basalt-ui 2.23.0 → 2.25.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 (122) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/MIGRATING.md +264 -12
  3. package/agent/agents/basalt-design-reviewer.md +2 -2
  4. package/agent/skills/basalt-design/SKILL.md +1 -1
  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/Bars.d.ts.map +1 -1
  8. package/dist/charts/Bars.js +21 -3
  9. package/dist/charts/CartesianChart.d.ts +2 -0
  10. package/dist/charts/CartesianChart.d.ts.map +1 -1
  11. package/dist/charts/CartesianChart.js +7 -3
  12. package/dist/charts/ChartCard.d.ts +6 -2
  13. package/dist/charts/ChartCard.d.ts.map +1 -1
  14. package/dist/charts/ChartCard.js +1 -1
  15. package/dist/charts/Sparkline.d.ts.map +1 -1
  16. package/dist/charts/Sparkline.js +32 -6
  17. package/dist/charts/StackedArea.d.ts.map +1 -1
  18. package/dist/charts/StackedArea.js +5 -1
  19. package/dist/charts/chart-legend.module.css +16 -0
  20. package/dist/charts/compile.d.ts +4 -0
  21. package/dist/charts/compile.d.ts.map +1 -1
  22. package/dist/charts/compile.js +65 -3
  23. package/dist/charts/legend.d.ts +0 -6
  24. package/dist/charts/legend.d.ts.map +1 -1
  25. package/dist/charts/legend.js +87 -35
  26. package/dist/charts/sparkline.module.css +59 -6
  27. package/dist/charts/sparkline.module.css.d.ts +1 -0
  28. package/dist/charts/state.d.ts +3 -1
  29. package/dist/charts/state.d.ts.map +1 -1
  30. package/dist/charts/state.js +10 -2
  31. package/dist/charts/types.d.ts +11 -0
  32. package/dist/charts/types.d.ts.map +1 -1
  33. package/dist/cli/shot/detect.d.ts.map +1 -1
  34. package/dist/cli/shot/detect.js +25 -36
  35. package/dist/cli/shot/measure.js +19 -23
  36. package/dist/dashboard/bar-list.d.ts.map +1 -1
  37. package/dist/dashboard/bar-list.js +16 -2
  38. package/dist/dashboard/bar-list.module.css +10 -17
  39. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  40. package/dist/dashboard/empty-state.d.ts.map +1 -1
  41. package/dist/dashboard/meter-model.d.ts +30 -1
  42. package/dist/dashboard/meter-model.d.ts.map +1 -1
  43. package/dist/dashboard/meter-model.js +74 -5
  44. package/dist/dashboard/meter-parts.d.ts +8 -1
  45. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  46. package/dist/dashboard/meter-parts.js +64 -21
  47. package/dist/dashboard/meter.d.ts +8 -1
  48. package/dist/dashboard/meter.d.ts.map +1 -1
  49. package/dist/dashboard/meter.js +14 -3
  50. package/dist/dashboard/meter.module.css +42 -2
  51. package/dist/dashboard/meter.module.css.d.ts +4 -0
  52. package/dist/dashboard/query-state.d.ts +7 -3
  53. package/dist/dashboard/query-state.d.ts.map +1 -1
  54. package/dist/dashboard/query-state.js +14 -6
  55. package/dist/dashboard/section.d.ts +2 -1
  56. package/dist/dashboard/section.d.ts.map +1 -1
  57. package/dist/dashboard/section.module.css +12 -0
  58. package/dist/dashboard/settings-section.d.ts +1 -1
  59. package/dist/dashboard/settings-section.d.ts.map +1 -1
  60. package/dist/dashboard/settings-section.js +3 -3
  61. package/dist/dashboard/stat-card.module.css +24 -10
  62. package/dist/dashboard/stat-group.module.css +8 -0
  63. package/dist/dashboard/stat-strip.d.ts +3 -2
  64. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  65. package/dist/dashboard/stat-strip.js +83 -73
  66. package/dist/dashboard/stat-strip.module.css +24 -39
  67. package/dist/dashboard/stat-strip.module.css.d.ts +1 -0
  68. package/dist/dashboard/widget-header.d.ts.map +1 -1
  69. package/dist/dashboard/widget-header.js +19 -1
  70. package/dist/dashboard/widget-header.module.css +6 -0
  71. package/dist/guard/index.d.ts +2 -2
  72. package/dist/guard/index.d.ts.map +1 -1
  73. package/dist/guard/index.js +1 -12
  74. package/dist/table/data-table.js +1 -1
  75. package/dist/theme/controls.module.css +7 -2
  76. package/dist/theme/index.d.ts.map +1 -1
  77. package/dist/theme/index.js +7 -5
  78. package/dist/tokens/palette.d.ts +2 -2
  79. package/dist/tokens/palette.d.ts.map +1 -1
  80. package/dist/tokens/palette.js +2 -2
  81. package/llms.txt +4 -3
  82. package/package.json +1 -1
  83. package/src/charts/Bars.tsx +36 -4
  84. package/src/charts/CartesianChart.tsx +9 -3
  85. package/src/charts/ChartCard.tsx +7 -3
  86. package/src/charts/Sparkline.tsx +66 -21
  87. package/src/charts/StackedArea.tsx +12 -1
  88. package/src/charts/chart-legend.module.css +16 -0
  89. package/src/charts/compile.ts +104 -2
  90. package/src/charts/legend.tsx +70 -3
  91. package/src/charts/sparkline.module.css +59 -6
  92. package/src/charts/sparkline.module.css.d.ts +1 -0
  93. package/src/charts/state.tsx +16 -7
  94. package/src/charts/types.ts +9 -0
  95. package/src/cli/shot/detect.ts +26 -40
  96. package/src/cli/shot/measure.ts +27 -27
  97. package/src/dashboard/bar-list.module.css +10 -17
  98. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  99. package/src/dashboard/bar-list.tsx +14 -2
  100. package/src/dashboard/empty-state.tsx +4 -2
  101. package/src/dashboard/meter-model.ts +124 -7
  102. package/src/dashboard/meter-parts.tsx +127 -31
  103. package/src/dashboard/meter.module.css +42 -2
  104. package/src/dashboard/meter.module.css.d.ts +4 -0
  105. package/src/dashboard/meter.tsx +22 -3
  106. package/src/dashboard/query-state.tsx +19 -8
  107. package/src/dashboard/section.module.css +12 -0
  108. package/src/dashboard/section.tsx +2 -1
  109. package/src/dashboard/settings-section.tsx +4 -4
  110. package/src/dashboard/stat-card.module.css +24 -10
  111. package/src/dashboard/stat-group.module.css +8 -0
  112. package/src/dashboard/stat-strip.module.css +24 -39
  113. package/src/dashboard/stat-strip.module.css.d.ts +1 -0
  114. package/src/dashboard/stat-strip.tsx +63 -43
  115. package/src/dashboard/widget-header.module.css +6 -0
  116. package/src/dashboard/widget-header.tsx +28 -1
  117. package/src/guard/index.ts +3 -14
  118. package/src/table/data-table.tsx +1 -1
  119. package/src/theme/__snapshots__/plain-theme.test.ts.snap +6 -6
  120. package/src/theme/controls.module.css +7 -2
  121. package/src/theme/index.ts +7 -5
  122. package/src/tokens/palette.ts +2 -2
