@auto-engineer/generate-react-client 1.12.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/CHANGELOG.md +12 -0
- package/LICENSE +10 -0
- package/dist/src/commands/generate-react-client.d.ts +21 -0
- package/dist/src/commands/generate-react-client.d.ts.map +1 -0
- package/dist/src/commands/generate-react-client.js +62 -0
- package/dist/src/commands/generate-react-client.js.map +1 -0
- package/dist/src/copy-starter.d.ts +2 -0
- package/dist/src/copy-starter.d.ts.map +1 -0
- package/dist/src/copy-starter.js +34 -0
- package/dist/src/copy-starter.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -0
- package/dist/starter/.storybook/main.ts +33 -0
- package/dist/starter/.storybook/preview.tsx +35 -0
- package/dist/starter/components.json +29 -0
- package/dist/starter/index.html +12 -0
- package/dist/starter/package.json +60 -0
- package/dist/starter/pnpm-lock.yaml +5236 -0
- package/dist/starter/public/mockServiceWorker.js +336 -0
- package/dist/starter/src/App.tsx +15 -0
- package/dist/starter/src/components/.gitkeep +0 -0
- package/dist/starter/src/components/ui/Accordion.stories.tsx +47 -0
- package/dist/starter/src/components/ui/Accordion.tsx +51 -0
- package/dist/starter/src/components/ui/Alert.stories.tsx +27 -0
- package/dist/starter/src/components/ui/Alert.tsx +49 -0
- package/dist/starter/src/components/ui/AlertDialog.stories.tsx +65 -0
- package/dist/starter/src/components/ui/AlertDialog.tsx +163 -0
- package/dist/starter/src/components/ui/AspectRatio.stories.tsx +33 -0
- package/dist/starter/src/components/ui/AspectRatio.tsx +9 -0
- package/dist/starter/src/components/ui/Avatar.stories.tsx +42 -0
- package/dist/starter/src/components/ui/Avatar.tsx +87 -0
- package/dist/starter/src/components/ui/Badge.stories.tsx +36 -0
- package/dist/starter/src/components/ui/Badge.tsx +40 -0
- package/dist/starter/src/components/ui/Breadcrumb.stories.tsx +52 -0
- package/dist/starter/src/components/ui/Breadcrumb.tsx +92 -0
- package/dist/starter/src/components/ui/Button.stories.tsx +92 -0
- package/dist/starter/src/components/ui/Button.tsx +62 -0
- package/dist/starter/src/components/ui/ButtonGroup.stories.tsx +30 -0
- package/dist/starter/src/components/ui/ButtonGroup.tsx +75 -0
- package/dist/starter/src/components/ui/Calendar.stories.tsx +38 -0
- package/dist/starter/src/components/ui/Calendar.tsx +159 -0
- package/dist/starter/src/components/ui/Card.stories.tsx +42 -0
- package/dist/starter/src/components/ui/Card.tsx +56 -0
- package/dist/starter/src/components/ui/Carousel.stories.tsx +54 -0
- package/dist/starter/src/components/ui/Carousel.tsx +216 -0
- package/dist/starter/src/components/ui/Chart.stories.tsx +38 -0
- package/dist/starter/src/components/ui/Chart.tsx +296 -0
- package/dist/starter/src/components/ui/Checkbox.stories.tsx +31 -0
- package/dist/starter/src/components/ui/Checkbox.tsx +29 -0
- package/dist/starter/src/components/ui/Collapsible.stories.tsx +56 -0
- package/dist/starter/src/components/ui/Collapsible.tsx +15 -0
- package/dist/starter/src/components/ui/Combobox.stories.tsx +73 -0
- package/dist/starter/src/components/ui/Combobox.tsx +267 -0
- package/dist/starter/src/components/ui/Command.stories.tsx +69 -0
- package/dist/starter/src/components/ui/Command.tsx +137 -0
- package/dist/starter/src/components/ui/ContextMenu.stories.tsx +66 -0
- package/dist/starter/src/components/ui/ContextMenu.tsx +211 -0
- package/dist/starter/src/components/ui/DesignSystem-Colors.mdx +68 -0
- package/dist/starter/src/components/ui/DesignSystem-Colors.stories.tsx +116 -0
- package/dist/starter/src/components/ui/DesignSystem-Layout.mdx +64 -0
- package/dist/starter/src/components/ui/DesignSystem-Layout.stories.tsx +166 -0
- package/dist/starter/src/components/ui/DesignSystem-Typography.mdx +31 -0
- package/dist/starter/src/components/ui/DesignSystem-Typography.stories.tsx +79 -0
- package/dist/starter/src/components/ui/Dialog.stories.tsx +72 -0
- package/dist/starter/src/components/ui/Dialog.tsx +136 -0
- package/dist/starter/src/components/ui/Direction.stories.tsx +36 -0
- package/dist/starter/src/components/ui/Direction.tsx +18 -0
- package/dist/starter/src/components/ui/Drawer.stories.tsx +68 -0
- package/dist/starter/src/components/ui/Drawer.tsx +106 -0
- package/dist/starter/src/components/ui/DropdownMenu.stories.tsx +72 -0
- package/dist/starter/src/components/ui/DropdownMenu.tsx +219 -0
- package/dist/starter/src/components/ui/Empty.stories.tsx +35 -0
- package/dist/starter/src/components/ui/Empty.tsx +85 -0
- package/dist/starter/src/components/ui/Field.stories.tsx +47 -0
- package/dist/starter/src/components/ui/Field.tsx +226 -0
- package/dist/starter/src/components/ui/Form.stories.tsx +44 -0
- package/dist/starter/src/components/ui/Form.tsx +136 -0
- package/dist/starter/src/components/ui/HoverCard.stories.tsx +47 -0
- package/dist/starter/src/components/ui/HoverCard.tsx +36 -0
- package/dist/starter/src/components/ui/Input.stories.tsx +38 -0
- package/dist/starter/src/components/ui/Input.tsx +21 -0
- package/dist/starter/src/components/ui/InputGroup.stories.tsx +50 -0
- package/dist/starter/src/components/ui/InputGroup.tsx +147 -0
- package/dist/starter/src/components/ui/InputOTP.stories.tsx +40 -0
- package/dist/starter/src/components/ui/InputOTP.tsx +68 -0
- package/dist/starter/src/components/ui/Item.stories.tsx +61 -0
- package/dist/starter/src/components/ui/Item.tsx +158 -0
- package/dist/starter/src/components/ui/Kbd.stories.tsx +54 -0
- package/dist/starter/src/components/ui/Kbd.tsx +18 -0
- package/dist/starter/src/components/ui/Label.stories.tsx +85 -0
- package/dist/starter/src/components/ui/Label.tsx +40 -0
- package/dist/starter/src/components/ui/Menubar.stories.tsx +76 -0
- package/dist/starter/src/components/ui/Menubar.tsx +236 -0
- package/dist/starter/src/components/ui/NativeSelect.stories.tsx +42 -0
- package/dist/starter/src/components/ui/NativeSelect.tsx +44 -0
- package/dist/starter/src/components/ui/NavigationMenu.stories.tsx +78 -0
- package/dist/starter/src/components/ui/NavigationMenu.tsx +142 -0
- package/dist/starter/src/components/ui/Pagination.stories.tsx +75 -0
- package/dist/starter/src/components/ui/Pagination.tsx +100 -0
- package/dist/starter/src/components/ui/Popover.stories.tsx +51 -0
- package/dist/starter/src/components/ui/Popover.tsx +52 -0
- package/dist/starter/src/components/ui/Progress.stories.tsx +28 -0
- package/dist/starter/src/components/ui/Progress.tsx +24 -0
- package/dist/starter/src/components/ui/RadioGroup.stories.tsx +48 -0
- package/dist/starter/src/components/ui/RadioGroup.tsx +31 -0
- package/dist/starter/src/components/ui/Resizable.stories.tsx +69 -0
- package/dist/starter/src/components/ui/Resizable.tsx +47 -0
- package/dist/starter/src/components/ui/ScrollArea.stories.tsx +43 -0
- package/dist/starter/src/components/ui/ScrollArea.tsx +46 -0
- package/dist/starter/src/components/ui/Select.stories.tsx +57 -0
- package/dist/starter/src/components/ui/Select.tsx +162 -0
- package/dist/starter/src/components/ui/Separator.stories.tsx +40 -0
- package/dist/starter/src/components/ui/Separator.tsx +26 -0
- package/dist/starter/src/components/ui/Sheet.stories.tsx +66 -0
- package/dist/starter/src/components/ui/Sheet.tsx +107 -0
- package/dist/starter/src/components/ui/Sidebar.stories.tsx +94 -0
- package/dist/starter/src/components/ui/Sidebar.tsx +675 -0
- package/dist/starter/src/components/ui/Skeleton.stories.tsx +38 -0
- package/dist/starter/src/components/ui/Skeleton.tsx +7 -0
- package/dist/starter/src/components/ui/Slider.stories.tsx +21 -0
- package/dist/starter/src/components/ui/Slider.tsx +54 -0
- package/dist/starter/src/components/ui/Sonner.stories.tsx +44 -0
- package/dist/starter/src/components/ui/Sonner.tsx +34 -0
- package/dist/starter/src/components/ui/Spinner.stories.tsx +23 -0
- package/dist/starter/src/components/ui/Spinner.tsx +9 -0
- package/dist/starter/src/components/ui/Switch.stories.tsx +35 -0
- package/dist/starter/src/components/ui/Switch.tsx +33 -0
- package/dist/starter/src/components/ui/Table.stories.tsx +65 -0
- package/dist/starter/src/components/ui/Table.tsx +75 -0
- package/dist/starter/src/components/ui/Tabs.stories.tsx +51 -0
- package/dist/starter/src/components/ui/Tabs.tsx +69 -0
- package/dist/starter/src/components/ui/Textarea.stories.tsx +24 -0
- package/dist/starter/src/components/ui/Textarea.tsx +18 -0
- package/dist/starter/src/components/ui/Toast.stories.tsx +112 -0
- package/dist/starter/src/components/ui/Toast.tsx +114 -0
- package/dist/starter/src/components/ui/Toaster.tsx +28 -0
- package/dist/starter/src/components/ui/Toggle.stories.tsx +40 -0
- package/dist/starter/src/components/ui/Toggle.tsx +41 -0
- package/dist/starter/src/components/ui/ToggleGroup.stories.tsx +58 -0
- package/dist/starter/src/components/ui/ToggleGroup.tsx +80 -0
- package/dist/starter/src/components/ui/Tooltip.stories.tsx +40 -0
- package/dist/starter/src/components/ui/Tooltip.tsx +42 -0
- package/dist/starter/src/hooks/use-mobile.ts +19 -0
- package/dist/starter/src/hooks/use-toast.ts +186 -0
- package/dist/starter/src/index.css +123 -0
- package/dist/starter/src/lib/utils.ts +6 -0
- package/dist/starter/src/main.tsx +5 -0
- package/dist/starter/tsconfig.app.json +25 -0
- package/dist/starter/tsconfig.json +4 -0
- package/dist/starter/vite.config.ts +16 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
interface TypographyRowProps {
|
|
4
|
+
label: string;
|
|
5
|
+
className: string;
|
|
6
|
+
sample?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function TypographyRow({ label, className, sample }: TypographyRowProps) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex flex-col gap-1 border-b border-border pb-4">
|
|
12
|
+
<div className="flex items-baseline gap-3">
|
|
13
|
+
<span className="text-xs font-mono text-muted-foreground min-w-[120px] shrink-0">{label}</span>
|
|
14
|
+
<code className="text-xs bg-muted px-1.5 py-0.5 rounded font-mono">{className}</code>
|
|
15
|
+
</div>
|
|
16
|
+
<div className={className}>{sample ?? 'The quick brown fox jumps over the lazy dog'}</div>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function TypographyScale() {
|
|
22
|
+
return (
|
|
23
|
+
<div className="flex flex-col gap-6 max-w-3xl">
|
|
24
|
+
<div className="flex flex-col gap-1 pb-4">
|
|
25
|
+
<h2 className="text-2xl font-semibold">Typography Scale</h2>
|
|
26
|
+
<p className="text-sm text-muted-foreground">
|
|
27
|
+
Visual reference for typography classes used throughout the design system.
|
|
28
|
+
</p>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div className="flex flex-col gap-6">
|
|
32
|
+
<h3 className="text-lg font-semibold text-muted-foreground uppercase tracking-wide">Headings</h3>
|
|
33
|
+
<TypographyRow label="H1" className="text-5xl font-extrabold tracking-tight" sample="Display Heading" />
|
|
34
|
+
<TypographyRow label="H2" className="text-4xl font-bold tracking-tight" sample="Page Heading" />
|
|
35
|
+
<TypographyRow label="H3" className="text-3xl font-bold" sample="Section Heading" />
|
|
36
|
+
<TypographyRow label="H4" className="text-2xl font-semibold" sample="Subsection Heading" />
|
|
37
|
+
<TypographyRow label="H5" className="text-xl font-semibold" sample="Card Heading" />
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div className="flex flex-col gap-6 mt-4">
|
|
41
|
+
<h3 className="text-lg font-semibold text-muted-foreground uppercase tracking-wide">Body</h3>
|
|
42
|
+
<TypographyRow
|
|
43
|
+
label="Body (lead)"
|
|
44
|
+
className="text-base leading-relaxed"
|
|
45
|
+
sample="Body text with relaxed leading for longer paragraphs. This style improves readability for multi-line content blocks."
|
|
46
|
+
/>
|
|
47
|
+
<TypographyRow
|
|
48
|
+
label="Body"
|
|
49
|
+
className="text-base"
|
|
50
|
+
sample="Default body text used for general content and UI labels."
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div className="flex flex-col gap-6 mt-4">
|
|
55
|
+
<h3 className="text-lg font-semibold text-muted-foreground uppercase tracking-wide">Muted & Small</h3>
|
|
56
|
+
<TypographyRow
|
|
57
|
+
label="Muted"
|
|
58
|
+
className="text-sm text-muted-foreground"
|
|
59
|
+
sample="Secondary text for descriptions, help text, and supplementary information."
|
|
60
|
+
/>
|
|
61
|
+
<TypographyRow
|
|
62
|
+
label="Small / Caption"
|
|
63
|
+
className="text-xs text-muted-foreground"
|
|
64
|
+
sample="Captions, timestamps, and fine-print details."
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const meta: Meta = {
|
|
72
|
+
title: 'Design System/Typography',
|
|
73
|
+
};
|
|
74
|
+
export default meta;
|
|
75
|
+
type Story = StoryObj;
|
|
76
|
+
|
|
77
|
+
export const TypeScale: Story = {
|
|
78
|
+
render: () => <TypographyScale />,
|
|
79
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import {
|
|
3
|
+
Dialog,
|
|
4
|
+
DialogContent,
|
|
5
|
+
DialogDescription,
|
|
6
|
+
DialogFooter,
|
|
7
|
+
DialogHeader,
|
|
8
|
+
DialogTitle,
|
|
9
|
+
DialogTrigger,
|
|
10
|
+
} from '@/components/ui/Dialog';
|
|
11
|
+
import { Button } from '@/components/ui/Button';
|
|
12
|
+
import { Input } from '@/components/ui/Input';
|
|
13
|
+
import { Label } from '@/components/ui/Label';
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof Dialog> = {
|
|
16
|
+
title: 'Dialog',
|
|
17
|
+
component: Dialog,
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof Dialog>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
render: () => (
|
|
24
|
+
<Dialog>
|
|
25
|
+
<DialogTrigger asChild>
|
|
26
|
+
<Button variant="outline">Edit Profile</Button>
|
|
27
|
+
</DialogTrigger>
|
|
28
|
+
<DialogContent className="sm:max-w-[425px]">
|
|
29
|
+
<DialogHeader>
|
|
30
|
+
<DialogTitle>Edit profile</DialogTitle>
|
|
31
|
+
<DialogDescription>Make changes to your profile here. Click save when you are done.</DialogDescription>
|
|
32
|
+
</DialogHeader>
|
|
33
|
+
<div className="grid gap-4 py-4">
|
|
34
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
35
|
+
<Label htmlFor="name" className="text-right">
|
|
36
|
+
Name
|
|
37
|
+
</Label>
|
|
38
|
+
<Input id="name" defaultValue="John Doe" className="col-span-3" />
|
|
39
|
+
</div>
|
|
40
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
41
|
+
<Label htmlFor="username" className="text-right">
|
|
42
|
+
Username
|
|
43
|
+
</Label>
|
|
44
|
+
<Input id="username" defaultValue="@johndoe" className="col-span-3" />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<DialogFooter>
|
|
48
|
+
<Button type="submit">Save changes</Button>
|
|
49
|
+
</DialogFooter>
|
|
50
|
+
</DialogContent>
|
|
51
|
+
</Dialog>
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const WithCloseButton: Story = {
|
|
56
|
+
render: () => (
|
|
57
|
+
<Dialog>
|
|
58
|
+
<DialogTrigger asChild>
|
|
59
|
+
<Button variant="outline">Open Dialog</Button>
|
|
60
|
+
</DialogTrigger>
|
|
61
|
+
<DialogContent>
|
|
62
|
+
<DialogHeader>
|
|
63
|
+
<DialogTitle>Confirm Action</DialogTitle>
|
|
64
|
+
<DialogDescription>Are you sure you want to proceed? This action cannot be undone.</DialogDescription>
|
|
65
|
+
</DialogHeader>
|
|
66
|
+
<DialogFooter showCloseButton>
|
|
67
|
+
<Button variant="destructive">Confirm</Button>
|
|
68
|
+
</DialogFooter>
|
|
69
|
+
</DialogContent>
|
|
70
|
+
</Dialog>
|
|
71
|
+
),
|
|
72
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { XIcon } from 'lucide-react';
|
|
3
|
+
import { Dialog as DialogPrimitive } from 'radix-ui';
|
|
4
|
+
|
|
5
|
+
import { cn } from '@/lib/utils';
|
|
6
|
+
import { Button } from '@/components/ui/Button';
|
|
7
|
+
|
|
8
|
+
function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
9
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
13
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
17
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
21
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
25
|
+
return (
|
|
26
|
+
<DialogPrimitive.Overlay
|
|
27
|
+
data-slot="dialog-overlay"
|
|
28
|
+
className={cn(
|
|
29
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function DialogContent({
|
|
38
|
+
className,
|
|
39
|
+
children,
|
|
40
|
+
showCloseButton = true,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
43
|
+
showCloseButton?: boolean;
|
|
44
|
+
}) {
|
|
45
|
+
return (
|
|
46
|
+
<DialogPortal data-slot="dialog-portal">
|
|
47
|
+
<DialogOverlay />
|
|
48
|
+
<DialogPrimitive.Content
|
|
49
|
+
data-slot="dialog-content"
|
|
50
|
+
className={cn(
|
|
51
|
+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg',
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
{showCloseButton && (
|
|
58
|
+
<DialogPrimitive.Close
|
|
59
|
+
data-slot="dialog-close"
|
|
60
|
+
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
61
|
+
>
|
|
62
|
+
<XIcon />
|
|
63
|
+
<span className="sr-only">Close</span>
|
|
64
|
+
</DialogPrimitive.Close>
|
|
65
|
+
)}
|
|
66
|
+
</DialogPrimitive.Content>
|
|
67
|
+
</DialogPortal>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
data-slot="dialog-header"
|
|
75
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function DialogFooter({
|
|
82
|
+
className,
|
|
83
|
+
showCloseButton = false,
|
|
84
|
+
children,
|
|
85
|
+
...props
|
|
86
|
+
}: React.ComponentProps<'div'> & {
|
|
87
|
+
showCloseButton?: boolean;
|
|
88
|
+
}) {
|
|
89
|
+
return (
|
|
90
|
+
<div
|
|
91
|
+
data-slot="dialog-footer"
|
|
92
|
+
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
|
|
93
|
+
{...props}
|
|
94
|
+
>
|
|
95
|
+
{children}
|
|
96
|
+
{showCloseButton && (
|
|
97
|
+
<DialogPrimitive.Close asChild>
|
|
98
|
+
<Button variant="outline">Close</Button>
|
|
99
|
+
</DialogPrimitive.Close>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
106
|
+
return (
|
|
107
|
+
<DialogPrimitive.Title
|
|
108
|
+
data-slot="dialog-title"
|
|
109
|
+
className={cn('text-lg leading-none font-semibold', className)}
|
|
110
|
+
{...props}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
116
|
+
return (
|
|
117
|
+
<DialogPrimitive.Description
|
|
118
|
+
data-slot="dialog-description"
|
|
119
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
Dialog,
|
|
127
|
+
DialogClose,
|
|
128
|
+
DialogContent,
|
|
129
|
+
DialogDescription,
|
|
130
|
+
DialogFooter,
|
|
131
|
+
DialogHeader,
|
|
132
|
+
DialogOverlay,
|
|
133
|
+
DialogPortal,
|
|
134
|
+
DialogTitle,
|
|
135
|
+
DialogTrigger,
|
|
136
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { DirectionProvider, useDirection } from '@/components/ui/Direction';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof DirectionProvider> = {
|
|
5
|
+
title: 'Direction',
|
|
6
|
+
component: DirectionProvider,
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof DirectionProvider>;
|
|
10
|
+
|
|
11
|
+
function DirectionDisplay() {
|
|
12
|
+
const direction = useDirection();
|
|
13
|
+
return <p className="text-sm text-muted-foreground">Current direction: {direction ?? 'not set'}</p>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const LTR: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<DirectionProvider dir="ltr">
|
|
19
|
+
<div className="space-y-2">
|
|
20
|
+
<DirectionDisplay />
|
|
21
|
+
<p>This content is rendered in a left-to-right context.</p>
|
|
22
|
+
</div>
|
|
23
|
+
</DirectionProvider>
|
|
24
|
+
),
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const RTL: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<DirectionProvider dir="rtl">
|
|
30
|
+
<div className="space-y-2" dir="rtl">
|
|
31
|
+
<DirectionDisplay />
|
|
32
|
+
<p>This content is rendered in a right-to-left context.</p>
|
|
33
|
+
</div>
|
|
34
|
+
</DirectionProvider>
|
|
35
|
+
),
|
|
36
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Direction } from 'radix-ui';
|
|
5
|
+
|
|
6
|
+
function DirectionProvider({
|
|
7
|
+
dir,
|
|
8
|
+
direction,
|
|
9
|
+
children,
|
|
10
|
+
}: React.ComponentProps<typeof Direction.DirectionProvider> & {
|
|
11
|
+
direction?: React.ComponentProps<typeof Direction.DirectionProvider>['dir'];
|
|
12
|
+
}) {
|
|
13
|
+
return <Direction.DirectionProvider dir={direction ?? dir}>{children}</Direction.DirectionProvider>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const useDirection = Direction.useDirection;
|
|
17
|
+
|
|
18
|
+
export { DirectionProvider, useDirection };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerTrigger,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerHeader,
|
|
7
|
+
DrawerFooter,
|
|
8
|
+
DrawerTitle,
|
|
9
|
+
DrawerDescription,
|
|
10
|
+
DrawerClose,
|
|
11
|
+
} from '@/components/ui/Drawer';
|
|
12
|
+
import { Button } from '@/components/ui/Button';
|
|
13
|
+
|
|
14
|
+
const meta: Meta<typeof Drawer> = {
|
|
15
|
+
title: 'Drawer',
|
|
16
|
+
component: Drawer,
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof Drawer>;
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
render: () => (
|
|
23
|
+
<Drawer>
|
|
24
|
+
<DrawerTrigger asChild>
|
|
25
|
+
<Button variant="outline">Open Drawer</Button>
|
|
26
|
+
</DrawerTrigger>
|
|
27
|
+
<DrawerContent>
|
|
28
|
+
<DrawerHeader>
|
|
29
|
+
<DrawerTitle>Move Goal</DrawerTitle>
|
|
30
|
+
<DrawerDescription>Set your daily activity goal.</DrawerDescription>
|
|
31
|
+
</DrawerHeader>
|
|
32
|
+
<div className="p-4">
|
|
33
|
+
<p className="text-muted-foreground text-sm">Adjust the settings below to configure your preferences.</p>
|
|
34
|
+
</div>
|
|
35
|
+
<DrawerFooter>
|
|
36
|
+
<Button>Submit</Button>
|
|
37
|
+
<DrawerClose asChild>
|
|
38
|
+
<Button variant="outline">Cancel</Button>
|
|
39
|
+
</DrawerClose>
|
|
40
|
+
</DrawerFooter>
|
|
41
|
+
</DrawerContent>
|
|
42
|
+
</Drawer>
|
|
43
|
+
),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const RightSide: Story = {
|
|
47
|
+
render: () => (
|
|
48
|
+
<Drawer direction="right">
|
|
49
|
+
<DrawerTrigger asChild>
|
|
50
|
+
<Button variant="outline">Open Right Drawer</Button>
|
|
51
|
+
</DrawerTrigger>
|
|
52
|
+
<DrawerContent>
|
|
53
|
+
<DrawerHeader>
|
|
54
|
+
<DrawerTitle>Side Panel</DrawerTitle>
|
|
55
|
+
<DrawerDescription>This drawer opens from the right side.</DrawerDescription>
|
|
56
|
+
</DrawerHeader>
|
|
57
|
+
<div className="p-4">
|
|
58
|
+
<p className="text-muted-foreground text-sm">Content goes here.</p>
|
|
59
|
+
</div>
|
|
60
|
+
<DrawerFooter>
|
|
61
|
+
<DrawerClose asChild>
|
|
62
|
+
<Button variant="outline">Close</Button>
|
|
63
|
+
</DrawerClose>
|
|
64
|
+
</DrawerFooter>
|
|
65
|
+
</DrawerContent>
|
|
66
|
+
</Drawer>
|
|
67
|
+
),
|
|
68
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Drawer as DrawerPrimitive } from 'vaul';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
|
|
6
|
+
function Drawer({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
7
|
+
return <DrawerPrimitive.Root data-slot="drawer" {...props} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function DrawerTrigger({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
11
|
+
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function DrawerPortal({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
15
|
+
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function DrawerClose({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
19
|
+
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function DrawerOverlay({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
23
|
+
return (
|
|
24
|
+
<DrawerPrimitive.Overlay
|
|
25
|
+
data-slot="drawer-overlay"
|
|
26
|
+
className={cn(
|
|
27
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function DrawerContent({ className, children, ...props }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
36
|
+
return (
|
|
37
|
+
<DrawerPortal data-slot="drawer-portal">
|
|
38
|
+
<DrawerOverlay />
|
|
39
|
+
<DrawerPrimitive.Content
|
|
40
|
+
data-slot="drawer-content"
|
|
41
|
+
className={cn(
|
|
42
|
+
'group/drawer-content bg-background fixed z-50 flex h-auto flex-col',
|
|
43
|
+
'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b',
|
|
44
|
+
'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t',
|
|
45
|
+
'data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm',
|
|
46
|
+
'data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm',
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
<div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
52
|
+
{children}
|
|
53
|
+
</DrawerPrimitive.Content>
|
|
54
|
+
</DrawerPortal>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
data-slot="drawer-header"
|
|
62
|
+
className={cn(
|
|
63
|
+
'flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left',
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
72
|
+
return <div data-slot="drawer-footer" className={cn('mt-auto flex flex-col gap-2 p-4', className)} {...props} />;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function DrawerTitle({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
76
|
+
return (
|
|
77
|
+
<DrawerPrimitive.Title
|
|
78
|
+
data-slot="drawer-title"
|
|
79
|
+
className={cn('text-foreground font-semibold', className)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function DrawerDescription({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
86
|
+
return (
|
|
87
|
+
<DrawerPrimitive.Description
|
|
88
|
+
data-slot="drawer-description"
|
|
89
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
Drawer,
|
|
97
|
+
DrawerPortal,
|
|
98
|
+
DrawerOverlay,
|
|
99
|
+
DrawerTrigger,
|
|
100
|
+
DrawerClose,
|
|
101
|
+
DrawerContent,
|
|
102
|
+
DrawerHeader,
|
|
103
|
+
DrawerFooter,
|
|
104
|
+
DrawerTitle,
|
|
105
|
+
DrawerDescription,
|
|
106
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import {
|
|
3
|
+
DropdownMenu,
|
|
4
|
+
DropdownMenuTrigger,
|
|
5
|
+
DropdownMenuContent,
|
|
6
|
+
DropdownMenuItem,
|
|
7
|
+
DropdownMenuLabel,
|
|
8
|
+
DropdownMenuSeparator,
|
|
9
|
+
DropdownMenuShortcut,
|
|
10
|
+
DropdownMenuGroup,
|
|
11
|
+
} from '@/components/ui/DropdownMenu';
|
|
12
|
+
import { Button } from '@/components/ui/Button';
|
|
13
|
+
import { UserIcon, SettingsIcon, LogOutIcon, CreditCardIcon } from 'lucide-react';
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof DropdownMenu> = {
|
|
16
|
+
title: 'DropdownMenu',
|
|
17
|
+
component: DropdownMenu,
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof DropdownMenu>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
render: () => (
|
|
24
|
+
<DropdownMenu>
|
|
25
|
+
<DropdownMenuTrigger asChild>
|
|
26
|
+
<Button variant="outline">Open Menu</Button>
|
|
27
|
+
</DropdownMenuTrigger>
|
|
28
|
+
<DropdownMenuContent className="w-56">
|
|
29
|
+
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
30
|
+
<DropdownMenuSeparator />
|
|
31
|
+
<DropdownMenuGroup>
|
|
32
|
+
<DropdownMenuItem>
|
|
33
|
+
<UserIcon />
|
|
34
|
+
<span>Profile</span>
|
|
35
|
+
<DropdownMenuShortcut>Ctrl+P</DropdownMenuShortcut>
|
|
36
|
+
</DropdownMenuItem>
|
|
37
|
+
<DropdownMenuItem>
|
|
38
|
+
<CreditCardIcon />
|
|
39
|
+
<span>Billing</span>
|
|
40
|
+
<DropdownMenuShortcut>Ctrl+B</DropdownMenuShortcut>
|
|
41
|
+
</DropdownMenuItem>
|
|
42
|
+
<DropdownMenuItem>
|
|
43
|
+
<SettingsIcon />
|
|
44
|
+
<span>Settings</span>
|
|
45
|
+
<DropdownMenuShortcut>Ctrl+S</DropdownMenuShortcut>
|
|
46
|
+
</DropdownMenuItem>
|
|
47
|
+
</DropdownMenuGroup>
|
|
48
|
+
<DropdownMenuSeparator />
|
|
49
|
+
<DropdownMenuItem variant="destructive">
|
|
50
|
+
<LogOutIcon />
|
|
51
|
+
<span>Log out</span>
|
|
52
|
+
</DropdownMenuItem>
|
|
53
|
+
</DropdownMenuContent>
|
|
54
|
+
</DropdownMenu>
|
|
55
|
+
),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Simple: Story = {
|
|
59
|
+
render: () => (
|
|
60
|
+
<DropdownMenu>
|
|
61
|
+
<DropdownMenuTrigger asChild>
|
|
62
|
+
<Button variant="outline">Actions</Button>
|
|
63
|
+
</DropdownMenuTrigger>
|
|
64
|
+
<DropdownMenuContent>
|
|
65
|
+
<DropdownMenuItem>Edit</DropdownMenuItem>
|
|
66
|
+
<DropdownMenuItem>Duplicate</DropdownMenuItem>
|
|
67
|
+
<DropdownMenuSeparator />
|
|
68
|
+
<DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
|
|
69
|
+
</DropdownMenuContent>
|
|
70
|
+
</DropdownMenu>
|
|
71
|
+
),
|
|
72
|
+
};
|