@blips/ui 0.0.1 → 2.0.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 (60) hide show
  1. package/dist/index.cjs +4308 -2010
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +435 -411
  4. package/dist/index.d.ts +435 -411
  5. package/dist/index.js +4244 -2008
  6. package/dist/index.js.map +1 -1
  7. package/package.json +18 -4
  8. package/src/components/accordion.tsx +58 -48
  9. package/src/components/alert-dialog.tsx +170 -112
  10. package/src/components/alert.tsx +49 -42
  11. package/src/components/aspect-ratio.tsx +9 -3
  12. package/src/components/avatar.tsx +109 -50
  13. package/src/components/badge.tsx +29 -17
  14. package/src/components/breadcrumb.tsx +81 -87
  15. package/src/components/button-group.tsx +83 -0
  16. package/src/components/button.tsx +40 -32
  17. package/src/components/calendar.tsx +49 -45
  18. package/src/components/card.tsx +77 -71
  19. package/src/components/carousel.tsx +150 -168
  20. package/src/components/chart.tsx +357 -0
  21. package/src/components/checkbox.tsx +28 -24
  22. package/src/components/collapsible.tsx +28 -6
  23. package/src/components/command.tsx +144 -110
  24. package/src/components/context-menu.tsx +220 -166
  25. package/src/components/dialog.tsx +131 -95
  26. package/src/components/drawer.tsx +105 -86
  27. package/src/components/dropdown-menu.tsx +234 -177
  28. package/src/components/form.tsx +167 -0
  29. package/src/components/hover-card.tsx +39 -22
  30. package/src/components/input-group.tsx +175 -0
  31. package/src/components/input-otp.tsx +56 -48
  32. package/src/components/input.tsx +18 -19
  33. package/src/components/kbd.tsx +28 -0
  34. package/src/components/label.tsx +20 -22
  35. package/src/components/menubar.tsx +221 -199
  36. package/src/components/navigation-menu.tsx +144 -102
  37. package/src/components/pagination.tsx +102 -91
  38. package/src/components/popover.tsx +86 -26
  39. package/src/components/progress.tsx +27 -24
  40. package/src/components/radio-group.tsx +28 -25
  41. package/src/components/resizable.tsx +42 -34
  42. package/src/components/scroll-area.tsx +54 -42
  43. package/src/components/select.tsx +165 -135
  44. package/src/components/separator.tsx +16 -17
  45. package/src/components/sheet.tsx +116 -113
  46. package/src/components/sidebar.tsx +726 -0
  47. package/src/components/skeleton.tsx +6 -8
  48. package/src/components/slider.tsx +60 -23
  49. package/src/components/sonner.tsx +25 -30
  50. package/src/components/spinner.tsx +16 -0
  51. package/src/components/switch.tsx +30 -22
  52. package/src/components/table.tsx +96 -97
  53. package/src/components/tabs.tsx +91 -53
  54. package/src/components/textarea.tsx +8 -12
  55. package/src/components/toggle-group.tsx +60 -37
  56. package/src/components/toggle.tsx +28 -24
  57. package/src/components/tooltip.tsx +50 -23
  58. package/src/globals.css +230 -68
  59. package/src/hooks/use-mobile.tsx +19 -0
  60. package/src/index.ts +105 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blips/ui",
3
- "version": "0.0.1",
3
+ "version": "2.0.0",
4
4
  "description": "Blips UI Component Library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -18,6 +18,7 @@
18
18
  }
19
19
  },
20
20
  "./globals.css": "./src/globals.css",
21
+ "./postcss.config": "./postcss.config.mjs",
21
22
  "./lib/utils": "./src/lib/utils.ts",
22
23
  "./components/accordion": "./src/components/accordion.tsx",
23
24
  "./components/alert": "./src/components/alert.tsx",
@@ -61,7 +62,15 @@
61
62
  "./components/textarea": "./src/components/textarea.tsx",
62
63
  "./components/toggle": "./src/components/toggle.tsx",
63
64
  "./components/toggle-group": "./src/components/toggle-group.tsx",
