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.
Files changed (191) hide show
  1. package/dist/bundle.css +1 -1
  2. package/dist/bundle.js +11 -11
  3. package/dist/components/Button/Button.module.css +1 -1
  4. package/dist/components/Card/Card.d.ts +1 -1
  5. package/dist/components/Divider/Divider.js +3 -3
  6. package/dist/components/Divider/Divider.module.css +1 -1
  7. package/dist/components/Divider/Divider.types.d.ts +6 -0
  8. package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
  9. package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +1 -1
  10. package/dist/components/Flyout/Flyout.constants.d.ts +1 -3
  11. package/dist/components/Flyout/Flyout.constants.js +1 -3
  12. package/dist/components/Flyout/Flyout.types.d.ts +2 -0
  13. package/dist/components/Flyout/FlyoutControlled.js +10 -11
  14. package/dist/components/Flyout/utilities/cooldown.js +1 -2
  15. package/dist/components/Icon/Icon.module.css +1 -1
  16. package/dist/components/Popover/Popover.types.d.ts +1 -1
  17. package/dist/components/Progress/Progress.module.css +1 -1
  18. package/dist/components/Select/Select.module.css +1 -1
  19. package/dist/components/Select/Select.types.d.ts +16 -11
  20. package/dist/components/Select/SelectCustomControlled.js +27 -10
  21. package/dist/components/Select/SelectGroup.d.ts +4 -0
  22. package/dist/components/Select/SelectGroup.js +10 -0
  23. package/dist/components/Select/SelectTrigger.js +1 -1
  24. package/dist/components/Select/index.d.ts +3 -2
  25. package/dist/components/Select/index.js +3 -2
  26. package/dist/components/Tabs/TabsContext.d.ts +1 -1
  27. package/dist/components/TextArea/TextArea.module.css +1 -1
  28. package/dist/components/TextArea/TextArea.types.d.ts +1 -1
  29. package/dist/components/TextField/TextField.module.css +1 -1
  30. package/dist/components/TextField/TextField.types.d.ts +1 -1
  31. package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
  32. package/dist/config/tailwind.d.ts +1 -1
  33. package/package.json +31 -30
  34. package/dist/components/Accordion/tests/Accordion.stories.d.ts +0 -44
  35. package/dist/components/Accordion/tests/Accordion.stories.js +0 -204
  36. package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +0 -40
  37. package/dist/components/ActionBar/tests/ActionBar.stories.js +0 -223
  38. package/dist/components/Actionable/tests/Actionable.stories.d.ts +0 -41
  39. package/dist/components/Actionable/tests/Actionable.stories.js +0 -220
  40. package/dist/components/Alert/tests/Alert.stories.d.ts +0 -24
  41. package/dist/components/Alert/tests/Alert.stories.js +0 -78
  42. package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +0 -32
  43. package/dist/components/Autocomplete/tests/Autocomplete.stories.js +0 -246
  44. package/dist/components/Avatar/tests/Avatar.stories.d.ts +0 -31
  45. package/dist/components/Avatar/tests/Avatar.stories.js +0 -176
  46. package/dist/components/Badge/tests/Badge.stories.d.ts +0 -55
  47. package/dist/components/Badge/tests/Badge.stories.js +0 -328
  48. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +0 -40
  49. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +0 -187
  50. package/dist/components/Button/tests/Button.stories.d.ts +0 -79
  51. package/dist/components/Button/tests/Button.stories.js +0 -789
  52. package/dist/components/Calendar/tests/Calendar.stories.d.ts +0 -29
  53. package/dist/components/Calendar/tests/Calendar.stories.js +0 -255
  54. package/dist/components/Card/tests/Card.stories.d.ts +0 -52
  55. package/dist/components/Card/tests/Card.stories.js +0 -125
  56. package/dist/components/Carousel/tests/Carousel.stories.d.ts +0 -34
  57. package/dist/components/Carousel/tests/Carousel.stories.js +0 -224
  58. package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +0 -30
  59. package/dist/components/Checkbox/tests/Checkbox.stories.js +0 -171
  60. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +0 -19
  61. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +0 -83
  62. package/dist/components/Container/tests/Container.stories.d.ts +0 -24
  63. package/dist/components/Container/tests/Container.stories.js +0 -75
  64. package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +0 -26
  65. package/dist/components/ContextMenu/tests/ContextMenu.stories.js +0 -70
  66. package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +0 -25
  67. package/dist/components/Dismissible/tests/Dismissible.stories.js +0 -97
  68. package/dist/components/Divider/tests/Divider.stories.d.ts +0 -18
  69. package/dist/components/Divider/tests/Divider.stories.js +0 -94
  70. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +0 -53
  71. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +0 -278
  72. package/dist/components/FileUpload/tests/FileUpload.stories.d.ts +0 -31
  73. package/dist/components/FileUpload/tests/FileUpload.stories.js +0 -140
  74. package/dist/components/Flyout/tests/Flyout.stories.d.ts +0 -102
  75. package/dist/components/Flyout/tests/Flyout.stories.js +0 -708
  76. package/dist/components/FormControl/tests/FormControl.stories.d.ts +0 -31
  77. package/dist/components/FormControl/tests/FormControl.stories.js +0 -143
  78. package/dist/components/Grid/tests/Grid.stories.d.ts +0 -38
  79. package/dist/components/Grid/tests/Grid.stories.js +0 -245
  80. package/dist/components/Hidden/tests/Hidden.stories.d.ts +0 -16
  81. package/dist/components/Hidden/tests/Hidden.stories.js +0 -48
  82. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +0 -16
  83. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +0 -28
  84. package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +0 -13
  85. package/dist/components/Hotkey/tests/Hotkey.stories.js +0 -53
  86. package/dist/components/Icon/tests/Icon.stories.d.ts +0 -25
  87. package/dist/components/Icon/tests/Icon.stories.js +0 -113
  88. package/dist/components/Image/tests/Image.stories.d.ts +0 -41
  89. package/dist/components/Image/tests/Image.stories.js +0 -196
  90. package/dist/components/Link/tests/Link.stories.d.ts +0 -42
  91. package/dist/components/Link/tests/Link.stories.js +0 -155
  92. package/dist/components/Loader/tests/Loader.stories.d.ts +0 -21
  93. package/dist/components/Loader/tests/Loader.stories.js +0 -68
  94. package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +0 -59
  95. package/dist/components/MenuItem/tests/MenuItem.stories.js +0 -236
  96. package/dist/components/Modal/tests/Modal.stories.d.ts +0 -64
  97. package/dist/components/Modal/tests/Modal.stories.js +0 -410
  98. package/dist/components/NumberField/tests/NumberField.stories.d.ts +0 -28
  99. package/dist/components/NumberField/tests/NumberField.stories.js +0 -258
  100. package/dist/components/Overlay/tests/Overlay.stories.d.ts +0 -28
  101. package/dist/components/Overlay/tests/Overlay.stories.js +0 -202
  102. package/dist/components/Pagination/tests/Pagination.stories.d.ts +0 -24
  103. package/dist/components/Pagination/tests/Pagination.stories.js +0 -105
  104. package/dist/components/PinField/tests/PinField.stories.d.ts +0 -34
  105. package/dist/components/PinField/tests/PinField.stories.js +0 -209
  106. package/dist/components/Popover/tests/Popover.stories.d.ts +0 -69
  107. package/dist/components/Popover/tests/Popover.stories.js +0 -340
  108. package/dist/components/Progress/tests/Progress.stories.d.ts +0 -30
  109. package/dist/components/Progress/tests/Progress.stories.js +0 -102
  110. package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.d.ts +0 -19
  111. package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +0 -92
  112. package/dist/components/Radio/tests/Radio.stories.d.ts +0 -35
  113. package/dist/components/Radio/tests/Radio.stories.js +0 -162
  114. package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +0 -19
  115. package/dist/components/RadioGroup/tests/RadioGroup.stories.js +0 -77
  116. package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +0 -34
  117. package/dist/components/Reshaped/tests/Reshaped.stories.js +0 -108
  118. package/dist/components/Resizable/tests/Resizable.stories.d.ts +0 -38
  119. package/dist/components/Resizable/tests/Resizable.stories.js +0 -185
  120. package/dist/components/Scrim/tests/Scrim.stories.d.ts +0 -20
  121. package/dist/components/Scrim/tests/Scrim.stories.js +0 -67
  122. package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +0 -37
  123. package/dist/components/ScrollArea/tests/ScrollArea.stories.js +0 -244
  124. package/dist/components/Select/SelectOptionGroup.d.ts +0 -4
  125. package/dist/components/Select/SelectOptionGroup.js +0 -9
  126. package/dist/components/Select/tests/Select.stories.d.ts +0 -47
  127. package/dist/components/Select/tests/Select.stories.js +0 -520
  128. package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +0 -20
  129. package/dist/components/Skeleton/tests/Skeleton.stories.js +0 -63
  130. package/dist/components/Slider/tests/Slider.stories.d.ts +0 -47
  131. package/dist/components/Slider/tests/Slider.stories.js +0 -279
  132. package/dist/components/Stepper/tests/Stepper.stories.d.ts +0 -31
  133. package/dist/components/Stepper/tests/Stepper.stories.js +0 -135
  134. package/dist/components/Switch/tests/Switch.stories.d.ts +0 -22
  135. package/dist/components/Switch/tests/Switch.stories.js +0 -137
  136. package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -13
  137. package/dist/components/Switch/tests/Switch.test.stories.js +0 -11
  138. package/dist/components/Table/tests/Table.stories.d.ts +0 -42
  139. package/dist/components/Table/tests/Table.stories.js +0 -348
  140. package/dist/components/Tabs/tests/Tabs.stories.d.ts +0 -62
  141. package/dist/components/Tabs/tests/Tabs.stories.js +0 -539
  142. package/dist/components/Text/tests/Text.stories.d.ts +0 -48
  143. package/dist/components/Text/tests/Text.stories.js +0 -201
  144. package/dist/components/TextArea/tests/TextArea.stories.d.ts +0 -53
  145. package/dist/components/TextArea/tests/TextArea.stories.js +0 -200
  146. package/dist/components/TextField/tests/TextField.stories.d.ts +0 -53
  147. package/dist/components/TextField/tests/TextField.stories.js +0 -237
  148. package/dist/components/Theme/tests/Theme.stories.d.ts +0 -25
  149. package/dist/components/Theme/tests/Theme.stories.js +0 -171
  150. package/dist/components/Timeline/tests/Timeline.stories.d.ts +0 -22
  151. package/dist/components/Timeline/tests/Timeline.stories.js +0 -86
  152. package/dist/components/Toast/tests/Toast.stories.d.ts +0 -41
  153. package/dist/components/Toast/tests/Toast.stories.js +0 -432
  154. package/dist/components/ToggleButton/tests/ToggleButton.stories.d.ts +0 -27
  155. package/dist/components/ToggleButton/tests/ToggleButton.stories.js +0 -97
  156. package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.d.ts +0 -27
  157. package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.js +0 -169
  158. package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +0 -28
  159. package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -182
  160. package/dist/components/View/tests/View.stories.d.ts +0 -141
  161. package/dist/components/View/tests/View.stories.js +0 -1329
  162. package/dist/components/_private/Portal/tests/Portal.stories.d.ts +0 -6
  163. package/dist/components/_private/Portal/tests/Portal.stories.js +0 -17
  164. package/dist/hooks/tests/useDrag.stories.d.ts +0 -31
  165. package/dist/hooks/tests/useDrag.stories.js +0 -147
  166. package/dist/hooks/tests/useElementId.stories.d.ts +0 -11
  167. package/dist/hooks/tests/useElementId.stories.js +0 -23
  168. package/dist/hooks/tests/useHandlerRef.stories.d.ts +0 -14
  169. package/dist/hooks/tests/useHandlerRef.stories.js +0 -44
  170. package/dist/hooks/tests/useHotkeys.stories.d.ts +0 -43
  171. package/dist/hooks/tests/useHotkeys.stories.js +0 -158
  172. package/dist/hooks/tests/useKeyboardArrowNavigation.stories.d.ts +0 -15
  173. package/dist/hooks/tests/useKeyboardArrowNavigation.stories.js +0 -128
  174. package/dist/hooks/tests/useKeyboardMode.stories.d.ts +0 -11
  175. package/dist/hooks/tests/useKeyboardMode.stories.js +0 -42
  176. package/dist/hooks/tests/useOnClickOutside.stories.d.ts +0 -23
  177. package/dist/hooks/tests/useOnClickOutside.stories.js +0 -111
  178. package/dist/hooks/tests/useRTL.stories.d.ts +0 -11
  179. package/dist/hooks/tests/useRTL.stories.js +0 -23
  180. package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +0 -18
  181. package/dist/hooks/tests/useResponsiveClientValue.stories.js +0 -30
  182. package/dist/hooks/tests/useScrollLock.stories.d.ts +0 -14
  183. package/dist/hooks/tests/useScrollLock.stories.js +0 -97
  184. package/dist/hooks/tests/useToggle.stories.d.ts +0 -13
  185. package/dist/hooks/tests/useToggle.stories.js +0 -59
  186. package/dist/tests/ShadowDOM.stories.d.ts +0 -6
  187. package/dist/tests/ShadowDOM.stories.js +0 -110
  188. package/dist/tests/themes.stories.d.ts +0 -16
  189. package/dist/tests/themes.stories.js +0 -327
  190. package/dist/utilities/a11y/tests/TrapFocus.stories.d.ts +0 -14
  191. package/dist/utilities/a11y/tests/TrapFocus.stories.js +0 -615
