reshaped 3.8.0-canary.7 → 3.8.0-canary.8
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 +12 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +9 -9
- package/dist/components/Actionable/Actionable.module.css +1 -1
- package/dist/components/Alert/tests/Alert.stories.d.ts +6 -5
- package/dist/components/Alert/tests/Alert.stories.js +15 -2
- package/dist/components/Badge/Badge.module.css +1 -1
- package/dist/components/Badge/tests/Badge.stories.d.ts +5 -0
- package/dist/components/Badge/tests/Badge.stories.js +34 -0
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +8 -4
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +57 -1
- package/dist/components/Button/tests/Button.stories.d.ts +54 -12
- package/dist/components/Button/tests/Button.stories.js +725 -588
- package/dist/components/Card/Card.module.css +1 -1
- package/dist/components/Card/tests/Card.stories.d.ts +28 -6
- package/dist/components/Card/tests/Card.stories.js +110 -65
- package/dist/components/Carousel/Carousel.module.css +1 -1
- package/dist/components/Checkbox/Checkbox.module.css +1 -1
- package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +20 -4
- package/dist/components/Checkbox/tests/Checkbox.stories.js +150 -79
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +9 -2
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +67 -35
- package/dist/components/Container/tests/Container.stories.d.ts +2 -0
- package/dist/components/Container/tests/Container.stories.js +14 -0
- package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +10 -1
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +57 -13
- package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +5 -0
- package/dist/components/Dismissible/tests/Dismissible.stories.js +30 -1
- package/dist/components/Divider/tests/Divider.stories.d.ts +8 -3
- package/dist/components/Divider/tests/Divider.stories.js +71 -41
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +35 -6
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +222 -115
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +0 -15
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +0 -106
- package/dist/components/FileUpload/FileUpload.module.css +1 -1
- package/dist/components/Flyout/Flyout.module.css +1 -1
- package/dist/components/Flyout/utilities/flyout.js +0 -1
- package/dist/components/FormControl/tests/FormControl.stories.d.ts +2 -0
- package/dist/components/FormControl/tests/FormControl.stories.js +35 -0
- package/dist/components/Hidden/tests/Hidden.stories.d.ts +2 -0
- package/dist/components/Hidden/tests/Hidden.stories.js +9 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +2 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +9 -0
- package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +2 -0
- package/dist/components/Hotkey/tests/Hotkey.stories.js +15 -0
- package/dist/components/Icon/tests/Icon.stories.d.ts +3 -0
- package/dist/components/Icon/tests/Icon.stories.js +23 -0
- package/dist/components/Link/tests/Link.stories.d.ts +28 -5
- package/dist/components/Link/tests/Link.stories.js +141 -58
- package/dist/components/Link/tests/Link.test.stories.d.ts +0 -13
- package/dist/components/Link/tests/Link.test.stories.js +0 -85
- package/dist/components/Loader/tests/Loader.stories.d.ts +11 -2
- package/dist/components/Loader/tests/Loader.stories.js +52 -25
- package/dist/components/Loader/tests/Loader.test.stories.d.ts +0 -3
- package/dist/components/Loader/tests/Loader.test.stories.js +0 -21
- package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +37 -7
- package/dist/components/MenuItem/tests/MenuItem.stories.js +218 -112
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/Modal.module.css +1 -1
- package/dist/components/Modal/tests/Modal.stories.d.ts +53 -10
- package/dist/components/Modal/tests/Modal.stories.js +366 -214
- package/dist/components/Overlay/tests/Overlay.stories.d.ts +15 -1
- package/dist/components/Overlay/tests/Overlay.stories.js +135 -1
- package/dist/components/Pagination/tests/Pagination.stories.d.ts +14 -1
- package/dist/components/Pagination/tests/Pagination.stories.js +93 -15
- package/dist/components/PinField/tests/PinField.stories.d.ts +1 -1
- package/dist/components/PinField/tests/PinField.stories.js +1 -1
- package/dist/components/Popover/Popover.module.css +1 -1
- package/dist/components/Progress/tests/Progress.stories.d.ts +19 -4
- package/dist/components/Progress/tests/Progress.stories.js +85 -49
- package/dist/components/Radio/Radio.module.css +1 -1
- package/dist/components/Radio/tests/Radio.stories.d.ts +25 -4
- package/dist/components/Radio/tests/Radio.stories.js +147 -65
- package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +9 -2
- package/dist/components/RadioGroup/tests/RadioGroup.stories.js +64 -38
- package/dist/components/Reshaped/Reshaped.css +1 -1
- package/dist/components/Scrim/tests/Scrim.stories.d.ts +10 -2
- package/dist/components/Scrim/tests/Scrim.stories.js +51 -31
- package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
- package/dist/components/Select/Select.module.css +1 -1
- package/dist/components/Select/Select.types.d.ts +38 -11
- package/dist/components/Select/SelectCustom.js +2 -1
- package/dist/components/Select/SelectCustomControlled.js +23 -9
- package/dist/components/Select/SelectCustomUncontrolled.js +10 -7
- package/dist/components/Select/SelectTrigger.js +1 -1
- package/dist/components/Select/tests/Select.stories.d.ts +3 -0
- package/dist/components/Select/tests/Select.stories.js +91 -34
- package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +10 -2
- package/dist/components/Skeleton/tests/Skeleton.stories.js +46 -28
- package/dist/components/Slider/Slider.module.css +1 -1
- package/dist/components/Stepper/tests/Stepper.stories.d.ts +18 -4
- package/dist/components/Stepper/tests/Stepper.stories.js +99 -70
- package/dist/components/Switch/Switch.module.css +1 -1
- package/dist/components/Switch/tests/Switch.stories.d.ts +10 -2
- package/dist/components/Switch/tests/Switch.stories.js +77 -23
- package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -10
- package/dist/components/Switch/tests/Switch.test.stories.js +0 -68
- package/dist/components/Table/Table.module.css +1 -1
- package/dist/components/Table/tests/Table.stories.d.ts +25 -5
- package/dist/components/Table/tests/Table.stories.js +274 -177
- package/dist/components/Table/tests/Table.test.stories.d.ts +0 -5
- package/dist/components/Table/tests/Table.test.stories.js +0 -82
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/TextArea/TextArea.module.css +1 -1
- package/dist/components/TextArea/tests/TextArea.stories.d.ts +41 -9
- package/dist/components/TextArea/tests/TextArea.stories.js +179 -93
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/TextField/TextField.module.css +1 -1
- package/dist/components/TextField/tests/TextField.stories.d.ts +41 -11
- package/dist/components/TextField/tests/TextField.stories.js +206 -132
- package/dist/components/TextField/tests/TextField.test.stories.d.ts +0 -13
- package/dist/components/TextField/tests/TextField.test.stories.js +0 -88
- package/dist/components/Theme/Theme.module.css +1 -1
- package/dist/components/Timeline/tests/Timeline.stories.d.ts +10 -2
- package/dist/components/Timeline/tests/Timeline.stories.js +69 -42
- package/dist/components/Timeline/tests/Timeline.test.stories.d.ts +0 -2
- package/dist/components/Timeline/tests/Timeline.test.stories.js +0 -21
- package/dist/components/Toast/tests/Toast.stories.d.ts +32 -8
- package/dist/components/Toast/tests/Toast.stories.js +109 -37
- package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +18 -4
- package/dist/components/Tooltip/tests/Tooltip.stories.js +139 -107
- package/dist/components/Tooltip/tests/Tooltip.test.stories.d.ts +0 -6
- package/dist/components/Tooltip/tests/Tooltip.test.stories.js +0 -29
- package/dist/components/View/tests/View.stories.d.ts +4 -0
- package/dist/components/View/tests/View.stories.js +39 -0
- package/dist/hooks/tests/useDrag.stories.js +1 -1
- package/dist/utilities/scroll/disable.js +2 -2
- package/package.json +1 -1
- package/dist/components/Alert/tests/Alert.test.stories.d.ts +0 -15
- package/dist/components/Alert/tests/Alert.test.stories.js +0 -26
- package/dist/components/Badge/tests/Badge.test.stories.d.ts +0 -20
- package/dist/components/Badge/tests/Badge.test.stories.js +0 -46
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.d.ts +0 -23
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.js +0 -76
- package/dist/components/Button/tests/Button.test.stories.d.ts +0 -28
- package/dist/components/Button/tests/Button.test.stories.js +0 -135
- package/dist/components/Card/tests/Card.test.stories.d.ts +0 -35
- package/dist/components/Card/tests/Card.test.stories.js +0 -54
- package/dist/components/Checkbox/tests/Checkbox.test.stories.d.ts +0 -25
- package/dist/components/Checkbox/tests/Checkbox.test.stories.js +0 -104
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.d.ts +0 -22
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.js +0 -78
- package/dist/components/Container/tests/Container.test.stories.d.ts +0 -15
- package/dist/components/Container/tests/Container.test.stories.js +0 -26
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.d.ts +0 -25
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +0 -53
- package/dist/components/Dismissible/tests/Dismissible.test.stories.d.ts +0 -19
- package/dist/components/Dismissible/tests/Dismissible.test.stories.js +0 -42
- package/dist/components/Divider/tests/Divider.test.stories.d.ts +0 -18
- package/dist/components/Divider/tests/Divider.test.stories.js +0 -47
- package/dist/components/FormControl/tests/FormControl.test.stories.d.ts +0 -20
- package/dist/components/FormControl/tests/FormControl.test.stories.js +0 -49
- package/dist/components/Hidden/tests/Hidden.test.stories.d.ts +0 -15
- package/dist/components/Hidden/tests/Hidden.test.stories.js +0 -20
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.d.ts +0 -15
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.js +0 -20
- package/dist/components/Hotkey/tests/Hotkey.test.stories.d.ts +0 -15
- package/dist/components/Hotkey/tests/Hotkey.test.stories.js +0 -26
- package/dist/components/Icon/tests/Icon.test.stories.d.ts +0 -16
- package/dist/components/Icon/tests/Icon.test.stories.js +0 -35
- package/dist/components/MenuItem/tests/MenuItem.test.stories.d.ts +0 -27
- package/dist/components/MenuItem/tests/MenuItem.test.stories.js +0 -116
- package/dist/components/Modal/tests/Modal.test.stories.d.ts +0 -31
- package/dist/components/Modal/tests/Modal.test.stories.js +0 -149
- package/dist/components/Overlay/tests/Overlay.test.stories.d.ts +0 -28
- package/dist/components/Overlay/tests/Overlay.test.stories.js +0 -148
- package/dist/components/Pagination/tests/Pagination.test.stories.d.ts +0 -23
- package/dist/components/Pagination/tests/Pagination.test.stories.js +0 -86
- package/dist/components/Progress/tests/Progress.test.stories.d.ts +0 -16
- package/dist/components/Progress/tests/Progress.test.stories.js +0 -35
- package/dist/components/Radio/tests/Radio.test.stories.d.ts +0 -30
- package/dist/components/Radio/tests/Radio.test.stories.js +0 -118
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.d.ts +0 -22
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.js +0 -78
- package/dist/components/Scrim/tests/Scrim.test.stories.d.ts +0 -15
- package/dist/components/Scrim/tests/Scrim.test.stories.js +0 -25
- package/dist/components/Skeleton/tests/Skeleton.test.stories.d.ts +0 -15
- package/dist/components/Skeleton/tests/Skeleton.test.stories.js +0 -23
- package/dist/components/Stepper/tests/Stepper.test.stories.d.ts +0 -20
- package/dist/components/Stepper/tests/Stepper.test.stories.js +0 -28
- package/dist/components/TextArea/tests/TextArea.test.stories.d.ts +0 -28
- package/dist/components/TextArea/tests/TextArea.test.stories.js +0 -99
- package/dist/components/Toast/tests/Toast.test.stories.d.ts +0 -16
- package/dist/components/Toast/tests/Toast.test.stories.js +0 -101
- package/dist/components/View/tests/View.test.stories.d.ts +0 -24
- package/dist/components/View/tests/View.test.stories.js +0 -50
@@ -1,104 +0,0 @@
|
|
1
|
-
import { expect, userEvent, fn } from "storybook/test";
|
2
|
-
import Checkbox from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/Checkbox/tests",
|
5
|
-
component: Checkbox,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/checkbox",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const render = {
|
14
|
-
name: "name, value",
|
15
|
-
render: () => (<Checkbox name="test-name" value="test-value">
|
16
|
-
Content
|
17
|
-
</Checkbox>),
|
18
|
-
play: async ({ canvas }) => {
|
19
|
-
const input = canvas.getByRole("checkbox");
|
20
|
-
expect(input).toHaveAttribute("value", "test-value");
|
21
|
-
expect(input).toHaveAttribute("name", "test-name");
|
22
|
-
expect(input).not.toBeChecked();
|
23
|
-
},
|
24
|
-
};
|
25
|
-
export const checked = {
|
26
|
-
name: "checked, controlled",
|
27
|
-
args: {
|
28
|
-
handleChange: fn(),
|
29
|
-
},
|
30
|
-
render: (args) => (<Checkbox name="test-name" value="test-value" checked onChange={args.handleChange}>
|
31
|
-
Content
|
32
|
-
</Checkbox>),
|
33
|
-
play: async ({ canvas, args }) => {
|
34
|
-
const input = canvas.getByRole("checkbox");
|
35
|
-
expect(input).toBeChecked();
|
36
|
-
await userEvent.click(input);
|
37
|
-
expect(args.handleChange).toHaveBeenCalledTimes(1);
|
38
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
39
|
-
name: "test-name",
|
40
|
-
value: "test-value",
|
41
|
-
checked: false,
|
42
|
-
event: expect.objectContaining({ target: input }),
|
43
|
-
});
|
44
|
-
// Still checked because it's controlled
|
45
|
-
expect(input).toBeChecked();
|
46
|
-
},
|
47
|
-
};
|
48
|
-
export const defaultChecked = {
|
49
|
-
name: "defaultChecked, uncontrolled",
|
50
|
-
args: {
|
51
|
-
handleChange: fn(),
|
52
|
-
},
|
53
|
-
render: (args) => (<Checkbox name="test-name" value="test-value" defaultChecked onChange={args.handleChange}>
|
54
|
-
Content
|
55
|
-
</Checkbox>),
|
56
|
-
play: async ({ canvas, args }) => {
|
57
|
-
const input = canvas.getByRole("checkbox");
|
58
|
-
expect(input).toBeChecked();
|
59
|
-
await userEvent.click(input);
|
60
|
-
expect(args.handleChange).toHaveBeenCalledTimes(1);
|
61
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
62
|
-
name: "test-name",
|
63
|
-
value: "test-value",
|
64
|
-
checked: false,
|
65
|
-
event: expect.objectContaining({ target: input }),
|
66
|
-
});
|
67
|
-
expect(input).not.toBeChecked();
|
68
|
-
},
|
69
|
-
};
|
70
|
-
export const disabled = {
|
71
|
-
name: "disabled",
|
72
|
-
render: () => (<Checkbox name="test-name" value="test-value" disabled>
|
73
|
-
Content
|
74
|
-
</Checkbox>),
|
75
|
-
play: async ({ canvas }) => {
|
76
|
-
const input = canvas.getByRole("checkbox");
|
77
|
-
expect(input).toBeDisabled();
|
78
|
-
},
|
79
|
-
};
|
80
|
-
export const indeterminate = {
|
81
|
-
name: "indeterminate",
|
82
|
-
render: () => (<Checkbox name="test-name" value="test-value" indeterminate>
|
83
|
-
Content
|
84
|
-
</Checkbox>),
|
85
|
-
play: async ({ canvas }) => {
|
86
|
-
const input = canvas.getByRole("checkbox");
|
87
|
-
expect(input.indeterminate).toBeTruthy();
|
88
|
-
await userEvent.click(input);
|
89
|
-
expect(input.indeterminate).toBeFalsy();
|
90
|
-
},
|
91
|
-
};
|
92
|
-
export const className = {
|
93
|
-
name: "className, attributes",
|
94
|
-
render: () => (<div data-testid="root">
|
95
|
-
<Checkbox className="test-classname" attributes={{ id: "test-id" }}>
|
96
|
-
Content
|
97
|
-
</Checkbox>
|
98
|
-
</div>),
|
99
|
-
play: async ({ canvas }) => {
|
100
|
-
const root = canvas.getByTestId("root").firstChild;
|
101
|
-
expect(root).toHaveClass("test-classname");
|
102
|
-
expect(root).toHaveAttribute("id", "test-id");
|
103
|
-
},
|
104
|
-
};
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
import { fn } from "storybook/test";
|
3
|
-
declare const _default: {
|
4
|
-
title: string;
|
5
|
-
component: import("react").FC<import("./..").CheckboxGroupProps>;
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: string;
|
9
|
-
};
|
10
|
-
chromatic: {
|
11
|
-
disableSnapshot: boolean;
|
12
|
-
};
|
13
|
-
};
|
14
|
-
};
|
15
|
-
export default _default;
|
16
|
-
export declare const value: StoryObj<{
|
17
|
-
handleChange: ReturnType<typeof fn>;
|
18
|
-
}>;
|
19
|
-
export declare const defaultValue: StoryObj<{
|
20
|
-
handleChange: ReturnType<typeof fn>;
|
21
|
-
}>;
|
22
|
-
export declare const disabled: StoryObj;
|
@@ -1,78 +0,0 @@
|
|
1
|
-
import { fn, userEvent, expect } from "storybook/test";
|
2
|
-
import CheckboxGroup from "../index.js";
|
3
|
-
import Checkbox from "../../Checkbox/index.js";
|
4
|
-
export default {
|
5
|
-
title: "Components/CheckboxGroup/tests",
|
6
|
-
component: CheckboxGroup,
|
7
|
-
parameters: {
|
8
|
-
iframe: {
|
9
|
-
url: "https://reshaped.so/docs/components/checkbox",
|
10
|
-
},
|
11
|
-
chromatic: { disableSnapshot: true },
|
12
|
-
},
|
13
|
-
};
|
14
|
-
export const value = {
|
15
|
-
name: "value, controlled",
|
16
|
-
args: {
|
17
|
-
handleChange: fn(),
|
18
|
-
},
|
19
|
-
render: (args) => (<CheckboxGroup name="test-name" value={["1"]} onChange={args.handleChange}>
|
20
|
-
{/* checked should be ignored */}
|
21
|
-
<Checkbox value="1" checked={false}>
|
22
|
-
Content
|
23
|
-
</Checkbox>
|
24
|
-
|
25
|
-
<Checkbox value="2">Content 2</Checkbox>
|
26
|
-
</CheckboxGroup>),
|
27
|
-
play: async ({ canvas, args }) => {
|
28
|
-
const inputs = canvas.getAllByRole("checkbox");
|
29
|
-
expect(inputs[0]).toBeChecked();
|
30
|
-
await userEvent.click(inputs[1]);
|
31
|
-
expect(args.handleChange).toHaveBeenCalledTimes(1);
|
32
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
33
|
-
name: "test-name",
|
34
|
-
value: ["1", "2"],
|
35
|
-
event: expect.objectContaining({ target: inputs[1] }),
|
36
|
-
});
|
37
|
-
// Still checked because it's controlled
|
38
|
-
expect(inputs[0]).toBeChecked();
|
39
|
-
expect(inputs[1]).not.toBeChecked();
|
40
|
-
},
|
41
|
-
};
|
42
|
-
export const defaultValue = {
|
43
|
-
name: "defaultValue, uncontrolled",
|
44
|
-
args: {
|
45
|
-
handleChange: fn(),
|
46
|
-
},
|
47
|
-
render: (args) => (<CheckboxGroup name="test-name" defaultValue={["1"]} onChange={args.handleChange}>
|
48
|
-
{/* checked should be ignored */}
|
49
|
-
<Checkbox value="1" checked={false}>
|
50
|
-
Content
|
51
|
-
</Checkbox>
|
52
|
-
|
53
|
-
<Checkbox value="2">Content 2</Checkbox>
|
54
|
-
</CheckboxGroup>),
|
55
|
-
play: async ({ canvas, args }) => {
|
56
|
-
const inputs = canvas.getAllByRole("checkbox");
|
57
|
-
expect(inputs[0]).toBeChecked();
|
58
|
-
await userEvent.click(inputs[1]);
|
59
|
-
expect(args.handleChange).toHaveBeenCalledTimes(1);
|
60
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
61
|
-
name: "test-name",
|
62
|
-
value: ["1", "2"],
|
63
|
-
event: expect.objectContaining({ target: inputs[1] }),
|
64
|
-
});
|
65
|
-
expect(inputs[0]).toBeChecked();
|
66
|
-
expect(inputs[1]).toBeChecked();
|
67
|
-
},
|
68
|
-
};
|
69
|
-
export const disabled = {
|
70
|
-
name: "disabled",
|
71
|
-
render: () => (<CheckboxGroup name="test-name" disabled>
|
72
|
-
<Checkbox value="test-value">Content</Checkbox>
|
73
|
-
</CheckboxGroup>),
|
74
|
-
play: async ({ canvas }) => {
|
75
|
-
const input = canvas.getByRole("checkbox");
|
76
|
-
expect(input).toBeDisabled();
|
77
|
-
},
|
78
|
-
};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").ContainerProps>;
|
5
|
-
parameters: {
|
6
|
-
iframe: {
|
7
|
-
url: string;
|
8
|
-
};
|
9
|
-
chromatic: {
|
10
|
-
disableSnapshot: boolean;
|
11
|
-
};
|
12
|
-
};
|
13
|
-
};
|
14
|
-
export default _default;
|
15
|
-
export declare const className: StoryObj;
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import Container from "../index.js";
|
3
|
-
import { Placeholder } from "../../../utilities/storybook/index.js";
|
4
|
-
export default {
|
5
|
-
title: "Utility components/Container/tests",
|
6
|
-
component: Container,
|
7
|
-
parameters: {
|
8
|
-
iframe: {
|
9
|
-
url: "https://reshaped.so/docs/components/action-bar",
|
10
|
-
},
|
11
|
-
chromatic: { disableSnapshot: true },
|
12
|
-
},
|
13
|
-
};
|
14
|
-
export const className = {
|
15
|
-
name: "className, attributes",
|
16
|
-
render: () => (<div data-testid="root">
|
17
|
-
<Container className="test-classname" attributes={{ id: "test-id" }}>
|
18
|
-
<Placeholder />
|
19
|
-
</Container>
|
20
|
-
</div>),
|
21
|
-
play: async ({ canvas }) => {
|
22
|
-
const root = canvas.getByTestId("root").firstChild;
|
23
|
-
expect(root).toHaveClass("test-classname");
|
24
|
-
expect(root).toHaveAttribute("id", "test-id");
|
25
|
-
},
|
26
|
-
};
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
import { fn } from "storybook/test";
|
3
|
-
declare const _default: {
|
4
|
-
title: string;
|
5
|
-
component: import("react").FC<import("./..").ContextMenuProps> & {
|
6
|
-
Content: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").ContentProps>;
|
7
|
-
Item: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").ItemProps>;
|
8
|
-
Section: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").SectionProps>;
|
9
|
-
SubMenu: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").SubMenuProps>;
|
10
|
-
SubTrigger: import("react").FC<import("../../DropdownMenu/DropdownMenu.types").SubTriggerProps>;
|
11
|
-
};
|
12
|
-
parameters: {
|
13
|
-
iframe: {
|
14
|
-
url: string;
|
15
|
-
};
|
16
|
-
chromatic: {
|
17
|
-
disableSnapshot: boolean;
|
18
|
-
};
|
19
|
-
};
|
20
|
-
};
|
21
|
-
export default _default;
|
22
|
-
export declare const handlers: StoryObj<{
|
23
|
-
handleOpen: ReturnType<typeof fn>;
|
24
|
-
handleClose: ReturnType<typeof fn>;
|
25
|
-
}>;
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
|
2
|
-
import ContextMenu from "../index.js";
|
3
|
-
import View from "../../View/index.js";
|
4
|
-
import { sleep } from "../../../utilities/helpers.js";
|
5
|
-
export default {
|
6
|
-
title: "Components/ContextMenu/tests",
|
7
|
-
component: ContextMenu,
|
8
|
-
parameters: {
|
9
|
-
iframe: {
|
10
|
-
url: "https://reshaped.so/docs/components/context-menu",
|
11
|
-
},
|
12
|
-
chromatic: { disableSnapshot: true },
|
13
|
-
},
|
14
|
-
};
|
15
|
-
export const handlers = {
|
16
|
-
name: "handleOpen, handleClose",
|
17
|
-
args: {
|
18
|
-
handleOpen: fn(),
|
19
|
-
handleClose: fn(),
|
20
|
-
},
|
21
|
-
render: (args) => (<div style={{ height: 200, overflow: "auto" }} data-testid="scroll">
|
22
|
-
<ContextMenu onOpen={args.handleOpen} onClose={args.handleClose}>
|
23
|
-
<View height="400px" backgroundColor="neutral-faded" borderRadius="medium" attributes={{ "data-testid": "root" }}/>
|
24
|
-
|
25
|
-
<ContextMenu.Content>
|
26
|
-
<ContextMenu.Item>Item</ContextMenu.Item>
|
27
|
-
</ContextMenu.Content>
|
28
|
-
</ContextMenu>
|
29
|
-
</div>),
|
30
|
-
play: async ({ canvasElement, args }) => {
|
31
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
32
|
-
const root = canvas.getByTestId("root");
|
33
|
-
const scroll = canvas.getByTestId("scroll");
|
34
|
-
await userEvent.pointer({ keys: "[MouseRight>]", target: root });
|
35
|
-
expect(args.handleOpen).toHaveBeenCalledTimes(1);
|
36
|
-
expect(args.handleOpen).toHaveBeenCalledWith();
|
37
|
-
const item = canvas.getByText("Item");
|
38
|
-
expect(item).toBeInTheDocument();
|
39
|
-
// Context menu locks the scroll of the closest scrollable parent
|
40
|
-
expect(scroll).toHaveStyle("overflow: hidden");
|
41
|
-
// Wait for the open animation to finish
|
42
|
-
await sleep(500);
|
43
|
-
await userEvent.click(root);
|
44
|
-
expect(args.handleClose).toHaveBeenCalledTimes(1);
|
45
|
-
expect(args.handleClose).toHaveBeenCalledWith({ reason: "outside-click" });
|
46
|
-
await waitFor(() => {
|
47
|
-
expect(item).not.toBeInTheDocument();
|
48
|
-
expect(scroll).not.toHaveStyle("overflow: hidden");
|
49
|
-
}, {
|
50
|
-
timeout: 1000,
|
51
|
-
});
|
52
|
-
},
|
53
|
-
};
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
import { fn } from "storybook/test";
|
3
|
-
declare const _default: {
|
4
|
-
title: string;
|
5
|
-
component: import("react").FC<import("./..").DismissibleProps>;
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: string;
|
9
|
-
};
|
10
|
-
chromatic: {
|
11
|
-
disableSnapshot: boolean;
|
12
|
-
};
|
13
|
-
};
|
14
|
-
};
|
15
|
-
export default _default;
|
16
|
-
export declare const closeAriaLabel: StoryObj<{
|
17
|
-
handleClose: ReturnType<typeof fn>;
|
18
|
-
}>;
|
19
|
-
export declare const className: StoryObj;
|
@@ -1,42 +0,0 @@
|
|
1
|
-
import { expect, fn, userEvent } from "storybook/test";
|
2
|
-
import Dismissible from "../index.js";
|
3
|
-
import { Placeholder } from "../../../utilities/storybook/index.js";
|
4
|
-
export default {
|
5
|
-
title: "Utility components/Dismissible/tests",
|
6
|
-
component: Dismissible,
|
7
|
-
parameters: {
|
8
|
-
iframe: {
|
9
|
-
url: "https://reshaped.so/docs/components/action-bar",
|
10
|
-
},
|
11
|
-
chromatic: { disableSnapshot: true },
|
12
|
-
},
|
13
|
-
};
|
14
|
-
export const closeAriaLabel = {
|
15
|
-
args: {
|
16
|
-
handleClose: fn(),
|
17
|
-
},
|
18
|
-
name: "onClose, closeAriaLabel",
|
19
|
-
render: (args) => (<Dismissible closeAriaLabel="Close" onClose={args.handleClose}>
|
20
|
-
<Placeholder />
|
21
|
-
</Dismissible>),
|
22
|
-
play: async ({ canvas, args }) => {
|
23
|
-
const button = canvas.getAllByRole("button")[0];
|
24
|
-
await userEvent.click(button);
|
25
|
-
expect(button).toHaveAttribute("aria-label", "Close");
|
26
|
-
expect(args.handleClose).toHaveBeenCalledTimes(1);
|
27
|
-
expect(args.handleClose).toHaveBeenCalledWith();
|
28
|
-
},
|
29
|
-
};
|
30
|
-
export const className = {
|
31
|
-
name: "className, attributes",
|
32
|
-
render: () => (<div data-testid="root">
|
33
|
-
<Dismissible closeAriaLabel="Close" onClose={() => { }} className="test-classname" attributes={{ id: "test-id" }}>
|
34
|
-
<Placeholder />
|
35
|
-
</Dismissible>
|
36
|
-
</div>),
|
37
|
-
play: async ({ canvas }) => {
|
38
|
-
const root = canvas.getByTestId("root").firstChild;
|
39
|
-
expect(root).toHaveClass("test-classname");
|
40
|
-
expect(root).toHaveAttribute("id", "test-id");
|
41
|
-
},
|
42
|
-
};
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").DividerProps>;
|
5
|
-
parameters: {
|
6
|
-
iframe: {
|
7
|
-
url: string;
|
8
|
-
};
|
9
|
-
chromatic: {
|
10
|
-
disableSnapshot: boolean;
|
11
|
-
};
|
12
|
-
};
|
13
|
-
};
|
14
|
-
export default _default;
|
15
|
-
export declare const horizontal: StoryObj;
|
16
|
-
export declare const vertical: StoryObj;
|
17
|
-
export declare const responsive: StoryObj;
|
18
|
-
export declare const className: StoryObj;
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import Divider from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/Divider/tests",
|
5
|
-
component: Divider,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/divider",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const horizontal = {
|
14
|
-
name: "orientation, horizontal",
|
15
|
-
render: () => <Divider />,
|
16
|
-
play: async ({ canvas }) => {
|
17
|
-
const el = canvas.getByRole("separator");
|
18
|
-
expect(el).toHaveAttribute("aria-orientation", "horizontal");
|
19
|
-
},
|
20
|
-
};
|
21
|
-
export const vertical = {
|
22
|
-
name: "orientation, vertical",
|
23
|
-
render: () => <Divider vertical/>,
|
24
|
-
play: async ({ canvas }) => {
|
25
|
-
const el = canvas.getByRole("separator");
|
26
|
-
expect(el).toHaveAttribute("aria-orientation", "vertical");
|
27
|
-
},
|
28
|
-
};
|
29
|
-
export const responsive = {
|
30
|
-
name: "orientation, responsive",
|
31
|
-
render: () => <Divider vertical={{ s: true, l: false }}/>,
|
32
|
-
play: async ({ canvas }) => {
|
33
|
-
const el = canvas.getByRole("separator");
|
34
|
-
expect(el).not.toHaveAttribute("aria-orientation");
|
35
|
-
},
|
36
|
-
};
|
37
|
-
export const className = {
|
38
|
-
name: "className, attributes",
|
39
|
-
render: () => (<div data-testid="root">
|
40
|
-
<Divider className="test-classname" attributes={{ id: "test-id" }}/>
|
41
|
-
</div>),
|
42
|
-
play: async ({ canvas }) => {
|
43
|
-
const root = canvas.getByTestId("root").firstChild;
|
44
|
-
expect(root).toHaveClass("test-classname");
|
45
|
-
expect(root).toHaveAttribute("id", "test-id");
|
46
|
-
},
|
47
|
-
};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").FormControlProps> & {
|
5
|
-
Label: import("react").FC<import("../FormControl.types").LabelProps>;
|
6
|
-
Helper: import("react").FC<import("../FormControl.types").CaptionProps>;
|
7
|
-
Error: import("react").FC<import("../FormControl.types").CaptionProps>;
|
8
|
-
};
|
9
|
-
parameters: {
|
10
|
-
iframe: {
|
11
|
-
url: string;
|
12
|
-
};
|
13
|
-
chromatic: {
|
14
|
-
disableSnapshot: boolean;
|
15
|
-
};
|
16
|
-
};
|
17
|
-
};
|
18
|
-
export default _default;
|
19
|
-
export declare const className: StoryObj;
|
20
|
-
export declare const group: StoryObj;
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import FormControl from "../index.js";
|
3
|
-
import Radio from "../../Radio/index.js";
|
4
|
-
import RadioGroup from "../../RadioGroup/index.js";
|
5
|
-
import TextField from "../../TextField/index.js";
|
6
|
-
import View from "../../View/index.js";
|
7
|
-
export default {
|
8
|
-
title: "Utility components/FormControl/tests",
|
9
|
-
component: FormControl,
|
10
|
-
parameters: {
|
11
|
-
iframe: {
|
12
|
-
url: "https://reshaped.so/docs/utilities/form-control",
|
13
|
-
},
|
14
|
-
chromatic: { disableSnapshot: true },
|
15
|
-
},
|
16
|
-
};
|
17
|
-
export const className = {
|
18
|
-
name: "id",
|
19
|
-
render: () => (<FormControl id="test-id" hasError>
|
20
|
-
<FormControl.Label>Label</FormControl.Label>
|
21
|
-
<TextField name="name"/>
|
22
|
-
<FormControl.Helper>Caption</FormControl.Helper>
|
23
|
-
<FormControl.Error>Error</FormControl.Error>
|
24
|
-
</FormControl>),
|
25
|
-
play: async ({ canvas }) => {
|
26
|
-
const input = canvas.getByRole("textbox");
|
27
|
-
const label = canvas.getByText("Label");
|
28
|
-
expect(input).toHaveAttribute("id", "test-id");
|
29
|
-
expect(input).toHaveAttribute("aria-describedby", `test-id-caption test-id-error`);
|
30
|
-
expect(label).toHaveAttribute("for", "test-id");
|
31
|
-
expect(label).toHaveAttribute("id", `test-id-label`);
|
32
|
-
},
|
33
|
-
};
|
34
|
-
export const group = {
|
35
|
-
name: "group",
|
36
|
-
render: () => (<FormControl group>
|
37
|
-
<FormControl.Label>Label</FormControl.Label>
|
38
|
-
<RadioGroup name="name">
|
39
|
-
<View gap={2}>
|
40
|
-
<Radio value="1">One</Radio>
|
41
|
-
<Radio value="2">Two</Radio>
|
42
|
-
</View>
|
43
|
-
</RadioGroup>
|
44
|
-
</FormControl>),
|
45
|
-
play: async ({ canvas }) => {
|
46
|
-
const group = canvas.getByRole("group");
|
47
|
-
expect(group).toBeInTheDocument();
|
48
|
-
},
|
49
|
-
};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").HiddenProps>;
|
5
|
-
parameters: {
|
6
|
-
iframe: {
|
7
|
-
url: string;
|
8
|
-
};
|
9
|
-
chromatic: {
|
10
|
-
disableSnapshot: boolean;
|
11
|
-
};
|
12
|
-
};
|
13
|
-
};
|
14
|
-
export default _default;
|
15
|
-
export declare const as: StoryObj;
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import Hidden from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Utility components/Hidden/tests",
|
5
|
-
component: Hidden,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/utilities/hidden",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const as = {
|
14
|
-
name: "as",
|
15
|
-
render: () => <Hidden as="span">Content</Hidden>,
|
16
|
-
play: ({ canvas }) => {
|
17
|
-
const el = canvas.getByText("Content");
|
18
|
-
expect(el.tagName).toEqual("SPAN");
|
19
|
-
},
|
20
|
-
};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").HiddenVisuallyProps>;
|
5
|
-
parameters: {
|
6
|
-
iframe: {
|
7
|
-
url: string;
|
8
|
-
};
|
9
|
-
chromatic: {
|
10
|
-
disableSnapshot: boolean;
|
11
|
-
};
|
12
|
-
};
|
13
|
-
};
|
14
|
-
export default _default;
|
15
|
-
export declare const children: StoryObj;
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import HiddenVisually from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Utility components/HiddenVisually/tests",
|
5
|
-
component: HiddenVisually,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/utilities/hidden-visually",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const children = {
|
14
|
-
name: "children",
|
15
|
-
render: () => <HiddenVisually>Content</HiddenVisually>,
|
16
|
-
play: ({ canvas }) => {
|
17
|
-
const el = canvas.getByText("Content");
|
18
|
-
expect(el).toBeInTheDocument();
|
19
|
-
},
|
20
|
-
};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("..").HotkeyProps>;
|
5
|
-
parameters: {
|
6
|
-
iframe: {
|
7
|
-
url: string;
|
8
|
-
};
|
9
|
-
chromatic: {
|
10
|
-
disableSnapshot: boolean;
|
11
|
-
};
|
12
|
-
};
|
13
|
-
};
|
14
|
-
export default _default;
|
15
|
-
export declare const className: StoryObj;
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import Hotkey from "../Hotkey.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/Hotkey/tests",
|
5
|
-
component: Hotkey,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/hotkey",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const className = {
|
14
|
-
name: "className, attributes",
|
15
|
-
render: () => (<div data-testid="root">
|
16
|
-
<Hotkey className="test-classname" attributes={{ id: "test-id" }}>
|
17
|
-
⌘K
|
18
|
-
</Hotkey>
|
19
|
-
</div>),
|
20
|
-
play: async ({ canvas }) => {
|
21
|
-
const root = canvas.getByTestId("root").firstChild;
|
22
|
-
expect(root).toHaveClass("test-classname");
|
23
|
-
expect(root).toHaveAttribute("id", "test-id");
|
24
|
-
expect(root?.tagName).toBe("KBD");
|
25
|
-
},
|
26
|
-
};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").IconProps>;
|
5
|
-
parameters: {
|
6
|
-
iframe: {
|
7
|
-
url: string;
|
8
|
-
};
|
9
|
-
chromatic: {
|
10
|
-
disableSnapshot: boolean;
|
11
|
-
};
|
12
|
-
};
|
13
|
-
};
|
14
|
-
export default _default;
|
15
|
-
export declare const render: StoryObj;
|
16
|
-
export declare const className: StoryObj;
|