basalt-ui 2.21.0 → 2.23.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 (254) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/MIGRATING.md +452 -12
  3. package/agent/agents/basalt-design-reviewer.md +1 -1
  4. package/agent/rules/basalt-tokens.md +1 -1
  5. package/agent/skills/basalt-design/SKILL.md +1 -1
  6. package/agent/skills/basalt-design/references/anti-defaults.md +1 -1
  7. package/agent/skills/basalt-design/references/catalogue.md +1 -0
  8. package/dist/charts/BandStrip.d.ts.map +1 -1
  9. package/dist/charts/BandStrip.js +73 -3
  10. package/dist/charts/Bars.d.ts.map +1 -1
  11. package/dist/charts/Bars.js +6 -0
  12. package/dist/charts/CartesianChart.d.ts +10 -0
  13. package/dist/charts/CartesianChart.d.ts.map +1 -1
  14. package/dist/charts/CartesianChart.js +8 -5
  15. package/dist/charts/ChartCard.d.ts +12 -3
  16. package/dist/charts/ChartCard.d.ts.map +1 -1
  17. package/dist/charts/ChartCard.js +39 -8
  18. package/dist/charts/DualPanel.d.ts.map +1 -1
  19. package/dist/charts/DualPanel.js +5 -8
  20. package/dist/charts/Heatmap.d.ts +12 -1
  21. package/dist/charts/Heatmap.d.ts.map +1 -1
  22. package/dist/charts/Heatmap.js +34 -5
  23. package/dist/charts/Lines.d.ts +3 -0
  24. package/dist/charts/Lines.d.ts.map +1 -1
  25. package/dist/charts/Lines.js +29 -6
  26. package/dist/charts/MirroredBars.d.ts.map +1 -1
  27. package/dist/charts/MirroredBars.js +4 -6
  28. package/dist/charts/Sparkline.d.ts +14 -2
  29. package/dist/charts/Sparkline.d.ts.map +1 -1
  30. package/dist/charts/Sparkline.js +101 -22
  31. package/dist/charts/StackedArea.d.ts +4 -1
  32. package/dist/charts/StackedArea.d.ts.map +1 -1
  33. package/dist/charts/StackedArea.js +9 -3
  34. package/dist/charts/band-fold.d.ts +38 -1
  35. package/dist/charts/band-fold.d.ts.map +1 -1
  36. package/dist/charts/band-fold.js +18 -1
  37. package/dist/charts/chart-box.module.css +19 -0
  38. package/dist/charts/chart-card.module.css +25 -0
  39. package/dist/charts/chart-dates.d.ts +12 -0
  40. package/dist/charts/chart-dates.d.ts.map +1 -0
  41. package/dist/charts/chart-dates.js +16 -0
  42. package/dist/charts/chart-legend.module.css +7 -0
  43. package/dist/charts/compile.d.ts +25 -6
  44. package/dist/charts/compile.d.ts.map +1 -1
  45. package/dist/charts/compile.js +152 -72
  46. package/dist/charts/date-tick-format.d.ts +5 -5
  47. package/dist/charts/date-tick-format.d.ts.map +1 -1
  48. package/dist/charts/date-tick-format.js +3 -7
  49. package/dist/charts/labels.d.ts +21 -6
  50. package/dist/charts/labels.d.ts.map +1 -1
  51. package/dist/charts/labels.js +52 -17
  52. package/dist/charts/legend.d.ts +2 -0
  53. package/dist/charts/legend.d.ts.map +1 -1
  54. package/dist/charts/legend.js +7 -21
  55. package/dist/charts/marks.js +1 -1
  56. package/dist/charts/panel.d.ts +0 -6
  57. package/dist/charts/panel.d.ts.map +1 -1
  58. package/dist/charts/panel.js +1 -10
  59. package/dist/charts/ref-label.d.ts +43 -0
  60. package/dist/charts/ref-label.d.ts.map +1 -0
  61. package/dist/charts/ref-label.js +75 -0
  62. package/dist/charts/scales.d.ts +4 -1
  63. package/dist/charts/scales.d.ts.map +1 -1
  64. package/dist/charts/scales.js +14 -3
  65. package/dist/charts/sparkline.module.css +13 -17
  66. package/dist/charts/sparkline.module.css.d.ts +1 -2
  67. package/dist/charts/state.d.ts +2 -0
  68. package/dist/charts/state.d.ts.map +1 -1
  69. package/dist/charts/state.js +5 -2
  70. package/dist/charts/types.d.ts +18 -8
  71. package/dist/charts/types.d.ts.map +1 -1
  72. package/dist/cli/doctor-upgrade.d.ts +1 -0
  73. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  74. package/dist/cli/doctor-upgrade.js +1 -0
  75. package/dist/cli/init.d.ts +2 -0
  76. package/dist/cli/init.d.ts.map +1 -1
  77. package/dist/cli/init.js +68 -4
  78. package/dist/cli/shot/capture.d.ts +21 -2
  79. package/dist/cli/shot/capture.d.ts.map +1 -1
  80. package/dist/cli/shot/capture.js +202 -36
  81. package/dist/cli/shot/detect.d.ts.map +1 -1
  82. package/dist/cli/shot/detect.js +17 -1
  83. package/dist/cli/shot/playwright.d.ts +13 -2
  84. package/dist/cli/shot/playwright.d.ts.map +1 -1
  85. package/dist/cli/shot/playwright.js +5 -1
  86. package/dist/cli/shot/types.d.ts +4 -0
  87. package/dist/cli/shot/types.d.ts.map +1 -1
  88. package/dist/cli/shot/types.js +2 -0
  89. package/dist/cli/tokens-css.d.ts +5 -7
  90. package/dist/cli/tokens-css.d.ts.map +1 -1
  91. package/dist/cli/tokens-css.js +11 -12
  92. package/dist/controls/controls.module.css +11 -1
  93. package/dist/controls/filter-pill.d.ts.map +1 -1
  94. package/dist/controls/filter-pill.js +1 -0
  95. package/dist/controls/sync-button.d.ts.map +1 -1
  96. package/dist/controls/sync-button.js +22 -3
  97. package/dist/controls/sync-button.module.css +34 -2
  98. package/dist/controls/sync-button.module.css.d.ts +1 -0
  99. package/dist/dashboard/bar-list.d.ts +6 -1
  100. package/dist/dashboard/bar-list.d.ts.map +1 -1
  101. package/dist/dashboard/bar-list.js +15 -8
  102. package/dist/dashboard/bar-list.module.css +83 -0
  103. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  104. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  105. package/dist/dashboard/delta-badge.js +2 -2
  106. package/dist/dashboard/index.d.ts +1 -0
  107. package/dist/dashboard/index.d.ts.map +1 -1
  108. package/dist/dashboard/index.js +2 -0
  109. package/dist/dashboard/meter-model.d.ts +84 -5
  110. package/dist/dashboard/meter-model.d.ts.map +1 -1
  111. package/dist/dashboard/meter-model.js +100 -15
  112. package/dist/dashboard/meter-parts.d.ts +9 -1
  113. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  114. package/dist/dashboard/meter-parts.js +276 -74
  115. package/dist/dashboard/meter.d.ts +54 -65
  116. package/dist/dashboard/meter.d.ts.map +1 -1
  117. package/dist/dashboard/meter.js +21 -4
  118. package/dist/dashboard/meter.module.css +76 -0
  119. package/dist/dashboard/meter.module.css.d.ts +6 -0
  120. package/dist/dashboard/page-summary.d.ts +20 -0
  121. package/dist/dashboard/page-summary.d.ts.map +1 -0
  122. package/dist/dashboard/page-summary.js +28 -0
  123. package/dist/dashboard/page-summary.module.css +89 -0
  124. package/dist/dashboard/page-summary.module.css.d.ts +15 -0
  125. package/dist/dashboard/query-state.d.ts.map +1 -1
  126. package/dist/dashboard/query-state.js +1 -1
  127. package/dist/dashboard/section.d.ts +25 -2
  128. package/dist/dashboard/section.d.ts.map +1 -1
  129. package/dist/dashboard/section.js +10 -5
  130. package/dist/dashboard/section.module.css +23 -0
  131. package/dist/dashboard/section.module.css.d.ts +1 -0
  132. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  133. package/dist/dashboard/stat-card-parts.js +1 -1
  134. package/dist/dashboard/stat-card.d.ts +4 -2
  135. package/dist/dashboard/stat-card.d.ts.map +1 -1
  136. package/dist/dashboard/stat-card.js +7 -5
  137. package/dist/dashboard/stat-card.module.css +36 -0
  138. package/dist/dashboard/stat-group.module.css +7 -0
  139. package/dist/dashboard/stat-strip.d.ts +22 -6
  140. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  141. package/dist/dashboard/stat-strip.js +104 -60
  142. package/dist/dashboard/stat-strip.module.css +122 -53
  143. package/dist/dashboard/stat-strip.module.css.d.ts +4 -0
  144. package/dist/dashboard/visual-slot.d.ts +7 -1
  145. package/dist/dashboard/visual-slot.d.ts.map +1 -1
  146. package/dist/dashboard/visual-slot.js +3 -1
  147. package/dist/guard/index.d.ts.map +1 -1
  148. package/dist/guard/index.js +0 -5
  149. package/dist/guard/vx-names.d.ts.map +1 -1
  150. package/dist/guard/vx-names.js +2 -0
  151. package/dist/index.d.ts +1 -1
  152. package/dist/index.d.ts.map +1 -1
  153. package/dist/index.js +3 -1
  154. package/dist/styles.css +43 -4
  155. package/dist/theme/chrome-vars.d.ts +20 -5
  156. package/dist/theme/chrome-vars.d.ts.map +1 -1
  157. package/dist/theme/chrome-vars.js +46 -3
  158. package/dist/theme/controls.module.css +37 -0
  159. package/dist/theme/controls.module.css.d.ts +2 -0
  160. package/dist/theme/index.d.ts.map +1 -1
  161. package/dist/theme/index.js +18 -27
  162. package/dist/theme/status-verdict.d.ts.map +1 -1
  163. package/dist/theme/status-verdict.js +9 -1
  164. package/dist/tokens/core.d.ts +2 -1
  165. package/dist/tokens/core.d.ts.map +1 -1
  166. package/dist/tokens/core.js +6 -1
  167. package/dist/tokens/derive.d.ts +3 -1
  168. package/dist/tokens/derive.d.ts.map +1 -1
  169. package/dist/tokens/derive.js +16 -1
  170. package/dist/tokens/palette.d.ts +11 -10
  171. package/dist/tokens/palette.d.ts.map +1 -1
  172. package/dist/tokens/palette.js +11 -10
  173. package/dist/tokens/status-text.d.ts.map +1 -1
  174. package/dist/tokens/status-text.js +3 -1
  175. package/llms.txt +42 -22
  176. package/package.json +1 -1
  177. package/src/charts/BandStrip.tsx +83 -3
  178. package/src/charts/Bars.tsx +7 -0
  179. package/src/charts/CartesianChart.tsx +18 -3
  180. package/src/charts/ChartCard.tsx +54 -13
  181. package/src/charts/DualPanel.tsx +3 -6
  182. package/src/charts/Heatmap.tsx +54 -5
  183. package/src/charts/Lines.tsx +56 -10
  184. package/src/charts/MirroredBars.tsx +3 -5
  185. package/src/charts/Sparkline.tsx +135 -25
  186. package/src/charts/StackedArea.tsx +14 -4
  187. package/src/charts/band-fold.ts +50 -1
  188. package/src/charts/chart-box.module.css +19 -0
  189. package/src/charts/chart-card.module.css +25 -0
  190. package/src/charts/chart-dates.ts +30 -0
  191. package/src/charts/chart-legend.module.css +7 -0
  192. package/src/charts/compile.ts +253 -87
  193. package/src/charts/date-tick-format.ts +10 -13
  194. package/src/charts/labels.ts +81 -26
  195. package/src/charts/legend.tsx +10 -20
  196. package/src/charts/marks.ts +1 -1
  197. package/src/charts/panel.tsx +1 -16
  198. package/src/charts/ref-label.ts +131 -0
  199. package/src/charts/scales.ts +22 -2
  200. package/src/charts/sparkline.module.css +13 -17
  201. package/src/charts/sparkline.module.css.d.ts +1 -2
  202. package/src/charts/state.tsx +9 -4
  203. package/src/charts/types.ts +18 -8
  204. package/src/cli/doctor-upgrade.ts +1 -1
  205. package/src/cli/init.ts +100 -3
  206. package/src/cli/shot/capture.ts +266 -35
  207. package/src/cli/shot/detect.ts +18 -1
  208. package/src/cli/shot/playwright.ts +20 -4
  209. package/src/cli/shot/types.ts +5 -0
  210. package/src/cli/tokens-css.ts +18 -20
  211. package/src/controls/controls.module.css +11 -1
  212. package/src/controls/filter-pill.tsx +2 -0
  213. package/src/controls/sync-button.module.css +34 -2
  214. package/src/controls/sync-button.module.css.d.ts +1 -0
  215. package/src/controls/sync-button.tsx +40 -4
  216. package/src/dashboard/bar-list.module.css +83 -0
  217. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  218. package/src/dashboard/bar-list.tsx +107 -69
  219. package/src/dashboard/delta-badge.tsx +6 -2
  220. package/src/dashboard/index.ts +1 -0
  221. package/src/dashboard/meter-model.ts +207 -24
  222. package/src/dashboard/meter-parts.tsx +349 -67
  223. package/src/dashboard/meter.module.css +76 -0
  224. package/src/dashboard/meter.module.css.d.ts +6 -0
  225. package/src/dashboard/meter.tsx +72 -18
  226. package/src/dashboard/page-summary.module.css +89 -0
  227. package/src/dashboard/page-summary.module.css.d.ts +15 -0
  228. package/src/dashboard/page-summary.tsx +95 -0
  229. package/src/dashboard/query-state.tsx +1 -1
  230. package/src/dashboard/section.module.css +23 -0
  231. package/src/dashboard/section.module.css.d.ts +1 -0
  232. package/src/dashboard/section.tsx +59 -11
  233. package/src/dashboard/stat-card-parts.tsx +5 -1
  234. package/src/dashboard/stat-card.module.css +36 -0
  235. package/src/dashboard/stat-card.tsx +12 -6
  236. package/src/dashboard/stat-group.module.css +7 -0
  237. package/src/dashboard/stat-strip.module.css +122 -53
  238. package/src/dashboard/stat-strip.module.css.d.ts +4 -0
  239. package/src/dashboard/stat-strip.tsx +176 -91
  240. package/src/dashboard/visual-slot.ts +12 -3
  241. package/src/guard/index.ts +0 -5
  242. package/src/guard/vx-names.ts +2 -0
  243. package/src/index.ts +2 -0
  244. package/src/styles.css +43 -4
  245. package/src/theme/__snapshots__/plain-theme.test.ts.snap +200 -68
  246. package/src/theme/chrome-vars.ts +77 -8
  247. package/src/theme/controls.module.css +37 -0
  248. package/src/theme/controls.module.css.d.ts +2 -0
  249. package/src/theme/index.ts +22 -32
  250. package/src/theme/status-verdict.tsx +5 -1
  251. package/src/tokens/core.ts +4 -1
  252. package/src/tokens/derive.ts +32 -3
  253. package/src/tokens/palette.ts +11 -10
  254. package/src/tokens/status-text.ts +2 -0
