@betterstart/cli 0.1.28 → 0.1.30

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 (65) hide show
  1. package/dist/{chunk-SAPJG4NO.js → chunk-6JCWMKSY.js} +7 -4
  2. package/dist/{chunk-SAPJG4NO.js.map → chunk-6JCWMKSY.js.map} +1 -1
  3. package/dist/cli.js +749 -866
  4. package/dist/cli.js.map +1 -1
  5. package/dist/drizzle-config-EDKOEZ6G.js +7 -0
  6. package/package.json +1 -1
  7. package/templates/ui/accordion.tsx +73 -42
  8. package/templates/ui/alert-dialog.tsx +155 -90
  9. package/templates/ui/alert.tsx +46 -26
  10. package/templates/ui/aspect-ratio.tsx +4 -2
  11. package/templates/ui/avatar.tsx +92 -43
  12. package/templates/ui/badge.tsx +27 -12
  13. package/templates/ui/breadcrumb.tsx +63 -60
  14. package/templates/ui/button-group.tsx +8 -8
  15. package/templates/ui/button.tsx +44 -26
  16. package/templates/ui/calendar.tsx +43 -34
  17. package/templates/ui/card.tsx +71 -34
  18. package/templates/ui/carousel.tsx +111 -115
  19. package/templates/ui/chart.tsx +197 -207
  20. package/templates/ui/checkbox.tsx +21 -20
  21. package/templates/ui/collapsible.tsx +14 -4
  22. package/templates/ui/combobox.tsx +272 -0
  23. package/templates/ui/command.tsx +139 -101
  24. package/templates/ui/context-menu.tsx +214 -156
  25. package/templates/ui/dialog.tsx +118 -77
  26. package/templates/ui/direction.tsx +20 -0
  27. package/templates/ui/drawer.tsx +89 -69
  28. package/templates/ui/dropdown-menu.tsx +228 -164
  29. package/templates/ui/empty.tsx +8 -5
  30. package/templates/ui/field.tsx +25 -32
  31. package/templates/ui/hover-card.tsx +29 -20
  32. package/templates/ui/input-group.tsx +20 -37
  33. package/templates/ui/input-otp.tsx +57 -42
  34. package/templates/ui/input.tsx +14 -17
  35. package/templates/ui/item.tsx +27 -17
  36. package/templates/ui/kbd.tsx +1 -3
  37. package/templates/ui/label.tsx +14 -14
  38. package/templates/ui/markdown-editor.tsx +1 -1
  39. package/templates/ui/menubar.tsx +220 -188
  40. package/templates/ui/native-select.tsx +42 -0
  41. package/templates/ui/navigation-menu.tsx +130 -90
  42. package/templates/ui/pagination.tsx +88 -73
  43. package/templates/ui/popover.tsx +67 -26
  44. package/templates/ui/progress.tsx +24 -18
  45. package/templates/ui/radio-group.tsx +26 -20
  46. package/templates/ui/resizable.tsx +29 -29
  47. package/templates/ui/scroll-area.tsx +47 -38
  48. package/templates/ui/select.tsx +158 -125
  49. package/templates/ui/separator.tsx +21 -19
  50. package/templates/ui/sheet.tsx +104 -95
  51. package/templates/ui/sidebar.tsx +77 -183
  52. package/templates/ui/skeleton.tsx +8 -2
  53. package/templates/ui/slider.tsx +46 -17
  54. package/templates/ui/sonner.tsx +19 -9
  55. package/templates/ui/spinner.tsx +2 -2
  56. package/templates/ui/switch.tsx +24 -20
  57. package/templates/ui/table.tsx +68 -73
  58. package/templates/ui/tabs.tsx +71 -46
  59. package/templates/ui/textarea.tsx +13 -16
  60. package/templates/ui/toggle-group.tsx +57 -28
  61. package/templates/ui/toggle.tsx +21 -20
  62. package/templates/ui/tooltip.tsx +44 -23
  63. package/dist/drizzle-config-KISB26BA.js +0 -7
  64. package/templates/ui/use-mobile.tsx +0 -19
  65. /package/dist/{drizzle-config-KISB26BA.js.map → drizzle-config-EDKOEZ6G.js.map} +0 -0
@@ -1,173 +1,231 @@
1
1
  'use client'
2
2
 
3
3
  import { cn } from '@cms/utils/cn'
