reshaped 3.8.0-canary.7 → 3.8.0-canary.9

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 (214) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/bundle.css +1 -1
  3. package/dist/bundle.js +9 -9
  4. package/dist/components/Accordion/AccordionControlled.js +1 -0
  5. package/dist/components/Actionable/Actionable.js +1 -0
  6. package/dist/components/Actionable/Actionable.module.css +1 -1
  7. package/dist/components/Alert/tests/Alert.stories.d.ts +6 -5
  8. package/dist/components/Alert/tests/Alert.stories.js +15 -2
  9. package/dist/components/Badge/Badge.module.css +1 -1
  10. package/dist/components/Badge/tests/Badge.stories.d.ts +5 -0
  11. package/dist/components/Badge/tests/Badge.stories.js +34 -0
  12. package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -0
  13. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +8 -4
  14. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +57 -1
  15. package/dist/components/Button/tests/Button.stories.d.ts +54 -12
  16. package/dist/components/Button/tests/Button.stories.js +725 -588
  17. package/dist/components/Calendar/CalendarMonth.js +1 -0
  18. package/dist/components/Card/Card.module.css +1 -1
  19. package/dist/components/Card/tests/Card.stories.d.ts +28 -6
  20. package/dist/components/Card/tests/Card.stories.js +110 -65
  21. package/dist/components/Carousel/Carousel.js +1 -0
  22. package/dist/components/Carousel/Carousel.module.css +1 -1
  23. package/dist/components/Checkbox/Checkbox.module.css +1 -1
  24. package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +20 -4
  25. package/dist/components/Checkbox/tests/Checkbox.stories.js +150 -79
  26. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +9 -2
  27. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +67 -35
  28. package/dist/components/Container/tests/Container.stories.d.ts +2 -0
  29. package/dist/components/Container/tests/Container.stories.js +14 -0
  30. package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +10 -1
  31. package/dist/components/ContextMenu/tests/ContextMenu.stories.js +57 -13
  32. package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +5 -0
  33. package/dist/components/Dismissible/tests/Dismissible.stories.js +30 -1
  34. package/dist/components/Divider/tests/Divider.stories.d.ts +8 -3
  35. package/dist/components/Divider/tests/Divider.stories.js +71 -41
  36. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +35 -6
  37. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +222 -115
  38. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +0 -15
  39. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +0 -106
  40. package/dist/components/FileUpload/FileUpload.module.css +1 -1
  41. package/dist/components/Flyout/Flyout.module.css +1 -1
  42. package/dist/components/Flyout/FlyoutContent.js +3 -0
  43. package/dist/components/Flyout/FlyoutControlled.js +6 -1
  44. package/dist/components/Flyout/utilities/flyout.js +0 -1
  45. package/dist/components/FormControl/FormControl.context.d.ts +1 -1
  46. package/dist/components/FormControl/tests/FormControl.stories.d.ts +2 -0
  47. package/dist/components/FormControl/tests/FormControl.stories.js +35 -0
  48. package/dist/components/Hidden/tests/Hidden.stories.d.ts +2 -0
  49. package/dist/components/Hidden/tests/Hidden.stories.js +9 -0
  50. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +2 -0
  51. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +9 -0
  52. package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +2 -0
  53. package/dist/components/Hotkey/tests/Hotkey.stories.js +15 -0
  54. package/dist/components/Icon/tests/Icon.stories.d.ts +3 -0
  55. package/dist/components/Icon/tests/Icon.stories.js +23 -0
  56. package/dist/components/Link/tests/Link.stories.d.ts +28 -5
  57. package/dist/components/Link/tests/Link.stories.js +141 -58
  58. package/dist/components/Link/tests/Link.test.stories.d.ts +0 -13
  59. package/dist/components/Link/tests/Link.test.stories.js +0 -85
  60. package/dist/components/Loader/tests/Loader.stories.d.ts +11 -2
  61. package/dist/components/Loader/tests/Loader.stories.js +52 -25
  62. package/dist/components/Loader/tests/Loader.test.stories.d.ts +0 -3
  63. package/dist/components/Loader/tests/Loader.test.stories.js +0 -21
  64. package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +37 -7
  65. package/dist/components/MenuItem/tests/MenuItem.stories.js +218 -112
  66. package/dist/components/Modal/Modal.js +1 -1
  67. package/dist/components/Modal/Modal.module.css +1 -1
  68. package/dist/components/Modal/tests/Modal.stories.d.ts +53 -10
  69. package/dist/components/Modal/tests/Modal.stories.js +366 -214
  70. package/dist/components/Overlay/Overlay.js +1 -0
  71. package/dist/components/Overlay/tests/Overlay.stories.d.ts +15 -1
  72. package/dist/components/Overlay/tests/Overlay.stories.js +135 -1
  73. package/dist/components/Pagination/tests/Pagination.stories.d.ts +14 -1
  74. package/dist/components/Pagination/tests/Pagination.stories.js +93 -15
  75. package/dist/components/PinField/tests/PinField.stories.d.ts +1 -1
  76. package/dist/components/PinField/tests/PinField.stories.js +1 -1
  77. package/dist/components/Popover/Popover.module.css +1 -1
  78. package/dist/components/Progress/tests/Progress.stories.d.ts +19 -4
  79. package/dist/components/Progress/tests/Progress.stories.js +85 -49
  80. package/dist/components/Radio/Radio.module.css +1 -1
  81. package/dist/components/Radio/tests/Radio.stories.d.ts +25 -4
  82. package/dist/components/Radio/tests/Radio.stories.js +147 -65
  83. package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +9 -2
  84. package/dist/components/RadioGroup/tests/RadioGroup.stories.js +64 -38
  85. package/dist/components/Reshaped/Reshaped.css +1 -1
  86. package/dist/components/Scrim/tests/Scrim.stories.d.ts +10 -2
  87. package/dist/components/Scrim/tests/Scrim.stories.js +51 -31
  88. package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
  89. package/dist/components/Select/Select.module.css +1 -1
  90. package/dist/components/Select/Select.types.d.ts +38 -11
  91. package/dist/components/Select/SelectCustom.js +2 -1
  92. package/dist/components/Select/SelectCustomControlled.js +24 -9
  93. package/dist/components/Select/SelectCustomUncontrolled.js +10 -7
  94. package/dist/components/Select/SelectTrigger.js +1 -1
  95. package/dist/components/Select/tests/Select.stories.d.ts +3 -0
  96. package/dist/components/Select/tests/Select.stories.js +91 -34
  97. package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +10 -2
  98. package/dist/components/Skeleton/tests/Skeleton.stories.js +46 -28
  99. package/dist/components/Slider/Slider.module.css +1 -1
  100. package/dist/components/Stepper/tests/Stepper.stories.d.ts +18 -4
  101. package/dist/components/Stepper/tests/Stepper.stories.js +99 -70
  102. package/dist/components/Switch/Switch.module.css +1 -1
  103. package/dist/components/Switch/tests/Switch.stories.d.ts +10 -2
  104. package/dist/components/Switch/tests/Switch.stories.js +77 -23
  105. package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -10
  106. package/dist/components/Switch/tests/Switch.test.stories.js +0 -68
  107. package/dist/components/Table/Table.module.css +1 -1
  108. package/dist/components/Table/tests/Table.stories.d.ts +25 -5
  109. package/dist/components/Table/tests/Table.stories.js +274 -177
  110. package/dist/components/Table/tests/Table.test.stories.d.ts +0 -5
  111. package/dist/components/Table/tests/Table.test.stories.js +0 -82
  112. package/dist/components/Tabs/Tabs.module.css +1 -1
  113. package/dist/components/Tabs/TabsControlled.js +1 -0
  114. package/dist/components/TextArea/TextArea.module.css +1 -1
  115. package/dist/components/TextArea/tests/TextArea.stories.d.ts +41 -9
  116. package/dist/components/TextArea/tests/TextArea.stories.js +179 -93
  117. package/dist/components/TextField/TextField.js +1 -1
  118. package/dist/components/TextField/TextField.module.css +1 -1
  119. package/dist/components/TextField/tests/TextField.stories.d.ts +41 -11
  120. package/dist/components/TextField/tests/TextField.stories.js +206 -132
  121. package/dist/components/TextField/tests/TextField.test.stories.d.ts +0 -13
  122. package/dist/components/TextField/tests/TextField.test.stories.js +0 -88
  123. package/dist/components/Theme/Theme.module.css +1 -1
  124. package/dist/components/Timeline/tests/Timeline.stories.d.ts +10 -2
  125. package/dist/components/Timeline/tests/Timeline.stories.js +69 -42
  126. package/dist/components/Timeline/tests/Timeline.test.stories.d.ts +0 -2
  127. package/dist/components/Timeline/tests/Timeline.test.stories.js +0 -21
  128. package/dist/components/Toast/ToastContainer.js +1 -0
  129. package/dist/components/Toast/ToastRegion.js +1 -0
  130. package/dist/components/Toast/tests/Toast.stories.d.ts +32 -8
  131. package/dist/components/Toast/tests/Toast.stories.js +111 -37
  132. package/dist/components/ToggleButtonGroup/ToggleButtonGroupControlled.js +1 -0
  133. package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +18 -4
  134. package/dist/components/Tooltip/tests/Tooltip.stories.js +139 -107
  135. package/dist/components/Tooltip/tests/Tooltip.test.stories.d.ts +0 -6
  136. package/dist/components/Tooltip/tests/Tooltip.test.stories.js +0 -29
  137. package/dist/components/View/View.js +1 -0
  138. package/dist/components/View/tests/View.stories.d.ts +4 -0
  139. package/dist/components/View/tests/View.stories.js +39 -0
  140. package/dist/components/_private/Expandable/Expandable.js +3 -1
  141. package/dist/components/_private/Portal/Portal.js +4 -1
  142. package/dist/hooks/_private/usePrevious.js +1 -0
  143. package/dist/hooks/tests/useDrag.stories.js +1 -1
  144. package/dist/styles/resolvers/align/align.css +1 -1
  145. package/dist/styles/resolvers/aspectRatio/aspectRatio.css +1 -1
  146. package/dist/styles/resolvers/bleed/bleed.module.css +1 -1
  147. package/dist/styles/resolvers/justify/justify.css +1 -1
  148. package/dist/styles/resolvers/maxHeight/maxHeight.module.css +1 -1
  149. package/dist/styles/resolvers/maxWidth/maxWidth.module.css +1 -1
  150. package/dist/styles/resolvers/minHeight/minHeight.module.css +1 -1
  151. package/dist/styles/resolvers/minWidth/minWidth.module.css +1 -1
  152. package/dist/styles/resolvers/position/position.css +1 -1
  153. package/dist/styles/resolvers/textAlign/textAlign.css +1 -1
  154. package/dist/styles/resolvers/width/width.module.css +1 -1
  155. package/dist/utilities/scroll/disable.js +2 -2
  156. package/package.json +21 -21
  157. package/dist/components/Alert/tests/Alert.test.stories.d.ts +0 -15
  158. package/dist/components/Alert/tests/Alert.test.stories.js +0 -26
  159. package/dist/components/Badge/tests/Badge.test.stories.d.ts +0 -20
  160. package/dist/components/Badge/tests/Badge.test.stories.js +0 -46
  161. package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.d.ts +0 -23
  162. package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.js +0 -76
  163. package/dist/components/Button/tests/Button.test.stories.d.ts +0 -28
  164. package/dist/components/Button/tests/Button.test.stories.js +0 -135
  165. package/dist/components/Card/tests/Card.test.stories.d.ts +0 -35
  166. package/dist/components/Card/tests/Card.test.stories.js +0 -54
  167. package/dist/components/Checkbox/tests/Checkbox.test.stories.d.ts +0 -25
  168. package/dist/components/Checkbox/tests/Checkbox.test.stories.js +0 -104
  169. package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.d.ts +0 -22
  170. package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.js +0 -78
  171. package/dist/components/Container/tests/Container.test.stories.d.ts +0 -15
  172. package/dist/components/Container/tests/Container.test.stories.js +0 -26
  173. package/dist/components/ContextMenu/tests/ContextMenu.test.stories.d.ts +0 -25
  174. package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +0 -53
  175. package/dist/components/Dismissible/tests/Dismissible.test.stories.d.ts +0 -19
  176. package/dist/components/Dismissible/tests/Dismissible.test.stories.js +0 -42
  177. package/dist/components/Divider/tests/Divider.test.stories.d.ts +0 -18
  178. package/dist/components/Divider/tests/Divider.test.stories.js +0 -47
  179. package/dist/components/FormControl/tests/FormControl.test.stories.d.ts +0 -20
  180. package/dist/components/FormControl/tests/FormControl.test.stories.js +0 -49
  181. package/dist/components/Hidden/tests/Hidden.test.stories.d.ts +0 -15
  182. package/dist/components/Hidden/tests/Hidden.test.stories.js +0 -20
  183. package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.d.ts +0 -15
  184. package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.js +0 -20
  185. package/dist/components/Hotkey/tests/Hotkey.test.stories.d.ts +0 -15
  186. package/dist/components/Hotkey/tests/Hotkey.test.stories.js +0 -26
  187. package/dist/components/Icon/tests/Icon.test.stories.d.ts +0 -16
  188. package/dist/components/Icon/tests/Icon.test.stories.js +0 -35
  189. package/dist/components/MenuItem/tests/MenuItem.test.stories.d.ts +0 -27
  190. package/dist/components/MenuItem/tests/MenuItem.test.stories.js +0 -116
  191. package/dist/components/Modal/tests/Modal.test.stories.d.ts +0 -31
  192. package/dist/components/Modal/tests/Modal.test.stories.js +0 -149
  193. package/dist/components/Overlay/tests/Overlay.test.stories.d.ts +0 -28
  194. package/dist/components/Overlay/tests/Overlay.test.stories.js +0 -148
  195. package/dist/components/Pagination/tests/Pagination.test.stories.d.ts +0 -23
  196. package/dist/components/Pagination/tests/Pagination.test.stories.js +0 -86
  197. package/dist/components/Progress/tests/Progress.test.stories.d.ts +0 -16
  198. package/dist/components/Progress/tests/Progress.test.stories.js +0 -35
  199. package/dist/components/Radio/tests/Radio.test.stories.d.ts +0 -30
  200. package/dist/components/Radio/tests/Radio.test.stories.js +0 -118
  201. package/dist/components/RadioGroup/tests/RadioGroup.test.stories.d.ts +0 -22
  202. package/dist/components/RadioGroup/tests/RadioGroup.test.stories.js +0 -78
  203. package/dist/components/Scrim/tests/Scrim.test.stories.d.ts +0 -15
  204. package/dist/components/Scrim/tests/Scrim.test.stories.js +0 -25
  205. package/dist/components/Skeleton/tests/Skeleton.test.stories.d.ts +0 -15
  206. package/dist/components/Skeleton/tests/Skeleton.test.stories.js +0 -23
  207. package/dist/components/Stepper/tests/Stepper.test.stories.d.ts +0 -20
  208. package/dist/components/Stepper/tests/Stepper.test.stories.js +0 -28
  209. package/dist/components/TextArea/tests/TextArea.test.stories.d.ts +0 -28
  210. package/dist/components/TextArea/tests/TextArea.test.stories.js +0 -99
  211. package/dist/components/Toast/tests/Toast.test.stories.d.ts +0 -16
  212. package/dist/components/Toast/tests/Toast.test.stories.js +0 -101
  213. package/dist/components/View/tests/View.test.stories.d.ts +0 -24
  214. package/dist/components/View/tests/View.test.stories.js +0 -50