@@ -1,237 +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 { expect, fn, userEvent } from "storybook/test";
10
- export default {
11
- title: "Components/TextField",
12
- component: TextField,
13
- parameters: {
14
- iframe: {
15
- url: "https://reshaped.so/docs/components/text-field",
16
- },
17
- },
18
- };
19
- export const variant = {
20
- name: "variant",
21
- render: () => (<Example>
22
- <Example.Item title="variant: faded">
23
- <TextField variant="faded" name="Name" placeholder="Enter your name"/>
24
- </Example.Item>
25
-
26
- <Example.Item title="variant: headless">
27
- <TextField variant="headless" name="Name" placeholder="Enter your name"/>
28
- </Example.Item>
29
- </Example>),
30
- };
31
- export const rounded = {
32
- name: "rounded",
33
- render: () => (<Example>
34
- <Example.Item title="rounded">
35
- <TextField rounded name="Name" placeholder="Enter your name" icon={IconZap} prefix="+31" endSlot={<Button rounded size="small" icon={IconZap}/>}/>
36
- </Example.Item>
37
-
38
- <Example.Item title="rounded, variant: faded">
39
- <View direction="row" gap={2}>
40
- <View.Item grow>
41
- <TextField rounded variant="faded" name="Name" placeholder="Enter your name" startSlot={<Badge rounded size="small">
42
- Hello
43
- </Badge>}/>
44
- </View.Item>
45
- <Button rounded>Submit</Button>
46
- </View>
47
- </Example.Item>
48
- </Example>),
49
- };
50
- export const error = {
51
- name: "hasError",
52
- render: () => (<Example>
53
- <Example.Item title="error">
54
- <TextField name="Name" placeholder="Enter your name" hasError/>
55
- </Example.Item>
56
- </Example>),
57
- };
58
- export const attachments = {
59
- name: "icon, endIcon, suffix, prefix, startSlot, endSlot, startSlotPadding, endSlotPadding",
60
- render: () => (<Example>
61
- <Example.Item title="icon">
62
- <TextField name="Name" placeholder="Enter your name" value="Reshaped" icon={IconZap}/>
63
- </Example.Item>
64
- <Example.Item title="endIcon">
65
- <TextField name="Name" placeholder="Enter your name" value="Reshaped" endIcon={IconZap}/>
66
- </Example.Item>
67
-
68
- <Example.Item title={["startSlot", "vertical and horizontal padding aligned"]}>
69
- <TextField name="Name" placeholder="Enter your name" value="Reshaped" startSlot={<Placeholder h={20}/>}/>
70
- </Example.Item>
71
-
72
- <Example.Item title={["endSlot", "vertical and horizontal padding aligned"]}>
73
- <TextField name="Name" placeholder="Enter your name" value="Reshaped" endSlot={<Button icon={IconZap} size="small" onClick={() => { }} attributes={{ "aria-label": "Action" }}/>}/>
74
- </Example.Item>
75
-
76
- <Example.Item title="paddingSlotStart=4, paddingSlotEnd=2">
77
- <TextField name="Name" placeholder="Enter your name" value="Reshaped" startSlotPadding={4} endSlotPadding={2} startSlot={<Placeholder h={20}/>} endSlot={<Placeholder h={20}/>}/>
78
- </Example.Item>
79
-
80
- <Example.Item title="with all affixes">
81
- <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}/>}/>
82
- </Example.Item>
83
-
84
- <Example.Item title="multiline wrap">
85
- <TextField name="Name" placeholder="Enter your name" value="Reshaped" startSlot={[...Array(10).keys()].map((i) => (<Badge size="small" key={i}>
86
- Item {i + 1}
87
- </Badge>))} multiline/>
88
- </Example.Item>
89
- </Example>),
90
- };
91
- export const size = {
92
- name: "size",
93
- render: () => (<Example>
94
- <Example.Item title="size: small">
95
- <TextField name="Name" placeholder="Enter your name" size="small" icon={IconZap}/>
96
- </Example.Item>
97
-
98
- <Example.Item title="size: medium">
99
- <TextField name="Name" placeholder="Enter your name" size="medium" icon={IconZap}/>
100
- </Example.Item>
101
-
102
- <Example.Item title="size: large">
103
- <TextField name="Name" placeholder="Enter your name" size="large" icon={IconZap}/>
104
- </Example.Item>
105
-
106
- <Example.Item title="size: xlarge">
107
- <TextField name="Name" placeholder="Enter your name" size="xlarge" icon={IconZap}/>
108
- </Example.Item>
109
-
110
- <Example.Item title={["responsive size", "[s] xlarge", "[m+] medium"]}>
111
- <TextField name="Name" placeholder="Enter your name" size={{ s: "xlarge", m: "medium" }} icon={IconZap}/>
112
- </Example.Item>
113
- </Example>),
114
- };
115
- export const aligner = {
116
- name: "aligner",
117
- render: () => (<Example>
118
- <Example.Item title="aligner">
119
- <View gap={2}>
120
- <Text variant="featured-2">What problem are you trying to solve?</Text>
121
- <TextField.Aligner>
122
- <TextField variant="headless" placeholder="Try something like 'I have a job'" name="description"/>
123
- </TextField.Aligner>
124
- <View.Item>
125
- <Button>Next</Button>
126
- </View.Item>
127
- </View>
128
- </Example.Item>
129
- </Example>),
130
- };
131
- export const render = {
132
- name: "base",
133
- render: () => <TextField name="test-name" inputAttributes={{ "aria-label": "Label" }}/>,
134
- play: async ({ canvas }) => {
135
- const input = canvas.getByRole("textbox");
136
- expect(input).toHaveAttribute("name", "test-name");
137
- expect(input).toHaveAccessibleName("Label");
138
- },
139
- };
140
- export const placeholder = {
141
- name: "placeholder",
142
- render: () => (<TextField name="test-name" placeholder="Placeholder" inputAttributes={{ "aria-label": "Label" }}/>),
143
- play: async ({ canvas }) => {
144
- const input = canvas.getByRole("textbox");
145
- expect(input).toHaveValue("");
146
- expect(input).toHaveAttribute("placeholder", "Placeholder");
147
- },
148
- };
149
- export const id = {
150
- name: "id",
151
- render: () => (<TextField name="test-name" id="test-id" inputAttributes={{ "aria-label": "Label" }}/>),
152
- play: async ({ canvas }) => {
153
- const input = canvas.getByRole("textbox");
154
- expect(input).toHaveAttribute("id", "test-id");
155
- },
156
- };
157
- export const disabled = {
158
- name: "disabled",
159
- render: () => <TextField name="test-name" disabled inputAttributes={{ "aria-label": "Label" }}/>,
160
- play: async ({ canvas }) => {
161
- const input = canvas.getByRole("textbox");
162
- expect(input).toBeDisabled();
163
- },
164
- };
165
- export const defaultValue = {
166
- name: "defaultValue, uncontrolled",
167
- args: {
168
- handleChange: fn(),
169
- },
170
- render: (args) => (<TextField name="test-name" defaultValue="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
171
- play: async ({ canvas, args }) => {
172
- const input = canvas.getByRole("textbox");
173
- expect(input).toHaveValue("value");
174
- input.focus();
175
- await userEvent.keyboard("2");
176
- expect(args.handleChange).toBeCalledTimes(1);
177
- expect(args.handleChange).toHaveBeenCalledWith({
178
- name: "test-name",
179
- value: "value2",
180
- event: expect.objectContaining({ target: input }),
181
- });
182
- expect(input).toHaveValue("value2");
183
- },
184
- };
185
- export const value = {
186
- name: "value, controlled",
187
- args: {
188
- handleChange: fn(),
189
- },
190
- render: (args) => (<TextField name="test-name" value="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
191
- play: async ({ canvas, args }) => {
192
- const input = canvas.getByRole("textbox");
193
- expect(input).toHaveValue("value");
194
- input.focus();
195
- await userEvent.keyboard("2");
196
- expect(args.handleChange).toBeCalledTimes(1);
197
- expect(args.handleChange).toHaveBeenCalledWith({
198
- name: "test-name",
199
- value: "value2",
200
- event: expect.objectContaining({ target: input }),
201
- });
202
- expect(input).toHaveValue("value");
203
- },
204
- };
205
- export const className = {
206
- name: "className, attributes",
207
- render: () => (<div data-testid="root">
208
- <TextField className="test-classname" attributes={{ id: "test-id" }} name="name" inputAttributes={{ id: "test-input-id", "aria-label": "Label" }}/>
209
- </div>),
210
- play: async ({ canvas }) => {
211
- const root = canvas.getByTestId("root").firstChild;
212
- const input = canvas.getByRole("textbox");
213
- expect(root).toHaveClass("test-classname");
214
- expect(root).toHaveAttribute("id", "test-id");
215
- expect(input).toHaveAttribute("id", "test-input-id");
216
- },
217
- };
218
- export const formControl = {
219
- name: "test: form control",
220
- render: () => (<Example>
221
- <Example.Item title="with helper">
222
- <FormControl>
223
- <FormControl.Label>Name</FormControl.Label>
224
- <TextField name="name" placeholder="Enter your name"/>
225
- <FormControl.Helper>Helper</FormControl.Helper>
226
- <FormControl.Error>This field is required</FormControl.Error>
227
- </FormControl>
228
- </Example.Item>
229
- <Example.Item title="with error">
230
- <FormControl hasError>
231
- <FormControl.Label>Name</FormControl.Label>
232
- <TextField name="name" placeholder="Enter your name"/>
233
- <FormControl.Error>This field is required</FormControl.Error>
234
- </FormControl>
235
- </Example.Item>
236
- </Example>),
237
- };
@@ -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
- };