@loadsmart/loadsmart-ui 6.0.1 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DragDropFile.context-0f0ede42.js → DragDropFile.context-50968b55.js} +1 -1
- package/dist/{DragDropFile.context-0f0ede42.js.map → DragDropFile.context-50968b55.js.map} +1 -1
- package/dist/common/BackButton/BackButton.d.ts +4 -4
- package/dist/common/BackButton/index.d.ts +2 -2
- package/dist/common/CloseButton/CloseButton.d.ts +6 -6
- package/dist/common/CloseButton/index.d.ts +2 -2
- package/dist/common/SelectionWrapper.d.ts +14 -14
- package/dist/components/Accordion/Accordion.context.d.ts +10 -10
- package/dist/components/Accordion/Accordion.d.ts +19 -19
- package/dist/components/Accordion/Accordion.stories.d.ts +8 -8
- package/dist/components/Accordion/Accordion.test.d.ts +1 -1
- package/dist/components/Accordion/index.d.ts +2 -2
- package/dist/components/Banner/Banner.d.ts +25 -25
- package/dist/components/Banner/Banner.stories.d.ts +106 -106
- package/dist/components/Banner/Banner.test.d.ts +1 -1
- package/dist/components/Banner/index.d.ts +2 -2
- package/dist/components/Breadcrumbs/Breadbrumbs.test.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumb.d.ts +8 -8
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +10 -10
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +5 -5
- package/dist/components/Breadcrumbs/index.d.ts +3 -3
- package/dist/components/Button/Button.d.ts +22 -22
- package/dist/components/Button/Button.stories.d.ts +32 -32
- package/dist/components/Button/Button.test.d.ts +1 -1
- package/dist/components/Button/index.d.ts +2 -2
- package/dist/components/Calendar/Calendar.d.ts +9 -9
- package/dist/components/Calendar/Calendar.helpers.d.ts +2 -2
- package/dist/components/Calendar/Calendar.stories.d.ts +21 -21
- package/dist/components/Calendar/Calendar.test.d.ts +1 -1
- package/dist/components/Calendar/Calendar.types.d.ts +63 -63
- package/dist/components/Calendar/Date.helper.d.ts +214 -214
- package/dist/components/Calendar/Date.helper.test.d.ts +1 -1
- package/dist/components/Calendar/DateFormat.helper.d.ts +35 -35
- package/dist/components/Calendar/DateFormat.helper.test.d.ts +1 -1
- package/dist/components/Calendar/Month.helper.d.ts +58 -58
- package/dist/components/Calendar/Month.helper.test.d.ts +1 -1
- package/dist/components/Calendar/PickerModeToggle.d.ts +5 -5
- package/dist/components/Calendar/Pickers/DayPicker.d.ts +9 -9
- package/dist/components/Calendar/Pickers/DayPicker.test.d.ts +1 -1
- package/dist/components/Calendar/Pickers/MonthPicker.d.ts +3 -3
- package/dist/components/Calendar/Pickers/MonthPicker.test.d.ts +1 -1
- package/dist/components/Calendar/Pickers/PickerButton.d.ts +5 -5
- package/dist/components/Calendar/Pickers/YearPicker.d.ts +3 -3
- package/dist/components/Calendar/Pickers/YearPicker.test.d.ts +1 -1
- package/dist/components/Calendar/index.d.ts +9 -9
- package/dist/components/Calendar/useCalendar.d.ts +19 -19
- package/dist/components/Calendar/usePickerMode.d.ts +3 -3
- package/dist/components/Card/Card.d.ts +16 -16
- package/dist/components/Card/Card.stories.d.ts +8 -8
- package/dist/components/Card/Card.test.d.ts +1 -1
- package/dist/components/Card/CardTitle.d.ts +8 -8
- package/dist/components/Card/index.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.d.ts +10 -10
- package/dist/components/Checkbox/Checkbox.stories.d.ts +8 -8
- package/dist/components/Checkbox/Checkbox.test.d.ts +1 -1
- package/dist/components/Checkbox/index.d.ts +2 -2
- package/dist/components/DatePicker/DatePicker.d.ts +13 -13
- package/dist/components/DatePicker/DatePicker.stories.d.ts +22 -22
- package/dist/components/DatePicker/DatePicker.test.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.types.d.ts +27 -27
- package/dist/components/DatePicker/DateRangePicker.d.ts +4 -4
- package/dist/components/DatePicker/DateRangePicker.stories.d.ts +21 -21
- package/dist/components/DatePicker/DateRangePicker.test.d.ts +1 -1
- package/dist/components/DatePicker/index.d.ts +3 -3
- package/dist/components/DatePicker/useDatePicker.d.ts +584 -584
- package/dist/components/DatePicker/useDateRangePicker.d.ts +876 -876
- package/dist/components/Dialog/Dialog.d.ts +37 -37
- package/dist/components/Dialog/Dialog.stories.d.ts +67 -67
- package/dist/components/Dialog/Dialog.test.d.ts +1 -1
- package/dist/components/Dialog/index.d.ts +4 -4
- package/dist/components/Dialog/useDialog.d.ts +12 -12
- package/dist/components/DragDropFile/DragDropFile.context.d.ts +5 -5
- package/dist/components/DragDropFile/DragDropFile.d.ts +7 -7
- package/dist/components/DragDropFile/DragDropFile.stories.d.ts +33 -33
- package/dist/components/DragDropFile/components/DropZone.d.ts +3 -3
- package/dist/components/DragDropFile/components/DropZone.test.d.ts +1 -1
- package/dist/components/DragDropFile/components/FileItem.d.ts +3 -3
- package/dist/components/DragDropFile/components/FileList.d.ts +3 -3
- package/dist/components/DragDropFile/components/FileList.test.d.ts +1 -1
- package/dist/components/DragDropFile/components/Wrapper.d.ts +6 -6
- package/dist/components/DragDropFile/index.d.ts +3 -3
- package/dist/components/DragDropFile/mocks.d.ts +9 -9
- package/dist/components/DragDropFile/styles.d.ts +10 -10
- package/dist/components/DragDropFile/types.d.ts +71 -71
- package/dist/components/Drawer/Drawer.d.ts +28 -28
- package/dist/components/Drawer/Drawer.stories.d.ts +6 -6
- package/dist/components/Drawer/Drawer.test.d.ts +1 -1
- package/dist/components/Drawer/index.d.ts +3 -3
- package/dist/components/Dropdown/Dropdown.context.d.ts +4 -4
- package/dist/components/Dropdown/Dropdown.d.ts +47 -47
- package/dist/components/Dropdown/Dropdown.fixtures.d.ts +12 -12
- package/dist/components/Dropdown/Dropdown.stories.d.ts +12 -12
- package/dist/components/Dropdown/Dropdown.test.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.types.d.ts +49 -49
- package/dist/components/Dropdown/DropdownMenu.d.ts +8 -8
- package/dist/components/Dropdown/DropdownTrigger.d.ts +21 -21
- package/dist/components/Dropdown/index.d.ts +6 -6
- package/dist/components/Dropdown/useDropdown.d.ts +14 -14
- package/dist/components/Dropdown/useDropdown.test.d.ts +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +7 -7
- package/dist/components/EmptyState/EmptyState.mocks.d.ts +7 -7
- package/dist/components/EmptyState/EmptyState.stories.d.ts +32 -32
- package/dist/components/EmptyState/EmptyState.test.d.ts +1 -1
- package/dist/components/EmptyState/EmptyState.types.d.ts +22 -22
- package/dist/components/EmptyState/EmptyStateWithIcon.d.ts +4 -4
- package/dist/components/EmptyState/EmptyStateWithIllustration.d.ts +4 -4
- package/dist/components/EmptyState/Illustration.d.ts +4 -4
- package/dist/components/EmptyState/index.d.ts +3 -3
- package/dist/components/ErrorMessage/ErrorMessage.d.ts +4 -4
- package/dist/components/ErrorMessage/ErrorMessage.stories.d.ts +13 -13
- package/dist/components/ErrorMessage/ErrorMessage.test.d.ts +1 -1
- package/dist/components/ErrorMessage/index.d.ts +2 -2
- package/dist/components/HighlightMatch/HighlightMatch.d.ts +7 -7
- package/dist/components/HighlightMatch/HighlightMatch.stories.d.ts +5 -5
- package/dist/components/HighlightMatch/HighlightMatch.test.d.ts +1 -1
- package/dist/components/HighlightMatch/index.d.ts +2 -2
- package/dist/components/Icon/Icon.d.ts +27 -27
- package/dist/components/Icon/index.d.ts +2 -2
- package/dist/components/IconFactory/IconFactory.d.ts +16 -16
- package/dist/components/IconFactory/IconFactory.fixtures.d.ts +10 -10
- package/dist/components/IconFactory/IconFactory.stories.d.ts +6 -6
- package/dist/components/IconFactory/IconFactory.test.d.ts +1 -1
- package/dist/components/IconFactory/index.d.ts +2 -2
- package/dist/components/Label/Label.d.ts +18 -18
- package/dist/components/Label/Label.stories.d.ts +14 -14
- package/dist/components/Label/Label.test.d.ts +1 -1
- package/dist/components/Label/index.d.ts +2 -2
- package/dist/components/Layout/Box.d.ts +15 -15
- package/dist/components/Layout/Grid.d.ts +11 -11
- package/dist/components/Layout/Group.d.ts +14 -14
- package/dist/components/Layout/Layout.d.ts +16 -16
- package/dist/components/Layout/Layout.stories.d.ts +146 -146
- package/dist/components/Layout/Layout.types.d.ts +3 -3
- package/dist/components/Layout/Layout.utils.d.ts +3 -3
- package/dist/components/Layout/Sidebar.d.ts +13 -13
- package/dist/components/Layout/Stack.d.ts +19 -19
- package/dist/components/Layout/Switcher.d.ts +12 -12
- package/dist/components/Layout/index.d.ts +7 -7
- package/dist/components/Link/Link.d.ts +9 -9
- package/dist/components/Link/Link.stories.d.ts +5 -5
- package/dist/components/Link/Link.test.d.ts +1 -1
- package/dist/components/Link/index.d.ts +3 -3
- package/dist/components/Link/useSafeLink.d.ts +3 -3
- package/dist/components/Loaders/LoadingBar.d.ts +13 -13
- package/dist/components/Loaders/LoadingBar.stories.d.ts +5 -5
- package/dist/components/Loaders/LoadingBar.test.d.ts +1 -1
- package/dist/components/Loaders/LoadingDots.d.ts +5 -5
- package/dist/components/Loaders/LoadingDots.stories.d.ts +6 -6
- package/dist/components/Loaders/LoadingDots.test.d.ts +1 -1
- package/dist/components/Loaders/Spinner.d.ts +5 -5
- package/dist/components/Loaders/Spinner.stories.d.ts +5 -5
- package/dist/components/Loaders/Spinner.test.d.ts +1 -1
- package/dist/components/Loaders/index.d.ts +3 -3
- package/dist/components/Modal/Modal.d.ts +22 -22
- package/dist/components/Modal/Modal.stories.d.ts +30 -30
- package/dist/components/Modal/Modal.test.d.ts +1 -1
- package/dist/components/Modal/index.d.ts +2 -2
- package/dist/components/Pagination/Pagination.constants.d.ts +7 -7
- package/dist/components/Pagination/Pagination.d.ts +3 -3
- package/dist/components/Pagination/Pagination.helper.d.ts +15 -15
- package/dist/components/Pagination/Pagination.stories.d.ts +5 -5
- package/dist/components/Pagination/Pagination.test.d.ts +1 -1
- package/dist/components/Pagination/Pagination.types.d.ts +48 -48
- package/dist/components/Pagination/PaginationItem.d.ts +3 -3
- package/dist/components/Pagination/index.d.ts +2 -2
- package/dist/components/Pagination/usePagination.d.ts +3 -3
- package/dist/components/Pagination/usePagination.test.d.ts +1 -1
- package/dist/components/Popover/Popover.d.ts +10 -10
- package/dist/components/Popover/Popover.stories.d.ts +5 -5
- package/dist/components/Popover/Popover.test.d.ts +1 -1
- package/dist/components/Popover/Popover.types.d.ts +33 -33
- package/dist/components/Popover/index.d.ts +2 -2
- package/dist/components/ProgressBar/ProgressBar.d.ts +9 -9
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +12 -12
- package/dist/components/ProgressBar/ProgressBar.test.d.ts +1 -1
- package/dist/components/ProgressBar/index.d.ts +2 -2
- package/dist/components/Radio/Radio.d.ts +10 -10
- package/dist/components/Radio/Radio.stories.d.ts +8 -8
- package/dist/components/Radio/Radio.test.d.ts +1 -1
- package/dist/components/Radio/index.d.ts +2 -2
- package/dist/components/Section/Section.d.ts +12 -12
- package/dist/components/Section/Section.test.d.ts +1 -1
- package/dist/components/Section/Sections.stories.d.ts +5 -5
- package/dist/components/Section/index.d.ts +2 -2
- package/dist/components/Select/Select.constants.d.ts +2 -2
- package/dist/components/Select/Select.context.d.ts +6 -6
- package/dist/components/Select/Select.d.ts +13 -13
- package/dist/components/Select/Select.fixtures.d.ts +28 -28
- package/dist/components/Select/Select.stories.d.ts +18 -18
- package/dist/components/Select/Select.test.d.ts +1 -1
- package/dist/components/Select/Select.types.d.ts +121 -121
- package/dist/components/Select/SelectCreatableOption.d.ts +3 -3
- package/dist/components/Select/SelectEmpty.d.ts +3 -3
- package/dist/components/Select/SelectEmpty.test.d.ts +1 -1
- package/dist/components/Select/SelectOption.d.ts +3 -3
- package/dist/components/Select/SelectOption.test.d.ts +1 -1
- package/dist/components/Select/SelectTrigger.d.ts +3 -3
- package/dist/components/Select/components.d.ts +2 -2
- package/dist/components/Select/index.d.ts +3 -3
- package/dist/components/Select/useSelect.d.ts +8 -8
- package/dist/components/Select/useSelect.helpers.d.ts +6 -6
- package/dist/components/Select/useSelect.helpers.test.d.ts +1 -1
- package/dist/components/Select/useSelect.test.d.ts +1 -1
- package/dist/components/Select/useSelectExternal.d.ts +2 -2
- package/dist/components/SideNavigation/Logo/Logo.d.ts +14 -14
- package/dist/components/SideNavigation/Logo/Logo.test.d.ts +1 -1
- package/dist/components/SideNavigation/Logo/index.d.ts +1 -1
- package/dist/components/SideNavigation/Menu/Menu.d.ts +17 -17
- package/dist/components/SideNavigation/Menu/Menu.test.d.ts +1 -1
- package/dist/components/SideNavigation/Menu/MenuBaseItem.d.ts +11 -11
- package/dist/components/SideNavigation/Menu/MenuExpandable.d.ts +6 -6
- package/dist/components/SideNavigation/Menu/MenuLink.d.ts +11 -11
- package/dist/components/SideNavigation/Menu/index.d.ts +1 -1
- package/dist/components/SideNavigation/Separator/Separator.d.ts +5 -5
- package/dist/components/SideNavigation/Separator/Separator.test.d.ts +1 -1
- package/dist/components/SideNavigation/Separator/index.d.ts +1 -1
- package/dist/components/SideNavigation/SideNavigation.d.ts +34 -34
- package/dist/components/SideNavigation/SideNavigation.stories.d.ts +5 -5
- package/dist/components/SideNavigation/SideNavigation.test.d.ts +1 -1
- package/dist/components/SideNavigation/index.d.ts +4 -4
- package/dist/components/SideNavigation/useSideNavigation.d.ts +8 -8
- package/dist/components/Steps/ProgressSteps/ProgressStep.d.ts +12 -12
- package/dist/components/Steps/ProgressSteps/ProgressSteps.d.ts +7 -7
- package/dist/components/Steps/ProgressSteps/index.d.ts +1 -1
- package/dist/components/Steps/Steps.d.ts +19 -19
- package/dist/components/Steps/Steps.fixtures.d.ts +6 -6
- package/dist/components/Steps/Steps.helpers.d.ts +2 -2
- package/dist/components/Steps/Steps.stories.d.ts +5 -5
- package/dist/components/Steps/Steps.test.d.ts +1 -1
- package/dist/components/Steps/Steps.types.d.ts +5 -5
- package/dist/components/Steps/StepsContext.d.ts +3 -3
- package/dist/components/Steps/StepsStep.d.ts +8 -8
- package/dist/components/Steps/index.d.ts +5 -5
- package/dist/components/Steps/useStep.test.d.ts +1 -1
- package/dist/components/Steps/useSteps.d.ts +30 -30
- package/dist/components/Switch/Switch.d.ts +11 -11
- package/dist/components/Switch/Switch.stories.d.ts +5 -5
- package/dist/components/Switch/Switch.test.d.ts +1 -1
- package/dist/components/Switch/index.d.ts +2 -2
- package/dist/components/Table/Selection.d.ts +35 -35
- package/dist/components/Table/Table.d.ts +44 -44
- package/dist/components/Table/Table.fixtures.d.ts +29 -29
- package/dist/components/Table/Table.stories.d.ts +61 -61
- package/dist/components/Table/Table.test.d.ts +1 -1
- package/dist/components/Table/Table.types.d.ts +73 -73
- package/dist/components/Table/TableSortHandle.d.ts +7 -7
- package/dist/components/Table/index.d.ts +2 -2
- package/dist/components/Table/useSortBy.d.ts +16 -16
- package/dist/components/Table/useSortBy.test.d.ts +1 -1
- package/dist/components/Table/useSortBy.types.d.ts +16 -16
- package/dist/components/TablePagination/RowsPerPage.d.ts +3 -3
- package/dist/components/TablePagination/TablePagination.d.ts +3 -3
- package/dist/components/TablePagination/TablePagination.stories.d.ts +5 -5
- package/dist/components/TablePagination/TablePagination.styles.d.ts +5 -5
- package/dist/components/TablePagination/TablePagination.test.d.ts +1 -1
- package/dist/components/TablePagination/TablePagination.types.d.ts +59 -59
- package/dist/components/TablePagination/TablePaginationActions.d.ts +10 -10
- package/dist/components/TablePagination/index.d.ts +2 -2
- package/dist/components/Tabs/Tabs.d.ts +54 -54
- package/dist/components/Tabs/Tabs.stories.d.ts +23 -23
- package/dist/components/Tabs/Tabs.test.d.ts +1 -1
- package/dist/components/Tabs/Tabs.types.d.ts +6 -6
- package/dist/components/Tabs/TabsContext.d.ts +9 -9
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/Tag/Tag.d.ts +19 -19
- package/dist/components/Tag/Tag.stories.d.ts +41 -41
- package/dist/components/Tag/Tag.test.d.ts +1 -1
- package/dist/components/Tag/index.d.ts +2 -2
- package/dist/components/Text/Text.d.ts +15 -15
- package/dist/components/Text/Text.stories.d.ts +5 -5
- package/dist/components/Text/Text.test.d.ts +1 -1
- package/dist/components/Text/index.d.ts +2 -2
- package/dist/components/TextField/TextField.d.ts +19 -19
- package/dist/components/TextField/TextField.stories.d.ts +11 -11
- package/dist/components/TextField/TextField.test.d.ts +1 -1
- package/dist/components/TextField/index.d.ts +4 -4
- package/dist/components/TextField/useTextField.d.ts +6 -6
- package/dist/components/Textarea/Textarea.d.ts +17 -17
- package/dist/components/Textarea/Textarea.stories.d.ts +11 -11
- package/dist/components/Textarea/Textarea.test.d.ts +1 -1
- package/dist/components/Textarea/index.d.ts +2 -2
- package/dist/components/Toast/Toast.d.ts +11 -11
- package/dist/components/Toast/Toast.stories.d.ts +12 -12
- package/dist/components/Toast/Toast.test.d.ts +1 -1
- package/dist/components/Toast/index.d.ts +2 -2
- package/dist/components/ToggleGroup/Toggle.d.ts +4 -4
- package/dist/components/ToggleGroup/Toggle.test.d.ts +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.constants.d.ts +2 -2
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +6 -6
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +6 -6
- package/dist/components/ToggleGroup/ToggleGroup.test.d.ts +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.types.d.ts +26 -26
- package/dist/components/ToggleGroup/ToggleGroupContext.d.ts +5 -5
- package/dist/components/ToggleGroup/index.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.d.ts +23 -23
- package/dist/components/Tooltip/Tooltip.stories.d.ts +13 -13
- package/dist/components/Tooltip/Tooltip.test.d.ts +1 -1
- package/dist/components/Tooltip/index.d.ts +2 -2
- package/dist/components/TopNavigation/Logo/Logo.d.ts +14 -14
- package/dist/components/TopNavigation/Logo/Logo.test.d.ts +1 -1
- package/dist/components/TopNavigation/Logo/index.d.ts +1 -1
- package/dist/components/TopNavigation/Menu/Menu.d.ts +18 -18
- package/dist/components/TopNavigation/Menu/Menu.test.d.ts +1 -1
- package/dist/components/TopNavigation/Menu/MenuItemDropdown.d.ts +17 -17
- package/dist/components/TopNavigation/Menu/MenuItemIcon.d.ts +8 -8
- package/dist/components/TopNavigation/Menu/index.d.ts +1 -1
- package/dist/components/TopNavigation/OpenSideNavButton/OpenSideNavButton.d.ts +7 -7
- package/dist/components/TopNavigation/OpenSideNavButton/index.d.ts +1 -1
- package/dist/components/TopNavigation/TopNavigation.d.ts +17 -17
- package/dist/components/TopNavigation/TopNavigation.stories.d.ts +5 -5
- package/dist/components/TopNavigation/index.d.ts +2 -2
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.stories.d.ts +13 -12
- package/dist/components/VisuallyHidden/VisuallyHidden.test.d.ts +1 -1
- package/dist/components/VisuallyHidden/index.d.ts +1 -1
- package/dist/hooks/useClickOutside/index.d.ts +1 -1
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +3 -3
- package/dist/hooks/useClickOutside/useClickOutside.test.d.ts +1 -1
- package/dist/hooks/useDidMount/index.d.ts +1 -1
- package/dist/hooks/useDidMount/useDidMount.d.ts +9 -9
- package/dist/hooks/useDidMount/useDidMount.test.d.ts +1 -1
- package/dist/hooks/useFingerprint/index.d.ts +1 -1
- package/dist/hooks/useFingerprint/useFingerprint.d.ts +18 -18
- package/dist/hooks/useFingerprint/useFingerprint.test.d.ts +1 -1
- package/dist/hooks/useFocusTrap/index.d.ts +2 -2
- package/dist/hooks/useFocusTrap/useFocusTrap.d.ts +27 -27
- package/dist/hooks/useFocusTrap/useFocusTrap.stories.d.ts +7 -7
- package/dist/hooks/useFocusTrap/useFocusTrap.test.d.ts +1 -1
- package/dist/hooks/useFocusWithin/index.d.ts +2 -2
- package/dist/hooks/useFocusWithin/useFocusWithin.d.ts +15 -15
- package/dist/hooks/useFocusWithin/useFocusWithin.test.d.ts +1 -1
- package/dist/hooks/useHeightExpansionToggler/index.d.ts +2 -2
- package/dist/hooks/useHeightExpansionToggler/useHeightExpansionToggler.d.ts +14 -14
- package/dist/hooks/useHeightExpansionToggler/useHeightExpansionToggler.test.d.ts +1 -1
- package/dist/hooks/useID/index.d.ts +1 -1
- package/dist/hooks/useID/useID.d.ts +2 -2
- package/dist/hooks/useSelectable/SelectableStrategy.d.ts +11 -11
- package/dist/hooks/useSelectable/SelectableStrategy.test.d.ts +1 -1
- package/dist/hooks/useSelectable/index.d.ts +2 -2
- package/dist/hooks/useSelectable/useSelectable.d.ts +6 -6
- package/dist/hooks/useSelectable/useSelectable.test.d.ts +1 -1
- package/dist/hooks/useSelectable/useSelectable.types.d.ts +46 -46
- package/dist/hooks/useWindowResize/index.d.ts +1 -1
- package/dist/hooks/useWindowResize/useWindowResize.d.ts +5 -5
- package/dist/index.d.ts +97 -97
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{miranda-compatibility.theme-97e29e8e.js → miranda-compatibility.theme-781b0886.js} +1 -1
- package/dist/miranda-compatibility.theme-781b0886.js.map +1 -0
- package/dist/prop-32998961.js +2 -0
- package/dist/prop-32998961.js.map +1 -0
- package/dist/styles/activatable.d.ts +10 -10
- package/dist/styles/disableable.d.ts +10 -10
- package/dist/styles/ellipsizable.d.ts +7 -7
- package/dist/styles/focusable.d.ts +10 -10
- package/dist/styles/font.d.ts +16 -16
- package/dist/styles/font.test.d.ts +1 -1
- package/dist/styles/hidden.d.ts +7 -7
- package/dist/styles/hoverable.d.ts +10 -10
- package/dist/styles/transition.d.ts +11 -11
- package/dist/styles/typography.d.ts +27 -27
- package/dist/styles/typography.test.d.ts +1 -1
- package/dist/testing/DatePickerEvent/DatePickerEvent.d.ts +42 -42
- package/dist/testing/DatePickerEvent/DateRangePickerEvent.d.ts +41 -41
- package/dist/testing/DatePickerEvent/index.d.ts +2 -2
- package/dist/testing/DragDropFileEvent/DragDropFileEvent.d.ts +6 -6
- package/dist/testing/DragDropFileEvent/index.d.ts +1 -1
- package/dist/testing/SelectEvent/SelectEvent.d.ts +66 -66
- package/dist/testing/SelectEvent/SelectEvent.test.d.ts +1 -1
- package/dist/testing/SelectEvent/index.d.ts +1 -1
- package/dist/testing/getInterpolatedStyles/getInterpolatedStyles.d.ts +10 -10
- package/dist/testing/getInterpolatedStyles/index.d.ts +1 -1
- package/dist/testing/index.d.ts +5 -5
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/renderWithDragDropFileProvider/index.d.ts +1 -1
- package/dist/testing/renderWithDragDropFileProvider/renderWithDragDropFileProvider.d.ts +5 -5
- package/dist/tests/generator.d.ts +35 -35
- package/dist/tests/renderer.d.ts +10 -10
- package/dist/theming/index.d.ts +16 -16
- package/dist/theming/index.js +1 -1
- package/dist/theming/index.js.map +1 -1
- package/dist/theming/themes/alice.theme.d.ts +755 -755
- package/dist/theming/themes/index.d.ts +3 -3
- package/dist/theming/themes/loadsmart.theme.d.ts +737 -737
- package/dist/theming/themes/miranda-compatibility.theme.d.ts +750 -750
- package/dist/theming/theming.helpers.d.ts +22 -22
- package/dist/{toArray-b56541b4.js → toArray-8fc577bb.js} +1 -1
- package/dist/toArray-8fc577bb.js.map +1 -0
- package/dist/tools/conditional.d.ts +39 -39
- package/dist/tools/conditional.test.d.ts +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +1 -1
- package/dist/tools/prop.d.ts +15 -15
- package/dist/tools/prop.test.d.ts +1 -1
- package/dist/utils/toolset/awaitTo.d.ts +10 -10
- package/dist/utils/toolset/debounce.d.ts +1 -1
- package/dist/utils/toolset/flatten.d.ts +1 -1
- package/dist/utils/toolset/formatBytes.d.ts +4 -4
- package/dist/utils/toolset/formatBytes.test.d.ts +1 -1
- package/dist/utils/toolset/get.d.ts +1 -1
- package/dist/utils/toolset/getID.d.ts +13 -13
- package/dist/utils/toolset/getID.test.d.ts +1 -1
- package/dist/utils/toolset/getOrdinalSuffix.d.ts +1 -1
- package/dist/utils/toolset/getOrdinalSuffix.test.d.ts +1 -1
- package/dist/utils/toolset/highlightMatch.d.ts +9 -9
- package/dist/utils/toolset/highlightMatch.test.d.ts +1 -1
- package/dist/utils/toolset/interleave.d.ts +2 -2
- package/dist/utils/toolset/interleave.test.d.ts +1 -1
- package/dist/utils/toolset/isEmpty.d.ts +1 -1
- package/dist/utils/toolset/isThenable.d.ts +5 -5
- package/dist/utils/toolset/isThenable.test.d.ts +1 -1
- package/dist/utils/toolset/keyboard.d.ts +24 -24
- package/dist/utils/toolset/omit.d.ts +1 -1
- package/dist/utils/toolset/pluralize.d.ts +14 -14
- package/dist/utils/toolset/range.d.ts +1 -1
- package/dist/utils/toolset/rem.d.ts +3 -3
- package/dist/utils/toolset/styledCompounds.d.ts +13 -13
- package/dist/utils/toolset/toArray.d.ts +2 -2
- package/dist/utils/types/ColorScheme.d.ts +2 -2
- package/dist/utils/types/EventLike.d.ts +10 -10
- package/dist/utils/types/InterpolatedStyle.d.ts +2 -2
- package/dist/utils/types/Status.d.ts +7 -7
- package/package.json +8 -9
- package/src/@types/@loadsmart/utilsFunction.d.ts +2 -2
- package/src/@types/@loadsmart/utilsObject.d.ts +2 -2
- package/src/@types/svg.d.ts +3 -3
- package/src/components/Calendar/Date.helper.test.ts +3 -6
- package/src/components/Calendar/Month.helper.test.ts +66 -66
- package/src/components/Calendar/Month.helper.ts +1 -3
- package/src/components/Dialog/useDialog.tsx +1 -5
- package/src/components/DragDropFile/DragDropFile.context.tsx +4 -6
- package/src/components/Dropdown/Dropdown.tsx +4 -6
- package/src/components/Dropdown/useDropdown.ts +1 -4
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Select/Select.test.tsx +2 -2
- package/src/components/Select/SelectOption.test.tsx +1 -1
- package/src/components/Select/useSelect.ts +4 -4
- package/src/components/Table/Table.fixtures.ts +1 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/TopNavigation/Menu/Menu.test.tsx +33 -0
- package/src/components/TopNavigation/Menu/MenuItemDropdown.tsx +6 -2
- package/src/components/TopNavigation/TopNavigation.stories.tsx +4 -1
- package/src/docs/tools/DragDropFileEvent.stories.mdx +1 -5
- package/src/docs/tools/conditional.stories.mdx +35 -28
- package/src/hooks/useClickOutside/useClickOutside.ts +1 -1
- package/src/hooks/useFocusTrap/useFocusTrap.ts +1 -1
- package/src/hooks/useFocusWithin/useFocusWithin.ts +5 -4
- package/src/tools/conditional.ts +1 -1
- package/src/utils/toolset/highlightMatch.test.tsx +1 -1
- package/src/utils/toolset/keyboard.ts +1 -3
- package/dist/miranda-compatibility.theme-97e29e8e.js.map +0 -1
- package/dist/prop-5c502a5a.js +0 -2
- package/dist/prop-5c502a5a.js.map +0 -1
- package/dist/toArray-b56541b4.js.map +0 -1
|
@@ -70,8 +70,7 @@ describe('DateHelper', () => {
|
|
|
70
70
|
|
|
71
71
|
it('converts single `Date` to array [`value`, `value`]', () => {
|
|
72
72
|
expect(getConstraintRange(new Date('2022-01-28T12:00:00.000Z'))).toEqual([
|
|
73
|
-
1643371200000,
|
|
74
|
-
1643371200000,
|
|
73
|
+
1643371200000, 1643371200000,
|
|
75
74
|
])
|
|
76
75
|
})
|
|
77
76
|
|
|
@@ -109,13 +108,11 @@ describe('DateHelper', () => {
|
|
|
109
108
|
|
|
110
109
|
it('converts a pair [`start`, `end`] to array [`start`, `end`]', () => {
|
|
111
110
|
expect(getConstraintRange([1641038400000, 1643371200000])).toEqual([
|
|
112
|
-
1641038400000,
|
|
113
|
-
1643371200000,
|
|
111
|
+
1641038400000, 1643371200000,
|
|
114
112
|
])
|
|
115
113
|
|
|
116
114
|
expect(getConstraintRange(['2022-01-01T12:00:00.000Z', '2022-01-28T12:00:00.000Z'])).toEqual([
|
|
117
|
-
1641038400000,
|
|
118
|
-
1643371200000,
|
|
115
|
+
1641038400000, 1643371200000,
|
|
119
116
|
])
|
|
120
117
|
|
|
121
118
|
expect(
|
|
@@ -13,77 +13,77 @@ describe('MonthHelper', () => {
|
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
// Checks if all aliases return the expected month
|
|
16
|
-
;(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
16
|
+
;(
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
expectedAliases: ['0', 'jan', 'january'],
|
|
20
|
+
month: MONTH_BY_NAME.january,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
expectedAliases: ['1', 'feb', 'february'],
|
|
24
|
+
month: MONTH_BY_NAME.february,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
expectedAliases: ['2', 'mar', 'march'],
|
|
28
|
+
month: MONTH_BY_NAME.march,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
expectedAliases: ['3', 'apr', 'april'],
|
|
32
|
+
month: MONTH_BY_NAME.april,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
expectedAliases: ['4', 'may', 'may'],
|
|
36
|
+
month: MONTH_BY_NAME.may,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
expectedAliases: ['5', 'jun', 'june'],
|
|
40
|
+
month: MONTH_BY_NAME.june,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
expectedAliases: ['6', 'jul', 'july'],
|
|
44
|
+
month: MONTH_BY_NAME.july,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
expectedAliases: ['7', 'aug', 'august'],
|
|
48
|
+
month: MONTH_BY_NAME.august,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
expectedAliases: ['8', 'sep', 'september'],
|
|
52
|
+
month: MONTH_BY_NAME.september,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
expectedAliases: ['9', 'oct', 'october'],
|
|
56
|
+
month: MONTH_BY_NAME.october,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
expectedAliases: ['10', 'nov', 'november'],
|
|
60
|
+
month: MONTH_BY_NAME.november,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
expectedAliases: ['11', 'dec', 'december'],
|
|
64
|
+
month: MONTH_BY_NAME.december,
|
|
65
|
+
},
|
|
66
|
+
] as { expectedAliases: CalendarMonthAlias[]; month: CalendarMonth }[]
|
|
67
|
+
).forEach(({ expectedAliases, month }) => {
|
|
68
|
+
describe(month.name, () => {
|
|
69
|
+
it(`returns ${month.name} month`, () => {
|
|
70
|
+
expectedAliases.forEach((alias) => {
|
|
71
|
+
expect(MonthHelper(alias)).not.toBeNull()
|
|
72
|
+
expect(MonthHelper(alias).get()).toEqual(month)
|
|
73
73
|
})
|
|
74
|
+
})
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
76
|
+
it(`compares ${month.name} months correctly`, () => {
|
|
77
|
+
ALL_MONTHS_ALIASES.forEach((someAlias) => {
|
|
78
|
+
expectedAliases.forEach((expectedAlias) => {
|
|
79
|
+
expect(MonthHelper(someAlias).is(expectedAlias)).toBe(
|
|
80
|
+
expectedAliases.includes(someAlias)
|
|
81
|
+
)
|
|
82
82
|
})
|
|
83
83
|
})
|
|
84
84
|
})
|
|
85
|
-
}
|
|
86
|
-
)
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
87
|
|
|
88
88
|
it('formats correctly', () => {
|
|
89
89
|
const EXPECTED = {
|
|
@@ -125,9 +125,7 @@ function getAllMonths() {
|
|
|
125
125
|
})
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
function MonthHelper(
|
|
129
|
-
alias: CalendarMonthAlias
|
|
130
|
-
): {
|
|
128
|
+
function MonthHelper(alias: CalendarMonthAlias): {
|
|
131
129
|
get(): CalendarMonth
|
|
132
130
|
format(representation?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow'): string
|
|
133
131
|
is(other: CalendarMonthAlias): boolean
|
|
@@ -6,11 +6,7 @@ export interface useDialogProps {
|
|
|
6
6
|
onClose?: () => void
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
function useDialog({
|
|
10
|
-
open: openProp,
|
|
11
|
-
onOpen,
|
|
12
|
-
onClose,
|
|
13
|
-
}: useDialogProps): {
|
|
9
|
+
function useDialog({ open: openProp, onOpen, onClose }: useDialogProps): {
|
|
14
10
|
open: boolean
|
|
15
11
|
show: () => void
|
|
16
12
|
hide: () => void
|
|
@@ -18,12 +18,10 @@ export const DragDropFileProvider = ({
|
|
|
18
18
|
[fileList]
|
|
19
19
|
)
|
|
20
20
|
|
|
21
|
-
const contextValue = useMemo(
|
|
22
|
-
fileList,
|
|
23
|
-
onFilesAdded,
|
|
24
|
-
|
|
25
|
-
onRetryUpload,
|
|
26
|
-
])
|
|
21
|
+
const contextValue = useMemo(
|
|
22
|
+
() => ({ fileList, onFilesAdded, onRemoveFile, onRetryUpload }),
|
|
23
|
+
[fileList, onFilesAdded, onRemoveFile, onRetryUpload]
|
|
24
|
+
)
|
|
27
25
|
|
|
28
26
|
return (
|
|
29
27
|
<DragDropFileContext.Provider value={contextValue}>{children}</DragDropFileContext.Provider>
|
|
@@ -70,12 +70,10 @@ export function GenericDropdown(props: GenericDropdownProps): JSX.Element {
|
|
|
70
70
|
position,
|
|
71
71
|
...others
|
|
72
72
|
} = props
|
|
73
|
-
const contextValue = useMemo(
|
|
74
|
-
expanded,
|
|
75
|
-
toggle,
|
|
76
|
-
|
|
77
|
-
expandDisabled,
|
|
78
|
-
])
|
|
73
|
+
const contextValue = useMemo(
|
|
74
|
+
() => ({ expanded, toggle, disabled, expandDisabled }),
|
|
75
|
+
[expanded, toggle, disabled, expandDisabled]
|
|
76
|
+
)
|
|
79
77
|
const ref = useRef(null)
|
|
80
78
|
|
|
81
79
|
const align = useDeprecatedAlignFromMenu(props)
|
|
@@ -9,10 +9,7 @@ export interface useDropdownProps {
|
|
|
9
9
|
|
|
10
10
|
export interface GenericDropdownProps extends DropdownProps, useDropdownProps {}
|
|
11
11
|
|
|
12
|
-
function useDropdown({
|
|
13
|
-
disabled,
|
|
14
|
-
expandDisabled,
|
|
15
|
-
}: DropdownProps): {
|
|
12
|
+
function useDropdown({ disabled, expandDisabled }: DropdownProps): {
|
|
16
13
|
expanded: boolean
|
|
17
14
|
toggle: () => void
|
|
18
15
|
expand: () => void
|
|
@@ -601,7 +601,7 @@ export const CustomCreatableOption: Story<SelectProps> = ({ onCreate, ...args }:
|
|
|
601
601
|
|
|
602
602
|
const handleCreate = useCallback(
|
|
603
603
|
function handleCreate(query: string) {
|
|
604
|
-
onCreate?.(query)
|
|
604
|
+
void onCreate?.(query)
|
|
605
605
|
|
|
606
606
|
const item: Option = { label: query, value: query } as Option
|
|
607
607
|
|
|
@@ -677,7 +677,7 @@ export const SelectWithFixedCreatableOption: Story<SelectProps> = ({
|
|
|
677
677
|
|
|
678
678
|
const handleCreate = useCallback(
|
|
679
679
|
function handleCreate(query: string) {
|
|
680
|
-
onCreate?.(query)
|
|
680
|
+
void onCreate?.(query)
|
|
681
681
|
},
|
|
682
682
|
[onCreate]
|
|
683
683
|
)
|
|
@@ -598,7 +598,7 @@ describe('Select', () => {
|
|
|
598
598
|
it.each([[{ multiple: false }], [{ multiple: true }]])(
|
|
599
599
|
'does not render the creatable option when onCreate callback is not provided - %s',
|
|
600
600
|
async (args) => {
|
|
601
|
-
setup({ onCreate:
|
|
601
|
+
setup({ onCreate: null as unknown as undefined, ...args })
|
|
602
602
|
|
|
603
603
|
const searchInput = screen.getByLabelText('Select your favorite fruit')
|
|
604
604
|
fire.change(searchInput, {
|
|
@@ -649,7 +649,7 @@ describe('Select', () => {
|
|
|
649
649
|
'does not render creatable option at the end of the list when the onCreate prop is not provided - %s',
|
|
650
650
|
async (args) => {
|
|
651
651
|
setup({
|
|
652
|
-
onCreate:
|
|
652
|
+
onCreate: null as unknown as undefined,
|
|
653
653
|
...args,
|
|
654
654
|
})
|
|
655
655
|
const { label: availableOption } = generator.pickone([...FRUITS])
|
|
@@ -17,7 +17,7 @@ const Setup = ({ optionProps, selectProps }: Props) => {
|
|
|
17
17
|
select.query = query
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<SelectContext.Provider value={
|
|
20
|
+
<SelectContext.Provider value={select as unknown as useSelectReturn}>
|
|
21
21
|
<SelectOption {...optionProps} />
|
|
22
22
|
</SelectContext.Provider>
|
|
23
23
|
)
|
|
@@ -212,10 +212,10 @@ function useSelect(props: SelectProps): useSelectReturn {
|
|
|
212
212
|
} = props
|
|
213
213
|
|
|
214
214
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
215
|
-
const datasources = useMemo<SelectDatasource<any>[]>(
|
|
216
|
-
props
|
|
217
|
-
props.options
|
|
218
|
-
|
|
215
|
+
const datasources = useMemo<SelectDatasource<any>[]>(
|
|
216
|
+
() => getDatasources(props),
|
|
217
|
+
[props.datasources, props.options]
|
|
218
|
+
)
|
|
219
219
|
const adapters = useMemo<Adapters>(() => extractAdapters(datasources), [datasources])
|
|
220
220
|
|
|
221
221
|
const selectable = useSelectable({
|
|
@@ -324,7 +324,7 @@ function ExpandableTableRow({
|
|
|
324
324
|
|
|
325
325
|
let leading: ReactNode = <RotatableIcon name="caret-right" $rotate={open} />
|
|
326
326
|
if (propsLeading) {
|
|
327
|
-
leading = isFunction(propsLeading) ? propsLeading(open) : propsLeading
|
|
327
|
+
leading = (isFunction(propsLeading) ? propsLeading(open) : propsLeading) as unknown as ReactNode
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
function toggle() {
|
|
@@ -55,6 +55,39 @@ describe('Menu', () => {
|
|
|
55
55
|
expect(screen.getByRole('link', { name: 'Schedule' })).toHaveAttribute('href', '/schedule')
|
|
56
56
|
})
|
|
57
57
|
|
|
58
|
+
it('renders dropdown menu when subitems are provided', () => {
|
|
59
|
+
const username = 'Username'
|
|
60
|
+
const link = { label: 'Link', url: '/url' }
|
|
61
|
+
const action = { label: 'Logout', click: jest.fn() }
|
|
62
|
+
|
|
63
|
+
setup({
|
|
64
|
+
children: (
|
|
65
|
+
<Menu.Item label={username}>
|
|
66
|
+
<Menu.SubItem label={link.label} url={link.url} />
|
|
67
|
+
<Menu.SubItem label={action.label} onClick={action.click} />
|
|
68
|
+
</Menu.Item>
|
|
69
|
+
),
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
expect(screen.getByText(username)).toBeInTheDocument()
|
|
73
|
+
expect(screen.queryByText(link.label)).not.toBeInTheDocument()
|
|
74
|
+
expect(screen.queryByText(action.label)).not.toBeInTheDocument()
|
|
75
|
+
|
|
76
|
+
user.click(screen.getByRole('button', { name: username }))
|
|
77
|
+
|
|
78
|
+
const linkSubItem = screen.getByRole('link', { name: link.label })
|
|
79
|
+
const buttonSubItem = screen.getByRole('menuitem', { name: action.label })
|
|
80
|
+
|
|
81
|
+
expect(linkSubItem).toBeVisible()
|
|
82
|
+
expect(linkSubItem).toHaveAttribute('href', link.url)
|
|
83
|
+
|
|
84
|
+
expect(buttonSubItem).toBeVisible()
|
|
85
|
+
|
|
86
|
+
user.click(buttonSubItem)
|
|
87
|
+
|
|
88
|
+
expect(action.click).toBeCalled()
|
|
89
|
+
})
|
|
90
|
+
|
|
58
91
|
// FIXME: Skipping as it's preventing test pipeline from being finished
|
|
59
92
|
it.skip('renders an accessible dropdown menu when children are provided', () => {
|
|
60
93
|
const username = 'Username'
|
|
@@ -68,7 +68,7 @@ const MenuDropdownSubItemLink = styled(BaseLink)`
|
|
|
68
68
|
|
|
69
69
|
type MenuDropdownSubItemProps = HTMLAttributes<HTMLElement> & {
|
|
70
70
|
label: string
|
|
71
|
-
url
|
|
71
|
+
url?: string
|
|
72
72
|
icon?: ReactNode
|
|
73
73
|
separator?: boolean
|
|
74
74
|
}
|
|
@@ -79,12 +79,16 @@ export function MenuDropdownSubItem({
|
|
|
79
79
|
url,
|
|
80
80
|
...rest
|
|
81
81
|
}: MenuDropdownSubItemProps): JSX.Element {
|
|
82
|
-
return (
|
|
82
|
+
return url ? (
|
|
83
83
|
<MenuDropdownSubItemLink {...rest} href={url}>
|
|
84
84
|
<DropdownMenuItem tabIndex={-1} leading={<IconWrapper>{icon}</IconWrapper>}>
|
|
85
85
|
{label}
|
|
86
86
|
</DropdownMenuItem>
|
|
87
87
|
</MenuDropdownSubItemLink>
|
|
88
|
+
) : (
|
|
89
|
+
<DropdownMenuItem leading={<IconWrapper>{icon}</IconWrapper>} {...rest}>
|
|
90
|
+
{label}
|
|
91
|
+
</DropdownMenuItem>
|
|
88
92
|
)
|
|
89
93
|
}
|
|
90
94
|
|
|
@@ -31,7 +31,10 @@ export function Playground(): JSX.Element {
|
|
|
31
31
|
url="#"
|
|
32
32
|
/>
|
|
33
33
|
<TopNavigation.Menu.Separator />
|
|
34
|
-
<TopNavigation.Menu.SubItem
|
|
34
|
+
<TopNavigation.Menu.SubItem
|
|
35
|
+
label="Logout"
|
|
36
|
+
onClick={() => alert('Logout button clicked')}
|
|
37
|
+
/>
|
|
35
38
|
</TopNavigation.Menu.Item>
|
|
36
39
|
</TopNavigation.Menu>
|
|
37
40
|
</TopNavigation>
|
|
@@ -7,11 +7,7 @@ We have exposed a few helper functions to make it easier to write unit tests for
|
|
|
7
7
|
The following functions descriptions consider this example:
|
|
8
8
|
|
|
9
9
|
```jsx
|
|
10
|
-
<DragDropFileProvider
|
|
11
|
-
fileList={fileList}
|
|
12
|
-
onFilesAdded={onFilesAdded}
|
|
13
|
-
onFileRemoved={onFileRemoved}
|
|
14
|
-
>
|
|
10
|
+
<DragDropFileProvider fileList={fileList} onFilesAdded={onFilesAdded} onFileRemoved={onFileRemoved}>
|
|
15
11
|
<DragDropFile.Wrapper>
|
|
16
12
|
<DragDropFile.DropZone
|
|
17
13
|
aria-label="Drag and drop file"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Meta } from '@storybook/addon-docs'
|
|
1
|
+
import { Meta } from '@storybook/addon-docs'
|
|
2
2
|
|
|
3
|
-
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
|
|
3
|
+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
|
|
4
4
|
|
|
5
5
|
<Meta title="Tools/Conditional & WhenProps" />
|
|
6
6
|
|
|
@@ -20,23 +20,26 @@ Let's consider the following sample button that changes its width based on its `
|
|
|
20
20
|
const Button = styled.button<ButtonProps>`
|
|
21
21
|
// ...
|
|
22
22
|
|
|
23
|
-
width: ${props =>
|
|
24
|
-
['primary', 'secondary', 'warning'].includes(props.variant)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
width: ${(props) =>
|
|
24
|
+
['primary', 'secondary', 'warning'].includes(props.variant)
|
|
25
|
+
? '36px'
|
|
26
|
+
: props.variant == 'icon' && props.scale == 'default'
|
|
27
|
+
? '32px'
|
|
28
|
+
: props.variant == 'icon' && props.scale == 'large'
|
|
29
|
+
? '48px'
|
|
30
|
+
: '24px'};
|
|
28
31
|
|
|
29
32
|
// ...
|
|
30
|
-
|
|
33
|
+
`
|
|
31
34
|
```
|
|
32
35
|
|
|
33
36
|
Of course, we could improve how we wrote our conditions, but that would still take some effort to make it easy to read and maintain.
|
|
34
37
|
|
|
35
|
-
Notice how we use our `props` of interest to determine the final value for our button's width. Well, that's where our `conditional` comes in handy.
|
|
38
|
+
Notice how we use our `props` of interest to determine the final value for our button's width. Well, that's where our `conditional` comes in handy. It encapsulates the `props` consumption, allowing for a quicker way of writing the conditionals.
|
|
36
39
|
|
|
37
40
|
Our current implementation allows the following types of condition checking:
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
**_Function condition_**
|
|
40
43
|
|
|
41
44
|
A function that receives the component props as argument and should return a string.
|
|
42
45
|
|
|
@@ -54,7 +57,7 @@ const Button = styled.button<ButtonProps>`
|
|
|
54
57
|
<Button scale="small" /> // would render style with `height: 24px;`
|
|
55
58
|
```
|
|
56
59
|
|
|
57
|
-
|
|
60
|
+
**_Object condition_**
|
|
58
61
|
|
|
59
62
|
An object, where the `key` would end up in the result of the `conditional` if `value` evaluates to `true`. Here, the `value` can be either a `boolean` value or a `function` that receives the component props as argument and returns a `boolean`.
|
|
60
63
|
|
|
@@ -79,7 +82,7 @@ const Button = styled.button<ButtonProps>`
|
|
|
79
82
|
<Button scale="small" /> // would render style with `height: 36px; width: 24px;`
|
|
80
83
|
```
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
**_Primitive condition_**
|
|
83
86
|
|
|
84
87
|
Any value you want to end up resulting from `conditional`, if _truthy_.
|
|
85
88
|
|
|
@@ -92,13 +95,12 @@ const Button = styled.button<ButtonProps>`
|
|
|
92
95
|
padding: ${conditional('10px', PADDING_X, false)};
|
|
93
96
|
|
|
94
97
|
// ...
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<Button /> // would render style with `padding: 10px 20px;`
|
|
98
|
+
`
|
|
98
99
|
|
|
100
|
+
;<Button /> // would render style with `padding: 10px 20px;`
|
|
99
101
|
```
|
|
100
102
|
|
|
101
|
-
|
|
103
|
+
**_Mixed condition_**
|
|
102
104
|
|
|
103
105
|
Of course, you can also mix and match multiple conditions at will:
|
|
104
106
|
|
|
@@ -151,11 +153,14 @@ _Before_:
|
|
|
151
153
|
const Button = styled.button<ButtonProps>`
|
|
152
154
|
// ...
|
|
153
155
|
|
|
154
|
-
width: ${props =>
|
|
155
|
-
['primary', 'secondary', 'warning'].include(props.variant)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
width: ${(props) =>
|
|
157
|
+
['primary', 'secondary', 'warning'].include(props.variant)
|
|
158
|
+
? '36px'
|
|
159
|
+
: props.variant == 'icon' && props.scale == 'default'
|
|
160
|
+
? '32px'
|
|
161
|
+
: props.variant == 'icon' && props.scale == 'large'
|
|
162
|
+
? '48px'
|
|
163
|
+
: '24px'};
|
|
159
164
|
|
|
160
165
|
// ...
|
|
161
166
|
`
|
|
@@ -195,7 +200,7 @@ const Button = styled.button<ButtonProps>`
|
|
|
195
200
|
|
|
196
201
|
The values can be represented as follows:
|
|
197
202
|
|
|
198
|
-
|
|
203
|
+
**_Array_**
|
|
199
204
|
|
|
200
205
|
A collection of values that the prop value should be compared to.
|
|
201
206
|
|
|
@@ -204,26 +209,28 @@ const Button = styled.button<ButtonProps>`
|
|
|
204
209
|
width: ${conditional({
|
|
205
210
|
'36px': whenProps({ variant: ['primary', 'secondary', 'warning'] }),
|
|
206
211
|
})};
|
|
207
|
-
|
|
212
|
+
`
|
|
208
213
|
```
|
|
209
214
|
|
|
210
215
|
In the example above, we'll have `width: 36px;` as a result if the button's `variant` prop is either `'primary'`, `'secondary'`, or `'warning'`.
|
|
211
216
|
|
|
212
|
-
|
|
217
|
+
**_Function_**
|
|
213
218
|
|
|
214
219
|
A function that receives the prop value as argument and returns a `boolean`.
|
|
215
220
|
|
|
216
221
|
```tsx
|
|
217
222
|
const Button = styled.button<ButtonProps>`
|
|
218
223
|
width: ${conditional({
|
|
219
|
-
'36px': whenProps({
|
|
224
|
+
'36px': whenProps({
|
|
225
|
+
variant: (variant) => ['primary', 'secondary', 'warning'].includes(variant),
|
|
226
|
+
}),
|
|
220
227
|
})};
|
|
221
228
|
`
|
|
222
229
|
```
|
|
223
230
|
|
|
224
231
|
In the example above, we'll also have `width: 36px;` as a result if the button's `variant` prop is either `'primary'`, `'secondary'`, or `'warning'`.
|
|
225
232
|
|
|
226
|
-
|
|
233
|
+
**_Anything else_**
|
|
227
234
|
|
|
228
235
|
A value to which the component prop will be strictly compared to.
|
|
229
236
|
|
|
@@ -240,5 +247,5 @@ In the example above, we'll have `width: 36px;` as a result only if the button's
|
|
|
240
247
|
<!-- The usage of this "Component" is intentional to enable react-syntax-highlighter's own highlighter -->
|
|
241
248
|
|
|
242
249
|
export const Component = () => {
|
|
243
|
-
return <SyntaxHighlighter
|
|
244
|
-
}
|
|
250
|
+
return <SyntaxHighlighter />
|
|
251
|
+
}
|
|
@@ -21,7 +21,7 @@ function useClickOutside<T extends HTMLElement>(
|
|
|
21
21
|
const handleEvent = useCallback(
|
|
22
22
|
function handleEvent(event: MouseEvent | TouchEvent | KeyboardEvent) {
|
|
23
23
|
function hasPressedEsc() {
|
|
24
|
-
return KeyboardKey(
|
|
24
|
+
return KeyboardKey(event as unknown as React.KeyboardEvent).is('ESCAPE')
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
if (!getContainer() || disabled) {
|
|
@@ -122,7 +122,7 @@ function useFocusTrap<T extends HTMLElement>(
|
|
|
122
122
|
* Brace yourselves for the nasty casting from globalThis.KeyboardEvent, which is
|
|
123
123
|
* the type used in the `addEventListener` callback, to React.KeyboardEvent ¯\_(ツ)_/¯
|
|
124
124
|
*/
|
|
125
|
-
const e =
|
|
125
|
+
const e = evt as unknown as React.KeyboardEvent
|
|
126
126
|
|
|
127
127
|
const supportedKeys = [...(keys || ['TAB'])]
|
|
128
128
|
|
|
@@ -12,15 +12,16 @@ export interface useFocusWithinProps {
|
|
|
12
12
|
* helps with identifying focus within elements.
|
|
13
13
|
* @param {Object} props - Hook props
|
|
14
14
|
*/
|
|
15
|
-
function useFocusWithin<T>(
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function useFocusWithin<T>(props: useFocusWithinProps = {}): {
|
|
16
|
+
ref: RefObject<T>
|
|
17
|
+
focused: boolean
|
|
18
|
+
} {
|
|
18
19
|
const { onFocus, onBlur } = props
|
|
19
20
|
const [focused, setFocused] = useState(false)
|
|
20
21
|
const containerRef = useRef<T>(null)
|
|
21
22
|
|
|
22
23
|
function getContainer() {
|
|
23
|
-
return
|
|
24
|
+
return containerRef.current as unknown as HTMLElement
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const handleFocus = useCallback(
|
package/src/tools/conditional.ts
CHANGED
|
@@ -78,7 +78,7 @@ function handleConditionObject<P>(condition: ConditionObject<P>, props: P): stri
|
|
|
78
78
|
|
|
79
79
|
if (value) {
|
|
80
80
|
const tokenKey = key as ThemeToken
|
|
81
|
-
const result = (getToken(tokenKey,
|
|
81
|
+
const result = (getToken(tokenKey, props as unknown as ThemedProps) ?? key) as string
|
|
82
82
|
return [...acc, result]
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -25,7 +25,7 @@ describe('Match highligther', () => {
|
|
|
25
25
|
/*
|
|
26
26
|
This can possibly happen in projects that don't use TypeScript or at runtime.
|
|
27
27
|
*/
|
|
28
|
-
const nullAsString: string =
|
|
28
|
+
const nullAsString: string = null as unknown as string
|
|
29
29
|
expect(highlightMatch('Label', nullAsString)).toEqual(<>Label</>)
|
|
30
30
|
expect(highlightMatch(nullAsString, 'xyz')).toEqual(<>{null}</>)
|
|
31
31
|
})
|
|
@@ -33,9 +33,7 @@ export function getKeyboardKey(e: KeyboardEvent): KeyboardEvent['key'] {
|
|
|
33
33
|
return e.key
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function KeyboardKey(
|
|
37
|
-
e: KeyboardEvent
|
|
38
|
-
): {
|
|
36
|
+
function KeyboardKey(e: KeyboardEvent): {
|
|
39
37
|
is(otherKeys: SupportedKey | SupportedKey[]): boolean
|
|
40
38
|
} {
|
|
41
39
|
const key = getKeyboardKey(e)
|