@@ -96,11 +96,11 @@
96
96
  min-width: 0;
97
97
  }
98
98
 
99
- /* A card too narrow to share its caption row (a two-column phone cell, ~170px): the qualifier is ALWAYS
100
- * on its own line under the caption, and a card with one (or a StatGroup row-mate's) reserves that line, so the values of one StatGroup
101
- * row share a baseline whether or not a sibling has a qualifier. The caption keeps the whole first
102
- * line (it truncates, with its `title`, only when it alone does not fit); the qualifier is one line
103
- * too (it truncates with its `title` only when it alone does not fit THAT line). */
99
+ /* A card too narrow to share its caption row (a two-column phone cell, ~170px): the qualifier takes its
100
+ * own line under the caption, where it wraps again rather than truncating (a qualifier can be the only place
101
+ * a band is stated). A card without one reserves the line when a StatGroup row-mate has one, so the values of
102
+ * one StatGroup row share a baseline. The caption keeps its line (it truncates, with
103
+ * its `title`, only when it alone does not fit). */
104
104
  @container basalt-card (max-width: 239.9px) {
105
105
  .captionMain:has(> .qualifier) {
106
106
  --basalt-stat-qualifier-reserve: 1;
@@ -113,6 +113,7 @@
113
113
  var(--vx-text-micro) * 1.4 * var(--basalt-stat-qualifier-reserve, 0)
114
114
  );
115
115
  align-content: flex-start;
116
+ justify-content: flex-start;
116
117
  min-height: calc(
117
118
  var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1) +
118
119
  var(--basalt-stat-qualifier-h)
@@ -123,12 +124,11 @@
123
124
  min-height: calc(var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1));
