@sincpro/web-ui 1.10.0 → 1.11.1

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.
Files changed (47) hide show
  1. package/dist/components/board/Board.d.ts +51 -0
  2. package/dist/components/board/Board.js +15 -0
  3. package/dist/components/board/index.d.ts +1 -0
  4. package/dist/components/board/index.js +2 -0
  5. package/dist/components/frame/Chart.d.ts +12 -7
  6. package/dist/components/frame/Chart.js +17 -17
  7. package/dist/components/frame/FrameView.d.ts +3 -3
  8. package/dist/components/frame/FrameView.js +79 -26
  9. package/dist/components/frame/model.d.ts +12 -3
  10. package/dist/components/frame/model.js +53 -19
  11. package/dist/components/index.d.ts +1 -0
  12. package/dist/components/index.js +1 -0
  13. package/dist/components/listing/AxisLevels.d.ts +24 -0
  14. package/dist/components/listing/AxisLevels.js +58 -0
  15. package/dist/components/listing/ChartExplorer.d.ts +79 -0
  16. package/dist/components/listing/ChartExplorer.js +114 -0
  17. package/dist/components/listing/PivotExplorer.js +5 -36
  18. package/dist/components/listing/index.d.ts +2 -0
  19. package/dist/components/listing/index.js +2 -0
  20. package/dist/components/listing/set.d.ts +3 -1
  21. package/dist/foundations/calendar.d.ts +15 -0
  22. package/dist/foundations/calendar.js +59 -1
  23. package/dist/foundations/chart.d.ts +126 -0
  24. package/dist/foundations/chart.js +297 -0
  25. package/dist/foundations/copy.d.ts +39 -0
  26. package/dist/foundations/copy.es.js +27 -0
  27. package/dist/foundations/copy.js +27 -0
  28. package/dist/foundations/index.d.ts +2 -1
  29. package/dist/foundations/index.js +4 -1
  30. package/dist/foundations/pivot.d.ts +9 -0
  31. package/dist/foundations/pivot.js +1 -0
  32. package/dist/primitives/chart/Chart.d.ts +39 -0
  33. package/dist/primitives/chart/Chart.js +235 -0
  34. package/dist/primitives/chart/index.d.ts +1 -0
  35. package/dist/primitives/chart/index.js +1 -0
  36. package/dist/primitives/index.d.ts +1 -0
  37. package/dist/primitives/index.js +1 -0
  38. package/dist/primitives/value/Metric.d.ts +13 -2
  39. package/dist/primitives/value/Metric.js +25 -3
  40. package/dist/tokens.css +45 -0
  41. package/dist/views/list/List.d.ts +2 -1
  42. package/dist/views/list/List.js +8 -1
  43. package/dist/views/list/ListView.d.ts +1 -1
  44. package/dist/views/list/ListView.js +37 -5
  45. package/dist/views/list/index.d.ts +1 -1
  46. package/dist/views/list/types.d.ts +34 -0
  47. package/package.json +4 -2
