@arc-ui/components 12.0.0-beta.5 → 12.0.0-beta7
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/dist/Alert/Alert.cjs.js +9 -10
- package/dist/Alert/Alert.esm.js +4 -5
- package/dist/Alert/styles.css +1 -0
- package/dist/Align/Align.cjs.js +7 -8
- package/dist/Align/Align.esm.js +1 -2
- package/dist/Align/styles.css +1 -0
- package/dist/AppButton/AppButton.cjs.js +4 -3
- package/dist/AppButton/AppButton.esm.js +4 -3
- package/dist/AppButton/styles.css +1 -0
- package/dist/Avatar/Avatar.cjs.js +7 -8
- package/dist/Avatar/Avatar.esm.js +7 -8
- package/dist/Avatar/styles.css +1 -0
- package/dist/AvatarGroup/AvatarGroup.cjs.js +14 -15
- package/dist/AvatarGroup/AvatarGroup.esm.js +7 -8
- package/dist/AvatarGroup/styles.css +1 -0
- package/dist/Badge/Badge.cjs.js +5 -13
- package/dist/Badge/Badge.esm.js +4 -12
- package/dist/Badge/styles.css +1 -0
- package/dist/Box/Box.cjs.js +6 -24
- package/dist/Box/Box.esm.js +5 -23
- package/dist/Box/styles.css +1 -0
- package/dist/BrandLogo/BrandLogo.cjs.js +3 -4
- package/dist/BrandLogo/BrandLogo.esm.js +3 -4
- package/dist/BrandLogo/styles.css +1 -0
- package/dist/Breadcrumbs/Breadcrumbs.cjs.js +4 -5
- package/dist/Breadcrumbs/Breadcrumbs.esm.js +4 -5
- package/dist/Breadcrumbs/styles.css +1 -0
- package/dist/Button/Button.cjs.js +5 -6
- package/dist/Button/Button.esm.js +5 -6
- package/dist/Button/styles.css +1 -0
- package/dist/ButtonV2/ButtonV2.cjs.js +5 -6
- package/dist/ButtonV2/ButtonV2.esm.js +5 -6
- package/dist/ButtonV2/styles.css +1 -0
- package/dist/Calendar/Calendar.cjs.js +9 -10
- package/dist/Calendar/Calendar.esm.js +9 -10
- package/dist/Calendar/styles.css +1 -0
- package/dist/CardFooter/CardFooter.cjs.js +17 -0
- package/dist/CardFooter/CardFooter.esm.js +9 -0
- package/dist/CardFooter/package.json +7 -0
- package/dist/CardFooter/styles.css +1 -0
- package/dist/CardHeading/CardHeading.cjs.js +14 -0
- package/dist/CardHeading/CardHeading.esm.js +6 -0
- package/dist/CardHeading/package.json +7 -0
- package/dist/CardHeading/styles.css +1 -0
- package/dist/Carousel/Carousel.cjs.js +457 -0
- package/dist/Carousel/Carousel.esm.js +431 -0
- package/dist/Carousel/package.json +7 -0
- package/dist/Carousel/styles.css +1 -0
- package/dist/Checkbox/Checkbox.cjs.js +8 -9
- package/dist/Checkbox/Checkbox.esm.js +8 -9
- package/dist/Checkbox/styles.css +1 -0
- package/dist/Columns/Columns.cjs.js +2 -3
- package/dist/Columns/Columns.esm.js +2 -3
- package/dist/Columns/styles.css +1 -0
- package/dist/ConditionalWrapper/ConditionalWrapper.cjs.js +10 -0
- package/dist/ConditionalWrapper/ConditionalWrapper.esm.js +2 -0
- package/dist/ConditionalWrapper/package.json +7 -0
- package/dist/ContentSwitcher/ContentSwitcher.cjs.js +20 -0
- package/dist/ContentSwitcher/ContentSwitcher.esm.js +12 -0
- package/dist/ContentSwitcher/package.json +7 -0
- package/dist/ContentSwitcher/styles.css +1 -0
- package/dist/ContentSwitcherDropdown/ContentSwitcherDropdown.cjs.js +23 -0
- package/dist/ContentSwitcherDropdown/ContentSwitcherDropdown.esm.js +15 -0
- package/dist/ContentSwitcherDropdown/package.json +7 -0
- package/dist/ContentSwitcherDropdown/styles.css +1 -0
- package/dist/DatePicker/DatePicker.cjs.js +18 -22
- package/dist/DatePicker/DatePicker.esm.js +18 -22
- package/dist/DatePicker/styles.css +1 -0
- package/dist/Disclosure/Disclosure.cjs.js +8 -9
- package/dist/Disclosure/Disclosure.esm.js +4 -5
- package/dist/Disclosure/styles.css +1 -0
- package/dist/DisclosureMini/DisclosureMini.cjs.js +5 -6
- package/dist/DisclosureMini/DisclosureMini.esm.js +5 -6
- package/dist/DisclosureMini/styles.css +1 -0
- package/dist/Elevation/Elevation.cjs.js +5 -5
- package/dist/Elevation/Elevation.esm.js +1 -1
- package/dist/Elevation/styles.css +1 -0
- package/dist/Filter/Filter.cjs.js +4 -4
- package/dist/Filter/Filter.esm.js +4 -4
- package/dist/Filter/styles.css +1 -0
- package/dist/FormControl/FormControl.cjs.js +7 -8
- package/dist/FormControl/FormControl.esm.js +7 -8
- package/dist/FormControl/styles.css +1 -0
- package/dist/Grid/Grid.cjs.js +2 -3
- package/dist/Grid/Grid.esm.js +2 -3
- package/dist/Grid/styles.css +1 -0
- package/dist/Group/Group.cjs.js +3 -3
- package/dist/Group/Group.esm.js +3 -3
- package/dist/Group/styles.css +1 -0
- package/dist/Heading/Heading.cjs.js +3 -4
- package/dist/Heading/Heading.esm.js +3 -4
- package/dist/Heading/styles.css +1 -0
- package/dist/HeroBanner/HeroBanner.cjs.js +63 -0
- package/dist/HeroBanner/HeroBanner.esm.js +55 -0
- package/dist/HeroBanner/package.json +7 -0
- package/dist/HeroBanner/styles.css +1 -0
- package/dist/HeroButton/HeroButton.cjs.js +5 -6
- package/dist/HeroButton/HeroButton.esm.js +5 -6
- package/dist/HeroButton/styles.css +1 -0
- package/dist/Hidden/Hidden.cjs.js +5 -5
- package/dist/Hidden/Hidden.esm.js +1 -1
- package/dist/Hidden/styles.css +1 -0
- package/dist/Icon/Icon.cjs.js +3 -4
- package/dist/Icon/Icon.esm.js +3 -4
- package/dist/Icon/styles.css +1 -0
- package/dist/Image/Image.cjs.js +2 -3
- package/dist/Image/Image.esm.js +2 -3
- package/dist/Image/styles.css +1 -0
- package/dist/ImpactCard/ImpactCard.cjs.js +16 -17
- package/dist/ImpactCard/ImpactCard.esm.js +10 -11
- package/dist/ImpactCard/styles.css +1 -0
- package/dist/InformationCard/InformationCard.cjs.js +37 -51
- package/dist/InformationCard/InformationCard.esm.js +34 -48
- package/dist/InformationCard/styles.css +1 -0
- package/dist/Link/Link.cjs.js +11 -12
- package/dist/Link/Link.esm.js +4 -5
- package/dist/Link/styles.css +1 -0
- package/dist/Markup/Markup.cjs.js +6 -6
- package/dist/Markup/Markup.esm.js +2 -2
- package/dist/Markup/styles.css +1 -0
- package/dist/MediaCard/MediaCard.cjs.js +14 -14
- package/dist/MediaCard/MediaCard.esm.js +14 -14
- package/dist/MediaCard/styles.css +1 -0
- package/dist/Modal/Modal.cjs.js +44 -1201
- package/dist/Modal/Modal.esm.js +13 -1169
- package/dist/Modal/styles.css +1 -0
- package/dist/Pagination/Pagination.cjs.js +12 -13
- package/dist/Pagination/Pagination.esm.js +3 -4
- package/dist/Pagination/styles.css +1 -0
- package/dist/PaginationSimple/PaginationSimple.cjs.js +9 -10
- package/dist/PaginationSimple/PaginationSimple.esm.js +3 -4
- package/dist/PaginationSimple/styles.css +1 -0
- package/dist/Poster/Poster.cjs.js +4 -5
- package/dist/Poster/Poster.esm.js +4 -5
- package/dist/Poster/styles.css +1 -0
- package/dist/ProgressBar/ProgressBar.cjs.js +12 -13
- package/dist/ProgressBar/ProgressBar.esm.js +6 -7
- package/dist/ProgressBar/styles.css +1 -0
- package/dist/ProgressStepper/ProgressStepper.cjs.js +5 -6
- package/dist/ProgressStepper/ProgressStepper.esm.js +5 -6
- package/dist/ProgressStepper/styles.css +1 -0
- package/dist/RadioGroup/RadioGroup.cjs.js +8 -9
- package/dist/RadioGroup/RadioGroup.esm.js +8 -9
- package/dist/RadioGroup/styles.css +1 -0
- package/dist/Rule/Rule.cjs.js +5 -5
- package/dist/Rule/Rule.esm.js +2 -2
- package/dist/Rule/styles.css +1 -0
- package/dist/ScrollToTop/ScrollToTop.cjs.js +8 -9
- package/dist/ScrollToTop/ScrollToTop.esm.js +3 -4
- package/dist/ScrollToTop/styles.css +1 -0
- package/dist/Section/Section.cjs.js +2 -2
- package/dist/Section/Section.esm.js +2 -2
- package/dist/Section/styles.css +1 -0
- package/dist/Select/Select.cjs.js +31 -1132
- package/dist/Select/Select.esm.js +18 -1119
- package/dist/Select/styles.css +1 -0
- package/dist/SiteFooter/SiteFooter.cjs.js +7 -8
- package/dist/SiteFooter/SiteFooter.esm.js +7 -8
- package/dist/SiteFooter/styles.css +1 -0
- package/dist/SiteHeaderV2/SiteHeaderV2.cjs.js +11 -13
- package/dist/SiteHeaderV2/SiteHeaderV2.esm.js +11 -13
- package/dist/SiteHeaderV2/styles.css +1 -0
- package/dist/SkipLink/SkipLink.cjs.js +4 -4
- package/dist/SkipLink/SkipLink.esm.js +3 -3
- package/dist/SkipLink/styles.css +1 -0
- package/dist/Spinner/Spinner.cjs.js +12 -0
- package/dist/Spinner/Spinner.esm.js +4 -0
- package/dist/Spinner/package.json +7 -0
- package/dist/Spinner/styles.css +1 -0
- package/dist/Surface/Surface.cjs.js +2 -2
- package/dist/Surface/Surface.esm.js +2 -2
- package/dist/Surface/styles.css +1 -0
- package/dist/Switch/Switch.cjs.js +16 -18
- package/dist/Switch/Switch.esm.js +12 -14
- package/dist/Switch/styles.css +1 -0
- package/dist/Tabs/Tabs.cjs.js +10 -11
- package/dist/Tabs/Tabs.esm.js +10 -11
- package/dist/Tabs/styles.css +1 -0
- package/dist/Tag/Tag.cjs.js +77 -9
- package/dist/Tag/Tag.esm.js +76 -8
- package/dist/Tag/styles.css +1 -0
- package/dist/Text/Text.cjs.js +3 -4
- package/dist/Text/Text.esm.js +3 -4
- package/dist/Text/styles.css +1 -0
- package/dist/TextArea/TextArea.cjs.js +61 -57
- package/dist/TextArea/TextArea.esm.js +57 -53
- package/dist/TextArea/styles.css +1 -0
- package/dist/TextInput/TextInput.cjs.js +9 -10
- package/dist/TextInput/TextInput.esm.js +9 -10
- package/dist/TextInput/styles.css +1 -0
- package/dist/Theme/Theme.cjs.js +5 -5
- package/dist/Theme/Theme.esm.js +1 -1
- package/dist/Theme/styles.css +1 -0
- package/dist/ThemeIcon/ThemeIcon.cjs.js +3 -4
- package/dist/ThemeIcon/ThemeIcon.esm.js +3 -4
- package/dist/ThemeIcon/styles.css +1 -0
- package/dist/Toast/Toast.cjs.js +8 -10
- package/dist/Toast/Toast.esm.js +8 -10
- package/dist/Toast/styles.css +1 -0
- package/dist/Truncate/Truncate.cjs.js +3 -3
- package/dist/Truncate/Truncate.esm.js +3 -3
- package/dist/Truncate/styles.css +1 -0
- package/dist/TypographyCard/TypographyCard.cjs.js +14 -15
- package/dist/TypographyCard/TypographyCard.esm.js +9 -10
- package/dist/TypographyCard/styles.css +1 -0
- package/dist/UniversalHeader/UniversalHeader.cjs.js +3 -3
- package/dist/UniversalHeader/UniversalHeader.esm.js +3 -3
- package/dist/UniversalHeader/styles.css +1 -0
- package/dist/VerticalSpace/VerticalSpace.cjs.js +2 -2
- package/dist/VerticalSpace/VerticalSpace.esm.js +2 -2
- package/dist/VerticalSpace/styles.css +1 -0
- package/dist/VideoPlayer/VideoPlayer.cjs.js +11 -12
- package/dist/VideoPlayer/VideoPlayer.esm.js +8 -9
- package/dist/VideoPlayer/styles.css +1 -0
- package/dist/Visible/Visible.cjs.js +5 -5
- package/dist/Visible/Visible.esm.js +1 -1
- package/dist/Visible/styles.css +1 -0
- package/dist/VisuallyHidden/VisuallyHidden.cjs.js +2 -1
- package/dist/VisuallyHidden/VisuallyHidden.esm.js +2 -1
- package/dist/VisuallyHidden/styles.css +1 -0
- package/dist/_shared/cjs/{Avatar-fc0d9b8b.js → Avatar-e6ba0881.js} +11 -12
- package/dist/_shared/cjs/Badge-1f86304b.js +17 -0
- package/dist/_shared/cjs/Box-d177ee32.js +29 -0
- package/dist/_shared/cjs/{BrandLogo-1d2ca2c7.js → BrandLogo-d4a6fd05.js} +7 -8
- package/dist/_shared/cjs/{Breadcrumbs-7af0af2c.js → Breadcrumbs-ca30086e.js} +12 -12
- package/dist/_shared/cjs/{BtIconArrowRight.esm-5989f2ca.js → BtIconArrowRight.esm-6053bb79.js} +0 -8
- package/dist/_shared/cjs/{Button-7d891a89.js → Button-a2150286.js} +12 -13
- package/dist/_shared/cjs/{ButtonV2-b2db3f46.js → ButtonV2-7c437d1a.js} +21 -16
- package/dist/_shared/cjs/{Calendar-649cc139.js → Calendar-9b4b01c8.js} +912 -912
- package/dist/_shared/cjs/{CardFooter-5414bc4f.js → CardFooter-68235081.js} +5 -5
- package/dist/_shared/cjs/CardHeading-88edadd4.js +16 -0
- package/dist/_shared/cjs/{Checkbox-0e423653.js → Checkbox-f6712cc5.js} +17 -12
- package/dist/_shared/cjs/{Columns-1224bdff.js → Columns-5c6bab74.js} +9 -10
- package/dist/_shared/cjs/Combination-854a36ce.js +1203 -0
- package/dist/_shared/cjs/ContentSwitcher-88b00e11.js +98 -0
- package/dist/_shared/cjs/ContentSwitcherDropdown-ba5330ed.js +47 -0
- package/dist/_shared/cjs/DatePicker-61d66a55.js +956 -0
- package/dist/_shared/cjs/{DisclosureMini-c01ecce0.js → DisclosureMini-a46a4838.js} +10 -10
- package/dist/_shared/cjs/{Filter-3b897d92.js → Filter-b6ca2a39.js} +14 -14
- package/dist/_shared/cjs/{FormControl-88d48f42.js → FormControl-0fba93b8.js} +12 -12
- package/dist/_shared/cjs/{Grid-9e91fb3d.js → Grid-69ed0e5c.js} +10 -11
- package/dist/_shared/cjs/{Group-3d5ea240.js → Group-7e6b78c9.js} +9 -9
- package/dist/_shared/cjs/{Heading-fb63844f.js → Heading-25d11688.js} +7 -8
- package/dist/_shared/cjs/{HeroButton-0586a7c4.js → HeroButton-19814c26.js} +14 -14
- package/dist/_shared/cjs/Icon-08447959.js +47 -0
- package/dist/_shared/cjs/{Image-e9a5a326.js → Image-c8969ad9.js} +9 -10
- package/dist/_shared/cjs/{MediaCard-8f41b411.js → MediaCard-7bbe8aa0.js} +18 -18
- package/dist/_shared/cjs/{Poster-b7242b37.js → Poster-96aa286e.js} +13 -14
- package/dist/_shared/cjs/{ProgressStepper-fb8405c2.js → ProgressStepper-c59ec56c.js} +18 -42
- package/dist/_shared/cjs/{RadioGroup-a4186267.js → RadioGroup-11f4b232.js} +14 -14
- package/dist/_shared/cjs/{Section-ecfc659b.js → Section-46646353.js} +5 -5
- package/dist/_shared/cjs/{SiteFooter-7c4072b5.js → SiteFooter-d839f66a.js} +11 -11
- package/dist/_shared/cjs/{SiteHeaderV2-94687999.js → SiteHeaderV2-3793453c.js} +63 -65
- package/dist/_shared/cjs/Spinner-56122c43.js +24 -0
- package/dist/_shared/cjs/Surface-1b5c2ac8.js +175 -0
- package/dist/_shared/cjs/Tabs-30a12f1a.js +93 -0
- package/dist/_shared/cjs/{Text-1c1110a4.js → Text-c187d9ef.js} +7 -8
- package/dist/_shared/cjs/{TextInput-762e2309.js → TextInput-d39f5a80.js} +12 -12
- package/dist/_shared/cjs/{ThemeIcon-ee814862.js → ThemeIcon-7f537bd2.js} +8 -9
- package/dist/_shared/cjs/{Toast-d06a89e0.js → Toast-35c83925.js} +16 -17
- package/dist/_shared/cjs/{UniversalHeader-f6d9c63a.js → UniversalHeader-f9ef793f.js} +6 -6
- package/dist/_shared/cjs/{VerticalSpace-e128ec68.js → VerticalSpace-973deefe.js} +5 -5
- package/dist/_shared/cjs/{VisuallyHidden-b0de4c7b.js → VisuallyHidden-25393f58.js} +3 -2
- package/dist/_shared/cjs/{component-df82bc05.js → component-4e71e3d3.js} +4 -4
- package/dist/_shared/cjs/{Combination-3a639f6d.js → floating-ui.react-dom-08b8b87c.js} +37 -1103
- package/dist/_shared/cjs/{Tabs-75c34f43.js → index-1e7a1fce.js} +11 -96
- package/dist/_shared/cjs/{index-3d629205.js → index-2bf59363.js} +19 -1
- package/dist/_shared/cjs/{index-996dec94.js → index-527f962b.js} +1 -1
- package/dist/_shared/cjs/{index-7aa7f96a.js → index-879e71ee.js} +8 -1
- package/dist/_shared/cjs/index-89c323a4.js +2204 -0
- package/dist/_shared/cjs/{index-41b09e85.js → index-ba3141f5.js} +20 -1
- package/dist/_shared/cjs/{index-0c6319ec.js → index-dbc843d3.js} +1 -1
- package/dist/_shared/cjs/{index-df60851b.js → index.es-c26e8978.js} +20 -6
- package/dist/_shared/cjs/{index.es-16759329.js → index.es-f23456fa.js} +2 -2
- package/dist/_shared/esm/{Avatar-38cc0595.js → Avatar-3537bca7.js} +5 -6
- package/dist/_shared/esm/Badge-7bc80706.js +11 -0
- package/dist/_shared/esm/Box-557fb3b1.js +23 -0
- package/dist/_shared/esm/{BrandLogo-7ed8aeda.js → BrandLogo-45d0d795.js} +2 -3
- package/dist/_shared/esm/{Breadcrumbs-9078b68e.js → Breadcrumbs-bcf9ca79.js} +8 -8
- package/dist/_shared/esm/BtIconArrowRight.esm-93da96bb.js +24 -0
- package/dist/_shared/esm/{Button-dde2b46a.js → Button-0506afa7.js} +4 -5
- package/dist/_shared/esm/{ButtonV2-49cd0615.js → ButtonV2-c83db10c.js} +13 -8
- package/dist/_shared/esm/{Calendar-60591442.js → Calendar-34b10bd5.js} +890 -890
- package/dist/_shared/esm/{CardFooter-c79fb2db.js → CardFooter-bf886438.js} +5 -5
- package/dist/_shared/esm/CardHeading-c65f9fb2.js +10 -0
- package/dist/_shared/esm/{Checkbox-0baca464.js → Checkbox-8195c42c.js} +12 -7
- package/dist/_shared/esm/{Columns-6a8f6fbb.js → Columns-9aa5df4a.js} +1 -2
- package/dist/_shared/esm/Combination-2af75870.js +1163 -0
- package/dist/_shared/esm/ContentSwitcher-bae1f0a7.js +92 -0
- package/dist/_shared/esm/ContentSwitcherDropdown-65291c09.js +41 -0
- package/dist/_shared/esm/DatePicker-aafbdea8.js +927 -0
- package/dist/_shared/esm/{DisclosureMini-38f4c459.js → DisclosureMini-f6d8c9bc.js} +4 -4
- package/dist/_shared/esm/{Filter-49dcf5ce.js → Filter-a5bf3fe3.js} +11 -11
- package/dist/_shared/esm/{FormControl-d873f7fa.js → FormControl-ff671eb8.js} +5 -5
- package/dist/_shared/esm/{Grid-fb9fc522.js → Grid-727d05d6.js} +1 -2
- package/dist/_shared/esm/{Group-66196f07.js → Group-c4f6c745.js} +2 -2
- package/dist/_shared/esm/{Heading-906c7c7c.js → Heading-0a8d3545.js} +2 -3
- package/dist/_shared/esm/{HeroButton-7ea692bf.js → HeroButton-a98767b7.js} +6 -6
- package/dist/_shared/esm/{Icon-512f834f.js → Icon-a5cb17de.js} +16 -6
- package/dist/_shared/esm/{Image-57d08939.js → Image-c1dc10b5.js} +1 -2
- package/dist/_shared/esm/{MediaCard-c12d89ea.js → MediaCard-fdc76670.js} +10 -10
- package/dist/_shared/esm/{Poster-e05a8b45.js → Poster-dc3d7ee8.js} +4 -5
- package/dist/_shared/esm/{ProgressStepper-189ed0f9.js → ProgressStepper-427f24e3.js} +9 -33
- package/dist/_shared/esm/{RadioGroup-8ff17cbb.js → RadioGroup-5b654bee.js} +7 -7
- package/dist/_shared/esm/{Section-1acbc06a.js → Section-c1dc6e37.js} +1 -1
- package/dist/_shared/esm/{SiteFooter-b65497e8.js → SiteFooter-1cdba967.js} +6 -6
- package/dist/_shared/esm/{SiteHeaderV2-784b3bf8.js → SiteHeaderV2-743847f6.js} +9 -11
- package/dist/_shared/esm/Spinner-6704017c.js +18 -0
- package/dist/_shared/esm/Surface-0af6a69a.js +165 -0
- package/dist/_shared/esm/Tabs-d360207d.js +87 -0
- package/dist/_shared/esm/{Text-a46fb76b.js → Text-df93be85.js} +2 -3
- package/dist/_shared/esm/{TextInput-94c7b1a4.js → TextInput-7ab39a54.js} +5 -5
- package/dist/_shared/esm/{ThemeIcon-c2dc41a6.js → ThemeIcon-e1e19266.js} +2 -3
- package/dist/_shared/esm/{Toast-de6ca2f3.js → Toast-abd517c8.js} +6 -7
- package/dist/_shared/esm/{UniversalHeader-456ad60c.js → UniversalHeader-8ebc5322.js} +3 -3
- package/dist/_shared/esm/{VerticalSpace-b07cd8e6.js → VerticalSpace-6a3533db.js} +1 -1
- package/dist/_shared/esm/VisuallyHidden-cf45ac18.js +12 -0
- package/dist/_shared/esm/{component-d0a555cf.js → component-3e60a45e.js} +1 -1
- package/dist/_shared/esm/{Combination-ae3a3f08.js → floating-ui.react-dom-1bb71aae.js} +15 -1079
- package/dist/_shared/esm/{index-f97466e9.js → index-14c7f4da.js} +1 -1
- package/dist/_shared/esm/{index-cace3545.js → index-57d4cb34.js} +33 -33
- package/dist/_shared/esm/{Tabs-21ac7dfe.js → index-89a7c31c.js} +6 -90
- package/dist/_shared/esm/{index-4e58de24.js → index-ac50b180.js} +21 -3
- package/dist/_shared/esm/index-afbf540d.js +2169 -0
- package/dist/_shared/esm/{index-7740883c.js → index-b9923ee4.js} +9 -2
- package/dist/_shared/esm/{index-605031ca.js → index-ce6dee84.js} +53 -53
- package/dist/_shared/esm/index-e969452b.js +41 -0
- package/dist/_shared/esm/{index-fa93ec97.js → index-f2ddcbe2.js} +1 -1
- package/dist/_shared/esm/{index-288c66b5.js → index.es-5496ec12.js} +20 -6
- package/dist/_shared/esm/{index.es-1b6d33c2.js → index.es-932db59a.js} +2 -2
- package/dist/index.es.js +14701 -14060
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +14703 -14059
- package/dist/index.js.map +1 -1
- package/dist/styles.css +5 -3
- package/dist/types/components/Avatar/index.d.ts +1 -1
- package/dist/types/components/Box/Box.d.ts +4 -0
- package/dist/types/components/ButtonV2/ButtonV2.d.ts +2 -2
- package/dist/types/components/CardHeading/index.d.ts +1 -0
- package/dist/types/components/Carousel/Carousel.d.ts +12 -0
- package/dist/types/components/Carousel/helpers/get-slide-config.d.ts +4 -0
- package/dist/types/components/Carousel/helpers/get-slider-position.d.ts +9 -0
- package/dist/types/components/Carousel/helpers/is-last-slide.d.ts +2 -0
- package/dist/types/components/Carousel/helpers/is-slide-hidden.d.ts +2 -0
- package/dist/types/components/Carousel/hooks/use-slides.d.ts +18 -0
- package/dist/types/components/Carousel/index.d.ts +1 -0
- package/dist/types/components/Carousel/types/breakpoints.d.ts +1 -0
- package/dist/types/components/Carousel/types/responsive.d.ts +3 -0
- package/dist/types/components/Carousel/types/screen-sizes.d.ts +2 -0
- package/dist/types/components/Carousel/types/slide-config.d.ts +5 -0
- package/dist/types/components/Carousel/types/slide.d.ts +4 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/ContentSwitcher/ContentSwitcher.d.ts +28 -0
- package/dist/types/components/ContentSwitcher/ContentSwitcherContent/ContentSwitcherContent.d.ts +12 -0
- package/dist/types/components/ContentSwitcher/ContentSwitcherContent/index.d.ts +1 -0
- package/dist/types/components/ContentSwitcher/ContentSwitcherList/ContentSwitcherList.d.ts +24 -0
- package/dist/types/components/ContentSwitcher/ContentSwitcherList/index.d.ts +1 -0
- package/dist/types/components/ContentSwitcher/ContentSwitcherTab/ContentSwitcherTab.d.ts +17 -0
- package/dist/types/components/ContentSwitcher/ContentSwitcherTab/index.d.ts +1 -0
- package/dist/types/components/ContentSwitcher/index.d.ts +1 -0
- package/dist/types/components/ContentSwitcherDropdown/ContentSwitcherDropdown.d.ts +37 -0
- package/dist/types/components/ContentSwitcherDropdown/index.d.ts +1 -0
- package/dist/types/components/Disclosure/index.d.ts +1 -1
- package/dist/types/components/Heading/index.d.ts +1 -1
- package/dist/types/components/HeroBanner/HeroBanner.d.ts +52 -0
- package/dist/types/components/HeroBanner/index.d.ts +1 -0
- package/dist/types/components/Icon/Icon.d.ts +2 -2
- package/dist/types/components/ImpactCard/ImpactCard.d.ts +2 -2
- package/dist/types/components/ImpactCard/index.d.ts +1 -1
- package/dist/types/components/InformationCard/InformationCard.d.ts +2 -2
- package/dist/types/components/InformationCard/index.d.ts +1 -1
- package/dist/types/components/MediaCard/MediaCard.d.ts +1 -1
- package/dist/types/components/MediaCard/index.d.ts +1 -1
- package/dist/types/components/Spinner/Spinner.d.ts +16 -0
- package/dist/types/components/Spinner/index.d.ts +1 -0
- package/dist/types/components/Surface/Surface.d.ts +4 -0
- package/dist/types/components/Switch/Switch.d.ts +4 -0
- package/dist/types/components/ThemeIcon/icon-names.d.ts +1 -1
- package/dist/types/components/Truncate/Truncate.d.ts +1 -1
- package/dist/types/components/TypographyCard/TypographyCard.d.ts +2 -2
- package/dist/types/components/TypographyCard/index.d.ts +1 -1
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/helpers/index.d.ts +0 -2
- package/dist/types/styles.d.ts +8 -4
- package/package.json +21 -16
- package/dist/_shared/cjs/ArcIconEclipse.esm-ac777a76.js +0 -28
- package/dist/_shared/cjs/DatePicker-2417e55b.js +0 -550
- package/dist/_shared/cjs/Icon-0ec0c1fb.js +0 -37
- package/dist/_shared/cjs/Surface-8599dbe4.js +0 -57
- package/dist/_shared/cjs/Tag-452048f6.js +0 -44
- package/dist/_shared/cjs/index-039a9d35.js +0 -23
- package/dist/_shared/cjs/index-28447df0.js +0 -23
- package/dist/_shared/cjs/index-dcfdd5da.js +0 -11
- package/dist/_shared/cjs/suffix-modifier-c8a34402.js +0 -19
- package/dist/_shared/esm/ArcIconEclipse.esm-bb48b82a.js +0 -22
- package/dist/_shared/esm/BtIconArrowRight.esm-6a17d0ce.js +0 -31
- package/dist/_shared/esm/DatePicker-c7bb178e.js +0 -539
- package/dist/_shared/esm/Surface-71d21a9e.js +0 -48
- package/dist/_shared/esm/Tag-2513c185.js +0 -38
- package/dist/_shared/esm/VisuallyHidden-06692fd3.js +0 -11
- package/dist/_shared/esm/index-5113ed53.js +0 -24
- package/dist/_shared/esm/index-6028d797.js +0 -21
- package/dist/_shared/esm/index-69089474.js +0 -21
- package/dist/_shared/esm/index-a624de47.js +0 -9
- package/dist/_shared/esm/suffix-modifier-1ce05abe.js +0 -17
- package/dist/types/components/ProgressStepper/ProgressStepperItem/icons/Todo.d.ts +0 -2
- package/dist/types/helpers/filter-data-attrs.d.ts +0 -1
- package/dist/types/helpers/suffix-modifier.d.ts +0 -9
- package/dist/types/private-components/CardHeading/index.d.ts +0 -1
- package/dist/types/private-components/index.d.ts +0 -3
- package/dist/_shared/cjs/{ConditionalWrapper-be3b2625.js → ConditionalWrapper-bf944594.js} +0 -0
- package/dist/_shared/cjs/{index-7e31a45b.js → index-28fbfd5b.js} +52 -52
- package/dist/_shared/cjs/{index-3dd54df1.js → index-76f7dd53.js} +31 -31
- /package/dist/_shared/esm/{ConditionalWrapper-59be8f35.js → ConditionalWrapper-b85979de.js} +0 -0
- /package/dist/types/{private-components → components}/CardFooter/CardFooter.d.ts +0 -0
- /package/dist/types/{private-components → components}/CardFooter/index.d.ts +0 -0
- /package/dist/types/{private-components → components}/CardHeading/CardHeading.d.ts +0 -0
- /package/dist/types/{private-components → components}/ConditionalWrapper/ConditionalWrapper.d.ts +0 -0
- /package/dist/types/{private-components → components}/ConditionalWrapper/index.d.ts +0 -0
|
@@ -0,0 +1,2169 @@
|
|
|
1
|
+
import { c as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, a as $8927f6f2acc4f386$export$250ffa63cdc0d034, _ as _extends, b as $e42e1063c40fb3ef$export$b9ecd428b558ff10, e as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a, h as $8927f6f2acc4f386$export$6d1a0317bde7de7f, $ as $c512c27ab02ef895$export$50c7b4e9d9f19c1, f as $9f79659886946c16$export$e5c5a5f917a5871c, d as $71cd76cc60e0454e$export$6f32135080cb4c3, g as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from './index-57d4cb34.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { forwardRef, useContext, useState, useEffect, createElement, useRef, createContext, useCallback, Fragment, useMemo } from 'react';
|
|
4
|
+
import ReactDOM__default, { createPortal } from 'react-dom';
|
|
5
|
+
import { $ as $e02a7d9cb1dc128c$export$c74125a8e3af6bb2 } from './index-14c7f4da.js';
|
|
6
|
+
import { a as $f631663db3294ace$export$b39126d51d94e6f3, $ as $1746a345f3d73bb7$export$f680877a34711e37 } from './index-b9923ee4.js';
|
|
7
|
+
import { $ as $addc16e1bbe58fd0$export$3a72a57244d6e765, a as $ea1ef594cf570d83$export$439d29a4e110a164 } from './index-e969452b.js';
|
|
8
|
+
import { u as useFloating, a as autoUpdate, o as offset, s as shift, l as limitShift, f as flip, b as size, c as arrow, h as hide } from './floating-ui.react-dom-1bb71aae.js';
|
|
9
|
+
import { $ as $db6c3485150b8e66$export$1ab7ae714698c4b8, a as $010c2913dbd2fe3d$export$5cae361ad82dce8b } from './index-ac50b180.js';
|
|
10
|
+
import { c as createSidecarMedium, a as useMergeRefs, f as fullWidthClassName, z as zeroRightClassName, s as styleSingleton, R as RemoveScrollBar, e as exportSidecar, h as hideOthers } from './component-3e60a45e.js';
|
|
11
|
+
import { _ as __rest, a as __assign, b as __spreadArray } from './index.es-5496ec12.js';
|
|
12
|
+
|
|
13
|
+
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, [min, max]) {
|
|
14
|
+
return Math.min(max, Math.max(min, value));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
|
|
18
|
+
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
|
|
19
|
+
const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
|
|
20
|
+
let $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
21
|
+
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ createContext({
|
|
22
|
+
layers: new Set(),
|
|
23
|
+
layersWithOutsidePointerEventsDisabled: new Set(),
|
|
24
|
+
branches: new Set()
|
|
25
|
+
});
|
|
26
|
+
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
27
|
+
var _node$ownerDocument;
|
|
28
|
+
const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
|
|
29
|
+
const context = useContext($5cb92bef7577960e$var$DismissableLayerContext);
|
|
30
|
+
const [node1, setNode] = useState(null);
|
|
31
|
+
const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
|
|
32
|
+
const [, force] = useState({});
|
|
33
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node)
|
|
34
|
+
);
|
|
35
|
+
const layers = Array.from(context.layers);
|
|
36
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
37
|
+
...context.layersWithOutsidePointerEventsDisabled
|
|
38
|
+
].slice(-1); // prettier-ignore
|
|
39
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore
|
|
40
|
+
const index = node1 ? layers.indexOf(node1) : -1;
|
|
41
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
42
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
43
|
+
const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{
|
|
44
|
+
const target = event.target;
|
|
45
|
+
const isPointerDownOnBranch = [
|
|
46
|
+
...context.branches
|
|
47
|
+
].some((branch)=>branch.contains(target)
|
|
48
|
+
);
|
|
49
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
50
|
+
onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
|
|
51
|
+
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
52
|
+
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
53
|
+
}, ownerDocument);
|
|
54
|
+
const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{
|
|
55
|
+
const target = event.target;
|
|
56
|
+
const isFocusInBranch = [
|
|
57
|
+
...context.branches
|
|
58
|
+
].some((branch)=>branch.contains(target)
|
|
59
|
+
);
|
|
60
|
+
if (isFocusInBranch) return;
|
|
61
|
+
onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
|
|
62
|
+
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
63
|
+
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
64
|
+
}, ownerDocument);
|
|
65
|
+
$addc16e1bbe58fd0$export$3a72a57244d6e765((event)=>{
|
|
66
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
67
|
+
if (!isHighestLayer) return;
|
|
68
|
+
onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
|
|
69
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
onDismiss();
|
|
72
|
+
}
|
|
73
|
+
}, ownerDocument);
|
|
74
|
+
useEffect(()=>{
|
|
75
|
+
if (!node1) return;
|
|
76
|
+
if (disableOutsidePointerEvents) {
|
|
77
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
78
|
+
$5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
79
|
+
ownerDocument.body.style.pointerEvents = 'none';
|
|
80
|
+
}
|
|
81
|
+
context.layersWithOutsidePointerEventsDisabled.add(node1);
|
|
82
|
+
}
|
|
83
|
+
context.layers.add(node1);
|
|
84
|
+
$5cb92bef7577960e$var$dispatchUpdate();
|
|
85
|
+
return ()=>{
|
|
86
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
87
|
+
};
|
|
88
|
+
}, [
|
|
89
|
+
node1,
|
|
90
|
+
ownerDocument,
|
|
91
|
+
disableOutsidePointerEvents,
|
|
92
|
+
context
|
|
93
|
+
]);
|
|
94
|
+
/**
|
|
95
|
+
* We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect
|
|
96
|
+
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
|
|
97
|
+
* and add it to the end again so the layering order wouldn't be _creation order_.
|
|
98
|
+
* We only want them to be removed from context stacks when unmounted.
|
|
99
|
+
*/ useEffect(()=>{
|
|
100
|
+
return ()=>{
|
|
101
|
+
if (!node1) return;
|
|
102
|
+
context.layers.delete(node1);
|
|
103
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node1);
|
|
104
|
+
$5cb92bef7577960e$var$dispatchUpdate();
|
|
105
|
+
};
|
|
106
|
+
}, [
|
|
107
|
+
node1,
|
|
108
|
+
context
|
|
109
|
+
]);
|
|
110
|
+
useEffect(()=>{
|
|
111
|
+
const handleUpdate = ()=>force({})
|
|
112
|
+
;
|
|
113
|
+
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
|
|
114
|
+
return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
|
|
115
|
+
;
|
|
116
|
+
}, []);
|
|
117
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, {
|
|
118
|
+
ref: composedRefs,
|
|
119
|
+
style: {
|
|
120
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
|
|
121
|
+
...props.style
|
|
122
|
+
},
|
|
123
|
+
onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
124
|
+
onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
125
|
+
onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
|
|
126
|
+
}));
|
|
127
|
+
});
|
|
128
|
+
/* -----------------------------------------------------------------------------------------------*/ /**
|
|
129
|
+
* Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`
|
|
130
|
+
* to mimic layer dismissing behaviour present in OS.
|
|
131
|
+
* Returns props to pass to the node we want to check for outside events.
|
|
132
|
+
*/ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
133
|
+
const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
|
|
134
|
+
const isPointerInsideReactTreeRef = useRef(false);
|
|
135
|
+
const handleClickRef = useRef(()=>{});
|
|
136
|
+
useEffect(()=>{
|
|
137
|
+
const handlePointerDown = (event)=>{
|
|
138
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
139
|
+
const eventDetail = {
|
|
140
|
+
originalEvent: event
|
|
141
|
+
};
|
|
142
|
+
function handleAndDispatchPointerDownOutsideEvent() {
|
|
143
|
+
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
|
|
144
|
+
discrete: true
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* On touch devices, we need to wait for a click event because browsers implement
|
|
149
|
+
* a ~350ms delay between the time the user stops touching the display and when the
|
|
150
|
+
* browser executres events. We need to ensure we don't reactivate pointer-events within
|
|
151
|
+
* this timeframe otherwise the browser may execute events that should have been prevented.
|
|
152
|
+
*
|
|
153
|
+
* Additionally, this also lets us deal automatically with cancellations when a click event
|
|
154
|
+
* isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
|
|
155
|
+
*
|
|
156
|
+
* This is why we also continuously remove the previous listener, because we cannot be
|
|
157
|
+
* certain that it was raised, and therefore cleaned-up.
|
|
158
|
+
*/ if (event.pointerType === 'touch') {
|
|
159
|
+
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
160
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
|
|
161
|
+
ownerDocument.addEventListener('click', handleClickRef.current, {
|
|
162
|
+
once: true
|
|
163
|
+
});
|
|
164
|
+
} else handleAndDispatchPointerDownOutsideEvent();
|
|
165
|
+
} else // We need to remove the event listener in case the outside click has been canceled.
|
|
166
|
+
// See: https://github.com/radix-ui/primitives/issues/2171
|
|
167
|
+
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
168
|
+
isPointerInsideReactTreeRef.current = false;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* if this hook executes in a component that mounts via a `pointerdown` event, the event
|
|
172
|
+
* would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
|
|
173
|
+
* this by delaying the event listener registration on the document.
|
|
174
|
+
* This is not React specific, but rather how the DOM works, ie:
|
|
175
|
+
* ```
|
|
176
|
+
* button.addEventListener('pointerdown', () => {
|
|
177
|
+
* console.log('I will log');
|
|
178
|
+
* document.addEventListener('pointerdown', () => {
|
|
179
|
+
* console.log('I will also log');
|
|
180
|
+
* })
|
|
181
|
+
* });
|
|
182
|
+
*/ const timerId = window.setTimeout(()=>{
|
|
183
|
+
ownerDocument.addEventListener('pointerdown', handlePointerDown);
|
|
184
|
+
}, 0);
|
|
185
|
+
return ()=>{
|
|
186
|
+
window.clearTimeout(timerId);
|
|
187
|
+
ownerDocument.removeEventListener('pointerdown', handlePointerDown);
|
|
188
|
+
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
189
|
+
};
|
|
190
|
+
}, [
|
|
191
|
+
ownerDocument,
|
|
192
|
+
handlePointerDownOutside
|
|
193
|
+
]);
|
|
194
|
+
return {
|
|
195
|
+
// ensures we check React component tree (not just DOM tree)
|
|
196
|
+
onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Listens for when focus happens outside a react subtree.
|
|
201
|
+
* Returns props to pass to the root (node) of the subtree we want to check.
|
|
202
|
+
*/ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
203
|
+
const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
|
|
204
|
+
const isFocusInsideReactTreeRef = useRef(false);
|
|
205
|
+
useEffect(()=>{
|
|
206
|
+
const handleFocus = (event)=>{
|
|
207
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
208
|
+
const eventDetail = {
|
|
209
|
+
originalEvent: event
|
|
210
|
+
};
|
|
211
|
+
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
212
|
+
discrete: false
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
ownerDocument.addEventListener('focusin', handleFocus);
|
|
217
|
+
return ()=>ownerDocument.removeEventListener('focusin', handleFocus)
|
|
218
|
+
;
|
|
219
|
+
}, [
|
|
220
|
+
ownerDocument,
|
|
221
|
+
handleFocusOutside
|
|
222
|
+
]);
|
|
223
|
+
return {
|
|
224
|
+
onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true
|
|
225
|
+
,
|
|
226
|
+
onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function $5cb92bef7577960e$var$dispatchUpdate() {
|
|
230
|
+
const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
|
|
231
|
+
document.dispatchEvent(event);
|
|
232
|
+
}
|
|
233
|
+
function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {
|
|
234
|
+
const target = detail.originalEvent.target;
|
|
235
|
+
const event = new CustomEvent(name, {
|
|
236
|
+
bubbles: false,
|
|
237
|
+
cancelable: true,
|
|
238
|
+
detail: detail
|
|
239
|
+
});
|
|
240
|
+
if (handler) target.addEventListener(name, handler, {
|
|
241
|
+
once: true
|
|
242
|
+
});
|
|
243
|
+
if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
|
|
244
|
+
else target.dispatchEvent(event);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
|
|
248
|
+
/**
|
|
249
|
+
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
250
|
+
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
251
|
+
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
|
|
252
|
+
useEffect(()=>{
|
|
253
|
+
var _edgeGuards$, _edgeGuards$2;
|
|
254
|
+
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
255
|
+
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
256
|
+
document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
257
|
+
$3db38b7d1fb3fe6a$var$count++;
|
|
258
|
+
return ()=>{
|
|
259
|
+
if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
|
|
260
|
+
);
|
|
261
|
+
$3db38b7d1fb3fe6a$var$count--;
|
|
262
|
+
};
|
|
263
|
+
}, []);
|
|
264
|
+
}
|
|
265
|
+
function $3db38b7d1fb3fe6a$var$createFocusGuard() {
|
|
266
|
+
const element = document.createElement('span');
|
|
267
|
+
element.setAttribute('data-radix-focus-guard', '');
|
|
268
|
+
element.tabIndex = 0;
|
|
269
|
+
element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
|
|
270
|
+
return element;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
|
|
274
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
|
|
275
|
+
const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
276
|
+
bubbles: false,
|
|
277
|
+
cancelable: true
|
|
278
|
+
};
|
|
279
|
+
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
280
|
+
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
281
|
+
const [container1, setContainer] = useState(null);
|
|
282
|
+
const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
|
|
283
|
+
const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
|
|
284
|
+
const lastFocusedElementRef = useRef(null);
|
|
285
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
|
|
286
|
+
);
|
|
287
|
+
const focusScope = useRef({
|
|
288
|
+
paused: false,
|
|
289
|
+
pause () {
|
|
290
|
+
this.paused = true;
|
|
291
|
+
},
|
|
292
|
+
resume () {
|
|
293
|
+
this.paused = false;
|
|
294
|
+
}
|
|
295
|
+
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
296
|
+
useEffect(()=>{
|
|
297
|
+
if (trapped) {
|
|
298
|
+
function handleFocusIn(event) {
|
|
299
|
+
if (focusScope.paused || !container1) return;
|
|
300
|
+
const target = event.target;
|
|
301
|
+
if (container1.contains(target)) lastFocusedElementRef.current = target;
|
|
302
|
+
else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
303
|
+
select: true
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function handleFocusOut(event) {
|
|
307
|
+
if (focusScope.paused || !container1) return;
|
|
308
|
+
const relatedTarget = event.relatedTarget; // A `focusout` event with a `null` `relatedTarget` will happen in at least two cases:
|
|
309
|
+
//
|
|
310
|
+
// 1. When the user switches app/tabs/windows/the browser itself loses focus.
|
|
311
|
+
// 2. In Google Chrome, when the focused element is removed from the DOM.
|
|
312
|
+
//
|
|
313
|
+
// We let the browser do its thing here because:
|
|
314
|
+
//
|
|
315
|
+
// 1. The browser already keeps a memory of what's focused for when the page gets refocused.
|
|
316
|
+
// 2. In Google Chrome, if we try to focus the deleted focused element (as per below), it
|
|
317
|
+
// throws the CPU to 100%, so we avoid doing anything for this reason here too.
|
|
318
|
+
if (relatedTarget === null) return; // If the focus has moved to an actual legitimate element (`relatedTarget !== null`)
|
|
319
|
+
// that is outside the container, we move focus to the last valid focused element inside.
|
|
320
|
+
if (!container1.contains(relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
321
|
+
select: true
|
|
322
|
+
});
|
|
323
|
+
} // When the focused element gets removed from the DOM, browsers move focus
|
|
324
|
+
// back to the document.body. In this case, we move focus to the container
|
|
325
|
+
// to keep focus trapped correctly.
|
|
326
|
+
function handleMutations(mutations) {
|
|
327
|
+
const focusedElement = document.activeElement;
|
|
328
|
+
if (focusedElement !== document.body) return;
|
|
329
|
+
for (const mutation of mutations)if (mutation.removedNodes.length > 0) $d3863c46a17e8a28$var$focus(container1);
|
|
330
|
+
}
|
|
331
|
+
document.addEventListener('focusin', handleFocusIn);
|
|
332
|
+
document.addEventListener('focusout', handleFocusOut);
|
|
333
|
+
const mutationObserver = new MutationObserver(handleMutations);
|
|
334
|
+
if (container1) mutationObserver.observe(container1, {
|
|
335
|
+
childList: true,
|
|
336
|
+
subtree: true
|
|
337
|
+
});
|
|
338
|
+
return ()=>{
|
|
339
|
+
document.removeEventListener('focusin', handleFocusIn);
|
|
340
|
+
document.removeEventListener('focusout', handleFocusOut);
|
|
341
|
+
mutationObserver.disconnect();
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}, [
|
|
345
|
+
trapped,
|
|
346
|
+
container1,
|
|
347
|
+
focusScope.paused
|
|
348
|
+
]);
|
|
349
|
+
useEffect(()=>{
|
|
350
|
+
if (container1) {
|
|
351
|
+
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
352
|
+
const previouslyFocusedElement = document.activeElement;
|
|
353
|
+
const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
|
|
354
|
+
if (!hasFocusedCandidate) {
|
|
355
|
+
const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
356
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
357
|
+
container1.dispatchEvent(mountEvent);
|
|
358
|
+
if (!mountEvent.defaultPrevented) {
|
|
359
|
+
$d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
|
|
360
|
+
select: true
|
|
361
|
+
});
|
|
362
|
+
if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return ()=>{
|
|
366
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
|
|
367
|
+
// We need to delay the focus a little to get around it for now.
|
|
368
|
+
// See: https://github.com/facebook/react/issues/17894
|
|
369
|
+
setTimeout(()=>{
|
|
370
|
+
const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
371
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
372
|
+
container1.dispatchEvent(unmountEvent);
|
|
373
|
+
if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
|
|
374
|
+
select: true
|
|
375
|
+
});
|
|
376
|
+
// we need to remove the listener after we `dispatchEvent`
|
|
377
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
378
|
+
$d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
|
|
379
|
+
}, 0);
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
}, [
|
|
383
|
+
container1,
|
|
384
|
+
onMountAutoFocus,
|
|
385
|
+
onUnmountAutoFocus,
|
|
386
|
+
focusScope
|
|
387
|
+
]); // Takes care of looping focus (when tabbing whilst at the edges)
|
|
388
|
+
const handleKeyDown = useCallback((event)=>{
|
|
389
|
+
if (!loop && !trapped) return;
|
|
390
|
+
if (focusScope.paused) return;
|
|
391
|
+
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
392
|
+
const focusedElement = document.activeElement;
|
|
393
|
+
if (isTabKey && focusedElement) {
|
|
394
|
+
const container = event.currentTarget;
|
|
395
|
+
const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
|
|
396
|
+
const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
|
|
397
|
+
if (!hasTabbableElementsInside) {
|
|
398
|
+
if (focusedElement === container) event.preventDefault();
|
|
399
|
+
} else {
|
|
400
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
401
|
+
event.preventDefault();
|
|
402
|
+
if (loop) $d3863c46a17e8a28$var$focus(first, {
|
|
403
|
+
select: true
|
|
404
|
+
});
|
|
405
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
406
|
+
event.preventDefault();
|
|
407
|
+
if (loop) $d3863c46a17e8a28$var$focus(last, {
|
|
408
|
+
select: true
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}, [
|
|
414
|
+
loop,
|
|
415
|
+
trapped,
|
|
416
|
+
focusScope.paused
|
|
417
|
+
]);
|
|
418
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
419
|
+
tabIndex: -1
|
|
420
|
+
}, scopeProps, {
|
|
421
|
+
ref: composedRefs,
|
|
422
|
+
onKeyDown: handleKeyDown
|
|
423
|
+
}));
|
|
424
|
+
});
|
|
425
|
+
/* -------------------------------------------------------------------------------------------------
|
|
426
|
+
* Utils
|
|
427
|
+
* -----------------------------------------------------------------------------------------------*/ /**
|
|
428
|
+
* Attempts focusing the first element in a list of candidates.
|
|
429
|
+
* Stops when focus has actually moved.
|
|
430
|
+
*/ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
|
|
431
|
+
const previouslyFocusedElement = document.activeElement;
|
|
432
|
+
for (const candidate of candidates){
|
|
433
|
+
$d3863c46a17e8a28$var$focus(candidate, {
|
|
434
|
+
select: select
|
|
435
|
+
});
|
|
436
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Returns the first and last tabbable elements inside a container.
|
|
441
|
+
*/ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
|
|
442
|
+
const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
|
|
443
|
+
const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
|
|
444
|
+
const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
|
|
445
|
+
return [
|
|
446
|
+
first,
|
|
447
|
+
last
|
|
448
|
+
];
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Returns a list of potential tabbable candidates.
|
|
452
|
+
*
|
|
453
|
+
* NOTE: This is only a close approximation. For example it doesn't take into account cases like when
|
|
454
|
+
* elements are not visible. This cannot be worked out easily by just reading a property, but rather
|
|
455
|
+
* necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
|
|
456
|
+
*
|
|
457
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
|
|
458
|
+
* Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
|
|
459
|
+
*/ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
|
|
460
|
+
const nodes = [];
|
|
461
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
462
|
+
acceptNode: (node)=>{
|
|
463
|
+
const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
|
|
464
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
|
|
465
|
+
// runtime's understanding of tabbability, so this automatically accounts
|
|
466
|
+
// for any kind of element that could be tabbed to.
|
|
467
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
|
|
471
|
+
// hinders accessibility to have tab order different from visual order.
|
|
472
|
+
return nodes;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Returns the first visible element in a list.
|
|
476
|
+
* NOTE: Only checks visibility up to the `container`.
|
|
477
|
+
*/ function $d3863c46a17e8a28$var$findVisible(elements, container) {
|
|
478
|
+
for (const element of elements){
|
|
479
|
+
// we stop checking if it's hidden at the `container` level (excluding)
|
|
480
|
+
if (!$d3863c46a17e8a28$var$isHidden(element, {
|
|
481
|
+
upTo: container
|
|
482
|
+
})) return element;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
|
|
486
|
+
if (getComputedStyle(node).visibility === 'hidden') return true;
|
|
487
|
+
while(node){
|
|
488
|
+
// we stop at `upTo` (excluding it)
|
|
489
|
+
if (upTo !== undefined && node === upTo) return false;
|
|
490
|
+
if (getComputedStyle(node).display === 'none') return true;
|
|
491
|
+
node = node.parentElement;
|
|
492
|
+
}
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
function $d3863c46a17e8a28$var$isSelectableInput(element) {
|
|
496
|
+
return element instanceof HTMLInputElement && 'select' in element;
|
|
497
|
+
}
|
|
498
|
+
function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
|
|
499
|
+
// only focus if that element is focusable
|
|
500
|
+
if (element && element.focus) {
|
|
501
|
+
const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
|
|
502
|
+
element.focus({
|
|
503
|
+
preventScroll: true
|
|
504
|
+
}); // only select if its not the same element, it supports selection and we need to select
|
|
505
|
+
if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
/* -------------------------------------------------------------------------------------------------
|
|
509
|
+
* FocusScope stack
|
|
510
|
+
* -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
|
|
511
|
+
function $d3863c46a17e8a28$var$createFocusScopesStack() {
|
|
512
|
+
/** A stack of focus scopes, with the active one at the top */ let stack = [];
|
|
513
|
+
return {
|
|
514
|
+
add (focusScope) {
|
|
515
|
+
// pause the currently active focus scope (at the top of the stack)
|
|
516
|
+
const activeFocusScope = stack[0];
|
|
517
|
+
if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
|
|
518
|
+
// remove in case it already exists (because we'll re-add it at the top of the stack)
|
|
519
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
520
|
+
stack.unshift(focusScope);
|
|
521
|
+
},
|
|
522
|
+
remove (focusScope) {
|
|
523
|
+
var _stack$;
|
|
524
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
525
|
+
(_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
function $d3863c46a17e8a28$var$arrayRemove(array, item) {
|
|
530
|
+
const updatedArray = [
|
|
531
|
+
...array
|
|
532
|
+
];
|
|
533
|
+
const index = updatedArray.indexOf(item);
|
|
534
|
+
if (index !== -1) updatedArray.splice(index, 1);
|
|
535
|
+
return updatedArray;
|
|
536
|
+
}
|
|
537
|
+
function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
538
|
+
return items.filter((item)=>item.tagName !== 'A'
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/* -------------------------------------------------------------------------------------------------
|
|
543
|
+
* Popper
|
|
544
|
+
* -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$POPPER_NAME = 'Popper';
|
|
545
|
+
const [$cf1ac5d9fe0e8206$var$createPopperContext, $cf1ac5d9fe0e8206$export$722aac194ae923] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cf1ac5d9fe0e8206$var$POPPER_NAME);
|
|
546
|
+
const [$cf1ac5d9fe0e8206$var$PopperProvider, $cf1ac5d9fe0e8206$var$usePopperContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$POPPER_NAME);
|
|
547
|
+
const $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9 = (props)=>{
|
|
548
|
+
const { __scopePopper: __scopePopper , children: children } = props;
|
|
549
|
+
const [anchor, setAnchor] = useState(null);
|
|
550
|
+
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$var$PopperProvider, {
|
|
551
|
+
scope: __scopePopper,
|
|
552
|
+
anchor: anchor,
|
|
553
|
+
onAnchorChange: setAnchor
|
|
554
|
+
}, children);
|
|
555
|
+
};
|
|
556
|
+
/* -------------------------------------------------------------------------------------------------
|
|
557
|
+
* PopperAnchor
|
|
558
|
+
* -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$ANCHOR_NAME = 'PopperAnchor';
|
|
559
|
+
const $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
560
|
+
const { __scopePopper: __scopePopper , virtualRef: virtualRef , ...anchorProps } = props;
|
|
561
|
+
const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$ANCHOR_NAME, __scopePopper);
|
|
562
|
+
const ref = useRef(null);
|
|
563
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
564
|
+
useEffect(()=>{
|
|
565
|
+
// Consumer can anchor the popper to something that isn't
|
|
566
|
+
// a DOM node e.g. pointer position, so we override the
|
|
567
|
+
// `anchorRef` with their virtual ref in this case.
|
|
568
|
+
context.onAnchorChange((virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current);
|
|
569
|
+
});
|
|
570
|
+
return virtualRef ? null : /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, anchorProps, {
|
|
571
|
+
ref: composedRefs
|
|
572
|
+
}));
|
|
573
|
+
});
|
|
574
|
+
/* -------------------------------------------------------------------------------------------------
|
|
575
|
+
* PopperContent
|
|
576
|
+
* -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$CONTENT_NAME = 'PopperContent';
|
|
577
|
+
const [$cf1ac5d9fe0e8206$var$PopperContentProvider, $cf1ac5d9fe0e8206$var$useContentContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME);
|
|
578
|
+
const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
579
|
+
var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
|
|
580
|
+
const { __scopePopper: __scopePopper , side: side = 'bottom' , sideOffset: sideOffset = 0 , align: align = 'center' , alignOffset: alignOffset = 0 , arrowPadding: arrowPadding = 0 , avoidCollisions: avoidCollisions = true , collisionBoundary: collisionBoundary = [] , collisionPadding: collisionPaddingProp = 0 , sticky: sticky = 'partial' , hideWhenDetached: hideWhenDetached = false , updatePositionStrategy: updatePositionStrategy = 'optimized' , onPlaced: onPlaced , ...contentProps } = props;
|
|
581
|
+
const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper);
|
|
582
|
+
const [content, setContent] = useState(null);
|
|
583
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
584
|
+
);
|
|
585
|
+
const [arrow$1, setArrow] = useState(null);
|
|
586
|
+
const arrowSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(arrow$1);
|
|
587
|
+
const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
|
|
588
|
+
const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
|
|
589
|
+
const desiredPlacement = side + (align !== 'center' ? '-' + align : '');
|
|
590
|
+
const collisionPadding = typeof collisionPaddingProp === 'number' ? collisionPaddingProp : {
|
|
591
|
+
top: 0,
|
|
592
|
+
right: 0,
|
|
593
|
+
bottom: 0,
|
|
594
|
+
left: 0,
|
|
595
|
+
...collisionPaddingProp
|
|
596
|
+
};
|
|
597
|
+
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [
|
|
598
|
+
collisionBoundary
|
|
599
|
+
];
|
|
600
|
+
const hasExplicitBoundaries = boundary.length > 0;
|
|
601
|
+
const detectOverflowOptions = {
|
|
602
|
+
padding: collisionPadding,
|
|
603
|
+
boundary: boundary.filter($cf1ac5d9fe0e8206$var$isNotNull),
|
|
604
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
605
|
+
altBoundary: hasExplicitBoundaries
|
|
606
|
+
};
|
|
607
|
+
const { refs: refs , floatingStyles: floatingStyles , placement: placement , isPositioned: isPositioned , middlewareData: middlewareData } = useFloating({
|
|
608
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
609
|
+
strategy: 'fixed',
|
|
610
|
+
placement: desiredPlacement,
|
|
611
|
+
whileElementsMounted: (...args)=>{
|
|
612
|
+
const cleanup = autoUpdate(...args, {
|
|
613
|
+
animationFrame: updatePositionStrategy === 'always'
|
|
614
|
+
});
|
|
615
|
+
return cleanup;
|
|
616
|
+
},
|
|
617
|
+
elements: {
|
|
618
|
+
reference: context.anchor
|
|
619
|
+
},
|
|
620
|
+
middleware: [
|
|
621
|
+
offset({
|
|
622
|
+
mainAxis: sideOffset + arrowHeight,
|
|
623
|
+
alignmentAxis: alignOffset
|
|
624
|
+
}),
|
|
625
|
+
avoidCollisions && shift({
|
|
626
|
+
mainAxis: true,
|
|
627
|
+
crossAxis: false,
|
|
628
|
+
limiter: sticky === 'partial' ? limitShift() : undefined,
|
|
629
|
+
...detectOverflowOptions
|
|
630
|
+
}),
|
|
631
|
+
avoidCollisions && flip({
|
|
632
|
+
...detectOverflowOptions
|
|
633
|
+
}),
|
|
634
|
+
size({
|
|
635
|
+
...detectOverflowOptions,
|
|
636
|
+
apply: ({ elements: elements , rects: rects , availableWidth: availableWidth , availableHeight: availableHeight })=>{
|
|
637
|
+
const { width: anchorWidth , height: anchorHeight } = rects.reference;
|
|
638
|
+
const contentStyle = elements.floating.style;
|
|
639
|
+
contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);
|
|
640
|
+
contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);
|
|
641
|
+
contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);
|
|
642
|
+
contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);
|
|
643
|
+
}
|
|
644
|
+
}),
|
|
645
|
+
arrow$1 && arrow({
|
|
646
|
+
element: arrow$1,
|
|
647
|
+
padding: arrowPadding
|
|
648
|
+
}),
|
|
649
|
+
$cf1ac5d9fe0e8206$var$transformOrigin({
|
|
650
|
+
arrowWidth: arrowWidth,
|
|
651
|
+
arrowHeight: arrowHeight
|
|
652
|
+
}),
|
|
653
|
+
hideWhenDetached && hide({
|
|
654
|
+
strategy: 'referenceHidden',
|
|
655
|
+
...detectOverflowOptions
|
|
656
|
+
})
|
|
657
|
+
]
|
|
658
|
+
});
|
|
659
|
+
const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
|
|
660
|
+
const handlePlaced = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPlaced);
|
|
661
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
662
|
+
if (isPositioned) handlePlaced === null || handlePlaced === void 0 || handlePlaced();
|
|
663
|
+
}, [
|
|
664
|
+
isPositioned,
|
|
665
|
+
handlePlaced
|
|
666
|
+
]);
|
|
667
|
+
const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
|
|
668
|
+
const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
|
|
669
|
+
const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
|
|
670
|
+
const [contentZIndex, setContentZIndex] = useState();
|
|
671
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
672
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
673
|
+
}, [
|
|
674
|
+
content
|
|
675
|
+
]);
|
|
676
|
+
return /*#__PURE__*/ createElement("div", {
|
|
677
|
+
ref: refs.setFloating,
|
|
678
|
+
"data-radix-popper-content-wrapper": "",
|
|
679
|
+
style: {
|
|
680
|
+
...floatingStyles,
|
|
681
|
+
transform: isPositioned ? floatingStyles.transform : 'translate(0, -200%)',
|
|
682
|
+
// keep off the page when measuring
|
|
683
|
+
minWidth: 'max-content',
|
|
684
|
+
zIndex: contentZIndex,
|
|
685
|
+
['--radix-popper-transform-origin']: [
|
|
686
|
+
(_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x,
|
|
687
|
+
(_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y
|
|
688
|
+
].join(' ')
|
|
689
|
+
} // Floating UI interally calculates logical alignment based the `dir` attribute on
|
|
690
|
+
,
|
|
691
|
+
dir: props.dir
|
|
692
|
+
}, /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$var$PopperContentProvider, {
|
|
693
|
+
scope: __scopePopper,
|
|
694
|
+
placedSide: placedSide,
|
|
695
|
+
onArrowChange: setArrow,
|
|
696
|
+
arrowX: arrowX,
|
|
697
|
+
arrowY: arrowY,
|
|
698
|
+
shouldHideArrow: cannotCenterArrow
|
|
699
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
700
|
+
"data-side": placedSide,
|
|
701
|
+
"data-align": placedAlign
|
|
702
|
+
}, contentProps, {
|
|
703
|
+
ref: composedRefs,
|
|
704
|
+
style: {
|
|
705
|
+
...contentProps.style,
|
|
706
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
707
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
708
|
+
animation: !isPositioned ? 'none' : undefined,
|
|
709
|
+
// hide the content if using the hide middleware and should be hidden
|
|
710
|
+
opacity: (_middlewareData$hide = middlewareData.hide) !== null && _middlewareData$hide !== void 0 && _middlewareData$hide.referenceHidden ? 0 : undefined
|
|
711
|
+
}
|
|
712
|
+
}))));
|
|
713
|
+
});
|
|
714
|
+
/* -----------------------------------------------------------------------------------------------*/ function $cf1ac5d9fe0e8206$var$isNotNull(value) {
|
|
715
|
+
return value !== null;
|
|
716
|
+
}
|
|
717
|
+
const $cf1ac5d9fe0e8206$var$transformOrigin = (options)=>({
|
|
718
|
+
name: 'transformOrigin',
|
|
719
|
+
options: options,
|
|
720
|
+
fn (data) {
|
|
721
|
+
var _middlewareData$arrow4, _middlewareData$arrow5, _middlewareData$arrow6, _middlewareData$arrow7, _middlewareData$arrow8;
|
|
722
|
+
const { placement: placement , rects: rects , middlewareData: middlewareData } = data;
|
|
723
|
+
const cannotCenterArrow = ((_middlewareData$arrow4 = middlewareData.arrow) === null || _middlewareData$arrow4 === void 0 ? void 0 : _middlewareData$arrow4.centerOffset) !== 0;
|
|
724
|
+
const isArrowHidden = cannotCenterArrow;
|
|
725
|
+
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
726
|
+
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
727
|
+
const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
|
|
728
|
+
const noArrowAlign = {
|
|
729
|
+
start: '0%',
|
|
730
|
+
center: '50%',
|
|
731
|
+
end: '100%'
|
|
732
|
+
}[placedAlign];
|
|
733
|
+
const arrowXCenter = ((_middlewareData$arrow5 = (_middlewareData$arrow6 = middlewareData.arrow) === null || _middlewareData$arrow6 === void 0 ? void 0 : _middlewareData$arrow6.x) !== null && _middlewareData$arrow5 !== void 0 ? _middlewareData$arrow5 : 0) + arrowWidth / 2;
|
|
734
|
+
const arrowYCenter = ((_middlewareData$arrow7 = (_middlewareData$arrow8 = middlewareData.arrow) === null || _middlewareData$arrow8 === void 0 ? void 0 : _middlewareData$arrow8.y) !== null && _middlewareData$arrow7 !== void 0 ? _middlewareData$arrow7 : 0) + arrowHeight / 2;
|
|
735
|
+
let x = '';
|
|
736
|
+
let y = '';
|
|
737
|
+
if (placedSide === 'bottom') {
|
|
738
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
739
|
+
y = `${-arrowHeight}px`;
|
|
740
|
+
} else if (placedSide === 'top') {
|
|
741
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
742
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
743
|
+
} else if (placedSide === 'right') {
|
|
744
|
+
x = `${-arrowHeight}px`;
|
|
745
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
746
|
+
} else if (placedSide === 'left') {
|
|
747
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
748
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
749
|
+
}
|
|
750
|
+
return {
|
|
751
|
+
data: {
|
|
752
|
+
x: x,
|
|
753
|
+
y: y
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
})
|
|
758
|
+
;
|
|
759
|
+
function $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement) {
|
|
760
|
+
const [side, align = 'center'] = placement.split('-');
|
|
761
|
+
return [
|
|
762
|
+
side,
|
|
763
|
+
align
|
|
764
|
+
];
|
|
765
|
+
}
|
|
766
|
+
const $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9;
|
|
767
|
+
const $cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d;
|
|
768
|
+
const $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc;
|
|
769
|
+
|
|
770
|
+
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
771
|
+
var _globalThis$document;
|
|
772
|
+
const { container: container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body , ...portalProps } = props;
|
|
773
|
+
return container ? /*#__PURE__*/ ReactDOM__default.createPortal(/*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, {
|
|
774
|
+
ref: forwardedRef
|
|
775
|
+
})), container) : null;
|
|
776
|
+
});
|
|
777
|
+
|
|
778
|
+
var effectCar = createSidecarMedium();
|
|
779
|
+
|
|
780
|
+
var nothing = function () {
|
|
781
|
+
return;
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* Removes scrollbar from the page and contain the scroll within the Lock
|
|
785
|
+
*/
|
|
786
|
+
var RemoveScroll = React.forwardRef(function (props, parentRef) {
|
|
787
|
+
var ref = React.useRef(null);
|
|
788
|
+
var _a = React.useState({
|
|
789
|
+
onScrollCapture: nothing,
|
|
790
|
+
onWheelCapture: nothing,
|
|
791
|
+
onTouchMoveCapture: nothing,
|
|
792
|
+
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
793
|
+
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]);
|
|
794
|
+
var SideCar = sideCar;
|
|
795
|
+
var containerRef = useMergeRefs([ref, parentRef]);
|
|
796
|
+
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
797
|
+
return (React.createElement(React.Fragment, null,
|
|
798
|
+
enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
|
|
799
|
+
forwardProps ? (React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));
|
|
800
|
+
});
|
|
801
|
+
RemoveScroll.defaultProps = {
|
|
802
|
+
enabled: true,
|
|
803
|
+
removeScrollBar: true,
|
|
804
|
+
inert: false,
|
|
805
|
+
};
|
|
806
|
+
RemoveScroll.classNames = {
|
|
807
|
+
fullWidth: fullWidthClassName,
|
|
808
|
+
zeroRight: zeroRightClassName,
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
var passiveSupported = false;
|
|
812
|
+
if (typeof window !== 'undefined') {
|
|
813
|
+
try {
|
|
814
|
+
var options = Object.defineProperty({}, 'passive', {
|
|
815
|
+
get: function () {
|
|
816
|
+
passiveSupported = true;
|
|
817
|
+
return true;
|
|
818
|
+
},
|
|
819
|
+
});
|
|
820
|
+
// @ts-ignore
|
|
821
|
+
window.addEventListener('test', options, options);
|
|
822
|
+
// @ts-ignore
|
|
823
|
+
window.removeEventListener('test', options, options);
|
|
824
|
+
}
|
|
825
|
+
catch (err) {
|
|
826
|
+
passiveSupported = false;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
830
|
+
|
|
831
|
+
var alwaysContainsScroll = function (node) {
|
|
832
|
+
// textarea will always _contain_ scroll inside self. It only can be hidden
|
|
833
|
+
return node.tagName === 'TEXTAREA';
|
|
834
|
+
};
|
|
835
|
+
var elementCanBeScrolled = function (node, overflow) {
|
|
836
|
+
var styles = window.getComputedStyle(node);
|
|
837
|
+
return (
|
|
838
|
+
// not-not-scrollable
|
|
839
|
+
styles[overflow] !== 'hidden' &&
|
|
840
|
+
// contains scroll inside self
|
|
841
|
+
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible'));
|
|
842
|
+
};
|
|
843
|
+
var elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); };
|
|
844
|
+
var elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); };
|
|
845
|
+
var locationCouldBeScrolled = function (axis, node) {
|
|
846
|
+
var current = node;
|
|
847
|
+
do {
|
|
848
|
+
// Skip over shadow root
|
|
849
|
+
if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
|
|
850
|
+
current = current.host;
|
|
851
|
+
}
|
|
852
|
+
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
853
|
+
if (isScrollable) {
|
|
854
|
+
var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];
|
|
855
|
+
if (s > d) {
|
|
856
|
+
return true;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
current = current.parentNode;
|
|
860
|
+
} while (current && current !== document.body);
|
|
861
|
+
return false;
|
|
862
|
+
};
|
|
863
|
+
var getVScrollVariables = function (_a) {
|
|
864
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
865
|
+
return [
|
|
866
|
+
scrollTop,
|
|
867
|
+
scrollHeight,
|
|
868
|
+
clientHeight,
|
|
869
|
+
];
|
|
870
|
+
};
|
|
871
|
+
var getHScrollVariables = function (_a) {
|
|
872
|
+
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
873
|
+
return [
|
|
874
|
+
scrollLeft,
|
|
875
|
+
scrollWidth,
|
|
876
|
+
clientWidth,
|
|
877
|
+
];
|
|
878
|
+
};
|
|
879
|
+
var elementCouldBeScrolled = function (axis, node) {
|
|
880
|
+
return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
881
|
+
};
|
|
882
|
+
var getScrollVariables = function (axis, node) {
|
|
883
|
+
return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
884
|
+
};
|
|
885
|
+
var getDirectionFactor = function (axis, direction) {
|
|
886
|
+
/**
|
|
887
|
+
* If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
|
|
888
|
+
* and then increasingly negative as you scroll towards the end of the content.
|
|
889
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
|
|
890
|
+
*/
|
|
891
|
+
return axis === 'h' && direction === 'rtl' ? -1 : 1;
|
|
892
|
+
};
|
|
893
|
+
var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
894
|
+
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
895
|
+
var delta = directionFactor * sourceDelta;
|
|
896
|
+
// find scrollable target
|
|
897
|
+
var target = event.target;
|
|
898
|
+
var targetInLock = endTarget.contains(target);
|
|
899
|
+
var shouldCancelScroll = false;
|
|
900
|
+
var isDeltaPositive = delta > 0;
|
|
901
|
+
var availableScroll = 0;
|
|
902
|
+
var availableScrollTop = 0;
|
|
903
|
+
do {
|
|
904
|
+
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
905
|
+
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
906
|
+
if (position || elementScroll) {
|
|
907
|
+
if (elementCouldBeScrolled(axis, target)) {
|
|
908
|
+
availableScroll += elementScroll;
|
|
909
|
+
availableScrollTop += position;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
target = target.parentNode;
|
|
913
|
+
} while (
|
|
914
|
+
// portaled content
|
|
915
|
+
(!targetInLock && target !== document.body) ||
|
|
916
|
+
// self content
|
|
917
|
+
(targetInLock && (endTarget.contains(target) || endTarget === target)));
|
|
918
|
+
if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
|
|
919
|
+
shouldCancelScroll = true;
|
|
920
|
+
}
|
|
921
|
+
else if (!isDeltaPositive &&
|
|
922
|
+
((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) {
|
|
923
|
+
shouldCancelScroll = true;
|
|
924
|
+
}
|
|
925
|
+
return shouldCancelScroll;
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
var getTouchXY = function (event) {
|
|
929
|
+
return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
930
|
+
};
|
|
931
|
+
var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };
|
|
932
|
+
var extractRef = function (ref) {
|
|
933
|
+
return ref && 'current' in ref ? ref.current : ref;
|
|
934
|
+
};
|
|
935
|
+
var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };
|
|
936
|
+
var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); };
|
|
937
|
+
var idCounter = 0;
|
|
938
|
+
var lockStack = [];
|
|
939
|
+
function RemoveScrollSideCar(props) {
|
|
940
|
+
var shouldPreventQueue = React.useRef([]);
|
|
941
|
+
var touchStartRef = React.useRef([0, 0]);
|
|
942
|
+
var activeAxis = React.useRef();
|
|
943
|
+
var id = React.useState(idCounter++)[0];
|
|
944
|
+
var Style = React.useState(function () { return styleSingleton(); })[0];
|
|
945
|
+
var lastProps = React.useRef(props);
|
|
946
|
+
React.useEffect(function () {
|
|
947
|
+
lastProps.current = props;
|
|
948
|
+
}, [props]);
|
|
949
|
+
React.useEffect(function () {
|
|
950
|
+
if (props.inert) {
|
|
951
|
+
document.body.classList.add("block-interactivity-".concat(id));
|
|
952
|
+
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
953
|
+
allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); });
|
|
954
|
+
return function () {
|
|
955
|
+
document.body.classList.remove("block-interactivity-".concat(id));
|
|
956
|
+
allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); });
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
return;
|
|
960
|
+
}, [props.inert, props.lockRef.current, props.shards]);
|
|
961
|
+
var shouldCancelEvent = React.useCallback(function (event, parent) {
|
|
962
|
+
if ('touches' in event && event.touches.length === 2) {
|
|
963
|
+
return !lastProps.current.allowPinchZoom;
|
|
964
|
+
}
|
|
965
|
+
var touch = getTouchXY(event);
|
|
966
|
+
var touchStart = touchStartRef.current;
|
|
967
|
+
var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
|
|
968
|
+
var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
|
|
969
|
+
var currentAxis;
|
|
970
|
+
var target = event.target;
|
|
971
|
+
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
|
|
972
|
+
// allow horizontal touch move on Range inputs. They will not cause any scroll
|
|
973
|
+
if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
|
|
974
|
+
return false;
|
|
975
|
+
}
|
|
976
|
+
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
977
|
+
if (!canBeScrolledInMainDirection) {
|
|
978
|
+
return true;
|
|
979
|
+
}
|
|
980
|
+
if (canBeScrolledInMainDirection) {
|
|
981
|
+
currentAxis = moveDirection;
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
currentAxis = moveDirection === 'v' ? 'h' : 'v';
|
|
985
|
+
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
986
|
+
// other axis might be not scrollable
|
|
987
|
+
}
|
|
988
|
+
if (!canBeScrolledInMainDirection) {
|
|
989
|
+
return false;
|
|
990
|
+
}
|
|
991
|
+
if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
|
|
992
|
+
activeAxis.current = currentAxis;
|
|
993
|
+
}
|
|
994
|
+
if (!currentAxis) {
|
|
995
|
+
return true;
|
|
996
|
+
}
|
|
997
|
+
var cancelingAxis = activeAxis.current || currentAxis;
|
|
998
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
|
|
999
|
+
}, []);
|
|
1000
|
+
var shouldPrevent = React.useCallback(function (_event) {
|
|
1001
|
+
var event = _event;
|
|
1002
|
+
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
|
|
1003
|
+
// not the last active
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
|
|
1007
|
+
var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta); })[0];
|
|
1008
|
+
// self event, and should be canceled
|
|
1009
|
+
if (sourceEvent && sourceEvent.should) {
|
|
1010
|
+
if (event.cancelable) {
|
|
1011
|
+
event.preventDefault();
|
|
1012
|
+
}
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
// outside or shard event
|
|
1016
|
+
if (!sourceEvent) {
|
|
1017
|
+
var shardNodes = (lastProps.current.shards || [])
|
|
1018
|
+
.map(extractRef)
|
|
1019
|
+
.filter(Boolean)
|
|
1020
|
+
.filter(function (node) { return node.contains(event.target); });
|
|
1021
|
+
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
1022
|
+
if (shouldStop) {
|
|
1023
|
+
if (event.cancelable) {
|
|
1024
|
+
event.preventDefault();
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}, []);
|
|
1029
|
+
var shouldCancel = React.useCallback(function (name, delta, target, should) {
|
|
1030
|
+
var event = { name: name, delta: delta, target: target, should: should };
|
|
1031
|
+
shouldPreventQueue.current.push(event);
|
|
1032
|
+
setTimeout(function () {
|
|
1033
|
+
shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
|
|
1034
|
+
}, 1);
|
|
1035
|
+
}, []);
|
|
1036
|
+
var scrollTouchStart = React.useCallback(function (event) {
|
|
1037
|
+
touchStartRef.current = getTouchXY(event);
|
|
1038
|
+
activeAxis.current = undefined;
|
|
1039
|
+
}, []);
|
|
1040
|
+
var scrollWheel = React.useCallback(function (event) {
|
|
1041
|
+
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1042
|
+
}, []);
|
|
1043
|
+
var scrollTouchMove = React.useCallback(function (event) {
|
|
1044
|
+
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1045
|
+
}, []);
|
|
1046
|
+
React.useEffect(function () {
|
|
1047
|
+
lockStack.push(Style);
|
|
1048
|
+
props.setCallbacks({
|
|
1049
|
+
onScrollCapture: scrollWheel,
|
|
1050
|
+
onWheelCapture: scrollWheel,
|
|
1051
|
+
onTouchMoveCapture: scrollTouchMove,
|
|
1052
|
+
});
|
|
1053
|
+
document.addEventListener('wheel', shouldPrevent, nonPassive);
|
|
1054
|
+
document.addEventListener('touchmove', shouldPrevent, nonPassive);
|
|
1055
|
+
document.addEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
1056
|
+
return function () {
|
|
1057
|
+
lockStack = lockStack.filter(function (inst) { return inst !== Style; });
|
|
1058
|
+
document.removeEventListener('wheel', shouldPrevent, nonPassive);
|
|
1059
|
+
document.removeEventListener('touchmove', shouldPrevent, nonPassive);
|
|
1060
|
+
document.removeEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
1061
|
+
};
|
|
1062
|
+
}, []);
|
|
1063
|
+
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
1064
|
+
return (React.createElement(React.Fragment, null,
|
|
1065
|
+
inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,
|
|
1066
|
+
removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: "margin" }) : null));
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
1070
|
+
|
|
1071
|
+
var ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
|
|
1072
|
+
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
1073
|
+
var $01b9c$RemoveScroll = ReactRemoveScroll;
|
|
1074
|
+
|
|
1075
|
+
const $cc7e05a45900e73f$var$OPEN_KEYS = [
|
|
1076
|
+
' ',
|
|
1077
|
+
'Enter',
|
|
1078
|
+
'ArrowUp',
|
|
1079
|
+
'ArrowDown'
|
|
1080
|
+
];
|
|
1081
|
+
const $cc7e05a45900e73f$var$SELECTION_KEYS = [
|
|
1082
|
+
' ',
|
|
1083
|
+
'Enter'
|
|
1084
|
+
];
|
|
1085
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1086
|
+
* Select
|
|
1087
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SELECT_NAME = 'Select';
|
|
1088
|
+
const [$cc7e05a45900e73f$var$Collection, $cc7e05a45900e73f$var$useCollection, $cc7e05a45900e73f$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($cc7e05a45900e73f$var$SELECT_NAME);
|
|
1089
|
+
const [$cc7e05a45900e73f$var$createSelectContext, $cc7e05a45900e73f$export$286727a75dc039bd] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cc7e05a45900e73f$var$SELECT_NAME, [
|
|
1090
|
+
$cc7e05a45900e73f$var$createCollectionScope,
|
|
1091
|
+
$cf1ac5d9fe0e8206$export$722aac194ae923
|
|
1092
|
+
]);
|
|
1093
|
+
const $cc7e05a45900e73f$var$usePopperScope = $cf1ac5d9fe0e8206$export$722aac194ae923();
|
|
1094
|
+
const [$cc7e05a45900e73f$var$SelectProvider, $cc7e05a45900e73f$var$useSelectContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
1095
|
+
const [$cc7e05a45900e73f$var$SelectNativeOptionsProvider, $cc7e05a45900e73f$var$useSelectNativeOptionsContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
1096
|
+
const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
1097
|
+
const { __scopeSelect: __scopeSelect , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange , dir: dir , name: name , autoComplete: autoComplete , disabled: disabled , required: required } = props;
|
|
1098
|
+
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
1099
|
+
const [trigger, setTrigger] = useState(null);
|
|
1100
|
+
const [valueNode, setValueNode] = useState(null);
|
|
1101
|
+
const [valueNodeHasChildren, setValueNodeHasChildren] = useState(false);
|
|
1102
|
+
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
1103
|
+
const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1104
|
+
prop: openProp,
|
|
1105
|
+
defaultProp: defaultOpen,
|
|
1106
|
+
onChange: onOpenChange
|
|
1107
|
+
});
|
|
1108
|
+
const [value, setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1109
|
+
prop: valueProp,
|
|
1110
|
+
defaultProp: defaultValue,
|
|
1111
|
+
onChange: onValueChange
|
|
1112
|
+
});
|
|
1113
|
+
const triggerPointerDownPosRef = useRef(null); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
1114
|
+
const isFormControl = trigger ? Boolean(trigger.closest('form')) : true;
|
|
1115
|
+
const [nativeOptionsSet, setNativeOptionsSet] = useState(new Set()); // The native `select` only associates the correct default value if the corresponding
|
|
1116
|
+
// `option` is rendered as a child **at the same time** as itself.
|
|
1117
|
+
// Because it might take a few renders for our items to gather the information to build
|
|
1118
|
+
// the native `option`(s), we generate a key on the `select` to make sure React re-builds it
|
|
1119
|
+
// each time the options change.
|
|
1120
|
+
const nativeSelectKey = Array.from(nativeOptionsSet).map((option)=>option.props.value
|
|
1121
|
+
).join(';');
|
|
1122
|
+
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, popperScope, /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectProvider, {
|
|
1123
|
+
required: required,
|
|
1124
|
+
scope: __scopeSelect,
|
|
1125
|
+
trigger: trigger,
|
|
1126
|
+
onTriggerChange: setTrigger,
|
|
1127
|
+
valueNode: valueNode,
|
|
1128
|
+
onValueNodeChange: setValueNode,
|
|
1129
|
+
valueNodeHasChildren: valueNodeHasChildren,
|
|
1130
|
+
onValueNodeHasChildrenChange: setValueNodeHasChildren,
|
|
1131
|
+
contentId: $1746a345f3d73bb7$export$f680877a34711e37(),
|
|
1132
|
+
value: value,
|
|
1133
|
+
onValueChange: setValue,
|
|
1134
|
+
open: open,
|
|
1135
|
+
onOpenChange: setOpen,
|
|
1136
|
+
dir: direction,
|
|
1137
|
+
triggerPointerDownPosRef: triggerPointerDownPosRef,
|
|
1138
|
+
disabled: disabled
|
|
1139
|
+
}, /*#__PURE__*/ createElement($cc7e05a45900e73f$var$Collection.Provider, {
|
|
1140
|
+
scope: __scopeSelect
|
|
1141
|
+
}, /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectNativeOptionsProvider, {
|
|
1142
|
+
scope: props.__scopeSelect,
|
|
1143
|
+
onNativeOptionAdd: useCallback((option)=>{
|
|
1144
|
+
setNativeOptionsSet((prev)=>new Set(prev).add(option)
|
|
1145
|
+
);
|
|
1146
|
+
}, []),
|
|
1147
|
+
onNativeOptionRemove: useCallback((option)=>{
|
|
1148
|
+
setNativeOptionsSet((prev)=>{
|
|
1149
|
+
const optionsSet = new Set(prev);
|
|
1150
|
+
optionsSet.delete(option);
|
|
1151
|
+
return optionsSet;
|
|
1152
|
+
});
|
|
1153
|
+
}, [])
|
|
1154
|
+
}, children)), isFormControl ? /*#__PURE__*/ createElement($cc7e05a45900e73f$var$BubbleSelect, {
|
|
1155
|
+
key: nativeSelectKey,
|
|
1156
|
+
"aria-hidden": true,
|
|
1157
|
+
required: required,
|
|
1158
|
+
tabIndex: -1,
|
|
1159
|
+
name: name,
|
|
1160
|
+
autoComplete: autoComplete,
|
|
1161
|
+
value: value // enable form autofill
|
|
1162
|
+
,
|
|
1163
|
+
onChange: (event)=>setValue(event.target.value)
|
|
1164
|
+
,
|
|
1165
|
+
disabled: disabled
|
|
1166
|
+
}, value === undefined ? /*#__PURE__*/ createElement("option", {
|
|
1167
|
+
value: ""
|
|
1168
|
+
}) : null, Array.from(nativeOptionsSet)) : null));
|
|
1169
|
+
};
|
|
1170
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1171
|
+
* SelectTrigger
|
|
1172
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$TRIGGER_NAME = 'SelectTrigger';
|
|
1173
|
+
const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1174
|
+
const { __scopeSelect: __scopeSelect , disabled: disabled = false , ...triggerProps } = props;
|
|
1175
|
+
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
1176
|
+
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$TRIGGER_NAME, __scopeSelect);
|
|
1177
|
+
const isDisabled = context.disabled || disabled;
|
|
1178
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onTriggerChange);
|
|
1179
|
+
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
1180
|
+
const [searchRef, handleTypeaheadSearch, resetTypeahead] = $cc7e05a45900e73f$var$useTypeaheadSearch((search)=>{
|
|
1181
|
+
const enabledItems = getItems().filter((item)=>!item.disabled
|
|
1182
|
+
);
|
|
1183
|
+
const currentItem = enabledItems.find((item)=>item.value === context.value
|
|
1184
|
+
);
|
|
1185
|
+
const nextItem = $cc7e05a45900e73f$var$findNextItem(enabledItems, search, currentItem);
|
|
1186
|
+
if (nextItem !== undefined) context.onValueChange(nextItem.value);
|
|
1187
|
+
});
|
|
1188
|
+
const handleOpen = ()=>{
|
|
1189
|
+
if (!isDisabled) {
|
|
1190
|
+
context.onOpenChange(true); // reset typeahead when we open
|
|
1191
|
+
resetTypeahead();
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$b688253958b8dfe7, _extends({
|
|
1195
|
+
asChild: true
|
|
1196
|
+
}, popperScope), /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
|
|
1197
|
+
type: "button",
|
|
1198
|
+
role: "combobox",
|
|
1199
|
+
"aria-controls": context.contentId,
|
|
1200
|
+
"aria-expanded": context.open,
|
|
1201
|
+
"aria-required": context.required,
|
|
1202
|
+
"aria-autocomplete": "none",
|
|
1203
|
+
dir: context.dir,
|
|
1204
|
+
"data-state": context.open ? 'open' : 'closed',
|
|
1205
|
+
disabled: isDisabled,
|
|
1206
|
+
"data-disabled": isDisabled ? '' : undefined,
|
|
1207
|
+
"data-placeholder": $cc7e05a45900e73f$var$shouldShowPlaceholder(context.value) ? '' : undefined
|
|
1208
|
+
}, triggerProps, {
|
|
1209
|
+
ref: composedRefs // Enable compatibility with native label or custom `Label` "click" for Safari:
|
|
1210
|
+
,
|
|
1211
|
+
onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onClick, (event)=>{
|
|
1212
|
+
// Whilst browsers generally have no issue focusing the trigger when clicking
|
|
1213
|
+
// on a label, Safari seems to struggle with the fact that there's no `onClick`.
|
|
1214
|
+
// We force `focus` in this case. Note: this doesn't create any other side-effect
|
|
1215
|
+
// because we are preventing default in `onPointerDown` so effectively
|
|
1216
|
+
// this only runs for a label "click"
|
|
1217
|
+
event.currentTarget.focus();
|
|
1218
|
+
}),
|
|
1219
|
+
onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onPointerDown, (event)=>{
|
|
1220
|
+
// prevent implicit pointer capture
|
|
1221
|
+
// https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture
|
|
1222
|
+
const target = event.target;
|
|
1223
|
+
if (target.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);
|
|
1224
|
+
// only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
|
|
1225
|
+
// but not when the control key is pressed (avoiding MacOS right click)
|
|
1226
|
+
if (event.button === 0 && event.ctrlKey === false) {
|
|
1227
|
+
handleOpen();
|
|
1228
|
+
context.triggerPointerDownPosRef.current = {
|
|
1229
|
+
x: Math.round(event.pageX),
|
|
1230
|
+
y: Math.round(event.pageY)
|
|
1231
|
+
}; // prevent trigger from stealing focus from the active item after opening.
|
|
1232
|
+
event.preventDefault();
|
|
1233
|
+
}
|
|
1234
|
+
}),
|
|
1235
|
+
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onKeyDown, (event)=>{
|
|
1236
|
+
const isTypingAhead = searchRef.current !== '';
|
|
1237
|
+
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
1238
|
+
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
1239
|
+
if (isTypingAhead && event.key === ' ') return;
|
|
1240
|
+
if ($cc7e05a45900e73f$var$OPEN_KEYS.includes(event.key)) {
|
|
1241
|
+
handleOpen();
|
|
1242
|
+
event.preventDefault();
|
|
1243
|
+
}
|
|
1244
|
+
})
|
|
1245
|
+
})));
|
|
1246
|
+
});
|
|
1247
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1248
|
+
* SelectValue
|
|
1249
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$VALUE_NAME = 'SelectValue';
|
|
1250
|
+
const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1251
|
+
// We ignore `className` and `style` as this part shouldn't be styled.
|
|
1252
|
+
const { __scopeSelect: __scopeSelect , className: className , style: style , children: children , placeholder: placeholder = '' , ...valueProps } = props;
|
|
1253
|
+
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$VALUE_NAME, __scopeSelect);
|
|
1254
|
+
const { onValueNodeHasChildrenChange: onValueNodeHasChildrenChange } = context;
|
|
1255
|
+
const hasChildren = children !== undefined;
|
|
1256
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onValueNodeChange);
|
|
1257
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1258
|
+
onValueNodeHasChildrenChange(hasChildren);
|
|
1259
|
+
}, [
|
|
1260
|
+
onValueNodeHasChildrenChange,
|
|
1261
|
+
hasChildren
|
|
1262
|
+
]);
|
|
1263
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, valueProps, {
|
|
1264
|
+
ref: composedRefs // we don't want events from the portalled `SelectValue` children to bubble
|
|
1265
|
+
,
|
|
1266
|
+
style: {
|
|
1267
|
+
pointerEvents: 'none'
|
|
1268
|
+
}
|
|
1269
|
+
}), $cc7e05a45900e73f$var$shouldShowPlaceholder(context.value) ? /*#__PURE__*/ createElement(Fragment, null, placeholder) : children);
|
|
1270
|
+
});
|
|
1271
|
+
const $cc7e05a45900e73f$export$99b400cabb58c515 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1272
|
+
const { __scopeSelect: __scopeSelect , children: children , ...iconProps } = props;
|
|
1273
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
|
|
1274
|
+
"aria-hidden": true
|
|
1275
|
+
}, iconProps, {
|
|
1276
|
+
ref: forwardedRef
|
|
1277
|
+
}), children || '▼');
|
|
1278
|
+
});
|
|
1279
|
+
const $cc7e05a45900e73f$export$b2af6c9944296213 = (props)=>{
|
|
1280
|
+
return /*#__PURE__*/ createElement($f1701beae083dbae$export$602eac185826482c, _extends({
|
|
1281
|
+
asChild: true
|
|
1282
|
+
}, props));
|
|
1283
|
+
};
|
|
1284
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1285
|
+
* SelectContent
|
|
1286
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$CONTENT_NAME = 'SelectContent';
|
|
1287
|
+
const $cc7e05a45900e73f$export$c973a4b3cb86a03d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1288
|
+
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, props.__scopeSelect);
|
|
1289
|
+
const [fragment, setFragment] = useState(); // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
|
|
1290
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1291
|
+
setFragment(new DocumentFragment());
|
|
1292
|
+
}, []);
|
|
1293
|
+
if (!context.open) {
|
|
1294
|
+
const frag = fragment;
|
|
1295
|
+
return frag ? /*#__PURE__*/ createPortal(/*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
1296
|
+
scope: props.__scopeSelect
|
|
1297
|
+
}, /*#__PURE__*/ createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
1298
|
+
scope: props.__scopeSelect
|
|
1299
|
+
}, /*#__PURE__*/ createElement("div", null, props.children))), frag) : null;
|
|
1300
|
+
}
|
|
1301
|
+
return /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectContentImpl, _extends({}, props, {
|
|
1302
|
+
ref: forwardedRef
|
|
1303
|
+
}));
|
|
1304
|
+
});
|
|
1305
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1306
|
+
* SelectContentImpl
|
|
1307
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$CONTENT_MARGIN = 10;
|
|
1308
|
+
const [$cc7e05a45900e73f$var$SelectContentProvider, $cc7e05a45900e73f$var$useSelectContentContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME);
|
|
1309
|
+
const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1310
|
+
const { __scopeSelect: __scopeSelect , position: position = 'item-aligned' , onCloseAutoFocus: onCloseAutoFocus , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , side: //
|
|
1311
|
+
// PopperContent props
|
|
1312
|
+
side , sideOffset: sideOffset , align: align , alignOffset: alignOffset , arrowPadding: arrowPadding , collisionBoundary: collisionBoundary , collisionPadding: collisionPadding , sticky: sticky , hideWhenDetached: hideWhenDetached , avoidCollisions: avoidCollisions , //
|
|
1313
|
+
...contentProps } = props;
|
|
1314
|
+
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
1315
|
+
const [content, setContent] = useState(null);
|
|
1316
|
+
const [viewport, setViewport] = useState(null);
|
|
1317
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
1318
|
+
);
|
|
1319
|
+
const [selectedItem, setSelectedItem] = useState(null);
|
|
1320
|
+
const [selectedItemText, setSelectedItemText] = useState(null);
|
|
1321
|
+
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
1322
|
+
const [isPositioned, setIsPositioned] = useState(false);
|
|
1323
|
+
const firstValidItemFoundRef = useRef(false); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
|
|
1324
|
+
useEffect(()=>{
|
|
1325
|
+
if (content) return hideOthers(content);
|
|
1326
|
+
}, [
|
|
1327
|
+
content
|
|
1328
|
+
]); // Make sure the whole tree has focus guards as our `Select` may be
|
|
1329
|
+
// the last element in the DOM (because of the `Portal`)
|
|
1330
|
+
$3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
|
|
1331
|
+
const focusFirst = useCallback((candidates)=>{
|
|
1332
|
+
const [firstItem, ...restItems] = getItems().map((item)=>item.ref.current
|
|
1333
|
+
);
|
|
1334
|
+
const [lastItem] = restItems.slice(-1);
|
|
1335
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
1336
|
+
for (const candidate of candidates){
|
|
1337
|
+
// if focus is already where we want to go, we don't want to keep going through the candidates
|
|
1338
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
1339
|
+
candidate === null || candidate === void 0 || candidate.scrollIntoView({
|
|
1340
|
+
block: 'nearest'
|
|
1341
|
+
}); // viewport might have padding so scroll to its edges when focusing first/last items.
|
|
1342
|
+
if (candidate === firstItem && viewport) viewport.scrollTop = 0;
|
|
1343
|
+
if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;
|
|
1344
|
+
candidate === null || candidate === void 0 || candidate.focus();
|
|
1345
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
1346
|
+
}
|
|
1347
|
+
}, [
|
|
1348
|
+
getItems,
|
|
1349
|
+
viewport
|
|
1350
|
+
]);
|
|
1351
|
+
const focusSelectedItem = useCallback(()=>focusFirst([
|
|
1352
|
+
selectedItem,
|
|
1353
|
+
content
|
|
1354
|
+
])
|
|
1355
|
+
, [
|
|
1356
|
+
focusFirst,
|
|
1357
|
+
selectedItem,
|
|
1358
|
+
content
|
|
1359
|
+
]); // Since this is not dependent on layout, we want to ensure this runs at the same time as
|
|
1360
|
+
// other effects across components. Hence why we don't call `focusSelectedItem` inside `position`.
|
|
1361
|
+
useEffect(()=>{
|
|
1362
|
+
if (isPositioned) focusSelectedItem();
|
|
1363
|
+
}, [
|
|
1364
|
+
isPositioned,
|
|
1365
|
+
focusSelectedItem
|
|
1366
|
+
]); // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`
|
|
1367
|
+
// and close on `pointerup` outside.
|
|
1368
|
+
const { onOpenChange: onOpenChange , triggerPointerDownPosRef: triggerPointerDownPosRef } = context;
|
|
1369
|
+
useEffect(()=>{
|
|
1370
|
+
if (content) {
|
|
1371
|
+
let pointerMoveDelta = {
|
|
1372
|
+
x: 0,
|
|
1373
|
+
y: 0
|
|
1374
|
+
};
|
|
1375
|
+
const handlePointerMove = (event)=>{
|
|
1376
|
+
var _triggerPointerDownPo, _triggerPointerDownPo2, _triggerPointerDownPo3, _triggerPointerDownPo4;
|
|
1377
|
+
pointerMoveDelta = {
|
|
1378
|
+
x: Math.abs(Math.round(event.pageX) - ((_triggerPointerDownPo = (_triggerPointerDownPo2 = triggerPointerDownPosRef.current) === null || _triggerPointerDownPo2 === void 0 ? void 0 : _triggerPointerDownPo2.x) !== null && _triggerPointerDownPo !== void 0 ? _triggerPointerDownPo : 0)),
|
|
1379
|
+
y: Math.abs(Math.round(event.pageY) - ((_triggerPointerDownPo3 = (_triggerPointerDownPo4 = triggerPointerDownPosRef.current) === null || _triggerPointerDownPo4 === void 0 ? void 0 : _triggerPointerDownPo4.y) !== null && _triggerPointerDownPo3 !== void 0 ? _triggerPointerDownPo3 : 0))
|
|
1380
|
+
};
|
|
1381
|
+
};
|
|
1382
|
+
const handlePointerUp = (event)=>{
|
|
1383
|
+
// If the pointer hasn't moved by a certain threshold then we prevent selecting item on `pointerup`.
|
|
1384
|
+
if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) event.preventDefault();
|
|
1385
|
+
else // otherwise, if the event was outside the content, close.
|
|
1386
|
+
if (!content.contains(event.target)) onOpenChange(false);
|
|
1387
|
+
document.removeEventListener('pointermove', handlePointerMove);
|
|
1388
|
+
triggerPointerDownPosRef.current = null;
|
|
1389
|
+
};
|
|
1390
|
+
if (triggerPointerDownPosRef.current !== null) {
|
|
1391
|
+
document.addEventListener('pointermove', handlePointerMove);
|
|
1392
|
+
document.addEventListener('pointerup', handlePointerUp, {
|
|
1393
|
+
capture: true,
|
|
1394
|
+
once: true
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
return ()=>{
|
|
1398
|
+
document.removeEventListener('pointermove', handlePointerMove);
|
|
1399
|
+
document.removeEventListener('pointerup', handlePointerUp, {
|
|
1400
|
+
capture: true
|
|
1401
|
+
});
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
}, [
|
|
1405
|
+
content,
|
|
1406
|
+
onOpenChange,
|
|
1407
|
+
triggerPointerDownPosRef
|
|
1408
|
+
]);
|
|
1409
|
+
useEffect(()=>{
|
|
1410
|
+
const close = ()=>onOpenChange(false)
|
|
1411
|
+
;
|
|
1412
|
+
window.addEventListener('blur', close);
|
|
1413
|
+
window.addEventListener('resize', close);
|
|
1414
|
+
return ()=>{
|
|
1415
|
+
window.removeEventListener('blur', close);
|
|
1416
|
+
window.removeEventListener('resize', close);
|
|
1417
|
+
};
|
|
1418
|
+
}, [
|
|
1419
|
+
onOpenChange
|
|
1420
|
+
]);
|
|
1421
|
+
const [searchRef, handleTypeaheadSearch] = $cc7e05a45900e73f$var$useTypeaheadSearch((search)=>{
|
|
1422
|
+
const enabledItems = getItems().filter((item)=>!item.disabled
|
|
1423
|
+
);
|
|
1424
|
+
const currentItem = enabledItems.find((item)=>item.ref.current === document.activeElement
|
|
1425
|
+
);
|
|
1426
|
+
const nextItem = $cc7e05a45900e73f$var$findNextItem(enabledItems, search, currentItem);
|
|
1427
|
+
if (nextItem) /**
|
|
1428
|
+
* Imperative focus during keydown is risky so we prevent React's batching updates
|
|
1429
|
+
* to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
|
|
1430
|
+
*/ setTimeout(()=>nextItem.ref.current.focus()
|
|
1431
|
+
);
|
|
1432
|
+
});
|
|
1433
|
+
const itemRefCallback = useCallback((node, value, disabled)=>{
|
|
1434
|
+
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
1435
|
+
const isSelectedItem = context.value !== undefined && context.value === value;
|
|
1436
|
+
if (isSelectedItem || isFirstValidItem) {
|
|
1437
|
+
setSelectedItem(node);
|
|
1438
|
+
if (isFirstValidItem) firstValidItemFoundRef.current = true;
|
|
1439
|
+
}
|
|
1440
|
+
}, [
|
|
1441
|
+
context.value
|
|
1442
|
+
]);
|
|
1443
|
+
const handleItemLeave = useCallback(()=>content === null || content === void 0 ? void 0 : content.focus()
|
|
1444
|
+
, [
|
|
1445
|
+
content
|
|
1446
|
+
]);
|
|
1447
|
+
const itemTextRefCallback = useCallback((node, value, disabled)=>{
|
|
1448
|
+
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
1449
|
+
const isSelectedItem = context.value !== undefined && context.value === value;
|
|
1450
|
+
if (isSelectedItem || isFirstValidItem) setSelectedItemText(node);
|
|
1451
|
+
}, [
|
|
1452
|
+
context.value
|
|
1453
|
+
]);
|
|
1454
|
+
const SelectPosition = position === 'popper' ? $cc7e05a45900e73f$var$SelectPopperPosition : $cc7e05a45900e73f$var$SelectItemAlignedPosition; // Silently ignore props that are not supported by `SelectItemAlignedPosition`
|
|
1455
|
+
const popperContentProps = SelectPosition === $cc7e05a45900e73f$var$SelectPopperPosition ? {
|
|
1456
|
+
side: side,
|
|
1457
|
+
sideOffset: sideOffset,
|
|
1458
|
+
align: align,
|
|
1459
|
+
alignOffset: alignOffset,
|
|
1460
|
+
arrowPadding: arrowPadding,
|
|
1461
|
+
collisionBoundary: collisionBoundary,
|
|
1462
|
+
collisionPadding: collisionPadding,
|
|
1463
|
+
sticky: sticky,
|
|
1464
|
+
hideWhenDetached: hideWhenDetached,
|
|
1465
|
+
avoidCollisions: avoidCollisions
|
|
1466
|
+
} : {};
|
|
1467
|
+
return /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
1468
|
+
scope: __scopeSelect,
|
|
1469
|
+
content: content,
|
|
1470
|
+
viewport: viewport,
|
|
1471
|
+
onViewportChange: setViewport,
|
|
1472
|
+
itemRefCallback: itemRefCallback,
|
|
1473
|
+
selectedItem: selectedItem,
|
|
1474
|
+
onItemLeave: handleItemLeave,
|
|
1475
|
+
itemTextRefCallback: itemTextRefCallback,
|
|
1476
|
+
focusSelectedItem: focusSelectedItem,
|
|
1477
|
+
selectedItemText: selectedItemText,
|
|
1478
|
+
position: position,
|
|
1479
|
+
isPositioned: isPositioned,
|
|
1480
|
+
searchRef: searchRef
|
|
1481
|
+
}, /*#__PURE__*/ createElement($01b9c$RemoveScroll, {
|
|
1482
|
+
as: $5e63c961fc1ce211$export$8c6ed5c666ac1360,
|
|
1483
|
+
allowPinchZoom: true
|
|
1484
|
+
}, /*#__PURE__*/ createElement($d3863c46a17e8a28$export$20e40289641fbbb6, {
|
|
1485
|
+
asChild: true // we make sure we're not trapping once it's been closed
|
|
1486
|
+
,
|
|
1487
|
+
trapped: context.open,
|
|
1488
|
+
onMountAutoFocus: (event)=>{
|
|
1489
|
+
// we prevent open autofocus because we manually focus the selected item
|
|
1490
|
+
event.preventDefault();
|
|
1491
|
+
},
|
|
1492
|
+
onUnmountAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(onCloseAutoFocus, (event)=>{
|
|
1493
|
+
var _context$trigger;
|
|
1494
|
+
(_context$trigger = context.trigger) === null || _context$trigger === void 0 || _context$trigger.focus({
|
|
1495
|
+
preventScroll: true
|
|
1496
|
+
});
|
|
1497
|
+
event.preventDefault();
|
|
1498
|
+
})
|
|
1499
|
+
}, /*#__PURE__*/ createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, {
|
|
1500
|
+
asChild: true,
|
|
1501
|
+
disableOutsidePointerEvents: true,
|
|
1502
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
1503
|
+
onPointerDownOutside: onPointerDownOutside // When focus is trapped, a focusout event may still happen.
|
|
1504
|
+
,
|
|
1505
|
+
onFocusOutside: (event)=>event.preventDefault()
|
|
1506
|
+
,
|
|
1507
|
+
onDismiss: ()=>context.onOpenChange(false)
|
|
1508
|
+
}, /*#__PURE__*/ createElement(SelectPosition, _extends({
|
|
1509
|
+
role: "listbox",
|
|
1510
|
+
id: context.contentId,
|
|
1511
|
+
"data-state": context.open ? 'open' : 'closed',
|
|
1512
|
+
dir: context.dir,
|
|
1513
|
+
onContextMenu: (event)=>event.preventDefault()
|
|
1514
|
+
}, contentProps, popperContentProps, {
|
|
1515
|
+
onPlaced: ()=>setIsPositioned(true)
|
|
1516
|
+
,
|
|
1517
|
+
ref: composedRefs,
|
|
1518
|
+
style: {
|
|
1519
|
+
// flex layout so we can place the scroll buttons properly
|
|
1520
|
+
display: 'flex',
|
|
1521
|
+
flexDirection: 'column',
|
|
1522
|
+
// reset the outline by default as the content MAY get focused
|
|
1523
|
+
outline: 'none',
|
|
1524
|
+
...contentProps.style
|
|
1525
|
+
},
|
|
1526
|
+
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(contentProps.onKeyDown, (event)=>{
|
|
1527
|
+
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; // select should not be navigated using tab key so we prevent it
|
|
1528
|
+
if (event.key === 'Tab') event.preventDefault();
|
|
1529
|
+
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
1530
|
+
if ([
|
|
1531
|
+
'ArrowUp',
|
|
1532
|
+
'ArrowDown',
|
|
1533
|
+
'Home',
|
|
1534
|
+
'End'
|
|
1535
|
+
].includes(event.key)) {
|
|
1536
|
+
const items = getItems().filter((item)=>!item.disabled
|
|
1537
|
+
);
|
|
1538
|
+
let candidateNodes = items.map((item)=>item.ref.current
|
|
1539
|
+
);
|
|
1540
|
+
if ([
|
|
1541
|
+
'ArrowUp',
|
|
1542
|
+
'End'
|
|
1543
|
+
].includes(event.key)) candidateNodes = candidateNodes.slice().reverse();
|
|
1544
|
+
if ([
|
|
1545
|
+
'ArrowUp',
|
|
1546
|
+
'ArrowDown'
|
|
1547
|
+
].includes(event.key)) {
|
|
1548
|
+
const currentElement = event.target;
|
|
1549
|
+
const currentIndex = candidateNodes.indexOf(currentElement);
|
|
1550
|
+
candidateNodes = candidateNodes.slice(currentIndex + 1);
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Imperative focus during keydown is risky so we prevent React's batching updates
|
|
1554
|
+
* to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
|
|
1555
|
+
*/ setTimeout(()=>focusFirst(candidateNodes)
|
|
1556
|
+
);
|
|
1557
|
+
event.preventDefault();
|
|
1558
|
+
}
|
|
1559
|
+
})
|
|
1560
|
+
}))))));
|
|
1561
|
+
});
|
|
1562
|
+
const $cc7e05a45900e73f$var$SelectItemAlignedPosition = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1563
|
+
const { __scopeSelect: __scopeSelect , onPlaced: onPlaced , ...popperProps } = props;
|
|
1564
|
+
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
1565
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
1566
|
+
const [contentWrapper, setContentWrapper] = useState(null);
|
|
1567
|
+
const [content, setContent] = useState(null);
|
|
1568
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
1569
|
+
);
|
|
1570
|
+
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
1571
|
+
const shouldExpandOnScrollRef = useRef(false);
|
|
1572
|
+
const shouldRepositionRef = useRef(true);
|
|
1573
|
+
const { viewport: viewport , selectedItem: selectedItem , selectedItemText: selectedItemText , focusSelectedItem: focusSelectedItem } = contentContext;
|
|
1574
|
+
const position = useCallback(()=>{
|
|
1575
|
+
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
1576
|
+
const triggerRect = context.trigger.getBoundingClientRect(); // -----------------------------------------------------------------------------------------
|
|
1577
|
+
// Horizontal positioning
|
|
1578
|
+
// -----------------------------------------------------------------------------------------
|
|
1579
|
+
const contentRect = content.getBoundingClientRect();
|
|
1580
|
+
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
1581
|
+
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
1582
|
+
if (context.dir !== 'rtl') {
|
|
1583
|
+
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
1584
|
+
const left = valueNodeRect.left - itemTextOffset;
|
|
1585
|
+
const leftDelta = triggerRect.left - left;
|
|
1586
|
+
const minContentWidth = triggerRect.width + leftDelta;
|
|
1587
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
1588
|
+
const rightEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
1589
|
+
const clampedLeft = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(left, [
|
|
1590
|
+
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
1591
|
+
rightEdge - contentWidth
|
|
1592
|
+
]);
|
|
1593
|
+
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
1594
|
+
contentWrapper.style.left = clampedLeft + 'px';
|
|
1595
|
+
} else {
|
|
1596
|
+
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
1597
|
+
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
1598
|
+
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
1599
|
+
const minContentWidth = triggerRect.width + rightDelta;
|
|
1600
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
1601
|
+
const leftEdge = window.innerWidth - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
1602
|
+
const clampedRight = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(right, [
|
|
1603
|
+
$cc7e05a45900e73f$var$CONTENT_MARGIN,
|
|
1604
|
+
leftEdge - contentWidth
|
|
1605
|
+
]);
|
|
1606
|
+
contentWrapper.style.minWidth = minContentWidth + 'px';
|
|
1607
|
+
contentWrapper.style.right = clampedRight + 'px';
|
|
1608
|
+
} // -----------------------------------------------------------------------------------------
|
|
1609
|
+
// Vertical positioning
|
|
1610
|
+
// -----------------------------------------------------------------------------------------
|
|
1611
|
+
const items = getItems();
|
|
1612
|
+
const availableHeight = window.innerHeight - $cc7e05a45900e73f$var$CONTENT_MARGIN * 2;
|
|
1613
|
+
const itemsHeight = viewport.scrollHeight;
|
|
1614
|
+
const contentStyles = window.getComputedStyle(content);
|
|
1615
|
+
const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);
|
|
1616
|
+
const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);
|
|
1617
|
+
const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);
|
|
1618
|
+
const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);
|
|
1619
|
+
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth; // prettier-ignore
|
|
1620
|
+
const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);
|
|
1621
|
+
const viewportStyles = window.getComputedStyle(viewport);
|
|
1622
|
+
const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);
|
|
1623
|
+
const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);
|
|
1624
|
+
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - $cc7e05a45900e73f$var$CONTENT_MARGIN;
|
|
1625
|
+
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
1626
|
+
const selectedItemHalfHeight = selectedItem.offsetHeight / 2;
|
|
1627
|
+
const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;
|
|
1628
|
+
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
1629
|
+
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
1630
|
+
const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;
|
|
1631
|
+
if (willAlignWithoutTopOverflow) {
|
|
1632
|
+
const isLastItem = selectedItem === items[items.length - 1].ref.current;
|
|
1633
|
+
contentWrapper.style.bottom = "0px";
|
|
1634
|
+
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
1635
|
+
const clampedTriggerMiddleToBottomEdge = Math.max(triggerMiddleToBottomEdge, selectedItemHalfHeight + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth);
|
|
1636
|
+
const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;
|
|
1637
|
+
contentWrapper.style.height = height + 'px';
|
|
1638
|
+
} else {
|
|
1639
|
+
const isFirstItem = selectedItem === items[0].ref.current;
|
|
1640
|
+
contentWrapper.style.top = "0px";
|
|
1641
|
+
const clampedTopEdgeToTriggerMiddle = Math.max(topEdgeToTriggerMiddle, contentBorderTopWidth + viewport.offsetTop + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight);
|
|
1642
|
+
const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;
|
|
1643
|
+
contentWrapper.style.height = height + 'px';
|
|
1644
|
+
viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;
|
|
1645
|
+
}
|
|
1646
|
+
contentWrapper.style.margin = `${$cc7e05a45900e73f$var$CONTENT_MARGIN}px 0`;
|
|
1647
|
+
contentWrapper.style.minHeight = minContentHeight + 'px';
|
|
1648
|
+
contentWrapper.style.maxHeight = availableHeight + 'px'; // -----------------------------------------------------------------------------------------
|
|
1649
|
+
onPlaced === null || onPlaced === void 0 || onPlaced(); // we don't want the initial scroll position adjustment to trigger "expand on scroll"
|
|
1650
|
+
// so we explicitly turn it on only after they've registered.
|
|
1651
|
+
requestAnimationFrame(()=>shouldExpandOnScrollRef.current = true
|
|
1652
|
+
);
|
|
1653
|
+
}
|
|
1654
|
+
}, [
|
|
1655
|
+
getItems,
|
|
1656
|
+
context.trigger,
|
|
1657
|
+
context.valueNode,
|
|
1658
|
+
contentWrapper,
|
|
1659
|
+
content,
|
|
1660
|
+
viewport,
|
|
1661
|
+
selectedItem,
|
|
1662
|
+
selectedItemText,
|
|
1663
|
+
context.dir,
|
|
1664
|
+
onPlaced
|
|
1665
|
+
]);
|
|
1666
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>position()
|
|
1667
|
+
, [
|
|
1668
|
+
position
|
|
1669
|
+
]); // copy z-index from content to wrapper
|
|
1670
|
+
const [contentZIndex, setContentZIndex] = useState();
|
|
1671
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1672
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
1673
|
+
}, [
|
|
1674
|
+
content
|
|
1675
|
+
]); // When the viewport becomes scrollable at the top, the scroll up button will mount.
|
|
1676
|
+
// Because it is part of the normal flow, it will push down the viewport, thus throwing our
|
|
1677
|
+
// trigger => selectedItem alignment off by the amount the viewport was pushed down.
|
|
1678
|
+
// We wait for this to happen and then re-run the positining logic one more time to account for it.
|
|
1679
|
+
const handleScrollButtonChange = useCallback((node)=>{
|
|
1680
|
+
if (node && shouldRepositionRef.current === true) {
|
|
1681
|
+
position();
|
|
1682
|
+
focusSelectedItem === null || focusSelectedItem === void 0 || focusSelectedItem();
|
|
1683
|
+
shouldRepositionRef.current = false;
|
|
1684
|
+
}
|
|
1685
|
+
}, [
|
|
1686
|
+
position,
|
|
1687
|
+
focusSelectedItem
|
|
1688
|
+
]);
|
|
1689
|
+
return /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectViewportProvider, {
|
|
1690
|
+
scope: __scopeSelect,
|
|
1691
|
+
contentWrapper: contentWrapper,
|
|
1692
|
+
shouldExpandOnScrollRef: shouldExpandOnScrollRef,
|
|
1693
|
+
onScrollButtonChange: handleScrollButtonChange
|
|
1694
|
+
}, /*#__PURE__*/ createElement("div", {
|
|
1695
|
+
ref: setContentWrapper,
|
|
1696
|
+
style: {
|
|
1697
|
+
display: 'flex',
|
|
1698
|
+
flexDirection: 'column',
|
|
1699
|
+
position: 'fixed',
|
|
1700
|
+
zIndex: contentZIndex
|
|
1701
|
+
}
|
|
1702
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, popperProps, {
|
|
1703
|
+
ref: composedRefs,
|
|
1704
|
+
style: {
|
|
1705
|
+
// When we get the height of the content, it includes borders. If we were to set
|
|
1706
|
+
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
1707
|
+
boxSizing: 'border-box',
|
|
1708
|
+
// We need to ensure the content doesn't get taller than the wrapper
|
|
1709
|
+
maxHeight: '100%',
|
|
1710
|
+
...popperProps.style
|
|
1711
|
+
}
|
|
1712
|
+
}))));
|
|
1713
|
+
});
|
|
1714
|
+
const $cc7e05a45900e73f$var$SelectPopperPosition = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1715
|
+
const { __scopeSelect: __scopeSelect , align: align = 'start' , collisionPadding: collisionPadding = $cc7e05a45900e73f$var$CONTENT_MARGIN , ...popperProps } = props;
|
|
1716
|
+
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
1717
|
+
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2, _extends({}, popperScope, popperProps, {
|
|
1718
|
+
ref: forwardedRef,
|
|
1719
|
+
align: align,
|
|
1720
|
+
collisionPadding: collisionPadding,
|
|
1721
|
+
style: {
|
|
1722
|
+
// Ensure border-box for floating-ui calculations
|
|
1723
|
+
boxSizing: 'border-box',
|
|
1724
|
+
...popperProps.style,
|
|
1725
|
+
'--radix-select-content-transform-origin': 'var(--radix-popper-transform-origin)',
|
|
1726
|
+
'--radix-select-content-available-width': 'var(--radix-popper-available-width)',
|
|
1727
|
+
'--radix-select-content-available-height': 'var(--radix-popper-available-height)',
|
|
1728
|
+
'--radix-select-trigger-width': 'var(--radix-popper-anchor-width)',
|
|
1729
|
+
'--radix-select-trigger-height': 'var(--radix-popper-anchor-height)'
|
|
1730
|
+
}
|
|
1731
|
+
}));
|
|
1732
|
+
});
|
|
1733
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1734
|
+
* SelectViewport
|
|
1735
|
+
* -----------------------------------------------------------------------------------------------*/ const [$cc7e05a45900e73f$var$SelectViewportProvider, $cc7e05a45900e73f$var$useSelectViewportContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, {});
|
|
1736
|
+
const $cc7e05a45900e73f$var$VIEWPORT_NAME = 'SelectViewport';
|
|
1737
|
+
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1738
|
+
const { __scopeSelect: __scopeSelect , ...viewportProps } = props;
|
|
1739
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
1740
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
1741
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onViewportChange);
|
|
1742
|
+
const prevScrollTopRef = useRef(0);
|
|
1743
|
+
return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement("style", {
|
|
1744
|
+
dangerouslySetInnerHTML: {
|
|
1745
|
+
__html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`
|
|
1746
|
+
}
|
|
1747
|
+
}), /*#__PURE__*/ createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
1748
|
+
scope: __scopeSelect
|
|
1749
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
1750
|
+
"data-radix-select-viewport": "",
|
|
1751
|
+
role: "presentation"
|
|
1752
|
+
}, viewportProps, {
|
|
1753
|
+
ref: composedRefs,
|
|
1754
|
+
style: {
|
|
1755
|
+
// we use position: 'relative' here on the `viewport` so that when we call
|
|
1756
|
+
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
1757
|
+
// (independent of the scrollUpButton).
|
|
1758
|
+
position: 'relative',
|
|
1759
|
+
flex: 1,
|
|
1760
|
+
overflow: 'auto',
|
|
1761
|
+
...viewportProps.style
|
|
1762
|
+
},
|
|
1763
|
+
onScroll: $e42e1063c40fb3ef$export$b9ecd428b558ff10(viewportProps.onScroll, (event)=>{
|
|
1764
|
+
const viewport = event.currentTarget;
|
|
1765
|
+
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } = viewportContext;
|
|
1766
|
+
if (shouldExpandOnScrollRef !== null && shouldExpandOnScrollRef !== void 0 && shouldExpandOnScrollRef.current && contentWrapper) {
|
|
1767
|
+
const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);
|
|
1768
|
+
if (scrolledBy > 0) {
|
|
1769
|
+
const availableHeight = window.innerHeight - $cc7e05a45900e73f$var$CONTENT_MARGIN * 2;
|
|
1770
|
+
const cssMinHeight = parseFloat(contentWrapper.style.minHeight);
|
|
1771
|
+
const cssHeight = parseFloat(contentWrapper.style.height);
|
|
1772
|
+
const prevHeight = Math.max(cssMinHeight, cssHeight);
|
|
1773
|
+
if (prevHeight < availableHeight) {
|
|
1774
|
+
const nextHeight = prevHeight + scrolledBy;
|
|
1775
|
+
const clampedNextHeight = Math.min(availableHeight, nextHeight);
|
|
1776
|
+
const heightDiff = nextHeight - clampedNextHeight;
|
|
1777
|
+
contentWrapper.style.height = clampedNextHeight + 'px';
|
|
1778
|
+
if (contentWrapper.style.bottom === '0px') {
|
|
1779
|
+
viewport.scrollTop = heightDiff > 0 ? heightDiff : 0; // ensure the content stays pinned to the bottom
|
|
1780
|
+
contentWrapper.style.justifyContent = 'flex-end';
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
prevScrollTopRef.current = viewport.scrollTop;
|
|
1786
|
+
})
|
|
1787
|
+
}))));
|
|
1788
|
+
});
|
|
1789
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1790
|
+
* SelectGroup
|
|
1791
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$GROUP_NAME = 'SelectGroup';
|
|
1792
|
+
$cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$GROUP_NAME);
|
|
1793
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1794
|
+
* SelectItem
|
|
1795
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$ITEM_NAME = 'SelectItem';
|
|
1796
|
+
const [$cc7e05a45900e73f$var$SelectItemContextProvider, $cc7e05a45900e73f$var$useSelectItemContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$ITEM_NAME);
|
|
1797
|
+
const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1798
|
+
const { __scopeSelect: __scopeSelect , value: value , disabled: disabled = false , textValue: textValueProp , ...itemProps } = props;
|
|
1799
|
+
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$ITEM_NAME, __scopeSelect);
|
|
1800
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$ITEM_NAME, __scopeSelect);
|
|
1801
|
+
const isSelected = context.value === value;
|
|
1802
|
+
const [textValue, setTextValue] = useState(textValueProp !== null && textValueProp !== void 0 ? textValueProp : '');
|
|
1803
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
1804
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>{
|
|
1805
|
+
var _contentContext$itemR;
|
|
1806
|
+
return (_contentContext$itemR = contentContext.itemRefCallback) === null || _contentContext$itemR === void 0 ? void 0 : _contentContext$itemR.call(contentContext, node, value, disabled);
|
|
1807
|
+
});
|
|
1808
|
+
const textId = $1746a345f3d73bb7$export$f680877a34711e37();
|
|
1809
|
+
const handleSelect = ()=>{
|
|
1810
|
+
if (!disabled) {
|
|
1811
|
+
context.onValueChange(value);
|
|
1812
|
+
context.onOpenChange(false);
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
if (value === '') throw new Error('A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.');
|
|
1816
|
+
return /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectItemContextProvider, {
|
|
1817
|
+
scope: __scopeSelect,
|
|
1818
|
+
value: value,
|
|
1819
|
+
disabled: disabled,
|
|
1820
|
+
textId: textId,
|
|
1821
|
+
isSelected: isSelected,
|
|
1822
|
+
onItemTextChange: useCallback((node)=>{
|
|
1823
|
+
setTextValue((prevTextValue)=>{
|
|
1824
|
+
var _node$textContent;
|
|
1825
|
+
return prevTextValue || ((_node$textContent = node === null || node === void 0 ? void 0 : node.textContent) !== null && _node$textContent !== void 0 ? _node$textContent : '').trim();
|
|
1826
|
+
});
|
|
1827
|
+
}, [])
|
|
1828
|
+
}, /*#__PURE__*/ createElement($cc7e05a45900e73f$var$Collection.ItemSlot, {
|
|
1829
|
+
scope: __scopeSelect,
|
|
1830
|
+
value: value,
|
|
1831
|
+
disabled: disabled,
|
|
1832
|
+
textValue: textValue
|
|
1833
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
1834
|
+
role: "option",
|
|
1835
|
+
"aria-labelledby": textId,
|
|
1836
|
+
"data-highlighted": isFocused ? '' : undefined // `isFocused` caveat fixes stuttering in VoiceOver
|
|
1837
|
+
,
|
|
1838
|
+
"aria-selected": isSelected && isFocused,
|
|
1839
|
+
"data-state": isSelected ? 'checked' : 'unchecked',
|
|
1840
|
+
"aria-disabled": disabled || undefined,
|
|
1841
|
+
"data-disabled": disabled ? '' : undefined,
|
|
1842
|
+
tabIndex: disabled ? undefined : -1
|
|
1843
|
+
}, itemProps, {
|
|
1844
|
+
ref: composedRefs,
|
|
1845
|
+
onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onFocus, ()=>setIsFocused(true)
|
|
1846
|
+
),
|
|
1847
|
+
onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onBlur, ()=>setIsFocused(false)
|
|
1848
|
+
),
|
|
1849
|
+
onPointerUp: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerUp, handleSelect),
|
|
1850
|
+
onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerMove, (event)=>{
|
|
1851
|
+
if (disabled) {
|
|
1852
|
+
var _contentContext$onIte;
|
|
1853
|
+
(_contentContext$onIte = contentContext.onItemLeave) === null || _contentContext$onIte === void 0 || _contentContext$onIte.call(contentContext);
|
|
1854
|
+
} else // even though safari doesn't support this option, it's acceptable
|
|
1855
|
+
// as it only means it might scroll a few pixels when using the pointer.
|
|
1856
|
+
event.currentTarget.focus({
|
|
1857
|
+
preventScroll: true
|
|
1858
|
+
});
|
|
1859
|
+
}),
|
|
1860
|
+
onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerLeave, (event)=>{
|
|
1861
|
+
if (event.currentTarget === document.activeElement) {
|
|
1862
|
+
var _contentContext$onIte2;
|
|
1863
|
+
(_contentContext$onIte2 = contentContext.onItemLeave) === null || _contentContext$onIte2 === void 0 || _contentContext$onIte2.call(contentContext);
|
|
1864
|
+
}
|
|
1865
|
+
}),
|
|
1866
|
+
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onKeyDown, (event)=>{
|
|
1867
|
+
var _contentContext$searc;
|
|
1868
|
+
const isTypingAhead = ((_contentContext$searc = contentContext.searchRef) === null || _contentContext$searc === void 0 ? void 0 : _contentContext$searc.current) !== '';
|
|
1869
|
+
if (isTypingAhead && event.key === ' ') return;
|
|
1870
|
+
if ($cc7e05a45900e73f$var$SELECTION_KEYS.includes(event.key)) handleSelect(); // prevent page scroll if using the space key to select an item
|
|
1871
|
+
if (event.key === ' ') event.preventDefault();
|
|
1872
|
+
})
|
|
1873
|
+
}))));
|
|
1874
|
+
});
|
|
1875
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1876
|
+
* SelectItemText
|
|
1877
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$ITEM_TEXT_NAME = 'SelectItemText';
|
|
1878
|
+
const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1879
|
+
// We ignore `className` and `style` as this part shouldn't be styled.
|
|
1880
|
+
const { __scopeSelect: __scopeSelect , className: className , style: style , ...itemTextProps } = props;
|
|
1881
|
+
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
1882
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
1883
|
+
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
1884
|
+
const nativeOptionsContext = $cc7e05a45900e73f$var$useSelectNativeOptionsContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
1885
|
+
const [itemTextNode, setItemTextNode] = useState(null);
|
|
1886
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setItemTextNode(node)
|
|
1887
|
+
, itemContext.onItemTextChange, (node)=>{
|
|
1888
|
+
var _contentContext$itemT;
|
|
1889
|
+
return (_contentContext$itemT = contentContext.itemTextRefCallback) === null || _contentContext$itemT === void 0 ? void 0 : _contentContext$itemT.call(contentContext, node, itemContext.value, itemContext.disabled);
|
|
1890
|
+
});
|
|
1891
|
+
const textContent = itemTextNode === null || itemTextNode === void 0 ? void 0 : itemTextNode.textContent;
|
|
1892
|
+
const nativeOption = useMemo(()=>/*#__PURE__*/ createElement("option", {
|
|
1893
|
+
key: itemContext.value,
|
|
1894
|
+
value: itemContext.value,
|
|
1895
|
+
disabled: itemContext.disabled
|
|
1896
|
+
}, textContent)
|
|
1897
|
+
, [
|
|
1898
|
+
itemContext.disabled,
|
|
1899
|
+
itemContext.value,
|
|
1900
|
+
textContent
|
|
1901
|
+
]);
|
|
1902
|
+
const { onNativeOptionAdd: onNativeOptionAdd , onNativeOptionRemove: onNativeOptionRemove } = nativeOptionsContext;
|
|
1903
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1904
|
+
onNativeOptionAdd(nativeOption);
|
|
1905
|
+
return ()=>onNativeOptionRemove(nativeOption)
|
|
1906
|
+
;
|
|
1907
|
+
}, [
|
|
1908
|
+
onNativeOptionAdd,
|
|
1909
|
+
onNativeOptionRemove,
|
|
1910
|
+
nativeOption
|
|
1911
|
+
]);
|
|
1912
|
+
return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
|
|
1913
|
+
id: itemContext.textId
|
|
1914
|
+
}, itemTextProps, {
|
|
1915
|
+
ref: composedRefs
|
|
1916
|
+
})), itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? /*#__PURE__*/ createPortal(itemTextProps.children, context.valueNode) : null);
|
|
1917
|
+
});
|
|
1918
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1919
|
+
* SelectItemIndicator
|
|
1920
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$ITEM_INDICATOR_NAME = 'SelectItemIndicator';
|
|
1921
|
+
const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1922
|
+
const { __scopeSelect: __scopeSelect , ...itemIndicatorProps } = props;
|
|
1923
|
+
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_INDICATOR_NAME, __scopeSelect);
|
|
1924
|
+
return itemContext.isSelected ? /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
|
|
1925
|
+
"aria-hidden": true
|
|
1926
|
+
}, itemIndicatorProps, {
|
|
1927
|
+
ref: forwardedRef
|
|
1928
|
+
})) : null;
|
|
1929
|
+
});
|
|
1930
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1931
|
+
* SelectScrollUpButton
|
|
1932
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton';
|
|
1933
|
+
const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1934
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
1935
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
1936
|
+
const [canScrollUp1, setCanScrollUp] = useState(false);
|
|
1937
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, viewportContext.onScrollButtonChange);
|
|
1938
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1939
|
+
if (contentContext.viewport && contentContext.isPositioned) {
|
|
1940
|
+
const viewport = contentContext.viewport;
|
|
1941
|
+
function handleScroll() {
|
|
1942
|
+
const canScrollUp = viewport.scrollTop > 0;
|
|
1943
|
+
setCanScrollUp(canScrollUp);
|
|
1944
|
+
}
|
|
1945
|
+
handleScroll();
|
|
1946
|
+
viewport.addEventListener('scroll', handleScroll);
|
|
1947
|
+
return ()=>viewport.removeEventListener('scroll', handleScroll)
|
|
1948
|
+
;
|
|
1949
|
+
}
|
|
1950
|
+
}, [
|
|
1951
|
+
contentContext.viewport,
|
|
1952
|
+
contentContext.isPositioned
|
|
1953
|
+
]);
|
|
1954
|
+
return canScrollUp1 ? /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, _extends({}, props, {
|
|
1955
|
+
ref: composedRefs,
|
|
1956
|
+
onAutoScroll: ()=>{
|
|
1957
|
+
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
1958
|
+
if (viewport && selectedItem) viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight;
|
|
1959
|
+
}
|
|
1960
|
+
})) : null;
|
|
1961
|
+
});
|
|
1962
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1963
|
+
* SelectScrollDownButton
|
|
1964
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';
|
|
1965
|
+
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1966
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
1967
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
1968
|
+
const [canScrollDown1, setCanScrollDown] = useState(false);
|
|
1969
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, viewportContext.onScrollButtonChange);
|
|
1970
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
1971
|
+
if (contentContext.viewport && contentContext.isPositioned) {
|
|
1972
|
+
const viewport = contentContext.viewport;
|
|
1973
|
+
function handleScroll() {
|
|
1974
|
+
const maxScroll = viewport.scrollHeight - viewport.clientHeight; // we use Math.ceil here because if the UI is zoomed-in
|
|
1975
|
+
// `scrollTop` is not always reported as an integer
|
|
1976
|
+
const canScrollDown = Math.ceil(viewport.scrollTop) < maxScroll;
|
|
1977
|
+
setCanScrollDown(canScrollDown);
|
|
1978
|
+
}
|
|
1979
|
+
handleScroll();
|
|
1980
|
+
viewport.addEventListener('scroll', handleScroll);
|
|
1981
|
+
return ()=>viewport.removeEventListener('scroll', handleScroll)
|
|
1982
|
+
;
|
|
1983
|
+
}
|
|
1984
|
+
}, [
|
|
1985
|
+
contentContext.viewport,
|
|
1986
|
+
contentContext.isPositioned
|
|
1987
|
+
]);
|
|
1988
|
+
return canScrollDown1 ? /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, _extends({}, props, {
|
|
1989
|
+
ref: composedRefs,
|
|
1990
|
+
onAutoScroll: ()=>{
|
|
1991
|
+
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
1992
|
+
if (viewport && selectedItem) viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;
|
|
1993
|
+
}
|
|
1994
|
+
})) : null;
|
|
1995
|
+
});
|
|
1996
|
+
const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1997
|
+
const { __scopeSelect: __scopeSelect , onAutoScroll: onAutoScroll , ...scrollIndicatorProps } = props;
|
|
1998
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext('SelectScrollButton', __scopeSelect);
|
|
1999
|
+
const autoScrollTimerRef = useRef(null);
|
|
2000
|
+
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
2001
|
+
const clearAutoScrollTimer = useCallback(()=>{
|
|
2002
|
+
if (autoScrollTimerRef.current !== null) {
|
|
2003
|
+
window.clearInterval(autoScrollTimerRef.current);
|
|
2004
|
+
autoScrollTimerRef.current = null;
|
|
2005
|
+
}
|
|
2006
|
+
}, []);
|
|
2007
|
+
useEffect(()=>{
|
|
2008
|
+
return ()=>clearAutoScrollTimer()
|
|
2009
|
+
;
|
|
2010
|
+
}, [
|
|
2011
|
+
clearAutoScrollTimer
|
|
2012
|
+
]); // When the viewport becomes scrollable on either side, the relevant scroll button will mount.
|
|
2013
|
+
// Because it is part of the normal flow, it will push down (top button) or shrink (bottom button)
|
|
2014
|
+
// the viewport, potentially causing the active item to now be partially out of view.
|
|
2015
|
+
// We re-run the `scrollIntoView` logic to make sure it stays within the viewport.
|
|
2016
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2017
|
+
var _activeItem$ref$curre;
|
|
2018
|
+
const activeItem = getItems().find((item)=>item.ref.current === document.activeElement
|
|
2019
|
+
);
|
|
2020
|
+
activeItem === null || activeItem === void 0 || (_activeItem$ref$curre = activeItem.ref.current) === null || _activeItem$ref$curre === void 0 || _activeItem$ref$curre.scrollIntoView({
|
|
2021
|
+
block: 'nearest'
|
|
2022
|
+
});
|
|
2023
|
+
}, [
|
|
2024
|
+
getItems
|
|
2025
|
+
]);
|
|
2026
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
2027
|
+
"aria-hidden": true
|
|
2028
|
+
}, scrollIndicatorProps, {
|
|
2029
|
+
ref: forwardedRef,
|
|
2030
|
+
style: {
|
|
2031
|
+
flexShrink: 0,
|
|
2032
|
+
...scrollIndicatorProps.style
|
|
2033
|
+
},
|
|
2034
|
+
onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerDown, ()=>{
|
|
2035
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
2036
|
+
}),
|
|
2037
|
+
onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerMove, ()=>{
|
|
2038
|
+
var _contentContext$onIte3;
|
|
2039
|
+
(_contentContext$onIte3 = contentContext.onItemLeave) === null || _contentContext$onIte3 === void 0 || _contentContext$onIte3.call(contentContext);
|
|
2040
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
2041
|
+
}),
|
|
2042
|
+
onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerLeave, ()=>{
|
|
2043
|
+
clearAutoScrollTimer();
|
|
2044
|
+
})
|
|
2045
|
+
}));
|
|
2046
|
+
});
|
|
2047
|
+
/* -----------------------------------------------------------------------------------------------*/ function $cc7e05a45900e73f$var$shouldShowPlaceholder(value) {
|
|
2048
|
+
return value === '' || value === undefined;
|
|
2049
|
+
}
|
|
2050
|
+
const $cc7e05a45900e73f$var$BubbleSelect = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
2051
|
+
const { value: value , ...selectProps } = props;
|
|
2052
|
+
const ref = useRef(null);
|
|
2053
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
2054
|
+
const prevValue = $010c2913dbd2fe3d$export$5cae361ad82dce8b(value); // Bubble value change to parents (e.g form change event)
|
|
2055
|
+
useEffect(()=>{
|
|
2056
|
+
const select = ref.current;
|
|
2057
|
+
const selectProto = window.HTMLSelectElement.prototype;
|
|
2058
|
+
const descriptor = Object.getOwnPropertyDescriptor(selectProto, 'value');
|
|
2059
|
+
const setValue = descriptor.set;
|
|
2060
|
+
if (prevValue !== value && setValue) {
|
|
2061
|
+
const event = new Event('change', {
|
|
2062
|
+
bubbles: true
|
|
2063
|
+
});
|
|
2064
|
+
setValue.call(select, value);
|
|
2065
|
+
select.dispatchEvent(event);
|
|
2066
|
+
}
|
|
2067
|
+
}, [
|
|
2068
|
+
prevValue,
|
|
2069
|
+
value
|
|
2070
|
+
]);
|
|
2071
|
+
/**
|
|
2072
|
+
* We purposefully use a `select` here to support form autofill as much
|
|
2073
|
+
* as possible.
|
|
2074
|
+
*
|
|
2075
|
+
* We purposefully do not add the `value` attribute here to allow the value
|
|
2076
|
+
* to be set programatically and bubble to any parent form `onChange` event.
|
|
2077
|
+
* Adding the `value` will cause React to consider the programatic
|
|
2078
|
+
* dispatch a duplicate and it will get swallowed.
|
|
2079
|
+
*
|
|
2080
|
+
* We use `VisuallyHidden` rather than `display: "none"` because Safari autofill
|
|
2081
|
+
* won't work otherwise.
|
|
2082
|
+
*/ return /*#__PURE__*/ createElement($ea1ef594cf570d83$export$439d29a4e110a164, {
|
|
2083
|
+
asChild: true
|
|
2084
|
+
}, /*#__PURE__*/ createElement("select", _extends({}, selectProps, {
|
|
2085
|
+
ref: composedRefs,
|
|
2086
|
+
defaultValue: value
|
|
2087
|
+
})));
|
|
2088
|
+
});
|
|
2089
|
+
$cc7e05a45900e73f$var$BubbleSelect.displayName = 'BubbleSelect';
|
|
2090
|
+
function $cc7e05a45900e73f$var$useTypeaheadSearch(onSearchChange) {
|
|
2091
|
+
const handleSearchChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onSearchChange);
|
|
2092
|
+
const searchRef = useRef('');
|
|
2093
|
+
const timerRef = useRef(0);
|
|
2094
|
+
const handleTypeaheadSearch = useCallback((key)=>{
|
|
2095
|
+
const search = searchRef.current + key;
|
|
2096
|
+
handleSearchChange(search);
|
|
2097
|
+
(function updateSearch(value) {
|
|
2098
|
+
searchRef.current = value;
|
|
2099
|
+
window.clearTimeout(timerRef.current); // Reset `searchRef` 1 second after it was last updated
|
|
2100
|
+
if (value !== '') timerRef.current = window.setTimeout(()=>updateSearch('')
|
|
2101
|
+
, 1000);
|
|
2102
|
+
})(search);
|
|
2103
|
+
}, [
|
|
2104
|
+
handleSearchChange
|
|
2105
|
+
]);
|
|
2106
|
+
const resetTypeahead = useCallback(()=>{
|
|
2107
|
+
searchRef.current = '';
|
|
2108
|
+
window.clearTimeout(timerRef.current);
|
|
2109
|
+
}, []);
|
|
2110
|
+
useEffect(()=>{
|
|
2111
|
+
return ()=>window.clearTimeout(timerRef.current)
|
|
2112
|
+
;
|
|
2113
|
+
}, []);
|
|
2114
|
+
return [
|
|
2115
|
+
searchRef,
|
|
2116
|
+
handleTypeaheadSearch,
|
|
2117
|
+
resetTypeahead
|
|
2118
|
+
];
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* This is the "meat" of the typeahead matching logic. It takes in a list of items,
|
|
2122
|
+
* the search and the current item, and returns the next item (or `undefined`).
|
|
2123
|
+
*
|
|
2124
|
+
* We normalize the search because if a user has repeatedly pressed a character,
|
|
2125
|
+
* we want the exact same behavior as if we only had that one character
|
|
2126
|
+
* (ie. cycle through items starting with that character)
|
|
2127
|
+
*
|
|
2128
|
+
* We also reorder the items by wrapping the array around the current item.
|
|
2129
|
+
* This is so we always look forward from the current item, and picking the first
|
|
2130
|
+
* item will always be the correct one.
|
|
2131
|
+
*
|
|
2132
|
+
* Finally, if the normalized search is exactly one character, we exclude the
|
|
2133
|
+
* current item from the values because otherwise it would be the first to match always
|
|
2134
|
+
* and focus would never move. This is as opposed to the regular case, where we
|
|
2135
|
+
* don't want focus to move if the current item still matches.
|
|
2136
|
+
*/ function $cc7e05a45900e73f$var$findNextItem(items, search, currentItem) {
|
|
2137
|
+
const isRepeated = search.length > 1 && Array.from(search).every((char)=>char === search[0]
|
|
2138
|
+
);
|
|
2139
|
+
const normalizedSearch = isRepeated ? search[0] : search;
|
|
2140
|
+
const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;
|
|
2141
|
+
let wrappedItems = $cc7e05a45900e73f$var$wrapArray(items, Math.max(currentItemIndex, 0));
|
|
2142
|
+
const excludeCurrentItem = normalizedSearch.length === 1;
|
|
2143
|
+
if (excludeCurrentItem) wrappedItems = wrappedItems.filter((v)=>v !== currentItem
|
|
2144
|
+
);
|
|
2145
|
+
const nextItem = wrappedItems.find((item)=>item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase())
|
|
2146
|
+
);
|
|
2147
|
+
return nextItem !== currentItem ? nextItem : undefined;
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Wraps an array around itself at a given start index
|
|
2151
|
+
* Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
|
|
2152
|
+
*/ function $cc7e05a45900e73f$var$wrapArray(array, startIndex) {
|
|
2153
|
+
return array.map((_, index)=>array[(startIndex + index) % array.length]
|
|
2154
|
+
);
|
|
2155
|
+
}
|
|
2156
|
+
const $cc7e05a45900e73f$export$be92b6f5f03c0fe9 = $cc7e05a45900e73f$export$ef9b1a59e592288f;
|
|
2157
|
+
const $cc7e05a45900e73f$export$41fb9f06171c75f4 = $cc7e05a45900e73f$export$3ac1e88a1c0b9f1;
|
|
2158
|
+
const $cc7e05a45900e73f$export$4c8d1a57a761ef94 = $cc7e05a45900e73f$export$e288731fd71264f0;
|
|
2159
|
+
const $cc7e05a45900e73f$export$f04a61298a47a40f = $cc7e05a45900e73f$export$99b400cabb58c515;
|
|
2160
|
+
const $cc7e05a45900e73f$export$602eac185826482c = $cc7e05a45900e73f$export$b2af6c9944296213;
|
|
2161
|
+
const $cc7e05a45900e73f$export$7c6e2c02157bb7d2 = $cc7e05a45900e73f$export$c973a4b3cb86a03d;
|
|
2162
|
+
const $cc7e05a45900e73f$export$d5c6c08dc2d3ca7 = $cc7e05a45900e73f$export$9ed6e7b40248d36d;
|
|
2163
|
+
const $cc7e05a45900e73f$export$6d08773d2e66f8f2 = $cc7e05a45900e73f$export$13ef48a934230896;
|
|
2164
|
+
const $cc7e05a45900e73f$export$d6e5bf9c43ea9319 = $cc7e05a45900e73f$export$3572fb0fb821ff49;
|
|
2165
|
+
const $cc7e05a45900e73f$export$c3468e2714d175fa = $cc7e05a45900e73f$export$6b9198de19accfe6;
|
|
2166
|
+
const $cc7e05a45900e73f$export$2f60d3ec9ad468f2 = $cc7e05a45900e73f$export$d8117927658af6d7;
|
|
2167
|
+
const $cc7e05a45900e73f$export$bf1aedc3039c8d63 = $cc7e05a45900e73f$export$ff951e476c12189;
|
|
2168
|
+
|
|
2169
|
+
export { $cc7e05a45900e73f$export$be92b6f5f03c0fe9 as $, $cc7e05a45900e73f$export$41fb9f06171c75f4 as a, $cc7e05a45900e73f$export$4c8d1a57a761ef94 as b, $cc7e05a45900e73f$export$f04a61298a47a40f as c, $cc7e05a45900e73f$export$602eac185826482c as d, $cc7e05a45900e73f$export$7c6e2c02157bb7d2 as e, $cc7e05a45900e73f$export$2f60d3ec9ad468f2 as f, $cc7e05a45900e73f$export$d5c6c08dc2d3ca7 as g, $cc7e05a45900e73f$export$6d08773d2e66f8f2 as h, $cc7e05a45900e73f$export$d6e5bf9c43ea9319 as i, $cc7e05a45900e73f$export$c3468e2714d175fa as j, $cc7e05a45900e73f$export$bf1aedc3039c8d63 as k };
|