@sincpro/web-ui 2.4.0 → 2.5.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.
Files changed (44) hide show
  1. package/README.md +24 -3
  2. package/dist/components/activity/Activity.d.ts +20 -1
  3. package/dist/components/activity/Activity.js +44 -7
  4. package/dist/components/activity/index.d.ts +1 -1
  5. package/dist/components/board/Board.d.ts +74 -2
  6. package/dist/components/board/Board.js +65 -2
  7. package/dist/components/board/index.d.ts +1 -1
  8. package/dist/components/board/index.js +1 -1
  9. package/dist/components/canvas/canvas.css +6 -1
  10. package/dist/components/form/Form.js +11 -0
  11. package/dist/components/form/FormIndex.d.ts +11 -0
  12. package/dist/components/form/FormIndex.js +96 -0
  13. package/dist/components/form/Sheet.js +5 -0
  14. package/dist/components/listing/ChartExplorer.js +10 -5
  15. package/dist/components/record/DirtyActions.d.ts +10 -1
  16. package/dist/components/record/DirtyActions.js +77 -6
  17. package/dist/components/record/RecordHeader.js +17 -11
  18. package/dist/foundations/calendar.d.ts +12 -0
  19. package/dist/foundations/calendar.js +50 -0
  20. package/dist/foundations/chart.d.ts +10 -1
  21. package/dist/foundations/chart.js +17 -1
  22. package/dist/foundations/copy.d.ts +20 -0
  23. package/dist/foundations/copy.es.js +9 -0
  24. package/dist/foundations/copy.js +9 -0
  25. package/dist/foundations/form.d.ts +6 -0
  26. package/dist/foundations/form.js +7 -0
  27. package/dist/foundations/index.d.ts +2 -2
  28. package/dist/foundations/index.js +2 -2
  29. package/dist/foundations/pivot.d.ts +6 -0
  30. package/dist/foundations/pivot.js +1 -0
  31. package/dist/primitives/chart/BarList.d.ts +30 -0
  32. package/dist/primitives/chart/BarList.js +27 -0
  33. package/dist/primitives/chart/Chart.d.ts +13 -0
  34. package/dist/primitives/chart/Chart.js +71 -19
  35. package/dist/primitives/chart/Sparkline.d.ts +30 -0
  36. package/dist/primitives/chart/Sparkline.js +53 -0
  37. package/dist/primitives/chart/index.d.ts +2 -0
  38. package/dist/primitives/chart/index.js +2 -0
  39. package/dist/primitives/field/Field.d.ts +6 -2
  40. package/dist/primitives/field/Field.js +35 -6
  41. package/dist/primitives/value/Metric.d.ts +7 -0
  42. package/dist/primitives/value/Metric.js +5 -2
  43. package/dist/tokens.css +53 -2
  44. package/package.json +1 -1
