orbital-ds 0.22.0 → 0.25.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 CHANGED
@@ -22,7 +22,10 @@ adivinar. Lee antes: `README.md`, `docs/CONTRACT.md`, `contract.json` y
22
22
  foco incluido).
23
23
  6. **Un tema cumple el contrato completo** (`contract.json`) y define en `:root` todo
24
24
  `--ds-*` que defina el tema base.
25
- 7. **La marca de una app vive en SU `brand.css`**, no en el tema del paquete. Para
25
+ 7. **Unidades: rem, no px.** Tamaños, alturas y container queries (`@[32rem]`) van en `rem` para respetar el
26
+ tamaño de letra de la persona (WCAG 1.4.4); `em` solo si algo debe escalar con el texto de su propio
27
+ componente; `px` solo en filetes y bordes finos, a través de tokens. El doctor rechaza `@[Npx]`.
28
+ 8. **La marca de una app vive en SU `brand.css`**, no en el tema del paquete. Para
26
29
  personalizar una app (color, radio, fuentes) edita ese fichero; nunca `node_modules` ni
27
30
  los temas. `pnpm exec orbital-ds-init` lo crea sin sobrescribir.
28
31
 
@@ -70,12 +73,16 @@ adivinar. Lee antes: `README.md`, `docs/CONTRACT.md`, `contract.json` y
70
73
  desde las variables del tema activo y de la marca (paleta `--chart-1…5` + estados, textos, ejes, tooltip,
71
74
  fuentes, ritmo) y se repinta al cambiar de tema o de piel. SVG por defecto; `exportable` descarga SVG/PNG.
72
75
  Nunca pongas colores en el `option`: los da el tema (si una serie necesita un tono, usa la paleta del tema).
76
+ - **Tarjeta**: `<ChartCard preset="standard|glance|focus|dense" option={…} loading error empty />` (`orbital-ds/ui/chart-card`) pone título, estados, descarga y motor de pintado; el `option` sigue sin colores.
73
77
  - **Opciones listas**: `orbital-ds/lib/echarts-presets` (línea/área, barras, combo, mapa de calor, sankey,
74
- gauge, donut, líneas y áreas de referencia). Sirven igual en pantalla y en informes.
78
+ gauge, donut, dispersión, radar, embudo, treemap, sunburst, velas, boxplot, líneas y áreas de referencia). Sirven igual en pantalla y en informes.
75
79
  - **Informes automáticos (servidor / Workers, sin DOM)**: `renderEChartToSvg(option, { width, height, tokens })`
76
80
  (`orbital-ds/lib/echarts-server`) con `tokens` = `orbital-ds/themes/<tema>.tokens.json` → `.light` o
77
81
  `.dark` (colores ya resueltos; mezcla ahí los de la marca si la app tiene). Para PNG (plantillas de
78
82
  documento), la app convierte el SVG (p. ej. resvg) con las fuentes del tema.
83
+ - **Validación**: `pnpm check:charts` (dentro de `verify`) ejecuta cada constructor de `echarts-presets`, comprueba
84
+ que su `option` no lleva colores y que se dibuja como SVG en el servidor. Un constructor nuevo necesita su caso en
85
+ `scripts/check-charts.mjs`, o la comprobación falla.
79
86
  - Registro común de tipos y componentes: `orbital-ds/lib/echarts-setup`. Otro tipo → `echarts.use([...])` en la app. Si la app
80
87
  usa `echarts` directamente (sin `<EChart>` ni `renderEChartToSvg`), llama antes a `dsEcharts()` (registra y lo devuelve):
81
88
  así ningún empaquetador quita el registro. `pnpm check:bundle` lo comprueba empaquetando un consumidor.
