basalt-ui 2.28.0 → 2.29.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 (229) hide show
  1. package/CHANGELOG.md +461 -401
  2. package/MIGRATING.md +202 -12
  3. package/agent/skills/basalt-app/SKILL.md +3 -3
  4. package/agent/skills/basalt-charts/SKILL.md +1 -1
  5. package/agent/skills/basalt-design/SKILL.md +11 -5
  6. package/agent/skills/basalt-design/references/catalogue.md +3 -1
  7. package/agent/skills/basalt-design/references/recipes.md +1 -1
  8. package/agent/skills/basalt-design/references/states.md +1 -1
  9. package/configs/oxlint-plugin.js +2 -1
  10. package/configs/oxlint.json +1 -0
  11. package/dist/charts/ChartCard.d.ts +9 -5
  12. package/dist/charts/ChartCard.d.ts.map +1 -1
  13. package/dist/charts/ChartCard.js +68 -12
  14. package/dist/charts/Sparkline.d.ts +5 -0
  15. package/dist/charts/Sparkline.d.ts.map +1 -1
  16. package/dist/charts/Sparkline.js +53 -5
  17. package/dist/charts/chart-box.module.css +9 -2
  18. package/dist/charts/chart-card.module.css +16 -13
  19. package/dist/charts/chart-card.module.css.d.ts +2 -0
  20. package/dist/charts/compile.d.ts +1 -1
  21. package/dist/charts/compile.d.ts.map +1 -1
  22. package/dist/charts/compile.js +18 -9
  23. package/dist/charts/ref-label.d.ts +6 -0
  24. package/dist/charts/ref-label.d.ts.map +1 -1
  25. package/dist/charts/ref-label.js +19 -5
  26. package/dist/charts/sparkline.module.css +44 -0
  27. package/dist/charts/sparkline.module.css.d.ts +3 -0
  28. package/dist/charts/state.d.ts +1 -1
  29. package/dist/charts/state.d.ts.map +1 -1
  30. package/dist/charts/state.js +3 -3
  31. package/dist/cli/doctor-upgrade.d.ts +11 -0
  32. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  33. package/dist/cli/doctor-upgrade.js +54 -0
  34. package/dist/cli/doctor.d.ts.map +1 -1
  35. package/dist/cli/doctor.js +32 -0
  36. package/dist/cli/help.d.ts.map +1 -1
  37. package/dist/cli/help.js +8 -3
  38. package/dist/cli/index.d.ts +13 -13
  39. package/dist/cli/index.d.ts.map +1 -1
  40. package/dist/cli/index.js +36 -2
  41. package/dist/cli/init.d.ts +6 -0
  42. package/dist/cli/init.d.ts.map +1 -1
  43. package/dist/cli/init.js +118 -27
  44. package/dist/cli/router-wiring.d.ts +3 -0
  45. package/dist/cli/router-wiring.d.ts.map +1 -1
  46. package/dist/cli/router-wiring.js +2 -0
  47. package/dist/cli/shot/capture.d.ts +28 -1
  48. package/dist/cli/shot/capture.d.ts.map +1 -1
  49. package/dist/cli/shot/capture.js +77 -7
  50. package/dist/cli/shot/detect.d.ts +4 -1
  51. package/dist/cli/shot/detect.d.ts.map +1 -1
  52. package/dist/cli/shot/detect.js +38 -16
  53. package/dist/cli/shot/index.d.ts.map +1 -1
  54. package/dist/cli/shot/index.js +9 -2
  55. package/dist/cli/shot/measure.d.ts.map +1 -1
  56. package/dist/cli/shot/measure.js +11 -2
  57. package/dist/cli/shot/types.d.ts +4 -1
  58. package/dist/cli/shot/types.d.ts.map +1 -1
  59. package/dist/cli/sync.d.ts.map +1 -1
  60. package/dist/cli/sync.js +10 -2
  61. package/dist/common/could-not-load.d.ts +13 -0
  62. package/dist/common/could-not-load.d.ts.map +1 -0
  63. package/dist/common/could-not-load.js +14 -0
  64. package/dist/common/index.d.ts +1 -0
  65. package/dist/common/index.d.ts.map +1 -1
  66. package/dist/common/index.js +3 -0
  67. package/dist/common/props.d.ts +20 -0
  68. package/dist/common/props.d.ts.map +1 -1
  69. package/dist/common/props.js +13 -1
  70. package/dist/common/retry-button.module.css +7 -3
  71. package/dist/dashboard/bar-list.d.ts +4 -4
  72. package/dist/dashboard/bar-list.d.ts.map +1 -1
  73. package/dist/dashboard/bar-list.js +10 -7
  74. package/dist/dashboard/bar-list.module.css +21 -3
  75. package/dist/dashboard/board.d.ts +2 -2
  76. package/dist/dashboard/board.d.ts.map +1 -1
  77. package/dist/dashboard/board.js +31 -12
  78. package/dist/dashboard/board.module.css +19 -0
  79. package/dist/dashboard/board.module.css.d.ts +2 -0
  80. package/dist/dashboard/empty-state.d.ts +3 -3
  81. package/dist/dashboard/empty-state.d.ts.map +1 -1
  82. package/dist/dashboard/empty-state.js +4 -2
  83. package/dist/dashboard/event-list-model.d.ts +3 -0
  84. package/dist/dashboard/event-list-model.d.ts.map +1 -1
  85. package/dist/dashboard/event-list-model.js +5 -1
  86. package/dist/dashboard/event-list-rows.d.ts.map +1 -1
  87. package/dist/dashboard/event-list-rows.js +2 -6
  88. package/dist/dashboard/event-list-scroll.d.ts +32 -4
  89. package/dist/dashboard/event-list-scroll.d.ts.map +1 -1
  90. package/dist/dashboard/event-list-scroll.js +117 -4
  91. package/dist/dashboard/event-list-skeleton.d.ts.map +1 -1
  92. package/dist/dashboard/event-list-skeleton.js +2 -4
  93. package/dist/dashboard/event-list.d.ts +4 -4
  94. package/dist/dashboard/event-list.d.ts.map +1 -1
  95. package/dist/dashboard/event-list.js +53 -23
  96. package/dist/dashboard/event-list.module.css +90 -37
  97. package/dist/dashboard/event-list.module.css.d.ts +1 -0
  98. package/dist/dashboard/meter-model.d.ts +6 -3
  99. package/dist/dashboard/meter-model.d.ts.map +1 -1
  100. package/dist/dashboard/meter-model.js +9 -4
  101. package/dist/dashboard/meter-parts.d.ts +3 -0
  102. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  103. package/dist/dashboard/meter-parts.js +32 -4
  104. package/dist/dashboard/meter.d.ts +3 -3
  105. package/dist/dashboard/meter.d.ts.map +1 -1
  106. package/dist/dashboard/meter.js +10 -2
  107. package/dist/dashboard/meter.module.css +18 -11
  108. package/dist/dashboard/meter.module.css.d.ts +0 -1
  109. package/dist/dashboard/page-summary.d.ts +3 -3
  110. package/dist/dashboard/page-summary.d.ts.map +1 -1
  111. package/dist/dashboard/page-summary.js +7 -2
  112. package/dist/dashboard/page-summary.module.css +5 -2
  113. package/dist/dashboard/query-state.d.ts +9 -8
  114. package/dist/dashboard/query-state.d.ts.map +1 -1
  115. package/dist/dashboard/query-state.js +28 -10
  116. package/dist/dashboard/section.d.ts +11 -3
  117. package/dist/dashboard/section.d.ts.map +1 -1
  118. package/dist/dashboard/section.js +34 -7
  119. package/dist/dashboard/settings-section.d.ts +4 -4
  120. package/dist/dashboard/settings-section.d.ts.map +1 -1
  121. package/dist/dashboard/settings-section.js +11 -7
  122. package/dist/dashboard/settings-section.module.css +6 -0
  123. package/dist/dashboard/settings-section.module.css.d.ts +1 -0
  124. package/dist/dashboard/stat-card.d.ts +3 -3
  125. package/dist/dashboard/stat-card.d.ts.map +1 -1
  126. package/dist/dashboard/stat-card.js +24 -8
  127. package/dist/dashboard/stat-card.module.css +11 -0
  128. package/dist/dashboard/stat-group.d.ts +2 -2
  129. package/dist/dashboard/stat-group.d.ts.map +1 -1
  130. package/dist/dashboard/stat-group.js +10 -3
  131. package/dist/dashboard/stat-strip.d.ts +5 -4
  132. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  133. package/dist/dashboard/stat-strip.js +41 -31
  134. package/dist/dashboard/stat-strip.module.css +4 -5
  135. package/dist/dashboard/visual-slot.d.ts +4 -0
  136. package/dist/dashboard/visual-slot.d.ts.map +1 -1
  137. package/dist/dashboard/visual-slot.js +2 -0
  138. package/dist/dashboard/widget-header.d.ts +6 -6
  139. package/dist/dashboard/widget-header.d.ts.map +1 -1
  140. package/dist/dashboard/widget-header.js +4 -2
  141. package/dist/dashboard/widget-header.module.css +6 -25
  142. package/dist/format/shared.d.ts.map +1 -1
  143. package/dist/format/shared.js +24 -1
  144. package/dist/guard/index.d.ts +1 -1
  145. package/dist/guard/index.d.ts.map +1 -1
  146. package/dist/guard/index.js +2 -1
  147. package/dist/styles.css +23 -0
  148. package/dist/table/cell-kinds.d.ts +10 -7
  149. package/dist/table/cell-kinds.d.ts.map +1 -1
  150. package/dist/table/cell-kinds.js +18 -7
  151. package/dist/table/data-table-fold.d.ts +13 -5
  152. package/dist/table/data-table-fold.d.ts.map +1 -1
  153. package/dist/table/data-table-fold.js +48 -16
  154. package/dist/table/data-table.d.ts +2 -2
  155. package/dist/table/data-table.d.ts.map +1 -1
  156. package/dist/table/data-table.js +16 -9
  157. package/dist/table/data-table.module.css +74 -2
  158. package/dist/table/data-table.module.css.d.ts +4 -0
  159. package/dist/theme/controls.module.css +23 -2
  160. package/llms.txt +263 -2
  161. package/package.json +1 -1
  162. package/src/charts/ChartCard.tsx +98 -16
  163. package/src/charts/Sparkline.tsx +84 -5
  164. package/src/charts/chart-box.module.css +9 -2
  165. package/src/charts/chart-card.module.css +16 -13
  166. package/src/charts/chart-card.module.css.d.ts +2 -0
  167. package/src/charts/compile.ts +37 -15
  168. package/src/charts/ref-label.ts +36 -9
  169. package/src/charts/sparkline.module.css +44 -0
  170. package/src/charts/sparkline.module.css.d.ts +3 -0
  171. package/src/charts/state.tsx +4 -3
  172. package/src/cli/doctor-upgrade.ts +75 -0
  173. package/src/cli/doctor.ts +36 -0
  174. package/src/cli/help.ts +16 -6
  175. package/src/cli/index.ts +73 -67
  176. package/src/cli/init.ts +157 -36
  177. package/src/cli/router-wiring.ts +2 -2
  178. package/src/cli/shot/capture.ts +109 -10
  179. package/src/cli/shot/detect.ts +46 -22
  180. package/src/cli/shot/index.ts +8 -2
  181. package/src/cli/shot/measure.ts +11 -2
  182. package/src/cli/shot/types.ts +4 -1
  183. package/src/cli/sync.ts +12 -2
  184. package/src/common/could-not-load.ts +22 -0
  185. package/src/common/index.ts +1 -0
  186. package/src/common/props.ts +30 -0
  187. package/src/common/retry-button.module.css +7 -3
  188. package/src/dashboard/bar-list.module.css +21 -3
  189. package/src/dashboard/bar-list.tsx +46 -41
  190. package/src/dashboard/board.module.css +19 -0
  191. package/src/dashboard/board.module.css.d.ts +2 -0
  192. package/src/dashboard/board.tsx +69 -48
  193. package/src/dashboard/empty-state.tsx +5 -2
  194. package/src/dashboard/event-list-model.ts +13 -1
  195. package/src/dashboard/event-list-rows.tsx +3 -6
  196. package/src/dashboard/event-list-scroll.ts +154 -8
  197. package/src/dashboard/event-list-skeleton.tsx +5 -1
  198. package/src/dashboard/event-list.module.css +90 -37
  199. package/src/dashboard/event-list.module.css.d.ts +1 -0
  200. package/src/dashboard/event-list.tsx +92 -65
  201. package/src/dashboard/meter-model.ts +16 -7
  202. package/src/dashboard/meter-parts.tsx +45 -13
  203. package/src/dashboard/meter.module.css +18 -11
  204. package/src/dashboard/meter.module.css.d.ts +0 -1
  205. package/src/dashboard/meter.tsx +36 -18
  206. package/src/dashboard/page-summary.module.css +5 -2
  207. package/src/dashboard/page-summary.tsx +13 -6
  208. package/src/dashboard/query-state.tsx +54 -29
  209. package/src/dashboard/section.tsx +83 -41
  210. package/src/dashboard/settings-section.module.css +6 -0
  211. package/src/dashboard/settings-section.module.css.d.ts +1 -0
  212. package/src/dashboard/settings-section.tsx +11 -6
  213. package/src/dashboard/stat-card.module.css +11 -0
  214. package/src/dashboard/stat-card.tsx +31 -8
  215. package/src/dashboard/stat-group.tsx +22 -14
  216. package/src/dashboard/stat-strip.module.css +4 -5
  217. package/src/dashboard/stat-strip.tsx +29 -20
  218. package/src/dashboard/visual-slot.ts +5 -0
  219. package/src/dashboard/widget-header.module.css +6 -25
  220. package/src/dashboard/widget-header.tsx +8 -5
  221. package/src/format/shared.ts +30 -1
  222. package/src/guard/index.ts +5 -1
  223. package/src/styles.css +23 -0
  224. package/src/table/cell-kinds.tsx +42 -13
  225. package/src/table/data-table-fold.tsx +65 -12
  226. package/src/table/data-table.module.css +74 -2
  227. package/src/table/data-table.module.css.d.ts +4 -0
  228. package/src/table/data-table.tsx +34 -13
  229. package/src/theme/controls.module.css +23 -2
