@adamosuiteservices/ui 1.7.13 → 1.8.13
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.
- package/dist/accordion-rounded.cjs +24 -2
- package/dist/accordion-rounded.js +46 -8
- package/dist/accordion.cjs +20 -1
- package/dist/accordion.js +29 -5
- package/dist/alert.cjs +26 -1
- package/dist/alert.js +33 -8
- package/dist/avatar.cjs +7 -1
- package/dist/avatar.js +8 -2
- package/dist/badge.cjs +83 -1
- package/dist/badge.js +106 -24
- package/dist/breadcrumb.cjs +8 -1
- package/dist/breadcrumb.js +11 -4
- package/dist/button-B7ZP4LZN.js +127 -0
- package/dist/button-D-qFRXiM.cjs +70 -0
- package/dist/button-group.cjs +25 -1
- package/dist/button-group.js +33 -9
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar.cjs +74 -1
- package/dist/calendar.js +114 -35
- package/dist/card.cjs +35 -1
- package/dist/card.js +45 -11
- package/dist/{checkbox-YWAnswaW.cjs → checkbox-CdnZ8VFJ.cjs} +21 -1
- package/dist/{checkbox-Dr487kAg.js → checkbox-DhBcmKze.js} +34 -4
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/combobox.cjs +36 -2
- package/dist/combobox.js +62 -22
- package/dist/components/icons/account-balance-icon.d.ts +3 -0
- package/dist/components/icons/account-icon.d.ts +3 -0
- package/dist/components/icons/add-circle-icon.d.ts +3 -0
- package/dist/components/icons/alarm-icon.d.ts +3 -0
- package/dist/components/icons/archive-icon.d.ts +3 -0
- package/dist/components/icons/arrow-back-icon.d.ts +3 -0
- package/dist/components/icons/arrow-circle-up-icon.d.ts +3 -0
- package/dist/components/icons/arrow-forward-icon.d.ts +3 -0
- package/dist/components/icons/arrow-outward-icon.d.ts +3 -0
- package/dist/components/icons/article-icon.d.ts +3 -0
- package/dist/components/icons/attach-file-icon.d.ts +3 -0
- package/dist/components/icons/autorenew-icon.d.ts +3 -0
- package/dist/components/icons/bookmark-icon.d.ts +3 -0
- package/dist/components/icons/calculate-icon.d.ts +3 -0
- package/dist/components/icons/calendar-today-icon.d.ts +3 -0
- package/dist/components/icons/call-split-icon.d.ts +3 -0
- package/dist/components/icons/cancel-filled-icon.d.ts +3 -0
- package/dist/components/icons/cancel-icon.d.ts +3 -0
- package/dist/components/icons/check-circle-icon.d.ts +3 -0
- package/dist/components/icons/check-icon.d.ts +3 -0
- package/dist/components/icons/chevron-back-icon.d.ts +3 -0
- package/dist/components/icons/chevron-down-icon.d.ts +3 -0
- package/dist/components/icons/chevron-forward-icon.d.ts +3 -0
- package/dist/components/icons/chevron-up-icon.d.ts +3 -0
- package/dist/components/icons/clarify-icon.d.ts +3 -0
- package/dist/components/icons/clock-icon.d.ts +3 -0
- package/dist/components/icons/close-icon.d.ts +3 -0
- package/dist/components/icons/confirmation-number-icon.d.ts +3 -0
- package/dist/components/icons/contacts-icon.d.ts +3 -0
- package/dist/components/icons/contract-delete-icon.d.ts +3 -0
- package/dist/components/icons/copy-icon.d.ts +3 -0
- package/dist/components/icons/do-not-touch-icon.d.ts +3 -0
- package/dist/components/icons/download-icon.d.ts +3 -0
- package/dist/components/icons/dragger-icon.d.ts +3 -0
- package/dist/components/icons/edit-icon.d.ts +3 -0
- package/dist/components/icons/edit-square-icon.d.ts +3 -0
- package/dist/components/icons/exclamation-icon.d.ts +3 -0
- package/dist/components/icons/expand-circle-right-icon.d.ts +3 -0
- package/dist/components/icons/feature-search-icon.d.ts +3 -0
- package/dist/components/icons/filter-icon.d.ts +3 -0
- package/dist/components/icons/folder-icon.d.ts +3 -0
- package/dist/components/icons/folder-open-icon.d.ts +3 -0
- package/dist/components/icons/format-list-bulleted-icon.d.ts +3 -0
- package/dist/components/icons/hamburger-menu-icon.d.ts +3 -0
- package/dist/components/icons/help-icon.d.ts +3 -0
- package/dist/components/icons/hide-pass-icon.d.ts +3 -0
- package/dist/components/icons/home-icon.d.ts +3 -0
- package/dist/components/icons/id-card-icon.d.ts +3 -0
- package/dist/components/icons/index.d.ts +88 -0
- package/dist/components/icons/info-icon.d.ts +3 -0
- package/dist/components/icons/kid-star-icon.d.ts +3 -0
- package/dist/components/icons/language-icon.d.ts +3 -0
- package/dist/components/icons/last-page-icon.d.ts +3 -0
- package/dist/components/icons/layers-icon.d.ts +3 -0
- package/dist/components/icons/location-icon.d.ts +3 -0
- package/dist/components/icons/mail-icon.d.ts +3 -0
- package/dist/components/icons/manage-search-icon.d.ts +3 -0
- package/dist/components/icons/menu-icon.d.ts +3 -0
- package/dist/components/icons/message-icon.d.ts +3 -0
- package/dist/components/icons/metrics-icon.d.ts +3 -0
- package/dist/components/icons/mic-icon.d.ts +3 -0
- package/dist/components/icons/minus-icon.d.ts +3 -0
- package/dist/components/icons/mode-comment-icon.d.ts +3 -0
- package/dist/components/icons/money-icon.d.ts +3 -0
- package/dist/components/icons/monitoring-icon.d.ts +3 -0
- package/dist/components/icons/more-icon.d.ts +3 -0
- package/dist/components/icons/notifications-icon.d.ts +3 -0
- package/dist/components/icons/open-in-new-icon.d.ts +3 -0
- package/dist/components/icons/palette-icon.d.ts +3 -0
- package/dist/components/icons/password-icon.d.ts +3 -0
- package/dist/components/icons/pending-icon.d.ts +3 -0
- package/dist/components/icons/person-add-icon.d.ts +3 -0
- package/dist/components/icons/person-search-icon.d.ts +3 -0
- package/dist/components/icons/photo-icon.d.ts +3 -0
- package/dist/components/icons/plus-icon.d.ts +3 -0
- package/dist/components/icons/policy-icon.d.ts +3 -0
- package/dist/components/icons/publish-icon.d.ts +3 -0
- package/dist/components/icons/ready-icon.d.ts +3 -0
- package/dist/components/icons/receipt-icon.d.ts +3 -0
- package/dist/components/icons/receive-icon.d.ts +3 -0
- package/dist/components/icons/refresh-icon.d.ts +3 -0
- package/dist/components/icons/search-icon.d.ts +3 -0
- package/dist/components/icons/see-icon.d.ts +3 -0
- package/dist/components/icons/send-icon.d.ts +3 -0
- package/dist/components/icons/settings-icon.d.ts +3 -0
- package/dist/components/icons/shield-icon.d.ts +3 -0
- package/dist/components/icons/swap-horiz-icon.d.ts +3 -0
- package/dist/components/icons/tag-icon.d.ts +3 -0
- package/dist/components/icons/trash-icon.d.ts +3 -0
- package/dist/components/layout/toaster/toaster.d.ts +1 -1
- package/dist/components/layout/toaster/toaster.stories.d.ts +1 -1
- package/dist/components/ui/accordion/accordion.d.ts +1 -1
- package/dist/components/ui/accordion/accordion.stories.d.ts +1 -1
- package/dist/components/ui/accordion-rounded/accordion-rounded.d.ts +1 -1
- package/dist/components/ui/accordion-rounded/accordion-rounded.stories.d.ts +1 -1
- package/dist/components/ui/alert/alert.stories.d.ts +1 -1
- package/dist/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/components/ui/avatar/avatar.stories.d.ts +1 -1
- package/dist/components/ui/badge/badge.stories.d.ts +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.stories.d.ts +1 -1
- package/dist/components/ui/button/button.stories.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.d.ts +1 -1
- package/dist/components/ui/button-group/button-group.stories.d.ts +1 -1
- package/dist/components/ui/calendar/calendar.d.ts +1 -1
- package/dist/components/ui/calendar/calendar.stories.d.ts +1 -1
- package/dist/components/ui/card/card.stories.d.ts +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts +1 -1
- package/dist/components/ui/checkbox/checkbox.stories.d.ts +1 -1
- package/dist/components/ui/collapsible/collapsible.stories.d.ts +1 -1
- package/dist/components/ui/combobox/combobox.stories.d.ts +1 -1
- package/dist/components/ui/command/command.d.ts +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu/context-menu.stories.d.ts +1 -1
- package/dist/components/ui/dialog/dialog.d.ts +1 -1
- package/dist/components/ui/dialog/dialog.stories.d.ts +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.stories.d.ts +1 -1
- package/dist/components/ui/field/field.d.ts +1 -1
- package/dist/components/ui/field/field.stories.d.ts +1 -1
- package/dist/components/ui/hover-card/hover-card.d.ts +1 -1
- package/dist/components/ui/hover-card/hover-card.stories.d.ts +1 -1
- package/dist/components/ui/input/input.stories.d.ts +1 -1
- package/dist/components/ui/input-group/Input-group.stories.d.ts +1 -1
- package/dist/components/ui/input-group/input-group.d.ts +1 -1
- package/dist/components/ui/kbd/kbd.stories.d.ts +1 -1
- package/dist/components/ui/label/label.d.ts +1 -1
- package/dist/components/ui/label/label.stories.d.ts +1 -1
- package/dist/components/ui/pagination/pagination.stories.d.ts +1 -1
- package/dist/components/ui/popover/popover.d.ts +1 -1
- package/dist/components/ui/popover/popover.stories.d.ts +1 -1
- package/dist/components/ui/progress/progress.d.ts +1 -1
- package/dist/components/ui/progress/progress.stories.d.ts +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts +1 -1
- package/dist/components/ui/radio-group/radio-group.stories.d.ts +1 -1
- package/dist/components/ui/scroll-area/scroll-area.d.ts +1 -1
- package/dist/components/ui/scroll-area/scroll-area.stories.d.ts +1 -1
- package/dist/components/ui/select/select.d.ts +1 -1
- package/dist/components/ui/select/select.stories.d.ts +1 -1
- package/dist/components/ui/separator/separator.d.ts +1 -1
- package/dist/components/ui/separator/separator.stories.d.ts +1 -1
- package/dist/components/ui/sheet/sheet.d.ts +1 -1
- package/dist/components/ui/sheet/sheet.stories.d.ts +1 -1
- package/dist/components/ui/skeleton/skeleton.stories.d.ts +1 -1
- package/dist/components/ui/slider/slider.d.ts +1 -1
- package/dist/components/ui/slider/slider.stories.d.ts +1 -1
- package/dist/components/ui/spinner/spinner.stories.d.ts +1 -1
- package/dist/components/ui/switch/switch.d.ts +1 -1
- package/dist/components/ui/switch/switch.stories.d.ts +1 -1
- package/dist/components/ui/tabs/tabs.d.ts +1 -1
- package/dist/components/ui/tabs/tabs.stories.d.ts +1 -1
- package/dist/components/ui/tabs-underline/tabs-underline.d.ts +1 -1
- package/dist/components/ui/tabs-underline/tabs-underline.stories.d.ts +1 -1
- package/dist/components/ui/textarea/textarea.stories.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.stories.d.ts +1 -1
- package/dist/components/ui/tooltip/tooltip.d.ts +1 -1
- package/dist/components/ui/tooltip/tooltip.stories.d.ts +1 -1
- package/dist/context-menu.cjs +79 -1
- package/dist/context-menu.js +101 -11
- package/dist/custom-layered-styles.css +1 -1
- package/dist/dialog.cjs +30 -1
- package/dist/dialog.js +35 -6
- package/dist/dropdown-menu.cjs +79 -1
- package/dist/dropdown-menu.js +101 -11
- package/dist/field.cjs +66 -1
- package/dist/field.js +91 -26
- package/dist/hover-card.cjs +15 -1
- package/dist/hover-card.js +15 -1
- package/dist/icons.cjs +1 -0
- package/dist/icons.js +1507 -0
- package/dist/input-BQZUpTEY.js +42 -0
- package/dist/input-DSmxdfq5.cjs +21 -0
- package/dist/input-group.cjs +76 -1
- package/dist/input-group.js +99 -24
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/kbd.cjs +10 -1
- package/dist/kbd.js +11 -2
- package/dist/{label-CmwGvhy1.js → label-BJ8Yf6Ft.js} +7 -1
- package/dist/{label-BjXORCBM.cjs → label-CNGQhi5L.cjs} +7 -1
- package/dist/label.cjs +1 -1
- package/dist/label.js +1 -1
- package/dist/pagination.cjs +13 -1
- package/dist/pagination.js +30 -6
- package/dist/{popover-FCKBtFo-.cjs → popover-CYbik-H4.cjs} +15 -1
- package/dist/{popover-3rIoNCXs.js → popover-DAwH8jUh.js} +15 -1
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +1 -1
- package/dist/radio-group.cjs +14 -1
- package/dist/radio-group.js +20 -2
- package/dist/select.cjs +68 -1
- package/dist/select.js +83 -10
- package/dist/{separator-BaZqZZ9R.cjs → separator-Brpax0EI.cjs} +7 -1
- package/dist/{separator-DR7lQjv9.js → separator-DVypR3Qf.js} +7 -1
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet-CGahUP7F.cjs +41 -0
- package/dist/sheet-Q3dBOQG-.js +174 -0
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sidebar.cjs +20 -2
- package/dist/sidebar.js +58 -26
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/slider.cjs +27 -1
- package/dist/slider.js +30 -4
- package/dist/space.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/switch.cjs +18 -1
- package/dist/switch.js +19 -2
- package/dist/table.cjs +20 -1
- package/dist/table.js +26 -7
- package/dist/tabs-underline.cjs +21 -1
- package/dist/tabs-underline.js +23 -3
- package/dist/tabs.cjs +22 -1
- package/dist/tabs.js +24 -3
- package/dist/textarea-CG7iQcb3.cjs +14 -0
- package/dist/textarea-CUPWKl-S.js +32 -0
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/toaster.cjs +4 -1
- package/dist/toaster.js +9 -6
- package/dist/toggle.cjs +17 -1
- package/dist/toggle.js +25 -9
- package/dist/tooltip.cjs +16 -1
- package/dist/tooltip.js +22 -2
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +6 -6
- package/docs/AI-GUIDE.md +321 -321
- package/docs/components/layout/sidebar.md +404 -404
- package/docs/components/layout/toaster.md +436 -436
- package/docs/components/ui/accordion-rounded.md +583 -583
- package/docs/components/ui/accordion.md +267 -267
- package/docs/components/ui/alert.md +671 -671
- package/docs/components/ui/avatar.md +588 -588
- package/docs/components/ui/badge.md +1024 -1024
- package/docs/components/ui/button-group.md +1002 -1002
- package/docs/components/ui/button.md +1078 -1078
- package/docs/components/ui/calendar.md +1159 -1159
- package/docs/components/ui/card.md +1265 -1265
- package/docs/components/ui/checkbox.md +292 -292
- package/docs/components/ui/collapsible.md +320 -320
- package/docs/components/ui/command.md +454 -454
- package/docs/components/ui/context-menu.md +540 -540
- package/docs/components/ui/dialog.md +628 -628
- package/docs/components/ui/dropdown-menu.md +731 -731
- package/docs/components/ui/field.md +706 -706
- package/docs/components/ui/hover-card.md +446 -446
- package/docs/components/ui/input-group.md +509 -509
- package/docs/components/ui/input.md +362 -362
- package/docs/components/ui/kbd.md +434 -434
- package/docs/components/ui/label.md +359 -359
- package/docs/components/ui/pagination.md +650 -650
- package/docs/components/ui/popover.md +536 -536
- package/docs/components/ui/progress.md +182 -182
- package/docs/components/ui/radio-group.md +311 -311
- package/docs/components/ui/select.md +352 -352
- package/docs/components/ui/separator.md +214 -214
- package/docs/components/ui/sheet.md +142 -142
- package/docs/components/ui/skeleton.md +140 -140
- package/docs/components/ui/slider.md +341 -341
- package/docs/components/ui/spinner.md +170 -170
- package/docs/components/ui/switch.md +402 -402
- package/docs/components/ui/table.md +183 -183
- package/docs/components/ui/tabs-underline.md +106 -106
- package/docs/components/ui/tabs.md +122 -122
- package/docs/components/ui/textarea.md +243 -243
- package/docs/components/ui/toggle.md +243 -243
- package/docs/components/ui/tooltip.md +320 -320
- package/docs/components/ui/typography.md +191 -191
- package/package.json +7 -1
- package/dist/button-2GdKenQI.js +0 -58
- package/dist/button-DEQVHMrX.cjs +0 -1
- package/dist/input-BF73maXg.cjs +0 -1
- package/dist/input-C04hsVXE.js +0 -22
- package/dist/sheet-B-9YHdR5.js +0 -128
- package/dist/sheet-CU-sFSaJ.cjs +0 -1
- package/dist/textarea-3ZdbFRDN.cjs +0 -1
- package/dist/textarea-BZbcAAAu.js +0 -19
|
@@ -1,671 +1,671 @@
|
|
|
1
|
-
# Alert Component
|
|
2
|
-
|
|
3
|
-
## Descripción
|
|
4
|
-
|
|
5
|
-
Componente versátil para mostrar **mensajes importantes** que requieren la atención del usuario. Usa un sistema de grid inteligente para iconos opcionales, soporta 4 variantes de color, y permite contenido rico con botones, listas, progress bars y más.
|
|
6
|
-
|
|
7
|
-
## Características
|
|
8
|
-
|
|
9
|
-
- ✅ 4 variantes visuales (default, destructive, success, warning)
|
|
10
|
-
- ✅ Grid automático para iconos opcionales
|
|
11
|
-
- ✅ Soporta título solo, descripción solo, o ambos
|
|
12
|
-
- ✅ Contenido rico: botones, progress, checkboxes, badges
|
|
13
|
-
- ✅ Rol ARIA "alert" para accesibilidad
|
|
14
|
-
- ✅ Iconos auto-dimensionados (size-4)
|
|
15
|
-
- ✅ Line clamp en títulos largos
|
|
16
|
-
- ✅ Sistema de slots para composición
|
|
17
|
-
|
|
18
|
-
## Importación
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
import {
|
|
22
|
-
Alert,
|
|
23
|
-
AlertTitle,
|
|
24
|
-
AlertDescription,
|
|
25
|
-
} from "@adamosuiteservices/ui/alert";
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Uso Básico
|
|
29
|
-
|
|
30
|
-
### Alert Completo (Icono + Título + Descripción)
|
|
31
|
-
|
|
32
|
-
```tsx
|
|
33
|
-
import { InfoIcon } from "lucide-react";
|
|
34
|
-
|
|
35
|
-
<Alert>
|
|
36
|
-
<InfoIcon />
|
|
37
|
-
<AlertTitle>Heads up!</AlertTitle>
|
|
38
|
-
<AlertDescription>
|
|
39
|
-
You can add components and dependencies to your app using the cli.
|
|
40
|
-
</AlertDescription>
|
|
41
|
-
</Alert>;
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Solo Título con Icono
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
import { CheckCircle2Icon } from "lucide-react";
|
|
48
|
-
|
|
49
|
-
<Alert variant="success">
|
|
50
|
-
<CheckCircle2Icon />
|
|
51
|
-
<AlertTitle>Your order has been processed!</AlertTitle>
|
|
52
|
-
</Alert>;
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Solo Descripción con Icono
|
|
56
|
-
|
|
57
|
-
```tsx
|
|
58
|
-
import { InfoIcon } from "lucide-react";
|
|
59
|
-
|
|
60
|
-
<Alert>
|
|
61
|
-
<InfoIcon />
|
|
62
|
-
<AlertDescription>
|
|
63
|
-
This is an alert with only a description. Sometimes you don't need a title.
|
|
64
|
-
</AlertDescription>
|
|
65
|
-
</Alert>;
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Sin Icono
|
|
69
|
-
|
|
70
|
-
```tsx
|
|
71
|
-
<Alert>
|
|
72
|
-
<AlertTitle>Update available</AlertTitle>
|
|
73
|
-
<AlertDescription>
|
|
74
|
-
A new software update is available. You can now update your app.
|
|
75
|
-
</AlertDescription>
|
|
76
|
-
</Alert>
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Variantes
|
|
80
|
-
|
|
81
|
-
### Default (Información General)
|
|
82
|
-
|
|
83
|
-
Para mensajes informativos neutrales:
|
|
84
|
-
|
|
85
|
-
```tsx
|
|
86
|
-
import { InfoIcon } from "lucide-react";
|
|
87
|
-
|
|
88
|
-
<Alert variant="default">
|
|
89
|
-
<InfoIcon />
|
|
90
|
-
<AlertTitle>Default variant</AlertTitle>
|
|
91
|
-
<AlertDescription>
|
|
92
|
-
This is the default alert variant for general information.
|
|
93
|
-
</AlertDescription>
|
|
94
|
-
</Alert>;
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
**Estilos aplicados**:
|
|
98
|
-
|
|
99
|
-
- Fondo: `bg-card` (blanco/gris claro según tema)
|
|
100
|
-
- Texto: `text-card-foreground`
|
|
101
|
-
- Uso: Información general, tips, avisos neutrales
|
|
102
|
-
|
|
103
|
-
### Success (Operaciones Exitosas)
|
|
104
|
-
|
|
105
|
-
Para confirmaciones y feedback positivo:
|
|
106
|
-
|
|
107
|
-
```tsx
|
|
108
|
-
import { CheckCircle2Icon } from "lucide-react";
|
|
109
|
-
|
|
110
|
-
<Alert variant="success">
|
|
111
|
-
<CheckCircle2Icon />
|
|
112
|
-
<AlertTitle>Success</AlertTitle>
|
|
113
|
-
<AlertDescription>
|
|
114
|
-
Your changes have been saved successfully.
|
|
115
|
-
</AlertDescription>
|
|
116
|
-
</Alert>;
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
**Estilos aplicados**:
|
|
120
|
-
|
|
121
|
-
- Fondo: `bg-success-50` (verde claro)
|
|
122
|
-
- Texto título/icono: `text-success` (verde)
|
|
123
|
-
- Texto descripción: `text-success/90` (verde 90% opacidad)
|
|
124
|
-
- Uso: Confirmaciones, operaciones completadas, validaciones exitosas
|
|
125
|
-
|
|
126
|
-
### Warning (Advertencias)
|
|
127
|
-
|
|
128
|
-
Para mensajes de precaución que requieren atención:
|
|
129
|
-
|
|
130
|
-
```tsx
|
|
131
|
-
import { AlertTriangleIcon } from "lucide-react";
|
|
132
|
-
|
|
133
|
-
<Alert variant="warning">
|
|
134
|
-
<AlertTriangleIcon />
|
|
135
|
-
<AlertTitle>Warning</AlertTitle>
|
|
136
|
-
<AlertDescription>
|
|
137
|
-
Your storage is running low. Consider upgrading your plan.
|
|
138
|
-
</AlertDescription>
|
|
139
|
-
</Alert>;
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
**Estilos aplicados**:
|
|
143
|
-
|
|
144
|
-
- Fondo: `bg-warning-50` (naranja/amarillo claro)
|
|
145
|
-
- Texto título/icono: `text-warning` (naranja/amarillo)
|
|
146
|
-
- Texto descripción: `text-warning/90`
|
|
147
|
-
- Uso: Advertencias, límites cercanos, acciones recomendadas
|
|
148
|
-
|
|
149
|
-
### Destructive (Errores Críticos)
|
|
150
|
-
|
|
151
|
-
Para errores, fallos y mensajes críticos:
|
|
152
|
-
|
|
153
|
-
```tsx
|
|
154
|
-
import { XCircleIcon } from "lucide-react";
|
|
155
|
-
|
|
156
|
-
<Alert variant="destructive">
|
|
157
|
-
<XCircleIcon />
|
|
158
|
-
<AlertTitle>Error</AlertTitle>
|
|
159
|
-
<AlertDescription>
|
|
160
|
-
Your session has expired. Please log in again.
|
|
161
|
-
</AlertDescription>
|
|
162
|
-
</Alert>;
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
**Estilos aplicados**:
|
|
166
|
-
|
|
167
|
-
- Fondo: `bg-destructive-50` (rojo claro)
|
|
168
|
-
- Texto título/icono: `text-destructive` (rojo)
|
|
169
|
-
- Texto descripción: `text-destructive/90`
|
|
170
|
-
- Uso: Errores, fallos de validación, acciones bloqueadas
|
|
171
|
-
|
|
172
|
-
## Props
|
|
173
|
-
|
|
174
|
-
### Alert (Root)
|
|
175
|
-
|
|
176
|
-
Contenedor principal del alert con rol ARIA.
|
|
177
|
-
|
|
178
|
-
| Prop | Tipo | Default | Descripción |
|
|
179
|
-
| --------- | ------------------------------------------------------ | ----------- | -------------------------------------- |
|
|
180
|
-
| variant | `"default" \| "destructive" \| "success" \| "warning"` | `"default"` | Variante visual del alert |
|
|
181
|
-
| className | `string` | - | Clases CSS adicionales |
|
|
182
|
-
| children | `ReactNode` | - | Contenido (icono, título, descripción) |
|
|
183
|
-
| ...props | `HTMLAttributes<HTMLDivElement>` | - | Props nativas de div |
|
|
184
|
-
|
|
185
|
-
**Atributos aplicados automáticamente**:
|
|
186
|
-
|
|
187
|
-
- `data-slot="alert"`: Para identificación interna
|
|
188
|
-
- `role="alert"`: Accesibilidad ARIA
|
|
189
|
-
|
|
190
|
-
### AlertTitle
|
|
191
|
-
|
|
192
|
-
Título del alert con line clamp automático.
|
|
193
|
-
|
|
194
|
-
| Prop | Tipo | Descripción |
|
|
195
|
-
| --------- | -------------------------------- | ---------------------------- |
|
|
196
|
-
| className | `string` | Clases CSS adicionales |
|
|
197
|
-
| children | `ReactNode` | Texto o contenido del título |
|
|
198
|
-
| ...props | `HTMLAttributes<HTMLDivElement>` | Props nativas de div |
|
|
199
|
-
|
|
200
|
-
**Características**:
|
|
201
|
-
|
|
202
|
-
- `line-clamp-1`: Trunca automáticamente textos largos
|
|
203
|
-
- `font-medium`: Peso de fuente medium
|
|
204
|
-
- `tracking-tight`: Letter spacing ajustado
|
|
205
|
-
- `min-h-4`: Altura mínima de 1rem
|
|
206
|
-
- `col-start-2`: Inicia en segunda columna del grid (después del icono)
|
|
207
|
-
|
|
208
|
-
### AlertDescription
|
|
209
|
-
|
|
210
|
-
Contenedor de la descripción con soporte para contenido rico.
|
|
211
|
-
|
|
212
|
-
| Prop | Tipo | Descripción |
|
|
213
|
-
| --------- | -------------------------------- | ---------------------------------------- |
|
|
214
|
-
| className | `string` | Clases CSS adicionales |
|
|
215
|
-
| children | `ReactNode` | Contenido (texto, listas, botones, etc.) |
|
|
216
|
-
| ...props | `HTMLAttributes<HTMLDivElement>` | Props nativas de div |
|
|
217
|
-
|
|
218
|
-
**Características**:
|
|
219
|
-
|
|
220
|
-
- `text-muted-foreground`: Color de texto secundario (sobrescrito por variantes)
|
|
221
|
-
- `grid`: Contenedor grid interno
|
|
222
|
-
- `justify-items-start`: Alinea items a la izquierda
|
|
223
|
-
- `gap-1`: Espaciado de 0.25rem entre elementos
|
|
224
|
-
- `[&_p]:leading-relaxed`: Line height relajado para párrafos
|
|
225
|
-
- `col-start-2`: Inicia en segunda columna del grid
|
|
226
|
-
|
|
227
|
-
## Sistema de Grid Inteligente
|
|
228
|
-
|
|
229
|
-
El Alert usa CSS Grid con **detección automática de iconos**:
|
|
230
|
-
|
|
231
|
-
### Sin Icono
|
|
232
|
-
|
|
233
|
-
```css
|
|
234
|
-
grid-cols-[0_1fr]
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
- Columna 1: 0px (oculta)
|
|
238
|
-
- Columna 2: Todo el espacio disponible
|
|
239
|
-
|
|
240
|
-
### Con Icono
|
|
241
|
-
|
|
242
|
-
```css
|
|
243
|
-
grid-cols-[calc(var(--adm-spacing)*4)_1fr]
|
|
244
|
-
has-[>svg]:gap-x-3
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
- Columna 1: 1rem (16px) para icono
|
|
248
|
-
- Columna 2: Todo el espacio restante
|
|
249
|
-
- Gap horizontal: 0.75rem (12px)
|
|
250
|
-
|
|
251
|
-
**Selector automático**: `has-[>svg]` detecta si hay un elemento SVG directo
|
|
252
|
-
|
|
253
|
-
### Estilos de Iconos
|
|
254
|
-
|
|
255
|
-
```css
|
|
256
|
-
[&>svg]:size-4 /* 16x16px */
|
|
257
|
-
[&>svg]:translate-y-0.5 /* Alineación vertical */
|
|
258
|
-
[&>svg]:text-current /* Hereda color de la variante */
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
## Ejemplos Avanzados
|
|
262
|
-
|
|
263
|
-
### Alert de Seguridad con Botones
|
|
264
|
-
|
|
265
|
-
```tsx
|
|
266
|
-
import { ShieldCheckIcon } from "lucide-react";
|
|
267
|
-
import { Button } from "@adamosuiteservices/ui/button";
|
|
268
|
-
|
|
269
|
-
<Alert variant="destructive">
|
|
270
|
-
<ShieldCheckIcon />
|
|
271
|
-
<AlertTitle>Security Notice: Suspicious Login Attempt</AlertTitle>
|
|
272
|
-
<AlertDescription>
|
|
273
|
-
<p>We detected a login attempt from an unrecognized device:</p>
|
|
274
|
-
<div className="mt-3 space-y-2 text-sm">
|
|
275
|
-
<div className="grid grid-cols-2 gap-2">
|
|
276
|
-
<span className="font-medium">Location:</span>
|
|
277
|
-
<span>San Francisco, CA</span>
|
|
278
|
-
<span className="font-medium">Device:</span>
|
|
279
|
-
<span>Chrome on Windows</span>
|
|
280
|
-
<span className="font-medium">Time:</span>
|
|
281
|
-
<span>2 minutes ago</span>
|
|
282
|
-
</div>
|
|
283
|
-
</div>
|
|
284
|
-
<div className="mt-4 flex gap-2">
|
|
285
|
-
<Button size="sm" variant="destructive">
|
|
286
|
-
Secure Account
|
|
287
|
-
</Button>
|
|
288
|
-
<Button size="sm" variant="outline">
|
|
289
|
-
This was me
|
|
290
|
-
</Button>
|
|
291
|
-
</div>
|
|
292
|
-
</AlertDescription>
|
|
293
|
-
</Alert>;
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### Estado del Sistema con Progress
|
|
297
|
-
|
|
298
|
-
```tsx
|
|
299
|
-
import { WifiOffIcon } from "lucide-react";
|
|
300
|
-
import { Progress } from "@adamosuiteservices/ui/progress";
|
|
301
|
-
|
|
302
|
-
<Alert variant="destructive">
|
|
303
|
-
<WifiOffIcon />
|
|
304
|
-
<AlertTitle>Service outage detected</AlertTitle>
|
|
305
|
-
<AlertDescription>
|
|
306
|
-
<p>We're experiencing connectivity issues with our primary data center.</p>
|
|
307
|
-
<div className="mt-3">
|
|
308
|
-
<div className="flex gap-2 items-center justify-between mb-2">
|
|
309
|
-
<span className="text-sm">Recovery Progress</span>
|
|
310
|
-
<span className="text-sm">75%</span>
|
|
311
|
-
</div>
|
|
312
|
-
<Progress value={75} variant="destructive" className="h-2" />
|
|
313
|
-
</div>
|
|
314
|
-
<p className="mt-2 text-sm">Estimated resolution: 15 minutes</p>
|
|
315
|
-
</AlertDescription>
|
|
316
|
-
</Alert>;
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### Notificación con Iconos Secundarios
|
|
320
|
-
|
|
321
|
-
```tsx
|
|
322
|
-
import { CalendarIcon, ClockIcon, MapPinIcon, UsersIcon } from "lucide-react";
|
|
323
|
-
|
|
324
|
-
<Alert>
|
|
325
|
-
<CalendarIcon />
|
|
326
|
-
<AlertTitle>Meeting reminder</AlertTitle>
|
|
327
|
-
<AlertDescription>
|
|
328
|
-
<p>Your meeting with the design team starts in 15 minutes.</p>
|
|
329
|
-
<div className="mt-3 space-y-1 text-sm">
|
|
330
|
-
<div className="flex items-center gap-2">
|
|
331
|
-
<ClockIcon className="h-3 w-3" />
|
|
332
|
-
<span>3:00 PM - 4:00 PM</span>
|
|
333
|
-
</div>
|
|
334
|
-
<div className="flex items-center gap-2">
|
|
335
|
-
<MapPinIcon className="h-3 w-3" />
|
|
336
|
-
<span>Conference Room B</span>
|
|
337
|
-
</div>
|
|
338
|
-
<div className="flex items-center gap-2">
|
|
339
|
-
<UsersIcon className="h-3 w-3" />
|
|
340
|
-
<span>5 attendees</span>
|
|
341
|
-
</div>
|
|
342
|
-
</div>
|
|
343
|
-
</AlertDescription>
|
|
344
|
-
</Alert>;
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
### Alert de Performance con Métricas
|
|
348
|
-
|
|
349
|
-
```tsx
|
|
350
|
-
import { ZapIcon } from "lucide-react";
|
|
351
|
-
|
|
352
|
-
<Alert variant="success">
|
|
353
|
-
<ZapIcon />
|
|
354
|
-
<AlertTitle>Performance optimized</AlertTitle>
|
|
355
|
-
<AlertDescription>
|
|
356
|
-
<p>Your application performance has been automatically optimized.</p>
|
|
357
|
-
<div className="mt-3 grid grid-cols-2 gap-2 text-sm">
|
|
358
|
-
<div className="flex gap-4 justify-between">
|
|
359
|
-
<span>Load time:</span>
|
|
360
|
-
<span className="text-green-600">-45%</span>
|
|
361
|
-
</div>
|
|
362
|
-
<div className="flex gap-4 justify-between">
|
|
363
|
-
<span>Memory usage:</span>
|
|
364
|
-
<span className="text-green-600">-23%</span>
|
|
365
|
-
</div>
|
|
366
|
-
<div className="flex gap-4 justify-between">
|
|
367
|
-
<span>CPU usage:</span>
|
|
368
|
-
<span className="text-green-600">-31%</span>
|
|
369
|
-
</div>
|
|
370
|
-
<div className="flex gap-4 justify-between">
|
|
371
|
-
<span>Battery life:</span>
|
|
372
|
-
<span className="text-green-600">+18%</span>
|
|
373
|
-
</div>
|
|
374
|
-
</div>
|
|
375
|
-
</AlertDescription>
|
|
376
|
-
</Alert>;
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
### Almacenamiento con Progreso y Acciones
|
|
380
|
-
|
|
381
|
-
```tsx
|
|
382
|
-
import { AlertTriangleIcon } from "lucide-react";
|
|
383
|
-
import { Progress } from "@adamosuiteservices/ui/progress";
|
|
384
|
-
import { Button } from "@adamosuiteservices/ui/button";
|
|
385
|
-
|
|
386
|
-
<Alert variant="warning">
|
|
387
|
-
<AlertTriangleIcon />
|
|
388
|
-
<AlertTitle>Storage almost full</AlertTitle>
|
|
389
|
-
<AlertDescription>
|
|
390
|
-
<p>
|
|
391
|
-
Your storage is 89% full. Consider cleaning up files or upgrading your
|
|
392
|
-
plan.
|
|
393
|
-
</p>
|
|
394
|
-
<div className="mt-3 space-y-2 text-sm">
|
|
395
|
-
<div className="flex justify-between">
|
|
396
|
-
<span>Used space:</span>
|
|
397
|
-
<span>89.2 GB of 100 GB</span>
|
|
398
|
-
</div>
|
|
399
|
-
<Progress value={89} variant="warning" className="h-2" />
|
|
400
|
-
<div className="grid grid-cols-2 gap-4 mt-3">
|
|
401
|
-
<div>
|
|
402
|
-
<p className="font-medium">Largest folders:</p>
|
|
403
|
-
<ul className="mt-1 space-y-1">
|
|
404
|
-
<li>Photos: 45.2 GB</li>
|
|
405
|
-
<li>Videos: 23.8 GB</li>
|
|
406
|
-
<li>Documents: 12.1 GB</li>
|
|
407
|
-
</ul>
|
|
408
|
-
</div>
|
|
409
|
-
<div className="space-y-2">
|
|
410
|
-
<Button size="sm" className="w-full">
|
|
411
|
-
Upgrade Storage
|
|
412
|
-
</Button>
|
|
413
|
-
<Button size="sm" variant="outline" className="w-full">
|
|
414
|
-
Clean Up Files
|
|
415
|
-
</Button>
|
|
416
|
-
</div>
|
|
417
|
-
</div>
|
|
418
|
-
</div>
|
|
419
|
-
</AlertDescription>
|
|
420
|
-
</Alert>;
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
### E-commerce: Orden Enviada
|
|
424
|
-
|
|
425
|
-
```tsx
|
|
426
|
-
import { TruckIcon } from "lucide-react";
|
|
427
|
-
import { Button } from "@adamosuiteservices/ui/button";
|
|
428
|
-
|
|
429
|
-
<Alert variant="success">
|
|
430
|
-
<TruckIcon />
|
|
431
|
-
<AlertTitle>Order shipped!</AlertTitle>
|
|
432
|
-
<AlertDescription>
|
|
433
|
-
<p>Your order #12345 has been shipped and is on its way to you.</p>
|
|
434
|
-
<div className="mt-3 space-y-1 text-sm">
|
|
435
|
-
<div className="flex gap-4 justify-between">
|
|
436
|
-
<span>Tracking number:</span>
|
|
437
|
-
<span className="font-mono">1Z999AA1234567890</span>
|
|
438
|
-
</div>
|
|
439
|
-
<div className="flex gap-4 justify-between">
|
|
440
|
-
<span>Estimated delivery:</span>
|
|
441
|
-
<span>Tomorrow, Oct 26</span>
|
|
442
|
-
</div>
|
|
443
|
-
<div className="flex gap-4 justify-between">
|
|
444
|
-
<span>Carrier:</span>
|
|
445
|
-
<span>UPS</span>
|
|
446
|
-
</div>
|
|
447
|
-
</div>
|
|
448
|
-
<Button size="sm" className="mt-3">
|
|
449
|
-
Track Package
|
|
450
|
-
</Button>
|
|
451
|
-
</AlertDescription>
|
|
452
|
-
</Alert>;
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
### Alert Interactivo con Checkboxes
|
|
456
|
-
|
|
457
|
-
```tsx
|
|
458
|
-
import { ShieldCheckIcon } from "lucide-react";
|
|
459
|
-
import { Badge } from "@adamosuiteservices/ui/badge";
|
|
460
|
-
import { Checkbox } from "@adamosuiteservices/ui/checkbox";
|
|
461
|
-
import { Button } from "@adamosuiteservices/ui/button";
|
|
462
|
-
|
|
463
|
-
<Alert>
|
|
464
|
-
<ShieldCheckIcon />
|
|
465
|
-
<AlertTitle>Cookie preferences</AlertTitle>
|
|
466
|
-
<AlertDescription>
|
|
467
|
-
<p>We use cookies to improve your experience and analyze site usage.</p>
|
|
468
|
-
<div className="mt-3 space-y-3">
|
|
469
|
-
<div className="space-y-2">
|
|
470
|
-
<div className="flex items-center justify-between">
|
|
471
|
-
<span className="text-sm">Essential cookies</span>
|
|
472
|
-
<Badge variant="secondary">Required</Badge>
|
|
473
|
-
</div>
|
|
474
|
-
<div className="flex items-center justify-between">
|
|
475
|
-
<span className="text-sm">Analytics cookies</span>
|
|
476
|
-
<Checkbox defaultChecked className="rounded" />
|
|
477
|
-
</div>
|
|
478
|
-
<div className="flex items-center justify-between">
|
|
479
|
-
<span className="text-sm">Marketing cookies</span>
|
|
480
|
-
<Checkbox className="rounded" />
|
|
481
|
-
</div>
|
|
482
|
-
</div>
|
|
483
|
-
<div className="flex gap-2">
|
|
484
|
-
<Button size="sm">Accept All</Button>
|
|
485
|
-
<Button size="sm" variant="outline">
|
|
486
|
-
Save Preferences
|
|
487
|
-
</Button>
|
|
488
|
-
<Button size="sm" variant="ghost">
|
|
489
|
-
Reject All
|
|
490
|
-
</Button>
|
|
491
|
-
</div>
|
|
492
|
-
</div>
|
|
493
|
-
</AlertDescription>
|
|
494
|
-
</Alert>;
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
### Update con Lista y Botones
|
|
498
|
-
|
|
499
|
-
```tsx
|
|
500
|
-
import { DownloadIcon } from "lucide-react";
|
|
501
|
-
import { Button } from "@adamosuiteservices/ui/button";
|
|
502
|
-
|
|
503
|
-
<Alert>
|
|
504
|
-
<DownloadIcon />
|
|
505
|
-
<AlertTitle>App update available</AlertTitle>
|
|
506
|
-
<AlertDescription>
|
|
507
|
-
<p>
|
|
508
|
-
Version 2.1.0 is now available with bug fixes and performance
|
|
509
|
-
improvements.
|
|
510
|
-
</p>
|
|
511
|
-
<div className="mt-3 space-y-2">
|
|
512
|
-
<div className="text-sm">
|
|
513
|
-
<p className="font-medium">What's new:</p>
|
|
514
|
-
<ul className="list-disc list-inside mt-1 space-y-1">
|
|
515
|
-
<li>Improved loading times</li>
|
|
516
|
-
<li>Fixed dark mode issues</li>
|
|
517
|
-
<li>Enhanced security</li>
|
|
518
|
-
</ul>
|
|
519
|
-
</div>
|
|
520
|
-
<div className="flex gap-2">
|
|
521
|
-
<Button size="sm">Update Now</Button>
|
|
522
|
-
<Button size="sm" variant="outline">
|
|
523
|
-
Remind Me Later
|
|
524
|
-
</Button>
|
|
525
|
-
<Button size="sm" variant="ghost">
|
|
526
|
-
Skip This Version
|
|
527
|
-
</Button>
|
|
528
|
-
</div>
|
|
529
|
-
</div>
|
|
530
|
-
</AlertDescription>
|
|
531
|
-
</Alert>;
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
## Casos de Uso Comunes
|
|
535
|
-
|
|
536
|
-
### Validación de Formularios
|
|
537
|
-
|
|
538
|
-
```tsx
|
|
539
|
-
<Alert variant="destructive">
|
|
540
|
-
<XCircleIcon />
|
|
541
|
-
<AlertTitle>Form validation failed</AlertTitle>
|
|
542
|
-
<AlertDescription>
|
|
543
|
-
Please correct the following errors before submitting.
|
|
544
|
-
</AlertDescription>
|
|
545
|
-
</Alert>
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
### Confirmación de Acción
|
|
549
|
-
|
|
550
|
-
```tsx
|
|
551
|
-
<Alert variant="success">
|
|
552
|
-
<CheckCircle2Icon />
|
|
553
|
-
<AlertTitle>Profile updated</AlertTitle>
|
|
554
|
-
<AlertDescription>
|
|
555
|
-
Your changes have been saved successfully.
|
|
556
|
-
</AlertDescription>
|
|
557
|
-
</Alert>
|
|
558
|
-
```
|
|
559
|
-
|
|
560
|
-
### Mantenimiento Programado
|
|
561
|
-
|
|
562
|
-
```tsx
|
|
563
|
-
<Alert variant="warning">
|
|
564
|
-
<AlertTriangleIcon />
|
|
565
|
-
<AlertTitle>Planned maintenance scheduled</AlertTitle>
|
|
566
|
-
<AlertDescription>
|
|
567
|
-
System maintenance tonight from 2:00 AM to 4:00 AM PST.
|
|
568
|
-
</AlertDescription>
|
|
569
|
-
</Alert>
|
|
570
|
-
```
|
|
571
|
-
|
|
572
|
-
### Sistema Operativo
|
|
573
|
-
|
|
574
|
-
```tsx
|
|
575
|
-
<Alert variant="success">
|
|
576
|
-
<ServerIcon />
|
|
577
|
-
<AlertTitle>All systems operational</AlertTitle>
|
|
578
|
-
<AlertDescription>
|
|
579
|
-
All services running normally. No issues detected.
|
|
580
|
-
</AlertDescription>
|
|
581
|
-
</Alert>
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
### Información de Backup
|
|
585
|
-
|
|
586
|
-
```tsx
|
|
587
|
-
<Alert>
|
|
588
|
-
<ArchiveIcon />
|
|
589
|
-
<AlertTitle>Backup completed</AlertTitle>
|
|
590
|
-
<AlertDescription>
|
|
591
|
-
Daily backup completed. 1,247 files backed up to cloud storage.
|
|
592
|
-
</AlertDescription>
|
|
593
|
-
</Alert>
|
|
594
|
-
```
|
|
595
|
-
|
|
596
|
-
## Mejores Prácticas
|
|
597
|
-
|
|
598
|
-
### Iconos Recomendados (lucide-react)
|
|
599
|
-
|
|
600
|
-
- **Default**: `InfoIcon`, `BellIcon`, `MailIcon`
|
|
601
|
-
- **Success**: `CheckCircle2Icon`, `CheckIcon`, `ShieldCheckIcon`
|
|
602
|
-
- **Warning**: `AlertTriangleIcon`, `AlertCircleIcon`
|
|
603
|
-
- **Destructive**: `XCircleIcon`, `AlertTriangleIcon`, `ShieldAlertIcon`
|
|
604
|
-
|
|
605
|
-
### Estructura de Contenido
|
|
606
|
-
|
|
607
|
-
```tsx
|
|
608
|
-
<Alert variant="...">
|
|
609
|
-
{/* 1. Icono (opcional, directo como hijo) */}
|
|
610
|
-
<IconComponent />
|
|
611
|
-
|
|
612
|
-
{/* 2. Título (opcional, breve y descriptivo) */}
|
|
613
|
-
<AlertTitle>Short descriptive title</AlertTitle>
|
|
614
|
-
|
|
615
|
-
{/* 3. Descripción (puede incluir contenido rico) */}
|
|
616
|
-
<AlertDescription>
|
|
617
|
-
<p>Main message goes here.</p>
|
|
618
|
-
{/* Contenido adicional: listas, botones, progress, etc. */}
|
|
619
|
-
</AlertDescription>
|
|
620
|
-
</Alert>
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
### Cuándo Usar Cada Variante
|
|
624
|
-
|
|
625
|
-
- **default**: Información general, notificaciones neutras
|
|
626
|
-
- **success**: Confirmaciones, operaciones completadas con éxito
|
|
627
|
-
- **warning**: Advertencias, límites próximos, acciones recomendadas
|
|
628
|
-
- **destructive**: Errores críticos, fallos de validación, acciones bloqueadas
|
|
629
|
-
|
|
630
|
-
### Acciones en Alerts
|
|
631
|
-
|
|
632
|
-
Para alerts con botones de acción:
|
|
633
|
-
|
|
634
|
-
```tsx
|
|
635
|
-
<AlertDescription>
|
|
636
|
-
<p>Message text</p>
|
|
637
|
-
<div className="mt-3 flex gap-2">
|
|
638
|
-
<Button size="sm">Primary Action</Button>
|
|
639
|
-
<Button size="sm" variant="outline">
|
|
640
|
-
Secondary
|
|
641
|
-
</Button>
|
|
642
|
-
</div>
|
|
643
|
-
</AlertDescription>
|
|
644
|
-
```
|
|
645
|
-
|
|
646
|
-
## Notas de Implementación
|
|
647
|
-
|
|
648
|
-
- Basado en CVA (class-variance-authority) para variantes
|
|
649
|
-
- Grid con selector CSS `has-[>svg]` para detección automática de iconos
|
|
650
|
-
- Usa sistema de slots con `data-slot` para composición
|
|
651
|
-
- Colores de variantes usan tokens CSS personalizados
|
|
652
|
-
- El icono debe ser hijo directo (no dentro de AlertTitle/AlertDescription)
|
|
653
|
-
- Padding horizontal: 1rem (px-4)
|
|
654
|
-
- Padding vertical: 0.75rem (py-3)
|
|
655
|
-
- Border radius: 0.5rem (rounded-lg)
|
|
656
|
-
|
|
657
|
-
## Accesibilidad
|
|
658
|
-
|
|
659
|
-
- ✅ Rol ARIA `role="alert"` aplicado automáticamente
|
|
660
|
-
- ✅ Screen readers anunciarán el contenido como alerta importante
|
|
661
|
-
- ✅ Contraste de colores cumple WCAG AA en todas las variantes
|
|
662
|
-
- ✅ Texto descriptivo en lugar de solo iconos
|
|
663
|
-
- ✅ Botones dentro de alerts mantienen navegación por teclado
|
|
664
|
-
- ⚠️ Para alerts dinámicos (que aparecen después de carga), considera usar `role="status"` o `aria-live="polite"` si no son urgentes
|
|
665
|
-
|
|
666
|
-
## Referencias
|
|
667
|
-
|
|
668
|
-
- Radix UI primitives: https://www.radix-ui.com/
|
|
669
|
-
- shadcn/ui Alert: https://ui.shadcn.com/docs/components/alert
|
|
670
|
-
- ARIA alert role: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role
|
|
671
|
-
- Lucide Icons: https://lucide.dev/
|
|
1
|
+
# Alert Component
|
|
2
|
+
|
|
3
|
+
## Descripción
|
|
4
|
+
|
|
5
|
+
Componente versátil para mostrar **mensajes importantes** que requieren la atención del usuario. Usa un sistema de grid inteligente para iconos opcionales, soporta 4 variantes de color, y permite contenido rico con botones, listas, progress bars y más.
|
|
6
|
+
|
|
7
|
+
## Características
|
|
8
|
+
|
|
9
|
+
- ✅ 4 variantes visuales (default, destructive, success, warning)
|
|
10
|
+
- ✅ Grid automático para iconos opcionales
|
|
11
|
+
- ✅ Soporta título solo, descripción solo, o ambos
|
|
12
|
+
- ✅ Contenido rico: botones, progress, checkboxes, badges
|
|
13
|
+
- ✅ Rol ARIA "alert" para accesibilidad
|
|
14
|
+
- ✅ Iconos auto-dimensionados (size-4)
|
|
15
|
+
- ✅ Line clamp en títulos largos
|
|
16
|
+
- ✅ Sistema de slots para composición
|
|
17
|
+
|
|
18
|
+
## Importación
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import {
|
|
22
|
+
Alert,
|
|
23
|
+
AlertTitle,
|
|
24
|
+
AlertDescription,
|
|
25
|
+
} from "@adamosuiteservices/ui/alert";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Uso Básico
|
|
29
|
+
|
|
30
|
+
### Alert Completo (Icono + Título + Descripción)
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { InfoIcon } from "lucide-react";
|
|
34
|
+
|
|
35
|
+
<Alert>
|
|
36
|
+
<InfoIcon />
|
|
37
|
+
<AlertTitle>Heads up!</AlertTitle>
|
|
38
|
+
<AlertDescription>
|
|
39
|
+
You can add components and dependencies to your app using the cli.
|
|
40
|
+
</AlertDescription>
|
|
41
|
+
</Alert>;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Solo Título con Icono
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { CheckCircle2Icon } from "lucide-react";
|
|
48
|
+
|
|
49
|
+
<Alert variant="success">
|
|
50
|
+
<CheckCircle2Icon />
|
|
51
|
+
<AlertTitle>Your order has been processed!</AlertTitle>
|
|
52
|
+
</Alert>;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Solo Descripción con Icono
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { InfoIcon } from "lucide-react";
|
|
59
|
+
|
|
60
|
+
<Alert>
|
|
61
|
+
<InfoIcon />
|
|
62
|
+
<AlertDescription>
|
|
63
|
+
This is an alert with only a description. Sometimes you don't need a title.
|
|
64
|
+
</AlertDescription>
|
|
65
|
+
</Alert>;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Sin Icono
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<Alert>
|
|
72
|
+
<AlertTitle>Update available</AlertTitle>
|
|
73
|
+
<AlertDescription>
|
|
74
|
+
A new software update is available. You can now update your app.
|
|
75
|
+
</AlertDescription>
|
|
76
|
+
</Alert>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Variantes
|
|
80
|
+
|
|
81
|
+
### Default (Información General)
|
|
82
|
+
|
|
83
|
+
Para mensajes informativos neutrales:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { InfoIcon } from "lucide-react";
|
|
87
|
+
|
|
88
|
+
<Alert variant="default">
|
|
89
|
+
<InfoIcon />
|
|
90
|
+
<AlertTitle>Default variant</AlertTitle>
|
|
91
|
+
<AlertDescription>
|
|
92
|
+
This is the default alert variant for general information.
|
|
93
|
+
</AlertDescription>
|
|
94
|
+
</Alert>;
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Estilos aplicados**:
|
|
98
|
+
|
|
99
|
+
- Fondo: `bg-card` (blanco/gris claro según tema)
|
|
100
|
+
- Texto: `text-card-foreground`
|
|
101
|
+
- Uso: Información general, tips, avisos neutrales
|
|
102
|
+
|
|
103
|
+
### Success (Operaciones Exitosas)
|
|
104
|
+
|
|
105
|
+
Para confirmaciones y feedback positivo:
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { CheckCircle2Icon } from "lucide-react";
|
|
109
|
+
|
|
110
|
+
<Alert variant="success">
|
|
111
|
+
<CheckCircle2Icon />
|
|
112
|
+
<AlertTitle>Success</AlertTitle>
|
|
113
|
+
<AlertDescription>
|
|
114
|
+
Your changes have been saved successfully.
|
|
115
|
+
</AlertDescription>
|
|
116
|
+
</Alert>;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Estilos aplicados**:
|
|
120
|
+
|
|
121
|
+
- Fondo: `bg-success-50` (verde claro)
|
|
122
|
+
- Texto título/icono: `text-success` (verde)
|
|
123
|
+
- Texto descripción: `text-success/90` (verde 90% opacidad)
|
|
124
|
+
- Uso: Confirmaciones, operaciones completadas, validaciones exitosas
|
|
125
|
+
|
|
126
|
+
### Warning (Advertencias)
|
|
127
|
+
|
|
128
|
+
Para mensajes de precaución que requieren atención:
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import { AlertTriangleIcon } from "lucide-react";
|
|
132
|
+
|
|
133
|
+
<Alert variant="warning">
|
|
134
|
+
<AlertTriangleIcon />
|
|
135
|
+
<AlertTitle>Warning</AlertTitle>
|
|
136
|
+
<AlertDescription>
|
|
137
|
+
Your storage is running low. Consider upgrading your plan.
|
|
138
|
+
</AlertDescription>
|
|
139
|
+
</Alert>;
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Estilos aplicados**:
|
|
143
|
+
|
|
144
|
+
- Fondo: `bg-warning-50` (naranja/amarillo claro)
|
|
145
|
+
- Texto título/icono: `text-warning` (naranja/amarillo)
|
|
146
|
+
- Texto descripción: `text-warning/90`
|
|
147
|
+
- Uso: Advertencias, límites cercanos, acciones recomendadas
|
|
148
|
+
|
|
149
|
+
### Destructive (Errores Críticos)
|
|
150
|
+
|
|
151
|
+
Para errores, fallos y mensajes críticos:
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import { XCircleIcon } from "lucide-react";
|
|
155
|
+
|
|
156
|
+
<Alert variant="destructive">
|
|
157
|
+
<XCircleIcon />
|
|
158
|
+
<AlertTitle>Error</AlertTitle>
|
|
159
|
+
<AlertDescription>
|
|
160
|
+
Your session has expired. Please log in again.
|
|
161
|
+
</AlertDescription>
|
|
162
|
+
</Alert>;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Estilos aplicados**:
|
|
166
|
+
|
|
167
|
+
- Fondo: `bg-destructive-50` (rojo claro)
|
|
168
|
+
- Texto título/icono: `text-destructive` (rojo)
|
|
169
|
+
- Texto descripción: `text-destructive/90`
|
|
170
|
+
- Uso: Errores, fallos de validación, acciones bloqueadas
|
|
171
|
+
|
|
172
|
+
## Props
|
|
173
|
+
|
|
174
|
+
### Alert (Root)
|
|
175
|
+
|
|
176
|
+
Contenedor principal del alert con rol ARIA.
|
|
177
|
+
|
|
178
|
+
| Prop | Tipo | Default | Descripción |
|
|
179
|
+
| --------- | ------------------------------------------------------ | ----------- | -------------------------------------- |
|
|
180
|
+
| variant | `"default" \| "destructive" \| "success" \| "warning"` | `"default"` | Variante visual del alert |
|
|
181
|
+
| className | `string` | - | Clases CSS adicionales |
|
|
182
|
+
| children | `ReactNode` | - | Contenido (icono, título, descripción) |
|
|
183
|
+
| ...props | `HTMLAttributes<HTMLDivElement>` | - | Props nativas de div |
|
|
184
|
+
|
|
185
|
+
**Atributos aplicados automáticamente**:
|
|
186
|
+
|
|
187
|
+
- `data-slot="alert"`: Para identificación interna
|
|
188
|
+
- `role="alert"`: Accesibilidad ARIA
|
|
189
|
+
|
|
190
|
+
### AlertTitle
|
|
191
|
+
|
|
192
|
+
Título del alert con line clamp automático.
|
|
193
|
+
|
|
194
|
+
| Prop | Tipo | Descripción |
|
|
195
|
+
| --------- | -------------------------------- | ---------------------------- |
|
|
196
|
+
| className | `string` | Clases CSS adicionales |
|
|
197
|
+
| children | `ReactNode` | Texto o contenido del título |
|
|
198
|
+
| ...props | `HTMLAttributes<HTMLDivElement>` | Props nativas de div |
|
|
199
|
+
|
|
200
|
+
**Características**:
|
|
201
|
+
|
|
202
|
+
- `line-clamp-1`: Trunca automáticamente textos largos
|
|
203
|
+
- `font-medium`: Peso de fuente medium
|
|
204
|
+
- `tracking-tight`: Letter spacing ajustado
|
|
205
|
+
- `min-h-4`: Altura mínima de 1rem
|
|
206
|
+
- `col-start-2`: Inicia en segunda columna del grid (después del icono)
|
|
207
|
+
|
|
208
|
+
### AlertDescription
|
|
209
|
+
|
|
210
|
+
Contenedor de la descripción con soporte para contenido rico.
|
|
211
|
+
|
|
212
|
+
| Prop | Tipo | Descripción |
|
|
213
|
+
| --------- | -------------------------------- | ---------------------------------------- |
|
|
214
|
+
| className | `string` | Clases CSS adicionales |
|
|
215
|
+
| children | `ReactNode` | Contenido (texto, listas, botones, etc.) |
|
|
216
|
+
| ...props | `HTMLAttributes<HTMLDivElement>` | Props nativas de div |
|
|
217
|
+
|
|
218
|
+
**Características**:
|
|
219
|
+
|
|
220
|
+
- `text-muted-foreground`: Color de texto secundario (sobrescrito por variantes)
|
|
221
|
+
- `grid`: Contenedor grid interno
|
|
222
|
+
- `justify-items-start`: Alinea items a la izquierda
|
|
223
|
+
- `gap-1`: Espaciado de 0.25rem entre elementos
|
|
224
|
+
- `[&_p]:leading-relaxed`: Line height relajado para párrafos
|
|
225
|
+
- `col-start-2`: Inicia en segunda columna del grid
|
|
226
|
+
|
|
227
|
+
## Sistema de Grid Inteligente
|
|
228
|
+
|
|
229
|
+
El Alert usa CSS Grid con **detección automática de iconos**:
|
|
230
|
+
|
|
231
|
+
### Sin Icono
|
|
232
|
+
|
|
233
|
+
```css
|
|
234
|
+
grid-cols-[0_1fr]
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
- Columna 1: 0px (oculta)
|
|
238
|
+
- Columna 2: Todo el espacio disponible
|
|
239
|
+
|
|
240
|
+
### Con Icono
|
|
241
|
+
|
|
242
|
+
```css
|
|
243
|
+
grid-cols-[calc(var(--adm-spacing)*4)_1fr]
|
|
244
|
+
has-[>svg]:gap-x-3
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
- Columna 1: 1rem (16px) para icono
|
|
248
|
+
- Columna 2: Todo el espacio restante
|
|
249
|
+
- Gap horizontal: 0.75rem (12px)
|
|
250
|
+
|
|
251
|
+
**Selector automático**: `has-[>svg]` detecta si hay un elemento SVG directo
|
|
252
|
+
|
|
253
|
+
### Estilos de Iconos
|
|
254
|
+
|
|
255
|
+
```css
|
|
256
|
+
[&>svg]:size-4 /* 16x16px */
|
|
257
|
+
[&>svg]:translate-y-0.5 /* Alineación vertical */
|
|
258
|
+
[&>svg]:text-current /* Hereda color de la variante */
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Ejemplos Avanzados
|
|
262
|
+
|
|
263
|
+
### Alert de Seguridad con Botones
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
import { ShieldCheckIcon } from "lucide-react";
|
|
267
|
+
import { Button } from "@adamosuiteservices/ui/button";
|
|
268
|
+
|
|
269
|
+
<Alert variant="destructive">
|
|
270
|
+
<ShieldCheckIcon />
|
|
271
|
+
<AlertTitle>Security Notice: Suspicious Login Attempt</AlertTitle>
|
|
272
|
+
<AlertDescription>
|
|
273
|
+
<p>We detected a login attempt from an unrecognized device:</p>
|
|
274
|
+
<div className="mt-3 space-y-2 text-sm">
|
|
275
|
+
<div className="grid grid-cols-2 gap-2">
|
|
276
|
+
<span className="font-medium">Location:</span>
|
|
277
|
+
<span>San Francisco, CA</span>
|
|
278
|
+
<span className="font-medium">Device:</span>
|
|
279
|
+
<span>Chrome on Windows</span>
|
|
280
|
+
<span className="font-medium">Time:</span>
|
|
281
|
+
<span>2 minutes ago</span>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
<div className="mt-4 flex gap-2">
|
|
285
|
+
<Button size="sm" variant="destructive">
|
|
286
|
+
Secure Account
|
|
287
|
+
</Button>
|
|
288
|
+
<Button size="sm" variant="outline">
|
|
289
|
+
This was me
|
|
290
|
+
</Button>
|
|
291
|
+
</div>
|
|
292
|
+
</AlertDescription>
|
|
293
|
+
</Alert>;
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Estado del Sistema con Progress
|
|
297
|
+
|
|
298
|
+
```tsx
|
|
299
|
+
import { WifiOffIcon } from "lucide-react";
|
|
300
|
+
import { Progress } from "@adamosuiteservices/ui/progress";
|
|
301
|
+
|
|
302
|
+
<Alert variant="destructive">
|
|
303
|
+
<WifiOffIcon />
|
|
304
|
+
<AlertTitle>Service outage detected</AlertTitle>
|
|
305
|
+
<AlertDescription>
|
|
306
|
+
<p>We're experiencing connectivity issues with our primary data center.</p>
|
|
307
|
+
<div className="mt-3">
|
|
308
|
+
<div className="flex gap-2 items-center justify-between mb-2">
|
|
309
|
+
<span className="text-sm">Recovery Progress</span>
|
|
310
|
+
<span className="text-sm">75%</span>
|
|
311
|
+
</div>
|
|
312
|
+
<Progress value={75} variant="destructive" className="h-2" />
|
|
313
|
+
</div>
|
|
314
|
+
<p className="mt-2 text-sm">Estimated resolution: 15 minutes</p>
|
|
315
|
+
</AlertDescription>
|
|
316
|
+
</Alert>;
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Notificación con Iconos Secundarios
|
|
320
|
+
|
|
321
|
+
```tsx
|
|
322
|
+
import { CalendarIcon, ClockIcon, MapPinIcon, UsersIcon } from "lucide-react";
|
|
323
|
+
|
|
324
|
+
<Alert>
|
|
325
|
+
<CalendarIcon />
|
|
326
|
+
<AlertTitle>Meeting reminder</AlertTitle>
|
|
327
|
+
<AlertDescription>
|
|
328
|
+
<p>Your meeting with the design team starts in 15 minutes.</p>
|
|
329
|
+
<div className="mt-3 space-y-1 text-sm">
|
|
330
|
+
<div className="flex items-center gap-2">
|
|
331
|
+
<ClockIcon className="h-3 w-3" />
|
|
332
|
+
<span>3:00 PM - 4:00 PM</span>
|
|
333
|
+
</div>
|
|
334
|
+
<div className="flex items-center gap-2">
|
|
335
|
+
<MapPinIcon className="h-3 w-3" />
|
|
336
|
+
<span>Conference Room B</span>
|
|
337
|
+
</div>
|
|
338
|
+
<div className="flex items-center gap-2">
|
|
339
|
+
<UsersIcon className="h-3 w-3" />
|
|
340
|
+
<span>5 attendees</span>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</AlertDescription>
|
|
344
|
+
</Alert>;
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Alert de Performance con Métricas
|
|
348
|
+
|
|
349
|
+
```tsx
|
|
350
|
+
import { ZapIcon } from "lucide-react";
|
|
351
|
+
|
|
352
|
+
<Alert variant="success">
|
|
353
|
+
<ZapIcon />
|
|
354
|
+
<AlertTitle>Performance optimized</AlertTitle>
|
|
355
|
+
<AlertDescription>
|
|
356
|
+
<p>Your application performance has been automatically optimized.</p>
|
|
357
|
+
<div className="mt-3 grid grid-cols-2 gap-2 text-sm">
|
|
358
|
+
<div className="flex gap-4 justify-between">
|
|
359
|
+
<span>Load time:</span>
|
|
360
|
+
<span className="text-green-600">-45%</span>
|
|
361
|
+
</div>
|
|
362
|
+
<div className="flex gap-4 justify-between">
|
|
363
|
+
<span>Memory usage:</span>
|
|
364
|
+
<span className="text-green-600">-23%</span>
|
|
365
|
+
</div>
|
|
366
|
+
<div className="flex gap-4 justify-between">
|
|
367
|
+
<span>CPU usage:</span>
|
|
368
|
+
<span className="text-green-600">-31%</span>
|
|
369
|
+
</div>
|
|
370
|
+
<div className="flex gap-4 justify-between">
|
|
371
|
+
<span>Battery life:</span>
|
|
372
|
+
<span className="text-green-600">+18%</span>
|
|
373
|
+
</div>
|
|
374
|
+
</div>
|
|
375
|
+
</AlertDescription>
|
|
376
|
+
</Alert>;
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Almacenamiento con Progreso y Acciones
|
|
380
|
+
|
|
381
|
+
```tsx
|
|
382
|
+
import { AlertTriangleIcon } from "lucide-react";
|
|
383
|
+
import { Progress } from "@adamosuiteservices/ui/progress";
|
|
384
|
+
import { Button } from "@adamosuiteservices/ui/button";
|
|
385
|
+
|
|
386
|
+
<Alert variant="warning">
|
|
387
|
+
<AlertTriangleIcon />
|
|
388
|
+
<AlertTitle>Storage almost full</AlertTitle>
|
|
389
|
+
<AlertDescription>
|
|
390
|
+
<p>
|
|
391
|
+
Your storage is 89% full. Consider cleaning up files or upgrading your
|
|
392
|
+
plan.
|
|
393
|
+
</p>
|
|
394
|
+
<div className="mt-3 space-y-2 text-sm">
|
|
395
|
+
<div className="flex justify-between">
|
|
396
|
+
<span>Used space:</span>
|
|
397
|
+
<span>89.2 GB of 100 GB</span>
|
|
398
|
+
</div>
|
|
399
|
+
<Progress value={89} variant="warning" className="h-2" />
|
|
400
|
+
<div className="grid grid-cols-2 gap-4 mt-3">
|
|
401
|
+
<div>
|
|
402
|
+
<p className="font-medium">Largest folders:</p>
|
|
403
|
+
<ul className="mt-1 space-y-1">
|
|
404
|
+
<li>Photos: 45.2 GB</li>
|
|
405
|
+
<li>Videos: 23.8 GB</li>
|
|
406
|
+
<li>Documents: 12.1 GB</li>
|
|
407
|
+
</ul>
|
|
408
|
+
</div>
|
|
409
|
+
<div className="space-y-2">
|
|
410
|
+
<Button size="sm" className="w-full">
|
|
411
|
+
Upgrade Storage
|
|
412
|
+
</Button>
|
|
413
|
+
<Button size="sm" variant="outline" className="w-full">
|
|
414
|
+
Clean Up Files
|
|
415
|
+
</Button>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
</div>
|
|
419
|
+
</AlertDescription>
|
|
420
|
+
</Alert>;
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### E-commerce: Orden Enviada
|
|
424
|
+
|
|
425
|
+
```tsx
|
|
426
|
+
import { TruckIcon } from "lucide-react";
|
|
427
|
+
import { Button } from "@adamosuiteservices/ui/button";
|
|
428
|
+
|
|
429
|
+
<Alert variant="success">
|
|
430
|
+
<TruckIcon />
|
|
431
|
+
<AlertTitle>Order shipped!</AlertTitle>
|
|
432
|
+
<AlertDescription>
|
|
433
|
+
<p>Your order #12345 has been shipped and is on its way to you.</p>
|
|
434
|
+
<div className="mt-3 space-y-1 text-sm">
|
|
435
|
+
<div className="flex gap-4 justify-between">
|
|
436
|
+
<span>Tracking number:</span>
|
|
437
|
+
<span className="font-mono">1Z999AA1234567890</span>
|
|
438
|
+
</div>
|
|
439
|
+
<div className="flex gap-4 justify-between">
|
|
440
|
+
<span>Estimated delivery:</span>
|
|
441
|
+
<span>Tomorrow, Oct 26</span>
|
|
442
|
+
</div>
|
|
443
|
+
<div className="flex gap-4 justify-between">
|
|
444
|
+
<span>Carrier:</span>
|
|
445
|
+
<span>UPS</span>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
<Button size="sm" className="mt-3">
|
|
449
|
+
Track Package
|
|
450
|
+
</Button>
|
|
451
|
+
</AlertDescription>
|
|
452
|
+
</Alert>;
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### Alert Interactivo con Checkboxes
|
|
456
|
+
|
|
457
|
+
```tsx
|
|
458
|
+
import { ShieldCheckIcon } from "lucide-react";
|
|
459
|
+
import { Badge } from "@adamosuiteservices/ui/badge";
|
|
460
|
+
import { Checkbox } from "@adamosuiteservices/ui/checkbox";
|
|
461
|
+
import { Button } from "@adamosuiteservices/ui/button";
|
|
462
|
+
|
|
463
|
+
<Alert>
|
|
464
|
+
<ShieldCheckIcon />
|
|
465
|
+
<AlertTitle>Cookie preferences</AlertTitle>
|
|
466
|
+
<AlertDescription>
|
|
467
|
+
<p>We use cookies to improve your experience and analyze site usage.</p>
|
|
468
|
+
<div className="mt-3 space-y-3">
|
|
469
|
+
<div className="space-y-2">
|
|
470
|
+
<div className="flex items-center justify-between">
|
|
471
|
+
<span className="text-sm">Essential cookies</span>
|
|
472
|
+
<Badge variant="secondary">Required</Badge>
|
|
473
|
+
</div>
|
|
474
|
+
<div className="flex items-center justify-between">
|
|
475
|
+
<span className="text-sm">Analytics cookies</span>
|
|
476
|
+
<Checkbox defaultChecked className="rounded" />
|
|
477
|
+
</div>
|
|
478
|
+
<div className="flex items-center justify-between">
|
|
479
|
+
<span className="text-sm">Marketing cookies</span>
|
|
480
|
+
<Checkbox className="rounded" />
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
<div className="flex gap-2">
|
|
484
|
+
<Button size="sm">Accept All</Button>
|
|
485
|
+
<Button size="sm" variant="outline">
|
|
486
|
+
Save Preferences
|
|
487
|
+
</Button>
|
|
488
|
+
<Button size="sm" variant="ghost">
|
|
489
|
+
Reject All
|
|
490
|
+
</Button>
|
|
491
|
+
</div>
|
|
492
|
+
</div>
|
|
493
|
+
</AlertDescription>
|
|
494
|
+
</Alert>;
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### Update con Lista y Botones
|
|
498
|
+
|
|
499
|
+
```tsx
|
|
500
|
+
import { DownloadIcon } from "lucide-react";
|
|
501
|
+
import { Button } from "@adamosuiteservices/ui/button";
|
|
502
|
+
|
|
503
|
+
<Alert>
|
|
504
|
+
<DownloadIcon />
|
|
505
|
+
<AlertTitle>App update available</AlertTitle>
|
|
506
|
+
<AlertDescription>
|
|
507
|
+
<p>
|
|
508
|
+
Version 2.1.0 is now available with bug fixes and performance
|
|
509
|
+
improvements.
|
|
510
|
+
</p>
|
|
511
|
+
<div className="mt-3 space-y-2">
|
|
512
|
+
<div className="text-sm">
|
|
513
|
+
<p className="font-medium">What's new:</p>
|
|
514
|
+
<ul className="list-disc list-inside mt-1 space-y-1">
|
|
515
|
+
<li>Improved loading times</li>
|
|
516
|
+
<li>Fixed dark mode issues</li>
|
|
517
|
+
<li>Enhanced security</li>
|
|
518
|
+
</ul>
|
|
519
|
+
</div>
|
|
520
|
+
<div className="flex gap-2">
|
|
521
|
+
<Button size="sm">Update Now</Button>
|
|
522
|
+
<Button size="sm" variant="outline">
|
|
523
|
+
Remind Me Later
|
|
524
|
+
</Button>
|
|
525
|
+
<Button size="sm" variant="ghost">
|
|
526
|
+
Skip This Version
|
|
527
|
+
</Button>
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
530
|
+
</AlertDescription>
|
|
531
|
+
</Alert>;
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
## Casos de Uso Comunes
|
|
535
|
+
|
|
536
|
+
### Validación de Formularios
|
|
537
|
+
|
|
538
|
+
```tsx
|
|
539
|
+
<Alert variant="destructive">
|
|
540
|
+
<XCircleIcon />
|
|
541
|
+
<AlertTitle>Form validation failed</AlertTitle>
|
|
542
|
+
<AlertDescription>
|
|
543
|
+
Please correct the following errors before submitting.
|
|
544
|
+
</AlertDescription>
|
|
545
|
+
</Alert>
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### Confirmación de Acción
|
|
549
|
+
|
|
550
|
+
```tsx
|
|
551
|
+
<Alert variant="success">
|
|
552
|
+
<CheckCircle2Icon />
|
|
553
|
+
<AlertTitle>Profile updated</AlertTitle>
|
|
554
|
+
<AlertDescription>
|
|
555
|
+
Your changes have been saved successfully.
|
|
556
|
+
</AlertDescription>
|
|
557
|
+
</Alert>
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
### Mantenimiento Programado
|
|
561
|
+
|
|
562
|
+
```tsx
|
|
563
|
+
<Alert variant="warning">
|
|
564
|
+
<AlertTriangleIcon />
|
|
565
|
+
<AlertTitle>Planned maintenance scheduled</AlertTitle>
|
|
566
|
+
<AlertDescription>
|
|
567
|
+
System maintenance tonight from 2:00 AM to 4:00 AM PST.
|
|
568
|
+
</AlertDescription>
|
|
569
|
+
</Alert>
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
### Sistema Operativo
|
|
573
|
+
|
|
574
|
+
```tsx
|
|
575
|
+
<Alert variant="success">
|
|
576
|
+
<ServerIcon />
|
|
577
|
+
<AlertTitle>All systems operational</AlertTitle>
|
|
578
|
+
<AlertDescription>
|
|
579
|
+
All services running normally. No issues detected.
|
|
580
|
+
</AlertDescription>
|
|
581
|
+
</Alert>
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
### Información de Backup
|
|
585
|
+
|
|
586
|
+
```tsx
|
|
587
|
+
<Alert>
|
|
588
|
+
<ArchiveIcon />
|
|
589
|
+
<AlertTitle>Backup completed</AlertTitle>
|
|
590
|
+
<AlertDescription>
|
|
591
|
+
Daily backup completed. 1,247 files backed up to cloud storage.
|
|
592
|
+
</AlertDescription>
|
|
593
|
+
</Alert>
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
## Mejores Prácticas
|
|
597
|
+
|
|
598
|
+
### Iconos Recomendados (lucide-react)
|
|
599
|
+
|
|
600
|
+
- **Default**: `InfoIcon`, `BellIcon`, `MailIcon`
|
|
601
|
+
- **Success**: `CheckCircle2Icon`, `CheckIcon`, `ShieldCheckIcon`
|
|
602
|
+
- **Warning**: `AlertTriangleIcon`, `AlertCircleIcon`
|
|
603
|
+
- **Destructive**: `XCircleIcon`, `AlertTriangleIcon`, `ShieldAlertIcon`
|
|
604
|
+
|
|
605
|
+
### Estructura de Contenido
|
|
606
|
+
|
|
607
|
+
```tsx
|
|
608
|
+
<Alert variant="...">
|
|
609
|
+
{/* 1. Icono (opcional, directo como hijo) */}
|
|
610
|
+
<IconComponent />
|
|
611
|
+
|
|
612
|
+
{/* 2. Título (opcional, breve y descriptivo) */}
|
|
613
|
+
<AlertTitle>Short descriptive title</AlertTitle>
|
|
614
|
+
|
|
615
|
+
{/* 3. Descripción (puede incluir contenido rico) */}
|
|
616
|
+
<AlertDescription>
|
|
617
|
+
<p>Main message goes here.</p>
|
|
618
|
+
{/* Contenido adicional: listas, botones, progress, etc. */}
|
|
619
|
+
</AlertDescription>
|
|
620
|
+
</Alert>
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
### Cuándo Usar Cada Variante
|
|
624
|
+
|
|
625
|
+
- **default**: Información general, notificaciones neutras
|
|
626
|
+
- **success**: Confirmaciones, operaciones completadas con éxito
|
|
627
|
+
- **warning**: Advertencias, límites próximos, acciones recomendadas
|
|
628
|
+
- **destructive**: Errores críticos, fallos de validación, acciones bloqueadas
|
|
629
|
+
|
|
630
|
+
### Acciones en Alerts
|
|
631
|
+
|
|
632
|
+
Para alerts con botones de acción:
|
|
633
|
+
|
|
634
|
+
```tsx
|
|
635
|
+
<AlertDescription>
|
|
636
|
+
<p>Message text</p>
|
|
637
|
+
<div className="mt-3 flex gap-2">
|
|
638
|
+
<Button size="sm">Primary Action</Button>
|
|
639
|
+
<Button size="sm" variant="outline">
|
|
640
|
+
Secondary
|
|
641
|
+
</Button>
|
|
642
|
+
</div>
|
|
643
|
+
</AlertDescription>
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
## Notas de Implementación
|
|
647
|
+
|
|
648
|
+
- Basado en CVA (class-variance-authority) para variantes
|
|
649
|
+
- Grid con selector CSS `has-[>svg]` para detección automática de iconos
|
|
650
|
+
- Usa sistema de slots con `data-slot` para composición
|
|
651
|
+
- Colores de variantes usan tokens CSS personalizados
|
|
652
|
+
- El icono debe ser hijo directo (no dentro de AlertTitle/AlertDescription)
|
|
653
|
+
- Padding horizontal: 1rem (px-4)
|
|
654
|
+
- Padding vertical: 0.75rem (py-3)
|
|
655
|
+
- Border radius: 0.5rem (rounded-lg)
|
|
656
|
+
|
|
657
|
+
## Accesibilidad
|
|
658
|
+
|
|
659
|
+
- ✅ Rol ARIA `role="alert"` aplicado automáticamente
|
|
660
|
+
- ✅ Screen readers anunciarán el contenido como alerta importante
|
|
661
|
+
- ✅ Contraste de colores cumple WCAG AA en todas las variantes
|
|
662
|
+
- ✅ Texto descriptivo en lugar de solo iconos
|
|
663
|
+
- ✅ Botones dentro de alerts mantienen navegación por teclado
|
|
664
|
+
- ⚠️ Para alerts dinámicos (que aparecen después de carga), considera usar `role="status"` o `aria-live="polite"` si no son urgentes
|
|
665
|
+
|
|
666
|
+
## Referencias
|
|
667
|
+
|
|
668
|
+
- Radix UI primitives: https://www.radix-ui.com/
|
|
669
|
+
- shadcn/ui Alert: https://ui.shadcn.com/docs/components/alert
|
|
670
|
+
- ARIA alert role: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role
|
|
671
|
+
- Lucide Icons: https://lucide.dev/
|