@@ -154,10 +161,12 @@ en cualquier proyecto. Vocabulario común en `src/lib/presets.ts` (`DsDensity`,
154
161
  4. **El diseño sigue el ancho del contenedor** (container query), no el dispositivo ni la presentación.
155
162
  5. **Aviso en desarrollo** (`dsWarn`, mensaje en inglés) si la combinación no cuadra.
156
163
  6. **Ganchos del DOM**: `data-slot` y `data-preset` (más `data-presentation`/`data-density` si aplica).
157
- 7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `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), `DataTable` (browse · manage · compact), `LoadingState` (list · card · table · detail), `DetailPanel` (side · bottom · full), `EntityList` (list · grid · compact), `StepFlow` (quick · activation · long), `FormLayout`
158
165
  (inline · sectioned · settings), `NoticeReview` (read · acknowledge · resolve · respond), `EmptyState` (first-use · no-results · error · forbidden), `StatGroup` (overview ·
159
166
  compact · comparison) y `ConfirmAction` (simple · typed).
160
167
 
168
+ **Densidad global.** `--ds-density` (1 por defecto; 0.8 más denso, 1.2 más aireado) escala el relleno de celdas y la separación de secciones y listas; la app lo ajusta en `brand.css`.
169
+
161
170
  ## Avisos y comunicaciones in-app (qué canal usar)
162
171
 
163
172
  Se elige el canal por **urgencia** y **persistencia**; cada app no lo decide a mano:
@@ -179,6 +188,7 @@ Mismo vocabulario en todos: tono `info | success | warning | danger` y estado `n
179
188
  ```bash
180
189
  pnpm check:ds # contrato, repetidos, sombras, fugas, valores fijos, personalidad, familias, contraste y demos
181
190
  pnpm verify # doctor + typecheck + build + check:bundle
191
+ pnpm check:charts # cada constructor de gráfico: sin colores y dibuja SVG en servidor
182
192
  pnpm check:bundle # empaqueta un consumidor de EChart (navegador y servidor) y comprueba que dibuja
183
193
  pnpm manifest # regenera components.manifest.json tras añadir componentes
184
194
  pnpm showcase # escaparate: todos los componentes × todos los temas × claro/oscuro × marca
@@ -258,5 +268,6 @@ Para que una app (o un agente que la edite) use orbital-ds sin romper nada:
258
268
  - **Mínimo exigible: AA.** Texto 4,5:1; texto grande y controles 3:1. `pnpm check:ds` falla si un par principal de texto sobre su superficie (texto/fondo, tarjeta, popover, primario, secundario, lateral, destructivo) o un texto de estado (info, danger, warning, success, neutral) baja de 4,5:1.
259
269
  - **Objetivo: AAA en el texto del cuerpo** (7:1 para texto/fondo y texto/tarjeta). Se mide con `pnpm check:ds -- --aaa` y avisa, no falla: WCAG no aconseja exigir AAA a todo el sitio. Hoy todos los temas lo cumplen.
260
270
  - **Excepciones declaradas, nunca silenciosas.** Si un tema no puede cumplir un par (el azul de marca de Twitter con texto blanco da 3:1), lo declara en su ficha, en `a11y.exceptions`, con su porqué; el doctor lo muestra como aviso. Vale también para el texto de estado sobre su fondo suave (`"warning/warning-soft"`), p. ej. cuando el par viene del sistema corporativo que el tema reproduce (fractalia).
271
+ - **Tamaños mínimos** (WCAG 2.5.8 y legibilidad): objetivo táctil ≥ 1,5rem (24 px; los `--ds-control-h-*` van de 1,5 a 2,5rem), texto ≥ 0,75rem (`text-xs`) y cuerpo en 0,875–1rem. El doctor falla si un `--ds-control-h-*` baja de 1,5rem o hay `text-[…rem]` menor de 0,75rem.
261
272
  - **Foco siempre visible** (anillo de 3:1 como mínimo) y sin que otro elemento lo tape.
262
273
  - **Una marca nueva debe volver a pasar el doctor.** Cambiar `--primary` obliga a revisar `--primary-foreground`, `--link` y `--ring`.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "orbital-ds",
3
- "version": "0.22.0",
3
+ "version": "0.25.0",
4
4
  "engine": "@base-ui/react",
5
5
  "docs": [
6
6
  "README.md",
@@ -365,6 +365,21 @@
365
365
  "embla-carousel-react"
366
366
  ]
367
367
  },
368
+ "chart-card": {
369
+ "import": "orbital-ds/ui/chart-card",
370
+ "exports": [
371
+ "ChartCard",
372
+ "type ChartCardPreset"
373
+ ],
374
+ "slots": [
375
+ "chart-card"
376
+ ],
377
+ "optionalPeers": [],
378
+ "notes": [
379
+ "Gráfico en una tarjeta con cargando/error/vacío resueltos: `glance` para un vistazo, `standard` en un panel, `focus` para el gráfico principal (descargable), `dense` para muchos puntos (canvas). El option sale de orbital-ds/lib/echarts-presets y nunca lleva colores.",
380
+ "Varios gráficos juntos: dentro de Mosaic (bento: el principal primero y en `focus`). Para informes en servidor usa renderEChartToSvg con el mismo option."
381
+ ]
382
+ },
368
383
  "chart": {
369
384
  "import": "orbital-ds/ui/chart",
370
385
  "exports": [
@@ -536,6 +551,24 @@
536
551
  "El título nombra la acción y el objeto; el botón repite el verbo, no «Aceptar»."
537
552
  ]
538
553
  },
554
+ "content-card": {
555
+ "import": "orbital-ds/ui/content-card",
556
+ "exports": [
557
+ "ContentCard",
558
+ "type ContentCardEmphasis",
559
+ "type ContentCardPreset"
560
+ ],
561
+ "slots": [
562
+ "content-card",
563
+ "content-card-media"
564
+ ],
565
+ "optionalPeers": [],
566
+ "notes": [
567
+ "Tarjeta de contenido para rejillas: `basic` (texto), `feature` (icono + capacidad), `media` (portada arriba), `horizontal` (portada al lado). El énfasis (`elevated`, `outlined`, `filled`, `ghost`) cambia la prominencia, no la estructura.",
568
+ "Interactiva con `href` (navega) o `onSelect` (acción): toda la tarjeta es el objetivo y el título el enlace; no metas botones dentro de un enlace ni tarjetas dentro de tarjetas. Para filas de entidades usa Item variant=\"card\"; para cifras, Stat.",
569
+ "Para disponer varias, Mosaic (even · bento · trio)."
570
+ ]
571
+ },
539
572
  "context-menu": {
540
573
  "import": "orbital-ds/ui/context-menu",
541
574
  "exports": [
@@ -633,6 +666,7 @@
633
666
  "@tanstack/react-table"
634
667
  ],
635
668
  "notes": [
669
+ "Presets: `browse` consulta, `manage` añade selección para actuar, `compact` es denso y sin menú de columnas; cualquier prop explícita los sobrescribe.",
636
670
  "Para muchas filas, comparar y ordenar; para 3–5 elementos usa Item variant=\"card\". Estado en la URL con dataTableStateToSearch.",
637
671
  "Cifras con DataTableNumber (alineadas, tabular-nums); acciones por fila en un menú; sin resultados con Empty y «Limpiar filtros»."
638
672
  ]
@@ -659,6 +693,22 @@
659
693
  "react-day-picker"
660
694
  ]
661
695
  },
696
+ "detail-panel": {
697
+ "import": "orbital-ds/ui/detail-panel",
698
+ "exports": [
699
+ "DetailPanel",
700
+ "type DetailPanelPreset"
701
+ ],
702
+ "slots": [
703
+ "detail-panel",
704
+ "detail-panel-body",
705
+ "detail-panel-footer"
706
+ ],
707
+ "optionalPeers": [],
708
+ "notes": [
709
+ "Ficha de una entidad junto a su lista (`onSelect`/`onRowClick` abre el panel): `side` en escritorio, `bottom` en móvil, `full` para contenido largo. Para decidir algo bloqueante usa ConfirmAction, no esto."
710
+ ]
711
+ },
662
712
  "dialog": {
663
713
  "import": "orbital-ds/ui/dialog",
664
714
  "exports": [
@@ -864,7 +914,8 @@
864
914
  "type EntityListPreset"
865
915
  ],
866
916
  "slots": [
867
- "entity-list"
917
+ "entity-list",
918
+ "entity-list-bulk"
868
919
  ],
869
920
  "optionalPeers": [],
870
921
  "notes": [
@@ -1167,6 +1218,20 @@
1167
1218
  ],
1168
1219
  "optionalPeers": []
1169
1220
  },
1221
+ "loading-state": {
1222
+ "import": "orbital-ds/ui/loading-state",
1223
+ "exports": [
1224
+ "LoadingState",
1225
+ "type LoadingStatePreset"
1226
+ ],
1227
+ "slots": [
1228
+ "loading-state"
1229
+ ],
1230
+ "optionalPeers": [],
1231
+ "notes": [
1232
+ "Mientras carga, pinta la forma de lo que vendrá: `list` para filas, `card` para una tarjeta, `table` para una tabla, `detail` para una ficha."
1233
+ ]
1234
+ },
1170
1235
  "marker": {
1171
1236
  "import": "orbital-ds/ui/marker",
1172
1237
  "exports": [
@@ -1285,6 +1350,24 @@
1285
1350
  ],
1286
1351
  "optionalPeers": []
1287
1352
  },
1353
+ "mosaic": {
1354
+ "import": "orbital-ds/ui/mosaic",
1355
+ "exports": [
1356
+ "Mosaic",
1357
+ "MosaicItem",
1358
+ "type MosaicPreset"
1359
+ ],
1360
+ "slots": [
1361
+ "mosaic",
1362
+ "mosaic-item",
1363
+ "mosaic-root"
1364
+ ],
1365
+ "optionalPeers": [],
1366
+ "notes": [
1367
+ "Rejilla de tarjetas con jerarquía: `bento` para destacar lo primero, `trio` para tres iguales, `even` sin jerarquía. Si todo pesa lo mismo, usa `even` (o EntityList grid), no bento. Para spans manuales envuelve en MosaicItem.",
1368
+ "El destacado va el primero del DOM (orden de lectura); no reordenes con CSS."
1369
+ ]
1370
+ },
1288
1371
  "motion-provider": {
1289
1372
  "import": "orbital-ds/ui/motion-provider",
1290
1373
  "exports": [
@@ -1432,6 +1515,20 @@
1432
1515
  "Cabecera de vista: PageHeaderTitle + PageHeaderDescription y la acción principal en PageHeaderActions; centrada en --ds-page-max-w."
1433
1516
  ]
1434
1517
  },
1518
+ "page-shell": {
1519
+ "import": "orbital-ds/ui/page-shell",
1520
+ "exports": [
1521
+ "PageShell",
1522
+ "type PageShellPreset"
1523
+ ],
1524
+ "slots": [
1525
+ "page-shell"
1526
+ ],
1527
+ "optionalPeers": [],
1528
+ "notes": [
1529
+ "Envuelve cada vista: `content` para listas y paneles, `detail` para una entidad, `canvas` solo para lienzos (mapa, kanban, editor). La cabecera va dentro con PageHeader."
1530
+ ]
1531
+ },
1435
1532
  "pagination": {
1436
1533
  "import": "orbital-ds/ui/pagination",
1437
1534
  "exports": [
@@ -149,5 +149,79 @@ interface PieOptionInput extends CommonOptions {
149
149
  showLabels?: boolean;
150
150
  }
151
151
  declare function pieOption(input: PieOptionInput): EChartsCoreOption;
152
+ interface ScatterOptionInput extends CommonOptions {
153
+ /** Cada serie es un grupo de puntos `[x, y]` (o `[x, y, tamaño]` con `sizeAxis`). */
154
+ series: Array<{
155
+ name: string;
156
+ data: Array<[number, number] | [number, number, number]>;
157
+ }>;
158
+ xName?: string;
159
+ yName?: string;
160
+ /** La tercera coordenada de cada punto da su tamaño (burbujas). */
161
+ sizeAxis?: boolean;
162
+ /** Formateador del eje X (el del valor se usa para Y). */
163
+ xFormatter?: DsValueFormatter;
164
+ zoom?: boolean;
165
+ }
166
+ declare function scatterOption(input: ScatterOptionInput): EChartsCoreOption;
167
+ interface RadarOptionInput extends CommonOptions {
168
+ /** Dimensiones y su máximo (la escala de cada eje). */
169
+ indicators: Array<{
170
+ name: string;
171
+ max: number;
172
+ }>;
173
+ series: Array<{
174
+ name: string;
175
+ data: number[];
176
+ }>;
177
+ /** Rellena el área de cada serie. */
178
+ area?: boolean;
179
+ }
180
+ declare function radarOption(input: RadarOptionInput): EChartsCoreOption;
181
+ interface FunnelOptionInput extends CommonOptions {
182
+ /** Etapas de mayor a menor; el nombre sale en la etiqueta. */
183
+ data: Array<{
184
+ name: string;
185
+ value: number;
186
+ }>;
187
+ /** Muestra el valor en cada etapa. */
188
+ showValues?: boolean;
189
+ }
190
+ declare function funnelOption(input: FunnelOptionInput): EChartsCoreOption;
191
+ interface HierarchyNode {
192
+ name: string;
193
+ value?: number;
194
+ children?: HierarchyNode[];
195
+ }
196
+ interface TreemapOptionInput extends CommonOptions {
197
+ data: HierarchyNode[];
198
+ /** Muestra la ruta de migas para bajar y subir de nivel. */
199
+ breadcrumb?: boolean;
200
+ }
201
+ /** Peso relativo de partes de un todo con varios niveles (presupuesto, espacio en disco). */
202
+ declare function treemapOption(input: TreemapOptionInput): EChartsCoreOption;
203
+ interface SunburstOptionInput extends CommonOptions {
204
+ data: HierarchyNode[];
205
+ }
206
+ /** Composición en anillos concéntricos (cada anillo, un nivel de la jerarquía). */
207
+ declare function sunburstOption(input: SunburstOptionInput): EChartsCoreOption;
208
+ interface CandlestickOptionInput extends CommonOptions {
209
+ categories: Array<string | number>;
210
+ /** Por categoría: `[apertura, cierre, mínimo, máximo]`. */
211
+ data: Array<[number, number, number, number]>;
212
+ name?: string;
213
+ zoom?: boolean;
214
+ }
215
+ /** Precios o medidas con apertura, cierre, mínimo y máximo por periodo. */
216
+ declare function candlestickOption(input: CandlestickOptionInput): EChartsCoreOption;
217
+ interface BoxplotOptionInput extends CommonOptions {
218
+ categories: Array<string | number>;
219
+ /** Por categoría, ya calculado: `[mínimo, Q1, mediana, Q3, máximo]`. */
220
+ data: Array<[number, number, number, number, number]>;
221
+ name?: string;
222
+ horizontal?: boolean;
223
+ }
224
+ /** Distribución de una medida por grupo (mediana, cuartiles y extremos). */
225
+ declare function boxplotOption(input: BoxplotOptionInput): EChartsCoreOption;
152
226
 
153
- export { type BarOptionInput, type ComboOptionInput, type DsChartValue, type DsReference, type DsSeries, type DsValueFormatter, type GaugeOptionInput, type HeatmapOptionInput, type LineOptionInput, type PieOptionInput, type SankeyLink, type SankeyOptionInput, barOption, comboOption, escapeHtml, gaugeOption, heatmapOption, lineOption, pieOption, referenceArea, referenceLine, sankeyOption };
227
+ export { type BarOptionInput, type BoxplotOptionInput, type CandlestickOptionInput, type ComboOptionInput, type DsChartValue, type DsReference, type DsSeries, type DsValueFormatter, type FunnelOptionInput, type GaugeOptionInput, type HeatmapOptionInput, type HierarchyNode, type LineOptionInput, type PieOptionInput, type RadarOptionInput, type SankeyLink, type SankeyOptionInput, type ScatterOptionInput, type SunburstOptionInput, type TreemapOptionInput, barOption, boxplotOption, candlestickOption, comboOption, escapeHtml, funnelOption, gaugeOption, heatmapOption, lineOption, pieOption, radarOption, referenceArea, referenceLine, sankeyOption, scatterOption, sunburstOption, treemapOption };
@@ -297,15 +297,152 @@ function pieOption(input) {
297
297
  input.extend
298
298
  );
299
299
  }
300
+ function scatterOption(input) {
301
+ return finish(
302
+ {
303
+ tooltip: tooltip("item", input.valueFormatter),
304
+ legend: legend(input.legend, input.series.length),
305
+ xAxis: valueAxis(input.xFormatter, { ...input.xName ? { name: input.xName } : {}, scale: true }),
306
+ yAxis: valueAxis(input.valueFormatter, { ...input.yName ? { name: input.yName } : {}, scale: true }),
307
+ ...input.zoom ? { dataZoom: [{ type: "inside" }, { type: "inside", orient: "vertical" }] } : {},
308
+ series: input.series.map((s) => ({
309
+ type: "scatter",
310
+ name: s.name,
311
+ data: s.data,
312
+ ...input.sizeAxis ? { symbolSize: (v) => Math.max(6, Math.sqrt(v[2] ?? 0) * 2) } : {},
313
+ emphasis: { focus: "series" }
314
+ }))
315
+ },
316
+ input.extend
317
+ );
318
+ }
319
+ function radarOption(input) {
320
+ return finish(
321
+ {
322
+ tooltip: tooltip("item", input.valueFormatter),
323
+ legend: legend(input.legend, input.series.length),
324
+ radar: { indicator: input.indicators, radius: "68%", center: ["50%", "55%"] },
325
+ series: [
326
+ {
327
+ type: "radar",
328
+ data: input.series.map((s) => ({ name: s.name, value: s.data })),
329
+ ...input.area ? { areaStyle: { opacity: 0.15 } } : {},
330
+ emphasis: { focus: "series" }
331
+ }
332
+ ]
333
+ },
334
+ input.extend
335
+ );
336
+ }
337
+ function funnelOption(input) {
338
+ const fmt = input.valueFormatter;
339
+ return finish(
340
+ {
341
+ tooltip: tooltip("item", fmt),
342
+ legend: legend(input.legend ?? false, input.data.length),
343
+ series: [
344
+ {
345
+ type: "funnel",
346
+ top: 16,
347
+ bottom: 16,
348
+ left: "8%",
349
+ width: "84%",
350
+ sort: "descending",
351
+ gap: 2,
352
+ label: {
353
+ show: true,
354
+ position: "inside",
355
+ ...input.showValues && fmt ? { formatter: (p) => `${p.name} \xB7 ${fmt(p.value)}` } : {}
356
+ },
357
+ emphasis: { label: { fontSize: void 0 } },
358
+ data: input.data
359
+ }
360
+ ]
361
+ },
362
+ input.extend
363
+ );
364
+ }
365
+ function treemapOption(input) {
366
+ return finish(
367
+ {
368
+ tooltip: tooltip("item", input.valueFormatter),
369
+ series: [
370
+ {
371
+ type: "treemap",
372
+ data: input.data,
373
+ roam: false,
374
+ nodeClick: "zoomToNode",
375
+ breadcrumb: { show: input.breadcrumb ?? true, bottom: 0 },
376
+ label: { show: true },
377
+ upperLabel: { show: false },
378
+ itemStyle: { gapWidth: 2 }
379
+ }
380
+ ]
381
+ },
382
+ input.extend
383
+ );
384
+ }
385
+ function sunburstOption(input) {
386
+ return finish(
387
+ {
388
+ tooltip: tooltip("item", input.valueFormatter),
389
+ series: [
390
+ {
391
+ type: "sunburst",
392
+ data: input.data,
393
+ radius: ["12%", "90%"],
394
+ sort: void 0,
395
+ emphasis: { focus: "ancestor" },
396
+ label: { rotate: "radial" }
397
+ }
398
+ ]
399
+ },
400
+ input.extend
401
+ );
402
+ }
403
+ function candlestickOption(input) {
404
+ return finish(
405
+ {
406
+ tooltip: tooltip("axis", input.valueFormatter, { axisPointer: { type: "cross" } }),
407
+ legend: legend(false, 1),
408
+ xAxis: { type: "category", data: input.categories },
409
+ yAxis: valueAxis(input.valueFormatter, { scale: true }),
410
+ ...input.zoom ? { dataZoom: [{ type: "inside" }] } : {},
411
+ series: [{ type: "candlestick", name: input.name, data: input.data }]
412
+ },
413
+ input.extend
414
+ );
415
+ }
416
+ function boxplotOption(input) {
417
+ const category = { type: "category", data: input.categories };
418
+ const value = valueAxis(input.valueFormatter, { scale: true });
419
+ return finish(
420
+ {
421
+ tooltip: tooltip("item", input.valueFormatter),
422
+ legend: legend(false, 1),
423
+ xAxis: input.horizontal ? value : category,
424
+ yAxis: input.horizontal ? category : value,
425
+ series: [{ type: "boxplot", name: input.name, data: input.data }]
426
+ },
427
+ input.extend
428
+ );
429
+ }
300
430
  export {
301
431
  barOption,
432
+ boxplotOption,
433
+ candlestickOption,
302
434
  comboOption,
303
435
  escapeHtml,
436
+ funnelOption,
304
437
  gaugeOption,
305
438
  heatmapOption,
306
439
  lineOption,
307
440
  pieOption,
441
+ radarOption,
308
442
  referenceArea,
309
443
  referenceLine,
310
- sankeyOption
444
+ sankeyOption,
445
+ scatterOption,
446
+ sunburstOption,
447
+ treemapOption
311
448
  };
@@ -1,6 +1,16 @@
1
1
  import {
2
2
  BarChart,
3
+ BoxplotChart,
4
+ CandlestickChart,
5
+ EffectScatterChart,
3
6
  FunnelChart,
7
+ GraphChart,
8
+ ParallelChart,
9
+ PictorialBarChart,
10
+ SunburstChart,
11
+ ThemeRiverChart,
12
+ TreeChart,
13
+ TreemapChart,
4
14
  GaugeChart,
5
15
  HeatmapChart,
6
16
  LineChart,
@@ -19,7 +29,9 @@ import {
19
29
  MarkAreaComponent,
20
30
  MarkLineComponent,
21
31
  MarkPointComponent,
32
+ ParallelComponent,
22
33
  TitleComponent,
34
+ ToolboxComponent,
23
35
  TooltipComponent,
24
36
  TransformComponent,
25
37
  VisualMapComponent
@@ -33,7 +45,17 @@ function dsEcharts() {
33
45
  registered = true;
34
46
  echarts.use([
35
47
  BarChart,
48
+ BoxplotChart,
49
+ CandlestickChart,
50
+ EffectScatterChart,
36
51
  FunnelChart,
52
+ GraphChart,
53
+ ParallelChart,
54
+ PictorialBarChart,
55
+ SunburstChart,
56
+ ThemeRiverChart,
57
+ TreeChart,
58
+ TreemapChart,
37
59
  GaugeChart,
38
60
  HeatmapChart,
39
61
  LineChart,
@@ -50,7 +72,9 @@ function dsEcharts() {
50
72
  MarkAreaComponent,
51
73
  MarkLineComponent,
52
74
  MarkPointComponent,
75
+ ParallelComponent,
53
76
  TitleComponent,
77
+ ToolboxComponent,
54
78
  TooltipComponent,
55
79
  TransformComponent,
56
80
  VisualMapComponent,
package/dist/styles.css CHANGED
@@ -493,7 +493,8 @@
493
493
  --ds-card-spacing: 1.5rem;
494
494
  --ds-card-spacing-sm: 1rem;
495
495
  --ds-field-px: 0.75rem;
496
- --ds-cell-p: 0.75rem;
496
+ --ds-density: 1; /* escala global de relleno y separación de listas y tablas (0.8 = más denso, 1.2 = más aireado) */
497
+ --ds-cell-p: calc(0.75rem * var(--ds-density));
497
498
  --ds-overlay-p: 1.5rem;
498
499
  --ds-overlay-gap: 1.5rem;
499
500
  --ds-popover-p: 1rem;
@@ -516,9 +517,11 @@
516
517
  /* Piezas de datos y estructura (0.10.0) */
517
518
  --ds-page-max-w: 72rem; /* ancho máximo del contenido de una vista (PageHeader) */
518
519
  --ds-page-gap: 1.5rem;
519
- --ds-section-gap: 1rem;
520
- --ds-list-gap: 0.75rem; /* separación entre filas/tarjetas de una lista de entidades */
521
- --ds-list-gap-compact: 0.25rem; /* ídem en el preset compact */
520
+ --ds-section-gap: calc(1rem * var(--ds-density));
521
+ --ds-page-narrow-w: 42rem; /* ancho máximo de una vista de detalle (PageShell detail) */
522
+ --ds-mosaic-row: 8rem; /* alto mínimo de una fila del Mosaic */
523
+ --ds-list-gap: calc(0.75rem * var(--ds-density)); /* separación entre filas/tarjetas de una lista de entidades */
524
+ --ds-list-gap-compact: calc(0.25rem * var(--ds-density)); /* ídem en el preset compact */
522
525
  --ds-stat-value-weight: 600; /* cifra de un KPI */
523
526
  --ds-stat-accent-w: calc(var(--ds-rule-w) * 3); /* filete de tono del KPI */
524
527
  --ds-sparkline-h: 2rem;
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import { EChartProps, EChartHandle } from './echart.js';
3
+ import { EChartsCoreOption } from 'echarts/core';
4
+
5
+ type ChartCardPreset = "glance" | "standard" | "focus" | "dense";
6
+ declare const ChartCard: React.ForwardRefExoticComponent<{
7
+ option: EChartsCoreOption;
8
+ preset?: ChartCardPreset;
9
+ title?: React.ReactNode;
10
+ description?: React.ReactNode;
11
+ /** Acciones de la cabecera (selector de periodo, menú…). */
12
+ action?: React.ReactNode;
13
+ /** Pie: nota de la fuente, leyenda propia, enlace «Ver detalle». */
14
+ footer?: React.ReactNode;
15
+ loading?: boolean;
16
+ error?: unknown;
17
+ onRetry?: () => void;
18
+ /** Sin datos: muestra el texto de «sin datos» en lugar del gráfico. */
19
+ empty?: boolean;
20
+ height?: EChartProps["height"];
21
+ renderer?: EChartProps["renderer"];
22
+ exportable?: boolean;
23
+ fileName?: string;
24
+ onEvents?: EChartProps["onEvents"];
25
+ className?: string;
26
+ } & React.RefAttributes<EChartHandle>>;
27
+
28
+ export { ChartCard, type ChartCardPreset };
@@ -0,0 +1,79 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { useDsMessages } from "../hooks/use-ds-messages.js";
5
+ import { cn } from "../lib/utils.js";
6
+ import { Button } from "./button.js";
7
+ import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./card.js";
8
+ import { EChart } from "./echart.js";
9
+ import { EmptyState } from "./empty-state.js";
10
+ import { Skeleton } from "./skeleton.js";
11
+ const PRESETS = {
12
+ glance: { height: "9rem", exportable: false, renderer: "svg" },
13
+ standard: { height: "20rem", exportable: false, renderer: "svg" },
14
+ focus: { height: "27.5rem", exportable: true, renderer: "svg" },
15
+ dense: { height: "22.5rem", exportable: false, renderer: "canvas" }
16
+ };
17
+ const ChartCard = React.forwardRef(function ChartCard2({
18
+ option,
19
+ preset = "standard",
20
+ title,
21
+ description,
22
+ action,
23
+ footer,
24
+ loading = false,
25
+ error,
26
+ onRetry,
27
+ empty = false,
28
+ height,
29
+ renderer,
30
+ exportable,
31
+ fileName,
32
+ onEvents,
33
+ className
34
+ }, ref) {
35
+ const t = useDsMessages();
36
+ const base = PRESETS[preset];
37
+ const h = height ?? base.height;
38
+ const state = error ? "error" : loading ? "loading" : empty ? "empty" : "ready";
39
+ return /* @__PURE__ */ jsxs(
40
+ Card,
41
+ {
42
+ "data-slot": "chart-card",
43
+ "data-preset": preset,
44
+ "data-state": state,
45
+ className: cn("@container/chart-card min-w-0", className),
46
+ children: [
47
+ title || description || action ? /* @__PURE__ */ jsxs(CardHeader, { children: [
48
+ title ? /* @__PURE__ */ jsx(CardTitle, { children: title }) : null,
49
+ description ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null,
50
+ action ? /* @__PURE__ */ jsx(CardAction, { children: action }) : null
51
+ ] }) : null,
52
+ /* @__PURE__ */ jsx(CardContent, { children: state === "error" ? /* @__PURE__ */ jsx(
53
+ EmptyState,
54
+ {
55
+ preset: "error",
56
+ style: { minHeight: h },
57
+ action: onRetry ? /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: onRetry, children: t.entityRetry }) : void 0
58
+ }
59
+ ) : state === "loading" ? /* @__PURE__ */ jsx(Skeleton, { role: "status", "aria-busy": "true", "aria-label": t.loading, className: "w-full", style: { height: h } }) : /* @__PURE__ */ jsx(
60
+ EChart,
61
+ {
62
+ ref,
63
+ option,
64
+ height: h,
65
+ renderer: renderer ?? base.renderer,
66
+ exportable: exportable ?? base.exportable,
67
+ fileName,
68
+ empty,
69
+ onEvents
70
+ }
71
+ ) }),
72
+ footer ? /* @__PURE__ */ jsx(CardFooter, { className: "text-xs text-muted-foreground", children: footer }) : null
73
+ ]
74
+ }
75
+ );
76
+ });
77
+ export {
78
+ ChartCard
79
+ };
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import { DsDensity } from '../lib/presets.js';
3
+ import { IconTile } from './icon-tile.js';
4
+ import 'class-variance-authority/types';
5
+ import 'class-variance-authority';
6
+
7
+ type ContentCardPreset = "basic" | "feature" | "media" | "horizontal";
8
+ type ContentCardEmphasis = "elevated" | "outlined" | "filled" | "ghost";
9
+ declare function ContentCard({ preset, emphasis, tone, density, icon, media, title, description, action, footer, href, onSelect, children, className, }: {
10
+ preset?: ContentCardPreset;
11
+ emphasis?: ContentCardEmphasis;
12
+ tone?: React.ComponentProps<typeof IconTile>["tone"];
13
+ density?: DsDensity;
14
+ /** Icono (preset feature o cualquiera con `icon`). */
15
+ icon?: React.ReactNode;
16
+ /** Portada (preset media y horizontal): imagen, vídeo o cualquier nodo. */
17
+ media?: React.ReactNode;
18
+ title: React.ReactNode;
19
+ description?: React.ReactNode;
20
+ /** Acción de la cabecera (menú, botón de icono); sigue pulsable en una tarjeta interactiva. */
21
+ action?: React.ReactNode;
22
+ footer?: React.ReactNode;
23
+ /** Toda la tarjeta navega a esta ruta. */
24
+ href?: string;
25
+ /** Toda la tarjeta es un botón. */
26
+ onSelect?: () => void;
27
+ children?: React.ReactNode;
28
+ className?: string;
29
+ }): React.JSX.Element;
30
+
31
+ export { ContentCard, type ContentCardEmphasis, type ContentCardPreset };
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { dsWarn } from "../lib/presets.js";
5
+ import { cn } from "../lib/utils.js";
6
+ import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./card.js";
7
+ import { IconTile } from "./icon-tile.js";
8
+ const EMPHASIS = {
9
+ elevated: "",
10
+ outlined: "shadow-none hover:shadow-none",
11
+ filled: "border-transparent bg-muted shadow-none hover:shadow-none",
12
+ ghost: "border-transparent bg-transparent shadow-none hover:shadow-none"
13
+ };
14
+ const DENSITY = {
15
+ compact: "[--ds-card-spacing:var(--ds-card-spacing-sm)] gap-2",
16
+ default: "",
17
+ comfortable: "[--ds-card-spacing:calc(var(--ds-card-spacing)*1.25)]"
18
+ };
19
+ function ContentCard({
20
+ preset = "basic",
21
+ emphasis = "elevated",
22
+ tone = "neutral",
23
+ density = "default",
24
+ icon,
25
+ media,
26
+ title,
27
+ description,
28
+ action,
29
+ footer,
30
+ href,
31
+ onSelect,
32
+ children,
33
+ className
34
+ }) {
35
+ React.useEffect(() => {
36
+ if (href && onSelect) dsWarn("ContentCard", "use either `href` or `onSelect`, not both.");
37
+ if ((preset === "media" || preset === "horizontal") && !media)
38
+ dsWarn("ContentCard", `preset="${preset}" needs the \`media\` prop.`);
39
+ }, [href, onSelect, preset, media]);
40
+ const interactive = Boolean(href || onSelect);
41
+ const stretch = "after:absolute after:inset-0 after:content-[''] outline-none after:rounded-card focus-visible:after:ring-(length:--ds-ring-width) focus-visible:after:ring-(--ds-ring-color)";
42
+ const titleNode = href ? /* @__PURE__ */ jsx("a", { href, className: stretch, children: title }) : onSelect ? /* @__PURE__ */ jsx("button", { type: "button", onClick: onSelect, className: cn("text-start", stretch), children: title }) : title;
43
+ const horizontal = preset === "horizontal";
44
+ const showIcon = icon && preset !== "media" && preset !== "horizontal";
45
+ return /* @__PURE__ */ jsxs(
46
+ Card,
47
+ {
48
+ "data-slot": "content-card",
49
+ "data-preset": preset,
50
+ "data-emphasis": emphasis,
51
+ "data-tone": tone,
52
+ "data-density": density,
53
+ className: cn(
54
+ "@container/content-card relative",
55
+ EMPHASIS[emphasis],
56
+ DENSITY[density],
57
+ interactive && "cursor-pointer hover:bg-muted/40",
58
+ horizontal && "@md/content-card:flex-row @md/content-card:py-0",
59
+ className
60
+ ),
61
+ children: [
62
+ media && (preset === "media" || horizontal) ? /* @__PURE__ */ jsx(
63
+ "div",
64
+ {
65
+ "data-slot": "content-card-media",
66
+ className: cn(
67
+ "aspect-(--ds-media-aspect) w-full shrink-0 overflow-hidden bg-(--ds-track-bg) [&>img]:size-full [&>img]:object-cover",
68
+ horizontal && "@md/content-card:aspect-auto @md/content-card:w-1/3"
69
+ ),
70
+ children: media
71
+ }
72
+ ) : null,
73
+ /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col gap-(--ds-card-spacing)", horizontal && "@md/content-card:py-(--ds-card-spacing)"), children: [
74
+ /* @__PURE__ */ jsxs(CardHeader, { children: [
75
+ showIcon ? /* @__PURE__ */ jsx(IconTile, { tone, size: "md", className: "mb-1", children: icon }) : null,
76
+ /* @__PURE__ */ jsx(CardTitle, { children: titleNode }),
77
+ description ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null,
78
+ action ? /* @__PURE__ */ jsx(CardAction, { className: "relative z-(--ds-z-raised)", children: action }) : null
79
+ ] }),
80
+ children ? /* @__PURE__ */ jsx(CardContent, { children }) : null,
81
+ footer ? /* @__PURE__ */ jsx(CardFooter, { className: "relative z-(--ds-z-raised) gap-2", children: footer }) : null
82
+ ] })
83
+ ]
84
+ }
85
+ );
86
+ }
87
+ export {
88
+ ContentCard
89
+ };
@@ -146,7 +146,10 @@ declare function DataTableBarCell({ value, max, format, tone, className, }: {
146
146
  tone?: DsDataTone;
147
147
  className?: string;
148
148
  }): React.JSX.Element;