@@ -10,9 +10,8 @@
10
10
  * `--mantine-spacing-*` fallbacks.
11
11
  *
12
12
  * Layout keys on the enclosing card's OWN width (`container: basalt-card`, declared by ChartCard /
13
- * StatCard / Section — docs/DESIGN-CORE.md § Layout, elevation, shapes), never the viewport: below 480px the subtitle folds
14
- * into the info glyph (a ChartCard keeps it, wrapped to two lines — wave 43); from 480px (wave 8) `value` + `delta` move onto the title row. Wrapping and
15
- * shrinking are unconditional. The subtitle ALSO folds (regardless of width) whenever the card's own
13
+ * StatCard / Section — docs/DESIGN-CORE.md § Layout, elevation, shapes), never the viewport: the subtitle stays visible text at every width (it wraps under the title); from 480px (wave 8) `value` + `delta` move onto the title row. Wrapping and
14
+ * shrinking are unconditional. The subtitle folds into the info glyph (regardless of width) only when the card's own
16
15
  * height is under 280px — see the `[data-basalt-card-short]` block below (wave 8's header-economy
17
16
  * law). No enclosing card, no container: the standard layout. Container conditions are px literals
18
17
  * of CONTAINER_CLASSES.
@@ -234,6 +233,7 @@
234
233
  * section with both read as a two-line heading rather than a heading plus a note. */
