basalt-ui 2.20.0 → 2.22.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 (289) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/MIGRATING.md +394 -12
  3. package/agent/agents/basalt-design-reviewer.md +22 -5
  4. package/agent/rules/basalt-tokens.md +3 -3
  5. package/agent/skills/basalt-design/SKILL.md +10 -23
  6. package/agent/skills/basalt-design/references/anti-defaults.md +24 -0
  7. package/agent/skills/basalt-design/references/catalogue.md +49 -0
  8. package/agent/skills/basalt-design/references/concept.md +36 -0
  9. package/agent/skills/basalt-design/references/encoding-rules.md +45 -0
  10. package/agent/skills/basalt-design/references/stat-tile.md +24 -0
  11. package/agent/templates/AGENTS-block.md.tpl +3 -3
  12. package/configs/oxlint-plugin.js +1 -0
  13. package/dist/charts/BandStrip.d.ts.map +1 -1
  14. package/dist/charts/BandStrip.js +27 -3
  15. package/dist/charts/Bars.d.ts.map +1 -1
  16. package/dist/charts/Bars.js +5 -0
  17. package/dist/charts/CartesianChart.d.ts +8 -0
  18. package/dist/charts/CartesianChart.d.ts.map +1 -1
  19. package/dist/charts/CartesianChart.js +8 -5
  20. package/dist/charts/ChartCard.d.ts +17 -4
  21. package/dist/charts/ChartCard.d.ts.map +1 -1
  22. package/dist/charts/ChartCard.js +33 -8
  23. package/dist/charts/DualPanel.d.ts.map +1 -1
  24. package/dist/charts/DualPanel.js +5 -8
  25. package/dist/charts/Heatmap.d.ts +12 -1
  26. package/dist/charts/Heatmap.d.ts.map +1 -1
  27. package/dist/charts/Heatmap.js +34 -5
  28. package/dist/charts/Lines.d.ts +3 -0
  29. package/dist/charts/Lines.d.ts.map +1 -1
  30. package/dist/charts/Lines.js +29 -6
  31. package/dist/charts/MirroredBars.d.ts.map +1 -1
  32. package/dist/charts/MirroredBars.js +4 -6
  33. package/dist/charts/Sparkline.d.ts +7 -1
  34. package/dist/charts/Sparkline.d.ts.map +1 -1
  35. package/dist/charts/Sparkline.js +39 -14
  36. package/dist/charts/StackedArea.d.ts +4 -1
  37. package/dist/charts/StackedArea.d.ts.map +1 -1
  38. package/dist/charts/StackedArea.js +9 -3
  39. package/dist/charts/band-fold.d.ts +20 -1
  40. package/dist/charts/band-fold.d.ts.map +1 -1
  41. package/dist/charts/band-fold.js +9 -0
  42. package/dist/charts/chart-box.module.css +19 -0
  43. package/dist/charts/chart-card.module.css +25 -0
  44. package/dist/charts/chart-legend.module.css +7 -0
  45. package/dist/charts/compile.d.ts +17 -6
  46. package/dist/charts/compile.d.ts.map +1 -1
  47. package/dist/charts/compile.js +145 -74
  48. package/dist/charts/labels.d.ts +15 -4
  49. package/dist/charts/labels.d.ts.map +1 -1
  50. package/dist/charts/labels.js +34 -10
  51. package/dist/charts/legend.d.ts +2 -0
  52. package/dist/charts/legend.d.ts.map +1 -1
  53. package/dist/charts/legend.js +7 -21
  54. package/dist/charts/marks.js +1 -1
  55. package/dist/charts/panel.d.ts +0 -6
  56. package/dist/charts/panel.d.ts.map +1 -1
  57. package/dist/charts/panel.js +1 -10
  58. package/dist/charts/ref-label.d.ts +26 -0
  59. package/dist/charts/ref-label.d.ts.map +1 -0
  60. package/dist/charts/ref-label.js +63 -0
  61. package/dist/charts/scales.d.ts +4 -1
  62. package/dist/charts/scales.d.ts.map +1 -1
  63. package/dist/charts/scales.js +14 -3
  64. package/dist/charts/sparkline.module.css +10 -11
  65. package/dist/charts/sparkline.module.css.d.ts +1 -2
  66. package/dist/charts/state.d.ts +7 -0
  67. package/dist/charts/state.d.ts.map +1 -1
  68. package/dist/charts/state.js +4 -1
  69. package/dist/charts/types.d.ts +14 -5
  70. package/dist/charts/types.d.ts.map +1 -1
  71. package/dist/cli/check-theme.d.ts.map +1 -1
  72. package/dist/cli/check-theme.js +3 -0
  73. package/dist/cli/doctor-upgrade.d.ts +1 -0
  74. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  75. package/dist/cli/doctor-upgrade.js +1 -0
  76. package/dist/cli/help.d.ts.map +1 -1
  77. package/dist/cli/help.js +3 -2
  78. package/dist/cli/index.d.ts +4 -2
  79. package/dist/cli/index.d.ts.map +1 -1
  80. package/dist/cli/index.js +27 -15
  81. package/dist/cli/init.d.ts +2 -0
  82. package/dist/cli/init.d.ts.map +1 -1
  83. package/dist/cli/init.js +71 -6
  84. package/dist/cli/shot/capture.d.ts +21 -2
  85. package/dist/cli/shot/capture.d.ts.map +1 -1
  86. package/dist/cli/shot/capture.js +200 -33
  87. package/dist/cli/shot/detect.d.ts +51 -0
  88. package/dist/cli/shot/detect.d.ts.map +1 -0
  89. package/dist/cli/shot/detect.js +409 -0
  90. package/dist/cli/shot/index.d.ts.map +1 -1
  91. package/dist/cli/shot/index.js +7 -4
  92. package/dist/cli/shot/measure.d.ts +2 -0
  93. package/dist/cli/shot/measure.d.ts.map +1 -1
  94. package/dist/cli/shot/measure.js +2 -0
  95. package/dist/cli/shot/playwright.d.ts +5 -2
  96. package/dist/cli/shot/playwright.d.ts.map +1 -1
  97. package/dist/cli/shot/types.d.ts +6 -1
  98. package/dist/cli/shot/types.d.ts.map +1 -1
  99. package/dist/cli/shot/types.js +4 -0
  100. package/dist/cli/sync.d.ts +2 -0
  101. package/dist/cli/sync.d.ts.map +1 -1
  102. package/dist/cli/sync.js +2 -2
  103. package/dist/common/retry-button.d.ts +12 -0
  104. package/dist/common/retry-button.d.ts.map +1 -0
  105. package/dist/common/retry-button.js +22 -0
  106. package/dist/common/retry-button.module.css +58 -0
  107. package/dist/common/retry-button.module.css.d.ts +8 -0
  108. package/dist/controls/controls.module.css +11 -1
  109. package/dist/controls/filter-pill.d.ts.map +1 -1
  110. package/dist/controls/filter-pill.js +1 -0
  111. package/dist/controls/sync-button.d.ts.map +1 -1
  112. package/dist/controls/sync-button.js +22 -3
  113. package/dist/controls/sync-button.module.css +34 -2
  114. package/dist/controls/sync-button.module.css.d.ts +1 -0
  115. package/dist/dashboard/bar-list.d.ts +5 -2
  116. package/dist/dashboard/bar-list.d.ts.map +1 -1
  117. package/dist/dashboard/bar-list.js +9 -10
  118. package/dist/dashboard/bar-list.module.css +53 -0
  119. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  120. package/dist/dashboard/index.d.ts +1 -0
  121. package/dist/dashboard/index.d.ts.map +1 -1
  122. package/dist/dashboard/index.js +2 -0
  123. package/dist/dashboard/meter-model.d.ts +108 -6
  124. package/dist/dashboard/meter-model.d.ts.map +1 -1
  125. package/dist/dashboard/meter-model.js +123 -19
  126. package/dist/dashboard/meter-parts.d.ts +8 -0
  127. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  128. package/dist/dashboard/meter-parts.js +345 -146
  129. package/dist/dashboard/meter.d.ts +50 -63
  130. package/dist/dashboard/meter.d.ts.map +1 -1
  131. package/dist/dashboard/meter.js +24 -3
  132. package/dist/dashboard/meter.module.css +79 -65
  133. package/dist/dashboard/meter.module.css.d.ts +7 -7
  134. package/dist/dashboard/page-summary.d.ts +20 -0
  135. package/dist/dashboard/page-summary.d.ts.map +1 -0
  136. package/dist/dashboard/page-summary.js +28 -0
  137. package/dist/dashboard/page-summary.module.css +89 -0
  138. package/dist/dashboard/page-summary.module.css.d.ts +15 -0
  139. package/dist/dashboard/query-state.d.ts +1 -1
  140. package/dist/dashboard/query-state.d.ts.map +1 -1
  141. package/dist/dashboard/query-state.js +3 -2
  142. package/dist/dashboard/section.d.ts +25 -2
  143. package/dist/dashboard/section.d.ts.map +1 -1
  144. package/dist/dashboard/section.js +10 -5
  145. package/dist/dashboard/section.module.css +23 -0
  146. package/dist/dashboard/section.module.css.d.ts +1 -0
  147. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  148. package/dist/dashboard/stat-card-parts.js +1 -1
  149. package/dist/dashboard/stat-card.d.ts +4 -2
  150. package/dist/dashboard/stat-card.d.ts.map +1 -1
  151. package/dist/dashboard/stat-card.js +7 -4
  152. package/dist/dashboard/stat-card.module.css +17 -0
  153. package/dist/dashboard/stat-strip.d.ts +24 -1
  154. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  155. package/dist/dashboard/stat-strip.js +97 -39
  156. package/dist/dashboard/stat-strip.module.css +147 -17
  157. package/dist/dashboard/stat-strip.module.css.d.ts +8 -0
  158. package/dist/dashboard/visual-slot.d.ts +8 -0
  159. package/dist/dashboard/visual-slot.d.ts.map +1 -0
  160. package/dist/dashboard/visual-slot.js +7 -0
  161. package/dist/guard/index.d.ts +15 -2
  162. package/dist/guard/index.d.ts.map +1 -1
  163. package/dist/guard/index.js +14 -0
  164. package/dist/guard/palette.d.ts +51 -0
  165. package/dist/guard/palette.d.ts.map +1 -0
  166. package/dist/guard/palette.js +190 -0
  167. package/dist/guard/series-file.d.ts +15 -0
  168. package/dist/guard/series-file.d.ts.map +1 -0
  169. package/dist/guard/series-file.js +29 -0
  170. package/dist/guard/types.d.ts +3 -3
  171. package/dist/guard/types.d.ts.map +1 -1
  172. package/dist/guard/vx-names.d.ts.map +1 -1
  173. package/dist/guard/vx-names.js +2 -0
  174. package/dist/index.d.ts +1 -1
  175. package/dist/index.d.ts.map +1 -1
  176. package/dist/index.js +3 -1
  177. package/dist/styles.css +34 -2
  178. package/dist/surfaces.d.ts +1 -1
  179. package/dist/surfaces.d.ts.map +1 -1
  180. package/dist/surfaces.js +2 -0
  181. package/dist/theme/chrome-vars.d.ts +20 -5
  182. package/dist/theme/chrome-vars.d.ts.map +1 -1
  183. package/dist/theme/chrome-vars.js +46 -3
  184. package/dist/theme/controls.module.css +33 -0
  185. package/dist/theme/controls.module.css.d.ts +1 -0
  186. package/dist/theme/index.d.ts.map +1 -1
  187. package/dist/theme/index.js +11 -5
  188. package/dist/tokens/core.d.ts +2 -1
  189. package/dist/tokens/core.d.ts.map +1 -1
  190. package/dist/tokens/core.js +6 -1
  191. package/dist/tokens/derive.d.ts +3 -1
  192. package/dist/tokens/derive.d.ts.map +1 -1
  193. package/dist/tokens/derive.js +16 -1
  194. package/dist/tokens/oklab.d.ts +28 -0
  195. package/dist/tokens/oklab.d.ts.map +1 -0
  196. package/dist/tokens/oklab.js +73 -0
  197. package/dist/tokens/palette.d.ts +4 -0
  198. package/dist/tokens/palette.d.ts.map +1 -1
  199. package/dist/tokens/palette.js +4 -0
  200. package/dist/tokens/status-text.d.ts.map +1 -1
  201. package/dist/tokens/status-text.js +3 -1
  202. package/llms.txt +43 -23
  203. package/package.json +1 -1
  204. package/src/charts/BandStrip.tsx +33 -3
  205. package/src/charts/Bars.tsx +6 -0
  206. package/src/charts/CartesianChart.tsx +16 -3
  207. package/src/charts/ChartCard.tsx +43 -7
  208. package/src/charts/DualPanel.tsx +3 -6
  209. package/src/charts/Heatmap.tsx +54 -5
  210. package/src/charts/Lines.tsx +56 -10
  211. package/src/charts/MirroredBars.tsx +3 -5
  212. package/src/charts/Sparkline.tsx +50 -13
  213. package/src/charts/StackedArea.tsx +14 -4
  214. package/src/charts/band-fold.ts +31 -1
  215. package/src/charts/chart-box.module.css +19 -0
  216. package/src/charts/chart-card.module.css +25 -0
  217. package/src/charts/chart-legend.module.css +7 -0
  218. package/src/charts/compile.ts +210 -85
  219. package/src/charts/labels.ts +48 -14
  220. package/src/charts/legend.tsx +10 -20
  221. package/src/charts/marks.ts +1 -1
  222. package/src/charts/panel.tsx +1 -16
  223. package/src/charts/ref-label.ts +104 -0
  224. package/src/charts/scales.ts +22 -2
  225. package/src/charts/sparkline.module.css +10 -11
  226. package/src/charts/sparkline.module.css.d.ts +1 -2
  227. package/src/charts/state.tsx +12 -1
  228. package/src/charts/types.ts +14 -5
  229. package/src/cli/check-theme.ts +3 -0
  230. package/src/cli/doctor-upgrade.ts +1 -1
  231. package/src/cli/help.ts +18 -1
  232. package/src/cli/index.ts +48 -17
  233. package/src/cli/init.ts +102 -4
  234. package/src/cli/shot/capture.ts +266 -34
  235. package/src/cli/shot/detect.ts +550 -0
  236. package/src/cli/shot/index.ts +8 -4
  237. package/src/cli/shot/measure.ts +4 -0
  238. package/src/cli/shot/playwright.ts +2 -2
  239. package/src/cli/shot/types.ts +8 -1
  240. package/src/cli/sync.ts +4 -2
  241. package/src/common/retry-button.module.css +58 -0
  242. package/src/common/retry-button.module.css.d.ts +8 -0
  243. package/src/common/retry-button.tsx +29 -0
  244. package/src/controls/controls.module.css +11 -1
  245. package/src/controls/filter-pill.tsx +2 -0
  246. package/src/controls/sync-button.module.css +34 -2
  247. package/src/controls/sync-button.module.css.d.ts +1 -0
  248. package/src/controls/sync-button.tsx +40 -4
  249. package/src/dashboard/bar-list.module.css +53 -0
  250. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  251. package/src/dashboard/bar-list.tsx +88 -76
  252. package/src/dashboard/index.ts +1 -0
  253. package/src/dashboard/meter-model.ts +265 -28
  254. package/src/dashboard/meter-parts.tsx +424 -163
  255. package/src/dashboard/meter.module.css +79 -65
  256. package/src/dashboard/meter.module.css.d.ts +7 -7
  257. package/src/dashboard/meter.tsx +77 -17
  258. package/src/dashboard/page-summary.module.css +89 -0
  259. package/src/dashboard/page-summary.module.css.d.ts +15 -0
  260. package/src/dashboard/page-summary.tsx +95 -0
  261. package/src/dashboard/query-state.tsx +4 -7
  262. package/src/dashboard/section.module.css +23 -0
  263. package/src/dashboard/section.module.css.d.ts +1 -0
  264. package/src/dashboard/section.tsx +59 -11
  265. package/src/dashboard/stat-card-parts.tsx +5 -1
  266. package/src/dashboard/stat-card.module.css +17 -0
  267. package/src/dashboard/stat-card.tsx +14 -5
  268. package/src/dashboard/stat-strip.module.css +147 -17
  269. package/src/dashboard/stat-strip.module.css.d.ts +8 -0
  270. package/src/dashboard/stat-strip.tsx +182 -56
  271. package/src/dashboard/visual-slot.ts +17 -0
  272. package/src/guard/index.ts +16 -4
  273. package/src/guard/palette.ts +261 -0
  274. package/src/guard/series-file.ts +51 -0
  275. package/src/guard/types.ts +3 -2
  276. package/src/guard/vx-names.ts +2 -0
  277. package/src/index.ts +2 -0
  278. package/src/styles.css +34 -2
  279. package/src/surfaces.ts +2 -0
  280. package/src/theme/__snapshots__/plain-theme.test.ts.snap +220 -60
  281. package/src/theme/chrome-vars.ts +77 -8
  282. package/src/theme/controls.module.css +33 -0
  283. package/src/theme/controls.module.css.d.ts +1 -0
  284. package/src/theme/index.ts +18 -5
  285. package/src/tokens/core.ts +4 -1
  286. package/src/tokens/derive.ts +32 -3
  287. package/src/tokens/oklab.ts +97 -0
  288. package/src/tokens/palette.ts +4 -0
  289. package/src/tokens/status-text.ts +2 -0
