@sincpro/web-ui 2.0.0 → 2.2.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 (143) hide show
  1. package/README.md +45 -0
  2. package/dist/components/activity/Activity.d.ts +13 -14
  3. package/dist/components/activity/Activity.js +1 -1
  4. package/dist/components/activity/Messages.d.ts +5 -5
  5. package/dist/components/activity/Messages.js +8 -8
  6. package/dist/components/attachments/Attachments.d.ts +7 -1
  7. package/dist/components/attachments/Attachments.js +8 -2
  8. package/dist/components/board/Board.d.ts +32 -2
  9. package/dist/components/board/Board.js +27 -4
  10. package/dist/components/board/index.d.ts +1 -1
  11. package/dist/components/board/index.js +2 -1
  12. package/dist/components/form/Form.js +6 -6
  13. package/dist/components/form/index.js +2 -2
  14. package/dist/components/frame/FrameView.d.ts +5 -5
  15. package/dist/components/frame/FrameView.js +4 -4
  16. package/dist/components/listing/GroupingLevels.d.ts +22 -22
  17. package/dist/components/listing/GroupingLevels.js +9 -9
  18. package/dist/components/listing/Listing.d.ts +11 -11
  19. package/dist/components/listing/Listing.js +11 -11
  20. package/dist/components/listing/ListingBar.js +11 -11
  21. package/dist/components/listing/Row.d.ts +19 -19
  22. package/dist/components/listing/Row.js +27 -27
  23. package/dist/components/listing/SortMenu.d.ts +36 -36
  24. package/dist/components/listing/SortMenu.js +6 -6
  25. package/dist/components/listing/grouping.d.ts +16 -16
  26. package/dist/components/listing/grouping.js +6 -6
  27. package/dist/components/listing/index.js +1 -1
  28. package/dist/components/listing/modelColumns.d.ts +25 -25
  29. package/dist/components/listing/modelColumns.js +24 -24
  30. package/dist/components/listing/pages.js +4 -4
  31. package/dist/components/listing/set.d.ts +18 -18
  32. package/dist/components/navigation/NavigationTree.js +2 -2
  33. package/dist/components/navigation/index.js +2 -2
  34. package/dist/components/record/RecordSkeleton.js +7 -7
  35. package/dist/components/search/CriteriaBuilder.d.ts +22 -22
  36. package/dist/components/search/CriteriaBuilder.js +31 -31
  37. package/dist/components/search/CriteriaChips.d.ts +9 -9
  38. package/dist/components/search/CriteriaChips.js +12 -12
  39. package/dist/components/search/FilterBuilder.d.ts +67 -67
  40. package/dist/components/search/FilterBuilder.js +104 -104
  41. package/dist/components/search/JoinWord.d.ts +1 -1
  42. package/dist/components/search/JoinWord.js +14 -14
  43. package/dist/components/search/JsonEditor.d.ts +8 -8
  44. package/dist/components/search/JsonEditor.js +16 -16
  45. package/dist/components/search/SearchBar.d.ts +34 -34
  46. package/dist/components/search/SearchBar.js +140 -117
  47. package/dist/components/search/criteria.d.ts +61 -61
  48. package/dist/components/search/criteria.js +39 -39
  49. package/dist/components/search/datePeriods.d.ts +47 -48
  50. package/dist/components/search/datePeriods.js +29 -29
  51. package/dist/components/search/dateRanges.d.ts +27 -27
  52. package/dist/components/search/dateRanges.js +16 -16
  53. package/dist/components/search/index.js +13 -13
  54. package/dist/components/search/model.d.ts +28 -28
  55. package/dist/components/search/model.js +21 -21
  56. package/dist/components/search/query.d.ts +71 -71
  57. package/dist/components/search/query.js +119 -119
  58. package/dist/components/shell/AppFrame.d.ts +9 -2
  59. package/dist/components/shell/AppFrame.js +102 -14
  60. package/dist/components/shell/Sidebar.d.ts +34 -0
  61. package/dist/components/shell/Sidebar.js +32 -0
  62. package/dist/components/shell/TopBar.d.ts +2 -0
  63. package/dist/components/shell/TopBar.js +13 -9
  64. package/dist/components/shell/index.d.ts +2 -0
  65. package/dist/components/shell/index.js +5 -1
  66. package/dist/components/shell/sidebarDrawer.d.ts +26 -0
  67. package/dist/components/shell/sidebarDrawer.js +22 -0
  68. package/dist/foundations/calendar.d.ts +27 -27
  69. package/dist/foundations/calendar.js +72 -72
  70. package/dist/foundations/chart.d.ts +57 -57
  71. package/dist/foundations/chart.js +27 -27
  72. package/dist/foundations/copy.d.ts +109 -94
  73. package/dist/foundations/copy.es.js +10 -2
  74. package/dist/foundations/copy.js +10 -2
  75. package/dist/foundations/grouping.d.ts +175 -175
  76. package/dist/foundations/grouping.js +0 -0
  77. package/dist/foundations/index.d.ts +1 -1
  78. package/dist/foundations/index.js +21 -21
  79. package/dist/foundations/pivot.d.ts +133 -131
  80. package/dist/foundations/pivot.js +54 -54
  81. package/dist/foundations/pivotSheet.d.ts +36 -36
  82. package/dist/foundations/pivotSheet.js +0 -0
  83. package/dist/foundations/slots.d.ts +38 -38
  84. package/dist/foundations/slots.js +18 -18
  85. package/dist/foundations/sticky.d.ts +28 -28
  86. package/dist/foundations/sticky.js +59 -59
  87. package/dist/foundations/xlsx.d.ts +47 -47
  88. package/dist/foundations/xlsx.js +0 -0
  89. package/dist/primitives/block/Line.d.ts +4 -4
  90. package/dist/primitives/block/Line.js +28 -28
  91. package/dist/primitives/block/index.js +2 -2
  92. package/dist/primitives/cell/index.js +2 -2
  93. package/dist/primitives/choice/index.js +3 -3
  94. package/dist/primitives/date/Calendar.d.ts +7 -1
  95. package/dist/primitives/date/Calendar.js +13 -3
  96. package/dist/primitives/date/DatePicker.d.ts +4 -1
  97. package/dist/primitives/date/DatePicker.js +2 -2
  98. package/dist/primitives/date/index.js +3 -3
  99. package/dist/primitives/disclosure/index.js +1 -1
  100. package/dist/primitives/field/DropZone.d.ts +22 -3
  101. package/dist/primitives/field/DropZone.js +33 -12
  102. package/dist/primitives/menu/Menu.d.ts +10 -6
  103. package/dist/primitives/menu/Menu.js +4 -3
  104. package/dist/primitives/notice/Callout.d.ts +30 -30
  105. package/dist/primitives/notice/Callout.js +6 -6
  106. package/dist/primitives/overlay/index.js +3 -3
  107. package/dist/primitives/picker/Picker.d.ts +6 -0
  108. package/dist/primitives/picker/Picker.js +27 -4
  109. package/dist/primitives/picker/index.js +2 -2
  110. package/dist/primitives/table/DataTable.d.ts +32 -32
  111. package/dist/primitives/table/DataTable.js +24 -24
  112. package/dist/primitives/table/EditableTable.d.ts +10 -10
  113. package/dist/primitives/table/EditableTable.js +9 -9
  114. package/dist/primitives/table/ReportTable.js +7 -7
  115. package/dist/primitives/table/SheetTable.d.ts +13 -13
  116. package/dist/primitives/table/SheetTable.js +14 -14
  117. package/dist/primitives/table/Table.js +8 -8
  118. package/dist/primitives/tabs/Tabs.d.ts +46 -46
  119. package/dist/primitives/tabs/Tabs.js +4 -30
  120. package/dist/primitives/tag/Count.d.ts +23 -0
  121. package/dist/primitives/tag/Count.js +59 -0
  122. package/dist/primitives/tag/index.d.ts +1 -0
  123. package/dist/primitives/tag/index.js +5 -2
  124. package/dist/primitives/toolbar/index.js +1 -1
  125. package/dist/primitives/value/Copyable.d.ts +22 -22
  126. package/dist/primitives/value/Copyable.js +9 -9
  127. package/dist/primitives/value/Metric.d.ts +7 -2
  128. package/dist/primitives/value/Metric.js +12 -4
  129. package/dist/tokens.css +164 -57
  130. package/dist/views/list/List.d.ts +36 -36
  131. package/dist/views/list/List.js +19 -19
  132. package/dist/views/list/ListView.js +74 -74
  133. package/dist/views/list/columns.d.ts +10 -10
  134. package/dist/views/list/columns.js +10 -10
  135. package/dist/views/list/derive.d.ts +30 -30
  136. package/dist/views/list/derive.js +49 -49
  137. package/dist/views/list/index.js +2 -2
  138. package/dist/views/list/presentations.js +3 -3
  139. package/dist/views/list/types.d.ts +109 -109
  140. package/dist/views/record/Record.d.ts +14 -14
  141. package/dist/views/record/Record.js +24 -24
  142. package/dist/views/record/index.js +1 -1
  143. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useUiCopy } from "../../foundations/copy.js";
