basalt-ui 2.19.0 → 2.20.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 (157) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/MIGRATING.md +174 -12
  3. package/agent/rules/basalt-charts.md +1 -1
  4. package/agent/rules/basalt-mantine.md +1 -1
  5. package/agent/skills/basalt-app/SKILL.md +1 -1
  6. package/agent/skills/basalt-design/SKILL.md +1 -1
  7. package/agent/templates/DESIGN.md.tpl +1 -1
  8. package/configs/oxlint-plugin.js +33 -19
  9. package/configs/oxlint-plugin.test.ts +32 -2
  10. package/dist/charts/ChartCard.d.ts +28 -3
  11. package/dist/charts/ChartCard.d.ts.map +1 -1
  12. package/dist/charts/ChartCard.js +33 -11
  13. package/dist/charts/Donut.d.ts.map +1 -1
  14. package/dist/charts/Donut.js +13 -1
  15. package/dist/charts/Heatmap.js +1 -1
  16. package/dist/charts/Sparkline.d.ts +7 -1
  17. package/dist/charts/Sparkline.d.ts.map +1 -1
  18. package/dist/charts/Sparkline.js +137 -18
  19. package/dist/charts/box.d.ts +2 -0
  20. package/dist/charts/box.d.ts.map +1 -1
  21. package/dist/charts/box.js +2 -0
  22. package/dist/charts/chart-box.module.css +30 -0
  23. package/dist/charts/chart-box.module.css.d.ts +1 -0
  24. package/dist/charts/chart-card.module.css +47 -0
  25. package/dist/charts/chart-card.module.css.d.ts +7 -0
  26. package/dist/charts/compile.d.ts.map +1 -1
  27. package/dist/charts/compile.js +35 -8
  28. package/dist/charts/host.d.ts.map +1 -1
  29. package/dist/charts/host.js +2 -1
  30. package/dist/charts/index.d.ts +1 -1
  31. package/dist/charts/index.d.ts.map +1 -1
  32. package/dist/charts/sparkline.module.css +59 -0
  33. package/dist/charts/sparkline.module.css.d.ts +13 -0
  34. package/dist/charts/state.d.ts.map +1 -1
  35. package/dist/charts/state.js +32 -4
  36. package/dist/charts/types.d.ts +6 -0
  37. package/dist/charts/types.d.ts.map +1 -1
  38. package/dist/controls/sync-button.d.ts +3 -0
  39. package/dist/controls/sync-button.d.ts.map +1 -1
  40. package/dist/dashboard/bar-list.d.ts +15 -4
  41. package/dist/dashboard/bar-list.d.ts.map +1 -1
  42. package/dist/dashboard/bar-list.js +39 -15
  43. package/dist/dashboard/bar-list.module.css +77 -2
  44. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  45. package/dist/dashboard/delta-badge.d.ts +8 -3
  46. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  47. package/dist/dashboard/delta-badge.js +9 -2
  48. package/dist/dashboard/index.d.ts +2 -0
  49. package/dist/dashboard/index.d.ts.map +1 -1
  50. package/dist/dashboard/meter-model.d.ts +19 -0
  51. package/dist/dashboard/meter-model.d.ts.map +1 -1
  52. package/dist/dashboard/meter-model.js +18 -1
  53. package/dist/dashboard/meter-parts.d.ts +5 -1
  54. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  55. package/dist/dashboard/meter-parts.js +114 -74
  56. package/dist/dashboard/meter.d.ts +22 -1
  57. package/dist/dashboard/meter.d.ts.map +1 -1
  58. package/dist/dashboard/meter.js +4 -1
  59. package/dist/dashboard/meter.module.css +90 -12
  60. package/dist/dashboard/meter.module.css.d.ts +5 -0
  61. package/dist/dashboard/query-state.d.ts.map +1 -1
  62. package/dist/dashboard/query-state.js +14 -9
  63. package/dist/dashboard/settings-section.d.ts.map +1 -1
  64. package/dist/dashboard/settings-section.js +14 -25
  65. package/dist/dashboard/stat-card-parts.js +1 -1
  66. package/dist/dashboard/stat-card.d.ts +1 -1
  67. package/dist/dashboard/stat-card.d.ts.map +1 -1
  68. package/dist/dashboard/stat-card.js +3 -6
  69. package/dist/dashboard/stat-card.module.css +15 -7
  70. package/dist/dashboard/stat-group.d.ts +11 -2
  71. package/dist/dashboard/stat-group.d.ts.map +1 -1
  72. package/dist/dashboard/stat-group.js +9 -7
  73. package/dist/dashboard/stat-strip.d.ts +50 -0
  74. package/dist/dashboard/stat-strip.d.ts.map +1 -0
  75. package/dist/dashboard/stat-strip.js +85 -0
  76. package/dist/dashboard/stat-strip.module.css +208 -0
  77. package/dist/dashboard/stat-strip.module.css.d.ts +28 -0
  78. package/dist/dashboard/widget-header.d.ts +3 -3
  79. package/dist/dashboard/widget-header.module.css +10 -6
  80. package/dist/format/date.d.ts.map +1 -1
  81. package/dist/format/date.js +4 -3
  82. package/dist/format/shared.d.ts +6 -0
  83. package/dist/format/shared.d.ts.map +1 -1
  84. package/dist/format/shared.js +6 -2
  85. package/dist/guard/index.d.ts +1 -1
  86. package/dist/guard/index.js +1 -1
  87. package/dist/index.d.ts +3 -1
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +4 -0
  90. package/dist/styles.css +6 -0
  91. package/dist/theme/card-inset.module.css +76 -0
  92. package/dist/theme/card-inset.module.css.d.ts +9 -0
  93. package/dist/theme/controls.module.css +3 -0
  94. package/dist/theme/index.d.ts.map +1 -1
  95. package/dist/theme/index.js +23 -0
  96. package/dist/theme/nav-link.module.css +8 -10
  97. package/dist/theme/status-dot.d.ts +3 -2
  98. package/dist/theme/status-dot.d.ts.map +1 -1
  99. package/dist/theme/status-dot.js +12 -3
  100. package/dist/theme/status-verdict.d.ts +3 -2
  101. package/dist/theme/status-verdict.d.ts.map +1 -1
  102. package/dist/theme/status-verdict.js +3 -2
  103. package/dist/theme/status-verdict.module.css +4 -2
  104. package/llms.txt +30 -6
  105. package/package.json +1 -1
  106. package/src/charts/ChartCard.tsx +70 -4
  107. package/src/charts/Donut.tsx +9 -1
  108. package/src/charts/Heatmap.tsx +1 -1
  109. package/src/charts/Sparkline.tsx +180 -18
  110. package/src/charts/box.tsx +2 -0
  111. package/src/charts/chart-box.module.css +30 -0
  112. package/src/charts/chart-box.module.css.d.ts +1 -0
  113. package/src/charts/chart-card.module.css +47 -0
  114. package/src/charts/chart-card.module.css.d.ts +7 -0
  115. package/src/charts/compile.ts +42 -9
  116. package/src/charts/host.tsx +6 -3
  117. package/src/charts/index.ts +1 -1
  118. package/src/charts/sparkline.module.css +59 -0
  119. package/src/charts/sparkline.module.css.d.ts +13 -0
  120. package/src/charts/state.tsx +44 -4
  121. package/src/charts/types.ts +6 -0
  122. package/src/controls/sync-button.tsx +3 -0
  123. package/src/dashboard/bar-list.module.css +77 -2
  124. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  125. package/src/dashboard/bar-list.tsx +86 -18
  126. package/src/dashboard/delta-badge.tsx +21 -5
  127. package/src/dashboard/index.ts +2 -0
  128. package/src/dashboard/meter-model.ts +35 -0
  129. package/src/dashboard/meter-parts.tsx +119 -23
  130. package/src/dashboard/meter.module.css +90 -12
  131. package/src/dashboard/meter.module.css.d.ts +5 -0
  132. package/src/dashboard/meter.tsx +26 -2
  133. package/src/dashboard/query-state.tsx +28 -19
  134. package/src/dashboard/settings-section.tsx +1 -8
  135. package/src/dashboard/stat-card-parts.tsx +1 -1
  136. package/src/dashboard/stat-card.module.css +15 -7
  137. package/src/dashboard/stat-card.tsx +5 -8
  138. package/src/dashboard/stat-group.tsx +19 -8
  139. package/src/dashboard/stat-strip.module.css +208 -0
  140. package/src/dashboard/stat-strip.module.css.d.ts +28 -0
  141. package/src/dashboard/stat-strip.tsx +183 -0
  142. package/src/dashboard/widget-header.module.css +10 -6
  143. package/src/dashboard/widget-header.tsx +3 -3
  144. package/src/format/date.ts +6 -3
  145. package/src/format/shared.ts +11 -2
  146. package/src/guard/index.ts +1 -1
  147. package/src/index.ts +7 -0
  148. package/src/styles.css +6 -0
  149. package/src/theme/__snapshots__/plain-theme.test.ts.snap +168 -24
  150. package/src/theme/card-inset.module.css +76 -0
  151. package/src/theme/card-inset.module.css.d.ts +9 -0
  152. package/src/theme/controls.module.css +3 -0
  153. package/src/theme/index.ts +30 -0
  154. package/src/theme/nav-link.module.css +8 -10
  155. package/src/theme/status-dot.tsx +17 -5
  156. package/src/theme/status-verdict.module.css +4 -2
  157. package/src/theme/status-verdict.tsx +9 -4
