@codefast/ui 0.3.16-canary.2 → 0.3.16-canary.3

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 (223) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1 -1
  3. package/dist/components/accordion.mjs +2 -2
  4. package/dist/components/alert-dialog.d.mts +1 -1
  5. package/dist/components/alert-dialog.mjs +4 -4
  6. package/dist/components/alert.d.mts +3 -13
  7. package/dist/components/alert.mjs +3 -23
  8. package/dist/components/badge.d.mts +3 -15
  9. package/dist/components/badge.mjs +2 -44
  10. package/dist/components/breadcrumb.mjs +1 -1
  11. package/dist/components/button-group.d.mts +3 -13
  12. package/dist/components/button-group.mjs +3 -24
  13. package/dist/components/button.d.mts +3 -25
  14. package/dist/components/button.mjs +2 -72
  15. package/dist/components/calendar.mjs +2 -1
  16. package/dist/components/carousel.d.mts +1 -2
  17. package/dist/components/chart.d.mts +2 -4
  18. package/dist/components/checkbox.mjs +2 -2
  19. package/dist/components/context-menu.mjs +2 -2
  20. package/dist/components/dialog.d.mts +1 -1
  21. package/dist/components/dialog.mjs +4 -4
  22. package/dist/components/drawer.d.mts +1 -1
  23. package/dist/components/drawer.mjs +2 -2
  24. package/dist/components/dropdown-menu.mjs +2 -2
  25. package/dist/components/empty.d.mts +3 -13
  26. package/dist/components/empty.mjs +3 -18
  27. package/dist/components/field.d.mts +3 -14
  28. package/dist/components/field.mjs +3 -32
  29. package/dist/components/form.d.mts +2 -4
  30. package/dist/components/hover-card.mjs +1 -1
  31. package/dist/components/input-group.d.mts +4 -31
  32. package/dist/components/input-group.mjs +3 -90
  33. package/dist/components/input-number.mjs +4 -4
  34. package/dist/components/input-otp.mjs +2 -2
  35. package/dist/components/input.mjs +1 -1
  36. package/dist/components/item.d.mts +4 -29
  37. package/dist/components/item.mjs +3 -56
  38. package/dist/components/menubar.mjs +2 -2
  39. package/dist/components/native-select.mjs +1 -1
  40. package/dist/components/navigation-menu.d.mts +1 -6
  41. package/dist/components/navigation-menu.mjs +8 -15
  42. package/dist/components/pagination.d.mts +1 -1
  43. package/dist/components/pagination.mjs +1 -1
  44. package/dist/components/popover.mjs +1 -1
  45. package/dist/components/progress-circle.d.mts +3 -47
  46. package/dist/components/progress-circle.mjs +2 -47
  47. package/dist/components/progress.mjs +1 -1
  48. package/dist/components/radio-group.mjs +1 -1
  49. package/dist/components/radio.mjs +1 -1
  50. package/dist/components/scroll-area.d.mts +3 -19
  51. package/dist/components/scroll-area.mjs +4 -61
  52. package/dist/components/select.d.mts +1 -1
  53. package/dist/components/select.mjs +3 -3
  54. package/dist/components/separator.d.mts +3 -18
  55. package/dist/components/separator.mjs +3 -23
  56. package/dist/components/sheet.d.mts +6 -18
  57. package/dist/components/sheet.mjs +6 -49
  58. package/dist/components/sidebar.d.mts +4 -19
  59. package/dist/components/sidebar.mjs +10 -46
  60. package/dist/components/skeleton.mjs +1 -1
  61. package/dist/components/slider.mjs +1 -1
  62. package/dist/components/spinner.mjs +1 -1
  63. package/dist/components/switch.mjs +2 -2
  64. package/dist/components/table.mjs +1 -1
  65. package/dist/components/tabs.mjs +1 -1
  66. package/dist/components/textarea.mjs +1 -1
  67. package/dist/components/toggle-group.d.mts +3 -2
  68. package/dist/components/toggle-group.mjs +1 -1
  69. package/dist/components/toggle.d.mts +2 -21
  70. package/dist/components/toggle.mjs +2 -39
  71. package/dist/components/tooltip.mjs +1 -1
  72. package/dist/index.d.mts +31 -16
  73. package/dist/index.mjs +30 -15
  74. package/dist/lib/utils.d.mts +1 -12
  75. package/dist/lib/utils.mjs +1 -9
  76. package/dist/primitives/checkbox-group.d.mts +1 -2
  77. package/dist/primitives/input-number.d.mts +1 -2
  78. package/dist/primitives/input.d.mts +1 -2
  79. package/dist/primitives/progress-circle.d.mts +1 -2
  80. package/dist/variants/alert.d.mts +18 -0
  81. package/dist/variants/alert.mjs +25 -0
  82. package/dist/variants/badge.d.mts +20 -0
  83. package/dist/variants/badge.mjs +46 -0
  84. package/dist/variants/button-group.d.mts +18 -0
  85. package/dist/variants/button-group.mjs +26 -0
  86. package/dist/variants/button.d.mts +30 -0
  87. package/dist/variants/button.mjs +76 -0
  88. package/dist/variants/empty.d.mts +18 -0
  89. package/dist/variants/empty.mjs +20 -0
  90. package/dist/variants/field.d.mts +19 -0
  91. package/dist/variants/field.mjs +34 -0
  92. package/dist/variants/input-group.d.mts +43 -0
  93. package/dist/variants/input-group.mjs +93 -0
  94. package/dist/variants/item.d.mts +37 -0
  95. package/dist/variants/item.mjs +60 -0
  96. package/dist/variants/navigation-menu.d.mts +13 -0
  97. package/dist/variants/navigation-menu.mjs +12 -0
  98. package/dist/variants/progress-circle.d.mts +52 -0
  99. package/dist/variants/progress-circle.mjs +49 -0
  100. package/dist/variants/scroll-area.d.mts +24 -0
  101. package/dist/variants/scroll-area.mjs +63 -0
  102. package/dist/variants/separator.d.mts +23 -0
  103. package/dist/variants/separator.mjs +25 -0
  104. package/dist/variants/sheet.d.mts +20 -0
  105. package/dist/variants/sheet.mjs +50 -0
  106. package/dist/variants/sidebar.d.mts +23 -0
  107. package/dist/variants/sidebar.mjs +42 -0
  108. package/dist/variants/toggle.d.mts +23 -0
  109. package/dist/variants/toggle.mjs +43 -0
  110. package/package.json +168 -20
  111. package/src/components/accordion.tsx +156 -0
  112. package/src/components/alert-dialog.tsx +314 -0
  113. package/src/components/alert.tsx +86 -0
  114. package/src/components/aspect-ratio.tsx +28 -0
  115. package/src/components/avatar.tsx +84 -0
  116. package/src/components/badge.tsx +38 -0
  117. package/src/components/breadcrumb.tsx +197 -0
  118. package/src/components/button-group.tsx +107 -0
  119. package/src/components/button.tsx +66 -0
  120. package/src/components/calendar.tsx +277 -0
  121. package/src/components/card.tsx +175 -0
  122. package/src/components/carousel.tsx +367 -0
  123. package/src/components/chart.tsx +587 -0
  124. package/src/components/checkbox-cards.tsx +92 -0
  125. package/src/components/checkbox-group.tsx +83 -0
  126. package/src/components/checkbox.tsx +65 -0
  127. package/src/components/collapsible.tsx +60 -0
  128. package/src/components/command.tsx +311 -0
  129. package/src/components/context-menu.tsx +489 -0
  130. package/src/components/dialog.tsx +295 -0
  131. package/src/components/drawer.tsx +271 -0
  132. package/src/components/dropdown-menu.tsx +498 -0
  133. package/src/components/empty.tsx +169 -0
  134. package/src/components/field.tsx +362 -0
  135. package/src/components/form.tsx +300 -0
  136. package/src/components/hover-card.tsx +116 -0
  137. package/src/components/input-group.tsx +224 -0
  138. package/src/components/input-number.tsx +161 -0
  139. package/src/components/input-otp.tsx +151 -0
  140. package/src/components/input-password.tsx +74 -0
  141. package/src/components/input-search.tsx +98 -0
  142. package/src/components/input.tsx +52 -0
  143. package/src/components/item.tsx +280 -0
  144. package/src/components/kbd.tsx +59 -0
  145. package/src/components/label.tsx +44 -0
  146. package/src/components/menubar.tsx +531 -0
  147. package/src/components/native-select.tsx +96 -0
  148. package/src/components/navigation-menu.tsx +295 -0
  149. package/src/components/pagination.tsx +204 -0
  150. package/src/components/popover.tsx +139 -0
  151. package/src/components/progress-circle.tsx +203 -0
  152. package/src/components/progress.tsx +54 -0
  153. package/src/components/radio-cards.tsx +85 -0
  154. package/src/components/radio-group.tsx +79 -0
  155. package/src/components/radio.tsx +61 -0
  156. package/src/components/resizable.tsx +99 -0
  157. package/src/components/scroll-area.tsx +115 -0
  158. package/src/components/select.tsx +319 -0
  159. package/src/components/separator.tsx +74 -0
  160. package/src/components/sheet.tsx +278 -0
  161. package/src/components/sidebar.tsx +1056 -0
  162. package/src/components/skeleton.tsx +37 -0
  163. package/src/components/slider.tsx +95 -0
  164. package/src/components/sonner.tsx +47 -0
  165. package/src/components/spinner.tsx +75 -0
  166. package/src/components/switch.tsx +66 -0
  167. package/src/components/table.tsx +200 -0
  168. package/src/components/tabs.tsx +128 -0
  169. package/src/components/textarea.tsx +49 -0
  170. package/src/components/toggle-group.tsx +141 -0
  171. package/src/components/toggle.tsx +39 -0
  172. package/src/components/tooltip.tsx +141 -0
  173. package/src/css/amber.css +59 -22
  174. package/src/css/blue.css +59 -22
  175. package/src/css/cyan.css +59 -22
  176. package/src/css/emerald.css +59 -22
  177. package/src/css/fuchsia.css +59 -22
  178. package/src/css/gray.css +59 -22
  179. package/src/css/green.css +59 -22
  180. package/src/css/indigo.css +59 -22
  181. package/src/css/lime.css +59 -22
  182. package/src/css/neutral.css +59 -22
  183. package/src/css/orange.css +59 -22
  184. package/src/css/pink.css +59 -22
  185. package/src/css/preset.css +32 -13
  186. package/src/css/purple.css +59 -22
  187. package/src/css/red.css +59 -22
  188. package/src/css/rose.css +59 -22
  189. package/src/css/sky.css +59 -22
  190. package/src/css/slate.css +59 -22
  191. package/src/css/stone.css +59 -22
  192. package/src/css/teal.css +59 -22
  193. package/src/css/violet.css +59 -22
  194. package/src/css/yellow.css +59 -22
  195. package/src/css/zinc.css +59 -22
  196. package/src/hooks/use-animated-value.ts +97 -0
  197. package/src/hooks/use-copy-to-clipboard.ts +63 -0
  198. package/src/hooks/use-is-mobile.ts +27 -0
  199. package/src/hooks/use-media-query.ts +71 -0
  200. package/src/hooks/use-mutation-observer.ts +54 -0
  201. package/src/hooks/use-pagination.ts +166 -0
  202. package/src/index.ts +720 -0
  203. package/src/lib/utils.ts +5 -0
  204. package/src/primitives/checkbox-group.tsx +360 -0
  205. package/src/primitives/input-number.tsx +1013 -0
  206. package/src/primitives/input.tsx +243 -0
  207. package/src/primitives/progress-circle.tsx +537 -0
  208. package/src/variants/alert.ts +45 -0
  209. package/src/variants/badge.ts +66 -0
  210. package/src/variants/button-group.ts +49 -0
  211. package/src/variants/button.ts +93 -0
  212. package/src/variants/empty.ts +43 -0
  213. package/src/variants/field.ts +50 -0
  214. package/src/variants/input-group.ts +132 -0
  215. package/src/variants/item.ts +90 -0
  216. package/src/variants/navigation-menu.ts +32 -0
  217. package/src/variants/progress-circle.ts +47 -0
  218. package/src/variants/scroll-area.ts +79 -0
  219. package/src/variants/separator.ts +41 -0
  220. package/src/variants/sheet.ts +70 -0
  221. package/src/variants/sidebar.ts +61 -0
  222. package/src/variants/toggle.ts +59 -0
  223. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
