@persona/design-system 0.1.5-pre.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +461 -0
- package/LICENSE +77 -0
- package/README.md +9 -0
- package/dist/Action-B10lxofb.d.mts +35 -0
- package/dist/Action-uduFOh2m.d.cts +35 -0
- package/dist/Action.d.cts +2 -0
- package/dist/Action.d.mts +2 -0
- package/dist/Attribute.d.cts +107 -0
- package/dist/Attribute.d.mts +107 -0
- package/dist/AttributeGrid.d.cts +40 -0
- package/dist/AttributeGrid.d.mts +41 -0
- package/dist/Badge-BqLnhb4n.mjs +34 -0
- package/dist/Badge-BqLnhb4n.mjs.map +1 -0
- package/dist/Badge-BwAZD9BH.cjs +41 -0
- package/dist/Badge-BwAZD9BH.cjs.map +1 -0
- package/dist/Badge.d.cts +25 -0
- package/dist/Badge.d.mts +25 -0
- package/dist/Banner.d.cts +48 -0
- package/dist/Banner.d.mts +48 -0
- package/dist/Button-C_3p5Xfi.d.cts +101 -0
- package/dist/Button-DqDLGURJ.d.mts +101 -0
- package/dist/Button.d.cts +2 -0
- package/dist/Button.d.mts +2 -0
- package/dist/ButtonGroup.d.cts +20 -0
- package/dist/ButtonGroup.d.mts +20 -0
- package/dist/Calendar.d.cts +11 -0
- package/dist/Calendar.d.mts +12 -0
- package/dist/CalendarBase.d.mts +12 -0
- package/dist/CalendarCell.d.mts +18 -0
- package/dist/CalendarGrid.d.mts +18 -0
- package/dist/Card-CcU9cKCd.d.mts +52 -0
- package/dist/Card-CrQL0hXm.d.cts +52 -0
- package/dist/Card-CyCKL-M5.cjs +248 -0
- package/dist/Card-CyCKL-M5.cjs.map +1 -0
- package/dist/Card-DeJSt5ys.mjs +205 -0
- package/dist/Card-DeJSt5ys.mjs.map +1 -0
- package/dist/Card.d.cts +2 -0
- package/dist/Card.d.mts +2 -0
- package/dist/Card2.d.cts +95 -0
- package/dist/Card2.d.mts +96 -0
- package/dist/Checkbox-BWJNAP27.d.mts +46 -0
- package/dist/Checkbox-BmjK0Wac.d.cts +46 -0
- package/dist/Checkbox-C5bGcb-r.mjs +176 -0
- package/dist/Checkbox-C5bGcb-r.mjs.map +1 -0
- package/dist/Checkbox-D4nv7eNs.cjs +183 -0
- package/dist/Checkbox-D4nv7eNs.cjs.map +1 -0
- package/dist/Checkbox.d.cts +2 -0
- package/dist/Checkbox.d.mts +2 -0
- package/dist/CheckboxGroupField.d.cts +24 -0
- package/dist/CheckboxGroupField.d.mts +25 -0
- package/dist/Combobox-B_-swcix.mjs +1672 -0
- package/dist/Combobox-B_-swcix.mjs.map +1 -0
- package/dist/Combobox-B_oe33Re.cjs +1692 -0
- package/dist/Combobox-B_oe33Re.cjs.map +1 -0
- package/dist/Combobox-DjbJYK_u.d.mts +11 -0
- package/dist/Combobox.d.cts +12 -0
- package/dist/Combobox.d.mts +3 -0
- package/dist/ComboboxBase-D2wypeXf.d.cts +320 -0
- package/dist/ComboboxBase-INya0Csa.d.mts +320 -0
- package/dist/ComboboxBase.d.cts +2 -0
- package/dist/ComboboxBase.d.mts +2 -0
- package/dist/ComboboxMultiSelect-Dn8cRZ6Z.d.cts +47 -0
- package/dist/ComboboxMultiSelect-Dq9DGH8S.d.mts +47 -0
- package/dist/ComboboxMultiSelect.d.cts +2 -0
- package/dist/ComboboxMultiSelect.d.mts +2 -0
- package/dist/ComboboxSingleSelect-D8YM7GKP.d.cts +35 -0
- package/dist/ComboboxSingleSelect-WwBJRb0e.d.mts +35 -0
- package/dist/ComboboxSingleSelect.d.cts +2 -0
- package/dist/ComboboxSingleSelect.d.mts +2 -0
- package/dist/ConfigFormGroup.d.cts +7 -0
- package/dist/ConfigFormGroup.d.mts +7 -0
- package/dist/DateField-Bwe_0qm9.d.cts +24 -0
- package/dist/DateField-Chko9oLb.d.mts +24 -0
- package/dist/DateField.d.cts +2 -0
- package/dist/DateField.d.mts +2 -0
- package/dist/DatePicker.d.cts +19 -0
- package/dist/DatePicker.d.mts +19 -0
- package/dist/DateRangePicker.d.cts +46 -0
- package/dist/DateRangePicker.d.mts +47 -0
- package/dist/DropdownButton-DO4NqvWR.cjs +33 -0
- package/dist/DropdownButton-DO4NqvWR.cjs.map +1 -0
- package/dist/DropdownButton-k9kEcexu.mjs +27 -0
- package/dist/DropdownButton-k9kEcexu.mjs.map +1 -0
- package/dist/DropdownButton.d.cts +26 -0
- package/dist/DropdownButton.d.mts +26 -0
- package/dist/DropdownMenu-BTk--LWo.mjs +60 -0
- package/dist/DropdownMenu-BTk--LWo.mjs.map +1 -0
- package/dist/DropdownMenu-Bm2QqLEq.d.cts +75 -0
- package/dist/DropdownMenu-D2fzpkX2.cjs +74 -0
- package/dist/DropdownMenu-D2fzpkX2.cjs.map +1 -0
- package/dist/DropdownMenu-rWgROxQe.d.mts +75 -0
- package/dist/DropdownMenu.d.cts +2 -0
- package/dist/DropdownMenu.d.mts +2 -0
- package/dist/ErrorProps-DLdVsYlk.d.cts +8 -0
- package/dist/ErrorProps-DYUKygmd.d.mts +8 -0
- package/dist/ErrorProps.d.cts +2 -0
- package/dist/ErrorProps.d.mts +2 -0
- package/dist/FormControl-BXHqI_2D.mjs +168 -0
- package/dist/FormControl-BXHqI_2D.mjs.map +1 -0
- package/dist/FormControl-CM7wTn1P.d.mts +60 -0
- package/dist/FormControl-DiR2e7Od.cjs +212 -0
- package/dist/FormControl-DiR2e7Od.cjs.map +1 -0
- package/dist/FormControl-KkeIYuBa.d.cts +60 -0
- package/dist/FormControl.d.cts +2 -0
- package/dist/FormControl.d.mts +2 -0
- package/dist/FormField-19ownwjH.d.cts +69 -0
- package/dist/FormField-CdMru4s5.d.mts +69 -0
- package/dist/FormField.d.cts +2 -0
- package/dist/FormField.d.mts +2 -0
- package/dist/Header-D8oDtnIL.d.cts +35 -0
- package/dist/Header-t1plnZc0.d.mts +35 -0
- package/dist/Header.d.cts +2 -0
- package/dist/Header.d.mts +2 -0
- package/dist/HelperTooltip-Cd7I0Ucq.d.mts +20 -0
- package/dist/HelperTooltip-oXdyk2At.d.cts +20 -0
- package/dist/HelperTooltip.d.cts +2 -0
- package/dist/HelperTooltip.d.mts +2 -0
- package/dist/IconButton-B1ZL8BqW.cjs +372 -0
- package/dist/IconButton-B1ZL8BqW.cjs.map +1 -0
- package/dist/IconButton-C28qxOdi.mjs +341 -0
- package/dist/IconButton-C28qxOdi.mjs.map +1 -0
- package/dist/IconButton-DsXbc3nQ.d.mts +24 -0
- package/dist/IconButton-ZcyTFjPn.d.cts +24 -0
- package/dist/IconButton.d.cts +2 -0
- package/dist/IconButton.d.mts +2 -0
- package/dist/ImageTile.d.cts +60 -0
- package/dist/ImageTile.d.mts +60 -0
- package/dist/Input-Cv5qieRg.d.mts +65 -0
- package/dist/Input-DHOsR4cl.cjs +210 -0
- package/dist/Input-DHOsR4cl.cjs.map +1 -0
- package/dist/Input-XppkvfUf.d.cts +65 -0
- package/dist/Input-eoFk39bE.mjs +191 -0
- package/dist/Input-eoFk39bE.mjs.map +1 -0
- package/dist/Input.d.cts +2 -0
- package/dist/Input.d.mts +2 -0
- package/dist/InputProps-BHu05fX0.d.mts +16 -0
- package/dist/InputProps-CitGo8QA.d.cts +16 -0
- package/dist/InputProps.d.cts +2 -0
- package/dist/InputProps.d.mts +2 -0
- package/dist/Link.d.cts +43 -0
- package/dist/Link.d.mts +43 -0
- package/dist/ListBox-AyjzT6ra.d.mts +138 -0
- package/dist/ListBox-CE3mfDSB.cjs +383 -0
- package/dist/ListBox-CE3mfDSB.cjs.map +1 -0
- package/dist/ListBox-DbyZFy2W.d.cts +138 -0
- package/dist/ListBox-Z1y0LG1H.mjs +369 -0
- package/dist/ListBox-Z1y0LG1H.mjs.map +1 -0
- package/dist/ListBox.d.cts +2 -0
- package/dist/ListBox.d.mts +2 -0
- package/dist/ListBoxField.d.cts +46 -0
- package/dist/ListBoxField.d.mts +47 -0
- package/dist/LoadingShimmer-CNE6JUVF.mjs +67 -0
- package/dist/LoadingShimmer-CNE6JUVF.mjs.map +1 -0
- package/dist/LoadingShimmer-DMK9RC4N.cjs +92 -0
- package/dist/LoadingShimmer-DMK9RC4N.cjs.map +1 -0
- package/dist/LoadingShimmer.d.cts +38 -0
- package/dist/LoadingShimmer.d.mts +38 -0
- package/dist/MaskedInput.d.cts +10 -0
- package/dist/MaskedInput.d.mts +10 -0
- package/dist/MatchHighlight.d.cts +11 -0
- package/dist/MatchHighlight.d.mts +11 -0
- package/dist/Menu-BpkjNO81.cjs +217 -0
- package/dist/Menu-BpkjNO81.cjs.map +1 -0
- package/dist/Menu-DIFkRQ6x.d.mts +70 -0
- package/dist/Menu-DNRHo2i_.mjs +167 -0
- package/dist/Menu-DNRHo2i_.mjs.map +1 -0
- package/dist/Menu-DPrNMatb.d.cts +70 -0
- package/dist/Menu.d.cts +2 -0
- package/dist/Menu.d.mts +2 -0
- package/dist/Modal.d.cts +141 -0
- package/dist/Modal.d.mts +141 -0
- package/dist/PageHeader.d.cts +26 -0
- package/dist/PageHeader.d.mts +26 -0
- package/dist/PageSelector.d.cts +30 -0
- package/dist/PageSelector.d.mts +30 -0
- package/dist/PageSizeSelector.d.mts +22 -0
- package/dist/Pagination.d.cts +33 -0
- package/dist/Pagination.d.mts +33 -0
- package/dist/Pii.d.cts +16 -0
- package/dist/Pii.d.mts +17 -0
- package/dist/Popover-BSdyxuja.mjs +124 -0
- package/dist/Popover-BSdyxuja.mjs.map +1 -0
- package/dist/Popover-C2dBSwiU.cjs +168 -0
- package/dist/Popover-C2dBSwiU.cjs.map +1 -0
- package/dist/Popover.d.cts +90 -0
- package/dist/Popover.d.mts +90 -0
- package/dist/ProgressBar.d.cts +83 -0
- package/dist/ProgressBar.d.mts +83 -0
- package/dist/ProgressIndicator.d.cts +64 -0
- package/dist/ProgressIndicator.d.mts +64 -0
- package/dist/PseudoClassProps-C5jpj6Rp.d.cts +12 -0
- package/dist/PseudoClassProps-mZgO_iZJ.d.mts +12 -0
- package/dist/PseudoClassProps.d.cts +2 -0
- package/dist/PseudoClassProps.d.mts +2 -0
- package/dist/Radio-mFfT6G3d.cjs +154 -0
- package/dist/Radio-mFfT6G3d.cjs.map +1 -0
- package/dist/Radio-w-L3Otuk.mjs +147 -0
- package/dist/Radio-w-L3Otuk.mjs.map +1 -0
- package/dist/Radio.d.cts +21 -0
- package/dist/Radio.d.mts +21 -0
- package/dist/RadioGroup-B8htTzsS.mjs +50 -0
- package/dist/RadioGroup-B8htTzsS.mjs.map +1 -0
- package/dist/RadioGroup-BjDmweRK.cjs +57 -0
- package/dist/RadioGroup-BjDmweRK.cjs.map +1 -0
- package/dist/RadioGroup-D5ueuC6a.d.cts +21 -0
- package/dist/RadioGroup-Ls0vPsP_.d.mts +21 -0
- package/dist/RadioGroup.d.cts +2 -0
- package/dist/RadioGroup.d.mts +2 -0
- package/dist/RangeCalendar.d.mts +33 -0
- package/dist/RangeCalendarPresets.d.mts +25 -0
- package/dist/RegisterComponent-BDb43KvI.d.mts +34 -0
- package/dist/RegisterComponent-CpXIR-51.d.cts +34 -0
- package/dist/Section.d.mts +67 -0
- package/dist/SectionHeading-DVSXofwK.d.cts +72 -0
- package/dist/SectionHeading-QvAmhVmD.d.mts +72 -0
- package/dist/SectionHeading.d.cts +2 -0
- package/dist/SectionHeading.d.mts +2 -0
- package/dist/SegmentedControl-CvznPXgC.cjs +124 -0
- package/dist/SegmentedControl-CvznPXgC.cjs.map +1 -0
- package/dist/SegmentedControl-DRtXdbLe.d.cts +59 -0
- package/dist/SegmentedControl-Dk5S4Dhz.d.mts +59 -0
- package/dist/SegmentedControl-DnwNjYre.mjs +111 -0
- package/dist/SegmentedControl-DnwNjYre.mjs.map +1 -0
- package/dist/SegmentedControl.d.cts +2 -0
- package/dist/SegmentedControl.d.mts +2 -0
- package/dist/Select-BdPdgtfU.d.cts +77 -0
- package/dist/Select-CVB-Q1g1.cjs +266 -0
- package/dist/Select-CVB-Q1g1.cjs.map +1 -0
- package/dist/Select-Cl3AOq0-.mjs +246 -0
- package/dist/Select-Cl3AOq0-.mjs.map +1 -0
- package/dist/Select-DRnRqMAL.d.mts +77 -0
- package/dist/Select.d.cts +2 -0
- package/dist/Select.d.mts +2 -0
- package/dist/Slider-D3gz7otf.d.mts +56 -0
- package/dist/Slider-uH5MOu2D.d.cts +56 -0
- package/dist/Slider.d.cts +2 -0
- package/dist/Slider.d.mts +2 -0
- package/dist/SliderRHF-Cc-9RuPe.d.cts +984 -0
- package/dist/SliderRHF-DIV-tCEv.d.mts +984 -0
- package/dist/SliderRHF.d.cts +2 -0
- package/dist/SliderRHF.d.mts +2 -0
- package/dist/SliderThumb.d.mts +139 -0
- package/dist/Spacer-DWGkX170.cjs +20 -0
- package/dist/Spacer-DWGkX170.cjs.map +1 -0
- package/dist/Spacer-DxH_sQrV.mjs +13 -0
- package/dist/Spacer-DxH_sQrV.mjs.map +1 -0
- package/dist/Spacer.d.cts +17 -0
- package/dist/Spacer.d.mts +18 -0
- package/dist/Spinner-C05An_fn.mjs +41 -0
- package/dist/Spinner-C05An_fn.mjs.map +1 -0
- package/dist/Spinner-z7DrPE1d.cjs +48 -0
- package/dist/Spinner-z7DrPE1d.cjs.map +1 -0
- package/dist/Spinner.d.cts +26 -0
- package/dist/Spinner.d.mts +26 -0
- package/dist/Stack-BHb3ZB2A.cjs +53 -0
- package/dist/Stack-BHb3ZB2A.cjs.map +1 -0
- package/dist/Stack-BntgUvsW.d.mts +47 -0
- package/dist/Stack-hwgS2FU1.mjs +40 -0
- package/dist/Stack-hwgS2FU1.mjs.map +1 -0
- package/dist/Stack-toDRLy--.d.cts +47 -0
- package/dist/Stack.d.cts +2 -0
- package/dist/Stack.d.mts +2 -0
- package/dist/StatusIndicator.d.cts +54 -0
- package/dist/StatusIndicator.d.mts +54 -0
- package/dist/Sticker-Bd7KkekO.d.mts +68 -0
- package/dist/Sticker-D6bwBTGr.mjs +215 -0
- package/dist/Sticker-D6bwBTGr.mjs.map +1 -0
- package/dist/Sticker-D_dutvp_.cjs +246 -0
- package/dist/Sticker-D_dutvp_.cjs.map +1 -0
- package/dist/Sticker-S6QWjlEJ.d.cts +68 -0
- package/dist/Sticker.d.cts +2 -0
- package/dist/Sticker.d.mts +2 -0
- package/dist/SwatchPicker.d.cts +18 -0
- package/dist/SwatchPicker.d.mts +18 -0
- package/dist/Tab.d.cts +26 -0
- package/dist/Tab.d.mts +26 -0
- package/dist/TabBar-BMv8dAS3.cjs +297 -0
- package/dist/TabBar-BMv8dAS3.cjs.map +1 -0
- package/dist/TabBar-Bf89XksH.mjs +266 -0
- package/dist/TabBar-Bf89XksH.mjs.map +1 -0
- package/dist/TabBar.d.cts +33 -0
- package/dist/TabBar.d.mts +33 -0
- package/dist/TabBarContext.d.mts +10 -0
- package/dist/TabBarIconButton.d.cts +10 -0
- package/dist/TabBarIconButton.d.mts +11 -0
- package/dist/Table-34f5m7w5.d.mts +13 -0
- package/dist/Table-DkAA1lt_.d.cts +13 -0
- package/dist/Table.d.cts +2 -0
- package/dist/Table.d.mts +2 -0
- package/dist/TableBody-5QcVMPP_.d.cts +9 -0
- package/dist/TableBody-Clf34yzJ.d.mts +9 -0
- package/dist/TableBody.d.cts +2 -0
- package/dist/TableBody.d.mts +2 -0
- package/dist/TableCell-DIs9h97h.d.cts +75 -0
- package/dist/TableCell-Dog4Blfq.d.mts +75 -0
- package/dist/TableCell.d.cts +2 -0
- package/dist/TableCell.d.mts +2 -0
- package/dist/TableHead-9LLM1B8I.d.cts +12 -0
- package/dist/TableHead-DJBGHoUD.d.mts +12 -0
- package/dist/TableHead.d.cts +2 -0
- package/dist/TableHead.d.mts +2 -0
- package/dist/TableHeaderCell-25lC9tNk.d.cts +17 -0
- package/dist/TableHeaderCell-DzYZq7SG.d.mts +17 -0
- package/dist/TableHeaderCell.d.cts +2 -0
- package/dist/TableHeaderCell.d.mts +2 -0
- package/dist/TableLayout-BA3jbdbi.d.mts +19 -0
- package/dist/TableLayout-CmDKOu10.d.cts +19 -0
- package/dist/TableLayout.d.cts +2 -0
- package/dist/TableLayout.d.mts +2 -0
- package/dist/TableRow-CBKpDeUV.d.mts +13 -0
- package/dist/TableRow-IPjQnK2q.d.cts +13 -0
- package/dist/TableRow.d.cts +2 -0
- package/dist/TableRow.d.mts +2 -0
- package/dist/TableTH.d.cts +2 -0
- package/dist/TableTH.d.mts +2 -0
- package/dist/Text-CnXedFut.d.mts +42 -0
- package/dist/Text-CrGiWG2E.d.cts +42 -0
- package/dist/Text-DOTYjIt0.mjs +58 -0
- package/dist/Text-DOTYjIt0.mjs.map +1 -0
- package/dist/Text-DVz8erdF.cjs +95 -0
- package/dist/Text-DVz8erdF.cjs.map +1 -0
- package/dist/Text.d.cts +2 -0
- package/dist/Text.d.mts +2 -0
- package/dist/TextArea-1bHvaq9p.d.mts +10 -0
- package/dist/TextArea-B1kitxCl.mjs +33 -0
- package/dist/TextArea-B1kitxCl.mjs.map +1 -0
- package/dist/TextArea-MVgGGM6r.cjs +40 -0
- package/dist/TextArea-MVgGGM6r.cjs.map +1 -0
- package/dist/TextArea-j43fhp2P.d.cts +10 -0
- package/dist/TextArea.d.cts +2 -0
- package/dist/TextArea.d.mts +2 -0
- package/dist/TextUnderlineTooltip-BDMs4iXn.d.cts +18 -0
- package/dist/TextUnderlineTooltip-z4sSGL91.d.mts +18 -0
- package/dist/TextUnderlineTooltip.d.cts +2 -0
- package/dist/TextUnderlineTooltip.d.mts +2 -0
- package/dist/Tile.d.cts +63 -0
- package/dist/Tile.d.mts +63 -0
- package/dist/Toast.d.cts +27 -0
- package/dist/Toast.d.mts +27 -0
- package/dist/Toggle-8GNRxyvE.mjs +167 -0
- package/dist/Toggle-8GNRxyvE.mjs.map +1 -0
- package/dist/Toggle-B3Cdyf7T.d.mts +54 -0
- package/dist/Toggle-BjkbL_uf.d.cts +54 -0
- package/dist/Toggle-CVdg5iQ0.cjs +174 -0
- package/dist/Toggle-CVdg5iQ0.cjs.map +1 -0
- package/dist/Toggle.d.cts +2 -0
- package/dist/Toggle.d.mts +2 -0
- package/dist/Tooltip-0i_15ysU.cjs +152 -0
- package/dist/Tooltip-0i_15ysU.cjs.map +1 -0
- package/dist/Tooltip-C0PS5InA.d.mts +100 -0
- package/dist/Tooltip-CE1oH6Iz.d.cts +100 -0
- package/dist/Tooltip-T7RQpy_a.mjs +120 -0
- package/dist/Tooltip-T7RQpy_a.mjs.map +1 -0
- package/dist/Tooltip.d.cts +2 -0
- package/dist/Tooltip.d.mts +2 -0
- package/dist/TruncatedText-0Tf8CwFX.d.mts +18 -0
- package/dist/TruncatedText-D8f3AiBL.d.cts +18 -0
- package/dist/chunk-Bpcn9VDT.mjs +39 -0
- package/dist/chunk-CoPdw6nB.cjs +64 -0
- package/dist/common.d.mts +7 -0
- package/dist/components/Attribute/index.cjs +210 -0
- package/dist/components/Attribute/index.cjs.map +1 -0
- package/dist/components/Attribute/index.d.cts +3 -0
- package/dist/components/Attribute/index.d.mts +3 -0
- package/dist/components/Attribute/index.mjs +198 -0
- package/dist/components/Attribute/index.mjs.map +1 -0
- package/dist/components/Badge/index.cjs +8 -0
- package/dist/components/Badge/index.d.cts +2 -0
- package/dist/components/Badge/index.d.mts +2 -0
- package/dist/components/Badge/index.mjs +2 -0
- package/dist/components/Banner/index.cjs +100 -0
- package/dist/components/Banner/index.cjs.map +1 -0
- package/dist/components/Banner/index.d.cts +2 -0
- package/dist/components/Banner/index.d.mts +2 -0
- package/dist/components/Banner/index.mjs +93 -0
- package/dist/components/Banner/index.mjs.map +1 -0
- package/dist/components/Button/index.cjs +12 -0
- package/dist/components/Button/index.d.cts +3 -0
- package/dist/components/Button/index.d.mts +3 -0
- package/dist/components/Button/index.mjs +2 -0
- package/dist/components/ButtonGroup/index.cjs +112 -0
- package/dist/components/ButtonGroup/index.cjs.map +1 -0
- package/dist/components/ButtonGroup/index.d.cts +2 -0
- package/dist/components/ButtonGroup/index.d.mts +2 -0
- package/dist/components/ButtonGroup/index.mjs +103 -0
- package/dist/components/ButtonGroup/index.mjs.map +1 -0
- package/dist/components/Card/index.cjs +13 -0
- package/dist/components/Card/index.d.cts +3 -0
- package/dist/components/Card/index.d.mts +3 -0
- package/dist/components/Card/index.mjs +2 -0
- package/dist/components/CardV2/index.cjs +512 -0
- package/dist/components/CardV2/index.cjs.map +1 -0
- package/dist/components/CardV2/index.d.cts +3 -0
- package/dist/components/CardV2/index.d.mts +3 -0
- package/dist/components/CardV2/index.mjs +511 -0
- package/dist/components/CardV2/index.mjs.map +1 -0
- package/dist/components/Checkbox/index.cjs +8 -0
- package/dist/components/Checkbox/index.d.cts +2 -0
- package/dist/components/Checkbox/index.d.mts +2 -0
- package/dist/components/Checkbox/index.mjs +2 -0
- package/dist/components/Combobox/index.cjs +10 -0
- package/dist/components/Combobox/index.d.cts +3 -0
- package/dist/components/Combobox/index.d.mts +3 -0
- package/dist/components/Combobox/index.mjs +2 -0
- package/dist/components/ConfigFormGroup/index.cjs +37 -0
- package/dist/components/ConfigFormGroup/index.cjs.map +1 -0
- package/dist/components/ConfigFormGroup/index.d.cts +3 -0
- package/dist/components/ConfigFormGroup/index.d.mts +3 -0
- package/dist/components/ConfigFormGroup/index.mjs +28 -0
- package/dist/components/ConfigFormGroup/index.mjs.map +1 -0
- package/dist/components/DatePicker/index.cjs +11503 -0
- package/dist/components/DatePicker/index.cjs.map +1 -0
- package/dist/components/DatePicker/index.d.cts +5 -0
- package/dist/components/DatePicker/index.d.mts +5 -0
- package/dist/components/DatePicker/index.mjs +11491 -0
- package/dist/components/DatePicker/index.mjs.map +1 -0
- package/dist/components/DropdownButton/index.cjs +8 -0
- package/dist/components/DropdownButton/index.d.cts +2 -0
- package/dist/components/DropdownButton/index.d.mts +2 -0
- package/dist/components/DropdownButton/index.mjs +2 -0
- package/dist/components/DropdownMenu/index.cjs +8 -0
- package/dist/components/DropdownMenu/index.d.cts +2 -0
- package/dist/components/DropdownMenu/index.d.mts +2 -0
- package/dist/components/DropdownMenu/index.mjs +2 -0
- package/dist/components/FormControl/index.cjs +16 -0
- package/dist/components/FormControl/index.d.cts +3 -0
- package/dist/components/FormControl/index.d.mts +3 -0
- package/dist/components/FormControl/index.mjs +3 -0
- package/dist/components/FormField/index.cjs +385 -0
- package/dist/components/FormField/index.cjs.map +1 -0
- package/dist/components/FormField/index.d.cts +5 -0
- package/dist/components/FormField/index.d.mts +5 -0
- package/dist/components/FormField/index.mjs +367 -0
- package/dist/components/FormField/index.mjs.map +1 -0
- package/dist/components/ImageTile/index.cjs +228 -0
- package/dist/components/ImageTile/index.cjs.map +1 -0
- package/dist/components/ImageTile/index.d.cts +2 -0
- package/dist/components/ImageTile/index.d.mts +2 -0
- package/dist/components/ImageTile/index.mjs +221 -0
- package/dist/components/ImageTile/index.mjs.map +1 -0
- package/dist/components/Input/index.cjs +15 -0
- package/dist/components/Input/index.cjs.map +1 -0
- package/dist/components/Input/index.d.cts +2 -0
- package/dist/components/Input/index.d.mts +2 -0
- package/dist/components/Input/index.mjs +7 -0
- package/dist/components/Input/index.mjs.map +1 -0
- package/dist/components/Link/index.cjs +87 -0
- package/dist/components/Link/index.cjs.map +1 -0
- package/dist/components/Link/index.d.cts +2 -0
- package/dist/components/Link/index.d.mts +2 -0
- package/dist/components/Link/index.mjs +80 -0
- package/dist/components/Link/index.mjs.map +1 -0
- package/dist/components/ListBox/index.cjs +9 -0
- package/dist/components/ListBox/index.d.cts +2 -0
- package/dist/components/ListBox/index.d.mts +2 -0
- package/dist/components/ListBox/index.mjs +2 -0
- package/dist/components/LoadingShimmer/index.cjs +7 -0
- package/dist/components/LoadingShimmer/index.d.cts +2 -0
- package/dist/components/LoadingShimmer/index.d.mts +2 -0
- package/dist/components/LoadingShimmer/index.mjs +2 -0
- package/dist/components/MaskedInput/index.cjs +29 -0
- package/dist/components/MaskedInput/index.cjs.map +1 -0
- package/dist/components/MaskedInput/index.d.cts +2 -0
- package/dist/components/MaskedInput/index.d.mts +2 -0
- package/dist/components/MaskedInput/index.mjs +24 -0
- package/dist/components/MaskedInput/index.mjs.map +1 -0
- package/dist/components/MatchHighlight/index.cjs +31 -0
- package/dist/components/MatchHighlight/index.cjs.map +1 -0
- package/dist/components/MatchHighlight/index.d.cts +2 -0
- package/dist/components/MatchHighlight/index.d.mts +2 -0
- package/dist/components/MatchHighlight/index.mjs +24 -0
- package/dist/components/MatchHighlight/index.mjs.map +1 -0
- package/dist/components/Menu/index.cjs +15 -0
- package/dist/components/Menu/index.d.cts +2 -0
- package/dist/components/Menu/index.d.mts +2 -0
- package/dist/components/Menu/index.mjs +2 -0
- package/dist/components/Modal/index.cjs +285 -0
- package/dist/components/Modal/index.cjs.map +1 -0
- package/dist/components/Modal/index.d.cts +2 -0
- package/dist/components/Modal/index.d.mts +2 -0
- package/dist/components/Modal/index.mjs +276 -0
- package/dist/components/Modal/index.mjs.map +1 -0
- package/dist/components/PageHeader/index.cjs +71 -0
- package/dist/components/PageHeader/index.cjs.map +1 -0
- package/dist/components/PageHeader/index.d.cts +2 -0
- package/dist/components/PageHeader/index.d.mts +2 -0
- package/dist/components/PageHeader/index.mjs +64 -0
- package/dist/components/PageHeader/index.mjs.map +1 -0
- package/dist/components/Pagination/index.cjs +211 -0
- package/dist/components/Pagination/index.cjs.map +1 -0
- package/dist/components/Pagination/index.d.cts +3 -0
- package/dist/components/Pagination/index.d.mts +3 -0
- package/dist/components/Pagination/index.mjs +203 -0
- package/dist/components/Pagination/index.mjs.map +1 -0
- package/dist/components/Pii/index.cjs +20 -0
- package/dist/components/Pii/index.cjs.map +1 -0
- package/dist/components/Pii/index.d.cts +2 -0
- package/dist/components/Pii/index.d.mts +2 -0
- package/dist/components/Pii/index.mjs +19 -0
- package/dist/components/Pii/index.mjs.map +1 -0
- package/dist/components/Popover/index.cjs +13 -0
- package/dist/components/Popover/index.d.cts +2 -0
- package/dist/components/Popover/index.d.mts +2 -0
- package/dist/components/Popover/index.mjs +2 -0
- package/dist/components/ProgressBar/index.cjs +177 -0
- package/dist/components/ProgressBar/index.cjs.map +1 -0
- package/dist/components/ProgressBar/index.d.cts +2 -0
- package/dist/components/ProgressBar/index.d.mts +2 -0
- package/dist/components/ProgressBar/index.mjs +168 -0
- package/dist/components/ProgressBar/index.mjs.map +1 -0
- package/dist/components/ProgressIndicator/index.cjs +185 -0
- package/dist/components/ProgressIndicator/index.cjs.map +1 -0
- package/dist/components/ProgressIndicator/index.d.cts +2 -0
- package/dist/components/ProgressIndicator/index.d.mts +2 -0
- package/dist/components/ProgressIndicator/index.mjs +178 -0
- package/dist/components/ProgressIndicator/index.mjs.map +1 -0
- package/dist/components/Radio/index.cjs +8 -0
- package/dist/components/Radio/index.d.cts +2 -0
- package/dist/components/Radio/index.d.mts +2 -0
- package/dist/components/Radio/index.mjs +2 -0
- package/dist/components/RadioGroup/index.cjs +8 -0
- package/dist/components/RadioGroup/index.d.cts +2 -0
- package/dist/components/RadioGroup/index.d.mts +2 -0
- package/dist/components/RadioGroup/index.mjs +2 -0
- package/dist/components/SegmentedControl/index.cjs +9 -0
- package/dist/components/SegmentedControl/index.d.cts +2 -0
- package/dist/components/SegmentedControl/index.d.mts +2 -0
- package/dist/components/SegmentedControl/index.mjs +2 -0
- package/dist/components/Select/index.cjs +10 -0
- package/dist/components/Select/index.d.cts +2 -0
- package/dist/components/Select/index.d.mts +2 -0
- package/dist/components/Select/index.mjs +2 -0
- package/dist/components/Slider/index.cjs +1507 -0
- package/dist/components/Slider/index.cjs.map +1 -0
- package/dist/components/Slider/index.d.cts +3 -0
- package/dist/components/Slider/index.d.mts +3 -0
- package/dist/components/Slider/index.mjs +1497 -0
- package/dist/components/Slider/index.mjs.map +1 -0
- package/dist/components/Spacer/index.cjs +3 -0
- package/dist/components/Spacer/index.d.cts +2 -0
- package/dist/components/Spacer/index.d.mts +2 -0
- package/dist/components/Spacer/index.mjs +2 -0
- package/dist/components/Spinner/index.cjs +8 -0
- package/dist/components/Spinner/index.d.cts +2 -0
- package/dist/components/Spinner/index.d.mts +2 -0
- package/dist/components/Spinner/index.mjs +2 -0
- package/dist/components/Stack/index.cjs +9 -0
- package/dist/components/Stack/index.d.cts +2 -0
- package/dist/components/Stack/index.d.mts +2 -0
- package/dist/components/Stack/index.mjs +2 -0
- package/dist/components/StatusIndicator/index.cjs +174 -0
- package/dist/components/StatusIndicator/index.cjs.map +1 -0
- package/dist/components/StatusIndicator/index.d.cts +2 -0
- package/dist/components/StatusIndicator/index.d.mts +2 -0
- package/dist/components/StatusIndicator/index.mjs +167 -0
- package/dist/components/StatusIndicator/index.mjs.map +1 -0
- package/dist/components/Sticker/index.cjs +12 -0
- package/dist/components/Sticker/index.d.cts +2 -0
- package/dist/components/Sticker/index.d.mts +2 -0
- package/dist/components/Sticker/index.mjs +2 -0
- package/dist/components/SwatchPicker/index.cjs +65 -0
- package/dist/components/SwatchPicker/index.cjs.map +1 -0
- package/dist/components/SwatchPicker/index.d.cts +2 -0
- package/dist/components/SwatchPicker/index.d.mts +2 -0
- package/dist/components/SwatchPicker/index.mjs +58 -0
- package/dist/components/SwatchPicker/index.mjs.map +1 -0
- package/dist/components/TabBar/index.cjs +12 -0
- package/dist/components/TabBar/index.d.cts +4 -0
- package/dist/components/TabBar/index.d.mts +4 -0
- package/dist/components/TabBar/index.mjs +2 -0
- package/dist/components/Table/index.cjs +400 -0
- package/dist/components/Table/index.cjs.map +1 -0
- package/dist/components/Table/index.d.cts +8 -0
- package/dist/components/Table/index.d.mts +8 -0
- package/dist/components/Table/index.mjs +379 -0
- package/dist/components/Table/index.mjs.map +1 -0
- package/dist/components/Text/index.cjs +9 -0
- package/dist/components/Text/index.d.cts +2 -0
- package/dist/components/Text/index.d.mts +2 -0
- package/dist/components/Text/index.mjs +2 -0
- package/dist/components/TextArea/index.cjs +8 -0
- package/dist/components/TextArea/index.d.cts +2 -0
- package/dist/components/TextArea/index.d.mts +2 -0
- package/dist/components/TextArea/index.mjs +2 -0
- package/dist/components/Tile/index.cjs +103 -0
- package/dist/components/Tile/index.cjs.map +1 -0
- package/dist/components/Tile/index.d.cts +2 -0
- package/dist/components/Tile/index.d.mts +2 -0
- package/dist/components/Tile/index.mjs +96 -0
- package/dist/components/Tile/index.mjs.map +1 -0
- package/dist/components/Toast/index.cjs +141 -0
- package/dist/components/Toast/index.cjs.map +1 -0
- package/dist/components/Toast/index.d.cts +2 -0
- package/dist/components/Toast/index.d.mts +2 -0
- package/dist/components/Toast/index.mjs +136 -0
- package/dist/components/Toast/index.mjs.map +1 -0
- package/dist/components/Toggle/index.cjs +8 -0
- package/dist/components/Toggle/index.d.cts +2 -0
- package/dist/components/Toggle/index.d.mts +2 -0
- package/dist/components/Toggle/index.mjs +2 -0
- package/dist/components/Tooltip/index.cjs +12 -0
- package/dist/components/Tooltip/index.d.cts +4 -0
- package/dist/components/Tooltip/index.d.mts +4 -0
- package/dist/components/Tooltip/index.mjs +2 -0
- package/dist/constants.d.mts +5 -0
- package/dist/ids-Cr-NW2RJ.d.mts +11 -0
- package/dist/ids-e4V5Y3Ub.d.cts +11 -0
- package/dist/index-1-AkepUA.d.mts +1 -0
- package/dist/index-7in8TPrM.d.mts +1 -0
- package/dist/index-8R9vlM2B.d.mts +83 -0
- package/dist/index-B2KLYYkM.d.cts +1 -0
- package/dist/index-BBDa5smF.d.cts +1 -0
- package/dist/index-BJ8-FA6N.d.cts +1 -0
- package/dist/index-BM1DqNZf.d.cts +628 -0
- package/dist/index-BPSCxsMC.d.cts +1 -0
- package/dist/index-BPiqSRRl.d.mts +1 -0
- package/dist/index-BUYyA1Xh.d.cts +1 -0
- package/dist/index-CCt0lwyI.d.mts +1 -0
- package/dist/index-CEDY7cmG.d.cts +1 -0
- package/dist/index-CEqOS-7M.d.mts +1 -0
- package/dist/index-CExuKKOI.d.cts +218 -0
- package/dist/index-CIABef8t.d.mts +1 -0
- package/dist/index-CIBxlpQo.d.mts +1 -0
- package/dist/index-CKu60b9I.d.mts +154 -0
- package/dist/index-CP2eJYlK.d.mts +1 -0
- package/dist/index-CRo77wc3.d.mts +1 -0
- package/dist/index-CiBIKhMu.d.cts +1 -0
- package/dist/index-Cii4Qb1X.d.mts +1 -0
- package/dist/index-CspKFJM1.d.cts +1 -0
- package/dist/index-CsuikFeJ.d.mts +1 -0
- package/dist/index-Cz6N-KeS.d.cts +1 -0
- package/dist/index-D-BciAtf.d.cts +1 -0
- package/dist/index-D26lpgQi.d.cts +1 -0
- package/dist/index-D2HUTZ-d.d.cts +1 -0
- package/dist/index-D4DUvwPf.d.mts +1 -0
- package/dist/index-D4ELpJXS.d.cts +1 -0
- package/dist/index-D6CnpA_r.d.cts +1 -0
- package/dist/index-DLoAMD9J.d.cts +1 -0
- package/dist/index-DQvVmqvS.d.mts +628 -0
- package/dist/index-DWfPppPU.d.mts +1 -0
- package/dist/index-DcU87nuJ2.d.cts +1 -0
- package/dist/index-DkrC-i1D.d.mts +1 -0
- package/dist/index-DvuJXuAN.d.mts +1 -0
- package/dist/index-OEBbnNdr.d.mts +1 -0
- package/dist/index-QbUkWSLh.d.mts +1 -0
- package/dist/index-VmEFGBxN.d.cts +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +0 -0
- package/dist/index2.d.cts +1 -0
- package/dist/index2.d.mts +1 -0
- package/dist/input-BCmP106-.d.mts +17 -0
- package/dist/input-Bm_anD8X.d.cts +17 -0
- package/dist/inputFields.d.cts +83 -0
- package/dist/inputFields.d.mts +83 -0
- package/dist/intersperse.d.mts +18 -0
- package/dist/lib/ConfigContext.cjs +15 -0
- package/dist/lib/ConfigContext.cjs.map +1 -0
- package/dist/lib/ConfigContext.d.cts +16 -0
- package/dist/lib/ConfigContext.d.mts +17 -0
- package/dist/lib/ConfigContext.mjs +15 -0
- package/dist/lib/ConfigContext.mjs.map +1 -0
- package/dist/lib/HeadlessAriaButton.cjs +33 -0
- package/dist/lib/HeadlessAriaButton.cjs.map +1 -0
- package/dist/lib/HeadlessAriaButton.d.cts +12 -0
- package/dist/lib/HeadlessAriaButton.d.mts +12 -0
- package/dist/lib/HeadlessAriaButton.mjs +30 -0
- package/dist/lib/HeadlessAriaButton.mjs.map +1 -0
- package/dist/lib/PDSProvider.cjs +20 -0
- package/dist/lib/PDSProvider.cjs.map +1 -0
- package/dist/lib/PDSProvider.d.cts +12 -0
- package/dist/lib/PDSProvider.d.mts +13 -0
- package/dist/lib/PDSProvider.mjs +19 -0
- package/dist/lib/PDSProvider.mjs.map +1 -0
- package/dist/lib/TruncatedText.cjs +39 -0
- package/dist/lib/TruncatedText.cjs.map +1 -0
- package/dist/lib/TruncatedText.d.cts +2 -0
- package/dist/lib/TruncatedText.d.mts +2 -0
- package/dist/lib/TruncatedText.mjs +31 -0
- package/dist/lib/TruncatedText.mjs.map +1 -0
- package/dist/lib/TruncatedTextWithTooltip.cjs +34 -0
- package/dist/lib/TruncatedTextWithTooltip.cjs.map +1 -0
- package/dist/lib/TruncatedTextWithTooltip.d.cts +15 -0
- package/dist/lib/TruncatedTextWithTooltip.d.mts +15 -0
- package/dist/lib/TruncatedTextWithTooltip.mjs +28 -0
- package/dist/lib/TruncatedTextWithTooltip.mjs.map +1 -0
- package/dist/lib/comboboxHelper.cjs +46 -0
- package/dist/lib/comboboxHelper.cjs.map +1 -0
- package/dist/lib/comboboxHelper.d.cts +24 -0
- package/dist/lib/comboboxHelper.d.mts +24 -0
- package/dist/lib/comboboxHelper.mjs +42 -0
- package/dist/lib/comboboxHelper.mjs.map +1 -0
- package/dist/lib/datePickerHelper.cjs +3568 -0
- package/dist/lib/datePickerHelper.cjs.map +1 -0
- package/dist/lib/datePickerHelper.d.cts +19 -0
- package/dist/lib/datePickerHelper.d.mts +19 -0
- package/dist/lib/datePickerHelper.mjs +3566 -0
- package/dist/lib/datePickerHelper.mjs.map +1 -0
- package/dist/lib/pseudoClass.cjs +32 -0
- package/dist/lib/pseudoClass.cjs.map +1 -0
- package/dist/lib/pseudoClass.d.cts +45 -0
- package/dist/lib/pseudoClass.d.mts +45 -0
- package/dist/lib/pseudoClass.mjs +18 -0
- package/dist/lib/pseudoClass.mjs.map +1 -0
- package/dist/lib/register/RegisterComponent.cjs +91 -0
- package/dist/lib/register/RegisterComponent.cjs.map +1 -0
- package/dist/lib/register/RegisterComponent.d.cts +2 -0
- package/dist/lib/register/RegisterComponent.d.mts +2 -0
- package/dist/lib/register/RegisterComponent.mjs +88 -0
- package/dist/lib/register/RegisterComponent.mjs.map +1 -0
- package/dist/lib/register/ids.cjs +31 -0
- package/dist/lib/register/ids.cjs.map +1 -0
- package/dist/lib/register/ids.d.cts +2 -0
- package/dist/lib/register/ids.d.mts +2 -0
- package/dist/lib/register/ids.mjs +28 -0
- package/dist/lib/register/ids.mjs.map +1 -0
- package/dist/lib/register/index.cjs +8 -0
- package/dist/lib/register/index.d.cts +4 -0
- package/dist/lib/register/index.d.mts +4 -0
- package/dist/lib/register/index.mjs +3 -0
- package/dist/lib/register/types.cjs +1 -0
- package/dist/lib/register/types.d.cts +2 -0
- package/dist/lib/register/types.d.mts +2 -0
- package/dist/lib/register/types.mjs +0 -0
- package/dist/lib/reorderItems.cjs +39 -0
- package/dist/lib/reorderItems.cjs.map +1 -0
- package/dist/lib/reorderItems.d.cts +26 -0
- package/dist/lib/reorderItems.d.mts +26 -0
- package/dist/lib/reorderItems.mjs +36 -0
- package/dist/lib/reorderItems.mjs.map +1 -0
- package/dist/lib/selectHelper.cjs +22 -0
- package/dist/lib/selectHelper.cjs.map +1 -0
- package/dist/lib/selectHelper.d.cts +14 -0
- package/dist/lib/selectHelper.d.mts +14 -0
- package/dist/lib/selectHelper.mjs +20 -0
- package/dist/lib/selectHelper.mjs.map +1 -0
- package/dist/lib/useControlled.cjs +20 -0
- package/dist/lib/useControlled.cjs.map +1 -0
- package/dist/lib/useControlled.d.cts +16 -0
- package/dist/lib/useControlled.d.mts +17 -0
- package/dist/lib/useControlled.mjs +19 -0
- package/dist/lib/useControlled.mjs.map +1 -0
- package/dist/lib/useIsOverflow.cjs +58 -0
- package/dist/lib/useIsOverflow.cjs.map +1 -0
- package/dist/lib/useIsOverflow.d.cts +11 -0
- package/dist/lib/useIsOverflow.d.mts +11 -0
- package/dist/lib/useIsOverflow.mjs +56 -0
- package/dist/lib/useIsOverflow.mjs.map +1 -0
- package/dist/lib/useOutsideClick.cjs +19 -0
- package/dist/lib/useOutsideClick.cjs.map +1 -0
- package/dist/lib/useOutsideClick.d.cts +13 -0
- package/dist/lib/useOutsideClick.d.mts +13 -0
- package/dist/lib/useOutsideClick.mjs +17 -0
- package/dist/lib/useOutsideClick.mjs.map +1 -0
- package/dist/lib/zindex.cjs +27 -0
- package/dist/lib/zindex.cjs.map +1 -0
- package/dist/lib/zindex.d.cts +25 -0
- package/dist/lib/zindex.d.mts +25 -0
- package/dist/lib/zindex.mjs +25 -0
- package/dist/lib/zindex.mjs.map +1 -0
- package/dist/mergeRefs-BZinWopc.cjs +31 -0
- package/dist/mergeRefs-BZinWopc.cjs.map +1 -0
- package/dist/mergeRefs-BgcbK0Qy.mjs +26 -0
- package/dist/mergeRefs-BgcbK0Qy.mjs.map +1 -0
- package/dist/mixins/focus.cjs +39 -0
- package/dist/mixins/focus.cjs.map +1 -0
- package/dist/mixins/focus.d.cts +11 -0
- package/dist/mixins/focus.d.mts +11 -0
- package/dist/mixins/focus.mjs +34 -0
- package/dist/mixins/focus.mjs.map +1 -0
- package/dist/mixins/hoverable.cjs +38 -0
- package/dist/mixins/hoverable.cjs.map +1 -0
- package/dist/mixins/hoverable.d.cts +16 -0
- package/dist/mixins/hoverable.d.mts +16 -0
- package/dist/mixins/hoverable.mjs +32 -0
- package/dist/mixins/hoverable.mjs.map +1 -0
- package/dist/mixins/input.cjs +95 -0
- package/dist/mixins/input.cjs.map +1 -0
- package/dist/mixins/input.d.cts +2 -0
- package/dist/mixins/input.d.mts +2 -0
- package/dist/mixins/input.mjs +94 -0
- package/dist/mixins/input.mjs.map +1 -0
- package/dist/mixins/menuItem.cjs +110 -0
- package/dist/mixins/menuItem.cjs.map +1 -0
- package/dist/mixins/menuItem.d.cts +30 -0
- package/dist/mixins/menuItem.d.mts +31 -0
- package/dist/mixins/menuItem.mjs +109 -0
- package/dist/mixins/menuItem.mjs.map +1 -0
- package/dist/mixins/print/index.cjs +25 -0
- package/dist/mixins/print/index.cjs.map +1 -0
- package/dist/mixins/print/index.d.cts +11 -0
- package/dist/mixins/print/index.d.mts +11 -0
- package/dist/mixins/print/index.mjs +23 -0
- package/dist/mixins/print/index.mjs.map +1 -0
- package/dist/mixins/text.cjs +93 -0
- package/dist/mixins/text.cjs.map +1 -0
- package/dist/mixins/text.d.cts +2 -0
- package/dist/mixins/text.d.mts +2 -0
- package/dist/mixins/text.mjs +88 -0
- package/dist/mixins/text.mjs.map +1 -0
- package/dist/motion-DoikasqZ.mjs +7483 -0
- package/dist/motion-DoikasqZ.mjs.map +1 -0
- package/dist/motion-QW6imSxE.cjs +7488 -0
- package/dist/motion-QW6imSxE.cjs.map +1 -0
- package/dist/react.esm-C-es35jP.cjs +11441 -0
- package/dist/react.esm-C-es35jP.cjs.map +1 -0
- package/dist/react.esm-Dv1lMDRs.mjs +11397 -0
- package/dist/react.esm-Dv1lMDRs.mjs.map +1 -0
- package/dist/text-BrSUs-88.d.mts +14 -0
- package/dist/text-PmH5oc61.d.cts +14 -0
- package/dist/theme-Cadb1xzQ.d.cts +154 -0
- package/dist/theme-DGAqgnUa.d.mts +154 -0
- package/dist/theme.cjs +353 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +2 -0
- package/dist/theme.d.mts +2 -0
- package/dist/theme.mjs +346 -0
- package/dist/theme.mjs.map +1 -0
- package/dist/types-DzHQ5MGm.d.mts +69 -0
- package/dist/types-N-cXznfM.d.cts +69 -0
- package/dist/useFormField-Ba0CQ43u.d.cts +30 -0
- package/dist/useFormField-BmtItl8y.d.mts +30 -0
- package/dist/useFormField-DN3gpEEV.cjs +37 -0
- package/dist/useFormField-DN3gpEEV.cjs.map +1 -0
- package/dist/useFormField-eftOPiXj.mjs +25 -0
- package/dist/useFormField-eftOPiXj.mjs.map +1 -0
- package/dist/useFormField.d.cts +2 -0
- package/dist/useFormField.d.mts +2 -0
- package/dist/useFormGroup-BMukAMAd.mjs +14 -0
- package/dist/useFormGroup-BMukAMAd.mjs.map +1 -0
- package/dist/useFormGroup-B_mFNoN9.cjs +26 -0
- package/dist/useFormGroup-B_mFNoN9.cjs.map +1 -0
- package/dist/useFormGroup.d.cts +18 -0
- package/dist/useFormGroup.d.mts +18 -0
- package/dist/useLabel-BcbghpIU.cjs +1465 -0
- package/dist/useLabel-BcbghpIU.cjs.map +1 -0
- package/dist/useLabel-DHGzNIKw.mjs +1212 -0
- package/dist/useLabel-DHGzNIKw.mjs.map +1 -0
- package/dist/useModalInsetRight.d.mts +21 -0
- package/dist/useToggle-0zLL1E7s.mjs +21 -0
- package/dist/useToggle-0zLL1E7s.mjs.map +1 -0
- package/dist/useToggle-DNrEsTpr.cjs +27 -0
- package/dist/useToggle-DNrEsTpr.cjs.map +1 -0
- package/dist/useToggle.d.mts +17 -0
- package/dist/useTruncation.d.mts +12 -0
- package/dist/utilities-C8Jf-xpi.d.cts +9 -0
- package/dist/utilities-w1K54IAy.d.mts +9 -0
- package/dist/utilities.d.cts +2 -0
- package/dist/utilities.d.mts +2 -0
- package/dist/utils/storybook.cjs +13 -0
- package/dist/utils/storybook.cjs.map +1 -0
- package/dist/utils/storybook.mjs +11 -0
- package/dist/utils/storybook.mjs.map +1 -0
- package/dist/utils/testing.cjs +50 -0
- package/dist/utils/testing.cjs.map +1 -0
- package/dist/utils/testing.d.cts +370 -0
- package/dist/utils/testing.d.mts +370 -0
- package/dist/utils/testing.mjs +45 -0
- package/dist/utils/testing.mjs.map +1 -0
- package/dist/variables/color.cjs +23 -0
- package/dist/variables/color.cjs.map +1 -0
- package/dist/variables/color.d.cts +19 -0
- package/dist/variables/color.d.mts +19 -0
- package/dist/variables/color.mjs +21 -0
- package/dist/variables/color.mjs.map +1 -0
- package/dist/variables/effect.cjs +27 -0
- package/dist/variables/effect.cjs.map +1 -0
- package/dist/variables/effect.d.cts +21 -0
- package/dist/variables/effect.d.mts +21 -0
- package/dist/variables/effect.mjs +24 -0
- package/dist/variables/effect.mjs.map +1 -0
- package/dist/variables/keyframes.cjs +22 -0
- package/dist/variables/keyframes.cjs.map +1 -0
- package/dist/variables/keyframes.d.cts +8 -0
- package/dist/variables/keyframes.d.mts +8 -0
- package/dist/variables/keyframes.mjs +19 -0
- package/dist/variables/keyframes.mjs.map +1 -0
- package/dist/variables/spacing.cjs +11 -0
- package/dist/variables/spacing.cjs.map +1 -0
- package/dist/variables/spacing.d.cts +8 -0
- package/dist/variables/spacing.d.mts +8 -0
- package/dist/variables/spacing.mjs +9 -0
- package/dist/variables/spacing.mjs.map +1 -0
- package/dist/variables/text.cjs +14 -0
- package/dist/variables/text.cjs.map +1 -0
- package/dist/variables/text.d.cts +10 -0
- package/dist/variables/text.d.mts +10 -0
- package/dist/variables/text.mjs +12 -0
- package/dist/variables/text.mjs.map +1 -0
- package/dist/variables/transitions.cjs +25 -0
- package/dist/variables/transitions.cjs.map +1 -0
- package/dist/variables/transitions.d.cts +19 -0
- package/dist/variables/transitions.d.mts +19 -0
- package/dist/variables/transitions.mjs +22 -0
- package/dist/variables/transitions.mjs.map +1 -0
- package/package.json +781 -0
|
@@ -0,0 +1,1692 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-CoPdw6nB.cjs");
|
|
2
|
+
const require_mixins_focus = require("./mixins/focus.cjs");
|
|
3
|
+
const require_Stack = require("./Stack-BHb3ZB2A.cjs");
|
|
4
|
+
require("./components/Stack/index.cjs");
|
|
5
|
+
const require_Text = require("./Text-DVz8erdF.cjs");
|
|
6
|
+
const require_lib_useOutsideClick = require("./lib/useOutsideClick.cjs");
|
|
7
|
+
const require_lib_zindex = require("./lib/zindex.cjs");
|
|
8
|
+
const require_IconButton = require("./IconButton-B1ZL8BqW.cjs");
|
|
9
|
+
require("./components/Button/index.cjs");
|
|
10
|
+
const require_Sticker = require("./Sticker-D_dutvp_.cjs");
|
|
11
|
+
const require_useFormField = require("./useFormField-DN3gpEEV.cjs");
|
|
12
|
+
const require_Menu = require("./Menu-BpkjNO81.cjs");
|
|
13
|
+
const require_Checkbox = require("./Checkbox-D4nv7eNs.cjs");
|
|
14
|
+
const require_Input = require("./Input-DHOsR4cl.cjs");
|
|
15
|
+
const require_components_Input_index = require("./components/Input/index.cjs");
|
|
16
|
+
require("./components/Menu/index.cjs");
|
|
17
|
+
const require_Spinner = require("./Spinner-z7DrPE1d.cjs");
|
|
18
|
+
let _persona_design_tokens = require("@persona/design-tokens");
|
|
19
|
+
let styled_components = require("styled-components");
|
|
20
|
+
styled_components = require_chunk.__toESM(styled_components);
|
|
21
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
22
|
+
let react = require("react");
|
|
23
|
+
let react_dom = require("react-dom");
|
|
24
|
+
let _persona_icons = require("@persona/icons");
|
|
25
|
+
let fuse_js = require("fuse.js");
|
|
26
|
+
fuse_js = require_chunk.__toESM(fuse_js);
|
|
27
|
+
let _tanstack_react_virtual = require("@tanstack/react-virtual");
|
|
28
|
+
let downshift = require("downshift");
|
|
29
|
+
//#region components/Combobox/ComboboxBase.tsx
|
|
30
|
+
function isOptionGroup(item) {
|
|
31
|
+
return "options" in item && Array.isArray(item.options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Flatten the visible leaves at the current navigation level. Inline
|
|
35
|
+
* (non-nested) groups are walked through transparently — their leaves
|
|
36
|
+
* surface at this level. Nested groups are skipped along with their
|
|
37
|
+
* contents — those leaves live behind a navigation step in single-
|
|
38
|
+
* select. Multi-select doesn't reach this code with nested groups
|
|
39
|
+
* intact (it inlines them at the component boundary), so the skip
|
|
40
|
+
* here is the single-select-only contract.
|
|
41
|
+
*/
|
|
42
|
+
function flattenOptions(items) {
|
|
43
|
+
const out = [];
|
|
44
|
+
for (const item of items) if (isOptionGroup(item)) {
|
|
45
|
+
if (!item.nested) out.push(...flattenOptions(item.options));
|
|
46
|
+
} else out.push(item);
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Recurse through the entire option tree looking for any nested
|
|
51
|
+
* group. Used to gate nested-mode behavior so trees that don't opt
|
|
52
|
+
* in (the overwhelmingly common case) skip the extra book-keeping
|
|
53
|
+
* entirely. Single-select uses this to switch between its nested-nav
|
|
54
|
+
* render path and the legacy renderer; multi-select uses it to
|
|
55
|
+
* short-circuit its `nested → inline` transform when there's nothing
|
|
56
|
+
* to convert.
|
|
57
|
+
*/
|
|
58
|
+
function containsNestedGroup(items) {
|
|
59
|
+
for (const item of items) if (isOptionGroup(item)) {
|
|
60
|
+
if (item.nested) return true;
|
|
61
|
+
if (containsNestedGroup(item.options)) return true;
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Find a nested-group child of `items` whose `label` matches `label`.
|
|
67
|
+
* Walks transparently through inline (non-nested) groups at the same
|
|
68
|
+
* level — they don't add a navigation step, so a nested submenu
|
|
69
|
+
* declared inside an inline section header is still "at this level"
|
|
70
|
+
* for descent purposes. Returns `null` if no match.
|
|
71
|
+
*/
|
|
72
|
+
function findNestedGroupByLabel(items, label) {
|
|
73
|
+
for (const item of items) {
|
|
74
|
+
if (!isOptionGroup(item)) continue;
|
|
75
|
+
if (item.nested) {
|
|
76
|
+
if (item.label === label) return item;
|
|
77
|
+
} else {
|
|
78
|
+
const found = findNestedGroupByLabel(item.options, label);
|
|
79
|
+
if (found) return found;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Walk the option tree by following `path` step-by-step. Each entry
|
|
86
|
+
* in `path` is the `label` of a nested group at that level; we
|
|
87
|
+
* descend into its `options` at each step. Returns the items visible
|
|
88
|
+
* at the resolved level (a mix of leaves, inline groups, and further
|
|
89
|
+
* nested groups).
|
|
90
|
+
*
|
|
91
|
+
* - Empty `path` returns the original top-level items unchanged.
|
|
92
|
+
* - If any step doesn't resolve to a known nested group (e.g. stale
|
|
93
|
+
* state after the registry changes), returns an empty list so the
|
|
94
|
+
* consumer can fall back to the root view.
|
|
95
|
+
*/
|
|
96
|
+
function getOptionsAtPath(options, path) {
|
|
97
|
+
let scope = options;
|
|
98
|
+
for (const label of path) {
|
|
99
|
+
const found = findNestedGroupByLabel(scope, label);
|
|
100
|
+
if (!found) return [];
|
|
101
|
+
scope = found.options;
|
|
102
|
+
}
|
|
103
|
+
return scope;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Recursively walk the tree and return every leaf option, each paired
|
|
107
|
+
* with the labels of its nested-group ancestors. Used by single-select
|
|
108
|
+
* Combobox to populate the search-results view: the search query
|
|
109
|
+
* bypasses the active navigation path and matches against every leaf
|
|
110
|
+
* in the tree, with the breadcrumb surfacing parent context in each
|
|
111
|
+
* hit.
|
|
112
|
+
*
|
|
113
|
+
* Inline (non-nested) groups are walked through transparently — their
|
|
114
|
+
* `label` isn't a breadcrumb crumb because they don't correspond to a
|
|
115
|
+
* navigation step. Only nested groups contribute a crumb.
|
|
116
|
+
*/
|
|
117
|
+
function flattenLeafOptions(options, breadcrumb = []) {
|
|
118
|
+
const result = [];
|
|
119
|
+
for (const item of options) if (isOptionGroup(item)) {
|
|
120
|
+
const nextBreadcrumb = item.nested ? [...breadcrumb, item.label] : breadcrumb;
|
|
121
|
+
result.push(...flattenLeafOptions(item.options, nextBreadcrumb));
|
|
122
|
+
} else result.push({
|
|
123
|
+
option: item,
|
|
124
|
+
breadcrumb
|
|
125
|
+
});
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Build the flat list of navigable items at the current navigation
|
|
130
|
+
* level, in document order. Inline (non-nested) groups are walked
|
|
131
|
+
* through transparently; their leaves and any nested subgroups
|
|
132
|
+
* contribute at this level. Nested groups become a `kind: 'group'`
|
|
133
|
+
* entry that the renderer turns into a navigation row.
|
|
134
|
+
*/
|
|
135
|
+
function getNavigableItemsAtLevel(items) {
|
|
136
|
+
const out = [];
|
|
137
|
+
for (const item of items) if (isOptionGroup(item)) if (item.nested) out.push({
|
|
138
|
+
kind: "group",
|
|
139
|
+
group: item
|
|
140
|
+
});
|
|
141
|
+
else out.push(...getNavigableItemsAtLevel(item.options));
|
|
142
|
+
else out.push({
|
|
143
|
+
kind: "leaf",
|
|
144
|
+
option: item
|
|
145
|
+
});
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A hook which provides the caller with dynamically filtered options
|
|
150
|
+
*
|
|
151
|
+
* @param options - The options to filter (can be flat or grouped)
|
|
152
|
+
* @param inputValue - The input value to filter the options by
|
|
153
|
+
* @returns The subset of the options that match the input value according to the fuse.js library
|
|
154
|
+
*/
|
|
155
|
+
function useFilteredOptions(options, inputValue) {
|
|
156
|
+
return (0, react.useMemo)(() => {
|
|
157
|
+
const flatOptions = flattenOptions(options);
|
|
158
|
+
const fuse = new fuse_js.default(flatOptions, {
|
|
159
|
+
shouldSort: false,
|
|
160
|
+
threshold: 0,
|
|
161
|
+
ignoreLocation: true,
|
|
162
|
+
minMatchCharLength: 1,
|
|
163
|
+
keys: ["label", "description"]
|
|
164
|
+
});
|
|
165
|
+
return inputValue === "" ? flatOptions : Array.from(new Set(fuse.search(inputValue).map(({ item }) => item)).values());
|
|
166
|
+
}, [options, inputValue]);
|
|
167
|
+
}
|
|
168
|
+
function buildVirtualRows(options, filteredOptions, indexRealToIndexVirtual) {
|
|
169
|
+
const rows = [];
|
|
170
|
+
let idx = 0;
|
|
171
|
+
for (const item of options) if (isOptionGroup(item)) {
|
|
172
|
+
if (item.nested) continue;
|
|
173
|
+
const visibleLeaves = flattenOptions(item.options).filter((opt) => filteredOptions.some((f) => f.value === opt.value));
|
|
174
|
+
if (visibleLeaves.length > 0) {
|
|
175
|
+
rows.push({
|
|
176
|
+
kind: "group-header",
|
|
177
|
+
label: item.label
|
|
178
|
+
});
|
|
179
|
+
for (const opt of visibleLeaves) {
|
|
180
|
+
indexRealToIndexVirtual.set(idx, rows.length);
|
|
181
|
+
rows.push({
|
|
182
|
+
kind: "option",
|
|
183
|
+
option: opt,
|
|
184
|
+
index: idx++
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
} else if (filteredOptions.some((f) => f.value === item.value)) {
|
|
189
|
+
indexRealToIndexVirtual.set(idx, rows.length);
|
|
190
|
+
rows.push({
|
|
191
|
+
kind: "option",
|
|
192
|
+
option: item,
|
|
193
|
+
index: idx++
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return rows;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Renders options with support for groups, handling filtering and proper indexing
|
|
200
|
+
*
|
|
201
|
+
* @param params - Object containing options, filteredOptions, and renderOption
|
|
202
|
+
* @param params.options - The original options array (can include groups)
|
|
203
|
+
* @param params.filteredOptions - The flat filtered options to display
|
|
204
|
+
* @param params.virtualizer - Optional virtualizer for large lists
|
|
205
|
+
* @param params.virtualRows - Pre-built flat rows list (required when virtualizer is provided)
|
|
206
|
+
* @param params.renderOption - Callback to render each individual option with its flat index
|
|
207
|
+
* @returns React nodes with properly grouped and filtered options
|
|
208
|
+
*/
|
|
209
|
+
function renderOptionsWithGroups({ options, filteredOptions, renderOption, virtualizer, virtualRows }) {
|
|
210
|
+
if (virtualizer && virtualRows) {
|
|
211
|
+
const rows = virtualRows;
|
|
212
|
+
const vItems = virtualizer.getVirtualItems();
|
|
213
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
214
|
+
style: {
|
|
215
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
216
|
+
width: "100%",
|
|
217
|
+
position: "relative"
|
|
218
|
+
},
|
|
219
|
+
children: vItems.map((vItem) => {
|
|
220
|
+
const row = rows[vItem.index];
|
|
221
|
+
if (!row) return null;
|
|
222
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
223
|
+
"data-index": vItem.index,
|
|
224
|
+
ref: virtualizer.measureElement,
|
|
225
|
+
style: {
|
|
226
|
+
position: "absolute",
|
|
227
|
+
top: 0,
|
|
228
|
+
left: 0,
|
|
229
|
+
width: "100%",
|
|
230
|
+
transform: `translateY(${vItem.start}px)`
|
|
231
|
+
},
|
|
232
|
+
children: row.kind === "group-header" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Menu.MenuHeading, {
|
|
233
|
+
as: "div",
|
|
234
|
+
children: row.label
|
|
235
|
+
}) : renderOption(row.option, row.index)
|
|
236
|
+
}, String(vItem.key));
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
let flatIndex = -1;
|
|
241
|
+
return options.map((item, groupIndex) => {
|
|
242
|
+
if (isOptionGroup(item)) {
|
|
243
|
+
if (item.nested) return null;
|
|
244
|
+
const visibleLeaves = flattenOptions(item.options).filter((opt) => filteredOptions.some((filtered) => filtered.value === opt.value));
|
|
245
|
+
if (visibleLeaves.length === 0) return null;
|
|
246
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Menu.MenuHeading, { children: item.label }), visibleLeaves.map((option) => {
|
|
247
|
+
flatIndex++;
|
|
248
|
+
return renderOption(option, flatIndex);
|
|
249
|
+
})] }, `group-${groupIndex}`);
|
|
250
|
+
} else {
|
|
251
|
+
if (!filteredOptions.some((filtered) => filtered.value === item.value)) return null;
|
|
252
|
+
flatIndex++;
|
|
253
|
+
return renderOption(item, flatIndex);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const MAX_DROPDOWN_HEIGHT = "300px";
|
|
258
|
+
const Container = styled_components.default.div`
|
|
259
|
+
display: flex;
|
|
260
|
+
position: relative;
|
|
261
|
+
width: 100%;
|
|
262
|
+
`;
|
|
263
|
+
const InputContainer = styled_components.default.div`
|
|
264
|
+
position: relative;
|
|
265
|
+
width: 100%;
|
|
266
|
+
`;
|
|
267
|
+
const ComboboxInput = (0, styled_components.default)(require_components_Input_index.default)`
|
|
268
|
+
padding-right: ${({ size }) => size === "sm" ? _persona_design_tokens.Spacing[5] : _persona_design_tokens.Spacing[6]}; /* Space for caret icon */
|
|
269
|
+
|
|
270
|
+
${({ $isOpen }) => $isOpen && styled_components.css`
|
|
271
|
+
${require_mixins_focus.focusStyle}
|
|
272
|
+
`}
|
|
273
|
+
|
|
274
|
+
/* Apply custom font family from selected item when dropdown is closed */
|
|
275
|
+
${({ $selectedItemStyle, $isOpen }) => !$isOpen && $selectedItemStyle?.fontFamily && styled_components.css`
|
|
276
|
+
&& {
|
|
277
|
+
font-family: ${$selectedItemStyle.fontFamily};
|
|
278
|
+
}
|
|
279
|
+
`}
|
|
280
|
+
`;
|
|
281
|
+
const CaretButton = (0, styled_components.default)(require_IconButton.Button).attrs({ width: "icon" })`
|
|
282
|
+
background-color: transparent;
|
|
283
|
+
border: none;
|
|
284
|
+
color: ${_persona_design_tokens.Color.BorderIconPrimary};
|
|
285
|
+
|
|
286
|
+
&:hover:not(:disabled),
|
|
287
|
+
&:active:not(:disabled) {
|
|
288
|
+
color: ${_persona_design_tokens.Color.BorderIconPrimary};
|
|
289
|
+
background-color: transparent;
|
|
290
|
+
border: none;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
&:disabled {
|
|
294
|
+
color: ${_persona_design_tokens.Color.BorderIconDisabled};
|
|
295
|
+
background-color: transparent;
|
|
296
|
+
border: none;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
position: absolute;
|
|
300
|
+
right: 0;
|
|
301
|
+
top: 0;
|
|
302
|
+
`;
|
|
303
|
+
const DropdownContainer = (0, styled_components.default)(require_Menu.FloatingCard)`
|
|
304
|
+
${({ $portal, $embedded, $top, $left, $width }) => $embedded ? styled_components.css`
|
|
305
|
+
position: static;
|
|
306
|
+
width: 100%;
|
|
307
|
+
min-width: 0;
|
|
308
|
+
border: 0;
|
|
309
|
+
border-radius: 0;
|
|
310
|
+
box-shadow: none;
|
|
311
|
+
background: transparent;
|
|
312
|
+
margin: 0;
|
|
313
|
+
` : $portal ? styled_components.css`
|
|
314
|
+
position: fixed;
|
|
315
|
+
top: ${$top != null ? `${$top}px` : "0"};
|
|
316
|
+
left: ${$left != null ? `${$left}px` : "0"};
|
|
317
|
+
width: ${$width != null ? `${$width}px` : "auto"};
|
|
318
|
+
` : styled_components.css`
|
|
319
|
+
position: absolute;
|
|
320
|
+
top: calc(100% + ${_persona_design_tokens.Spacing[2]});
|
|
321
|
+
left: 0;
|
|
322
|
+
right: 0;
|
|
323
|
+
width: 100%;
|
|
324
|
+
`}
|
|
325
|
+
|
|
326
|
+
${({ $minWidth }) => $minWidth && styled_components.css`
|
|
327
|
+
min-width: ${$minWidth};
|
|
328
|
+
`}
|
|
329
|
+
|
|
330
|
+
display: flex;
|
|
331
|
+
flex-direction: column;
|
|
332
|
+
${({ $embedded }) => $embedded && styled_components.css`
|
|
333
|
+
gap: ${_persona_design_tokens.Spacing[2]};
|
|
334
|
+
`}
|
|
335
|
+
overflow: ${({ $embedded }) => $embedded ? "visible" : "hidden"}; /* Prevent floating menu overflow while preserving embedded focus rings */
|
|
336
|
+
box-sizing: border-box;
|
|
337
|
+
z-index: ${require_lib_zindex.Z_INDICES.modalDropdown}; /* Ensure portal dropdown appears above other content */
|
|
338
|
+
|
|
339
|
+
${({ $isOpen }) => !$isOpen && styled_components.css`
|
|
340
|
+
display: none;
|
|
341
|
+
`}
|
|
342
|
+
`;
|
|
343
|
+
const ScrollableMenuList = (0, styled_components.default)(require_Menu.MenuList)`
|
|
344
|
+
max-height: ${MAX_DROPDOWN_HEIGHT};
|
|
345
|
+
overflow-y: auto;
|
|
346
|
+
overflow-x: hidden; /* Prevent horizontal scrolling */
|
|
347
|
+
width: 100%; /* Ensure full width is used */
|
|
348
|
+
box-sizing: border-box;
|
|
349
|
+
`;
|
|
350
|
+
const SearchInputContainer = styled_components.default.div`
|
|
351
|
+
flex-shrink: 0;
|
|
352
|
+
${({ $embedded }) => $embedded ? styled_components.css`
|
|
353
|
+
padding: 0;
|
|
354
|
+
` : styled_components.css`
|
|
355
|
+
padding: ${_persona_design_tokens.Spacing[1]} ${_persona_design_tokens.Spacing[2]};
|
|
356
|
+
border-bottom: 1px solid ${({ theme }) => theme.color.border.primary};
|
|
357
|
+
`}
|
|
358
|
+
`;
|
|
359
|
+
const SearchInput = (0, styled_components.default)(require_components_Input_index.default)`
|
|
360
|
+
${({ $embedded }) => !$embedded && styled_components.css`
|
|
361
|
+
/* Borderless strip inside floating menus */
|
|
362
|
+
border: none;
|
|
363
|
+
padding-top: ${_persona_design_tokens.Spacing[1]};
|
|
364
|
+
padding-bottom: ${_persona_design_tokens.Spacing[1]};
|
|
365
|
+
|
|
366
|
+
&:focus {
|
|
367
|
+
outline: none !important;
|
|
368
|
+
}
|
|
369
|
+
`}
|
|
370
|
+
`;
|
|
371
|
+
const EmptyState = (0, styled_components.default)(require_Text.Paragraph).attrs(({ size }) => ({ size }))`
|
|
372
|
+
padding: 0 ${({ size }) => size === "sm" ? _persona_design_tokens.Spacing[1] : _persona_design_tokens.Spacing[2]};
|
|
373
|
+
color: ${({ theme }) => theme.color.text.tertiary};
|
|
374
|
+
${({ theme }) => theme.text.paragraph.md};
|
|
375
|
+
`;
|
|
376
|
+
const LoadingContainer = styled_components.default.div`
|
|
377
|
+
display: flex;
|
|
378
|
+
align-items: center;
|
|
379
|
+
justify-content: center;
|
|
380
|
+
min-height: 136px;
|
|
381
|
+
padding: ${_persona_design_tokens.Spacing[3]};
|
|
382
|
+
`;
|
|
383
|
+
const OptionLabel = styled_components.default.div`
|
|
384
|
+
overflow: hidden;
|
|
385
|
+
text-overflow: ellipsis;
|
|
386
|
+
white-space: nowrap;
|
|
387
|
+
min-width: 0; /* Allow flex item to shrink below content size */
|
|
388
|
+
|
|
389
|
+
/* Apply custom font family if provided */
|
|
390
|
+
${({ $labelStyle }) => $labelStyle?.fontFamily && styled_components.css`
|
|
391
|
+
font-family: ${$labelStyle.fontFamily};
|
|
392
|
+
`}
|
|
393
|
+
`;
|
|
394
|
+
const Description = styled_components.default.p`
|
|
395
|
+
${_persona_design_tokens.Typography.TextSmall};
|
|
396
|
+
color: ${_persona_design_tokens.Color.TextSecondary};
|
|
397
|
+
margin: 0;
|
|
398
|
+
|
|
399
|
+
/* Multi-line truncation with 3-line limit */
|
|
400
|
+
overflow: hidden;
|
|
401
|
+
display: -webkit-box;
|
|
402
|
+
-webkit-line-clamp: 3;
|
|
403
|
+
-webkit-box-orient: vertical;
|
|
404
|
+
|
|
405
|
+
/* Fallback for browsers that don't support -webkit-line-clamp */
|
|
406
|
+
max-height: calc(${_persona_design_tokens.Typography.TextSmall.lineHeight} * 3); /* line-height * 3 lines */
|
|
407
|
+
`;
|
|
408
|
+
function useDropdownPosition(portalContainerRef, isOpen, portal) {
|
|
409
|
+
const [position, setPosition] = (0, react.useState)({
|
|
410
|
+
top: 0,
|
|
411
|
+
left: 0,
|
|
412
|
+
width: 0
|
|
413
|
+
});
|
|
414
|
+
(0, react.useEffect)(() => {
|
|
415
|
+
if (!portal || !isOpen || !portalContainerRef.current) return;
|
|
416
|
+
const updatePosition = () => {
|
|
417
|
+
const rect = portalContainerRef.current.getBoundingClientRect();
|
|
418
|
+
const spacing = parseInt(_persona_design_tokens.Spacing[2]);
|
|
419
|
+
setPosition({
|
|
420
|
+
top: rect.bottom + spacing,
|
|
421
|
+
left: rect.left,
|
|
422
|
+
width: rect.width
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
updatePosition();
|
|
426
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
427
|
+
window.addEventListener("resize", updatePosition);
|
|
428
|
+
return () => {
|
|
429
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
430
|
+
window.removeEventListener("resize", updatePosition);
|
|
431
|
+
};
|
|
432
|
+
}, [
|
|
433
|
+
portalContainerRef,
|
|
434
|
+
isOpen,
|
|
435
|
+
portal
|
|
436
|
+
]);
|
|
437
|
+
return position;
|
|
438
|
+
}
|
|
439
|
+
function DropdownPortalWrapper({ children, portal }) {
|
|
440
|
+
const portalRoot = (0, react.useRef)(null);
|
|
441
|
+
(0, react.useEffect)(() => {
|
|
442
|
+
if (portal) portalRoot.current = document.body;
|
|
443
|
+
}, [portal]);
|
|
444
|
+
if (portal && portalRoot.current) return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
445
|
+
id: "combobox-dropdown-portal-wrapper",
|
|
446
|
+
children
|
|
447
|
+
}), portalRoot.current);
|
|
448
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
449
|
+
}
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region components/Combobox/useTruncation.ts
|
|
452
|
+
/**
|
|
453
|
+
* Custom hook for calculating truncation when multi-select items are restricted to a single line using actual DOM measurements
|
|
454
|
+
* Ensures at least one item is always visible
|
|
455
|
+
*/
|
|
456
|
+
function useTruncation(selectedItems, stickerRefs, truncatorRef, containerRef, truncate) {
|
|
457
|
+
const [visibleCount, setVisibleCount] = (0, react.useState)(selectedItems.length);
|
|
458
|
+
(0, react.useEffect)(() => {
|
|
459
|
+
if (!truncate || selectedItems.length === 0 || !containerRef.current) {
|
|
460
|
+
setVisibleCount(selectedItems.length);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const calculateVisibleCount = () => {
|
|
464
|
+
const container = containerRef.current;
|
|
465
|
+
if (!container) return;
|
|
466
|
+
if (!(selectedItems.every((_, i) => stickerRefs.current[i] != null) && truncatorRef.current != null)) return;
|
|
467
|
+
const computedStyle = window.getComputedStyle(container);
|
|
468
|
+
const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
|
|
469
|
+
const paddingRight = parseFloat(computedStyle.paddingRight) || 0;
|
|
470
|
+
const availableWidth = container.offsetWidth - paddingLeft - paddingRight;
|
|
471
|
+
const gap = 4;
|
|
472
|
+
const truncatorWidth = truncatorRef.current.offsetWidth;
|
|
473
|
+
let count = 1;
|
|
474
|
+
let totalWidth = stickerRefs.current[0].offsetWidth;
|
|
475
|
+
for (let i = 1; i < selectedItems.length; i++) {
|
|
476
|
+
const itemWidth = stickerRefs.current[i].offsetWidth;
|
|
477
|
+
const wouldBeLastItem = i === selectedItems.length - 1;
|
|
478
|
+
const widthWithItem = totalWidth + gap + itemWidth;
|
|
479
|
+
if (widthWithItem + (wouldBeLastItem ? 0 : gap + truncatorWidth) <= availableWidth) {
|
|
480
|
+
totalWidth = widthWithItem;
|
|
481
|
+
count++;
|
|
482
|
+
} else break;
|
|
483
|
+
}
|
|
484
|
+
setVisibleCount((prev) => prev === count ? prev : count);
|
|
485
|
+
};
|
|
486
|
+
const resizeObserver = new ResizeObserver(calculateVisibleCount);
|
|
487
|
+
resizeObserver.observe(containerRef.current);
|
|
488
|
+
return () => {
|
|
489
|
+
resizeObserver.disconnect();
|
|
490
|
+
};
|
|
491
|
+
}, [
|
|
492
|
+
selectedItems,
|
|
493
|
+
stickerRefs,
|
|
494
|
+
truncatorRef,
|
|
495
|
+
containerRef,
|
|
496
|
+
truncate
|
|
497
|
+
]);
|
|
498
|
+
return visibleCount;
|
|
499
|
+
}
|
|
500
|
+
//#endregion
|
|
501
|
+
//#region components/Combobox/ComboboxMultiSelect.tsx
|
|
502
|
+
const SELECT_ALL_VALUE = "__SELECT_ALL__";
|
|
503
|
+
const EXTERNAL_TRIGGER_DROPDOWN_MIN_WIDTH$1 = "240px";
|
|
504
|
+
/**
|
|
505
|
+
* Recursively drop the `nested: true` flag from every group in the
|
|
506
|
+
* tree, converting nested-navigation groups into inline section-
|
|
507
|
+
* header groups. Multi-select doesn't implement the nested-nav UX
|
|
508
|
+
* (chevron rows, Back row, descent), so this graceful-degradation
|
|
509
|
+
* transform keeps every leaf reachable as a checkable option under
|
|
510
|
+
* its parent's section header — instead of having `flattenOptions` /
|
|
511
|
+
* `renderOptionsWithGroups` silently drop them along with their
|
|
512
|
+
* descendants. Single-select Combobox is unaffected; it owns its own
|
|
513
|
+
* nested-nav render path.
|
|
514
|
+
*
|
|
515
|
+
* For a multi-level tree (`{nested, options: [{nested, options}]}`),
|
|
516
|
+
* the inner inline group is walked through by `flattenOptions` so
|
|
517
|
+
* its leaves surface under the outer header — the inner label is
|
|
518
|
+
* lost, but all leaves stay reachable. Acceptable for the
|
|
519
|
+
* graceful-degradation goal; nested-nav can be added later without
|
|
520
|
+
* changing this API.
|
|
521
|
+
*/
|
|
522
|
+
function inlineNestedGroups(items) {
|
|
523
|
+
return items.map((item) => {
|
|
524
|
+
if (!isOptionGroup(item)) return item;
|
|
525
|
+
return {
|
|
526
|
+
label: item.label,
|
|
527
|
+
options: inlineNestedGroups(item.options)
|
|
528
|
+
};
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
const MultiSelectComboboxInput = (0, styled_components.default)(ComboboxInput)`
|
|
532
|
+
position: absolute;
|
|
533
|
+
inset: 0;
|
|
534
|
+
height: auto;
|
|
535
|
+
caret-color: transparent; /* Hide cursor in multi-select mode because we use stickers and focus into the search input */
|
|
536
|
+
`;
|
|
537
|
+
const MultiSelectScrollableMenuList = (0, styled_components.default)(ScrollableMenuList)`
|
|
538
|
+
max-height: calc(${MAX_DROPDOWN_HEIGHT} - 60px); /* Subtract approximate search bar height */
|
|
539
|
+
overflow-x: hidden; /* Prevent horizontal scrolling */
|
|
540
|
+
width: 100%; /* Ensure full width is used */
|
|
541
|
+
box-sizing: border-box;
|
|
542
|
+
${({ $embedded }) => $embedded && styled_components.css`
|
|
543
|
+
padding: 0;
|
|
544
|
+
`}
|
|
545
|
+
`;
|
|
546
|
+
const SelectedItemsContainer = styled_components.default.div`
|
|
547
|
+
position: relative; /* Establish positioning context */
|
|
548
|
+
box-sizing: border-box;
|
|
549
|
+
min-height: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[5] : _persona_design_tokens.Spacing[6]};
|
|
550
|
+
max-height: ${({ $truncate, $size }) => $truncate ? $size === "sm" ? _persona_design_tokens.Spacing[5] : _persona_design_tokens.Spacing[6] : "none"};
|
|
551
|
+
padding-left: ${_persona_design_tokens.Spacing[2]};
|
|
552
|
+
padding-right: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[5] : _persona_design_tokens.Spacing[6]}; /* Leave space for caret button. */
|
|
553
|
+
padding-top: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[1] : _persona_design_tokens.Spacing[2]};
|
|
554
|
+
padding-bottom: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[1] : _persona_design_tokens.Spacing[2]};
|
|
555
|
+
display: flex;
|
|
556
|
+
flex-wrap: ${({ $truncate }) => $truncate ? "nowrap" : "wrap"};
|
|
557
|
+
gap: ${_persona_design_tokens.Spacing[1]};
|
|
558
|
+
align-items: flex-start;
|
|
559
|
+
align-content: flex-start;
|
|
560
|
+
pointer-events: none; /* Allow clicks to pass through to underlying input */
|
|
561
|
+
overflow: hidden; /* Required for truncation when truncate mode is enabled */
|
|
562
|
+
|
|
563
|
+
/* Re-enable pointer events on stickers' dismiss buttons */
|
|
564
|
+
button {
|
|
565
|
+
pointer-events: auto;
|
|
566
|
+
}
|
|
567
|
+
`;
|
|
568
|
+
const TruncatedItemsWrapper = styled_components.default.div`
|
|
569
|
+
display: flex;
|
|
570
|
+
flex-wrap: nowrap;
|
|
571
|
+
gap: ${_persona_design_tokens.Spacing[1]};
|
|
572
|
+
overflow: hidden;
|
|
573
|
+
flex: 1;
|
|
574
|
+
min-width: 0; /* Allow shrinking below content size */
|
|
575
|
+
pointer-events: none;
|
|
576
|
+
`;
|
|
577
|
+
const TruncatedSticker = (0, styled_components.default)(require_Sticker.Sticker)`
|
|
578
|
+
/* Allow first sticker to truncate its text only when it's the only item */
|
|
579
|
+
flex-shrink: ${({ $isOnlyItem }) => $isOnlyItem ? 1 : 0};
|
|
580
|
+
min-width: 0;
|
|
581
|
+
max-width: 100%;
|
|
582
|
+
/* If the sticker is an inline element it was causing the parent to gain an extra pixel of height */
|
|
583
|
+
vertical-align: top;
|
|
584
|
+
`;
|
|
585
|
+
const TruncatorSticker = (0, styled_components.default)(require_Sticker.Sticker)`
|
|
586
|
+
/* Truncator should never shrink */
|
|
587
|
+
flex-shrink: 0;
|
|
588
|
+
/* If the sticker is an inline element it was causing the parent to gain an extra pixel of height */
|
|
589
|
+
vertical-align: top;
|
|
590
|
+
`;
|
|
591
|
+
const HiddenMeasurementContainer = styled_components.default.div`
|
|
592
|
+
position: absolute;
|
|
593
|
+
top: 0;
|
|
594
|
+
left: 0;
|
|
595
|
+
visibility: hidden;
|
|
596
|
+
display: flex;
|
|
597
|
+
flex-wrap: nowrap;
|
|
598
|
+
gap: ${_persona_design_tokens.Spacing[1]};
|
|
599
|
+
pointer-events: none;
|
|
600
|
+
overflow: hidden;
|
|
601
|
+
max-width: 100%;
|
|
602
|
+
`;
|
|
603
|
+
const StyledMenuItem$1 = (0, styled_components.default)(require_Menu.MenuItem)`
|
|
604
|
+
/* These heights should add up to 24 and 32 respectively and the content is 20 already */
|
|
605
|
+
padding: ${({ $size }) => $size === "sm" ? `2px ${_persona_design_tokens.Spacing[2]}` : `6px ${_persona_design_tokens.Spacing[2]}`};
|
|
606
|
+
display: flex;
|
|
607
|
+
flex-direction: column;
|
|
608
|
+
align-items: flex-start;
|
|
609
|
+
gap: ${_persona_design_tokens.Spacing[1]};
|
|
610
|
+
min-width: 0; /* Allow content to shrink below natural size */
|
|
611
|
+
width: 100%; /* Ensure full width of dropdown */
|
|
612
|
+
box-sizing: border-box;
|
|
613
|
+
|
|
614
|
+
/* Force all children to respect the container width */
|
|
615
|
+
> * {
|
|
616
|
+
width: 100%;
|
|
617
|
+
min-width: 0;
|
|
618
|
+
box-sizing: border-box;
|
|
619
|
+
}
|
|
620
|
+
`;
|
|
621
|
+
const CheckboxLabel = styled_components.default.span`
|
|
622
|
+
color: ${_persona_design_tokens.Color.TextPrimary};
|
|
623
|
+
${({ $size }) => $size === "sm" ? _persona_design_tokens.Typography.TextSmall : _persona_design_tokens.Typography.TextMedium};
|
|
624
|
+
display: flex;
|
|
625
|
+
flex-direction: column;
|
|
626
|
+
gap: ${_persona_design_tokens.Spacing[1]};
|
|
627
|
+
min-width: 0; /* Allow content to shrink below natural size */
|
|
628
|
+
|
|
629
|
+
/** Nudge text for visual alignment */
|
|
630
|
+
position: relative;
|
|
631
|
+
bottom: -1px;
|
|
632
|
+
`;
|
|
633
|
+
function ComboboxMultiSelectComponent({ size = "md", options: rawOptions, isOptionsLoading, values = [], onValuesChange, searchPlaceholder = "Search...", onInputChange, placeholder = "Select an option...", emptyStateMessage = "No options found", disabled = false, hasWarning, hasError, id, labelId, "aria-label": ariaLabel, onOpenChange, truncate = false, selectAll = false, stableOptionOrder = false, portal = false, portalContainerRef: externalPortalContainerRef, trigger, embedded = false, virtualize = false, ...props }, ref) {
|
|
634
|
+
const options = (0, react.useMemo)(() => containsNestedGroup(rawOptions) ? inlineNestedGroups(rawOptions) : rawOptions, [rawOptions]);
|
|
635
|
+
const field = require_useFormField.useFormField({
|
|
636
|
+
hasWarning,
|
|
637
|
+
hasError,
|
|
638
|
+
disabled,
|
|
639
|
+
inputId: id
|
|
640
|
+
});
|
|
641
|
+
const [inputValue, setInputValue] = (0, react.useState)("");
|
|
642
|
+
const searchInputRef = (0, react.useRef)(null);
|
|
643
|
+
const comboboxInputRef = (0, react.useRef)(null);
|
|
644
|
+
const caretButtonRef = (0, react.useRef)(null);
|
|
645
|
+
const comboboxContainerRef = (0, react.useRef)(null);
|
|
646
|
+
const scrollableListRef = (0, react.useRef)(null);
|
|
647
|
+
const selectedItemsContainerRef = (0, react.useRef)(null);
|
|
648
|
+
const measurementStickerRefs = (0, react.useRef)([]);
|
|
649
|
+
const measurementTruncatorRef = (0, react.useRef)(null);
|
|
650
|
+
const portalContainerRef = externalPortalContainerRef || comboboxContainerRef;
|
|
651
|
+
const flatOptions = (0, react.useMemo)(() => flattenOptions(options), [options]);
|
|
652
|
+
const selectedItems = flatOptions.filter((option) => values.includes(option.value));
|
|
653
|
+
(0, react.useEffect)(() => {
|
|
654
|
+
measurementStickerRefs.current = measurementStickerRefs.current.slice(0, selectedItems.length);
|
|
655
|
+
}, [selectedItems.length]);
|
|
656
|
+
const visibleCount = useTruncation(selectedItems, measurementStickerRefs, measurementTruncatorRef, selectedItemsContainerRef, truncate);
|
|
657
|
+
(0, react.useImperativeHandle)(ref, () => ({
|
|
658
|
+
...comboboxInputRef.current,
|
|
659
|
+
focusSearchInput: () => {
|
|
660
|
+
if (searchInputRef.current) searchInputRef.current.focus();
|
|
661
|
+
}
|
|
662
|
+
}), []);
|
|
663
|
+
const filteredOptions = useFilteredOptions(options, inputValue);
|
|
664
|
+
const isGrouped = (0, react.useMemo)(() => options.some(isOptionGroup), [options]);
|
|
665
|
+
const optionsWithSelectedFirstInGroups = (0, react.useMemo)(() => {
|
|
666
|
+
if (!isGrouped || values.length === 0 || stableOptionOrder) return options;
|
|
667
|
+
return options.map((item) => {
|
|
668
|
+
if (isOptionGroup(item)) {
|
|
669
|
+
const groupLeaves = flattenOptions(item.options);
|
|
670
|
+
return {
|
|
671
|
+
...item,
|
|
672
|
+
options: groupLeaves.toSorted((a, b) => {
|
|
673
|
+
const aSelected = values.includes(a.value);
|
|
674
|
+
if (aSelected === values.includes(b.value)) return 0;
|
|
675
|
+
return aSelected ? -1 : 1;
|
|
676
|
+
})
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
return item;
|
|
680
|
+
});
|
|
681
|
+
}, [
|
|
682
|
+
options,
|
|
683
|
+
isGrouped,
|
|
684
|
+
values,
|
|
685
|
+
stableOptionOrder
|
|
686
|
+
]);
|
|
687
|
+
const navigableItems = (0, react.useMemo)(() => {
|
|
688
|
+
const items = [];
|
|
689
|
+
if (isGrouped && values.length > 0) {
|
|
690
|
+
if (selectAll && filteredOptions.length > 0) items.push({
|
|
691
|
+
value: SELECT_ALL_VALUE,
|
|
692
|
+
label: "Select all"
|
|
693
|
+
});
|
|
694
|
+
for (const item of optionsWithSelectedFirstInGroups) if (isOptionGroup(item)) {
|
|
695
|
+
for (const opt of flattenOptions(item.options)) if (filteredOptions.some((f) => f.value === opt.value)) items.push(opt);
|
|
696
|
+
} else if (filteredOptions.some((f) => f.value === item.value)) items.push(item);
|
|
697
|
+
return items;
|
|
698
|
+
}
|
|
699
|
+
const orderedFiltered = !isGrouped && values.length > 0 && !stableOptionOrder ? filteredOptions.toSorted((a, b) => {
|
|
700
|
+
const aSelected = values.includes(a.value);
|
|
701
|
+
if (aSelected === values.includes(b.value)) return 0;
|
|
702
|
+
return aSelected ? -1 : 1;
|
|
703
|
+
}) : filteredOptions;
|
|
704
|
+
if (selectAll && orderedFiltered.length > 0) items.push({
|
|
705
|
+
value: SELECT_ALL_VALUE,
|
|
706
|
+
label: "Select all"
|
|
707
|
+
});
|
|
708
|
+
items.push(...orderedFiltered);
|
|
709
|
+
return items;
|
|
710
|
+
}, [
|
|
711
|
+
selectAll,
|
|
712
|
+
filteredOptions,
|
|
713
|
+
isGrouped,
|
|
714
|
+
values,
|
|
715
|
+
optionsWithSelectedFirstInGroups,
|
|
716
|
+
stableOptionOrder
|
|
717
|
+
]);
|
|
718
|
+
const optionsToRender = (0, react.useMemo)(() => {
|
|
719
|
+
if (!isGrouped && values.length > 0) return navigableItems;
|
|
720
|
+
const hasSelectAll = selectAll && filteredOptions.length > 0 && navigableItems[0]?.value === SELECT_ALL_VALUE;
|
|
721
|
+
const baseOptions = isGrouped && values.length > 0 ? optionsWithSelectedFirstInGroups : options;
|
|
722
|
+
return hasSelectAll ? [navigableItems[0], ...baseOptions] : baseOptions;
|
|
723
|
+
}, [
|
|
724
|
+
isGrouped,
|
|
725
|
+
values,
|
|
726
|
+
navigableItems,
|
|
727
|
+
selectAll,
|
|
728
|
+
filteredOptions,
|
|
729
|
+
optionsWithSelectedFirstInGroups,
|
|
730
|
+
options
|
|
731
|
+
]);
|
|
732
|
+
const navigableToVirtualRowRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
733
|
+
const virtualRows = (0, react.useMemo)(() => {
|
|
734
|
+
if (!virtualize) return [];
|
|
735
|
+
const map = /* @__PURE__ */ new Map();
|
|
736
|
+
const rows = buildVirtualRows(optionsToRender, navigableItems, map);
|
|
737
|
+
navigableToVirtualRowRef.current = map;
|
|
738
|
+
return rows;
|
|
739
|
+
}, [
|
|
740
|
+
optionsToRender,
|
|
741
|
+
navigableItems,
|
|
742
|
+
virtualize
|
|
743
|
+
]);
|
|
744
|
+
const virtualizer = (0, _tanstack_react_virtual.useVirtualizer)({
|
|
745
|
+
count: virtualRows.length,
|
|
746
|
+
getScrollElement: () => scrollableListRef.current,
|
|
747
|
+
estimateSize: () => size === "sm" ? 24 : 32,
|
|
748
|
+
overscan: 5
|
|
749
|
+
});
|
|
750
|
+
const itemToString = (0, react.useCallback)((item) => {
|
|
751
|
+
return item ? item.label : "";
|
|
752
|
+
}, []);
|
|
753
|
+
const { addSelectedItem, getSelectedItemProps, getDropdownProps, removeSelectedItem, reset, setSelectedItems } = (0, downshift.useMultipleSelection)({
|
|
754
|
+
selectedItems,
|
|
755
|
+
onStateChange: ({ selectedItems: newSelectedItems, type }) => {
|
|
756
|
+
switch (type) {
|
|
757
|
+
case downshift.useMultipleSelection.stateChangeTypes.SelectedItemKeyDownBackspace:
|
|
758
|
+
case downshift.useMultipleSelection.stateChangeTypes.SelectedItemKeyDownDelete:
|
|
759
|
+
case downshift.useMultipleSelection.stateChangeTypes.DropdownKeyDownBackspace:
|
|
760
|
+
case downshift.useMultipleSelection.stateChangeTypes.FunctionRemoveSelectedItem:
|
|
761
|
+
case downshift.useMultipleSelection.stateChangeTypes.FunctionAddSelectedItem:
|
|
762
|
+
case downshift.useMultipleSelection.stateChangeTypes.FunctionSetSelectedItems:
|
|
763
|
+
if (onValuesChange && newSelectedItems) {
|
|
764
|
+
const newValues = newSelectedItems.map((item) => item.value);
|
|
765
|
+
onValuesChange?.(newValues);
|
|
766
|
+
}
|
|
767
|
+
break;
|
|
768
|
+
case downshift.useMultipleSelection.stateChangeTypes.FunctionReset:
|
|
769
|
+
if (onValuesChange) onValuesChange([]);
|
|
770
|
+
break;
|
|
771
|
+
default: break;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
const selectedState = (0, react.useMemo)(() => {
|
|
776
|
+
const counts = filteredOptions.reduce((acc, option) => {
|
|
777
|
+
if (values.includes(option.value)) acc.selected++;
|
|
778
|
+
else acc.notSelected++;
|
|
779
|
+
return acc;
|
|
780
|
+
}, {
|
|
781
|
+
selected: 0,
|
|
782
|
+
notSelected: 0
|
|
783
|
+
});
|
|
784
|
+
return {
|
|
785
|
+
allSelected: counts.selected === filteredOptions.length,
|
|
786
|
+
allNotSelected: counts.notSelected === filteredOptions.length,
|
|
787
|
+
indeterminate: counts.selected > 0 && counts.selected < filteredOptions.length
|
|
788
|
+
};
|
|
789
|
+
}, [values, filteredOptions]);
|
|
790
|
+
const handleSelectAllToggle = (0, react.useCallback)(() => {
|
|
791
|
+
if (selectedState.allSelected || selectedState.indeterminate) {
|
|
792
|
+
const visibleValues = filteredOptions.map((option) => option.value);
|
|
793
|
+
setSelectedItems(selectedItems.filter((item) => !visibleValues.includes(item.value)));
|
|
794
|
+
} else {
|
|
795
|
+
const newItems = filteredOptions.filter((option) => !values.includes(option.value));
|
|
796
|
+
setSelectedItems([...selectedItems, ...newItems]);
|
|
797
|
+
}
|
|
798
|
+
}, [
|
|
799
|
+
selectedState.allSelected,
|
|
800
|
+
selectedState.indeterminate,
|
|
801
|
+
filteredOptions,
|
|
802
|
+
selectedItems,
|
|
803
|
+
values,
|
|
804
|
+
setSelectedItems
|
|
805
|
+
]);
|
|
806
|
+
const { isOpen, getToggleButtonProps, getMenuProps, getInputProps, getItemProps, highlightedIndex, setHighlightedIndex, closeMenu, openMenu } = (0, downshift.useCombobox)({
|
|
807
|
+
items: navigableItems,
|
|
808
|
+
itemToString,
|
|
809
|
+
isOpen: embedded ? true : void 0,
|
|
810
|
+
selectedItem: null,
|
|
811
|
+
initialHighlightedIndex: 0,
|
|
812
|
+
defaultHighlightedIndex: 0,
|
|
813
|
+
onIsOpenChange({ isOpen: newIsOpen }) {
|
|
814
|
+
if (newIsOpen && inputValue !== "") setInputValue("");
|
|
815
|
+
},
|
|
816
|
+
onHighlightedIndexChange: ({ highlightedIndex, type }) => {
|
|
817
|
+
if (virtualize && type !== downshift.useCombobox.stateChangeTypes.MenuMouseLeave && highlightedIndex >= 0) {
|
|
818
|
+
const rowIndex = navigableToVirtualRowRef.current.get(highlightedIndex);
|
|
819
|
+
if (rowIndex != null) virtualizer.scrollToIndex(rowIndex, { align: "auto" });
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
onStateChange({ type, selectedItem: newSelectedItem, inputValue: newInputValue }) {
|
|
823
|
+
switch (type) {
|
|
824
|
+
case downshift.useCombobox.stateChangeTypes.InputChange:
|
|
825
|
+
setInputValue(newInputValue || "");
|
|
826
|
+
onInputChange?.(newInputValue || "");
|
|
827
|
+
break;
|
|
828
|
+
case downshift.useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
829
|
+
case downshift.useCombobox.stateChangeTypes.ItemClick:
|
|
830
|
+
if (newSelectedItem && newSelectedItem.value === SELECT_ALL_VALUE) {
|
|
831
|
+
handleSelectAllToggle();
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
if (newSelectedItem) if (values.includes(newSelectedItem.value)) removeSelectedItem(newSelectedItem);
|
|
835
|
+
else addSelectedItem(newSelectedItem);
|
|
836
|
+
break;
|
|
837
|
+
default: break;
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
stateReducer(state, actionAndChanges) {
|
|
841
|
+
const { type, changes } = actionAndChanges;
|
|
842
|
+
switch (type) {
|
|
843
|
+
case downshift.useCombobox.stateChangeTypes.ItemClick:
|
|
844
|
+
case downshift.useCombobox.stateChangeTypes.InputKeyDownEnter: return {
|
|
845
|
+
...changes,
|
|
846
|
+
isOpen: true,
|
|
847
|
+
inputValue: "",
|
|
848
|
+
highlightedIndex: state.highlightedIndex
|
|
849
|
+
};
|
|
850
|
+
case downshift.useCombobox.stateChangeTypes.InputBlur:
|
|
851
|
+
if (isOpen) return {
|
|
852
|
+
...changes,
|
|
853
|
+
isOpen: true
|
|
854
|
+
};
|
|
855
|
+
return changes;
|
|
856
|
+
case downshift.useCombobox.stateChangeTypes.InputClick:
|
|
857
|
+
case downshift.useCombobox.stateChangeTypes.ToggleButtonClick: return changes;
|
|
858
|
+
default: return changes;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
const renderOption = (0, react.useCallback)((option, currentIndex) => {
|
|
863
|
+
const isHighlighted = highlightedIndex === currentIndex;
|
|
864
|
+
const isSelected = values.includes(option.value);
|
|
865
|
+
if (option.value === SELECT_ALL_VALUE) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMenuItem$1, {
|
|
866
|
+
...getItemProps({
|
|
867
|
+
item: option,
|
|
868
|
+
index: currentIndex
|
|
869
|
+
}),
|
|
870
|
+
focused: isHighlighted,
|
|
871
|
+
selected: false,
|
|
872
|
+
"aria-labelledby": `combobox-option-label-${currentIndex}`,
|
|
873
|
+
$size: size,
|
|
874
|
+
tabIndex: -1,
|
|
875
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
876
|
+
direction: "horizontal",
|
|
877
|
+
align: "center",
|
|
878
|
+
spacing: _persona_design_tokens.Spacing[2],
|
|
879
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Checkbox, {
|
|
880
|
+
checked: selectedState.allSelected,
|
|
881
|
+
indeterminate: selectedState.indeterminate,
|
|
882
|
+
tabIndex: -1
|
|
883
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckboxLabel, {
|
|
884
|
+
id: `combobox-option-label-${currentIndex}`,
|
|
885
|
+
$size: size,
|
|
886
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionLabel, { children: option.label })
|
|
887
|
+
})]
|
|
888
|
+
})
|
|
889
|
+
}, "select-all");
|
|
890
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMenuItem$1, {
|
|
891
|
+
...getItemProps({
|
|
892
|
+
item: option,
|
|
893
|
+
index: currentIndex,
|
|
894
|
+
"aria-selected": isSelected
|
|
895
|
+
}),
|
|
896
|
+
focused: isHighlighted,
|
|
897
|
+
selected: false,
|
|
898
|
+
"aria-labelledby": `combobox-option-label-${currentIndex}`,
|
|
899
|
+
$size: size,
|
|
900
|
+
tabIndex: -1,
|
|
901
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
902
|
+
direction: "horizontal",
|
|
903
|
+
align: "center",
|
|
904
|
+
spacing: _persona_design_tokens.Spacing[2],
|
|
905
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Checkbox, {
|
|
906
|
+
checked: isSelected,
|
|
907
|
+
tabIndex: -1
|
|
908
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckboxLabel, {
|
|
909
|
+
id: `combobox-option-label-${currentIndex}`,
|
|
910
|
+
$size: size,
|
|
911
|
+
children: option.labelStickerVariant ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Sticker.Sticker, {
|
|
912
|
+
variant: option.labelStickerVariant,
|
|
913
|
+
children: option.label
|
|
914
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionLabel, {
|
|
915
|
+
title: option.label,
|
|
916
|
+
$labelStyle: option.PLEASE_DO_NOT_USE_labelFontStyle,
|
|
917
|
+
children: option.label
|
|
918
|
+
}), option.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Description, {
|
|
919
|
+
title: option.description,
|
|
920
|
+
children: option.description
|
|
921
|
+
})] })
|
|
922
|
+
})]
|
|
923
|
+
})
|
|
924
|
+
}, `${option.value}-${currentIndex}`);
|
|
925
|
+
}, [
|
|
926
|
+
highlightedIndex,
|
|
927
|
+
values,
|
|
928
|
+
getItemProps,
|
|
929
|
+
size,
|
|
930
|
+
selectedState
|
|
931
|
+
]);
|
|
932
|
+
const isMenuOpen = isOpen;
|
|
933
|
+
const handleKeyDown = (0, react.useCallback)((event) => {
|
|
934
|
+
if (event.key === "Enter" && !isMenuOpen) openMenu();
|
|
935
|
+
}, [isMenuOpen, openMenu]);
|
|
936
|
+
const dropdownPosition = useDropdownPosition(portalContainerRef, isMenuOpen, embedded ? false : portal);
|
|
937
|
+
(0, react.useEffect)(() => {
|
|
938
|
+
onOpenChange?.(isMenuOpen);
|
|
939
|
+
}, [isMenuOpen, onOpenChange]);
|
|
940
|
+
(0, react.useEffect)(() => {
|
|
941
|
+
if (isMenuOpen && navigableItems.length > 0) {
|
|
942
|
+
if (highlightedIndex === -1 || highlightedIndex >= navigableItems.length) setHighlightedIndex(0);
|
|
943
|
+
}
|
|
944
|
+
}, [
|
|
945
|
+
navigableItems,
|
|
946
|
+
isMenuOpen,
|
|
947
|
+
highlightedIndex,
|
|
948
|
+
setHighlightedIndex
|
|
949
|
+
]);
|
|
950
|
+
const searchInputId = `${field.inputId}-search`;
|
|
951
|
+
(0, react.useEffect)(() => {
|
|
952
|
+
if (isMenuOpen && searchInputRef.current) searchInputRef.current.focus();
|
|
953
|
+
}, [isMenuOpen]);
|
|
954
|
+
const handleSearchInputKeyDown = (0, react.useCallback)((e) => {
|
|
955
|
+
if (e.key === "ArrowDown" && navigableItems.length > 0) {
|
|
956
|
+
e.preventDefault();
|
|
957
|
+
setHighlightedIndex(highlightedIndex === -1 ? 0 : (highlightedIndex + 1) % navigableItems.length);
|
|
958
|
+
}
|
|
959
|
+
if (e.key === "ArrowUp" && navigableItems.length > 0) {
|
|
960
|
+
e.preventDefault();
|
|
961
|
+
setHighlightedIndex(highlightedIndex === -1 ? navigableItems.length - 1 : (highlightedIndex - 1 + navigableItems.length) % navigableItems.length);
|
|
962
|
+
}
|
|
963
|
+
if (e.key === "Enter" && highlightedIndex >= 0 && navigableItems[highlightedIndex]) {
|
|
964
|
+
e.preventDefault();
|
|
965
|
+
const selectedItem = navigableItems[highlightedIndex];
|
|
966
|
+
if (selectedItem.value === SELECT_ALL_VALUE) {
|
|
967
|
+
handleSelectAllToggle();
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
if (values.includes(selectedItem.value)) removeSelectedItem(selectedItem);
|
|
971
|
+
else addSelectedItem(selectedItem);
|
|
972
|
+
}
|
|
973
|
+
if (e.key === "Escape") {
|
|
974
|
+
closeMenu();
|
|
975
|
+
if (comboboxInputRef.current) comboboxInputRef.current.focus();
|
|
976
|
+
}
|
|
977
|
+
if (e.key === "Tab" && highlightedIndex >= 0 && navigableItems[highlightedIndex]) closeMenu();
|
|
978
|
+
}, [
|
|
979
|
+
navigableItems,
|
|
980
|
+
highlightedIndex,
|
|
981
|
+
setHighlightedIndex,
|
|
982
|
+
values,
|
|
983
|
+
addSelectedItem,
|
|
984
|
+
removeSelectedItem,
|
|
985
|
+
closeMenu,
|
|
986
|
+
comboboxInputRef,
|
|
987
|
+
handleSelectAllToggle
|
|
988
|
+
]);
|
|
989
|
+
require_lib_useOutsideClick.useOutsideClick({
|
|
990
|
+
ref: comboboxContainerRef,
|
|
991
|
+
onOutsideClick: (0, react.useCallback)((e) => {
|
|
992
|
+
if (!embedded && isMenuOpen && !e.target?.closest("#combobox-dropdown-portal-wrapper")) closeMenu();
|
|
993
|
+
}, [
|
|
994
|
+
embedded,
|
|
995
|
+
isMenuOpen,
|
|
996
|
+
closeMenu
|
|
997
|
+
])
|
|
998
|
+
});
|
|
999
|
+
const externalTrigger = (() => {
|
|
1000
|
+
if (embedded || trigger == null || !(0, react.isValidElement)(trigger)) return null;
|
|
1001
|
+
const triggerProps = trigger.props;
|
|
1002
|
+
return (0, react.cloneElement)(trigger, getToggleButtonProps({
|
|
1003
|
+
...triggerProps,
|
|
1004
|
+
disabled: field.disabled || Boolean(triggerProps.disabled)
|
|
1005
|
+
}));
|
|
1006
|
+
})();
|
|
1007
|
+
const handleSearchInputBlur = (0, react.useCallback)((e) => {
|
|
1008
|
+
if (!isMenuOpen) return;
|
|
1009
|
+
const relatedTarget = e.relatedTarget;
|
|
1010
|
+
if (!embedded && (!relatedTarget || !comboboxContainerRef.current?.contains(relatedTarget))) closeMenu();
|
|
1011
|
+
}, [
|
|
1012
|
+
embedded,
|
|
1013
|
+
isMenuOpen,
|
|
1014
|
+
closeMenu
|
|
1015
|
+
]);
|
|
1016
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Container, {
|
|
1017
|
+
...props,
|
|
1018
|
+
ref: comboboxContainerRef,
|
|
1019
|
+
children: [embedded ? null : externalTrigger != null ? externalTrigger : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(InputContainer, { children: [
|
|
1020
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MultiSelectComboboxInput, {
|
|
1021
|
+
...getInputProps(getDropdownProps({
|
|
1022
|
+
...props,
|
|
1023
|
+
ref: comboboxInputRef,
|
|
1024
|
+
id: field.inputId,
|
|
1025
|
+
placeholder: selectedItems.length === 0 ? placeholder : "",
|
|
1026
|
+
disabled: field.disabled,
|
|
1027
|
+
"aria-label": ariaLabel,
|
|
1028
|
+
"aria-labelledby": labelId,
|
|
1029
|
+
"aria-describedby": [field.helperTextId, field.hasWarning ? field.warningTextId : null].filter(Boolean).join(" ") || void 0,
|
|
1030
|
+
"aria-errormessage": field.hasError ? field.errorTextId : void 0,
|
|
1031
|
+
"aria-invalid": field.hasError,
|
|
1032
|
+
preventKeyAction: isMenuOpen,
|
|
1033
|
+
onKeyDown: handleKeyDown
|
|
1034
|
+
})),
|
|
1035
|
+
size,
|
|
1036
|
+
$isOpen: isMenuOpen,
|
|
1037
|
+
hasWarning: field.hasWarning,
|
|
1038
|
+
hasError: field.hasError,
|
|
1039
|
+
value: ""
|
|
1040
|
+
}),
|
|
1041
|
+
truncate && selectedItems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HiddenMeasurementContainer, {
|
|
1042
|
+
"aria-hidden": "true",
|
|
1043
|
+
children: [selectedItems.map((item, index) => {
|
|
1044
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1045
|
+
ref: (el) => measurementStickerRefs.current[index] = el,
|
|
1046
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Sticker.Sticker, {
|
|
1047
|
+
variant: flatOptions.find((opt) => opt.value === item.value)?.labelStickerVariant || "grey",
|
|
1048
|
+
disabled: field.disabled,
|
|
1049
|
+
children: item.label
|
|
1050
|
+
})
|
|
1051
|
+
}, `measurement-${item.value}-${index}`);
|
|
1052
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1053
|
+
ref: measurementTruncatorRef,
|
|
1054
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TruncatorSticker, {
|
|
1055
|
+
variant: "grey",
|
|
1056
|
+
disabled: field.disabled,
|
|
1057
|
+
children: ["+", selectedItems.length - visibleCount]
|
|
1058
|
+
})
|
|
1059
|
+
})]
|
|
1060
|
+
}),
|
|
1061
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectedItemsContainer, {
|
|
1062
|
+
$size: size,
|
|
1063
|
+
$truncate: truncate,
|
|
1064
|
+
ref: selectedItemsContainerRef,
|
|
1065
|
+
children: truncate ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TruncatedItemsWrapper, { children: [selectedItems.slice(0, visibleCount).map((item, index) => {
|
|
1066
|
+
const { ref: _ref, ...stickerProps } = getSelectedItemProps({
|
|
1067
|
+
selectedItem: item,
|
|
1068
|
+
index
|
|
1069
|
+
});
|
|
1070
|
+
const stickerVariant = flatOptions.find((opt) => opt.value === item.value)?.labelStickerVariant || "grey";
|
|
1071
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TruncatedSticker, {
|
|
1072
|
+
...stickerProps,
|
|
1073
|
+
variant: stickerVariant,
|
|
1074
|
+
disabled: field.disabled,
|
|
1075
|
+
$isOnlyItem: visibleCount === 1,
|
|
1076
|
+
children: item.label
|
|
1077
|
+
}, `selected-${item.value}-${index}`);
|
|
1078
|
+
}), visibleCount < selectedItems.length && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TruncatorSticker, {
|
|
1079
|
+
variant: "grey",
|
|
1080
|
+
disabled: field.disabled,
|
|
1081
|
+
children: ["+", selectedItems.length - visibleCount]
|
|
1082
|
+
})] }) : selectedItems.map((item, index) => {
|
|
1083
|
+
const { ref, ...stickerProps } = getSelectedItemProps({
|
|
1084
|
+
selectedItem: item,
|
|
1085
|
+
index
|
|
1086
|
+
});
|
|
1087
|
+
const stickerVariant = flatOptions.find((opt) => opt.value === item.value)?.labelStickerVariant || "grey";
|
|
1088
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Sticker.Sticker, {
|
|
1089
|
+
...stickerProps,
|
|
1090
|
+
variant: stickerVariant,
|
|
1091
|
+
onDismiss: (e) => {
|
|
1092
|
+
e.stopPropagation();
|
|
1093
|
+
removeSelectedItem(item);
|
|
1094
|
+
},
|
|
1095
|
+
dismissButtonProps: { tabIndex: -1 },
|
|
1096
|
+
disabled: field.disabled,
|
|
1097
|
+
tabIndex: -1,
|
|
1098
|
+
children: item.label
|
|
1099
|
+
}, `selected-${item.value}-${index}`);
|
|
1100
|
+
})
|
|
1101
|
+
}),
|
|
1102
|
+
selectedItems.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CaretButton, {
|
|
1103
|
+
id: `${field.inputId}__clear-all`,
|
|
1104
|
+
onClick: reset,
|
|
1105
|
+
size,
|
|
1106
|
+
disabled: field.disabled,
|
|
1107
|
+
"aria-label": "Clear all selected items",
|
|
1108
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.CircleXInverseIcon, {})
|
|
1109
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CaretButton, {
|
|
1110
|
+
...getToggleButtonProps({ ref: caretButtonRef }),
|
|
1111
|
+
size,
|
|
1112
|
+
disabled: field.disabled,
|
|
1113
|
+
"aria-label": `${isMenuOpen ? "Close" : "Open"} options menu`,
|
|
1114
|
+
"aria-haspopup": "listbox",
|
|
1115
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.CaretDownIcon, {})
|
|
1116
|
+
})
|
|
1117
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownPortalWrapper, {
|
|
1118
|
+
portal: embedded ? false : portal,
|
|
1119
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownContainer, {
|
|
1120
|
+
$isOpen: isMenuOpen,
|
|
1121
|
+
$portal: embedded ? false : portal,
|
|
1122
|
+
$embedded: embedded,
|
|
1123
|
+
$top: dropdownPosition.top,
|
|
1124
|
+
$left: dropdownPosition.left,
|
|
1125
|
+
$width: dropdownPosition.width,
|
|
1126
|
+
$minWidth: externalTrigger ? EXTERNAL_TRIGGER_DROPDOWN_MIN_WIDTH$1 : void 0,
|
|
1127
|
+
...getMenuProps(),
|
|
1128
|
+
"aria-multiselectable": "true",
|
|
1129
|
+
children: [isMenuOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInputContainer, {
|
|
1130
|
+
$embedded: embedded,
|
|
1131
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input.InputGroup, {
|
|
1132
|
+
leftIcon: embedded ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.SearchIcon, {}),
|
|
1133
|
+
size,
|
|
1134
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
|
|
1135
|
+
$embedded: embedded,
|
|
1136
|
+
id: searchInputId,
|
|
1137
|
+
ref: searchInputRef,
|
|
1138
|
+
placeholder: searchPlaceholder,
|
|
1139
|
+
value: inputValue,
|
|
1140
|
+
onChange: (e) => {
|
|
1141
|
+
setInputValue(e.target.value);
|
|
1142
|
+
onInputChange?.(e.target.value);
|
|
1143
|
+
},
|
|
1144
|
+
onKeyDown: handleSearchInputKeyDown,
|
|
1145
|
+
onBlur: handleSearchInputBlur,
|
|
1146
|
+
disabled: field.disabled,
|
|
1147
|
+
"aria-label": embedded ? "Search options" : ariaLabel ?? searchPlaceholder,
|
|
1148
|
+
size
|
|
1149
|
+
})
|
|
1150
|
+
})
|
|
1151
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MultiSelectScrollableMenuList, {
|
|
1152
|
+
$embedded: embedded,
|
|
1153
|
+
tabIndex: -1,
|
|
1154
|
+
ref: scrollableListRef,
|
|
1155
|
+
children: isMenuOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: isOptionsLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadingContainer, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Spinner.Spinner, { size: "md" }) }) : navigableItems.length > 0 ? renderOptionsWithGroups({
|
|
1156
|
+
options: optionsToRender,
|
|
1157
|
+
filteredOptions: navigableItems,
|
|
1158
|
+
renderOption,
|
|
1159
|
+
virtualizer: virtualize ? virtualizer : void 0,
|
|
1160
|
+
virtualRows: virtualize ? virtualRows : void 0
|
|
1161
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmptyState, {
|
|
1162
|
+
role: "status",
|
|
1163
|
+
"aria-live": "polite",
|
|
1164
|
+
size,
|
|
1165
|
+
children: emptyStateMessage
|
|
1166
|
+
}) })
|
|
1167
|
+
})]
|
|
1168
|
+
})
|
|
1169
|
+
})]
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
const ComboboxMultiSelect = (0, react.forwardRef)(ComboboxMultiSelectComponent);
|
|
1173
|
+
//#endregion
|
|
1174
|
+
//#region components/Combobox/ComboboxSingleSelect.tsx
|
|
1175
|
+
const StyledMenuItem = (0, styled_components.default)(require_Menu.MenuItem)`
|
|
1176
|
+
display: flex;
|
|
1177
|
+
flex-direction: column;
|
|
1178
|
+
align-items: flex-start;
|
|
1179
|
+
gap: ${_persona_design_tokens.Spacing[1]};
|
|
1180
|
+
min-width: 0; /* Allow content to shrink below natural size */
|
|
1181
|
+
width: 100%; /* Ensure full width of dropdown */
|
|
1182
|
+
box-sizing: border-box;
|
|
1183
|
+
|
|
1184
|
+
/* Force all children to respect the container width */
|
|
1185
|
+
> * {
|
|
1186
|
+
width: 100%;
|
|
1187
|
+
min-width: 0;
|
|
1188
|
+
box-sizing: border-box;
|
|
1189
|
+
}
|
|
1190
|
+
`;
|
|
1191
|
+
const ParentMenuItem = (0, styled_components.default)(require_Menu.MenuItem)`
|
|
1192
|
+
${require_Menu.IconContainer} {
|
|
1193
|
+
margin-right: 0;
|
|
1194
|
+
}
|
|
1195
|
+
`;
|
|
1196
|
+
const ParentChevron = styled_components.default.span`
|
|
1197
|
+
display: inline-flex;
|
|
1198
|
+
align-items: center;
|
|
1199
|
+
color: ${_persona_design_tokens.Color.BorderIconSecondary};
|
|
1200
|
+
`;
|
|
1201
|
+
const EXTERNAL_TRIGGER_DROPDOWN_MIN_WIDTH = "240px";
|
|
1202
|
+
const SingleSelectScrollableMenuList = (0, styled_components.default)(ScrollableMenuList)`
|
|
1203
|
+
${({ $embedded }) => $embedded && styled_components.css`
|
|
1204
|
+
padding: 0;
|
|
1205
|
+
`}
|
|
1206
|
+
`;
|
|
1207
|
+
const BackRow = styled_components.default.button`
|
|
1208
|
+
display: flex;
|
|
1209
|
+
align-items: center;
|
|
1210
|
+
gap: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[1] : _persona_design_tokens.Spacing[2]};
|
|
1211
|
+
width: 100%;
|
|
1212
|
+
padding: ${({ $size }) => $size === "sm" ? `${_persona_design_tokens.Spacing[1]} ${_persona_design_tokens.Spacing[2]}` : _persona_design_tokens.Spacing[2]};
|
|
1213
|
+
background: transparent;
|
|
1214
|
+
border: 0;
|
|
1215
|
+
cursor: pointer;
|
|
1216
|
+
color: ${_persona_design_tokens.Color.TextPrimary};
|
|
1217
|
+
${({ $size }) => $size === "sm" ? _persona_design_tokens.Typography.TextSmall : _persona_design_tokens.Typography.TextMedium};
|
|
1218
|
+
|
|
1219
|
+
svg {
|
|
1220
|
+
color: ${_persona_design_tokens.Color.BorderIconPrimary};
|
|
1221
|
+
}
|
|
1222
|
+
`;
|
|
1223
|
+
const StickerDisplay = (0, styled_components.default)(require_Sticker.Sticker)`
|
|
1224
|
+
position: absolute;
|
|
1225
|
+
left: ${_persona_design_tokens.Spacing[2]};
|
|
1226
|
+
top: 50%;
|
|
1227
|
+
transform: translateY(-50%);
|
|
1228
|
+
pointer-events: none;
|
|
1229
|
+
z-index: 1;
|
|
1230
|
+
`;
|
|
1231
|
+
const StickerComboboxInput = (0, styled_components.default)(ComboboxInput)`
|
|
1232
|
+
/* Hide text when sticker is shown */
|
|
1233
|
+
color: transparent;
|
|
1234
|
+
caret-color: transparent;
|
|
1235
|
+
`;
|
|
1236
|
+
function ComboboxSingleSelectComponent({ size = "md", options, isOptionsLoading, value, onChange, onInputChange, placeholder = "Select an option...", emptyStateMessage = "No options found", disabled = false, hasWarning, hasError, id, labelId, "aria-label": ariaLabel, onOpenChange, portal = false, portalContainerRef: externalPortalContainerRef, trigger, embedded = false, ...props }, ref) {
|
|
1237
|
+
const field = require_useFormField.useFormField({
|
|
1238
|
+
hasWarning,
|
|
1239
|
+
hasError,
|
|
1240
|
+
disabled,
|
|
1241
|
+
inputId: id
|
|
1242
|
+
});
|
|
1243
|
+
const [inputValue, setInputValue] = (0, react.useState)("");
|
|
1244
|
+
const [isDropdownOpen, setIsDropdownOpen] = (0, react.useState)(false);
|
|
1245
|
+
const [navigationPath, setNavigationPath] = (0, react.useState)([]);
|
|
1246
|
+
const comboboxInputRef = (0, react.useRef)(null);
|
|
1247
|
+
const internalContainerRef = (0, react.useRef)(null);
|
|
1248
|
+
const pendingDescentRef = (0, react.useRef)(null);
|
|
1249
|
+
const portalContainerRef = externalPortalContainerRef || internalContainerRef;
|
|
1250
|
+
(0, react.useImperativeHandle)(ref, () => ({ ...comboboxInputRef.current }), []);
|
|
1251
|
+
const isSearching = inputValue.trim() !== "";
|
|
1252
|
+
const nestedOptions = (0, react.useMemo)(() => getOptionsAtPath(options, navigationPath), [options, navigationPath]);
|
|
1253
|
+
const hasNestedGroups = (0, react.useMemo)(() => containsNestedGroup(options), [options]);
|
|
1254
|
+
const navigableItems = (0, react.useMemo)(() => getNavigableItemsAtLevel(nestedOptions), [nestedOptions]);
|
|
1255
|
+
const searchableLeaves = (0, react.useMemo)(() => {
|
|
1256
|
+
if (!isSearching || !hasNestedGroups) return [];
|
|
1257
|
+
return flattenLeafOptions(options).map(({ option }) => option);
|
|
1258
|
+
}, [
|
|
1259
|
+
options,
|
|
1260
|
+
isSearching,
|
|
1261
|
+
hasNestedGroups
|
|
1262
|
+
]);
|
|
1263
|
+
const searchableLeafFuse = (0, react.useMemo)(() => {
|
|
1264
|
+
if (!isSearching || !hasNestedGroups) return null;
|
|
1265
|
+
return new fuse_js.default(flattenLeafOptions(options).map(({ option, breadcrumb }) => ({
|
|
1266
|
+
option,
|
|
1267
|
+
label: String(option.label),
|
|
1268
|
+
description: option.description,
|
|
1269
|
+
ancestors: breadcrumb.join(" ")
|
|
1270
|
+
})), {
|
|
1271
|
+
shouldSort: false,
|
|
1272
|
+
threshold: 0,
|
|
1273
|
+
ignoreLocation: true,
|
|
1274
|
+
minMatchCharLength: 1,
|
|
1275
|
+
keys: [
|
|
1276
|
+
"label",
|
|
1277
|
+
"description",
|
|
1278
|
+
"ancestors"
|
|
1279
|
+
]
|
|
1280
|
+
});
|
|
1281
|
+
}, [
|
|
1282
|
+
options,
|
|
1283
|
+
isSearching,
|
|
1284
|
+
hasNestedGroups
|
|
1285
|
+
]);
|
|
1286
|
+
const renderSource = isSearching ? hasNestedGroups ? searchableLeaves : options : nestedOptions;
|
|
1287
|
+
const standardFilteredOptions = useFilteredOptions(renderSource, inputValue);
|
|
1288
|
+
const filteredOptions = (0, react.useMemo)(() => {
|
|
1289
|
+
if (!isSearching || !hasNestedGroups || searchableLeafFuse == null) return standardFilteredOptions;
|
|
1290
|
+
if (inputValue === "") return searchableLeaves;
|
|
1291
|
+
return Array.from(new Set(searchableLeafFuse.search(inputValue).map(({ item }) => item.option)).values());
|
|
1292
|
+
}, [
|
|
1293
|
+
isSearching,
|
|
1294
|
+
hasNestedGroups,
|
|
1295
|
+
searchableLeafFuse,
|
|
1296
|
+
inputValue,
|
|
1297
|
+
searchableLeaves,
|
|
1298
|
+
standardFilteredOptions
|
|
1299
|
+
]);
|
|
1300
|
+
const downshiftItems = (0, react.useMemo)(() => {
|
|
1301
|
+
if (isSearching) return filteredOptions.map((option) => ({
|
|
1302
|
+
kind: "leaf",
|
|
1303
|
+
option
|
|
1304
|
+
}));
|
|
1305
|
+
return navigableItems.filter((item) => item.kind === "group" || filteredOptions.some((f) => f.value === item.option.value));
|
|
1306
|
+
}, [
|
|
1307
|
+
isSearching,
|
|
1308
|
+
filteredOptions,
|
|
1309
|
+
navigableItems
|
|
1310
|
+
]);
|
|
1311
|
+
const allLeaves = (0, react.useMemo)(() => flattenLeafOptions(options), [options]);
|
|
1312
|
+
const flatOptionsForFallback = (0, react.useMemo)(() => flattenOptions(options), [options]);
|
|
1313
|
+
const selectedOption = allLeaves.find(({ option }) => option.value === value)?.option ?? flatOptionsForFallback.find((option) => option.value === value) ?? null;
|
|
1314
|
+
const selectedNavigableItem = (0, react.useMemo)(() => selectedOption ? {
|
|
1315
|
+
kind: "leaf",
|
|
1316
|
+
option: selectedOption
|
|
1317
|
+
} : null, [selectedOption?.value, selectedOption?.label]);
|
|
1318
|
+
const itemToString = (0, react.useCallback)((item) => {
|
|
1319
|
+
if (!item) return "";
|
|
1320
|
+
return item.kind === "leaf" ? item.option.label : item.group.label;
|
|
1321
|
+
}, []);
|
|
1322
|
+
const handleAscend = (0, react.useCallback)(() => {
|
|
1323
|
+
setNavigationPath((prev) => prev.length > 0 ? prev.slice(0, -1) : prev);
|
|
1324
|
+
setInputValue("");
|
|
1325
|
+
}, []);
|
|
1326
|
+
const handleDescend = (0, react.useCallback)((groupLabel) => {
|
|
1327
|
+
setNavigationPath((prev) => [...prev, groupLabel]);
|
|
1328
|
+
setInputValue("");
|
|
1329
|
+
}, []);
|
|
1330
|
+
const { isOpen, getToggleButtonProps, getMenuProps, getInputProps, getItemProps, highlightedIndex, setHighlightedIndex, openMenu } = (0, downshift.useCombobox)({
|
|
1331
|
+
items: downshiftItems,
|
|
1332
|
+
itemToString,
|
|
1333
|
+
isOpen: embedded ? true : void 0,
|
|
1334
|
+
selectedItem: isDropdownOpen ? null : selectedNavigableItem,
|
|
1335
|
+
inputValue,
|
|
1336
|
+
onInputValueChange({ inputValue: newInputValue }) {
|
|
1337
|
+
if (newInputValue === "" && !embedded && trigger == null) onChange?.(null);
|
|
1338
|
+
setInputValue(newInputValue || "");
|
|
1339
|
+
onInputChange?.(newInputValue || "");
|
|
1340
|
+
},
|
|
1341
|
+
onIsOpenChange({ isOpen: newIsOpen }) {
|
|
1342
|
+
setIsDropdownOpen(newIsOpen);
|
|
1343
|
+
if (newIsOpen) {
|
|
1344
|
+
if (selectedOption || value && inputValue === flatOptionsForFallback.find((opt) => opt.value === value)?.label) setInputValue("");
|
|
1345
|
+
} else setInputValue(selectedOption?.label || "");
|
|
1346
|
+
},
|
|
1347
|
+
onSelectedItemChange: ({ selectedItem: newSelectedItem }) => {
|
|
1348
|
+
if (newSelectedItem == null || newSelectedItem.kind !== "leaf") return;
|
|
1349
|
+
const leaf = newSelectedItem.option;
|
|
1350
|
+
onChange?.(leaf.value);
|
|
1351
|
+
setInputValue(leaf.label);
|
|
1352
|
+
},
|
|
1353
|
+
stateReducer(state, actionAndChanges) {
|
|
1354
|
+
const { changes, type } = actionAndChanges;
|
|
1355
|
+
switch (type) {
|
|
1356
|
+
case downshift.useCombobox.stateChangeTypes.InputBlur: return {
|
|
1357
|
+
...changes,
|
|
1358
|
+
selectedItem: state.selectedItem
|
|
1359
|
+
};
|
|
1360
|
+
case downshift.useCombobox.stateChangeTypes.ItemClick:
|
|
1361
|
+
case downshift.useCombobox.stateChangeTypes.InputKeyDownEnter: {
|
|
1362
|
+
const candidate = changes.selectedItem;
|
|
1363
|
+
if (candidate && candidate.kind === "group") {
|
|
1364
|
+
pendingDescentRef.current = candidate.group.label;
|
|
1365
|
+
return {
|
|
1366
|
+
...changes,
|
|
1367
|
+
selectedItem: state.selectedItem,
|
|
1368
|
+
isOpen: true
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
return changes;
|
|
1372
|
+
}
|
|
1373
|
+
default: return changes;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
(0, react.useEffect)(() => {
|
|
1378
|
+
if (pendingDescentRef.current != null) {
|
|
1379
|
+
const target = pendingDescentRef.current;
|
|
1380
|
+
pendingDescentRef.current = null;
|
|
1381
|
+
handleDescend(target);
|
|
1382
|
+
}
|
|
1383
|
+
});
|
|
1384
|
+
(0, react.useEffect)(() => {
|
|
1385
|
+
if (!isOpen && !embedded && navigationPath.length > 0) setNavigationPath([]);
|
|
1386
|
+
}, [
|
|
1387
|
+
embedded,
|
|
1388
|
+
isOpen,
|
|
1389
|
+
navigationPath.length
|
|
1390
|
+
]);
|
|
1391
|
+
const renderLeaf = (0, react.useCallback)((option, currentIndex) => {
|
|
1392
|
+
const isHighlighted = highlightedIndex === currentIndex;
|
|
1393
|
+
const isSelected = selectedOption?.value === option.value;
|
|
1394
|
+
const itemProps = getItemProps({
|
|
1395
|
+
item: {
|
|
1396
|
+
kind: "leaf",
|
|
1397
|
+
option
|
|
1398
|
+
},
|
|
1399
|
+
index: currentIndex,
|
|
1400
|
+
"aria-selected": isSelected
|
|
1401
|
+
});
|
|
1402
|
+
const labelContent = option.labelStickerVariant ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Sticker.Sticker, {
|
|
1403
|
+
variant: option.labelStickerVariant,
|
|
1404
|
+
children: option.label
|
|
1405
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionLabel, {
|
|
1406
|
+
title: option.label,
|
|
1407
|
+
$labelStyle: option.PLEASE_DO_NOT_USE_labelFontStyle,
|
|
1408
|
+
children: option.label
|
|
1409
|
+
}), option.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Description, {
|
|
1410
|
+
title: option.description,
|
|
1411
|
+
children: option.description
|
|
1412
|
+
})] });
|
|
1413
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMenuItem, {
|
|
1414
|
+
...itemProps,
|
|
1415
|
+
focused: isHighlighted,
|
|
1416
|
+
selected: isSelected,
|
|
1417
|
+
size,
|
|
1418
|
+
tabIndex: -1,
|
|
1419
|
+
children: labelContent
|
|
1420
|
+
}, `leaf-${String(option.value)}-${currentIndex}`);
|
|
1421
|
+
}, [
|
|
1422
|
+
highlightedIndex,
|
|
1423
|
+
selectedOption,
|
|
1424
|
+
getItemProps,
|
|
1425
|
+
size
|
|
1426
|
+
]);
|
|
1427
|
+
const renderNestedGroupRow = (0, react.useCallback)((group, currentIndex) => {
|
|
1428
|
+
const isHighlighted = highlightedIndex === currentIndex;
|
|
1429
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParentMenuItem, {
|
|
1430
|
+
...getItemProps({
|
|
1431
|
+
item: {
|
|
1432
|
+
kind: "group",
|
|
1433
|
+
group
|
|
1434
|
+
},
|
|
1435
|
+
index: currentIndex
|
|
1436
|
+
}),
|
|
1437
|
+
"aria-haspopup": "menu",
|
|
1438
|
+
focused: isHighlighted,
|
|
1439
|
+
size,
|
|
1440
|
+
tabIndex: -1,
|
|
1441
|
+
stretchLabel: true,
|
|
1442
|
+
suffixIcon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParentChevron, {
|
|
1443
|
+
"aria-hidden": "true",
|
|
1444
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.ChevronRightIcon, {})
|
|
1445
|
+
}),
|
|
1446
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionLabel, {
|
|
1447
|
+
title: group.label,
|
|
1448
|
+
children: group.label
|
|
1449
|
+
})
|
|
1450
|
+
}, `group-${group.label}-${currentIndex}`);
|
|
1451
|
+
}, [
|
|
1452
|
+
highlightedIndex,
|
|
1453
|
+
getItemProps,
|
|
1454
|
+
size
|
|
1455
|
+
]);
|
|
1456
|
+
const renderNestedLevel = (0, react.useCallback)((items) => {
|
|
1457
|
+
let navIndex = -1;
|
|
1458
|
+
const walk = (node, key) => {
|
|
1459
|
+
if (isOptionGroup(node)) {
|
|
1460
|
+
if (node.nested) {
|
|
1461
|
+
if (!downshiftItems.some((i) => i.kind === "group" && i.group === node)) return null;
|
|
1462
|
+
navIndex++;
|
|
1463
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: renderNestedGroupRow(node, navIndex) }, key);
|
|
1464
|
+
}
|
|
1465
|
+
const childNodes = [];
|
|
1466
|
+
for (let i = 0; i < node.options.length; i++) {
|
|
1467
|
+
const rendered = walk(node.options[i], `${key}-${i}`);
|
|
1468
|
+
if (rendered != null) childNodes.push(rendered);
|
|
1469
|
+
}
|
|
1470
|
+
if (childNodes.length === 0) return null;
|
|
1471
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Menu.MenuHeading, { children: node.label }), childNodes] }, key);
|
|
1472
|
+
}
|
|
1473
|
+
if (!downshiftItems.some((i) => i.kind === "leaf" && i.option === node)) return null;
|
|
1474
|
+
navIndex++;
|
|
1475
|
+
return renderLeaf(node, navIndex);
|
|
1476
|
+
};
|
|
1477
|
+
return items.map((item, idx) => walk(item, `item-${idx}`));
|
|
1478
|
+
}, [
|
|
1479
|
+
downshiftItems,
|
|
1480
|
+
renderLeaf,
|
|
1481
|
+
renderNestedGroupRow
|
|
1482
|
+
]);
|
|
1483
|
+
const renderOption = (0, react.useCallback)((option, currentIndex) => renderLeaf(option, currentIndex), [renderLeaf]);
|
|
1484
|
+
const isMenuOpen = isOpen;
|
|
1485
|
+
const dropdownPosition = useDropdownPosition(portalContainerRef, isMenuOpen, embedded ? false : portal);
|
|
1486
|
+
const handleKeyDown = (0, react.useCallback)((event) => {
|
|
1487
|
+
if (event.key === "Enter" && !isMenuOpen) {
|
|
1488
|
+
openMenu();
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
if (!isMenuOpen || isSearching) return;
|
|
1492
|
+
if (event.key === "ArrowRight") {
|
|
1493
|
+
const highlighted = downshiftItems[highlightedIndex];
|
|
1494
|
+
if (highlighted && highlighted.kind === "group") {
|
|
1495
|
+
event.preventDefault();
|
|
1496
|
+
handleDescend(highlighted.group.label);
|
|
1497
|
+
}
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
if (event.key === "ArrowLeft" && navigationPath.length > 0) {
|
|
1501
|
+
const input = event.currentTarget;
|
|
1502
|
+
if ((input.selectionStart ?? 0) === 0 && (input.selectionEnd ?? 0) === 0) {
|
|
1503
|
+
event.preventDefault();
|
|
1504
|
+
handleAscend();
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
}, [
|
|
1508
|
+
isMenuOpen,
|
|
1509
|
+
isSearching,
|
|
1510
|
+
downshiftItems,
|
|
1511
|
+
highlightedIndex,
|
|
1512
|
+
navigationPath.length,
|
|
1513
|
+
openMenu,
|
|
1514
|
+
handleDescend,
|
|
1515
|
+
handleAscend
|
|
1516
|
+
]);
|
|
1517
|
+
(0, react.useEffect)(() => {
|
|
1518
|
+
onOpenChange?.(isMenuOpen);
|
|
1519
|
+
}, [isMenuOpen, onOpenChange]);
|
|
1520
|
+
(0, react.useEffect)(() => {
|
|
1521
|
+
if (!isMenuOpen) setInputValue(selectedOption?.label || "");
|
|
1522
|
+
}, [selectedOption, isMenuOpen]);
|
|
1523
|
+
const selectedLabel = selectedOption?.label || "";
|
|
1524
|
+
(0, react.useEffect)(() => {
|
|
1525
|
+
if (embedded) setInputValue(selectedLabel);
|
|
1526
|
+
}, [selectedLabel, embedded]);
|
|
1527
|
+
(0, react.useEffect)(() => {
|
|
1528
|
+
if (isMenuOpen && downshiftItems.length > 0) {
|
|
1529
|
+
if (highlightedIndex === -1 || highlightedIndex >= downshiftItems.length) setHighlightedIndex(0);
|
|
1530
|
+
}
|
|
1531
|
+
}, [
|
|
1532
|
+
downshiftItems,
|
|
1533
|
+
isMenuOpen,
|
|
1534
|
+
highlightedIndex,
|
|
1535
|
+
setHighlightedIndex
|
|
1536
|
+
]);
|
|
1537
|
+
const displayValue = isMenuOpen ? inputValue : selectedOption?.label || "";
|
|
1538
|
+
const hasSticker = !isMenuOpen && selectedOption?.labelStickerVariant;
|
|
1539
|
+
const InputComponent = hasSticker ? StickerComboboxInput : ComboboxInput;
|
|
1540
|
+
const showBackRow = isMenuOpen && navigationPath.length > 0 && !isSearching;
|
|
1541
|
+
const externalTrigger = (() => {
|
|
1542
|
+
if (embedded || trigger == null || !(0, react.isValidElement)(trigger)) return null;
|
|
1543
|
+
const triggerProps = trigger.props;
|
|
1544
|
+
return (0, react.cloneElement)(trigger, getToggleButtonProps({
|
|
1545
|
+
...triggerProps,
|
|
1546
|
+
disabled: field.disabled || Boolean(triggerProps.disabled)
|
|
1547
|
+
}));
|
|
1548
|
+
})();
|
|
1549
|
+
const searchInputProps = getInputProps({
|
|
1550
|
+
ref: comboboxInputRef,
|
|
1551
|
+
id: field.inputId,
|
|
1552
|
+
placeholder: "Search…",
|
|
1553
|
+
disabled: field.disabled,
|
|
1554
|
+
"aria-label": embedded ? "Search options" : ariaLabel ?? "Search options",
|
|
1555
|
+
"aria-labelledby": embedded ? void 0 : labelId,
|
|
1556
|
+
"aria-describedby": [field.helperTextId, field.hasWarning ? field.warningTextId : null].filter(Boolean).join(" ") || void 0,
|
|
1557
|
+
"aria-errormessage": field.hasError ? field.errorTextId : void 0,
|
|
1558
|
+
"aria-invalid": field.hasError,
|
|
1559
|
+
onKeyDown: handleKeyDown
|
|
1560
|
+
});
|
|
1561
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Container, {
|
|
1562
|
+
...props,
|
|
1563
|
+
ref: internalContainerRef,
|
|
1564
|
+
children: [embedded ? null : externalTrigger != null ? externalTrigger : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(InputContainer, { children: [
|
|
1565
|
+
hasSticker && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StickerDisplay, {
|
|
1566
|
+
variant: selectedOption.labelStickerVariant,
|
|
1567
|
+
children: selectedOption.label
|
|
1568
|
+
}),
|
|
1569
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InputComponent, {
|
|
1570
|
+
...getInputProps({
|
|
1571
|
+
...props,
|
|
1572
|
+
ref: comboboxInputRef,
|
|
1573
|
+
id: field.inputId,
|
|
1574
|
+
placeholder,
|
|
1575
|
+
disabled: field.disabled,
|
|
1576
|
+
"aria-label": ariaLabel,
|
|
1577
|
+
"aria-labelledby": labelId,
|
|
1578
|
+
"aria-describedby": [field.helperTextId, field.hasWarning ? field.warningTextId : null].filter(Boolean).join(" ") || void 0,
|
|
1579
|
+
"aria-errormessage": field.hasError ? field.errorTextId : void 0,
|
|
1580
|
+
"aria-invalid": field.hasError,
|
|
1581
|
+
onKeyDown: handleKeyDown
|
|
1582
|
+
}),
|
|
1583
|
+
size,
|
|
1584
|
+
$isOpen: isMenuOpen,
|
|
1585
|
+
hasWarning: field.hasWarning,
|
|
1586
|
+
hasError: field.hasError,
|
|
1587
|
+
value: displayValue,
|
|
1588
|
+
$selectedItemStyle: selectedOption?.PLEASE_DO_NOT_USE_labelFontStyle
|
|
1589
|
+
}),
|
|
1590
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CaretButton, {
|
|
1591
|
+
...getToggleButtonProps(),
|
|
1592
|
+
size,
|
|
1593
|
+
disabled: field.disabled,
|
|
1594
|
+
"aria-label": `${isMenuOpen ? "Close" : "Open"} options menu`,
|
|
1595
|
+
"aria-haspopup": "listbox",
|
|
1596
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.CaretDownIcon, {})
|
|
1597
|
+
})
|
|
1598
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownPortalWrapper, {
|
|
1599
|
+
portal: embedded ? false : portal,
|
|
1600
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownContainer, {
|
|
1601
|
+
$isOpen: isMenuOpen,
|
|
1602
|
+
$portal: embedded ? false : portal,
|
|
1603
|
+
$embedded: embedded,
|
|
1604
|
+
$top: dropdownPosition.top,
|
|
1605
|
+
$left: dropdownPosition.left,
|
|
1606
|
+
$width: dropdownPosition.width,
|
|
1607
|
+
$minWidth: externalTrigger ? EXTERNAL_TRIGGER_DROPDOWN_MIN_WIDTH : void 0,
|
|
1608
|
+
...getMenuProps(),
|
|
1609
|
+
children: [(externalTrigger || embedded) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInputContainer, {
|
|
1610
|
+
$embedded: embedded,
|
|
1611
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input.InputGroup, {
|
|
1612
|
+
leftIcon: embedded ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.SearchIcon, {}),
|
|
1613
|
+
size,
|
|
1614
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
|
|
1615
|
+
$embedded: embedded,
|
|
1616
|
+
...searchInputProps,
|
|
1617
|
+
size,
|
|
1618
|
+
hasWarning: field.hasWarning,
|
|
1619
|
+
hasError: field.hasError,
|
|
1620
|
+
value: inputValue,
|
|
1621
|
+
autoComplete: "off"
|
|
1622
|
+
})
|
|
1623
|
+
})
|
|
1624
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SingleSelectScrollableMenuList, {
|
|
1625
|
+
$embedded: embedded,
|
|
1626
|
+
tabIndex: -1,
|
|
1627
|
+
children: isMenuOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [showBackRow && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BackRow, {
|
|
1628
|
+
type: "button",
|
|
1629
|
+
tabIndex: -1,
|
|
1630
|
+
onMouseDown: (event) => {
|
|
1631
|
+
event.preventDefault();
|
|
1632
|
+
handleAscend();
|
|
1633
|
+
},
|
|
1634
|
+
onClick: (event) => {
|
|
1635
|
+
if (event.detail === 0) handleAscend();
|
|
1636
|
+
},
|
|
1637
|
+
"aria-label": "Back to previous menu",
|
|
1638
|
+
$size: size,
|
|
1639
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.ArrowLeftIcon, {
|
|
1640
|
+
"aria-hidden": "true",
|
|
1641
|
+
size: size === "sm" ? 12 : 16
|
|
1642
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Back" })]
|
|
1643
|
+
}), isOptionsLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadingContainer, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Spinner.Spinner, { size: "md" }) }) : downshiftItems.length > 0 ? hasNestedGroups && !isSearching ? renderNestedLevel(nestedOptions) : renderOptionsWithGroups({
|
|
1644
|
+
options: renderSource,
|
|
1645
|
+
filteredOptions,
|
|
1646
|
+
renderOption
|
|
1647
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmptyState, {
|
|
1648
|
+
role: "status",
|
|
1649
|
+
"aria-live": "polite",
|
|
1650
|
+
size,
|
|
1651
|
+
children: emptyStateMessage
|
|
1652
|
+
})] })
|
|
1653
|
+
})]
|
|
1654
|
+
})
|
|
1655
|
+
})]
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
const ComboboxSingleSelect = (0, react.forwardRef)(ComboboxSingleSelectComponent);
|
|
1659
|
+
//#endregion
|
|
1660
|
+
//#region components/Combobox/Combobox.tsx
|
|
1661
|
+
function ComboboxComponent(props, ref) {
|
|
1662
|
+
if (props.multiple) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComboboxMultiSelect, {
|
|
1663
|
+
ref,
|
|
1664
|
+
...props
|
|
1665
|
+
});
|
|
1666
|
+
else return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComboboxSingleSelect, {
|
|
1667
|
+
ref,
|
|
1668
|
+
...props
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
const Combobox = (0, react.forwardRef)(ComboboxComponent);
|
|
1672
|
+
//#endregion
|
|
1673
|
+
Object.defineProperty(exports, "CaretButton", {
|
|
1674
|
+
enumerable: true,
|
|
1675
|
+
get: function() {
|
|
1676
|
+
return CaretButton;
|
|
1677
|
+
}
|
|
1678
|
+
});
|
|
1679
|
+
Object.defineProperty(exports, "Combobox", {
|
|
1680
|
+
enumerable: true,
|
|
1681
|
+
get: function() {
|
|
1682
|
+
return Combobox;
|
|
1683
|
+
}
|
|
1684
|
+
});
|
|
1685
|
+
Object.defineProperty(exports, "flattenOptions", {
|
|
1686
|
+
enumerable: true,
|
|
1687
|
+
get: function() {
|
|
1688
|
+
return flattenOptions;
|
|
1689
|
+
}
|
|
1690
|
+
});
|
|
1691
|
+
|
|
1692
|
+
//# sourceMappingURL=Combobox-B_oe33Re.cjs.map
|