basalt-ui 2.18.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 (183) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/MIGRATING.md +238 -12
  3. package/agent/agents/basalt-design-reviewer.md +2 -2
  4. package/agent/rules/basalt-charts.md +1 -1
  5. package/agent/rules/basalt-mantine.md +1 -1
  6. package/agent/skills/basalt-app/SKILL.md +1 -1
  7. package/agent/skills/basalt-design/SKILL.md +1 -1
  8. package/agent/templates/DESIGN.md.tpl +1 -1
  9. package/configs/oxlint-plugin.js +33 -19
  10. package/configs/oxlint-plugin.test.ts +32 -2
  11. package/dist/charts/ChartCard.d.ts +28 -3
  12. package/dist/charts/ChartCard.d.ts.map +1 -1
  13. package/dist/charts/ChartCard.js +33 -11
  14. package/dist/charts/Donut.d.ts.map +1 -1
  15. package/dist/charts/Donut.js +13 -1
  16. package/dist/charts/Heatmap.js +1 -1
  17. package/dist/charts/Sparkline.d.ts +7 -1
  18. package/dist/charts/Sparkline.d.ts.map +1 -1
  19. package/dist/charts/Sparkline.js +137 -18
  20. package/dist/charts/box.d.ts +2 -0
  21. package/dist/charts/box.d.ts.map +1 -1
  22. package/dist/charts/box.js +2 -0
  23. package/dist/charts/chart-box.module.css +30 -0
  24. package/dist/charts/chart-box.module.css.d.ts +1 -0
  25. package/dist/charts/chart-card.module.css +47 -0
  26. package/dist/charts/chart-card.module.css.d.ts +7 -0
  27. package/dist/charts/compile.d.ts.map +1 -1
  28. package/dist/charts/compile.js +35 -8
  29. package/dist/charts/host.d.ts.map +1 -1
  30. package/dist/charts/host.js +2 -1
  31. package/dist/charts/index.d.ts +1 -1
  32. package/dist/charts/index.d.ts.map +1 -1
  33. package/dist/charts/sparkline.module.css +59 -0
  34. package/dist/charts/sparkline.module.css.d.ts +13 -0
  35. package/dist/charts/state.d.ts.map +1 -1
  36. package/dist/charts/state.js +32 -4
  37. package/dist/charts/types.d.ts +6 -0
  38. package/dist/charts/types.d.ts.map +1 -1
  39. package/dist/commands/notifications/center.d.ts.map +1 -1
  40. package/dist/commands/notifications/center.js +18 -26
  41. package/dist/content/callout.d.ts +1 -1
  42. package/dist/content/callout.d.ts.map +1 -1
  43. package/dist/content/callout.js +10 -1
  44. package/dist/content/callout.module.css +15 -3
  45. package/dist/content/callout.module.css.d.ts +1 -0
  46. package/dist/controls/sync-button.d.ts +3 -0
  47. package/dist/controls/sync-button.d.ts.map +1 -1
  48. package/dist/dashboard/bar-list.d.ts +15 -4
  49. package/dist/dashboard/bar-list.d.ts.map +1 -1
  50. package/dist/dashboard/bar-list.js +56 -19
  51. package/dist/dashboard/bar-list.module.css +110 -17
  52. package/dist/dashboard/bar-list.module.css.d.ts +2 -0
  53. package/dist/dashboard/delta-badge.d.ts +8 -3
  54. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  55. package/dist/dashboard/delta-badge.js +9 -2
  56. package/dist/dashboard/index.d.ts +2 -0
  57. package/dist/dashboard/index.d.ts.map +1 -1
  58. package/dist/dashboard/meter-model.d.ts +68 -1
  59. package/dist/dashboard/meter-model.d.ts.map +1 -1
  60. package/dist/dashboard/meter-model.js +65 -4
  61. package/dist/dashboard/meter-parts.d.ts +5 -1
  62. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  63. package/dist/dashboard/meter-parts.js +234 -60
  64. package/dist/dashboard/meter.d.ts +38 -6
  65. package/dist/dashboard/meter.d.ts.map +1 -1
  66. package/dist/dashboard/meter.js +4 -1
  67. package/dist/dashboard/meter.module.css +209 -13
  68. package/dist/dashboard/meter.module.css.d.ts +16 -0
  69. package/dist/dashboard/query-state.d.ts.map +1 -1
  70. package/dist/dashboard/query-state.js +14 -9
  71. package/dist/dashboard/settings-section.d.ts.map +1 -1
  72. package/dist/dashboard/settings-section.js +14 -25
  73. package/dist/dashboard/stat-card-parts.d.ts +3 -1
  74. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  75. package/dist/dashboard/stat-card-parts.js +18 -3
  76. package/dist/dashboard/stat-card.d.ts +7 -6
  77. package/dist/dashboard/stat-card.d.ts.map +1 -1
  78. package/dist/dashboard/stat-card.js +51 -83
  79. package/dist/dashboard/stat-card.module.css +42 -14
  80. package/dist/dashboard/stat-group.d.ts +11 -2
  81. package/dist/dashboard/stat-group.d.ts.map +1 -1
  82. package/dist/dashboard/stat-group.js +9 -7
  83. package/dist/dashboard/stat-strip.d.ts +50 -0
  84. package/dist/dashboard/stat-strip.d.ts.map +1 -0
  85. package/dist/dashboard/stat-strip.js +85 -0
  86. package/dist/dashboard/stat-strip.module.css +208 -0
  87. package/dist/dashboard/stat-strip.module.css.d.ts +28 -0
  88. package/dist/dashboard/widget-header.d.ts +3 -3
  89. package/dist/dashboard/widget-header.d.ts.map +1 -1
  90. package/dist/dashboard/widget-header.js +2 -1
  91. package/dist/dashboard/widget-header.module.css +38 -7
  92. package/dist/format/date.d.ts.map +1 -1
  93. package/dist/format/date.js +4 -3
  94. package/dist/format/shared.d.ts +6 -0
  95. package/dist/format/shared.d.ts.map +1 -1
  96. package/dist/format/shared.js +6 -2
  97. package/dist/guard/index.d.ts +1 -1
  98. package/dist/guard/index.js +1 -1
  99. package/dist/index.d.ts +3 -1
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +4 -0
  102. package/dist/styles.css +6 -0
  103. package/dist/theme/card-inset.module.css +76 -0
  104. package/dist/theme/card-inset.module.css.d.ts +9 -0
  105. package/dist/theme/chrome-vars.d.ts +29 -17
  106. package/dist/theme/chrome-vars.d.ts.map +1 -1
  107. package/dist/theme/chrome-vars.js +18 -8
  108. package/dist/theme/controls.module.css +3 -0
  109. package/dist/theme/index.d.ts.map +1 -1
  110. package/dist/theme/index.js +32 -5
  111. package/dist/theme/nav-link.module.css +8 -10
  112. package/dist/theme/status-dot.d.ts +7 -0
  113. package/dist/theme/status-dot.d.ts.map +1 -0
  114. package/dist/theme/status-dot.js +18 -0
  115. package/dist/theme/status-dot.module.css +9 -0
  116. package/dist/theme/status-dot.module.css.d.ts +8 -0
  117. package/dist/theme/status-verdict.d.ts +10 -0
  118. package/dist/theme/status-verdict.d.ts.map +1 -0
  119. package/dist/theme/status-verdict.js +14 -0
  120. package/dist/theme/status-verdict.module.css +25 -0
  121. package/dist/theme/status-verdict.module.css.d.ts +9 -0
  122. package/llms.txt +30 -6
  123. package/package.json +1 -1
  124. package/src/charts/ChartCard.tsx +70 -4
  125. package/src/charts/Donut.tsx +9 -1
  126. package/src/charts/Heatmap.tsx +1 -1
  127. package/src/charts/Sparkline.tsx +180 -18
  128. package/src/charts/box.tsx +2 -0
  129. package/src/charts/chart-box.module.css +30 -0
  130. package/src/charts/chart-box.module.css.d.ts +1 -0
  131. package/src/charts/chart-card.module.css +47 -0
  132. package/src/charts/chart-card.module.css.d.ts +7 -0
  133. package/src/charts/compile.ts +42 -9
  134. package/src/charts/host.tsx +6 -3
  135. package/src/charts/index.ts +1 -1
  136. package/src/charts/sparkline.module.css +59 -0
  137. package/src/charts/sparkline.module.css.d.ts +13 -0
  138. package/src/charts/state.tsx +44 -4
  139. package/src/charts/types.ts +6 -0
  140. package/src/commands/notifications/center.tsx +29 -32
  141. package/src/content/callout.module.css +15 -3
  142. package/src/content/callout.module.css.d.ts +1 -0
  143. package/src/content/callout.tsx +15 -2
  144. package/src/controls/sync-button.tsx +3 -0
  145. package/src/dashboard/bar-list.module.css +110 -17
  146. package/src/dashboard/bar-list.module.css.d.ts +2 -0
  147. package/src/dashboard/bar-list.tsx +102 -21
  148. package/src/dashboard/delta-badge.tsx +21 -5
  149. package/src/dashboard/index.ts +2 -0
  150. package/src/dashboard/meter-model.ts +132 -4
  151. package/src/dashboard/meter-parts.tsx +305 -25
  152. package/src/dashboard/meter.module.css +209 -13
  153. package/src/dashboard/meter.module.css.d.ts +16 -0
  154. package/src/dashboard/meter.tsx +42 -7
  155. package/src/dashboard/query-state.tsx +28 -19
  156. package/src/dashboard/settings-section.tsx +1 -8
  157. package/src/dashboard/stat-card-parts.tsx +22 -2
  158. package/src/dashboard/stat-card.module.css +42 -14
  159. package/src/dashboard/stat-card.tsx +23 -60
  160. package/src/dashboard/stat-group.tsx +19 -8
  161. package/src/dashboard/stat-strip.module.css +208 -0
  162. package/src/dashboard/stat-strip.module.css.d.ts +28 -0
  163. package/src/dashboard/stat-strip.tsx +183 -0
  164. package/src/dashboard/widget-header.module.css +38 -7
  165. package/src/dashboard/widget-header.tsx +7 -4
  166. package/src/format/date.ts +6 -3
  167. package/src/format/shared.ts +11 -2
  168. package/src/guard/index.ts +1 -1
  169. package/src/index.ts +7 -0
  170. package/src/styles.css +6 -0
  171. package/src/theme/__snapshots__/plain-theme.test.ts.snap +242 -26
  172. package/src/theme/card-inset.module.css +76 -0
  173. package/src/theme/card-inset.module.css.d.ts +9 -0
  174. package/src/theme/chrome-vars.ts +48 -23
  175. package/src/theme/controls.module.css +3 -0
  176. package/src/theme/index.ts +40 -6
  177. package/src/theme/nav-link.module.css +8 -10
  178. package/src/theme/status-dot.module.css +9 -0
  179. package/src/theme/status-dot.module.css.d.ts +8 -0
  180. package/src/theme/status-dot.tsx +31 -0
  181. package/src/theme/status-verdict.module.css +25 -0
  182. package/src/theme/status-verdict.module.css.d.ts +9 -0
  183. package/src/theme/status-verdict.tsx +32 -0
