@sincpro/web-ui 2.3.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 (70) hide show
  1. package/README.md +71 -6
  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/guide/Guide.d.ts +33 -0
  15. package/dist/components/guide/Guide.js +288 -0
  16. package/dist/components/guide/GuideSpot.d.ts +14 -0
  17. package/dist/components/guide/GuideSpot.js +13 -0
  18. package/dist/components/guide/index.d.ts +4 -0
  19. package/dist/components/guide/index.js +6 -0
  20. package/dist/components/guide/place.d.ts +44 -0
  21. package/dist/components/guide/place.js +69 -0
  22. package/dist/components/guide/target.d.ts +41 -0
  23. package/dist/components/guide/target.js +55 -0
  24. package/dist/components/index.d.ts +1 -0
  25. package/dist/components/index.js +1 -0
  26. package/dist/components/listing/ChartExplorer.js +10 -5
  27. package/dist/components/listing/Listing.js +7 -5
  28. package/dist/components/listing/Row.js +8 -7
  29. package/dist/components/navigation/NavigationTree.js +1 -1
  30. package/dist/components/record/DirtyActions.d.ts +19 -8
  31. package/dist/components/record/DirtyActions.js +89 -13
  32. package/dist/components/record/RecordHeader.js +17 -11
  33. package/dist/components/record/ThumbBar.js +2 -1
  34. package/dist/components/shell/SearchEntry.d.ts +29 -0
  35. package/dist/components/shell/SearchEntry.js +34 -0
  36. package/dist/components/shell/Sidebar.d.ts +5 -1
  37. package/dist/components/shell/Sidebar.js +4 -3
  38. package/dist/components/shell/TopBar.d.ts +5 -1
  39. package/dist/components/shell/TopBar.js +3 -2
  40. package/dist/components/shell/index.d.ts +1 -0
  41. package/dist/components/shell/index.js +3 -0
  42. package/dist/foundations/calendar.d.ts +12 -0
  43. package/dist/foundations/calendar.js +50 -0
  44. package/dist/foundations/chart.d.ts +10 -1
  45. package/dist/foundations/chart.js +17 -1
  46. package/dist/foundations/copy.d.ts +39 -2
  47. package/dist/foundations/copy.es.js +19 -0
  48. package/dist/foundations/copy.js +19 -0
  49. package/dist/foundations/form.d.ts +6 -0
  50. package/dist/foundations/form.js +7 -0
  51. package/dist/foundations/index.d.ts +3 -2
  52. package/dist/foundations/index.js +4 -2
  53. package/dist/foundations/pivot.d.ts +6 -0
  54. package/dist/foundations/pivot.js +1 -0
  55. package/dist/foundations/shortcut.d.ts +18 -0
  56. package/dist/foundations/shortcut.js +20 -0
  57. package/dist/primitives/chart/BarList.d.ts +30 -0
  58. package/dist/primitives/chart/BarList.js +27 -0
  59. package/dist/primitives/chart/Chart.d.ts +13 -0
  60. package/dist/primitives/chart/Chart.js +71 -19
  61. package/dist/primitives/chart/Sparkline.d.ts +30 -0
  62. package/dist/primitives/chart/Sparkline.js +53 -0
  63. package/dist/primitives/chart/index.d.ts +2 -0
  64. package/dist/primitives/chart/index.js +2 -0
  65. package/dist/primitives/field/Field.d.ts +6 -2
  66. package/dist/primitives/field/Field.js +35 -6
  67. package/dist/primitives/value/Metric.d.ts +12 -1
  68. package/dist/primitives/value/Metric.js +9 -4
  69. package/dist/tokens.css +92 -22
  70. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  export { AppFrame } from "./AppFrame.js";
2
2
  export { type BrandLogo } from "./brandMark.js";
3
3
  export { Sidebar, type SidebarAction, type SidebarProps, } from "./Sidebar.js";
4
+ export { SearchEntry, type SearchEntryProps, } from "./SearchEntry.js";
4
5
  export { type SidebarDrawer, SidebarToggle, useSidebarDrawer, } from "./sidebarDrawer.js";
5
6
  export { type AppEntry, SystrayButton, TopBar, type TopMenu, } from "./TopBar.js";
6
7
  export { Pane, Panes } from "./Panes.js";
@@ -4,6 +4,9 @@ export { AppFrame } from "./AppFrame.js";
4
4
  export {} from "./brandMark.js";
5
5
  /* The whole chrome in one column, for a back office with no bar on top. */
6
6
  export { Sidebar, } from "./Sidebar.js";
