reshaped 3.3.11 → 3.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/bundle.css +1 -1
  3. package/dist/bundle.js +16 -17
  4. package/dist/cjs/themes/_generator/utilities/generateColors.d.ts +1 -1
  5. package/dist/cjs/themes/_generator/utilities/generateColors.js +3 -2
  6. package/dist/cjs/themes/_generator/utilities/tests/color.test.js +32 -31
  7. package/dist/cjs/themes/slate/theme.css +1 -1
  8. package/dist/components/Accordion/tests/Accordion.stories.d.ts +30 -8
  9. package/dist/components/Accordion/tests/Accordion.stories.js +172 -119
  10. package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +12 -3
  11. package/dist/components/ActionBar/tests/ActionBar.stories.js +51 -36
  12. package/dist/components/ActionBar/tests/ActionBar.test.stories.d.ts +15 -0
  13. package/dist/components/ActionBar/tests/ActionBar.test.stories.js +26 -0
  14. package/dist/components/Actionable/Actionable.js +1 -1
  15. package/dist/components/Actionable/tests/Actionable.stories.d.ts +19 -5
  16. package/dist/components/Actionable/tests/Actionable.stories.js +88 -63
  17. package/dist/components/Actionable/tests/Actionable.test.stories.d.ts +32 -0
  18. package/dist/components/Actionable/tests/Actionable.test.stories.js +130 -0
  19. package/dist/components/Alert/Alert.js +1 -1
  20. package/dist/components/Alert/tests/Alert.stories.d.ts +12 -3
  21. package/dist/components/Alert/tests/Alert.stories.js +51 -86
  22. package/dist/components/Alert/tests/Alert.test.stories.d.ts +15 -0
  23. package/dist/components/Alert/tests/Alert.test.stories.js +26 -0
  24. package/dist/components/Autocomplete/Autocomplete.js +9 -2
  25. package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +6 -2
  26. package/dist/components/Autocomplete/tests/Autocomplete.stories.js +94 -111
  27. package/dist/components/Autocomplete/tests/Autocomplete.test.stories.d.ts +23 -0
  28. package/dist/components/Autocomplete/tests/Autocomplete.test.stories.js +86 -0
  29. package/dist/components/Avatar/Avatar.js +1 -1
  30. package/dist/components/Avatar/tests/Avatar.stories.d.ts +14 -4
  31. package/dist/components/Avatar/tests/Avatar.stories.js +94 -80
  32. package/dist/components/Avatar/tests/Avatar.test.stories.d.ts +17 -0
  33. package/dist/components/Avatar/tests/Avatar.test.stories.js +39 -0
  34. package/dist/components/Badge/tests/Badge.stories.d.ts +33 -8
  35. package/dist/components/Badge/tests/Badge.stories.js +238 -212
  36. package/dist/components/Badge/tests/Badge.test.stories.d.ts +20 -0
  37. package/dist/components/Badge/tests/Badge.test.stories.js +44 -0
  38. package/dist/components/Breadcrumbs/Breadcrumbs.js +2 -2
  39. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +1 -0
  40. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +24 -5
  41. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +114 -95
  42. package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.d.ts +23 -0
  43. package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.js +76 -0
  44. package/dist/components/Button/Button.js +5 -2
  45. package/dist/components/Button/Button.module.css +1 -1
  46. package/dist/components/Button/Button.types.d.ts +1 -0
  47. package/dist/components/Button/tests/Button.stories.d.ts +2 -2
  48. package/dist/components/Button/tests/Button.stories.js +77 -74
  49. package/dist/components/Button/tests/Button.test.stories.d.ts +27 -0
  50. package/dist/components/Button/tests/Button.test.stories.js +112 -0
  51. package/dist/components/Calendar/tests/Calendar.test.stories.d.ts +26 -0
  52. package/dist/components/Calendar/tests/Calendar.test.stories.js +161 -0
  53. package/dist/components/Card/tests/Card.stories.d.ts +0 -1
  54. package/dist/components/Card/tests/Card.stories.js +0 -11
  55. package/dist/components/Card/tests/Card.test.stories.d.ts +35 -0
  56. package/dist/components/Card/tests/Card.test.stories.js +54 -0
  57. package/dist/components/Carousel/CarouselControl.js +1 -1
  58. package/dist/components/Carousel/tests/Carousel.stories.d.ts +3 -0
  59. package/dist/components/Carousel/tests/Carousel.stories.js +4 -0
  60. package/dist/components/Carousel/tests/Carousel.test.stories.d.ts +17 -0
  61. package/dist/components/Carousel/tests/Carousel.test.stories.js +52 -0
  62. package/dist/components/Checkbox/tests/Checkbox.test.stories.d.ts +25 -0
  63. package/dist/components/Checkbox/tests/Checkbox.test.stories.js +104 -0
  64. package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.d.ts +22 -0
  65. package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.js +78 -0
  66. package/dist/components/Container/Container.module.css +1 -1
  67. package/dist/components/Container/tests/Container.stories.d.ts +12 -3
  68. package/dist/components/Container/tests/Container.stories.js +50 -31
  69. package/dist/components/Container/tests/Container.test.stories.d.ts +15 -0
  70. package/dist/components/Container/tests/Container.test.stories.js +26 -0
  71. package/dist/components/ContextMenu/ContextMenu.js +13 -9
  72. package/dist/components/ContextMenu/tests/ContextMenu.stories.js +2 -3
  73. package/dist/components/ContextMenu/tests/ContextMenu.test.stories.d.ts +26 -0
  74. package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +53 -0
  75. package/dist/components/Dismissible/Dismissible.js +1 -1
  76. package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +10 -3
  77. package/dist/components/Dismissible/tests/Dismissible.stories.js +51 -34
  78. package/dist/components/Dismissible/tests/Dismissible.test.stories.d.ts +19 -0
  79. package/dist/components/Dismissible/tests/Dismissible.test.stories.js +42 -0
  80. package/dist/components/Divider/tests/Divider.test.stories.d.ts +18 -0
  81. package/dist/components/Divider/tests/Divider.test.stories.js +47 -0
  82. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +37 -0
  83. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +117 -0
  84. package/dist/components/FileUpload/tests/FileUpload.test.stories.d.ts +22 -0
  85. package/dist/components/FileUpload/tests/FileUpload.test.stories.js +52 -0
  86. package/dist/components/FormControl/FormControlCaption.js +1 -1
  87. package/dist/components/FormControl/FormControlLabel.js +1 -1
  88. package/dist/components/FormControl/tests/FormControl.stories.d.ts +11 -5
  89. package/dist/components/FormControl/tests/FormControl.stories.js +78 -73
  90. package/dist/components/FormControl/tests/FormControl.test.stories.d.ts +20 -0
  91. package/dist/components/FormControl/tests/FormControl.test.stories.js +49 -0
  92. package/dist/components/Grid/tests/Grid.stories.d.ts +20 -5
  93. package/dist/components/Grid/tests/Grid.stories.js +164 -149
  94. package/dist/components/Grid/tests/Grid.test.stories.d.ts +19 -0
  95. package/dist/components/Grid/tests/Grid.test.stories.js +42 -0
  96. package/dist/components/Hidden/tests/Hidden.stories.d.ts +4 -1
  97. package/dist/components/Hidden/tests/Hidden.stories.js +28 -25
  98. package/dist/components/Hidden/tests/Hidden.test.stories.d.ts +15 -0
  99. package/dist/components/Hidden/tests/Hidden.test.stories.js +20 -0
  100. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +4 -1
  101. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +8 -5
  102. package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.d.ts +15 -0
  103. package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.js +20 -0
  104. package/dist/components/Hotkey/tests/Hotkey.test.stories.d.ts +15 -0
  105. package/dist/components/Hotkey/tests/Hotkey.test.stories.js +26 -0
  106. package/dist/components/Icon/tests/Icon.stories.d.ts +12 -3
  107. package/dist/components/Icon/tests/Icon.stories.js +69 -60
  108. package/dist/components/Icon/tests/Icon.test.stories.d.ts +16 -0
  109. package/dist/components/Icon/tests/Icon.test.stories.js +35 -0
  110. package/dist/components/Image/tests/Image.stories.d.ts +24 -5
  111. package/dist/components/Image/tests/Image.stories.js +95 -75
  112. package/dist/components/Image/tests/Image.test.stories.d.ts +25 -0
  113. package/dist/components/Image/tests/Image.test.stories.js +80 -0
  114. package/dist/components/Link/tests/Link.test.stories.d.ts +29 -0
  115. package/dist/components/Link/tests/Link.test.stories.js +87 -0
  116. package/dist/components/Loader/Loader.js +1 -1
  117. package/dist/components/Loader/Loader.types.d.ts +1 -0
  118. package/dist/components/Loader/tests/Loader.stories.js +8 -8
  119. package/dist/components/Loader/tests/Loader.test.stories.d.ts +16 -0
  120. package/dist/components/Loader/tests/Loader.test.stories.js +32 -0
  121. package/dist/components/MenuItem/tests/MenuItem.test.stories.d.ts +26 -0
  122. package/dist/components/MenuItem/tests/MenuItem.test.stories.js +100 -0
  123. package/dist/components/Modal/tests/Modal.test.stories.d.ts +32 -0
  124. package/dist/components/Modal/tests/Modal.test.stories.js +149 -0
  125. package/dist/components/Overlay/tests/Overlay.stories.d.ts +4 -2
  126. package/dist/components/Overlay/tests/Overlay.stories.js +53 -53
  127. package/dist/components/Overlay/tests/Overlay.test.stories.d.ts +28 -0
  128. package/dist/components/Overlay/tests/Overlay.test.stories.js +146 -0
  129. package/dist/components/Pagination/tests/Pagination.test.stories.d.ts +23 -0
  130. package/dist/components/Pagination/tests/Pagination.test.stories.js +86 -0
  131. package/dist/components/PinField/tests/PinField.stories.d.ts +0 -1
  132. package/dist/components/PinField/tests/PinField.stories.js +10 -19
  133. package/dist/components/PinField/tests/PinField.test.stories.d.ts +29 -0
  134. package/dist/components/PinField/tests/PinField.test.stories.js +177 -0
  135. package/dist/components/Popover/tests/Popover.test.stories.d.ts +40 -0
  136. package/dist/components/Popover/tests/Popover.test.stories.js +167 -0
  137. package/dist/components/Progress/Progress.js +2 -2
  138. package/dist/components/Progress/Progress.types.d.ts +1 -0
  139. package/dist/components/Progress/tests/Progress.stories.js +10 -10
  140. package/dist/components/Progress/tests/Progress.test.stories.d.ts +16 -0
  141. package/dist/components/Progress/tests/Progress.test.stories.js +35 -0
  142. package/dist/components/Radio/tests/Radio.test.stories.d.ts +30 -0
  143. package/dist/components/Radio/tests/Radio.test.stories.js +118 -0
  144. package/dist/components/RadioGroup/tests/RadioGroup.test.stories.d.ts +22 -0
  145. package/dist/components/RadioGroup/tests/RadioGroup.test.stories.js +78 -0
  146. package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +33 -0
  147. package/dist/components/Reshaped/tests/Reshaped.stories.js +88 -0
  148. package/dist/components/Resizable/Resizable.js +1 -0
  149. package/dist/components/Resizable/tests/Resizable.stories.d.ts +3 -0
  150. package/dist/components/Resizable/tests/Resizable.stories.js +4 -0
  151. package/dist/components/Resizable/tests/Resizable.test.stories.d.ts +19 -0
  152. package/dist/components/Resizable/tests/Resizable.test.stories.js +25 -0
  153. package/dist/components/Scrim/tests/Scrim.test.stories.d.ts +15 -0
  154. package/dist/components/Scrim/tests/Scrim.test.stories.js +25 -0
  155. package/dist/components/ScrollArea/ScrollArea.js +1 -1
  156. package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
  157. package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +17 -4
  158. package/dist/components/ScrollArea/tests/ScrollArea.stories.js +114 -139
  159. package/dist/components/ScrollArea/tests/ScrollArea.test.stories.d.ts +23 -0
  160. package/dist/components/ScrollArea/tests/ScrollArea.test.stories.js +66 -0
  161. package/dist/components/Select/tests/Select.stories.d.ts +1 -1
  162. package/dist/components/Select/tests/Select.stories.js +5 -12
  163. package/dist/components/Select/tests/Select.test.stories.d.ts +27 -0
  164. package/dist/components/Select/tests/Select.test.stories.js +132 -0
  165. package/dist/components/Skeleton/tests/Skeleton.test.stories.d.ts +15 -0
  166. package/dist/components/Skeleton/tests/Skeleton.test.stories.js +23 -0
  167. package/dist/components/Slider/tests/Slider.stories.d.ts +0 -1
  168. package/dist/components/Slider/tests/Slider.stories.js +8 -9
  169. package/dist/components/Slider/tests/Slider.test.stories.d.ts +38 -0
  170. package/dist/components/Slider/tests/Slider.test.stories.js +150 -0
  171. package/dist/components/Stepper/Stepper.js +1 -1
  172. package/dist/components/Stepper/tests/Stepper.stories.js +0 -3
  173. package/dist/components/Stepper/tests/Stepper.test.stories.d.ts +18 -0
  174. package/dist/components/Stepper/tests/Stepper.test.stories.js +28 -0
  175. package/dist/components/Switch/tests/Switch.test.stories.d.ts +23 -0
  176. package/dist/components/Switch/tests/Switch.test.stories.js +79 -0
  177. package/dist/components/Table/tests/Table.test.stories.d.ts +25 -0
  178. package/dist/components/Table/tests/Table.test.stories.js +93 -0
  179. package/dist/components/Tabs/tests/Tabs.stories.js +4 -4
  180. package/dist/components/Tabs/tests/Tabs.test.stories.d.ts +28 -0
  181. package/dist/components/Tabs/tests/Tabs.test.stories.js +128 -0
  182. package/dist/components/Text/tests/Text.stories.d.ts +28 -7
  183. package/dist/components/Text/tests/Text.stories.js +148 -125
  184. package/dist/components/Text/tests/Text.test.stories.d.ts +18 -0
  185. package/dist/components/Text/tests/Text.test.stories.js +49 -0
  186. package/dist/components/TextArea/TextArea.module.css +1 -1
  187. package/dist/components/TextArea/tests/TextArea.stories.js +1 -1
  188. package/dist/components/TextArea/tests/TextArea.test.stories.d.ts +29 -0
  189. package/dist/components/TextArea/tests/TextArea.test.stories.js +99 -0
  190. package/dist/components/TextField/tests/TextField.stories.js +1 -1
  191. package/dist/components/TextField/tests/TextField.test.stories.d.ts +29 -0
  192. package/dist/components/TextField/tests/TextField.test.stories.js +99 -0
  193. package/dist/components/Theme/tests/Theme.test.stories.d.ts +24 -0
  194. package/dist/components/Theme/tests/Theme.test.stories.js +133 -0
  195. package/dist/components/Timeline/tests/Timeline.test.stories.d.ts +18 -0
  196. package/dist/components/Timeline/tests/Timeline.test.stories.js +32 -0
  197. package/dist/components/Toast/tests/Toast.test.stories.d.ts +16 -0
  198. package/dist/components/Toast/tests/Toast.test.stories.js +101 -0
  199. package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -14
  200. package/dist/components/Tooltip/tests/Tooltip.test.stories.d.ts +19 -0
  201. package/dist/components/Tooltip/tests/Tooltip.test.stories.js +40 -0
  202. package/dist/components/View/View.js +1 -2
  203. package/dist/components/View/tests/View.stories.d.ts +112 -28
  204. package/dist/components/View/tests/View.stories.js +1092 -1012
  205. package/dist/components/View/tests/View.test.stories.d.ts +20 -0
  206. package/dist/components/View/tests/View.test.stories.js +50 -0
  207. package/dist/components/_private/Flyout/FlyoutContent.js +1 -1
  208. package/dist/components/_private/Flyout/tests/Flyout.stories.js +4 -4
  209. package/dist/components/_private/Flyout/tests/Flyout.test.stories.d.ts +28 -0
  210. package/dist/components/_private/Flyout/tests/Flyout.test.stories.js +205 -0
  211. package/dist/components/_private/Portal/tests/Portal.stories.js +1 -1
  212. package/dist/hooks/_private/useSingletonHotkeys.d.ts +3 -3
  213. package/dist/hooks/_private/useSingletonHotkeys.js +1 -1
  214. package/dist/hooks/tests/useDrag.stories.js +1 -0
  215. package/dist/hooks/tests/useDrag.test.stories.d.ts +26 -0
  216. package/dist/hooks/tests/useDrag.test.stories.js +120 -0
  217. package/dist/hooks/tests/useElementId.stories.d.ts +6 -0
  218. package/dist/hooks/tests/useElementId.stories.js +19 -0
  219. package/dist/hooks/tests/useHotkeys.test.stories.d.ts +39 -0
  220. package/dist/hooks/tests/useHotkeys.test.stories.js +119 -0
  221. package/dist/hooks/tests/useRTL.stories.d.ts +6 -0
  222. package/dist/hooks/tests/useRTL.stories.js +25 -0
  223. package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +9 -1
  224. package/dist/hooks/tests/useResponsiveClientValue.stories.js +22 -9
  225. package/dist/hooks/tests/useScrollLock.stories.d.ts +6 -0
  226. package/dist/hooks/tests/useScrollLock.stories.js +22 -0
  227. package/dist/hooks/tests/useToggle.stories.d.ts +8 -0
  228. package/dist/hooks/tests/useToggle.stories.js +54 -0
  229. package/dist/hooks/useHotkeys.js +0 -2
  230. package/dist/hooks/useScrollLock.d.ts +1 -0
  231. package/dist/hooks/useScrollLock.js +7 -3
  232. package/dist/tests/ShadowDOM.stories.js +1 -1
  233. package/dist/themes/_generator/tests/themes.stories.d.ts +3 -0
  234. package/dist/themes/_generator/tests/themes.stories.js +7 -11
  235. package/dist/themes/_generator/utilities/generateColors.d.ts +1 -1
  236. package/dist/themes/_generator/utilities/generateColors.js +3 -2
  237. package/dist/themes/slate/theme.css +1 -1
  238. package/dist/utilities/helpers.d.ts +1 -0
  239. package/dist/utilities/helpers.js +3 -0
  240. package/dist/utilities/scroll/lock.d.ts +1 -0
  241. package/dist/utilities/scroll/lock.js +3 -3
  242. package/dist/utilities/scroll/lockSafari.d.ts +1 -1
  243. package/dist/utilities/scroll/lockSafari.js +4 -5
  244. package/dist/utilities/scroll/lockStandard.d.ts +4 -1
  245. package/dist/utilities/scroll/lockStandard.js +7 -2
  246. package/dist/utilities/storybook/Example.js +1 -2
  247. package/package.json +20 -19
  248. package/dist/components/Theme/tests/Theme.stories.d.ts +0 -13
  249. package/dist/components/Theme/tests/Theme.stories.js +0 -80
  250. package/dist/utilities/storybook/Example.module.css +0 -1