@@ -5,7 +5,7 @@ export { currentCopy, currentCopyLocale, ENGLISH_COPY, fillCopy, installCopy, me
5
5
  export { byDensity, DensityProvider, useDensity, } from "./density.js";
6
6
  /* A CONTROL'S CONTRACT — the ids its `Field` gives it and whether it is viewed or written. The
7
7
  package's controls and the application's speak it alike. */
8
- export { controlName, FieldBoundary, FormModeProvider, useFieldIds, useFormMode, } from "./form.js";
8
+ export { controlName, FieldBoundary, FormModeProvider, FormStyleProvider, useFieldIds, useFormMode, useFormStyle, } from "./form.js";
9
9
  /* A SHORTCUT, drawn the way the person's keyboard says it: «⌘K» on a Mac, «Ctrl K» elsewhere. */
10
10
  export { modShortcut, useKeyboardPlatform, } from "./shortcut.js";
11
11
  /* THE THEME — light, dark or the operating system's. The palettes live in `tokens.css`; this
@@ -21,7 +21,7 @@ export { flatten, loose, pick, pickAll, propsOf, slot, slotOf, } from "./slots.j
21
21
  /* THE CALENDAR — from a date to a key and from a key to a label. The months
22
22
  and the days of the week are said by `Intl` with the copy's `locale`; the week
23
23
  and the quarter are the only two words that have to be written. */
24
- export { dateKey, dateKeysBetween, dateLabel, grainName, monthName, nextDateKey, } from "./calendar.js";
24
+ export { dateKey, dateKeysBetween, dateKeyYear, dateLabel, dateTick, grainName, monthName, nextDateKey, } from "./calendar.js";
25
25
  /* THE GROUPING — the vocabulary, which both layers speak: the list builds the
26
26
  tree of buckets and the table draws it. It lives here and not in `contexts/list`
27
27
  because a primitive cannot import from a context. */
@@ -92,6 +92,12 @@ export type PivotMeasure = {
92
92
  header: string;
93
93
  /** For a percentage or a variation, which are not read like an amount. */
94
94
  format?: (value: number) => string;
95
+ /**
96
+ * The same number where room is short — a chart's axis, beside a sparkline: «76 MB» for
97
+ * 79.691.776 bytes, «Bs 120 mil». Without it the axis writes the bare number, grouped, and
98
+ * compact from the millions.
99
+ */
100
+ formatShort?: (value: number) => string;
95
101
  /**
96
102
  * How the measure reads in a SPREADSHEET: the Excel format code,
97
103
  * `#,##0.00`, `0.0%`, `#,##0 "Bs."`.
@@ -132,6 +132,7 @@ export function pivotFrom(items, spec) {
132
132
  id: one.id,
133
133
  header: one.header,
134
134
  ...(one.format === undefined ? {} : { format: one.format }),
135
+ ...(one.formatShort === undefined ? {} : { formatShort: one.formatShort }),
135
136
  ...(one.numberFormat === undefined ? {} : { numberFormat: one.numberFormat }),
136
137
  ...(one.additive === undefined ? {} : { additive: one.additive }),
137
138
  })),
@@ -0,0 +1,30 @@
1
+ import type { ChartData } from "../../foundations/chart.js";
2
+ import type { PivotKey } from "../../foundations/pivot.js";
3
+ /**
4
+ * A BAR LIST: a ranking read as a list — the name, a bar, the number — one row each.
5
+ *
6
+ * Context: «why were messages rejected» is six reasons and a count each. A bar chart answers
7
+ * it with two axes, a grid and the names tilted under thirty-pixel columns; a `Meter` answers
8
+ * a different question (a quantity against a known capacity, coloured by alarm). A ranking
9
+ * is a list whose bars only say «how much against the biggest», so that is what this draws:
10
+ * the name where the eye starts, a thin bar proportional to the largest value, and the
11
+ * number at the end — written, because the bar alone gives the shape and not the amount.
12
+ *
13
+ * It reads `ChartData`, the same thing a `Chart` draws — `chartFromPivot`, `chartFromRecord`
14
+ * — never a second way to fold. With one series it draws that series; with several it draws
15
+ * what each whole category gives (`totals`).
16
+ *
17
+ * - A zero is a row with an empty track, not a missing row: «0 spam» is an answer.
18
+ * - A hole (`null`) reads «—»: not counted is not zero.
19
+ * - The gathered tail («otros») draws in the de-emphasis grey and does not open.
20
+ * - Negative values have no length here (a ranking of magnitudes): their row writes the
21
+ * number with its sign and an empty track. A diverging reading is a `Chart`.
22
+ */
23
+ export type BarListProps = {
24
+ data: ChartData;
25
+ /** The accessible name: what is ranked. */
26
+ label: string;
27
+ /** A row was pressed: open what fell there. Absent, the rows only show. */
28
+ onPoint?: (category: PivotKey) => void;
29
+ };
30
+ export declare function BarList({ data, label, onPoint }: BarListProps): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useUiCopy } from "../../foundations/copy.js";
4
+ import { Empty } from "../notice/Notice.js";
5
+ import { useMemo } from "react";
6
+ export function BarList({ data, label, onPoint }) {
7
+ const copy = useUiCopy();
8
+ const number = useMemo(() => new Intl.NumberFormat(copy.locale, { maximumFractionDigits: 2 }), [copy.locale]);
9
+ const format = (value) => data.measure.format?.(value) ?? number.format(value);
10
+ const amounts = data.categories.map((_, at) => data.series.length === 1 ? (data.values[at]?.[0] ?? null) : (data.totals[at] ?? null));
11
+ const peak = Math.max(0, ...amounts.map((value) => value ?? 0));
12
+ const written = amounts.map((value) => (value === null ? "—" : format(value)));
13
+ /* One width for the numbers' column, the longest one's: they line up at the right edge
14
+ like a column of a table, whatever the measure writes. */
15
+ const column = `${String(Math.max(...written.map((text) => text.length), 1) + 1)}ch`;
16
+ if (data.categories.length === 0)
17
+ return _jsx(Empty, { sentence: copy.chart.empty, align: "start" });
18
+ return (_jsx("ul", { "aria-label": label, className: "flex min-w-0 flex-col gap-0.5", children: data.categories.map((category, at) => {
19
+ const value = amounts[at] ?? null;
20
+ const text = written[at] ?? "—";
21
+ const share = value === null || value <= 0 || peak === 0 ? 0 : (value / peak) * 100;
22
+ const rest = category.rest === true;
23
+ const row = (_jsxs(_Fragment, { children: [_jsx("span", { className: "w-1/3 min-w-0 shrink-0 truncate text-meta text-ink", children: category.label }), _jsx("span", { "aria-hidden": true, className: "h-2 min-w-0 flex-1 rounded-pill bg-ink/6", children: _jsx("span", { className: `block h-full rounded-pill ${rest ? "bg-muted" : "bg-data"}`, style: { width: `${String(share)}%` } }) }), _jsx("span", { className: "shrink-0 text-right text-meta whitespace-nowrap text-ink tabular-nums", style: { width: column }, children: text })] }));
24
+ const line = "flex w-full min-w-0 items-center gap-3 rounded-control px-1.5 py-1.5";
25
+ return (_jsx("li", { className: "min-w-0", children: onPoint === undefined || rest ? (_jsx("div", { className: line, children: row })) : (_jsx("button", { type: "button", onClick: () => onPoint(category.key), className: `${line} cursor-pointer text-left outline-0 transition-colors duration-(--duration-instant) hover:bg-ink/4 focus-visible:outline-2 focus-visible:outline-primary`, children: row })) }, category.id));
26
+ }) }));
27
+ }
@@ -17,6 +17,19 @@ import type { PivotKey } from "../../foundations/pivot.js";
17
17
  * for one series (`data`), the categorical palette only from two, a legend only from two,
18
18
  * and no animation: a chart that moves when it loads is decoration (MOTION in tokens.css).
19
19
  *
20
+ * ── What made it look unfinished, and the rule each fix keeps ─────────
21
+ *
22
+ * - A time axis writes the SHORT tick («ene», «T1», `ChartPoint.tick`) and spaces them
23
+ * evenly: «Enero de 2025» twelve times did not fit, and the axis dropped months at random.
24
+ * - A line has no dot on every value — the line IS the values; the hover says each one. A
25
+ * dot marks only what a line cannot draw: a value alone between two holes, and where the
26
+ * series ends (where it is now).
27
+ * - A hole is drawn as a hole WITH a mark: a faint dashed bridge across it, never the series
28
+ * colour. A bare gap read as a broken chart, not as «nothing was recorded here».
29
+ * - When every bar carries its number at the tip, the value axis and its grid go: they
30
+ * would say the same thing twice. The axis stays whenever any value is unlabelled.
31
+ * - The ticks read the measure's short form (`formatShort`: «76 MB»), not a bare number.
32
+ *
20
33
  * A primitive: it knows nothing about lists or toolbars. `ChartExplorer` puts the controls
21
34
  * around it; anyone can draw it alone with a `ChartData`.
22
35
  */
@@ -4,9 +4,11 @@ import { SERIES_COLORS, } from "../../foundations/chart.js";
4
4
  import { fillCopy, useUiCopy } from "../../foundations/copy.js";
5
5
  import { Empty } from "../notice/Notice.js";
6
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";
7
+ import { Area, Bar, BarChart, CartesianGrid, Cell, ComposedChart, LabelList, Line, Pie, PieChart, ReferenceLine, Tooltip, XAxis, YAxis, } from "recharts";
8
8
  const MAX_BAR = 24;
9
9
  const RADIUS = 4;
10
+ /* The wash under a line: the series hue at a tenth, never a saturated block. */
11
+ const WASH = 0.1;
10
12
  function colorOf(point, index, alone) {
11
13
  /* The tail and the previous period are context, not the subject: the de-emphasis grey. */
12
14
  if (point.rest === true || point.previous === true)
@@ -37,11 +39,16 @@ export function Chart({ data, kind = "bar", stacked: stackedProp = false, horizo
37
39
  const peak = Math.max(0, ...data.values.flatMap((row) => row.map((value) => Math.abs(value ?? 0))));
38
40
  const negative = data.values.some((row) => row.some((value) => (value ?? 0) < 0));
39
41
  /* 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
+ thousands come out as «7 K» next to «14 k» on the same axis. A measure that knows its
43
+ short form («76 MB») says it itself. */
44
+ const tick = (value) => data.measure.formatShort?.(value) ??
45
+ (peak >= 1_000_000 ? compact.format(value) : number.format(value));
42
46
  /* One object per category, the shape Recharts reads: `s0`, `s1`… per series. */
43
47
  const rows = useMemo(() => data.categories.map((category, c) => {
44
- const row = { label: category.label };
48
+ const row = {
49
+ label: category.label,
50
+ tick: category.tick ?? category.label,
51
+ };
45
52
  data.series.forEach((_, s) => {
46
53
  row[`s${String(s)}`] = data.values[c]?.[s] ?? null;
47
54
  });
@@ -113,7 +120,16 @@ export function Chart({ data, kind = "bar", stacked: stackedProp = false, horizo
113
120
  : horizontal
114
121
  ? { height: `${String(data.categories.length * (1 + perCategory * 0.75) + 3)}rem` }
115
122
  : {};
116
- const grid = (_jsx(CartesianGrid, { vertical: horizontal, horizontal: !horizontal, stroke: "var(--color-line)" }));
123
+ /* The value rides the tip of its bar when there is ONE series: the axis gives the scale,
124
+ the tip gives the number, and nobody has to hover thirty bars to read them. With
125
+ several series it would be a number on every mark, which is noise. */
126
+ const tips = kind === "bar" &&
127
+ !stacked &&
128
+ visible.length === 1 &&
129
+ (horizontal || data.categories.length <= 12);
130
+ /* Every bar says its number: the value axis and its grid would say it twice. */
131
+ const labelled = tips;
132
+ const grid = labelled ? null : (_jsx(CartesianGrid, { vertical: horizontal, horizontal: !horizontal, stroke: "var(--color-line)" }));
117
133
  const tickStyle = { fill: "currentColor" };
118
134
  const valueAxis = {
119
135
  type: "number",
@@ -121,21 +137,18 @@ export function Chart({ data, kind = "bar", stacked: stackedProp = false, horizo
121
137
  tick: tickStyle,
122
138
  tickLine: false,
123
139
  axisLine: false,
140
+ hide: labelled,
124
141
  };
125
142
  const categoryAxis = {
126
143
  type: "category",
127
- dataKey: "label",
144
+ dataKey: "tick",
128
145
  tick: tickStyle,
129
146
  tickLine: false,
130
147
  axisLine: { stroke: "var(--color-line-strong)" },
131
148
  };
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" })] }));
149
+ const axes = horizontal ? (_jsxs(_Fragment, { children: [_jsx(XAxis, { ...valueAxis }), _jsx(YAxis, { ...categoryAxis, width: "auto", interval: 0 })] })) : (_jsxs(_Fragment, { children: ["/* Every Nth tick, the same N all along: an axis that skips unevenly reads as missing periods. */", _jsx(XAxis, { ...categoryAxis, interval: "equidistantPreserveStart", minTickGap: 12 }), _jsx(YAxis, { ...valueAxis, width: "auto" })] }));
133
150
  const zero = negative ? (_jsx(ReferenceLine, { ...(horizontal ? { x: 0 } : { y: 0 }), stroke: "var(--color-line-strong)" })) : null;
134
151
  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
152
  let plot;
140
153
  if (kind === "bar") {
141
154
  plot = (_jsxs(BarChart, { data: rows, layout: horizontal ? "vertical" : "horizontal", responsive: true, width: "100%", height: "100%", title: label, barGap: 2, barCategoryGap: "20%", margin: {
@@ -154,7 +167,6 @@ export function Chart({ data, kind = "bar", stacked: stackedProp = false, horizo
154
167
  : { 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
168
  }
156
169
  else {
157
- const dots = rows.length <= 24;
158
170
  const common = {
159
171
  data: rows,
160
172
  responsive: true,
@@ -174,12 +186,49 @@ export function Chart({ data, kind = "bar", stacked: stackedProp = false, horizo
174
186
  }),
175
187
  };
176
188
  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)))] }));
189
+ const filled = kind === "area" || stacked;
190
+ const valueAt = (s, c) => data.values[c]?.[s] ?? null;
191
+ /* A dot only where the line cannot draw: a value alone between two holes (or at an edge
192
+ next to one), and the last value of a series — where it stands now. */
193
+ const marked = (s, c) => {
194
+ if (valueAt(s, c) === null)
195
+ return false;
196
+ const before = c === 0 ? null : valueAt(s, c - 1);
197
+ const after = c === rows.length - 1 ? null : valueAt(s, c + 1);
198
+ const last = data.values.every((_, at) => at <= c || valueAt(s, at) === null);
199
+ return (before === null && after === null) || last;
200
+ };
201
+ /* A hole INSIDE a series: a null with a value somewhere before and after it. */
202
+ const holed = (s) => data.values.some((_, c) => valueAt(s, c) === null &&
203
+ data.values.some((__, at) => at < c && valueAt(s, at) !== null) &&
204
+ data.values.some((__, at) => at > c && valueAt(s, at) !== null));
205
+ plot = (_jsxs(ComposedChart, { ...common, stackOffset: negative ? "sign" : "none", children: [grid, axes, zero, _jsx(Tooltip, { isAnimationActive: false, cursor: { stroke: "var(--color-line-strong)" }, content: readout }), stacked
206
+ ? null
207
+ : visible
208
+ .filter((one) => holed(one.index))
209
+ .map((one) => (_jsx(Line, { type: "monotone", dataKey: one.key, stroke: "var(--color-line-strong)", strokeWidth: 1.5, strokeDasharray: "3 4", connectNulls: true, dot: false, activeDot: false, legendType: "none", tooltipType: "none", isAnimationActive: false }, `${one.point.id}\u0000gap`))), visible.map((one) => {
210
+ const dot = (props) => props.index !== undefined &&
211
+ props.cx !== undefined &&
212
+ props.cy !== undefined &&
213
+ marked(one.index, props.index) ? (_jsx("circle", { cx: props.cx, cy: props.cy, r: 4, fill: one.color, stroke: "var(--color-surface)", strokeWidth: 2 })) : null;
214
+ const shared = {
215
+ type: "monotone",
216
+ dataKey: one.key,
217
+ name: one.point.label,
218
+ stroke: one.color,
219
+ strokeWidth: 2,
220
+ dot,
221
+ activeDot: { ...ring, fill: one.color },
222
+ connectNulls: false,
223
+ isAnimationActive: false,
224
+ };
225
+ return filled ? (_jsx(Area, { ...shared, ...(stacked ? { stackId: "stack", dot: false } : {}), fill: one.color, fillOpacity: WASH }, one.point.id)) : (_jsx(Line, { ...shared }, one.point.id));
226
+ })] }));
181
227
  }
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, {
228
+ return (_jsxs("figure", { "aria-label": label, className: "flex min-w-0 flex-col gap-3", children: [alone ? null : (
229
+ /* At the top right, where the eye ends the title: the key to the colours, out of
230
+ the way of the plot's own reading from the left. */
231
+ _jsx("ul", { className: "flex min-w-0 flex-wrap items-center justify-end 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
232
  name: one.point.label,
184
233
  }),
185
234
  /* The last one on cannot be turned off: a chart with nothing on it reads
@@ -191,7 +240,7 @@ export function Chart({ data, kind = "bar", stacked: stackedProp = false, horizo
191
240
  else
192
241
  next.add(one.point.id);
193
242
  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] }));
243
+ }), 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" || kind === "area" }), _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
244
  }
196
245
  /**
197
246
  * The number at the tip of a bar, on ONE line. Recharts' own label wraps to the bar's
@@ -217,7 +266,10 @@ function Readout({ active, payload, label, format, compare = false, }) {
217
266
  }), [copy.locale]);
218
267
  if (active !== true || payload === undefined || payload.length === 0)
219
268
  return null;
220
- const heading = label ?? payload[0]?.name;
269
+ /* The full label of the category («Enero de 2025»), not the tick the axis wrote («ene»). */
270
+ const row = payload[0]?.payload;
271
+ const full = typeof row === "object" && row !== null && "label" in row ? String(row.label) : undefined;
272
+ const heading = full ?? label ?? payload[0]?.name;
221
273
  /* Now against before, said as a change: the number a comparison is asked for. */
222
274
  const now = payload[0]?.value;
223
275
  const before = payload[1]?.value;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A SPARKLINE: the shape of the last periods, drawn under a figure — no axis, no grid, no
3
+ * tooltip. It answers «and lately?» beside a number that answers «how much now?».
4
+ *
5
+ * Context: a board's headline figure said one number and nothing about its direction; the
6
+ * only way to see the trend was a whole chart. A sparkline is the trend at the size of a
7
+ * word. It is not a small chart, and it does not try to be one: no scale (its height is the
8
+ * series' own range), so it is never read for a value — the figure beside it says the
9
+ * value. That is why it draws in the soft data hue and marks only the LAST point in the full
10
+ * one: the current period is the one the figure talks about.
11
+ *
12
+ * - A series flat at zero is drawn flat on the floor, not in the middle: nothing happened,
13
+ * and the baseline is where nothing is.
14
+ * - A hole is a hole — the line breaks — because there is no axis here to say why.
15
+ * - With nothing to draw (no values, all holes) it draws nothing, not an empty frame.
16
+ *
17
+ * Pure SVG and no Recharts: a board with eight of them should not load a chart engine for
18
+ * lines without axes. The SVG stretches to its box (`preserveAspectRatio="none"`) with a
19
+ * stroke that does not stretch (`non-scaling-stroke`); the end dot is an HTML mark laid over
20
+ * it, so it stays round at any width.
21
+ */
22
+ export type SparklineProps = {
23
+ /** The values, oldest first. `null` is a period with nothing recorded. */
24
+ values: readonly (number | null)[];
25
+ /** What it shows, for a screen reader: «Mensajes recibidos, últimas 24 horas». */
26
+ label: string;
27
+ /** The wash under the line, for a quantity read as an amount (memory, stock). */
28
+ area?: boolean;
29
+ };
30
+ export declare function Sparkline({ values, label, area }: SparklineProps): import("react").JSX.Element | null;
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const WIDTH = 100;
3
+ const HEIGHT = 40;
4
+ /* Room for the stroke and the end dot at the top and the bottom. */
5
+ const PAD = 4;
6
+ export function Sparkline({ values, label, area = true }) {
7
+ const known = values.filter((value) => value !== null);
8
+ if (known.length === 0)
9
+ return null;
10
+ /* Its own range, not from zero: memory between 40 and 66 MB drawn from 0 is a flat block
11
+ with a ripple on top, and the turn is what a sparkline is for. */
12
+ const low = Math.min(...known);
13
+ const high = Math.max(...known);
14
+ const range = high - low;
15
+ const x = (at) => values.length === 1 ? WIDTH / 2 : (at / (values.length - 1)) * WIDTH;
16
+ /* Flat at zero sits on the floor; flat anywhere else, in the middle. */
17
+ const y = (value) => range === 0
18
+ ? high === 0
19
+ ? HEIGHT - PAD
20
+ : HEIGHT / 2
21
+ : PAD + (1 - (value - low) / range) * (HEIGHT - 2 * PAD);
22
+ /* The runs between holes, each its own stroke. */
23
+ const runs = [];
24
+ values.forEach((value, at) => {
25
+ if (value === null)
26
+ return;
27
+ const previous = values[at - 1];
28
+ if (at === 0 || previous === null || previous === undefined)
29
+ runs.push([]);
30
+ runs[runs.length - 1].push({ at, value });
31
+ });
32
+ const point = (one) => `${x(one.at).toFixed(2)},${y(one.value).toFixed(2)}`;
33
+ const line = (run) => `M${run.map(point).join(" L")}`;
34
+ const wash = (run) => {
35
+ const first = run[0];
36
+ const last = run[run.length - 1];
37
+ return `${line(run)} L${x(last.at).toFixed(2)},${HEIGHT} L${x(first.at).toFixed(2)},${HEIGHT} Z`;
38
+ };
39
+ let lastAt = values.length - 1;
40
+ while (values[lastAt] === null)
41
+ lastAt -= 1;
42
+ const end = { x: x(lastAt), y: y(values[lastAt]) };
43
+ return (_jsxs("div", { className: "relative h-(--size-sparkline) w-full min-w-0", children: [_jsxs("svg", { role: "img", "aria-label": label, viewBox: `0 0 ${String(WIDTH)} ${String(HEIGHT)}`, preserveAspectRatio: "none", className: "block size-full overflow-visible", children: [area
44
+ ? runs
45
+ .filter((run) => run.length > 1)
46
+ .map((run) => (_jsx("path", { d: wash(run), fill: "var(--color-data-soft)", fillOpacity: 0.1 }, `wash-${String(run[0].at)}`)))
47
+ : null, runs
48
+ .filter((run) => run.length > 1)
49
+ .map((run) => (_jsx("path", { d: line(run), fill: "none", stroke: "var(--color-data-soft)", strokeWidth: 1.5, strokeLinejoin: "round", strokeLinecap: "round", vectorEffect: "non-scaling-stroke" }, `line-${String(run[0].at)}`)))] }), _jsx("span", { "aria-hidden": true, className: "absolute size-2 -translate-x-1/2 -translate-y-1/2 rounded-pill bg-data ring-2 ring-surface", style: {
50
+ left: `${String((end.x / WIDTH) * 100)}%`,
51
+ top: `${String((end.y / HEIGHT) * 100)}%`,
52
+ } })] }));
53
+ }
@@ -1 +1,3 @@
1
+ export { BarList, type BarListProps } from "./BarList.js";
1
2
  export { Chart, type ChartProps } from "./Chart.js";
3
+ export { Sparkline, type SparklineProps } from "./Sparkline.js";
@@ -1 +1,3 @@
1
+ export { BarList } from "./BarList.js";
1
2
  export { Chart } from "./Chart.js";
3
+ export { Sparkline } from "./Sparkline.js";
@@ -3,9 +3,10 @@ import { type FormMode } from "../../foundations/form.js";
3
3
  import { type FieldNote } from "./note.js";
4
4
  import { type Rounding } from "../value/rounding.js";
5
5
  import { type ReactNode } from "react";
6
- export declare function Field({ label, hint, error, required, children, htmlFor, layout, action, mode, note, changed, copy: copyAs, }: {
6
+ export declare function Field({ label, hint, error, required, children, htmlFor, layout, action, mode, note, changed, optional, copy: copyAs, }: {
7
7
  label: string;
8
- /** What is expected. A `?` on the label that opens it on press. */
8
+ /** What is expected. A `?` on the label that opens it on press — in the «settings» form
9
+ * style, written out under the label. */
9
10
  hint?: string;
10
11
  /** What has to be corrected. It goes BELOW, close to the cursor, and it says
11
12
  * what to put. */
@@ -37,6 +38,9 @@ export declare function Field({ label, hint, error, required, children, htmlFor,
37
38
  * «2 cambios sin guardar» is about — in a form of twenty, the reason to look before
38
39
  * saving — and it is read as part of the field's description. */
39
40
  changed?: boolean;
41
+ /** It may stay empty: «(opcional)» beside the label — drawn only in the «settings» form
42
+ * style, where every row says what it asks. Ignored with `required`. */
43
+ optional?: boolean;
40
44
  /** The copy button by the label (see `clipboard.tsx`): on by default, copying what the
41
45
  * control shows. A string copies that instead; `false` removes the button from this
42
46
  * field. */
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { AriaLocale } from "../../foundations/aria.js";
4
4
  import { useUiCopy } from "../../foundations/copy.js";
5
5
  import { byDensity, useDensity } from "../../foundations/density.js";
6
6
  import { FieldIdsContext, useFieldIds, } from "../../foundations/form.js";
7
- import { controlName, FormModeProvider, useFormMode, } from "../../foundations/form.js";
7
+ import { controlName, FormModeProvider, useFormMode, useFormStyle, } from "../../foundations/form.js";
8
8
  import { focusRing, tv } from "../../foundations/variants.js";
9
9
  import { FieldGroup, listOptionStyles } from "./aria.js";
10
10
  import { FieldCopy, useFieldCopy } from "./clipboard.js";
@@ -41,10 +41,25 @@ import { Button as AriaButton, Input, ListBox, ListBoxItem, NumberField as AriaN
41
41
  * Help is a `?` next to the name, opened with a press. A paragraph above the
42
42
  * control ate a line on every field. The error still goes below, close to
43
43
  * the cursor, and it says what to put.
44
+ *
45
+ * ── In the «settings» style a field is a ROW that explains itself ───
46
+ *
47
+ * `FormStyleProvider value="settings"` (an application's choice, see `foundations/form`):
48
+ * the label and its help — written out, muted, under it — on the left, the control on the
49
+ * right, «(opcional)» beside a label that may stay empty. A form filled once in a while is
50
+ * read before it is typed into, and there the paragraph is the point, not a lost line.
51
+ * The ids do not change: the written help is still what describes the control.
44
52
  * ==================================================================== */
45
- export function Field({ label, hint, error, required = false, children, htmlFor, layout, action, mode, note, changed = false, copy: copyAs, }) {
53
+ /** The label of a field in the «settings» style: the name, `*` or «(opcional)», the
54
+ * field's marks, and the help written out under it — it describes the control (`hintId`). */
55
+ function SettingsLabel({ name, hint, hintId, optional, marks, inline, }) {
56
+ const copy = useUiCopy();
57
+ return (_jsxs("div", { "data-ui": "field.label", className: `flex min-w-0 flex-col gap-0.5 ${inline ? "pt-1.5" : ""}`, children: [_jsxs("span", { className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-meta font-medium text-ink transition-colors duration-(--duration-quick) group-focus-within/field:text-primary", children: [name, optional ? (_jsxs("span", { className: "text-micro font-normal text-muted", children: ["(", copy.field.optional, ")"] })) : null, marks] }), hint === undefined ? null : (_jsx("p", { id: hintId, className: "max-w-prose text-micro text-muted", children: hint }))] }));
58
+ }
59
+ export function Field({ label, hint, error, required = false, children, htmlFor, layout, action, mode, note, changed = false, optional = false, copy: copyAs, }) {
46
60
  const d = useDensity();
47
61
  const copy = useUiCopy();
62
+ const settings = useFormStyle() === "settings";
48
63
  const copies = useFieldCopy() && copyAs !== false;
49
64
  const shown = useRef(null);
50
65
  const auto = useId();
@@ -57,10 +72,12 @@ export function Field({ label, hint, error, required = false, children, htmlFor,
57
72
  const changedId = `${id}-changed`;
58
73
  /* The error first: what has to be corrected is heard before what is worth knowing. */
59
74
  const describedBy = describedByOf(hint === undefined ? null : hintId, error === undefined ? null : errorId, note === undefined ? null : noteId, changed ? changedId : null);
60
- const labelNode = (
75
+ const name = (_jsxs("label", { id: `${id}-label`, htmlFor: id, className: inline && !settings ? "min-w-0 truncate" : "", children: [label, required ? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "text-ink", "aria-hidden": true, children: [" ", "*"] }), _jsxs("span", { className: "sr-only", children: [", ", copy.field.required] })] })) : null] }));
76
+ const marks = (_jsxs(_Fragment, { children: [note === undefined ? null : _jsx(NoteFlag, { note: note }), changed ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, title: copy.field.changed, className: "size-1.5 shrink-0 rounded-pill bg-accent transition-transform duration-(--duration-quick) ease-(--ease-out) starting:scale-0" }), _jsx("span", { id: changedId, className: "sr-only", children: copy.field.changed })] })) : null, copies ? (_jsx(FieldCopy, { label: label, scope: shown, ...(typeof copyAs === "string" ? { value: copyAs } : {}) })) : null] }));
77
+ const labelNode = settings ? (_jsx(SettingsLabel, { name: name, hint: hint, hintId: hintId, optional: optional && !required, marks: marks, inline: inline })) : (
61
78
  /* The label follows its control's focus: in a form of twenty fields, the eye finds the
62
79
  row being written by its name as much as by the ring. */
63
- _jsxs("span", { className: `flex min-w-0 items-center gap-1 text-micro font-medium text-muted transition-colors duration-(--duration-quick) group-focus-within/field:text-primary ${inline ? "pt-2" : ""}`, children: [_jsxs("label", { id: `${id}-label`, htmlFor: id, className: inline ? "min-w-0 truncate" : "", children: [label, required ? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "text-ink", "aria-hidden": true, children: [" ", "*"] }), _jsxs("span", { className: "sr-only", children: [", ", copy.field.required] })] })) : null] }), hint === undefined ? null : _jsx(Hint, { id: hintId, children: hint }), note === undefined ? null : _jsx(NoteFlag, { note: note }), changed ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, title: copy.field.changed, className: "size-1.5 shrink-0 rounded-pill bg-accent transition-transform duration-(--duration-quick) ease-(--ease-out) starting:scale-0" }), _jsx("span", { id: changedId, className: "sr-only", children: copy.field.changed })] })) : null, copies ? (_jsx(FieldCopy, { label: label, scope: shown, ...(typeof copyAs === "string" ? { value: copyAs } : {}) })) : null] }));
80
+ _jsxs("span", { className: `flex min-w-0 items-center gap-1 text-micro font-medium text-muted transition-colors duration-(--duration-quick) group-focus-within/field:text-primary ${inline ? "pt-2" : ""}`, children: [name, hint === undefined ? null : _jsx(Hint, { id: hintId, children: hint }), marks] }));
64
81
  /* Last in the field so it is read last; absolutely placed, it still sits at the field's
65
82
  top — the static position of an absolute child of a flex or grid box is its start. */
66
83
  const noteCard = note === undefined ? null : _jsx(NoteCard, { note: note, id: noteId, owner: label });
@@ -78,6 +95,13 @@ export function Field({ label, hint, error, required = false, children, htmlFor,
78
95
  inside it then also finds the label that names it, not only the id it is handed. */
79
96
  const content = (_jsx(FieldIdsContext.Provider, { value: ids, children: _jsx("div", { ref: shown, className: "contents", children: typeof children === "function" ? children(ids) : children }) }));
80
97
  const body = (_jsxs(_Fragment, { children: [mode === undefined ? (content) : (_jsx(FormModeProvider, { value: mode, children: content })), error === undefined ? null : (_jsxs("p", { id: errorId, role: "alert", className: "flex items-start gap-1.5 text-micro text-danger", children: [_jsx(AlertCircle, { className: "mt-px size-(--size-icon-sm) shrink-0", strokeWidth: 2, "aria-hidden": true }), _jsx("span", { className: "max-w-prose", children: error }), _jsx(CopyButton, { label: copy.copyable.report, value: () => `${label}: ${error}` })] }))] }));
98
+ if (inline && settings) {
99
+ /* The row: what it asks on the left, the answer on the right (`grid-setting`). */
100
+ return (_jsxs("div", { "data-ui": "field", "data-style": "settings", className: "grid-setting grid min-w-0 items-start gap-x-8 gap-y-2 group/field", children: [labelNode, _jsx("div", { className: "flex min-w-0 flex-col gap-1", children: body }), action === undefined ? null : (_jsx("div", { "data-under-control": true, className: "flex items-center gap-2", children: action })), noteCard] }));
101
+ }
102
+ if (settings) {
103
+ return (_jsxs("div", { "data-ui": "field", "data-style": "settings", className: "group/field flex min-w-0 flex-col gap-2", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-2", children: [labelNode, action === undefined ? null : _jsx("span", { className: "ml-auto shrink-0", children: action })] }), body, noteCard] }));
104
+ }
81
105
  if (inline) {
82
106
  return (_jsxs("div", { className: "grid-label grid min-w-0 items-start gap-x-4 gap-y-1 group/field", children: [labelNode, _jsx("div", { className: "flex min-w-0 flex-col gap-1", children: body }), action === undefined ? null : (_jsx("div", { "data-under-control": true, className: "flex items-center gap-2", children: action })), noteCard] }));
83
107
  }
@@ -97,6 +121,7 @@ export function Field({ label, hint, error, required = false, children, htmlFor,
97
121
  */
98
122
  export function DataField({ label, value, hint, layout, mono = false, action, note, copy: copyAs, }) {
99
123
  const d = useDensity();
124
+ const settings = useFormStyle() === "settings";
100
125
  const shown = useRef(null);
101
126
  const allowed = useFieldCopy() && copyAs !== false;
102
127
  const noteId = `${useId()}-note`;
@@ -104,9 +129,13 @@ export function DataField({ label, value, hint, layout, mono = false, action, no
104
129
  const inline = layout === "inline" || (layout === undefined && sheetLayout === "horizontal");
105
130
  const empty = value === undefined || value === null || value === "";
106
131
  const unset = useUiCopy().field.unset;
107
- const labelNode = (_jsxs("span", { className: `flex min-w-0 items-center gap-1 text-micro font-medium text-muted ${inline ? "pt-0.5" : ""}`, children: [_jsx("span", { className: inline ? "min-w-0 truncate" : "", children: label }), hint === undefined ? null : _jsx(Hint, { children: hint }), note === undefined ? null : _jsx(NoteFlag, { note: note }), allowed && !empty ? (_jsx(FieldCopy, { label: label, scope: shown, ...(typeof copyAs === "string" ? { value: copyAs } : {}) })) : null] }));
132
+ const marks = (_jsxs(_Fragment, { children: [note === undefined ? null : _jsx(NoteFlag, { note: note }), allowed && !empty ? (_jsx(FieldCopy, { label: label, scope: shown, ...(typeof copyAs === "string" ? { value: copyAs } : {}) })) : null] }));
133
+ const labelNode = settings ? (_jsx(SettingsLabel, { name: _jsx("span", { children: label }), hint: hint, hintId: undefined, optional: false, marks: marks, inline: false })) : (_jsxs("span", { className: `flex min-w-0 items-center gap-1 text-micro font-medium text-muted ${inline ? "pt-0.5" : ""}`, children: [_jsx("span", { className: inline ? "min-w-0 truncate" : "", children: label }), hint === undefined ? null : _jsx(Hint, { children: hint }), marks] }));
108
134
  const noteCard = note === undefined ? null : _jsx(NoteCard, { note: note, id: noteId, owner: label });
109
135
  const valueNode = (_jsx("span", { ref: shown, ...(note === undefined ? {} : { "aria-describedby": noteId }), className: `min-w-0 text-meta ${empty ? "text-muted italic" : "text-ink"} ${mono ? "font-mono tabular-nums" : ""}`, children: empty ? unset : value }));
136
+ if (inline && settings) {
137
+ return (_jsxs("div", { "data-ui": "field", "data-style": "settings", className: "grid-setting grid min-w-0 items-start gap-x-8 gap-y-1 group/field", children: [labelNode, _jsxs("span", { className: "flex min-w-0 items-baseline gap-2", children: [valueNode, action] }), noteCard] }));
138
+ }
110
139
  if (inline) {
111
140
  return (_jsxs("div", { className: "grid-label grid min-w-0 items-baseline gap-x-4 gap-y-0.5 group/field", children: [labelNode, _jsxs("span", { className: "flex min-w-0 items-baseline gap-2", children: [valueNode, action] }), noteCard] }));
112
141
  }
@@ -55,6 +55,13 @@ export type MetricProps = {
55
55
  };
56
56
  };
57
57
  export declare function Metric({ value, label, detail, tone, icon: Icon, onClick, active, change, loading, }: MetricProps): import("react").JSX.Element;
58
+ /** How a figure moved against a named period: «↗ +18 % vs 2025». The arrow carries the
59
+ * direction and the words the period, so the colour is never the only channel. A board's
60
+ * stat tile says it the same way. */
61
+ export declare function MetricChange({ change, format, }: {
62
+ change: NonNullable<MetricProps["change"]>;
63
+ format: (value: number) => string;
64
+ }): import("react").JSX.Element;
58
65
  /** The row of metrics. It wraps if they don't fit; it doesn't scroll: a hidden
59
66
  * metric is a filter nobody finds. */
60
67
  export declare function Metrics({ children }: {
@@ -40,7 +40,7 @@ export function Metric({ value, label, detail, tone = "neutral", icon: Icon, onC
40
40
  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 })), loading ? (
41
41
  /* A bar one line of the figure tall (`h-lh`), so the box is the size it will
42
42
  be. It appears late, like every skeleton: a fast read never shows it. */
43
- _jsx("span", { "aria-hidden": true, className: `inline-block h-lh w-16 animate-reveal-late rounded-control ${bySurface(sup, "bg-ink/8", "bg-chrome-ink/12")}` })) : (figure)] }), _jsx("span", { className: `text-micro ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: label }), detail === undefined || loading ? null : (_jsx("span", { "data-ui": "metric.detail", className: `text-micro tabular-nums ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: detail })), change === undefined || loading ? null : (_jsx(Change, { change: change, format: percent.format }))] }));
43
+ _jsx("span", { "aria-hidden": true, className: `inline-block h-lh w-16 animate-reveal-late rounded-control ${bySurface(sup, "bg-ink/8", "bg-chrome-ink/12")}` })) : (figure)] }), _jsx("span", { className: `text-micro ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: label }), detail === undefined || loading ? null : (_jsx("span", { "data-ui": "metric.detail", className: `text-micro tabular-nums ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: detail })), change === undefined || loading ? null : (_jsx(MetricChange, { change: change, format: percent.format }))] }));
44
44
  if (onClick === undefined) {
45
45
  return (_jsx("div", { "data-ui": "metric", className: box, "aria-label": loading
46
46
  ? `${label}: ${copy.failed.loading}`
@@ -48,7 +48,10 @@ export function Metric({ value, label, detail, tone = "neutral", icon: Icon, onC
48
48
  }
49
49
  return (_jsxs("button", { type: "button", onClick: onClick, "aria-pressed": active, ...(loading ? { "aria-busy": true } : {}), "data-ui": "metric", className: box, children: [content, loading ? _jsx("span", { className: "sr-only", children: copy.failed.loading }) : null] }));
50
50
  }
51
- function Change({ change, format, }) {
51
+ /** How a figure moved against a named period: «↗ +18 % vs 2025». The arrow carries the
52
+ * direction and the words the period, so the colour is never the only channel. A board's
53
+ * stat tile says it the same way. */
54
+ export function MetricChange({ change, format, }) {
52
55
  const copy = useUiCopy();
53
56
  const sup = useSurface();
54
57
  const up = change.by > 0;