@adamosuiteservices/ui 2.11.17 → 2.11.18

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 (66) hide show
  1. package/dist/accordion-rounded.cjs +1 -1
  2. package/dist/accordion-rounded.js +1 -1
  3. package/dist/badge.cjs +3 -3
  4. package/dist/badge.js +2 -2
  5. package/dist/breadcrumb.cjs +5 -5
  6. package/dist/breadcrumb.js +16 -16
  7. package/dist/components/ui/date-picker-selector/date-picker-selector.d.ts +2 -2
  8. package/dist/components/ui/sheet/sheet.d.ts +2 -1
  9. package/dist/date-picker-selector.cjs +1 -1
  10. package/dist/date-picker-selector.js +29 -30
  11. package/dist/dialog.cjs +1 -1
  12. package/dist/dialog.js +1 -1
  13. package/dist/select.cjs +2 -2
  14. package/dist/select.js +2 -2
  15. package/dist/{sheet-DVT_djHX.cjs → sheet-CvcCaGSl.cjs} +11 -11
  16. package/dist/{sheet-CPf9Guon.js → sheet-IRIc3TJ1.js} +33 -19
  17. package/dist/sheet.cjs +1 -1
  18. package/dist/sheet.js +7 -6
  19. package/dist/sidebar.cjs +1 -1
  20. package/dist/sidebar.js +1 -1
  21. package/dist/styles.css +1 -1
  22. package/dist/tabs-underline.cjs +3 -3
  23. package/dist/tabs-underline.js +13 -13
  24. package/dist/tabs.cjs +5 -4
  25. package/dist/tabs.js +3 -2
  26. package/dist/themes.css +1 -1
  27. package/docs/AI-GUIDE.md +321 -321
  28. package/docs/components/layout/sidebar.md +399 -399
  29. package/docs/components/layout/toaster.md +436 -436
  30. package/docs/components/ui/accordion-rounded.md +584 -584
  31. package/docs/components/ui/accordion.md +269 -269
  32. package/docs/components/ui/badge.md +2 -1
  33. package/docs/components/ui/button-group.md +984 -984
  34. package/docs/components/ui/button.md +1137 -1137
  35. package/docs/components/ui/calendar.md +1159 -1159
  36. package/docs/components/ui/card.md +1455 -1455
  37. package/docs/components/ui/checkbox.md +292 -292
  38. package/docs/components/ui/collapsible.md +323 -323
  39. package/docs/components/ui/command.md +454 -454
  40. package/docs/components/ui/context-menu.md +540 -540
  41. package/docs/components/ui/date-picker-selector.md +0 -2
  42. package/docs/components/ui/dialog.md +628 -628
  43. package/docs/components/ui/dropdown-menu.md +709 -709
  44. package/docs/components/ui/field.md +706 -706
  45. package/docs/components/ui/hover-card.md +446 -446
  46. package/docs/components/ui/input.md +362 -362
  47. package/docs/components/ui/kbd.md +434 -434
  48. package/docs/components/ui/label.md +359 -359
  49. package/docs/components/ui/pagination.md +650 -650
  50. package/docs/components/ui/popover.md +536 -536
  51. package/docs/components/ui/progress.md +182 -182
  52. package/docs/components/ui/radio-group.md +311 -311
  53. package/docs/components/ui/select.md +352 -352
  54. package/docs/components/ui/separator.md +214 -214
  55. package/docs/components/ui/sheet.md +174 -142
  56. package/docs/components/ui/skeleton.md +140 -140
  57. package/docs/components/ui/slider.md +341 -341
  58. package/docs/components/ui/spinner.md +170 -170
  59. package/docs/components/ui/switch.md +408 -408
  60. package/docs/components/ui/tabs-underline.md +106 -106
  61. package/docs/components/ui/tabs.md +122 -122
  62. package/docs/components/ui/textarea.md +243 -243
  63. package/docs/components/ui/toggle.md +237 -237
  64. package/docs/components/ui/tooltip.md +317 -317
  65. package/docs/components/ui/typography.md +280 -280
  66. package/package.json +1 -1
