@betterstart/cli 0.1.28 → 0.1.29

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 +742 -869
  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
@@ -0,0 +1,7 @@
1
+ import {
2
+ drizzleConfigTemplate
3
+ } from "./chunk-6JCWMKSY.js";
4
+ export {
5
+ drizzleConfigTemplate
6
+ };
7
+ //# sourceMappingURL=drizzle-config-EDKOEZ6G.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstart/cli",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Scaffold a full-featured CMS into any Next.js 16 application",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,52 +1,83 @@
1
1
  'use client'
2
2
 
3
3
  import { cn } from '@cms/utils/cn'
4
- import * as AccordionPrimitive from '@radix-ui/react-accordion'
5
- import { ChevronDown } from 'lucide-react'
6
- import * as React from 'react'
4
+ import { ChevronDown, ChevronUp } from 'lucide-react'
5
+ import { Accordion as AccordionPrimitive } from 'radix-ui'
6
+ import type * as React from 'react'
7
7
 
8
- const Accordion = AccordionPrimitive.Root
8
+ function Accordion({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
9
+ return (
10
+ <AccordionPrimitive.Root
11
+ data-slot="accordion"
12
+ className={cn('flex w-full flex-col', className)}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ function AccordionItem({
19
+ className,
20
+ ...props
21
+ }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
22
+ return (
23
+ <AccordionPrimitive.Item
24
+ data-slot="accordion-item"
25
+ className={cn('not-last:border-b', className)}
26
+ {...props}
27
+ />
28
+ )
29
+ }
9
30
 
10
- const AccordionItem = React.forwardRef<
11
- React.ElementRef<typeof AccordionPrimitive.Item>,
12
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
13
- >(({ className, ...props }, ref) => (
14
- <AccordionPrimitive.Item ref={ref} className={cn('border-b', className)} {...props} />
15
- ))
16
- AccordionItem.displayName = 'AccordionItem'
31
+ function AccordionTrigger({
32
+ className,
33
+ children,
34
+ ...props
35
+ }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
36
+ return (
37
+ <AccordionPrimitive.Header className="flex">
38
+ <AccordionPrimitive.Trigger
39
+ data-slot="accordion-trigger"
40
+ className={cn(
41
+ 'focus-visible:ring-ring/50 focus-visible:border-ring focus-visible:after:border-ring **:data-[slot=accordion-trigger-icon]:text-muted-foreground group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4',
42
+ className
43
+ )}
44
+ {...props}
45
+ >
46
+ {children}
47
+ <ChevronDown
48
+ data-slot="accordion-trigger-icon"
49
+ className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"
50
+ />
51
+ <ChevronUp
52
+ data-slot="accordion-trigger-icon"
53
+ className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"
54
+ />
55
+ </AccordionPrimitive.Trigger>
56
+ </AccordionPrimitive.Header>
57
+ )
58
+ }
17
59
 
18
- const AccordionTrigger = React.forwardRef<
19
- React.ElementRef<typeof AccordionPrimitive.Trigger>,
20
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
21
- >(({ className, children, ...props }, ref) => (
22
- <AccordionPrimitive.Header className="flex">
23
- <AccordionPrimitive.Trigger
24
- ref={ref}
25
- className={cn(
26
- 'flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180',
27
- className
28
- )}
60
+ function AccordionContent({
61
+ className,
62
+ children,
63
+ ...props
64
+ }: React.ComponentProps<typeof AccordionPrimitive.Content>) {
65
+ return (
66
+ <AccordionPrimitive.Content
67
+ data-slot="accordion-content"
68
+ className="data-open:animate-accordion-down data-closed:animate-accordion-up overflow-hidden text-sm"
29
69
  {...props}
30
70
  >
31
- {children}
32
- <ChevronDown className="size-4 shrink-0 text-muted-foreground transition-transform duration-200" />
33
- </AccordionPrimitive.Trigger>
34
- </AccordionPrimitive.Header>
35
- ))
36
- AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
37
-
38
- const AccordionContent = React.forwardRef<
39
- React.ElementRef<typeof AccordionPrimitive.Content>,
40
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
41
- >(({ className, children, ...props }, ref) => (
42
- <AccordionPrimitive.Content
43
- ref={ref}
44
- className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
45
- {...props}
46
- >
47
- <div className={cn('pb-4 pt-0', className)}>{children}</div>
48
- </AccordionPrimitive.Content>
49
- ))
50
- AccordionContent.displayName = AccordionPrimitive.Content.displayName
71
+ <div
72
+ className={cn(
73
+ '[&_a]:hover:text-foreground h-(--radix-accordion-content-height) pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_p:not(:last-child)]:mb-4',
74
+ className
75
+ )}
76
+ >
77
+ {children}
78
+ </div>
79
+ </AccordionPrimitive.Content>
80
+ )
81
+ }
51
82
 
52
83
  export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
@@ -1,116 +1,181 @@
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 AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
5
- import * as React from 'react'
6
- import { buttonVariants } from './button'
5
+ import { AlertDialog as AlertDialogPrimitive } from 'radix-ui'
6
+ import type * as React from 'react'
7
7
 
8
- const AlertDialog = AlertDialogPrimitive.Root
8
+ function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
9
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
10
+ }
11
+
12
+ function AlertDialogTrigger({
13
+ ...props
14
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
15
+ return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
16
+ }
9
17
 
10
- const AlertDialogTrigger = AlertDialogPrimitive.Trigger
18
+ function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
19
+ return <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
20
+ }
11
21
 
12
- const AlertDialogPortal = AlertDialogPrimitive.Portal
22
+ function AlertDialogOverlay({
23
+ className,
24
+ ...props
25
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
26
+ return (
27
+ <AlertDialogPrimitive.Overlay
28
+ data-slot="alert-dialog-overlay"
29
+ className={cn(
30
+ 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs',
31
+ className
32
+ )}
33
+ {...props}
34
+ />
35
+ )
36
+ }
13
37
 
14
- const AlertDialogOverlay = React.forwardRef<
15
- React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
16
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
17
- >(({ className, ...props }, ref) => (
18
- <AlertDialogPrimitive.Overlay
19
- className={cn(
20
- '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',
21
- className
22
- )}
23
- {...props}
24
- ref={ref}
25
- />
26
- ))
27
- AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
38
+ function AlertDialogContent({
39
+ className,
40
+ size = 'default',
41
+ ...props
42
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
43
+ size?: 'default' | 'sm'
44
+ }) {
45
+ return (
46
+ <AlertDialogPortal>
47
+ <AlertDialogOverlay />
48
+ <AlertDialogPrimitive.Content
49
+ data-slot="alert-dialog-content"
50
+ data-size={size}
51
+ className={cn(
52
+ '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 bg-background ring-foreground/10 group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-4 ring-1 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm',
53
+ className
54
+ )}
55
+ {...props}
56
+ />
57
+ </AlertDialogPortal>
58
+ )
59
+ }
28
60
 
29
- const AlertDialogContent = React.forwardRef<
30
- React.ElementRef<typeof AlertDialogPrimitive.Content>,
31
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
32
- >(({ className, ...props }, ref) => (
33
- <AlertDialogPortal>
34
- <AlertDialogOverlay />
35
- <AlertDialogPrimitive.Content
36
- ref={ref}
61
+ function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
62
+ return (
63
+ <div
64
+ data-slot="alert-dialog-header"
37
65
  className={cn(
38
- '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',
66
+ 'grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',
39
67
  className
40
68
  )}
41
69
  {...props}
42
70
  />
43
- </AlertDialogPortal>
44
- ))
45
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
71
+ )
72
+ }
46
73
 
47
- const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
48
- <div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />
49
- )
50
- AlertDialogHeader.displayName = 'AlertDialogHeader'
74
+ function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
75
+ return (
76
+ <div
77
+ data-slot="alert-dialog-footer"
78
+ className={cn(
79
+ 'bg-muted/50 -mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',
80
+ className
81
+ )}
82
+ {...props}
83
+ />
84
+ )
85
+ }
51
86
 