@@ -1,8 +1,7 @@
1
+ import { expect } from "@storybook/test";
1
2
  import { Example } from "../../../utilities/storybook/index.js";
2
- import FormControl, { useFormControl } from "../index.js";
3
- import RadioGroup from "../../RadioGroup/index.js";
4
- import Radio from "../../Radio/index.js";
5
- import View from "../../View/index.js";
3
+ import FormControl from "../index.js";
4
+ import TextField from "../../TextField/index.js";
6
5
  export default {
7
6
  title: "Utilities/FormControl",
8
7
  component: FormControl,
@@ -12,74 +11,80 @@ export default {
12
11
  },
13
12
  },
14
13
  };
15
- const Input = () => {
16
- const { attributes } = useFormControl();
17
- return <input {...attributes}/>;
18
- };
19
- export const status = () => (<Example>
20
- <Example.Item title="status: default">
21
- <FormControl>
22
- <FormControl.Label>Label</FormControl.Label>
23
- <Input />
24
- <FormControl.Helper>Caption</FormControl.Helper>
25
- <FormControl.Error>Error</FormControl.Error>
26
- </FormControl>
27
- </Example.Item>
14
+ export const status = {
15
+ name: "status",
16
+ render: () => (<Example>
17
+ <Example.Item title="status: default">
18
+ <FormControl>
19
+ <FormControl.Label>Label</FormControl.Label>
20
+ <TextField name="name"/>
21
+ <FormControl.Helper>Caption</FormControl.Helper>
22
+ <FormControl.Error>Error</FormControl.Error>
23
+ </FormControl>
24
+ </Example.Item>
28
25
 
29
- <Example.Item title="status: error">
30
- <FormControl hasError>
31
- <FormControl.Label>Label</FormControl.Label>
32
- <Input />
33
- <FormControl.Helper>Caption</FormControl.Helper>
34
- <FormControl.Error>Error</FormControl.Error>
35
- </FormControl>
36
- </Example.Item>
37
- </Example>);
38
- export const size = () => (<Example>
39
- <Example.Item title="size: medium">
40
- <FormControl size="medium">
41
- <FormControl.Label>Label</FormControl.Label>
42
- <Input />
43
- <FormControl.Helper>Caption</FormControl.Helper>
44
- </FormControl>
45
- </Example.Item>
46
- <Example.Item title="size: large">
47
- <FormControl size="large">
48
- <FormControl.Label>Label</FormControl.Label>
49
- <Input />
50
- <FormControl.Helper>Caption</FormControl.Helper>
51
- </FormControl>
52
- </Example.Item>
53
- </Example>);
54
- export const disabled = () => (<Example>
55
- <Example.Item title="disabled">
56
- <FormControl disabled>
57
- <FormControl.Label>Label</FormControl.Label>
58
- <Input />
59
- <FormControl.Helper>Caption</FormControl.Helper>
60
- </FormControl>
61
- </Example.Item>
62
- </Example>);
63
- export const required = () => (<Example>
64
- <Example.Item title="required">
65
- <FormControl required>
66
- <FormControl.Label>Label</FormControl.Label>
67
- <Input />
68
- <FormControl.Helper>Caption</FormControl.Helper>
69
- </FormControl>
70
- </Example.Item>
71
- </Example>);
72
- export const group = () => (<Example>
73
- <Example.Item title="form group">
74
- <FormControl group>
75
- <FormControl.Label>Favorite animals:</FormControl.Label>
26
+ <Example.Item title="status: error">
27
+ <FormControl hasError>
28
+ <FormControl.Label>Label</FormControl.Label>
29
+ <TextField name="name"/>
30
+ <FormControl.Helper>Caption</FormControl.Helper>
31
+ <FormControl.Error>Error</FormControl.Error>
32
+ </FormControl>
33
+ </Example.Item>
34
+ </Example>),
35
+ play: ({ canvas }) => {
36
+ const inputs = canvas.getAllByRole("textbox");
37
+ expect(inputs[0]).toHaveAccessibleName("Label");
38
+ expect(inputs[0]).toHaveAccessibleDescription("Caption");
39
+ expect(inputs[1]).toHaveAccessibleName("Label");
40
+ expect(inputs[1]).toHaveAccessibleDescription("Caption Error");
41
+ },
42
+ };
43
+ export const size = {
44
+ name: "size",
45
+ render: () => (<Example>
46
+ <Example.Item title="size: medium">
47
+ <FormControl size="medium">
48
+ <FormControl.Label>Label</FormControl.Label>
49
+ <TextField name="name"/>
50
+ <FormControl.Helper>Caption</FormControl.Helper>
51
+ </FormControl>
52
+ </Example.Item>
76
53
 
77
- <RadioGroup name="animalGroup">
78
- <View gap={2}>
79
- <Radio value="dog">Dog</Radio>
80
- <Radio value="cat">Cat</Radio>
81
- </View>
82
- </RadioGroup>
83
- </FormControl>
84
- </Example.Item>
85
- </Example>);
54
+ <Example.Item title="size: large">
55
+ <FormControl size="large">
56
+ <FormControl.Label>Label</FormControl.Label>
57
+ <TextField name="name" size="large"/>
58
+ <FormControl.Helper>Caption</FormControl.Helper>
59
+ </FormControl>
60
+ </Example.Item>
61
+ </Example>),
62
+ };
63
+ export const disabled = {
64
+ name: "disabled",
65
+ render: () => (<Example>
66
+ <Example.Item title="disabled">
67
+ <FormControl disabled>
68
+ <FormControl.Label>Label</FormControl.Label>
69
+ <TextField name="name"/>
70
+ <FormControl.Helper>Caption</FormControl.Helper>
71
+ </FormControl>
72
+ </Example.Item>
73
+ </Example>),
74
+ play: ({ canvas }) => {
75
+ const input = canvas.getByRole("textbox");
76
+ expect(input).toBeDisabled();
77
+ },
78
+ };
79
+ export const required = {
80
+ name: "required",
81
+ render: () => (<Example>
82
+ <Example.Item title="required">
83
+ <FormControl required>
84
+ <FormControl.Label>Label</FormControl.Label>
85
+ <TextField name="name"/>
86
+ <FormControl.Helper>Caption</FormControl.Helper>
87
+ </FormControl>
88
+ </Example.Item>
89
+ </Example>),
90
+ };
@@ -0,0 +1,20 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ declare const _default: {
3
+ title: string;
4
+ component: import("react").ComponentType<import("./..").FormControlProps> & {
5
+ Label: React.ComponentType<import("../FormControl.types").LabelProps>;
6
+ Helper: React.ComponentType<import("../FormControl.types").CaptionProps>;
7
+ Error: React.ComponentType<import("../FormControl.types").CaptionProps>;
8
+ };
9
+ parameters: {
10
+ iframe: {
11
+ url: string;
12
+ };
13
+ chromatic: {
14
+ disableSnapshot: boolean;
15
+ };
16
+ };
17
+ };
18
+ export default _default;
19
+ export declare const className: StoryObj;
20
+ export declare const group: StoryObj;
@@ -0,0 +1,49 @@
1
+ import { expect } from "@storybook/test";
2
+ import FormControl from "../index.js";
3
+ import Radio from "../../Radio/index.js";
4
+ import RadioGroup from "../../RadioGroup/index.js";
5
+ import TextField from "../../TextField/index.js";
6
+ import View from "../../View/index.js";
7
+ export default {
8
+ title: "Utilities/FormControl/tests",
9
+ component: FormControl,
10
+ parameters: {
11
+ iframe: {
12
+ url: "https://reshaped.so/docs/utilities/form-control",
13
+ },
14
+ chromatic: { disableSnapshot: true },
15
+ },
16
+ };
17
+ export const className = {
18
+ name: "id",
19
+ render: () => (<FormControl id="test-id" hasError>
20
+ <FormControl.Label>Label</FormControl.Label>
21
+ <TextField name="name"/>
22
+ <FormControl.Helper>Caption</FormControl.Helper>
23
+ <FormControl.Error>Error</FormControl.Error>
24
+ </FormControl>),
25
+ play: async ({ canvas }) => {
26
+ const input = canvas.getByRole("textbox");
27
+ const label = canvas.getByText("Label");
28
+ expect(input).toHaveAttribute("id", "test-id");
29
+ expect(input).toHaveAttribute("aria-describedby", `test-id-caption test-id-error`);
30
+ expect(label).toHaveAttribute("for", "test-id");
31
+ expect(label).toHaveAttribute("id", `test-id-label`);
32
+ },
33
+ };
34
+ export const group = {
35
+ name: "group",
36
+ render: () => (<FormControl group>
37
+ <FormControl.Label>Label</FormControl.Label>
38
+ <RadioGroup name="name">
39
+ <View gap={2}>
40
+ <Radio value="1">One</Radio>
41
+ <Radio value="2">Two</Radio>
42
+ </View>
43
+ </RadioGroup>
44
+ </FormControl>),
45
+ play: async ({ canvas }) => {
46
+ const group = canvas.getByRole("group");
47
+ expect(group).toBeInTheDocument();
48
+ },
49
+ };
@@ -11,8 +11,23 @@ declare const _default: {
11
11
  };