124
125
  }
125
126
 
127
+ /* Always its own line: siblings of one group never place it differently (beside, or under). */
126
128
  .qualifier {
127
- flex: 0 0 100%;
128
- overflow: hidden;
129
- text-overflow: ellipsis;
130
- white-space: nowrap;
129
+ flex-basis: 100%;
131
130
  line-height: 1.4;
131
+ text-wrap: balance;
132
132
  }
133
133
  }
134
134
 
@@ -252,8 +252,14 @@
252
252
  gap: var(--basalt-stat-foot-gap);
253
253
  margin-top: auto;
254
254
  min-width: 0;
255
+ /* The sparkline slot's readout reserve (`.sparklineBleed`): the readout line less the card gap above. */
256
+ --basalt-spark-readout-reserve: max(
257
+ 0px,
258
+ calc(var(--basalt-spark-readout-h) - var(--vx-space-stat-card-gap))
259
+ );
255
260
  min-height: calc(
256
- var(--basalt-stat-visual-h) + var(--basalt-stat-foot-gap) + var(--basalt-stat-footer-h)
261
+ var(--basalt-stat-visual-h) + var(--basalt-spark-readout-reserve) +
262
+ var(--basalt-stat-foot-gap) + var(--basalt-stat-footer-h)
257
263
  );
258
264
  }
259
265
 
@@ -382,6 +388,14 @@
382
388
  margin-inline: calc(-1 * var(--vx-space-card-inset-x, 1rem));
383
389
  }
384
390
 
391
+ /* A slotted chart's readout line (`--basalt-spark-readout-h`) above its plot: the card gap already sits
392
+ * above the slot, the slot reserves the rest, so the chip never covers the delta or qualifier row.
393
+ * `.foot` reserves the same, so a card with a sparkline and one without keep the same height. */
394
+ .sparklineBleed:has([data-basalt-sparkline], [data-basalt-chart]) {
395
+ box-sizing: content-box;
396
+ padding-top: var(--basalt-spark-readout-reserve);
397
+ }
398
+
385
399
  /* A Meter in the visual slot is a block, not a chart: it sizes to its content and keeps the card's
386
400
  * inline inset instead of the sparkline's fixed 22px and side bleed. */
387
401
  .sparklineBleed:has(> [data-basalt-meter]) {
@@ -63,6 +63,14 @@
63
63
  }
64
64
  }
65
65
 
66
+ /* An odd count never leaves one cell alone on a half-empty row: below 480px (two columns) the last
67
+ * odd cell spans the row, as the strip's does. */
68
+ @container basalt-grid (max-width: 479.9px) {
69
+ .root > *:last-child:nth-child(odd) {
70
+ grid-column: 1 / -1;
71
+ }
72
+ }
73
+
66
74
  @container basalt-grid (min-width: 800px) {
67
75
  .root {
68
76
  grid-template-columns: repeat(var(--basalt-stat-group-cols-sm), minmax(0, 1fr));
@@ -104,12 +104,14 @@
104
104
  min-height: calc(var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1));
105
105
  }
