basalt-ui 2.27.2 → 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 (343) hide show
  1. package/CHANGELOG.md +466 -307
  2. package/MIGRATING.md +358 -12
  3. package/agent/rules/basalt-batteries.md +1 -1
  4. package/agent/rules/basalt-mantine.md +1 -1
  5. package/agent/rules/basalt-tokens.md +2 -2
  6. package/agent/skills/basalt-app/SKILL.md +3 -3
  7. package/agent/skills/basalt-charts/SKILL.md +1 -1
  8. package/agent/skills/basalt-design/SKILL.md +12 -6
  9. package/agent/skills/basalt-design/references/catalogue.md +42 -36
  10. package/agent/skills/basalt-design/references/recipes.md +47 -0
  11. package/agent/skills/basalt-design/references/states.md +1 -1
  12. package/configs/oxlint-basalt.json +2 -1
  13. package/configs/oxlint-plugin.js +112 -3
  14. package/configs/oxlint-plugin.test.ts +99 -4
  15. package/configs/oxlint.json +1 -0
  16. package/dist/agent/chat/thread-message.d.ts +1 -160
  17. package/dist/agent/chat/thread-message.d.ts.map +1 -1
  18. package/dist/agent/chat/thread-message.js +7 -162
  19. package/dist/agent/chat/virtualize.d.ts +5 -5
  20. package/dist/charts/ChartCard.d.ts +14 -7
  21. package/dist/charts/ChartCard.d.ts.map +1 -1
  22. package/dist/charts/ChartCard.js +112 -23
  23. package/dist/charts/Lines.d.ts.map +1 -1
  24. package/dist/charts/Lines.js +11 -4
  25. package/dist/charts/Sparkline.d.ts +14 -2
  26. package/dist/charts/Sparkline.d.ts.map +1 -1
  27. package/dist/charts/Sparkline.js +155 -44
  28. package/dist/charts/chart-box.module.css +59 -2
  29. package/dist/charts/chart-box.module.css.d.ts +5 -0
  30. package/dist/charts/chart-card.module.css +28 -17
  31. package/dist/charts/chart-card.module.css.d.ts +3 -0
  32. package/dist/charts/compile.d.ts +1 -1
  33. package/dist/charts/compile.d.ts.map +1 -1
  34. package/dist/charts/compile.js +38 -27
  35. package/dist/charts/labels.d.ts +13 -3
  36. package/dist/charts/labels.d.ts.map +1 -1
  37. package/dist/charts/labels.js +131 -20
  38. package/dist/charts/legend.d.ts.map +1 -1
  39. package/dist/charts/legend.js +1 -1
  40. package/dist/charts/ref-label.d.ts +37 -8
  41. package/dist/charts/ref-label.d.ts.map +1 -1
  42. package/dist/charts/ref-label.js +55 -10
  43. package/dist/charts/sparkline.module.css +50 -0
  44. package/dist/charts/sparkline.module.css.d.ts +3 -0
  45. package/dist/charts/state.d.ts +4 -4
  46. package/dist/charts/state.d.ts.map +1 -1
  47. package/dist/charts/state.js +23 -5
  48. package/dist/cli/doctor-upgrade.d.ts +11 -0
  49. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  50. package/dist/cli/doctor-upgrade.js +54 -0
  51. package/dist/cli/doctor.d.ts.map +1 -1
  52. package/dist/cli/doctor.js +32 -0
  53. package/dist/cli/help.d.ts.map +1 -1
  54. package/dist/cli/help.js +8 -3
  55. package/dist/cli/index.d.ts +13 -13
  56. package/dist/cli/index.d.ts.map +1 -1
  57. package/dist/cli/index.js +36 -2
  58. package/dist/cli/init.d.ts +6 -0
  59. package/dist/cli/init.d.ts.map +1 -1
  60. package/dist/cli/init.js +118 -27
  61. package/dist/cli/router-wiring.d.ts +3 -0
  62. package/dist/cli/router-wiring.d.ts.map +1 -1
  63. package/dist/cli/router-wiring.js +2 -0
  64. package/dist/cli/shot/capture.d.ts +34 -2
  65. package/dist/cli/shot/capture.d.ts.map +1 -1
  66. package/dist/cli/shot/capture.js +95 -12
  67. package/dist/cli/shot/detect.d.ts +4 -1
  68. package/dist/cli/shot/detect.d.ts.map +1 -1
  69. package/dist/cli/shot/detect.js +38 -16
  70. package/dist/cli/shot/index.d.ts.map +1 -1
  71. package/dist/cli/shot/index.js +9 -2
  72. package/dist/cli/shot/measure.d.ts.map +1 -1
  73. package/dist/cli/shot/measure.js +11 -2
  74. package/dist/cli/shot/types.d.ts +4 -1
  75. package/dist/cli/shot/types.d.ts.map +1 -1
  76. package/dist/cli/sync.d.ts.map +1 -1
  77. package/dist/cli/sync.js +10 -2
  78. package/dist/common/could-not-load.d.ts +13 -0
  79. package/dist/common/could-not-load.d.ts.map +1 -0
  80. package/dist/common/could-not-load.js +14 -0
  81. package/dist/common/empty-copy.d.ts +16 -0
  82. package/dist/common/empty-copy.d.ts.map +1 -0
  83. package/dist/common/empty-copy.js +9 -0
  84. package/dist/common/index.d.ts +1 -0
  85. package/dist/common/index.d.ts.map +1 -1
  86. package/dist/common/index.js +3 -0
  87. package/dist/common/props.d.ts +20 -0
  88. package/dist/common/props.d.ts.map +1 -1
  89. package/dist/common/props.js +13 -1
  90. package/dist/common/retry-button.module.css +7 -3
  91. package/dist/common/virtual-rows.d.ts +196 -0
  92. package/dist/common/virtual-rows.d.ts.map +1 -0
  93. package/dist/common/virtual-rows.js +290 -0
  94. package/dist/controls/controls.module.css +33 -1
  95. package/dist/controls/controls.module.css.d.ts +2 -0
  96. package/dist/controls/enum-filter.d.ts.map +1 -1
  97. package/dist/controls/enum-filter.js +8 -2
  98. package/dist/controls/filter-pill.d.ts +27 -3
  99. package/dist/controls/filter-pill.d.ts.map +1 -1
  100. package/dist/controls/filter-pill.js +15 -4
  101. package/dist/controls/form-layout.d.ts +9 -3
  102. package/dist/controls/form-layout.d.ts.map +1 -1
  103. package/dist/controls/form-layout.js +74 -12
  104. package/dist/controls/form-layout.module.css +112 -7
  105. package/dist/controls/form-layout.module.css.d.ts +1 -0
  106. package/dist/controls/multi-select-filter.d.ts +2 -2
  107. package/dist/controls/multi-select-filter.d.ts.map +1 -1
  108. package/dist/controls/multi-select-filter.js +12 -6
  109. package/dist/controls/range-filter.d.ts +1 -1
  110. package/dist/controls/range-filter.d.ts.map +1 -1
  111. package/dist/controls/range-filter.js +8 -2
  112. package/dist/dashboard/bar-list.d.ts +5 -5
  113. package/dist/dashboard/bar-list.d.ts.map +1 -1
  114. package/dist/dashboard/bar-list.js +15 -8
  115. package/dist/dashboard/bar-list.module.css +21 -5
  116. package/dist/dashboard/board-nav.d.ts +22 -0
  117. package/dist/dashboard/board-nav.d.ts.map +1 -0
  118. package/dist/dashboard/board-nav.js +49 -0
  119. package/dist/dashboard/board.d.ts +52 -0
  120. package/dist/dashboard/board.d.ts.map +1 -0
  121. package/dist/dashboard/board.js +247 -0
  122. package/dist/dashboard/board.module.css +179 -0
  123. package/dist/dashboard/board.module.css.d.ts +28 -0
  124. package/dist/dashboard/empty-state.d.ts +6 -6
  125. package/dist/dashboard/empty-state.d.ts.map +1 -1
  126. package/dist/dashboard/empty-state.js +17 -8
  127. package/dist/dashboard/event-list-model.d.ts +54 -0
  128. package/dist/dashboard/event-list-model.d.ts.map +1 -0
  129. package/dist/dashboard/event-list-model.js +76 -0
  130. package/dist/dashboard/event-list-rows.d.ts +23 -0
  131. package/dist/dashboard/event-list-rows.d.ts.map +1 -0
  132. package/dist/dashboard/event-list-rows.js +89 -0
  133. package/dist/dashboard/event-list-scroll.d.ts +55 -0
  134. package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
  135. package/dist/dashboard/event-list-scroll.js +216 -0
  136. package/dist/dashboard/event-list-skeleton.d.ts +10 -0
  137. package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
  138. package/dist/dashboard/event-list-skeleton.js +34 -0
  139. package/dist/dashboard/event-list.d.ts +65 -0
  140. package/dist/dashboard/event-list.d.ts.map +1 -0
  141. package/dist/dashboard/event-list.js +208 -0
  142. package/dist/dashboard/event-list.module.css +336 -0
  143. package/dist/dashboard/event-list.module.css.d.ts +34 -0
  144. package/dist/dashboard/index.d.ts +2 -0
  145. package/dist/dashboard/index.d.ts.map +1 -1
  146. package/dist/dashboard/index.js +4 -0
  147. package/dist/dashboard/meter-model.d.ts +6 -3
  148. package/dist/dashboard/meter-model.d.ts.map +1 -1
  149. package/dist/dashboard/meter-model.js +9 -4
  150. package/dist/dashboard/meter-parts.d.ts +3 -0
  151. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  152. package/dist/dashboard/meter-parts.js +36 -6
  153. package/dist/dashboard/meter.d.ts +3 -3
  154. package/dist/dashboard/meter.d.ts.map +1 -1
  155. package/dist/dashboard/meter.js +10 -2
  156. package/dist/dashboard/meter.module.css +20 -12
  157. package/dist/dashboard/meter.module.css.d.ts +0 -1
  158. package/dist/dashboard/page-summary.d.ts +3 -3
  159. package/dist/dashboard/page-summary.d.ts.map +1 -1
  160. package/dist/dashboard/page-summary.js +7 -2
  161. package/dist/dashboard/page-summary.module.css +5 -2
  162. package/dist/dashboard/query-state.d.ts +9 -8
  163. package/dist/dashboard/query-state.d.ts.map +1 -1
  164. package/dist/dashboard/query-state.js +29 -11
  165. package/dist/dashboard/section.d.ts +11 -3
  166. package/dist/dashboard/section.d.ts.map +1 -1
  167. package/dist/dashboard/section.js +34 -7
  168. package/dist/dashboard/settings-section.d.ts +8 -5
  169. package/dist/dashboard/settings-section.d.ts.map +1 -1
  170. package/dist/dashboard/settings-section.js +12 -8
  171. package/dist/dashboard/settings-section.module.css +25 -4
  172. package/dist/dashboard/settings-section.module.css.d.ts +1 -0
  173. package/dist/dashboard/stat-card-parts.d.ts +5 -1
  174. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  175. package/dist/dashboard/stat-card-parts.js +8 -3
  176. package/dist/dashboard/stat-card.d.ts +3 -3
  177. package/dist/dashboard/stat-card.d.ts.map +1 -1
  178. package/dist/dashboard/stat-card.js +47 -12
  179. package/dist/dashboard/stat-card.module.css +42 -7
  180. package/dist/dashboard/stat-card.module.css.d.ts +3 -0
  181. package/dist/dashboard/stat-group.d.ts +2 -2
  182. package/dist/dashboard/stat-group.d.ts.map +1 -1
  183. package/dist/dashboard/stat-group.js +10 -3
  184. package/dist/dashboard/stat-strip.d.ts +5 -4
  185. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  186. package/dist/dashboard/stat-strip.js +41 -31
  187. package/dist/dashboard/stat-strip.module.css +8 -6
  188. package/dist/dashboard/visual-slot.d.ts +4 -0
  189. package/dist/dashboard/visual-slot.d.ts.map +1 -1
  190. package/dist/dashboard/visual-slot.js +2 -0
  191. package/dist/dashboard/widget-header.d.ts +6 -6
  192. package/dist/dashboard/widget-header.d.ts.map +1 -1
  193. package/dist/dashboard/widget-header.js +4 -2
  194. package/dist/dashboard/widget-header.module.css +12 -15
  195. package/dist/format/shared.d.ts.map +1 -1
  196. package/dist/format/shared.js +24 -1
  197. package/dist/guard/index.d.ts +1 -1
  198. package/dist/guard/index.d.ts.map +1 -1
  199. package/dist/guard/index.js +4 -1
  200. package/dist/index.d.ts +1 -1
  201. package/dist/index.d.ts.map +1 -1
  202. package/dist/index.js +4 -0
  203. package/dist/shell/app-main.module.css +18 -0
  204. package/dist/styles.css +69 -0
  205. package/dist/surfaces.d.ts +2 -2
  206. package/dist/surfaces.d.ts.map +1 -1
  207. package/dist/surfaces.js +8 -2
  208. package/dist/table/cell-kinds.d.ts +47 -0
  209. package/dist/table/cell-kinds.d.ts.map +1 -0
  210. package/dist/table/cell-kinds.js +180 -0
  211. package/dist/table/cell-kinds.module.css +55 -0
  212. package/dist/table/cell-kinds.module.css.d.ts +15 -0
  213. package/dist/table/data-table-fold.d.ts +155 -0
  214. package/dist/table/data-table-fold.d.ts.map +1 -0
  215. package/dist/table/data-table-fold.js +320 -0
  216. package/dist/table/data-table-state.d.ts +10 -3
  217. package/dist/table/data-table-state.d.ts.map +1 -1
  218. package/dist/table/data-table-state.js +11 -6
  219. package/dist/table/data-table.d.ts +13 -28
  220. package/dist/table/data-table.d.ts.map +1 -1
  221. package/dist/table/data-table.js +362 -255
  222. package/dist/table/data-table.module.css +282 -3
  223. package/dist/table/data-table.module.css.d.ts +16 -0
  224. package/dist/table/table-features.d.ts +34 -4
  225. package/dist/table/table-features.d.ts.map +1 -1
  226. package/dist/table/table-features.js +10 -0
  227. package/dist/theme/card-inset.module.css +35 -0
  228. package/dist/theme/controls.module.css +55 -2
  229. package/dist/theme/ctl-theme.d.ts.map +1 -1
  230. package/dist/theme/ctl-theme.js +5 -0
  231. package/dist/theme/index.d.ts.map +1 -1
  232. package/dist/theme/index.js +14 -10
  233. package/dist/tokens/core.d.ts +1 -0
  234. package/dist/tokens/core.d.ts.map +1 -1
  235. package/dist/tokens/core.js +1 -0
  236. package/dist/tokens/derive.js +1 -1
  237. package/dist/tokens/palette.d.ts +2 -1
  238. package/dist/tokens/palette.d.ts.map +1 -1
  239. package/llms.txt +295 -5
  240. package/package.json +1 -1
  241. package/src/agent/chat/thread-message.tsx +10 -403
  242. package/src/agent/chat/virtualize.ts +5 -5
  243. package/src/charts/ChartCard.tsx +175 -31
  244. package/src/charts/Lines.tsx +13 -4
  245. package/src/charts/Sparkline.tsx +213 -48
  246. package/src/charts/chart-box.module.css +59 -2
  247. package/src/charts/chart-box.module.css.d.ts +5 -0
  248. package/src/charts/chart-card.module.css +28 -17
  249. package/src/charts/chart-card.module.css.d.ts +3 -0
  250. package/src/charts/compile.ts +59 -33
  251. package/src/charts/labels.ts +175 -24
  252. package/src/charts/legend.tsx +3 -2
  253. package/src/charts/ref-label.ts +114 -18
  254. package/src/charts/sparkline.module.css +50 -0
  255. package/src/charts/sparkline.module.css.d.ts +3 -0
  256. package/src/charts/state.tsx +40 -10
  257. package/src/cli/doctor-upgrade.ts +75 -0
  258. package/src/cli/doctor.ts +36 -0
  259. package/src/cli/help.ts +16 -6
  260. package/src/cli/index.ts +73 -67
  261. package/src/cli/init.ts +157 -36
  262. package/src/cli/router-wiring.ts +2 -2
  263. package/src/cli/shot/capture.ts +138 -16
  264. package/src/cli/shot/detect.ts +46 -22
  265. package/src/cli/shot/index.ts +8 -2
  266. package/src/cli/shot/measure.ts +11 -2
  267. package/src/cli/shot/types.ts +4 -1
  268. package/src/cli/sync.ts +12 -2
  269. package/src/common/could-not-load.ts +22 -0
  270. package/src/common/empty-copy.ts +17 -0
  271. package/src/common/index.ts +1 -0
  272. package/src/common/props.ts +30 -0
  273. package/src/common/retry-button.module.css +7 -3
  274. package/src/common/virtual-rows.tsx +682 -0
  275. package/src/controls/controls.module.css +33 -1
  276. package/src/controls/controls.module.css.d.ts +2 -0
  277. package/src/controls/enum-filter.tsx +8 -2
  278. package/src/controls/filter-pill.tsx +80 -27
  279. package/src/controls/form-layout.module.css +112 -7
  280. package/src/controls/form-layout.module.css.d.ts +1 -0
  281. package/src/controls/form-layout.tsx +115 -22
  282. package/src/controls/multi-select-filter.tsx +22 -11
  283. package/src/controls/range-filter.tsx +9 -3
  284. package/src/dashboard/bar-list.module.css +21 -5
  285. package/src/dashboard/bar-list.tsx +53 -45
  286. package/src/dashboard/board-nav.ts +67 -0
  287. package/src/dashboard/board.module.css +179 -0
  288. package/src/dashboard/board.module.css.d.ts +28 -0
  289. package/src/dashboard/board.tsx +415 -0
  290. package/src/dashboard/empty-state.tsx +21 -11
  291. package/src/dashboard/event-list-model.ts +125 -0
  292. package/src/dashboard/event-list-rows.tsx +117 -0
  293. package/src/dashboard/event-list-scroll.ts +291 -0
  294. package/src/dashboard/event-list-skeleton.tsx +62 -0
  295. package/src/dashboard/event-list.module.css +336 -0
  296. package/src/dashboard/event-list.module.css.d.ts +34 -0
  297. package/src/dashboard/event-list.tsx +336 -0
  298. package/src/dashboard/index.ts +2 -0
  299. package/src/dashboard/meter-model.ts +16 -7
  300. package/src/dashboard/meter-parts.tsx +53 -14
  301. package/src/dashboard/meter.module.css +20 -12
  302. package/src/dashboard/meter.module.css.d.ts +0 -1
  303. package/src/dashboard/meter.tsx +36 -18
  304. package/src/dashboard/page-summary.module.css +5 -2
  305. package/src/dashboard/page-summary.tsx +13 -6
  306. package/src/dashboard/query-state.tsx +55 -30
  307. package/src/dashboard/section.tsx +83 -41
  308. package/src/dashboard/settings-section.module.css +25 -4
  309. package/src/dashboard/settings-section.module.css.d.ts +1 -0
  310. package/src/dashboard/settings-section.tsx +18 -8
  311. package/src/dashboard/stat-card-parts.tsx +20 -3
  312. package/src/dashboard/stat-card.module.css +42 -7
  313. package/src/dashboard/stat-card.module.css.d.ts +3 -0
  314. package/src/dashboard/stat-card.tsx +55 -13
  315. package/src/dashboard/stat-group.tsx +22 -14
  316. package/src/dashboard/stat-strip.module.css +8 -6
  317. package/src/dashboard/stat-strip.tsx +29 -20
  318. package/src/dashboard/visual-slot.ts +5 -0
  319. package/src/dashboard/widget-header.module.css +12 -15
  320. package/src/dashboard/widget-header.tsx +8 -5
  321. package/src/format/shared.ts +30 -1
  322. package/src/guard/index.ts +7 -1
  323. package/src/index.ts +4 -0
  324. package/src/shell/app-main.module.css +18 -0
  325. package/src/styles.css +69 -0
  326. package/src/surfaces.ts +7 -1
  327. package/src/table/cell-kinds.module.css +55 -0
  328. package/src/table/cell-kinds.module.css.d.ts +15 -0
  329. package/src/table/cell-kinds.tsx +263 -0
  330. package/src/table/data-table-fold.tsx +567 -0
  331. package/src/table/data-table-state.ts +24 -13
  332. package/src/table/data-table.module.css +282 -3
  333. package/src/table/data-table.module.css.d.ts +16 -0
  334. package/src/table/data-table.tsx +430 -362
  335. package/src/table/table-features.ts +44 -4
  336. package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
  337. package/src/theme/card-inset.module.css +35 -0
  338. package/src/theme/controls.module.css +55 -2
  339. package/src/theme/ctl-theme.tsx +8 -0
  340. package/src/theme/index.ts +12 -8
  341. package/src/tokens/core.ts +1 -0
  342. package/src/tokens/derive.ts +1 -1
  343. package/src/tokens/palette.ts +4 -1