12
12
  };
13
13
  export default _default;
14
- export declare const base: () => import("react").JSX.Element;
15
- export declare const layout: () => import("react").JSX.Element;
16
- export declare const itemLayout: () => import("react").JSX.Element;
17
- export declare const areas: () => import("react").JSX.Element;
18
- export declare const auto: () => import("react").JSX.Element;
14
+ export declare const base: {
15
+ name: string;
16
+ render: () => import("react").JSX.Element;
17
+ };
18
+ export declare const layout: {
19
+ name: string;
20
+ render: () => import("react").JSX.Element;
21
+ };
22
+ export declare const itemLayout: {
23
+ name: string;
24
+ render: () => import("react").JSX.Element;
25
+ };
26
+ export declare const areas: {
27
+ name: string;
28
+ render: () => import("react").JSX.Element;
29
+ };
30
+ export declare const auto: {
31
+ name: string;
32
+ render: () => import("react").JSX.Element;
33
+ };
@@ -10,161 +10,176 @@ export default {
10
10
  },
11
11
  },
12
12
  };
13
- export const base = () => (<Example>
14
- <Example.Item title="gap: 2">
15
- <Grid gap={2} columns={2}>
16
- {[1, 2].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
17
- {i}
18
- </View>))}
19
- </Grid>
20
- </Example.Item>
21
- <Example.Item title="align: center">
22
- <Grid gap={2} columns={2} align="center">
23
- <View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
24
- 1
25
- </View>
26
- <View backgroundColor="neutral-faded" borderRadius="medium" padding={8}>
27
- 2
28
- </View>
29
- </Grid>
30
- </Example.Item>
31
- <Example.Item title="justify: center">
32
- <Grid gap={2} columns="200px 200px" justify="center">
33
- <View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
34
- 1
35
- </View>
36
- <View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
37
- 2
38
- </View>
39
- </Grid>
40
- </Example.Item>
41
- </Example>);
42
- export const layout = () => (<Example>
43
- <Example.Item title="simple: 2 rows, 3 columns">
44
- <Grid gap={4} columns={3} rows={2}>
45
- {[1, 2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
46
- {i}
47
- </View>))}
48
- </Grid>
49
- </Example.Item>
50
- <Example.Item title="columns template, 1fr 2fr 1fr">
51
- <Grid gap={4} columns="1fr 2fr 1fr" rows={2}>
52
- {[1, 2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
53
- {i}
54
- </View>))}
55
- </Grid>
56
- </Example.Item>
57
- <Example.Item title="rows template, 1fr 2fr">
58
- <Grid gap={4} columns={3} rows="1fr 2fr">
59
- {[1, 2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
60
- {i}
61
- </View>))}
62
- </Grid>
63
- </Example.Item>
64
- <Example.Item title="responsive">
65
- <Grid gap={4} columns={{ s: 3, m: "1fr 2fr 1fr" }} rows={{ s: 2, m: "1fr 2fr" }}>
66
- {[1, 2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
67
- {i}
68
- </View>))}
69
- </Grid>
70
- </Example.Item>
71
- </Example>);
72
- export const itemLayout = () => (<Example>
73
- <Example.Item title="column, start 1, end 3">
74
- <Grid gap={4} columns={3} rows={2}>
75
- <Grid.Item colStart={1} colEnd={3}>
76
- <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
13
+ export const base = {
14
+ name: "gap, align, justify",
15
+ render: () => (<Example>
16
+ <Example.Item title="gap: 2">
17
+ <Grid gap={2} columns={2}>
18
+ {[1, 2].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
19
+ {i}
20
+ </View>))}
21
+ </Grid>
22
+ </Example.Item>
23
+ <Example.Item title="align: center">
24
+ <Grid gap={2} columns={2} align="center">
25
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
77
26
  1
78
27
  </View>
79
- </Grid.Item>
80
- {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
81
- {i}
82
- </View>))}
83
- </Grid>
84
- </Example.Item>
85
- <Example.Item title="column, start 1, span 2">
86
- <Grid gap={4} columns={3} rows={2}>
87
- <Grid.Item colStart={1} colSpan={2}>
88
- <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
89
- 1
28
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={8}>
29
+ 2
90
30
  </View>