4
+ import { useSurface } from "../../foundations/surface.js";
5
+ import { useMemo } from "react";
6
+ /* Static and in a table: Tailwind cannot compose `bg-${tone}/12`. The gold is never text on
7
+ the canvas (2.43:1), so there its count is ink on a gold wash — the same rule as `Tag`. */
8
+ const SOFT = {
9
+ neutral: { canvas: "bg-ink/8 text-muted", chrome: "bg-chrome-ink/10 text-chrome-muted" },
10
+ info: { canvas: "bg-info/12 text-info", chrome: "bg-chrome-link/15 text-chrome-link" },
11
+ good: { canvas: "bg-good/12 text-good", chrome: "bg-chrome-good/15 text-chrome-good" },
12
+ warn: { canvas: "bg-warn/14 text-warn", chrome: "bg-chrome-warn/15 text-chrome-warn" },
13
+ bad: { canvas: "bg-bad/12 text-bad", chrome: "bg-chrome-bad/15 text-chrome-bad" },
14
+ accent: {
15
+ canvas: "bg-accent/20 text-ink",
16
+ chrome: "bg-chrome-accent/15 text-chrome-accent",
17
+ },
18
+ };
19
+ const SOLID = {
20
+ neutral: { canvas: "bg-ink text-surface", chrome: "bg-chrome-ink text-chrome" },
21
+ info: { canvas: "bg-info text-surface", chrome: "bg-chrome-link text-chrome" },
22
+ good: { canvas: "bg-good text-surface", chrome: "bg-chrome-good text-chrome" },
23
+ warn: { canvas: "bg-warn text-surface", chrome: "bg-chrome-warn text-chrome" },
24
+ bad: { canvas: "bg-bad text-surface", chrome: "bg-chrome-bad text-chrome" },
25
+ accent: { canvas: "bg-accent text-on-accent", chrome: "bg-chrome-accent text-chrome" },
26
+ };
27
+ const DOT = {
28
+ neutral: { canvas: "bg-muted", chrome: "bg-chrome-muted" },
29
+ info: { canvas: "bg-info", chrome: "bg-chrome-link" },
30
+ good: { canvas: "bg-good", chrome: "bg-chrome-good" },
31
+ warn: { canvas: "bg-warn", chrome: "bg-chrome-warn" },
32
+ bad: { canvas: "bg-bad", chrome: "bg-chrome-bad" },
33
+ accent: { canvas: "bg-accent", chrome: "bg-chrome-accent" },
34
+ };
35
+ /** The text of a count: formatted for the locale, and «99+» past `max`. Exported for the
36
+ * hosts that also need it in words — a button's `aria-label`, a `title`. */
37
+ export function countText(value, format, max) {
38
+ return max !== undefined && value > max ? `${format(max)}+` : format(value);
39
+ }
40
+ function skinOf(tone, surface, { solid, current, zero }) {
41
+ if (solid)
42
+ return SOLID[tone][surface];
43
+ if (zero)
44
+ return surface === "chrome" ? "bg-chrome-ink/6 text-chrome-muted" : "bg-ink/5 text-muted";
45
+ if (current && tone === "neutral")
46
+ return "bg-current/12 text-current";
47
+ return SOFT[tone][surface];
48
+ }
49
+ export function Count({ value, tone = "neutral", solid = false, max, showZero = false, current = false, surface, "aria-hidden": hidden, }) {
50
+ const copy = useUiCopy();
51
+ const sup = useSurface(surface);
52
+ const number = useMemo(() => new Intl.NumberFormat(copy.locale), [copy.locale]);
53
+ if (value === undefined) {
54
+ return (_jsx("span", { "data-count": "dot", className: `inline-block size-1.5 shrink-0 rounded-pill ${DOT[tone][sup]}`, "aria-hidden": true }));
55
+ }
56
+ if (value <= 0 && !showZero)
57
+ return null;
58
+ return (_jsx("span", { "data-count": value, ...(hidden === true ? { "aria-hidden": true } : {}), className: `inline-flex min-w-4 shrink-0 items-center justify-center rounded-pill text-micro tabular-nums ${solid ? "px-1 leading-none font-semibold" : "px-1.5 leading-normal font-medium"} ${skinOf(tone, sup, { solid, current, zero: value <= 0 })}`, children: countText(value, number.format, max) }));
59
+ }
@@ -1,2 +1,3 @@
1
1
  export { StatusDot, Tag } from "./Tag.js";