@@ -10,3 +10,5 @@ export { SettingsSection, SettingsRow, DangerZone } from './settings-section'
10
10
  export { Meter, type MeterProps } from './meter'
11
11
  export type { MeterSegment, MeterTick, MeterZone } from './meter-model'
12
12
  export { BarList, type BarListProps } from './bar-list'
13
+ export { EventList, type EventListProps } from './event-list'
14
+ export { Board, type BoardProps } from './board'
@@ -10,8 +10,9 @@ export type MeterSegment = {
10
10
  label: string
11
11
  color?: string
12
12
  /**
13
- * `'muted'`: the part takes the one flat muted fill every muted part shares, a hairline seam
14
- * between neighbours (never a lightness step). A `color` wins.
13
+ * `'muted'`: the part takes the one flat muted fill every muted part shares, a visible 2px
14
+ * separator between neighbours (never a lightness step). A `color` wins. Give each categorical part its own
15
+ * series `color`; `muted` is for a tail "other" part, and a bar of only muted parts reads as one slab.
15
16
  */
16
17
  tone?: 'muted'
17
18
  forecast?: boolean
@@ -87,7 +88,7 @@ export type Part = {
87
88
  readonly size: number
88
89
  readonly color: string | undefined
89
90
  readonly forecast: boolean
90
- /** A muted part right after another muted part: a hairline seam keeps the shared fill apart. */
91
+ /** A categorical part right after another: a 2px separator (not a hairline) keeps neighbours, muted ones included, apart. */
91
92
  readonly seam: boolean
92
93
  readonly label: string
93
94
  /** The segment's own (normalised) amount, in the reading's units — what its caption states. */
@@ -205,11 +206,18 @@ export function normalizeSegments(segments: readonly MeterSegment[]): MeterSegme
205
206
  return segments.map((s) => ({ ...s, value: Number.isFinite(s.value) ? Math.max(0, s.value) : 0 }))
206
207
  }
207
208
 
209
+ const isMuted = (s: MeterSegment) => s.tone === 'muted' && s.color === undefined && !s.forecast
210
+
211
+ /** Three or more categorical parts that all take the one muted fill read as a single slab. */
212
+ export function allPartsMuted(segments: readonly MeterSegment[]): boolean {
213
+ const parts = segments.filter((s) => s.forecast !== true)
214
+ return parts.length >= 3 && parts.every(isMuted)
215
+ }
216
+
208
217
  /** Segment amounts (already normalised) accumulate from `min`; a part never passes the track end. */
209
218
  export function layoutSegments(segments: readonly MeterSegment[], span: number): Part[] {
210
219
  let cursor = 0
211
- const isMuted = (s: MeterSegment) => s.tone === 'muted' && s.color === undefined && !s.forecast
212
- let prevMuted = false
220
+ let prevCategorical = false
213
221
  return segments.map((s) => {
214
222
  const size = Math.max(0, Math.min(clamp01(s.value / span), 1 - cursor))
215
223
  const forecast = s.forecast === true
@@ -219,12 +227,13 @@ export function layoutSegments(segments: readonly MeterSegment[], span: number):
219
227
  size,
220
228
  color: forecast ? undefined : isMuted(s) ? mutedFill(MUTED_PART) : s.color,
221
229
  forecast,
222
- seam: isMuted(s) && prevMuted,
230
+ seam: !forecast && prevCategorical,
223
231
  label: s.label,
224
232
  amount: s.value,
225
233
  }
226
234
  cursor += size
227
- prevMuted = isMuted(s)
235
+ // A zero-size part has no visible edge: the next part has no neighbour to be separated from.
236
+ if (size > 0) prevCategorical = !forecast
228
237
  return part
229
238
  })
230
239
  }