@@ -112,7 +112,9 @@
112
112
  .pill {
113
113
  --vx-hit-gap: var(--vx-space-control-gap);
114
114
  position: relative;
115
- max-width: 15rem;
115
+ /* A filter pill fits its selected option; this is only the ceiling. 15rem clipped an ordinary site
116
+ * or project name (argo astro site select) — 24rem holds a long one and the label truncates past it. */
117
+ max-width: 24rem;
116
118
  border-color: color-mix(in srgb, var(--vx-ink) 12%, transparent);
117
119
  }
118
120
 
@@ -353,6 +355,14 @@
353
355
  flex: 0 1 auto;
354
356
  }
355
357
 
358
+ /* Mantine's own inline-start inset is `--input-height / 3` = 10.67px, off every step. The `ctl` inset
359
+ * is the one the buttons beside it already use, so the value lines up with their labels. Set on the
360
+ * input itself: the `--input-padding-inline-start` var is declared on a CHILD of the root this class
361
+ * lands on, so a root-level override would be shadowed. */
362
+ .phoneSelect input {
363
+ padding-inline-start: var(--button-padding-x-ctl);
364
+ }
365
+
356
366
  /* ── The facet list (MultiSelectFilter, `panel` + `sheet` surfaces) ──────────────────────────────── */