2
+ export { Count, type CountProps, countText } from "./Count.js";
2
3
  export { type TagItem, Tags } from "./Tags.js";
@@ -1,5 +1,8 @@
1
1
  /* Saying a state without writing a sentence: the capsule and the dot. */
2
2
  export { StatusDot, Tag } from "./Tag.js";
3
- /* La tira de fichas: la misma en la barra, en el desplegable y en cualquier
4
- lugar donde se dibuje una lista de palabras cortas. */
3
+ /* How many things are behind something, or that something asks for: one counter for the
4
+ sidebar, the tabs, the systray, a menu and an application's own button. */
5
+ export { Count, countText } from "./Count.js";
6
+ /* The strip of chips: the same in the bar, in the dropdown and anywhere
7
+ a list of short words is drawn. */
5
8
  export { Tags } from "./Tags.js";
@@ -1,2 +1,2 @@
1
- /* LA BARRA DE HERRAMIENTAS — un grupo de controles que se recorre con las flechas. */
1
+ /* THE TOOLBAR — a group of controls walked with the arrow keys. */
2
2
  export { Toolbar, ToolbarSeparator } from "./Toolbar.js";
@@ -1,37 +1,37 @@
1
1
  import { type ReactNode } from "react";
2
2
  /**
3
- * UN VALOR QUE SE COPIA.
3
+ * A VALUE THAT GETS COPIED.
4
4
  *
5
- * Context: la mitad de los valores de este producto existen para pegarse en otro
6
- * lado —un NIT, un CUF de factura, una referencia bancaria, un código de
7
- * autorización de 26 caracteres—. Seleccionarlos a mano falla justo con los que
8
- * más importa no equivocar: son largos, van en monoespaciada y se cortan.
5
+ * Context: half the values in this product exist to be pasted somewhere
6
+ * else —a tax ID, an invoice CUF, a bank reference, a 26-character
7
+ * authorisation code—. Selecting them by hand fails precisely with the ones
8
+ * where it matters most not to make a mistake: they are long, monospaced and get cut off.
9
9
  *
10
- * ── Confirma, y por eso el estado vive acá ──────────────────────────
10
+ * ── It confirms, and that is why the state lives here ───────────────
11
11
  *
12
- * Copiar no tiene efecto visible: el portapapeles está afuera de la pantalla. Un
13
- * botón que no contesta se aprieta tres veces «por las dudas». Por eso el ícono
14
- * pasa a un tilde por dos segundos — lo mínimo para creerle sin quedarse
15
- * mirando.
12
+ * Copying has no visible effect: the clipboard is off the screen. A
13
+ * button that does not answer gets pressed three times «just in case». That is why the icon
14
+ * turns into a tick for two seconds — the minimum to believe it without staying
15
+ * to watch.
16
16
  *
17
- * ── Y puede fallar ──────────────────────────────────────────────────
17
+ * ── And it can fail ─────────────────────────────────────────────────
18
18
  *
19
- * `navigator.clipboard` no existe fuera de un contexto seguro, y en algunos
20
- * navegadores exige un permiso que se puede negar. Se contempla: si falla, el
21
- * botón lo dice en vez de fingir que copió. Una confirmación falsa es peor que
22
- * ninguna, porque alguien pega lo que tenía antes y no se entera.
19
+ * `navigator.clipboard` does not exist outside a secure context, and in some
20
+ * browsers it demands a permission that can be denied. That is handled: if it fails, the
21
+ * button says so instead of pretending it copied. A false confirmation is worse than
22
+ * none, because someone pastes what they had before and never finds out.
23
23
  */
24
24
  export type CopyableProps = {
25
- /** Lo que se copia. Siempre texto: el portapapeles no tiene tipos. */
25
+ /** What is copied. Always text: the clipboard has no types. */
26
26
  value: string;
27
- /** Cómo se ve, si no es el valor tal cual. Un fingerprint se muestra cortado y
28
- * se copia entero, que es justamente por qué las dos cosas son props
29
- * distintas. */
27
+ /** How it looks, if it is not the value as is. A fingerprint is shown cut off and
28
+ * copied whole, which is precisely why the two things are different
29
+ * props. */
30
30
  children?: ReactNode;
31
- /** El valor es de máquina: id, hash, clave. Sin esto, tipografía normal. */
31
+ /** The value is a machine's: id, hash, key. Without this, normal typography. */
32
32
  mono?: boolean;
33
- /** Sólo el botón, sin el valor al lado. Para una celda o un encabezado donde
34
- * el valor ya está dibujado. */
33
+ /** Only the button, without the value beside it. For a cell or a header where
34
+ * the value is already drawn. */
35
35
  bare?: boolean;
36
36
  };