@@ -3,7 +3,9 @@ import { Skeleton, VisuallyHidden } from '@mantine/core'
3
3
  import { useContext, useId, useRef, useState } from 'react'
4
4
  import type { CSSProperties, ReactNode, RefObject } from 'react'
5
5
  import { useIsomorphicLayoutEffect } from '../common/isomorphic-layout-effect'
6
+ import { splitEmptyCopy } from '../common/empty-copy'
6
7
  import { cx } from '../common/props'
8
+ import type { DataAttributes } from '../common/props'
7
9
  import {
8
10
  ariaValues,
9
11
  modelBar,
@@ -30,6 +32,7 @@ import type {
30
32
  ZoneLabel,
31
33
  } from './meter-model'
32
34
  import classes from './meter.module.css'
35
+ import { EmptyState } from './empty-state'
33
36
  import { VisualSlotContext } from './visual-slot'
34
37
  import { toPct } from './scale'
35
38
 
@@ -38,6 +41,8 @@ export type Shell = {
38
41
  style: CSSProperties | undefined
39
42
  /** `size="row"`: one text line tall, no caption rows. */
40
43
  row: boolean
44
+ /** The consumer's `data-*` (`data-shot`), on the root of every state. */
45
+ data: DataAttributes
41
46
  }
42
47
 
43
48
  /**
@@ -46,6 +51,7 @@ export type Shell = {
46
51
  */
47
52
  function rootProps(shell: Shell) {
48
53
  return {
54
+ ...shell.data,
49
55
  className: cx(classes.root, shell.row && classes.row, shell.className),
50
56
  style: shell.style,
51
57
  'data-basalt-meter': '',
@@ -160,6 +166,21 @@ export function MeterEmpty(props: {
160
166
  shell: Shell
161
167
  }) {
162
168
  const { label, text, ring, zoned, shell } = props
169
+ // A host that states its gap (non-blank `text`) gets the one empty box `BarList` and `EventList` draw: no
170
+ // track, no ring, the same `EmptyState` tile.
171
+ if (text !== undefined && text.trim() !== '') {
172
+ const copy = splitEmptyCopy(text)
173
+ return (
174
+ // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a polite live region named by the Meter's label; `<output>` cannot hold the tile's block content
175
+ <div {...rootProps(shell)} role="status" aria-label={label}>
176
+ <EmptyState
177
+ tier="section"
178
+ title={copy.title}
179
+ {...(copy.description !== undefined && { description: copy.description })}
180
+ />
181
+ </div>
182
+ )
183
+ }
163
184
  // The ring has a reading slot (its centre), so the dash sits there as the reading. A bar states its
164
185
  // gap once, and only if the host says so (`text`): otherwise the caption rows a loaded Meter would
165
186
  // have stay blank, so the muted track keeps the loaded height without a dash under it.
@@ -178,15 +199,11 @@ export function MeterEmpty(props: {
178
199
  </div>
179
200
  </>
180
201
  )}
181
- {text !== undefined ? (
182
- <span className={classes.empty}>{text}</span>
183
- ) : (
184
- !ring && (
185
- <>
186
- <VisuallyHidden className={classes.summary}>No reading</VisuallyHidden>
187
- {!shell.row && <Line zoned={zoned} />}
188
- </>
189
- )
202
+ {!ring && (
203
+ <>
204
+ <VisuallyHidden className={classes.summary}>No reading</VisuallyHidden>
205
+ {!shell.row && <Line zoned={zoned} />}
206
+ </>
190
207
  )}
191
208
  </output>
192
209
  )
@@ -774,6 +791,9 @@ export function MeterBar(props: {
774
791
  ...labelled,
775
792
  ]
776
793
  const zoneLabels = compact ? [] : model.zoneLabels
794
+ // With no zone names to own the row below the track, the marker's reading shares the caption row
795
+ // with the end caption (both on one line when they fit), centred on the marker like ZoneReading.
796
+ const readingInRow = anchored && zoneLabels.length === 0
777
797
  // On a zoned track the zone names own the row below; the figures at its two ends sit above the
778
798
  // track, where nothing else competes for them. Every other tick label stays with the names.
779
799
  const isEnd = (t: TickMark) => t.pct <= 0 || t.pct >= 100
@@ -790,13 +810,19 @@ export function MeterBar(props: {
790
810
  const items: CaptionItem[] = compact
791
811
  ? []
792
812
  : [
793
- ...(start !== null && !anchored
813
+ ...(start !== null && (!anchored || readingInRow)
794
814
  ? [
795
815
  {
796
816
  key: 'start',
797
817
  node: glue(start),
818
+ // `readingAt="start"` labels the track's start edge ("60-day low"), not the reading: it stays
819
+ // at the edge instead of sitting centred under the reading tick as if it were its caption.
820
+ ...(readingInRow &&
821
+ props.readingAt !== 'start' &&
822
+ model.markerPct !== undefined && { pct: model.markerPct }),
798
823
  // The reading sits at its fill's end (clamped inside the track); `readingAt="start"` keeps the old start edge.
799
824
  ...(props.readingAt !== 'start' &&
825
+ !readingInRow &&
800
826
  model.fillEndPct !== undefined && {
801
827
  pct: model.fillEndPct,
802
828
  align: 'end' as const,
@@ -810,8 +836,9 @@ export function MeterBar(props: {
810
836
  key: 'forecast',
811
837
  node: glue(model.forecastText),
812
838
  drop: 2,
813
- // The reading ends at the boundary, the forecast ends where its fill does.
814
- // If that collides, it falls back to starting at the boundary before it drops.
839
+ // The reading ends at the boundary, the forecast ends where its fill does (a tick
840
+ // marks that end). If that would cover the reading, it falls back to starting at the
841
+ // boundary before it drops.
815
842
  ...(props.readingAt !== 'start' && model.forecastEndPct !== undefined
816
843
  ? {
817
844
  pct: model.forecastEndPct,
@@ -925,6 +952,16 @@ export function MeterBar(props: {
925
952
  <>
926
953
  <Tick kind="marker" className={classes.marker} pct={model.markerPct} />
927
954
  <Tick kind="boundary" className={classes.boundaryTick} pct={model.boundaryPct} />
955
+ {/* At the track end the track itself marks the forecast end. */}
956
+ <Tick
957
+ kind="forecastEnd"
958
+ className={classes.boundaryTick}
959
+ pct={
960
+ model.forecastEndPct !== undefined && model.forecastEndPct < 100
961
+ ? model.forecastEndPct
962
+ : undefined
963
+ }
964
+ />
928
965
  {model.ticks.map((t) => (
929
966
  <Tick key={t.key} kind="tick" className={classes.tick} pct={t.pct} />
930
967
  ))}
@@ -933,7 +970,9 @@ export function MeterBar(props: {
933
970
  )}
934
971
  </div>
935
972
  {zoneLabels.length > 0 && <LabelRow zones={zoneLabels} ticks={belowTicks} />}
936
- {anchored && quiet(<ZoneReading pct={model.markerPct ?? 0}>{start}</ZoneReading>)}
973
+ {anchored &&
974
+ !readingInRow &&
975
+ quiet(<ZoneReading pct={model.markerPct ?? 0}>{start}</ZoneReading>)}
937
976
  {!loading && model.describedByText !== null && (
938
977
  <VisuallyHidden id={describedId} className={classes.summary}>
939
978
  {model.describedByText}
@@ -958,7 +997,7 @@ function tickPosition(kind: TickKind, pct: number): CSSProperties {
958
997
  return { insetInlineStart: `calc(100% - ${TICK_WIDTH})`, marginInlineStart: 0 }
959
998
  }
960
999
 
961
- type TickKind = 'marker' | 'boundary' | 'target' | 'tick'
1000
+ type TickKind = 'marker' | 'boundary' | 'forecastEnd' | 'target' | 'tick'
962
1001
 
963
1002
  function Tick({
964
1003
  kind,
@@ -14,6 +14,12 @@
14
14
  --basalt-meter-caption: var(--vx-text-micro);
15
15
  }
16
16
 
17
+ /* A bar fills its container's width: as a flex item (a StatCard visual, a strip cell) it would
18
+ * otherwise size to its captions and stop part-way across the card. */
19
+ .root:has(> .trackBox) {
20
+ inline-size: 100%;
21
+ }
22
+
17
23
  .track {
18
24
  position: relative;
19
25
  display: flex;
@@ -62,10 +68,10 @@
62
68
  background: color-mix(in srgb, var(--vx-muted) 65%, transparent);
63
69
  }
64
70
 
65
- /* Muted parts share one flat fill: a track-coloured hairline at the shared edge tells them apart. */
71
+ /* Adjacent categorical parts (muted ones share one fill): a track-coloured gap, not a hairline, tells them apart. */
66
72
  .fill[data-meter-seam] {
67
73
  box-sizing: border-box;
68
- border-inline-start: 1px solid var(--vx-surface-subtle);
74
+ border-inline-start: 2px solid var(--vx-surface-subtle);
69
75
  }
70
76
 
71
77
  /* The committed/forecast pair: the same neutral at two strengths. Flat, never hatched. */
@@ -142,7 +148,8 @@
142
148
  --basalt-reading-dir: 1;
143
149
  position: relative;
144
150
  height: 1.25em;
145
- overflow: clip;
151
+ /* Clipped along the row only: a descender hangs below the 1.25em box of a taller caption line. */
152
+ overflow-x: clip;
146
153
  font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
147
154
  font-variant-numeric: lining-nums;
148
155
  font-size: var(--basalt-meter-caption);
@@ -167,7 +174,11 @@
167
174
  translate: none;
168
175
  }
169
176
 
170
- /* The reading on a zone track: a notch standing proud of the bands, in ink. */
177
+ /*
178
+ * The reading on a zone track: a notch standing proud of the bands. A panel core in an ink ring, so
179
+ * one of the two always contrasts with the fill under it: the core on an ink fill, the ring on a
180
+ * light one (an ink core on an ink track vanished).
181
+ */
171
182
  .marker {
172
183
  position: absolute;
173
184
  top: -3px;
@@ -175,7 +186,8 @@
175
186
  width: 3px;
176
187
  margin-inline-start: -1.5px;
177
188
  border-radius: var(--vx-radius-fine);
178
- background: var(--vx-ink);
189
+ background: var(--vx-surface-panel);
190
+ box-shadow: 0 0 0 1.5px var(--vx-ink);
179
191
  }
180
192
 
181
193
  .tick {
@@ -186,8 +198,9 @@
186
198
  margin-inline-start: -1px;
187
199
  border-radius: var(--vx-radius-fine);
188
200
  background: var(--vx-ink);
189
- /* A track-coloured halo keeps an ink tick readable on a fill that is itself near-ink (dark). */
190
- box-shadow: 0 0 0 1px var(--vx-surface-subtle);
201
+ /* A panel-coloured 2px halo (the opposite pole of ink in both schemes) keeps the tick readable on
202
+ * a fill that is itself near-ink: `tone="ink"`, or --vx-line in dark. */
203
+ box-shadow: 0 0 0 2px var(--vx-surface-panel);
191
204
  }
192
205
 
193
206
  .boundaryTick {
@@ -323,11 +336,6 @@
323
336
  border-radius: var(--vx-radius-fine);
324
337
  }
325
338
 
326
- .empty {
327
- font-size: var(--basalt-meter-caption);
328
- color: var(--vx-muted);
329
- }
330
-
331
339
  /* One caption-height line: a blank caption row of an empty Meter, so it stands at the loaded height. */
332
340
  .line {
333
341
  display: flex;
@@ -31,7 +31,6 @@ declare const classes: {
31
31
  readonly partCaptionsWrap: string
32
32
  readonly partCaptionsGrid: string
33
33
  readonly swatch: string
34
- readonly empty: string
35
34
  readonly line: string
36
35
  readonly lineZoned: string
37
36
  readonly hold: string
@@ -24,7 +24,16 @@
24
24
  *
25
25
  * Categorical `segments` (no `forecast` part) are captioned one per part — swatch, name, value — under
26
26
  * the track and the default start caption is dropped (an explicit `startCaption` still shows);
27
- * committed/forecast keeps the reading plus the forecast caption.
27
+ * committed/forecast keeps the reading plus the forecast caption. The reading is captioned at the
28
+ * committed fill's end and the forecast at the forecast's end, which a tick marks (none when it
29
+ * reaches the track end); the forecast caption drops before it ever sits under the boundary tick.
30
+ * Adjacent categorical parts are separated by a 2px separator, muted ones included; give each part its own
31
+ * series colour (`tone="muted"` is for a tail "other" part — a bar of only muted parts warns once in
32
+ * development).
33
+ *
34
+ * Captions keep at least a gap step between them at any width: at
35
+ * narrow widths the lower-priority ones drop first (tick captions, then the forecast), and what is
36
+ * dropped stays in the described-by text. A bar fills its container's width.
28
37
  *
29
38
  * @example
30
39
  * import { Meter } from 'basalt-ui'
@@ -53,28 +62,31 @@
53
62
  */
54
63
  import { useContext } from 'react'
55
64
  import type { ReactNode } from 'react'
56
- import type { BasaltProps } from '../common/props'
65
+ import { pickDataAttributes } from '../common/props'
66
+ import type { BasaltProps, DataAttributes } from '../common/props'
57
67
  import { VX } from '../tokens'
58
- import { isReading, normalizeSegments, segmentReading, spanOf } from './meter-model'
68
+ import { reportOnce } from '../common/validate'
69
+ import { allPartsMuted, isReading, normalizeSegments, segmentReading, spanOf } from './meter-model'
59
70
  import type { MeterSegment, MeterTick, MeterZone } from './meter-model'
60
71
  import { MeterBar, MeterEmpty, MeterRing, MeterRingLoading } from './meter-parts'
61
72
  import { asText } from './scale'
62
73
  import { VisualSlotContext } from './visual-slot'
63
74
 
64
- type Common = BasaltProps & {
65
- /** Accessible name (`aria-label`). Required: a meter without one is announced as a bare number. */
66
- label: string
67
- /** Track start. Default 0. */
68
- min?: number
69
- /** Track end. Default 100. */
70
- max?: number
71
- /** Formats values in captions and the accessible text. Default: the number as written. */
72
- format?: (value: number) => string
73
- /** Renders a skeleton with the meter's footprint. */
74
- loading?: boolean
75
- /** Muted line shown when there is no reading; none by default (the muted track stands alone, caption rows blank). */
76
- emptyText?: string
77
- }
75
+ type Common = BasaltProps &
76
+ DataAttributes & {
77
+ /** Accessible name (`aria-label`). Required: a meter without one is announced as a bare number. */
78
+ label: string
79
+ /** Track start. Default 0. */
80
+ min?: number
81
+ /** Track end. Default 100. */
82
+ max?: number
83
+ /** Formats values in captions and the accessible text. Default: the number as written. */
84
+ format?: (value: number) => string
85
+ /** Renders a skeleton with the meter's footprint. */
86
+ loading?: boolean
87
+ /** The empty box shown when there is no reading (the same `EmptyState` tile `BarList` and `EventList` draw, no track; the first sentence is its title, the rest its muted line). None by default: the muted track stands alone, caption rows blank. */
88
+ emptyText?: string
89
+ }
78
90
 
79
91
  type BarCommon = Common & {
80
92
  shape?: 'bar'
@@ -222,7 +234,7 @@ function barTone(tone: 'muted' | 'ink' | undefined, plain: boolean): 'muted' | u
222
234
  export function Meter(props: MeterProps) {
223
235
  const { label, min = 0, max = 100, format = asText, className, style } = props
224
236
  const row = props.size === 'row'
225
- const shell = { className, style, row }
237
+ const shell = { className, style, row, data: pickDataAttributes(props) }
226
238
  const ring = props.shape === 'ring'
227
239
  warnInvalidTrack(min, max)
228
240
  const host = useContext(VisualSlotContext)
@@ -238,6 +250,12 @@ export function Meter(props: MeterProps) {
238
250
  props.segments === undefined || (loading && props.segments.length === 0)
239
251
  ? undefined
240
252
  : normalizeSegments(props.segments)
253
+ if (segments !== undefined && allPartsMuted(segments)) {
254
+ reportOnce(
255
+ 'Meter',
256
+ '[basalt] Meter: every segment is tone="muted", so the parts read as one slab; give each part its own series colour (muted is for a tail "other" part)',
257
+ )
258
+ }
241
259
  const placeholder =
242
260
  props.zones !== undefined && props.zones.length > 0 ? min + spanOf(min, max).span / 2 : min
243
261
  const reading = loading
@@ -9,11 +9,14 @@
9
9
  min-width: 0;
10
10
  }
11
11
 
12
+ /* The aside sits right after the sentence it dates and wraps under it when the line is full — never
13
+ * pinned to the far edge, where it read as belonging to nothing. */
12
14
  .top {
13
15
  display: flex;
16
+ flex-wrap: wrap;
14
17
  align-items: baseline;
15
- justify-content: space-between;
16
- gap: var(--vx-space-stack-md);
18
+ column-gap: var(--vx-space-stack-md);
19
+ row-gap: var(--vx-space-stack-xs);
17
20
  min-width: 0;
18
21
  }
19
22
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * PageSummary — a page's opening (docs/waves/design-parity/SPEC.md § 6.9): one headline sentence
3
3
  * that carries at least one live number, an optional facts line under it, and an optional `aside`
4
- * right of the headline. It renders an `h2` at the `h1` type step (head face, −0.02em): the page's own
4
+ * after the headline (beside it, wrapping under it when the line is full). It renders an `h2` at the `h1` type step (head face, −0.02em): the page's own
5
5
  * h1 is the shell breadcrumb's / `PageTitle`'s, and a second one would split the outline. The facts
6
6
  * are the proportional sans at `xs`, muted, `·`-separated — a time fact may take mono itself, the line does
7
7
  * not (D33).
@@ -32,8 +32,8 @@
32
32
  */
33
33
  import { Skeleton } from '@mantine/core'
34
34
  import type { ReactNode } from 'react'
35
- import { cx } from '../common/props'
36
- import type { BasaltProps } from '../common/props'
35
+ import { cx, pickDataAttributes } from '../common/props'
36
+ import type { BasaltProps, DataAttributes } from '../common/props'
37
37
  import classes from './page-summary.module.css'
38
38
 
39
39
  type Fact = ReactNode | null | false | undefined
@@ -43,7 +43,7 @@ type PageSummaryContent = {
43
43
  sentence: ReactNode
44
44
  /** Short facts under the headline, e.g. `['3 need you', oldest && `oldest ${oldest}`]`. */
45
45
  facts?: readonly Fact[]
46
- /** Right of the headline: a date or a freshness word. */
46
+ /** After the headline: a date or a freshness word. */
47
47
  aside?: ReactNode
48
48
  loading?: false
49
49
  }
@@ -51,7 +51,9 @@ type PageSummaryContent = {
51
51
  /** While the sentence's data loads: a skeleton of the same shape, no content props needed. */
52
52
  type PageSummaryLoading = Partial<Omit<PageSummaryContent, 'loading'>> & { loading: true }
53
53
 
54
- export type PageSummaryProps = BasaltProps & (PageSummaryContent | PageSummaryLoading)
54
+ export type PageSummaryProps = BasaltProps &
55
+ DataAttributes &
56
+ (PageSummaryContent | PageSummaryLoading)
55
57
 
56
58
  const NO_FACTS: readonly Fact[] = []
57
59
 
@@ -60,7 +62,12 @@ const isShown = (fact: Fact): boolean =>
60
62
 
61
63
  export function PageSummary(props: PageSummaryProps) {
62
64
  const { className, style } = props
63
- const common = { className: cx(classes.root, className), 'data-page-summary': '', style }
65
+ const common = {
66
+ ...pickDataAttributes(props),
67
+ className: cx(classes.root, className),
68
+ 'data-page-summary': '',
69
+ style,
70
+ }
64
71
 
65
72
  if (props.loading === true) {
66
73
  return (