orbital-ds 0.27.0 → 0.28.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 +1 -1
- package/components.manifest.json +141 -2
- package/dist/hooks/use-ds-messages.d.ts +29 -0
- package/dist/lib/i18n.d.ts +29 -0
- package/dist/lib/i18n.js +87 -0
- package/dist/styles.css +48 -0
- package/dist/ui/command-palette.d.ts +36 -0
- package/dist/ui/command-palette.js +111 -0
- package/dist/ui/dropzone.d.ts +3 -1
- package/dist/ui/dropzone.js +3 -1
- package/dist/ui/error-page.d.ts +19 -0
- package/dist/ui/error-page.js +92 -0
- package/dist/ui/file-upload.d.ts +42 -0
- package/dist/ui/file-upload.js +175 -0
- package/dist/ui/filter-bar.js +8 -0
- package/dist/ui/page-header.js +13 -2
- package/dist/ui/page-loader.d.ts +23 -0
- package/dist/ui/page-loader.js +163 -0
- package/docs/CONTRACT.md +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -161,7 +161,7 @@ en cualquier proyecto. Vocabulario común en `src/lib/presets.ts` (`DsDensity`,
|
|
|
161
161
|
4. **El diseño sigue el ancho del contenedor** (container query), no el dispositivo ni la presentación.
|
|
162
162
|
5. **Aviso en desarrollo** (`dsWarn`, mensaje en inglés) si la combinación no cuadra.
|
|
163
163
|
6. **Ganchos del DOM**: `data-slot` y `data-preset` (más `data-presentation`/`data-density` si aplica).
|
|
164
|
-
7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `ChartCard` (glance · standard · focus · dense), `ContentCard` (basic · feature · media · horizontal, con `emphasis` elevated · outlined · filled · ghost), `Mosaic` (even · bento · trio), `PageShell` (content · detail · canvas), `PageHeader` (page · compact · canvas), `FilterBar` (inline · compact · stacked), `DataTable` (browse · manage · compact), `LoadingState` (list · card · table · detail), `DetailPanel` (side · bottom · full), `EntityList` (list · grid · compact), `StepFlow` (quick · activation · long), `FormLayout`
|
|
164
|
+
7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `ChartCard` (glance · standard · focus · dense), `ContentCard` (basic · feature · media · horizontal, con `emphasis` elevated · outlined · filled · ghost), `Mosaic` (even · bento · trio), `PageShell` (content · detail · canvas), `PageHeader` (page · compact · canvas), `FilterBar` (inline · compact · stacked), `DataTable` (browse · manage · compact), `LoadingState` (list · card · table · detail), `PageLoader` (splash · route · section · overlay), `CommandPalette` (go · actions · search), `FileUpload` (drop · button), `ErrorPage` (not-found · forbidden · server-error · offline · maintenance, con `tone` neutral · playful), `DetailPanel` (side · bottom · full), `EntityList` (list · grid · compact), `StepFlow` (quick · activation · long), `FormLayout`
|
|
165
165
|
(inline · sectioned · settings), `NoticeReview` (read · acknowledge · resolve · respond), `EmptyState` (first-use · no-results · error · forbidden), `StatGroup` (overview ·
|
|
166
166
|
compact · comparison) y `ConfirmAction` (simple · typed).
|
|
167
167
|
|
package/components.manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "orbital-ds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"engine": "@base-ui/react",
|
|
5
5
|
"docs": [
|
|
6
6
|
"README.md",
|
|
@@ -523,6 +523,37 @@
|
|
|
523
523
|
],
|
|
524
524
|
"optionalPeers": []
|
|
525
525
|
},
|
|
526
|
+
"command-palette": {
|
|
527
|
+
"import": "orbital-ds/ui/command-palette",
|
|
528
|
+
"exports": [
|
|
529
|
+
"CommandPalette",
|
|
530
|
+
"type CommandPaletteGroup",
|
|
531
|
+
"type CommandPaletteItem",
|
|
532
|
+
"type CommandPalettePreset"
|
|
533
|
+
],
|
|
534
|
+
"slots": [
|
|
535
|
+
"command-palette",
|
|
536
|
+
"command-palette-loading"
|
|
537
|
+
],
|
|
538
|
+
"optionalPeers": [],
|
|
539
|
+
"presets": {
|
|
540
|
+
"values": [
|
|
541
|
+
"go",
|
|
542
|
+
"actions",
|
|
543
|
+
"search"
|
|
544
|
+
],
|
|
545
|
+
"default": "go",
|
|
546
|
+
"intent": {
|
|
547
|
+
"go": "navegar («Ir a…»): filtra en el cliente por etiqueta y `keywords`",
|
|
548
|
+
"actions": "ejecutar acciones («Escribe un comando…»): igual, con otro texto de ayuda",
|
|
549
|
+
"search": "buscar entidades: NO filtra en el cliente; la app responde a `onQueryChange` con `groups`"
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
"notes": [
|
|
553
|
+
"Paleta ⌘K: `go` para navegar, `actions` para ejecutar, `search` para buscar entidades en el servidor (no filtra en el cliente: responde a onQueryChange). Móvil: ábrela desde un botón con el icono de búsqueda (`open`/`onOpenChange`). Los textos de grupos y elementos los pone la app con su i18n.",
|
|
554
|
+
"Un solo CommandPalette por app, montado en la raíz. Para una lista filtrable dentro de una página usa Command, no la paleta."
|
|
555
|
+
]
|
|
556
|
+
},
|
|
526
557
|
"command": {
|
|
527
558
|
"import": "orbital-ds/ui/command",
|
|
528
559
|
"exports": [
|
|
@@ -712,7 +743,12 @@
|
|
|
712
743
|
"manage",
|
|
713
744
|
"compact"
|
|
714
745
|
],
|
|
715
|
-
"default": "browse"
|
|
746
|
+
"default": "browse",
|
|
747
|
+
"intent": {
|
|
748
|
+
"browse": "consultar datos: búsqueda y columnas visibles, filas cómodas, sin selección",
|
|
749
|
+
"manage": "gestionar registros: añade selección de filas para acciones en lote",
|
|
750
|
+
"compact": "tabla dentro de un panel o una tarjeta: filas densas, sin selector de columnas"
|
|
751
|
+
}
|
|
716
752
|
},
|
|
717
753
|
"notes": [
|
|
718
754
|
"Presets: `browse` consulta, `manage` añade selección para actuar, `compact` es denso y sin menú de columnas; cualquier prop explícita los sobrescribe.",
|
|
@@ -1013,6 +1049,44 @@
|
|
|
1013
1049
|
"No compone Card + Item a mano: la fila es siempre un Item."
|
|
1014
1050
|
]
|
|
1015
1051
|
},
|
|
1052
|
+
"error-page": {
|
|
1053
|
+
"import": "orbital-ds/ui/error-page",
|
|
1054
|
+
"exports": [
|
|
1055
|
+
"ErrorPage",
|
|
1056
|
+
"type ErrorPagePreset",
|
|
1057
|
+
"type ErrorPageTone"
|
|
1058
|
+
],
|
|
1059
|
+
"slots": [
|
|
1060
|
+
"error-page",
|
|
1061
|
+
"error-page-actions",
|
|
1062
|
+
"error-page-code",
|
|
1063
|
+
"error-page-description",
|
|
1064
|
+
"error-page-title"
|
|
1065
|
+
],
|
|
1066
|
+
"optionalPeers": [],
|
|
1067
|
+
"presets": {
|
|
1068
|
+
"values": [
|
|
1069
|
+
"not-found",
|
|
1070
|
+
"forbidden",
|
|
1071
|
+
"server-error",
|
|
1072
|
+
"offline",
|
|
1073
|
+
"maintenance"
|
|
1074
|
+
],
|
|
1075
|
+
"default": "not-found",
|
|
1076
|
+
"intent": {
|
|
1077
|
+
"not-found": "la ruta o el recurso no existe (404): lleva de vuelta a un sitio seguro",
|
|
1078
|
+
"forbidden": "sin permiso (403): explica a quién pedir acceso",
|
|
1079
|
+
"server-error": "falló el servidor (500): invita a reintentar",
|
|
1080
|
+
"offline": "sin conexión: la app decide cuándo se recupera",
|
|
1081
|
+
"maintenance": "parada programada: di cuándo vuelve en `description`"
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
"notes": [
|
|
1085
|
+
"Página completa de error por intención: not-found (404, lleva a un sitio seguro), forbidden (403), server-error (500, reintentar), offline y maintenance (di cuándo vuelve en `description`). Dentro de una vista usa EmptyState; aquí es la vista entera.",
|
|
1086
|
+
"`tone=\"playful\"` da mensajes con personalidad (en, es y pt-BR); úsalo en productos cercanos y nunca en un fallo grave. Los textos propios de la app se pasan con `title`/`description`.",
|
|
1087
|
+
"Siempre con una salida: `actions` con un botón principal (inicio, reintentar, volver). Para la ruta desconocida de un router, monta ErrorPage en su componente de «no encontrado»."
|
|
1088
|
+
]
|
|
1089
|
+
},
|
|
1016
1090
|
"eyebrow": {
|
|
1017
1091
|
"import": "orbital-ds/ui/eyebrow",
|
|
1018
1092
|
"exports": [
|
|
@@ -1054,6 +1128,37 @@
|
|
|
1054
1128
|
"Una columna; agrupa con FieldSet/FieldLegend; lo opcional, marcado o plegado."
|
|
1055
1129
|
]
|
|
1056
1130
|
},
|
|
1131
|
+
"file-upload": {
|
|
1132
|
+
"import": "orbital-ds/ui/file-upload",
|
|
1133
|
+
"exports": [
|
|
1134
|
+
"FileUpload",
|
|
1135
|
+
"type FileUploadFn",
|
|
1136
|
+
"type FileUploadItem",
|
|
1137
|
+
"type FileUploadPreset",
|
|
1138
|
+
"type FileUploadStatus"
|
|
1139
|
+
],
|
|
1140
|
+
"slots": [
|
|
1141
|
+
"file-upload",
|
|
1142
|
+
"file-upload-item",
|
|
1143
|
+
"file-upload-list"
|
|
1144
|
+
],
|
|
1145
|
+
"optionalPeers": [],
|
|
1146
|
+
"presets": {
|
|
1147
|
+
"values": [
|
|
1148
|
+
"drop",
|
|
1149
|
+
"button"
|
|
1150
|
+
],
|
|
1151
|
+
"default": "drop",
|
|
1152
|
+
"intent": {
|
|
1153
|
+
"drop": "zona grande para soltar con la lista debajo (importar, adjuntar documentos)",
|
|
1154
|
+
"button": "botón «Adjuntar» con la lista debajo, ocupa poco (formularios, comentarios, diálogos)"
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
"notes": [
|
|
1158
|
+
"Subida completa: `drop` para importar o adjuntar documentos, `button` para formularios y diálogos con poco sitio. La app pone `upload(file, onProgress, signal)` (cualquier backend, p. ej. URL prefirmada); sin él solo recoge ficheros y los envías con el formulario.",
|
|
1159
|
+
"Un fichero con error muestra su mensaje y «reintentar»; quitar un fichero en curso cancela la subida (`signal`). Sin subida por trozos ni reanudación: eso lo resuelve la app. Solo la zona, sin lista: Dropzone; solo la fila de un fichero: Attachment."
|
|
1160
|
+
]
|
|
1161
|
+
},
|
|
1057
1162
|
"filter-bar": {
|
|
1058
1163
|
"import": "orbital-ds/ui/filter-bar",
|
|
1059
1164
|
"exports": [
|
|
@@ -1693,6 +1798,40 @@
|
|
|
1693
1798
|
"Presets: `page` (vista normal), `compact` (vista densa o dentro de un panel), `canvas` (lienzo a todo el ancho, sin máximo). Dentro de PageShell, usa el preset de la maqueta y deja `page` aquí."
|
|
1694
1799
|
]
|
|
1695
1800
|
},
|
|
1801
|
+
"page-loader": {
|
|
1802
|
+
"import": "orbital-ds/ui/page-loader",
|
|
1803
|
+
"exports": [
|
|
1804
|
+
"PageLoader",
|
|
1805
|
+
"type PageLoaderIndicator",
|
|
1806
|
+
"type PageLoaderPreset"
|
|
1807
|
+
],
|
|
1808
|
+
"slots": [
|
|
1809
|
+
"page-loader",
|
|
1810
|
+
"page-loader-mark",
|
|
1811
|
+
"page-loader-message",
|
|
1812
|
+
"page-loader-progress"
|
|
1813
|
+
],
|
|
1814
|
+
"optionalPeers": [],
|
|
1815
|
+
"presets": {
|
|
1816
|
+
"values": [
|
|
1817
|
+
"splash",
|
|
1818
|
+
"route",
|
|
1819
|
+
"section",
|
|
1820
|
+
"overlay"
|
|
1821
|
+
],
|
|
1822
|
+
"default": "section",
|
|
1823
|
+
"intent": {
|
|
1824
|
+
"splash": "arranque de la app: pantalla completa, marca, indicador, mensajes y avance",
|
|
1825
|
+
"route": "navegación entre rutas: barra fina fija arriba, no bloquea ni tapa nada",
|
|
1826
|
+
"section": "una región que carga: centrado en su hueco, con altura mínima",
|
|
1827
|
+
"overlay": "procesando sobre contenido existente: velo con desenfoque que bloquea el área"
|
|
1828
|
+
}
|
|
1829
|
+
},
|
|
1830
|
+
"notes": [
|
|
1831
|
+
"Carga de página con intención: `splash` al arrancar la app (con marca y mensajes que rotan), `route` para navegar (barra fina, no bloquea), `section` para una región, `overlay` para procesar sobre contenido (bloquea el área; el contenedor debe ser `relative`). Esqueleto de la forma del contenido: LoadingState.",
|
|
1832
|
+
"Mensajes rotativos solo en cargas largas (> 3 s); con `value` real, muestra avance. Para una acción dentro de un botón usa Spinner; para una tarea larga con ilustración, TaskLoader. El texto lo pone la app con su i18n."
|
|
1833
|
+
]
|
|
1834
|
+
},
|
|
1696
1835
|
"page-shell": {
|
|
1697
1836
|
"import": "orbital-ds/ui/page-shell",
|
|
1698
1837
|
"exports": [
|
|
@@ -20,6 +20,11 @@ declare const DsMessagesContext: React.Context<{
|
|
|
20
20
|
carouselNext: string;
|
|
21
21
|
commandTitle: string;
|
|
22
22
|
commandDescription: string;
|
|
23
|
+
commandPaletteGoPlaceholder: string;
|
|
24
|
+
commandPaletteActionsPlaceholder: string;
|
|
25
|
+
commandPaletteSearchPlaceholder: string;
|
|
26
|
+
commandPaletteEmpty: string;
|
|
27
|
+
commandPaletteLoading: string;
|
|
23
28
|
scrollToEnd: string;
|
|
24
29
|
scrollToStart: string;
|
|
25
30
|
sidebarToggle: string;
|
|
@@ -39,6 +44,12 @@ declare const DsMessagesContext: React.Context<{
|
|
|
39
44
|
dateRangePlaceholder: string;
|
|
40
45
|
dropzoneTitle: string;
|
|
41
46
|
dropzoneHint: string;
|
|
47
|
+
fileUploadAttach: string;
|
|
48
|
+
fileUploadUploading: string;
|
|
49
|
+
fileUploadDone: string;
|
|
50
|
+
fileUploadFailed: string;
|
|
51
|
+
fileUploadRetry: string;
|
|
52
|
+
fileUploadRemove: string;
|
|
42
53
|
dropzoneTooLarge: string;
|
|
43
54
|
dropzoneWrongType: string;
|
|
44
55
|
dataTableSearch: string;
|
|
@@ -78,6 +89,24 @@ declare const DsMessagesContext: React.Context<{
|
|
|
78
89
|
emptyErrorBody: string;
|
|
79
90
|
emptyForbiddenTitle: string;
|
|
80
91
|
emptyForbiddenBody: string;
|
|
92
|
+
errorPageNotFoundTitle: string;
|
|
93
|
+
errorPageNotFoundBody: string;
|
|
94
|
+
errorPageServerTitle: string;
|
|
95
|
+
errorPageServerBody: string;
|
|
96
|
+
errorPageOfflineTitle: string;
|
|
97
|
+
errorPageOfflineBody: string;
|
|
98
|
+
errorPageMaintenanceTitle: string;
|
|
99
|
+
errorPageMaintenanceBody: string;
|
|
100
|
+
errorPageNotFoundPlayfulTitle: string;
|
|
101
|
+
errorPageNotFoundPlayfulBody: string;
|
|
102
|
+
errorPageForbiddenPlayfulTitle: string;
|
|
103
|
+
errorPageForbiddenPlayfulBody: string;
|
|
104
|
+
errorPageServerPlayfulTitle: string;
|
|
105
|
+
errorPageServerPlayfulBody: string;
|
|
106
|
+
errorPageOfflinePlayfulTitle: string;
|
|
107
|
+
errorPageOfflinePlayfulBody: string;
|
|
108
|
+
errorPageMaintenancePlayfulTitle: string;
|
|
109
|
+
errorPageMaintenancePlayfulBody: string;
|
|
81
110
|
confirmActionConfirm: string;
|
|
82
111
|
confirmActionCancel: string;
|
|
83
112
|
confirmActionTyped: string;
|
package/dist/lib/i18n.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ declare const en: {
|
|
|
19
19
|
carouselNext: string;
|
|
20
20
|
commandTitle: string;
|
|
21
21
|
commandDescription: string;
|
|
22
|
+
commandPaletteGoPlaceholder: string;
|
|
23
|
+
commandPaletteActionsPlaceholder: string;
|
|
24
|
+
commandPaletteSearchPlaceholder: string;
|
|
25
|
+
commandPaletteEmpty: string;
|
|
26
|
+
commandPaletteLoading: string;
|
|
22
27
|
scrollToEnd: string;
|
|
23
28
|
scrollToStart: string;
|
|
24
29
|
sidebarToggle: string;
|
|
@@ -38,6 +43,12 @@ declare const en: {
|
|
|
38
43
|
dateRangePlaceholder: string;
|
|
39
44
|
dropzoneTitle: string;
|
|
40
45
|
dropzoneHint: string;
|
|
46
|
+
fileUploadAttach: string;
|
|
47
|
+
fileUploadUploading: string;
|
|
48
|
+
fileUploadDone: string;
|
|
49
|
+
fileUploadFailed: string;
|
|
50
|
+
fileUploadRetry: string;
|
|
51
|
+
fileUploadRemove: string;
|
|
41
52
|
dropzoneTooLarge: string;
|
|
42
53
|
dropzoneWrongType: string;
|
|
43
54
|
dataTableSearch: string;
|
|
@@ -77,6 +88,24 @@ declare const en: {
|
|
|
77
88
|
emptyErrorBody: string;
|
|
78
89
|
emptyForbiddenTitle: string;
|
|
79
90
|
emptyForbiddenBody: string;
|
|
91
|
+
errorPageNotFoundTitle: string;
|
|
92
|
+
errorPageNotFoundBody: string;
|
|
93
|
+
errorPageServerTitle: string;
|
|
94
|
+
errorPageServerBody: string;
|
|
95
|
+
errorPageOfflineTitle: string;
|
|
96
|
+
errorPageOfflineBody: string;
|
|
97
|
+
errorPageMaintenanceTitle: string;
|
|
98
|
+
errorPageMaintenanceBody: string;
|
|
99
|
+
errorPageNotFoundPlayfulTitle: string;
|
|
100
|
+
errorPageNotFoundPlayfulBody: string;
|
|
101
|
+
errorPageForbiddenPlayfulTitle: string;
|
|
102
|
+
errorPageForbiddenPlayfulBody: string;
|
|
103
|
+
errorPageServerPlayfulTitle: string;
|
|
104
|
+
errorPageServerPlayfulBody: string;
|
|
105
|
+
errorPageOfflinePlayfulTitle: string;
|
|
106
|
+
errorPageOfflinePlayfulBody: string;
|
|
107
|
+
errorPageMaintenancePlayfulTitle: string;
|
|
108
|
+
errorPageMaintenancePlayfulBody: string;
|
|
80
109
|
confirmActionConfirm: string;
|
|
81
110
|
confirmActionCancel: string;
|
|
82
111
|
confirmActionTyped: string;
|
package/dist/lib/i18n.js
CHANGED
|
@@ -18,6 +18,11 @@ const en = {
|
|
|
18
18
|
carouselNext: "Next slide",
|
|
19
19
|
commandTitle: "Command palette",
|
|
20
20
|
commandDescription: "Search for a command to run\u2026",
|
|
21
|
+
commandPaletteGoPlaceholder: "Go to\u2026",
|
|
22
|
+
commandPaletteActionsPlaceholder: "Type a command\u2026",
|
|
23
|
+
commandPaletteSearchPlaceholder: "Search\u2026",
|
|
24
|
+
commandPaletteEmpty: "No results.",
|
|
25
|
+
commandPaletteLoading: "Searching\u2026",
|
|
21
26
|
scrollToEnd: "Scroll to end",
|
|
22
27
|
scrollToStart: "Scroll to start",
|
|
23
28
|
sidebarToggle: "Toggle sidebar",
|
|
@@ -37,6 +42,12 @@ const en = {
|
|
|
37
42
|
dateRangePlaceholder: "Pick a date range",
|
|
38
43
|
dropzoneTitle: "Drop files here",
|
|
39
44
|
dropzoneHint: "or click to browse",
|
|
45
|
+
fileUploadAttach: "Attach files",
|
|
46
|
+
fileUploadUploading: "Uploading\u2026",
|
|
47
|
+
fileUploadDone: "Uploaded",
|
|
48
|
+
fileUploadFailed: "Upload failed",
|
|
49
|
+
fileUploadRetry: "Retry {name}",
|
|
50
|
+
fileUploadRemove: "Remove {name}",
|
|
40
51
|
dropzoneTooLarge: "{name} is larger than {max}",
|
|
41
52
|
dropzoneWrongType: "{name} is not an accepted file type",
|
|
42
53
|
dataTableSearch: "Search\u2026",
|
|
@@ -76,6 +87,24 @@ const en = {
|
|
|
76
87
|
emptyErrorBody: "We couldn't load this. Try again.",
|
|
77
88
|
emptyForbiddenTitle: "No access",
|
|
78
89
|
emptyForbiddenBody: "You don't have permission to see this.",
|
|
90
|
+
errorPageNotFoundTitle: "Page not found",
|
|
91
|
+
errorPageNotFoundBody: "The page you're looking for doesn't exist or has moved.",
|
|
92
|
+
errorPageServerTitle: "Something went wrong",
|
|
93
|
+
errorPageServerBody: "The server failed to respond. Try again in a moment.",
|
|
94
|
+
errorPageOfflineTitle: "You're offline",
|
|
95
|
+
errorPageOfflineBody: "Check your connection and try again.",
|
|
96
|
+
errorPageMaintenanceTitle: "Back soon",
|
|
97
|
+
errorPageMaintenanceBody: "We're doing scheduled maintenance.",
|
|
98
|
+
errorPageNotFoundPlayfulTitle: "This page took a wrong turn",
|
|
99
|
+
errorPageNotFoundPlayfulBody: "We looked everywhere. It isn't here, or it moved without telling us.",
|
|
100
|
+
errorPageForbiddenPlayfulTitle: "Members only",
|
|
101
|
+
errorPageForbiddenPlayfulBody: "This door needs a key you don't have yet. Ask whoever manages your space.",
|
|
102
|
+
errorPageServerPlayfulTitle: "Our server tripped",
|
|
103
|
+
errorPageServerPlayfulBody: "It's picking itself up. Give it a moment and try again.",
|
|
104
|
+
errorPageOfflinePlayfulTitle: "Signal lost",
|
|
105
|
+
errorPageOfflinePlayfulBody: "Your connection wandered off. Once it's back, so are we.",
|
|
106
|
+
errorPageMaintenancePlayfulTitle: "Back in a bit",
|
|
107
|
+
errorPageMaintenancePlayfulBody: "We're tidying up behind the scenes. Thanks for your patience.",
|
|
79
108
|
confirmActionConfirm: "Confirm",
|
|
80
109
|
confirmActionCancel: "Cancel",
|
|
81
110
|
confirmActionTyped: "Type {value} to confirm",
|
|
@@ -163,6 +192,11 @@ const es = {
|
|
|
163
192
|
carouselNext: "Diapositiva siguiente",
|
|
164
193
|
commandTitle: "Paleta de comandos",
|
|
165
194
|
commandDescription: "Busca un comando para ejecutar\u2026",
|
|
195
|
+
commandPaletteGoPlaceholder: "Ir a\u2026",
|
|
196
|
+
commandPaletteActionsPlaceholder: "Escribe un comando\u2026",
|
|
197
|
+
commandPaletteSearchPlaceholder: "Buscar\u2026",
|
|
198
|
+
commandPaletteEmpty: "Sin resultados.",
|
|
199
|
+
commandPaletteLoading: "Buscando\u2026",
|
|
166
200
|
scrollToEnd: "Ir al final",
|
|
167
201
|
scrollToStart: "Ir al principio",
|
|
168
202
|
sidebarToggle: "Mostrar u ocultar el lateral",
|
|
@@ -182,6 +216,12 @@ const es = {
|
|
|
182
216
|
dateRangePlaceholder: "Elige un rango de fechas",
|
|
183
217
|
dropzoneTitle: "Suelta aqu\xED los ficheros",
|
|
184
218
|
dropzoneHint: "o haz clic para buscarlos",
|
|
219
|
+
fileUploadAttach: "Adjuntar ficheros",
|
|
220
|
+
fileUploadUploading: "Subiendo\u2026",
|
|
221
|
+
fileUploadDone: "Subido",
|
|
222
|
+
fileUploadFailed: "Error al subir",
|
|
223
|
+
fileUploadRetry: "Reintentar {name}",
|
|
224
|
+
fileUploadRemove: "Quitar {name}",
|
|
185
225
|
dropzoneTooLarge: "{name} supera {max}",
|
|
186
226
|
dropzoneWrongType: "{name} no es un tipo de fichero admitido",
|
|
187
227
|
dataTableSearch: "Buscar\u2026",
|
|
@@ -221,6 +261,24 @@ const es = {
|
|
|
221
261
|
emptyErrorBody: "No hemos podido cargarlo. Int\xE9ntalo de nuevo.",
|
|
222
262
|
emptyForbiddenTitle: "Sin acceso",
|
|
223
263
|
emptyForbiddenBody: "No tienes permiso para ver esto.",
|
|
264
|
+
errorPageNotFoundTitle: "P\xE1gina no encontrada",
|
|
265
|
+
errorPageNotFoundBody: "La p\xE1gina que buscas no existe o se ha movido.",
|
|
266
|
+
errorPageServerTitle: "Algo ha fallado",
|
|
267
|
+
errorPageServerBody: "El servidor no ha respondido. Int\xE9ntalo de nuevo en un momento.",
|
|
268
|
+
errorPageOfflineTitle: "Sin conexi\xF3n",
|
|
269
|
+
errorPageOfflineBody: "Revisa tu conexi\xF3n e int\xE9ntalo de nuevo.",
|
|
270
|
+
errorPageMaintenanceTitle: "Volvemos enseguida",
|
|
271
|
+
errorPageMaintenanceBody: "Estamos haciendo un mantenimiento programado.",
|
|
272
|
+
errorPageNotFoundPlayfulTitle: "Esta p\xE1gina tom\xF3 un desv\xEDo",
|
|
273
|
+
errorPageNotFoundPlayfulBody: "La hemos buscado por todas partes. No est\xE1 aqu\xED o se mud\xF3 sin avisar.",
|
|
274
|
+
errorPageForbiddenPlayfulTitle: "Solo para miembros",
|
|
275
|
+
errorPageForbiddenPlayfulBody: "Esta puerta pide una llave que a\xFAn no tienes. P\xEDdesela a quien gestione tu espacio.",
|
|
276
|
+
errorPageServerPlayfulTitle: "Nuestro servidor tropez\xF3",
|
|
277
|
+
errorPageServerPlayfulBody: "Se est\xE1 levantando. Dale un momento y vuelve a intentarlo.",
|
|
278
|
+
errorPageOfflinePlayfulTitle: "Se fue la se\xF1al",
|
|
279
|
+
errorPageOfflinePlayfulBody: "Tu conexi\xF3n se ha ido a dar una vuelta. Cuando vuelva, volvemos nosotros.",
|
|
280
|
+
errorPageMaintenancePlayfulTitle: "Volvemos en un rato",
|
|
281
|
+
errorPageMaintenancePlayfulBody: "Estamos ordenando cosas entre bastidores. Gracias por la paciencia.",
|
|
224
282
|
confirmActionConfirm: "Confirmar",
|
|
225
283
|
confirmActionCancel: "Cancelar",
|
|
226
284
|
confirmActionTyped: "Escribe {value} para confirmar",
|
|
@@ -308,6 +366,11 @@ const ptBR = {
|
|
|
308
366
|
carouselNext: "Pr\xF3ximo slide",
|
|
309
367
|
commandTitle: "Paleta de comandos",
|
|
310
368
|
commandDescription: "Pesquise um comando para executar\u2026",
|
|
369
|
+
commandPaletteGoPlaceholder: "Ir para\u2026",
|
|
370
|
+
commandPaletteActionsPlaceholder: "Digite um comando\u2026",
|
|
371
|
+
commandPaletteSearchPlaceholder: "Pesquisar\u2026",
|
|
372
|
+
commandPaletteEmpty: "Sem resultados.",
|
|
373
|
+
commandPaletteLoading: "Pesquisando\u2026",
|
|
311
374
|
scrollToEnd: "Ir para o final",
|
|
312
375
|
scrollToStart: "Ir para o in\xEDcio",
|
|
313
376
|
sidebarToggle: "Mostrar ou ocultar a barra lateral",
|
|
@@ -327,6 +390,12 @@ const ptBR = {
|
|
|
327
390
|
dateRangePlaceholder: "Escolha um intervalo de datas",
|
|
328
391
|
dropzoneTitle: "Solte os arquivos aqui",
|
|
329
392
|
dropzoneHint: "ou clique para procurar",
|
|
393
|
+
fileUploadAttach: "Anexar arquivos",
|
|
394
|
+
fileUploadUploading: "Enviando\u2026",
|
|
395
|
+
fileUploadDone: "Enviado",
|
|
396
|
+
fileUploadFailed: "Falha no envio",
|
|
397
|
+
fileUploadRetry: "Tentar de novo {name}",
|
|
398
|
+
fileUploadRemove: "Remover {name}",
|
|
330
399
|
dropzoneTooLarge: "{name} excede {max}",
|
|
331
400
|
dropzoneWrongType: "{name} n\xE3o \xE9 um tipo de arquivo aceito",
|
|
332
401
|
dataTableSearch: "Pesquisar\u2026",
|
|
@@ -366,6 +435,24 @@ const ptBR = {
|
|
|
366
435
|
emptyErrorBody: "N\xE3o foi poss\xEDvel carregar. Tente novamente.",
|
|
367
436
|
emptyForbiddenTitle: "Sem acesso",
|
|
368
437
|
emptyForbiddenBody: "Voc\xEA n\xE3o tem permiss\xE3o para ver isto.",
|
|
438
|
+
errorPageNotFoundTitle: "P\xE1gina n\xE3o encontrada",
|
|
439
|
+
errorPageNotFoundBody: "A p\xE1gina que voc\xEA procura n\xE3o existe ou foi movida.",
|
|
440
|
+
errorPageServerTitle: "Algo deu errado",
|
|
441
|
+
errorPageServerBody: "O servidor n\xE3o respondeu. Tente novamente em instantes.",
|
|
442
|
+
errorPageOfflineTitle: "Sem conex\xE3o",
|
|
443
|
+
errorPageOfflineBody: "Verifique sua conex\xE3o e tente novamente.",
|
|
444
|
+
errorPageMaintenanceTitle: "Voltamos logo",
|
|
445
|
+
errorPageMaintenanceBody: "Estamos fazendo uma manuten\xE7\xE3o programada.",
|
|
446
|
+
errorPageNotFoundPlayfulTitle: "Esta p\xE1gina pegou um desvio",
|
|
447
|
+
errorPageNotFoundPlayfulBody: "Procuramos por todo lado. Ela n\xE3o est\xE1 aqui ou mudou sem avisar.",
|
|
448
|
+
errorPageForbiddenPlayfulTitle: "S\xF3 para membros",
|
|
449
|
+
errorPageForbiddenPlayfulBody: "Esta porta pede uma chave que voc\xEA ainda n\xE3o tem. Pe\xE7a a quem gerencia seu espa\xE7o.",
|
|
450
|
+
errorPageServerPlayfulTitle: "Nosso servidor trope\xE7ou",
|
|
451
|
+
errorPageServerPlayfulBody: "Ele est\xE1 se levantando. D\xEA um instante e tente de novo.",
|
|
452
|
+
errorPageOfflinePlayfulTitle: "O sinal sumiu",
|
|
453
|
+
errorPageOfflinePlayfulBody: "Sua conex\xE3o saiu para passear. Quando voltar, voltamos tamb\xE9m.",
|
|
454
|
+
errorPageMaintenancePlayfulTitle: "Voltamos j\xE1",
|
|
455
|
+
errorPageMaintenancePlayfulBody: "Estamos arrumando as coisas nos bastidores. Obrigado pela paci\xEAncia.",
|
|
369
456
|
confirmActionConfirm: "Confirmar",
|
|
370
457
|
confirmActionCancel: "Cancelar",
|
|
371
458
|
confirmActionTyped: "Digite {value} para confirmar",
|
package/dist/styles.css
CHANGED
|
@@ -628,6 +628,20 @@
|
|
|
628
628
|
--ds-loader-bar-h: 2px;
|
|
629
629
|
--ds-loader-bg: var(--muted);
|
|
630
630
|
--ds-loader-done-bg: var(--card);
|
|
631
|
+
--ds-pageloader-size: 3.5rem; /* PageLoader: lado del indicador */
|
|
632
|
+
--ds-pageloader-stroke: 0.1875rem; /* grosor del anillo (orbit) */
|
|
633
|
+
--ds-pageloader-dot: 0.625rem; /* satélite (orbit) y núcleo (pulse) */
|
|
634
|
+
--ds-pageloader-core: 1.25rem; /* centro del anillo (orbit) */
|
|
635
|
+
--ds-pageloader-bar-w: 0.375rem; /* ancho de cada barra (bars) */
|
|
636
|
+
--ds-pageloader-route-h: 0.1875rem; /* barra de navegación (route) */
|
|
637
|
+
--ds-errorpage-min-h: 24rem; /* ErrorPage: alto mínimo */
|
|
638
|
+
--ds-errorpage-max-w: 36rem;
|
|
639
|
+
--ds-errorpage-gap: 1.5rem;
|
|
640
|
+
--ds-errorpage-icon-box: 4rem;
|
|
641
|
+
--ds-errorpage-icon: 1.75rem;
|
|
642
|
+
--ds-errorpage-code-size: 4.5rem;
|
|
643
|
+
--ds-pageloader-min-h: 16rem; /* alto mínimo de una región (section) */
|
|
644
|
+
--ds-pageloader-progress-w: 12rem; /* barra de avance (splash, section) */
|
|
631
645
|
--ds-loader-done-glow: 0 0 #0000; /* brillo al terminar (sin sombra por defecto) */
|
|
632
646
|
|
|
633
647
|
/* ── MATERIALES ─────────────────────────────────────────────────────────
|
|
@@ -828,6 +842,40 @@
|
|
|
828
842
|
@utility animate-ds-indeterminate {
|
|
829
843
|
animation: ds-indeterminate var(--ds-motion-pulse) var(--ds-ease-pulse) infinite;
|
|
830
844
|
}
|
|
845
|
+
/* PageLoader: órbita, ondas y ecualizador con el ritmo del tema; quietos con movimiento reducido
|
|
846
|
+
* (motion-reduce:animate-none en cada pieza). */
|
|
847
|
+
@utility animate-ds-orbit {
|
|
848
|
+
animation: ds-orbit calc(var(--ds-motion-spin) * 1.4) linear infinite;
|
|
849
|
+
}
|
|
850
|
+
@utility animate-ds-pageloader-wave {
|
|
851
|
+
animation: ds-pageloader-wave var(--ds-motion-pulse) var(--ds-ease-pulse) infinite;
|
|
852
|
+
}
|
|
853
|
+
@utility animate-ds-pageloader-bars {
|
|
854
|
+
animation: ds-pageloader-bars var(--ds-motion-pulse) var(--ds-ease-pulse) infinite alternate both;
|
|
855
|
+
}
|
|
856
|
+
@keyframes ds-orbit {
|
|
857
|
+
to {
|
|
858
|
+
transform: rotate(360deg);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
@keyframes ds-pageloader-wave {
|
|
862
|
+
from {
|
|
863
|
+
transform: scale(0.3);
|
|
864
|
+
opacity: 0.45;
|
|
865
|
+
}
|
|
866
|
+
to {
|
|
867
|
+
transform: scale(1);
|
|
868
|
+
opacity: 0;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
@keyframes ds-pageloader-bars {
|
|
872
|
+
from {
|
|
873
|
+
transform: scaleY(0.25);
|
|
874
|
+
}
|
|
875
|
+
to {
|
|
876
|
+
transform: scaleY(1);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
831
879
|
@keyframes ds-ring-inner {
|
|
832
880
|
from {
|
|
833
881
|
transform: scale(0.813);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type CommandPalettePreset = "go" | "actions" | "search";
|
|
4
|
+
type CommandPaletteItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
/** Atajo que se muestra a la derecha (solo texto; no lo enlaza). */
|
|
9
|
+
shortcut?: string;
|
|
10
|
+
/** Palabras extra con las que también se encuentra el elemento. */
|
|
11
|
+
keywords?: string[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onSelect: () => void;
|
|
14
|
+
};
|
|
15
|
+
type CommandPaletteGroup = {
|
|
16
|
+
heading?: string;
|
|
17
|
+
items: CommandPaletteItem[];
|
|
18
|
+
};
|
|
19
|
+
declare function CommandPalette({ preset, groups, open, onOpenChange, hotkey, placeholder, emptyMessage, query, onQueryChange, loading, closeOnSelect, className, }: {
|
|
20
|
+
preset?: CommandPalettePreset;
|
|
21
|
+
groups: CommandPaletteGroup[];
|
|
22
|
+
open?: boolean;
|
|
23
|
+
onOpenChange?: (open: boolean) => void;
|
|
24
|
+
/** Tecla del atajo (con ⌘/Ctrl); `null` lo desactiva. */
|
|
25
|
+
hotkey?: string | null;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
emptyMessage?: string;
|
|
28
|
+
/** Texto del campo (controlado); necesario en `search` para consultar al servidor. */
|
|
29
|
+
query?: string;
|
|
30
|
+
onQueryChange?: (query: string) => void;
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
closeOnSelect?: boolean;
|
|
33
|
+
className?: string;
|
|
34
|
+
}): React.JSX.Element;
|
|
35
|
+
|
|
36
|
+
export { CommandPalette, type CommandPaletteGroup, type CommandPaletteItem, type CommandPalettePreset };
|
|
@@ -0,0 +1,111 @@
|
|
|
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 {
|
|
6
|
+
Command,
|
|
7
|
+
CommandDialog,
|
|
8
|
+
CommandEmpty,
|
|
9
|
+
CommandGroup,
|
|
10
|
+
CommandInput,
|
|
11
|
+
CommandItem,
|
|
12
|
+
CommandList,
|
|
13
|
+
CommandSeparator,
|
|
14
|
+
CommandShortcut
|
|
15
|
+
} from "./command.js";
|
|
16
|
+
function CommandPalette({
|
|
17
|
+
preset = "go",
|
|
18
|
+
groups,
|
|
19
|
+
open,
|
|
20
|
+
onOpenChange,
|
|
21
|
+
hotkey = "k",
|
|
22
|
+
placeholder,
|
|
23
|
+
emptyMessage,
|
|
24
|
+
query,
|
|
25
|
+
onQueryChange,
|
|
26
|
+
loading = false,
|
|
27
|
+
closeOnSelect = true,
|
|
28
|
+
className
|
|
29
|
+
}) {
|
|
30
|
+
const t = useDsMessages();
|
|
31
|
+
const [own, setOwn] = React.useState(false);
|
|
32
|
+
const isOpen = open ?? own;
|
|
33
|
+
const setOpen = React.useCallback(
|
|
34
|
+
(next) => {
|
|
35
|
+
if (open === void 0) setOwn(next);
|
|
36
|
+
onOpenChange?.(next);
|
|
37
|
+
},
|
|
38
|
+
[open, onOpenChange]
|
|
39
|
+
);
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
if (!hotkey) return;
|
|
42
|
+
const onKey = (e) => {
|
|
43
|
+
if (e.key.toLowerCase() === hotkey.toLowerCase() && (e.metaKey || e.ctrlKey)) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
setOpen(!isOpen);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
document.addEventListener("keydown", onKey);
|
|
49
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
50
|
+
}, [hotkey, isOpen, setOpen]);
|
|
51
|
+
const hint = {
|
|
52
|
+
go: t.commandPaletteGoPlaceholder,
|
|
53
|
+
actions: t.commandPaletteActionsPlaceholder,
|
|
54
|
+
search: t.commandPaletteSearchPlaceholder
|
|
55
|
+
}[preset];
|
|
56
|
+
const visible = groups.filter((g) => g.items.length > 0);
|
|
57
|
+
return /* @__PURE__ */ jsx(CommandDialog, { open: isOpen, onOpenChange: setOpen, className, children: /* @__PURE__ */ jsxs(
|
|
58
|
+
Command,
|
|
59
|
+
{
|
|
60
|
+
"data-slot": "command-palette",
|
|
61
|
+
"data-preset": preset,
|
|
62
|
+
shouldFilter: preset !== "search",
|
|
63
|
+
className: "rounded-none",
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
CommandInput,
|
|
67
|
+
{
|
|
68
|
+
placeholder: placeholder ?? hint,
|
|
69
|
+
...query !== void 0 ? { value: query } : {},
|
|
70
|
+
onValueChange: onQueryChange
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
74
|
+
loading ? /* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
role: "status",
|
|
78
|
+
"data-slot": "command-palette-loading",
|
|
79
|
+
className: "py-6 text-center text-sm text-muted-foreground",
|
|
80
|
+
children: t.commandPaletteLoading
|
|
81
|
+
}
|
|
82
|
+
) : /* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage ?? t.commandPaletteEmpty }),
|
|
83
|
+
visible.map((group, gi) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
84
|
+
gi > 0 ? /* @__PURE__ */ jsx(CommandSeparator, {}) : null,
|
|
85
|
+
/* @__PURE__ */ jsx(CommandGroup, { heading: group.heading, children: group.items.map((item) => /* @__PURE__ */ jsxs(
|
|
86
|
+
CommandItem,
|
|
87
|
+
{
|
|
88
|
+
value: item.label,
|
|
89
|
+
keywords: item.keywords,
|
|
90
|
+
disabled: item.disabled,
|
|
91
|
+
onSelect: () => {
|
|
92
|
+
if (closeOnSelect) setOpen(false);
|
|
93
|
+
item.onSelect();
|
|
94
|
+
},
|
|
95
|
+
children: [
|
|
96
|
+
item.icon,
|
|
97
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: item.label }),
|
|
98
|
+
item.shortcut ? /* @__PURE__ */ jsx(CommandShortcut, { children: item.shortcut }) : null
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
item.id
|
|
102
|
+
)) })
|
|
103
|
+
] }, group.heading ?? gi))
|
|
104
|
+
] })
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
) });
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
CommandPalette
|
|
111
|
+
};
|
package/dist/ui/dropzone.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ type DropzoneRejection = {
|
|
|
10
10
|
type DropzoneState = "idle" | "drag-over" | "error" | "disabled";
|
|
11
11
|
/** Tamaño legible en el idioma activo: 10485760 → «10 MB». */
|
|
12
12
|
declare function formatBytes(bytes: number, locale: string): string;
|
|
13
|
-
declare function Dropzone({ className, accept, maxSize, maxFiles, multiple, disabled, invalid, onFiles, onReject, title, hint, description, icon, children, id, name, ...props }: Omit<React.ComponentProps<"div">, "title"> & {
|
|
13
|
+
declare function Dropzone({ className, areaClassName, accept, maxSize, maxFiles, multiple, disabled, invalid, onFiles, onReject, title, hint, description, icon, children, id, name, ...props }: Omit<React.ComponentProps<"div">, "title"> & {
|
|
14
14
|
/** Tipos admitidos, con la sintaxis de `<input accept>`: «.pdf,image/*». */
|
|
15
15
|
accept?: string;
|
|
16
16
|
/** Tamaño máximo por fichero, en bytes. */
|
|
@@ -33,6 +33,8 @@ declare function Dropzone({ className, accept, maxSize, maxFiles, multiple, disa
|
|
|
33
33
|
description?: React.ReactNode;
|
|
34
34
|
/** Icono de la baldosa; por defecto, subir. */
|
|
35
35
|
icon?: React.ReactNode;
|
|
36
|
+
/** Clases del área pulsable (la `label`); lo usa FileUpload para el preset `button`. */
|
|
37
|
+
areaClassName?: string;
|
|
36
38
|
/** id del `input type=file`. */
|
|
37
39
|
id?: string;
|
|
38
40
|
/** name del `input type=file` (formularios). */
|
package/dist/ui/dropzone.js
CHANGED
|
@@ -37,6 +37,7 @@ function matchesAccept(file, accept) {
|
|
|
37
37
|
}
|
|
38
38
|
function Dropzone({
|
|
39
39
|
className,
|
|
40
|
+
areaClassName,
|
|
40
41
|
accept,
|
|
41
42
|
maxSize,
|
|
42
43
|
maxFiles,
|
|
@@ -145,7 +146,8 @@ function Dropzone({
|
|
|
145
146
|
"has-[input:focus-visible]:border-ring has-[input:focus-visible]:ring-(length:--ds-ring-width) has-[input:focus-visible]:ring-(--ds-ring-color)",
|
|
146
147
|
"data-[state=drag-over]:border-primary data-[state=drag-over]:bg-accent data-[state=drag-over]:text-accent-foreground",
|
|
147
148
|
"data-[state=error]:border-danger data-[state=error]:bg-danger-soft",
|
|
148
|
-
"data-[state=disabled]:cursor-not-allowed data-[state=disabled]:opacity-(--ds-disabled-opacity) data-[state=disabled]:hover:bg-(--ds-field-bg)"
|
|
149
|
+
"data-[state=disabled]:cursor-not-allowed data-[state=disabled]:opacity-(--ds-disabled-opacity) data-[state=disabled]:hover:bg-(--ds-field-bg)",
|
|
150
|
+
areaClassName
|
|
149
151
|
),
|
|
150
152
|
children: [
|
|
151
153
|
/* @__PURE__ */ jsx(
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type ErrorPagePreset = "not-found" | "forbidden" | "server-error" | "offline" | "maintenance";
|
|
4
|
+
type ErrorPageTone = "neutral" | "playful";
|
|
5
|
+
declare function ErrorPage({ preset, tone, code, title, description, illustration, actions, className, ...props }: Omit<React.ComponentProps<"main">, "title"> & {
|
|
6
|
+
preset?: ErrorPagePreset;
|
|
7
|
+
/** Tono de los textos por defecto. */
|
|
8
|
+
tone?: ErrorPageTone;
|
|
9
|
+
/** Número grande (404, 500…); `null` lo oculta. */
|
|
10
|
+
code?: string | null;
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
description?: React.ReactNode;
|
|
13
|
+
/** Sustituye el icono del preset. */
|
|
14
|
+
illustration?: React.ReactNode;
|
|
15
|
+
/** Botones o enlaces de la app; el primero es el principal. */
|
|
16
|
+
actions?: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { ErrorPage, type ErrorPagePreset, type ErrorPageTone };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CloudOffIcon, CompassIcon, LockIcon, ServerCrashIcon, WrenchIcon } from "lucide-react";
|
|
4
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
const META = {
|
|
7
|
+
"not-found": { code: "404", icon: CompassIcon, alert: false },
|
|
8
|
+
forbidden: { code: "403", icon: LockIcon, alert: false },
|
|
9
|
+
"server-error": { code: "500", icon: ServerCrashIcon, alert: true },
|
|
10
|
+
offline: { code: null, icon: CloudOffIcon, alert: true },
|
|
11
|
+
maintenance: { code: null, icon: WrenchIcon, alert: false }
|
|
12
|
+
};
|
|
13
|
+
function ErrorPage({
|
|
14
|
+
preset = "not-found",
|
|
15
|
+
tone = "neutral",
|
|
16
|
+
code,
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
illustration,
|
|
20
|
+
actions,
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
const t = useDsMessages();
|
|
25
|
+
const meta = META[preset];
|
|
26
|
+
const Icon = meta.icon;
|
|
27
|
+
const neutral = {
|
|
28
|
+
"not-found": [t.errorPageNotFoundTitle, t.errorPageNotFoundBody],
|
|
29
|
+
forbidden: [t.emptyForbiddenTitle, t.emptyForbiddenBody],
|
|
30
|
+
"server-error": [t.errorPageServerTitle, t.errorPageServerBody],
|
|
31
|
+
offline: [t.errorPageOfflineTitle, t.errorPageOfflineBody],
|
|
32
|
+
maintenance: [t.errorPageMaintenanceTitle, t.errorPageMaintenanceBody]
|
|
33
|
+
};
|
|
34
|
+
const playful = {
|
|
35
|
+
"not-found": [t.errorPageNotFoundPlayfulTitle, t.errorPageNotFoundPlayfulBody],
|
|
36
|
+
forbidden: [t.errorPageForbiddenPlayfulTitle, t.errorPageForbiddenPlayfulBody],
|
|
37
|
+
"server-error": [t.errorPageServerPlayfulTitle, t.errorPageServerPlayfulBody],
|
|
38
|
+
offline: [t.errorPageOfflinePlayfulTitle, t.errorPageOfflinePlayfulBody],
|
|
39
|
+
maintenance: [t.errorPageMaintenancePlayfulTitle, t.errorPageMaintenancePlayfulBody]
|
|
40
|
+
};
|
|
41
|
+
const texts = (tone === "playful" ? playful : neutral)[preset];
|
|
42
|
+
const shownCode = code === void 0 ? meta.code : code;
|
|
43
|
+
return /* @__PURE__ */ jsxs(
|
|
44
|
+
"main",
|
|
45
|
+
{
|
|
46
|
+
"data-slot": "error-page",
|
|
47
|
+
"data-preset": preset,
|
|
48
|
+
"data-tone": tone,
|
|
49
|
+
role: meta.alert ? "alert" : void 0,
|
|
50
|
+
className: cn(
|
|
51
|
+
"mx-auto flex min-h-(--ds-errorpage-min-h) w-full max-w-(--ds-errorpage-max-w) flex-col items-center justify-center gap-(--ds-errorpage-gap) px-4 py-12 text-center",
|
|
52
|
+
"animate-in fade-in duration-(--ds-motion-base) ease-(--ds-ease-enter) motion-reduce:animate-none",
|
|
53
|
+
className
|
|
54
|
+
),
|
|
55
|
+
...props,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
className: "grid size-(--ds-errorpage-icon-box) place-items-center rounded-full bg-muted text-muted-foreground [&>svg]:size-(--ds-errorpage-icon)",
|
|
62
|
+
children: illustration ?? /* @__PURE__ */ jsx(Icon, {})
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
shownCode ? /* @__PURE__ */ jsx(
|
|
66
|
+
"p",
|
|
67
|
+
{
|
|
68
|
+
"data-slot": "error-page-code",
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
className: "text-(length:--ds-errorpage-code-size) leading-none font-(--ds-heading-weight) text-muted-foreground tabular-nums",
|
|
71
|
+
children: shownCode
|
|
72
|
+
}
|
|
73
|
+
) : null,
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
"h1",
|
|
77
|
+
{
|
|
78
|
+
"data-slot": "error-page-title",
|
|
79
|
+
className: "text-(length:--ds-page-title-size) leading-tight font-(--ds-heading-weight) text-foreground",
|
|
80
|
+
children: title ?? texts[0]
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx("p", { "data-slot": "error-page-description", className: "max-w-prose text-sm text-muted-foreground", children: description ?? texts[1] })
|
|
84
|
+
] }),
|
|
85
|
+
actions ? /* @__PURE__ */ jsx("div", { "data-slot": "error-page-actions", className: "flex flex-wrap items-center justify-center gap-2", children: actions }) : null
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
ErrorPage
|
|
92
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type FileUploadPreset = "drop" | "button";
|
|
4
|
+
type FileUploadStatus = "ready" | "uploading" | "done" | "error";
|
|
5
|
+
type FileUploadItem = {
|
|
6
|
+
id: string;
|
|
7
|
+
file: File;
|
|
8
|
+
status: FileUploadStatus;
|
|
9
|
+
/** 0–100 */
|
|
10
|
+
progress: number;
|
|
11
|
+
/** Mensaje si `status` es `error`. */
|
|
12
|
+
error?: string;
|
|
13
|
+
};
|
|
14
|
+
type FileUploadFn = (file: File, onProgress: (percent: number) => void, signal: AbortSignal) => Promise<unknown>;
|
|
15
|
+
declare function FileUpload({ preset, files, onFilesChange, upload, accept, maxSize, maxFiles, multiple, disabled, title, hint, description, icon, label, name, id, className, }: {
|
|
16
|
+
preset?: FileUploadPreset;
|
|
17
|
+
/** Lista controlada. Sin ella, el componente la guarda. */
|
|
18
|
+
files?: FileUploadItem[];
|
|
19
|
+
onFilesChange?: (files: FileUploadItem[]) => void;
|
|
20
|
+
/** Sube un fichero; la pone la app. Sin ella, solo recoge. */
|
|
21
|
+
upload?: FileUploadFn;
|
|
22
|
+
/** Tipos admitidos, con la sintaxis de `<input accept>`. */
|
|
23
|
+
accept?: string;
|
|
24
|
+
/** Tamaño máximo por fichero, en bytes. */
|
|
25
|
+
maxSize?: number;
|
|
26
|
+
/** Máximo de ficheros en la lista. */
|
|
27
|
+
maxFiles?: number;
|
|
28
|
+
multiple?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
title?: React.ReactNode;
|
|
31
|
+
hint?: React.ReactNode;
|
|
32
|
+
/** Texto de la app (p. ej. «PDF o imagen, hasta 10 MB»). */
|
|
33
|
+
description?: React.ReactNode;
|
|
34
|
+
icon?: React.ReactNode;
|
|
35
|
+
/** Texto del botón (preset `button`). */
|
|
36
|
+
label?: React.ReactNode;
|
|
37
|
+
name?: string;
|
|
38
|
+
id?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
}): React.JSX.Element;
|
|
41
|
+
|
|
42
|
+
export { FileUpload, type FileUploadFn, type FileUploadItem, type FileUploadPreset, type FileUploadStatus };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AlertCircleIcon, FileIcon, PaperclipIcon, RotateCcwIcon, XIcon } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { useDsLocale, useDsMessages } from "../hooks/use-ds-messages.js";
|
|
6
|
+
import { dsFormat } from "../lib/i18n.js";
|
|
7
|
+
import { cn } from "../lib/utils.js";
|
|
8
|
+
import {
|
|
9
|
+
Attachment,
|
|
10
|
+
AttachmentAction,
|
|
11
|
+
AttachmentActions,
|
|
12
|
+
AttachmentContent,
|
|
13
|
+
AttachmentDescription,
|
|
14
|
+
AttachmentMedia,
|
|
15
|
+
AttachmentTitle
|
|
16
|
+
} from "./attachment.js";
|
|
17
|
+
import { buttonVariants } from "./button.js";
|
|
18
|
+
import { Dropzone, formatBytes } from "./dropzone.js";
|
|
19
|
+
import { Progress } from "./progress.js";
|
|
20
|
+
import { Spinner } from "./spinner.js";
|
|
21
|
+
function FileUpload({
|
|
22
|
+
preset = "drop",
|
|
23
|
+
files,
|
|
24
|
+
onFilesChange,
|
|
25
|
+
upload,
|
|
26
|
+
accept,
|
|
27
|
+
maxSize,
|
|
28
|
+
maxFiles,
|
|
29
|
+
multiple = true,
|
|
30
|
+
disabled = false,
|
|
31
|
+
title,
|
|
32
|
+
hint,
|
|
33
|
+
description,
|
|
34
|
+
icon,
|
|
35
|
+
label,
|
|
36
|
+
name,
|
|
37
|
+
id,
|
|
38
|
+
className
|
|
39
|
+
}) {
|
|
40
|
+
const t = useDsMessages();
|
|
41
|
+
const locale = useDsLocale();
|
|
42
|
+
const [own, setOwn] = React.useState([]);
|
|
43
|
+
const items = files ?? own;
|
|
44
|
+
const itemsRef = React.useRef(items);
|
|
45
|
+
itemsRef.current = items;
|
|
46
|
+
const changeRef = React.useRef(onFilesChange);
|
|
47
|
+
changeRef.current = onFilesChange;
|
|
48
|
+
const controlled = files !== void 0;
|
|
49
|
+
const controllers = React.useRef(/* @__PURE__ */ new Map());
|
|
50
|
+
const counter = React.useRef(0);
|
|
51
|
+
const uid = React.useId();
|
|
52
|
+
const commit = React.useCallback(
|
|
53
|
+
(next) => {
|
|
54
|
+
itemsRef.current = next;
|
|
55
|
+
if (!controlled) setOwn(next);
|
|
56
|
+
changeRef.current?.(next);
|
|
57
|
+
},
|
|
58
|
+
[controlled]
|
|
59
|
+
);
|
|
60
|
+
const patch = React.useCallback(
|
|
61
|
+
(itemId, change) => {
|
|
62
|
+
if (!itemsRef.current.some((i) => i.id === itemId)) return;
|
|
63
|
+
commit(itemsRef.current.map((i) => i.id === itemId ? { ...i, ...change } : i));
|
|
64
|
+
},
|
|
65
|
+
[commit]
|
|
66
|
+
);
|
|
67
|
+
const start = React.useCallback(
|
|
68
|
+
(item) => {
|
|
69
|
+
if (!upload) return;
|
|
70
|
+
const ac = new AbortController();
|
|
71
|
+
controllers.current.set(item.id, ac);
|
|
72
|
+
upload(item.file, (p) => patch(item.id, { progress: Math.min(100, Math.max(0, p)) }), ac.signal).then(
|
|
73
|
+
() => patch(item.id, { status: "done", progress: 100, error: void 0 }),
|
|
74
|
+
(e) => {
|
|
75
|
+
if (ac.signal.aborted) return;
|
|
76
|
+
patch(item.id, { status: "error", error: e instanceof Error ? e.message : void 0 });
|
|
77
|
+
}
|
|
78
|
+
).finally(() => controllers.current.delete(item.id));
|
|
79
|
+
},
|
|
80
|
+
[upload, patch]
|
|
81
|
+
);
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
const map = controllers.current;
|
|
84
|
+
return () => {
|
|
85
|
+
for (const ac of map.values()) ac.abort();
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
88
|
+
const remove = (itemId) => {
|
|
89
|
+
controllers.current.get(itemId)?.abort();
|
|
90
|
+
controllers.current.delete(itemId);
|
|
91
|
+
commit(itemsRef.current.filter((i) => i.id !== itemId));
|
|
92
|
+
};
|
|
93
|
+
const retry = (item) => {
|
|
94
|
+
patch(item.id, { status: "uploading", progress: 0, error: void 0 });
|
|
95
|
+
start(item);
|
|
96
|
+
};
|
|
97
|
+
const onFiles = (accepted) => {
|
|
98
|
+
const created = accepted.map((file) => ({
|
|
99
|
+
id: `${uid}-${counter.current++}`,
|
|
100
|
+
file,
|
|
101
|
+
status: upload ? "uploading" : "ready",
|
|
102
|
+
progress: 0
|
|
103
|
+
}));
|
|
104
|
+
if (!multiple) {
|
|
105
|
+
for (const ac of controllers.current.values()) ac.abort();
|
|
106
|
+
controllers.current.clear();
|
|
107
|
+
}
|
|
108
|
+
commit(multiple ? [...itemsRef.current, ...created] : created.slice(0, 1));
|
|
109
|
+
for (const item of multiple ? created : created.slice(0, 1)) start(item);
|
|
110
|
+
};
|
|
111
|
+
const remaining = multiple && maxFiles != null ? Math.max(0, maxFiles - items.length) : void 0;
|
|
112
|
+
const zoneDisabled = disabled || remaining === 0;
|
|
113
|
+
const statusText = (item) => item.status === "uploading" ? t.fileUploadUploading : item.status === "done" ? t.fileUploadDone : item.status === "error" ? item.error ?? t.fileUploadFailed : "";
|
|
114
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "file-upload", "data-preset": preset, className: cn("flex w-full flex-col gap-3", className), children: [
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
Dropzone,
|
|
117
|
+
{
|
|
118
|
+
accept,
|
|
119
|
+
maxSize,
|
|
120
|
+
maxFiles: remaining,
|
|
121
|
+
multiple,
|
|
122
|
+
disabled: zoneDisabled,
|
|
123
|
+
onFiles,
|
|
124
|
+
name,
|
|
125
|
+
id,
|
|
126
|
+
...preset === "drop" ? { title, hint, description, icon } : {},
|
|
127
|
+
areaClassName: preset === "button" ? "items-start border-0 bg-transparent p-0 hover:bg-transparent data-[state=drag-over]:bg-accent data-[state=error]:bg-transparent" : void 0,
|
|
128
|
+
children: preset === "button" ? /* @__PURE__ */ jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [
|
|
129
|
+
/* @__PURE__ */ jsxs("span", { className: buttonVariants({ variant: "outline" }), children: [
|
|
130
|
+
icon ?? /* @__PURE__ */ jsx(PaperclipIcon, {}),
|
|
131
|
+
label ?? t.fileUploadAttach
|
|
132
|
+
] }),
|
|
133
|
+
description ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: description }) : null
|
|
134
|
+
] }) : void 0
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
items.length > 0 ? /* @__PURE__ */ jsx("ul", { "data-slot": "file-upload-list", "aria-live": "polite", className: "flex flex-col gap-2", children: items.map((item) => /* @__PURE__ */ jsx("li", { "data-slot": "file-upload-item", "data-status": item.status, className: "flex", children: /* @__PURE__ */ jsxs(
|
|
138
|
+
Attachment,
|
|
139
|
+
{
|
|
140
|
+
state: item.status === "ready" ? "done" : item.status,
|
|
141
|
+
orientation: "horizontal",
|
|
142
|
+
className: "w-full",
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsx(AttachmentMedia, { children: item.status === "uploading" ? /* @__PURE__ */ jsx(Spinner, { role: "presentation", "aria-label": void 0, "aria-hidden": "true" }) : item.status === "error" ? /* @__PURE__ */ jsx(AlertCircleIcon, {}) : /* @__PURE__ */ jsx(FileIcon, {}) }),
|
|
145
|
+
/* @__PURE__ */ jsxs(AttachmentContent, { children: [
|
|
146
|
+
/* @__PURE__ */ jsx(AttachmentTitle, { children: item.file.name }),
|
|
147
|
+
/* @__PURE__ */ jsx(AttachmentDescription, { children: [formatBytes(item.file.size, locale), statusText(item)].filter(Boolean).join(" \xB7 ") }),
|
|
148
|
+
item.status === "uploading" ? /* @__PURE__ */ jsx(Progress, { value: item.progress, "aria-label": item.file.name, className: "mt-1.5" }) : null
|
|
149
|
+
] }),
|
|
150
|
+
/* @__PURE__ */ jsxs(AttachmentActions, { children: [
|
|
151
|
+
item.status === "error" && upload ? /* @__PURE__ */ jsx(
|
|
152
|
+
AttachmentAction,
|
|
153
|
+
{
|
|
154
|
+
"aria-label": dsFormat(t.fileUploadRetry, { name: item.file.name }),
|
|
155
|
+
onClick: () => retry(item),
|
|
156
|
+
children: /* @__PURE__ */ jsx(RotateCcwIcon, {})
|
|
157
|
+
}
|
|
158
|
+
) : null,
|
|
159
|
+
/* @__PURE__ */ jsx(
|
|
160
|
+
AttachmentAction,
|
|
161
|
+
{
|
|
162
|
+
"aria-label": dsFormat(t.fileUploadRemove, { name: item.file.name }),
|
|
163
|
+
onClick: () => remove(item.id),
|
|
164
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
] })
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
) }, item.id)) }) : null
|
|
171
|
+
] });
|
|
172
|
+
}
|
|
173
|
+
export {
|
|
174
|
+
FileUpload
|
|
175
|
+
};
|
package/dist/ui/filter-bar.js
CHANGED
|
@@ -14,7 +14,13 @@ import {
|
|
|
14
14
|
DropdownMenuTrigger
|
|
15
15
|
} from "./dropdown-menu.js";
|
|
16
16
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
17
|
+
const BAR_PRESETS = {
|
|
18
|
+
inline: "",
|
|
19
|
+
compact: "[--ds-filter-gap:var(--ds-filter-gap-compact)]",
|
|
20
|
+
stacked: "flex-col items-stretch [&>[data-slot=filter-bar-actions]]:ms-0"
|
|
21
|
+
};
|
|
17
22
|
function FilterBar({
|
|
23
|
+
preset = "inline",
|
|
18
24
|
className,
|
|
19
25
|
children,
|
|
20
26
|
actions,
|
|
@@ -27,8 +33,10 @@ function FilterBar({
|
|
|
27
33
|
"div",
|
|
28
34
|
{
|
|
29
35
|
"data-slot": "filter-bar",
|
|
36
|
+
"data-preset": preset,
|
|
30
37
|
className: cn(
|
|
31
38
|
"flex w-full flex-wrap items-center gap-(--ds-filter-gap)",
|
|
39
|
+
BAR_PRESETS[preset],
|
|
32
40
|
className
|
|
33
41
|
),
|
|
34
42
|
...props,
|
package/dist/ui/page-header.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { IconTile } from "./icon-tile.js";
|
|
4
|
-
|
|
4
|
+
const HEADER_PRESETS = {
|
|
5
|
+
page: "",
|
|
6
|
+
compact: "[--ds-page-title-size:var(--ds-page-title-size-compact)] [--ds-page-title-size-wide:var(--ds-page-title-size-compact-wide)] mb-(--ds-section-gap)",
|
|
7
|
+
canvas: "max-w-none"
|
|
8
|
+
};
|
|
9
|
+
function PageHeader({
|
|
10
|
+
preset = "page",
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
5
14
|
return /* @__PURE__ */ jsx(
|
|
6
15
|
"header",
|
|
7
16
|
{
|
|
8
17
|
"data-slot": "page-header",
|
|
18
|
+
"data-preset": preset,
|
|
9
19
|
className: cn(
|
|
10
20
|
"group/page-header @container/page-header mx-auto mb-(--ds-page-gap) grid w-full max-w-(--ds-page-max-w) grid-cols-1 gap-x-(--ds-page-gap) gap-y-0 [grid-template-areas:'breadcrumb'_'title'_'description'_'actions'_'notice'] @2xl/page-header:grid-cols-[minmax(0,1fr)_auto] @2xl/page-header:[grid-template-areas:'breadcrumb_breadcrumb'_'title_actions'_'description_actions'_'notice_notice']",
|
|
21
|
+
HEADER_PRESETS[preset],
|
|
11
22
|
className
|
|
12
23
|
),
|
|
13
24
|
...props
|
|
@@ -23,7 +34,7 @@ function PageHeaderTitle({ className, ...props }) {
|
|
|
23
34
|
{
|
|
24
35
|
"data-slot": "page-header-title",
|
|
25
36
|
className: cn(
|
|
26
|
-
"min-w-0 text-
|
|
37
|
+
"min-w-0 text-(length:--ds-page-title-size) leading-tight font-(--ds-heading-weight) text-foreground [grid-area:title] @2xl/page-header:text-(length:--ds-page-title-size-wide)",
|
|
27
38
|
className
|
|
28
39
|
),
|
|
29
40
|
...props
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type PageLoaderPreset = "splash" | "route" | "section" | "overlay";
|
|
4
|
+
type PageLoaderIndicator = "orbit" | "pulse" | "bars";
|
|
5
|
+
declare function PageLoader({ preset, indicator, message, messages, interval, value, mark, delay, className, }: {
|
|
6
|
+
preset?: PageLoaderPreset;
|
|
7
|
+
indicator?: PageLoaderIndicator;
|
|
8
|
+
/** Texto fijo bajo el indicador. */
|
|
9
|
+
message?: string;
|
|
10
|
+
/** Varios textos que rotan (cargas largas: «Conectando…», «Preparando tu espacio…»). */
|
|
11
|
+
messages?: string[];
|
|
12
|
+
/** Milisegundos entre mensajes. */
|
|
13
|
+
interval?: number;
|
|
14
|
+
/** Avance 0–100. Sin valor, indeterminado. */
|
|
15
|
+
value?: number;
|
|
16
|
+
/** Marca o logo (preset splash). */
|
|
17
|
+
mark?: React.ReactNode;
|
|
18
|
+
/** Milisegundos antes de mostrarse; evita el parpadeo en cargas cortas. */
|
|
19
|
+
delay?: number;
|
|
20
|
+
className?: string;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { PageLoader, type PageLoaderIndicator, type PageLoaderPreset };
|
|
@@ -0,0 +1,163 @@
|
|
|
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 { cn } from "../lib/utils.js";
|
|
6
|
+
const PRESETS = {
|
|
7
|
+
splash: {
|
|
8
|
+
delay: 0,
|
|
9
|
+
frame: "fixed inset-0 z-(--ds-z-overlay) flex-col gap-6 bg-background"
|
|
10
|
+
},
|
|
11
|
+
route: {
|
|
12
|
+
delay: 150,
|
|
13
|
+
frame: "fixed inset-x-0 top-0 z-(--ds-z-overlay) h-(--ds-pageloader-route-h) pointer-events-none"
|
|
14
|
+
},
|
|
15
|
+
section: {
|
|
16
|
+
delay: 150,
|
|
17
|
+
frame: "min-h-(--ds-pageloader-min-h) w-full flex-col gap-4"
|
|
18
|
+
},
|
|
19
|
+
overlay: {
|
|
20
|
+
delay: 150,
|
|
21
|
+
frame: "absolute inset-0 z-(--ds-z-raised) flex-col gap-4 bg-background/70 backdrop-blur-(--ds-scrim-blur)"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
function Indicator({ kind }) {
|
|
25
|
+
if (kind === "pulse") {
|
|
26
|
+
return /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "relative grid size-(--ds-pageloader-size) place-items-center", children: [
|
|
27
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-ds-pageloader-wave rounded-full bg-primary motion-reduce:animate-none" }),
|
|
28
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-ds-pageloader-wave rounded-full bg-primary [animation-delay:calc(var(--ds-motion-pulse)/-2)] motion-reduce:animate-none" }),
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: "size-(--ds-pageloader-dot) rounded-full bg-primary" })
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
if (kind === "bars") {
|
|
33
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "flex h-(--ds-pageloader-size) items-center gap-1.5", children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
className: "h-full w-(--ds-pageloader-bar-w) origin-center animate-ds-pageloader-bars rounded-full bg-primary motion-reduce:animate-none",
|
|
37
|
+
style: { animationDelay: `calc(var(--ds-motion-pulse) * ${i} / -6)` }
|
|
38
|
+
},
|
|
39
|
+
i
|
|
40
|
+
)) });
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsxs(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
className: "relative grid size-(--ds-pageloader-size) place-items-center rounded-full border-(length:--ds-pageloader-stroke) border-(--ds-track-bg)",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-ds-orbit motion-reduce:animate-none", children: /* @__PURE__ */ jsx("span", { className: "absolute inset-x-0 top-0 mx-auto size-(--ds-pageloader-dot) -translate-y-1/2 rounded-full bg-primary" }) }),
|
|
49
|
+
/* @__PURE__ */ jsx("span", { className: "size-(--ds-pageloader-core) animate-ds-ring-inner rounded-full bg-primary/25 motion-reduce:animate-none" })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function PageLoader({
|
|
55
|
+
preset = "section",
|
|
56
|
+
indicator = "orbit",
|
|
57
|
+
message,
|
|
58
|
+
messages,
|
|
59
|
+
interval = 2400,
|
|
60
|
+
value,
|
|
61
|
+
mark,
|
|
62
|
+
delay,
|
|
63
|
+
className
|
|
64
|
+
}) {
|
|
65
|
+
const t = useDsMessages();
|
|
66
|
+
const base = PRESETS[preset];
|
|
67
|
+
const wait = delay ?? base.delay;
|
|
68
|
+
const [visible, setVisible] = React.useState(wait <= 0);
|
|
69
|
+
const [index, setIndex] = React.useState(0);
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
if (wait <= 0) return setVisible(true);
|
|
72
|
+
const id = window.setTimeout(() => setVisible(true), wait);
|
|
73
|
+
return () => window.clearTimeout(id);
|
|
74
|
+
}, [wait]);
|
|
75
|
+
const list = messages && messages.length > 0 ? messages : null;
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
if (!list || list.length < 2) return;
|
|
78
|
+
const id = window.setInterval(() => setIndex((i) => (i + 1) % list.length), interval);
|
|
79
|
+
return () => window.clearInterval(id);
|
|
80
|
+
}, [list, interval]);
|
|
81
|
+
const text = list ? list[index % list.length] : message;
|
|
82
|
+
const determinate = typeof value === "number" && Number.isFinite(value);
|
|
83
|
+
const pct = determinate ? Math.min(Math.max(value, 0), 100) : 0;
|
|
84
|
+
const state = visible ? "visible" : "waiting";
|
|
85
|
+
if (preset === "route") {
|
|
86
|
+
return /* @__PURE__ */ jsxs(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
role: "status",
|
|
90
|
+
"aria-busy": "true",
|
|
91
|
+
"data-slot": "page-loader",
|
|
92
|
+
"data-preset": preset,
|
|
93
|
+
"data-state": state,
|
|
94
|
+
className: cn(base.frame, !visible && "hidden", className),
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: text ?? t.loading }),
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
"span",
|
|
99
|
+
{
|
|
100
|
+
"aria-hidden": "true",
|
|
101
|
+
className: "relative block size-full overflow-hidden bg-(--ds-track-bg) [--ds-dir:1] rtl:[--ds-dir:-1]",
|
|
102
|
+
children: /* @__PURE__ */ jsx(
|
|
103
|
+
"span",
|
|
104
|
+
{
|
|
105
|
+
className: cn(
|
|
106
|
+
"absolute inset-y-0 start-0 bg-primary",
|
|
107
|
+
determinate ? "transition-[width] duration-(--ds-motion-slow) ease-(--ds-ease-standard) motion-reduce:transition-none" : "w-2/5 animate-ds-indeterminate motion-reduce:animate-none"
|
|
108
|
+
),
|
|
109
|
+
style: determinate ? { width: `${pct}%` } : void 0
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return /* @__PURE__ */ jsxs(
|
|
119
|
+
"div",
|
|
120
|
+
{
|
|
121
|
+
role: "status",
|
|
122
|
+
"aria-busy": "true",
|
|
123
|
+
"data-slot": "page-loader",
|
|
124
|
+
"data-preset": preset,
|
|
125
|
+
"data-indicator": indicator,
|
|
126
|
+
"data-state": state,
|
|
127
|
+
className: cn("items-center justify-center text-center", base.frame, visible ? "flex" : "hidden", className),
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: text ?? t.loading }),
|
|
130
|
+
mark && preset === "splash" ? /* @__PURE__ */ jsx("span", { "data-slot": "page-loader-mark", "aria-hidden": "true", className: "grid place-items-center", children: mark }) : null,
|
|
131
|
+
/* @__PURE__ */ jsx(Indicator, { kind: indicator }),
|
|
132
|
+
text ? /* @__PURE__ */ jsx(
|
|
133
|
+
"span",
|
|
134
|
+
{
|
|
135
|
+
"data-slot": "page-loader-message",
|
|
136
|
+
"aria-hidden": "true",
|
|
137
|
+
className: "max-w-prose px-4 text-sm text-muted-foreground animate-in fade-in motion-reduce:animate-none",
|
|
138
|
+
children: text
|
|
139
|
+
},
|
|
140
|
+
text
|
|
141
|
+
) : null,
|
|
142
|
+
determinate ? /* @__PURE__ */ jsx(
|
|
143
|
+
"span",
|
|
144
|
+
{
|
|
145
|
+
"data-slot": "page-loader-progress",
|
|
146
|
+
"aria-hidden": "true",
|
|
147
|
+
className: "relative h-(--ds-loader-bar-h) w-(--ds-pageloader-progress-w) overflow-hidden rounded-full bg-(--ds-track-bg)",
|
|
148
|
+
children: /* @__PURE__ */ jsx(
|
|
149
|
+
"span",
|
|
150
|
+
{
|
|
151
|
+
className: "absolute inset-y-0 start-0 bg-primary transition-[width] duration-(--ds-motion-slow) ease-(--ds-ease-standard) motion-reduce:transition-none",
|
|
152
|
+
style: { width: `${pct}%` }
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
) : null
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
PageLoader
|
|
163
|
+
};
|
package/docs/CONTRACT.md
CHANGED
|
@@ -134,7 +134,7 @@ en cualquier proyecto. Vocabulario común en `src/lib/presets.ts` (`DsDensity`,
|
|
|
134
134
|
4. **El diseño sigue el ancho del contenedor** (container query), no el dispositivo ni la presentación.
|
|
135
135
|
5. **Aviso en desarrollo** (`dsWarn`, mensaje en inglés) si la combinación no cuadra.
|
|
136
136
|
6. **Ganchos del DOM**: `data-slot` y `data-preset` (más `data-presentation`/`data-density` si aplica).
|
|
137
|
-
7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `ChartCard` (glance · standard · focus · dense), `ContentCard` (basic · feature · media · horizontal, con `emphasis` elevated · outlined · filled · ghost), `Mosaic` (even · bento · trio), `PageShell` (content · detail · canvas), `PageHeader` (page · compact · canvas), `FilterBar` (inline · compact · stacked), `DataTable` (browse · manage · compact), `LoadingState` (list · card · table · detail), `DetailPanel` (side · bottom · full), `EntityList` (list · grid · compact), `StepFlow` (quick · activation · long), `FormLayout`
|
|
137
|
+
7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `ChartCard` (glance · standard · focus · dense), `ContentCard` (basic · feature · media · horizontal, con `emphasis` elevated · outlined · filled · ghost), `Mosaic` (even · bento · trio), `PageShell` (content · detail · canvas), `PageHeader` (page · compact · canvas), `FilterBar` (inline · compact · stacked), `DataTable` (browse · manage · compact), `LoadingState` (list · card · table · detail), `PageLoader` (splash · route · section · overlay), `CommandPalette` (go · actions · search), `FileUpload` (drop · button), `ErrorPage` (not-found · forbidden · server-error · offline · maintenance, con `tone` neutral · playful), `DetailPanel` (side · bottom · full), `EntityList` (list · grid · compact), `StepFlow` (quick · activation · long), `FormLayout`
|
|
138
138
|
(inline · sectioned · settings), `NoticeReview` (read · acknowledge · resolve · respond), `EmptyState` (first-use · no-results · error · forbidden), `StatGroup` (overview ·
|
|
139
139
|
compact · comparison) y `ConfirmAction` (simple · typed).
|
|
140
140
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orbital-ds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Sistema de diseño genérico: estructura común + temas con personalidad (qratia, zyro) + ~60 componentes sobre Base UI y Tailwind v4, con contrato verificable y legible por agentes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|