149
+ type DataTablePreset = "browse" | "manage" | "compact";
149
150
  interface DataTableProps<TData extends object> {
151
+ /** Intención: `browse` (consultar), `manage` (seleccionar y actuar) o `compact` (denso). Solo fija valores por defecto. */
152
+ preset?: DataTablePreset;
150
153
  columns: DataTableColumn<TData>[];
151
154
  data: TData[];
152
155
  /** Id estable de cada fila (selección que sobrevive a ordenar y filtrar). Por defecto, el índice. */
@@ -180,6 +183,6 @@ interface DataTableProps<TData extends object> {
180
183
  "aria-label"?: string;
181
184
  className?: string;
182
185
  }
183
- declare function DataTable<TData extends object>({ columns, data, getRowId, state: controlled, onStateChange, defaultState, searchable, selectable, columnToggle, pageSizes, loading, empty, onRowClick, toolbar, rowActions, density, "aria-label": ariaLabel, className, }: DataTableProps<TData>): React.JSX.Element;
186
+ declare function DataTable<TData extends object>({ columns, data, getRowId, state: controlled, onStateChange, defaultState, preset, searchable, selectable, columnToggle, pageSizes, loading, empty, onRowClick, toolbar, rowActions, density, "aria-label": ariaLabel, className, }: DataTableProps<TData>): React.JSX.Element;
184
187
 
185
- export { DATA_TABLE_PAGE_SIZES, DataTable, DataTableBarCell, type DataTableColumn, type DataTableColumnMeta, type DataTableFeatures, type DataTableFilterOption, DataTableNumber, type DataTableProps, type DataTableSearch, type DataTableState, createDataTableColumnHelper, dataTableFeatures, dataTableStateFromSearch, dataTableStateToSearch, validateDataTableSearch };
188
+ export { DATA_TABLE_PAGE_SIZES, DataTable, DataTableBarCell, type DataTableColumn, type DataTableColumnMeta, type DataTableFeatures, type DataTableFilterOption, DataTableNumber, type DataTablePreset, type DataTableProps, type DataTableSearch, type DataTableState, createDataTableColumnHelper, dataTableFeatures, dataTableStateFromSearch, dataTableStateToSearch, validateDataTableSearch };
@@ -274,6 +274,11 @@ function prepareColumns(columns) {
274
274
  return col;
275
275
  });
