reshaped 3.9.0-canary.0 → 3.9.0-canary.10
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/bundle.css +1 -1
- package/dist/bundle.js +2 -31
- package/dist/cli/theming/index.js +4 -4
- package/dist/cli/theming/reshaped.config.js +1 -1
- package/dist/components/Accordion/Accordion.types.d.ts +1 -1
- package/dist/components/Accordion/AccordionControlled.js +2 -2
- package/dist/components/Accordion/AccordionTrigger.js +2 -2
- package/dist/components/Accordion/index.d.ts +1 -1
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/ActionBar/ActionBar.js +1 -1
- package/dist/components/ActionBar/ActionBar.types.d.ts +1 -1
- package/dist/components/Actionable/Actionable.js +1 -1
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Alert/Alert.types.d.ts +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +6 -6
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +3 -3
- package/dist/components/Avatar/Avatar.js +9 -26
- package/dist/components/Avatar/Avatar.module.css +1 -1
- package/dist/components/Badge/Badge.js +4 -4
- package/dist/components/Badge/Badge.module.css +1 -1
- package/dist/components/Badge/Badge.types.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +3 -3
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsItem.js +1 -1
- package/dist/components/Button/Button.js +2 -2
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Button/Button.types.d.ts +3 -3
- package/dist/components/Calendar/Calendar.types.d.ts +25 -6
- package/dist/components/Calendar/CalendarControlled.js +45 -10
- package/dist/components/Calendar/CalendarControls.js +11 -11
- package/dist/components/Calendar/CalendarDate.js +13 -11
- package/dist/components/Calendar/CalendarMonth.js +3 -3
- package/dist/components/Calendar/CalendarYear.js +1 -1
- package/dist/components/Calendar/useCalendarKeyboardNavigation.js +1 -1
- package/dist/components/Card/Card.js +2 -2
- package/dist/components/Card/Card.module.css +1 -1
- package/dist/components/Card/Card.types.d.ts +1 -1
- package/dist/components/Carousel/Carousel.js +4 -4
- package/dist/components/Carousel/Carousel.types.d.ts +1 -1
- package/dist/components/Carousel/CarouselControl.d.ts +1 -1
- package/dist/components/Carousel/CarouselControl.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +5 -15
- package/dist/components/CheckboxGroup/CheckboxGroup.types.d.ts +1 -1
- package/dist/components/Container/Container.js +1 -1
- package/dist/components/Container/Container.types.d.ts +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/components/Dismissible/Dismissible.js +1 -1
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/Divider/Divider.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +6 -6
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +4 -4
- package/dist/components/FileUpload/FileUpload.js +9 -7
- package/dist/components/FileUpload/FileUpload.module.css +1 -1
- package/dist/components/FileUpload/FileUpload.types.d.ts +3 -1
- package/dist/components/Flyout/Flyout.constants.d.ts +3 -6
- package/dist/components/Flyout/Flyout.constants.js +1 -3
- package/dist/components/Flyout/Flyout.js +1 -1
- package/dist/components/Flyout/Flyout.module.css +1 -1
- package/dist/components/Flyout/Flyout.types.d.ts +6 -7
- package/dist/components/Flyout/FlyoutContent.js +7 -7
- package/dist/components/Flyout/FlyoutControlled.js +17 -14
- package/dist/components/Flyout/index.d.ts +1 -1
- package/dist/components/Flyout/index.js +1 -1
- package/dist/components/Flyout/useFlyout.d.ts +2 -2
- package/dist/components/Flyout/useFlyout.js +5 -18
- package/dist/components/Flyout/utilities/calculatePosition.d.ts +6 -6
- package/dist/components/Flyout/utilities/calculatePosition.js +6 -6
- package/dist/components/Flyout/utilities/cooldown.js +1 -2
- package/dist/components/Flyout/utilities/flyout.d.ts +1 -1
- package/dist/components/Flyout/utilities/flyout.js +5 -2
- package/dist/components/FormControl/FormControlCaption.js +1 -1
- package/dist/components/FormControl/FormControlLabel.js +1 -1
- package/dist/components/FormControl/index.d.ts +2 -2
- package/dist/components/FormControl/index.js +2 -2
- package/dist/components/Grid/Grid.js +1 -1
- package/dist/components/Grid/Grid.types.d.ts +2 -2
- package/dist/components/HiddenInput/HiddenInput.js +34 -0
- package/dist/components/HiddenInput/HiddenInput.types.d.ts +26 -0
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Icon/Icon.module.css +1 -1
- package/dist/components/Image/Image.js +14 -9
- package/dist/components/Image/Image.module.css +1 -1
- package/dist/components/Image/Image.types.d.ts +4 -2
- package/dist/components/Link/Link.js +1 -1
- package/dist/components/MenuItem/MenuItem.js +1 -1
- package/dist/components/MenuItem/MenuItem.types.d.ts +2 -2
- package/dist/components/Modal/Modal.js +8 -8
- package/dist/components/Modal/Modal.module.css +1 -1
- package/dist/components/Modal/Modal.types.d.ts +1 -1
- package/dist/components/NumberField/NumberFieldControlled.js +7 -7
- package/dist/components/Overlay/Overlay.js +8 -8
- package/dist/components/PinField/PinFieldControlled.js +4 -4
- package/dist/components/Popover/Popover.js +3 -3
- package/dist/components/Popover/Popover.module.css +1 -1
- package/dist/components/Popover/Popover.types.d.ts +2 -2
- package/dist/components/Progress/Progress.module.css +1 -1
- package/dist/components/Radio/Radio.js +5 -15
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +1 -1
- package/dist/components/Reshaped/Reshaped.css +1 -1
- package/dist/components/Reshaped/Reshaped.js +4 -4
- package/dist/components/Reshaped/Reshaped.types.d.ts +1 -1
- package/dist/components/Resizable/Resizable.js +2 -2
- package/dist/components/Resizable/Resizable.types.d.ts +1 -1
- package/dist/components/Resizable/ResizableHandle.js +1 -1
- package/dist/components/Scrim/Scrim.js +4 -3
- package/dist/components/Scrim/Scrim.module.css +1 -1
- package/dist/components/Scrim/Scrim.types.d.ts +2 -1
- package/dist/components/ScrollArea/ScrollArea.js +5 -5
- package/dist/components/Select/Select.types.d.ts +3 -3
- package/dist/components/Select/SelectCustomControlled.js +6 -3
- package/dist/components/Select/SelectEndContent.js +1 -1
- package/dist/components/Select/SelectGroup.js +1 -1
- package/dist/components/Select/SelectNative.js +2 -2
- package/dist/components/Select/SelectRoot.js +1 -1
- package/dist/components/Select/SelectTrigger.js +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Slider/SliderControlled.js +7 -7
- package/dist/components/Slider/SliderThumb.js +3 -3
- package/dist/components/Stepper/Stepper.js +4 -4
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Table/Table.js +2 -2
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/TabsContext.d.ts +1 -0
- package/dist/components/Tabs/TabsControlled.js +2 -1
- package/dist/components/Tabs/TabsItem.js +4 -4
- package/dist/components/Tabs/TabsList.js +17 -13
- package/dist/components/Tabs/TabsPanel.js +3 -3
- package/dist/components/Text/Text.js +3 -3
- package/dist/components/Text/Text.module.css +1 -1
- package/dist/components/Text/Text.types.d.ts +2 -0
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/TextArea/TextArea.types.d.ts +1 -1
- package/dist/components/TextField/TextField.js +2 -2
- package/dist/components/TextField/TextField.types.d.ts +2 -2
- package/dist/components/Theme/GlobalColorMode.js +1 -1
- package/dist/components/Theme/Theme.js +2 -2
- package/dist/components/Theme/Theme.module.css +1 -1
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Toast/Toast.js +2 -2
- package/dist/components/Toast/Toast.types.d.ts +1 -1
- package/dist/components/Toast/ToastContainer.js +3 -3
- package/dist/components/Toast/ToastProvider.js +1 -1
- package/dist/components/Toast/ToastRegion.js +2 -2
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.types.d.ts +1 -1
- package/dist/components/ToggleButtonGroup/ToggleButtonGroupControlled.js +1 -1
- package/dist/components/Tooltip/Tooltip.js +5 -3
- package/dist/components/View/View.js +2 -2
- package/dist/components/View/View.types.d.ts +1 -1
- package/dist/components/_private/Expandable/Expandable.js +2 -2
- package/dist/components/_private/Portal/Portal.js +1 -1
- package/dist/config/tailwind.js +2 -2
- package/dist/hooks/_private/useDrag.js +4 -4
- package/dist/hooks/_private/useFadeSide.js +1 -1
- package/dist/hooks/useOnClickOutside.js +2 -4
- package/dist/hooks/useResponsiveClientValue.js +1 -1
- package/dist/styles/mixin.js +1 -1
- package/dist/tests/ThemesPlayground.js +16 -16
- package/dist/themes/_generator/definitions/slate.js +1 -1
- package/dist/themes/_generator/tokens/color/utilities/generateColors.d.ts +1 -1
- package/dist/themes/_generator/tokens/color/utilities/generateMetaColors.d.ts +1 -1
- package/dist/themes/_generator/tokens/color/utilities/generateMetaColors.js +1 -1
- package/dist/themes/_generator/tokens/css.js +2 -2
- package/dist/themes/_generator/tokens/font/font.types.d.ts +2 -2
- package/dist/themes/_generator/tokens/transforms.js +1 -1
- package/dist/themes/_generator/tokens/types.d.ts +3 -3
- package/dist/themes/_generator/transform.d.ts +1 -1
- package/dist/themes/_generator/transform.js +3 -3
- package/dist/themes/figma/theme.css +1 -1
- package/dist/themes/fragments/twitter/theme.css +1 -1
- package/dist/themes/index.d.ts +1 -1
- package/dist/themes/reshaped/theme.css +1 -1
- package/dist/themes/slate/theme.css +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/utilities/a11y/TrapFocus.js +4 -4
- package/dist/utilities/scroll/lock.js +1 -1
- package/dist/utilities/scroll/lockStandard.js +1 -1
- package/dist/utilities/storybook/Example.js +1 -1
- package/package.json +42 -35
- package/dist/components/Accordion/tests/Accordion.stories.d.ts +0 -44
- package/dist/components/Accordion/tests/Accordion.stories.js +0 -204
- package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +0 -40
- package/dist/components/ActionBar/tests/ActionBar.stories.js +0 -223
- package/dist/components/Actionable/tests/Actionable.stories.d.ts +0 -41
- package/dist/components/Actionable/tests/Actionable.stories.js +0 -220
- package/dist/components/Alert/tests/Alert.stories.d.ts +0 -24
- package/dist/components/Alert/tests/Alert.stories.js +0 -78
- package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +0 -32
- package/dist/components/Autocomplete/tests/Autocomplete.stories.js +0 -246
- package/dist/components/Avatar/tests/Avatar.stories.d.ts +0 -31
- package/dist/components/Avatar/tests/Avatar.stories.js +0 -176
- package/dist/components/Badge/tests/Badge.stories.d.ts +0 -55
- package/dist/components/Badge/tests/Badge.stories.js +0 -328
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +0 -40
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +0 -187
- package/dist/components/Button/tests/Button.stories.d.ts +0 -79
- package/dist/components/Button/tests/Button.stories.js +0 -789
- package/dist/components/Calendar/tests/Calendar.stories.d.ts +0 -29
- package/dist/components/Calendar/tests/Calendar.stories.js +0 -255
- package/dist/components/Card/tests/Card.stories.d.ts +0 -52
- package/dist/components/Card/tests/Card.stories.js +0 -125
- package/dist/components/Carousel/tests/Carousel.stories.d.ts +0 -34
- package/dist/components/Carousel/tests/Carousel.stories.js +0 -224
- package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +0 -30
- package/dist/components/Checkbox/tests/Checkbox.stories.js +0 -171
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +0 -19
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +0 -83
- package/dist/components/Container/tests/Container.stories.d.ts +0 -24
- package/dist/components/Container/tests/Container.stories.js +0 -75
- package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +0 -26
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +0 -70
- package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +0 -25
- package/dist/components/Dismissible/tests/Dismissible.stories.js +0 -97
- package/dist/components/Divider/tests/Divider.stories.d.ts +0 -20
- package/dist/components/Divider/tests/Divider.stories.js +0 -120
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +0 -53
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +0 -278
- package/dist/components/FileUpload/tests/FileUpload.stories.d.ts +0 -31
- package/dist/components/FileUpload/tests/FileUpload.stories.js +0 -140
- package/dist/components/Flyout/tests/Flyout.stories.d.ts +0 -103
- package/dist/components/Flyout/tests/Flyout.stories.js +0 -738
- package/dist/components/FormControl/tests/FormControl.stories.d.ts +0 -31
- package/dist/components/FormControl/tests/FormControl.stories.js +0 -143
- package/dist/components/Grid/tests/Grid.stories.d.ts +0 -38
- package/dist/components/Grid/tests/Grid.stories.js +0 -245
- package/dist/components/Hidden/tests/Hidden.stories.d.ts +0 -16
- package/dist/components/Hidden/tests/Hidden.stories.js +0 -48
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +0 -16
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +0 -28
- package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +0 -13
- package/dist/components/Hotkey/tests/Hotkey.stories.js +0 -53
- package/dist/components/Icon/tests/Icon.stories.d.ts +0 -25
- package/dist/components/Icon/tests/Icon.stories.js +0 -113
- package/dist/components/Image/tests/Image.stories.d.ts +0 -41
- package/dist/components/Image/tests/Image.stories.js +0 -196
- package/dist/components/Link/tests/Link.stories.d.ts +0 -42
- package/dist/components/Link/tests/Link.stories.js +0 -155
- package/dist/components/Loader/tests/Loader.stories.d.ts +0 -21
- package/dist/components/Loader/tests/Loader.stories.js +0 -68
- package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +0 -59
- package/dist/components/MenuItem/tests/MenuItem.stories.js +0 -236
- package/dist/components/Modal/tests/Modal.stories.d.ts +0 -64
- package/dist/components/Modal/tests/Modal.stories.js +0 -410
- package/dist/components/NumberField/tests/NumberField.stories.d.ts +0 -28
- package/dist/components/NumberField/tests/NumberField.stories.js +0 -258
- package/dist/components/Overlay/tests/Overlay.stories.d.ts +0 -28
- package/dist/components/Overlay/tests/Overlay.stories.js +0 -202
- package/dist/components/Pagination/tests/Pagination.stories.d.ts +0 -24
- package/dist/components/Pagination/tests/Pagination.stories.js +0 -105
- package/dist/components/PinField/tests/PinField.stories.d.ts +0 -34
- package/dist/components/PinField/tests/PinField.stories.js +0 -209
- package/dist/components/Popover/tests/Popover.stories.d.ts +0 -69
- package/dist/components/Popover/tests/Popover.stories.js +0 -340
- package/dist/components/Progress/tests/Progress.stories.d.ts +0 -30
- package/dist/components/Progress/tests/Progress.stories.js +0 -102
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.d.ts +0 -19
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +0 -92
- package/dist/components/Radio/tests/Radio.stories.d.ts +0 -35
- package/dist/components/Radio/tests/Radio.stories.js +0 -162
- package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +0 -19
- package/dist/components/RadioGroup/tests/RadioGroup.stories.js +0 -77
- package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +0 -34
- package/dist/components/Reshaped/tests/Reshaped.stories.js +0 -108
- package/dist/components/Resizable/tests/Resizable.stories.d.ts +0 -38
- package/dist/components/Resizable/tests/Resizable.stories.js +0 -185
- package/dist/components/Scrim/tests/Scrim.stories.d.ts +0 -20
- package/dist/components/Scrim/tests/Scrim.stories.js +0 -67
- package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +0 -37
- package/dist/components/ScrollArea/tests/ScrollArea.stories.js +0 -244
- package/dist/components/Select/tests/Select.stories.d.ts +0 -53
- package/dist/components/Select/tests/Select.stories.js +0 -616
- package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +0 -20
- package/dist/components/Skeleton/tests/Skeleton.stories.js +0 -63
- package/dist/components/Slider/tests/Slider.stories.d.ts +0 -47
- package/dist/components/Slider/tests/Slider.stories.js +0 -279
- package/dist/components/Stepper/tests/Stepper.stories.d.ts +0 -31
- package/dist/components/Stepper/tests/Stepper.stories.js +0 -135
- package/dist/components/Switch/tests/Switch.stories.d.ts +0 -22
- package/dist/components/Switch/tests/Switch.stories.js +0 -137
- package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -13
- package/dist/components/Switch/tests/Switch.test.stories.js +0 -11
- package/dist/components/Table/tests/Table.stories.d.ts +0 -42
- package/dist/components/Table/tests/Table.stories.js +0 -348
- package/dist/components/Tabs/tests/Tabs.stories.d.ts +0 -62
- package/dist/components/Tabs/tests/Tabs.stories.js +0 -539
- package/dist/components/Text/tests/Text.stories.d.ts +0 -48
- package/dist/components/Text/tests/Text.stories.js +0 -201
- package/dist/components/TextArea/tests/TextArea.stories.d.ts +0 -53
- package/dist/components/TextArea/tests/TextArea.stories.js +0 -204
- package/dist/components/TextField/tests/TextField.stories.d.ts +0 -54
- package/dist/components/TextField/tests/TextField.stories.js +0 -252
- package/dist/components/Theme/tests/Theme.stories.d.ts +0 -25
- package/dist/components/Theme/tests/Theme.stories.js +0 -171
- package/dist/components/Timeline/tests/Timeline.stories.d.ts +0 -22
- package/dist/components/Timeline/tests/Timeline.stories.js +0 -86
- package/dist/components/Toast/tests/Toast.stories.d.ts +0 -41
- package/dist/components/Toast/tests/Toast.stories.js +0 -432
- package/dist/components/ToggleButton/tests/ToggleButton.stories.d.ts +0 -27
- package/dist/components/ToggleButton/tests/ToggleButton.stories.js +0 -97
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.d.ts +0 -27
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.js +0 -169
- package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +0 -28
- package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -182
- package/dist/components/View/tests/View.stories.d.ts +0 -141
- package/dist/components/View/tests/View.stories.js +0 -1329
- package/dist/components/_private/HiddenInput/HiddenInput.js +0 -10
- package/dist/components/_private/HiddenInput/HiddenInput.types.d.ts +0 -15
- package/dist/components/_private/Portal/tests/Portal.stories.d.ts +0 -6
- package/dist/components/_private/Portal/tests/Portal.stories.js +0 -17
- package/dist/hooks/tests/useDrag.stories.d.ts +0 -31
- package/dist/hooks/tests/useDrag.stories.js +0 -147
- package/dist/hooks/tests/useElementId.stories.d.ts +0 -11
- package/dist/hooks/tests/useElementId.stories.js +0 -23
- package/dist/hooks/tests/useHandlerRef.stories.d.ts +0 -14
- package/dist/hooks/tests/useHandlerRef.stories.js +0 -44
- package/dist/hooks/tests/useHotkeys.stories.d.ts +0 -43
- package/dist/hooks/tests/useHotkeys.stories.js +0 -158
- package/dist/hooks/tests/useKeyboardArrowNavigation.stories.d.ts +0 -15
- package/dist/hooks/tests/useKeyboardArrowNavigation.stories.js +0 -128
- package/dist/hooks/tests/useKeyboardMode.stories.d.ts +0 -11
- package/dist/hooks/tests/useKeyboardMode.stories.js +0 -42
- package/dist/hooks/tests/useOnClickOutside.stories.d.ts +0 -23
- package/dist/hooks/tests/useOnClickOutside.stories.js +0 -111
- package/dist/hooks/tests/useRTL.stories.d.ts +0 -11
- package/dist/hooks/tests/useRTL.stories.js +0 -23
- package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +0 -18
- package/dist/hooks/tests/useResponsiveClientValue.stories.js +0 -30
- package/dist/hooks/tests/useScrollLock.stories.d.ts +0 -14
- package/dist/hooks/tests/useScrollLock.stories.js +0 -97
- package/dist/hooks/tests/useToggle.stories.d.ts +0 -13
- package/dist/hooks/tests/useToggle.stories.js +0 -59
- package/dist/tests/ShadowDOM.stories.d.ts +0 -6
- package/dist/tests/ShadowDOM.stories.js +0 -110
- package/dist/tests/themes.stories.d.ts +0 -16
- package/dist/tests/themes.stories.js +0 -327
- package/dist/utilities/a11y/tests/TrapFocus.stories.d.ts +0 -14
- package/dist/utilities/a11y/tests/TrapFocus.stories.js +0 -615
- /package/dist/components/{_private/HiddenInput → HiddenInput}/HiddenInput.d.ts +0 -0
- /package/dist/components/{_private/HiddenInput → HiddenInput}/HiddenInput.module.css +0 -0
- /package/dist/components/{_private/HiddenInput → HiddenInput}/HiddenInput.types.js +0 -0
- /package/dist/components/{_private/HiddenInput → HiddenInput}/index.d.ts +0 -0
- /package/dist/components/{_private/HiddenInput → HiddenInput}/index.js +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames } from "../../../utilities/props.js";
|
|
3
|
-
import s from "./HiddenInput.module.css";
|
|
4
|
-
const HiddenInput = (props) => {
|
|
5
|
-
const { name, value, type, onChange, onFocus, onBlur, checked, defaultChecked, disabled, className, attributes, } = props;
|
|
6
|
-
const rootClassNames = classNames(s.root, className);
|
|
7
|
-
return (_jsx("input", { ...attributes, className: rootClassNames, type: type, name: name, value: value, checked: checked, defaultChecked: defaultChecked, disabled: disabled, onChange: onChange, onFocus: onFocus || attributes?.onFocus, onBlur: onBlur || attributes?.onBlur }));
|
|
8
|
-
};
|
|
9
|
-
HiddenInput.displayName = "HiddenInput";
|
|
10
|
-
export default HiddenInput;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type * as G from "../../../types/global";
|
|
3
|
-
export type Props = {
|
|
4
|
-
name?: string;
|
|
5
|
-
value?: string;
|
|
6
|
-
checked?: boolean;
|
|
7
|
-
defaultChecked?: boolean;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
|
-
onFocus?: (e: React.FocusEvent) => void;
|
|
11
|
-
onBlur?: (e: React.FocusEvent) => void;
|
|
12
|
-
type: "checkbox" | "radio";
|
|
13
|
-
className?: G.ClassName;
|
|
14
|
-
attributes?: G.Attributes<"input">;
|
|
15
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Portal from "../index.js";
|
|
3
|
-
export default { title: "Internal/Portal" };
|
|
4
|
-
export const base = () => {
|
|
5
|
-
const ref = React.useRef(null);
|
|
6
|
-
const [mounted, setMounted] = React.useState(false);
|
|
7
|
-
React.useEffect(() => {
|
|
8
|
-
setMounted(true);
|
|
9
|
-
}, []);
|
|
10
|
-
return (<>
|
|
11
|
-
<div style={{ border: "2px solid #333", padding: 16 }}>
|
|
12
|
-
App
|
|
13
|
-
{mounted && <Portal targetRef={ref}>Ported to green</Portal>}
|
|
14
|
-
</div>
|
|
15
|
-
<div ref={ref} style={{ border: "2px solid green", padding: 16 }}/>
|
|
16
|
-
</>);
|
|
17
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
3
|
-
import { fn } from "storybook/test";
|
|
4
|
-
declare const _default: {
|
|
5
|
-
title: string;
|
|
6
|
-
parameters: {
|
|
7
|
-
chromatic: {
|
|
8
|
-
disableSnapshot: boolean;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|
|
13
|
-
export declare const base: {
|
|
14
|
-
name: string;
|
|
15
|
-
render: () => React.JSX.Element;
|
|
16
|
-
};
|
|
17
|
-
export declare const mouseEvents: StoryObj<{
|
|
18
|
-
handleDrag: ReturnType<typeof fn>;
|
|
19
|
-
}>;
|
|
20
|
-
export declare const touchEvents: StoryObj<{
|
|
21
|
-
handleDrag: ReturnType<typeof fn>;
|
|
22
|
-
}>;
|
|
23
|
-
export declare const orientationHorizontal: StoryObj<{
|
|
24
|
-
handleDrag: ReturnType<typeof fn>;
|
|
25
|
-
}>;
|
|
26
|
-
export declare const orientationVertical: StoryObj<{
|
|
27
|
-
handleDrag: ReturnType<typeof fn>;
|
|
28
|
-
}>;
|
|
29
|
-
export declare const disabled: StoryObj<{
|
|
30
|
-
handleDrag: ReturnType<typeof fn>;
|
|
31
|
-
}>;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { fireEvent, fn, expect } from "storybook/test";
|
|
3
|
-
import View from "../../components/View/index.js";
|
|
4
|
-
import useDrag from "../_private/useDrag.js";
|
|
5
|
-
import useToggle from "../useToggle.js";
|
|
6
|
-
import Button from "../../components/Button/index.js";
|
|
7
|
-
export default {
|
|
8
|
-
title: "Internal/useDrag",
|
|
9
|
-
parameters: {
|
|
10
|
-
chromatic: { disableSnapshot: true },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
function Example() {
|
|
14
|
-
const [state, setState] = React.useState({ x: 0, y: 0 });
|
|
15
|
-
const disabledToggle = useToggle();
|
|
16
|
-
const { ref, containerRef, active } = useDrag((args) => {
|
|
17
|
-
setState(args);
|
|
18
|
-
}, {
|
|
19
|
-
disabled: disabledToggle.active,
|
|
20
|
-
});
|
|
21
|
-
return (<View direction="row" gap={4}>
|
|
22
|
-
<View backgroundColor="neutral-faded" borderRadius="medium" width="200px" height="200px" attributes={{ ref: containerRef }}>
|
|
23
|
-
<View height={8} width={8} borderRadius="small" animated backgroundColor={active ? "primary" : "neutral"} attributes={{
|
|
24
|
-
role: "button",
|
|
25
|
-
tabIndex: 0,
|
|
26
|
-
"aria-label": "Drag",
|
|
27
|
-
ref,
|
|
28
|
-
style: { translate: `${state.x}px ${state.y}px`, cursor: active ? "grabbing" : "grab" },
|
|
29
|
-
}}/>
|
|
30
|
-
</View>
|
|
31
|
-
<Button onClick={() => disabledToggle.toggle()}>
|
|
32
|
-
{disabledToggle.active ? "Enable" : "Disable"}
|
|
33
|
-
</Button>
|
|
34
|
-
</View>);
|
|
35
|
-
}
|
|
36
|
-
export const base = { name: "base", render: () => <Example /> };
|
|
37
|
-
const Demo = (props) => {
|
|
38
|
-
const { ref, containerRef } = useDrag((options) => {
|
|
39
|
-
props.onDrag(options);
|
|
40
|
-
}, {
|
|
41
|
-
orientation: props.orientation,
|
|
42
|
-
disabled: props.disabled,
|
|
43
|
-
});
|
|
44
|
-
return (<View backgroundColor="neutral-faded" width="200px" height="200px" attributes={{ ref: containerRef, "data-testid": "test-id" }}>
|
|
45
|
-
<View height={8} width={8} backgroundColor="primary" attributes={{
|
|
46
|
-
"data-testid": "test-handle-id",
|
|
47
|
-
ref,
|
|
48
|
-
}}/>
|
|
49
|
-
</View>);
|
|
50
|
-
};
|
|
51
|
-
export const mouseEvents = {
|
|
52
|
-
name: "onDrag, mouse events",
|
|
53
|
-
args: {
|
|
54
|
-
handleDrag: fn(),
|
|
55
|
-
},
|
|
56
|
-
render: (args) => {
|
|
57
|
-
return <Demo onDrag={args.handleDrag}/>;
|
|
58
|
-
},
|
|
59
|
-
play: ({ canvas, args }) => {
|
|
60
|
-
const trigger = canvas.getByTestId("test-handle-id");
|
|
61
|
-
fireEvent.mouseDown(trigger);
|
|
62
|
-
fireEvent.mouseMove(document.body, { clientX: 100, clientY: 50 });
|
|
63
|
-
expect(args.handleDrag).toHaveBeenCalledTimes(1);
|
|
64
|
-
expect(args.handleDrag).toHaveBeenCalledWith(expect.objectContaining({ x: 100, y: 50 }));
|
|
65
|
-
fireEvent.mouseUp(trigger);
|
|
66
|
-
fireEvent.mouseUp(document.body, { clientX: 50, clientY: 100 });
|
|
67
|
-
expect(args.handleDrag).toHaveBeenCalledTimes(1);
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
export const touchEvents = {
|
|
71
|
-
name: "onDrag, touch events",
|
|
72
|
-
args: {
|
|
73
|
-
handleDrag: fn(),
|
|
74
|
-
},
|
|
75
|
-
render: (args) => {
|
|
76
|
-
return <Demo onDrag={args.handleDrag}/>;
|
|
77
|
-
},
|
|
78
|
-
play: ({ canvas, args }) => {
|
|
79
|
-
const createTouch = (target, x, y) => {
|
|
80
|
-
return new Touch({
|
|
81
|
-
identifier: Date.now(),
|
|
82
|
-
target,
|
|
83
|
-
clientX: x,
|
|
84
|
-
clientY: y,
|
|
85
|
-
screenX: x,
|
|
86
|
-
screenY: y,
|
|
87
|
-
pageX: x,
|
|
88
|
-
pageY: y,
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
const trigger = canvas.getByTestId("test-handle-id");
|
|
92
|
-
fireEvent.touchStart(trigger, { changedTouches: [createTouch(trigger, 0, 0)] });
|
|
93
|
-
fireEvent.touchMove(document.body, { changedTouches: [createTouch(trigger, 100, 50)] });
|
|
94
|
-
expect(args.handleDrag).toHaveBeenCalledTimes(1);
|
|
95
|
-
expect(args.handleDrag).toHaveBeenCalledWith(expect.objectContaining({ x: 100, y: 50 }));
|
|
96
|
-
fireEvent.touchEnd(trigger);
|
|
97
|
-
fireEvent.touchEnd(document.body, { changedTouches: [createTouch(trigger, 100, 50)] });
|
|
98
|
-
expect(args.handleDrag).toHaveBeenCalledTimes(1);
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
export const orientationHorizontal = {
|
|
102
|
-
name: "orientation horizontal",
|
|
103
|
-
args: {
|
|
104
|
-
handleDrag: fn(),
|
|
105
|
-
},
|
|
106
|
-
render: (args) => {
|
|
107
|
-
return <Demo onDrag={args.handleDrag} orientation="horizontal"/>;
|
|
108
|
-
},
|
|
109
|
-
play: ({ canvas, args }) => {
|
|
110
|
-
const trigger = canvas.getByTestId("test-handle-id");
|
|
111
|
-
fireEvent.mouseDown(trigger);
|
|
112
|
-
fireEvent.mouseMove(document.body, { clientX: 100, clientY: 50 });
|
|
113
|
-
expect(args.handleDrag).toHaveBeenCalledTimes(1);
|
|
114
|
-
expect(args.handleDrag).toHaveBeenCalledWith(expect.objectContaining({ x: 100, y: 0 }));
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
export const orientationVertical = {
|
|
118
|
-
name: "orientation vertical",
|
|
119
|
-
args: {
|
|
120
|
-
handleDrag: fn(),
|
|
121
|
-
},
|
|
122
|
-
render: (args) => {
|
|
123
|
-
return <Demo onDrag={args.handleDrag} orientation="vertical"/>;
|
|
124
|
-
},
|
|
125
|
-
play: ({ canvas, args }) => {
|
|
126
|
-
const trigger = canvas.getByTestId("test-handle-id");
|
|
127
|
-
fireEvent.mouseDown(trigger);
|
|
128
|
-
fireEvent.mouseMove(document.body, { clientX: 100, clientY: 50 });
|
|
129
|
-
expect(args.handleDrag).toHaveBeenCalledTimes(1);
|
|
130
|
-
expect(args.handleDrag).toHaveBeenCalledWith(expect.objectContaining({ x: 0, y: 50 }));
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
export const disabled = {
|
|
134
|
-
name: "disabled",
|
|
135
|
-
args: {
|
|
136
|
-
handleDrag: fn(),
|
|
137
|
-
},
|
|
138
|
-
render: (args) => {
|
|
139
|
-
return <Demo onDrag={args.handleDrag} disabled/>;
|
|
140
|
-
},
|
|
141
|
-
play: ({ canvas, args }) => {
|
|
142
|
-
const trigger = canvas.getByTestId("test-handle-id");
|
|
143
|
-
fireEvent.mouseDown(trigger);
|
|
144
|
-
fireEvent.mouseMove(document.body, { clientX: 100, clientY: 50 });
|
|
145
|
-
expect(args.handleDrag).toHaveBeenCalledTimes(0);
|
|
146
|
-
},
|
|
147
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { expect, waitFor } from "storybook/test";
|
|
2
|
-
import useElementId from "../useElementId.js";
|
|
3
|
-
export default {
|
|
4
|
-
title: "Hooks/useElementId",
|
|
5
|
-
parameters: {
|
|
6
|
-
chromatic: { disableSnapshot: true },
|
|
7
|
-
},
|
|
8
|
-
};
|
|
9
|
-
const Component = (props) => {
|
|
10
|
-
const id = useElementId(props.id);
|
|
11
|
-
return <div id={id}>{id}</div>;
|
|
12
|
-
};
|
|
13
|
-
export const id = {
|
|
14
|
-
name: "passed id",
|
|
15
|
-
render: () => {
|
|
16
|
-
return <Component id="hey"/>;
|
|
17
|
-
},
|
|
18
|
-
play: async () => {
|
|
19
|
-
waitFor(() => {
|
|
20
|
-
expect(document.querySelector("#hey")).toBeTruthy();
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { Mock } from "storybook/test";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
parameters: {
|
|
6
|
-
chromatic: {
|
|
7
|
-
disableSnapshot: boolean;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
12
|
-
export declare const base: StoryObj<{
|
|
13
|
-
handleEffect: Mock;
|
|
14
|
-
}>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { expect, fn, userEvent } from "storybook/test";
|
|
3
|
-
import Button from "../../components/Button/index.js";
|
|
4
|
-
import View from "../../components/View/index.js";
|
|
5
|
-
import useHandlerRef from "../useHandlerRef.js";
|
|
6
|
-
export default {
|
|
7
|
-
title: "Hooks/useHandlerRef",
|
|
8
|
-
parameters: {
|
|
9
|
-
chromatic: { disableSnapshot: true },
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
const Component = (props) => {
|
|
13
|
-
const { onEffect, count } = props;
|
|
14
|
-
const onEffectRef = useHandlerRef(onEffect);
|
|
15
|
-
React.useEffect(() => {
|
|
16
|
-
onEffectRef.current();
|
|
17
|
-
}, [onEffectRef]);
|
|
18
|
-
return <>Counter: {count}</>;
|
|
19
|
-
};
|
|
20
|
-
export const base = {
|
|
21
|
-
name: "base",
|
|
22
|
-
args: {
|
|
23
|
-
handleEffect: fn(),
|
|
24
|
-
},
|
|
25
|
-
render: (args) => {
|
|
26
|
-
const [count, setCount] = React.useState(0);
|
|
27
|
-
// Creating a new handler on each render
|
|
28
|
-
const handleEffect = () => {
|
|
29
|
-
args.handleEffect(0);
|
|
30
|
-
};
|
|
31
|
-
return (<View gap={4}>
|
|
32
|
-
<Button onClick={() => setCount((prev) => prev + 1)}>Increase count</Button>
|
|
33
|
-
<Component onEffect={handleEffect} count={count}/>
|
|
34
|
-
</View>);
|
|
35
|
-
},
|
|
36
|
-
play: async ({ canvas, args }) => {
|
|
37
|
-
const button = canvas.getAllByRole("button")[0];
|
|
38
|
-
// mount, triggerred twice in dev mode
|
|
39
|
-
expect(args.handleEffect).toHaveBeenCalledTimes(2);
|
|
40
|
-
await userEvent.click(button);
|
|
41
|
-
// Rerendering the component doesn't re-trigger the effect
|
|
42
|
-
expect(args.handleEffect).toHaveBeenCalledTimes(2);
|
|
43
|
-
},
|
|
44
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { fn } from "storybook/test";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
parameters: {
|
|
6
|
-
chromatic: {
|
|
7
|
-
disableSnapshot: boolean;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
12
|
-
export declare const base: {
|
|
13
|
-
name: string;
|
|
14
|
-
render: () => import("react").JSX.Element;
|
|
15
|
-
};
|
|
16
|
-
export declare const singleKey: StoryObj<{
|
|
17
|
-
handleHotkey: ReturnType<typeof fn>;
|
|
18
|
-
}>;
|
|
19
|
-
export declare const modKey: StoryObj<{
|
|
20
|
-
handleHotkey: ReturnType<typeof fn>;
|
|
21
|
-
}>;
|
|
22
|
-
export declare const modKeyHold: StoryObj<{
|
|
23
|
-
handleHotkey: ReturnType<typeof fn>;
|
|
24
|
-
}>;
|
|
25
|
-
export declare const keyList: StoryObj<{
|
|
26
|
-
handleHotkey: ReturnType<typeof fn>;
|
|
27
|
-
}>;
|
|
28
|
-
export declare const keyCombination: StoryObj<{
|
|
29
|
-
handleHotkey: ReturnType<typeof fn>;
|
|
30
|
-
}>;
|
|
31
|
-
export declare const keyCombinationFormat: StoryObj<{
|
|
32
|
-
handleHotkey: ReturnType<typeof fn>;
|
|
33
|
-
}>;
|
|
34
|
-
export declare const keyCombinationOrder: StoryObj<{
|
|
35
|
-
handleHotkey: ReturnType<typeof fn>;
|
|
36
|
-
}>;
|
|
37
|
-
export declare const keyCombinationMoreThanRequired: StoryObj<{
|
|
38
|
-
handleHotkey: ReturnType<typeof fn>;
|
|
39
|
-
}>;
|
|
40
|
-
export declare const optionModified: StoryObj<{
|
|
41
|
-
handleHotkey: ReturnType<typeof fn>;
|
|
42
|
-
handleHotkeyModified: ReturnType<typeof fn>;
|
|
43
|
-
}>;
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { expect, fn, userEvent } from "storybook/test";
|
|
2
|
-
import View from "../../components/View/index.js";
|
|
3
|
-
import useHotkeys from "../useHotkeys.js";
|
|
4
|
-
export default {
|
|
5
|
-
title: "Hooks/useHotkeys",
|
|
6
|
-
parameters: {
|
|
7
|
-
chromatic: { disableSnapshot: true },
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
export const base = {
|
|
11
|
-
name: "base",
|
|
12
|
-
render: () => {
|
|
13
|
-
const { checkHotkeyState } = useHotkeys({
|
|
14
|
-
"shift + b + n": () => console.log("pressed"),
|
|
15
|
-
"c + v": () => console.log("c + v"),
|
|
16
|
-
"Meta + k": () => console.log("meta + k"),
|
|
17
|
-
"Meta + f": () => console.log("meta + f"),
|
|
18
|
-
"Meta + v": () => console.log("meta + v"),
|
|
19
|
-
"Meta + b": () => console.log("meta + b"),
|
|
20
|
-
"control + enter": () => console.log("control + enter"),
|
|
21
|
-
"meta + enter": () => console.log("meta + enter"),
|
|
22
|
-
"mod + enter": () => console.log("mod + enter"),
|
|
23
|
-
"mod + ArrowRight": () => console.log("right"),
|
|
24
|
-
"mod + ArrowUp": () => console.log("top"),
|
|
25
|
-
"shift + ArrowRight": () => console.log("right"),
|
|
26
|
-
"shift + ArrowUp": () => console.log("top"),
|
|
27
|
-
"alt+shift+n": () => console.log("alt+shift+n"),
|
|
28
|
-
"shift+alt+n": () => console.log("shift+alt+n"),
|
|
29
|
-
"alt+shiftLeft+n": () => console.log("alt+shiftLeft+n"),
|
|
30
|
-
});
|
|
31
|
-
const active = checkHotkeyState("shift + b + n");
|
|
32
|
-
const shiftActive = checkHotkeyState("shift");
|
|
33
|
-
const bActive = checkHotkeyState("b");
|
|
34
|
-
const nActive = checkHotkeyState("n");
|
|
35
|
-
return (<View animated gap={2} direction="row" backgroundColor={active ? "positive-faded" : undefined} padding={2} borderRadius="small">
|
|
36
|
-
<View paddingInline={4} paddingBlock={2} borderRadius="small" borderColor="neutral-faded" animated backgroundColor={shiftActive ? "neutral-faded" : "elevation-raised"} shadow={shiftActive ? undefined : "raised"}>
|
|
37
|
-
Shift
|
|
38
|
-
</View>
|
|
39
|
-
<View paddingInline={4} paddingBlock={2} borderRadius="small" borderColor="neutral-faded" animated backgroundColor={bActive ? "neutral-faded" : "elevation-raised"} shadow={bActive ? undefined : "raised"}>
|
|
40
|
-
b
|
|
41
|
-
</View>
|
|
42
|
-
<View paddingInline={4} paddingBlock={2} borderRadius="small" borderColor="neutral-faded" animated backgroundColor={nActive ? "neutral-faded" : "elevation-raised"} shadow={nActive ? undefined : "raised"}>
|
|
43
|
-
n
|
|
44
|
-
</View>
|
|
45
|
-
</View>);
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
const Component = (props) => {
|
|
49
|
-
const { hotkeys } = props;
|
|
50
|
-
useHotkeys(hotkeys);
|
|
51
|
-
return <div />;
|
|
52
|
-
};
|
|
53
|
-
export const singleKey = {
|
|
54
|
-
name: "single key",
|
|
55
|
-
args: {
|
|
56
|
-
handleHotkey: fn(),
|
|
57
|
-
},
|
|
58
|
-
render: (args) => <Component hotkeys={{ a: args.handleHotkey }}/>,
|
|
59
|
-
play: async ({ args }) => {
|
|
60
|
-
await userEvent.keyboard("a");
|
|
61
|
-
await userEvent.keyboard("b");
|
|
62
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(1);
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
export const modKey = {
|
|
66
|
-
name: "mod key",
|
|
67
|
-
args: {
|
|
68
|
-
handleHotkey: fn(),
|
|
69
|
-
},
|
|
70
|
-
render: (args) => <Component hotkeys={{ mod: args.handleHotkey }}/>,
|
|
71
|
-
play: async ({ args }) => {
|
|
72
|
-
await userEvent.keyboard("{Meta/}");
|
|
73
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(1);
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
export const modKeyHold = {
|
|
77
|
-
name: "mod key on hold",
|
|
78
|
-
args: {
|
|
79
|
-
handleHotkey: fn(),
|
|
80
|
-
},
|
|
81
|
-
render: (args) => <Component hotkeys={{ "Meta + b": args.handleHotkey }}/>,
|
|
82
|
-
play: async ({ args }) => {
|
|
83
|
-
await userEvent.keyboard("{Meta>}bb{/Meta}");
|
|
84
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(2);
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
export const keyList = {
|
|
88
|
-
name: "key list",
|
|
89
|
-
args: {
|
|
90
|
-
handleHotkey: fn(),
|
|
91
|
-
},
|
|
92
|
-
render: (args) => <Component hotkeys={{ "a,b": args.handleHotkey }}/>,
|
|
93
|
-
play: async ({ args }) => {
|
|
94
|
-
await userEvent.keyboard("a");
|
|
95
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(1);
|
|
96
|
-
await userEvent.keyboard("b");
|
|
97
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(2);
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
export const keyCombination = {
|
|
101
|
-
name: "key combination",
|
|
102
|
-
args: {
|
|
103
|
-
handleHotkey: fn(),
|
|
104
|
-
},
|
|
105
|
-
render: (args) => <Component hotkeys={{ "a+b": args.handleHotkey }}/>,
|
|
106
|
-
play: async ({ args }) => {
|
|
107
|
-
await userEvent.keyboard("{a>}b{/a}");
|
|
108
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(1);
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
export const keyCombinationFormat = {
|
|
112
|
-
name: "key combination without formatting",
|
|
113
|
-
args: {
|
|
114
|
-
handleHotkey: fn(),
|
|
115
|
-
},
|
|
116
|
-
render: (args) => <Component hotkeys={{ "A + b": args.handleHotkey }}/>,
|
|
117
|
-
play: async ({ args }) => {
|
|
118
|
-
await userEvent.keyboard("{a>}b{/a}");
|
|
119
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(1);
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
export const keyCombinationOrder = {
|
|
123
|
-
name: "key combination without order",
|
|
124
|
-
args: {
|
|
125
|
-
handleHotkey: fn(),
|
|
126
|
-
},
|
|
127
|
-
render: (args) => <Component hotkeys={{ "b+a": args.handleHotkey }}/>,
|
|
128
|
-
play: async ({ args }) => {
|
|
129
|
-
await userEvent.keyboard("{a>}b{/a}");
|
|
130
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(1);
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
export const keyCombinationMoreThanRequired = {
|
|
134
|
-
name: "key combination, more keys pressed",
|
|
135
|
-
args: {
|
|
136
|
-
handleHotkey: fn(),
|
|
137
|
-
},
|
|
138
|
-
render: (args) => <Component hotkeys={{ "z + x": args.handleHotkey }}/>,
|
|
139
|
-
play: async ({ args }) => {
|
|
140
|
-
await userEvent.keyboard("{z>}{x>}c{/x}{/z}");
|
|
141
|
-
// When c is pressed, it doesn't trigger a+b for the second time
|
|
142
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(1);
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
export const optionModified = {
|
|
146
|
-
name: "modified with alt/option",
|
|
147
|
-
args: {
|
|
148
|
-
handleHotkey: fn(),
|
|
149
|
-
handleHotkeyModified: fn(),
|
|
150
|
-
},
|
|
151
|
-
render: (args) => (<Component hotkeys={{ "alt+n": args.handleHotkeyModified, "alt+shift": args.handleHotkey }}/>),
|
|
152
|
-
play: async ({ args }) => {
|
|
153
|
-
await userEvent.keyboard("{Alt>}n{/Alt}");
|
|
154
|
-
expect(args.handleHotkeyModified).toHaveBeenCalledTimes(1);
|
|
155
|
-
await userEvent.keyboard("{Alt>}{Shift}{/Alt}");
|
|
156
|
-
expect(args.handleHotkey).toHaveBeenCalledTimes(1);
|
|
157
|
-
},
|
|
158
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
title: string;
|
|
4
|
-
parameters: {
|
|
5
|
-
chromatic: {
|
|
6
|
-
disableSnapshot: boolean;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
11
|
-
export declare const base: StoryObj;
|
|
12
|
-
export declare const horizontal: StoryObj;
|
|
13
|
-
export declare const vertical: StoryObj;
|
|
14
|
-
export declare const circular: StoryObj;
|
|
15
|
-
export declare const disabled: StoryObj;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
2
|
-
import { expect, userEvent } from "storybook/test";
|
|
3
|
-
import View from "../../components/View/index.js";
|
|
4
|
-
import Button from "../../components/Button/index.js";
|
|
5
|
-
import useKeyboardArrowNavigation from "../useKeyboardArrowNavigation.js";
|
|
6
|
-
export default {
|
|
7
|
-
title: "Hooks/useKeyboardArrowNavigation",
|
|
8
|
-
parameters: {
|
|
9
|
-
chromatic: { disableSnapshot: true },
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
export const base = {
|
|
13
|
-
name: "base",
|
|
14
|
-
render: () => {
|
|
15
|
-
const ref = useRef(null);
|
|
16
|
-
useKeyboardArrowNavigation({ ref });
|
|
17
|
-
return (<View gap={2} direction="row" attributes={{ ref }}>
|
|
18
|
-
<Button onClick={() => { }}>Action 1</Button>
|
|
19
|
-
<Button onClick={() => { }}>Action 2</Button>
|
|
20
|
-
<Button onClick={() => { }}>Action 3</Button>
|
|
21
|
-
</View>);
|
|
22
|
-
},
|
|
23
|
-
play: async ({ canvas }) => {
|
|
24
|
-
const buttons = canvas.getAllByRole("button");
|
|
25
|
-
buttons[0].focus();
|
|
26
|
-
await userEvent.keyboard("{ArrowRight/}");
|
|
27
|
-
expect(document.activeElement).toBe(buttons[1]);
|
|
28
|
-
await userEvent.keyboard("{ArrowDown/}");
|
|
29
|
-
expect(document.activeElement).toBe(buttons[2]);
|
|
30
|
-
await userEvent.keyboard("{ArrowUp/}");
|
|
31
|
-
expect(document.activeElement).toBe(buttons[1]);
|
|
32
|
-
await userEvent.keyboard("{ArrowLeft/}");
|
|
33
|
-
expect(document.activeElement).toBe(buttons[0]);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
export const horizontal = {
|
|
37
|
-
name: "orientation: horizontal",
|
|
38
|
-
render: () => {
|
|
39
|
-
const ref = useRef(null);
|
|
40
|
-
useKeyboardArrowNavigation({ ref, orientation: "horizontal" });
|
|
41
|
-
return (<View gap={2} direction="row" attributes={{ ref }}>
|
|
42
|
-
<Button onClick={() => { }}>Action 1</Button>
|
|
43
|
-
<Button onClick={() => { }}>Action 2</Button>
|
|
44
|
-
<Button onClick={() => { }}>Action 3</Button>
|
|
45
|
-
</View>);
|
|
46
|
-
},
|
|
47
|
-
play: async ({ canvas }) => {
|
|
48
|
-
const buttons = canvas.getAllByRole("button");
|
|
49
|
-
expect(buttons[0]).toHaveAttribute("tabindex", "0");
|
|
50
|
-
expect(buttons[1]).toHaveAttribute("tabindex", "-1");
|
|
51
|
-
expect(buttons[2]).toHaveAttribute("tabindex", "-1");
|
|
52
|
-
buttons[0].focus();
|
|
53
|
-
await userEvent.keyboard("{ArrowRight/}");
|
|
54
|
-
expect(document.activeElement).toBe(buttons[1]);
|
|
55
|
-
await userEvent.keyboard("{ArrowLeft/}");
|
|
56
|
-
expect(document.activeElement).toBe(buttons[0]);
|
|
57
|
-
await userEvent.keyboard("{ArrowDown/}");
|
|
58
|
-
expect(document.activeElement).toBe(buttons[0]);
|
|
59
|
-
await userEvent.keyboard("{ArrowUp/}");
|
|
60
|
-
expect(document.activeElement).toBe(buttons[0]);
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
export const vertical = {
|
|
64
|
-
name: "orientation: vertical",
|
|
65
|
-
render: () => {
|
|
66
|
-
const ref = useRef(null);
|
|
67
|
-
useKeyboardArrowNavigation({ ref, orientation: "vertical" });
|
|
68
|
-
return (<View gap={2} direction="column" attributes={{ ref }}>
|
|
69
|
-
<Button onClick={() => { }}>Action 1</Button>
|
|
70
|
-
<Button onClick={() => { }}>Action 2</Button>
|
|
71
|
-
<Button onClick={() => { }}>Action 3</Button>
|
|
72
|
-
</View>);
|
|
73
|
-
},
|
|
74
|
-
play: async ({ canvas }) => {
|
|
75
|
-
const buttons = canvas.getAllByRole("button");
|
|
76
|
-
buttons[0].focus();
|
|
77
|
-
await userEvent.keyboard("{ArrowDown/}");
|
|
78
|
-
expect(document.activeElement).toBe(buttons[1]);
|
|
79
|
-
await userEvent.keyboard("{ArrowUp/}");
|
|
80
|
-
expect(document.activeElement).toBe(buttons[0]);
|
|
81
|
-
await userEvent.keyboard("{ArrowRight/}");
|
|
82
|
-
expect(document.activeElement).toBe(buttons[0]);
|
|
83
|
-
await userEvent.keyboard("{ArrowLeft/}");
|
|
84
|
-
expect(document.activeElement).toBe(buttons[0]);
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
export const circular = {
|
|
88
|
-
name: "circular",
|
|
89
|
-
render: () => {
|
|
90
|
-
const ref = useRef(null);
|
|
91
|
-
useKeyboardArrowNavigation({ ref, circular: true });
|
|
92
|
-
return (<View gap={2} direction="row" attributes={{ ref }}>
|
|
93
|
-
<Button onClick={() => { }}>Action 1</Button>
|
|
94
|
-
<Button onClick={() => { }}>Action 2</Button>
|
|
95
|
-
<Button onClick={() => { }}>Action 3</Button>
|
|
96
|
-
</View>);
|
|
97
|
-
},
|
|
98
|
-
play: async ({ canvas }) => {
|
|
99
|
-
const buttons = canvas.getAllByRole("button");
|
|
100
|
-
buttons[0].focus();
|
|
101
|
-
await userEvent.keyboard("{ArrowRight/}");
|
|
102
|
-
await userEvent.keyboard("{ArrowRight/}");
|
|
103
|
-
expect(document.activeElement).toBe(buttons[2]);
|
|
104
|
-
await userEvent.keyboard("{ArrowRight/}");
|
|
105
|
-
expect(document.activeElement).toBe(buttons[0]);
|
|
106
|
-
await userEvent.keyboard("{ArrowLeft/}");
|
|
107
|
-
expect(document.activeElement).toBe(buttons[2]);
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
export const disabled = {
|
|
111
|
-
name: "disabled",
|
|
112
|
-
render: () => {
|
|
113
|
-
const ref = useRef(null);
|
|
114
|
-
useKeyboardArrowNavigation({ ref, disabled: true });
|
|
115
|
-
return (<View gap={2} direction="row" attributes={{ ref }}>
|
|
116
|
-
<Button onClick={() => { }}>Action 1</Button>
|
|
117
|
-
<Button onClick={() => { }}>Action 2</Button>
|
|
118
|
-
<Button onClick={() => { }}>Action 3</Button>
|
|
119
|
-
</View>);
|
|
120
|
-
},
|
|
121
|
-
play: async ({ canvas }) => {
|
|
122
|
-
const buttons = canvas.getAllByRole("button");
|
|
123
|
-
buttons[0].focus();
|
|
124
|
-
await userEvent.keyboard("{ArrowRight/}");
|
|
125
|
-
expect(document.activeElement).toBe(buttons[0]);
|
|
126
|
-
expect(buttons[0]).not.toHaveAttribute("tabindex");
|
|
127
|
-
},
|
|
128
|
-
};
|