-
- {this.renderSelectedList()}
+
+ {selectedValues.map((option) => (
+
+ {option.value}
+
+
+ ))}
{
- e.preventDefault();
- }}
+ className={clsx('optionListContainer', isOpen ? 'displayBlock' : 'displayNone')}
+ onMouseDown={(e) => e.preventDefault()}
>
- {this.renderOptionList()}
+
+ {visibleOptions.length === 0 && (
+ {intl.formatMessage(messages.noOptions)}
+ )}
+ {visibleOptions.map((option, i) => (
+ - onSelectItem(option)}
+ data-index={i}
+ tabIndex={0}
+ >
+ {option.value}
+
+ ))}
+
- );
- }
+
+ );
+};
- render() {
- return (
-
- {this.renderMultiselectContainer()}
-
- );
- }
-}
-
-Multiselect.defaultProps = {
- options: [],
- selectedValues: [],
- displayValue: 'model',
- placeholder: 'Select',
- emptyRecordMsg: 'No Options Available',
- onSelect: () => {},
- onRemove: () => {},
- onKeyPressFn: () => {},
- id: '',
- name: '',
- disabled: false,
- className: '',
-} as IMultiselectProps;
+export { Multiselect };
diff --git a/packages/pl-fe/src/features/forms/index.tsx b/packages/pl-fe/src/features/forms/index.tsx
index b5f2edf96..fa8c33cc4 100644
--- a/packages/pl-fe/src/features/forms/index.tsx
+++ b/packages/pl-fe/src/features/forms/index.tsx
@@ -1,14 +1,7 @@
-import React, { useMemo } from 'react';
-import { defineMessages, useIntl } from 'react-intl';
+import React from 'react';
-import { Multiselect as Ms } from '@/components/ui/multiselect';
import Select from '@/components/ui/select';
-const messages = defineMessages({
- selectPlaceholder: { id: 'select.placeholder', defaultMessage: 'Select' },
- selectNoOptions: { id: 'select.no_options', defaultMessage: 'No options available' },
-});
-
interface ISelectDropdown {
className?: string;
label?: React.ReactNode;
@@ -30,43 +23,4 @@ const SelectDropdown: React.FC
= (props) => {
return ;
};
-interface IMultiselect {
- className?: string;
- items: Record;
- value?: string[];
- onChange?: (values: string[]) => void;
- disabled?: boolean;
-}
-
-const Multiselect: React.FC = (props) => {
- const intl = useIntl();
- const { items, value, onChange, disabled } = props;
-
- const options = useMemo(
- () => Object.entries(items).map(([key, value]) => ({ key, value })),
- [items],
- );
- const selectedValues = value
- ?.map((key) => options.find((option) => option.key === key))
- .filter((value) => value);
-
- const handleChange = (values: Record<'key' | 'value', string>[]) => {
- onChange?.(values.map(({ key }) => key));
- };
-
- return (
-
- );
-};
-
-export { Multiselect, SelectDropdown };
+export { SelectDropdown };
diff --git a/packages/pl-fe/src/features/preferences/index.tsx b/packages/pl-fe/src/features/preferences/index.tsx
index 99c6bc309..3206dd5df 100644
--- a/packages/pl-fe/src/features/preferences/index.tsx
+++ b/packages/pl-fe/src/features/preferences/index.tsx
@@ -7,8 +7,9 @@ import List, { ListItem } from '@/components/list';
import Button from '@/components/ui/button';
import Form from '@/components/ui/form';
import HStack from '@/components/ui/hstack';
+import { Multiselect } from '@/components/ui/multiselect';
import StepSlider from '@/components/ui/step-slider';
-import { Multiselect, SelectDropdown } from '@/features/forms';
+import { SelectDropdown } from '@/features/forms';
import SettingToggle from '@/features/settings/components/setting-toggle';
import { useAppDispatch } from '@/hooks/use-app-dispatch';
import { useAppSelector } from '@/hooks/use-app-selector';
diff --git a/packages/pl-fe/src/locales/en.json b/packages/pl-fe/src/locales/en.json
index b40391cdf..b584df495 100644
--- a/packages/pl-fe/src/locales/en.json
+++ b/packages/pl-fe/src/locales/en.json
@@ -1774,6 +1774,7 @@
"security.update_password.success": "Password successfully updated.",
"select.no_options": "No options available",
"select.placeholder": "Select",
+ "select.remove_item": "Remove item",
"select_bookmark_folder_modal.header_title": "Select folder",
"settings.configure_mfa": "Configure MFA",
"settings.edit_profile": "Edit profile",
diff --git a/packages/pl-fe/src/styles/forms.scss b/packages/pl-fe/src/styles/forms.scss
index 92c1c56fb..9985a8d63 100644
--- a/packages/pl-fe/src/styles/forms.scss
+++ b/packages/pl-fe/src/styles/forms.scss
@@ -84,11 +84,6 @@ select {
z-index: 2;
}
- .highlightOption {
- @apply bg-primary-600;
- color: #fff;
- }
-
.displayBlock {
display: block;
}
@@ -108,5 +103,10 @@ select {
.option {
@apply hover:bg-primary-600;
+
+ &:focus {
+ @apply bg-primary-600;
+ color: #fff;
+ }
}
}