basalt-ui 2.22.0 → 2.24.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 (169) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/MIGRATING.md +400 -12
  3. package/agent/agents/basalt-design-reviewer.md +3 -3
  4. package/agent/skills/basalt-design/SKILL.md +2 -2
  5. package/agent/skills/basalt-design/references/catalogue.md +22 -19
  6. package/agent/skills/basalt-design/references/states.md +39 -0
  7. package/dist/charts/BandStrip.d.ts.map +1 -1
  8. package/dist/charts/BandStrip.js +51 -5
  9. package/dist/charts/Bars.d.ts.map +1 -1
  10. package/dist/charts/Bars.js +19 -3
  11. package/dist/charts/CartesianChart.d.ts +2 -0
  12. package/dist/charts/CartesianChart.d.ts.map +1 -1
  13. package/dist/charts/CartesianChart.js +7 -3
  14. package/dist/charts/ChartCard.d.ts +1 -1
  15. package/dist/charts/ChartCard.d.ts.map +1 -1
  16. package/dist/charts/ChartCard.js +25 -15
  17. package/dist/charts/Sparkline.d.ts +8 -2
  18. package/dist/charts/Sparkline.d.ts.map +1 -1
  19. package/dist/charts/Sparkline.js +95 -15
  20. package/dist/charts/StackedArea.d.ts.map +1 -1
  21. package/dist/charts/StackedArea.js +5 -1
  22. package/dist/charts/band-fold.d.ts +22 -4
  23. package/dist/charts/band-fold.d.ts.map +1 -1
  24. package/dist/charts/band-fold.js +10 -2
  25. package/dist/charts/chart-dates.d.ts +12 -0
  26. package/dist/charts/chart-dates.d.ts.map +1 -0
  27. package/dist/charts/chart-dates.js +16 -0
  28. package/dist/charts/chart-legend.module.css +16 -0
  29. package/dist/charts/compile.d.ts +10 -0
  30. package/dist/charts/compile.d.ts.map +1 -1
  31. package/dist/charts/compile.js +77 -24
  32. package/dist/charts/date-tick-format.d.ts +5 -5
  33. package/dist/charts/date-tick-format.d.ts.map +1 -1
  34. package/dist/charts/date-tick-format.js +3 -7
  35. package/dist/charts/labels.d.ts +7 -3
  36. package/dist/charts/labels.d.ts.map +1 -1
  37. package/dist/charts/labels.js +28 -17
  38. package/dist/charts/legend.d.ts +0 -6
  39. package/dist/charts/legend.d.ts.map +1 -1
  40. package/dist/charts/legend.js +87 -35
  41. package/dist/charts/ref-label.d.ts +17 -0
  42. package/dist/charts/ref-label.d.ts.map +1 -1
  43. package/dist/charts/ref-label.js +13 -1
  44. package/dist/charts/sparkline.module.css +62 -12
  45. package/dist/charts/sparkline.module.css.d.ts +1 -0
  46. package/dist/charts/state.d.ts.map +1 -1
  47. package/dist/charts/state.js +4 -2
  48. package/dist/charts/types.d.ts +15 -3
  49. package/dist/charts/types.d.ts.map +1 -1
  50. package/dist/cli/shot/capture.d.ts.map +1 -1
  51. package/dist/cli/shot/capture.js +9 -5
  52. package/dist/cli/shot/detect.js +8 -5
  53. package/dist/cli/shot/measure.js +19 -23
  54. package/dist/cli/shot/playwright.d.ts +8 -0
  55. package/dist/cli/shot/playwright.d.ts.map +1 -1
  56. package/dist/cli/shot/playwright.js +5 -1
  57. package/dist/cli/shot/types.d.ts +2 -0
  58. package/dist/cli/shot/types.d.ts.map +1 -1
  59. package/dist/cli/tokens-css.d.ts +5 -7
  60. package/dist/cli/tokens-css.d.ts.map +1 -1
  61. package/dist/cli/tokens-css.js +11 -12
  62. package/dist/dashboard/bar-list.d.ts +6 -1
  63. package/dist/dashboard/bar-list.d.ts.map +1 -1
  64. package/dist/dashboard/bar-list.js +8 -0
  65. package/dist/dashboard/bar-list.module.css +18 -0
  66. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  67. package/dist/dashboard/delta-badge.js +2 -2
  68. package/dist/dashboard/empty-state.d.ts.map +1 -1
  69. package/dist/dashboard/meter-model.d.ts +55 -21
  70. package/dist/dashboard/meter-model.d.ts.map +1 -1
  71. package/dist/dashboard/meter-model.js +98 -17
  72. package/dist/dashboard/meter-parts.d.ts +9 -2
  73. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  74. package/dist/dashboard/meter-parts.js +99 -21
  75. package/dist/dashboard/meter.d.ts +21 -8
  76. package/dist/dashboard/meter.d.ts.map +1 -1
  77. package/dist/dashboard/meter.js +14 -3
  78. package/dist/dashboard/meter.module.css +57 -2
  79. package/dist/dashboard/meter.module.css.d.ts +5 -0
  80. package/dist/dashboard/query-state.d.ts +7 -3
  81. package/dist/dashboard/query-state.d.ts.map +1 -1
  82. package/dist/dashboard/query-state.js +15 -7
  83. package/dist/dashboard/section.d.ts +2 -1
  84. package/dist/dashboard/section.d.ts.map +1 -1
  85. package/dist/dashboard/section.module.css +12 -0
  86. package/dist/dashboard/settings-section.d.ts +1 -1
  87. package/dist/dashboard/settings-section.d.ts.map +1 -1
  88. package/dist/dashboard/settings-section.js +3 -3
  89. package/dist/dashboard/stat-card-parts.js +1 -1
  90. package/dist/dashboard/stat-card.module.css +43 -10
  91. package/dist/dashboard/stat-group.module.css +15 -0
  92. package/dist/dashboard/stat-strip.d.ts +16 -5
  93. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  94. package/dist/dashboard/stat-strip.js +100 -74
  95. package/dist/dashboard/stat-strip.module.css +68 -62
  96. package/dist/dashboard/stat-strip.module.css.d.ts +1 -0
  97. package/dist/dashboard/widget-header.d.ts.map +1 -1
  98. package/dist/dashboard/widget-header.js +19 -1
  99. package/dist/dashboard/widget-header.module.css +6 -0
  100. package/dist/guard/index.d.ts +2 -2
  101. package/dist/guard/index.d.ts.map +1 -1
  102. package/dist/guard/index.js +1 -17
  103. package/dist/styles.css +18 -11
  104. package/dist/table/data-table.js +1 -1
  105. package/dist/theme/controls.module.css +19 -0
  106. package/dist/theme/controls.module.css.d.ts +1 -0
  107. package/dist/theme/index.d.ts.map +1 -1
  108. package/dist/theme/index.js +12 -7
  109. package/dist/theme/status-verdict.d.ts.map +1 -1
  110. package/dist/theme/status-verdict.js +9 -1
  111. package/dist/tokens/palette.d.ts +7 -10
  112. package/dist/tokens/palette.d.ts.map +1 -1
  113. package/dist/tokens/palette.js +7 -10
  114. package/llms.txt +7 -4
  115. package/package.json +1 -1
  116. package/src/charts/BandStrip.tsx +55 -5
  117. package/src/charts/Bars.tsx +31 -3
  118. package/src/charts/CartesianChart.tsx +9 -3
  119. package/src/charts/ChartCard.tsx +32 -19
  120. package/src/charts/Sparkline.tsx +139 -21
  121. package/src/charts/StackedArea.tsx +12 -1
  122. package/src/charts/band-fold.ts +25 -6
  123. package/src/charts/chart-dates.ts +30 -0
  124. package/src/charts/chart-legend.module.css +16 -0
  125. package/src/charts/compile.ts +148 -25
  126. package/src/charts/date-tick-format.ts +10 -13
  127. package/src/charts/labels.ts +43 -22
  128. package/src/charts/legend.tsx +70 -3
  129. package/src/charts/ref-label.ts +27 -0
  130. package/src/charts/sparkline.module.css +62 -12
  131. package/src/charts/sparkline.module.css.d.ts +1 -0
  132. package/src/charts/state.tsx +7 -4
  133. package/src/charts/types.ts +13 -3
  134. package/src/cli/shot/capture.ts +15 -3
  135. package/src/cli/shot/detect.ts +9 -9
  136. package/src/cli/shot/measure.ts +27 -27
  137. package/src/cli/shot/playwright.ts +18 -2
  138. package/src/cli/shot/types.ts +2 -0
  139. package/src/cli/tokens-css.ts +18 -20
  140. package/src/dashboard/bar-list.module.css +18 -0
  141. package/src/dashboard/bar-list.tsx +29 -0
  142. package/src/dashboard/delta-badge.tsx +6 -2
  143. package/src/dashboard/empty-state.tsx +4 -2
  144. package/src/dashboard/meter-model.ts +181 -47
  145. package/src/dashboard/meter-parts.tsx +187 -30
  146. package/src/dashboard/meter.module.css +57 -2
  147. package/src/dashboard/meter.module.css.d.ts +5 -0
  148. package/src/dashboard/meter.tsx +33 -10
  149. package/src/dashboard/query-state.tsx +20 -9
  150. package/src/dashboard/section.module.css +12 -0
  151. package/src/dashboard/section.tsx +2 -1
  152. package/src/dashboard/settings-section.tsx +4 -4
  153. package/src/dashboard/stat-card-parts.tsx +1 -1
  154. package/src/dashboard/stat-card.module.css +43 -10
  155. package/src/dashboard/stat-group.module.css +15 -0
  156. package/src/dashboard/stat-strip.module.css +68 -62
  157. package/src/dashboard/stat-strip.module.css.d.ts +1 -0
  158. package/src/dashboard/stat-strip.tsx +118 -59
  159. package/src/dashboard/widget-header.module.css +6 -0
  160. package/src/dashboard/widget-header.tsx +28 -1
  161. package/src/guard/index.ts +3 -19
  162. package/src/styles.css +18 -11
  163. package/src/table/data-table.tsx +1 -1
  164. package/src/theme/__snapshots__/plain-theme.test.ts.snap +14 -8
  165. package/src/theme/controls.module.css +19 -0
  166. package/src/theme/controls.module.css.d.ts +1 -0
  167. package/src/theme/index.ts +12 -7
  168. package/src/theme/status-verdict.tsx +5 -1
  169. package/src/tokens/palette.ts +7 -10
