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,432 +0,0 @@
|
|
|
1
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
2
|
-
import { useToast, ToastProvider } from "../index.js";
|
|
3
|
-
import Button from "../../Button/index.js";
|
|
4
|
-
import View from "../../View/index.js";
|
|
5
|
-
import Image from "../../Image/index.js";
|
|
6
|
-
import Text from "../../Text/index.js";
|
|
7
|
-
import Dismissible from "../../Dismissible/index.js";
|
|
8
|
-
import IconZap from "../../../icons/Zap.js";
|
|
9
|
-
import { expect, userEvent, waitFor, within } from "storybook/test";
|
|
10
|
-
import { sleep } from "../../../utilities/helpers.js";
|
|
11
|
-
export default {
|
|
12
|
-
title: "Components/Toast",
|
|
13
|
-
parameters: {
|
|
14
|
-
iframe: {
|
|
15
|
-
url: "https://reshaped.so/docs/components/toast",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
const Size = () => {
|
|
20
|
-
const toast = useToast();
|
|
21
|
-
const props = {
|
|
22
|
-
icon: IconZap,
|
|
23
|
-
title: "Hey!",
|
|
24
|
-
text: "Event completed",
|
|
25
|
-
actionsSlot: [<Button>Action</Button>],
|
|
26
|
-
};
|
|
27
|
-
return (<Example>
|
|
28
|
-
<Example.Item title="size: small">
|
|
29
|
-
<Button onClick={() => {
|
|
30
|
-
toast.show({ ...props });
|
|
31
|
-
}}>
|
|
32
|
-
Show toast
|
|
33
|
-
</Button>
|
|
34
|
-
</Example.Item>
|
|
35
|
-
<Example.Item title="size: medium">
|
|
36
|
-
<Button onClick={() => {
|
|
37
|
-
toast.show({ ...props, size: "medium" });
|
|
38
|
-
}}>
|
|
39
|
-
Show toast
|
|
40
|
-
</Button>
|
|
41
|
-
</Example.Item>
|
|
42
|
-
<Example.Item title="large">
|
|
43
|
-
<Button onClick={() => {
|
|
44
|
-
toast.show({ ...props, size: "large" });
|
|
45
|
-
}}>
|
|
46
|
-
Show toast
|
|
47
|
-
</Button>
|
|
48
|
-
</Example.Item>
|
|
49
|
-
</Example>);
|
|
50
|
-
};
|
|
51
|
-
export const size = { name: "size", render: () => <Size /> };
|
|
52
|
-
const Position = () => {
|
|
53
|
-
const toast = useToast();
|
|
54
|
-
return (<Example>
|
|
55
|
-
<Example.Item title="position: bottom-start">
|
|
56
|
-
<Button onClick={() => {
|
|
57
|
-
const id = toast.show({
|
|
58
|
-
text: "Event completed",
|
|
59
|
-
position: "bottom-start",
|
|
60
|
-
actionsSlot: <Button onClick={() => toast.hide(id)}>Close</Button>,
|
|
61
|
-
});
|
|
62
|
-
}}>
|
|
63
|
-
Show toast
|
|
64
|
-
</Button>
|
|
65
|
-
</Example.Item>
|
|
66
|
-
<Example.Item title="position: bottom">
|
|
67
|
-
<Button onClick={() => {
|
|
68
|
-
toast.show({
|
|
69
|
-
text: "Event completed",
|
|
70
|
-
position: "bottom",
|
|
71
|
-
});
|
|
72
|
-
}}>
|
|
73
|
-
Show toast
|
|
74
|
-
</Button>
|
|
75
|
-
</Example.Item>
|
|
76
|
-
<Example.Item title="position: bottom-end">
|
|
77
|
-
<Button onClick={() => {
|
|
78
|
-
toast.show({
|
|
79
|
-
text: "Event completed",
|
|
80
|
-
position: "bottom-end",
|
|
81
|
-
});
|
|
82
|
-
}}>
|
|
83
|
-
Show toast
|
|
84
|
-
</Button>
|
|
85
|
-
</Example.Item>
|
|
86
|
-
<Example.Item title="position: top-start">
|
|
87
|
-
<Button onClick={() => {
|
|
88
|
-
toast.show({
|
|
89
|
-
text: "Event completed",
|
|
90
|
-
position: "top-start",
|
|
91
|
-
});
|
|
92
|
-
}}>
|
|
93
|
-
Show toast
|
|
94
|
-
</Button>
|
|
95
|
-
</Example.Item>
|
|
96
|
-
<Example.Item title="position: top">
|
|
97
|
-
<Button onClick={() => {
|
|
98
|
-
toast.show({
|
|
99
|
-
text: "Event completed",
|
|
100
|
-
position: "top",
|
|
101
|
-
});
|
|
102
|
-
}}>
|
|
103
|
-
Show toast
|
|
104
|
-
</Button>
|
|
105
|
-
</Example.Item>
|
|
106
|
-
<Example.Item title="position: top-end">
|
|
107
|
-
<Button onClick={() => {
|
|
108
|
-
toast.show({
|
|
109
|
-
text: "Event completed",
|
|
110
|
-
position: "top-end",
|
|
111
|
-
});
|
|
112
|
-
}}>
|
|
113
|
-
Show toast
|
|
114
|
-
</Button>
|
|
115
|
-
</Example.Item>
|
|
116
|
-
</Example>);
|
|
117
|
-
};
|
|
118
|
-
export const position = { name: "position", render: () => <Position /> };
|
|
119
|
-
const Color = () => {
|
|
120
|
-
const toast = useToast();
|
|
121
|
-
return (<Example>
|
|
122
|
-
<Example.Item title="color: inverted">
|
|
123
|
-
<Button onClick={() => {
|
|
124
|
-
const id = toast.show({
|
|
125
|
-
text: "Event completed",
|
|
126
|
-
color: "inverted",
|
|
127
|
-
title: "Hey!",
|
|
128
|
-
icon: IconZap,
|
|
129
|
-
actionsSlot: [
|
|
130
|
-
<Button onClick={() => toast.hide(id)}>Undo</Button>,
|
|
131
|
-
<Button onClick={() => toast.hide(id)}>Hide</Button>,
|
|
132
|
-
],
|
|
133
|
-
});
|
|
134
|
-
}}>
|
|
135
|
-
Show toast
|
|
136
|
-
</Button>
|
|
137
|
-
</Example.Item>
|
|
138
|
-
<Example.Item title="color: neutral">
|
|
139
|
-
<Button onClick={() => {
|
|
140
|
-
const id = toast.show({
|
|
141
|
-
text: "Event completed",
|
|
142
|
-
color: "neutral",
|
|
143
|
-
title: "Hey!",
|
|
144
|
-
icon: IconZap,
|
|
145
|
-
actionsSlot: [
|
|
146
|
-
<Button onClick={() => toast.hide(id)}>Undo</Button>,
|
|
147
|
-
<Button onClick={() => toast.hide(id)}>Hide</Button>,
|
|
148
|
-
],
|
|
149
|
-
});
|
|
150
|
-
}}>
|
|
151
|
-
Show toast
|
|
152
|
-
</Button>
|
|
153
|
-
</Example.Item>
|
|
154
|
-
<Example.Item title="color: primary">
|
|
155
|
-
<Button onClick={() => {
|
|
156
|
-
const id = toast.show({
|
|
157
|
-
text: "Event completed",
|
|
158
|
-
color: "primary",
|
|
159
|
-
title: "Hey!",
|
|
160
|
-
icon: IconZap,
|
|
161
|
-
actionsSlot: [
|
|
162
|
-
<Button onClick={() => toast.hide(id)}>Undo</Button>,
|
|
163
|
-
<Button onClick={() => toast.hide(id)}>Hide</Button>,
|
|
164
|
-
],
|
|
165
|
-
});
|
|
166
|
-
}}>
|
|
167
|
-
Show toast
|
|
168
|
-
</Button>
|
|
169
|
-
</Example.Item>
|
|
170
|
-
<Example.Item title="color: positive">
|
|
171
|
-
<Button onClick={() => {
|
|
172
|
-
const id = toast.show({
|
|
173
|
-
text: "Event completed",
|
|
174
|
-
color: "positive",
|
|
175
|
-
title: "Hey!",
|
|
176
|
-
icon: IconZap,
|
|
177
|
-
actionsSlot: [
|
|
178
|
-
<Button onClick={() => toast.hide(id)}>Undo</Button>,
|
|
179
|
-
<Button onClick={() => toast.hide(id)}>Hide</Button>,
|
|
180
|
-
],
|
|
181
|
-
});
|
|
182
|
-
}}>
|
|
183
|
-
Show toast
|
|
184
|
-
</Button>
|
|
185
|
-
</Example.Item>
|
|
186
|
-
<Example.Item title="color: critical">
|
|
187
|
-
<Button onClick={() => {
|
|
188
|
-
const id = toast.show({
|
|
189
|
-
text: "Event completed",
|
|
190
|
-
color: "critical",
|
|
191
|
-
title: "Hey!",
|
|
192
|
-
icon: IconZap,
|
|
193
|
-
actionsSlot: [
|
|
194
|
-
<Button onClick={() => toast.hide(id)}>Undo</Button>,
|
|
195
|
-
<Button onClick={() => toast.hide(id)}>Hide</Button>,
|
|
196
|
-
],
|
|
197
|
-
});
|
|
198
|
-
}}>
|
|
199
|
-
Show toast
|
|
200
|
-
</Button>
|
|
201
|
-
</Example.Item>
|
|
202
|
-
<Example.Item title="color: warning">
|
|
203
|
-
<Button onClick={() => {
|
|
204
|
-
const id = toast.show({
|
|
205
|
-
text: "Event completed",
|
|
206
|
-
color: "warning",
|
|
207
|
-
title: "Hey!",
|
|
208
|
-
icon: IconZap,
|
|
209
|
-
actionsSlot: [
|
|
210
|
-
<Button onClick={() => toast.hide(id)}>Undo</Button>,
|
|
211
|
-
<Button onClick={() => toast.hide(id)}>Hide</Button>,
|
|
212
|
-
],
|
|
213
|
-
});
|
|
214
|
-
}}>
|
|
215
|
-
Show toast
|
|
216
|
-
</Button>
|
|
217
|
-
</Example.Item>
|
|
218
|
-
</Example>);
|
|
219
|
-
};
|
|
220
|
-
export const color = { name: "color", render: () => <Color /> };
|
|
221
|
-
const Timeout = () => {
|
|
222
|
-
const toast = useToast();
|
|
223
|
-
return (<Example>
|
|
224
|
-
<Example.Item title="timeout: short">
|
|
225
|
-
<Button onClick={() => {
|
|
226
|
-
toast.show({
|
|
227
|
-
text: "Event completed",
|
|
228
|
-
timeout: "short",
|
|
229
|
-
});
|
|
230
|
-
}}>
|
|
231
|
-
Show toast
|
|
232
|
-
</Button>
|
|
233
|
-
</Example.Item>
|
|
234
|
-
<Example.Item title="timeout: long">
|
|
235
|
-
<Button onClick={() => {
|
|
236
|
-
toast.show({
|
|
237
|
-
text: "Event completed",
|
|
238
|
-
timeout: "long",
|
|
239
|
-
});
|
|
240
|
-
}}>
|
|
241
|
-
Show toast
|
|
242
|
-
</Button>
|
|
243
|
-
</Example.Item>
|
|
244
|
-
<Example.Item title="timeout: 0">
|
|
245
|
-
<Button onClick={() => {
|
|
246
|
-
toast.show({
|
|
247
|
-
text: "Event completed",
|
|
248
|
-
timeout: 0,
|
|
249
|
-
});
|
|
250
|
-
}}>
|
|
251
|
-
Show toast
|
|
252
|
-
</Button>
|
|
253
|
-
</Example.Item>
|
|
254
|
-
</Example>);
|
|
255
|
-
};
|
|
256
|
-
export const timeout = { name: "timeout", render: () => <Timeout /> };
|
|
257
|
-
const Expanded = () => {
|
|
258
|
-
const toast = useToast();
|
|
259
|
-
return (<Example>
|
|
260
|
-
<Example.Item title="Custom width coming from Reshaped provider for bottom-start">
|
|
261
|
-
<Button onClick={() => {
|
|
262
|
-
toast.show({
|
|
263
|
-
text: "Event completed",
|
|
264
|
-
position: "bottom-start",
|
|
265
|
-
});
|
|
266
|
-
}}>
|
|
267
|
-
Show toast
|
|
268
|
-
</Button>
|
|
269
|
-
</Example.Item>
|
|
270
|
-
</Example>);
|
|
271
|
-
};
|
|
272
|
-
export const regionOptions = { name: "expanded", render: () => <Expanded /> };
|
|
273
|
-
const Slots = () => {
|
|
274
|
-
const toast = useToast();
|
|
275
|
-
return (<Example>
|
|
276
|
-
<Example.Item title="always expanded, promotion banner">
|
|
277
|
-
<Button onClick={() => {
|
|
278
|
-
const id = toast.show({
|
|
279
|
-
children: (<View gap={3} direction="row">
|
|
280
|
-
<View aspectRatio={1}>
|
|
281
|
-
<Image height="100px" src="https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=400&q=80" borderRadius="medium"/>
|
|
282
|
-
</View>
|
|
283
|
-
<View.Item grow>
|
|
284
|
-
<View gap={1}>
|
|
285
|
-
<Dismissible closeAriaLabel="Close notification" onClose={() => toast.hide(id)}>
|
|
286
|
-
<Text variant="body-2" weight="bold">
|
|
287
|
-
Look at this gradient!
|
|
288
|
-
</Text>
|
|
289
|
-
</Dismissible>
|
|
290
|
-
<Text variant="body-3">
|
|
291
|
-
If you start using more gradients, your product will become even more
|
|
292
|
-
succesful.
|
|
293
|
-
</Text>
|
|
294
|
-
</View>
|
|
295
|
-
</View.Item>
|
|
296
|
-
</View>),
|
|
297
|
-
color: "neutral",
|
|
298
|
-
position: "bottom-start",
|
|
299
|
-
timeout: 0,
|
|
300
|
-
});
|
|
301
|
-
}}>
|
|
302
|
-
Show toast
|
|
303
|
-
</Button>
|
|
304
|
-
</Example.Item>
|
|
305
|
-
</Example>);
|
|
306
|
-
};
|
|
307
|
-
export const slots = { name: "slots", render: () => <Slots /> };
|
|
308
|
-
export const base = {
|
|
309
|
-
name: "base",
|
|
310
|
-
render: () => {
|
|
311
|
-
const toast = useToast();
|
|
312
|
-
return (<Button onClick={() => {
|
|
313
|
-
const id = toast.show({
|
|
314
|
-
title: "Title",
|
|
315
|
-
text: "Text",
|
|
316
|
-
children: "Children",
|
|
317
|
-
startSlot: "Slot",
|
|
318
|
-
actionsSlot: (<Button attributes={{ "data-testid": "trigger-id" }} onClick={() => toast.hide(id)}>
|
|
319
|
-
Trigger
|
|
320
|
-
</Button>),
|
|
321
|
-
});
|
|
322
|
-
}}>
|
|
323
|
-
Show toast
|
|
324
|
-
</Button>);
|
|
325
|
-
},
|
|
326
|
-
play: async ({ canvasElement }) => {
|
|
327
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
|
328
|
-
const button = canvas.getAllByRole("button")[0];
|
|
329
|
-
await userEvent.click(button);
|
|
330
|
-
const title = canvas.getByText("Title");
|
|
331
|
-
const text = canvas.getByText("Text");
|
|
332
|
-
const children = canvas.getByText("Children");
|
|
333
|
-
const slot = canvas.getByText("Slot");
|
|
334
|
-
const action = canvas.getByTestId("trigger-id");
|
|
335
|
-
expect(title).toBeInTheDocument();
|
|
336
|
-
expect(text).toBeInTheDocument();
|
|
337
|
-
expect(children).toBeInTheDocument();
|
|
338
|
-
expect(slot).toBeInTheDocument();
|
|
339
|
-
expect(action).toBeInTheDocument();
|
|
340
|
-
await userEvent.click(action);
|
|
341
|
-
await sleep(600);
|
|
342
|
-
await waitFor(() => {
|
|
343
|
-
expect(title).not.toBeInTheDocument();
|
|
344
|
-
});
|
|
345
|
-
},
|
|
346
|
-
};
|
|
347
|
-
const NestedDemo = () => {
|
|
348
|
-
const toast = useToast();
|
|
349
|
-
return (<Button onClick={() => {
|
|
350
|
-
toast.show({
|
|
351
|
-
text: "Content",
|
|
352
|
-
});
|
|
353
|
-
}}>
|
|
354
|
-
Show toast
|
|
355
|
-
</Button>);
|
|
356
|
-
};
|
|
357
|
-
export const nested = {
|
|
358
|
-
name: "ToastProvider",
|
|
359
|
-
render: () => {
|
|
360
|
-
return (<div data-testid="test-container-id">
|
|
361
|
-
<ToastProvider>
|
|
362
|
-
<NestedDemo />
|
|
363
|
-
</ToastProvider>
|
|
364
|
-
</div>);
|
|
365
|
-
},
|
|
366
|
-
play: async ({ canvasElement }) => {
|
|
367
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
|
368
|
-
const button = canvas.getAllByRole("button")[0];
|
|
369
|
-
await userEvent.click(button);
|
|
370
|
-
const container = canvas.getByTestId("test-container-id");
|
|
371
|
-
const toast = within(container).getByText("Content");
|
|
372
|
-
expect(toast).toBeInTheDocument();
|
|
373
|
-
},
|
|
374
|
-
};
|
|
375
|
-
export const className = {
|
|
376
|
-
name: "className, attributes",
|
|
377
|
-
render: () => {
|
|
378
|
-
const toast = useToast();
|
|
379
|
-
return (<Button onClick={() => {
|
|
380
|
-
const id = toast.show({
|
|
381
|
-
text: "Content",
|
|
382
|
-
attributes: { "data-testid": "test-id" },
|
|
383
|
-
className: "test-classname",
|
|
384
|
-
});
|
|
385
|
-
}}>
|
|
386
|
-
Show toast
|
|
387
|
-
</Button>);
|
|
388
|
-
},
|
|
389
|
-
play: async ({ canvasElement }) => {
|
|
390
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
|
391
|
-
const button = canvas.getAllByRole("button")[0];
|
|
392
|
-
await userEvent.click(button);
|
|
393
|
-
const toast = canvas.getByTestId("test-id");
|
|
394
|
-
expect(toast).toBeInTheDocument();
|
|
395
|
-
expect(toast).toHaveClass("test-classname");
|
|
396
|
-
},
|
|
397
|
-
};
|
|
398
|
-
const Multiline = () => {
|
|
399
|
-
const toast = useToast();
|
|
400
|
-
return (<Button onClick={() => {
|
|
401
|
-
toast.show({
|
|
402
|
-
text: "Very long event completed notification message",
|
|
403
|
-
});
|
|
404
|
-
}}>
|
|
405
|
-
Show toast
|
|
406
|
-
</Button>);
|
|
407
|
-
};
|
|
408
|
-
const Nested = () => {
|
|
409
|
-
const toast = useToast();
|
|
410
|
-
return (<View height="300px">
|
|
411
|
-
<Button onClick={() => {
|
|
412
|
-
toast.show({
|
|
413
|
-
text: "Notification sent",
|
|
414
|
-
});
|
|
415
|
-
}}>
|
|
416
|
-
Show toast
|
|
417
|
-
</Button>
|
|
418
|
-
</View>);
|
|
419
|
-
};
|
|
420
|
-
export const edgeCases = {
|
|
421
|
-
name: "test: edge cases",
|
|
422
|
-
render: () => (<Example>
|
|
423
|
-
<Example.Item title="Multiline, should support dynamic height">
|
|
424
|
-
<Multiline />
|
|
425
|
-
</Example.Item>
|
|
426
|
-
<Example.Item title="Nested ToastProvider">
|
|
427
|
-
<ToastProvider>
|
|
428
|
-
<Nested />
|
|
429
|
-
</ToastProvider>
|
|
430
|
-
</Example.Item>
|
|
431
|
-
</Example>),
|
|
432
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { type Mock } from "storybook/test";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: import("react").FC<import("..").ToggleButtonProps>;
|
|
6
|
-
parameters: {
|
|
7
|
-
iframe: {
|
|
8
|
-
url: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|
|
13
|
-
export declare const variant: {
|
|
14
|
-
name: string;
|
|
15
|
-
render: () => import("react").JSX.Element;
|
|
16
|
-
};
|
|
17
|
-
export declare const selectedColor: {
|
|
18
|
-
name: string;
|
|
19
|
-
render: () => import("react").JSX.Element;
|
|
20
|
-
};
|
|
21
|
-
export declare const onChange: StoryObj<{
|
|
22
|
-
handleUncontrolledChange: Mock;
|
|
23
|
-
handleControlledChange: Mock;
|
|
24
|
-
}>;
|
|
25
|
-
export declare const onClick: StoryObj<{
|
|
26
|
-
handleClick: Mock;
|
|
27
|
-
}>;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { expect, fn, userEvent } from "storybook/test";
|
|
2
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
3
|
-
import ToggleButton from "../ToggleButton.js";
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/ToggleButton",
|
|
6
|
-
component: ToggleButton,
|
|
7
|
-
parameters: {
|
|
8
|
-
iframe: {
|
|
9
|
-
url: "https://reshaped.so/docs/components/toggle-button",
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
export const variant = {
|
|
14
|
-
name: "variant",
|
|
15
|
-
render: () => (<Example>
|
|
16
|
-
<Example.Item title="outline">
|
|
17
|
-
<ToggleButton>Button</ToggleButton>
|
|
18
|
-
</Example.Item>
|
|
19
|
-
<Example.Item title="ghost">
|
|
20
|
-
<ToggleButton variant="ghost">Button</ToggleButton>
|
|
21
|
-
</Example.Item>
|
|
22
|
-
</Example>),
|
|
23
|
-
};
|
|
24
|
-
export const selectedColor = {
|
|
25
|
-
name: "selectedColor",
|
|
26
|
-
render: () => (<Example>
|
|
27
|
-
<Example.Item title="selectedColor: primary">
|
|
28
|
-
<ToggleButton selectedColor="primary" defaultChecked>
|
|
29
|
-
Button
|
|
30
|
-
</ToggleButton>
|
|
31
|
-
</Example.Item>
|
|
32
|
-
</Example>),
|
|
33
|
-
};
|
|
34
|
-
export const onChange = {
|
|
35
|
-
name: "checked, defaultChecked, onChange",
|
|
36
|
-
args: {
|
|
37
|
-
handleUncontrolledChange: fn(),
|
|
38
|
-
handleControlledChange: fn(),
|
|
39
|
-
},
|
|
40
|
-
render: (args) => (<Example>
|
|
41
|
-
<Example.Item title="defaultChecked, onChange">
|
|
42
|
-
<ToggleButton defaultChecked onChange={args.handleUncontrolledChange} value="1">
|
|
43
|
-
Button
|
|
44
|
-
</ToggleButton>
|
|
45
|
-
</Example.Item>
|
|
46
|
-
<Example.Item title="checked, onChange">
|
|
47
|
-
<ToggleButton checked onChange={args.handleControlledChange} value="2">
|
|
48
|
-
Button
|
|
49
|
-
</ToggleButton>
|
|
50
|
-
</Example.Item>
|
|
51
|
-
</Example>),
|
|
52
|
-
play: async ({ canvas, args }) => {
|
|
53
|
-
const [uncontrolledButton, controlledButton] = canvas.getAllByRole("button");
|
|
54
|
-
await userEvent.click(uncontrolledButton);
|
|
55
|
-
expect(args.handleUncontrolledChange).toHaveBeenCalledTimes(1);
|
|
56
|
-
expect(args.handleUncontrolledChange).toHaveBeenLastCalledWith({
|
|
57
|
-
checked: false,
|
|
58
|
-
value: "1",
|
|
59
|
-
event: expect.objectContaining({ target: uncontrolledButton }),
|
|
60
|
-
});
|
|
61
|
-
await userEvent.click(uncontrolledButton);
|
|
62
|
-
expect(args.handleUncontrolledChange).toHaveBeenCalledTimes(2);
|
|
63
|
-
expect(args.handleUncontrolledChange).toHaveBeenLastCalledWith({
|
|
64
|
-
checked: true,
|
|
65
|
-
value: "1",
|
|
66
|
-
event: expect.objectContaining({ target: uncontrolledButton }),
|
|
67
|
-
});
|
|
68
|
-
await userEvent.click(controlledButton);
|
|
69
|
-
expect(args.handleControlledChange).toHaveBeenCalledTimes(1);
|
|
70
|
-
expect(args.handleControlledChange).toHaveBeenLastCalledWith({
|
|
71
|
-
checked: false,
|
|
72
|
-
value: "2",
|
|
73
|
-
event: expect.objectContaining({ target: controlledButton }),
|
|
74
|
-
});
|
|
75
|
-
await userEvent.click(controlledButton);
|
|
76
|
-
// Stayed checked after the first click
|
|
77
|
-
expect(args.handleControlledChange).toHaveBeenCalledTimes(2);
|
|
78
|
-
expect(args.handleControlledChange).toHaveBeenLastCalledWith({
|
|
79
|
-
checked: false,
|
|
80
|
-
value: "2",
|
|
81
|
-
event: expect.objectContaining({ target: uncontrolledButton }),
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
export const onClick = {
|
|
86
|
-
name: "onClick",
|
|
87
|
-
args: {
|
|
88
|
-
handleClick: fn(),
|
|
89
|
-
},
|
|
90
|
-
render: (args) => <ToggleButton onClick={args.handleClick}>Button</ToggleButton>,
|
|
91
|
-
play: async ({ canvas, args }) => {
|
|
92
|
-
const [button] = canvas.getAllByRole("button");
|
|
93
|
-
await userEvent.click(button);
|
|
94
|
-
expect(args.handleClick).toHaveBeenCalledOnce();
|
|
95
|
-
expect(args.handleClick).toHaveBeenLastCalledWith(expect.objectContaining({ target: button }));
|
|
96
|
-
},
|
|
97
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { Mock } from "storybook/test";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: import("react").FC<import("./..").ToggleButtonGroupProps>;
|
|
6
|
-
parameters: {
|
|
7
|
-
iframe: {
|
|
8
|
-
url: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|
|
13
|
-
export declare const single: StoryObj<{
|
|
14
|
-
handleUncontrolledChange: Mock;
|
|
15
|
-
handleControlledChange: Mock;
|
|
16
|
-
handleItemChange: Mock;
|
|
17
|
-
}>;
|
|
18
|
-
export declare const multiple: StoryObj<{
|
|
19
|
-
handleUncontrolledChange: Mock;
|
|
20
|
-
handleControlledChange: Mock;
|
|
21
|
-
}>;
|
|
22
|
-
export declare const selectedColor: StoryObj;
|
|
23
|
-
export declare const className: StoryObj;
|
|
24
|
-
export declare const testIcon: {
|
|
25
|
-
name: string;
|
|
26
|
-
render: () => import("react").JSX.Element;
|
|
27
|
-
};
|