235
234
  .subtitle {
236
235
  margin-top: 4px;
236
+ overflow-wrap: anywhere;
237
237
  font-size: var(--vx-text-sm);
238
238
  font-weight: 400;
239
239
  color: var(--vx-muted);
@@ -380,24 +380,10 @@
380
380
  color: var(--vx-muted);
381
381
  }
382
382
 
383
- /* Card narrower than 480px: the subtitle folds into the info glyph (`InfoGlyph`'s `note`, or
384
- * `.foldGlyph` when there is no `info`) — exactly one of the two shows. */
383
+ /* Card narrower than 480px: the subtitle stays visible text under the title and wraps (a touch
384
+ * surface has no hover to open a fold glyph). A chart card also clamps it to two lines, then an
385
+ * ellipsis; the full text stays in the DOM. Only the short-height fold below still moves it. */
385
386
  @container basalt-card (max-width: 479.9px) {
386
- .subtitle {
387
- display: none;
388
- }
389
-
390
- .foldGlyph {
391
- display: inline-flex;
392
- }
393
-
394
- .foldNote {
395
- display: block;
396
- }
397
-
398
- /* A chart card keeps its subtitle (argo's line/dot key) on its own line at every width: up to two
399
- * lines, then an ellipsis; the full text stays in the DOM. StatCard and Section still fold. The
400
- * short-height block below out-ranks this (its selector is one class heavier). */
401
387
  [data-basalt-chart-header] .subtitle {
402
388
  display: -webkit-box;
403
389
  -webkit-box-orient: vertical;
@@ -405,11 +391,6 @@
405
391
  line-clamp: 2;
406
392
  overflow: hidden;
407
393
  }
408
-
409
- [data-basalt-chart-header] .foldGlyph,
410
- [data-basalt-chart-header] .foldNote {
411
- display: none;
412
- }
413
394
  }
414
395
 
415
396
  /*
@@ -32,8 +32,8 @@
32
32
  import { useEffect, useId, useRef, useState } from 'react'
33
33
  import type { ReactNode, RefObject } from 'react'
34
34
  import { useIsomorphicLayoutEffect } from '../common/isomorphic-layout-effect'
35
- import { cx } from '../common/props'
36
- import type { BasaltProps, SlotStylesProps } from '../common/props'
35
+ import { cx, pickDataAttributes } from '../common/props'
36
+ import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props'
37
37
  import { IconSlot } from '../theme/icon-slot'
38
38
  import { DeltaBadge } from './delta-badge'
39
39
  import type { DeltaPolarity } from './delta-badge'
@@ -54,6 +54,7 @@ export type WidgetHeaderTier = 'section' | 'widget' | 'group'
54
54
  export type WidgetHeaderSlot = 'root' | 'title' | 'metric' | 'icon'
55
55
 
56
56
  export type WidgetHeaderProps = BasaltProps &
57
+ DataAttributes &
57
58
  SlotStylesProps<WidgetHeaderSlot> & {
58
59
  /** `section` renders an `<h2>` at the section-header height; `widget` renders an `<h3>` at the
59
60
  * tighter icon-tier height, display-only; `group` also renders an `<h3>` but as the quietest
@@ -65,9 +66,9 @@ export type WidgetHeaderProps = BasaltProps &
65
66
  title: string
66
67
  /** Optional leading icon, rendered before the title. Decorative — hidden from assistive tech. */