357
367
 
358
368
  /*
@@ -75,6 +75,8 @@ export function FilterPill({
75
75
  size="ctl"
76
76
  className={cx(classes.pill, className)}
77
77
  data-basalt-hit
78
+ // The label truncates past the pill's width cap; the full name stays one hover away.
79
+ title={label}
78
80
  classNames={{ label: classes.pillLabel }}
79
81
  {...(style !== undefined && { style })}
80
82
  {...(active === true && { 'data-active': true })}
@@ -34,8 +34,22 @@
34
34
  }
35
35
 
36
36
  /*
37
- * `scope: 'page'` below `sm`: the label and the age go, the glyph stays, and the button collapses
38
- * to the square icon form (spec §3, "icon-only, age in tooltip"). Hidden, not unmounted — a second
37
+ * The phone form's age (`2 m`): hidden above `sm`, where the long age already sits beside the label.
38
+ * `nowrap` is the whole point of it — a two-token string that wraps inside a 32px button is worse
39
+ * than no age at all.
40
+ */
41
+ .ageCompact {
42
+ display: none;
43
+ white-space: nowrap;
44
+ color: var(--vx-muted);
45
+ font-family: var(--basalt-font-mono);
46
+ font-size: var(--vx-text-xs);
47
+ }
48
+
49
+ /*
50
+ * `scope: 'page'` below `sm`: the label and the long age go, the glyph stays, and the button
51
+ * collapses to the square icon form (spec §3) — unless an age exists, in which case the compact age
52
+ * rides beside the glyph and the square pin is released (argo m365 refresh at 390). Hidden, not unmounted — a second
39
53
  * mount under `hiddenFrom` is exactly the responsive twin law C9 forbids, which is also why the
40
54
  * accessible name lives on `aria-label` rather than in this text.
41
55
  *
@@ -52,6 +66,10 @@
52
66
  display: none;
53
67
  }
54
68
 
69
+ .ageCompact {
70
+ display: inline;
71
+ }
72
+
55
73
  .pageButton {
56
74
  --button-padding-x: 0;
57
75
 
@@ -61,4 +79,18 @@
61
79
  .pageButton :global(.mantine-Button-section[data-position='left']) {
62
80
  margin-inline-end: 0;
63
81
  }
82
+
83
+ /* An age beside the glyph: content-width, on the `ctl` inset, glyph and age one control gap apart. */
84
+ .pageButton[data-with-age] {
85
+ --button-padding-x: var(--button-padding-x-ctl);
86
+
87
+ /* Mantine divides the inline-start padding by 1.5 when a left section exists — off the scale. */
88
+ padding-inline: var(--button-padding-x-ctl);
89
+ width: auto;
90
+ flex: none;
91
+ }
92
+
93
+ .pageButton[data-with-age] :global(.mantine-Button-section[data-position='left']) {
94
+ margin-inline-end: var(--vx-space-control-gap);
95
+ }
64
96
  }
