From 5b86002b55fdaa86605ccd333625de29a58113ab Mon Sep 17 00:00:00 2001 From: mahi-19 Date: Tue, 27 Feb 2024 15:03:57 +0530 Subject: [PATCH 1/3] feat:Inline view of selected options of Multiselect --- src/Components/Form/MultiSelectMenuV2.tsx | 30 +++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Components/Form/MultiSelectMenuV2.tsx b/src/Components/Form/MultiSelectMenuV2.tsx index 25cd226e09e..b02d85d764c 100644 --- a/src/Components/Form/MultiSelectMenuV2.tsx +++ b/src/Components/Form/MultiSelectMenuV2.tsx @@ -61,9 +61,6 @@ const MultiSelectMenuV2 = (props: Props) => { if (selectedOptions.length === 0) return placeholder; if (props.renderSelectedOptions) return props.renderSelectedOptions(selectedOptions.map((o) => o.option)); - return ( - {`${selectedOptions.length} item(s) selected`} - ); }; return ( @@ -89,17 +86,30 @@ const MultiSelectMenuV2 = (props: Props) => {

+ + {selectedOptions.length !== 0 && ( +
+ {selectedOptions.map((option) => ( + { + const updatedOptions = selectedOptions.filter( + (selectedOption) => + selectedOption.value !== option.value + ); + props.onChange( + updatedOptions.map((o) => o.value) as any + ); + }} + /> + ))} +
+ )} - {selectedOptions.length !== 0 && ( -
- {selectedOptions.map((option) => ( - - ))} -
- )} From b791b917867bbeaaa5c3c6b8c3e20d6f94ae7a23 Mon Sep 17 00:00:00 2001 From: mahi-19 Date: Tue, 27 Feb 2024 16:40:46 +0530 Subject: [PATCH 2/3] fix: padding in input box --- src/Components/Form/MultiSelectMenuV2.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Form/MultiSelectMenuV2.tsx b/src/Components/Form/MultiSelectMenuV2.tsx index b02d85d764c..bc4c8751ea6 100644 --- a/src/Components/Form/MultiSelectMenuV2.tsx +++ b/src/Components/Form/MultiSelectMenuV2.tsx @@ -88,7 +88,7 @@ const MultiSelectMenuV2 = (props: Props) => {

{selectedOptions.length !== 0 && ( -
+
{selectedOptions.map((option) => ( { return ( -

{props.label}

+

{props.label}

{props.onRemove && (

Date: Tue, 27 Feb 2024 17:01:28 +0530 Subject: [PATCH 3/3] fix: padding --- src/Components/Form/MultiSelectMenuV2.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Form/MultiSelectMenuV2.tsx b/src/Components/Form/MultiSelectMenuV2.tsx index bc4c8751ea6..ecb7416b5fe 100644 --- a/src/Components/Form/MultiSelectMenuV2.tsx +++ b/src/Components/Form/MultiSelectMenuV2.tsx @@ -88,7 +88,7 @@ const MultiSelectMenuV2 = (props: Props) => {

{selectedOptions.length !== 0 && ( -
+
{selectedOptions.map((option) => ( { return ( -

{props.label}

+

{props.label}

{props.onRemove && (