@@ -0,0 +1,235 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { SERIES_COLORS, } from "../../foundations/chart.js";
4
+ import { fillCopy, useUiCopy } from "../../foundations/copy.js";
5
+ import { Empty } from "../notice/Notice.js";
6
+ import { useMemo, useState } from "react";
7
+ import { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, LabelList, Line, LineChart, Pie, PieChart, ReferenceLine, Tooltip, XAxis, YAxis, } from "recharts";
8
+ const MAX_BAR = 24;
9
+ const RADIUS = 4;
10
+ function colorOf(point, index, alone) {
11
+ /* The tail and the previous period are context, not the subject: the de-emphasis grey. */
12
+ if (point.rest === true || point.previous === true)
13
+ return "var(--color-muted)";
14
+ /* The current period of a comparison is the one series that matters. */
15
+ if (point.id === "\u0000current")
16
+ return "var(--color-data)";
17
+ if (alone)
18
+ return "var(--color-data)";
19
+ return `var(--color-series-${String((index % SERIES_COLORS) + 1)})`;
20
+ }
21
+ /** A swatch: identity rides the mark beside the text, never the text's colour. */
22
+ function Swatch({ color, line = false }) {
23
+ return (_jsx("span", { "aria-hidden": true, className: `shrink-0 ${line ? "h-0.5 w-3 rounded-pill" : "size-2.5 rounded-mark"}`, style: { background: color } }));
24
+ }
25
+ export function Chart({ data, kind = "bar", stacked: stackedProp = false, horizontal: horizontalProp, onPoint, label, height, }) {
26
+ const copy = useUiCopy();
27
+ const words = copy.chart;
28
+ const [off, setOff] = useState(() => new Set());
29
+ const alone = data.series.length <= 1;
30
+ /* Stacking one series is the series: it would only cost the rounded tip and the number. */
31
+ const stacked = stackedProp && !alone && data.compare !== true;
32
+ const number = useMemo(
33
+ /* Grouping ALWAYS: Spanish writes 7000 but 14.000, and one axis cannot say both. */
34
+ () => new Intl.NumberFormat(copy.locale, { maximumFractionDigits: 2, useGrouping: "always" }), [copy.locale]);
35
+ const compact = useMemo(() => new Intl.NumberFormat(copy.locale, { notation: "compact", maximumFractionDigits: 1 }), [copy.locale]);
36
+ const format = (value) => data.measure.format?.(value) ?? number.format(value);
37
+ const peak = Math.max(0, ...data.values.flatMap((row) => row.map((value) => Math.abs(value ?? 0))));
38
+ const negative = data.values.some((row) => row.some((value) => (value ?? 0) < 0));
39
+ /* In full up to the millions (7.000, 14.000), compact from there (2,5 M): Spanish compact
40
+ thousands come out as «7 K» next to «14 k» on the same axis. */
41
+ const tick = (value) => peak >= 1_000_000 ? compact.format(value) : number.format(value);
42
+ /* One object per category, the shape Recharts reads: `s0`, `s1`… per series. */
43
+ const rows = useMemo(() => data.categories.map((category, c) => {
44
+ const row = { label: category.label };
45
+ data.series.forEach((_, s) => {
46
+ row[`s${String(s)}`] = data.values[c]?.[s] ?? null;
47
+ });
48
+ return row;
49
+ }), [data]);
50
+ const series = data.series.map((point, index) => ({
51
+ point,
52
+ index,
53
+ key: `s${String(index)}`,
54
+ color: colorOf(point, index, alone),
55
+ shown: !off.has(point.id),
56
+ }));
57
+ const visible = series.filter((one) => one.shown);
58
+ const open = (categoryIndex, seriesIndex) => {
59
+ const category = data.categories[categoryIndex];
60
+ if (onPoint === undefined || category === undefined || category.rest === true)
61
+ return;
62
+ if (seriesIndex === undefined)
63
+ return onPoint(category.key);
64
+ const one = data.series[seriesIndex];
65
+ /* The tail and the previous period are not records of THIS set: nothing to open. */
66
+ if (one === undefined || one.rest === true || one.previous === true)
67
+ return;
68
+ onPoint(category.key, one.key);
69
+ };
70
+ const hidden = data.hiddenSeries + data.hiddenCategories;
71
+ const note = hidden === 0 ? null : (_jsx("p", { className: "text-micro text-muted", children: fillCopy(words.hidden, { count: hidden }) }));
72
+ if (data.categories.length === 0 || data.series.length === 0) {
73
+ return _jsx(Empty, { sentence: words.empty });
74
+ }
75
+ /* ── The pie: one whole, split. ───────────────────────────────── */
76
+ if (kind === "pie") {
77
+ if (data.totals.some((value) => (value ?? 0) < 0)) {
78
+ return _jsx(Empty, { sentence: words.pieNegative });
79
+ }
80
+ const slices = data.categories
81
+ .map((category, index) => ({
82
+ category,
83
+ index,
84
+ value: data.totals[index] ?? 0,
85
+ color: colorOf(category, index, false),
86
+ }))
87
+ .filter((slice) => slice.value > 0);
88
+ const whole = slices.reduce((total, slice) => total + slice.value, 0);
89
+ if (whole === 0)
90
+ return _jsx(Empty, { sentence: words.empty });
91
+ const percent = new Intl.NumberFormat(copy.locale, {
92
+ style: "percent",
93
+ maximumFractionDigits: 1,
94
+ });
95
+ return (
96
+ /* The pie asks ITS width, not the window's: in a narrow board tile the legend goes
97
+ under the ring instead of being squeezed beside it. */
98
+ _jsxs("figure", { "aria-label": label, className: "@container flex min-w-0 flex-col gap-3", children: [_jsxs("div", { className: "flex min-w-0 flex-col items-center gap-6 @lg:flex-row", children: [_jsxs("div", { className: "relative aspect-square w-full max-w-64 shrink-0", children: [_jsxs(PieChart, { responsive: true, width: "100%", height: "100%", title: label, children: [_jsx(Pie, { data: slices.map((slice) => ({
99
+ name: slice.category.label,
100
+ value: slice.value,
101
+ })), dataKey: "value", nameKey: "name", innerRadius: "62%", outerRadius: "98%",
102
+ /* From twelve o'clock, clockwise: how a whole is read. */
103
+ startAngle: 90, endAngle: -270, stroke: "var(--color-surface)", strokeWidth: 2, isAnimationActive: false, ...(onPoint === undefined
104
+ ? {}
105
+ : { onClick: (_, at) => open(slices[at]?.index ?? -1) }), cursor: onPoint === undefined ? "default" : "pointer", children: slices.map((slice) => (_jsx(Cell, { fill: slice.color }, slice.category.id))) }), _jsx(Tooltip, { isAnimationActive: false, content: (props) => _jsx(Readout, { ...props, format: format }) })] }), _jsxs("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center text-center", children: [_jsx("span", { className: "text-title font-semibold text-ink", children: format(whole) }), _jsx("span", { className: "text-micro text-muted", children: data.measure.header })] })] }), _jsx("ul", { className: "flex w-full max-w-sm min-w-0 flex-col gap-1.5", "aria-label": label, children: slices.map((slice) => (_jsxs("li", { className: "flex min-w-0 items-center gap-2 text-meta", children: [_jsx(Swatch, { color: slice.color }), _jsx("span", { className: "min-w-0 flex-1 truncate text-ink", children: slice.category.label }), _jsx("span", { className: "shrink-0 text-ink tabular-nums", children: format(slice.value) }), _jsx("span", { className: "w-12 shrink-0 text-right text-muted tabular-nums", children: percent.format(slice.value / whole) })] }, slice.category.id))) })] }), note] }));
106
+ }
107
+ /* ── Bars and lines: categories along an axis. ────────────────── */
108
+ const longest = Math.max(0, ...data.categories.map((category) => category.label.length));
109
+ const horizontal = kind === "bar" && (horizontalProp ?? (data.categories.length > 10 || longest > 18));
110
+ const perCategory = stacked || visible.length <= 1 ? 1 : visible.length;
111
+ const size = height !== undefined
112
+ ? { height }
113
+ : horizontal
114
+ ? { height: `${String(data.categories.length * (1 + perCategory * 0.75) + 3)}rem` }
115
+ : {};
116
+ const grid = (_jsx(CartesianGrid, { vertical: horizontal, horizontal: !horizontal, stroke: "var(--color-line)" }));
117
+ const tickStyle = { fill: "currentColor" };
118
+ const valueAxis = {
119
+ type: "number",
120
+ tickFormatter: tick,
121
+ tick: tickStyle,
122
+ tickLine: false,
123
+ axisLine: false,
124
+ };
125
+ const categoryAxis = {
126
+ type: "category",
127
+ dataKey: "label",
128
+ tick: tickStyle,
129
+ tickLine: false,
130
+ axisLine: { stroke: "var(--color-line-strong)" },
131
+ };
132
+ const axes = horizontal ? (_jsxs(_Fragment, { children: [_jsx(XAxis, { ...valueAxis }), _jsx(YAxis, { ...categoryAxis, width: "auto", interval: 0 })] })) : (_jsxs(_Fragment, { children: [_jsx(XAxis, { ...categoryAxis, interval: "preserveStartEnd", minTickGap: 8 }), _jsx(YAxis, { ...valueAxis, width: "auto" })] }));
133
+ const zero = negative ? (_jsx(ReferenceLine, { ...(horizontal ? { x: 0 } : { y: 0 }), stroke: "var(--color-line-strong)" })) : null;
134
+ const readout = (props) => (_jsx(Readout, { ...props, format: format, compare: data.compare === true }));
135
+ /* The value rides the tip of its bar when there is ONE series: the axis gives the scale,
136
+ the tip gives the number, and nobody has to hover thirty bars to read them. With
137
+ several series it would be a number on every mark, which is noise. */
138
+ const tips = !stacked && visible.length === 1 && (horizontal || data.categories.length <= 12);
139
+ let plot;
140
+ if (kind === "bar") {
141
+ plot = (_jsxs(BarChart, { data: rows, layout: horizontal ? "vertical" : "horizontal", responsive: true, width: "100%", height: "100%", title: label, barGap: 2, barCategoryGap: "20%", margin: {
142
+ top: tips && !horizontal ? 20 : 8,
143
+ right: tips && horizontal ? 56 : 8,
144
+ bottom: 0,
145
+ left: 0,
146
+ }, stackOffset: negative ? "sign" : "none", children: [grid, axes, zero, _jsx(Tooltip, { isAnimationActive: false, cursor: { fill: "var(--color-ink)", fillOpacity: 0.04 }, content: readout }), visible.map((one) => (_jsx(Bar, { dataKey: one.key, name: one.point.label, fill: one.color, maxBarSize: MAX_BAR, isAnimationActive: false, ...(stacked
147
+ ? { stackId: "stack", stroke: "var(--color-surface)", strokeWidth: 1 }
148
+ : {
149
+ radius: horizontal
150
+ ? [0, RADIUS, RADIUS, 0]
151
+ : [RADIUS, RADIUS, 0, 0],
152
+ }), cursor: onPoint === undefined ? "default" : "pointer", ...(onPoint === undefined
153
+ ? {}
154
+ : { onClick: (_, at) => open(at, one.index) }), children: tips ? (_jsx(LabelList, { dataKey: one.key, content: (props) => (_jsx(Tip, { viewBox: props.viewBox, value: props.value, horizontal: horizontal, format: format })) })) : null }, one.point.id)))] }));
155
+ }
156
+ else {
157
+ const dots = rows.length <= 24;
158
+ const common = {
159
+ data: rows,
160
+ responsive: true,
161
+ width: "100%",
162
+ height: "100%",
163
+ title: label,
164
+ margin: { top: 8, right: 12, bottom: 0, left: 0 },
165
+ ...(onPoint === undefined
166
+ ? {}
167
+ : {
168
+ onClick: (state) => {
169
+ const at = Number(state.activeIndex);
170
+ if (Number.isInteger(at))
171
+ open(at, alone ? 0 : undefined);
172
+ },
173
+ style: { cursor: "pointer" },
174
+ }),
175
+ };
176
+ const ring = { r: 5, stroke: "var(--color-surface)", strokeWidth: 2 };
177
+ const tooltip = (_jsx(Tooltip, { isAnimationActive: false, cursor: { stroke: "var(--color-line-strong)" }, content: readout }));
178
+ plot = stacked ? (_jsxs(AreaChart, { ...common, stackOffset: negative ? "sign" : "none", children: [grid, axes, zero, tooltip, visible.map((one) => (_jsx(Area, { type: "monotone", dataKey: one.key, name: one.point.label, stackId: "stack", stroke: one.color, strokeWidth: 2, fill: one.color, fillOpacity: 0.12, dot: false, activeDot: { ...ring, fill: one.color }, isAnimationActive: false }, one.point.id)))] })) : (_jsxs(LineChart, { ...common, children: [grid, axes, zero, tooltip, visible.map((one) => (_jsx(Line, { type: "monotone", dataKey: one.key, name: one.point.label, stroke: one.color, strokeWidth: 2, dot: dots
179
+ ? { r: 4, fill: one.color, stroke: "var(--color-surface)", strokeWidth: 2 }
180
+ : false, activeDot: { ...ring, fill: one.color }, connectNulls: false, isAnimationActive: false }, one.point.id)))] }));
181
+ }
182
+ return (_jsxs("figure", { "aria-label": label, className: "flex min-w-0 flex-col gap-3", children: [alone ? null : (_jsx("ul", { className: "flex min-w-0 flex-wrap items-center gap-x-1 gap-y-1", children: series.map((one) => (_jsx("li", { className: "min-w-0", children: _jsxs("button", { type: "button", "aria-pressed": one.shown, "aria-label": fillCopy(one.shown ? words.hideSeries : words.showSeries, {
183
+ name: one.point.label,
184
+ }),
185
+ /* The last one on cannot be turned off: a chart with nothing on it reads
186
+ as broken, not as «you hid everything». */
187
+ disabled: one.shown && visible.length === 1, onClick: () => setOff((current) => {
188
+ const next = new Set(current);
189
+ if (next.has(one.point.id))
190
+ next.delete(one.point.id);
191
+ else
192
+ next.add(one.point.id);
193
+ return next;
194
+ }), className: `inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-control px-1.5 py-0.5 text-meta transition-colors duration-(--duration-instant) outline-0 hover:bg-ink/5 focus-visible:outline-2 focus-visible:outline-primary ${one.shown ? "text-ink" : "text-muted line-through"}`, children: [_jsx(Swatch, { color: one.shown ? one.color : "var(--color-line-strong)", line: kind === "line" }), _jsx("span", { className: "truncate", children: one.point.label })] }) }, one.point.id))) })), _jsx("div", { className: `min-w-0 text-micro text-muted ${height === undefined && !horizontal ? "h-72" : ""}`, style: size, children: plot }), note] }));
195
+ }
196
+ /**
197
+ * The number at the tip of a bar, on ONE line. Recharts' own label wraps to the bar's
198
+ * width, which breaks «Bs. 51.100» in two over a 24 px bar.
199
+ */
200
+ function Tip({ viewBox, value, horizontal, format, }) {
201
+ if (typeof value !== "number" || typeof viewBox !== "object" || viewBox === null)
202
+ return null;
203
+ const box = viewBox;
204
+ const { x = 0, y = 0, width = 0, height = 0 } = box;
205
+ /* A negative bar has its tip on the other side of the zero. */
206
+ const below = value < 0;
207
+ return horizontal ? (_jsx("text", { x: below ? x + width - 6 : x + width + 6, y: y + height / 2, textAnchor: below ? "end" : "start", dominantBaseline: "central", fill: "var(--color-ink)", className: "tabular-nums", children: format(value) })) : (_jsx("text", { x: x + width / 2, y: below ? y + height + 6 : y - 6, textAnchor: "middle", dominantBaseline: below ? "hanging" : "auto", fill: "var(--color-ink)", className: "tabular-nums", children: format(value) }));
208
+ }
209
+ /** What hovering (or arrowing to) a category says: its name, and each series' number. */
210
+ function Readout({ active, payload, label, format, compare = false, }) {
211
+ const copy = useUiCopy();
212
+ const words = copy.chart;
213
+ const percent = useMemo(() => new Intl.NumberFormat(copy.locale, {
214
+ style: "percent",
215
+ maximumFractionDigits: 1,
216
+ signDisplay: "exceptZero",
217
+ }), [copy.locale]);
218
+ if (active !== true || payload === undefined || payload.length === 0)
219
+ return null;
220
+ const heading = label ?? payload[0]?.name;
221
+ /* Now against before, said as a change: the number a comparison is asked for. */
222
+ const now = payload[0]?.value;
223
+ const before = payload[1]?.value;
224
+ const change = compare && typeof now === "number" && typeof before === "number" && before !== 0
225
+ ? (now - before) / Math.abs(before)
226
+ : null;
227
+ return (_jsxs("div", { className: "max-w-xs min-w-40 rounded-control border border-line-strong bg-surface px-3 py-2 text-micro text-ink shadow-float", children: [heading === undefined || heading === "" ? null : (_jsx("p", { className: "mb-1.5 truncate font-medium", children: String(heading) })), _jsx("ul", { className: "flex flex-col gap-1", children: payload.map((entry) => {
228
+ const color = typeof entry.color === "string"
229
+ ? entry.color
230
+ : typeof entry.payload?.fill === "string"
231
+ ? entry.payload.fill
232
+ : "var(--color-data)";
233
+ return (_jsxs("li", { className: "flex items-center gap-2", children: [_jsx(Swatch, { color: color }), _jsx("span", { className: "min-w-0 flex-1 truncate text-muted", children: String(entry.name) }), _jsx("span", { className: "shrink-0 tabular-nums", children: typeof entry.value === "number" ? format(entry.value) : "—" })] }, String(entry.dataKey ?? entry.name)));
234
+ }) }), change === null ? null : (_jsxs("p", { className: "mt-1.5 flex items-center justify-between gap-3 border-t border-line pt-1.5", children: [_jsx("span", { className: "text-muted", children: words.change }), _jsx("span", { className: "tabular-nums", children: percent.format(change) })] }))] }));
235
+ }
@@ -0,0 +1 @@
1
+ export { Chart, type ChartProps } from "./Chart.js";
@@ -0,0 +1 @@
1
+ export { Chart } from "./Chart.js";
@@ -1,6 +1,7 @@
1
1
  export * from "./block/index.js";
