reshaped 3.6.0-canary.0 → 3.6.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 (122) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/dist/bundle.css +1 -1
  3. package/dist/bundle.d.ts +1 -1
  4. package/dist/bundle.js +11 -11
  5. package/dist/components/Accordion/AccordionControlled.js +1 -1
  6. package/dist/components/Accordion/AccordionTrigger.js +1 -1
  7. package/dist/components/ActionBar/ActionBar.js +1 -1
  8. package/dist/components/Actionable/Actionable.js +1 -1
  9. package/dist/components/Autocomplete/tests/Autocomplete.stories.js +1 -0
  10. package/dist/components/Avatar/Avatar.js +1 -1
  11. package/dist/components/Badge/Badge.js +1 -1
  12. package/dist/components/Badge/BadgeContainer.js +1 -1
  13. package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
  14. package/dist/components/Button/Button.js +1 -1
  15. package/dist/components/Button/ButtonGroup.js +1 -1
  16. package/dist/components/Calendar/CalendarDate.js +1 -1
  17. package/dist/components/Card/Card.d.ts +1 -1
  18. package/dist/components/Card/Card.js +1 -1
  19. package/dist/components/Card/tests/Card.stories.d.ts +1 -1
  20. package/dist/components/Card/tests/Card.test.stories.d.ts +1 -1
  21. package/dist/components/Carousel/Carousel.js +4 -3
  22. package/dist/components/Carousel/CarouselControl.js +1 -1
  23. package/dist/components/Checkbox/Checkbox.js +1 -1
  24. package/dist/components/Checkbox/Checkbox.module.css +1 -1
  25. package/dist/components/Container/Container.js +1 -1
  26. package/dist/components/Dismissible/Dismissible.js +1 -1
  27. package/dist/components/Divider/Divider.js +1 -1
  28. package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
  29. package/dist/components/FileUpload/FileUpload.js +1 -1
  30. package/dist/components/Flyout/FlyoutContent.js +4 -3
  31. package/dist/components/Flyout/utilities/calculatePosition.d.ts +1 -1
  32. package/dist/components/Flyout/utilities/calculatePosition.js +1 -1
  33. package/dist/components/FormControl/FormControl.context.d.ts +0 -2
  34. package/dist/components/Grid/Grid.js +1 -1
  35. package/dist/components/Hidden/Hidden.js +1 -1
  36. package/dist/components/Hotkey/Hotkey.js +1 -1
  37. package/dist/components/Icon/Icon.js +1 -1
  38. package/dist/components/Image/Image.js +1 -1
  39. package/dist/components/Link/Link.js +1 -1
  40. package/dist/components/Loader/Loader.js +1 -1
  41. package/dist/components/MenuItem/MenuItem.js +1 -1
  42. package/dist/components/Modal/Modal.js +1 -1
  43. package/dist/components/NumberField/NumberFieldControlled.js +1 -1
  44. package/dist/components/Overlay/Overlay.js +1 -1
  45. package/dist/components/PinField/PinFieldControlled.js +1 -1
  46. package/dist/components/Popover/Popover.js +3 -3
  47. package/dist/components/Popover/Popover.module.css +1 -1
  48. package/dist/components/Popover/Popover.types.d.ts +1 -0
  49. package/dist/components/Popover/tests/Popover.stories.d.ts +46 -7
  50. package/dist/components/Popover/tests/Popover.stories.js +209 -85
  51. package/dist/components/Progress/Progress.js +1 -1
  52. package/dist/components/ProgressIndicator/ProgressIndicator.js +1 -1
  53. package/dist/components/Radio/Radio.js +1 -1
  54. package/dist/components/Radio/Radio.module.css +1 -1
  55. package/dist/components/Reshaped/Reshaped.js +1 -1
  56. package/dist/components/Resizable/Resizable.js +1 -1
  57. package/dist/components/Scrim/Scrim.js +1 -1
  58. package/dist/components/ScrollArea/ScrollArea.js +8 -11
  59. package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
  60. package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +13 -4
  61. package/dist/components/ScrollArea/tests/ScrollArea.stories.js +129 -30
  62. package/dist/components/Select/Select.js +1 -1
  63. package/dist/components/Skeleton/Skeleton.js +1 -1
  64. package/dist/components/Slider/Slider.types.d.ts +34 -7
  65. package/dist/components/Slider/SliderControlled.js +32 -20
  66. package/dist/components/Slider/SliderThumb.js +4 -4
  67. package/dist/components/Slider/SliderUncontrolled.js +3 -2
  68. package/dist/components/Slider/tests/Slider.stories.d.ts +38 -8
  69. package/dist/components/Slider/tests/Slider.stories.js +268 -54
  70. package/dist/components/Stepper/Stepper.js +1 -1
  71. package/dist/components/Switch/Switch.js +1 -1
  72. package/dist/components/Table/Table.js +6 -3
  73. package/dist/components/Table/Table.module.css +1 -1
  74. package/dist/components/Tabs/TabsItem.js +1 -1
  75. package/dist/components/Tabs/TabsList.js +3 -34
  76. package/dist/components/Tabs/TabsPanel.js +1 -1
  77. package/dist/components/Text/Text.js +1 -1
  78. package/dist/components/TextArea/TextArea.js +1 -1
  79. package/dist/components/TextField/TextField.js +1 -1
  80. package/dist/components/Theme/Theme.js +1 -1
  81. package/dist/components/Timeline/Timeline.js +1 -1
  82. package/dist/components/Toast/ToastContainer.js +1 -1
  83. package/dist/components/Toast/ToastRegion.js +1 -1
  84. package/dist/components/View/View.js +1 -1
  85. package/dist/components/_private/Aligner/Aligner.js +1 -1
  86. package/dist/components/_private/Expandable/Expandable.js +1 -1
  87. package/dist/components/_private/HiddenInput/HiddenInput.js +1 -1
  88. package/dist/hooks/_private/useFadeSide.d.ts +5 -0
  89. package/dist/hooks/_private/useFadeSide.js +47 -0
  90. package/dist/index.d.ts +1 -1
  91. package/dist/index.js +1 -1
  92. package/dist/styles/align/index.js +1 -1
  93. package/dist/styles/aspectRatio/index.js +1 -1
  94. package/dist/styles/bleed/index.js +1 -1
  95. package/dist/styles/border/index.js +1 -1
  96. package/dist/styles/height/index.js +1 -1
  97. package/dist/styles/inset/index.js +1 -1
  98. package/dist/styles/justify/index.js +1 -1
  99. package/dist/styles/maxHeight/index.js +1 -1
  100. package/dist/styles/maxWidth/index.js +1 -1
  101. package/dist/styles/minHeight/index.js +1 -1
  102. package/dist/styles/minWidth/index.js +1 -1
  103. package/dist/styles/padding/index.js +1 -1
  104. package/dist/styles/position/index.js +1 -1
  105. package/dist/styles/radius/index.js +1 -1
  106. package/dist/styles/textAlign/index.js +1 -1
  107. package/dist/styles/width/index.js +1 -1
  108. package/dist/utilities/dom/event.d.ts +7 -0
  109. package/dist/utilities/dom/event.js +11 -0
  110. package/dist/utilities/dom/index.d.ts +1 -0
  111. package/dist/utilities/dom/index.js +1 -0
  112. package/dist/utilities/helpers.d.ts +1 -15
  113. package/dist/utilities/helpers.js +11 -133
  114. package/dist/utilities/props.d.ts +13 -0
  115. package/dist/utilities/props.js +83 -0
  116. package/package.json +25 -26
  117. package/dist/components/Popover/tests/Popover.test.stories.d.ts +0 -39
  118. package/dist/components/Popover/tests/Popover.test.stories.js +0 -167
  119. package/dist/components/ScrollArea/tests/ScrollArea.test.stories.d.ts +0 -23
  120. package/dist/components/ScrollArea/tests/ScrollArea.test.stories.js +0 -66
  121. package/dist/components/Slider/tests/Slider.test.stories.d.ts +0 -38
  122. package/dist/components/Slider/tests/Slider.test.stories.js +0 -150