@@ -1,135 +0,0 @@
1
- import { userEvent, expect, fn } from "storybook/test";
2
- import Button from "../index.js";
3
- import Example from "../../../utilities/storybook/Example.js";
4
- export default {
5
- title: "Components/Button/tests",
6
- component: Button,
7
- parameters: {
8
- iframe: {
9
- url: "https://reshaped.so/docs/components/button",
10
- },
11
- chromatic: { disableSnapshot: true },
12
- },
13
- };
14
- export const children = {
15
- name: "children",
16
- render: () => <Button>Trigger</Button>,
17
- play: async ({ canvas }) => {
18
- const el = canvas.getByText("Trigger");
19
- expect(el).toBeInTheDocument();
20
- expect(el.tagName).toBe("SPAN");
21
- },
22
- };
23
- export const href = {
24
- name: "href",
25
- render: () => <Button href="https://reshaped.so">Trigger</Button>,
26
- play: async ({ canvas }) => {
27
- const el = canvas.getByRole("link");
28
- expect(el).toHaveAttribute("href", "https://reshaped.so");
29
- },
30
- };
31
- export const onClick = {
32
- name: "onClick",
33
- args: {
34
- handleClick: fn(),
35
- },
36
- render: (args) => <Button onClick={args.handleClick}>Trigger</Button>,
37
- play: async ({ canvas, args }) => {
38
- const { handleClick } = args;
39
- const el = canvas.getAllByRole("button")[0];
40
- await userEvent.click(el);
41
- expect(el).toHaveAttribute("type", "button");
42
- expect(handleClick).toHaveBeenCalledTimes(1);
43
- expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
44
- },
45
- };
46
- export const hrefOnClick = {
47
- name: "href + onClick",
48
- args: {
49
- handleClick: fn(),
50
- },
51
- render: (args) => (<Button onClick={(e) => {
52
- e.preventDefault();
53
- args.handleClick(e);
54
- }} href="https://reshaped.so">
55
- Trigger
56
- </Button>),
57
- play: async ({ canvas, args }) => {
58
- const { handleClick } = args;
59
- const el = canvas.getByRole("link");
60
- await userEvent.click(el);
61
- expect(el).toHaveAttribute("href", "https://reshaped.so");
62
- expect(handleClick).toHaveBeenCalledTimes(1);
63
- expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
64
- },
65
- };
66
- export const disabled = {
67
- name: "disabled",
68
- render: () => (<Button disabled onClick={() => { }}>
69
- Trigger
70
- </Button>),
71
- play: async ({ canvas }) => {
72
- const el = canvas.getAllByRole("button")[0];
73
- expect(el).toBeDisabled();
74
- },
75
- };
76
- export const as = {
77
- name: "as, render",
78
- render: () => (<Example>
79
- <Example.Item title="as: span">
80
- <Button onClick={() => { }} as="span">
81
- Trigger
82
- </Button>
83
- </Example.Item>
84
- <Example.Item title="render, disabled">
85
- <Button disabled onClick={() => { }} render={(props) => <section {...props}/>} attributes={{ "data-testid": "render-el" }}>
86
- Trigger
87
- </Button>
88
- </Example.Item>
89
- </Example>),
90
- play: ({ canvas }) => {
91
- const [asEl] = canvas.getAllByText("Trigger");
92
- const renderEl = canvas.getByTestId("render-el");
93
- expect(asEl.tagName).toBe("SPAN");
94
- expect(renderEl.tagName).toBe("SECTION");
95
- expect(renderEl).toHaveAttribute("aria-disabled", "true");
96
- },
97
- };
98
- export const className = {
99
- name: "className, attributes",
100
- render: () => (<div data-testid="root">
101
- <Button className="test-classname" attributes={{ id: "test-id" }}>
102
- Trigger
103
- </Button>
104
- </div>),
105
- play: async ({ canvas }) => {
106
- const root = canvas.getByTestId("root").firstChild;
107
- expect(root).toHaveClass("test-classname");
108
- expect(root).toHaveAttribute("id", "test-id");
109
- },
110
- };
111
- export const group = {
112
- name: "group",
113
- render: () => (<Button.Group>
114
- <Button>Trigger</Button>
115
- <Button>Trigger</Button>
116
- </Button.Group>),
117
- play: async ({ canvas }) => {
118
- const el = canvas.getByRole("group");
119
- expect(el).toBeInTheDocument();
120
- expect(el.childElementCount).toEqual(2);
121
- },
122
- };
123
- export const groupClassName = {
124
- name: "group className, attributes",
125
- render: () => (<div data-testid="root">
126
- <Button.Group className="test-classname" attributes={{ id: "test-id" }}>
127
- <Button>Trigger</Button>
128
- </Button.Group>
129
- </div>),
130
- play: async ({ canvas }) => {
131
- const root = canvas.getByTestId("root").firstChild;
132
- expect(root).toHaveClass("test-classname");
133
- expect(root).toHaveAttribute("id", "test-id");
134
- },
135
- };
@@ -1,35 +0,0 @@
1
- import React from "react";
2
- import { StoryObj } from "@storybook/react-vite";
3
- import { fn } from "storybook/test";
4
- declare const _default: {
5
- title: string;
6
- component: React.ForwardRefExoticComponent<{
7
- padding?: import("../../../types/global").Responsive<number>;
8
- bleed?: import("../../../types/global").Responsive<number>;
9
- selected?: boolean;
10
- elevated?: boolean;
11
- children?: React.ReactNode;
12
- onClick?: import("../../Actionable").ActionableProps["onClick"];
13
- href?: string;
14
- as?: keyof React.JSX.IntrinsicElements | undefined;
15
- className?: import("../../../types/global").ClassName;
16
- attributes?: (import("../../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children" | "ref" | "style" | "form" | "slot" | "title" | "disabled" | "key" | "value" | "hidden" | "color" | "content" | "className" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dir" | "name" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "onToggle" | "type" | "id" | "lang" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
17
- ref?: import("../../Actionable/Actionable.types").AttributesRef;
18
- }) | undefined)) | undefined;
19
- } & Pick<import("../../View").ViewProps, "height"> & React.RefAttributes<HTMLElement>>;
20
- parameters: {
21
- iframe: {
22
- url: string;
23
- };
24
- chromatic: {
25
- disableSnapshot: boolean;
26
- };
27
- };
28
- };
29
- export default _default;
30
- export declare const onClick: StoryObj<{
31
- handleClick: ReturnType<typeof fn>;
32
- }>;
33
- export declare const href: StoryObj;
34
- export declare const as: StoryObj;
35
- export declare const className: StoryObj;
@@ -1,54 +0,0 @@
1
- import React from "react";
2
- import { expect, fn, userEvent } from "storybook/test";
3
- import Card from "../index.js";
4
- export default {
5
- title: "Components/Card/tests",
6
- component: Card,
7
- parameters: {
8
- iframe: {
9
- url: "https://reshaped.so/docs/components/card",
10
- },
11
- chromatic: { disableSnapshot: true },
12
- },
13
- };
14
- export const onClick = {
15
- name: "onClick",
16
- args: {
17
- handleClick: fn(),
18
- },
19
- render: (args) => <Card onClick={args.handleClick}>Trigger</Card>,
20
- play: async ({ canvas, args }) => {
21
- const { handleClick } = args;
22
- const el = canvas.getAllByRole("button")[0];
23
- await userEvent.click(el);
24
- expect(handleClick).toHaveBeenCalledTimes(1);
25
- expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
26
- },
27
- };
28
- export const href = {
29
- name: "href",
30
- render: () => <Card href="https://reshaped.so">Trigger</Card>,
31
- play: async ({ canvas }) => {
32
- const el = canvas.getByRole("link");
33
- expect(el).toHaveAttribute("href", "https://reshaped.so");
34
- },
35
- };
36
- export const as = {
37
- name: "as",
38
- render: () => <Card as="span" attributes={{ "data-testid": "root" }}/>,
39
- play: ({ canvas }) => {
40
- const root = canvas.getByTestId("root");
41
- expect(root.tagName).toBe("SPAN");
42
- },
43
- };
44
- export const className = {
45
- name: "className, attributes",
46
- render: () => (<div data-testid="root">
47
- <Card className="test-classname" attributes={{ id: "test-id" }}/>
48
- </div>),
49
- play: async ({ canvas }) => {
50
- const root = canvas.getByTestId("root").firstChild;
51
- expect(root).toHaveClass("test-classname");
52
- expect(root).toHaveAttribute("id", "test-id");
53
- },
54
- };
@@ -1,25 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- import { fn } from "storybook/test";
3
- declare const _default: {
4
- title: string;
5
- component: import("react").FC<import("./..").CheckboxProps>;
6
- parameters: {
7
- iframe: {
8
- url: string;
9
- };
10
- chromatic: {
11
- disableSnapshot: boolean;
12
- };
13
- };
14
- };
15
- export default _default;
16
- export declare const render: StoryObj;
17
- export declare const checked: StoryObj<{
18
- handleChange: ReturnType<typeof fn>;
19
- }>;
20
- export declare const defaultChecked: StoryObj<{
21
- handleChange: ReturnType<typeof fn>;
22
- }>;
23
- export declare const disabled: StoryObj;
24
- export declare const indeterminate: StoryObj;
25
- export declare const className: StoryObj;
@@ -1,104 +0,0 @@
1
- import { expect, userEvent, fn } from "storybook/test";
2
- import Checkbox from "../index.js";
3
- export default {
4
- title: "Components/Checkbox/tests",
5
- component: Checkbox,
6
- parameters: {
7
- iframe: {
8
- url: "https://reshaped.so/docs/components/checkbox",
9
- },
10
- chromatic: { disableSnapshot: true },
11
- },
12
- };
13
- export const render = {
14
- name: "name, value",
15
- render: () => (<Checkbox name="test-name" value="test-value">
16
- Content
17
- </Checkbox>),
18
- play: async ({ canvas }) => {
19
- const input = canvas.getByRole("checkbox");
20
- expect(input).toHaveAttribute("value", "test-value");
21
- expect(input).toHaveAttribute("name", "test-name");
22
- expect(input).not.toBeChecked();
23
- },
24
- };
25
- export const checked = {
26
- name: "checked, controlled",
27
- args: {
28
- handleChange: fn(),
29
- },
30
- render: (args) => (<Checkbox name="test-name" value="test-value" checked onChange={args.handleChange}>
31
- Content
32
- </Checkbox>),
33
- play: async ({ canvas, args }) => {
34
- const input = canvas.getByRole("checkbox");
35
- expect(input).toBeChecked();
36
- await userEvent.click(input);
37
- expect(args.handleChange).toHaveBeenCalledTimes(1);
38
- expect(args.handleChange).toHaveBeenCalledWith({
39
- name: "test-name",
40
- value: "test-value",
41
- checked: false,
42
- event: expect.objectContaining({ target: input }),
43
- });
44
- // Still checked because it's controlled
45
- expect(input).toBeChecked();
46
- },
47
- };
48
- export const defaultChecked = {
49
- name: "defaultChecked, uncontrolled",
50
- args: {
51
- handleChange: fn(),
52
- },
53
- render: (args) => (<Checkbox name="test-name" value="test-value" defaultChecked onChange={args.handleChange}>
54
- Content
55
- </Checkbox>),
56
- play: async ({ canvas, args }) => {
57
- const input = canvas.getByRole("checkbox");
58
- expect(input).toBeChecked();
59
- await userEvent.click(input);
60
- expect(args.handleChange).toHaveBeenCalledTimes(1);
61
- expect(args.handleChange).toHaveBeenCalledWith({
62
- name: "test-name",
63
- value: "test-value",
64
- checked: false,
65
- event: expect.objectContaining({ target: input }),
66
- });
67
- expect(input).not.toBeChecked();
68
- },
69
- };
70
- export const disabled = {
71
- name: "disabled",
72
- render: () => (<Checkbox name="test-name" value="test-value" disabled>
73
- Content
74
- </Checkbox>),
75
- play: async ({ canvas }) => {
76
- const input = canvas.getByRole("checkbox");
77
- expect(input).toBeDisabled();
78
- },
79
- };
80
- export const indeterminate = {
81
- name: "indeterminate",
82
- render: () => (<Checkbox name="test-name" value="test-value" indeterminate>
83
- Content
84
- </Checkbox>),
85
- play: async ({ canvas }) => {
86
- const input = canvas.getByRole("checkbox");
87
- expect(input.indeterminate).toBeTruthy();
88
- await userEvent.click(input);
89
- expect(input.indeterminate).toBeFalsy();
90
- },
91
- };
92
- export const className = {
93
- name: "className, attributes",
94
- render: () => (<div data-testid="root">
95
- <Checkbox className="test-classname" attributes={{ id: "test-id" }}>
96
- Content
97
- </Checkbox>
98
- </div>),
99
- play: async ({ canvas }) => {
100
- const root = canvas.getByTestId("root").firstChild;
101
- expect(root).toHaveClass("test-classname");
102
- expect(root).toHaveAttribute("id", "test-id");
103
- },
104
- };
@@ -1,22 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- import { fn } from "storybook/test";
3
- declare const _default: {
4
- title: string;
5
- component: import("react").FC<import("./..").CheckboxGroupProps>;
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;
@@ -1,78 +0,0 @@
1
- import { fn, userEvent, expect } from "storybook/test";
2
- import CheckboxGroup from "../index.js";
3
- import Checkbox from "../../Checkbox/index.js";
4
- export default {
5
- title: "Components/CheckboxGroup/tests",
6
- component: CheckboxGroup,
7
- parameters: {
8
- iframe: {
9
- url: "https://reshaped.so/docs/components/checkbox",
10
- },
11
- chromatic: { disableSnapshot: true },
12
- },
13
- };
14
- export const value = {
15
- name: "value, controlled",
16
- args: {
17
- handleChange: fn(),
18
- },
19
- render: (args) => (<CheckboxGroup name="test-name" value={["1"]} onChange={args.handleChange}>
20
- {/* checked should be ignored */}
21
- <Checkbox value="1" checked={false}>
22
- Content
23
- </Checkbox>
24
-
25
- <Checkbox value="2">Content 2</Checkbox>
26
- </CheckboxGroup>),
27
- play: async ({ canvas, args }) => {
28
- const inputs = canvas.getAllByRole("checkbox");
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: ["1", "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) => (<CheckboxGroup name="test-name" defaultValue={["1"]} onChange={args.handleChange}>
48
- {/* checked should be ignored */}
49
- <Checkbox value="1" checked={false}>
50
- Content
51
- </Checkbox>
52
-
53
- <Checkbox value="2">Content 2</Checkbox>
54
- </CheckboxGroup>),
55
- play: async ({ canvas, args }) => {
56
- const inputs = canvas.getAllByRole("checkbox");
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: ["1", "2"],
63
- event: expect.objectContaining({ target: inputs[1] }),
64
- });
65
- expect(inputs[0]).toBeChecked();
66
- expect(inputs[1]).toBeChecked();
67
- },
68
- };
69
- export const disabled = {
70
- name: "disabled",
71
- render: () => (<CheckboxGroup name="test-name" disabled>
72
- <Checkbox value="test-value">Content</Checkbox>
73
- </CheckboxGroup>),
74
- play: async ({ canvas }) => {
75
- const input = canvas.getByRole("checkbox");
76
- expect(input).toBeDisabled();
77
- },
78
- };
@@ -1,15 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- declare const _default: {
3
- title: string;
4
- component: import("react").FC<import("./..").ContainerProps>;
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;
@@ -1,26 +0,0 @@
1
- import { expect } from "storybook/test";
2
- import Container from "../index.js";
3
- import { Placeholder } from "../../../utilities/storybook/index.js";
4
- export default {
5
- title: "Utility components/Container/tests",
6
- component: Container,
7
- parameters: {
8
- iframe: {
9
- url: "https://reshaped.so/docs/components/action-bar",
10
- },
11
- chromatic: { disableSnapshot: true },
12
- },
13
- };
14
- export const className = {
15
- name: "className, attributes",
16
- render: () => (<div data-testid="root">
17
- <Container className="test-classname" attributes={{ id: "test-id" }}>
18
- <Placeholder />
19
- </Container>
20
- </div>),
21
- play: async ({ canvas }) => {
22
- const root = canvas.getByTestId("root").firstChild;
23
- expect(root).toHaveClass("test-classname");
24
- expect(root).toHaveAttribute("id", "test-id");
25
- },
26
- };
@@ -1,25 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- import { fn } from "storybook/test";
3
- declare const _default: {
4
- title: string;
5
- component: import("react").FC<import("./..").ContextMenuProps> & {
6
- Content: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").ContentProps>;
7
- Item: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").ItemProps>;
8
- Section: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").SectionProps>;
9
- SubMenu: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").SubMenuProps>;
10
- SubTrigger: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").SubTriggerProps>;
11
- };
12
- parameters: {
13
- iframe: {
14
- url: string;
15
- };
16
- chromatic: {
17
- disableSnapshot: boolean;
18
- };
19
- };
20
- };
21
- export default _default;
22
- export declare const handlers: StoryObj<{
23
- handleOpen: ReturnType<typeof fn>;
24
- handleClose: ReturnType<typeof fn>;
25
- }>;
@@ -1,53 +0,0 @@
1
- import { expect, fn, userEvent, waitFor, within } from "storybook/test";
2
- import ContextMenu from "../index.js";
3
- import View from "../../View/index.js";
4
- import { sleep } from "../../../utilities/helpers.js";
5
- export default {
6
- title: "Components/ContextMenu/tests",
7
- component: ContextMenu,
8
- parameters: {
9
- iframe: {
10
- url: "https://reshaped.so/docs/components/context-menu",
11
- },
12
- chromatic: { disableSnapshot: true },
13
- },
14
- };
15
- export const handlers = {
16
- name: "handleOpen, handleClose",
17
- args: {
18
- handleOpen: fn(),
19
- handleClose: fn(),
20
- },
21
- render: (args) => (<div style={{ height: 200, overflow: "auto" }} data-testid="scroll">
22
- <ContextMenu onOpen={args.handleOpen} onClose={args.handleClose}>
23
- <View height="400px" backgroundColor="neutral-faded" borderRadius="medium" attributes={{ "data-testid": "root" }}/>
24
-
25
- <ContextMenu.Content>
26
- <ContextMenu.Item>Item</ContextMenu.Item>
27
- </ContextMenu.Content>
28
- </ContextMenu>
29
- </div>),
30
- play: async ({ canvasElement, args }) => {
31
- const canvas = within(canvasElement.ownerDocument.body);
32
- const root = canvas.getByTestId("root");
33
- const scroll = canvas.getByTestId("scroll");
34
- await userEvent.pointer({ keys: "[MouseRight>]", target: root });
35
- expect(args.handleOpen).toHaveBeenCalledTimes(1);
36
- expect(args.handleOpen).toHaveBeenCalledWith();
37
- const item = canvas.getByText("Item");
38
- expect(item).toBeInTheDocument();
39
- // Context menu locks the scroll of the closest scrollable parent
40
- expect(scroll).toHaveStyle("overflow: hidden");
41
- // Wait for the open animation to finish
42
- await sleep(500);
43
- await userEvent.click(root);
44
- expect(args.handleClose).toHaveBeenCalledTimes(1);
45
- expect(args.handleClose).toHaveBeenCalledWith({ reason: "outside-click" });
46
- await waitFor(() => {
47
- expect(item).not.toBeInTheDocument();
48
- expect(scroll).not.toHaveStyle("overflow: hidden");
49
- }, {
50
- timeout: 1000,
51
- });
52
- },
53
- };
@@ -1,19 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- import { fn } from "storybook/test";
3
- declare const _default: {
4
- title: string;
5
- component: import("react").FC<import("./..").DismissibleProps>;
6
- parameters: {
7
- iframe: {
8
- url: string;
9
- };
10
- chromatic: {
11
- disableSnapshot: boolean;
12
- };
13
- };
14
- };
15
- export default _default;
16
- export declare const closeAriaLabel: StoryObj<{
17
- handleClose: ReturnType<typeof fn>;
18
- }>;
19
- export declare const className: StoryObj;
@@ -1,42 +0,0 @@
1
- import { expect, fn, userEvent } from "storybook/test";
2
- import Dismissible from "../index.js";
3
- import { Placeholder } from "../../../utilities/storybook/index.js";
4
- export default {
5
- title: "Utility components/Dismissible/tests",
6
- component: Dismissible,
7
- parameters: {
8
- iframe: {
9
- url: "https://reshaped.so/docs/components/action-bar",
10
- },
11
- chromatic: { disableSnapshot: true },
12
- },
13
- };
14
- export const closeAriaLabel = {
15
- args: {
16
- handleClose: fn(),
17
- },
18
- name: "onClose, closeAriaLabel",
19
- render: (args) => (<Dismissible closeAriaLabel="Close" onClose={args.handleClose}>
20
- <Placeholder />
21
- </Dismissible>),
22
- play: async ({ canvas, args }) => {
23
- const button = canvas.getAllByRole("button")[0];
24
- await userEvent.click(button);
25
- expect(button).toHaveAttribute("aria-label", "Close");
26
- expect(args.handleClose).toHaveBeenCalledTimes(1);
27
- expect(args.handleClose).toHaveBeenCalledWith();
28
- },
29
- };
30
- export const className = {
31
- name: "className, attributes",
32
- render: () => (<div data-testid="root">
33
- <Dismissible closeAriaLabel="Close" onClose={() => { }} className="test-classname" attributes={{ id: "test-id" }}>
34
- <Placeholder />
35
- </Dismissible>
36
- </div>),
37
- play: async ({ canvas }) => {
38
- const root = canvas.getByTestId("root").firstChild;
39
- expect(root).toHaveClass("test-classname");
40
- expect(root).toHaveAttribute("id", "test-id");
41
- },
42
- };