@@ -0,0 +1,295 @@
1
+ "use client";
2
+
3
+ import type { VariantProps } from "#/lib/utils";
4
+ import type { ComponentProps, JSX } from "react";
5
+
6
+ import { cn } from "#/lib/utils";
7
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
8
+ import { XIcon } from "lucide-react";
9
+
10
+ import { buttonVariants } from "#/variants/button";
11
+
12
+ /* -----------------------------------------------------------------------------
13
+ * Component: Dialog
14
+ * -------------------------------------------------------------------------- */
15
+
16
+ /**
17
+ * @since 0.3.16-canary.0
18
+ */
19
+ type DialogProps = ComponentProps<typeof DialogPrimitive.Root>;
20
+
21
+ /**
22
+ * @since 0.3.16-canary.0
23
+ */
24
+ function Dialog({ ...props }: DialogProps): JSX.Element {
25
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;
26
+ }
27
+
28
+ /* -----------------------------------------------------------------------------
29
+ * Component: DialogTrigger
30
+ * -------------------------------------------------------------------------- */
31
+
32
+ /**
33
+ * @since 0.3.16-canary.0
34
+ */
35
+ type DialogTriggerProps = ComponentProps<typeof DialogPrimitive.Trigger>;
36
+
37
+ /**
38
+ * @since 0.3.16-canary.0
39
+ */
40
+ function DialogTrigger({ ...props }: DialogTriggerProps): JSX.Element {
41
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
42
+ }
43
+
44
+ /* -----------------------------------------------------------------------------
45
+ * Component: DialogContent
46
+ * -------------------------------------------------------------------------- */
47
+
48
+ /**
49
+ * @since 0.3.16-canary.0
50
+ */
51
+ interface DialogContentProps extends ComponentProps<typeof DialogPrimitive.Content> {
52
+ classNames?: {
53
+ close?: string;
54
+ content?: string;
55
+ overlay?: string;
56
+ wrapper?: string;
57
+ };
58
+ }
59
+
60
+ /**
61
+ * @since 0.3.16-canary.0
62
+ */
63
+ function DialogContent({
64
+ children,
65
+ className,
66
+ classNames,
67
+ ...props
68
+ }: DialogContentProps): JSX.Element {
69
+ return (
70
+ <DialogPrimitive.Portal>
71
+ <DialogPrimitive.Overlay
72
+ className={cn(
73
+ "fixed inset-0 z-50",
74
+ "bg-black/40 backdrop-blur-sm",
75
+ "ease-gentle data-open:animate-in data-open:duration-300 data-open:fade-in-0",
76
+ "data-closed:animate-out data-closed:duration-200 data-closed:fade-out-0",
77
+ "motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
78
+ classNames?.overlay,
79
+ )}
80
+ data-slot="dialog-overlay"
81
+ />
82
+ <DialogPrimitive.Content
83
+ className={cn(
84
+ "fixed inset-0 z-50 grid grid-rows-[1fr_auto] justify-items-center overflow-auto",
85
+ "sm:grid-rows-[1fr_auto_3fr] sm:p-4",
86
+ "ease-gentle data-open:animate-in data-open:duration-300",
87
+ "max-sm:data-open:animation-duration-380 max-sm:data-open:slide-in-from-bottom",
88
+ "sm:data-open:fade-in-0 sm:data-open:zoom-in-95",
89
+ "data-closed:animate-out data-closed:duration-200",
90
+ "max-sm:data-closed:animation-duration-280 max-sm:data-closed:slide-out-to-bottom",
91
+ "sm:data-closed:fade-out-0 sm:data-closed:zoom-out-95",
92
+ "motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
93
+ classNames?.wrapper,
94
+ )}
95
+ data-slot="dialog-content-wrapper"
96
+ {...props}
97
+ >
98
+ <div
99
+ className={cn(
100
+ "relative row-start-2 flex w-full flex-col",
101
+ "rounded-t-2xl border",
102
+ "bg-popover text-popover-foreground shadow-lg",
103
+ "sm:max-w-lg sm:rounded-2xl",
104
+ classNames?.content,
105
+ className,
106
+ )}
107
+ data-slot="dialog-content"
108
+ >
109
+ {children}
110
+ <DialogPrimitive.Close
111
+ className={buttonVariants({
112
+ className: ["absolute top-2.5 right-2.5 size-7", classNames?.close],
113
+ size: "icon",
114
+ variant: "ghost",
115
+ })}
116
+ data-slot="dialog-close"
117
+ >
118
+ <XIcon className="size-4" />
119
+ <span className="sr-only">Close</span>
120
+ </DialogPrimitive.Close>
121
+ </div>
122
+ </DialogPrimitive.Content>
123
+ </DialogPrimitive.Portal>
124
+ );
125
+ }
126
+
127
+ /* -----------------------------------------------------------------------------
128
+ * Component: DialogHeader
129
+ * -------------------------------------------------------------------------- */
130
+
131
+ /**
132
+ * @since 0.3.16-canary.0
133
+ */
134
+ type DialogHeaderProps = ComponentProps<"div">;
135
+
136
+ /**
137
+ * @since 0.3.16-canary.0
138
+ */
139
+ function DialogHeader({ className, ...props }: DialogHeaderProps): JSX.Element {
140
+ return (
141
+ <header
142
+ className={cn(
143
+ "flex shrink-0 flex-col gap-1.5 px-6 pt-6 pb-2 text-center",
144
+ "sm:text-left",
145
+ className,
146
+ )}
147
+ data-slot="dialog-header"
148
+ {...props}
149
+ />
150
+ );
151
+ }
152
+
153
+ /* -----------------------------------------------------------------------------
154
+ * Component: DialogBody
155
+ * -------------------------------------------------------------------------- */
156
+
157
+ /**
158
+ * @since 0.3.16-canary.0
159
+ */
160
+ type DialogBodyProps = ComponentProps<"div">;
161
+
162
+ /**
163
+ * @since 0.3.16-canary.0
164
+ */
165
+ function DialogBody({ className, ...props }: DialogBodyProps): JSX.Element {
166
+ return (
167
+ <main
168
+ className={cn("overflow-auto", "px-6 py-2", className)}
169
+ data-slot="dialog-body"
170
+ {...props}
171
+ />
172
+ );
173
+ }
174
+
175
+ /* -----------------------------------------------------------------------------
176
+ * Component: DialogFooter
177
+ * -------------------------------------------------------------------------- */
178
+
179
+ /**
180
+ * @since 0.3.16-canary.0
181
+ */
182
+ type DialogFooterProps = ComponentProps<"div">;
183
+
184
+ /**
185
+ * @since 0.3.16-canary.0
186
+ */
187
+ function DialogFooter({ className, ...props }: DialogFooterProps): JSX.Element {
188
+ return (
189
+ <footer
190
+ className={cn(
191
+ "flex shrink-0 flex-col-reverse gap-2 px-6 pt-2 pb-6",
192
+ "sm:flex-row sm:justify-end",
193
+ className,
194
+ )}
195
+ data-slot="dialog-footer"
196
+ {...props}
197
+ />
198
+ );
199
+ }
200
+
201
+ /* -----------------------------------------------------------------------------
202
+ * Component: DialogTitle
203
+ * -------------------------------------------------------------------------- */
204
+
205
+ /**
206
+ * @since 0.3.16-canary.0
207
+ */
208
+ type DialogTitleProps = ComponentProps<typeof DialogPrimitive.Title>;
209
+
210
+ /**
211
+ * @since 0.3.16-canary.0
212
+ */
213
+ function DialogTitle({ className, ...props }: DialogTitleProps): JSX.Element {
214
+ return (
215
+ <DialogPrimitive.Title
216
+ className={cn("text-lg leading-none font-semibold tracking-tight", className)}
217
+ data-slot="dialog-title"
218
+ {...props}
219
+ />
220
+ );
221
+ }
222
+
223
+ /* -----------------------------------------------------------------------------
224
+ * Component: DialogDescription
225
+ * -------------------------------------------------------------------------- */
226
+
227
+ /**
228
+ * @since 0.3.16-canary.0
229
+ */
230
+ type DialogDescriptionProps = ComponentProps<typeof DialogPrimitive.Description>;
231
+
232
+ /**
233
+ * @since 0.3.16-canary.0
234
+ */
235
+ function DialogDescription({ className, ...props }: DialogDescriptionProps): JSX.Element {
236
+ return (
237
+ <DialogPrimitive.Description
238
+ className={cn("text-sm text-muted-foreground", className)}
239
+ data-slot="dialog-description"
240
+ {...props}
241
+ />
242
+ );
243
+ }
244
+
245
+ /* -----------------------------------------------------------------------------
246
+ * Component: DialogClose
247
+ * -------------------------------------------------------------------------- */
248
+
249
+ /**
250
+ * @since 0.3.16-canary.0
251
+ */
252
+ interface DialogCloseProps extends Omit<ComponentProps<typeof DialogPrimitive.Close>, "ref"> {
253
+ size?: VariantProps<typeof buttonVariants>["size"];
254
+ variant?: VariantProps<typeof buttonVariants>["variant"];
255
+ }
256
+
257
+ /**
258
+ * @since 0.3.16-canary.0
259
+ */
260
+ function DialogClose({ className, size, variant, ...props }: DialogCloseProps): JSX.Element {
261
+ return (
262
+ <DialogPrimitive.Close
263
+ className={buttonVariants({ className, size, variant })}
264
+ data-slot="dialog-close"
265
+ {...props}
266
+ />
267
+ );
268
+ }
269
+
270
+ /* -----------------------------------------------------------------------------
271
+ * Exports
272
+ * -------------------------------------------------------------------------- */
273
+
274
+ export {
275
+ Dialog,
276
+ DialogBody,
277
+ DialogClose,
278
+ DialogContent,
279
+ DialogDescription,
280
+ DialogFooter,
281
+ DialogHeader,
282
+ DialogTitle,
283
+ DialogTrigger,
284
+ };
285
+ export type {
286
+ DialogBodyProps,
287
+ DialogCloseProps,
288
+ DialogContentProps,
289
+ DialogDescriptionProps,
290
+ DialogFooterProps,
291
+ DialogHeaderProps,
292
+ DialogProps,
293
+ DialogTitleProps,
294
+ DialogTriggerProps,
295
+ };
@@ -0,0 +1,271 @@
1
+ "use client";
2
+
3
+ import type { VariantProps } from "#/lib/utils";
4
+ import type { ComponentProps, JSX } from "react";
5
+
6
+ import { cn } from "#/lib/utils";
7
+ import { Drawer as DrawerPrimitive } from "vaul";
8
+
9
+ import { buttonVariants } from "#/variants/button";
10
+
11
+ /* -----------------------------------------------------------------------------
12
+ * Component: Drawer
13
+ * -------------------------------------------------------------------------- */
14
+
15
+ /**
16
+ * @since 0.3.16-canary.0
17
+ */
18
+ type DrawerProps = ComponentProps<typeof DrawerPrimitive.Root>;
19
+
20
+ /**
21
+ * @since 0.3.16-canary.0
22
+ */
23
+ function Drawer({ shouldScaleBackground = true, ...props }: DrawerProps): JSX.Element {
24
+ return (
25
+ <DrawerPrimitive.Root
26
+ data-slot="drawer"
27
+ shouldScaleBackground={shouldScaleBackground}
28
+ {...props}
29
+ />
30
+ );
31
+ }
32
+
33
+ /* -----------------------------------------------------------------------------
34
+ * Component: DrawerTrigger
35
+ * -------------------------------------------------------------------------- */
36
+
37
+ /**
38
+ * @since 0.3.16-canary.0
39
+ */
40
+ type DrawerTriggerProps = ComponentProps<typeof DrawerPrimitive.Trigger>;
41
+
42
+ /**
43
+ * @since 0.3.16-canary.0
44
+ */
45
+ function DrawerTrigger({ ...props }: DrawerTriggerProps): JSX.Element {
46
+ return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
47
+ }
48
+
49
+ /* -----------------------------------------------------------------------------
50
+ * Component: DrawerContent
51
+ * -------------------------------------------------------------------------- */
52
+
53
+ /**
54
+ * @since 0.3.16-canary.0
55
+ */
56
+ interface DrawerContentProps extends ComponentProps<typeof DrawerPrimitive.Content> {
57
+ classNames?: {
58
+ content?: string;
59
+ handle?: string;
60
+ overlay?: string;
61
+ };
62
+ }
63
+
64
+ /**
65
+ * @since 0.3.16-canary.0
66
+ */
67
+ function DrawerContent({
68
+ children,
69
+ className,
70
+ classNames,
71
+ ...props
72
+ }: DrawerContentProps): JSX.Element {
73
+ return (
74
+ <DrawerPrimitive.Portal>
75
+ <DrawerPrimitive.Overlay
76
+ className={cn("fixed inset-0 z-50", "bg-black/50", classNames?.overlay)}
77
+ data-slot="drawer-overlay"
78
+ />
79
+ <DrawerPrimitive.Content
80
+ className={cn(
81
+ "group/drawer-content fixed z-50 flex h-auto flex-col",
82
+ "bg-background",
83
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-2xl",
84
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4",
85
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4",
86
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-2xl",
87
+ "data-[vaul-drawer-direction=left]:sm:max-w-sm",
88
+ "data-[vaul-drawer-direction=right]:sm:max-w-sm",
89
+ classNames?.content,
90
+ className,
91
+ )}
92
+ data-slot="drawer-content"
93
+ {...props}
94
+ >
95
+ <div
96
+ className={cn(
97
+ "hidden",
98
+ "mx-auto mt-4 h-1.5 w-12 shrink-0",
99
+ "rounded-full",
100
+ "bg-muted",
101
+ "group-data-[vaul-drawer-direction=bottom]/drawer-content:block",
102
+ classNames?.handle,
103
+ )}
104
+ />
105
+ {children}
106
+ </DrawerPrimitive.Content>
107
+ </DrawerPrimitive.Portal>
108
+ );
109
+ }
110
+
111
+ /* -----------------------------------------------------------------------------
112
+ * Component: DrawerHeader
113
+ * -------------------------------------------------------------------------- */
114
+
115
+ /**
116
+ * @since 0.3.16-canary.0
117
+ */
118
+ type DrawerHeaderProps = ComponentProps<"div">;
119
+
120
+ /**
121
+ * @since 0.3.16-canary.0
122
+ */
123
+ function DrawerHeader({ className, ...props }: DrawerHeaderProps): JSX.Element {
124
+ return (
125
+ <div
126
+ className={cn("flex flex-col gap-1.5", "p-4", className)}
127
+ data-slot="drawer-header"
128
+ {...props}
129
+ />
130
+ );
131
+ }
132
+
133
+ /* -----------------------------------------------------------------------------
134
+ * Component: DrawerBody
135
+ * -------------------------------------------------------------------------- */
136
+
137
+ /**
138
+ * @since 0.3.16-canary.0
139
+ */
140
+ type DrawerBodyProps = ComponentProps<"div">;
141
+
142
+ /**
143
+ * @since 0.3.16-canary.0
144
+ */
145
+ function DrawerBody({ className, ...props }: DrawerBodyProps): JSX.Element {
146
+ return (
147
+ <main
148
+ className={cn("overflow-auto", "px-6 py-2", className)}
149
+ data-slot="drawer-body"
150
+ {...props}
151
+ />
152
+ );
153
+ }
154
+
155
+ /* -----------------------------------------------------------------------------
156
+ * Component: DrawerFooter
157
+ * -------------------------------------------------------------------------- */
158
+
159
+ /**
160
+ * @since 0.3.16-canary.0
161
+ */
162
+ type DrawerFooterProps = ComponentProps<"div">;
163
+
164
+ /**
165
+ * @since 0.3.16-canary.0
166
+ */
167
+ function DrawerFooter({ className, ...props }: DrawerFooterProps): JSX.Element {
168
+ return (
169
+ <div
170
+ className={cn("flex flex-col gap-2", "mt-auto p-4", className)}
171
+ data-slot="drawer-footer"
172
+ {...props}
173
+ />
174
+ );
175
+ }
176
+
177
+ /* -----------------------------------------------------------------------------
178
+ * Component: DrawerTitle
179
+ * -------------------------------------------------------------------------- */
180
+
181
+ /**
182
+ * @since 0.3.16-canary.0
183
+ */
184
+ type DrawerTitleProps = ComponentProps<typeof DrawerPrimitive.Title>;
185
+
186
+ /**
187
+ * @since 0.3.16-canary.0
188
+ */
189
+ function DrawerTitle({ className, ...props }: DrawerTitleProps): JSX.Element {
190
+ return (
191
+ <DrawerPrimitive.Title
192
+ className={cn("font-semibold text-foreground", className)}
193
+ data-slot="drawer-title"
194
+ {...props}
195
+ />
196
+ );
197
+ }
198
+
199
+ /* -----------------------------------------------------------------------------
200
+ * Component: DrawerDescription
201
+ * -------------------------------------------------------------------------- */
202
+
203
+ /**
204
+ * @since 0.3.16-canary.0
205
+ */
206
+ type DrawerDescriptionProps = ComponentProps<typeof DrawerPrimitive.Description>;
207
+
208
+ /**
209
+ * @since 0.3.16-canary.0
210
+ */
211
+ function DrawerDescription({ className, ...props }: DrawerDescriptionProps): JSX.Element {
212
+ return (
213
+ <DrawerPrimitive.Description
214
+ className={cn("text-sm text-muted-foreground", className)}
215
+ data-slot="drawer-description"
216
+ {...props}
217
+ />
218
+ );
219
+ }
220
+
221
+ /* -----------------------------------------------------------------------------
222
+ * Component: DrawerClose
223
+ * -------------------------------------------------------------------------- */
224
+
225
+ /**
226
+ * @since 0.3.16-canary.0
227
+ */
228
+ interface DrawerCloseProps extends ComponentProps<typeof DrawerPrimitive.Close> {
229
+ size?: VariantProps<typeof buttonVariants>["size"];
230
+ variant?: VariantProps<typeof buttonVariants>["variant"];
231
+ }
232
+
233
+ /**
234
+ * @since 0.3.16-canary.0
235
+ */
236
+ function DrawerClose({ className, size, variant, ...props }: DrawerCloseProps): JSX.Element {
237
+ return (
238
+ <DrawerPrimitive.Close
239
+ className={buttonVariants({ className, size, variant })}
240
+ data-slot="drawer-close"
241
+ {...props}
242
+ />
243
+ );
244
+ }
245
+
246
+ /* -----------------------------------------------------------------------------
247
+ * Exports
248
+ * -------------------------------------------------------------------------- */
249
+
250
+ export {
251
+ Drawer,
252
+ DrawerBody,
253
+ DrawerClose,
254
+ DrawerContent,
255
+ DrawerDescription,
256
+ DrawerFooter,
257
+ DrawerHeader,
258
+ DrawerTitle,
259
+ DrawerTrigger,
260
+ };
261
+ export type {
262
+ DrawerBodyProps,
263
+ DrawerCloseProps,
264
+ DrawerContentProps,
265
+ DrawerDescriptionProps,
266
+ DrawerFooterProps,
267
+ DrawerHeaderProps,
268
+ DrawerProps,
269
+ DrawerTitleProps,
270
+ DrawerTriggerProps,
271
+ };