@@ -9,19 +9,29 @@
9
9
  * (e.g. VO2max) with `rows` under it; omit `value` to render the rows alone.
10
10
  *
11
11
  * `state` replaces the readings (hero, visual, rows, footer) with the cell's empty or error body, at
12
- * the cell's size. Empty: `—` in the value position and the reason, muted. Error: the shared error
13
- * anatomy compact — status dot, the word `Failed`, the message, the shared Retry. The caption stays.
12
+ * the cell's size. Empty: the reason, muted, in the value's place (`—` only when no reason is given). Error: the shared error
13
+ * anatomy compact — status dot, the words `Could not load`, the message, the shared Retry. The caption stays.
14
14
  * A `visual` is a hero host: a zoned `Meter` in it does not repeat the value at its marker.
15
15
  *
16
- * Alignment: cells of one row align by PART (caption, value, hero footer, visual, rows, footer share
17
- * tracks via subgrid), and each cell spans only down to its last part, so its own box ends at its
18
- * content. A footer rides with what it captions (under the hero: its own track right below it).
19
- * The dividers belong to a row-high slot around the cell, so they run the whole row and the area
20
- * under a short cell is the strip's own surface. `action` sits at the end of the caption line (the
21
- * caption truncates first); a row with `hideValue` prints its label alone.
16
+ * Alignment: a cell is a plain column that ends at its content (the slot around it runs the whole
17
+ * row, so the dividers do too). Cells of one row share a caption top and a value baseline BY
18
+ * CONSTRUCTION: the caption line is one line (it truncates with a `title`), and when any cell has a
19
+ * qualifier a narrow cell reserves the qualifier's own line, so the parts above the value have equal
20
+ * height. Below the value nothing is shared: a visual starts right under it, rows follow, and a
21
+ * footer rides with the last part it captions, so a short cell never holds a taller sibling's void.
22
+ * `action` sits at the end of the caption line (the caption truncates first); a row with `hideValue`
23
+ * prints its label alone.
22
24
  *
