create-auto-app 1.34.0 → 1.35.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 (157) hide show
  1. package/package.json +2 -2
  2. package/templates/typical/.context/components-db.json +4006 -0
  3. package/templates/typical/.gitignore +1 -1
  4. package/templates/typical/auto.config.ts +85 -80
  5. package/templates/typical/client/.gitignore +0 -4
  6. package/templates/typical/client/.storybook/main.ts +0 -66
  7. package/templates/typical/client/.storybook/manager-head.html +0 -154
  8. package/templates/typical/client/.storybook/manager.ts +0 -164
  9. package/templates/typical/client/.storybook/preview-head.html +0 -31
  10. package/templates/typical/client/.storybook/preview.tsx +0 -120
  11. package/templates/typical/client/codegen.ts +0 -17
  12. package/templates/typical/client/components.json +0 -29
  13. package/templates/typical/client/index.html +0 -12
  14. package/templates/typical/client/package.json +0 -69
  15. package/templates/typical/client/pnpm-lock.yaml +0 -7868
  16. package/templates/typical/client/public/blank.svg +0 -1
  17. package/templates/typical/client/public/mockServiceWorker.js +0 -336
  18. package/templates/typical/client/src/App.tsx +0 -29
  19. package/templates/typical/client/src/components/.gitkeep +0 -0
  20. package/templates/typical/client/src/components/ui/Accordion.stories.tsx +0 -49
  21. package/templates/typical/client/src/components/ui/Accordion.tsx +0 -55
  22. package/templates/typical/client/src/components/ui/Alert.stories.tsx +0 -29
  23. package/templates/typical/client/src/components/ui/Alert.tsx +0 -56
  24. package/templates/typical/client/src/components/ui/AlertDialog.stories.tsx +0 -67
  25. package/templates/typical/client/src/components/ui/AlertDialog.tsx +0 -178
  26. package/templates/typical/client/src/components/ui/AspectRatio.stories.tsx +0 -35
  27. package/templates/typical/client/src/components/ui/AspectRatio.tsx +0 -13
  28. package/templates/typical/client/src/components/ui/Avatar.stories.tsx +0 -45
  29. package/templates/typical/client/src/components/ui/Avatar.tsx +0 -98
  30. package/templates/typical/client/src/components/ui/Badge.stories.tsx +0 -41
  31. package/templates/typical/client/src/components/ui/Badge.tsx +0 -45
  32. package/templates/typical/client/src/components/ui/Breadcrumb.stories.tsx +0 -54
  33. package/templates/typical/client/src/components/ui/Breadcrumb.tsx +0 -104
  34. package/templates/typical/client/src/components/ui/Button.stories.tsx +0 -102
  35. package/templates/typical/client/src/components/ui/Button.tsx +0 -67
  36. package/templates/typical/client/src/components/ui/ButtonGroup.stories.tsx +0 -32
  37. package/templates/typical/client/src/components/ui/ButtonGroup.tsx +0 -81
  38. package/templates/typical/client/src/components/ui/Calendar.stories.tsx +0 -40
  39. package/templates/typical/client/src/components/ui/Calendar.tsx +0 -165
  40. package/templates/typical/client/src/components/ui/Card.stories.tsx +0 -44
  41. package/templates/typical/client/src/components/ui/Card.tsx +0 -66
  42. package/templates/typical/client/src/components/ui/Carousel.stories.tsx +0 -56
  43. package/templates/typical/client/src/components/ui/Carousel.tsx +0 -225
  44. package/templates/typical/client/src/components/ui/Chart.stories.tsx +0 -39
  45. package/templates/typical/client/src/components/ui/Chart.tsx +0 -305
  46. package/templates/typical/client/src/components/ui/Checkbox.stories.tsx +0 -35
  47. package/templates/typical/client/src/components/ui/Checkbox.tsx +0 -30
  48. package/templates/typical/client/src/components/ui/Collapsible.stories.tsx +0 -58
  49. package/templates/typical/client/src/components/ui/Collapsible.tsx +0 -18
  50. package/templates/typical/client/src/components/ui/Combobox.stories.tsx +0 -75
  51. package/templates/typical/client/src/components/ui/Combobox.tsx +0 -296
  52. package/templates/typical/client/src/components/ui/Command.stories.tsx +0 -71
  53. package/templates/typical/client/src/components/ui/Command.tsx +0 -157
  54. package/templates/typical/client/src/components/ui/ContextMenu.stories.tsx +0 -68
  55. package/templates/typical/client/src/components/ui/ContextMenu.tsx +0 -231
  56. package/templates/typical/client/src/components/ui/DesignSystem-Colors.mdx +0 -68
  57. package/templates/typical/client/src/components/ui/DesignSystem-Colors.stories.tsx +0 -117
  58. package/templates/typical/client/src/components/ui/DesignSystem-Layout.mdx +0 -64
  59. package/templates/typical/client/src/components/ui/DesignSystem-Layout.stories.tsx +0 -167
  60. package/templates/typical/client/src/components/ui/DesignSystem-Overview.stories.tsx +0 -748
  61. package/templates/typical/client/src/components/ui/DesignSystem-Typography.mdx +0 -31
  62. package/templates/typical/client/src/components/ui/DesignSystem-Typography.stories.tsx +0 -80
  63. package/templates/typical/client/src/components/ui/Dialog.stories.tsx +0 -74
  64. package/templates/typical/client/src/components/ui/Dialog.tsx +0 -154
  65. package/templates/typical/client/src/components/ui/Direction.stories.tsx +0 -38
  66. package/templates/typical/client/src/components/ui/Direction.tsx +0 -24
  67. package/templates/typical/client/src/components/ui/Drawer.stories.tsx +0 -70
  68. package/templates/typical/client/src/components/ui/Drawer.tsx +0 -124
  69. package/templates/typical/client/src/components/ui/DropdownMenu.stories.tsx +0 -74
  70. package/templates/typical/client/src/components/ui/DropdownMenu.tsx +0 -239
  71. package/templates/typical/client/src/components/ui/Empty.stories.tsx +0 -37
  72. package/templates/typical/client/src/components/ui/Empty.tsx +0 -98
  73. package/templates/typical/client/src/components/ui/Field.stories.tsx +0 -50
  74. package/templates/typical/client/src/components/ui/Field.tsx +0 -251
  75. package/templates/typical/client/src/components/ui/Form.stories.tsx +0 -45
  76. package/templates/typical/client/src/components/ui/Form.tsx +0 -148
  77. package/templates/typical/client/src/components/ui/HoverCard.stories.tsx +0 -49
  78. package/templates/typical/client/src/components/ui/HoverCard.tsx +0 -39
  79. package/templates/typical/client/src/components/ui/Input.stories.tsx +0 -42
  80. package/templates/typical/client/src/components/ui/Input.tsx +0 -22
  81. package/templates/typical/client/src/components/ui/InputGroup.stories.tsx +0 -53
  82. package/templates/typical/client/src/components/ui/InputGroup.tsx +0 -153
  83. package/templates/typical/client/src/components/ui/InputOTP.stories.tsx +0 -42
  84. package/templates/typical/client/src/components/ui/InputOTP.tsx +0 -72
  85. package/templates/typical/client/src/components/ui/Item.stories.tsx +0 -64
  86. package/templates/typical/client/src/components/ui/Item.tsx +0 -168
  87. package/templates/typical/client/src/components/ui/Kbd.stories.tsx +0 -59
  88. package/templates/typical/client/src/components/ui/Kbd.tsx +0 -22
  89. package/templates/typical/client/src/components/ui/Label.stories.tsx +0 -90
  90. package/templates/typical/client/src/components/ui/Label.tsx +0 -44
  91. package/templates/typical/client/src/components/ui/Menubar.stories.tsx +0 -78
  92. package/templates/typical/client/src/components/ui/Menubar.tsx +0 -251
  93. package/templates/typical/client/src/components/ui/NativeSelect.stories.tsx +0 -45
  94. package/templates/typical/client/src/components/ui/NativeSelect.tsx +0 -50
  95. package/templates/typical/client/src/components/ui/NavigationMenu.stories.tsx +0 -80
  96. package/templates/typical/client/src/components/ui/NavigationMenu.tsx +0 -152
  97. package/templates/typical/client/src/components/ui/Pagination.stories.tsx +0 -77
  98. package/templates/typical/client/src/components/ui/Pagination.tsx +0 -108
  99. package/templates/typical/client/src/components/ui/Popover.stories.tsx +0 -53
  100. package/templates/typical/client/src/components/ui/Popover.tsx +0 -57
  101. package/templates/typical/client/src/components/ui/Progress.stories.tsx +0 -32
  102. package/templates/typical/client/src/components/ui/Progress.tsx +0 -25
  103. package/templates/typical/client/src/components/ui/RadioGroup.stories.tsx +0 -50
  104. package/templates/typical/client/src/components/ui/RadioGroup.tsx +0 -36
  105. package/templates/typical/client/src/components/ui/Resizable.stories.tsx +0 -72
  106. package/templates/typical/client/src/components/ui/Resizable.tsx +0 -54
  107. package/templates/typical/client/src/components/ui/ScrollArea.stories.tsx +0 -45
  108. package/templates/typical/client/src/components/ui/ScrollArea.tsx +0 -51
  109. package/templates/typical/client/src/components/ui/Select.stories.tsx +0 -59
  110. package/templates/typical/client/src/components/ui/Select.tsx +0 -171
  111. package/templates/typical/client/src/components/ui/Separator.stories.tsx +0 -42
  112. package/templates/typical/client/src/components/ui/Separator.tsx +0 -27
  113. package/templates/typical/client/src/components/ui/Sheet.stories.tsx +0 -68
  114. package/templates/typical/client/src/components/ui/Sheet.tsx +0 -115
  115. package/templates/typical/client/src/components/ui/Sidebar.stories.tsx +0 -96
  116. package/templates/typical/client/src/components/ui/Sidebar.tsx +0 -695
  117. package/templates/typical/client/src/components/ui/Skeleton.stories.tsx +0 -40
  118. package/templates/typical/client/src/components/ui/Skeleton.tsx +0 -11
  119. package/templates/typical/client/src/components/ui/Slider.stories.tsx +0 -24
  120. package/templates/typical/client/src/components/ui/Slider.tsx +0 -55
  121. package/templates/typical/client/src/components/ui/Sonner.stories.tsx +0 -45
  122. package/templates/typical/client/src/components/ui/Sonner.tsx +0 -38
  123. package/templates/typical/client/src/components/ui/Spinner.stories.tsx +0 -26
  124. package/templates/typical/client/src/components/ui/Spinner.tsx +0 -13
  125. package/templates/typical/client/src/components/ui/Switch.stories.tsx +0 -39
  126. package/templates/typical/client/src/components/ui/Switch.tsx +0 -35
  127. package/templates/typical/client/src/components/ui/Table.stories.tsx +0 -67
  128. package/templates/typical/client/src/components/ui/Table.tsx +0 -86
  129. package/templates/typical/client/src/components/ui/Tabs.stories.tsx +0 -53
  130. package/templates/typical/client/src/components/ui/Tabs.tsx +0 -75
  131. package/templates/typical/client/src/components/ui/Textarea.stories.tsx +0 -27
  132. package/templates/typical/client/src/components/ui/Textarea.tsx +0 -22
  133. package/templates/typical/client/src/components/ui/Toast.stories.tsx +0 -116
  134. package/templates/typical/client/src/components/ui/Toast.tsx +0 -123
  135. package/templates/typical/client/src/components/ui/Toaster.tsx +0 -32
  136. package/templates/typical/client/src/components/ui/Toggle.stories.tsx +0 -44
  137. package/templates/typical/client/src/components/ui/Toggle.tsx +0 -42
  138. package/templates/typical/client/src/components/ui/ToggleGroup.stories.tsx +0 -61
  139. package/templates/typical/client/src/components/ui/ToggleGroup.tsx +0 -83
  140. package/templates/typical/client/src/components/ui/Tooltip.stories.tsx +0 -42
  141. package/templates/typical/client/src/components/ui/Tooltip.tsx +0 -48
  142. package/templates/typical/client/src/gql/execute.ts +0 -11
  143. package/templates/typical/client/src/gql/fragment-masking.ts +0 -83
  144. package/templates/typical/client/src/gql/gql.ts +0 -9
  145. package/templates/typical/client/src/gql/graphql.ts +0 -182
  146. package/templates/typical/client/src/gql/index.ts +0 -2
  147. package/templates/typical/client/src/graphql/mutations.ts +0 -0
  148. package/templates/typical/client/src/graphql/queries.ts +0 -0
  149. package/templates/typical/client/src/hooks/.gitkeep +0 -0
  150. package/templates/typical/client/src/hooks/use-mobile.ts +0 -19
  151. package/templates/typical/client/src/hooks/use-toast.ts +0 -186
  152. package/templates/typical/client/src/index.css +0 -121
  153. package/templates/typical/client/src/lib/utils.ts +0 -6
  154. package/templates/typical/client/src/main.tsx +0 -5
  155. package/templates/typical/client/tsconfig.app.json +0 -26
  156. package/templates/typical/client/tsconfig.json +0 -10
  157. package/templates/typical/client/vite.config.ts +0 -50
