@catalystsoftware/ui 1.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 (157) hide show
  1. package/README.md +7 -0
  2. package/components/catalyst-ui/buttons/burger.tsx +207 -0
  3. package/components/catalyst-ui/core/data-display/timeline.tsx +210 -0
  4. package/components/catalyst-ui/core/feedback/alert.tsx +491 -0
  5. package/components/catalyst-ui/core/feedback/spinner-1.tsx +65 -0
  6. package/components/catalyst-ui/core/feedback/toast.tsx +1857 -0
  7. package/components/catalyst-ui/core/navigation/menu.tsx +164 -0
  8. package/components/catalyst-ui/forms/toggle-class.tsx +176 -0
  9. package/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +419 -0
  10. package/components/catalyst-ui/hooks/use-counter.tsx +13 -0
  11. package/components/catalyst-ui/hooks/use-event-listener.tsx +23 -0
  12. package/components/catalyst-ui/hooks/use-export-markdown.tsx +47 -0
  13. package/components/catalyst-ui/hooks/use-focus.tsx +17 -0
  14. package/components/catalyst-ui/hooks/use-interval.tsx +23 -0
  15. package/components/catalyst-ui/hooks/use-is-client.tsx +16 -0
  16. package/components/catalyst-ui/hooks/use-media-query.tsx +19 -0
  17. package/components/catalyst-ui/hooks/use-mobile.tsx +19 -0
  18. package/components/catalyst-ui/hooks/use-resize-observer.tsx +81 -0
  19. package/components/catalyst-ui/hooks/use-timeout.tsx +21 -0
  20. package/components/catalyst-ui/hooks/use-timer.tsx +209 -0
  21. package/components/catalyst-ui/hooks/use-toggle.tsx +12 -0
  22. package/components/catalyst-ui/media/image.tsx +13 -0
  23. package/components/catalyst-ui/overlays/dual-sidebar.tsx +4142 -0
  24. package/components/catalyst-ui/overlays/sidebar-original.tsx +726 -0
  25. package/components/catalyst-ui/primitives/accordion.tsx +250 -0
  26. package/components/catalyst-ui/primitives/alert-dialog.tsx +126 -0
  27. package/components/catalyst-ui/primitives/aspect-ratio.tsx +9 -0
  28. package/components/catalyst-ui/primitives/avatar.tsx +296 -0
  29. package/components/catalyst-ui/primitives/badge.tsx +57 -0
  30. package/components/catalyst-ui/primitives/breadcrumb.tsx +101 -0
  31. package/components/catalyst-ui/primitives/button.tsx +265 -0
  32. package/components/catalyst-ui/primitives/calendar-v4.tsx +208 -0
  33. package/components/catalyst-ui/primitives/calendar.tsx +295 -0
  34. package/components/catalyst-ui/primitives/card.tsx +618 -0
  35. package/components/catalyst-ui/primitives/carousel.tsx +238 -0
  36. package/components/catalyst-ui/primitives/chart.tsx +347 -0
  37. package/components/catalyst-ui/primitives/checkbox.tsx +225 -0
  38. package/components/catalyst-ui/primitives/collapsible.tsx +212 -0
  39. package/components/catalyst-ui/primitives/command.tsx +393 -0
  40. package/components/catalyst-ui/primitives/context-menu.tsx +236 -0
  41. package/components/catalyst-ui/primitives/dialog.tsx +471 -0
  42. package/components/catalyst-ui/primitives/drawer.tsx +761 -0
  43. package/components/catalyst-ui/primitives/dropdown-menu.tsx +290 -0
  44. package/components/catalyst-ui/primitives/empty.tsx +104 -0
  45. package/components/catalyst-ui/primitives/field.tsx +244 -0
  46. package/components/catalyst-ui/primitives/hover-card.tsx +124 -0
  47. package/components/catalyst-ui/primitives/input-otp.tsx +76 -0
  48. package/components/catalyst-ui/primitives/input.tsx +64 -0
  49. package/components/catalyst-ui/primitives/item.tsx +196 -0
  50. package/components/catalyst-ui/primitives/kbd.tsx +75 -0
  51. package/components/catalyst-ui/primitives/label.tsx +24 -0
  52. package/components/catalyst-ui/primitives/navigation-menu.tsx +150 -0
  53. package/components/catalyst-ui/primitives/pagination.tsx +198 -0
  54. package/components/catalyst-ui/primitives/popover.tsx +232 -0
  55. package/components/catalyst-ui/primitives/progress.tsx +34 -0
  56. package/components/catalyst-ui/primitives/radio-group.tsx +43 -0
  57. package/components/catalyst-ui/primitives/resizable.tsx +56 -0
  58. package/components/catalyst-ui/primitives/select.tsx +155 -0
  59. package/components/catalyst-ui/primitives/separator.tsx +74 -0
  60. package/components/catalyst-ui/primitives/sheet.tsx +126 -0
  61. package/components/catalyst-ui/primitives/skeleton.tsx +15 -0
  62. package/components/catalyst-ui/primitives/slider.tsx +27 -0
  63. package/components/catalyst-ui/primitives/switch.tsx +187 -0
  64. package/components/catalyst-ui/primitives/tabs.tsx +335 -0
  65. package/components/catalyst-ui/primitives/textarea.tsx +24 -0
  66. package/components/catalyst-ui/primitives/toggle-group.tsx +55 -0
  67. package/components/catalyst-ui/primitives/toggle.tsx +42 -0
  68. package/components/catalyst-ui/primitives/tooltip.tsx +116 -0
  69. package/components/catalyst-ui/utils/basic-auth.tsx +40 -0
  70. package/components/catalyst-ui/utils/context-storage.tsx +19 -0
  71. package/components/catalyst-ui/utils/cors-middleware.tsx +71 -0
  72. package/components/catalyst-ui/utils/deferred-content.tsx +595 -0
  73. package/components/catalyst-ui/utils/honeypot-middleware.tsx +38 -0
  74. package/components/catalyst-ui/utils/incId.tsx +75 -0
  75. package/components/catalyst-ui/utils/jwk-auth.tsx +36 -0
  76. package/components/catalyst-ui/utils/request-id.tsx +14 -0
  77. package/components/catalyst-ui/utils/secure-headers.tsx +37 -0
  78. package/components/catalyst-ui/utils/server-timing.tsx +23 -0
  79. package/components/catalyst-ui/utils/utils.ts +43 -0
  80. package/components/catalyst-ui/utils/with-cookie.tsx +43 -0
  81. package/components/catalyst-ui/x/accordian-x.tsx +428 -0
  82. package/components/catalyst-ui/x/alert-x.tsx +413 -0
  83. package/components/catalyst-ui/x/animated-text-x.tsx +2242 -0
  84. package/components/catalyst-ui/x/avatar-x.tsx +515 -0
  85. package/components/catalyst-ui/x/badge-x.tsx +670 -0
  86. package/components/catalyst-ui/x/button-X.tsx +2857 -0
  87. package/components/catalyst-ui/x/button-group-x.tsx +847 -0
  88. package/components/catalyst-ui/x/calendar-x.tsx +1910 -0
  89. package/components/catalyst-ui/x/card-x.tsx +2597 -0
  90. package/components/catalyst-ui/x/checkbox-x.tsx +656 -0
  91. package/components/catalyst-ui/x/collapsible-x.tsx +1360 -0
  92. package/components/catalyst-ui/x/combobox-x.tsx +911 -0
  93. package/components/catalyst-ui/x/data-table-x.tsx +1753 -0
  94. package/components/catalyst-ui/x/date-picker-x.tsx +648 -0
  95. package/components/catalyst-ui/x/dialog-x.tsx +659 -0
  96. package/components/catalyst-ui/x/dropdown-menu-x.tsx +612 -0
  97. package/components/catalyst-ui/x/hover-card-x.tsx +375 -0
  98. package/components/catalyst-ui/x/icon-x.tsx +840 -0
  99. package/components/catalyst-ui/x/input-mask-x.tsx +981 -0
  100. package/components/catalyst-ui/x/input-otp-x.tsx +659 -0
  101. package/components/catalyst-ui/x/loader-x.tsx +1757 -0
  102. package/components/catalyst-ui/x/pagination-x.tsx +622 -0
  103. package/components/catalyst-ui/x/popover-x.tsx +744 -0
  104. package/components/catalyst-ui/x/radio-group-x.tsx +499 -0
  105. package/components/catalyst-ui/x/select-x.tsx +1127 -0
  106. package/components/catalyst-ui/x/sheet-x.tsx +668 -0
  107. package/components/catalyst-ui/x/switch-x.tsx +681 -0
  108. package/components/catalyst-ui/x/table-x.tsx +574 -0
  109. package/components/catalyst-ui/x/tabs-x.tsx +839 -0
  110. package/components/catalyst-ui/x/textarea-x.tsx +1263 -0
  111. package/components/catalyst-ui/x/tooltip-x.tsx +396 -0
  112. package/components/catalyst-ui/x/tracker-x.tsx +560 -0
  113. package/data/bg-data.tsx +901 -0
  114. package/data/buttons-data.tsx +2327 -0
  115. package/data/charts-data.tsx +102 -0
  116. package/data/chat-data.tsx +83 -0
  117. package/data/code-data.tsx +1040 -0
  118. package/data/comboboxes-data.tsx +1843 -0
  119. package/data/command-data.tsx +1381 -0
  120. package/data/core-data.tsx +15953 -0
  121. package/data/crm-data.tsx +47 -0
  122. package/data/data.tsx +159 -0
  123. package/data/date-and-time-data.tsx +554 -0
  124. package/data/dependencies.tsx +7 -0
  125. package/data/ecommerce-data.tsx +1387 -0
  126. package/data/forms-data.tsx +7890 -0
  127. package/data/hooks-data.tsx +5487 -0
  128. package/data/index.ts +34 -0
  129. package/data/inputs-data.tsx +557 -0
  130. package/data/interactive-data.tsx +5394 -0
  131. package/data/lofi-data.tsx +18295 -0
  132. package/data/marketing-data.tsx +2546 -0
  133. package/data/media-data.tsx +1510 -0
  134. package/data/motion-data.tsx +5801 -0
  135. package/data/overlay-data.tsx +4136 -0
  136. package/data/pdf-data.tsx +124 -0
  137. package/data/pos-data.tsx +213 -0
  138. package/data/postcss.config.js +6 -0
  139. package/data/primitive-data.tsx +5170 -0
  140. package/data/prompt-data.tsx +1226 -0
  141. package/data/requiredLibs.ts +4 -0
  142. package/data/sandbox-data.tsx +1 -0
  143. package/data/sidebars-data.tsx +5421 -0
  144. package/data/stacks-data.tsx +32 -0
  145. package/data/table-data.tsx +706 -0
  146. package/data/tailwind.config.js +3830 -0
  147. package/data/tailwind.config.ngin.js +3830 -0
  148. package/data/tailwind.css +431 -0
  149. package/data/tools-data.tsx +6910 -0
  150. package/data/typography-data.tsx +2050 -0
  151. package/data/utils-data.tsx +6500 -0
  152. package/data/x-data.tsx +1171 -0
  153. package/dist/index.d.ts +3 -0
  154. package/dist/index.d.ts.map +1 -0
  155. package/dist/index.js +30245 -0
  156. package/dist/index.js.map +362 -0
  157. package/package.json +50 -0