23
25
  * Anchors: each cell is `data-shot="strip-<key>"` and each footer cell
24
- * `data-shot="strip-footer-<key>"` (derived — a consumer cannot choose another name).
26
+ * `data-shot="strip-footer-<key>"` (derived — a consumer cannot choose another name). A footer entry
27
+ * with `under: '<cell key>'` qualifies that one cell and is PART of it, at every width: it renders in
28
+ * the cell's own slot under its content, so it neither stretches its siblings nor opens a void, and it
29
+ * follows its cell when the strip folds. An entry without `under` (or naming no cell) is full width
30
+ * under the grid.
31
+ *
32
+ * Absence: a page that hides the strip in a declared shot state sets `shotAbsent` on the group
33
+ * (`['empty']`): every derived anchor, cells and footer cells, then carries `data-shot-absent`. A
34
+ * cell's own `shotAbsent` replaces the group's for that cell (the exception).
25
35
  *
26
36
  * Mapping from a prototype: warden's JSX `qualifier` line UNDER the value is `footer`; the cell
27
37
  * `qualifier` is the short `· text` on the caption line. Cells are equal-weight: unequal column
@@ -40,6 +50,12 @@ import { InfoGlyph } from './widget-header'
40
50
  import classes from './stat-strip.module.css'
41
51
  import { HOSTED, VisualSlotContext } from './visual-slot'
42
52
 