@@ -1,251 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
5
- import { Menubar as MenubarPrimitive } from 'radix-ui';
6
-
7
- import { cn } from '@/lib/utils';
8
-
9
- /**
10
- * A horizontal menu bar for desktop applications, built on Radix UI Menubar primitive.
11
- * Compose with MenubarMenu, MenubarTrigger, and MenubarContent to create top-level menu groups with keyboard navigation.
12
- */
13
- function Menubar({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Root>) {
14
- return (
15
- <MenubarPrimitive.Root
16
- data-slot="menubar"
17
- className={cn('bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs', className)}
18
- {...props}
19
- />
20
- );
21
- }
22
-
23
- /** A single menu within the menubar that wraps a trigger and its dropdown content. */
24
- function MenubarMenu({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
25
- return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} />;
26
- }
27
-
28
- function MenubarGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Group>) {
29
- return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />;
30
- }
31
-
32
- function MenubarPortal({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
33
- return <MenubarPrimitive.Portal data-slot="menubar-portal" {...props} />;
34
- }
35
-
36
- function MenubarRadioGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
37
- return <MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />;
38
- }
39
-
40
- /** The button that toggles a menu open within the menubar. */
41
- function MenubarTrigger({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {
42
- return (
43
- <MenubarPrimitive.Trigger
44
- data-slot="menubar-trigger"
45
- className={cn(
46
- 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none',
47
- className,
48
- )}
49
- {...props}
50
- />
51
- );
52
- }
53
-
54
- /** The dropdown panel that appears when a MenubarTrigger is activated. Renders via a portal. */
55
- function MenubarContent({
56
- className,
57
- align = 'start',
58
- alignOffset = -4,
59
- sideOffset = 8,
60
- ...props
61
- }: React.ComponentProps<typeof MenubarPrimitive.Content>) {
62
- return (
63
- <MenubarPortal>
64
- <MenubarPrimitive.Content
65
- data-slot="menubar-content"
66
- align={align}
67
- alignOffset={alignOffset}
68
- sideOffset={sideOffset}
69
- className={cn(
70
- 'bg-popover text-popover-foreground data-[state=open]:animate-in 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 z-50 min-w-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md',
71
- className,
72
- )}
73
- {...props}
74
- />
75
- </MenubarPortal>
76
- );
77
- }
78
-
79
- /** An interactive item within a menubar dropdown. Supports an inset layout and a destructive variant. */
80
- function MenubarItem({
81
- className,
82
- /** Adds left padding to align with items that have icons or indicators. */
83
- inset,
84
- /** Use "destructive" for dangerous actions. */
85
- variant = 'default',
86
- ...props
87
- }: React.ComponentProps<typeof MenubarPrimitive.Item> & {
88
- inset?: boolean;
89
- variant?: 'default' | 'destructive';
90
- }) {
91
- return (
92
- <MenubarPrimitive.Item
93
- data-slot="menubar-item"
94
- data-inset={inset}
95
- data-variant={variant}
96
- className={cn(
97
- "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
98
- className,
99
- )}
100
- {...props}
101
- />
102
- );
103
- }
104
-
105
- /** A menu item with a checkbox indicator for toggling boolean options. */
106
- function MenubarCheckboxItem({
107
- className,
108
- children,
109
- checked,
110
- ...props
111
- }: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) {
112
- return (
113
- <MenubarPrimitive.CheckboxItem
114
- data-slot="menubar-checkbox-item"
115
- className={cn(
116
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 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",
117
- className,
118
- )}
119
- checked={checked}
120
- {...props}
121
- >
122
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
123
- <MenubarPrimitive.ItemIndicator>
124
- <CheckIcon className="size-4" />
125
- </MenubarPrimitive.ItemIndicator>
126
- </span>
127
- {children}
128
- </MenubarPrimitive.CheckboxItem>
129
- );
130
- }
131
-
132
- /** A menu item within a MenubarRadioGroup that shows a radio dot when selected. */
133
- function MenubarRadioItem({ className, children, ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) {
134
- return (
135
- <MenubarPrimitive.RadioItem
136
- data-slot="menubar-radio-item"
137
- className={cn(
138
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 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",
139
- className,
140
- )}
141
- {...props}
142
- >
143
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
144
- <MenubarPrimitive.ItemIndicator>
145
- <CircleIcon className="size-2 fill-current" />
146
- </MenubarPrimitive.ItemIndicator>
147
- </span>
148
- {children}
149
- </MenubarPrimitive.RadioItem>
150
- );
151
- }
152
-
153
- function MenubarLabel({
154
- className,
155
- inset,
156
- ...props
157
- }: React.ComponentProps<typeof MenubarPrimitive.Label> & {
158
- inset?: boolean;
159
- }) {
160
- return (
161
- <MenubarPrimitive.Label
162
- data-slot="menubar-label"
163
- data-inset={inset}
164
- className={cn('px-2 py-1.5 text-sm font-medium data-[inset]:pl-8', className)}
165
- {...props}
166
- />
167
- );
168
- }
169
-
170
- function MenubarSeparator({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Separator>) {
171
- return (
172
- <MenubarPrimitive.Separator
173
- data-slot="menubar-separator"
174
- className={cn('bg-border -mx-1 my-1 h-px', className)}
175
- {...props}
176
- />
177
- );
178
- }
179
-
180
- /** Displays a keyboard shortcut hint aligned to the right of a menu item. */
181
- function MenubarShortcut({ className, ...props }: React.ComponentProps<'span'>) {
182
- return (
183
- <span
184
- data-slot="menubar-shortcut"
185
- className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}
186
- {...props}
187
- />
188
- );
189
- }
190
-
191
- function MenubarSub({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
192
- return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />;
193
- }
194
-
195
- /** The trigger for a nested submenu, rendering a chevron icon to indicate expandability. */
196
- function MenubarSubTrigger({
197
- className,
198
- inset,
199
- children,
200
- ...props
201
- }: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {
202
- inset?: boolean;
203
- }) {
204
- return (
205
- <MenubarPrimitive.SubTrigger
206
- data-slot="menubar-sub-trigger"
207
- data-inset={inset}
208
- className={cn(
209
- 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8',
210
- className,
211
- )}
212
- {...props}
213
- >
214
- {children}
215
- <ChevronRightIcon className="ml-auto h-4 w-4" />
216
- </MenubarPrimitive.SubTrigger>
217
- );
218
- }
219
-
220
- /** The dropdown content panel for a nested submenu. */
221
- function MenubarSubContent({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {
222
- return (
223
- <MenubarPrimitive.SubContent
224
- data-slot="menubar-sub-content"
225
- className={cn(
226
- '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 z-50 min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg',
227
- className,
228
- )}
229
- {...props}
230
- />
231
- );
232
- }
233
-
234
- export {
235
- Menubar,
236
- MenubarPortal,
237
- MenubarMenu,
238
- MenubarTrigger,
239
- MenubarContent,
240
- MenubarGroup,
241
- MenubarSeparator,
242
- MenubarLabel,
243
- MenubarItem,
244
- MenubarShortcut,
245
- MenubarCheckboxItem,
246
- MenubarRadioGroup,
247
- MenubarRadioItem,
248
- MenubarSub,
249
- MenubarSubTrigger,
250
- MenubarSubContent,
251
- };
@@ -1,45 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { NativeSelect, NativeSelectOption } from '@/components/ui/NativeSelect';
3
-
4
- const meta: Meta<typeof NativeSelect> = {
5
- title: 'UI Components/NativeSelect',
6
- component: NativeSelect,
7
- };
8
- export default meta;
9
- type Story = StoryObj<typeof NativeSelect>;
10
-
11
- /** Shows a native select with pre-selected value and several options. */
12
- export const Default: Story = {
13
- render: () => (
14
- <NativeSelect defaultValue="react">
15
- <NativeSelectOption value="react">React</NativeSelectOption>
16
- <NativeSelectOption value="vue">Vue</NativeSelectOption>
17
- <NativeSelectOption value="angular">Angular</NativeSelectOption>
18
- <NativeSelectOption value="svelte">Svelte</NativeSelectOption>
19
- </NativeSelect>
20
- ),
21
- };
22
-
23
- /** Shows the compact size variant with a disabled placeholder option. */
24
- export const Small: Story = {
25
- render: () => (
26
- <NativeSelect size="sm" defaultValue="">
27
- <NativeSelectOption value="" disabled>
28
- Select a fruit...
29
- </NativeSelectOption>
30
- <NativeSelectOption value="apple">Apple</NativeSelectOption>
31
- <NativeSelectOption value="banana">Banana</NativeSelectOption>
32
- <NativeSelectOption value="cherry">Cherry</NativeSelectOption>
33
- </NativeSelect>
34
- ),
35
- };
36
-
37
- /** Shows the select in a disabled state. */
38
- export const Disabled: Story = {
39
- render: () => (
40
- <NativeSelect disabled defaultValue="react">
41
- <NativeSelectOption value="react">React</NativeSelectOption>
42
- <NativeSelectOption value="vue">Vue</NativeSelectOption>
43
- </NativeSelect>
44
- ),
45
- };
@@ -1,50 +0,0 @@
1
- import * as React from 'react';
2
- import { ChevronDownIcon } from 'lucide-react';
3
-
4
- import { cn } from '@/lib/utils';
5
-
6
- /**
7
- * A styled wrapper around the browser's native <select> element.
8
- * Use instead of the custom Select component when native mobile pickers or simpler accessibility is preferred.
9
- */
10
- function NativeSelect({
11
- className,
12
- size = 'default',
13
- ...props
14
- }: Omit<React.ComponentProps<'select'>, 'size'> & { size?: 'sm' | 'default' }) {
15
- return (
16
- <div
17
- className="group/native-select relative w-fit has-[select:disabled]:opacity-50"
18
- data-slot="native-select-wrapper"
19
- >
20
- <select
21
- data-slot="native-select"
22
- data-size={size}
23
- className={cn(
24
- 'border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 dark:hover:bg-input/50 h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent px-3 py-2 pr-9 text-sm shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed data-[size=sm]:h-8 data-[size=sm]:py-1',
25
- 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
26
- 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
27
- className,
28
- )}
29
- {...props}
30
- />
31
- <ChevronDownIcon
32
- className="text-muted-foreground pointer-events-none absolute top-1/2 right-3.5 size-4 -translate-y-1/2 opacity-50 select-none"
33
- aria-hidden="true"
34
- data-slot="native-select-icon"
35
- />
36
- </div>
37
- );
38
- }
39
-
40
- /** An individual option within a NativeSelect dropdown. */
41
- function NativeSelectOption({ ...props }: React.ComponentProps<'option'>) {
42
- return <option data-slot="native-select-option" {...props} />;
43
- }
44
-
45
- /** Groups related options under a label within a NativeSelect. */
46
- function NativeSelectOptGroup({ className, ...props }: React.ComponentProps<'optgroup'>) {
47
- return <optgroup data-slot="native-select-optgroup" className={cn(className)} {...props} />;
48
- }
49
-
50
- export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
@@ -1,80 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import {
3
- NavigationMenu,
4
- NavigationMenuList,
5
- NavigationMenuItem,
6
- NavigationMenuLink,
7
- NavigationMenuTrigger,
8
- NavigationMenuContent,
9
- } from '@/components/ui/NavigationMenu';
10
-
11
- const meta: Meta<typeof NavigationMenu> = {
12
- title: 'UI Components/NavigationMenu',
13
- component: NavigationMenu,
14
- };
15
- export default meta;
16
- type Story = StoryObj<typeof NavigationMenu>;
17
-
18
- /** Shows a navigation menu with dropdown content panels and a direct link item. */
19
- export const Default: Story = {
20
- render: () => (
21
- <NavigationMenu>
22
- <NavigationMenuList>
23
- <NavigationMenuItem>
24
- <NavigationMenuTrigger>Getting Started</NavigationMenuTrigger>
25
- <NavigationMenuContent>
26
- <div className="grid w-[400px] gap-3 p-4">
27
- <NavigationMenuLink href="#">
28
- <div className="font-medium">Introduction</div>
29
- <p className="text-muted-foreground text-sm">Learn the basics and get up and running quickly.</p>
30
- </NavigationMenuLink>
31
- <NavigationMenuLink href="#">
32
- <div className="font-medium">Installation</div>
33
- <p className="text-muted-foreground text-sm">Step-by-step guide to installing dependencies.</p>
34
- </NavigationMenuLink>
35
- </div>
36
- </NavigationMenuContent>
37
- </NavigationMenuItem>
38
- <NavigationMenuItem>
39
- <NavigationMenuTrigger>Components</NavigationMenuTrigger>
40
- <NavigationMenuContent>
41
- <div className="grid w-[400px] gap-3 p-4">
42
- <NavigationMenuLink href="#">
43
- <div className="font-medium">Button</div>
44
- <p className="text-muted-foreground text-sm">
45
- Displays a button or a component that looks like a button.
46
- </p>
47
- </NavigationMenuLink>
48
- <NavigationMenuLink href="#">
49
- <div className="font-medium">Dialog</div>
50
- <p className="text-muted-foreground text-sm">A modal dialog that interrupts the user.</p>
51
- </NavigationMenuLink>
52
- </div>
53
- </NavigationMenuContent>
54
- </NavigationMenuItem>
55
- <NavigationMenuItem>
56
- <NavigationMenuLink href="#">Documentation</NavigationMenuLink>
57
- </NavigationMenuItem>
58
- </NavigationMenuList>
59
- </NavigationMenu>
60
- ),
61
- };
62
-
63
- /** Shows a flat navigation menu with simple link items and no dropdowns. */
64
- export const SimpleLinks: Story = {
65
- render: () => (
66
- <NavigationMenu>
67
- <NavigationMenuList>
68
- <NavigationMenuItem>
69
- <NavigationMenuLink href="#">Home</NavigationMenuLink>
70
- </NavigationMenuItem>
71
- <NavigationMenuItem>
72
- <NavigationMenuLink href="#">About</NavigationMenuLink>
73
- </NavigationMenuItem>
74
- <NavigationMenuItem>
75
- <NavigationMenuLink href="#">Contact</NavigationMenuLink>
76
- </NavigationMenuItem>
77
- </NavigationMenuList>
78
- </NavigationMenu>
79
- ),
80
- };
@@ -1,152 +0,0 @@
1
- import * as React from 'react';
2
- import { cva } from 'class-variance-authority';
3
- import { ChevronDownIcon } from 'lucide-react';
4
- import { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';
5
-
6
- import { cn } from '@/lib/utils';
7
-
8
- /**
9
- * A site-wide navigation component with dropdown content panels, built on Radix UI NavigationMenu primitive.
10
- * Compose with NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, and NavigationMenuContent for rich mega-menu layouts.
11
- */
12
- function NavigationMenu({
13
- className,
14
- children,
15
- /** Whether to render the shared viewport container for content panels. Set to false for inline dropdowns. */
16
- viewport = true,
17
- ...props
18
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
19
- viewport?: boolean;
20
- }) {
21
- return (
22
- <NavigationMenuPrimitive.Root
23
- data-slot="navigation-menu"
24
- data-viewport={viewport}
25
- className={cn('group/navigation-menu relative flex max-w-max flex-1 items-center justify-center', className)}
26
- {...props}
27
- >
28
- {children}
29
- {viewport && <NavigationMenuViewport />}
30
- </NavigationMenuPrimitive.Root>
31
- );
32
- }
33
-
34
- /** The horizontal list container for navigation menu items. */
35
- function NavigationMenuList({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
36
- return (
37
- <NavigationMenuPrimitive.List
38
- data-slot="navigation-menu-list"
39
- className={cn('group flex flex-1 list-none items-center justify-center gap-1', className)}
40
- {...props}
41
- />
42
- );
43
- }
44
-
45
- function NavigationMenuItem({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
46
- return (
47
- <NavigationMenuPrimitive.Item data-slot="navigation-menu-item" className={cn('relative', className)} {...props} />
48
- );
49
- }
50
-
51
- const navigationMenuTriggerStyle = cva(
52
- 'group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1',
53
- );
54
-
55
- /** The button that opens a NavigationMenuContent dropdown, with an animated chevron indicator. */
56
- function NavigationMenuTrigger({
57
- className,
58
- children,
59
- ...props
60
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
61
- return (
62
- <NavigationMenuPrimitive.Trigger
63
- data-slot="navigation-menu-trigger"
64
- className={cn(navigationMenuTriggerStyle(), 'group', className)}
65
- {...props}
66
- >
67
- {children}{' '}
68
- <ChevronDownIcon
69
- className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
70
- aria-hidden="true"
71
- />
72
- </NavigationMenuPrimitive.Trigger>
73
- );
74
- }
75
-
76
- /** The expandable content panel that appears below a NavigationMenuTrigger with animated transitions. */
77
- function NavigationMenuContent({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
78
- return (
79
- <NavigationMenuPrimitive.Content
80
- data-slot="navigation-menu-content"
81
- className={cn(
82
- 'data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto',
83
- 'group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none',
84
- className,
85
- )}
86
- {...props}
87
- />
88
- );
89
- }
90
-
91
- function NavigationMenuViewport({
92
- className,
93
- ...props
94
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
95
- return (
96
- <div className={cn('absolute top-full left-0 isolate z-50 flex justify-center')}>
97
- <NavigationMenuPrimitive.Viewport
98
- data-slot="navigation-menu-viewport"
99
- className={cn(
100
- 'origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]',
101
- className,
102
- )}
103
- {...props}
104
- />
105
- </div>
106
- );
107
- }
108
-
109
- /** A styled link within the navigation menu, used for both top-level and dropdown links. */
110
- function NavigationMenuLink({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
111
- return (
112
- <NavigationMenuPrimitive.Link
113
- data-slot="navigation-menu-link"
114
- className={cn(
115
- "data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
116
- className,
117
- )}
118
- {...props}
119
- />
120
- );
121
- }
122
-
123
- /** An animated arrow indicator that tracks the active menu item position. */
124
- function NavigationMenuIndicator({
125
- className,
126
- ...props
127
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
128
- return (
129
- <NavigationMenuPrimitive.Indicator
130
- data-slot="navigation-menu-indicator"
131
- className={cn(
132
- 'data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden',
133
- className,
134
- )}
135
- {...props}
136
- >
137
- <div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
138
- </NavigationMenuPrimitive.Indicator>
139
- );
140
- }
141
-
142
- export {
143
- NavigationMenu,
144
- NavigationMenuList,
145
- NavigationMenuItem,
146
- NavigationMenuContent,
147
- NavigationMenuTrigger,
148
- NavigationMenuLink,
149
- NavigationMenuIndicator,
150
- NavigationMenuViewport,
151
- navigationMenuTriggerStyle,
152
- };
@@ -1,77 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import {
3
- Pagination,
4
- PaginationContent,
5
- PaginationLink,
6
- PaginationItem,
7
- PaginationPrevious,
8
- PaginationNext,
9
- PaginationEllipsis,
10
- } from '@/components/ui/Pagination';
11
-
12
- const meta: Meta<typeof Pagination> = {
13
- title: 'UI Components/Pagination',
14
- component: Pagination,
15
- };
16
- export default meta;
17
- type Story = StoryObj<typeof Pagination>;
18
-
19
- /** Shows a full pagination bar with previous/next, numbered links, and an ellipsis. */
20
- export const Default: Story = {
21
- render: () => (
22
- <Pagination>
23
- <PaginationContent>
24
- <PaginationItem>
25
- <PaginationPrevious href="#" />
26
- </PaginationItem>
27
- <PaginationItem>
28
- <PaginationLink href="#">1</PaginationLink>
29
- </PaginationItem>
30
- <PaginationItem>
31
- <PaginationLink href="#" isActive>
32
- 2
33
- </PaginationLink>
34
- </PaginationItem>
35
- <PaginationItem>
36
- <PaginationLink href="#">3</PaginationLink>
37
- </PaginationItem>
38
- <PaginationItem>
39
- <PaginationEllipsis />
40
- </PaginationItem>
41
- <PaginationItem>
42
- <PaginationLink href="#">10</PaginationLink>
43
- </PaginationItem>
44
- <PaginationItem>
45
- <PaginationNext href="#" />
46
- </PaginationItem>
47
- </PaginationContent>
48
- </Pagination>
49
- ),
50
- };
51
-
52
- /** Shows a compact pagination for a small number of pages without ellipsis. */
53
- export const FewPages: Story = {
54
- render: () => (
55
- <Pagination>
56
- <PaginationContent>
57
- <PaginationItem>
58
- <PaginationPrevious href="#" />
59
- </PaginationItem>
60
- <PaginationItem>
61
- <PaginationLink href="#" isActive>
62
- 1
63
- </PaginationLink>
64
- </PaginationItem>
65
- <PaginationItem>
66
- <PaginationLink href="#">2</PaginationLink>
67
- </PaginationItem>
68
- <PaginationItem>
69
- <PaginationLink href="#">3</PaginationLink>
70
- </PaginationItem>
71
- <PaginationItem>
72
- <PaginationNext href="#" />
73
- </PaginationItem>
74
- </PaginationContent>
75
- </Pagination>
76
- ),
77
- };