package/src/cli/sync.ts CHANGED
@@ -57,6 +57,8 @@ export type SyncOptions = {
57
57
  check?: boolean
58
58
  /** The raw flag list, read for `--tokens-only` / `--framework` exactly as check-theme reads it. */
59
59
  flags?: readonly string[]
60
+ /** Shipped-source root; defaults to this package. Tests point it at a scratch package. */
61
+ pkgRoot?: string
60
62
  }
61
63
 
62
64
  /**
@@ -144,11 +146,11 @@ export function sync(opts: SyncOptions = {}, invocationCwd: string = process.cwd
144
146
 
145
147
  // Before renderContext, which reads `basalt.roots` for the roots-derived template variables.
146
148
  const rootsState = reconcileRoots(cwd, { write: opts.check !== true })
147
- const ctx = renderContext(cwd, ruleRootsFor(rootsState))
149
+ const ctx = renderContext(cwd, ruleRootsFor(rootsState), opts.pkgRoot)
148
150
  const manifest = readManifest(cwd)
149
151
  const placement = resolvePlacement(cwd)
150
152
  const { skip: seedSkip, skipped } = routerSeedPlan(cwd, placement.appRel)
151
- const files = managedFiles(placement).filter((f) => !skipped.has(f.dest))
153
+ const files = managedFiles(placement, ctx.pkgRoot).filter((f) => !skipped.has(f.dest))
152
154
 
153
155
  let updated = 0
154
156
  // `created` and `recreated` were one counter, and `0 updated, 20 recreated` is what a full
@@ -0,0 +1,58 @@
1
+ /*
2
+ * The one Retry. ErrorState (Mantine, StatCard / pages), ChartCard's placeholder and a strip cell's
3
+ * error all render this, so the three read as one button. It is a plain element because `./charts`
4
+ * resolves with no Mantine, and it is styled to be a Mantine `size="xs" variant="default"` Button
5
+ * reading the same `--vx-*` tokens the theme binds that button to: panel fill (elevated on hover), no
6
+ * border, `shadow-raised`, the control radius, the xs type size, the theme's inline padding step and
7
+ * Mantine's 30px xs height. `--mantine-scale` carries the app's scale knob, 1 where Mantine is absent.
8
+ */
9
+ .retry {
10
+ display: inline-flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ flex: none;
14
+ box-sizing: border-box;
15
+ height: calc(1.875rem * var(--mantine-scale, 1));
16
+ padding-block: 0;
17
+ padding-inline: calc(var(--vx-space-stack-md, 0.75rem) * var(--mantine-scale, 1));
18
+ border: calc(0.0625rem * var(--mantine-scale, 1)) solid transparent;
19
+ border-radius: var(--vx-radius-ctrl);
20
+ background: var(--vx-surface-panel);
21
+ box-shadow: var(--vx-shadow-raised);
22
+ color: var(--mantine-color-default-color, var(--vx-ink));
23
+ font: inherit;
24
+ font-size: var(--vx-text-xs);
25
+ font-weight: 500;
26
+ line-height: 1;
27
+ white-space: nowrap;
28
+ cursor: pointer;
29
+ user-select: none;
30
+ transition: box-shadow 120ms ease;
31
+ }
32
+
33
+ .retry:focus-visible {
34
+ outline: calc(0.125rem * var(--mantine-scale, 1)) solid
35
+ var(--mantine-primary-color-filled, var(--vx-accent-fill));
36
+ outline-offset: calc(0.125rem * var(--mantine-scale, 1));
37
+ }
38
+
39
+ /* Hover is a pointer affordance: a touch tap would leave it stuck on. */
40
+ @media (hover: hover) {
41
+ .retry:hover:not(:disabled) {
42
+ background: var(--vx-surface-elevated);
43
+ }
44
+ }
45
+
46
+ /* Busy is Mantine's disabled paint: its own disabled colour and background, flat, no border. */
47
+ .retry:disabled {
48
+ background: var(--mantine-color-disabled, var(--vx-surface-subtle));
49
+ color: var(--mantine-color-disabled-color, var(--vx-muted));
50
+ box-shadow: none;
51
+ cursor: not-allowed;
52
+ }
53
+
54
+ @media (prefers-reduced-motion: reduce) {
55
+ .retry {
56
+ transition: none;
57
+ }
58
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
3
+ * signature — so dot access stays verbatim under the package's strict flags.
4
+ */
5
+ declare const classes: {
6
+ readonly retry: string
7
+ }
8
+ export default classes
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The one Retry button of the shared error anatomy (status dot + word + message + Retry). Internal:
3
+ * `ErrorState`, `ChartCard`'s placeholder and a strip cell's error all render it, so they cannot
4
+ * drift. Mantine-free — `./charts` uses it with no `@mantine/*` installed.
5
+ */
6
+ import type { ReactElement } from 'react'
7
+ import classes from './retry-button.module.css'
8
+
9
+ export function RetryButton({
10
+ onClick,
11
+ retrying = false,
12
+ }: {
13
+ onClick: () => void
14
+ /** A refetch is in flight: inert and marked busy. */
15
+ retrying?: boolean
16
+ }): ReactElement {
17
+ return (
18
+ <button
19
+ type="button"
20
+ className={classes.retry}
21
+ data-basalt-retry=""
22
+ disabled={retrying}
23
+ {...(retrying && { 'aria-busy': true })}
24
+ onClick={onClick}
25
+ >
26
+ Retry
27
+ </button>
28
+ )
29
+ }
@@ -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;
@@ -164,3 +177,43 @@
164
177
  text-overflow: ellipsis;
165
178
  white-space: nowrap;
166
179
  }
