@recursica/adapter-mantine-v8 1.3.4 → 1.3.6
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/.storybook/commonArgTypes.ts +148 -0
- package/CHANGELOG.md +12 -0
- package/package.json +2 -2
- package/src/Introduction.stories.tsx +149 -0
- package/src/components/Accordion/Accordion.stories.tsx +189 -0
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +68 -0
- package/src/components/AutoComplete/AutoComplete.stories.tsx +336 -0
- package/src/components/Avatar/Avatar.stories.tsx +92 -0
- package/src/components/Badge/Badge.stories.tsx +78 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +114 -0
- package/src/components/Button/Button.stories.tsx +192 -0
- package/src/components/Card/Card.stories.tsx +76 -0
- package/src/components/Checkbox/CHECKBOX_IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +97 -0
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +139 -0
- package/src/components/Chip/Chip.stories.tsx +128 -0
- package/src/components/Container/Container.stories.tsx +118 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +158 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +252 -0
- package/src/components/FileInput/FileInput.stories.tsx +313 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +362 -0
- package/src/components/Flex/Flex.stories.tsx +128 -0
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +118 -0
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +129 -0
- package/src/components/Group/Group.stories.tsx +120 -0
- package/src/components/Heading/Heading.stories.tsx +112 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +172 -0
- package/src/components/Label/Label.stories.tsx +131 -0
- package/src/components/LayoutGrid/LayoutGrid.stories.tsx +61 -0
- package/src/components/Link/Link.stories.tsx +58 -0
- package/src/components/Loader/Loader.stories.tsx +123 -0
- package/src/components/Menu/Menu.stories.tsx +370 -0
- package/src/components/Modal/Modal.stories.tsx +105 -0
- package/src/components/NativeInputA11y.dom.test.tsx +60 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +96 -0
- package/src/components/Pagination/Pagination.stories.tsx +48 -0
- package/src/components/Panel/Panel.stories.tsx +219 -0
- package/src/components/Popover/Popover.stories.tsx +133 -0
- package/src/components/Radio/RADIO_IMPLEMENTATION_NOTES.md +5 -0
- package/src/components/Radio/Radio.stories.tsx +93 -0
- package/src/components/Radio/RadioGroup.stories.tsx +117 -0
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +163 -0
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +106 -0
- package/src/components/Slider/Slider.stories.tsx +282 -0
- package/src/components/Stack/Stack.stories.tsx +108 -0
- package/src/components/Stepper/Stepper.stories.tsx +148 -0
- package/src/components/Switch/SWITCH_IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Switch/Switch.stories.tsx +114 -0
- package/src/components/Switch/SwitchGroup.stories.tsx +132 -0
- package/src/components/Table/Table.stories.tsx +140 -0
- package/src/components/Tabs/Tabs.stories.tsx +154 -0
- package/src/components/Text/Text.stories.tsx +148 -0
- package/src/components/TextArea/TextArea.stories.tsx +94 -0
- package/src/components/TextField/TextField.stories.tsx +162 -0
- package/src/components/TimePicker/TimePicker.stories.tsx +141 -0
- package/src/components/Timeline/Timeline.stories.tsx +128 -0
- package/src/components/Toast/Toast.stories.tsx +67 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +165 -0
- package/src/components/TransferList/TransferList.stories.tsx +121 -0
- package/src/components/Tree/Tree.stories.tsx +104 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Toast } from "./Toast";
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
type ToastStoryArgs = Record<string, any>;
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "UI-Kit/Toast",
|
|
9
|
+
component: Toast,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component:
|
|
15
|
+
"The `Toast` component is a standalone visual component wrapping Mantine's `Notification`. Note that this component is visually decoupled from `@mantine/notifications` and is meant to be used when you need to render a static or manually-controlled notification panel. If you need dynamic notification popups, you should use `@mantine/notifications` and configure its provider to use our styles.",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
title: {
|
|
21
|
+
control: "text",
|
|
22
|
+
description: "Title displayed above the message body",
|
|
23
|
+
},
|
|
24
|
+
children: {
|
|
25
|
+
control: "text",
|
|
26
|
+
description: "Main notification message",
|
|
27
|
+
},
|
|
28
|
+
withCloseButton: {
|
|
29
|
+
control: "boolean",
|
|
30
|
+
description: "Whether the close button is visible",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
} satisfies Meta<typeof Toast>;
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
|
|
38
|
+
export const Default: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
title: "Update Available",
|
|
42
|
+
children:
|
|
43
|
+
"A new version of the application is available to download. Please restart your browser to apply the latest security patches and feature updates. If you ignore this message, the update will automatically install during your next session.",
|
|
44
|
+
withCloseButton: true,
|
|
45
|
+
},
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
|
+
render: ({ withLayer, layer, ...args }: ToastStoryArgs) => {
|
|
48
|
+
return <Toast {...args} />;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const WithIcon: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
variant: "default",
|
|
55
|
+
title: "Action Required",
|
|
56
|
+
children:
|
|
57
|
+
"You must complete your profile setup before accessing this feature.",
|
|
58
|
+
icon: "⚠️",
|
|
59
|
+
},
|
|
60
|
+
parameters: {
|
|
61
|
+
controls: { disable: true },
|
|
62
|
+
},
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
64
|
+
render: ({ withLayer, layer, ...args }: ToastStoryArgs) => {
|
|
65
|
+
return <Toast {...args} />;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Tooltip, type TooltipProps } from "./Tooltip";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Tooltip story axes:
|
|
7
|
+
* - position: tooltip alignment relative to target
|
|
8
|
+
* - withBeak: beak (arrow) indicator on the tooltip
|
|
9
|
+
* - openDelay / closeDelay: hover timing controls
|
|
10
|
+
* - multiline: text wrapping behavior
|
|
11
|
+
* - disabled: suppress the tooltip entirely
|
|
12
|
+
* - layer: tested via the global Layer decorator (withLayer/layer args)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
type TooltipStoryArgs = Record<string, any>;
|
|
17
|
+
|
|
18
|
+
const meta: Meta = {
|
|
19
|
+
title: "UI-Kit/Tooltip",
|
|
20
|
+
component: Tooltip,
|
|
21
|
+
tags: ["autodocs"],
|
|
22
|
+
argTypes: {
|
|
23
|
+
label: {
|
|
24
|
+
control: "text",
|
|
25
|
+
description: "Content displayed inside the tooltip.",
|
|
26
|
+
},
|
|
27
|
+
position: {
|
|
28
|
+
control: "select",
|
|
29
|
+
options: [
|
|
30
|
+
"bottom",
|
|
31
|
+
"bottom-start",
|
|
32
|
+
"bottom-end",
|
|
33
|
+
"top",
|
|
34
|
+
"top-start",
|
|
35
|
+
"top-end",
|
|
36
|
+
"left",
|
|
37
|
+
"left-start",
|
|
38
|
+
"left-end",
|
|
39
|
+
"right",
|
|
40
|
+
"right-start",
|
|
41
|
+
"right-end",
|
|
42
|
+
],
|
|
43
|
+
description: "The position of the tooltip relative to the target.",
|
|
44
|
+
},
|
|
45
|
+
withBeak: {
|
|
46
|
+
control: "boolean",
|
|
47
|
+
description:
|
|
48
|
+
"Whether to display a beak (arrow) pointing to the target. Recursica equivalent of Mantine's withArrow.",
|
|
49
|
+
},
|
|
50
|
+
offset: {
|
|
51
|
+
control: "number",
|
|
52
|
+
description: "Distance in px between the tooltip and the target element.",
|
|
53
|
+
},
|
|
54
|
+
openDelay: {
|
|
55
|
+
control: "number",
|
|
56
|
+
description: "Delay in ms before the tooltip opens on hover.",
|
|
57
|
+
},
|
|
58
|
+
closeDelay: {
|
|
59
|
+
control: "number",
|
|
60
|
+
description: "Delay in ms before the tooltip closes when hover ends.",
|
|
61
|
+
},
|
|
62
|
+
disabled: {
|
|
63
|
+
control: "boolean",
|
|
64
|
+
description: "If set, the tooltip will not be rendered.",
|
|
65
|
+
},
|
|
66
|
+
opened: {
|
|
67
|
+
control: "boolean",
|
|
68
|
+
description:
|
|
69
|
+
"Force the tooltip to stay open. Useful for inspecting styling.",
|
|
70
|
+
},
|
|
71
|
+
// Hide auto-detected HTML attributes that leak from ElementProps<'div'>
|
|
72
|
+
defaultChecked: { table: { disable: true } },
|
|
73
|
+
defaultValue: { table: { disable: true } },
|
|
74
|
+
suppressContentEditableWarning: { table: { disable: true } },
|
|
75
|
+
suppressHydrationWarning: { table: { disable: true } },
|
|
76
|
+
},
|
|
77
|
+
parameters: {
|
|
78
|
+
layout: "centered",
|
|
79
|
+
docs: {
|
|
80
|
+
description: {
|
|
81
|
+
component: `
|
|
82
|
+
The \`Tooltip\` component displays a floating label when the user hovers over or focuses a target element. It wraps Mantine's \`Tooltip\` while enforcing strict Recursica design token styling.
|
|
83
|
+
|
|
84
|
+
### API
|
|
85
|
+
|
|
86
|
+
Unlike \`HoverCard\`, Tooltip is a single component — content is passed via the \`label\` prop:
|
|
87
|
+
\`\`\`tsx
|
|
88
|
+
<Tooltip label="Helpful text" withBeak>
|
|
89
|
+
<Button>Hover me</Button>
|
|
90
|
+
</Tooltip>
|
|
91
|
+
\`\`\`
|
|
92
|
+
|
|
93
|
+
### Static Sub-Components
|
|
94
|
+
- \`Tooltip.Floating\` — A tooltip that follows the cursor position
|
|
95
|
+
- \`Tooltip.Group\` — Groups multiple tooltips to share hover delay
|
|
96
|
+
|
|
97
|
+
### Key Behaviors
|
|
98
|
+
- The beak (arrow) is shown by default (\`withBeak={true}\`)
|
|
99
|
+
- Supports \`openDelay\` and \`closeDelay\` for timing control
|
|
100
|
+
- Set \`multiline\` to allow text wrapping within max-width
|
|
101
|
+
`,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default meta;
|
|
108
|
+
|
|
109
|
+
type Story = StoryObj<TooltipStoryArgs>;
|
|
110
|
+
|
|
111
|
+
export const Default: Story = {
|
|
112
|
+
args: {
|
|
113
|
+
label: "This is a helpful tooltip",
|
|
114
|
+
position: "top",
|
|
115
|
+
withBeak: true,
|
|
116
|
+
offset: 5,
|
|
117
|
+
openDelay: 0,
|
|
118
|
+
closeDelay: 0,
|
|
119
|
+
disabled: false,
|
|
120
|
+
},
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
122
|
+
render: ({ withLayer, layer, ...args }: TooltipStoryArgs) => {
|
|
123
|
+
return (
|
|
124
|
+
<Tooltip {...(args as TooltipProps)}>
|
|
125
|
+
<Button variant="solid">Hover me</Button>
|
|
126
|
+
</Tooltip>
|
|
127
|
+
);
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const WithoutBeak: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
label: "Tooltip without a beak indicator",
|
|
134
|
+
position: "top",
|
|
135
|
+
withBeak: false,
|
|
136
|
+
offset: 5,
|
|
137
|
+
},
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
139
|
+
render: ({ withLayer, layer, ...args }: TooltipStoryArgs) => {
|
|
140
|
+
return (
|
|
141
|
+
<Tooltip {...(args as TooltipProps)}>
|
|
142
|
+
<Button variant="outline">Without Beak</Button>
|
|
143
|
+
</Tooltip>
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const LongContent: Story = {
|
|
149
|
+
args: {
|
|
150
|
+
label:
|
|
151
|
+
"This is a longer tooltip message that demonstrates how text wraps within the maximum width defined by the design system.",
|
|
152
|
+
position: "top",
|
|
153
|
+
withBeak: true,
|
|
154
|
+
opened: true,
|
|
155
|
+
offset: 5,
|
|
156
|
+
},
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
158
|
+
render: ({ withLayer, layer, ...args }: TooltipStoryArgs) => {
|
|
159
|
+
return (
|
|
160
|
+
<Tooltip {...(args as TooltipProps)}>
|
|
161
|
+
<Button variant="solid">Long Content</Button>
|
|
162
|
+
</Tooltip>
|
|
163
|
+
);
|
|
164
|
+
},
|
|
165
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { TransferList } from "./TransferList";
|
|
4
|
+
import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
|
|
5
|
+
|
|
6
|
+
type TransferListStoryProps = React.ComponentProps<typeof TransferList>;
|
|
7
|
+
|
|
8
|
+
const SAMPLE_DATA: TransferListStoryProps["defaultData"] = [
|
|
9
|
+
[
|
|
10
|
+
{ value: "alpha", label: "Alpha" },
|
|
11
|
+
{ value: "bravo", label: "Bravo" },
|
|
12
|
+
{ value: "charlie", label: "Charlie" },
|
|
13
|
+
{ value: "delta", label: "Delta" },
|
|
14
|
+
{ value: "echo", label: "Echo" },
|
|
15
|
+
],
|
|
16
|
+
[{ value: "foxtrot", label: "Foxtrot" }],
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const GROUPED_DATA: TransferListStoryProps["defaultData"] = [
|
|
20
|
+
[
|
|
21
|
+
{ value: "apple", label: "Apple", group: "Fruit" },
|
|
22
|
+
{ value: "banana", label: "Banana", group: "Fruit" },
|
|
23
|
+
{ value: "carrot", label: "Carrot", group: "Vegetable" },
|
|
24
|
+
{ value: "daikon", label: "Daikon", group: "Vegetable" },
|
|
25
|
+
{ value: "eagle", label: "Eagle" },
|
|
26
|
+
],
|
|
27
|
+
[],
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const meta: Meta<TransferListStoryProps> = {
|
|
31
|
+
title: "UI-Kit/TransferList",
|
|
32
|
+
component: TransferList,
|
|
33
|
+
tags: ["autodocs"],
|
|
34
|
+
parameters: {
|
|
35
|
+
docs: {
|
|
36
|
+
description: {
|
|
37
|
+
component:
|
|
38
|
+
"TransferList (dual listbox) lets users move items between two lists. Composes FormControlWrapper, TextField, Checkbox, CheckboxGroup, Badge, and Button.",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
args: {
|
|
43
|
+
label: "Assign users",
|
|
44
|
+
assistiveText: "Move users into the selected list.",
|
|
45
|
+
defaultData: SAMPLE_DATA,
|
|
46
|
+
disabled: false,
|
|
47
|
+
required: false,
|
|
48
|
+
},
|
|
49
|
+
argTypes: {
|
|
50
|
+
disabled: {
|
|
51
|
+
control: "boolean",
|
|
52
|
+
},
|
|
53
|
+
...formControlArgTypes,
|
|
54
|
+
sourceLabel: {
|
|
55
|
+
control: "text",
|
|
56
|
+
},
|
|
57
|
+
targetLabel: {
|
|
58
|
+
control: "text",
|
|
59
|
+
},
|
|
60
|
+
searchable: {
|
|
61
|
+
control: "boolean",
|
|
62
|
+
},
|
|
63
|
+
searchPlaceholder: {
|
|
64
|
+
control: "text",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default meta;
|
|
70
|
+
|
|
71
|
+
type Story = StoryObj<TransferListStoryProps>;
|
|
72
|
+
|
|
73
|
+
export const Default: Story = {};
|
|
74
|
+
|
|
75
|
+
export const Grouped: Story = {
|
|
76
|
+
args: {
|
|
77
|
+
label: "Assign ingredients",
|
|
78
|
+
defaultData: GROUPED_DATA,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const SideBySide: Story = {
|
|
83
|
+
args: {
|
|
84
|
+
formLayout: "side-by-side",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const NoSearch: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
label: "Assign users (no filtering)",
|
|
91
|
+
searchable: false,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const StaticError: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
error: "Select at least one user.",
|
|
98
|
+
defaultData: [[], SAMPLE_DATA![0]],
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const StaticDisabled: Story = {
|
|
103
|
+
args: {
|
|
104
|
+
disabled: true,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const Empty: Story = {
|
|
109
|
+
args: {
|
|
110
|
+
label: "Assign users",
|
|
111
|
+
defaultData: [[], []],
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const ReadOnly: Story = {
|
|
116
|
+
args: {
|
|
117
|
+
label: "Assigned users",
|
|
118
|
+
defaultData: [[], SAMPLE_DATA![0]],
|
|
119
|
+
readOnly: true,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Tree } from "./Tree";
|
|
3
|
+
import { Layer, type RecursicaTreeNode } from "@recursica/adapter-common";
|
|
4
|
+
|
|
5
|
+
const sampleData: RecursicaTreeNode[] = [
|
|
6
|
+
{
|
|
7
|
+
value: "documents",
|
|
8
|
+
label: "Documents",
|
|
9
|
+
children: [
|
|
10
|
+
{ value: "documents/resume.pdf", label: "resume.pdf" },
|
|
11
|
+
{ value: "documents/cover-letter.docx", label: "cover-letter.docx" },
|
|
12
|
+
{
|
|
13
|
+
value: "documents/taxes",
|
|
14
|
+
label: "Taxes",
|
|
15
|
+
children: [
|
|
16
|
+
{ value: "documents/taxes/2023.pdf", label: "2023.pdf" },
|
|
17
|
+
{ value: "documents/taxes/2024.pdf", label: "2024.pdf" },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: "photos",
|
|
24
|
+
label: "Photos",
|
|
25
|
+
children: [
|
|
26
|
+
{ value: "photos/vacation.jpg", label: "vacation.jpg" },
|
|
27
|
+
{ value: "photos/family.jpg", label: "family.jpg" },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
{ value: "readme.md", label: "readme.md" },
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const meta: Meta<typeof Tree> = {
|
|
34
|
+
title: "UI-Kit/Tree",
|
|
35
|
+
component: Tree,
|
|
36
|
+
tags: ["autodocs"],
|
|
37
|
+
parameters: {
|
|
38
|
+
docs: {
|
|
39
|
+
description: {
|
|
40
|
+
component: `
|
|
41
|
+
The \`Tree\` component renders hierarchical \`data\` as an expandable/selectable tree, wrapping \`@mantine/core\`'s \`Tree\` with a fully custom node renderer so every visual property (row box model, selected/unselected colors and typography, indent, item spacing) comes from Recursica's \`tree\` design tokens.
|
|
42
|
+
|
|
43
|
+
Each node needs a unique \`value\` and a \`label\`; a \`children\` array (even empty) makes a node expandable.
|
|
44
|
+
`,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default meta;
|
|
51
|
+
|
|
52
|
+
export const Default: StoryObj<typeof Tree> = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<Tree data={sampleData} initialExpandedValues={["documents"]} />
|
|
55
|
+
),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const AllExpanded: StoryObj<typeof Tree> = {
|
|
59
|
+
render: () => <Tree data={sampleData} initialExpandedValues="*" />,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const PreSelected: StoryObj<typeof Tree> = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<Tree
|
|
65
|
+
data={sampleData}
|
|
66
|
+
initialExpandedValues={["documents"]}
|
|
67
|
+
initialSelectedValues={["documents/resume.pdf"]}
|
|
68
|
+
/>
|
|
69
|
+
),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const MultipleSelection: StoryObj<typeof Tree> = {
|
|
73
|
+
render: () => (
|
|
74
|
+
<Tree
|
|
75
|
+
data={sampleData}
|
|
76
|
+
initialExpandedValues="*"
|
|
77
|
+
initialSelectedValues={["documents/resume.pdf", "photos/vacation.jpg"]}
|
|
78
|
+
multiple
|
|
79
|
+
/>
|
|
80
|
+
),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** Whole tree disabled, with a node pre-selected so the selected chip's styling under the
|
|
84
|
+
* disabled dimming can be checked alongside unselected rows. */
|
|
85
|
+
export const Disabled: StoryObj<typeof Tree> = {
|
|
86
|
+
render: () => (
|
|
87
|
+
<Tree
|
|
88
|
+
data={sampleData}
|
|
89
|
+
initialExpandedValues={["documents"]}
|
|
90
|
+
initialSelectedValues={["documents/resume.pdf"]}
|
|
91
|
+
disabled
|
|
92
|
+
/>
|
|
93
|
+
),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/** Demonstrates the component nested inside a non-default layer — the one case where an
|
|
97
|
+
* explicit `<Layer>` wrap belongs in a story (see COMPONENT_STORYBOOK_GUIDE.md §9). */
|
|
98
|
+
export const LayerOne: StoryObj<typeof Tree> = {
|
|
99
|
+
render: () => (
|
|
100
|
+
<Layer layer={1} style={{ padding: "24px" }}>
|
|
101
|
+
<Tree data={sampleData} initialExpandedValues={["documents"]} />
|
|
102
|
+
</Layer>
|
|
103
|
+
),
|
|
104
|
+
};
|