reshaped 3.8.8 → 3.9.0-canary.1
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 +11 -11
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Divider/Divider.js +3 -3
- package/dist/components/Divider/Divider.module.css +1 -1
- package/dist/components/Divider/Divider.types.d.ts +6 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +1 -1
- package/dist/components/Flyout/Flyout.constants.d.ts +1 -3
- package/dist/components/Flyout/Flyout.constants.js +1 -3
- package/dist/components/Flyout/Flyout.types.d.ts +2 -0
- package/dist/components/Flyout/FlyoutControlled.js +10 -11
- package/dist/components/Flyout/utilities/cooldown.js +1 -2
- package/dist/components/Icon/Icon.module.css +1 -1
- package/dist/components/Popover/Popover.types.d.ts +1 -1
- package/dist/components/Progress/Progress.module.css +1 -1
- package/dist/components/Select/Select.module.css +1 -1
- package/dist/components/Select/Select.types.d.ts +16 -11
- package/dist/components/Select/SelectCustomControlled.js +27 -10
- package/dist/components/Select/SelectGroup.d.ts +4 -0
- package/dist/components/Select/SelectGroup.js +10 -0
- package/dist/components/Select/SelectTrigger.js +1 -1
- package/dist/components/Select/index.d.ts +3 -2
- package/dist/components/Select/index.js +3 -2
- package/dist/components/Tabs/TabsContext.d.ts +1 -1
- package/dist/components/TextArea/TextArea.module.css +1 -1
- package/dist/components/TextArea/TextArea.types.d.ts +1 -1
- package/dist/components/TextField/TextField.module.css +1 -1
- package/dist/components/TextField/TextField.types.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/config/tailwind.d.ts +1 -1
- package/package.json +31 -30
- 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 -18
- package/dist/components/Divider/tests/Divider.stories.js +0 -94
- 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 -102
- package/dist/components/Flyout/tests/Flyout.stories.js +0 -708
- 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/SelectOptionGroup.d.ts +0 -4
- package/dist/components/Select/SelectOptionGroup.js +0 -9
- package/dist/components/Select/tests/Select.stories.d.ts +0 -47
- package/dist/components/Select/tests/Select.stories.js +0 -520
- 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 -200
- package/dist/components/TextField/tests/TextField.stories.d.ts +0 -53
- package/dist/components/TextField/tests/TextField.stories.js +0 -237
- 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/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
|
@@ -1,789 +0,0 @@
|
|
|
1
|
-
import { Example, Placeholder } from "../../../utilities/storybook/index.js";
|
|
2
|
-
import Button from "../index.js";
|
|
3
|
-
import View from "../../View/index.js";
|
|
4
|
-
import Image from "../../Image/index.js";
|
|
5
|
-
import Avatar from "../../Avatar/index.js";
|
|
6
|
-
import Hotkey from "../../Hotkey/index.js";
|
|
7
|
-
import IconZap from "../../../icons/Zap.js";
|
|
8
|
-
import { expect, fn, userEvent } from "storybook/test";
|
|
9
|
-
export default {
|
|
10
|
-
title: "Components/Button",
|
|
11
|
-
component: Button,
|
|
12
|
-
parameters: {
|
|
13
|
-
iframe: {
|
|
14
|
-
url: "https://reshaped.so/docs/components/button",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
const imgUrl = "https://images.unsplash.com/photo-1632502361954-0dd92ce797db?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1625&q=80";
|
|
19
|
-
export const variantAndColor = {
|
|
20
|
-
name: "variant, color",
|
|
21
|
-
render: () => (<Example>
|
|
22
|
-
<Example.Item title="variant: solid">
|
|
23
|
-
<View gap={4} direction="row">
|
|
24
|
-
<Button onClick={() => { }}>Button</Button>
|
|
25
|
-
<Button onClick={() => { }} color="primary">
|
|
26
|
-
Button
|
|
27
|
-
</Button>
|
|
28
|
-
<Button onClick={() => { }} color="critical">
|
|
29
|
-
Button
|
|
30
|
-
</Button>
|
|
31
|
-
<Button onClick={() => { }} color="positive">
|
|
32
|
-
Button
|
|
33
|
-
</Button>
|
|
34
|
-
</View>
|
|
35
|
-
</Example.Item>
|
|
36
|
-
<Example.Item title="variant: faded">
|
|
37
|
-
<View direction="row" gap={4}>
|
|
38
|
-
<Button onClick={() => { }} variant="faded">
|
|
39
|
-
Button
|
|
40
|
-
</Button>
|
|
41
|
-
<Button onClick={() => { }} color="primary" variant="faded">
|
|
42
|
-
Button
|
|
43
|
-
</Button>
|
|
44
|
-
<Button onClick={() => { }} color="critical" variant="faded">
|
|
45
|
-
Button
|
|
46
|
-
</Button>
|
|
47
|
-
<Button onClick={() => { }} color="positive" variant="faded">
|
|
48
|
-
Button
|
|
49
|
-
</Button>
|
|
50
|
-
<View padding={4} borderRadius="medium" attributes={{ style: { color: "#029CFD" } }}>
|
|
51
|
-
<Button onClick={() => { }} color="inherit" variant="faded">
|
|
52
|
-
Inherit
|
|
53
|
-
</Button>
|
|
54
|
-
</View>
|
|
55
|
-
|
|
56
|
-
<View padding={4} backgroundColor="black" borderRadius="medium">
|
|
57
|
-
<Button onClick={() => { }} color="inherit" variant="faded">
|
|
58
|
-
Inherit
|
|
59
|
-
</Button>
|
|
60
|
-
</View>
|
|
61
|
-
<View padding={4} backgroundColor="white" borderRadius="medium">
|
|
62
|
-
<Button onClick={() => { }} color="inherit" variant="faded">
|
|
63
|
-
Inherit
|
|
64
|
-
</Button>
|
|
65
|
-
</View>
|
|
66
|
-
</View>
|
|
67
|
-
</Example.Item>
|
|
68
|
-
<Example.Item title="variant: outline">
|
|
69
|
-
<View direction="row" gap={4}>
|
|
70
|
-
<Button onClick={() => { }} variant="outline">
|
|
71
|
-
Button
|
|
72
|
-
</Button>
|
|
73
|
-
<Button onClick={() => { }} color="primary" variant="outline">
|
|
74
|
-
Button
|
|
75
|
-
</Button>
|
|
76
|
-
<Button onClick={() => { }} color="critical" variant="outline">
|
|
77
|
-
Button
|
|
78
|
-
</Button>
|
|
79
|
-
<Button onClick={() => { }} color="positive" variant="outline">
|
|
80
|
-
Button
|
|
81
|
-
</Button>
|
|
82
|
-
|
|
83
|
-
<View padding={4} borderRadius="medium" attributes={{ style: { color: "#029CFD" } }}>
|
|
84
|
-
<Button onClick={() => { }} color="inherit" variant="outline">
|
|
85
|
-
Inherit
|
|
86
|
-
</Button>
|
|
87
|
-
</View>
|
|
88
|
-
|
|
89
|
-
<View padding={4} backgroundColor="black" borderRadius="medium">
|
|
90
|
-
<Button onClick={() => { }} color="inherit" variant="outline">
|
|
91
|
-
Inherit
|
|
92
|
-
</Button>
|
|
93
|
-
</View>
|
|
94
|
-
<View padding={4} backgroundColor="white" borderRadius="medium">
|
|
95
|
-
<Button onClick={() => { }} color="inherit" variant="outline">
|
|
96
|
-
Inherit
|
|
97
|
-
</Button>
|
|
98
|
-
</View>
|
|
99
|
-
</View>
|
|
100
|
-
</Example.Item>
|
|
101
|
-
<Example.Item title="variant: ghost">
|
|
102
|
-
<View direction="row" gap={4}>
|
|
103
|
-
<Button onClick={() => { }} variant="ghost">
|
|
104
|
-
Button
|
|
105
|
-
</Button>
|
|
106
|
-
<Button onClick={() => { }} color="primary" variant="ghost">
|
|
107
|
-
Button
|
|
108
|
-
</Button>
|
|
109
|
-
<Button onClick={() => { }} color="critical" variant="ghost">
|
|
110
|
-
Button
|
|
111
|
-
</Button>
|
|
112
|
-
<Button onClick={() => { }} color="positive" variant="ghost">
|
|
113
|
-
Button
|
|
114
|
-
</Button>
|
|
115
|
-
<View padding={4} borderRadius="medium" attributes={{ style: { color: "#029CFD" } }}>
|
|
116
|
-
<Button onClick={() => { }} color="inherit" variant="ghost">
|
|
117
|
-
Inherit
|
|
118
|
-
</Button>
|
|
119
|
-
</View>
|
|
120
|
-
|
|
121
|
-
<View padding={4} backgroundColor="black" borderRadius="medium">
|
|
122
|
-
<Button onClick={() => { }} color="inherit" variant="ghost">
|
|
123
|
-
Inherit
|
|
124
|
-
</Button>
|
|
125
|
-
</View>
|
|
126
|
-
<View padding={4} backgroundColor="white" borderRadius="medium">
|
|
127
|
-
<Button onClick={() => { }} color="inherit" variant="ghost">
|
|
128
|
-
Inherit
|
|
129
|
-
</Button>
|
|
130
|
-
</View>
|
|
131
|
-
</View>
|
|
132
|
-
</Example.Item>
|
|
133
|
-
<Example.Item title="color: media">
|
|
134
|
-
<View backgroundColor="primary" borderRadius="medium" padding={4} direction="row" gap={4}>
|
|
135
|
-
<Button onClick={() => { }} color="media">
|
|
136
|
-
Button
|
|
137
|
-
</Button>
|
|
138
|
-
|
|
139
|
-
<Button onClick={() => { }} color="media" variant="faded">
|
|
140
|
-
Button
|
|
141
|
-
</Button>
|
|
142
|
-
</View>
|
|
143
|
-
</Example.Item>
|
|
144
|
-
</Example>),
|
|
145
|
-
};
|
|
146
|
-
export const icon = {
|
|
147
|
-
name: "icon",
|
|
148
|
-
render: () => (<Example>
|
|
149
|
-
<Example.Item title="icon">
|
|
150
|
-
<Button onClick={() => { }} icon={IconZap}>
|
|
151
|
-
Button
|
|
152
|
-
</Button>
|
|
153
|
-
</Example.Item>
|
|
154
|
-
|
|
155
|
-
<Example.Item title="endIcon">
|
|
156
|
-
<Button onClick={() => { }} endIcon={IconZap}>
|
|
157
|
-
Button
|
|
158
|
-
</Button>
|
|
159
|
-
</Example.Item>
|
|
160
|
-
|
|
161
|
-
<Example.Item title="icon, endIcon">
|
|
162
|
-
<Button onClick={() => { }} icon={IconZap} endIcon={IconZap}>
|
|
163
|
-
Button
|
|
164
|
-
</Button>
|
|
165
|
-
</Example.Item>
|
|
166
|
-
|
|
167
|
-
<Example.Item title="icon only">
|
|
168
|
-
<Button onClick={() => { }} icon={IconZap} attributes={{ "aria-label": "Action" }}/>
|
|
169
|
-
</Example.Item>
|
|
170
|
-
</Example>),
|
|
171
|
-
};
|
|
172
|
-
export const size = {
|
|
173
|
-
name: "size",
|
|
174
|
-
render: () => (<Example>
|
|
175
|
-
<Example.Item title="size: small">
|
|
176
|
-
<View gap={4} direction="row">
|
|
177
|
-
<Button size="small" icon={IconZap}>
|
|
178
|
-
Button
|
|
179
|
-
</Button>
|
|
180
|
-
<Button size="small" variant="outline" icon={IconZap}>
|
|
181
|
-
Button
|
|
182
|
-
</Button>
|
|
183
|
-
<Button size="small" variant="ghost" icon={IconZap}>
|
|
184
|
-
Button
|
|
185
|
-
</Button>
|
|
186
|
-
</View>
|
|
187
|
-
</Example.Item>
|
|
188
|
-
|
|
189
|
-
<Example.Item title="size: medium">
|
|
190
|
-
<View gap={4} direction="row">
|
|
191
|
-
<Button icon={IconZap}>Button</Button>
|
|
192
|
-
<Button variant="outline" icon={IconZap}>
|
|
193
|
-
Button
|
|
194
|
-
</Button>
|
|
195
|
-
<Button variant="ghost" icon={IconZap}>
|
|
196
|
-
Button
|
|
197
|
-
</Button>
|
|
198
|
-
</View>
|
|
199
|
-
</Example.Item>
|
|
200
|
-
|
|
201
|
-
<Example.Item title="size: large">
|
|
202
|
-
<View gap={4} direction="row">
|
|
203
|
-
<Button size="large" icon={IconZap}>
|
|
204
|
-
Button
|
|
205
|
-
</Button>
|
|
206
|
-
<Button size="large" variant="outline" icon={IconZap}>
|
|
207
|
-
Button
|
|
208
|
-
</Button>
|
|
209
|
-
<Button size="large" variant="ghost" icon={IconZap}>
|
|
210
|
-
Button
|
|
211
|
-
</Button>
|
|
212
|
-
</View>
|
|
213
|
-
</Example.Item>
|
|
214
|
-
|
|
215
|
-
<Example.Item title="size: xlarge">
|
|
216
|
-
<View gap={4} direction="row">
|
|
217
|
-
<Button size="xlarge" icon={IconZap}>
|
|
218
|
-
Button
|
|
219
|
-
</Button>
|
|
220
|
-
<Button size="xlarge" variant="outline" icon={IconZap}>
|
|
221
|
-
Button
|
|
222
|
-
</Button>
|
|
223
|
-
<Button size="xlarge" variant="ghost" icon={IconZap}>
|
|
224
|
-
Button
|
|
225
|
-
</Button>
|
|
226
|
-
</View>
|
|
227
|
-
</Example.Item>
|
|
228
|
-
|
|
229
|
-
<Example.Item title="size: large, [m+] medium">
|
|
230
|
-
<Button size={{ s: "large", m: "medium" }} icon={IconZap}>
|
|
231
|
-
Responsive
|
|
232
|
-
</Button>
|
|
233
|
-
</Example.Item>
|
|
234
|
-
</Example>),
|
|
235
|
-
};
|
|
236
|
-
export const elevated = {
|
|
237
|
-
name: "elevated",
|
|
238
|
-
render: () => (<Example>
|
|
239
|
-
<Example.Item title="elevated, color: neutral">
|
|
240
|
-
<View direction="row" gap={4}>
|
|
241
|
-
<Button elevated onClick={() => { }}>
|
|
242
|
-
Button
|
|
243
|
-
</Button>
|
|
244
|
-
<Button elevated variant="outline" onClick={() => { }}>
|
|
245
|
-
Button
|
|
246
|
-
</Button>
|
|
247
|
-
</View>
|
|
248
|
-
</Example.Item>
|
|
249
|
-
|
|
250
|
-
<Example.Item title="elevated, color">
|
|
251
|
-
<View direction="row" gap={4}>
|
|
252
|
-
<Button elevated color="primary">
|
|
253
|
-
Button
|
|
254
|
-
</Button>
|
|
255
|
-
<Button elevated variant="outline" color="primary">
|
|
256
|
-
Button
|
|
257
|
-
</Button>
|
|
258
|
-
<View backgroundColor="primary" padding={4} borderRadius="medium">
|
|
259
|
-
<Button color="media" elevated>
|
|
260
|
-
Button
|
|
261
|
-
</Button>
|
|
262
|
-
</View>
|
|
263
|
-
</View>
|
|
264
|
-
</Example.Item>
|
|
265
|
-
</Example>),
|
|
266
|
-
};
|
|
267
|
-
export const rounded = {
|
|
268
|
-
name: "rounded",
|
|
269
|
-
render: () => (<Example>
|
|
270
|
-
<Example.Item title="rounded, size: small, all variants">
|
|
271
|
-
<View gap={3} direction="row">
|
|
272
|
-
<Button rounded size="small" icon={IconZap}>
|
|
273
|
-
Button
|
|
274
|
-
</Button>
|
|
275
|
-
<Button rounded variant="outline" size="small" icon={IconZap}>
|
|
276
|
-
Button
|
|
277
|
-
</Button>
|
|
278
|
-
<Button rounded variant="ghost" size="small" icon={IconZap}>
|
|
279
|
-
Button
|
|
280
|
-
</Button>
|
|
281
|
-
</View>
|
|
282
|
-
</Example.Item>
|
|
283
|
-
<Example.Item title="rounded, size: medium, all variants">
|
|
284
|
-
<View gap={3} direction="row">
|
|
285
|
-
<Button rounded icon={IconZap}>
|
|
286
|
-
Button
|
|
287
|
-
</Button>
|
|
288
|
-
<Button rounded variant="outline" icon={IconZap}>
|
|
289
|
-
Button
|
|
290
|
-
</Button>
|
|
291
|
-
<Button rounded variant="ghost" icon={IconZap}>
|
|
292
|
-
Button
|
|
293
|
-
</Button>
|
|
294
|
-
</View>
|
|
295
|
-
</Example.Item>
|
|
296
|
-
<Example.Item title="rounded, size: large, all variants">
|
|
297
|
-
<View gap={3} direction="row">
|
|
298
|
-
<Button rounded size="large" icon={IconZap}>
|
|
299
|
-
Button
|
|
300
|
-
</Button>
|
|
301
|
-
<Button rounded variant="outline" size="large" icon={IconZap}>
|
|
302
|
-
Button
|
|
303
|
-
</Button>
|
|
304
|
-
<Button rounded variant="ghost" size="large" icon={IconZap}>
|
|
305
|
-
Button
|
|
306
|
-
</Button>
|
|
307
|
-
</View>
|
|
308
|
-
</Example.Item>
|
|
309
|
-
<Example.Item title="rounded, icon only, all sizes">
|
|
310
|
-
<View gap={3} direction="row">
|
|
311
|
-
<Button rounded size="small" icon={IconZap}/>
|
|
312
|
-
<Button rounded icon={IconZap}/>
|
|
313
|
-
<Button rounded size="large" icon={IconZap}/>
|
|
314
|
-
</View>
|
|
315
|
-
</Example.Item>
|
|
316
|
-
</Example>),
|
|
317
|
-
};
|
|
318
|
-
export const fullWidth = {
|
|
319
|
-
name: "fullWidth",
|
|
320
|
-
render: () => (<Example>
|
|
321
|
-
<Example.Item title="fullWidth, all variants">
|
|
322
|
-
<View gap={3}>
|
|
323
|
-
<Button fullWidth>Neutral</Button>
|
|
324
|
-
<Button fullWidth variant="faded">
|
|
325
|
-
Faded
|
|
326
|
-
</Button>
|
|
327
|
-
<Button fullWidth variant="outline">
|
|
328
|
-
Outline
|
|
329
|
-
</Button>
|
|
330
|
-
<Button fullWidth variant="ghost">
|
|
331
|
-
Ghost
|
|
332
|
-
</Button>
|
|
333
|
-
</View>
|
|
334
|
-
</Example.Item>
|
|
335
|
-
|
|
336
|
-
<Example.Item title={["responsive fullWidth", "[s] true", "[m+] false"]}>
|
|
337
|
-
<Button fullWidth={{ s: true, m: false }}>Button</Button>
|
|
338
|
-
</Example.Item>
|
|
339
|
-
</Example>),
|
|
340
|
-
};
|
|
341
|
-
export const loading = {
|
|
342
|
-
name: "loading",
|
|
343
|
-
render: () => (<Example>
|
|
344
|
-
<Example.Item title="loading, color: neutral, all variants">
|
|
345
|
-
<View gap={3} direction="row">
|
|
346
|
-
<Button loading loadingAriaLabel="Loading">
|
|
347
|
-
Button
|
|
348
|
-
</Button>
|
|
349
|
-
<Button loading loadingAriaLabel="Loading" variant="faded">
|
|
350
|
-
Button
|
|
351
|
-
</Button>
|
|
352
|
-
<Button loading loadingAriaLabel="Loading" variant="outline">
|
|
353
|
-
Button
|
|
354
|
-
</Button>
|
|
355
|
-
<Button loading loadingAriaLabel="Loading" variant="ghost">
|
|
356
|
-
Button
|
|
357
|
-
</Button>
|
|
358
|
-
</View>
|
|
359
|
-
</Example.Item>
|
|
360
|
-
<Example.Item title="loading, color critical, all variants">
|
|
361
|
-
<View gap={3} direction="row">
|
|
362
|
-
<Button loading loadingAriaLabel="Loading" color="critical">
|
|
363
|
-
Button
|
|
364
|
-
</Button>
|
|
365
|
-
<Button loading loadingAriaLabel="Loading" color="critical" variant="faded">
|
|
366
|
-
Button
|
|
367
|
-
</Button>
|
|
368
|
-
<Button loading loadingAriaLabel="Loading" color="critical" variant="outline">
|
|
369
|
-
Button
|
|
370
|
-
</Button>
|
|
371
|
-
<Button loading loadingAriaLabel="Loading" color="critical" variant="ghost">
|
|
372
|
-
Button
|
|
373
|
-
</Button>
|
|
374
|
-
</View>
|
|
375
|
-
</Example.Item>
|
|
376
|
-
<Example.Item title="loading, color positive, all variants">
|
|
377
|
-
<View gap={3} direction="row">
|
|
378
|
-
<Button loading loadingAriaLabel="Loading" color="positive">
|
|
379
|
-
Button
|
|
380
|
-
</Button>
|
|
381
|
-
<Button loading loadingAriaLabel="Loading" color="positive" variant="faded">
|
|
382
|
-
Button
|
|
383
|
-
</Button>
|
|
384
|
-
<Button loading loadingAriaLabel="Loading" color="positive" variant="outline">
|
|
385
|
-
Button
|
|
386
|
-
</Button>
|
|
387
|
-
<Button loading loadingAriaLabel="Loading" color="positive" variant="ghost">
|
|
388
|
-
Button
|
|
389
|
-
</Button>
|
|
390
|
-
</View>
|
|
391
|
-
</Example.Item>
|
|
392
|
-
|
|
393
|
-
<Example.Item title="loading, color: media">
|
|
394
|
-
<View aspectRatio={16 / 9}>
|
|
395
|
-
<Image src={imgUrl}/>
|
|
396
|
-
|
|
397
|
-
<div style={{ position: "absolute", top: 16, left: 16 }}>
|
|
398
|
-
<View gap={3} direction="row">
|
|
399
|
-
<Button color="media" loading loadingAriaLabel="Loading">
|
|
400
|
-
Button
|
|
401
|
-
</Button>
|
|
402
|
-
<Button color="media" variant="faded" loading loadingAriaLabel="Loading">
|
|
403
|
-
Button
|
|
404
|
-
</Button>
|
|
405
|
-
</View>
|
|
406
|
-
</div>
|
|
407
|
-
</View>
|
|
408
|
-
</Example.Item>
|
|
409
|
-
|
|
410
|
-
<Example.Item title={["loading, long button text", "button size should stay the same"]}>
|
|
411
|
-
<Button loading loadingAriaLabel="Loading" color="primary">
|
|
412
|
-
Long button text
|
|
413
|
-
</Button>
|
|
414
|
-
</Example.Item>
|
|
415
|
-
|
|
416
|
-
<Example.Item title={["loading, icon only", "button keep square 1/1 ratio"]}>
|
|
417
|
-
<Button icon={IconZap} rounded loading loadingAriaLabel="Loading"/>
|
|
418
|
-
</Example.Item>
|
|
419
|
-
</Example>),
|
|
420
|
-
};
|
|
421
|
-
export const highlighted = {
|
|
422
|
-
name: "highlighted",
|
|
423
|
-
render: () => (<Example>
|
|
424
|
-
<Example.Item title="highlighted, color: neutral, all variants">
|
|
425
|
-
<View gap={3} direction="row">
|
|
426
|
-
<Button highlighted icon={IconZap}>
|
|
427
|
-
Button
|
|
428
|
-
</Button>
|
|
429
|
-
<Button highlighted variant="faded" icon={IconZap}>
|
|
430
|
-
Button
|
|
431
|
-
</Button>
|
|
432
|
-
<Button highlighted variant="outline" icon={IconZap}>
|
|
433
|
-
Button
|
|
434
|
-
</Button>
|
|
435
|
-
<Button highlighted variant="ghost" icon={IconZap}>
|
|
436
|
-
Button
|
|
437
|
-
</Button>
|
|
438
|
-
</View>
|
|
439
|
-
</Example.Item>
|
|
440
|
-
<Example.Item title="highlighted, color: critical, all variants">
|
|
441
|
-
<View gap={3} direction="row">
|
|
442
|
-
<Button highlighted color="critical" icon={IconZap}>
|
|
443
|
-
Button
|
|
444
|
-
</Button>
|
|
445
|
-
<Button highlighted color="critical" variant="faded" icon={IconZap}>
|
|
446
|
-
Button
|
|
447
|
-
</Button>
|
|
448
|
-
<Button highlighted color="critical" variant="outline" icon={IconZap}>
|
|
449
|
-
Button
|
|
450
|
-
</Button>
|
|
451
|
-
<Button highlighted color="critical" variant="ghost" icon={IconZap}>
|
|
452
|
-
Button
|
|
453
|
-
</Button>
|
|
454
|
-
</View>
|
|
455
|
-
</Example.Item>
|
|
456
|
-
<Example.Item title="highlighted, color: positive, all variants">
|
|
457
|
-
<View gap={3} direction="row">
|
|
458
|
-
<Button highlighted color="positive" icon={IconZap}>
|
|
459
|
-
Button
|
|
460
|
-
</Button>
|
|
461
|
-
<Button highlighted color="positive" variant="faded" icon={IconZap}>
|
|
462
|
-
Button
|
|
463
|
-
</Button>
|
|
464
|
-
<Button highlighted color="positive" variant="outline" icon={IconZap}>
|
|
465
|
-
Button
|
|
466
|
-
</Button>
|
|
467
|
-
<Button highlighted color="positive" variant="ghost" icon={IconZap}>
|
|
468
|
-
Button
|
|
469
|
-
</Button>
|
|
470
|
-
</View>
|
|
471
|
-
</Example.Item>
|
|
472
|
-
</Example>),
|
|
473
|
-
};
|
|
474
|
-
export const disabled = {
|
|
475
|
-
name: "disabled",
|
|
476
|
-
render: () => (<Example>
|
|
477
|
-
<Example.Item title="disabled, color: neutral, all variants">
|
|
478
|
-
<View gap={3} direction="row">
|
|
479
|
-
<Button disabled icon={IconZap} onClick={() => { }}>
|
|
480
|
-
Button
|
|
481
|
-
</Button>
|
|
482
|
-
<Button disabled variant="faded" icon={IconZap}>
|
|
483
|
-
Button
|
|
484
|
-
</Button>
|
|
485
|
-
<Button disabled variant="outline" icon={IconZap}>
|
|
486
|
-
Button
|
|
487
|
-
</Button>
|
|
488
|
-
<Button disabled variant="ghost" icon={IconZap}>
|
|
489
|
-
Button
|
|
490
|
-
</Button>
|
|
491
|
-
</View>
|
|
492
|
-
</Example.Item>
|
|
493
|
-
<Example.Item title="disabled, color: critical, all variants">
|
|
494
|
-
<View gap={3} direction="row">
|
|
495
|
-
<Button disabled color="critical" icon={IconZap}>
|
|
496
|
-
Button
|
|
497
|
-
</Button>
|
|
498
|
-
<Button disabled color="critical" variant="faded" icon={IconZap}>
|
|
499
|
-
Button
|
|
500
|
-
</Button>
|
|
501
|
-
<Button disabled color="critical" variant="outline" icon={IconZap}>
|
|
502
|
-
Button
|
|
503
|
-
</Button>
|
|
504
|
-
<Button disabled color="critical" variant="ghost" icon={IconZap}>
|
|
505
|
-
Button
|
|
506
|
-
</Button>
|
|
507
|
-
</View>
|
|
508
|
-
</Example.Item>
|
|
509
|
-
<Example.Item title="disabled, color: positive, all variants">
|
|
510
|
-
<View gap={3} direction="row">
|
|
511
|
-
<Button disabled color="positive" icon={IconZap}>
|
|
512
|
-
Button
|
|
513
|
-
</Button>
|
|
514
|
-
<Button disabled color="positive" variant="faded" icon={IconZap}>
|
|
515
|
-
Button
|
|
516
|
-
</Button>
|
|
517
|
-
<Button disabled color="positive" variant="outline" icon={IconZap}>
|
|
518
|
-
Button
|
|
519
|
-
</Button>
|
|
520
|
-
<Button disabled color="positive" variant="ghost" icon={IconZap}>
|
|
521
|
-
Button
|
|
522
|
-
</Button>
|
|
523
|
-
</View>
|
|
524
|
-
</Example.Item>
|
|
525
|
-
|
|
526
|
-
<Example.Item title="disabled, color: media">
|
|
527
|
-
<View aspectRatio={16 / 9}>
|
|
528
|
-
<Image src={imgUrl}/>
|
|
529
|
-
|
|
530
|
-
<div style={{ position: "absolute", top: 16, left: 16 }}>
|
|
531
|
-
<View gap={3} direction="row">
|
|
532
|
-
<Button color="media" disabled>
|
|
533
|
-
Button
|
|
534
|
-
</Button>
|
|
535
|
-
<Button color="media" variant="faded" disabled>
|
|
536
|
-
Button
|
|
537
|
-
</Button>
|
|
538
|
-
</View>
|
|
539
|
-
</div>
|
|
540
|
-
</View>
|
|
541
|
-
</Example.Item>
|
|
542
|
-
</Example>),
|
|
543
|
-
play: ({ canvas }) => {
|
|
544
|
-
const el = canvas.getAllByRole("button")[0];
|
|
545
|
-
expect(el).toBeDisabled();
|
|
546
|
-
},
|
|
547
|
-
};
|
|
548
|
-
export const aligner = {
|
|
549
|
-
name: "aligner",
|
|
550
|
-
render: () => (<Example>
|
|
551
|
-
<Example.Item title="aligner: all">
|
|
552
|
-
<View padding={4} borderColor="neutral-faded" direction="row" gap={2}>
|
|
553
|
-
<View.Item grow>Content</View.Item>
|
|
554
|
-
<Button.Aligner>
|
|
555
|
-
<Button icon={IconZap} variant="ghost"/>
|
|
556
|
-
</Button.Aligner>
|
|
557
|
-
</View>
|
|
558
|
-
</Example.Item>
|
|
559
|
-
|
|
560
|
-
<Example.Item title="aligner: top">
|
|
561
|
-
<View padding={4} borderColor="neutral-faded" direction="row" gap={2}>
|
|
562
|
-
<View.Item grow>
|
|
563
|
-
<Placeholder />
|
|
564
|
-
</View.Item>
|
|
565
|
-
<Button.Aligner side="top">
|
|
566
|
-
<Button icon={IconZap} variant="ghost"/>
|
|
567
|
-
</Button.Aligner>
|
|
568
|
-
</View>
|
|
569
|
-
</Example.Item>
|
|
570
|
-
|
|
571
|
-
<Example.Item title="aligner: top and end">
|
|
572
|
-
<View padding={4} borderColor="neutral-faded" direction="row" gap={2}>
|
|
573
|
-
<View.Item grow>
|
|
574
|
-
<Placeholder />
|
|
575
|
-
</View.Item>
|
|
576
|
-
<Button.Aligner side={["top", "end"]}>
|
|
577
|
-
<Button icon={IconZap} variant="ghost"/>
|
|
578
|
-
</Button.Aligner>
|
|
579
|
-
</View>
|
|
580
|
-
</Example.Item>
|
|
581
|
-
|
|
582
|
-
<Example.Item title="aligner: bottom">
|
|
583
|
-
<View padding={4} borderColor="neutral-faded" direction="row" gap={2} align="end">
|
|
584
|
-
<View.Item grow>
|
|
585
|
-
<Placeholder />
|
|
586
|
-
</View.Item>
|
|
587
|
-
<Button.Aligner side="bottom">
|
|
588
|
-
<Button icon={IconZap} variant="ghost"/>
|
|
589
|
-
</Button.Aligner>
|
|
590
|
-
</View>
|
|
591
|
-
</Example.Item>
|
|
592
|
-
|
|
593
|
-
<Example.Item title="aligner: start">
|
|
594
|
-
<View padding={4} borderColor="neutral-faded" gap={2} align="start">
|
|
595
|
-
<View.Item grow>
|
|
596
|
-
<Placeholder />
|
|
597
|
-
</View.Item>
|
|
598
|
-
<Button.Aligner side="start">
|
|
599
|
-
<Button icon={IconZap} variant="ghost"/>
|
|
600
|
-
</Button.Aligner>
|
|
601
|
-
</View>
|
|
602
|
-
</Example.Item>
|
|
603
|
-
|
|
604
|
-
<Example.Item title="aligner: end">
|
|
605
|
-
<View padding={4} borderColor="neutral-faded" gap={2} align="end">
|
|
606
|
-
<View.Item grow>
|
|
607
|
-
<Placeholder />
|
|
608
|
-
</View.Item>
|
|
609
|
-
<Button.Aligner side="end">
|
|
610
|
-
<Button icon={IconZap} variant="ghost"/>
|
|
611
|
-
</Button.Aligner>
|
|
612
|
-
</View>
|
|
613
|
-
</Example.Item>
|
|
614
|
-
</Example>),
|
|
615
|
-
};
|
|
616
|
-
export const composition = {
|
|
617
|
-
name: "test: composition",
|
|
618
|
-
render: () => (<Example>
|
|
619
|
-
<Example.Item title="slot gap">
|
|
620
|
-
<Button variant="outline">
|
|
621
|
-
<Avatar size={6} initials="RS"/>
|
|
622
|
-
Label
|
|
623
|
-
<Hotkey>B</Hotkey>
|
|
624
|
-
</Button>
|
|
625
|
-
</Example.Item>
|
|
626
|
-
</Example>),
|
|
627
|
-
};
|
|
628
|
-
export const href = {
|
|
629
|
-
name: "href",
|
|
630
|
-
render: () => <Button href="https://reshaped.so">Trigger</Button>,
|
|
631
|
-
play: async ({ canvas }) => {
|
|
632
|
-
const el = canvas.getByRole("link");
|
|
633
|
-
expect(el).toHaveAttribute("href", "https://reshaped.so");
|
|
634
|
-
},
|
|
635
|
-
};
|
|
636
|
-
export const onClick = {
|
|
637
|
-
name: "onClick",
|
|
638
|
-
args: {
|
|
639
|
-
handleClick: fn(),
|
|
640
|
-
},
|
|
641
|
-
render: (args) => <Button onClick={args.handleClick}>Trigger</Button>,
|
|
642
|
-
play: async ({ canvas, args }) => {
|
|
643
|
-
const { handleClick } = args;
|
|
644
|
-
const el = canvas.getAllByRole("button")[0];
|
|
645
|
-
await userEvent.click(el);
|
|
646
|
-
expect(el).toHaveAttribute("type", "button");
|
|
647
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
648
|
-
expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
|
|
649
|
-
},
|
|
650
|
-
};
|
|
651
|
-
export const hrefOnClick = {
|
|
652
|
-
name: "href, onClick",
|
|
653
|
-
args: {
|
|
654
|
-
handleClick: fn(),
|
|
655
|
-
},
|
|
656
|
-
render: (args) => (<Button onClick={(e) => {
|
|
657
|
-
e.preventDefault();
|
|
658
|
-
args.handleClick(e);
|
|
659
|
-
}} href="https://reshaped.so">
|
|
660
|
-
Trigger
|
|
661
|
-
</Button>),
|
|
662
|
-
play: async ({ canvas, args }) => {
|
|
663
|
-
const { handleClick } = args;
|
|
664
|
-
const el = canvas.getByRole("link");
|
|
665
|
-
await userEvent.click(el);
|
|
666
|
-
expect(el).toHaveAttribute("href", "https://reshaped.so");
|
|
667
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
668
|
-
expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
|
|
669
|
-
},
|
|
670
|
-
};
|
|
671
|
-
export const as = {
|
|
672
|
-
name: "as",
|
|
673
|
-
render: () => (<Example>
|
|
674
|
-
<Example.Item title="as: span">
|
|
675
|
-
<Button onClick={() => { }} as="span">
|
|
676
|
-
Trigger
|
|
677
|
-
</Button>
|
|
678
|
-
</Example.Item>
|
|
679
|
-
<Example.Item title="render, disabled">
|
|
680
|
-
<Button disabled onClick={() => { }} render={(props) => <section {...props}/>} attributes={{ "data-testid": "render-el" }}>
|
|
681
|
-
Trigger
|
|
682
|
-
</Button>
|
|
683
|
-
</Example.Item>
|
|
684
|
-
</Example>),
|
|
685
|
-
play: ({ canvas }) => {
|
|
686
|
-
const [asEl] = canvas.getAllByText("Trigger");
|
|
687
|
-
const renderEl = canvas.getByTestId("render-el");
|
|
688
|
-
expect(asEl.tagName).toBe("SPAN");
|
|
689
|
-
expect(renderEl.tagName).toBe("SECTION");
|
|
690
|
-
expect(renderEl).toHaveAttribute("aria-disabled", "true");
|
|
691
|
-
},
|
|
692
|
-
};
|
|
693
|
-
export const className = {
|
|
694
|
-
name: "className, attributes",
|
|
695
|
-
render: () => (<div data-testid="root">
|
|
696
|
-
<Button className="test-classname" attributes={{ id: "test-id" }}>
|
|
697
|
-
Trigger
|
|
698
|
-
</Button>
|
|
699
|
-
</div>),
|
|
700
|
-
play: async ({ canvas }) => {
|
|
701
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
702
|
-
expect(root).toHaveClass("test-classname");
|
|
703
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
704
|
-
},
|
|
705
|
-
};
|
|
706
|
-
export const group = {
|
|
707
|
-
name: "group",
|
|
708
|
-
render: () => (<Example>
|
|
709
|
-
<Example.Item title="with icon">
|
|
710
|
-
<Button.Group>
|
|
711
|
-
<Button rounded>Submit</Button>
|
|
712
|
-
<Button rounded icon={IconZap}/>
|
|
713
|
-
</Button.Group>
|
|
714
|
-
</Example.Item>
|
|
715
|
-
<Example.Item title="variant: solid">
|
|
716
|
-
<View gap={2}>
|
|
717
|
-
{["neutral", "primary", "critical", "positive", "media"].map((color) => (<Button.Group key={color}>
|
|
718
|
-
<Button color={color}>One</Button>
|
|
719
|
-
<Button color={color}>Two</Button>
|
|
720
|
-
<Button color={color}>Three</Button>
|
|
721
|
-
</Button.Group>))}
|
|
722
|
-
</View>
|
|
723
|
-
</Example.Item>
|
|
724
|
-
<Example.Item title="variant: outline">
|
|
725
|
-
<View gap={2}>
|
|
726
|
-
{["neutral", "primary", "critical", "positive"].map((color) => (<Button.Group key={color}>
|
|
727
|
-
<Button color={color} variant="outline">
|
|
728
|
-
One
|
|
729
|
-
</Button>
|
|
730
|
-
<Button color={color} variant="outline">
|
|
731
|
-
Two
|
|
732
|
-
</Button>
|
|
733
|
-
<Button color={color} variant="outline">
|
|
734
|
-
Three
|
|
735
|
-
</Button>
|
|
736
|
-
</Button.Group>))}
|
|
737
|
-
</View>
|
|
738
|
-
</Example.Item>
|
|
739
|
-
<Example.Item title="variant: faded">
|
|
740
|
-
<View gap={2}>
|
|
741
|
-
{["neutral", "primary", "critical", "positive", "media"].map((color) => (<Button.Group key={color}>
|
|
742
|
-
<Button color={color} variant="faded">
|
|
743
|
-
One
|
|
744
|
-
</Button>
|
|
745
|
-
<Button color={color} variant="faded">
|
|
746
|
-
Two
|
|
747
|
-
</Button>
|
|
748
|
-
<Button color={color} variant="faded">
|
|
749
|
-
Three
|
|
750
|
-
</Button>
|
|
751
|
-
</Button.Group>))}
|
|
752
|
-
</View>
|
|
753
|
-
</Example.Item>
|
|
754
|
-
|
|
755
|
-
<Example.Item title="variant: ghost">
|
|
756
|
-
<View gap={2}>
|
|
757
|
-
{["neutral", "primary", "critical", "positive"].map((color) => (<Button.Group key={color}>
|
|
758
|
-
<Button color={color} variant="ghost">
|
|
759
|
-
One
|
|
760
|
-
</Button>
|
|
761
|
-
<Button color={color} variant="ghost">
|
|
762
|
-
Two
|
|
763
|
-
</Button>
|
|
764
|
-
<Button color={color} variant="ghost">
|
|
765
|
-
Three
|
|
766
|
-
</Button>
|
|
767
|
-
</Button.Group>))}
|
|
768
|
-
</View>
|
|
769
|
-
</Example.Item>
|
|
770
|
-
</Example>),
|
|
771
|
-
play: async ({ canvas }) => {
|
|
772
|
-
const [el] = canvas.getAllByRole("group");
|
|
773
|
-
expect(el).toBeInTheDocument();
|
|
774
|
-
expect(el.childElementCount).toEqual(2);
|
|
775
|
-
},
|
|
776
|
-
};
|
|
777
|
-
export const groupClassName = {
|
|
778
|
-
name: "group className, attributes",
|
|
779
|
-
render: () => (<div data-testid="root">
|
|
780
|
-
<Button.Group className="test-classname" attributes={{ id: "test-id" }}>
|
|
781
|
-
<Button>Trigger</Button>
|
|
782
|
-
</Button.Group>
|
|
783
|
-
</div>),
|
|
784
|
-
play: async ({ canvas }) => {
|
|
785
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
786
|
-
expect(root).toHaveClass("test-classname");
|
|
787
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
788
|
-
},
|
|
789
|
-
};
|