@persona/design-system 0.1.8 → 0.1.9
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 +12 -0
- package/README.md +20 -1
- package/dist/Attribute.d.mts +1 -1
- package/dist/{Badge-DortWowZ.mjs → Badge-DEVbRlJX.mjs} +2 -2
- package/dist/{Badge-DortWowZ.mjs.map → Badge-DEVbRlJX.mjs.map} +1 -1
- package/dist/{Breadcrumbs-CDZ_Mrcg.mjs → Breadcrumbs-W8hIhdHD.mjs} +3 -3
- package/dist/{Breadcrumbs-CDZ_Mrcg.mjs.map → Breadcrumbs-W8hIhdHD.mjs.map} +1 -1
- package/dist/{Button-9p469xA1.d.mts → Button-Vd5O4DUp.d.mts} +3 -3
- package/dist/Button.d.mts +1 -1
- package/dist/CalendarBase.d.mts +1 -1
- package/dist/{CardV2-C9z0Hr-c.mjs → CardV2-C0fcOUdp.mjs} +5 -5
- package/dist/{CardV2-C9z0Hr-c.mjs.map → CardV2-C0fcOUdp.mjs.map} +1 -1
- package/dist/{Checkbox-B0bjZbji.mjs → Checkbox-BcuiFvK7.mjs} +2 -2
- package/dist/{Checkbox-B0bjZbji.mjs.map → Checkbox-BcuiFvK7.mjs.map} +1 -1
- package/dist/{Combobox-BdqU5WLG.mjs → Combobox-B6JyLog8.mjs} +13 -7
- package/dist/Combobox-B6JyLog8.mjs.map +1 -0
- package/dist/{Combobox-DBWMHwUt.d.cts → Combobox-BaD0f2Du.d.mts} +3 -3
- package/dist/Combobox.d.mts +2 -2
- package/dist/{ComboboxBase-BsY7CYoB.d.mts → ComboboxBase-BsPf8BZh.d.mts} +8 -3
- package/dist/ComboboxBase.d.mts +1 -1
- package/dist/{ComboboxMultiSelect-dNuETspL.d.mts → ComboboxMultiSelect-DhLzCWbz.d.mts} +2 -2
- package/dist/ComboboxMultiSelect.d.mts +1 -1
- package/dist/{ComboboxSingleSelect-C8KvIJ43.d.mts → ComboboxSingleSelect-P0r5rs_u.d.mts} +3 -3
- package/dist/ComboboxSingleSelect.d.mts +1 -1
- package/dist/DataTable.d.mts +9 -0
- package/dist/{DatePicker-DY1YA_Fu.mjs → DatePicker-Bw79p-Lx.mjs} +5 -5
- package/dist/{DatePicker-DY1YA_Fu.mjs.map → DatePicker-Bw79p-Lx.mjs.map} +1 -1
- package/dist/{DropdownButton-DKLjJylQ.mjs → DropdownButton-BI3IFJun.mjs} +3 -3
- package/dist/{DropdownButton-DKLjJylQ.mjs.map → DropdownButton-BI3IFJun.mjs.map} +1 -1
- package/dist/DropdownButton.d.mts +2 -2
- package/dist/{DropdownMenu-DGYexb7s.mjs → DropdownMenu-D25WBCah.mjs} +2 -2
- package/dist/{DropdownMenu-DGYexb7s.mjs.map → DropdownMenu-D25WBCah.mjs.map} +1 -1
- package/dist/{DropdownMenu-CVPanvKA.d.mts → DropdownMenu-D6nfAsi0.d.mts} +2 -2
- package/dist/DropdownMenu.d.mts +1 -1
- package/dist/{FormControl-B28qa7aQ.mjs → FormControl-CFU9uKF7.mjs} +2 -2
- package/dist/{FormControl-B28qa7aQ.mjs.map → FormControl-CFU9uKF7.mjs.map} +1 -1
- package/dist/{FormField-PeYYRO4s.mjs → FormField-DdmgSWq4.mjs} +14 -11
- package/dist/{FormField-PeYYRO4s.mjs.map → FormField-DdmgSWq4.mjs.map} +1 -1
- package/dist/{HoverCopyableField-ClXBg_ld.mjs → HoverCopyableField-7TWP0Y1Z.mjs} +3 -3
- package/dist/{HoverCopyableField-ClXBg_ld.mjs.map → HoverCopyableField-7TWP0Y1Z.mjs.map} +1 -1
- package/dist/{IconButton-ZcyTFjPn.d.cts → IconButton-BHCmHIx5.d.mts} +2 -2
- package/dist/{IconButton-CIWiEsS-.mjs → IconButton-P8w0JDI5.mjs} +2 -2
- package/dist/{IconButton-CIWiEsS-.mjs.map → IconButton-P8w0JDI5.mjs.map} +1 -1
- package/dist/IconButton.d.mts +1 -1
- package/dist/InlineCombobox.d.mts +1 -1
- package/dist/InlineInput.d.mts +1 -1
- package/dist/{Input-BPClVzwD.d.mts → Input-DMgVyZyq.d.mts} +3 -3
- package/dist/{Input-BFI_e7aU.mjs → Input-QC6xla6I.mjs} +2 -2
- package/dist/Input-QC6xla6I.mjs.map +1 -0
- package/dist/Input.d.mts +1 -1
- package/dist/{ListBox-_fcSPynx.d.mts → ListBox-D09N1a5D.d.mts} +8 -3
- package/dist/{ListBox-BwID8jpk.mjs → ListBox-TrL3Tb7X.mjs} +13 -7
- package/dist/ListBox-TrL3Tb7X.mjs.map +1 -0
- package/dist/ListBox.d.mts +1 -1
- package/dist/ListBoxField.d.mts +2 -2
- package/dist/{LogicRow-BtCKGX_j.d.mts → LogicRow-BcuiSTHN.d.mts} +2 -2
- package/dist/LogicRow.d.mts +1 -1
- package/dist/MaskedInput.d.mts +1 -1
- package/dist/{Menu-CUp_9HgC.d.mts → Menu-Bv8dsrz6.d.mts} +2 -2
- package/dist/{Menu-CPYXo61N.mjs → Menu-DmeMgN-i.mjs} +2 -2
- package/dist/{Menu-CPYXo61N.mjs.map → Menu-DmeMgN-i.mjs.map} +1 -1
- package/dist/Menu.d.mts +1 -1
- package/dist/Modal.d.mts +1 -1
- package/dist/{PageHeader-D-6W61E_.mjs → PageHeader-jSLud2JI.mjs} +5 -4
- package/dist/PageHeader-jSLud2JI.mjs.map +1 -0
- package/dist/PageHeader.d.mts +7 -2
- package/dist/{Pagination-ztqhywAP.mjs → Pagination-BeYukNCj.mjs} +4 -4
- package/dist/{Pagination-ztqhywAP.mjs.map → Pagination-BeYukNCj.mjs.map} +1 -1
- package/dist/{Pii-DrrtEz7U.mjs → Pii-QsTrz8wn.mjs} +2 -2
- package/dist/{Pii-DrrtEz7U.mjs.map → Pii-QsTrz8wn.mjs.map} +1 -1
- package/dist/{Select-2KbtKawr.d.mts → Select-Bk27TgN8.d.mts} +2 -2
- package/dist/{Select-cPEORy70.mjs → Select-C1ZoRk39.mjs} +4 -4
- package/dist/{Select-cPEORy70.mjs.map → Select-C1ZoRk39.mjs.map} +1 -1
- package/dist/Select.d.mts +1 -1
- package/dist/{Sticker-DbqKLe33.mjs → Sticker-CyGb9dEu.mjs} +2 -2
- package/dist/{Sticker-DbqKLe33.mjs.map → Sticker-CyGb9dEu.mjs.map} +1 -1
- package/dist/Tab.d.mts +13 -4
- package/dist/{TabBar-zSA8kyE6.mjs → TabBar-Bn8PHHBZ.mjs} +15 -9
- package/dist/TabBar-Bn8PHHBZ.mjs.map +1 -0
- package/dist/TabBarIconButton.d.mts +1 -1
- package/dist/{Table-D8IcpACv.mjs → Table-BfontAeY.mjs} +7 -5
- package/dist/{Table-D8IcpACv.mjs.map → Table-BfontAeY.mjs.map} +1 -1
- package/dist/{TableBox-luasMC73.mjs → TableBox-bmrKh_ax.mjs} +86 -35
- package/dist/TableBox-bmrKh_ax.mjs.map +1 -0
- package/dist/TableBox.d.mts +1 -1
- package/dist/{TableBoxCell-By1xE6_Q.d.mts → TableBoxCell-CvjLYhTV.d.mts} +21 -7
- package/dist/TableBoxCell.d.mts +1 -1
- package/dist/TableBoxField.d.mts +7 -4
- package/dist/{TableBoxRow-CsRPRPQ-.d.mts → TableBoxRow-BzXECgid.d.mts} +2 -2
- package/dist/TableBoxRow.d.mts +1 -1
- package/dist/{TableBoxRowActions-DMYOI8Do.d.mts → TableBoxRowActions-BAiFXiCh.d.mts} +2 -2
- package/dist/TableBoxRowActions.d.mts +1 -1
- package/dist/{TableControls-DHMs7o58.mjs → TableControls-DVTtNAPo.mjs} +11 -11
- package/dist/{TableControls-DHMs7o58.mjs.map → TableControls-DVTtNAPo.mjs.map} +1 -1
- package/dist/{TableLayout-Ct0kepcA.d.cts → TableLayout-BZeP8qfg.d.mts} +7 -1
- package/dist/TableLayout.d.mts +1 -1
- package/dist/{Tooltip-C6AR1xT-.mjs → Tooltip-BvDbmXak.mjs} +2 -2
- package/dist/{Tooltip-C6AR1xT-.mjs.map → Tooltip-BvDbmXak.mjs.map} +1 -1
- package/dist/components/Attribute/index.mjs +3 -3
- package/dist/components/Badge/index.mjs +1 -1
- package/dist/components/Banner/index.mjs +1 -1
- package/dist/components/Breadcrumbs/index.mjs +1 -1
- package/dist/components/Button/index.d.mts +2 -2
- package/dist/components/Button/index.mjs +1 -1
- package/dist/components/ButtonGroup/index.mjs +1 -1
- package/dist/components/CardV2/index.mjs +1 -1
- package/dist/components/Checkbox/index.mjs +1 -1
- package/dist/components/Combobox/index.d.mts +2 -2
- package/dist/components/Combobox/index.mjs +1 -1
- package/dist/components/DataTable/TableControls/index.mjs +1 -1
- package/dist/components/DataTable/index.mjs +14 -12
- package/dist/components/DataTable/index.mjs.map +1 -1
- package/dist/components/DataTable/types.d.mts +1 -1
- package/dist/components/DatePicker/index.mjs +1 -1
- package/dist/components/DropdownButton/index.mjs +1 -1
- package/dist/components/DropdownMenu/index.d.mts +1 -1
- package/dist/components/DropdownMenu/index.mjs +1 -1
- package/dist/components/FormControl/index.mjs +1 -1
- package/dist/components/FormField/index.d.mts +2 -2
- package/dist/components/FormField/index.mjs +2 -2
- package/dist/components/HoverCopyableField/index.mjs +1 -1
- package/dist/components/ImageTile/index.mjs +4 -4
- package/dist/components/Input/index.d.mts +1 -1
- package/dist/components/Input/index.mjs +1 -1
- package/dist/components/ListBox/index.d.mts +3 -3
- package/dist/components/ListBox/index.mjs +1 -1
- package/dist/components/MaskedInput/index.mjs +1 -1
- package/dist/components/Menu/index.d.mts +1 -1
- package/dist/components/Menu/index.mjs +1 -1
- package/dist/components/Modal/index.mjs +2 -2
- package/dist/components/PageHeader/index.mjs +1 -1
- package/dist/components/Pagination/index.mjs +1 -1
- package/dist/components/Pii/index.mjs +1 -1
- package/dist/components/ProgressBar/index.mjs +1 -1
- package/dist/components/Select/index.d.mts +1 -1
- package/dist/components/Select/index.mjs +1 -1
- package/dist/components/Slider/index.mjs +1 -1
- package/dist/components/Sticker/index.mjs +1 -1
- package/dist/components/TabBar/index.mjs +1 -1
- package/dist/components/Table/index.d.mts +1 -1
- package/dist/components/Table/index.mjs +1 -1
- package/dist/components/TableBox/index.d.mts +1 -1
- package/dist/components/TableBox/index.mjs +1 -1
- package/dist/components/TechnicalSticker/index.mjs +1 -1
- package/dist/components/Tile/index.mjs +2 -2
- package/dist/components/Toast/index.mjs +1 -1
- package/dist/components/Tooltip/index.mjs +1 -1
- package/dist/fieldPickerOptions.d.mts +1 -1
- package/dist/{index-IlwGkCAe2.d.mts → index-BxXTpeUb2.d.mts} +4 -3
- package/dist/inputFields.d.mts +4 -4
- package/dist/layouts/LayoutLoadingShimmer/index.mjs +3 -3
- package/dist/lib/TruncatedTextWithTooltip.mjs +1 -1
- package/dist/lib/useScrollOverflow.d.mts +7 -0
- package/dist/lib/useScrollOverflow.mjs +22 -1
- package/dist/lib/useScrollOverflow.mjs.map +1 -1
- package/dist/useComboboxFooterAction.d.mts +1 -1
- package/dist/useTruncation.d.mts +1 -1
- package/package.json +202 -746
- package/skills/ui-authoring/COMPONENTS.md +331 -0
- package/skills/ui-authoring/EXAMPLES.md +370 -0
- package/skills/ui-authoring/REFERENCE.md +293 -0
- package/skills/ui-authoring/SKILL.md +237 -0
- package/dist/Action-E90Wvqmc.d.cts +0 -35
- package/dist/Action.d.cts +0 -2
- package/dist/Attribute.d.cts +0 -107
- package/dist/AttributeGrid.d.cts +0 -40
- package/dist/Badge-ADPloFsd.cjs +0 -38
- package/dist/Badge-ADPloFsd.cjs.map +0 -1
- package/dist/Badge.d.cts +0 -25
- package/dist/Banner.d.cts +0 -48
- package/dist/Breadcrumb-VH-Mwo-M.d.cts +0 -44
- package/dist/Breadcrumb.d.cts +0 -2
- package/dist/Breadcrumbs-BBREROrw.d.cts +0 -26
- package/dist/Breadcrumbs-tR49JqAS.cjs +0 -295
- package/dist/Breadcrumbs-tR49JqAS.cjs.map +0 -1
- package/dist/Breadcrumbs.d.cts +0 -2
- package/dist/Button-C_3p5Xfi.d.cts +0 -101
- package/dist/Button.d.cts +0 -2
- package/dist/ButtonGroup.d.cts +0 -20
- package/dist/Calendar.d.cts +0 -11
- package/dist/Card-CJPEmUvg.d.cts +0 -52
- package/dist/Card-Csz-PxX0.cjs +0 -248
- package/dist/Card-Csz-PxX0.cjs.map +0 -1
- package/dist/Card.d.cts +0 -2
- package/dist/Card2.d.cts +0 -95
- package/dist/CardV2-DJXgFomd.cjs +0 -419
- package/dist/CardV2-DJXgFomd.cjs.map +0 -1
- package/dist/Checkbox-CmCujC1W.cjs +0 -183
- package/dist/Checkbox-CmCujC1W.cjs.map +0 -1
- package/dist/Checkbox-Cr8ifm10.d.cts +0 -46
- package/dist/Checkbox.d.cts +0 -2
- package/dist/CheckboxGroupField.d.cts +0 -24
- package/dist/Combobox-BdqU5WLG.mjs.map +0 -1
- package/dist/Combobox-C99xluaM.d.mts +0 -11
- package/dist/Combobox-COXvmxlM.cjs +0 -1877
- package/dist/Combobox-COXvmxlM.cjs.map +0 -1
- package/dist/Combobox.d.cts +0 -3
- package/dist/ComboboxBase-zZ3tE-dH.d.cts +0 -361
- package/dist/ComboboxBase.d.cts +0 -2
- package/dist/ComboboxMultiSelect-ioB4Jx7_.d.cts +0 -47
- package/dist/ComboboxMultiSelect.d.cts +0 -2
- package/dist/ComboboxSingleSelect-Fn80tdhz.d.cts +0 -35
- package/dist/ComboboxSingleSelect.d.cts +0 -2
- package/dist/CompactBar-BEAK55kh.d.cts +0 -21
- package/dist/CompactBar.d.cts +0 -2
- package/dist/ConfigFormGroup-m5YdVa9n.cjs +0 -35
- package/dist/ConfigFormGroup-m5YdVa9n.cjs.map +0 -1
- package/dist/ConfigFormGroup.d.cts +0 -7
- package/dist/ControlBar-D8CirAyZ.d.cts +0 -151
- package/dist/ControlBar.d.cts +0 -2
- package/dist/DataTable.d.cts +0 -372
- package/dist/DateField.d.cts +0 -23
- package/dist/DatePicker-BlCgFb7g.cjs +0 -948
- package/dist/DatePicker-BlCgFb7g.cjs.map +0 -1
- package/dist/DatePicker.d.cts +0 -19
- package/dist/DateRangePicker.d.cts +0 -52
- package/dist/DropdownButton-Dl7IEzAc.cjs +0 -32
- package/dist/DropdownButton-Dl7IEzAc.cjs.map +0 -1
- package/dist/DropdownButton.d.cts +0 -26
- package/dist/DropdownMenu-DnlQqTjs.cjs +0 -74
- package/dist/DropdownMenu-DnlQqTjs.cjs.map +0 -1
- package/dist/DropdownMenu-FkiManPP.d.cts +0 -75
- package/dist/DropdownMenu.d.cts +0 -2
- package/dist/ErrorProps-Dxqb4gw_.d.cts +0 -8
- package/dist/ErrorProps.d.cts +0 -2
- package/dist/FieldRegistry-OX60T3hr.d.cts +0 -122
- package/dist/FieldRegistry.d.cts +0 -2
- package/dist/FilterBar-YzOh02f9.d.cts +0 -103
- package/dist/FilterBar.d.cts +0 -2
- package/dist/FloatingActionBar.d.cts +0 -40
- package/dist/FormControl-DFp_qcW1.d.cts +0 -60
- package/dist/FormControl-MkBXuUF6.cjs +0 -212
- package/dist/FormControl-MkBXuUF6.cjs.map +0 -1
- package/dist/FormControl.d.cts +0 -2
- package/dist/FormField-D3XhxTMg.cjs +0 -550
- package/dist/FormField-D3XhxTMg.cjs.map +0 -1
- package/dist/FormField-idNLw5PW.d.cts +0 -69
- package/dist/FormField.d.cts +0 -2
- package/dist/Header-C-WhPOin.d.cts +0 -35
- package/dist/Header.d.cts +0 -2
- package/dist/HelperTooltip-T-sTGGLD.d.cts +0 -20
- package/dist/HelperTooltip.d.cts +0 -2
- package/dist/HoverCopyableField-CRkM7o4B.cjs +0 -110
- package/dist/HoverCopyableField-CRkM7o4B.cjs.map +0 -1
- package/dist/HoverCopyableField.d.cts +0 -16
- package/dist/IconButton-BSES_-6g.d.mts +0 -24
- package/dist/IconButton-nlgjJQCS.cjs +0 -372
- package/dist/IconButton-nlgjJQCS.cjs.map +0 -1
- package/dist/IconButton.d.cts +0 -2
- package/dist/ImageTile.d.cts +0 -60
- package/dist/Input-BFI_e7aU.mjs.map +0 -1
- package/dist/Input-BM0DzWEf.d.cts +0 -65
- package/dist/Input-OJPQ07TW.cjs +0 -209
- package/dist/Input-OJPQ07TW.cjs.map +0 -1
- package/dist/Input.d.cts +0 -2
- package/dist/InputProps-CoVNpQSj.d.cts +0 -16
- package/dist/InputProps.d.cts +0 -2
- package/dist/Inserter.d.cts +0 -12
- package/dist/LayoutLoadingShimmer.d.cts +0 -20
- package/dist/Link.d.cts +0 -43
- package/dist/ListBox-BP1eaG7L.cjs +0 -448
- package/dist/ListBox-BP1eaG7L.cjs.map +0 -1
- package/dist/ListBox-BwID8jpk.mjs.map +0 -1
- package/dist/ListBox-QaeRQBSC.d.cts +0 -138
- package/dist/ListBox.d.cts +0 -2
- package/dist/ListBoxField.d.cts +0 -46
- package/dist/LoadingShimmer-Dx6ncVUV.cjs +0 -92
- package/dist/LoadingShimmer-Dx6ncVUV.cjs.map +0 -1
- package/dist/LoadingShimmer.d.cts +0 -38
- package/dist/LogicRow-C6lrFIq0.d.cts +0 -40
- package/dist/LogicRow.d.cts +0 -2
- package/dist/MaskedInput.d.cts +0 -10
- package/dist/MatchHighlight.d.cts +0 -11
- package/dist/Menu-fUnbIYr5.d.cts +0 -70
- package/dist/Menu-t2q8NrV0.cjs +0 -217
- package/dist/Menu-t2q8NrV0.cjs.map +0 -1
- package/dist/Menu.d.cts +0 -2
- package/dist/MiddleTruncatedText-CO76xIqP.cjs +0 -178
- package/dist/MiddleTruncatedText-CO76xIqP.cjs.map +0 -1
- package/dist/Modal.d.cts +0 -146
- package/dist/PageHeader-CUDnarkt.cjs +0 -77
- package/dist/PageHeader-CUDnarkt.cjs.map +0 -1
- package/dist/PageHeader-D-6W61E_.mjs.map +0 -1
- package/dist/PageHeader.d.cts +0 -35
- package/dist/PageSelector-CNnVp3Al.d.cts +0 -30
- package/dist/PageSelector.d.cts +0 -2
- package/dist/Pagination-2Yo1vRJZ.cjs +0 -236
- package/dist/Pagination-2Yo1vRJZ.cjs.map +0 -1
- package/dist/Pagination-D04tn-tf.d.cts +0 -39
- package/dist/Pagination.d.cts +0 -2
- package/dist/Pii-DHTb3ewO.cjs +0 -25
- package/dist/Pii-DHTb3ewO.cjs.map +0 -1
- package/dist/Pii.d.cts +0 -16
- package/dist/Popover-BzgMAhsX.cjs +0 -168
- package/dist/Popover-BzgMAhsX.cjs.map +0 -1
- package/dist/Popover.d.cts +0 -90
- package/dist/ProgressBar.d.cts +0 -83
- package/dist/ProgressIndicator.d.cts +0 -64
- package/dist/PseudoClassProps-C5jpj6Rp.d.cts +0 -12
- package/dist/PseudoClassProps.d.cts +0 -2
- package/dist/Radio-BrTzy7-C.cjs +0 -154
- package/dist/Radio-BrTzy7-C.cjs.map +0 -1
- package/dist/Radio.d.cts +0 -21
- package/dist/RadioGroup-CriF2InQ.cjs +0 -57
- package/dist/RadioGroup-CriF2InQ.cjs.map +0 -1
- package/dist/RadioGroup-XYWjprsv.d.cts +0 -21
- package/dist/RadioGroup.d.cts +0 -2
- package/dist/SearchInput-CTI59-NW.d.cts +0 -46
- package/dist/SearchInput.d.cts +0 -2
- package/dist/SectionHeading-C6hjGdK-.d.cts +0 -71
- package/dist/SectionHeading.d.cts +0 -2
- package/dist/SegmentedControl-C2XZF0ys.cjs +0 -125
- package/dist/SegmentedControl-C2XZF0ys.cjs.map +0 -1
- package/dist/SegmentedControl-nHIK1ZvR.d.cts +0 -59
- package/dist/SegmentedControl.d.cts +0 -2
- package/dist/Select-BH3hXMxp.d.cts +0 -83
- package/dist/Select-BurtT6bN.cjs +0 -265
- package/dist/Select-BurtT6bN.cjs.map +0 -1
- package/dist/Select.d.cts +0 -2
- package/dist/Slider.d.cts +0 -51
- package/dist/SliderRHF.d.cts +0 -18
- package/dist/Spacer-B2CerL6e.cjs +0 -20
- package/dist/Spacer-B2CerL6e.cjs.map +0 -1
- package/dist/Spacer.d.cts +0 -17
- package/dist/Spinner-B6bx70yR.cjs +0 -48
- package/dist/Spinner-B6bx70yR.cjs.map +0 -1
- package/dist/Spinner.d.cts +0 -26
- package/dist/Stack-BzVkf3cz.d.cts +0 -47
- package/dist/Stack-UeifHn3c.cjs +0 -53
- package/dist/Stack-UeifHn3c.cjs.map +0 -1
- package/dist/Stack.d.cts +0 -2
- package/dist/StatusIndicator.d.cts +0 -82
- package/dist/Sticker-CI-XxUmM.d.cts +0 -68
- package/dist/Sticker-CIoseh9f.cjs +0 -244
- package/dist/Sticker-CIoseh9f.cjs.map +0 -1
- package/dist/Sticker.d.cts +0 -2
- package/dist/SwatchPicker.d.cts +0 -18
- package/dist/Tab.d.cts +0 -26
- package/dist/TabBar-PFaDNRw0.cjs +0 -298
- package/dist/TabBar-PFaDNRw0.cjs.map +0 -1
- package/dist/TabBar-zSA8kyE6.mjs.map +0 -1
- package/dist/TabBar.d.cts +0 -33
- package/dist/TabBarIconButton.d.cts +0 -10
- package/dist/Table-DXqyNohc.d.cts +0 -13
- package/dist/Table-DxLvJYWK.cjs +0 -478
- package/dist/Table-DxLvJYWK.cjs.map +0 -1
- package/dist/Table.d.cts +0 -2
- package/dist/TableBody-CxwHmdNb.d.cts +0 -9
- package/dist/TableBody.d.cts +0 -2
- package/dist/TableBox-CiuXCXyv.cjs +0 -1370
- package/dist/TableBox-CiuXCXyv.cjs.map +0 -1
- package/dist/TableBox-luasMC73.mjs.map +0 -1
- package/dist/TableBox.d.cts +0 -3
- package/dist/TableBoxCell-DIMenSwX.d.cts +0 -259
- package/dist/TableBoxCell.d.cts +0 -2
- package/dist/TableBoxField.d.cts +0 -99
- package/dist/TableBoxRow-RNQ6wJLh.d.cts +0 -86
- package/dist/TableBoxRow.d.cts +0 -2
- package/dist/TableBoxRowActions-CYpoPhYZ.d.cts +0 -57
- package/dist/TableBoxRowActions.d.cts +0 -2
- package/dist/TableCell.d.cts +0 -2
- package/dist/TableControls-BtXK7Ils.cjs +0 -3995
- package/dist/TableControls-BtXK7Ils.cjs.map +0 -1
- package/dist/TableControls-CLNF0AJG.d.cts +0 -70
- package/dist/TableControls.d.cts +0 -2
- package/dist/TableControlsContext-DAZx6Rrj.d.cts +0 -21
- package/dist/TableControlsContext.d.cts +0 -2
- package/dist/TableHead-Ch4Ho3LW.d.cts +0 -12
- package/dist/TableHead.d.cts +0 -2
- package/dist/TableHeaderCell-Crsa2R2g.d.cts +0 -17
- package/dist/TableHeaderCell.d.cts +0 -2
- package/dist/TableLayout-nwy094C_.d.mts +0 -19
- package/dist/TableLayout.d.cts +0 -2
- package/dist/TableRow-DVTPqT4w.d.cts +0 -13
- package/dist/TableRow.d.cts +0 -2
- package/dist/TableTH.d.cts +0 -2
- package/dist/TableViewConfigurationDropdown-CaiOGyrU.d.cts +0 -32
- package/dist/TableViewConfigurationDropdown.d.cts +0 -2
- package/dist/TechnicalSticker.d.cts +0 -51
- package/dist/Text-CrGiWG2E.d.cts +0 -42
- package/dist/Text-G9QmYf0P.cjs +0 -95
- package/dist/Text-G9QmYf0P.cjs.map +0 -1
- package/dist/Text.d.cts +0 -2
- package/dist/TextArea-BNiipQDb.cjs +0 -40
- package/dist/TextArea-BNiipQDb.cjs.map +0 -1
- package/dist/TextArea-CHW9FKM4.d.cts +0 -10
- package/dist/TextArea.d.cts +0 -2
- package/dist/TextUnderlineTooltip-DMEyOu8C.d.cts +0 -18
- package/dist/TextUnderlineTooltip.d.cts +0 -2
- package/dist/Tile.d.cts +0 -63
- package/dist/Toast.d.cts +0 -23
- package/dist/Toggle-Ce-rF8Xp.cjs +0 -174
- package/dist/Toggle-Ce-rF8Xp.cjs.map +0 -1
- package/dist/Toggle-tbIebQWC.d.cts +0 -54
- package/dist/Toggle.d.cts +0 -2
- package/dist/Tooltip--eDrrk2r.d.cts +0 -100
- package/dist/Tooltip-olP3rdUO.cjs +0 -152
- package/dist/Tooltip-olP3rdUO.cjs.map +0 -1
- package/dist/Tooltip.d.cts +0 -2
- package/dist/TruncatedText-Dit2NJI6.d.cts +0 -18
- package/dist/chunk-CKQMccvm.cjs +0 -28
- package/dist/components/Attribute/index.cjs +0 -210
- package/dist/components/Attribute/index.cjs.map +0 -1
- package/dist/components/Attribute/index.d.cts +0 -3
- package/dist/components/Badge/index.cjs +0 -7
- package/dist/components/Badge/index.d.cts +0 -2
- package/dist/components/Banner/index.cjs +0 -99
- package/dist/components/Banner/index.cjs.map +0 -1
- package/dist/components/Banner/index.d.cts +0 -2
- package/dist/components/Breadcrumbs/index.cjs +0 -7
- package/dist/components/Breadcrumbs/index.d.cts +0 -2
- package/dist/components/Button/index.cjs +0 -11
- package/dist/components/Button/index.d.cts +0 -3
- package/dist/components/ButtonGroup/index.cjs +0 -112
- package/dist/components/ButtonGroup/index.cjs.map +0 -1
- package/dist/components/ButtonGroup/index.d.cts +0 -2
- package/dist/components/Card/index.cjs +0 -12
- package/dist/components/Card/index.d.cts +0 -3
- package/dist/components/CardV2/index.cjs +0 -7
- package/dist/components/CardV2/index.d.cts +0 -3
- package/dist/components/Checkbox/index.cjs +0 -7
- package/dist/components/Checkbox/index.d.cts +0 -2
- package/dist/components/Combobox/index.cjs +0 -9
- package/dist/components/Combobox/index.d.cts +0 -3
- package/dist/components/ConfigFormGroup/index.cjs +0 -10
- package/dist/components/ConfigFormGroup/index.d.cts +0 -3
- package/dist/components/DataTable/TableControls/index.cjs +0 -27
- package/dist/components/DataTable/TableControls/index.d.cts +0 -16
- package/dist/components/DataTable/index.cjs +0 -1434
- package/dist/components/DataTable/index.cjs.map +0 -1
- package/dist/components/DataTable/index.d.cts +0 -8
- package/dist/components/DataTable/types.cjs +0 -0
- package/dist/components/DataTable/types.d.cts +0 -159
- package/dist/components/DatePicker/index.cjs +0 -10
- package/dist/components/DatePicker/index.d.cts +0 -5
- package/dist/components/DropdownButton/index.cjs +0 -7
- package/dist/components/DropdownButton/index.d.cts +0 -2
- package/dist/components/DropdownMenu/index.cjs +0 -7
- package/dist/components/DropdownMenu/index.d.cts +0 -2
- package/dist/components/FormControl/index.cjs +0 -15
- package/dist/components/FormControl/index.d.cts +0 -3
- package/dist/components/FormField/index.cjs +0 -19
- package/dist/components/FormField/index.d.cts +0 -6
- package/dist/components/HoverCopyableField/index.cjs +0 -2
- package/dist/components/HoverCopyableField/index.d.cts +0 -2
- package/dist/components/ImageTile/index.cjs +0 -225
- package/dist/components/ImageTile/index.cjs.map +0 -1
- package/dist/components/ImageTile/index.d.cts +0 -2
- package/dist/components/Input/index.cjs +0 -14
- package/dist/components/Input/index.cjs.map +0 -1
- package/dist/components/Input/index.d.cts +0 -2
- package/dist/components/Link/index.cjs +0 -87
- package/dist/components/Link/index.cjs.map +0 -1
- package/dist/components/Link/index.d.cts +0 -2
- package/dist/components/ListBox/index.cjs +0 -8
- package/dist/components/ListBox/index.d.cts +0 -4
- package/dist/components/LoadingShimmer/index.cjs +0 -6
- package/dist/components/LoadingShimmer/index.d.cts +0 -2
- package/dist/components/MaskedInput/index.cjs +0 -29
- package/dist/components/MaskedInput/index.cjs.map +0 -1
- package/dist/components/MaskedInput/index.d.cts +0 -2
- package/dist/components/MatchHighlight/index.cjs +0 -31
- package/dist/components/MatchHighlight/index.cjs.map +0 -1
- package/dist/components/MatchHighlight/index.d.cts +0 -2
- package/dist/components/Menu/index.cjs +0 -14
- package/dist/components/Menu/index.d.cts +0 -2
- package/dist/components/Modal/index.cjs +0 -290
- package/dist/components/Modal/index.cjs.map +0 -1
- package/dist/components/Modal/index.d.cts +0 -2
- package/dist/components/PageHeader/index.cjs +0 -7
- package/dist/components/PageHeader/index.d.cts +0 -2
- package/dist/components/Pagination/index.cjs +0 -10
- package/dist/components/Pagination/index.d.cts +0 -4
- package/dist/components/Pii/index.cjs +0 -2
- package/dist/components/Pii/index.d.cts +0 -2
- package/dist/components/Popover/index.cjs +0 -12
- package/dist/components/Popover/index.d.cts +0 -2
- package/dist/components/ProgressBar/index.cjs +0 -177
- package/dist/components/ProgressBar/index.cjs.map +0 -1
- package/dist/components/ProgressBar/index.d.cts +0 -2
- package/dist/components/ProgressIndicator/index.cjs +0 -185
- package/dist/components/ProgressIndicator/index.cjs.map +0 -1
- package/dist/components/ProgressIndicator/index.d.cts +0 -2
- package/dist/components/Radio/index.cjs +0 -7
- package/dist/components/Radio/index.d.cts +0 -2
- package/dist/components/RadioGroup/index.cjs +0 -7
- package/dist/components/RadioGroup/index.d.cts +0 -2
- package/dist/components/SegmentedControl/index.cjs +0 -8
- package/dist/components/SegmentedControl/index.d.cts +0 -2
- package/dist/components/Select/index.cjs +0 -9
- package/dist/components/Select/index.d.cts +0 -2
- package/dist/components/Slider/index.cjs +0 -245
- package/dist/components/Slider/index.cjs.map +0 -1
- package/dist/components/Slider/index.d.cts +0 -3
- package/dist/components/Spacer/index.cjs +0 -2
- package/dist/components/Spacer/index.d.cts +0 -2
- package/dist/components/Spinner/index.cjs +0 -7
- package/dist/components/Spinner/index.d.cts +0 -2
- package/dist/components/Stack/index.cjs +0 -8
- package/dist/components/Stack/index.d.cts +0 -2
- package/dist/components/StatusIndicator/index.cjs +0 -224
- package/dist/components/StatusIndicator/index.cjs.map +0 -1
- package/dist/components/StatusIndicator/index.d.cts +0 -2
- package/dist/components/Sticker/index.cjs +0 -11
- package/dist/components/Sticker/index.d.cts +0 -2
- package/dist/components/SwatchPicker/index.cjs +0 -63
- package/dist/components/SwatchPicker/index.cjs.map +0 -1
- package/dist/components/SwatchPicker/index.d.cts +0 -2
- package/dist/components/TabBar/index.cjs +0 -11
- package/dist/components/TabBar/index.d.cts +0 -4
- package/dist/components/Table/index.cjs +0 -21
- package/dist/components/Table/index.d.cts +0 -8
- package/dist/components/TableBox/index.cjs +0 -7
- package/dist/components/TableBox/index.d.cts +0 -3
- package/dist/components/TechnicalSticker/index.cjs +0 -239
- package/dist/components/TechnicalSticker/index.cjs.map +0 -1
- package/dist/components/TechnicalSticker/index.d.cts +0 -2
- package/dist/components/Text/index.cjs +0 -8
- package/dist/components/Text/index.d.cts +0 -2
- package/dist/components/TextArea/index.cjs +0 -7
- package/dist/components/TextArea/index.d.cts +0 -2
- package/dist/components/Tile/index.cjs +0 -102
- package/dist/components/Tile/index.cjs.map +0 -1
- package/dist/components/Tile/index.d.cts +0 -2
- package/dist/components/Toast/index.cjs +0 -134
- package/dist/components/Toast/index.cjs.map +0 -1
- package/dist/components/Toast/index.d.cts +0 -2
- package/dist/components/Toggle/index.cjs +0 -7
- package/dist/components/Toggle/index.d.cts +0 -2
- package/dist/components/Tooltip/index.cjs +0 -11
- package/dist/components/Tooltip/index.d.cts +0 -4
- package/dist/constants-B6c8S033.d.cts +0 -6
- package/dist/constants.d.cts +0 -2
- package/dist/constants2.d.cts +0 -10
- package/dist/filter-size-context-CIw0Zi6r.d.cts +0 -52
- package/dist/filter-size-context.d.cts +0 -2
- package/dist/helpers.d.cts +0 -76
- package/dist/index-BIAn8oQh.d.cts +0 -1
- package/dist/index-BL32-cvv.d.cts +0 -1
- package/dist/index-BPSCxsMC.d.cts +0 -1
- package/dist/index-BR1oNnaF.d.cts +0 -1
- package/dist/index-BXpMZvwA.d.cts +0 -1
- package/dist/index-BhY1qu3m.d.cts +0 -1
- package/dist/index-BlwcRiXv.d.cts +0 -1
- package/dist/index-Bw8QVu_o.d.cts +0 -75
- package/dist/index-C0NRIDsj2.d.cts +0 -1
- package/dist/index-C1ihAKnV.d.cts +0 -1
- package/dist/index-C9EIpBh8.d.cts +0 -7
- package/dist/index-CDAfh8Ew.d.cts +0 -1
- package/dist/index-CFG0_wK4.d.cts +0 -1
- package/dist/index-CQ25UCod.d.cts +0 -1
- package/dist/index-Cv0jeUQf2.d.cts +0 -1
- package/dist/index-CwSIy_W-.d.cts +0 -1
- package/dist/index-D-BciAtf.d.cts +0 -1
- package/dist/index-D34XP8vp.d.cts +0 -54
- package/dist/index-D6CnpA_r.d.cts +0 -1
- package/dist/index-D9IqtUDs.d.cts +0 -1
- package/dist/index-DFKoAoY2.d.cts +0 -1
- package/dist/index-DpEKQcoR.d.cts +0 -1
- package/dist/index-_wQ5ClJU.d.cts +0 -1
- package/dist/index-dC-i2r_u.d.cts +0 -1
- package/dist/index-sQecLSpR.d.cts +0 -1
- package/dist/index.cjs +0 -0
- package/dist/index.d.cts +0 -2
- package/dist/index2.d.cts +0 -2
- package/dist/index3.d.cts +0 -4
- package/dist/index4.d.cts +0 -11
- package/dist/index5.d.cts +0 -1
- package/dist/input-DPB0cX2m.d.cts +0 -17
- package/dist/inputFields.d.cts +0 -83
- package/dist/intersperse-_0nQM5Rb.cjs +0 -26
- package/dist/intersperse-_0nQM5Rb.cjs.map +0 -1
- package/dist/layouts/LayoutLoadingShimmer/index.cjs +0 -139
- package/dist/layouts/LayoutLoadingShimmer/index.cjs.map +0 -1
- package/dist/layouts/LayoutLoadingShimmer/index.d.cts +0 -2
- package/dist/lib/ConfigContext.cjs +0 -15
- package/dist/lib/ConfigContext.cjs.map +0 -1
- package/dist/lib/ConfigContext.d.cts +0 -16
- package/dist/lib/GlobalStyles.cjs +0 -57
- package/dist/lib/GlobalStyles.cjs.map +0 -1
- package/dist/lib/GlobalStyles.d.cts +0 -8
- package/dist/lib/HeadlessAriaButton.cjs +0 -33
- package/dist/lib/HeadlessAriaButton.cjs.map +0 -1
- package/dist/lib/HeadlessAriaButton.d.cts +0 -12
- package/dist/lib/MiddleTruncatedText.cjs +0 -7
- package/dist/lib/MiddleTruncatedText.d.cts +0 -14
- package/dist/lib/PDSProvider.cjs +0 -13
- package/dist/lib/PDSProvider.cjs.map +0 -1
- package/dist/lib/PDSProvider.d.cts +0 -10
- package/dist/lib/TruncatedText.cjs +0 -39
- package/dist/lib/TruncatedText.cjs.map +0 -1
- package/dist/lib/TruncatedText.d.cts +0 -2
- package/dist/lib/TruncatedTextWithTooltip.cjs +0 -34
- package/dist/lib/TruncatedTextWithTooltip.cjs.map +0 -1
- package/dist/lib/TruncatedTextWithTooltip.d.cts +0 -15
- package/dist/lib/comboboxHelper.cjs +0 -46
- package/dist/lib/comboboxHelper.cjs.map +0 -1
- package/dist/lib/comboboxHelper.d.cts +0 -24
- package/dist/lib/copyTextToClipboard.cjs +0 -33
- package/dist/lib/copyTextToClipboard.cjs.map +0 -1
- package/dist/lib/copyTextToClipboard.d.cts +0 -4
- package/dist/lib/datePickerHelper.cjs +0 -36
- package/dist/lib/datePickerHelper.cjs.map +0 -1
- package/dist/lib/datePickerHelper.d.cts +0 -19
- package/dist/lib/message.cjs +0 -12
- package/dist/lib/message.cjs.map +0 -1
- package/dist/lib/message.d.cts +0 -2
- package/dist/lib/pseudoClass.cjs +0 -31
- package/dist/lib/pseudoClass.cjs.map +0 -1
- package/dist/lib/pseudoClass.d.cts +0 -45
- package/dist/lib/reorderItems.cjs +0 -38
- package/dist/lib/reorderItems.cjs.map +0 -1
- package/dist/lib/reorderItems.d.cts +0 -26
- package/dist/lib/selectHelper.cjs +0 -22
- package/dist/lib/selectHelper.cjs.map +0 -1
- package/dist/lib/selectHelper.d.cts +0 -14
- package/dist/lib/useControlled.cjs +0 -20
- package/dist/lib/useControlled.cjs.map +0 -1
- package/dist/lib/useControlled.d.cts +0 -16
- package/dist/lib/useIsOverflow.cjs +0 -58
- package/dist/lib/useIsOverflow.cjs.map +0 -1
- package/dist/lib/useIsOverflow.d.cts +0 -11
- package/dist/lib/useOutsideClick.cjs +0 -19
- package/dist/lib/useOutsideClick.cjs.map +0 -1
- package/dist/lib/useOutsideClick.d.cts +0 -13
- package/dist/lib/useScrollOverflow.cjs +0 -61
- package/dist/lib/useScrollOverflow.cjs.map +0 -1
- package/dist/lib/useScrollOverflow.d.cts +0 -36
- package/dist/lib/zindex.cjs +0 -26
- package/dist/lib/zindex.cjs.map +0 -1
- package/dist/lib/zindex.d.cts +0 -25
- package/dist/message-BEgtEjQC.d.cts +0 -9
- package/dist/mixins/focus.cjs +0 -39
- package/dist/mixins/focus.cjs.map +0 -1
- package/dist/mixins/focus.d.cts +0 -11
- package/dist/mixins/hoverable.cjs +0 -38
- package/dist/mixins/hoverable.cjs.map +0 -1
- package/dist/mixins/hoverable.d.cts +0 -16
- package/dist/mixins/input.cjs +0 -95
- package/dist/mixins/input.cjs.map +0 -1
- package/dist/mixins/input.d.cts +0 -2
- package/dist/mixins/menuItem.cjs +0 -110
- package/dist/mixins/menuItem.cjs.map +0 -1
- package/dist/mixins/menuItem.d.cts +0 -30
- package/dist/mixins/print/index.cjs +0 -25
- package/dist/mixins/print/index.cjs.map +0 -1
- package/dist/mixins/print/index.d.cts +0 -11
- package/dist/mixins/text.cjs +0 -93
- package/dist/mixins/text.cjs.map +0 -1
- package/dist/mixins/text.d.cts +0 -2
- package/dist/operators-1qE2GpC7.d.cts +0 -43
- package/dist/operators.d.cts +0 -2
- package/dist/text-PmH5oc61.d.cts +0 -14
- package/dist/theme-Cadb1xzQ.d.cts +0 -154
- package/dist/theme.cjs +0 -353
- package/dist/theme.cjs.map +0 -1
- package/dist/theme.d.cts +0 -2
- package/dist/types-B_HHNlia.d.cts +0 -158
- package/dist/types-CCvc590y.d.cts +0 -45
- package/dist/types-CkiXVJeR.d.cts +0 -10
- package/dist/types-SYSKcZKW.d.cts +0 -25
- package/dist/types.d.cts +0 -2
- package/dist/types2.d.cts +0 -2
- package/dist/types3.d.cts +0 -2
- package/dist/types4.d.cts +0 -2
- package/dist/useFilterStateV2-DbPwX5N1.d.cts +0 -93
- package/dist/useFilterStateV2.d.cts +0 -2
- package/dist/useFormField--Q8ZdpW5.d.cts +0 -30
- package/dist/useFormField-BZlArnsI.cjs +0 -37
- package/dist/useFormField-BZlArnsI.cjs.map +0 -1
- package/dist/useFormField.d.cts +0 -2
- package/dist/useFormGroup-Bmnzgq0S.cjs +0 -26
- package/dist/useFormGroup-Bmnzgq0S.cjs.map +0 -1
- package/dist/useFormGroup.d.cts +0 -18
- package/dist/useTableBoxDragAndDrop-DnbUToce.d.cts +0 -69
- package/dist/useTableBoxDragAndDrop.d.cts +0 -2
- package/dist/useTableColumns.d.cts +0 -72
- package/dist/useToggle-DARO917w.cjs +0 -27
- package/dist/useToggle-DARO917w.cjs.map +0 -1
- package/dist/utilities-mSlaTrjB.d.cts +0 -9
- package/dist/utilities.d.cts +0 -2
- package/dist/utils/storybook.cjs +0 -12
- package/dist/utils/storybook.cjs.map +0 -1
- package/dist/utils/testing.cjs +0 -50
- package/dist/utils/testing.cjs.map +0 -1
- package/dist/utils/testing.d.cts +0 -18
- package/dist/validation-CJymv6JE.d.cts +0 -51
- package/dist/validation.d.cts +0 -2
- package/dist/value-control-resolver-B9p25q3G.d.cts +0 -46
- package/dist/value-control-resolver.d.cts +0 -2
- package/dist/variables/color.cjs +0 -22
- package/dist/variables/color.cjs.map +0 -1
- package/dist/variables/color.d.cts +0 -19
- package/dist/variables/effect.cjs +0 -27
- package/dist/variables/effect.cjs.map +0 -1
- package/dist/variables/effect.d.cts +0 -21
- package/dist/variables/keyframes.cjs +0 -22
- package/dist/variables/keyframes.cjs.map +0 -1
- package/dist/variables/keyframes.d.cts +0 -8
- package/dist/variables/spacing.cjs +0 -10
- package/dist/variables/spacing.cjs.map +0 -1
- package/dist/variables/spacing.d.cts +0 -8
- package/dist/variables/text.cjs +0 -13
- package/dist/variables/text.cjs.map +0 -1
- package/dist/variables/text.d.cts +0 -10
- package/dist/variables/transitions.cjs +0 -24
- package/dist/variables/transitions.cjs.map +0 -1
- package/dist/variables/transitions.d.cts +0 -19
|
@@ -1,1877 +0,0 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-CKQMccvm.cjs");
|
|
2
|
-
const require_mixins_focus = require("./mixins/focus.cjs");
|
|
3
|
-
const require_Stack = require("./Stack-UeifHn3c.cjs");
|
|
4
|
-
const require_Text = require("./Text-G9QmYf0P.cjs");
|
|
5
|
-
const require_lib_useOutsideClick = require("./lib/useOutsideClick.cjs");
|
|
6
|
-
const require_lib_zindex = require("./lib/zindex.cjs");
|
|
7
|
-
const require_IconButton = require("./IconButton-nlgjJQCS.cjs");
|
|
8
|
-
const require_Menu = require("./Menu-t2q8NrV0.cjs");
|
|
9
|
-
const require_useFormField = require("./useFormField-BZlArnsI.cjs");
|
|
10
|
-
const require_Input = require("./Input-OJPQ07TW.cjs");
|
|
11
|
-
const require_components_Input_index = require("./components/Input/index.cjs");
|
|
12
|
-
const require_Spinner = require("./Spinner-B6bx70yR.cjs");
|
|
13
|
-
const require_Sticker = require("./Sticker-CIoseh9f.cjs");
|
|
14
|
-
const require_Checkbox = require("./Checkbox-CmCujC1W.cjs");
|
|
15
|
-
let _persona_design_tokens = require("@persona/design-tokens");
|
|
16
|
-
let styled_components = require("styled-components");
|
|
17
|
-
styled_components = require_chunk.__toESM(styled_components);
|
|
18
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
19
|
-
let react = require("react");
|
|
20
|
-
let _persona_icons = require("@persona/icons");
|
|
21
|
-
let fuse_js = require("fuse.js");
|
|
22
|
-
fuse_js = require_chunk.__toESM(fuse_js);
|
|
23
|
-
let react_dom = require("react-dom");
|
|
24
|
-
let _tanstack_react_virtual = require("@tanstack/react-virtual");
|
|
25
|
-
let downshift = require("downshift");
|
|
26
|
-
//#region components/Combobox/ComboboxBase.tsx
|
|
27
|
-
function isOptionGroup(item) {
|
|
28
|
-
return "options" in item && Array.isArray(item.options);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Flatten the visible leaves at the current navigation level. Inline
|
|
32
|
-
* (non-nested) groups are walked through transparently — their leaves
|
|
33
|
-
* surface at this level. Nested groups are skipped along with their
|
|
34
|
-
* contents — those leaves live behind a navigation step in single-
|
|
35
|
-
* select. Multi-select doesn't reach this code with nested groups
|
|
36
|
-
* intact (it inlines them at the component boundary), so the skip
|
|
37
|
-
* here is the single-select-only contract.
|
|
38
|
-
*/
|
|
39
|
-
function flattenOptions(items) {
|
|
40
|
-
const out = [];
|
|
41
|
-
for (const item of items) if (isOptionGroup(item)) {
|
|
42
|
-
if (!item.nested) out.push(...flattenOptions(item.options));
|
|
43
|
-
} else out.push(item);
|
|
44
|
-
return out;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Recurse through the entire option tree looking for any nested
|
|
48
|
-
* group. Used to gate nested-mode behavior so trees that don't opt
|
|
49
|
-
* in (the overwhelmingly common case) skip the extra book-keeping
|
|
50
|
-
* entirely. Single-select uses this to switch between its nested-nav
|
|
51
|
-
* render path and the legacy renderer; multi-select uses it to
|
|
52
|
-
* short-circuit its `nested → inline` transform when there's nothing
|
|
53
|
-
* to convert.
|
|
54
|
-
*/
|
|
55
|
-
function containsNestedGroup(items) {
|
|
56
|
-
for (const item of items) if (isOptionGroup(item)) {
|
|
57
|
-
if (item.nested) return true;
|
|
58
|
-
if (containsNestedGroup(item.options)) return true;
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Find a nested-group child of `items` whose `label` matches `label`.
|
|
64
|
-
* Walks transparently through inline (non-nested) groups at the same
|
|
65
|
-
* level — they don't add a navigation step, so a nested submenu
|
|
66
|
-
* declared inside an inline section header is still "at this level"
|
|
67
|
-
* for descent purposes. Returns `null` if no match.
|
|
68
|
-
*/
|
|
69
|
-
function findNestedGroupByLabel(items, label) {
|
|
70
|
-
for (const item of items) {
|
|
71
|
-
if (!isOptionGroup(item)) continue;
|
|
72
|
-
if (item.nested) {
|
|
73
|
-
if (item.label === label) return item;
|
|
74
|
-
} else {
|
|
75
|
-
const found = findNestedGroupByLabel(item.options, label);
|
|
76
|
-
if (found) return found;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Walk the option tree by following `path` step-by-step. Each entry
|
|
83
|
-
* in `path` is the `label` of a nested group at that level; we
|
|
84
|
-
* descend into its `options` at each step. Returns the items visible
|
|
85
|
-
* at the resolved level (a mix of leaves, inline groups, and further
|
|
86
|
-
* nested groups).
|
|
87
|
-
*
|
|
88
|
-
* - Empty `path` returns the original top-level items unchanged.
|
|
89
|
-
* - If any step doesn't resolve to a known nested group (e.g. stale
|
|
90
|
-
* state after the registry changes), returns an empty list so the
|
|
91
|
-
* consumer can fall back to the root view.
|
|
92
|
-
*/
|
|
93
|
-
function getOptionsAtPath(options, path) {
|
|
94
|
-
let scope = options;
|
|
95
|
-
for (const label of path) {
|
|
96
|
-
const found = findNestedGroupByLabel(scope, label);
|
|
97
|
-
if (!found) return [];
|
|
98
|
-
scope = found.options;
|
|
99
|
-
}
|
|
100
|
-
return scope;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Recursively walk the tree and return every leaf option, each paired
|
|
104
|
-
* with the labels of its nested-group ancestors. Used by single-select
|
|
105
|
-
* Combobox to populate the search-results view: the search query
|
|
106
|
-
* bypasses the active navigation path and matches against every leaf
|
|
107
|
-
* in the tree, with the breadcrumb surfacing parent context in each
|
|
108
|
-
* hit.
|
|
109
|
-
*
|
|
110
|
-
* Inline (non-nested) groups are walked through transparently — their
|
|
111
|
-
* `label` isn't a breadcrumb crumb because they don't correspond to a
|
|
112
|
-
* navigation step. Only nested groups contribute a crumb.
|
|
113
|
-
*/
|
|
114
|
-
function flattenLeafOptions(options, breadcrumb = []) {
|
|
115
|
-
const result = [];
|
|
116
|
-
for (const item of options) if (isOptionGroup(item)) {
|
|
117
|
-
const nextBreadcrumb = item.nested ? [...breadcrumb, item.label] : breadcrumb;
|
|
118
|
-
result.push(...flattenLeafOptions(item.options, nextBreadcrumb));
|
|
119
|
-
} else result.push({
|
|
120
|
-
option: item,
|
|
121
|
-
breadcrumb
|
|
122
|
-
});
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Build the flat list of navigable items at the current navigation
|
|
127
|
-
* level, in document order. Inline (non-nested) groups are walked
|
|
128
|
-
* through transparently; their leaves and any nested subgroups
|
|
129
|
-
* contribute at this level. Nested groups become a `kind: 'group'`
|
|
130
|
-
* entry that the renderer turns into a navigation row.
|
|
131
|
-
*/
|
|
132
|
-
function getNavigableItemsAtLevel(items) {
|
|
133
|
-
const out = [];
|
|
134
|
-
for (const item of items) if (isOptionGroup(item)) if (item.nested) out.push({
|
|
135
|
-
kind: "group",
|
|
136
|
-
group: item
|
|
137
|
-
});
|
|
138
|
-
else out.push(...getNavigableItemsAtLevel(item.options));
|
|
139
|
-
else out.push({
|
|
140
|
-
kind: "leaf",
|
|
141
|
-
option: item
|
|
142
|
-
});
|
|
143
|
-
return out;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* A hook which provides the caller with dynamically filtered options
|
|
147
|
-
*
|
|
148
|
-
* @param options - The options to filter (can be flat or grouped)
|
|
149
|
-
* @param inputValue - The input value to filter the options by
|
|
150
|
-
* @returns The subset of the options that match the input value according to the fuse.js library
|
|
151
|
-
*/
|
|
152
|
-
function useFilteredOptions(options, inputValue) {
|
|
153
|
-
return (0, react.useMemo)(() => {
|
|
154
|
-
const flatOptions = flattenOptions(options);
|
|
155
|
-
const fuse = new fuse_js.default(flatOptions, {
|
|
156
|
-
shouldSort: false,
|
|
157
|
-
threshold: 0,
|
|
158
|
-
ignoreLocation: true,
|
|
159
|
-
minMatchCharLength: 1,
|
|
160
|
-
keys: ["label", "description"]
|
|
161
|
-
});
|
|
162
|
-
return inputValue === "" ? flatOptions : Array.from(new Set(fuse.search(inputValue).map(({ item }) => item)).values());
|
|
163
|
-
}, [options, inputValue]);
|
|
164
|
-
}
|
|
165
|
-
function buildVirtualRows(options, filteredOptions, indexRealToIndexVirtual) {
|
|
166
|
-
const rows = [];
|
|
167
|
-
let idx = 0;
|
|
168
|
-
for (const item of options) if (isOptionGroup(item)) {
|
|
169
|
-
if (item.nested) continue;
|
|
170
|
-
const visibleLeaves = flattenOptions(item.options).filter((opt) => filteredOptions.some((f) => f.value === opt.value));
|
|
171
|
-
if (visibleLeaves.length > 0) {
|
|
172
|
-
rows.push({
|
|
173
|
-
kind: "group-header",
|
|
174
|
-
label: item.label
|
|
175
|
-
});
|
|
176
|
-
for (const opt of visibleLeaves) {
|
|
177
|
-
indexRealToIndexVirtual.set(idx, rows.length);
|
|
178
|
-
rows.push({
|
|
179
|
-
kind: "option",
|
|
180
|
-
option: opt,
|
|
181
|
-
index: idx++
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
} else if (filteredOptions.some((f) => f.value === item.value)) {
|
|
186
|
-
indexRealToIndexVirtual.set(idx, rows.length);
|
|
187
|
-
rows.push({
|
|
188
|
-
kind: "option",
|
|
189
|
-
option: item,
|
|
190
|
-
index: idx++
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
return rows;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Renders options with support for groups, handling filtering and proper indexing
|
|
197
|
-
*
|
|
198
|
-
* @param params - Object containing options, filteredOptions, and renderOption
|
|
199
|
-
* @param params.options - The original options array (can include groups)
|
|
200
|
-
* @param params.filteredOptions - The flat filtered options to display
|
|
201
|
-
* @param params.virtualizer - Optional virtualizer for large lists
|
|
202
|
-
* @param params.virtualRows - Pre-built flat rows list (required when virtualizer is provided)
|
|
203
|
-
* @param params.renderOption - Callback to render each individual option with its flat index
|
|
204
|
-
* @returns React nodes with properly grouped and filtered options
|
|
205
|
-
*/
|
|
206
|
-
function renderOptionsWithGroups({ options, filteredOptions, renderOption, virtualizer, virtualRows }) {
|
|
207
|
-
if (virtualizer && virtualRows) {
|
|
208
|
-
const rows = virtualRows;
|
|
209
|
-
const vItems = virtualizer.getVirtualItems();
|
|
210
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
211
|
-
style: {
|
|
212
|
-
height: `${virtualizer.getTotalSize()}px`,
|
|
213
|
-
width: "100%",
|
|
214
|
-
position: "relative"
|
|
215
|
-
},
|
|
216
|
-
children: vItems.map((vItem) => {
|
|
217
|
-
const row = rows[vItem.index];
|
|
218
|
-
if (!row) return null;
|
|
219
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
220
|
-
"data-index": vItem.index,
|
|
221
|
-
ref: virtualizer.measureElement,
|
|
222
|
-
style: {
|
|
223
|
-
position: "absolute",
|
|
224
|
-
top: 0,
|
|
225
|
-
left: 0,
|
|
226
|
-
width: "100%",
|
|
227
|
-
transform: `translateY(${vItem.start}px)`
|
|
228
|
-
},
|
|
229
|
-
children: row.kind === "group-header" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Menu.MenuHeading, {
|
|
230
|
-
as: "div",
|
|
231
|
-
children: row.label
|
|
232
|
-
}) : renderOption(row.option, row.index)
|
|
233
|
-
}, String(vItem.key));
|
|
234
|
-
})
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
let flatIndex = -1;
|
|
238
|
-
return options.map((item, groupIndex) => {
|
|
239
|
-
if (isOptionGroup(item)) {
|
|
240
|
-
if (item.nested) return null;
|
|
241
|
-
const visibleLeaves = flattenOptions(item.options).filter((opt) => filteredOptions.some((filtered) => filtered.value === opt.value));
|
|
242
|
-
if (visibleLeaves.length === 0) return null;
|
|
243
|
-
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) => {
|
|
244
|
-
flatIndex++;
|
|
245
|
-
return renderOption(option, flatIndex);
|
|
246
|
-
})] }, `group-${groupIndex}`);
|
|
247
|
-
} else {
|
|
248
|
-
if (!filteredOptions.some((filtered) => filtered.value === item.value)) return null;
|
|
249
|
-
flatIndex++;
|
|
250
|
-
return renderOption(item, flatIndex);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
const MAX_DROPDOWN_HEIGHT = "300px";
|
|
255
|
-
const Container = styled_components.default.div`
|
|
256
|
-
display: flex;
|
|
257
|
-
position: relative;
|
|
258
|
-
width: 100%;
|
|
259
|
-
`;
|
|
260
|
-
const InputContainer = styled_components.default.div`
|
|
261
|
-
position: relative;
|
|
262
|
-
width: 100%;
|
|
263
|
-
`;
|
|
264
|
-
const ComboboxInput = (0, styled_components.default)(require_components_Input_index.default)`
|
|
265
|
-
padding-right: ${({ size }) => size === "sm" ? _persona_design_tokens.Spacing[5] : _persona_design_tokens.Spacing[6]}; /* Space for caret icon */
|
|
266
|
-
|
|
267
|
-
${({ $isOpen }) => $isOpen && styled_components.css`
|
|
268
|
-
${require_mixins_focus.focusStyle}
|
|
269
|
-
`}
|
|
270
|
-
|
|
271
|
-
/* Apply custom font family from selected item when dropdown is closed */
|
|
272
|
-
${({ $selectedItemStyle, $isOpen }) => !$isOpen && $selectedItemStyle?.fontFamily && styled_components.css`
|
|
273
|
-
&& {
|
|
274
|
-
font-family: ${$selectedItemStyle.fontFamily};
|
|
275
|
-
}
|
|
276
|
-
`}
|
|
277
|
-
`;
|
|
278
|
-
const CaretButton = (0, styled_components.default)(require_IconButton.Button).attrs({ width: "icon" })`
|
|
279
|
-
background-color: transparent;
|
|
280
|
-
border: none;
|
|
281
|
-
color: ${_persona_design_tokens.Color.BorderIconPrimary};
|
|
282
|
-
|
|
283
|
-
&:hover:not(:disabled),
|
|
284
|
-
&:active:not(:disabled) {
|
|
285
|
-
color: ${_persona_design_tokens.Color.BorderIconPrimary};
|
|
286
|
-
background-color: transparent;
|
|
287
|
-
border: none;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
&:disabled {
|
|
291
|
-
color: ${_persona_design_tokens.Color.BorderIconDisabled};
|
|
292
|
-
background-color: transparent;
|
|
293
|
-
border: none;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
position: absolute;
|
|
297
|
-
right: 0;
|
|
298
|
-
top: 0;
|
|
299
|
-
`;
|
|
300
|
-
const DropdownContainer = (0, styled_components.default)(require_Menu.FloatingCard)`
|
|
301
|
-
${({ $portal, $embedded, $top, $left, $width }) => $embedded ? styled_components.css`
|
|
302
|
-
position: static;
|
|
303
|
-
width: 100%;
|
|
304
|
-
min-width: 0;
|
|
305
|
-
border: 0;
|
|
306
|
-
border-radius: 0;
|
|
307
|
-
box-shadow: none;
|
|
308
|
-
background: transparent;
|
|
309
|
-
margin: 0;
|
|
310
|
-
` : $portal ? styled_components.css`
|
|
311
|
-
position: fixed;
|
|
312
|
-
top: ${$top != null ? `${$top}px` : "0"};
|
|
313
|
-
left: ${$left != null ? `${$left}px` : "0"};
|
|
314
|
-
width: ${$width != null ? `${$width}px` : "auto"};
|
|
315
|
-
` : styled_components.css`
|
|
316
|
-
position: absolute;
|
|
317
|
-
top: calc(100% + ${_persona_design_tokens.Spacing[2]});
|
|
318
|
-
left: 0;
|
|
319
|
-
right: 0;
|
|
320
|
-
width: 100%;
|
|
321
|
-
`}
|
|
322
|
-
|
|
323
|
-
${({ $minWidth }) => $minWidth && styled_components.css`
|
|
324
|
-
min-width: ${$minWidth};
|
|
325
|
-
`}
|
|
326
|
-
|
|
327
|
-
display: flex;
|
|
328
|
-
flex-direction: column;
|
|
329
|
-
${({ $embedded }) => $embedded && styled_components.css`
|
|
330
|
-
gap: ${_persona_design_tokens.Spacing[2]};
|
|
331
|
-
`}
|
|
332
|
-
overflow: ${({ $embedded }) => $embedded ? "visible" : "hidden"}; /* Prevent floating menu overflow while preserving embedded focus rings */
|
|
333
|
-
box-sizing: border-box;
|
|
334
|
-
z-index: ${require_lib_zindex.Z_INDICES.modalDropdown}; /* Ensure portal dropdown appears above other content */
|
|
335
|
-
|
|
336
|
-
${({ $isOpen }) => !$isOpen && styled_components.css`
|
|
337
|
-
display: none;
|
|
338
|
-
`}
|
|
339
|
-
`;
|
|
340
|
-
const ScrollableMenuList = (0, styled_components.default)(require_Menu.MenuList)`
|
|
341
|
-
max-height: ${MAX_DROPDOWN_HEIGHT};
|
|
342
|
-
overflow-y: auto;
|
|
343
|
-
overflow-x: hidden; /* Prevent horizontal scrolling */
|
|
344
|
-
width: 100%; /* Ensure full width is used */
|
|
345
|
-
box-sizing: border-box;
|
|
346
|
-
`;
|
|
347
|
-
const SearchInputContainer = styled_components.default.div`
|
|
348
|
-
flex-shrink: 0;
|
|
349
|
-
${({ $embedded }) => $embedded ? styled_components.css`
|
|
350
|
-
padding: 0;
|
|
351
|
-
` : styled_components.css`
|
|
352
|
-
padding: ${_persona_design_tokens.Spacing[1]} ${_persona_design_tokens.Spacing[2]};
|
|
353
|
-
border-bottom: 1px solid ${({ theme }) => theme.color.border.primary};
|
|
354
|
-
`}
|
|
355
|
-
`;
|
|
356
|
-
const SearchInput = (0, styled_components.default)(require_components_Input_index.default)`
|
|
357
|
-
${({ $embedded }) => !$embedded && styled_components.css`
|
|
358
|
-
/* Borderless strip inside floating menus */
|
|
359
|
-
border: none;
|
|
360
|
-
padding-top: ${_persona_design_tokens.Spacing[1]};
|
|
361
|
-
padding-bottom: ${_persona_design_tokens.Spacing[1]};
|
|
362
|
-
|
|
363
|
-
&:focus {
|
|
364
|
-
outline: none !important;
|
|
365
|
-
}
|
|
366
|
-
`}
|
|
367
|
-
`;
|
|
368
|
-
const EmptyState = (0, styled_components.default)(require_Text.Paragraph).attrs(({ size }) => ({ size }))`
|
|
369
|
-
padding: 0 ${({ size }) => size === "sm" ? _persona_design_tokens.Spacing[1] : _persona_design_tokens.Spacing[2]};
|
|
370
|
-
color: ${({ theme }) => theme.color.text.tertiary};
|
|
371
|
-
${({ theme }) => theme.text.paragraph.md};
|
|
372
|
-
`;
|
|
373
|
-
const LoadingContainer = styled_components.default.div`
|
|
374
|
-
display: flex;
|
|
375
|
-
align-items: center;
|
|
376
|
-
justify-content: center;
|
|
377
|
-
min-height: 136px;
|
|
378
|
-
padding: ${_persona_design_tokens.Spacing[3]};
|
|
379
|
-
`;
|
|
380
|
-
const FooterActionContainer = styled_components.default.div`
|
|
381
|
-
flex-shrink: 0;
|
|
382
|
-
padding-top: ${_persona_design_tokens.Spacing[1]};
|
|
383
|
-
`;
|
|
384
|
-
/**
|
|
385
|
-
* Action button rendered at the bottom of the dropdown, below the option list.
|
|
386
|
-
* Kept out of downshift's `items` list and out of the Tab order, mirroring the
|
|
387
|
-
* `BackRow` affordance: `onMouseDown` preventDefault beats downshift's
|
|
388
|
-
* blur-on-mousedown so the dropdown stays open on click. Keyboard users reach it
|
|
389
|
-
* by arrowing past the last option (the parent drives `isHighlighted` and points
|
|
390
|
-
* the input's `aria-activedescendant` at this button via `id`).
|
|
391
|
-
*/
|
|
392
|
-
function FooterActionRow({ action, size, id, isHighlighted = false }) {
|
|
393
|
-
const buttonRef = (0, react.useRef)(null);
|
|
394
|
-
(0, react.useEffect)(() => {
|
|
395
|
-
if (isHighlighted) buttonRef.current?.scrollIntoView({ block: "nearest" });
|
|
396
|
-
}, [isHighlighted]);
|
|
397
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FooterActionContainer, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_IconButton.Button, {
|
|
398
|
-
ref: buttonRef,
|
|
399
|
-
id,
|
|
400
|
-
type: "button",
|
|
401
|
-
variant: "basic",
|
|
402
|
-
width: "full",
|
|
403
|
-
size,
|
|
404
|
-
tabIndex: -1,
|
|
405
|
-
active: isHighlighted,
|
|
406
|
-
onMouseDown: (e) => {
|
|
407
|
-
e.preventDefault();
|
|
408
|
-
action.onClick();
|
|
409
|
-
},
|
|
410
|
-
onClick: (e) => {
|
|
411
|
-
if (e.detail === 0) action.onClick();
|
|
412
|
-
},
|
|
413
|
-
children: action.label
|
|
414
|
-
}) });
|
|
415
|
-
}
|
|
416
|
-
const OptionLabel = styled_components.default.div`
|
|
417
|
-
overflow: hidden;
|
|
418
|
-
text-overflow: ellipsis;
|
|
419
|
-
white-space: nowrap;
|
|
420
|
-
min-width: 0; /* Allow flex item to shrink below content size */
|
|
421
|
-
|
|
422
|
-
/* Apply custom font family if provided */
|
|
423
|
-
${({ $labelStyle }) => $labelStyle?.fontFamily && styled_components.css`
|
|
424
|
-
font-family: ${$labelStyle.fontFamily};
|
|
425
|
-
`}
|
|
426
|
-
`;
|
|
427
|
-
const Description = styled_components.default.p`
|
|
428
|
-
${_persona_design_tokens.Typography.TextSmall};
|
|
429
|
-
color: ${_persona_design_tokens.Color.TextSecondary};
|
|
430
|
-
margin: 0;
|
|
431
|
-
|
|
432
|
-
/* Multi-line truncation with 3-line limit */
|
|
433
|
-
overflow: hidden;
|
|
434
|
-
display: -webkit-box;
|
|
435
|
-
-webkit-line-clamp: 3;
|
|
436
|
-
-webkit-box-orient: vertical;
|
|
437
|
-
|
|
438
|
-
/* Fallback for browsers that don't support -webkit-line-clamp */
|
|
439
|
-
max-height: calc(${_persona_design_tokens.Typography.TextSmall.lineHeight} * 3); /* line-height * 3 lines */
|
|
440
|
-
`;
|
|
441
|
-
function useDropdownPosition(portalContainerRef, isOpen, portal) {
|
|
442
|
-
const [position, setPosition] = (0, react.useState)({
|
|
443
|
-
top: 0,
|
|
444
|
-
left: 0,
|
|
445
|
-
width: 0
|
|
446
|
-
});
|
|
447
|
-
(0, react.useEffect)(() => {
|
|
448
|
-
if (!portal || !isOpen || !portalContainerRef.current) return;
|
|
449
|
-
const updatePosition = () => {
|
|
450
|
-
const rect = portalContainerRef.current.getBoundingClientRect();
|
|
451
|
-
const spacing = parseInt(_persona_design_tokens.Spacing[2]);
|
|
452
|
-
setPosition({
|
|
453
|
-
top: rect.bottom + spacing,
|
|
454
|
-
left: rect.left,
|
|
455
|
-
width: rect.width
|
|
456
|
-
});
|
|
457
|
-
};
|
|
458
|
-
updatePosition();
|
|
459
|
-
window.addEventListener("scroll", updatePosition, true);
|
|
460
|
-
window.addEventListener("resize", updatePosition);
|
|
461
|
-
return () => {
|
|
462
|
-
window.removeEventListener("scroll", updatePosition, true);
|
|
463
|
-
window.removeEventListener("resize", updatePosition);
|
|
464
|
-
};
|
|
465
|
-
}, [
|
|
466
|
-
portalContainerRef,
|
|
467
|
-
isOpen,
|
|
468
|
-
portal
|
|
469
|
-
]);
|
|
470
|
-
return position;
|
|
471
|
-
}
|
|
472
|
-
function DropdownPortalWrapper({ children, portal }) {
|
|
473
|
-
const portalRoot = (0, react.useRef)(null);
|
|
474
|
-
(0, react.useEffect)(() => {
|
|
475
|
-
if (portal) portalRoot.current = document.body;
|
|
476
|
-
}, [portal]);
|
|
477
|
-
if (portal && portalRoot.current) return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
478
|
-
id: "combobox-dropdown-portal-wrapper",
|
|
479
|
-
"data-react-aria-top-layer": "true",
|
|
480
|
-
children
|
|
481
|
-
}), portalRoot.current);
|
|
482
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
483
|
-
}
|
|
484
|
-
//#endregion
|
|
485
|
-
//#region components/Combobox/useComboboxFooterAction.ts
|
|
486
|
-
/**
|
|
487
|
-
* Shared keyboard-navigation logic for the Combobox `footerAction` button, used
|
|
488
|
-
* by both the single- and multi-select variants. The footer is a real
|
|
489
|
-
* `<button>` outside downshift's item list, so it needs a parallel highlight
|
|
490
|
-
* flag (`isFooterHighlighted`) reached by arrowing past the last option or up
|
|
491
|
-
* from the first option, rather than a downshift `highlightedIndex`. DOM focus
|
|
492
|
-
* stays on the input; the footer is never a Tab stop (mirrors the `BackRow`
|
|
493
|
-
* affordance).
|
|
494
|
-
*/
|
|
495
|
-
function useComboboxFooterAction({ footerAction, isOptionsLoading, itemCount, isMenuOpen, inputValue, highlightedIndex, setHighlightedIndex, inputId }) {
|
|
496
|
-
const [isFooterHighlighted, setIsFooterHighlighted] = (0, react.useState)(false);
|
|
497
|
-
const footerActionId = `${inputId}-footer-action`;
|
|
498
|
-
const showFooterAction = Boolean(footerAction) && !isOptionsLoading && itemCount > 0;
|
|
499
|
-
(0, react.useEffect)(() => {
|
|
500
|
-
if (!isMenuOpen) setIsFooterHighlighted(false);
|
|
501
|
-
}, [isMenuOpen]);
|
|
502
|
-
(0, react.useEffect)(() => {
|
|
503
|
-
setIsFooterHighlighted(false);
|
|
504
|
-
}, [inputValue]);
|
|
505
|
-
(0, react.useEffect)(() => {
|
|
506
|
-
if (!showFooterAction) setIsFooterHighlighted(false);
|
|
507
|
-
}, [showFooterAction]);
|
|
508
|
-
(0, react.useEffect)(() => {
|
|
509
|
-
if (highlightedIndex >= 0) setIsFooterHighlighted(false);
|
|
510
|
-
}, [highlightedIndex]);
|
|
511
|
-
const clearFooterHighlight = (0, react.useCallback)(() => setIsFooterHighlighted(false), []);
|
|
512
|
-
return {
|
|
513
|
-
isFooterHighlighted,
|
|
514
|
-
footerActionId,
|
|
515
|
-
showFooterAction,
|
|
516
|
-
handleFooterKeyDown: (0, react.useCallback)((event) => {
|
|
517
|
-
if (!showFooterAction) return false;
|
|
518
|
-
const nativeEvent = event.nativeEvent;
|
|
519
|
-
const consume = () => {
|
|
520
|
-
event.preventDefault();
|
|
521
|
-
nativeEvent.preventDownshiftDefault = true;
|
|
522
|
-
};
|
|
523
|
-
if (!isFooterHighlighted && event.key === "ArrowDown" && highlightedIndex === itemCount - 1) {
|
|
524
|
-
consume();
|
|
525
|
-
setIsFooterHighlighted(true);
|
|
526
|
-
setHighlightedIndex(-1);
|
|
527
|
-
return true;
|
|
528
|
-
}
|
|
529
|
-
if (!isFooterHighlighted && event.key === "ArrowUp" && highlightedIndex === 0) {
|
|
530
|
-
consume();
|
|
531
|
-
setIsFooterHighlighted(true);
|
|
532
|
-
setHighlightedIndex(-1);
|
|
533
|
-
return true;
|
|
534
|
-
}
|
|
535
|
-
if (isFooterHighlighted) {
|
|
536
|
-
if (event.key === "ArrowUp") {
|
|
537
|
-
consume();
|
|
538
|
-
setIsFooterHighlighted(false);
|
|
539
|
-
setHighlightedIndex(itemCount - 1);
|
|
540
|
-
return true;
|
|
541
|
-
}
|
|
542
|
-
if (event.key === "ArrowDown") {
|
|
543
|
-
consume();
|
|
544
|
-
setIsFooterHighlighted(false);
|
|
545
|
-
setHighlightedIndex(0);
|
|
546
|
-
return true;
|
|
547
|
-
}
|
|
548
|
-
if (event.key === "Enter") {
|
|
549
|
-
consume();
|
|
550
|
-
footerAction?.onClick();
|
|
551
|
-
return true;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
return false;
|
|
555
|
-
}, [
|
|
556
|
-
showFooterAction,
|
|
557
|
-
isFooterHighlighted,
|
|
558
|
-
highlightedIndex,
|
|
559
|
-
itemCount,
|
|
560
|
-
footerAction,
|
|
561
|
-
setHighlightedIndex
|
|
562
|
-
]),
|
|
563
|
-
clearFooterHighlight
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
//#endregion
|
|
567
|
-
//#region components/Combobox/useTruncation.ts
|
|
568
|
-
/**
|
|
569
|
-
* Custom hook for calculating truncation when multi-select items are restricted to a single line using actual DOM measurements
|
|
570
|
-
* Ensures at least one item is always visible
|
|
571
|
-
*/
|
|
572
|
-
function useTruncation(selectedItems, stickerRefs, truncatorRef, containerRef, truncate) {
|
|
573
|
-
const [visibleCount, setVisibleCount] = (0, react.useState)(selectedItems.length);
|
|
574
|
-
(0, react.useEffect)(() => {
|
|
575
|
-
if (!truncate || selectedItems.length === 0 || !containerRef.current) {
|
|
576
|
-
setVisibleCount(selectedItems.length);
|
|
577
|
-
return;
|
|
578
|
-
}
|
|
579
|
-
const calculateVisibleCount = () => {
|
|
580
|
-
const container = containerRef.current;
|
|
581
|
-
if (!container) return;
|
|
582
|
-
if (!(selectedItems.every((_, i) => stickerRefs.current[i] != null) && truncatorRef.current != null)) return;
|
|
583
|
-
const computedStyle = window.getComputedStyle(container);
|
|
584
|
-
const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
|
|
585
|
-
const paddingRight = parseFloat(computedStyle.paddingRight) || 0;
|
|
586
|
-
const availableWidth = container.offsetWidth - paddingLeft - paddingRight;
|
|
587
|
-
const gap = 4;
|
|
588
|
-
const truncatorWidth = truncatorRef.current.offsetWidth;
|
|
589
|
-
let count = 1;
|
|
590
|
-
let totalWidth = stickerRefs.current[0].offsetWidth;
|
|
591
|
-
for (let i = 1; i < selectedItems.length; i++) {
|
|
592
|
-
const itemWidth = stickerRefs.current[i].offsetWidth;
|
|
593
|
-
const wouldBeLastItem = i === selectedItems.length - 1;
|
|
594
|
-
const widthWithItem = totalWidth + gap + itemWidth;
|
|
595
|
-
if (widthWithItem + (wouldBeLastItem ? 0 : gap + truncatorWidth) <= availableWidth) {
|
|
596
|
-
totalWidth = widthWithItem;
|
|
597
|
-
count++;
|
|
598
|
-
} else break;
|
|
599
|
-
}
|
|
600
|
-
setVisibleCount((prev) => prev === count ? prev : count);
|
|
601
|
-
};
|
|
602
|
-
const resizeObserver = new ResizeObserver(calculateVisibleCount);
|
|
603
|
-
resizeObserver.observe(containerRef.current);
|
|
604
|
-
return () => {
|
|
605
|
-
resizeObserver.disconnect();
|
|
606
|
-
};
|
|
607
|
-
}, [
|
|
608
|
-
selectedItems,
|
|
609
|
-
stickerRefs,
|
|
610
|
-
truncatorRef,
|
|
611
|
-
containerRef,
|
|
612
|
-
truncate
|
|
613
|
-
]);
|
|
614
|
-
return visibleCount;
|
|
615
|
-
}
|
|
616
|
-
//#endregion
|
|
617
|
-
//#region components/Combobox/ComboboxMultiSelect.tsx
|
|
618
|
-
const SELECT_ALL_VALUE = "__SELECT_ALL__";
|
|
619
|
-
const EXTERNAL_TRIGGER_DROPDOWN_MIN_WIDTH$1 = "240px";
|
|
620
|
-
/**
|
|
621
|
-
* Recursively drop the `nested: true` flag from every group in the
|
|
622
|
-
* tree, converting nested-navigation groups into inline section-
|
|
623
|
-
* header groups. Multi-select doesn't implement the nested-nav UX
|
|
624
|
-
* (chevron rows, Back row, descent), so this graceful-degradation
|
|
625
|
-
* transform keeps every leaf reachable as a checkable option under
|
|
626
|
-
* its parent's section header — instead of having `flattenOptions` /
|
|
627
|
-
* `renderOptionsWithGroups` silently drop them along with their
|
|
628
|
-
* descendants. Single-select Combobox is unaffected; it owns its own
|
|
629
|
-
* nested-nav render path.
|
|
630
|
-
*
|
|
631
|
-
* For a multi-level tree (`{nested, options: [{nested, options}]}`),
|
|
632
|
-
* the inner inline group is walked through by `flattenOptions` so
|
|
633
|
-
* its leaves surface under the outer header — the inner label is
|
|
634
|
-
* lost, but all leaves stay reachable. Acceptable for the
|
|
635
|
-
* graceful-degradation goal; nested-nav can be added later without
|
|
636
|
-
* changing this API.
|
|
637
|
-
*/
|
|
638
|
-
function inlineNestedGroups(items) {
|
|
639
|
-
return items.map((item) => {
|
|
640
|
-
if (!isOptionGroup(item)) return item;
|
|
641
|
-
return {
|
|
642
|
-
label: item.label,
|
|
643
|
-
options: inlineNestedGroups(item.options)
|
|
644
|
-
};
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
const MultiSelectComboboxInput = (0, styled_components.default)(ComboboxInput)`
|
|
648
|
-
position: absolute;
|
|
649
|
-
inset: 0;
|
|
650
|
-
height: auto;
|
|
651
|
-
caret-color: transparent; /* Hide cursor in multi-select mode because we use stickers and focus into the search input */
|
|
652
|
-
`;
|
|
653
|
-
const MultiSelectScrollableMenuList = (0, styled_components.default)(ScrollableMenuList)`
|
|
654
|
-
max-height: calc(${MAX_DROPDOWN_HEIGHT} - 60px); /* Subtract approximate search bar height */
|
|
655
|
-
overflow-x: hidden; /* Prevent horizontal scrolling */
|
|
656
|
-
width: 100%; /* Ensure full width is used */
|
|
657
|
-
box-sizing: border-box;
|
|
658
|
-
${({ $embedded }) => $embedded && styled_components.css`
|
|
659
|
-
padding: 0;
|
|
660
|
-
`}
|
|
661
|
-
`;
|
|
662
|
-
const SelectedItemsContainer = styled_components.default.div`
|
|
663
|
-
position: relative; /* Establish positioning context */
|
|
664
|
-
box-sizing: border-box;
|
|
665
|
-
min-height: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[5] : _persona_design_tokens.Spacing[6]};
|
|
666
|
-
max-height: ${({ $truncate, $size }) => $truncate ? $size === "sm" ? _persona_design_tokens.Spacing[5] : _persona_design_tokens.Spacing[6] : "none"};
|
|
667
|
-
padding-left: ${_persona_design_tokens.Spacing[2]};
|
|
668
|
-
padding-right: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[5] : _persona_design_tokens.Spacing[6]}; /* Leave space for caret button. */
|
|
669
|
-
padding-top: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[1] : _persona_design_tokens.Spacing[2]};
|
|
670
|
-
padding-bottom: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[1] : _persona_design_tokens.Spacing[2]};
|
|
671
|
-
display: flex;
|
|
672
|
-
flex-wrap: ${({ $truncate }) => $truncate ? "nowrap" : "wrap"};
|
|
673
|
-
gap: ${_persona_design_tokens.Spacing[1]};
|
|
674
|
-
align-items: flex-start;
|
|
675
|
-
align-content: flex-start;
|
|
676
|
-
pointer-events: none; /* Allow clicks to pass through to underlying input */
|
|
677
|
-
overflow: hidden; /* Required for truncation when truncate mode is enabled */
|
|
678
|
-
|
|
679
|
-
/* Re-enable pointer events on stickers' dismiss buttons */
|
|
680
|
-
button {
|
|
681
|
-
pointer-events: auto;
|
|
682
|
-
}
|
|
683
|
-
`;
|
|
684
|
-
const TruncatedItemsWrapper = styled_components.default.div`
|
|
685
|
-
display: flex;
|
|
686
|
-
flex-wrap: nowrap;
|
|
687
|
-
gap: ${_persona_design_tokens.Spacing[1]};
|
|
688
|
-
overflow: hidden;
|
|
689
|
-
flex: 1;
|
|
690
|
-
min-width: 0; /* Allow shrinking below content size */
|
|
691
|
-
pointer-events: none;
|
|
692
|
-
`;
|
|
693
|
-
const TruncatedSticker = (0, styled_components.default)(require_Sticker.Sticker)`
|
|
694
|
-
/* Allow first sticker to truncate its text only when it's the only item */
|
|
695
|
-
flex-shrink: ${({ $isOnlyItem }) => $isOnlyItem ? 1 : 0};
|
|
696
|
-
min-width: 0;
|
|
697
|
-
max-width: 100%;
|
|
698
|
-
/* If the sticker is an inline element it was causing the parent to gain an extra pixel of height */
|
|
699
|
-
vertical-align: top;
|
|
700
|
-
`;
|
|
701
|
-
const TruncatorSticker = (0, styled_components.default)(require_Sticker.Sticker)`
|
|
702
|
-
/* Truncator should never shrink */
|
|
703
|
-
flex-shrink: 0;
|
|
704
|
-
/* If the sticker is an inline element it was causing the parent to gain an extra pixel of height */
|
|
705
|
-
vertical-align: top;
|
|
706
|
-
`;
|
|
707
|
-
const HiddenMeasurementContainer = styled_components.default.div`
|
|
708
|
-
position: absolute;
|
|
709
|
-
top: 0;
|
|
710
|
-
left: 0;
|
|
711
|
-
visibility: hidden;
|
|
712
|
-
display: flex;
|
|
713
|
-
flex-wrap: nowrap;
|
|
714
|
-
gap: ${_persona_design_tokens.Spacing[1]};
|
|
715
|
-
pointer-events: none;
|
|
716
|
-
overflow: hidden;
|
|
717
|
-
max-width: 100%;
|
|
718
|
-
`;
|
|
719
|
-
const StyledMenuItem$1 = (0, styled_components.default)(require_Menu.MenuItem)`
|
|
720
|
-
/* These heights should add up to 24 and 32 respectively and the content is 20 already */
|
|
721
|
-
padding: ${({ $size }) => $size === "sm" ? `2px ${_persona_design_tokens.Spacing[2]}` : `6px ${_persona_design_tokens.Spacing[2]}`};
|
|
722
|
-
display: flex;
|
|
723
|
-
flex-direction: column;
|
|
724
|
-
align-items: flex-start;
|
|
725
|
-
gap: ${_persona_design_tokens.Spacing[1]};
|
|
726
|
-
min-width: 0; /* Allow content to shrink below natural size */
|
|
727
|
-
width: 100%; /* Ensure full width of dropdown */
|
|
728
|
-
box-sizing: border-box;
|
|
729
|
-
|
|
730
|
-
/* Force all children to respect the container width */
|
|
731
|
-
> * {
|
|
732
|
-
width: 100%;
|
|
733
|
-
min-width: 0;
|
|
734
|
-
box-sizing: border-box;
|
|
735
|
-
}
|
|
736
|
-
`;
|
|
737
|
-
const CheckboxLabel = styled_components.default.span`
|
|
738
|
-
color: ${_persona_design_tokens.Color.TextPrimary};
|
|
739
|
-
${({ $size }) => $size === "sm" ? _persona_design_tokens.Typography.TextSmall : _persona_design_tokens.Typography.TextMedium};
|
|
740
|
-
display: flex;
|
|
741
|
-
flex-direction: column;
|
|
742
|
-
gap: ${_persona_design_tokens.Spacing[1]};
|
|
743
|
-
min-width: 0; /* Allow content to shrink below natural size */
|
|
744
|
-
|
|
745
|
-
/** Nudge text for visual alignment */
|
|
746
|
-
position: relative;
|
|
747
|
-
bottom: -1px;
|
|
748
|
-
`;
|
|
749
|
-
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, footerAction, ...props }, ref) {
|
|
750
|
-
const options = (0, react.useMemo)(() => containsNestedGroup(rawOptions) ? inlineNestedGroups(rawOptions) : rawOptions, [rawOptions]);
|
|
751
|
-
const field = require_useFormField.useFormField({
|
|
752
|
-
hasWarning,
|
|
753
|
-
hasError,
|
|
754
|
-
disabled,
|
|
755
|
-
inputId: id
|
|
756
|
-
});
|
|
757
|
-
const [inputValue, setInputValue] = (0, react.useState)("");
|
|
758
|
-
const searchInputRef = (0, react.useRef)(null);
|
|
759
|
-
const comboboxInputRef = (0, react.useRef)(null);
|
|
760
|
-
const caretButtonRef = (0, react.useRef)(null);
|
|
761
|
-
const comboboxContainerRef = (0, react.useRef)(null);
|
|
762
|
-
const scrollableListRef = (0, react.useRef)(null);
|
|
763
|
-
const selectedItemsContainerRef = (0, react.useRef)(null);
|
|
764
|
-
const measurementStickerRefs = (0, react.useRef)([]);
|
|
765
|
-
const measurementTruncatorRef = (0, react.useRef)(null);
|
|
766
|
-
const portalContainerRef = externalPortalContainerRef || comboboxContainerRef;
|
|
767
|
-
const flatOptions = (0, react.useMemo)(() => flattenOptions(options), [options]);
|
|
768
|
-
const selectedItems = flatOptions.filter((option) => values.includes(option.value));
|
|
769
|
-
(0, react.useEffect)(() => {
|
|
770
|
-
measurementStickerRefs.current = measurementStickerRefs.current.slice(0, selectedItems.length);
|
|
771
|
-
}, [selectedItems.length]);
|
|
772
|
-
const visibleCount = useTruncation(selectedItems, measurementStickerRefs, measurementTruncatorRef, selectedItemsContainerRef, truncate);
|
|
773
|
-
(0, react.useImperativeHandle)(ref, () => ({
|
|
774
|
-
...comboboxInputRef.current,
|
|
775
|
-
focusSearchInput: () => {
|
|
776
|
-
if (searchInputRef.current) searchInputRef.current.focus();
|
|
777
|
-
}
|
|
778
|
-
}), []);
|
|
779
|
-
const filteredOptions = useFilteredOptions(options, inputValue);
|
|
780
|
-
const isGrouped = (0, react.useMemo)(() => options.some(isOptionGroup), [options]);
|
|
781
|
-
const optionsWithSelectedFirstInGroups = (0, react.useMemo)(() => {
|
|
782
|
-
if (!isGrouped || values.length === 0 || stableOptionOrder) return options;
|
|
783
|
-
return options.map((item) => {
|
|
784
|
-
if (isOptionGroup(item)) {
|
|
785
|
-
const groupLeaves = flattenOptions(item.options);
|
|
786
|
-
return {
|
|
787
|
-
...item,
|
|
788
|
-
options: groupLeaves.toSorted((a, b) => {
|
|
789
|
-
const aSelected = values.includes(a.value);
|
|
790
|
-
if (aSelected === values.includes(b.value)) return 0;
|
|
791
|
-
return aSelected ? -1 : 1;
|
|
792
|
-
})
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
return item;
|
|
796
|
-
});
|
|
797
|
-
}, [
|
|
798
|
-
options,
|
|
799
|
-
isGrouped,
|
|
800
|
-
values,
|
|
801
|
-
stableOptionOrder
|
|
802
|
-
]);
|
|
803
|
-
const navigableItems = (0, react.useMemo)(() => {
|
|
804
|
-
const items = [];
|
|
805
|
-
if (isGrouped && values.length > 0) {
|
|
806
|
-
if (selectAll && filteredOptions.length > 0) items.push({
|
|
807
|
-
value: SELECT_ALL_VALUE,
|
|
808
|
-
label: "Select all"
|
|
809
|
-
});
|
|
810
|
-
for (const item of optionsWithSelectedFirstInGroups) if (isOptionGroup(item)) {
|
|
811
|
-
for (const opt of flattenOptions(item.options)) if (filteredOptions.some((f) => f.value === opt.value)) items.push(opt);
|
|
812
|
-
} else if (filteredOptions.some((f) => f.value === item.value)) items.push(item);
|
|
813
|
-
return items;
|
|
814
|
-
}
|
|
815
|
-
const orderedFiltered = !isGrouped && values.length > 0 && !stableOptionOrder ? filteredOptions.toSorted((a, b) => {
|
|
816
|
-
const aSelected = values.includes(a.value);
|
|
817
|
-
if (aSelected === values.includes(b.value)) return 0;
|
|
818
|
-
return aSelected ? -1 : 1;
|
|
819
|
-
}) : filteredOptions;
|
|
820
|
-
if (selectAll && orderedFiltered.length > 0) items.push({
|
|
821
|
-
value: SELECT_ALL_VALUE,
|
|
822
|
-
label: "Select all"
|
|
823
|
-
});
|
|
824
|
-
items.push(...orderedFiltered);
|
|
825
|
-
return items;
|
|
826
|
-
}, [
|
|
827
|
-
selectAll,
|
|
828
|
-
filteredOptions,
|
|
829
|
-
isGrouped,
|
|
830
|
-
values,
|
|
831
|
-
optionsWithSelectedFirstInGroups,
|
|
832
|
-
stableOptionOrder
|
|
833
|
-
]);
|
|
834
|
-
const optionsToRender = (0, react.useMemo)(() => {
|
|
835
|
-
if (!isGrouped && values.length > 0) return navigableItems;
|
|
836
|
-
const hasSelectAll = selectAll && filteredOptions.length > 0 && navigableItems[0]?.value === SELECT_ALL_VALUE;
|
|
837
|
-
const baseOptions = isGrouped && values.length > 0 ? optionsWithSelectedFirstInGroups : options;
|
|
838
|
-
return hasSelectAll ? [navigableItems[0], ...baseOptions] : baseOptions;
|
|
839
|
-
}, [
|
|
840
|
-
isGrouped,
|
|
841
|
-
values,
|
|
842
|
-
navigableItems,
|
|
843
|
-
selectAll,
|
|
844
|
-
filteredOptions,
|
|
845
|
-
optionsWithSelectedFirstInGroups,
|
|
846
|
-
options
|
|
847
|
-
]);
|
|
848
|
-
const navigableToVirtualRowRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
849
|
-
const virtualRows = (0, react.useMemo)(() => {
|
|
850
|
-
if (!virtualize) return [];
|
|
851
|
-
const map = /* @__PURE__ */ new Map();
|
|
852
|
-
const rows = buildVirtualRows(optionsToRender, navigableItems, map);
|
|
853
|
-
navigableToVirtualRowRef.current = map;
|
|
854
|
-
return rows;
|
|
855
|
-
}, [
|
|
856
|
-
optionsToRender,
|
|
857
|
-
navigableItems,
|
|
858
|
-
virtualize
|
|
859
|
-
]);
|
|
860
|
-
const virtualizer = (0, _tanstack_react_virtual.useVirtualizer)({
|
|
861
|
-
count: virtualRows.length,
|
|
862
|
-
getScrollElement: () => scrollableListRef.current,
|
|
863
|
-
estimateSize: () => size === "sm" ? 24 : 32,
|
|
864
|
-
overscan: 5
|
|
865
|
-
});
|
|
866
|
-
const itemToString = (0, react.useCallback)((item) => {
|
|
867
|
-
return item ? item.label : "";
|
|
868
|
-
}, []);
|
|
869
|
-
const getOptionId = (0, react.useCallback)((index) => `${field.inputId}-option-${index}`, [field.inputId]);
|
|
870
|
-
const { addSelectedItem, getSelectedItemProps, getDropdownProps, removeSelectedItem, reset, setSelectedItems } = (0, downshift.useMultipleSelection)({
|
|
871
|
-
selectedItems,
|
|
872
|
-
onStateChange: ({ selectedItems: newSelectedItems, type }) => {
|
|
873
|
-
switch (type) {
|
|
874
|
-
case downshift.useMultipleSelection.stateChangeTypes.SelectedItemKeyDownBackspace:
|
|
875
|
-
case downshift.useMultipleSelection.stateChangeTypes.SelectedItemKeyDownDelete:
|
|
876
|
-
case downshift.useMultipleSelection.stateChangeTypes.DropdownKeyDownBackspace:
|
|
877
|
-
case downshift.useMultipleSelection.stateChangeTypes.FunctionRemoveSelectedItem:
|
|
878
|
-
case downshift.useMultipleSelection.stateChangeTypes.FunctionAddSelectedItem:
|
|
879
|
-
case downshift.useMultipleSelection.stateChangeTypes.FunctionSetSelectedItems:
|
|
880
|
-
if (onValuesChange && newSelectedItems) {
|
|
881
|
-
const newValues = newSelectedItems.map((item) => item.value);
|
|
882
|
-
onValuesChange?.(newValues);
|
|
883
|
-
}
|
|
884
|
-
break;
|
|
885
|
-
case downshift.useMultipleSelection.stateChangeTypes.FunctionReset:
|
|
886
|
-
if (onValuesChange) onValuesChange([]);
|
|
887
|
-
break;
|
|
888
|
-
default: break;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
});
|
|
892
|
-
const selectedState = (0, react.useMemo)(() => {
|
|
893
|
-
const counts = filteredOptions.reduce((acc, option) => {
|
|
894
|
-
if (values.includes(option.value)) acc.selected++;
|
|
895
|
-
else acc.notSelected++;
|
|
896
|
-
return acc;
|
|
897
|
-
}, {
|
|
898
|
-
selected: 0,
|
|
899
|
-
notSelected: 0
|
|
900
|
-
});
|
|
901
|
-
return {
|
|
902
|
-
allSelected: counts.selected === filteredOptions.length,
|
|
903
|
-
allNotSelected: counts.notSelected === filteredOptions.length,
|
|
904
|
-
indeterminate: counts.selected > 0 && counts.selected < filteredOptions.length
|
|
905
|
-
};
|
|
906
|
-
}, [values, filteredOptions]);
|
|
907
|
-
const handleSelectAllToggle = (0, react.useCallback)(() => {
|
|
908
|
-
if (selectedState.allSelected || selectedState.indeterminate) {
|
|
909
|
-
const visibleValues = filteredOptions.map((option) => option.value);
|
|
910
|
-
setSelectedItems(selectedItems.filter((item) => !visibleValues.includes(item.value)));
|
|
911
|
-
} else {
|
|
912
|
-
const newItems = filteredOptions.filter((option) => !values.includes(option.value));
|
|
913
|
-
setSelectedItems([...selectedItems, ...newItems]);
|
|
914
|
-
}
|
|
915
|
-
}, [
|
|
916
|
-
selectedState.allSelected,
|
|
917
|
-
selectedState.indeterminate,
|
|
918
|
-
filteredOptions,
|
|
919
|
-
selectedItems,
|
|
920
|
-
values,
|
|
921
|
-
setSelectedItems
|
|
922
|
-
]);
|
|
923
|
-
const { isOpen, getToggleButtonProps, getMenuProps, getInputProps, getItemProps, highlightedIndex, setHighlightedIndex, closeMenu, openMenu } = (0, downshift.useCombobox)({
|
|
924
|
-
items: navigableItems,
|
|
925
|
-
itemToString,
|
|
926
|
-
getItemId: getOptionId,
|
|
927
|
-
isOpen: embedded ? true : void 0,
|
|
928
|
-
selectedItem: null,
|
|
929
|
-
initialHighlightedIndex: 0,
|
|
930
|
-
defaultHighlightedIndex: 0,
|
|
931
|
-
onIsOpenChange({ isOpen: newIsOpen }) {
|
|
932
|
-
if (newIsOpen && inputValue !== "") setInputValue("");
|
|
933
|
-
},
|
|
934
|
-
onHighlightedIndexChange: ({ highlightedIndex, type }) => {
|
|
935
|
-
if (virtualize && type !== downshift.useCombobox.stateChangeTypes.MenuMouseLeave && highlightedIndex >= 0) {
|
|
936
|
-
const rowIndex = navigableToVirtualRowRef.current.get(highlightedIndex);
|
|
937
|
-
if (rowIndex != null) virtualizer.scrollToIndex(rowIndex, { align: "auto" });
|
|
938
|
-
}
|
|
939
|
-
},
|
|
940
|
-
onStateChange({ type, selectedItem: newSelectedItem, inputValue: newInputValue }) {
|
|
941
|
-
switch (type) {
|
|
942
|
-
case downshift.useCombobox.stateChangeTypes.InputChange:
|
|
943
|
-
setInputValue(newInputValue || "");
|
|
944
|
-
onInputChange?.(newInputValue || "");
|
|
945
|
-
break;
|
|
946
|
-
case downshift.useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
947
|
-
case downshift.useCombobox.stateChangeTypes.ItemClick:
|
|
948
|
-
if (newSelectedItem && newSelectedItem.value === SELECT_ALL_VALUE) {
|
|
949
|
-
handleSelectAllToggle();
|
|
950
|
-
break;
|
|
951
|
-
}
|
|
952
|
-
if (newSelectedItem) if (values.includes(newSelectedItem.value)) removeSelectedItem(newSelectedItem);
|
|
953
|
-
else addSelectedItem(newSelectedItem);
|
|
954
|
-
break;
|
|
955
|
-
default: break;
|
|
956
|
-
}
|
|
957
|
-
},
|
|
958
|
-
stateReducer(state, actionAndChanges) {
|
|
959
|
-
const { type, changes } = actionAndChanges;
|
|
960
|
-
switch (type) {
|
|
961
|
-
case downshift.useCombobox.stateChangeTypes.ItemClick:
|
|
962
|
-
case downshift.useCombobox.stateChangeTypes.InputKeyDownEnter: return {
|
|
963
|
-
...changes,
|
|
964
|
-
isOpen: true,
|
|
965
|
-
inputValue: "",
|
|
966
|
-
highlightedIndex: state.highlightedIndex
|
|
967
|
-
};
|
|
968
|
-
case downshift.useCombobox.stateChangeTypes.InputBlur:
|
|
969
|
-
if (state.isOpen) return {
|
|
970
|
-
...changes,
|
|
971
|
-
isOpen: true
|
|
972
|
-
};
|
|
973
|
-
return changes;
|
|
974
|
-
case downshift.useCombobox.stateChangeTypes.InputClick:
|
|
975
|
-
case downshift.useCombobox.stateChangeTypes.ToggleButtonClick: return changes;
|
|
976
|
-
default: return changes;
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
});
|
|
980
|
-
const renderOption = (0, react.useCallback)((option, currentIndex) => {
|
|
981
|
-
const isHighlighted = highlightedIndex === currentIndex;
|
|
982
|
-
const isSelected = values.includes(option.value);
|
|
983
|
-
if (option.value === SELECT_ALL_VALUE) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMenuItem$1, {
|
|
984
|
-
...getItemProps({
|
|
985
|
-
item: option,
|
|
986
|
-
index: currentIndex
|
|
987
|
-
}),
|
|
988
|
-
focused: isHighlighted,
|
|
989
|
-
selected: false,
|
|
990
|
-
"aria-labelledby": `combobox-option-label-${currentIndex}`,
|
|
991
|
-
$size: size,
|
|
992
|
-
tabIndex: -1,
|
|
993
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
994
|
-
direction: "horizontal",
|
|
995
|
-
align: "center",
|
|
996
|
-
spacing: _persona_design_tokens.Spacing[2],
|
|
997
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Checkbox, {
|
|
998
|
-
checked: selectedState.allSelected,
|
|
999
|
-
indeterminate: selectedState.indeterminate,
|
|
1000
|
-
tabIndex: -1
|
|
1001
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckboxLabel, {
|
|
1002
|
-
id: `combobox-option-label-${currentIndex}`,
|
|
1003
|
-
$size: size,
|
|
1004
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionLabel, { children: option.label })
|
|
1005
|
-
})]
|
|
1006
|
-
})
|
|
1007
|
-
}, "select-all");
|
|
1008
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMenuItem$1, {
|
|
1009
|
-
...getItemProps({
|
|
1010
|
-
item: option,
|
|
1011
|
-
index: currentIndex,
|
|
1012
|
-
"aria-selected": isSelected
|
|
1013
|
-
}),
|
|
1014
|
-
focused: isHighlighted,
|
|
1015
|
-
selected: false,
|
|
1016
|
-
"aria-labelledby": `combobox-option-label-${currentIndex}`,
|
|
1017
|
-
$size: size,
|
|
1018
|
-
tabIndex: -1,
|
|
1019
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
1020
|
-
direction: "horizontal",
|
|
1021
|
-
align: "center",
|
|
1022
|
-
spacing: _persona_design_tokens.Spacing[2],
|
|
1023
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Checkbox, {
|
|
1024
|
-
checked: isSelected,
|
|
1025
|
-
tabIndex: -1
|
|
1026
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckboxLabel, {
|
|
1027
|
-
id: `combobox-option-label-${currentIndex}`,
|
|
1028
|
-
$size: size,
|
|
1029
|
-
children: option.labelStickerVariant ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Sticker.Sticker, {
|
|
1030
|
-
variant: option.labelStickerVariant,
|
|
1031
|
-
children: option.label
|
|
1032
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionLabel, {
|
|
1033
|
-
title: option.label,
|
|
1034
|
-
$labelStyle: option.PLEASE_DO_NOT_USE_labelFontStyle,
|
|
1035
|
-
children: option.label
|
|
1036
|
-
}), option.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Description, {
|
|
1037
|
-
title: option.description,
|
|
1038
|
-
children: option.description
|
|
1039
|
-
})] })
|
|
1040
|
-
})]
|
|
1041
|
-
})
|
|
1042
|
-
}, `${option.value}-${currentIndex}`);
|
|
1043
|
-
}, [
|
|
1044
|
-
highlightedIndex,
|
|
1045
|
-
values,
|
|
1046
|
-
getItemProps,
|
|
1047
|
-
size,
|
|
1048
|
-
selectedState
|
|
1049
|
-
]);
|
|
1050
|
-
const isMenuOpen = isOpen;
|
|
1051
|
-
const { isFooterHighlighted, footerActionId, showFooterAction, handleFooterKeyDown, clearFooterHighlight } = useComboboxFooterAction({
|
|
1052
|
-
footerAction,
|
|
1053
|
-
isOptionsLoading,
|
|
1054
|
-
itemCount: navigableItems.length,
|
|
1055
|
-
isMenuOpen,
|
|
1056
|
-
inputValue,
|
|
1057
|
-
highlightedIndex,
|
|
1058
|
-
setHighlightedIndex,
|
|
1059
|
-
inputId: field.inputId
|
|
1060
|
-
});
|
|
1061
|
-
const handleKeyDown = (0, react.useCallback)((event) => {
|
|
1062
|
-
if (event.key === "Enter" && !isMenuOpen) openMenu();
|
|
1063
|
-
}, [isMenuOpen, openMenu]);
|
|
1064
|
-
const dropdownPosition = useDropdownPosition(portalContainerRef, isMenuOpen, embedded ? false : portal);
|
|
1065
|
-
(0, react.useEffect)(() => {
|
|
1066
|
-
onOpenChange?.(isMenuOpen);
|
|
1067
|
-
}, [isMenuOpen, onOpenChange]);
|
|
1068
|
-
(0, react.useEffect)(() => {
|
|
1069
|
-
if (isMenuOpen && navigableItems.length > 0 && !isFooterHighlighted) {
|
|
1070
|
-
if (highlightedIndex === -1 || highlightedIndex >= navigableItems.length) setHighlightedIndex(0);
|
|
1071
|
-
}
|
|
1072
|
-
}, [
|
|
1073
|
-
navigableItems,
|
|
1074
|
-
isMenuOpen,
|
|
1075
|
-
highlightedIndex,
|
|
1076
|
-
isFooterHighlighted,
|
|
1077
|
-
setHighlightedIndex
|
|
1078
|
-
]);
|
|
1079
|
-
const searchInputId = `${field.inputId}-search`;
|
|
1080
|
-
(0, react.useEffect)(() => {
|
|
1081
|
-
if (isMenuOpen && searchInputRef.current) searchInputRef.current.focus();
|
|
1082
|
-
}, [isMenuOpen]);
|
|
1083
|
-
const handleSearchInputKeyDown = (0, react.useCallback)((e) => {
|
|
1084
|
-
if (handleFooterKeyDown(e)) return;
|
|
1085
|
-
if (e.key === "ArrowDown" && navigableItems.length > 0) {
|
|
1086
|
-
e.preventDefault();
|
|
1087
|
-
setHighlightedIndex(highlightedIndex === -1 ? 0 : (highlightedIndex + 1) % navigableItems.length);
|
|
1088
|
-
}
|
|
1089
|
-
if (e.key === "ArrowUp" && navigableItems.length > 0) {
|
|
1090
|
-
e.preventDefault();
|
|
1091
|
-
setHighlightedIndex(highlightedIndex === -1 ? navigableItems.length - 1 : (highlightedIndex - 1 + navigableItems.length) % navigableItems.length);
|
|
1092
|
-
}
|
|
1093
|
-
if (e.key === "Enter" && highlightedIndex >= 0 && navigableItems[highlightedIndex]) {
|
|
1094
|
-
e.preventDefault();
|
|
1095
|
-
const selectedItem = navigableItems[highlightedIndex];
|
|
1096
|
-
if (selectedItem.value === SELECT_ALL_VALUE) {
|
|
1097
|
-
handleSelectAllToggle();
|
|
1098
|
-
return;
|
|
1099
|
-
}
|
|
1100
|
-
if (values.includes(selectedItem.value)) removeSelectedItem(selectedItem);
|
|
1101
|
-
else addSelectedItem(selectedItem);
|
|
1102
|
-
}
|
|
1103
|
-
if (e.key === "Escape") {
|
|
1104
|
-
clearFooterHighlight();
|
|
1105
|
-
closeMenu();
|
|
1106
|
-
if (comboboxInputRef.current) comboboxInputRef.current.focus();
|
|
1107
|
-
}
|
|
1108
|
-
if (e.key === "Tab") {
|
|
1109
|
-
if (isFooterHighlighted) {
|
|
1110
|
-
clearFooterHighlight();
|
|
1111
|
-
closeMenu();
|
|
1112
|
-
} else if (highlightedIndex >= 0 && navigableItems[highlightedIndex]) closeMenu();
|
|
1113
|
-
}
|
|
1114
|
-
}, [
|
|
1115
|
-
navigableItems,
|
|
1116
|
-
highlightedIndex,
|
|
1117
|
-
setHighlightedIndex,
|
|
1118
|
-
handleFooterKeyDown,
|
|
1119
|
-
isFooterHighlighted,
|
|
1120
|
-
clearFooterHighlight,
|
|
1121
|
-
values,
|
|
1122
|
-
addSelectedItem,
|
|
1123
|
-
removeSelectedItem,
|
|
1124
|
-
closeMenu,
|
|
1125
|
-
comboboxInputRef,
|
|
1126
|
-
handleSelectAllToggle
|
|
1127
|
-
]);
|
|
1128
|
-
require_lib_useOutsideClick.useOutsideClick({
|
|
1129
|
-
ref: comboboxContainerRef,
|
|
1130
|
-
onOutsideClick: (0, react.useCallback)((e) => {
|
|
1131
|
-
if (!embedded && isMenuOpen && !e.target?.closest("#combobox-dropdown-portal-wrapper")) closeMenu();
|
|
1132
|
-
}, [
|
|
1133
|
-
embedded,
|
|
1134
|
-
isMenuOpen,
|
|
1135
|
-
closeMenu
|
|
1136
|
-
])
|
|
1137
|
-
});
|
|
1138
|
-
const externalTrigger = (() => {
|
|
1139
|
-
if (embedded || trigger == null || !(0, react.isValidElement)(trigger)) return null;
|
|
1140
|
-
const triggerProps = trigger.props;
|
|
1141
|
-
return (0, react.cloneElement)(trigger, getToggleButtonProps({
|
|
1142
|
-
...triggerProps,
|
|
1143
|
-
disabled: field.disabled || Boolean(triggerProps.disabled)
|
|
1144
|
-
}));
|
|
1145
|
-
})();
|
|
1146
|
-
const handleSearchInputBlur = (0, react.useCallback)((e) => {
|
|
1147
|
-
if (!isMenuOpen) return;
|
|
1148
|
-
const relatedTarget = e.relatedTarget;
|
|
1149
|
-
const staysInCombobox = relatedTarget != null && (Boolean(comboboxContainerRef.current?.contains(relatedTarget)) || Boolean(relatedTarget.closest("#combobox-dropdown-portal-wrapper")));
|
|
1150
|
-
if (!embedded && !staysInCombobox) closeMenu();
|
|
1151
|
-
}, [
|
|
1152
|
-
embedded,
|
|
1153
|
-
isMenuOpen,
|
|
1154
|
-
closeMenu
|
|
1155
|
-
]);
|
|
1156
|
-
const searchInputAriaLabel = embedded ? "Search options" : ariaLabel ?? searchPlaceholder;
|
|
1157
|
-
const searchInputDownshiftProps = embedded ? getInputProps(getDropdownProps({
|
|
1158
|
-
ref: searchInputRef,
|
|
1159
|
-
id: searchInputId,
|
|
1160
|
-
"aria-label": searchInputAriaLabel
|
|
1161
|
-
})) : {
|
|
1162
|
-
ref: searchInputRef,
|
|
1163
|
-
id: searchInputId
|
|
1164
|
-
};
|
|
1165
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Container, {
|
|
1166
|
-
...props,
|
|
1167
|
-
ref: comboboxContainerRef,
|
|
1168
|
-
children: [embedded ? null : externalTrigger != null ? externalTrigger : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(InputContainer, { children: [
|
|
1169
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MultiSelectComboboxInput, {
|
|
1170
|
-
...getInputProps(getDropdownProps({
|
|
1171
|
-
...props,
|
|
1172
|
-
ref: comboboxInputRef,
|
|
1173
|
-
id: field.inputId,
|
|
1174
|
-
placeholder: selectedItems.length === 0 ? placeholder : "",
|
|
1175
|
-
disabled: field.disabled,
|
|
1176
|
-
"aria-label": ariaLabel,
|
|
1177
|
-
"aria-labelledby": labelId,
|
|
1178
|
-
"aria-describedby": [field.helperTextId, field.hasWarning ? field.warningTextId : null].filter(Boolean).join(" ") || void 0,
|
|
1179
|
-
"aria-errormessage": field.hasError ? field.errorTextId : void 0,
|
|
1180
|
-
"aria-invalid": field.hasError,
|
|
1181
|
-
preventKeyAction: isMenuOpen,
|
|
1182
|
-
onKeyDown: handleKeyDown
|
|
1183
|
-
})),
|
|
1184
|
-
size,
|
|
1185
|
-
$isOpen: isMenuOpen,
|
|
1186
|
-
hasWarning: field.hasWarning,
|
|
1187
|
-
hasError: field.hasError,
|
|
1188
|
-
value: ""
|
|
1189
|
-
}),
|
|
1190
|
-
truncate && selectedItems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HiddenMeasurementContainer, {
|
|
1191
|
-
"aria-hidden": "true",
|
|
1192
|
-
children: [selectedItems.map((item, index) => {
|
|
1193
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1194
|
-
ref: (el) => measurementStickerRefs.current[index] = el,
|
|
1195
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Sticker.Sticker, {
|
|
1196
|
-
variant: flatOptions.find((opt) => opt.value === item.value)?.labelStickerVariant || "grey",
|
|
1197
|
-
disabled: field.disabled,
|
|
1198
|
-
children: item.label
|
|
1199
|
-
})
|
|
1200
|
-
}, `measurement-${item.value}-${index}`);
|
|
1201
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1202
|
-
ref: measurementTruncatorRef,
|
|
1203
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TruncatorSticker, {
|
|
1204
|
-
variant: "grey",
|
|
1205
|
-
disabled: field.disabled,
|
|
1206
|
-
children: ["+", selectedItems.length - visibleCount]
|
|
1207
|
-
})
|
|
1208
|
-
})]
|
|
1209
|
-
}),
|
|
1210
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectedItemsContainer, {
|
|
1211
|
-
$size: size,
|
|
1212
|
-
$truncate: truncate,
|
|
1213
|
-
ref: selectedItemsContainerRef,
|
|
1214
|
-
children: truncate ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TruncatedItemsWrapper, { children: [selectedItems.slice(0, visibleCount).map((item, index) => {
|
|
1215
|
-
const { ref: _ref, ...stickerProps } = getSelectedItemProps({
|
|
1216
|
-
selectedItem: item,
|
|
1217
|
-
index
|
|
1218
|
-
});
|
|
1219
|
-
const stickerVariant = flatOptions.find((opt) => opt.value === item.value)?.labelStickerVariant || "grey";
|
|
1220
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TruncatedSticker, {
|
|
1221
|
-
...stickerProps,
|
|
1222
|
-
variant: stickerVariant,
|
|
1223
|
-
disabled: field.disabled,
|
|
1224
|
-
$isOnlyItem: visibleCount === 1,
|
|
1225
|
-
children: item.label
|
|
1226
|
-
}, `selected-${item.value}-${index}`);
|
|
1227
|
-
}), visibleCount < selectedItems.length && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TruncatorSticker, {
|
|
1228
|
-
variant: "grey",
|
|
1229
|
-
disabled: field.disabled,
|
|
1230
|
-
children: ["+", selectedItems.length - visibleCount]
|
|
1231
|
-
})] }) : selectedItems.map((item, index) => {
|
|
1232
|
-
const { ref, ...stickerProps } = getSelectedItemProps({
|
|
1233
|
-
selectedItem: item,
|
|
1234
|
-
index
|
|
1235
|
-
});
|
|
1236
|
-
const stickerVariant = flatOptions.find((opt) => opt.value === item.value)?.labelStickerVariant || "grey";
|
|
1237
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Sticker.Sticker, {
|
|
1238
|
-
...stickerProps,
|
|
1239
|
-
variant: stickerVariant,
|
|
1240
|
-
onDismiss: (e) => {
|
|
1241
|
-
e.stopPropagation();
|
|
1242
|
-
removeSelectedItem(item);
|
|
1243
|
-
},
|
|
1244
|
-
dismissButtonProps: { tabIndex: -1 },
|
|
1245
|
-
disabled: field.disabled,
|
|
1246
|
-
tabIndex: -1,
|
|
1247
|
-
children: item.label
|
|
1248
|
-
}, `selected-${item.value}-${index}`);
|
|
1249
|
-
})
|
|
1250
|
-
}),
|
|
1251
|
-
selectedItems.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CaretButton, {
|
|
1252
|
-
id: `${field.inputId}__clear-all`,
|
|
1253
|
-
onClick: reset,
|
|
1254
|
-
size,
|
|
1255
|
-
disabled: field.disabled,
|
|
1256
|
-
"aria-label": "Clear all selected items",
|
|
1257
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.CircleXInverseIcon, {})
|
|
1258
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CaretButton, {
|
|
1259
|
-
...getToggleButtonProps({ ref: caretButtonRef }),
|
|
1260
|
-
size,
|
|
1261
|
-
disabled: field.disabled,
|
|
1262
|
-
"aria-label": `${isMenuOpen ? "Close" : "Open"} options menu`,
|
|
1263
|
-
"aria-haspopup": "listbox",
|
|
1264
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.CaretDownIcon, {})
|
|
1265
|
-
})
|
|
1266
|
-
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownPortalWrapper, {
|
|
1267
|
-
portal: embedded ? false : portal,
|
|
1268
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownContainer, {
|
|
1269
|
-
$isOpen: isMenuOpen,
|
|
1270
|
-
$portal: embedded ? false : portal,
|
|
1271
|
-
$embedded: embedded,
|
|
1272
|
-
$top: dropdownPosition.top,
|
|
1273
|
-
$left: dropdownPosition.left,
|
|
1274
|
-
$width: dropdownPosition.width,
|
|
1275
|
-
$minWidth: externalTrigger ? EXTERNAL_TRIGGER_DROPDOWN_MIN_WIDTH$1 : void 0,
|
|
1276
|
-
...getMenuProps(),
|
|
1277
|
-
"aria-multiselectable": "true",
|
|
1278
|
-
children: [isMenuOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInputContainer, {
|
|
1279
|
-
$embedded: embedded,
|
|
1280
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input.InputGroup, {
|
|
1281
|
-
leftIcon: embedded ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.SearchIcon, {}),
|
|
1282
|
-
size,
|
|
1283
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
|
|
1284
|
-
...searchInputDownshiftProps,
|
|
1285
|
-
$embedded: embedded,
|
|
1286
|
-
placeholder: searchPlaceholder,
|
|
1287
|
-
value: inputValue,
|
|
1288
|
-
onChange: (e) => {
|
|
1289
|
-
setInputValue(e.target.value);
|
|
1290
|
-
onInputChange?.(e.target.value);
|
|
1291
|
-
},
|
|
1292
|
-
onKeyDown: handleSearchInputKeyDown,
|
|
1293
|
-
onBlur: handleSearchInputBlur,
|
|
1294
|
-
disabled: field.disabled,
|
|
1295
|
-
"aria-label": searchInputAriaLabel,
|
|
1296
|
-
"aria-activedescendant": isFooterHighlighted ? footerActionId : highlightedIndex >= 0 ? getOptionId(highlightedIndex) : void 0,
|
|
1297
|
-
size
|
|
1298
|
-
})
|
|
1299
|
-
})
|
|
1300
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MultiSelectScrollableMenuList, {
|
|
1301
|
-
$embedded: embedded,
|
|
1302
|
-
tabIndex: -1,
|
|
1303
|
-
ref: scrollableListRef,
|
|
1304
|
-
children: isMenuOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(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({
|
|
1305
|
-
options: optionsToRender,
|
|
1306
|
-
filteredOptions: navigableItems,
|
|
1307
|
-
renderOption,
|
|
1308
|
-
virtualizer: virtualize ? virtualizer : void 0,
|
|
1309
|
-
virtualRows: virtualize ? virtualRows : void 0
|
|
1310
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmptyState, {
|
|
1311
|
-
role: "status",
|
|
1312
|
-
"aria-live": "polite",
|
|
1313
|
-
size,
|
|
1314
|
-
children: emptyStateMessage
|
|
1315
|
-
}), showFooterAction && footerAction && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FooterActionRow, {
|
|
1316
|
-
action: footerAction,
|
|
1317
|
-
size,
|
|
1318
|
-
id: footerActionId,
|
|
1319
|
-
isHighlighted: isFooterHighlighted
|
|
1320
|
-
})] })
|
|
1321
|
-
})]
|
|
1322
|
-
})
|
|
1323
|
-
})]
|
|
1324
|
-
});
|
|
1325
|
-
}
|
|
1326
|
-
const ComboboxMultiSelect = (0, react.forwardRef)(ComboboxMultiSelectComponent);
|
|
1327
|
-
//#endregion
|
|
1328
|
-
//#region components/Combobox/ComboboxSingleSelect.tsx
|
|
1329
|
-
const StyledMenuItem = (0, styled_components.default)(require_Menu.MenuItem)`
|
|
1330
|
-
display: flex;
|
|
1331
|
-
flex-direction: column;
|
|
1332
|
-
align-items: flex-start;
|
|
1333
|
-
gap: ${_persona_design_tokens.Spacing[1]};
|
|
1334
|
-
min-width: 0; /* Allow content to shrink below natural size */
|
|
1335
|
-
width: 100%; /* Ensure full width of dropdown */
|
|
1336
|
-
box-sizing: border-box;
|
|
1337
|
-
|
|
1338
|
-
/* Force all children to respect the container width */
|
|
1339
|
-
> * {
|
|
1340
|
-
width: 100%;
|
|
1341
|
-
min-width: 0;
|
|
1342
|
-
box-sizing: border-box;
|
|
1343
|
-
}
|
|
1344
|
-
`;
|
|
1345
|
-
const ParentMenuItem = (0, styled_components.default)(require_Menu.MenuItem)`
|
|
1346
|
-
${require_Menu.IconContainer} {
|
|
1347
|
-
margin-right: 0;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
> ${require_Menu.IconContainer}:first-child:not(:last-child) {
|
|
1351
|
-
margin-right: ${_persona_design_tokens.Spacing[2]};
|
|
1352
|
-
}
|
|
1353
|
-
`;
|
|
1354
|
-
const ParentChevron = styled_components.default.span`
|
|
1355
|
-
display: inline-flex;
|
|
1356
|
-
align-items: center;
|
|
1357
|
-
color: ${_persona_design_tokens.Color.BorderIconSecondary};
|
|
1358
|
-
`;
|
|
1359
|
-
const EXTERNAL_TRIGGER_DROPDOWN_MIN_WIDTH = "240px";
|
|
1360
|
-
const SingleSelectScrollableMenuList = (0, styled_components.default)(ScrollableMenuList)`
|
|
1361
|
-
${({ $embedded }) => $embedded && styled_components.css`
|
|
1362
|
-
padding: 0;
|
|
1363
|
-
`}
|
|
1364
|
-
`;
|
|
1365
|
-
const BackRow = styled_components.default.button`
|
|
1366
|
-
display: flex;
|
|
1367
|
-
align-items: center;
|
|
1368
|
-
gap: ${({ $size }) => $size === "sm" ? _persona_design_tokens.Spacing[1] : _persona_design_tokens.Spacing[2]};
|
|
1369
|
-
width: 100%;
|
|
1370
|
-
padding: ${({ $size }) => $size === "sm" ? `${_persona_design_tokens.Spacing[1]} ${_persona_design_tokens.Spacing[2]}` : _persona_design_tokens.Spacing[2]};
|
|
1371
|
-
background: transparent;
|
|
1372
|
-
border: 0;
|
|
1373
|
-
cursor: pointer;
|
|
1374
|
-
color: ${_persona_design_tokens.Color.TextPrimary};
|
|
1375
|
-
${({ $size }) => $size === "sm" ? _persona_design_tokens.Typography.TextSmall : _persona_design_tokens.Typography.TextMedium};
|
|
1376
|
-
|
|
1377
|
-
svg {
|
|
1378
|
-
color: ${_persona_design_tokens.Color.BorderIconPrimary};
|
|
1379
|
-
}
|
|
1380
|
-
`;
|
|
1381
|
-
const StickerDisplay = (0, styled_components.default)(require_Sticker.Sticker)`
|
|
1382
|
-
position: absolute;
|
|
1383
|
-
left: ${_persona_design_tokens.Spacing[2]};
|
|
1384
|
-
top: 50%;
|
|
1385
|
-
transform: translateY(-50%);
|
|
1386
|
-
pointer-events: none;
|
|
1387
|
-
z-index: 1;
|
|
1388
|
-
`;
|
|
1389
|
-
const StickerComboboxInput = (0, styled_components.default)(ComboboxInput)`
|
|
1390
|
-
/* Hide text when sticker is shown */
|
|
1391
|
-
color: transparent;
|
|
1392
|
-
caret-color: transparent;
|
|
1393
|
-
`;
|
|
1394
|
-
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, footerAction, ...props }, ref) {
|
|
1395
|
-
const field = require_useFormField.useFormField({
|
|
1396
|
-
hasWarning,
|
|
1397
|
-
hasError,
|
|
1398
|
-
disabled,
|
|
1399
|
-
inputId: id
|
|
1400
|
-
});
|
|
1401
|
-
const [inputValue, setInputValue] = (0, react.useState)("");
|
|
1402
|
-
const [isDropdownOpen, setIsDropdownOpen] = (0, react.useState)(embedded);
|
|
1403
|
-
const [navigationPath, setNavigationPath] = (0, react.useState)([]);
|
|
1404
|
-
const comboboxInputRef = (0, react.useRef)(null);
|
|
1405
|
-
const internalContainerRef = (0, react.useRef)(null);
|
|
1406
|
-
const pendingDescentRef = (0, react.useRef)(null);
|
|
1407
|
-
const portalContainerRef = externalPortalContainerRef || internalContainerRef;
|
|
1408
|
-
(0, react.useImperativeHandle)(ref, () => ({ ...comboboxInputRef.current }), []);
|
|
1409
|
-
const isSearching = inputValue.trim() !== "";
|
|
1410
|
-
const nestedOptions = (0, react.useMemo)(() => getOptionsAtPath(options, navigationPath), [options, navigationPath]);
|
|
1411
|
-
const hasNestedGroups = (0, react.useMemo)(() => containsNestedGroup(options), [options]);
|
|
1412
|
-
const navigableItems = (0, react.useMemo)(() => getNavigableItemsAtLevel(nestedOptions), [nestedOptions]);
|
|
1413
|
-
const searchableLeaves = (0, react.useMemo)(() => {
|
|
1414
|
-
if (!isSearching || !hasNestedGroups) return [];
|
|
1415
|
-
return flattenLeafOptions(options).map(({ option }) => option);
|
|
1416
|
-
}, [
|
|
1417
|
-
options,
|
|
1418
|
-
isSearching,
|
|
1419
|
-
hasNestedGroups
|
|
1420
|
-
]);
|
|
1421
|
-
const searchableLeafFuse = (0, react.useMemo)(() => {
|
|
1422
|
-
if (!isSearching || !hasNestedGroups) return null;
|
|
1423
|
-
return new fuse_js.default(flattenLeafOptions(options).map(({ option, breadcrumb }) => ({
|
|
1424
|
-
option,
|
|
1425
|
-
label: String(option.label),
|
|
1426
|
-
description: option.description,
|
|
1427
|
-
ancestors: breadcrumb.join(" ")
|
|
1428
|
-
})), {
|
|
1429
|
-
shouldSort: false,
|
|
1430
|
-
threshold: 0,
|
|
1431
|
-
ignoreLocation: true,
|
|
1432
|
-
minMatchCharLength: 1,
|
|
1433
|
-
keys: [
|
|
1434
|
-
"label",
|
|
1435
|
-
"description",
|
|
1436
|
-
"ancestors"
|
|
1437
|
-
]
|
|
1438
|
-
});
|
|
1439
|
-
}, [
|
|
1440
|
-
options,
|
|
1441
|
-
isSearching,
|
|
1442
|
-
hasNestedGroups
|
|
1443
|
-
]);
|
|
1444
|
-
const renderSource = isSearching ? hasNestedGroups ? searchableLeaves : options : nestedOptions;
|
|
1445
|
-
const standardFilteredOptions = useFilteredOptions(renderSource, inputValue);
|
|
1446
|
-
const filteredOptions = (0, react.useMemo)(() => {
|
|
1447
|
-
if (!isSearching || !hasNestedGroups || searchableLeafFuse == null) return standardFilteredOptions;
|
|
1448
|
-
if (inputValue === "") return searchableLeaves;
|
|
1449
|
-
return Array.from(new Set(searchableLeafFuse.search(inputValue).map(({ item }) => item.option)).values());
|
|
1450
|
-
}, [
|
|
1451
|
-
isSearching,
|
|
1452
|
-
hasNestedGroups,
|
|
1453
|
-
searchableLeafFuse,
|
|
1454
|
-
inputValue,
|
|
1455
|
-
searchableLeaves,
|
|
1456
|
-
standardFilteredOptions
|
|
1457
|
-
]);
|
|
1458
|
-
const downshiftItems = (0, react.useMemo)(() => {
|
|
1459
|
-
if (isSearching) return filteredOptions.map((option) => ({
|
|
1460
|
-
kind: "leaf",
|
|
1461
|
-
option
|
|
1462
|
-
}));
|
|
1463
|
-
return navigableItems.filter((item) => item.kind === "group" || filteredOptions.some((f) => f.value === item.option.value));
|
|
1464
|
-
}, [
|
|
1465
|
-
isSearching,
|
|
1466
|
-
filteredOptions,
|
|
1467
|
-
navigableItems
|
|
1468
|
-
]);
|
|
1469
|
-
const allLeaves = (0, react.useMemo)(() => flattenLeafOptions(options), [options]);
|
|
1470
|
-
const flatOptionsForFallback = (0, react.useMemo)(() => flattenOptions(options), [options]);
|
|
1471
|
-
const selectedOption = allLeaves.find(({ option }) => option.value === value)?.option ?? flatOptionsForFallback.find((option) => option.value === value) ?? null;
|
|
1472
|
-
const selectedNavigableItem = (0, react.useMemo)(() => selectedOption ? {
|
|
1473
|
-
kind: "leaf",
|
|
1474
|
-
option: selectedOption
|
|
1475
|
-
} : null, [selectedOption?.value, selectedOption?.label]);
|
|
1476
|
-
const itemToString = (0, react.useCallback)((item) => {
|
|
1477
|
-
if (!item) return "";
|
|
1478
|
-
return item.kind === "leaf" ? item.option.label : item.group.label;
|
|
1479
|
-
}, []);
|
|
1480
|
-
const handleAscend = (0, react.useCallback)(() => {
|
|
1481
|
-
setNavigationPath((prev) => prev.length > 0 ? prev.slice(0, -1) : prev);
|
|
1482
|
-
setInputValue("");
|
|
1483
|
-
}, []);
|
|
1484
|
-
const handleDescend = (0, react.useCallback)((groupLabel) => {
|
|
1485
|
-
setNavigationPath((prev) => [...prev, groupLabel]);
|
|
1486
|
-
setInputValue("");
|
|
1487
|
-
}, []);
|
|
1488
|
-
const { isOpen, getToggleButtonProps, getMenuProps, getInputProps, getItemProps, highlightedIndex, setHighlightedIndex, openMenu } = (0, downshift.useCombobox)({
|
|
1489
|
-
items: downshiftItems,
|
|
1490
|
-
itemToString,
|
|
1491
|
-
isOpen: embedded ? true : void 0,
|
|
1492
|
-
selectedItem: isDropdownOpen ? null : selectedNavigableItem,
|
|
1493
|
-
inputValue,
|
|
1494
|
-
onInputValueChange({ inputValue: newInputValue }) {
|
|
1495
|
-
if (newInputValue === "" && !embedded && trigger == null) onChange?.(null);
|
|
1496
|
-
setInputValue(newInputValue || "");
|
|
1497
|
-
onInputChange?.(newInputValue || "");
|
|
1498
|
-
},
|
|
1499
|
-
onIsOpenChange({ isOpen: newIsOpen }) {
|
|
1500
|
-
if (embedded) return;
|
|
1501
|
-
setIsDropdownOpen(newIsOpen);
|
|
1502
|
-
if (newIsOpen) {
|
|
1503
|
-
if (selectedOption || value && inputValue === flatOptionsForFallback.find((opt) => opt.value === value)?.label) setInputValue("");
|
|
1504
|
-
} else setInputValue(selectedOption?.label || "");
|
|
1505
|
-
},
|
|
1506
|
-
onSelectedItemChange: ({ selectedItem: newSelectedItem }) => {
|
|
1507
|
-
if (newSelectedItem == null || newSelectedItem.kind !== "leaf") return;
|
|
1508
|
-
const leaf = newSelectedItem.option;
|
|
1509
|
-
onChange?.(leaf.value);
|
|
1510
|
-
setInputValue(leaf.label);
|
|
1511
|
-
},
|
|
1512
|
-
stateReducer(state, actionAndChanges) {
|
|
1513
|
-
const { changes, type } = actionAndChanges;
|
|
1514
|
-
switch (type) {
|
|
1515
|
-
case downshift.useCombobox.stateChangeTypes.InputBlur: return {
|
|
1516
|
-
...changes,
|
|
1517
|
-
selectedItem: state.selectedItem
|
|
1518
|
-
};
|
|
1519
|
-
case downshift.useCombobox.stateChangeTypes.ItemClick:
|
|
1520
|
-
case downshift.useCombobox.stateChangeTypes.InputKeyDownEnter: {
|
|
1521
|
-
const candidate = changes.selectedItem;
|
|
1522
|
-
if (candidate && candidate.kind === "group") {
|
|
1523
|
-
pendingDescentRef.current = candidate.group.label;
|
|
1524
|
-
return {
|
|
1525
|
-
...changes,
|
|
1526
|
-
selectedItem: state.selectedItem,
|
|
1527
|
-
isOpen: true
|
|
1528
|
-
};
|
|
1529
|
-
}
|
|
1530
|
-
return changes;
|
|
1531
|
-
}
|
|
1532
|
-
default: return changes;
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
});
|
|
1536
|
-
(0, react.useEffect)(() => {
|
|
1537
|
-
if (pendingDescentRef.current != null) {
|
|
1538
|
-
const target = pendingDescentRef.current;
|
|
1539
|
-
pendingDescentRef.current = null;
|
|
1540
|
-
handleDescend(target);
|
|
1541
|
-
}
|
|
1542
|
-
});
|
|
1543
|
-
(0, react.useEffect)(() => {
|
|
1544
|
-
if (!isOpen && !embedded && navigationPath.length > 0) setNavigationPath([]);
|
|
1545
|
-
}, [
|
|
1546
|
-
embedded,
|
|
1547
|
-
isOpen,
|
|
1548
|
-
navigationPath.length
|
|
1549
|
-
]);
|
|
1550
|
-
const renderLeaf = (0, react.useCallback)((option, currentIndex) => {
|
|
1551
|
-
const isHighlighted = highlightedIndex === currentIndex;
|
|
1552
|
-
const isSelected = selectedOption?.value === option.value;
|
|
1553
|
-
const itemProps = getItemProps({
|
|
1554
|
-
item: {
|
|
1555
|
-
kind: "leaf",
|
|
1556
|
-
option
|
|
1557
|
-
},
|
|
1558
|
-
index: currentIndex,
|
|
1559
|
-
"aria-selected": isSelected
|
|
1560
|
-
});
|
|
1561
|
-
const labelContent = option.labelStickerVariant ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Sticker.Sticker, {
|
|
1562
|
-
variant: option.labelStickerVariant,
|
|
1563
|
-
children: option.label
|
|
1564
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionLabel, {
|
|
1565
|
-
title: option.label,
|
|
1566
|
-
$labelStyle: option.PLEASE_DO_NOT_USE_labelFontStyle,
|
|
1567
|
-
children: option.label
|
|
1568
|
-
}), option.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Description, {
|
|
1569
|
-
title: option.description,
|
|
1570
|
-
children: option.description
|
|
1571
|
-
})] });
|
|
1572
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMenuItem, {
|
|
1573
|
-
...itemProps,
|
|
1574
|
-
focused: isHighlighted,
|
|
1575
|
-
selected: isSelected,
|
|
1576
|
-
size,
|
|
1577
|
-
tabIndex: -1,
|
|
1578
|
-
children: labelContent
|
|
1579
|
-
}, `leaf-${String(option.value)}-${currentIndex}`);
|
|
1580
|
-
}, [
|
|
1581
|
-
highlightedIndex,
|
|
1582
|
-
selectedOption,
|
|
1583
|
-
getItemProps,
|
|
1584
|
-
size
|
|
1585
|
-
]);
|
|
1586
|
-
const renderNestedGroupRow = (0, react.useCallback)((group, currentIndex) => {
|
|
1587
|
-
const isHighlighted = highlightedIndex === currentIndex;
|
|
1588
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ParentMenuItem, {
|
|
1589
|
-
...getItemProps({
|
|
1590
|
-
item: {
|
|
1591
|
-
kind: "group",
|
|
1592
|
-
group
|
|
1593
|
-
},
|
|
1594
|
-
index: currentIndex
|
|
1595
|
-
}),
|
|
1596
|
-
"aria-haspopup": "menu",
|
|
1597
|
-
focused: isHighlighted,
|
|
1598
|
-
prefixIcon: group.prefixIcon,
|
|
1599
|
-
size,
|
|
1600
|
-
tabIndex: -1,
|
|
1601
|
-
stretchLabel: true,
|
|
1602
|
-
suffixIcon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParentChevron, {
|
|
1603
|
-
"aria-hidden": "true",
|
|
1604
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.ChevronRightIcon, {})
|
|
1605
|
-
}),
|
|
1606
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionLabel, {
|
|
1607
|
-
title: group.label,
|
|
1608
|
-
children: group.label
|
|
1609
|
-
}), group.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Description, {
|
|
1610
|
-
title: group.description,
|
|
1611
|
-
children: group.description
|
|
1612
|
-
})]
|
|
1613
|
-
}, `group-${group.label}-${currentIndex}`);
|
|
1614
|
-
}, [
|
|
1615
|
-
highlightedIndex,
|
|
1616
|
-
getItemProps,
|
|
1617
|
-
size
|
|
1618
|
-
]);
|
|
1619
|
-
const renderNestedLevel = (0, react.useCallback)((items) => {
|
|
1620
|
-
let navIndex = -1;
|
|
1621
|
-
const walk = (node, key) => {
|
|
1622
|
-
if (isOptionGroup(node)) {
|
|
1623
|
-
if (node.nested) {
|
|
1624
|
-
if (!downshiftItems.some((i) => i.kind === "group" && i.group === node)) return null;
|
|
1625
|
-
navIndex++;
|
|
1626
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: renderNestedGroupRow(node, navIndex) }, key);
|
|
1627
|
-
}
|
|
1628
|
-
const childNodes = [];
|
|
1629
|
-
for (let i = 0; i < node.options.length; i++) {
|
|
1630
|
-
const rendered = walk(node.options[i], `${key}-${i}`);
|
|
1631
|
-
if (rendered != null) childNodes.push(rendered);
|
|
1632
|
-
}
|
|
1633
|
-
if (childNodes.length === 0) return null;
|
|
1634
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Menu.MenuHeading, { children: node.label }), childNodes] }, key);
|
|
1635
|
-
}
|
|
1636
|
-
if (!downshiftItems.some((i) => i.kind === "leaf" && i.option === node)) return null;
|
|
1637
|
-
navIndex++;
|
|
1638
|
-
return renderLeaf(node, navIndex);
|
|
1639
|
-
};
|
|
1640
|
-
return items.map((item, idx) => walk(item, `item-${idx}`));
|
|
1641
|
-
}, [
|
|
1642
|
-
downshiftItems,
|
|
1643
|
-
renderLeaf,
|
|
1644
|
-
renderNestedGroupRow
|
|
1645
|
-
]);
|
|
1646
|
-
const renderOption = (0, react.useCallback)((option, currentIndex) => renderLeaf(option, currentIndex), [renderLeaf]);
|
|
1647
|
-
const isMenuOpen = isOpen;
|
|
1648
|
-
const dropdownPosition = useDropdownPosition(portalContainerRef, isMenuOpen, embedded ? false : portal);
|
|
1649
|
-
const { isFooterHighlighted, footerActionId, showFooterAction, handleFooterKeyDown } = useComboboxFooterAction({
|
|
1650
|
-
footerAction,
|
|
1651
|
-
isOptionsLoading,
|
|
1652
|
-
itemCount: downshiftItems.length,
|
|
1653
|
-
isMenuOpen,
|
|
1654
|
-
inputValue,
|
|
1655
|
-
highlightedIndex,
|
|
1656
|
-
setHighlightedIndex,
|
|
1657
|
-
inputId: field.inputId
|
|
1658
|
-
});
|
|
1659
|
-
const handleKeyDown = (0, react.useCallback)((event) => {
|
|
1660
|
-
if (event.key === "Enter" && !isMenuOpen) {
|
|
1661
|
-
openMenu();
|
|
1662
|
-
return;
|
|
1663
|
-
}
|
|
1664
|
-
if (!isMenuOpen) return;
|
|
1665
|
-
if (handleFooterKeyDown(event)) return;
|
|
1666
|
-
if (isSearching) return;
|
|
1667
|
-
if (event.key === "ArrowRight") {
|
|
1668
|
-
const highlighted = downshiftItems[highlightedIndex];
|
|
1669
|
-
if (highlighted && highlighted.kind === "group") {
|
|
1670
|
-
event.preventDefault();
|
|
1671
|
-
handleDescend(highlighted.group.label);
|
|
1672
|
-
}
|
|
1673
|
-
return;
|
|
1674
|
-
}
|
|
1675
|
-
if (event.key === "ArrowLeft" && navigationPath.length > 0) {
|
|
1676
|
-
const input = event.currentTarget;
|
|
1677
|
-
if ((input.selectionStart ?? 0) === 0 && (input.selectionEnd ?? 0) === 0) {
|
|
1678
|
-
event.preventDefault();
|
|
1679
|
-
handleAscend();
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
}, [
|
|
1683
|
-
isMenuOpen,
|
|
1684
|
-
isSearching,
|
|
1685
|
-
handleFooterKeyDown,
|
|
1686
|
-
downshiftItems,
|
|
1687
|
-
highlightedIndex,
|
|
1688
|
-
navigationPath.length,
|
|
1689
|
-
openMenu,
|
|
1690
|
-
handleDescend,
|
|
1691
|
-
handleAscend
|
|
1692
|
-
]);
|
|
1693
|
-
(0, react.useEffect)(() => {
|
|
1694
|
-
onOpenChange?.(isMenuOpen);
|
|
1695
|
-
}, [isMenuOpen, onOpenChange]);
|
|
1696
|
-
(0, react.useEffect)(() => {
|
|
1697
|
-
if (!isMenuOpen) setInputValue(selectedOption?.label || "");
|
|
1698
|
-
}, [selectedOption, isMenuOpen]);
|
|
1699
|
-
(0, react.useEffect)(() => {
|
|
1700
|
-
if (isMenuOpen && downshiftItems.length > 0 && !isFooterHighlighted) {
|
|
1701
|
-
if (highlightedIndex === -1 || highlightedIndex >= downshiftItems.length) setHighlightedIndex(0);
|
|
1702
|
-
}
|
|
1703
|
-
}, [
|
|
1704
|
-
downshiftItems,
|
|
1705
|
-
isMenuOpen,
|
|
1706
|
-
highlightedIndex,
|
|
1707
|
-
isFooterHighlighted,
|
|
1708
|
-
setHighlightedIndex
|
|
1709
|
-
]);
|
|
1710
|
-
const displayValue = isMenuOpen ? inputValue : selectedOption?.label || "";
|
|
1711
|
-
const hasSticker = !isMenuOpen && selectedOption?.labelStickerVariant;
|
|
1712
|
-
const InputComponent = hasSticker ? StickerComboboxInput : ComboboxInput;
|
|
1713
|
-
const showBackRow = isMenuOpen && navigationPath.length > 0 && !isSearching;
|
|
1714
|
-
const externalTrigger = (() => {
|
|
1715
|
-
if (embedded || trigger == null || !(0, react.isValidElement)(trigger)) return null;
|
|
1716
|
-
const triggerProps = trigger.props;
|
|
1717
|
-
return (0, react.cloneElement)(trigger, getToggleButtonProps({
|
|
1718
|
-
...triggerProps,
|
|
1719
|
-
disabled: field.disabled || Boolean(triggerProps.disabled)
|
|
1720
|
-
}));
|
|
1721
|
-
})();
|
|
1722
|
-
const searchInputProps = getInputProps({
|
|
1723
|
-
ref: comboboxInputRef,
|
|
1724
|
-
id: field.inputId,
|
|
1725
|
-
placeholder: "Search…",
|
|
1726
|
-
disabled: field.disabled,
|
|
1727
|
-
"aria-label": embedded ? "Search options" : ariaLabel ?? "Search options",
|
|
1728
|
-
"aria-labelledby": embedded ? void 0 : labelId,
|
|
1729
|
-
"aria-describedby": [field.helperTextId, field.hasWarning ? field.warningTextId : null].filter(Boolean).join(" ") || void 0,
|
|
1730
|
-
"aria-errormessage": field.hasError ? field.errorTextId : void 0,
|
|
1731
|
-
"aria-invalid": field.hasError,
|
|
1732
|
-
onKeyDown: handleKeyDown
|
|
1733
|
-
});
|
|
1734
|
-
if (isFooterHighlighted) searchInputProps["aria-activedescendant"] = footerActionId;
|
|
1735
|
-
const mainInputProps = getInputProps({
|
|
1736
|
-
...props,
|
|
1737
|
-
ref: comboboxInputRef,
|
|
1738
|
-
id: field.inputId,
|
|
1739
|
-
placeholder,
|
|
1740
|
-
disabled: field.disabled,
|
|
1741
|
-
"aria-label": ariaLabel,
|
|
1742
|
-
"aria-labelledby": labelId,
|
|
1743
|
-
"aria-describedby": [field.helperTextId, field.hasWarning ? field.warningTextId : null].filter(Boolean).join(" ") || void 0,
|
|
1744
|
-
"aria-errormessage": field.hasError ? field.errorTextId : void 0,
|
|
1745
|
-
"aria-invalid": field.hasError,
|
|
1746
|
-
onKeyDown: handleKeyDown
|
|
1747
|
-
});
|
|
1748
|
-
if (isFooterHighlighted) mainInputProps["aria-activedescendant"] = footerActionId;
|
|
1749
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Container, {
|
|
1750
|
-
...props,
|
|
1751
|
-
ref: internalContainerRef,
|
|
1752
|
-
children: [embedded ? null : externalTrigger != null ? externalTrigger : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(InputContainer, { children: [
|
|
1753
|
-
hasSticker && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StickerDisplay, {
|
|
1754
|
-
variant: selectedOption.labelStickerVariant,
|
|
1755
|
-
children: selectedOption.label
|
|
1756
|
-
}),
|
|
1757
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InputComponent, {
|
|
1758
|
-
...mainInputProps,
|
|
1759
|
-
size,
|
|
1760
|
-
$isOpen: isMenuOpen,
|
|
1761
|
-
hasWarning: field.hasWarning,
|
|
1762
|
-
hasError: field.hasError,
|
|
1763
|
-
value: displayValue,
|
|
1764
|
-
$selectedItemStyle: selectedOption?.PLEASE_DO_NOT_USE_labelFontStyle
|
|
1765
|
-
}),
|
|
1766
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CaretButton, {
|
|
1767
|
-
...getToggleButtonProps(),
|
|
1768
|
-
size,
|
|
1769
|
-
disabled: field.disabled,
|
|
1770
|
-
"aria-label": `${isMenuOpen ? "Close" : "Open"} options menu`,
|
|
1771
|
-
"aria-haspopup": "listbox",
|
|
1772
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.CaretDownIcon, {})
|
|
1773
|
-
})
|
|
1774
|
-
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownPortalWrapper, {
|
|
1775
|
-
portal: embedded ? false : portal,
|
|
1776
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownContainer, {
|
|
1777
|
-
$isOpen: isMenuOpen,
|
|
1778
|
-
$portal: embedded ? false : portal,
|
|
1779
|
-
$embedded: embedded,
|
|
1780
|
-
$top: dropdownPosition.top,
|
|
1781
|
-
$left: dropdownPosition.left,
|
|
1782
|
-
$width: dropdownPosition.width,
|
|
1783
|
-
$minWidth: externalTrigger ? EXTERNAL_TRIGGER_DROPDOWN_MIN_WIDTH : void 0,
|
|
1784
|
-
...getMenuProps(),
|
|
1785
|
-
children: [(externalTrigger || embedded) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInputContainer, {
|
|
1786
|
-
$embedded: embedded,
|
|
1787
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input.InputGroup, {
|
|
1788
|
-
leftIcon: embedded ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.SearchIcon, {}),
|
|
1789
|
-
size,
|
|
1790
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
|
|
1791
|
-
$embedded: embedded,
|
|
1792
|
-
...searchInputProps,
|
|
1793
|
-
size,
|
|
1794
|
-
hasWarning: field.hasWarning,
|
|
1795
|
-
hasError: field.hasError,
|
|
1796
|
-
value: inputValue,
|
|
1797
|
-
autoComplete: "off"
|
|
1798
|
-
})
|
|
1799
|
-
})
|
|
1800
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SingleSelectScrollableMenuList, {
|
|
1801
|
-
$embedded: embedded,
|
|
1802
|
-
tabIndex: -1,
|
|
1803
|
-
children: isMenuOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1804
|
-
showBackRow && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BackRow, {
|
|
1805
|
-
type: "button",
|
|
1806
|
-
tabIndex: -1,
|
|
1807
|
-
onMouseDown: (event) => {
|
|
1808
|
-
event.preventDefault();
|
|
1809
|
-
handleAscend();
|
|
1810
|
-
},
|
|
1811
|
-
onClick: (event) => {
|
|
1812
|
-
if (event.detail === 0) handleAscend();
|
|
1813
|
-
},
|
|
1814
|
-
"aria-label": "Back to previous menu",
|
|
1815
|
-
$size: size,
|
|
1816
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_persona_icons.ArrowLeftIcon, {
|
|
1817
|
-
"aria-hidden": "true",
|
|
1818
|
-
size: size === "sm" ? 12 : 16
|
|
1819
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Back" })]
|
|
1820
|
-
}),
|
|
1821
|
-
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({
|
|
1822
|
-
options: renderSource,
|
|
1823
|
-
filteredOptions,
|
|
1824
|
-
renderOption
|
|
1825
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmptyState, {
|
|
1826
|
-
role: "status",
|
|
1827
|
-
"aria-live": "polite",
|
|
1828
|
-
size,
|
|
1829
|
-
children: emptyStateMessage
|
|
1830
|
-
}),
|
|
1831
|
-
showFooterAction && footerAction && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FooterActionRow, {
|
|
1832
|
-
action: footerAction,
|
|
1833
|
-
size,
|
|
1834
|
-
id: footerActionId,
|
|
1835
|
-
isHighlighted: isFooterHighlighted
|
|
1836
|
-
})
|
|
1837
|
-
] })
|
|
1838
|
-
})]
|
|
1839
|
-
})
|
|
1840
|
-
})]
|
|
1841
|
-
});
|
|
1842
|
-
}
|
|
1843
|
-
const ComboboxSingleSelect = (0, react.forwardRef)(ComboboxSingleSelectComponent);
|
|
1844
|
-
//#endregion
|
|
1845
|
-
//#region components/Combobox/Combobox.tsx
|
|
1846
|
-
function ComboboxComponent(props, ref) {
|
|
1847
|
-
if (props.multiple) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComboboxMultiSelect, {
|
|
1848
|
-
ref,
|
|
1849
|
-
...props
|
|
1850
|
-
});
|
|
1851
|
-
else return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComboboxSingleSelect, {
|
|
1852
|
-
ref,
|
|
1853
|
-
...props
|
|
1854
|
-
});
|
|
1855
|
-
}
|
|
1856
|
-
const Combobox = (0, react.forwardRef)(ComboboxComponent);
|
|
1857
|
-
//#endregion
|
|
1858
|
-
Object.defineProperty(exports, "CaretButton", {
|
|
1859
|
-
enumerable: true,
|
|
1860
|
-
get: function() {
|
|
1861
|
-
return CaretButton;
|
|
1862
|
-
}
|
|
1863
|
-
});
|
|
1864
|
-
Object.defineProperty(exports, "Combobox", {
|
|
1865
|
-
enumerable: true,
|
|
1866
|
-
get: function() {
|
|
1867
|
-
return Combobox;
|
|
1868
|
-
}
|
|
1869
|
-
});
|
|
1870
|
-
Object.defineProperty(exports, "flattenOptions", {
|
|
1871
|
-
enumerable: true,
|
|
1872
|
-
get: function() {
|
|
1873
|
-
return flattenOptions;
|
|
1874
|
-
}
|
|
1875
|
-
});
|
|
1876
|
-
|
|
1877
|
-
//# sourceMappingURL=Combobox-COXvmxlM.cjs.map
|