@@ -0,0 +1,183 @@
1
+ /**
2
+ * StatStrip — the body of `StatGroup variant="strip"`: KPI cells joined into one surface and split
3
+ * by hairlines, with an optional footer row of wider cells. Internal: reached through `StatGroup`.
4
+ *
5
+ * Cell anatomy: a mono caption (with `· qualifier` muted on the same line and the `info` glyph), the
6
+ * hero `value` in the proportional sans, an optional `delta`, `visual` and `footer` line. `rows`
7
+ * replaces the hero with aligned `label · visual · value · delta` rows (one cell, several signals).
8
+ * `tone` inks the VALUE only, for a verdict; a null reading is `—`. A cell may carry BOTH: the hero
9
+ * (e.g. VO2max) with `rows` under it; omit `value` to render the rows alone.
10
+ *
11
+ * Anchors: each cell is `data-shot="strip-<key>"` and each footer cell
12
+ * `data-shot="strip-footer-<key>"` (derived — a consumer cannot choose another name).
13
+ *
14
+ * Mapping from a prototype: warden's JSX `qualifier` line UNDER the value is `footer`; the cell
15
+ * `qualifier` is the short `· text` on the caption line. Cells are equal-weight: unequal column
16
+ * weights are not supported. `stale` dims a cell while placeholder data shows.
17
+ */
18
+ import { Card, Skeleton } from '@mantine/core'
19
+ import { useId } from 'react'
20
+ import type { CSSProperties, ReactNode } from 'react'
21
+ import { cx } from '../common/props'
22
+ import type { BasaltProps, Tone } from '../common/props'
23
+ import { VX } from '../tokens'
24
+ import { InfoGlyph } from './widget-header'
25
+ import classes from './stat-strip.module.css'
26
+
27
+ export type StatStripRow = {
28
+ key: string
29
+ label: string
30
+ /** `null` = no reading, printed as `—`. Pre-join the unit (`'48 ms'`). */
31
+ value: string | null
32
+ visual?: ReactNode
33
+ /** A `DeltaBadge`. */
34
+ delta?: ReactNode
35
+ }
36
+
37
+ export type StatStripCell = {
38
+ key: string
39
+ caption: string
40
+ /** Muted, on the caption line: `CAPTION · qualifier`. */
41
+ qualifier?: string
42
+ /** The definition behind the caption, in the info-glyph tooltip. */
43
+ info?: string
44
+ /** `null` = no reading, printed as `—`. Omit only when `rows` carries the cell. */
45
+ value?: string | null
46
+ unit?: string
47
+ /** A `DeltaBadge`. */
48
+ delta?: ReactNode
49
+ /** The micro-visual slot (Meter / Sparkline / BandStrip). */
50
+ visual?: ReactNode
51
+ /** A muted line pinned to the cell foot. */
52
+ footer?: ReactNode
53
+ /** Aligned signals under the hero (or alone when `value` is omitted). */
54
+ rows?: readonly StatStripRow[]
55
+ /** Inks the value only — set it when the reading is a verdict. */
56
+ tone?: Tone
57
+ /** Skeleton in place of the readings. */
58
+ loading?: boolean
59
+ /** Dims the cell while placeholder data shows. */
60
+ stale?: boolean
61
+ }
62
+
63
+ export type StatStripProps = BasaltProps & {
64
+ /** The strip's accessible name. */
65
+ label: string
66
+ cells: readonly StatStripCell[]
67
+ /** Wider cells under the cells. */
68
+ footer?: readonly { key: string; content: ReactNode }[]
69
+ /** The DESKTOP column count. Default: the cell count, capped at 6. */
70
+ cols?: 2 | 3 | 4 | 5 | 6
71
+ }
72
+
73
+ const EMPTY = '—'
74
+
75
+ function StripCell({ cell }: { cell: StatStripCell }) {
76
+ const captionId = useId()
77
+ const { rows, loading } = cell
78
+ const hasHero = cell.value !== undefined || rows === undefined
79
+ return (
80
+ <article
81
+ className={classes.cell}
82
+ data-strip-cell={cell.key}
83
+ data-shot={`strip-${cell.key}`}
84
+ aria-labelledby={captionId}
85
+ {...(cell.stale && { 'data-stale': 'true' })}
86
+ >
87
+ <div className={classes.captionLine}>
88
+ {/* The caption and its info glyph are one unit: the qualifier wraps whole, never between them. */}
89
+ <span className={classes.lead}>
90
+ <span className={classes.caption} id={captionId} title={cell.caption} data-strip-caption>
91
+ {cell.caption}
92
+ </span>
93
+ {cell.info !== undefined && <InfoGlyph text={cell.info} />}
94
+ </span>
95
+ {cell.qualifier !== undefined && (
96
+ <span className={classes.qualifier}>{cell.qualifier}</span>
97
+ )}
98
+ </div>
99
+ {hasHero &&
100
+ (loading ? (
101
+ <Skeleton className={classes.skeletonValue} radius="sm" />
102
+ ) : (
103
+ <div className={classes.valueRow}>
104
+ <span
105
+ className={classes.value}
106
+ data-strip-value
107
+ style={cell.tone !== undefined ? { color: VX.status[cell.tone] } : undefined}
108
+ >
109
+ {cell.value ?? EMPTY}
110
+ </span>
111
+ {cell.value !== undefined && cell.value !== null && cell.unit !== undefined && (
112
+ <span className={classes.unit}>{cell.unit}</span>
113
+ )}
114
+ {cell.delta}
115
+ </div>
116
+ ))}
117
+ {cell.visual !== undefined && <div className={classes.visual}>{cell.visual}</div>}
118
+ {rows !== undefined &&
119
+ (loading ? (
120
+ <div className={classes.rows} aria-hidden="true">
121
+ {rows.map((row) => (
122
+ <Skeleton key={row.key} className={classes.skeletonRow} radius="sm" />
123
+ ))}
124
+ </div>
125
+ ) : (
126
+ <ul className={classes.rows}>
127
+ {rows.map((row) => (
128
+ <li key={row.key} className={classes.row} data-strip-row={row.key}>
129
+ <span className={classes.rowLabel}>{row.label}</span>
130
+ <span className={classes.visual}>{row.visual}</span>
131
+ <span className={classes.rowValue}>{row.value ?? EMPTY}</span>
132
+ <span>{row.delta}</span>
133
+ </li>
134
+ ))}
135
+ </ul>
136
+ ))}
137
+ {cell.footer !== undefined && <div className={classes.footer}>{cell.footer}</div>}
138
+ </article>
139
+ )
140
+ }
141
+
142
+ export function StatStrip({ label, cells, footer, cols, className, style }: StatStripProps) {
143
+ const desktop = cols ?? Math.min(Math.max(cells.length, 2), 6)
144
+ // `StatGroup`'s rule: four is 2 + 2 below the full count, never 3 + 1.
145
+ const mid = desktop === 4 ? 2 : Math.min(desktop, 3)
146
+ return (
147
+ <div className={cx(classes.container, className)} style={style}>
148
+ <Card>
149
+ <Card.Section
150
+ component="section"
151
+ aria-label={label}
152
+ className={classes.clip}
153
+ style={
154
+ {
155
+ '--basalt-strip-cols': desktop,
156
+ '--basalt-strip-cols-sm': mid,
157
+ } as CSSProperties
158
+ }
159
+ >
160
+ <div className={classes.cells}>
161
+ {cells.map((cell) => (
162
+ <StripCell key={cell.key} cell={cell} />
163
+ ))}
164
+ </div>
165
+ {footer !== undefined && footer.length > 0 && (
166
+ <div className={classes.footerRow}>
167
+ {footer.map((entry) => (
168
+ <div
169
+ key={entry.key}
170
+ className={classes.footerCell}
171
+ data-strip-footer-cell={entry.key}
172
+ data-shot={`strip-footer-${entry.key}`}
173
+ >
174
+ {entry.content}
175
+ </div>
176
+ ))}
177
+ </div>
178
+ )}
179
+ </Card.Section>
180
+ </Card>
181
+ </div>
182
+ )
183
+ }
@@ -143,7 +143,8 @@
143
143
  border-radius: var(--vx-radius-ctrl);