67
68
  icon?: ReactNode
68
- /** Optional muted line rendered below the title row. In a card narrower than 480px, or shorter
69
- * than 280px regardless of width, it folds into the info glyph's bubble instead (CSS only —
70
- * exactly one of the two shows). */
69
+ /** Optional muted line rendered below the title row. Visible text at every width (it wraps
70
+ * under the title); in a card shorter than 280px it folds into the info glyph's bubble instead
71
+ * (CSS only — exactly one of the two shows). */
71
72
  subtitle?: string
72
73
  /**
73
74
  * Renders an info glyph BESIDE the heading (never inside it — this text would otherwise become
@@ -406,11 +407,13 @@ export function WidgetHeader({
406
407
  className,
407
408
  style,
408
409
  classNames,
410
+ ...rest
409
411
  }: WidgetHeaderProps) {
410
412
  const Heading = tier === 'section' ? 'h2' : 'h3'
411
413
 
412
414
  return (
413
415
  <div
416
+ {...pickDataAttributes(rest)}
414
417
  className={cx(classes.root, classNames?.root, className)}
415
418
  data-tier={tier}
416
419
  {...(style !== undefined && { style })}
@@ -118,7 +118,36 @@ export function dateFormat(
118
118
  options.timeZone === undefined && defaults.timeZone !== undefined
119
119
  ? { ...options, timeZone: defaults.timeZone }
120
120
  : options
121
- return memoize(dateCaches, resolved, withZone, () => new Intl.DateTimeFormat(resolved, withZone))
121
+ return memoize(dateCaches, resolved, withZone, () =>
122
+ shortSeptember(new Intl.DateTimeFormat(resolved, withZone)),
123
+ )
124
+ }
125
+
126
+ const toShortSeptember = (text: string): string => text.replace(/\bSept\b/g, 'Sep')
127
+
128
+ /**
129
+ * ICU 72+ writes September as `Sept` in en-GB (and kin) but `Sep` in en-US. One short month form
130
+ * across every basalt date text: an English formatter prints `Sep`, whichever region tag it got.
131
+ * Other languages keep their own abbreviation (`Sept.` in German is correct).
132
+ */
133
+ function shortSeptember(formatter: Intl.DateTimeFormat): Intl.DateTimeFormat {
134
+ if (!formatter.resolvedOptions().locale.startsWith('en')) return formatter
135
+ const nativeFormat = formatter.format
136
+ const nativeParts = formatter.formatToParts.bind(formatter)
137
+ const format = (date?: Date | number): string => toShortSeptember(nativeFormat(date))
138
+ const formatToParts = (date?: Date | number): Intl.DateTimeFormatPart[] =>
139
+ nativeParts(date).map((part) =>
140
+ part.type === 'month' ? { ...part, value: toShortSeptember(part.value) } : part,
141
+ )
142
+ const nativeRange = formatter.formatRange.bind(formatter)
143
+ const formatRange = (start: Date | number, end: Date | number): string =>
144
+ toShortSeptember(nativeRange(start, end))
145
+ Object.defineProperties(formatter, {
146
+ format: { value: format },
147
+ formatRange: { value: formatRange },
148
+ formatToParts: { value: formatToParts },
149
+ })
150
+ return formatter
122
151
  }
123
152
 
124
153
  /** What every number/measure formatter accepts. */
@@ -828,6 +828,10 @@ const SUB_16_FONT_SIZE = /font-?[Ss]ize\s*:\s*['"]?(-?\d+(?:\.\d+)?)(?:px)?['"]?
828
828
  const DEFAULT_SPACING_STEPS: readonly number[] = Object.values(SPACE_SCALE_LEVEL0).toSorted(
829
829
  (a, b) => a - b,
830
830
  )
831
+ const SPACING_TOKEN_LIST = Object.entries(SPACE_SCALE_LEVEL0)
832
+ .map(([name, px]) => `${px} → "${name}"`)
833
+ .join(', ')
834
+
831
835
  /** Default off-identity Mantine accent families. */
832
836
  const DEFAULT_FORBIDDEN_ACCENTS: readonly string[] = ['teal', 'violet', 'grape', 'indigo', 'pink']
833
837
 
@@ -2039,7 +2043,7 @@ export const GUARD_RULES = {
2039
2043
  // JSX-prop-shaped (`p={16}`) — CSS has no `=`/`{}` prop syntax; gated off explicitly (see
2040
2044
  // off-identity-accent above for why "never matches today" still gets an explicit gate).
2041
2045
  appliesTo: (relPath) => !relPath.endsWith('.css'),
2042
- message: 'Use the Mantine spacing prop/token (p/m/gap with xs..xl).',
2046
+ message: `Use the Mantine spacing token, not the number (p/m/gap): ${SPACING_TOKEN_LIST}. A number that equals a step IS that token.`,
2043
2047
  },
2044
2048
  'raw-radius': {
2045
2049
  kind: 'raw-radius',
package/src/styles.css CHANGED
@@ -153,6 +153,29 @@
153
153
  font-size: max(var(--basalt-input-fz-floor, 16px), var(--input-fz, 1rem)) !important;
154
154
  }
155
155
 
156
+ /* Browser autofill paints its own yellow/blue over a field, and a focused Select keeps it. The UA
157
+ background cannot be overridden directly, so the field surface is painted over it with an inset
158
+ shadow and the long transition holds the UA colour off; text and caret keep the ink. A themed
159
+ `.input` sets its own `box-shadow` UNLAYERED, which outranks this layer: `controls.module.css`
160
+ re-points `--field-depth` under `:-webkit-autofill` for those. */
161
+ input:-webkit-autofill,
162
+ input:-webkit-autofill:hover,
163
+ input:-webkit-autofill:focus {
164
+ -webkit-text-fill-color: var(--vx-ink);
165
+ caret-color: var(--vx-ink);
166
+ box-shadow: 0 0 0 100vmax var(--vx-surface-field) inset;
167
+ transition: background-color 600000s 0s;
168
+ }
169
+
170
+ /* A Slider's bar and thumb fill in ink, not the accent, unless it encodes a status: an explicit
171
+ `color=` writes `--slider-color` inline, which outranks this. Mantine's own default sits in
172
+ `@layer mantine`, so this layer wins. In the dark scheme the thumb is filled with the same var,
173
+ a light disc with its white border; the drag-value label does not read it. */
174
+ .mantine-Slider-root,
175
+ .mantine-RangeSlider-root {
176
+ --slider-color: var(--vx-ink);
177
+ }
178
+
156
179
  /* `data-numeric` — one typographic law, every element. A number read as a MEASUREMENT (a preset
157
180
  like `7d`/`30d`, a KPI value, a table cell, a count tag) is mono with tabular figures, so
158
181
  digits line up column-wise and a changing value does not reflow its neighbours. Declared here,
@@ -5,7 +5,7 @@
5
5
  * {@link kindClass} / {@link kindAlign} (chrome) and {@link KindCell} (content).
6
6
  */
7
7
  import { Badge, Skeleton, Tooltip } from '@mantine/core'
8
- import type { Cell, Column, RowData } from '@tanstack/react-table'
8
+ import type { Cell, Column, Row, RowData } from '@tanstack/react-table'
9
9
  import { FlexRender } from '@tanstack/react-table'
10
10
  import type { ReactNode } from 'react'
11
11
  import { cx } from '../common/props'
@@ -47,27 +47,55 @@ export function kindAlign(kind: DataTableColumnKind | undefined): DataTableAlign
47
47
  return kind === 'number' || kind === 'money' ? 'right' : undefined
48
48
  }