4
- import * as ContextMenuPrimitive from '@radix-ui/react-context-menu'
5
- import { Check, ChevronRight, Circle } from 'lucide-react'
6
- import * as React from 'react'
7
-
8
- const ContextMenu = ContextMenuPrimitive.Root
9
-
10
- const ContextMenuTrigger = ContextMenuPrimitive.Trigger
11
-
12
- const ContextMenuGroup = ContextMenuPrimitive.Group
13
-
14
- const ContextMenuPortal = ContextMenuPrimitive.Portal
15
-
16
- const ContextMenuSub = ContextMenuPrimitive.Sub
17
-
18
- const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
19
-
20
- const ContextMenuSubTrigger = React.forwardRef<
21
- React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
22
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
23
- inset?: boolean
24
- }
25
- >(({ className, inset, children, ...props }, ref) => (
26
- <ContextMenuPrimitive.SubTrigger
27
- ref={ref}
28
- className={cn(
29
- 'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground',
30
- inset && 'pl-8',
31
- className
32
- )}
33
- {...props}
34
- >
35
- {children}
36
- <ChevronRight className="ml-auto size-4" />
37
- </ContextMenuPrimitive.SubTrigger>
38
- ))
39
- ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
40
-
41
- const ContextMenuSubContent = React.forwardRef<
42
- React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
43
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
44
- >(({ className, ...props }, ref) => (
45
- <ContextMenuPrimitive.SubContent
46
- ref={ref}
47
- className={cn(
48
- 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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 origin-[--radix-context-menu-content-transform-origin]',
49
- className
50
- )}
51
- {...props}
52
- />
53
- ))
54
- ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
55
-
56
- const ContextMenuContent = React.forwardRef<
57
- React.ElementRef<typeof ContextMenuPrimitive.Content>,
58
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
59
- >(({ className, ...props }, ref) => (
60
- <ContextMenuPrimitive.Portal>
61
- <ContextMenuPrimitive.Content
62
- ref={ref}
4
+ import { Check, ChevronRight } from 'lucide-react'
5
+ import { ContextMenu as ContextMenuPrimitive } from 'radix-ui'
6
+ import type * as React from 'react'
7
+
8
+ function ContextMenu({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
9
+ return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
10
+ }
11
+
12
+ function ContextMenuTrigger({
13
+ className,
14
+ ...props
15
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
16
+ return (
17
+ <ContextMenuPrimitive.Trigger
18
+ data-slot="context-menu-trigger"
19
+ className={cn('select-none', className)}
20
+ {...props}
21
+ />
22
+ )
23
+ }
24
+
25
+ function ContextMenuGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
26
+ return <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
27
+ }
28
+
29
+ function ContextMenuPortal({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
30
+ return <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
31
+ }
32
+
33
+ function ContextMenuSub({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
34
+ return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />
35
+ }
36
+
37
+ function ContextMenuRadioGroup({
38
+ ...props
39
+ }: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
40
+ return <ContextMenuPrimitive.RadioGroup data-slot="context-menu-radio-group" {...props} />
41
+ }
42
+
43
+ function ContextMenuContent({
44
+ className,
45
+ ...props
46
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Content> & {
47
+ side?: 'top' | 'right' | 'bottom' | 'left'
48
+ }) {
49
+ return (
50
+ <ContextMenuPrimitive.Portal>
51
+ <ContextMenuPrimitive.Content
52
+ data-slot="context-menu-content"
53
+ className={cn(
54
+ 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 shadow-md ring-1 duration-100',
55
+ className
56
+ )}
57
+ {...props}
58
+ />
59
+ </ContextMenuPrimitive.Portal>
60
+ )
61
+ }
62
+
63
+ function ContextMenuItem({
64
+ className,
65
+ inset,
66
+ variant = 'default',
67
+ ...props
68
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
69
+ inset?: boolean
70
+ variant?: 'default' | 'destructive'
71
+ }) {
72
+ return (
73
+ <ContextMenuPrimitive.Item
74
+ data-slot="context-menu-item"
75
+ data-inset={inset}
76
+ data-variant={variant}
77
+ className={cn(
78
+ "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 focus:*:[svg]:text-accent-foreground group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
79
+ className
80
+ )}
81
+ {...props}
82
+ />
83
+ )
84
+ }
85
+
86
+ function ContextMenuSubTrigger({
87
+ className,
88
+ inset,
89
+ children,
90
+ ...props
91
+ }: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
92
+ inset?: boolean
93
+ }) {
94
+ return (
95
+ <ContextMenuPrimitive.SubTrigger
96
+ data-slot="context-menu-sub-trigger"
97
+ data-inset={inset}
98
+ className={cn(
99
+ "focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
100
+ className
101
+ )}
102
+ {...props}
103
+ >
104
+ {children}
105
+ <ChevronRight className="ml-auto" />
106
+ </ContextMenuPrimitive.SubTrigger>
107
+ )
108
+ }
109
+
110
+ function ContextMenuSubContent({
111
+ className,
112
+ ...props
113
+ }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
114
+ return (
115
+ <ContextMenuPrimitive.SubContent
116
+ data-slot="context-menu-sub-content"
117
+ className={cn(
118
+ 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 bg-popover text-popover-foreground z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border p-1 shadow-lg duration-100',
119
+ className
120
+ )}
121
+ {...props}
122
+ />
123
+ )
124
+ }
125
+
126
+ function ContextMenuCheckboxItem({
127
+ className,
128
+ children,
129
+ checked,
130
+ inset,
131
+ ...props
132
+ }: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem> & {
133
+ inset?: boolean
134
+ }) {
135
+ return (
136
+ <ContextMenuPrimitive.CheckboxItem
137
+ data-slot="context-menu-checkbox-item"
138
+ data-inset={inset}
139
+ className={cn(
140
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
141
+ className
142
+ )}
143
+ checked={checked}
144
+ {...props}
145
+ >
146
+ <span className="pointer-events-none absolute right-2">
147
+ <ContextMenuPrimitive.ItemIndicator>
148
+ <Check />
149
+ </ContextMenuPrimitive.ItemIndicator>
150
+ </span>
151
+ {children}
152
+ </ContextMenuPrimitive.CheckboxItem>
153
+ )
154
+ }
155
+
156
+ function ContextMenuRadioItem({
157
+ className,
158
+ children,
159
+ inset,
160
+ ...props
161
+ }: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem> & {
162
+ inset?: boolean
163
+ }) {
164
+ return (
165
+ <ContextMenuPrimitive.RadioItem
166
+ data-slot="context-menu-radio-item"
167
+ data-inset={inset}
168
+ className={cn(
169
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
170
+ className
171
+ )}
172
+ {...props}
173
+ >
174
+ <span className="pointer-events-none absolute right-2">
175
+ <ContextMenuPrimitive.ItemIndicator>
176
+ <Check />
177
+ </ContextMenuPrimitive.ItemIndicator>
178
+ </span>
179
+ {children}
180
+ </ContextMenuPrimitive.RadioItem>
181
+ )
182
+ }
183
+
184
+ function ContextMenuLabel({
185
+ className,
186
+ inset,
187
+ ...props
188
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
189
+ inset?: boolean
190
+ }) {
191
+ return (
192
+ <ContextMenuPrimitive.Label
193
+ data-slot="context-menu-label"
194
+ data-inset={inset}
63
195
  className={cn(
64
- 'z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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 origin-[--radix-context-menu-content-transform-origin]',
196
+ 'text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7',
65
197
  className
66
198
  )}
67
199
  {...props}
68
200
  />
69
- </ContextMenuPrimitive.Portal>
70
- ))
71
- ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
72
-
73
- const ContextMenuItem = React.forwardRef<
74
- React.ElementRef<typeof ContextMenuPrimitive.Item>,
75
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
76
- inset?: boolean
77
- }
78
- >(({ className, inset, ...props }, ref) => (
79
- <ContextMenuPrimitive.Item
80
- ref={ref}
81
- className={cn(
82
- 'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
83
- inset && 'pl-8',
84
- className
85
- )}
86
- {...props}
87
- />
88
- ))
89
- ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
90
-
91
- const ContextMenuCheckboxItem = React.forwardRef<
92
- React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
93
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
94
- >(({ className, children, checked, ...props }, ref) => (
95
- <ContextMenuPrimitive.CheckboxItem
96
- ref={ref}
97
- className={cn(
98
- 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
99
- className
100
- )}
101
- checked={checked}
102
- {...props}
103
- >
104
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
105
- <ContextMenuPrimitive.ItemIndicator>
106
- <Check className="size-4" />
107
- </ContextMenuPrimitive.ItemIndicator>
108
- </span>
109
- {children}
110
- </ContextMenuPrimitive.CheckboxItem>
111
- ))
112
- ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName
113
-
114
- const ContextMenuRadioItem = React.forwardRef<
115
- React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
116
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
117
- >(({ className, children, ...props }, ref) => (
118
- <ContextMenuPrimitive.RadioItem
119
- ref={ref}
120
- className={cn(
121
- 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
122
- className
123
- )}
124
- {...props}
125
- >
126
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
127
- <ContextMenuPrimitive.ItemIndicator>
128
- <Circle className="size-4 fill-current" />
129
- </ContextMenuPrimitive.ItemIndicator>
130
- </span>
131
- {children}
132
- </ContextMenuPrimitive.RadioItem>
133
- ))
134
- ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
135
-
136
- const ContextMenuLabel = React.forwardRef<
137
- React.ElementRef<typeof ContextMenuPrimitive.Label>,
138
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
139
- inset?: boolean
140
- }
141
- >(({ className, inset, ...props }, ref) => (
142
- <ContextMenuPrimitive.Label
143
- ref={ref}
144
- className={cn('px-2 py-1.5 text-sm font-semibold text-foreground', inset && 'pl-8', className)}
145
- {...props}
146
- />
147
- ))
148
- ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
149
-
150
- const ContextMenuSeparator = React.forwardRef<
151
- React.ElementRef<typeof ContextMenuPrimitive.Separator>,
152
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
153
- >(({ className, ...props }, ref) => (
154
- <ContextMenuPrimitive.Separator
155
- ref={ref}
156
- className={cn('-mx-1 my-1 h-px bg-border', className)}
157
- {...props}
158
- />
159
- ))
160
- ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
161
-
162
- const ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
201
+ )
202
+ }
203
+
204
+ function ContextMenuSeparator({
205
+ className,
206
+ ...props
207
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
208
+ return (
209
+ <ContextMenuPrimitive.Separator
210
+ data-slot="context-menu-separator"
211
+ className={cn('bg-border -mx-1 my-1 h-px', className)}
212
+ {...props}
213
+ />
214
+ )
215
+ }
216
+
217
+ function ContextMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {
163
218
  return (
164
219
  <span
165
- className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)}
220
+ data-slot="context-menu-shortcut"
221
+ className={cn(
222
+ 'text-muted-foreground group-focus/context-menu-item:text-accent-foreground ml-auto text-xs tracking-widest',
223
+ className
224
+ )}
166
225
  {...props}
167
226
  />
168
227
  )
169
228
  }