180
+
181
+ /*
182
+ * Wide (a container of 480px or more): one row, `[label][value][secondary][track]`. The label column fits the
183
+ * longest label (capped at 40% or 14rem, the rest truncates with its `title`), value and secondary are right-
184
+ * aligned and shared by every row, and the track takes the remaining width on the one scale — a
185
+ * full-scale bar ends at the track end, never under a value. Compact keeps the stacked thin layout.
186
+ */
187
+ @container basalt-card (width >= 480px) {
188
+ .root[data-variant='thin'] {
189
+ grid-template-columns: fit-content(min(40%, 14rem)) auto minmax(0, 1fr);
190
+ column-gap: var(--vx-space-stack-md, 0.75rem);
191
+ }
192
+
193
+ .root[data-variant='thin'][data-secondary] {
194
+ grid-template-columns: fit-content(min(40%, 14rem)) auto fit-content(30%) minmax(0, 1fr);
195
+ }
196
+
197
+ .root[data-variant='thin'] .row {
198
+ grid-template-rows: auto;
199
+ align-items: center;
200
+ padding-block: 0;
201
+ }
202
+
203
+ .root[data-variant='thin'] .track {
204
+ grid-column: auto;
205
+ align-self: center;
206
+ }
207
+
208
+ .root[data-variant='thin'] .label {
209
+ display: block;
210
+ white-space: nowrap;
211
+ text-overflow: ellipsis;
212
+ -webkit-line-clamp: unset;
213
+ line-clamp: unset;
214
+ }
215
+
216
+ .root[data-variant='thin'] .secondary {
217
+ text-align: end;
218
+ }
219
+ }
@@ -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
@@ -8,10 +8,14 @@
8
8
  * A row may carry its own `max` (points of 40 / 35 / 25): its bar fills value / row.max and the value