2
2
  export * from "./button/index.js";
3
3
  export * from "./cell/index.js";
4
+ export * from "./chart/index.js";
4
5
  export * from "./choice/index.js";
5
6
  export * from "./date/index.js";
6
7
  export * from "./dialog/index.js";
@@ -2,6 +2,7 @@
2
2
  export * from "./block/index.js";
3
3
  export * from "./button/index.js";
4
4
  export * from "./cell/index.js";
5
+ export * from "./chart/index.js";
5
6
  export * from "./choice/index.js";
6
7
  export * from "./date/index.js";
7
8
  export * from "./dialog/index.js";
@@ -1,5 +1,5 @@
1
1
  import type { Tone } from "../../foundations/types.js";
2
- import type { LucideIcon } from "lucide-react";
2
+ import { type LucideIcon } from "lucide-react";
3
3
  /**
4
4
  * A metric that also FILTERS: «2 por confirmar», «41 por entregar».
5
5
  *
@@ -33,8 +33,19 @@ export type MetricProps = {
33
33
  onClick?: () => void;
34
34
  /** This narrowing is applied. */
35
35
  active?: boolean;
36
+ /**
37
+ * How it moved against a NAMED period: `{ by: 0.18, against: "2025" }` draws «↗ +18 % vs
38
+ * 2025». Whether up is good is the domain's (`better`, up by default): more sales is
39
+ * good news, more overdue invoices is not. The arrow carries the direction and the word
40
+ * the period, so the colour is never the only channel.
41
+ */
42
+ change?: {
43
+ by: number;
44
+ against: string;
45
+ better?: "up" | "down";
46
+ };
36
47
  };
