@catalystsoftware/ui 1.0.4 → 1.0.5

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 (157) hide show
  1. package/data/tailwind.config.js +261 -3821
  2. package/dist/components/catalyst-ui/buttons/burger.tsx +207 -0
  3. package/dist/components/catalyst-ui/core/data-display/timeline.tsx +210 -0
  4. package/dist/components/catalyst-ui/core/feedback/alert.tsx +491 -0
  5. package/dist/components/catalyst-ui/core/feedback/spinner-1.tsx +65 -0
  6. package/dist/components/catalyst-ui/core/feedback/toast.tsx +1857 -0
  7. package/dist/components/catalyst-ui/core/navigation/menu.tsx +164 -0
  8. package/dist/components/catalyst-ui/forms/toggle-class.tsx +176 -0
  9. package/dist/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +419 -0
  10. package/dist/components/catalyst-ui/hooks/use-counter.tsx +13 -0
  11. package/dist/components/catalyst-ui/hooks/use-event-listener.tsx +23 -0
  12. package/dist/components/catalyst-ui/hooks/use-export-markdown.tsx +47 -0
  13. package/dist/components/catalyst-ui/hooks/use-focus.tsx +17 -0
  14. package/dist/components/catalyst-ui/hooks/use-interval.tsx +23 -0
  15. package/dist/components/catalyst-ui/hooks/use-is-client.tsx +16 -0
  16. package/dist/components/catalyst-ui/hooks/use-media-query.tsx +19 -0
  17. package/dist/components/catalyst-ui/hooks/use-mobile.tsx +19 -0
  18. package/dist/components/catalyst-ui/hooks/use-resize-observer.tsx +81 -0
  19. package/dist/components/catalyst-ui/hooks/use-timeout.tsx +21 -0
  20. package/dist/components/catalyst-ui/hooks/use-timer.tsx +209 -0
  21. package/dist/components/catalyst-ui/hooks/use-toggle.tsx +12 -0
  22. package/dist/components/catalyst-ui/media/image.tsx +13 -0
  23. package/dist/components/catalyst-ui/overlays/dual-sidebar.tsx +4142 -0
  24. package/dist/components/catalyst-ui/overlays/sidebar-original.tsx +726 -0
  25. package/dist/components/catalyst-ui/primitives/accordion.tsx +250 -0
  26. package/dist/components/catalyst-ui/primitives/alert-dialog.tsx +126 -0
  27. package/dist/components/catalyst-ui/primitives/aspect-ratio.tsx +9 -0
  28. package/dist/components/catalyst-ui/primitives/avatar.tsx +296 -0
  29. package/dist/components/catalyst-ui/primitives/badge.tsx +57 -0
  30. package/dist/components/catalyst-ui/primitives/breadcrumb.tsx +101 -0
  31. package/dist/components/catalyst-ui/primitives/button.tsx +265 -0
  32. package/dist/components/catalyst-ui/primitives/calendar-v4.tsx +208 -0
  33. package/dist/components/catalyst-ui/primitives/calendar.tsx +295 -0
  34. package/dist/components/catalyst-ui/primitives/card.tsx +618 -0
  35. package/dist/components/catalyst-ui/primitives/carousel.tsx +238 -0
  36. package/dist/components/catalyst-ui/primitives/chart.tsx +347 -0
  37. package/dist/components/catalyst-ui/primitives/checkbox.tsx +225 -0
  38. package/dist/components/catalyst-ui/primitives/collapsible.tsx +212 -0
  39. package/dist/components/catalyst-ui/primitives/command.tsx +393 -0
  40. package/dist/components/catalyst-ui/primitives/context-menu.tsx +236 -0
  41. package/dist/components/catalyst-ui/primitives/dialog.tsx +471 -0
  42. package/dist/components/catalyst-ui/primitives/drawer.tsx +761 -0
  43. package/dist/components/catalyst-ui/primitives/dropdown-menu.tsx +290 -0
  44. package/dist/components/catalyst-ui/primitives/empty.tsx +104 -0
  45. package/dist/components/catalyst-ui/primitives/field.tsx +244 -0
  46. package/dist/components/catalyst-ui/primitives/hover-card.tsx +124 -0
  47. package/dist/components/catalyst-ui/primitives/input-otp.tsx +76 -0
  48. package/dist/components/catalyst-ui/primitives/input.tsx +64 -0
  49. package/dist/components/catalyst-ui/primitives/item.tsx +196 -0
  50. package/dist/components/catalyst-ui/primitives/kbd.tsx +75 -0
  51. package/dist/components/catalyst-ui/primitives/label.tsx +24 -0
  52. package/dist/components/catalyst-ui/primitives/navigation-menu.tsx +150 -0
  53. package/dist/components/catalyst-ui/primitives/pagination.tsx +198 -0
  54. package/dist/components/catalyst-ui/primitives/popover.tsx +232 -0
  55. package/dist/components/catalyst-ui/primitives/progress.tsx +34 -0
  56. package/dist/components/catalyst-ui/primitives/radio-group.tsx +43 -0
  57. package/dist/components/catalyst-ui/primitives/resizable.tsx +56 -0
  58. package/dist/components/catalyst-ui/primitives/select.tsx +155 -0
  59. package/dist/components/catalyst-ui/primitives/separator.tsx +74 -0
  60. package/dist/components/catalyst-ui/primitives/sheet.tsx +126 -0
  61. package/dist/components/catalyst-ui/primitives/skeleton.tsx +15 -0
  62. package/dist/components/catalyst-ui/primitives/slider.tsx +27 -0
  63. package/dist/components/catalyst-ui/primitives/switch.tsx +187 -0
  64. package/dist/components/catalyst-ui/primitives/tabs.tsx +335 -0
  65. package/dist/components/catalyst-ui/primitives/textarea.tsx +24 -0
  66. package/dist/components/catalyst-ui/primitives/toggle-group.tsx +55 -0
  67. package/dist/components/catalyst-ui/primitives/toggle.tsx +42 -0
  68. package/dist/components/catalyst-ui/primitives/tooltip.tsx +116 -0
  69. package/dist/components/catalyst-ui/utils/basic-auth.tsx +40 -0
  70. package/dist/components/catalyst-ui/utils/context-storage.tsx +19 -0
  71. package/dist/components/catalyst-ui/utils/cors-middleware.tsx +71 -0
  72. package/dist/components/catalyst-ui/utils/deferred-content.tsx +595 -0
  73. package/dist/components/catalyst-ui/utils/honeypot-middleware.tsx +38 -0
  74. package/dist/components/catalyst-ui/utils/incId.tsx +75 -0
  75. package/dist/components/catalyst-ui/utils/jwk-auth.tsx +36 -0
  76. package/dist/components/catalyst-ui/utils/request-id.tsx +14 -0
  77. package/dist/components/catalyst-ui/utils/secure-headers.tsx +37 -0
  78. package/dist/components/catalyst-ui/utils/server-timing.tsx +23 -0
  79. package/dist/components/catalyst-ui/utils/utils.ts +43 -0
  80. package/dist/components/catalyst-ui/utils/with-cookie.tsx +43 -0
  81. package/dist/components/catalyst-ui/x/accordian-x.tsx +428 -0
  82. package/dist/components/catalyst-ui/x/alert-x.tsx +413 -0
  83. package/dist/components/catalyst-ui/x/animated-text-x.tsx +2242 -0
  84. package/dist/components/catalyst-ui/x/avatar-x.tsx +515 -0
  85. package/dist/components/catalyst-ui/x/badge-x.tsx +670 -0
  86. package/dist/components/catalyst-ui/x/button-X.tsx +2857 -0
  87. package/dist/components/catalyst-ui/x/button-group-x.tsx +847 -0
  88. package/dist/components/catalyst-ui/x/calendar-x.tsx +1910 -0
  89. package/dist/components/catalyst-ui/x/card-x.tsx +2597 -0
  90. package/dist/components/catalyst-ui/x/checkbox-x.tsx +656 -0
  91. package/dist/components/catalyst-ui/x/collapsible-x.tsx +1360 -0
  92. package/dist/components/catalyst-ui/x/combobox-x.tsx +911 -0
  93. package/dist/components/catalyst-ui/x/data-table-x.tsx +1753 -0
  94. package/dist/components/catalyst-ui/x/date-picker-x.tsx +648 -0
  95. package/dist/components/catalyst-ui/x/dialog-x.tsx +659 -0
  96. package/dist/components/catalyst-ui/x/dropdown-menu-x.tsx +612 -0
  97. package/dist/components/catalyst-ui/x/hover-card-x.tsx +375 -0
  98. package/dist/components/catalyst-ui/x/icon-x.tsx +840 -0
  99. package/dist/components/catalyst-ui/x/input-mask-x.tsx +981 -0
  100. package/dist/components/catalyst-ui/x/input-otp-x.tsx +659 -0
  101. package/dist/components/catalyst-ui/x/loader-x.tsx +1757 -0
  102. package/dist/components/catalyst-ui/x/pagination-x.tsx +622 -0
  103. package/dist/components/catalyst-ui/x/popover-x.tsx +744 -0
  104. package/dist/components/catalyst-ui/x/radio-group-x.tsx +499 -0
  105. package/dist/components/catalyst-ui/x/select-x.tsx +1127 -0
  106. package/dist/components/catalyst-ui/x/sheet-x.tsx +668 -0
  107. package/dist/components/catalyst-ui/x/switch-x.tsx +681 -0
  108. package/dist/components/catalyst-ui/x/table-x.tsx +574 -0
  109. package/dist/components/catalyst-ui/x/tabs-x.tsx +839 -0
  110. package/dist/components/catalyst-ui/x/textarea-x.tsx +1263 -0
  111. package/dist/components/catalyst-ui/x/tooltip-x.tsx +396 -0
  112. package/dist/components/catalyst-ui/x/tracker-x.tsx +560 -0
  113. package/dist/data/bg-data.tsx +901 -0
  114. package/dist/data/buttons-data.tsx +2327 -0
  115. package/dist/data/charts-data.tsx +102 -0
  116. package/dist/data/chat-data.tsx +83 -0
  117. package/dist/data/code-data.tsx +1040 -0
  118. package/dist/data/comboboxes-data.tsx +1843 -0
  119. package/dist/data/command-data.tsx +1381 -0
  120. package/dist/data/core-data.tsx +15953 -0
  121. package/dist/data/crm-data.tsx +47 -0
  122. package/dist/data/data.tsx +159 -0
  123. package/dist/data/date-and-time-data.tsx +554 -0
  124. package/dist/data/dependencies.tsx +7 -0
  125. package/dist/data/ecommerce-data.tsx +1387 -0
  126. package/dist/data/forms-data.tsx +7890 -0
  127. package/dist/data/hooks-data.tsx +5487 -0
  128. package/dist/data/index.ts +34 -0
  129. package/dist/data/inputs-data.tsx +557 -0
  130. package/dist/data/interactive-data.tsx +5394 -0
  131. package/dist/data/lofi-data.tsx +18295 -0
  132. package/dist/data/marketing-data.tsx +2546 -0
  133. package/dist/data/media-data.tsx +1510 -0
  134. package/dist/data/motion-data.tsx +5801 -0
  135. package/dist/data/overlay-data.tsx +4136 -0
  136. package/dist/data/pdf-data.tsx +124 -0
  137. package/dist/data/pos-data.tsx +213 -0
  138. package/dist/data/postcss.config.js +6 -0
  139. package/dist/data/primitive-data.tsx +5170 -0
  140. package/dist/data/prompt-data.tsx +1226 -0
  141. package/dist/data/requiredLibs.ts +4 -0
  142. package/dist/data/sandbox-data.tsx +1 -0
  143. package/dist/data/sidebars-data.tsx +5421 -0
  144. package/dist/data/stacks-data.tsx +32 -0
  145. package/dist/data/table-data.tsx +706 -0
  146. package/dist/data/tailwind.config.js +270 -0
  147. package/dist/data/tailwind.config.ngin.js +3830 -0
  148. package/dist/data/tailwind.css +431 -0
  149. package/dist/data/tools-data.tsx +6910 -0
  150. package/dist/data/typography-data.tsx +2050 -0
  151. package/dist/data/utils-data.tsx +6500 -0
  152. package/dist/data/x-data.tsx +1171 -0
  153. package/dist/data.tsx +159 -0
  154. package/package.json +1 -1
  155. package/dist/index.d.ts +0 -3
  156. package/dist/index.d.ts.map +0 -1
  157. package/dist/index.js.map +0 -362
