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
@@ -69,6 +69,8 @@
69
69
  .label {
70
70
  position: relative;
71
71
  min-width: 0;
72
+ /* A name truncates before it touches the value, whatever the column gap. */
73
+ padding-inline-end: var(--vx-space-stack-md, 0.75rem);
72
74
  overflow: hidden;
73
75
  text-overflow: ellipsis;
74
76
  white-space: nowrap;
@@ -231,10 +233,26 @@
231
233
  }
232
234
 
233
235
  /*
234
- * A column of DeltaBadges: glyph and figure are ONE unit, end-aligned as a whole, so the glyph never drifts
235
- * from its figure however wide the column ("▲ 9%" and "▲13%" share their right edge and keep the badge's own
236
- * gap). Tabular figures keep the right edges even (D33: only in a table-like column, not a hero metric).
236
+ * A column of DeltaBadges is a start-aligned two-track grid: the glyph track, then the figure. Every
237
+ * glyph shares one x and sits one fixed gap from its own figure ("▲ 9%" and "▲ 13%" alike); the
238
+ * figures are ragged on the right. End-aligning them in a fixed-width track kept the right edge but
239
+ * left a digit-wide hole between a short figure and its glyph (about 8px, Wave 50 S4).
237
240
  */
238
241
  .secondary [data-delta] {
242
+ /* A block that hugs its content and sits on the cell's start, whatever the cell's `text-align`, so
243
+ * every glyph shares one x. */
244
+ display: grid;
245
+ width: max-content;
246
+ margin-inline-end: auto;
247
+ grid-auto-flow: column;
248
+ grid-template-columns: auto auto;
249
+ justify-items: start;
239
250
  font-variant-numeric: tabular-nums;
251
+ /* The row's line box, not the badge's own `line-height: 1`: its baseline then sits on the value's. */
252
+ line-height: inherit;
253
+ }
254
+
255
+ /* A zero delta has no glyph: its figure is the only track. */
256
+ .secondary [data-delta]:not(:has([data-delta-glyph])) {
257
+ grid-template-columns: auto;
240
258
  }
@@ -18,9 +18,10 @@
18
18
  * the one scale, so a name stays beside its value and a full-scale bar ends at the track end.
19
19
  *
20
20
  * The secondary column aligns by content (override: `secondaryAlign`): a text secondary (a status word,
21
- * `StatusVerdict`/`StatusDot`) starts on one x so the dots line up; figures ("41%", "+€7"), numbers and a
22
- * `DeltaBadge` end. A delta column also gets a fixed-width glyph slot and a tabular figure slot, so the
23
- * glyphs AND the figures' right edges line up (a column of deltas is table-like, D33 allows tabular there).
21
+ * `StatusVerdict`/`StatusDot`) starts on one x so the dots line up; figures ("41%", "+€7") and numbers
22
+ * end. A `DeltaBadge` starts on one x too: a glyph track, then the figure, so every glyph shares an x and
23
+ * sits one fixed gap from its own figure; the figures are ragged on the right (a column of deltas is
24
+ * table-like, D33 allows tabular there).
24
25
  *
25
26
  * Colour law: bars are neutral. `accentLeader` (opt-in) lets the top row take the accent — the
26
27
  * leader bar, and nothing else. Each value is rendered as text, never only a bar length.
@@ -49,11 +50,12 @@ import { Skeleton, VisuallyHidden } from '@mantine/core'
49
50
  import { EmptyState } from './empty-state'
50
51
  import { isValidElement } from 'react'
51
52
  import type { ReactNode } from 'react'
52
- import { cx } from '../common/props'
53
- import type { BasaltProps } from '../common/props'
53
+ import { cx, pickDataAttributes } from '../common/props'
54
+ import type { BasaltProps, DataAttributes } from '../common/props'
54
55
  import classes from './bar-list.module.css'
55
56
  import { StatusDot } from '../theme/status-dot'