170
- ContextMenuShortcut.displayName = 'ContextMenuShortcut'
171
229
 
172
230
  export {
173
231
  ContextMenu,
@@ -1,103 +1,144 @@
1
1
  'use client'
2
2
 
3
+ import { Button } from '@cms/components/ui/button'
3
4
  import { cn } from '@cms/utils/cn'
4
- import * as DialogPrimitive from '@radix-ui/react-dialog'
5
5
  import { X } from 'lucide-react'
6
- import * as React from 'react'
6
+ import { Dialog as DialogPrimitive } from 'radix-ui'
7
+ import type * as React from 'react'
7
8
 
8
- const Dialog = DialogPrimitive.Root
9
+ function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
10
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />
11
+ }
9
12
 
10
- const DialogTrigger = DialogPrimitive.Trigger
13
+ function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
14
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
15
+ }
11
16
 
12
- const DialogPortal = DialogPrimitive.Portal
17
+ function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
18
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
19
+ }
13
20
 
14
- const DialogClose = DialogPrimitive.Close
21
+ function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
22
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
23
+ }
15
24
 
16
- const DialogOverlay = React.forwardRef<
17
- React.ElementRef<typeof DialogPrimitive.Overlay>,
18
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
19
- >(({ className, ...props }, ref) => (
20
- <DialogPrimitive.Overlay
21
- ref={ref}
22
- className={cn(
23
- 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
24
- className
25
- )}
26
- {...props}
27
- />
28
- ))
29
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
25
+ function DialogOverlay({
26
+ className,
27
+ ...props
28
+ }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
29
+ return (
30
+ <DialogPrimitive.Overlay
31
+ data-slot="dialog-overlay"
32
+ className={cn(
33
+ 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs',
34
+ className
35
+ )}
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ function DialogContent({
42
+ className,
43
+ children,
44
+ showCloseButton = true,
45
+ ...props
46
+ }: React.ComponentProps<typeof DialogPrimitive.Content> & {
47
+ showCloseButton?: boolean
48
+ }) {
49
+ return (
50
+ <DialogPortal>
51
+ <DialogOverlay />
52
+ <DialogPrimitive.Content
53
+ data-slot="dialog-content"
54
+ className={cn(
55
+ 'bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-4 text-sm ring-1 duration-100 outline-none sm:max-w-sm',
56
+ className
57
+ )}
58
+ {...props}
59
+ >
60
+ {children}
61
+ {showCloseButton && (
62
+ <DialogPrimitive.Close data-slot="dialog-close" asChild>
63
+ <Button variant="ghost" className="absolute top-2 right-2" size="icon-sm">
64
+ <X />
65
+ <span className="sr-only">Close</span>
66
+ </Button>
67
+ </DialogPrimitive.Close>
68
+ )}
69
+ </DialogPrimitive.Content>
70
+ </DialogPortal>
71
+ )
72
+ }
30
73
 
31
- const DialogContent = React.forwardRef<
32
- React.ElementRef<typeof DialogPrimitive.Content>,
33
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
34
- >(({ className, children, ...props }, ref) => (
35
- <DialogPortal>
36
- <DialogOverlay />
37
- <DialogPrimitive.Content
38
- ref={ref}
74
+ function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
75
+ return (
76
+ <div data-slot="dialog-header" className={cn('flex flex-col gap-2', className)} {...props} />
77
+ )
78
+ }
79
+
80
+ function DialogFooter({
81
+ className,
82
+ showCloseButton = false,
83
+ children,
84
+ ...props
85
+ }: React.ComponentProps<'div'> & {
86
+ showCloseButton?: boolean
87
+ }) {
88
+ return (
89
+ <div
90
+ data-slot="dialog-footer"
39
91
  className={cn(
40
- 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
92
+ 'bg-muted/50 -mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t p-4 sm:flex-row sm:justify-end',
41
93
  className
42
94
  )}
43
95
  {...props}
44
96
  >
45
97
  {children}
46
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
47
- <X className="size-4" />
48
- <span className="sr-only">Close</span>
49
- </DialogPrimitive.Close>
50
- </DialogPrimitive.Content>
51
- </DialogPortal>
52
- ))
53
- DialogContent.displayName = DialogPrimitive.Content.displayName
54
-
55
- const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
56
- <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
57
- )
58
- DialogHeader.displayName = 'DialogHeader'
59
-
60
- const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
61
- <div
62
- className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}
63
- {...props}
64
- />
65
- )
66
- DialogFooter.displayName = 'DialogFooter'
98
+ {showCloseButton && (
99
+ <DialogPrimitive.Close asChild>
100
+ <Button variant="outline">Close</Button>
101
+ </DialogPrimitive.Close>
102
+ )}
103
+ </div>
104
+ )
105
+ }
67
106
 
