diff --git a/apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx b/apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx index 9e2b7412ad7e..e976c1f1a3b0 100644 --- a/apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx +++ b/apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx @@ -1,10 +1,11 @@ import type { IRole } from '@rocket.chat/core-typings'; -import { Box, Icon, TextInput } from '@rocket.chat/fuselage'; +import { useBreakpoints } from '@rocket.chat/fuselage-hooks'; import type { OptionProp } from '@rocket.chat/ui-client'; import { MultiSelectCustom } from '@rocket.chat/ui-client'; import React, { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; +import FilterByText from '../../../../components/FilterByText'; import type { UsersFilters } from '../AdminUsersPage'; type UsersTableFiltersProps = { @@ -19,8 +20,7 @@ const UsersTableFilters = ({ roleData, setUsersFilters }: UsersTableFiltersProps const [text, setText] = useState(''); const handleSearchTextChange = useCallback( - (event) => { - const text = event.currentTarget.value; + ({ text }) => { setUsersFilters({ text, roles: selectedRoles }); setText(text); }, @@ -57,37 +57,21 @@ const UsersTableFilters = ({ roleData, setUsersFilters }: UsersTableFiltersProps [roleData], ); + const breakpoints = useBreakpoints(); + const fixFiltersSize = breakpoints.includes('lg') ? { maxWidth: 'x200', minWidth: 'x200' } : null; + return ( - e.preventDefault(), [])} - mb='x8' - display='flex' - flexWrap='wrap' - alignItems='center' - justifyContent='center' - > - - } - onChange={handleSearchTextChange} - value={text} - /> - - - - - + + + ); }; diff --git a/packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustom.tsx b/packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustom.tsx index 08abd33b383e..bc0dcc45a7ed 100644 --- a/packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustom.tsx +++ b/packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustom.tsx @@ -1,7 +1,7 @@ -import { Box } from '@rocket.chat/fuselage'; -import { useOutsideClick, useToggle } from '@rocket.chat/fuselage-hooks'; +import { Button } from '@rocket.chat/fuselage'; +import { useToggle } from '@rocket.chat/fuselage-hooks'; import type { TranslationKey } from '@rocket.chat/ui-contexts'; -import type { FormEvent, ReactElement, RefObject } from 'react'; +import type { ComponentProps, FormEvent, ReactElement, RefObject } from 'react'; import { useCallback, useRef } from 'react'; import MultiSelectCustomAnchor from './MultiSelectCustomAnchor'; @@ -48,7 +48,7 @@ type DropDownProps = { selectedOptions: OptionProp[]; setSelectedOptions: (roles: OptionProp[]) => void; searchBarText?: TranslationKey; -}; +} & ComponentProps; export const MultiSelectCustom = ({ dropdownOptions, @@ -57,9 +57,9 @@ export const MultiSelectCustom = ({ selectedOptions, setSelectedOptions, searchBarText, + ...props }: DropDownProps): ReactElement => { const reference = useRef(null); - const target = useRef(null); const [collapsed, toggleCollapsed] = useToggle(false); const onClose = useCallback( @@ -74,8 +74,6 @@ export const MultiSelectCustom = ({ [toggleCollapsed], ); - useOutsideClick([target], onClose); - const onSelect = (item: OptionProp, e?: FormEvent): void => { e?.stopPropagation(); item.checked = !item.checked; @@ -92,7 +90,7 @@ export const MultiSelectCustom = ({ const count = dropdownOptions.filter((option) => option.checked).length; return ( - + <> {collapsed && ( - + )} - + ); }; diff --git a/packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustomAnchor.tsx b/packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustomAnchor.tsx index 0a8aee69344b..208c25bb6ee1 100644 --- a/packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustomAnchor.tsx +++ b/packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustomAnchor.tsx @@ -1,5 +1,5 @@ import { css } from '@rocket.chat/css-in-js'; -import { Box, Icon } from '@rocket.chat/fuselage'; +import { Box, Icon, Palette } from '@rocket.chat/fuselage'; import type { TranslationKey } from '@rocket.chat/ui-contexts'; import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentProps } from 'react'; @@ -27,6 +27,7 @@ const MultiSelectCustomAnchor = forwardRef {isDirty ? `${t(selectedOptionsTitle)} (${selectedOptionsCount})` : t(defaultTitle)}