91
- </Grid.Item>
92
- {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
93
- {i}
94
- </View>))}
95
- </Grid>
96
- </Example.Item>
97
-
98
- <Example.Item title="row, start 1, end 3">
99
- <Grid gap={4} columns={3} rows={2}>
100
- <Grid.Item rowStart={1} rowEnd={3}>
101
- <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
31
+ </Grid>
32
+ </Example.Item>
33
+ <Example.Item title="justify: center">
34
+ <Grid gap={2} columns="200px 200px" justify="center">
35
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
102
36
  1
103
37
  </View>
104
- </Grid.Item>
105
- {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
106
- {i}
107
- </View>))}
108
- </Grid>
109
- </Example.Item>
110
-
111
- <Example.Item title="row, start 1, span 2">
112
- <Grid gap={4} columns={3} rows={2}>
113
- <Grid.Item rowStart={1} rowSpan={2}>
114
- <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
115
- 1
38
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
39
+ 2
116
40
  </View>
117
- </Grid.Item>
118
- {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
119
- {i}
120
- </View>))}
121
- </Grid>
122
- </Example.Item>
41
+ </Grid>
42
+ </Example.Item>
43
+ </Example>),
44
+ };
45
+ export const layout = {
46
+ name: "rows, columns",
47
+ render: () => (<Example>
48
+ <Example.Item title="simple: 2 rows, 3 columns">
49
+ <Grid gap={4} columns={3} rows={2}>
50
+ {[1, 2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
51
+ {i}
52
+ </View>))}
53
+ </Grid>
54
+ </Example.Item>
55
+ <Example.Item title="columns template, 1fr 2fr 1fr">
56
+ <Grid gap={4} columns="1fr 2fr 1fr" rows={2}>
57
+ {[1, 2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
58
+ {i}
59
+ </View>))}
60
+ </Grid>
61
+ </Example.Item>
62
+ <Example.Item title="rows template, 1fr 2fr">
63
+ <Grid gap={4} columns={3} rows="1fr 2fr">
64
+ {[1, 2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
65
+ {i}
66
+ </View>))}
67
+ </Grid>
68
+ </Example.Item>
69
+ <Example.Item title="responsive">
70
+ <Grid gap={4} columns={{ s: 3, m: "1fr 2fr 1fr" }} rows={{ s: 2, m: "1fr 2fr" }}>
71
+ {[1, 2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
72
+ {i}
73
+ </View>))}
74
+ </Grid>
75
+ </Example.Item>
76
+ </Example>),
77
+ };
78
+ export const itemLayout = {
79
+ name: "colStart, colEnd, rowStart, rowEnd",
80
+ render: () => (<Example>
81
+ <Example.Item title="column, start 1, end 3">
82
+ <Grid gap={4} columns={3} rows={2}>
83
+ <Grid.Item colStart={1} colEnd={3}>
84
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
85
+ 1
86
+ </View>
87
+ </Grid.Item>
88
+ {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
89
+ {i}
90
+ </View>))}
91
+ </Grid>
92
+ </Example.Item>
93
+ <Example.Item title="column, start 1, span 2">
94
+ <Grid gap={4} columns={3} rows={2}>
95
+ <Grid.Item colStart={1} colSpan={2}>
96
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
97
+ 1
98
+ </View>
99
+ </Grid.Item>
100
+ {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
101
+ {i}
102
+ </View>))}
103
+ </Grid>
104
+ </Example.Item>
123
105
 
