@strapi/design-system 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/Accordion.js +70 -25
- package/dist/Accordion/Accordion.mjs +55 -0
- package/dist/Accordion/AccordionContent.js +19 -12
- package/dist/Accordion/AccordionContent.mjs +16 -0
- package/dist/Accordion/AccordionContext.js +17 -12
- package/dist/Accordion/AccordionContext.mjs +12 -0
- package/dist/Accordion/AccordionGroup.js +64 -32
- package/dist/Accordion/AccordionGroup.mjs +65 -0
- package/dist/Accordion/AccordionToggle.js +64 -31
- package/dist/Accordion/AccordionToggle.mjs +78 -0
- package/dist/Accordion/index.js +16 -11
- package/dist/Accordion/index.mjs +4 -0
- package/dist/Accordion/utils.js +18 -6
- package/dist/Accordion/utils.mjs +15 -0
- package/dist/Alert/Alert.js +41 -19
- package/dist/Alert/Alert.mjs +54 -0
- package/dist/Alert/index.js +9 -4
- package/dist/Alert/index.mjs +1 -0
- package/dist/Alert/utils.js +35 -16
- package/dist/Alert/utils.mjs +30 -0
- package/dist/Avatar/Avatar.js +57 -27
- package/dist/Avatar/Avatar.mjs +41 -0
- package/dist/Avatar/AvatarGroup.js +16 -8
- package/dist/Avatar/AvatarGroup.mjs +11 -0
- package/dist/Avatar/constants.js +9 -5
- package/dist/Avatar/constants.mjs +4 -0
- package/dist/Avatar/index.js +12 -7
- package/dist/Avatar/index.mjs +2 -0
- package/dist/Badge/Badge.js +22 -13
- package/dist/Badge/Badge.mjs +15 -0
- package/dist/Badge/index.js +9 -4
- package/dist/Badge/index.mjs +1 -0
- package/dist/BaseButton/BaseButton.js +46 -16
- package/dist/BaseButton/BaseButton.mjs +29 -0
- package/dist/BaseButton/index.js +10 -5
- package/dist/BaseButton/index.mjs +1 -0
- package/dist/BaseCheckbox/BaseCheckbox.js +75 -37
- package/dist/BaseCheckbox/BaseCheckbox.mjs +92 -0
- package/dist/BaseCheckbox/assets/checkmark-black.svg.js +5 -4
- package/dist/BaseCheckbox/assets/checkmark-black.svg.mjs +3 -0
- package/dist/BaseCheckbox/assets/checkmark.svg.js +5 -4
- package/dist/BaseCheckbox/assets/checkmark.svg.mjs +3 -0
- package/dist/BaseCheckbox/index.js +9 -4
- package/dist/BaseCheckbox/index.mjs +1 -0
- package/dist/BaseCheckbox/utils.js +15 -3
- package/dist/BaseCheckbox/utils.mjs +12 -0
- package/dist/BaseLink/BaseLink.js +18 -8
- package/dist/BaseLink/BaseLink.mjs +10 -0
- package/dist/BaseLink/index.js +9 -4
- package/dist/BaseLink/index.mjs +1 -0
- package/dist/BaseRadio/BaseRadio.js +39 -39
- package/dist/BaseRadio/BaseRadio.mjs +49 -0
- package/dist/BaseRadio/RadioGroup.js +20 -14
- package/dist/BaseRadio/RadioGroup.mjs +17 -0
- package/dist/BaseRadio/context.js +13 -9
- package/dist/BaseRadio/context.mjs +10 -0
- package/dist/BaseRadio/index.js +11 -6
- package/dist/BaseRadio/index.mjs +2 -0
- package/dist/BaseRadio/utils.js +33 -5
- package/dist/BaseRadio/utils.mjs +28 -0
- package/dist/Box/Box.js +79 -63
- package/dist/Box/Box.mjs +103 -0
- package/dist/Box/index.js +9 -4
- package/dist/Box/index.mjs +1 -0
- package/dist/Breadcrumbs/Breadcrumbs.js +31 -20
- package/dist/Breadcrumbs/Breadcrumbs.mjs +32 -0
- package/dist/Breadcrumbs/index.js +10 -5
- package/dist/Breadcrumbs/index.mjs +1 -0
- package/dist/Button/Button.js +45 -30
- package/dist/Button/Button.mjs +61 -0
- package/dist/Button/constants.js +27 -14
- package/dist/Button/constants.mjs +13 -0
- package/dist/Button/index.js +10 -5
- package/dist/Button/index.mjs +1 -0
- package/dist/Button/utils.js +121 -72
- package/dist/Button/utils.mjs +153 -0
- package/dist/Card/Card.js +16 -11
- package/dist/Card/Card.mjs +13 -0
- package/dist/Card/CardAction.js +30 -16
- package/dist/Card/CardAction.mjs +26 -0
- package/dist/Card/CardAsset.js +28 -15
- package/dist/Card/CardAsset.mjs +33 -0
- package/dist/Card/CardBadge.js +20 -10
- package/dist/Card/CardBadge.mjs +14 -0
- package/dist/Card/CardBody.js +12 -6
- package/dist/Card/CardBody.mjs +9 -0
- package/dist/Card/CardCheckbox.js +15 -12
- package/dist/Card/CardCheckbox.mjs +13 -0
- package/dist/Card/CardContent.js +18 -7
- package/dist/Card/CardContent.mjs +12 -0
- package/dist/Card/CardContext.js +11 -6
- package/dist/Card/CardContext.mjs +6 -0
- package/dist/Card/CardHeader.js +19 -8
- package/dist/Card/CardHeader.mjs +12 -0
- package/dist/Card/CardTimer.js +11 -7
- package/dist/Card/CardTimer.mjs +7 -0
- package/dist/Card/CardTitle.js +17 -10
- package/dist/Card/CardTitle.mjs +13 -0
- package/dist/Card/index.js +28 -23
- package/dist/Card/index.mjs +10 -0
- package/dist/CarouselInput/Carousel.js +73 -32
- package/dist/CarouselInput/Carousel.mjs +54 -0
- package/dist/CarouselInput/CarouselActions.js +10 -6
- package/dist/CarouselInput/CarouselActions.mjs +6 -0
- package/dist/CarouselInput/CarouselImage.js +29 -16
- package/dist/CarouselInput/CarouselImage.mjs +22 -0
- package/dist/CarouselInput/CarouselInput.js +19 -15
- package/dist/CarouselInput/CarouselInput.mjs +16 -0
- package/dist/CarouselInput/CarouselSlide.js +10 -6
- package/dist/CarouselInput/CarouselSlide.mjs +6 -0
- package/dist/CarouselInput/index.js +17 -12
- package/dist/CarouselInput/index.mjs +5 -0
- package/dist/Checkbox/Checkbox.js +59 -24
- package/dist/Checkbox/Checkbox.mjs +37 -0
- package/dist/Checkbox/index.js +9 -4
- package/dist/Checkbox/index.mjs +1 -0
- package/dist/Combobox/Combobox.js +175 -102
- package/dist/Combobox/Combobox.mjs +218 -0
- package/dist/Combobox/ComboboxList.js +12 -4
- package/dist/Combobox/ComboboxList.mjs +14 -0
- package/dist/Combobox/ComboboxOption.js +9 -5
- package/dist/Combobox/ComboboxOption.mjs +5 -0
- package/dist/Combobox/index.js +12 -7
- package/dist/Combobox/index.mjs +2 -0
- package/dist/DatePicker/DatePicker.js +682 -364
- package/dist/DatePicker/DatePicker.mjs +721 -0
- package/dist/DatePicker/index.js +9 -4
- package/dist/DatePicker/index.mjs +1 -0
- package/dist/DateTimePicker/DateTimePicker.js +140 -97
- package/dist/DateTimePicker/DateTimePicker.mjs +137 -0
- package/dist/DateTimePicker/index.js +10 -5
- package/dist/DateTimePicker/index.mjs +1 -0
- package/dist/DesignSystemProvider.js +26 -9
- package/dist/DesignSystemProvider.mjs +22 -0
- package/dist/Dialog/Dialog.js +38 -25
- package/dist/Dialog/Dialog.mjs +36 -0
- package/dist/Dialog/DialogBody.js +22 -11
- package/dist/Dialog/DialogBody.mjs +20 -0
- package/dist/Dialog/DialogFooter.js +20 -9
- package/dist/Dialog/DialogFooter.mjs +19 -0
- package/dist/Dialog/index.js +13 -8
- package/dist/Dialog/index.mjs +3 -0
- package/dist/DismissibleLayer/index.js +29 -5
- package/dist/DismissibleLayer/index.mjs +5 -0
- package/dist/Divider/Divider.js +19 -8
- package/dist/Divider/Divider.mjs +16 -0
- package/dist/Divider/index.js +9 -4
- package/dist/Divider/index.mjs +1 -0
- package/dist/EmptyStateLayout/EmptyStateLayout.js +20 -9
- package/dist/EmptyStateLayout/EmptyStateLayout.mjs +16 -0
- package/dist/EmptyStateLayout/index.js +9 -4
- package/dist/EmptyStateLayout/index.mjs +1 -0
- package/dist/EmptyStateLayout/story-assets/Illo.js +9 -5
- package/dist/EmptyStateLayout/story-assets/Illo.mjs +5 -0
- package/dist/Field/Field.js +16 -11
- package/dist/Field/Field.mjs +13 -0
- package/dist/Field/FieldAction.js +22 -14
- package/dist/Field/FieldAction.mjs +16 -0
- package/dist/Field/FieldContext.js +11 -6
- package/dist/Field/FieldContext.mjs +6 -0
- package/dist/Field/FieldError.js +16 -9
- package/dist/Field/FieldError.mjs +13 -0
- package/dist/Field/FieldHint.js +16 -9
- package/dist/Field/FieldHint.mjs +13 -0
- package/dist/Field/FieldInput.js +65 -43
- package/dist/Field/FieldInput.mjs +76 -0
- package/dist/Field/FieldLabel.js +40 -17
- package/dist/Field/FieldLabel.mjs +40 -0
- package/dist/Field/index.js +23 -18
- package/dist/Field/index.mjs +7 -0
- package/dist/Flex/Flex.js +30 -18
- package/dist/Flex/Flex.mjs +23 -0
- package/dist/Flex/index.js +9 -4
- package/dist/Flex/index.mjs +1 -0
- package/dist/FocusTrap/FocusTrap.js +67 -31
- package/dist/FocusTrap/FocusTrap.mjs +65 -0
- package/dist/FocusTrap/index.js +9 -4
- package/dist/FocusTrap/index.mjs +1 -0
- package/dist/Grid/Grid.js +22 -13
- package/dist/Grid/Grid.mjs +16 -0
- package/dist/Grid/GridItem.js +19 -11
- package/dist/Grid/GridItem.mjs +17 -0
- package/dist/Grid/index.js +11 -6
- package/dist/Grid/index.mjs +2 -0
- package/dist/Icon/Icon.js +25 -13
- package/dist/Icon/Icon.mjs +18 -0
- package/dist/Icon/index.js +9 -4
- package/dist/Icon/index.mjs +1 -0
- package/dist/IconButton/IconButton.js +101 -46
- package/dist/IconButton/IconButton.mjs +128 -0
- package/dist/IconButton/index.js +10 -5
- package/dist/IconButton/index.mjs +1 -0
- package/dist/JSONInput/JSONInput.js +122 -75
- package/dist/JSONInput/JSONInput.mjs +142 -0
- package/dist/JSONInput/index.js +9 -4
- package/dist/JSONInput/index.mjs +1 -0
- package/dist/JSONInput/utils/decorationExtension.js +42 -26
- package/dist/JSONInput/utils/decorationExtension.mjs +36 -0
- package/dist/KeyboardNavigable/KeyboardNavigable.js +71 -42
- package/dist/KeyboardNavigable/KeyboardNavigable.mjs +71 -0
- package/dist/KeyboardNavigable/index.js +9 -4
- package/dist/KeyboardNavigable/index.mjs +1 -0
- package/dist/Layout/ActionLayout.js +14 -5
- package/dist/Layout/ActionLayout.mjs +11 -0
- package/dist/Layout/ContentLayout.js +11 -5
- package/dist/Layout/ContentLayout.mjs +8 -0
- package/dist/Layout/GridLayout.js +14 -6
- package/dist/Layout/GridLayout.mjs +9 -0
- package/dist/Layout/HeaderLayout.js +51 -30
- package/dist/Layout/HeaderLayout.mjs +43 -0
- package/dist/Layout/Layout.js +21 -9
- package/dist/Layout/Layout.mjs +16 -0
- package/dist/Layout/TwoColsLayout.js +13 -7
- package/dist/Layout/TwoColsLayout.mjs +10 -0
- package/dist/Layout/index.js +20 -15
- package/dist/Layout/index.mjs +6 -0
- package/dist/Link/Link.js +53 -20
- package/dist/Link/Link.mjs +50 -0
- package/dist/Link/index.js +9 -4
- package/dist/Link/index.mjs +1 -0
- package/dist/LinkButton/LinkButton.js +51 -20
- package/dist/LinkButton/LinkButton.mjs +33 -0
- package/dist/LinkButton/index.js +9 -4
- package/dist/LinkButton/index.mjs +1 -0
- package/dist/LiveRegions/LiveRegions.js +12 -6
- package/dist/LiveRegions/LiveRegions.mjs +9 -0
- package/dist/LiveRegions/constants.js +10 -7
- package/dist/LiveRegions/constants.mjs +7 -0
- package/dist/LiveRegions/index.js +11 -6
- package/dist/LiveRegions/index.mjs +2 -0
- package/dist/LiveRegions/useNotifyAT.js +36 -16
- package/dist/LiveRegions/useNotifyAT.mjs +33 -0
- package/dist/Loader/Loader.js +44 -13
- package/dist/Loader/Loader.mjs +24 -0
- package/dist/Loader/assets/loader.svg.js +5 -4
- package/dist/Loader/assets/loader.svg.mjs +3 -0
- package/dist/Loader/index.js +9 -4
- package/dist/Loader/index.mjs +1 -0
- package/dist/Main/Main.js +18 -7
- package/dist/Main/Main.mjs +15 -0
- package/dist/Main/SkipToContent.js +20 -9
- package/dist/Main/SkipToContent.mjs +17 -0
- package/dist/Main/index.js +11 -6
- package/dist/Main/index.mjs +2 -0
- package/dist/MainNav/MainNav.js +21 -10
- package/dist/MainNav/MainNav.mjs +14 -0
- package/dist/MainNav/MainNavContext.js +11 -6
- package/dist/MainNav/MainNavContext.mjs +6 -0
- package/dist/MainNav/NavBrand.js +32 -16
- package/dist/MainNav/NavBrand.mjs +31 -0
- package/dist/MainNav/NavCondense.js +27 -18
- package/dist/MainNav/NavCondense.mjs +33 -0
- package/dist/MainNav/NavFooter.js +11 -5
- package/dist/MainNav/NavFooter.mjs +8 -0
- package/dist/MainNav/NavLink.js +59 -40
- package/dist/MainNav/NavLink.mjs +92 -0
- package/dist/MainNav/NavSection.js +31 -11
- package/dist/MainNav/NavSection.mjs +24 -0
- package/dist/MainNav/NavSections.js +24 -9
- package/dist/MainNav/NavSections.mjs +18 -0
- package/dist/MainNav/NavUser.js +27 -17
- package/dist/MainNav/NavUser.mjs +19 -0
- package/dist/MainNav/index.js +23 -18
- package/dist/MainNav/index.mjs +8 -0
- package/dist/ModalLayout/ModalBody.js +18 -7
- package/dist/ModalLayout/ModalBody.mjs +13 -0
- package/dist/ModalLayout/ModalContext.js +11 -7
- package/dist/ModalLayout/ModalContext.mjs +6 -0
- package/dist/ModalLayout/ModalFooter.js +21 -10
- package/dist/ModalLayout/ModalFooter.mjs +14 -0
- package/dist/ModalLayout/ModalHeader.js +25 -16
- package/dist/ModalLayout/ModalHeader.mjs +18 -0
- package/dist/ModalLayout/ModalLayout.js +26 -14
- package/dist/ModalLayout/ModalLayout.mjs +20 -0
- package/dist/ModalLayout/index.js +15 -10
- package/dist/ModalLayout/index.mjs +4 -0
- package/dist/NumberInput/NumberInput.js +121 -70
- package/dist/NumberInput/NumberInput.mjs +121 -0
- package/dist/NumberInput/index.js +9 -4
- package/dist/NumberInput/index.mjs +1 -0
- package/dist/Pagination/Pagination.js +38 -11
- package/dist/Pagination/Pagination.mjs +15 -0
- package/dist/Pagination/PaginationContext.js +11 -6
- package/dist/Pagination/PaginationContext.mjs +6 -0
- package/dist/Pagination/assets/next.svg.js +5 -4
- package/dist/Pagination/assets/next.svg.mjs +3 -0
- package/dist/Pagination/assets/previous.svg.js +5 -4
- package/dist/Pagination/assets/previous.svg.mjs +3 -0
- package/dist/Pagination/components.js +63 -46
- package/dist/Pagination/components.mjs +73 -0
- package/dist/Pagination/index.js +14 -9
- package/dist/Pagination/index.mjs +2 -0
- package/dist/Popover/Popover.js +149 -111
- package/dist/Popover/Popover.mjs +136 -0
- package/dist/Popover/index.js +12 -7
- package/dist/Popover/index.mjs +3 -0
- package/dist/Popover/primitives.js +10 -5
- package/dist/Popover/primitives.mjs +1 -0
- package/dist/Portal/Portal.js +35 -9
- package/dist/Portal/Portal.mjs +11 -0
- package/dist/Portal/index.js +9 -4
- package/dist/Portal/index.mjs +1 -0
- package/dist/ProgressBar/ProgressBar.js +21 -10
- package/dist/ProgressBar/ProgressBar.mjs +20 -0
- package/dist/ProgressBar/index.js +9 -4
- package/dist/ProgressBar/index.mjs +1 -0
- package/dist/Radio/Radio.js +13 -7
- package/dist/Radio/Radio.mjs +10 -0
- package/dist/Radio/index.js +11 -6
- package/dist/Radio/index.mjs +2 -0
- package/dist/RawTable/RawCell.js +147 -58
- package/dist/RawTable/RawCell.mjs +144 -0
- package/dist/RawTable/RawTable.js +84 -52
- package/dist/RawTable/RawTable.mjs +81 -0
- package/dist/RawTable/RawTableContext.js +17 -12
- package/dist/RawTable/RawTableContext.mjs +12 -0
- package/dist/RawTable/RawTbody.js +21 -8
- package/dist/RawTable/RawTbody.mjs +18 -0
- package/dist/RawTable/RawThead.js +20 -8
- package/dist/RawTable/RawThead.mjs +17 -0
- package/dist/RawTable/RawTr.js +21 -12
- package/dist/RawTable/RawTr.mjs +18 -0
- package/dist/RawTable/focusFocusable.js +11 -6
- package/dist/RawTable/focusFocusable.mjs +8 -0
- package/dist/RawTable/index.js +18 -13
- package/dist/RawTable/index.mjs +5 -0
- package/dist/Searchbar/SearchForm.js +9 -5
- package/dist/Searchbar/SearchForm.mjs +5 -0
- package/dist/Searchbar/Searchbar.js +45 -30
- package/dist/Searchbar/Searchbar.mjs +54 -0
- package/dist/Searchbar/index.js +11 -6
- package/dist/Searchbar/index.mjs +2 -0
- package/dist/Select/MultiSelect.js +143 -52
- package/dist/Select/MultiSelect.mjs +138 -0
- package/dist/Select/MultiSelectNested.js +24 -8
- package/dist/Select/MultiSelectNested.mjs +17 -0
- package/dist/Select/OptGroup.js +9 -5
- package/dist/Select/OptGroup.mjs +10 -0
- package/dist/Select/Option.js +14 -10
- package/dist/Select/Option.mjs +16 -0
- package/dist/Select/Select.js +37 -12
- package/dist/Select/Select.mjs +19 -0
- package/dist/Select/SelectList.js +141 -76
- package/dist/Select/SelectList.mjs +126 -0
- package/dist/Select/SelectParts.js +119 -60
- package/dist/Select/SelectParts.mjs +133 -0
- package/dist/Select/SingleSelect.js +109 -43
- package/dist/Select/SingleSelect.mjs +85 -0
- package/dist/Select/index.js +24 -19
- package/dist/Select/index.mjs +7 -0
- package/dist/SimpleMenu/SimpleMenu.js +159 -80
- package/dist/SimpleMenu/SimpleMenu.mjs +178 -0
- package/dist/SimpleMenu/index.js +10 -5
- package/dist/SimpleMenu/index.mjs +1 -0
- package/dist/SimpleMenu/utils.js +11 -8
- package/dist/SimpleMenu/utils.mjs +14 -0
- package/dist/Stack/Stack.js +43 -21
- package/dist/Stack/Stack.mjs +49 -0
- package/dist/Stack/index.js +9 -4
- package/dist/Stack/index.mjs +1 -0
- package/dist/Status/Status.js +32 -17
- package/dist/Status/Status.mjs +29 -0
- package/dist/Status/index.js +9 -4
- package/dist/Status/index.mjs +1 -0
- package/dist/SubNav/SubNav.js +23 -11
- package/dist/SubNav/SubNav.mjs +20 -0
- package/dist/SubNav/SubNavHeader.js +65 -37
- package/dist/SubNav/SubNavHeader.mjs +59 -0
- package/dist/SubNav/SubNavLink.js +38 -23
- package/dist/SubNav/SubNavLink.mjs +56 -0
- package/dist/SubNav/SubNavLinkSection.js +38 -21
- package/dist/SubNav/SubNavLinkSection.mjs +43 -0
- package/dist/SubNav/SubNavSection.js +33 -18
- package/dist/SubNav/SubNavSection.mjs +30 -0
- package/dist/SubNav/SubNavSectionLabel.js +29 -13
- package/dist/SubNav/SubNavSectionLabel.mjs +27 -0
- package/dist/SubNav/SubNavSections.js +20 -7
- package/dist/SubNav/SubNavSections.mjs +13 -0
- package/dist/SubNav/index.js +20 -15
- package/dist/SubNav/index.mjs +6 -0
- package/dist/Switch/Switch.js +32 -19
- package/dist/Switch/Switch.mjs +54 -0
- package/dist/Switch/index.js +9 -4
- package/dist/Switch/index.mjs +1 -0
- package/dist/Table/Cell.js +26 -11
- package/dist/Table/Cell.mjs +31 -0
- package/dist/Table/TFooter.js +26 -13
- package/dist/Table/TFooter.mjs +36 -0
- package/dist/Table/Table.js +54 -35
- package/dist/Table/Table.mjs +69 -0
- package/dist/Table/Tbody.js +18 -7
- package/dist/Table/Tbody.mjs +14 -0
- package/dist/Table/Thead.js +19 -8
- package/dist/Table/Thead.mjs +12 -0
- package/dist/Table/Tr.js +21 -10
- package/dist/Table/Tr.mjs +29 -0
- package/dist/Table/index.js +20 -15
- package/dist/Table/index.mjs +6 -0
- package/dist/Tabs/TabGroup.js +40 -15
- package/dist/Tabs/TabGroup.mjs +17 -0
- package/dist/Tabs/TabPanels.js +21 -12
- package/dist/Tabs/TabPanels.mjs +18 -0
- package/dist/Tabs/Tabs.js +145 -68
- package/dist/Tabs/Tabs.mjs +144 -0
- package/dist/Tabs/TabsContext.js +18 -13
- package/dist/Tabs/TabsContext.mjs +13 -0
- package/dist/Tabs/components.js +46 -25
- package/dist/Tabs/components.mjs +62 -0
- package/dist/Tabs/index.js +15 -10
- package/dist/Tabs/index.mjs +3 -0
- package/dist/Tag/Tag.js +29 -14
- package/dist/Tag/Tag.mjs +30 -0
- package/dist/Tag/index.js +9 -4
- package/dist/Tag/index.mjs +1 -0
- package/dist/TextButton/TextButton.js +52 -21
- package/dist/TextButton/TextButton.mjs +44 -0
- package/dist/TextButton/index.js +9 -4
- package/dist/TextButton/index.mjs +1 -0
- package/dist/TextInput/TextInput.js +32 -21
- package/dist/TextInput/TextInput.mjs +29 -0
- package/dist/TextInput/index.js +9 -4
- package/dist/TextInput/index.mjs +1 -0
- package/dist/Textarea/Textarea.js +44 -28
- package/dist/Textarea/Textarea.mjs +46 -0
- package/dist/Textarea/index.js +9 -4
- package/dist/Textarea/index.mjs +1 -0
- package/dist/ThemeProvider/ThemeProvider.js +16 -9
- package/dist/ThemeProvider/{ThemeProvider.cjs → ThemeProvider.mjs} +13 -3
- package/dist/ThemeProvider/hooks.js +10 -4
- package/dist/ThemeProvider/hooks.mjs +7 -0
- package/dist/ThemeProvider/index.js +11 -6
- package/dist/ThemeProvider/index.mjs +2 -0
- package/dist/TimePicker/TimePicker.js +133 -78
- package/dist/TimePicker/TimePicker.mjs +111 -0
- package/dist/TimePicker/index.js +10 -5
- package/dist/TimePicker/index.mjs +1 -0
- package/dist/ToggleCheckbox/ToggleCheckbox.js +73 -33
- package/dist/ToggleCheckbox/ToggleCheckbox.mjs +90 -0
- package/dist/ToggleCheckbox/index.js +9 -4
- package/dist/ToggleCheckbox/index.mjs +1 -0
- package/dist/ToggleInput/ToggleInput.js +81 -34
- package/dist/ToggleInput/ToggleInput.mjs +69 -0
- package/dist/ToggleInput/index.js +9 -4
- package/dist/ToggleInput/index.mjs +1 -0
- package/dist/Tooltip/Tooltip.js +55 -23
- package/dist/Tooltip/Tooltip.mjs +31 -0
- package/dist/Tooltip/hooks/useTooltipHandlers.js +38 -21
- package/dist/Tooltip/hooks/useTooltipHandlers.mjs +35 -0
- package/dist/Tooltip/hooks/useTooltipLayout.js +24 -16
- package/dist/Tooltip/hooks/useTooltipLayout.mjs +21 -0
- package/dist/Tooltip/index.js +9 -4
- package/dist/Tooltip/index.mjs +1 -0
- package/dist/Tooltip/utils/positionTooltip.js +72 -25
- package/dist/Tooltip/utils/positionTooltip.mjs +70 -0
- package/dist/Typography/Typography.js +30 -21
- package/dist/Typography/Typography.mjs +26 -0
- package/dist/Typography/constants.js +21 -11
- package/dist/Typography/constants.mjs +10 -0
- package/dist/Typography/index.js +9 -4
- package/dist/Typography/index.mjs +1 -0
- package/dist/Typography/utils.js +64 -50
- package/dist/Typography/utils.mjs +67 -0
- package/dist/VisuallyHidden/VisuallyHidden.js +13 -5
- package/dist/VisuallyHidden/VisuallyHidden.mjs +14 -0
- package/dist/VisuallyHidden/index.js +9 -4
- package/dist/VisuallyHidden/index.mjs +1 -0
- package/dist/helpers/context.js +49 -20
- package/dist/helpers/context.mjs +26 -0
- package/dist/helpers/deprecations.js +20 -12
- package/dist/helpers/deprecations.mjs +16 -0
- package/dist/helpers/getDefaultLocale.js +31 -4
- package/dist/helpers/getDefaultLocale.mjs +32 -0
- package/dist/helpers/getFocusableNodes.js +35 -6
- package/dist/helpers/getFocusableNodes.mjs +31 -0
- package/dist/helpers/handleResponsiveValues.js +34 -24
- package/dist/helpers/handleResponsiveValues.mjs +33 -0
- package/dist/helpers/keyboardKeys.js +22 -19
- package/dist/helpers/keyboardKeys.mjs +19 -0
- package/dist/helpers/objects.js +20 -8
- package/dist/helpers/objects.mjs +17 -0
- package/dist/helpers/setOpacity.js +9 -4
- package/dist/helpers/setOpacity.mjs +5 -0
- package/dist/helpers/setTabIndexOnFirstItem.js +11 -6
- package/dist/helpers/setTabIndexOnFirstItem.mjs +8 -0
- package/dist/helpers/strings.js +7 -4
- package/dist/helpers/strings.mjs +3 -0
- package/dist/helpers/theme.js +13 -6
- package/dist/helpers/theme.mjs +10 -0
- package/dist/helpers/useElementOnScreen.js +13 -6
- package/dist/helpers/useElementOnScreen.mjs +14 -0
- package/dist/helpers/useId.js +13 -6
- package/dist/helpers/useId.mjs +14 -0
- package/dist/helpers/useIntersection.js +13 -6
- package/dist/helpers/useIntersection.mjs +14 -0
- package/dist/helpers/useLockScroll.js +11 -6
- package/dist/helpers/useLockScroll.mjs +14 -0
- package/dist/helpers/usePrevious.js +13 -6
- package/dist/helpers/usePrevious.mjs +14 -0
- package/dist/helpers/useResizeObserver.js +13 -6
- package/dist/helpers/useResizeObserver.mjs +14 -0
- package/dist/hooks/useComposeRefs.js +69 -11
- package/dist/hooks/useComposeRefs.mjs +47 -0
- package/dist/hooks/useControllableState.js +61 -20
- package/dist/hooks/useControllableState.mjs +39 -0
- package/dist/hooks/useDateFormatter.js +76 -18
- package/dist/hooks/useDateFormatter.mjs +54 -0
- package/dist/hooks/useElementOnScreen.js +26 -13
- package/dist/hooks/useElementOnScreen.mjs +24 -0
- package/dist/hooks/useId.js +24 -12
- package/dist/hooks/useId.mjs +17 -0
- package/dist/hooks/useIntersection.js +40 -22
- package/dist/hooks/useIntersection.mjs +37 -0
- package/dist/hooks/useLockScroll.js +15 -8
- package/dist/hooks/useLockScroll.mjs +14 -0
- package/dist/hooks/usePrevious.js +14 -9
- package/dist/hooks/usePrevious.mjs +11 -0
- package/dist/hooks/useResizeObserver.js +27 -15
- package/dist/hooks/useResizeObserver.mjs +24 -0
- package/dist/index.js +316 -311
- package/dist/index.mjs +141 -0
- package/dist/themes/common-theme.js +24 -20
- package/dist/themes/common-theme.mjs +21 -0
- package/dist/themes/darkTheme/dark-colors.js +54 -51
- package/dist/themes/darkTheme/dark-colors.mjs +51 -0
- package/dist/themes/darkTheme/dark-shadows.js +14 -11
- package/dist/themes/darkTheme/dark-shadows.mjs +11 -0
- package/dist/themes/darkTheme/index.js +14 -10
- package/dist/themes/darkTheme/index.mjs +11 -0
- package/dist/themes/extendTheme.js +38 -27
- package/dist/themes/extendTheme.mjs +43 -0
- package/dist/themes/index.js +17 -12
- package/dist/themes/index.mjs +4 -0
- package/dist/themes/lightTheme/index.js +14 -10
- package/dist/themes/lightTheme/index.mjs +11 -0
- package/dist/themes/lightTheme/light-colors.js +54 -51
- package/dist/themes/lightTheme/light-colors.mjs +51 -0
- package/dist/themes/lightTheme/light-shadows.js +14 -11
- package/dist/themes/lightTheme/light-shadows.mjs +11 -0
- package/dist/themes/sizes.js +24 -21
- package/dist/themes/sizes.mjs +21 -0
- package/dist/themes/utils.js +20 -12
- package/dist/themes/{utils.cjs → utils.mjs} +15 -7
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +27 -18
- package/dist/v2/Breadcrumbs/Breadcrumbs.mjs +26 -0
- package/dist/v2/Breadcrumbs/Crumb.js +12 -8
- package/dist/v2/Breadcrumbs/Crumb.mjs +8 -0
- package/dist/v2/Breadcrumbs/CrumbLink.js +25 -16
- package/dist/v2/Breadcrumbs/CrumbLink.mjs +22 -0
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +21 -12
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.mjs +18 -0
- package/dist/v2/Breadcrumbs/Divider.js +13 -7
- package/dist/v2/Breadcrumbs/Divider.mjs +10 -0
- package/dist/v2/Breadcrumbs/index.js +15 -10
- package/dist/v2/Breadcrumbs/index.mjs +4 -0
- package/dist/v2/Link/Link.js +31 -19
- package/dist/v2/Link/Link.mjs +39 -0
- package/dist/v2/Link/index.js +9 -4
- package/dist/v2/Link/index.mjs +1 -0
- package/dist/v2/LinkButton/LinkButton.js +32 -21
- package/dist/v2/LinkButton/LinkButton.mjs +37 -0
- package/dist/v2/LinkButton/index.js +9 -4
- package/dist/v2/LinkButton/index.mjs +1 -0
- package/dist/v2/MainNav/MainNav.js +21 -10
- package/dist/v2/MainNav/MainNav.mjs +14 -0
- package/dist/v2/MainNav/MainNavContext.js +11 -6
- package/dist/v2/MainNav/MainNavContext.mjs +6 -0
- package/dist/v2/MainNav/NavBrand.js +39 -20
- package/dist/v2/MainNav/NavBrand.mjs +37 -0
- package/dist/v2/MainNav/NavCondense.js +31 -22
- package/dist/v2/MainNav/NavCondense.mjs +34 -0
- package/dist/v2/MainNav/NavFooter.js +11 -5
- package/dist/v2/MainNav/NavFooter.mjs +8 -0
- package/dist/v2/MainNav/NavLink.js +62 -42
- package/dist/v2/MainNav/NavLink.mjs +93 -0
- package/dist/v2/MainNav/NavSection.js +27 -11
- package/dist/v2/MainNav/NavSection.mjs +24 -0
- package/dist/v2/MainNav/NavSections.js +23 -9
- package/dist/v2/MainNav/NavSections.mjs +18 -0
- package/dist/v2/MainNav/NavUser.js +27 -17
- package/dist/v2/MainNav/NavUser.mjs +19 -0
- package/dist/v2/MainNav/index.js +23 -18
- package/dist/v2/MainNav/index.mjs +8 -0
- package/dist/v2/Pagination/Pagination.js +38 -11
- package/dist/v2/Pagination/Pagination.mjs +15 -0
- package/dist/v2/Pagination/PaginationContext.js +11 -6
- package/dist/v2/Pagination/PaginationContext.mjs +6 -0
- package/dist/v2/Pagination/assets/next.svg.js +5 -4
- package/dist/v2/Pagination/assets/next.svg.mjs +3 -0
- package/dist/v2/Pagination/assets/previous.svg.js +5 -4
- package/dist/v2/Pagination/assets/previous.svg.mjs +3 -0
- package/dist/v2/Pagination/components.js +65 -44
- package/dist/v2/Pagination/components.mjs +71 -0
- package/dist/v2/Pagination/index.js +14 -9
- package/dist/v2/Pagination/index.mjs +2 -0
- package/dist/v2/SimpleMenu/Menu.js +101 -44
- package/dist/v2/SimpleMenu/Menu.mjs +112 -0
- package/dist/v2/SimpleMenu/SimpleMenu.js +45 -24
- package/dist/v2/SimpleMenu/SimpleMenu.mjs +44 -0
- package/dist/v2/SimpleMenu/index.js +12 -7
- package/dist/v2/SimpleMenu/index.mjs +3 -0
- package/dist/v2/SubNav/SubNav.js +23 -11
- package/dist/v2/SubNav/SubNav.mjs +20 -0
- package/dist/v2/SubNav/SubNavHeader.js +63 -37
- package/dist/v2/SubNav/SubNavHeader.mjs +57 -0
- package/dist/v2/SubNav/SubNavLink.js +41 -25
- package/dist/v2/SubNav/SubNavLink.mjs +57 -0
- package/dist/v2/SubNav/SubNavLinkSection.js +37 -21
- package/dist/v2/SubNav/SubNavLinkSection.mjs +43 -0
- package/dist/v2/SubNav/SubNavSection.js +32 -18
- package/dist/v2/SubNav/SubNavSection.mjs +30 -0
- package/dist/v2/SubNav/SubNavSectionLabel.js +27 -13
- package/dist/v2/SubNav/SubNavSectionLabel.mjs +25 -0
- package/dist/v2/SubNav/SubNavSections.js +16 -7
- package/dist/v2/SubNav/SubNavSections.mjs +13 -0
- package/dist/v2/SubNav/index.js +20 -15
- package/dist/v2/SubNav/index.mjs +6 -0
- package/dist/v2/index.js +60 -55
- package/dist/v2/index.mjs +25 -0
- package/package.json +25 -18
- package/dist/Accordion/Accordion.cjs +0 -23
- package/dist/Accordion/AccordionContent.cjs +0 -1
- package/dist/Accordion/AccordionContext.cjs +0 -1
- package/dist/Accordion/AccordionGroup.cjs +0 -47
- package/dist/Accordion/AccordionToggle.cjs +0 -28
- package/dist/Accordion/index.cjs +0 -1
- package/dist/Accordion/utils.cjs +0 -1
- package/dist/Alert/Alert.cjs +0 -29
- package/dist/Alert/index.cjs +0 -1
- package/dist/Alert/utils.cjs +0 -1
- package/dist/Avatar/Avatar.cjs +0 -18
- package/dist/Avatar/AvatarGroup.cjs +0 -5
- package/dist/Avatar/constants.cjs +0 -1
- package/dist/Avatar/index.cjs +0 -1
- package/dist/Badge/Badge.cjs +0 -4
- package/dist/Badge/index.cjs +0 -1
- package/dist/BaseButton/BaseButton.cjs +0 -17
- package/dist/BaseButton/index.cjs +0 -1
- package/dist/BaseCheckbox/BaseCheckbox.cjs +0 -62
- package/dist/BaseCheckbox/assets/checkmark-black.svg.cjs +0 -1
- package/dist/BaseCheckbox/assets/checkmark.svg.cjs +0 -1
- package/dist/BaseCheckbox/index.cjs +0 -1
- package/dist/BaseCheckbox/utils.cjs +0 -1
- package/dist/BaseLink/BaseLink.cjs +0 -1
- package/dist/BaseLink/index.cjs +0 -1
- package/dist/BaseRadio/BaseRadio.cjs +0 -31
- package/dist/BaseRadio/RadioGroup.cjs +0 -1
- package/dist/BaseRadio/context.cjs +0 -1
- package/dist/BaseRadio/index.cjs +0 -1
- package/dist/BaseRadio/utils.cjs +0 -1
- package/dist/Box/Box.cjs +0 -79
- package/dist/Box/index.cjs +0 -1
- package/dist/Breadcrumbs/Breadcrumbs.cjs +0 -16
- package/dist/Breadcrumbs/index.cjs +0 -1
- package/dist/Button/Button.cjs +0 -36
- package/dist/Button/constants.cjs +0 -1
- package/dist/Button/index.cjs +0 -1
- package/dist/Button/utils.cjs +0 -87
- package/dist/Card/Card.cjs +0 -1
- package/dist/Card/CardAction.cjs +0 -6
- package/dist/Card/CardAsset.cjs +0 -19
- package/dist/Card/CardBadge.cjs +0 -6
- package/dist/Card/CardBody.cjs +0 -1
- package/dist/Card/CardCheckbox.cjs +0 -1
- package/dist/Card/CardContent.cjs +0 -3
- package/dist/Card/CardContext.cjs +0 -1
- package/dist/Card/CardHeader.cjs +0 -3
- package/dist/Card/CardTimer.cjs +0 -1
- package/dist/Card/CardTitle.cjs +0 -1
- package/dist/Card/index.cjs +0 -1
- package/dist/CarouselInput/Carousel.cjs +0 -13
- package/dist/CarouselInput/CarouselActions.cjs +0 -1
- package/dist/CarouselInput/CarouselImage.cjs +0 -3
- package/dist/CarouselInput/CarouselInput.cjs +0 -1
- package/dist/CarouselInput/CarouselSlide.cjs +0 -1
- package/dist/CarouselInput/index.cjs +0 -1
- package/dist/Checkbox/Checkbox.cjs +0 -7
- package/dist/Checkbox/index.cjs +0 -1
- package/dist/Combobox/Combobox.cjs +0 -107
- package/dist/Combobox/ComboboxList.cjs +0 -5
- package/dist/Combobox/ComboboxOption.cjs +0 -1
- package/dist/Combobox/index.cjs +0 -1
- package/dist/DatePicker/DatePicker.cjs +0 -88
- package/dist/DatePicker/index.cjs +0 -1
- package/dist/DateTimePicker/DateTimePicker.cjs +0 -7
- package/dist/DateTimePicker/index.cjs +0 -1
- package/dist/DesignSystemProvider.cjs +0 -1
- package/dist/Dialog/Dialog.cjs +0 -11
- package/dist/Dialog/DialogBody.cjs +0 -10
- package/dist/Dialog/DialogFooter.cjs +0 -9
- package/dist/Dialog/index.cjs +0 -1
- package/dist/DismissibleLayer/index.cjs +0 -1
- package/dist/Divider/Divider.cjs +0 -7
- package/dist/Divider/index.cjs +0 -1
- package/dist/EmptyStateLayout/EmptyStateLayout.cjs +0 -5
- package/dist/EmptyStateLayout/index.cjs +0 -1
- package/dist/EmptyStateLayout/story-assets/Illo.cjs +0 -1
- package/dist/Field/Field.cjs +0 -1
- package/dist/Field/FieldAction.cjs +0 -4
- package/dist/Field/FieldContext.cjs +0 -1
- package/dist/Field/FieldError.cjs +0 -1
- package/dist/Field/FieldHint.cjs +0 -1
- package/dist/Field/FieldInput.cjs +0 -41
- package/dist/Field/FieldLabel.cjs +0 -12
- package/dist/Field/index.cjs +0 -1
- package/dist/Flex/Flex.cjs +0 -9
- package/dist/Flex/index.cjs +0 -1
- package/dist/FocusTrap/FocusTrap.cjs +0 -1
- package/dist/FocusTrap/index.cjs +0 -1
- package/dist/Grid/Grid.cjs +0 -5
- package/dist/Grid/GridItem.cjs +0 -12
- package/dist/Grid/index.cjs +0 -1
- package/dist/Icon/Icon.cjs +0 -6
- package/dist/Icon/index.cjs +0 -1
- package/dist/IconButton/IconButton.cjs +0 -81
- package/dist/IconButton/index.cjs +0 -1
- package/dist/JSONInput/JSONInput.cjs +0 -33
- package/dist/JSONInput/index.cjs +0 -1
- package/dist/JSONInput/utils/decorationExtension.cjs +0 -1
- package/dist/KeyboardNavigable/KeyboardNavigable.cjs +0 -1
- package/dist/KeyboardNavigable/index.cjs +0 -1
- package/dist/Layout/ActionLayout.cjs +0 -1
- package/dist/Layout/ContentLayout.cjs +0 -1
- package/dist/Layout/GridLayout.cjs +0 -5
- package/dist/Layout/HeaderLayout.cjs +0 -4
- package/dist/Layout/Layout.cjs +0 -6
- package/dist/Layout/TwoColsLayout.cjs +0 -1
- package/dist/Layout/index.cjs +0 -1
- package/dist/Link/Link.cjs +0 -33
- package/dist/Link/index.cjs +0 -1
- package/dist/LinkButton/LinkButton.cjs +0 -15
- package/dist/LinkButton/index.cjs +0 -1
- package/dist/LiveRegions/LiveRegions.cjs +0 -1
- package/dist/LiveRegions/constants.cjs +0 -1
- package/dist/LiveRegions/index.cjs +0 -1
- package/dist/LiveRegions/useNotifyAT.cjs +0 -1
- package/dist/Loader/Loader.cjs +0 -12
- package/dist/Loader/assets/loader.svg.cjs +0 -1
- package/dist/Loader/index.cjs +0 -1
- package/dist/Main/Main.cjs +0 -6
- package/dist/Main/SkipToContent.cjs +0 -8
- package/dist/Main/index.cjs +0 -1
- package/dist/MainNav/MainNav.cjs +0 -4
- package/dist/MainNav/MainNavContext.cjs +0 -1
- package/dist/MainNav/NavBrand.cjs +0 -12
- package/dist/MainNav/NavCondense.cjs +0 -20
- package/dist/MainNav/NavFooter.cjs +0 -1
- package/dist/MainNav/NavLink.cjs +0 -69
- package/dist/MainNav/NavSection.cjs +0 -1
- package/dist/MainNav/NavSections.cjs +0 -4
- package/dist/MainNav/NavUser.cjs +0 -3
- package/dist/MainNav/index.cjs +0 -1
- package/dist/ModalLayout/ModalBody.cjs +0 -4
- package/dist/ModalLayout/ModalContext.cjs +0 -1
- package/dist/ModalLayout/ModalFooter.cjs +0 -4
- package/dist/ModalLayout/ModalHeader.cjs +0 -4
- package/dist/ModalLayout/ModalLayout.cjs +0 -4
- package/dist/ModalLayout/index.cjs +0 -1
- package/dist/NumberInput/NumberInput.cjs +0 -12
- package/dist/NumberInput/index.cjs +0 -1
- package/dist/Pagination/Pagination.cjs +0 -1
- package/dist/Pagination/PaginationContext.cjs +0 -1
- package/dist/Pagination/assets/next.svg.cjs +0 -1
- package/dist/Pagination/assets/previous.svg.cjs +0 -1
- package/dist/Pagination/components.cjs +0 -33
- package/dist/Pagination/index.cjs +0 -1
- package/dist/Popover/Popover.cjs +0 -25
- package/dist/Popover/index.cjs +0 -1
- package/dist/Popover/primitives.cjs +0 -1
- package/dist/Portal/Portal.cjs +0 -1
- package/dist/Portal/index.cjs +0 -1
- package/dist/ProgressBar/ProgressBar.cjs +0 -11
- package/dist/ProgressBar/index.cjs +0 -1
- package/dist/Radio/Radio.cjs +0 -1
- package/dist/Radio/index.cjs +0 -1
- package/dist/RawTable/RawCell.cjs +0 -1
- package/dist/RawTable/RawTable.cjs +0 -1
- package/dist/RawTable/RawTableContext.cjs +0 -1
- package/dist/RawTable/RawTbody.cjs +0 -1
- package/dist/RawTable/RawThead.cjs +0 -1
- package/dist/RawTable/RawTr.cjs +0 -1
- package/dist/RawTable/focusFocusable.cjs +0 -1
- package/dist/RawTable/index.cjs +0 -1
- package/dist/Searchbar/SearchForm.cjs +0 -1
- package/dist/Searchbar/Searchbar.cjs +0 -28
- package/dist/Searchbar/index.cjs +0 -1
- package/dist/Select/MultiSelect.cjs +0 -30
- package/dist/Select/MultiSelectNested.cjs +0 -3
- package/dist/Select/OptGroup.cjs +0 -5
- package/dist/Select/Option.cjs +0 -5
- package/dist/Select/Select.cjs +0 -6
- package/dist/Select/SelectList.cjs +0 -5
- package/dist/Select/SelectParts.cjs +0 -83
- package/dist/Select/SingleSelect.cjs +0 -1
- package/dist/Select/index.cjs +0 -1
- package/dist/SimpleMenu/SimpleMenu.cjs +0 -35
- package/dist/SimpleMenu/index.cjs +0 -1
- package/dist/SimpleMenu/utils.cjs +0 -12
- package/dist/Stack/Stack.cjs +0 -19
- package/dist/Stack/index.cjs +0 -1
- package/dist/Status/Status.cjs +0 -11
- package/dist/Status/index.cjs +0 -1
- package/dist/SubNav/SubNav.cjs +0 -10
- package/dist/SubNav/SubNavHeader.cjs +0 -4
- package/dist/SubNav/SubNavLink.cjs +0 -39
- package/dist/SubNav/SubNavLinkSection.cjs +0 -19
- package/dist/SubNav/SubNavSection.cjs +0 -8
- package/dist/SubNav/SubNavSectionLabel.cjs +0 -9
- package/dist/SubNav/SubNavSections.cjs +0 -1
- package/dist/SubNav/index.cjs +0 -1
- package/dist/Switch/Switch.cjs +0 -42
- package/dist/Switch/index.cjs +0 -1
- package/dist/Table/Cell.cjs +0 -17
- package/dist/Table/TFooter.cjs +0 -22
- package/dist/Table/Table.cjs +0 -34
- package/dist/Table/Tbody.cjs +0 -5
- package/dist/Table/Thead.cjs +0 -3
- package/dist/Table/Tr.cjs +0 -20
- package/dist/Table/index.cjs +0 -1
- package/dist/Tabs/TabGroup.cjs +0 -1
- package/dist/Tabs/TabPanels.cjs +0 -1
- package/dist/Tabs/Tabs.cjs +0 -5
- package/dist/Tabs/TabsContext.cjs +0 -1
- package/dist/Tabs/components.cjs +0 -43
- package/dist/Tabs/index.cjs +0 -1
- package/dist/Tag/Tag.cjs +0 -14
- package/dist/Tag/index.cjs +0 -1
- package/dist/TextButton/TextButton.cjs +0 -26
- package/dist/TextButton/index.cjs +0 -1
- package/dist/TextInput/TextInput.cjs +0 -1
- package/dist/TextInput/index.cjs +0 -1
- package/dist/Textarea/Textarea.cjs +0 -17
- package/dist/Textarea/index.cjs +0 -1
- package/dist/ThemeProvider/hooks.cjs +0 -1
- package/dist/ThemeProvider/index.cjs +0 -1
- package/dist/TimePicker/TimePicker.cjs +0 -8
- package/dist/TimePicker/index.cjs +0 -1
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +0 -36
- package/dist/ToggleCheckbox/index.cjs +0 -1
- package/dist/ToggleInput/ToggleInput.cjs +0 -22
- package/dist/ToggleInput/index.cjs +0 -1
- package/dist/Tooltip/Tooltip.cjs +0 -5
- package/dist/Tooltip/hooks/useTooltipHandlers.cjs +0 -1
- package/dist/Tooltip/hooks/useTooltipLayout.cjs +0 -1
- package/dist/Tooltip/index.cjs +0 -1
- package/dist/Tooltip/utils/positionTooltip.cjs +0 -1
- package/dist/Typography/Typography.cjs +0 -14
- package/dist/Typography/constants.cjs +0 -1
- package/dist/Typography/index.cjs +0 -1
- package/dist/Typography/utils.cjs +0 -34
- package/dist/VisuallyHidden/VisuallyHidden.cjs +0 -10
- package/dist/VisuallyHidden/index.cjs +0 -1
- package/dist/helpers/context.cjs +0 -1
- package/dist/helpers/deprecations.cjs +0 -1
- package/dist/helpers/getDefaultLocale.cjs +0 -4
- package/dist/helpers/getFocusableNodes.cjs +0 -1
- package/dist/helpers/handleResponsiveValues.cjs +0 -1
- package/dist/helpers/keyboardKeys.cjs +0 -1
- package/dist/helpers/objects.cjs +0 -1
- package/dist/helpers/setOpacity.cjs +0 -1
- package/dist/helpers/setTabIndexOnFirstItem.cjs +0 -1
- package/dist/helpers/strings.cjs +0 -1
- package/dist/helpers/theme.cjs +0 -1
- package/dist/helpers/useElementOnScreen.cjs +0 -4
- package/dist/helpers/useId.cjs +0 -4
- package/dist/helpers/useIntersection.cjs +0 -4
- package/dist/helpers/useLockScroll.cjs +0 -4
- package/dist/helpers/usePrevious.cjs +0 -4
- package/dist/helpers/useResizeObserver.cjs +0 -4
- package/dist/hooks/useComposeRefs.cjs +0 -1
- package/dist/hooks/useControllableState.cjs +0 -1
- package/dist/hooks/useDateFormatter.cjs +0 -1
- package/dist/hooks/useElementOnScreen.cjs +0 -1
- package/dist/hooks/useId.cjs +0 -1
- package/dist/hooks/useIntersection.cjs +0 -1
- package/dist/hooks/useLockScroll.cjs +0 -1
- package/dist/hooks/usePrevious.cjs +0 -1
- package/dist/hooks/useResizeObserver.cjs +0 -1
- package/dist/index.cjs +0 -1
- package/dist/themes/common-theme.cjs +0 -1
- package/dist/themes/darkTheme/dark-colors.cjs +0 -1
- package/dist/themes/darkTheme/dark-shadows.cjs +0 -1
- package/dist/themes/darkTheme/index.cjs +0 -1
- package/dist/themes/extendTheme.cjs +0 -13
- package/dist/themes/index.cjs +0 -1
- package/dist/themes/lightTheme/index.cjs +0 -1
- package/dist/themes/lightTheme/light-colors.cjs +0 -1
- package/dist/themes/lightTheme/light-shadows.cjs +0 -1
- package/dist/themes/sizes.cjs +0 -1
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +0 -9
- package/dist/v2/Breadcrumbs/Crumb.cjs +0 -1
- package/dist/v2/Breadcrumbs/CrumbLink.cjs +0 -14
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +0 -9
- package/dist/v2/Breadcrumbs/Divider.cjs +0 -1
- package/dist/v2/Breadcrumbs/index.cjs +0 -1
- package/dist/v2/Link/Link.cjs +0 -25
- package/dist/v2/Link/index.cjs +0 -1
- package/dist/v2/LinkButton/LinkButton.cjs +0 -20
- package/dist/v2/LinkButton/index.cjs +0 -1
- package/dist/v2/MainNav/MainNav.cjs +0 -4
- package/dist/v2/MainNav/MainNavContext.cjs +0 -1
- package/dist/v2/MainNav/NavBrand.cjs +0 -12
- package/dist/v2/MainNav/NavCondense.cjs +0 -17
- package/dist/v2/MainNav/NavFooter.cjs +0 -1
- package/dist/v2/MainNav/NavLink.cjs +0 -69
- package/dist/v2/MainNav/NavSection.cjs +0 -1
- package/dist/v2/MainNav/NavSections.cjs +0 -4
- package/dist/v2/MainNav/NavUser.cjs +0 -3
- package/dist/v2/MainNav/index.cjs +0 -1
- package/dist/v2/Pagination/Pagination.cjs +0 -1
- package/dist/v2/Pagination/PaginationContext.cjs +0 -1
- package/dist/v2/Pagination/assets/next.svg.cjs +0 -1
- package/dist/v2/Pagination/assets/previous.svg.cjs +0 -1
- package/dist/v2/Pagination/components.cjs +0 -33
- package/dist/v2/Pagination/index.cjs +0 -1
- package/dist/v2/SimpleMenu/Menu.cjs +0 -65
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +0 -1
- package/dist/v2/SimpleMenu/index.cjs +0 -1
- package/dist/v2/SubNav/SubNav.cjs +0 -10
- package/dist/v2/SubNav/SubNavHeader.cjs +0 -4
- package/dist/v2/SubNav/SubNavLink.cjs +0 -39
- package/dist/v2/SubNav/SubNavLinkSection.cjs +0 -19
- package/dist/v2/SubNav/SubNavSection.cjs +0 -8
- package/dist/v2/SubNav/SubNavSectionLabel.cjs +0 -9
- package/dist/v2/SubNav/SubNavSections.cjs +0 -1
- package/dist/v2/SubNav/index.cjs +0 -1
- package/dist/v2/index.cjs +0 -1
|
@@ -1,138 +1,245 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
const React = require('react');
|
|
7
|
+
const reactDom$1 = require('@floating-ui/react-dom');
|
|
8
|
+
const date = require('@internationalized/date');
|
|
9
|
+
const reactFocusGuards = require('@radix-ui/react-focus-guards');
|
|
10
|
+
const reactFocusScope = require('@radix-ui/react-focus-scope');
|
|
11
|
+
const icons = require('@strapi/icons');
|
|
12
|
+
const uiPrimitives = require('@strapi/ui-primitives');
|
|
13
|
+
const reactDom = require('react-dom');
|
|
14
|
+
const reactRemoveScroll = require('react-remove-scroll');
|
|
15
|
+
const styled = require('styled-components');
|
|
16
|
+
const DesignSystemProvider = require('../DesignSystemProvider.js');
|
|
17
|
+
const index = require('../DismissibleLayer/index.js');
|
|
18
|
+
const context = require('../helpers/context.js');
|
|
19
|
+
const deprecations = require('../helpers/deprecations.js');
|
|
20
|
+
const useComposeRefs = require('../hooks/useComposeRefs.js');
|
|
21
|
+
const useControllableState = require('../hooks/useControllableState.js');
|
|
22
|
+
const useDateFormatter = require('../hooks/useDateFormatter.js');
|
|
23
|
+
const useId = require('../hooks/useId.js');
|
|
24
|
+
const SingleSelect = require('../Select/SingleSelect.js');
|
|
25
|
+
const Portal = require('../Portal/Portal.js');
|
|
26
|
+
const Flex = require('../Flex/Flex.js');
|
|
27
|
+
const utils = require('../themes/utils.js');
|
|
28
|
+
const Box = require('../Box/Box.js');
|
|
29
|
+
const Typography = require('../Typography/Typography.js');
|
|
30
|
+
const Field = require('../Field/Field.js');
|
|
31
|
+
const FieldLabel = require('../Field/FieldLabel.js');
|
|
32
|
+
const FieldHint = require('../Field/FieldHint.js');
|
|
33
|
+
const FieldError = require('../Field/FieldError.js');
|
|
34
|
+
|
|
35
|
+
const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
36
|
+
|
|
37
|
+
function _interopNamespace(e) {
|
|
38
|
+
if (e && e.__esModule) return e;
|
|
39
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
40
|
+
if (e) {
|
|
41
|
+
for (const k in e) {
|
|
42
|
+
if (k !== 'default') {
|
|
43
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
44
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: () => e[k]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
n.default = e;
|
|
52
|
+
return Object.freeze(n);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
56
|
+
const styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
57
|
+
|
|
58
|
+
const DEFAULT_PAST_RANGE = 200;
|
|
59
|
+
const DEFAULT_FUTURE_RANGE = 15;
|
|
60
|
+
const [DatePickerProvider, useDatePickerContext] = context.createContext('DatePicker');
|
|
61
|
+
const DatePickerInput = React__namespace.forwardRef(({
|
|
62
|
+
/**
|
|
63
|
+
* DatePickerCalendar props
|
|
64
|
+
*/
|
|
65
|
+
calendarLabel, className, initialDate, locale: defaultLocale, maxDate, minDate, monthSelectLabel = 'Month', onChange, selectedDate, yearSelectLabel = 'Year',
|
|
66
|
+
/**
|
|
67
|
+
* Combobox props
|
|
68
|
+
*/
|
|
69
|
+
error, id, disabled = false, placeholder, required = false, onClear, clearLabel = 'Clear', size,
|
|
70
|
+
/**
|
|
71
|
+
* @preserve
|
|
72
|
+
* @deprecated This is no longer used.
|
|
73
|
+
*/
|
|
74
|
+
ariaLabel: _ariaLabel,
|
|
75
|
+
/**
|
|
76
|
+
* @preserve
|
|
77
|
+
* @deprecated This is no longer used.
|
|
78
|
+
*/
|
|
79
|
+
selectedDateLabel: _selectedDateLabel, ...restProps }, ref) => {
|
|
80
|
+
const timeZone = date.getLocalTimeZone();
|
|
81
|
+
const designContext = DesignSystemProvider.useDesignSystem('DatePicker');
|
|
82
|
+
const locale = defaultLocale ?? designContext.locale;
|
|
83
|
+
const formatter = useDateFormatter.useDateFormatter(locale, {
|
|
84
|
+
day: '2-digit',
|
|
85
|
+
month: '2-digit',
|
|
86
|
+
year: 'numeric',
|
|
87
|
+
});
|
|
88
|
+
const [open, setOpen] = React__namespace.useState(false);
|
|
89
|
+
const [trigger, setTrigger] = React__namespace.useState(null);
|
|
90
|
+
const [textInput, setTextInput] = React__namespace.useState(null);
|
|
91
|
+
const [content, setContent] = React__namespace.useState(null);
|
|
92
|
+
const [textValue, setTextValue] = React__namespace.useState();
|
|
93
|
+
const [value, setValue] = useControllableState.useControllableState({
|
|
94
|
+
defaultProp: initialDate ? convertUTCDateToCalendarDate(initialDate) : undefined,
|
|
95
|
+
prop: selectedDate ? convertUTCDateToCalendarDate(selectedDate) : undefined,
|
|
96
|
+
onChange(date) {
|
|
97
|
+
if (onChange) {
|
|
98
|
+
onChange(date?.toDate(timeZone));
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
const [actualMinDate, actualMaxDate] = React__namespace.useMemo(() => {
|
|
103
|
+
const now = initialDate ? convertUTCDateToCalendarDate(initialDate) : date.today('UTC');
|
|
104
|
+
const actualMinDate = minDate
|
|
105
|
+
? convertUTCDateToCalendarDate(minDate)
|
|
106
|
+
: now.set({ day: 1, month: 1, year: now.year - DEFAULT_PAST_RANGE });
|
|
107
|
+
let actualMaxDate = maxDate
|
|
108
|
+
? convertUTCDateToCalendarDate(maxDate)
|
|
109
|
+
: now.set({ day: 31, month: 12, year: now.year + DEFAULT_FUTURE_RANGE });
|
|
110
|
+
if (actualMaxDate.compare(actualMinDate) < 0) {
|
|
111
|
+
actualMaxDate = actualMinDate.set({ day: 31, month: 12, year: actualMinDate.year + DEFAULT_FUTURE_RANGE });
|
|
112
|
+
}
|
|
113
|
+
return [actualMinDate, actualMaxDate];
|
|
114
|
+
}, [minDate, maxDate, initialDate]);
|
|
115
|
+
/**
|
|
116
|
+
* Setting the initial calendar state based on priority.
|
|
117
|
+
*/
|
|
118
|
+
const [calendarDate, setCalendarDate] = React__namespace.useState(makeInitialCalendarDate({
|
|
119
|
+
currentValue: value,
|
|
120
|
+
minDate: actualMinDate,
|
|
121
|
+
maxDate: actualMaxDate,
|
|
122
|
+
}));
|
|
123
|
+
const contentId = useId.useId();
|
|
124
|
+
const clearRef = React__namespace.useRef(null);
|
|
125
|
+
const handleClearClick = (e) => {
|
|
126
|
+
if (onClear && !disabled) {
|
|
127
|
+
setTextValue('');
|
|
128
|
+
setValue(undefined);
|
|
129
|
+
onClear(e);
|
|
130
|
+
textInput?.focus();
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const handleOpenChange = React__namespace.useCallback((nextOpen) => {
|
|
134
|
+
if (nextOpen && value) {
|
|
135
|
+
setCalendarDate(value);
|
|
136
|
+
}
|
|
137
|
+
setOpen(nextOpen);
|
|
138
|
+
}, [value]);
|
|
139
|
+
React__namespace.useLayoutEffect(() => {
|
|
140
|
+
if (selectedDate) {
|
|
141
|
+
const date = convertUTCDateToCalendarDate(selectedDate);
|
|
142
|
+
setTextValue(formatter.format(date.toDate(timeZone)));
|
|
143
|
+
setCalendarDate(date);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
setTextValue('');
|
|
147
|
+
}
|
|
148
|
+
}, [selectedDate, formatter, timeZone]);
|
|
149
|
+
React__namespace.useLayoutEffect(() => {
|
|
150
|
+
if (initialDate && textValue === undefined) {
|
|
151
|
+
const date = convertUTCDateToCalendarDate(initialDate);
|
|
152
|
+
setTextValue(formatter.format(date.toDate(timeZone)));
|
|
153
|
+
}
|
|
154
|
+
}, [initialDate, textValue, formatter, timeZone]);
|
|
155
|
+
const hintId = `${id}-hint`;
|
|
156
|
+
const errorId = `${id}-error`;
|
|
157
|
+
return (jsxRuntime.jsxs(DatePickerProvider, { calendarDate: calendarDate, content: content, contentId: contentId, disabled: disabled, locale: locale, minDate: actualMinDate, maxDate: actualMaxDate, open: open, onCalendarDateChange: setCalendarDate, onContentChange: setContent, onOpenChange: handleOpenChange, onTextInputChange: setTextInput, onTextValueChange: setTextValue, onTriggerChange: setTrigger, onValueChange: setValue, required: required, textInput: textInput, textValue: textValue, timeZone: timeZone, trigger: trigger, value: value, children: [jsxRuntime.jsxs(DatePickerTrigger, { className: className, size: size, hasError: Boolean(error), children: [jsxRuntime.jsx(StyledCalendarIcon, { "aria-hidden": true }), jsxRuntime.jsx(DatePickerTextInput, { ref: ref, placeholder: placeholder, "aria-describedby": `${hintId} ${errorId}`, id: id, ...restProps }), textValue && onClear ? (jsxRuntime.jsx(IconBox, { as: "button", hasRadius: true, background: "transparent", type: "button", onClick: handleClearClick, "aria-disabled": disabled, "aria-label": clearLabel, title: clearLabel, ref: clearRef, children: jsxRuntime.jsx(icons.Cross, {}) })) : null] }), jsxRuntime.jsx(Portal.Portal, { children: jsxRuntime.jsx(DatePickerContent, { label: calendarLabel, children: jsxRuntime.jsx(DatePickerCalendar, { monthSelectLabel: monthSelectLabel, yearSelectLabel: yearSelectLabel }) }) })] }));
|
|
158
|
+
});
|
|
159
|
+
const isPrintableCharacter = (str) => {
|
|
160
|
+
return Boolean(str.match(/^[^a-zA-Z]*$/));
|
|
161
|
+
};
|
|
162
|
+
const makeInitialCalendarDate = ({ currentValue, minDate, maxDate }) => {
|
|
163
|
+
const now = date.today('UTC');
|
|
164
|
+
if (currentValue) {
|
|
165
|
+
return currentValue;
|
|
166
|
+
}
|
|
167
|
+
if (date.minDate(minDate, now) === minDate && date.maxDate(maxDate, now) === maxDate) {
|
|
168
|
+
return now;
|
|
76
169
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
let j = a ? R(a) : D.set({ day: 31, month: 12, year: D.year + oe });
|
|
80
|
-
return j.compare(z) < 0 && (j = z.set({ day: 31, month: 12, year: z.year + oe })), [z, j];
|
|
81
|
-
}, [s, a, n]), [fe, G] = c.useState(Je({
|
|
82
|
-
currentValue: V,
|
|
83
|
-
minDate: te,
|
|
84
|
-
maxDate: re
|
|
85
|
-
})), pe = ce(), he = c.useRef(null), ge = (D) => {
|
|
86
|
-
P && !y && (_(""), ee(void 0), P(D), A?.focus());
|
|
87
|
-
}, De = c.useCallback((D) => {
|
|
88
|
-
D && V && G(V), Z(D);
|
|
89
|
-
}, [V]);
|
|
90
|
-
c.useLayoutEffect(() => {
|
|
91
|
-
if (l) {
|
|
92
|
-
const D = R(l);
|
|
93
|
-
_($.format(D.toDate(T))), G(D);
|
|
94
|
-
} else
|
|
95
|
-
_("");
|
|
96
|
-
}, [l, $, T]), c.useLayoutEffect(() => {
|
|
97
|
-
if (n && Y === void 0) {
|
|
98
|
-
const D = R(n);
|
|
99
|
-
_($.format(D.toDate(T)));
|
|
170
|
+
if (date.minDate(minDate, now) === now) {
|
|
171
|
+
return minDate;
|
|
100
172
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
173
|
+
if (date.maxDate(maxDate, now) === now) {
|
|
174
|
+
return maxDate;
|
|
175
|
+
}
|
|
176
|
+
return now;
|
|
177
|
+
};
|
|
178
|
+
/* -------------------------------------------------------------------------------------------------
|
|
179
|
+
* DatePickerTrigger
|
|
180
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
181
|
+
const DATE_PICKER_TRIGGER_NAME = 'DatePickerTrigger';
|
|
182
|
+
const DatePickerTrigger = React__namespace.forwardRef(({ hasError, size = 'M', ...restProps }, forwardedRef) => {
|
|
183
|
+
const context = useDatePickerContext(DATE_PICKER_TRIGGER_NAME);
|
|
184
|
+
const composedRefs = useComposeRefs.useComposedRefs(forwardedRef, (node) => context.onTriggerChange(node));
|
|
185
|
+
const handleOpenChange = () => {
|
|
186
|
+
if (!context.disabled) {
|
|
187
|
+
context.onOpenChange(true);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
return (jsxRuntime.jsx(reactFocusScope.FocusScope, { asChild: true,
|
|
191
|
+
// we make sure we're not trapping once it's been closed
|
|
192
|
+
// (closed !== unmounted when animating out)
|
|
193
|
+
trapped: context.open, onMountAutoFocus: (event) => {
|
|
194
|
+
// we prevent open autofocus because we manually focus the selected item
|
|
195
|
+
event.preventDefault();
|
|
196
|
+
}, onUnmountAutoFocus: (event) => {
|
|
197
|
+
/**
|
|
198
|
+
* In firefox there's a some kind of selection happening after
|
|
199
|
+
* unmounting all of this, so we make sure we clear that.
|
|
200
|
+
*/
|
|
201
|
+
document.getSelection()?.empty();
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
}, children: jsxRuntime.jsx(TriggerElement, { ref: composedRefs, "$hasError": hasError, "$size": size, ...restProps, paddingLeft: 3, paddingRight: 3, hasRadius: true, gap: 3, overflow: "hidden", background: context.disabled ? 'neutral150' : 'neutral0', onClick: uiPrimitives.composeEventHandlers(restProps.onClick, () => {
|
|
204
|
+
// Whilst browsers generally have no issue focusing the trigger when clicking
|
|
205
|
+
// on a label, Safari seems to struggle with the fact that there's no `onClick`.
|
|
206
|
+
// We force `focus` in this case. Note: this doesn't create any other side-effect
|
|
207
|
+
// because we are preventing default in `onPointerDown` so effectively
|
|
208
|
+
// this only runs for a label "click"
|
|
209
|
+
context.textInput?.focus();
|
|
210
|
+
}), onPointerDown: uiPrimitives.composeEventHandlers(restProps.onPointerDown, (event) => {
|
|
211
|
+
// prevent implicit pointer capture
|
|
212
|
+
// https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture
|
|
213
|
+
const target = event.target;
|
|
214
|
+
if (target.hasPointerCapture(event.pointerId)) {
|
|
215
|
+
target.releasePointerCapture(event.pointerId);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* This has been added to allow events inside the trigger to be easily fired
|
|
219
|
+
* e.g. the clear button or removing a tag
|
|
220
|
+
*/
|
|
221
|
+
const buttonTarg = target.closest('button') ?? target.closest('div');
|
|
222
|
+
if (buttonTarg !== event.currentTarget) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
// only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
|
|
226
|
+
// but not when the control key is pressed (avoiding MacOS right click)
|
|
227
|
+
if (event.button === 0 && event.ctrlKey === false) {
|
|
228
|
+
handleOpenChange();
|
|
229
|
+
/**
|
|
230
|
+
* Firefox had issues focussing the input correctly.
|
|
231
|
+
*/
|
|
232
|
+
context.textInput?.focus();
|
|
233
|
+
}
|
|
234
|
+
}) }) }));
|
|
235
|
+
});
|
|
236
|
+
const TriggerElement = styled__default.default(Flex.Flex) `
|
|
237
|
+
border: 1px solid ${({ theme, $hasError }) => ($hasError ? theme.colors.danger600 : theme.colors.neutral200)};
|
|
238
|
+
min-height: ${({ theme, $size }) => utils.getThemeSize('input')({ theme, size: $size })};
|
|
132
239
|
|
|
133
240
|
&[data-disabled] {
|
|
134
|
-
color: ${({ theme
|
|
135
|
-
background: ${({ theme
|
|
241
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
242
|
+
background: ${({ theme }) => theme.colors.neutral150};
|
|
136
243
|
cursor: not-allowed;
|
|
137
244
|
}
|
|
138
245
|
|
|
@@ -141,8 +248,9 @@ const je = 200, oe = 15, [He, L] = Ve("DatePicker"), Xe = c.forwardRef(({
|
|
|
141
248
|
outline: none;
|
|
142
249
|
}
|
|
143
250
|
|
|
144
|
-
${({ theme
|
|
145
|
-
|
|
251
|
+
${({ theme, $hasError }) => utils.inputFocusStyle()({ theme, hasError: $hasError })};
|
|
252
|
+
`;
|
|
253
|
+
const IconBox = styled__default.default(Box.Box) `
|
|
146
254
|
border: none;
|
|
147
255
|
|
|
148
256
|
svg {
|
|
@@ -151,110 +259,213 @@ const je = 200, oe = 15, [He, L] = Ve("DatePicker"), Xe = c.forwardRef(({
|
|
|
151
259
|
}
|
|
152
260
|
|
|
153
261
|
svg path {
|
|
154
|
-
fill: ${({ theme
|
|
262
|
+
fill: ${({ theme }) => theme.colors.neutral600};
|
|
155
263
|
}
|
|
156
|
-
|
|
264
|
+
`;
|
|
265
|
+
const StyledCalendarIcon = styled__default.default(icons.Calendar) `
|
|
157
266
|
& > path {
|
|
158
|
-
fill: ${({ theme
|
|
267
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
159
268
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
case "month":
|
|
173
|
-
return "MM";
|
|
174
|
-
case "year":
|
|
175
|
-
return "YYYY";
|
|
176
|
-
default:
|
|
177
|
-
return "";
|
|
178
|
-
}
|
|
179
|
-
}), m = d.find((p) => p.type === "literal")?.value ?? "";
|
|
180
|
-
return [o, m, h];
|
|
181
|
-
}, [y]), E = k.map((d) => `\\d{${d.length}}`).join(`\\${w}`);
|
|
182
|
-
return i(lt, { role: "combobox", type: "text", inputMode: "numeric", ref: x, "aria-autocomplete": "none", "aria-controls": t.contentId, "aria-disabled": t.disabled, "aria-expanded": t.open, "aria-required": t.required, "aria-haspopup": "dialog", "data-state": t.open ? "open" : "closed", disabled: l, "data-disabled": l ? "" : void 0, pattern: E, placeholder: e ?? k.join(w), ...r, value: s ?? "", onBlur: N(r.onBlur, () => {
|
|
183
|
-
if (!t.textValue) {
|
|
184
|
-
t.onValueChange(void 0);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
t.onTextValueChange(y.format(t.calendarDate.toDate(t.timeZone))), t.onValueChange(t.calendarDate);
|
|
188
|
-
}), onChange: N(r.onChange, (d) => {
|
|
189
|
-
if (ie(d.target.value)) {
|
|
190
|
-
const h = d.target.value.split(w), [o, m, p] = P.map((C, A) => {
|
|
191
|
-
const K = h[A];
|
|
192
|
-
return {
|
|
193
|
-
...C,
|
|
194
|
-
value: K
|
|
195
|
-
};
|
|
196
|
-
}).sort((C, A) => C.type === "year" ? 1 : A.type === "year" ? -1 : C.type === "month" ? 1 : A.type === "month" ? -1 : 0).map((C) => C.value), T = t.calendarDate.year;
|
|
197
|
-
let M = t.calendarDate.year;
|
|
198
|
-
if (p) {
|
|
199
|
-
let C = p.length === 1 ? `0${p}` : p;
|
|
200
|
-
M = p.length < 3 ? Number(`${T}`.slice(0, 4 - C.length) + C) : Number(C);
|
|
201
|
-
}
|
|
202
|
-
p && p.length < 3 && M > t.maxDate.year && (M -= 100);
|
|
203
|
-
const v = t.calendarDate.set({ year: M }), $ = v.calendar.getMonthsInYear(v), O = v.set({
|
|
204
|
-
month: m && Number(m) <= $ ? Number(m) : void 0
|
|
205
|
-
}), Z = O.calendar.getDaysInMonth(O), q = O.set({
|
|
206
|
-
day: o && Number(o) <= Z ? Number(o) : void 0
|
|
207
|
-
});
|
|
208
|
-
t.onCalendarDateChange(it(q, t.minDate, t.maxDate)), t.onTextValueChange(d.target.value);
|
|
209
|
-
}
|
|
210
|
-
}), onKeyDown: N(r.onKeyDown, (d) => {
|
|
211
|
-
if (!t.open && (ie(d.key) || ["ArrowDown", "Backspace"].includes(d.key)))
|
|
212
|
-
f();
|
|
213
|
-
else if (["Tab"].includes(d.key) && t.open)
|
|
214
|
-
d.preventDefault();
|
|
215
|
-
else if (["Escape"].includes(d.key))
|
|
216
|
-
t.open ? t.onOpenChange(!1) : (t.onValueChange(void 0), t.onTextValueChange("")), d.preventDefault();
|
|
217
|
-
else if (t.open && ["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"].includes(d.key))
|
|
218
|
-
switch (d.preventDefault(), d.key) {
|
|
219
|
-
case "ArrowDown": {
|
|
220
|
-
const h = t.calendarDate.add({ weeks: 1 });
|
|
221
|
-
if (t.maxDate && h.compare(t.maxDate) > 0)
|
|
222
|
-
return;
|
|
223
|
-
t.onCalendarDateChange(h);
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
case "ArrowRight": {
|
|
227
|
-
const h = t.calendarDate.add({ days: 1 });
|
|
228
|
-
if (t.maxDate && h.compare(t.maxDate) > 0)
|
|
229
|
-
return;
|
|
230
|
-
t.onCalendarDateChange(h);
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
case "ArrowUp": {
|
|
234
|
-
const h = t.calendarDate.subtract({ weeks: 1 });
|
|
235
|
-
if (t.minDate && h.compare(t.minDate) < 0)
|
|
236
|
-
return;
|
|
237
|
-
t.onCalendarDateChange(h);
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
case "ArrowLeft": {
|
|
241
|
-
const h = t.calendarDate.subtract({ days: 1 });
|
|
242
|
-
if (t.minDate && h.compare(t.minDate) < 0)
|
|
243
|
-
return;
|
|
244
|
-
t.onCalendarDateChange(h);
|
|
269
|
+
`;
|
|
270
|
+
/* -------------------------------------------------------------------------------------------------
|
|
271
|
+
* DatePickerTextInput
|
|
272
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
273
|
+
const DATE_PICKER_TEXT_INPUT_NAME = 'DatePickerTextInput';
|
|
274
|
+
const DatePickerTextInput = React__namespace.forwardRef(({ placeholder, ...props }, forwardedRef) => {
|
|
275
|
+
const context = useDatePickerContext(DATE_PICKER_TEXT_INPUT_NAME);
|
|
276
|
+
const { onTextValueChange, textValue, onTextInputChange, onOpenChange, disabled, locale } = context;
|
|
277
|
+
const composedRefs = useComposeRefs.useComposedRefs(forwardedRef, (node) => onTextInputChange(node));
|
|
278
|
+
const handleOpenChange = () => {
|
|
279
|
+
if (!disabled) {
|
|
280
|
+
onOpenChange(true);
|
|
245
281
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
282
|
+
};
|
|
283
|
+
const formatter = useDateFormatter.useDateFormatter(locale, {
|
|
284
|
+
year: 'numeric',
|
|
285
|
+
month: '2-digit',
|
|
286
|
+
day: '2-digit',
|
|
287
|
+
});
|
|
288
|
+
const [dateFormatPlaceholder, separator, dateStructure] = React__namespace.useMemo(() => {
|
|
289
|
+
const parts = formatter.formatToParts(new Date());
|
|
290
|
+
const dateStructure = parts.filter((part) => part.type === 'year' || part.type === 'month' || part.type === 'day');
|
|
291
|
+
const placeholder = dateStructure.map((part) => {
|
|
292
|
+
switch (part.type) {
|
|
293
|
+
case 'day':
|
|
294
|
+
return 'DD';
|
|
295
|
+
case 'month':
|
|
296
|
+
return 'MM';
|
|
297
|
+
case 'year':
|
|
298
|
+
return 'YYYY';
|
|
299
|
+
default:
|
|
300
|
+
return '';
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
const separator = parts.find((part) => part.type === 'literal')?.value ?? '';
|
|
304
|
+
return [placeholder, separator, dateStructure];
|
|
305
|
+
}, [formatter]);
|
|
306
|
+
/**
|
|
307
|
+
* the `pattern` prop of an input cannot be a regex it must be a string without the `/` delimiters.
|
|
308
|
+
* Therefore, we manually escape the separator and `d` character.
|
|
309
|
+
*/
|
|
310
|
+
const inputPattern = dateFormatPlaceholder.map((part) => `\\d{${part.length}}`).join(`\\${separator}`);
|
|
311
|
+
return (jsxRuntime.jsx(Input, { role: "combobox", type: "text", inputMode: "numeric", ref: composedRefs, "aria-autocomplete": "none", "aria-controls": context.contentId, "aria-disabled": context.disabled, "aria-expanded": context.open, "aria-required": context.required, "aria-haspopup": "dialog", "data-state": context.open ? 'open' : 'closed', disabled: disabled, "data-disabled": disabled ? '' : undefined, pattern: inputPattern, placeholder: placeholder ?? dateFormatPlaceholder.join(separator), ...props, value: textValue ?? '', onBlur: uiPrimitives.composeEventHandlers(props.onBlur, () => {
|
|
312
|
+
if (!context.textValue) {
|
|
313
|
+
context.onValueChange(undefined);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
context.onTextValueChange(formatter.format(context.calendarDate.toDate(context.timeZone)));
|
|
317
|
+
context.onValueChange(context.calendarDate);
|
|
318
|
+
}), onChange: uiPrimitives.composeEventHandlers(props.onChange, (event) => {
|
|
319
|
+
if (isPrintableCharacter(event.target.value)) {
|
|
320
|
+
const inputByPart = event.target.value.split(separator);
|
|
321
|
+
/**
|
|
322
|
+
* by using the dateStructure to understand the localised order we split and organise the event.target.value
|
|
323
|
+
* to DD MM YYYY and return as an array.
|
|
324
|
+
*/
|
|
325
|
+
const [day, month, year] = dateStructure
|
|
326
|
+
.map((part, index) => {
|
|
327
|
+
const value = inputByPart[index];
|
|
328
|
+
return {
|
|
329
|
+
...part,
|
|
330
|
+
value,
|
|
331
|
+
};
|
|
332
|
+
})
|
|
333
|
+
/**
|
|
334
|
+
* TODO: This could probably be better done?
|
|
335
|
+
*/
|
|
336
|
+
.sort((a, b) => {
|
|
337
|
+
if (a.type === 'year') {
|
|
338
|
+
return 1;
|
|
339
|
+
}
|
|
340
|
+
if (b.type === 'year') {
|
|
341
|
+
return -1;
|
|
342
|
+
}
|
|
343
|
+
if (a.type === 'month') {
|
|
344
|
+
return 1;
|
|
345
|
+
}
|
|
346
|
+
if (b.type === 'month') {
|
|
347
|
+
return -1;
|
|
348
|
+
}
|
|
349
|
+
return 0;
|
|
350
|
+
})
|
|
351
|
+
.map((part) => part.value);
|
|
352
|
+
const currentYear = context.calendarDate.year;
|
|
353
|
+
/**
|
|
354
|
+
* If a user types 2 for the year then the year should be the current year with the last number as what they typed.
|
|
355
|
+
* This applies for if they've typed two numbers but not three or four numbers.
|
|
356
|
+
*/
|
|
357
|
+
let newYear = context.calendarDate.year;
|
|
358
|
+
if (year) {
|
|
359
|
+
/**
|
|
360
|
+
* ensure the year is _at least_ 2 digits long so if the year
|
|
361
|
+
* is 2023 and you type 9 the year becomes 2009 instead of 2029,
|
|
362
|
+
* this is much similar to how other DatePickers work and makes more sense.
|
|
363
|
+
*/
|
|
364
|
+
let normalizedYear = year.length === 1 ? `0${year}` : year;
|
|
365
|
+
/**
|
|
366
|
+
* The year we set to _must_ be 4 digits long.
|
|
367
|
+
*/
|
|
368
|
+
newYear =
|
|
369
|
+
year.length < 3
|
|
370
|
+
? Number(`${currentYear}`.slice(0, 4 - normalizedYear.length) + normalizedYear)
|
|
371
|
+
: Number(normalizedYear);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* If you type a value like `94` and that's above the maxDate e.g. 2040 then
|
|
375
|
+
* we assume you would have meant 1994 and correct the date. Again, this is
|
|
376
|
+
* similar to how other DatePickers work.
|
|
377
|
+
*
|
|
378
|
+
* Note we only do this if the typed value is less than 3 digits long.
|
|
379
|
+
*/
|
|
380
|
+
if (year && year.length < 3 && newYear > context.maxDate.year) {
|
|
381
|
+
newYear -= 100;
|
|
382
|
+
}
|
|
383
|
+
const newDateWithYear = context.calendarDate.set({ year: newYear });
|
|
384
|
+
const maxMonthNumber = newDateWithYear.calendar.getMonthsInYear(newDateWithYear);
|
|
385
|
+
const newDateWithMonthAndYear = newDateWithYear.set({
|
|
386
|
+
month: month && Number(month) <= maxMonthNumber ? Number(month) : undefined,
|
|
387
|
+
});
|
|
388
|
+
const maxDayNumber = newDateWithMonthAndYear.calendar.getDaysInMonth(newDateWithMonthAndYear);
|
|
389
|
+
const newDateWithDayMonthAndYear = newDateWithMonthAndYear.set({
|
|
390
|
+
day: day && Number(day) <= maxDayNumber ? Number(day) : undefined,
|
|
391
|
+
});
|
|
392
|
+
context.onCalendarDateChange(constrainValue(newDateWithDayMonthAndYear, context.minDate, context.maxDate));
|
|
393
|
+
context.onTextValueChange(event.target.value);
|
|
394
|
+
}
|
|
395
|
+
}), onKeyDown: uiPrimitives.composeEventHandlers(props.onKeyDown, (event) => {
|
|
396
|
+
if (!context.open && (isPrintableCharacter(event.key) || ['ArrowDown', 'Backspace'].includes(event.key))) {
|
|
397
|
+
handleOpenChange();
|
|
398
|
+
}
|
|
399
|
+
else if (['Tab'].includes(event.key) && context.open) {
|
|
400
|
+
event.preventDefault();
|
|
401
|
+
}
|
|
402
|
+
else if (['Escape'].includes(event.key)) {
|
|
403
|
+
if (context.open) {
|
|
404
|
+
context.onOpenChange(false);
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
context.onValueChange(undefined);
|
|
408
|
+
context.onTextValueChange('');
|
|
409
|
+
}
|
|
410
|
+
event.preventDefault();
|
|
411
|
+
}
|
|
412
|
+
else if (context.open && ['ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'].includes(event.key)) {
|
|
413
|
+
event.preventDefault();
|
|
414
|
+
switch (event.key) {
|
|
415
|
+
case 'ArrowDown': {
|
|
416
|
+
const nextDate = context.calendarDate.add({ weeks: 1 });
|
|
417
|
+
if (context.maxDate && nextDate.compare(context.maxDate) > 0) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
context.onCalendarDateChange(nextDate);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
case 'ArrowRight': {
|
|
424
|
+
const nextDate = context.calendarDate.add({ days: 1 });
|
|
425
|
+
if (context.maxDate && nextDate.compare(context.maxDate) > 0) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
context.onCalendarDateChange(nextDate);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
case 'ArrowUp': {
|
|
432
|
+
const nextDate = context.calendarDate.subtract({ weeks: 1 });
|
|
433
|
+
if (context.minDate && nextDate.compare(context.minDate) < 0) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
context.onCalendarDateChange(nextDate);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
case 'ArrowLeft': {
|
|
440
|
+
const nextDate = context.calendarDate.subtract({ days: 1 });
|
|
441
|
+
if (context.minDate && nextDate.compare(context.minDate) < 0) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
context.onCalendarDateChange(nextDate);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else if (context.open && ['Enter'].includes(event.key)) {
|
|
449
|
+
event.preventDefault();
|
|
450
|
+
onTextValueChange(formatter.format(context.calendarDate.toDate(context.timeZone)));
|
|
451
|
+
context.onValueChange(context.calendarDate);
|
|
452
|
+
context.onOpenChange(false);
|
|
453
|
+
}
|
|
454
|
+
}) }));
|
|
250
455
|
});
|
|
251
|
-
function
|
|
252
|
-
|
|
456
|
+
function constrainValue(date$1, minValue, maxValue) {
|
|
457
|
+
if (minValue) {
|
|
458
|
+
date$1 = date.maxDate(date$1, minValue);
|
|
459
|
+
}
|
|
460
|
+
if (maxValue) {
|
|
461
|
+
date$1 = date.minDate(date$1, maxValue);
|
|
462
|
+
}
|
|
463
|
+
return date$1;
|
|
253
464
|
}
|
|
254
|
-
const
|
|
465
|
+
const Input = styled__default.default.input `
|
|
255
466
|
width: 100%;
|
|
256
467
|
font-size: ${14 / 16}rem;
|
|
257
|
-
color: ${({ theme
|
|
468
|
+
color: ${({ theme }) => theme.colors.neutral800};
|
|
258
469
|
height: 100%;
|
|
259
470
|
border: none;
|
|
260
471
|
background-color: transparent;
|
|
@@ -266,166 +477,273 @@ const lt = I.input`
|
|
|
266
477
|
&[aria-disabled='true'] {
|
|
267
478
|
cursor: inherit;
|
|
268
479
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
480
|
+
`;
|
|
481
|
+
/* -------------------------------------------------------------------------------------------------
|
|
482
|
+
* DatePickerContent
|
|
483
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
484
|
+
const CONTENT_NAME = 'DatePickerContent';
|
|
485
|
+
const DatePickerContent = React__namespace.forwardRef((props, forwardedRef) => {
|
|
486
|
+
const [fragment, setFragment] = React__namespace.useState();
|
|
487
|
+
const context = useDatePickerContext(CONTENT_NAME);
|
|
488
|
+
// setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
|
|
489
|
+
React__namespace.useLayoutEffect(() => {
|
|
490
|
+
setFragment(new DocumentFragment());
|
|
491
|
+
}, []);
|
|
492
|
+
if (!context.open) {
|
|
493
|
+
const frag = fragment;
|
|
494
|
+
return frag ? reactDom.createPortal(jsxRuntime.jsx("div", { children: props.children }), frag) : null;
|
|
495
|
+
}
|
|
496
|
+
return jsxRuntime.jsx(DatePickerContentImpl, { ...props, ref: forwardedRef });
|
|
497
|
+
});
|
|
498
|
+
/* -------------------------------------------------------------------------------------------------
|
|
499
|
+
* DatePickerContentImpl
|
|
500
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
501
|
+
const CONTENT_IMPL_NAME = 'DatePickerContent';
|
|
502
|
+
const DatePickerContentImpl = React__namespace.forwardRef((props, forwardedRef) => {
|
|
503
|
+
const { label = 'Choose date', ...restProps } = props;
|
|
504
|
+
const { onOpenChange, ...context } = useDatePickerContext(CONTENT_IMPL_NAME);
|
|
505
|
+
const { x, y, refs, strategy } = reactDom$1.useFloating({
|
|
506
|
+
strategy: 'fixed',
|
|
507
|
+
placement: 'bottom-start',
|
|
508
|
+
middleware: [
|
|
509
|
+
reactDom$1.offset({
|
|
510
|
+
mainAxis: 4,
|
|
511
|
+
}),
|
|
512
|
+
reactDom$1.shift(),
|
|
513
|
+
reactDom$1.flip(),
|
|
514
|
+
],
|
|
515
|
+
elements: {
|
|
516
|
+
reference: context.trigger,
|
|
517
|
+
},
|
|
518
|
+
whileElementsMounted: reactDom$1.autoUpdate,
|
|
519
|
+
});
|
|
520
|
+
React__namespace.useEffect(() => {
|
|
521
|
+
const close = () => {
|
|
522
|
+
onOpenChange(false);
|
|
523
|
+
};
|
|
524
|
+
window.addEventListener('blur', close);
|
|
525
|
+
window.addEventListener('resize', close);
|
|
526
|
+
return () => {
|
|
527
|
+
window.removeEventListener('blur', close);
|
|
528
|
+
window.removeEventListener('resize', close);
|
|
529
|
+
};
|
|
530
|
+
}, [onOpenChange]);
|
|
531
|
+
const composedRefs = useComposeRefs.useComposedRefs(forwardedRef, (node) => context.onContentChange(node), refs.setFloating);
|
|
532
|
+
reactFocusGuards.useFocusGuards();
|
|
533
|
+
return (jsxRuntime.jsx(reactRemoveScroll.RemoveScroll, { allowPinchZoom: true, children: jsxRuntime.jsx(index.DismissibleLayer, { asChild: true,
|
|
534
|
+
// When focus is trapped, a focusout event may still happen.
|
|
535
|
+
// We make sure we don't trigger our `onDismiss` in such case.
|
|
536
|
+
onFocusOutside: (event) => {
|
|
537
|
+
event.preventDefault();
|
|
538
|
+
}, onDismiss: () => {
|
|
539
|
+
onOpenChange(false);
|
|
540
|
+
}, children: jsxRuntime.jsx(ContentElement, { ref: composedRefs, "data-state": context.open ? 'open' : 'closed', onContextMenu: (event) => event.preventDefault(), id: context.contentId, role: "dialog", "aria-modal": "true", "aria-label": label, style: {
|
|
541
|
+
left: x,
|
|
542
|
+
top: y,
|
|
543
|
+
position: strategy,
|
|
544
|
+
}, hasRadius: true, background: "neutral0", padding: 1, ...restProps }) }) }));
|
|
545
|
+
});
|
|
546
|
+
const ContentElement = styled__default.default(Box.Box) `
|
|
547
|
+
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
|
548
|
+
z-index: ${({ theme }) => theme.zIndices[0]};
|
|
549
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
550
|
+
`;
|
|
551
|
+
/* -------------------------------------------------------------------------------------------------
|
|
552
|
+
* DatePickerCalendar
|
|
553
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
554
|
+
const DATE_PICKER_CALENDAR_NAME = 'DatePickerCalendar';
|
|
555
|
+
const DatePickerCalendar = React__namespace.forwardRef(({ monthSelectLabel, yearSelectLabel, ...restProps }, ref) => {
|
|
556
|
+
const { locale, timeZone, minDate, maxDate, calendarDate, onCalendarDateChange } = useDatePickerContext(DATE_PICKER_CALENDAR_NAME);
|
|
557
|
+
const startDate = date.startOfMonth(calendarDate);
|
|
558
|
+
const years = React__namespace.useMemo(() => {
|
|
559
|
+
const minYear = minDate.year;
|
|
560
|
+
const maxYear = maxDate.year;
|
|
561
|
+
return [...Array(maxYear - minYear + 1).keys()].map((y) => (minYear + y).toString());
|
|
562
|
+
}, [minDate, maxDate]);
|
|
563
|
+
const monthFormatter = useDateFormatter.useDateFormatter(locale, { month: 'long' });
|
|
564
|
+
const months = React__namespace.useMemo(() => [...Array(calendarDate.calendar.getMonthsInYear(calendarDate)).keys()].map((m) => monthFormatter.format(calendarDate.set({ month: m + 1 }).toDate(timeZone))), [calendarDate, monthFormatter, timeZone]);
|
|
565
|
+
const dayFormatter = useDateFormatter.useDateFormatter(locale, { weekday: 'short' });
|
|
566
|
+
/**
|
|
567
|
+
* These are the strings of our days of the week
|
|
568
|
+
* e.g. `Mon`, `Tue`, `Wed`, etc.
|
|
569
|
+
*/
|
|
570
|
+
const weekDays = React__namespace.useMemo(() => {
|
|
571
|
+
let weekStart = date.startOfWeek(date.today(timeZone), locale);
|
|
572
|
+
return [...new Array(7).keys()].map((index) => {
|
|
573
|
+
let date = weekStart.add({ days: index });
|
|
574
|
+
let dateDay = date.toDate(timeZone);
|
|
575
|
+
return dayFormatter.format(dateDay);
|
|
576
|
+
});
|
|
577
|
+
}, [timeZone, locale, dayFormatter]);
|
|
578
|
+
const handleMonthChange = (month) => {
|
|
579
|
+
if (typeof month === 'number') {
|
|
580
|
+
/**
|
|
581
|
+
* This just to make TS happy, we're not going to get a
|
|
582
|
+
* number because we only use strings as options
|
|
583
|
+
*/
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
const updatedDate = calendarDate.set({ month: months.indexOf(month) + 1 });
|
|
587
|
+
onCalendarDateChange(updatedDate);
|
|
297
588
|
};
|
|
298
|
-
|
|
299
|
-
|
|
589
|
+
const handleYearChange = (year) => {
|
|
590
|
+
if (typeof year === 'number') {
|
|
591
|
+
/**
|
|
592
|
+
* This just to make TS happy, we're not going to get a
|
|
593
|
+
* number because we only use strings as options
|
|
594
|
+
*/
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
const updatedDate = calendarDate.set({ year: parseInt(year, 10) });
|
|
598
|
+
onCalendarDateChange(updatedDate);
|
|
300
599
|
};
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
const m = l.set({ month: k.indexOf(o) + 1 });
|
|
337
|
-
b(m);
|
|
338
|
-
}, d = (o) => {
|
|
339
|
-
if (typeof o == "number")
|
|
340
|
-
return;
|
|
341
|
-
const m = l.set({ year: parseInt(o, 10) });
|
|
342
|
-
b(m);
|
|
343
|
-
}, h = ht(x, a);
|
|
344
|
-
return F(U, { ref: t, direction: "column", alignItems: "stretch", padding: 4, ...n, children: [F(gt, { justifyContent: "flex-start", paddingBottom: 4, paddingLeft: 2, paddingRight: 2, gap: 2, children: [i(ne, { label: e, size: "S", value: k[l.month - 1], onChange: E, children: k.map((o) => i(ae, { value: o, children: o }, o)) }), i(ne, { size: "S", value: l.year.toString(), label: r, onChange: d, children: f.map((o) => i(ae, { value: o, children: o }, o)) })] }), F("table", { role: "grid", children: [i("thead", { "aria-hidden": !0, children: i("tr", { "aria-rowindex": 0, children: P.map((o, m) => i(Dt, { "aria-colindex": m, children: o }, o)) }) }), i("tbody", { children: [...new Array(6).keys()].map((o) => i("tr", { "aria-rowindex": o + 2, children: h(o).map((m, p) => m ? i(bt, { "aria-colindex": p + 1, date: m, startDate: x }, m.toString()) : i(de, { "aria-colindex": p + 1 })) }, o)) })] })] });
|
|
345
|
-
}), ht = (e, r) => (n) => {
|
|
346
|
-
let t = e.add({ weeks: n }), a = [];
|
|
347
|
-
t = le(t, r);
|
|
348
|
-
let s = Ie(t, r);
|
|
349
|
-
for (let g = 0; g < s; g++)
|
|
350
|
-
a.push(null);
|
|
351
|
-
for (; a.length < 7; ) {
|
|
352
|
-
a.push(t);
|
|
353
|
-
let g = t.add({ days: 1 });
|
|
354
|
-
if (se(t, g))
|
|
355
|
-
break;
|
|
356
|
-
t = g;
|
|
357
|
-
}
|
|
358
|
-
for (; a.length < 7; )
|
|
359
|
-
a.push(null);
|
|
360
|
-
return a;
|
|
361
|
-
}, gt = I(U)`
|
|
600
|
+
const getDatesInWeek = makeGetDatesInWeek(startDate, locale);
|
|
601
|
+
return (jsxRuntime.jsxs(Flex.Flex, { ref: ref, direction: "column", alignItems: "stretch", padding: 4, ...restProps, children: [jsxRuntime.jsxs(ToolbarFlex, { justifyContent: "flex-start", paddingBottom: 4, paddingLeft: 2, paddingRight: 2, gap: 2, children: [jsxRuntime.jsx(SingleSelect.SingleSelectInput, { label: monthSelectLabel, size: "S", value: months[calendarDate.month - 1], onChange: handleMonthChange, children: months.map((month) => (jsxRuntime.jsx(SingleSelect.SingleSelectOption, { value: month, children: month }, month))) }), jsxRuntime.jsx(SingleSelect.SingleSelectInput, { size: "S", value: calendarDate.year.toString(), label: yearSelectLabel, onChange: handleYearChange, children: years.map((year) => (jsxRuntime.jsx(SingleSelect.SingleSelectOption, { value: year, children: year }, year))) })] }), jsxRuntime.jsxs("table", { role: "grid", children: [jsxRuntime.jsx("thead", { "aria-hidden": true, children: jsxRuntime.jsx("tr", { "aria-rowindex": 0, children: weekDays.map((day, index) => (jsxRuntime.jsx(DatePickerHeaderCell, { "aria-colindex": index, children: day }, day))) }) }), jsxRuntime.jsx("tbody", { children: [...new Array(6).keys()].map((weekIndex) => (jsxRuntime.jsx("tr", { "aria-rowindex": weekIndex + 2, children: getDatesInWeek(weekIndex).map((date, index) => date ? (jsxRuntime.jsx(DatePickerCalendarCell, { "aria-colindex": index + 1, date: date, startDate: startDate }, date.toString())) : (jsxRuntime.jsx(Cell, { "aria-colindex": index + 1 }))) }, weekIndex))) })] })] }));
|
|
602
|
+
});
|
|
603
|
+
const makeGetDatesInWeek = (from, locale) => (weekIndex) => {
|
|
604
|
+
let date$1 = from.add({ weeks: weekIndex });
|
|
605
|
+
let dates = [];
|
|
606
|
+
date$1 = date.startOfWeek(date$1, locale);
|
|
607
|
+
/**
|
|
608
|
+
* startOfWeek will clamp dates within the calendar system's valid range, which may
|
|
609
|
+
* start in the middle of a week. In this case, add null placeholders.
|
|
610
|
+
*/
|
|
611
|
+
let dayOfWeek = date.getDayOfWeek(date$1, locale);
|
|
612
|
+
for (let i = 0; i < dayOfWeek; i++) {
|
|
613
|
+
dates.push(null);
|
|
614
|
+
}
|
|
615
|
+
while (dates.length < 7) {
|
|
616
|
+
dates.push(date$1);
|
|
617
|
+
let nextDate = date$1.add({ days: 1 });
|
|
618
|
+
if (date.isSameDay(date$1, nextDate)) {
|
|
619
|
+
/**
|
|
620
|
+
* If the next day is the same, we have hit the end of the calendar system.
|
|
621
|
+
*/
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
date$1 = nextDate;
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Add null placeholders if at the end of the calendar system.
|
|
628
|
+
*/
|
|
629
|
+
while (dates.length < 7) {
|
|
630
|
+
dates.push(null);
|
|
631
|
+
}
|
|
632
|
+
return dates;
|
|
633
|
+
};
|
|
634
|
+
const ToolbarFlex = styled__default.default(Flex.Flex) `
|
|
362
635
|
div[role='combobox'] {
|
|
363
636
|
border: 1px solid transparent;
|
|
364
637
|
background: transparent;
|
|
365
|
-
font-weight: ${(
|
|
638
|
+
font-weight: ${(props) => props.theme.fontWeights.bold};
|
|
366
639
|
|
|
367
|
-
${
|
|
368
|
-
color: ${({ theme
|
|
640
|
+
${Typography.Typography} {
|
|
641
|
+
color: ${({ theme }) => theme.colors.neutral800};
|
|
369
642
|
}
|
|
370
643
|
|
|
371
644
|
svg {
|
|
372
645
|
> g,
|
|
373
646
|
path {
|
|
374
|
-
fill: ${({ theme
|
|
647
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
375
648
|
}
|
|
376
649
|
}
|
|
377
650
|
|
|
378
651
|
&:hover {
|
|
379
|
-
background-color: ${({ theme
|
|
652
|
+
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
380
653
|
}
|
|
381
654
|
}
|
|
382
|
-
|
|
383
|
-
|
|
655
|
+
`;
|
|
656
|
+
const DatePickerHeaderCell = React__namespace.forwardRef(({ children, ...props }, forwardedRef) => {
|
|
657
|
+
return (jsxRuntime.jsx(Th, { as: "th", role: "gridcell", ref: forwardedRef, ...props, height: `${24 / 16}rem`, width: `${32 / 16}rem`, children: jsxRuntime.jsx(Typography.Typography, { variant: "pi", fontWeight: "bold", color: "neutral800", children: children.slice(0, 2) }) }));
|
|
658
|
+
});
|
|
659
|
+
const Th = styled__default.default(Box.Box) `
|
|
660
|
+
border-radius: ${({ theme }) => theme.borderRadius};
|
|
384
661
|
text-transform: capitalize;
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
})
|
|
662
|
+
`;
|
|
663
|
+
/* -------------------------------------------------------------------------------------------------
|
|
664
|
+
* DatePickerCalendarCell
|
|
665
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
666
|
+
const DATE_PICKER_CALEDNAR_CELL_NAME = 'DatePickerCalendarCell';
|
|
667
|
+
const DatePickerCalendarCell = React__namespace.forwardRef(({ date: date$1, startDate, ...props }, forwardedRef) => {
|
|
668
|
+
const { timeZone, locale, calendarDate, onValueChange, onOpenChange, onTextValueChange, onCalendarDateChange } = useDatePickerContext(DATE_PICKER_CALEDNAR_CELL_NAME);
|
|
669
|
+
const isSelected = date.isSameDay(calendarDate, date$1);
|
|
670
|
+
const dateFormatter = useDateFormatter.useDateFormatter(locale, {
|
|
671
|
+
weekday: 'long',
|
|
672
|
+
day: 'numeric',
|
|
673
|
+
month: 'long',
|
|
674
|
+
year: 'numeric',
|
|
675
|
+
});
|
|
676
|
+
const label = React__namespace.useMemo(() => dateFormatter.format(date$1.toDate(timeZone)), [dateFormatter, date$1, timeZone]);
|
|
677
|
+
const cellDateFormatter = useDateFormatter.useDateFormatter(locale, {
|
|
678
|
+
day: 'numeric',
|
|
679
|
+
calendar: date$1.calendar.identifier,
|
|
680
|
+
});
|
|
681
|
+
const formattedDate = React__namespace.useMemo(() => cellDateFormatter.formatToParts(date$1.toDate(timeZone)).find((part) => part.type === 'day').value, [cellDateFormatter, date$1, timeZone]);
|
|
682
|
+
const textValueFormatter = useDateFormatter.useDateFormatter(locale, {
|
|
683
|
+
day: '2-digit',
|
|
684
|
+
month: '2-digit',
|
|
685
|
+
year: 'numeric',
|
|
686
|
+
});
|
|
687
|
+
const endDate = date.endOfMonth(startDate);
|
|
688
|
+
const isOutsideVisibleRange = date$1.compare(startDate) < 0 || date$1.compare(endDate) > 0;
|
|
689
|
+
let textColor = 'neutral900';
|
|
690
|
+
if (isSelected) {
|
|
691
|
+
textColor = 'primary600';
|
|
692
|
+
}
|
|
693
|
+
else if (isOutsideVisibleRange) {
|
|
694
|
+
textColor = 'neutral600';
|
|
695
|
+
}
|
|
696
|
+
return (jsxRuntime.jsx(Cell, { as: "td", role: "gridcell", ref: forwardedRef, "aria-selected": isSelected, ...props, hasRadius: true, "aria-label": label, tabIndex: isSelected ? 0 : -1, background: isSelected ? 'primary100' : 'neutral0', cursor: "pointer", onPointerDown: uiPrimitives.composeEventHandlers(props.onPointerDown, (event) => {
|
|
697
|
+
event.preventDefault();
|
|
698
|
+
onCalendarDateChange(date$1);
|
|
699
|
+
onValueChange(date$1);
|
|
700
|
+
onTextValueChange(textValueFormatter.format(date$1.toDate(timeZone)));
|
|
701
|
+
onOpenChange(false);
|
|
702
|
+
}), children: jsxRuntime.jsx(Typography.Typography, { variant: "pi", textColor: textColor, children: formattedDate }) }));
|
|
703
|
+
});
|
|
704
|
+
const Cell = styled__default.default(Box.Box) `
|
|
404
705
|
text-align: center;
|
|
405
706
|
padding: ${7 / 16}rem;
|
|
406
707
|
// Trick to prevent the outline from overflowing because of the general outline-offset
|
|
407
708
|
outline-offset: -2px !important;
|
|
408
709
|
|
|
409
710
|
&:hover {
|
|
410
|
-
background: ${({ theme
|
|
711
|
+
background: ${({ theme }) => theme.colors.primary100};
|
|
411
712
|
|
|
412
|
-
& > ${
|
|
413
|
-
color: ${({ theme
|
|
713
|
+
& > ${Typography.Typography} {
|
|
714
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
414
715
|
}
|
|
415
716
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
717
|
+
`;
|
|
718
|
+
const DatePickerField = React__namespace.forwardRef((props, ref) => {
|
|
719
|
+
const { error, hint, id, required, label, ...restProps } = props;
|
|
720
|
+
const generatedId = useId.useId(id);
|
|
721
|
+
return (jsxRuntime.jsx(Field.Field, { error: error, hint: hint, required: required, id: generatedId, children: jsxRuntime.jsxs(Flex.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [jsxRuntime.jsx(FieldLabel.FieldLabel, { children: label }), jsxRuntime.jsx(DatePickerInput, { ref: ref, id: generatedId, error: error, required: required, ...restProps }), jsxRuntime.jsx(FieldHint.FieldHint, {}), jsxRuntime.jsx(FieldError.FieldError, {})] }) }));
|
|
722
|
+
});
|
|
723
|
+
const warnOnce = deprecations.once(console.warn);
|
|
724
|
+
const convertUTCDateToCalendarDate = (date$1) => {
|
|
725
|
+
/**
|
|
726
|
+
* TODO: remove this in V2, it's a deprecated API
|
|
727
|
+
*/
|
|
728
|
+
if (typeof date$1 === 'string') {
|
|
729
|
+
warnOnce("It looks like you're passing a string as representation of a Date to the DatePicker. This is deprecated, look to passing a Date instead.");
|
|
730
|
+
const timestamp = Date.parse(date$1);
|
|
731
|
+
if (!Number.isNaN(timestamp)) {
|
|
732
|
+
date$1 = new Date(timestamp);
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
date$1 = new Date();
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
const utcDateString = date$1.toISOString();
|
|
739
|
+
const zonedDateTime = date.parseAbsolute(utcDateString, 'UTC');
|
|
740
|
+
/**
|
|
741
|
+
* ZonedDateTime can't have weeks added,
|
|
742
|
+
* see – https://github.com/adobe/react-spectrum/issues/3667
|
|
743
|
+
*/
|
|
744
|
+
return date.toCalendarDate(zonedDateTime);
|
|
431
745
|
};
|
|
746
|
+
const DatePicker = DatePickerField;
|
|
747
|
+
|
|
748
|
+
exports.DatePicker = DatePicker;
|
|
749
|
+
exports.DatePickerInput = DatePickerInput;
|