@@ -0,0 +1,618 @@
1
+ import React, { forwardRef, createContext, useContext } from 'react'
2
+ import { cva, type VariantProps } from 'class-variance-authority'
3
+ import { cn } from '~/components/catalyst-ui'
4
+
5
+ // #endregion ===========================================================================
6
+ // CARD CONTEXT
7
+ // #region =========================================================================
8
+ interface CardContextValue {
9
+ variant?: string
10
+ size?: string
11
+ interactive?: boolean
12
+ }
13
+
14
+ const CardContext = createContext<CardContextValue>({})
15
+
16
+ const useCardContext = () => useContext(CardContext)
17
+
18
+ // #endregion ===========================================================================
19
+ // CARD VARIANTS
20
+ // #region ============================================================================
21
+ const cardVariants = cva(
22
+ "rounded-lg transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
23
+ {
24
+ variants: {
25
+ variant: {
26
+ default: "bg-card text-card-foreground shadow-lg hover:shadow-xl",
27
+ elevated: "bg-surface-container-low shadow-md hover:shadow-lg active:shadow-sm",
28
+ filled: "bg-primary text-on-primary shadow-sm hover:shadow-md active:shadow-sm",
29
+ tonal: "bg-secondary-container text-on-secondary-container hover:shadow-sm active:shadow-none",
30
+ outlined: "border border-outline text-primary hover:bg-primary/8 active:bg-primary/12",
31
+ ghost: "bg-transparent border-0 hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
32
+ gradient: "bg-gradient-to-r from-primary to-primary/80 text-primary-foreground shadow-md hover:shadow-lg active:shadow-sm",
33
+ glass: "bg-background/20 backdrop-blur-md border border-border/50 text-foreground hover:bg-background/30",
34
+ dashed: "bg-transparent border-2 border-dashed border-border hover:border-primary/50",
35
+ destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
36
+ secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
37
+ link: "bg-transparent text-primary underline-offset-4 hover:underline hover:text-foreground",
38
+ styled: "transition duration-300 border-2 border-border text-foreground rounded-md bg-primary hover:bg-muted",
39
+ reverted: "transition duration-300 border-2 border-border text-foreground rounded-md bg-background hover:bg-primary",
40
+ success: "bg-green-600 text-white shadow-sm hover:bg-green-700 active:shadow-none",
41
+ warning: "bg-amber-600 text-white shadow-sm hover:bg-amber-700 active:shadow-none",
42
+ info: "bg-blue-600 text-white shadow-sm hover:bg-blue-700 active:shadow-none",
43
+ soft: "bg-primary/10 text-primary hover:bg-primary/20 active:bg-primary/30",
44
+ shine: "bg-primary text-primary-foreground relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-white/20 before:to-transparent before:-translate-x-full hover:before:translate-x-full before:transition-transform before:duration-700",
45
+ pulse: "bg-primary text-primary-foreground animate-pulse hover:animate-none shadow-md hover:shadow-lg",
46
+ },
47
+ size: {
48
+ sm: "p-3 text-sm",
49
+ default: "p-6",
50
+ lg: "p-8 text-lg",
51
+ xl: "p-10 text-xl",
52
+ icon: "p-4 aspect-square flex items-center justify-center",
53
+ },
54
+ interactive: {
55
+ true: "cursor-pointer hover:scale-[1.02] active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
56
+ false: "",
57
+ },
58
+ align: {
59
+ left: "text-left",
60
+ center: "text-center",
61
+ right: "text-right",
62
+ },
63
+ },
64
+ defaultVariants: {
65
+ variant: "default",
66
+ size: "default",
67
+ interactive: false,
68
+ align: "left",
69
+ },
70
+ }
71
+ )
72
+
73
+ // #endregion ===========================================================================
74
+ // CARD HEADER VARIANTS
75
+ // #region ===========================================================================
76
+ const cardHeaderVariants = cva(
77
+ "flex flex-col",
78
+ {
79
+ variants: {
80
+ spacing: {
81
+ none: "p-0 space-y-0",
82
+ compact: "p-3 space-y-1",
83
+ default: "p-6 space-y-1.5",
84
+ spacious: "p-8 space-y-2",
85
+ },
86
+ align: {
87
+ left: "items-start text-left",
88
+ center: "items-center text-center",
89
+ right: "items-end text-right",
90
+ },
91
+ },
92
+ defaultVariants: {
93
+ spacing: "default",
94
+ align: "left",
95
+ },
96
+ }
97
+ )
98
+
99
+ // #endregion ===========================================================================
100
+ // CARD TITLE VARIANTS
101
+ // #region ===========================================================================
102
+ const cardTitleVariants = cva(
103
+ "font-semibold leading-none tracking-tight",
104
+ {
105
+ variants: {
106
+ size: {
107
+ sm: "text-base",
108
+ default: "text-2xl",
109
+ lg: "text-3xl",
110
+ xl: "text-4xl",
111
+ },
112
+ weight: {
113
+ normal: "font-normal",
114
+ medium: "font-medium",
115
+ semibold: "font-semibold",
116
+ bold: "font-bold",
117
+ },
118
+ },
119
+ defaultVariants: {
120
+ size: "default",
121
+ weight: "semibold",
122
+ },
123
+ }
124
+ )
125
+
126
+ // #endregion ===========================================================================
127
+ // CARD DESCRIPTION VARIANTS
128
+ // #region ===========================================================================
129
+ const cardDescriptionVariants = cva(
130
+ "text-muted-foreground",
131
+ {
132
+ variants: {
133
+ size: {
134
+ xs: "text-xs",
135
+ sm: "text-sm",
136
+ default: "text-sm",
137
+ base: "text-base",
138
+ },
139
+ },
140
+ defaultVariants: {
141
+ size: "default",
142
+ },
143
+ }
144
+ )
145
+
146
+ // #endregion ===========================================================================
147
+ // CARD CONTENT VARIANTS
148
+ // #region ===========================================================================
149
+ const cardContentVariants = cva(
150
+ "",
151
+ {
152
+ variants: {
153
+ padding: {
154
+ none: "p-0",
155
+ sm: "p-3",
156
+ default: "p-6 pt-0",
157
+ lg: "p-8 pt-0",
158
+ },
159
+ spacing: {
160
+ none: "space-y-0",
161
+ tight: "space-y-2",
162
+ default: "space-y-4",
163
+ loose: "space-y-6",
164
+ },
165
+ },
166
+ defaultVariants: {
167
+ padding: "default",
168
+ spacing: "default",
169
+ },
170
+ }
171
+ )
172
+
173
+ // #endregion ===========================================================================
174
+ // CARD FOOTER VARIANTS
175
+ // #region ===========================================================================
176
+ const cardFooterVariants = cva(
177
+ "flex p-6 pt-0",
178
+ {
179
+ variants: {
180
+ layout: {
181
+ row: "flex-row",
182
+ column: "flex-col",
183
+ "row-reverse": "flex-row-reverse",
184
+ "column-reverse": "flex-col-reverse",
185
+ },
186
+ justify: {
187
+ start: "justify-start",
188
+ center: "justify-center",
189
+ end: "justify-end",
190
+ between: "justify-between",
191
+ around: "justify-around",
192
+ evenly: "justify-evenly",
193
+ },
194
+ align: {
195
+ start: "items-start",
196
+ center: "items-center",
197
+ end: "items-end",
198
+ stretch: "items-stretch",
199
+ },
200
+ gap: {
201
+ none: "gap-0",
202
+ sm: "gap-2",
203
+ default: "gap-3",
204
+ md: "gap-4",
205
+ lg: "gap-6",
206
+ },
207
+ },
208
+ defaultVariants: {
209
+ layout: "row",
210
+ justify: "start",
211
+ align: "center",
212
+ gap: "default",
213
+ },
214
+ }
215
+ )
216
+
217
+ // #endregion ===========================================================================
218
+ // CARD ACTION VARIANTS
219
+ // #region ===========================================================================
220
+ const cardActionVariants = cva(
221
+ "col-start-2 row-span-2 row-start-1",
222
+ {
223
+ variants: {
224
+ position: {
225
+ default: "self-start justify-self-end",
226
+ "top-right": "self-start justify-self-end",
227
+ "top-left": "self-start justify-self-start",
228
+ "bottom-right": "self-end justify-self-end",
229
+ "bottom-left": "self-end justify-self-start",
230
+ center: "self-center justify-self-center",
231
+ },
232
+ },
233
+ defaultVariants: {
234
+ position: "default",
235
+ },
236
+ }
237
+ )
238
+
239
+ // #endregion ===========================================================================
240
+ // TYPE DEFINITIONS
241
+ // #region ===========================================================================
242
+ interface CardProps
243
+ extends React.HTMLAttributes<HTMLDivElement>,
244
+ VariantProps<typeof cardVariants> {}
245
+
246
+ interface CardHeaderProps
247
+ extends React.HTMLAttributes<HTMLDivElement>,
248
+ VariantProps<typeof cardHeaderVariants> {}
249
+
250
+ interface CardTitleProps
251
+ extends React.HTMLAttributes<HTMLHeadingElement>,
252
+ VariantProps<typeof cardTitleVariants> {}
253
+
254
+ interface CardDescriptionProps
255
+ extends React.HTMLAttributes<HTMLParagraphElement>,
256
+ VariantProps<typeof cardDescriptionVariants> {}
257
+
258
+ interface CardContentProps
259
+ extends React.HTMLAttributes<HTMLDivElement>,
260
+ VariantProps<typeof cardContentVariants> {}
261
+
262
+ interface CardFooterProps
263
+ extends React.HTMLAttributes<HTMLDivElement>,
264
+ VariantProps<typeof cardFooterVariants> {}
265
+
266
+ interface CardActionProps
267
+ extends React.HTMLAttributes<HTMLDivElement>,
268
+ VariantProps<typeof cardActionVariants> {}
269
+
270
+ // #endregion ===========================================================================
271
+ // CARD COMPONENT
272
+ // #region ===========================================================================
273
+ const Card = React.forwardRef<HTMLDivElement, CardProps>(
274
+ ({ className, variant, size, interactive, align, children, ...props }, ref) => {
275
+ const contextValue: CardContextValue = { variant, size, interactive }
276
+
277
+ return (
278
+ <CardContext.Provider value={contextValue}>
279
+ <div
280
+ ref={ref}
281
+ className={cn(cardVariants({ variant, size, interactive, align }), className)}
282
+ {...props}
283
+ >
284
+ {children}
285
+ </div>
286
+ </CardContext.Provider>
287
+ )
288
+ }
289
+ )
290
+ Card.displayName = 'Card'
291
+
292
+ // #endregion ===========================================================================
293
+ // CARD HEADER COMPONENT
294
+ // #region ===========================================================================
295
+ const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(
296
+ ({ className, spacing, align, ...props }, ref) => {
297
+ const context = useCardContext()
298
+
299
+ return (
300
+ <div
301
+ ref={ref}
302
+ className={cn(
303
+ cardHeaderVariants({
304
+ spacing,
305
+ align: align || (context.variant === 'default' ? 'left' : undefined)
306
+ }),
307
+ className
308
+ )}
309
+ {...props}
310
+ />
311
+ )
312
+ }
313
+ )
314
+ CardHeader.displayName = 'CardHeader'
315
+
316
+ // #endregion ===========================================================================
317
+ // CARD TITLE COMPONENT
318
+ // #region ===========================================================================
319
+ const CardTitle = React.forwardRef<HTMLParagraphElement, CardTitleProps>(
320
+ ({ className, size, weight, ...props }, ref) => (
321
+ <h3
322
+ ref={ref}
323
+ className={cn(cardTitleVariants({ size, weight }), className)}
324
+ {...props}
325
+ />
326
+ )
327
+ )
328
+ CardTitle.displayName = 'CardTitle'
329
+
330
+ // #endregion ===========================================================================
331
+ // CARD DESCRIPTION COMPONENT
332
+ // #region ===========================================================================
333
+ const CardDescription = React.forwardRef<HTMLParagraphElement, CardDescriptionProps>(
334
+ ({ className, size, ...props }, ref) => (
335
+ <p
336
+ ref={ref}
337
+ className={cn(cardDescriptionVariants({ size }), className)}
338
+ {...props}
339
+ />
340
+ )
341
+ )
342
+ CardDescription.displayName = 'CardDescription'
343
+
344
+ // #endregion ===========================================================================
345
+ // CARD ACTION COMPONENT
346
+ // #region ===========================================================================
347
+ const CardAction = React.forwardRef<HTMLDivElement, CardActionProps>(
348
+ ({ className, position, ...props }, ref) => (
349
+ <div
350
+ ref={ref}
351
+ data-slot="card-action"
352
+ className={cn(cardActionVariants({ position }), className)}
353
+ {...props}
354
+ />
355
+ )
356
+ )
357
+ CardAction.displayName = 'CardAction'
358
+
359
+ // #endregion ===========================================================================
360
+ // CARD CONTENT COMPONENT
361
+ // #region ===========================================================================
362
+ const CardContent = React.forwardRef<HTMLDivElement, CardContentProps>(
363
+ ({ className, padding, spacing, ...props }, ref) => (
364
+ <div
365
+ ref={ref}
366
+ className={cn(cardContentVariants({ padding, spacing }), className)}
367
+ {...props}
368
+ />
369
+ )
370
+ )
371
+ CardContent.displayName = 'CardContent'
372
+
373
+ // #endregion ===========================================================================
374
+ // CARD FOOTER COMPONENT
375
+ // #region ===========================================================================
376
+ const CardFooter = React.forwardRef<HTMLDivElement, CardFooterProps>(
377
+ ({ className, layout, justify, align, gap, ...props }, ref) => (
378
+ <div
379
+ ref={ref}
380
+ className={cn(cardFooterVariants({ layout, justify, align, gap }), className)}
381
+ {...props}
382
+ />
383
+ )
384
+ )
385
+ CardFooter.displayName = 'CardFooter'
386
+
387
+ // #endregion ===========================================================================
388
+ // CARD IMAGE COMPONENT
389
+ // #region ===========================================================================
390
+ interface CardImageProps extends CardProps {
391
+ imgSrc: string;
392
+ imgAlt: string;
393
+ title: string;
394
+ description: string;
395
+ actionText?: string;
396
+ actionTo?: string;
397
+ onActionClick?: () => void;
398
+ }
399
+
400
+ const CardImage = forwardRef<HTMLDivElement, CardImageProps>(
401
+ ({
402
+ className,
403
+ imgSrc,
404
+ imgAlt,
405
+ title,
406
+ description,
407
+ actionText,
408
+ actionTo,
409
+ onActionClick,
410
+ variant,
411
+ size,
412
+ interactive,
413
+ ...props
414
+ }, ref) => {
415
+ const ActionElement = actionTo ? 'a' : 'button';
416
+
417
+ return (
418
+ <Card
419
+ ref={ref}
420
+ variant={variant}
421
+ size={size}
422
+ interactive={interactive}
423
+ className={cn("overflow-hidden", className)}
424
+ {...props}
425
+ >
426
+ <div className="aspect-video overflow-hidden">
427
+ <img
428
+ src={imgSrc}
429
+ alt={imgAlt}
430
+ className="h-full w-full object-cover transition-all hover:scale-105"
431
+ />
432
+ </div>
433
+ <CardHeader>
434
+ <CardTitle>{title}</CardTitle>
435
+ <CardDescription>{description}</CardDescription>
436
+ </CardHeader>
437
+ {actionText && (
438
+ <CardFooter>
439
+ <ActionElement
440
+ {...(actionTo ? { href: actionTo } : { onClick: onActionClick })}
441
+ className="text-primary hover:underline"
442
+ >
443
+ {actionText}
444
+ </ActionElement>
445
+ </CardFooter>
446
+ )}
447
+ </Card>
448
+ );
449
+ }
450
+ );
451
+ CardImage.displayName = "CardImage";
452
+
453
+ // #endregion ===========================================================================
454
+ // CARD HEART COMPONENT
455
+ // #region ===========================================================================
456
+ interface CardHeartProps {
457
+ filled: boolean;
458
+ className?: string;
459
+ }
460
+
461
+ function CardHeart({ filled, className }: CardHeartProps) {
462
+ return filled ? (
463
+ <svg
464
+ xmlns="http://www.w3.org/2000/svg"
465
+ viewBox="0 0 24 24"
466
+ fill="currentColor"
467
+ className={className}
468
+ >
469
+ <path d="M11.645 20.91l-.007-.003-.022-.012a15.247 15.247 0 01-.383-.218 25.18 25.18 0 01-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0112 5.052 5.5 5.5 0 0116.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 01-4.244 3.17 15.247 15.247 0 01-.383.218l-.022.012-.007.004-.003.001a.752.752 0 01-.704 0l-.003-.001z" />
470
+ </svg>
471
+ ) : (
472
+ <svg
473
+ xmlns="http://www.w3.org/2000/svg"
474
+ fill="none"
475
+ viewBox="0 0 24 24"
476
+ strokeWidth={1.5}
477
+ stroke="currentColor"
478
+ className={className}
479
+ >
480
+ <path
481
+ strokeLinecap="round"
482
+ strokeLinejoin="round"
483
+ d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z"
484
+ />
485
+ </svg>
486
+ );
487
+ }
488
+
489
+ // #endregion ===========================================================================
490
+ // CARD PRODUCT COMPONENT
491
+ // #region ===========================================================================
492
+ interface Product {
493
+ id: string;
494
+ name: string;
495
+ description: string;
496
+ price: number;
497
+ image: string;
498
+ category: string;
499
+ rating: number;
500
+ }
501
+
502
+ interface CardProductProps extends CardProps {
503
+ product: Product;
504
+ onAddToCart: (productId: string) => void;
505
+ onToggleFavorite: (productId: string) => void;
506
+ isFavorite?: boolean;
507
+ }
508
+
509
+ const CardProduct = forwardRef<HTMLDivElement, CardProductProps>(
510
+ ({
511
+ className,
512
+ product,
513
+ onAddToCart,
514
+ onToggleFavorite,
515
+ isFavorite = false,
516
+ variant,
517
+ size,
518
+ interactive,
519
+ ...props
520
+ }, ref) => {
521
+ return (
522
+ <Card
523
+ ref={ref}
524
+ variant={variant}
525
+ size={size}
526
+ interactive={interactive}
527
+ className={cn("group overflow-hidden", className)}
528
+ {...props}
529
+ >
530
+ <div className="relative aspect-square overflow-hidden">
531
+ <img
532
+ src={product.image}
533
+ alt={product.name}
534
+ className="h-full w-full object-cover transition-all group-hover:scale-105"
535
+ />
536
+ <button
537
+ onClick={() => onToggleFavorite(product.id)}
538
+ className="absolute top-2 right-2 rounded-full bg-background/80 p-2 backdrop-blur-sm transition-all hover:bg-background"
539
+ aria-label={isFavorite ? "Remove from favorites" : "Add to favorites"}
540
+ >
541
+ <CardHeart filled={isFavorite} className="h-4 w-4" />
542
+ </button>
543
+ </div>
544
+ <CardHeader spacing="compact">
545
+ <div className="flex items-start justify-between">
546
+ <div>
547
+ <CardTitle size="sm">{product.name}</CardTitle>
548
+ <CardDescription size="sm">{product.category}</CardDescription>
549
+ </div>
550
+ <div className="text-lg font-semibold">${product.price.toFixed(2)}</div>
551
+ </div>
552
+ </CardHeader>
553
+ <CardContent padding="sm">
554
+ <p className="line-clamp-2 text-sm text-muted-foreground">
555
+ {product.description}
556
+ </p>
557
+ </CardContent>
558
+ <CardFooter padding="sm">
559
+ <button
560
+ onClick={() => onAddToCart(product.id)}
561
+ className="w-full rounded-md bg-primary py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90"
562
+ >
563
+ Add to Cart
564
+ </button>
565
+ </CardFooter>
566
+ </Card>
567
+ );
568
+ }
569
+ );
570
+ CardProduct.displayName = "CardProduct";
571
+
572
+ // #endregion ===========================================================================
573
+ // EXPORTS
574
+ // #region ===========================================================================
575
+ export function CardGroup({ variant, className, children }: any) {
576
+ switch (variant) {
577
+ case 'vertical':
578
+ return (
579
+ <div className={cn('flex flex-col *:rounded-none *:shadow-none *:not-last:border-b-0 *:first:rounded-t-xl *:last:rounded-b-xl', className)}>
580
+ {children}
581
+ </div>
582
+ )
583
+ default:
584
+ return (
585
+ <div className={cn('flex *:rounded-none *:shadow-none max-xl:flex-col max-xl:*:not-last:border-b-0 max-xl:*:first:rounded-t-xl max-xl:*:last:rounded-b-xl xl:*:not-last:border-r-0 xl:*:first:rounded-l-xl xl:*:last:rounded-r-xl', className)}>
586
+ {children}
587
+ </div>
588
+ )
589
+ }
590
+ }
591
+
592
+ export {
593
+ Card,
594
+ CardHeader,
595
+ CardFooter,
596
+ CardTitle,
597
+ CardDescription,
598
+ CardAction,
599
+ CardContent,
600
+ CardImage,
601
+ CardHeart,
602
+ CardProduct,
603
+ cardVariants,
604
+ cardHeaderVariants,
605
+ cardTitleVariants,
606
+ cardDescriptionVariants,
607
+ cardContentVariants,
608
+ cardFooterVariants,
609
+ cardActionVariants,
610
+ useCardContext,
611
+ type CardProps,
612
+ type CardHeaderProps,
613
+ type CardTitleProps,
614
+ type CardDescriptionProps,
615
+ type CardContentProps,
616
+ type CardFooterProps,
617
+ type CardActionProps,
618
+ }