@strapi/design-system 0.0.0-599b75fb-test → 0.0.0-622b91ef
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/README.md +47 -0
- package/dist/Accordion/Accordion.cjs +4 -4
- package/dist/Accordion/Accordion.js +13 -71
- package/dist/Accordion/AccordionContent.cjs +1 -1
- package/dist/Accordion/AccordionContent.js +3 -16
- package/dist/Accordion/AccordionContext.cjs +1 -1
- package/dist/Accordion/AccordionGroup.cjs +4 -4
- package/dist/Accordion/AccordionGroup.js +19 -89
- package/dist/Accordion/AccordionToggle.cjs +3 -3
- package/dist/Accordion/AccordionToggle.js +11 -101
- package/dist/Accordion/index.cjs +1 -1
- package/dist/Accordion/utils.cjs +1 -1
- package/dist/Alert/Alert.cjs +23 -29
- package/dist/Alert/Alert.js +33 -111
- package/dist/Alert/index.cjs +1 -1
- package/dist/Alert/utils.cjs +1 -1
- package/dist/Alert/utils.js +14 -3
- package/dist/Avatar/Avatar.cjs +5 -5
- package/dist/Avatar/Avatar.js +12 -56
- package/dist/Avatar/AvatarGroup.cjs +3 -3
- package/dist/Avatar/constants.cjs +1 -1
- package/dist/Avatar/index.cjs +1 -1
- package/dist/Badge/Badge.cjs +2 -2
- package/dist/Badge/Badge.js +4 -33
- package/dist/Badge/index.cjs +1 -1
- package/dist/BaseButton/BaseButton.cjs +4 -4
- package/dist/BaseButton/BaseButton.js +15 -38
- package/dist/BaseButton/index.cjs +1 -1
- package/dist/BaseCheckbox/BaseCheckbox.cjs +4 -4
- package/dist/BaseCheckbox/BaseCheckbox.js +19 -62
- package/dist/BaseCheckbox/index.cjs +1 -1
- package/dist/BaseCheckbox/utils.cjs +1 -1
- package/dist/BaseLink/BaseLink.cjs +1 -3
- package/dist/BaseLink/BaseLink.js +2 -18
- package/dist/BaseLink/index.cjs +1 -1
- package/dist/BaseRadio/BaseRadio.cjs +2 -2
- package/dist/BaseRadio/BaseRadio.js +12 -38
- package/dist/BaseRadio/RadioGroup.cjs +1 -1
- package/dist/BaseRadio/RadioGroup.js +3 -25
- package/dist/BaseRadio/context.cjs +1 -1
- package/dist/BaseRadio/index.cjs +1 -1
- package/dist/BaseRadio/utils.cjs +1 -1
- package/dist/Box/Box.cjs +3 -3
- package/dist/Box/Box.js +47 -173
- package/dist/Box/index.cjs +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.cjs +4 -4
- package/dist/Breadcrumbs/Breadcrumbs.js +10 -43
- package/dist/Breadcrumbs/index.cjs +1 -1
- package/dist/Button/Button.cjs +10 -5
- package/dist/Button/Button.js +27 -69
- package/dist/Button/constants.cjs +1 -1
- package/dist/Button/index.cjs +1 -1
- package/dist/Button/utils.cjs +1 -1
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +5 -25
- package/dist/Card/CardAction.cjs +2 -2
- package/dist/Card/CardAsset.cjs +3 -3
- package/dist/Card/CardAsset.js +5 -25
- package/dist/Card/CardBadge.cjs +2 -2
- package/dist/Card/CardBadge.js +2 -8
- package/dist/Card/CardBody.cjs +1 -1
- package/dist/Card/CardBody.js +1 -10
- package/dist/Card/CardCheckbox.cjs +1 -1
- package/dist/Card/CardCheckbox.js +5 -10
- package/dist/Card/CardContent.cjs +2 -2
- package/dist/Card/CardContent.js +1 -7
- package/dist/Card/CardContext.cjs +1 -1
- package/dist/Card/CardContext.js +1 -3
- package/dist/Card/CardHeader.cjs +2 -2
- package/dist/Card/CardHeader.js +2 -8
- package/dist/Card/CardTimer.cjs +1 -1
- package/dist/Card/CardTimer.js +1 -19
- package/dist/Card/CardTitle.cjs +1 -1
- package/dist/Card/CardTitle.js +3 -17
- package/dist/Card/index.cjs +1 -1
- package/dist/CarouselInput/Carousel.cjs +6 -7
- package/dist/CarouselInput/Carousel.js +24 -69
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +4 -16
- package/dist/CarouselInput/CarouselImage.cjs +3 -4
- package/dist/CarouselInput/CarouselImage.js +13 -22
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +12 -72
- package/dist/CarouselInput/CarouselSlide.cjs +1 -3
- package/dist/CarouselInput/CarouselSlide.js +4 -28
- package/dist/CarouselInput/index.cjs +1 -1
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +21 -38
- package/dist/Checkbox/index.cjs +1 -1
- package/dist/Combobox/Combobox.cjs +107 -1
- package/dist/Combobox/Combobox.js +168 -280
- package/dist/Combobox/ComboboxList.cjs +5 -1
- package/dist/Combobox/ComboboxList.js +8 -6
- package/dist/Combobox/ComboboxOption.cjs +1 -1
- package/dist/Combobox/ComboboxOption.js +3 -29
- package/dist/Combobox/index.cjs +1 -1
- package/dist/DatePicker/DatePicker.cjs +85 -5
- package/dist/DatePicker/DatePicker.js +423 -76
- package/dist/DatePicker/index.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.cjs +7 -1
- package/dist/DateTimePicker/DateTimePicker.js +96 -103
- package/dist/DateTimePicker/index.cjs +1 -1
- package/dist/DateTimePicker/index.js +3 -2
- package/dist/DesignSystemProvider.cjs +1 -0
- package/dist/DesignSystemProvider.js +10 -0
- package/dist/Dialog/Dialog.cjs +4 -4
- package/dist/Dialog/Dialog.js +20 -45
- package/dist/Dialog/DialogBody.cjs +2 -2
- package/dist/Dialog/DialogBody.js +9 -18
- package/dist/Dialog/DialogFooter.cjs +2 -2
- package/dist/Dialog/DialogFooter.js +7 -17
- package/dist/Dialog/index.cjs +1 -1
- package/dist/DismissibleLayer/index.cjs +1 -1
- package/dist/DismissibleLayer/index.js +3 -2
- package/dist/Divider/Divider.cjs +2 -2
- package/dist/Divider/Divider.js +6 -15
- package/dist/Divider/index.cjs +1 -1
- package/dist/EmptyStateLayout/EmptyStateLayout.cjs +2 -7
- package/dist/EmptyStateLayout/EmptyStateLayout.js +8 -25
- package/dist/EmptyStateLayout/index.cjs +1 -1
- package/dist/EmptyStateLayout/story-assets/Illo.cjs +1 -1
- package/dist/EmptyStateLayout/story-assets/Illo.js +3 -62
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +5 -26
- package/dist/Field/FieldAction.cjs +2 -2
- package/dist/Field/FieldAction.js +5 -20
- package/dist/Field/FieldContext.cjs +1 -1
- package/dist/Field/FieldError.cjs +1 -1
- package/dist/Field/FieldError.js +2 -12
- package/dist/Field/FieldHint.cjs +1 -1
- package/dist/Field/FieldHint.js +4 -14
- package/dist/Field/FieldInput.cjs +4 -4
- package/dist/Field/FieldInput.js +19 -86
- package/dist/Field/FieldLabel.cjs +4 -4
- package/dist/Field/FieldLabel.js +7 -32
- package/dist/Field/index.cjs +1 -1
- package/dist/Flex/Flex.cjs +4 -4
- package/dist/Flex/Flex.js +10 -25
- package/dist/Flex/index.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.js +14 -22
- package/dist/FocusTrap/index.cjs +1 -1
- package/dist/Grid/Grid.cjs +3 -3
- package/dist/Grid/Grid.js +10 -20
- package/dist/Grid/GridItem.cjs +2 -2
- package/dist/Grid/GridItem.js +10 -26
- package/dist/Grid/index.cjs +1 -1
- package/dist/Icon/Icon.cjs +3 -3
- package/dist/Icon/Icon.js +6 -21
- package/dist/Icon/index.cjs +1 -1
- package/dist/IconButton/IconButton.cjs +4 -4
- package/dist/IconButton/IconButton.js +34 -85
- package/dist/IconButton/index.cjs +1 -1
- package/dist/JSONInput/JSONInput.cjs +1 -1
- package/dist/JSONInput/JSONInput.js +11 -56
- package/dist/JSONInput/JSONInputContainer.cjs +3 -3
- package/dist/JSONInput/JSONInputContainer.js +7 -14
- package/dist/JSONInput/index.cjs +1 -1
- package/dist/JSONInput/utils/decorationExtension.cjs +1 -1
- package/dist/JSONInput/utils/decorationExtension.js +3 -0
- package/dist/KeyboardNavigable/KeyboardNavigable.cjs +1 -1
- package/dist/KeyboardNavigable/KeyboardNavigable.js +32 -39
- package/dist/KeyboardNavigable/index.cjs +1 -1
- package/dist/Layout/ActionLayout.cjs +1 -9
- package/dist/Layout/ActionLayout.js +4 -23
- package/dist/Layout/ContentLayout.cjs +1 -1
- package/dist/Layout/ContentLayout.js +3 -7
- package/dist/Layout/GridLayout.cjs +3 -3
- package/dist/Layout/GridLayout.js +4 -8
- package/dist/Layout/HeaderLayout.cjs +4 -3
- package/dist/Layout/HeaderLayout.js +25 -96
- package/dist/Layout/Layout.cjs +4 -4
- package/dist/Layout/Layout.js +8 -16
- package/dist/Layout/TwoColsLayout.cjs +1 -1
- package/dist/Layout/TwoColsLayout.js +6 -11
- package/dist/Layout/index.cjs +1 -1
- package/dist/Link/Link.cjs +4 -4
- package/dist/Link/Link.js +9 -53
- package/dist/Link/index.cjs +1 -1
- package/dist/LinkButton/LinkButton.cjs +2 -2
- package/dist/LinkButton/LinkButton.js +8 -51
- package/dist/LinkButton/index.cjs +1 -1
- package/dist/LiveRegions/LiveRegions.cjs +1 -1
- package/dist/LiveRegions/LiveRegions.js +1 -18
- package/dist/LiveRegions/constants.cjs +1 -1
- package/dist/LiveRegions/index.cjs +1 -1
- package/dist/LiveRegions/useNotifyAT.cjs +1 -1
- package/dist/Loader/Loader.cjs +2 -2
- package/dist/Loader/Loader.js +3 -22
- package/dist/Loader/index.cjs +1 -1
- package/dist/Main/Main.cjs +2 -2
- package/dist/Main/Main.js +6 -15
- package/dist/Main/SkipToContent.cjs +4 -7
- package/dist/Main/SkipToContent.js +5 -24
- package/dist/Main/index.cjs +1 -1
- package/dist/MainNav/MainNav.cjs +2 -2
- package/dist/MainNav/MainNav.js +9 -30
- package/dist/MainNav/MainNavContext.cjs +1 -1
- package/dist/MainNav/MainNavContext.js +1 -1
- package/dist/MainNav/NavBrand.cjs +3 -3
- package/dist/MainNav/NavBrand.js +14 -24
- package/dist/MainNav/NavCondense.cjs +2 -2
- package/dist/MainNav/NavCondense.js +10 -14
- package/dist/MainNav/NavFooter.cjs +1 -1
- package/dist/MainNav/NavFooter.js +4 -9
- package/dist/MainNav/NavLink.cjs +6 -6
- package/dist/MainNav/NavLink.js +39 -51
- package/dist/MainNav/NavSection.cjs +1 -1
- package/dist/MainNav/NavSection.js +9 -33
- package/dist/MainNav/NavSections.cjs +2 -2
- package/dist/MainNav/NavSections.js +8 -21
- package/dist/MainNav/NavUser.cjs +2 -2
- package/dist/MainNav/NavUser.js +14 -25
- package/dist/MainNav/index.cjs +1 -1
- package/dist/ModalLayout/ModalBody.cjs +2 -2
- package/dist/ModalLayout/ModalBody.js +6 -6
- package/dist/ModalLayout/ModalContext.cjs +1 -1
- package/dist/ModalLayout/ModalContext.js +2 -1
- package/dist/ModalLayout/ModalFooter.cjs +2 -6
- package/dist/ModalLayout/ModalFooter.js +8 -21
- package/dist/ModalLayout/ModalHeader.cjs +2 -2
- package/dist/ModalLayout/ModalHeader.js +13 -21
- package/dist/ModalLayout/ModalLayout.cjs +3 -5
- package/dist/ModalLayout/ModalLayout.js +12 -31
- package/dist/ModalLayout/index.cjs +1 -1
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +69 -162
- package/dist/NumberInput/index.cjs +1 -1
- package/dist/Pagination/Pagination.cjs +1 -5
- package/dist/Pagination/Pagination.js +8 -21
- package/dist/Pagination/PaginationContext.cjs +1 -1
- package/dist/Pagination/components.cjs +10 -13
- package/dist/Pagination/components.js +33 -69
- package/dist/Pagination/index.cjs +1 -1
- package/dist/Popover/Popover.cjs +4 -5
- package/dist/Popover/Popover.js +105 -110
- package/dist/Popover/index.cjs +1 -1
- package/dist/Popover/index.js +5 -9
- package/dist/Popover/primitives.cjs +1 -0
- package/dist/Popover/primitives.js +5 -0
- package/dist/Portal/Portal.cjs +1 -1
- package/dist/Portal/Portal.js +7 -11
- package/dist/Portal/index.cjs +1 -1
- package/dist/ProgressBar/ProgressBar.cjs +5 -5
- package/dist/ProgressBar/ProgressBar.js +6 -36
- package/dist/ProgressBar/index.cjs +1 -1
- package/dist/Radio/Radio.cjs +1 -4
- package/dist/Radio/Radio.js +6 -15
- package/dist/Radio/index.cjs +1 -1
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +6 -29
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +4 -28
- package/dist/RawTable/RawTableContext.cjs +1 -1
- package/dist/RawTable/RawTbody.cjs +1 -1
- package/dist/RawTable/RawTbody.js +3 -11
- package/dist/RawTable/RawThead.cjs +1 -1
- package/dist/RawTable/RawThead.js +3 -11
- package/dist/RawTable/RawTr.cjs +1 -1
- package/dist/RawTable/RawTr.js +3 -13
- package/dist/RawTable/focusFocusable.cjs +1 -1
- package/dist/RawTable/index.cjs +1 -1
- package/dist/Searchbar/SearchForm.cjs +1 -1
- package/dist/Searchbar/SearchForm.js +3 -3
- package/dist/Searchbar/Searchbar.cjs +10 -11
- package/dist/Searchbar/Searchbar.js +31 -59
- package/dist/Searchbar/index.cjs +1 -1
- package/dist/Select/MultiSelect.cjs +30 -0
- package/dist/Select/MultiSelect.js +75 -0
- package/dist/Select/MultiSelectNested.cjs +3 -1
- package/dist/Select/MultiSelectNested.js +7 -12
- package/dist/Select/OptGroup.cjs +5 -1
- package/dist/Select/OptGroup.js +8 -22
- package/dist/Select/Option.cjs +5 -45
- package/dist/Select/Option.js +13 -99
- package/dist/Select/Select.cjs +6 -3
- package/dist/Select/Select.js +16 -206
- package/dist/Select/SelectList.cjs +5 -1
- package/dist/Select/SelectList.js +67 -69
- package/dist/Select/SelectParts.cjs +83 -0
- package/dist/Select/SelectParts.js +110 -0
- package/dist/Select/SingleSelect.cjs +1 -0
- package/dist/Select/SingleSelect.js +44 -0
- package/dist/Select/index.cjs +1 -1
- package/dist/Select/index.js +17 -10
- package/dist/SimpleMenu/SimpleMenu.cjs +9 -9
- package/dist/SimpleMenu/SimpleMenu.js +73 -143
- package/dist/SimpleMenu/index.cjs +1 -1
- package/dist/SimpleMenu/utils.cjs +1 -1
- package/dist/Stack/Stack.cjs +5 -5
- package/dist/Stack/Stack.js +7 -28
- package/dist/Stack/index.cjs +1 -1
- package/dist/Status/Status.cjs +7 -7
- package/dist/Status/Status.js +12 -38
- package/dist/Status/index.cjs +1 -1
- package/dist/SubNav/SubNav.cjs +5 -5
- package/dist/SubNav/SubNav.js +8 -13
- package/dist/SubNav/SubNavHeader.cjs +3 -3
- package/dist/SubNav/SubNavHeader.js +32 -69
- package/dist/SubNav/SubNavLink.cjs +13 -13
- package/dist/SubNav/SubNavLink.js +18 -44
- package/dist/SubNav/SubNavLinkSection.cjs +4 -4
- package/dist/SubNav/SubNavLinkSection.js +15 -24
- package/dist/SubNav/SubNavSection.cjs +2 -2
- package/dist/SubNav/SubNavSection.js +16 -49
- package/dist/SubNav/SubNavSectionLabel.cjs +3 -3
- package/dist/SubNav/SubNavSectionLabel.js +11 -36
- package/dist/SubNav/SubNavSections.cjs +1 -1
- package/dist/SubNav/SubNavSections.js +5 -18
- package/dist/SubNav/index.cjs +1 -1
- package/dist/Switch/Switch.cjs +3 -3
- package/dist/Switch/Switch.js +15 -44
- package/dist/Switch/index.cjs +1 -1
- package/dist/Table/Cell.cjs +3 -3
- package/dist/Table/Cell.js +9 -18
- package/dist/Table/TFooter.cjs +3 -3
- package/dist/Table/TFooter.js +11 -16
- package/dist/Table/Table.cjs +12 -12
- package/dist/Table/Table.js +16 -24
- package/dist/Table/Tbody.cjs +2 -2
- package/dist/Table/Tbody.js +6 -6
- package/dist/Table/Thead.cjs +2 -2
- package/dist/Table/Thead.js +6 -6
- package/dist/Table/Tr.cjs +2 -2
- package/dist/Table/Tr.js +6 -6
- package/dist/Table/index.cjs +1 -1
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +13 -36
- package/dist/Tabs/TabPanels.cjs +1 -1
- package/dist/Tabs/TabPanels.js +11 -21
- package/dist/Tabs/Tabs.cjs +2 -2
- package/dist/Tabs/Tabs.js +56 -106
- package/dist/Tabs/TabsContext.cjs +1 -1
- package/dist/Tabs/TabsContext.js +11 -4
- package/dist/Tabs/components.cjs +17 -17
- package/dist/Tabs/index.cjs +1 -1
- package/dist/Tag/Tag.cjs +4 -4
- package/dist/Tag/Tag.js +6 -43
- package/dist/Tag/index.cjs +1 -1
- package/dist/TextButton/TextButton.cjs +6 -12
- package/dist/TextButton/TextButton.js +17 -60
- package/dist/TextButton/index.cjs +1 -1
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +10 -41
- package/dist/TextInput/index.cjs +1 -1
- package/dist/Textarea/Textarea.cjs +14 -12
- package/dist/Textarea/Textarea.js +33 -52
- package/dist/Textarea/index.cjs +1 -1
- package/dist/ThemeProvider/ThemeProvider.cjs +2 -2
- package/dist/ThemeProvider/ThemeProvider.js +5 -12
- package/dist/ThemeProvider/hooks.cjs +1 -1
- package/dist/ThemeProvider/index.cjs +1 -1
- package/dist/TimePicker/TimePicker.cjs +5 -7
- package/dist/TimePicker/TimePicker.js +79 -53
- package/dist/TimePicker/index.cjs +1 -1
- package/dist/TimePicker/index.js +3 -2
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +8 -8
- package/dist/ToggleCheckbox/ToggleCheckbox.js +27 -122
- package/dist/ToggleCheckbox/index.cjs +1 -1
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +15 -62
- package/dist/ToggleInput/index.cjs +1 -1
- package/dist/Tooltip/Tooltip.cjs +2 -2
- package/dist/Tooltip/Tooltip.js +9 -52
- package/dist/Tooltip/hooks/useTooltipHandlers.cjs +1 -1
- package/dist/Tooltip/hooks/useTooltipLayout.cjs +1 -1
- package/dist/Tooltip/index.cjs +1 -1
- package/dist/Tooltip/utils/positionTooltip.cjs +1 -1
- package/dist/Typography/Typography.cjs +2 -2
- package/dist/Typography/Typography.js +11 -26
- package/dist/Typography/constants.cjs +1 -1
- package/dist/Typography/index.cjs +1 -1
- package/dist/Typography/utils.cjs +9 -9
- package/dist/VisuallyHidden/VisuallyHidden.cjs +1 -1
- package/dist/VisuallyHidden/index.cjs +1 -1
- package/dist/helpers/context.cjs +1 -0
- package/dist/helpers/context.js +21 -0
- package/dist/helpers/deprecations.cjs +1 -1
- package/dist/helpers/getDefaultLocale.cjs +4 -1
- package/dist/helpers/getDefaultLocale.js +7 -2
- package/dist/helpers/getFocusableNodes.cjs +1 -1
- package/dist/helpers/keyboardKeys.cjs +1 -1
- package/dist/helpers/objects.cjs +1 -1
- package/dist/helpers/objects.js +6 -22
- package/dist/helpers/setOpacity.cjs +1 -1
- package/dist/helpers/setTabIndexOnFirstItem.cjs +1 -1
- package/dist/helpers/strings.cjs +1 -0
- package/dist/helpers/strings.js +4 -0
- package/dist/helpers/theme.cjs +1 -1
- package/dist/helpers/useElementOnScreen.cjs +4 -1
- package/dist/helpers/useElementOnScreen.js +6 -1
- package/dist/helpers/useId.cjs +4 -1
- package/dist/helpers/useId.js +6 -1
- package/dist/helpers/useIntersection.cjs +4 -1
- package/dist/helpers/useIntersection.js +6 -1
- package/dist/helpers/useLockScroll.cjs +4 -1
- package/dist/helpers/useLockScroll.js +6 -1
- package/dist/helpers/usePrevious.cjs +4 -1
- package/dist/helpers/usePrevious.js +6 -1
- package/dist/helpers/useResizeObserver.cjs +4 -1
- package/dist/helpers/useResizeObserver.js +6 -1
- package/dist/hooks/useComposeRefs.cjs +1 -0
- package/dist/hooks/useComposeRefs.js +14 -0
- package/dist/hooks/useControllableState.cjs +1 -1
- package/dist/hooks/useControllableState.js +7 -7
- package/dist/hooks/useDateFormatter.cjs +1 -0
- package/dist/hooks/useDateFormatter.js +20 -0
- package/dist/hooks/useElementOnScreen.cjs +1 -1
- package/dist/hooks/useId.cjs +1 -1
- package/dist/hooks/useIntersection.cjs +1 -1
- package/dist/hooks/useIntersection.js +8 -8
- package/dist/hooks/useLockScroll.cjs +1 -1
- package/dist/hooks/usePrevious.cjs +1 -1
- package/dist/hooks/useResizeObserver.cjs +1 -1
- package/dist/hooks/useResizeObserver.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +305 -293
- package/dist/themes/common-theme.cjs +1 -1
- package/dist/themes/darkTheme/dark-colors.cjs +1 -1
- package/dist/themes/darkTheme/dark-shadows.cjs +1 -1
- package/dist/themes/darkTheme/index.cjs +1 -1
- package/dist/themes/extendTheme.cjs +4 -4
- package/dist/themes/extendTheme.js +21 -13
- package/dist/themes/index.cjs +1 -1
- package/dist/themes/lightTheme/index.cjs +1 -1
- package/dist/themes/lightTheme/light-colors.cjs +1 -1
- package/dist/themes/lightTheme/light-shadows.cjs +1 -1
- package/dist/themes/sizes.cjs +1 -1
- package/dist/themes/sizes.js +4 -4
- package/dist/themes/utils.cjs +4 -4
- package/dist/themes/utils.js +7 -6
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +2 -2
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +15 -19
- package/dist/v2/Breadcrumbs/Crumb.cjs +1 -1
- package/dist/v2/Breadcrumbs/Crumb.js +5 -23
- package/dist/v2/Breadcrumbs/CrumbLink.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbLink.js +6 -14
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +4 -3
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +11 -16
- package/dist/v2/Breadcrumbs/Divider.cjs +1 -1
- package/dist/v2/Breadcrumbs/Divider.js +5 -5
- package/dist/v2/Breadcrumbs/index.cjs +1 -1
- package/dist/v2/Link/Link.cjs +13 -11
- package/dist/v2/Link/Link.js +23 -37
- package/dist/v2/Link/index.cjs +1 -1
- package/dist/v2/LinkButton/LinkButton.cjs +2 -2
- package/dist/v2/LinkButton/LinkButton.js +11 -49
- package/dist/v2/LinkButton/index.cjs +1 -1
- package/dist/v2/MainNav/MainNav.cjs +2 -2
- package/dist/v2/MainNav/MainNav.js +9 -30
- package/dist/v2/MainNav/MainNavContext.cjs +1 -1
- package/dist/v2/MainNav/MainNavContext.js +1 -1
- package/dist/v2/MainNav/NavBrand.cjs +3 -3
- package/dist/v2/MainNav/NavBrand.js +16 -23
- package/dist/v2/MainNav/NavCondense.cjs +2 -5
- package/dist/v2/MainNav/NavCondense.js +19 -22
- package/dist/v2/MainNav/NavFooter.cjs +1 -1
- package/dist/v2/MainNav/NavFooter.js +4 -9
- package/dist/v2/MainNav/NavLink.cjs +10 -10
- package/dist/v2/MainNav/NavLink.js +39 -50
- package/dist/v2/MainNav/NavSection.cjs +1 -1
- package/dist/v2/MainNav/NavSection.js +9 -33
- package/dist/v2/MainNav/NavSections.cjs +2 -2
- package/dist/v2/MainNav/NavSections.js +7 -20
- package/dist/v2/MainNav/NavUser.cjs +2 -2
- package/dist/v2/MainNav/NavUser.js +15 -26
- package/dist/v2/MainNav/index.cjs +1 -1
- package/dist/v2/Pagination/Pagination.cjs +1 -5
- package/dist/v2/Pagination/Pagination.js +8 -21
- package/dist/v2/Pagination/PaginationContext.cjs +1 -1
- package/dist/v2/Pagination/components.cjs +10 -13
- package/dist/v2/Pagination/components.js +31 -51
- package/dist/v2/Pagination/index.cjs +1 -1
- package/dist/v2/SimpleMenu/Menu.cjs +65 -0
- package/dist/v2/SimpleMenu/Menu.js +89 -0
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +1 -33
- package/dist/v2/SimpleMenu/SimpleMenu.js +25 -177
- package/dist/v2/SimpleMenu/index.cjs +1 -1
- package/dist/v2/SimpleMenu/index.js +5 -3
- package/dist/v2/SubNav/SubNav.cjs +5 -5
- package/dist/v2/SubNav/SubNav.js +8 -13
- package/dist/v2/SubNav/SubNavHeader.cjs +3 -3
- package/dist/v2/SubNav/SubNavHeader.js +33 -70
- package/dist/v2/SubNav/SubNavLink.cjs +5 -5
- package/dist/v2/SubNav/SubNavLink.js +21 -49
- package/dist/v2/SubNav/SubNavLinkSection.cjs +4 -4
- package/dist/v2/SubNav/SubNavLinkSection.js +16 -24
- package/dist/v2/SubNav/SubNavSection.cjs +2 -2
- package/dist/v2/SubNav/SubNavSection.js +14 -46
- package/dist/v2/SubNav/SubNavSectionLabel.cjs +3 -3
- package/dist/v2/SubNav/SubNavSectionLabel.js +11 -36
- package/dist/v2/SubNav/SubNavSections.cjs +1 -1
- package/dist/v2/SubNav/SubNavSections.js +5 -18
- package/dist/v2/SubNav/index.cjs +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.js +53 -51
- package/package.json +23 -35
- package/dist/Combobox/components.cjs +0 -53
- package/dist/Combobox/components.js +0 -64
- package/dist/Combobox/utils.cjs +0 -1
- package/dist/Combobox/utils.js +0 -78
- package/dist/DatePicker/DatePickerCalendar.cjs +0 -1
- package/dist/DatePicker/DatePickerCalendar.js +0 -142
- package/dist/DatePicker/DatePickerTd.cjs +0 -19
- package/dist/DatePicker/DatePickerTd.js +0 -61
- package/dist/DatePicker/DatePickerTh.cjs +0 -9
- package/dist/DatePicker/DatePickerTh.js +0 -42
- package/dist/DatePicker/compareDates.cjs +0 -1
- package/dist/DatePicker/compareDates.js +0 -4
- package/dist/DatePicker/components.cjs +0 -33
- package/dist/DatePicker/components.js +0 -43
- package/dist/DatePicker/utils/formatDate.cjs +0 -1
- package/dist/DatePicker/utils/formatDate.js +0 -4
- package/dist/DatePicker/utils/generateWeeks.cjs +0 -1
- package/dist/DatePicker/utils/generateWeeks.js +0 -17
- package/dist/DatePicker/utils/getDayOfWeek.cjs +0 -1
- package/dist/DatePicker/utils/getDayOfWeek.js +0 -15
- package/dist/DatePicker/utils/getMonths.cjs +0 -1
- package/dist/DatePicker/utils/getMonths.js +0 -7
- package/dist/DatePicker/utils/getYears.cjs +0 -1
- package/dist/DatePicker/utils/getYears.js +0 -9
- package/dist/DatePicker/utils/index.cjs +0 -1
- package/dist/DatePicker/utils/index.js +0 -12
- package/dist/DismissibleLayer/DismissibleLayer.cjs +0 -1
- package/dist/DismissibleLayer/DismissibleLayer.js +0 -30
- package/dist/Grid/GridContext.cjs +0 -1
- package/dist/Grid/GridContext.js +0 -6
- package/dist/Select/SelectButton.cjs +0 -19
- package/dist/Select/SelectButton.js +0 -69
- package/dist/Select/SelectTags.cjs +0 -6
- package/dist/Select/SelectTags.js +0 -38
- package/dist/Select/components.cjs +0 -39
- package/dist/Select/components.js +0 -48
- package/dist/Select/constants.cjs +0 -1
- package/dist/Select/constants.js +0 -8
- package/dist/Select/hooks/useButtonRef.cjs +0 -1
- package/dist/Select/hooks/useButtonRef.js +0 -13
- package/dist/Select/hooks/useListRef.cjs +0 -1
- package/dist/Select/hooks/useListRef.js +0 -18
- package/dist/Select/utils.cjs +0 -1
- package/dist/Select/utils.js +0 -17
- package/dist/Tabs/useTabsFocus.cjs +0 -1
- package/dist/Tabs/useTabsFocus.js +0 -17
- package/dist/Textarea/TextareaInput.cjs +0 -30
- package/dist/Textarea/TextareaInput.js +0 -70
- package/dist/helpers/arrays.cjs +0 -1
- package/dist/helpers/arrays.js +0 -6
- package/dist/helpers/escapeSelector.cjs +0 -1
- package/dist/helpers/escapeSelector.js +0 -4
- package/dist/v2/SimpleMenu/utils.cjs +0 -12
- package/dist/v2/SimpleMenu/utils.js +0 -15
- /package/dist/BaseCheckbox/assets/{checkmark-black.cjs → checkmark-black.svg.cjs} +0 -0
- /package/dist/BaseCheckbox/assets/{checkmark-black.js → checkmark-black.svg.js} +0 -0
- /package/dist/BaseCheckbox/assets/{checkmark.cjs → checkmark.svg.cjs} +0 -0
- /package/dist/BaseCheckbox/assets/{checkmark.js → checkmark.svg.js} +0 -0
- /package/dist/Loader/assets/{loader.cjs → loader.svg.cjs} +0 -0
- /package/dist/Loader/assets/{loader.js → loader.svg.js} +0 -0
- /package/dist/Pagination/assets/{next.cjs → next.svg.cjs} +0 -0
- /package/dist/Pagination/assets/{next.js → next.svg.js} +0 -0
- /package/dist/Pagination/assets/{previous.cjs → previous.svg.cjs} +0 -0
- /package/dist/Pagination/assets/{previous.js → previous.svg.js} +0 -0
- /package/dist/v2/Pagination/assets/{next.cjs → next.svg.cjs} +0 -0
- /package/dist/v2/Pagination/assets/{next.js → next.svg.js} +0 -0
- /package/dist/v2/Pagination/assets/{previous.cjs → previous.svg.cjs} +0 -0
- /package/dist/v2/Pagination/assets/{previous.js → previous.svg.js} +0 -0
package/dist/Select/Select.js
CHANGED
|
@@ -1,209 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { FieldHint as he } from "../Field/FieldHint.js";
|
|
16
|
-
import { FieldError as Ee } from "../Field/FieldError.js";
|
|
17
|
-
import "../Field/FieldContext.js";
|
|
18
|
-
import "../Field/FieldAction.js";
|
|
19
|
-
import { Flex as g } from "../Flex/Flex.js";
|
|
20
|
-
import { escapeSelector as _ } from "../helpers/escapeSelector.js";
|
|
21
|
-
import { useId as be } from "../hooks/useId.js";
|
|
22
|
-
import { Popover as ge } from "../Popover/Popover.js";
|
|
23
|
-
import { sizes as ye } from "../themes/sizes.js";
|
|
24
|
-
import { Typography as q } from "../Typography/Typography.js";
|
|
25
|
-
import { VisuallyHidden as z } from "../VisuallyHidden/VisuallyHidden.js";
|
|
26
|
-
const Be = ne(g)`
|
|
27
|
-
width: 100%;
|
|
28
|
-
`, G = ({
|
|
29
|
-
label: m,
|
|
30
|
-
labelAction: H,
|
|
31
|
-
id: W,
|
|
32
|
-
children: N,
|
|
33
|
-
customizeContent: f,
|
|
34
|
-
placeholder: y,
|
|
35
|
-
onChange: B,
|
|
36
|
-
value: o,
|
|
37
|
-
hint: I,
|
|
38
|
-
error: d,
|
|
39
|
-
disabled: s,
|
|
40
|
-
clearLabel: C,
|
|
41
|
-
onClear: S,
|
|
42
|
-
onReachEnd: J,
|
|
43
|
-
multi: i,
|
|
44
|
-
required: x,
|
|
45
|
-
selectButtonTitle: K,
|
|
46
|
-
size: Q,
|
|
47
|
-
startIcon: $,
|
|
48
|
-
withTags: u,
|
|
49
|
-
...U
|
|
50
|
-
}) => {
|
|
51
|
-
const n = be(W), [h, E] = ee(void 0), R = pe(h), w = te(null), D = `${n}-label`, b = `${n}-content`, X = typeof d == "string";
|
|
52
|
-
let O;
|
|
53
|
-
if (d ? O = `${n}-error` : I && (O = `${n}-hint`), u && !i)
|
|
54
|
-
throw new Error('The "withTags" props can only be used when the "multi" prop is present');
|
|
55
|
-
const Y = () => {
|
|
56
|
-
E(void 0);
|
|
57
|
-
}, Z = () => {
|
|
58
|
-
s || (S(), R.current.focus());
|
|
59
|
-
}, L = (t) => {
|
|
60
|
-
t.preventDefault(), !s && (t.nativeEvent.which === 3 || t.nativeEvent.button === 2 || E(ae.Mouse));
|
|
61
|
-
}, T = (t, l = !0) => {
|
|
62
|
-
i ? B(o.includes(t) ? o.filter((a) => a !== t) : [...o, t]) : (B(t), l && E(void 0));
|
|
63
|
-
}, F = (t) => {
|
|
64
|
-
B(
|
|
65
|
-
o.includes(t[0]) ? o.filter((l, a, c) => c.indexOf(l) < 0, t) : [...o, ...t]
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
let v, M = [];
|
|
69
|
-
const j = (t, l) => {
|
|
70
|
-
const a = `${n}-option-${t.props.value}`, c = i ? o.includes(t.props.value) : t.props.value === o;
|
|
71
|
-
return c && (u ? M.push({ label: t.props.children, value: t.props.value }) : v = t.props.children), A(t, {
|
|
72
|
-
id: _(a),
|
|
73
|
-
onClick: () => T(t.props.value),
|
|
74
|
-
selected: c,
|
|
75
|
-
multi: i,
|
|
76
|
-
isChild: l
|
|
77
|
-
});
|
|
78
|
-
}, V = k.toArray(N).map((t) => {
|
|
79
|
-
if (t.type.displayName === "OptGroup") {
|
|
80
|
-
const l = `${n}-option-${t.props.label}`, a = t.props.children.every((p) => o.includes(p.props.value)), c = !a && t.props.children.some((p) => o.includes(p.props.value));
|
|
81
|
-
return A(t, {
|
|
82
|
-
id: _(l),
|
|
83
|
-
onClick: () => F(t.props.children.map((p) => p.props.value)),
|
|
84
|
-
selected: a,
|
|
85
|
-
indeterminate: c,
|
|
86
|
-
multi: i,
|
|
87
|
-
children: k.toArray(t.props.children).map((p) => j(p, !0)),
|
|
88
|
-
value: t.props.label
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return j(t);
|
|
92
|
-
});
|
|
93
|
-
return /* @__PURE__ */ r.createElement(fe, { hint: I, error: d, id: n, required: x }, /* @__PURE__ */ r.createElement(g, { direction: "column", alignItems: "stretch", gap: m || I || X ? 1 : 0 }, m && /* @__PURE__ */ r.createElement(ue, { action: H }, m), /* @__PURE__ */ r.createElement(ie, { size: Q, hasError: Boolean(d), disabled: s, ref: w }, /* @__PURE__ */ r.createElement(
|
|
94
|
-
ce,
|
|
95
|
-
{
|
|
96
|
-
ref: R,
|
|
97
|
-
labelledBy: `${n} ${D} ${b}`,
|
|
98
|
-
"aria-describedby": O,
|
|
99
|
-
"aria-required": x,
|
|
100
|
-
expanded: Boolean(h),
|
|
101
|
-
onTrigger: E,
|
|
102
|
-
id: n,
|
|
103
|
-
hasError: Boolean(d),
|
|
104
|
-
disabled: s,
|
|
105
|
-
onMouseDown: L,
|
|
106
|
-
value: i ? o.join(",") : o,
|
|
107
|
-
...U
|
|
108
|
-
}
|
|
109
|
-
), /* @__PURE__ */ r.createElement(Be, { justifyContent: "space-between" }, /* @__PURE__ */ r.createElement(g, null, $ && /* @__PURE__ */ r.createElement(P, { paddingLeft: 3, "aria-hidden": !0 }, $), u && /* @__PURE__ */ r.createElement(me, { tags: M, onRemoveTag: T, disabled: s }), /* @__PURE__ */ r.createElement(P, { paddingLeft: 4, paddingRight: 4 }, u ? /* @__PURE__ */ r.createElement(r.Fragment, null, !o || o.length === 0 ? /* @__PURE__ */ r.createElement(q, { ellipsis: !0, id: b, textColor: "neutral600" }, y) : null, /* @__PURE__ */ r.createElement(z, { as: "span", id: b }, f ? f(o) : v || y, o.join(", "))) : /* @__PURE__ */ r.createElement(q, { ellipsis: !0, id: b, textColor: o ? "neutral800" : "neutral600" }, f ? f(o) : v || y, i && /* @__PURE__ */ r.createElement(z, { as: "span" }, o.join(", "))))), /* @__PURE__ */ r.createElement(g, null, (i && o && o.length || !i && o) && S && /* @__PURE__ */ r.createElement(
|
|
110
|
-
le,
|
|
111
|
-
{
|
|
112
|
-
as: "button",
|
|
113
|
-
type: "button",
|
|
114
|
-
onClick: Z,
|
|
115
|
-
"aria-label": C,
|
|
116
|
-
"aria-disabled": s,
|
|
117
|
-
title: C
|
|
118
|
-
},
|
|
119
|
-
/* @__PURE__ */ r.createElement(re, null)
|
|
120
|
-
), /* @__PURE__ */ r.createElement(
|
|
121
|
-
se,
|
|
122
|
-
{
|
|
123
|
-
paddingLeft: 3,
|
|
124
|
-
"aria-hidden": !0,
|
|
125
|
-
as: "button",
|
|
126
|
-
type: "button",
|
|
127
|
-
onMouseDown: L,
|
|
128
|
-
tabIndex: -1,
|
|
129
|
-
disabled: s,
|
|
130
|
-
title: K
|
|
131
|
-
},
|
|
132
|
-
/* @__PURE__ */ r.createElement(oe, null)
|
|
133
|
-
)))), /* @__PURE__ */ r.createElement(he, null), /* @__PURE__ */ r.createElement(Ee, null)), h && /* @__PURE__ */ r.createElement(
|
|
134
|
-
ge,
|
|
135
|
-
{
|
|
136
|
-
source: w,
|
|
137
|
-
spacing: 4,
|
|
138
|
-
fullWidth: !0,
|
|
139
|
-
intersectionId: `select-list-intersection-${n}`,
|
|
140
|
-
onReachEnd: J
|
|
141
|
-
},
|
|
142
|
-
/* @__PURE__ */ r.createElement(
|
|
143
|
-
de,
|
|
144
|
-
{
|
|
145
|
-
selectId: n,
|
|
146
|
-
labelledBy: m ? D : void 0,
|
|
147
|
-
onEscape: Y,
|
|
148
|
-
expanded: h,
|
|
149
|
-
onSelectItem: (t, l) => l ? F(t) : T(t, !1),
|
|
150
|
-
multi: i
|
|
151
|
-
},
|
|
152
|
-
V
|
|
153
|
-
)
|
|
154
|
-
));
|
|
155
|
-
};
|
|
156
|
-
G.defaultProps = {
|
|
157
|
-
"aria-label": void 0,
|
|
158
|
-
children: [],
|
|
159
|
-
clearLabel: "Clear",
|
|
160
|
-
customizeContent: void 0,
|
|
161
|
-
disabled: !1,
|
|
162
|
-
id: void 0,
|
|
163
|
-
label: void 0,
|
|
164
|
-
labelAction: void 0,
|
|
165
|
-
multi: !1,
|
|
166
|
-
onChange() {
|
|
167
|
-
},
|
|
168
|
-
onClear: void 0,
|
|
169
|
-
onReachEnd: void 0,
|
|
170
|
-
value: void 0,
|
|
171
|
-
hint: void 0,
|
|
172
|
-
error: void 0,
|
|
173
|
-
placeholder: "Select...",
|
|
174
|
-
required: !1,
|
|
175
|
-
selectButtonTitle: "Carret Down Button",
|
|
176
|
-
size: "M",
|
|
177
|
-
startIcon: void 0,
|
|
178
|
-
withTags: !1
|
|
179
|
-
};
|
|
180
|
-
G.propTypes = {
|
|
181
|
-
"aria-label": e.string,
|
|
182
|
-
children: e.oneOfType([e.arrayOf(e.node), e.node]),
|
|
183
|
-
clearLabel: e.string,
|
|
184
|
-
customizeContent: e.func,
|
|
185
|
-
disabled: e.bool,
|
|
186
|
-
error: e.oneOfType([e.string, e.bool]),
|
|
187
|
-
hint: e.oneOfType([e.string, e.bool, e.node, e.arrayOf(e.node)]),
|
|
188
|
-
id: e.oneOfType([e.string, e.number]),
|
|
189
|
-
label: e.string,
|
|
190
|
-
labelAction: e.element,
|
|
191
|
-
multi: e.bool,
|
|
192
|
-
onChange: e.func,
|
|
193
|
-
onClear: e.func,
|
|
194
|
-
onReachEnd: e.func,
|
|
195
|
-
placeholder: e.string,
|
|
196
|
-
required: e.bool,
|
|
197
|
-
selectButtonTitle: e.string,
|
|
198
|
-
size: e.oneOf(Object.keys(ye.input)),
|
|
199
|
-
startIcon: e.element,
|
|
200
|
-
value: e.oneOfType([
|
|
201
|
-
e.arrayOf(e.oneOfType([e.string, e.number])),
|
|
202
|
-
e.string,
|
|
203
|
-
e.number
|
|
204
|
-
]),
|
|
205
|
-
withTags: e.bool
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
import { MultiSelect as m } from "./MultiSelect.js";
|
|
4
|
+
import { SingleSelect as c } from "./SingleSelect.js";
|
|
5
|
+
const i = l.createContext({ multi: !1 }), r = () => l.useContext(i);
|
|
6
|
+
/**
|
|
7
|
+
* @preserve
|
|
8
|
+
* @deprecated You should import the specific type of select you want to render
|
|
9
|
+
*
|
|
10
|
+
* e.g. `import { MultiSelect } from '@strapi/design-system';`
|
|
11
|
+
*/
|
|
12
|
+
const x = (t) => {
|
|
13
|
+
const o = l.useMemo(() => ({ multi: !!(t.multi || t.withTags) }), [t.multi, t.withTags]);
|
|
14
|
+
return e(i.Provider, { value: o, children: t.multi || t.withTags ? e(m, { ...t }) : e(c, { ...t }) });
|
|
206
15
|
};
|
|
207
16
|
export {
|
|
208
|
-
|
|
17
|
+
x as Select,
|
|
18
|
+
r as useSelectContext
|
|
209
19
|
};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),A=require("react"),m=require("compute-scroll-into-view"),a=require("../helpers/keyboardKeys.cjs"),v=require("../Flex/Flex.cjs");function q(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,c.get?c:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const p=q(A),g={Keyboard:"down:keyboard",Mouse:"down:mouse"},K={Keyboard:"up:keyboard",Mouse:"up:mouse"};/**
|
|
2
|
+
* @preserve
|
|
3
|
+
* @deprecated This component will be removed in the next major release.
|
|
4
|
+
* If you need a custom listbox I would recommend opening a new issue.
|
|
5
|
+
*/const h=({labelledBy:e,onSelectItem:t,children:n,multi:c=!1,onEscape:r,expanded:d})=>{const o=k(d),S=i=>{switch(i.key){case a.KeyboardKeys.ESCAPE:{i.stopPropagation(),r();break}case a.KeyboardKeys.DOWN:{i.preventDefault();const s=y(o.current);if(!s)return;const u=s.nextSibling;if(u)l(o.current,u);else{const b=o.current.querySelectorAll('[role="option"]')[0];l(o.current,b)}break}case a.KeyboardKeys.UP:{i.preventDefault();const s=y(o.current);if(!s)return;const u=s.previousSibling;if(u)l(o.current,u);else{const f=o.current.querySelectorAll('[role="option"]'),b=f[f.length-1];l(o.current,b)}break}case a.KeyboardKeys.SPACE:case a.KeyboardKeys.ENTER:{i.preventDefault();const s=y(o.current);s.getAttribute("data-opt-group")?t(s.getAttribute("data-opt-group-children").split(","),s.getAttribute("data-opt-group")):t(s.getAttribute("data-strapi-value")),c||r();break}}};return O.jsx(v.Flex,{as:"ul",gap:1,direction:"column",alignItems:"stretch",role:"listbox","aria-labelledby":e,tabIndex:-1,ref:o,onKeyDown:S,onBlur:r,children:n})},l=(e,t)=>{e.setAttribute("aria-activedescendant",t.getAttribute("id")),e.querySelectorAll('[role="option"]').forEach(r=>r.classList.remove("is-focused")),t.classList.add("is-focused"),m.compute(t,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}).forEach(({el:r,top:d,left:o})=>{r.scrollTop=d,r.scrollLeft=o})},k=e=>{const t=p.useRef(null);return p.useEffect(()=>{t.current.focus()},[]),p.useEffect(()=>{if(!t.current)return;const n=t.current.querySelector('[aria-selected="true"]'),c=t.current.querySelectorAll('[role="option"]');let r;n?r=n:e===K.Keyboard?r=c[c.length-1]:e===g.Keyboard&&(r=c[0]),r&&(e===K.Keyboard||e===g.Keyboard)&&l(t.current,r)},[]),t},y=e=>{const t=e.getAttribute("aria-activedescendant");return e.querySelector(`#${t}`)};exports.SelectList=h;
|
|
@@ -1,87 +1,85 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import * as b from "react";
|
|
3
|
+
import { compute as S } from "compute-scroll-into-view";
|
|
4
|
+
import { KeyboardKeys as u } from "../helpers/keyboardKeys.js";
|
|
5
|
+
import { Flex as h } from "../Flex/Flex.js";
|
|
6
|
+
const g = {
|
|
7
|
+
Keyboard: "down:keyboard",
|
|
8
|
+
Mouse: "down:mouse"
|
|
9
|
+
}, m = { Keyboard: "up:keyboard", Mouse: "up:mouse" };
|
|
10
|
+
/**
|
|
11
|
+
* @preserve
|
|
12
|
+
* @deprecated This component will be removed in the next major release.
|
|
13
|
+
* If you need a custom listbox I would recommend opening a new issue.
|
|
14
|
+
*/
|
|
15
|
+
const E = ({ labelledBy: r, onSelectItem: e, children: c, multi: s = !1, onEscape: t, expanded: f }) => {
|
|
16
|
+
const o = K(f);
|
|
17
|
+
return A(h, { as: "ul", gap: 1, direction: "column", alignItems: "stretch", role: "listbox", "aria-labelledby": r, tabIndex: -1, ref: o, onKeyDown: (i) => {
|
|
18
|
+
switch (i.key) {
|
|
19
|
+
case u.ESCAPE: {
|
|
20
|
+
i.stopPropagation(), t();
|
|
13
21
|
break;
|
|
14
22
|
}
|
|
15
|
-
case
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
23
|
+
case u.DOWN: {
|
|
24
|
+
i.preventDefault();
|
|
25
|
+
const n = y(o.current);
|
|
26
|
+
if (!n)
|
|
19
27
|
return;
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
|
|
28
|
+
const a = n.nextSibling;
|
|
29
|
+
if (a)
|
|
30
|
+
l(o.current, a);
|
|
23
31
|
else {
|
|
24
|
-
const
|
|
25
|
-
|
|
32
|
+
const d = o.current.querySelectorAll('[role="option"]')[0];
|
|
33
|
+
l(o.current, d);
|
|
26
34
|
}
|
|
27
35
|
break;
|
|
28
36
|
}
|
|
29
|
-
case
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
37
|
+
case u.UP: {
|
|
38
|
+
i.preventDefault();
|
|
39
|
+
const n = y(o.current);
|
|
40
|
+
if (!n)
|
|
33
41
|
return;
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
|
|
42
|
+
const a = n.previousSibling;
|
|
43
|
+
if (a)
|
|
44
|
+
l(o.current, a);
|
|
37
45
|
else {
|
|
38
|
-
const
|
|
39
|
-
|
|
46
|
+
const p = o.current.querySelectorAll('[role="option"]'), d = p[p.length - 1];
|
|
47
|
+
l(o.current, d);
|
|
40
48
|
}
|
|
41
49
|
break;
|
|
42
50
|
}
|
|
43
|
-
case
|
|
44
|
-
case
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
t.getAttribute("data-opt-group-children").split(","),
|
|
49
|
-
t.getAttribute("data-opt-group")
|
|
50
|
-
) : p(t.getAttribute("data-strapi-value")), d || a();
|
|
51
|
+
case u.SPACE:
|
|
52
|
+
case u.ENTER: {
|
|
53
|
+
i.preventDefault();
|
|
54
|
+
const n = y(o.current);
|
|
55
|
+
n.getAttribute("data-opt-group") ? e(n.getAttribute("data-opt-group-children").split(","), n.getAttribute("data-opt-group")) : e(n.getAttribute("data-strapi-value")), s || t();
|
|
51
56
|
break;
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
m.propTypes = {
|
|
78
|
-
children: r.node.isRequired,
|
|
79
|
-
expanded: r.oneOf([f.Keyboard, f.Mouse, b.Keyboard, b.Mouse]).isRequired,
|
|
80
|
-
labelledBy: r.string,
|
|
81
|
-
multi: r.bool,
|
|
82
|
-
onEscape: r.func.isRequired,
|
|
83
|
-
onSelectItem: r.func.isRequired
|
|
59
|
+
}, onBlur: t, children: c });
|
|
60
|
+
}, l = (r, e) => {
|
|
61
|
+
r.setAttribute("aria-activedescendant", e.getAttribute("id")), r.querySelectorAll('[role="option"]').forEach((t) => t.classList.remove("is-focused")), e.classList.add("is-focused"), S(e, {
|
|
62
|
+
scrollMode: "if-needed",
|
|
63
|
+
block: "nearest",
|
|
64
|
+
inline: "nearest"
|
|
65
|
+
}).forEach(({ el: t, top: f, left: o }) => {
|
|
66
|
+
t.scrollTop = f, t.scrollLeft = o;
|
|
67
|
+
});
|
|
68
|
+
}, K = (r) => {
|
|
69
|
+
const e = b.useRef(null);
|
|
70
|
+
return b.useEffect(() => {
|
|
71
|
+
e.current.focus();
|
|
72
|
+
}, []), b.useEffect(() => {
|
|
73
|
+
if (!e.current)
|
|
74
|
+
return;
|
|
75
|
+
const c = e.current.querySelector('[aria-selected="true"]'), s = e.current.querySelectorAll('[role="option"]');
|
|
76
|
+
let t;
|
|
77
|
+
c ? t = c : r === m.Keyboard ? t = s[s.length - 1] : r === g.Keyboard && (t = s[0]), t && (r === m.Keyboard || r === g.Keyboard) && l(e.current, t);
|
|
78
|
+
}, []), e;
|
|
79
|
+
}, y = (r) => {
|
|
80
|
+
const e = r.getAttribute("aria-activedescendant");
|
|
81
|
+
return r.querySelector(`#${e}`);
|
|
84
82
|
};
|
|
85
83
|
export {
|
|
86
|
-
|
|
84
|
+
E as SelectList
|
|
87
85
|
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),R=require("react"),d=require("@strapi/icons"),o=require("@strapi/ui-primitives"),p=require("styled-components"),j=require("../hooks/useComposeRefs.cjs"),c=require("../Flex/Flex.cjs"),f=require("../Box/Box.cjs"),u=require("../themes/utils.cjs"),g=require("../Typography/Typography.cjs"),I=e=>e&&e.__esModule?e:{default:e};function T(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const a=T(R),l=I(p),v=a.forwardRef(({onClear:e,clearLabel:t="Clear",startIcon:s,disabled:n,hasError:h,size:m="M",children:x,...b},$)=>{const i=a.useRef(null),S=y=>{e&&!n&&(e(y),i.current.focus())},w=j.useComposedRefs(i,$);return r.jsx(o.Select.Trigger,{asChild:!0,children:r.jsxs(q,{"aria-disabled":n,$hasError:h,$size:m,ref:w,alignItems:"center",justifyContent:"space-between",position:"relative",overflow:"hidden",hasRadius:!0,background:n?"neutral150":"neutral0",paddingLeft:3,paddingRight:3,gap:4,cursor:"default",width:"100%",...b,children:[r.jsxs(c.Flex,{flex:"1",as:"span",gap:3,children:[s&&r.jsx(f.Box,{as:"span","aria-hidden":!0,children:s}),x]}),r.jsxs(c.Flex,{as:"span",gap:3,children:[e?r.jsx(C,{as:"button",hasRadius:!0,background:"transparent",role:"button",tabIndex:0,onClick:S,"aria-disabled":n,"aria-label":t,title:t,cursor:"pointer",children:r.jsx(d.Cross,{})}):null,r.jsx(k,{children:r.jsx(d.CarretDown,{})})]})]})})}),C=l.default(f.Box)`
|
|
2
|
+
border: none;
|
|
3
|
+
|
|
4
|
+
svg {
|
|
5
|
+
height: ${11/16}rem;
|
|
6
|
+
width: ${11/16}rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
svg path {
|
|
10
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
11
|
+
}
|
|
12
|
+
`,q=l.default(c.Flex)`
|
|
13
|
+
border: 1px solid ${({theme:e,$hasError:t})=>t?e.colors.danger600:e.colors.neutral200};
|
|
14
|
+
min-height: ${({theme:e,$size:t})=>u.getThemeSize("input")({theme:e,size:t})};
|
|
15
|
+
|
|
16
|
+
&[aria-disabled='true'] {
|
|
17
|
+
color: ${e=>e.theme.colors.neutral600};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Required to ensure the below inputFocusStyles are adhered too */
|
|
21
|
+
&:focus-visible {
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${({theme:e,$hasError:t})=>u.inputFocusStyle()({theme:e,hasError:t})};
|
|
26
|
+
`,k=l.default(o.Select.Icon)`
|
|
27
|
+
& > svg {
|
|
28
|
+
width: ${6/16}rem;
|
|
29
|
+
|
|
30
|
+
& > path {
|
|
31
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`,V=a.forwardRef(({children:e,placeholder:t,...s},n)=>r.jsx(_,{ref:n,ellipsis:!0,...s,children:r.jsx(P,{placeholder:t,children:e})})),_=l.default(g.Typography)`
|
|
35
|
+
flex: 1;
|
|
36
|
+
`,P=l.default(o.Select.Value)`
|
|
37
|
+
display: flex;
|
|
38
|
+
gap: ${({theme:e})=>e.spaces[1]};
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
`,z=l.default(o.Select.Content)`
|
|
41
|
+
background: ${({theme:e})=>e.colors.neutral0};
|
|
42
|
+
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
43
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
44
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
45
|
+
min-width: var(--radix-select-trigger-width);
|
|
46
|
+
/* This is from the design-system figma file. */
|
|
47
|
+
max-height: 15rem;
|
|
48
|
+
z-index: ${({theme:e})=>e.zIndices[1]};
|
|
49
|
+
`,F=l.default(o.Select.Viewport)`
|
|
50
|
+
padding: ${({theme:e})=>e.spaces[1]};
|
|
51
|
+
`,O=a.forwardRef((e,t)=>r.jsx(B,{ref:t,...e})),M=p.css`
|
|
52
|
+
width: 100%;
|
|
53
|
+
border: none;
|
|
54
|
+
text-align: left;
|
|
55
|
+
outline-offset: -3px;
|
|
56
|
+
border-radius: ${e=>e.theme.borderRadius};
|
|
57
|
+
padding: ${e=>`${e.theme.spaces[2]} ${e.theme.spaces[4]}`};
|
|
58
|
+
padding-left: ${({theme:e})=>e.spaces[4]};
|
|
59
|
+
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: ${({theme:e})=>e.spaces[2]};
|
|
63
|
+
white-space: nowrap;
|
|
64
|
+
user-select: none;
|
|
65
|
+
|
|
66
|
+
&:focus-visible {
|
|
67
|
+
outline: none;
|
|
68
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
69
|
+
}
|
|
70
|
+
`,B=l.default(o.Select.Item)`
|
|
71
|
+
${M}
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&[data-state='checked'] {
|
|
78
|
+
${g.Typography} {
|
|
79
|
+
font-weight: bold;
|
|
80
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`,D=o.Select.Root,G=v,E=V,N=o.Select.Portal,A=z,H=F,J=O,K=o.Select.ItemIndicator,L=o.Select.ItemText,Q=o.Select.Group;exports.Content=A;exports.Group=Q;exports.Item=J;exports.ItemIndicator=K;exports.ItemText=L;exports.Portal=N;exports.Root=D;exports.Trigger=G;exports.Value=E;exports.Viewport=H;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { Cross as y, CarretDown as R } from "@strapi/icons";
|
|
4
|
+
import { Select as o } from "@strapi/ui-primitives";
|
|
5
|
+
import s, { css as I } from "styled-components";
|
|
6
|
+
import { useComposedRefs as S } from "../hooks/useComposeRefs.js";
|
|
7
|
+
import { Flex as c } from "../Flex/Flex.js";
|
|
8
|
+
import { Box as p } from "../Box/Box.js";
|
|
9
|
+
import { getThemeSize as C, inputFocusStyle as T } from "../themes/utils.js";
|
|
10
|
+
import { Typography as u } from "../Typography/Typography.js";
|
|
11
|
+
const k = a.forwardRef(({ onClear: e, clearLabel: r = "Clear", startIcon: i, disabled: n, hasError: m, size: h = "M", children: f, ...g }, $) => {
|
|
12
|
+
const d = a.useRef(null), w = (x) => {
|
|
13
|
+
e && !n && (e(x), d.current.focus());
|
|
14
|
+
}, b = S(d, $);
|
|
15
|
+
return t(o.Trigger, { asChild: !0, children: l(V, { "aria-disabled": n, $hasError: m, $size: h, ref: b, alignItems: "center", justifyContent: "space-between", position: "relative", overflow: "hidden", hasRadius: !0, background: n ? "neutral150" : "neutral0", paddingLeft: 3, paddingRight: 3, gap: 4, cursor: "default", width: "100%", ...g, children: [l(c, { flex: "1", as: "span", gap: 3, children: [i && t(p, { as: "span", "aria-hidden": !0, children: i }), f] }), l(c, { as: "span", gap: 3, children: [e ? t(v, { as: "button", hasRadius: !0, background: "transparent", role: "button", tabIndex: 0, onClick: w, "aria-disabled": n, "aria-label": r, title: r, cursor: "pointer", children: t(y, {}) }) : null, t(z, { children: t(R, {}) })] })] }) });
|
|
16
|
+
}), v = s(p)`
|
|
17
|
+
border: none;
|
|
18
|
+
|
|
19
|
+
svg {
|
|
20
|
+
height: ${11 / 16}rem;
|
|
21
|
+
width: ${11 / 16}rem;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
svg path {
|
|
25
|
+
fill: ${({ theme: e }) => e.colors.neutral600};
|
|
26
|
+
}
|
|
27
|
+
`, V = s(c)`
|
|
28
|
+
border: 1px solid ${({ theme: e, $hasError: r }) => r ? e.colors.danger600 : e.colors.neutral200};
|
|
29
|
+
min-height: ${({ theme: e, $size: r }) => C("input")({ theme: e, size: r })};
|
|
30
|
+
|
|
31
|
+
&[aria-disabled='true'] {
|
|
32
|
+
color: ${(e) => e.theme.colors.neutral600};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Required to ensure the below inputFocusStyles are adhered too */
|
|
36
|
+
&:focus-visible {
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
${({ theme: e, $hasError: r }) => T()({ theme: e, hasError: r })};
|
|
41
|
+
`, z = s(o.Icon)`
|
|
42
|
+
& > svg {
|
|
43
|
+
width: ${6 / 16}rem;
|
|
44
|
+
|
|
45
|
+
& > path {
|
|
46
|
+
fill: ${({ theme: e }) => e.colors.neutral600};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`, j = a.forwardRef(({ children: e, placeholder: r, ...i }, n) => t(F, { ref: n, ellipsis: !0, ...i, children: t(B, { placeholder: r, children: e }) })), F = s(u)`
|
|
50
|
+
flex: 1;
|
|
51
|
+
`, B = s(o.Value)`
|
|
52
|
+
display: flex;
|
|
53
|
+
gap: ${({ theme: e }) => e.spaces[1]};
|
|
54
|
+
flex-wrap: wrap;
|
|
55
|
+
`, D = s(o.Content)`
|
|
56
|
+
background: ${({ theme: e }) => e.colors.neutral0};
|
|
57
|
+
box-shadow: ${({ theme: e }) => e.shadows.filterShadow};
|
|
58
|
+
border: 1px solid ${({ theme: e }) => e.colors.neutral150};
|
|
59
|
+
border-radius: ${({ theme: e }) => e.borderRadius};
|
|
60
|
+
min-width: var(--radix-select-trigger-width);
|
|
61
|
+
/* This is from the design-system figma file. */
|
|
62
|
+
max-height: 15rem;
|
|
63
|
+
z-index: ${({ theme: e }) => e.zIndices[1]};
|
|
64
|
+
`, E = s(o.Viewport)`
|
|
65
|
+
padding: ${({ theme: e }) => e.spaces[1]};
|
|
66
|
+
`, G = a.forwardRef((e, r) => t(q, { ref: r, ...e })), P = I`
|
|
67
|
+
width: 100%;
|
|
68
|
+
border: none;
|
|
69
|
+
text-align: left;
|
|
70
|
+
outline-offset: -3px;
|
|
71
|
+
border-radius: ${(e) => e.theme.borderRadius};
|
|
72
|
+
padding: ${(e) => `${e.theme.spaces[2]} ${e.theme.spaces[4]}`};
|
|
73
|
+
padding-left: ${({ theme: e }) => e.spaces[4]};
|
|
74
|
+
background-color: ${({ theme: e }) => e.colors.neutral0};
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: ${({ theme: e }) => e.spaces[2]};
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
user-select: none;
|
|
80
|
+
|
|
81
|
+
&:focus-visible {
|
|
82
|
+
outline: none;
|
|
83
|
+
background-color: ${({ theme: e }) => e.colors.primary100};
|
|
84
|
+
}
|
|
85
|
+
`, q = s(o.Item)`
|
|
86
|
+
${P}
|
|
87
|
+
|
|
88
|
+
&:hover {
|
|
89
|
+
background-color: ${({ theme: e }) => e.colors.primary100};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&[data-state='checked'] {
|
|
93
|
+
${u} {
|
|
94
|
+
font-weight: bold;
|
|
95
|
+
color: ${({ theme: e }) => e.colors.primary600};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`, U = o.Root, W = k, X = j, Y = o.Portal, Z = D, _ = E, ee = G, re = o.ItemIndicator, oe = o.ItemText, te = o.Group;
|
|
99
|
+
export {
|
|
100
|
+
Z as Content,
|
|
101
|
+
te as Group,
|
|
102
|
+
ee as Item,
|
|
103
|
+
re as ItemIndicator,
|
|
104
|
+
oe as ItemText,
|
|
105
|
+
Y as Portal,
|
|
106
|
+
U as Root,
|
|
107
|
+
W as Trigger,
|
|
108
|
+
X as Value,
|
|
109
|
+
_ as Viewport
|
|
110
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),E=require("react"),o=require("./SelectParts.cjs"),V=require("../helpers/strings.cjs"),b=require("../hooks/useId.cjs"),H=require("../hooks/useIntersection.cjs"),q=require("../Box/Box.cjs"),W=require("../Typography/Typography.cjs"),z=require("../Field/Field.cjs"),D=require("../Flex/Flex.cjs"),A=require("../Field/FieldLabel.cjs"),G=require("../Field/FieldHint.cjs"),J=require("../Field/FieldError.cjs");function K(t){if(t&&t.__esModule)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const h=K(E),Q=({error:t,hint:n,id:r,label:i,labelAction:s,required:d,selectButtonTitle:x,...g})=>{const c=b.useId(r),u=h.useRef(null),f=()=>{u.current.focus()};return e.jsx(z.Field,{hint:n,error:t,id:c,required:d,children:e.jsxs(D.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[i?e.jsx(A.FieldLabel,{onClick:f,action:s,children:i}):null,e.jsx(O,{label:i,id:c,triggerRef:u,required:d,...g}),e.jsx(G.FieldHint,{}),e.jsx(J.FieldError,{})]})})},O=({"aria-label":t,id:n,children:r,clearLabel:i="Clear",customizeContent:s,disabled:d,error:x,label:g,onChange:c,onClear:u,onReachEnd:f,placeholder:m,required:y,selectButtonTitle:X,startIcon:F,size:R="M",value:p,triggerRef:T,...B})=>{const[C,j]=h.useState(),[_,$]=h.useState(!1),v=l=>{$(l)},w=l=>{u&&u(l),c||j("")},P=`${n}-hint`,k=`${n}-error`,L=l=>{c?c(typeof p=="number"?Number(l):l):j(l)},S=h.useRef(null),M=b.useId(),I=`intersection-${V.stripReactIdOfColon(M)}`,N=l=>{f&&f(l)};H.useIntersection(S,N,{selectorToWatch:`#${I}`,skipWhen:!_});const a=(typeof p<"u"&&p!==null?p.toString():C)??"";return e.jsxs(o.Root,{onOpenChange:v,disabled:d,required:y,onValueChange:L,value:a,...B,children:[e.jsx(o.Trigger,{ref:T,"aria-label":g??t,"aria-describedby":n?`${P} ${k}`:void 0,id:n,startIcon:F,size:R,hasError:!!x,disabled:d,clearLabel:i,onClear:a&&u?w:void 0,children:e.jsx(o.Value,{placeholder:m,textColor:a?"neutral800":"neutral600",children:a&&s?s(a):void 0})}),e.jsx(o.Portal,{children:e.jsx(o.Content,{position:"popper",sideOffset:4,children:e.jsxs(o.Viewport,{ref:S,children:[r,e.jsx(q.Box,{id:I,width:"100%",height:"1px"})]})})})]})},U=h.forwardRef(({value:t,startIcon:n,children:r,...i},s)=>e.jsxs(o.Item,{ref:s,value:t.toString(),...i,children:[n&&e.jsx(q.Box,{as:"span","aria-hidden":!0,children:n}),e.jsx(W.Typography,{textColor:"neutral800",children:e.jsx(o.ItemText,{children:r})})]}));exports.SingleSelect=Q;exports.SingleSelectInput=O;exports.SingleSelectOption=U;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
|
+
import { Item as q, ItemText as W, Root as _, Trigger as H, Value as M, Portal as P, Content as z, Viewport as A } from "./SelectParts.js";
|
|
4
|
+
import { stripReactIdOfColon as D } from "../helpers/strings.js";
|
|
5
|
+
import { useId as R } from "../hooks/useId.js";
|
|
6
|
+
import { useIntersection as G } from "../hooks/useIntersection.js";
|
|
7
|
+
import { Box as x } from "../Box/Box.js";
|
|
8
|
+
import { Typography as J } from "../Typography/Typography.js";
|
|
9
|
+
import { Field as K } from "../Field/Field.js";
|
|
10
|
+
import { Flex as Q } from "../Flex/Flex.js";
|
|
11
|
+
import { FieldLabel as U } from "../Field/FieldLabel.js";
|
|
12
|
+
import { FieldHint as X } from "../Field/FieldHint.js";
|
|
13
|
+
import { FieldError as Y } from "../Field/FieldError.js";
|
|
14
|
+
const me = ({ error: c, hint: t, id: d, label: n, labelAction: i, required: a, selectButtonTitle: g, ...p }) => {
|
|
15
|
+
const o = R(d), l = u.useRef(null);
|
|
16
|
+
return e(K, { hint: t, error: c, id: o, required: a, children: h(Q, { direction: "column", alignItems: "stretch", gap: 1, children: [n ? e(U, { onClick: () => {
|
|
17
|
+
l.current.focus();
|
|
18
|
+
}, action: i, children: n }) : null, e(Z, { label: n, id: o, triggerRef: l, required: a, ...p }), e(X, {}), e(Y, {})] }) });
|
|
19
|
+
}, Z = ({ "aria-label": c, id: t, children: d, clearLabel: n = "Clear", customizeContent: i, disabled: a, error: g, label: p, onChange: o, onClear: l, onReachEnd: m, placeholder: C, required: B, selectButtonTitle: ee, startIcon: O, size: T = "M", value: f, triggerRef: F, ...$ }) => {
|
|
20
|
+
const [y, I] = u.useState(), [k, w] = u.useState(!1), L = (r) => {
|
|
21
|
+
w(r);
|
|
22
|
+
}, v = (r) => {
|
|
23
|
+
l && l(r), o || I("");
|
|
24
|
+
}, E = `${t}-hint`, N = `${t}-error`, V = (r) => {
|
|
25
|
+
o ? o(typeof f == "number" ? Number(r) : r) : I(r);
|
|
26
|
+
}, b = u.useRef(null), j = R(), S = `intersection-${D(j)}`;
|
|
27
|
+
G(b, (r) => {
|
|
28
|
+
m && m(r);
|
|
29
|
+
}, {
|
|
30
|
+
selectorToWatch: `#${S}`,
|
|
31
|
+
/**
|
|
32
|
+
* We need to know when the select is open because only then will viewportRef
|
|
33
|
+
* not be null. Because it uses a portal that (sensibly) is not mounted 24/7.
|
|
34
|
+
*/
|
|
35
|
+
skipWhen: !k
|
|
36
|
+
});
|
|
37
|
+
const s = (typeof f < "u" && f !== null ? f.toString() : y) ?? "";
|
|
38
|
+
return h(_, { onOpenChange: L, disabled: a, required: B, onValueChange: V, value: s, ...$, children: [e(H, { ref: F, "aria-label": p ?? c, "aria-describedby": t ? `${E} ${N}` : void 0, id: t, startIcon: O, size: T, hasError: !!g, disabled: a, clearLabel: n, onClear: s && l ? v : void 0, children: e(M, { placeholder: C, textColor: s ? "neutral800" : "neutral600", children: s && i ? i(s) : void 0 }) }), e(P, { children: e(z, { position: "popper", sideOffset: 4, children: h(A, { ref: b, children: [d, e(x, { id: S, width: "100%", height: "1px" })] }) }) })] });
|
|
39
|
+
}, ge = u.forwardRef(({ value: c, startIcon: t, children: d, ...n }, i) => h(q, { ref: i, value: c.toString(), ...n, children: [t && e(x, { as: "span", "aria-hidden": !0, children: t }), e(J, { textColor: "neutral800", children: e(W, { children: d }) })] }));
|
|
40
|
+
export {
|
|
41
|
+
me as SingleSelect,
|
|
42
|
+
Z as SingleSelectInput,
|
|
43
|
+
ge as SingleSelectOption
|
|
44
|
+
};
|
package/dist/Select/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./MultiSelectNested.cjs"),e=require("./MultiSelect.cjs"),t=require("./SingleSelect.cjs"),i=require("./Select.cjs"),c=require("./Option.cjs"),S=require("./OptGroup.cjs"),u=require("./SelectList.cjs");exports.MultiSelectNested=l.MultiSelectNested;exports.MultiSelect=e.MultiSelect;exports.MultiSelectGroup=e.MultiSelectGroup;exports.MultiSelectOption=e.MultiSelectOption;exports.SingleSelect=t.SingleSelect;exports.SingleSelectOption=t.SingleSelectOption;exports.Select=i.Select;exports.Option=c.Option;exports.OptGroup=S.OptGroup;exports.SelectList=u.SelectList;
|