53
+ /** The URL shot states an anchor can declare itself absent in (`data-shot-absent`). */
54
+ type StatStripShotState = 'empty' | 'loading' | 'error'
55
+
56
+ const absentAttr = (states: readonly StatStripShotState[] | undefined) =>
57
+ states === undefined || states.length === 0 ? {} : { 'data-shot-absent': states.join(' ') }
58
+
43
59
  export type StatStripRow = {
44
60
  key: string
45
61
  label: string
@@ -99,6 +115,17 @@ export type StatStripCell = {
99
115
  stale?: boolean
100
116
  /** Empty or failed: replaces the readings; `loading` wins while pending. */
101
117
  state?: StatStripCellState
118
+ /** The shot states this cell's anchor is absent in; replaces the group's `shotAbsent`. */
119
+ shotAbsent?: readonly StatStripShotState[]
120
+ }
121
+
122
+ export type StatStripFooterEntry = {
123
+ key: string
124
+ content: ReactNode
125
+ /** The `key` of the cell this entry qualifies: it renders inside that cell, under its content, at
126
+ * every width, as a sibling AFTER the article (outside its `aria-labelledby` region). For a key that
127
+ * names no cell it takes the full width under the grid. */
128
+ under?: string
102
129
  }
103
130
 
104
131
  export type StatStripProps = BasaltProps & {
@@ -106,24 +133,31 @@ export type StatStripProps = BasaltProps & {
106
133
  label: string
107
134
  cells: readonly StatStripCell[]
108
135
  /** Wider cells under the cells. */
109
- footer?: readonly { key: string; content: ReactNode }[]
136
+ footer?: readonly StatStripFooterEntry[]
110
137
  /** The DESKTOP column count. Default: the cell count, capped at 6. */
111
138
  cols?: 2 | 3 | 4 | 5 | 6
139
+ /** The shot states the page hides the whole strip in (`data-shot-absent` on every derived anchor). */
140
+ shotAbsent?: readonly StatStripShotState[]
112
141
  }
113
142
 
114
143
  const EMPTY = '—'
115
144
 
116
145
  function CellState({ state }: { state: StatStripCellState }) {
117
146
  if (state.kind === 'empty') {
147
+ // A stated reason IS the gap: it takes the value's place, so no bare dash sits above it.
148
+ if (state.reason !== undefined) {
149
+ return (
150
+ <p className={classes.reason} data-strip-reason>
151
+ {state.reason}
152
+ </p>
153
+ )
154
+ }
118
155
  return (
119
- <>
120
- <div className={classes.valueRow}>
121
- <span className={classes.value} data-strip-value>
122
- {EMPTY}
123
- </span>
124
- </div>
125
- {state.reason !== undefined && <p className={classes.reason}>{state.reason}</p>}
126
- </>
156
+ <div className={classes.valueRow}>
157
+ <span className={classes.value} data-strip-value>
158
+ {EMPTY}
159
+ </span>
160
+ </div>
127
161
  )
128
162
  }
129
163
  const message = toErrorMessage(state.error, 'The request failed.')
@@ -131,7 +165,7 @@ function CellState({ state }: { state: StatStripCellState }) {
131
165
  <div className={classes.error} role="alert" data-strip-state="error">
132
166
  <span className={classes.errorHead}>
133
167
  <StatusDot color={VX.status.bad} />
134
- Failed
168
+ Could not load
135
169
  </span>
136
170
  <p className={classes.reason}>{message}</p>
137
171
  {state.onRetry !== undefined && (
@@ -141,32 +175,46 @@ function CellState({ state }: { state: StatStripCellState }) {
141
175
  )
142
176
  }
143
177
 
144
- /** The last of the six shared tracks (caption, hero, hero footer, visual, rows, footer) a cell paints into. */
145
- function lastTrackOf(cell: StatStripCell, state: StatStripCellState | undefined) {
146
- if (state !== undefined) return state.kind === 'empty' && state.reason !== undefined ? 4 : 2
147
- if (cell.rows !== undefined)
148
- return cell.footer !== undefined ? 6 : cell.visual !== undefined ? 5 : 4
149
- if (cell.visual !== undefined) return 4
150
- return cell.footer !== undefined ? 3 : 2
178
+ function FooterCell({
179
+ entry,
180
+ shotAbsent,
181
+ under,
182
+ }: {
183
+ entry: StatStripFooterEntry
184
+ shotAbsent: readonly StatStripShotState[] | undefined
185
+ under: boolean
186
+ }) {
187
+ return (
188
+ <div
189
+ className={under ? classes.underCell : classes.footerCell}
190
+ data-strip-footer-cell={entry.key}
191
+ data-shot={`strip-footer-${entry.key}`}
192
+ {...absentAttr(shotAbsent)}
193
+ {...(under && { 'data-under': entry.under })}
194
+ >
195
+ {entry.content}
196
+ </div>
197
+ )
151
198
  }
152
199
 
153
- function StripCell({ cell }: { cell: StatStripCell }) {
200
+ function StripCell({
201
+ cell,
202
+ shotAbsent,
203
+ under,
204
+ }: {
205
+ cell: StatStripCell
206
+ shotAbsent: readonly StatStripShotState[] | undefined
207
+ under: readonly StatStripFooterEntry[]
208
+ }) {
154
209
  const captionId = useId()
155
210
  const { rows, loading } = cell
156
211
  const state = loading ? undefined : cell.state
157
212
  const hasHero = cell.value !== undefined || rows === undefined
158
- // A footer under a visual (and no rows) rides with it, so it hugs that visual instead of dropping
159
- // to a taller sibling's; under a hero alone it rides with the value; only under rows does it take
160
- // the row's shared footer track.
161
- const ownFooter = cell.visual !== undefined && rows === undefined
162
- const heroFooter = hasHero && cell.visual === undefined && rows === undefined
163
- // The cell spans the tracks down to its last part, so its box ends at its content (the slot
164
- // around it still runs the whole row for the dividers).
165
213
  // The cell's verdict colours a plain Meter in its visual too (a hero host only).
166
214
  const hostSlot = !hasHero ? null : cell.tone === undefined ? HOSTED : { tone: cell.tone }
167
- const lastTrack = lastTrackOf(cell, state)
215
+ // A footer rides with what it captions: it follows the cell's last part, whatever a sibling holds.
168
216
  const footerEl = cell.footer !== undefined && (
169
- <div className={cx(classes.footer, heroFooter && classes.heroFooter)} data-strip-footer>
217
+ <div className={classes.footer} data-strip-footer>
170
218
  {cell.footer}
171
219
  </div>
172
220
  )
@@ -188,14 +236,15 @@ function StripCell({ cell }: { cell: StatStripCell }) {
188
236
  </div>
189
237
  )
190
238
  return (
191
- // The slot owns the dividers and stretches to the row; the article inside ends at its content.
239
+ // The slot owns the dividers and runs the row; the article inside ends at its content.
192
240
  <div className={classes.cell} data-strip-slot>
193
241
  <article
194
242
  className={classes.content}
195
- style={{ '--basalt-strip-span': lastTrack } as CSSProperties}
196
243
  data-strip-cell={cell.key}
197
244
  data-shot={`strip-${cell.key}`}
198
245
  aria-labelledby={captionId}
246
+ {...absentAttr(cell.shotAbsent ?? shotAbsent)}
247
+ {...(state !== undefined && { 'data-strip-has-state': '' })}
199
248
  {...(state === undefined && cell.visual !== undefined && { 'data-strip-has-visual': '' })}
200
249
  {...(state === undefined && rows !== undefined && { 'data-strip-has-rows': '' })}
201
250
  {...(cell.stale && { 'data-stale': 'true' })}
@@ -226,15 +275,9 @@ function StripCell({ cell }: { cell: StatStripCell }) {
226
275
  </div>
227
276
  {state !== undefined && <CellState state={state} />}
228
277
  {state === undefined && hasHero && heroEl}
229
- {state === undefined && heroFooter && footerEl}
230
278
  {state === undefined && cell.visual !== undefined && (
231
- <div className={classes.visualStack}>
232
- <div className={classes.visual} data-strip-visual>
233
- <VisualSlotContext.Provider value={hostSlot}>
234
- {cell.visual}
235
- </VisualSlotContext.Provider>
236
- </div>
237
- {ownFooter && footerEl}
279
+ <div className={classes.visual} data-strip-visual>
280
+ <VisualSlotContext.Provider value={hostSlot}>{cell.visual}</VisualSlotContext.Provider>
238
281
  </div>
239
282
  )}
240
283
  {state === undefined &&
@@ -259,16 +302,32 @@ function StripCell({ cell }: { cell: StatStripCell }) {
259
302
  ))}
260
303
  </ul>
261
304
  ))}
262
- {state === undefined && !ownFooter && !heroFooter && footerEl}
305
+ {state === undefined && footerEl}
263
306
  </article>
307
+ {under.map((entry) => (
308
+ <FooterCell key={entry.key} entry={entry} shotAbsent={shotAbsent} under />
309
+ ))}
264
310
  </div>
265
311
  )
266
312
  }
267
313
 
268
- export function StatStrip({ label, cells, footer, cols, className, style }: StatStripProps) {
314
+ export function StatStrip({
315
+ label,
316
+ cells,
317
+ footer,
318
+ cols,
319
+ shotAbsent,
320
+ className,
321
+ style,
322
+ }: StatStripProps) {
269
323
  const desktop = cols ?? Math.min(Math.max(cells.length, 2), 6)
270
324
  // `StatGroup`'s rule: four is 2 + 2 below the full count, never 3 + 1.
271
325
  const mid = desktop === 4 ? 2 : Math.min(desktop, 3)
326
+ const keys = new Set(cells.map((cell) => cell.key))
327
+ const underOf = (key: string) => footer?.filter((entry) => entry.under === key) ?? []
328
+ const rest = footer?.filter((entry) => entry.under === undefined || !keys.has(entry.under)) ?? []
329
+ const hasQualifier = cells.some((cell) => cell.qualifier !== undefined)
330
+ const hasAction = cells.some((cell) => cell.action !== undefined)
272
331
  return (
273
332
  <div className={cx(classes.container, className)} style={style}>
274
333
  <Card>
@@ -276,6 +335,8 @@ export function StatStrip({ label, cells, footer, cols, className, style }: Stat
276
335
  component="section"
277
336
  aria-label={label}
278
337
  className={classes.clip}
338
+ {...(hasQualifier && { 'data-strip-qualifier': '' })}
339
+ {...(hasAction && { 'data-strip-action-row': '' })}
279
340
  style={
280
341
  {
281
342
  '--basalt-strip-cols': desktop,
@@ -285,20 +346,18 @@ export function StatStrip({ label, cells, footer, cols, className, style }: Stat
285
346
  >
286
347
  <div className={classes.cells}>
287
348
  {cells.map((cell) => (
288
- <StripCell key={cell.key} cell={cell} />
349
+ <StripCell
350
+ key={cell.key}
351
+ cell={cell}
352
+ shotAbsent={shotAbsent}
353
+ under={underOf(cell.key)}
354
+ />
289
355
  ))}
290
356
  </div>
291
- {footer !== undefined && footer.length > 0 && (
357
+ {rest.length > 0 && (
292
358
  <div className={classes.footerRow}>
293
- {footer.map((entry) => (
294
- <div
295
- key={entry.key}
296
- className={classes.footerCell}
297
- data-strip-footer-cell={entry.key}
298
- data-shot={`strip-footer-${entry.key}`}
299
- >
300
- {entry.content}
301
- </div>
359
+ {rest.map((entry) => (
360
+ <FooterCell key={entry.key} entry={entry} shotAbsent={shotAbsent} under={false} />
302
361
  ))}
303
362
  </div>
304
363
  )}
@@ -230,6 +230,12 @@
230
230
  color: var(--vx-muted);
231
231
  }
232
232
 
233
+ /* A Section shell holds three sizes: the title (`md`), this note and the count tag (`xs`), and the
234
+ * body (`sm`). The note steps down to the count tag's rung instead of sitting between them. */
235
+ .root[data-tier='section'] .subtitle {
236
+ font-size: var(--vx-text-xs);
237
+ }
238
+
233
239
  /* `data-placement` is read by wave-3 composers wanting a `bleed` layout (docs/CONTROLS-SPEC.md
234
240
  * §2.2's `sparklinePlacement` composer mapping) — this primitive only ever sets `right`. */
235
241
  .sparkline {
@@ -170,6 +170,14 @@ const BUBBLE_EDGE = 8
170
170
 
171
171
  type BubblePos = { top: number; left: number }
172
172
 
173
+ /** The `basalt-card` container (`ChartCard`/`StatCard`/`Section`) the glyph sits in, if any. */
174
+ function cardOf(trigger: Element): Element | null {
175
+ for (let el = trigger.parentElement; el !== null; el = el.parentElement) {
176
+ if (getComputedStyle(el).containerName.split(/\s+/).includes('basalt-card')) return el
177
+ }
178
+ return null
179
+ }
180
+
173
181
  /**
174
182
  * Places the bubble in the VIEWPORT: below the glyph, flipped above when it would overflow the
175
183
  * bottom edge, shifted sideways to stay inside the left and right edges. Re-places on scroll, resize
@@ -191,6 +199,8 @@ function useBubblePosition(
191
199
  // is the same box the placement maths below positions.
192
200
  const bubbleEl = bubbleRef.current
193
201
  if (bubbleEl !== null && typeof bubbleEl.showPopover === 'function') bubbleEl.showPopover()
202
+ // The card is resolved once per open, not on every scroll re-place.
203
+ const card = triggerRef.current === null ? null : cardOf(triggerRef.current)
194
204
  const place = () => {
195
205
  const trigger = triggerRef.current
196
206
  const bubble = bubbleRef.current
@@ -202,7 +212,24 @@ function useBubblePosition(
202
212
  const viewH = document.documentElement.clientHeight
203
213
  const below = t.bottom + BUBBLE_GAP
204
214
  const above = t.top - BUBBLE_GAP - b.height
205
- const top = below + b.height > viewH - BUBBLE_EDGE && above >= BUBBLE_EDGE ? above : below
215
+ const overflows = below + b.height > viewH - BUBBLE_EDGE
216
+ // Inside a card the bubble never leaves the card's own box upward: above the header is the
217
+ // card above, and a bubble there covers that card's hero. It flips only into room the card
218
+ // itself owns; otherwise it stays below the glyph and slides up just far enough to fit.
219
+ const viewportFlip = above >= BUBBLE_EDGE ? above : below
220
+ let top = below
221
+ if (overflows) {
222
+ // A card scrolled partly off the top has a negative top: never place above the viewport edge.
223
+ const floor =
224
+ card === null ? BUBBLE_EDGE : Math.max(BUBBLE_EDGE, card.getBoundingClientRect().top)
225
+ if (above >= floor) top = above
226
+ else if (card !== null) {
227
+ const slid = Math.max(floor, viewH - BUBBLE_EDGE - b.height)
228
+ // Never cover the glyph itself: when the slid bubble would, take the viewport flip instead.
229
+ const covers = slid < t.bottom && slid + b.height > t.top
230
+ top = covers ? viewportFlip : slid
231
+ }
232
+ }
206
233
  const left = Math.max(BUBBLE_EDGE, Math.min(t.left, viewW - BUBBLE_EDGE - b.width))
207
234
  setPos((prev) => (prev?.top === top && prev.left === left ? prev : { top, left }))
208
235
  }
@@ -862,8 +862,8 @@ export type GraceEntry = { since: string; promote: string; why: string }
862
862
 
863
863
  /**
864
864
  * Kinds still inside their grace minor — reported, not fatal, until the next minor promotes them.
865
- * Empty since 1.36.0: `unknown-vx-token`, the last tenant, promoted (its grace ran one minor past
866
- * 1.35.0 to keep the factory throw out of the a11y release).
865
+ * Empty since 2.24.0: `raw-spacing` and `inline-spacing` (since 2.16.0), the last tenants, promoted.
866
+ * It was empty once before, at 1.36.0, when `unknown-vx-token` promoted.
867
867
  * See {@link GuardSeverity} for the doctrine and why basalt-ui in particular needs it.
868
868
  *
869
869
  * Adding a kind here is part of shipping it; removing the entry IS the promotion, and belongs in
@@ -900,23 +900,7 @@ export type GraceEntry = { since: string; promote: string; why: string }
900
900
  * 'raw-font-family': { since: '1.4.0', promote: '1.5.0', why: 'introduced 1.4.0 — …' },
901
901
  * }
902
902
  */
903
- export const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>> = {
904
- 'raw-spacing': {
905
- since: '2.16.0',
906
- promote: '2.24.0',
907
- why: 'The spacing scale moved to 8/12/16/20/24 in 2.16.0: a prop value equal to a NEW step (p={16}) is newly a finding.',
908
- },
909
- 'inline-spacing': {
910
- since: '2.16.0',
911
- promote: '2.24.0',
912
- why: 'The scale moved to 8/12/16/20/24 and the CSS micro ceiling dropped 10 → 7 in 2.16.0: a literal 8px/10px in CSS is newly a finding.',
913
- },
914
- 'series-palette': {
915
- since: '2.21.0',
916
- promote: '2.23.0',
917
- why: 'New in 2.21.0: the series file is judged by computed lightness, chroma, colour-blind separation and contrast; a palette that was tuned by eye is newly a finding.',
918
- },
919
- }
903
+ export const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>> = {}
920
904
 
921
905
  /** A kind's effective severity: consumer override first, then the grace table, then `error`. */
922
906
  export function severityOf(kind: GuardKind, cfg: GuardConfig): GuardSeverity {
package/src/styles.css CHANGED
@@ -31,6 +31,21 @@
31
31
  @import '@fontsource-variable/hubot-sans';
32
32
  @import '@fontsource-variable/jetbrains-mono';
33
33
 
34
+ /* Hubot Sans has no `zero` OpenType feature and its default zero is slashed, so a head-face "2026" or
35
+ * "90 days" cannot be fixed with `font-feature-settings`. Digits come from the sans instead: this
36
+ * face covers U+0030-0039 only, cut from the Nunito Sans variable file, and leads
37
+ * `--basalt-font-head`, so Hubot draws every letter and Nunito every digit. */
38
+ @font-face {
39
+ /* theme-allow raw-font-family — declares the face, uses nothing */
40
+ font-family: 'Basalt Head Digits';
41
+ font-style: normal;
42
+ font-display: swap;
43
+ font-weight: 200 1000;
44
+ src: url('@fontsource-variable/nunito-sans/files/nunito-sans-latin-wght-normal.woff2')
45
+ format('woff2-variations');
46
+ unicode-range: U+0030-0039;
47
+ }
48
+
34
49
  /* Font stack — overridable via the --basalt-font-* custom properties. */
35
50
  @layer base {
36
51
  :root {
@@ -42,9 +57,10 @@
42
57
  --basalt-font-sans:
43
58
  'Nunito Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
44
59
  Helvetica, Arial, sans-serif;
60
+ /* A consumer that sets its own head family replaces this stack, digit face included, by design. */
45
61
  --basalt-font-head:
46
- 'Hubot Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica,
47
- Arial, sans-serif;
62
+ 'Basalt Head Digits', 'Hubot Sans Variable', ui-sans-serif, system-ui, -apple-system,
63
+ 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
48
64
  --basalt-font-mono: 'JetBrains Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;
49
65
  /* Hero values, unit/count/delta text, bar-list and meter figures: proportional sans, lining
50
66
  figures. Set to `var(--basalt-font-mono)` to restore the pre-Wave-35 mono numerals. */
@@ -67,15 +83,6 @@
67
83
  text-size-adjust: 100%;
68
84
  }
69
85
 
70
- /* A slashed zero belongs to data text only. Hubot Sans (the heading face) draws one, and it leaked
71
- into every title that borrows the face (`2026`, `90 days`). `zero` is OFF by default and nothing
72
- in the package turns it on, so this is the off state at the root: it inherits into every head-face
73
- surface whether a heading element, a Mantine title or a CSS-module class that only sets the
74
- family, and is a no-op on the mono stack. */
75
- :root {
76
- font-feature-settings: 'zero' 0;
77
- }
78
-
79
86
  /* Mono data text drops its ligatures: `<>` in a facts line is two characters, not a diamond. Reaches
80
87
  the mono stack by element (code, kbd, samp, pre), by contract (`data-numeric`, `data-monospace`),
81
88
  by Mantine's `ff="monospace"` inline style, and by the stack's own var in an inline style. Body
@@ -1790,7 +1790,7 @@ export function BasaltDataTable<T extends RowData>(props: BasaltDataTableProps<T
1790
1790
  const errorNode = queryError !== undefined && (
1791
1791
  <ErrorState
1792
1792
  error={queryError.error}
1793
- title="Could not load"
1793
+ title="Could not load rows"
1794
1794
  tier="section"
1795
1795
  retrying={queryError.fetchStatus === 'fetching'}
1796
1796
  onRetry={() => void queryError.refetch()}
@@ -243,6 +243,9 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
243
243
  },
244
244
  },
245
245
  "Alert": {
246
+ "classNames": {
247
+ "root": undefined,
248
+ },
246
249
  "styles": {
247
250
  "title": {
248
251
  "fontFamily": "var(--basalt-font-head)",
@@ -547,7 +550,7 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
547
550
  "styles": {
548
551
  "root": {
549
552
  "backgroundColor": "color-mix(in srgb, var(--vx-ink) 7%, transparent)",
550
- "borderRadius": "var(--vx-radius-tight)",
553
+ "borderRadius": "var(--basalt-code-radius, var(--vx-radius-tight))",
551
554
  },
552
555
  },
553
556
  },
@@ -899,7 +902,7 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
899
902
  indicator: {
900
903
  boxShadow: "var(--vx-shadow-raised)",
901
904
  outline: "1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)",
902
- borderRadius: "var(--vx-radius-fine)"
905
+ borderRadius: "round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"
903
906
  },
904
907
  ...props.size === "ctl" ? {
905
908
  label: {
@@ -914,11 +917,11 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
914
917
  "outputs": [
915
918
  {
916
919
  "probes": 2020,
917
- "result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"var(--vx-radius-fine)"}}",
920
+ "result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"}}",
918
921
  },
919
922
  {
920
923
  "probes": 288,
921
- "result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"var(--vx-radius-fine)"},"label":{"display":"inline-flex","alignItems":"center","minHeight":"calc(var(--vx-space-control-height-ctl) * var(--mantine-scale) - 4px)"}}",
924
+ "result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"},"label":{"display":"inline-flex","alignItems":"center","minHeight":"calc(var(--vx-space-control-height-ctl) * var(--mantine-scale) - 4px)"}}",
922
925
  },
923
926
  ],
924
927
  },
@@ -1573,6 +1576,9 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
1573
1576
  },
1574
1577
  },
1575
1578
  "Alert": {
1579
+ "classNames": {
1580
+ "root": undefined,
1581
+ },
1576
1582
  "styles": {
1577
1583
  "title": {
1578
1584
  "fontFamily": "var(--basalt-font-head)",
@@ -1877,7 +1883,7 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
1877
1883
  "styles": {
1878
1884
  "root": {
1879
1885
  "backgroundColor": "color-mix(in srgb, var(--vx-ink) 7%, transparent)",
1880
- "borderRadius": "var(--vx-radius-tight)",
1886
+ "borderRadius": "var(--basalt-code-radius, var(--vx-radius-tight))",
1881
1887
  },
1882
1888
  },
1883
1889
  },
@@ -2229,7 +2235,7 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
2229
2235
  indicator: {
2230
2236
  boxShadow: "var(--vx-shadow-raised)",
2231
2237
  outline: "1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)",
2232
- borderRadius: "var(--vx-radius-fine)"
2238
+ borderRadius: "round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"
2233
2239
  },
2234
2240
  ...props.size === "ctl" ? {
2235
2241
  label: {
@@ -2244,11 +2250,11 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
2244
2250
  "outputs": [
2245
2251
  {
2246
2252
  "probes": 2020,
2247
- "result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"var(--vx-radius-fine)"}}",
2253
+ "result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"}}",
2248
2254
  },
2249
2255
  {
2250
2256
  "probes": 288,
2251
- "result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"var(--vx-radius-fine)"},"label":{"display":"inline-flex","alignItems":"center","minHeight":"calc(var(--vx-space-control-height-ctl) * var(--mantine-scale) - 4px)"}}",
2257
+ "result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"},"label":{"display":"inline-flex","alignItems":"center","minHeight":"calc(var(--vx-space-control-height-ctl) * var(--mantine-scale) - 4px)"}}",
2252
2258
  },
2253
2259
  ],
2254
2260
  },
@@ -323,6 +323,12 @@ html .tableRoot tbody tr:last-of-type {
323
323
  border-bottom: none;
324
324
  }
325
325
 
326
+ /* A status word is the text as written ("Healthy"), not Mantine's UPPERCASE default; a caller who wants
327
+ * a micro-caption passes `tt="uppercase"`, which is inline and wins. `html` outranks Mantine's class. */
328
+ html .badgeRoot {
329
+ text-transform: none;
330
+ }
331
+
326
332
  /*
327
333
  * Badge status dot: a coloured `light` Badge is the neutral surface + ink word with a leading dot in the
328
334
  * status colour (`badgeVars` writes the `--badge-dot*` vars; nothing here without them). The dot is a
@@ -359,3 +365,16 @@ html .tableRoot tbody tr:last-of-type {
359
365
  .badgeSection img {
360
366
  object-fit: contain;
361
367
  }
368
+
369
+ /*
370
+ * Alert: an inline Code inside it sits one nested step (3px) under the Alert's own radius
371
+ * (craft-1/nested-radius-step), snapped down onto the radius scale (2, or 0 under a 5px Alert). The Code theme reads
372
+ * `--basalt-code-radius`; the Alert supplies it.
373
+ */
374
+ .alertRoot {
375
+ --basalt-code-radius: round(
376
+ down,
377
+ min(2px, max(0px, var(--alert-radius, var(--vx-radius-ctrl)) - 3px)),
378
+ 2px
379
+ );
380
+ }
@@ -5,6 +5,7 @@
5
5
  declare const classes: {
6
6
  readonly inputWrapper: string
7
7
  readonly input: string
8
+ readonly alertRoot: string
8
9
  readonly buttonRoot: string
9
10
  readonly actionIconRoot: string
10
11
  readonly checkboxCardRoot: string
@@ -517,6 +517,7 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
517
517
  // already on-system (defaultRadius 'md' control tier + the variant color resolver), so only
518
518
  // the title font is overridden.
519
519
  Alert: ext<typeof Alert>({
520
+ classNames: { root: controlsClasses.alertRoot },
520
521
  styles: {
521
522
  title: {
522
523
  fontFamily: 'var(--basalt-font-head)',
@@ -775,11 +776,12 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
775
776
  // label that no longer fits its equal share truncates instead of forcing the column wide.
776
777
  //
777
778
  // The track's padding is `SPACE_FIXED.segmentedTrackInset`, a plain literal — NOT a
778
- // `--vx-space-*` var — because it is density-EXEMPT: it is load-bearing for the nested-corner
779
- // law (`RADIUS.ctrl === RADIUS_STEP.fine + segmentedTrackInset`, see that constant's doc in
780
- // `tokens/palette.ts`), and `radius.ctrl`/`RADIUS_STEP.fine` below already track the
781
- // RADIUS knob together, so the inset between them must stay fixed at exactly 2 regardless of
782
- // density.
779
+ // `--vx-space-*` var — because it is density-EXEMPT (see that constant's doc in
780
+ // `tokens/palette.ts`). The INDICATOR radius is the track's per-instance radius (`--sc-radius`,
781
+ // which Mantine sets on the root from the `radius` prop) minus 3 px, snapped DOWN onto the radius
782
+ // scale: `craft-1/nested-radius-step` wants nested surfaces ≥ 3 px apart, SPEC § 8.1 rule 1 wants
783
+ // every radius on a § 5 step, and the only step that satisfies both under a 6 px track is 2
784
+ // (`RADIUS_STEP.scaleXs`; 0 when the track is under 5 px). A custom `radius` therefore nests too.
783
785
  SegmentedControl: ext<typeof SegmentedControl>({
784
786
  defaultProps: { radius: radius.ctrl },
785
787
  classNames: {
@@ -818,7 +820,9 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
818
820
  // ink-12% fill sat one shade from the track and read as a hover state.
819
821
  boxShadow: 'var(--vx-shadow-raised)',
820
822
  outline: '1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)',
821
- borderRadius: 'var(--vx-radius-fine)',
823
+ // Nested radius snapped to the scale (SPEC § 8.1 rule 1): 2 when the track leaves a 3 px step, else 0.
824
+ // `--sc-radius` has no fallback: `defaultProps.radius` above guarantees Mantine sets it.
825
+ borderRadius: 'round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)',
822
826
  },
823
827
  // Conditionally spread the WHOLE key (never a present `label: undefined`) — the package
824
828
  // builds under `exactOptionalPropertyTypes`, which treats a key present-but-`undefined` as
@@ -1040,7 +1044,8 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
1040
1044
  styles: {
1041
1045
  root: {
1042
1046
  backgroundColor: 'color-mix(in srgb, var(--vx-ink) 7%, transparent)',
1043
- borderRadius: 'var(--vx-radius-tight)',
1047
+ // An Alert re-points the var (`controls.module.css`) so a nested Code steps down.
1048
+ borderRadius: 'var(--basalt-code-radius, var(--vx-radius-tight))',
1044
1049
  },
1045
1050
  },
1046
1051
  }),
@@ -23,7 +23,11 @@ export function StatusVerdict({ color, word, phrase, className, style }: StatusV
23
23
  return (
24
24
  <span className={cx(classes.verdict, className)} {...(style !== undefined && { style })}>
25
25
  <StatusDot color={color} />
26
- <span data-verdict-word="" {...(phrase !== undefined && { 'aria-hidden': true })}>
26
+ <span
27
+ data-verdict-word=""
28
+ title={phrase ?? word}
29
+ {...(phrase !== undefined && { 'aria-hidden': true })}
30
+ >
27
31
  {word}
28
32
  </span>
29
33
  {phrase !== undefined && <span className={classes.hidden}>{phrase}</span>}