basalt-ui 2.20.0 → 2.22.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 (289) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/MIGRATING.md +394 -12
  3. package/agent/agents/basalt-design-reviewer.md +22 -5
  4. package/agent/rules/basalt-tokens.md +3 -3
  5. package/agent/skills/basalt-design/SKILL.md +10 -23
  6. package/agent/skills/basalt-design/references/anti-defaults.md +24 -0
  7. package/agent/skills/basalt-design/references/catalogue.md +49 -0
  8. package/agent/skills/basalt-design/references/concept.md +36 -0
  9. package/agent/skills/basalt-design/references/encoding-rules.md +45 -0
  10. package/agent/skills/basalt-design/references/stat-tile.md +24 -0
  11. package/agent/templates/AGENTS-block.md.tpl +3 -3
  12. package/configs/oxlint-plugin.js +1 -0
  13. package/dist/charts/BandStrip.d.ts.map +1 -1
  14. package/dist/charts/BandStrip.js +27 -3
  15. package/dist/charts/Bars.d.ts.map +1 -1
  16. package/dist/charts/Bars.js +5 -0
  17. package/dist/charts/CartesianChart.d.ts +8 -0
  18. package/dist/charts/CartesianChart.d.ts.map +1 -1
  19. package/dist/charts/CartesianChart.js +8 -5
  20. package/dist/charts/ChartCard.d.ts +17 -4
  21. package/dist/charts/ChartCard.d.ts.map +1 -1
  22. package/dist/charts/ChartCard.js +33 -8
  23. package/dist/charts/DualPanel.d.ts.map +1 -1
  24. package/dist/charts/DualPanel.js +5 -8
  25. package/dist/charts/Heatmap.d.ts +12 -1
  26. package/dist/charts/Heatmap.d.ts.map +1 -1
  27. package/dist/charts/Heatmap.js +34 -5
  28. package/dist/charts/Lines.d.ts +3 -0
  29. package/dist/charts/Lines.d.ts.map +1 -1
  30. package/dist/charts/Lines.js +29 -6
  31. package/dist/charts/MirroredBars.d.ts.map +1 -1
  32. package/dist/charts/MirroredBars.js +4 -6
  33. package/dist/charts/Sparkline.d.ts +7 -1
  34. package/dist/charts/Sparkline.d.ts.map +1 -1
  35. package/dist/charts/Sparkline.js +39 -14
  36. package/dist/charts/StackedArea.d.ts +4 -1
  37. package/dist/charts/StackedArea.d.ts.map +1 -1
  38. package/dist/charts/StackedArea.js +9 -3
  39. package/dist/charts/band-fold.d.ts +20 -1
  40. package/dist/charts/band-fold.d.ts.map +1 -1
  41. package/dist/charts/band-fold.js +9 -0
  42. package/dist/charts/chart-box.module.css +19 -0
  43. package/dist/charts/chart-card.module.css +25 -0
  44. package/dist/charts/chart-legend.module.css +7 -0
  45. package/dist/charts/compile.d.ts +17 -6
  46. package/dist/charts/compile.d.ts.map +1 -1
  47. package/dist/charts/compile.js +145 -74
  48. package/dist/charts/labels.d.ts +15 -4
  49. package/dist/charts/labels.d.ts.map +1 -1
  50. package/dist/charts/labels.js +34 -10
  51. package/dist/charts/legend.d.ts +2 -0
  52. package/dist/charts/legend.d.ts.map +1 -1
  53. package/dist/charts/legend.js +7 -21
  54. package/dist/charts/marks.js +1 -1
  55. package/dist/charts/panel.d.ts +0 -6
  56. package/dist/charts/panel.d.ts.map +1 -1
  57. package/dist/charts/panel.js +1 -10
  58. package/dist/charts/ref-label.d.ts +26 -0
  59. package/dist/charts/ref-label.d.ts.map +1 -0
  60. package/dist/charts/ref-label.js +63 -0
  61. package/dist/charts/scales.d.ts +4 -1
  62. package/dist/charts/scales.d.ts.map +1 -1
  63. package/dist/charts/scales.js +14 -3
  64. package/dist/charts/sparkline.module.css +10 -11
  65. package/dist/charts/sparkline.module.css.d.ts +1 -2
  66. package/dist/charts/state.d.ts +7 -0
  67. package/dist/charts/state.d.ts.map +1 -1
  68. package/dist/charts/state.js +4 -1
  69. package/dist/charts/types.d.ts +14 -5
  70. package/dist/charts/types.d.ts.map +1 -1
  71. package/dist/cli/check-theme.d.ts.map +1 -1
  72. package/dist/cli/check-theme.js +3 -0
  73. package/dist/cli/doctor-upgrade.d.ts +1 -0
  74. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  75. package/dist/cli/doctor-upgrade.js +1 -0
  76. package/dist/cli/help.d.ts.map +1 -1
  77. package/dist/cli/help.js +3 -2
  78. package/dist/cli/index.d.ts +4 -2
  79. package/dist/cli/index.d.ts.map +1 -1
  80. package/dist/cli/index.js +27 -15
  81. package/dist/cli/init.d.ts +2 -0
  82. package/dist/cli/init.d.ts.map +1 -1
  83. package/dist/cli/init.js +71 -6
  84. package/dist/cli/shot/capture.d.ts +21 -2
  85. package/dist/cli/shot/capture.d.ts.map +1 -1
  86. package/dist/cli/shot/capture.js +200 -33
  87. package/dist/cli/shot/detect.d.ts +51 -0
  88. package/dist/cli/shot/detect.d.ts.map +1 -0
  89. package/dist/cli/shot/detect.js +409 -0
  90. package/dist/cli/shot/index.d.ts.map +1 -1
  91. package/dist/cli/shot/index.js +7 -4
  92. package/dist/cli/shot/measure.d.ts +2 -0
  93. package/dist/cli/shot/measure.d.ts.map +1 -1
  94. package/dist/cli/shot/measure.js +2 -0
  95. package/dist/cli/shot/playwright.d.ts +5 -2
  96. package/dist/cli/shot/playwright.d.ts.map +1 -1
  97. package/dist/cli/shot/types.d.ts +6 -1
  98. package/dist/cli/shot/types.d.ts.map +1 -1
  99. package/dist/cli/shot/types.js +4 -0
  100. package/dist/cli/sync.d.ts +2 -0
  101. package/dist/cli/sync.d.ts.map +1 -1
  102. package/dist/cli/sync.js +2 -2
  103. package/dist/common/retry-button.d.ts +12 -0
  104. package/dist/common/retry-button.d.ts.map +1 -0
  105. package/dist/common/retry-button.js +22 -0
  106. package/dist/common/retry-button.module.css +58 -0
  107. package/dist/common/retry-button.module.css.d.ts +8 -0
  108. package/dist/controls/controls.module.css +11 -1
  109. package/dist/controls/filter-pill.d.ts.map +1 -1
  110. package/dist/controls/filter-pill.js +1 -0
  111. package/dist/controls/sync-button.d.ts.map +1 -1
  112. package/dist/controls/sync-button.js +22 -3
  113. package/dist/controls/sync-button.module.css +34 -2
  114. package/dist/controls/sync-button.module.css.d.ts +1 -0
  115. package/dist/dashboard/bar-list.d.ts +5 -2
  116. package/dist/dashboard/bar-list.d.ts.map +1 -1
  117. package/dist/dashboard/bar-list.js +9 -10
  118. package/dist/dashboard/bar-list.module.css +53 -0
  119. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  120. package/dist/dashboard/index.d.ts +1 -0
  121. package/dist/dashboard/index.d.ts.map +1 -1
  122. package/dist/dashboard/index.js +2 -0
  123. package/dist/dashboard/meter-model.d.ts +108 -6
  124. package/dist/dashboard/meter-model.d.ts.map +1 -1
  125. package/dist/dashboard/meter-model.js +123 -19
  126. package/dist/dashboard/meter-parts.d.ts +8 -0
  127. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  128. package/dist/dashboard/meter-parts.js +345 -146
  129. package/dist/dashboard/meter.d.ts +50 -63
  130. package/dist/dashboard/meter.d.ts.map +1 -1
  131. package/dist/dashboard/meter.js +24 -3
  132. package/dist/dashboard/meter.module.css +79 -65
  133. package/dist/dashboard/meter.module.css.d.ts +7 -7
  134. package/dist/dashboard/page-summary.d.ts +20 -0
  135. package/dist/dashboard/page-summary.d.ts.map +1 -0
  136. package/dist/dashboard/page-summary.js +28 -0
  137. package/dist/dashboard/page-summary.module.css +89 -0
  138. package/dist/dashboard/page-summary.module.css.d.ts +15 -0
  139. package/dist/dashboard/query-state.d.ts +1 -1
  140. package/dist/dashboard/query-state.d.ts.map +1 -1
  141. package/dist/dashboard/query-state.js +3 -2
  142. package/dist/dashboard/section.d.ts +25 -2
  143. package/dist/dashboard/section.d.ts.map +1 -1
  144. package/dist/dashboard/section.js +10 -5
  145. package/dist/dashboard/section.module.css +23 -0
  146. package/dist/dashboard/section.module.css.d.ts +1 -0
  147. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  148. package/dist/dashboard/stat-card-parts.js +1 -1
  149. package/dist/dashboard/stat-card.d.ts +4 -2
  150. package/dist/dashboard/stat-card.d.ts.map +1 -1
  151. package/dist/dashboard/stat-card.js +7 -4
  152. package/dist/dashboard/stat-card.module.css +17 -0
  153. package/dist/dashboard/stat-strip.d.ts +24 -1
  154. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  155. package/dist/dashboard/stat-strip.js +97 -39
  156. package/dist/dashboard/stat-strip.module.css +147 -17
  157. package/dist/dashboard/stat-strip.module.css.d.ts +8 -0
  158. package/dist/dashboard/visual-slot.d.ts +8 -0
  159. package/dist/dashboard/visual-slot.d.ts.map +1 -0
  160. package/dist/dashboard/visual-slot.js +7 -0
  161. package/dist/guard/index.d.ts +15 -2
  162. package/dist/guard/index.d.ts.map +1 -1
  163. package/dist/guard/index.js +14 -0
  164. package/dist/guard/palette.d.ts +51 -0
  165. package/dist/guard/palette.d.ts.map +1 -0
  166. package/dist/guard/palette.js +190 -0
  167. package/dist/guard/series-file.d.ts +15 -0
  168. package/dist/guard/series-file.d.ts.map +1 -0
  169. package/dist/guard/series-file.js +29 -0
  170. package/dist/guard/types.d.ts +3 -3
  171. package/dist/guard/types.d.ts.map +1 -1
  172. package/dist/guard/vx-names.d.ts.map +1 -1
  173. package/dist/guard/vx-names.js +2 -0
  174. package/dist/index.d.ts +1 -1
  175. package/dist/index.d.ts.map +1 -1
  176. package/dist/index.js +3 -1
  177. package/dist/styles.css +34 -2
  178. package/dist/surfaces.d.ts +1 -1
  179. package/dist/surfaces.d.ts.map +1 -1
  180. package/dist/surfaces.js +2 -0
  181. package/dist/theme/chrome-vars.d.ts +20 -5
  182. package/dist/theme/chrome-vars.d.ts.map +1 -1
  183. package/dist/theme/chrome-vars.js +46 -3
  184. package/dist/theme/controls.module.css +33 -0
  185. package/dist/theme/controls.module.css.d.ts +1 -0
  186. package/dist/theme/index.d.ts.map +1 -1
  187. package/dist/theme/index.js +11 -5
  188. package/dist/tokens/core.d.ts +2 -1
  189. package/dist/tokens/core.d.ts.map +1 -1
  190. package/dist/tokens/core.js +6 -1
  191. package/dist/tokens/derive.d.ts +3 -1
  192. package/dist/tokens/derive.d.ts.map +1 -1
  193. package/dist/tokens/derive.js +16 -1
  194. package/dist/tokens/oklab.d.ts +28 -0
  195. package/dist/tokens/oklab.d.ts.map +1 -0
  196. package/dist/tokens/oklab.js +73 -0
  197. package/dist/tokens/palette.d.ts +4 -0
  198. package/dist/tokens/palette.d.ts.map +1 -1
  199. package/dist/tokens/palette.js +4 -0
  200. package/dist/tokens/status-text.d.ts.map +1 -1
  201. package/dist/tokens/status-text.js +3 -1
  202. package/llms.txt +43 -23
  203. package/package.json +1 -1
  204. package/src/charts/BandStrip.tsx +33 -3
  205. package/src/charts/Bars.tsx +6 -0
  206. package/src/charts/CartesianChart.tsx +16 -3
  207. package/src/charts/ChartCard.tsx +43 -7
  208. package/src/charts/DualPanel.tsx +3 -6
  209. package/src/charts/Heatmap.tsx +54 -5
  210. package/src/charts/Lines.tsx +56 -10
  211. package/src/charts/MirroredBars.tsx +3 -5
  212. package/src/charts/Sparkline.tsx +50 -13
  213. package/src/charts/StackedArea.tsx +14 -4
  214. package/src/charts/band-fold.ts +31 -1
  215. package/src/charts/chart-box.module.css +19 -0
  216. package/src/charts/chart-card.module.css +25 -0
  217. package/src/charts/chart-legend.module.css +7 -0
  218. package/src/charts/compile.ts +210 -85
  219. package/src/charts/labels.ts +48 -14
  220. package/src/charts/legend.tsx +10 -20
  221. package/src/charts/marks.ts +1 -1
  222. package/src/charts/panel.tsx +1 -16
  223. package/src/charts/ref-label.ts +104 -0
  224. package/src/charts/scales.ts +22 -2
  225. package/src/charts/sparkline.module.css +10 -11
  226. package/src/charts/sparkline.module.css.d.ts +1 -2
  227. package/src/charts/state.tsx +12 -1
  228. package/src/charts/types.ts +14 -5
  229. package/src/cli/check-theme.ts +3 -0
  230. package/src/cli/doctor-upgrade.ts +1 -1
  231. package/src/cli/help.ts +18 -1
  232. package/src/cli/index.ts +48 -17
  233. package/src/cli/init.ts +102 -4
  234. package/src/cli/shot/capture.ts +266 -34
  235. package/src/cli/shot/detect.ts +550 -0
  236. package/src/cli/shot/index.ts +8 -4
  237. package/src/cli/shot/measure.ts +4 -0
  238. package/src/cli/shot/playwright.ts +2 -2
  239. package/src/cli/shot/types.ts +8 -1
  240. package/src/cli/sync.ts +4 -2
  241. package/src/common/retry-button.module.css +58 -0
  242. package/src/common/retry-button.module.css.d.ts +8 -0
  243. package/src/common/retry-button.tsx +29 -0
  244. package/src/controls/controls.module.css +11 -1
  245. package/src/controls/filter-pill.tsx +2 -0
  246. package/src/controls/sync-button.module.css +34 -2
  247. package/src/controls/sync-button.module.css.d.ts +1 -0
  248. package/src/controls/sync-button.tsx +40 -4
  249. package/src/dashboard/bar-list.module.css +53 -0
  250. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  251. package/src/dashboard/bar-list.tsx +88 -76
  252. package/src/dashboard/index.ts +1 -0
  253. package/src/dashboard/meter-model.ts +265 -28
  254. package/src/dashboard/meter-parts.tsx +424 -163
  255. package/src/dashboard/meter.module.css +79 -65
  256. package/src/dashboard/meter.module.css.d.ts +7 -7
  257. package/src/dashboard/meter.tsx +77 -17
  258. package/src/dashboard/page-summary.module.css +89 -0
  259. package/src/dashboard/page-summary.module.css.d.ts +15 -0
  260. package/src/dashboard/page-summary.tsx +95 -0
  261. package/src/dashboard/query-state.tsx +4 -7
  262. package/src/dashboard/section.module.css +23 -0
  263. package/src/dashboard/section.module.css.d.ts +1 -0
  264. package/src/dashboard/section.tsx +59 -11
  265. package/src/dashboard/stat-card-parts.tsx +5 -1
  266. package/src/dashboard/stat-card.module.css +17 -0
  267. package/src/dashboard/stat-card.tsx +14 -5
  268. package/src/dashboard/stat-strip.module.css +147 -17
  269. package/src/dashboard/stat-strip.module.css.d.ts +8 -0
  270. package/src/dashboard/stat-strip.tsx +182 -56
  271. package/src/dashboard/visual-slot.ts +17 -0
  272. package/src/guard/index.ts +16 -4
  273. package/src/guard/palette.ts +261 -0
  274. package/src/guard/series-file.ts +51 -0
  275. package/src/guard/types.ts +3 -2
  276. package/src/guard/vx-names.ts +2 -0
  277. package/src/index.ts +2 -0
  278. package/src/styles.css +34 -2
  279. package/src/surfaces.ts +2 -0
  280. package/src/theme/__snapshots__/plain-theme.test.ts.snap +220 -60
  281. package/src/theme/chrome-vars.ts +77 -8
  282. package/src/theme/controls.module.css +33 -0
  283. package/src/theme/controls.module.css.d.ts +1 -0
  284. package/src/theme/index.ts +18 -5
  285. package/src/tokens/core.ts +4 -1
  286. package/src/tokens/derive.ts +32 -3
  287. package/src/tokens/oklab.ts +97 -0
  288. package/src/tokens/palette.ts +4 -0
  289. package/src/tokens/status-text.ts +2 -0