52
- const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
53
- <div
54
- className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}
55
- {...props}
56
- />
57
- )
58
- AlertDialogFooter.displayName = 'AlertDialogFooter'
87
+ function AlertDialogMedia({ className, ...props }: React.ComponentProps<'div'>) {
88
+ return (
89
+ <div
90
+ data-slot="alert-dialog-media"
91
+ className={cn(
92
+ "bg-muted mb-2 inline-flex size-10 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",
93
+ className
94
+ )}
95
+ {...props}
96
+ />
97
+ )
98
+ }
59
99
 
60
- const AlertDialogTitle = React.forwardRef<
61
- React.ElementRef<typeof AlertDialogPrimitive.Title>,
62
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
63
- >(({ className, ...props }, ref) => (
64
- <AlertDialogPrimitive.Title
65
- ref={ref}
66
- className={cn('text-lg font-semibold', className)}
67
- {...props}
68
- />
69
- ))
70
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
100
+ function AlertDialogTitle({
101
+ className,
102
+ ...props
103
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
104
+ return (
105
+ <AlertDialogPrimitive.Title
106
+ data-slot="alert-dialog-title"
107
+ className={cn(
108
+ 'text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',
109
+ className
110
+ )}
111
+ {...props}
112
+ />
113
+ )
114
+ }
71
115
 
72
- const AlertDialogDescription = React.forwardRef<
73
- React.ElementRef<typeof AlertDialogPrimitive.Description>,
74
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
75
- >(({ className, ...props }, ref) => (
76
- <AlertDialogPrimitive.Description
77
- ref={ref}
78
- className={cn('text-sm text-muted-foreground', className)}
79
- {...props}
80
- />
81
- ))
82
- AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName
116
+ function AlertDialogDescription({
117
+ className,
118
+ ...props
119
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
120
+ return (
121
+ <AlertDialogPrimitive.Description
122
+ data-slot="alert-dialog-description"
123
+ className={cn(
124
+ 'text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3',
125
+ className
126
+ )}
127
+ {...props}
128
+ />
129
+ )
130
+ }
83
131
 
84
- const AlertDialogAction = React.forwardRef<
85
- React.ElementRef<typeof AlertDialogPrimitive.Action>,
86
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
87
- >(({ className, ...props }, ref) => (
88
- <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
89
- ))
90
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
132
+ function AlertDialogAction({
133
+ className,
134
+ variant = 'default',
135
+ size = 'default',
136
+ ...props
137
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Action> &
138
+ Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) {
139
+ return (
140
+ <Button variant={variant} size={size} asChild>
141
+ <AlertDialogPrimitive.Action
142
+ data-slot="alert-dialog-action"
143
+ className={cn(className)}
144
+ {...props}
145
+ />
146
+ </Button>
147
+ )
148
+ }
91
149
 
92
- const AlertDialogCancel = React.forwardRef<
93
- React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
94
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
95
- >(({ className, ...props }, ref) => (
96
- <AlertDialogPrimitive.Cancel
97
- ref={ref}
98
- className={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)}
99
- {...props}
100
- />
101
- ))
102
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
150
+ function AlertDialogCancel({
151
+ className,
152
+ variant = 'outline',
153
+ size = 'default',
154
+ ...props
155
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
156
+ Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) {
157
+ return (
158
+ <Button variant={variant} size={size} asChild>
159
+ <AlertDialogPrimitive.Cancel
160
+ data-slot="alert-dialog-cancel"
161
+ className={cn(className)}
162
+ {...props}
163
+ />
164
+ </Button>
165
+ )
166
+ }
103
167
 
104
168
  export {
105
169
  AlertDialog,
106
- AlertDialogPortal,
107
- AlertDialogOverlay,
108
- AlertDialogTrigger,
170
+ AlertDialogAction,
171
+ AlertDialogCancel,
109
172
  AlertDialogContent,
110
- AlertDialogHeader,
173
+ AlertDialogDescription,
111
174
  AlertDialogFooter,
175
+ AlertDialogHeader,
176
+ AlertDialogMedia,
177
+ AlertDialogOverlay,
178
+ AlertDialogPortal,
112
179
  AlertDialogTitle,
113
- AlertDialogDescription,
114
- AlertDialogAction,
115
- AlertDialogCancel
180
+ AlertDialogTrigger
116
181
  }
@@ -1,15 +1,15 @@
1
1
  import { cn } from '@cms/utils/cn'
2
2
  import { cva, type VariantProps } from 'class-variance-authority'
3
- import * as React from 'react'
3
+ import type * as React from 'react'
4
4
 
5
5
  const alertVariants = cva(
6
- 'relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7',
6
+ "grid gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 w-full relative group/alert",
7
7
  {
8
8
  variants: {
9
9
  variant: {
10
- default: 'bg-background text-foreground',
10
+ default: 'bg-card text-card-foreground',
11
11
  destructive:
12
- 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive'
12
+ 'text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current'
13
13
  }
14
14
  },
15
15
  defaultVariants: {
@@ -18,31 +18,51 @@ const alertVariants = cva(
18
18
  }
19
19
  )
20
20
 
21
- const Alert = React.forwardRef<
22
- HTMLDivElement,
23
- React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
24
- >(({ className, variant, ...props }, ref) => (
25
- <div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
26
- ))
27
- Alert.displayName = 'Alert'
21
+ function Alert({
22
+ className,
23
+ variant,
24
+ ...props
25
+ }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {
26
+ return (
27
+ <div
28
+ data-slot="alert"
29
+ role="alert"
30
+ className={cn(alertVariants({ variant }), className)}
31
+ {...props}
32
+ />
33
+ )
34
+ }
28
35
 
29
- const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
30
- ({ className, ...props }, ref) => (
31
- <h5
32
- ref={ref}
33
- className={cn('mb-1 font-medium leading-none tracking-tight', className)}
36
+ function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {
37
+ return (
38
+ <div
39
+ data-slot="alert-title"
40
+ className={cn(
41
+ '[&_a]:hover:text-foreground font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3',
42
+ className
43
+ )}
34
44
  {...props}
35
45
  />
36
46
  )
37
- )
38
- AlertTitle.displayName = 'AlertTitle'
47
+ }
39
48
 
40
- const AlertDescription = React.forwardRef<
41
- HTMLParagraphElement,
42
- React.HTMLAttributes<HTMLParagraphElement>
43
- >(({ className, ...props }, ref) => (
44
- <div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />
45
- ))
46
- AlertDescription.displayName = 'AlertDescription'
49
+ function AlertDescription({ className, ...props }: React.ComponentProps<'div'>) {
50
+ return (
51
+ <div
52
+ data-slot="alert-description"
53
+ className={cn(
54
+ 'text-muted-foreground [&_a]:hover:text-foreground text-sm text-balance md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_p:not(:last-child)]:mb-4',
55
+ className
56
+ )}
57
+ {...props}
58
+ />
59
+ )
60
+ }
61
+
62
+ function AlertAction({ className, ...props }: React.ComponentProps<'div'>) {
63
+ return (
64
+ <div data-slot="alert-action" className={cn('absolute top-2 right-2', className)} {...props} />
65
+ )
66
+ }
47
67
 
48
- export { Alert, AlertTitle, AlertDescription }
68
+ export { Alert, AlertTitle, AlertDescription, AlertAction }
@@ -1,7 +1,9 @@
1
1
  'use client'
2
2
 
3
- import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio'
3
+ import { AspectRatio as AspectRatioPrimitive } from 'radix-ui'
4
4
 
5
- const AspectRatio = AspectRatioPrimitive.Root
5
+ function AspectRatio({ ...props }: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
6
+ return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
7
+ }
6
8
 
7
9
  export { AspectRatio }