@recursica/adapter-mantine-v8 1.3.3 → 1.3.4
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 +8 -0
- package/docs/PHILOSOPHY.md +4 -0
- package/package.json +4 -8
- package/.storybook/commonArgTypes.ts +0 -148
- package/recursica_brand.json +0 -2610
- package/recursica_tokens.json +0 -769
- package/recursica_ui-kit.json +0 -9049
- package/recursica_variables_scoped.css +0 -6178
- package/src/Introduction.stories.tsx +0 -149
- package/src/components/Accordion/Accordion.stories.tsx +0 -189
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +0 -68
- package/src/components/AutoComplete/AutoComplete.stories.tsx +0 -336
- package/src/components/Avatar/Avatar.stories.tsx +0 -92
- package/src/components/Badge/Badge.stories.tsx +0 -78
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +0 -114
- package/src/components/Button/Button.stories.tsx +0 -192
- package/src/components/Card/Card.stories.tsx +0 -76
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -97
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +0 -139
- package/src/components/Chip/Chip.stories.tsx +0 -128
- package/src/components/Container/Container.stories.tsx +0 -118
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -158
- package/src/components/Dropdown/Dropdown.stories.tsx +0 -252
- package/src/components/FileInput/FileInput.stories.tsx +0 -313
- package/src/components/FileUpload/FileUpload.stories.tsx +0 -362
- package/src/components/Flex/Flex.stories.tsx +0 -128
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +0 -118
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +0 -129
- package/src/components/Group/Group.stories.tsx +0 -120
- package/src/components/Heading/Heading.stories.tsx +0 -112
- package/src/components/HoverCard/HoverCard.stories.tsx +0 -172
- package/src/components/Label/Label.stories.tsx +0 -131
- package/src/components/LayoutGrid/LayoutGrid.stories.tsx +0 -61
- package/src/components/Link/Link.stories.tsx +0 -58
- package/src/components/Loader/Loader.stories.tsx +0 -123
- package/src/components/Menu/Menu.stories.tsx +0 -370
- package/src/components/Modal/Modal.stories.tsx +0 -105
- package/src/components/NumberInput/NumberInput.stories.tsx +0 -96
- package/src/components/Pagination/Pagination.stories.tsx +0 -48
- package/src/components/Panel/Panel.stories.tsx +0 -219
- package/src/components/Popover/Popover.stories.tsx +0 -133
- package/src/components/Radio/Radio.stories.tsx +0 -93
- package/src/components/Radio/RadioGroup.stories.tsx +0 -117
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +0 -163
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +0 -106
- package/src/components/Slider/Slider.stories.tsx +0 -282
- package/src/components/Stack/Stack.stories.tsx +0 -108
- package/src/components/Stepper/Stepper.stories.tsx +0 -148
- package/src/components/Switch/Switch.stories.tsx +0 -114
- package/src/components/Switch/SwitchGroup.stories.tsx +0 -132
- package/src/components/Table/Table.stories.tsx +0 -140
- package/src/components/Tabs/Tabs.stories.tsx +0 -154
- package/src/components/Text/Text.stories.tsx +0 -148
- package/src/components/TextArea/TextArea.stories.tsx +0 -94
- package/src/components/TextField/TextField.stories.tsx +0 -162
- package/src/components/TimePicker/TimePicker.stories.tsx +0 -141
- package/src/components/Timeline/Timeline.stories.tsx +0 -128
- package/src/components/Toast/Toast.stories.tsx +0 -67
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -165
- package/src/components/TransferList/TransferList.stories.tsx +0 -121
- package/src/components/Tree/Tree.stories.tsx +0 -104
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { Stepper } from "./Stepper";
|
|
4
|
-
import { Button } from "../Button/Button";
|
|
5
|
-
import { Group } from "../Group/Group";
|
|
6
|
-
import { Flex } from "../Flex/Flex";
|
|
7
|
-
|
|
8
|
-
const meta: Meta<typeof Stepper> = {
|
|
9
|
-
title: "UI-Kit/Stepper",
|
|
10
|
-
component: Stepper,
|
|
11
|
-
tags: ["autodocs"],
|
|
12
|
-
parameters: {
|
|
13
|
-
layout: "centered",
|
|
14
|
-
docs: {
|
|
15
|
-
description: {
|
|
16
|
-
component: `
|
|
17
|
-
The \`Stepper\` component provides a visual progression interface strictly mapped to Recursica's UI-Kit.
|
|
18
|
-
This component wraps Mantine's \`Stepper\` and natively enforces Figma tokens for sizes, colors, gaps, and states (\`completed\`, \`current\`, \`upcoming\`).
|
|
19
|
-
|
|
20
|
-
### Layout & Orientation
|
|
21
|
-
Orientation dictates how the steps flow:
|
|
22
|
-
- **horizontal**: Steps render side-by-side.
|
|
23
|
-
- **vertical**: Steps stack vertically, mapping seamlessly to the vertical gap tokens.
|
|
24
|
-
`,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
argTypes: {
|
|
29
|
-
size: {
|
|
30
|
-
control: "radio",
|
|
31
|
-
options: ["small", "large"],
|
|
32
|
-
},
|
|
33
|
-
orientation: {
|
|
34
|
-
control: "radio",
|
|
35
|
-
options: ["horizontal", "vertical"],
|
|
36
|
-
},
|
|
37
|
-
defaultChecked: {
|
|
38
|
-
table: { disable: true },
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default meta;
|
|
44
|
-
type Story = StoryObj<typeof Stepper>;
|
|
45
|
-
|
|
46
|
-
const InteractiveStepper = (args: React.ComponentProps<typeof Stepper>) => {
|
|
47
|
-
const [active, setActive] = useState(1);
|
|
48
|
-
const nextStep = () =>
|
|
49
|
-
setActive((current) => (current < 3 ? current + 1 : current));
|
|
50
|
-
const prevStep = () =>
|
|
51
|
-
setActive((current) => (current > 0 ? current - 1 : current));
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<Flex direction="column" w={600}>
|
|
55
|
-
<Stepper {...args} active={active} onStepClick={setActive}>
|
|
56
|
-
<Stepper.Step
|
|
57
|
-
label="First step"
|
|
58
|
-
description="Create an account and set up your billing profile"
|
|
59
|
-
/>
|
|
60
|
-
<Stepper.Step
|
|
61
|
-
label="Second step"
|
|
62
|
-
description="Verify email and ensure all notification preferences are correct"
|
|
63
|
-
/>
|
|
64
|
-
<Stepper.Step label="Final step" description="Get full access" />
|
|
65
|
-
<Stepper.Completed>
|
|
66
|
-
Completed, click back button to get to previous step
|
|
67
|
-
</Stepper.Completed>
|
|
68
|
-
</Stepper>
|
|
69
|
-
|
|
70
|
-
<Group mt={24} justify="center" gap={8}>
|
|
71
|
-
<Button variant="outline" onClick={prevStep} disabled={active === 0}>
|
|
72
|
-
Previous step
|
|
73
|
-
</Button>
|
|
74
|
-
<Button variant="outline" onClick={nextStep} disabled={active === 3}>
|
|
75
|
-
Next step
|
|
76
|
-
</Button>
|
|
77
|
-
</Group>
|
|
78
|
-
</Flex>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const Default: Story = {
|
|
83
|
-
render: (args) => <InteractiveStepper {...args} />,
|
|
84
|
-
args: {
|
|
85
|
-
size: "large",
|
|
86
|
-
orientation: "horizontal",
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export const Small: Story = {
|
|
91
|
-
render: (args) => <InteractiveStepper {...args} />,
|
|
92
|
-
args: {
|
|
93
|
-
size: "small",
|
|
94
|
-
orientation: "horizontal",
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export const Vertical: Story = {
|
|
99
|
-
render: (args) => <InteractiveStepper {...args} />,
|
|
100
|
-
args: {
|
|
101
|
-
size: "large",
|
|
102
|
-
orientation: "vertical",
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const StressTestStepper = (args: React.ComponentProps<typeof Stepper>) => {
|
|
107
|
-
const [active, setActive] = useState(1);
|
|
108
|
-
const nextStep = () =>
|
|
109
|
-
setActive((current) => (current < 3 ? current + 1 : current));
|
|
110
|
-
const prevStep = () =>
|
|
111
|
-
setActive((current) => (current > 0 ? current - 1 : current));
|
|
112
|
-
|
|
113
|
-
return (
|
|
114
|
-
<Flex direction="column" w={600}>
|
|
115
|
-
<Stepper {...args} active={active} onStepClick={setActive}>
|
|
116
|
-
<Stepper.Step
|
|
117
|
-
label="This is an extremely long step title designed to test how the layout handles multiline text wrapping and constraints"
|
|
118
|
-
description="Create an account and set up your billing profile"
|
|
119
|
-
/>
|
|
120
|
-
<Stepper.Step
|
|
121
|
-
label="Second step"
|
|
122
|
-
description="Verify email and ensure all notification preferences are correct"
|
|
123
|
-
/>
|
|
124
|
-
<Stepper.Step label="Final step" />
|
|
125
|
-
<Stepper.Completed>
|
|
126
|
-
Completed, click back button to get to previous step
|
|
127
|
-
</Stepper.Completed>
|
|
128
|
-
</Stepper>
|
|
129
|
-
|
|
130
|
-
<Group mt={24} justify="center" gap={8}>
|
|
131
|
-
<Button variant="outline" onClick={prevStep} disabled={active === 0}>
|
|
132
|
-
Previous step
|
|
133
|
-
</Button>
|
|
134
|
-
<Button variant="outline" onClick={nextStep} disabled={active === 3}>
|
|
135
|
-
Next step
|
|
136
|
-
</Button>
|
|
137
|
-
</Group>
|
|
138
|
-
</Flex>
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export const LayoutStressTest: Story = {
|
|
143
|
-
render: (args) => <StressTestStepper {...args} />,
|
|
144
|
-
args: {
|
|
145
|
-
size: "large",
|
|
146
|
-
orientation: "horizontal",
|
|
147
|
-
},
|
|
148
|
-
};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Switch } from "./Switch";
|
|
3
|
-
import { Stack } from "../Stack/Stack";
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Switch> = {
|
|
6
|
-
title: "UI-Kit/Switch",
|
|
7
|
-
component: Switch,
|
|
8
|
-
tags: ["autodocs"],
|
|
9
|
-
parameters: {
|
|
10
|
-
docs: {
|
|
11
|
-
description: {
|
|
12
|
-
component: `
|
|
13
|
-
The \`Switch\` component is an atomic form primitive representing boolean states, natively aligned to the Recursica design system.
|
|
14
|
-
|
|
15
|
-
> [!IMPORTANT]
|
|
16
|
-
> Unlike \`Checkbox\`, the \`Switch\` is typically used for standalone settings toggles. It fully supports the universal \`ReadOnlyField\` boundaries when passed the \`readOnly\` attribute.
|
|
17
|
-
|
|
18
|
-
### Usage
|
|
19
|
-
To render a standard switch:
|
|
20
|
-
\`\`\`tsx
|
|
21
|
-
<Switch label="Enable Notifications" defaultChecked />
|
|
22
|
-
\`\`\`
|
|
23
|
-
`,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
argTypes: {
|
|
28
|
-
checked: {
|
|
29
|
-
control: "boolean",
|
|
30
|
-
},
|
|
31
|
-
disabled: {
|
|
32
|
-
control: "boolean",
|
|
33
|
-
},
|
|
34
|
-
required: {
|
|
35
|
-
control: "boolean",
|
|
36
|
-
},
|
|
37
|
-
error: {
|
|
38
|
-
control: "boolean",
|
|
39
|
-
},
|
|
40
|
-
defaultChecked: {
|
|
41
|
-
control: "boolean",
|
|
42
|
-
},
|
|
43
|
-
readOnly: {
|
|
44
|
-
control: "boolean",
|
|
45
|
-
description:
|
|
46
|
-
"Toggles structural read-only data presentation bypassing interaction boundaries completely.",
|
|
47
|
-
},
|
|
48
|
-
controlMaxWidth: { table: { disable: true } },
|
|
49
|
-
controlMinWidth: { table: { disable: true } },
|
|
50
|
-
emptyValueComponent: { table: { disable: true } },
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default meta;
|
|
55
|
-
|
|
56
|
-
type Story = StoryObj<typeof Switch>;
|
|
57
|
-
|
|
58
|
-
export const Default: Story = {
|
|
59
|
-
args: {
|
|
60
|
-
disabled: false,
|
|
61
|
-
label: "Standard Switch",
|
|
62
|
-
},
|
|
63
|
-
// We explicitly destructure global Storybook injected arguments so they do not leak into the DOM natively.
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
65
|
-
render: ({ withLayer, layer, ...args }: any) => <Switch {...args} />,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const SideBySideLayout: Story = {
|
|
69
|
-
args: {
|
|
70
|
-
label: "Opt-in form alignment",
|
|
71
|
-
formLayout: "side-by-side",
|
|
72
|
-
},
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
74
|
-
render: ({ withLayer, layer, ...args }: any) => <Switch {...args} />,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const StaticVariations: Story = {
|
|
78
|
-
args: {},
|
|
79
|
-
render: () => (
|
|
80
|
-
<Stack gap="xl">
|
|
81
|
-
<Switch label="Default Unchecked State" />
|
|
82
|
-
<Switch label="Checked State" defaultChecked />
|
|
83
|
-
<Switch label="Disabled Unchecked" disabled />
|
|
84
|
-
<Switch label="Disabled Checked" defaultChecked disabled />
|
|
85
|
-
</Stack>
|
|
86
|
-
),
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const ReadOnly: Story = {
|
|
90
|
-
args: {
|
|
91
|
-
...Default.args,
|
|
92
|
-
readOnly: true,
|
|
93
|
-
},
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
95
|
-
render: ({ withLayer, layer, ...args }: any) => <Switch {...args} />,
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export const CustomReadOnly: Story = {
|
|
99
|
-
args: {
|
|
100
|
-
...Default.args,
|
|
101
|
-
readOnly: true,
|
|
102
|
-
},
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
104
|
-
render: ({ withLayer, layer, ...args }: any) => (
|
|
105
|
-
<Switch
|
|
106
|
-
{...args}
|
|
107
|
-
readOnlyComponent={({ checked, label }) => (
|
|
108
|
-
<span style={{ fontWeight: "bold", color: checked ? "green" : "red" }}>
|
|
109
|
-
{label} {checked ? "ENABLED" : "DISABLED"}
|
|
110
|
-
</span>
|
|
111
|
-
)}
|
|
112
|
-
/>
|
|
113
|
-
),
|
|
114
|
-
};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Switch } from "./Switch";
|
|
3
|
-
import { SwitchGroup } from "./SwitchGroup";
|
|
4
|
-
import { useState } from "react";
|
|
5
|
-
import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof SwitchGroup> = {
|
|
8
|
-
title: "UI-Kit/SwitchGroup",
|
|
9
|
-
component: SwitchGroup,
|
|
10
|
-
tags: ["autodocs"],
|
|
11
|
-
parameters: {
|
|
12
|
-
docs: {
|
|
13
|
-
description: {
|
|
14
|
-
component: `
|
|
15
|
-
The \`SwitchGroup\` component is the mandatory organizational wrapper for orchestrating \`Switch\` primitives into macro form layouts. It inherently leverages the \`FormControlWrapper\`, granting native access to structural alignments, assistive descriptions, and strict flex arrays.
|
|
16
|
-
|
|
17
|
-
### Supported Layout Vectors
|
|
18
|
-
- **\`formLayout="stacked"\`**: Top-to-bottom layout cascading the Label bounding box down vertically into a standard stacked switch array.
|
|
19
|
-
- **\`formLayout="side-by-side"\`**: Flow architecture pulling the grouping Label dynamically to the left while structurally organizing the internal switches cleanly alongside it horizontally.
|
|
20
|
-
|
|
21
|
-
> [!IMPORTANT]
|
|
22
|
-
> If you require a solitary \`Switch\` field to natively accept an overarching form label, assistive text, or align with other side-by-side components in a form column, you must wrap it inside a \`Switch.Group\` to trigger the \`FormControlWrapper\` mapping.
|
|
23
|
-
`,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
argTypes: {
|
|
28
|
-
...formControlArgTypes,
|
|
29
|
-
readOnly: {
|
|
30
|
-
control: "boolean",
|
|
31
|
-
description:
|
|
32
|
-
"Passes read-only lock natively down mapping inner switches into explicitly disabled states.",
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default meta;
|
|
38
|
-
|
|
39
|
-
type Story = StoryObj<typeof SwitchGroup>;
|
|
40
|
-
|
|
41
|
-
export const Default: Story = {
|
|
42
|
-
args: {
|
|
43
|
-
formLayout: "stacked",
|
|
44
|
-
label: "Standard Group",
|
|
45
|
-
},
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
47
|
-
render: function StoryRender({ withLayer, layer, ...args }: any) {
|
|
48
|
-
const [value, setValue] = useState<string[]>([]);
|
|
49
|
-
return (
|
|
50
|
-
<SwitchGroup {...args} value={value} onChange={setValue}>
|
|
51
|
-
<Switch value="1" label="Option 1" />
|
|
52
|
-
<Switch value="2" label="Option 2" />
|
|
53
|
-
</SwitchGroup>
|
|
54
|
-
);
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const StackedLayout: Story = {
|
|
59
|
-
args: {
|
|
60
|
-
formLayout: "stacked",
|
|
61
|
-
label: "Notification Settings",
|
|
62
|
-
description: "Manage your preferences.",
|
|
63
|
-
assistiveText: "We recommend turning these on.",
|
|
64
|
-
error: "",
|
|
65
|
-
required: true,
|
|
66
|
-
},
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
68
|
-
render: function StoryRender({ withLayer, layer, ...args }: any) {
|
|
69
|
-
const [value, setValue] = useState<string[]>(["email"]);
|
|
70
|
-
return (
|
|
71
|
-
<SwitchGroup {...args} value={value} onChange={setValue}>
|
|
72
|
-
<Switch value="email" label="Email Alerts" />
|
|
73
|
-
<Switch value="push" label="Push Notifications" />
|
|
74
|
-
<Switch value="sms" label="SMS Messages" />
|
|
75
|
-
</SwitchGroup>
|
|
76
|
-
);
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const SideBySideLayout: Story = {
|
|
81
|
-
args: {
|
|
82
|
-
...StackedLayout.args,
|
|
83
|
-
formLayout: "side-by-side",
|
|
84
|
-
labelSize: "default",
|
|
85
|
-
labelAlignment: "left",
|
|
86
|
-
},
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
88
|
-
render: function StoryRender({ withLayer, layer, ...args }: any) {
|
|
89
|
-
const [value, setValue] = useState<string[]>([]);
|
|
90
|
-
return (
|
|
91
|
-
<SwitchGroup {...args} value={value} onChange={setValue}>
|
|
92
|
-
<Switch value="weekly" label="Weekly Digest" />
|
|
93
|
-
<Switch value="marketing" label="Marketing Emails" />
|
|
94
|
-
</SwitchGroup>
|
|
95
|
-
);
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const SolitaryFormControl: Story = {
|
|
100
|
-
args: {
|
|
101
|
-
formLayout: "side-by-side",
|
|
102
|
-
label: "Enable Backups",
|
|
103
|
-
description: "Automatically back up your data nightly.",
|
|
104
|
-
},
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
106
|
-
render: function StoryRender({ withLayer, layer, ...args }: any) {
|
|
107
|
-
const [value, setValue] = useState<string[]>(["auto"]);
|
|
108
|
-
return (
|
|
109
|
-
<SwitchGroup {...args} value={value} onChange={setValue}>
|
|
110
|
-
<Switch value="auto" label="Auto-backup" />
|
|
111
|
-
</SwitchGroup>
|
|
112
|
-
);
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export const ReadOnly: Story = {
|
|
117
|
-
args: {
|
|
118
|
-
...StackedLayout.args,
|
|
119
|
-
readOnly: true,
|
|
120
|
-
},
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
122
|
-
render: function StoryRender({ withLayer, layer, ...args }: any) {
|
|
123
|
-
const [value, setValue] = useState<string[]>(["email", "sms"]);
|
|
124
|
-
return (
|
|
125
|
-
<SwitchGroup {...args} value={value} onChange={setValue}>
|
|
126
|
-
<Switch value="email" label="Email Alerts" />
|
|
127
|
-
<Switch value="push" label="Push Notifications" />
|
|
128
|
-
<Switch value="sms" label="SMS Messages" />
|
|
129
|
-
</SwitchGroup>
|
|
130
|
-
);
|
|
131
|
-
},
|
|
132
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Table } from "./Table";
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Table> = {
|
|
5
|
-
title: "UI-Kit/Table",
|
|
6
|
-
component: Table,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
|
|
12
|
-
type Story = StoryObj<typeof Table>;
|
|
13
|
-
|
|
14
|
-
const elements = [
|
|
15
|
-
{ position: 6, mass: 12.011, symbol: "C", name: "Carbon" },
|
|
16
|
-
{ position: 7, mass: 14.007, symbol: "N", name: "Nitrogen" },
|
|
17
|
-
{ position: 8, mass: 15.999, symbol: "O", name: "Oxygen" },
|
|
18
|
-
{ position: 9, mass: 18.998, symbol: "F", name: "Fluorine" },
|
|
19
|
-
{ position: 10, mass: 20.18, symbol: "Ne", name: "Neon" },
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
export const Default: Story = {
|
|
23
|
-
render: () => {
|
|
24
|
-
const rows = elements.map((element) => (
|
|
25
|
-
<Table.Tr key={element.name}>
|
|
26
|
-
<Table.Td>{element.position}</Table.Td>
|
|
27
|
-
<Table.Td>{element.name}</Table.Td>
|
|
28
|
-
<Table.Td>{element.symbol}</Table.Td>
|
|
29
|
-
<Table.Td>{element.mass}</Table.Td>
|
|
30
|
-
</Table.Tr>
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Table>
|
|
35
|
-
<Table.Thead>
|
|
36
|
-
<Table.Tr>
|
|
37
|
-
<Table.Th>Element position</Table.Th>
|
|
38
|
-
<Table.Th>Element name</Table.Th>
|
|
39
|
-
<Table.Th>Symbol</Table.Th>
|
|
40
|
-
<Table.Th>Atomic mass</Table.Th>
|
|
41
|
-
</Table.Tr>
|
|
42
|
-
</Table.Thead>
|
|
43
|
-
<Table.Tbody>{rows}</Table.Tbody>
|
|
44
|
-
</Table>
|
|
45
|
-
);
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const SortedColumn: Story = {
|
|
50
|
-
render: () => {
|
|
51
|
-
const sorted = [...elements].sort((a, b) => a.mass - b.mass);
|
|
52
|
-
const rows = sorted.map((element) => (
|
|
53
|
-
<Table.Tr key={element.name}>
|
|
54
|
-
<Table.Td>{element.position}</Table.Td>
|
|
55
|
-
<Table.Td>{element.name}</Table.Td>
|
|
56
|
-
<Table.Td>{element.symbol}</Table.Td>
|
|
57
|
-
<Table.Td>{element.mass}</Table.Td>
|
|
58
|
-
</Table.Tr>
|
|
59
|
-
));
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<Table>
|
|
63
|
-
<Table.Thead>
|
|
64
|
-
<Table.Tr>
|
|
65
|
-
<Table.Th>Element position</Table.Th>
|
|
66
|
-
<Table.Th>Element name</Table.Th>
|
|
67
|
-
<Table.Th>Symbol</Table.Th>
|
|
68
|
-
<Table.Th sorted="asc">Atomic mass</Table.Th>
|
|
69
|
-
</Table.Tr>
|
|
70
|
-
</Table.Thead>
|
|
71
|
-
<Table.Tbody>{rows}</Table.Tbody>
|
|
72
|
-
</Table>
|
|
73
|
-
);
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const SelectedAndDisabledRows: Story = {
|
|
78
|
-
render: () => (
|
|
79
|
-
<Table>
|
|
80
|
-
<Table.Thead>
|
|
81
|
-
<Table.Tr>
|
|
82
|
-
<Table.Th>Element position</Table.Th>
|
|
83
|
-
<Table.Th>Element name</Table.Th>
|
|
84
|
-
<Table.Th>Symbol</Table.Th>
|
|
85
|
-
<Table.Th>Atomic mass</Table.Th>
|
|
86
|
-
</Table.Tr>
|
|
87
|
-
</Table.Thead>
|
|
88
|
-
<Table.Tbody>
|
|
89
|
-
{elements.map((element, index) => (
|
|
90
|
-
<Table.Tr
|
|
91
|
-
key={element.name}
|
|
92
|
-
selected={index === 0}
|
|
93
|
-
disabled={index === elements.length - 1}
|
|
94
|
-
>
|
|
95
|
-
<Table.Td>{element.position}</Table.Td>
|
|
96
|
-
<Table.Td>{element.name}</Table.Td>
|
|
97
|
-
<Table.Td>{element.symbol}</Table.Td>
|
|
98
|
-
<Table.Td>{element.mass}</Table.Td>
|
|
99
|
-
</Table.Tr>
|
|
100
|
-
))}
|
|
101
|
-
</Table.Tbody>
|
|
102
|
-
</Table>
|
|
103
|
-
),
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export const CurrencyColumnWithFooter: Story = {
|
|
107
|
-
render: () => {
|
|
108
|
-
const prices = [
|
|
109
|
-
{ item: "Widget", price: 19.99 },
|
|
110
|
-
{ item: "Gadget", price: 49.5 },
|
|
111
|
-
{ item: "Gizmo", price: 9.25 },
|
|
112
|
-
];
|
|
113
|
-
const total = prices.reduce((sum, row) => sum + row.price, 0);
|
|
114
|
-
|
|
115
|
-
return (
|
|
116
|
-
<Table>
|
|
117
|
-
<Table.Thead>
|
|
118
|
-
<Table.Tr>
|
|
119
|
-
<Table.Th>Item</Table.Th>
|
|
120
|
-
<Table.Th variant="currency">Price</Table.Th>
|
|
121
|
-
</Table.Tr>
|
|
122
|
-
</Table.Thead>
|
|
123
|
-
<Table.Tbody>
|
|
124
|
-
{prices.map((row) => (
|
|
125
|
-
<Table.Tr key={row.item}>
|
|
126
|
-
<Table.Td>{row.item}</Table.Td>
|
|
127
|
-
<Table.Td variant="currency">${row.price.toFixed(2)}</Table.Td>
|
|
128
|
-
</Table.Tr>
|
|
129
|
-
))}
|
|
130
|
-
</Table.Tbody>
|
|
131
|
-
<Table.Tfoot>
|
|
132
|
-
<Table.Tr>
|
|
133
|
-
<Table.Td>Total</Table.Td>
|
|
134
|
-
<Table.Td variant="currency">${total.toFixed(2)}</Table.Td>
|
|
135
|
-
</Table.Tr>
|
|
136
|
-
</Table.Tfoot>
|
|
137
|
-
</Table>
|
|
138
|
-
);
|
|
139
|
-
},
|
|
140
|
-
};
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Tabs } from "./Tabs";
|
|
3
|
-
import { Flex } from "../Flex/Flex";
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Tabs> = {
|
|
6
|
-
title: "UI-Kit/Tabs",
|
|
7
|
-
component: Tabs,
|
|
8
|
-
tags: ["autodocs"],
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
argTypes: {
|
|
13
|
-
variant: {
|
|
14
|
-
control: "radio",
|
|
15
|
-
options: ["default", "outline", "pills"],
|
|
16
|
-
},
|
|
17
|
-
orientation: {
|
|
18
|
-
control: "radio",
|
|
19
|
-
options: ["horizontal", "vertical"],
|
|
20
|
-
},
|
|
21
|
-
// @ts-expect-error Custom prop not in native TabsProps
|
|
22
|
-
disabled: {
|
|
23
|
-
control: "boolean",
|
|
24
|
-
},
|
|
25
|
-
defaultChecked: {
|
|
26
|
-
table: {
|
|
27
|
-
disable: true,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default meta;
|
|
34
|
-
type Story = StoryObj<typeof Tabs>;
|
|
35
|
-
|
|
36
|
-
const InteractiveTabs = (
|
|
37
|
-
args: React.ComponentProps<typeof Tabs> & { disabled?: boolean },
|
|
38
|
-
) => {
|
|
39
|
-
return (
|
|
40
|
-
<Flex w={600} h={300}>
|
|
41
|
-
<Tabs defaultValue="gallery" {...args}>
|
|
42
|
-
<Tabs.List>
|
|
43
|
-
<Tabs.Tab
|
|
44
|
-
value="gallery"
|
|
45
|
-
disabled={args.disabled}
|
|
46
|
-
leftSection={
|
|
47
|
-
<svg
|
|
48
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
49
|
-
viewBox="0 0 24 24"
|
|
50
|
-
fill="none"
|
|
51
|
-
stroke="currentColor"
|
|
52
|
-
strokeWidth="2"
|
|
53
|
-
strokeLinecap="round"
|
|
54
|
-
strokeLinejoin="round"
|
|
55
|
-
>
|
|
56
|
-
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
57
|
-
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
58
|
-
<polyline points="21 15 16 10 5 21"></polyline>
|
|
59
|
-
</svg>
|
|
60
|
-
}
|
|
61
|
-
>
|
|
62
|
-
Gallery
|
|
63
|
-
</Tabs.Tab>
|
|
64
|
-
<Tabs.Tab
|
|
65
|
-
value="messages"
|
|
66
|
-
disabled={args.disabled}
|
|
67
|
-
leftSection={
|
|
68
|
-
<svg
|
|
69
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
70
|
-
viewBox="0 0 24 24"
|
|
71
|
-
fill="none"
|
|
72
|
-
stroke="currentColor"
|
|
73
|
-
strokeWidth="2"
|
|
74
|
-
strokeLinecap="round"
|
|
75
|
-
strokeLinejoin="round"
|
|
76
|
-
>
|
|
77
|
-
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
|
|
78
|
-
</svg>
|
|
79
|
-
}
|
|
80
|
-
>
|
|
81
|
-
Messages
|
|
82
|
-
</Tabs.Tab>
|
|
83
|
-
<Tabs.Tab
|
|
84
|
-
value="settings"
|
|
85
|
-
disabled={args.disabled}
|
|
86
|
-
leftSection={
|
|
87
|
-
<svg
|
|
88
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
89
|
-
viewBox="0 0 24 24"
|
|
90
|
-
fill="none"
|
|
91
|
-
stroke="currentColor"
|
|
92
|
-
strokeWidth="2"
|
|
93
|
-
strokeLinecap="round"
|
|
94
|
-
strokeLinejoin="round"
|
|
95
|
-
>
|
|
96
|
-
<circle cx="12" cy="12" r="3"></circle>
|
|
97
|
-
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
|
|
98
|
-
</svg>
|
|
99
|
-
}
|
|
100
|
-
>
|
|
101
|
-
Settings
|
|
102
|
-
</Tabs.Tab>
|
|
103
|
-
</Tabs.List>
|
|
104
|
-
|
|
105
|
-
<Tabs.Panel value="gallery">Gallery tab content</Tabs.Panel>
|
|
106
|
-
|
|
107
|
-
<Tabs.Panel value="messages">Messages tab content</Tabs.Panel>
|
|
108
|
-
|
|
109
|
-
<Tabs.Panel value="settings">Settings tab content</Tabs.Panel>
|
|
110
|
-
</Tabs>
|
|
111
|
-
</Flex>
|
|
112
|
-
);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const Default: Story = {
|
|
116
|
-
render: (args) => <InteractiveTabs {...args} />,
|
|
117
|
-
args: {
|
|
118
|
-
variant: "default",
|
|
119
|
-
orientation: "horizontal",
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export const Outline: Story = {
|
|
124
|
-
render: (args) => <InteractiveTabs {...args} />,
|
|
125
|
-
args: {
|
|
126
|
-
variant: "outline",
|
|
127
|
-
orientation: "horizontal",
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export const Pills: Story = {
|
|
132
|
-
render: (args) => <InteractiveTabs {...args} />,
|
|
133
|
-
args: {
|
|
134
|
-
variant: "pills",
|
|
135
|
-
orientation: "horizontal",
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export const Vertical: Story = {
|
|
140
|
-
render: (args) => <InteractiveTabs {...args} />,
|
|
141
|
-
args: {
|
|
142
|
-
variant: "default",
|
|
143
|
-
orientation: "vertical",
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export const Inverted: Story = {
|
|
148
|
-
render: (args) => <InteractiveTabs {...args} />,
|
|
149
|
-
args: {
|
|
150
|
-
variant: "default",
|
|
151
|
-
orientation: "horizontal",
|
|
152
|
-
inverted: true,
|
|
153
|
-
},
|
|
154
|
-
};
|