@@ -1,3 +1,5 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ import { fn } from "@storybook/test";
1
3
  declare const _default: {
2
4
  title: string;
3
5
  component: import("react").FC<import("./..").PopoverProps> & {
@@ -12,10 +14,47 @@ declare const _default: {
12
14
  };
13
15
  };
14
16
  export default _default;
15
- export declare const position: () => import("react").JSX.Element;
16
- export declare const width: () => import("react").JSX.Element;
17
- export declare const variant: () => import("react").JSX.Element;
18
- export declare const padding: () => import("react").JSX.Element;
19
- export declare const triggerType: () => import("react").JSX.Element;
20
- export declare const dismissible: () => import("react").JSX.Element;
21
- export declare const edgeCases: () => import("react").JSX.Element;
17
+ export declare const position: {
18
+ name: string;
19
+ render: () => import("react").JSX.Element;
20
+ };
21
+ export declare const widthNumber: {
22
+ name: string;
23
+ render: () => import("react").JSX.Element;
24
+ };
25
+ export declare const widthFull: {
26
+ name: string;
27
+ render: () => import("react").JSX.Element;
28
+ };
29
+ export declare const padding: {
30
+ name: string;
31
+ render: () => import("react").JSX.Element;
32
+ };
33
+ export declare const elevation: {
34
+ name: string;
35
+ render: () => import("react").JSX.Element;
36
+ };
37
+ export declare const defaultActive: StoryObj<{
38
+ handleOpen: ReturnType<typeof fn>;
39
+ handleClose: ReturnType<typeof fn>;
40
+ }>;
41
+ export declare const active: StoryObj<{
42
+ handleOpen: ReturnType<typeof fn>;
43
+ handleClose: ReturnType<typeof fn>;
44
+ }>;
45
+ export declare const activeFalse: StoryObj<{
46
+ handleOpen: ReturnType<typeof fn>;
47
+ handleClose: ReturnType<typeof fn>;
48
+ }>;
49
+ export declare const dismissible: StoryObj<{
50
+ handleClose: ReturnType<typeof fn>;
51
+ }>;
52
+ export declare const className: StoryObj;
53
+ export declare const testWithTooltip: {
54
+ name: string;
55
+ render: () => import("react").JSX.Element;
56
+ };
57
+ export declare const variant: {
58
+ name: string;
59
+ render: () => import("react").JSX.Element;
60
+ };
@@ -1,4 +1,6 @@
1
+ import { expect, fn, userEvent, within, waitFor } from "@storybook/test";
1
2
  import { Example } from "../../../utilities/storybook/index.js";
3
+ import { sleep } from "../../../utilities/helpers.js";
2
4
  import View from "../../View/index.js";
3
5
  import Popover from "../index.js";
4
6
  import Tooltip from "../../Tooltip/index.js";
@@ -26,99 +28,206 @@ const Demo = (props) => {
26
28
  </Popover.Content>
27
29
  </Popover>);
28
30
  };
