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
@@ -0,0 +1,22 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ import { fn } from "@storybook/test";
3
+ declare const _default: {
4
+ title: string;
5
+ component: (props: import("./..").RadioGroupProps) => import("react").JSX.Element;
6
+ parameters: {
7
+ iframe: {
8
+ url: string;
9
+ };
10
+ chromatic: {
11
+ disableSnapshot: boolean;
12
+ };
13
+ };
14
+ };
15
+ export default _default;
16
+ export declare const value: StoryObj<{
17
+ handleChange: ReturnType<typeof fn>;
18
+ }>;
19
+ export declare const defaultValue: StoryObj<{
20
+ handleChange: ReturnType<typeof fn>;
21
+ }>;
22
+ export declare const disabled: StoryObj;
@@ -0,0 +1,78 @@
1
+ import { fn, userEvent, expect } from "@storybook/test";
2
+ import RadioGroup from "../index.js";
3
+ import Radio from "../../Radio/index.js";
4
+ export default {
5
+ title: "Components/RadioGroup/tests",
6
+ component: RadioGroup,
7
+ parameters: {
8
+ iframe: {
9
+ url: "https://reshaped.so/docs/components/radio",
10
+ },
11
+ chromatic: { disableSnapshot: true },
12
+ },
13
+ };
14
+ export const value = {
15
+ name: "value, controlled",
16
+ args: {
17
+ handleChange: fn(),
18
+ },
19
+ render: (args) => (<RadioGroup name="test-name" value="1" onChange={args.handleChange}>
20
+ {/* checked should be ignored */}
21
+ <Radio value="1" checked={false}>
22
+ Content
23
+ </Radio>
24
+
25
+ <Radio value="2">Content 2</Radio>
26
+ </RadioGroup>),
27
+ play: async ({ canvas, args }) => {
28
+ const inputs = canvas.getAllByRole("radio");
29
+ expect(inputs[0]).toBeChecked();
30
+ await userEvent.click(inputs[1]);
31
+ expect(args.handleChange).toHaveBeenCalledTimes(1);
32
+ expect(args.handleChange).toHaveBeenCalledWith({
33
+ name: "test-name",
34
+ value: "2",
35
+ event: expect.objectContaining({ target: inputs[1] }),
36
+ });
37
+ // Still checked because it's controlled
38
+ expect(inputs[0]).toBeChecked();
39
+ expect(inputs[1]).not.toBeChecked();
40
+ },
41
+ };
42
+ export const defaultValue = {
43
+ name: "defaultValue, uncontrolled",
44
+ args: {
45
+ handleChange: fn(),
46
+ },
47
+ render: (args) => (<RadioGroup name="test-name" defaultValue="1" onChange={args.handleChange}>
48
+ {/* checked should be ignored */}
49
+ <Radio value="1" checked={false}>
50
+ Content
51
+ </Radio>
52
+
53
+ <Radio value="2">Content 2</Radio>
54
+ </RadioGroup>),
55
+ play: async ({ canvas, args }) => {
56
+ const inputs = canvas.getAllByRole("radio");
57
+ expect(inputs[0]).toBeChecked();
58
+ await userEvent.click(inputs[1]);
59
+ expect(args.handleChange).toHaveBeenCalledTimes(1);
60
+ expect(args.handleChange).toHaveBeenCalledWith({
61
+ name: "test-name",
62
+ value: "2",
63
+ event: expect.objectContaining({ target: inputs[1] }),
64
+ });
65
+ expect(inputs[0]).not.toBeChecked();
66
+ expect(inputs[1]).toBeChecked();
67
+ },
68
+ };
69
+ export const disabled = {
70
+ name: "disabled",
71
+ render: () => (<RadioGroup name="test-name" disabled>
72
+ <Radio value="test-value">Content</Radio>
73
+ </RadioGroup>),
74
+ play: async ({ canvas }) => {
75
+ const input = canvas.getByRole("radio");
76
+ expect(input).toBeDisabled();
77
+ },
78
+ };
@@ -0,0 +1,33 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ declare const _default: {
3
+ title: string;
4
+ parameters: {
5
+ disableWrapper: boolean;
6
+ };
7
+ };
8
+ export default _default;
9
+ export declare const rtl: {
10
+ name: string;
11
+ render: () => import("react").JSX.Element;
12
+ };
13
+ export declare const lightMode: {
14
+ name: string;
15
+ render: () => import("react").JSX.Element;
16
+ play: () => void;
17
+ };
18
+ export declare const darkMode: {
19
+ name: string;
20
+ render: () => import("react").JSX.Element;
21
+ play: () => void;
22
+ };
23
+ export declare const scoped: {
24
+ name: string;
25
+ render: () => import("react").JSX.Element;
26
+ play: () => Promise<void>;
27
+ };
28
+ export declare const testScoped: StoryObj;
29
+ export declare const keyboardMode: {
30
+ name: string;
31
+ render: () => import("react").JSX.Element;
32
+ play: () => Promise<void>;
33
+ };
@@ -0,0 +1,88 @@
1
+ import { expect, userEvent } from "@storybook/test";
2
+ import { useTheme } from "../../Theme/index.js";
3
+ import Button from "../../Button/index.js";
4
+ import Reshaped from "../Reshaped.js";
5
+ export default {
6
+ title: "Utilities/Reshaped",
7
+ parameters: {
8
+ disableWrapper: true,
9
+ },
10
+ };
11
+ export const rtl = {
12
+ name: "defaultRTL",
13
+ render: () => (<Reshaped defaultRTL theme="reshaped" defaultColorMode="dark">
14
+ Hello
15
+ </Reshaped>),
16
+ };
17
+ export const lightMode = {
18
+ name: "defaultColorMode=light",
19
+ render: () => <Reshaped theme="reshaped">Hello</Reshaped>,
20
+ play: () => {
21
+ const theme = document.documentElement.getAttribute("data-rs-theme");
22
+ const colorMode = document.documentElement.getAttribute("data-rs-color-mode");
23
+ expect(theme).toEqual("reshaped");
24
+ expect(colorMode).toEqual("light");
25
+ },
26
+ };
27
+ export const darkMode = {
28
+ name: "defaultColorMode=dark",
29
+ render: () => (<Reshaped theme="reshaped" defaultColorMode="dark">
30
+ Hello
31
+ </Reshaped>),
32
+ play: () => {
33
+ const theme = document.documentElement.getAttribute("data-rs-theme");
34
+ const colorMode = document.documentElement.getAttribute("data-rs-color-mode");
35
+ expect(theme).toEqual("reshaped");
36
+ expect(colorMode).toEqual("dark");
37
+ },
38
+ };
39
+ export const scoped = {
40
+ name: "scoped",
41
+ render: () => (<Reshaped theme="reshaped" defaultColorMode="dark" scoped>
42
+ Hello
43
+ </Reshaped>),
44
+ play: async () => {
45
+ const root = document.querySelector("[data-rs-root]");
46
+ expect(root).toBeInTheDocument();
47
+ expect(root).not.toBe(document.documentElement);
48
+ expect(root).toHaveAttribute("data-rs-theme", "reshaped");
49
+ expect(document.documentElement).not.toHaveAttribute("data-rs-theme");
50
+ },
51
+ };
52
+ const ScopedComponent = () => {
53
+ const { invertColorMode } = useTheme();
54
+ return <Button onClick={invertColorMode}>Invert</Button>;
55
+ };
56
+ export const testScoped = {
57
+ name: "test: scoped switch",
58
+ render: () => (<Reshaped theme="reshaped">
59
+ <Reshaped theme="slate" scoped>
60
+ <ScopedComponent />
61
+ </Reshaped>
62
+ </Reshaped>),
63
+ play: async ({ canvas }) => {
64
+ const nestedRoot = document.querySelector("[data-rs-root]");
65
+ const button = canvas.getAllByRole("button")[0];
66
+ expect(document.documentElement).toHaveAttribute("data-rs-theme", "reshaped");
67
+ expect(document.documentElement).toHaveAttribute("data-rs-color-mode", "light");
68
+ expect(nestedRoot).toHaveAttribute("data-rs-theme", "slate");
69
+ expect(nestedRoot).toHaveAttribute("data-rs-color-mode", "light");
70
+ await userEvent.click(button);
71
+ expect(document.documentElement).toHaveAttribute("data-rs-color-mode", "light");
72
+ expect(nestedRoot).toHaveAttribute("data-rs-color-mode", "dark");
73
+ },
74
+ };
75
+ export const keyboardMode = {
76
+ name: "test: keyboard mode",
77
+ render: () => (<Reshaped theme="reshaped" defaultColorMode="dark">
78
+ Hello
79
+ </Reshaped>),
80
+ play: async () => {
81
+ const attribute = "data-rs-keyboard";
82
+ expect(document.documentElement).not.toHaveAttribute(attribute);
83
+ await userEvent.keyboard("{Tab/}");
84
+ expect(document.documentElement).toHaveAttribute(attribute);
85
+ await userEvent.click(document.body);
86
+ expect(document.documentElement).not.toHaveAttribute(attribute);
87
+ },
88
+ };
@@ -19,6 +19,7 @@ const PrivateResizableHandle = (props) => {
19
19
  return (_jsx(View.Item, { className: handleClassNames, attributes: {
20
20
  role: "button",
21
21
  tabIndex: 0,
22
+ "aria-hidden": true,
22
23
  ref: (el) => {
23
24
  // @ts-ignore
24
25
  ref.current = el;
@@ -9,6 +9,9 @@ declare const _default: {
9
9
  iframe: {
10
10
  url: string;
11
11
  };
12
+ a11y: {
13
+ disable: boolean;
14
+ };
12
15
  };
13
16
  };
14
17
  export default _default;
@@ -9,6 +9,10 @@ export default {
9
9
  iframe: {
10
10
  url: "https://reshaped.so/docs/utilities/Resizable",
11
11
  },
12
+ // Skip because of the aria-hidden applied to buttons, they're not needed for the screen reader navigation
13
+ a11y: {
14
+ disable: true,
15
+ },
12
16
  },
13
17
  };
14
18
  export const base = () => (<Example>
@@ -0,0 +1,19 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ declare const _default: {
3
+ title: string;
4
+ component: {
5
+ (props: import("./..").ResizableProps): import("react").JSX.Element;
6
+ Item: import("react").FC<import("./..").ResizableItemProps>;
7
+ Handle: import("react").FC<import("./..").ResizableHandleProps>;
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;
@@ -0,0 +1,25 @@
1
+ import { expect } from "@storybook/test";
2
+ import Resizable from "../index.js";
3
+ export default {
4
+ title: "Components/Resizable/tests",
5
+ component: Resizable,
6
+ parameters: {
7
+ iframe: {
8
+ url: "https://reshaped.so/docs/utilities/Resizable",
9
+ },
10
+ chromatic: { disableSnapshot: true },
11
+ },
12
+ };
13
+ export const className = {
14
+ name: "className, attributes",
15
+ render: () => (<div data-testid="root">
16
+ <Resizable className="test-classname" attributes={{ id: "test-id" }}>
17
+ <Resizable.Item>Content</Resizable.Item>
18
+ </Resizable>
19
+ </div>),
20
+ play: async ({ canvas }) => {
21
+ const root = canvas.getByTestId("root").firstChild;
22
+ expect(root).toHaveClass("test-classname");
23
+ expect(root).toHaveAttribute("id", "test-id");
24
+ },
25
+ };
@@ -0,0 +1,15 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ declare const _default: {
3
+ title: string;
4
+ component: (props: import("./..").ScrimProps) => import("react").JSX.Element;
5
+ parameters: {
6
+ iframe: {
7
+ url: string;
8
+ };
9
+ chromatic: {
10
+ disableSnapshot: boolean;
11
+ };
12
+ };
13
+ };
14
+ export default _default;
15
+ export declare const className: StoryObj;
@@ -0,0 +1,25 @@
1
+ import { expect } from "@storybook/test";
2
+ import Scrim from "../index.js";
3
+ export default {
4
+ title: "Components/Scrim/tests",
5
+ component: Scrim,
6
+ parameters: {
7
+ iframe: {
8
+ url: "https://reshaped.so/docs/components/scrim",
9
+ },
10
+ chromatic: { disableSnapshot: true },
11
+ },
12
+ };
13
+ export const className = {
14
+ name: "className, attributes",
15
+ render: () => (<div data-testid="root">
16
+ <Scrim className="test-classname" attributes={{ id: "test-id" }}>
17
+ Content
18
+ </Scrim>
19
+ </div>),
20
+ play: async ({ canvas }) => {
21
+ const root = canvas.getByTestId("root").firstChild;
22
+ expect(root).toHaveClass("test-classname");
23
+ expect(root).toHaveAttribute("id", "test-id");
24
+ },
25
+ };
@@ -134,6 +134,6 @@ const ScrollArea = forwardRef((props, ref) => {
134
134
  observer.observe(contentEl);
135
135
  return () => observer.disconnect();
136
136
  }, [updateScroll]);
137
- return (_jsxs("div", { ...attributes, className: rootClassNames, style: rootVariables, children: [_jsx("div", { className: s.scrollable, ref: scrollableRef, onScroll: handleScroll, children: _jsx("div", { className: s.content, ref: contentRef, children: children }) }), scrollRatio.y < 1 && scrollbarDisplay !== "hidden" && (_jsx(ScrollAreaBar, { vertical: true, onThumbMove: handleThumbYMove, ratio: scrollRatio.y, position: scrollPosition.y })), scrollRatio.x < 1 && scrollbarDisplay !== "hidden" && (_jsx(ScrollAreaBar, { onThumbMove: handleThumbXMove, ratio: scrollRatio.x, position: scrollPosition.x }))] }));
137
+ return (_jsxs("div", { ...attributes, className: rootClassNames, style: rootVariables, children: [_jsx("div", { className: s.scrollable, ref: scrollableRef, onScroll: handleScroll, tabIndex: 0, children: _jsx("div", { className: s.content, ref: contentRef, children: children }) }), scrollRatio.y < 1 && scrollbarDisplay !== "hidden" && (_jsx(ScrollAreaBar, { vertical: true, onThumbMove: handleThumbYMove, ratio: scrollRatio.y, position: scrollPosition.y })), scrollRatio.x < 1 && scrollbarDisplay !== "hidden" && (_jsx(ScrollAreaBar, { onThumbMove: handleThumbXMove, ratio: scrollRatio.x, position: scrollPosition.x }))] }));
138
138
  });
139
139
  export default ScrollArea;
@@ -1 +1 @@
1
- .root{--rs-scroll-area-thumb-size:calc(var(--rs-unit-x1) * 1.5);--rs-scroll-area-thumb-offset:calc(var(--rs-unit-x1) / 2);overflow:hidden}.root,.scrollable{height:100%;position:relative}.scrollable{overflow:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}.scrollable::-webkit-scrollbar{display:none;height:0;width:0}.content{display:inline-block;min-height:100%;min-width:100%;vertical-align:top}.scrollbar{box-sizing:initial;padding:var(--rs-scroll-area-thumb-offset);position:absolute}.thumb{height:100%;position:relative;width:100%}.thumb:before{background:var(--rs-color-foreground-neutral);border-radius:999px;content:"";display:block;opacity:0;position:absolute;transition:opacity var(--rs-duration-fast) var(--rs-easing-standard)}.--scrollbar-y{inset-block:0;inset-inline-end:0;width:var(--rs-scroll-area-thumb-size)}.--scrollbar-y .thumb:before{height:calc(var(--rs-scroll-area-ratio) * 100%);inset-block-start:calc(var(--rs-scroll-area-position) * 100%);width:100%}.--scrollbar-x{height:var(--rs-scroll-area-thumb-size);inset-block-end:0;inset-inline:0}.--scrollbar-x .thumb:before{height:100%;inset-inline-start:calc(var(--rs-scroll-area-position) * 100%);width:calc(var(--rs-scroll-area-ratio) * 100%)}.--scrollbar-y:not(:last-child){inset-block-end:calc(var(--rs-scroll-area-thumb-size) + var(--rs-scroll-area-thumb-offset) * 2)}.--scrollbar-y~.--scrollbar-x{inset-inline-end:calc(var(--rs-scroll-area-thumb-size) + var(--rs-scroll-area-thumb-offset) * 2)}.--display-hover:hover>.scrollbar .thumb:before,.--display-visible .thumb:before{opacity:.2}.--display-hover:hover .--scrollbar-dragging .thumb:before,.--scrollbar-dragging .thumb:before,.scrollbar:hover .thumb:before{opacity:.32}
1
+ .root{--rs-scroll-area-thumb-size:calc(var(--rs-unit-x1) * 1.5);--rs-scroll-area-thumb-offset:calc(var(--rs-unit-x1) / 2);height:100%;overflow:hidden;position:relative}[data-rs-keyboard] .root:has(.scrollable:focus){box-shadow:var(--rs-focus-shadow)}.scrollable{height:100%;overflow:auto;position:relative;scrollbar-width:none;-webkit-overflow-scrolling:touch}.scrollable::-webkit-scrollbar{display:none;height:0;width:0}.content{display:inline-block;min-height:100%;min-width:100%;vertical-align:top}.scrollbar{box-sizing:initial;padding:var(--rs-scroll-area-thumb-offset);position:absolute}.thumb{height:100%;position:relative;width:100%}.thumb:before{background:var(--rs-color-foreground-neutral);border-radius:999px;content:"";display:block;opacity:0;position:absolute;transition:opacity var(--rs-duration-fast) var(--rs-easing-standard)}.--scrollbar-y{inset-block:0;inset-inline-end:0;width:var(--rs-scroll-area-thumb-size)}.--scrollbar-y .thumb:before{height:calc(var(--rs-scroll-area-ratio) * 100%);inset-block-start:calc(var(--rs-scroll-area-position) * 100%);width:100%}.--scrollbar-x{height:var(--rs-scroll-area-thumb-size);inset-block-end:0;inset-inline:0}.--scrollbar-x .thumb:before{height:100%;inset-inline-start:calc(var(--rs-scroll-area-position) * 100%);width:calc(var(--rs-scroll-area-ratio) * 100%)}.--scrollbar-y:not(:last-child){inset-block-end:calc(var(--rs-scroll-area-thumb-size) + var(--rs-scroll-area-thumb-offset) * 2)}.--scrollbar-y~.--scrollbar-x{inset-inline-end:calc(var(--rs-scroll-area-thumb-size) + var(--rs-scroll-area-thumb-offset) * 2)}.--display-hover:hover>.scrollbar .thumb:before,.--display-visible .thumb:before{opacity:.2}.--display-hover:hover .--scrollbar-dragging .thumb:before,.--scrollbar-dragging .thumb:before,.scrollbar:hover .thumb:before{opacity:.32}
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { StoryObj } from "@storybook/react";
2
3
  declare const _default: {
3
4
  title: string;
4
5
  component: React.ForwardRefExoticComponent<import("./..").ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
@@ -6,10 +7,22 @@ declare const _default: {
6
7
  iframe: {
7
8
  url: string;
8
9
  };
10
+ a11y: {
11
+ disable: boolean;
12
+ };
9
13
  };
10
14
  };
11
15
  export default _default;
12
- export declare const direction: () => React.JSX.Element;
13
- export declare const visibility: () => React.JSX.Element;
14
- export declare const ref: () => React.JSX.Element;
15
- export declare const edgeCases: () => React.JSX.Element;
16
+ export declare const direction: {
17
+ name: string;
18
+ render: () => React.JSX.Element;
19
+ };
20
+ export declare const visibility: {
21
+ name: string;
22
+ render: () => React.JSX.Element;
23
+ };
24
+ export declare const composition: {
25
+ name: string;
26
+ render: () => React.JSX.Element;
27
+ };
28
+ export declare const dynamicHeight: StoryObj;