orbital-ds 0.25.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 +273 -273
- package/components.manifest.json +360 -4
- 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 +53 -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.d.ts +4 -2
- package/dist/ui/filter-bar.js +8 -0
- package/dist/ui/page-header.d.ts +5 -2
- 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 +224 -224
- package/package.json +1 -1
- package/scripts/cli.mjs +6 -1
- package/scripts/doctor.mjs +7 -0
- package/scripts/manifest.mjs +100 -85
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
|
@@ -517,6 +517,10 @@
|
|
|
517
517
|
/* Piezas de datos y estructura (0.10.0) */
|
|
518
518
|
--ds-page-max-w: 72rem; /* ancho máximo del contenido de una vista (PageHeader) */
|
|
519
519
|
--ds-page-gap: 1.5rem;
|
|
520
|
+
--ds-page-title-size: 1.5rem; /* título de vista (PageHeader), contenedor estrecho */
|
|
521
|
+
--ds-page-title-size-wide: 1.875rem; /* ... y a partir de 42rem */
|
|
522
|
+
--ds-page-title-size-compact: 1.25rem; /* preset compact */
|
|
523
|
+
--ds-page-title-size-compact-wide: 1.5rem;
|
|
520
524
|
--ds-section-gap: calc(1rem * var(--ds-density));
|
|
521
525
|
--ds-page-narrow-w: 42rem; /* ancho máximo de una vista de detalle (PageShell detail) */
|
|
522
526
|
--ds-mosaic-row: 8rem; /* alto mínimo de una fila del Mosaic */
|
|
@@ -540,6 +544,7 @@
|
|
|
540
544
|
--ds-notifications-max-h: 24rem; /* alto máximo de la lista antes de desplazarse */
|
|
541
545
|
--ds-dropzone-p: 2rem;
|
|
542
546
|
--ds-filter-gap: 0.5rem;
|
|
547
|
+
--ds-filter-gap-compact: 0.25rem; /* FilterBar preset compact */
|
|
543
548
|
--ds-banner-px: 1rem; /* aviso de página (Banner) */
|
|
544
549
|
--ds-banner-py: 0.625rem;
|
|
545
550
|
--ds-tabs-gap: 0.25rem; /* separación entre pestañas cuando el tema las separa */
|
|
@@ -623,6 +628,20 @@
|
|
|
623
628
|
--ds-loader-bar-h: 2px;
|
|
624
629
|
--ds-loader-bg: var(--muted);
|
|
625
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) */
|
|
626
645
|
--ds-loader-done-glow: 0 0 #0000; /* brillo al terminar (sin sombra por defecto) */
|
|
627
646
|
|
|
628
647
|
/* ── MATERIALES ─────────────────────────────────────────────────────────
|
|
@@ -823,6 +842,40 @@
|
|
|
823
842
|
@utility animate-ds-indeterminate {
|
|
824
843
|
animation: ds-indeterminate var(--ds-motion-pulse) var(--ds-ease-pulse) infinite;
|
|
825
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
|
+
}
|
|
826
879
|
@keyframes ds-ring-inner {
|
|
827
880
|
from {
|
|
828
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 };
|