29
- export const position = () => (<Example>
30
- <Example.Item title="position: bottom">
31
- <View align="center" justify="center" gap={8} direction="row">
32
- <Demo position="bottom-start"/>
33
- <Demo position="bottom"/>
34
- <Demo position="bottom-end"/>
35
- </View>
36
- </Example.Item>
37
- <Example.Item title="position: top">
38
- <View align="center" justify="center" gap={8} direction="row">
39
- <Demo position="top-start"/>
40
- <Demo position="top"/>
41
- <Demo position="top-end"/>
42
- </View>
43
- </Example.Item>
44
- <Example.Item title="position: start">
45
- <View align="center" justify="center" gap={8} direction="row">
46
- <Demo position="start-top"/>
47
- <Demo position="start"/>
48
- <Demo position="start-bottom"/>
49
- </View>
50
- </Example.Item>
51
- <Example.Item title="position: end">
52
- <View align="center" justify="center" gap={8} direction="row">
53
- <Demo position="end-top"/>
54
- <Demo position="end"/>
55
- <Demo position="end-bottom"/>
56
- </View>
57
- </Example.Item>
58
- <Example.Item title={["position: bottom", "changes to top-start because it doesn't fit"]}>
59
- <View align="center">
60
- <Demo position="bottom"/>
61
- </View>
62
- </Example.Item>
63
- </Example>);
64
- export const width = () => (<Example>
65
- <Example.Item title="width: 400">
66
- <Demo width="400px"/>
67
- </Example.Item>
68
- <Example.Item title="width: 100%">
69
- <Demo width="100%"/>
70
- </Example.Item>
71
- </Example>);
72
- export const variant = () => (<Example>
73
- <Example.Item title="variant: headless">
74
- <Popover variant="headless">
31
+ export const position = {
32
+ name: "position",
33
+ render: () => (<Example>
34
+ <Example.Item title="position: bottom">
35
+ <View align="center" justify="center" gap={8} direction="row">
36
+ <Demo position="bottom-start"/>
37
+ <Demo position="bottom"/>
38
+ <Demo position="bottom-end"/>
39
+ </View>
40
+ </Example.Item>
41
+ <Example.Item title="position: top">
42
+ <View align="center" justify="center" gap={8} direction="row">
43
+ <Demo position="top-start"/>
44
+ <Demo position="top"/>
45
+ <Demo position="top-end"/>
46
+ </View>
47
+ </Example.Item>
48
+ <Example.Item title="position: start">
49
+ <View align="center" justify="center" gap={8} direction="row">
50
+ <Demo position="start-top"/>
51
+ <Demo position="start"/>
52
+ <Demo position="start-bottom"/>
53
+ </View>
54
+ </Example.Item>
55
+ <Example.Item title="position: end">
56
+ <View align="center" justify="center" gap={8} direction="row">
57
+ <Demo position="end-top"/>
58
+ <Demo position="end"/>
59
+ <Demo position="end-bottom" defaultActive/>
60
+ </View>
61
+ </Example.Item>
62
+ </Example>),
63
+ };
64
+ export const widthNumber = {
65
+ name: "width: px",
66
+ render: () => <Demo width="400px" defaultActive/>,
67
+ };
68
+ export const widthFull = {
69
+ name: "width: 100%",
70
+ render: () => <Demo width="100%" defaultActive/>,
71
+ };
72
+ export const padding = {
73
+ name: "padding",
74
+ render: () => (<Example>
75
+ <Example.Item title="padding: 0">
76
+ <Demo padding={0}/>
77
+ </Example.Item>
78
+ <Example.Item title="padding: 6">
79
+ <Demo padding={6} defaultActive/>
80
+ </Example.Item>
81
+ </Example>),
82
+ };
83
+ export const elevation = {
84
+ name: "elevation",
85
+ render: () => (<Example>
86
+ <Example.Item title="elevation: raised">
87
+ <Demo elevation="raised" defaultActive/>
88
+ </Example.Item>
89
+ </Example>),
90
+ };
91
+ export const defaultActive = {
92
+ name: "defaultActive, uncontrolled",
93
+ args: {
94
+ handleOpen: fn(),
95
+ handleClose: fn(),
96
+ },
97
+ render: (args) => (<Popover onOpen={args.handleOpen} onClose={args.handleClose} defaultActive>
98
+ <Popover.Trigger>
99
+ {(attributes) => <Button attributes={attributes}>Open</Button>}
100
+ </Popover.Trigger>
101
+ <Popover.Content>Content</Popover.Content>
102
+ </Popover>),
103
+ play: async ({ canvasElement, args }) => {
104
+ const canvas = within(canvasElement.ownerDocument.body);
105
+ const trigger = canvas.getAllByRole("button")[0];
106
+ let item = canvas.getByText("Content");
107
+ // Wait for the open animation
108
+ await sleep(500);
109
+ await userEvent.click(document.body);
110
+ await waitFor(() => {
111
+ expect(args.handleClose).toHaveBeenCalledTimes(1);
112
+ expect(args.handleClose).toHaveBeenCalledWith({ reason: "outside-click" });
113
+ expect(item).not.toBeInTheDocument();
114
+ });
115
+ await userEvent.click(trigger);
116
+ await waitFor(() => {
117
+ expect(args.handleOpen).toHaveBeenCalledTimes(1);
118
+ expect(args.handleOpen).toHaveBeenCalledWith();
119
+ });
120
+ item = canvas.getByText("Content");
121
+ expect(item).toBeInTheDocument();
122
+ },
123
+ };
124
+ export const active = {
125
+ name: "active, controlled",
126
+ args: {
127
+ handleOpen: fn(),
128
+ handleClose: fn(),
129
+ },
130
+ render: (args) => (<Popover onOpen={args.handleOpen} onClose={args.handleClose} active>
131
+ <Popover.Trigger>
132
+ {(attributes) => <Button attributes={attributes}>Open</Button>}
133
+ </Popover.Trigger>
134
+ <Popover.Content>Content</Popover.Content>
135
+ </Popover>),
136
+ play: async ({ canvasElement, args }) => {
137
+ const canvas = within(canvasElement.ownerDocument.body);
138
+ const item = canvas.getByText("Content");
139
+ await userEvent.click(document.body);
140
+ await waitFor(() => {
141
+ expect(args.handleClose).toHaveBeenCalledTimes(1);
142
+ expect(args.handleClose).toHaveBeenCalledWith({ reason: "outside-click" });
143
+ });
144
+ expect(item).toBeInTheDocument();
145
+ },
146
+ };
147
+ export const activeFalse = {
148
+ name: "active false, controlled",
149
+ args: {
150
+ handleOpen: fn(),
151
+ handleClose: fn(),
152
+ },
153
+ render: (args) => (<Popover onOpen={args.handleOpen} onClose={args.handleClose} active={false}>
154
+ <Popover.Trigger>
155
+ {(attributes) => <Button attributes={attributes}>Open</Button>}
156
+ </Popover.Trigger>
157
+ <Popover.Content>Content</Popover.Content>
158
+ </Popover>),
159
+ play: async ({ canvasElement, args }) => {
160
+ const canvas = within(canvasElement.ownerDocument.body);
161
+ const trigger = canvas.getAllByRole("button")[0];
162
+ await userEvent.click(trigger);
163
+ await waitFor(() => {
164
+ expect(args.handleOpen).toHaveBeenCalledTimes(1);
165
+ expect(args.handleOpen).toHaveBeenCalledWith();
166
+ });
167
+ const item = canvas.queryByText("Content");
168
+ expect(item).not.toBeInTheDocument();
169
+ },
170
+ };
171
+ export const dismissible = {
172
+ name: "dismissible, onClose, className, attributes, closeAriaLabel",
173
+ args: {
174
+ handleClose: fn(),
175
+ },
176
+ render: (args) => (<Popover onClose={args.handleClose} defaultActive>
177
+ <Popover.Trigger>
178
+ {(attributes) => <Button attributes={attributes}>Open</Button>}
179
+ </Popover.Trigger>
180
+ <Popover.Content>
181
+ <Popover.Dismissible closeAriaLabel="Close" attributes={{ "data-testid": "test-id" }} className="test-classname">
182
+ Content
183
+ </Popover.Dismissible>
184
+ </Popover.Content>
185
+ </Popover>),
186
+ play: async ({ canvasElement, args }) => {
187
+ const canvas = within(canvasElement.ownerDocument.body);
188
+ await sleep(300);
189
+ const dismissible = canvas.getByTestId("test-id");
190
+ const closeButton = within(dismissible).getByRole("button");
191
+ expect(dismissible).toHaveClass("test-classname");
192
+ expect(closeButton).toHaveAccessibleName("Close");
193
+ await userEvent.click(closeButton);
194
+ await waitFor(() => {
195
+ expect(args.handleClose).toHaveBeenCalledTimes(1);
196
+ expect(args.handleClose).toHaveBeenCalledWith({});
197
+ });
198
+ await sleep(300);
199
+ const trigger = canvas.getAllByRole("button")[0];
200
+ await userEvent.click(trigger);
201
+ },
202
+ };
203
+ export const className = {
204
+ name: "className, attributes",
205
+ render: () => (<div data-testid="root">
206
+ <Popover active>
75
207
  <Popover.Trigger>
76
208
  {(attributes) => <Button attributes={attributes}>Open</Button>}
77
209
  </Popover.Trigger>
78
- <Popover.Content>
79
- <View height="100px" width="100px" borderColor="primary" borderRadius="medium" backgroundColor="neutral-faded"/>
210
+ <Popover.Content className="test-classname" attributes={{ "data-testid": "test-id" }}>
211
+ Content
80
212
  </Popover.Content>
81
213
  </Popover>
82
- </Example.Item>
83
- </Example>);
84
- export const padding = () => (<Example>
85
- <Example.Item title="padding: 0">
86
- <Demo padding={0}/>
87
- </Example.Item>
88
- <Example.Item title="padding: 6">
89
- <Demo padding={6}/>
90
- </Example.Item>
91
- </Example>);
92
- export const triggerType = () => (<Example>
93
- <Example.Item title="triggerType: hover">
94
- <Demo triggerType="hover"/>
95
- </Example.Item>
96
- </Example>);
97
- export const dismissible = () => {
98
- return (<Example>
99
- <Example.Item title="with dismissible">
100
- <Popover>
101
- <Popover.Trigger>
102
- {(attributes) => <Button attributes={attributes}>Open</Button>}
103
- </Popover.Trigger>
104
- <Popover.Content>
105
- <Popover.Dismissible closeAriaLabel="Close" align="center">
106
- Popover content
107
- </Popover.Dismissible>
108
- </Popover.Content>
109
- </Popover>
110
- </Example.Item>
111
- </Example>);
214
+ </div>),
215
+ play: async ({ canvasElement }) => {
216
+ const canvas = within(canvasElement.ownerDocument.body);
217
+ const menu = await canvas.findByTestId("test-id");
218
+ expect(menu).toHaveClass("test-classname");
219
+ },
112
220
  };
113
- export const edgeCases = () => (<Example>
114
- <Example.Item title="Popover with tooltip">
221
+ export const testWithTooltip = {
222
+ name: "test: with tooltip",
223
+ render: () => (<View paddingTop={10}>
115
224
  <Tooltip position="top" text="Hello">
116
225
  {(tooltipAttributes) => (<Popover position="bottom">
117
226
  <Popover.Trigger>
118
227
  {(attributes) => (<Button attributes={{
119
- ...attributes,
120
- ...tooltipAttributes,
121
- }}>
228
+ ...attributes,
229
+ ...tooltipAttributes,
230
+ }}>
122
231
  Open
123
232
  </Button>)}
124
233
  </Popover.Trigger>
@@ -130,5 +239,20 @@ export const edgeCases = () => (<Example>
130
239
  </Popover.Content>
131
240
  </Popover>)}
132
241
  </Tooltip>
133
- </Example.Item>
134
- </Example>);
242
+ </View>),
243
+ };
244
+ export const variant = {
245
+ name: "variant [deprecated]",
246
+ render: () => (<Example>
247
+ <Example.Item title="variant: headless">
248
+ <Popover variant="headless" defaultActive position="bottom-start">
249
+ <Popover.Trigger>
250
+ {(attributes) => <Button attributes={attributes}>Open</Button>}
251
+ </Popover.Trigger>
252
+ <Popover.Content>
253
+ <View height="100px" width="100px" borderColor="primary" borderRadius="medium" backgroundColor="primary-faded"/>
254
+ </Popover.Content>
255
+ </Popover>
256
+ </Example.Item>
257
+ </Example>),
258
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { classNames } from "../../utilities/helpers.js";
2
+ import { classNames } from "../../utilities/props.js";
3
3
  import s from "./Progress.module.css";
4
4
  const Progress = (props) => {
5
5
  const { value = 0, min = 0, max = 100, color = "primary", size = "medium", duration, ariaLabel, className, attributes, } = props;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React from "react";
4
- import { classNames } from "../../utilities/helpers.js";
4
+ import { classNames } from "../../utilities/props.js";
5
5
  import { onNextFrame } from "../../utilities/animation.js";
6
6
  import usePrevious from "../../hooks/_private/usePrevious.js";
7
7
  import s from "./ProgressIndicator.module.css";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { classNames, responsiveClassNames, responsivePropDependency } from "../../utilities/helpers.js";
3
+ import { classNames, responsiveClassNames, responsivePropDependency } from "../../utilities/props.js";
4
4
  import HiddenInput from "../_private/HiddenInput/index.js";
5
5
  import Text from "../Text/index.js";
6
6
  import { useRadioGroup } from "../RadioGroup/index.js";
@@ -1 +1 @@
1
- @layer rs.radio.base;@layer rs.radio.error;@layer rs.radio.checked;@layer rs.radio.disabled;@layer rs.radio.base{.root{align-items:center;cursor:pointer;display:inline-flex;gap:var(--rs-radio-gap);user-select:none;vertical-align:top;-webkit-tap-highlight-color:transparent}.root:hover .decorator{background:var(--rs-color-background-neutral-faded)}.field{position:relative}.decorator{background:var(--rs-color-background-elevation-base);border:1px solid var(--rs-color-border-neutral);border-radius:50%;height:var(--rs-radio-line-height);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:background-color,border-color;width:var(--rs-radio-line-height)}.decorator:after{background:var(--rs-color-on-background-primary);border-radius:50%;content:"";height:calc(var(--rs-radio-line-height) * .4);left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%) scale(0);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity,transform;width:calc(var(--rs-radio-line-height) * .4)}.--size-small{--rs-radio-line-height:var(--rs-line-height-caption-1);--rs-radio-gap:var(--rs-unit-x1)}.--size-medium{--rs-radio-line-height:var(--rs-line-height-body-3);--rs-radio-gap:var(--rs-unit-x2)}.--size-large{--rs-radio-line-height:var(--rs-line-height-body-2);--rs-radio-gap:var(--rs-unit-x2)}[data-rs-keyboard] .input:focus+.decorator{box-shadow:var(--rs-focus-shadow)}}@layer rs.radio.error{.root.--error .decorator{border-color:var(--rs-color-border-critical)}}@layer rs.radio.checked{.input:checked+.decorator{background:var(--rs-color-background-primary);border-color:var(--rs-color-background-primary)}.input:checked+.decorator:after{opacity:1;transform:translate(-50%,-50%) scale(1)}}@layer rs.radio.disabled{.root.--disabled{color:var(--rs-color-foreground-disabled);cursor:not-allowed}.root.--disabled .decorator{background:var(--rs-color-background-disabled-faded);border-color:var(--rs-color-border-disabled)}.root.--disabled .decorator:after{background-color:var(--rs-color-foreground-disabled)}.root.--disabled .input:checked+.decorator{background:var(--rs-color-background-disabled);border-color:transparent}}@media (--rs-viewport-m ){.--size-small--m{--rs-radio-line-height:var(--rs-line-height-caption-1);--rs-radio-gap:var(--rs-unit-x1)}.--size-medium--m{--rs-radio-line-height:var(--rs-line-height-body-3);--rs-radio-gap:var(--rs-unit-x2)}.--size-large--m{--rs-radio-line-height:var(--rs-line-height-body-2);--rs-radio-gap:var(--rs-unit-x2)}}@media (--rs-viewport-l ){.--size-small--l{--rs-radio-line-height:var(--rs-line-height-caption-1);--rs-radio-gap:var(--rs-unit-x1)}.--size-medium--l{--rs-radio-line-height:var(--rs-line-height-body-3);--rs-radio-gap:var(--rs-unit-x2)}.--size-large--l{--rs-radio-line-height:var(--rs-line-height-body-2);--rs-radio-gap:var(--rs-unit-x2)}}@media (--rs-viewport-xl ){.--size-small--xl{--rs-radio-line-height:var(--rs-line-height-caption-1);--rs-radio-gap:var(--rs-unit-x1)}.--size-medium--xl{--rs-radio-line-height:var(--rs-line-height-body-3);--rs-radio-gap:var(--rs-unit-x2)}.--size-large--xl{--rs-radio-line-height:var(--rs-line-height-body-2);--rs-radio-gap:var(--rs-unit-x2)}}
1
+ .root{align-items:center;cursor:pointer;display:inline-flex;gap:var(--rs-radio-gap);user-select:none;vertical-align:top;-webkit-tap-highlight-color:transparent}.root:hover .decorator{background:var(--rs-color-background-neutral-faded)}.field{position:relative}.decorator{background:var(--rs-color-background-elevation-base);border:1px solid var(--rs-color-border-neutral);border-radius:50%;height:var(--rs-radio-line-height);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:background-color,border-color;width:var(--rs-radio-line-height)}.decorator:after{background:var(--rs-color-on-background-primary);border-radius:50%;content:"";height:calc(var(--rs-radio-line-height) * .4);left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%) scale(0);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity,transform;width:calc(var(--rs-radio-line-height) * .4)}.--size-small{--rs-radio-line-height:var(--rs-line-height-caption-1);--rs-radio-gap:var(--rs-unit-x1)}.--size-medium{--rs-radio-line-height:var(--rs-line-height-body-3);--rs-radio-gap:var(--rs-unit-x2)}.--size-large{--rs-radio-line-height:var(--rs-line-height-body-2);--rs-radio-gap:var(--rs-unit-x2)}[data-rs-keyboard] .input:focus+.decorator{box-shadow:var(--rs-focus-shadow)}.root.--error .decorator{border-color:var(--rs-color-border-critical)}.input:checked+.decorator{background:var(--rs-color-background-primary);border-color:var(--rs-color-background-primary)}.input:checked+.decorator:after{opacity:1;transform:translate(-50%,-50%) scale(1)}.root.--disabled{color:var(--rs-color-foreground-disabled);cursor:not-allowed}.root.--disabled .decorator{background:var(--rs-color-background-disabled-faded);border-color:var(--rs-color-border-disabled)}.root.--disabled .decorator:after{background-color:var(--rs-color-foreground-disabled)}.root.--disabled .input:checked+.decorator{background:var(--rs-color-background-disabled);border-color:transparent}@media (--rs-viewport-m ){.--size-small--m{--rs-radio-line-height:var(--rs-line-height-caption-1);--rs-radio-gap:var(--rs-unit-x1)}.--size-medium--m{--rs-radio-line-height:var(--rs-line-height-body-3);--rs-radio-gap:var(--rs-unit-x2)}.--size-large--m{--rs-radio-line-height:var(--rs-line-height-body-2);--rs-radio-gap:var(--rs-unit-x2)}}@media (--rs-viewport-l ){.--size-small--l{--rs-radio-line-height:var(--rs-line-height-caption-1);--rs-radio-gap:var(--rs-unit-x1)}.--size-medium--l{--rs-radio-line-height:var(--rs-line-height-body-3);--rs-radio-gap:var(--rs-unit-x2)}.--size-large--l{--rs-radio-line-height:var(--rs-line-height-body-2);--rs-radio-gap:var(--rs-unit-x2)}}@media (--rs-viewport-xl ){.--size-small--xl{--rs-radio-line-height:var(--rs-line-height-caption-1);--rs-radio-gap:var(--rs-unit-x1)}.--size-medium--xl{--rs-radio-line-height:var(--rs-line-height-body-3);--rs-radio-gap:var(--rs-unit-x2)}.--size-large--xl{--rs-radio-line-height:var(--rs-line-height-body-2);--rs-radio-gap:var(--rs-unit-x2)}}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React from "react";
4
- import { classNames } from "../../utilities/helpers.js";
4
+ import { classNames } from "../../utilities/props.js";
5
5
  import { GlobalColorMode, PrivateTheme } from "../Theme/index.js";
