From 4eaa872a4a480b689a628caeda2a588f335293d5 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Thu, 22 Aug 2024 13:52:26 +0530 Subject: [PATCH] removed transition for ListboxOptions --- .../e2e/facility_spec/facility_creation.cy.ts | 1 + src/Components/CameraFeed/AssetBedSelect.tsx | 39 ++-- src/Components/Form/MultiSelectMenuV2.tsx | 171 +++++++++--------- src/Components/Form/SelectMenuV2.tsx | 154 ++++++++-------- 4 files changed, 173 insertions(+), 192 deletions(-) diff --git a/cypress/e2e/facility_spec/facility_creation.cy.ts b/cypress/e2e/facility_spec/facility_creation.cy.ts index 6401ba7bbbe..a092d23390e 100644 --- a/cypress/e2e/facility_spec/facility_creation.cy.ts +++ b/cypress/e2e/facility_spec/facility_creation.cy.ts @@ -132,6 +132,7 @@ describe("Facility Creation", () => { facilityFeature.forEach((featureText) => { cy.get("[role='option']").contains(featureText).click(); }); + facilityPage.clickfacilityfeatureoption(); facilityPage.fillPincode("682001"); facilityPage.selectStateOnPincode("Kerala"); facilityPage.selectDistrictOnPincode("Ernakulam"); diff --git a/src/Components/CameraFeed/AssetBedSelect.tsx b/src/Components/CameraFeed/AssetBedSelect.tsx index 2d7b49d138c..b97675c7b31 100644 --- a/src/Components/CameraFeed/AssetBedSelect.tsx +++ b/src/Components/CameraFeed/AssetBedSelect.tsx @@ -4,7 +4,6 @@ import { ListboxButton, ListboxOption, ListboxOptions, - Transition, } from "@headlessui/react"; import CareIcon from "../../CAREUI/icons/CareIcon"; import { classNames } from "../../Utils/utils"; @@ -108,29 +107,23 @@ export const CameraPresetDropdown = ( - - - {options?.map((obj) => ( - - classNames(dropdownOptionClassNames(args), "px-2 py-1.5") - } - value={obj} - > - {label(obj)} - - ))} - - + {options?.map((obj) => ( + + classNames(dropdownOptionClassNames(args), "px-2 py-1.5") + } + value={obj} + > + {label(obj)} + + ))} + ); diff --git a/src/Components/Form/MultiSelectMenuV2.tsx b/src/Components/Form/MultiSelectMenuV2.tsx index eb01d0f837f..97f97cdb8ba 100644 --- a/src/Components/Form/MultiSelectMenuV2.tsx +++ b/src/Components/Form/MultiSelectMenuV2.tsx @@ -1,5 +1,4 @@ import CareIcon from "../../CAREUI/icons/CareIcon"; -import { DropdownTransition } from "../Common/components/HelperComponents"; import { Label, Listbox, @@ -93,97 +92,93 @@ const MultiSelectMenuV2 = (props: Props) => { } multiple > - {({ open }) => ( - <> - -
-
- -
-
-

- -

- - {selectedOptions.length !== 0 && ( -
- {selectedOptions.map((option, index) => ( - { - const updatedOptions = selectedOptions.filter( - (selectedOption) => - selectedOption.value !== option.value, - ); - props.onChange( - updatedOptions.map((o) => o.value) as any, - ); - }} - /> - ))} -
- )} -
- + <> + +
+
+ +
+
+

+ +

+ + {selectedOptions.length !== 0 && ( +
+ {selectedOptions.map((option, index) => ( + { + const updatedOptions = selectedOptions.filter( + (selectedOption) => + selectedOption.value !== option.value, + ); + props.onChange( + updatedOptions.map((o) => o.value) as any, + ); + }} + /> + ))} +
+ )}
- -
- - +
+ +
+ + {options.map((option, index) => ( + handleSingleSelect(option)} + disabled={option.disabled} > - {options.map((option, index) => ( - handleSingleSelect(option)} - disabled={option.disabled} - > - {({ focus }) => ( -
-
- {option.label} - {(option.icon || option.isSelected) && - (option.isSelected ? ( - - ) : ( - option.icon - ))} -
- {option.description && ( -

- {option.description} -

+ {({ focus }) => ( +
+
+ {option.label} + {(option.icon || option.isSelected) && + (option.isSelected ? ( + + ) : ( + option.icon + ))} +
+ {option.description && ( +

+ > + {option.description} +

)} - - ))} - - -
- - )} +
+ )} +
+ ))} +
+
+
); diff --git a/src/Components/Form/SelectMenuV2.tsx b/src/Components/Form/SelectMenuV2.tsx index 1b633078571..c416472fc12 100644 --- a/src/Components/Form/SelectMenuV2.tsx +++ b/src/Components/Form/SelectMenuV2.tsx @@ -5,7 +5,6 @@ import { ListboxOption, ListboxOptions, } from "@headlessui/react"; -import { DropdownTransition } from "../Common/components/HelperComponents"; import CareIcon from "../../CAREUI/icons/CareIcon"; import { dropdownOptionClassNames } from "./MultiSelectMenuV2"; import { classNames } from "../../Utils/utils"; @@ -94,92 +93,85 @@ const SelectMenuV2 = (props: SelectMenuProps) => { value={value} onChange={(selection: any) => props.onChange(selection.value)} > - {({ open }) => ( - <> - -
- -
-
- {props.showIconWhenSelected && value?.icon && ( -
- {value.icon} -
- )} -

- {value.selectedLabel} -

-
- {showChevronIcon && ( - + <> + +
+ +
+
+ {props.showIconWhenSelected && value?.icon && ( +
+ {value.icon} +
)} +

+ {value.selectedLabel} +

- -
)} - > - - - {options.map((option, index) => ( - - {({ focus, selected }) => ( -
-
- {option.label} - {props.optionIcon - ? option.icon - : selected && ( - - )} -
- {option.description && ( - - {option.description} - +
+ +
+ + {options.map((option, index) => ( + + {({ focus, selected }) => ( +
+
+ {option.label} + {props.optionIcon + ? option.icon + : selected && ( + + )} +
+ {option.description && ( + + > + {option.description} + )} - - ))} - - -
+
+ )} +
+ ))} +
- - )} +
+
);