49
49
 
50
+ /** A `text` column whose longest cell is this many characters or fewer has nothing to wrap. */
51
+ const SHORT_TEXT = 32
52
+
53
+ /** Whether every cell of the column renders a short string (needs at least one row to say so). */
54
+ function isShortText<T extends RowData>(
55
+ id: string,
56
+ rows: readonly Row<BasaltTableFeatures, T>[],
57
+ ): boolean {
58
+ return (
59
+ rows.length > 0 &&
60
+ rows.every((row) => {
61
+ const value: unknown = row.getValue(id)
62
+ return typeof value === 'string' && value.length <= SHORT_TEXT
63
+ })
64
+ )
65
+ }
66
+
50
67
  /**
51
68
  * Column sizing law (SPEC § 6.6): a data column is as wide as its header or widest cell (body cells
52
- * hold one line), and the slack of a wide container goes to ONE place — the LAST `text` column (a
53
- * notes/detail column that may wrap), else a trailing spacer after the last data column — so a name
54
- * sits beside its figures, never a third of the table away. An `entity` column is content-sized.
69
+ * hold one line), and the slack of a wide container goes to ONE place, so a value sits beside its name:
70
+ * the LAST data column when it is a `text`, `entity` or kindless one (the row's tail reads on after the
71
+ * columns before it); else the LAST `text` column (a notes/detail column that may wrap, ahead of figures);
72
+ * (one whose cells are not all short); else a trailing spacer after the last data column — never an `entity` with columns after it, which
73
+ * would put a short name hundreds of pixels from its next value.
55
74
  * `fixedIds` (the checkbox and actions columns) fit too but are not data. An earlier `text` column
56
- * keeps its auto share (it may wrap), and a table where no column opted into a kind renders as
57
- * before: no fit marks, no spacer.
75
+ * keeps its auto share (it may wrap) unless every cell it holds is short ({@link SHORT_TEXT} characters:
76
+ * nothing to wrap, so it takes no slack either; `rows` says what it holds), and a table where no column
77
+ * opted into a kind renders as before: no fit marks, no spacer.
58
78
  */
