@auto-engineer/generate-react-client 1.64.0 → 1.65.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.
Files changed (144) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/starter/.storybook/main.ts +17 -22
  3. package/dist/starter/.storybook/manager-head.html +31 -31
  4. package/dist/starter/.storybook/manager.ts +133 -133
  5. package/dist/starter/.storybook/preview-head.html +12 -12
  6. package/dist/starter/.storybook/preview.tsx +79 -79
  7. package/dist/starter/biome.json +126 -0
  8. package/dist/starter/codegen.ts +11 -11
  9. package/dist/starter/components.json +27 -27
  10. package/dist/starter/package.json +86 -80
  11. package/dist/starter/public/mockServiceWorker.js +261 -261
  12. package/dist/starter/scripts/build-component-db.ts +17 -20
  13. package/dist/starter/src/App.tsx +15 -17
  14. package/dist/starter/src/components/ui/Accordion.stories.tsx +35 -35
  15. package/dist/starter/src/components/ui/Accordion.tsx +33 -33
  16. package/dist/starter/src/components/ui/Alert.stories.tsx +15 -15
  17. package/dist/starter/src/components/ui/Alert.tsx +32 -32
  18. package/dist/starter/src/components/ui/AlertDialog.stories.tsx +50 -50
  19. package/dist/starter/src/components/ui/AlertDialog.tsx +114 -115
  20. package/dist/starter/src/components/ui/AspectRatio.stories.tsx +20 -20
  21. package/dist/starter/src/components/ui/AspectRatio.tsx +1 -1
  22. package/dist/starter/src/components/ui/Avatar.stories.tsx +27 -27
  23. package/dist/starter/src/components/ui/Avatar.tsx +63 -63
  24. package/dist/starter/src/components/ui/Badge.stories.tsx +14 -14
  25. package/dist/starter/src/components/ui/Badge.tsx +27 -27
  26. package/dist/starter/src/components/ui/Breadcrumb.stories.tsx +38 -38
  27. package/dist/starter/src/components/ui/Breadcrumb.tsx +63 -62
  28. package/dist/starter/src/components/ui/Button.stories.tsx +55 -55
  29. package/dist/starter/src/components/ui/Button.tsx +49 -49
  30. package/dist/starter/src/components/ui/ButtonGroup.stories.tsx +17 -17
  31. package/dist/starter/src/components/ui/ButtonGroup.tsx +52 -53
  32. package/dist/starter/src/components/ui/Calendar.stories.tsx +20 -19
  33. package/dist/starter/src/components/ui/Calendar.tsx +142 -143
  34. package/dist/starter/src/components/ui/Card.stories.tsx +29 -29
  35. package/dist/starter/src/components/ui/Card.tsx +31 -31
  36. package/dist/starter/src/components/ui/Carousel.stories.tsx +41 -41
  37. package/dist/starter/src/components/ui/Carousel.tsx +171 -172
  38. package/dist/starter/src/components/ui/Chart.stories.tsx +21 -21
  39. package/dist/starter/src/components/ui/Chart.tsx +244 -247
  40. package/dist/starter/src/components/ui/Checkbox.stories.tsx +11 -11
  41. package/dist/starter/src/components/ui/Checkbox.tsx +18 -18
  42. package/dist/starter/src/components/ui/Collapsible.stories.tsx +40 -40
  43. package/dist/starter/src/components/ui/Collapsible.tsx +3 -3
  44. package/dist/starter/src/components/ui/Combobox.stories.tsx +48 -48
  45. package/dist/starter/src/components/ui/Combobox.tsx +204 -205
  46. package/dist/starter/src/components/ui/Command.stories.tsx +55 -55
  47. package/dist/starter/src/components/ui/Command.tsx +102 -103
  48. package/dist/starter/src/components/ui/ContextMenu.stories.tsx +52 -52
  49. package/dist/starter/src/components/ui/ContextMenu.tsx +151 -151
  50. package/dist/starter/src/components/ui/DesignSystem-Colors.stories.tsx +92 -92
  51. package/dist/starter/src/components/ui/DesignSystem-Layout.stories.tsx +139 -139
  52. package/dist/starter/src/components/ui/DesignSystem-Overview.stories.tsx +676 -657
  53. package/dist/starter/src/components/ui/DesignSystem-Typography.stories.tsx +59 -59
  54. package/dist/starter/src/components/ui/Dialog.stories.tsx +56 -56
  55. package/dist/starter/src/components/ui/Dialog.tsx +97 -98
  56. package/dist/starter/src/components/ui/Direction.stories.tsx +20 -20
  57. package/dist/starter/src/components/ui/Direction.tsx +7 -7
  58. package/dist/starter/src/components/ui/Drawer.stories.tsx +54 -54
  59. package/dist/starter/src/components/ui/Drawer.tsx +70 -70
  60. package/dist/starter/src/components/ui/DropdownMenu.stories.tsx +58 -58
  61. package/dist/starter/src/components/ui/DropdownMenu.tsx +157 -157
  62. package/dist/starter/src/components/ui/Empty.stories.tsx +22 -22
  63. package/dist/starter/src/components/ui/Empty.tsx +58 -58
  64. package/dist/starter/src/components/ui/Field.stories.tsx +31 -31
  65. package/dist/starter/src/components/ui/Field.tsx +180 -181
  66. package/dist/starter/src/components/ui/Form.stories.tsx +29 -29
  67. package/dist/starter/src/components/ui/Form.tsx +93 -96
  68. package/dist/starter/src/components/ui/HoverCard.stories.tsx +34 -34
  69. package/dist/starter/src/components/ui/HoverCard.tsx +21 -21
  70. package/dist/starter/src/components/ui/Input.stories.tsx +18 -18
  71. package/dist/starter/src/components/ui/Input.tsx +14 -14
  72. package/dist/starter/src/components/ui/InputGroup.stories.tsx +34 -34
  73. package/dist/starter/src/components/ui/InputGroup.tsx +110 -111
  74. package/dist/starter/src/components/ui/InputOTP.stories.tsx +28 -28
  75. package/dist/starter/src/components/ui/InputOTP.tsx +43 -43
  76. package/dist/starter/src/components/ui/Item.stories.tsx +45 -45
  77. package/dist/starter/src/components/ui/Item.tsx +113 -114
  78. package/dist/starter/src/components/ui/Kbd.stories.tsx +31 -31
  79. package/dist/starter/src/components/ui/Kbd.tsx +11 -11
  80. package/dist/starter/src/components/ui/Label.stories.tsx +62 -62
  81. package/dist/starter/src/components/ui/Label.tsx +26 -25
  82. package/dist/starter/src/components/ui/Menubar.stories.tsx +62 -62
  83. package/dist/starter/src/components/ui/Menubar.tsx +173 -173
  84. package/dist/starter/src/components/ui/NativeSelect.stories.tsx +26 -26
  85. package/dist/starter/src/components/ui/NativeSelect.tsx +29 -29
  86. package/dist/starter/src/components/ui/NavigationMenu.stories.tsx +64 -64
  87. package/dist/starter/src/components/ui/NavigationMenu.tsx +103 -103
  88. package/dist/starter/src/components/ui/Pagination.stories.tsx +61 -61
  89. package/dist/starter/src/components/ui/Pagination.tsx +69 -71
  90. package/dist/starter/src/components/ui/Popover.stories.tsx +38 -38
  91. package/dist/starter/src/components/ui/Popover.tsx +25 -25
  92. package/dist/starter/src/components/ui/Progress.stories.tsx +9 -9
  93. package/dist/starter/src/components/ui/Progress.tsx +14 -14
  94. package/dist/starter/src/components/ui/RadioGroup.stories.tsx +35 -35
  95. package/dist/starter/src/components/ui/RadioGroup.tsx +19 -19
  96. package/dist/starter/src/components/ui/Resizable.stories.tsx +54 -54
  97. package/dist/starter/src/components/ui/Resizable.tsx +29 -29
  98. package/dist/starter/src/components/ui/ScrollArea.stories.tsx +27 -27
  99. package/dist/starter/src/components/ui/ScrollArea.tsx +34 -34
  100. package/dist/starter/src/components/ui/Select.stories.tsx +43 -43
  101. package/dist/starter/src/components/ui/Select.tsx +120 -120
  102. package/dist/starter/src/components/ui/Separator.stories.tsx +27 -27
  103. package/dist/starter/src/components/ui/Separator.tsx +17 -17
  104. package/dist/starter/src/components/ui/Sheet.stories.tsx +53 -53
  105. package/dist/starter/src/components/ui/Sheet.tsx +69 -69
  106. package/dist/starter/src/components/ui/Sidebar.stories.tsx +77 -77
  107. package/dist/starter/src/components/ui/Sidebar.tsx +563 -564
  108. package/dist/starter/src/components/ui/Skeleton.stories.tsx +25 -25
  109. package/dist/starter/src/components/ui/Skeleton.tsx +1 -1
  110. package/dist/starter/src/components/ui/Slider.stories.tsx +5 -5
  111. package/dist/starter/src/components/ui/Slider.tsx +45 -44
  112. package/dist/starter/src/components/ui/Sonner.stories.tsx +32 -32
  113. package/dist/starter/src/components/ui/Sonner.tsx +23 -23
  114. package/dist/starter/src/components/ui/Spinner.stories.tsx +8 -8
  115. package/dist/starter/src/components/ui/Spinner.tsx +1 -1
  116. package/dist/starter/src/components/ui/Switch.stories.tsx +16 -17
  117. package/dist/starter/src/components/ui/Switch.tsx +24 -24
  118. package/dist/starter/src/components/ui/Table.stories.tsx +50 -50
  119. package/dist/starter/src/components/ui/Table.tsx +45 -45
  120. package/dist/starter/src/components/ui/Tabs.stories.tsx +39 -39
  121. package/dist/starter/src/components/ui/Tabs.tsx +47 -47
  122. package/dist/starter/src/components/ui/Textarea.stories.tsx +9 -9
  123. package/dist/starter/src/components/ui/Textarea.tsx +11 -11
  124. package/dist/starter/src/components/ui/Toast.stories.tsx +77 -77
  125. package/dist/starter/src/components/ui/Toast.tsx +75 -75
  126. package/dist/starter/src/components/ui/Toaster.tsx +17 -19
  127. package/dist/starter/src/components/ui/Toggle.stories.tsx +20 -20
  128. package/dist/starter/src/components/ui/Toggle.tsx +26 -26
  129. package/dist/starter/src/components/ui/ToggleGroup.stories.tsx +41 -41
  130. package/dist/starter/src/components/ui/ToggleGroup.tsx +61 -62
  131. package/dist/starter/src/components/ui/Tooltip.stories.tsx +26 -26
  132. package/dist/starter/src/components/ui/Tooltip.tsx +24 -24
  133. package/dist/starter/src/gql/execute.ts +1 -1
  134. package/dist/starter/src/gql/fragment-masking.ts +1 -1
  135. package/dist/starter/src/gql/graphql.ts +3 -0
  136. package/dist/starter/src/hooks/use-mobile.ts +11 -11
  137. package/dist/starter/src/hooks/use-toast.ts +135 -135
  138. package/dist/starter/src/index.css +105 -105
  139. package/dist/starter/src/lib/utils.ts +1 -1
  140. package/dist/starter/src/main.tsx +4 -1
  141. package/dist/starter/tsconfig.app.json +24 -24
  142. package/dist/starter/tsconfig.json +8 -8
  143. package/dist/starter/vite.config.ts +38 -37
  144. 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
