reshaped 3.9.0-canary.0 → 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 +10 -10
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Card/Card.module.css +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +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/FlyoutControlled.js +6 -8
- package/dist/components/Flyout/utilities/cooldown.js +1 -2
- package/dist/components/Icon/Icon.module.css +1 -1
- package/dist/components/Progress/Progress.module.css +1 -1
- package/dist/components/Reshaped/Reshaped.css +1 -1
- package/dist/components/Text/Text.module.css +1 -1
- package/dist/components/Theme/Theme.module.css +1 -1
- package/dist/hooks/useOnClickOutside.js +2 -4
- package/dist/themes/_generator/tokens/css.js +2 -2
- package/dist/themes/figma/theme.css +1 -1
- package/dist/themes/fragments/twitter/theme.css +1 -1
- package/dist/themes/reshaped/theme.css +1 -1
- package/dist/themes/slate/theme.css +1 -1
- package/package.json +40 -35
- package/dist/components/Accordion/tests/Accordion.stories.d.ts +0 -44
- package/dist/components/Accordion/tests/Accordion.stories.js +0 -204
- package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +0 -40
- package/dist/components/ActionBar/tests/ActionBar.stories.js +0 -223
- package/dist/components/Actionable/tests/Actionable.stories.d.ts +0 -41
- package/dist/components/Actionable/tests/Actionable.stories.js +0 -220
- package/dist/components/Alert/tests/Alert.stories.d.ts +0 -24
- package/dist/components/Alert/tests/Alert.stories.js +0 -78
- package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +0 -32
- package/dist/components/Autocomplete/tests/Autocomplete.stories.js +0 -246
- package/dist/components/Avatar/tests/Avatar.stories.d.ts +0 -31
- package/dist/components/Avatar/tests/Avatar.stories.js +0 -176
- package/dist/components/Badge/tests/Badge.stories.d.ts +0 -55
- package/dist/components/Badge/tests/Badge.stories.js +0 -328
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +0 -40
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +0 -187
- package/dist/components/Button/tests/Button.stories.d.ts +0 -79
- package/dist/components/Button/tests/Button.stories.js +0 -789
- package/dist/components/Calendar/tests/Calendar.stories.d.ts +0 -29
- package/dist/components/Calendar/tests/Calendar.stories.js +0 -255
- package/dist/components/Card/tests/Card.stories.d.ts +0 -52
- package/dist/components/Card/tests/Card.stories.js +0 -125
- package/dist/components/Carousel/tests/Carousel.stories.d.ts +0 -34
- package/dist/components/Carousel/tests/Carousel.stories.js +0 -224
- package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +0 -30
- package/dist/components/Checkbox/tests/Checkbox.stories.js +0 -171
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +0 -19
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +0 -83
- package/dist/components/Container/tests/Container.stories.d.ts +0 -24
- package/dist/components/Container/tests/Container.stories.js +0 -75
- package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +0 -26
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +0 -70
- package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +0 -25
- package/dist/components/Dismissible/tests/Dismissible.stories.js +0 -97
- package/dist/components/Divider/tests/Divider.stories.d.ts +0 -20
- package/dist/components/Divider/tests/Divider.stories.js +0 -120
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +0 -53
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +0 -278
- package/dist/components/FileUpload/tests/FileUpload.stories.d.ts +0 -31
- package/dist/components/FileUpload/tests/FileUpload.stories.js +0 -140
- package/dist/components/Flyout/tests/Flyout.stories.d.ts +0 -103
- package/dist/components/Flyout/tests/Flyout.stories.js +0 -738
- package/dist/components/FormControl/tests/FormControl.stories.d.ts +0 -31
- package/dist/components/FormControl/tests/FormControl.stories.js +0 -143
- package/dist/components/Grid/tests/Grid.stories.d.ts +0 -38
- package/dist/components/Grid/tests/Grid.stories.js +0 -245
- package/dist/components/Hidden/tests/Hidden.stories.d.ts +0 -16
- package/dist/components/Hidden/tests/Hidden.stories.js +0 -48
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +0 -16
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +0 -28
- package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +0 -13
- package/dist/components/Hotkey/tests/Hotkey.stories.js +0 -53
- package/dist/components/Icon/tests/Icon.stories.d.ts +0 -25
- package/dist/components/Icon/tests/Icon.stories.js +0 -113
- package/dist/components/Image/tests/Image.stories.d.ts +0 -41
- package/dist/components/Image/tests/Image.stories.js +0 -196
- package/dist/components/Link/tests/Link.stories.d.ts +0 -42
- package/dist/components/Link/tests/Link.stories.js +0 -155
- package/dist/components/Loader/tests/Loader.stories.d.ts +0 -21
- package/dist/components/Loader/tests/Loader.stories.js +0 -68
- package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +0 -59
- package/dist/components/MenuItem/tests/MenuItem.stories.js +0 -236
- package/dist/components/Modal/tests/Modal.stories.d.ts +0 -64
- package/dist/components/Modal/tests/Modal.stories.js +0 -410
- package/dist/components/NumberField/tests/NumberField.stories.d.ts +0 -28
- package/dist/components/NumberField/tests/NumberField.stories.js +0 -258
- package/dist/components/Overlay/tests/Overlay.stories.d.ts +0 -28
- package/dist/components/Overlay/tests/Overlay.stories.js +0 -202
- package/dist/components/Pagination/tests/Pagination.stories.d.ts +0 -24
- package/dist/components/Pagination/tests/Pagination.stories.js +0 -105
- package/dist/components/PinField/tests/PinField.stories.d.ts +0 -34
- package/dist/components/PinField/tests/PinField.stories.js +0 -209
- package/dist/components/Popover/tests/Popover.stories.d.ts +0 -69
- package/dist/components/Popover/tests/Popover.stories.js +0 -340
- package/dist/components/Progress/tests/Progress.stories.d.ts +0 -30
- package/dist/components/Progress/tests/Progress.stories.js +0 -102
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.d.ts +0 -19
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +0 -92
- package/dist/components/Radio/tests/Radio.stories.d.ts +0 -35
- package/dist/components/Radio/tests/Radio.stories.js +0 -162
- package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +0 -19
- package/dist/components/RadioGroup/tests/RadioGroup.stories.js +0 -77
- package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +0 -34
- package/dist/components/Reshaped/tests/Reshaped.stories.js +0 -108
- package/dist/components/Resizable/tests/Resizable.stories.d.ts +0 -38
- package/dist/components/Resizable/tests/Resizable.stories.js +0 -185
- package/dist/components/Scrim/tests/Scrim.stories.d.ts +0 -20
- package/dist/components/Scrim/tests/Scrim.stories.js +0 -67
- package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +0 -37
- package/dist/components/ScrollArea/tests/ScrollArea.stories.js +0 -244
- package/dist/components/Select/tests/Select.stories.d.ts +0 -53
- package/dist/components/Select/tests/Select.stories.js +0 -616
- package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +0 -20
- package/dist/components/Skeleton/tests/Skeleton.stories.js +0 -63
- package/dist/components/Slider/tests/Slider.stories.d.ts +0 -47
- package/dist/components/Slider/tests/Slider.stories.js +0 -279
- package/dist/components/Stepper/tests/Stepper.stories.d.ts +0 -31
- package/dist/components/Stepper/tests/Stepper.stories.js +0 -135
- package/dist/components/Switch/tests/Switch.stories.d.ts +0 -22
- package/dist/components/Switch/tests/Switch.stories.js +0 -137
- package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -13
- package/dist/components/Switch/tests/Switch.test.stories.js +0 -11
- package/dist/components/Table/tests/Table.stories.d.ts +0 -42
- package/dist/components/Table/tests/Table.stories.js +0 -348
- package/dist/components/Tabs/tests/Tabs.stories.d.ts +0 -62
- package/dist/components/Tabs/tests/Tabs.stories.js +0 -539
- package/dist/components/Text/tests/Text.stories.d.ts +0 -48
- package/dist/components/Text/tests/Text.stories.js +0 -201
- package/dist/components/TextArea/tests/TextArea.stories.d.ts +0 -53
- package/dist/components/TextArea/tests/TextArea.stories.js +0 -204
- package/dist/components/TextField/tests/TextField.stories.d.ts +0 -54
- package/dist/components/TextField/tests/TextField.stories.js +0 -252
- package/dist/components/Theme/tests/Theme.stories.d.ts +0 -25
- package/dist/components/Theme/tests/Theme.stories.js +0 -171
- package/dist/components/Timeline/tests/Timeline.stories.d.ts +0 -22
- package/dist/components/Timeline/tests/Timeline.stories.js +0 -86
- package/dist/components/Toast/tests/Toast.stories.d.ts +0 -41
- package/dist/components/Toast/tests/Toast.stories.js +0 -432
- package/dist/components/ToggleButton/tests/ToggleButton.stories.d.ts +0 -27
- package/dist/components/ToggleButton/tests/ToggleButton.stories.js +0 -97
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.d.ts +0 -27
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.js +0 -169
- package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +0 -28
- package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -182
- package/dist/components/View/tests/View.stories.d.ts +0 -141
- package/dist/components/View/tests/View.stories.js +0 -1329
- package/dist/components/_private/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,252 +0,0 @@
|
|
|
1
|
-
import { Example, Placeholder } from "../../../utilities/storybook/index.js";
|
|
2
|
-
import IconZap from "../../../icons/Zap.js";
|
|
3
|
-
import TextField from "../index.js";
|
|
4
|
-
import FormControl from "../../FormControl/index.js";
|
|
5
|
-
import View from "../../View/index.js";
|
|
6
|
-
import Text from "../../Text/index.js";
|
|
7
|
-
import Button from "../../Button/index.js";
|
|
8
|
-
import Badge from "../../Badge/index.js";
|
|
9
|
-
import Select from "../../Select/index.js";
|
|
10
|
-
import { expect, fn, userEvent } from "storybook/test";
|
|
11
|
-
import Divider from "../../Divider/index.js";
|
|
12
|
-
export default {
|
|
13
|
-
title: "Components/TextField",
|
|
14
|
-
component: TextField,
|
|
15
|
-
parameters: {
|
|
16
|
-
iframe: {
|
|
17
|
-
url: "https://reshaped.so/docs/components/text-field",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
export const variant = {
|
|
22
|
-
name: "variant",
|
|
23
|
-
render: () => (<Example>
|
|
24
|
-
<Example.Item title="variant: faded">
|
|
25
|
-
<TextField variant="faded" name="Name" placeholder="Enter your name"/>
|
|
26
|
-
</Example.Item>
|
|
27
|
-
|
|
28
|
-
<Example.Item title="variant: headless">
|
|
29
|
-
<TextField variant="ghost" name="Name" placeholder="Enter your name"/>
|
|
30
|
-
</Example.Item>
|
|
31
|
-
|
|
32
|
-
<Example.Item title="variant: headless">
|
|
33
|
-
<TextField variant="headless" name="Name" placeholder="Enter your name"/>
|
|
34
|
-
</Example.Item>
|
|
35
|
-
</Example>),
|
|
36
|
-
};
|
|
37
|
-
export const rounded = {
|
|
38
|
-
name: "rounded",
|
|
39
|
-
render: () => (<Example>
|
|
40
|
-
<Example.Item title="rounded">
|
|
41
|
-
<TextField rounded name="Name" placeholder="Enter your name" icon={IconZap} prefix="+31" endSlot={<Button rounded size="small" icon={IconZap}/>}/>
|
|
42
|
-
</Example.Item>
|
|
43
|
-
|
|
44
|
-
<Example.Item title="rounded, variant: faded">
|
|
45
|
-
<View direction="row" gap={2}>
|
|
46
|
-
<View.Item grow>
|
|
47
|
-
<TextField rounded variant="faded" name="Name" placeholder="Enter your name" startSlot={<Badge rounded size="small">
|
|
48
|
-
Hello
|
|
49
|
-
</Badge>}/>
|
|
50
|
-
</View.Item>
|
|
51
|
-
<Button rounded>Submit</Button>
|
|
52
|
-
</View>
|
|
53
|
-
</Example.Item>
|
|
54
|
-
</Example>),
|
|
55
|
-
};
|
|
56
|
-
export const error = {
|
|
57
|
-
name: "hasError",
|
|
58
|
-
render: () => (<Example>
|
|
59
|
-
<Example.Item title="error">
|
|
60
|
-
<TextField name="Name" placeholder="Enter your name" hasError/>
|
|
61
|
-
</Example.Item>
|
|
62
|
-
</Example>),
|
|
63
|
-
};
|
|
64
|
-
export const attachments = {
|
|
65
|
-
name: "icon, endIcon, suffix, prefix, startSlot, endSlot, startSlotPadding, endSlotPadding",
|
|
66
|
-
render: () => (<Example>
|
|
67
|
-
<Example.Item title="icon">
|
|
68
|
-
<TextField name="Name" placeholder="Enter your name" value="Reshaped" icon={IconZap}/>
|
|
69
|
-
</Example.Item>
|
|
70
|
-
<Example.Item title="endIcon">
|
|
71
|
-
<TextField name="Name" placeholder="Enter your name" value="Reshaped" endIcon={IconZap}/>
|
|
72
|
-
</Example.Item>
|
|
73
|
-
|
|
74
|
-
<Example.Item title={["startSlot", "vertical and horizontal padding aligned"]}>
|
|
75
|
-
<TextField name="Name" placeholder="Enter your name" value="Reshaped" startSlot={<Placeholder h={20}/>}/>
|
|
76
|
-
</Example.Item>
|
|
77
|
-
|
|
78
|
-
<Example.Item title={["endSlot", "vertical and horizontal padding aligned"]}>
|
|
79
|
-
<TextField name="Name" placeholder="Enter your name" value="Reshaped" endSlot={<Button icon={IconZap} size="small" onClick={() => { }} attributes={{ "aria-label": "Action" }}/>}/>
|
|
80
|
-
</Example.Item>
|
|
81
|
-
|
|
82
|
-
<Example.Item title="paddingSlotStart=4, paddingSlotEnd=2">
|
|
83
|
-
<TextField name="Name" placeholder="Enter your name" value="Reshaped" startSlotPadding={4} endSlotPadding={2} startSlot={<Placeholder h={20}/>} endSlot={<Placeholder h={20}/>}/>
|
|
84
|
-
</Example.Item>
|
|
85
|
-
|
|
86
|
-
<Example.Item title="with all affixes">
|
|
87
|
-
<TextField name="Name" placeholder="Enter your name" value="Reshaped" endIcon={IconZap} icon={IconZap} prefix="Estimated value" suffix="m2" startSlot={<Placeholder h={20}/>} endSlot={<Placeholder h={20}/>}/>
|
|
88
|
-
</Example.Item>
|
|
89
|
-
|
|
90
|
-
<Example.Item title="multiline wrap">
|
|
91
|
-
<TextField name="Name" placeholder="Enter your name" value="Reshaped" startSlot={[...Array(10).keys()].map((i) => (<Badge size="small" key={i}>
|
|
92
|
-
Item {i + 1}
|
|
93
|
-
</Badge>))} multiline/>
|
|
94
|
-
</Example.Item>
|
|
95
|
-
</Example>),
|
|
96
|
-
};
|
|
97
|
-
export const size = {
|
|
98
|
-
name: "size",
|
|
99
|
-
render: () => (<Example>
|
|
100
|
-
<Example.Item title="size: small">
|
|
101
|
-
<TextField name="Name" placeholder="Enter your name" size="small" icon={IconZap}/>
|
|
102
|
-
</Example.Item>
|
|
103
|
-
|
|
104
|
-
<Example.Item title="size: medium">
|
|
105
|
-
<TextField name="Name" placeholder="Enter your name" size="medium" icon={IconZap}/>
|
|
106
|
-
</Example.Item>
|
|
107
|
-
|
|
108
|
-
<Example.Item title="size: large">
|
|
109
|
-
<TextField name="Name" placeholder="Enter your name" size="large" icon={IconZap}/>
|
|
110
|
-
</Example.Item>
|
|
111
|
-
|
|
112
|
-
<Example.Item title="size: xlarge">
|
|
113
|
-
<TextField name="Name" placeholder="Enter your name" size="xlarge" icon={IconZap}/>
|
|
114
|
-
</Example.Item>
|
|
115
|
-
|
|
116
|
-
<Example.Item title={["responsive size", "[s] xlarge", "[m+] medium"]}>
|
|
117
|
-
<TextField name="Name" placeholder="Enter your name" size={{ s: "xlarge", m: "medium" }} icon={IconZap}/>
|
|
118
|
-
</Example.Item>
|
|
119
|
-
</Example>),
|
|
120
|
-
};
|
|
121
|
-
export const aligner = {
|
|
122
|
-
name: "aligner",
|
|
123
|
-
render: () => (<Example>
|
|
124
|
-
<Example.Item title="aligner">
|
|
125
|
-
<View gap={2}>
|
|
126
|
-
<Text variant="featured-2">What problem are you trying to solve?</Text>
|
|
127
|
-
<TextField.Aligner>
|
|
128
|
-
<TextField variant="headless" placeholder="Try something like 'I have a job'" name="description"/>
|
|
129
|
-
</TextField.Aligner>
|
|
130
|
-
<View.Item>
|
|
131
|
-
<Button>Next</Button>
|
|
132
|
-
</View.Item>
|
|
133
|
-
</View>
|
|
134
|
-
</Example.Item>
|
|
135
|
-
</Example>),
|
|
136
|
-
};
|
|
137
|
-
export const render = {
|
|
138
|
-
name: "base",
|
|
139
|
-
render: () => <TextField name="test-name" inputAttributes={{ "aria-label": "Label" }}/>,
|
|
140
|
-
play: async ({ canvas }) => {
|
|
141
|
-
const input = canvas.getByRole("textbox");
|
|
142
|
-
expect(input).toHaveAttribute("name", "test-name");
|
|
143
|
-
expect(input).toHaveAccessibleName("Label");
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
export const placeholder = {
|
|
147
|
-
name: "placeholder",
|
|
148
|
-
render: () => (<TextField name="test-name" placeholder="Placeholder" inputAttributes={{ "aria-label": "Label" }}/>),
|
|
149
|
-
play: async ({ canvas }) => {
|
|
150
|
-
const input = canvas.getByRole("textbox");
|
|
151
|
-
expect(input).toHaveValue("");
|
|
152
|
-
expect(input).toHaveAttribute("placeholder", "Placeholder");
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
export const id = {
|
|
156
|
-
name: "id",
|
|
157
|
-
render: () => (<TextField name="test-name" id="test-id" inputAttributes={{ "aria-label": "Label" }}/>),
|
|
158
|
-
play: async ({ canvas }) => {
|
|
159
|
-
const input = canvas.getByRole("textbox");
|
|
160
|
-
expect(input).toHaveAttribute("id", "test-id");
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
export const disabled = {
|
|
164
|
-
name: "disabled",
|
|
165
|
-
render: () => <TextField name="test-name" disabled inputAttributes={{ "aria-label": "Label" }}/>,
|
|
166
|
-
play: async ({ canvas }) => {
|
|
167
|
-
const input = canvas.getByRole("textbox");
|
|
168
|
-
expect(input).toBeDisabled();
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
export const defaultValue = {
|
|
172
|
-
name: "defaultValue, uncontrolled",
|
|
173
|
-
args: {
|
|
174
|
-
handleChange: fn(),
|
|
175
|
-
},
|
|
176
|
-
render: (args) => (<TextField name="test-name" defaultValue="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
|
177
|
-
play: async ({ canvas, args }) => {
|
|
178
|
-
const input = canvas.getByRole("textbox");
|
|
179
|
-
expect(input).toHaveValue("value");
|
|
180
|
-
input.focus();
|
|
181
|
-
await userEvent.keyboard("2");
|
|
182
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
|
183
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
|
184
|
-
name: "test-name",
|
|
185
|
-
value: "value2",
|
|
186
|
-
event: expect.objectContaining({ target: input }),
|
|
187
|
-
});
|
|
188
|
-
expect(input).toHaveValue("value2");
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
export const value = {
|
|
192
|
-
name: "value, controlled",
|
|
193
|
-
args: {
|
|
194
|
-
handleChange: fn(),
|
|
195
|
-
},
|
|
196
|
-
render: (args) => (<TextField name="test-name" value="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
|
197
|
-
play: async ({ canvas, args }) => {
|
|
198
|
-
const input = canvas.getByRole("textbox");
|
|
199
|
-
expect(input).toHaveValue("value");
|
|
200
|
-
input.focus();
|
|
201
|
-
await userEvent.keyboard("2");
|
|
202
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
|
203
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
|
204
|
-
name: "test-name",
|
|
205
|
-
value: "value2",
|
|
206
|
-
event: expect.objectContaining({ target: input }),
|
|
207
|
-
});
|
|
208
|
-
expect(input).toHaveValue("value");
|
|
209
|
-
},
|
|
210
|
-
};
|
|
211
|
-
export const className = {
|
|
212
|
-
name: "className, attributes",
|
|
213
|
-
render: () => (<div data-testid="root">
|
|
214
|
-
<TextField className="test-classname" attributes={{ id: "test-id" }} name="name" inputAttributes={{ id: "test-input-id", "aria-label": "Label" }}/>
|
|
215
|
-
</div>),
|
|
216
|
-
play: async ({ canvas }) => {
|
|
217
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
218
|
-
const input = canvas.getByRole("textbox");
|
|
219
|
-
expect(root).toHaveClass("test-classname");
|
|
220
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
221
|
-
expect(input).toHaveAttribute("id", "test-input-id");
|
|
222
|
-
},
|
|
223
|
-
};
|
|
224
|
-
export const formControl = {
|
|
225
|
-
name: "test: form control",
|
|
226
|
-
render: () => (<Example>
|
|
227
|
-
<Example.Item title="with helper">
|
|
228
|
-
<FormControl>
|
|
229
|
-
<FormControl.Label>Name</FormControl.Label>
|
|
230
|
-
<TextField name="name" placeholder="Enter your name"/>
|
|
231
|
-
<FormControl.Helper>Helper</FormControl.Helper>
|
|
232
|
-
<FormControl.Error>This field is required</FormControl.Error>
|
|
233
|
-
</FormControl>
|
|
234
|
-
</Example.Item>
|
|
235
|
-
<Example.Item title="with error">
|
|
236
|
-
<FormControl hasError>
|
|
237
|
-
<FormControl.Label>Name</FormControl.Label>
|
|
238
|
-
<TextField name="name" placeholder="Enter your name"/>
|
|
239
|
-
<FormControl.Error>This field is required</FormControl.Error>
|
|
240
|
-
</FormControl>
|
|
241
|
-
</Example.Item>
|
|
242
|
-
</Example>),
|
|
243
|
-
};
|
|
244
|
-
export const foo = () => {
|
|
245
|
-
return (<TextField name="test-name" inputAttributes={{ "aria-label": "Label" }} endSlotPadding={0} endSlot={<View gap={0} direction="row" align="stretch">
|
|
246
|
-
<Divider color="neutral" vertical/>
|
|
247
|
-
<Select.Custom name="test-name" inputAttributes={{ "aria-label": "Label" }} variant="ghost">
|
|
248
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
249
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
250
|
-
</Select.Custom>
|
|
251
|
-
</View>}/>);
|
|
252
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: import("react").FC<import("./..").ThemeProps>;
|
|
5
|
-
parameters: {
|
|
6
|
-
iframe: {
|
|
7
|
-
url: string;
|
|
8
|
-
};
|
|
9
|
-
chromatic: {
|
|
10
|
-
disableSnapshot: boolean;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export default _default;
|
|
15
|
-
export declare const scoped: StoryObj;
|
|
16
|
-
export declare const light: StoryObj;
|
|
17
|
-
export declare const dark: StoryObj;
|
|
18
|
-
export declare const inherited: StoryObj;
|
|
19
|
-
export declare const inverted: StoryObj;
|
|
20
|
-
export declare const controlled: StoryObj;
|
|
21
|
-
export declare const uncontrolled: StoryObj;
|
|
22
|
-
export declare const disabledTransition: {
|
|
23
|
-
name: string;
|
|
24
|
-
render: () => import("react").JSX.Element;
|
|
25
|
-
};
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { expect, userEvent } from "storybook/test";
|
|
2
|
-
import Card from "../../Card/index.js";
|
|
3
|
-
import Button from "../../Button/index.js";
|
|
4
|
-
import View from "../../View/index.js";
|
|
5
|
-
import MenuItem from "../../MenuItem/index.js";
|
|
6
|
-
import Theme, { useTheme } from "../index.js";
|
|
7
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
8
|
-
import Popover from "../../Popover/index.js";
|
|
9
|
-
export default {
|
|
10
|
-
title: "Utility components/Theme",
|
|
11
|
-
component: Theme,
|
|
12
|
-
parameters: {
|
|
13
|
-
iframe: {
|
|
14
|
-
url: "https://reshaped.so/docs/utilities/theme",
|
|
15
|
-
},
|
|
16
|
-
chromatic: { disableSnapshot: true },
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
export const scoped = {
|
|
20
|
-
name: "scoped",
|
|
21
|
-
render: () => (<Example>
|
|
22
|
-
<Example.Item title="scoped, single">
|
|
23
|
-
<Theme name="reshaped">
|
|
24
|
-
<Card attributes={{ "data-testid": "test-id" }}>
|
|
25
|
-
<Button color="primary">Action</Button>
|
|
26
|
-
</Card>
|
|
27
|
-
</Theme>
|
|
28
|
-
</Example.Item>
|
|
29
|
-
|
|
30
|
-
<Example.Item title="scoped, multiple">
|
|
31
|
-
<Theme name={["reshaped", "figma"]}>
|
|
32
|
-
<Card attributes={{ "data-testid": "test-id-multi" }}>
|
|
33
|
-
<View direction="row" gap={4}>
|
|
34
|
-
<Button color="primary">Action</Button>
|
|
35
|
-
|
|
36
|
-
<Popover>
|
|
37
|
-
<Popover.Trigger>
|
|
38
|
-
{(attributes) => <Button attributes={attributes}>Popover</Button>}
|
|
39
|
-
</Popover.Trigger>
|
|
40
|
-
<Popover.Content>Content</Popover.Content>
|
|
41
|
-
</Popover>
|
|
42
|
-
</View>
|
|
43
|
-
</Card>
|
|
44
|
-
</Theme>
|
|
45
|
-
</Example.Item>
|
|
46
|
-
</Example>),
|
|
47
|
-
play: ({ canvas }) => {
|
|
48
|
-
const root = canvas.getByTestId("test-id").parentNode;
|
|
49
|
-
const rootMultiple = canvas.getByTestId("test-id-multi").parentNode;
|
|
50
|
-
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
|
51
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
|
52
|
-
expect(rootMultiple).toHaveAttribute("data-rs-theme", " reshaped figma ");
|
|
53
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
export const light = {
|
|
57
|
-
name: "light",
|
|
58
|
-
render: () => (<Theme name="reshaped" colorMode="light">
|
|
59
|
-
<Card attributes={{ "data-testid": "test-id" }}>Content</Card>
|
|
60
|
-
</Theme>),
|
|
61
|
-
play: ({ canvas }) => {
|
|
62
|
-
const root = canvas.getByTestId("test-id").parentNode;
|
|
63
|
-
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
|
64
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "light");
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
export const dark = {
|
|
68
|
-
name: "dark",
|
|
69
|
-
render: () => (<Theme name="reshaped" colorMode="dark">
|
|
70
|
-
<Card attributes={{ "data-testid": "test-id" }}>Content</Card>
|
|
71
|
-
</Theme>),
|
|
72
|
-
play: ({ canvas }) => {
|
|
73
|
-
const root = canvas.getByTestId("test-id").parentNode;
|
|
74
|
-
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
|
75
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
export const inherited = {
|
|
79
|
-
name: "inherited",
|
|
80
|
-
render: () => (<Theme name="reshaped">
|
|
81
|
-
<Card attributes={{ "data-testid": "test-id" }}>Content</Card>
|
|
82
|
-
</Theme>),
|
|
83
|
-
play: ({ canvas }) => {
|
|
84
|
-
const root = canvas.getByTestId("test-id").parentNode;
|
|
85
|
-
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
|
86
|
-
// Our storybook setup uses dark by default
|
|
87
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
export const inverted = {
|
|
91
|
-
name: "inverted",
|
|
92
|
-
render: () => (<Theme name="reshaped" colorMode="inverted">
|
|
93
|
-
<Card attributes={{ "data-testid": "test-id" }}>Content</Card>
|
|
94
|
-
</Theme>),
|
|
95
|
-
play: ({ canvas }) => {
|
|
96
|
-
const root = canvas.getByTestId("test-id").parentNode;
|
|
97
|
-
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
|
98
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "light");
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
export const controlled = {
|
|
102
|
-
name: "controlled",
|
|
103
|
-
render: () => {
|
|
104
|
-
const Internal = () => {
|
|
105
|
-
const { setTheme, theme } = useTheme();
|
|
106
|
-
return (<Button color="primary" onClick={() => setTheme("slate")}>
|
|
107
|
-
Switch to slate
|
|
108
|
-
</Button>);
|
|
109
|
-
};
|
|
110
|
-
return (<div data-testid="root">
|
|
111
|
-
<Theme name="reshaped">
|
|
112
|
-
<Internal />
|
|
113
|
-
</Theme>
|
|
114
|
-
</div>);
|
|
115
|
-
},
|
|
116
|
-
play: async ({ canvas }) => {
|
|
117
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
118
|
-
const trigger = canvas.getAllByRole("button")[0];
|
|
119
|
-
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
|
120
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
|
121
|
-
await userEvent.click(trigger);
|
|
122
|
-
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
|
123
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
export const uncontrolled = {
|
|
127
|
-
name: "uncontrolled",
|
|
128
|
-
render: () => {
|
|
129
|
-
const Internal = () => {
|
|
130
|
-
const { setTheme } = useTheme();
|
|
131
|
-
return (<Button color="primary" onClick={() => setTheme("slate")}>
|
|
132
|
-
Switch to slate
|
|
133
|
-
</Button>);
|
|
134
|
-
};
|
|
135
|
-
return (<div data-testid="root">
|
|
136
|
-
<Theme defaultName="reshaped">
|
|
137
|
-
<Internal />
|
|
138
|
-
</Theme>
|
|
139
|
-
</div>);
|
|
140
|
-
},
|
|
141
|
-
play: async ({ canvas }) => {
|
|
142
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
143
|
-
const trigger = canvas.getAllByRole("button")[0];
|
|
144
|
-
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
|
145
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
|
146
|
-
await userEvent.click(trigger);
|
|
147
|
-
expect(root).toHaveAttribute("data-rs-theme", "slate");
|
|
148
|
-
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
export const disabledTransition = {
|
|
152
|
-
name: "disabled transitions",
|
|
153
|
-
render: () => {
|
|
154
|
-
const { invertColorMode } = useTheme();
|
|
155
|
-
return (<Example>
|
|
156
|
-
<Example.Item title="should have no transitions while switching color mode">
|
|
157
|
-
<View gap={3}>
|
|
158
|
-
<Button onClick={invertColorMode}>Invert mode</Button>
|
|
159
|
-
|
|
160
|
-
<MenuItem selected>Test transition</MenuItem>
|
|
161
|
-
|
|
162
|
-
<Card>Default card</Card>
|
|
163
|
-
|
|
164
|
-
<Theme colorMode="inverted">
|
|
165
|
-
<Card>Inverted card</Card>
|
|
166
|
-
</Theme>
|
|
167
|
-
</View>
|
|
168
|
-
</Example.Item>
|
|
169
|
-
</Example>);
|
|
170
|
-
},
|
|
171
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: import("react").FC<import("./..").TimelineProps> & {
|
|
5
|
-
Item: typeof import("../Timeline").TimelineItem;
|
|
6
|
-
};
|
|
7
|
-
parameters: {
|
|
8
|
-
iframe: {
|
|
9
|
-
url: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export default _default;
|
|
14
|
-
export declare const base: {
|
|
15
|
-
name: string;
|
|
16
|
-
render: () => import("react").JSX.Element;
|
|
17
|
-
};
|
|
18
|
-
export declare const marker: {
|
|
19
|
-
name: string;
|
|
20
|
-
render: () => import("react").JSX.Element;
|
|
21
|
-
};
|
|
22
|
-
export declare const className: StoryObj;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Example, Placeholder } from "../../../utilities/storybook/index.js";
|
|
2
|
-
import Timeline from "../index.js";
|
|
3
|
-
import { expect } from "storybook/test";
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Timeline",
|
|
6
|
-
component: Timeline,
|
|
7
|
-
parameters: {
|
|
8
|
-
iframe: {
|
|
9
|
-
url: "https://reshaped.so/docs/components/timeline",
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
export const base = {
|
|
14
|
-
name: "base",
|
|
15
|
-
render: () => (<Example>
|
|
16
|
-
<Example.Item title="children passed directly">
|
|
17
|
-
<Timeline>
|
|
18
|
-
<Placeholder />
|
|
19
|
-
<Placeholder />
|
|
20
|
-
<Placeholder />
|
|
21
|
-
</Timeline>
|
|
22
|
-
</Example.Item>
|
|
23
|
-
<Example.Item title="children wrapped with Timeline.Item">
|
|
24
|
-
<Timeline>
|
|
25
|
-
<Timeline.Item>
|
|
26
|
-
<Placeholder />
|
|
27
|
-
</Timeline.Item>
|
|
28
|
-
<Timeline.Item>
|
|
29
|
-
<Placeholder />
|
|
30
|
-
</Timeline.Item>
|
|
31
|
-
<Timeline.Item>
|
|
32
|
-
<Placeholder />
|
|
33
|
-
</Timeline.Item>
|
|
34
|
-
</Timeline>
|
|
35
|
-
</Example.Item>
|
|
36
|
-
</Example>),
|
|
37
|
-
};
|
|
38
|
-
export const marker = {
|
|
39
|
-
name: "markerSlot",
|
|
40
|
-
render: () => (<Example>
|
|
41
|
-
<Example.Item title="slot">
|
|
42
|
-
<Timeline>
|
|
43
|
-
<Timeline.Item markerSlot={<Placeholder h="20px" w="20px"/>}>
|
|
44
|
-
<Placeholder />
|
|
45
|
-
</Timeline.Item>
|
|
46
|
-
<Timeline.Item markerSlot={<Placeholder h="20px" w="20px"/>}>
|
|
47
|
-
<Placeholder />
|
|
48
|
-
</Timeline.Item>
|
|
49
|
-
<Timeline.Item markerSlot={<Placeholder h="20px" w="20px"/>}>
|
|
50
|
-
<Placeholder />
|
|
51
|
-
</Timeline.Item>
|
|
52
|
-
</Timeline>
|
|
53
|
-
</Example.Item>
|
|
54
|
-
|
|
55
|
-
<Example.Item title="null marker">
|
|
56
|
-
<Timeline>
|
|
57
|
-
<Timeline.Item markerSlot={null}>
|
|
58
|
-
<Placeholder />
|
|
59
|
-
</Timeline.Item>
|
|
60
|
-
<Timeline.Item markerSlot={null}>
|
|
61
|
-
<Placeholder />
|
|
62
|
-
</Timeline.Item>
|
|
63
|
-
</Timeline>
|
|
64
|
-
</Example.Item>
|
|
65
|
-
</Example>),
|
|
66
|
-
};
|
|
67
|
-
export const className = {
|
|
68
|
-
name: "className, attributes",
|
|
69
|
-
render: () => (<div data-testid="root">
|
|
70
|
-
<Timeline className="test-classname" attributes={{ id: "test-id" }}>
|
|
71
|
-
<Timeline.Item className="test-item-classname" attributes={{ id: "test-item-id" }}>
|
|
72
|
-
Content
|
|
73
|
-
</Timeline.Item>
|
|
74
|
-
<Timeline.Item>Content</Timeline.Item>
|
|
75
|
-
</Timeline>
|
|
76
|
-
</div>),
|
|
77
|
-
play: async ({ canvas }) => {
|
|
78
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
79
|
-
const items = canvas.getAllByRole("listitem");
|
|
80
|
-
expect(root).toHaveClass("test-classname");
|
|
81
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
82
|
-
expect(items).toHaveLength(2);
|
|
83
|
-
expect(items[0]).toHaveClass("test-item-classname");
|
|
84
|
-
expect(items[0]).toHaveAttribute("id", "test-item-id");
|
|
85
|
-
},
|
|
86
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
title: string;
|
|
4
|
-
parameters: {
|
|
5
|
-
iframe: {
|
|
6
|
-
url: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
11
|
-
export declare const size: {
|
|
12
|
-
name: string;
|
|
13
|
-
render: () => import("react").JSX.Element;
|
|
14
|
-
};
|
|
15
|
-
export declare const position: {
|
|
16
|
-
name: string;
|
|
17
|
-
render: () => import("react").JSX.Element;
|
|
18
|
-
};
|
|
19
|
-
export declare const color: {
|
|
20
|
-
name: string;
|
|
21
|
-
render: () => import("react").JSX.Element;
|
|
22
|
-
};
|
|
23
|
-
export declare const timeout: {
|
|
24
|
-
name: string;
|
|
25
|
-
render: () => import("react").JSX.Element;
|
|
26
|
-
};
|
|
27
|
-
export declare const regionOptions: {
|
|
28
|
-
name: string;
|
|
29
|
-
render: () => import("react").JSX.Element;
|
|
30
|
-
};
|
|
31
|
-
export declare const slots: {
|
|
32
|
-
name: string;
|
|
33
|
-
render: () => import("react").JSX.Element;
|
|
34
|
-
};
|
|
35
|
-
export declare const base: StoryObj;
|
|
36
|
-
export declare const nested: StoryObj;
|
|
37
|
-
export declare const className: StoryObj;
|
|
38
|
-
export declare const edgeCases: {
|
|
39
|
-
name: string;
|
|
40
|
-
render: () => import("react").JSX.Element;
|
|
41
|
-
};
|