@midas-ds/components 10.1.0 → 10.2.0
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/AccordionItem-DZT76sWu.js +320 -0
- package/AccordionItem-Z_c9MpAM.cjs +1 -0
- package/BadgeContainer-D3RtqcPF.js +37 -0
- package/BadgeContainer-DeUgqGqb.cjs +1 -0
- package/Breadcrumbs-CmZXtTiS.js +250 -0
- package/Breadcrumbs-Cx09jwZZ.cjs +1 -0
- package/Button-CbFRzRrF.js +38 -0
- package/Button-DnhqHU01.cjs +1 -0
- package/Button-ZOQy9Ivu.js +78 -0
- package/Button-iSiWjocA.cjs +1 -0
- package/Button.module-CMMhIrkn.js +14 -0
- package/Button.module-DO5s9hOk.cjs +1 -0
- package/ButtonGroup-DUqW5dzM.cjs +1 -0
- package/ButtonGroup-DvVvear6.js +22 -0
- package/CHANGELOG.md +81 -0
- package/Card-C0BFW3wJ.cjs +1 -0
- package/Card-CaKKKv9k.js +131 -0
- package/CharacterCounter-CPGdboVJ.js +22 -0
- package/CharacterCounter-CrY8QRuY.cjs +1 -0
- package/Checkbox-CvFsn_FL.js +380 -0
- package/Checkbox-DSxGAJX2.cjs +1 -0
- package/CheckboxGroup-Bk9DPq4I.cjs +1 -0
- package/CheckboxGroup-Dij9zKlF.js +54 -0
- package/Collection-C5ONNBqd.js +576 -0
- package/Collection-Csx3L9gh.cjs +1 -0
- package/ColorSchemeSwitch-CbAWIJCg.js +106 -0
- package/ColorSchemeSwitch-JRrCyYVv.cjs +16 -0
- package/ComboBox-BCaqPEIH.js +1375 -0
- package/ComboBox-gveQKHU3.cjs +1 -0
- package/DateField-CAQlzuDD.js +46 -0
- package/DateField-deVVFwKA.cjs +1 -0
- package/DateInputDivider-DnUxETEC.cjs +1 -0
- package/DateInputDivider-Dx8n1Lxp.js +2908 -0
- package/DateRangePicker-BmBvwqo6.js +881 -0
- package/DateRangePicker-BzfitoK0.cjs +6 -0
- package/Dialog-Bd5hK360.cjs +1 -0
- package/Dialog-Bxx8cBEq.js +208 -0
- package/Dialog-CYxThuMl.js +1609 -0
- package/Dialog-CwTEAujZ.cjs +1 -0
- package/DragAndDrop-CSwmPhxC.js +60 -0
- package/DragAndDrop-HvycSrKY.cjs +1 -0
- package/Dropdown-CaGon9OR.cjs +6 -0
- package/Dropdown-nkjzsVYX.js +84 -0
- package/FieldError-BZw8UzBk.cjs +1 -0
- package/FieldError-CZikNDxX.js +28 -0
- package/FieldError-DqdfJ3fs.cjs +1 -0
- package/FieldError-Dv3bBEjh.js +23 -0
- package/FileUpload-DYRZ0M9F.cjs +2 -0
- package/FileUpload-ULwcYDxs.js +2372 -0
- package/FocusScope-DwIqdYpQ.js +625 -0
- package/FocusScope-NaPbvuuS.cjs +1 -0
- package/Form-BuOomA4T.cjs +1 -0
- package/Form-CXcEMuBf.js +5 -0
- package/Grid--OhtgCo6.js +27 -0
- package/Grid-DVQtOcu9.cjs +1 -0
- package/GridItem-DlbSdRmB.js +246 -0
- package/GridItem-XgHmZWXY.cjs +1 -0
- package/Group-CeSsSQVC.js +44 -0
- package/Group-CgiqQHH1.cjs +1 -0
- package/Heading-BY5-QN4S.js +46 -0
- package/Heading-DoJAtYZf.cjs +1 -0
- package/Hidden-B5ir3Lei.js +34 -0
- package/Hidden-BxRZGdEW.cjs +1 -0
- package/InfoBanner-BS-dAfzO.cjs +1 -0
- package/InfoBanner-CVIBFSWx.js +82 -0
- package/Input-D8Ku_FQz.js +41 -0
- package/Input-DKSAYvsw.cjs +1 -0
- package/Label-C9ivwkAd.js +21 -0
- package/Label-CUV21CAv.cjs +1 -0
- package/Label-DkDOsmUF.js +16 -0
- package/Label-IMWAyoKb.cjs +1 -0
- package/Layout-BWeHHnqU.cjs +16 -0
- package/Layout-CCt_2L1k.js +468 -0
- package/Link-B-nus-FT.js +71 -0
- package/Link-DsnCtNeI.cjs +6 -0
- package/Link-SHMbeyIP.cjs +1 -0
- package/Link-uFowN4qv.js +59 -0
- package/LinkButton-CuBilDML.js +69 -0
- package/LinkButton-CymMrcGL.cjs +6 -0
- package/ListBox-CDOsQChA.cjs +1 -0
- package/ListBox-DOi_y_Lt.js +530 -0
- package/ListBoxButton-CFeNhJhr.cjs +1 -0
- package/ListBoxButton-O6zN3P4W.js +15 -0
- package/ListBoxSection-C1aLKL9p.js +1058 -0
- package/ListBoxSection-DGCP6xpf.cjs +1 -0
- package/ListKeyboardDelegate-BqMETvPv.cjs +1 -0
- package/ListKeyboardDelegate-DNOzQ8nc.js +158 -0
- package/LiveAnnouncer-B6177m92.js +51 -0
- package/LiveAnnouncer-CwEWPU8b.cjs +1 -0
- package/LocalizedStringFormatter-C0C54hjf.cjs +1 -0
- package/LocalizedStringFormatter-D-4Qyql0.js +77 -0
- package/Logo-BIrOEINM.js +133 -0
- package/Logo-DT2_2O43.cjs +1 -0
- package/NumberFormatter-DewVDY5w.cjs +1 -0
- package/NumberFormatter-DgOUVrge.js +119 -0
- package/OverlayArrow-D75k-EMl.cjs +1 -0
- package/OverlayArrow-DorA4Rbr.js +506 -0
- package/PressResponder-C06O3Z5P.cjs +1 -0
- package/PressResponder-CVEg5kND.js +33 -0
- package/ProgressBar-Bkw9zavs.cjs +1 -0
- package/ProgressBar-CEX2WNoW.js +77 -0
- package/ProgressBar-Dqh3ftSP.cjs +1 -0
- package/ProgressBar-gmAzSsrz.js +53 -0
- package/RSPContexts-BW2SEIqe.js +11 -0
- package/RSPContexts-D8hmBfGm.cjs +1 -0
- package/Radio-CDKrvQe4.cjs +1 -0
- package/Radio-_ukSkxPT.js +311 -0
- package/RangeCalendar-cbCKBPZv.cjs +11 -0
- package/RangeCalendar-uXwoBL-O.js +1685 -0
- package/SearchField-6yBGiojX.cjs +6 -0
- package/SearchField-DYl2uo7o.js +362 -0
- package/Select-CpHjd1tp.cjs +1 -0
- package/Select-PvCqY7Lp.js +646 -0
- package/SelectionManager-6H88Cv6B.js +1033 -0
- package/SelectionManager-C5NGBzvz.cjs +1 -0
- package/Separator-LYnFqh4L.js +60 -0
- package/Separator-nPra6kD-.cjs +1 -0
- package/Skeleton-BAwbfKBW.cjs +1 -0
- package/Skeleton-BePDRmrO.js +40 -0
- package/Spinner-D31SXm-U.js +41 -0
- package/Spinner-DAJtfxqJ.cjs +6 -0
- package/Table-B_N7wUmA.js +2451 -0
- package/Table-D9vNc_y-.cjs +16 -0
- package/Tabs-Ct6D83aR.js +404 -0
- package/Tabs-Dtcl2oK2.cjs +1 -0
- package/Tag-CVFkzg3s.cjs +1 -0
- package/Tag-g6HN-YCv.js +748 -0
- package/Text-3MNwRMpI.cjs +1 -0
- package/Text-B2K-BJKQ.cjs +1 -0
- package/Text-BN-g1iWi.js +32 -0
- package/Text-B_H68Tvq.js +15 -0
- package/TextArea-DSiQ578a.js +206 -0
- package/TextArea-cVyGBRbL.cjs +1 -0
- package/TextField-B70CL2qz.cjs +1 -0
- package/TextField-DBaRuNj7.js +119 -0
- package/TextField.module-BcpPBWnD.js +13 -0
- package/TextField.module-Dw5Rtn9y.cjs +1 -0
- package/Toast-CjpldAI8.js +988 -0
- package/Toast-DrkOGy4d.cjs +1 -0
- package/ToggleButtonGroup-BuU_6dYe.cjs +1 -0
- package/ToggleButtonGroup-Ceh9_yBM.js +210 -0
- package/Tooltip-BAIjaYax.js +283 -0
- package/Tooltip-CiWg4zIC.cjs +1 -0
- package/VisuallyHidden-CtXvK_Tw.cjs +1 -0
- package/VisuallyHidden-D-4z1VgU.js +40 -0
- package/accordion/index.cjs +1 -0
- package/accordion/index.js +5 -0
- package/arrow-right-Cw48o2oW.cjs +6 -0
- package/arrow-right-Dg8sttFO.js +14 -0
- package/assets/AccordionItem.css +1 -0
- package/assets/BadgeContainer.css +1 -0
- package/assets/Breadcrumbs.css +1 -0
- package/assets/Button.css +1 -0
- package/assets/ButtonGroup.css +1 -0
- package/assets/Card.css +1 -0
- package/assets/CharacterCounter.css +1 -0
- package/assets/Checkbox.css +1 -0
- package/assets/ColorSchemeSwitch.css +1 -0
- package/assets/ComboBox.css +1 -0
- package/assets/DateField.css +1 -0
- package/assets/DateInputDivider.css +1 -0
- package/assets/DateRangePicker.css +1 -0
- package/assets/Dialog.css +1 -0
- package/assets/Dropdown.css +1 -0
- package/assets/FieldError.css +1 -0
- package/assets/FileUpload.css +1 -0
- package/assets/GridItem.css +1 -0
- package/assets/Heading.css +1 -0
- package/assets/InfoBanner.css +1 -0
- package/assets/Label.css +1 -0
- package/assets/Layout.css +1 -0
- package/assets/Link.css +1 -0
- package/assets/LinkButton.css +1 -0
- package/assets/ListBoxSection.css +1 -0
- package/assets/Logo.css +1 -0
- package/assets/ProgressBar.css +1 -0
- package/assets/Radio.css +1 -0
- package/assets/RangeCalendar.css +1 -0
- package/assets/SearchField.css +1 -0
- package/assets/Select.css +1 -0
- package/assets/Skeleton.css +1 -0
- package/assets/Spinner.css +1 -0
- package/assets/Table.css +1 -0
- package/assets/Tabs.css +1 -0
- package/assets/Tag.css +1 -0
- package/assets/Text.css +1 -0
- package/assets/TextField.css +1 -0
- package/assets/Toast.css +1 -0
- package/assets/ToggleButtonGroup.css +1 -0
- package/assets/Tooltip.css +1 -0
- package/badge/index.cjs +1 -0
- package/badge/index.js +5 -0
- package/breadcrumbs/index.cjs +1 -0
- package/breadcrumbs/index.js +4 -0
- package/button/index.cjs +1 -0
- package/button/index.js +6 -0
- package/calendar/CalendarHeader.d.ts +2 -1
- package/calendar/index.cjs +1 -0
- package/calendar/index.js +5 -0
- package/card/Card.d.ts +3 -0
- package/card/index.cjs +1 -0
- package/card/index.js +10 -0
- package/character-counter/index.cjs +1 -0
- package/character-counter/index.js +4 -0
- package/check-CLF6Yxza.js +11 -0
- package/check-Dw9c62O4.cjs +6 -0
- package/checkbox/index.cjs +1 -0
- package/checkbox/index.js +6 -0
- package/chevron-down-C2E7aZ3N.cjs +6 -0
- package/chevron-down-Cd1bkzXT.js +13 -0
- package/clsx-C11secjj.cjs +1 -0
- package/clsx-OuTLNxxd.js +16 -0
- package/color-scheme-switch/index.cjs +1 -0
- package/color-scheme-switch/index.js +4 -0
- package/combobox/ComboBox.d.ts +9 -5
- package/combobox/index.cjs +1 -0
- package/combobox/index.d.ts +1 -1
- package/combobox/index.js +7 -0
- package/combobox/types.d.ts +6 -0
- package/combobox/utils.d.ts +3 -10
- package/common/types.d.ts +2 -0
- package/context-B8cn10po.js +80 -0
- package/context-DjwhtgxQ.cjs +1 -0
- package/createLucideIcon-DAY4oS-S.cjs +21 -0
- package/createLucideIcon-DeWljiyi.js +79 -0
- package/date-field/index.cjs +1 -0
- package/date-field/index.js +8 -0
- package/date-picker/index.cjs +1 -0
- package/date-picker/index.js +5 -0
- package/dropdown/index.cjs +1 -0
- package/dropdown/index.js +5 -0
- package/field-error/FieldError.d.ts +4 -1
- package/field-error/index.cjs +1 -0
- package/field-error/index.js +4 -0
- package/file-upload/index.cjs +1 -0
- package/file-upload/index.js +4 -0
- package/filterDOMProps-BS2lrgFA.cjs +1 -0
- package/filterDOMProps-D6KHYVBX.js +24 -0
- package/focusSafely-Bqfo_DH7.cjs +1 -0
- package/focusSafely-C48ucRUz.js +56 -0
- package/getScrollParent-DuKmPmUa.cjs +1 -0
- package/getScrollParent-Ru2U2LlM.js +9 -0
- package/grid/Grid.d.ts +15 -4
- package/grid/GridItem.d.ts +31 -2
- package/grid/index.cjs +1 -0
- package/grid/index.d.ts +2 -2
- package/grid/index.js +8 -0
- package/heading/index.cjs +1 -0
- package/heading/index.js +4 -0
- package/index-BSMrH_Du.js +120 -0
- package/index-D97L3EBk.cjs +17 -0
- package/index.cjs +1 -164
- package/index.d.ts +1 -1
- package/index.js +127 -30044
- package/inertValue-B7loUihk.js +8 -0
- package/inertValue-BWmZ1afe.cjs +1 -0
- package/info-DkzVqB8I.js +38 -0
- package/info-DlzSeKbc.cjs +16 -0
- package/info-banner/index.cjs +1 -0
- package/info-banner/index.js +4 -0
- package/label/index.cjs +1 -0
- package/label/index.js +4 -0
- package/layout/index.cjs +1 -0
- package/layout/index.js +8 -0
- package/link/Link.d.ts +4 -1
- package/link/index.cjs +1 -0
- package/link/index.js +6 -0
- package/link-button/LinkButton.d.ts +24 -1
- package/link-button/index.cjs +1 -0
- package/link-button/index.js +6 -0
- package/list-box/ListBox.d.ts +4 -0
- package/list-box/ListBoxButton.d.ts +2 -0
- package/list-box/ListBoxItem.d.ts +3 -0
- package/list-box/ListBoxPopover.d.ts +3 -0
- package/list-box/ListBoxSection.d.ts +8 -0
- package/list-box/index.cjs +1 -0
- package/list-box/index.d.ts +6 -0
- package/list-box/index.js +9 -0
- package/list-box/types.d.ts +23 -0
- package/logo/index.cjs +1 -0
- package/logo/index.js +4 -0
- package/modal/index.cjs +1 -0
- package/modal/index.js +6 -0
- package/number-BE8InLgI.js +6 -0
- package/number-E0x3H9cL.cjs +1 -0
- package/package.json +4 -4
- package/progress-bar/index.cjs +1 -0
- package/progress-bar/index.js +4 -0
- package/radio/index.cjs +1 -0
- package/radio/index.js +5 -0
- package/scrollIntoView-ClEACHUk.js +57 -0
- package/scrollIntoView-DRSoJp89.cjs +1 -0
- package/search-field/index.cjs +1 -0
- package/search-field/index.js +4 -0
- package/select/HiddenMultiSelect.d.ts +5 -4
- package/select/MultiSelectValueTag.d.ts +11 -0
- package/select/Select.d.ts +2 -77
- package/select/SelectFieldError.d.ts +8 -0
- package/select/SelectListBox.d.ts +4 -3
- package/select/SelectTrigger.d.ts +10 -0
- package/select/index.cjs +1 -0
- package/select/index.d.ts +1 -0
- package/select/index.js +4 -0
- package/select/types.d.ts +188 -0
- package/select/useMultiSelect.d.ts +4 -21
- package/select/useMultiSelectListState.d.ts +3 -15
- package/select/useMultiSelectState.d.ts +3 -19
- package/skeleton/Skeleton.d.ts +5 -0
- package/skeleton/index.cjs +1 -0
- package/skeleton/index.js +4 -0
- package/spinner/index.cjs +1 -0
- package/spinner/index.js +4 -0
- package/square-arrow-out-up-right-BCAO2eJs.cjs +6 -0
- package/square-arrow-out-up-right-BkyqV2PN.js +15 -0
- package/table/Table.d.ts +7 -1
- package/table/index.cjs +1 -0
- package/table/index.js +9 -0
- package/tabs/index.cjs +1 -0
- package/tabs/index.js +4 -0
- package/tag/index.cjs +1 -0
- package/tag/index.js +5 -0
- package/text/index.cjs +1 -0
- package/text/index.js +4 -0
- package/textfield/index.cjs +1 -0
- package/textfield/index.js +7 -0
- package/theme/index.cjs +1 -0
- package/theme/index.d.ts +4 -0
- package/{theme.js → theme/index.js} +2 -2
- package/theme/tokens.d.ts +10 -0
- package/toast/index.cjs +1 -0
- package/toast/index.js +9 -0
- package/toggle-button/index.cjs +1 -0
- package/toggle-button/index.js +5 -0
- package/tokens-p6pg1Cea.cjs +1 -0
- package/{tokens-C0U7hdoO.js → tokens-xp-7KMK7.js} +18 -8
- package/tooltip/index.cjs +1 -0
- package/tooltip/index.js +5 -0
- package/triangle-alert-C0lvfCYH.cjs +6 -0
- package/triangle-alert-wxyxspAl.js +21 -0
- package/useButton-B1Fa-6qE.cjs +1 -0
- package/useButton-C-Lq7CNY.js +47 -0
- package/useCollator-C_ozeWLo.cjs +1 -0
- package/useCollator-CgZcHC8N.js +11 -0
- package/useControlledState-D0L6S_5r.cjs +1 -0
- package/useControlledState-u436Wbp1.js +30 -0
- package/useDateFormatter-C53Uxdli.js +1571 -0
- package/useDateFormatter-g2maMTGH.cjs +1 -0
- package/useDescription-CVKhFa3c.js +32 -0
- package/useDescription-DmQYSEES.cjs +1 -0
- package/useEvent-CjkbBniY.cjs +1 -0
- package/useEvent-Cyd2ZL0c.js +21 -0
- package/useField-B1RU0GKs.cjs +1 -0
- package/useField-BPMAlIbU.js +35 -0
- package/useFilter-ChIbnALW.js +35 -0
- package/useFilter-CtIwF2qW.cjs +1 -0
- package/useFocusRing-BDGH3lpn.js +82 -0
- package/useFocusRing-CbImDrwF.cjs +1 -0
- package/useFocusable-CaedRTpB.js +74 -0
- package/useFocusable-CuPQ7Cm5.cjs +1 -0
- package/useFormValidation-ClximP89.cjs +1 -0
- package/useFormValidation-R8hQIjWP.js +215 -0
- package/useHasTabbableChild-DgphNvnk.cjs +1 -0
- package/useHasTabbableChild-DsD9AJwE.js +34 -0
- package/useHighlightSelectionDescription-BizKjvPU.cjs +1 -0
- package/useHighlightSelectionDescription-DFfcgbUj.js +567 -0
- package/useHover-_mv5J4_q.cjs +1 -0
- package/useHover-qRAon4nS.js +490 -0
- package/useLabel-DDdAJ1JO.js +23 -0
- package/useLabel-m_S5xkHy.cjs +1 -0
- package/useLabels-BLOfc6Y-.cjs +1 -0
- package/useLabels-BZjoZA1Z.js +17 -0
- package/useListState-Ca2-uZMO.cjs +1 -0
- package/useListState-DFQ9d-uE.js +132 -0
- package/useLocalizedStringFormatter-D07YB2e1.js +22 -0
- package/useLocalizedStringFormatter-u9SJaOwk.cjs +1 -0
- package/useObserveElement-BdI4zgd7.js +27 -0
- package/useObserveElement-BzEr5D32.cjs +1 -0
- package/usePress-BFa6cT9o.cjs +7 -0
- package/usePress-CUJ3pMOw.js +542 -0
- package/useSingleSelectListState-C-nB8cug.js +34 -0
- package/useSingleSelectListState-MGNxUTum.cjs +1 -0
- package/useTextField-5OZQPyOW.js +86 -0
- package/useTextField-CtUDWsUl.cjs +1 -0
- package/useToggleState-Bz5rAf4C.js +18 -0
- package/useToggleState-DoIkSQdj.cjs +1 -0
- package/useUpdateEffect-CCDx8D4X.js +13 -0
- package/useUpdateEffect-sk3kiVGz.cjs +1 -0
- package/utils/test.d.ts +1 -1
- package/utils-BNtZbAib.cjs +1 -0
- package/utils-HNTsIwux.js +308 -0
- package/x-CvxiAZTW.cjs +6 -0
- package/x-JK7i-TQC.js +14 -0
- package/flex/Flex.d.ts +0 -17
- package/flex/FlexItem.d.ts +0 -15
- package/flex/index.d.ts +0 -2
- package/index.css +0 -1
- package/select/SelectPopover.d.ts +0 -10
- package/theme.cjs +0 -1
- package/tokens-COoF1t17.cjs +0 -1
- /package/{global.css → assets/global.css} +0 -0
- /package/{select → list-box}/SectionedListLayout.d.ts +0 -0
|
@@ -0,0 +1,1033 @@
|
|
|
1
|
+
import V, { useRef as S, useEffect as q, useMemo as j, useState as se } from "react";
|
|
2
|
+
import { $ as ye, d as Y, c as we, g as he } from "./utils-HNTsIwux.js";
|
|
3
|
+
import { u as ke, b as Ae, d as xe, s as ue, e as Ie, C as Ce, r as pe } from "./useHover-qRAon4nS.js";
|
|
4
|
+
import { b as Fe, c as Pe, f as Me } from "./usePress-CUJ3pMOw.js";
|
|
5
|
+
import { $ as J } from "./useEvent-Cyd2ZL0c.js";
|
|
6
|
+
import { a as Be, b as ve } from "./scrollIntoView-ClEACHUk.js";
|
|
7
|
+
import { flushSync as Re } from "react-dom";
|
|
8
|
+
import { a as ae } from "./focusSafely-C48ucRUz.js";
|
|
9
|
+
import { $ as Le } from "./FocusScope-DwIqdYpQ.js";
|
|
10
|
+
import { $ as Oe } from "./context-B8cn10po.js";
|
|
11
|
+
import { $ as ze } from "./useDescription-CVKhFa3c.js";
|
|
12
|
+
import { $ as Ue } from "./useControlledState-u436Wbp1.js";
|
|
13
|
+
function be(n, e) {
|
|
14
|
+
const t = S(!0), l = S(null);
|
|
15
|
+
ye(() => (t.current = !0, () => {
|
|
16
|
+
t.current = !1;
|
|
17
|
+
}), []), ye(() => {
|
|
18
|
+
t.current ? t.current = !1 : (!l.current || e.some((i, c) => !Object.is(i, l[c]))) && n(), l.current = e;
|
|
19
|
+
}, e);
|
|
20
|
+
}
|
|
21
|
+
const Ve = "react-aria-clear-focus", He = "react-aria-focus";
|
|
22
|
+
function H(n) {
|
|
23
|
+
return ke() ? n.metaKey : n.ctrlKey;
|
|
24
|
+
}
|
|
25
|
+
const We = 500;
|
|
26
|
+
function Ge(n) {
|
|
27
|
+
let { isDisabled: e, onLongPressStart: t, onLongPressEnd: l, onLongPress: i, threshold: c = We, accessibilityDescription: r } = n;
|
|
28
|
+
const f = S(void 0);
|
|
29
|
+
let { addGlobalListener: a, removeGlobalListener: g } = Ae(), { pressProps: E } = Fe({
|
|
30
|
+
isDisabled: e,
|
|
31
|
+
onPressStart(v) {
|
|
32
|
+
if (v.continuePropagation(), (v.pointerType === "mouse" || v.pointerType === "touch") && (t && t({
|
|
33
|
+
...v,
|
|
34
|
+
type: "longpressstart"
|
|
35
|
+
}), f.current = setTimeout(() => {
|
|
36
|
+
v.target.dispatchEvent(new PointerEvent("pointercancel", {
|
|
37
|
+
bubbles: !0
|
|
38
|
+
})), xe(v.target).activeElement !== v.target && ue(v.target), i && i({
|
|
39
|
+
...v,
|
|
40
|
+
type: "longpress"
|
|
41
|
+
}), f.current = void 0;
|
|
42
|
+
}, c), v.pointerType === "touch")) {
|
|
43
|
+
let $ = (b) => {
|
|
44
|
+
b.preventDefault();
|
|
45
|
+
};
|
|
46
|
+
a(v.target, "contextmenu", $, {
|
|
47
|
+
once: !0
|
|
48
|
+
}), a(window, "pointerup", () => {
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
g(v.target, "contextmenu", $);
|
|
51
|
+
}, 30);
|
|
52
|
+
}, {
|
|
53
|
+
once: !0
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
onPressEnd(v) {
|
|
58
|
+
f.current && clearTimeout(f.current), l && (v.pointerType === "mouse" || v.pointerType === "touch") && l({
|
|
59
|
+
...v,
|
|
60
|
+
type: "longpressend"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}), m = ze(i && !e ? r : void 0);
|
|
64
|
+
return {
|
|
65
|
+
longPressProps: Y(E, m)
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function De(n) {
|
|
69
|
+
let e = Ye(xe(n));
|
|
70
|
+
e !== n && (e && qe(e, n), n && je(n, e));
|
|
71
|
+
}
|
|
72
|
+
function qe(n, e) {
|
|
73
|
+
n.dispatchEvent(new FocusEvent("blur", {
|
|
74
|
+
relatedTarget: e
|
|
75
|
+
})), n.dispatchEvent(new FocusEvent("focusout", {
|
|
76
|
+
bubbles: !0,
|
|
77
|
+
relatedTarget: e
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
function je(n, e) {
|
|
81
|
+
n.dispatchEvent(new FocusEvent("focus", {
|
|
82
|
+
relatedTarget: e
|
|
83
|
+
})), n.dispatchEvent(new FocusEvent("focusin", {
|
|
84
|
+
bubbles: !0,
|
|
85
|
+
relatedTarget: e
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
function Ye(n) {
|
|
89
|
+
let e = Ie(n), t = e == null ? void 0 : e.getAttribute("aria-activedescendant");
|
|
90
|
+
return t && n.getElementById(t) || e;
|
|
91
|
+
}
|
|
92
|
+
function fe(n) {
|
|
93
|
+
return Ce() ? n.altKey : n.ctrlKey;
|
|
94
|
+
}
|
|
95
|
+
function re(n, e) {
|
|
96
|
+
var t, l;
|
|
97
|
+
let i = `[data-key="${CSS.escape(String(e))}"]`, c = (t = n.current) === null || t === void 0 ? void 0 : t.dataset.collection;
|
|
98
|
+
return c && (i = `[data-collection="${CSS.escape(c)}"]${i}`), (l = n.current) === null || l === void 0 ? void 0 : l.querySelector(i);
|
|
99
|
+
}
|
|
100
|
+
const Te = /* @__PURE__ */ new WeakMap();
|
|
101
|
+
function Ze(n) {
|
|
102
|
+
let e = we();
|
|
103
|
+
return Te.set(n, e), e;
|
|
104
|
+
}
|
|
105
|
+
function Je(n) {
|
|
106
|
+
return Te.get(n);
|
|
107
|
+
}
|
|
108
|
+
const Qe = 1e3;
|
|
109
|
+
function Xe(n) {
|
|
110
|
+
let { keyboardDelegate: e, selectionManager: t, onTypeSelect: l } = n, i = S({
|
|
111
|
+
search: "",
|
|
112
|
+
timeout: void 0
|
|
113
|
+
}).current, c = (r) => {
|
|
114
|
+
let f = Ne(r.key);
|
|
115
|
+
if (!(!f || r.ctrlKey || r.metaKey || !r.currentTarget.contains(r.target))) {
|
|
116
|
+
if (f === " " && i.search.trim().length > 0 && (r.preventDefault(), "continuePropagation" in r || r.stopPropagation()), i.search += f, e.getKeyForSearch != null) {
|
|
117
|
+
let a = e.getKeyForSearch(i.search, t.focusedKey);
|
|
118
|
+
a == null && (a = e.getKeyForSearch(i.search)), a != null && (t.setFocusedKey(a), l && l(a));
|
|
119
|
+
}
|
|
120
|
+
clearTimeout(i.timeout), i.timeout = setTimeout(() => {
|
|
121
|
+
i.search = "";
|
|
122
|
+
}, Qe);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
typeSelectProps: {
|
|
127
|
+
// Using a capturing listener to catch the keydown event before
|
|
128
|
+
// other hooks in order to handle the Spacebar event.
|
|
129
|
+
onKeyDownCapture: e.getKeyForSearch ? c : void 0
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function Ne(n) {
|
|
134
|
+
return n.length === 1 || !/^[A-Z]/i.test(n) ? n : "";
|
|
135
|
+
}
|
|
136
|
+
function bt(n) {
|
|
137
|
+
let { selectionManager: e, keyboardDelegate: t, ref: l, autoFocus: i = !1, shouldFocusWrap: c = !1, disallowEmptySelection: r = !1, disallowSelectAll: f = !1, escapeKeyBehavior: a = "clearSelection", selectOnFocus: g = e.selectionBehavior === "replace", disallowTypeAhead: E = !1, shouldUseVirtualFocus: m, allowsTabNavigation: v = !1, isVirtualized: $, scrollRef: b = l, linkBehavior: k = "action" } = n, { direction: y } = Oe(), d = Pe(), K = (o) => {
|
|
138
|
+
var s;
|
|
139
|
+
if (o.altKey && o.key === "Tab" && o.preventDefault(), !(!((s = l.current) === null || s === void 0) && s.contains(o.target))) return;
|
|
140
|
+
const p = (u, z) => {
|
|
141
|
+
if (u != null) {
|
|
142
|
+
if (e.isLink(u) && k === "selection" && g && !fe(o)) {
|
|
143
|
+
Re(() => {
|
|
144
|
+
e.setFocusedKey(u, z);
|
|
145
|
+
});
|
|
146
|
+
let U = re(l, u), de = e.getItemProps(u);
|
|
147
|
+
U && d.open(U, o, de.href, de.routerOptions);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (e.setFocusedKey(u, z), e.isLink(u) && k === "override") return;
|
|
151
|
+
o.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(u) : g && !fe(o) && e.replaceSelection(u);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
switch (o.key) {
|
|
155
|
+
case "ArrowDown":
|
|
156
|
+
if (t.getKeyBelow) {
|
|
157
|
+
var x, T, D;
|
|
158
|
+
let u = e.focusedKey != null ? (x = t.getKeyBelow) === null || x === void 0 ? void 0 : x.call(t, e.focusedKey) : (T = t.getFirstKey) === null || T === void 0 ? void 0 : T.call(t);
|
|
159
|
+
u == null && c && (u = (D = t.getFirstKey) === null || D === void 0 ? void 0 : D.call(t, e.focusedKey)), u != null && (o.preventDefault(), p(u));
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
case "ArrowUp":
|
|
163
|
+
if (t.getKeyAbove) {
|
|
164
|
+
var B, L, N;
|
|
165
|
+
let u = e.focusedKey != null ? (B = t.getKeyAbove) === null || B === void 0 ? void 0 : B.call(t, e.focusedKey) : (L = t.getLastKey) === null || L === void 0 ? void 0 : L.call(t);
|
|
166
|
+
u == null && c && (u = (N = t.getLastKey) === null || N === void 0 ? void 0 : N.call(t, e.focusedKey)), u != null && (o.preventDefault(), p(u));
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case "ArrowLeft":
|
|
170
|
+
if (t.getKeyLeftOf) {
|
|
171
|
+
var _, ee, te;
|
|
172
|
+
let u = e.focusedKey != null ? (_ = t.getKeyLeftOf) === null || _ === void 0 ? void 0 : _.call(t, e.focusedKey) : null;
|
|
173
|
+
u == null && c && (u = y === "rtl" ? (ee = t.getFirstKey) === null || ee === void 0 ? void 0 : ee.call(t, e.focusedKey) : (te = t.getLastKey) === null || te === void 0 ? void 0 : te.call(t, e.focusedKey)), u != null && (o.preventDefault(), p(u, y === "rtl" ? "first" : "last"));
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
case "ArrowRight":
|
|
177
|
+
if (t.getKeyRightOf) {
|
|
178
|
+
var le, ie, ne;
|
|
179
|
+
let u = e.focusedKey != null ? (le = t.getKeyRightOf) === null || le === void 0 ? void 0 : le.call(t, e.focusedKey) : null;
|
|
180
|
+
u == null && c && (u = y === "rtl" ? (ie = t.getLastKey) === null || ie === void 0 ? void 0 : ie.call(t, e.focusedKey) : (ne = t.getFirstKey) === null || ne === void 0 ? void 0 : ne.call(t, e.focusedKey)), u != null && (o.preventDefault(), p(u, y === "rtl" ? "last" : "first"));
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
case "Home":
|
|
184
|
+
if (t.getFirstKey) {
|
|
185
|
+
if (e.focusedKey === null && o.shiftKey) return;
|
|
186
|
+
o.preventDefault();
|
|
187
|
+
let u = t.getFirstKey(e.focusedKey, H(o));
|
|
188
|
+
e.setFocusedKey(u), u != null && (H(o) && o.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(u) : g && e.replaceSelection(u));
|
|
189
|
+
}
|
|
190
|
+
break;
|
|
191
|
+
case "End":
|
|
192
|
+
if (t.getLastKey) {
|
|
193
|
+
if (e.focusedKey === null && o.shiftKey) return;
|
|
194
|
+
o.preventDefault();
|
|
195
|
+
let u = t.getLastKey(e.focusedKey, H(o));
|
|
196
|
+
e.setFocusedKey(u), u != null && (H(o) && o.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(u) : g && e.replaceSelection(u));
|
|
197
|
+
}
|
|
198
|
+
break;
|
|
199
|
+
case "PageDown":
|
|
200
|
+
if (t.getKeyPageBelow && e.focusedKey != null) {
|
|
201
|
+
let u = t.getKeyPageBelow(e.focusedKey);
|
|
202
|
+
u != null && (o.preventDefault(), p(u));
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
case "PageUp":
|
|
206
|
+
if (t.getKeyPageAbove && e.focusedKey != null) {
|
|
207
|
+
let u = t.getKeyPageAbove(e.focusedKey);
|
|
208
|
+
u != null && (o.preventDefault(), p(u));
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
case "a":
|
|
212
|
+
H(o) && e.selectionMode === "multiple" && f !== !0 && (o.preventDefault(), e.selectAll());
|
|
213
|
+
break;
|
|
214
|
+
case "Escape":
|
|
215
|
+
a === "clearSelection" && !r && e.selectedKeys.size !== 0 && (o.stopPropagation(), o.preventDefault(), e.clearSelection());
|
|
216
|
+
break;
|
|
217
|
+
case "Tab":
|
|
218
|
+
if (!v) {
|
|
219
|
+
if (o.shiftKey) l.current.focus();
|
|
220
|
+
else {
|
|
221
|
+
let u = Le(l.current, {
|
|
222
|
+
tabbable: !0
|
|
223
|
+
}), z, U;
|
|
224
|
+
do
|
|
225
|
+
U = u.lastChild(), U && (z = U);
|
|
226
|
+
while (U);
|
|
227
|
+
z && !z.contains(document.activeElement) && ue(z);
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}, h = S({
|
|
233
|
+
top: 0,
|
|
234
|
+
left: 0
|
|
235
|
+
});
|
|
236
|
+
J(b, "scroll", $ ? void 0 : () => {
|
|
237
|
+
var o, s, p, x;
|
|
238
|
+
h.current = {
|
|
239
|
+
top: (p = (o = b.current) === null || o === void 0 ? void 0 : o.scrollTop) !== null && p !== void 0 ? p : 0,
|
|
240
|
+
left: (x = (s = b.current) === null || s === void 0 ? void 0 : s.scrollLeft) !== null && x !== void 0 ? x : 0
|
|
241
|
+
};
|
|
242
|
+
});
|
|
243
|
+
let w = (o) => {
|
|
244
|
+
if (e.isFocused) {
|
|
245
|
+
o.currentTarget.contains(o.target) || e.setFocused(!1);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (o.currentTarget.contains(o.target)) {
|
|
249
|
+
if (e.setFocused(!0), e.focusedKey == null) {
|
|
250
|
+
var s, p;
|
|
251
|
+
let D = (L) => {
|
|
252
|
+
L != null && (e.setFocusedKey(L), g && !e.isSelected(L) && e.replaceSelection(L));
|
|
253
|
+
}, B = o.relatedTarget;
|
|
254
|
+
var x, T;
|
|
255
|
+
B && o.currentTarget.compareDocumentPosition(B) & Node.DOCUMENT_POSITION_FOLLOWING ? D((x = e.lastSelectedKey) !== null && x !== void 0 ? x : (s = t.getLastKey) === null || s === void 0 ? void 0 : s.call(t)) : D((T = e.firstSelectedKey) !== null && T !== void 0 ? T : (p = t.getFirstKey) === null || p === void 0 ? void 0 : p.call(t));
|
|
256
|
+
} else !$ && b.current && (b.current.scrollTop = h.current.top, b.current.scrollLeft = h.current.left);
|
|
257
|
+
if (e.focusedKey != null && b.current) {
|
|
258
|
+
let D = re(l, e.focusedKey);
|
|
259
|
+
D instanceof HTMLElement && (!D.contains(document.activeElement) && !m && ue(D), pe() === "keyboard" && ve(D, {
|
|
260
|
+
containingElement: l.current
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}, A = (o) => {
|
|
265
|
+
o.currentTarget.contains(o.relatedTarget) || e.setFocused(!1);
|
|
266
|
+
}, I = S(!1);
|
|
267
|
+
J(l, He, m ? (o) => {
|
|
268
|
+
let { detail: s } = o;
|
|
269
|
+
o.stopPropagation(), e.setFocused(!0), (s == null ? void 0 : s.focusStrategy) === "first" && (I.current = !0);
|
|
270
|
+
} : void 0);
|
|
271
|
+
let M = he(() => {
|
|
272
|
+
var o, s;
|
|
273
|
+
let p = (s = (o = t.getFirstKey) === null || o === void 0 ? void 0 : o.call(t)) !== null && s !== void 0 ? s : null;
|
|
274
|
+
p == null ? (De(l.current), e.collection.size > 0 && (I.current = !1)) : (e.setFocusedKey(p), I.current = !1);
|
|
275
|
+
});
|
|
276
|
+
be(() => {
|
|
277
|
+
I.current && M();
|
|
278
|
+
}, [
|
|
279
|
+
e.collection,
|
|
280
|
+
M
|
|
281
|
+
]);
|
|
282
|
+
let F = he(() => {
|
|
283
|
+
e.collection.size > 0 && (I.current = !1);
|
|
284
|
+
});
|
|
285
|
+
be(() => {
|
|
286
|
+
F();
|
|
287
|
+
}, [
|
|
288
|
+
e.focusedKey,
|
|
289
|
+
F
|
|
290
|
+
]), J(l, Ve, m ? (o) => {
|
|
291
|
+
var s;
|
|
292
|
+
o.stopPropagation(), e.setFocused(!1), !((s = o.detail) === null || s === void 0) && s.clearFocusKey && e.setFocusedKey(null);
|
|
293
|
+
} : void 0);
|
|
294
|
+
const W = S(i), R = S(!1);
|
|
295
|
+
q(() => {
|
|
296
|
+
if (W.current) {
|
|
297
|
+
var o, s;
|
|
298
|
+
let T = null;
|
|
299
|
+
var p;
|
|
300
|
+
i === "first" && (T = (p = (o = t.getFirstKey) === null || o === void 0 ? void 0 : o.call(t)) !== null && p !== void 0 ? p : null);
|
|
301
|
+
var x;
|
|
302
|
+
i === "last" && (T = (x = (s = t.getLastKey) === null || s === void 0 ? void 0 : s.call(t)) !== null && x !== void 0 ? x : null);
|
|
303
|
+
let D = e.selectedKeys;
|
|
304
|
+
if (D.size) {
|
|
305
|
+
for (let B of D) if (e.canSelectItem(B)) {
|
|
306
|
+
T = B;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
e.setFocused(!0), e.setFocusedKey(T), T == null && !m && l.current && ae(l.current), e.collection.size > 0 && (W.current = !1, R.current = !0);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
let P = S(e.focusedKey), O = S(null);
|
|
314
|
+
q(() => {
|
|
315
|
+
if (e.isFocused && e.focusedKey != null && (e.focusedKey !== P.current || R.current) && b.current && l.current) {
|
|
316
|
+
let o = pe(), s = re(l, e.focusedKey);
|
|
317
|
+
if (!(s instanceof HTMLElement))
|
|
318
|
+
return;
|
|
319
|
+
(o === "keyboard" || R.current) && (O.current && cancelAnimationFrame(O.current), O.current = requestAnimationFrame(() => {
|
|
320
|
+
b.current && (Be(b.current, s), o !== "virtual" && ve(s, {
|
|
321
|
+
containingElement: l.current
|
|
322
|
+
}));
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
!m && e.isFocused && e.focusedKey == null && P.current != null && l.current && ae(l.current), P.current = e.focusedKey, R.current = !1;
|
|
326
|
+
}), q(() => () => {
|
|
327
|
+
O.current && cancelAnimationFrame(O.current);
|
|
328
|
+
}, []), J(l, "react-aria-focus-scope-restore", (o) => {
|
|
329
|
+
o.preventDefault(), e.setFocused(!0);
|
|
330
|
+
});
|
|
331
|
+
let G = {
|
|
332
|
+
onKeyDown: K,
|
|
333
|
+
onFocus: w,
|
|
334
|
+
onBlur: A,
|
|
335
|
+
onMouseDown(o) {
|
|
336
|
+
b.current === o.target && o.preventDefault();
|
|
337
|
+
}
|
|
338
|
+
}, { typeSelectProps: Q } = Xe({
|
|
339
|
+
keyboardDelegate: t,
|
|
340
|
+
selectionManager: e
|
|
341
|
+
});
|
|
342
|
+
E || (G = Y(Q, G));
|
|
343
|
+
let Z;
|
|
344
|
+
m || (Z = e.focusedKey == null ? 0 : -1);
|
|
345
|
+
let X = Ze(e.collection);
|
|
346
|
+
return {
|
|
347
|
+
collectionProps: Y(G, {
|
|
348
|
+
tabIndex: Z,
|
|
349
|
+
"data-collection": X
|
|
350
|
+
})
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function $t(n) {
|
|
354
|
+
let { id: e, selectionManager: t, key: l, ref: i, shouldSelectOnPressUp: c, shouldUseVirtualFocus: r, focus: f, isDisabled: a, onAction: g, allowsDifferentPressOrigin: E, linkBehavior: m = "action" } = n, v = Pe();
|
|
355
|
+
e = we(e);
|
|
356
|
+
let $ = (s) => {
|
|
357
|
+
if (s.pointerType === "keyboard" && fe(s)) t.toggleSelection(l);
|
|
358
|
+
else {
|
|
359
|
+
if (t.selectionMode === "none") return;
|
|
360
|
+
if (t.isLink(l)) {
|
|
361
|
+
if (m === "selection" && i.current) {
|
|
362
|
+
let p = t.getItemProps(l);
|
|
363
|
+
v.open(i.current, s, p.href, p.routerOptions), t.setSelectedKeys(t.selectedKeys);
|
|
364
|
+
return;
|
|
365
|
+
} else if (m === "override" || m === "none") return;
|
|
366
|
+
}
|
|
367
|
+
t.selectionMode === "single" ? t.isSelected(l) && !t.disallowEmptySelection ? t.toggleSelection(l) : t.replaceSelection(l) : s && s.shiftKey ? t.extendSelection(l) : t.selectionBehavior === "toggle" || s && (H(s) || s.pointerType === "touch" || s.pointerType === "virtual") ? t.toggleSelection(l) : t.replaceSelection(l);
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
q(() => {
|
|
371
|
+
l === t.focusedKey && t.isFocused && (r ? De(i.current) : f ? f() : document.activeElement !== i.current && i.current && ae(i.current));
|
|
372
|
+
}, [
|
|
373
|
+
i,
|
|
374
|
+
l,
|
|
375
|
+
t.focusedKey,
|
|
376
|
+
t.childFocusStrategy,
|
|
377
|
+
t.isFocused,
|
|
378
|
+
r
|
|
379
|
+
]), a = a || t.isDisabled(l);
|
|
380
|
+
let b = {};
|
|
381
|
+
!r && !a ? b = {
|
|
382
|
+
tabIndex: l === t.focusedKey ? 0 : -1,
|
|
383
|
+
onFocus(s) {
|
|
384
|
+
s.target === i.current && t.setFocusedKey(l);
|
|
385
|
+
}
|
|
386
|
+
} : a && (b.onMouseDown = (s) => {
|
|
387
|
+
s.preventDefault();
|
|
388
|
+
});
|
|
389
|
+
let k = t.isLink(l) && m === "override", y = t.isLink(l) && m !== "selection" && m !== "none", d = !a && t.canSelectItem(l) && !k, K = (g || y) && !a, h = K && (t.selectionBehavior === "replace" ? !d : !d || t.isEmpty), w = K && d && t.selectionBehavior === "replace", A = h || w, I = S(null), M = A && d, F = S(!1), W = S(!1), R = (s) => {
|
|
390
|
+
if (g && g(), y && i.current) {
|
|
391
|
+
let p = t.getItemProps(l);
|
|
392
|
+
v.open(i.current, s, p.href, p.routerOptions);
|
|
393
|
+
}
|
|
394
|
+
}, P = {
|
|
395
|
+
ref: i
|
|
396
|
+
};
|
|
397
|
+
c ? (P.onPressStart = (s) => {
|
|
398
|
+
I.current = s.pointerType, F.current = M, s.pointerType === "keyboard" && (!A || me()) && $(s);
|
|
399
|
+
}, E ? (P.onPressUp = h ? void 0 : (s) => {
|
|
400
|
+
s.pointerType === "mouse" && d && $(s);
|
|
401
|
+
}, P.onPress = h ? R : (s) => {
|
|
402
|
+
s.pointerType !== "keyboard" && s.pointerType !== "mouse" && d && $(s);
|
|
403
|
+
}) : P.onPress = (s) => {
|
|
404
|
+
if (h || w && s.pointerType !== "mouse") {
|
|
405
|
+
if (s.pointerType === "keyboard" && !$e()) return;
|
|
406
|
+
R(s);
|
|
407
|
+
} else s.pointerType !== "keyboard" && d && $(s);
|
|
408
|
+
}) : (P.onPressStart = (s) => {
|
|
409
|
+
I.current = s.pointerType, F.current = M, W.current = h, d && (s.pointerType === "mouse" && !h || s.pointerType === "keyboard" && (!K || me())) && $(s);
|
|
410
|
+
}, P.onPress = (s) => {
|
|
411
|
+
(s.pointerType === "touch" || s.pointerType === "pen" || s.pointerType === "virtual" || s.pointerType === "keyboard" && A && $e() || s.pointerType === "mouse" && W.current) && (A ? R(s) : d && $(s));
|
|
412
|
+
}), b["data-collection"] = Je(t.collection), b["data-key"] = l, P.preventFocusOnPress = r, r && (P = Y(P, {
|
|
413
|
+
onPressStart(s) {
|
|
414
|
+
s.pointerType !== "touch" && (t.setFocused(!0), t.setFocusedKey(l));
|
|
415
|
+
},
|
|
416
|
+
onPress(s) {
|
|
417
|
+
s.pointerType === "touch" && (t.setFocused(!0), t.setFocusedKey(l));
|
|
418
|
+
}
|
|
419
|
+
}));
|
|
420
|
+
let { pressProps: O, isPressed: G } = Fe(P), Q = w ? (s) => {
|
|
421
|
+
I.current === "mouse" && (s.stopPropagation(), s.preventDefault(), R(s));
|
|
422
|
+
} : void 0, { longPressProps: Z } = Ge({
|
|
423
|
+
isDisabled: !M,
|
|
424
|
+
onLongPress(s) {
|
|
425
|
+
s.pointerType === "touch" && ($(s), t.setSelectionBehavior("toggle"));
|
|
426
|
+
}
|
|
427
|
+
}), X = (s) => {
|
|
428
|
+
I.current === "touch" && F.current && s.preventDefault();
|
|
429
|
+
}, o = t.isLink(l) ? (s) => {
|
|
430
|
+
Me.isOpening || s.preventDefault();
|
|
431
|
+
} : void 0;
|
|
432
|
+
return {
|
|
433
|
+
itemProps: Y(
|
|
434
|
+
b,
|
|
435
|
+
d || h || r && !a ? O : {},
|
|
436
|
+
M ? Z : {},
|
|
437
|
+
{
|
|
438
|
+
onDoubleClick: Q,
|
|
439
|
+
onDragStartCapture: X,
|
|
440
|
+
onClick: o,
|
|
441
|
+
id: e
|
|
442
|
+
},
|
|
443
|
+
// Prevent DOM focus from moving on mouse down when using virtual focus
|
|
444
|
+
r ? {
|
|
445
|
+
onMouseDown: (s) => s.preventDefault()
|
|
446
|
+
} : void 0
|
|
447
|
+
),
|
|
448
|
+
isPressed: G,
|
|
449
|
+
isSelected: t.isSelected(l),
|
|
450
|
+
isFocused: t.isFocused && t.focusedKey === l,
|
|
451
|
+
isDisabled: a,
|
|
452
|
+
allowsSelection: d,
|
|
453
|
+
hasAction: A
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
function $e() {
|
|
457
|
+
let n = window.event;
|
|
458
|
+
return (n == null ? void 0 : n.key) === "Enter";
|
|
459
|
+
}
|
|
460
|
+
function me() {
|
|
461
|
+
let n = window.event;
|
|
462
|
+
return (n == null ? void 0 : n.key) === " " || (n == null ? void 0 : n.code) === "Space";
|
|
463
|
+
}
|
|
464
|
+
class _e {
|
|
465
|
+
build(e, t) {
|
|
466
|
+
return this.context = t, ge(() => this.iterateCollection(e));
|
|
467
|
+
}
|
|
468
|
+
*iterateCollection(e) {
|
|
469
|
+
let { children: t, items: l } = e;
|
|
470
|
+
if (V.isValidElement(t) && t.type === V.Fragment) yield* this.iterateCollection({
|
|
471
|
+
children: t.props.children,
|
|
472
|
+
items: l
|
|
473
|
+
});
|
|
474
|
+
else if (typeof t == "function") {
|
|
475
|
+
if (!l) throw new Error("props.children was a function but props.items is missing");
|
|
476
|
+
let i = 0;
|
|
477
|
+
for (let c of l)
|
|
478
|
+
yield* this.getFullNode({
|
|
479
|
+
value: c,
|
|
480
|
+
index: i
|
|
481
|
+
}, {
|
|
482
|
+
renderer: t
|
|
483
|
+
}), i++;
|
|
484
|
+
} else {
|
|
485
|
+
let i = [];
|
|
486
|
+
V.Children.forEach(t, (r) => {
|
|
487
|
+
r && i.push(r);
|
|
488
|
+
});
|
|
489
|
+
let c = 0;
|
|
490
|
+
for (let r of i) {
|
|
491
|
+
let f = this.getFullNode({
|
|
492
|
+
element: r,
|
|
493
|
+
index: c
|
|
494
|
+
}, {});
|
|
495
|
+
for (let a of f)
|
|
496
|
+
c++, yield a;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
getKey(e, t, l, i) {
|
|
501
|
+
if (e.key != null) return e.key;
|
|
502
|
+
if (t.type === "cell" && t.key != null) return `${i}${t.key}`;
|
|
503
|
+
let c = t.value;
|
|
504
|
+
if (c != null) {
|
|
505
|
+
var r;
|
|
506
|
+
let f = (r = c.key) !== null && r !== void 0 ? r : c.id;
|
|
507
|
+
if (f == null) throw new Error("No key found for item");
|
|
508
|
+
return f;
|
|
509
|
+
}
|
|
510
|
+
return i ? `${i}.${t.index}` : `$.${t.index}`;
|
|
511
|
+
}
|
|
512
|
+
getChildState(e, t) {
|
|
513
|
+
return {
|
|
514
|
+
renderer: t.renderer || e.renderer
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
*getFullNode(e, t, l, i) {
|
|
518
|
+
if (V.isValidElement(e.element) && e.element.type === V.Fragment) {
|
|
519
|
+
let y = [];
|
|
520
|
+
V.Children.forEach(e.element.props.children, (K) => {
|
|
521
|
+
y.push(K);
|
|
522
|
+
});
|
|
523
|
+
var c;
|
|
524
|
+
let d = (c = e.index) !== null && c !== void 0 ? c : 0;
|
|
525
|
+
for (const K of y) yield* this.getFullNode({
|
|
526
|
+
element: K,
|
|
527
|
+
index: d++
|
|
528
|
+
}, t, l, i);
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
let r = e.element;
|
|
532
|
+
if (!r && e.value && t && t.renderer) {
|
|
533
|
+
let y = this.cache.get(e.value);
|
|
534
|
+
if (y && (!y.shouldInvalidate || !y.shouldInvalidate(this.context))) {
|
|
535
|
+
y.index = e.index, y.parentKey = i ? i.key : null, yield y;
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
r = t.renderer(e.value);
|
|
539
|
+
}
|
|
540
|
+
if (V.isValidElement(r)) {
|
|
541
|
+
let y = r.type;
|
|
542
|
+
if (typeof y != "function" && typeof y.getCollectionNode != "function") {
|
|
543
|
+
let w = r.type;
|
|
544
|
+
throw new Error(`Unknown element <${w}> in collection.`);
|
|
545
|
+
}
|
|
546
|
+
let d = y.getCollectionNode(r.props, this.context);
|
|
547
|
+
var f;
|
|
548
|
+
let K = (f = e.index) !== null && f !== void 0 ? f : 0, h = d.next();
|
|
549
|
+
for (; !h.done && h.value; ) {
|
|
550
|
+
let w = h.value;
|
|
551
|
+
e.index = K;
|
|
552
|
+
var a;
|
|
553
|
+
let A = (a = w.key) !== null && a !== void 0 ? a : null;
|
|
554
|
+
A == null && (A = w.element ? null : this.getKey(r, e, t, l));
|
|
555
|
+
let M = [
|
|
556
|
+
...this.getFullNode({
|
|
557
|
+
...w,
|
|
558
|
+
key: A,
|
|
559
|
+
index: K,
|
|
560
|
+
wrapper: et(e.wrapper, w.wrapper)
|
|
561
|
+
}, this.getChildState(t, w), l ? `${l}${r.key}` : r.key, i)
|
|
562
|
+
];
|
|
563
|
+
for (let F of M) {
|
|
564
|
+
var g, E;
|
|
565
|
+
F.value = (E = (g = w.value) !== null && g !== void 0 ? g : e.value) !== null && E !== void 0 ? E : null, F.value && this.cache.set(F.value, F);
|
|
566
|
+
var m;
|
|
567
|
+
if (e.type && F.type !== e.type) throw new Error(`Unsupported type <${oe(F.type)}> in <${oe((m = i == null ? void 0 : i.type) !== null && m !== void 0 ? m : "unknown parent type")}>. Only <${oe(e.type)}> is supported.`);
|
|
568
|
+
K++, yield F;
|
|
569
|
+
}
|
|
570
|
+
h = d.next(M);
|
|
571
|
+
}
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (e.key == null || e.type == null) return;
|
|
575
|
+
let v = this;
|
|
576
|
+
var $, b;
|
|
577
|
+
let k = {
|
|
578
|
+
type: e.type,
|
|
579
|
+
props: e.props,
|
|
580
|
+
key: e.key,
|
|
581
|
+
parentKey: i ? i.key : null,
|
|
582
|
+
value: ($ = e.value) !== null && $ !== void 0 ? $ : null,
|
|
583
|
+
level: i ? i.level + 1 : 0,
|
|
584
|
+
index: e.index,
|
|
585
|
+
rendered: e.rendered,
|
|
586
|
+
textValue: (b = e.textValue) !== null && b !== void 0 ? b : "",
|
|
587
|
+
"aria-label": e["aria-label"],
|
|
588
|
+
wrapper: e.wrapper,
|
|
589
|
+
shouldInvalidate: e.shouldInvalidate,
|
|
590
|
+
hasChildNodes: e.hasChildNodes || !1,
|
|
591
|
+
childNodes: ge(function* () {
|
|
592
|
+
if (!e.hasChildNodes || !e.childNodes) return;
|
|
593
|
+
let y = 0;
|
|
594
|
+
for (let d of e.childNodes()) {
|
|
595
|
+
d.key != null && (d.key = `${k.key}${d.key}`);
|
|
596
|
+
let K = v.getFullNode({
|
|
597
|
+
...d,
|
|
598
|
+
index: y
|
|
599
|
+
}, v.getChildState(t, d), k.key, k);
|
|
600
|
+
for (let h of K)
|
|
601
|
+
y++, yield h;
|
|
602
|
+
}
|
|
603
|
+
})
|
|
604
|
+
};
|
|
605
|
+
yield k;
|
|
606
|
+
}
|
|
607
|
+
constructor() {
|
|
608
|
+
this.cache = /* @__PURE__ */ new WeakMap();
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function ge(n) {
|
|
612
|
+
let e = [], t = null;
|
|
613
|
+
return {
|
|
614
|
+
*[Symbol.iterator]() {
|
|
615
|
+
for (let l of e) yield l;
|
|
616
|
+
t || (t = n());
|
|
617
|
+
for (let l of t)
|
|
618
|
+
e.push(l), yield l;
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
function et(n, e) {
|
|
623
|
+
if (n && e) return (t) => n(e(t));
|
|
624
|
+
if (n) return n;
|
|
625
|
+
if (e) return e;
|
|
626
|
+
}
|
|
627
|
+
function oe(n) {
|
|
628
|
+
return n[0].toUpperCase() + n.slice(1);
|
|
629
|
+
}
|
|
630
|
+
function mt(n, e, t) {
|
|
631
|
+
let l = j(() => new _e(), []), { children: i, items: c, collection: r } = n;
|
|
632
|
+
return j(() => {
|
|
633
|
+
if (r) return r;
|
|
634
|
+
let a = l.build({
|
|
635
|
+
children: i,
|
|
636
|
+
items: c
|
|
637
|
+
}, t);
|
|
638
|
+
return e(a);
|
|
639
|
+
}, [
|
|
640
|
+
l,
|
|
641
|
+
i,
|
|
642
|
+
c,
|
|
643
|
+
r,
|
|
644
|
+
t,
|
|
645
|
+
e
|
|
646
|
+
]);
|
|
647
|
+
}
|
|
648
|
+
function tt(n, e) {
|
|
649
|
+
return typeof e.getChildren == "function" ? e.getChildren(n.key) : n.childNodes;
|
|
650
|
+
}
|
|
651
|
+
function lt(n) {
|
|
652
|
+
return it(n, 0);
|
|
653
|
+
}
|
|
654
|
+
function it(n, e) {
|
|
655
|
+
if (e < 0) return;
|
|
656
|
+
let t = 0;
|
|
657
|
+
for (let l of n) {
|
|
658
|
+
if (t === e) return l;
|
|
659
|
+
t++;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
function gt(n) {
|
|
663
|
+
let e;
|
|
664
|
+
for (let t of n) e = t;
|
|
665
|
+
return e;
|
|
666
|
+
}
|
|
667
|
+
function ce(n, e, t) {
|
|
668
|
+
if (e.parentKey === t.parentKey) return e.index - t.index;
|
|
669
|
+
let l = [
|
|
670
|
+
...Ke(n, e),
|
|
671
|
+
e
|
|
672
|
+
], i = [
|
|
673
|
+
...Ke(n, t),
|
|
674
|
+
t
|
|
675
|
+
], c = l.slice(0, i.length).findIndex((r, f) => r !== i[f]);
|
|
676
|
+
return c !== -1 ? (e = l[c], t = i[c], e.index - t.index) : l.findIndex((r) => r === t) >= 0 ? 1 : (i.findIndex((r) => r === e) >= 0, -1);
|
|
677
|
+
}
|
|
678
|
+
function Ke(n, e) {
|
|
679
|
+
let t = [], l = e;
|
|
680
|
+
for (; (l == null ? void 0 : l.parentKey) != null; )
|
|
681
|
+
l = n.getItem(l.parentKey), l && t.unshift(l);
|
|
682
|
+
return t;
|
|
683
|
+
}
|
|
684
|
+
class C extends Set {
|
|
685
|
+
constructor(e, t, l) {
|
|
686
|
+
super(e), e instanceof C ? (this.anchorKey = t ?? e.anchorKey, this.currentKey = l ?? e.currentKey) : (this.anchorKey = t ?? null, this.currentKey = l ?? null);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
function nt(n, e) {
|
|
690
|
+
if (n.size !== e.size) return !1;
|
|
691
|
+
for (let t of n)
|
|
692
|
+
if (!e.has(t)) return !1;
|
|
693
|
+
return !0;
|
|
694
|
+
}
|
|
695
|
+
function Kt(n) {
|
|
696
|
+
let { selectionMode: e = "none", disallowEmptySelection: t = !1, allowDuplicateSelectionEvents: l, selectionBehavior: i = "toggle", disabledBehavior: c = "all" } = n, r = S(!1), [, f] = se(!1), a = S(null), g = S(null), [, E] = se(null), m = j(() => Se(n.selectedKeys), [
|
|
697
|
+
n.selectedKeys
|
|
698
|
+
]), v = j(() => Se(n.defaultSelectedKeys, new C()), [
|
|
699
|
+
n.defaultSelectedKeys
|
|
700
|
+
]), [$, b] = Ue(m, v, n.onSelectionChange), k = j(() => n.disabledKeys ? new Set(n.disabledKeys) : /* @__PURE__ */ new Set(), [
|
|
701
|
+
n.disabledKeys
|
|
702
|
+
]), [y, d] = se(i);
|
|
703
|
+
i === "replace" && y === "toggle" && typeof $ == "object" && $.size === 0 && d("replace");
|
|
704
|
+
let K = S(i);
|
|
705
|
+
return q(() => {
|
|
706
|
+
i !== K.current && (d(i), K.current = i);
|
|
707
|
+
}, [
|
|
708
|
+
i
|
|
709
|
+
]), {
|
|
710
|
+
selectionMode: e,
|
|
711
|
+
disallowEmptySelection: t,
|
|
712
|
+
selectionBehavior: y,
|
|
713
|
+
setSelectionBehavior: d,
|
|
714
|
+
get isFocused() {
|
|
715
|
+
return r.current;
|
|
716
|
+
},
|
|
717
|
+
setFocused(h) {
|
|
718
|
+
r.current = h, f(h);
|
|
719
|
+
},
|
|
720
|
+
get focusedKey() {
|
|
721
|
+
return a.current;
|
|
722
|
+
},
|
|
723
|
+
get childFocusStrategy() {
|
|
724
|
+
return g.current;
|
|
725
|
+
},
|
|
726
|
+
setFocusedKey(h, w = "first") {
|
|
727
|
+
a.current = h, g.current = w, E(h);
|
|
728
|
+
},
|
|
729
|
+
selectedKeys: $,
|
|
730
|
+
setSelectedKeys(h) {
|
|
731
|
+
(l || !nt(h, $)) && b(h);
|
|
732
|
+
},
|
|
733
|
+
disabledKeys: k,
|
|
734
|
+
disabledBehavior: c
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
function Se(n, e) {
|
|
738
|
+
return n ? n === "all" ? "all" : new C(n) : e;
|
|
739
|
+
}
|
|
740
|
+
class Ee {
|
|
741
|
+
/**
|
|
742
|
+
* The type of selection that is allowed in the collection.
|
|
743
|
+
*/
|
|
744
|
+
get selectionMode() {
|
|
745
|
+
return this.state.selectionMode;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Whether the collection allows empty selection.
|
|
749
|
+
*/
|
|
750
|
+
get disallowEmptySelection() {
|
|
751
|
+
return this.state.disallowEmptySelection;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* The selection behavior for the collection.
|
|
755
|
+
*/
|
|
756
|
+
get selectionBehavior() {
|
|
757
|
+
return this.state.selectionBehavior;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Sets the selection behavior for the collection.
|
|
761
|
+
*/
|
|
762
|
+
setSelectionBehavior(e) {
|
|
763
|
+
this.state.setSelectionBehavior(e);
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Whether the collection is currently focused.
|
|
767
|
+
*/
|
|
768
|
+
get isFocused() {
|
|
769
|
+
return this.state.isFocused;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Sets whether the collection is focused.
|
|
773
|
+
*/
|
|
774
|
+
setFocused(e) {
|
|
775
|
+
this.state.setFocused(e);
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* The current focused key in the collection.
|
|
779
|
+
*/
|
|
780
|
+
get focusedKey() {
|
|
781
|
+
return this.state.focusedKey;
|
|
782
|
+
}
|
|
783
|
+
/** Whether the first or last child of the focused key should receive focus. */
|
|
784
|
+
get childFocusStrategy() {
|
|
785
|
+
return this.state.childFocusStrategy;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Sets the focused key.
|
|
789
|
+
*/
|
|
790
|
+
setFocusedKey(e, t) {
|
|
791
|
+
(e == null || this.collection.getItem(e)) && this.state.setFocusedKey(e, t);
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* The currently selected keys in the collection.
|
|
795
|
+
*/
|
|
796
|
+
get selectedKeys() {
|
|
797
|
+
return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* The raw selection value for the collection.
|
|
801
|
+
* Either 'all' for select all, or a set of keys.
|
|
802
|
+
*/
|
|
803
|
+
get rawSelection() {
|
|
804
|
+
return this.state.selectedKeys;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Returns whether a key is selected.
|
|
808
|
+
*/
|
|
809
|
+
isSelected(e) {
|
|
810
|
+
if (this.state.selectionMode === "none") return !1;
|
|
811
|
+
let t = this.getKey(e);
|
|
812
|
+
return t == null ? !1 : this.state.selectedKeys === "all" ? this.canSelectItem(t) : this.state.selectedKeys.has(t);
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Whether the selection is empty.
|
|
816
|
+
*/
|
|
817
|
+
get isEmpty() {
|
|
818
|
+
return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Whether all items in the collection are selected.
|
|
822
|
+
*/
|
|
823
|
+
get isSelectAll() {
|
|
824
|
+
if (this.isEmpty) return !1;
|
|
825
|
+
if (this.state.selectedKeys === "all") return !0;
|
|
826
|
+
if (this._isSelectAll != null) return this._isSelectAll;
|
|
827
|
+
let e = this.getSelectAllKeys(), t = this.state.selectedKeys;
|
|
828
|
+
return this._isSelectAll = e.every((l) => t.has(l)), this._isSelectAll;
|
|
829
|
+
}
|
|
830
|
+
get firstSelectedKey() {
|
|
831
|
+
let e = null;
|
|
832
|
+
for (let l of this.state.selectedKeys) {
|
|
833
|
+
let i = this.collection.getItem(l);
|
|
834
|
+
(!e || i && ce(this.collection, i, e) < 0) && (e = i);
|
|
835
|
+
}
|
|
836
|
+
var t;
|
|
837
|
+
return (t = e == null ? void 0 : e.key) !== null && t !== void 0 ? t : null;
|
|
838
|
+
}
|
|
839
|
+
get lastSelectedKey() {
|
|
840
|
+
let e = null;
|
|
841
|
+
for (let l of this.state.selectedKeys) {
|
|
842
|
+
let i = this.collection.getItem(l);
|
|
843
|
+
(!e || i && ce(this.collection, i, e) > 0) && (e = i);
|
|
844
|
+
}
|
|
845
|
+
var t;
|
|
846
|
+
return (t = e == null ? void 0 : e.key) !== null && t !== void 0 ? t : null;
|
|
847
|
+
}
|
|
848
|
+
get disabledKeys() {
|
|
849
|
+
return this.state.disabledKeys;
|
|
850
|
+
}
|
|
851
|
+
get disabledBehavior() {
|
|
852
|
+
return this.state.disabledBehavior;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Extends the selection to the given key.
|
|
856
|
+
*/
|
|
857
|
+
extendSelection(e) {
|
|
858
|
+
if (this.selectionMode === "none") return;
|
|
859
|
+
if (this.selectionMode === "single") {
|
|
860
|
+
this.replaceSelection(e);
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
let t = this.getKey(e);
|
|
864
|
+
if (t == null) return;
|
|
865
|
+
let l;
|
|
866
|
+
if (this.state.selectedKeys === "all") l = new C([
|
|
867
|
+
t
|
|
868
|
+
], t, t);
|
|
869
|
+
else {
|
|
870
|
+
let r = this.state.selectedKeys;
|
|
871
|
+
var i;
|
|
872
|
+
let f = (i = r.anchorKey) !== null && i !== void 0 ? i : t;
|
|
873
|
+
l = new C(r, f, t);
|
|
874
|
+
var c;
|
|
875
|
+
for (let a of this.getKeyRange(f, (c = r.currentKey) !== null && c !== void 0 ? c : t)) l.delete(a);
|
|
876
|
+
for (let a of this.getKeyRange(t, f)) this.canSelectItem(a) && l.add(a);
|
|
877
|
+
}
|
|
878
|
+
this.state.setSelectedKeys(l);
|
|
879
|
+
}
|
|
880
|
+
getKeyRange(e, t) {
|
|
881
|
+
let l = this.collection.getItem(e), i = this.collection.getItem(t);
|
|
882
|
+
return l && i ? ce(this.collection, l, i) <= 0 ? this.getKeyRangeInternal(e, t) : this.getKeyRangeInternal(t, e) : [];
|
|
883
|
+
}
|
|
884
|
+
getKeyRangeInternal(e, t) {
|
|
885
|
+
var l;
|
|
886
|
+
if (!((l = this.layoutDelegate) === null || l === void 0) && l.getKeyRange) return this.layoutDelegate.getKeyRange(e, t);
|
|
887
|
+
let i = [], c = e;
|
|
888
|
+
for (; c != null; ) {
|
|
889
|
+
let r = this.collection.getItem(c);
|
|
890
|
+
if (r && (r.type === "item" || r.type === "cell" && this.allowsCellSelection) && i.push(c), c === t) return i;
|
|
891
|
+
c = this.collection.getKeyAfter(c);
|
|
892
|
+
}
|
|
893
|
+
return [];
|
|
894
|
+
}
|
|
895
|
+
getKey(e) {
|
|
896
|
+
let t = this.collection.getItem(e);
|
|
897
|
+
if (!t || t.type === "cell" && this.allowsCellSelection) return e;
|
|
898
|
+
for (; t && t.type !== "item" && t.parentKey != null; ) t = this.collection.getItem(t.parentKey);
|
|
899
|
+
return !t || t.type !== "item" ? null : t.key;
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Toggles whether the given key is selected.
|
|
903
|
+
*/
|
|
904
|
+
toggleSelection(e) {
|
|
905
|
+
if (this.selectionMode === "none") return;
|
|
906
|
+
if (this.selectionMode === "single" && !this.isSelected(e)) {
|
|
907
|
+
this.replaceSelection(e);
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
let t = this.getKey(e);
|
|
911
|
+
if (t == null) return;
|
|
912
|
+
let l = new C(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
|
|
913
|
+
l.has(t) ? l.delete(t) : this.canSelectItem(t) && (l.add(t), l.anchorKey = t, l.currentKey = t), !(this.disallowEmptySelection && l.size === 0) && this.state.setSelectedKeys(l);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Replaces the selection with only the given key.
|
|
917
|
+
*/
|
|
918
|
+
replaceSelection(e) {
|
|
919
|
+
if (this.selectionMode === "none") return;
|
|
920
|
+
let t = this.getKey(e);
|
|
921
|
+
if (t == null) return;
|
|
922
|
+
let l = this.canSelectItem(t) ? new C([
|
|
923
|
+
t
|
|
924
|
+
], t, t) : new C();
|
|
925
|
+
this.state.setSelectedKeys(l);
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Replaces the selection with the given keys.
|
|
929
|
+
*/
|
|
930
|
+
setSelectedKeys(e) {
|
|
931
|
+
if (this.selectionMode === "none") return;
|
|
932
|
+
let t = new C();
|
|
933
|
+
for (let l of e) {
|
|
934
|
+
let i = this.getKey(l);
|
|
935
|
+
if (i != null && (t.add(i), this.selectionMode === "single"))
|
|
936
|
+
break;
|
|
937
|
+
}
|
|
938
|
+
this.state.setSelectedKeys(t);
|
|
939
|
+
}
|
|
940
|
+
getSelectAllKeys() {
|
|
941
|
+
let e = [], t = (l) => {
|
|
942
|
+
for (; l != null; ) {
|
|
943
|
+
if (this.canSelectItem(l)) {
|
|
944
|
+
var i;
|
|
945
|
+
let r = this.collection.getItem(l);
|
|
946
|
+
(r == null ? void 0 : r.type) === "item" && e.push(l);
|
|
947
|
+
var c;
|
|
948
|
+
r != null && r.hasChildNodes && (this.allowsCellSelection || r.type !== "item") && t((c = (i = lt(tt(r, this.collection))) === null || i === void 0 ? void 0 : i.key) !== null && c !== void 0 ? c : null);
|
|
949
|
+
}
|
|
950
|
+
l = this.collection.getKeyAfter(l);
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
return t(this.collection.getFirstKey()), e;
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Selects all items in the collection.
|
|
957
|
+
*/
|
|
958
|
+
selectAll() {
|
|
959
|
+
!this.isSelectAll && this.selectionMode === "multiple" && this.state.setSelectedKeys("all");
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Removes all keys from the selection.
|
|
963
|
+
*/
|
|
964
|
+
clearSelection() {
|
|
965
|
+
!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0) && this.state.setSelectedKeys(new C());
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Toggles between select all and an empty selection.
|
|
969
|
+
*/
|
|
970
|
+
toggleSelectAll() {
|
|
971
|
+
this.isSelectAll ? this.clearSelection() : this.selectAll();
|
|
972
|
+
}
|
|
973
|
+
select(e, t) {
|
|
974
|
+
this.selectionMode !== "none" && (this.selectionMode === "single" ? this.isSelected(e) && !this.disallowEmptySelection ? this.toggleSelection(e) : this.replaceSelection(e) : this.selectionBehavior === "toggle" || t && (t.pointerType === "touch" || t.pointerType === "virtual") ? this.toggleSelection(e) : this.replaceSelection(e));
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Returns whether the current selection is equal to the given selection.
|
|
978
|
+
*/
|
|
979
|
+
isSelectionEqual(e) {
|
|
980
|
+
if (e === this.state.selectedKeys) return !0;
|
|
981
|
+
let t = this.selectedKeys;
|
|
982
|
+
if (e.size !== t.size) return !1;
|
|
983
|
+
for (let l of e)
|
|
984
|
+
if (!t.has(l)) return !1;
|
|
985
|
+
for (let l of t)
|
|
986
|
+
if (!e.has(l)) return !1;
|
|
987
|
+
return !0;
|
|
988
|
+
}
|
|
989
|
+
canSelectItem(e) {
|
|
990
|
+
var t;
|
|
991
|
+
if (this.state.selectionMode === "none" || this.state.disabledKeys.has(e)) return !1;
|
|
992
|
+
let l = this.collection.getItem(e);
|
|
993
|
+
return !(!l || !(l == null || (t = l.props) === null || t === void 0) && t.isDisabled || l.type === "cell" && !this.allowsCellSelection);
|
|
994
|
+
}
|
|
995
|
+
isDisabled(e) {
|
|
996
|
+
var t, l;
|
|
997
|
+
return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(e) || !!(!((l = this.collection.getItem(e)) === null || l === void 0 || (t = l.props) === null || t === void 0) && t.isDisabled));
|
|
998
|
+
}
|
|
999
|
+
isLink(e) {
|
|
1000
|
+
var t, l;
|
|
1001
|
+
return !!(!((l = this.collection.getItem(e)) === null || l === void 0 || (t = l.props) === null || t === void 0) && t.href);
|
|
1002
|
+
}
|
|
1003
|
+
getItemProps(e) {
|
|
1004
|
+
var t;
|
|
1005
|
+
return (t = this.collection.getItem(e)) === null || t === void 0 ? void 0 : t.props;
|
|
1006
|
+
}
|
|
1007
|
+
withCollection(e) {
|
|
1008
|
+
return new Ee(e, this.state, {
|
|
1009
|
+
allowsCellSelection: this.allowsCellSelection,
|
|
1010
|
+
layoutDelegate: this.layoutDelegate || void 0
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
constructor(e, t, l) {
|
|
1014
|
+
this.collection = e, this.state = t;
|
|
1015
|
+
var i;
|
|
1016
|
+
this.allowsCellSelection = (i = l == null ? void 0 : l.allowsCellSelection) !== null && i !== void 0 ? i : !1, this._isSelectAll = null, this.layoutDelegate = (l == null ? void 0 : l.layoutDelegate) || null;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
export {
|
|
1020
|
+
re as $,
|
|
1021
|
+
Kt as a,
|
|
1022
|
+
mt as b,
|
|
1023
|
+
Ee as c,
|
|
1024
|
+
$t as d,
|
|
1025
|
+
bt as e,
|
|
1026
|
+
tt as f,
|
|
1027
|
+
Xe as g,
|
|
1028
|
+
je as h,
|
|
1029
|
+
gt as i,
|
|
1030
|
+
lt as j,
|
|
1031
|
+
it as k,
|
|
1032
|
+
Ge as l
|
|
1033
|
+
};
|