@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,48 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/RadioGroup';
|
|
3
|
+
import { Label } from '@/components/ui/Label';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof RadioGroup> = {
|
|
6
|
+
title: 'RadioGroup',
|
|
7
|
+
component: RadioGroup,
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof RadioGroup>;
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<RadioGroup defaultValue="comfortable">
|
|
15
|
+
<div className="flex items-center space-x-2">
|
|
16
|
+
<RadioGroupItem value="default" id="r1" />
|
|
17
|
+
<Label htmlFor="r1">Default</Label>
|
|
18
|
+
</div>
|
|
19
|
+
<div className="flex items-center space-x-2">
|
|
20
|
+
<RadioGroupItem value="comfortable" id="r2" />
|
|
21
|
+
<Label htmlFor="r2">Comfortable</Label>
|
|
22
|
+
</div>
|
|
23
|
+
<div className="flex items-center space-x-2">
|
|
24
|
+
<RadioGroupItem value="compact" id="r3" />
|
|
25
|
+
<Label htmlFor="r3">Compact</Label>
|
|
26
|
+
</div>
|
|
27
|
+
</RadioGroup>
|
|
28
|
+
),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Horizontal: Story = {
|
|
32
|
+
render: () => (
|
|
33
|
+
<RadioGroup defaultValue="medium" className="flex flex-row gap-4">
|
|
34
|
+
<div className="flex items-center space-x-2">
|
|
35
|
+
<RadioGroupItem value="small" id="h1" />
|
|
36
|
+
<Label htmlFor="h1">Small</Label>
|
|
37
|
+
</div>
|
|
38
|
+
<div className="flex items-center space-x-2">
|
|
39
|
+
<RadioGroupItem value="medium" id="h2" />
|
|
40
|
+
<Label htmlFor="h2">Medium</Label>
|
|
41
|
+
</div>
|
|
42
|
+
<div className="flex items-center space-x-2">
|
|
43
|
+
<RadioGroupItem value="large" id="h3" />
|
|
44
|
+
<Label htmlFor="h3">Large</Label>
|
|
45
|
+
</div>
|
|
46
|
+
</RadioGroup>
|
|
47
|
+
),
|
|
48
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CircleIcon } from 'lucide-react';
|
|
3
|
+
import { RadioGroup as RadioGroupPrimitive } from 'radix-ui';
|
|
4
|
+
|
|
5
|
+
import { cn } from '@/lib/utils';
|
|
6
|
+
|
|
7
|
+
function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
|
8
|
+
return <RadioGroupPrimitive.Root data-slot="radio-group" className={cn('grid gap-3', className)} {...props} />;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
|
|
12
|
+
return (
|
|
13
|
+
<RadioGroupPrimitive.Item
|
|
14
|
+
data-slot="radio-group-item"
|
|
15
|
+
className={cn(
|
|
16
|
+
'border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
<RadioGroupPrimitive.Indicator
|
|
22
|
+
data-slot="radio-group-indicator"
|
|
23
|
+
className="relative flex items-center justify-center"
|
|
24
|
+
>
|
|
25
|
+
<CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
|
|
26
|
+
</RadioGroupPrimitive.Indicator>
|
|
27
|
+
</RadioGroupPrimitive.Item>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from '@/components/ui/Resizable';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof ResizablePanelGroup> = {
|
|
5
|
+
title: 'Resizable',
|
|
6
|
+
component: ResizablePanelGroup,
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof ResizablePanelGroup>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
render: () => (
|
|
13
|
+
<ResizablePanelGroup orientation="horizontal" className="min-h-[200px] max-w-md rounded-lg border">
|
|
14
|
+
<ResizablePanel defaultSize={50}>
|
|
15
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
16
|
+
<span className="font-semibold">Panel One</span>
|
|
17
|
+
</div>
|
|
18
|
+
</ResizablePanel>
|
|
19
|
+
<ResizableHandle />
|
|
20
|
+
<ResizablePanel defaultSize={50}>
|
|
21
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
22
|
+
<span className="font-semibold">Panel Two</span>
|
|
23
|
+
</div>
|
|
24
|
+
</ResizablePanel>
|
|
25
|
+
</ResizablePanelGroup>
|
|
26
|
+
),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const WithHandle: Story = {
|
|
30
|
+
render: () => (
|
|
31
|
+
<ResizablePanelGroup orientation="horizontal" className="min-h-[200px] max-w-md rounded-lg border">
|
|
32
|
+
<ResizablePanel defaultSize={30}>
|
|
33
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
34
|
+
<span className="font-semibold">Sidebar</span>
|
|
35
|
+
</div>
|
|
36
|
+
</ResizablePanel>
|
|
37
|
+
<ResizableHandle withHandle />
|
|
38
|
+
<ResizablePanel defaultSize={70}>
|
|
39
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
40
|
+
<span className="font-semibold">Content</span>
|
|
41
|
+
</div>
|
|
42
|
+
</ResizablePanel>
|
|
43
|
+
</ResizablePanelGroup>
|
|
44
|
+
),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const ThreePanels: Story = {
|
|
48
|
+
render: () => (
|
|
49
|
+
<ResizablePanelGroup orientation="horizontal" className="min-h-[200px] max-w-lg rounded-lg border">
|
|
50
|
+
<ResizablePanel defaultSize={25}>
|
|
51
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
52
|
+
<span className="font-semibold">Left</span>
|
|
53
|
+
</div>
|
|
54
|
+
</ResizablePanel>
|
|
55
|
+
<ResizableHandle withHandle />
|
|
56
|
+
<ResizablePanel defaultSize={50}>
|
|
57
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
58
|
+
<span className="font-semibold">Center</span>
|
|
59
|
+
</div>
|
|
60
|
+
</ResizablePanel>
|
|
61
|
+
<ResizableHandle withHandle />
|
|
62
|
+
<ResizablePanel defaultSize={25}>
|
|
63
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
64
|
+
<span className="font-semibold">Right</span>
|
|
65
|
+
</div>
|
|
66
|
+
</ResizablePanel>
|
|
67
|
+
</ResizablePanelGroup>
|
|
68
|
+
),
|
|
69
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { GripVerticalIcon } from 'lucide-react';
|
|
4
|
+
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
|
+
|
|
8
|
+
function ResizablePanelGroup({ className, ...props }: ResizablePrimitive.GroupProps) {
|
|
9
|
+
return (
|
|
10
|
+
<ResizablePrimitive.Group
|
|
11
|
+
data-slot="resizable-panel-group"
|
|
12
|
+
className={cn('flex h-full w-full aria-[orientation=vertical]:flex-col', className)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
|
|
19
|
+
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ResizableHandle({
|
|
23
|
+
withHandle,
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: ResizablePrimitive.SeparatorProps & {
|
|
27
|
+
withHandle?: boolean;
|
|
28
|
+
}) {
|
|
29
|
+
return (
|
|
30
|
+
<ResizablePrimitive.Separator
|
|
31
|
+
data-slot="resizable-handle"
|
|
32
|
+
className={cn(
|
|
33
|
+
'bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90',
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
>
|
|
38
|
+
{withHandle && (
|
|
39
|
+
<div className="bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border">
|
|
40
|
+
<GripVerticalIcon className="size-2.5" />
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
</ResizablePrimitive.Separator>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ScrollArea, ScrollBar } from '@/components/ui/ScrollArea';
|
|
3
|
+
import { Separator } from '@/components/ui/Separator';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ScrollArea> = {
|
|
6
|
+
title: 'ScrollArea',
|
|
7
|
+
component: ScrollArea,
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof ScrollArea>;
|
|
11
|
+
|
|
12
|
+
const tags = Array.from({ length: 50 }, (_, i) => `Item ${i + 1}`);
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<ScrollArea className="h-72 w-48 rounded-md border">
|
|
17
|
+
<div className="p-4">
|
|
18
|
+
<h4 className="mb-4 text-sm font-medium leading-none">Tags</h4>
|
|
19
|
+
{tags.map((tag) => (
|
|
20
|
+
<div key={tag}>
|
|
21
|
+
<div className="text-sm">{tag}</div>
|
|
22
|
+
<Separator className="my-2" />
|
|
23
|
+
</div>
|
|
24
|
+
))}
|
|
25
|
+
</div>
|
|
26
|
+
</ScrollArea>
|
|
27
|
+
),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Horizontal: Story = {
|
|
31
|
+
render: () => (
|
|
32
|
+
<ScrollArea className="w-96 whitespace-nowrap rounded-md border">
|
|
33
|
+
<div className="flex w-max space-x-4 p-4">
|
|
34
|
+
{Array.from({ length: 20 }, (_, i) => (
|
|
35
|
+
<div key={i} className="bg-muted flex h-24 w-36 shrink-0 items-center justify-center rounded-md">
|
|
36
|
+
<span className="text-sm font-medium">Card {i + 1}</span>
|
|
37
|
+
</div>
|
|
38
|
+
))}
|
|
39
|
+
</div>
|
|
40
|
+
<ScrollBar orientation="horizontal" />
|
|
41
|
+
</ScrollArea>
|
|
42
|
+
),
|
|
43
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
|
|
6
|
+
function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
|
7
|
+
return (
|
|
8
|
+
<ScrollAreaPrimitive.Root data-slot="scroll-area" className={cn('relative', className)} {...props}>
|
|
9
|
+
<ScrollAreaPrimitive.Viewport
|
|
10
|
+
data-slot="scroll-area-viewport"
|
|
11
|
+
className="focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1"
|
|
12
|
+
>
|
|
13
|
+
{children}
|
|
14
|
+
</ScrollAreaPrimitive.Viewport>
|
|
15
|
+
<ScrollBar />
|
|
16
|
+
<ScrollAreaPrimitive.Corner />
|
|
17
|
+
</ScrollAreaPrimitive.Root>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function ScrollBar({
|
|
22
|
+
className,
|
|
23
|
+
orientation = 'vertical',
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
|
26
|
+
return (
|
|
27
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
28
|
+
data-slot="scroll-area-scrollbar"
|
|
29
|
+
orientation={orientation}
|
|
30
|
+
className={cn(
|
|
31
|
+
'flex touch-none p-px transition-colors select-none',
|
|
32
|
+
orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent',
|
|
33
|
+
orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent',
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
>
|
|
38
|
+
<ScrollAreaPrimitive.ScrollAreaThumb
|
|
39
|
+
data-slot="scroll-area-thumb"
|
|
40
|
+
className="bg-border relative flex-1 rounded-full"
|
|
41
|
+
/>
|
|
42
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import {
|
|
3
|
+
Select,
|
|
4
|
+
SelectTrigger,
|
|
5
|
+
SelectValue,
|
|
6
|
+
SelectContent,
|
|
7
|
+
SelectItem,
|
|
8
|
+
SelectGroup,
|
|
9
|
+
SelectLabel,
|
|
10
|
+
} from '@/components/ui/Select';
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof Select> = {
|
|
13
|
+
title: 'Select',
|
|
14
|
+
component: Select,
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof Select>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
render: () => (
|
|
21
|
+
<Select>
|
|
22
|
+
<SelectTrigger className="w-[180px]">
|
|
23
|
+
<SelectValue placeholder="Select a fruit" />
|
|
24
|
+
</SelectTrigger>
|
|
25
|
+
<SelectContent>
|
|
26
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
27
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
28
|
+
<SelectItem value="cherry">Cherry</SelectItem>
|
|
29
|
+
<SelectItem value="grape">Grape</SelectItem>
|
|
30
|
+
<SelectItem value="orange">Orange</SelectItem>
|
|
31
|
+
</SelectContent>
|
|
32
|
+
</Select>
|
|
33
|
+
),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Grouped: Story = {
|
|
37
|
+
render: () => (
|
|
38
|
+
<Select>
|
|
39
|
+
<SelectTrigger className="w-[220px]">
|
|
40
|
+
<SelectValue placeholder="Select a timezone" />
|
|
41
|
+
</SelectTrigger>
|
|
42
|
+
<SelectContent>
|
|
43
|
+
<SelectGroup>
|
|
44
|
+
<SelectLabel>North America</SelectLabel>
|
|
45
|
+
<SelectItem value="est">Eastern Standard Time (EST)</SelectItem>
|
|
46
|
+
<SelectItem value="cst">Central Standard Time (CST)</SelectItem>
|
|
47
|
+
<SelectItem value="pst">Pacific Standard Time (PST)</SelectItem>
|
|
48
|
+
</SelectGroup>
|
|
49
|
+
<SelectGroup>
|
|
50
|
+
<SelectLabel>Europe</SelectLabel>
|
|
51
|
+
<SelectItem value="gmt">Greenwich Mean Time (GMT)</SelectItem>
|
|
52
|
+
<SelectItem value="cet">Central European Time (CET)</SelectItem>
|
|
53
|
+
</SelectGroup>
|
|
54
|
+
</SelectContent>
|
|
55
|
+
</Select>
|
|
56
|
+
),
|
|
57
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
|
5
|
+
import { Select as SelectPrimitive } from 'radix-ui';
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
|
|
9
|
+
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
10
|
+
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
14
|
+
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
18
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function SelectTrigger({
|
|
22
|
+
className,
|
|
23
|
+
size = 'default',
|
|
24
|
+
children,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
27
|
+
size?: 'sm' | 'default';
|
|
28
|
+
}) {
|
|
29
|
+
return (
|
|
30
|
+
<SelectPrimitive.Trigger
|
|
31
|
+
data-slot="select-trigger"
|
|
32
|
+
data-size={size}
|
|
33
|
+
className={cn(
|
|
34
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
<SelectPrimitive.Icon asChild>
|
|
41
|
+
<ChevronDownIcon className="size-4 opacity-50" />
|
|
42
|
+
</SelectPrimitive.Icon>
|
|
43
|
+
</SelectPrimitive.Trigger>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function SelectContent({
|
|
48
|
+
className,
|
|
49
|
+
children,
|
|
50
|
+
position = 'item-aligned',
|
|
51
|
+
align = 'center',
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
54
|
+
return (
|
|
55
|
+
<SelectPrimitive.Portal>
|
|
56
|
+
<SelectPrimitive.Content
|
|
57
|
+
data-slot="select-content"
|
|
58
|
+
className={cn(
|
|
59
|
+
'bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
|
|
60
|
+
position === 'popper' &&
|
|
61
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
position={position}
|
|
65
|
+
align={align}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
<SelectScrollUpButton />
|
|
69
|
+
<SelectPrimitive.Viewport
|
|
70
|
+
className={cn(
|
|
71
|
+
'p-1',
|
|
72
|
+
position === 'popper' &&
|
|
73
|
+
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1',
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
</SelectPrimitive.Viewport>
|
|
78
|
+
<SelectScrollDownButton />
|
|
79
|
+
</SelectPrimitive.Content>
|
|
80
|
+
</SelectPrimitive.Portal>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
85
|
+
return (
|
|
86
|
+
<SelectPrimitive.Label
|
|
87
|
+
data-slot="select-label"
|
|
88
|
+
className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
95
|
+
return (
|
|
96
|
+
<SelectPrimitive.Item
|
|
97
|
+
data-slot="select-item"
|
|
98
|
+
className={cn(
|
|
99
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
100
|
+
className,
|
|
101
|
+
)}
|
|
102
|
+
{...props}
|
|
103
|
+
>
|
|
104
|
+
<span data-slot="select-item-indicator" className="absolute right-2 flex size-3.5 items-center justify-center">
|
|
105
|
+
<SelectPrimitive.ItemIndicator>
|
|
106
|
+
<CheckIcon className="size-4" />
|
|
107
|
+
</SelectPrimitive.ItemIndicator>
|
|
108
|
+
</span>
|
|
109
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
110
|
+
</SelectPrimitive.Item>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
115
|
+
return (
|
|
116
|
+
<SelectPrimitive.Separator
|
|
117
|
+
data-slot="select-separator"
|
|
118
|
+
className={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}
|
|
119
|
+
{...props}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
125
|
+
return (
|
|
126
|
+
<SelectPrimitive.ScrollUpButton
|
|
127
|
+
data-slot="select-scroll-up-button"
|
|
128
|
+
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
|
129
|
+
{...props}
|
|
130
|
+
>
|
|
131
|
+
<ChevronUpIcon className="size-4" />
|
|
132
|
+
</SelectPrimitive.ScrollUpButton>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function SelectScrollDownButton({
|
|
137
|
+
className,
|
|
138
|
+
...props
|
|
139
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
140
|
+
return (
|
|
141
|
+
<SelectPrimitive.ScrollDownButton
|
|
142
|
+
data-slot="select-scroll-down-button"
|
|
143
|
+
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
|
144
|
+
{...props}
|
|
145
|
+
>
|
|
146
|
+
<ChevronDownIcon className="size-4" />
|
|
147
|
+
</SelectPrimitive.ScrollDownButton>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export {
|
|
152
|
+
Select,
|
|
153
|
+
SelectContent,
|
|
154
|
+
SelectGroup,
|
|
155
|
+
SelectItem,
|
|
156
|
+
SelectLabel,
|
|
157
|
+
SelectScrollDownButton,
|
|
158
|
+
SelectScrollUpButton,
|
|
159
|
+
SelectSeparator,
|
|
160
|
+
SelectTrigger,
|
|
161
|
+
SelectValue,
|
|
162
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Separator } from '@/components/ui/Separator';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Separator> = {
|
|
5
|
+
title: 'Separator',
|
|
6
|
+
component: Separator,
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof Separator>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
render: () => (
|
|
13
|
+
<div>
|
|
14
|
+
<div className="space-y-1">
|
|
15
|
+
<h4 className="text-sm font-medium leading-none">Radix Primitives</h4>
|
|
16
|
+
<p className="text-muted-foreground text-sm">An open-source UI component library.</p>
|
|
17
|
+
</div>
|
|
18
|
+
<Separator className="my-4" />
|
|
19
|
+
<div className="flex h-5 items-center space-x-4 text-sm">
|
|
20
|
+
<div>Blog</div>
|
|
21
|
+
<Separator orientation="vertical" />
|
|
22
|
+
<div>Docs</div>
|
|
23
|
+
<Separator orientation="vertical" />
|
|
24
|
+
<div>Source</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Vertical: Story = {
|
|
31
|
+
render: () => (
|
|
32
|
+
<div className="flex h-12 items-center space-x-4 text-sm">
|
|
33
|
+
<div>First</div>
|
|
34
|
+
<Separator orientation="vertical" />
|
|
35
|
+
<div>Second</div>
|
|
36
|
+
<Separator orientation="vertical" />
|
|
37
|
+
<div>Third</div>
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Separator as SeparatorPrimitive } from 'radix-ui';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
|
|
6
|
+
function Separator({
|
|
7
|
+
className,
|
|
8
|
+
orientation = 'horizontal',
|
|
9
|
+
decorative = true,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<SeparatorPrimitive.Root
|
|
14
|
+
data-slot="separator"
|
|
15
|
+
decorative={decorative}
|
|
16
|
+
orientation={orientation}
|
|
17
|
+
className={cn(
|
|
18
|
+
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Separator };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription } from '@/components/ui/Sheet';
|
|
3
|
+
import { Button } from '@/components/ui/Button';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Sheet> = {
|
|
6
|
+
title: 'Sheet',
|
|
7
|
+
component: Sheet,
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Sheet>;
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<Sheet>
|
|
15
|
+
<SheetTrigger asChild>
|
|
16
|
+
<Button variant="outline">Open Sheet</Button>
|
|
17
|
+
</SheetTrigger>
|
|
18
|
+
<SheetContent>
|
|
19
|
+
<SheetHeader>
|
|
20
|
+
<SheetTitle>Edit Profile</SheetTitle>
|
|
21
|
+
<SheetDescription>Make changes to your profile here. Click save when you are done.</SheetDescription>
|
|
22
|
+
</SheetHeader>
|
|
23
|
+
<div className="grid gap-4 px-4 py-4">
|
|
24
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
25
|
+
<span className="text-right text-sm">Name</span>
|
|
26
|
+
<input className="border-input col-span-3 h-9 rounded-md border px-3 text-sm" defaultValue="John Doe" />
|
|
27
|
+
</div>
|
|
28
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
29
|
+
<span className="text-right text-sm">Username</span>
|
|
30
|
+
<input className="border-input col-span-3 h-9 rounded-md border px-3 text-sm" defaultValue="@johndoe" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</SheetContent>
|
|
34
|
+
</Sheet>
|
|
35
|
+
),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const LeftSide: Story = {
|
|
39
|
+
render: () => (
|
|
40
|
+
<Sheet>
|
|
41
|
+
<SheetTrigger asChild>
|
|
42
|
+
<Button variant="outline">Open Left Sheet</Button>
|
|
43
|
+
</SheetTrigger>
|
|
44
|
+
<SheetContent side="left">
|
|
45
|
+
<SheetHeader>
|
|
46
|
+
<SheetTitle>Navigation</SheetTitle>
|
|
47
|
+
<SheetDescription>Browse through the application.</SheetDescription>
|
|
48
|
+
</SheetHeader>
|
|
49
|
+
<nav className="grid gap-2 px-4 py-4">
|
|
50
|
+
<a href="#" className="text-sm hover:underline">
|
|
51
|
+
Home
|
|
52
|
+
</a>
|
|
53
|
+
<a href="#" className="text-sm hover:underline">
|
|
54
|
+
About
|
|
55
|
+
</a>
|
|
56
|
+
<a href="#" className="text-sm hover:underline">
|
|
57
|
+
Settings
|
|
58
|
+
</a>
|
|
59
|
+
<a href="#" className="text-sm hover:underline">
|
|
60
|
+
Help
|
|
61
|
+
</a>
|
|
62
|
+
</nav>
|
|
63
|
+
</SheetContent>
|
|
64
|
+
</Sheet>
|
|
65
|
+
),
|
|
66
|
+
};
|