124
- <Example.Item title="responsive">
125
- <Grid gap={4} columns={3} rows={2}>
126
- <Grid.Item rowStart={1} rowSpan={{ s: 1, m: 2 }} colStart={1} colSpan={{ s: 1, m: 2 }}>
127
- <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
128
- 1
129
- </View>
130
- </Grid.Item>
131
- {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
132
- {i}
133
- </View>))}
134
- </Grid>
135
- </Example.Item>
136
- </Example>);
137
- export const areas = () => (<Example>
138
- <Example.Item title="simple: 2 rows, 3 columns">
139
- <Grid gap={4} rows={2} areas={["a .", "a b"]}>
140
- {["a", "b"].map((area) => (<Grid.Item area={area} key={area}>
106
+ <Example.Item title="row, start 1, end 3">
107
+ <Grid gap={4} columns={3} rows={2}>
108
+ <Grid.Item rowStart={1} rowEnd={3}>
109
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
110
+ 1
111
+ </View>
112
+ </Grid.Item>
113
+ {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
114
+ {i}
115
+ </View>))}
116
+ </Grid>
117
+ </Example.Item>
118
+
119
+ <Example.Item title="row, start 1, span 2">
120
+ <Grid gap={4} columns={3} rows={2}>
121
+ <Grid.Item rowStart={1} rowSpan={2}>
122
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
123
+ 1
124
+ </View>
125
+ </Grid.Item>
126
+ {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
127
+ {i}
128
+ </View>))}
129
+ </Grid>
130
+ </Example.Item>
131
+
132
+ <Example.Item title="responsive">
133
+ <Grid gap={4} columns={3} rows={2}>
134
+ <Grid.Item rowStart={1} rowSpan={{ s: 1, m: 2 }} colStart={1} colSpan={{ s: 1, m: 2 }}>
141
135
  <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