106
106
 
107
- /* Caption and qualifier share one line: the caption keeps its words, the qualifier gives way first. */
107
+ /* Caption and qualifier share one line while the qualifier fits; when it does not it wraps whole under the
108
+ * caption and wraps again rather than truncating (it can be the only place a band is stated). */
108
109
  .captionMain {
109
110
  display: flex;
110
111
  flex: 1 1 0;
111
- flex-wrap: nowrap;
112
+ flex-wrap: wrap;
112
113
  align-items: baseline;
114
+ align-content: flex-start;
113
115
  column-gap: var(--vx-space-control-gap);
114
116
  min-width: 0;
115
117
  }
@@ -140,28 +142,18 @@
140
142
 
141
143
  /* The lowercase qualifier is the muted sans (mono is for the UPPERCASE caption only). */
142
144
  .qualifier {
143
- flex: 0 100 auto;
145
+ flex: 0 1 auto;
144
146
  min-width: 0;
145
- overflow: hidden;
146
- text-overflow: ellipsis;
147
- white-space: nowrap;
147
+ overflow-wrap: anywhere;
148
+ text-wrap: balance;
148
149
  font-size: var(--vx-text-micro);
149
150
  line-height: 1.4;
150
151
  color: var(--vx-muted);
151
152
  }
152
153
 
153
- /* A narrow cell (~170px at 390): the qualifier takes its own line under the caption, and when any cell
154
- * of the strip has a qualifier every cell reserves that line, so values share a baseline. */
154
+ /* A narrow cell (~170px at 390): when any cell of the strip has a qualifier every cell reserves one line for
155
+ * it, whether it sat beside the caption or wrapped under it, so values share a baseline. */
155
156
  @container basalt-card (max-width: 239.9px) {
156
- .captionMain {
157
- flex-wrap: wrap;
158
- align-content: flex-start;
159
- }
160
-
161
- .qualifier {
162
- flex: 0 0 100%;
163
- }
164
-
165
157
  .qualifier {
166
158
  line-height: 1.25;
167
159
  }
@@ -238,7 +230,8 @@
238
230
  --basalt-spark-readout-h: 1.125rem;
239
231
  }
240
232
 
241
- .visual:has([data-basalt-sparkline]) {
233
+ /* A slotted chart's readout line above its plot: the cell reserves it so the chip never covers the value. */
234
+ .visual:has([data-basalt-sparkline], [data-basalt-chart]) {
242
235
  padding-top: max(0px, calc(var(--basalt-spark-readout-h) - var(--vx-space-stack-sm)));
243
236
  }
244
237
 
@@ -322,35 +315,18 @@
322
315
  }
323
316
 
324
317
  /* A meter's start and end captions read as one phrase (name, then value) however wide the track. */