276
276
  }
277
+ const PRESET_DEFAULTS = {
278
+ browse: { searchable: true, selectable: false, columnToggle: true, density: "comfortable" },
279
+ manage: { searchable: true, selectable: true, columnToggle: true, density: "comfortable" },
280
+ compact: { searchable: true, selectable: false, columnToggle: false, density: "compact" }
281
+ };
277
282
  function DataTable({
278
283
  columns,
279
284
  data,
@@ -281,16 +286,17 @@ function DataTable({
281
286
  state: controlled,
282
287
  onStateChange,
283
288
  defaultState,
284
- searchable = true,
285
- selectable = false,
286
- columnToggle = true,
289
+ preset = "browse",
290
+ searchable = PRESET_DEFAULTS[preset].searchable,
291
+ selectable = PRESET_DEFAULTS[preset].selectable,
292
+ columnToggle = PRESET_DEFAULTS[preset].columnToggle,
287
293
  pageSizes = DATA_TABLE_PAGE_SIZES,
288
294
  loading = false,
289
295
  empty,
290
296
  onRowClick,
291
297
  toolbar,
292
298
  rowActions,
293
- density = "comfortable",
299
+ density = PRESET_DEFAULTS[preset].density,
294
300
  "aria-label": ariaLabel,
295
301
  className
296
302
  }) {
@@ -389,6 +395,7 @@ function DataTable({
389
395
  "div",
390
396
  {
391
397
  "data-slot": "data-table",
398
+ "data-preset": preset,
392
399
  "data-density": density,
393
400
  "aria-busy": loading || void 0,
394
401
  className: cn(
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+
3
+ type DetailPanelPreset = "side" | "bottom" | "full";
4
+ declare function DetailPanel({ open, onOpenChange, preset, side, title, description, footer, children, className, }: {
5
+ open?: boolean;
6
+ onOpenChange?: (open: boolean) => void;
7
+ preset?: DetailPanelPreset;
8
+ side?: "top" | "right" | "bottom" | "left";
9
+ title: React.ReactNode;
10
+ description?: React.ReactNode;
11
+ footer?: React.ReactNode;
12
+ children?: React.ReactNode;
13
+ className?: string;
14
+ }): React.JSX.Element;
15
+
16
+ export { DetailPanel, type DetailPanelPreset };
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../lib/utils.js";
4
+ import {
5
+ Sheet,
6
+ SheetContent,
7
+ SheetDescription,
8
+ SheetHeader,
9
+ SheetTitle
10
+ } from "./sheet.js";
11
+ const SIDE = {
12
+ side: "right",
13
+ bottom: "bottom",
14
+ full: "right"
15
+ };
16
+ const SIZE = {
17
+ side: "",
18
+ bottom: "max-h-[85dvh]",
19
+ full: "w-full sm:max-w-none"
20
+ };
21
+ function DetailPanel({
22
+ open,
23
+ onOpenChange,
24
+ preset = "side",
25
+ side,
26
+ title,
27
+ description,
28
+ footer,
29
+ children,
30
+ className
31
+ }) {
32
+ return /* @__PURE__ */ jsx(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
33
+ SheetContent,
34
+ {
35
+ "data-slot": "detail-panel",
36
+ "data-preset": preset,
37
+ side: side ?? SIDE[preset],
38
+ className: cn("gap-(--ds-overlay-gap) overflow-y-auto", SIZE[preset], className),
39
+ children: [
40
+ /* @__PURE__ */ jsxs(SheetHeader, { children: [
41
+ /* @__PURE__ */ jsx(SheetTitle, { children: title }),
42
+ description ? /* @__PURE__ */ jsx(SheetDescription, { children: description }) : null
43
+ ] }),
44
+ /* @__PURE__ */ jsx("div", { "data-slot": "detail-panel-body", className: "flex min-w-0 flex-1 flex-col gap-3 px-(--ds-overlay-p) text-sm", children }),
45
+ footer ? /* @__PURE__ */ jsx("div", { "data-slot": "detail-panel-footer", className: "flex flex-col-reverse gap-2 p-(--ds-overlay-p) sm:flex-row sm:justify-end", children: footer }) : null
46
+ ]
47
+ }
48
+ ) });
49
+ }
50
+ export {
51
+ DetailPanel
52
+ };
@@ -1,13 +1,15 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  type EntityListPreset = "list" | "grid" | "compact";
4
- declare function EntityList<T>({ items, getKey, renderItem, preset, toolbar, loading, error, onRetry, filtered, emptyAction, skeletonCount, className, }: {
4
+ declare function EntityList<T>({ items, getKey, renderItem, preset, toolbar, bulk, loading, error, onRetry, filtered, emptyAction, skeletonCount, className, }: {
5
5
  items: readonly T[];
6
6
  getKey: (item: T) => string | number;
7
7
  renderItem: (item: T) => React.ReactNode;
8
8
  preset?: EntityListPreset;
9
9
  /** Barra superior (FilterBar, buscador…). */
10
10
  toolbar?: React.ReactNode;
11
+ /** Barra de acciones en lote (aparece cuando la app tiene filas seleccionadas); la app decide cuándo pasarla. */
12
+ bulk?: React.ReactNode;
11
13
  loading?: boolean;
12
14
  /** Si hay error, se muestra en lugar de la lista. */
13
15
  error?: unknown;
@@ -17,6 +17,7 @@ function EntityList({
17
17
  renderItem,
18
18
  preset = "list",
19
19
  toolbar,
20
+ bulk,
20
21
  loading = false,
21
22
  error,
22
23
  onRetry,
@@ -36,6 +37,7 @@ function EntityList({
36
37
  className: cn("@container flex flex-col gap-(--ds-list-gap)", className),
37
38
  children: [
38
39
  toolbar,
40
+ bulk ? /* @__PURE__ */ jsx("div", { "data-slot": "entity-list-bulk", role: "toolbar", className: "flex flex-wrap items-center gap-2 rounded-card border border-border bg-muted/50 p-2", children: bulk }) : null,
39
41
  state === "error" ? /* @__PURE__ */ jsx(
40
42
  EmptyState,
41
43
  {
@@ -42,11 +42,11 @@ function FormLayout({
42
42
  role: bar ? "region" : void 0,
43
43
  "aria-label": bar ? t.formUnsaved : void 0,
44
44
  className: cn(
45
- "flex flex-col-reverse gap-2 @[520px]:flex-row @[520px]:items-center @[520px]:justify-end",
45
+ "flex flex-col-reverse gap-2 @[32.5rem]:flex-row @[32.5rem]:items-center @[32.5rem]:justify-end",
46
46
  bar && "sticky bottom-0 z-(--ds-z-raised) rounded-card border border-border bg-popover p-3 shadow-card"
47
47
  ),
48
48
  children: [
49
- bar && /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground @[520px]:me-auto", children: t.formUnsaved }),
49
+ bar && /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground @[32.5rem]:me-auto", children: t.formUnsaved }),
50
50
  onDiscard && /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", disabled: saving, onClick: onDiscard, children: discardLabel ?? t.formDiscard }),
51
51
  /* @__PURE__ */ jsx(Button, { type: "submit", disabled: saving, "aria-busy": saving || void 0, children: saving ? t.stepFlowSaving : saveLabel ?? t.formSave })
52
52
  ]
@@ -69,8 +69,8 @@ function FormSection({
69
69
  "data-slot": "form-section",
70
70
  className: cn(
71
71
  "grid min-w-0 gap-(--ds-section-gap)",
72
- "group-data-[preset=sectioned]/form:@[700px]:grid-cols-[minmax(10rem,16rem)_minmax(0,1fr)]",
73
- "group-data-[preset=settings]/form:@[700px]:grid-cols-[minmax(10rem,16rem)_minmax(0,1fr)]",
72
+ "group-data-[preset=sectioned]/form:@[43.75rem]:grid-cols-[minmax(10rem,16rem)_minmax(0,1fr)]",
73
+ "group-data-[preset=settings]/form:@[43.75rem]:grid-cols-[minmax(10rem,16rem)_minmax(0,1fr)]",
74
74
  className
75
75
  ),
76
76
  ...props,
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+
3
+ type LoadingStatePreset = "list" | "card" | "table" | "detail";
4
+ declare function LoadingState({ preset, rows, className, }: {
5
+ preset?: LoadingStatePreset;
6
+ rows?: number;
7
+ className?: string;
8
+ }): React.JSX.Element;
9
+
10
+ export { LoadingState, type LoadingStatePreset };
@@ -0,0 +1,48 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useDsMessages } from "../hooks/use-ds-messages.js";
3
+ import { cn } from "../lib/utils.js";
4
+ import { Skeleton } from "./skeleton.js";
5
+ function LoadingState({
6
+ preset = "list",
7
+ rows = 4,
8
+ className
9
+ }) {
10
+ const t = useDsMessages();
11
+ const n = Array.from({ length: rows }, (_, i) => i);
12
+ return /* @__PURE__ */ jsxs(
13
+ "div",
14
+ {
15
+ "data-slot": "loading-state",
16
+ "data-preset": preset,
17
+ role: "status",
18
+ "aria-busy": "true",
19
+ "aria-label": t.loading,
20
+ className: cn("flex w-full flex-col gap-(--ds-list-gap)", className),
21
+ children: [
22
+ preset === "list" && n.map((i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
23
+ /* @__PURE__ */ jsx(Skeleton, { className: "size-10 shrink-0" }),
24
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-2", children: [
25
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/3" }),
26
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-2/3" })
27
+ ] })
28
+ ] }, i)),
29
+ preset === "card" && /* @__PURE__ */ jsxs(Fragment, { children: [
30
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-1/2" }),
31
+ n.map((i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-full" }, i))
32
+ ] }),
33
+ preset === "table" && /* @__PURE__ */ jsxs(Fragment, { children: [
34
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-full" }),
35
+ n.map((i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-full" }, i))
36
+ ] }),
37
+ preset === "detail" && /* @__PURE__ */ jsxs(Fragment, { children: [
38
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-1/2" }),
39
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/3" }),
40
+ n.map((i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-20 w-full" }, i))
41
+ ] })
42
+ ]
43
+ }
44
+ );
45
+ }
46
+ export {
47
+ LoadingState
48
+ };
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+
3
+ type MosaicPreset = "even" | "bento" | "trio";
4
+ declare function Mosaic({ preset, className, ...props }: React.ComponentProps<"div"> & {
5
+ preset?: MosaicPreset;
6
+ }): React.JSX.Element;
7
+ /** Envuelve un hijo para darle span; solo se aplica cuando el contenedor es lo bastante ancho. */
8
+ declare function MosaicItem({ span, rows, className, ...props }: React.ComponentProps<"div"> & {
9
+ span?: 1 | 2 | 3 | 4;
10
+ rows?: 1 | 2 | 3;
11
+ }): React.JSX.Element;
12
+
13
+ export { Mosaic, MosaicItem, type MosaicPreset };
@@ -0,0 +1,52 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cn } from "../lib/utils.js";
3
+ const LAYOUT = {
4
+ even: "grid-cols-1 @[32rem]:grid-cols-2 @[56rem]:grid-cols-3",
5
+ bento: "grid-cols-1 @[32rem]:grid-cols-2 @[56rem]:grid-cols-4 @[56rem]:[&>*:first-child]:col-span-2 @[56rem]:[&>*:first-child]:row-span-2",
6
+ trio: "grid-cols-1 @[48rem]:grid-cols-3"
7
+ };
8
+ function Mosaic({
9
+ preset = "even",
10
+ className,
11
+ ...props
12
+ }) {
13
+ return /* @__PURE__ */ jsx("div", { "data-slot": "mosaic-root", className: "@container w-full", children: /* @__PURE__ */ jsx(
14
+ "div",
15
+ {
16
+ "data-slot": "mosaic",
17
+ "data-preset": preset,
18
+ className: cn(
19
+ "grid auto-rows-[minmax(var(--ds-mosaic-row),auto)] gap-(--ds-list-gap) [&>*]:min-w-0",
20
+ LAYOUT[preset],
21
+ className
22
+ ),
23
+ ...props
24
+ }
25
+ ) });
26
+ }
27
+ const COL = {
28
+ 1: "",
29
+ 2: "@[32rem]:col-span-2",
30
+ 3: "@[56rem]:col-span-3",
31
+ 4: "@[56rem]:col-span-4"
32
+ };
33
+ const ROW = { 1: "", 2: "@[32rem]:row-span-2", 3: "@[32rem]:row-span-3" };
34
+ function MosaicItem({
35
+ span = 1,
36
+ rows = 1,
37
+ className,
38
+ ...props
39
+ }) {
40
+ return /* @__PURE__ */ jsx(
41
+ "div",
42
+ {
43
+ "data-slot": "mosaic-item",
44
+ className: cn("flex flex-col *:flex-1", COL[span], ROW[rows], className),
45
+ ...props
46
+ }
47
+ );
48
+ }
49
+ export {
50
+ Mosaic,
51
+ MosaicItem
52
+ };
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+
3
+ type PageShellPreset = "content" | "detail" | "canvas";
4
+ declare function PageShell({ preset, className, ...props }: React.ComponentProps<"main"> & {
5
+ preset?: PageShellPreset;
6
+ }): React.JSX.Element;
7
+
8
+ export { PageShell, type PageShellPreset };
@@ -0,0 +1,29 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cn } from "../lib/utils.js";
3
+ const WIDTH = {
4
+ content: "max-w-(--ds-page-max-w)",
5
+ detail: "max-w-(--ds-page-narrow-w)",
6
+ canvas: "max-w-none"
7
+ };
8
+ function PageShell({
9
+ preset = "content",
10
+ className,
11
+ ...props
12
+ }) {
13
+ return /* @__PURE__ */ jsx(
14
+ "main",
15
+ {
16
+ "data-slot": "page-shell",
17
+ "data-preset": preset,
18
+ className: cn(
19
+ "@container mx-auto flex w-full flex-col gap-(--ds-section-gap)",
20
+ WIDTH[preset],
21
+ className
22
+ ),
23
+ ...props
24
+ }
25
+ );
26
+ }
27
+ export {
28
+ PageShell
29
+ };
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../lib/utils.js";
3
3
  const LAYOUT = {
4
- overview: "gap-(--ds-section-gap) grid-cols-1 @[480px]:grid-cols-2 @[900px]:grid-cols-4",
5
- compact: "gap-3 grid-cols-2 @[640px]:grid-cols-4",
6
- comparison: "gap-(--ds-section-gap) grid-cols-1 @[520px]:grid-cols-2"
4
+ overview: "gap-(--ds-section-gap) grid-cols-1 @[30rem]:grid-cols-2 @[56.25rem]:grid-cols-4",
5
+ compact: "gap-3 grid-cols-2 @[40rem]:grid-cols-4",
6
+ comparison: "gap-(--ds-section-gap) grid-cols-1 @[32.5rem]:grid-cols-2"
7
7
  };
8
8
  function StatGroup({
9
9
  preset = "overview",
@@ -132,7 +132,7 @@ function StepFlow({
132
132
  /* @__PURE__ */ jsxs(
133
133
  "div",
134
134
  {
135
- className: cn("flex flex-col gap-2", density !== "compact" && "@[600px]:hidden"),
135
+ className: cn("flex flex-col gap-2", density !== "compact" && "@[37.5rem]:hidden"),
136
136
  children: [
137
137
  /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-3 text-xs text-muted-foreground", children: [
138
138
  /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: dsFormat(t.stepOf, { n: index + 1, total: all.length }) }),
@@ -153,7 +153,7 @@ function StepFlow({
153
153
  {
154
154
  "aria-label": t.stepFlowProgress,
155
155
  orientation: "horizontal",
156
- className: "hidden @[600px]:flex",
156
+ className: "hidden @[37.5rem]:flex",
157
157
  children: all.map((s, i) => /* @__PURE__ */ jsxs(StepperItem, { step: i + 1, status: stepStatus(i, s), children: [
158
158
  /* @__PURE__ */ jsx(StepperIndicator, {}),
159
159
  /* @__PURE__ */ jsx(StepperContent, { className: "min-w-0 max-w-40", children: /* @__PURE__ */ jsx(StepperTitle, { className: "truncate", children: s.title }) }),
@@ -166,7 +166,7 @@ function StepFlow({
166
166
  {
167
167
  "aria-label": t.stepFlowProgress,
168
168
  orientation: "vertical",
169
- className: "hidden @[600px]:flex",
169
+ className: "hidden @[37.5rem]:flex",
170
170
  children: all.map((s, i) => /* @__PURE__ */ jsxs(StepperItem, { step: i + 1, status: stepStatus(i, s), children: [
171
171
  /* @__PURE__ */ jsx(StepperIndicator, {}),
172
172
  /* @__PURE__ */ jsxs(StepperContent, { children: [
@@ -201,7 +201,7 @@ function StepFlow({
201
201
  "div",
202
202
  {
203
203
  "data-slot": "step-flow-footer",
204
- className: "flex flex-col-reverse gap-2 @[600px]:flex-row @[600px]:items-center @[600px]:justify-end",
204
+ className: "flex flex-col-reverse gap-2 @[37.5rem]:flex-row @[37.5rem]:items-center @[37.5rem]:justify-end",
205
205
  children: [
206
206
  /* @__PURE__ */ jsx(
207
207
  Button,
@@ -209,7 +209,7 @@ function StepFlow({
209
209
  variant: "ghost",
210
210
  disabled: pending,
211
211
  onClick: requestClose,
212
- className: "@[600px]:me-auto",
212
+ className: "@[37.5rem]:me-auto",
213
213
  children: t.stepFlowCancel
214
214
  }
215
215
  ),
@@ -256,7 +256,7 @@ function StepFlow({
256
256
  {
257
257
  className: cn(
258
258
  "grid min-w-0 gap-(--ds-section-gap)",
259
- rail && "@[600px]:grid-cols-[minmax(10rem,14rem)_minmax(0,1fr)]"
259
+ rail && "@[37.5rem]:grid-cols-[minmax(10rem,14rem)_minmax(0,1fr)]"
260
260
  ),
261
261
  children: [
262
262
  result == null && progressNode,
@@ -265,11 +265,11 @@ function StepFlow({
265
265
  {
266
266
  className: cn(
267
267
  "grid min-w-0 gap-(--ds-section-gap)",
268
- showAside && result == null && "@[600px]:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]"
268
+ showAside && result == null && "@[37.5rem]:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]"
269
269
  ),
270
270
  children: [
271
271
  body,
272
- showAside && result == null && /* @__PURE__ */ jsx("aside", { "data-slot": "step-flow-aside", className: "hidden min-w-0 @[600px]:block", children: aside })
272
+ showAside && result == null && /* @__PURE__ */ jsx("aside", { "data-slot": "step-flow-aside", className: "hidden min-w-0 @[37.5rem]:block", children: aside })
273
273
  ]
274
274
  }
275
275
  )
package/docs/CONTRACT.md CHANGED
@@ -134,10 +134,12 @@ 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: `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), `DataTable` (browse · manage · compact), `LoadingState` (list · card · table · detail), `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
 
141
+ **Densidad global.** `--ds-density` (1 por defecto; 0.8 más denso, 1.2 más aireado) escala el relleno de celdas y la separación de secciones y listas; la app lo ajusta en `brand.css`.
142
+
141
143
  ## Avisos y comunicaciones in-app (qué canal usar)
142
144
 
143
145
  Se elige el canal por **urgencia** y **persistencia**; cada app no lo decide a mano:
@@ -154,6 +156,11 @@ Mismo vocabulario en todos: tono `info | success | warning | danger` y estado `n
154
156
  `NotificationItem onSelect` abre la revisión; `NoticeReview` tiene presets `read | acknowledge | resolve | respond`
155
157
  (modal o `presentation="sheet"`).
156
158
 
159
+ ## Unidades
160
+
161
+ Medidas en `rem` (también en container queries); `em` solo relativo al propio componente; `px` solo en filetes y
162
+ bordes finos vía token. `pnpm check:ds` rechaza `@[Npx]` y medidas fijas en valores arbitrarios.
163
+
157
164
  ## Reglas de nombres
158
165
 
159
166
  - Todo en **inglés**: tokens, props y valores de variantes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orbital-ds",
3
- "version": "0.22.0",
3
+ "version": "0.25.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",
@@ -68,10 +68,11 @@
68
68
  "build": "tsup && node scripts/build-css.mjs",
69
69
  "dev": "tsup --watch --onSuccess \"node scripts/copy-css.mjs\"",
70
70
  "typecheck": "tsc --noEmit",
71
- "verify": "pnpm check:ds && pnpm typecheck && pnpm showcase:typecheck && pnpm build && pnpm check:bundle && pnpm check:pack",
71
+ "verify": "pnpm check:ds && pnpm typecheck && pnpm showcase:typecheck && pnpm build && pnpm check:bundle && pnpm check:charts && pnpm check:pack",
72
72
  "manifest": "node scripts/manifest.mjs",
73
73
  "check:ds": "node scripts/doctor.mjs",
74
74
  "check:bundle": "node scripts/check-bundle.mjs",
75
+ "check:charts": "node scripts/check-charts.mjs",
75
76
  "check:pack": "node scripts/check-pack.mjs",
76
77
  "prepublishOnly": "pnpm verify",
77
78
  "showcase": "vite --config showcase/vite.config.ts",
@@ -70,6 +70,12 @@ function declarations(body) {
70
70
 
71
71
  /** Variables --ds-* que la estructura del paquete define (las que una app puede usar). */
72
72
  /** CSS de la estructura: src/ en el repo; dist/ en el paquete instalado (npm no publica src/). */
73
+ // Objetivo táctil mínimo WCAG 2.5.8 (AA): ningún control mide menos de 1,5rem (24 px).
74
+ {
75
+ const css = existsSync(join(ROOT, 'src/styles.css')) ? readFileSync(join(ROOT, 'src/styles.css'), 'utf8') : '';
76
+ for (const m of css.matchAll(/--ds-control-h-(xs|sm|md|lg)\s*:\s*([\d.]+)rem/g))
77
+ if (parseFloat(m[2]) < 1.5) errors.push(`accesibilidad: --ds-control-h-${m[1]} = ${m[2]}rem queda bajo el objetivo táctil mínimo de 1.5rem (WCAG 2.5.8)`);
78
+ }
73
79
  const STRUCTURE_CSS = existsSync(join(ROOT, 'src/styles.css')) ? join(ROOT, 'src/styles.css') : join(ROOT, 'dist/styles.css');
74
80
 
75
81
  function knownDsVars() {
@@ -507,6 +513,8 @@ const NO_HARDCODE = [
507
513
  { re: /(?<![\w-])(?:bg|text|border)-(?:black|white)(?:\/\d+)?(?![\w-])/g, why: 'color fijo (usa un token de color)' },
508
514
  { re: /(?<![\w-])shadow-(?:xs|sm|md|lg|xl|2xl)(?![\w-])/g, why: 'sombra de la escala Tailwind (usa shadow-card/control/raised/overlay/popover)' },
509
515
  { re: /(?<![\w-])text-\[\d+px\]/g, why: 'tamaño de texto arbitrario (usa la escala estándar)' },
516
+ { re: /(?<![\w-])text-\[(?:0?\.[0-6]\d*|0?\.7[0-4]\d*)rem\]/g, why: 'texto menor de 0,75rem (12 px): ilegible; usa text-xs como mínimo' },
517
+ { re: /@\[\d+px\]/g, why: 'container query en px (usa rem: respeta el tamaño de letra de la persona)' },
510
518
  { re: /(?<![\w-])rounded-(?:3xl|4xl)(?![\w-])/g, why: 'radio fuera de la rampa (usa rounded-control/overlay o la rampa sm…2xl)' },
511
519
  { re: /(?<![\w-])(?:bg|text|border|ring|fill|stroke)-(?:red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone)-\d{2,3}(?![\w-])/g, why: 'color de la paleta Tailwind (usa tokens del tema)' },
512
520
  ];