orbital-ds 0.18.3 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +34 -0
- package/components.manifest.json +109 -1
- package/dist/hooks/use-ds-messages.d.ts +36 -0
- package/dist/lib/i18n.d.ts +36 -0
- package/dist/lib/i18n.js +108 -0
- package/dist/lib/presets.d.ts +8 -0
- package/dist/lib/presets.js +8 -0
- package/dist/motion.css +11 -4
- package/dist/ui/confirm-action.d.ts +18 -0
- package/dist/ui/confirm-action.js +79 -0
- package/dist/ui/empty-state.d.ts +17 -0
- package/dist/ui/empty-state.js +58 -0
- package/dist/ui/form-layout.d.ts +19 -0
- package/dist/ui/form-layout.js +90 -0
- package/dist/ui/notice-review.d.ts +31 -0
- package/dist/ui/notice-review.js +138 -0
- package/dist/ui/notifications.d.ts +3 -1
- package/dist/ui/notifications.js +12 -2
- package/dist/ui/stat-group.d.ts +8 -0
- package/dist/ui/stat-group.js +17 -0
- package/dist/ui/step-flow.d.ts +48 -0
- package/dist/ui/step-flow.js +338 -0
- package/docs/CONTRACT.md +34 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -140,6 +140,40 @@ Regla de oro: **nunca te sales del sistema**; si algo no se puede hacer con comp
|
|
|
140
140
|
lee esta documentación del paquete instalado, así que se actualiza con cada versión; `orbital-ds skill --check` en
|
|
141
141
|
el verify avisa si quedó de otra versión. El asistente lo ofrece en sus extras.
|
|
142
142
|
|
|
143
|
+
## Componentes con presets (patrones de configuración)
|
|
144
|
+
|
|
145
|
+
Un componente de **flujo o maqueta** (StepFlow, FormLayout, EmptyState, StatGroup, ConfirmAction) se configura con un
|
|
146
|
+
`preset`: una intención en inglés que **solo fija valores por defecto**; cualquier prop explícita lo sobrescribe, así sirve
|
|
147
|
+
en cualquier proyecto. Vocabulario común en `src/lib/presets.ts` (`DsDensity`, `DsPresentation`, `dsWarn`).
|
|
148
|
+
|
|
149
|
+
1. **Configuración en inglés** (props, valores, tokens, `data-*`); **texto visible o accesible** por `useDsMessages()` en
|
|
150
|
+
los tres catálogos; comentarios y `@note` en español.
|
|
151
|
+
2. **Nombre del preset = intención** (`quick`, `first-use`, `settings`), nunca el aspecto (`small-modal`).
|
|
152
|
+
3. **Ejes independientes**: presentación (`dialog | page | inline | sheet`) y densidad (`compact | default | comfortable`)
|
|
153
|
+
son props distintas; los presets las combinan, no las fusionan.
|
|
154
|
+
4. **El diseño sigue el ancho del contenedor** (container query), no el dispositivo ni la presentación.
|
|
155
|
+
5. **Aviso en desarrollo** (`dsWarn`, mensaje en inglés) si la combinación no cuadra.
|
|
156
|
+
6. **Ganchos del DOM**: `data-slot` y `data-preset` (más `data-presentation`/`data-density` si aplica).
|
|
157
|
+
7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `StepFlow` (quick · activation · long), `FormLayout`
|
|
158
|
+
(inline · sectioned · settings), `EmptyState` (first-use · no-results · error · forbidden), `StatGroup` (overview ·
|
|
159
|
+
compact · comparison) y `ConfirmAction` (simple · typed).
|
|
160
|
+
|
|
161
|
+
## Avisos y comunicaciones in-app (qué canal usar)
|
|
162
|
+
|
|
163
|
+
Se elige el canal por **urgencia** y **persistencia**; cada app no lo decide a mano:
|
|
164
|
+
|
|
165
|
+
| Intención | Canal | Persiste | Interrumpe |
|
|
166
|
+
|---|---|---|---|
|
|
167
|
+
| Confirmar una acción de la persona | toast (`Toaster`/`Toast`) | no | no |
|
|
168
|
+
| Aviso de una sección | `Alert` | sí | no |
|
|
169
|
+
| Aviso que afecta a toda la página | `Banner` | hasta resolver | no |
|
|
170
|
+
| Asunto con seguimiento o decisión | campana (`NotificationCenter`) + `NoticeReview` | sí, con estado | solo si es crítico |
|
|
171
|
+
| Bloqueo que exige respuesta ya | `ConfirmAction` / `AlertDialog` | no | sí |
|
|
172
|
+
|
|
173
|
+
Mismo vocabulario en todos: tono `info | success | warning | danger` y estado `new → acknowledged → resolved`.
|
|
174
|
+
`NotificationItem onSelect` abre la revisión; `NoticeReview` tiene presets `read | acknowledge | resolve | respond`
|
|
175
|
+
(modal o `presentation="sheet"`).
|
|
176
|
+
|
|
143
177
|
## Cómo comprobar tu trabajo
|
|
144
178
|
|
|
145
179
|
```bash
|
package/components.manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "orbital-ds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"engine": "@base-ui/react",
|
|
5
5
|
"docs": [
|
|
6
6
|
"README.md",
|
|
@@ -521,6 +521,21 @@
|
|
|
521
521
|
"cmdk"
|
|
522
522
|
]
|
|
523
523
|
},
|
|
524
|
+
"confirm-action": {
|
|
525
|
+
"import": "orbital-ds/ui/confirm-action",
|
|
526
|
+
"exports": [
|
|
527
|
+
"ConfirmAction",
|
|
528
|
+
"type ConfirmActionPreset"
|
|
529
|
+
],
|
|
530
|
+
"slots": [
|
|
531
|
+
"confirm-action"
|
|
532
|
+
],
|
|
533
|
+
"optionalPeers": [],
|
|
534
|
+
"notes": [
|
|
535
|
+
"Para borrar, revocar o archivar. `simple` si es reversible o de bajo impacto; `typed` (escribir el nombre) si no se puede deshacer. Si se puede deshacer, mejor un toast con «Deshacer» sin confirmar.",
|
|
536
|
+
"El título nombra la acción y el objeto; el botón repite el verbo, no «Aceptar»."
|
|
537
|
+
]
|
|
538
|
+
},
|
|
524
539
|
"context-menu": {
|
|
525
540
|
"import": "orbital-ds/ui/context-menu",
|
|
526
541
|
"exports": [
|
|
@@ -804,6 +819,21 @@
|
|
|
804
819
|
"Nunca pongas colores en el option: los da el tema (paleta --chart-1…5). Para informes en servidor: renderEChartToSvg."
|
|
805
820
|
]
|
|
806
821
|
},
|
|
822
|
+
"empty-state": {
|
|
823
|
+
"import": "orbital-ds/ui/empty-state",
|
|
824
|
+
"exports": [
|
|
825
|
+
"EmptyState",
|
|
826
|
+
"type EmptyStatePreset"
|
|
827
|
+
],
|
|
828
|
+
"slots": [
|
|
829
|
+
"empty-state"
|
|
830
|
+
],
|
|
831
|
+
"optionalPeers": [],
|
|
832
|
+
"notes": [
|
|
833
|
+
"Un preset por intención: first-use (nada aún), no-results (el filtro no encuentra), error (reintentar), forbidden (sin permiso). Cambia título, descripción o icono solo si el dominio lo pide.",
|
|
834
|
+
"Para un vacío con composición propia usa Empty y sus partes."
|
|
835
|
+
]
|
|
836
|
+
},
|
|
807
837
|
"empty": {
|
|
808
838
|
"import": "orbital-ds/ui/empty",
|
|
809
839
|
"exports": [
|
|
@@ -887,6 +917,24 @@
|
|
|
887
917
|
],
|
|
888
918
|
"optionalPeers": []
|
|
889
919
|
},
|
|
920
|
+
"form-layout": {
|
|
921
|
+
"import": "orbital-ds/ui/form-layout",
|
|
922
|
+
"exports": [
|
|
923
|
+
"FormLayout",
|
|
924
|
+
"FormSection",
|
|
925
|
+
"type FormLayoutPreset"
|
|
926
|
+
],
|
|
927
|
+
"slots": [
|
|
928
|
+
"form-actions",
|
|
929
|
+
"form-layout",
|
|
930
|
+
"form-section"
|
|
931
|
+
],
|
|
932
|
+
"optionalPeers": [],
|
|
933
|
+
"notes": [
|
|
934
|
+
"Formularios y ajustes: `inline` (corto), `sectioned` (varias secciones) o `settings` (barra de guardado solo con cambios). Combina con Field para los campos.",
|
|
935
|
+
"Un formulario de varios pasos no va aquí: usa StepFlow."
|
|
936
|
+
]
|
|
937
|
+
},
|
|
890
938
|
"gauge": {
|
|
891
939
|
"import": "orbital-ds/ui/gauge",
|
|
892
940
|
"exports": [
|
|
@@ -1279,6 +1327,24 @@
|
|
|
1279
1327
|
],
|
|
1280
1328
|
"optionalPeers": []
|
|
1281
1329
|
},
|
|
1330
|
+
"notice-review": {
|
|
1331
|
+
"import": "orbital-ds/ui/notice-review",
|
|
1332
|
+
"exports": [
|
|
1333
|
+
"NoticeReview",
|
|
1334
|
+
"type NoticeReviewPreset"
|
|
1335
|
+
],
|
|
1336
|
+
"slots": [
|
|
1337
|
+
"notice-review",
|
|
1338
|
+
"notice-review-actions",
|
|
1339
|
+
"notice-review-body",
|
|
1340
|
+
"notice-review-state"
|
|
1341
|
+
],
|
|
1342
|
+
"optionalPeers": [],
|
|
1343
|
+
"notes": [
|
|
1344
|
+
"Detalle de un aviso de la campana: pásale `onSelect` a NotificationItem y abre aquí el contexto completo. `acknowledge` para reconocer, `resolve` para cerrar con nota, `respond` para aceptar o rechazar una comunicación, `read` si solo se lee.",
|
|
1345
|
+
"Canal según intención: toast confirma una acción; Alert avisa en una sección; Banner avisa en toda la página; campana + NoticeReview para lo que exige seguimiento; ConfirmAction/AlertDialog para lo que bloquea."
|
|
1346
|
+
]
|
|
1347
|
+
},
|
|
1282
1348
|
"notifications": {
|
|
1283
1349
|
"import": "orbital-ds/ui/notifications",
|
|
1284
1350
|
"exports": [
|
|
@@ -1307,6 +1373,7 @@
|
|
|
1307
1373
|
"notification-list",
|
|
1308
1374
|
"notification-mark-all",
|
|
1309
1375
|
"notification-meta",
|
|
1376
|
+
"notification-select",
|
|
1310
1377
|
"notification-tab",
|
|
1311
1378
|
"notification-tab-count",
|
|
1312
1379
|
"notification-tabs",
|
|
@@ -1744,6 +1811,20 @@
|
|
|
1744
1811
|
],
|
|
1745
1812
|
"optionalPeers": []
|
|
1746
1813
|
},
|
|
1814
|
+
"stat-group": {
|
|
1815
|
+
"import": "orbital-ds/ui/stat-group",
|
|
1816
|
+
"exports": [
|
|
1817
|
+
"StatGroup",
|
|
1818
|
+
"type StatGroupPreset"
|
|
1819
|
+
],
|
|
1820
|
+
"slots": [
|
|
1821
|
+
"stat-group"
|
|
1822
|
+
],
|
|
1823
|
+
"optionalPeers": [],
|
|
1824
|
+
"notes": [
|
|
1825
|
+
"Agrupa varios Stat en la cabecera de un panel; no pongas más de 4 por fila. Para series o tendencias usa Sparkline dentro de cada Stat."
|
|
1826
|
+
]
|
|
1827
|
+
},
|
|
1747
1828
|
"stat": {
|
|
1748
1829
|
"import": "orbital-ds/ui/stat",
|
|
1749
1830
|
"exports": [
|
|
@@ -1823,6 +1904,33 @@
|
|
|
1823
1904
|
],
|
|
1824
1905
|
"optionalPeers": []
|
|
1825
1906
|
},
|
|
1907
|
+
"step-flow": {
|
|
1908
|
+
"import": "orbital-ds/ui/step-flow",
|
|
1909
|
+
"exports": [
|
|
1910
|
+
"StepFlow",
|
|
1911
|
+
"type StepFlowPresentation",
|
|
1912
|
+
"type StepFlowPreset",
|
|
1913
|
+
"type StepFlowProgress",
|
|
1914
|
+
"type StepFlowProps",
|
|
1915
|
+
"type StepFlowStep"
|
|
1916
|
+
],
|
|
1917
|
+
"slots": [
|
|
1918
|
+
"step-flow",
|
|
1919
|
+
"step-flow-aside",
|
|
1920
|
+
"step-flow-body",
|
|
1921
|
+
"step-flow-footer",
|
|
1922
|
+
"step-flow-header",
|
|
1923
|
+
"step-flow-page",
|
|
1924
|
+
"step-flow-progress",
|
|
1925
|
+
"step-flow-result"
|
|
1926
|
+
],
|
|
1927
|
+
"optionalPeers": [],
|
|
1928
|
+
"notes": [
|
|
1929
|
+
"Para altas y configuraciones por pasos. Elige un `preset` (quick, activation, long) y sobrescribe lo que haga falta; presentación y densidad son independientes.",
|
|
1930
|
+
"El estado de los campos vive en la app: solo se monta el paso actual. `invalid` bloquea «Siguiente»; `dirty` pide confirmar al cerrar.",
|
|
1931
|
+
"Una sola tarea corta sin pasos no necesita StepFlow: usa Dialog. El lateral (`aside`) se oculta en contenedor estrecho; no pongas ahí nada imprescindible."
|
|
1932
|
+
]
|
|
1933
|
+
},
|
|
1826
1934
|
"step-ring": {
|
|
1827
1935
|
"import": "orbital-ds/ui/step-ring",
|
|
1828
1936
|
"exports": [
|
|
@@ -57,6 +57,42 @@ declare const DsMessagesContext: React.Context<{
|
|
|
57
57
|
stepperCompleted: string;
|
|
58
58
|
stepperCurrent: string;
|
|
59
59
|
stepperError: string;
|
|
60
|
+
stepFlowBack: string;
|
|
61
|
+
stepFlowNext: string;
|
|
62
|
+
stepFlowFinish: string;
|
|
63
|
+
stepFlowSkip: string;
|
|
64
|
+
stepFlowCancel: string;
|
|
65
|
+
stepFlowReview: string;
|
|
66
|
+
stepFlowOptional: string;
|
|
67
|
+
stepFlowProgress: string;
|
|
68
|
+
stepFlowConfirmTitle: string;
|
|
69
|
+
stepFlowConfirmBody: string;
|
|
70
|
+
stepFlowConfirmKeep: string;
|
|
71
|
+
stepFlowConfirmDiscard: string;
|
|
72
|
+
stepFlowSaving: string;
|
|
73
|
+
emptyFirstUseTitle: string;
|
|
74
|
+
emptyFirstUseBody: string;
|
|
75
|
+
emptyNoResultsTitle: string;
|
|
76
|
+
emptyNoResultsBody: string;
|
|
77
|
+
emptyErrorTitle: string;
|
|
78
|
+
emptyErrorBody: string;
|
|
79
|
+
emptyForbiddenTitle: string;
|
|
80
|
+
emptyForbiddenBody: string;
|
|
81
|
+
confirmActionConfirm: string;
|
|
82
|
+
confirmActionCancel: string;
|
|
83
|
+
confirmActionTyped: string;
|
|
84
|
+
formSave: string;
|
|
85
|
+
formDiscard: string;
|
|
86
|
+
formUnsaved: string;
|
|
87
|
+
noticeAcknowledge: string;
|
|
88
|
+
noticeResolve: string;
|
|
89
|
+
noticeNote: string;
|
|
90
|
+
noticeAccept: string;
|
|
91
|
+
noticeDecline: string;
|
|
92
|
+
noticeSnooze: string;
|
|
93
|
+
noticeStateNew: string;
|
|
94
|
+
noticeStateAcknowledged: string;
|
|
95
|
+
noticeStateResolved: string;
|
|
60
96
|
statIncrease: string;
|
|
61
97
|
statDecrease: string;
|
|
62
98
|
statNoChange: string;
|
package/dist/lib/i18n.d.ts
CHANGED
|
@@ -56,6 +56,42 @@ declare const en: {
|
|
|
56
56
|
stepperCompleted: string;
|
|
57
57
|
stepperCurrent: string;
|
|
58
58
|
stepperError: string;
|
|
59
|
+
stepFlowBack: string;
|
|
60
|
+
stepFlowNext: string;
|
|
61
|
+
stepFlowFinish: string;
|
|
62
|
+
stepFlowSkip: string;
|
|
63
|
+
stepFlowCancel: string;
|
|
64
|
+
stepFlowReview: string;
|
|
65
|
+
stepFlowOptional: string;
|
|
66
|
+
stepFlowProgress: string;
|
|
67
|
+
stepFlowConfirmTitle: string;
|
|
68
|
+
stepFlowConfirmBody: string;
|
|
69
|
+
stepFlowConfirmKeep: string;
|
|
70
|
+
stepFlowConfirmDiscard: string;
|
|
71
|
+
stepFlowSaving: string;
|
|
72
|
+
emptyFirstUseTitle: string;
|
|
73
|
+
emptyFirstUseBody: string;
|
|
74
|
+
emptyNoResultsTitle: string;
|
|
75
|
+
emptyNoResultsBody: string;
|
|
76
|
+
emptyErrorTitle: string;
|
|
77
|
+
emptyErrorBody: string;
|
|
78
|
+
emptyForbiddenTitle: string;
|
|
79
|
+
emptyForbiddenBody: string;
|
|
80
|
+
confirmActionConfirm: string;
|
|
81
|
+
confirmActionCancel: string;
|
|
82
|
+
confirmActionTyped: string;
|
|
83
|
+
formSave: string;
|
|
84
|
+
formDiscard: string;
|
|
85
|
+
formUnsaved: string;
|
|
86
|
+
noticeAcknowledge: string;
|
|
87
|
+
noticeResolve: string;
|
|
88
|
+
noticeNote: string;
|
|
89
|
+
noticeAccept: string;
|
|
90
|
+
noticeDecline: string;
|
|
91
|
+
noticeSnooze: string;
|
|
92
|
+
noticeStateNew: string;
|
|
93
|
+
noticeStateAcknowledged: string;
|
|
94
|
+
noticeStateResolved: string;
|
|
59
95
|
statIncrease: string;
|
|
60
96
|
statDecrease: string;
|
|
61
97
|
statNoChange: string;
|
package/dist/lib/i18n.js
CHANGED
|
@@ -55,6 +55,42 @@ const en = {
|
|
|
55
55
|
stepperCompleted: "Completed",
|
|
56
56
|
stepperCurrent: "Current step",
|
|
57
57
|
stepperError: "Needs attention",
|
|
58
|
+
stepFlowBack: "Back",
|
|
59
|
+
stepFlowNext: "Next",
|
|
60
|
+
stepFlowFinish: "Finish",
|
|
61
|
+
stepFlowSkip: "Skip",
|
|
62
|
+
stepFlowCancel: "Cancel",
|
|
63
|
+
stepFlowReview: "Review",
|
|
64
|
+
stepFlowOptional: "Optional",
|
|
65
|
+
stepFlowProgress: "Progress",
|
|
66
|
+
stepFlowConfirmTitle: "Discard changes?",
|
|
67
|
+
stepFlowConfirmBody: "You have unsaved changes. If you leave now they will be lost.",
|
|
68
|
+
stepFlowConfirmKeep: "Keep editing",
|
|
69
|
+
stepFlowConfirmDiscard: "Discard",
|
|
70
|
+
stepFlowSaving: "Saving",
|
|
71
|
+
emptyFirstUseTitle: "Nothing here yet",
|
|
72
|
+
emptyFirstUseBody: "Create the first one to get started.",
|
|
73
|
+
emptyNoResultsTitle: "No results",
|
|
74
|
+
emptyNoResultsBody: "Try changing or clearing the filters.",
|
|
75
|
+
emptyErrorTitle: "Something went wrong",
|
|
76
|
+
emptyErrorBody: "We couldn't load this. Try again.",
|
|
77
|
+
emptyForbiddenTitle: "No access",
|
|
78
|
+
emptyForbiddenBody: "You don't have permission to see this.",
|
|
79
|
+
confirmActionConfirm: "Confirm",
|
|
80
|
+
confirmActionCancel: "Cancel",
|
|
81
|
+
confirmActionTyped: "Type {value} to confirm",
|
|
82
|
+
formSave: "Save changes",
|
|
83
|
+
formDiscard: "Discard",
|
|
84
|
+
formUnsaved: "You have unsaved changes",
|
|
85
|
+
noticeAcknowledge: "Acknowledge",
|
|
86
|
+
noticeResolve: "Mark as resolved",
|
|
87
|
+
noticeNote: "Resolution note (optional)",
|
|
88
|
+
noticeAccept: "Accept",
|
|
89
|
+
noticeDecline: "Decline",
|
|
90
|
+
noticeSnooze: "Remind me later",
|
|
91
|
+
noticeStateNew: "New",
|
|
92
|
+
noticeStateAcknowledged: "Acknowledged",
|
|
93
|
+
noticeStateResolved: "Resolved",
|
|
58
94
|
statIncrease: "Increase",
|
|
59
95
|
statDecrease: "Decrease",
|
|
60
96
|
statNoChange: "No change",
|
|
@@ -163,6 +199,42 @@ const es = {
|
|
|
163
199
|
stepperCompleted: "Completado",
|
|
164
200
|
stepperCurrent: "Paso actual",
|
|
165
201
|
stepperError: "Requiere atenci\xF3n",
|
|
202
|
+
stepFlowBack: "Atr\xE1s",
|
|
203
|
+
stepFlowNext: "Siguiente",
|
|
204
|
+
stepFlowFinish: "Finalizar",
|
|
205
|
+
stepFlowSkip: "Omitir",
|
|
206
|
+
stepFlowCancel: "Cancelar",
|
|
207
|
+
stepFlowReview: "Revisi\xF3n",
|
|
208
|
+
stepFlowOptional: "Opcional",
|
|
209
|
+
stepFlowProgress: "Progreso",
|
|
210
|
+
stepFlowConfirmTitle: "\xBFDescartar los cambios?",
|
|
211
|
+
stepFlowConfirmBody: "Tienes cambios sin guardar. Si sales ahora se perder\xE1n.",
|
|
212
|
+
stepFlowConfirmKeep: "Seguir editando",
|
|
213
|
+
stepFlowConfirmDiscard: "Descartar",
|
|
214
|
+
stepFlowSaving: "Guardando",
|
|
215
|
+
emptyFirstUseTitle: "A\xFAn no hay nada",
|
|
216
|
+
emptyFirstUseBody: "Crea el primero para empezar.",
|
|
217
|
+
emptyNoResultsTitle: "Sin resultados",
|
|
218
|
+
emptyNoResultsBody: "Prueba a cambiar o limpiar los filtros.",
|
|
219
|
+
emptyErrorTitle: "Algo ha fallado",
|
|
220
|
+
emptyErrorBody: "No hemos podido cargarlo. Int\xE9ntalo de nuevo.",
|
|
221
|
+
emptyForbiddenTitle: "Sin acceso",
|
|
222
|
+
emptyForbiddenBody: "No tienes permiso para ver esto.",
|
|
223
|
+
confirmActionConfirm: "Confirmar",
|
|
224
|
+
confirmActionCancel: "Cancelar",
|
|
225
|
+
confirmActionTyped: "Escribe {value} para confirmar",
|
|
226
|
+
formSave: "Guardar cambios",
|
|
227
|
+
formDiscard: "Descartar",
|
|
228
|
+
formUnsaved: "Tienes cambios sin guardar",
|
|
229
|
+
noticeAcknowledge: "Reconocer",
|
|
230
|
+
noticeResolve: "Marcar como resuelto",
|
|
231
|
+
noticeNote: "Nota de resoluci\xF3n (opcional)",
|
|
232
|
+
noticeAccept: "Aceptar",
|
|
233
|
+
noticeDecline: "Rechazar",
|
|
234
|
+
noticeSnooze: "Record\xE1rmelo m\xE1s tarde",
|
|
235
|
+
noticeStateNew: "Nuevo",
|
|
236
|
+
noticeStateAcknowledged: "Reconocido",
|
|
237
|
+
noticeStateResolved: "Resuelto",
|
|
166
238
|
statIncrease: "Subida",
|
|
167
239
|
statDecrease: "Bajada",
|
|
168
240
|
statNoChange: "Sin cambios",
|
|
@@ -271,6 +343,42 @@ const ptBR = {
|
|
|
271
343
|
stepperCompleted: "Conclu\xEDdo",
|
|
272
344
|
stepperCurrent: "Etapa atual",
|
|
273
345
|
stepperError: "Requer aten\xE7\xE3o",
|
|
346
|
+
stepFlowBack: "Voltar",
|
|
347
|
+
stepFlowNext: "Avan\xE7ar",
|
|
348
|
+
stepFlowFinish: "Concluir",
|
|
349
|
+
stepFlowSkip: "Pular",
|
|
350
|
+
stepFlowCancel: "Cancelar",
|
|
351
|
+
stepFlowReview: "Revis\xE3o",
|
|
352
|
+
stepFlowOptional: "Opcional",
|
|
353
|
+
stepFlowProgress: "Progresso",
|
|
354
|
+
stepFlowConfirmTitle: "Descartar as altera\xE7\xF5es?",
|
|
355
|
+
stepFlowConfirmBody: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas. Se sair agora, elas ser\xE3o perdidas.",
|
|
356
|
+
stepFlowConfirmKeep: "Continuar editando",
|
|
357
|
+
stepFlowConfirmDiscard: "Descartar",
|
|
358
|
+
stepFlowSaving: "Salvando",
|
|
359
|
+
emptyFirstUseTitle: "Ainda n\xE3o h\xE1 nada",
|
|
360
|
+
emptyFirstUseBody: "Crie o primeiro para come\xE7ar.",
|
|
361
|
+
emptyNoResultsTitle: "Sem resultados",
|
|
362
|
+
emptyNoResultsBody: "Tente alterar ou limpar os filtros.",
|
|
363
|
+
emptyErrorTitle: "Algo deu errado",
|
|
364
|
+
emptyErrorBody: "N\xE3o foi poss\xEDvel carregar. Tente novamente.",
|
|
365
|
+
emptyForbiddenTitle: "Sem acesso",
|
|
366
|
+
emptyForbiddenBody: "Voc\xEA n\xE3o tem permiss\xE3o para ver isto.",
|
|
367
|
+
confirmActionConfirm: "Confirmar",
|
|
368
|
+
confirmActionCancel: "Cancelar",
|
|
369
|
+
confirmActionTyped: "Digite {value} para confirmar",
|
|
370
|
+
formSave: "Salvar altera\xE7\xF5es",
|
|
371
|
+
formDiscard: "Descartar",
|
|
372
|
+
formUnsaved: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas",
|
|
373
|
+
noticeAcknowledge: "Reconhecer",
|
|
374
|
+
noticeResolve: "Marcar como resolvido",
|
|
375
|
+
noticeNote: "Nota de resolu\xE7\xE3o (opcional)",
|
|
376
|
+
noticeAccept: "Aceitar",
|
|
377
|
+
noticeDecline: "Recusar",
|
|
378
|
+
noticeSnooze: "Lembrar mais tarde",
|
|
379
|
+
noticeStateNew: "Novo",
|
|
380
|
+
noticeStateAcknowledged: "Reconhecido",
|
|
381
|
+
noticeStateResolved: "Resolvido",
|
|
274
382
|
statIncrease: "Aumento",
|
|
275
383
|
statDecrease: "Queda",
|
|
276
384
|
statNoChange: "Sem altera\xE7\xE3o",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Densidad: cuánto aire y cuánta información por pantalla. */
|
|
2
|
+
type DsDensity = "compact" | "default" | "comfortable";
|
|
3
|
+
/** Presentación: dónde vive el contenido. */
|
|
4
|
+
type DsPresentation = "dialog" | "page" | "inline" | "sheet";
|
|
5
|
+
/** Avisa SOLO en desarrollo (los mensajes para quien programa van en inglés). */
|
|
6
|
+
declare function dsWarn(component: string, message: string): void;
|
|
7
|
+
|
|
8
|
+
export { type DsDensity, type DsPresentation, dsWarn };
|
package/dist/motion.css
CHANGED
|
@@ -24,17 +24,24 @@
|
|
|
24
24
|
|
|
25
25
|
@media (prefers-reduced-motion: no-preference) {
|
|
26
26
|
/* ── Entrada (cada grupo, con su interruptor: none lo apaga) ───────────── */
|
|
27
|
+
/* Una entrada de lado o con desplazamiento no debe crear scroll horizontal mientras dura
|
|
28
|
+
(clip no crea contenedor de scroll: el sticky y el scroll de la página siguen igual). */
|
|
29
|
+
:where(body) {
|
|
30
|
+
overflow-x: clip;
|
|
31
|
+
}
|
|
32
|
+
/* `backwards`, no `both`: al terminar no queda ningún efecto vivo (ni contexto de apilado ni
|
|
33
|
+
bloque contenedor para hijos fixed/sticky) y el hover del tema manda sobre translate/scale. */
|
|
27
34
|
:where([data-slot='card'], [data-slot='panel'], [data-slot='stat'], [data-slot='item'][data-variant='card']) {
|
|
28
|
-
animation: var(--ds-enter-surfaces) var(--ds-motion-base) var(--ds-ease-enter)
|
|
35
|
+
animation: var(--ds-enter-surfaces) var(--ds-motion-base) var(--ds-ease-enter) backwards;
|
|
29
36
|
}
|
|
30
37
|
:where([data-slot='alert'], [data-slot='banner'], [data-slot='empty']) {
|
|
31
|
-
animation: var(--ds-enter-notices) var(--ds-motion-base) var(--ds-ease-enter)
|
|
38
|
+
animation: var(--ds-enter-notices) var(--ds-motion-base) var(--ds-ease-enter) backwards;
|
|
32
39
|
}
|
|
33
40
|
:where([data-slot='page-header'], [data-slot='section-header'], [data-slot='app-header']) {
|
|
34
|
-
animation: var(--ds-enter-headers) var(--ds-motion-base) var(--ds-ease-enter)
|
|
41
|
+
animation: var(--ds-enter-headers) var(--ds-motion-base) var(--ds-ease-enter) backwards;
|
|
35
42
|
}
|
|
36
43
|
:where([data-slot='timeline-item'], [data-slot='table-body'] > [data-slot='table-row']) {
|
|
37
|
-
animation: var(--ds-enter-rows) var(--ds-motion-base) var(--ds-ease-enter)
|
|
44
|
+
animation: var(--ds-enter-rows) var(--ds-motion-base) var(--ds-ease-enter) backwards;
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
/* Cascada entre hermanas: cada una, un paso de --ds-motion-stagger más tarde (hasta 10). */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type ConfirmActionPreset = "simple" | "typed";
|
|
4
|
+
declare function ConfirmAction({ open, onOpenChange, preset, tone, title, description, confirmLabel, cancelLabel, expected, onConfirm, }: {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
preset?: ConfirmActionPreset;
|
|
8
|
+
tone?: "destructive" | "default";
|
|
9
|
+
title: React.ReactNode;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
confirmLabel?: React.ReactNode;
|
|
12
|
+
cancelLabel?: React.ReactNode;
|
|
13
|
+
/** Texto que hay que escribir (preset `typed`). */
|
|
14
|
+
expected?: string;
|
|
15
|
+
onConfirm: () => void | Promise<void>;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { ConfirmAction, type ConfirmActionPreset };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
5
|
+
import { dsFormat } from "../lib/i18n.js";
|
|
6
|
+
import { dsWarn } from "../lib/presets.js";
|
|
7
|
+
import {
|
|
8
|
+
AlertDialog,
|
|
9
|
+
AlertDialogAction,
|
|
10
|
+
AlertDialogCancel,
|
|
11
|
+
AlertDialogContent,
|
|
12
|
+
AlertDialogDescription,
|
|
13
|
+
AlertDialogFooter,
|
|
14
|
+
AlertDialogHeader,
|
|
15
|
+
AlertDialogTitle
|
|
16
|
+
} from "./alert-dialog.js";
|
|
17
|
+
import { Input } from "./input.js";
|
|
18
|
+
function ConfirmAction({
|
|
19
|
+
open,
|
|
20
|
+
onOpenChange,
|
|
21
|
+
preset = "simple",
|
|
22
|
+
tone = "destructive",
|
|
23
|
+
title,
|
|
24
|
+
description,
|
|
25
|
+
confirmLabel,
|
|
26
|
+
cancelLabel,
|
|
27
|
+
expected,
|
|
28
|
+
onConfirm
|
|
29
|
+
}) {
|
|
30
|
+
const t = useDsMessages();
|
|
31
|
+
const [typed, setTyped] = React.useState("");
|
|
32
|
+
const [pending, setPending] = React.useState(false);
|
|
33
|
+
const needsTyping = preset === "typed";
|
|
34
|
+
const ready = !needsTyping || expected != null && typed === expected;
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
if (needsTyping && !expected)
|
|
37
|
+
dsWarn("ConfirmAction", 'preset="typed" needs the `expected` prop.');
|
|
38
|
+
}, [needsTyping, expected]);
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
if (!open) setTyped("");
|
|
41
|
+
}, [open]);
|
|
42
|
+
const run = async (event) => {
|
|
43
|
+
if (pending) return;
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
setPending(true);
|
|
46
|
+
try {
|
|
47
|
+
await onConfirm();
|
|
48
|
+
onOpenChange?.(false);
|
|
49
|
+
} finally {
|
|
50
|
+
setPending(false);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return /* @__PURE__ */ jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(AlertDialogContent, { "data-slot": "confirm-action", "data-preset": preset, children: [
|
|
54
|
+
/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
|
|
55
|
+
/* @__PURE__ */ jsx(AlertDialogTitle, { children: title }),
|
|
56
|
+
description ? /* @__PURE__ */ jsx(AlertDialogDescription, { children: description }) : null
|
|
57
|
+
] }),
|
|
58
|
+
needsTyping && expected ? /* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-2 text-sm", children: [
|
|
59
|
+
/* @__PURE__ */ jsx("span", { children: dsFormat(t.confirmActionTyped, { value: expected }) }),
|
|
60
|
+
/* @__PURE__ */ jsx(Input, { value: typed, onChange: (e) => setTyped(e.target.value), autoComplete: "off" })
|
|
61
|
+
] }) : null,
|
|
62
|
+
/* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
|
|
63
|
+
/* @__PURE__ */ jsx(AlertDialogCancel, { disabled: pending, children: cancelLabel ?? t.confirmActionCancel }),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
AlertDialogAction,
|
|
66
|
+
{
|
|
67
|
+
variant: tone === "destructive" ? "destructive" : "default",
|
|
68
|
+
disabled: !ready || pending,
|
|
69
|
+
"aria-busy": pending || void 0,
|
|
70
|
+
onClick: run,
|
|
71
|
+
children: confirmLabel ?? t.confirmActionConfirm
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] })
|
|
75
|
+
] }) });
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
ConfirmAction
|
|
79
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Empty } from './empty.js';
|
|
3
|
+
import 'class-variance-authority/types';
|
|
4
|
+
import 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
type EmptyStatePreset = "first-use" | "no-results" | "error" | "forbidden";
|
|
7
|
+
declare function EmptyState({ preset, title, description, icon, action, className, ...props }: Omit<React.ComponentProps<typeof Empty>, "title"> & {
|
|
8
|
+
preset?: EmptyStatePreset;
|
|
9
|
+
title?: React.ReactNode;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
/** Sustituye el icono del preset. */
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
/** Acción principal (botón o enlace); la pone la app. */
|
|
14
|
+
action?: React.ReactNode;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { EmptyState, type EmptyStatePreset };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { InboxIcon, LockIcon, SearchXIcon, TriangleAlertIcon } from "lucide-react";
|
|
4
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
import {
|
|
7
|
+
Empty,
|
|
8
|
+
EmptyContent,
|
|
9
|
+
EmptyDescription,
|
|
10
|
+
EmptyHeader,
|
|
11
|
+
EmptyMedia,
|
|
12
|
+
EmptyTitle
|
|
13
|
+
} from "./empty.js";
|
|
14
|
+
const ICONS = {
|
|
15
|
+
"first-use": InboxIcon,
|
|
16
|
+
"no-results": SearchXIcon,
|
|
17
|
+
error: TriangleAlertIcon,
|
|
18
|
+
forbidden: LockIcon
|
|
19
|
+
};
|
|
20
|
+
function EmptyState({
|
|
21
|
+
preset = "first-use",
|
|
22
|
+
title,
|
|
23
|
+
description,
|
|
24
|
+
icon,
|
|
25
|
+
action,
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}) {
|
|
29
|
+
const t = useDsMessages();
|
|
30
|
+
const Icon = ICONS[preset];
|
|
31
|
+
const texts = {
|
|
32
|
+
"first-use": [t.emptyFirstUseTitle, t.emptyFirstUseBody],
|
|
33
|
+
"no-results": [t.emptyNoResultsTitle, t.emptyNoResultsBody],
|
|
34
|
+
error: [t.emptyErrorTitle, t.emptyErrorBody],
|
|
35
|
+
forbidden: [t.emptyForbiddenTitle, t.emptyForbiddenBody]
|
|
36
|
+
}[preset];
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
Empty,
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "empty-state",
|
|
41
|
+
"data-preset": preset,
|
|
42
|
+
role: preset === "error" ? "alert" : void 0,
|
|
43
|
+
className: cn("border border-border", className),
|
|
44
|
+
...props,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsxs(EmptyHeader, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx(EmptyMedia, { variant: "icon", className: cn(preset === "error" && "text-danger"), children: icon ?? /* @__PURE__ */ jsx(Icon, {}) }),
|
|
48
|
+
/* @__PURE__ */ jsx(EmptyTitle, { children: title ?? texts[0] }),
|
|
49
|
+
/* @__PURE__ */ jsx(EmptyDescription, { children: description ?? texts[1] })
|
|
50
|
+
] }),
|
|
51
|
+
action ? /* @__PURE__ */ jsx(EmptyContent, { children: action }) : null
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
EmptyState
|
|
58
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type FormLayoutPreset = "inline" | "sectioned" | "settings";
|
|
4
|
+
declare function FormLayout({ preset, dirty, saving, onSave, onDiscard, saveLabel, discardLabel, className, children, ...props }: Omit<React.ComponentProps<"form">, "onSubmit"> & {
|
|
5
|
+
preset?: FormLayoutPreset;
|
|
6
|
+
/** Hay cambios sin guardar (obligatorio para que `settings` muestre su barra). */
|
|
7
|
+
dirty?: boolean;
|
|
8
|
+
saving?: boolean;
|
|
9
|
+
onSave?: () => void | Promise<void>;
|
|
10
|
+
onDiscard?: () => void;
|
|
11
|
+
saveLabel?: React.ReactNode;
|
|
12
|
+
discardLabel?: React.ReactNode;
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
declare function FormSection({ title, description, className, children, ...props }: Omit<React.ComponentProps<"section">, "title"> & {
|
|
15
|
+
title: React.ReactNode;
|
|
16
|
+
description?: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { FormLayout, type FormLayoutPreset, FormSection };
|