reshaped 3.9.0-canary.0 → 3.9.0-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/dist/bundle.css +1 -1
  2. package/dist/bundle.js +10 -10
  3. package/dist/components/Button/Button.module.css +1 -1
  4. package/dist/components/Card/Card.module.css +1 -1
  5. package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
  6. package/dist/components/Flyout/Flyout.constants.d.ts +1 -3
  7. package/dist/components/Flyout/Flyout.constants.js +1 -3
  8. package/dist/components/Flyout/FlyoutControlled.js +6 -8
  9. package/dist/components/Flyout/utilities/cooldown.js +1 -2
  10. package/dist/components/Icon/Icon.module.css +1 -1
  11. package/dist/components/Progress/Progress.module.css +1 -1
  12. package/dist/components/Reshaped/Reshaped.css +1 -1
  13. package/dist/components/Text/Text.module.css +1 -1
  14. package/dist/components/Theme/Theme.module.css +1 -1
  15. package/dist/hooks/useOnClickOutside.js +2 -4
  16. package/dist/themes/_generator/tokens/css.js +2 -2
  17. package/dist/themes/figma/theme.css +1 -1
  18. package/dist/themes/fragments/twitter/theme.css +1 -1
  19. package/dist/themes/reshaped/theme.css +1 -1
  20. package/dist/themes/slate/theme.css +1 -1
  21. package/package.json +40 -35
  22. package/dist/components/Accordion/tests/Accordion.stories.d.ts +0 -44
  23. package/dist/components/Accordion/tests/Accordion.stories.js +0 -204
  24. package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +0 -40
  25. package/dist/components/ActionBar/tests/ActionBar.stories.js +0 -223
  26. package/dist/components/Actionable/tests/Actionable.stories.d.ts +0 -41
  27. package/dist/components/Actionable/tests/Actionable.stories.js +0 -220
  28. package/dist/components/Alert/tests/Alert.stories.d.ts +0 -24
  29. package/dist/components/Alert/tests/Alert.stories.js +0 -78
  30. package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +0 -32
  31. package/dist/components/Autocomplete/tests/Autocomplete.stories.js +0 -246
  32. package/dist/components/Avatar/tests/Avatar.stories.d.ts +0 -31
  33. package/dist/components/Avatar/tests/Avatar.stories.js +0 -176
  34. package/dist/components/Badge/tests/Badge.stories.d.ts +0 -55
  35. package/dist/components/Badge/tests/Badge.stories.js +0 -328
  36. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +0 -40
  37. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +0 -187
  38. package/dist/components/Button/tests/Button.stories.d.ts +0 -79
  39. package/dist/components/Button/tests/Button.stories.js +0 -789
  40. package/dist/components/Calendar/tests/Calendar.stories.d.ts +0 -29
  41. package/dist/components/Calendar/tests/Calendar.stories.js +0 -255
  42. package/dist/components/Card/tests/Card.stories.d.ts +0 -52
  43. package/dist/components/Card/tests/Card.stories.js +0 -125
  44. package/dist/components/Carousel/tests/Carousel.stories.d.ts +0 -34
  45. package/dist/components/Carousel/tests/Carousel.stories.js +0 -224
  46. package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +0 -30
  47. package/dist/components/Checkbox/tests/Checkbox.stories.js +0 -171
  48. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +0 -19
  49. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +0 -83
  50. package/dist/components/Container/tests/Container.stories.d.ts +0 -24
  51. package/dist/components/Container/tests/Container.stories.js +0 -75
  52. package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +0 -26
  53. package/dist/components/ContextMenu/tests/ContextMenu.stories.js +0 -70
  54. package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +0 -25
  55. package/dist/components/Dismissible/tests/Dismissible.stories.js +0 -97
  56. package/dist/components/Divider/tests/Divider.stories.d.ts +0 -20
  57. package/dist/components/Divider/tests/Divider.stories.js +0 -120
  58. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +0 -53
  59. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +0 -278
  60. package/dist/components/FileUpload/tests/FileUpload.stories.d.ts +0 -31
  61. package/dist/components/FileUpload/tests/FileUpload.stories.js +0 -140
  62. package/dist/components/Flyout/tests/Flyout.stories.d.ts +0 -103
  63. package/dist/components/Flyout/tests/Flyout.stories.js +0 -738
  64. package/dist/components/FormControl/tests/FormControl.stories.d.ts +0 -31
  65. package/dist/components/FormControl/tests/FormControl.stories.js +0 -143
  66. package/dist/components/Grid/tests/Grid.stories.d.ts +0 -38
  67. package/dist/components/Grid/tests/Grid.stories.js +0 -245
  68. package/dist/components/Hidden/tests/Hidden.stories.d.ts +0 -16
  69. package/dist/components/Hidden/tests/Hidden.stories.js +0 -48
  70. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +0 -16
  71. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +0 -28
  72. package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +0 -13
  73. package/dist/components/Hotkey/tests/Hotkey.stories.js +0 -53
  74. package/dist/components/Icon/tests/Icon.stories.d.ts +0 -25
  75. package/dist/components/Icon/tests/Icon.stories.js +0 -113
  76. package/dist/components/Image/tests/Image.stories.d.ts +0 -41
  77. package/dist/components/Image/tests/Image.stories.js +0 -196
  78. package/dist/components/Link/tests/Link.stories.d.ts +0 -42
  79. package/dist/components/Link/tests/Link.stories.js +0 -155
  80. package/dist/components/Loader/tests/Loader.stories.d.ts +0 -21
  81. package/dist/components/Loader/tests/Loader.stories.js +0 -68
  82. package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +0 -59
  83. package/dist/components/MenuItem/tests/MenuItem.stories.js +0 -236
  84. package/dist/components/Modal/tests/Modal.stories.d.ts +0 -64
  85. package/dist/components/Modal/tests/Modal.stories.js +0 -410
  86. package/dist/components/NumberField/tests/NumberField.stories.d.ts +0 -28
  87. package/dist/components/NumberField/tests/NumberField.stories.js +0 -258
  88. package/dist/components/Overlay/tests/Overlay.stories.d.ts +0 -28
  89. package/dist/components/Overlay/tests/Overlay.stories.js +0 -202
  90. package/dist/components/Pagination/tests/Pagination.stories.d.ts +0 -24
  91. package/dist/components/Pagination/tests/Pagination.stories.js +0 -105
  92. package/dist/components/PinField/tests/PinField.stories.d.ts +0 -34
  93. package/dist/components/PinField/tests/PinField.stories.js +0 -209
  94. package/dist/components/Popover/tests/Popover.stories.d.ts +0 -69
  95. package/dist/components/Popover/tests/Popover.stories.js +0 -340
  96. package/dist/components/Progress/tests/Progress.stories.d.ts +0 -30
  97. package/dist/components/Progress/tests/Progress.stories.js +0 -102
  98. package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.d.ts +0 -19
  99. package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +0 -92
  100. package/dist/components/Radio/tests/Radio.stories.d.ts +0 -35
  101. package/dist/components/Radio/tests/Radio.stories.js +0 -162
  102. package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +0 -19
  103. package/dist/components/RadioGroup/tests/RadioGroup.stories.js +0 -77
  104. package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +0 -34
  105. package/dist/components/Reshaped/tests/Reshaped.stories.js +0 -108
  106. package/dist/components/Resizable/tests/Resizable.stories.d.ts +0 -38
  107. package/dist/components/Resizable/tests/Resizable.stories.js +0 -185
  108. package/dist/components/Scrim/tests/Scrim.stories.d.ts +0 -20
  109. package/dist/components/Scrim/tests/Scrim.stories.js +0 -67
  110. package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +0 -37
  111. package/dist/components/ScrollArea/tests/ScrollArea.stories.js +0 -244
  112. package/dist/components/Select/tests/Select.stories.d.ts +0 -53
  113. package/dist/components/Select/tests/Select.stories.js +0 -616
  114. package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +0 -20
  115. package/dist/components/Skeleton/tests/Skeleton.stories.js +0 -63
  116. package/dist/components/Slider/tests/Slider.stories.d.ts +0 -47
  117. package/dist/components/Slider/tests/Slider.stories.js +0 -279
  118. package/dist/components/Stepper/tests/Stepper.stories.d.ts +0 -31
  119. package/dist/components/Stepper/tests/Stepper.stories.js +0 -135
  120. package/dist/components/Switch/tests/Switch.stories.d.ts +0 -22
  121. package/dist/components/Switch/tests/Switch.stories.js +0 -137
  122. package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -13
  123. package/dist/components/Switch/tests/Switch.test.stories.js +0 -11
  124. package/dist/components/Table/tests/Table.stories.d.ts +0 -42
  125. package/dist/components/Table/tests/Table.stories.js +0 -348
  126. package/dist/components/Tabs/tests/Tabs.stories.d.ts +0 -62
  127. package/dist/components/Tabs/tests/Tabs.stories.js +0 -539
  128. package/dist/components/Text/tests/Text.stories.d.ts +0 -48
  129. package/dist/components/Text/tests/Text.stories.js +0 -201
  130. package/dist/components/TextArea/tests/TextArea.stories.d.ts +0 -53
  131. package/dist/components/TextArea/tests/TextArea.stories.js +0 -204
  132. package/dist/components/TextField/tests/TextField.stories.d.ts +0 -54
  133. package/dist/components/TextField/tests/TextField.stories.js +0 -252
  134. package/dist/components/Theme/tests/Theme.stories.d.ts +0 -25
  135. package/dist/components/Theme/tests/Theme.stories.js +0 -171
  136. package/dist/components/Timeline/tests/Timeline.stories.d.ts +0 -22
  137. package/dist/components/Timeline/tests/Timeline.stories.js +0 -86
  138. package/dist/components/Toast/tests/Toast.stories.d.ts +0 -41
  139. package/dist/components/Toast/tests/Toast.stories.js +0 -432
  140. package/dist/components/ToggleButton/tests/ToggleButton.stories.d.ts +0 -27
  141. package/dist/components/ToggleButton/tests/ToggleButton.stories.js +0 -97
  142. package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.d.ts +0 -27
  143. package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.js +0 -169
  144. package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +0 -28
  145. package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -182
  146. package/dist/components/View/tests/View.stories.d.ts +0 -141
  147. package/dist/components/View/tests/View.stories.js +0 -1329
  148. package/dist/components/_private/Portal/tests/Portal.stories.d.ts +0 -6
  149. package/dist/components/_private/Portal/tests/Portal.stories.js +0 -17
  150. package/dist/hooks/tests/useDrag.stories.d.ts +0 -31
  151. package/dist/hooks/tests/useDrag.stories.js +0 -147
  152. package/dist/hooks/tests/useElementId.stories.d.ts +0 -11
  153. package/dist/hooks/tests/useElementId.stories.js +0 -23
  154. package/dist/hooks/tests/useHandlerRef.stories.d.ts +0 -14
  155. package/dist/hooks/tests/useHandlerRef.stories.js +0 -44
  156. package/dist/hooks/tests/useHotkeys.stories.d.ts +0 -43
  157. package/dist/hooks/tests/useHotkeys.stories.js +0 -158
  158. package/dist/hooks/tests/useKeyboardArrowNavigation.stories.d.ts +0 -15
  159. package/dist/hooks/tests/useKeyboardArrowNavigation.stories.js +0 -128
  160. package/dist/hooks/tests/useKeyboardMode.stories.d.ts +0 -11
  161. package/dist/hooks/tests/useKeyboardMode.stories.js +0 -42
  162. package/dist/hooks/tests/useOnClickOutside.stories.d.ts +0 -23
  163. package/dist/hooks/tests/useOnClickOutside.stories.js +0 -111
  164. package/dist/hooks/tests/useRTL.stories.d.ts +0 -11
  165. package/dist/hooks/tests/useRTL.stories.js +0 -23
  166. package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +0 -18
  167. package/dist/hooks/tests/useResponsiveClientValue.stories.js +0 -30
  168. package/dist/hooks/tests/useScrollLock.stories.d.ts +0 -14
  169. package/dist/hooks/tests/useScrollLock.stories.js +0 -97
  170. package/dist/hooks/tests/useToggle.stories.d.ts +0 -13
  171. package/dist/hooks/tests/useToggle.stories.js +0 -59
  172. package/dist/tests/ShadowDOM.stories.d.ts +0 -6
  173. package/dist/tests/ShadowDOM.stories.js +0 -110
  174. package/dist/tests/themes.stories.d.ts +0 -16
  175. package/dist/tests/themes.stories.js +0 -327
  176. package/dist/utilities/a11y/tests/TrapFocus.stories.d.ts +0 -14
  177. package/dist/utilities/a11y/tests/TrapFocus.stories.js +0 -615
