@auto-engineer/generate-react-client 1.64.0 → 1.66.0
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 +140 -0
- package/dist/starter/.storybook/main.ts +17 -22
- package/dist/starter/.storybook/manager-head.html +31 -31
- package/dist/starter/.storybook/manager.ts +133 -133
- package/dist/starter/.storybook/preview-head.html +12 -12
- package/dist/starter/.storybook/preview.tsx +79 -79
- package/dist/starter/biome.json +126 -0
- package/dist/starter/codegen.ts +11 -11
- package/dist/starter/components.json +27 -27
- package/dist/starter/package.json +86 -80
- package/dist/starter/public/mockServiceWorker.js +261 -261
- package/dist/starter/scripts/build-component-db.ts +17 -20
- package/dist/starter/src/App.tsx +15 -17
- package/dist/starter/src/components/ui/Accordion.stories.tsx +35 -35
- package/dist/starter/src/components/ui/Accordion.tsx +33 -33
- package/dist/starter/src/components/ui/Alert.stories.tsx +15 -15
- package/dist/starter/src/components/ui/Alert.tsx +32 -32
- package/dist/starter/src/components/ui/AlertDialog.stories.tsx +50 -50
- package/dist/starter/src/components/ui/AlertDialog.tsx +114 -115
- package/dist/starter/src/components/ui/AspectRatio.stories.tsx +20 -20
- package/dist/starter/src/components/ui/AspectRatio.tsx +1 -1
- package/dist/starter/src/components/ui/Avatar.stories.tsx +27 -27
- package/dist/starter/src/components/ui/Avatar.tsx +63 -63
- package/dist/starter/src/components/ui/Badge.stories.tsx +14 -14
- package/dist/starter/src/components/ui/Badge.tsx +27 -27
- package/dist/starter/src/components/ui/Breadcrumb.stories.tsx +38 -38
- package/dist/starter/src/components/ui/Breadcrumb.tsx +63 -62
- package/dist/starter/src/components/ui/Button.stories.tsx +55 -55
- package/dist/starter/src/components/ui/Button.tsx +49 -49
- package/dist/starter/src/components/ui/ButtonGroup.stories.tsx +17 -17
- package/dist/starter/src/components/ui/ButtonGroup.tsx +52 -53
- package/dist/starter/src/components/ui/Calendar.stories.tsx +20 -19
- package/dist/starter/src/components/ui/Calendar.tsx +142 -143
- package/dist/starter/src/components/ui/Card.stories.tsx +29 -29
- package/dist/starter/src/components/ui/Card.tsx +31 -31
- package/dist/starter/src/components/ui/Carousel.stories.tsx +41 -41
- package/dist/starter/src/components/ui/Carousel.tsx +171 -172
- package/dist/starter/src/components/ui/Chart.stories.tsx +21 -21
- package/dist/starter/src/components/ui/Chart.tsx +244 -247
- package/dist/starter/src/components/ui/Checkbox.stories.tsx +11 -11
- package/dist/starter/src/components/ui/Checkbox.tsx +18 -18
- package/dist/starter/src/components/ui/Collapsible.stories.tsx +40 -40
- package/dist/starter/src/components/ui/Collapsible.tsx +3 -3
- package/dist/starter/src/components/ui/Combobox.stories.tsx +48 -48
- package/dist/starter/src/components/ui/Combobox.tsx +204 -205
- package/dist/starter/src/components/ui/Command.stories.tsx +55 -55
- package/dist/starter/src/components/ui/Command.tsx +102 -103
- package/dist/starter/src/components/ui/ContextMenu.stories.tsx +52 -52
- package/dist/starter/src/components/ui/ContextMenu.tsx +151 -151
- package/dist/starter/src/components/ui/DesignSystem-Colors.stories.tsx +92 -92
- package/dist/starter/src/components/ui/DesignSystem-Layout.stories.tsx +139 -139
- package/dist/starter/src/components/ui/DesignSystem-Overview.stories.tsx +676 -657
- package/dist/starter/src/components/ui/DesignSystem-Typography.stories.tsx +59 -59
- package/dist/starter/src/components/ui/Dialog.stories.tsx +56 -56
- package/dist/starter/src/components/ui/Dialog.tsx +97 -98
- package/dist/starter/src/components/ui/Direction.stories.tsx +20 -20
- package/dist/starter/src/components/ui/Direction.tsx +7 -7
- package/dist/starter/src/components/ui/Drawer.stories.tsx +54 -54
- package/dist/starter/src/components/ui/Drawer.tsx +70 -70
- package/dist/starter/src/components/ui/DropdownMenu.stories.tsx +58 -58
- package/dist/starter/src/components/ui/DropdownMenu.tsx +157 -157
- package/dist/starter/src/components/ui/Empty.stories.tsx +22 -22
- package/dist/starter/src/components/ui/Empty.tsx +58 -58
- package/dist/starter/src/components/ui/Field.stories.tsx +31 -31
- package/dist/starter/src/components/ui/Field.tsx +180 -181
- package/dist/starter/src/components/ui/Form.stories.tsx +29 -29
- package/dist/starter/src/components/ui/Form.tsx +93 -96
- package/dist/starter/src/components/ui/HoverCard.stories.tsx +34 -34
- package/dist/starter/src/components/ui/HoverCard.tsx +21 -21
- package/dist/starter/src/components/ui/Input.stories.tsx +18 -18
- package/dist/starter/src/components/ui/Input.tsx +14 -14
- package/dist/starter/src/components/ui/InputGroup.stories.tsx +34 -34
- package/dist/starter/src/components/ui/InputGroup.tsx +110 -111
- package/dist/starter/src/components/ui/InputOTP.stories.tsx +28 -28
- package/dist/starter/src/components/ui/InputOTP.tsx +43 -43
- package/dist/starter/src/components/ui/Item.stories.tsx +45 -45
- package/dist/starter/src/components/ui/Item.tsx +113 -114
- package/dist/starter/src/components/ui/Kbd.stories.tsx +31 -31
- package/dist/starter/src/components/ui/Kbd.tsx +11 -11
- package/dist/starter/src/components/ui/Label.stories.tsx +62 -62
- package/dist/starter/src/components/ui/Label.tsx +26 -25
- package/dist/starter/src/components/ui/Menubar.stories.tsx +62 -62
- package/dist/starter/src/components/ui/Menubar.tsx +173 -173
- package/dist/starter/src/components/ui/NativeSelect.stories.tsx +26 -26
- package/dist/starter/src/components/ui/NativeSelect.tsx +29 -29
- package/dist/starter/src/components/ui/NavigationMenu.stories.tsx +64 -64
- package/dist/starter/src/components/ui/NavigationMenu.tsx +103 -103
- package/dist/starter/src/components/ui/Pagination.stories.tsx +61 -61
- package/dist/starter/src/components/ui/Pagination.tsx +69 -71
- package/dist/starter/src/components/ui/Popover.stories.tsx +38 -38
- package/dist/starter/src/components/ui/Popover.tsx +25 -25
- package/dist/starter/src/components/ui/Progress.stories.tsx +9 -9
- package/dist/starter/src/components/ui/Progress.tsx +14 -14
- package/dist/starter/src/components/ui/RadioGroup.stories.tsx +35 -35
- package/dist/starter/src/components/ui/RadioGroup.tsx +19 -19
- package/dist/starter/src/components/ui/Resizable.stories.tsx +54 -54
- package/dist/starter/src/components/ui/Resizable.tsx +29 -29
- package/dist/starter/src/components/ui/ScrollArea.stories.tsx +27 -27
- package/dist/starter/src/components/ui/ScrollArea.tsx +34 -34
- package/dist/starter/src/components/ui/Select.stories.tsx +43 -43
- package/dist/starter/src/components/ui/Select.tsx +120 -120
- package/dist/starter/src/components/ui/Separator.stories.tsx +27 -27
- package/dist/starter/src/components/ui/Separator.tsx +17 -17
- package/dist/starter/src/components/ui/Sheet.stories.tsx +53 -53
- package/dist/starter/src/components/ui/Sheet.tsx +69 -69
- package/dist/starter/src/components/ui/Sidebar.stories.tsx +77 -77
- package/dist/starter/src/components/ui/Sidebar.tsx +563 -564
- package/dist/starter/src/components/ui/Skeleton.stories.tsx +25 -25
- package/dist/starter/src/components/ui/Skeleton.tsx +1 -1
- package/dist/starter/src/components/ui/Slider.stories.tsx +5 -5
- package/dist/starter/src/components/ui/Slider.tsx +45 -44
- package/dist/starter/src/components/ui/Sonner.stories.tsx +32 -32
- package/dist/starter/src/components/ui/Sonner.tsx +23 -23
- package/dist/starter/src/components/ui/Spinner.stories.tsx +8 -8
- package/dist/starter/src/components/ui/Spinner.tsx +1 -1
- package/dist/starter/src/components/ui/Switch.stories.tsx +16 -17
- package/dist/starter/src/components/ui/Switch.tsx +24 -24
- package/dist/starter/src/components/ui/Table.stories.tsx +50 -50
- package/dist/starter/src/components/ui/Table.tsx +45 -45
- package/dist/starter/src/components/ui/Tabs.stories.tsx +39 -39
- package/dist/starter/src/components/ui/Tabs.tsx +47 -47
- package/dist/starter/src/components/ui/Textarea.stories.tsx +9 -9
- package/dist/starter/src/components/ui/Textarea.tsx +11 -11
- package/dist/starter/src/components/ui/Toast.stories.tsx +77 -77
- package/dist/starter/src/components/ui/Toast.tsx +75 -75
- package/dist/starter/src/components/ui/Toaster.tsx +17 -19
- package/dist/starter/src/components/ui/Toggle.stories.tsx +20 -20
- package/dist/starter/src/components/ui/Toggle.tsx +26 -26
- package/dist/starter/src/components/ui/ToggleGroup.stories.tsx +41 -41
- package/dist/starter/src/components/ui/ToggleGroup.tsx +61 -62
- package/dist/starter/src/components/ui/Tooltip.stories.tsx +26 -26
- package/dist/starter/src/components/ui/Tooltip.tsx +24 -24
- package/dist/starter/src/gql/execute.ts +1 -1
- package/dist/starter/src/gql/fragment-masking.ts +1 -1
- package/dist/starter/src/gql/graphql.ts +3 -0
- package/dist/starter/src/hooks/use-mobile.ts +11 -11
- package/dist/starter/src/hooks/use-toast.ts +135 -135
- package/dist/starter/src/index.css +105 -105
- package/dist/starter/src/lib/utils.ts +1 -1
- package/dist/starter/src/main.tsx +4 -1
- package/dist/starter/tsconfig.app.json +24 -24
- package/dist/starter/tsconfig.json +8 -8
- package/dist/starter/vite.config.ts +38 -37
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,80 +1,80 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
3
|
interface TypographyRowProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
label: string;
|
|
5
|
+
className: string;
|
|
6
|
+
sample?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function TypographyRow({ label, className, sample }: TypographyRowProps) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
19
|
}
|
|
20
20
|
|
|
21
21
|
function TypographyScale() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
69
|
}
|
|
70
70
|
|
|
71
71
|
const meta: Meta = {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
title: 'Design System/Typography',
|
|
73
|
+
tags: ['!autodocs', '!manifest'],
|
|
74
74
|
};
|
|
75
75
|
export default meta;
|
|
76
76
|
type Story = StoryObj;
|
|
77
77
|
|
|
78
78
|
export const TypeScale: Story = {
|
|
79
|
-
|
|
79
|
+
render: () => <TypographyScale />,
|
|
80
80
|
};
|
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Button } from '@/components/ui/Button';
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogDescription,
|
|
7
|
+
DialogFooter,
|
|
8
|
+
DialogHeader,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
DialogTrigger,
|
|
10
11
|
} from '@/components/ui/Dialog';
|
|
11
|
-
import { Button } from '@/components/ui/Button';
|
|
12
12
|
import { Input } from '@/components/ui/Input';
|
|
13
13
|
import { Label } from '@/components/ui/Label';
|
|
14
14
|
|
|
15
15
|
const meta: Meta<typeof Dialog> = {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
title: 'UI Components/Dialog',
|
|
17
|
+
component: Dialog,
|
|
18
18
|
};
|
|
19
19
|
export default meta;
|
|
20
20
|
type Story = StoryObj<typeof Dialog>;
|
|
21
21
|
|
|
22
22
|
/** Shows a dialog with a form for editing profile information. */
|
|
23
23
|
export const Default: Story = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
24
|
+
render: () => (
|
|
25
|
+
<Dialog>
|
|
26
|
+
<DialogTrigger asChild>
|
|
27
|
+
<Button variant="outline">Edit Profile</Button>
|
|
28
|
+
</DialogTrigger>
|
|
29
|
+
<DialogContent className="sm:max-w-[425px]">
|
|
30
|
+
<DialogHeader>
|
|
31
|
+
<DialogTitle>Edit profile</DialogTitle>
|
|
32
|
+
<DialogDescription>Make changes to your profile here. Click save when you are done.</DialogDescription>
|
|
33
|
+
</DialogHeader>
|
|
34
|
+
<div className="grid gap-4 py-4">
|
|
35
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
36
|
+
<Label htmlFor="name" className="text-right">
|
|
37
|
+
Name
|
|
38
|
+
</Label>
|
|
39
|
+
<Input id="name" defaultValue="John Doe" className="col-span-3" />
|
|
40
|
+
</div>
|
|
41
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
42
|
+
<Label htmlFor="username" className="text-right">
|
|
43
|
+
Username
|
|
44
|
+
</Label>
|
|
45
|
+
<Input id="username" defaultValue="@johndoe" className="col-span-3" />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<DialogFooter>
|
|
49
|
+
<Button type="submit">Save changes</Button>
|
|
50
|
+
</DialogFooter>
|
|
51
|
+
</DialogContent>
|
|
52
|
+
</Dialog>
|
|
53
|
+
),
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
/** Shows a confirmation dialog with a footer close button and a destructive action. */
|
|
57
57
|
export const WithCloseButton: Story = {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
render: () => (
|
|
59
|
+
<Dialog>
|
|
60
|
+
<DialogTrigger asChild>
|
|
61
|
+
<Button variant="outline">Open Dialog</Button>
|
|
62
|
+
</DialogTrigger>
|
|
63
|
+
<DialogContent>
|
|
64
|
+
<DialogHeader>
|
|
65
|
+
<DialogTitle>Confirm Action</DialogTitle>
|
|
66
|
+
<DialogDescription>Are you sure you want to proceed? This action cannot be undone.</DialogDescription>
|
|
67
|
+
</DialogHeader>
|
|
68
|
+
<DialogFooter showCloseButton>
|
|
69
|
+
<Button variant="destructive">Confirm</Button>
|
|
70
|
+
</DialogFooter>
|
|
71
|
+
</DialogContent>
|
|
72
|
+
</Dialog>
|
|
73
|
+
),
|
|
74
74
|
};
|
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { XIcon } from 'lucide-react';
|
|
3
2
|
import { Dialog as DialogPrimitive } from 'radix-ui';
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/lib/utils';
|
|
3
|
+
import type * as React from 'react';
|
|
6
4
|
import { Button } from '@/components/ui/Button';
|
|
5
|
+
import { cn } from '@/lib/utils';
|
|
7
6
|
|
|
8
7
|
/** A modal overlay with focus trapping and scroll locking. Click outside or press Escape to close. */
|
|
9
8
|
function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
10
|
-
|
|
9
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
/** Button or element that opens the dialog when clicked. */
|
|
14
13
|
function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
15
|
-
|
|
14
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
/** Renders dialog content into a React portal. */
|
|
19
18
|
function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
20
|
-
|
|
19
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
/** Programmatic close trigger for the dialog. */
|
|
24
23
|
function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
25
|
-
|
|
24
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
/** Semi-transparent backdrop behind the dialog that dims the page content. */
|
|
29
28
|
function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
return (
|
|
30
|
+
<DialogPrimitive.Overlay
|
|
31
|
+
data-slot="dialog-overlay"
|
|
32
|
+
className={cn(
|
|
33
|
+
'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',
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
/**
|
|
@@ -44,49 +43,49 @@ function DialogOverlay({ className, ...props }: React.ComponentProps<typeof Dial
|
|
|
44
43
|
* Set showCloseButton={false} to hide the top-right X button.
|
|
45
44
|
*/
|
|
46
45
|
function DialogContent({
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
className,
|
|
47
|
+
children,
|
|
48
|
+
/** Whether to render the close (X) button in the top-right corner. */
|
|
49
|
+
showCloseButton = true,
|
|
50
|
+
...props
|
|
52
51
|
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
53
|
-
|
|
52
|
+
showCloseButton?: boolean;
|
|
54
53
|
}) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
54
|
+
return (
|
|
55
|
+
<DialogPortal data-slot="dialog-portal">
|
|
56
|
+
<DialogOverlay />
|
|
57
|
+
<DialogPrimitive.Content
|
|
58
|
+
data-slot="dialog-content"
|
|
59
|
+
className={cn(
|
|
60
|
+
'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',
|
|
61
|
+
className,
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
{showCloseButton && (
|
|
67
|
+
<DialogPrimitive.Close
|
|
68
|
+
data-slot="dialog-close"
|
|
69
|
+
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"
|
|
70
|
+
>
|
|
71
|
+
<XIcon />
|
|
72
|
+
<span className="sr-only">Close</span>
|
|
73
|
+
</DialogPrimitive.Close>
|
|
74
|
+
)}
|
|
75
|
+
</DialogPrimitive.Content>
|
|
76
|
+
</DialogPortal>
|
|
77
|
+
);
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
/** Container for DialogTitle and DialogDescription at the top of the dialog. */
|
|
82
81
|
function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
return (
|
|
83
|
+
<div
|
|
84
|
+
data-slot="dialog-header"
|
|
85
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
/**
|
|
@@ -94,61 +93,61 @@ function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
94
93
|
* Set showCloseButton to add an automatic "Close" button.
|
|
95
94
|
*/
|
|
96
95
|
function DialogFooter({
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
className,
|
|
97
|
+
/** Whether to append a "Close" button that dismisses the dialog. */
|
|
98
|
+
showCloseButton = false,
|
|
99
|
+
children,
|
|
100
|
+
...props
|
|
102
101
|
}: React.ComponentProps<'div'> & {
|
|
103
|
-
|
|
102
|
+
showCloseButton?: boolean;
|
|
104
103
|
}) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
data-slot="dialog-footer"
|
|
107
|
+
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
|
|
108
|
+
{...props}
|
|
109
|
+
>
|
|
110
|
+
{children}
|
|
111
|
+
{showCloseButton && (
|
|
112
|
+
<DialogPrimitive.Close asChild>
|
|
113
|
+
<Button variant="outline">Close</Button>
|
|
114
|
+
</DialogPrimitive.Close>
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
/** Accessible title for the dialog. Required for screen reader support. */
|
|
122
121
|
function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
return (
|
|
123
|
+
<DialogPrimitive.Title
|
|
124
|
+
data-slot="dialog-title"
|
|
125
|
+
className={cn('text-lg leading-none font-semibold', className)}
|
|
126
|
+
{...props}
|
|
127
|
+
/>
|
|
128
|
+
);
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
/** Accessible description text for the dialog, displayed below the title. */
|
|
133
132
|
function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
133
|
+
return (
|
|
134
|
+
<DialogPrimitive.Description
|
|
135
|
+
data-slot="dialog-description"
|
|
136
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
141
140
|
}
|
|
142
141
|
|
|
143
142
|
export {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
143
|
+
Dialog,
|
|
144
|
+
DialogClose,
|
|
145
|
+
DialogContent,
|
|
146
|
+
DialogDescription,
|
|
147
|
+
DialogFooter,
|
|
148
|
+
DialogHeader,
|
|
149
|
+
DialogOverlay,
|
|
150
|
+
DialogPortal,
|
|
151
|
+
DialogTitle,
|
|
152
|
+
DialogTrigger,
|
|
154
153
|
};
|
|
@@ -2,37 +2,37 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import { DirectionProvider, useDirection } from '@/components/ui/Direction';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof DirectionProvider> = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
title: 'UI Components/Direction',
|
|
6
|
+
component: DirectionProvider,
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof DirectionProvider>;
|
|
10
10
|
|
|
11
11
|
function DirectionDisplay() {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const direction = useDirection();
|
|
13
|
+
return <p className="text-sm text-muted-foreground">Current direction: {direction ?? 'not set'}</p>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/** Shows the DirectionProvider in left-to-right mode. */
|
|
17
17
|
export const LTR: Story = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
render: () => (
|
|
19
|
+
<DirectionProvider dir="ltr">
|
|
20
|
+
<div className="space-y-2">
|
|
21
|
+
<DirectionDisplay />
|
|
22
|
+
<p>This content is rendered in a left-to-right context.</p>
|
|
23
|
+
</div>
|
|
24
|
+
</DirectionProvider>
|
|
25
|
+
),
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
/** Shows the DirectionProvider in right-to-left mode for internationalization support. */
|
|
29
29
|
export const RTL: Story = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
render: () => (
|
|
31
|
+
<DirectionProvider dir="rtl">
|
|
32
|
+
<div className="space-y-2" dir="rtl">
|
|
33
|
+
<DirectionDisplay />
|
|
34
|
+
<p>This content is rendered in a right-to-left context.</p>
|
|
35
|
+
</div>
|
|
36
|
+
</DirectionProvider>
|
|
37
|
+
),
|
|
38
38
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { Direction } from 'radix-ui';
|
|
4
|
+
import type * as React from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Provides text direction (LTR/RTL) context to all descendant Radix UI components.
|
|
8
8
|
* Accepts either `dir` or `direction` prop for convenience.
|
|
9
9
|
*/
|
|
10
10
|
function DirectionProvider({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
dir,
|
|
12
|
+
/** Alias for `dir`. If both are provided, `direction` takes precedence. */
|
|
13
|
+
direction,
|
|
14
|
+
children,
|
|
15
15
|
}: React.ComponentProps<typeof Direction.DirectionProvider> & {
|
|
16
|
-
|
|
16
|
+
direction?: React.ComponentProps<typeof Direction.DirectionProvider>['dir'];
|
|
17
17
|
}) {
|
|
18
|
-
|
|
18
|
+
return <Direction.DirectionProvider dir={direction ?? dir}>{children}</Direction.DirectionProvider>;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/** Hook to read the current text direction from the nearest DirectionProvider. */
|