orbital-ds 0.22.0 → 0.27.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.
@@ -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,15 @@
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-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;
524
+ --ds-section-gap: calc(1rem * var(--ds-density));
525
+ --ds-page-narrow-w: 42rem; /* ancho máximo de una vista de detalle (PageShell detail) */
526
+ --ds-mosaic-row: 8rem; /* alto mínimo de una fila del Mosaic */
527
+ --ds-list-gap: calc(0.75rem * var(--ds-density)); /* separación entre filas/tarjetas de una lista de entidades */
528
+ --ds-list-gap-compact: calc(0.25rem * var(--ds-density)); /* ídem en el preset compact */
522
529
  --ds-stat-value-weight: 600; /* cifra de un KPI */
523
530
  --ds-stat-accent-w: calc(var(--ds-rule-w) * 3); /* filete de tono del KPI */
524
531
  --ds-sparkline-h: 2rem;
@@ -537,6 +544,7 @@
537
544
  --ds-notifications-max-h: 24rem; /* alto máximo de la lista antes de desplazarse */
538
545
  --ds-dropzone-p: 2rem;
539
546
  --ds-filter-gap: 0.5rem;
547
+ --ds-filter-gap-compact: 0.25rem; /* FilterBar preset compact */
540
548
  --ds-banner-px: 1rem; /* aviso de página (Banner) */
541
549
  --ds-banner-py: 0.625rem;
542
550
  --ds-tabs-gap: 0.25rem; /* separación entre pestañas cuando el tema las separa */
@@ -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
  {
@@ -1,6 +1,8 @@
1
1
  import * as React from 'react';
2
2
 
3
- declare function FilterBar({ className, children, actions, onClear, canClear, ...props }: React.ComponentProps<"div"> & {
3
+ type FilterBarPreset = "inline" | "compact" | "stacked";
4
+ declare function FilterBar({ preset, className, children, actions, onClear, canClear, ...props }: React.ComponentProps<"div"> & {
5
+ preset?: FilterBarPreset;
4
6
  /** Acciones de la vista (exportar, guardar vista…), al final de la fila. */
5
7
  actions?: React.ReactNode;
6
8
  /** Si se pasa, muestra «Quitar filtros». */
@@ -33,4 +35,4 @@ declare function FilterMenu({ className, label, icon, value, onValueChange, opti
33
35
  id?: string;
34
36
  }): React.JSX.Element;
35
37
 
36
- export { FilterBar, FilterMenu, type FilterOption };
38
+ export { FilterBar, type FilterBarPreset, FilterMenu, type FilterOption };
@@ -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
+ };