reshaped 3.6.0-canary.0 → 3.6.0-canary.2
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.
- package/CHANGELOG.md +21 -2
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +1 -1
- package/dist/bundle.js +11 -11
- package/dist/components/Accordion/AccordionControlled.js +1 -1
- package/dist/components/Accordion/AccordionTrigger.js +1 -1
- package/dist/components/ActionBar/ActionBar.js +1 -1
- package/dist/components/Actionable/Actionable.js +1 -1
- package/dist/components/Autocomplete/tests/Autocomplete.stories.js +1 -0
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Badge/Badge.js +1 -1
- package/dist/components/Badge/BadgeContainer.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/ButtonGroup.js +1 -1
- package/dist/components/Calendar/CalendarDate.js +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Card/tests/Card.stories.d.ts +1 -1
- package/dist/components/Card/tests/Card.test.stories.d.ts +1 -1
- package/dist/components/Carousel/Carousel.js +4 -3
- package/dist/components/Carousel/CarouselControl.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Checkbox/Checkbox.module.css +1 -1
- package/dist/components/Container/Container.js +1 -1
- package/dist/components/Dismissible/Dismissible.js +1 -1
- package/dist/components/Divider/Divider.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/components/FileUpload/FileUpload.js +1 -1
- package/dist/components/Flyout/Flyout.types.d.ts +3 -2
- package/dist/components/Flyout/FlyoutContent.js +14 -11
- package/dist/components/Flyout/tests/Flyout.stories.d.ts +4 -0
- package/dist/components/Flyout/tests/Flyout.stories.js +20 -4
- package/dist/components/Flyout/useFlyout.js +13 -9
- package/dist/components/Flyout/utilities/calculatePosition.d.ts +1 -1
- package/dist/components/Flyout/utilities/calculatePosition.js +1 -1
- package/dist/components/Flyout/utilities/flyout.js +4 -4
- package/dist/components/FormControl/FormControl.context.d.ts +0 -2
- package/dist/components/Grid/Grid.js +1 -1
- package/dist/components/Hidden/Hidden.js +1 -1
- package/dist/components/Hotkey/Hotkey.js +1 -1
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Image/Image.js +1 -1
- package/dist/components/Link/Link.js +1 -1
- package/dist/components/Loader/Loader.js +1 -1
- package/dist/components/MenuItem/MenuItem.js +1 -1
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/Modal.module.css +1 -1
- package/dist/components/NumberField/NumberFieldControlled.js +1 -1
- package/dist/components/Overlay/Overlay.js +3 -3
- package/dist/components/Overlay/Overlay.module.css +1 -1
- package/dist/components/Overlay/Overlay.types.d.ts +1 -0
- package/dist/components/PinField/PinFieldControlled.js +1 -1
- package/dist/components/Popover/Popover.js +3 -3
- package/dist/components/Popover/Popover.module.css +1 -1
- package/dist/components/Popover/Popover.types.d.ts +1 -0
- package/dist/components/Popover/tests/Popover.stories.d.ts +46 -7
- package/dist/components/Popover/tests/Popover.stories.js +209 -85
- package/dist/components/Progress/Progress.js +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/dist/components/Radio/Radio.js +1 -1
- package/dist/components/Radio/Radio.module.css +1 -1
- package/dist/components/Reshaped/Reshaped.js +1 -1
- package/dist/components/Resizable/Resizable.js +1 -1
- package/dist/components/Scrim/Scrim.js +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +8 -11
- package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
- package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +13 -4
- package/dist/components/ScrollArea/tests/ScrollArea.stories.js +129 -30
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Slider/Slider.types.d.ts +34 -7
- package/dist/components/Slider/SliderControlled.js +32 -20
- package/dist/components/Slider/SliderThumb.js +4 -4
- package/dist/components/Slider/SliderUncontrolled.js +3 -2
- package/dist/components/Slider/tests/Slider.stories.d.ts +38 -8
- package/dist/components/Slider/tests/Slider.stories.js +268 -54
- package/dist/components/Stepper/Stepper.js +1 -1
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Table/Table.js +6 -3
- package/dist/components/Table/Table.module.css +1 -1
- package/dist/components/Tabs/TabsItem.js +1 -1
- package/dist/components/Tabs/TabsList.js +3 -34
- package/dist/components/Tabs/TabsPanel.js +1 -1
- package/dist/components/Text/Text.js +1 -1
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/Theme/Theme.js +1 -1
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Toast/ToastContainer.js +1 -1
- package/dist/components/Toast/ToastRegion.js +1 -1
- package/dist/components/View/View.js +1 -1
- package/dist/components/_private/Aligner/Aligner.js +1 -1
- package/dist/components/_private/Expandable/Expandable.js +1 -1
- package/dist/components/_private/HiddenInput/HiddenInput.js +1 -1
- package/dist/hooks/_private/useFadeSide.d.ts +5 -0
- package/dist/hooks/_private/useFadeSide.js +47 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/align/index.js +1 -1
- package/dist/styles/aspectRatio/index.js +1 -1
- package/dist/styles/bleed/index.js +1 -1
- package/dist/styles/border/index.js +1 -1
- package/dist/styles/height/index.js +1 -1
- package/dist/styles/inset/index.js +1 -1
- package/dist/styles/justify/index.js +1 -1
- package/dist/styles/maxHeight/index.js +1 -1
- package/dist/styles/maxWidth/index.js +1 -1
- package/dist/styles/minHeight/index.js +1 -1
- package/dist/styles/minWidth/index.js +1 -1
- package/dist/styles/padding/index.js +1 -1
- package/dist/styles/position/index.js +1 -1
- package/dist/styles/radius/index.js +1 -1
- package/dist/styles/textAlign/index.js +1 -1
- package/dist/styles/width/index.js +1 -1
- package/dist/utilities/dom/event.d.ts +7 -0
- package/dist/utilities/dom/event.js +11 -0
- package/dist/utilities/dom/find.d.ts +1 -1
- package/dist/utilities/dom/find.js +2 -2
- package/dist/utilities/dom/index.d.ts +1 -0
- package/dist/utilities/dom/index.js +1 -0
- package/dist/utilities/helpers.d.ts +1 -15
- package/dist/utilities/helpers.js +11 -133
- package/dist/utilities/props.d.ts +13 -0
- package/dist/utilities/props.js +83 -0
- package/package.json +25 -26
- package/dist/components/Popover/tests/Popover.test.stories.d.ts +0 -39
- package/dist/components/Popover/tests/Popover.test.stories.js +0 -167
- package/dist/components/ScrollArea/tests/ScrollArea.test.stories.d.ts +0 -23
- package/dist/components/ScrollArea/tests/ScrollArea.test.stories.js +0 -66
- package/dist/components/Slider/tests/Slider.test.stories.d.ts +0 -38
- package/dist/components/Slider/tests/Slider.test.stories.js +0 -150
@@ -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 =
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
<
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
<
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
<
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
<
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
-
|
210
|
+
<Popover.Content className="test-classname" attributes={{ "data-testid": "test-id" }}>
|
211
|
+
Content
|
80
212
|
</Popover.Content>
|
81
213
|
</Popover>
|
82
|
-
</
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
|
114
|
-
|
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
|
-
|
120
|
-
|
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
|
-
</
|
134
|
-
|
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/
|
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/
|
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/
|
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
|
-
|
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/
|
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/
|
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/
|
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/
|
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
|
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,
|
77
|
-
const
|
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
|
131
|
-
if (!
|
127
|
+
const rootEl = rootRef.current;
|
128
|
+
if (!rootEl)
|
132
129
|
return;
|
133
130
|
const observer = new ResizeObserver(updateScroll);
|
134
|
-
observer.observe(
|
131
|
+
observer.observe(rootEl);
|
135
132
|
return () => observer.disconnect();
|
136
133
|
}, [updateScroll]);
|
137
|
-
return (_jsxs("div", { ...attributes, className: rootClassNames, style:
|
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
|
17
|
+
export declare const base: {
|
17
18
|
name: string;
|
18
19
|
render: () => React.JSX.Element;
|
19
20
|
};
|
20
|
-
export declare const
|
21
|
+
export declare const scrollbarDisplay: {
|
21
22
|
name: string;
|
22
23
|
render: () => React.JSX.Element;
|
23
24
|
};
|
24
|
-
export declare const
|
25
|
+
export declare const height: {
|
25
26
|
name: string;
|
26
27
|
render: () => React.JSX.Element;
|
27
28
|
};
|
28
|
-
export declare const
|
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;
|