reshaped 3.3.11 → 3.3.13
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 +12 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +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/Carousel.js +52 -4
- package/dist/components/Carousel/Carousel.types.d.ts +4 -0
- package/dist/components/Carousel/CarouselControl.js +1 -1
- package/dist/components/Carousel/tests/Carousel.stories.d.ts +23 -4
- package/dist/components/Carousel/tests/Carousel.stories.js +199 -102
- 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/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/index.d.ts +1 -1
- package/dist/components/Table/tests/Table.stories.d.ts +5 -5
- 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/index.d.ts +1 -1
- 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 +42 -41
- 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
@@ -13,64 +13,73 @@ export default {
|
|
13
13
|
},
|
14
14
|
},
|
15
15
|
};
|
16
|
-
export const size =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
<Example.Item title={["responsive size", "[s] 5", "[m]: 10"]}>
|
29
|
-
<Icon svg={IconZap} size={{ s: 5, m: 10 }}/>
|
30
|
-
</Example.Item>
|
31
|
-
<Example.Item title="size: inherit from font">
|
32
|
-
<Text variant="title-6">
|
33
|
-
<View direction="row" align="center" gap={2}>
|
34
|
-
<Icon svg={IconZap}/>
|
35
|
-
<View.Item>Reshaped</View.Item>
|
16
|
+
export const size = {
|
17
|
+
name: "size",
|
18
|
+
render: () => (<Example>
|
19
|
+
<Example.Item title="size: 4">
|
20
|
+
<Icon svg={IconZap} size={4}/>
|
21
|
+
</Example.Item>
|
22
|
+
<Example.Item title="size: 8">
|
23
|
+
<Icon svg={IconZap} size={8}/>
|
24
|
+
</Example.Item>
|
25
|
+
<Example.Item title="size: 100%">
|
26
|
+
<View width={25} height={25}>
|
27
|
+
<Icon svg={IconZap} size="100%"/>
|
36
28
|
</View>
|
37
|
-
</
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
</Example
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
<
|
55
|
-
|
56
|
-
|
57
|
-
<
|
58
|
-
|
59
|
-
|
60
|
-
<
|
61
|
-
<Icon svg={IconZap}/>
|
62
|
-
</
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
<
|
73
|
-
<
|
74
|
-
|
75
|
-
|
76
|
-
|
29
|
+
</Example.Item>
|
30
|
+
<Example.Item title={["responsive size", "[s] 5", "[m]: 10"]}>
|
31
|
+
<Icon svg={IconZap} size={{ s: 5, m: 10 }}/>
|
32
|
+
</Example.Item>
|
33
|
+
<Example.Item title="size: inherit from font">
|
34
|
+
<Text variant="title-6">
|
35
|
+
<View direction="row" align="center" gap={2}>
|
36
|
+
<Icon svg={IconZap}/>
|
37
|
+
<View.Item>Reshaped</View.Item>
|
38
|
+
</View>
|
39
|
+
</Text>
|
40
|
+
</Example.Item>
|
41
|
+
</Example>),
|
42
|
+
};
|
43
|
+
export const color = {
|
44
|
+
name: "color",
|
45
|
+
render: () => (<Example>
|
46
|
+
<Example.Item title="color: neutral">
|
47
|
+
<Icon svg={IconZap} color="neutral"/>
|
48
|
+
</Example.Item>
|
49
|
+
<Example.Item title="color: neutral-faded">
|
50
|
+
<Icon svg={IconZap} color="neutral-faded"/>
|
51
|
+
</Example.Item>
|
52
|
+
<Example.Item title="color: primary">
|
53
|
+
<Icon svg={IconZap} color="primary"/>
|
54
|
+
</Example.Item>
|
55
|
+
<Example.Item title="color: critical">
|
56
|
+
<Icon svg={IconZap} color="critical"/>
|
57
|
+
</Example.Item>
|
58
|
+
<Example.Item title="color: positive">
|
59
|
+
<Icon svg={IconZap} color="positive"/>
|
60
|
+
</Example.Item>
|
61
|
+
<Example.Item title="color: disabled">
|
62
|
+
<Icon svg={IconZap} color="disabled"/>
|
63
|
+
</Example.Item>
|
64
|
+
<Example.Item title="color: inherit">
|
65
|
+
<div style={{ color: "tomato" }}>
|
66
|
+
<Icon svg={IconZap}/>
|
67
|
+
</div>
|
68
|
+
</Example.Item>
|
69
|
+
</Example>),
|
70
|
+
};
|
71
|
+
export const autoWidth = {
|
72
|
+
name: "autoWidth",
|
73
|
+
render: () => (<Example>
|
74
|
+
<Example.Item title="square boundaries">
|
75
|
+
<div style={{ background: "var(--rs-color-background-neutral)", display: "inline-block" }}>
|
76
|
+
<Icon svg={IconMic} size={10}/>
|
77
|
+
</div>
|
78
|
+
</Example.Item>
|
79
|
+
<Example.Item title="auto width boundaries">
|
80
|
+
<div style={{ background: "var(--rs-color-background-neutral)", display: "inline-block" }}>
|
81
|
+
<Icon svg={IconMic} size={10} autoWidth/>
|
82
|
+
</div>
|
83
|
+
</Example.Item>
|
84
|
+
</Example>),
|
85
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
component: (props: import("./..").IconProps) => 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 render: StoryObj;
|
16
|
+
export declare const className: StoryObj;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { expect } from "@storybook/test";
|
2
|
+
import Icon from "../index.js";
|
3
|
+
import IconZap from "../../../icons/Zap.js";
|
4
|
+
export default {
|
5
|
+
title: "Utilities/Icon/tests",
|
6
|
+
component: Icon,
|
7
|
+
parameters: {
|
8
|
+
iframe: {
|
9
|
+
url: "https://reshaped.so/docs/utilities/icon",
|
10
|
+
},
|
11
|
+
chromatic: { disableSnapshot: true },
|
12
|
+
},
|
13
|
+
};
|
14
|
+
export const render = {
|
15
|
+
name: "render, hidden from sr",
|
16
|
+
render: () => (<div data-testid="root">
|
17
|
+
<Icon svg={IconZap}/>
|
18
|
+
</div>),
|
19
|
+
play: ({ canvas }) => {
|
20
|
+
const root = canvas.getByTestId("root").firstChild;
|
21
|
+
expect(root).toBeInTheDocument();
|
22
|
+
expect(root).toHaveAttribute("aria-hidden");
|
23
|
+
},
|
24
|
+
};
|
25
|
+
export const className = {
|
26
|
+
name: "className, attributes",
|
27
|
+
render: () => (<div data-testid="root">
|
28
|
+
<Icon svg={IconZap} className="test-classname" attributes={{ id: "test-id" }}/>
|
29
|
+
</div>),
|
30
|
+
play: async ({ canvas }) => {
|
31
|
+
const root = canvas.getByTestId("root").firstChild;
|
32
|
+
expect(root).toHaveClass("test-classname");
|
33
|
+
expect(root).toHaveAttribute("id", "test-id");
|
34
|
+
},
|
35
|
+
};
|
@@ -8,8 +8,27 @@ declare const _default: {
|
|
8
8
|
};
|
9
9
|
};
|
10
10
|
export default _default;
|
11
|
-
export declare const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
export declare const
|
11
|
+
export declare const base: {
|
12
|
+
name: string;
|
13
|
+
render: () => import("react").JSX.Element;
|
14
|
+
};
|
15
|
+
export declare const size: {
|
16
|
+
name: string;
|
17
|
+
render: () => import("react").JSX.Element;
|
18
|
+
};
|
19
|
+
export declare const radius: {
|
20
|
+
name: string;
|
21
|
+
render: () => import("react").JSX.Element;
|
22
|
+
};
|
23
|
+
export declare const displayMode: {
|
24
|
+
name: string;
|
25
|
+
render: () => import("react").JSX.Element;
|
26
|
+
};
|
27
|
+
export declare const ratio: {
|
28
|
+
name: string;
|
29
|
+
render: () => import("react").JSX.Element;
|
30
|
+
};
|
31
|
+
export declare const fallback: {
|
32
|
+
name: string;
|
33
|
+
render: () => import("react").JSX.Element;
|
34
|
+
};
|
@@ -13,85 +13,105 @@ export default {
|
|
13
13
|
},
|
14
14
|
};
|
15
15
|
const imgUrl = "https://images.unsplash.com/photo-1536880756060-98a6a140f0a7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80";
|
16
|
-
export const
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
</Example
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
<
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
16
|
+
export const base = {
|
17
|
+
name: "base",
|
18
|
+
render: () => (<Example>
|
19
|
+
<Example.Item title="base">
|
20
|
+
<Image src={imgUrl} alt="Image alt"/>
|
21
|
+
</Example.Item>
|
22
|
+
</Example>),
|
23
|
+
};
|
24
|
+
export const size = {
|
25
|
+
name: "width, height",
|
26
|
+
render: () => (<Example>
|
27
|
+
<Example.Item title="width: 200px">
|
28
|
+
<Image src={imgUrl} width="200px"/>
|
29
|
+
</Example.Item>
|
30
|
+
<Example.Item title="height: 200px">
|
31
|
+
<Image src={imgUrl} height="200px"/>
|
32
|
+
</Example.Item>
|
33
|
+
<Example.Item title={["responsive width", "[s] 200px", "[m+] 300px"]}>
|
34
|
+
<Image src={imgUrl} width={{ s: "200px", m: "300px" }}/>
|
35
|
+
</Example.Item>
|
36
|
+
</Example>),
|
37
|
+
};
|
38
|
+
export const radius = {
|
39
|
+
name: "borderRadius",
|
40
|
+
render: () => (<Example>
|
41
|
+
<Example.Item title="radius: small">
|
42
|
+
<View width="300px">
|
43
|
+
<Image src={imgUrl} borderRadius="small"/>
|
44
|
+
</View>
|
45
|
+
</Example.Item>
|
46
|
+
<Example.Item title="radius: medium">
|
47
|
+
<View width="300px">
|
48
|
+
<Image src={imgUrl} borderRadius="medium"/>
|
49
|
+
</View>
|
50
|
+
</Example.Item>
|
51
|
+
<Example.Item title="radius: large">
|
52
|
+
<View width="300px">
|
53
|
+
<Image src={imgUrl} borderRadius="large"/>
|
54
|
+
</View>
|
55
|
+
</Example.Item>
|
56
|
+
</Example>),
|
57
|
+
};
|
58
|
+
export const displayMode = {
|
59
|
+
name: "displayMode",
|
60
|
+
render: () => (<Example>
|
61
|
+
<Example.Item title="mode: cover">
|
62
|
+
<Image src={imgUrl} height="200px" width="100%" displayMode="cover"/>
|
63
|
+
</Example.Item>
|
64
|
+
<Example.Item title="mode: contain">
|
65
|
+
<Image src={imgUrl} height="200px" width="100%" displayMode="contain"/>
|
66
|
+
</Example.Item>
|
67
|
+
</Example>),
|
68
|
+
};
|
69
|
+
export const ratio = {
|
70
|
+
name: "composition, aspectRatio",
|
71
|
+
render: () => (<Example>
|
72
|
+
<Example.Item title="ratio: 16/9">
|
70
73
|
<View aspectRatio={16 / 9}>
|
71
|
-
<Image src=
|
74
|
+
<Image src={imgUrl}/>
|
72
75
|
</View>
|
73
|
-
</
|
74
|
-
|
75
|
-
<Example.Item title="fallback, image, on error">
|
76
|
-
<View width="300px">
|
76
|
+
</Example.Item>
|
77
|
+
<Example.Item title="ratio: 16/9, displayMode: contain">
|
77
78
|
<View aspectRatio={16 / 9}>
|
78
|
-
<Image src=
|
79
|
+
<Image src={imgUrl} displayMode="contain"/>
|
79
80
|
</View>
|
80
|
-
</
|
81
|
-
</Example
|
81
|
+
</Example.Item>
|
82
|
+
</Example>),
|
83
|
+
};
|
84
|
+
export const fallback = {
|
85
|
+
name: "fallback",
|
86
|
+
render: () => (<Example>
|
87
|
+
<Example.Item title="fallback, background, on error">
|
88
|
+
<View width="300px">
|
89
|
+
<View aspectRatio={16 / 9}>
|
90
|
+
<Image src="error" fallback/>
|
91
|
+
</View>
|
92
|
+
</View>
|
93
|
+
</Example.Item>
|
94
|
+
<Example.Item title="fallback, image, on error">
|
95
|
+
<View width="300px">
|
96
|
+
<View aspectRatio={16 / 9}>
|
97
|
+
<Image src="error" fallback={imgUrl}/>
|
98
|
+
</View>
|
99
|
+
</View>
|
100
|
+
</Example.Item>
|
82
101
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
102
|
+
<Example.Item title="fallback, icon, on error">
|
103
|
+
<View width="300px">
|
104
|
+
<View aspectRatio={16 / 9}>
|
105
|
+
<Image src="error" fallback={<Icon svg={IconZap} size={10}/>}/>
|
106
|
+
</View>
|
87
107
|
</View>
|
88
|
-
</
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
108
|
+
</Example.Item>
|
109
|
+
<Example.Item title="fallback, icon, no url">
|
110
|
+
<View width="300px">
|
111
|
+
<View aspectRatio={16 / 9}>
|
112
|
+
<Image fallback={<Icon svg={IconZap} size={10}/>}/>
|
113
|
+
</View>
|
94
114
|
</View>
|
95
|
-
</
|
96
|
-
</Example
|
97
|
-
|
115
|
+
</Example.Item>
|
116
|
+
</Example>),
|
117
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
import { fn } from "@storybook/test";
|
3
|
+
declare const _default: {
|
4
|
+
title: string;
|
5
|
+
component: (props: import("./..").ImageProps) => 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 src: StoryObj;
|
17
|
+
export declare const ariaLabel: StoryObj;
|
18
|
+
export declare const onLoad: StoryObj<{
|
19
|
+
handleLoad: ReturnType<typeof fn>;
|
20
|
+
}>;
|
21
|
+
export declare const onError: StoryObj<{
|
22
|
+
handleError: ReturnType<typeof fn>;
|
23
|
+
}>;
|
24
|
+
export declare const className: StoryObj;
|
25
|
+
export declare const imageAttributes: StoryObj;
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import { expect, fn, waitFor } from "@storybook/test";
|
2
|
+
import Image from "../index.js";
|
3
|
+
export default {
|
4
|
+
title: "Utilities/Image/tests",
|
5
|
+
component: Image,
|
6
|
+
parameters: {
|
7
|
+
iframe: {
|
8
|
+
url: "https://reshaped.so/docs/utilities/image",
|
9
|
+
},
|
10
|
+
chromatic: { disableSnapshot: true },
|
11
|
+
},
|
12
|
+
};
|
13
|
+
const imgUrl = "https://images.unsplash.com/photo-1536880756060-98a6a140f0a7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80";
|
14
|
+
export const src = {
|
15
|
+
name: "src, presentation",
|
16
|
+
render: () => <Image src={imgUrl}/>,
|
17
|
+
play: ({ canvas }) => {
|
18
|
+
const img = canvas.getByRole("presentation");
|
19
|
+
expect(img).toHaveAttribute("src", imgUrl);
|
20
|
+
},
|
21
|
+
};
|
22
|
+
export const ariaLabel = {
|
23
|
+
name: "src, alt",
|
24
|
+
render: () => <Image src={imgUrl} alt="photo"/>,
|
25
|
+
play: ({ canvas }) => {
|
26
|
+
const img = canvas.getByRole("img");
|
27
|
+
expect(img).toHaveAccessibleName("photo");
|
28
|
+
},
|
29
|
+
};
|
30
|
+
export const onLoad = {
|
31
|
+
name: "onLoad",
|
32
|
+
args: {
|
33
|
+
handleLoad: fn(),
|
34
|
+
},
|
35
|
+
render: (args) => <Image src={imgUrl} alt="photo" onLoad={args.handleLoad}/>,
|
36
|
+
play: async ({ canvas, args }) => {
|
37
|
+
const { handleLoad } = args;
|
38
|
+
const img = canvas.getByRole("img");
|
39
|
+
await waitFor(() => {
|
40
|
+
expect(handleLoad).toHaveBeenCalledTimes(1);
|
41
|
+
expect(handleLoad).toHaveBeenCalledWith(expect.objectContaining({ target: img, type: "load" }));
|
42
|
+
});
|
43
|
+
},
|
44
|
+
};
|
45
|
+
export const onError = {
|
46
|
+
name: "onError",
|
47
|
+
args: {
|
48
|
+
handleError: fn(),
|
49
|
+
},
|
50
|
+
render: (args) => <Image src="/invalid.png" alt="photo" onError={args.handleError}/>,
|
51
|
+
play: async ({ canvas, args }) => {
|
52
|
+
const { handleError } = args;
|
53
|
+
const img = canvas.getByRole("img");
|
54
|
+
await waitFor(() => {
|
55
|
+
expect(handleError).toHaveBeenCalledTimes(1);
|
56
|
+
expect(handleError).toHaveBeenCalledWith(expect.objectContaining({ target: img, type: "error" }));
|
57
|
+
});
|
58
|
+
},
|
59
|
+
};
|
60
|
+
export const className = {
|
61
|
+
name: "className, attributes",
|
62
|
+
render: () => (<div data-testid="root">
|
63
|
+
<Image src={imgUrl} className="test-classname" attributes={{ id: "test-id" }}/>
|
64
|
+
</div>),
|
65
|
+
play: async ({ canvas }) => {
|
66
|
+
const root = canvas.getByTestId("root").firstChild;
|
67
|
+
expect(root).toHaveClass("test-classname");
|
68
|
+
expect(root).toHaveAttribute("id", "test-id");
|
69
|
+
},
|
70
|
+
};
|
71
|
+
export const imageAttributes = {
|
72
|
+
name: "imageAttributes",
|
73
|
+
render: () => (<div data-testid="root">
|
74
|
+
<Image src={imgUrl} alt="photo" attributes={{ id: "test-id" }} imageAttributes={{ id: "test-img-id" }}/>
|
75
|
+
</div>),
|
76
|
+
play: async ({ canvas }) => {
|
77
|
+
const img = canvas.getByRole("img");
|
78
|
+
expect(img).toHaveAttribute("id", "test-img-id");
|
79
|
+
},
|
80
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
import { fn } from "@storybook/test";
|
3
|
+
declare const _default: {
|
4
|
+
title: string;
|
5
|
+
component: import("react").ForwardRefExoticComponent<Pick<import("../../Actionable").ActionableProps, "children" | "disabled" | "className" | "attributes" | "type" | "onClick" | "href" | "stopPropagation"> & {
|
6
|
+
icon?: import("../../Icon").IconProps["svg"];
|
7
|
+
color?: "inherit" | "critical" | "primary" | "positive" | "warning";
|
8
|
+
variant?: "plain" | "underline";
|
9
|
+
} & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
10
|
+
parameters: {
|
11
|
+
iframe: {
|
12
|
+
url: string;
|
13
|
+
};
|
14
|
+
chromatic: {
|
15
|
+
disableSnapshot: boolean;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
};
|
19
|
+
export default _default;
|
20
|
+
export declare const children: StoryObj;
|
21
|
+
export declare const href: StoryObj;
|
22
|
+
export declare const onClick: StoryObj<{
|
23
|
+
handleClick: ReturnType<typeof fn>;
|
24
|
+
}>;
|
25
|
+
export declare const hrefOnClick: StoryObj<{
|
26
|
+
handleClick: ReturnType<typeof fn>;
|
27
|
+
}>;
|
28
|
+
export declare const disabled: StoryObj;
|
29
|
+
export declare const className: StoryObj;
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import { userEvent, expect, fn } from "@storybook/test";
|
2
|
+
import Link from "../index.js";
|
3
|
+
export default {
|
4
|
+
title: "Components/Link/tests",
|
5
|
+
component: Link,
|
6
|
+
parameters: {
|
7
|
+
iframe: {
|
8
|
+
url: "https://reshaped.so/docs/components/breadcrumbs",
|
9
|
+
},
|
10
|
+
chromatic: { disableSnapshot: true },
|
11
|
+
},
|
12
|
+
};
|
13
|
+
export const children = {
|
14
|
+
name: "children",
|
15
|
+
render: () => <Link>Trigger</Link>,
|
16
|
+
play: async ({ canvas }) => {
|
17
|
+
const el = canvas.getByText("Trigger");
|
18
|
+
expect(el).toBeInTheDocument();
|
19
|
+
expect(el.tagName).toBe("SPAN");
|
20
|
+
},
|
21
|
+
};
|
22
|
+
export const href = {
|
23
|
+
name: "href",
|
24
|
+
render: () => <Link href="https://reshaped.so">Trigger</Link>,
|
25
|
+
play: async ({ canvas }) => {
|
26
|
+
const el = canvas.getByRole("link");
|
27
|
+
expect(el).toHaveAttribute("href", "https://reshaped.so");
|
28
|
+
},
|
29
|
+
};
|
30
|
+
export const onClick = {
|
31
|
+
name: "onClick",
|
32
|
+
args: {
|
33
|
+
handleClick: fn(),
|
34
|
+
},
|
35
|
+
render: (args) => <Link onClick={args.handleClick}>Trigger</Link>,
|
36
|
+
play: async ({ canvas, args }) => {
|
37
|
+
const { handleClick } = args;
|
38
|
+
const el = canvas.getAllByRole("button")[0];
|
39
|
+
await userEvent.click(el);
|
40
|
+
expect(el).toHaveAttribute("type", "button");
|
41
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
42
|
+
expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
|
43
|
+
},
|
44
|
+
};
|
45
|
+
export const hrefOnClick = {
|
46
|
+
name: "href + onClick",
|
47
|
+
args: {
|
48
|
+
handleClick: fn(),
|
49
|
+
},
|
50
|
+
render: (args) => (<Link onClick={(e) => {
|
51
|
+
e.preventDefault();
|
52
|
+
args.handleClick(e);
|
53
|
+
}} href="https://reshaped.so">
|
54
|
+
Trigger
|
55
|
+
</Link>),
|
56
|
+
play: async ({ canvas, args }) => {
|
57
|
+
const { handleClick } = args;
|
58
|
+
const el = canvas.getByRole("link");
|
59
|
+
await userEvent.click(el);
|
60
|
+
expect(el).toHaveAttribute("href", "https://reshaped.so");
|
61
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
62
|
+
expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
|
63
|
+
},
|
64
|
+
};
|
65
|
+
export const disabled = {
|
66
|
+
name: "disabled",
|
67
|
+
render: () => (<Link disabled onClick={() => { }}>
|
68
|
+
Trigger
|
69
|
+
</Link>),
|
70
|
+
play: async ({ canvas }) => {
|
71
|
+
const el = canvas.getAllByRole("button")[0];
|
72
|
+
expect(el).toBeDisabled();
|
73
|
+
},
|
74
|
+
};
|
75
|
+
export const className = {
|
76
|
+
name: "className, attributes",
|
77
|
+
render: () => (<div data-testid="root">
|
78
|
+
<Link className="test-classname" attributes={{ id: "test-id" }}>
|
79
|
+
Trigger
|
80
|
+
</Link>
|
81
|
+
</div>),
|
82
|
+
play: async ({ canvas }) => {
|
83
|
+
const root = canvas.getByTestId("root").firstChild;
|
84
|
+
expect(root).toHaveClass("test-classname");
|
85
|
+
expect(root).toHaveAttribute("id", "test-id");
|
86
|
+
},
|
87
|
+
};
|
@@ -3,7 +3,7 @@ import { classNames, responsiveClassNames } from "../../utilities/helpers.js";
|
|
3
3
|
import s from "./Loader.module.css";
|
4
4
|
const Loader = (props) => {
|
5
5
|
const { size = "small", color = "primary", className, attributes } = props;
|
6
|
-
const ariaLabel = attributes?.["aria-label"];
|
6
|
+
const ariaLabel = props.ariaLabel || attributes?.["aria-label"];
|
7
7
|
const rootClassNames = classNames(s.root, className, responsiveClassNames(s, "--size", size), color && s[`--color-${color}`]);
|
8
8
|
return (_jsx("span", { ...attributes, role: "progressbar", "aria-live": ariaLabel ? "assertive" : undefined, "aria-label": ariaLabel, className: rootClassNames, children: _jsx("span", { className: s.inner }) }));
|
9
9
|
};
|
@@ -2,6 +2,7 @@ import type * as G from "../../types/global";
|
|
2
2
|
export type Props = {
|
3
3
|
size?: G.Responsive<"small" | "medium" | "large">;
|
4
4
|
color?: "primary" | "critical" | "positive" | "inherit";
|
5
|
+
ariaLabel?: string;
|
5
6
|
className?: G.ClassName;
|
6
7
|
attributes?: G.Attributes<"span">;
|
7
8
|
};
|