59
79
  export function planColumnSizing<T extends RowData>(
60
80
  columns: readonly Column<BasaltTableFeatures, T, unknown>[],
61
81
  fixedIds: ReadonlySet<string>,
82
+ rows: readonly Row<BasaltTableFeatures, T>[],
62
83
  ): { fitIds: ReadonlySet<string>; spacer: boolean } {
63
84
  const data = columns.filter((column) => !fixedIds.has(column.id))
64
85
  const kinds = new Map(data.map((column) => [column.id, resolveKind(column)]))
65
86
  const fitIds = new Set(columns.filter((column) => fixedIds.has(column.id)).map((c) => c.id))
66
87
  const hasKinds = data.some((column) => kinds.get(column.id) !== undefined)
67
88
  if (!hasKinds) return { fitIds, spacer: false }
68
- const slackId = data.findLast((column) => kinds.get(column.id) === 'text')?.id
89
+ const tail = data.at(-1)
90
+ const tailKind = tail === undefined ? undefined : kinds.get(tail.id)
91
+ const slackId =
92
+ tail !== undefined && (tailKind === undefined || tailKind === 'text' || tailKind === 'entity')
93
+ ? tail.id
94
+ : data.findLast((column) => kinds.get(column.id) === 'text' && !isShortText(column.id, rows))
95
+ ?.id
69
96
  for (const column of data) {
70
- if (column.id === slackId || kinds.get(column.id) === 'text') continue
97
+ if (column.id === slackId) continue
98
+ if (kinds.get(column.id) === 'text' && !isShortText(column.id, rows)) continue
71
99
  fitIds.add(column.id)
72
100
  }
73
101
  return { fitIds, spacer: slackId === undefined }
@@ -75,7 +103,7 @@ export function planColumnSizing<T extends RowData>(
75
103
 
76
104
  /**
77
105
  * A bar's width by kind. A share (`100%`) of a content-sized cell is that cell's own width, so the
78
- * fit columns take it; the slack column has no width of its own and takes a fixed length.
106
+ * fit columns take it; the slack column (a text, else the last entity) has no width of its own and takes a fixed length.
79
107
  */
80
108
  const SKELETON_WIDTH: Record<DataTableColumnKind | 'kindless', string> = {
81
109
  number: '3rem',
@@ -83,8 +111,8 @@ const SKELETON_WIDTH: Record<DataTableColumnKind | 'kindless', string> = {
83
111
  status: '4.5rem',
84
112
  'relative-time': '4.5rem',
85
113
  meter: '4rem',
86
- entity: '100%',
87
- text: '10rem',
114
+ entity: 'min(100%, 10rem)',
115
+ text: 'min(100%, 10rem)',
88
116
  kindless: '100%',
89
117
  }
90
118
 
@@ -172,8 +200,9 @@ function RelativeTime({ value }: { value: unknown }) {
172
200
  if (date === undefined) return <Dash />
173
201
  const full = dateTime(date)
174
202
  return (
175
- // Below the cell and on keyboard focus: above it the tip covered the header's label on row one.
176
- <Tooltip label={full} position="bottom" events={{ hover: true, focus: true, touch: false }}>
203
+ // Beside the cell, on hover and keyboard focus: below it the tip covered the next row's time, above it
204
+ // the header's label on row one.
205
+ <Tooltip label={full} position="right" events={{ hover: true, focus: true, touch: false }}>
177
206
  {/* oxlint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- the tooltip opens on focus */}
178
207
  <time dateTime={date.toISOString()} tabIndex={0}>
179
208
  {relativeTime(date)}
@@ -4,7 +4,7 @@
4
4
  * overflows, and the toggle, disclosure and sticky-cell props that draw both. `data-table.tsx`
5
5
  * composes them; nothing here knows the rest of the table.
6
6
  */
7
- import { Text } from '@mantine/core'
7
+ import { Popover, Text } from '@mantine/core'
8
8
  import type {
9
9
  Cell,
10
10
  Column,
@@ -452,21 +452,74 @@ export function RowDisclosure<T extends RowData>({
452
452
  )
453
453
  }
454
454
 
455
- /** The header cell above the toggles: a micro count of what folded, with the names in `title` and
456
- * for a screen reader (F102 — a hidden column must be announced, not merely reachable). */
455
+ /** The count word of a fold label, singular for one: "column", or "col" for the tight visible header. */
456
+ function foldNoun(count: number, short: boolean): string {
457
+ const noun = short ? 'col' : 'column'
458
+ return count === 1 ? noun : `${noun}s`
459
+ }
460
+
461
+ /** "2 more columns: C, D" — the folded columns, counted and named. */
462
+ export function foldedSummary(count: number, label: string): string {
463
+ return `${count} more ${foldNoun(count, false)}: ${label}`
464
+ }
465
+
466
+ /** The header cell above the toggles: a micro count of what folded, and a button that NAMES them. The
467
+ * button's accessible name is the one summary (F102 — a hidden column must be announced, not merely
468
+ * reachable); its `title` is the mouse hint, and a tap, Enter or Space opens a popover listing the
469
+ * folded columns, because a touch reader never sees a `title` (the 390 crop read as an unexplained
470
+ * "+3 cols"). The popover closes on outside click and Escape. A bare `+N` read as an unexplained
471
+ * figure at 390, so the word rides with it — in the sans micro face, which keeps "+4 cols" inside
472
+ * the 44px toggle cell (the mono face did not). A second line shows the first folded name, ellipsised to
473
+ * the cell, so the button says what it opens before it is tapped. */
457
474
  export function FoldHeaderLabel({
458
- count,
459
- foldedLabel,
475
+ names,
460
476
  }: {
461
- count: number
462
- foldedLabel: string
477
+ /** The folded columns' headers, in column order. */
478
+ names: readonly string[]
463
479
  }): ReactNode {
480
+ const [opened, setOpened] = useState(false)
481
+ const count = names.length
482
+ const summary = foldedSummary(count, names.join(', '))
483
+ const visible = `+${count} ${foldNoun(count, true)}`
464
484
  return (
465
- <span className={classes.foldCount} title={foldedLabel}>
466
- <span aria-hidden>+{count}</span>
467
- <span className={classes.srOnly}>
468
- {count} {count === 1 ? 'column' : 'columns'} folded: {foldedLabel}
469
- </span>
485
+ <span className={classes.foldCount}>
486
+ <Popover
487
+ opened={opened}
488
+ onChange={setOpened}
489
+ position="bottom-start"
490
+ withinPortal
491
+ shadow="md"
492
+ transitionProps={{ duration: 0 }}
493
+ >
494
+ <Popover.Target>
495
+ <button
496
+ type="button"
497
+ className={classes.foldCountButton}
498
+ data-basalt-hit
499
+ title={summary}
500
+ aria-label={`${visible}, ${summary}`}
501
+ aria-haspopup="dialog"
502
+ aria-expanded={opened}
503
+ onClick={(event) => {
504
+ event.stopPropagation()
505
+ setOpened((open) => !open)
506
+ }}
507
+ >
508
+ {visible}
509
+ {/* What the count reveals, truncated to the toggle cell: the first folded name. Spoken in full by the label. */}
510
+ <span className={classes.foldCountHint} aria-hidden>
511
+ {names[0]}
512
+ </span>
513
+ </button>
514
+ </Popover.Target>
515
+ <Popover.Dropdown p="xs" className={classes.foldNames} aria-label={summary}>
516
+ <ul className={classes.foldNameList}>
517
+ {names.map((name, index) => (
518
+ <li key={`${index}-${name}`}>{name}</li>
519
+ ))}
520
+ </ul>
521
+ </Popover.Dropdown>
522
+ </Popover>
470
523
  </span>
471
524
  )
472
525
  }
@@ -130,6 +130,7 @@
130
130
  * wrapper sized by its own min-content would never read a shrunken `clientWidth` back.
131
131
  */
132
132
  .foldWrapper {
133
+ position: relative;
133
134
  min-width: 0;
134
135
  }
135
136
 
@@ -175,14 +176,59 @@
175
176
  outline-offset: 1px;
176
177
  }
177
178
 
178
- /* The header above the toggles: a micro count of the folded columns. */
179
+ /* The header above the toggles: a micro count of the folded columns, the word included ("+4 cols"). */
179
180
  .foldCount {
180
- font-family: var(--mantine-font-family-monospace);
181
+ /* The header cell is mono caps with tracking; "+4 COLS" in it is 51px, wider than the 44px cell. */
182
+ font-family: var(--mantine-font-family);
183
+ letter-spacing: normal;
184
+ text-transform: none;
181
185
  font-size: var(--vx-text-micro);
182
186
  color: var(--vx-muted);
187
+ }
188
+
189
+ /* The first folded name under the count: one ellipsised line the width of the 44px toggle cell. */
190
+ .foldCountHint {
191
+ display: block;
192
+ inline-size: calc(2.75rem * var(--mantine-scale, 1));
193
+ overflow: hidden;
194
+ text-overflow: ellipsis;
195
+ white-space: nowrap;
196
+ opacity: 0.8;
197
+ }
198
+
199
+ /* The count is a button: bare, inheriting the micro face, `help` for the mouse's title hint. */
200
+ .foldCountButton {
201
+ padding: 0;
202
+ border: none;
203
+ background: none;
204
+ font: inherit;
205
+ color: inherit;
183
206
  cursor: help;
184
207
  }
185
208
 
209
+ .foldCountButton:hover,
210
+ .foldCountButton:focus-visible {
211
+ color: var(--vx-ink);
212
+ }
213
+
214
+ .foldCountButton:focus-visible {
215
+ outline: 2px solid var(--vx-accent);
216
+ outline-offset: 2px;
217
+ border-radius: var(--vx-radius-ctrl);
218
+ }
219
+
220
+ /* The popover naming the folded columns: a quiet list in the table's own sans. */
221
+ .foldNames {
222
+ font-size: var(--vx-text-sm);
223
+ color: var(--vx-ink);
224
+ }
225
+
226
+ .foldNameList {
227
+ margin: 0;
228
+ padding: 0;
229
+ list-style: none;
230
+ }
231
+
186
232
  .foldChevron {
187
233
  width: 0.875rem;
188
234
  height: 0.875rem;
@@ -301,6 +347,26 @@
301
347
  outline-offset: -2px;
302
348
  }
303
349
 
350
+ /*
351
+ * Inside the fold wrapper the ring is an overlay instead: an outline paints UNDER the sticky cells
352
+ * (pinned column, toggle, header), so at 390 it was open along the top and start edge. The overlay
353
+ * sits over them, on the wrapper — the scroller's own box, which never scrolls — closed on all four.
354
+ */
355
+ @supports selector(:has(*)) {
356
+ .foldWrapper .scroller:focus-visible {
357
+ outline: none;
358
+ }
359
+
360
+ .foldWrapper:has(.scroller:focus-visible)::after {
361
+ content: '';
362
+ position: absolute;
363
+ inset: 0;
364
+ z-index: 5;
365
+ border: 2px solid var(--vx-accent);
366
+ pointer-events: none;
367
+ }
368
+ }
369
+
304
370
  /*
305
371
  * A pinned cell is opaque in EVERY row state (TanStack issue 5392 — the cell under it bled through).
306
372
  * Its inline `background-color` is the panel; the row's own state tint is layered over it as an image,
@@ -380,6 +446,12 @@ td.pinnedFluid {
380
446
  width: 1px;
381
447
  }
382
448
 
449
+ /* A fitted `text` column (all cells short) is as wide as its longest cell, so it holds one line: at
450
+ `width: 1px` the wrapping law would break "Payment failed" onto two. */
451
+ .table td[data-fit][data-kind='text']:not(.pinnedLayer) {
452
+ white-space: nowrap;
453
+ }
454
+
383
455
  .spacer {
384
456
  padding: 0;
385
457
  }
@@ -10,12 +10,16 @@ declare const classes: {
10
10
  readonly dangerAction: string
11
11
  readonly foldChevron: string
12
12
  readonly foldCount: string
13
+ readonly foldCountButton: string
14
+ readonly foldCountHint: string
13
15
  readonly foldDisclosure: string
14
16
  readonly foldDisclosureCell: string
15
17
  readonly foldDisclosureLabel: string
16
18
  readonly foldDisclosureRow: string
17
19
  readonly foldDisclosureRowTr: string
18
20
  readonly foldDisclosureValue: string
21
+ readonly foldNameList: string
22
+ readonly foldNames: string
19
23
  readonly foldToggle: string
20
24
  readonly foldToggleCell: string
21
25
  readonly foldWrapper: string
@@ -63,8 +63,9 @@ import { constructFilterFn, FlexRender, useTable } from '@tanstack/react-table'
63
63
  import type { CSSProperties, MouseEvent as ReactMouseEvent, ReactNode, RefObject } from 'react'
64
64
  import { Fragment, useId, useLayoutEffect, useMemo, useRef, useState } from 'react'
65
65
  import { useDebouncedCallback } from '@mantine/hooks'
66
- import { cx } from '../common/props'
67
- import type { BasaltProps, SlotStylesProps } from '../common/props'
66
+ import { HostTitleContext } from '../common/could-not-load'
67
+ import { cx, pickDataAttributes } from '../common/props'
68
+ import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props'
68
69
  import { BASALT_PREFIX } from '../common/errors'
69
70
  import { HIT_COARSE } from '../common/hit-floor'
70
71
  import { useMeasuredWidths } from '../common/use-measured-widths'
@@ -96,7 +97,12 @@ import {
96
97
  export { planColumnFold } from './data-table-fold'
97
98
  import { dataQueryBranch } from './query-branch'
98
99
  import { basaltTableFeatures } from './table-features'
99
- import type { BasaltColumnDef, BasaltTableFeatures, DataTableAlign } from './table-features'
100
+ import type {
101
+ BasaltColumnDef,
102
+ BasaltTableFeatures,
103
+ DataTableAlign,
104
+ DataTableColumnKind,
105
+ } from './table-features'
100
106
  import {
101
107
  columnDefId,
102
108
  columnLabel,
@@ -542,6 +548,7 @@ export type BasaltDataTableSlot = 'root' | 'toolbar' | 'table' | 'footer'
542
548
  * }
543
549
  */
544
550
  export type BasaltDataTableProps<T extends RowData> = BasaltProps &
551
+ DataAttributes &
545
552
  SlotStylesProps<BasaltDataTableSlot> & {
546
553
  // ── Header (WidgetHeader, docs/CONTROLS-SPEC.md §2.2) ──────────────────────────
547
554
 
@@ -992,11 +999,15 @@ export type BasaltDataTableProps<T extends RowData> = BasaltProps &
992
999
  /**
993
1000
  * A skeleton cell's floor by `meta.kind`, rem: roughly what a typical value of the kind measures, so
994
1001
  * a loading table plans the same fold as the loaded one instead of squeezing every column to its
995
- * (narrow) header. A column without a kind keeps its natural width.
1002
+ * (narrow) header. A kindless column floors at a short phrase. `text` is a short word
1003
+ * (a scope, a category): the bar was once 10rem wide, which made such a column 3x its loaded width
1004
+ * and folded one column more than the rows do.
996
1005
  */
997
- const SKELETON_MIN_REM: Record<string, number> = {
1006
+ const SKELETON_MIN_REM: Partial<Record<DataTableColumnKind | 'kindless', number>> = {
998
1007
  entity: 7,
999
- text: 6,
1008
+ text: 4.5,
1009
+ // A kindless column is the one-line cause or note of an outage or event log.
1010
+ kindless: 8,
1000
1011
  'relative-time': 5,
1001
1012
  status: 4,
1002
1013
  money: 4.5,
@@ -1006,8 +1017,9 @@ const SKELETON_MIN_REM: Record<string, number> = {
1006
1017
  function skeletonMinWidth<T extends RowData>(
1007
1018
  column: Column<BasaltTableFeatures, T, unknown>,
1008
1019
  ): string | undefined {
1009
- const kind = resolveKind(column)
1010
- const rem = kind === undefined ? undefined : SKELETON_MIN_REM[kind]
1020
+ // The checkbox and actions columns are synthetic: no kind, and a fixed width of their own.
1021
+ if (column.id === SELECT_COLUMN_ID || column.id === ACTIONS_COLUMN_ID) return undefined
1022
+ const rem = SKELETON_MIN_REM[resolveKind(column) ?? 'kindless']
1011
1023
  return rem === undefined ? undefined : `${rem}rem`
1012
1024
  }
1013
1025
 
@@ -1620,10 +1632,10 @@ export function BasaltDataTable<T extends RowData>(props: BasaltDataTableProps<T
1620
1632
  )
1621
1633
  const ariaColCount = fullLeafColumns.length + colIndexOffset
1622
1634
  // What the toggle announces: the folded columns' own headers, in column order.
1623
- const foldedLabel = fullLeafColumns
1635
+ const foldedNames = fullLeafColumns
1624
1636
  .filter((column) => foldedColumns.has(column.id))
1625
1637
  .map((column) => columnLabel(column))
1626
- .join(', ')
1638
+ const foldedLabel = foldedNames.join(', ')
1627
1639
 
1628
1640
  // `getSelectedRowModel()` is TanStack's own memo, so its `rows` array keeps its identity until
1629
1641
  // the selection or the row model actually moves — which is what makes both memos below hold.
@@ -1695,13 +1707,19 @@ export function BasaltDataTable<T extends RowData>(props: BasaltDataTableProps<T
1695
1707
  const errorNode = queryError !== undefined && (
1696
1708
  <ErrorState
1697
1709
  error={queryError.error}
1698
- title="Could not load"
1710
+ // A titled table names itself; an untitled one reads its host's title (`Section`, a card)
1711
+ // through `ErrorState`, which falls back to the bare "Could not load" outside any host.
1712
+ {...(title !== undefined && { title: `Could not load ${title}` })}
1699
1713
  tier="section"
1700
1714
  retrying={queryError.fetchStatus === 'fetching'}
1701
1715
  onRetry={() => void queryError.refetch()}
1702
1716
  />
1703
1717
  )
1704
- const emptyNode = emptyState ?? <EmptyState tier="section" title="No data to display." />
1718
+ const emptyNode = (
1719
+ <HostTitleContext value={title}>
1720
+ {emptyState ?? <EmptyState tier="section" title="No data to display." />}
1721
+ </HostTitleContext>
1722
+ )
1705
1723
 
1706
1724
  // The cells in render order (start → center → end) with only the visible ones — the skeleton rows
1707
1725
  // mirror the header with it.
@@ -1723,6 +1741,8 @@ export function BasaltDataTable<T extends RowData>(props: BasaltDataTableProps<T
1723
1741
  const { fitIds, spacer } = planColumnSizing(
1724
1742
  orderedVisibleColumns,
1725
1743
  new Set([SELECT_COLUMN_ID, ACTIONS_COLUMN_ID]),
1744
+ // Every row, not the page: paging, sorting or filtering must not move a column's width.
1745
+ table.getCoreRowModel().rows,
1726
1746
  )
1727
1747
  const fitAttr = (id: string) => (fitIds.has(id) ? { 'data-fit': true } : undefined)
1728
1748
  // colSpan covers the rendered cells, the trailing spacer included.
@@ -1760,7 +1780,7 @@ export function BasaltDataTable<T extends RowData>(props: BasaltDataTableProps<T
1760
1780
  are folded, and which. */}
1761
1781
  {hasFolded && (
1762
1782
  <Table.Th {...toggleCell} aria-colindex={1}>
1763
- <FoldHeaderLabel count={foldedColumns.size} foldedLabel={foldedLabel} />
1783
+ <FoldHeaderLabel names={foldedNames} />
1764
1784
  </Table.Th>
1765
1785
  )}
1766
1786
  {headerGroup.headers.map((header) => {
@@ -1991,6 +2011,7 @@ export function BasaltDataTable<T extends RowData>(props: BasaltDataTableProps<T
1991
2011
 
1992
2012
  return (
1993
2013
  <div
2014
+ {...pickDataAttributes(props)}
1994
2015
  ref={projectionRootRef}
1995
2016
  className={cx(classNames?.root, className)}
1996
2017
  {...(style !== undefined && { style })}