56
57
  import { StatusVerdict } from '../theme/status-verdict'
58
+ import { skeletonRowCount } from './event-list-model'
57
59
  import { asText, barPercent } from './scale'
58
60
 
59
61
  type BarListItem = {
@@ -69,37 +71,38 @@ type BarListItem = {
69
71
  tickLabel?: string
70
72
  }
71
73
 
72
- export type BarListProps = BasaltProps & {
73
- /** Accessible name of the list. Required. */
74
- label: string
75
- /** Rows in display order (sort them yourself; the list does not reorder). */
76
- items: readonly BarListItem[]
77
- /**
78
- * Formats each number. `part` is `'max'` for a row's denominator, `'value'` otherwise (the value and
79
- * the tick), so a unit can sit on one side only: `'32 / 40 pts'`. Default: the number as written.
80
- */
81
- format?: (value: number, part: 'value' | 'max') => string
82
- /** Scale end shared by rows without their own `max`. Default: the largest of those rows' values. */
83
- max?: number
84
- /**
85
- * `thin` (default): label on its own line above a thin bar, value right-aligned on that line.
86
- * `inline`: the label sits inside a heavier track, the value outside it.
87
- */
88
- variant?: 'thin' | 'inline'
89
- /** The first row's bar takes the accent. Off by default. */
90
- accentLeader?: boolean
91
- /**
92
- * Which edge the secondary column aligns to. Default: by content — text (a status word, a status
93
- * mark) starts, figures and other elements end.
94
- */
95
- secondaryAlign?: 'start' | 'end'
96
- /** Renders row-shaped skeletons. */
97
- loading?: boolean
98
- /** Skeleton rows while loading. Default 5. */
99
- loadingRows?: number
100
- /** Title of the `EmptyState` tile shown when `items` is empty. Default "No items to compare yet"; pass the cause for your list. */
101
- emptyText?: string
102
- }
74
+ export type BarListProps = BasaltProps &
75
+ DataAttributes & {
76
+ /** Accessible name of the list. Required. */
77
+ label: string
78
+ /** Rows in display order (sort them yourself; the list does not reorder). */
79
+ items: readonly BarListItem[]
80
+ /**
81
+ * Formats each number. `part` is `'max'` for a row's denominator, `'value'` otherwise (the value and
82
+ * the tick), so a unit can sit on one side only: `'32 / 40 pts'`. Default: the number as written.
83
+ */
84
+ format?: (value: number, part: 'value' | 'max') => string
85
+ /** Scale end shared by rows without their own `max`. Default: the largest of those rows' values. */
86
+ max?: number
87
+ /**
88
+ * `thin` (default): label on its own line above a thin bar, value right-aligned on that line.
89
+ * `inline`: the label sits inside a heavier track, the value outside it.
90
+ */
91
+ variant?: 'thin' | 'inline'
92
+ /** The first row's bar takes the accent. Off by default. */
93
+ accentLeader?: boolean
94
+ /**
95
+ * Which edge the secondary column aligns to. Default: by content — text (a status word, a status
96
+ * mark) starts, figures and other elements end.
97
+ */
98
+ secondaryAlign?: 'start' | 'end'
99
+ /** Renders row-shaped skeletons. */
100
+ loading?: boolean
101
+ /** Skeleton rows while loading. Default: the rows `items` holds now (a refetch, capped at 30), else 5. */
102
+ loadingRows?: number
103
+ /** Title of the `EmptyState` tile shown when `items` is empty. Default "No items to compare yet"; pass the cause for your list. */
104
+ emptyText?: string
105
+ }
103
106
 
104
107
  /** `null`, `undefined`, `false` and `true` render nothing, so they are not a secondary value. */
105
108
  const hasContent = (node: ReactNode): boolean =>
@@ -127,19 +130,21 @@ export function BarList({
127
130
  accentLeader = false,
128
131
  secondaryAlign,
129
132
  loading = false,
130
- loadingRows = 5,
133
+ loadingRows,
131
134
  emptyText = 'No items to compare yet',
132
135
  className,
133
136
  style,
137
+ ...rest
134
138
  }: BarListProps) {
139
+ const data = pickDataAttributes(rest)
135
140
  if (loading) {
136
141
  // Each row is a real, empty row with a skeleton laid over it, so the list takes the height of
137
142
  // the rows it will become in every layout instead of a fixed guess.
138
143
  return (
139
- <div className={cx(classes.frame, className)} style={style}>
144
+ <div {...data} className={cx(classes.frame, className)} style={style}>
140
145
  <div className={classes.root} aria-busy="true" data-variant={variant}>
141
146
  <VisuallyHidden>{`Loading ${label}`}</VisuallyHidden>
142
- {Array.from({ length: loadingRows }, (_, i) => (
147
+ {Array.from({ length: skeletonRowCount(loadingRows, items.length) }, (_, i) => (
143
148
  <div
144
149
  key={i}
145
150
  className={cx(classes.row, classes.skeletonRow)}
@@ -158,7 +163,7 @@ export function BarList({
158
163
  }
159
164
  if (items.length === 0) {
160
165
  return (
161
- <div className={cx(classes.frame, className)} style={style}>
166
+ <div {...data} className={cx(classes.frame, className)} style={style}>
162
167
  {/* oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a polite live region whose name is the visually hidden label inside; `<output>` cannot hold the tile's block content */}
163
168
  <div className={classes.root} role="status">
164
169
  <VisuallyHidden>{label}</VisuallyHidden>
@@ -179,7 +184,7 @@ export function BarList({
179
184
  const align = secondaryAlign ?? (items.some((i) => isText(i.secondary)) ? 'start' : 'end')
180
185
  return (
181
186
  // The frame is the width container the wide layout keys on (a container cannot restyle its own grid).
182
- <div className={cx(classes.frame, className)} style={style}>
187
+ <div {...data} className={cx(classes.frame, className)} style={style}>
183
188
  {/* The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one. */}
184
189
  <ul
185
190
  className={classes.root}
@@ -26,6 +26,25 @@
26
26
  gap: var(--vx-space-stack-sm);
27
27
  }
28
28
 
29
+ /* A bottom fade while more cards sit below the fold (`data-more`, set by `ColumnScroll`). A mask, not a
30
+ gradient of the page colour: a Board in a `Section` sits on the panel surface, and a fade to the
31
+ page colour (W50) left a 16 px band that read as no fade at all. The mask dissolves the cards
32
+ themselves, so it shows on any backdrop, and adds no height. */
33
+ .viewport[data-more] {
34
+ --board-fade: calc(var(--vx-space-stack-lg, 1.5rem) * 2);
35
+ mask-image: linear-gradient(to bottom, black calc(100% - var(--board-fade)), transparent);
36
+ }
37
+
38
+ /* A quiet thumb: 6 px, a faint ink tint that firms on hover, no rail behind it (Mantine's default is a
39
+ heavy grey bar that read as chrome on the page). */
40
+ .thumb {
41
+ background: color-mix(in srgb, var(--vx-ink) 22%, transparent);
42
+ }
43
+
44
+ .thumb:hover {
45
+ background: color-mix(in srgb, var(--vx-ink) 40%, transparent);
46
+ }
47
+
29
48
  .head {
30
49
  display: flex;
31
50
  align-items: center;
@@ -6,8 +6,10 @@ declare const classes: {
6
6
  readonly root: string
7
7
  readonly columns: string
8
8
  readonly column: string
9
+ readonly viewport: string
9
10
  readonly head: string
10
11
  readonly title: string
12
+ readonly thumb: string
11
13
  readonly count: string
12
14
  readonly total: string
13
15
  readonly list: string
@@ -43,8 +43,8 @@
43
43
  import { ScrollArea, SegmentedControl, Skeleton, Card, VisuallyHidden } from '@mantine/core'
44
44
  import { Fragment, useEffect, useId, useRef, useState } from 'react'
45
45
  import type { KeyboardEvent, ReactNode } from 'react'
46
- import { cx } from '../common/props'
47
- import type { BasaltProps } from '../common/props'
46
+ import { cx, pickDataAttributes } from '../common/props'
47
+ import type { BasaltProps, DataAttributes } from '../common/props'
48
48
  import { useSizeClass } from '../shell/use-size-class'
49
49
  import type { EnumField, FieldHandle } from '../state'
50
50
  import { StatusDot } from '../theme/status-dot'
@@ -53,47 +53,49 @@ import classes from './board.module.css'
53
53
  import { isBoardKey, isSafeHref, moveOnBoard } from './board-nav'
54
54
  import type { BoardPos } from './board-nav'
55
55
  import { EmptyState } from './empty-state'
56
+ import { useScrolledEdge } from './event-list-scroll'
56
57
 
57
- export type BoardProps<T extends string = string> = BasaltProps & {
58
- /** Accessible name of the board. Default "Board". */
59
- label?: string
60
- /** Columns in display order. Column and card `id`s must be unique within their parent. */
61
- columns: readonly {
62
- id: T
63
- title: string
64
- /** Colour of the header's status dot (a `VX.status.*` token). Default muted. */
65
- tone?: string
66
- /** Right-aligned header text, already formatted ("3 items", "$12.40"). */
67
- total?: string
68
- /** The title of the `EmptyState` tile an empty column shows. Default "Nothing here"; say why it is empty. */
69
- empty?: string
70
- cards: readonly {
71
- id: string
72
- actor?: string
73
- type?: string
58
+ export type BoardProps<T extends string = string> = BasaltProps &
59
+ DataAttributes & {
60
+ /** Accessible name of the board. Default "Board". */
61
+ label?: string
62
+ /** Columns in display order. Column and card `id`s must be unique within their parent. */
63
+ columns: readonly {
64
+ id: T
74
65
  title: string
75
- /** A linked record; `href` is a link only when http(s) or relative. */
76
- record?: { label: string; href?: string }
77
- /** One muted status line ("Deferred · waiting on CI"). */
78
- status?: string
79
- /** An optional meter or preview; the one ReactNode slot. */
80
- meter?: ReactNode
66
+ /** Colour of the header's status dot (a `VX.status.*` token). Default muted. */
67
+ tone?: string
68
+ /** Right-aligned header text, already formatted ("3 items", "$12.40"). */
69
+ total?: string
70
+ /** The title of the `EmptyState` tile an empty column shows. Default "Nothing here"; say why it is empty. */
71
+ empty?: string
72
+ cards: readonly {
73
+ id: string
74
+ actor?: string
75
+ type?: string
76
+ title: string
77
+ /** A linked record; `href` is a link only when http(s) or relative. */
78
+ record?: { label: string; href?: string }
79
+ /** One muted status line ("Deferred · waiting on CI"). */
80
+ status?: string
81
+ /** An optional meter or preview; the one ReactNode slot. */
82
+ meter?: ReactNode
83
+ }[]
81
84
  }[]
82
- }[]
83
- /** Called with the card and column ids on Enter, Space or a click. */
84
- onOpen?: (cardId: string, columnId: string) => void
85
- /** Each column scrolls alone inside a box of this height. Omitted: content-sized. */
86
- height?: number | string
87
- /** Renders column-shaped skeletons. */
88
- loading?: boolean
89
- /** The tile shown when no column has a card. Default "Nothing on the board". */
90
- empty?: { title: string; description?: string; action?: ReactNode }
91
- /**
92
- * Compact: the store field holding the selected column id (an enum field of the column ids, the
93
- * type `ViewTabs` takes). Omitted: internal state, first column.
94
- */
95
- field?: FieldHandle<EnumField<T>>
96
- }
85
+ /** Called with the card and column ids on Enter, Space or a click. */
86
+ onOpen?: (cardId: string, columnId: string) => void
87
+ /** Each column scrolls alone inside a box of this height. Omitted: content-sized. */
88
+ height?: number | string
89
+ /** Renders column-shaped skeletons. */
90
+ loading?: boolean
91
+ /** The tile shown when no column has a card. Default "Nothing on the board". */
92
+ empty?: { title: string; description?: string; action?: ReactNode }
93
+ /**
94
+ * Compact: the store field holding the selected column id (an enum field of the column ids, the
95
+ * type `ViewTabs` takes). Omitted: internal state, first column.
96
+ */
97
+ field?: FieldHandle<EnumField<T>>
98
+ }
97
99
 
98
100
  const DEFAULT_EMPTY = { title: 'Nothing on the board' } as const
99
101
  const SKELETON_COLUMNS = 3
@@ -180,6 +182,25 @@ export function Board<T extends string = string>({ field, ...props }: BoardProps
180
182
  )
181
183
  }
182
184
 
185
+ /** One column's scroll box. It marks its viewport `data-more` while cards remain below the fold, and
186
+ * CSS masks the column's bottom edge there, so a clipped last card is never silent. */
187
+ function ColumnScroll({ height, children }: { height?: number | string; children: ReactNode }) {
188
+ const [viewport, setViewport] = useState<HTMLDivElement | null>(null)
189
+ useScrolledEdge(viewport)
190
+ return (
191
+ <ScrollArea.Autosize
192
+ {...(height !== undefined && { mah: height })}
193
+ type="auto"
194
+ offsetScrollbars="y"
195
+ viewportRef={setViewport}
196
+ scrollbarSize={6}
197
+ classNames={{ viewport: classes.viewport, thumb: classes.thumb }}
198
+ >
199
+ {children}
200
+ </ScrollArea.Autosize>
201
+ )
202
+ }
203
+
183
204
  function BoardView<T extends string>({
184
205
  label = 'Board',
185
206
  columns,
@@ -191,6 +212,7 @@ function BoardView<T extends string>({
191
212
  onPick,
192
213
  className,
193
214
  style,
215
+ ...rest
194
216
  }: BoardViewProps<T>) {
195
217
  const compact = useSizeClass() === 'compact'
196
218
  const labelId = useId()
@@ -311,13 +333,7 @@ function BoardView<T extends string>({
311
333
  )}
312
334
  {col.total !== undefined && <span className={classes.total}>{col.total}</span>}
313
335
  </div>
314
- <ScrollArea.Autosize
315
- {...(height !== undefined && { mah: height })}
316
- type="auto"
317
- offsetScrollbars="y"
318
- >
319
- {list}
320
- </ScrollArea.Autosize>
336
+ <ColumnScroll {...(height !== undefined && { height })}>{list}</ColumnScroll>
321
337
  </div>
322
338
  )
323
339
  }
@@ -387,7 +403,12 @@ function BoardView<T extends string>({
387
403
  }
388
404
 
389
405
  return (
390
- <div className={cx(classes.root, className)} style={style} data-board="">
406
+ <div
407
+ {...pickDataAttributes(rest)}
408
+ className={cx(classes.root, className)}
409
+ style={style}
410
+ data-board=""
411
+ >
391
412
  {content}
392
413
  </div>
393
414
  )
@@ -20,13 +20,14 @@
20
20
  import { Center, Stack } from '@mantine/core'
21
21
  import type { ReactNode } from 'react'
22
22
  import { VX, alpha } from '../tokens'
23
- import { cx } from '../common/props'
24
- import type { BasaltProps, SlotStylesProps } from '../common/props'
23
+ import { cx, pickDataAttributes } from '../common/props'
24
+ import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props'
25
25
 
26
26
  /** The five boxes `EmptyState` paints, and the whole styling seam it offers (`common/props.ts`). */
27
27
  export type EmptyStateSlot = 'root' | 'icon' | 'title' | 'description' | 'action'
28
28
 
29
29
  export type EmptyStateProps = BasaltProps &
30
+ DataAttributes &
30
31
  SlotStylesProps<EmptyStateSlot> & {
31
32
  /** Optional glyph slot, rendered faint at ~28-32px. No shipped illustration assets. */
32
33
  icon?: ReactNode
@@ -65,10 +66,12 @@ export function EmptyState({
65
66
  className,
66
67
  style,
67
68
  classNames,
69
+ ...rest
68
70
  }: EmptyStateProps) {
69
71
  const resolved = tier ?? 'page'
70
72
  return (
71
73
  <Stack
74
+ {...pickDataAttributes(rest)}
72
75
  align="center"
73
76
  gap="xs"
74
77
  className={cx(classNames?.root, className)}
@@ -99,7 +99,19 @@ export type RowContext = {
99
99
 
100
100
  /** `null`, `undefined`, booleans and the empty string render nothing, so they are not content. */
101
101
  export const present = (node: ReactNode): boolean =>
102
- node !== undefined && node !== null && typeof node !== 'boolean' && node !== ''
102
+ node !== undefined &&
103
+ node !== null &&
104
+ typeof node !== 'boolean' &&
105
+ node !== '' &&
106
+ !(Array.isArray(node) && !node.some(present))
107
+
108
+ const SKELETON_DEFAULT_ROWS = 5
109
+ const SKELETON_MAX_ROWS = 30
110
+
111
+ /** Skeleton rows while loading, shared by `EventList` and `BarList`: an explicit `loadingRows`, else the
112
+ * rows held now (a refetch), capped at 30, else 5 (a cold load has no count to keep). */
113
+ export const skeletonRowCount = (loadingRows: number | undefined, held: number): number =>
114
+ loadingRows ?? (held > 0 ? Math.min(held, SKELETON_MAX_ROWS) : SKELETON_DEFAULT_ROWS)
103
115
 
104
116
  /** The data attributes a row (real or skeleton) carries; the CSS keys on them. */
105
117
  export function rowAttributes(ctx: RowContext, first: boolean, last: boolean) {
@@ -29,7 +29,6 @@ export function EventRow({
29
29
  const at = toEventDate(item.at)
30
30
  const valid = isValidEventDate(at)
31
31
  const stamp = formatEventTime(at, ctx.timeMode, ctx.now)
32
- const hasMeta = present(item.body) || present(item.chips)
33
32
  return (
34
33
  <Tag
35
34
  className={classes.row}
@@ -37,8 +36,6 @@ export function EventRow({
37
36
  role={Tag === 'div' ? 'listitem' : undefined}
38
37
  data-event-id={item.id}
39
38
  data-untimed={stamp === '' ? '' : undefined}
40
- // A row whose only meta is chips and has no time: the chips join the sentence's line, not a line of their own.
41
- data-chips-only={stamp === '' && !present(item.body) && present(item.chips) ? '' : undefined}
42
39
  {...rowAttributes(ctx, first, last)}
43
40
  >
44
41
  {ctx.lead && <span className={classes.leading}>{item.leading}</span>}
@@ -51,12 +48,12 @@ export function EventRow({
51
48
  {stamp}
52
49
  </time>
53
50
  )}
54
- {hasMeta && (
51
+ {present(item.body) && (
55
52
  <div className={classes.meta}>
56
- {present(item.body) && <span className={classes.body}>{item.body}</span>}
57
- {present(item.chips) && <span className={classes.chips}>{item.chips}</span>}
53
+ <span className={classes.body}>{item.body}</span>
58
54
  </div>
59
55
  )}
56
+ {present(item.chips) && <div className={classes.chips}>{item.chips}</div>}
60
57
  </Tag>
61
58
  )
62
59
  }