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,38 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- declare const _default: {
3
- title: string;
4
- component: import("react").FC<import("./..").ResizableProps> & {
5
- Item: typeof import("../Resizable").ResizableItem;
6
- Handle: import("react").FC<import("./..").ResizableHandleProps>;
7
- };
8
- parameters: {
9
- iframe: {
10
- url: string;
11
- };
12
- a11y: {
13
- disable: boolean;
14
- };
15
- };
16
- };
17
- export default _default;
18
- export declare const direction: {
19
- name: string;
20
- render: () => import("react").JSX.Element;
21
- };
22
- export declare const children: {
23
- name: string;
24
- render: () => import("react").JSX.Element;
25
- };
26
- export declare const variant: {
27
- name: string;
28
- render: () => import("react").JSX.Element;
29
- };
30
- export declare const size: {
31
- name: string;
32
- render: () => import("react").JSX.Element;
33
- };
34
- export declare const layout: {
35
- name: string;
36
- render: () => import("react").JSX.Element;
37
- };
38
- export declare const className: StoryObj;
@@ -1,185 +0,0 @@
1
- import { expect } from "storybook/test";
2
- import { Example } from "../../../utilities/storybook/index.js";
3
- import Resizable from "../index.js";
4
- import View from "../../View/index.js";
5
- import Button from "../../Button/index.js";
6
- export default {
7
- title: "Components/Resizable",
8
- component: Resizable,
9
- parameters: {
10
- iframe: {
11
- url: "https://reshaped.so/docs/utilities/resizable",
12
- },
13
- // Skip because of the aria-hidden applied to buttons, they're not needed for the screen reader navigation
14
- a11y: {
15
- disable: true,
16
- },
17
- },
18
- };
19
- const Panel = (props) => (<View backgroundColor="neutral-faded" borderRadius="medium" align="center" justify="center" height={props.height ?? "100%"}>
20
- Panel
21
- </View>);
22
- const Handle = () => {
23
- return (<Resizable.Handle>
24
- {(attributes, props) => (<View backgroundColor={props.status === "dragging" ? "primary" : "primary-faded"} padding={props.direction === "column" ? 1 : 8} height="100%" align="center" justify="center" borderRadius="small" animated>
25
- <Button attributes={attributes} type="button">
26
- Drag me
27
- </Button>
28
- </View>)}
29
- </Resizable.Handle>);
30
- };
31
- export const direction = {
32
- name: "direction",
33
- render: () => {
34
- return (<Example>
35
- <Example.Item title="row">
36
- <Resizable height="200px">
37
- <Resizable.Item>
38
- <Panel />
39
- </Resizable.Item>
40
- <Resizable.Handle />
41
- <Resizable.Item>
42
- <Panel />
43
- </Resizable.Item>
44
- <Resizable.Handle />
45
- <Resizable.Item>
46
- <Panel />
47
- </Resizable.Item>
48
- </Resizable>
49
- </Example.Item>
50
- <Example.Item title="column">
51
- <Resizable height="400px" direction="column">
52
- <Resizable.Item>
53
- <Panel />
54
- </Resizable.Item>
55
- <Resizable.Handle />
56
- <Resizable.Item>
57
- <Panel />
58
- </Resizable.Item>
59
- <Resizable.Handle />
60
- <Resizable.Item>
61
- <Panel />
62
- </Resizable.Item>
63
- </Resizable>
64
- </Example.Item>
65
-
66
- {/* Test that page doesn't scroll on dragging */}
67
- <div style={{ height: 2000 }}/>
68
- </Example>);
69
- },
70
- };
71
- export const children = {
72
- name: "children",
73
- render: () => {
74
- return (<Example>
75
- <Example.Item title="render props, row">
76
- <Resizable height="200px">
77
- <Resizable.Item>
78
- <Panel />
79
- </Resizable.Item>
80
- <Resizable.Handle />
81
- <Resizable.Item>
82
- <Panel />
83
- </Resizable.Item>
84
- <Handle />
85
- <Resizable.Item>
86
- <Panel />
87
- </Resizable.Item>
88
- </Resizable>
89
- </Example.Item>
90
- <Example.Item title="render props, column">
91
- <Resizable height="400px" direction="column">
92
- <Resizable.Item>
93
- <Panel />
94
- </Resizable.Item>
95
- <Resizable.Handle />
96
- <Resizable.Item>
97
- <Panel />
98
- </Resizable.Item>
99
- <Handle />
100
- <Resizable.Item>
101
- <Panel />
102
- </Resizable.Item>
103
- </Resizable>
104
- </Example.Item>
105
- </Example>);
106
- },
107
- };
108
- export const variant = {
109
- name: "variant",
110
- render: () => (<Example>
111
- <Example.Item title="bordered, row">
112
- <Resizable height="200px" variant="bordered">
113
- <Resizable.Item>
114
- <Panel />
115
- </Resizable.Item>
116
- <Resizable.Handle />
117
- <Resizable.Item>
118
- <Panel />
119
- </Resizable.Item>
120
- <Resizable.Handle />
121
- <Resizable.Item>
122
- <Panel />
123
- </Resizable.Item>
124
- </Resizable>
125
- </Example.Item>
126
- <Example.Item title="bordered, column">
127
- <Resizable height="400px" direction="column" variant="bordered">
128
- <Resizable.Item>
129
- <Panel />
130
- </Resizable.Item>
131
- <Resizable.Handle />
132
- <Resizable.Item>
133
- <Panel />
134
- </Resizable.Item>
135
- <Resizable.Handle />
136
- <Resizable.Item>
137
- <Panel />
138
- </Resizable.Item>
139
- </Resizable>
140
- </Example.Item>
141
- </Example>),
142
- };
143
- export const size = {
144
- name: "minSize, maxSize, defaultSize",
145
- render: () => (<Resizable className="test-classname" attributes={{ id: "test-id" }} height="200px">
146
- <Resizable.Item>
147
- <Panel />
148
- </Resizable.Item>
149
- <Resizable.Handle />
150
- <Resizable.Item minSize="200px" maxSize="500px" defaultSize="300px">
151
- <Panel />
152
- </Resizable.Item>
153
- </Resizable>),
154
- };
155
- export const layout = {
156
- name: "height, gap",
157
- render: () => (<Resizable height="100px" gap={8}>
158
- <Resizable.Item>
159
- <Panel />
160
- </Resizable.Item>
161
- <Resizable.Handle />
162
- <Resizable.Item>
163
- <Panel />
164
- </Resizable.Item>
165
- </Resizable>),
166
- };
167
- export const className = {
168
- name: "className, attributes",
169
- render: () => (<div data-testid="root">
170
- <Resizable className="test-classname" attributes={{ id: "test-id" }} height="200px">
171
- <Resizable.Item>
172
- <Panel />
173
- </Resizable.Item>
174
- <Resizable.Handle />
175
- <Resizable.Item>
176
- <Panel />
177
- </Resizable.Item>
178
- </Resizable>
179
- </div>),
180
- play: async ({ canvas }) => {
181
- const root = canvas.getByTestId("root").firstChild;
182
- expect(root).toHaveClass("test-classname");
183
- expect(root).toHaveAttribute("id", "test-id");
184
- },
185
- };
@@ -1,20 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- declare const _default: {
3
- title: string;
4
- component: import("react").FC<import("./..").ScrimProps>;
5
- parameters: {
6
- iframe: {
7
- url: string;
8
- };
9
- };
10
- };
11
- export default _default;
12
- export declare const position: {
13
- name: string;
14
- render: () => import("react").JSX.Element;
15
- };
16
- export declare const className: StoryObj;
17
- export declare const composition: {
18
- name: string;
19
- render: () => import("react").JSX.Element;
20
- };
@@ -1,67 +0,0 @@
1
- import { Example, Placeholder } from "../../../utilities/storybook/index.js";
2
- import Scrim from "../index.js";
3
- import { expect } from "storybook/test";
4
- export default {
5
- title: "Components/Scrim",
6
- component: Scrim,
7
- parameters: {
8
- iframe: {
9
- url: "https://reshaped.so/docs/components/scrim",
10
- },
11
- },
12
- };
13
- export const position = {
14
- name: "position",
15
- render: () => (<Example>
16
- <Example.Item title="position: center">
17
- <Scrim backgroundSlot={<Placeholder h={200}/>}>Scrim</Scrim>
18
- </Example.Item>
19
-
20
- <Example.Item title="position: bottom">
21
- <Scrim position="bottom" backgroundSlot={<Placeholder h={200}/>}>
22
- Scrim
23
- </Scrim>
24
- </Example.Item>
25
-
26
- <Example.Item title="position: top">
27
- <Scrim position="top" backgroundSlot={<Placeholder h={200}/>}>
28
- Scrim
29
- </Scrim>
30
- </Example.Item>
31
-
32
- <Example.Item title="position: start">
33
- <Scrim position="start" backgroundSlot={<Placeholder h={200}/>}>
34
- Scrim
35
- </Scrim>
36
- </Example.Item>
37
-
38
- <Example.Item title="position: end">
39
- <Scrim position="end" backgroundSlot={<Placeholder h={200}/>}>
40
- Scrim
41
- </Scrim>
42
- </Example.Item>
43
- </Example>),
44
- };
45
- export const className = {
46
- name: "className, attributes",
47
- render: () => (<div data-testid="root">
48
- <Scrim className="test-classname" attributes={{ id: "test-id" }}>
49
- Content
50
- </Scrim>
51
- </div>),
52
- play: async ({ canvas }) => {
53
- const root = canvas.getByTestId("root").firstChild;
54
- expect(root).toHaveClass("test-classname");
55
- expect(root).toHaveAttribute("id", "test-id");
56
- },
57
- };
58
- export const composition = {
59
- name: "test: composition",
60
- render: () => (<Example>
61
- <Example.Item title="without backgroundSlot, size is based on the parent component">
62
- <div style={{ height: 300, position: "relative" }}>
63
- <Scrim>Text</Scrim>
64
- </div>
65
- </Example.Item>
66
- </Example>),
67
- };
@@ -1,37 +0,0 @@
1
- import React from "react";
2
- import { StoryObj } from "@storybook/react-vite";
3
- import { Mock } from "storybook/test";
4
- declare const _default: {
5
- title: string;
6
- component: React.ForwardRefExoticComponent<import("./..").ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
7
- parameters: {
8
- iframe: {
9
- url: string;
10
- };
11
- a11y: {
12
- disable: boolean;
13
- };
14
- };
15
- };
16
- export default _default;
17
- export declare const base: {
18
- name: string;
19
- render: () => React.JSX.Element;
20
- };
21
- export declare const scrollbarDisplay: {
22
- name: string;
23
- render: () => React.JSX.Element;
24
- };
25
- export declare const height: {
26
- name: string;
27
- render: () => React.JSX.Element;
28
- };
29
- export declare const onScroll: StoryObj<{
30
- handleScroll: Mock;
31
- }>;
32
- export declare const className: StoryObj;
33
- export declare const testNested: {
34
- name: string;
35
- render: () => React.JSX.Element;
36
- };
37
- export declare const testDynamicHeight: StoryObj;
@@ -1,244 +0,0 @@
1
- import React from "react";
2
- import { userEvent, expect, waitFor, fn } from "storybook/test";
3
- import { Example } from "../../../utilities/storybook/index.js";
4
- import ScrollArea from "../index.js";
5
- import View from "../../View/index.js";
6
- import Button from "../../Button/index.js";
7
- export default {
8
- title: "Utility components/ScrollArea",
9
- component: ScrollArea,
10
- parameters: {
11
- iframe: {
12
- url: "https://reshaped.so/docs/utilities/scroll-area",
13
- },
14
- // Skip because axe core incorrectly reports contrast issues
15
- a11y: {
16
- disable: true,
17
- },
18
- },
19
- };
20
- export const base = {
21
- name: "base",
22
- render: () => (<Example>
23
- <Example.Item title="vertical scroll">
24
- <ScrollArea height="100px" scrollbarDisplay="visible">
25
- <View backgroundColor="elevation-base" padding={4}>
26
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
27
- has been the industry's standard dummy text ever since the 1500s, when an unknown
28
- printer took a galley of type and scrambled it to make a type specimen book. It has
29
- survived not only five centuries, but also the leap into electronic typesetting,
30
- remaining essentially unchanged. It was popularised in the 1960s with the release of
31
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
32
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
33
- </View>
34
- </ScrollArea>
35
- </Example.Item>
36
-
37
- <Example.Item title="horizontal scroll">
38
- <ScrollArea height="100px" scrollbarDisplay="visible">
39
- <View backgroundColor="elevation-base" padding={4} width="150%" height="100px">
40
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
41
- has been the industry's standard dummy text ever since the 1500s
42
- </View>
43
- </ScrollArea>
44
- </Example.Item>
45
-
46
- <Example.Item title="horizontal and vertical scroll">
47
- <ScrollArea height="100px" scrollbarDisplay="visible">
48
- <View backgroundColor="elevation-base" padding={4} width="150%">
49
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
50
- has been the industry's standard dummy text ever since the 1500s, when an unknown
51
- printer took a galley of type and scrambled it to make a type specimen book. It has
52
- survived not only five centuries, but also the leap into electronic typesetting,
53
- remaining essentially unchanged. It was popularised in the 1960s with the release of
54
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
55
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
56
- </View>
57
- </ScrollArea>
58
- </Example.Item>
59
- </Example>),
60
- };
61
- export const scrollbarDisplay = {
62
- name: "scrollbarDisplay",
63
- render: () => (<Example>
64
- <Example.Item title="scrollbarDisplay: hover">
65
- <ScrollArea height="100px">
66
- <View backgroundColor="elevation-base" padding={4} width="150%">
67
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
68
- has been the industry's standard dummy text ever since the 1500s, when an unknown
69
- printer took a galley of type and scrambled it to make a type specimen book. It has
70
- survived not only five centuries, but also the leap into electronic typesetting,
71
- remaining essentially unchanged. It was popularised in the 1960s with the release of
72
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
73
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
74
- </View>
75
- </ScrollArea>
76
- </Example.Item>
77
-
78
- <Example.Item title="scrollbarDisplay: hidden">
79
- <ScrollArea height="100px" scrollbarDisplay="hidden">
80
- <View backgroundColor="elevation-base" padding={4} width="150%">
81
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
82
- has been the industry's standard dummy text ever since the 1500s, when an unknown
83
- printer took a galley of type and scrambled it to make a type specimen book. It has
84
- survived not only five centuries, but also the leap into electronic typesetting,
85
- remaining essentially unchanged. It was popularised in the 1960s with the release of
86
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
87
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
88
- </View>
89
- </ScrollArea>
90
- </Example.Item>
91
-
92
- <Example.Item title="scrollbarDisplay: visible">
93
- <ScrollArea height="100px" scrollbarDisplay="visible">
94
- <View backgroundColor="elevation-base" padding={4} width="150%">
95
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
96
- has been the industry's standard dummy text ever since the 1500s, when an unknown
97
- printer took a galley of type and scrambled it to make a type specimen book. It has
98
- survived not only five centuries, but also the leap into electronic typesetting,
99
- remaining essentially unchanged. It was popularised in the 1960s with the release of
100
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
101
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
102
- </View>
103
- </ScrollArea>
104
- </Example.Item>
105
- </Example>),
106
- };
107
- export const height = {
108
- name: "height, maxHeight",
109
- render: () => (<Example>
110
- <Example.Item title="height: 80px">
111
- <ScrollArea height="80px">
112
- <View backgroundColor="elevation-base" padding={4}>
113
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
114
- has been the industry's standard dummy text ever since the 1500s, when an unknown
115
- printer took a galley of type and scrambled it to make a type specimen book. It has
116
- survived not only five centuries, but also the leap into electronic typesetting,
117
- remaining essentially unchanged. It was popularised in the 1960s with the release of
118
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
119
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
120
- </View>
121
- </ScrollArea>
122
- </Example.Item>
123
-
124
- <Example.Item title="responsive height: s 80px, m: 120px">
125
- <ScrollArea height={{ s: "80px", m: "120px" }}>
126
- <View backgroundColor="elevation-base" padding={4}>
127
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
128
- has been the industry's standard dummy text ever since the 1500s, when an unknown
129
- printer took a galley of type and scrambled it to make a type specimen book. It has
130
- survived not only five centuries, but also the leap into electronic typesetting,
131
- remaining essentially unchanged. It was popularised in the 1960s with the release of
132
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
133
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
134
- </View>
135
- </ScrollArea>
136
- </Example.Item>
137
-
138
- <Example.Item title="maxHeight: 80px">
139
- <ScrollArea maxHeight="80px">
140
- <View backgroundColor="elevation-base" padding={4}>
141
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
142
- has been the industry's standard dummy text ever since the 1500s, when an unknown
143
- printer took a galley of type and scrambled it to make a type specimen book. It has
144
- survived not only five centuries, but also the leap into electronic typesetting,
145
- remaining essentially unchanged. It was popularised in the 1960s with the release of
146
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
147
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
148
- </View>
149
- </ScrollArea>
150
- </Example.Item>
151
-
152
- <Example.Item title="responsive max height: s 80px, m: 200px">
153
- <ScrollArea maxHeight={{ s: "80px", m: "200px" }}>
154
- <View backgroundColor="elevation-base" padding={4}>
155
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
156
- has been the industry's standard dummy text ever since the 1500s, when an unknown
157
- printer took a galley of type and scrambled it to make a type specimen book. It has
158
- survived not only five centuries, but also the leap into electronic typesetting,
159
- remaining essentially unchanged. It was popularised in the 1960s with the release of
160
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
161
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
162
- </View>
163
- </ScrollArea>
164
- </Example.Item>
165
- </Example>),
166
- };
167
- export const onScroll = {
168
- name: "ref, onScroll",
169
- args: {
170
- handleScroll: fn(),
171
- },
172
- render: (args) => {
173
- const ref = React.useRef(null);
174
- return (<View gap={4}>
175
- <View.Item>
176
- <Button onClick={() => ref.current?.scrollBy({ top: 50, left: 50 })}>Scroll</Button>
177
- </View.Item>
178
- <ScrollArea height="100px" ref={ref} scrollbarDisplay="visible" onScroll={args.handleScroll}>
179
- <View backgroundColor="neutral-faded" padding={4} width="1000px" height="200px">
180
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
181
- has been the industry's standard dummy text ever since the 1500s, when an unknown
182
- printer took a galley of type and scrambled it to make a type specimen book. It has
183
- survived not only five centuries, but also the leap into electronic typesetting,
184
- remaining essentially unchanged. It was popularised in the 1960s with the release of
185
- Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
186
- publishing software like Aldus PageMaker including versions of Lorem Ipsum.
187
- </View>
188
- </ScrollArea>
189
- </View>);
190
- },
191
- play: async ({ canvas, args }) => {
192
- const trigger = canvas.getAllByRole("button")[0];
193
- await userEvent.click(trigger);
194
- await waitFor(() => {
195
- expect(args.handleScroll).toHaveBeenCalledTimes(1);
196
- // x value is flaky, so only testing y here
197
- expect(args.handleScroll).toHaveBeenCalledWith(expect.objectContaining({ y: 0.5 }));
198
- });
199
- },
200
- };
201
- export const className = {
202
- name: "className, attributes",
203
- render: () => (<div data-testid="root">
204
- <ScrollArea className="test-classname" attributes={{ id: "test-id" }}>
205
- Content
206
- </ScrollArea>
207
- </div>),
208
- play: async ({ canvas }) => {
209
- const root = canvas.getByTestId("root").firstChild;
210
- expect(root).toHaveClass("test-classname");
211
- expect(root).toHaveAttribute("id", "test-id");
212
- },
213
- };
214
- export const testNested = {
215
- name: "test: nested",
216
- render: () => (<ScrollArea height="100px" scrollbarDisplay="visible">
217
- <View padding={4} paddingInline={16}>
218
- <ScrollArea height="200px" scrollbarDisplay="visible">
219
- {Array(20)
220
- .fill("")
221
- .map((_, index) => {
222
- return <div key={index}>Item {index + 1}</div>;
223
- })}
224
- </ScrollArea>
225
- </View>
226
- </ScrollArea>),
227
- };
228
- export const testDynamicHeight = {
229
- name: "test: dynamic height change",
230
- render: () => {
231
- const [count, setCount] = React.useState(10);
232
- return (<View gap={4}>
233
- <View.Item>
234
- <Button onClick={() => setCount((prev) => prev + 10)}>Add more items</Button>
235
- </View.Item>
236
-
237
- <ScrollArea height="200px" scrollbarDisplay="visible">
238
- <View gap={2}>
239
- {new Array(count).fill("").map((_, i) => (<View.Item key={i}>Item {i + 1}</View.Item>))}
240
- </View>
241
- </ScrollArea>
242
- </View>);
243
- },
244
- };
@@ -1,53 +0,0 @@
1
- import React from "react";
2
- import { Mock } from "storybook/test";
3
- import { StoryObj } from "@storybook/react-vite";
4
- declare const _default: {
5
- title: string;
6
- component: React.FC<import("../Select.types").NativeProps> & {
7
- Custom: React.FC<import("../Select.types").CustomProps>;
8
- Option: React.FC<import("../Select.types").OptionProps>;
9
- Group: React.FC<import("../Select.types").GroupProps>;
10
- OptionGroup: React.FC<import("../Select.types").GroupProps>;
11
- };
12
- parameters: {
13
- iframe: {
14
- url: string;
15
- };
16
- };
17
- };
18
- export default _default;
19
- export declare const nativeRender: StoryObj;
20
- export declare const customRender: StoryObj;
21
- export declare const nativeHandlers: StoryObj<{
22
- handleChange: Mock;
23
- handleControlledChange: Mock;
24
- handleFocus: Mock;
25
- handleBlur: Mock;
26
- handleClick: Mock;
27
- }>;
28
- export declare const customHandlers: StoryObj<{
29
- handleChange: Mock;
30
- handleControlledChange: Mock;
31
- handleFocus: Mock;
32
- handleBlur: Mock;
33
- handleClick: Mock;
34
- }>;
35
- export declare const triggerOnly: StoryObj<{
36
- handleClick: Mock;
37
- }>;
38
- export declare const multiple: StoryObj<{
39
- handleChange: Mock;
40
- }>;
41
- export declare const variant: StoryObj;
42
- export declare const size: StoryObj;
43
- export declare const startSlot: StoryObj;
44
- export declare const renderValue: {
45
- name: string;
46
- render: () => React.JSX.Element;
47
- };
48
- export declare const error: StoryObj;
49
- export declare const disabled: StoryObj;
50
- export declare const className: StoryObj;
51
- export declare const fallback: StoryObj;
52
- export declare const formControl: StoryObj;
53
- export declare const testComposition: StoryObj;