@@ -0,0 +1,761 @@
1
+ import * as React from "react";
2
+ import { cn, } from '~/components/catalyst-ui';
3
+ import { Button, } from '~/components/catalyst-ui';
4
+ import { Input, } from "~/components/catalyst-ui";
5
+ import { Label, } from "~/components/catalyst-ui";
6
+ import { Textarea, } from "~/components/catalyst-ui";
7
+ import { Settings, User, Mail, Phone, MapPin, Calendar, } from "lucide-react";
8
+ import { Drawer as DrawerPrimitive, } from "vaul";
9
+ import { motion, type Variants } from "framer-motion";
10
+ import { cva, type VariantProps } from "class-variance-authority";
11
+
12
+ // @dev app/components/catalyst-ui/data/primitive-data.tsx:4285
13
+ const drawerVariants = cva(
14
+ ["group/drawer-content fixed z-50 flex flex-col"],
15
+ {
16
+ variants: {
17
+ variant: {
18
+ default: "",
19
+ card: [
20
+ "bg-card rounded-t-xl shadow-xl",
21
+ "data-[vaul-drawer-direction=bottom]:mb-5",
22
+ "data-[vaul-drawer-direction=top]:mt-5",
23
+ "data-[vaul-drawer-direction=left]:ml-5",
24
+ "data-[vaul-drawer-direction=right]:mr-5",
25
+ ],
26
+ glass: [
27
+ "backdrop-blur-xl bg-background/80 border-t border-white/10 max-w-sm",
28
+ "data-[vaul-drawer-direction=bottom]:mb-5",
29
+ "data-[vaul-drawer-direction=top]:mt-5",
30
+ "data-[vaul-drawer-direction=left]:ml-5",
31
+ "data-[vaul-drawer-direction=right]:mr-5",
32
+ ],
33
+ elevated: [
34
+ "bg-background shadow-2xl max-w-sm",
35
+ "data-[vaul-drawer-direction=bottom]:mb-5",
36
+ "data-[vaul-drawer-direction=top]:mt-5",
37
+ "data-[vaul-drawer-direction=left]:ml-5",
38
+ "data-[vaul-drawer-direction=right]:mr-5",
39
+ ],
40
+ bordered: [
41
+ "bg-background border-t-2 border-primary/20 max-w-sm",
42
+ "data-[vaul-drawer-direction=bottom]:mb-5",
43
+ "data-[vaul-drawer-direction=top]:mt-5",
44
+ "data-[vaul-drawer-direction=left]:ml-5",
45
+ "data-[vaul-drawer-direction=right]:mr-5",
46
+ ],
47
+ macos: [
48
+ "backdrop-blur-xl bg-card/70 shadow-2xl border border-border/50 w-full max-w-sm rounded-3xl mx-auto",
49
+ "data-[vaul-drawer-direction=bottom]:mb-5",
50
+ "data-[vaul-drawer-direction=top]:mt-5",
51
+ "data-[vaul-drawer-direction=left]:ml-5",
52
+ "data-[vaul-drawer-direction=right]:mr-5",
53
+ ],
54
+ },
55
+ direction: {
56
+ top: "border-b rounded-b-lg max-h-[80vh] mb-24 top-0 inset-x-0 left-1/2 -translate-x-1/2",
57
+ bottom: "border-t rounded-t-lg max-h-[80vh] mt-24 bottom-0 inset-x-0 left-1/2 -translate-x-1/2",
58
+ right: "sm:max-w-sm border-l w-3/4 right-0 inset-y-0 top-1/2 -translate-y-1/2",
59
+ left: "inset-y-0 left-0 w-3/4 border-r sm:max-w-sm top-1/2 -translate-y-1/2",
60
+ },
61
+ size: {
62
+ default: "h-auto",
63
+ sm: "h-[50vh]",
64
+ md: "h-[70vh]",
65
+ lg: "h-[90vh]",
66
+ full: "h-screen",
67
+ },
68
+ },
69
+ defaultVariants: {
70
+ variant: "default",
71
+ size: "default",
72
+ },
73
+ }
74
+ );
75
+
76
+ // Default motion variants
77
+ const defaultContentVariants: Variants = {
78
+ hidden: {
79
+ y: "100%",
80
+ opacity: 0,
81
+ transition: {
82
+ type: "spring",
83
+ stiffness: 300,
84
+ damping: 30,
85
+ },
86
+ },
87
+ visible: {
88
+ y: 0,
89
+ opacity: 1,
90
+ transition: {
91
+ type: "spring",
92
+ stiffness: 300,
93
+ damping: 30,
94
+ mass: 0.8,
95
+ staggerChildren: 0.07,
96
+ delayChildren: 0.1,
97
+ },
98
+ },
99
+ };
100
+
101
+ const defaultItemVariants: Variants = {
102
+ hidden: {
103
+ y: 20,
104
+ opacity: 0,
105
+ transition: {
106
+ type: "spring",
107
+ stiffness: 300,
108
+ damping: 30,
109
+ },
110
+ },
111
+ visible: {
112
+ y: 0,
113
+ opacity: 1,
114
+ transition: {
115
+ type: "spring",
116
+ stiffness: 300,
117
+ damping: 30,
118
+ mass: 0.8,
119
+ },
120
+ },
121
+ };
122
+
123
+ type MotionConfig = {
124
+ contentVariants?: Variants;
125
+ itemVariants?: Variants;
126
+ };
127
+
128
+ const DrawerMotionContext = React.createContext<MotionConfig & { enabled: boolean }>({
129
+ enabled: false,
130
+ contentVariants: defaultContentVariants,
131
+ itemVariants: defaultItemVariants,
132
+ });
133
+
134
+ function Drawer({
135
+ motionConfig,
136
+ ...props
137
+ }: React.ComponentProps<typeof DrawerPrimitive.Root> & {
138
+ motionConfig?: MotionConfig;
139
+ }) {
140
+ return (
141
+ <DrawerMotionContext.Provider
142
+ value={{
143
+ enabled: false, // Will be set by DrawerContent based on variant
144
+ contentVariants: motionConfig?.contentVariants ?? defaultContentVariants,
145
+ itemVariants: motionConfig?.itemVariants ?? defaultItemVariants,
146
+ }}
147
+ >
148
+ <DrawerPrimitive.Root data-slot="drawer" {...props} />
149
+ </DrawerMotionContext.Provider>
150
+ );
151
+ }
152
+
153
+ function DrawerTrigger({
154
+ ...props
155
+ }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
156
+ return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
157
+ }
158
+
159
+ function DrawerPortal({
160
+ ...props
161
+ }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
162
+ return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />;
163
+ }
164
+
165
+ function DrawerClose({
166
+ ...props
167
+ }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
168
+ return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
169
+ }
170
+
171
+ function DrawerOverlay({
172
+ className,
173
+ ...props
174
+ }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
175
+ return (
176
+ <DrawerPrimitive.Overlay
177
+ data-slot="drawer-overlay"
178
+ className={cn(
179
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
180
+ className
181
+ )}
182
+ {...props}
183
+ />
184
+ );
185
+ }
186
+
187
+ function DrawerContent({
188
+ className,
189
+ children,
190
+ variant,
191
+ direction,
192
+ size,
193
+ ...props
194
+ }: React.ComponentProps<typeof DrawerPrimitive.Content> &
195
+ VariantProps<typeof drawerVariants>) {
196
+ const motionConfigFromContext = React.useContext(DrawerMotionContext);
197
+
198
+ // Enable motion for all variants except "default"
199
+ const motionEnabled = variant && variant !== "default";
200
+
201
+ const motionConfig = {
202
+ ...motionConfigFromContext,
203
+ enabled: motionEnabled,
204
+ };
205
+
206
+ const content = (
207
+ <>
208
+ <div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
209
+ {children}
210
+ </>
211
+ );
212
+
213
+ return (
214
+ <DrawerPortal data-slot="drawer-portal">
215
+ <DrawerOverlay />
216
+ <DrawerMotionContext.Provider value={motionConfig}>
217
+ <DrawerPrimitive.Content
218
+ data-slot="drawer-content"
219
+ className={cn(
220
+ drawerVariants({ variant, direction, size }),
221
+ "bg-background",
222
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0",
223
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0",
224
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0",
225
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0",
226
+ className
227
+ )}
228
+ {...props}
229
+ >
230
+ {motionEnabled ? (
231
+ <motion.div
232
+ variants={motionConfig.contentVariants}
233
+ initial="hidden"
234
+ animate="visible"
235
+ className="h-full flex flex-col"
236
+ >
237
+ {content}
238
+ </motion.div>
239
+ ) : (
240
+ content
241
+ )}
242
+ </DrawerPrimitive.Content>
243
+ </DrawerMotionContext.Provider>
244
+ </DrawerPortal>
245
+ );
246
+ }
247
+
248
+ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
249
+ const motionConfig = React.useContext(DrawerMotionContext);
250
+
251
+ const Component = motionConfig.enabled ? motion.div : "div";
252
+
253
+ return (
254
+ <Component
255
+ data-slot="drawer-header"
256
+ className={cn(
257
+ "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
258
+ className
259
+ )}
260
+ {...(motionConfig.enabled && {
261
+ variants: motionConfig.itemVariants,
262
+ })}
263
+ {...props}
264
+ />
265
+ );
266
+ }
267
+
268
+ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
269
+ const motionConfig = React.useContext(DrawerMotionContext);
270
+
271
+ const Component = motionConfig.enabled ? motion.div : "div";
272
+
273
+ return (
274
+ <Component
275
+ data-slot="drawer-footer"
276
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
277
+ {...(motionConfig.enabled && {
278
+ variants: motionConfig.itemVariants,
279
+ })}
280
+ {...props}
281
+ />
282
+ );
283
+ }
284
+
285
+ function DrawerTitle({
286
+ className,
287
+ ...props
288
+ }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
289
+ const motionConfig = React.useContext(DrawerMotionContext);
290
+
291
+ return (
292
+ <DrawerPrimitive.Title
293
+ data-slot="drawer-title"
294
+ className={cn("text-foreground font-semibold", className)}
295
+ asChild={motionConfig.enabled}
296
+ {...props}
297
+ >
298
+ {motionConfig.enabled ? (
299
+ <motion.h2 variants={motionConfig.itemVariants}>{props.children}</motion.h2>
300
+ ) : (
301
+ props.children
302
+ )}
303
+ </DrawerPrimitive.Title>
304
+ );
305
+ }
306
+
307
+ function DrawerDescription({
308
+ className,
309
+ ...props
310
+ }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
311
+ const motionConfig = React.useContext(DrawerMotionContext);
312
+
313
+ return (
314
+ <DrawerPrimitive.Description
315
+ data-slot="drawer-description"
316
+ className={cn("text-muted-foreground text-sm", className)}
317
+ asChild={motionConfig.enabled}
318
+ {...props}
319
+ >
320
+ {motionConfig.enabled ? (
321
+ <motion.p variants={motionConfig.itemVariants}>{props.children}</motion.p>
322
+ ) : (
323
+ props.children
324
+ )}
325
+ </DrawerPrimitive.Description>
326
+ );
327
+ }
328
+
329
+ // Example usage
330
+ export default function DrawerDemooo() {
331
+ const [open, setOpen] = React.useState(false);
332
+
333
+ // Custom variants example
334
+ const customContentVariants: Variants = {
335
+ hidden: {
336
+ y: "100%",
337
+ opacity: 0,
338
+ scale: 0.95,
339
+ },
340
+ visible: {
341
+ y: 0,
342
+ opacity: 1,
343
+ scale: 1,
344
+ transition: {
345
+ type: "spring",
346
+ stiffness: 400,
347
+ damping: 40,
348
+ staggerChildren: 0.1,
349
+ delayChildren: 0.2,
350
+ },
351
+ },
352
+ };
353
+
354
+ const customItemVariants: Variants = {
355
+ hidden: {
356
+ x: -20,
357
+ opacity: 0,
358
+ },
359
+ visible: {
360
+ x: 0,
361
+ opacity: 1,
362
+ transition: {
363
+ type: "spring",
364
+ stiffness: 400,
365
+ damping: 40,
366
+ },
367
+ },
368
+ };
369
+
370
+ return (
371
+ <div className="flex min-h-screen items-center justify-center gap-4 p-8 bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800">
372
+ <div className="space-y-4">
373
+ <h1 className="text-3xl font-bold mb-8 text-center">Drawer Motion Examples</h1>
374
+
375
+ <div className="flex flex-wrap gap-4 justify-center">
376
+ {/* Without Motion - Default variant */}
377
+ <Drawer>
378
+ <DrawerTrigger className="px-4 py-2 bg-gray-800 text-white rounded-lg hover:bg-gray-700 transition-colors">
379
+ Default (No Motion)
380
+ </DrawerTrigger>
381
+ <DrawerContent>
382
+ <DrawerHeader>
383
+ <DrawerTitle>Standard Drawer</DrawerTitle>
384
+ <DrawerDescription>
385
+ This drawer has no motion animations (default variant)
386
+ </DrawerDescription>
387
+ </DrawerHeader>
388
+ <div className="p-4">
389
+ <p className="text-sm text-gray-600 dark:text-gray-400">
390
+ Content without animations
391
+ </p>
392
+ </div>
393
+ <DrawerFooter>
394
+ <DrawerClose className="px-4 py-2 bg-gray-800 text-white rounded-lg hover:bg-gray-700 transition-colors">
395
+ Close
396
+ </DrawerClose>
397
+ </DrawerFooter>
398
+ </DrawerContent>
399
+ </Drawer>
400
+
401
+ {/* With Motion - Card variant */}
402
+ <Drawer>
403
+ <DrawerTrigger className="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors">
404
+ Card Variant (Motion)
405
+ </DrawerTrigger>
406
+ <DrawerContent variant="card">
407
+ <DrawerHeader>
408
+ <DrawerTitle>Card Drawer</DrawerTitle>
409
+ <DrawerDescription>
410
+ Motion automatically enabled with card variant
411
+ </DrawerDescription>
412
+ </DrawerHeader>
413
+ <div className="p-4">
414
+ <p className="text-sm text-gray-600 dark:text-gray-400">
415
+ Smooth spring animations with staggered children
416
+ </p>
417
+ </div>
418
+ <DrawerFooter>
419
+ <DrawerClose className="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors">
420
+ Close
421
+ </DrawerClose>
422
+ </DrawerFooter>
423
+ </DrawerContent>
424
+ </Drawer>
425
+
426
+ {/* With Motion - Glass variant */}
427
+ <Drawer>
428
+ <DrawerTrigger className="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">
429
+ Glass Variant (Motion)
430
+ </DrawerTrigger>
431
+ <DrawerContent variant="glass">
432
+ <DrawerHeader>
433
+ <DrawerTitle>Glass Drawer</DrawerTitle>
434
+ <DrawerDescription>
435
+ Motion automatically enabled with glass variant
436
+ </DrawerDescription>
437
+ </DrawerHeader>
438
+ <div className="p-4 space-y-4">
439
+ <div className="space-y-2">
440
+ <h3 className="font-semibold">Features:</h3>
441
+ <ul className="text-sm text-gray-600 dark:text-gray-400 space-y-1 list-disc list-inside">
442
+ <li>Automatic motion activation</li>
443
+ <li>Glassmorphism design</li>
444
+ <li>Staggered child animations</li>
445
+ <li>Spring physics</li>
446
+ </ul>
447
+ </div>
448
+ </div>
449
+ <DrawerFooter>
450
+ <DrawerClose className="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">
451
+ Close
452
+ </DrawerClose>
453
+ </DrawerFooter>
454
+ </DrawerContent>
455
+ </Drawer>
456
+
457
+ {/* With Custom Motion - macOS variant */}
458
+ <Drawer
459
+ open={open}
460
+ onOpenChange={setOpen}
461
+ motionConfig={{
462
+ contentVariants: customContentVariants,
463
+ itemVariants: customItemVariants,
464
+ }}
465
+ >
466
+ <DrawerTrigger className="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors">
467
+ macOS + Custom Motion
468
+ </DrawerTrigger>
469
+ <DrawerContent variant="macos">
470
+ <DrawerHeader>
471
+ <DrawerTitle>Custom Motion Drawer</DrawerTitle>
472
+ <DrawerDescription>
473
+ macOS variant with custom animation variants
474
+ </DrawerDescription>
475
+ </DrawerHeader>
476
+ <div className="p-4 space-y-4">
477
+ <div className="space-y-2">
478
+ <h3 className="font-semibold">Custom Features:</h3>
479
+ <ul className="text-sm text-gray-600 dark:text-gray-400 space-y-1 list-disc list-inside">
480
+ <li>Custom entrance animations</li>
481
+ <li>Scale and slide effects</li>
482
+ <li>Faster spring physics</li>
483
+ <li>Horizontal slide animation</li>
484
+ </ul>
485
+ </div>
486
+ </div>
487
+ <DrawerFooter>
488
+ <button
489
+ onClick={() => setOpen(false)}
490
+ className="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors"
491
+ >
492
+ Close
493
+ </button>
494
+ </DrawerFooter>
495
+ </DrawerContent>
496
+ </Drawer>
497
+ </div>
498
+ </div>
499
+ </div>
500
+ );
501
+ }
502
+ export {
503
+ Drawer, DrawerPortal, DrawerOverlay, DrawerTrigger, DrawerClose, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription
504
+ }
505
+
506
+ // SIMPLIFIED DEMO COMPONENT
507
+
508
+
509
+ export function DrawerDemooo1() {
510
+ return (
511
+ <div className="flex flex-col gap-4 p-8">
512
+ <h1 className="text-2xl font-bold mb-6">Simplified Drawer Demo</h1>
513
+
514
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
515
+ {/* Basic Drawer */}
516
+ <Drawer>
517
+ <DrawerTrigger asChild>
518
+ <Button variant="outline" className="w-full">
519
+ Open Basic Drawer
520
+ </Button>
521
+ </DrawerTrigger>
522
+ <DrawerContent position="right" size="md">
523
+ <DrawerHeader>
524
+ <DrawerTitle>Basic Drawer</DrawerTitle>
525
+ <DrawerDescription>
526
+ This is a simple drawer example with basic content.
527
+ </DrawerDescription>
528
+ </DrawerHeader>
529
+ <div className="space-y-4">
530
+ <p>This is the drawer content area.</p>
531
+ <p>You can put any content here - forms, lists, images, etc.</p>
532
+ <div className="bg-gray-100 p-4 rounded">
533
+ <h3 className="font-medium mb-2">Example Content</h3>
534
+ <p className="text-sm text-gray-600">
535
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
536
+ Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
537
+ </p>
538
+ </div>
539
+ </div>
540
+ <DrawerFooter>
541
+ <DrawerClose asChild>
542
+ <Button>Close</Button>
543
+ </DrawerClose>
544
+ </DrawerFooter>
545
+ </DrawerContent>
546
+ </Drawer>
547
+
548
+ {/* Profile Form Drawer */}
549
+ <Drawer>
550
+ <DrawerTrigger asChild>
551
+ <Button variant="outline" className="w-full">
552
+ <User className="h-4 w-4 mr-2" />
553
+ Edit Profile
554
+ </Button>
555
+ </DrawerTrigger>
556
+ <DrawerContent position="right" size="lg">
557
+ <DrawerHeader>
558
+ <DrawerTitle className="flex items-center gap-2">
559
+ <User className="h-5 w-5" />
560
+ Edit Profile
561
+ </DrawerTitle>
562
+ <DrawerDescription>
563
+ Update your profile information below.
564
+ </DrawerDescription>
565
+ </DrawerHeader>
566
+ <form className="space-y-6">
567
+ <div className="grid grid-cols-2 gap-4">
568
+ <div>
569
+ <Label htmlFor="firstName">First Name</Label>
570
+ <Input id="firstName" placeholder="John" />
571
+ </div>
572
+ <div>
573
+ <Label htmlFor="lastName">Last Name</Label>
574
+ <Input id="lastName" placeholder="Doe" />
575
+ </div>
576
+ </div>
577
+
578
+ <div>
579
+ <Label htmlFor="email">Email</Label>
580
+ <div className="relative">
581
+ <Mail className="absolute left-3 top-3 h-4 w-4 text-gray-400" />
582
+ <Input id="email" type="email" placeholder="john@example.com" className="pl-10" />
583
+ </div>
584
+ </div>
585
+
586
+ <div>
587
+ <Label htmlFor="phone">Phone</Label>
588
+ <div className="relative">
589
+ <Phone className="absolute left-3 top-3 h-4 w-4 text-gray-400" />
590
+ <Input id="phone" placeholder="+1 (555) 000-0000" className="pl-10" />
591
+ </div>
592
+ </div>
593
+
594
+ <div>
595
+ <Label htmlFor="address">Address</Label>
596
+ <div className="relative">
597
+ <MapPin className="absolute left-3 top-3 h-4 w-4 text-gray-400" />
598
+ <Input id="address" placeholder="123 Main St, City, State" className="pl-10" />
599
+ </div>
600
+ </div>
601
+
602
+ <div>
603
+ <Label htmlFor="bio">Bio</Label>
604
+ <Textarea id="bio" placeholder="Tell us about yourself..." rows={3} />
605
+ </div>
606
+ </form>
607
+ <DrawerFooter>
608
+ <DrawerClose asChild>
609
+ <Button className="w-full">Save Changes</Button>
610
+ </DrawerClose>
611
+ <DrawerClose asChild>
612
+ <Button variant="outline" className="w-full">Cancel</Button>
613
+ </DrawerClose>
614
+ </DrawerFooter>
615
+ </DrawerContent>
616
+ </Drawer>
617
+
618
+ {/* Settings Drawer */}
619
+ <Drawer>
620
+ <DrawerTrigger asChild>
621
+ <Button variant="outline" className="w-full">
622
+ <Settings className="h-4 w-4 mr-2" />
623
+ Settings
624
+ </Button>
625
+ </DrawerTrigger>
626
+ <DrawerContent position="left" size="md">
627
+ <DrawerHeader>
628
+ <DrawerTitle className="flex items-center gap-2">
629
+ <Settings className="h-5 w-5" />
630
+ Settings
631
+ </DrawerTitle>
632
+ <DrawerDescription>
633
+ Manage your application preferences.
634
+ </DrawerDescription>
635
+ </DrawerHeader>
636
+ <div className="space-y-6">
637
+ <div>
638
+ <h3 className="text-sm font-medium mb-3">Appearance</h3>
639
+ <div className="space-y-2">
640
+ <label className="flex items-center space-x-2">
641
+ <input type="radio" name="theme" value="light" defaultChecked />
642
+ <span className="text-sm">Light</span>
643
+ </label>
644
+ <label className="flex items-center space-x-2">
645
+ <input type="radio" name="theme" value="dark" />
646
+ <span className="text-sm">Dark</span>
647
+ </label>
648
+ <label className="flex items-center space-x-2">
649
+ <input type="radio" name="theme" value="system" />
650
+ <span className="text-sm">System</span>
651
+ </label>
652
+ </div>
653
+ </div>
654
+
655
+ <div>
656
+ <h3 className="text-sm font-medium mb-3">Notifications</h3>
657
+ <div className="space-y-2">
658
+ <label className="flex items-center justify-between">
659
+ <span className="text-sm">Email notifications</span>
660
+ <input type="checkbox" defaultChecked />
661
+ </label>
662
+ <label className="flex items-center justify-between">
663
+ <span className="text-sm">Push notifications</span>
664
+ <input type="checkbox" />
665
+ </label>
666
+ <label className="flex items-center justify-between">
667
+ <span className="text-sm">SMS notifications</span>
668
+ <input type="checkbox" defaultChecked />
669
+ </label>
670
+ </div>
671
+ </div>
672
+
673
+ <div>
674
+ <h3 className="text-sm font-medium mb-3">Privacy</h3>
675
+ <div className="space-y-2">
676
+ <label className="flex items-center justify-between">
677
+ <span className="text-sm">Profile visibility</span>
678
+ <input type="checkbox" defaultChecked />
679
+ </label>
680
+ <label className="flex items-center justify-between">
681
+ <span className="text-sm">Activity status</span>
682
+ <input type="checkbox" />
683
+ </label>
684
+ </div>
685
+ </div>
686
+ </div>
687
+ <DrawerFooter>
688
+ <DrawerClose asChild>
689
+ <Button>Save Settings</Button>
690
+ </DrawerClose>
691
+ </DrawerFooter>
692
+ </DrawerContent>
693
+ </Drawer>
694
+
695
+ {/* Bottom Drawer */}
696
+ <Drawer>
697
+ <DrawerTrigger asChild>
698
+ <Button variant="outline" className="w-full">
699
+ <Calendar className="h-4 w-4 mr-2" />
700
+ Bottom Drawer
701
+ </Button>
702
+ </DrawerTrigger>
703
+ <DrawerContent position="bottom" size="md">
704
+ <DrawerHeader>
705
+ <DrawerTitle>Select Date</DrawerTitle>
706
+ <DrawerDescription>
707
+ Choose a date from the calendar below.
708
+ </DrawerDescription>
709
+ </DrawerHeader>
710
+ <div className="grid grid-cols-7 gap-2 text-center text-sm">
711
+ <div className="font-medium py-2">Sun</div>
712
+ <div className="font-medium py-2">Mon</div>
713
+ <div className="font-medium py-2">Tue</div>
714
+ <div className="font-medium py-2">Wed</div>
715
+ <div className="font-medium py-2">Thu</div>
716
+ <div className="font-medium py-2">Fri</div>
717
+ <div className="font-medium py-2">Sat</div>
718
+
719
+ {Array.from({ length: 31 }, (_, i) => (
720
+ <DrawerClose key={i + 1} asChild>
721
+ <button className="py-2 hover:bg-gray-100 rounded transition-colors">
722
+ {i + 1}
723
+ </button>
724
+ </DrawerClose>
725
+ ))}
726
+ </div>
727
+ <DrawerFooter>
728
+ <DrawerClose asChild>
729
+ <Button variant="outline">Cancel</Button>
730
+ </DrawerClose>
731
+ </DrawerFooter>
732
+ </DrawerContent>
733
+ </Drawer>
734
+ </div>
735
+
736
+ {/* Usage Example Code */}
737
+ <div className="mt-8 p-4 bg-gray-50 rounded-lg">
738
+ <h2 className="text-lg font-semibold mb-2">Simplified Usage</h2>
739
+ <pre className="text-sm overflow-x-auto">
740
+ {`<Drawer>
741
+ <DrawerTrigger asChild>
742
+ <Button>Open Drawer</Button>
743
+ </DrawerTrigger>
744
+ <DrawerContent position="right" size="md">
745
+ <DrawerHeader>
746
+ <DrawerTitle>Drawer Title</DrawerTitle>
747
+ <DrawerDescription>Drawer description</DrawerDescription>
748
+ </DrawerHeader>
749
+ {/* Your content here */}
750
+ <DrawerFooter>
751
+ <DrawerClose asChild>
752
+ <Button>Close</Button>
753
+ </DrawerClose>
754
+ </DrawerFooter>
755
+ </DrawerContent>
756
+ </Drawer>`}
757
+ </pre>
758
+ </div>
759
+ </div>
760
+ )
761
+ }