37
- export declare function Metric({ value, label, tone, icon: Icon, onClick, active, }: MetricProps): import("react").JSX.Element;
48
+ export declare function Metric({ value, label, tone, icon: Icon, onClick, active, change, }: MetricProps): import("react").JSX.Element;
38
49
  /** The row of metrics. It wraps if they don't fit; it doesn't scroll: a hidden
39
50
  * metric is a filter nobody finds. */
40
51
  export declare function Metrics({ children }: {
@@ -1,7 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useUiCopy } from "../../foundations/copy.js";
3
+ import { fillCopy, useUiCopy } from "../../foundations/copy.js";
4
4
  import { bySurface, useSurface } from "../../foundations/surface.js";
5
+ import { ArrowDownRight, ArrowUpRight } from "lucide-react";
6
+ import { useMemo } from "react";
5
7
  const TONE = {
6
8
  neutral: { background: "bg-ink/6", text: "text-ink", edge: "border-ink/20" },
7
9
  info: { background: "bg-info/10", text: "text-info", edge: "border-info/35" },
@@ -12,10 +14,15 @@ const TONE = {
12
14
  ink and the tone is only visible when the card is lit up. */
13
15
  accent: { background: "bg-accent/20", text: "text-ink", edge: "border-accent/50" },
14
16
  };
15
- export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, active = false, }) {
17
+ export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, active = false, change, }) {
16
18
  const copy = useUiCopy();
17
19
  const sup = useSurface();
18
20
  const t = TONE[tone];
21
+ const percent = useMemo(() => new Intl.NumberFormat(copy.locale, {
22
+ style: "percent",
23
+ maximumFractionDigits: 1,
24
+ signDisplay: "exceptZero",
25
+ }), [copy.locale]);
19
26
  /* At rest the box is the sheet with a hair of border: that is what makes four
20
27
  metrics read as one row and not as four notices. Lit up it gets tinted, and
21
28
  there the color says which one is applied. */
@@ -25,12 +32,27 @@ export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, ac
25
32
  const box = `flex min-w-(--container-metric) shrink-0 flex-col justify-center gap-0.5 rounded-box border px-3.5 py-2 text-left transition-colors duration-(--duration-instant) ${skin} ${onClick === undefined
26
33
  ? ""
27
34
  : "cursor-pointer hover:border-line-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"}`;
28
- const content = (_jsxs(_Fragment, { children: [_jsxs("span", { className: `flex items-center gap-1.5 text-title font-semibold tabular-nums ${t.text}`, children: [Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md)", strokeWidth: 2, "aria-hidden": true })), typeof value === "number" ? value.toLocaleString(copy.locale) : value] }), _jsx("span", { className: `text-micro ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: label })] }));
35
+ const content = (_jsxs(_Fragment, { children: [_jsxs("span", { className: `flex items-center gap-1.5 text-title font-semibold tabular-nums ${t.text}`, children: [Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md)", strokeWidth: 2, "aria-hidden": true })), typeof value === "number" ? value.toLocaleString(copy.locale) : value] }), _jsx("span", { className: `text-micro ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: label }), change === undefined ? null : _jsx(Change, { change: change, format: percent.format })] }));
29
36
  if (onClick === undefined) {
30
37
  return (_jsx("div", { className: box, "aria-label": `${value} ${label}`, children: content }));
31
38
  }
32
39
  return (_jsx("button", { type: "button", onClick: onClick, "aria-pressed": active, className: box, children: content }));
33
40
  }
41
+ function Change({ change, format, }) {
42
+ const copy = useUiCopy();
43
+ const sup = useSurface();
44
+ const up = change.by > 0;
45
+ const flat = change.by === 0;
46
+ const good = flat ? null : up === ((change.better ?? "up") === "up");
47
+ const Arrow = up ? ArrowUpRight : ArrowDownRight;
48
+ /* On the chrome the states have their own steps; on the canvas, the usual ones. */
49
+ const color = good === null
50
+ ? bySurface(sup, "text-muted", "text-chrome-muted")
51
+ : good
52
+ ? bySurface(sup, "text-good", "text-chrome-good")
53
+ : bySurface(sup, "text-bad", "text-chrome-bad");
54
+ return (_jsxs("span", { className: `flex items-center gap-1 text-micro tabular-nums ${color}`, children: [flat ? null : _jsx(Arrow, { className: "size-(--size-icon-sm)", strokeWidth: 2, "aria-hidden": true }), format(change.by), _jsx("span", { className: bySurface(sup, "text-muted", "text-chrome-muted"), children: fillCopy(copy.chart.against, { name: change.against }) })] }));
55
+ }
34
56
  /** The row of metrics. It wraps if they don't fit; it doesn't scroll: a hidden
35
57
  * metric is a filter nobody finds. */
36
58
  export function Metrics({ children }) {
package/dist/tokens.css CHANGED
@@ -161,6 +161,27 @@
161
161
  element requires. */
162
162
  --color-data-soft: #5c74a6; /* 4.43:1 */
163
163
 
164
+ /* The CATEGORICAL palette: one hue per series when a chart draws two or more. A single
165
+ series is `data`. Eight and not one more — a ninth would be a generated hue, and under
166
+ colour blindness it reads as one of these; the chart gathers the tail into «others».
167
+
168
+ The ORDER is the colour-blind safety, not taste: every neighbouring pair stays apart
169
+ under protan and deutan simulation (worst OKLab ΔE 9.1 here, 8.4 in the dark, target 8)
170
+ and under normal vision (worst 19.6 / 19.3, floor 15) — computed, not eyeballed, against
171
+ these very surfaces. Status keeps its own steps (`good`/`bad`): a series is never «fine».
172
+
173
+ Three light steps (aqua, yellow, magenta) sit under 3:1 on the ground. A mark there is
174
+ never the only channel: the legend names it, the tooltip reads it out, and the table
175
+ presentation is the chart's twin. Text NEVER wears these colours. */
176
+ --color-series-1: #2a78d6; /* 4.20:1 */
177
+ --color-series-2: #eb6834; /* 3.04:1 */
178
+ --color-series-3: #1baf7a; /* 2.68:1 */
179
+ --color-series-4: #eda100; /* 2.06:1 */
180
+ --color-series-5: #e87ba4; /* 2.56:1 */
181
+ --color-series-6: #008300; /* 4.70:1 */
182
+ --color-series-7: #6250d6; /* 5.49:1 */
183
+ --color-series-8: #e34948; /* 3.76:1 */
184
+
164
185
  /* States. Muted on purpose —this is a tool, not an alarm panel— but all three
165
186
  pass AA as TEXT on the ground, because all three are used as a word and not
166
187
  as decoration. */
@@ -718,6 +739,14 @@
718
739
  --color-danger-hover: #f6ab9f; /* 9.66:1 · surface on top 8.78:1 */
719
740
  --color-info: #5cc4d8; /* 8.89:1 */
720
741
  --color-data-soft: #6f88bd; /* 5.10:1 */
742
+ --color-series-1: #3987e5; /* 4.96:1 */
743
+ --color-series-2: #d95926; /* 4.65:1 */
744
+ --color-series-3: #199e70; /* 5.30:1 */
745
+ --color-series-4: #c98500; /* 5.88:1 */
746
+ --color-series-5: #d55181; /* 4.57:1 */
747
+ --color-series-6: #008300; /* 3.65:1 */
748
+ --color-series-7: #9085e9; /* 5.77:1 */
749
+ --color-series-8: #e66767; /* 5.59:1 */
721
750
  --color-good: #6fcf8b; /* 9.43:1 */
722
751
  --color-warn: #e3b341; /* 9.27:1 */
723
752
  --color-bad: #f08d7f; /* 7.58:1 */
@@ -757,6 +786,14 @@
757
786
  --color-danger-hover: #f6ab9f; /* 9.66:1 · surface on top 8.78:1 */
758
787
  --color-info: #5cc4d8; /* 8.89:1 */
759
788
  --color-data-soft: #6f88bd; /* 5.10:1 */
789
+ --color-series-1: #3987e5; /* 4.96:1 */
790
+ --color-series-2: #d95926; /* 4.65:1 */
791
+ --color-series-3: #199e70; /* 5.30:1 */
792
+ --color-series-4: #c98500; /* 5.88:1 */
793
+ --color-series-5: #d55181; /* 4.57:1 */
794
+ --color-series-6: #008300; /* 3.65:1 */
795
+ --color-series-7: #9085e9; /* 5.77:1 */
796
+ --color-series-8: #e66767; /* 5.59:1 */
760
797
  --color-good: #6fcf8b; /* 9.43:1 */
761
798
  --color-warn: #e3b341; /* 9.27:1 */
762
799
  --color-bad: #f08d7f; /* 7.58:1 */
@@ -798,6 +835,14 @@
798
835
  --color-danger-hover: #7c2d24; /* 8.84:1 · white on top 9.30:1 */
799
836
  --color-info: #0f5c6e; /* 7.19:1 · white on top 7.56:1 */
800
837
  --color-data-soft: #5c74a6; /* 4.43:1 */
838
+ --color-series-1: #2a78d6; /* 4.20:1 */
839
+ --color-series-2: #eb6834; /* 3.04:1 */
840
+ --color-series-3: #1baf7a; /* 2.68:1 */
841
+ --color-series-4: #eda100; /* 2.06:1 */
842
+ --color-series-5: #e87ba4; /* 2.56:1 */
843
+ --color-series-6: #008300; /* 4.70:1 */
844
+ --color-series-7: #6250d6; /* 5.49:1 */
845
+ --color-series-8: #e34948; /* 3.76:1 */
801
846
  --color-good: #2f6b3c; /* 6.07:1 */
802
847
  --color-warn: #7e5e12; /* 5.71:1 */
803
848
  --color-bad: #9b3b30; /* 6.52:1 */
@@ -6,7 +6,7 @@ import type { Surface } from "../../foundations/types.js";
6
6
  import type { DataColumn, DataTableCreate } from "../../primitives/table/DataTable.js";
7
7
  import type { RowAction } from "../../primitives/table/RowActions.js";
8
8
  import type { SortState } from "../../primitives/table/sorting.js";
9
- import { type CardWays, type ListCalendar, type ListCrumb, type ListEmpty, type ListGantt, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type ListTimeline, type RowOf } from "./types.js";
9
+ import { type CardWays, type ListCalendar, type ListChart, type ListCrumb, type ListEmpty, type ListGantt, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type ListTimeline, type RowOf } from "./types.js";
10
10
  import type { ReactNode } from "react";
11
11
  type BarProps = {
12
12
  children?: ReactNode;
@@ -156,6 +156,7 @@ export declare namespace List {
156
156
  var Sheet: <T>(props: SheetProps<T>) => ReactNode;
157
157
  var Report: ((props: ListReport) => ReactNode) & import("../../foundations/slots.js").Slotted<"report">;
158
158
  var Pivot: <T>(props: ListPivot<T>) => ReactNode;
159
+ var Chart: <T>(props: ListChart<T>) => ReactNode;
159
160
  var Calendar: <T>(props: ListCalendar<T>) => ReactNode;
160
161
  var Gantt: <T>(props: ListGantt<T>) => ReactNode;
161
162
  var Timeline: <T>(props: ListTimeline<T>) => ReactNode;
@@ -30,6 +30,9 @@ const Board = slot("board", (_props) => null);
30
30
  const SheetSlot = slot("sheet", (_props) => null);
31
31
  const Report = slot("report", (_props) => null);
32
32
  const Pivot = slot("pivot", (_props) => null);
33
+ /** The pivot, drawn — Odoo's graph view (`ChartExplorer`). `unknown` in between: the
34
+ * comparison's records make the props invariant in `T`, and the slot never reads them. */
35
+ const ChartSlot = slot("chart", (_props) => null);
33
36
  /* El orden en que se OFRECEN cuando están escritas de otra manera. El conmutador
34
37
  respeta el orden del árbol; esto sólo nombra a qué presentación corresponde
35
38
  cada ranura. */
@@ -40,6 +43,7 @@ const PRESENT_OF = {
40
43
  sheet: "sheet",
41
44
  report: "report",
42
45
  pivot: "pivot",
46
+ chart: "chart",
43
47
  calendar: "calendar",
44
48
  gantt: "gantt",
45
49
  timeline: "timeline",
@@ -51,6 +55,7 @@ const FACES = [
51
55
  "sheet",
52
56
  "report",
53
57
  "pivot",
58
+ "chart",
54
59
  "calendar",
55
60
  "gantt",
56
61
  "timeline",
@@ -97,6 +102,7 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
97
102
  const sheet = propsOf(pick(top, "sheet"));
98
103
  const report = propsOf(pick(top, "report"));
99
104
  const pivot = propsOf(pick(top, "pivot"));
105
+ const chart = propsOf(pick(top, "chart"));
100
106
  const calendar = propsOf(pick(top, "calendar"));
101
107
  const gantt = propsOf(pick(top, "gantt"));
102
108
  const timeline = propsOf(pick(top, "timeline"));
@@ -141,7 +147,7 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
141
147
  : { onVisibleColumnIdsChange: table.onVisibleColumnIdsChange }),
142
148
  }), ...(board?.card === undefined ? {} : { card: board.card }), ...(board?.stages === undefined ? {} : { boardStages: board.stages }), ...(sheet?.columns === undefined || sheet.cell === undefined
143
149
  ? {}
144
- : { sheet: sheet }), ...(report === undefined ? {} : { report }), ...(pivot === undefined ? {} : { pivot }), ...(calendar === undefined ? {} : { calendar }), ...(gantt === undefined ? {} : { gantt }), ...(timeline === undefined ? {} : { timeline }), ...(faces.length === 0 ? {} : { faces }), ...(presents.length === 0 ? {} : { presents }), ...(present === undefined ? {} : { present }), ...(onPresentChange === undefined ? {} : { onPresentChange }), ...(group === undefined ? {} : { group }), ...(selection === undefined ? {} : { selection }), ...(sort === undefined ? {} : { sort }), ...(onSortChange === undefined ? {} : { onSortChange }), ...(sortable === undefined ? {} : { sortable }), ...(onOpen === undefined ? {} : { onOpen }), ...(onPeek === undefined ? {} : { onPeek }), ...(isPeeked === undefined ? {} : { isPeeked }), ...(rowClick === undefined ? {} : { rowClick }), ...(onChoose === undefined || readOnly ? {} : { onChoose }), ...(state === undefined ? {} : { state }), ...(filtered === undefined ? {} : { filtered }), ...(empty === undefined ? {} : { empty }), children: rest.length === 0 ? undefined : rest }));
150
+ : { sheet: sheet }), ...(report === undefined ? {} : { report }), ...(pivot === undefined ? {} : { pivot }), ...(chart === undefined ? {} : { chart }), ...(calendar === undefined ? {} : { calendar }), ...(gantt === undefined ? {} : { gantt }), ...(timeline === undefined ? {} : { timeline }), ...(faces.length === 0 ? {} : { faces }), ...(presents.length === 0 ? {} : { presents }), ...(present === undefined ? {} : { present }), ...(onPresentChange === undefined ? {} : { onPresentChange }), ...(group === undefined ? {} : { group }), ...(selection === undefined ? {} : { selection }), ...(sort === undefined ? {} : { sort }), ...(onSortChange === undefined ? {} : { onSortChange }), ...(sortable === undefined ? {} : { sortable }), ...(onOpen === undefined ? {} : { onOpen }), ...(onPeek === undefined ? {} : { onPeek }), ...(isPeeked === undefined ? {} : { isPeeked }), ...(rowClick === undefined ? {} : { rowClick }), ...(onChoose === undefined || readOnly ? {} : { onChoose }), ...(state === undefined ? {} : { state }), ...(filtered === undefined ? {} : { filtered }), ...(empty === undefined ? {} : { empty }), children: rest.length === 0 ? undefined : rest }));
145
151
  }
146
152
  List.Bar = Bar;
147
153
  List.Crumbs = Crumbs;
@@ -157,6 +163,7 @@ List.Board = Board;
157
163
  List.Sheet = SheetSlot;
158
164
  List.Report = Report;
159
165
  List.Pivot = Pivot;
166
+ List.Chart = ChartSlot;
160
167
  List.Calendar = CalendarSlot;
161
168
  List.Gantt = GanttSlot;
162
169
  List.Timeline = TimelineSlot;
@@ -1,5 +1,5 @@
1
1
  import type { ListViewProps } from "./types.js";
2
- export declare function ListView<T extends object>({ items, keyOf, identity, crumbs, embedded, surface: requestedSurface, metrics, search, pagination, views, actions, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, faces, present: requested, presents, onPresentChange, sort, onSortChange, sortable, totals, rowActions, create, group, selection, onOpen, onPeek, rowClick, onChoose, state, filtered, empty, children, }: ListViewProps<T>): import("react").JSX.Element;
2
+ export declare function ListView<T extends object>({ items, keyOf, identity, crumbs, embedded, surface: requestedSurface, metrics, search, pagination, views, actions, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, chart, faces, present: requested, presents, onPresentChange, sort, onSortChange, sortable, totals, rowActions, create, group, selection, onOpen, onPeek, rowClick, onChoose, state, filtered, empty, children, }: ListViewProps<T>): import("react").JSX.Element;
3
3
  /** What a list offers when it fails and can be retried. */
4
4
  export declare function RetryAction({ onRetry }: {
5
5
  onRetry: () => void;
@@ -25,7 +25,7 @@ import { groupedColumnIds, WIDE_PRESENTS } from "./columns.js";
25
25
  import { groupLevelsOf, reportColumnsOf, reportRowsOf, sheetFromColumns, sheetRowsOf, } from "./derive.js";
26
26
  import { SheetPresentation, TablePresentation, } from "./presentations.js";
27
27
  import { useNarrowList } from "./useNarrowList.js";
28
- import { CalendarDays, CalendarRange, ChartGantt, Grid3x3, LayoutGrid, List, Sheet, Sigma, Table2, } from "lucide-react";
28
+ import { CalendarDays, CalendarRange, ChartColumnBig, ChartGantt, Grid3x3, LayoutGrid, List, Sheet, Sigma, Table2, } from "lucide-react";
29
29
  import { Fragment, lazy, Suspense, useCallback, useMemo } from "react";
30
30
  /* The calendar (FullCalendar) and the gantt (SVAR) are each about a third of a list's weight,
31
31
  and most lists never show either face. Each is its own chunk, fetched the first time its
@@ -37,6 +37,11 @@ const RecordCalendar = lazy(() => import("../../components/calendar/RecordCalend
37
37
  const RecordGantt = lazy(() => import("../../components/gantt/RecordGantt.js").then((module) => ({
38
38
  default: module.RecordGantt,
39
39
  })));
40
+ /* The chart (Recharts) is its own chunk too: a list that is never drawn as a chart never
41
+ downloads it. */
42
+ const ChartExplorer = lazy(() => import("../../components/listing/ChartExplorer.js").then((module) => ({
43
+ default: module.ChartExplorer,
44
+ })));
40
45
  /**
41
46
  * EL DIBUJO de una lista. **La puerta es `List`**, que se escribe como árbol y
42
47
  * traduce las ranuras a esto — acá todo entra como props porque acá ya se
@@ -71,11 +76,13 @@ const PRESENT_ICONS = [
71
76
  { id: "report", icon: Sigma },
72
77
  /* La cuadrícula: dos ejes, y lo que importa está adentro. */
73
78
  { id: "pivot", icon: Grid3x3 },
79
+ /* El mismo pivote, dibujado. */
80
+ { id: "chart", icon: ChartColumnBig },
74
81
  { id: "calendar", icon: CalendarDays },
75
82
  { id: "gantt", icon: ChartGantt },
76
83
  { id: "timeline", icon: CalendarRange },
77
84
  ];
78
- export function ListView({ items, keyOf, identity, crumbs, embedded = false, surface: requestedSurface, metrics, search, pagination, views, actions, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, faces, present: requested = "rows", presents, onPresentChange, sort, onSortChange, sortable, totals = false, rowActions, create, group, selection, onOpen, onPeek, rowClick = "peek", onChoose, state, filtered = false, empty, children, }) {
85
+ export function ListView({ items, keyOf, identity, crumbs, embedded = false, surface: requestedSurface, metrics, search, pagination, views, actions, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, chart, faces, present: requested = "rows", presents, onPresentChange, sort, onSortChange, sortable, totals = false, rowActions, create, group, selection, onOpen, onPeek, rowClick = "peek", onChoose, state, filtered = false, empty, children, }) {
79
86
  const wide = useMemo(() => [
80
87
  ...WIDE_PRESENTS,
81
88
  ...(faces ?? []).filter((f) => f.wide === true).map((f) => f.id),
@@ -155,7 +162,8 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
155
162
  const sortMenu = sortable === undefined ||
156
163
  sortable.length === 0 ||
157
164
  declaredReport ||
158
- present === "pivot" ? null : (_jsx(SortMenu, { fields: sortable, sort: sort ?? [], onSortChange: (next) => onSortChange?.(next), ...(surface === undefined ? {} : { surface }) }));
165
+ present === "pivot" ||
166
+ present === "chart" ? null : (_jsx(SortMenu, { fields: sortable, sort: sort ?? [], onSortChange: (next) => onSortChange?.(next), ...(surface === undefined ? {} : { surface }) }));
159
167
  const rightViews = views ?? switcher;
160
168
  const viewsSlot = columnsMenu === null && sortMenu === null && rightViews === undefined ? undefined : (_jsxs(_Fragment, { children: [sortMenu, columnsMenu, rightViews] }));
161
169
  /* Embedded, the line is drawn only if it has something to OFFER: a count alone repeats
@@ -236,7 +244,9 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
236
244
  error === null &&
237
245
  (present === "pivot" && pivotShown !== undefined
238
246
  ? pivotIsEmpty(pivotShown)
239
- : items.length === 0) &&
247
+ : present === "chart" && chart?.folded !== undefined
248
+ ? pivotIsEmpty(chart.folded)
249
+ : items.length === 0) &&
240
250
  /* The first record of an empty list is written in the table, not under a sentence
241
251
  saying there is nothing. */
242
252
  !(present === "table" && create?.draft != null);
@@ -332,7 +342,29 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
332
342
  orden —cada eje viene en el orden de sus claves— y no hay menú de
333
343
  columnas, porque las columnas son un eje y no una lista de campos que
334
344
  se puedan esconder de a uno. */
335
- _jsx(PivotTable, { pivot: pivotShown, ...(pivot?.onCell === undefined ? {} : { onCell: pivot.onCell }), ...(pivot?.height === undefined ? {} : { height: pivot.height }) })) : present === "calendar" && calendar !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordCalendar, { ...calendar, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "gantt" && gantt !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordGantt, { ...gantt, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "timeline" && timeline !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(RecordTimeline, { ...timeline, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) })) : present === "board" && boardStages !== undefined ? (_jsx(BoardColumns, { items: ordered, keyOf: keyOf, stages: boardStages, card: renderCard })) : present === "board" ? (_jsx("div", { className: "flex flex-col", children: wrapGroups((inside) => (_jsx("div", { className: "grid gap-3 p-3 @2xl:grid-cols-2 @5xl:grid-cols-3", children: inside.map(renderCard) }))) })) : (
345
+ _jsx(PivotTable, { pivot: pivotShown, ...(pivot?.onCell === undefined ? {} : { onCell: pivot.onCell }), ...(pivot?.height === undefined ? {} : { height: pivot.height }) })) : present === "chart" &&
346
+ chart !== undefined &&
347
+ (chart.folded !== undefined || chart.spec !== undefined) ? (
348
+ /* Odoo's graph view. Its levels follow the search bar's grouping, like the pivot's
349
+ rows: the first along the axis, the rest as series. */
350
+ _jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(ChartExplorer, { ...(chart.folded === undefined ? {} : { folded: chart.folded }), ...(chart.spec === undefined
351
+ ? {}
352
+ : {
353
+ items: ordered,
354
+ of: chart.spec.of,
355
+ measures: chart.spec.measures,
356
+ defaultCategories: chart.spec.rows,
357
+ defaultSeries: chart.spec.columns,
358
+ ...(chart.spec.labelOf === undefined
359
+ ? {}
360
+ : { labelOf: chart.spec.labelOf }),
361
+ }), ...(chart.fields === undefined ? {} : { fields: chart.fields }), ...(chart.defaultMeasure === undefined
362
+ ? {}
363
+ : { defaultMeasure: chart.defaultMeasure }), ...(chart.kind === undefined ? {} : { defaultKind: chart.kind }), ...(chart.defaultMeasures === undefined
364
+ ? {}
365
+ : { defaultMeasures: chart.defaultMeasures }), ...(chart.stacked === undefined ? {} : { defaultStacked: chart.stacked }), ...(chart.cumulative === undefined
366
+ ? {}
367
+ : { defaultCumulative: chart.cumulative }), ...(chart.order === undefined ? {} : { defaultOrder: chart.order }), ...(chart.compare === undefined ? {} : { compare: chart.compare }), ...((group?.levels.length ?? 0) > 0 ? { levels: group.levels } : {}), ...(chart.onPoint === undefined ? {} : { onPoint: chart.onPoint }), ...(chart.height === undefined ? {} : { height: chart.height }), ...(chart.fileName === undefined ? {} : { fileName: chart.fileName }), ...(identity?.title === undefined ? {} : { label: identity.title }) }) }) })) : present === "calendar" && calendar !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordCalendar, { ...calendar, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "gantt" && gantt !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordGantt, { ...gantt, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "timeline" && timeline !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(RecordTimeline, { ...timeline, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) })) : present === "board" && boardStages !== undefined ? (_jsx(BoardColumns, { items: ordered, keyOf: keyOf, stages: boardStages, card: renderCard })) : present === "board" ? (_jsx("div", { className: "flex flex-col", children: wrapGroups((inside) => (_jsx("div", { className: "grid gap-3 p-3 @2xl:grid-cols-2 @5xl:grid-cols-3", children: inside.map(renderCard) }))) })) : (
336
368
  /* El encabezado va ANTES de los montones y no adentro de cada uno:
337
369
  rotula la fila, y la fila es la misma en los cinco montones. */
338
370
  _jsxs(_Fragment, { children: [rowHeader === undefined || items.length === 0 ? null : (_jsx(RowHeader, { name: rowHeader.name, ...(rowHeader.meta === undefined ? {} : { meta: rowHeader.meta }), ...(rowHeader.tags === undefined ? {} : { tags: rowHeader.tags }), withSelection: selection !== undefined,
@@ -1,2 +1,2 @@
1
1
  export { List, type ListPresentProps, type ListProps } from "./List.js";
2
- export { type CardWays, type ListCrumb, type ListEmpty, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type RowOf, } from "./types.js";
2
+ export { type CardWays, type ListChart, type ListCrumb, type ListEmpty, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type RowOf, } from "./types.js";