6
6
  import { ToastProvider } from "../Toast/index.js";
7
7
  import { useGlobalColorMode } from "../Theme/useTheme.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React from "react";
4
- import { classNames } from "../../utilities/helpers.js";
4
+ import { classNames } from "../../utilities/props.js";
5
5
  import useDrag from "../../hooks/_private/useDrag.js";
6
6
  import View from "../View/index.js";
7
7
  import s from "./Resizable.module.css";
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { classNames } from "../../utilities/helpers.js";
2
+ import { classNames } from "../../utilities/props.js";
3
3
  import s from "./Scrim.module.css";
4
4
  const Scrim = (props) => {
5
5
  const { children, backgroundSlot, position = "cover", attributes, className, scrimClassName, } = props;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import React, { forwardRef } from "react";
4
- import { classNames } from "../../utilities/helpers.js";
4
+ import { classNames } from "../../utilities/props.js";
5
5
  import { disableUserSelect, enableUserSelect } from "../../utilities/dom/index.js";
6
6
  import getHeightStyles from "../../styles/height/index.js";
7
7
  import getMaxHeightStyles from "../../styles/maxHeight/index.js";
@@ -70,14 +70,11 @@ const ScrollArea = forwardRef((props, ref) => {
70
70
  const [scrollRatio, setScrollRatio] = React.useState({ x: 1, y: 1 });
71
71
  const [scrollPosition, setScrollPosition] = React.useState({ x: 0, y: 0 });
72
72
  const scrollableRef = React.useRef(null);
73
- const contentRef = React.useRef(null);
73
+ const rootRef = React.useRef(null);
74
74
  const heightStyles = getHeightStyles(height);
75
75
  const maxHeightStyles = getMaxHeightStyles(maxHeight);
76
- const rootClassNames = classNames(s.root, scrollbarDisplay && s[`--display-${scrollbarDisplay}`], heightStyles?.classNames, maxHeightStyles?.classNames, className);
77
- const rootVariables = {
78
- ...heightStyles?.variables,
79
- ...maxHeightStyles?.variables,
80
- };
76
+ const rootClassNames = classNames(s.root, scrollbarDisplay && s[`--display-${scrollbarDisplay}`], heightStyles?.classNames, className);
77
+ const contentClassNames = classNames(s.content, maxHeightStyles?.classNames);
81
78
  const updateScroll = React.useCallback(() => {
82
79
  const scrollableEl = scrollableRef.current;
83
80
  if (!scrollableEl)
@@ -127,14 +124,14 @@ const ScrollArea = forwardRef((props, ref) => {
127
124
  updateScroll();
128
125
  }, [updateScroll]);
129
126
  useIsomorphicLayoutEffect(() => {
130
- const contentEl = contentRef.current;
131
- if (!contentEl)
127
+ const rootEl = rootRef.current;
128
+ if (!rootEl)
132
129
  return;
133
130
  const observer = new ResizeObserver(updateScroll);
134
- observer.observe(contentEl);
131
+ observer.observe(rootEl);
135
132
  return () => observer.disconnect();
136
133
  }, [updateScroll]);
137
- return (_jsxs("div", { ...attributes, className: rootClassNames, style: rootVariables, children: [_jsx("div", { className: s.scrollable, ref: scrollableRef, onScroll: handleScroll, tabIndex: 0, children: _jsx("div", { className: s.content, ref: contentRef, children: children }) }), scrollRatio.y < 1 && scrollbarDisplay !== "hidden" && (_jsx(ScrollAreaBar, { vertical: true, onThumbMove: handleThumbYMove, ratio: scrollRatio.y, position: scrollPosition.y })), scrollRatio.x < 1 && scrollbarDisplay !== "hidden" && (_jsx(ScrollAreaBar, { onThumbMove: handleThumbXMove, ratio: scrollRatio.x, position: scrollPosition.x }))] }));
134
+ return (_jsxs("div", { ...attributes, ref: rootRef, className: rootClassNames, style: { ...heightStyles?.variables }, children: [_jsx("div", { className: s.scrollable, ref: scrollableRef, onScroll: handleScroll, tabIndex: 0, children: _jsx("div", { className: contentClassNames, style: { ...maxHeightStyles?.variables }, children: children }) }), scrollRatio.y < 1 && scrollbarDisplay !== "hidden" && (_jsx(ScrollAreaBar, { vertical: true, onThumbMove: handleThumbYMove, ratio: scrollRatio.y, position: scrollPosition.y })), scrollRatio.x < 1 && scrollbarDisplay !== "hidden" && (_jsx(ScrollAreaBar, { onThumbMove: handleThumbXMove, ratio: scrollRatio.x, position: scrollPosition.x }))] }));
138
135
  });
139
136
  ScrollArea.displayName = "ScrollArea";
140
137
  export default ScrollArea;
@@ -1 +1 @@
1
- .root{--rs-scroll-area-thumb-size:calc(var(--rs-unit-x1) * 1.5);--rs-scroll-area-thumb-offset:calc(var(--rs-unit-x1) / 2);height:100%;overflow:hidden;position:relative}[data-rs-keyboard] .root:has(.scrollable:focus){box-shadow:var(--rs-focus-shadow)}.scrollable{height:100%;overflow:auto;position:relative;scrollbar-width:none;-webkit-overflow-scrolling:touch}.scrollable::-webkit-scrollbar{display:none;height:0;width:0}.content{display:inline-block;min-height:100%;min-width:100%;vertical-align:top}.scrollbar{box-sizing:initial;padding:var(--rs-scroll-area-thumb-offset);position:absolute}.thumb{height:100%;position:relative;width:100%}.thumb:before{background:var(--rs-color-foreground-neutral);border-radius:999px;content:"";display:block;opacity:0;position:absolute;transition:opacity var(--rs-duration-fast) var(--rs-easing-standard)}.--scrollbar-y{inset-block:0;inset-inline-end:0;width:var(--rs-scroll-area-thumb-size)}.--scrollbar-y .thumb:before{height:calc(var(--rs-scroll-area-ratio) * 100%);inset-block-start:calc(var(--rs-scroll-area-position) * 100%);width:100%}.--scrollbar-x{height:var(--rs-scroll-area-thumb-size);inset-block-end:0;inset-inline:0}.--scrollbar-x .thumb:before{height:100%;inset-inline-start:calc(var(--rs-scroll-area-position) * 100%);width:calc(var(--rs-scroll-area-ratio) * 100%)}.--scrollbar-y:not(:last-child){inset-block-end:calc(var(--rs-scroll-area-thumb-size) + var(--rs-scroll-area-thumb-offset) * 2)}.--scrollbar-y~.--scrollbar-x{inset-inline-end:calc(var(--rs-scroll-area-thumb-size) + var(--rs-scroll-area-thumb-offset) * 2)}.--display-hover:hover>.scrollbar .thumb:before,.--display-visible .thumb:before{opacity:.2}.--display-hover:hover .--scrollbar-dragging .thumb:before,.--scrollbar-dragging .thumb:before,.scrollbar:hover .thumb:before{opacity:.32}
1
+ .root{--rs-scroll-area-thumb-size:calc(var(--rs-unit-x1) * 1.5);--rs-scroll-area-thumb-offset:calc(var(--rs-unit-x1) / 2);height:100%;overflow:hidden;position:relative}[data-rs-keyboard] .root:has(.scrollable:focus){box-shadow:var(--rs-focus-shadow)}.scrollable{height:100%;outline:none;overflow:auto;position:relative;scrollbar-width:none;-webkit-overflow-scrolling:touch}.scrollable::-webkit-scrollbar{display:none;height:0;width:0}.content{display:inline-block;min-height:100%;min-width:100%;vertical-align:top}.scrollbar{box-sizing:initial;padding:var(--rs-scroll-area-thumb-offset);position:absolute}.thumb{height:100%;position:relative;width:100%}.thumb:before{background:var(--rs-color-foreground-neutral);border-radius:999px;content:"";display:block;opacity:0;position:absolute;transition:opacity var(--rs-duration-fast) var(--rs-easing-standard)}.--scrollbar-y{inset-block:0;inset-inline-end:0;width:var(--rs-scroll-area-thumb-size)}.--scrollbar-y .thumb:before{height:calc(var(--rs-scroll-area-ratio) * 100%);inset-block-start:calc(var(--rs-scroll-area-position) * 100%);width:100%}.--scrollbar-x{height:var(--rs-scroll-area-thumb-size);inset-block-end:0;inset-inline:0}.--scrollbar-x .thumb:before{height:100%;inset-inline-start:calc(var(--rs-scroll-area-position) * 100%);width:calc(var(--rs-scroll-area-ratio) * 100%)}.--scrollbar-y:not(:last-child){inset-block-end:calc(var(--rs-scroll-area-thumb-size) + var(--rs-scroll-area-thumb-offset) * 2)}.--scrollbar-y~.--scrollbar-x{inset-inline-end:calc(var(--rs-scroll-area-thumb-size) + var(--rs-scroll-area-thumb-offset) * 2)}.--display-hover:hover>.scrollbar .thumb:before,.--display-visible .thumb:before{opacity:.2}.--display-hover:hover .--scrollbar-dragging .thumb:before,.--scrollbar-dragging .thumb:before,.scrollbar:hover .thumb:before{opacity:.32}
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { StoryObj } from "@storybook/react";
3
+ import { Mock } from "@storybook/test";
3
4
  declare const _default: {
4
5
  title: string;
5
6
  component: React.ForwardRefExoticComponent<import("./..").ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
@@ -13,16 +14,24 @@ declare const _default: {
13
14
  };
14
15
  };
15
16
  export default _default;
16
- export declare const direction: {
17
+ export declare const base: {
17
18
  name: string;
18
19
  render: () => React.JSX.Element;
19
20
  };
20
- export declare const visibility: {
21
+ export declare const scrollbarDisplay: {
21
22
  name: string;
22
23
  render: () => React.JSX.Element;
23
24
  };
24
- export declare const composition: {
25
+ export declare const height: {
25
26
  name: string;
26
27
  render: () => React.JSX.Element;
27
28
  };
28
- export declare const dynamicHeight: StoryObj;
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;