142
- {area}
136
+ 1
143
137
  </View>
144
- </Grid.Item>))}
145
- </Grid>
146
- </Example.Item>
147
- </Example>);
148
- export const auto = () => (<Example>
149
- <Example.Item title="auto flow: column">
150
- <Grid gap={4} autoFlow="column" rows={2} columns={2}>
151
- {[1, 2, 3].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
152
- {i}
153
- </View>))}
154
- </Grid>
155
- </Example.Item>
156
- <Example.Item title="auto rows">
157
- <Grid gap={4} autoRows="100px" columns={2}>
158
- {[1, 2, 3].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
159
- {i}
160
- </View>))}
161
- </Grid>
162
- </Example.Item>
163
- <Example.Item title="auto columns">
164
- <Grid gap={4} autoColumns="100px" autoFlow="column">
165
- {[1, 2, 3].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
166
- {i}
167
- </View>))}
168
- </Grid>
169
- </Example.Item>
170
- </Example>);
138
+ </Grid.Item>
139
+ {[2, 3, 4, 5].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
140
+ {i}
141
+ </View>))}
142
+ </Grid>
143
+ </Example.Item>
144
+ </Example>),
145
+ };
146
+ export const areas = {
147
+ name: "areas",
148
+ render: () => (<Example>
149
+ <Example.Item title="simple: 2 rows, 3 columns">
150
+ <Grid gap={4} rows={2} areas={["a .", "a b"]}>
151
+ {["a", "b"].map((area) => (<Grid.Item area={area} key={area}>
152
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4} height="100%">
153
+ {area}
154
+ </View>
155
+ </Grid.Item>))}
156
+ </Grid>
157
+ </Example.Item>
158
+ </Example>),
159
+ };
160
+ export const auto = {
161
+ name: "autoFlow, autoColumns, autoRows",
162
+ render: () => (<Example>
163
+ <Example.Item title="auto flow: column">
164
+ <Grid gap={4} autoFlow="column" rows={2} columns={2}>
165
+ {[1, 2, 3].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
166
+ {i}
167
+ </View>))}
168
+ </Grid>
169
+ </Example.Item>
170
+ <Example.Item title="auto rows">
171
+ <Grid gap={4} autoRows="100px" columns={2}>
172
+ {[1, 2, 3].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
173
+ {i}
174
+ </View>))}
175
+ </Grid>
176
+ </Example.Item>
177
+ <Example.Item title="auto columns">
178
+ <Grid gap={4} autoColumns="100px" autoFlow="column">
179
+ {[1, 2, 3].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
180
+ {i}
181
+ </View>))}
182
+ </Grid>
183
+ </Example.Item>
184
+ </Example>),
185
+ };
@@ -0,0 +1,19 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ declare const _default: {
3
+ title: string;
4
+ component: {
5
+ <As extends keyof React.JSX.IntrinsicElements = "div">(props: import("./..").GridProps<As>): import("react").JSX.Element;
6
+ Item: <As extends keyof React.JSX.IntrinsicElements = "div">(props: import("./..").GridItemProps<As>) => import("react").JSX.Element;
7
+ };
8
+ parameters: {
9
+ iframe: {
10
+ url: string;
11
+ };
12
+ chromatic: {
13
+ disableSnapshot: boolean;
14
+ };
15
+ };
16
+ };
17
+ export default _default;
18
+ export declare const as: StoryObj;
19
+ export declare const className: StoryObj;
@@ -0,0 +1,42 @@
1
+ import { expect } from "@storybook/test";
2
+ import Grid from "../index.js";
3
+ export default {
4
+ title: "Utilities/Grid/tests",
5
+ component: Grid,
6
+ parameters: {
7
+ iframe: {
8
+ url: "https://reshaped.so/docs/utilities/grid",
9
+ },
10
+ chromatic: { disableSnapshot: true },
11
+ },
12
+ };
13
+ export const as = {
14
+ name: "as",
15
+ render: () => (<Grid as="ul">
16
+ <Grid.Item as="li">Content</Grid.Item>
17
+ </Grid>),
18
+ play: ({ canvas }) => {
19
+ const ul = canvas.getByRole("list");
20
+ const li = canvas.getByRole("listitem");
21
+ expect(ul).toBeInTheDocument();
22
+ expect(li).toBeInTheDocument();
23
+ },
24
+ };
25
+ export const className = {
26
+ name: "className, attributes",
27
+ render: () => (<div data-testid="root">
28
+ <Grid className="test-class" attributes={{ id: "test-id" }}>
29
+ <Grid.Item className="test-item-class" attributes={{ id: "test-item-id" }}>
30
+ Content
31
+ </Grid.Item>
32
+ </Grid>
33
+ </div>),
34
+ play: async ({ canvas }) => {
35
+ const root = canvas.getByTestId("root").firstChild;
36
+ const item = root?.firstChild;
37
+ expect(root).toHaveAttribute("id", "test-id");
38
+ expect(root).toHaveClass("test-class");
39
+ expect(item).toHaveAttribute("id", "test-item-id");
40
+ expect(item).toHaveClass("test-item-class");
41
+ },
42
+ };
@@ -8,4 +8,7 @@ declare const _default: {
8
8
  };
9
9
  };
10
10
  export default _default;
11
- export declare const visibility: () => import("react").JSX.Element;
11
+ export declare const visibility: {
12
+ name: string;
13
+ render: () => import("react").JSX.Element;
14
+ };