reshaped 3.3.11 → 3.3.12
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/CHANGELOG.md +9 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +16 -17
- package/dist/cjs/themes/_generator/utilities/generateColors.d.ts +1 -1
- package/dist/cjs/themes/_generator/utilities/generateColors.js +3 -2
- package/dist/cjs/themes/_generator/utilities/tests/color.test.js +32 -31
- package/dist/cjs/themes/slate/theme.css +1 -1
- package/dist/components/Accordion/tests/Accordion.stories.d.ts +30 -8
- package/dist/components/Accordion/tests/Accordion.stories.js +172 -119
- package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +12 -3
- package/dist/components/ActionBar/tests/ActionBar.stories.js +51 -36
- package/dist/components/ActionBar/tests/ActionBar.test.stories.d.ts +15 -0
- package/dist/components/ActionBar/tests/ActionBar.test.stories.js +26 -0
- package/dist/components/Actionable/Actionable.js +1 -1
- package/dist/components/Actionable/tests/Actionable.stories.d.ts +19 -5
- package/dist/components/Actionable/tests/Actionable.stories.js +88 -63
- package/dist/components/Actionable/tests/Actionable.test.stories.d.ts +32 -0
- package/dist/components/Actionable/tests/Actionable.test.stories.js +130 -0
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Alert/tests/Alert.stories.d.ts +12 -3
- package/dist/components/Alert/tests/Alert.stories.js +51 -86
- package/dist/components/Alert/tests/Alert.test.stories.d.ts +15 -0
- package/dist/components/Alert/tests/Alert.test.stories.js +26 -0
- package/dist/components/Autocomplete/Autocomplete.js +9 -2
- package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +6 -2
- package/dist/components/Autocomplete/tests/Autocomplete.stories.js +94 -111
- package/dist/components/Autocomplete/tests/Autocomplete.test.stories.d.ts +23 -0
- package/dist/components/Autocomplete/tests/Autocomplete.test.stories.js +86 -0
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Avatar/tests/Avatar.stories.d.ts +14 -4
- package/dist/components/Avatar/tests/Avatar.stories.js +94 -80
- package/dist/components/Avatar/tests/Avatar.test.stories.d.ts +17 -0
- package/dist/components/Avatar/tests/Avatar.test.stories.js +39 -0
- package/dist/components/Badge/tests/Badge.stories.d.ts +33 -8
- package/dist/components/Badge/tests/Badge.stories.js +238 -212
- package/dist/components/Badge/tests/Badge.test.stories.d.ts +20 -0
- package/dist/components/Badge/tests/Badge.test.stories.js +44 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +1 -0
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +24 -5
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +114 -95
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.d.ts +23 -0
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.js +76 -0
- package/dist/components/Button/Button.js +5 -2
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Button/Button.types.d.ts +1 -0
- package/dist/components/Button/tests/Button.stories.d.ts +2 -2
- package/dist/components/Button/tests/Button.stories.js +77 -74
- package/dist/components/Button/tests/Button.test.stories.d.ts +27 -0
- package/dist/components/Button/tests/Button.test.stories.js +112 -0
- package/dist/components/Calendar/tests/Calendar.test.stories.d.ts +26 -0
- package/dist/components/Calendar/tests/Calendar.test.stories.js +161 -0
- package/dist/components/Card/tests/Card.stories.d.ts +0 -1
- package/dist/components/Card/tests/Card.stories.js +0 -11
- package/dist/components/Card/tests/Card.test.stories.d.ts +35 -0
- package/dist/components/Card/tests/Card.test.stories.js +54 -0
- package/dist/components/Carousel/CarouselControl.js +1 -1
- package/dist/components/Carousel/tests/Carousel.stories.d.ts +3 -0
- package/dist/components/Carousel/tests/Carousel.stories.js +4 -0
- package/dist/components/Carousel/tests/Carousel.test.stories.d.ts +17 -0
- package/dist/components/Carousel/tests/Carousel.test.stories.js +52 -0
- package/dist/components/Checkbox/tests/Checkbox.test.stories.d.ts +25 -0
- package/dist/components/Checkbox/tests/Checkbox.test.stories.js +104 -0
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.d.ts +22 -0
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.js +78 -0
- package/dist/components/Container/Container.module.css +1 -1
- package/dist/components/Container/tests/Container.stories.d.ts +12 -3
- package/dist/components/Container/tests/Container.stories.js +50 -31
- package/dist/components/Container/tests/Container.test.stories.d.ts +15 -0
- package/dist/components/Container/tests/Container.test.stories.js +26 -0
- package/dist/components/ContextMenu/ContextMenu.js +13 -9
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +2 -3
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.d.ts +26 -0
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +53 -0
- package/dist/components/Dismissible/Dismissible.js +1 -1
- package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +10 -3
- package/dist/components/Dismissible/tests/Dismissible.stories.js +51 -34
- package/dist/components/Dismissible/tests/Dismissible.test.stories.d.ts +19 -0
- package/dist/components/Dismissible/tests/Dismissible.test.stories.js +42 -0
- package/dist/components/Divider/tests/Divider.test.stories.d.ts +18 -0
- package/dist/components/Divider/tests/Divider.test.stories.js +47 -0
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +37 -0
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +117 -0
- package/dist/components/FileUpload/tests/FileUpload.test.stories.d.ts +22 -0
- package/dist/components/FileUpload/tests/FileUpload.test.stories.js +52 -0
- package/dist/components/FormControl/FormControlCaption.js +1 -1
- package/dist/components/FormControl/FormControlLabel.js +1 -1
- package/dist/components/FormControl/tests/FormControl.stories.d.ts +11 -5
- package/dist/components/FormControl/tests/FormControl.stories.js +78 -73
- package/dist/components/FormControl/tests/FormControl.test.stories.d.ts +20 -0
- package/dist/components/FormControl/tests/FormControl.test.stories.js +49 -0
- package/dist/components/Grid/tests/Grid.stories.d.ts +20 -5
- package/dist/components/Grid/tests/Grid.stories.js +164 -149
- package/dist/components/Grid/tests/Grid.test.stories.d.ts +19 -0
- package/dist/components/Grid/tests/Grid.test.stories.js +42 -0
- package/dist/components/Hidden/tests/Hidden.stories.d.ts +4 -1
- package/dist/components/Hidden/tests/Hidden.stories.js +28 -25
- package/dist/components/Hidden/tests/Hidden.test.stories.d.ts +15 -0
- package/dist/components/Hidden/tests/Hidden.test.stories.js +20 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +4 -1
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +8 -5
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.d.ts +15 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.js +20 -0
- package/dist/components/Hotkey/tests/Hotkey.test.stories.d.ts +15 -0
- package/dist/components/Hotkey/tests/Hotkey.test.stories.js +26 -0
- package/dist/components/Icon/tests/Icon.stories.d.ts +12 -3
- package/dist/components/Icon/tests/Icon.stories.js +69 -60
- package/dist/components/Icon/tests/Icon.test.stories.d.ts +16 -0
- package/dist/components/Icon/tests/Icon.test.stories.js +35 -0
- package/dist/components/Image/tests/Image.stories.d.ts +24 -5
- package/dist/components/Image/tests/Image.stories.js +95 -75
- package/dist/components/Image/tests/Image.test.stories.d.ts +25 -0
- package/dist/components/Image/tests/Image.test.stories.js +80 -0
- package/dist/components/Link/tests/Link.test.stories.d.ts +29 -0
- package/dist/components/Link/tests/Link.test.stories.js +87 -0
- package/dist/components/Loader/Loader.js +1 -1
- package/dist/components/Loader/Loader.types.d.ts +1 -0
- package/dist/components/Loader/tests/Loader.stories.js +8 -8
- package/dist/components/Loader/tests/Loader.test.stories.d.ts +16 -0
- package/dist/components/Loader/tests/Loader.test.stories.js +32 -0
- package/dist/components/MenuItem/tests/MenuItem.test.stories.d.ts +26 -0
- package/dist/components/MenuItem/tests/MenuItem.test.stories.js +100 -0
- package/dist/components/Modal/tests/Modal.test.stories.d.ts +32 -0
- package/dist/components/Modal/tests/Modal.test.stories.js +149 -0
- package/dist/components/Overlay/tests/Overlay.stories.d.ts +4 -2
- package/dist/components/Overlay/tests/Overlay.stories.js +53 -53
- package/dist/components/Overlay/tests/Overlay.test.stories.d.ts +28 -0
- package/dist/components/Overlay/tests/Overlay.test.stories.js +146 -0
- package/dist/components/Pagination/tests/Pagination.test.stories.d.ts +23 -0
- package/dist/components/Pagination/tests/Pagination.test.stories.js +86 -0
- package/dist/components/PinField/tests/PinField.stories.d.ts +0 -1
- package/dist/components/PinField/tests/PinField.stories.js +10 -19
- package/dist/components/PinField/tests/PinField.test.stories.d.ts +29 -0
- package/dist/components/PinField/tests/PinField.test.stories.js +177 -0
- package/dist/components/Popover/tests/Popover.test.stories.d.ts +40 -0
- package/dist/components/Popover/tests/Popover.test.stories.js +167 -0
- package/dist/components/Progress/Progress.js +2 -2
- package/dist/components/Progress/Progress.types.d.ts +1 -0
- package/dist/components/Progress/tests/Progress.stories.js +10 -10
- package/dist/components/Progress/tests/Progress.test.stories.d.ts +16 -0
- package/dist/components/Progress/tests/Progress.test.stories.js +35 -0
- package/dist/components/Radio/tests/Radio.test.stories.d.ts +30 -0
- package/dist/components/Radio/tests/Radio.test.stories.js +118 -0
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.d.ts +22 -0
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.js +78 -0
- package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +33 -0
- package/dist/components/Reshaped/tests/Reshaped.stories.js +88 -0
- package/dist/components/Resizable/Resizable.js +1 -0
- package/dist/components/Resizable/tests/Resizable.stories.d.ts +3 -0
- package/dist/components/Resizable/tests/Resizable.stories.js +4 -0
- package/dist/components/Resizable/tests/Resizable.test.stories.d.ts +19 -0
- package/dist/components/Resizable/tests/Resizable.test.stories.js +25 -0
- package/dist/components/Scrim/tests/Scrim.test.stories.d.ts +15 -0
- package/dist/components/Scrim/tests/Scrim.test.stories.js +25 -0
- package/dist/components/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
- package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +17 -4
- package/dist/components/ScrollArea/tests/ScrollArea.stories.js +114 -139
- package/dist/components/ScrollArea/tests/ScrollArea.test.stories.d.ts +23 -0
- package/dist/components/ScrollArea/tests/ScrollArea.test.stories.js +66 -0
- package/dist/components/Select/tests/Select.stories.d.ts +1 -1
- package/dist/components/Select/tests/Select.stories.js +5 -12
- package/dist/components/Select/tests/Select.test.stories.d.ts +27 -0
- package/dist/components/Select/tests/Select.test.stories.js +132 -0
- package/dist/components/Skeleton/tests/Skeleton.test.stories.d.ts +15 -0
- package/dist/components/Skeleton/tests/Skeleton.test.stories.js +23 -0
- package/dist/components/Slider/tests/Slider.stories.d.ts +0 -1
- package/dist/components/Slider/tests/Slider.stories.js +8 -9
- package/dist/components/Slider/tests/Slider.test.stories.d.ts +38 -0
- package/dist/components/Slider/tests/Slider.test.stories.js +150 -0
- package/dist/components/Stepper/Stepper.js +1 -1
- package/dist/components/Stepper/tests/Stepper.stories.js +0 -3
- package/dist/components/Stepper/tests/Stepper.test.stories.d.ts +18 -0
- package/dist/components/Stepper/tests/Stepper.test.stories.js +28 -0
- package/dist/components/Switch/tests/Switch.test.stories.d.ts +23 -0
- package/dist/components/Switch/tests/Switch.test.stories.js +79 -0
- package/dist/components/Table/tests/Table.test.stories.d.ts +25 -0
- package/dist/components/Table/tests/Table.test.stories.js +93 -0
- package/dist/components/Tabs/tests/Tabs.stories.js +4 -4
- package/dist/components/Tabs/tests/Tabs.test.stories.d.ts +28 -0
- package/dist/components/Tabs/tests/Tabs.test.stories.js +128 -0
- package/dist/components/Text/tests/Text.stories.d.ts +28 -7
- package/dist/components/Text/tests/Text.stories.js +148 -125
- package/dist/components/Text/tests/Text.test.stories.d.ts +18 -0
- package/dist/components/Text/tests/Text.test.stories.js +49 -0
- package/dist/components/TextArea/TextArea.module.css +1 -1
- package/dist/components/TextArea/tests/TextArea.stories.js +1 -1
- package/dist/components/TextArea/tests/TextArea.test.stories.d.ts +29 -0
- package/dist/components/TextArea/tests/TextArea.test.stories.js +99 -0
- package/dist/components/TextField/tests/TextField.stories.js +1 -1
- package/dist/components/TextField/tests/TextField.test.stories.d.ts +29 -0
- package/dist/components/TextField/tests/TextField.test.stories.js +99 -0
- package/dist/components/Theme/tests/Theme.test.stories.d.ts +24 -0
- package/dist/components/Theme/tests/Theme.test.stories.js +133 -0
- package/dist/components/Timeline/tests/Timeline.test.stories.d.ts +18 -0
- package/dist/components/Timeline/tests/Timeline.test.stories.js +32 -0
- package/dist/components/Toast/tests/Toast.test.stories.d.ts +16 -0
- package/dist/components/Toast/tests/Toast.test.stories.js +101 -0
- package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -14
- package/dist/components/Tooltip/tests/Tooltip.test.stories.d.ts +19 -0
- package/dist/components/Tooltip/tests/Tooltip.test.stories.js +40 -0
- package/dist/components/View/View.js +1 -2
- package/dist/components/View/tests/View.stories.d.ts +112 -28
- package/dist/components/View/tests/View.stories.js +1092 -1012
- package/dist/components/View/tests/View.test.stories.d.ts +20 -0
- package/dist/components/View/tests/View.test.stories.js +50 -0
- package/dist/components/_private/Flyout/FlyoutContent.js +1 -1
- package/dist/components/_private/Flyout/tests/Flyout.stories.js +4 -4
- package/dist/components/_private/Flyout/tests/Flyout.test.stories.d.ts +28 -0
- package/dist/components/_private/Flyout/tests/Flyout.test.stories.js +205 -0
- package/dist/components/_private/Portal/tests/Portal.stories.js +1 -1
- package/dist/hooks/_private/useSingletonHotkeys.d.ts +3 -3
- package/dist/hooks/_private/useSingletonHotkeys.js +1 -1
- package/dist/hooks/tests/useDrag.stories.js +1 -0
- package/dist/hooks/tests/useDrag.test.stories.d.ts +26 -0
- package/dist/hooks/tests/useDrag.test.stories.js +120 -0
- package/dist/hooks/tests/useElementId.stories.d.ts +6 -0
- package/dist/hooks/tests/useElementId.stories.js +19 -0
- package/dist/hooks/tests/useHotkeys.test.stories.d.ts +39 -0
- package/dist/hooks/tests/useHotkeys.test.stories.js +119 -0
- package/dist/hooks/tests/useRTL.stories.d.ts +6 -0
- package/dist/hooks/tests/useRTL.stories.js +25 -0
- package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +9 -1
- package/dist/hooks/tests/useResponsiveClientValue.stories.js +22 -9
- package/dist/hooks/tests/useScrollLock.stories.d.ts +6 -0
- package/dist/hooks/tests/useScrollLock.stories.js +22 -0
- package/dist/hooks/tests/useToggle.stories.d.ts +8 -0
- package/dist/hooks/tests/useToggle.stories.js +54 -0
- package/dist/hooks/useHotkeys.js +0 -2
- package/dist/hooks/useScrollLock.d.ts +1 -0
- package/dist/hooks/useScrollLock.js +7 -3
- package/dist/tests/ShadowDOM.stories.js +1 -1
- package/dist/themes/_generator/tests/themes.stories.d.ts +3 -0
- package/dist/themes/_generator/tests/themes.stories.js +7 -11
- package/dist/themes/_generator/utilities/generateColors.d.ts +1 -1
- package/dist/themes/_generator/utilities/generateColors.js +3 -2
- package/dist/themes/slate/theme.css +1 -1
- package/dist/utilities/helpers.d.ts +1 -0
- package/dist/utilities/helpers.js +3 -0
- package/dist/utilities/scroll/lock.d.ts +1 -0
- package/dist/utilities/scroll/lock.js +3 -3
- package/dist/utilities/scroll/lockSafari.d.ts +1 -1
- package/dist/utilities/scroll/lockSafari.js +4 -5
- package/dist/utilities/scroll/lockStandard.d.ts +4 -1
- package/dist/utilities/scroll/lockStandard.js +7 -2
- package/dist/utilities/storybook/Example.js +1 -2
- package/package.json +20 -19
- package/dist/components/Theme/tests/Theme.stories.d.ts +0 -13
- package/dist/components/Theme/tests/Theme.stories.js +0 -80
- package/dist/utilities/storybook/Example.module.css +0 -1
@@ -1,10 +1,8 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import { useRef } from "react";
|
3
2
|
import { Example } from "../../../utilities/storybook/index.js";
|
4
3
|
import ScrollArea from "../index.js";
|
5
4
|
import View from "../../View/index.js";
|
6
5
|
import Button from "../../Button/index.js";
|
7
|
-
import useToggle from "../../../hooks/useToggle.js";
|
8
6
|
export default {
|
9
7
|
title: "Utilities/ScrollArea",
|
10
8
|
component: ScrollArea,
|
@@ -12,150 +10,105 @@ export default {
|
|
12
10
|
iframe: {
|
13
11
|
url: "https://reshaped.so/docs/utilities/scroll-area",
|
14
12
|
},
|
13
|
+
// Skip because axe core incorrectly reports contrast issues
|
14
|
+
a11y: {
|
15
|
+
disable: true,
|
16
|
+
},
|
15
17
|
},
|
16
18
|
};
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
<
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
</View>
|
33
|
-
</ScrollArea>
|
34
|
-
</View>);
|
35
|
-
};
|
36
|
-
export const direction = () => (<Example>
|
37
|
-
<Example.Item title="vertical">
|
38
|
-
<ScrollArea height="100px" scrollbarDisplay="visible" onScroll={console.log}>
|
39
|
-
<View backgroundColor="neutral-faded" padding={4}>
|
40
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
|
41
|
-
been the industry's standard dummy text ever since the 1500s, when an unknown printer took
|
42
|
-
a galley of type and scrambled it to make a type specimen book. It has survived not only
|
43
|
-
five centuries, but also the leap into electronic typesetting, remaining essentially
|
44
|
-
unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
|
45
|
-
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus
|
46
|
-
PageMaker including versions of Lorem Ipsum.
|
47
|
-
</View>
|
48
|
-
</ScrollArea>
|
49
|
-
</Example.Item>
|
50
|
-
<Example.Item title="horizontal">
|
51
|
-
<ScrollArea height="120px" scrollbarDisplay="visible" onScroll={console.log}>
|
52
|
-
<View backgroundColor="neutral-faded" padding={4} width="500px">
|
53
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
|
54
|
-
been the industry's standard dummy text ever since the 1500s
|
55
|
-
</View>
|
56
|
-
</ScrollArea>
|
57
|
-
</Example.Item>
|
58
|
-
<Example.Item title="both directions">
|
59
|
-
<ScrollArea height="100px" scrollbarDisplay="visible">
|
60
|
-
<View backgroundColor="neutral-faded" padding={4} width="500px">
|
61
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
|
62
|
-
been the industry's standard dummy text ever since the 1500s, when an unknown printer took
|
63
|
-
a galley of type and scrambled it to make a type specimen book. It has survived not only
|
64
|
-
five centuries, but also the leap into electronic typesetting, remaining essentially
|
65
|
-
unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
|
66
|
-
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus
|
67
|
-
PageMaker including versions of Lorem Ipsum.
|
68
|
-
</View>
|
69
|
-
</ScrollArea>
|
70
|
-
</Example.Item>
|
71
|
-
</Example>);
|
72
|
-
export const visibility = () => (<Example>
|
73
|
-
<Example.Item title="visibility: hover">
|
74
|
-
<ScrollArea height="100px">
|
75
|
-
<View backgroundColor="neutral-faded" padding={4}>
|
76
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
|
77
|
-
been the industry's standard dummy text ever since the 1500s, when an unknown printer took
|
78
|
-
a galley of type and scrambled it to make a type specimen book. It has survived not only
|
79
|
-
five centuries, but also the leap into electronic typesetting, remaining essentially
|
80
|
-
unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
|
81
|
-
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus
|
82
|
-
PageMaker including versions of Lorem Ipsum.
|
83
|
-
</View>
|
84
|
-
</ScrollArea>
|
85
|
-
</Example.Item>
|
86
|
-
<Example.Item title="visibility: hidden">
|
87
|
-
<ScrollArea height="100px" scrollbarDisplay="hidden">
|
88
|
-
<View backgroundColor="neutral-faded" padding={4}>
|
89
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
|
90
|
-
been the industry's standard dummy text ever since the 1500s, when an unknown printer took
|
91
|
-
a galley of type and scrambled it to make a type specimen book. It has survived not only
|
92
|
-
five centuries, but also the leap into electronic typesetting, remaining essentially
|
93
|
-
unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
|
94
|
-
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus
|
95
|
-
PageMaker including versions of Lorem Ipsum.
|
96
|
-
</View>
|
97
|
-
</ScrollArea>
|
98
|
-
</Example.Item>
|
99
|
-
<Example.Item title="visibility: visible">
|
100
|
-
<ScrollArea height="100px" scrollbarDisplay="visible">
|
101
|
-
<View backgroundColor="neutral-faded" padding={4}>
|
102
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
|
103
|
-
been the industry's standard dummy text ever since the 1500s, when an unknown printer took
|
104
|
-
a galley of type and scrambled it to make a type specimen book. It has survived not only
|
105
|
-
five centuries, but also the leap into electronic typesetting, remaining essentially
|
106
|
-
unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
|
107
|
-
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus
|
108
|
-
PageMaker including versions of Lorem Ipsum.
|
109
|
-
</View>
|
110
|
-
</ScrollArea>
|
111
|
-
</Example.Item>
|
112
|
-
</Example>);
|
113
|
-
export const ref = () => (<Example>
|
114
|
-
<Example.Item title="external ref">
|
115
|
-
<Demo />
|
116
|
-
</Example.Item>
|
117
|
-
</Example>);
|
118
|
-
export const edgeCases = () => {
|
119
|
-
const toggle = useToggle(true);
|
120
|
-
const [count, setCount] = React.useState(20);
|
121
|
-
return (<Example>
|
122
|
-
<Example.Item title="dynamic content update">
|
123
|
-
<View gap={4}>
|
124
|
-
<Button onClick={toggle.toggle}>Toggle</Button>
|
125
|
-
<ScrollArea height="100px" scrollbarDisplay="visible">
|
126
|
-
<View backgroundColor="neutral-faded" padding={4} width={toggle.active ? "120%" : "90%"}>
|
127
|
-
{toggle.active ? (<React.Fragment>
|
128
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
|
129
|
-
Ipsum has been the industry's standard dummy text ever since the 1500s, when an
|
130
|
-
unknown printer took a galley of type and scrambled it to make a type specimen
|
131
|
-
book. It has survived not only five centuries, but also the leap into electronic
|
132
|
-
typesetting, remaining essentially unchanged. It was popularised in the 1960s with
|
133
|
-
the release of Letraset sheets containing Lorem Ipsum passages, and more recently
|
134
|
-
with desktop publishing software like Aldus PageMaker including versions of Lorem
|
135
|
-
Ipsum.
|
136
|
-
</React.Fragment>) : null}
|
137
|
-
</View>
|
138
|
-
</ScrollArea>
|
139
|
-
</View>
|
19
|
+
export const direction = {
|
20
|
+
name: "direction",
|
21
|
+
render: () => (<Example>
|
22
|
+
<Example.Item title="vertical">
|
23
|
+
<ScrollArea height="100px" scrollbarDisplay="visible">
|
24
|
+
<View backgroundColor="elevation-base" padding={4}>
|
25
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
|
26
|
+
has been the industry's standard dummy text ever since the 1500s, when an unknown
|
27
|
+
printer took a galley of type and scrambled it to make a type specimen book. It has
|
28
|
+
survived not only five centuries, but also the leap into electronic typesetting,
|
29
|
+
remaining essentially unchanged. It was popularised in the 1960s with the release of
|
30
|
+
Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
|
31
|
+
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
32
|
+
</View>
|
33
|
+
</ScrollArea>
|
140
34
|
</Example.Item>
|
141
35
|
|
142
|
-
<Example.Item title="
|
143
|
-
<
|
144
|
-
<
|
36
|
+
<Example.Item title="horizontal">
|
37
|
+
<ScrollArea height="100px" scrollbarDisplay="visible">
|
38
|
+
<View backgroundColor="elevation-base" padding={4} width="150%" height="100px">
|
39
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
|
40
|
+
has been the industry's standard dummy text ever since the 1500s
|
41
|
+
</View>
|
42
|
+
</ScrollArea>
|
43
|
+
</Example.Item>
|
145
44
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
45
|
+
<Example.Item title="horizontal, vertical">
|
46
|
+
<ScrollArea height="100px" scrollbarDisplay="visible">
|
47
|
+
<View backgroundColor="elevation-base" padding={4} width="150%">
|
48
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
|
49
|
+
has been the industry's standard dummy text ever since the 1500s, when an unknown
|
50
|
+
printer took a galley of type and scrambled it to make a type specimen book. It has
|
51
|
+
survived not only five centuries, but also the leap into electronic typesetting,
|
52
|
+
remaining essentially unchanged. It was popularised in the 1960s with the release of
|
53
|
+
Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
|
54
|
+
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
55
|
+
</View>
|
56
|
+
</ScrollArea>
|
57
|
+
</Example.Item>
|
58
|
+
</Example>),
|
59
|
+
};
|
60
|
+
export const visibility = {
|
61
|
+
name: "scrollbarDisplay",
|
62
|
+
render: () => (<Example>
|
63
|
+
<Example.Item title="visibility: hover">
|
64
|
+
<ScrollArea height="100px">
|
65
|
+
<View backgroundColor="elevation-base" padding={4}>
|
66
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
|
67
|
+
has been the industry's standard dummy text ever since the 1500s, when an unknown
|
68
|
+
printer took a galley of type and scrambled it to make a type specimen book. It has
|
69
|
+
survived not only five centuries, but also the leap into electronic typesetting,
|
70
|
+
remaining essentially unchanged. It was popularised in the 1960s with the release of
|
71
|
+
Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
|
72
|
+
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
73
|
+
</View>
|
74
|
+
</ScrollArea>
|
75
|
+
</Example.Item>
|
76
|
+
|
77
|
+
<Example.Item title="visibility: hidden">
|
78
|
+
<ScrollArea height="100px" scrollbarDisplay="hidden">
|
79
|
+
<View backgroundColor="elevation-base" padding={4}>
|
80
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
|
81
|
+
has been the industry's standard dummy text ever since the 1500s, when an unknown
|
82
|
+
printer took a galley of type and scrambled it to make a type specimen book. It has
|
83
|
+
survived not only five centuries, but also the leap into electronic typesetting,
|
84
|
+
remaining essentially unchanged. It was popularised in the 1960s with the release of
|
85
|
+
Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
|
86
|
+
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
87
|
+
</View>
|
88
|
+
</ScrollArea>
|
154
89
|
</Example.Item>
|
155
90
|
|
156
|
-
<Example.Item title="
|
91
|
+
<Example.Item title="visibility: visible">
|
92
|
+
<ScrollArea height="100px" scrollbarDisplay="visible">
|
93
|
+
<View backgroundColor="elevation-base" padding={4}>
|
94
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
|
95
|
+
has been the industry's standard dummy text ever since the 1500s, when an unknown
|
96
|
+
printer took a galley of type and scrambled it to make a type specimen book. It has
|
97
|
+
survived not only five centuries, but also the leap into electronic typesetting,
|
98
|
+
remaining essentially unchanged. It was popularised in the 1960s with the release of
|
99
|
+
Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
|
100
|
+
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
101
|
+
</View>
|
102
|
+
</ScrollArea>
|
103
|
+
</Example.Item>
|
104
|
+
</Example>),
|
105
|
+
};
|
106
|
+
export const composition = {
|
107
|
+
name: "composition",
|
108
|
+
render: () => (<Example>
|
109
|
+
<Example.Item title="nested">
|
157
110
|
<ScrollArea height="100px">
|
158
|
-
<View padding={
|
111
|
+
<View padding={4} paddingInline={16}>
|
159
112
|
<ScrollArea height="200px">
|
160
113
|
{Array(20)
|
161
114
|
.fill("")
|
@@ -166,5 +119,27 @@ export const edgeCases = () => {
|
|
166
119
|
</View>
|
167
120
|
</ScrollArea>
|
168
121
|
</Example.Item>
|
169
|
-
</Example>)
|
122
|
+
</Example>),
|
123
|
+
};
|
124
|
+
export const dynamicHeight = {
|
125
|
+
name: "composition, dynamic height change",
|
126
|
+
render: () => {
|
127
|
+
const [count, setCount] = React.useState(10);
|
128
|
+
return (<View gap={4}>
|
129
|
+
<View.Item>
|
130
|
+
<Button onClick={() => setCount((prev) => prev + 10)}>Add more items</Button>
|
131
|
+
</View.Item>
|
132
|
+
|
133
|
+
<ScrollArea height="200px" scrollbarDisplay="visible">
|
134
|
+
<View gap={2}>
|
135
|
+
{new Array(count).fill("").map((_, i) => (<View.Item key={i}>Item {i + 1}</View.Item>))}
|
136
|
+
</View>
|
137
|
+
</ScrollArea>
|
138
|
+
</View>);
|
139
|
+
},
|
140
|
+
// TODO: After Using play(), Storybook makes the scroll lag, but not when triggered manually in the browser
|
141
|
+
// play: async ({ canvas }) => {
|
142
|
+
// const trigger = canvas.getAllByRole("button")[0];
|
143
|
+
// await userEvent.click(trigger);
|
144
|
+
// },
|
170
145
|
};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { StoryObj } from "@storybook/react";
|
3
|
+
import { fn } from "@storybook/test";
|
4
|
+
declare const _default: {
|
5
|
+
title: string;
|
6
|
+
component: React.ForwardRefExoticComponent<import("./..").ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
|
7
|
+
parameters: {
|
8
|
+
iframe: {
|
9
|
+
url: string;
|
10
|
+
};
|
11
|
+
a11y: {
|
12
|
+
disable: boolean;
|
13
|
+
};
|
14
|
+
chromatic: {
|
15
|
+
disableSnapshot: boolean;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
};
|
19
|
+
export default _default;
|
20
|
+
export declare const onScroll: StoryObj<{
|
21
|
+
handleScroll: ReturnType<typeof fn>;
|
22
|
+
}>;
|
23
|
+
export declare const className: StoryObj;
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { expect, fn, userEvent, waitFor } from "@storybook/test";
|
3
|
+
import Button from "../../Button/index.js";
|
4
|
+
import ScrollArea from "../index.js";
|
5
|
+
import View from "../../View/index.js";
|
6
|
+
export default {
|
7
|
+
title: "Utilities/ScrollArea/tests",
|
8
|
+
component: ScrollArea,
|
9
|
+
parameters: {
|
10
|
+
iframe: {
|
11
|
+
url: "https://reshaped.so/docs/utilities/text",
|
12
|
+
},
|
13
|
+
// Skip because axe core incorrectly reports contrast issues
|
14
|
+
a11y: {
|
15
|
+
disable: true,
|
16
|
+
},
|
17
|
+
chromatic: { disableSnapshot: true },
|
18
|
+
},
|
19
|
+
};
|
20
|
+
export const onScroll = {
|
21
|
+
name: "ref, onScroll",
|
22
|
+
args: {
|
23
|
+
handleScroll: fn(),
|
24
|
+
},
|
25
|
+
render: (args) => {
|
26
|
+
const ref = React.useRef(null);
|
27
|
+
return (<View gap={4}>
|
28
|
+
<View.Item>
|
29
|
+
<Button onClick={() => ref.current?.scrollBy({ top: 50, left: 50 })}>Scroll</Button>
|
30
|
+
</View.Item>
|
31
|
+
<ScrollArea height="100px" ref={ref} scrollbarDisplay="visible" onScroll={args.handleScroll}>
|
32
|
+
<View backgroundColor="neutral-faded" padding={4} width="1000px" height="200px">
|
33
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
|
34
|
+
has been the industry's standard dummy text ever since the 1500s, when an unknown
|
35
|
+
printer took a galley of type and scrambled it to make a type specimen book. It has
|
36
|
+
survived not only five centuries, but also the leap into electronic typesetting,
|
37
|
+
remaining essentially unchanged. It was popularised in the 1960s with the release of
|
38
|
+
Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
|
39
|
+
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
40
|
+
</View>
|
41
|
+
</ScrollArea>
|
42
|
+
</View>);
|
43
|
+
},
|
44
|
+
play: async ({ canvas, args }) => {
|
45
|
+
const trigger = canvas.getAllByRole("button")[0];
|
46
|
+
await userEvent.click(trigger);
|
47
|
+
await waitFor(() => {
|
48
|
+
expect(args.handleScroll).toHaveBeenCalledTimes(1);
|
49
|
+
// x value is flaky, so only testing y here
|
50
|
+
expect(args.handleScroll).toHaveBeenCalledWith(expect.objectContaining({ y: 0.5 }));
|
51
|
+
});
|
52
|
+
},
|
53
|
+
};
|
54
|
+
export const className = {
|
55
|
+
name: "className, attributes",
|
56
|
+
render: () => (<div data-testid="root">
|
57
|
+
<ScrollArea className="test-classname" attributes={{ id: "test-id" }}>
|
58
|
+
Content
|
59
|
+
</ScrollArea>
|
60
|
+
</div>),
|
61
|
+
play: async ({ canvas }) => {
|
62
|
+
const root = canvas.getByTestId("root").firstChild;
|
63
|
+
expect(root).toHaveClass("test-classname");
|
64
|
+
expect(root).toHaveAttribute("id", "test-id");
|
65
|
+
},
|
66
|
+
};
|
@@ -8,7 +8,7 @@ declare const _default: {
|
|
8
8
|
};
|
9
9
|
};
|
10
10
|
export default _default;
|
11
|
-
export declare const
|
11
|
+
export declare const value: () => import("react").JSX.Element;
|
12
12
|
export declare const variants: () => import("react").JSX.Element;
|
13
13
|
export declare const size: () => import("react").JSX.Element;
|
14
14
|
export declare const disabled: () => import("react").JSX.Element;
|
@@ -13,23 +13,16 @@ export default {
|
|
13
13
|
},
|
14
14
|
},
|
15
15
|
};
|
16
|
-
export const
|
17
|
-
<Example.Item title="
|
18
|
-
<Select name="animal"
|
16
|
+
export const value = () => (<Example>
|
17
|
+
<Example.Item title="defaultValue">
|
18
|
+
<Select name="animal" defaultValue="dog" inputAttributes={{ "aria-label": "test select" }} options={[
|
19
19
|
{ label: "Dog", value: "dog" },
|
20
20
|
{ label: "Turtle", value: "turtle" },
|
21
21
|
]}/>
|
22
22
|
</Example.Item>
|
23
23
|
|
24
|
-
<Example.Item title="
|
25
|
-
<Select name="animal" inputAttributes={{ "aria-label": "test select" }}
|
26
|
-
{ label: "Dog", value: "dog" },
|
27
|
-
{ label: "Turtle", value: "turtle" },
|
28
|
-
]}/>
|
29
|
-
</Example.Item>
|
30
|
-
|
31
|
-
<Example.Item title="selected, uncontrolled">
|
32
|
-
<Select name="animal" inputAttributes={{ "aria-label": "test select" }} placeholder="Select an animal" value="dog" options={[
|
24
|
+
<Example.Item title="placeholder">
|
25
|
+
<Select name="animal" placeholder="Select an animal" inputAttributes={{ "aria-label": "test select" }} options={[
|
33
26
|
{ label: "Dog", value: "dog" },
|
34
27
|
{ label: "Turtle", value: "turtle" },
|
35
28
|
]}/>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
import { fn } from "@storybook/test";
|
3
|
+
declare const _default: {
|
4
|
+
title: string;
|
5
|
+
component: (props: import("./..").SelectProps) => import("react").JSX.Element;
|
6
|
+
parameters: {
|
7
|
+
iframe: {
|
8
|
+
url: string;
|
9
|
+
};
|
10
|
+
chromatic: {
|
11
|
+
disableSnapshot: boolean;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
};
|
15
|
+
export default _default;
|
16
|
+
export declare const render: StoryObj;
|
17
|
+
export declare const startSlot: StoryObj;
|
18
|
+
export declare const placeholder: StoryObj;
|
19
|
+
export declare const id: StoryObj;
|
20
|
+
export declare const disabled: StoryObj;
|
21
|
+
export declare const defaultValue: StoryObj<{
|
22
|
+
handleChange: ReturnType<typeof fn>;
|
23
|
+
}>;
|
24
|
+
export declare const value: StoryObj<{
|
25
|
+
handleChange: ReturnType<typeof fn>;
|
26
|
+
}>;
|
27
|
+
export declare const className: StoryObj;
|
@@ -0,0 +1,132 @@
|
|
1
|
+
import { expect, userEvent, fn } from "@storybook/test";
|
2
|
+
import Select from "../index.js";
|
3
|
+
export default {
|
4
|
+
title: "Components/Select/tests",
|
5
|
+
component: Select,
|
6
|
+
parameters: {
|
7
|
+
iframe: {
|
8
|
+
url: "https://reshaped.so/docs/components/select",
|
9
|
+
},
|
10
|
+
chromatic: { disableSnapshot: true },
|
11
|
+
},
|
12
|
+
};
|
13
|
+
export const render = {
|
14
|
+
name: "rendering",
|
15
|
+
render: () => (<Select name="test-name" options={[
|
16
|
+
{ label: "Option 1", value: "1" },
|
17
|
+
{ label: "Option 2", value: "2" },
|
18
|
+
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
19
|
+
play: async ({ canvas }) => {
|
20
|
+
const elInput = canvas.getByRole("combobox");
|
21
|
+
const elOptions = canvas.getAllByRole("option");
|
22
|
+
expect(elInput).toHaveAttribute("name", "test-name");
|
23
|
+
expect(elInput).toHaveValue("1");
|
24
|
+
expect(elOptions.length).toBe(2);
|
25
|
+
expect(elOptions[0]).toHaveValue("1");
|
26
|
+
expect(elOptions[0].textContent).toBe("Option 1");
|
27
|
+
expect(elOptions[1]).toHaveValue("2");
|
28
|
+
expect(elOptions[1].textContent).toBe("Option 2");
|
29
|
+
},
|
30
|
+
};
|
31
|
+
export const startSlot = {
|
32
|
+
name: "startSlot",
|
33
|
+
render: () => (<Select name="test-name" startSlot="Slot" options={[]} inputAttributes={{ "aria-label": "test select" }}/>),
|
34
|
+
play: async ({ canvas }) => {
|
35
|
+
const slot = canvas.getByText("Slot");
|
36
|
+
expect(slot).toBeInTheDocument();
|
37
|
+
},
|
38
|
+
};
|
39
|
+
export const placeholder = {
|
40
|
+
name: "placeholder",
|
41
|
+
render: () => (<Select name="test-name" placeholder="Placeholder" options={[
|
42
|
+
{ label: "Option 1", value: "1" },
|
43
|
+
{ label: "Option 2", value: "2" },
|
44
|
+
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
45
|
+
play: async ({ canvas }) => {
|
46
|
+
const input = canvas.getByRole("combobox");
|
47
|
+
const options = canvas.getAllByRole("option");
|
48
|
+
expect(input).toHaveValue("");
|
49
|
+
expect(options.length).toBe(3);
|
50
|
+
expect(options[0].textContent).toBe("Placeholder");
|
51
|
+
expect(options[0]).toHaveValue("");
|
52
|
+
},
|
53
|
+
};
|
54
|
+
export const id = {
|
55
|
+
name: "id",
|
56
|
+
render: () => (<Select name="test-name" id="test-id" options={[
|
57
|
+
{ label: "Option 1", value: "1" },
|
58
|
+
{ label: "Option 2", value: "2" },
|
59
|
+
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
60
|
+
play: async ({ canvas }) => {
|
61
|
+
const input = canvas.getByRole("combobox");
|
62
|
+
expect(input).toHaveAttribute("id", "test-id");
|
63
|
+
},
|
64
|
+
};
|
65
|
+
export const disabled = {
|
66
|
+
name: "disabled",
|
67
|
+
render: () => (<Select name="test-name" disabled options={[
|
68
|
+
{ label: "Option 1", value: "1" },
|
69
|
+
{ label: "Option 2", value: "2" },
|
70
|
+
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
71
|
+
play: async ({ canvas }) => {
|
72
|
+
const input = canvas.getByRole("combobox");
|
73
|
+
expect(input).toBeDisabled();
|
74
|
+
},
|
75
|
+
};
|
76
|
+
export const defaultValue = {
|
77
|
+
name: "defaultValue, uncontrolled",
|
78
|
+
args: {
|
79
|
+
handleChange: fn(),
|
80
|
+
},
|
81
|
+
render: (args) => (<Select name="test-name" defaultValue="2" onChange={args.handleChange} options={[
|
82
|
+
{ label: "Option 1", value: "1" },
|
83
|
+
{ label: "Option 2", value: "2" },
|
84
|
+
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
85
|
+
play: async ({ canvas, args }) => {
|
86
|
+
const input = canvas.getByRole("combobox");
|
87
|
+
expect(input).toHaveValue("2");
|
88
|
+
await userEvent.selectOptions(input, "1");
|
89
|
+
expect(args.handleChange).toBeCalledTimes(1);
|
90
|
+
expect(args.handleChange).toHaveBeenCalledWith({
|
91
|
+
name: "test-name",
|
92
|
+
value: "1",
|
93
|
+
event: expect.objectContaining({ target: input }),
|
94
|
+
});
|
95
|
+
expect(input).toHaveValue("1");
|
96
|
+
},
|
97
|
+
};
|
98
|
+
export const value = {
|
99
|
+
name: "value, controlled",
|
100
|
+
args: {
|
101
|
+
handleChange: fn(),
|
102
|
+
},
|
103
|
+
render: (args) => (<Select name="test-name" value="2" onChange={args.handleChange} options={[
|
104
|
+
{ label: "Option 1", value: "1" },
|
105
|
+
{ label: "Option 2", value: "2" },
|
106
|
+
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
107
|
+
play: async ({ canvas, args }) => {
|
108
|
+
const input = canvas.getByRole("combobox");
|
109
|
+
expect(input).toHaveValue("2");
|
110
|
+
await userEvent.selectOptions(input, "1");
|
111
|
+
expect(args.handleChange).toBeCalledTimes(1);
|
112
|
+
expect(args.handleChange).toHaveBeenCalledWith({
|
113
|
+
name: "test-name",
|
114
|
+
value: "1",
|
115
|
+
event: expect.objectContaining({ target: input }),
|
116
|
+
});
|
117
|
+
expect(input).toHaveValue("2");
|
118
|
+
},
|
119
|
+
};
|
120
|
+
export const className = {
|
121
|
+
name: "className, attributes",
|
122
|
+
render: () => (<div data-testid="root">
|
123
|
+
<Select className="test-classname" attributes={{ id: "test-id" }} inputAttributes={{ "aria-label": "test select", id: "test-input-id" }} options={[]} name="name"/>
|
124
|
+
</div>),
|
125
|
+
play: async ({ canvas }) => {
|
126
|
+
const root = canvas.getByTestId("root").firstChild;
|
127
|
+
const input = canvas.getByRole("combobox");
|
128
|
+
expect(root).toHaveClass("test-classname");
|
129
|
+
expect(root).toHaveAttribute("id", "test-id");
|
130
|
+
expect(input).toHaveAttribute("id", "test-input-id");
|
131
|
+
},
|
132
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
component: (props: import("./..").SkeletonProps) => import("react").JSX.Element;
|
5
|
+
parameters: {
|
6
|
+
iframe: {
|
7
|
+
url: string;
|
8
|
+
};
|
9
|
+
chromatic: {
|
10
|
+
disableSnapshot: boolean;
|
11
|
+
};
|
12
|
+
};
|
13
|
+
};
|
14
|
+
export default _default;
|
15
|
+
export declare const className: StoryObj;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { expect } from "@storybook/test";
|
2
|
+
import Skeleton from "../index.js";
|
3
|
+
export default {
|
4
|
+
title: "Components/Skeleton/tests",
|
5
|
+
component: Skeleton,
|
6
|
+
parameters: {
|
7
|
+
iframe: {
|
8
|
+
url: "https://reshaped.so/docs/components/skeleton",
|
9
|
+
},
|
10
|
+
chromatic: { disableSnapshot: true },
|
11
|
+
},
|
12
|
+
};
|
13
|
+
export const className = {
|
14
|
+
name: "className, attributes",
|
15
|
+
render: () => (<div data-testid="root">
|
16
|
+
<Skeleton className="test-classname" attributes={{ id: "test-id" }}/>
|
17
|
+
</div>),
|
18
|
+
play: async ({ canvas }) => {
|
19
|
+
const root = canvas.getByTestId("root").firstChild;
|
20
|
+
expect(root).toHaveClass("test-classname");
|
21
|
+
expect(root).toHaveAttribute("id", "test-id");
|
22
|
+
},
|
23
|
+
};
|
@@ -14,4 +14,3 @@ export declare const step: () => import("react").JSX.Element;
|
|
14
14
|
export declare const boundaries: () => import("react").JSX.Element;
|
15
15
|
export declare const status: () => import("react").JSX.Element;
|
16
16
|
export declare const customRender: () => import("react").JSX.Element;
|
17
|
-
export declare const formControl: () => import("react").JSX.Element;
|
@@ -13,7 +13,7 @@ export default {
|
|
13
13
|
};
|
14
14
|
export const base = () => (<Example>
|
15
15
|
<Example.Item title="range">
|
16
|
-
<Slider range name="slider" defaultMinValue={30} defaultMaxValue={100}
|
16
|
+
<Slider range name="slider" defaultMinValue={30} defaultMaxValue={100}/>
|
17
17
|
</Example.Item>
|
18
18
|
<div style={{ height: 2000 }}/>
|
19
19
|
</Example>);
|
@@ -48,17 +48,16 @@ export const status = () => (<Example>
|
|
48
48
|
</Example>);
|
49
49
|
export const customRender = () => (<Example>
|
50
50
|
<Example.Item title="custom render">
|
51
|
-
<
|
51
|
+
<FormControl>
|
52
|
+
<FormControl.Label>Slider value</FormControl.Label>
|
53
|
+
<Slider name="slider" defaultValue={30} renderValue={(args) => `$${args.value}`}/>
|
54
|
+
</FormControl>
|
52
55
|
</Example.Item>
|
56
|
+
|
53
57
|
<Example.Item title="no tooltip">
|
54
|
-
<
|
55
|
-
</Example.Item>
|
56
|
-
</Example>);
|
57
|
-
export const formControl = () => (<Example>
|
58
|
-
<Example.Item title="form control, disabled">
|
59
|
-
<FormControl disabled>
|
58
|
+
<FormControl>
|
60
59
|
<FormControl.Label>Slider value</FormControl.Label>
|
61
|
-
<Slider name="slider"/>
|
60
|
+
<Slider name="slider" defaultValue={30} renderValue={false}/>
|
62
61
|
</FormControl>
|
63
62
|
</Example.Item>
|
64
63
|
</Example>);
|