@@ -12,11 +12,16 @@ import {
12
12
  zoneBand,
13
13
  zoneLabelsFit,
14
14
  } from './meter-model'
15
- import type { MeterSegment, MeterZone, Part, ZoneLabel } from './meter-model'
15
+ import type { MeterSegment, MeterTick, MeterZone, Part, TickMark, ZoneLabel } from './meter-model'
16
16
  import classes from './meter.module.css'
17
17
  import { toPct } from './scale'
18
18
 
19
- export type Shell = { className: string | undefined; style: CSSProperties | undefined }
19
+ export type Shell = {
20
+ className: string | undefined
21
+ style: CSSProperties | undefined
22
+ /** `size="row"`: one text line tall, no caption rows. */
23
+ row: boolean
24
+ }
20
25
 
21
26
  /**
22
27
  * The one root contract of every Meter state. `data-basalt-meter` is the handle `StatCard` keys its
@@ -24,7 +29,7 @@ export type Shell = { className: string | undefined; style: CSSProperties | unde
24
29
  */
25
30
  function rootProps(shell: Shell) {
26
31
  return {
27
- className: cx(classes.root, shell.className),
32
+ className: cx(classes.root, shell.row && classes.row, shell.className),
28
33
  style: shell.style,
29
34
  'data-basalt-meter': '',
30
35
  } as const
@@ -62,6 +67,22 @@ function RingSvg({ fraction, color }: { fraction?: number; color?: string | unde
62
67
  )
63
68
  }
64
69
 
70
+ /**
71
+ * A value and its unit stay on one line: a no-break space replaces the space between a digit and a
72
+ * known unit ("24 h", "7 d", "5 min", "40 %"), so a caption never wraps to a lone "d". Any other
73
+ * word ("3 of 7", "250 over") keeps its ordinary space.
74
+ */
75
+ const UNITS = 'h|d|w|mo|y|s|ms|min|m|km|mi|g|kg|%|€|pts|bpm|AU|kcal|KB|MB|GB|TB'
76
+ const UNIT_AFTER_NUMBER = new RegExp(`(\\d) (?=(?:${UNITS})(?![\\p{L}\\d]))`, 'gu')
77
+ /** The last two words of a caption Meter composes are one unit when the last is short, so no
78
+ * line ends on a lone "budget" or "d". */
79
+ // Ordinary spaces only: an already-glued unit (`7\u00a0d`) counts as one word.
80
+ const SHORT_LAST_WORD = /([^ ]) ([^ ]{1,6})$/u
81
+ const glueUnits = (text: ReactNode): ReactNode =>
82
+ typeof text === 'string' ? text.replace(UNIT_AFTER_NUMBER, '$1\u00a0') : text
83
+ const glue = (text: ReactNode): ReactNode =>
84
+ typeof text === 'string' ? String(glueUnits(text)).replace(SHORT_LAST_WORD, '$1\u00a0$2') : text
85
+
65
86
  export function MeterLoading({
66
87
  label,
67
88
  ring,
@@ -73,7 +94,7 @@ export function MeterLoading({
73
94
  }) {
74
95
  return (
75
96
  <div {...rootProps(shell)} aria-busy="true">
76
- <VisuallyHidden>{`Loading ${label}`}</VisuallyHidden>
97
+ <VisuallyHidden className={classes.summary}>{`Loading ${label}`}</VisuallyHidden>
77
98
  {ring ? (
78
99
  <Skeleton className={classes.skeletonRing} circle />
79
100
  ) : (
@@ -293,6 +314,54 @@ function ZoneLabels({ labels }: { labels: readonly ZoneLabel[] }) {
293
314
  )
294
315
  }
295
316
 
317
+ /** Ticks past the middle caption to the left of their mark, so a caption near the end stays on the row. */
318
+ const TICK_LABEL_FLIP_PCT = 50
319
+
320
+ /**
321
+ * Captions the labelled ticks above the track, each hugging its mark. Same fit rule as the zone names:
322
+ * when two would overlap (or one would leave the row) the band hides and the labels wrap as a list in
323
+ * tick order. Decorative: the ticks are in the described-by text.
324
+ */
325
+ function TickLabels({ ticks }: { ticks: readonly TickMark[] }) {
326
+ const rowRef = useRef<HTMLDivElement>(null)
327
+ const fits = useZoneLabelLayout(rowRef, ticks.map((t) => `${t.label}@${t.pct}`).join('\u0000'))
328
+ return (
329
+ <div className={classes.tickLabels}>
330
+ <div
331
+ ref={rowRef}
332
+ className={classes.tickBand}
333
+ data-meter-tick-band
334
+ data-collapsed={fits ? undefined : ''}
335
+ aria-hidden
336
+ >
337
+ {ticks.map((t) => (
338
+ <span
339
+ key={t.key}
340
+ className={classes.tickLabel}
341
+ data-meter-tick-label=""
342
+ style={
343
+ t.pct > TICK_LABEL_FLIP_PCT
344
+ ? { insetInlineEnd: `${100 - t.pct}%` }
345
+ : { insetInlineStart: `${t.pct}%` }
346
+ }
347
+ >
348
+ {t.label}
349
+ </span>
350
+ ))}
351
+ </div>
352
+ {!fits && (
353
+ <div className={classes.zoneList} data-meter-tick-list aria-hidden>
354
+ {ticks.map((t) => (
355
+ <span key={t.key} className={classes.zoneListItem}>
356
+ {t.label}
357
+ </span>
358
+ ))}
359
+ </div>
360
+ )}
361
+ </div>
362
+ )
363
+ }
364
+
296
365
  export function MeterBar(props: {
297
366
  label: string
298
367
  reading: number
@@ -303,6 +372,8 @@ export function MeterBar(props: {
303
372
  segments: readonly MeterSegment[] | undefined
304
373
  zones: readonly MeterZone[] | undefined
305
374
  target: number | undefined
375
+ ticks: readonly MeterTick[] | undefined
376
+ tone: 'muted' | undefined
306
377
  forecastCaption: string | undefined
307
378
  startCaption: ReactNode
308
379
  endCaption: ReactNode
@@ -311,17 +382,24 @@ export function MeterBar(props: {
311
382
  const { label, reading, min, max, format, zones, shell } = props
312
383
  const describedId = useId()
313
384
  const model = modelBar(props)
314
- const start = startCaptionText(model, props.startCaption)
315
- const end = props.endCaption === undefined ? model.endText : props.endCaption
385
+ const compact = shell.row
386
+ const start = compact ? null : startCaptionText(model, props.startCaption)
387
+ const end = compact ? null : props.endCaption === undefined ? model.endText : props.endCaption
316
388
  const anchored = model.markerPct !== undefined && start !== null
317
- const hasCaptions = (start !== null && !anchored) || end !== null || model.forecastText !== null
318
- const hasParts = model.partCaptions.length > 0
389
+ const hasCaptions =
390
+ (start !== null && !anchored) || end !== null || (!compact && model.forecastText !== null)
391
+ const hasParts = !compact && model.partCaptions.length > 0
392
+ const tickLabels = compact ? [] : model.ticks.filter((t) => t.label !== undefined)
319
393
  const describedBy =
320
394
  model.describedByText === null ? {} : ({ 'aria-describedby': describedId } as const)
321
395
 
322
396
  const root = rootProps(shell)
323
397
  return (
324
- <div {...root} className={cx(root.className, model.zoneLabels.length > 0 && classes.zoned)}>
398
+ <div
399
+ {...root}
400
+ className={cx(root.className, !compact && model.zoneLabels.length > 0 && classes.zoned)}
401
+ >
402
+ {tickLabels.length > 0 && <TickLabels ticks={tickLabels} />}
325
403
  <div
326
404
  className={classes.trackBox}
327
405
  aria-label={label}
@@ -343,18 +421,26 @@ export function MeterBar(props: {
343
421
  key={i}
344
422
  className={cx(classes.fill, p.forecast && classes.forecastFill)}
345
423
  data-meter-fill={p.forecast ? 'forecast' : 'committed'}
424
+ data-tone={
425
+ props.tone === 'muted' && p.color === undefined && !p.forecast ? 'muted' : undefined
426
+ }
346
427
  style={fillStyle(p)}
347
428
  />
348
429
  ))}
349
430
  </div>
350
431
  <Tick kind="marker" className={classes.marker} pct={model.markerPct} />
351
432
  <Tick kind="boundary" className={classes.boundaryTick} pct={model.boundaryPct} />
433
+ {model.ticks.map((t) => (
434
+ <Tick key={t.key} kind="tick" className={classes.tick} pct={t.pct} />
435
+ ))}
352
436
  <Tick kind="target" className={classes.tick} pct={model.targetPct} />
353
437
  </div>
354
- {model.zoneLabels.length > 0 && <ZoneLabels labels={model.zoneLabels} />}
438
+ {!compact && model.zoneLabels.length > 0 && <ZoneLabels labels={model.zoneLabels} />}
355
439
  {anchored && <ZoneReading pct={model.markerPct ?? 0}>{start}</ZoneReading>}
356
440
  {model.describedByText !== null && (
357
- <VisuallyHidden id={describedId}>{model.describedByText}</VisuallyHidden>
441
+ <VisuallyHidden id={describedId} className={classes.summary}>
442
+ {model.describedByText}
443
+ </VisuallyHidden>
358
444
  )}
359
445
  {hasParts && (
360
446
  // The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one.
@@ -368,40 +454,50 @@ export function MeterBar(props: {
368
454
  style={{ background: c.color ?? 'var(--vx-line)' }}
369
455
  aria-hidden
370
456
  />
371
- {c.label} {c.text}
457
+ {glueUnits(`${c.label} ${c.text}`)}
372
458
  </li>
373
459
  ))}
374
460
  </ul>
375
461
  )}
376
462
  {hasCaptions && (
377
463
  <div className={classes.captions} data-meter-captions>
378
- {start !== null && !anchored && <span className={classes.caption}>{start}</span>}
379
- {model.forecastText !== null && (
380
- <span className={classes.caption}>{model.forecastText}</span>
464
+ {start !== null && !anchored && <span className={classes.caption}>{glue(start)}</span>}
465
+ {!compact && model.forecastText !== null && (
466
+ <span className={classes.caption}>{glue(model.forecastText)}</span>
381
467
  )}
382
- {end !== null && <span className={classes.captionEnd}>{end}</span>}
468
+ {end !== null && <span className={classes.captionEnd}>{glue(end)}</span>}
383
469
  </div>
384
470
  )}
385
471
  </div>
386
472
  )
387
473
  }
388
474
 
475
+ /** A tick's width: the end tick's start edge sits this far inside the track. */
476
+ const TICK_WIDTH = '2px'
477
+
478
+ /**
479
+ * Centred on its percent. A target or tick AT the track end is the exception: centred there it is
480
+ * half outside the track (and hidden by a full fill), so its end edge sits ON the track end and it
481
+ * reads inside. The marker is the reading itself and stays centred.
482
+ */
483
+ function tickPosition(kind: TickKind, pct: number): CSSProperties {
484
+ if (pct < 100 || kind === 'marker' || kind === 'boundary') return { insetInlineStart: `${pct}%` }
485
+ return { insetInlineStart: `calc(100% - ${TICK_WIDTH})`, marginInlineStart: 0 }
486
+ }
487
+
488
+ type TickKind = 'marker' | 'boundary' | 'target' | 'tick'
489
+
389
490
  function Tick({
390
491
  kind,
391
492
  className,
392
493
  pct,
393
494
  }: {
394
- kind: 'marker' | 'boundary' | 'target'
495
+ kind: TickKind
395
496
  className: string
396
497
  pct: number | undefined
397
498
  }) {
398
499
  if (pct === undefined) return null
399
500
  return (
400
- <div
401
- className={className}
402
- data-meter-tick={kind}
403
- style={{ insetInlineStart: `${pct}%` }}
404
- aria-hidden
405
- />
501
+ <div className={className} data-meter-tick={kind} style={tickPosition(kind, pct)} aria-hidden />
406
502
  )
407
503
  }
@@ -9,6 +9,9 @@
9
9
  flex-direction: column;
10
10
  gap: var(--vx-space-stack-xs, 0.25rem);
11
11
  min-width: 0;
12
+ /* The ONE caption size: every caption below reads it. A host that wants captions at its own text
13
+ * size sets `--basalt-meter-caption: 1em` on the Meter. */
14
+ --basalt-meter-caption: var(--vx-text-micro);
12
15
  }
13
16
 
14
17
  .root.zoned {
@@ -35,6 +38,14 @@
35
38
  background: var(--vx-line);
36
39
  }
37
40
 
41
+ /*
42
+ * A non-verdict reading: --vx-muted at 65%. 35% (argo's alpha) measures 1.7:1 (light) / 2.4:1 (dark)
43
+ * against the track; 65% clears 3:1 in both, and is not the near-white of --vx-line in dark.
44
+ */
45
+ .fill[data-tone='muted'] {
46
+ background: color-mix(in srgb, var(--vx-muted) 65%, transparent);
47
+ }
48
+
38
49
  /* The committed/forecast pair: the same neutral at two strengths. Flat, never hatched. */
39
50
  .forecastFill {
40
51
  background: color-mix(in srgb, var(--vx-line) 45%, transparent);
@@ -54,8 +65,9 @@
54
65
  position: relative;
55
66
  /* Labels are absolutely placed, so the row needs its own line height. */
56
67
  height: 1.25em;
57
- font-family: var(--basalt-font-mono);
58
- font-size: var(--vx-text-micro);
68
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
69
+ font-variant-numeric: lining-nums;
70
+ font-size: var(--basalt-meter-caption);
59
71
  color: var(--vx-muted);
60
72
  }
61
73
 
@@ -86,8 +98,9 @@
86
98
  display: flex;
87
99
  flex-wrap: wrap;
88
100
  gap: var(--vx-space-stack-xs) var(--vx-space-stack-sm);
89
- font-family: var(--basalt-font-mono);
90
- font-size: var(--vx-text-micro);
101
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
102
+ font-variant-numeric: lining-nums;
103
+ font-size: var(--basalt-meter-caption);
91
104
  color: var(--vx-muted);
92
105
  }
93
106
 
@@ -102,8 +115,9 @@
102
115
  position: relative;
103
116
  height: 1.25em;
104
117
  overflow: clip;
105
- font-family: var(--basalt-font-mono);
106
- font-size: var(--vx-text-micro);
118
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
119
+ font-variant-numeric: lining-nums;
120
+ font-size: var(--basalt-meter-caption);
107
121
  }
108
122
 
109
123
  .zoneReadingRow:dir(rtl) {
@@ -144,6 +158,8 @@
144
158
  margin-inline-start: -1px;
145
159
  border-radius: var(--vx-radius-fine);
146
160
  background: var(--vx-ink);
161
+ /* A track-coloured halo keeps an ink tick readable on a fill that is itself near-ink (dark). */
162
+ box-shadow: 0 0 0 1px var(--vx-surface-subtle);
147
163
  }
148
164
 
149
165
  .boundaryTick {
@@ -157,14 +173,17 @@
157
173
  align-items: baseline;
158
174
  justify-content: space-between;
159
175
  gap: var(--vx-space-control-gap, 0.375rem);
160
- font-family: var(--basalt-font-mono);
161
- font-size: var(--vx-text-micro);
176
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
177
+ font-variant-numeric: lining-nums;
178
+ font-size: var(--basalt-meter-caption);
179
+ text-wrap: balance;
162
180
  color: var(--vx-muted);
163
181
  }
164
182
 
165
183
  /* Captions never truncate: the row wraps, and a caption wider than the row wraps inside itself. */
166
184
  .caption {
167
185
  min-width: 0;
186
+ text-wrap: balance;
168
187
  overflow-wrap: anywhere;
169
188
  }
170
189
 
@@ -175,6 +194,12 @@
175
194
  text-align: end;
176
195
  }
177
196
 
197
+ /* The visually-hidden summary and loading text are still text: they read the caption size, not the
198
+ * body size they would inherit. */
199
+ .root .summary {
200
+ font-size: var(--basalt-meter-caption);
201
+ }
202
+
178
203
  /* Categorical segments: one caption per part under the track, wrapping at narrow widths. */
179
204
  .partCaptions {
180
205
  display: flex;
@@ -183,8 +208,10 @@
183
208
  margin: 0;
184
209
  padding: 0;
185
210
  list-style: none;
186
- font-family: var(--basalt-font-mono);
187
- font-size: var(--vx-text-micro);
211
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
212
+ font-variant-numeric: lining-nums;
213
+ font-size: var(--basalt-meter-caption);
214
+ text-wrap: balance;
188
215
  color: var(--vx-muted);
189
216
  }
190
217
 
@@ -205,7 +232,7 @@
205
232
  }
206
233
 
207
234
  .empty {
208
- font-size: var(--vx-text-sm);
235
+ font-size: var(--basalt-meter-caption);
209
236
  color: var(--vx-muted);
210
237
  }
211
238
 
@@ -256,7 +283,8 @@
256
283
 
257
284
  .ringValue {
258
285
  position: relative;
259
- font-family: var(--basalt-font-mono);
286
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
287
+ font-variant-numeric: lining-nums;
260
288
  font-size: var(--vx-text-kpi);
261
289
  font-weight: 500;
262
290
  color: var(--vx-ink);
@@ -266,3 +294,53 @@
266
294
  width: 5rem;
267
295
  height: 5rem;
268
296
  }
297
+
298
+ /* ── tick captions ───────────────────────────────────────────────────────────────────────────── */
299
+
300
+ /* Above the track, so they never share a row with the zone names or the captions below it. */
301
+ .tickLabels {
302
+ position: relative;
303
+ }
304
+
305
+ .tickBand {
306
+ position: relative;
307
+ height: 1.25em;
308
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
309
+ font-variant-numeric: lining-nums;
310
+ font-size: var(--basalt-meter-caption);
311
+ color: var(--vx-muted);
312
+ }
313
+
314
+ /* Hidden but laid out, so a resize can measure it again. */
315
+ .tickBand[data-collapsed] {
316
+ position: absolute;
317
+ top: 0;
318
+ inset-inline: 0;
319
+ visibility: hidden;
320
+ pointer-events: none;
321
+ }
322
+
323
+ .tickLabel {
324
+ position: absolute;
325
+ top: 0;
326
+ white-space: nowrap;
327
+ }
328
+
329
+ /* ── size="row" ──────────────────────────────────────────────────────────────────────────────── */
330
+
331
+ .row {
332
+ gap: 0;
333
+ justify-content: center;
334
+ }
335
+
336
+ .row .track {
337
+ height: 1lh;
338
+ }
339
+
340
+ .row .skeletonTrack {
341
+ height: 1lh;
342
+ }
343
+
344
+ .row .skeletonCaption {
345
+ display: none;
346
+ }
@@ -4,6 +4,7 @@
4
4
  */
5
5
  declare const classes: {
6
6
  readonly root: string
7
+ readonly summary: string
7
8
  readonly zoned: string
8
9
  readonly track: string
9
10
  readonly trackBox: string
@@ -35,5 +36,9 @@ declare const classes: {
35
36
  readonly ringArc: string
36
37
  readonly ringValue: string
37
38
  readonly skeletonRing: string
39
+ readonly tickLabels: string
40
+ readonly tickBand: string
41
+ readonly tickLabel: string
42
+ readonly row: string
38
43
  }
39
44
  export default classes
@@ -53,7 +53,7 @@
53
53
  import type { ReactNode } from 'react'
54
54
  import type { BasaltProps } from '../common/props'
55
55
  import { isReading, normalizeSegments, segmentReading, spanOf } from './meter-model'
56
- import type { MeterSegment, MeterZone } from './meter-model'
56
+ import type { MeterSegment, MeterTick, MeterZone } from './meter-model'
57
57
  import { MeterBar, MeterEmpty, MeterLoading, MeterRing } from './meter-parts'
58
58
  import { asText } from './scale'
59
59
 
@@ -76,6 +76,24 @@ type BarCommon = Common & {
76
76
  shape?: 'bar'
77
77
  /** Target position; draws a tick and states it in the end caption (with the overage past it). */
78
78
  target?: number
79
+ /**
80
+ * More marks on the track (cut-offs, a window mean). Each is drawn at `at`; a `label` is captioned
81
+ * above the track, wrapping to a list when two collide. A tick outside `[min, max]` is dropped, not
82
+ * clamped. All are listed in the accessible description. Works with `value`, `zones`, `segments`
83
+ * and `target`.
84
+ */
85
+ ticks?: readonly MeterTick[]
86
+ /**
87
+ * `'muted'`: a non-verdict fill (a load, not a verdict) in `--vx-muted` at a strength that holds
88
+ * 3:1 against the track in both schemes — the neutral fill is near-white in dark. A `color` wins.
89
+ */
90
+ tone?: 'muted'
91
+ /**
92
+ * `'row'`: in-line use — a track one text line tall and no caption rows (reading, target, forecast,
93
+ * part, zone and tick captions). The label stays as `aria-label`; the described-by text keeps the
94
+ * rest. Put the value beside it in your own layout.
95
+ */
96
+ size?: 'row'
79
97
  /** Start caption (default: the formatted reading). `null` drops it. */
80
98
  startCaption?: ReactNode
81
99
  /** End caption (default: `Target <target>`). `null` drops it. */
@@ -125,6 +143,9 @@ export type MeterProps =
125
143
  segments?: never
126
144
  zones?: never
127
145
  target?: never
146
+ ticks?: never
147
+ tone?: never
148
+ size?: never
128
149
  startCaption?: never
129
150
  endCaption?: never
130
151
  })
@@ -141,7 +162,8 @@ function warnInvalidTrack(min: number, max: number) {
141
162
 
142
163
  export function Meter(props: MeterProps) {
143
164
  const { label, min = 0, max = 100, format = asText, className, style } = props
144
- const shell = { className, style }
165
+ const row = props.size === 'row'
166
+ const shell = { className, style, row }
145
167
  const ring = props.shape === 'ring'
146
168
  warnInvalidTrack(min, max)
147
169
 
@@ -165,6 +187,8 @@ export function Meter(props: MeterProps) {
165
187
  segments={segments}
166
188
  zones={props.zones}
167
189
  target={isReading(props.target) ? props.target : undefined}
190
+ ticks={props.ticks}
191
+ tone={props.tone}
168
192
  forecastCaption={props.segments === undefined ? undefined : props.forecastCaption}
169
193
  startCaption={props.startCaption}
170
194
  endCaption={props.endCaption}
@@ -14,11 +14,13 @@
14
14
  * the re-derivation this exists to delete. `LoadingState` / `ErrorState` ship alongside as the
15
15
  * escape hatch for a page that must place its branches in different DOM positions.
16
16
  */
17
- import { Alert, Button, Center, Group, Loader, Stack, Text } from '@mantine/core'
17
+ import { Button, Center, Group, Loader, Stack, Text } from '@mantine/core'
18
18
  import type { CSSProperties, ReactNode } from 'react'
19
19
  import { toErrorMessage } from '../common/errors'
20
20
  import { cx } from '../common/props'
21
21
  import type { BasaltProps, SlotStylesProps } from '../common/props'
22
+ import { VX } from '../tokens'
23
+ import { StatusDot } from '../theme/status-dot'
22
24
  import { EmptyState } from './empty-state'
23
25
  import { assertQueryStateLike } from '../common/query-state-like'
24
26
  import type { QueryStateLike } from '../common/query-state-like'
@@ -126,28 +128,35 @@ export function ErrorState({
126
128
  style,
127
129
  }: ErrorStateProps): ReactNode {
128
130
  const resolved = tier ?? 'page'
131
+ // D28: a status dot + a word + the message + the retry, on the neutral surface — never a
132
+ // red-tinted filled panel (SPEC § 6.12).
129
133
  const alert = (
130
- <Alert
131
- color="red"
132
- variant="light"
133
- title={title}
134
+ <Stack
135
+ gap="xs"
136
+ role="alert"
134
137
  {...(resolved === 'section' && className !== undefined && { className })}
135
138
  {...(resolved === 'section' && style !== undefined && { style })}
136
139
  >
137
- <Stack gap="sm">
138
- <Text size="sm">{toErrorMessage(error, fallback)}</Text>
139
- {(onRetry ?? action) !== undefined && (
140
- <Group gap="xs">
141
- {onRetry && (
142
- <Button size="xs" variant="default" loading={retrying} onClick={onRetry}>
143
- Retry
144
- </Button>
145
- )}
146
- {action}
147
- </Group>
148
- )}
149
- </Stack>
150
- </Alert>
140
+ <Group gap="xs" wrap="nowrap">
141
+ <StatusDot color={VX.status.bad} />
142
+ <Text size="sm" fw={500}>
143
+ {title}
144
+ </Text>
145
+ </Group>
146
+ <Text size="sm" c="dimmed">
147
+ {toErrorMessage(error, fallback)}
148
+ </Text>
149
+ {(onRetry ?? action) !== undefined && (
150
+ <Group gap="xs">
151
+ {onRetry && (
152
+ <Button size="xs" variant="default" loading={retrying} onClick={onRetry}>
153
+ Retry
154
+ </Button>
155
+ )}
156
+ {action}
157
+ </Group>
158
+ )}
159
+ </Stack>
151
160
  )
152
161
  if (resolved === 'section') return alert
153
162
  return (
@@ -79,13 +79,7 @@ export function SettingsSection({
79
79
  classNames,
80
80
  }: SettingsSectionProps) {
81
81
  return (
82
- <Card
83
- className={cx(classNames?.root, className)}
84
- style={{
85
- padding: 'var(--vx-space-card-inset-y, 0.75rem) var(--vx-space-card-inset-x, 1rem)',
86
- ...style,
87
- }}
88
- >
82
+ <Card className={cx(classNames?.root, className)} style={style}>
89
83
  <div className={cx(classes.header, classNames?.header)}>
90
84
  <WidgetHeader
91
85
  tier="section"
@@ -158,7 +152,6 @@ export function DangerZone({
158
152
  <Card
159
153
  className={cx(classNames?.root, className)}
160
154
  style={{
161
- padding: 'var(--vx-space-card-inset-y, 0.75rem) var(--vx-space-card-inset-x, 1rem)',
162
155
  boxShadow: `${VX.shadowCard}, 0 0 0 1px ${alpha(VX.status.bad, 0.25)}`,
163
156
  ...style,
164
157
  }}
@@ -41,7 +41,7 @@ export function CaptionRow({ title, icon, info, qualifier, tone, actions }: Capt
41
41
  <div className={classes.lead}>
42
42
  <h3 className={classes.caption}>
43
43
  {icon !== undefined && <IconSlot className={classes.icon}>{icon}</IconSlot>}
44
- <span className={classes.captionText} data-widget-title>
44
+ <span className={classes.captionText} title={title} data-widget-title>
45
45
  {title}
46
46
  </span>
47
47
  </h3>