9
9
  * column reads "32 / 40". The shared scale — `max` prop, else the largest value — is computed over the
10
10
  * rows WITHOUT their own `max` only. A row's `tick` (on that row's scale) draws a hairline across the
11
- * bar, named for assistive tech. `variant="thin"` puts the label on its own line above a thin bar with
12
- * the value right-aligned on the label line.
11
+ * bar, named for assistive tech. The default (`variant="thin"`) puts the label on its own line above a
12
+ * thin bar with the value right-aligned on the label line; `variant="inline"` is the older heavy track
13
+ * with the label inside it.
13
14
  *
14
- * 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.
15
19
  *
16
20
  * Colour law: bars are neutral. `accentLeader` (opt-in) lets the top row take the accent — the
17
21
  * leader bar, and nothing else. Each value is rendered as text, never only a bar length.
@@ -22,10 +26,9 @@
22
26
  * // Recovery contributors on a fixed 0–100 scale, the qualitative level as the secondary value:
23
27
  * <BarList label="Recovery contributors" max={100} items={[{ label: 'Sleep', value: 82, secondary: 'Good' }]} />
24
28
  *
25
- * // Points of different maxima, thin rows, a threshold tick ("32 / 40 pts"; the tick is named for AT):
29
+ * // Points of different maxima, a threshold tick ("32 / 40 pts"; the tick is named for AT):
26
30
  * <BarList