64
- "./components/tooltip": "./src/components/tooltip.tsx"
65
+ "./components/tooltip": "./src/components/tooltip.tsx",
66
+ "./components/button-group": "./src/components/button-group.tsx",
67
+ "./components/chart": "./src/components/chart.tsx",
68
+ "./components/form": "./src/components/form.tsx",
69
+ "./components/input-group": "./src/components/input-group.tsx",
70
+ "./components/kbd": "./src/components/kbd.tsx",
71
+ "./components/sidebar": "./src/components/sidebar.tsx",
72
+ "./components/spinner": "./src/components/spinner.tsx",
73
+ "./hooks/use-mobile": "./src/hooks/use-mobile.tsx"
65
74
  },
66
75
  "files": [
67
76
  "dist",
@@ -83,6 +92,8 @@
83
92
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
84
93
  },
85
94
  "dependencies": {
95
+ "@hookform/resolvers": "^5.2.2",
96
+ "@phosphor-icons/react": "^2.1.10",
86
97
  "@radix-ui/react-accordion": "^1.2.12",
87
98
  "@radix-ui/react-alert-dialog": "^1.1.15",
88
99
  "@radix-ui/react-aspect-ratio": "^1.1.8",
@@ -115,13 +126,16 @@
115
126
  "date-fns": "^4.1.0",
116
127
  "embla-carousel-react": "^8.6.0",
117
128
  "input-otp": "^1.4.2",
118
- "lucide-react": "^0.468.0",
119
129
  "next-themes": "^0.4.6",
120
130
  "react-day-picker": "^9.13.0",
131
+ "react-hook-form": "^7.71.1",
121
132
  "react-resizable-panels": "^4.5.9",
133
+ "recharts": "2.15.4",
122
134
  "sonner": "^2.0.7",
123
135
  "tailwind-merge": "^2.6.0",
124
- "vaul": "^1.1.2"
136
+ "tw-animate-css": "^1.4.0",
137
+ "vaul": "^1.1.2",
138
+ "zod": "^4.3.6"
125
139
  },
