@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,65 +1,65 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Checkbox } from "../shadcn";
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Checkbox> = {
|
|
5
|
-
title: "Shadcn/Components/Checkbox",
|
|
6
|
-
component: Checkbox,
|
|
7
|
-
args: {
|
|
8
|
-
"aria-label": "Checkbox demo",
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof Checkbox>;
|
|
14
|
-
|
|
15
|
-
export const Default: Story = {
|
|
16
|
-
render: args => (
|
|
17
|
-
<div className="al-flex al-items-center al-space-x-2">
|
|
18
|
-
<Checkbox {...args} id="terms" />
|
|
19
|
-
<label
|
|
20
|
-
htmlFor="terms"
|
|
21
|
-
className="al-text-sm al-font-medium al-leading-none al-peer-disabled:al-cursor-not-allowed al-peer-disabled:al-opacity-70"
|
|
22
|
-
>
|
|
23
|
-
Accept terms and conditions
|
|
24
|
-
</label>
|
|
25
|
-
</div>
|
|
26
|
-
),
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const Checked: Story = {
|
|
30
|
-
render: args => (
|
|
31
|
-
<div className="al-flex al-items-center al-space-x-2">
|
|
32
|
-
<Checkbox {...args} id="checked" defaultChecked />
|
|
33
|
-
<label htmlFor="checked" className="al-text-sm al-font-medium al-leading-none">
|
|
34
|
-
Checked by default
|
|
35
|
-
</label>
|
|
36
|
-
</div>
|
|
37
|
-
),
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const Disabled: Story = {
|
|
41
|
-
render: args => (
|
|
42
|
-
<div className="al-flex al-items-center al-space-x-2">
|
|
43
|
-
<Checkbox {...args} id="disabled" disabled />
|
|
44
|
-
<label htmlFor="disabled" className="al-text-sm al-font-medium al-leading-none al-opacity-70">
|
|
45
|
-
Disabled checkbox
|
|
46
|
-
</label>
|
|
47
|
-
</div>
|
|
48
|
-
),
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const WithDescription: Story = {
|
|
52
|
-
render: args => (
|
|
53
|
-
<div className="al-items-top al-flex al-space-x-2">
|
|
54
|
-
<Checkbox {...args} id="description" />
|
|
55
|
-
<div className="al-grid al-gap-1.5 al-leading-none">
|
|
56
|
-
<label htmlFor="description" className="al-text-sm al-font-medium al-leading-none">
|
|
57
|
-
Accept terms
|
|
58
|
-
</label>
|
|
59
|
-
<p className="al-text-sm al-text-muted-foreground">
|
|
60
|
-
You agree to our Terms of Service and Privacy Policy.
|
|
61
|
-
</p>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
),
|
|
65
|
-
};
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Checkbox } from "../shadcn";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Checkbox> = {
|
|
5
|
+
title: "Shadcn/Components/Checkbox",
|
|
6
|
+
component: Checkbox,
|
|
7
|
+
args: {
|
|
8
|
+
"aria-label": "Checkbox demo",
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: args => (
|
|
17
|
+
<div className="al-flex al-items-center al-space-x-2">
|
|
18
|
+
<Checkbox {...args} id="terms" />
|
|
19
|
+
<label
|
|
20
|
+
htmlFor="terms"
|
|
21
|
+
className="al-text-sm al-font-medium al-leading-none al-peer-disabled:al-cursor-not-allowed al-peer-disabled:al-opacity-70"
|
|
22
|
+
>
|
|
23
|
+
Accept terms and conditions
|
|
24
|
+
</label>
|
|
25
|
+
</div>
|
|
26
|
+
),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Checked: Story = {
|
|
30
|
+
render: args => (
|
|
31
|
+
<div className="al-flex al-items-center al-space-x-2">
|
|
32
|
+
<Checkbox {...args} id="checked" defaultChecked />
|
|
33
|
+
<label htmlFor="checked" className="al-text-sm al-font-medium al-leading-none">
|
|
34
|
+
Checked by default
|
|
35
|
+
</label>
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Disabled: Story = {
|
|
41
|
+
render: args => (
|
|
42
|
+
<div className="al-flex al-items-center al-space-x-2">
|
|
43
|
+
<Checkbox {...args} id="disabled" disabled />
|
|
44
|
+
<label htmlFor="disabled" className="al-text-sm al-font-medium al-leading-none al-opacity-70">
|
|
45
|
+
Disabled checkbox
|
|
46
|
+
</label>
|
|
47
|
+
</div>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const WithDescription: Story = {
|
|
52
|
+
render: args => (
|
|
53
|
+
<div className="al-items-top al-flex al-space-x-2">
|
|
54
|
+
<Checkbox {...args} id="description" />
|
|
55
|
+
<div className="al-grid al-gap-1.5 al-leading-none">
|
|
56
|
+
<label htmlFor="description" className="al-text-sm al-font-medium al-leading-none">
|
|
57
|
+
Accept terms
|
|
58
|
+
</label>
|
|
59
|
+
<p className="al-text-sm al-text-muted-foreground">
|
|
60
|
+
You agree to our Terms of Service and Privacy Policy.
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
-
import {
|
|
3
|
-
Command,
|
|
4
|
-
CommandEmpty,
|
|
5
|
-
CommandGroup,
|
|
6
|
-
CommandInput,
|
|
7
|
-
CommandItem,
|
|
8
|
-
CommandList,
|
|
9
|
-
} from "../shadcn";
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: "Shadcn/Components/Command",
|
|
13
|
-
component: Command,
|
|
14
|
-
} as Meta;
|
|
15
|
-
|
|
16
|
-
const Template: StoryFn = () => (
|
|
17
|
-
<Command className="al-rounded-lg al-border al-shadow-md">
|
|
18
|
-
<CommandInput placeholder="Type a command or search..." />
|
|
19
|
-
<CommandList>
|
|
20
|
-
<CommandEmpty>No results found.</CommandEmpty>
|
|
21
|
-
<CommandGroup heading="Suggestions">
|
|
22
|
-
<CommandItem>Option 1</CommandItem>
|
|
23
|
-
<CommandItem>Option 2</CommandItem>
|
|
24
|
-
<CommandItem>Option 3</CommandItem>
|
|
25
|
-
</CommandGroup>
|
|
26
|
-
<CommandGroup heading="Settings">
|
|
27
|
-
<CommandItem>Profile</CommandItem>
|
|
28
|
-
<CommandItem>Billing</CommandItem>
|
|
29
|
-
<CommandItem>Settings</CommandItem>
|
|
30
|
-
</CommandGroup>
|
|
31
|
-
</CommandList>
|
|
32
|
-
</Command>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export const Default = Template.bind({});
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
Command,
|
|
4
|
+
CommandEmpty,
|
|
5
|
+
CommandGroup,
|
|
6
|
+
CommandInput,
|
|
7
|
+
CommandItem,
|
|
8
|
+
CommandList,
|
|
9
|
+
} from "../shadcn";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: "Shadcn/Components/Command",
|
|
13
|
+
component: Command,
|
|
14
|
+
} as Meta;
|
|
15
|
+
|
|
16
|
+
const Template: StoryFn = () => (
|
|
17
|
+
<Command className="al-rounded-lg al-border al-shadow-md">
|
|
18
|
+
<CommandInput placeholder="Type a command or search..." />
|
|
19
|
+
<CommandList>
|
|
20
|
+
<CommandEmpty>No results found.</CommandEmpty>
|
|
21
|
+
<CommandGroup heading="Suggestions">
|
|
22
|
+
<CommandItem>Option 1</CommandItem>
|
|
23
|
+
<CommandItem>Option 2</CommandItem>
|
|
24
|
+
<CommandItem>Option 3</CommandItem>
|
|
25
|
+
</CommandGroup>
|
|
26
|
+
<CommandGroup heading="Settings">
|
|
27
|
+
<CommandItem>Profile</CommandItem>
|
|
28
|
+
<CommandItem>Billing</CommandItem>
|
|
29
|
+
<CommandItem>Settings</CommandItem>
|
|
30
|
+
</CommandGroup>
|
|
31
|
+
</CommandList>
|
|
32
|
+
</Command>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const Default = Template.bind({});
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
-
import {
|
|
3
|
-
DropdownMenu,
|
|
4
|
-
DropdownMenuContent,
|
|
5
|
-
DropdownMenuItem,
|
|
6
|
-
DropdownMenuTrigger,
|
|
7
|
-
Button,
|
|
8
|
-
} from "../shadcn";
|
|
9
|
-
import { MoreIcon, CopyIcon, RefreshIcon } from "@ac-assets/icons";
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: "Shadcn/Components/DropdownMenu",
|
|
13
|
-
component: DropdownMenu,
|
|
14
|
-
} as Meta;
|
|
15
|
-
|
|
16
|
-
const Template: StoryFn = () => (
|
|
17
|
-
<DropdownMenu>
|
|
18
|
-
<DropdownMenuTrigger asChild>
|
|
19
|
-
<Button variant="ghost" size="sm" className="al-p-0 al-h-8 al-w-8">
|
|
20
|
-
<MoreIcon className="al-h-4 al-w-4" />
|
|
21
|
-
</Button>
|
|
22
|
-
</DropdownMenuTrigger>
|
|
23
|
-
<DropdownMenuContent>
|
|
24
|
-
<DropdownMenuItem onClick={() => console.log("Copy clicked")}>
|
|
25
|
-
<CopyIcon className="al-mr-2 al-h-4 al-w-4" />
|
|
26
|
-
Copy message
|
|
27
|
-
</DropdownMenuItem>
|
|
28
|
-
<DropdownMenuItem onClick={() => console.log("Regenerate clicked")}>
|
|
29
|
-
<RefreshIcon className="al-mr-2 al-h-4 al-w-4" />
|
|
30
|
-
Regenerate response
|
|
31
|
-
</DropdownMenuItem>
|
|
32
|
-
</DropdownMenuContent>
|
|
33
|
-
</DropdownMenu>
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
export const Default = Template.bind({});
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
DropdownMenu,
|
|
4
|
+
DropdownMenuContent,
|
|
5
|
+
DropdownMenuItem,
|
|
6
|
+
DropdownMenuTrigger,
|
|
7
|
+
Button,
|
|
8
|
+
} from "../shadcn";
|
|
9
|
+
import { MoreIcon, CopyIcon, RefreshIcon } from "@ac-assets/icons";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: "Shadcn/Components/DropdownMenu",
|
|
13
|
+
component: DropdownMenu,
|
|
14
|
+
} as Meta;
|
|
15
|
+
|
|
16
|
+
const Template: StoryFn = () => (
|
|
17
|
+
<DropdownMenu>
|
|
18
|
+
<DropdownMenuTrigger asChild>
|
|
19
|
+
<Button variant="ghost" size="sm" className="al-p-0 al-h-8 al-w-8">
|
|
20
|
+
<MoreIcon className="al-h-4 al-w-4" />
|
|
21
|
+
</Button>
|
|
22
|
+
</DropdownMenuTrigger>
|
|
23
|
+
<DropdownMenuContent>
|
|
24
|
+
<DropdownMenuItem onClick={() => console.log("Copy clicked")}>
|
|
25
|
+
<CopyIcon className="al-mr-2 al-h-4 al-w-4" />
|
|
26
|
+
Copy message
|
|
27
|
+
</DropdownMenuItem>
|
|
28
|
+
<DropdownMenuItem onClick={() => console.log("Regenerate clicked")}>
|
|
29
|
+
<RefreshIcon className="al-mr-2 al-h-4 al-w-4" />
|
|
30
|
+
Regenerate response
|
|
31
|
+
</DropdownMenuItem>
|
|
32
|
+
</DropdownMenuContent>
|
|
33
|
+
</DropdownMenu>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export const Default = Template.bind({});
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
-
import { useForm } from "react-hook-form";
|
|
3
|
-
import {
|
|
4
|
-
Form,
|
|
5
|
-
FormField,
|
|
6
|
-
FormItem,
|
|
7
|
-
FormLabel,
|
|
8
|
-
FormControl,
|
|
9
|
-
FormDescription,
|
|
10
|
-
FormMessage,
|
|
11
|
-
} from "../shadcn";
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: "Shadcn/Components/Form",
|
|
15
|
-
component: Form,
|
|
16
|
-
} as Meta;
|
|
17
|
-
|
|
18
|
-
const Template: StoryFn = () => {
|
|
19
|
-
const form = useForm({
|
|
20
|
-
defaultValues: {
|
|
21
|
-
username: "",
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<Form {...form}>
|
|
27
|
-
<form className="al-space-y-8">
|
|
28
|
-
<FormField
|
|
29
|
-
control={form.control}
|
|
30
|
-
name="username"
|
|
31
|
-
render={({ field }) => (
|
|
32
|
-
<FormItem>
|
|
33
|
-
<FormLabel>Username</FormLabel>
|
|
34
|
-
<FormControl>
|
|
35
|
-
<input
|
|
36
|
-
{...field}
|
|
37
|
-
className="al-flex al-h-10 al-w-full al-rounded-md al-border al-border-input al-bg-background al-px-3 al-py-2 al-text-sm"
|
|
38
|
-
/>
|
|
39
|
-
</FormControl>
|
|
40
|
-
<FormDescription>This is your public display name.</FormDescription>
|
|
41
|
-
<FormMessage />
|
|
42
|
-
</FormItem>
|
|
43
|
-
)}
|
|
44
|
-
/>
|
|
45
|
-
</form>
|
|
46
|
-
</Form>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const Default = Template.bind({});
|
|
51
|
-
|
|
52
|
-
export const WithValidation: StoryFn = () => {
|
|
53
|
-
const form = useForm({
|
|
54
|
-
defaultValues: {
|
|
55
|
-
username: "",
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<Form {...form}>
|
|
61
|
-
<form className="al-space-y-8">
|
|
62
|
-
<FormField
|
|
63
|
-
control={form.control}
|
|
64
|
-
name="username"
|
|
65
|
-
render={({ field }) => (
|
|
66
|
-
<FormItem>
|
|
67
|
-
<FormLabel>Username</FormLabel>
|
|
68
|
-
<FormControl>
|
|
69
|
-
<input
|
|
70
|
-
{...field}
|
|
71
|
-
className="al-flex al-h-10 al-w-full al-rounded-md al-border al-border-input al-bg-background al-px-3 al-py-2 al-text-sm"
|
|
72
|
-
/>
|
|
73
|
-
</FormControl>
|
|
74
|
-
<FormDescription>Username must be at least 2 characters.</FormDescription>
|
|
75
|
-
<FormMessage />
|
|
76
|
-
</FormItem>
|
|
77
|
-
)}
|
|
78
|
-
/>
|
|
79
|
-
</form>
|
|
80
|
-
</Form>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const WithError: StoryFn = () => {
|
|
85
|
-
const form = useForm({
|
|
86
|
-
defaultValues: {
|
|
87
|
-
username: "a",
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<Form {...form}>
|
|
93
|
-
<form className="al-space-y-8">
|
|
94
|
-
<FormField
|
|
95
|
-
control={form.control}
|
|
96
|
-
name="username"
|
|
97
|
-
render={({ field }) => (
|
|
98
|
-
<FormItem>
|
|
99
|
-
<FormLabel>Username</FormLabel>
|
|
100
|
-
<FormControl>
|
|
101
|
-
<input
|
|
102
|
-
{...field}
|
|
103
|
-
className="al-flex al-h-10 al-w-full al-rounded-md al-border al-border-destructive al-bg-background al-px-3 al-py-2 al-text-sm"
|
|
104
|
-
/>
|
|
105
|
-
</FormControl>
|
|
106
|
-
<FormDescription>Username must be at least 2 characters.</FormDescription>
|
|
107
|
-
<FormMessage>Username is too short</FormMessage>
|
|
108
|
-
</FormItem>
|
|
109
|
-
)}
|
|
110
|
-
/>
|
|
111
|
-
</form>
|
|
112
|
-
</Form>
|
|
113
|
-
);
|
|
114
|
-
};
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
+
import { useForm } from "react-hook-form";
|
|
3
|
+
import {
|
|
4
|
+
Form,
|
|
5
|
+
FormField,
|
|
6
|
+
FormItem,
|
|
7
|
+
FormLabel,
|
|
8
|
+
FormControl,
|
|
9
|
+
FormDescription,
|
|
10
|
+
FormMessage,
|
|
11
|
+
} from "../shadcn";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: "Shadcn/Components/Form",
|
|
15
|
+
component: Form,
|
|
16
|
+
} as Meta;
|
|
17
|
+
|
|
18
|
+
const Template: StoryFn = () => {
|
|
19
|
+
const form = useForm({
|
|
20
|
+
defaultValues: {
|
|
21
|
+
username: "",
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Form {...form}>
|
|
27
|
+
<form className="al-space-y-8">
|
|
28
|
+
<FormField
|
|
29
|
+
control={form.control}
|
|
30
|
+
name="username"
|
|
31
|
+
render={({ field }) => (
|
|
32
|
+
<FormItem>
|
|
33
|
+
<FormLabel>Username</FormLabel>
|
|
34
|
+
<FormControl>
|
|
35
|
+
<input
|
|
36
|
+
{...field}
|
|
37
|
+
className="al-flex al-h-10 al-w-full al-rounded-md al-border al-border-input al-bg-background al-px-3 al-py-2 al-text-sm"
|
|
38
|
+
/>
|
|
39
|
+
</FormControl>
|
|
40
|
+
<FormDescription>This is your public display name.</FormDescription>
|
|
41
|
+
<FormMessage />
|
|
42
|
+
</FormItem>
|
|
43
|
+
)}
|
|
44
|
+
/>
|
|
45
|
+
</form>
|
|
46
|
+
</Form>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const Default = Template.bind({});
|
|
51
|
+
|
|
52
|
+
export const WithValidation: StoryFn = () => {
|
|
53
|
+
const form = useForm({
|
|
54
|
+
defaultValues: {
|
|
55
|
+
username: "",
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Form {...form}>
|
|
61
|
+
<form className="al-space-y-8">
|
|
62
|
+
<FormField
|
|
63
|
+
control={form.control}
|
|
64
|
+
name="username"
|
|
65
|
+
render={({ field }) => (
|
|
66
|
+
<FormItem>
|
|
67
|
+
<FormLabel>Username</FormLabel>
|
|
68
|
+
<FormControl>
|
|
69
|
+
<input
|
|
70
|
+
{...field}
|
|
71
|
+
className="al-flex al-h-10 al-w-full al-rounded-md al-border al-border-input al-bg-background al-px-3 al-py-2 al-text-sm"
|
|
72
|
+
/>
|
|
73
|
+
</FormControl>
|
|
74
|
+
<FormDescription>Username must be at least 2 characters.</FormDescription>
|
|
75
|
+
<FormMessage />
|
|
76
|
+
</FormItem>
|
|
77
|
+
)}
|
|
78
|
+
/>
|
|
79
|
+
</form>
|
|
80
|
+
</Form>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const WithError: StoryFn = () => {
|
|
85
|
+
const form = useForm({
|
|
86
|
+
defaultValues: {
|
|
87
|
+
username: "a",
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Form {...form}>
|
|
93
|
+
<form className="al-space-y-8">
|
|
94
|
+
<FormField
|
|
95
|
+
control={form.control}
|
|
96
|
+
name="username"
|
|
97
|
+
render={({ field }) => (
|
|
98
|
+
<FormItem>
|
|
99
|
+
<FormLabel>Username</FormLabel>
|
|
100
|
+
<FormControl>
|
|
101
|
+
<input
|
|
102
|
+
{...field}
|
|
103
|
+
className="al-flex al-h-10 al-w-full al-rounded-md al-border al-border-destructive al-bg-background al-px-3 al-py-2 al-text-sm"
|
|
104
|
+
/>
|
|
105
|
+
</FormControl>
|
|
106
|
+
<FormDescription>Username must be at least 2 characters.</FormDescription>
|
|
107
|
+
<FormMessage>Username is too short</FormMessage>
|
|
108
|
+
</FormItem>
|
|
109
|
+
)}
|
|
110
|
+
/>
|
|
111
|
+
</form>
|
|
112
|
+
</Form>
|
|
113
|
+
);
|
|
114
|
+
};
|