@@ -1,1455 +1,1455 @@
1
- # Card
2
-
3
- Contenedor versátil con bordes redondeados, padding, sombra y borde configurables para agrupar contenido relacionado. Incluye 6 variantes de color, control de elevación y bordes, y un sistema de layout con grid automático para headers con acciones.
4
-
5
- ## Características Principales
6
-
7
- - **6 variantes de color**: Default, Primary, Muted, Success, Warning, Destructive
8
- - **2 variantes de sombra**: Default (con elevación) y None (diseño plano, por defecto)
9
- - **2 variantes de borde**: Default (visible) y Transparent (invisible pero mantiene espacio)
10
- - **Composición modular**: 6 subcomponentes (Card, CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardFooter)
11
- - **Grid automático en header**: Detecta `CardAction` y ajusta layout automáticamente con `has-data-[slot=card-action]:grid-cols-[1fr_auto]`
12
- - **Container queries**: CardHeader usa `@container/card-header` para layouts responsive
13
- - **Spacing flexible**: `gap-6` entre secciones principales, spacing auto en header/footer con bordes
14
- - **Bordes opcionales**: Clases `.border-b` y `.border-t` añaden separadores con padding automático
15
- - **Data slots**: Cada subcomponente tiene `data-slot` para targeting CSS específico
16
- - **Integración con otros componentes**: Background transparente para Calendar/otros componentes anidados
17
-
18
- ## Importación
19
-
20
- ```tsx
21
- import {
22
- Card,
23
- CardHeader,
24
- CardTitle,
25
- CardDescription,
26
- CardAction,
27
- CardContent,
28
- CardFooter,
29
- } from "@adamosuiteservices/ui/card";
30
- ```
31
-
32
- ## Uso Básico
33
-
34
- ### Card Completa
35
-
36
- Estructura típica con todos los componentes.
37
-
38
- ```tsx
39
- import {
40
- Card,
41
- CardHeader,
42
- CardTitle,
43
- CardDescription,
44
- CardContent,
45
- CardFooter,
46
- } from "@adamosuiteservices/ui/card";
47
- import { Button } from "@adamosuiteservices/ui/button";
48
-
49
- <Card className="w-[350px]">
50
- <CardHeader>
51
- <CardTitle>Card Title</CardTitle>
52
- <CardDescription>Card Description</CardDescription>
53
- </CardHeader>
54
- <CardContent>
55
- <p>Card Content goes here.</p>
56
- </CardContent>
57
- <CardFooter>
58
- <Button>Action</Button>
59
- </CardFooter>
60
- </Card>;
61
- ```
62
-
63
- ### Card Simple (Solo Contenido)
64
-
65
- Para contenedores minimalistas sin header/footer.
66
-
67
- ```tsx
68
- <Card className="w-[350px]">
69
- <CardContent>
70
- <h3 className="text-lg font-semibold">Simple Card</h3>
71
- <p className="text-sm text-muted-foreground">
72
- This is a simple card with just content.
73
- </p>
74
- </CardContent>
75
- </Card>
76
- ```
77
-
78
- ### Con Acción en Header
79
-
80
- Botón de acción que se alinea automáticamente a la derecha.
81
-
82
- ```tsx
83
- import { Icon } from "@adamosuiteservices/ui/icon";
84
-
85
- <Card className="w-[400px]">
86
- <CardHeader>
87
- <CardTitle>Notifications</CardTitle>
88
- <CardDescription>You have 3 unread messages.</CardDescription>
89
- <CardAction>
90
- <Button variant="outline" size="sm">
91
- <Icon symbol="more_horiz" />
92
- </Button>
93
- </CardAction>
94
- </CardHeader>
95
- <CardContent>{/* Notification items */}</CardContent>
96
- </Card>;
97
- ```
98
-
99
- **Nota**: El grid se ajusta automáticamente cuando hay `CardAction`.
100
-
101
- ## Componentes
102
-
103
- ### Card
104
-
105
- Contenedor principal de la card.
106
-
107
- #### Props
108
-
109
- | Prop | Tipo | Default | Descripción |
110
- | ----------- | ------------------------------------------------------------------------------ | ----------- | ---------------------------------------------------------- |
111
- | `variant` | `"default" \| "primary" \| "muted" \| "success" \| "warning" \| "destructive"` | `"default"` | Variante de color de fondo |
112
- | `shadow` | `"default" \| "none"` | `"none"` | Control de sombra (none=flat, default=elevación) |
113
- | `border` | `"default" \| "transparent"` | `"default"` | Control de borde (default=visible, transparent=invisible) |
114
- | `className` | `string` | - | Clases CSS adicionales |
115
- | `children` | `ReactNode` | - | Contenido de la card |
116
-
117
- ### CardHeader
118
-
119
- Sección de encabezado con grid automático para título, descripción y acción.
120
-
121
- #### Props
122
-
123
- | Prop | Tipo | Descripción |
124
- | ----------- | ----------- | ---------------------------------------------------------- |
125
- | `className` | `string` | Clases CSS adicionales |
126
- | `children` | `ReactNode` | Usualmente contiene CardTitle, CardDescription, CardAction |
127
-
128
- **Características**:
129
-
130
- - Grid automático: 2 filas (`grid-rows-[auto_auto]`)
131
- - Columnas adaptativas: 1 columna por defecto, 2 cuando hay `CardAction` (`has-data-[slot=card-action]:grid-cols-[1fr_auto]`)
132
- - Container query: `@container/card-header` para responsive interno
133
- - Padding inferior automático: `[.border-b]:pb-6` cuando se agrega clase `.border-b`
134
-
135
- ### CardTitle
136
-
137
- Título principal de la card.
138
-
139
- #### Props
140
-
141
- | Prop | Tipo | Descripción |
142
- | ----------- | ----------- | ---------------------- |
143
- | `className` | `string` | Clases CSS adicionales |
144
- | `children` | `ReactNode` | Texto del título |
145
-
146
- **Estilos default**: `leading-none font-semibold`
147
-
148
- ### CardDescription
149
-
150
- Descripción o subtítulo de la card.
151
-
152
- #### Props
153
-
154
- | Prop | Tipo | Descripción |
155
- | ----------- | ----------- | ---------------------- |
156
- | `className` | `string` | Clases CSS adicionales |
157
- | `children` | `ReactNode` | Texto de descripción |
158
-
159
- **Estilos default**: `text-muted-foreground text-sm`
160
-
161
- ### CardAction
162
-
163
- Botón o acción alineada a la derecha del header.
164
-
165
- #### Props
166
-
167
- | Prop | Tipo | Descripción |
168
- | ----------- | ----------- | ---------------------- |
169
- | `className` | `string` | Clases CSS adicionales |
170
- | `children` | `ReactNode` | Usualmente un Button |
171
-
172
- **Posicionamiento**:
173
-
174
- - `col-start-2 row-span-2 row-start-1`: Ocupa columna 2, ambas filas
175
- - `self-start justify-self-end`: Alineado superior-derecha
176
-
177
- ### CardContent
178
-
179
- Contenido principal de la card.
180
-
181
- #### Props
182
-
183
- | Prop | Tipo | Descripción |
184
- | ----------- | ----------- | ---------------------- |
185
- | `className` | `string` | Clases CSS adicionales |
186
- | `children` | `ReactNode` | Contenido principal |
187
-
188
- **Estilos default**: `px-6` (padding horizontal matching header/footer)
189
-
190
- ### CardFooter
191
-
192
- Pie de la card para acciones o información adicional.
193
-
194
- #### Props
195
-
196
- | Prop | Tipo | Descripción |
197
- | ----------- | ----------- | ---------------------- |
198
- | `className` | `string` | Clases CSS adicionales |
199
- | `children` | `ReactNode` | Usualmente botones |
200
-
201
- **Estilos default**:
202
-
203
- - `flex items-center px-6`: Layout flex horizontal centrado
204
- - `[.border-t]:pt-6`: Padding superior automático con clase `.border-t`
205
-
206
- ## Variantes
207
-
208
- ### Default
209
-
210
- Card estándar con fondo blanco/oscuro según tema.
211
-
212
- ```tsx
213
- <Card variant="default" className="w-[350px]">
214
- <CardHeader>
215
- <CardTitle>Default Card</CardTitle>
216
- <CardDescription>Standard card appearance</CardDescription>
217
- </CardHeader>
218
- <CardContent>
219
- <p className="text-sm">Standard styling with default colors.</p>
220
- </CardContent>
221
- </Card>
222
- ```
223
-
224
- **Colores**: `bg-card text-card-foreground`
225
-
226
- ### Primary
227
-
228
- Fondo azul claro para información importante.
229
-
230
- ```tsx
231
- <Card variant="primary" className="w-[350px]">
232
- <CardHeader>
233
- <CardTitle>Important Information</CardTitle>
234
- <CardDescription>Please read carefully</CardDescription>
235
- </CardHeader>
236
- <CardContent>
237
- <p className="text-sm">
238
- This is important information that requires attention.
239
- </p>
240
- </CardContent>
241
- <CardFooter>
242
- <Button>Acknowledge</Button>
243
- </CardFooter>
244
- </Card>
245
- ```
246
-
247
- **Colores**: `bg-primary-50` con iconos y texto ajustados
248
-
249
- ### Success
250
-
251
- Fondo verde claro para confirmaciones exitosas.
252
-
253
- ```tsx
254
- <Card variant="success" className="w-[350px]">
255
- <CardHeader>
256
- <CardTitle>Payment Successful</CardTitle>
257
- <CardDescription>Your transaction completed</CardDescription>
258
- </CardHeader>
259
- <CardContent>
260
- <p className="text-sm">Your payment has been processed successfully.</p>
261
- </CardContent>
262
- <CardFooter>
263
- <Button variant="outline">View Receipt</Button>
264
- </CardFooter>
265
- </Card>
266
- ```
267
-
268
- **Colores**: `bg-success-50` con texto `text-success/90`
269
-
270
- ### Warning
271
-
272
- Fondo naranja/amarillo para advertencias.
273
-
274
- ```tsx
275
- <Card variant="warning" className="w-[350px]">
276
- <CardHeader>
277
- <CardTitle>Storage Almost Full</CardTitle>
278
- <CardDescription>You're running out of space</CardDescription>
279
- </CardHeader>
280
- <CardContent>
281
- <p className="text-sm">You've used 95% of storage. Consider upgrading.</p>
282
- </CardContent>
283
- <CardFooter className="gap-2">
284
- <Button variant="outline" size="sm">
285
- Manage
286
- </Button>
287
- <Button size="sm">Upgrade</Button>
288
- </CardFooter>
289
- </Card>
290
- ```
291
-
292
- **Colores**: `bg-warning-50` con texto `text-warning/90`
293
-
294
- ### Destructive
295
-
296
- Fondo rojo claro para acciones destructivas o errores.
297
-
298
- ```tsx
299
- <Card variant="destructive" className="w-[350px]">
300
- <CardHeader>
301
- <CardTitle>Delete Account</CardTitle>
302
- <CardDescription>This action cannot be undone</CardDescription>
303
- </CardHeader>
304
- <CardContent>
305
- <p className="text-sm">
306
- Permanently delete your account? All data will be lost.
307
- </p>
308
- </CardContent>
309
- <CardFooter className="gap-2">
310
- <Button variant="outline" size="sm">
311
- Cancel
312
- </Button>
313
- <Button variant="destructive" size="sm">
314
- Delete
315
- </Button>
316
- </CardFooter>
317
- </Card>
318
- ```
319
-
320
- **Colores**: `bg-destructive-50` con texto `text-destructive/90`
321
-
322
- ### Muted
323
-
324
- Fondo gris claro para información secundaria.
325
-
326
- ```tsx
327
- <Card variant="muted" className="w-full">
328
- <CardHeader>
329
- <CardTitle>Muted Card</CardTitle>
330
- <CardDescription>Less prominent information</CardDescription>
331
- </CardHeader>
332
- <CardContent>
333
- <p className="text-sm">
334
- Information that doesn't require immediate attention.
335
- </p>
336
- </CardContent>
337
- </Card>
338
- ```
339
-
340
- **Colores**: `bg-muted` con texto `text-muted/90`
341
-
342
- ## Variantes de Sombra
343
-
344
- Controla la elevación de las cards con la prop `shadow`. Por defecto, las cards no tienen sombra (`shadow="none"`).
345
-
346
- ### Sin Sombra (Default)
347
-
348
- Card plana sin elevación para diseños limpios y modernos.
349
-
350
- ```tsx
351
- <Card className="w-[350px]">
352
- <CardHeader>
353
- <CardTitle>Flat Card</CardTitle>
354
- <CardDescription>No elevation, flat design</CardDescription>
355
- </CardHeader>
356
- <CardContent>
357
- <p className="text-sm">
358
- Default behavior - perfect for modern, clean layouts and dense grids.
359
- </p>
360
- </CardContent>
361
- </Card>
362
- ```
363
-
364
- **Uso**: Default para todas las cards. Ideal para diseños modernos, layouts densos, o cuando las cards ya están visualmente separadas por otros elementos.
365
-
366
- ### Con Sombra
367
-
368
- Card con sombra sutil para crear profundidad cuando se necesita énfasis.
369
-
370
- ```tsx
371
- <Card shadow="default" className="w-[350px]">
372
- <CardHeader>
373
- <CardTitle>Card with Shadow</CardTitle>
374
- <CardDescription>Subtle elevation effect</CardDescription>
375
- </CardHeader>
376
- <CardContent>
377
- <p className="text-sm">
378
- Use shadow="default" when you need elevation to make cards stand out.
379
- </p>
380
- </CardContent>
381
- </Card>
382
- ```
383
-
384
- **Uso**: Usa cuando necesites que cards individuales se destaquen o floten sobre el contenido de fondo.
385
-
386
- ### Combinando con Variantes de Color
387
-
388
- La prop `shadow` funciona con todas las variantes de color.
389
-
390
- ```tsx
391
- {/* Flat colored cards */}
392
- <Card variant="primary" shadow="none" className="w-[350px]">
393
- <CardHeader>
394
- <CardTitle>Flat Primary</CardTitle>
395
- <CardDescription>Primary color without shadow</CardDescription>
396
- </CardHeader>
397
- <CardContent>
398
- <p className="text-sm">
399
- Combines color variant with flat design for modern appearance.
400
- </p>
401
- </CardContent>
402
- </Card>
403
-
404
- {/* Elevated colored cards */}
405
- <Card variant="success" shadow="default" className="w-[350px]">
406
- <CardHeader>
407
- <CardTitle>Elevated Success</CardTitle>
408
- <CardDescription>Success color with shadow</CardDescription>
409
- </CardHeader>
410
- <CardContent>
411
- <p className="text-sm">
412
- Shadow adds depth to colored variants for emphasis.
413
- </p>
414
- </CardContent>
415
- </Card>
416
- ```
417
-
418
- **Nota**: Experimenta con `shadow="none"` en grids de cards o layouts densos para un look más limpio.
419
-
420
- ## Variantes de Borde
421
-
422
- El Card ofrece dos opciones de borde a través de la prop `border`:
423
-
424
- ### Con Borde (Default)
425
-
426
- Por defecto, las cards tienen un borde visible que define claramente sus límites:
427
-
428
- ```tsx
429
- <Card border="default" variant="primary">
430
- <CardHeader>
431
- <CardTitle>Card con Borde</CardTitle>
432
- <CardDescription>Borde visible para definición clara</CardDescription>
433
- </CardHeader>
434
- <CardContent>
435
- <p className="text-sm">
436
- El borde ayuda a separar la card del fondo y de otros elementos.
437
- </p>
438
- </CardContent>
439
- </Card>
440
- ```
441
-
442
- ### Sin Borde
443
-
444
- Usa `border="transparent"` para ocultar el borde mientras mantienes el espaciado:
445
-
446
- ```tsx
447
- <Card border="transparent" variant="primary">
448
- <CardHeader>
449
- <CardTitle>Card sin Borde</CardTitle>
450
- <CardDescription>Diseño más limpio y minimalista</CardDescription>
451
- </CardHeader>
452
- <CardContent>
453
- <p className="text-sm">
454
- Sin borde para un look más integrado con el fondo.
455
- </p>
456
- </CardContent>
457
- </Card>
458
- ```
459
-
460
- **Nota**: `border="transparent"` mantiene el espacio del borde en el layout, a diferencia de removerlo completamente. Esto asegura consistencia en el espaciado.
461
-
462
- ## Patrones Avanzados
463
-
464
- ### Formulario de Login
465
-
466
- Card completa con form, inputs y múltiples acciones.
467
-
468
- ```tsx
469
- import { Input } from "@adamosuiteservices/ui/input";
470
- import { Label } from "@adamosuiteservices/ui/label";
471
-
472
- <Card className="w-full max-w-sm">
473
- <CardHeader>
474
- <CardTitle>Login to your account</CardTitle>
475
- <CardDescription>Enter your email below to login</CardDescription>
476
- <CardAction>
477
- <Button variant="link">Sign Up</Button>
478
- </CardAction>
479
- </CardHeader>
480
- <CardContent>
481
- <form>
482
- <div className="flex flex-col gap-6">
483
- <div className="grid gap-2">
484
- <Label htmlFor="email">Email</Label>
485
- <Input id="email" type="email" placeholder="m@example.com" required />
486
- </div>
487
- <div className="grid gap-2">
488
- <div className="flex items-center">
489
- <Label htmlFor="password">Password</Label>
490
- <a
491
- href="#"
492
- className="ml-auto text-sm underline-offset-4 hover:underline"
493
- >
494
- Forgot password?
495
- </a>
496
- </div>
497
- <Input id="password" type="password" required />
498
- </div>
499
- </div>
500
- </form>
501
- </CardContent>
502
- <CardFooter className="flex-col gap-2">
503
- <Button type="submit" className="w-full">
504
- Login
505
- </Button>
506
- <Button variant="outline" className="w-full">
507
- Login with Google
508
- </Button>
509
- </CardFooter>
510
- </Card>;
511
- ```
512
-
513
- ### Perfil de Usuario
514
-
515
- Card con avatar, stats y acciones múltiples.
516
-
517
- ```tsx
518
- import { Avatar } from "@adamosuiteservices/ui/avatar";
519
- import { Icon } from "@adamosuiteservices/ui/icon";
520
-
521
- <Card className="w-[380px]">
522
- <CardHeader>
523
- <div className="flex items-center space-x-4">
524
- <Avatar className="h-12 w-12">
525
- <Icon symbol="person" />
526
- </Avatar>
527
- <div>
528
- <CardTitle>Sofia Davis</CardTitle>
529
- <CardDescription>Product Designer</CardDescription>
530
- </div>
531
- </div>
532
- <CardAction>
533
- <Button variant="outline" size="sm">
534
- Follow
535
- </Button>
536
- </CardAction>
537
- </CardHeader>
538
- <CardContent>
539
- <div className="text-sm text-muted-foreground">
540
- Passionate about creating beautiful user experiences.
541
- </div>
542
- </CardContent>
543
- <CardFooter className="flex justify-between">
544
- <div className="flex space-x-4 text-sm text-muted-foreground">
545
- <div className="flex items-center">
546
- <Icon symbol="favorite" className="mr-1 text-sm" />
547
- 256
548
- </div>
549
- <div className="flex items-center">
550
- <Icon symbol="star" className="mr-1 text-sm" />
551
- 98
552
- </div>
553
- </div>
554
- <div className="flex space-x-1">
555
- <Button variant="ghost" size="sm">
556
- <Icon symbol="share" />
557
- </Button>
558
- <Button variant="ghost" size="sm">
559
- <Icon symbol="open_in_new" />
560
- </Button>
561
- </div>
562
- </CardFooter>
563
- </Card>;
564
- ```
565
-
566
- ### Card de Producto
567
-
568
- E-commerce card con imagen, badge, precio y acciones.
569
-
570
- ```tsx
571
- import { Badge } from "@adamosuiteservices/ui/badge";
572
- import { Icon } from "@adamosuiteservices/ui/icon";
573
-
574
- <Card className="w-[350px]">
575
- <CardHeader>
576
- <div className="aspect-square rounded-md bg-muted"></div>
577
- </CardHeader>
578
- <CardContent>
579
- <div className="space-y-2">
580
- <Badge variant="secondary">Electronics</Badge>
581
- <CardTitle>Wireless Headphones</CardTitle>
582
- <CardDescription>
583
- Premium wireless headphones with noise cancellation.
584
- </CardDescription>
585
- <div className="flex items-center justify-between">
586
- <div className="text-2xl font-bold">$299.99</div>
587
- <div className="flex items-center text-sm text-muted-foreground">
588
- <Icon symbol="star" className="mr-1 text-lg fill-current" />
589
- 4.5 (128)
590
- </div>
591
- </div>
592
- </div>
593
- </CardContent>
594
- <CardFooter className="flex gap-2">
595
- <Button className="flex-1">
596
- <Icon symbol="credit_card" />
597
- Add to Cart
598
- </Button>
599
- <Button variant="outline" size="sm">
600
- <Icon symbol="favorite" />
601
- </Button>
602
- </CardFooter>
603
- </Card>;
604
- ```
605
-
606
- ### Stats Cards (Dashboard)
607
-
608
- Grid de cards para métricas con iconos y tendencias.
609
-
610
- ```tsx
611
- import { Icon } from "@adamosuiteservices/ui/icon";
612
-
613
- <div className="grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-4">
614
- <Card>
615
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
616
- <CardTitle className="text-sm font-medium">Total Revenue</CardTitle>
617
- <Icon symbol="payments" className="text-lg text-muted-foreground" />
618
- </CardHeader>
619
- <CardContent>
620
- <div className="text-2xl font-bold">$45,231.89</div>
621
- <p className="text-xs text-muted-foreground">+20.1% from last month</p>
622
- </CardContent>
623
- </Card>
624
-
625
- <Card>
626
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
627
- <CardTitle className="text-sm font-medium">Subscriptions</CardTitle>
628
- <Icon symbol="person" className="text-lg text-muted-foreground" />
629
- </CardHeader>
630
- <CardContent>
631
- <div className="text-2xl font-bold">+2350</div>
632
- <p className="text-xs text-muted-foreground">+180.1% from last month</p>
633
- </CardContent>
634
- </Card>
635
-
636
- <Card>
637
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
638
- <CardTitle className="text-sm font-medium">Sales</CardTitle>
639
- <Icon symbol="credit_card" className="text-lg text-muted-foreground" />
640
- </CardHeader>
641
- <CardContent>
642
- <div className="text-2xl font-bold">+12,234</div>
643
- <p className="text-xs text-muted-foreground">+19% from last month</p>
644
- </CardContent>
645
- </Card>
646
-
647
- <Card>
648
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
649
- <CardTitle className="text-sm font-medium">Active Now</CardTitle>
650
- <Icon symbol="person" className="text-lg text-muted-foreground" />
651
- </CardHeader>
652
- <CardContent>
653
- <div className="text-2xl font-bold">+573</div>
654
- <p className="text-xs text-muted-foreground">+201 since last hour</p>
655
- </CardContent>
656
- </Card>
657
- </div>;
658
- ```
659
-
660
- ### Card de Notificaciones
661
-
662
- Lista de notificaciones con items y acción de marcar leído.
663
-
664
- ```tsx
665
- import { Icon } from "@adamosuiteservices/ui/icon";
666
-
667
- <Card className="w-[380px]">
668
- <CardHeader>
669
- <CardTitle>Notifications</CardTitle>
670
- <CardDescription>You have 3 unread messages.</CardDescription>
671
- </CardHeader>
672
- <CardContent className="grid gap-4">
673
- <div className="flex items-center space-x-4 rounded-md border p-4">
674
- <Icon symbol="notifications" className="text-lg" />
675
- <div className="flex-1 space-y-1">
676
- <p className="text-sm font-medium leading-none">Push Notifications</p>
677
- <p className="text-sm text-muted-foreground">
678
- Send notifications to device.
679
- </p>
680
- </div>
681
- </div>
682
- <div className="flex items-center space-x-4 rounded-md border p-4">
683
- <Icon symbol="mail" className="text-lg" />
684
- <div className="flex-1 space-y-1">
685
- <p className="text-sm font-medium leading-none">Email Notifications</p>
686
- <p className="text-sm text-muted-foreground">
687
- Send notifications to email.
688
- </p>
689
- </div>
690
- </div>
691
- </CardContent>
692
- <CardFooter>
693
- <Button className="w-full">
694
- <Icon symbol="check" />
695
- Mark all as read
696
- </Button>
697
- </CardFooter>
698
- </Card>;
699
- ```
700
-
701
- ### Con Separadores (Border)
702
-
703
- Usa `.border-b` y `.border-t` para separadores visuales.
704
-
705
- ```tsx
706
- <Card className="w-[350px]">
707
- <CardHeader className="border-b">
708
- <CardTitle>Settings</CardTitle>
709
- <CardDescription>Manage your preferences</CardDescription>
710
- </CardHeader>
711
- <CardContent>
712
- <div className="space-y-4">{/* Settings content */}</div>
713
- </CardContent>
714
- <CardFooter className="border-t">
715
- <Button className="w-full">Save Changes</Button>
716
- </CardFooter>
717
- </Card>
718
- ```
719
-
720
- **Nota**: El padding se ajusta automáticamente (`pb-6` en header, `pt-6` en footer).
721
-
722
- ### Grid de Variantes
723
-
724
- Mostrar todas las variantes en una vista comparativa.
725
-
726
- ```tsx
727
- <div className="grid gap-6 grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
728
- <Card variant="default">
729
- <CardHeader>
730
- <CardTitle>Default</CardTitle>
731
- <CardDescription>Standard card</CardDescription>
732
- </CardHeader>
733
- <CardContent>
734
- <p className="text-sm">Standard styling.</p>
735
- </CardContent>
736
- </Card>
737
-
738
- <Card variant="primary">
739
- <CardHeader>
740
- <CardTitle>Primary</CardTitle>
741
- <CardDescription>Important info</CardDescription>
742
- </CardHeader>
743
- <CardContent>
744
- <p className="text-sm">Highlight important content.</p>
745
- </CardContent>
746
- </Card>
747
-
748
- <Card variant="success">
749
- <CardHeader>
750
- <CardTitle>Success</CardTitle>
751
- <CardDescription>Success message</CardDescription>
752
- </CardHeader>
753
- <CardContent>
754
- <p className="text-sm">Successful operations.</p>
755
- </CardContent>
756
- </Card>
757
-
758
- <Card variant="warning">
759
- <CardHeader>
760
- <CardTitle>Warning</CardTitle>
761
- <CardDescription>Caution message</CardDescription>
762
- </CardHeader>
763
- <CardContent>
764
- <p className="text-sm">Important warnings.</p>
765
- </CardContent>
766
- </Card>
767
-
768
- <Card variant="destructive">
769
- <CardHeader>
770
- <CardTitle>Destructive</CardTitle>
771
- <CardDescription>Error or danger</CardDescription>
772
- </CardHeader>
773
- <CardContent>
774
- <p className="text-sm">Errors or destructive actions.</p>
775
- </CardContent>
776
- </Card>
777
-
778
- <Card variant="muted">
779
- <CardHeader>
780
- <CardTitle>Muted</CardTitle>
781
- <CardDescription>Secondary info</CardDescription>
782
- </CardHeader>
783
- <CardContent>
784
- <p className="text-sm">Less important information.</p>
785
- </CardContent>
786
- </Card>
787
- </div>
788
- ```
789
-
790
- ### Header con Layout Custom
791
-
792
- Override del grid para layouts específicos.
793
-
794
- ```tsx
795
- {
796
- /* Horizontal layout con custom spacing */
797
- }
798
- <Card className="w-[400px]">
799
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
800
- <CardTitle className="text-sm font-medium">Custom Layout</CardTitle>
801
- <Badge>New</Badge>
802
- </CardHeader>
803
- <CardContent>
804
- <div className="text-2xl font-bold">Content</div>
805
- </CardContent>
806
- </Card>;
807
- ```
808
-
809
- ### Footer con Múltiples Acciones
810
-
811
- Diferentes arreglos de botones.
812
-
813
- ```tsx
814
- {
815
- /* Botones horizontales con gap */
816
- }
817
- <Card>
818
- <CardHeader>
819
- <CardTitle>Confirm Action</CardTitle>
820
- </CardHeader>
821
- <CardContent>
822
- <p>Are you sure?</p>
823
- </CardContent>
824
- <CardFooter className="gap-2">
825
- <Button variant="outline" size="sm">
826
- Cancel
827
- </Button>
828
- <Button size="sm">Confirm</Button>
829
- </CardFooter>
830
- </Card>;
831
-
832
- {
833
- /* Botones apilados verticalmente */
834
- }
835
- <Card>
836
- <CardHeader>
837
- <CardTitle>Choose Option</CardTitle>
838
- </CardHeader>
839
- <CardContent>
840
- <p>Select an action:</p>
841
- </CardContent>
842
- <CardFooter className="flex-col gap-2">
843
- <Button className="w-full">Primary Action</Button>
844
- <Button variant="outline" className="w-full">
845
- Secondary
846
- </Button>
847
- </CardFooter>
848
- </Card>;
849
-
850
- {
851
- /* Acciones distribuidas */
852
- }
853
- <Card>
854
- <CardHeader>
855
- <CardTitle>Actions</CardTitle>
856
- </CardHeader>
857
- <CardContent>
858
- <p>Multiple actions available.</p>
859
- </CardContent>
860
- <CardFooter className="justify-between">
861
- <Button variant="outline" size="sm">
862
- Cancel
863
- </Button>
864
- <div className="flex gap-2">
865
- <Button variant="outline" size="sm">
866
- Save Draft
867
- </Button>
868
- <Button size="sm">Publish</Button>
869
- </div>
870
- </CardFooter>
871
- </Card>;
872
- ```
873
-
874
- ## Casos de Uso Comunes
875
-
876
- ### Authentication Forms
877
-
878
- ```tsx
879
- <Card className="w-full max-w-md">
880
- <CardHeader>
881
- <CardTitle>Create Account</CardTitle>
882
- <CardDescription>Sign up to get started</CardDescription>
883
- </CardHeader>
884
- <CardContent className="space-y-4">
885
- <Input type="text" placeholder="Full Name" />
886
- <Input type="email" placeholder="Email" />
887
- <Input type="password" placeholder="Password" />
888
- </CardContent>
889
- <CardFooter>
890
- <Button className="w-full">Create Account</Button>
891
- </CardFooter>
892
- </Card>
893
- ```
894
-
895
- ### Dashboard Widgets
896
-
897
- ```tsx
898
- <Card>
899
- <CardHeader>
900
- <CardTitle>Recent Activity</CardTitle>
901
- <CardDescription>Your latest actions</CardDescription>
902
- <CardAction>
903
- <Button variant="ghost" size="sm">
904
- View All
905
- </Button>
906
- </CardAction>
907
- </CardHeader>
908
- <CardContent>{/* Activity list */}</CardContent>
909
- </Card>
910
- ```
911
-
912
- ### Settings Panels
913
-
914
- ```tsx
915
- <Card className="border-b">
916
- <CardHeader>
917
- <CardTitle>Account Settings</CardTitle>
918
- <CardDescription>Manage your account preferences</CardDescription>
919
- </CardHeader>
920
- <CardContent className="space-y-4">{/* Settings options */}</CardContent>
921
- <CardFooter className="border-t">
922
- <Button>Save Changes</Button>
923
- </CardFooter>
924
- </Card>
925
- ```
926
-
927
- ### Pricing Cards
928
-
929
- ```tsx
930
- <div className="grid gap-4 md:grid-cols-3">
931
- <Card>
932
- <CardHeader>
933
- <CardTitle>Basic</CardTitle>
934
- <CardDescription>For individuals</CardDescription>
935
- </CardHeader>
936
- <CardContent>
937
- <div className="text-3xl font-bold">$9/mo</div>
938
- <ul className="mt-4 space-y-2 text-sm">
939
- <li>✓ Feature 1</li>
940
- <li>✓ Feature 2</li>
941
- </ul>
942
- </CardContent>
943
- <CardFooter>
944
- <Button variant="outline" className="w-full">
945
- Choose Plan
946
- </Button>
947
- </CardFooter>
948
- </Card>
949
- {/* More pricing tiers */}
950
- </div>
951
- ```
952
-
953
- ### Status/Alert Cards
954
-
955
- ```tsx
956
- <Card variant="warning">
957
- <CardHeader>
958
- <CardTitle>Action Required</CardTitle>
959
- <CardDescription>Your subscription expires soon</CardDescription>
960
- </CardHeader>
961
- <CardContent>
962
- <p className="text-sm">
963
- Renew your subscription to continue accessing premium features.
964
- </p>
965
- </CardContent>
966
- <CardFooter>
967
- <Button>Renew Now</Button>
968
- </CardFooter>
969
- </Card>
970
- ```
971
-
972
- ## Mejores Prácticas
973
-
974
- ### Usa Anchos Fijos para Consistencia
975
-
976
- ```tsx
977
- {
978
- /* ✅ Correcto - Ancho consistente */
979
- }
980
- <Card className="w-[350px]">
981
- <CardContent>Consistent width</CardContent>
982
- </Card>;
983
-
984
- {
985
- /* ✅ También correcto - max-w para responsive */
986
- }
987
- <Card className="w-full max-w-md">
988
- <CardContent>Responsive width</CardContent>
989
- </Card>;
990
-
991
- {
992
- /* ❌ Evitar - Sin ancho puede expandirse inesperadamente */
993
- }
994
- <Card>
995
- <CardContent>No width constraint</CardContent>
996
- </Card>;
997
- ```
998
-
999
- ### Variantes Semánticas
1000
-
1001
- ```tsx
1002
- {/* ✅ Correcto - Variante según significado */}
1003
- <Card variant="success">
1004
- <CardContent>Payment processed!</CardContent>
1005
- </Card>
1006
-
1007
- <Card variant="destructive">
1008
- <CardContent>Error occurred</CardContent>
1009
- </Card>
1010
-
1011
- {/* ❌ Incorrecto - Variante no semántica */}
1012
- <Card variant="success">
1013
- <CardContent>Error occurred</CardContent> {/* Confuso */}
1014
- </Card>
1015
- ```
1016
-
1017
- ### Uso de Sombras y Bordes
1018
-
1019
- ```tsx
1020
- {/* ✅ Correcto - Default sin sombra para diseño plano */}
1021
- <Card>
1022
- <CardContent>Clean, flat design</CardContent>
1023
- </Card>
1024
-
1025
- {/* ✅ Correcto - Shadow para cards flotantes o destacadas */}
1026
- <Card shadow="default">
1027
- <CardContent>Elevated card with depth</CardContent>
1028
- </Card>
1029
-
1030
- {/* ✅ Correcto - Border transparent para integración con fondo */}
1031
- <Card border="transparent" variant="muted">
1032
- <CardContent>Blends with background</CardContent>
1033
- </Card>
1034
-
1035
- {/* ⚠️ Evitar - Shadow sin propósito específico */}
1036
- <Card shadow="default">
1037
- <CardContent>Unnecessary elevation</CardContent>
1038
- </Card>
1039
- ```
1040
-
1041
- **Recomendaciones**:
1042
-
1043
- - Usa `shadow="none"` (default) para layouts densos y diseños modernos
1044
- - Aplica `shadow="default"` para destacar cards importantes o flotantes
1045
- - Usa `border="transparent"` en cards sobre fondos de color similar
1046
- - Mantén `border="default"` para máxima claridad y separación
1047
-
1048
- ### Estructura de Header Completa
1049
-
1050
- ```tsx
1051
- {
1052
- /* ✅ Correcto - Título + Descripción */
1053
- }
1054
- <CardHeader>
1055
- <CardTitle>Title</CardTitle>
1056
- <CardDescription>Description</CardDescription>
1057
- </CardHeader>;
1058
-
1059
- {
1060
- /* ⚠️ Aceptable - Solo título */
1061
- }
1062
- <CardHeader>
1063
- <CardTitle>Title Only</CardTitle>
1064
- </CardHeader>;
1065
-
1066
- {
1067
- /* ❌ Evitar - Solo descripción sin título */
1068
- }
1069
- <CardHeader>
1070
- <CardDescription>No title</CardDescription>
1071
- </CardHeader>;
1072
- ```
1073
-
1074
- ### CardAction Solo en CardHeader
1075
-
1076
- ```tsx
1077
- {
1078
- /* ✅ Correcto - CardAction dentro de CardHeader */
1079
- }
1080
- <CardHeader>
1081
- <CardTitle>Title</CardTitle>
1082
- <CardDescription>Description</CardDescription>
1083
- <CardAction>
1084
- <Button size="sm">Action</Button>
1085
- </CardAction>
1086
- </CardHeader>;
1087
-
1088
- {
1089
- /* ❌ Incorrecto - CardAction fuera de CardHeader */
1090
- }
1091
- <Card>
1092
- <CardTitle>Title</CardTitle>
1093
- <CardAction>
1094
- <Button>Won't position correctly</Button>
1095
- </CardAction>
1096
- </Card>;
1097
- ```
1098
-
1099
- ### Footer Flex para Múltiples Botones
1100
-
1101
- ```tsx
1102
- {
1103
- /* ✅ Correcto - Gap entre botones */
1104
- }
1105
- <CardFooter className="gap-2">
1106
- <Button variant="outline">Cancel</Button>
1107
- <Button>Confirm</Button>
1108
- </CardFooter>;
1109
-
1110
- {
1111
- /* ✅ Correcto - Full width individual */
1112
- }
1113
- <CardFooter className="flex-col gap-2">
1114
- <Button className="w-full">Primary</Button>
1115
- <Button variant="outline" className="w-full">
1116
- Secondary
1117
- </Button>
1118
- </CardFooter>;
1119
-
1120
- {
1121
- /* ❌ Evitar - Sin gap entre botones */
1122
- }
1123
- <CardFooter>
1124
- <Button>Button1</Button>
1125
- <Button>Button2</Button> {/* Se pegan */}
1126
- </CardFooter>;
1127
- ```
1128
-
1129
- ### Bordes Opcionales
1130
-
1131
- ```tsx
1132
- {
1133
- /* ✅ Correcto - Border con padding automático */
1134
- }
1135
- <Card>
1136
- <CardHeader className="border-b">
1137
- <CardTitle>Title</CardTitle>
1138
- </CardHeader>
1139
- <CardContent>Content</CardContent>
1140
- <CardFooter className="border-t">
1141
- <Button>Action</Button>
1142
- </CardFooter>
1143
- </Card>;
1144
-
1145
- {
1146
- /* ❌ Evitar - Border sin la clase en header/footer */
1147
- }
1148
- <Card className="border-b">
1149
- {" "}
1150
- {/* No aplica padding correcto */}
1151
- <CardHeader>
1152
- <CardTitle>Title</CardTitle>
1153
- </CardHeader>
1154
- </Card>;
1155
- ```
1156
-
1157
- ### Grid en Stats Cards
1158
-
1159
- ```tsx
1160
- {
1161
- /* ✅ Correcto - Override spacing cuando es necesario */
1162
- }
1163
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
1164
- <CardTitle className="text-sm font-medium">Stat</CardTitle>
1165
- <Icon className="h-4 w-4 text-muted-foreground" />
1166
- </CardHeader>;
1167
-
1168
- {
1169
- /* ❌ Incorrecto - Usar grid default con layout horizontal */
1170
- }
1171
- <CardHeader className="flex-row">
1172
- {" "}
1173
- {/* Grid sigue activo */}
1174
- <CardTitle>Stat</CardTitle>
1175
- <Icon />
1176
- </CardHeader>;
1177
- ```
1178
-
1179
- ### Uso de Shadow
1180
-
1181
- ```tsx
1182
- {/* ✅ Correcto - Shadow para cards individuales o destacadas */}
1183
- <Card shadow="default" className="w-[350px]">
1184
- <CardContent>
1185
- Stands out with subtle elevation
1186
- </CardContent>
1187
- </Card>
1188
-
1189
- {/* ✅ Correcto - Sin shadow para grids densos */}
1190
- <div className="grid gap-4 md:grid-cols-3">
1191
- <Card shadow="none">
1192
- <CardContent>Flat design in dense layout</CardContent>
1193
- </Card>
1194
- <Card shadow="none">
1195
- <CardContent>Flat design in dense layout</CardContent>
1196
- </Card>
1197
- <Card shadow="none">
1198
- <CardContent>Flat design in dense layout</CardContent>
1199
- </Card>
1200
- </div>
1201
-
1202
- {/* ✅ Correcto - Sin shadow cuando ya hay separación visual */}
1203
- <div className="space-y-4">
1204
- <Card shadow="none">
1205
- <CardContent>Spacing provides separation</CardContent>
1206
- </Card>
1207
- <Card shadow="none">
1208
- <CardContent>No shadow needed here</CardContent>
1209
- </Card>
1210
- </div>
1211
-
1212
- {/* ⚠️ Considerar - Mucha sombra en layouts densos */}
1213
- <div className="grid gap-2 md:grid-cols-4">
1214
- <Card shadow="default">...</Card> {/* Puede verse pesado */}
1215
- <Card shadow="default">...</Card>
1216
- <Card shadow="default">...</Card>
1217
- <Card shadow="default">...</Card>
1218
- </div>
1219
- ```
1220
-
1221
- ## Notas de Implementación
1222
-
1223
- - **Basado en CVA**: Usa `class-variance-authority` para variantes de color, sombra y borde
1224
- - **Data Slots**: Cada componente tiene `data-slot` para CSS targeting específico (`data-slot="card"`, `data-slot="card-header"`, etc.)
1225
- - **Grid Automático**: CardHeader usa `has-data-[slot=card-action]:grid-cols-[1fr_auto]` para detectar CardAction y ajustar layout
1226
- - **Container Queries**: CardHeader tiene `@container/card-header` para responsive interno (requiere Tailwind CSS container queries)
1227
- - **Spacing Consistente**: `gap-6` entre secciones (header, content, footer), `px-6` horizontal en todas las secciones
1228
- - **Padding Condicional**: `.border-b` y `.border-t` triggers automáticos para `pb-6` y `pt-6` respectivamente
1229
- - **Variantes de Color**: Cada variante ajusta `bg-*-50` y `text-*-foreground`, con ajustes para iconos SVG (`[&>svg]:text-current`)
1230
- - **Variantes de Sombra**: Dos opciones (`default` con `shadow-xs`, `none` sin sombra por defecto) para control de elevación
1231
- - **Variantes de Borde**: Dos opciones (`default` con borde visible, `transparent` con borde invisible pero mantiene espaciado)
1232
- - **Rounded Corners**: `rounded-3xl` por defecto para esquinas suaves
1233
- - **Flex Column**: Card root usa `flex flex-col gap-6` para layout vertical automático
1234
-
1235
- ## Accesibilidad
1236
-
1237
- ### Estructura Semántica
1238
-
1239
- Cards usan `<div>` por defecto, pero considera añadir roles ARIA cuando sea apropiado.
1240
-
1241
- ```tsx
1242
- {
1243
- /* Para cards interactivas */
1244
- }
1245
- <Card role="article" aria-labelledby="card-title">
1246
- <CardHeader>
1247
- <CardTitle id="card-title">Article Title</CardTitle>
1248
- </CardHeader>
1249
- <CardContent>Content</CardContent>
1250
- </Card>;
1251
-
1252
- {
1253
- /* Para cards clickeables */
1254
- }
1255
- <Card
1256
- role="button"
1257
- tabIndex={0}
1258
- onClick={handleClick}
1259
- onKeyDown={(e) => e.key === "Enter" && handleClick()}
1260
- >
1261
- <CardContent>Clickable card</CardContent>
1262
- </Card>;
1263
- ```
1264
-
1265
- ### Labels para CardAction
1266
-
1267
- ```tsx
1268
- {
1269
- /* ✅ Correcto - aria-label descriptiva */
1270
- }
1271
- <CardAction>
1272
- <Button variant="outline" size="sm" aria-label="More options">
1273
- <MoreHorizontalIcon />
1274
- </Button>
1275
- </CardAction>;
1276
-
1277
- {
1278
- /* ❌ Incorrecto - Sin label para icono solo */
1279
- }
1280
- <CardAction>
1281
- <Button variant="outline" size="sm">
1282
- <MoreHorizontalIcon />
1283
- </Button>
1284
- </CardAction>;
1285
- ```
1286
-
1287
- ### Formularios Accesibles
1288
-
1289
- ```tsx
1290
- {
1291
- /* ✅ Correcto - Labels asociadas */
1292
- }
1293
- <CardContent>
1294
- <div className="space-y-4">
1295
- <div className="grid gap-2">
1296
- <Label htmlFor="email">Email</Label>
1297
- <Input id="email" type="email" />
1298
- </div>
1299
- </div>
1300
- </CardContent>;
1301
- ```
1302
-
1303
- ### Focus Management
1304
-
1305
- Cards no son focuseables por defecto. Si necesitas interactividad:
1306
-
1307
- ```tsx
1308
- {
1309
- /* Para cards clickeables */
1310
- }
1311
- <Card
1312
- tabIndex={0}
1313
- role="button"
1314
- className="cursor-pointer hover:shadow-md transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
1315
- onClick={handleClick}
1316
- >
1317
- <CardContent>Interactive card</CardContent>
1318
- </Card>;
1319
- ```
1320
-
1321
- ## Troubleshooting
1322
-
1323
- ### CardAction No Se Alinea a la Derecha
1324
-
1325
- **Problema**: CardAction no aparece en la posición correcta.
1326
-
1327
- **Solución**:
1328
-
1329
- ```tsx
1330
- // ❌ Problema - CardAction fuera de CardHeader
1331
- <Card>
1332
- <CardTitle>Title</CardTitle>
1333
- <CardAction>
1334
- <Button>Action</Button>
1335
- </CardAction>
1336
- </Card>
1337
-
1338
- // ✅ Solución - CardAction dentro de CardHeader
1339
- <Card>
1340
- <CardHeader>
1341
- <CardTitle>Title</CardTitle>
1342
- <CardDescription>Description</CardDescription>
1343
- <CardAction>
1344
- <Button>Action</Button>
1345
- </CardAction>
1346
- </CardHeader>
1347
- </Card>
1348
- ```
1349
-
1350
- ### Gap Excesivo entre Secciones
1351
-
1352
- **Problema**: Mucho espacio entre header/content/footer.
1353
-
1354
- **Solución**:
1355
-
1356
- ```tsx
1357
- // ✅ El gap-6 es intencional, pero puedes reducirlo
1358
- <Card className="gap-4"> {/* Override gap-6 */}
1359
- <CardHeader>...</CardHeader>
1360
- <CardContent>...</CardContent>
1361
- </Card>
1362
-
1363
- // O eliminar gap completamente
1364
- <Card className="gap-0">
1365
- <CardHeader>...</CardHeader>
1366
- <CardContent>...</CardContent>
1367
- </Card>
1368
- ```
1369
-
1370
- ### Bordes No Muestran Padding
1371
-
1372
- **Problema**: `.border-b` o `.border-t` no agregan padding.
1373
-
1374
- **Solución**:
1375
-
1376
- ```tsx
1377
- // ❌ Problema - Border en elemento incorrecto
1378
- <Card className="border-b">
1379
- <CardHeader>...</CardHeader>
1380
- </Card>
1381
-
1382
- // ✅ Solución - Border en CardHeader o CardFooter
1383
- <Card>
1384
- <CardHeader className="border-b">...</CardHeader>
1385
- <CardContent>...</CardContent>
1386
- <CardFooter className="border-t">...</CardFooter>
1387
- </Card>
1388
- ```
1389
-
1390
- ### Variante No Cambia Color
1391
-
1392
- **Problema**: Variante primary/success/etc no aplica colores.
1393
-
1394
- **Solución**:
1395
-
1396
- ```tsx
1397
- // ✅ Verifica que la prop sea en Card root
1398
- <Card variant="primary"> {/* Correcto */}
1399
- <CardHeader>...</CardHeader>
1400
- </Card>
1401
-
1402
- // ❌ No funciona en subcomponentes
1403
- <Card>
1404
- <CardHeader variant="primary"> {/* No existe esta prop */}
1405
- ...
1406
- </CardHeader>
1407
- </Card>
1408
- ```
1409
-
1410
- ### Stats Cards con Layout Incorrecto
1411
-
1412
- **Problema**: Íconos y títulos no se alinean horizontalmente.
1413
-
1414
- **Solución**:
1415
-
1416
- ```tsx
1417
- // ✅ Override grid con flex
1418
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
1419
- <CardTitle className="text-sm font-medium">Revenue</CardTitle>
1420
- <DollarSignIcon className="h-4 w-4" />
1421
- </CardHeader>
1422
- ```
1423
-
1424
- ### Footer Buttons No Se Distribuyen
1425
-
1426
- **Problema**: Botones en footer se pegan sin espacio.
1427
-
1428
- **Solución**:
1429
-
1430
- ```tsx
1431
- // ❌ Problema - Sin gap
1432
- <CardFooter>
1433
- <Button>Cancel</Button>
1434
- <Button>Confirm</Button>
1435
- </CardFooter>
1436
-
1437
- // ✅ Solución - Añade gap
1438
- <CardFooter className="gap-2">
1439
- <Button>Cancel</Button>
1440
- <Button>Confirm</Button>
1441
- </CardFooter>
1442
-
1443
- // ✅ O usa justify-between
1444
- <CardFooter className="justify-between">
1445
- <Button>Cancel</Button>
1446
- <Button>Confirm</Button>
1447
- </CardFooter>
1448
- ```
1449
-
1450
- ## Referencias
1451
-
1452
- - **CVA (Class Variance Authority)**: https://cva.style/docs
1453
- - **shadcn/ui Card**: https://ui.shadcn.com/docs/components/card
1454
- - **Tailwind Container Queries**: https://tailwindcss.com/docs/hover-focus-and-other-states#container-queries
1455
- - **ARIA Article Role**: https://www.w3.org/TR/wai-aria-1.2/#article
1
+ # Card
2
+
3
+ Contenedor versátil con bordes redondeados, padding, sombra y borde configurables para agrupar contenido relacionado. Incluye 6 variantes de color, control de elevación y bordes, y un sistema de layout con grid automático para headers con acciones.
4
+
5
+ ## Características Principales
6
+
7
+ - **6 variantes de color**: Default, Primary, Muted, Success, Warning, Destructive
8
+ - **2 variantes de sombra**: Default (con elevación) y None (diseño plano, por defecto)
9
+ - **2 variantes de borde**: Default (visible) y Transparent (invisible pero mantiene espacio)
10
+ - **Composición modular**: 6 subcomponentes (Card, CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardFooter)
11
+ - **Grid automático en header**: Detecta `CardAction` y ajusta layout automáticamente con `has-data-[slot=card-action]:grid-cols-[1fr_auto]`
12
+ - **Container queries**: CardHeader usa `@container/card-header` para layouts responsive
13
+ - **Spacing flexible**: `gap-6` entre secciones principales, spacing auto en header/footer con bordes
14
+ - **Bordes opcionales**: Clases `.border-b` y `.border-t` añaden separadores con padding automático
15
+ - **Data slots**: Cada subcomponente tiene `data-slot` para targeting CSS específico
16
+ - **Integración con otros componentes**: Background transparente para Calendar/otros componentes anidados
17
+
18
+ ## Importación
19
+
20
+ ```tsx
21
+ import {
22
+ Card,
23
+ CardHeader,
24
+ CardTitle,
25
+ CardDescription,
26
+ CardAction,
27
+ CardContent,
28
+ CardFooter,
29
+ } from "@adamosuiteservices/ui/card";
30
+ ```
31
+
32
+ ## Uso Básico
33
+
34
+ ### Card Completa
35
+
36
+ Estructura típica con todos los componentes.
37
+
38
+ ```tsx
39
+ import {
40
+ Card,
41
+ CardHeader,
42
+ CardTitle,
43
+ CardDescription,
44
+ CardContent,
45
+ CardFooter,
46
+ } from "@adamosuiteservices/ui/card";
47
+ import { Button } from "@adamosuiteservices/ui/button";
48
+
49
+ <Card className="w-[350px]">
50
+ <CardHeader>
51
+ <CardTitle>Card Title</CardTitle>
52
+ <CardDescription>Card Description</CardDescription>
53
+ </CardHeader>
54
+ <CardContent>
55
+ <p>Card Content goes here.</p>
56
+ </CardContent>
57
+ <CardFooter>
58
+ <Button>Action</Button>
59
+ </CardFooter>
60
+ </Card>;
61
+ ```
62
+
63
+ ### Card Simple (Solo Contenido)
64
+
65
+ Para contenedores minimalistas sin header/footer.
66
+
67
+ ```tsx
68
+ <Card className="w-[350px]">
69
+ <CardContent>
70
+ <h3 className="text-lg font-semibold">Simple Card</h3>
71
+ <p className="text-sm text-muted-foreground">
72
+ This is a simple card with just content.
73
+ </p>
74
+ </CardContent>
75
+ </Card>
76
+ ```
77
+
78
+ ### Con Acción en Header
79
+
80
+ Botón de acción que se alinea automáticamente a la derecha.
81
+
82
+ ```tsx
83
+ import { Icon } from "@adamosuiteservices/ui/icon";
84
+
85
+ <Card className="w-[400px]">
86
+ <CardHeader>
87
+ <CardTitle>Notifications</CardTitle>
88
+ <CardDescription>You have 3 unread messages.</CardDescription>
89
+ <CardAction>
90
+ <Button variant="outline" size="sm">
91
+ <Icon symbol="more_horiz" />
92
+ </Button>
93
+ </CardAction>
94
+ </CardHeader>
95
+ <CardContent>{/* Notification items */}</CardContent>
96
+ </Card>;
97
+ ```
98
+
99
+ **Nota**: El grid se ajusta automáticamente cuando hay `CardAction`.
100
+
101
+ ## Componentes
102
+
103
+ ### Card
104
+
105
+ Contenedor principal de la card.
106
+
107
+ #### Props
108
+
109
+ | Prop | Tipo | Default | Descripción |
110
+ | ----------- | ------------------------------------------------------------------------------ | ----------- | ---------------------------------------------------------- |
111
+ | `variant` | `"default" \| "primary" \| "muted" \| "success" \| "warning" \| "destructive"` | `"default"` | Variante de color de fondo |
112
+ | `shadow` | `"default" \| "none"` | `"none"` | Control de sombra (none=flat, default=elevación) |
113
+ | `border` | `"default" \| "transparent"` | `"default"` | Control de borde (default=visible, transparent=invisible) |
114
+ | `className` | `string` | - | Clases CSS adicionales |
115
+ | `children` | `ReactNode` | - | Contenido de la card |
116
+
117
+ ### CardHeader
118
+
119
+ Sección de encabezado con grid automático para título, descripción y acción.
120
+
121
+ #### Props
122
+
123
+ | Prop | Tipo | Descripción |
124
+ | ----------- | ----------- | ---------------------------------------------------------- |
125
+ | `className` | `string` | Clases CSS adicionales |
126
+ | `children` | `ReactNode` | Usualmente contiene CardTitle, CardDescription, CardAction |
127
+
128
+ **Características**:
129
+
130
+ - Grid automático: 2 filas (`grid-rows-[auto_auto]`)
131
+ - Columnas adaptativas: 1 columna por defecto, 2 cuando hay `CardAction` (`has-data-[slot=card-action]:grid-cols-[1fr_auto]`)
132
+ - Container query: `@container/card-header` para responsive interno
133
+ - Padding inferior automático: `[.border-b]:pb-6` cuando se agrega clase `.border-b`
134
+
135
+ ### CardTitle
136
+
137
+ Título principal de la card.
138
+
139
+ #### Props
140
+
141
+ | Prop | Tipo | Descripción |
142
+ | ----------- | ----------- | ---------------------- |
143
+ | `className` | `string` | Clases CSS adicionales |
144
+ | `children` | `ReactNode` | Texto del título |
145
+
146
+ **Estilos default**: `leading-none font-semibold`
147
+
148
+ ### CardDescription
149
+
150
+ Descripción o subtítulo de la card.
151
+
152
+ #### Props
153
+
154
+ | Prop | Tipo | Descripción |
155
+ | ----------- | ----------- | ---------------------- |
156
+ | `className` | `string` | Clases CSS adicionales |
157
+ | `children` | `ReactNode` | Texto de descripción |
158
+
159
+ **Estilos default**: `text-muted-foreground text-sm`
160
+
161
+ ### CardAction
162
+
163
+ Botón o acción alineada a la derecha del header.
164
+
165
+ #### Props
166
+
167
+ | Prop | Tipo | Descripción |
168
+ | ----------- | ----------- | ---------------------- |
169
+ | `className` | `string` | Clases CSS adicionales |
170
+ | `children` | `ReactNode` | Usualmente un Button |
171
+
172
+ **Posicionamiento**:
173
+
174
+ - `col-start-2 row-span-2 row-start-1`: Ocupa columna 2, ambas filas
175
+ - `self-start justify-self-end`: Alineado superior-derecha
176
+
177
+ ### CardContent
178
+
179
+ Contenido principal de la card.
180
+
181
+ #### Props
182
+
183
+ | Prop | Tipo | Descripción |
184
+ | ----------- | ----------- | ---------------------- |
185
+ | `className` | `string` | Clases CSS adicionales |
186
+ | `children` | `ReactNode` | Contenido principal |
187
+
188
+ **Estilos default**: `px-6` (padding horizontal matching header/footer)
189
+
190
+ ### CardFooter
191
+
192
+ Pie de la card para acciones o información adicional.
193
+
194
+ #### Props
195
+
196
+ | Prop | Tipo | Descripción |
197
+ | ----------- | ----------- | ---------------------- |
198
+ | `className` | `string` | Clases CSS adicionales |
199
+ | `children` | `ReactNode` | Usualmente botones |
200
+
201
+ **Estilos default**:
202
+
203
+ - `flex items-center px-6`: Layout flex horizontal centrado
204
+ - `[.border-t]:pt-6`: Padding superior automático con clase `.border-t`
205
+
206
+ ## Variantes
207
+
208
+ ### Default
209
+
210
+ Card estándar con fondo blanco/oscuro según tema.
211
+
212
+ ```tsx
213
+ <Card variant="default" className="w-[350px]">
214
+ <CardHeader>
215
+ <CardTitle>Default Card</CardTitle>
216
+ <CardDescription>Standard card appearance</CardDescription>
217
+ </CardHeader>
218
+ <CardContent>
219
+ <p className="text-sm">Standard styling with default colors.</p>
220
+ </CardContent>
221
+ </Card>
222
+ ```
223
+
224
+ **Colores**: `bg-card text-card-foreground`
225
+
226
+ ### Primary
227
+
228
+ Fondo azul claro para información importante.
229
+
230
+ ```tsx
231
+ <Card variant="primary" className="w-[350px]">
232
+ <CardHeader>
233
+ <CardTitle>Important Information</CardTitle>
234
+ <CardDescription>Please read carefully</CardDescription>
235
+ </CardHeader>
236
+ <CardContent>
237
+ <p className="text-sm">
238
+ This is important information that requires attention.
239
+ </p>
240
+ </CardContent>
241
+ <CardFooter>
242
+ <Button>Acknowledge</Button>
243
+ </CardFooter>
244
+ </Card>
245
+ ```
246
+
247
+ **Colores**: `bg-primary-50` con iconos y texto ajustados
248
+
249
+ ### Success
250
+
251
+ Fondo verde claro para confirmaciones exitosas.
252
+
253
+ ```tsx
254
+ <Card variant="success" className="w-[350px]">
255
+ <CardHeader>
256
+ <CardTitle>Payment Successful</CardTitle>
257
+ <CardDescription>Your transaction completed</CardDescription>
258
+ </CardHeader>
259
+ <CardContent>
260
+ <p className="text-sm">Your payment has been processed successfully.</p>
261
+ </CardContent>
262
+ <CardFooter>
263
+ <Button variant="outline">View Receipt</Button>
264
+ </CardFooter>
265
+ </Card>
266
+ ```
267
+
268
+ **Colores**: `bg-success-50` con texto `text-success/90`
269
+
270
+ ### Warning
271
+
272
+ Fondo naranja/amarillo para advertencias.
273
+
274
+ ```tsx
275
+ <Card variant="warning" className="w-[350px]">
276
+ <CardHeader>
277
+ <CardTitle>Storage Almost Full</CardTitle>
278
+ <CardDescription>You're running out of space</CardDescription>
279
+ </CardHeader>
280
+ <CardContent>
281
+ <p className="text-sm">You've used 95% of storage. Consider upgrading.</p>
282
+ </CardContent>
283
+ <CardFooter className="gap-2">
284
+ <Button variant="outline" size="sm">
285
+ Manage
286
+ </Button>
287
+ <Button size="sm">Upgrade</Button>
288
+ </CardFooter>
289
+ </Card>
290
+ ```
291
+
292
+ **Colores**: `bg-warning-50` con texto `text-warning/90`
293
+
294
+ ### Destructive
295
+
296
+ Fondo rojo claro para acciones destructivas o errores.
297
+
298
+ ```tsx
299
+ <Card variant="destructive" className="w-[350px]">
300
+ <CardHeader>
301
+ <CardTitle>Delete Account</CardTitle>
302
+ <CardDescription>This action cannot be undone</CardDescription>
303
+ </CardHeader>
304
+ <CardContent>
305
+ <p className="text-sm">
306
+ Permanently delete your account? All data will be lost.
307
+ </p>
308
+ </CardContent>
309
+ <CardFooter className="gap-2">
310
+ <Button variant="outline" size="sm">
311
+ Cancel
312
+ </Button>
313
+ <Button variant="destructive" size="sm">
314
+ Delete
315
+ </Button>
316
+ </CardFooter>
317
+ </Card>
318
+ ```
319
+
320
+ **Colores**: `bg-destructive-50` con texto `text-destructive/90`
321
+
322
+ ### Muted
323
+
324
+ Fondo gris claro para información secundaria.
325
+
326
+ ```tsx
327
+ <Card variant="muted" className="w-full">
328
+ <CardHeader>
329
+ <CardTitle>Muted Card</CardTitle>
330
+ <CardDescription>Less prominent information</CardDescription>
331
+ </CardHeader>
332
+ <CardContent>
333
+ <p className="text-sm">
334
+ Information that doesn't require immediate attention.
335
+ </p>
336
+ </CardContent>
337
+ </Card>
338
+ ```
339
+
340
+ **Colores**: `bg-muted` con texto `text-muted/90`
341
+
342
+ ## Variantes de Sombra
343
+
344
+ Controla la elevación de las cards con la prop `shadow`. Por defecto, las cards no tienen sombra (`shadow="none"`).
345
+
346
+ ### Sin Sombra (Default)
347
+
348
+ Card plana sin elevación para diseños limpios y modernos.
349
+
350
+ ```tsx
351
+ <Card className="w-[350px]">
352
+ <CardHeader>
353
+ <CardTitle>Flat Card</CardTitle>
354
+ <CardDescription>No elevation, flat design</CardDescription>
355
+ </CardHeader>
356
+ <CardContent>
357
+ <p className="text-sm">
358
+ Default behavior - perfect for modern, clean layouts and dense grids.
359
+ </p>
360
+ </CardContent>
361
+ </Card>
362
+ ```
363
+
364
+ **Uso**: Default para todas las cards. Ideal para diseños modernos, layouts densos, o cuando las cards ya están visualmente separadas por otros elementos.
365
+
366
+ ### Con Sombra
367
+
368
+ Card con sombra sutil para crear profundidad cuando se necesita énfasis.
369
+
370
+ ```tsx
371
+ <Card shadow="default" className="w-[350px]">
372
+ <CardHeader>
373
+ <CardTitle>Card with Shadow</CardTitle>
374
+ <CardDescription>Subtle elevation effect</CardDescription>
375
+ </CardHeader>
376
+ <CardContent>
377
+ <p className="text-sm">
378
+ Use shadow="default" when you need elevation to make cards stand out.
379
+ </p>
380
+ </CardContent>
381
+ </Card>
382
+ ```
383
+
384
+ **Uso**: Usa cuando necesites que cards individuales se destaquen o floten sobre el contenido de fondo.
385
+
386
+ ### Combinando con Variantes de Color
387
+
388
+ La prop `shadow` funciona con todas las variantes de color.
389
+
390
+ ```tsx
391
+ {/* Flat colored cards */}
392
+ <Card variant="primary" shadow="none" className="w-[350px]">
393
+ <CardHeader>
394
+ <CardTitle>Flat Primary</CardTitle>
395
+ <CardDescription>Primary color without shadow</CardDescription>
396
+ </CardHeader>
397
+ <CardContent>
398
+ <p className="text-sm">
399
+ Combines color variant with flat design for modern appearance.
400
+ </p>
401
+ </CardContent>
402
+ </Card>
403
+
404
+ {/* Elevated colored cards */}
405
+ <Card variant="success" shadow="default" className="w-[350px]">
406
+ <CardHeader>
407
+ <CardTitle>Elevated Success</CardTitle>
408
+ <CardDescription>Success color with shadow</CardDescription>
409
+ </CardHeader>
410
+ <CardContent>
411
+ <p className="text-sm">
412
+ Shadow adds depth to colored variants for emphasis.
413
+ </p>
414
+ </CardContent>
415
+ </Card>
416
+ ```
417
+
418
+ **Nota**: Experimenta con `shadow="none"` en grids de cards o layouts densos para un look más limpio.
419
+
420
+ ## Variantes de Borde
421
+
422
+ El Card ofrece dos opciones de borde a través de la prop `border`:
423
+
424
+ ### Con Borde (Default)
425
+
426
+ Por defecto, las cards tienen un borde visible que define claramente sus límites:
427
+
428
+ ```tsx
429
+ <Card border="default" variant="primary">
430
+ <CardHeader>
431
+ <CardTitle>Card con Borde</CardTitle>
432
+ <CardDescription>Borde visible para definición clara</CardDescription>
433
+ </CardHeader>
434
+ <CardContent>
435
+ <p className="text-sm">
436
+ El borde ayuda a separar la card del fondo y de otros elementos.
437
+ </p>
438
+ </CardContent>
439
+ </Card>
440
+ ```
441
+
442
+ ### Sin Borde
443
+
444
+ Usa `border="transparent"` para ocultar el borde mientras mantienes el espaciado:
445
+
446
+ ```tsx
447
+ <Card border="transparent" variant="primary">
448
+ <CardHeader>
449
+ <CardTitle>Card sin Borde</CardTitle>
450
+ <CardDescription>Diseño más limpio y minimalista</CardDescription>
451
+ </CardHeader>
452
+ <CardContent>
453
+ <p className="text-sm">
454
+ Sin borde para un look más integrado con el fondo.
455
+ </p>
456
+ </CardContent>
457
+ </Card>
458
+ ```
459
+
460
+ **Nota**: `border="transparent"` mantiene el espacio del borde en el layout, a diferencia de removerlo completamente. Esto asegura consistencia en el espaciado.
461
+
462
+ ## Patrones Avanzados
463
+
464
+ ### Formulario de Login
465
+
466
+ Card completa con form, inputs y múltiples acciones.
467
+
468
+ ```tsx
469
+ import { Input } from "@adamosuiteservices/ui/input";
470
+ import { Label } from "@adamosuiteservices/ui/label";
471
+
472
+ <Card className="w-full max-w-sm">
473
+ <CardHeader>
474
+ <CardTitle>Login to your account</CardTitle>
475
+ <CardDescription>Enter your email below to login</CardDescription>
476
+ <CardAction>
477
+ <Button variant="link">Sign Up</Button>
478
+ </CardAction>
479
+ </CardHeader>
480
+ <CardContent>
481
+ <form>
482
+ <div className="flex flex-col gap-6">
483
+ <div className="grid gap-2">
484
+ <Label htmlFor="email">Email</Label>
485
+ <Input id="email" type="email" placeholder="m@example.com" required />
486
+ </div>
487
+ <div className="grid gap-2">
488
+ <div className="flex items-center">
489
+ <Label htmlFor="password">Password</Label>
490
+ <a
491
+ href="#"
492
+ className="ml-auto text-sm underline-offset-4 hover:underline"
493
+ >
494
+ Forgot password?
495
+ </a>
496
+ </div>
497
+ <Input id="password" type="password" required />
498
+ </div>
499
+ </div>
500
+ </form>
501
+ </CardContent>
502
+ <CardFooter className="flex-col gap-2">
503
+ <Button type="submit" className="w-full">
504
+ Login
505
+ </Button>
506
+ <Button variant="outline" className="w-full">
507
+ Login with Google
508
+ </Button>
509
+ </CardFooter>
510
+ </Card>;
511
+ ```
512
+
513
+ ### Perfil de Usuario
514
+
515
+ Card con avatar, stats y acciones múltiples.
516
+
517
+ ```tsx
518
+ import { Avatar } from "@adamosuiteservices/ui/avatar";
519
+ import { Icon } from "@adamosuiteservices/ui/icon";
520
+
521
+ <Card className="w-[380px]">
522
+ <CardHeader>
523
+ <div className="flex items-center space-x-4">
524
+ <Avatar className="h-12 w-12">
525
+ <Icon symbol="person" />
526
+ </Avatar>
527
+ <div>
528
+ <CardTitle>Sofia Davis</CardTitle>
529
+ <CardDescription>Product Designer</CardDescription>
530
+ </div>
531
+ </div>
532
+ <CardAction>
533
+ <Button variant="outline" size="sm">
534
+ Follow
535
+ </Button>
536
+ </CardAction>
537
+ </CardHeader>
538
+ <CardContent>
539
+ <div className="text-sm text-muted-foreground">
540
+ Passionate about creating beautiful user experiences.
541
+ </div>
542
+ </CardContent>
543
+ <CardFooter className="flex justify-between">
544
+ <div className="flex space-x-4 text-sm text-muted-foreground">
545
+ <div className="flex items-center">
546
+ <Icon symbol="favorite" className="mr-1 text-sm" />
547
+ 256
548
+ </div>
549
+ <div className="flex items-center">
550
+ <Icon symbol="star" className="mr-1 text-sm" />
551
+ 98
552
+ </div>
553
+ </div>
554
+ <div className="flex space-x-1">
555
+ <Button variant="ghost" size="sm">
556
+ <Icon symbol="share" />
557
+ </Button>
558
+ <Button variant="ghost" size="sm">
559
+ <Icon symbol="open_in_new" />
560
+ </Button>
561
+ </div>
562
+ </CardFooter>
563
+ </Card>;
564
+ ```
565
+
566
+ ### Card de Producto
567
+
568
+ E-commerce card con imagen, badge, precio y acciones.
569
+
570
+ ```tsx
571
+ import { Badge } from "@adamosuiteservices/ui/badge";
572
+ import { Icon } from "@adamosuiteservices/ui/icon";
573
+
574
+ <Card className="w-[350px]">
575
+ <CardHeader>
576
+ <div className="aspect-square rounded-md bg-muted"></div>
577
+ </CardHeader>
578
+ <CardContent>
579
+ <div className="space-y-2">
580
+ <Badge variant="secondary">Electronics</Badge>
581
+ <CardTitle>Wireless Headphones</CardTitle>
582
+ <CardDescription>
583
+ Premium wireless headphones with noise cancellation.
584
+ </CardDescription>
585
+ <div className="flex items-center justify-between">
586
+ <div className="text-2xl font-bold">$299.99</div>
587
+ <div className="flex items-center text-sm text-muted-foreground">
588
+ <Icon symbol="star" className="mr-1 text-lg fill-current" />
589
+ 4.5 (128)
590
+ </div>
591
+ </div>
592
+ </div>
593
+ </CardContent>
594
+ <CardFooter className="flex gap-2">
595
+ <Button className="flex-1">
596
+ <Icon symbol="credit_card" />
597
+ Add to Cart
598
+ </Button>
599
+ <Button variant="outline" size="sm">
600
+ <Icon symbol="favorite" />
601
+ </Button>
602
+ </CardFooter>
603
+ </Card>;
604
+ ```
605
+
606
+ ### Stats Cards (Dashboard)
607
+
608
+ Grid de cards para métricas con iconos y tendencias.
609
+
610
+ ```tsx
611
+ import { Icon } from "@adamosuiteservices/ui/icon";
612
+
613
+ <div className="grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-4">
614
+ <Card>
615
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
616
+ <CardTitle className="text-sm font-medium">Total Revenue</CardTitle>
617
+ <Icon symbol="payments" className="text-lg text-muted-foreground" />
618
+ </CardHeader>
619
+ <CardContent>
620
+ <div className="text-2xl font-bold">$45,231.89</div>
621
+ <p className="text-xs text-muted-foreground">+20.1% from last month</p>
622
+ </CardContent>
623
+ </Card>
624
+
625
+ <Card>
626
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
627
+ <CardTitle className="text-sm font-medium">Subscriptions</CardTitle>
628
+ <Icon symbol="person" className="text-lg text-muted-foreground" />
629
+ </CardHeader>
630
+ <CardContent>
631
+ <div className="text-2xl font-bold">+2350</div>
632
+ <p className="text-xs text-muted-foreground">+180.1% from last month</p>
633
+ </CardContent>
634
+ </Card>
635
+
636
+ <Card>
637
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
638
+ <CardTitle className="text-sm font-medium">Sales</CardTitle>
639
+ <Icon symbol="credit_card" className="text-lg text-muted-foreground" />
640
+ </CardHeader>
641
+ <CardContent>
642
+ <div className="text-2xl font-bold">+12,234</div>
643
+ <p className="text-xs text-muted-foreground">+19% from last month</p>
644
+ </CardContent>
645
+ </Card>
646
+
647
+ <Card>
648
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
649
+ <CardTitle className="text-sm font-medium">Active Now</CardTitle>
650
+ <Icon symbol="person" className="text-lg text-muted-foreground" />
651
+ </CardHeader>
652
+ <CardContent>
653
+ <div className="text-2xl font-bold">+573</div>
654
+ <p className="text-xs text-muted-foreground">+201 since last hour</p>
655
+ </CardContent>
656
+ </Card>
657
+ </div>;
658
+ ```
659
+
660
+ ### Card de Notificaciones
661
+
662
+ Lista de notificaciones con items y acción de marcar leído.
663
+
664
+ ```tsx
665
+ import { Icon } from "@adamosuiteservices/ui/icon";
666
+
667
+ <Card className="w-[380px]">
668
+ <CardHeader>
669
+ <CardTitle>Notifications</CardTitle>
670
+ <CardDescription>You have 3 unread messages.</CardDescription>
671
+ </CardHeader>
672
+ <CardContent className="grid gap-4">
673
+ <div className="flex items-center space-x-4 rounded-md border p-4">
674
+ <Icon symbol="notifications" className="text-lg" />
675
+ <div className="flex-1 space-y-1">
676
+ <p className="text-sm font-medium leading-none">Push Notifications</p>
677
+ <p className="text-sm text-muted-foreground">
678
+ Send notifications to device.
679
+ </p>
680
+ </div>
681
+ </div>
682
+ <div className="flex items-center space-x-4 rounded-md border p-4">
683
+ <Icon symbol="mail" className="text-lg" />
684
+ <div className="flex-1 space-y-1">
685
+ <p className="text-sm font-medium leading-none">Email Notifications</p>
686
+ <p className="text-sm text-muted-foreground">
687
+ Send notifications to email.
688
+ </p>
689
+ </div>
690
+ </div>
691
+ </CardContent>
692
+ <CardFooter>
693
+ <Button className="w-full">
694
+ <Icon symbol="check" />
695
+ Mark all as read
696
+ </Button>
697
+ </CardFooter>
698
+ </Card>;
699
+ ```
700
+
701
+ ### Con Separadores (Border)
702
+
703
+ Usa `.border-b` y `.border-t` para separadores visuales.
704
+
705
+ ```tsx
706
+ <Card className="w-[350px]">
707
+ <CardHeader className="border-b">
708
+ <CardTitle>Settings</CardTitle>
709
+ <CardDescription>Manage your preferences</CardDescription>
710
+ </CardHeader>
711
+ <CardContent>
712
+ <div className="space-y-4">{/* Settings content */}</div>
713
+ </CardContent>
714
+ <CardFooter className="border-t">
715
+ <Button className="w-full">Save Changes</Button>
716
+ </CardFooter>
717
+ </Card>
718
+ ```
719
+
720
+ **Nota**: El padding se ajusta automáticamente (`pb-6` en header, `pt-6` en footer).
721
+
722
+ ### Grid de Variantes
723
+
724
+ Mostrar todas las variantes en una vista comparativa.
725
+
726
+ ```tsx
727
+ <div className="grid gap-6 grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
728
+ <Card variant="default">
729
+ <CardHeader>
730
+ <CardTitle>Default</CardTitle>
731
+ <CardDescription>Standard card</CardDescription>
732
+ </CardHeader>
733
+ <CardContent>
734
+ <p className="text-sm">Standard styling.</p>
735
+ </CardContent>
736
+ </Card>
737
+
738
+ <Card variant="primary">
739
+ <CardHeader>
740
+ <CardTitle>Primary</CardTitle>
741
+ <CardDescription>Important info</CardDescription>
742
+ </CardHeader>
743
+ <CardContent>
744
+ <p className="text-sm">Highlight important content.</p>
745
+ </CardContent>
746
+ </Card>
747
+
748
+ <Card variant="success">
749
+ <CardHeader>
750
+ <CardTitle>Success</CardTitle>
751
+ <CardDescription>Success message</CardDescription>
752
+ </CardHeader>
753
+ <CardContent>
754
+ <p className="text-sm">Successful operations.</p>
755
+ </CardContent>
756
+ </Card>
757
+
758
+ <Card variant="warning">
759
+ <CardHeader>
760
+ <CardTitle>Warning</CardTitle>
761
+ <CardDescription>Caution message</CardDescription>
762
+ </CardHeader>
763
+ <CardContent>
764
+ <p className="text-sm">Important warnings.</p>
765
+ </CardContent>
766
+ </Card>
767
+
768
+ <Card variant="destructive">
769
+ <CardHeader>
770
+ <CardTitle>Destructive</CardTitle>
771
+ <CardDescription>Error or danger</CardDescription>
772
+ </CardHeader>
773
+ <CardContent>
774
+ <p className="text-sm">Errors or destructive actions.</p>
775
+ </CardContent>
776
+ </Card>
777
+
778
+ <Card variant="muted">
779
+ <CardHeader>
780
+ <CardTitle>Muted</CardTitle>
781
+ <CardDescription>Secondary info</CardDescription>
782
+ </CardHeader>
783
+ <CardContent>
784
+ <p className="text-sm">Less important information.</p>
785
+ </CardContent>
786
+ </Card>
787
+ </div>
788
+ ```
789
+
790
+ ### Header con Layout Custom
791
+
792
+ Override del grid para layouts específicos.
793
+
794
+ ```tsx
795
+ {
796
+ /* Horizontal layout con custom spacing */
797
+ }
798
+ <Card className="w-[400px]">
799
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
800
+ <CardTitle className="text-sm font-medium">Custom Layout</CardTitle>
801
+ <Badge>New</Badge>
802
+ </CardHeader>
803
+ <CardContent>
804
+ <div className="text-2xl font-bold">Content</div>
805
+ </CardContent>
806
+ </Card>;
807
+ ```
808
+
809
+ ### Footer con Múltiples Acciones
810
+
811
+ Diferentes arreglos de botones.
812
+
813
+ ```tsx
814
+ {
815
+ /* Botones horizontales con gap */
816
+ }
817
+ <Card>
818
+ <CardHeader>
819
+ <CardTitle>Confirm Action</CardTitle>
820
+ </CardHeader>
821
+ <CardContent>
822
+ <p>Are you sure?</p>
823
+ </CardContent>
824
+ <CardFooter className="gap-2">
825
+ <Button variant="outline" size="sm">
826
+ Cancel
827
+ </Button>
828
+ <Button size="sm">Confirm</Button>
829
+ </CardFooter>
830
+ </Card>;
831
+
832
+ {
833
+ /* Botones apilados verticalmente */
834
+ }
835
+ <Card>
836
+ <CardHeader>
837
+ <CardTitle>Choose Option</CardTitle>
838
+ </CardHeader>
839
+ <CardContent>
840
+ <p>Select an action:</p>
841
+ </CardContent>
842
+ <CardFooter className="flex-col gap-2">
843
+ <Button className="w-full">Primary Action</Button>
844
+ <Button variant="outline" className="w-full">
845
+ Secondary
846
+ </Button>
847
+ </CardFooter>
848
+ </Card>;
849
+
850
+ {
851
+ /* Acciones distribuidas */
852
+ }
853
+ <Card>
854
+ <CardHeader>
855
+ <CardTitle>Actions</CardTitle>
856
+ </CardHeader>
857
+ <CardContent>
858
+ <p>Multiple actions available.</p>
859
+ </CardContent>
860
+ <CardFooter className="justify-between">
861
+ <Button variant="outline" size="sm">
862
+ Cancel
863
+ </Button>
864
+ <div className="flex gap-2">
865
+ <Button variant="outline" size="sm">
866
+ Save Draft
867
+ </Button>
868
+ <Button size="sm">Publish</Button>
869
+ </div>
870
+ </CardFooter>
871
+ </Card>;
872
+ ```
873
+
874
+ ## Casos de Uso Comunes
875
+
876
+ ### Authentication Forms
877
+
878
+ ```tsx
879
+ <Card className="w-full max-w-md">
880
+ <CardHeader>
881
+ <CardTitle>Create Account</CardTitle>
882
+ <CardDescription>Sign up to get started</CardDescription>
883
+ </CardHeader>
884
+ <CardContent className="space-y-4">
885
+ <Input type="text" placeholder="Full Name" />
886
+ <Input type="email" placeholder="Email" />
887
+ <Input type="password" placeholder="Password" />
888
+ </CardContent>
889
+ <CardFooter>
890
+ <Button className="w-full">Create Account</Button>
891
+ </CardFooter>
892
+ </Card>
893
+ ```
894
+
895
+ ### Dashboard Widgets
896
+
897
+ ```tsx
898
+ <Card>
899
+ <CardHeader>
900
+ <CardTitle>Recent Activity</CardTitle>
901
+ <CardDescription>Your latest actions</CardDescription>
902
+ <CardAction>
903
+ <Button variant="ghost" size="sm">
904
+ View All
905
+ </Button>
906
+ </CardAction>
907
+ </CardHeader>
908
+ <CardContent>{/* Activity list */}</CardContent>
909
+ </Card>
910
+ ```
911
+
912
+ ### Settings Panels
913
+
914
+ ```tsx
915
+ <Card className="border-b">
916
+ <CardHeader>
917
+ <CardTitle>Account Settings</CardTitle>
918
+ <CardDescription>Manage your account preferences</CardDescription>
919
+ </CardHeader>
920
+ <CardContent className="space-y-4">{/* Settings options */}</CardContent>
921
+ <CardFooter className="border-t">
922
+ <Button>Save Changes</Button>
923
+ </CardFooter>
924
+ </Card>
925
+ ```
926
+
927
+ ### Pricing Cards
928
+
929
+ ```tsx
930
+ <div className="grid gap-4 md:grid-cols-3">
931
+ <Card>
932
+ <CardHeader>
933
+ <CardTitle>Basic</CardTitle>
934
+ <CardDescription>For individuals</CardDescription>
935
+ </CardHeader>
936
+ <CardContent>
937
+ <div className="text-3xl font-bold">$9/mo</div>
938
+ <ul className="mt-4 space-y-2 text-sm">
939
+ <li>✓ Feature 1</li>
940
+ <li>✓ Feature 2</li>
941
+ </ul>
942
+ </CardContent>
943
+ <CardFooter>
944
+ <Button variant="outline" className="w-full">
945
+ Choose Plan
946
+ </Button>
947
+ </CardFooter>
948
+ </Card>
949
+ {/* More pricing tiers */}
950
+ </div>
951
+ ```
952
+
953
+ ### Status/Alert Cards
954
+
955
+ ```tsx
956
+ <Card variant="warning">
957
+ <CardHeader>
958
+ <CardTitle>Action Required</CardTitle>
959
+ <CardDescription>Your subscription expires soon</CardDescription>
960
+ </CardHeader>
961
+ <CardContent>
962
+ <p className="text-sm">
963
+ Renew your subscription to continue accessing premium features.
964
+ </p>
965
+ </CardContent>
966
+ <CardFooter>
967
+ <Button>Renew Now</Button>
968
+ </CardFooter>
969
+ </Card>
970
+ ```
971
+
972
+ ## Mejores Prácticas
973
+
974
+ ### Usa Anchos Fijos para Consistencia
975
+
976
+ ```tsx
977
+ {
978
+ /* ✅ Correcto - Ancho consistente */
979
+ }
980
+ <Card className="w-[350px]">
981
+ <CardContent>Consistent width</CardContent>
982
+ </Card>;
983
+
984
+ {
985
+ /* ✅ También correcto - max-w para responsive */
986
+ }
987
+ <Card className="w-full max-w-md">
988
+ <CardContent>Responsive width</CardContent>
989
+ </Card>;
990
+
991
+ {
992
+ /* ❌ Evitar - Sin ancho puede expandirse inesperadamente */
993
+ }
994
+ <Card>
995
+ <CardContent>No width constraint</CardContent>
996
+ </Card>;
997
+ ```
998
+
999
+ ### Variantes Semánticas
1000
+
1001
+ ```tsx
1002
+ {/* ✅ Correcto - Variante según significado */}
1003
+ <Card variant="success">
1004
+ <CardContent>Payment processed!</CardContent>
1005
+ </Card>
1006
+
1007
+ <Card variant="destructive">
1008
+ <CardContent>Error occurred</CardContent>
1009
+ </Card>
1010
+
1011
+ {/* ❌ Incorrecto - Variante no semántica */}
1012
+ <Card variant="success">
1013
+ <CardContent>Error occurred</CardContent> {/* Confuso */}
1014
+ </Card>
1015
+ ```
1016
+
1017
+ ### Uso de Sombras y Bordes
1018
+
1019
+ ```tsx
1020
+ {/* ✅ Correcto - Default sin sombra para diseño plano */}
1021
+ <Card>
1022
+ <CardContent>Clean, flat design</CardContent>
1023
+ </Card>
1024
+
1025
+ {/* ✅ Correcto - Shadow para cards flotantes o destacadas */}
1026
+ <Card shadow="default">
1027
+ <CardContent>Elevated card with depth</CardContent>
1028
+ </Card>
1029
+
1030
+ {/* ✅ Correcto - Border transparent para integración con fondo */}
1031
+ <Card border="transparent" variant="muted">
1032
+ <CardContent>Blends with background</CardContent>
1033
+ </Card>
1034
+
1035
+ {/* ⚠️ Evitar - Shadow sin propósito específico */}
1036
+ <Card shadow="default">
1037
+ <CardContent>Unnecessary elevation</CardContent>
1038
+ </Card>
1039
+ ```
1040
+
1041
+ **Recomendaciones**:
1042
+
1043
+ - Usa `shadow="none"` (default) para layouts densos y diseños modernos
1044
+ - Aplica `shadow="default"` para destacar cards importantes o flotantes
1045
+ - Usa `border="transparent"` en cards sobre fondos de color similar
1046
+ - Mantén `border="default"` para máxima claridad y separación
1047
+
1048
+ ### Estructura de Header Completa
1049
+
1050
+ ```tsx
1051
+ {
1052
+ /* ✅ Correcto - Título + Descripción */
1053
+ }
1054
+ <CardHeader>
1055
+ <CardTitle>Title</CardTitle>
1056
+ <CardDescription>Description</CardDescription>
1057
+ </CardHeader>;
1058
+
1059
+ {
1060
+ /* ⚠️ Aceptable - Solo título */
1061
+ }
1062
+ <CardHeader>
1063
+ <CardTitle>Title Only</CardTitle>
1064
+ </CardHeader>;
1065
+
1066
+ {
1067
+ /* ❌ Evitar - Solo descripción sin título */
1068
+ }
1069
+ <CardHeader>
1070
+ <CardDescription>No title</CardDescription>
1071
+ </CardHeader>;
1072
+ ```
1073
+
1074
+ ### CardAction Solo en CardHeader
1075
+
1076
+ ```tsx
1077
+ {
1078
+ /* ✅ Correcto - CardAction dentro de CardHeader */
1079
+ }
1080
+ <CardHeader>
1081
+ <CardTitle>Title</CardTitle>
1082
+ <CardDescription>Description</CardDescription>
1083
+ <CardAction>
1084
+ <Button size="sm">Action</Button>
1085
+ </CardAction>
1086
+ </CardHeader>;
1087
+
1088
+ {
1089
+ /* ❌ Incorrecto - CardAction fuera de CardHeader */
1090
+ }
1091
+ <Card>
1092
+ <CardTitle>Title</CardTitle>
1093
+ <CardAction>
1094
+ <Button>Won't position correctly</Button>
1095
+ </CardAction>
1096
+ </Card>;
1097
+ ```
1098
+
1099
+ ### Footer Flex para Múltiples Botones
1100
+
1101
+ ```tsx
1102
+ {
1103
+ /* ✅ Correcto - Gap entre botones */
1104
+ }
1105
+ <CardFooter className="gap-2">
1106
+ <Button variant="outline">Cancel</Button>
1107
+ <Button>Confirm</Button>
1108
+ </CardFooter>;
1109
+
1110
+ {
1111
+ /* ✅ Correcto - Full width individual */
1112
+ }
1113
+ <CardFooter className="flex-col gap-2">
1114
+ <Button className="w-full">Primary</Button>
1115
+ <Button variant="outline" className="w-full">
1116
+ Secondary
1117
+ </Button>
1118
+ </CardFooter>;
1119
+
1120
+ {
1121
+ /* ❌ Evitar - Sin gap entre botones */
1122
+ }
1123
+ <CardFooter>
1124
+ <Button>Button1</Button>
1125
+ <Button>Button2</Button> {/* Se pegan */}
1126
+ </CardFooter>;
1127
+ ```
1128
+
1129
+ ### Bordes Opcionales
1130
+
1131
+ ```tsx
1132
+ {
1133
+ /* ✅ Correcto - Border con padding automático */
1134
+ }
1135
+ <Card>
1136
+ <CardHeader className="border-b">
1137
+ <CardTitle>Title</CardTitle>
1138
+ </CardHeader>
1139
+ <CardContent>Content</CardContent>
1140
+ <CardFooter className="border-t">
1141
+ <Button>Action</Button>
1142
+ </CardFooter>
1143
+ </Card>;
1144
+
1145
+ {
1146
+ /* ❌ Evitar - Border sin la clase en header/footer */
1147
+ }
1148
+ <Card className="border-b">
1149
+ {" "}
1150
+ {/* No aplica padding correcto */}
1151
+ <CardHeader>
1152
+ <CardTitle>Title</CardTitle>
1153
+ </CardHeader>
1154
+ </Card>;
1155
+ ```
1156
+
1157
+ ### Grid en Stats Cards
1158
+
1159
+ ```tsx
1160
+ {
1161
+ /* ✅ Correcto - Override spacing cuando es necesario */
1162
+ }
1163
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
1164
+ <CardTitle className="text-sm font-medium">Stat</CardTitle>
1165
+ <Icon className="h-4 w-4 text-muted-foreground" />
1166
+ </CardHeader>;
1167
+
1168
+ {
1169
+ /* ❌ Incorrecto - Usar grid default con layout horizontal */
1170
+ }
1171
+ <CardHeader className="flex-row">
1172
+ {" "}
1173
+ {/* Grid sigue activo */}
1174
+ <CardTitle>Stat</CardTitle>
1175
+ <Icon />
1176
+ </CardHeader>;
1177
+ ```
1178
+
1179
+ ### Uso de Shadow
1180
+
1181
+ ```tsx
1182
+ {/* ✅ Correcto - Shadow para cards individuales o destacadas */}
1183
+ <Card shadow="default" className="w-[350px]">
1184
+ <CardContent>
1185
+ Stands out with subtle elevation
1186
+ </CardContent>
1187
+ </Card>
1188
+
1189
+ {/* ✅ Correcto - Sin shadow para grids densos */}
1190
+ <div className="grid gap-4 md:grid-cols-3">
1191
+ <Card shadow="none">
1192
+ <CardContent>Flat design in dense layout</CardContent>
1193
+ </Card>
1194
+ <Card shadow="none">
1195
+ <CardContent>Flat design in dense layout</CardContent>
1196
+ </Card>
1197
+ <Card shadow="none">
1198
+ <CardContent>Flat design in dense layout</CardContent>
1199
+ </Card>
1200
+ </div>
1201
+
1202
+ {/* ✅ Correcto - Sin shadow cuando ya hay separación visual */}
1203
+ <div className="space-y-4">
1204
+ <Card shadow="none">
1205
+ <CardContent>Spacing provides separation</CardContent>
1206
+ </Card>
1207
+ <Card shadow="none">
1208
+ <CardContent>No shadow needed here</CardContent>
1209
+ </Card>
1210
+ </div>
1211
+
1212
+ {/* ⚠️ Considerar - Mucha sombra en layouts densos */}
1213
+ <div className="grid gap-2 md:grid-cols-4">
1214
+ <Card shadow="default">...</Card> {/* Puede verse pesado */}
1215
+ <Card shadow="default">...</Card>
1216
+ <Card shadow="default">...</Card>
1217
+ <Card shadow="default">...</Card>
1218
+ </div>
1219
+ ```
1220
+
1221
+ ## Notas de Implementación
1222
+
1223
+ - **Basado en CVA**: Usa `class-variance-authority` para variantes de color, sombra y borde
1224
+ - **Data Slots**: Cada componente tiene `data-slot` para CSS targeting específico (`data-slot="card"`, `data-slot="card-header"`, etc.)
1225
+ - **Grid Automático**: CardHeader usa `has-data-[slot=card-action]:grid-cols-[1fr_auto]` para detectar CardAction y ajustar layout
1226
+ - **Container Queries**: CardHeader tiene `@container/card-header` para responsive interno (requiere Tailwind CSS container queries)
1227
+ - **Spacing Consistente**: `gap-6` entre secciones (header, content, footer), `px-6` horizontal en todas las secciones
1228
+ - **Padding Condicional**: `.border-b` y `.border-t` triggers automáticos para `pb-6` y `pt-6` respectivamente
1229
+ - **Variantes de Color**: Cada variante ajusta `bg-*-50` y `text-*-foreground`, con ajustes para iconos SVG (`[&>svg]:text-current`)
1230
+ - **Variantes de Sombra**: Dos opciones (`default` con `shadow-xs`, `none` sin sombra por defecto) para control de elevación
1231
+ - **Variantes de Borde**: Dos opciones (`default` con borde visible, `transparent` con borde invisible pero mantiene espaciado)
1232
+ - **Rounded Corners**: `rounded-3xl` por defecto para esquinas suaves
1233
+ - **Flex Column**: Card root usa `flex flex-col gap-6` para layout vertical automático
1234
+
1235
+ ## Accesibilidad
1236
+
1237
+ ### Estructura Semántica
1238
+
1239
+ Cards usan `<div>` por defecto, pero considera añadir roles ARIA cuando sea apropiado.
1240
+
1241
+ ```tsx
1242
+ {
1243
+ /* Para cards interactivas */
1244
+ }
1245
+ <Card role="article" aria-labelledby="card-title">
1246
+ <CardHeader>
1247
+ <CardTitle id="card-title">Article Title</CardTitle>
1248
+ </CardHeader>
1249
+ <CardContent>Content</CardContent>
1250
+ </Card>;
1251
+
1252
+ {
1253
+ /* Para cards clickeables */
1254
+ }
1255
+ <Card
1256
+ role="button"
1257
+ tabIndex={0}
1258
+ onClick={handleClick}
1259
+ onKeyDown={(e) => e.key === "Enter" && handleClick()}
1260
+ >
1261
+ <CardContent>Clickable card</CardContent>
1262
+ </Card>;
1263
+ ```
1264
+
1265
+ ### Labels para CardAction
1266
+
1267
+ ```tsx
1268
+ {
1269
+ /* ✅ Correcto - aria-label descriptiva */
1270
+ }
1271
+ <CardAction>
1272
+ <Button variant="outline" size="sm" aria-label="More options">
1273
+ <MoreHorizontalIcon />
1274
+ </Button>
1275
+ </CardAction>;
1276
+
1277
+ {
1278
+ /* ❌ Incorrecto - Sin label para icono solo */
1279
+ }
1280
+ <CardAction>
1281
+ <Button variant="outline" size="sm">
1282
+ <MoreHorizontalIcon />
1283
+ </Button>
1284
+ </CardAction>;
1285
+ ```
1286
+
1287
+ ### Formularios Accesibles
1288
+
1289
+ ```tsx
1290
+ {
1291
+ /* ✅ Correcto - Labels asociadas */
1292
+ }
1293
+ <CardContent>
1294
+ <div className="space-y-4">
1295
+ <div className="grid gap-2">
1296
+ <Label htmlFor="email">Email</Label>
1297
+ <Input id="email" type="email" />
1298
+ </div>
1299
+ </div>
1300
+ </CardContent>;
1301
+ ```
1302
+
1303
+ ### Focus Management
1304
+
1305
+ Cards no son focuseables por defecto. Si necesitas interactividad:
1306
+
1307
+ ```tsx
1308
+ {
1309
+ /* Para cards clickeables */
1310
+ }
1311
+ <Card
1312
+ tabIndex={0}
1313
+ role="button"
1314
+ className="cursor-pointer hover:shadow-md transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
1315
+ onClick={handleClick}
1316
+ >
1317
+ <CardContent>Interactive card</CardContent>
1318
+ </Card>;
1319
+ ```
1320
+
1321
+ ## Troubleshooting
1322
+
1323
+ ### CardAction No Se Alinea a la Derecha
1324
+
1325
+ **Problema**: CardAction no aparece en la posición correcta.
1326
+
1327
+ **Solución**:
1328
+
1329
+ ```tsx
1330
+ // ❌ Problema - CardAction fuera de CardHeader
1331
+ <Card>
1332
+ <CardTitle>Title</CardTitle>
1333
+ <CardAction>
1334
+ <Button>Action</Button>
1335
+ </CardAction>
1336
+ </Card>
1337
+
1338
+ // ✅ Solución - CardAction dentro de CardHeader
1339
+ <Card>
1340
+ <CardHeader>
1341
+ <CardTitle>Title</CardTitle>
1342
+ <CardDescription>Description</CardDescription>
1343
+ <CardAction>
1344
+ <Button>Action</Button>
1345
+ </CardAction>
1346
+ </CardHeader>
1347
+ </Card>
1348
+ ```
1349
+
1350
+ ### Gap Excesivo entre Secciones
1351
+
1352
+ **Problema**: Mucho espacio entre header/content/footer.
1353
+
1354
+ **Solución**:
1355
+
1356
+ ```tsx
1357
+ // ✅ El gap-6 es intencional, pero puedes reducirlo
1358
+ <Card className="gap-4"> {/* Override gap-6 */}
1359
+ <CardHeader>...</CardHeader>
1360
+ <CardContent>...</CardContent>
1361
+ </Card>
1362
+
1363
+ // O eliminar gap completamente
1364
+ <Card className="gap-0">
1365
+ <CardHeader>...</CardHeader>
1366
+ <CardContent>...</CardContent>
1367
+ </Card>
1368
+ ```
1369
+
1370
+ ### Bordes No Muestran Padding
1371
+
1372
+ **Problema**: `.border-b` o `.border-t` no agregan padding.
1373
+
1374
+ **Solución**:
1375
+
1376
+ ```tsx
1377
+ // ❌ Problema - Border en elemento incorrecto
1378
+ <Card className="border-b">
1379
+ <CardHeader>...</CardHeader>
1380
+ </Card>
1381
+
1382
+ // ✅ Solución - Border en CardHeader o CardFooter
1383
+ <Card>
1384
+ <CardHeader className="border-b">...</CardHeader>
1385
+ <CardContent>...</CardContent>
1386
+ <CardFooter className="border-t">...</CardFooter>
1387
+ </Card>
1388
+ ```
1389
+
1390
+ ### Variante No Cambia Color
1391
+
1392
+ **Problema**: Variante primary/success/etc no aplica colores.
1393
+
1394
+ **Solución**:
1395
+
1396
+ ```tsx
1397
+ // ✅ Verifica que la prop sea en Card root
1398
+ <Card variant="primary"> {/* Correcto */}
1399
+ <CardHeader>...</CardHeader>
1400
+ </Card>
1401
+
1402
+ // ❌ No funciona en subcomponentes
1403
+ <Card>
1404
+ <CardHeader variant="primary"> {/* No existe esta prop */}
1405
+ ...
1406
+ </CardHeader>
1407
+ </Card>
1408
+ ```
1409
+
1410
+ ### Stats Cards con Layout Incorrecto
1411
+
1412
+ **Problema**: Íconos y títulos no se alinean horizontalmente.
1413
+
1414
+ **Solución**:
1415
+
1416
+ ```tsx
1417
+ // ✅ Override grid con flex
1418
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
1419
+ <CardTitle className="text-sm font-medium">Revenue</CardTitle>
1420
+ <DollarSignIcon className="h-4 w-4" />
1421
+ </CardHeader>
1422
+ ```
1423
+
1424
+ ### Footer Buttons No Se Distribuyen
1425
+
1426
+ **Problema**: Botones en footer se pegan sin espacio.
1427
+
1428
+ **Solución**:
1429
+
1430
+ ```tsx
1431
+ // ❌ Problema - Sin gap
1432
+ <CardFooter>
1433
+ <Button>Cancel</Button>
1434
+ <Button>Confirm</Button>
1435
+ </CardFooter>
1436
+
1437
+ // ✅ Solución - Añade gap
1438
+ <CardFooter className="gap-2">
1439
+ <Button>Cancel</Button>
1440
+ <Button>Confirm</Button>
1441
+ </CardFooter>
1442
+
1443
+ // ✅ O usa justify-between
1444
+ <CardFooter className="justify-between">
1445
+ <Button>Cancel</Button>
1446
+ <Button>Confirm</Button>
1447
+ </CardFooter>
1448
+ ```
1449
+
1450
+ ## Referencias
1451
+
1452
+ - **CVA (Class Variance Authority)**: https://cva.style/docs
1453
+ - **shadcn/ui Card**: https://ui.shadcn.com/docs/components/card
1454
+ - **Tailwind Container Queries**: https://tailwindcss.com/docs/hover-focus-and-other-states#container-queries
1455
+ - **ARIA Article Role**: https://www.w3.org/TR/wai-aria-1.2/#article