126
140
  "devDependencies": {
127
141
  "@types/node": "^22.10.2",
@@ -1,56 +1,66 @@
1
- import * as AccordionPrimitive from "@radix-ui/react-accordion";
2
- import { ChevronDown } from "lucide-react";
3
- import * as React from "react";
1
+ "use client"
4
2
 
5
- import { cn } from "../lib/utils";
3
+ import * as React from "react"
4
+ import { CaretDown } from "@phosphor-icons/react"
5
+ import * as AccordionPrimitive from "@radix-ui/react-accordion"
6
6
 
7
- const Accordion = AccordionPrimitive.Root;
7
+ import { cn } from "../lib/utils"
8
8
 
9
- const AccordionItem = React.forwardRef<
10
- React.ElementRef<typeof AccordionPrimitive.Item>,
11
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
12
- >(({ className, ...props }, ref) => (
13
- <AccordionPrimitive.Item
14
- ref={ref}
15
- className={cn("border-b", className)}
16
- {...props}
17
- />
18
- ));
19
- AccordionItem.displayName = "AccordionItem";
9
+ function Accordion({
10
+ ...props
11
+ }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
12
+ return <AccordionPrimitive.Root data-slot="accordion" {...props} />
13
+ }
20
14
 
21
- const AccordionTrigger = React.forwardRef<
22
- React.ElementRef<typeof AccordionPrimitive.Trigger>,
23
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
24
- >(({ className, children, ...props }, ref) => (
25
- <AccordionPrimitive.Header className="flex">
26
- <AccordionPrimitive.Trigger
27
- ref={ref}
28
- className={cn(
29
- "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
30
- className
31
- )}
15
+ function AccordionItem({
16
+ className,
17
+ ...props
18
+ }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
19
+ return (
20
+ <AccordionPrimitive.Item
21
+ data-slot="accordion-item"
22
+ className={cn("border-b last:border-b-0", className)}
32
23
  {...props}
33
- >
34
- {children}
35
- <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
36
- </AccordionPrimitive.Trigger>
37
- </AccordionPrimitive.Header>
38
- ));
39
- AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
24
+ />
25
+ )
26
+ }
40
27
 
41
- const AccordionContent = React.forwardRef<
42
- React.ElementRef<typeof AccordionPrimitive.Content>,
43
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
44
- >(({ className, children, ...props }, ref) => (
45
- <AccordionPrimitive.Content
46
- ref={ref}
47
- className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
48
- {...props}
49
- >
50
- <div className={cn("pb-4 pt-0", className)}>{children}</div>
51
- </AccordionPrimitive.Content>
52
- ));
28
+ function AccordionTrigger({
29
+ className,
30
+ children,
31
+ ...props
32
+ }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
33
+ return (
34
+ <AccordionPrimitive.Header className="flex">
35
+ <AccordionPrimitive.Trigger
36
+ data-slot="accordion-trigger"
37
+ className={cn(
38
+ "flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
39
+ className
40
+ )}
41
+ {...props}
42
+ >
43
+ {children}
44
+ <CaretDown className="pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200" />
45
+ </AccordionPrimitive.Trigger>
46
+ </AccordionPrimitive.Header>
47
+ )
48
+ }
53
49
 
54
- AccordionContent.displayName = AccordionPrimitive.Content.displayName;
50
+ function AccordionContent({
51
+ className,
52
+ children,
53
+ ...props
54
+ }: React.ComponentProps<typeof AccordionPrimitive.Content>) {
55
+ return (
56
+ <AccordionPrimitive.Content
57
+ data-slot="accordion-content"
58
+ className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
59
+ {...props}
60
+ >
61
+ <div className={cn("pt-0 pb-4", className)}>{children}</div>
62
+ </AccordionPrimitive.Content>
63
+ )
64
+ }
55
65
 
56
- export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
66
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
@@ -1,138 +1,196 @@
1
- import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
2
- import * as React from "react";
3
- import { buttonVariants } from "./button";
4
- import { cn } from "../lib/utils";
1
+ "use client"
5
2
 
6
- const AlertDialog = AlertDialogPrimitive.Root;
3
+ import * as React from "react"
4
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
7
5
 
8
- const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
6
+ import { cn } from "../lib/utils"
7
+ import { Button } from "./button"
9
8
 
10
- const AlertDialogPortal = AlertDialogPrimitive.Portal;
9
+ function AlertDialog({
10
+ ...props
11
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
12
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
13
+ }
14
+
15
+ function AlertDialogTrigger({
16
+ ...props
17
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
18
+ return (
19
+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
20
+ )
21
+ }
22
+
23
+ function AlertDialogPortal({
24
+ ...props
25
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
26
+ return (
27
+ <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
28
+ )
29
+ }
30
+
31
+ function AlertDialogOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
35
+ return (
36
+ <AlertDialogPrimitive.Overlay
37
+ data-slot="alert-dialog-overlay"
38
+ className={cn(
39
+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ )
45
+ }
11
46
 
12
- const AlertDialogOverlay = React.forwardRef<
13
- React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
14
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
15
- >(({ className, ...props }, ref) => (
16
- <AlertDialogPrimitive.Overlay
17
- className={cn(
18
- "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",
19
- className
20
- )}
21
- {...props}
22
- ref={ref}
23
- />
24
- ));
25
- AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
47
+ function AlertDialogContent({
48
+ className,
49
+ size = "default",
50
+ ...props
51
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
52
+ size?: "default" | "sm"
53
+ }) {
54
+ return (
55
+ <AlertDialogPortal>
56
+ <AlertDialogOverlay />
57
+ <AlertDialogPrimitive.Content
58
+ data-slot="alert-dialog-content"
59
+ data-size={size}
60
+ className={cn(
61
+ "group/alert-dialog-content 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 bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
62
+ className
63
+ )}
64
+ {...props}
65
+ />
66
+ </AlertDialogPortal>
67
+ )
68
+ }
26
69
 
27
- const AlertDialogContent = React.forwardRef<
28
- React.ElementRef<typeof AlertDialogPrimitive.Content>,
29
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
30
- >(({ className, ...props }, ref) => (
31
- <AlertDialogPortal>
32
- <AlertDialogOverlay />
33
- <AlertDialogPrimitive.Content
34
- ref={ref}
70
+ function AlertDialogHeader({
71
+ className,
72
+ ...props
73
+ }: React.ComponentProps<"div">) {
74
+ return (
75
+ <div
76
+ data-slot="alert-dialog-header"
35
77
  className={cn(
36
- "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",
78
+ "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-6 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]",
37
79
  className
38
80
  )}
39
81
  {...props}
40
82
  />
41
- </AlertDialogPortal>
42
- ));
43
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
83
+ )
84
+ }
44
85
 
45
- const AlertDialogHeader = ({
86
+ function AlertDialogFooter({
46
87
  className,
47
88
  ...props
48
- }: React.HTMLAttributes<HTMLDivElement>) => (
49
- <div
50
- className={cn(
51
- "flex flex-col space-y-2 text-center sm:text-left",
52
- className
53
- )}
54
- {...props}
55
- />
56
- );
57
- AlertDialogHeader.displayName = "AlertDialogHeader";
89
+ }: React.ComponentProps<"div">) {
90
+ return (
91
+ <div
92
+ data-slot="alert-dialog-footer"
93
+ className={cn(
94
+ "flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
95
+ className
96
+ )}
97
+ {...props}
98
+ />
99
+ )
100
+ }
58
101
 
59
- const AlertDialogFooter = ({
102
+ function AlertDialogTitle({
60
103
  className,
61
104
  ...props
62
- }: React.HTMLAttributes<HTMLDivElement>) => (
63
- <div
64
- className={cn(
65
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
66
- className
67
- )}
68
- {...props}
69
- />
70
- );
71
- AlertDialogFooter.displayName = "AlertDialogFooter";
105
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
106
+ return (
107
+ <AlertDialogPrimitive.Title
108
+ data-slot="alert-dialog-title"
109
+ className={cn(
110
+ "text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
111
+ className
112
+ )}
113
+ {...props}
114
+ />
115
+ )
116
+ }
72
117
 
73
- const AlertDialogTitle = React.forwardRef<
74
- React.ElementRef<typeof AlertDialogPrimitive.Title>,
75
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
76
- >(({ className, ...props }, ref) => (
77
- <AlertDialogPrimitive.Title
78
- ref={ref}
79
- className={cn("text-lg font-semibold", className)}
80
- {...props}
81
- />
82
- ));
83
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
118
+ function AlertDialogDescription({
119
+ className,
120
+ ...props
121
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
122
+ return (
123
+ <AlertDialogPrimitive.Description
124
+ data-slot="alert-dialog-description"
125
+ className={cn("text-sm text-muted-foreground", className)}
126
+ {...props}
127
+ />
128
+ )
129
+ }
84
130
 
85
- const AlertDialogDescription = React.forwardRef<
86
- React.ElementRef<typeof AlertDialogPrimitive.Description>,
87
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
88
- >(({ className, ...props }, ref) => (
89
- <AlertDialogPrimitive.Description
90
- ref={ref}
91
- className={cn("text-sm text-muted-foreground", className)}
92
- {...props}
93
- />
94
- ));
95
- AlertDialogDescription.displayName =
96
- AlertDialogPrimitive.Description.displayName;
131
+ function AlertDialogMedia({
132
+ className,
133
+ ...props
134
+ }: React.ComponentProps<"div">) {
135
+ return (
136
+ <div
137
+ data-slot="alert-dialog-media"
138
+ className={cn(
139
+ "mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
140
+ className
141
+ )}
142
+ {...props}
143
+ />
144
+ )
145
+ }
97
146
 
98
- const AlertDialogAction = React.forwardRef<
99
- React.ElementRef<typeof AlertDialogPrimitive.Action>,
100
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
101
- >(({ className, ...props }, ref) => (
102
- <AlertDialogPrimitive.Action
103
- ref={ref}
104
- className={cn(buttonVariants(), className)}
105
- {...props}
106
- />
107
- ));
108
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
147
+ function AlertDialogAction({
148
+ className,
149
+ variant = "default",
150
+ size = "default",
151
+ ...props
152
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Action> &
153
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
154
+ return (
155
+ <Button variant={variant} size={size} asChild>
156
+ <AlertDialogPrimitive.Action
157
+ data-slot="alert-dialog-action"
158
+ className={cn(className)}
159
+ {...props}
160
+ />
161
+ </Button>
162
+ )
163
+ }
109
164
 
110
- const AlertDialogCancel = React.forwardRef<
111
- React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
112
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
113
- >(({ className, ...props }, ref) => (
114
- <AlertDialogPrimitive.Cancel
115
- ref={ref}
116
- className={cn(
117
- buttonVariants({ variant: "outline" }),
118
- "mt-2 sm:mt-0",
119
- className
120
- )}
121
- {...props}
122
- />
123
- ));
124
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
165
+ function AlertDialogCancel({
166
+ className,
167
+ variant = "outline",
168
+ size = "default",
169
+ ...props
170
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
171
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
172
+ return (
173
+ <Button variant={variant} size={size} asChild>
174
+ <AlertDialogPrimitive.Cancel
175
+ data-slot="alert-dialog-cancel"
176
+ className={cn(className)}
177
+ {...props}
178
+ />
179
+ </Button>
180
+ )
181
+ }
125
182
 
126
183
  export {
127
184
  AlertDialog,
128
- AlertDialogPortal,
129
- AlertDialogOverlay,
130
- AlertDialogTrigger,
185
+ AlertDialogAction,
186
+ AlertDialogCancel,
131
187
  AlertDialogContent,
132
- AlertDialogHeader,
188
+ AlertDialogDescription,
133
189
  AlertDialogFooter,
190
+ AlertDialogHeader,
191
+ AlertDialogMedia,
192
+ AlertDialogOverlay,
193
+ AlertDialogPortal,
134
194
  AlertDialogTitle,
135
- AlertDialogDescription,
136
- AlertDialogAction,
137
- AlertDialogCancel,
138
- };
195
+ AlertDialogTrigger,
196
+ }
@@ -1,59 +1,66 @@
1
- import { cva, type VariantProps } from "class-variance-authority";
2
- import * as React from "react";
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
3
 
4
- import { cn } from "../lib/utils";
4
+ import { cn } from "../lib/utils"
5
5
 
6
6
  const alertVariants = cva(
7
- "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
7
+ "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
8
8
  {
9
9
  variants: {
10
10
  variant: {
11
- default: "bg-background text-foreground",
11
+ default: "bg-card text-card-foreground",
12
12
  destructive:
13
- "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
13
+ "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current",
14
14
  },
15
15
  },
16
16
  defaultVariants: {
17
17
  variant: "default",
18
18
  },
19
19
  }
20
- );
20
+ )
21
21
 
22
- const Alert = React.forwardRef<
23
- HTMLDivElement,
24
- React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
25
- >(({ className, variant, ...props }, ref) => (
26
- <div
27
- ref={ref}
28
- role="alert"
29
- className={cn(alertVariants({ variant }), className)}
30
- {...props}
31
- />
32
- ));
33
- Alert.displayName = "Alert";
22
+ function Alert({
23
+ className,
24
+ variant,
25
+ ...props
26
+ }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
27
+ return (
28
+ <div
29
+ data-slot="alert"
30
+ role="alert"
31
+ className={cn(alertVariants({ variant }), className)}
32
+ {...props}
33
+ />
34
+ )
35
+ }
34
36
 
35
- const AlertTitle = React.forwardRef<
36
- HTMLParagraphElement,
37
- React.HTMLAttributes<HTMLHeadingElement>
38
- >(({ className, ...props }, ref) => (
39
- <h5
40
- ref={ref}
41
- className={cn("mb-1 font-medium leading-none tracking-tight", className)}
42
- {...props}
43
- />
44
- ));
45
- AlertTitle.displayName = "AlertTitle";
37
+ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
38
+ return (
39
+ <div
40
+ data-slot="alert-title"
41
+ className={cn(
42
+ "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
43
+ className
44
+ )}
45
+ {...props}
46
+ />
47
+ )
48
+ }
46
49
 
47
- const AlertDescription = React.forwardRef<
48
- HTMLParagraphElement,
49
- React.HTMLAttributes<HTMLParagraphElement>
50
- >(({ className, ...props }, ref) => (
51
- <div
52
- ref={ref}
53
- className={cn("text-sm [&_p]:leading-relaxed", className)}
54
- {...props}
55
- />
56
- ));
57
- AlertDescription.displayName = "AlertDescription";
50
+ function AlertDescription({
51
+ className,
52
+ ...props
53
+ }: React.ComponentProps<"div">) {
54
+ return (
55
+ <div
56
+ data-slot="alert-description"
57
+ className={cn(
58
+ "col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed",
59
+ className
60
+ )}
61
+ {...props}
62
+ />
63
+ )
64
+ }
58
65
 
59
- export { Alert, AlertTitle, AlertDescription };
66
+ export { Alert, AlertTitle, AlertDescription }
@@ -1,5 +1,11 @@
1
- import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
1
+ "use client"
2
2
 
3
- const AspectRatio = AspectRatioPrimitive.Root;
3
+ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
4
4
 
5
- export { AspectRatio };
5
+ function AspectRatio({
6
+ ...props
7
+ }: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
8
+ return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
9
+ }
10
+
11
+ export { AspectRatio }