144
144
  background: var(--vx-surface-subtle);
145
145
  padding: var(--vx-space-badge-inset-y) var(--vx-space-badge-inset-x);
146
- font-family: var(--basalt-font-mono);
146
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
147
+ font-variant-numeric: lining-nums;
147
148
  font-size: var(--vx-text-xs);
148
149
  font-weight: 500;
149
150
  color: var(--vx-faint);
@@ -172,7 +173,8 @@
172
173
  .value {
173
174
  min-width: 0;
174
175
  overflow-wrap: anywhere;
175
- font-family: var(--basalt-font-mono);
176
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
177
+ font-variant-numeric: lining-nums;
176
178
  font-size: var(--vx-text-kpi);
177
179
  font-weight: 500;
178
180
  letter-spacing: -0.02em;
@@ -180,15 +182,16 @@
180
182
  }
181
183
 
182
184
  /*
183
- * The unit beside the hero value. Mono like the number it qualifies (so `412 TSS` sits on one
184
- * baseline grid), `--vx-text-sm` and `--vx-muted` so it never competes with the numeral — the whole
185
+ * The unit beside the hero value. Sans like the number it qualifies (so `412 TSS` sits on one
186
+ * baseline), `--vx-text-sm` and `--vx-muted` so it never competes with the numeral — the whole
185
187
  * point is that a unit is the SMALL half of the pair. `flex-shrink: 0`: a unit clipped to `TS…`
186
188
  * would state nothing.
187
189
  */