325
- .footerCell [data-meter-captions] {
318
+ .footerCell [data-meter-captions],
319
+ .underCell [data-meter-captions] {
326
320
  justify-content: flex-start;
327
321
  column-gap: var(--vx-space-stack-md);
328
322
  }
329
323
 
330
- .footerCell [data-meter-captions] > * {
324
+ .footerCell [data-meter-captions] > *,
325
+ .underCell [data-meter-captions] > * {
331
326
  margin-inline-start: 0;
332
327
  text-align: start;
333
328
  }
334
329
 
335
- /* From the full desktop count a footer entry may sit under the cell it qualifies (`under`): the row
336
- * takes the cells' column grid, an entry with `--basalt-strip-footer-col` sits in that column, and any
337
- * other takes the full row. Each entry keeps its own leading hairlines (`.footerCell`, below), so a
338
- * placed entry reads as attached to its column and the columns beside it stay the strip's surface. */
339
- @container basalt-grid (min-width: 800px) {
340
- .footerRow[data-placed] {
341
- display: grid;
342
- grid-template-columns: repeat(var(--basalt-strip-cols), minmax(0, 1fr));
343
- }
344
-
345
- .footerRow[data-placed] > .footerCell {
346
- grid-column: 1 / -1;
347
- }
348
-
349
- .footerRow[data-placed] > .footerCell[data-under] {
350
- grid-column: var(--basalt-strip-footer-col);
351
- }
352
- }
353
-
354
330
  .footerCell {
355
331
  flex: 1 1 14rem;
356
332
  min-width: 0;
@@ -358,3 +334,12 @@
358
334
  border-inline-start: 1px solid var(--vx-divider);
359
335
  border-block-start: 1px solid var(--vx-divider);
360
336
  }
337
+
338
+ /* A footer entry `under` a cell is part of that cell: it sits in the slot under the article, inset like
339
+ * the article, split from the readings by the strip's own hairline. */
340
+ .underCell {
341
+ min-width: 0;
342
+ margin: var(--vx-space-stack-md) var(--vx-space-stack-md) 0;
343
+ padding-block-start: var(--vx-space-stack-sm);
344
+ border-block-start: 1px solid var(--vx-divider);
345
+ }
@@ -32,5 +32,6 @@ declare const classes: {
32
32
  readonly rowValue: string
33
33
  readonly footerRow: string
34
34
  readonly footerCell: string
35
+ readonly underCell: string
35
36
  }
36
37
  export default classes
@@ -9,7 +9,7 @@
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
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
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
  *
@@ -24,8 +24,10 @@
24
24
  *
25
25
  * Anchors: each cell is `data-shot="strip-<key>"` and each footer cell
26
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: from 800px it sits in the cell's column (an
28
- * entry without `under` then takes the full row); below, every entry is full width under the grid.
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.
29
31
  *
30
32
  * Absence: a page that hides the strip in a declared shot state sets `shotAbsent` on the group
31
33
  * (`['empty']`): every derived anchor, cells and footer cells, then carries `data-shot-absent`. A
@@ -120,8 +122,9 @@ export type StatStripCell = {
120
122
  export type StatStripFooterEntry = {
121
123
  key: string
122
124
  content: ReactNode
123
- /** The `key` of the cell this entry qualifies. From the full desktop width (800px) it sits in that
124
- * cell's column; below it, and for a key that names no cell, it takes the full width under the grid. */
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. */
125
128
  under?: string
126
129
  }
127
130
 
@@ -141,15 +144,20 @@ const EMPTY = '—'
141
144
 
142
145
  function CellState({ state }: { state: StatStripCellState }) {
143
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
+ }
144
155
  return (
145
- <>
146
- <div className={classes.valueRow}>
147
- <span className={classes.value} data-strip-value>
148
- {EMPTY}
149
- </span>
150
- </div>
151
- {state.reason !== undefined && <p className={classes.reason}>{state.reason}</p>}
152
- </>
156
+ <div className={classes.valueRow}>
157
+ <span className={classes.value} data-strip-value>
158
+ {EMPTY}
159
+ </span>
160
+ </div>
153
161
  )
154
162
  }
155
163
  const message = toErrorMessage(state.error, 'The request failed.')
@@ -167,12 +175,36 @@ function CellState({ state }: { state: StatStripCellState }) {
167
175
  )
168
176
  }