68
- const DialogTitle = React.forwardRef<
69
- React.ElementRef<typeof DialogPrimitive.Title>,
70
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
71
- >(({ className, ...props }, ref) => (
72
- <DialogPrimitive.Title
73
- ref={ref}
74
- className={cn('text-lg font-semibold leading-none tracking-tight', className)}
75
- {...props}
76
- />
77
- ))
78
- DialogTitle.displayName = DialogPrimitive.Title.displayName
107
+ function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
108
+ return (
109
+ <DialogPrimitive.Title
110
+ data-slot="dialog-title"
111
+ className={cn('text-base leading-none font-medium', className)}
112
+ {...props}
113
+ />
114
+ )
115
+ }
79
116
 
80
- const DialogDescription = React.forwardRef<
81
- React.ElementRef<typeof DialogPrimitive.Description>,
82
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
83
- >(({ className, ...props }, ref) => (
84
- <DialogPrimitive.Description
85
- ref={ref}
86
- className={cn('text-sm text-muted-foreground', className)}
87
- {...props}
88
- />
89
- ))
90
- DialogDescription.displayName = DialogPrimitive.Description.displayName
117
+ function DialogDescription({
118
+ className,
119
+ ...props
120
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
121
+ return (
122
+ <DialogPrimitive.Description
123
+ data-slot="dialog-description"
124
+ className={cn(
125
+ 'text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3',
126
+ className
127
+ )}
128
+ {...props}
129
+ />
130
+ )
131
+ }
91
132
 
92
133
  export {
93
134
  Dialog,
94
- DialogPortal,
95
- DialogOverlay,
96
- DialogTrigger,
97
135
  DialogClose,
98
136
  DialogContent,
99
- DialogHeader,
137
+ DialogDescription,
100
138
  DialogFooter,
139
+ DialogHeader,
140
+ DialogOverlay,
141
+ DialogPortal,
101
142
  DialogTitle,
102
- DialogDescription
143
+ DialogTrigger
103
144
  }
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+
3
+ import { Direction } from 'radix-ui'
4
+ import type * as React from 'react'
5
+
6
+ function DirectionProvider({
7
+ dir,
8
+ direction,
9
+ children
10
+ }: React.ComponentProps<typeof Direction.DirectionProvider> & {
11
+ direction?: React.ComponentProps<typeof Direction.DirectionProvider>['dir']
12
+ }) {
13
+ return (
14
+ <Direction.DirectionProvider dir={direction ?? dir}>{children}</Direction.DirectionProvider>
15
+ )
16
+ }
17
+
18
+ const useDirection = Direction.useDirection
19
+
20
+ export { DirectionProvider, useDirection }