37
37
  /**
@@ -3,8 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useUiCopy } from "../../foundations/copy.js";
4
4
  import { Check, Copy } from "lucide-react";
5
5
  import { useEffect, useRef, useState } from "react";
6
- /** Cuánto dura el tilde. Dos segundos: alcanza para verlo sin que el botón se
7
- * quede en un estado que ya no es cierto. */
6
+ /** How long the tick lasts. Two seconds: enough to see it without the button
7
+ * staying in a state that is no longer true. */
8
8
  const CONFIRMED_FOR = 2000;
9
9
  /**
10
10
  * The button alone, for a value that is only known when it is pressed — what a field shows
@@ -15,8 +15,8 @@ export function CopyButton({ value, label, }) {
15
15
  const copy = useUiCopy();
16
16
  const [state, setState] = useState("idle");
17
17
  const timer = useRef(null);
18
- /* Se limpia al desmontar: sin esto, copiar y cerrar el panel antes de los dos
19
- segundos deja un `setState` apuntando a un componente que ya no existe. */
18
+ /* Cleared on unmount: without this, copying and closing the panel before the two
19
+ seconds leaves a `setState` pointing at a component that no longer exists. */
20
20
  useEffect(() => () => {
21
21
  if (timer.current !== null)
22
22
  clearTimeout(timer.current);
@@ -36,8 +36,8 @@ export function CopyButton({ value, label, }) {
36
36
  setState("done");
37
37
  }
38
38
  catch {
39
- /* Sin portapapeles —contexto no seguro, permiso negado— se DICE. Fingir
40
- que copió hace que alguien pegue lo que tenía antes sin enterarse. */
39
+ /* Without a clipboard —insecure context, permission denied— it SAYS so. Pretending
40
+ it copied makes someone paste what they had before without knowing. */
41
41
  setState("failed");
42
42
  }
43
43
  timer.current = setTimeout(() => setState("idle"), CONFIRMED_FOR);
@@ -64,8 +64,8 @@ export function Copyable({ value, children, mono = false, bare = false }) {
64
64
  if (bare)
65
65
  return button;
66
66
  return (
67
- /* El botón aparece con el puntero y ocupa lugar SIEMPRE: si apareciera de la
68
- nada, el valor se correría al pasar por encima, y un texto que se mueve
69
- cuando vas a seleccionarlo es peor que no tener botón. */
67
+ /* The button appears with the pointer and ALWAYS takes up space: if it appeared out of
68
+ nowhere, the value would shift on hover, and text that moves
69
+ when you go to select it is worse than having no button. */
70
70
  _jsxs("span", { className: "group/copy inline-flex min-w-0 items-center gap-1", children: [_jsx("span", { className: `min-w-0 truncate ${mono ? "font-mono" : ""}`, children: children ?? value }), _jsx("span", { className: "opacity-0 transition-opacity duration-(--duration-instant) group-hover/copy:opacity-100 focus-within:opacity-100", children: button })] }));
71
71
  }
@@ -25,8 +25,13 @@ import { type LucideIcon } from "lucide-react";
25
25
  * the NUMBER.
26
26
  */
27
27
  export type MetricProps = {
28
- value: number | string;
28
+ /** The figure. Without it — and not `loading` — it reads «—»: not counted, which is not
29
+ * zero. */
30
+ value?: number | string;
29
31
  label: string;
32
+ /** The figure is being read. The label stays and the box keeps its size, so a row of
33
+ * metrics does not jump when the numbers land one at a time. */
34
+ loading?: boolean;
30
35
  tone?: Tone;
31
36
  icon?: LucideIcon;
32
37
  /** Present = narrows the list. Absent = only informs, and doesn't get pressed. */
@@ -45,7 +50,7 @@ export type MetricProps = {
45
50
  better?: "up" | "down";
46
51
  };
47
52
  };
48
- export declare function Metric({ value, label, tone, icon: Icon, onClick, active, change, }: MetricProps): import("react").JSX.Element;
53
+ export declare function Metric({ value, label, tone, icon: Icon, onClick, active, change, loading, }: MetricProps): import("react").JSX.Element;
49
54
  /** The row of metrics. It wraps if they don't fit; it doesn't scroll: a hidden
50
55
  * metric is a filter nobody finds. */
51
56
  export declare function Metrics({ children }: {
@@ -14,7 +14,7 @@ const TONE = {
14
14
  ink and the tone is only visible when the card is lit up. */
15
15
  accent: { background: "bg-accent/20", text: "text-ink", edge: "border-accent/50" },
16
16
  };
17
- export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, active = false, change, }) {
17
+ export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, active = false, change, loading = false, }) {
18
18
  const copy = useUiCopy();
19
19
  const sup = useSurface();
20
20
  const t = TONE[tone];
@@ -32,11 +32,19 @@ export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, ac
32
32
  const box = `flex min-w-(--container-metric) shrink-0 flex-col justify-center gap-0.5 rounded-box border px-3.5 py-2 text-left transition-colors duration-(--duration-instant) ${skin} ${onClick === undefined
33
33
  ? ""
34
34
  : "cursor-pointer hover:border-line-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"}`;
35
- const content = (_jsxs(_Fragment, { children: [_jsxs("span", { className: `flex items-center gap-1.5 text-title font-semibold tabular-nums ${t.text}`, children: [Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md)", strokeWidth: 2, "aria-hidden": true })), typeof value === "number" ? value.toLocaleString(copy.locale) : value] }), _jsx("span", { className: `text-micro ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: label }), change === undefined ? null : _jsx(Change, { change: change, format: percent.format })] }));
35
+ const figure = value === undefined
36
+ ? "—"
37
+ : typeof value === "number"
38
+ ? value.toLocaleString(copy.locale)
39
+ : value;
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
+ /* A bar one line of the figure tall (`h-lh`), so the box is the size it will
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 }), change === undefined || loading ? null : (_jsx(Change, { change: change, format: percent.format }))] }));
36
44
  if (onClick === undefined) {
37
- return (_jsx("div", { className: box, "aria-label": `${value} ${label}`, children: content }));
45
+ return (_jsx("div", { className: box, "aria-label": loading ? `${label}: ${copy.failed.loading}` : `${figure} ${label}`, ...(loading ? { "aria-busy": true } : {}), children: content }));
38
46
  }
39
- return (_jsx("button", { type: "button", onClick: onClick, "aria-pressed": active, className: box, children: content }));
47
+ return (_jsxs("button", { type: "button", onClick: onClick, "aria-pressed": active, ...(loading ? { "aria-busy": true } : {}), className: box, children: [content, loading ? _jsx("span", { className: "sr-only", children: copy.failed.loading }) : null] }));
40
48
  }
41
49
  function Change({ change, format, }) {
42
50
  const copy = useUiCopy();
package/dist/tokens.css CHANGED
@@ -92,14 +92,17 @@
92
92
  * as the border that marks a state. If the gold needs to say something, it
93
93
  * is the dark text on top of it that says it.
94
94
  * ---------------------------------------------------------------- */
95
- --color-accent: #c89b3c; /* 2.43:1 on the ground → NEVER text */
96
- --color-accent-hover: #b88a2e; /* on light the hover DARKENS: ink on top gives 5.71:1 */
95
+ --color-accent: var(--brand-accent, #c89b3c); /* 2.43:1 on the ground → NEVER text */
96
+ --color-accent-hover: var(
97
+ --brand-accent-hover,
98
+ #b88a2e
99
+ ); /* on light the hover DARKENS: ink on top gives 5.71:1 */
97
100
 
98
101
  /* The text ON the gold. It is its own token and not `ink` because `ink` flips
99
102
  to a light colour in the dark theme, and light text on gold is 2.4:1: the
100
103
  primary action would stop being readable the moment the theme changed. The
101
104
  gold button is dark-on-gold in BOTH themes. */
102
- --color-on-accent: #1a1714; /* 6.98:1 on the gold */
105
+ --color-on-accent: var(--brand-on-accent, #1a1714); /* 6.98:1 on the gold */
103
106
 
104
107
  /* Data blue. On light the brand blue reads in full, without lightening it:
105
108
  13.52:1. In the dark theme it had to be lightened to #3D5CA8 so that a 6px
@@ -140,8 +143,11 @@
140
143
  product read as assembled, not designed. It is now the chrome's own navy,
141
144
  less saturated: still clearly blue, one family with the bar, and it reads
142
145
  BETTER — 8.26:1 as text (was 7.48:1), white on top 8.69:1 (was 7.87:1). */
143
- --color-primary: #2a4a85; /* 8.26:1 · white on top 8.69:1 */
144
- --color-primary-hover: #1c3765; /* 11.19:1 · white on top 11.77:1 */
146
+ --color-primary: var(--brand-primary, #2a4a85); /* 8.26:1 · white on top 8.69:1 */
147
+ --color-primary-hover: var(
148
+ --brand-primary-hover,
149
+ #1c3765
150
+ ); /* 11.19:1 · white on top 11.77:1 */
145
151
 
146
152
  /* Destructive. It is the SAME red as the `bad` state, on purpose: the red
147
153
  that says «this went wrong» and the one that says «this is going to delete
@@ -224,15 +230,21 @@
224
230
  practical consequence — the `brand-wash` is BORN out of the background
225
231
  itself instead of being painted on top, which is why here the wash reads as
226
232
  light and on black it read as a stain. */
227
- --color-chrome: #141b2e; /* the base */
228
- --color-chrome-raised: #1e2740; /* active tab, open menu */
233
+ --color-chrome: var(--brand-chrome, #141b2e); /* the base */
234
+ --color-chrome-raised: var(--brand-chrome-raised, #1e2740); /* active tab, open menu */
229
235
  /* The hairline under the application bar. On light the chrome already
230
236
  separates from the canvas by luminance, so it IS the chrome (invisible); in the
231
237
  dark theme the two are both near-black and the hairline is what tells them apart. */
232
- --color-chrome-edge: #141b2e; /* 1.00:1 on the chrome — invisible on light, a hairline on dark */
238
+ --color-chrome-edge: var(
239
+ --brand-chrome-edge,
240
+ #141b2e
241
+ ); /* 1.00:1 on the chrome — invisible on light, a hairline on dark */
233
242
  --color-chrome-ink: #e8e4de; /* 13.53:1 — text */
234
243
  --color-chrome-muted: #a39b90; /* 6.24:1 — faint text */
235
- --color-chrome-accent: #c89b3c; /* 6.70:1 — the gold, here it IS text */
244
+ --color-chrome-accent: var(
245
+ --brand-chrome-accent,
246
+ #c89b3c
247
+ ); /* 6.70:1 — the gold, here it IS text */
236
248
 
237
249
  /* ── The link had to change, and the reason is NOT contrast ──────────
238
250
  The blue #6FA0EA gave 6.44:1 on this background: too dark, it sank into the
@@ -243,7 +255,10 @@
243
255
  (220°) at 9.46:1 separates from the bar as clearly as the cyan did (9.94:1)
244
256
  and stays in the palette. WCAG measures luminance and people see hue — here
245
257
  both agree: light on dark, one family. */
246
- --color-chrome-link: #a9c1f2; /* 9.46:1 · same family as the navy, separated by luminance */
258
+ --color-chrome-link: var(
259
+ --brand-chrome-link,
260
+ #a9c1f2
261
+ ); /* 9.46:1 · same family as the navy, separated by luminance */
247
262
 
248
263
  --color-chrome-good: #6fcf8b; /* 8.95:1 */
249
264
  --color-chrome-warn: #e3b341; /* 8.80:1 */
@@ -461,19 +476,26 @@
461
476
  `ListingBar`. */
462
477
  --container-search: 30rem;
463
478
 
464
- /* Lo que PIDE una miga antes de recortarse, y lo que pide el rastro entero.
465
- Los dos son pedidos y no anchos: una línea más angosta se los baja, y una
466
- más ancha se los deja crecer.
467
-
468
- Hacen falta los dos porque son dos problemas distintos. Un nombre de este
469
- producto llega a cincuenta caracteres, así que UNA miga puede comerse la
470
- línea entera aunque el rastro tenga tres: `--container-crumb` es lo que
471
- cada una pide antes de terminar en «…», y ahí la que manda es la última
472
- —dónde estoy— que nunca se recorta del todo.
473
-
474
- `--container-trail` es lo que pide el rastro COMPLETO en la línea de la
475
- banda. Sin él, «de dónde vengo» le saca el lugar a lo que cuelga del
476
- registro y el centro deja de estar en el centro. */
479
+ /* How wide the cuts panel may grow: filters, grouping and favourites side by side — three
480
+ columns of a facet each — and never wider than the screen, so on a phone the columns
481
+ stack and it reads as a popover. It is the SCREEN that decides, not the field: a list's
482
+ search field is often narrow (it shares the bar with sort, columns and «New»), and a
483
+ panel capped at the field's width stacked its three columns on a 1440px desk. */
484
+ --container-cuts: min(calc(var(--container-facet) * 3), calc(100vw - 3rem));
485
+
486
+ /* What a crumb ASKS for before being clipped, and what the whole trail asks for.
487
+ Both are requests and not widths: a narrower line drops them, and a
488
+ wider one lets them grow.
489
+
490
+ Both are needed because they are two different problems. A name in this
491
+ product reaches fifty characters, so ONE crumb can eat the whole
492
+ line even if the trail has three: `--container-crumb` is what
493
+ each one asks for before ending in «…», and there the last one rules
494
+ —where I am— which is never clipped entirely.
495
+
496
+ `--container-trail` is what the COMPLETE trail asks for in the band's
497
+ line. Without it, «de dónde vengo» takes the room from what hangs off the
498
+ record and the centre stops being in the centre. */
477
499
  --container-crumb: 12rem;
478
500
  --container-trail: 20rem;
479
501
 
@@ -547,6 +569,15 @@
547
569
  things, and what they have to let you compare is precisely the number. */
548
570
  --container-metric: 7rem;
549
571
 
572
+ /* The body of a board tile while it reads or after it failed: a chart's own plot height
573
+ (`Chart` draws `h-72`, 18rem). The skeleton and the failure take the room the chart will
574
+ take, so the grid does not jump when one tile lands and its neighbour is still reading. */
575
+ --size-tile-body: 18rem;
576
+
577
+ /* A row of headline metrics while the board reads them: the height of one `Metric` with
578
+ its figure and label, so the tiles below do not move down when the numbers arrive. */
579
+ --size-metric: 3.75rem;
580
+
550
581
  /* The width of the peek drawer. It is a system decision and not a component
551
582
  one: 30rem is what fits of a record without leaving the list behind it
552
583
  —which has to stay clickable— reduced to a useless strip. */
@@ -600,6 +631,11 @@
600
631
  two modules whose sidebars differ in width read as two products. */
601
632
  --container-sidebar: 15rem;
602
633
 
634
+ /* The same sidebar as a drawer on a phone: a little wider than the column — it has the
635
+ whole screen to itself — and never wider than the screen minus a strip of the page,
636
+ which is where a thumb taps to close it. */
637
+ --container-drawer: min(20rem, calc(100vw - 3rem));
638
+
603
639
  /* The record sheet. The rail above it spans the whole window; the sheet does not: a form
604
640
  stretched to 1,400 px puts the label and its value half a screen apart and turns every
605
641
  input into a bar nobody fills. 72rem holds two columns of fields at a readable width —
@@ -715,6 +751,29 @@
715
751
  * gets a hairline (`chrome-edge`) because it and the canvas are both near
716
752
  * black. The gold keeps being the primary action; `on-accent` keeps the text
717
753
  * on it dark.
754
+ *
755
+ * ── A BRAND: set it once, every theme follows ───────────────────────
756
+ *
757
+ * The colours a brand owns — the action (`accent`, `accent-hover`, `on-accent`),
758
+ * the link and current place (`primary`, `primary-hover`), and the bar
759
+ * (`chrome`, `chrome-raised`, `chrome-edge`, `chrome-accent`, `chrome-link`) —
760
+ * read a `--brand-*` variable first, and fall back to the system's value:
761
+ *
762
+ * :root {
763
+ * --brand-accent: #d4a73a; --brand-dark-accent: #e0b850;
764
+ * --brand-chrome: #10203f; --brand-dark-chrome: #0a1428;
765
+ * }
766
+ *
767
+ * `--brand-<token>` is the light palette's, `--brand-dark-<token>` the dark's.
768
+ * Set on `:root`, a variable is INHERITED by every subtree — so the four blocks
769
+ * that define a palette (`@theme`, the media query, `[data-theme="dark"]` and
770
+ * the nested `[data-theme="light"]`) all resolve to the brand, and nothing has
771
+ * to be repeated per theme. Before, a brand overrode `--color-*` and lost to
772
+ * whichever of those blocks matched the element it was on.
773
+ *
774
+ * The system measures ITS values (the numbers in the comments); a brand's
775
+ * contrast is the brand's to check — the Storybook a11y pass does, on every
776
+ * story, in both themes.
718
777
  * ==================================================================== */
719
778
  :root {
720
779
  color-scheme: light dark;
@@ -729,12 +788,21 @@
729
788
  --color-line-strong: #443f38; /* 1.73:1 — border of a box, table header */
730
789
  --color-ink: #ece8e1; /* 14.78:1 */
731
790
  --color-muted: #a39b90; /* 6.57:1 */
732
- --color-accent: #c89b3c; /* 7.05:1 — on dark the gold CAN be read, but it stays the primary action */
733
- --color-accent-hover: #dbb055; /* on dark the hover LIGHTENS: on-accent on top gives 8.80:1 */
734
- --color-on-accent: #1a1714; /* 6.98:1 on the gold */
791
+ --color-accent: var(
792
+ --brand-dark-accent,
793
+ #c89b3c
794
+ ); /* 7.05:1 — on dark the gold CAN be read, but it stays the primary action */
795
+ --color-accent-hover: var(
796
+ --brand-dark-accent-hover,
797
+ #dbb055
798
+ ); /* on dark the hover LIGHTENS: on-accent on top gives 8.80:1 */
799
+ --color-on-accent: var(--brand-dark-on-accent, #1a1714); /* 6.98:1 on the gold */
735
800
  --color-data: #8ea6d9; /* 7.40:1 */
736
- --color-primary: #8fa9e8; /* 7.74:1 · surface on top 7.03:1 */
737
- --color-primary-hover: #b0c3f1; /* 10.25:1 · surface on top 9.31:1 */
801
+ --color-primary: var(--brand-dark-primary, #8fa9e8); /* 7.74:1 · surface on top 7.03:1 */
802
+ --color-primary-hover: var(
803
+ --brand-dark-primary-hover,
804
+ #b0c3f1
805
+ ); /* 10.25:1 · surface on top 9.31:1 */
738
806
  --color-danger: #f08d7f; /* 7.58:1 · surface on top 6.89:1 */
739
807
  --color-danger-hover: #f6ab9f; /* 9.66:1 · surface on top 8.78:1 */
740
808
  --color-info: #5cc4d8; /* 8.89:1 */
@@ -750,13 +818,22 @@
750
818
  --color-good: #6fcf8b; /* 9.43:1 */
751
819
  --color-warn: #e3b341; /* 9.27:1 */
752
820
  --color-bad: #f08d7f; /* 7.58:1 */
753
- --color-chrome: #0b101e; /* the base: deeper than the canvas */
754
- --color-chrome-raised: #18223a; /* active tab, open menu */
755
- --color-chrome-edge: #2b3656; /* 1.59:1 on the chrome — the hairline that separates the bar from the canvas */
821
+ --color-chrome: var(--brand-dark-chrome, #0b101e); /* the base: deeper than the canvas */
822
+ --color-chrome-raised: var(
823
+ --brand-dark-chrome-raised,
824
+ #18223a
825
+ ); /* active tab, open menu */
826
+ --color-chrome-edge: var(
827
+ --brand-dark-chrome-edge,
828
+ #2b3656
829
+ ); /* 1.59:1 on the chrome — the hairline that separates the bar from the canvas */
756
830
  --color-chrome-ink: #e8e4de; /* 14.98:1 — text */
757
831
  --color-chrome-muted: #a39b90; /* 6.91:1 — faint text */
758
- --color-chrome-accent: #c89b3c; /* 7.42:1 — the gold, here it IS text */
759
- --color-chrome-link: #a9c1f2; /* 10.48:1 */
832
+ --color-chrome-accent: var(
833
+ --brand-dark-chrome-accent,
834
+ #c89b3c
835
+ ); /* 7.42:1 — the gold, here it IS text */
836
+ --color-chrome-link: var(--brand-dark-chrome-link, #a9c1f2); /* 10.48:1 */
760
837
  --color-chrome-good: #6fcf8b; /* 9.91:1 */
761
838
  --color-chrome-warn: #e3b341; /* 9.75:1 */
762
839
  --color-chrome-bad: #ff8a7a; /* 8.28:1 */
@@ -776,12 +853,21 @@
776
853
  --color-line-strong: #443f38; /* 1.73:1 — border of a box, table header */
777
854
  --color-ink: #ece8e1; /* 14.78:1 */
778
855
  --color-muted: #a39b90; /* 6.57:1 */
779
- --color-accent: #c89b3c; /* 7.05:1 — on dark the gold CAN be read, but it stays the primary action */
780
- --color-accent-hover: #dbb055; /* on dark the hover LIGHTENS: on-accent on top gives 8.80:1 */
781
- --color-on-accent: #1a1714; /* 6.98:1 on the gold */
856
+ --color-accent: var(
857
+ --brand-dark-accent,
858
+ #c89b3c
859
+ ); /* 7.05:1 — on dark the gold CAN be read, but it stays the primary action */
860
+ --color-accent-hover: var(
861
+ --brand-dark-accent-hover,
862
+ #dbb055
863
+ ); /* on dark the hover LIGHTENS: on-accent on top gives 8.80:1 */
864
+ --color-on-accent: var(--brand-dark-on-accent, #1a1714); /* 6.98:1 on the gold */
782
865
  --color-data: #8ea6d9; /* 7.40:1 */
783
- --color-primary: #8fa9e8; /* 7.74:1 · surface on top 7.03:1 */
784
- --color-primary-hover: #b0c3f1; /* 10.25:1 · surface on top 9.31:1 */
866
+ --color-primary: var(--brand-dark-primary, #8fa9e8); /* 7.74:1 · surface on top 7.03:1 */
867
+ --color-primary-hover: var(
868
+ --brand-dark-primary-hover,
869
+ #b0c3f1
870
+ ); /* 10.25:1 · surface on top 9.31:1 */
785
871
  --color-danger: #f08d7f; /* 7.58:1 · surface on top 6.89:1 */
786
872
  --color-danger-hover: #f6ab9f; /* 9.66:1 · surface on top 8.78:1 */
787
873
  --color-info: #5cc4d8; /* 8.89:1 */
@@ -797,13 +883,19 @@
797
883
  --color-good: #6fcf8b; /* 9.43:1 */
798
884
  --color-warn: #e3b341; /* 9.27:1 */
799
885
  --color-bad: #f08d7f; /* 7.58:1 */
800
- --color-chrome: #0b101e; /* the base: deeper than the canvas */
801
- --color-chrome-raised: #18223a; /* active tab, open menu */
802
- --color-chrome-edge: #2b3656; /* 1.59:1 on the chrome — the hairline that separates the bar from the canvas */
886
+ --color-chrome: var(--brand-dark-chrome, #0b101e); /* the base: deeper than the canvas */
887
+ --color-chrome-raised: var(--brand-dark-chrome-raised, #18223a); /* active tab, open menu */
888
+ --color-chrome-edge: var(
889
+ --brand-dark-chrome-edge,
890
+ #2b3656
891
+ ); /* 1.59:1 on the chrome — the hairline that separates the bar from the canvas */
803
892
  --color-chrome-ink: #e8e4de; /* 14.98:1 — text */
804
893
  --color-chrome-muted: #a39b90; /* 6.91:1 — faint text */
805
- --color-chrome-accent: #c89b3c; /* 7.42:1 — the gold, here it IS text */
806
- --color-chrome-link: #a9c1f2; /* 10.48:1 */
894
+ --color-chrome-accent: var(
895
+ --brand-dark-chrome-accent,
896
+ #c89b3c
897
+ ); /* 7.42:1 — the gold, here it IS text */
898
+ --color-chrome-link: var(--brand-dark-chrome-link, #a9c1f2); /* 10.48:1 */
807
899
  --color-chrome-good: #6fcf8b; /* 9.91:1 */
808
900
  --color-chrome-warn: #e3b341; /* 9.75:1 */
809
901
  --color-chrome-bad: #ff8a7a; /* 8.28:1 */
@@ -825,12 +917,18 @@
825
917
  --color-line-strong: #d5cec2; /* 1.49:1 — border of a box, table header */
826
918
  --color-ink: #1a1714;
827
919
  --color-muted: #6b6459;
828
- --color-accent: #c89b3c; /* 2.43:1 on the ground → NEVER text */
829
- --color-accent-hover: #b88a2e; /* on light the hover DARKENS: ink on top gives 5.71:1 */
830
- --color-on-accent: #1a1714; /* 6.98:1 on the gold */
920
+ --color-accent: var(--brand-accent, #c89b3c); /* 2.43:1 on the ground → NEVER text */
921
+ --color-accent-hover: var(
922
+ --brand-accent-hover,
923
+ #b88a2e
924
+ ); /* on light the hover DARKENS: ink on top gives 5.71:1 */
925
+ --color-on-accent: var(--brand-on-accent, #1a1714); /* 6.98:1 on the gold */
831
926
  --color-data: #1b2a4a; /* 13.52:1 */
832
- --color-primary: #2a4a85; /* 8.26:1 · white on top 8.69:1 */
833
- --color-primary-hover: #1c3765; /* 11.19:1 · white on top 11.77:1 */
927
+ --color-primary: var(--brand-primary, #2a4a85); /* 8.26:1 · white on top 8.69:1 */
928
+ --color-primary-hover: var(
929
+ --brand-primary-hover,
930
+ #1c3765
931
+ ); /* 11.19:1 · white on top 11.77:1 */
834
932
  --color-danger: #9b3b30; /* 6.52:1 · white on top 6.86:1 */
835
933
  --color-danger-hover: #7c2d24; /* 8.84:1 · white on top 9.30:1 */
836
934
  --color-info: #0f5c6e; /* 7.19:1 · white on top 7.56:1 */
@@ -846,13 +944,22 @@
846
944
  --color-good: #2f6b3c; /* 6.07:1 */
847
945
  --color-warn: #7e5e12; /* 5.71:1 */
848
946
  --color-bad: #9b3b30; /* 6.52:1 */
849
- --color-chrome: #141b2e; /* the base */
850
- --color-chrome-raised: #1e2740; /* active tab, open menu */
851
- --color-chrome-edge: #141b2e; /* 1.00:1 on the chrome — invisible on light, a hairline on dark */
947
+ --color-chrome: var(--brand-chrome, #141b2e); /* the base */
948
+ --color-chrome-raised: var(--brand-chrome-raised, #1e2740); /* active tab, open menu */
949
+ --color-chrome-edge: var(
950
+ --brand-chrome-edge,
951
+ #141b2e
952
+ ); /* 1.00:1 on the chrome — invisible on light, a hairline on dark */
852
953
  --color-chrome-ink: #e8e4de; /* 13.53:1 — text */
853
954
  --color-chrome-muted: #a39b90; /* 6.24:1 — faint text */
854
- --color-chrome-accent: #c89b3c; /* 6.70:1 — the gold, here it IS text */
855
- --color-chrome-link: #a9c1f2; /* 9.46:1 · same family as the navy, separated by luminance */
955
+ --color-chrome-accent: var(
956
+ --brand-chrome-accent,
957
+ #c89b3c
958
+ ); /* 6.70:1 — the gold, here it IS text */
959
+ --color-chrome-link: var(
960
+ --brand-chrome-link,
961
+ #a9c1f2
962
+ ); /* 9.46:1 · same family as the navy, separated by luminance */
856
963
  --color-chrome-good: #6fcf8b; /* 8.95:1 */
857
964
  --color-chrome-warn: #e3b341; /* 8.80:1 */
858
965
  --color-chrome-bad: #ff8a7a; /* 7.48:1 */
@@ -987,10 +1094,10 @@
987
1094
  color: var(--color-ink);
988
1095
  font-family: var(--font-sans);
989
1096
  -webkit-font-smoothing: antialiased;
990
- /* Sólo horizontal. Sacar el `overflow: hidden` entero destapó algo que se
991
- * desborda a los costados —un panel oculto fuera de pantalla, medido para
992
- * un ancho que ya no es el suyo— y sin este freno se podía scrollear hacia
993
- * la derecha para verlo. El alto sigue libre: es lo que se vino a arreglar. */
1097
+ /* Horizontal only. Removing `overflow: hidden` entirely uncovered something that
1098
+ * overflows sideways —a panel hidden off-screen, measured for
1099
+ * a width that is no longer its own— and without this brake one could scroll to
1100
+ * the right to see it. The height stays free: that is what was being fixed. */
994
1101
  overflow-x: hidden;
995
1102
  }
996
1103