@@ -14,10 +14,11 @@
14
14
  * the re-derivation this exists to delete. `LoadingState` / `ErrorState` ship alongside as the
15
15
  * escape hatch for a page that must place its branches in different DOM positions.
16
16
  */
17
- import { Button, Center, Group, Loader, Stack, Text } from '@mantine/core'
17
+ import { Center, Group, Loader, Stack, Text } from '@mantine/core'
18
18
  import type { CSSProperties, ReactNode } from 'react'
19
19
  import { toErrorMessage } from '../common/errors'
20
20
  import { cx } from '../common/props'
21
+ import { RetryButton } from '../common/retry-button'
21
22
  import type { BasaltProps, SlotStylesProps } from '../common/props'
22
23
  import { VX } from '../tokens'
23
24
  import { StatusDot } from '../theme/status-dot'
@@ -104,7 +105,7 @@ export type ErrorStateProps = BasaltProps & {
104
105
  /** Shown only when the server body carries no readable message. */
105
106
  fallback?: string
106
107
  onRetry?: () => void
107
- /** Disables/spins the retry button while a refetch is in flight. */
108
+ /** Disables the retry button while a refetch is in flight. */
108
109
  retrying?: boolean
109
110
  /** How loud this state is. Default `'page'`. */
110
111
  tier?: QueryStateTier
@@ -148,11 +149,7 @@ export function ErrorState({
148
149
  </Text>
149
150
  {(onRetry ?? action) !== undefined && (
150
151
  <Group gap="xs">
151
- {onRetry && (
152
- <Button size="xs" variant="default" loading={retrying} onClick={onRetry}>
153
- Retry
154
- </Button>
155
- )}
152
+ {onRetry && <RetryButton onClick={onRetry} retrying={retrying} />}
156
153
  {action}
157
154
  </Group>
158
155
  )}
@@ -41,6 +41,29 @@
41
41
  gap: 0;
42
42
  }
43
43
 
44
+ /*
45
+ * Three type sizes in one section, not four (argo calendar next-days counted group head 11 + row
46
+ * title 13 + meta 12 + section title 15). The `group` tier is the one head this package draws below
47
+ * the section title, and it was on `micro` (11) — a step of its own. It joins the `xs` (12) step the
48
+ * rows' meta already uses; the head stays a mono UPPERCASE caption, which is the one place D33 keeps
49
+ * mono, so only its size moves and the rank is still carried by case, face and tracking. Section
50
+ * title (15), row title (13) and meta + group head (12) are then the whole ladder.
51
+ */
52
+ .root[data-tier='group'] [data-widget-title] {
53
+ font-size: var(--vx-text-xs);
54
+ }
55
+
56
+ /*
57
+ * The untitled header: `tabs` (and `actions`) alone, one control row at the `ctl` height, so the
58
+ * row costs what the controls cost and nothing for a heading that is not there.
59
+ */
60
+ .tabsRow {
61
+ display: flex;
62
+ align-items: center;
63
+ gap: var(--vx-space-control-gap);
64
+ min-width: 0;
65
+ }
66
+
44
67
  /*
45
68
  * `summary` — the always-visible row under the header. No border, no background (the Section owns
46
69
  * neither); it is a plain flow row, so a consumer's `Group` of stats or one line of `Text` lands
@@ -6,6 +6,7 @@ declare const classes: {
6
6
  readonly root: string
7
7
  readonly body: string
8
8
  readonly summary: string
9
+ readonly tabsRow: string
9
10
  readonly chevron: string
10
11
  }
11
12
  export default classes
@@ -75,7 +75,25 @@ export type SectionSlot = 'root' | 'header' | 'body'
75
75
  // intersecting the two would let a caller write `classNames={{ metric: … }}` on a `Section` and get
76
76
  // silence. Section's three slots are its whole styling contract; the header's own slots are reached
77
77
  // on a `WidgetHeader`.
78
- export type SectionProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'actions'> &
78
+ /** The props only a drawn heading can carry; an untitled `Section` forbids each (`?: never`). */
79
+ type HeaderOnlyKey =
80
+ | 'icon'
81
+ | 'subtitle'
82
+ | 'info'
83
+ | 'value'
84
+ | 'unit'
85
+ | 'delta'
86
+ | 'deltaPeriod'
87
+ | 'deltaPolarity'
88
+ | 'deltaFormat'
89
+ | 'deltaGlyph'
90
+ | 'sparkline'
91
+ | 'count'
92
+
93
+ type SectionBaseProps = Omit<
94
+ WidgetHeaderProps,
95
+ 'tier' | 'classNames' | 'actions' | 'title' | HeaderOnlyKey
96
+ > &
79
97
  BasaltProps &
80
98
  SlotStylesProps<SectionSlot> & {
81
99
  /**
@@ -128,6 +146,24 @@ export type SectionProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'acti
128
146
  children: ReactNode
129
147
  }
130
148
 
149
+ /**
150
+ * A Section names itself with `title` — or, with no title, by its `tabs` alone (argo's m365 phone
151
+ * pane switch: a heading restating the open pane's name beside the tabs that already say it). The
152
+ * header row then collapses to the tabs (and `actions`): no heading, no fold, and none of the
153
+ * heading-only props (`count`, `info`, `subtitle`, `icon`, the hero metric) — each is a type error.
154
+ *
155
+ * Naming: a `ViewTabs` in `tabs` already names its own tablist, so the section adds no second name
156
+ * and no `group` role. Pass `aria-label` only when the tabs are not self-naming — it then makes the
157
+ * root a labelled `group`.
158
+ */
159
+ export type SectionProps = SectionBaseProps &
160
+ (
161
+ | (Pick<WidgetHeaderProps, HeaderOnlyKey> & { title: string; 'aria-label'?: never })
162
+ | ({ title?: undefined; tabs: ReactNode; 'aria-label'?: string } & {
163
+ [K in HeaderOnlyKey]?: never
164
+ })
165
+ )
166
+
131
167
  function ChevronToggle({
132
168
  open,
133
169
  onToggle,
@@ -187,9 +223,11 @@ export function Section({
187
223
  className,
188
224
  style,
189
225
  classNames,
226
+ 'aria-label': ariaLabel,
190
227
  ...headerProps
191
228
  }: SectionProps) {
192
229
  const { title } = headerProps
230
+ const untitled = title === undefined
193
231
 
194
232
  // A `persistKey` with nothing to fold writes a localStorage key nobody ever reads back — the
195
233
  // shape a consumer lands on after deleting `collapsible` and leaving the key behind. It renders
@@ -242,16 +280,18 @@ export function Section({
242
280
  const rootStyle =
243
281
  anchorStyle === undefined && style === undefined ? undefined : { ...anchorStyle, ...style }
244
282
 
283
+ // An untitled section has nothing to fold behind: the tabs ARE the header.
284
+ const foldable = collapsible && !untitled
245
285
  const headerActions =
246
- tabs !== undefined || actions !== undefined || collapsible ? (
286
+ tabs !== undefined || actions !== undefined || foldable ? (
247
287
  <>
248
- {tabs !== undefined && open && <CtlSlot>{tabs}</CtlSlot>}
288
+ {tabs !== undefined && (open || untitled) && <CtlSlot>{tabs}</CtlSlot>}
249
289
  {actions !== undefined && (
250
290
  <CtlSlot>
251
291
  <BarActionSlot actions={actions} />
252
292
  </CtlSlot>
253
293
  )}
254
- {collapsible && (
294
+ {foldable && (
255
295
  <ChevronToggle open={open} onToggle={() => setOpen(!open)} controls={bodyId} />
256
296
  )}
257
297
  </>
@@ -261,17 +301,25 @@ export function Section({
261
301
  <div
262
302
  className={cx(classes.root, classNames?.root, className)}
263
303
  data-tier={tier}
304
+ {...(untitled && ariaLabel !== undefined && { role: 'group', 'aria-label': ariaLabel })}
264
305
  {...(id !== undefined && { id })}
265
306
  {...(rootStyle !== undefined && { style: rootStyle })}
266
307
  >
267
- <WidgetHeader
268
- tier={tier}
269
- {...headerProps}
270
- {...(classNames?.header !== undefined && { className: classNames.header })}
271
- {...(headerActions !== undefined && { actions: headerActions })}
272
- />
308
+ {untitled ? (
309
+ <div className={cx(classes.tabsRow, classNames?.header)} data-basalt-hit-scope>
310
+ {headerActions}
311
+ </div>
312
+ ) : (
313
+ <WidgetHeader
314
+ tier={tier}
315
+ {...(headerProps as Pick<WidgetHeaderProps, HeaderOnlyKey>)}
316
+ title={title}
317
+ {...(classNames?.header !== undefined && { className: classNames.header })}
318
+ {...(headerActions !== undefined && { actions: headerActions })}
319
+ />
320
+ )}
273
321
  {summary !== undefined && <div className={classes.summary}>{summary}</div>}
274
- {open && (
322
+ {(open || untitled) && (
275
323
  <div id={bodyId} className={cx(classes.body, classNames?.body)}>
276
324
  {query === undefined ? (
277
325
  children
@@ -55,7 +55,11 @@ export function CaptionRow({ title, icon, info, qualifier, tone, actions }: Capt
55
55
  />
56
56
  )}
57
57
  </div>
58
- {qualifier !== undefined && <span className={classes.qualifier}>{qualifier}</span>}
58
+ {qualifier !== undefined && (
59
+ <span className={classes.qualifier} title={qualifier}>
60
+ {qualifier}
61
+ </span>
62
+ )}
59
63
  </div>
60
64
  {/* `tier="widget"`: the caption row is 24px (`--vx-space-control-height-widget`), so a card
61
65
  with a kebab is the same height as one without (`theme/ctl-theme.tsx`). */}
@@ -96,6 +96,23 @@
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) never wraps the
100
+ * qualifier under the caption: that second line pushed the value below its row neighbours'. The
101
+ * caption row stays one line; the qualifier truncates (full text in its `title`). */
102
+ @container basalt-card (max-width: 239.9px) {
103
+ .captionMain {
104
+ flex-wrap: nowrap;
105
+ }
106
+
107
+ .qualifier {
108
+ flex: 0 1 auto;
109
+ overflow: hidden;
110
+ text-overflow: ellipsis;
111
+ white-space: nowrap;
112
+ text-align: end;
113
+ }
114
+ }
115
+
99
116
  /* Law C15: the shared hit overlay; `--vx-hit-gap` caps the expansion at the control gap. */
100
117
  .actions {
101
118
  --vx-hit-gap: var(--vx-space-control-gap);
@@ -112,6 +112,7 @@ import type { BasaltProps, SlotStylesProps, Tone } from '../common/props'
112
112
  import { ErrorState, QueryState, resolveQueryBranch } from './query-state'
113
113
  import type { QueryBranch, QueryStateLike } from './query-state'
114
114
  import classes from './stat-card.module.css'
115
+ import { HOSTED, VisualSlotContext } from './visual-slot'
115
116
 
116
117
  /**
117
118
  * The boxes `StatCard` paints, and the whole styling seam it offers (`common/props.ts`).
@@ -216,8 +217,10 @@ export type StatCardProps = BasaltProps &
216
217
  value: string
217
218
  /**
218
219
  * Right-aligned on the caption row, `micro` muted: the period, target or source the figure is
219
- * measured over (`30 days`, `target 99.9%`). Wraps under the caption when the card is too narrow
220
- * for both. Not a restatement of the caption.
220
+ * measured over (`30 days`, `target 99.9%`). Wraps under the caption when the card is too
221
+ * narrow for both. Only in a card narrower than 240px does it truncate instead (the full text
222
+ * is its `title`); between 240px and the width it fits, a long one still wraps and moves the
223
+ * value down a line. Not a restatement of the caption.
221
224
  */
222
225
  qualifier?: string
223
226
  /**
@@ -325,7 +328,7 @@ function renderValueBody({
325
328
  return (
326
329
  <ErrorState
327
330
  error={resolved.error}
328
- title="Could not load this figure"
331
+ title="Could not load"
329
332
  tier="section"
330
333
  onRetry={() => void resolved.query.refetch()}
331
334
  retrying={resolved.query.fetchStatus === 'fetching'}
@@ -357,12 +360,16 @@ function renderVisualNode({
357
360
  function renderFooterNode({
358
361
  subtitle,
359
362
  pending,
363
+ ready,
360
364
  }: {
361
365
  subtitle: string | undefined
362
366
  pending: boolean
367
+ ready: boolean
363
368
  }): ReactNode {
364
369
  if (subtitle === undefined) return null
365
370
  if (pending) return <FooterSkeleton />
371
+ // The footer captions the visual; with no figure drawn (empty, failed) it would caption nothing.
372
+ if (!ready) return null
366
373
  return (
367
374
  <p className={classes.footer} title={subtitle}>
368
375
  {subtitle}
@@ -448,7 +455,9 @@ export function StatCard({
448
455
  >
449
456
  {/* A measured slot renders nothing on the first commit (width 0) — an SVG at width 0 is a
450
457
  visible 0-width box that then jumps, which is worse than one frame of nothing. */}
451
- {isRender ? measured.width > 0 && sparkline(measured) : sparkline}
458
+ <VisualSlotContext.Provider value={tone === undefined ? HOSTED : { tone }}>
459
+ {isRender ? measured.width > 0 && sparkline(measured) : sparkline}
460
+ </VisualSlotContext.Provider>
452
461
  </div>
453
462
  )
454
463
 
@@ -484,7 +493,7 @@ export function StatCard({
484
493
 
485
494
  const hasBleedVisual = sparkline !== undefined && bleeds
486
495
  const visualNode = renderVisualNode({ show: hasBleedVisual, pending, slot: sparklineSlot })
487
- const footerNode = renderFooterNode({ subtitle, pending })
496
+ const footerNode = renderFooterNode({ subtitle, pending, ready })
488
497
 
489
498
  return (
490
499
  <Card
@@ -1,11 +1,12 @@
1
1
  /*
2
2
  * StatGroup `variant="strip"`: one joined surface, cells split by 1px hairlines.
3
3
  *
4
- * The hairlines are LEADING borders (inline-start + block-start) on every cell, and `.clip` hides
5
- * the ones that lead a row or the strip by pulling the grid 1px up/left inside an `overflow: hidden`
6
- * box. That is why the rail survives any column count and any wrap with no `nth-child` bookkeeping
7
- * (`stat-group.module.css` needs it because its cells are not clipped). No shadow per cell, no
8
- * coloured edge: the one surface is the Card's.
4
+ * The hairlines are LEADING edges (inline-start + block-start) drawn as outer box-shadows, so they
5
+ * take no layout space and every cell keeps the same `stack-md` inset. `.clip` hides the ones that
6
+ * lead a row or the strip by pulling the grid 1px up/left inside an `overflow: hidden` box. That is
7
+ * why the rail survives any column count and any wrap with no `nth-child` bookkeeping
8
+ * (`stat-group.module.css` needs it because its cells are not clipped). No coloured edge: the one
9
+ * surface is the Card's.
9
10
  *
10
11
  * The column law keys on the CONTAINER like `StatGroup`'s own: two columns at < 480px (the `regular` class boundary) with an odd
11
12
  * last cell spanning, never one; up to three below 800px; the full `cols` from 800px.
@@ -26,19 +27,86 @@
26
27
  margin: -1px 0 0 -1px;
27
28
  }
28
29
 
30
+ /* The CELL is the row-high column: it owns the hairlines, so they run the whole row however short
31
+ * the cell inside it ends. It paints nothing else — the one surface stays the Card's. */
29
32
  .cell {
30
- display: flex;
31
- flex-direction: column;
32
- gap: var(--vx-space-stack-sm);
33
+ display: grid;
34
+ grid-row: span 6;
35
+ grid-template-rows: subgrid;
33
36
  min-width: 0;
34
- padding: var(--vx-space-stack-md);
35
- border-inline-start: 1px solid var(--vx-divider);
37
+ /* The foot inset lives HERE, on the row-high slot (it lands on the last track of every cell
38
+ * alike). A cell that ends early must not carry it: its padding would inflate the shared track
39
+ * it ends in and push the parts below out of line. */
40
+ padding-block-end: var(--vx-space-stack-md);
41
+ box-shadow:
42
+ -1px 0 0 var(--vx-divider),
43
+ 0 -1px 0 var(--vx-divider);
36
44
  }
37
45
 
38
- /* The top line is adjacent-sibling: the first cell draws none (it leads the strip), every later one
39
- * draws its top edge, which is the rule between wrapped rows. */
40
- .cell + .cell {
41
- border-block-start: 1px solid var(--vx-divider);
46
+ /* The CONTENT spans the same six tracks (parts align through the subgrid) but is `align-self: start`,
47
+ * so its own box ends at its content instead of at the row's bottom. */
48
+ .content {
49
+ display: grid;
50
+ grid-row: 1 / span var(--basalt-strip-span, 6);
51
+ grid-template-rows: subgrid;
52
+ align-self: start;
53
+ min-width: 0;
54
+ padding: var(--vx-space-stack-md) var(--vx-space-stack-md) 0;
55
+ }
56
+
57
+ /* Forced colors drop box-shadows, so the hairlines come back as CanvasText borders. Every cell takes
58
+ * both, so they stay level with each other; `.clip` still hides the leading ones. */
59
+ @media (forced-colors: active) {
60
+ .cell {
61
+ border-inline-start: 1px solid CanvasText;
62
+ border-block-start: 1px solid CanvasText;
63
+ }
64
+ }
65
+
66
+ /* Cells align by PART. Every cell sits on the same six tracks of `.cells` (caption, hero, hero footer,
67
+ * visual, rows, footer), so a row of cells shares one caption top and one value baseline, and a void opens
68
+ * only where a sibling's same part is taller. A cell SPANS only down to its last part
69
+ * (`--basalt-strip-span`), so its own box ends at its content; the slot around it runs the whole
70
+ * row. A part a cell lacks collapses its track (the spacing is a margin on the part, not a gap).
71
+ * A footer rides with what it captions: under a hero alone it takes the hero-footer track right
72
+ * below the hero, under a visual it rides in the visual track (`.visualStack`); only a rows
73
+ * cell's footer uses the shared footer track. A hero-less cell (rows only) starts its rows in the
74
+ * visual track, so the hero track above them is the one void, and only as tall as a sibling's
75
+ * value. */
76
+ .content > * {
77
+ grid-column: 1;
78
+ min-width: 0;
79
+ }
80
+
81
+ .content > :not(.captionLine) {
82
+ margin-block-start: var(--vx-space-stack-sm);
83
+ }
84
+
85
+ .valueRow,
86
+ .skeletonValue,
87
+ .error {
88
+ grid-row: 2;
89
+ }
90
+
91
+ /* A hero's footer has its own track right under the hero track, so it hugs the value however tall a
92
+ * sibling's visual is, and a cell without a footer never spans (or reserves) it. */
93
+ .content > .heroFooter {
94
+ grid-row: 3;
95
+ }
96
+
97
+ .content > .visualStack,
98
+ .content > .reason,
99
+ .content > .rows {
100
+ grid-row: 4;
101
+ }
102
+
103
+ .content[data-strip-has-visual] > .rows {
104
+ grid-row: 5;
105
+ }
106
+
107
+ .content > .footer:not(.heroFooter) {
108
+ grid-row: 6;
109
+ align-self: start;
42
110
  }
43
111
 
44
112
  @container basalt-grid (max-width: 479.9px) {
@@ -58,7 +126,18 @@
58
126
  }
59
127
 
60
128
  .captionLine {
129
+ grid-row: 1;
130
+ display: flex;
131
+ flex-wrap: nowrap;
132
+ align-items: center;
133
+ column-gap: var(--vx-space-control-gap);
134
+ min-width: 0;
135
+ }
136
+
137
+ /* Caption + qualifier wrap among themselves; the `action` beside them never joins the wrap. */
138
+ .captionMain {
61
139
  display: flex;
140
+ flex: 1 1 0;
62
141
  flex-wrap: wrap;
63
142
  align-items: center;
64
143
  column-gap: var(--vx-space-control-gap);
@@ -96,6 +175,14 @@
96
175
  overflow-wrap: anywhere;
97
176
  }
98
177
 
178
+ /* A control at the end of the caption line: it keeps its size, the caption truncates first. */
179
+ .action {
180
+ display: inline-flex;
181
+ flex: none;
182
+ align-items: center;
183
+ margin-inline-start: auto;
184
+ }
185
+
99
186
  .valueRow {
100
187
  display: flex;
101
188
  flex-wrap: wrap;
@@ -129,7 +216,7 @@
129
216
  height: calc(var(--vx-text-kpi) * 1.25);
130
217
  }
131
218
 
132
- .cell[data-stale] {
219
+ .content[data-stale] {
133
220
  /* The package's one dimmed-state value (controls.module.css, panel-row.module.css). */
134
221
  opacity: 0.55;
135
222
  }
@@ -143,10 +230,14 @@
143
230
  min-width: 0;
144
231
  }
145
232
 
233
+ .visualStack > .footer {
234
+ margin-block-start: var(--vx-space-stack-sm);
235
+ }
236
+
146
237
  /* A Sparkline's hover readout takes this line above its plot (`charts/sparkline.module.css`). The
147
238
  * cell's own stack gap already sits above it; the slot reserves the rest, so the chip never covers
148
239
  * the value. */
149
- .cell {
240
+ .content {
150
241
  --basalt-spark-readout-h: 1.125rem;
151
242
  }
152
243
 
@@ -154,8 +245,36 @@
154
245
  padding-top: max(0px, calc(var(--basalt-spark-readout-h) - var(--vx-space-stack-sm)));
155
246
  }
156
247
 
248
+ /* An empty cell's reason and an errored cell's message: one muted `sm` line, wrapping rather than
249
+ * clipping (a 390px two-column cell is ~170px wide). */
250
+ .reason {
251
+ margin: 0;
252
+ min-width: 0;
253
+ font-size: var(--vx-text-sm);
254
+ line-height: 1.3;
255
+ color: var(--vx-muted);
256
+ overflow-wrap: anywhere;
257
+ }
258
+
259
+ /* The compact error anatomy: dot + word, the message, Retry — a left-aligned stack in the cell. */
260
+ .error {
261
+ display: flex;
262
+ flex-direction: column;
263
+ align-items: flex-start;
264
+ gap: var(--vx-space-stack-xs);
265
+ min-width: 0;
266
+ }
267
+
268
+ .errorHead {
269
+ display: inline-flex;
270
+ align-items: center;
271
+ gap: var(--vx-space-stack-sm);
272
+ font-size: var(--vx-text-sm);
273
+ font-weight: 500;
274
+ color: var(--vx-ink);
275
+ }
276
+
157
277
  .footer {
158
- margin-top: auto;
159
278
  font-size: var(--vx-text-sm);
160
279
  color: var(--vx-muted);
161
280
  }
@@ -199,6 +318,17 @@
199
318
  margin-left: -1px;
200
319
  }
201
320
 
321
+ /* A meter's start and end captions read as one phrase (name, then value) however wide the track. */
322
+ .footerCell [data-meter-captions] {
323
+ justify-content: flex-start;
324
+ column-gap: var(--vx-space-stack-md);
325
+ }
326
+
327
+ .footerCell [data-meter-captions] > * {
328
+ margin-inline-start: 0;
329
+ text-align: start;
330
+ }
331
+
202
332
  .footerCell {
203
333
  flex: 1 1 14rem;
204
334
  min-width: 0;
@@ -7,16 +7,24 @@ declare const classes: {
7
7
  readonly clip: string
8
8
  readonly cells: string
9
9
  readonly cell: string
10
+ readonly content: string
11
+ readonly action: string
10
12
  readonly captionLine: string
13
+ readonly captionMain: string
11
14
  readonly lead: string
12
15
  readonly caption: string
13
16
  readonly qualifier: string
14
17
  readonly valueRow: string
18
+ readonly heroFooter: string
15
19
  readonly value: string
16
20
  readonly unit: string
17
21
  readonly skeletonValue: string
18
22
  readonly skeletonRow: string
19
23
  readonly visual: string
24
+ readonly visualStack: string
25
+ readonly reason: string
26
+ readonly error: string
27
+ readonly errorHead: string
20
28
  readonly footer: string
21
29
  readonly rows: string
22
30
  readonly row: string