@strapi/design-system 1.3.0-beta.0 → 1.3.0-beta.1
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/.eslintrc.js +38 -0
- package/.prettierrc.js +7 -0
- package/.storybook/{main.cjs → main.js} +0 -0
- package/babel.config.js +5 -0
- package/createIndexFiles.js +34 -0
- package/global-setup.js +1 -1
- package/jest.config.js +3 -1
- package/package.json +22 -28
- package/playwright.config.js +4 -2
- package/src/Accordion/Accordion.js +1 -0
- package/src/BaseCheckbox/BaseCheckbox.js +14 -9
- package/src/BaseCheckbox/BaseCheckbox.stories.mdx +1 -1
- package/src/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/DatePicker/__tests__/DatePicker.spec.js +1 -0
- package/src/DateTimePicker/__tests__/DateTimePicker.e2e.js +1 -1
- package/src/DismissibleLayer/DismissibleLayer.js +15 -1
- package/src/DismissibleLayer/__test__/DimissibleLayer.spec.js +4 -2
- package/src/IconButton/IconButton.js +62 -22
- package/src/IconButton/IconButton.stories.mdx +69 -16
- package/src/ModalLayout/__tests__/ModalLayout.spec.js +7 -1
- package/src/Portal/Portal.js +0 -5
- package/src/Status/Status.stories.mdx +9 -4
- package/src/Switch/Switch.stories.mdx +23 -2
- package/webpack.config.js +84 -0
- package/.eslintrc +0 -34
- package/.prettierrc +0 -7
- package/dist/Accordion/Accordion.cjs +0 -23
- package/dist/Accordion/Accordion.js +0 -87
- package/dist/Accordion/AccordionContent.cjs +0 -1
- package/dist/Accordion/AccordionContent.js +0 -23
- package/dist/Accordion/AccordionContext.cjs +0 -1
- package/dist/Accordion/AccordionContext.js +0 -6
- package/dist/Accordion/AccordionGroup.cjs +0 -47
- package/dist/Accordion/AccordionGroup.js +0 -91
- package/dist/Accordion/AccordionToggle.cjs +0 -28
- package/dist/Accordion/AccordionToggle.js +0 -127
- package/dist/Accordion/index.cjs +0 -1
- package/dist/Accordion/index.js +0 -11
- package/dist/Accordion/utils.cjs +0 -1
- package/dist/Accordion/utils.js +0 -7
- package/dist/Alert/Alert.cjs +0 -35
- package/dist/Alert/Alert.js +0 -111
- package/dist/Alert/index.cjs +0 -1
- package/dist/Alert/index.js +0 -4
- package/dist/Alert/utils.cjs +0 -1
- package/dist/Alert/utils.js +0 -6
- package/dist/Avatar/Avatar.cjs +0 -29
- package/dist/Avatar/Avatar.js +0 -79
- package/dist/Avatar/AvatarGroup.cjs +0 -5
- package/dist/Avatar/AvatarGroup.js +0 -11
- package/dist/Avatar/constants.cjs +0 -1
- package/dist/Avatar/constants.js +0 -5
- package/dist/Avatar/index.cjs +0 -1
- package/dist/Avatar/index.js +0 -7
- package/dist/Badge/Badge.cjs +0 -1
- package/dist/Badge/Badge.js +0 -33
- package/dist/Badge/index.cjs +0 -1
- package/dist/Badge/index.js +0 -4
- package/dist/BaseButton/BaseButton.cjs +0 -23
- package/dist/BaseButton/BaseButton.js +0 -45
- package/dist/BaseButton/index.cjs +0 -1
- package/dist/BaseButton/index.js +0 -5
- package/dist/BaseCheckbox/BaseCheckbox.cjs +0 -62
- package/dist/BaseCheckbox/BaseCheckbox.js +0 -104
- package/dist/BaseCheckbox/assets/checkmark-black.cjs +0 -1
- package/dist/BaseCheckbox/assets/checkmark-black.js +0 -4
- package/dist/BaseCheckbox/assets/checkmark.cjs +0 -1
- package/dist/BaseCheckbox/assets/checkmark.js +0 -4
- package/dist/BaseCheckbox/index.cjs +0 -1
- package/dist/BaseCheckbox/index.js +0 -4
- package/dist/BaseCheckbox/utils.cjs +0 -1
- package/dist/BaseCheckbox/utils.js +0 -4
- package/dist/BaseLink/BaseLink.cjs +0 -3
- package/dist/BaseLink/BaseLink.js +0 -31
- package/dist/BaseLink/index.cjs +0 -1
- package/dist/BaseLink/index.js +0 -4
- package/dist/BaseRadio/BaseRadio.cjs +0 -31
- package/dist/BaseRadio/BaseRadio.js +0 -62
- package/dist/BaseRadio/RadioGroup.cjs +0 -1
- package/dist/BaseRadio/RadioGroup.js +0 -32
- package/dist/BaseRadio/context.cjs +0 -1
- package/dist/BaseRadio/context.js +0 -6
- package/dist/BaseRadio/index.cjs +0 -1
- package/dist/BaseRadio/index.js +0 -6
- package/dist/BaseRadio/utils.cjs +0 -1
- package/dist/BaseRadio/utils.js +0 -6
- package/dist/Box/Box.cjs +0 -80
- package/dist/Box/Box.js +0 -95
- package/dist/Box/BoxProps.cjs +0 -1
- package/dist/Box/BoxProps.js +0 -51
- package/dist/Box/index.cjs +0 -1
- package/dist/Box/index.js +0 -4
- package/dist/Breadcrumbs/Breadcrumbs.cjs +0 -16
- package/dist/Breadcrumbs/Breadcrumbs.js +0 -52
- package/dist/Breadcrumbs/index.cjs +0 -1
- package/dist/Breadcrumbs/index.js +0 -5
- package/dist/Button/Button.cjs +0 -43
- package/dist/Button/Button.js +0 -105
- package/dist/Button/constants.cjs +0 -1
- package/dist/Button/constants.js +0 -14
- package/dist/Button/index.cjs +0 -1
- package/dist/Button/index.js +0 -5
- package/dist/Button/utils.cjs +0 -87
- package/dist/Button/utils.js +0 -112
- package/dist/Card/Card.cjs +0 -1
- package/dist/Card/Card.js +0 -32
- package/dist/Card/CardAction.cjs +0 -6
- package/dist/Card/CardAction.js +0 -14
- package/dist/Card/CardAsset.cjs +0 -19
- package/dist/Card/CardAsset.js +0 -42
- package/dist/Card/CardBadge.cjs +0 -6
- package/dist/Card/CardBadge.js +0 -14
- package/dist/Card/CardBody.cjs +0 -1
- package/dist/Card/CardBody.js +0 -15
- package/dist/Card/CardCheckbox.cjs +0 -1
- package/dist/Card/CardCheckbox.js +0 -16
- package/dist/Card/CardContent.cjs +0 -3
- package/dist/Card/CardContent.js +0 -15
- package/dist/Card/CardContext.cjs +0 -1
- package/dist/Card/CardContext.js +0 -6
- package/dist/Card/CardHeader.cjs +0 -4
- package/dist/Card/CardHeader.js +0 -13
- package/dist/Card/CardTimer.cjs +0 -5
- package/dist/Card/CardTimer.js +0 -26
- package/dist/Card/CardTitle.cjs +0 -1
- package/dist/Card/CardTitle.js +0 -23
- package/dist/Card/index.cjs +0 -1
- package/dist/Card/index.js +0 -23
- package/dist/CarouselInput/Carousel.cjs +0 -14
- package/dist/CarouselInput/Carousel.js +0 -131
- package/dist/CarouselInput/CarouselActions.cjs +0 -1
- package/dist/CarouselInput/CarouselActions.js +0 -14
- package/dist/CarouselInput/CarouselImage.cjs +0 -4
- package/dist/CarouselInput/CarouselImage.js +0 -35
- package/dist/CarouselInput/CarouselInput.cjs +0 -1
- package/dist/CarouselInput/CarouselInput.js +0 -79
- package/dist/CarouselInput/CarouselSlide.cjs +0 -3
- package/dist/CarouselInput/CarouselSlide.js +0 -26
- package/dist/CarouselInput/index.cjs +0 -1
- package/dist/CarouselInput/index.js +0 -12
- package/dist/Checkbox/Checkbox.cjs +0 -7
- package/dist/Checkbox/Checkbox.js +0 -64
- package/dist/Checkbox/index.cjs +0 -1
- package/dist/Checkbox/index.js +0 -4
- package/dist/Combobox/Combobox.cjs +0 -1
- package/dist/Combobox/Combobox.js +0 -285
- package/dist/Combobox/ComboboxList.cjs +0 -1
- package/dist/Combobox/ComboboxList.js +0 -15
- package/dist/Combobox/ComboboxOption.cjs +0 -1
- package/dist/Combobox/ComboboxOption.js +0 -30
- package/dist/Combobox/components.cjs +0 -53
- package/dist/Combobox/components.js +0 -64
- package/dist/Combobox/index.cjs +0 -1
- package/dist/Combobox/index.js +0 -7
- package/dist/Combobox/utils.cjs +0 -1
- package/dist/Combobox/utils.js +0 -78
- package/dist/DatePicker/DatePicker.cjs +0 -1
- package/dist/DatePicker/DatePicker.js +0 -104
- package/dist/DatePicker/DatePickerCalendar.cjs +0 -1
- package/dist/DatePicker/DatePickerCalendar.js +0 -102
- package/dist/DatePicker/DatePickerTd.cjs +0 -19
- package/dist/DatePicker/DatePickerTd.js +0 -55
- package/dist/DatePicker/DatePickerTh.cjs +0 -9
- package/dist/DatePicker/DatePickerTh.js +0 -35
- package/dist/DatePicker/compareDates.cjs +0 -1
- package/dist/DatePicker/compareDates.js +0 -4
- package/dist/DatePicker/components.cjs +0 -31
- package/dist/DatePicker/components.js +0 -41
- package/dist/DatePicker/index.cjs +0 -1
- package/dist/DatePicker/index.js +0 -4
- 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/DateTimePicker/DateTimePicker.cjs +0 -1
- package/dist/DateTimePicker/DateTimePicker.js +0 -108
- package/dist/DateTimePicker/DateTimePickerProps.cjs +0 -1
- package/dist/DateTimePicker/DateTimePickerProps.js +0 -42
- package/dist/DateTimePicker/__tests__/parseDate.test.cjs +0 -1
- package/dist/DateTimePicker/__tests__/parseDate.test.js +0 -8
- package/dist/DateTimePicker/index.cjs +0 -1
- package/dist/DateTimePicker/index.js +0 -4
- package/dist/DateTimePicker/parseDate.cjs +0 -1
- package/dist/DateTimePicker/parseDate.js +0 -7
- package/dist/Dialog/Dialog.cjs +0 -14
- package/dist/Dialog/Dialog.js +0 -66
- package/dist/Dialog/DialogBody.cjs +0 -10
- package/dist/Dialog/DialogBody.js +0 -32
- package/dist/Dialog/DialogFooter.cjs +0 -9
- package/dist/Dialog/DialogFooter.js +0 -31
- package/dist/Dialog/index.cjs +0 -1
- package/dist/Dialog/index.js +0 -8
- package/dist/DismissibleLayer/DismissibleLayer.cjs +0 -1
- package/dist/DismissibleLayer/DismissibleLayer.js +0 -37
- package/dist/DismissibleLayer/index.cjs +0 -1
- package/dist/DismissibleLayer/index.js +0 -4
- package/dist/Divider/Divider.cjs +0 -5
- package/dist/Divider/Divider.js +0 -24
- package/dist/Divider/index.cjs +0 -1
- package/dist/Divider/index.js +0 -4
- package/dist/EmptyStateLayout/EmptyStateLayout.cjs +0 -10
- package/dist/EmptyStateLayout/EmptyStateLayout.js +0 -44
- package/dist/EmptyStateLayout/index.cjs +0 -1
- package/dist/EmptyStateLayout/index.js +0 -4
- package/dist/EmptyStateLayout/story-assets/Illo.cjs +0 -1
- package/dist/EmptyStateLayout/story-assets/Illo.js +0 -49
- package/dist/Field/Field.cjs +0 -1
- package/dist/Field/Field.js +0 -28
- package/dist/Field/FieldAction.cjs +0 -10
- package/dist/Field/FieldAction.js +0 -24
- package/dist/Field/FieldContext.cjs +0 -1
- package/dist/Field/FieldContext.js +0 -6
- package/dist/Field/FieldError.cjs +0 -1
- package/dist/Field/FieldError.js +0 -16
- package/dist/Field/FieldHint.cjs +0 -1
- package/dist/Field/FieldHint.js +0 -15
- package/dist/Field/FieldInput.cjs +0 -43
- package/dist/Field/FieldInput.js +0 -105
- package/dist/Field/FieldLabel.cjs +0 -9
- package/dist/Field/FieldLabel.js +0 -44
- package/dist/Field/index.cjs +0 -1
- package/dist/Field/index.js +0 -18
- package/dist/Flex/Flex.cjs +0 -9
- package/dist/Flex/Flex.js +0 -22
- package/dist/Flex/FlexProps.cjs +0 -1
- package/dist/Flex/FlexProps.js +0 -40
- package/dist/Flex/index.cjs +0 -1
- package/dist/Flex/index.js +0 -4
- package/dist/FocusTrap/ExampleComponent.cjs +0 -1
- package/dist/FocusTrap/ExampleComponent.js +0 -70
- package/dist/FocusTrap/FocusTrap.cjs +0 -1
- package/dist/FocusTrap/FocusTrap.js +0 -48
- package/dist/FocusTrap/index.cjs +0 -1
- package/dist/FocusTrap/index.js +0 -4
- package/dist/Grid/Grid.cjs +0 -5
- package/dist/Grid/Grid.js +0 -28
- package/dist/Grid/GridContext.cjs +0 -1
- package/dist/Grid/GridContext.js +0 -6
- package/dist/Grid/GridItem.cjs +0 -12
- package/dist/Grid/GridItem.js +0 -41
- package/dist/Grid/index.cjs +0 -1
- package/dist/Grid/index.js +0 -6
- package/dist/Icon/Icon.cjs +0 -6
- package/dist/Icon/Icon.js +0 -26
- package/dist/Icon/index.cjs +0 -1
- package/dist/Icon/index.js +0 -4
- package/dist/IconButton/IconButton.cjs +0 -86
- package/dist/IconButton/IconButton.js +0 -129
- package/dist/IconButton/index.cjs +0 -1
- package/dist/IconButton/index.js +0 -5
- package/dist/KeyboardNavigable/KeyboardNavigable.cjs +0 -1
- package/dist/KeyboardNavigable/KeyboardNavigable.js +0 -58
- package/dist/KeyboardNavigable/index.cjs +0 -1
- package/dist/KeyboardNavigable/index.js +0 -4
- package/dist/Layout/ActionLayout.cjs +0 -9
- package/dist/Layout/ActionLayout.js +0 -37
- package/dist/Layout/ContentLayout.cjs +0 -1
- package/dist/Layout/ContentLayout.js +0 -13
- package/dist/Layout/GridLayout.cjs +0 -5
- package/dist/Layout/GridLayout.js +0 -13
- package/dist/Layout/HeaderLayout.cjs +0 -8
- package/dist/Layout/HeaderLayout.js +0 -132
- package/dist/Layout/Layout.cjs +0 -6
- package/dist/Layout/Layout.js +0 -24
- package/dist/Layout/TwoColsLayout.cjs +0 -1
- package/dist/Layout/TwoColsLayout.js +0 -29
- package/dist/Layout/index.cjs +0 -1
- package/dist/Layout/index.js +0 -15
- package/dist/Link/Link.cjs +0 -33
- package/dist/Link/Link.js +0 -87
- package/dist/Link/index.cjs +0 -1
- package/dist/Link/index.js +0 -4
- package/dist/LinkButton/LinkButton.cjs +0 -32
- package/dist/LinkButton/LinkButton.js +0 -99
- package/dist/LinkButton/index.cjs +0 -1
- package/dist/LinkButton/index.js +0 -4
- package/dist/LiveRegions/LiveRegions.cjs +0 -1
- package/dist/LiveRegions/LiveRegions.js +0 -22
- package/dist/LiveRegions/StoryComponent.cjs +0 -1
- package/dist/LiveRegions/StoryComponent.js +0 -18
- package/dist/LiveRegions/constants.cjs +0 -1
- package/dist/LiveRegions/constants.js +0 -8
- package/dist/LiveRegions/index.cjs +0 -1
- package/dist/LiveRegions/index.js +0 -4
- package/dist/LiveRegions/useNotifyAT.cjs +0 -1
- package/dist/LiveRegions/useNotifyAT.js +0 -17
- package/dist/Loader/Loader.cjs +0 -12
- package/dist/Loader/Loader.js +0 -37
- package/dist/Loader/assets/loader.cjs +0 -1
- package/dist/Loader/assets/loader.js +0 -4
- package/dist/Loader/index.cjs +0 -1
- package/dist/Loader/index.js +0 -4
- package/dist/Main/Main.cjs +0 -6
- package/dist/Main/Main.js +0 -26
- package/dist/Main/SkipToContent.cjs +0 -12
- package/dist/Main/SkipToContent.js +0 -29
- package/dist/Main/index.cjs +0 -1
- package/dist/Main/index.js +0 -6
- package/dist/MainNav/MainNav.cjs +0 -9
- package/dist/MainNav/MainNav.js +0 -30
- package/dist/MainNav/MainNavContext.cjs +0 -1
- package/dist/MainNav/MainNavContext.js +0 -6
- package/dist/MainNav/NavBrand.cjs +0 -12
- package/dist/MainNav/NavBrand.js +0 -67
- package/dist/MainNav/NavCondense.cjs +0 -20
- package/dist/MainNav/NavCondense.js +0 -45
- package/dist/MainNav/NavLink.cjs +0 -69
- package/dist/MainNav/NavLink.js +0 -119
- package/dist/MainNav/NavSection.cjs +0 -1
- package/dist/MainNav/NavSection.js +0 -49
- package/dist/MainNav/NavSections.cjs +0 -1
- package/dist/MainNav/NavSections.js +0 -21
- package/dist/MainNav/NavUser.cjs +0 -7
- package/dist/MainNav/NavUser.js +0 -54
- package/dist/MainNav/index.cjs +0 -1
- package/dist/MainNav/index.js +0 -16
- package/dist/ModalLayout/ModalBody.cjs +0 -4
- package/dist/ModalLayout/ModalBody.js +0 -13
- package/dist/ModalLayout/ModalContext.cjs +0 -1
- package/dist/ModalLayout/ModalContext.js +0 -6
- package/dist/ModalLayout/ModalFooter.cjs +0 -8
- package/dist/ModalLayout/ModalFooter.js +0 -32
- package/dist/ModalLayout/ModalHeader.cjs +0 -4
- package/dist/ModalLayout/ModalHeader.js +0 -37
- package/dist/ModalLayout/ModalLayout.cjs +0 -12
- package/dist/ModalLayout/ModalLayout.js +0 -42
- package/dist/ModalLayout/index.cjs +0 -1
- package/dist/ModalLayout/index.js +0 -10
- package/dist/NumberInput/NumberInput.cjs +0 -12
- package/dist/NumberInput/NumberInput.js +0 -179
- package/dist/NumberInput/index.cjs +0 -1
- package/dist/NumberInput/index.js +0 -4
- package/dist/Pagination/Pagination.cjs +0 -5
- package/dist/Pagination/Pagination.js +0 -30
- package/dist/Pagination/PaginationContext.cjs +0 -1
- package/dist/Pagination/PaginationContext.js +0 -6
- package/dist/Pagination/assets/next.cjs +0 -1
- package/dist/Pagination/assets/next.js +0 -4
- package/dist/Pagination/assets/previous.cjs +0 -1
- package/dist/Pagination/assets/previous.js +0 -4
- package/dist/Pagination/components.cjs +0 -36
- package/dist/Pagination/components.js +0 -111
- package/dist/Pagination/index.cjs +0 -1
- package/dist/Pagination/index.js +0 -9
- package/dist/Popover/Popover.cjs +0 -26
- package/dist/Popover/Popover.js +0 -122
- package/dist/Popover/index.cjs +0 -1
- package/dist/Popover/index.js +0 -5
- package/dist/Portal/Portal.cjs +0 -1
- package/dist/Portal/Portal.js +0 -15
- package/dist/Portal/index.cjs +0 -1
- package/dist/Portal/index.js +0 -4
- package/dist/ProgressBar/ProgressBar.cjs +0 -21
- package/dist/ProgressBar/ProgressBar.js +0 -58
- package/dist/ProgressBar/index.cjs +0 -1
- package/dist/ProgressBar/index.js +0 -4
- package/dist/Radio/Radio.cjs +0 -4
- package/dist/Radio/Radio.js +0 -24
- package/dist/Radio/index.cjs +0 -1
- package/dist/Radio/index.js +0 -6
- package/dist/RawTable/RawCell.cjs +0 -1
- package/dist/RawTable/RawCell.js +0 -80
- package/dist/RawTable/RawTable.cjs +0 -1
- package/dist/RawTable/RawTable.js +0 -73
- package/dist/RawTable/RawTableContext.cjs +0 -1
- package/dist/RawTable/RawTableContext.js +0 -12
- package/dist/RawTable/RawTbody.cjs +0 -1
- package/dist/RawTable/RawTbody.js +0 -16
- package/dist/RawTable/RawThead.cjs +0 -1
- package/dist/RawTable/RawThead.js +0 -14
- package/dist/RawTable/RawTr.cjs +0 -1
- package/dist/RawTable/RawTr.js +0 -19
- package/dist/RawTable/focusFocusable.cjs +0 -1
- package/dist/RawTable/focusFocusable.js +0 -7
- package/dist/RawTable/index.cjs +0 -1
- package/dist/RawTable/index.js +0 -13
- package/dist/Searchbar/SearchForm.cjs +0 -1
- package/dist/Searchbar/SearchForm.js +0 -8
- package/dist/Searchbar/Searchbar.cjs +0 -29
- package/dist/Searchbar/Searchbar.js +0 -79
- package/dist/Searchbar/index.cjs +0 -1
- package/dist/Searchbar/index.js +0 -6
- package/dist/Select/MultiSelectNested.cjs +0 -1
- package/dist/Select/MultiSelectNested.js +0 -26
- package/dist/Select/OptGroup.cjs +0 -1
- package/dist/Select/OptGroup.js +0 -20
- package/dist/Select/Option.cjs +0 -49
- package/dist/Select/Option.js +0 -104
- package/dist/Select/Select.cjs +0 -3
- package/dist/Select/Select.js +0 -232
- package/dist/Select/SelectButton.cjs +0 -19
- package/dist/Select/SelectButton.js +0 -64
- package/dist/Select/SelectList.cjs +0 -1
- package/dist/Select/SelectList.js +0 -81
- package/dist/Select/SelectTags.cjs +0 -8
- package/dist/Select/SelectTags.js +0 -36
- 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/index.cjs +0 -1
- package/dist/Select/index.js +0 -12
- package/dist/Select/utils.cjs +0 -1
- package/dist/Select/utils.js +0 -17
- package/dist/SimpleMenu/SimpleMenu.cjs +0 -19
- package/dist/SimpleMenu/SimpleMenu.js +0 -164
- package/dist/SimpleMenu/index.cjs +0 -1
- package/dist/SimpleMenu/index.js +0 -5
- package/dist/SimpleMenu/utils.cjs +0 -12
- package/dist/SimpleMenu/utils.js +0 -15
- package/dist/Stack/Stack.cjs +0 -19
- package/dist/Stack/Stack.js +0 -55
- package/dist/Stack/index.cjs +0 -1
- package/dist/Stack/index.js +0 -4
- package/dist/Status/Status.cjs +0 -11
- package/dist/Status/Status.js +0 -46
- package/dist/Status/index.cjs +0 -1
- package/dist/Status/index.js +0 -4
- package/dist/SubNav/SubNav.cjs +0 -10
- package/dist/SubNav/SubNav.js +0 -26
- package/dist/SubNav/SubNavHeader.cjs +0 -4
- package/dist/SubNav/SubNavHeader.js +0 -98
- package/dist/SubNav/SubNavLink.cjs +0 -39
- package/dist/SubNav/SubNavLink.js +0 -80
- package/dist/SubNav/SubNavLinkSection.cjs +0 -19
- package/dist/SubNav/SubNavLinkSection.js +0 -68
- package/dist/SubNav/SubNavSection.cjs +0 -8
- package/dist/SubNav/SubNavSection.js +0 -63
- package/dist/SubNav/SubNavSectionLabel.cjs +0 -9
- package/dist/SubNav/SubNavSectionLabel.js +0 -53
- package/dist/SubNav/SubNavSections.cjs +0 -1
- package/dist/SubNav/SubNavSections.js +0 -20
- package/dist/SubNav/index.cjs +0 -1
- package/dist/SubNav/index.js +0 -15
- package/dist/Switch/Switch.cjs +0 -42
- package/dist/Switch/Switch.js +0 -80
- package/dist/Switch/index.cjs +0 -1
- package/dist/Switch/index.js +0 -4
- package/dist/Table/Cell.cjs +0 -17
- package/dist/Table/Cell.js +0 -39
- package/dist/Table/TFooter.cjs +0 -22
- package/dist/Table/TFooter.js +0 -50
- package/dist/Table/Table.cjs +0 -36
- package/dist/Table/Table.js +0 -80
- package/dist/Table/Tbody.cjs +0 -5
- package/dist/Table/Tbody.js +0 -13
- package/dist/Table/Thead.cjs +0 -3
- package/dist/Table/Thead.js +0 -11
- package/dist/Table/Tr.cjs +0 -20
- package/dist/Table/Tr.js +0 -28
- package/dist/Table/index.cjs +0 -1
- package/dist/Table/index.js +0 -15
- package/dist/Tabs/TabGroup.cjs +0 -1
- package/dist/Tabs/TabGroup.js +0 -36
- package/dist/Tabs/TabPanels.cjs +0 -1
- package/dist/Tabs/TabPanels.js +0 -32
- package/dist/Tabs/Tabs.cjs +0 -5
- package/dist/Tabs/Tabs.js +0 -134
- package/dist/Tabs/TabsContext.cjs +0 -1
- package/dist/Tabs/TabsContext.js +0 -6
- package/dist/Tabs/components.cjs +0 -43
- package/dist/Tabs/components.js +0 -52
- package/dist/Tabs/index.cjs +0 -1
- package/dist/Tabs/index.js +0 -10
- package/dist/Tabs/useTabsFocus.cjs +0 -1
- package/dist/Tabs/useTabsFocus.js +0 -16
- package/dist/Tag/Tag.cjs +0 -14
- package/dist/Tag/Tag.js +0 -60
- package/dist/Tag/index.cjs +0 -1
- package/dist/Tag/index.js +0 -4
- package/dist/TextButton/TextButton.cjs +0 -32
- package/dist/TextButton/TextButton.js +0 -82
- package/dist/TextButton/index.cjs +0 -1
- package/dist/TextButton/index.js +0 -4
- package/dist/TextInput/TextInput.cjs +0 -1
- package/dist/TextInput/TextInput.js +0 -69
- package/dist/TextInput/index.cjs +0 -1
- package/dist/TextInput/index.js +0 -4
- package/dist/Textarea/Textarea.cjs +0 -15
- package/dist/Textarea/Textarea.js +0 -74
- package/dist/Textarea/TextareaInput.cjs +0 -30
- package/dist/Textarea/TextareaInput.js +0 -68
- package/dist/Textarea/index.cjs +0 -1
- package/dist/Textarea/index.js +0 -4
- package/dist/ThemeProvider/ThemeProvider.cjs +0 -173
- package/dist/ThemeProvider/ThemeProvider.js +0 -186
- package/dist/ThemeProvider/hooks.cjs +0 -1
- package/dist/ThemeProvider/hooks.js +0 -5
- package/dist/ThemeProvider/index.cjs +0 -1
- package/dist/ThemeProvider/index.js +0 -6
- package/dist/TimePicker/TimePicker.cjs +0 -12
- package/dist/TimePicker/TimePicker.js +0 -104
- package/dist/TimePicker/index.cjs +0 -1
- package/dist/TimePicker/index.js +0 -4
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +0 -36
- package/dist/ToggleCheckbox/ToggleCheckbox.js +0 -119
- package/dist/ToggleCheckbox/index.cjs +0 -1
- package/dist/ToggleCheckbox/index.js +0 -4
- package/dist/ToggleInput/ToggleInput.cjs +0 -6
- package/dist/ToggleInput/ToggleInput.js +0 -90
- package/dist/ToggleInput/index.cjs +0 -1
- package/dist/ToggleInput/index.js +0 -4
- package/dist/Tooltip/Tooltip.cjs +0 -6
- package/dist/Tooltip/Tooltip.js +0 -60
- package/dist/Tooltip/hooks/useTooltipHandlers.cjs +0 -1
- package/dist/Tooltip/hooks/useTooltipHandlers.js +0 -22
- package/dist/Tooltip/hooks/useTooltipLayout.cjs +0 -1
- package/dist/Tooltip/hooks/useTooltipLayout.js +0 -14
- package/dist/Tooltip/index.cjs +0 -1
- package/dist/Tooltip/index.js +0 -4
- package/dist/Tooltip/utils/positionTooltip.cjs +0 -1
- package/dist/Tooltip/utils/positionTooltip.js +0 -27
- package/dist/Typography/Typography.cjs +0 -10
- package/dist/Typography/Typography.js +0 -23
- package/dist/Typography/TypographyProps.cjs +0 -1
- package/dist/Typography/TypographyProps.js +0 -31
- package/dist/Typography/constants.cjs +0 -1
- package/dist/Typography/constants.js +0 -11
- package/dist/Typography/index.cjs +0 -1
- package/dist/Typography/index.js +0 -4
- package/dist/Typography/utils.cjs +0 -34
- package/dist/Typography/utils.js +0 -59
- package/dist/VisuallyHidden/VisuallyHidden.cjs +0 -10
- package/dist/VisuallyHidden/VisuallyHidden.js +0 -14
- package/dist/VisuallyHidden/index.cjs +0 -1
- package/dist/VisuallyHidden/index.js +0 -4
- package/dist/helpers/escapeSelector.cjs +0 -1
- package/dist/helpers/escapeSelector.js +0 -4
- package/dist/helpers/genId.cjs +0 -1
- package/dist/helpers/genId.js +0 -5
- package/dist/helpers/getDefaultLocale.cjs +0 -1
- package/dist/helpers/getDefaultLocale.js +0 -4
- package/dist/helpers/getFocusableNodes.cjs +0 -1
- package/dist/helpers/getFocusableNodes.js +0 -7
- package/dist/helpers/handleResponsiveValues.cjs +0 -5
- package/dist/helpers/handleResponsiveValues.js +0 -19
- package/dist/helpers/keyboardKeys.cjs +0 -1
- package/dist/helpers/keyboardKeys.js +0 -20
- package/dist/helpers/setOpacity.cjs +0 -1
- package/dist/helpers/setOpacity.js +0 -4
- package/dist/helpers/setTabIndexOnFirstItem.cjs +0 -1
- package/dist/helpers/setTabIndexOnFirstItem.js +0 -7
- package/dist/helpers/useElementOnScreen.cjs +0 -1
- package/dist/helpers/useElementOnScreen.js +0 -15
- package/dist/helpers/useId.cjs +0 -1
- package/dist/helpers/useId.js +0 -6
- package/dist/helpers/useIntersection.cjs +0 -1
- package/dist/helpers/useIntersection.js +0 -21
- package/dist/helpers/useLockScroll.cjs +0 -1
- package/dist/helpers/useLockScroll.js +0 -9
- package/dist/helpers/usePrevious.cjs +0 -1
- package/dist/helpers/usePrevious.js +0 -10
- package/dist/helpers/useResizeObserver.cjs +0 -1
- package/dist/helpers/useResizeObserver.js +0 -14
- package/dist/index.cjs +0 -1
- package/dist/index.js +0 -290
- package/dist/themes/ColorButton.cjs +0 -3
- package/dist/themes/ColorButton.js +0 -25
- package/dist/themes/colors.cjs +0 -1
- package/dist/themes/colors.js +0 -49
- package/dist/themes/common-theme.cjs +0 -1
- package/dist/themes/common-theme.js +0 -21
- package/dist/themes/darkTheme/dark-colors.cjs +0 -1
- package/dist/themes/darkTheme/dark-colors.js +0 -52
- package/dist/themes/darkTheme/dark-shadows.cjs +0 -1
- package/dist/themes/darkTheme/dark-shadows.js +0 -12
- package/dist/themes/darkTheme/index.cjs +0 -1
- package/dist/themes/darkTheme/index.js +0 -11
- package/dist/themes/extendTheme.cjs +0 -13
- package/dist/themes/extendTheme.js +0 -36
- package/dist/themes/index.cjs +0 -1
- package/dist/themes/index.js +0 -12
- package/dist/themes/lightTheme/index.cjs +0 -1
- package/dist/themes/lightTheme/index.js +0 -11
- package/dist/themes/lightTheme/light-colors.cjs +0 -1
- package/dist/themes/lightTheme/light-colors.js +0 -52
- package/dist/themes/lightTheme/light-shadows.cjs +0 -1
- package/dist/themes/lightTheme/light-shadows.js +0 -12
- package/dist/themes/sizes.cjs +0 -1
- package/dist/themes/sizes.js +0 -13
- package/dist/themes/utils.cjs +0 -41
- package/dist/themes/utils.js +0 -46
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +0 -9
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +0 -38
- package/dist/v2/Breadcrumbs/Crumb.cjs +0 -1
- package/dist/v2/Breadcrumbs/Crumb.js +0 -27
- package/dist/v2/Breadcrumbs/CrumbLink.cjs +0 -14
- package/dist/v2/Breadcrumbs/CrumbLink.js +0 -31
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +0 -8
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +0 -28
- package/dist/v2/Breadcrumbs/Divider.cjs +0 -1
- package/dist/v2/Breadcrumbs/Divider.js +0 -15
- package/dist/v2/Breadcrumbs/index.cjs +0 -1
- package/dist/v2/Breadcrumbs/index.js +0 -10
- package/dist/v2/Link/Link.cjs +0 -23
- package/dist/v2/Link/Link.js +0 -69
- package/dist/v2/Link/index.cjs +0 -1
- package/dist/v2/Link/index.js +0 -4
- package/dist/v2/LinkButton/LinkButton.cjs +0 -33
- package/dist/v2/LinkButton/LinkButton.js +0 -95
- package/dist/v2/LinkButton/index.cjs +0 -1
- package/dist/v2/LinkButton/index.js +0 -4
- package/dist/v2/MainNav/MainNav.cjs +0 -9
- package/dist/v2/MainNav/MainNav.js +0 -30
- package/dist/v2/MainNav/MainNavContext.cjs +0 -1
- package/dist/v2/MainNav/MainNavContext.js +0 -6
- package/dist/v2/MainNav/NavBrand.cjs +0 -12
- package/dist/v2/MainNav/NavBrand.js +0 -68
- package/dist/v2/MainNav/NavCondense.cjs +0 -20
- package/dist/v2/MainNav/NavCondense.js +0 -45
- package/dist/v2/MainNav/NavLink.cjs +0 -69
- package/dist/v2/MainNav/NavLink.js +0 -122
- package/dist/v2/MainNav/NavSection.cjs +0 -1
- package/dist/v2/MainNav/NavSection.js +0 -49
- package/dist/v2/MainNav/NavSections.cjs +0 -1
- package/dist/v2/MainNav/NavSections.js +0 -21
- package/dist/v2/MainNav/NavUser.cjs +0 -7
- package/dist/v2/MainNav/NavUser.js +0 -54
- package/dist/v2/MainNav/index.cjs +0 -1
- package/dist/v2/MainNav/index.js +0 -16
- package/dist/v2/Pagination/Pagination.cjs +0 -5
- package/dist/v2/Pagination/Pagination.js +0 -30
- package/dist/v2/Pagination/PaginationContext.cjs +0 -1
- package/dist/v2/Pagination/PaginationContext.js +0 -6
- package/dist/v2/Pagination/assets/next.cjs +0 -1
- package/dist/v2/Pagination/assets/next.js +0 -4
- package/dist/v2/Pagination/assets/previous.cjs +0 -1
- package/dist/v2/Pagination/assets/previous.js +0 -4
- package/dist/v2/Pagination/components.cjs +0 -36
- package/dist/v2/Pagination/components.js +0 -111
- package/dist/v2/Pagination/index.cjs +0 -1
- package/dist/v2/Pagination/index.js +0 -9
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +0 -19
- package/dist/v2/SimpleMenu/SimpleMenu.js +0 -164
- package/dist/v2/SimpleMenu/index.cjs +0 -1
- package/dist/v2/SimpleMenu/index.js +0 -5
- package/dist/v2/SimpleMenu/utils.cjs +0 -12
- package/dist/v2/SimpleMenu/utils.js +0 -15
- package/dist/v2/SubNav/SubNav.cjs +0 -10
- package/dist/v2/SubNav/SubNav.js +0 -26
- package/dist/v2/SubNav/SubNavHeader.cjs +0 -4
- package/dist/v2/SubNav/SubNavHeader.js +0 -98
- package/dist/v2/SubNav/SubNavLink.cjs +0 -39
- package/dist/v2/SubNav/SubNavLink.js +0 -83
- package/dist/v2/SubNav/SubNavLinkSection.cjs +0 -19
- package/dist/v2/SubNav/SubNavLinkSection.js +0 -68
- package/dist/v2/SubNav/SubNavSection.cjs +0 -8
- package/dist/v2/SubNav/SubNavSection.js +0 -63
- package/dist/v2/SubNav/SubNavSectionLabel.cjs +0 -9
- package/dist/v2/SubNav/SubNavSectionLabel.js +0 -53
- package/dist/v2/SubNav/SubNavSections.cjs +0 -1
- package/dist/v2/SubNav/SubNavSections.js +0 -20
- package/dist/v2/SubNav/index.cjs +0 -1
- package/dist/v2/SubNav/index.js +0 -15
- package/dist/v2/index.cjs +0 -1
- package/dist/v2/index.js +0 -51
- package/vite.config.js +0 -35
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
jest: true,
|
|
4
|
+
browser: true,
|
|
5
|
+
node: true,
|
|
6
|
+
},
|
|
7
|
+
parserOptions: {
|
|
8
|
+
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
|
|
9
|
+
sourceType: 'module', // Allows for the use of imports
|
|
10
|
+
ecmaFeatures: {
|
|
11
|
+
jsx: true, // Allows for the parsing of JSX
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
settings: {
|
|
15
|
+
react: {
|
|
16
|
+
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
extends: [
|
|
20
|
+
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
|
|
21
|
+
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
|
|
22
|
+
],
|
|
23
|
+
rules: {
|
|
24
|
+
'react/sort-prop-types': 1,
|
|
25
|
+
'default-case': 'error',
|
|
26
|
+
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: false }],
|
|
27
|
+
'no-undef': 'error',
|
|
28
|
+
},
|
|
29
|
+
overrides: [
|
|
30
|
+
{
|
|
31
|
+
files: '*.mdx',
|
|
32
|
+
parser: 'eslint-mdx',
|
|
33
|
+
rules: {
|
|
34
|
+
'react/react-in-jsx-scope': 'off',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
package/.prettierrc.js
ADDED
|
File without changes
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const excludedFolders = require('../../tools/excludedFolders');
|
|
4
|
+
|
|
5
|
+
const isV2Build = process.env.IS_V2 === 'true';
|
|
6
|
+
let entryFolder = isV2Build ? path.resolve(__dirname, 'src', 'v2') : path.resolve(__dirname, 'src');
|
|
7
|
+
const fileNames = fs.readdirSync(entryFolder);
|
|
8
|
+
const entries = fileNames.filter((name) => !excludedFolders.includes(name));
|
|
9
|
+
|
|
10
|
+
const createIndexFile = async (fileName) => {
|
|
11
|
+
const name = fileName.replace('.js', '');
|
|
12
|
+
const content = `
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
if (process.env.NODE_ENV === "production") {
|
|
16
|
+
module.exports = require("./${name}.production.js");
|
|
17
|
+
} else {
|
|
18
|
+
module.exports = require("./${name}.development.js");
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const outputPath = isV2Build
|
|
24
|
+
? path.resolve(__dirname, 'dist', 'v2', `${name}.js`)
|
|
25
|
+
: path.resolve(__dirname, 'dist', `${name}.js`);
|
|
26
|
+
fs.writeFile(outputPath, content);
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.log(err);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
entries.forEach((entry) => {
|
|
33
|
+
createIndexFile(entry);
|
|
34
|
+
});
|
package/global-setup.js
CHANGED
package/jest.config.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
module.exports = {
|
|
2
2
|
testRegex: ['src/.*\\.spec\\.(jsx|js)$', 'tests/.*\\.spec.js$'],
|
|
3
3
|
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect', './test-bundler.js'],
|
|
4
4
|
moduleNameMapper: {
|
|
5
5
|
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
|
6
6
|
'<rootDir>/__mocks__/fileMock.js',
|
|
7
7
|
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
|
|
8
|
+
'^@strapi/icons/(.*)': '<rootDir>/../strapi-icons/dist/$1',
|
|
9
|
+
'^@strapi/icons': '<rootDir>/../strapi-icons/dist/index.js',
|
|
8
10
|
},
|
|
9
11
|
testEnvironment: 'jsdom',
|
|
10
12
|
transform: {
|
package/package.json
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/design-system",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.1",
|
|
4
|
+
"main": "index.js",
|
|
4
5
|
"license": "MIT",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.cjs",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"require": "./dist/index.cjs"
|
|
12
|
-
},
|
|
13
|
-
"./*": {
|
|
14
|
-
"import": "./dist/*.js",
|
|
15
|
-
"require": "./dist/*.cjs"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"sideEffects": false,
|
|
19
6
|
"dependencies": {
|
|
20
7
|
"@floating-ui/react-dom": "^1.0.0",
|
|
21
8
|
"@internationalized/number": "^3.1.1",
|
|
@@ -23,6 +10,10 @@
|
|
|
23
10
|
"prop-types": "^15.7.2"
|
|
24
11
|
},
|
|
25
12
|
"devDependencies": {
|
|
13
|
+
"@babel/core": "^7.13.10",
|
|
14
|
+
"@babel/plugin-transform-runtime": "^7.13.2",
|
|
15
|
+
"@babel/preset-env": "^7.13.0",
|
|
16
|
+
"@babel/preset-react": "^7.12.13",
|
|
26
17
|
"@figspec/react": "^0.1.5",
|
|
27
18
|
"@juggle/resize-observer": "^3.4.0",
|
|
28
19
|
"@playwright/test": "1.27.1",
|
|
@@ -30,12 +21,13 @@
|
|
|
30
21
|
"@storybook/addon-essentials": "^6.5.13",
|
|
31
22
|
"@storybook/addon-links": "^6.5.13",
|
|
32
23
|
"@storybook/react": "^6.5.13",
|
|
33
|
-
"@strapi/icons": "^1.3.0-beta.0",
|
|
34
24
|
"@swc/core": "^1.3.11",
|
|
35
25
|
"@swc/jest": "^0.2.23",
|
|
36
26
|
"@testing-library/jest-dom": "^5.16.5",
|
|
37
27
|
"@testing-library/react": "^11.2.5",
|
|
38
28
|
"axe-playwright": "^1.1.11",
|
|
29
|
+
"babel-loader": "^8.2.2",
|
|
30
|
+
"clean-webpack-plugin": "^3.0.0",
|
|
39
31
|
"cross-env": "^7.0.3",
|
|
40
32
|
"eslint": "^7.20.0",
|
|
41
33
|
"eslint-config-prettier": "^7.2.0",
|
|
@@ -46,32 +38,34 @@
|
|
|
46
38
|
"jest": "^29.2.2",
|
|
47
39
|
"jest-environment-jsdom": "^29.2.2",
|
|
48
40
|
"jest-styled-components": "^7.1.1",
|
|
49
|
-
"prettier": "^2.
|
|
41
|
+
"prettier": "^2.2.1",
|
|
50
42
|
"qs": "^6.10.3",
|
|
51
43
|
"react": "^17.0.1",
|
|
52
44
|
"react-copy-to-clipboard": "^5.0.4",
|
|
53
45
|
"react-dom": "^17.0.1",
|
|
54
46
|
"react-router-dom": "^5.2.0",
|
|
55
47
|
"storybook-dark-mode": "^1.1.2",
|
|
56
|
-
"styled-components": "^5.
|
|
48
|
+
"styled-components": "^5.3.6",
|
|
49
|
+
"url-loader": "^4.1.1",
|
|
50
|
+
"webpack-bundle-analyzer": "^4.4.0",
|
|
51
|
+
"webpack-cli": "^4.5.0"
|
|
57
52
|
},
|
|
58
53
|
"peerDependencies": {
|
|
59
|
-
"@strapi/icons": "^1.2.
|
|
54
|
+
"@strapi/icons": "^1.2.7",
|
|
60
55
|
"react": "^17.0.1",
|
|
61
56
|
"react-dom": "^17.0.1",
|
|
62
57
|
"react-router-dom": "^5.2.0",
|
|
63
58
|
"styled-components": "^5.2.1"
|
|
64
59
|
},
|
|
65
|
-
"peerDependenciesMeta": {
|
|
66
|
-
"react-router-dom": {
|
|
67
|
-
"optional": true
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
60
|
"scripts": {
|
|
71
|
-
"
|
|
61
|
+
"analyze:bundle": "cross-env BUNDLE_ANALYZE=1 webpack",
|
|
72
62
|
"prebuild": "rimraf dist",
|
|
73
|
-
"build": "yarn build:
|
|
74
|
-
"build:
|
|
63
|
+
"build": "yarn build:files && cross-env IS_V2=true yarn build:files",
|
|
64
|
+
"build:files": "yarn build:dev && yarn build:prod && yarn copy:files && yarn create:index-files",
|
|
65
|
+
"build:dev": "cross-env NODE_ENV=development webpack-cli",
|
|
66
|
+
"build:prod": "cross-env NODE_ENV=production webpack-cli",
|
|
67
|
+
"copy:files": "node ../../tools/copy-files.js",
|
|
68
|
+
"create:index-files": "node ./createIndexFiles.js",
|
|
75
69
|
"build-storybook": "build-storybook",
|
|
76
70
|
"lint": "eslint . --ext .js,.jsx,.mdx --fix",
|
|
77
71
|
"lint-staged": "eslint --fix",
|
|
@@ -83,5 +77,5 @@
|
|
|
83
77
|
"test:e2e:watch": "chokidar '**/__tests__/*.e2e.js' -c 'npm run test:e2e -- --retries=0 {path}'",
|
|
84
78
|
"test:e2e:debug": "cross-env PWDEBUG=1 playwright test"
|
|
85
79
|
},
|
|
86
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "bfb372de4377a8b345c7801758c10d3d0bac509c"
|
|
87
81
|
}
|
package/playwright.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const { devices } = require('@playwright/test');
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const config = {
|
|
4
4
|
testMatch: '**/__tests__/*.e2e.js',
|
|
5
5
|
// Forbid test.only on CI
|
|
6
6
|
forbidOnly: !!process.env.CI,
|
|
@@ -35,3 +35,5 @@ export default {
|
|
|
35
35
|
},
|
|
36
36
|
],
|
|
37
37
|
};
|
|
38
|
+
|
|
39
|
+
module.exports = config;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
|
|
5
|
+
import { Box } from '../Box';
|
|
4
6
|
import { getCheckboxSize } from './utils';
|
|
7
|
+
|
|
5
8
|
import checkmarkIcon from './assets/checkmark.svg';
|
|
6
9
|
import checkmarkIconDisabled from './assets/checkmark-black.svg';
|
|
7
10
|
|
|
@@ -84,15 +87,17 @@ export const BaseCheckbox = ({ indeterminate, size, name, value, onValueChange,
|
|
|
84
87
|
};
|
|
85
88
|
|
|
86
89
|
return (
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
<Box>
|
|
91
|
+
<CheckboxInput
|
|
92
|
+
size={size}
|
|
93
|
+
checked={value}
|
|
94
|
+
onChange={handleValueChange}
|
|
95
|
+
type="checkbox"
|
|
96
|
+
ref={checkboxRef}
|
|
97
|
+
name={name}
|
|
98
|
+
{...inputProps}
|
|
99
|
+
/>
|
|
100
|
+
</Box>
|
|
96
101
|
);
|
|
97
102
|
};
|
|
98
103
|
|
|
@@ -41,7 +41,7 @@ The `BaseCheckbox` can have an indeterminate state.
|
|
|
41
41
|
<Canvas>
|
|
42
42
|
<Story name="indeterminate">
|
|
43
43
|
{() => {
|
|
44
|
-
const [checkedItems, setCheckedItems] =
|
|
44
|
+
const [checkedItems, setCheckedItems] = useState([true, false]);
|
|
45
45
|
const allChecked = checkedItems.every(Boolean);
|
|
46
46
|
const isIndeterminate = checkedItems.some(Boolean) && !allChecked;
|
|
47
47
|
return (
|
|
@@ -55,7 +55,7 @@ import { Checkbox } from '@strapi/design-system/Checkbox';
|
|
|
55
55
|
}}
|
|
56
56
|
>
|
|
57
57
|
{() => {
|
|
58
|
-
const [checkedItems, setCheckedItems] =
|
|
58
|
+
const [checkedItems, setCheckedItems] = useState([true, false]);
|
|
59
59
|
const allChecked = checkedItems.every(Boolean);
|
|
60
60
|
const isIndeterminate = checkedItems.some(Boolean) && !allChecked;
|
|
61
61
|
return (
|
|
@@ -26,7 +26,21 @@ export const DismissibleLayer = ({ children, className, onEscapeKeyDown, onPoint
|
|
|
26
26
|
* @type {(event: PointerEvent) => void}
|
|
27
27
|
*/
|
|
28
28
|
const handlePointerDownOutside = (event) => {
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Because certain elements that live inside modals e.g. Selects
|
|
31
|
+
* render their dropdowns in portals the `layerRef.current.contains(event.target)` fails.
|
|
32
|
+
*
|
|
33
|
+
* Therefore we check the closest portal of the DimissibleLayer (which we're trying to close)
|
|
34
|
+
* and the event that _may_ prematurely close the layer and see if they are equal.
|
|
35
|
+
*/
|
|
36
|
+
const dismissibleLayersReactPortal = layerRef.current.closest('[data-react-portal]');
|
|
37
|
+
const eventsReactPortal = event.target.closest('[data-react-portal]');
|
|
38
|
+
|
|
39
|
+
if (
|
|
40
|
+
layerRef.current &&
|
|
41
|
+
!layerRef.current.contains(event.target) &&
|
|
42
|
+
dismissibleLayersReactPortal === eventsReactPortal
|
|
43
|
+
) {
|
|
30
44
|
onPointerDownOutsideHandler();
|
|
31
45
|
}
|
|
32
46
|
};
|
|
@@ -5,8 +5,9 @@ import { DismissibleLayer } from '../DismissibleLayer';
|
|
|
5
5
|
describe('DismissibleLayer', () => {
|
|
6
6
|
it('should fire onEscapeKeyDown when the ESCAPE key is pressed', () => {
|
|
7
7
|
const onEscapeKeyDownMock = jest.fn();
|
|
8
|
+
const onPointerDownOutsideMock = jest.fn();
|
|
8
9
|
render(
|
|
9
|
-
<DismissibleLayer onEscapeKeyDown={onEscapeKeyDownMock}>
|
|
10
|
+
<DismissibleLayer onEscapeKeyDown={onEscapeKeyDownMock} onPointerDownOutside={onPointerDownOutsideMock}>
|
|
10
11
|
<h1>hello world</h1>
|
|
11
12
|
</DismissibleLayer>,
|
|
12
13
|
);
|
|
@@ -18,9 +19,10 @@ describe('DismissibleLayer', () => {
|
|
|
18
19
|
|
|
19
20
|
it('should fire onPointerDownOutside when the user clicks outside the DismissibleLayer', () => {
|
|
20
21
|
const onPointerDownOutsideMock = jest.fn();
|
|
22
|
+
const onEscapeKeyDownMock = jest.fn();
|
|
21
23
|
render(
|
|
22
24
|
<>
|
|
23
|
-
<DismissibleLayer onPointerDownOutside={onPointerDownOutsideMock}>
|
|
25
|
+
<DismissibleLayer onPointerDownOutside={onPointerDownOutsideMock} onEscapeKeyDown={onEscapeKeyDownMock}>
|
|
24
26
|
<h1>hello world</h1>
|
|
25
27
|
</DismissibleLayer>
|
|
26
28
|
<button>Click me</button>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { cloneElement } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { Tooltip } from '../Tooltip';
|
|
5
5
|
import { BaseButton } from '../BaseButton';
|
|
6
6
|
import { Flex } from '../Flex';
|
|
7
|
+
import { VisuallyHidden } from '../VisuallyHidden';
|
|
7
8
|
|
|
8
9
|
const IconButtonWrapper = styled(BaseButton)`
|
|
9
10
|
display: flex;
|
|
@@ -94,29 +95,42 @@ export const IconButtonGroup = styled(Flex)`
|
|
|
94
95
|
}
|
|
95
96
|
`;
|
|
96
97
|
|
|
97
|
-
export const IconButton = React.forwardRef(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
export const IconButton = React.forwardRef(
|
|
99
|
+
({ label, noBorder, children, icon, disabled, onClick, ['aria-label']: ariaLabel, ...restProps }, ref) => {
|
|
100
|
+
/**
|
|
101
|
+
* @type {React.MouseEventHandler<HTMLButtonElement>}
|
|
102
|
+
*/
|
|
103
|
+
const handleClick = (e) => {
|
|
104
|
+
if (!disabled && onClick) {
|
|
105
|
+
onClick(e);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
if (!label) {
|
|
110
|
+
return (
|
|
111
|
+
<IconButtonWrapper {...restProps} ref={ref} noBorder={noBorder} onClick={handleClick} aria-disabled={disabled}>
|
|
112
|
+
<VisuallyHidden as="span">{ariaLabel}</VisuallyHidden>
|
|
113
|
+
{cloneElement(children ?? icon, {
|
|
114
|
+
'aria-hidden': true,
|
|
115
|
+
focusable: false, // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable
|
|
116
|
+
})}
|
|
117
|
+
</IconButtonWrapper>
|
|
118
|
+
);
|
|
101
119
|
}
|
|
102
|
-
};
|
|
103
120
|
|
|
104
|
-
if (!label) {
|
|
105
121
|
return (
|
|
106
|
-
<
|
|
107
|
-
{
|
|
108
|
-
|
|
122
|
+
<Tooltip label={label}>
|
|
123
|
+
<IconButtonWrapper {...restProps} ref={ref} noBorder={noBorder} onClick={handleClick} aria-disabled={disabled}>
|
|
124
|
+
<VisuallyHidden as="span">{label}</VisuallyHidden>
|
|
125
|
+
{cloneElement(children ?? icon, {
|
|
126
|
+
'aria-hidden': true,
|
|
127
|
+
focusable: false, // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable
|
|
128
|
+
})}
|
|
129
|
+
</IconButtonWrapper>
|
|
130
|
+
</Tooltip>
|
|
109
131
|
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<Tooltip label={label}>
|
|
114
|
-
<IconButtonWrapper {...props} ref={ref} noBorder={noBorder} onClick={handleClick} aria-disabled={disabled}>
|
|
115
|
-
{icon}
|
|
116
|
-
</IconButtonWrapper>
|
|
117
|
-
</Tooltip>
|
|
118
|
-
);
|
|
119
|
-
});
|
|
132
|
+
},
|
|
133
|
+
);
|
|
120
134
|
|
|
121
135
|
IconButton.displayName = 'IconButton';
|
|
122
136
|
|
|
@@ -126,10 +140,36 @@ IconButton.defaultProps = {
|
|
|
126
140
|
disabled: false,
|
|
127
141
|
onClick: undefined,
|
|
128
142
|
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @type {(otherProps: string[]) => (props: Record<string, unknown>, propName: string) => Error | undefined}
|
|
146
|
+
*/
|
|
147
|
+
const throwPropErrorIfNoneAreDefined = (otherProps, propType) => (props, propName) => {
|
|
148
|
+
if (!props[propName] && otherProps.every((otherProp) => !props[otherProp])) {
|
|
149
|
+
return new Error(`One of the following props is required: ${propName}, ${otherProps.join(', ')}`);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
PropTypes.checkPropTypes({ [propName]: PropTypes[propType] }, props, 'prop', 'IconButton');
|
|
153
|
+
};
|
|
154
|
+
|
|
129
155
|
IconButton.propTypes = {
|
|
156
|
+
/**
|
|
157
|
+
* `PropTypes.string` – must be defined if `label` is not defined.
|
|
158
|
+
*/
|
|
159
|
+
['aria-label']: throwPropErrorIfNoneAreDefined(['label'], 'string'),
|
|
160
|
+
/**
|
|
161
|
+
* `PropTypes.node` – must be defined if `icon` is not defined.
|
|
162
|
+
*/
|
|
163
|
+
children: throwPropErrorIfNoneAreDefined(['icon'], 'node'),
|
|
130
164
|
disabled: PropTypes.bool,
|
|
131
|
-
|
|
132
|
-
|
|
165
|
+
/**
|
|
166
|
+
* `PropTypes.node` – must be defined if `children` is not defined.
|
|
167
|
+
*/
|
|
168
|
+
icon: throwPropErrorIfNoneAreDefined(['children'], 'node'),
|
|
169
|
+
/**
|
|
170
|
+
* `PropTypes.string` – must be defined if `aria-label` is not defined.
|
|
171
|
+
*/
|
|
172
|
+
label: throwPropErrorIfNoneAreDefined(['aria-label'], 'string'),
|
|
133
173
|
noBorder: PropTypes.bool,
|
|
134
174
|
onClick: PropTypes.func,
|
|
135
175
|
};
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import { Meta, Story, Canvas } from '@storybook/addon-docs';
|
|
4
4
|
import { ArgsTable } from '@storybook/addon-docs';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
|
|
5
7
|
import Pencil from '@strapi/icons/Pencil';
|
|
6
8
|
import Play from '@strapi/icons/Play';
|
|
7
9
|
import Trash from '@strapi/icons/Trash';
|
|
8
10
|
import Plus from '@strapi/icons/Plus';
|
|
11
|
+
|
|
9
12
|
import { IconButton, IconButtonGroup } from './IconButton';
|
|
10
13
|
import { Box } from '../Box';
|
|
11
14
|
import { Flex } from '../Flex';
|
|
15
|
+
import { Typography } from '../Typography';
|
|
12
16
|
|
|
13
17
|
<Meta title="Design System/Components/IconButton" component={IconButton} />
|
|
14
18
|
|
|
@@ -38,14 +42,22 @@ Icon Buttons are used to perform actions within a page, a table or another objec
|
|
|
38
42
|
|
|
39
43
|
<Canvas>
|
|
40
44
|
<Story name="base">
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
{() => {
|
|
46
|
+
const [currentAction, setCurrentAction] = useState('None Selected');
|
|
47
|
+
return (
|
|
48
|
+
<Box padding={7}>
|
|
49
|
+
<Box paddingBottom={3}>
|
|
50
|
+
<Typography>{currentAction}</Typography>
|
|
51
|
+
</Box>
|
|
52
|
+
<Flex>
|
|
53
|
+
<IconButton onClick={() => setCurrentAction('edit')} label="Edit" icon={<Pencil />} />
|
|
54
|
+
<IconButton onClick={() => setCurrentAction('Create')} label="Create" icon={<Plus />} />
|
|
55
|
+
<IconButton onClick={() => setCurrentAction('Delete')} label="Delete" icon={<Trash />} />
|
|
56
|
+
<IconButton onClick={() => setCurrentAction('Publish')} label="Publish" icon={<Play />} />
|
|
57
|
+
</Flex>
|
|
58
|
+
</Box>
|
|
59
|
+
);
|
|
60
|
+
}}
|
|
49
61
|
</Story>
|
|
50
62
|
</Canvas>
|
|
51
63
|
|
|
@@ -55,14 +67,22 @@ Depending on the status of an action or the permissions, an IconButton can be un
|
|
|
55
67
|
|
|
56
68
|
<Canvas>
|
|
57
69
|
<Story name="disabled">
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
{() => {
|
|
71
|
+
const [currentAction, setCurrentAction] = useState('None Selected');
|
|
72
|
+
return (
|
|
73
|
+
<Box padding={7}>
|
|
74
|
+
<Box paddingBottom={3}>
|
|
75
|
+
<Typography>{currentAction}</Typography>
|
|
76
|
+
</Box>
|
|
77
|
+
<Flex>
|
|
78
|
+
<IconButton disabled onClick={() => setCurrentAction('edit')} label="Edit" icon={<Pencil />} />
|
|
79
|
+
<IconButton disabled onClick={() => setCurrentAction('Create')} label="Create" icon={<Plus />} />
|
|
80
|
+
<IconButton disabled onClick={() => setCurrentAction('Delete')} label="Delete" icon={<Trash />} />
|
|
81
|
+
<IconButton disabled onClick={() => setCurrentAction('Publish')} label="Publish" icon={<Play />} />
|
|
82
|
+
</Flex>
|
|
83
|
+
</Box>
|
|
84
|
+
);
|
|
85
|
+
}}
|
|
66
86
|
</Story>
|
|
67
87
|
</Canvas>
|
|
68
88
|
|
|
@@ -95,6 +115,39 @@ IconButtons can be used within another component is a Group shape.
|
|
|
95
115
|
</Story>
|
|
96
116
|
</Canvas>
|
|
97
117
|
|
|
118
|
+
### Icons as Children & aria-label
|
|
119
|
+
|
|
120
|
+
IconButtons can take Icons as their children and can be fully accessible without a tooltip.
|
|
121
|
+
|
|
122
|
+
<Canvas>
|
|
123
|
+
<Story name="children">
|
|
124
|
+
{() => {
|
|
125
|
+
const [currentAction, setCurrentAction] = useState('None Selected');
|
|
126
|
+
return (
|
|
127
|
+
<Box padding={7}>
|
|
128
|
+
<Box paddingBottom={3}>
|
|
129
|
+
<Typography>{currentAction}</Typography>
|
|
130
|
+
</Box>
|
|
131
|
+
<Flex>
|
|
132
|
+
<IconButton onClick={() => setCurrentAction('Edit')} aria-label={'Edit'}>
|
|
133
|
+
<Pencil />
|
|
134
|
+
</IconButton>
|
|
135
|
+
<IconButton onClick={() => setCurrentAction('Create')} aria-label="Create">
|
|
136
|
+
<Plus />
|
|
137
|
+
</IconButton>
|
|
138
|
+
<IconButton onClick={() => setCurrentAction('Delete')} aria-label="Delete">
|
|
139
|
+
<Trash />
|
|
140
|
+
</IconButton>
|
|
141
|
+
<IconButton onClick={() => setCurrentAction('Publish')} aria-label="Publish">
|
|
142
|
+
<Play />
|
|
143
|
+
</IconButton>
|
|
144
|
+
</Flex>
|
|
145
|
+
</Box>
|
|
146
|
+
);
|
|
147
|
+
}}
|
|
148
|
+
</Story>
|
|
149
|
+
</Canvas>
|
|
150
|
+
|
|
98
151
|
## Props
|
|
99
152
|
|
|
100
153
|
<ArgsTable of={IconButton} />
|
|
@@ -506,12 +506,18 @@ describe('ModalLayout', () => {
|
|
|
506
506
|
Modal Title
|
|
507
507
|
<button
|
|
508
508
|
aria-disabled="false"
|
|
509
|
-
aria-label="Close the modal"
|
|
510
509
|
class="c8 c9"
|
|
511
510
|
type="button"
|
|
512
511
|
>
|
|
512
|
+
<span
|
|
513
|
+
class="c0"
|
|
514
|
+
>
|
|
515
|
+
Close the modal
|
|
516
|
+
</span>
|
|
513
517
|
<svg
|
|
518
|
+
aria-hidden="true"
|
|
514
519
|
fill="none"
|
|
520
|
+
focusable="false"
|
|
515
521
|
height="1em"
|
|
516
522
|
viewBox="0 0 24 24"
|
|
517
523
|
width="1em"
|
package/src/Portal/Portal.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useLayoutEffect, useRef, useState } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
|
|
5
4
|
export const Portal = ({ children }) => {
|
|
6
5
|
const rootRef = useRef(null);
|
|
@@ -24,7 +23,3 @@ export const Portal = ({ children }) => {
|
|
|
24
23
|
|
|
25
24
|
return createPortal(children, rootRef.current);
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
Portal.propTypes = {
|
|
29
|
-
children: PropTypes.node.isRequired,
|
|
30
|
-
};
|
|
@@ -49,20 +49,25 @@ Use a Status sparingly within forms to give an important visual indication. Stat
|
|
|
49
49
|
</Story>
|
|
50
50
|
</Canvas>
|
|
51
51
|
|
|
52
|
-
|
|
53
52
|
### Size
|
|
54
53
|
|
|
55
54
|
<Canvas>
|
|
56
55
|
<Story name="size S">
|
|
57
56
|
<Stack spacing={3}>
|
|
58
57
|
<Status variant="success" size="S" showBullet={false}>
|
|
59
|
-
<Typography fontWeight="bold" textColor="success700">
|
|
58
|
+
<Typography fontWeight="bold" textColor="success700">
|
|
59
|
+
Published
|
|
60
|
+
</Typography>
|
|
60
61
|
</Status>
|
|
61
62
|
<Status variant="secondary" size="S" showBullet={false}>
|
|
62
|
-
<Typography fontWeight="bold" textColor="secondary700">
|
|
63
|
+
<Typography fontWeight="bold" textColor="secondary700">
|
|
64
|
+
Draft
|
|
65
|
+
</Typography>
|
|
63
66
|
</Status>
|
|
64
67
|
<Status variant="alternative" size="S" showBullet={false}>
|
|
65
|
-
<Typography fontWeight="bold" textColor="alternative700">
|
|
68
|
+
<Typography fontWeight="bold" textColor="alternative700">
|
|
69
|
+
Updated
|
|
70
|
+
</Typography>
|
|
66
71
|
</Status>
|
|
67
72
|
</Stack>
|
|
68
73
|
</Story>
|