@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.
- package/README.md +24 -3
- package/dist/components/activity/Activity.d.ts +20 -1
- package/dist/components/activity/Activity.js +44 -7
- package/dist/components/activity/index.d.ts +1 -1
- package/dist/components/board/Board.d.ts +74 -2
- package/dist/components/board/Board.js +65 -2
- package/dist/components/board/index.d.ts +1 -1
- package/dist/components/board/index.js +1 -1
- package/dist/components/canvas/canvas.css +6 -1
- package/dist/components/form/Form.js +11 -0
- package/dist/components/form/FormIndex.d.ts +11 -0
- package/dist/components/form/FormIndex.js +96 -0
- package/dist/components/form/Sheet.js +5 -0
- package/dist/components/listing/ChartExplorer.js +10 -5
- package/dist/components/record/DirtyActions.d.ts +10 -1
- package/dist/components/record/DirtyActions.js +77 -6
- package/dist/components/record/RecordHeader.js +17 -11
- package/dist/foundations/calendar.d.ts +12 -0
- package/dist/foundations/calendar.js +50 -0
- package/dist/foundations/chart.d.ts +10 -1
- package/dist/foundations/chart.js +17 -1
- package/dist/foundations/copy.d.ts +20 -0
- package/dist/foundations/copy.es.js +9 -0
- package/dist/foundations/copy.js +9 -0
- package/dist/foundations/form.d.ts +6 -0
- package/dist/foundations/form.js +7 -0
- package/dist/foundations/index.d.ts +2 -2
- package/dist/foundations/index.js +2 -2
- package/dist/foundations/pivot.d.ts +6 -0
- package/dist/foundations/pivot.js +1 -0
- package/dist/primitives/chart/BarList.d.ts +30 -0
- package/dist/primitives/chart/BarList.js +27 -0
- package/dist/primitives/chart/Chart.d.ts +13 -0
- package/dist/primitives/chart/Chart.js +71 -19
- package/dist/primitives/chart/Sparkline.d.ts +30 -0
- package/dist/primitives/chart/Sparkline.js +53 -0
- package/dist/primitives/chart/index.d.ts +2 -0
- package/dist/primitives/chart/index.js +2 -0
- package/dist/primitives/field/Field.d.ts +6 -2
- package/dist/primitives/field/Field.js +35 -6
- package/dist/primitives/value/Metric.d.ts +7 -0
- package/dist/primitives/value/Metric.js +5 -2
- package/dist/tokens.css +53 -2
- package/package.json +1 -1
|
@@ -9,9 +9,14 @@ import { Button, IconButton } from "../../primitives/button/Button.js";
|
|
|
9
9
|
import { Chart } from "../../primitives/chart/Chart.js";
|
|
10
10
|
import { SegmentedControl } from "../../primitives/choice/SegmentedControl.js";
|
|
11
11
|
import { Menu } from "../../primitives/menu/Menu.js";
|
|
12
|
-
import { ArrowDownWideNarrow, ArrowUpNarrowWide, ChartColumnBig, ChartLine, ChartPie, Download, GitCompareArrows, Layers, Sigma, TrendingUp, } from "lucide-react";
|
|
12
|
+
import { ArrowDownWideNarrow, ArrowUpNarrowWide, ChartArea, ChartColumnBig, ChartLine, ChartPie, Download, GitCompareArrows, Layers, Sigma, TrendingUp, } from "lucide-react";
|
|
13
13
|
import { useMemo, useState } from "react";
|
|
14
|
-
const KIND_ICON = {
|
|
14
|
+
const KIND_ICON = {
|
|
15
|
+
bar: ChartColumnBig,
|
|
16
|
+
line: ChartLine,
|
|
17
|
+
area: ChartArea,
|
|
18
|
+
pie: ChartPie,
|
|
19
|
+
};
|
|
15
20
|
/**
|
|
16
21
|
* Odoo's GRAPH view, for any set: bars, lines or a pie; which measures; split by what along
|
|
17
22
|
* the axis and by what into series; stacked, cumulative, ordered; against the previous
|
|
@@ -64,7 +69,7 @@ export function ChartExplorer({ folded, items, of, fields = [], labelOf: outerLa
|
|
|
64
69
|
return measuresShown.map((measure) => {
|
|
65
70
|
const reading = {
|
|
66
71
|
measure: measure.id,
|
|
67
|
-
cumulative: kind === "line" && cumulative,
|
|
72
|
+
cumulative: (kind === "line" || kind === "area") && cumulative,
|
|
68
73
|
...(kind === "pie" ? { maxCategories: 7 } : {}),
|
|
69
74
|
};
|
|
70
75
|
const current = chartFromPivot(pivot, reading);
|
|
@@ -92,7 +97,7 @@ export function ChartExplorer({ folded, items, of, fields = [], labelOf: outerLa
|
|
|
92
97
|
/* The last one stays: a chart of no measure is no chart. */
|
|
93
98
|
setChosen(!on.includes(id) ? [...on, id] : on.length === 1 ? on : on.filter((one) => one !== id));
|
|
94
99
|
};
|
|
95
|
-
return (_jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-5 gap-y-2", children: [_jsx(SegmentedControl, { "aria-label": words.kind, size: "sm", value: kind, onChange: (next) => setKind(next), options: ["bar", "line", "pie"].map((one) => ({
|
|
100
|
+
return (_jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-5 gap-y-2", children: [_jsx(SegmentedControl, { "aria-label": words.kind, size: "sm", value: kind, onChange: (next) => setKind(next), options: ["bar", "line", "area", "pie"].map((one) => ({
|
|
96
101
|
value: one,
|
|
97
102
|
label: words[one],
|
|
98
103
|
icon: KIND_ICON[one],
|
|
@@ -105,7 +110,7 @@ export function ChartExplorer({ folded, items, of, fields = [], labelOf: outerLa
|
|
|
105
110
|
checked: measuresShown.some((on) => on.id === one.id),
|
|
106
111
|
})),
|
|
107
112
|
},
|
|
108
|
-
], onSelect: toggleMeasure }), folded === undefined ? (_jsxs(_Fragment, { children: [_jsx(AxisLevels, { name: words.categoriesAxis, levels: categories, onChange: following ? null : setOwnCategories, fields: fields, used: series, labelOf: labelOf }), kind === "pie" || (following && series.length === 0) ? null : (_jsx(AxisLevels, { name: words.seriesAxis, levels: series, onChange: following ? null : setOwnSeries, fields: fields, used: categories, labelOf: labelOf }))] })) : null, _jsxs("div", { className: "ml-auto flex items-center gap-1", children: [canCompare ? (_jsx(IconButton, { icon: GitCompareArrows, label: fillCopy(words.compareWith, { name: compare.previous }), "aria-pressed": comparing, onClick: () => setComparing((now) => !now) })) : null, kind !== "pie" && manySeries ? (_jsx(IconButton, { icon: Layers, label: words.stacked, "aria-pressed": stacked, onClick: () => setStacked((now) => !now) })) : null, kind === "line" ? (_jsx(IconButton, { icon: TrendingUp, label: words.cumulative, "aria-pressed": cumulative && additive, disabled: !additive, onClick: () => setCumulative((now) => !now) })) : null, _jsx(IconButton, { icon: ArrowDownWideNarrow, label: words.descending, "aria-pressed": order === "desc", onClick: () => toggleOrder("desc") }), _jsx(IconButton, { icon: ArrowUpNarrowWide, label: words.ascending, "aria-pressed": order === "asc", onClick: () => toggleOrder("asc") }), pivot === undefined ? null : (_jsx(Button, { role: "ghost", size: "sm", icon: Download, onClick: () => downloadPivot(pivot, fileName === undefined ? {} : { name: fileName }), children: copy.pivot.download }))] })] }), charts.map((data) => (_jsxs("section", { className: "flex min-w-0 flex-col gap-2", children: [charts.length > 1 ? (_jsx("h3", { className: "text-meta font-semibold text-ink", children: data.measure.header })) : null, _jsx(Chart, { data: data, kind: kind, stacked: stacked, label: charts.length > 1
|
|
113
|
+
], onSelect: toggleMeasure }), folded === undefined ? (_jsxs(_Fragment, { children: [_jsx(AxisLevels, { name: words.categoriesAxis, levels: categories, onChange: following ? null : setOwnCategories, fields: fields, used: series, labelOf: labelOf }), kind === "pie" || (following && series.length === 0) ? null : (_jsx(AxisLevels, { name: words.seriesAxis, levels: series, onChange: following ? null : setOwnSeries, fields: fields, used: categories, labelOf: labelOf }))] })) : null, _jsxs("div", { className: "ml-auto flex items-center gap-1", children: [canCompare ? (_jsx(IconButton, { icon: GitCompareArrows, label: fillCopy(words.compareWith, { name: compare.previous }), "aria-pressed": comparing, onClick: () => setComparing((now) => !now) })) : null, kind !== "pie" && manySeries ? (_jsx(IconButton, { icon: Layers, label: words.stacked, "aria-pressed": stacked, onClick: () => setStacked((now) => !now) })) : null, kind === "line" || kind === "area" ? (_jsx(IconButton, { icon: TrendingUp, label: words.cumulative, "aria-pressed": cumulative && additive, disabled: !additive, onClick: () => setCumulative((now) => !now) })) : null, _jsx(IconButton, { icon: ArrowDownWideNarrow, label: words.descending, "aria-pressed": order === "desc", onClick: () => toggleOrder("desc") }), _jsx(IconButton, { icon: ArrowUpNarrowWide, label: words.ascending, "aria-pressed": order === "asc", onClick: () => toggleOrder("asc") }), pivot === undefined ? null : (_jsx(Button, { role: "ghost", size: "sm", icon: Download, onClick: () => downloadPivot(pivot, fileName === undefined ? {} : { name: fileName }), children: copy.pivot.download }))] })] }), charts.map((data) => (_jsxs("section", { className: "flex min-w-0 flex-col gap-2", children: [charts.length > 1 ? (_jsx("h3", { className: "text-meta font-semibold text-ink", children: data.measure.header })) : null, _jsx(Chart, { data: data, kind: kind, stacked: stacked, label: charts.length > 1
|
|
109
114
|
? describe(data.measure.header, label ?? data.categoryTitle)
|
|
110
115
|
: (label ?? describe(data.measure.header, data.categoryTitle)), ...(onPoint === undefined ? {} : { onPoint }), ...(height === undefined ? {} : { height }) })] }, data.measure.id)))] }));
|
|
111
116
|
}
|
|
@@ -26,7 +26,12 @@ export interface DirtyState {
|
|
|
26
26
|
* two was noise beside the one action that matters. The only thing written here is what
|
|
27
27
|
* the buttons cannot say — WHY it cannot be saved yet (`blocked`). The count of changes
|
|
28
28
|
* still reaches a screen reader, as the Save button's description. */
|
|
29
|
-
export declare function DirtyActions({ onSave, onDiscard, saving, label, blocked, changes, }: DirtyState
|
|
29
|
+
export declare function DirtyActions({ onSave, onDiscard, saving, label, blocked, changes, floating, }: DirtyState & {
|
|
30
|
+
/** In the floating bar (`DirtyBar`): the count is WRITTEN — the changed fields may be far
|
|
31
|
+
* up a long form, out of sight, and their marks with them — and Discard is the quiet
|
|
32
|
+
* ghost, so the bar reads «what is pending · undo · save» and not two equal boxes. */
|
|
33
|
+
floating?: boolean;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
30
35
|
/**
|
|
31
36
|
* Whether the record has JUST been saved: `dirty` went from saving straight to gone.
|
|
32
37
|
*
|
|
@@ -40,3 +45,7 @@ export declare function useJustSaved(dirty: DirtyState | undefined): boolean;
|
|
|
40
45
|
export declare function SavedMark({ saved }: {
|
|
41
46
|
saved: boolean;
|
|
42
47
|
}): import("react").JSX.Element;
|
|
48
|
+
export declare function DirtyBar({ dirty, saved, }: {
|
|
49
|
+
dirty: DirtyState | undefined;
|
|
50
|
+
saved: boolean;
|
|
51
|
+
}): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { fillCopy, useUiCopy } from "../../foundations/copy.js";
|
|
4
|
-
import { bySurface, useSurface } from "../../foundations/surface.js";
|
|
4
|
+
import { bySurface, SurfaceProvider, useSurface } from "../../foundations/surface.js";
|
|
5
5
|
import { Button } from "../../primitives/button/Button.js";
|
|
6
6
|
import { Check, Save, Undo2 } from "lucide-react";
|
|
7
7
|
import { useEffect, useId, useRef, useState } from "react";
|
|
@@ -16,7 +16,7 @@ import { useEffect, useId, useRef, useState } from "react";
|
|
|
16
16
|
* two was noise beside the one action that matters. The only thing written here is what
|
|
17
17
|
* the buttons cannot say — WHY it cannot be saved yet (`blocked`). The count of changes
|
|
18
18
|
* still reaches a screen reader, as the Save button's description. */
|
|
19
|
-
export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked, changes, }) {
|
|
19
|
+
export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked, changes, floating = false, }) {
|
|
20
20
|
const copy = useUiCopy();
|
|
21
21
|
const blockedId = useId();
|
|
22
22
|
const changesId = useId();
|
|
@@ -28,9 +28,15 @@ export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked
|
|
|
28
28
|
...(blocked === undefined ? [] : [blockedId]),
|
|
29
29
|
...(counted ? [changesId] : []),
|
|
30
30
|
].join(" ");
|
|
31
|
-
return (_jsxs(_Fragment, { children: [blocked === undefined ? null : (_jsx("span", { id: blockedId, "data-ui": "dirty.blocked", className: `inline-flex h-(--size-control-md) min-w-0 shrink items-center gap-1.5 truncate rounded-control px-2.5 text-meta font-medium ${bySurface(surface, "bg-warn/12 text-warn", "bg-chrome-warn/15 text-chrome-warn")}`, children: blocked })), counted ? (_jsx("span", { id: changesId,
|
|
31
|
+
return (_jsxs(_Fragment, { children: [blocked === undefined ? null : (_jsx("span", { id: blockedId, "data-ui": "dirty.blocked", className: `inline-flex h-(--size-control-md) min-w-0 shrink items-center gap-1.5 truncate rounded-control px-2.5 text-meta font-medium ${bySurface(surface, "bg-warn/12 text-warn", "bg-chrome-warn/15 text-chrome-warn")}`, children: blocked })), counted ? (_jsx("span", { id: changesId, ...(floating
|
|
32
|
+
? {
|
|
33
|
+
/* One row on a phone too: the count gives way (it truncates), never the
|
|
34
|
+
buttons — a pill broken in two rows is a blob. */
|
|
35
|
+
className: `min-w-0 shrink! truncate px-2.5 text-meta ${bySurface(surface, "text-muted", "text-chrome-muted")}`,
|
|
36
|
+
}
|
|
37
|
+
: { hidden: true }), children: fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
|
|
32
38
|
count: changes.toLocaleString(copy.locale),
|
|
33
|
-
}) })) : null, _jsx(Button, { surface: surface, onClick: onDiscard, disabled: saving, icon: Undo2, children: copy.record.discard }), _jsx(Button, { role: "primary", surface: surface, onClick: onSave, busy: saving, disabled: blocked !== undefined, icon: Save, ...(describedBy === "" ? {} : { "aria-describedby": describedBy }), children: saving ? copy.record.saving : (label ?? copy.record.save) })] }));
|
|
39
|
+
}) })) : null, _jsx(Button, { ...(floating ? { role: "ghost" } : {}), surface: surface, onClick: onDiscard, disabled: saving, icon: Undo2, children: copy.record.discard }), _jsx(Button, { role: "primary", surface: surface, onClick: onSave, busy: saving, disabled: blocked !== undefined, icon: Save, ...(describedBy === "" ? {} : { "aria-describedby": describedBy }), children: saving ? copy.record.saving : (label ?? copy.record.save) })] }));
|
|
34
40
|
}
|
|
35
41
|
/** The one action a view leads with: the element written with `role="primary"` — the
|
|
36
42
|
* same prop that paints it gold and that `make smoke` counts, so there is no second way to
|
|
@@ -69,10 +75,75 @@ export function useJustSaved(dirty) {
|
|
|
69
75
|
}, [saving, present]);
|
|
70
76
|
return saved;
|
|
71
77
|
}
|
|
78
|
+
/** The «✓ Guardado» chip itself, without its live region: what is SEEN. */
|
|
79
|
+
function SavedChip() {
|
|
80
|
+
const copy = useUiCopy();
|
|
81
|
+
const surface = useSurface();
|
|
82
|
+
return (_jsxs("span", { "aria-hidden": true, className: `inline-flex h-(--size-control-md) shrink-0 items-center gap-1.5 rounded-ui-button px-2.5 text-meta font-medium transition-[opacity,translate] duration-(--duration-quick) ease-(--ease-out) starting:-translate-y-0.5 starting:opacity-0 ${bySurface(surface, "bg-good/12 text-good", "bg-chrome-good/15 text-chrome-good")}`, children: [_jsx(Check, { className: "size-(--size-icon-sm)", strokeWidth: 2.5 }), copy.record.saved] }));
|
|
83
|
+
}
|
|
72
84
|
/** «✓ Guardado», where Save was, for a moment. The live region is always there — a region
|
|
73
85
|
* inserted together with its words is not reliably announced. */
|
|
74
86
|
export function SavedMark({ saved }) {
|
|
75
87
|
const copy = useUiCopy();
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { role: "status", className: "sr-only", children: saved ? copy.record.saved : "" }), saved ? _jsx(SavedChip, {}) : null] }));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Save and Discard FLOATING at the bottom of the screen, centred — the «settings» form
|
|
92
|
+
* style's (`FormStyleProvider`), in place of the rail and the thumb bar.
|
|
93
|
+
*
|
|
94
|
+
* Context: a settings form is long and read top to bottom; the rail is left behind with the
|
|
95
|
+
* first card, and the last field changed is near the bottom. The bar appears with the first
|
|
96
|
+
* change, in the dark band (the chrome) so it reads apart from the cards, and says «Guardado»
|
|
97
|
+
* for a moment where Save was. Sticky and last in the record, as the thumb bar: at the end of
|
|
98
|
+
* the form it settles under the last card and covers nothing.
|
|
99
|
+
*
|
|
100
|
+
* ── It never covers the field being typed into ──────────────────────
|
|
101
|
+
*
|
|
102
|
+
* The bar appears with the first keystroke, and on a phone the field being typed into is
|
|
103
|
+
* often the one at the bottom of the screen — right where the bar lands. So while the bar is
|
|
104
|
+
* up, the field that has the focus (when the bar appears, and each time the focus moves) is
|
|
105
|
+
* scrolled up out from under it: a form that hides what you are writing is broken, however
|
|
106
|
+
* nice the bar.
|
|
107
|
+
*
|
|
108
|
+
* ── Its shape ─────────────────────────────────────────────────────────
|
|
109
|
+
*
|
|
110
|
+
* A pill holds pills: the buttons inside take the pill's radius (`--ui-button-radius`), or a
|
|
111
|
+
* full-round bar around 8 px corners reads as two boxes in a tube. On the dark theme the
|
|
112
|
+
* chrome is as dark as the ground, so the bar carries the chrome's hairline (`chrome-edge`) —
|
|
113
|
+
* invisible on light, where the chrome already stands apart by luminance.
|
|
114
|
+
*/
|
|
115
|
+
const PILL = { "--ui-button-radius": "var(--radius-pill)" };
|
|
116
|
+
/** Scrolls `field` up from under `bar` when they overlap, with a little air above the bar. */
|
|
117
|
+
function clearOf(bar, field) {
|
|
118
|
+
if (!(field instanceof HTMLElement) || field === document.body || bar.contains(field))
|
|
119
|
+
return;
|
|
120
|
+
const over = bar.getBoundingClientRect();
|
|
121
|
+
const under = field.getBoundingClientRect();
|
|
122
|
+
if (over.height === 0 || under.bottom <= over.top || under.top >= over.bottom)
|
|
123
|
+
return;
|
|
124
|
+
const before = field.style.scrollMarginBottom;
|
|
125
|
+
field.style.scrollMarginBottom = `${String(Math.ceil(over.height + 12))}px`;
|
|
126
|
+
field.scrollIntoView({ block: "nearest" });
|
|
127
|
+
field.style.scrollMarginBottom = before;
|
|
128
|
+
}
|
|
129
|
+
export function DirtyBar({ dirty, saved, }) {
|
|
130
|
+
const copy = useUiCopy();
|
|
131
|
+
const shown = dirty !== undefined || saved;
|
|
132
|
+
const ref = useRef(null);
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
const bar = ref.current;
|
|
135
|
+
if (!shown || bar === null)
|
|
136
|
+
return;
|
|
137
|
+
/* After the bar has its height: the frame it was drawn in. */
|
|
138
|
+
const frame = requestAnimationFrame(() => clearOf(bar, document.activeElement));
|
|
139
|
+
const onFocus = (event) => clearOf(bar, event.target);
|
|
140
|
+
document.addEventListener("focusin", onFocus);
|
|
141
|
+
return () => {
|
|
142
|
+
cancelAnimationFrame(frame);
|
|
143
|
+
document.removeEventListener("focusin", onFocus);
|
|
144
|
+
};
|
|
145
|
+
}, [shown]);
|
|
146
|
+
/* Always mounted, so «Guardado» is announced (see `SavedMark`); with nothing to say it has
|
|
147
|
+
no height and covers nothing. */
|
|
148
|
+
return (_jsxs("div", { ref: ref, "data-ui": "dirty.bar", className: `pointer-events-none sticky bottom-0 z-20 mt-auto flex justify-center px-3 ${shown ? "pt-3 safe-bottom" : ""}`, children: [_jsx("span", { role: "status", className: "sr-only", children: saved ? copy.record.saved : "" }), shown ? (_jsx(SurfaceProvider, { value: "chrome", children: _jsx("div", { style: PILL, className: "pointer-events-auto flex max-w-full min-w-0 items-center gap-1 rounded-pill border border-chrome-edge bg-chrome p-1.5 shadow-float *:shrink-0", children: dirty === undefined ? _jsx(SavedChip, {}) : _jsx(DirtyActions, { ...dirty, floating: true }) }) })) : null] }));
|
|
78
149
|
}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { Breadcrumb } from "./Breadcrumb.js";
|
|
4
|
-
import { DirtyActions, SavedMark, useJustSaved, } from "./DirtyActions.js";
|
|
4
|
+
import { DirtyActions, DirtyBar, SavedMark, useJustSaved, } from "./DirtyActions.js";
|
|
5
5
|
import { isPrimary, ThumbBar, thumbPlan } from "./ThumbBar.js";
|
|
6
6
|
import { byDensity, useDensity } from "../../foundations/density.js";
|
|
7
|
+
import { useFormStyle } from "../../foundations/form.js";
|
|
7
8
|
import { SurfaceProvider } from "../../foundations/surface.js";
|
|
8
9
|
import { Line } from "../../primitives/block/Line.js";
|
|
9
10
|
import { Tag } from "../../primitives/tag/Tag.js";
|
|
10
11
|
import { useEffect, useRef } from "react";
|
|
11
12
|
export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Icon, title, subtitle, tag, figure, railSurface = "canvas", smart, aspects, dirty, activity, activityLayout = "auto", width = "reading", ribbon, blocking, indicator, paper: onPaper, children, }) {
|
|
12
13
|
const d = useDensity();
|
|
14
|
+
/* The «settings» form style (`FormStyleProvider`): Save and Discard float at the bottom
|
|
15
|
+
(`DirtyBar`) instead of taking the rail and the thumb bar, and the record has no white
|
|
16
|
+
sheet of its own — its sections are the cards, on the ground. */
|
|
17
|
+
const floating = useFormStyle() === "settings";
|
|
13
18
|
/* «Guardado» is said where Save was; a record whose rail exists only while it has changes
|
|
14
19
|
keeps it for that moment, or the answer would leave with the question. */
|
|
15
20
|
const saved = useJustSaved(dirty);
|
|
21
|
+
const railDirty = floating ? undefined : dirty;
|
|
16
22
|
/* Save is gone the moment it has saved, and the focus that was on it fell to the page —
|
|
17
23
|
a keyboard was left at the top of the document. It comes back to the record's name:
|
|
18
24
|
where reading the record starts, and announced together with «Guardado». */
|
|
@@ -24,12 +30,12 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
24
30
|
if (lost)
|
|
25
31
|
nameRef.current?.focus({ preventScroll: true });
|
|
26
32
|
}, [saved]);
|
|
27
|
-
const hasRail = saved ||
|
|
33
|
+
const hasRail = (saved && !floating) ||
|
|
28
34
|
crumbs !== undefined ||
|
|
29
35
|
pager !== undefined ||
|
|
30
36
|
actions !== undefined ||
|
|
31
37
|
status !== undefined ||
|
|
32
|
-
|
|
38
|
+
railDirty !== undefined;
|
|
33
39
|
/* In compact the rail goes away ENTIRELY, and it is not for room: in a
|
|
34
40
|
preview, the breadcrumbs and the pager belong to the surface that opened it
|
|
35
41
|
—the list behind is still there— and the actions are already in the
|
|
@@ -42,7 +48,7 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
42
48
|
/* The activity column at the RIGHT of the sheet when the page is wide (THE PAGE). */
|
|
43
49
|
const beside = activity !== undefined && activityLayout === "auto";
|
|
44
50
|
/* The thumb bar's content (see THE THUMB BAR in `ThumbBar`): dirty first, else the primary. */
|
|
45
|
-
const { rail: railActions, primaries, mode: thumb, } = thumbPlan({ withRail, actions, dirty });
|
|
51
|
+
const { rail: railActions, primaries, mode: thumb, } = thumbPlan({ withRail, actions, dirty: railDirty });
|
|
46
52
|
/* In compact the TITLE is not drawn either, for the same reason as in
|
|
47
53
|
`Listing`: the surface header already says it. Drawing it here showed it
|
|
48
54
|
twice in the same 480 px drawer — and the name of a customer in this product
|
|
@@ -92,15 +98,15 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
92
98
|
it. The line wraps on a phone, so it is never pushed out of reach. */
|
|
93
99
|
smart === undefined && indicator === undefined ? undefined : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center justify-center gap-2", children: [smart, indicator] })), end: pager }), actions === undefined &&
|
|
94
100
|
status === undefined &&
|
|
95
|
-
|
|
96
|
-
!saved ? null : (
|
|
101
|
+
railDirty === undefined &&
|
|
102
|
+
(!saved || floating) ? null : (
|
|
97
103
|
/* Row 2 — WHAT I CAN DO and WHERE IT IS AT: actions stuck to the
|
|
98
104
|
left edge, the history and the state stuck to the right one. No
|
|
99
105
|
`flex-wrap`: wrapping split the row in two and the state ended up
|
|
100
106
|
below the actions, which is another hierarchy. */
|
|
101
|
-
_jsxs("div", { className: "flex min-w-0 items-start gap-x-4", children: [
|
|
107
|
+
_jsxs("div", { className: "flex min-w-0 items-start gap-x-4", children: [railDirty !== undefined ? (_jsx("div", { className: "flex shrink-0 items-center gap-1.5 @max-handheld/record:hidden", children: _jsx(DirtyActions, { ...railDirty }) })) : actions === undefined ? (floating ? null : (_jsx(SavedMark, { saved: saved }))) : (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [primaries.length === 0
|
|
102
108
|
? actions
|
|
103
|
-
: railActions.map((node) => isPrimary(node) ? (_jsx("span", { "data-thumb-moves": "", className: "contents @max-handheld/record:hidden", children: node }, node.key)) : (node)), _jsx(SavedMark, { saved: saved })] })), status === undefined ? null : (_jsx("div", { className: "ml-auto flex min-w-0 flex-col items-end gap-1.5", children: status }))] }))] }) }) }) })) : null, paper ? (
|
|
109
|
+
: railActions.map((node) => isPrimary(node) ? (_jsx("span", { "data-thumb-moves": "", className: "contents @max-handheld/record:hidden", children: node }, node.key)) : (node)), floating ? null : _jsx(SavedMark, { saved: saved })] })), status === undefined ? null : (_jsx("div", { className: "ml-auto flex min-w-0 flex-col items-end gap-1.5", children: status }))] }))] }) }) }) })) : null, paper ? (
|
|
104
110
|
/* ==================================================================== *
|
|
105
111
|
* THE PAGE — [sheet | Actividad], on the ground.
|
|
106
112
|
*
|
|
@@ -128,14 +134,14 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
128
134
|
* the application bar.
|
|
129
135
|
* ==================================================================== */
|
|
130
136
|
_jsx("div", { className: "bg-ground px-3 pt-3 pb-3", children: _jsx("div", { className: "@container/page", children: _jsxs("div", { className: `flex min-w-0 flex-col gap-3 ${column} ${beside
|
|
131
|
-
?
|
|
137
|
+
? `@beside/page:flex-row @beside/page:items-stretch @beside/page:justify-center ${floating ? "@beside/page:gap-4" : "@beside/page:gap-0"}`
|
|
132
138
|
: ""}`, children: [_jsxs("div", { className: `flex min-w-0 flex-1 flex-col gap-3 ${beside && width === "reading"
|
|
133
139
|
? "mx-auto w-full max-w-(--container-sheet) @beside/page:mx-0"
|
|
134
|
-
: ""}`, children: [blocking, _jsxs("div", { className: `relative flex min-w-0 flex-col overflow-clip rounded-box border border-line bg-surface ${beside ? "@beside/page:rounded-r-none" : ""}`, children: [ribbon, identity, children] }), activity !== undefined && activityLayout === "below" ? activity : null] }), beside ? (
|
|
140
|
+
: ""}`, children: [blocking, _jsxs("div", { className: `relative flex min-w-0 flex-col overflow-clip ${floating ? "" : "rounded-box border border-line bg-surface"} ${beside && !floating ? "@beside/page:rounded-r-none" : ""}`, children: [ribbon, identity, children] }), activity !== undefined && activityLayout === "below" ? activity : null] }), beside ? (
|
|
135
141
|
/* After the sheet: the record first, what is around it second — in the
|
|
136
142
|
reading order and on screen. */
|
|
137
143
|
_jsx("div", { className: "mx-auto w-full max-w-(--container-sheet) min-w-0 @beside/page:mx-0 @beside/page:flex @beside/page:w-auto @beside/page:max-w-none @beside/page:shrink-0", children: activity })) : null] }) }) })) : (
|
|
138
144
|
/* No paper (a modal, a drawer): one surface, no ground beside
|
|
139
145
|
it — the band first, the record, and the activity below. */
|
|
140
|
-
_jsxs("div", { className: "relative flex min-w-0 flex-1 flex-col overflow-clip bg-surface", children: [ribbon, blocking === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pt-3.5", "pb-2"), children: blocking })), identity, children, activity === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pb-4", "pb-2"), children: activity }))] })), thumb === null ? null : _jsx(ThumbBar, { mode: thumb, dirty:
|
|
146
|
+
_jsxs("div", { className: "relative flex min-w-0 flex-1 flex-col overflow-clip bg-surface", children: [ribbon, blocking === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pt-3.5", "pb-2"), children: blocking })), identity, children, activity === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pb-4", "pb-2"), children: activity }))] })), thumb === null ? null : (_jsx(ThumbBar, { mode: thumb, dirty: railDirty, primaries: primaries })), floating ? _jsx(DirtyBar, { dirty: dirty, saved: saved }) : null] }));
|
|
141
147
|
}
|
|
@@ -21,6 +21,18 @@ export declare function dateKey(when: Date | string | number | null | undefined,
|
|
|
21
21
|
* instead of vanishing behind an invented date.
|
|
22
22
|
*/
|
|
23
23
|
export declare function dateLabel(key: string, grain: GroupGrain, within?: readonly GroupGrain[]): string;
|
|
24
|
+
/**
|
|
25
|
+
* The SHORT label of a date key: what an axis writes under its tick — «ene», «T1», «18 nov».
|
|
26
|
+
*
|
|
27
|
+
* Context: the axis used to write «Enero de 2025» under each month. Twelve of those do not fit
|
|
28
|
+
* side by side, so the chart dropped whichever collided and the axis read «Enero, Marzo,
|
|
29
|
+
* Abril, Mayo, Julio» — uneven, as if months were missing. A tick only has to tell its
|
|
30
|
+
* neighbours apart; the full label stays in the tooltip. `withYear` is for an axis that
|
|
31
|
+
* crosses a new year: then «ene 26» beside «dic 25».
|
|
32
|
+
*/
|
|
33
|
+
export declare function dateTick(key: string, grain: GroupGrain, withYear?: boolean): string;
|
|
34
|
+
/** The year a date key of `grain` falls in, or `null` if the key does not have its shape. */
|
|
35
|
+
export declare function dateKeyYear(key: string, grain: GroupGrain): number | null;
|
|
24
36
|
/**
|
|
25
37
|
* The NEXT key in the same grain: «2026-09» → «2026-10», «2026-Q4» → «2027-Q1»,
|
|
26
38
|
* «2026-W52» → the ISO week that follows. `null` if the key does not have the shape of its grain —
|
|
@@ -148,6 +148,56 @@ export function dateLabel(key, grain, within = []) {
|
|
|
148
148
|
...(said("year") ? {} : { year: "numeric" }),
|
|
149
149
|
}).format(when));
|
|
150
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* The SHORT label of a date key: what an axis writes under its tick — «ene», «T1», «18 nov».
|
|
153
|
+
*
|
|
154
|
+
* Context: the axis used to write «Enero de 2025» under each month. Twelve of those do not fit
|
|
155
|
+
* side by side, so the chart dropped whichever collided and the axis read «Enero, Marzo,
|
|
156
|
+
* Abril, Mayo, Julio» — uneven, as if months were missing. A tick only has to tell its
|
|
157
|
+
* neighbours apart; the full label stays in the tooltip. `withYear` is for an axis that
|
|
158
|
+
* crosses a new year: then «ene 26» beside «dic 25».
|
|
159
|
+
*/
|
|
160
|
+
export function dateTick(key, grain, withYear = false) {
|
|
161
|
+
const copy = currentCopy();
|
|
162
|
+
if (key === "")
|
|
163
|
+
return copy.time.noDate;
|
|
164
|
+
const parts = KEY_SHAPES[grain].exec(key);
|
|
165
|
+
if (parts === null)
|
|
166
|
+
return key;
|
|
167
|
+
const locale = currentCopyLocale();
|
|
168
|
+
const year = Number(parts[1]);
|
|
169
|
+
const short = pad(year % 100);
|
|
170
|
+
if (grain === "year")
|
|
171
|
+
return String(year);
|
|
172
|
+
if (grain === "quarter") {
|
|
173
|
+
const quarter = fillCopy(copy.calendar.quarter, { n: Number(parts[2]) });
|
|
174
|
+
return withYear ? `${quarter} ${short}` : quarter;
|
|
175
|
+
}
|
|
176
|
+
if (grain === "week") {
|
|
177
|
+
const week = fillCopy(copy.calendar.weekShort, { n: Number(parts[2]) });
|
|
178
|
+
return withYear ? `${week} ${short}` : week;
|
|
179
|
+
}
|
|
180
|
+
/* `Intl`'s short month carries a dot in Spanish («ene.»): under a tick it is noise. */
|
|
181
|
+
const bare = (text) => text.replace(".", "");
|
|
182
|
+
if (grain === "month") {
|
|
183
|
+
const month = bare(format(locale, { month: "short" }).format(new Date(year, Number(parts[2]) - 1, 1)));
|
|
184
|
+
return withYear ? `${month} ${short}` : month;
|
|
185
|
+
}
|
|
186
|
+
const day = Number(parts[3]);
|
|
187
|
+
const when = new Date(year, Number(parts[2]) - 1, day);
|
|
188
|
+
if (when.getDate() !== day)
|
|
189
|
+
return key;
|
|
190
|
+
return bare(format(locale, {
|
|
191
|
+
day: "numeric",
|
|
192
|
+
month: "short",
|
|
193
|
+
...(withYear ? { year: "2-digit" } : {}),
|
|
194
|
+
}).format(when));
|
|
195
|
+
}
|
|
196
|
+
/** The year a date key of `grain` falls in, or `null` if the key does not have its shape. */
|
|
197
|
+
export function dateKeyYear(key, grain) {
|
|
198
|
+
const parts = KEY_SHAPES[grain].exec(key);
|
|
199
|
+
return parts === null ? null : Number(parts[1]);
|
|
200
|
+
}
|
|
151
201
|
/**
|
|
152
202
|
* The NEXT key in the same grain: «2026-09» → «2026-10», «2026-Q4» → «2027-Q1»,
|
|
153
203
|
* «2026-W52» → the ISO week that follows. `null` if the key does not have the shape of its grain —
|
|
@@ -24,7 +24,10 @@ import { type Pivot, type PivotKey } from "./pivot.js";
|
|
|
24
24
|
* 3. **Colour follows the series, not its position.** The remaining series keep the
|
|
25
25
|
* pivot's order; sorting by size sorts the AXIS, never repaints.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
/** `area` is a line with its wash under it: one quantity over time read as an amount —memory
|
|
28
|
+
* in use, the stock on hand— where the filled area says «this much», and a bare line only
|
|
29
|
+
* says where it went. */
|
|
30
|
+
export type ChartKind = "bar" | "line" | "area" | "pie";
|
|
28
31
|
export type ChartOrder = "asc" | "desc";
|
|
29
32
|
/** The row count of each crossing, offered as one more measure: it is the only one that
|
|
30
33
|
* can always be answered. */
|
|
@@ -38,6 +41,9 @@ export type ChartPoint = {
|
|
|
38
41
|
/** `pathKey(key)`: the stable identity for React and for colour. */
|
|
39
42
|
id: string;
|
|
40
43
|
label: string;
|
|
44
|
+
/** What the axis writes under it when room is short: «ene» for «Enero de 2025». The
|
|
45
|
+
* tooltip keeps `label`. Absent, the axis writes the label. */
|
|
46
|
+
tick?: string;
|
|
41
47
|
/** The tail gathered into one: «otros (12)». Drawn quieter and does not open. */
|
|
42
48
|
rest?: boolean;
|
|
43
49
|
/** The previous period of a comparison: drawn quiet, behind the current one. */
|
|
@@ -47,6 +53,8 @@ export type ChartMeasure = {
|
|
|
47
53
|
id: string;
|
|
48
54
|
header: string;
|
|
49
55
|
format?: (value: number) => string;
|
|
56
|
+
/** The number where room is short: the axis ticks, a sparkline (`PivotMeasure.formatShort`). */
|
|
57
|
+
formatShort?: (value: number) => string;
|
|
50
58
|
additive: boolean;
|
|
51
59
|
};
|
|
52
60
|
export type ChartData = {
|
|
@@ -122,5 +130,6 @@ export declare function chartCompare(current: ChartData, previous: ChartData, la
|
|
|
122
130
|
export declare function chartFromRecord(entries: Readonly<Record<string, number | null>> | readonly (readonly [string, number | null])[], measure: {
|
|
123
131
|
header: string;
|
|
124
132
|
format?: (value: number) => string;
|
|
133
|
+
formatShort?: (value: number) => string;
|
|
125
134
|
additive?: boolean;
|
|
126
135
|
}): ChartData;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dateKeysBetween } from "./calendar.js";
|
|
1
|
+
import { dateKeysBetween, dateKeyYear, dateTick } from "./calendar.js";
|
|
2
2
|
import { currentCopy, fillCopy } from "./copy.js";
|
|
3
3
|
import { pathKey } from "./grouping.js";
|
|
4
4
|
import { axisLabels, } from "./pivot.js";
|
|
@@ -16,6 +16,7 @@ export function chartMeasures(pivot) {
|
|
|
16
16
|
id: one.id,
|
|
17
17
|
header: one.header,
|
|
18
18
|
...(one.format === undefined ? {} : { format: one.format }),
|
|
19
|
+
...(one.formatShort === undefined ? {} : { formatShort: one.formatShort }),
|
|
19
20
|
additive: one.additive === true,
|
|
20
21
|
})),
|
|
21
22
|
];
|
|
@@ -122,6 +123,20 @@ export function chartFromPivot(pivot, reading = {}) {
|
|
|
122
123
|
totals = filled.map((one) => one.total);
|
|
123
124
|
}
|
|
124
125
|
}
|
|
126
|
+
/* 0b · The ticks of a time axis: «ene» under the month, the full label in the tooltip. The
|
|
127
|
+
year joins the tick only when the axis crosses one. */
|
|
128
|
+
if (grain !== undefined) {
|
|
129
|
+
const years = new Set(categories
|
|
130
|
+
.map((point) => dateKeyYear(point.key[0] ?? "", grain))
|
|
131
|
+
.filter((year) => year !== null));
|
|
132
|
+
const withYear = years.size > 1;
|
|
133
|
+
categories = categories.map((point) => {
|
|
134
|
+
const key = point.key[0] ?? "";
|
|
135
|
+
return dateKeyYear(key, grain) === null
|
|
136
|
+
? point
|
|
137
|
+
: { ...point, tick: dateTick(key, grain, withYear) };
|
|
138
|
+
});
|
|
139
|
+
}
|
|
125
140
|
/* 1 · The series that do not fit in the palette. */
|
|
126
141
|
let hiddenSeries = 0;
|
|
127
142
|
const seriesTotals = series.map((column, at) => margin(pivot.columnTotal?.(column.key), values.map((row) => row[at] ?? null)));
|
|
@@ -287,6 +302,7 @@ export function chartFromRecord(entries, measure) {
|
|
|
287
302
|
id: "value",
|
|
288
303
|
header: measure.header,
|
|
289
304
|
...(measure.format === undefined ? {} : { format: measure.format }),
|
|
305
|
+
...(measure.formatShort === undefined ? {} : { formatShort: measure.formatShort }),
|
|
290
306
|
additive: measure.additive ?? true,
|
|
291
307
|
},
|
|
292
308
|
categoryTitle: "",
|
|
@@ -141,6 +141,11 @@ export type UiCopy = {
|
|
|
141
141
|
/** The word next to a required label. The asterisk is the mark; this is
|
|
142
142
|
* what a screen reader says, because a star is not a word. */
|
|
143
143
|
required: string;
|
|
144
|
+
/** Beside the label of a field that may stay empty, in the «settings» form style: there
|
|
145
|
+
* every row says what it asks, and the asterisk alone left the rest unsaid. */
|
|
146
|
+
optional: string;
|
|
147
|
+
/** The accessible name of the index of a form's sections («settings» style). */
|
|
148
|
+
sections: string;
|
|
144
149
|
/** The name of the button that opens a field's longer explanation. */
|
|
145
150
|
help: string;
|
|
146
151
|
/** What a field with no value says when it is read: an answer, not a blank. */
|
|
@@ -367,6 +372,15 @@ export type UiCopy = {
|
|
|
367
372
|
yesterday: string;
|
|
368
373
|
/** A filter that leaves nothing. */
|
|
369
374
|
emptyFilter: string;
|
|
375
|
+
/** A field an edit left (or found) empty: a word, because «—» beside an arrow reads as a
|
|
376
|
+
* dash somebody typed. */
|
|
377
|
+
empty: string;
|
|
378
|
+
/** Said before the old and the new value of a change, for a screen reader: the strike and
|
|
379
|
+
* the weight carry it on screen. */
|
|
380
|
+
before: string;
|
|
381
|
+
after: string;
|
|
382
|
+
/** An edit of many fields shows three; this opens the rest. `{count}` is all of them. */
|
|
383
|
+
allChanges: string;
|
|
370
384
|
/** A note in the timeline takes you to what it belongs to. `{owner}` is that field or
|
|
371
385
|
* line. */
|
|
372
386
|
goTo: string;
|
|
@@ -470,6 +484,8 @@ export type UiCopy = {
|
|
|
470
484
|
*/
|
|
471
485
|
calendar: {
|
|
472
486
|
week: string;
|
|
487
|
+
/** A week under a chart's tick, where «Semana 12» does not fit: «S12». */
|
|
488
|
+
weekShort: string;
|
|
473
489
|
weekOfYear: string;
|
|
474
490
|
quarter: string;
|
|
475
491
|
quarterOfYear: string;
|
|
@@ -702,6 +718,7 @@ export type UiCopy = {
|
|
|
702
718
|
kind: string;
|
|
703
719
|
bar: string;
|
|
704
720
|
line: string;
|
|
721
|
+
area: string;
|
|
705
722
|
pie: string;
|
|
706
723
|
measure: string;
|
|
707
724
|
categoriesAxis: string;
|
|
@@ -781,6 +798,9 @@ export type UiCopy = {
|
|
|
781
798
|
tileFailed: string;
|
|
782
799
|
/** The board's own reading (its headline numbers) failed. */
|
|
783
800
|
failed: string;
|
|
801
|
+
/** A stat tile whose figure has nothing to be computed from — no messages, so no share of
|
|
802
|
+
* clean ones. Said in words: «—» there reads as a broken tile. */
|
|
803
|
+
noData: string;
|
|
784
804
|
emptyLane: string;
|
|
785
805
|
moveHint: string;
|
|
786
806
|
moved: string;
|
|
@@ -121,6 +121,8 @@ export const SPANISH_COPY = {
|
|
|
121
121
|
fileUnreadable: "No pudimos leer el archivo",
|
|
122
122
|
tryAnother: "Probá con otro",
|
|
123
123
|
required: "obligatorio",
|
|
124
|
+
optional: "opcional",
|
|
125
|
+
sections: "Secciones del formulario",
|
|
124
126
|
help: "Ayuda",
|
|
125
127
|
unset: "sin definir",
|
|
126
128
|
none: "Ninguna",
|
|
@@ -271,6 +273,10 @@ export const SPANISH_COPY = {
|
|
|
271
273
|
today: "Hoy",
|
|
272
274
|
yesterday: "Ayer",
|
|
273
275
|
emptyFilter: "Todavía no hay nada de esto.",
|
|
276
|
+
empty: "vacío",
|
|
277
|
+
before: "antes:",
|
|
278
|
+
after: "ahora:",
|
|
279
|
+
allChanges: "Ver los {count} cambios",
|
|
274
280
|
goTo: "Ir a {owner}",
|
|
275
281
|
send: "Enviar",
|
|
276
282
|
sending: "Enviando…",
|
|
@@ -326,6 +332,7 @@ export const SPANISH_COPY = {
|
|
|
326
332
|
time: { justNow: "recién", invalid: "fecha inválida", noDate: "sin fecha" },
|
|
327
333
|
calendar: {
|
|
328
334
|
week: "Semana {n}",
|
|
335
|
+
weekShort: "S{n}",
|
|
329
336
|
weekOfYear: "Semana {n} de {year}",
|
|
330
337
|
quarter: "T{n}",
|
|
331
338
|
quarterOfYear: "T{n} de {year}",
|
|
@@ -472,6 +479,7 @@ export const SPANISH_COPY = {
|
|
|
472
479
|
kind: "Tipo de gráfico",
|
|
473
480
|
bar: "Barras",
|
|
474
481
|
line: "Líneas",
|
|
482
|
+
area: "Área",
|
|
475
483
|
pie: "Torta",
|
|
476
484
|
measure: "Medida",
|
|
477
485
|
categoriesAxis: "Eje",
|
|
@@ -526,6 +534,7 @@ export const SPANISH_COPY = {
|
|
|
526
534
|
board: {
|
|
527
535
|
tileFailed: "No se pudo leer «{title}»",
|
|
528
536
|
failed: "No se pudieron leer los números del tablero",
|
|
537
|
+
noData: "Sin datos",
|
|
529
538
|
emptyLane: "Nada en esta etapa.",
|
|
530
539
|
moveHint: "Arrastrala, o Alt + ← / → para pasarla a otra etapa",
|
|
531
540
|
moved: "{name} pasó a {column}",
|
package/dist/foundations/copy.js
CHANGED
|
@@ -97,6 +97,8 @@ export const ENGLISH_COPY = {
|
|
|
97
97
|
fileUnreadable: "We could not read the file",
|
|
98
98
|
tryAnother: "Try another one",
|
|
99
99
|
required: "required",
|
|
100
|
+
optional: "optional",
|
|
101
|
+
sections: "Sections of the form",
|
|
100
102
|
help: "Help",
|
|
101
103
|
unset: "not set",
|
|
102
104
|
none: "None",
|
|
@@ -219,6 +221,10 @@ export const ENGLISH_COPY = {
|
|
|
219
221
|
today: "Today",
|
|
220
222
|
yesterday: "Yesterday",
|
|
221
223
|
emptyFilter: "Nothing of this kind yet.",
|
|
224
|
+
empty: "empty",
|
|
225
|
+
before: "before:",
|
|
226
|
+
after: "now:",
|
|
227
|
+
allChanges: "See the {count} changes",
|
|
222
228
|
goTo: "Go to {owner}",
|
|
223
229
|
send: "Send",
|
|
224
230
|
sending: "Sending…",
|
|
@@ -303,6 +309,7 @@ export const ENGLISH_COPY = {
|
|
|
303
309
|
},
|
|
304
310
|
calendar: {
|
|
305
311
|
week: "Week {n}",
|
|
312
|
+
weekShort: "W{n}",
|
|
306
313
|
weekOfYear: "Week {n}, {year}",
|
|
307
314
|
quarter: "Q{n}",
|
|
308
315
|
quarterOfYear: "Q{n} {year}",
|
|
@@ -462,6 +469,7 @@ export const ENGLISH_COPY = {
|
|
|
462
469
|
kind: "Chart type",
|
|
463
470
|
bar: "Bars",
|
|
464
471
|
line: "Lines",
|
|
472
|
+
area: "Area",
|
|
465
473
|
pie: "Pie",
|
|
466
474
|
measure: "Measure",
|
|
467
475
|
categoriesAxis: "Axis",
|
|
@@ -516,6 +524,7 @@ export const ENGLISH_COPY = {
|
|
|
516
524
|
board: {
|
|
517
525
|
tileFailed: "«{title}» could not be read",
|
|
518
526
|
failed: "The board's numbers could not be read",
|
|
527
|
+
noData: "No data",
|
|
519
528
|
emptyLane: "Nothing in this stage.",
|
|
520
529
|
moveHint: "Drag it, or Alt + ← / → to move it to another stage",
|
|
521
530
|
moved: "{name} moved to {column}",
|
|
@@ -79,3 +79,9 @@ export declare function FormModeProvider({ value, children, }: {
|
|
|
79
79
|
/** The mode of this field. The prop beats the context — a computed field stays
|
|
80
80
|
* in read mode inside a form that is being edited. */
|
|
81
81
|
export declare function useFormMode(explicit?: FormMode): FormMode;
|
|
82
|
+
export type FormStyle = "dense" | "settings";
|
|
83
|
+
export declare function FormStyleProvider({ value, children, }: {
|
|
84
|
+
value: FormStyle;
|
|
85
|
+
children: ReactNode;
|
|
86
|
+
}): import("react").JSX.Element;
|
|
87
|
+
export declare function useFormStyle(): FormStyle;
|
package/dist/foundations/form.js
CHANGED
|
@@ -52,3 +52,10 @@ export function useFormMode(explicit) {
|
|
|
52
52
|
const inherited = useContext(Ctx);
|
|
53
53
|
return explicit ?? inherited;
|
|
54
54
|
}
|
|
55
|
+
const StyleCtx = createContext("dense");
|
|
56
|
+
export function FormStyleProvider({ value, children, }) {
|
|
57
|
+
return _jsx(StyleCtx.Provider, { value: value, children: children });
|
|
58
|
+
}
|
|
59
|
+
export function useFormStyle() {
|
|
60
|
+
return useContext(StyleCtx);
|
|
61
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { type CopyCatalog, type CopyOverride, createCopy, mergeCopyOver, } from "./catalog.js";
|
|
2
2
|
export { currentCopy, currentCopyLocale, ENGLISH_COPY, fillCopy, installCopy, mergeCopy, type UiCopy, type UiCopyOverride, UiCopyProvider, useUiCopy, } from "./copy.js";
|
|
3
3
|
export { byDensity, type Density, DensityProvider, useDensity, } from "./density.js";
|
|
4
|
-
export { controlName, FieldBoundary, type FieldIds, type FormMode, FormModeProvider, useFieldIds, useFormMode, } from "./form.js";
|
|
4
|
+
export { controlName, FieldBoundary, type FieldIds, type FormMode, FormModeProvider, type FormStyle, FormStyleProvider, useFieldIds, useFormMode, useFormStyle, } from "./form.js";
|
|
5
5
|
export { type KeyboardPlatform, type ModShortcut, modShortcut, useKeyboardPlatform, } from "./shortcut.js";
|
|
6
6
|
export { bySurface, SurfaceProvider, useSurface } from "./surface.js";
|
|
7
7
|
export { applyTheme, isTheme, type ResolvedTheme, resolveTheme, type Theme, THEME_ATTRIBUTE, ThemeProvider, type ThemeProviderProps, THEMES, useTheme, } from "./theme.js";
|
|
@@ -9,7 +9,7 @@ export type { OpenTarget, Size, Surface, Tone } from "./types.js";
|
|
|
9
9
|
/** The system's Spanish, for whoever wants to install it whole. */
|
|
10
10
|
export { SPANISH_COPY } from "./copy.es.js";
|
|
11
11
|
export { flatten, loose, pick, pickAll, propsOf, slot, slotOf, type Slotted, } from "./slots.js";
|
|
12
|
-
export { dateKey, dateKeysBetween, dateLabel, grainName, monthName, nextDateKey, } from "./calendar.js";
|
|
12
|
+
export { dateKey, dateKeysBetween, dateKeyYear, dateLabel, dateTick, grainName, monthName, nextDateKey, } from "./calendar.js";
|
|
13
13
|
export { GRAIN_ORDER, type GroupableField, type GroupGrain, type Grouping, type GroupLevel, itemPath, levelKey, moveLevel, normalizeLevels, pathKey, pathLabels, type Pile, pileCount, type PileFoot, pileFoot, pileIsOpen, pileItems, pileLabel, type PileLabelOf, type PileOf, pilesFrom, pilesOf, } from "./grouping.js";
|
|
14
14
|
export { axisLabels, axisSpans, keyStarts, type Pivot, type PivotAxis, type PivotCell, type PivotCrossing, type PivotFold, pivotFrom, pivotIsEmpty, type PivotKey, type PivotLevel, type PivotMargin, type PivotMeasure, pivotOf, type PivotSource, type PivotSpec, } from "./pivot.js";
|
|
15
15
|
export { chartCompare, type ChartData, chartFromPivot, chartFromRecord, type ChartKind, type ChartMeasure, chartMeasures, type ChartOrder, type ChartPoint, type ChartReading, COUNT_MEASURE, orderChart, SERIES_COLORS, } from "./chart.js";
|