@altimateai/ui-components 0.0.1-beta.5 → 0.0.1-beta.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/dist/CoachForm.js +1 -1
- package/dist/storybook/Accordion.stories.tsx +52 -52
- package/dist/storybook/Alert.stories.tsx +61 -61
- package/dist/storybook/AlertDialog.stories.tsx +161 -161
- package/dist/storybook/Avatar.stories.tsx +58 -58
- package/dist/storybook/Badge.stories.tsx +36 -36
- package/dist/storybook/Button.stories.tsx +109 -109
- package/dist/storybook/Card.stories.tsx +69 -69
- package/dist/storybook/Checkbox.stories.tsx +65 -65
- package/dist/storybook/Command.stories.tsx +35 -35
- package/dist/storybook/DropdownMenu.stories.tsx +36 -36
- package/dist/storybook/Form.stories.tsx +114 -114
- package/dist/storybook/HoverCard.stories.tsx +99 -99
- package/dist/storybook/Input.stories.tsx +53 -53
- package/dist/storybook/Label.stories.tsx +42 -42
- package/dist/storybook/Menubar.stories.tsx +159 -159
- package/dist/storybook/Pagination.stories.tsx +152 -152
- package/dist/storybook/Popover.stories.tsx +23 -23
- package/dist/storybook/Progress.stories.tsx +89 -89
- package/dist/storybook/RadioGroup.stories.tsx +58 -58
- package/dist/storybook/Resizable.stories.tsx +119 -119
- package/dist/storybook/ScrollArea.stories.tsx +101 -101
- package/dist/storybook/Select.stories.tsx +95 -95
- package/dist/storybook/Sheet.stories.tsx +69 -69
- package/dist/storybook/Sidebar.stories.tsx +97 -97
- package/dist/storybook/Slider.stories.tsx +79 -79
- package/dist/storybook/Switch.stories.tsx +90 -90
- package/dist/storybook/Textarea.stories.tsx +50 -50
- package/dist/storybook/Toast.stories.tsx +107 -107
- package/dist/storybook/Tooltip.stories.tsx +28 -28
- package/dist/storybook/Typography.stories.tsx +178 -178
- package/package.json +2 -2
- package/readme.md +11 -11
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from "@storybook/react";
|
|
2
|
-
import { Sidebar, SidebarProvider } from "../shadcn";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Shadcn/Components/Sidebar",
|
|
6
|
-
component: Sidebar,
|
|
7
|
-
decorators: [
|
|
8
|
-
Story => (
|
|
9
|
-
<SidebarProvider>
|
|
10
|
-
<Story />
|
|
11
|
-
</SidebarProvider>
|
|
12
|
-
),
|
|
13
|
-
],
|
|
14
|
-
parameters: {
|
|
15
|
-
layout: "fullscreen",
|
|
16
|
-
},
|
|
17
|
-
} as Meta<typeof Sidebar>;
|
|
18
|
-
|
|
19
|
-
const Template: StoryFn<typeof Sidebar> = args => (
|
|
20
|
-
<div className="al-h-screen">
|
|
21
|
-
<Sidebar {...args}>
|
|
22
|
-
<div className="al-p-4">
|
|
23
|
-
<h2 className="al-text-lg al-font-semibold">Sidebar Content</h2>
|
|
24
|
-
<p className="al-mt-2">This is an example of sidebar content.</p>
|
|
25
|
-
<ul className="al-mt-4 al-space-y-2">
|
|
26
|
-
<li>Menu Item 1</li>
|
|
27
|
-
<li>Menu Item 2</li>
|
|
28
|
-
<li>Menu Item 3</li>
|
|
29
|
-
</ul>
|
|
30
|
-
</div>
|
|
31
|
-
</Sidebar>
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export const Default = Template.bind({});
|
|
36
|
-
Default.args = {};
|
|
37
|
-
|
|
38
|
-
export const RightSide = Template.bind({});
|
|
39
|
-
RightSide.args = {
|
|
40
|
-
side: "right",
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const FloatingVariant = Template.bind({});
|
|
44
|
-
FloatingVariant.args = {
|
|
45
|
-
variant: "floating",
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const InsetVariant = Template.bind({});
|
|
49
|
-
InsetVariant.args = {
|
|
50
|
-
variant: "inset",
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const IconCollapsible = Template.bind({});
|
|
54
|
-
IconCollapsible.args = {
|
|
55
|
-
collapsible: "icon",
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const NonCollapsible = Template.bind({});
|
|
59
|
-
NonCollapsible.args = {
|
|
60
|
-
collapsible: "none",
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// Example with custom content and styling
|
|
64
|
-
export const CustomStyling = Template.bind({});
|
|
65
|
-
CustomStyling.args = {
|
|
66
|
-
className: "al-bg-primary al-text-primary-foreground",
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// Example with controlled state
|
|
70
|
-
export const ControlledState: StoryFn<typeof Sidebar> = args => {
|
|
71
|
-
return (
|
|
72
|
-
<div className="al-h-screen">
|
|
73
|
-
<SidebarProvider defaultOpen={false}>
|
|
74
|
-
<Sidebar {...args}>
|
|
75
|
-
<div className="al-p-4">
|
|
76
|
-
<h2 className="al-text-lg al-font-semibold">Controlled Sidebar</h2>
|
|
77
|
-
<p className="al-mt-2">This sidebar starts in a collapsed state.</p>
|
|
78
|
-
</div>
|
|
79
|
-
</Sidebar>
|
|
80
|
-
</SidebarProvider>
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Example with mobile view
|
|
86
|
-
export const MobileView: StoryFn<typeof Sidebar> = args => {
|
|
87
|
-
return (
|
|
88
|
-
<div className="al-h-screen al-w-screen md:al-hidden">
|
|
89
|
-
<Sidebar {...args}>
|
|
90
|
-
<div className="al-p-4">
|
|
91
|
-
<h2 className="al-text-lg al-font-semibold">Mobile Sidebar</h2>
|
|
92
|
-
<p className="al-mt-2">This sidebar is optimized for mobile view.</p>
|
|
93
|
-
</div>
|
|
94
|
-
</Sidebar>
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
1
|
+
import type { Meta, StoryFn } from "@storybook/react";
|
|
2
|
+
import { Sidebar, SidebarProvider } from "../shadcn";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Shadcn/Components/Sidebar",
|
|
6
|
+
component: Sidebar,
|
|
7
|
+
decorators: [
|
|
8
|
+
Story => (
|
|
9
|
+
<SidebarProvider>
|
|
10
|
+
<Story />
|
|
11
|
+
</SidebarProvider>
|
|
12
|
+
),
|
|
13
|
+
],
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: "fullscreen",
|
|
16
|
+
},
|
|
17
|
+
} as Meta<typeof Sidebar>;
|
|
18
|
+
|
|
19
|
+
const Template: StoryFn<typeof Sidebar> = args => (
|
|
20
|
+
<div className="al-h-screen">
|
|
21
|
+
<Sidebar {...args}>
|
|
22
|
+
<div className="al-p-4">
|
|
23
|
+
<h2 className="al-text-lg al-font-semibold">Sidebar Content</h2>
|
|
24
|
+
<p className="al-mt-2">This is an example of sidebar content.</p>
|
|
25
|
+
<ul className="al-mt-4 al-space-y-2">
|
|
26
|
+
<li>Menu Item 1</li>
|
|
27
|
+
<li>Menu Item 2</li>
|
|
28
|
+
<li>Menu Item 3</li>
|
|
29
|
+
</ul>
|
|
30
|
+
</div>
|
|
31
|
+
</Sidebar>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const Default = Template.bind({});
|
|
36
|
+
Default.args = {};
|
|
37
|
+
|
|
38
|
+
export const RightSide = Template.bind({});
|
|
39
|
+
RightSide.args = {
|
|
40
|
+
side: "right",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const FloatingVariant = Template.bind({});
|
|
44
|
+
FloatingVariant.args = {
|
|
45
|
+
variant: "floating",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const InsetVariant = Template.bind({});
|
|
49
|
+
InsetVariant.args = {
|
|
50
|
+
variant: "inset",
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const IconCollapsible = Template.bind({});
|
|
54
|
+
IconCollapsible.args = {
|
|
55
|
+
collapsible: "icon",
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const NonCollapsible = Template.bind({});
|
|
59
|
+
NonCollapsible.args = {
|
|
60
|
+
collapsible: "none",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Example with custom content and styling
|
|
64
|
+
export const CustomStyling = Template.bind({});
|
|
65
|
+
CustomStyling.args = {
|
|
66
|
+
className: "al-bg-primary al-text-primary-foreground",
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// Example with controlled state
|
|
70
|
+
export const ControlledState: StoryFn<typeof Sidebar> = args => {
|
|
71
|
+
return (
|
|
72
|
+
<div className="al-h-screen">
|
|
73
|
+
<SidebarProvider defaultOpen={false}>
|
|
74
|
+
<Sidebar {...args}>
|
|
75
|
+
<div className="al-p-4">
|
|
76
|
+
<h2 className="al-text-lg al-font-semibold">Controlled Sidebar</h2>
|
|
77
|
+
<p className="al-mt-2">This sidebar starts in a collapsed state.</p>
|
|
78
|
+
</div>
|
|
79
|
+
</Sidebar>
|
|
80
|
+
</SidebarProvider>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Example with mobile view
|
|
86
|
+
export const MobileView: StoryFn<typeof Sidebar> = args => {
|
|
87
|
+
return (
|
|
88
|
+
<div className="al-h-screen al-w-screen md:al-hidden">
|
|
89
|
+
<Sidebar {...args}>
|
|
90
|
+
<div className="al-p-4">
|
|
91
|
+
<h2 className="al-text-lg al-font-semibold">Mobile Sidebar</h2>
|
|
92
|
+
<p className="al-mt-2">This sidebar is optimized for mobile view.</p>
|
|
93
|
+
</div>
|
|
94
|
+
</Sidebar>
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
-
import { Slider } from "../shadcn";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Shadcn/Components/Slider",
|
|
6
|
-
component: Slider,
|
|
7
|
-
argTypes: {
|
|
8
|
-
defaultValue: {
|
|
9
|
-
control: "object",
|
|
10
|
-
},
|
|
11
|
-
min: {
|
|
12
|
-
control: "number",
|
|
13
|
-
},
|
|
14
|
-
max: {
|
|
15
|
-
control: "number",
|
|
16
|
-
},
|
|
17
|
-
step: {
|
|
18
|
-
control: "number",
|
|
19
|
-
},
|
|
20
|
-
disabled: {
|
|
21
|
-
control: "boolean",
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
} as Meta<typeof Slider>;
|
|
25
|
-
|
|
26
|
-
const Template: StoryFn = args => (
|
|
27
|
-
<div className="al-w-[60%] al-space-y-4">
|
|
28
|
-
<Slider {...args} />
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export const Default = Template.bind({});
|
|
33
|
-
Default.args = {
|
|
34
|
-
defaultValue: [50],
|
|
35
|
-
max: 100,
|
|
36
|
-
step: 1,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const WithSteps = Template.bind({});
|
|
40
|
-
WithSteps.args = {
|
|
41
|
-
defaultValue: [0],
|
|
42
|
-
max: 100,
|
|
43
|
-
step: 10,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const Range = Template.bind({});
|
|
47
|
-
Range.args = {
|
|
48
|
-
defaultValue: [25, 75],
|
|
49
|
-
max: 100,
|
|
50
|
-
step: 1,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const Disabled = Template.bind({});
|
|
54
|
-
Disabled.args = {
|
|
55
|
-
defaultValue: [50],
|
|
56
|
-
max: 100,
|
|
57
|
-
step: 1,
|
|
58
|
-
disabled: true,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const CustomRange = Template.bind({});
|
|
62
|
-
CustomRange.args = {
|
|
63
|
-
defaultValue: [40],
|
|
64
|
-
min: -50,
|
|
65
|
-
max: 50,
|
|
66
|
-
step: 5,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const WithLabels: StoryFn = () => (
|
|
70
|
-
<div className="al-w-[60%] al-space-y-4">
|
|
71
|
-
<div className="al-grid al-gap-4 al-pt-4">
|
|
72
|
-
<div className="al-flex al-items-center al-justify-between">
|
|
73
|
-
<label className="al-text-sm al-font-medium">Volume</label>
|
|
74
|
-
<span className="al-w-12 al-rounded-md al-text-right al-text-sm">50%</span>
|
|
75
|
-
</div>
|
|
76
|
-
<Slider defaultValue={[50]} max={100} step={1} />
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
+
import { Slider } from "../shadcn";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Shadcn/Components/Slider",
|
|
6
|
+
component: Slider,
|
|
7
|
+
argTypes: {
|
|
8
|
+
defaultValue: {
|
|
9
|
+
control: "object",
|
|
10
|
+
},
|
|
11
|
+
min: {
|
|
12
|
+
control: "number",
|
|
13
|
+
},
|
|
14
|
+
max: {
|
|
15
|
+
control: "number",
|
|
16
|
+
},
|
|
17
|
+
step: {
|
|
18
|
+
control: "number",
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
control: "boolean",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
} as Meta<typeof Slider>;
|
|
25
|
+
|
|
26
|
+
const Template: StoryFn = args => (
|
|
27
|
+
<div className="al-w-[60%] al-space-y-4">
|
|
28
|
+
<Slider {...args} />
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const Default = Template.bind({});
|
|
33
|
+
Default.args = {
|
|
34
|
+
defaultValue: [50],
|
|
35
|
+
max: 100,
|
|
36
|
+
step: 1,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const WithSteps = Template.bind({});
|
|
40
|
+
WithSteps.args = {
|
|
41
|
+
defaultValue: [0],
|
|
42
|
+
max: 100,
|
|
43
|
+
step: 10,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Range = Template.bind({});
|
|
47
|
+
Range.args = {
|
|
48
|
+
defaultValue: [25, 75],
|
|
49
|
+
max: 100,
|
|
50
|
+
step: 1,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Disabled = Template.bind({});
|
|
54
|
+
Disabled.args = {
|
|
55
|
+
defaultValue: [50],
|
|
56
|
+
max: 100,
|
|
57
|
+
step: 1,
|
|
58
|
+
disabled: true,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const CustomRange = Template.bind({});
|
|
62
|
+
CustomRange.args = {
|
|
63
|
+
defaultValue: [40],
|
|
64
|
+
min: -50,
|
|
65
|
+
max: 50,
|
|
66
|
+
step: 5,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const WithLabels: StoryFn = () => (
|
|
70
|
+
<div className="al-w-[60%] al-space-y-4">
|
|
71
|
+
<div className="al-grid al-gap-4 al-pt-4">
|
|
72
|
+
<div className="al-flex al-items-center al-justify-between">
|
|
73
|
+
<label className="al-text-sm al-font-medium">Volume</label>
|
|
74
|
+
<span className="al-w-12 al-rounded-md al-text-right al-text-sm">50%</span>
|
|
75
|
+
</div>
|
|
76
|
+
<Slider defaultValue={[50]} max={100} step={1} />
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
-
import { Switch } from "../shadcn";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Shadcn/Components/Switch",
|
|
6
|
-
component: Switch,
|
|
7
|
-
argTypes: {
|
|
8
|
-
checked: {
|
|
9
|
-
control: "boolean",
|
|
10
|
-
},
|
|
11
|
-
disabled: {
|
|
12
|
-
control: "boolean",
|
|
13
|
-
},
|
|
14
|
-
defaultChecked: {
|
|
15
|
-
control: "boolean",
|
|
16
|
-
},
|
|
17
|
-
onCheckedChange: { action: "checked changed" },
|
|
18
|
-
},
|
|
19
|
-
} as Meta;
|
|
20
|
-
|
|
21
|
-
const Template: StoryFn = args => <Switch {...args} />;
|
|
22
|
-
|
|
23
|
-
export const Default = Template.bind({});
|
|
24
|
-
Default.args = {
|
|
25
|
-
"aria-label": "Switch demo",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const Checked = Template.bind({});
|
|
29
|
-
Checked.args = {
|
|
30
|
-
defaultChecked: true,
|
|
31
|
-
"aria-label": "Switch demo",
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const Disabled = Template.bind({});
|
|
35
|
-
Disabled.args = {
|
|
36
|
-
disabled: true,
|
|
37
|
-
"aria-label": "Switch demo",
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const DisabledChecked = Template.bind({});
|
|
41
|
-
DisabledChecked.args = {
|
|
42
|
-
disabled: true,
|
|
43
|
-
defaultChecked: true,
|
|
44
|
-
"aria-label": "Switch demo",
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const WithLabel: StoryFn = () => (
|
|
48
|
-
<div className="al-flex al-items-center al-space-x-2">
|
|
49
|
-
<Switch id="airplane-mode" />
|
|
50
|
-
<label
|
|
51
|
-
htmlFor="airplane-mode"
|
|
52
|
-
className="al-text-sm al-font-medium al-leading-none al-peer-disabled:al-cursor-not-allowed al-peer-disabled:al-opacity-70"
|
|
53
|
-
>
|
|
54
|
-
Airplane Mode
|
|
55
|
-
</label>
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
export const WithDescription: StoryFn = () => (
|
|
60
|
-
<div className="al-flex al-flex-col al-space-y-2">
|
|
61
|
-
<div className="al-flex al-items-center al-space-x-2">
|
|
62
|
-
<Switch id="notifications" />
|
|
63
|
-
<label htmlFor="notifications" className="al-text-sm al-font-medium al-leading-none">
|
|
64
|
-
Enable Notifications
|
|
65
|
-
</label>
|
|
66
|
-
</div>
|
|
67
|
-
<p className="al-text-sm al-text-muted-foreground">
|
|
68
|
-
You will receive notifications when someone mentions you in a comment.
|
|
69
|
-
</p>
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
export const InForm: StoryFn = () => (
|
|
74
|
-
<form className="al-w-full al-max-w-sm">
|
|
75
|
-
<div className="al-flex al-flex-col al-space-y-4">
|
|
76
|
-
<div className="al-flex al-items-center al-justify-between">
|
|
77
|
-
<label htmlFor="marketing" className="al-text-sm al-font-medium al-leading-none">
|
|
78
|
-
Marketing emails
|
|
79
|
-
</label>
|
|
80
|
-
<Switch id="marketing" />
|
|
81
|
-
</div>
|
|
82
|
-
<div className="al-flex al-items-center al-justify-between">
|
|
83
|
-
<label htmlFor="newsletter" className="al-text-sm al-font-medium al-leading-none">
|
|
84
|
-
Weekly newsletter
|
|
85
|
-
</label>
|
|
86
|
-
<Switch id="newsletter" defaultChecked />
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
</form>
|
|
90
|
-
);
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
+
import { Switch } from "../shadcn";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Shadcn/Components/Switch",
|
|
6
|
+
component: Switch,
|
|
7
|
+
argTypes: {
|
|
8
|
+
checked: {
|
|
9
|
+
control: "boolean",
|
|
10
|
+
},
|
|
11
|
+
disabled: {
|
|
12
|
+
control: "boolean",
|
|
13
|
+
},
|
|
14
|
+
defaultChecked: {
|
|
15
|
+
control: "boolean",
|
|
16
|
+
},
|
|
17
|
+
onCheckedChange: { action: "checked changed" },
|
|
18
|
+
},
|
|
19
|
+
} as Meta;
|
|
20
|
+
|
|
21
|
+
const Template: StoryFn = args => <Switch {...args} />;
|
|
22
|
+
|
|
23
|
+
export const Default = Template.bind({});
|
|
24
|
+
Default.args = {
|
|
25
|
+
"aria-label": "Switch demo",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Checked = Template.bind({});
|
|
29
|
+
Checked.args = {
|
|
30
|
+
defaultChecked: true,
|
|
31
|
+
"aria-label": "Switch demo",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Disabled = Template.bind({});
|
|
35
|
+
Disabled.args = {
|
|
36
|
+
disabled: true,
|
|
37
|
+
"aria-label": "Switch demo",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const DisabledChecked = Template.bind({});
|
|
41
|
+
DisabledChecked.args = {
|
|
42
|
+
disabled: true,
|
|
43
|
+
defaultChecked: true,
|
|
44
|
+
"aria-label": "Switch demo",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const WithLabel: StoryFn = () => (
|
|
48
|
+
<div className="al-flex al-items-center al-space-x-2">
|
|
49
|
+
<Switch id="airplane-mode" />
|
|
50
|
+
<label
|
|
51
|
+
htmlFor="airplane-mode"
|
|
52
|
+
className="al-text-sm al-font-medium al-leading-none al-peer-disabled:al-cursor-not-allowed al-peer-disabled:al-opacity-70"
|
|
53
|
+
>
|
|
54
|
+
Airplane Mode
|
|
55
|
+
</label>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
export const WithDescription: StoryFn = () => (
|
|
60
|
+
<div className="al-flex al-flex-col al-space-y-2">
|
|
61
|
+
<div className="al-flex al-items-center al-space-x-2">
|
|
62
|
+
<Switch id="notifications" />
|
|
63
|
+
<label htmlFor="notifications" className="al-text-sm al-font-medium al-leading-none">
|
|
64
|
+
Enable Notifications
|
|
65
|
+
</label>
|
|
66
|
+
</div>
|
|
67
|
+
<p className="al-text-sm al-text-muted-foreground">
|
|
68
|
+
You will receive notifications when someone mentions you in a comment.
|
|
69
|
+
</p>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export const InForm: StoryFn = () => (
|
|
74
|
+
<form className="al-w-full al-max-w-sm">
|
|
75
|
+
<div className="al-flex al-flex-col al-space-y-4">
|
|
76
|
+
<div className="al-flex al-items-center al-justify-between">
|
|
77
|
+
<label htmlFor="marketing" className="al-text-sm al-font-medium al-leading-none">
|
|
78
|
+
Marketing emails
|
|
79
|
+
</label>
|
|
80
|
+
<Switch id="marketing" />
|
|
81
|
+
</div>
|
|
82
|
+
<div className="al-flex al-items-center al-justify-between">
|
|
83
|
+
<label htmlFor="newsletter" className="al-text-sm al-font-medium al-leading-none">
|
|
84
|
+
Weekly newsletter
|
|
85
|
+
</label>
|
|
86
|
+
<Switch id="newsletter" defaultChecked />
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</form>
|
|
90
|
+
);
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
-
import { Textarea } from "../shadcn";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Shadcn/Components/Textarea",
|
|
6
|
-
component: Textarea,
|
|
7
|
-
argTypes: {
|
|
8
|
-
disabled: {
|
|
9
|
-
control: "boolean",
|
|
10
|
-
},
|
|
11
|
-
placeholder: {
|
|
12
|
-
control: "text",
|
|
13
|
-
},
|
|
14
|
-
rows: {
|
|
15
|
-
control: "number",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
} as Meta;
|
|
19
|
-
|
|
20
|
-
const Template: StoryFn = args => <Textarea {...args} />;
|
|
21
|
-
|
|
22
|
-
export const Default = Template.bind({});
|
|
23
|
-
Default.args = {
|
|
24
|
-
placeholder: "Type your message here.",
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const WithRows = Template.bind({});
|
|
28
|
-
WithRows.args = {
|
|
29
|
-
placeholder: "Type your message here.",
|
|
30
|
-
rows: 10,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Disabled = Template.bind({});
|
|
34
|
-
Disabled.args = {
|
|
35
|
-
placeholder: "This textarea is disabled",
|
|
36
|
-
disabled: true,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const WithValue = Template.bind({});
|
|
40
|
-
WithValue.args = {
|
|
41
|
-
value:
|
|
42
|
-
"This is a pre-filled textarea with some content that demonstrates how the component handles longer text.",
|
|
43
|
-
rows: 5,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const WithCustomClass = Template.bind({});
|
|
47
|
-
WithCustomClass.args = {
|
|
48
|
-
placeholder: "Custom styled textarea",
|
|
49
|
-
className: "al-border-2 al-border-primary",
|
|
50
|
-
};
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
+
import { Textarea } from "../shadcn";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Shadcn/Components/Textarea",
|
|
6
|
+
component: Textarea,
|
|
7
|
+
argTypes: {
|
|
8
|
+
disabled: {
|
|
9
|
+
control: "boolean",
|
|
10
|
+
},
|
|
11
|
+
placeholder: {
|
|
12
|
+
control: "text",
|
|
13
|
+
},
|
|
14
|
+
rows: {
|
|
15
|
+
control: "number",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
} as Meta;
|
|
19
|
+
|
|
20
|
+
const Template: StoryFn = args => <Textarea {...args} />;
|
|
21
|
+
|
|
22
|
+
export const Default = Template.bind({});
|
|
23
|
+
Default.args = {
|
|
24
|
+
placeholder: "Type your message here.",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const WithRows = Template.bind({});
|
|
28
|
+
WithRows.args = {
|
|
29
|
+
placeholder: "Type your message here.",
|
|
30
|
+
rows: 10,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Disabled = Template.bind({});
|
|
34
|
+
Disabled.args = {
|
|
35
|
+
placeholder: "This textarea is disabled",
|
|
36
|
+
disabled: true,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const WithValue = Template.bind({});
|
|
40
|
+
WithValue.args = {
|
|
41
|
+
value:
|
|
42
|
+
"This is a pre-filled textarea with some content that demonstrates how the component handles longer text.",
|
|
43
|
+
rows: 5,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const WithCustomClass = Template.bind({});
|
|
47
|
+
WithCustomClass.args = {
|
|
48
|
+
placeholder: "Custom styled textarea",
|
|
49
|
+
className: "al-border-2 al-border-primary",
|
|
50
|
+
};
|