- label: string;
5
- className: string;
6
- sample?: string;
4
+ label: string;
5
+ className: string;
6
+ sample?: string;
7
7
  }
8
8
 
9
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
- );
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
- 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>
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
- <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>
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
- <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>
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
- <div className="flex flex-col gap-6 mt-4">
55
- <h3 className="text-lg font-semibold text-muted-foreground uppercase tracking-wide">Muted &amp; 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
- );
54
+ <div className="flex flex-col gap-6 mt-4">
55
+ <h3 className="text-lg font-semibold text-muted-foreground uppercase tracking-wide">Muted &amp; 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
- title: 'Design System/Typography',
73
- tags: ['!autodocs', '!manifest'],
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
- render: () => <TypographyScale />,
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
- Dialog,
4
- DialogContent,
5
- DialogDescription,
6
- DialogFooter,
7
- DialogHeader,
8
- DialogTitle,
9
- DialogTrigger,
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
- title: 'UI Components/Dialog',
17
- component: Dialog,
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
- 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
- ),
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
- 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
- ),
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
- return <DialogPrimitive.Root data-slot="dialog" {...props} />;
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
- return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
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
- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
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
- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
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
- return (
31
- <DialogPrimitive.Overlay
32
- data-slot="dialog-overlay"
33
- className={cn(
34
- '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',
35
- className,
36
- )}
37
- {...props}
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
- className,
48
- children,
49
- /** Whether to render the close (X) button in the top-right corner. */
50
- showCloseButton = true,
51
- ...props
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
- showCloseButton?: boolean;
52
+ showCloseButton?: boolean;
54
53
  }) {
55
- return (
56
- <DialogPortal data-slot="dialog-portal">
57
- <DialogOverlay />
58
- <DialogPrimitive.Content
59
- data-slot="dialog-content"
60
- className={cn(
61
- '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',
62
- className,
63
- )}
64
- {...props}
65
- >
66
- {children}
67
- {showCloseButton && (
68
- <DialogPrimitive.Close
69
- data-slot="dialog-close"
70
- 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"
71
- >
72
- <XIcon />
73
- <span className="sr-only">Close</span>
74
- </DialogPrimitive.Close>
75
- )}
76
- </DialogPrimitive.Content>
77
- </DialogPortal>
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
- return (
84
- <div
85
- data-slot="dialog-header"
86
- className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
87
- {...props}
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
- className,
98
- /** Whether to append a "Close" button that dismisses the dialog. */
99
- showCloseButton = false,
100
- children,
101
- ...props
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
- showCloseButton?: boolean;
102
+ showCloseButton?: boolean;
104
103
  }) {
105
- return (
106
- <div
107
- data-slot="dialog-footer"
108
- className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
109
- {...props}
110
- >
111
- {children}
112
- {showCloseButton && (
113
- <DialogPrimitive.Close asChild>
114
- <Button variant="outline">Close</Button>
115
- </DialogPrimitive.Close>
116
- )}
117
- </div>
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
- return (
124
- <DialogPrimitive.Title
125
- data-slot="dialog-title"
126
- className={cn('text-lg leading-none font-semibold', className)}
127
- {...props}
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
- return (
135
- <DialogPrimitive.Description
136
- data-slot="dialog-description"
137
- className={cn('text-muted-foreground text-sm', className)}
138
- {...props}
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
- Dialog,
145
- DialogClose,
146
- DialogContent,
147
- DialogDescription,
148
- DialogFooter,
149
- DialogHeader,
150
- DialogOverlay,
151
- DialogPortal,
152
- DialogTitle,
153
- DialogTrigger,
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
- title: 'UI Components/Direction',
6
- component: DirectionProvider,
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
- const direction = useDirection();
13
- return <p className="text-sm text-muted-foreground">Current direction: {direction ?? 'not set'}</p>;
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
- 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
- ),
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
- 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
- ),
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
- dir,
12
- /** Alias for `dir`. If both are provided, `direction` takes precedence. */
13
- direction,
14
- children,
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
- direction?: React.ComponentProps<typeof Direction.DirectionProvider>['dir'];
16
+ direction?: React.ComponentProps<typeof Direction.DirectionProvider>['dir'];
17
17
  }) {
18
- return <Direction.DirectionProvider dir={direction ?? dir}>{children}</Direction.DirectionProvider>;
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. */