reshaped 3.9.0-canary.0 → 3.9.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +10 -10
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Card/Card.module.css +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/components/Flyout/Flyout.constants.d.ts +1 -3
- package/dist/components/Flyout/Flyout.constants.js +1 -3
- package/dist/components/Flyout/FlyoutControlled.js +6 -8
- package/dist/components/Flyout/utilities/cooldown.js +1 -2
- package/dist/components/Icon/Icon.module.css +1 -1
- package/dist/components/Progress/Progress.module.css +1 -1
- package/dist/components/Reshaped/Reshaped.css +1 -1
- package/dist/components/Text/Text.module.css +1 -1
- package/dist/components/Theme/Theme.module.css +1 -1
- package/dist/hooks/useOnClickOutside.js +2 -4
- package/dist/themes/_generator/tokens/css.js +2 -2
- package/dist/themes/figma/theme.css +1 -1
- package/dist/themes/fragments/twitter/theme.css +1 -1
- package/dist/themes/reshaped/theme.css +1 -1
- package/dist/themes/slate/theme.css +1 -1
- package/package.json +40 -35
- package/dist/components/Accordion/tests/Accordion.stories.d.ts +0 -44
- package/dist/components/Accordion/tests/Accordion.stories.js +0 -204
- package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +0 -40
- package/dist/components/ActionBar/tests/ActionBar.stories.js +0 -223
- package/dist/components/Actionable/tests/Actionable.stories.d.ts +0 -41
- package/dist/components/Actionable/tests/Actionable.stories.js +0 -220
- package/dist/components/Alert/tests/Alert.stories.d.ts +0 -24
- package/dist/components/Alert/tests/Alert.stories.js +0 -78
- package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +0 -32
- package/dist/components/Autocomplete/tests/Autocomplete.stories.js +0 -246
- package/dist/components/Avatar/tests/Avatar.stories.d.ts +0 -31
- package/dist/components/Avatar/tests/Avatar.stories.js +0 -176
- package/dist/components/Badge/tests/Badge.stories.d.ts +0 -55
- package/dist/components/Badge/tests/Badge.stories.js +0 -328
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +0 -40
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +0 -187
- package/dist/components/Button/tests/Button.stories.d.ts +0 -79
- package/dist/components/Button/tests/Button.stories.js +0 -789
- package/dist/components/Calendar/tests/Calendar.stories.d.ts +0 -29
- package/dist/components/Calendar/tests/Calendar.stories.js +0 -255
- package/dist/components/Card/tests/Card.stories.d.ts +0 -52
- package/dist/components/Card/tests/Card.stories.js +0 -125
- package/dist/components/Carousel/tests/Carousel.stories.d.ts +0 -34
- package/dist/components/Carousel/tests/Carousel.stories.js +0 -224
- package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +0 -30
- package/dist/components/Checkbox/tests/Checkbox.stories.js +0 -171
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +0 -19
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +0 -83
- package/dist/components/Container/tests/Container.stories.d.ts +0 -24
- package/dist/components/Container/tests/Container.stories.js +0 -75
- package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +0 -26
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +0 -70
- package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +0 -25
- package/dist/components/Dismissible/tests/Dismissible.stories.js +0 -97
- package/dist/components/Divider/tests/Divider.stories.d.ts +0 -20
- package/dist/components/Divider/tests/Divider.stories.js +0 -120
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +0 -53
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +0 -278
- package/dist/components/FileUpload/tests/FileUpload.stories.d.ts +0 -31
- package/dist/components/FileUpload/tests/FileUpload.stories.js +0 -140
- package/dist/components/Flyout/tests/Flyout.stories.d.ts +0 -103
- package/dist/components/Flyout/tests/Flyout.stories.js +0 -738
- package/dist/components/FormControl/tests/FormControl.stories.d.ts +0 -31
- package/dist/components/FormControl/tests/FormControl.stories.js +0 -143
- package/dist/components/Grid/tests/Grid.stories.d.ts +0 -38
- package/dist/components/Grid/tests/Grid.stories.js +0 -245
- package/dist/components/Hidden/tests/Hidden.stories.d.ts +0 -16
- package/dist/components/Hidden/tests/Hidden.stories.js +0 -48
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +0 -16
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +0 -28
- package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +0 -13
- package/dist/components/Hotkey/tests/Hotkey.stories.js +0 -53
- package/dist/components/Icon/tests/Icon.stories.d.ts +0 -25
- package/dist/components/Icon/tests/Icon.stories.js +0 -113
- package/dist/components/Image/tests/Image.stories.d.ts +0 -41
- package/dist/components/Image/tests/Image.stories.js +0 -196
- package/dist/components/Link/tests/Link.stories.d.ts +0 -42
- package/dist/components/Link/tests/Link.stories.js +0 -155
- package/dist/components/Loader/tests/Loader.stories.d.ts +0 -21
- package/dist/components/Loader/tests/Loader.stories.js +0 -68
- package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +0 -59
- package/dist/components/MenuItem/tests/MenuItem.stories.js +0 -236
- package/dist/components/Modal/tests/Modal.stories.d.ts +0 -64
- package/dist/components/Modal/tests/Modal.stories.js +0 -410
- package/dist/components/NumberField/tests/NumberField.stories.d.ts +0 -28
- package/dist/components/NumberField/tests/NumberField.stories.js +0 -258
- package/dist/components/Overlay/tests/Overlay.stories.d.ts +0 -28
- package/dist/components/Overlay/tests/Overlay.stories.js +0 -202
- package/dist/components/Pagination/tests/Pagination.stories.d.ts +0 -24
- package/dist/components/Pagination/tests/Pagination.stories.js +0 -105
- package/dist/components/PinField/tests/PinField.stories.d.ts +0 -34
- package/dist/components/PinField/tests/PinField.stories.js +0 -209
- package/dist/components/Popover/tests/Popover.stories.d.ts +0 -69
- package/dist/components/Popover/tests/Popover.stories.js +0 -340
- package/dist/components/Progress/tests/Progress.stories.d.ts +0 -30
- package/dist/components/Progress/tests/Progress.stories.js +0 -102
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.d.ts +0 -19
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +0 -92
- package/dist/components/Radio/tests/Radio.stories.d.ts +0 -35
- package/dist/components/Radio/tests/Radio.stories.js +0 -162
- package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +0 -19
- package/dist/components/RadioGroup/tests/RadioGroup.stories.js +0 -77
- package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +0 -34
- package/dist/components/Reshaped/tests/Reshaped.stories.js +0 -108
- package/dist/components/Resizable/tests/Resizable.stories.d.ts +0 -38
- package/dist/components/Resizable/tests/Resizable.stories.js +0 -185
- package/dist/components/Scrim/tests/Scrim.stories.d.ts +0 -20
- package/dist/components/Scrim/tests/Scrim.stories.js +0 -67
- package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +0 -37
- package/dist/components/ScrollArea/tests/ScrollArea.stories.js +0 -244
- package/dist/components/Select/tests/Select.stories.d.ts +0 -53
- package/dist/components/Select/tests/Select.stories.js +0 -616
- package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +0 -20
- package/dist/components/Skeleton/tests/Skeleton.stories.js +0 -63
- package/dist/components/Slider/tests/Slider.stories.d.ts +0 -47
- package/dist/components/Slider/tests/Slider.stories.js +0 -279
- package/dist/components/Stepper/tests/Stepper.stories.d.ts +0 -31
- package/dist/components/Stepper/tests/Stepper.stories.js +0 -135
- package/dist/components/Switch/tests/Switch.stories.d.ts +0 -22
- package/dist/components/Switch/tests/Switch.stories.js +0 -137
- package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -13
- package/dist/components/Switch/tests/Switch.test.stories.js +0 -11
- package/dist/components/Table/tests/Table.stories.d.ts +0 -42
- package/dist/components/Table/tests/Table.stories.js +0 -348
- package/dist/components/Tabs/tests/Tabs.stories.d.ts +0 -62
- package/dist/components/Tabs/tests/Tabs.stories.js +0 -539
- package/dist/components/Text/tests/Text.stories.d.ts +0 -48
- package/dist/components/Text/tests/Text.stories.js +0 -201
- package/dist/components/TextArea/tests/TextArea.stories.d.ts +0 -53
- package/dist/components/TextArea/tests/TextArea.stories.js +0 -204
- package/dist/components/TextField/tests/TextField.stories.d.ts +0 -54
- package/dist/components/TextField/tests/TextField.stories.js +0 -252
- package/dist/components/Theme/tests/Theme.stories.d.ts +0 -25
- package/dist/components/Theme/tests/Theme.stories.js +0 -171
- package/dist/components/Timeline/tests/Timeline.stories.d.ts +0 -22
- package/dist/components/Timeline/tests/Timeline.stories.js +0 -86
- package/dist/components/Toast/tests/Toast.stories.d.ts +0 -41
- package/dist/components/Toast/tests/Toast.stories.js +0 -432
- package/dist/components/ToggleButton/tests/ToggleButton.stories.d.ts +0 -27
- package/dist/components/ToggleButton/tests/ToggleButton.stories.js +0 -97
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.d.ts +0 -27
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.js +0 -169
- package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +0 -28
- package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -182
- package/dist/components/View/tests/View.stories.d.ts +0 -141
- package/dist/components/View/tests/View.stories.js +0 -1329
- package/dist/components/_private/Portal/tests/Portal.stories.d.ts +0 -6
- package/dist/components/_private/Portal/tests/Portal.stories.js +0 -17
- package/dist/hooks/tests/useDrag.stories.d.ts +0 -31
- package/dist/hooks/tests/useDrag.stories.js +0 -147
- package/dist/hooks/tests/useElementId.stories.d.ts +0 -11
- package/dist/hooks/tests/useElementId.stories.js +0 -23
- package/dist/hooks/tests/useHandlerRef.stories.d.ts +0 -14
- package/dist/hooks/tests/useHandlerRef.stories.js +0 -44
- package/dist/hooks/tests/useHotkeys.stories.d.ts +0 -43
- package/dist/hooks/tests/useHotkeys.stories.js +0 -158
- package/dist/hooks/tests/useKeyboardArrowNavigation.stories.d.ts +0 -15
- package/dist/hooks/tests/useKeyboardArrowNavigation.stories.js +0 -128
- package/dist/hooks/tests/useKeyboardMode.stories.d.ts +0 -11
- package/dist/hooks/tests/useKeyboardMode.stories.js +0 -42
- package/dist/hooks/tests/useOnClickOutside.stories.d.ts +0 -23
- package/dist/hooks/tests/useOnClickOutside.stories.js +0 -111
- package/dist/hooks/tests/useRTL.stories.d.ts +0 -11
- package/dist/hooks/tests/useRTL.stories.js +0 -23
- package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +0 -18
- package/dist/hooks/tests/useResponsiveClientValue.stories.js +0 -30
- package/dist/hooks/tests/useScrollLock.stories.d.ts +0 -14
- package/dist/hooks/tests/useScrollLock.stories.js +0 -97
- package/dist/hooks/tests/useToggle.stories.d.ts +0 -13
- package/dist/hooks/tests/useToggle.stories.js +0 -59
- package/dist/tests/ShadowDOM.stories.d.ts +0 -6
- package/dist/tests/ShadowDOM.stories.js +0 -110
- package/dist/tests/themes.stories.d.ts +0 -16
- package/dist/tests/themes.stories.js +0 -327
- package/dist/utilities/a11y/tests/TrapFocus.stories.d.ts +0 -14
- package/dist/utilities/a11y/tests/TrapFocus.stories.js +0 -615
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
2
|
-
import Switch from "../index.js";
|
|
3
|
-
import View from "../../View/index.js";
|
|
4
|
-
import { expect, fn, userEvent } from "storybook/test";
|
|
5
|
-
export default {
|
|
6
|
-
title: "Components/Switch",
|
|
7
|
-
component: Switch,
|
|
8
|
-
parameters: {
|
|
9
|
-
iframe: {
|
|
10
|
-
url: "https://reshaped.so/docs/components/switch",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
export const size = () => (<Example>
|
|
15
|
-
<Example.Item title="size: medium">
|
|
16
|
-
<Switch name="active" size="medium" inputAttributes={{ "aria-label": "test switch" }}/>
|
|
17
|
-
</Example.Item>
|
|
18
|
-
<Example.Item title="size: small">
|
|
19
|
-
<Switch name="active" size="small" inputAttributes={{ "aria-label": "test switch" }}/>
|
|
20
|
-
</Example.Item>
|
|
21
|
-
<Example.Item title="size: large">
|
|
22
|
-
<Switch name="active" size="large" inputAttributes={{ "aria-label": "test switch" }}/>
|
|
23
|
-
</Example.Item>
|
|
24
|
-
<Example.Item title="size: responsive, s: small, m: large">
|
|
25
|
-
<Switch name="active" size={{ s: "small", m: "large" }} inputAttributes={{ "aria-label": "test switch" }}/>
|
|
26
|
-
</Example.Item>
|
|
27
|
-
</Example>);
|
|
28
|
-
export const label = () => (<Example>
|
|
29
|
-
<Example.Item title="size: medium">
|
|
30
|
-
<View direction="row" gap={8}>
|
|
31
|
-
<Switch name="active" inputAttributes={{ "aria-label": "test switch" }}>
|
|
32
|
-
Wi-fi
|
|
33
|
-
</Switch>
|
|
34
|
-
<Switch reversed name="active" inputAttributes={{ "aria-label": "test switch" }}>
|
|
35
|
-
Wi-fi
|
|
36
|
-
</Switch>
|
|
37
|
-
</View>
|
|
38
|
-
</Example.Item>
|
|
39
|
-
<Example.Item title="size: small">
|
|
40
|
-
<View direction="row" gap={8}>
|
|
41
|
-
<Switch name="active" size="small" inputAttributes={{ "aria-label": "test switch" }}>
|
|
42
|
-
Wi-fi
|
|
43
|
-
</Switch>
|
|
44
|
-
<Switch reversed name="active" size="small" inputAttributes={{ "aria-label": "test switch" }}>
|
|
45
|
-
Wi-fi
|
|
46
|
-
</Switch>
|
|
47
|
-
</View>
|
|
48
|
-
</Example.Item>
|
|
49
|
-
|
|
50
|
-
<Example.Item title="size: large">
|
|
51
|
-
<View direction="row" gap={8}>
|
|
52
|
-
<Switch name="active" size="large" inputAttributes={{ "aria-label": "test switch" }}>
|
|
53
|
-
Wi-fi
|
|
54
|
-
</Switch>
|
|
55
|
-
<Switch reversed name="active" size="large" inputAttributes={{ "aria-label": "test switch" }}>
|
|
56
|
-
Wi-fi
|
|
57
|
-
</Switch>
|
|
58
|
-
</View>
|
|
59
|
-
</Example.Item>
|
|
60
|
-
</Example>);
|
|
61
|
-
export const defaultChecked = {
|
|
62
|
-
name: "defaultChecked, uncontrolled",
|
|
63
|
-
args: {
|
|
64
|
-
handleChange: fn(),
|
|
65
|
-
},
|
|
66
|
-
render: (args) => (<Switch name="test-name" defaultChecked onChange={args.handleChange}>
|
|
67
|
-
Label
|
|
68
|
-
</Switch>),
|
|
69
|
-
play: async ({ canvas, args }) => {
|
|
70
|
-
const input = canvas.getByRole("checkbox");
|
|
71
|
-
expect(input).toBeChecked();
|
|
72
|
-
await userEvent.click(input);
|
|
73
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
|
74
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
|
75
|
-
name: "test-name",
|
|
76
|
-
checked: false,
|
|
77
|
-
event: expect.objectContaining({ target: input }),
|
|
78
|
-
});
|
|
79
|
-
expect(input).not.toBeChecked();
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
export const checked = {
|
|
83
|
-
name: "checked, uncontrolled",
|
|
84
|
-
args: {
|
|
85
|
-
handleChange: fn(),
|
|
86
|
-
},
|
|
87
|
-
render: (args) => (<Switch name="test-name" checked onChange={args.handleChange}>
|
|
88
|
-
Label
|
|
89
|
-
</Switch>),
|
|
90
|
-
play: async ({ canvas, args }) => {
|
|
91
|
-
const input = canvas.getByRole("checkbox");
|
|
92
|
-
expect(input).toBeChecked();
|
|
93
|
-
await userEvent.click(input);
|
|
94
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
|
95
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
|
96
|
-
name: "test-name",
|
|
97
|
-
checked: false,
|
|
98
|
-
event: expect.objectContaining({ target: input }),
|
|
99
|
-
});
|
|
100
|
-
expect(input).toBeChecked();
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
export const disabled = {
|
|
104
|
-
name: "disabled",
|
|
105
|
-
render: () => (<Example>
|
|
106
|
-
<Example.Item title="disabled, unselected">
|
|
107
|
-
<Switch name="active" disabled inputAttributes={{ "aria-label": "test switch" }}/>
|
|
108
|
-
</Example.Item>
|
|
109
|
-
<Example.Item title="disabled, selected">
|
|
110
|
-
<Switch name="active" disabled defaultChecked inputAttributes={{ "aria-label": "test switch" }}/>
|
|
111
|
-
</Example.Item>
|
|
112
|
-
<Example.Item title="disabled, with label">
|
|
113
|
-
<Switch name="active" disabled>
|
|
114
|
-
Switch
|
|
115
|
-
</Switch>
|
|
116
|
-
</Example.Item>
|
|
117
|
-
</Example>),
|
|
118
|
-
play: async ({ canvas }) => {
|
|
119
|
-
const [input] = canvas.getAllByRole("checkbox");
|
|
120
|
-
expect(input).toBeDisabled();
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
export const className = {
|
|
124
|
-
name: "className, attributes",
|
|
125
|
-
render: () => (<div data-testid="root">
|
|
126
|
-
<Switch className="test-classname" attributes={{ id: "test-id" }} inputAttributes={{ "aria-label": "test select", id: "test-input-id" }} name="name">
|
|
127
|
-
Label
|
|
128
|
-
</Switch>
|
|
129
|
-
</div>),
|
|
130
|
-
play: async ({ canvas }) => {
|
|
131
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
132
|
-
const input = canvas.getByRole("checkbox");
|
|
133
|
-
expect(root).toHaveClass("test-classname");
|
|
134
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
135
|
-
expect(input).toHaveAttribute("id", "test-input-id");
|
|
136
|
-
},
|
|
137
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: React.FC<import("./..").TableProps> & {
|
|
6
|
-
Cell: typeof import("../Table").TableCell;
|
|
7
|
-
Heading: typeof import("../Table").TableHeading;
|
|
8
|
-
Row: typeof import("../Table").TableRow;
|
|
9
|
-
Body: typeof import("../Table").TableBody;
|
|
10
|
-
Head: typeof import("../Table").TableHead;
|
|
11
|
-
};
|
|
12
|
-
parameters: {
|
|
13
|
-
iframe: {
|
|
14
|
-
url: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export default _default;
|
|
19
|
-
export declare const layout: {
|
|
20
|
-
name: string;
|
|
21
|
-
render: () => React.JSX.Element;
|
|
22
|
-
};
|
|
23
|
-
export declare const border: {
|
|
24
|
-
name: string;
|
|
25
|
-
render: () => React.JSX.Element;
|
|
26
|
-
};
|
|
27
|
-
export declare const rows: {
|
|
28
|
-
name: string;
|
|
29
|
-
render: () => React.JSX.Element;
|
|
30
|
-
};
|
|
31
|
-
export declare const render: StoryObj;
|
|
32
|
-
export declare const tbody: StoryObj;
|
|
33
|
-
export declare const tabIndex: StoryObj;
|
|
34
|
-
export declare const className: StoryObj;
|
|
35
|
-
export declare const edgeCases: {
|
|
36
|
-
name: string;
|
|
37
|
-
render: () => React.JSX.Element;
|
|
38
|
-
};
|
|
39
|
-
export declare const examples: {
|
|
40
|
-
name: string;
|
|
41
|
-
render: () => React.JSX.Element;
|
|
42
|
-
};
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
3
|
-
import Table from "../index.js";
|
|
4
|
-
import Checkbox from "../../Checkbox/index.js";
|
|
5
|
-
import Card from "../../Card/index.js";
|
|
6
|
-
import View from "../../View/index.js";
|
|
7
|
-
import { expect } from "storybook/test";
|
|
8
|
-
export default {
|
|
9
|
-
title: "Components/Table",
|
|
10
|
-
component: Table,
|
|
11
|
-
parameters: {
|
|
12
|
-
iframe: {
|
|
13
|
-
url: "https://reshaped.so/docs/components/table",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
export const layout = {
|
|
18
|
-
name: "base",
|
|
19
|
-
render: () => (<Example>
|
|
20
|
-
<Example.Item title="base">
|
|
21
|
-
<Table>
|
|
22
|
-
<Table.Head>
|
|
23
|
-
<Table.Row>
|
|
24
|
-
<Table.Heading>Column 1</Table.Heading>
|
|
25
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
26
|
-
</Table.Row>
|
|
27
|
-
</Table.Head>
|
|
28
|
-
<Table.Body>
|
|
29
|
-
<Table.Row>
|
|
30
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
31
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
32
|
-
</Table.Row>
|
|
33
|
-
</Table.Body>
|
|
34
|
-
</Table>
|
|
35
|
-
</Example.Item>
|
|
36
|
-
<Example.Item title="colspan: 2 for col 2, rowspan: 2 for cell 3">
|
|
37
|
-
<Table>
|
|
38
|
-
<Table.Row>
|
|
39
|
-
<Table.Heading>Column 1</Table.Heading>
|
|
40
|
-
<Table.Heading colSpan={2}>Column 2</Table.Heading>
|
|
41
|
-
</Table.Row>
|
|
42
|
-
<Table.Row>
|
|
43
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
44
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
45
|
-
<Table.Cell rowSpan={2}>Cell 3</Table.Cell>
|
|
46
|
-
</Table.Row>
|
|
47
|
-
<Table.Row>
|
|
48
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
49
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
50
|
-
</Table.Row>
|
|
51
|
-
</Table>
|
|
52
|
-
</Example.Item>
|
|
53
|
-
<Example.Item title="align: center for heading 1, align: end for heading 2">
|
|
54
|
-
<Table>
|
|
55
|
-
<Table.Row>
|
|
56
|
-
<Table.Heading align="center">Column 1</Table.Heading>
|
|
57
|
-
<Table.Heading align="end">Column 2</Table.Heading>
|
|
58
|
-
</Table.Row>
|
|
59
|
-
<Table.Row>
|
|
60
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
61
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
62
|
-
</Table.Row>
|
|
63
|
-
</Table>
|
|
64
|
-
</Example.Item>
|
|
65
|
-
<Example.Item title="valign: center for cell 2, valign: end for cell 3">
|
|
66
|
-
<Table>
|
|
67
|
-
<Table.Row>
|
|
68
|
-
<Table.Heading>Column 1</Table.Heading>
|
|
69
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
70
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
71
|
-
</Table.Row>
|
|
72
|
-
<Table.Row>
|
|
73
|
-
<Table.Cell>
|
|
74
|
-
<View height={15} backgroundColor="neutral-faded"/>
|
|
75
|
-
</Table.Cell>
|
|
76
|
-
<Table.Cell verticalAlign="center">Cell 2</Table.Cell>
|
|
77
|
-
<Table.Cell verticalAlign="end">Cell 3</Table.Cell>
|
|
78
|
-
</Table.Row>
|
|
79
|
-
</Table>
|
|
80
|
-
</Example.Item>
|
|
81
|
-
<Example.Item title="width: 40%, minWidth: 200px for col 1">
|
|
82
|
-
<Table>
|
|
83
|
-
<Table.Row>
|
|
84
|
-
<Table.Heading width="40%" minWidth="200px">
|
|
85
|
-
Column 1
|
|
86
|
-
</Table.Heading>
|
|
87
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
88
|
-
</Table.Row>
|
|
89
|
-
<Table.Row>
|
|
90
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
91
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
92
|
-
</Table.Row>
|
|
93
|
-
</Table>
|
|
94
|
-
</Example.Item>
|
|
95
|
-
</Example>),
|
|
96
|
-
};
|
|
97
|
-
export const border = {
|
|
98
|
-
name: "border",
|
|
99
|
-
render: () => (<Example>
|
|
100
|
-
<Example.Item title="border: true">
|
|
101
|
-
<Table border>
|
|
102
|
-
<Table.Row>
|
|
103
|
-
<Table.Heading>Column 1</Table.Heading>
|
|
104
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
105
|
-
</Table.Row>
|
|
106
|
-
<Table.Row>
|
|
107
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
108
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
109
|
-
</Table.Row>
|
|
110
|
-
</Table>
|
|
111
|
-
</Example.Item>
|
|
112
|
-
<Example.Item title="columnBorder: true">
|
|
113
|
-
<Table columnBorder>
|
|
114
|
-
<Table.Row>
|
|
115
|
-
<Table.Heading>Column 1</Table.Heading>
|
|
116
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
117
|
-
</Table.Row>
|
|
118
|
-
<Table.Row>
|
|
119
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
120
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
121
|
-
</Table.Row>
|
|
122
|
-
</Table>
|
|
123
|
-
</Example.Item>
|
|
124
|
-
<Example.Item title="columnBorder: true, border: true">
|
|
125
|
-
<Table columnBorder border>
|
|
126
|
-
<Table.Row>
|
|
127
|
-
<Table.Heading>Column 1</Table.Heading>
|
|
128
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
129
|
-
</Table.Row>
|
|
130
|
-
<Table.Row>
|
|
131
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
132
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
133
|
-
</Table.Row>
|
|
134
|
-
</Table>
|
|
135
|
-
</Example.Item>
|
|
136
|
-
</Example>),
|
|
137
|
-
};
|
|
138
|
-
export const rows = {
|
|
139
|
-
name: "rows",
|
|
140
|
-
render: () => (<Example>
|
|
141
|
-
<Example.Item title="highlighted for row 2">
|
|
142
|
-
<Table>
|
|
143
|
-
<Table.Row>
|
|
144
|
-
<Table.Heading>Column 1</Table.Heading>
|
|
145
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
146
|
-
</Table.Row>
|
|
147
|
-
<Table.Row highlighted>
|
|
148
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
149
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
150
|
-
</Table.Row>
|
|
151
|
-
</Table>
|
|
152
|
-
</Example.Item>
|
|
153
|
-
<Example.Item title="clickable row 2, focus ring">
|
|
154
|
-
<Table>
|
|
155
|
-
<Table.Row>
|
|
156
|
-
<Table.Heading>Column 1</Table.Heading>
|
|
157
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
158
|
-
</Table.Row>
|
|
159
|
-
<Table.Row onClick={() => { }}>
|
|
160
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
161
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
162
|
-
</Table.Row>
|
|
163
|
-
</Table>
|
|
164
|
-
</Example.Item>
|
|
165
|
-
</Example>),
|
|
166
|
-
};
|
|
167
|
-
export const render = {
|
|
168
|
-
name: "rendering",
|
|
169
|
-
render: () => (<Table>
|
|
170
|
-
<Table.Head>
|
|
171
|
-
<Table.Row>
|
|
172
|
-
<Table.Heading>Heading</Table.Heading>
|
|
173
|
-
<Table.Heading>Heading</Table.Heading>
|
|
174
|
-
</Table.Row>
|
|
175
|
-
</Table.Head>
|
|
176
|
-
<Table.Body>
|
|
177
|
-
<Table.Row>
|
|
178
|
-
<Table.Cell>Content</Table.Cell>
|
|
179
|
-
<Table.Cell>Content</Table.Cell>
|
|
180
|
-
</Table.Row>
|
|
181
|
-
</Table.Body>
|
|
182
|
-
</Table>),
|
|
183
|
-
play: async ({ canvas }) => {
|
|
184
|
-
const body = canvas.getAllByRole("rowgroup");
|
|
185
|
-
const rows = canvas.getAllByRole("row");
|
|
186
|
-
const headings = canvas.getAllByRole("columnheader");
|
|
187
|
-
const cells = canvas.getAllByRole("cell");
|
|
188
|
-
expect(body).toHaveLength(2);
|
|
189
|
-
expect(rows).toHaveLength(2);
|
|
190
|
-
expect(headings).toHaveLength(2);
|
|
191
|
-
expect(cells).toHaveLength(2);
|
|
192
|
-
expect(canvas.getAllByText("Heading")).toHaveLength(2);
|
|
193
|
-
expect(canvas.getAllByText("Content")).toHaveLength(2);
|
|
194
|
-
},
|
|
195
|
-
};
|
|
196
|
-
export const tbody = {
|
|
197
|
-
name: "tbody rendering",
|
|
198
|
-
render: () => (<Table>
|
|
199
|
-
<Table.Row>
|
|
200
|
-
<Table.Heading>Heading</Table.Heading>
|
|
201
|
-
<Table.Heading>Heading</Table.Heading>
|
|
202
|
-
</Table.Row>
|
|
203
|
-
</Table>),
|
|
204
|
-
play: async ({ canvas }) => {
|
|
205
|
-
const body = canvas.getByRole("rowgroup");
|
|
206
|
-
expect(body).toBeInTheDocument();
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
export const tabIndex = {
|
|
210
|
-
name: "adds tabIndex for clickable rows",
|
|
211
|
-
render: () => (<Table>
|
|
212
|
-
<Table.Row>
|
|
213
|
-
<Table.Cell />
|
|
214
|
-
</Table.Row>
|
|
215
|
-
<Table.Row onClick={() => { }}>
|
|
216
|
-
<Table.Cell />
|
|
217
|
-
</Table.Row>
|
|
218
|
-
<Table.Row attributes={{ onClick: () => { } }}>
|
|
219
|
-
<Table.Cell />
|
|
220
|
-
</Table.Row>
|
|
221
|
-
</Table>),
|
|
222
|
-
play: async ({ canvas }) => {
|
|
223
|
-
const elRows = canvas.getAllByRole("row");
|
|
224
|
-
expect(elRows[0]).not.toHaveAttribute("tabIndex");
|
|
225
|
-
expect(elRows[1]).toHaveAttribute("tabIndex", "0");
|
|
226
|
-
expect(elRows[2]).toHaveAttribute("tabIndex", "0");
|
|
227
|
-
},
|
|
228
|
-
};
|
|
229
|
-
export const className = {
|
|
230
|
-
name: "className, attributes",
|
|
231
|
-
render: () => (<div data-testid="root">
|
|
232
|
-
<Table className="test-classname" attributes={{ id: "test-id" }}>
|
|
233
|
-
<Table.Row attributes={{ id: "test-row-id" }}>
|
|
234
|
-
<Table.Cell attributes={{ id: "test-cell-id" }}></Table.Cell>
|
|
235
|
-
</Table.Row>
|
|
236
|
-
</Table>
|
|
237
|
-
</div>),
|
|
238
|
-
play: async ({ canvas }) => {
|
|
239
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
240
|
-
const row = canvas.getByRole("row");
|
|
241
|
-
const cell = canvas.getByRole("cell");
|
|
242
|
-
expect(root).toHaveClass("test-classname");
|
|
243
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
244
|
-
expect(row).toHaveAttribute("id", "test-row-id");
|
|
245
|
-
expect(cell).toHaveAttribute("id", "test-cell-id");
|
|
246
|
-
},
|
|
247
|
-
};
|
|
248
|
-
export const edgeCases = {
|
|
249
|
-
name: "test: edge cases",
|
|
250
|
-
render: () => (<Example>
|
|
251
|
-
<Example.Item title="scroll fade">
|
|
252
|
-
<Table>
|
|
253
|
-
<Table.Row>
|
|
254
|
-
<Table.Heading width="500px">Column 1</Table.Heading>
|
|
255
|
-
<Table.Heading width="500px">Column 2</Table.Heading>
|
|
256
|
-
</Table.Row>
|
|
257
|
-
<Table.Row>
|
|
258
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
259
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
260
|
-
</Table.Row>
|
|
261
|
-
</Table>
|
|
262
|
-
</Example.Item>
|
|
263
|
-
<Example.Item title="card with highlighted heading">
|
|
264
|
-
<Card elevated padding={0}>
|
|
265
|
-
<Table>
|
|
266
|
-
<Table.Row highlighted>
|
|
267
|
-
<Table.Heading width="50%" minWidth="200px">
|
|
268
|
-
Column 1
|
|
269
|
-
</Table.Heading>
|
|
270
|
-
<Table.Heading colSpan={2} align="end">
|
|
271
|
-
Column 2
|
|
272
|
-
</Table.Heading>
|
|
273
|
-
</Table.Row>
|
|
274
|
-
<Table.Row>
|
|
275
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
276
|
-
<Table.Cell align="center">Cell 2</Table.Cell>
|
|
277
|
-
<Table.Cell align="end">Cell 3</Table.Cell>
|
|
278
|
-
</Table.Row>
|
|
279
|
-
<Table.Row>
|
|
280
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
281
|
-
<Table.Cell align="center">Cell 2</Table.Cell>
|
|
282
|
-
<Table.Cell align="end">Cell 3</Table.Cell>
|
|
283
|
-
</Table.Row>
|
|
284
|
-
</Table>
|
|
285
|
-
</Card>
|
|
286
|
-
</Example.Item>
|
|
287
|
-
<Example.Item title="width: auto, nowrap">
|
|
288
|
-
<Table>
|
|
289
|
-
<Table.Row>
|
|
290
|
-
<Table.Heading width="50%">Column 1</Table.Heading>
|
|
291
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
292
|
-
<Table.Heading>Column 3</Table.Heading>
|
|
293
|
-
<Table.Heading width="auto">Long heading title</Table.Heading>
|
|
294
|
-
</Table.Row>
|
|
295
|
-
<Table.Row>
|
|
296
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
297
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
298
|
-
<Table.Cell>Cell 3</Table.Cell>
|
|
299
|
-
<Table.Cell>Cell 4</Table.Cell>
|
|
300
|
-
</Table.Row>
|
|
301
|
-
</Table>
|
|
302
|
-
</Example.Item>
|
|
303
|
-
</Example>),
|
|
304
|
-
};
|
|
305
|
-
const SelectionDemo = () => {
|
|
306
|
-
const [value, setValue] = React.useState([]);
|
|
307
|
-
const rows = [
|
|
308
|
-
{
|
|
309
|
-
value: "1",
|
|
310
|
-
},
|
|
311
|
-
{ value: "2" },
|
|
312
|
-
];
|
|
313
|
-
const allSelected = value.length === rows.length;
|
|
314
|
-
return (<Table>
|
|
315
|
-
<Table.Row>
|
|
316
|
-
<Table.Heading width="auto">
|
|
317
|
-
<Checkbox inputAttributes={{ "aria-label": "Select all" }} name="hey" checked={allSelected} indeterminate={!!value.length && value.length < rows.length} onChange={() => {
|
|
318
|
-
setValue(allSelected ? [] : rows.map((row) => row.value));
|
|
319
|
-
}}/>
|
|
320
|
-
</Table.Heading>
|
|
321
|
-
<Table.Heading>Column 1</Table.Heading>
|
|
322
|
-
<Table.Heading>Column 2</Table.Heading>
|
|
323
|
-
</Table.Row>
|
|
324
|
-
{rows.map((row) => (<Table.Row key={row.value} highlighted={value.includes(row.value)}>
|
|
325
|
-
<Table.Cell>
|
|
326
|
-
<Checkbox name="hey" value={row.value} inputAttributes={{ "aria-label": "Select the row" }} checked={value.includes(row.value)} onChange={(args) => {
|
|
327
|
-
setValue((prev) => {
|
|
328
|
-
if (!args.value)
|
|
329
|
-
return prev;
|
|
330
|
-
if (args.checked)
|
|
331
|
-
return [...prev, args.value];
|
|
332
|
-
return prev.filter((item) => item !== args.value);
|
|
333
|
-
});
|
|
334
|
-
}}/>
|
|
335
|
-
</Table.Cell>
|
|
336
|
-
<Table.Cell>Cell 1</Table.Cell>
|
|
337
|
-
<Table.Cell>Cell 2</Table.Cell>
|
|
338
|
-
</Table.Row>))}
|
|
339
|
-
</Table>);
|
|
340
|
-
};
|
|
341
|
-
export const examples = {
|
|
342
|
-
name: "test: selectable",
|
|
343
|
-
render: () => (<Example>
|
|
344
|
-
<Example.Item title="selectable">
|
|
345
|
-
<SelectionDemo />
|
|
346
|
-
</Example.Item>
|
|
347
|
-
</Example>),
|
|
348
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
3
|
-
import { fn } from "storybook/test";
|
|
4
|
-
declare const _default: {
|
|
5
|
-
title: string;
|
|
6
|
-
component: React.FC<import("./..").TabsProps> & {
|
|
7
|
-
Item: React.ForwardRefExoticComponent<import("./..").TabsItemProps & React.RefAttributes<import("../../Actionable").ActionableRef>>;
|
|
8
|
-
List: React.FC<import("../Tabs.types").ListProps>;
|
|
9
|
-
Panel: React.FC<import("../Tabs.types").PanelProps>;
|
|
10
|
-
};
|
|
11
|
-
parameters: {
|
|
12
|
-
iframe: {
|
|
13
|
-
url: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export default _default;
|
|
18
|
-
export declare const base: StoryObj;
|
|
19
|
-
export declare const variant: {
|
|
20
|
-
name: string;
|
|
21
|
-
render: () => React.JSX.Element;
|
|
22
|
-
};
|
|
23
|
-
export declare const size: {
|
|
24
|
-
name: string;
|
|
25
|
-
render: () => React.JSX.Element;
|
|
26
|
-
};
|
|
27
|
-
export declare const direction: {
|
|
28
|
-
name: string;
|
|
29
|
-
render: () => React.JSX.Element;
|
|
30
|
-
};
|
|
31
|
-
export declare const icon: {
|
|
32
|
-
name: string;
|
|
33
|
-
render: () => React.JSX.Element;
|
|
34
|
-
};
|
|
35
|
-
export declare const equalWidth: {
|
|
36
|
-
name: string;
|
|
37
|
-
render: () => React.JSX.Element;
|
|
38
|
-
};
|
|
39
|
-
export declare const href: {
|
|
40
|
-
name: string;
|
|
41
|
-
render: () => React.JSX.Element;
|
|
42
|
-
};
|
|
43
|
-
export declare const disabled: StoryObj;
|
|
44
|
-
export declare const defaultValue: StoryObj<{
|
|
45
|
-
handleChange: ReturnType<typeof fn>;
|
|
46
|
-
}>;
|
|
47
|
-
export declare const value: StoryObj<{
|
|
48
|
-
handleChange: ReturnType<typeof fn>;
|
|
49
|
-
}>;
|
|
50
|
-
export declare const className: StoryObj;
|
|
51
|
-
export declare const testFocusableContent: {
|
|
52
|
-
name: string;
|
|
53
|
-
render: () => React.JSX.Element;
|
|
54
|
-
};
|
|
55
|
-
export declare const testComposition: {
|
|
56
|
-
name: string;
|
|
57
|
-
render: () => React.JSX.Element;
|
|
58
|
-
};
|
|
59
|
-
export declare const testEdgeCaseDom: {
|
|
60
|
-
name: string;
|
|
61
|
-
render: () => React.JSX.Element;
|
|
62
|
-
};
|