188
190
  .unit {
189
191
  flex-shrink: 0;
190
192
  align-self: baseline;
191
- font-family: var(--basalt-font-mono);
193
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
194
+ font-variant-numeric: lining-nums;
192
195
  font-size: var(--vx-text-sm);
193
196
  font-weight: 500;
194
197
  color: var(--vx-muted);
@@ -247,12 +250,16 @@
247
250
  * overlay — axe and assistive tech measure the element. The negative margin hands the extra
248
251
  * (24 - 11) / 2 back on every side, so the glyph and the row around it keep their drawn size. */
249
252
  .infoTrigger {
253
+ --basalt-info-glyph: 11px;
254
+ --basalt-info-ring-offset: 2px;
255
+ --basalt-info-ring-width: 2px;
250
256
  display: inline-flex;
251
257
  align-items: center;
252
258
  justify-content: center;
253
259
  min-width: 24px;
254
260
  min-height: 24px;
255
- margin: calc((11px - 24px) / 2);
261
+ margin: calc((var(--basalt-info-glyph) - 24px) / 2);
262
+ position: relative;
256
263
  appearance: none;
257
264
  padding: 0;
258
265
  border: none;
@@ -261,6 +268,29 @@
261
268
  cursor: help;
262
269
  }
263
270
 
271
+ /* The keyboard ring hugs the glyph, not the 24px hit box: drawn on the box it reached 6.5px past
272
+ * the glyph and painted over the title's last letter and a neighbouring status dot. The `::before`
273
+ * is the glyph + the offset on each side, outlined by the ring width, so the ring ends 4px from the
274
+ * glyph — inside the 6px control gap. (`::after` is the hit overlay's.)
275
+ * Forced colors: the ring is an `outline`, which the UA keeps and recolours to a system colour, so
276
+ * it stays visible without a `forced-colors` override. */
277
+ .infoTrigger:focus-visible {
278
+ outline: none;
279
+
280
+ &::before {
281
+ content: '';
282
+ position: absolute;
283
+ top: 50%;
284
+ left: 50%;
285
+ translate: -50% -50%;
286
+ width: calc(var(--basalt-info-glyph) + 2 * var(--basalt-info-ring-offset));
287
+ height: calc(var(--basalt-info-glyph) + 2 * var(--basalt-info-ring-offset));
288
+ border-radius: var(--vx-radius-fine);
289
+ outline: var(--basalt-info-ring-width) solid var(--vx-accent);
290
+ pointer-events: none;
291
+ }
292
+ }
293
+
264
294
  .infoTrigger:hover,
265
295
  .infoTrigger:focus-visible,
266
296
  .infoTrigger[data-open='true'] {
@@ -316,7 +346,8 @@
316
346
  white-space: nowrap;
317
347
  align-items: baseline;
318
348
  gap: 3px;
319
- font-family: var(--basalt-font-mono);
349
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
350
+ font-variant-numeric: lining-nums;
320
351
  font-size: var(--vx-text-sm);
321
352
  font-weight: 500;
322
353
  line-height: 1;
@@ -77,11 +77,11 @@ export type WidgetHeaderProps = BasaltProps &
77
77
  * click — so a keyboard user gets it too. Mantine-free: a plain state bubble, not a Tooltip.
78
78
  */
79
79
  info?: string
80
- /** Pre-formatted metric value (mono, hero size, never truncated). Renders on its own row with
80
+ /** Pre-formatted metric value (sans, lining figures, hero size, never truncated). Renders on its own row with
81
81
  * `delta` under the title row, or on the title row in a card 480px or wider. */
82
82
  value?: string
83
83
  /**
84
- * The value's unit, rendered immediately after it on the hero row: muted, mono, `--vx-text-sm`.
84
+ * The value's unit, rendered immediately after it on the hero row: muted, sans, `--vx-text-sm`.
85
85
  *
86
86
  * It exists because `value` is a pre-formatted `string` and a KPI's unit is not part of the
87
87
  * number: `412` and `TSS` are two facts at two weights, and jamming them into one string paints
@@ -120,7 +120,7 @@ export type WidgetHeaderProps = BasaltProps &
120
120
  /** Trend visual slot, rendered below the metric row. Carries `data-placement="right"` so a
121
121
  * wave-3 composer's `bleed` layout can select it. */
122
122
  sparkline?: ReactNode
123
- /** Mono count tag rendered after the title (C11 — every table/list states its count). `0` is a
123
+ /** Count tag rendered after the title (C11 — every table/list states its count). `0` is a
124
124
  * real count and renders, distinct from omitting the prop entirely. */
125
125
  count?: number
126
126
  /** Right-aligned slot (`margin-inline-start: auto`) — the C1/C5 home for header actions. */
@@ -290,6 +290,7 @@ export function InfoGlyph({
290
290
  ref={triggerRef}
291
291
  type="button"
292
292
  data-basalt-hit
293
+ data-info-trigger
293
294
  className={classes.infoTrigger}
294
295
  // The GLYPH is named, not the text — `text` reaches AT through `aria-describedby` below, so
295
296
  // it never lands in the heading's or the button's accessible name.
@@ -372,7 +373,9 @@ export function WidgetHeader({
372
373
  {icon !== undefined && (
373
374
  <IconSlot className={cx(classes.icon, classNames?.icon)}>{icon}</IconSlot>
374
375
  )}
375
- <span className={classes.titleText}>{title}</span>
376
+ <span className={classes.titleText} data-widget-title>
377
+ {title}
378
+ </span>
376
379
  </Heading>
377
380
  {/* OUTSIDE the heading on purpose — see `info`'s own doc. */}
378
381
  {info !== undefined && (
@@ -3,7 +3,7 @@
3
3
  * seeded from argo consumers (`features/{walking-pad,reading,astro-window,garmin-health}/{formatters,format,
4
4
  * formulas}.ts` — read those files' own JSDoc for the exact call sites this generalizes).
5
5
  */
6
- import { dateFormat, NON_FINITE, numberFormat, toDate } from './shared'
6
+ import { dateFormat, NON_FINITE, numberFormat, resolveLocale, toDate } from './shared'
7
7
  import type { LocaleOption } from './shared'
8
8
 
9
9
  type DateInput = Date | number | string | null | undefined
@@ -92,10 +92,13 @@ function relativeTimeFormat(
92
92
  style: 'long' | 'short' | 'narrow',
93
93
  numeric: 'auto' | 'always',
94
94
  ): Intl.RelativeTimeFormat {
95
- const key = `${locale ?? ''}|${style}|${numeric}`
95
+ // Same resolution as `numberFormat`/`dateFormat`. The RESOLVED tag keys the cache (`\0` marks
96
+ // "runtime locale", which no real tag can equal), so a changed default never serves a stale one.
97
+ const resolved = resolveLocale(locale)
98
+ const key = `${resolved ?? '\0'}|${style}|${numeric}`
96
99
  const cached = relativeTimeFormatterCache.get(key)
97
100
  if (cached !== undefined) return cached
98
- const created = new Intl.RelativeTimeFormat(locale, { style, numeric })
101
+ const created = new Intl.RelativeTimeFormat(resolved, { style, numeric })
99
102
  relativeTimeFormatterCache.set(key, created)
100
103
  return created
101
104
  }
@@ -92,11 +92,20 @@ function memoize<T>(
92
92
  return created
93
93
  }
94
94
 
95
+ /**
96
+ * The ONE locale resolution every formatter shares: the call's own tag, else the
97
+ * {@link defineFormat} default, else `undefined` (the runtime's own locale). Internal — not
98
+ * re-exported from the public barrel.
99
+ */
100
+ export function resolveLocale(locale?: string): string | undefined {
101
+ return locale ?? defaults.locale
102
+ }
103
+
95
104
  export function numberFormat(
96
105
  locale: string | undefined,
97
106
  options: Intl.NumberFormatOptions,
98
107
  ): Intl.NumberFormat {
99
- const resolved = locale ?? defaults.locale
108
+ const resolved = resolveLocale(locale)
100
109
  return memoize(numberCaches, resolved, options, () => new Intl.NumberFormat(resolved, options))
101
110
  }
102
111
 
@@ -104,7 +113,7 @@ export function dateFormat(
104
113
  locale: string | undefined,
105
114
  options: Intl.DateTimeFormatOptions,
106
115
  ): Intl.DateTimeFormat {
107
- const resolved = locale ?? defaults.locale
116
+ const resolved = resolveLocale(locale)
108
117
  const withZone =
109
118
  options.timeZone === undefined && defaults.timeZone !== undefined
110
119
  ? { ...options, timeZone: defaults.timeZone }
@@ -2072,7 +2072,7 @@ export const GUARD_RULES = {
2072
2072
  // JSX-tag-shaped (`<Card withBorder>`) — never appears in CSS text.
2073
2073
  appliesTo: (relPath) => !relPath.endsWith('.css'),
2074
2074
  message:
2075
- 'withBorder on a Card/Paper double-draws the edge — card depth is --vx-shadow-card, which already bakes a 1px ring into the shadow. Drop the prop (docs/DESIGN-SPEC.md doctrine inversion #1) — and fix the inset in the same edit: an explicit p/padding or radius on that Card/Paper is the other half of the idiom, which only the oxlint lane sees (basalt/card-inset); leave both to the theme or use py="sm" px="md".',
2075
+ 'withBorder on a Card/Paper double-draws the edge — card depth is --vx-shadow-card, which already bakes a 1px ring into the shadow. Drop the prop (docs/DESIGN-SPEC.md doctrine inversion #1) — and fix the inset in the same edit: an explicit p/padding or radius on that Card/Paper is the other half of the idiom, which only the oxlint lane sees (basalt/card-inset); the theme owns both, so write neither.',
2076
2076
  },
2077
2077
  'off-system-surface-var': {
2078
2078
  kind: 'off-system-surface-var',
package/src/index.ts CHANGED
@@ -26,6 +26,8 @@ export {
26
26
  export { scrollParentOf, useCoarsePointer, type Tone } from './common'
27
27
  export { createBasaltTheme } from './theme'
28
28
  export { ThemeToggle } from './theme/theme-toggle'
29
+ export { StatusDot, type StatusDotProps } from './theme/status-dot'
30
+ export { StatusVerdict, type StatusVerdictProps } from './theme/status-verdict'
29
31
  export {
30
32
  BasaltShell,
31
33
  PageBar,
@@ -44,12 +46,17 @@ export {
44
46
  type StatCardBreakdownRow,
45
47
  type StatCardSparklineSize,
46
48
  StatGroup,
49
+ type StatStripCell,
50
+ type StatStripRow,
47
51
  EmptyState,
48
52
  SettingsSection,
49
53
  SettingsRow,
50
54
  DangerZone,
51
55
  Meter,
52
56
  type MeterProps,
57
+ type MeterSegment,
58
+ type MeterTick,
59
+ type MeterZone,
53
60
  BarList,
54
61
  type BarListProps,
55
62
  } from './dashboard'
package/src/styles.css CHANGED
@@ -46,6 +46,9 @@
46
46
  'Hubot Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica,
47
47
  Arial, sans-serif;
48
48
  --basalt-font-mono: 'JetBrains Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;
49
+ /* Hero values, unit/count/delta text, bar-list and meter figures: proportional sans, lining
50
+ figures. Set to `var(--basalt-font-mono)` to restore the pre-Wave-35 mono numerals. */
51
+ --basalt-font-numeral: var(--basalt-font-sans);
49
52
  }
50
53
  }
51
54
 
@@ -153,6 +156,9 @@
153
156
  h6,
154
157
  .mantine-Title-root {
155
158
  font-stretch: var(--basalt-font-head-stretch, 88%);
159
+ /* Hubot Sans draws a slashed zero by default; a heading numeral is a figure, not code. */
160
+ font-feature-settings: 'zero' 0;
161
+ font-variant-numeric: lining-nums;
156
162
  }
157
163
 
158
164
  /* Scrollbars (docs/DESIGN-SPEC.md §5): 9px, ink-mix thumb (stronger on hover), radius 6,