@strapi/design-system 0.0.0-3cf3ff39
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/LICENSE +7 -0
- package/README.md +47 -0
- package/dist/Accordion/Accordion.cjs +23 -0
- package/dist/Accordion/Accordion.js +38 -0
- package/dist/Accordion/AccordionContent.cjs +1 -0
- package/dist/Accordion/AccordionContent.js +13 -0
- package/dist/Accordion/AccordionContext.cjs +1 -0
- package/dist/Accordion/AccordionContext.js +12 -0
- package/dist/Accordion/AccordionGroup.cjs +47 -0
- package/dist/Accordion/AccordionGroup.js +60 -0
- package/dist/Accordion/AccordionToggle.cjs +28 -0
- package/dist/Accordion/AccordionToggle.js +53 -0
- package/dist/Accordion/index.cjs +1 -0
- package/dist/Accordion/index.js +11 -0
- package/dist/Accordion/utils.cjs +1 -0
- package/dist/Accordion/utils.js +7 -0
- package/dist/Alert/Alert.cjs +35 -0
- package/dist/Alert/Alert.js +46 -0
- package/dist/Alert/index.cjs +1 -0
- package/dist/Alert/index.js +4 -0
- package/dist/Alert/utils.cjs +1 -0
- package/dist/Alert/utils.js +6 -0
- package/dist/Avatar/Avatar.cjs +18 -0
- package/dist/Avatar/Avatar.js +39 -0
- package/dist/Avatar/AvatarGroup.cjs +5 -0
- package/dist/Avatar/AvatarGroup.js +11 -0
- package/dist/Avatar/constants.cjs +1 -0
- package/dist/Avatar/constants.js +5 -0
- package/dist/Avatar/index.cjs +1 -0
- package/dist/Avatar/index.js +7 -0
- package/dist/Badge/Badge.cjs +4 -0
- package/dist/Badge/Badge.js +14 -0
- package/dist/Badge/index.cjs +1 -0
- package/dist/Badge/index.js +4 -0
- package/dist/BaseButton/BaseButton.cjs +17 -0
- package/dist/BaseButton/BaseButton.js +27 -0
- package/dist/BaseButton/index.cjs +1 -0
- package/dist/BaseButton/index.js +5 -0
- package/dist/BaseCheckbox/BaseCheckbox.cjs +62 -0
- package/dist/BaseCheckbox/BaseCheckbox.js +80 -0
- package/dist/BaseCheckbox/assets/checkmark-black.svg.cjs +1 -0
- package/dist/BaseCheckbox/assets/checkmark-black.svg.js +4 -0
- package/dist/BaseCheckbox/assets/checkmark.svg.cjs +1 -0
- package/dist/BaseCheckbox/assets/checkmark.svg.js +4 -0
- package/dist/BaseCheckbox/index.cjs +1 -0
- package/dist/BaseCheckbox/index.js +4 -0
- package/dist/BaseCheckbox/utils.cjs +1 -0
- package/dist/BaseCheckbox/utils.js +4 -0
- package/dist/BaseLink/BaseLink.cjs +1 -0
- package/dist/BaseLink/BaseLink.js +8 -0
- package/dist/BaseLink/index.cjs +1 -0
- package/dist/BaseLink/index.js +4 -0
- package/dist/BaseRadio/BaseRadio.cjs +31 -0
- package/dist/BaseRadio/BaseRadio.js +58 -0
- package/dist/BaseRadio/RadioGroup.cjs +1 -0
- package/dist/BaseRadio/RadioGroup.js +15 -0
- package/dist/BaseRadio/context.cjs +1 -0
- package/dist/BaseRadio/context.js +10 -0
- package/dist/BaseRadio/index.cjs +1 -0
- package/dist/BaseRadio/index.js +6 -0
- package/dist/BaseRadio/utils.cjs +1 -0
- package/dist/BaseRadio/utils.js +6 -0
- package/dist/Box/Box.cjs +79 -0
- package/dist/Box/Box.js +95 -0
- package/dist/Box/index.cjs +1 -0
- package/dist/Box/index.js +4 -0
- package/dist/Breadcrumbs/Breadcrumbs.cjs +16 -0
- package/dist/Breadcrumbs/Breadcrumbs.js +30 -0
- package/dist/Breadcrumbs/index.cjs +1 -0
- package/dist/Breadcrumbs/index.js +5 -0
- package/dist/Button/Button.cjs +31 -0
- package/dist/Button/Button.js +51 -0
- package/dist/Button/constants.cjs +1 -0
- package/dist/Button/constants.js +14 -0
- package/dist/Button/index.cjs +1 -0
- package/dist/Button/index.js +5 -0
- package/dist/Button/utils.cjs +87 -0
- package/dist/Button/utils.js +112 -0
- package/dist/Card/Card.cjs +1 -0
- package/dist/Card/Card.js +12 -0
- package/dist/Card/CardAction.cjs +6 -0
- package/dist/Card/CardAction.js +20 -0
- package/dist/Card/CardAsset.cjs +19 -0
- package/dist/Card/CardAsset.js +28 -0
- package/dist/Card/CardBadge.cjs +6 -0
- package/dist/Card/CardBadge.js +12 -0
- package/dist/Card/CardBody.cjs +1 -0
- package/dist/Card/CardBody.js +7 -0
- package/dist/Card/CardCheckbox.cjs +1 -0
- package/dist/Card/CardCheckbox.js +14 -0
- package/dist/Card/CardContent.cjs +3 -0
- package/dist/Card/CardContent.js +9 -0
- package/dist/Card/CardContext.cjs +1 -0
- package/dist/Card/CardContext.js +6 -0
- package/dist/Card/CardHeader.cjs +3 -0
- package/dist/Card/CardHeader.js +9 -0
- package/dist/Card/CardTimer.cjs +1 -0
- package/dist/Card/CardTimer.js +7 -0
- package/dist/Card/CardTitle.cjs +1 -0
- package/dist/Card/CardTitle.js +11 -0
- package/dist/Card/index.cjs +1 -0
- package/dist/Card/index.js +23 -0
- package/dist/CarouselInput/Carousel.cjs +13 -0
- package/dist/CarouselInput/Carousel.js +40 -0
- package/dist/CarouselInput/CarouselActions.cjs +1 -0
- package/dist/CarouselInput/CarouselActions.js +6 -0
- package/dist/CarouselInput/CarouselImage.cjs +3 -0
- package/dist/CarouselInput/CarouselImage.js +17 -0
- package/dist/CarouselInput/CarouselInput.cjs +1 -0
- package/dist/CarouselInput/CarouselInput.js +15 -0
- package/dist/CarouselInput/CarouselSlide.cjs +1 -0
- package/dist/CarouselInput/CarouselSlide.js +6 -0
- package/dist/CarouselInput/index.cjs +1 -0
- package/dist/CarouselInput/index.js +12 -0
- package/dist/Checkbox/Checkbox.cjs +7 -0
- package/dist/Checkbox/Checkbox.js +28 -0
- package/dist/Checkbox/index.cjs +1 -0
- package/dist/Checkbox/index.js +4 -0
- package/dist/Combobox/Combobox.cjs +107 -0
- package/dist/Combobox/Combobox.js +175 -0
- package/dist/Combobox/ComboboxList.cjs +5 -0
- package/dist/Combobox/ComboboxList.js +10 -0
- package/dist/Combobox/ComboboxOption.cjs +1 -0
- package/dist/Combobox/ComboboxOption.js +5 -0
- package/dist/Combobox/index.cjs +1 -0
- package/dist/Combobox/index.js +7 -0
- package/dist/DatePicker/DatePicker.cjs +88 -0
- package/dist/DatePicker/DatePicker.js +397 -0
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -0
- package/dist/DatePicker/DatePickerCalendar.js +43 -0
- package/dist/DatePicker/DatePickerTd.cjs +19 -0
- package/dist/DatePicker/DatePickerTd.js +29 -0
- package/dist/DatePicker/DatePickerTh.cjs +9 -0
- package/dist/DatePicker/DatePickerTh.js +18 -0
- package/dist/DatePicker/compareDates.cjs +1 -0
- package/dist/DatePicker/compareDates.js +4 -0
- package/dist/DatePicker/components.cjs +39 -0
- package/dist/DatePicker/components.js +53 -0
- package/dist/DatePicker/index.cjs +1 -0
- package/dist/DatePicker/index.js +4 -0
- package/dist/DatePicker/utils/formatDate.cjs +1 -0
- package/dist/DatePicker/utils/formatDate.js +4 -0
- package/dist/DatePicker/utils/generateWeeks.cjs +1 -0
- package/dist/DatePicker/utils/generateWeeks.js +17 -0
- package/dist/DatePicker/utils/getDayOfWeek.cjs +1 -0
- package/dist/DatePicker/utils/getDayOfWeek.js +15 -0
- package/dist/DatePicker/utils/getMonths.cjs +1 -0
- package/dist/DatePicker/utils/getMonths.js +7 -0
- package/dist/DatePicker/utils/getYears.cjs +1 -0
- package/dist/DatePicker/utils/getYears.js +9 -0
- package/dist/DatePicker/utils/index.cjs +1 -0
- package/dist/DatePicker/utils/index.js +12 -0
- package/dist/DateTimePicker/DateTimePicker.cjs +5 -0
- package/dist/DateTimePicker/DateTimePicker.js +91 -0
- package/dist/DateTimePicker/index.cjs +1 -0
- package/dist/DateTimePicker/index.js +5 -0
- package/dist/DateTimePicker/parseDate.cjs +1 -0
- package/dist/DateTimePicker/parseDate.js +8 -0
- package/dist/DesignSystemProvider.cjs +1 -0
- package/dist/DesignSystemProvider.js +10 -0
- package/dist/Dialog/Dialog.cjs +11 -0
- package/dist/Dialog/Dialog.js +31 -0
- package/dist/Dialog/DialogBody.cjs +10 -0
- package/dist/Dialog/DialogBody.js +17 -0
- package/dist/Dialog/DialogFooter.cjs +9 -0
- package/dist/Dialog/DialogFooter.js +16 -0
- package/dist/Dialog/index.cjs +1 -0
- package/dist/Dialog/index.js +8 -0
- package/dist/DismissibleLayer/index.cjs +1 -0
- package/dist/DismissibleLayer/index.js +5 -0
- package/dist/Divider/Divider.cjs +7 -0
- package/dist/Divider/Divider.js +13 -0
- package/dist/Divider/index.cjs +1 -0
- package/dist/Divider/index.js +4 -0
- package/dist/EmptyStateLayout/EmptyStateLayout.cjs +5 -0
- package/dist/EmptyStateLayout/EmptyStateLayout.js +13 -0
- package/dist/EmptyStateLayout/index.cjs +1 -0
- package/dist/EmptyStateLayout/index.js +4 -0
- package/dist/EmptyStateLayout/story-assets/Illo.cjs +1 -0
- package/dist/EmptyStateLayout/story-assets/Illo.js +5 -0
- package/dist/Field/Field.cjs +1 -0
- package/dist/Field/Field.js +12 -0
- package/dist/Field/FieldAction.cjs +4 -0
- package/dist/Field/FieldAction.js +16 -0
- package/dist/Field/FieldContext.cjs +1 -0
- package/dist/Field/FieldContext.js +6 -0
- package/dist/Field/FieldError.cjs +1 -0
- package/dist/Field/FieldError.js +10 -0
- package/dist/Field/FieldHint.cjs +1 -0
- package/dist/Field/FieldHint.js +10 -0
- package/dist/Field/FieldInput.cjs +41 -0
- package/dist/Field/FieldInput.js +63 -0
- package/dist/Field/FieldLabel.cjs +12 -0
- package/dist/Field/FieldLabel.js +25 -0
- package/dist/Field/index.cjs +1 -0
- package/dist/Field/index.js +18 -0
- package/dist/Flex/Flex.cjs +9 -0
- package/dist/Flex/Flex.js +19 -0
- package/dist/Flex/index.cjs +1 -0
- package/dist/Flex/index.js +4 -0
- package/dist/FocusTrap/FocusTrap.cjs +1 -0
- package/dist/FocusTrap/FocusTrap.js +33 -0
- package/dist/FocusTrap/index.cjs +1 -0
- package/dist/FocusTrap/index.js +4 -0
- package/dist/Grid/Grid.cjs +5 -0
- package/dist/Grid/Grid.js +26 -0
- package/dist/Grid/GridContext.cjs +1 -0
- package/dist/Grid/GridContext.js +6 -0
- package/dist/Grid/GridItem.cjs +12 -0
- package/dist/Grid/GridItem.js +34 -0
- package/dist/Grid/index.cjs +1 -0
- package/dist/Grid/index.js +6 -0
- package/dist/Icon/Icon.cjs +6 -0
- package/dist/Icon/Icon.js +15 -0
- package/dist/Icon/index.cjs +1 -0
- package/dist/Icon/index.js +4 -0
- package/dist/IconButton/IconButton.cjs +81 -0
- package/dist/IconButton/IconButton.js +101 -0
- package/dist/IconButton/index.cjs +1 -0
- package/dist/IconButton/index.js +5 -0
- package/dist/JSONInput/JSONInput.cjs +1 -0
- package/dist/JSONInput/JSONInput.js +64 -0
- package/dist/JSONInput/JSONInputContainer.cjs +33 -0
- package/dist/JSONInput/JSONInputContainer.js +39 -0
- package/dist/JSONInput/index.cjs +1 -0
- package/dist/JSONInput/index.js +4 -0
- package/dist/JSONInput/utils/decorationExtension.cjs +1 -0
- package/dist/JSONInput/utils/decorationExtension.js +27 -0
- package/dist/KeyboardNavigable/KeyboardNavigable.cjs +1 -0
- package/dist/KeyboardNavigable/KeyboardNavigable.js +46 -0
- package/dist/KeyboardNavigable/index.cjs +1 -0
- package/dist/KeyboardNavigable/index.js +4 -0
- package/dist/Layout/ActionLayout.cjs +9 -0
- package/dist/Layout/ActionLayout.js +29 -0
- package/dist/Layout/ContentLayout.cjs +1 -0
- package/dist/Layout/ContentLayout.js +11 -0
- package/dist/Layout/GridLayout.cjs +5 -0
- package/dist/Layout/GridLayout.js +13 -0
- package/dist/Layout/HeaderLayout.cjs +4 -0
- package/dist/Layout/HeaderLayout.js +127 -0
- package/dist/Layout/Layout.cjs +6 -0
- package/dist/Layout/Layout.js +24 -0
- package/dist/Layout/TwoColsLayout.cjs +1 -0
- package/dist/Layout/TwoColsLayout.js +17 -0
- package/dist/Layout/index.cjs +1 -0
- package/dist/Layout/index.js +15 -0
- package/dist/Link/Link.cjs +33 -0
- package/dist/Link/Link.js +44 -0
- package/dist/Link/index.cjs +1 -0
- package/dist/Link/index.js +4 -0
- package/dist/LinkButton/LinkButton.cjs +15 -0
- package/dist/LinkButton/LinkButton.js +29 -0
- package/dist/LinkButton/index.cjs +1 -0
- package/dist/LinkButton/index.js +4 -0
- package/dist/LiveRegions/LiveRegions.cjs +1 -0
- package/dist/LiveRegions/LiveRegions.js +7 -0
- package/dist/LiveRegions/constants.cjs +1 -0
- package/dist/LiveRegions/constants.js +8 -0
- package/dist/LiveRegions/index.cjs +1 -0
- package/dist/LiveRegions/index.js +6 -0
- package/dist/LiveRegions/useNotifyAT.cjs +1 -0
- package/dist/LiveRegions/useNotifyAT.js +17 -0
- package/dist/Loader/Loader.cjs +12 -0
- package/dist/Loader/Loader.js +20 -0
- package/dist/Loader/assets/loader.svg.cjs +1 -0
- package/dist/Loader/assets/loader.svg.js +4 -0
- package/dist/Loader/index.cjs +1 -0
- package/dist/Loader/index.js +4 -0
- package/dist/Main/Main.cjs +6 -0
- package/dist/Main/Main.js +12 -0
- package/dist/Main/SkipToContent.cjs +8 -0
- package/dist/Main/SkipToContent.js +14 -0
- package/dist/Main/index.cjs +1 -0
- package/dist/Main/index.js +6 -0
- package/dist/MainNav/MainNav.cjs +4 -0
- package/dist/MainNav/MainNav.js +33 -0
- package/dist/MainNav/MainNavContext.cjs +1 -0
- package/dist/MainNav/MainNavContext.js +6 -0
- package/dist/MainNav/NavBrand.cjs +12 -0
- package/dist/MainNav/NavBrand.js +49 -0
- package/dist/MainNav/NavCondense.cjs +20 -0
- package/dist/MainNav/NavCondense.js +40 -0
- package/dist/MainNav/NavFooter.cjs +1 -0
- package/dist/MainNav/NavFooter.js +12 -0
- package/dist/MainNav/NavLink.cjs +69 -0
- package/dist/MainNav/NavLink.js +103 -0
- package/dist/MainNav/NavSection.cjs +1 -0
- package/dist/MainNav/NavSection.js +46 -0
- package/dist/MainNav/NavSections.cjs +4 -0
- package/dist/MainNav/NavSections.js +26 -0
- package/dist/MainNav/NavUser.cjs +3 -0
- package/dist/MainNav/NavUser.js +32 -0
- package/dist/MainNav/index.cjs +1 -0
- package/dist/MainNav/index.js +18 -0
- package/dist/ModalLayout/ModalBody.cjs +4 -0
- package/dist/ModalLayout/ModalBody.js +10 -0
- package/dist/ModalLayout/ModalContext.cjs +1 -0
- package/dist/ModalLayout/ModalContext.js +7 -0
- package/dist/ModalLayout/ModalFooter.cjs +4 -0
- package/dist/ModalLayout/ModalFooter.js +11 -0
- package/dist/ModalLayout/ModalHeader.cjs +4 -0
- package/dist/ModalLayout/ModalHeader.js +17 -0
- package/dist/ModalLayout/ModalLayout.cjs +4 -0
- package/dist/ModalLayout/ModalLayout.js +16 -0
- package/dist/ModalLayout/index.cjs +1 -0
- package/dist/ModalLayout/index.js +10 -0
- package/dist/NumberInput/NumberInput.cjs +12 -0
- package/dist/NumberInput/NumberInput.js +79 -0
- package/dist/NumberInput/index.cjs +1 -0
- package/dist/NumberInput/index.js +4 -0
- package/dist/Pagination/Pagination.cjs +1 -0
- package/dist/Pagination/Pagination.js +12 -0
- package/dist/Pagination/PaginationContext.cjs +1 -0
- package/dist/Pagination/PaginationContext.js +6 -0
- package/dist/Pagination/assets/next.svg.cjs +1 -0
- package/dist/Pagination/assets/next.svg.js +4 -0
- package/dist/Pagination/assets/previous.svg.cjs +1 -0
- package/dist/Pagination/assets/previous.svg.js +4 -0
- package/dist/Pagination/components.cjs +33 -0
- package/dist/Pagination/components.js +67 -0
- package/dist/Pagination/index.cjs +1 -0
- package/dist/Pagination/index.js +9 -0
- package/dist/Popover/Popover.cjs +25 -0
- package/dist/Popover/Popover.js +127 -0
- package/dist/Popover/index.cjs +1 -0
- package/dist/Popover/index.js +7 -0
- package/dist/Popover/primitives.cjs +1 -0
- package/dist/Popover/primitives.js +5 -0
- package/dist/Portal/Portal.cjs +1 -0
- package/dist/Portal/Portal.js +9 -0
- package/dist/Portal/index.cjs +1 -0
- package/dist/Portal/index.js +4 -0
- package/dist/ProgressBar/ProgressBar.cjs +11 -0
- package/dist/ProgressBar/ProgressBar.js +17 -0
- package/dist/ProgressBar/index.cjs +1 -0
- package/dist/ProgressBar/index.js +4 -0
- package/dist/Radio/Radio.cjs +1 -0
- package/dist/Radio/Radio.js +8 -0
- package/dist/Radio/index.cjs +1 -0
- package/dist/Radio/index.js +6 -0
- package/dist/RawTable/RawCell.cjs +1 -0
- package/dist/RawTable/RawCell.js +60 -0
- package/dist/RawTable/RawTable.cjs +1 -0
- package/dist/RawTable/RawTable.js +53 -0
- package/dist/RawTable/RawTableContext.cjs +1 -0
- package/dist/RawTable/RawTableContext.js +12 -0
- package/dist/RawTable/RawTbody.cjs +1 -0
- package/dist/RawTable/RawTbody.js +9 -0
- package/dist/RawTable/RawThead.cjs +1 -0
- package/dist/RawTable/RawThead.js +9 -0
- package/dist/RawTable/RawTr.cjs +1 -0
- package/dist/RawTable/RawTr.js +13 -0
- package/dist/RawTable/focusFocusable.cjs +1 -0
- package/dist/RawTable/focusFocusable.js +7 -0
- package/dist/RawTable/index.cjs +1 -0
- package/dist/RawTable/index.js +13 -0
- package/dist/Searchbar/SearchForm.cjs +1 -0
- package/dist/Searchbar/SearchForm.js +5 -0
- package/dist/Searchbar/Searchbar.cjs +28 -0
- package/dist/Searchbar/Searchbar.js +47 -0
- package/dist/Searchbar/index.cjs +1 -0
- package/dist/Searchbar/index.js +6 -0
- package/dist/Select/MultiSelect.cjs +30 -0
- package/dist/Select/MultiSelect.js +75 -0
- package/dist/Select/MultiSelectNested.cjs +3 -0
- package/dist/Select/MultiSelectNested.js +9 -0
- package/dist/Select/OptGroup.cjs +5 -0
- package/dist/Select/OptGroup.js +10 -0
- package/dist/Select/Option.cjs +5 -0
- package/dist/Select/Option.js +16 -0
- package/dist/Select/Select.cjs +6 -0
- package/dist/Select/Select.js +19 -0
- package/dist/Select/SelectList.cjs +5 -0
- package/dist/Select/SelectList.js +85 -0
- 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 -0
- package/dist/Select/index.js +19 -0
- package/dist/SimpleMenu/SimpleMenu.cjs +35 -0
- package/dist/SimpleMenu/SimpleMenu.js +198 -0
- package/dist/SimpleMenu/index.cjs +1 -0
- package/dist/SimpleMenu/index.js +5 -0
- package/dist/SimpleMenu/utils.cjs +12 -0
- package/dist/SimpleMenu/utils.js +15 -0
- package/dist/Stack/Stack.cjs +19 -0
- package/dist/Stack/Stack.js +35 -0
- package/dist/Stack/index.cjs +1 -0
- package/dist/Stack/index.js +4 -0
- package/dist/Status/Status.cjs +11 -0
- package/dist/Status/Status.js +22 -0
- package/dist/Status/index.cjs +1 -0
- package/dist/Status/index.js +4 -0
- package/dist/SubNav/SubNav.cjs +10 -0
- package/dist/SubNav/SubNav.js +22 -0
- package/dist/SubNav/SubNavHeader.cjs +4 -0
- package/dist/SubNav/SubNavHeader.js +86 -0
- package/dist/SubNav/SubNavLink.cjs +39 -0
- package/dist/SubNav/SubNavLink.js +81 -0
- package/dist/SubNav/SubNavLinkSection.cjs +19 -0
- package/dist/SubNav/SubNavLinkSection.js +51 -0
- package/dist/SubNav/SubNavSection.cjs +8 -0
- package/dist/SubNav/SubNavSection.js +64 -0
- package/dist/SubNav/SubNavSectionLabel.cjs +9 -0
- package/dist/SubNav/SubNavSectionLabel.js +47 -0
- package/dist/SubNav/SubNavSections.cjs +1 -0
- package/dist/SubNav/SubNavSections.js +22 -0
- package/dist/SubNav/index.cjs +1 -0
- package/dist/SubNav/index.js +15 -0
- package/dist/Switch/Switch.cjs +42 -0
- package/dist/Switch/Switch.js +50 -0
- package/dist/Switch/index.cjs +1 -0
- package/dist/Switch/index.js +4 -0
- package/dist/Table/Cell.cjs +17 -0
- package/dist/Table/Cell.js +38 -0
- package/dist/Table/TFooter.cjs +22 -0
- package/dist/Table/TFooter.js +43 -0
- package/dist/Table/Table.cjs +34 -0
- package/dist/Table/Table.js +70 -0
- package/dist/Table/Tbody.cjs +5 -0
- package/dist/Table/Tbody.js +12 -0
- package/dist/Table/Thead.cjs +3 -0
- package/dist/Table/Thead.js +10 -0
- package/dist/Table/Tr.cjs +20 -0
- package/dist/Table/Tr.js +27 -0
- package/dist/Table/index.cjs +1 -0
- package/dist/Table/index.js +15 -0
- package/dist/Tabs/TabGroup.cjs +1 -0
- package/dist/Tabs/TabGroup.js +16 -0
- package/dist/Tabs/TabPanels.cjs +1 -0
- package/dist/Tabs/TabPanels.js +14 -0
- package/dist/Tabs/Tabs.cjs +5 -0
- package/dist/Tabs/Tabs.js +76 -0
- package/dist/Tabs/TabsContext.cjs +1 -0
- package/dist/Tabs/TabsContext.js +13 -0
- package/dist/Tabs/components.cjs +43 -0
- package/dist/Tabs/components.js +52 -0
- package/dist/Tabs/index.cjs +1 -0
- package/dist/Tabs/index.js +10 -0
- package/dist/Tag/Tag.cjs +14 -0
- package/dist/Tag/Tag.js +23 -0
- package/dist/Tag/index.cjs +1 -0
- package/dist/Tag/index.js +4 -0
- package/dist/TextButton/TextButton.cjs +26 -0
- package/dist/TextButton/TextButton.js +40 -0
- package/dist/TextButton/index.cjs +1 -0
- package/dist/TextButton/index.js +4 -0
- package/dist/TextInput/TextInput.cjs +1 -0
- package/dist/TextInput/TextInput.js +21 -0
- package/dist/TextInput/index.cjs +1 -0
- package/dist/TextInput/index.js +4 -0
- package/dist/Textarea/Textarea.cjs +17 -0
- package/dist/Textarea/Textarea.js +39 -0
- package/dist/Textarea/index.cjs +1 -0
- package/dist/Textarea/index.js +4 -0
- package/dist/ThemeProvider/ThemeProvider.cjs +173 -0
- package/dist/ThemeProvider/ThemeProvider.js +180 -0
- package/dist/ThemeProvider/hooks.cjs +1 -0
- package/dist/ThemeProvider/hooks.js +5 -0
- package/dist/ThemeProvider/index.cjs +1 -0
- package/dist/ThemeProvider/index.js +6 -0
- package/dist/TimePicker/TimePicker.cjs +8 -0
- package/dist/TimePicker/TimePicker.js +83 -0
- package/dist/TimePicker/index.cjs +1 -0
- package/dist/TimePicker/index.js +5 -0
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +36 -0
- package/dist/ToggleCheckbox/ToggleCheckbox.js +59 -0
- package/dist/ToggleCheckbox/index.cjs +1 -0
- package/dist/ToggleCheckbox/index.js +4 -0
- package/dist/ToggleInput/ToggleInput.cjs +6 -0
- package/dist/ToggleInput/ToggleInput.js +23 -0
- package/dist/ToggleInput/index.cjs +1 -0
- package/dist/ToggleInput/index.js +4 -0
- package/dist/Tooltip/Tooltip.cjs +5 -0
- package/dist/Tooltip/Tooltip.js +26 -0
- package/dist/Tooltip/hooks/useTooltipHandlers.cjs +1 -0
- package/dist/Tooltip/hooks/useTooltipHandlers.js +22 -0
- package/dist/Tooltip/hooks/useTooltipLayout.cjs +1 -0
- package/dist/Tooltip/hooks/useTooltipLayout.js +17 -0
- package/dist/Tooltip/index.cjs +1 -0
- package/dist/Tooltip/index.js +4 -0
- package/dist/Tooltip/utils/positionTooltip.cjs +1 -0
- package/dist/Tooltip/utils/positionTooltip.js +27 -0
- package/dist/Typography/Typography.cjs +14 -0
- package/dist/Typography/Typography.js +25 -0
- package/dist/Typography/constants.cjs +1 -0
- package/dist/Typography/constants.js +11 -0
- package/dist/Typography/index.cjs +1 -0
- package/dist/Typography/index.js +4 -0
- package/dist/Typography/utils.cjs +34 -0
- package/dist/Typography/utils.js +59 -0
- package/dist/VisuallyHidden/VisuallyHidden.cjs +10 -0
- package/dist/VisuallyHidden/VisuallyHidden.js +14 -0
- package/dist/VisuallyHidden/index.cjs +1 -0
- package/dist/VisuallyHidden/index.js +4 -0
- package/dist/helpers/context.cjs +1 -0
- package/dist/helpers/context.js +21 -0
- package/dist/helpers/deprecations.cjs +1 -0
- package/dist/helpers/deprecations.js +13 -0
- package/dist/helpers/getDefaultLocale.cjs +4 -0
- package/dist/helpers/getDefaultLocale.js +9 -0
- package/dist/helpers/getFocusableNodes.cjs +1 -0
- package/dist/helpers/getFocusableNodes.js +7 -0
- package/dist/helpers/handleResponsiveValues.cjs +1 -0
- package/dist/helpers/handleResponsiveValues.js +25 -0
- package/dist/helpers/keyboardKeys.cjs +1 -0
- package/dist/helpers/keyboardKeys.js +20 -0
- package/dist/helpers/objects.cjs +1 -0
- package/dist/helpers/objects.js +10 -0
- package/dist/helpers/setOpacity.cjs +1 -0
- package/dist/helpers/setOpacity.js +4 -0
- package/dist/helpers/setTabIndexOnFirstItem.cjs +1 -0
- package/dist/helpers/setTabIndexOnFirstItem.js +7 -0
- package/dist/helpers/strings.cjs +1 -0
- package/dist/helpers/strings.js +4 -0
- package/dist/helpers/theme.cjs +1 -0
- package/dist/helpers/theme.js +7 -0
- package/dist/helpers/useElementOnScreen.cjs +4 -0
- package/dist/helpers/useElementOnScreen.js +11 -0
- package/dist/helpers/useId.cjs +4 -0
- package/dist/helpers/useId.js +11 -0
- package/dist/helpers/useIntersection.cjs +4 -0
- package/dist/helpers/useIntersection.js +11 -0
- package/dist/helpers/useLockScroll.cjs +4 -0
- package/dist/helpers/useLockScroll.js +11 -0
- package/dist/helpers/usePrevious.cjs +4 -0
- package/dist/helpers/usePrevious.js +11 -0
- package/dist/helpers/useResizeObserver.cjs +4 -0
- package/dist/helpers/useResizeObserver.js +11 -0
- package/dist/hooks/useComposeRefs.cjs +1 -0
- package/dist/hooks/useComposeRefs.js +14 -0
- package/dist/hooks/useControllableState.cjs +1 -0
- package/dist/hooks/useControllableState.js +22 -0
- package/dist/hooks/useDateFormatter.cjs +1 -0
- package/dist/hooks/useDateFormatter.js +20 -0
- package/dist/hooks/useElementOnScreen.cjs +1 -0
- package/dist/hooks/useElementOnScreen.js +15 -0
- package/dist/hooks/useId.cjs +1 -0
- package/dist/hooks/useId.js +13 -0
- package/dist/hooks/useIntersection.cjs +1 -0
- package/dist/hooks/useIntersection.js +23 -0
- package/dist/hooks/useLockScroll.cjs +1 -0
- package/dist/hooks/useLockScroll.js +9 -0
- package/dist/hooks/usePrevious.cjs +1 -0
- package/dist/hooks/usePrevious.js +10 -0
- package/dist/hooks/useResizeObserver.cjs +1 -0
- package/dist/hooks/useResizeObserver.js +16 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +311 -0
- package/dist/themes/common-theme.cjs +1 -0
- package/dist/themes/common-theme.js +21 -0
- package/dist/themes/darkTheme/dark-colors.cjs +1 -0
- package/dist/themes/darkTheme/dark-colors.js +52 -0
- package/dist/themes/darkTheme/dark-shadows.cjs +1 -0
- package/dist/themes/darkTheme/dark-shadows.js +12 -0
- package/dist/themes/darkTheme/index.cjs +1 -0
- package/dist/themes/darkTheme/index.js +11 -0
- package/dist/themes/extendTheme.cjs +13 -0
- package/dist/themes/extendTheme.js +36 -0
- package/dist/themes/index.cjs +1 -0
- package/dist/themes/index.js +12 -0
- package/dist/themes/lightTheme/index.cjs +1 -0
- package/dist/themes/lightTheme/index.js +11 -0
- package/dist/themes/lightTheme/light-colors.cjs +1 -0
- package/dist/themes/lightTheme/light-colors.js +52 -0
- package/dist/themes/lightTheme/light-shadows.cjs +1 -0
- package/dist/themes/lightTheme/light-shadows.js +12 -0
- package/dist/themes/sizes.cjs +1 -0
- package/dist/themes/sizes.js +22 -0
- package/dist/themes/utils.cjs +41 -0
- package/dist/themes/utils.js +47 -0
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +9 -0
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +33 -0
- package/dist/v2/Breadcrumbs/Crumb.cjs +1 -0
- package/dist/v2/Breadcrumbs/Crumb.js +27 -0
- package/dist/v2/Breadcrumbs/CrumbLink.cjs +14 -0
- package/dist/v2/Breadcrumbs/CrumbLink.js +30 -0
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +8 -0
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +23 -0
- package/dist/v2/Breadcrumbs/Divider.cjs +1 -0
- package/dist/v2/Breadcrumbs/Divider.js +9 -0
- package/dist/v2/Breadcrumbs/index.cjs +1 -0
- package/dist/v2/Breadcrumbs/index.js +10 -0
- package/dist/v2/Link/Link.cjs +25 -0
- package/dist/v2/Link/Link.js +36 -0
- package/dist/v2/Link/index.cjs +1 -0
- package/dist/v2/Link/index.js +4 -0
- package/dist/v2/LinkButton/LinkButton.cjs +20 -0
- package/dist/v2/LinkButton/LinkButton.js +35 -0
- package/dist/v2/LinkButton/index.cjs +1 -0
- package/dist/v2/LinkButton/index.js +4 -0
- package/dist/v2/MainNav/MainNav.cjs +4 -0
- package/dist/v2/MainNav/MainNav.js +33 -0
- package/dist/v2/MainNav/MainNavContext.cjs +1 -0
- package/dist/v2/MainNav/MainNavContext.js +6 -0
- package/dist/v2/MainNav/NavBrand.cjs +12 -0
- package/dist/v2/MainNav/NavBrand.js +50 -0
- package/dist/v2/MainNav/NavCondense.cjs +20 -0
- package/dist/v2/MainNav/NavCondense.js +40 -0
- package/dist/v2/MainNav/NavFooter.cjs +1 -0
- package/dist/v2/MainNav/NavFooter.js +12 -0
- package/dist/v2/MainNav/NavLink.cjs +69 -0
- package/dist/v2/MainNav/NavLink.js +103 -0
- package/dist/v2/MainNav/NavSection.cjs +1 -0
- package/dist/v2/MainNav/NavSection.js +46 -0
- package/dist/v2/MainNav/NavSections.cjs +4 -0
- package/dist/v2/MainNav/NavSections.js +26 -0
- package/dist/v2/MainNav/NavUser.cjs +3 -0
- package/dist/v2/MainNav/NavUser.js +32 -0
- package/dist/v2/MainNav/index.cjs +1 -0
- package/dist/v2/MainNav/index.js +18 -0
- package/dist/v2/Pagination/Pagination.cjs +5 -0
- package/dist/v2/Pagination/Pagination.js +26 -0
- package/dist/v2/Pagination/PaginationContext.cjs +1 -0
- package/dist/v2/Pagination/PaginationContext.js +6 -0
- package/dist/v2/Pagination/assets/next.svg.cjs +1 -0
- package/dist/v2/Pagination/assets/next.svg.js +4 -0
- package/dist/v2/Pagination/assets/previous.svg.cjs +1 -0
- package/dist/v2/Pagination/assets/previous.svg.js +4 -0
- package/dist/v2/Pagination/components.cjs +36 -0
- package/dist/v2/Pagination/components.js +95 -0
- package/dist/v2/Pagination/index.cjs +1 -0
- package/dist/v2/Pagination/index.js +9 -0
- package/dist/v2/SimpleMenu/Menu.cjs +65 -0
- package/dist/v2/SimpleMenu/Menu.js +89 -0
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +1 -0
- package/dist/v2/SimpleMenu/SimpleMenu.js +27 -0
- package/dist/v2/SimpleMenu/index.cjs +1 -0
- package/dist/v2/SimpleMenu/index.js +7 -0
- package/dist/v2/SubNav/SubNav.cjs +10 -0
- package/dist/v2/SubNav/SubNav.js +22 -0
- package/dist/v2/SubNav/SubNavHeader.cjs +4 -0
- package/dist/v2/SubNav/SubNavHeader.js +86 -0
- package/dist/v2/SubNav/SubNavLink.cjs +39 -0
- package/dist/v2/SubNav/SubNavLink.js +84 -0
- package/dist/v2/SubNav/SubNavLinkSection.cjs +19 -0
- package/dist/v2/SubNav/SubNavLinkSection.js +50 -0
- package/dist/v2/SubNav/SubNavSection.cjs +8 -0
- package/dist/v2/SubNav/SubNavSection.js +63 -0
- package/dist/v2/SubNav/SubNavSectionLabel.cjs +9 -0
- package/dist/v2/SubNav/SubNavSectionLabel.js +47 -0
- package/dist/v2/SubNav/SubNavSections.cjs +1 -0
- package/dist/v2/SubNav/SubNavSections.js +22 -0
- package/dist/v2/SubNav/index.cjs +1 -0
- package/dist/v2/SubNav/index.js +15 -0
- package/dist/v2/index.cjs +1 -0
- package/dist/v2/index.js +55 -0
- package/package.json +69 -0
|
@@ -0,0 +1,85 @@
|
|
|
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();
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
case u.DOWN: {
|
|
24
|
+
i.preventDefault();
|
|
25
|
+
const n = y(o.current);
|
|
26
|
+
if (!n)
|
|
27
|
+
return;
|
|
28
|
+
const a = n.nextSibling;
|
|
29
|
+
if (a)
|
|
30
|
+
l(o.current, a);
|
|
31
|
+
else {
|
|
32
|
+
const d = o.current.querySelectorAll('[role="option"]')[0];
|
|
33
|
+
l(o.current, d);
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case u.UP: {
|
|
38
|
+
i.preventDefault();
|
|
39
|
+
const n = y(o.current);
|
|
40
|
+
if (!n)
|
|
41
|
+
return;
|
|
42
|
+
const a = n.previousSibling;
|
|
43
|
+
if (a)
|
|
44
|
+
l(o.current, a);
|
|
45
|
+
else {
|
|
46
|
+
const p = o.current.querySelectorAll('[role="option"]'), d = p[p.length - 1];
|
|
47
|
+
l(o.current, d);
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
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();
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
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}`);
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
E as SelectList
|
|
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 t=require("react/jsx-runtime"),N=require("react"),o=require("./SelectParts.cjs"),E=require("../helpers/strings.cjs"),b=require("../hooks/useId.cjs"),V=require("../hooks/useIntersection.cjs"),q=require("../Box/Box.cjs"),H=require("../Typography/Typography.cjs"),W=require("../Field/Field.cjs"),z=require("../Flex/Flex.cjs"),D=require("../Field/FieldLabel.cjs"),A=require("../Field/FieldHint.cjs"),G=require("../Field/FieldError.cjs");function J(e){if(e&&e.__esModule)return e;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const h=J(N),K=({error:e,hint:n,id:r,label:i,labelAction:s,required:f,selectButtonTitle:x,...d})=>{const c=b.useId(r),u=h.useRef(null),g=()=>{u.current.focus()};return t.jsx(W.Field,{hint:n,error:e,id:c,required:f,children:t.jsxs(z.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[t.jsx(D.FieldLabel,{onClick:g,action:s,children:i}),t.jsx(O,{label:i,id:c,triggerRef:u,required:f,...d}),t.jsx(A.FieldHint,{}),t.jsx(G.FieldError,{})]})})},O=({id:e,children:n,clearLabel:r="Clear",customizeContent:i,disabled:s,error:f,label:x,onChange:d,onClear:c,onReachEnd:u,placeholder:g,required:m,selectButtonTitle:U,startIcon:y,size:F="M",value:p,triggerRef:R,...T})=>{const[B,j]=h.useState(),[C,_]=h.useState(!1),$=l=>{_(l)},v=l=>{c&&c(l),d||j("")},w=`${e}-hint`,P=`${e}-error`,k=l=>{d?d(typeof p=="number"?Number(l):l):j(l)},S=h.useRef(null),L=b.useId(),I=`intersection-${E.stripReactIdOfColon(L)}`,M=l=>{u&&u(l)};V.useIntersection(S,M,{selectorToWatch:`#${I}`,skipWhen:!C});const a=(typeof p<"u"&&p!==null?p.toString():B)??"";return t.jsxs(o.Root,{onOpenChange:$,disabled:s,required:m,onValueChange:k,value:a,...T,children:[t.jsx(o.Trigger,{ref:R,"aria-label":x,"aria-describedby":e?`${w} ${P}`:void 0,id:e,startIcon:y,size:F,hasError:!!f,disabled:s,clearLabel:r,onClear:a&&c?v:void 0,children:t.jsx(o.Value,{placeholder:g,textColor:a?"neutral800":"neutral600",children:a&&i?i(a):void 0})}),t.jsx(o.Portal,{children:t.jsx(o.Content,{position:"popper",sideOffset:4,children:t.jsxs(o.Viewport,{ref:S,children:[n,t.jsx(q.Box,{id:I,width:"100%",height:"1px"})]})})})]})},Q=h.forwardRef(({value:e,startIcon:n,children:r,...i},s)=>t.jsxs(o.Item,{ref:s,value:e.toString(),...i,children:[n&&t.jsx(q.Box,{as:"span","aria-hidden":!0,children:n}),t.jsx(H.Typography,{textColor:"neutral800",children:t.jsx(o.ItemText,{children:r})})]}));exports.SingleSelect=K;exports.SingleSelectInput=O;exports.SingleSelectOption=Q;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
|
+
import { Item as j, ItemText as q, Root as W, Trigger as _, Value as H, Portal as M, Content as P, Viewport as z } from "./SelectParts.js";
|
|
4
|
+
import { stripReactIdOfColon as A } from "../helpers/strings.js";
|
|
5
|
+
import { useId as R } from "../hooks/useId.js";
|
|
6
|
+
import { useIntersection as D } from "../hooks/useIntersection.js";
|
|
7
|
+
import { Box as x } from "../Box/Box.js";
|
|
8
|
+
import { Typography as G } from "../Typography/Typography.js";
|
|
9
|
+
import { Field as J } from "../Field/Field.js";
|
|
10
|
+
import { Flex as K } from "../Flex/Flex.js";
|
|
11
|
+
import { FieldLabel as Q } from "../Field/FieldLabel.js";
|
|
12
|
+
import { FieldHint as U } from "../Field/FieldHint.js";
|
|
13
|
+
import { FieldError as X } from "../Field/FieldError.js";
|
|
14
|
+
const pe = ({ error: r, hint: i, id: c, label: n, labelAction: o, required: f, selectButtonTitle: m, ...d }) => {
|
|
15
|
+
const l = R(c), a = u.useRef(null);
|
|
16
|
+
return e(J, { hint: i, error: r, id: l, required: f, children: p(K, { direction: "column", alignItems: "stretch", gap: 1, children: [e(Q, { onClick: () => {
|
|
17
|
+
a.current.focus();
|
|
18
|
+
}, action: o, children: n }), e(Y, { label: n, id: l, triggerRef: a, required: f, ...d }), e(U, {}), e(X, {})] }) });
|
|
19
|
+
}, Y = ({ id: r, children: i, clearLabel: c = "Clear", customizeContent: n, disabled: o, error: f, label: m, onChange: d, onClear: l, onReachEnd: a, placeholder: g, required: C, selectButtonTitle: Z, startIcon: B, size: O = "M", value: h, triggerRef: T, ...F }) => {
|
|
20
|
+
const [$, I] = u.useState(), [y, k] = u.useState(!1), w = (t) => {
|
|
21
|
+
k(t);
|
|
22
|
+
}, L = (t) => {
|
|
23
|
+
l && l(t), d || I("");
|
|
24
|
+
}, v = `${r}-hint`, E = `${r}-error`, N = (t) => {
|
|
25
|
+
d ? d(typeof h == "number" ? Number(t) : t) : I(t);
|
|
26
|
+
}, b = u.useRef(null), V = R(), S = `intersection-${A(V)}`;
|
|
27
|
+
D(b, (t) => {
|
|
28
|
+
a && a(t);
|
|
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: !y
|
|
36
|
+
});
|
|
37
|
+
const s = (typeof h < "u" && h !== null ? h.toString() : $) ?? "";
|
|
38
|
+
return p(W, { onOpenChange: w, disabled: o, required: C, onValueChange: N, value: s, ...F, children: [e(_, { ref: T, "aria-label": m, "aria-describedby": r ? `${v} ${E}` : void 0, id: r, startIcon: B, size: O, hasError: !!f, disabled: o, clearLabel: c, onClear: s && l ? L : void 0, children: e(H, { placeholder: g, textColor: s ? "neutral800" : "neutral600", children: s && n ? n(s) : void 0 }) }), e(M, { children: e(P, { position: "popper", sideOffset: 4, children: p(z, { ref: b, children: [i, e(x, { id: S, width: "100%", height: "1px" })] }) }) })] });
|
|
39
|
+
}, me = u.forwardRef(({ value: r, startIcon: i, children: c, ...n }, o) => p(j, { ref: o, value: r.toString(), ...n, children: [i && e(x, { as: "span", "aria-hidden": !0, children: i }), e(G, { textColor: "neutral800", children: e(q, { children: c }) })] }));
|
|
40
|
+
export {
|
|
41
|
+
pe as SingleSelect,
|
|
42
|
+
Y as SingleSelectInput,
|
|
43
|
+
me as SingleSelectOption
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MultiSelectNested as o } from "./MultiSelectNested.js";
|
|
2
|
+
import { MultiSelect as l, MultiSelectGroup as p, MultiSelectOption as i } from "./MultiSelect.js";
|
|
3
|
+
import { SingleSelect as c, SingleSelectOption as f } from "./SingleSelect.js";
|
|
4
|
+
import { Select as x } from "./Select.js";
|
|
5
|
+
import { Option as n } from "./Option.js";
|
|
6
|
+
import { OptGroup as O } from "./OptGroup.js";
|
|
7
|
+
import { SelectList as s } from "./SelectList.js";
|
|
8
|
+
export {
|
|
9
|
+
l as MultiSelect,
|
|
10
|
+
p as MultiSelectGroup,
|
|
11
|
+
o as MultiSelectNested,
|
|
12
|
+
i as MultiSelectOption,
|
|
13
|
+
O as OptGroup,
|
|
14
|
+
n as Option,
|
|
15
|
+
x as Select,
|
|
16
|
+
s as SelectList,
|
|
17
|
+
c as SingleSelect,
|
|
18
|
+
f as SingleSelectOption
|
|
19
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),r=require("react"),H=require("@strapi/icons"),M=require("@strapi/ui-primitives"),U=require("prop-types"),G=require("react-router-dom"),J=require("styled-components"),C=require("./utils.cjs"),i=require("../helpers/keyboardKeys.cjs"),Q=require("../hooks/useId.cjs"),X=require("../Link/Link.cjs"),w=require("../Button/Button.cjs"),_=require("../Popover/Popover.cjs"),b=require("../Box/Box.cjs"),q=require("../Typography/Typography.cjs"),Y=require("../Flex/Flex.cjs"),O=e=>e&&e.__esModule?e:{default:e},B=O(r),n=O(U),h=O(J),Z=h.default.button`
|
|
2
|
+
border: none;
|
|
3
|
+
padding: 0;
|
|
4
|
+
background: transparent;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
${C.getOptionStyle}
|
|
7
|
+
`,ee=h.default(G.NavLink)`
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
${C.getOptionStyle}
|
|
10
|
+
`,ne=h.default(X.Link)`
|
|
11
|
+
/* Removing Link hover effect */
|
|
12
|
+
&:hover {
|
|
13
|
+
color: currentColor;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&:focus-visible {
|
|
17
|
+
/* Removing Link focus-visible after properties and reset to global outline */
|
|
18
|
+
outline: 2px solid ${({theme:e})=>e.colors.primary600};
|
|
19
|
+
outline-offset: 2px;
|
|
20
|
+
&:after {
|
|
21
|
+
content: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${C.getOptionStyle}
|
|
26
|
+
`,te=h.default.span`
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
svg {
|
|
30
|
+
height: 4px;
|
|
31
|
+
width: 6px;
|
|
32
|
+
}
|
|
33
|
+
`,oe=h.default(w.Button)`
|
|
34
|
+
padding: ${({theme:e})=>`${e.spaces[1]} ${e.spaces[3]}`};
|
|
35
|
+
`,S=({children:e,onClick:g,to:u,isFocused:a,href:d,...R})=>{const l=r.useRef();r.useEffect(()=>{a&&l.current&&l.current.focus()},[a]);const c={tabIndex:a?0:-1,ref:l,role:"menuitem",...R},f=v=>{(v.key===i.KeyboardKeys.SPACE||v.key===i.KeyboardKeys.ENTER)&&g()};return u&&!d?o.jsx(ee,{to:u,...c,children:o.jsx(b.Box,{padding:2,children:o.jsx(q.Typography,{children:e})})}):d&&!u?o.jsx(ne,{isExternal:!0,href:d,...c,children:o.jsx(b.Box,{padding:2,children:o.jsx(q.Typography,{children:e})})}):o.jsx(Z,{onKeyDown:f,onMouseDown:g,type:"button",...c,children:o.jsx(b.Box,{padding:2,children:o.jsx(q.Typography,{children:e})})})};S.defaultProps={as:void 0,href:void 0,isFocused:!1,onClick(){},to:void 0};S.propTypes={as:n.default.elementType,children:n.default.node.isRequired,href:n.default.string,isFocused:n.default.bool,onClick:n.default.func,to:n.default.string};const x=({label:e,children:g,id:u,as:a,onOpen:d=()=>{},onClose:R=()=>{},size:l,popoverPlacement:c,onReachEnd:f,...v})=>{const p=r.useRef(),k=Q.useId(u),K=r.useRef(!1),[y,m]=r.useState(!1),[P,j]=r.useState(0),E=r.Children.toArray(g),L=l==="S"?oe:w.Button,$=a||L,T=!!f&&typeof f=="function";r.useEffect(()=>{if(["string","number"].includes(typeof e)){const t=E.findIndex(s=>s.props.children===e);t!==-1&&j(t)}},[e]);const I=M.useCallbackRef(d),D=M.useCallbackRef(R);r.useEffect(()=>{K?.current?y?I():D():K.current=!0},[K,D,I,y]),r.useEffect(()=>{B.default.isValidElement(e)&&P===-1&&p.current.focus()},[e,P]);const A=t=>{y&&(t.key===i.KeyboardKeys.ESCAPE&&(t.stopPropagation(),m(!1),p.current.focus()),t.key===i.KeyboardKeys.DOWN&&j(s=>s===E.length-1?0:s+1),t.key===i.KeyboardKeys.UP&&j(s=>s===0?E.length-1:s-1))},N=t=>{(t.key===i.KeyboardKeys.ENTER||t.key===i.KeyboardKeys.SPACE)&&m(s=>!s)},F=t=>{t.preventDefault(),t.currentTarget.contains(t.relatedTarget)||m(!1)},V=t=>{t.preventDefault(),m(s=>!s)},W=()=>{T&&f()},z=E.map((t,s)=>o.jsx(Y.Flex,{as:"li",justifyContent:"center",role:"menuitem",children:r.cloneElement(t,{onClick(){t.props.onClick(),m(!1),p.current.focus()},isFocused:P===s})},s));return o.jsxs("div",{onKeyDown:A,children:[o.jsx($,{label:B.default.isValidElement(e)?null:e,"aria-haspopup":!0,"aria-expanded":y,"aria-controls":k,onKeyDown:N,onMouseDown:V,ref:p,type:"button",variant:"ghost",endIcon:o.jsx(te,{children:o.jsx(H.CarretDown,{"aria-hidden":!0})}),...v,children:e}),y&&o.jsx(_.Popover,{onBlur:F,placement:c,source:p,onReachEnd:W,intersectionId:T?`popover-${k}`:void 0,spacing:4,children:o.jsx(b.Box,{role:"menu",as:"ul",padding:1,id:k,children:z})})]})};x.defaultProps={as:void 0};x.displayName="SimpleMenu";x.defaultProps={id:void 0,onOpen:void 0,onClose:void 0,onReachEnd:void 0,popoverPlacement:"bottom-start",size:"M"};x.propTypes={as:n.default.any,children:n.default.oneOfType([n.default.arrayOf(n.default.node),n.default.node]).isRequired,id:n.default.string,label:n.default.oneOfType([n.default.string,n.default.number,n.default.element]).isRequired,onClose:n.default.func,onOpen:n.default.func,onReachEnd:n.default.func,popoverPlacement:n.default.oneOf(_.POPOVER_PLACEMENTS),size:n.default.oneOf(["S","M"])};exports.MenuItem=S;exports.SimpleMenu=x;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { jsx as t, jsxs as z } from "react/jsx-runtime";
|
|
2
|
+
import B, { useRef as T, useEffect as E, useState as K, Children as H, cloneElement as U } from "react";
|
|
3
|
+
import { CarretDown as G } from "@strapi/icons";
|
|
4
|
+
import { useCallbackRef as $ } from "@strapi/ui-primitives";
|
|
5
|
+
import e from "prop-types";
|
|
6
|
+
import { NavLink as J } from "react-router-dom";
|
|
7
|
+
import y from "styled-components";
|
|
8
|
+
import { getOptionStyle as b } from "./utils.js";
|
|
9
|
+
import { KeyboardKeys as i } from "../helpers/keyboardKeys.js";
|
|
10
|
+
import { useId as Q } from "../hooks/useId.js";
|
|
11
|
+
import { Link as X } from "../Link/Link.js";
|
|
12
|
+
import { Button as L } from "../Button/Button.js";
|
|
13
|
+
import { POPOVER_PLACEMENTS as Y, Popover as Z } from "../Popover/Popover.js";
|
|
14
|
+
import { Box as C } from "../Box/Box.js";
|
|
15
|
+
import { Typography as O } from "../Typography/Typography.js";
|
|
16
|
+
import { Flex as ee } from "../Flex/Flex.js";
|
|
17
|
+
const ne = y.button`
|
|
18
|
+
border: none;
|
|
19
|
+
padding: 0;
|
|
20
|
+
background: transparent;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
${b}
|
|
23
|
+
`, oe = y(J)`
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
${b}
|
|
26
|
+
`, te = y(X)`
|
|
27
|
+
/* Removing Link hover effect */
|
|
28
|
+
&:hover {
|
|
29
|
+
color: currentColor;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:focus-visible {
|
|
33
|
+
/* Removing Link focus-visible after properties and reset to global outline */
|
|
34
|
+
outline: 2px solid ${({ theme: o }) => o.colors.primary600};
|
|
35
|
+
outline-offset: 2px;
|
|
36
|
+
&:after {
|
|
37
|
+
content: none;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${b}
|
|
42
|
+
`, re = y.span`
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
svg {
|
|
46
|
+
height: 4px;
|
|
47
|
+
width: 6px;
|
|
48
|
+
}
|
|
49
|
+
`, ie = y(L)`
|
|
50
|
+
padding: ${({ theme: o }) => `${o.spaces[1]} ${o.spaces[3]}`};
|
|
51
|
+
`, A = ({ children: o, onClick: h, to: s, isFocused: c, href: a, ...x }) => {
|
|
52
|
+
const d = T();
|
|
53
|
+
E(() => {
|
|
54
|
+
c && d.current && d.current.focus();
|
|
55
|
+
}, [c]);
|
|
56
|
+
const l = {
|
|
57
|
+
tabIndex: c ? 0 : -1,
|
|
58
|
+
ref: d,
|
|
59
|
+
role: "menuitem",
|
|
60
|
+
...x
|
|
61
|
+
}, p = (g) => {
|
|
62
|
+
(g.key === i.SPACE || g.key === i.ENTER) && h();
|
|
63
|
+
};
|
|
64
|
+
return s && !a ? /* @__PURE__ */ t(oe, { to: s, ...l, children: /* @__PURE__ */ t(C, { padding: 2, children: /* @__PURE__ */ t(O, { children: o }) }) }) : a && !s ? /* @__PURE__ */ t(te, { isExternal: !0, href: a, ...l, children: /* @__PURE__ */ t(C, { padding: 2, children: /* @__PURE__ */ t(O, { children: o }) }) }) : /* @__PURE__ */ t(ne, { onKeyDown: p, onMouseDown: h, type: "button", ...l, children: /* @__PURE__ */ t(C, { padding: 2, children: /* @__PURE__ */ t(O, { children: o }) }) });
|
|
65
|
+
};
|
|
66
|
+
A.defaultProps = {
|
|
67
|
+
as: void 0,
|
|
68
|
+
href: void 0,
|
|
69
|
+
isFocused: !1,
|
|
70
|
+
onClick() {
|
|
71
|
+
},
|
|
72
|
+
to: void 0
|
|
73
|
+
};
|
|
74
|
+
A.propTypes = {
|
|
75
|
+
as: e.elementType,
|
|
76
|
+
children: e.node.isRequired,
|
|
77
|
+
href: e.string,
|
|
78
|
+
isFocused: e.bool,
|
|
79
|
+
onClick: e.func,
|
|
80
|
+
to: e.string
|
|
81
|
+
};
|
|
82
|
+
const k = ({
|
|
83
|
+
label: o,
|
|
84
|
+
children: h,
|
|
85
|
+
id: s,
|
|
86
|
+
as: c,
|
|
87
|
+
onOpen: a = () => {
|
|
88
|
+
},
|
|
89
|
+
onClose: x = () => {
|
|
90
|
+
},
|
|
91
|
+
size: d,
|
|
92
|
+
popoverPlacement: l,
|
|
93
|
+
onReachEnd: p,
|
|
94
|
+
...g
|
|
95
|
+
}) => {
|
|
96
|
+
const u = T(), P = Q(s), R = T(!1), [f, m] = K(!1), [D, I] = K(0), v = H.toArray(h), N = c || (d === "S" ? ie : L), S = !!p && typeof p == "function";
|
|
97
|
+
E(() => {
|
|
98
|
+
if (["string", "number"].includes(typeof o)) {
|
|
99
|
+
const n = v.findIndex((r) => r.props.children === o);
|
|
100
|
+
n !== -1 && I(n);
|
|
101
|
+
}
|
|
102
|
+
}, [o]);
|
|
103
|
+
const w = $(a), M = $(x);
|
|
104
|
+
E(() => {
|
|
105
|
+
R?.current ? f ? w() : M() : R.current = !0;
|
|
106
|
+
}, [R, M, w, f]), E(() => {
|
|
107
|
+
B.isValidElement(o) && D === -1 && u.current.focus();
|
|
108
|
+
}, [o, D]);
|
|
109
|
+
const F = (n) => {
|
|
110
|
+
f && (n.key === i.ESCAPE && (n.stopPropagation(), m(!1), u.current.focus()), n.key === i.DOWN && I((r) => r === v.length - 1 ? 0 : r + 1), n.key === i.UP && I((r) => r === 0 ? v.length - 1 : r - 1));
|
|
111
|
+
}, V = (n) => {
|
|
112
|
+
(n.key === i.ENTER || n.key === i.SPACE) && m((r) => !r);
|
|
113
|
+
}, j = (n) => {
|
|
114
|
+
n.preventDefault(), n.currentTarget.contains(n.relatedTarget) || m(!1);
|
|
115
|
+
}, q = (n) => {
|
|
116
|
+
n.preventDefault(), m((r) => !r);
|
|
117
|
+
}, W = () => {
|
|
118
|
+
S && p();
|
|
119
|
+
}, _ = v.map((n, r) => (
|
|
120
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
121
|
+
/* @__PURE__ */ t(ee, { as: "li", justifyContent: "center", role: "menuitem", children: U(n, {
|
|
122
|
+
onClick() {
|
|
123
|
+
n.props.onClick(), m(!1), u.current.focus();
|
|
124
|
+
},
|
|
125
|
+
isFocused: D === r
|
|
126
|
+
}) }, r)
|
|
127
|
+
));
|
|
128
|
+
return (
|
|
129
|
+
// TODO: review why we need to eslint it and how to solve this issue.
|
|
130
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
131
|
+
/* @__PURE__ */ z("div", { onKeyDown: F, children: [
|
|
132
|
+
/* @__PURE__ */ t(
|
|
133
|
+
N,
|
|
134
|
+
{
|
|
135
|
+
label: B.isValidElement(o) ? null : o,
|
|
136
|
+
"aria-haspopup": !0,
|
|
137
|
+
"aria-expanded": f,
|
|
138
|
+
"aria-controls": P,
|
|
139
|
+
onKeyDown: V,
|
|
140
|
+
onMouseDown: q,
|
|
141
|
+
ref: u,
|
|
142
|
+
type: "button",
|
|
143
|
+
variant: "ghost",
|
|
144
|
+
endIcon: /* @__PURE__ */ t(re, { children: /* @__PURE__ */ t(G, { "aria-hidden": !0 }) }),
|
|
145
|
+
...g,
|
|
146
|
+
children: o
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
f && /* @__PURE__ */ t(
|
|
150
|
+
Z,
|
|
151
|
+
{
|
|
152
|
+
onBlur: j,
|
|
153
|
+
placement: l,
|
|
154
|
+
source: u,
|
|
155
|
+
onReachEnd: W,
|
|
156
|
+
intersectionId: S ? `popover-${P}` : void 0,
|
|
157
|
+
spacing: 4,
|
|
158
|
+
children: /* @__PURE__ */ t(C, { role: "menu", as: "ul", padding: 1, id: P, children: _ })
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] })
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
k.defaultProps = {
|
|
165
|
+
as: void 0
|
|
166
|
+
};
|
|
167
|
+
k.displayName = "SimpleMenu";
|
|
168
|
+
k.defaultProps = {
|
|
169
|
+
id: void 0,
|
|
170
|
+
onOpen: void 0,
|
|
171
|
+
onClose: void 0,
|
|
172
|
+
onReachEnd: void 0,
|
|
173
|
+
popoverPlacement: "bottom-start",
|
|
174
|
+
size: "M"
|
|
175
|
+
};
|
|
176
|
+
k.propTypes = {
|
|
177
|
+
as: e.any,
|
|
178
|
+
children: e.oneOfType([e.arrayOf(e.node), e.node]).isRequired,
|
|
179
|
+
id: e.string,
|
|
180
|
+
label: e.oneOfType([e.string, e.number, e.element]).isRequired,
|
|
181
|
+
onClose: e.func,
|
|
182
|
+
onOpen: e.func,
|
|
183
|
+
/**
|
|
184
|
+
* Callback function to be called when the popover reaches the end of the scrollable content
|
|
185
|
+
*/
|
|
186
|
+
onReachEnd: e.func,
|
|
187
|
+
popoverPlacement: e.oneOf(Y),
|
|
188
|
+
/**
|
|
189
|
+
* Size of the trigger button.
|
|
190
|
+
* Note: in case a custom component is passed through the "as"
|
|
191
|
+
* prop, the size prop is passed along too, but needs to be handled there
|
|
192
|
+
*/
|
|
193
|
+
size: e.oneOf(["S", "M"])
|
|
194
|
+
};
|
|
195
|
+
export {
|
|
196
|
+
A as MenuItem,
|
|
197
|
+
k as SimpleMenu
|
|
198
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./SimpleMenu.cjs");exports.MenuItem=e.MenuItem;exports.SimpleMenu=e.SimpleMenu;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=({theme:o})=>`
|
|
2
|
+
text-align: left;
|
|
3
|
+
width: 100%;
|
|
4
|
+
color: ${o.colors.neutral800};
|
|
5
|
+
border-radius: ${o.borderRadius};
|
|
6
|
+
&:focus {
|
|
7
|
+
background-color: ${o.colors.primary100};
|
|
8
|
+
}
|
|
9
|
+
&:not([aria-disabled]):hover {
|
|
10
|
+
background-color: ${o.colors.primary100};
|
|
11
|
+
}
|
|
12
|
+
`;exports.getOptionStyle=r;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const r = ({ theme: o }) => `
|
|
2
|
+
text-align: left;
|
|
3
|
+
width: 100%;
|
|
4
|
+
color: ${o.colors.neutral800};
|
|
5
|
+
border-radius: ${o.borderRadius};
|
|
6
|
+
&:focus {
|
|
7
|
+
background-color: ${o.colors.primary100};
|
|
8
|
+
}
|
|
9
|
+
&:not([aria-disabled]):hover {
|
|
10
|
+
background-color: ${o.colors.primary100};
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
export {
|
|
14
|
+
r as getOptionStyle
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),u=require("react"),m=require("styled-components"),s=require("../helpers/theme.cjs"),o=require("../Flex/Flex.cjs"),f=e=>e&&e.__esModule?e:{default:e},c=f(m),l={size:!0,spacing:!0},g=c.default(o.Flex).withConfig({shouldForwardProp:(e,t)=>!l[e]&&t(e)})`
|
|
2
|
+
& > * {
|
|
3
|
+
margin-top: 0;
|
|
4
|
+
margin-bottom: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
& > * + * {
|
|
8
|
+
margin-top: ${({theme:e,spacing:t})=>s.extractStyleFromTheme(e.spaces,t,void 0)};
|
|
9
|
+
}
|
|
10
|
+
`,h=c.default(o.Flex).withConfig({shouldForwardProp:(e,t)=>!l[e]&&t(e)})`
|
|
11
|
+
& > * {
|
|
12
|
+
margin-left: 0;
|
|
13
|
+
margin-right: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
& > * + * {
|
|
17
|
+
margin-left: ${({theme:e,spacing:t})=>s.extractStyleFromTheme(e.spaces,t,void 0)};
|
|
18
|
+
}
|
|
19
|
+
`,d=u.forwardRef(({horizontal:e=!1,spacing:t,size:r,...n},a)=>(r&&console.warn('Deprecation warning: Usage of "size" prop in Stack component is deprecated. This is discouraged and will be removed in the next major release. Please use "spacing" instead'),e?i.jsx(h,{ref:a,spacing:t||r,...n}):i.jsx(g,{direction:"column",alignItems:"stretch",ref:a,spacing:t||r,...n})));d.displayName="Stack";exports.Stack=d;
|