@catalystsoftware/ui 1.0.5 → 1.0.7

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 (155) hide show
  1. package/dist/data/data.tsx +29 -29
  2. package/dist/data/tailwind.config.js +3821 -261
  3. package/dist/data.tsx +29 -29
  4. package/package.json +4 -3
  5. package/components/catalyst-ui/buttons/burger.tsx +0 -207
  6. package/components/catalyst-ui/core/data-display/timeline.tsx +0 -210
  7. package/components/catalyst-ui/core/feedback/alert.tsx +0 -491
  8. package/components/catalyst-ui/core/feedback/spinner-1.tsx +0 -65
  9. package/components/catalyst-ui/core/feedback/toast.tsx +0 -1857
  10. package/components/catalyst-ui/core/navigation/menu.tsx +0 -164
  11. package/components/catalyst-ui/forms/toggle-class.tsx +0 -176
  12. package/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +0 -419
  13. package/components/catalyst-ui/hooks/use-counter.tsx +0 -13
  14. package/components/catalyst-ui/hooks/use-event-listener.tsx +0 -23
  15. package/components/catalyst-ui/hooks/use-export-markdown.tsx +0 -47
  16. package/components/catalyst-ui/hooks/use-focus.tsx +0 -17
  17. package/components/catalyst-ui/hooks/use-interval.tsx +0 -23
  18. package/components/catalyst-ui/hooks/use-is-client.tsx +0 -16
  19. package/components/catalyst-ui/hooks/use-media-query.tsx +0 -19
  20. package/components/catalyst-ui/hooks/use-mobile.tsx +0 -19
  21. package/components/catalyst-ui/hooks/use-resize-observer.tsx +0 -81
  22. package/components/catalyst-ui/hooks/use-timeout.tsx +0 -21
  23. package/components/catalyst-ui/hooks/use-timer.tsx +0 -209
  24. package/components/catalyst-ui/hooks/use-toggle.tsx +0 -12
  25. package/components/catalyst-ui/media/image.tsx +0 -13
  26. package/components/catalyst-ui/overlays/dual-sidebar.tsx +0 -4142
  27. package/components/catalyst-ui/overlays/sidebar-original.tsx +0 -726
  28. package/components/catalyst-ui/primitives/accordion.tsx +0 -250
  29. package/components/catalyst-ui/primitives/alert-dialog.tsx +0 -126
  30. package/components/catalyst-ui/primitives/aspect-ratio.tsx +0 -9
  31. package/components/catalyst-ui/primitives/avatar.tsx +0 -296
  32. package/components/catalyst-ui/primitives/badge.tsx +0 -57
  33. package/components/catalyst-ui/primitives/breadcrumb.tsx +0 -101
  34. package/components/catalyst-ui/primitives/button.tsx +0 -265
  35. package/components/catalyst-ui/primitives/calendar-v4.tsx +0 -208
  36. package/components/catalyst-ui/primitives/calendar.tsx +0 -295
  37. package/components/catalyst-ui/primitives/card.tsx +0 -618
  38. package/components/catalyst-ui/primitives/carousel.tsx +0 -238
  39. package/components/catalyst-ui/primitives/chart.tsx +0 -347
  40. package/components/catalyst-ui/primitives/checkbox.tsx +0 -225
  41. package/components/catalyst-ui/primitives/collapsible.tsx +0 -212
  42. package/components/catalyst-ui/primitives/command.tsx +0 -393
  43. package/components/catalyst-ui/primitives/context-menu.tsx +0 -236
  44. package/components/catalyst-ui/primitives/dialog.tsx +0 -471
  45. package/components/catalyst-ui/primitives/drawer.tsx +0 -761
  46. package/components/catalyst-ui/primitives/dropdown-menu.tsx +0 -290
  47. package/components/catalyst-ui/primitives/empty.tsx +0 -104
  48. package/components/catalyst-ui/primitives/field.tsx +0 -244
  49. package/components/catalyst-ui/primitives/hover-card.tsx +0 -124
  50. package/components/catalyst-ui/primitives/input-otp.tsx +0 -76
  51. package/components/catalyst-ui/primitives/input.tsx +0 -64
  52. package/components/catalyst-ui/primitives/item.tsx +0 -196
  53. package/components/catalyst-ui/primitives/kbd.tsx +0 -75
  54. package/components/catalyst-ui/primitives/label.tsx +0 -24
  55. package/components/catalyst-ui/primitives/navigation-menu.tsx +0 -150
  56. package/components/catalyst-ui/primitives/pagination.tsx +0 -198
  57. package/components/catalyst-ui/primitives/popover.tsx +0 -232
  58. package/components/catalyst-ui/primitives/progress.tsx +0 -34
  59. package/components/catalyst-ui/primitives/radio-group.tsx +0 -43
  60. package/components/catalyst-ui/primitives/resizable.tsx +0 -56
  61. package/components/catalyst-ui/primitives/select.tsx +0 -155
  62. package/components/catalyst-ui/primitives/separator.tsx +0 -74
  63. package/components/catalyst-ui/primitives/sheet.tsx +0 -126
  64. package/components/catalyst-ui/primitives/skeleton.tsx +0 -15
  65. package/components/catalyst-ui/primitives/slider.tsx +0 -27
  66. package/components/catalyst-ui/primitives/switch.tsx +0 -187
  67. package/components/catalyst-ui/primitives/tabs.tsx +0 -335
  68. package/components/catalyst-ui/primitives/textarea.tsx +0 -24
  69. package/components/catalyst-ui/primitives/toggle-group.tsx +0 -55
  70. package/components/catalyst-ui/primitives/toggle.tsx +0 -42
  71. package/components/catalyst-ui/primitives/tooltip.tsx +0 -116
  72. package/components/catalyst-ui/utils/basic-auth.tsx +0 -40
  73. package/components/catalyst-ui/utils/context-storage.tsx +0 -19
  74. package/components/catalyst-ui/utils/cors-middleware.tsx +0 -71
  75. package/components/catalyst-ui/utils/deferred-content.tsx +0 -595
  76. package/components/catalyst-ui/utils/honeypot-middleware.tsx +0 -38
  77. package/components/catalyst-ui/utils/incId.tsx +0 -75
  78. package/components/catalyst-ui/utils/jwk-auth.tsx +0 -36
  79. package/components/catalyst-ui/utils/request-id.tsx +0 -14
  80. package/components/catalyst-ui/utils/secure-headers.tsx +0 -37
  81. package/components/catalyst-ui/utils/server-timing.tsx +0 -23
  82. package/components/catalyst-ui/utils/utils.ts +0 -43
  83. package/components/catalyst-ui/utils/with-cookie.tsx +0 -43
  84. package/components/catalyst-ui/x/accordian-x.tsx +0 -428
  85. package/components/catalyst-ui/x/alert-x.tsx +0 -413
  86. package/components/catalyst-ui/x/animated-text-x.tsx +0 -2242
  87. package/components/catalyst-ui/x/avatar-x.tsx +0 -515
  88. package/components/catalyst-ui/x/badge-x.tsx +0 -670
  89. package/components/catalyst-ui/x/button-X.tsx +0 -2857
  90. package/components/catalyst-ui/x/button-group-x.tsx +0 -847
  91. package/components/catalyst-ui/x/calendar-x.tsx +0 -1910
  92. package/components/catalyst-ui/x/card-x.tsx +0 -2597
  93. package/components/catalyst-ui/x/checkbox-x.tsx +0 -656
  94. package/components/catalyst-ui/x/collapsible-x.tsx +0 -1360
  95. package/components/catalyst-ui/x/combobox-x.tsx +0 -911
  96. package/components/catalyst-ui/x/data-table-x.tsx +0 -1753
  97. package/components/catalyst-ui/x/date-picker-x.tsx +0 -648
  98. package/components/catalyst-ui/x/dialog-x.tsx +0 -659
  99. package/components/catalyst-ui/x/dropdown-menu-x.tsx +0 -612
  100. package/components/catalyst-ui/x/hover-card-x.tsx +0 -375
  101. package/components/catalyst-ui/x/icon-x.tsx +0 -840
  102. package/components/catalyst-ui/x/input-mask-x.tsx +0 -981
  103. package/components/catalyst-ui/x/input-otp-x.tsx +0 -659
  104. package/components/catalyst-ui/x/loader-x.tsx +0 -1757
  105. package/components/catalyst-ui/x/pagination-x.tsx +0 -622
  106. package/components/catalyst-ui/x/popover-x.tsx +0 -744
  107. package/components/catalyst-ui/x/radio-group-x.tsx +0 -499
  108. package/components/catalyst-ui/x/select-x.tsx +0 -1127
  109. package/components/catalyst-ui/x/sheet-x.tsx +0 -668
  110. package/components/catalyst-ui/x/switch-x.tsx +0 -681
  111. package/components/catalyst-ui/x/table-x.tsx +0 -574
  112. package/components/catalyst-ui/x/tabs-x.tsx +0 -839
  113. package/components/catalyst-ui/x/textarea-x.tsx +0 -1263
  114. package/components/catalyst-ui/x/tooltip-x.tsx +0 -396
  115. package/components/catalyst-ui/x/tracker-x.tsx +0 -560
  116. package/data/bg-data.tsx +0 -901
  117. package/data/buttons-data.tsx +0 -2327
  118. package/data/charts-data.tsx +0 -102
  119. package/data/chat-data.tsx +0 -83
  120. package/data/code-data.tsx +0 -1040
  121. package/data/comboboxes-data.tsx +0 -1843
  122. package/data/command-data.tsx +0 -1381
  123. package/data/core-data.tsx +0 -15953
  124. package/data/crm-data.tsx +0 -47
  125. package/data/data.tsx +0 -159
  126. package/data/date-and-time-data.tsx +0 -554
  127. package/data/dependencies.tsx +0 -7
  128. package/data/ecommerce-data.tsx +0 -1387
  129. package/data/forms-data.tsx +0 -7890
  130. package/data/hooks-data.tsx +0 -5487
  131. package/data/index.ts +0 -34
  132. package/data/inputs-data.tsx +0 -557
  133. package/data/interactive-data.tsx +0 -5394
  134. package/data/lofi-data.tsx +0 -18295
  135. package/data/marketing-data.tsx +0 -2546
  136. package/data/media-data.tsx +0 -1510
  137. package/data/motion-data.tsx +0 -5801
  138. package/data/overlay-data.tsx +0 -4136
  139. package/data/pdf-data.tsx +0 -124
  140. package/data/pos-data.tsx +0 -213
  141. package/data/postcss.config.js +0 -6
  142. package/data/primitive-data.tsx +0 -5170
  143. package/data/prompt-data.tsx +0 -1226
  144. package/data/requiredLibs.ts +0 -4
  145. package/data/sandbox-data.tsx +0 -1
  146. package/data/sidebars-data.tsx +0 -5421
  147. package/data/stacks-data.tsx +0 -32
  148. package/data/table-data.tsx +0 -706
  149. package/data/tailwind.config.js +0 -270
  150. package/data/tailwind.config.ngin.js +0 -3830
  151. package/data/tailwind.css +0 -431
  152. package/data/tools-data.tsx +0 -6910
  153. package/data/typography-data.tsx +0 -2050
  154. package/data/utils-data.tsx +0 -6500
  155. package/data/x-data.tsx +0 -1171
@@ -1,618 +0,0 @@
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
- }