169
177
 
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
+ )
198
+ }
199
+
170
200
  function StripCell({
171
201
  cell,
172
202
  shotAbsent,
203
+ under,
173
204
  }: {
174
205
  cell: StatStripCell
175
206
  shotAbsent: readonly StatStripShotState[] | undefined
207
+ under: readonly StatStripFooterEntry[]
176
208
  }) {
177
209
  const captionId = useId()
178
210
  const { rows, loading } = cell
@@ -232,9 +264,7 @@ function StripCell({
232
264
  {cell.info !== undefined && <InfoGlyph text={cell.info} />}
233
265
  </span>
234
266
  {cell.qualifier !== undefined && (
235
- <span className={classes.qualifier} title={cell.qualifier}>
236
- {cell.qualifier}
237
- </span>
267
+ <span className={classes.qualifier}>{cell.qualifier}</span>
238
268
  )}
239
269
  </div>
240
270
  {cell.action !== undefined && (
@@ -274,6 +304,9 @@ function StripCell({
274
304
  ))}
275
305
  {state === undefined && footerEl}
276
306
  </article>
307
+ {under.map((entry) => (
308
+ <FooterCell key={entry.key} entry={entry} shotAbsent={shotAbsent} under />
309
+ ))}
277
310
  </div>
278
311
  )
279
312
  }
@@ -290,14 +323,11 @@ export function StatStrip({
290
323
  const desktop = cols ?? Math.min(Math.max(cells.length, 2), 6)
291
324
  // `StatGroup`'s rule: four is 2 + 2 below the full count, never 3 + 1.
292
325
  const mid = desktop === 4 ? 2 : Math.min(desktop, 3)
293
- // A cell's column at the full count; `undefined` for a key that names no cell.
294
- const columnOf = (key: string | undefined) => {
295
- const at = cells.findIndex((cell) => cell.key === key)
296
- return at < 0 ? undefined : (at % desktop) + 1
297
- }
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)) ?? []
298
329
  const hasQualifier = cells.some((cell) => cell.qualifier !== undefined)
299
330
  const hasAction = cells.some((cell) => cell.action !== undefined)
300
- const placed = footer?.some((entry) => columnOf(entry.under) !== undefined) ?? false
301
331
  return (
302
332
  <div className={cx(classes.container, className)} style={style}>
303
333
  <Card>
@@ -316,29 +346,19 @@ export function StatStrip({
316
346
  >
317
347
  <div className={classes.cells}>
318
348
  {cells.map((cell) => (
319
- <StripCell key={cell.key} cell={cell} shotAbsent={shotAbsent} />
349
+ <StripCell
350
+ key={cell.key}
351
+ cell={cell}
352
+ shotAbsent={shotAbsent}
353
+ under={underOf(cell.key)}
354
+ />
320
355
  ))}
321
356
  </div>
322
- {footer !== undefined && footer.length > 0 && (
323
- <div className={classes.footerRow} {...(placed && { 'data-placed': '' })}>
324
- {footer.map((entry) => {
325
- const column = columnOf(entry.under)
326
- return (
327
- <div
328
- key={entry.key}
329
- className={classes.footerCell}
330
- data-strip-footer-cell={entry.key}
331
- data-shot={`strip-footer-${entry.key}`}
332
- {...absentAttr(shotAbsent)}
333
- {...(column !== undefined && {
334
- 'data-under': entry.under,
335
- style: { '--basalt-strip-footer-col': column } as CSSProperties,
336
- })}
337
- >
338
- {entry.content}
339
- </div>
340
- )
341
- })}
357
+ {rest.length > 0 && (
358
+ <div className={classes.footerRow}>
359
+ {rest.map((entry) => (
360
+ <FooterCell key={entry.key} entry={entry} shotAbsent={shotAbsent} under={false} />
361
+ ))}
342
362
  </div>
343
363
  )}
344
364
  </Card.Section>
@@ -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,18 +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
- }
903
+ export const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>> = {}
915
904
 
916
905
  /** A kind's effective severity: consumer override first, then the grace table, then `error`. */
917
906
  export function severityOf(kind: GuardKind, cfg: GuardConfig): GuardSeverity {
@@ -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()}
@@ -902,7 +902,7 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
902
902
  indicator: {
903
903
  boxShadow: "var(--vx-shadow-raised)",
904
904
  outline: "1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)",
905
- borderRadius: "max(0px, calc(var(--sc-radius, var(--vx-radius-ctrl)) - 3px))"
905
+ borderRadius: "round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"
906
906
  },
907
907
  ...props.size === "ctl" ? {
908
908
  label: {
@@ -917,11 +917,11 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
917
917
  "outputs": [
918
918
  {
919
919
  "probes": 2020,
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":"max(0px, calc(var(--sc-radius, var(--vx-radius-ctrl)) - 3px))"}}",
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)"}}",
921
921
  },
922
922
  {
923
923
  "probes": 288,
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":"max(0px, calc(var(--sc-radius, var(--vx-radius-ctrl)) - 3px))"},"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)"}}",
925
925
  },
926
926
  ],
927
927
  },
@@ -2235,7 +2235,7 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
2235
2235
  indicator: {
2236
2236
  boxShadow: "var(--vx-shadow-raised)",
2237
2237
  outline: "1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)",
2238
- borderRadius: "max(0px, calc(var(--sc-radius, var(--vx-radius-ctrl)) - 3px))"
2238
+ borderRadius: "round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"
2239
2239
  },
2240
2240
  ...props.size === "ctl" ? {
2241
2241
  label: {
@@ -2250,11 +2250,11 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
2250
2250
  "outputs": [
2251
2251
  {
2252
2252
  "probes": 2020,
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":"max(0px, calc(var(--sc-radius, var(--vx-radius-ctrl)) - 3px))"}}",
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)"}}",
2254
2254
  },
2255
2255
  {
2256
2256
  "probes": 288,
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":"max(0px, calc(var(--sc-radius, var(--vx-radius-ctrl)) - 3px))"},"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)"}}",
2258
2258
  },
2259
2259
  ],
2260
2260
  },
@@ -368,8 +368,13 @@ html .badgeRoot {
368
368
 
369
369
  /*
370
370
  * Alert: an inline Code inside it sits one nested step (3px) under the Alert's own radius
371
- * (craft-1/nested-radius-step). The Code theme reads `--basalt-code-radius`; the Alert supplies it.
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.
372
373
  */
373
374
  .alertRoot {
374
- --basalt-code-radius: max(0px, calc(var(--alert-radius, var(--vx-radius-ctrl)) - 3px));
375
+ --basalt-code-radius: round(
376
+ down,
377
+ min(2px, max(0px, var(--alert-radius, var(--vx-radius-ctrl)) - 3px)),
378
+ 2px
379
+ );
375
380
  }
@@ -778,9 +778,10 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
778
778
  // The track's padding is `SPACE_FIXED.segmentedTrackInset`, a plain literal — NOT a
779
779
  // `--vx-space-*` var — because it is density-EXEMPT (see that constant's doc in
780
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: exact concentricity would
782
- // be track − inset (2 px), but `craft-1/nested-radius-step` wants nested surfaces ≥ 3 px apart
783
- // and that lint step wins. A custom `radius` therefore nests too.
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.
784
785
  SegmentedControl: ext<typeof SegmentedControl>({
785
786
  defaultProps: { radius: radius.ctrl },
786
787
  classNames: {
@@ -819,8 +820,9 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
819
820
  // ink-12% fill sat one shade from the track and read as a hover state.
820
821
  boxShadow: 'var(--vx-shadow-raised)',
821
822
  outline: '1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)',
822
- // Track radius − 3 px: craft-1/nested-radius-step beats exact concentricity.
823
- borderRadius: 'max(0px, calc(var(--sc-radius, var(--vx-radius-ctrl)) - 3px))',
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)',
824
826
  },
825
827
  // Conditionally spread the WHOLE key (never a present `label: undefined`) — the package
826
828
  // builds under `exactOptionalPropertyTypes`, which treats a key present-but-`undefined` as
@@ -241,8 +241,8 @@ export const RADIUS_STEP = {
241
241
  /** SegmentedControl's active indicator, Kbd, Code — one step below the control radius. */
242
242
  tight: DEFAULT_RADIUS_VALUES.tight, // 5
243
243
  /** Progress bar, and the Mantine scale's `sm` step — two steps below the control radius. (No
244
- * longer the SegmentedControl indicator: that is the track radius − 3 px, the nested-radius lint
245
- * step, set in `theme/index.ts`.) */
244
+ * longer the SegmentedControl indicator: that is the track radius − 3 px snapped down onto the
245
+ * scale, set in `theme/index.ts`.) */
246
246
  fine: DEFAULT_RADIUS_VALUES.fine, // 4
247
247
  /** The Mantine `radius` scale's `xs` step — independent of both anchors. */
248
248
  scaleXs: 2,