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