27
31
  * label="Recovery contributors"
28
- * variant="thin"
29
32
  * format={(n, part) => (part === 'max' ? `${n} pts` : String(n))}
30
33
  * items={[{ label: 'Sleep', value: 32, max: 40, tick: 30, tickLabel: 'Target' }, { label: 'HRV', value: 14, max: 35 }]}
31
34
  * />
@@ -69,8 +72,11 @@ export type BarListProps = BasaltProps & {
69
72
  format?: (value: number, part: 'value' | 'max') => string
70
73
  /** Scale end shared by rows without their own `max`. Default: the largest of those rows' values. */
71
74
  max?: number
72
- /** `thin`: label on its own line above a thin bar, value right-aligned on that line. */
73
- variant?: 'default' | 'thin'
75
+ /**
76
+ * `thin` (default): label on its own line above a thin bar, value right-aligned on that line.
77
+ * `inline`: the label sits inside a heavier track, the value outside it.
78
+ */
79
+ variant?: 'thin' | 'inline'
74
80
  /** The first row's bar takes the accent. Off by default. */
75
81
  accentLeader?: boolean
76
82
  /** Renders row-shaped skeletons. */
@@ -90,7 +96,7 @@ export function BarList({
90
96
  items,
91
97
  format = asText,
92
98
  max,
93
- variant = 'default',
99
+ variant = 'thin',
94
100
  accentLeader = false,
95
101
  loading = false,
96
102
  loadingRows = 5,
@@ -100,19 +106,23 @@ export function BarList({
100
106
  }: BarListProps) {
101
107
  if (loading) {
102
108
  return (
103
- <div className={cx(classes.root, className)} style={style} aria-busy="true">
104
- <VisuallyHidden>{`Loading ${label}`}</VisuallyHidden>
105
- {Array.from({ length: loadingRows }, (_, i) => (
106
- <Skeleton key={i} className={classes.skeletonRow} data-bar-skeleton />
107
- ))}
109
+ <div className={cx(classes.frame, className)} style={style}>
110
+ <div className={classes.root} aria-busy="true">
111
+ <VisuallyHidden>{`Loading ${label}`}</VisuallyHidden>
112
+ {Array.from({ length: loadingRows }, (_, i) => (
113
+ <Skeleton key={i} className={classes.skeletonRow} data-bar-skeleton />
114
+ ))}
115
+ </div>
108
116
  </div>
109
117
  )
110
118
  }
111
119
  if (items.length === 0) {
112
120
  return (
113
- <output className={cx(classes.root, className)} style={style} aria-label={label}>
114
- <span className={classes.empty}>{emptyText}</span>
115
- </output>
121
+ <div className={cx(classes.frame, className)} style={style}>
122
+ <output className={classes.root} aria-label={label}>
123
+ <span className={classes.empty}>{emptyText}</span>
124
+ </output>
125
+ </div>
116
126
  )
117
127
  }
118
128
 
@@ -125,69 +135,71 @@ export function BarList({
125
135
  const thin = variant === 'thin'
126
136
  const hasSecondary = items.some((i) => hasContent(i.secondary))
127
137
  return (
128
- // The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one.
129
- <ul
130
- className={cx(classes.root, className)}
131
- style={style}
132
- // oxlint-disable-next-line jsx-a11y/no-redundant-roles
133
- role="list"
134
- aria-label={label}
135
- data-secondary={hasSecondary ? '' : undefined}
136
- data-variant={thin ? 'thin' : undefined}
137
- >
138
- {items.map((item, i) => {
139
- const isLeader = accentLeader && i === 0
140
- const rowScale = item.max ?? scale
141
- const labelNode = (
142
- <span className={classes.label} title={item.label}>
143
- {item.label}
144
- </span>
145
- )
146
- const tickName =
147
- item.tick === undefined
148
- ? ''
149
- : `${item.tickLabel ?? 'Threshold'} ${format(item.tick, 'value')}`
150
- const track = (
151
- <span className={classes.track} data-bar-track>
152
- {/* theme-allow hidden-inline-style — the width is the row's data (a % of its scale), not styling */}
153
- <span
154
- className={cx(classes.bar, isLeader && classes.leader)}
155
- style={{ width: `${barPercent(item.value, rowScale)}%` }}
156
- data-bar-fill=""
157
- data-bar-leader={isLeader ? '' : undefined}
158
- aria-hidden
159
- />
160
- {item.tick !== undefined && (
161
- // theme-allow hidden-inline-style — the position is the row's data (a % of its scale)
138
+ // The frame is the width container the wide layout keys on (a container cannot restyle its own grid).
139
+ <div className={cx(classes.frame, className)} style={style}>
140
+ {/* The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one. */}
141
+ <ul
142
+ className={classes.root}
143
+ // oxlint-disable-next-line jsx-a11y/no-redundant-roles
144
+ role="list"
145
+ aria-label={label}
146
+ data-secondary={hasSecondary ? '' : undefined}
147
+ data-variant={variant}
148
+ >
149
+ {items.map((item, i) => {
150
+ const isLeader = accentLeader && i === 0
151
+ const rowScale = item.max ?? scale
152
+ const labelNode = (
153
+ <span className={classes.label} title={item.label}>
154
+ {item.label}
155
+ </span>
156
+ )
157
+ const tickName =
158
+ item.tick === undefined
159
+ ? ''
160
+ : `${item.tickLabel ?? 'Threshold'} ${format(item.tick, 'value')}`
161
+ const track = (
162
+ <span className={classes.track} data-bar-track>
163
+ {/* theme-allow hidden-inline-style — the width is the row's data (a % of its scale), not styling */}
162
164
  <span
163
- className={classes.tick}
164
- style={{ insetInlineStart: `${barPercent(item.tick, rowScale)}%` }}
165
- data-bar-tick=""
165
+ className={cx(classes.bar, isLeader && classes.leader)}
166
+ style={{ width: `${barPercent(item.value, rowScale)}%` }}
167
+ data-bar-fill=""
168
+ data-bar-leader={isLeader ? '' : undefined}
166
169
  aria-hidden
167
170
  />
168
- )}
169
- {!thin && labelNode}
170
- {/* Inside the track so it is never the row's last child (the value/secondary inset). */}
171
- {item.tick !== undefined && <VisuallyHidden>{tickName}</VisuallyHidden>}
172
- </span>
173
- )
174
- return (
175
- <li key={item.key ?? `${item.label}-${i}`} className={classes.row}>
176
- {thin && labelNode}
177
- {!thin && track}
178
- <span className={classes.value}>
179
- {Number.isFinite(item.value)
180
- ? item.max === undefined
181
- ? format(item.value, 'value')
182
- : `${format(item.value, 'value')} / ${format(item.max, 'max')}`
183
- : '—'}
171
+ {item.tick !== undefined && (
172
+ // theme-allow hidden-inline-style — the position is the row's data (a % of its scale)
173
+ <span
174
+ className={classes.tick}
175
+ style={{ insetInlineStart: `${barPercent(item.tick, rowScale)}%` }}
176
+ data-bar-tick=""
177
+ aria-hidden
178
+ />
179
+ )}
180
+ {!thin && labelNode}
181
+ {/* Inside the track so it is never the row's last child (the value/secondary inset). */}
182
+ {item.tick !== undefined && <VisuallyHidden>{tickName}</VisuallyHidden>}
184
183
  </span>
185
- {/* Kept empty on a row without one: the secondary column is shared, so every row has the cell. */}
186
- {hasSecondary && <span className={classes.secondary}>{item.secondary}</span>}
187
- {thin && track}
188
- </li>
189
- )
190
- })}
191
- </ul>
184
+ )
185
+ return (
186
+ <li key={item.key ?? `${item.label}-${i}`} className={classes.row}>
187
+ {thin && labelNode}
188
+ {!thin && track}
189
+ <span className={classes.value}>
190
+ {Number.isFinite(item.value)
191
+ ? item.max === undefined
192
+ ? format(item.value, 'value')
193
+ : `${format(item.value, 'value')} / ${format(item.max, 'max')}`
194
+ : '—'}
195
+ </span>
196
+ {/* Kept empty on a row without one: the secondary column is shared, so every row has the cell. */}
197
+ {hasSecondary && <span className={classes.secondary}>{item.secondary}</span>}
198
+ {thin && track}
199
+ </li>
200
+ )
201
+ })}
202
+ </ul>
203
+ </div>
192
204
  )
193
205
  }
@@ -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'