7
+ /* The way into the application's palette, drawn: «Buscar… ⌘K». The sidebar and the bar draw
8
+ it from their `search`; on its own, for any other place. */
9
+ export { SearchEntry, } from "./SearchEntry.js";
7
10
  /* The sidebar's phone drawer, for a bar an application writes itself. */
8
11
  export { SidebarToggle, useSidebarDrawer, } from "./sidebarDrawer.js";
9
12
  export { SystrayButton, TopBar, } from "./TopBar.js";
@@ -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
- export type ChartKind = "bar" | "line" | "pie";
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: "",
@@ -68,9 +68,10 @@ export type UiCopy = {
68
68
  location: string;
69
69
  status: string;
70
70
  faces: string;
71
- /** The mark of a record with changes that are not saved yet. */
71
+ /** @deprecated Not drawn since 2.4: the Save and Discard buttons already say it. Kept so
72
+ * a copy table written for an earlier version still type-checks. */
72
73
  unsaved: string;
73
- /** The same mark when the record says how many fields changed. */
74
+ /** How many fields changed — the Save button's description, for a screen reader. */
74
75
  unsavedOne: string;
75
76
  unsavedMany: string;
76
77
  save: string;
@@ -108,6 +109,22 @@ export type UiCopy = {
108
109
  openNavigation: string;
109
110
  /** The drawer's name: what a screen reader hears when it opens. */
110
111
  navigation: string;
112
+ /** The way into the application's palette, in the sidebar or the bar. */
113
+ search: string;
114
+ };
115
+ /** A guided tour (`Guide`). */
116
+ guide: {
117
+ /** The tour's name when the application gives none. */
118
+ label: string;
119
+ /** «2 de 5»: `{current}` and `{total}`. */
120
+ progress: string;
121
+ /** What a screen reader hears on each step: `{progress}` and `{title}`. */
122
+ step: string;
123
+ next: string;
124
+ back: string;
125
+ skip: string;
126
+ /** The last step's button, in place of «next». */
127
+ finish: string;
111
128
  };
112
129
  field: {
113
130
  drop: string;
@@ -124,6 +141,11 @@ export type UiCopy = {
124
141
  /** The word next to a required label. The asterisk is the mark; this is
125
142
  * what a screen reader says, because a star is not a word. */
126
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;
127
149
  /** The name of the button that opens a field's longer explanation. */
128
150
  help: string;
129
151
  /** What a field with no value says when it is read: an answer, not a blank. */
@@ -350,6 +372,15 @@ export type UiCopy = {
350
372
  yesterday: string;
351
373
  /** A filter that leaves nothing. */
352
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;
353
384
  /** A note in the timeline takes you to what it belongs to. `{owner}` is that field or
354
385
  * line. */
355
386
  goTo: string;
@@ -453,6 +484,8 @@ export type UiCopy = {
453
484
  */
454
485
  calendar: {
455
486
  week: string;
487
+ /** A week under a chart's tick, where «Semana 12» does not fit: «S12». */
488
+ weekShort: string;
456
489
  weekOfYear: string;
457
490
  quarter: string;
458
491
  quarterOfYear: string;
@@ -685,6 +718,7 @@ export type UiCopy = {
685
718
  kind: string;
686
719
  bar: string;
687
720
  line: string;
721
+ area: string;
688
722
  pie: string;
689
723
  measure: string;
690
724
  categoriesAxis: string;
@@ -764,6 +798,9 @@ export type UiCopy = {
764
798
  tileFailed: string;
765
799
  /** The board's own reading (its headline numbers) failed. */
766
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;
767
804
  emptyLane: string;
768
805
  moveHint: string;
769
806
  moved: string;
@@ -99,6 +99,16 @@ export const SPANISH_COPY = {
99
99
  openAsPanel: "Abrir como panel",
100
100
  openNavigation: "Abrir la navegación",
101
101
  navigation: "Navegación",
102
+ search: "Buscar…",
103
+ },
104
+ guide: {
105
+ label: "Recorrido",
106
+ progress: "{current} de {total}",
107
+ step: "{progress}: {title}",
108
+ next: "Siguiente",
109
+ back: "Atrás",
110
+ skip: "Saltar el recorrido",
111
+ finish: "Terminar",
102
112
  },
103
113
  field: {
104
114
  drop: "Soltá un archivo acá, o elegí uno.",
@@ -111,6 +121,8 @@ export const SPANISH_COPY = {
111
121
  fileUnreadable: "No pudimos leer el archivo",
112
122
  tryAnother: "Probá con otro",
113
123
  required: "obligatorio",
124
+ optional: "opcional",
125
+ sections: "Secciones del formulario",
114
126
  help: "Ayuda",
115
127
  unset: "sin definir",
116
128
  none: "Ninguna",
@@ -261,6 +273,10 @@ export const SPANISH_COPY = {
261
273
  today: "Hoy",
262
274
  yesterday: "Ayer",
263
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",
264
280
  goTo: "Ir a {owner}",
265
281
  send: "Enviar",
266
282
  sending: "Enviando…",
@@ -316,6 +332,7 @@ export const SPANISH_COPY = {
316
332
  time: { justNow: "recién", invalid: "fecha inválida", noDate: "sin fecha" },
317
333
  calendar: {
318
334
  week: "Semana {n}",
335
+ weekShort: "S{n}",
319
336
  weekOfYear: "Semana {n} de {year}",
320
337
  quarter: "T{n}",
321
338
  quarterOfYear: "T{n} de {year}",
@@ -462,6 +479,7 @@ export const SPANISH_COPY = {
462
479
  kind: "Tipo de gráfico",
463
480
  bar: "Barras",
464
481
  line: "Líneas",
482
+ area: "Área",
465
483
  pie: "Torta",
466
484
  measure: "Medida",
467
485
  categoriesAxis: "Eje",
@@ -516,6 +534,7 @@ export const SPANISH_COPY = {
516
534
  board: {
517
535
  tileFailed: "No se pudo leer «{title}»",
518
536
  failed: "No se pudieron leer los números del tablero",
537
+ noData: "Sin datos",
519
538
  emptyLane: "Nada en esta etapa.",
520
539
  moveHint: "Arrastrala, o Alt + ← / → para pasarla a otra etapa",
521
540
  moved: "{name} pasó a {column}",
@@ -75,6 +75,16 @@ export const ENGLISH_COPY = {
75
75
  openAsPanel: "Open as panel",
76
76
  openNavigation: "Open the navigation",
77
77
  navigation: "Navigation",
78
+ search: "Search…",
79
+ },
80
+ guide: {
81
+ label: "Guided tour",
82
+ progress: "{current} of {total}",
83
+ step: "{progress}: {title}",
84
+ next: "Next",
85
+ back: "Back",
86
+ skip: "Skip the tour",
87
+ finish: "Done",
78
88
  },
79
89
  field: {
80
90
  drop: "Drop a file here, or choose one.",
@@ -87,6 +97,8 @@ export const ENGLISH_COPY = {
87
97
  fileUnreadable: "We could not read the file",
88
98
  tryAnother: "Try another one",
89
99
  required: "required",
100
+ optional: "optional",
101
+ sections: "Sections of the form",
90
102
  help: "Help",
91
103
  unset: "not set",
92
104
  none: "None",
@@ -209,6 +221,10 @@ export const ENGLISH_COPY = {
209
221
  today: "Today",
210
222
  yesterday: "Yesterday",
211
223
  emptyFilter: "Nothing of this kind yet.",
224
+ empty: "empty",
225
+ before: "before:",
226
+ after: "now:",
227
+ allChanges: "See the {count} changes",
212
228
  goTo: "Go to {owner}",
213
229
  send: "Send",
214
230
  sending: "Sending…",
@@ -293,6 +309,7 @@ export const ENGLISH_COPY = {
293
309
  },
294
310
  calendar: {
295
311
  week: "Week {n}",
312
+ weekShort: "W{n}",
296
313
  weekOfYear: "Week {n}, {year}",
297
314
  quarter: "Q{n}",
298
315
  quarterOfYear: "Q{n} {year}",
@@ -452,6 +469,7 @@ export const ENGLISH_COPY = {
452
469
  kind: "Chart type",
453
470
  bar: "Bars",
454
471
  line: "Lines",
472
+ area: "Area",
455
473
  pie: "Pie",
456
474
  measure: "Measure",
457
475
  categoriesAxis: "Axis",
@@ -506,6 +524,7 @@ export const ENGLISH_COPY = {
506
524
  board: {
507
525
  tileFailed: "«{title}» could not be read",
508
526
  failed: "The board's numbers could not be read",
527
+ noData: "No data",
509
528
  emptyLane: "Nothing in this stage.",
510
529
  moveHint: "Drag it, or Alt + ← / → to move it to another stage",
511
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;
@@ -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,14 +1,15 @@
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
+ export { type KeyboardPlatform, type ModShortcut, modShortcut, useKeyboardPlatform, } from "./shortcut.js";
5
6
  export { bySurface, SurfaceProvider, useSurface } from "./surface.js";
6
7
  export { applyTheme, isTheme, type ResolvedTheme, resolveTheme, type Theme, THEME_ATTRIBUTE, ThemeProvider, type ThemeProviderProps, THEMES, useTheme, } from "./theme.js";
7
8
  export type { OpenTarget, Size, Surface, Tone } from "./types.js";
8
9
  /** The system's Spanish, for whoever wants to install it whole. */
9
10
  export { SPANISH_COPY } from "./copy.es.js";
10
11
  export { flatten, loose, pick, pickAll, propsOf, slot, slotOf, type Slotted, } from "./slots.js";
11
- export { dateKey, dateKeysBetween, dateLabel, grainName, monthName, nextDateKey, } from "./calendar.js";
12
+ export { dateKey, dateKeysBetween, dateKeyYear, dateLabel, dateTick, grainName, monthName, nextDateKey, } from "./calendar.js";
12
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";
13
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";
14
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";
@@ -5,7 +5,9 @@ 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
+ /* A SHORTCUT, drawn the way the person's keyboard says it: «⌘K» on a Mac, «Ctrl K» elsewhere. */
10
+ export { modShortcut, useKeyboardPlatform, } from "./shortcut.js";
9
11
  /* THE THEME — light, dark or the operating system's. The palettes live in `tokens.css`; this
10
12
  only writes `data-theme`. */
11
13
  export { bySurface, SurfaceProvider, useSurface } from "./surface.js";
@@ -19,7 +21,7 @@ export { flatten, loose, pick, pickAll, propsOf, slot, slotOf, } from "./slots.j
19
21
  /* THE CALENDAR — from a date to a key and from a key to a label. The months
20
22
  and the days of the week are said by `Intl` with the copy's `locale`; the week
21
23
  and the quarter are the only two words that have to be written. */
22
- export { dateKey, dateKeysBetween, dateLabel, grainName, monthName, nextDateKey, } from "./calendar.js";
24
+ export { dateKey, dateKeysBetween, dateKeyYear, dateLabel, dateTick, grainName, monthName, nextDateKey, } from "./calendar.js";
23
25
  /* THE GROUPING — the vocabulary, which both layers speak: the list builds the
24
26
  tree of buckets and the table draws it. It lives here and not in `contexts/list`
25
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,18 @@
1
+ /**
2
+ * Context: a shortcut is drawn the way the person's keyboard says it — «⌘K» on a Mac, «Ctrl K»
3
+ * everywhere else. A «Ctrl K» on a Mac is a shortcut that does not work, and people stop
4
+ * reading the others. Only the browser knows the platform: on the server and while hydrating
5
+ * it is `null`, and the shortcut appears right after instead of being drawn wrong and
6
+ * corrected in front of the person.
7
+ */
8
+ export type KeyboardPlatform = "apple" | "other";
9
+ /** The keyboard the page is being used with; `null` on the server and while hydrating. */
10
+ export declare function useKeyboardPlatform(): KeyboardPlatform | null;
11
+ export type ModShortcut = {
12
+ /** What is drawn: «⌘K», «Ctrl K». */
13
+ label: string;
14
+ /** For `aria-keyshortcuts`: «Meta+K», «Control+K». */
15
+ aria: string;
16
+ };
17
+ /** The platform's command key with `key`: ⌘ on a Mac, Ctrl elsewhere. */
18
+ export declare function modShortcut(key: string, platform: KeyboardPlatform): ModShortcut;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { useSyncExternalStore } from "react";
3
+ function readPlatform() {
4
+ const nav = navigator;
5
+ /* `userAgentData` where there is one (Chromium); `platform` is deprecated but it is the
6
+ only answer Safari and Firefox give. */
7
+ const name = nav.userAgentData?.platform ?? nav.platform;
8
+ return /mac|iphone|ipad|ipod/i.test(name) ? "apple" : "other";
9
+ }
10
+ const unchanging = () => () => { };
11
+ /** The keyboard the page is being used with; `null` on the server and while hydrating. */
12
+ export function useKeyboardPlatform() {
13
+ return useSyncExternalStore(unchanging, readPlatform, () => null);
14
+ }
15
+ /** The platform's command key with `key`: ⌘ on a Mac, Ctrl elsewhere. */
16
+ export function modShortcut(key, platform) {
17
+ return platform === "apple"
18
+ ? { label: `⌘${key}`, aria: `Meta+${key}` }
19
+ : { label: `Ctrl ${key}`, aria: `Control+${key}` };
20
+ }
@@ -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
  */