@@ -5,6 +5,7 @@
5
5
  declare const classes: {
6
6
  readonly spin: string
7
7
  readonly age: string
8
+ readonly ageCompact: string
8
9
  readonly label: string
9
10
  readonly pageButton: string
10
11
  }
@@ -13,8 +13,8 @@
13
13
  * pushes a page's own actions into the kebab. The age and the error live in the tooltip; the
14
14
  * accessible name is `label`.
15
15
  * - `scope: 'page'` → `PageBar.sync` (the page's own data). The labelled `Button` with the age
16
- * inline beside it on desktop, icon-only below `sm` where that width is gone — CSS only, one
17
- * mount, never a `visibleFrom` twin (law C9).
16
+ * inline beside it on desktop; below `sm` the label and the long age go and the glyph keeps a
17
+ * SHORT age (`2m`) beside it — CSS only, one mount, never a `visibleFrom` twin (law C9).
18
18
  *
19
19
  * Because the label is hidden rather than unmounted below `sm`, the accessible name comes from
20
20
  * `aria-label` in BOTH forms: `display: none` text is out of the accessibility tree, so a page
@@ -26,6 +26,7 @@ import type { ReactNode } from 'react'
26
26
  import { cx } from '../common/props'
27
27
  import type { BasaltProps } from '../common/props'
28
28
  import { relativeTime } from '../format'
29
+ import { numberFormat } from '../format/shared'
29
30
  import { IconSlot } from '../theme/icon-slot'
30
31
  import { RefreshGlyph } from './glyphs'
31
32
  import classes from './sync-button.module.css'
@@ -69,15 +70,43 @@ function toMillis(at: number | Date | null | undefined): number | undefined {
69
70
  * string (`now`, `1 min. ago`, …), so it is stable across calls within a bucket and a tick only
70
71
  * re-renders when the label changes. With no timestamp there is no subscription and no timer.
71
72
  */
72
- function useRelativeAge(at: number | Date | null | undefined): string | undefined {
73
+ function useRelativeAge(
74
+ at: number | Date | null | undefined,
75
+ format: (timestamp: number) => string = (timestamp) =>
76
+ relativeTime(timestamp, { style: 'short' }),
77
+ ): string | undefined {
73
78
  const timestamp = toMillis(at)
74
79
  return useSyncExternalStore(
75
80
  timestamp === undefined ? subscribeNever : subscribeAgeTick,
76
- () => (timestamp === undefined ? undefined : relativeTime(timestamp, { style: 'short' })),
81
+ () => (timestamp === undefined ? undefined : format(timestamp)),
77
82
  () => undefined,
78
83
  )
79
84
  }
80
85
 
86
+ const COMPACT_UNITS = [
87
+ { unit: 'day', seconds: 86_400 },
88
+ { unit: 'hour', seconds: 3_600 },
89
+ { unit: 'minute', seconds: 60 },
90
+ ] as const
91
+
92
+ /**
93
+ * The phone form's age: one number and a NARROW locale unit (`2m`, `3h`, `2d` in English, `2 Min.`
94
+ * in German), small enough to ride beside the glyph in the button at 390. `Intl.NumberFormat`'s
95
+ * unit style honours the `BasaltProvider` / `defineFormat` locale like every other format here.
96
+ * Under a minute it is the locale's own "now", the same bucket the long age uses, so the two never
97
+ * disagree about whether a sync just landed.
98
+ */
99
+ function compactAge(timestamp: number): string {
100
+ const seconds = Math.max(0, (Date.now() - timestamp) / 1000)
101
+ const step = COMPACT_UNITS.find((u) => seconds >= u.seconds)
102
+ if (step === undefined) return relativeTime(timestamp, { style: 'short' })
103
+ return numberFormat(undefined, {
104
+ style: 'unit',
105
+ unit: step.unit,
106
+ unitDisplay: 'narrow',
107
+ }).format(Math.floor(seconds / step.seconds))
108
+ }
109
+
81
110
  const subscribeNever = (): (() => void) => () => {}
82
111
 
83
112
  function subscribeAgeTick(onTick: () => void): () => void {
@@ -108,6 +137,7 @@ export function SyncButton({
108
137
  style,
109
138
  }: SyncButtonProps): ReactNode {
110
139
  const age = useRelativeAge(lastCompletedAt)
140
+ const shortAge = useRelativeAge(lastCompletedAt, compactAge)
111
141
  // Wherever the label is not painted — every `global` mount, and a `page` mount below `sm` — the
112
142
  // tooltip is where the age lives; an `error` outranks it everywhere. ONE tooltip, one mount.
113
143
  const tooltip = error ?? age
@@ -158,6 +188,7 @@ export function SyncButton({
158
188
  <Button
159
189
  variant="default"
160
190
  className={cx(classes.pageButton, className)}
191
+ {...(age !== undefined && { 'data-with-age': true })}
161
192
  {...(style !== undefined && { style })}
162
193
  leftSection={
163
194
  <IconSlot>
@@ -168,6 +199,11 @@ export function SyncButton({
168
199
  >
169
200
  <span className={classes.label}>{label}</span>
170
201
  {age !== undefined && <span className={classes.age}>{age}</span>}
202
+ {shortAge !== undefined && (
203
+ <span className={classes.ageCompact} data-sync-age="compact">
204
+ {shortAge}
205
+ </span>
206
+ )}
171
207
  </Button>
172
208
  )}
173
209
  </Tooltip>
@@ -5,6 +5,19 @@
5
5
  * row never wraps: the label truncates, the value is nowrap.
6
6
  */
7
7
 
8
+ /*
9
+ * The width container the wide layout keys on (a container cannot restyle its own grid), in every
10
+ * state. It is named `basalt-card` because the theme guard permits only the declared names; that
11
+ * shadows an enclosing card's container for the list's descendants only, and the query below measures
12
+ * the LIST's own inline size, not the card's. `inline-size: 100%` keeps it from collapsing to zero in
13
+ * a flex row or an auto track (size containment ignores content width).
14
+ */
15
+ .frame {
16
+ container: basalt-card / inline-size;
17
+ inline-size: 100%;
18
+ min-width: 0;
19
+ }
20
+
8
21
  .root {
9
22
  display: grid;
10
23
  grid-template-columns: minmax(0, 1fr) auto;
@@ -158,9 +171,79 @@
158
171
  text-overflow: ellipsis;
159
172
  }
160
173
 
174
+ /* The dot + word never outgrows its cell: the word truncates (its cell carries the full text in `title`). */
175
+ .root[data-variant='thin'] .secondary > :first-child {
176
+ max-inline-size: 100%;
177
+ }
178
+
161
179
  .root[data-variant='thin'] .secondary [data-verdict-word] {
162
180
  min-width: 0;
163
181
  overflow: hidden;
164
182
  text-overflow: ellipsis;
165
183
  white-space: nowrap;
166
184
  }
185
+
186
+ /*
187
+ * Wide (a container of 480px or more): one row, `[label][value][secondary][track]`. The label column fits the
188
+ * longest label (capped at 40% or 14rem, the rest truncates with its `title`), value and secondary are right-
189
+ * aligned and shared by every row, and the track takes the remaining width on the one scale — a
190
+ * full-scale bar ends at the track end, never under a value. Compact keeps the stacked thin layout.
191
+ */
192
+ @container basalt-card (width >= 480px) {
193
+ .root[data-variant='thin'] {
194
+ grid-template-columns: fit-content(min(40%, 14rem)) auto minmax(0, 1fr);
195
+ column-gap: var(--vx-space-stack-md, 0.75rem);
196
+ }
197
+
198
+ .root[data-variant='thin'][data-secondary] {
199
+ grid-template-columns: fit-content(min(40%, 14rem)) auto fit-content(30%) minmax(0, 1fr);
200
+ }
201
+
202
+ .root[data-variant='thin'] .row {
203
+ grid-template-rows: auto;
204
+ align-items: center;
205
+ padding-block: 0;
206
+ }
207
+
208
+ .root[data-variant='thin'] .track {
209
+ grid-column: auto;
210
+ align-self: center;
211
+ }
212
+
213
+ .root[data-variant='thin'] .label {
214
+ display: block;
215
+ white-space: nowrap;
216
+ text-overflow: ellipsis;
217
+ -webkit-line-clamp: unset;
218
+ line-clamp: unset;
219
+ }
220
+
221
+ .root[data-variant='thin'] .secondary {
222
+ text-align: end;
223
+ }
224
+
225
+ .root[data-variant='thin'][data-secondary-align='start'] .secondary {
226
+ text-align: start;
227
+ }
228
+ }
229
+
230
+ /*
231
+ * A column of DeltaBadges: a two-column grid, the glyph in a fixed-width slot and the figure (the badge's
232
+ * bare text) end-aligned in a tabular slot of four characters, so "▲ 9%" and "▲13%" share both their glyph
233
+ * x and their right edge. A zero delta has no glyph; an empty `::before` holds its slot. Scoped here because
234
+ * a hero metric has no column to line up with (D33: tabular figures only in a table-like column).
235
+ */
236
+ .secondary [data-delta] {
237
+ display: inline-grid;
238
+ grid-template-columns: 1em minmax(4ch, auto);
239
+ justify-items: end;
240
+ font-variant-numeric: tabular-nums;
241
+ }
242
+
243
+ .secondary [data-delta]:not(:has([data-delta-glyph]))::before {
244
+ content: '';
245
+ }
246
+
247
+ .secondary [data-delta-glyph] {
248
+ justify-self: center;
249
+ }
@@ -3,6 +3,7 @@
3
3
  * signature — so dot access stays verbatim under the package's strict flags.
4
4
  */
5
5
  declare const classes: {
6
+ readonly frame: string
6
7
  readonly root: string
7
8
  readonly row: string
8
9
  readonly track: string
@@ -12,7 +12,15 @@
12
12
  * thin bar with the value right-aligned on the label line; `variant="inline"` is the older heavy track
13
13
  * with the label inside it.
14
14
  *
15
- * Thin rows sit flush: no inline inset on the label or the rail.
15
+ * Thin rows sit flush: no inline inset on the label or the rail. In a container wider than the compact
16
+ * class (480px) a thin row reads `[label][value][secondary][track]` — the label column fits the longest
17
+ * label, the value and secondary columns are right-aligned and shared, and the track takes the rest on
18
+ * the one scale, so a name stays beside its value and a full-scale bar ends at the track end.
19
+ *
20
+ * The secondary column aligns by content (override: `secondaryAlign`): a text secondary (a status word,
21
+ * `StatusVerdict`/`StatusDot`) starts on one x so the dots line up; figures ("41%", "+€7"), numbers and a
22
+ * `DeltaBadge` end. A delta column also gets a fixed-width glyph slot and a tabular figure slot, so the
23
+ * glyphs AND the figures' right edges line up (a column of deltas is table-like, D33 allows tabular there).
16
24
  *
17
25
  * Colour law: bars are neutral. `accentLeader` (opt-in) lets the top row take the accent — the
18
26
  * leader bar, and nothing else. Each value is rendered as text, never only a bar length.
@@ -38,10 +46,13 @@
38
46
  * />
39
47
  */
40
48
  import { Skeleton, VisuallyHidden } from '@mantine/core'
49
+ import { isValidElement } from 'react'
41
50
  import type { ReactNode } from 'react'
42
51
  import { cx } from '../common/props'
43
52
  import type { BasaltProps } from '../common/props'
44
53
  import classes from './bar-list.module.css'
54
+ import { StatusDot } from '../theme/status-dot'
55
+ import { StatusVerdict } from '../theme/status-verdict'
45
56
  import { asText, barPercent } from './scale'
46
57
 
47
58
  type BarListItem = {
@@ -76,6 +87,11 @@ export type BarListProps = BasaltProps & {
76
87
  variant?: 'thin' | 'inline'
77
88
  /** The first row's bar takes the accent. Off by default. */
78
89
  accentLeader?: boolean
90
+ /**
91
+ * Which edge the secondary column aligns to. Default: by content — text (a status word, a status
92
+ * mark) starts, figures and other elements end.
93
+ */
94
+ secondaryAlign?: 'start' | 'end'
79
95
  /** Renders row-shaped skeletons. */
80
96
  loading?: boolean
81
97
  /** Skeleton rows while loading. Default 5. */
@@ -88,6 +104,19 @@ export type BarListProps = BasaltProps & {
88
104
  const hasContent = (node: ReactNode): boolean =>
89
105
  node !== undefined && node !== null && typeof node !== 'boolean'
90
106
 
107
+ const isFigure = (node: ReactNode): boolean =>
108
+ typeof node === 'number' || (typeof node === 'string' && /^[\s+\-−±▲▼]*[€$£¥]?\d/.test(node))
109
+
110
+ /**
111
+ * The column's edge by content. A string that is not a figure and a status mark (`StatusVerdict`,
112
+ * `StatusDot`) are text and start on one x so the dots line up; a number, a numeric string and any other
113
+ * element (a `DeltaBadge`) are figures and keep the end edge.
114
+ */
115
+ const isText = (node: ReactNode): boolean =>
116
+ typeof node === 'string'
117
+ ? !isFigure(node)
118
+ : isValidElement(node) && (node.type === StatusVerdict || node.type === StatusDot)
119
+
91
120
  export function BarList({
92
121
  label,
93
122
  items,
@@ -95,6 +124,7 @@ export function BarList({
95
124
  max,
96
125
  variant = 'thin',
97
126
  accentLeader = false,
127
+ secondaryAlign,
98
128
  loading = false,
99
129
  loadingRows = 5,
100
130
  emptyText = 'No data',
@@ -103,19 +133,23 @@ export function BarList({
103
133
  }: BarListProps) {
104
134
  if (loading) {
105
135
  return (
106
- <div className={cx(classes.root, className)} style={style} aria-busy="true">
107
- <VisuallyHidden>{`Loading ${label}`}</VisuallyHidden>
108
- {Array.from({ length: loadingRows }, (_, i) => (
109
- <Skeleton key={i} className={classes.skeletonRow} data-bar-skeleton />
110
- ))}
136
+ <div className={cx(classes.frame, className)} style={style}>
137
+ <div className={classes.root} aria-busy="true">
138
+ <VisuallyHidden>{`Loading ${label}`}</VisuallyHidden>
139
+ {Array.from({ length: loadingRows }, (_, i) => (
140
+ <Skeleton key={i} className={classes.skeletonRow} data-bar-skeleton />
141
+ ))}
142
+ </div>
111
143
  </div>
112
144
  )
113
145
  }
114
146
  if (items.length === 0) {
115
147
  return (
116
- <output className={cx(classes.root, className)} style={style} aria-label={label}>
117
- <span className={classes.empty}>{emptyText}</span>
118
- </output>
148
+ <div className={cx(classes.frame, className)} style={style}>
149
+ <output className={classes.root} aria-label={label}>
150
+ <span className={classes.empty}>{emptyText}</span>
151
+ </output>
152
+ </div>
119
153
  )
120
154
  }
121
155
 
@@ -127,70 +161,74 @@ export function BarList({
127
161
  )
128
162
  const thin = variant === 'thin'
129
163
  const hasSecondary = items.some((i) => hasContent(i.secondary))
164
+ const align = secondaryAlign ?? (items.some((i) => isText(i.secondary)) ? 'start' : 'end')
130
165
  return (
131
- // The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one.
132
- <ul
133
- className={cx(classes.root, className)}
134
- style={style}
135
- // oxlint-disable-next-line jsx-a11y/no-redundant-roles
136
- role="list"
137
- aria-label={label}
138
- data-secondary={hasSecondary ? '' : undefined}
139
- data-variant={variant}
140
- >
141
- {items.map((item, i) => {
142
- const isLeader = accentLeader && i === 0
143
- const rowScale = item.max ?? scale
144
- const labelNode = (
145
- <span className={classes.label} title={item.label}>
146
- {item.label}
147
- </span>
148
- )
149
- const tickName =
150
- item.tick === undefined
151
- ? ''
152
- : `${item.tickLabel ?? 'Threshold'} ${format(item.tick, 'value')}`
153
- const track = (
154
- <span className={classes.track} data-bar-track>
155
- {/* theme-allow hidden-inline-style — the width is the row's data (a % of its scale), not styling */}
156
- <span
157
- className={cx(classes.bar, isLeader && classes.leader)}
158
- style={{ width: `${barPercent(item.value, rowScale)}%` }}
159
- data-bar-fill=""
160
- data-bar-leader={isLeader ? '' : undefined}
161
- aria-hidden
162
- />
163
- {item.tick !== undefined && (
164
- // theme-allow hidden-inline-style — the position is the row's data (a % of its scale)
166
+ // The frame is the width container the wide layout keys on (a container cannot restyle its own grid).
167
+ <div className={cx(classes.frame, className)} style={style}>
168
+ {/* The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one. */}
169
+ <ul
170
+ className={classes.root}
171
+ // oxlint-disable-next-line jsx-a11y/no-redundant-roles
172
+ role="list"
173
+ aria-label={label}
174
+ data-secondary={hasSecondary ? '' : undefined}
175
+ data-secondary-align={hasSecondary ? align : undefined}
176
+ data-variant={variant}
177
+ >
178
+ {items.map((item, i) => {
179
+ const isLeader = accentLeader && i === 0
180
+ const rowScale = item.max ?? scale
181
+ const labelNode = (
182
+ <span className={classes.label} title={item.label}>
183
+ {item.label}
184
+ </span>
185
+ )
186
+ const tickName =
187
+ item.tick === undefined
188
+ ? ''
189
+ : `${item.tickLabel ?? 'Threshold'} ${format(item.tick, 'value')}`
190
+ const track = (
191
+ <span className={classes.track} data-bar-track>
192
+ {/* theme-allow hidden-inline-style — the width is the row's data (a % of its scale), not styling */}
165
193
  <span
166
- className={classes.tick}
167
- style={{ insetInlineStart: `${barPercent(item.tick, rowScale)}%` }}
168
- data-bar-tick=""
194
+ className={cx(classes.bar, isLeader && classes.leader)}
195
+ style={{ width: `${barPercent(item.value, rowScale)}%` }}
196
+ data-bar-fill=""
197
+ data-bar-leader={isLeader ? '' : undefined}
169
198
  aria-hidden
170
199
  />
171
- )}
172
- {!thin && labelNode}
173
- {/* Inside the track so it is never the row's last child (the value/secondary inset). */}
174
- {item.tick !== undefined && <VisuallyHidden>{tickName}</VisuallyHidden>}
175
- </span>
176
- )
177
- return (
178
- <li key={item.key ?? `${item.label}-${i}`} className={classes.row}>
179
- {thin && labelNode}
180
- {!thin && track}
181
- <span className={classes.value}>
182
- {Number.isFinite(item.value)
183
- ? item.max === undefined
184
- ? format(item.value, 'value')
185
- : `${format(item.value, 'value')} / ${format(item.max, 'max')}`
186
- : '—'}
200
+ {item.tick !== undefined && (
201
+ // theme-allow hidden-inline-style — the position is the row's data (a % of its scale)
202
+ <span
203
+ className={classes.tick}
204
+ style={{ insetInlineStart: `${barPercent(item.tick, rowScale)}%` }}
205
+ data-bar-tick=""
206
+ aria-hidden
207
+ />
208
+ )}
209
+ {!thin && labelNode}
210
+ {/* Inside the track so it is never the row's last child (the value/secondary inset). */}
211
+ {item.tick !== undefined && <VisuallyHidden>{tickName}</VisuallyHidden>}
187
212
  </span>
188
- {/* Kept empty on a row without one: the secondary column is shared, so every row has the cell. */}
189
- {hasSecondary && <span className={classes.secondary}>{item.secondary}</span>}
190
- {thin && track}
191
- </li>
192
- )
193
- })}
194
- </ul>
213
+ )
214
+ return (
215
+ <li key={item.key ?? `${item.label}-${i}`} className={classes.row}>
216
+ {thin && labelNode}
217
+ {!thin && track}
218
+ <span className={classes.value}>
219
+ {Number.isFinite(item.value)
220
+ ? item.max === undefined
221
+ ? format(item.value, 'value')
222
+ : `${format(item.value, 'value')} / ${format(item.max, 'max')}`
223
+ : '—'}
224
+ </span>
225
+ {/* Kept empty on a row without one: the secondary column is shared, so every row has the cell. */}
226
+ {hasSecondary && <span className={classes.secondary}>{item.secondary}</span>}
227
+ {thin && track}
228
+ </li>
229
+ )
230
+ })}
231
+ </ul>
232
+ </div>
195
233
  )
196
234
  }
@@ -87,8 +87,12 @@ export function DeltaBadge({
87
87
  const showGlyph = withGlyph && glyph !== undefined
88
88
 
89
89
  return (
90
- <span className={classes.deltaBadge} style={{ color: tone }}>
91
- {showGlyph && <span className={classes.deltaGlyph}>{glyph}</span>}
90
+ <span className={classes.deltaBadge} style={{ color: tone }} data-delta="">
91
+ {showGlyph && (
92
+ <span className={classes.deltaGlyph} data-delta-glyph="">
93
+ {glyph}
94
+ </span>
95
+ )}
92
96
  {format(value)}
93
97
  {period !== undefined && ' '}
94
98
  {period !== undefined && (
@@ -1,6 +1,7 @@
1
1
  export { WidgetHeader } from './widget-header'
2
2
  export { DeltaBadge } from './delta-badge'
3
3
  export { Section } from './section'
4
+ export { PageSummary, type PageSummaryProps } from './page-summary'
4
5
  export { StatCard, type StatCardBreakdownRow, type StatCardSparklineSize } from './stat-card'
5
6
  export { StatGroup } from './stat-group'
6
7
  export type { StatStripCell, StatStripRow } from './stat-strip'