@@ -1,224 +0,0 @@
1
- import React from "react";
2
- import { expect, fn, userEvent, waitFor } from "storybook/test";
3
- import { Example, Placeholder } from "../../../utilities/storybook/index.js";
4
- import Carousel from "../index.js";
5
- import Button from "../../Button/index.js";
6
- import View from "../../View/index.js";
7
- export default {
8
- title: "Components/Carousel",
9
- component: Carousel,
10
- parameters: {
11
- // Skip because of the aria-hidden applied to buttons, they're replaced by screen reader navigation
12
- a11y: {
13
- disable: true,
14
- },
15
- iframe: {
16
- url: "https://reshaped.so/docs/components/carousel",
17
- },
18
- },
19
- };
20
- export const base = {
21
- name: "base",
22
- render: () => (<Carousel attributes={{ "data-testid": "test-id" }} visibleItems={3}>
23
- <Placeholder h={100}>Content</Placeholder>
24
- <Placeholder h={100}>Content</Placeholder>
25
- <Placeholder h={100}>Content</Placeholder>
26
- <Placeholder h={100}>Content</Placeholder>
27
- <Placeholder h={100}>Content</Placeholder>
28
- <Placeholder h={100}>Content</Placeholder>
29
- </Carousel>),
30
- play: async ({ canvas }) => {
31
- const root = canvas.getByTestId("test-id");
32
- const items = canvas.getAllByText("Content");
33
- const buttons = root.querySelectorAll("button");
34
- expect(root).toBeInTheDocument();
35
- expect(root.tagName).toBe("SECTION");
36
- expect(items).toHaveLength(6);
37
- expect(buttons).toHaveLength(2);
38
- },
39
- };
40
- export const visibleItems = {
41
- name: "visibleItems",
42
- render: () => (<Example>
43
- <Example.Item title="visibleItems: 3">
44
- <Carousel visibleItems={3}>
45
- <Placeholder h={100}/>
46
- <Placeholder h={100}/>
47
- <Placeholder h={100}/>
48
- <Placeholder h={100}/>
49
- <Placeholder h={100}/>
50
- <Placeholder h={100}/>
51
- </Carousel>
52
- </Example.Item>
53
-
54
- <Example.Item title={["responsive visibleItems", "s: 2, m+ 3"]}>
55
- <Carousel visibleItems={{ s: 2, m: 3 }}>
56
- <Placeholder h={100}/>
57
- <Placeholder h={100}/>
58
- <Placeholder h={100}/>
59
- <Placeholder h={100}/>
60
- <Placeholder h={100}/>
61
- <Placeholder h={100}/>
62
- </Carousel>
63
- </Example.Item>
64
-
65
- <Example.Item title="visibleItems: auto">
66
- <Carousel>
67
- <Placeholder h={100}/>
68
- <Placeholder h={100} w={200}/>
69
- <Placeholder h={100} w={300}/>
70
- <Placeholder h={100}/>
71
- <Placeholder h={100}/>
72
- <Placeholder h={100}/>
73
- </Carousel>
74
- </Example.Item>
75
- </Example>),
76
- };
77
- export const gap = {
78
- name: "gap",
79
- render: () => (<Example>
80
- <Example.Item title="gap: 2, visibleItems 3">
81
- <Carousel visibleItems={3} gap={2}>
82
- <Placeholder h={100}/>
83
- <Placeholder h={100}/>
84
- <Placeholder h={100}/>
85
- <Placeholder h={100}/>
86
- <Placeholder h={100}/>
87
- <Placeholder h={100}/>
88
- </Carousel>
89
- </Example.Item>
90
-
91
- <Example.Item title={["gap: responsive, visibleItems: 3", "s: 2, l: 8"]}>
92
- <Carousel visibleItems={3} gap={{ s: 2, l: 8 }}>
93
- <Placeholder h={100}/>
94
- <Placeholder h={100}/>
95
- <Placeholder h={100}/>
96
- <Placeholder h={100}/>
97
- <Placeholder h={100}/>
98
- <Placeholder h={100}/>
99
- </Carousel>
100
- </Example.Item>
101
- </Example>),
102
- };
103
- export const bleed = {
104
- name: "bleed",
105
- render: () => (<Example>
106
- <Example.Item title="bleed: 4, visibleItems: 3">
107
- <Carousel visibleItems={3} bleed={4}>
108
- <Placeholder h={100}/>
109
- <Placeholder h={100}/>
110
- <Placeholder h={100}/>
111
- <Placeholder h={100}/>
112
- <Placeholder h={100}/>
113
- <Placeholder h={100}/>
114
- </Carousel>
115
- </Example.Item>
116
-
117
- <Example.Item title={["responsive bleed, visibleItems: 3", "[s] 4, [l+] 0"]}>
118
- <Carousel visibleItems={3} bleed={{ s: 4, l: 0 }}>
119
- <Placeholder h={100}/>
120
- <Placeholder h={100}/>
121
- <Placeholder h={100}/>
122
- <Placeholder h={100}/>
123
- <Placeholder h={100}/>
124
- <Placeholder h={100}/>
125
- </Carousel>
126
- </Example.Item>
127
- </Example>),
128
- };
129
- export const navigationDisplay = {
130
- name: "navigationDisplay",
131
- render: () => (<Example>
132
- <Example.Item title="navigationDisplay: hidden">
133
- <Carousel visibleItems={3} navigationDisplay="hidden" attributes={{ "data-testid": "test-id" }}>
134
- <Placeholder h={100}/>
135
- <Placeholder h={100}/>
136
- <Placeholder h={100}/>
137
- <Placeholder h={100}/>
138
- <Placeholder h={100}/>
139
- <Placeholder h={100}/>
140
- </Carousel>
141
- </Example.Item>
142
- </Example>),
143
- play: async ({ canvas }) => {
144
- const root = canvas.getByTestId("test-id");
145
- const buttons = root.querySelectorAll("button");
146
- expect(buttons).toHaveLength(0);
147
- },
148
- };
149
- export const instanceRef = {
150
- name: "instanceRef, onChange",
151
- args: {
152
- handleChange: fn(),
153
- },
154
- render: (args) => {
155
- const carouselRef = React.useRef(null);
156
- const [index, setIndex] = React.useState(0);
157
- return (<Example>
158
- <Example.Item title="instanceRef, onChange">
159
- <View gap={3}>
160
- <View gap={3} direction="row" align="center">
161
- <Button onClick={() => carouselRef.current?.navigateBack()}>Back</Button>
162
- <Button onClick={() => carouselRef.current?.navigateForward()}>Forward</Button>
163
- <Button onClick={() => carouselRef.current?.navigateTo(3)}>To 3</Button>
164
- <View.Item>Index: {index}</View.Item>
165
- </View>
166
- <Carousel visibleItems={2} instanceRef={carouselRef} navigationDisplay="hidden" onChange={(changeArgs) => {
167
- args.handleChange(changeArgs);
168
- setIndex(changeArgs.index);
169
- }}>
170
- <Placeholder h={100}>Item 0</Placeholder>
171
- <Placeholder h={100}>Item 1</Placeholder>
172
- <Placeholder h={100}>Item 2</Placeholder>
173
- <Placeholder h={100}>Item 3</Placeholder>
174
- <Placeholder h={100}>Item 4</Placeholder>
175
- <Placeholder h={100}>Item 5</Placeholder>
176
- </Carousel>
177
- </View>
178
- </Example.Item>
179
- </Example>);
180
- },
181
- play: async ({ canvas, args }) => {
182
- const buttons = canvas.getAllByRole("button");
183
- const backButton = buttons[0];
184
- const forwardButton = buttons[1];
185
- const toButton = buttons[2];
186
- await userEvent.click(forwardButton);
187
- await waitFor(() => {
188
- expect(args.handleChange).toHaveBeenCalledWith({ index: 1 });
189
- expect(args.handleChange).toHaveBeenCalledWith({ index: 2 });
190
- expect(args.handleChange).not.toHaveBeenCalledWith({ index: 3 });
191
- });
192
- args.handleChange.mockClear();
193
- await userEvent.click(backButton);
194
- await waitFor(() => {
195
- expect(args.handleChange).toHaveBeenCalledWith({ index: 0 });
196
- expect(args.handleChange).toHaveBeenCalledWith({ index: 1 });
197
- });
198
- args.handleChange.mockClear();
199
- await userEvent.click(toButton);
200
- await waitFor(() => {
201
- expect(args.handleChange).toHaveBeenCalledWith({ index: 1 });
202
- expect(args.handleChange).toHaveBeenCalledWith({ index: 2 });
203
- expect(args.handleChange).toHaveBeenCalledWith({ index: 3 });
204
- });
205
- },
206
- };
207
- export const className = {
208
- name: "className, attributes",
209
- render: () => (<div data-testid="root">
210
- <Carousel visibleItems={2} className="test-classname" attributes={{ id: "test-id" }}>
211
- <Placeholder h={100}>Item 0</Placeholder>
212
- <Placeholder h={100}>Item 1</Placeholder>
213
- <Placeholder h={100}>Item 2</Placeholder>
214
- <Placeholder h={100}>Item 3</Placeholder>
215
- <Placeholder h={100}>Item 4</Placeholder>
216
- <Placeholder h={100}>Item 5</Placeholder>
217
- </Carousel>
218
- </div>),
219
- play: async ({ canvas }) => {
220
- const root = canvas.getByTestId("root").firstChild;
221
- expect(root).toHaveClass("test-classname");
222
- expect(root).toHaveAttribute("id", "test-id");
223
- },
224
- };
@@ -1,30 +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
- };
11
- };
12
- export default _default;
13
- export declare const render: StoryObj;
14
- export declare const size: {
15
- name: string;
16
- render: () => import("react").JSX.Element;
17
- };
18
- export declare const error: {
19
- name: string;
20
- render: () => import("react").JSX.Element;
21
- };
22
- export declare const disabled: StoryObj;
23
- export declare const checked: StoryObj<{
24
- handleChange: ReturnType<typeof fn>;
25
- }>;
26
- export declare const defaultChecked: StoryObj<{
27
- handleChange: ReturnType<typeof fn>;
28
- }>;
29
- export declare const indeterminate: StoryObj;
30
- export declare const className: StoryObj;
@@ -1,171 +0,0 @@
1
- import { Example } from "../../../utilities/storybook/index.js";
2
- import Checkbox from "../index.js";
3
- import View from "../../View/index.js";
4
- import { expect, fn, userEvent } from "storybook/test";
5
- export default {
6
- title: "Components/Checkbox",
7
- component: Checkbox,
8
- parameters: {
9
- iframe: {
10
- url: "https://reshaped.so/docs/components/checkbox",
11
- },
12
- },
13
- };
14
- export const render = {
15
- name: "name, value",
16
- render: () => (<Checkbox name="test-name" value="test-value">
17
- Content
18
- </Checkbox>),
19
- play: async ({ canvas }) => {
20
- const input = canvas.getByRole("checkbox");
21
- expect(input).toHaveAttribute("value", "test-value");
22
- expect(input).toHaveAttribute("name", "test-name");
23
- expect(input).not.toBeChecked();
24
- },
25
- };
26
- export const size = {
27
- name: "size",
28
- render: () => (<Example>
29
- <Example.Item title="size: small">
30
- <View gap={4} direction="row">
31
- <Checkbox name="animal" value="dog" size="small" defaultChecked>
32
- Checkbox
33
- </Checkbox>
34
- <Checkbox name="animal" value="dog" size="small" indeterminate>
35
- Checkbox
36
- </Checkbox>
37
- </View>
38
- </Example.Item>
39
- <Example.Item title="size: medium">
40
- <View gap={4} direction="row">
41
- <Checkbox name="animal" value="dog" size="medium" defaultChecked>
42
- Checkbox
43
- </Checkbox>
44
- <Checkbox name="animal" value="dog" size="medium" indeterminate>
45
- Checkbox
46
- </Checkbox>
47
- </View>
48
- </Example.Item>
49
- <Example.Item title="size: large">
50
- <View gap={4} direction="row">
51
- <Checkbox name="animal" value="dog" size="large" defaultChecked>
52
- Checkbox
53
- </Checkbox>
54
- <Checkbox name="animal" value="dog" size="large" indeterminate>
55
- Checkbox
56
- </Checkbox>
57
- </View>
58
- </Example.Item>
59
- <Example.Item title="size: responsive, s: small, m: large">
60
- <View gap={4} direction="row">
61
- <Checkbox name="animal" value="dog" size={{ s: "small", m: "large" }} defaultChecked>
62
- Checkbox
63
- </Checkbox>
64
- </View>
65
- </Example.Item>
66
- </Example>),
67
- };
68
- export const error = {
69
- name: "hasError",
70
- render: () => (<Example>
71
- <Example.Item title="error">
72
- <Checkbox name="animal" value="dog" hasError>
73
- Checkbox
74
- </Checkbox>
75
- </Example.Item>
76
- </Example>),
77
- };
78
- export const disabled = {
79
- name: "disabled",
80
- render: () => (<Example>
81
- <Example.Item title="disabled">
82
- <Checkbox name="animal" value="dog" disabled>
83
- Checkbox
84
- </Checkbox>
85
- </Example.Item>
86
- <Example.Item title="disabled, checked">
87
- <Checkbox name="animal" value="dog" disabled checked>
88
- Checkbox
89
- </Checkbox>
90
- </Example.Item>
91
- <Example.Item title="disabled, indeterminate">
92
- <Checkbox name="animal" value="dog" disabled indeterminate>
93
- Checkbox
94
- </Checkbox>
95
- </Example.Item>
96
- </Example>),
97
- play: async ({ canvas }) => {
98
- const [input] = canvas.getAllByRole("checkbox");
99
- expect(input).toBeDisabled();
100
- },
101
- };
102
- export const checked = {
103
- name: "checked, controlled",
104
- args: {
105
- handleChange: fn(),
106
- },
107
- render: (args) => (<Checkbox name="test-name" value="test-value" checked onChange={args.handleChange}>
108
- Content
109
- </Checkbox>),
110
- play: async ({ canvas, args }) => {
111
- const input = canvas.getByRole("checkbox");
112
- expect(input).toBeChecked();
113
- await userEvent.click(input);
114
- expect(args.handleChange).toHaveBeenCalledTimes(1);
115
- expect(args.handleChange).toHaveBeenCalledWith({
116
- name: "test-name",
117
- value: "test-value",
118
- checked: false,
119
- event: expect.objectContaining({ target: input }),
120
- });
121
- // Still checked because it's controlled
122
- expect(input).toBeChecked();
123
- },
124
- };
125
- export const defaultChecked = {
126
- name: "defaultChecked, uncontrolled",
127
- args: {
128
- handleChange: fn(),
129
- },
130
- render: (args) => (<Checkbox name="test-name" value="test-value" defaultChecked onChange={args.handleChange}>
131
- Content
132
- </Checkbox>),
133
- play: async ({ canvas, args }) => {
134
- const input = canvas.getByRole("checkbox");
135
- expect(input).toBeChecked();
136
- await userEvent.click(input);
137
- expect(args.handleChange).toHaveBeenCalledTimes(1);
138
- expect(args.handleChange).toHaveBeenCalledWith({
139
- name: "test-name",
140
- value: "test-value",
141
- checked: false,
142
- event: expect.objectContaining({ target: input }),
143
- });
144
- expect(input).not.toBeChecked();
145
- },
146
- };
147
- export const indeterminate = {
148
- name: "indeterminate",
149
- render: () => (<Checkbox name="test-name" value="test-value" indeterminate>
150
- Content
151
- </Checkbox>),
152
- play: async ({ canvas }) => {
153
- const input = canvas.getByRole("checkbox");
154
- expect(input.indeterminate).toBeTruthy();
155
- await userEvent.click(input);
156
- expect(input.indeterminate).toBeFalsy();
157
- },
158
- };
159
- export const className = {
160
- name: "className, attributes",
161
- render: () => (<div data-testid="root">
162
- <Checkbox className="test-classname" attributes={{ id: "test-id" }}>
163
- Content
164
- </Checkbox>
165
- </div>),
166
- play: async ({ canvas }) => {
167
- const root = canvas.getByTestId("root").firstChild;
168
- expect(root).toHaveClass("test-classname");
169
- expect(root).toHaveAttribute("id", "test-id");
170
- },
171
- };
@@ -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("./..").CheckboxGroupProps>;
6
- parameters: {
7
- iframe: {
8
- url: string;
9
- };
10
- };
11
- };
12
- export default _default;
13
- export declare const value: StoryObj<{
14
- handleChange: ReturnType<typeof fn>;
15
- }>;
16
- export declare const defaultValue: StoryObj<{
17
- handleChange: ReturnType<typeof fn>;
18
- }>;
19
- export declare const disabled: StoryObj;
@@ -1,83 +0,0 @@
1
- import View from "../../View/index.js";
2
- import CheckboxGroup from "../index.js";
3
- import Checkbox from "../../Checkbox/index.js";
4
- import { expect, fn, userEvent } from "storybook/test";
5
- export default {
6
- title: "Components/CheckboxGroup",
7
- component: CheckboxGroup,
8
- parameters: {
9
- iframe: {
10
- url: "https://reshaped.so/docs/components/checkbox",
11
- },
12
- },
13
- };
14
- export const value = {
15
- name: "value, controlled",
16
- args: {
17
- handleChange: fn(),
18
- },
19
- render: (args) => (<View gap={2}>
20
- <CheckboxGroup name="test-name" value={["1"]} onChange={args.handleChange}>
21
- {/* checked should be ignored */}
22
- <Checkbox value="1" checked={false}>
23
- Content
24
- </Checkbox>
25
-
26
- <Checkbox value="2">Content 2</Checkbox>
27
- </CheckboxGroup>
28
- </View>),
29
- play: async ({ canvas, args }) => {
30
- const inputs = canvas.getAllByRole("checkbox");
31
- expect(inputs[0]).toBeChecked();
32
- await userEvent.click(inputs[1]);
33
- expect(args.handleChange).toHaveBeenCalledTimes(1);
34
- expect(args.handleChange).toHaveBeenCalledWith({
35
- name: "test-name",
36
- value: ["1", "2"],
37
- event: expect.objectContaining({ target: inputs[1] }),
38
- });
39
- // Still checked because it's controlled
40
- expect(inputs[0]).toBeChecked();
41
- expect(inputs[1]).not.toBeChecked();
42
- },
43
- };
44
- export const defaultValue = {
45
- name: "defaultValue, uncontrolled",
46
- args: {
47
- handleChange: fn(),
48
- },
49
- render: (args) => (<View gap={2}>
50
- <CheckboxGroup name="test-name" defaultValue={["1"]} onChange={args.handleChange}>
51
- {/* checked should be ignored */}
52
- <Checkbox value="1" checked={false}>
53
- Content
54
- </Checkbox>
55
-
56
- <Checkbox value="2">Content 2</Checkbox>
57
- </CheckboxGroup>
58
- </View>),
59
- play: async ({ canvas, args }) => {
60
- const inputs = canvas.getAllByRole("checkbox");
61
- expect(inputs[0]).toBeChecked();
62
- await userEvent.click(inputs[1]);
63
- expect(args.handleChange).toHaveBeenCalledTimes(1);
64
- expect(args.handleChange).toHaveBeenCalledWith({
65
- name: "test-name",
66
- value: ["1", "2"],
67
- event: expect.objectContaining({ target: inputs[1] }),
68
- });
69
- expect(inputs[0]).toBeChecked();
70
- expect(inputs[1]).toBeChecked();
71
- },
72
- };
73
- export const disabled = {
74
- name: "disabled",
75
- render: () => (<CheckboxGroup name="test-name" disabled>
76
- <Checkbox value="test-value">Item 1</Checkbox>
77
- <Checkbox value="test-value-2">Item 2</Checkbox>
78
- </CheckboxGroup>),
79
- play: async ({ canvas }) => {
80
- const [input] = canvas.getAllByRole("checkbox");
81
- expect(input).toBeDisabled();
82
- },
83
- };
@@ -1,24 +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
- };
10
- };
11
- export default _default;
12
- export declare const padding: {
13
- name: string;
14
- render: () => import("react").JSX.Element;
15
- };
16
- export declare const size: {
17
- name: string;
18
- render: () => import("react").JSX.Element;
19
- };
20
- export declare const flex: {
21
- name: string;
22
- render: () => import("react").JSX.Element;
23
- };
24
- export declare const className: StoryObj;
@@ -1,75 +0,0 @@
1
- import { Example, Placeholder } from "../../../utilities/storybook/index.js";
2
- import Container from "../index.js";
3
- import { expect } from "storybook/test";
4
- export default {
5
- title: "Utility components/Container",
6
- component: Container,
7
- parameters: {
8
- iframe: {
9
- url: "https://reshaped.so/docs/utilities/container",
10
- },
11
- },
12
- };
13
- export const padding = {
14
- name: "padding",
15
- render: () => (<Example>
16
- <Example.Item title="padding: default">
17
- <Container>
18
- <Placeholder />
19
- </Container>
20
- </Example.Item>
21
- <Example.Item title="padding: 0">
22
- <Container padding={0}>
23
- <Placeholder />
24
- </Container>
25
- </Example.Item>
26
- </Example>),
27
- };
28
- export const size = {
29
- name: "width, height, maxHeight",
30
- render: () => (<Example>
31
- <Example.Item title="width: 200px, height: 200px">
32
- <Container width="200px" height="200px">
33
- <Placeholder h="100%"/>
34
- </Container>
35
- </Example.Item>
36
- <Example.Item title="width: 200px, height: 200px, maxHeight: 100px">
37
- <Container width="200px" height="200px" maxHeight="100px">
38
- <Placeholder h="100%"/>
39
- </Container>
40
- </Example.Item>
41
- <Example.Item title="width, height: [s] 100px, [m+] 200px">
42
- <Container width={{ s: "100px", m: "200px" }} height={{ s: "100px", m: "200px" }}>
43
- <Placeholder h="100%"/>
44
- </Container>
45
- </Example.Item>
46
- <Example.Item title="width, height: [s] 100px, [m+] 200px, maxHeight: [s] 50px, [m+]: 100px">
47
- <Container width={{ s: "100px", m: "200px" }} height={{ s: "100px", m: "200px" }} maxHeight={{ s: "50px", m: "100px" }}>
48
- <Placeholder h="100%"/>
49
- </Container>
50
- </Example.Item>
51
- </Example>),
52
- };
53
- export const flex = {
54
- name: "align, justify",
55
- render: () => (<Example>
56
- <Example.Item title="align: center, justify: center">
57
- <Container align="center" justify="center" height="200px">
58
- <Placeholder />
59
- </Container>
60
- </Example.Item>
61
- </Example>),
62
- };
63
- export const className = {
64
- name: "className, attributes",
65
- render: () => (<div data-testid="root">
66
- <Container className="test-classname" attributes={{ id: "test-id" }}>
67
- <Placeholder />
68
- </Container>
69
- </div>),
70
- play: async ({ canvas }) => {
71
- const root = canvas.getByTestId("root").firstChild;
72
- expect(root).toHaveClass("test-classname");
73
- expect(root).toHaveAttribute("id", "test-id");
74
- },
75
- };
@@ -1,26 +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
- };
17
- };
18
- export default _default;
19
- export declare const base: {
20
- name: string;
21
- render: () => import("react").JSX.Element;
22
- };
23
- export declare const handlers: StoryObj<{
24
- handleOpen: ReturnType<typeof fn>;
25
- handleClose: ReturnType<typeof fn>;
26
- }>;