basalt-ui 2.27.2 → 2.28.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 (238) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/MIGRATING.md +168 -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-design/SKILL.md +1 -1
  7. package/agent/skills/basalt-design/references/catalogue.md +40 -36
  8. package/agent/skills/basalt-design/references/recipes.md +47 -0
  9. package/configs/oxlint-basalt.json +2 -1
  10. package/configs/oxlint-plugin.js +110 -2
  11. package/configs/oxlint-plugin.test.ts +99 -4
  12. package/dist/agent/chat/thread-message.d.ts +1 -160
  13. package/dist/agent/chat/thread-message.d.ts.map +1 -1
  14. package/dist/agent/chat/thread-message.js +7 -162
  15. package/dist/agent/chat/virtualize.d.ts +5 -5
  16. package/dist/charts/ChartCard.d.ts +5 -2
  17. package/dist/charts/ChartCard.d.ts.map +1 -1
  18. package/dist/charts/ChartCard.js +46 -13
  19. package/dist/charts/Lines.d.ts.map +1 -1
  20. package/dist/charts/Lines.js +11 -4
  21. package/dist/charts/Sparkline.d.ts +9 -2
  22. package/dist/charts/Sparkline.d.ts.map +1 -1
  23. package/dist/charts/Sparkline.js +104 -41
  24. package/dist/charts/chart-box.module.css +50 -0
  25. package/dist/charts/chart-box.module.css.d.ts +5 -0
  26. package/dist/charts/chart-card.module.css +12 -4
  27. package/dist/charts/chart-card.module.css.d.ts +1 -0
  28. package/dist/charts/compile.d.ts.map +1 -1
  29. package/dist/charts/compile.js +20 -18
  30. package/dist/charts/labels.d.ts +13 -3
  31. package/dist/charts/labels.d.ts.map +1 -1
  32. package/dist/charts/labels.js +131 -20
  33. package/dist/charts/legend.d.ts.map +1 -1
  34. package/dist/charts/legend.js +1 -1
  35. package/dist/charts/ref-label.d.ts +31 -8
  36. package/dist/charts/ref-label.d.ts.map +1 -1
  37. package/dist/charts/ref-label.js +40 -9
  38. package/dist/charts/sparkline.module.css +6 -0
  39. package/dist/charts/state.d.ts +3 -3
  40. package/dist/charts/state.d.ts.map +1 -1
  41. package/dist/charts/state.js +20 -2
  42. package/dist/cli/shot/capture.d.ts +6 -1
  43. package/dist/cli/shot/capture.d.ts.map +1 -1
  44. package/dist/cli/shot/capture.js +18 -5
  45. package/dist/common/empty-copy.d.ts +16 -0
  46. package/dist/common/empty-copy.d.ts.map +1 -0
  47. package/dist/common/empty-copy.js +9 -0
  48. package/dist/common/virtual-rows.d.ts +196 -0
  49. package/dist/common/virtual-rows.d.ts.map +1 -0
  50. package/dist/common/virtual-rows.js +290 -0
  51. package/dist/controls/controls.module.css +33 -1
  52. package/dist/controls/controls.module.css.d.ts +2 -0
  53. package/dist/controls/enum-filter.d.ts.map +1 -1
  54. package/dist/controls/enum-filter.js +8 -2
  55. package/dist/controls/filter-pill.d.ts +27 -3
  56. package/dist/controls/filter-pill.d.ts.map +1 -1
  57. package/dist/controls/filter-pill.js +15 -4
  58. package/dist/controls/form-layout.d.ts +9 -3
  59. package/dist/controls/form-layout.d.ts.map +1 -1
  60. package/dist/controls/form-layout.js +74 -12
  61. package/dist/controls/form-layout.module.css +112 -7
  62. package/dist/controls/form-layout.module.css.d.ts +1 -0
  63. package/dist/controls/multi-select-filter.d.ts +2 -2
  64. package/dist/controls/multi-select-filter.d.ts.map +1 -1
  65. package/dist/controls/multi-select-filter.js +12 -6
  66. package/dist/controls/range-filter.d.ts +1 -1
  67. package/dist/controls/range-filter.d.ts.map +1 -1
  68. package/dist/controls/range-filter.js +8 -2
  69. package/dist/dashboard/bar-list.d.ts +1 -1
  70. package/dist/dashboard/bar-list.d.ts.map +1 -1
  71. package/dist/dashboard/bar-list.js +6 -2
  72. package/dist/dashboard/bar-list.module.css +0 -2
  73. package/dist/dashboard/board-nav.d.ts +22 -0
  74. package/dist/dashboard/board-nav.d.ts.map +1 -0
  75. package/dist/dashboard/board-nav.js +49 -0
  76. package/dist/dashboard/board.d.ts +52 -0
  77. package/dist/dashboard/board.d.ts.map +1 -0
  78. package/dist/dashboard/board.js +228 -0
  79. package/dist/dashboard/board.module.css +160 -0
  80. package/dist/dashboard/board.module.css.d.ts +26 -0
  81. package/dist/dashboard/empty-state.d.ts +3 -3
  82. package/dist/dashboard/empty-state.d.ts.map +1 -1
  83. package/dist/dashboard/empty-state.js +13 -6
  84. package/dist/dashboard/event-list-model.d.ts +51 -0
  85. package/dist/dashboard/event-list-model.d.ts.map +1 -0
  86. package/dist/dashboard/event-list-model.js +72 -0
  87. package/dist/dashboard/event-list-rows.d.ts +23 -0
  88. package/dist/dashboard/event-list-rows.d.ts.map +1 -0
  89. package/dist/dashboard/event-list-rows.js +93 -0
  90. package/dist/dashboard/event-list-scroll.d.ts +27 -0
  91. package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
  92. package/dist/dashboard/event-list-scroll.js +103 -0
  93. package/dist/dashboard/event-list-skeleton.d.ts +10 -0
  94. package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
  95. package/dist/dashboard/event-list-skeleton.js +36 -0
  96. package/dist/dashboard/event-list.d.ts +65 -0
  97. package/dist/dashboard/event-list.d.ts.map +1 -0
  98. package/dist/dashboard/event-list.js +178 -0
  99. package/dist/dashboard/event-list.module.css +283 -0
  100. package/dist/dashboard/event-list.module.css.d.ts +33 -0
  101. package/dist/dashboard/index.d.ts +2 -0
  102. package/dist/dashboard/index.d.ts.map +1 -1
  103. package/dist/dashboard/index.js +4 -0
  104. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  105. package/dist/dashboard/meter-parts.js +5 -3
  106. package/dist/dashboard/meter.module.css +2 -1
  107. package/dist/dashboard/query-state.js +1 -1
  108. package/dist/dashboard/settings-section.d.ts +4 -1
  109. package/dist/dashboard/settings-section.d.ts.map +1 -1
  110. package/dist/dashboard/settings-section.js +1 -1
  111. package/dist/dashboard/settings-section.module.css +19 -4
  112. package/dist/dashboard/stat-card-parts.d.ts +5 -1
  113. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  114. package/dist/dashboard/stat-card-parts.js +8 -3
  115. package/dist/dashboard/stat-card.d.ts.map +1 -1
  116. package/dist/dashboard/stat-card.js +25 -6
  117. package/dist/dashboard/stat-card.module.css +31 -7
  118. package/dist/dashboard/stat-card.module.css.d.ts +3 -0
  119. package/dist/dashboard/stat-strip.module.css +4 -1
  120. package/dist/dashboard/widget-header.module.css +17 -1
  121. package/dist/guard/index.d.ts.map +1 -1
  122. package/dist/guard/index.js +2 -0
  123. package/dist/index.d.ts +1 -1
  124. package/dist/index.d.ts.map +1 -1
  125. package/dist/index.js +4 -0
  126. package/dist/shell/app-main.module.css +18 -0
  127. package/dist/styles.css +46 -0
  128. package/dist/surfaces.d.ts +2 -2
  129. package/dist/surfaces.d.ts.map +1 -1
  130. package/dist/surfaces.js +8 -2
  131. package/dist/table/cell-kinds.d.ts +44 -0
  132. package/dist/table/cell-kinds.d.ts.map +1 -0
  133. package/dist/table/cell-kinds.js +169 -0
  134. package/dist/table/cell-kinds.module.css +55 -0
  135. package/dist/table/cell-kinds.module.css.d.ts +15 -0
  136. package/dist/table/data-table-fold.d.ts +147 -0
  137. package/dist/table/data-table-fold.d.ts.map +1 -0
  138. package/dist/table/data-table-fold.js +288 -0
  139. package/dist/table/data-table-state.d.ts +10 -3
  140. package/dist/table/data-table-state.d.ts.map +1 -1
  141. package/dist/table/data-table-state.js +11 -6
  142. package/dist/table/data-table.d.ts +11 -26
  143. package/dist/table/data-table.d.ts.map +1 -1
  144. package/dist/table/data-table.js +354 -254
  145. package/dist/table/data-table.module.css +210 -3
  146. package/dist/table/data-table.module.css.d.ts +12 -0
  147. package/dist/table/table-features.d.ts +34 -4
  148. package/dist/table/table-features.d.ts.map +1 -1
  149. package/dist/table/table-features.js +10 -0
  150. package/dist/theme/card-inset.module.css +35 -0
  151. package/dist/theme/controls.module.css +32 -0
  152. package/dist/theme/ctl-theme.d.ts.map +1 -1
  153. package/dist/theme/ctl-theme.js +5 -0
  154. package/dist/theme/index.d.ts.map +1 -1
  155. package/dist/theme/index.js +14 -10
  156. package/dist/tokens/core.d.ts +1 -0
  157. package/dist/tokens/core.d.ts.map +1 -1
  158. package/dist/tokens/core.js +1 -0
  159. package/dist/tokens/derive.js +1 -1
  160. package/dist/tokens/palette.d.ts +2 -1
  161. package/dist/tokens/palette.d.ts.map +1 -1
  162. package/llms.txt +34 -5
  163. package/package.json +1 -1
  164. package/src/agent/chat/thread-message.tsx +10 -403
  165. package/src/agent/chat/virtualize.ts +5 -5
  166. package/src/charts/ChartCard.tsx +79 -17
  167. package/src/charts/Lines.tsx +13 -4
  168. package/src/charts/Sparkline.tsx +131 -45
  169. package/src/charts/chart-box.module.css +50 -0
  170. package/src/charts/chart-box.module.css.d.ts +5 -0
  171. package/src/charts/chart-card.module.css +12 -4
  172. package/src/charts/chart-card.module.css.d.ts +1 -0
  173. package/src/charts/compile.ts +22 -18
  174. package/src/charts/labels.ts +175 -24
  175. package/src/charts/legend.tsx +3 -2
  176. package/src/charts/ref-label.ts +86 -17
  177. package/src/charts/sparkline.module.css +6 -0
  178. package/src/charts/state.tsx +36 -7
  179. package/src/cli/shot/capture.ts +29 -6
  180. package/src/common/empty-copy.ts +17 -0
  181. package/src/common/virtual-rows.tsx +682 -0
  182. package/src/controls/controls.module.css +33 -1
  183. package/src/controls/controls.module.css.d.ts +2 -0
  184. package/src/controls/enum-filter.tsx +8 -2
  185. package/src/controls/filter-pill.tsx +80 -27
  186. package/src/controls/form-layout.module.css +112 -7
  187. package/src/controls/form-layout.module.css.d.ts +1 -0
  188. package/src/controls/form-layout.tsx +115 -22
  189. package/src/controls/multi-select-filter.tsx +22 -11
  190. package/src/controls/range-filter.tsx +9 -3
  191. package/src/dashboard/bar-list.module.css +0 -2
  192. package/src/dashboard/bar-list.tsx +8 -5
  193. package/src/dashboard/board-nav.ts +67 -0
  194. package/src/dashboard/board.module.css +160 -0
  195. package/src/dashboard/board.module.css.d.ts +26 -0
  196. package/src/dashboard/board.tsx +394 -0
  197. package/src/dashboard/empty-state.tsx +16 -9
  198. package/src/dashboard/event-list-model.ts +113 -0
  199. package/src/dashboard/event-list-rows.tsx +120 -0
  200. package/src/dashboard/event-list-scroll.ts +145 -0
  201. package/src/dashboard/event-list-skeleton.tsx +58 -0
  202. package/src/dashboard/event-list.module.css +283 -0
  203. package/src/dashboard/event-list.module.css.d.ts +33 -0
  204. package/src/dashboard/event-list.tsx +309 -0
  205. package/src/dashboard/index.ts +2 -0
  206. package/src/dashboard/meter-parts.tsx +9 -2
  207. package/src/dashboard/meter.module.css +2 -1
  208. package/src/dashboard/query-state.tsx +1 -1
  209. package/src/dashboard/settings-section.module.css +19 -4
  210. package/src/dashboard/settings-section.tsx +7 -2
  211. package/src/dashboard/stat-card-parts.tsx +20 -3
  212. package/src/dashboard/stat-card.module.css +31 -7
  213. package/src/dashboard/stat-card.module.css.d.ts +3 -0
  214. package/src/dashboard/stat-card.tsx +24 -5
  215. package/src/dashboard/stat-strip.module.css +4 -1
  216. package/src/dashboard/widget-header.module.css +17 -1
  217. package/src/guard/index.ts +2 -0
  218. package/src/index.ts +4 -0
  219. package/src/shell/app-main.module.css +18 -0
  220. package/src/styles.css +46 -0
  221. package/src/surfaces.ts +7 -1
  222. package/src/table/cell-kinds.module.css +55 -0
  223. package/src/table/cell-kinds.module.css.d.ts +15 -0
  224. package/src/table/cell-kinds.tsx +234 -0
  225. package/src/table/data-table-fold.tsx +514 -0
  226. package/src/table/data-table-state.ts +24 -13
  227. package/src/table/data-table.module.css +210 -3
  228. package/src/table/data-table.module.css.d.ts +12 -0
  229. package/src/table/data-table.tsx +406 -359
  230. package/src/table/table-features.ts +44 -4
  231. package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
  232. package/src/theme/card-inset.module.css +35 -0
  233. package/src/theme/controls.module.css +32 -0
  234. package/src/theme/ctl-theme.tsx +8 -0
  235. package/src/theme/index.ts +12 -8
  236. package/src/tokens/core.ts +1 -0
  237. package/src/tokens/derive.ts +1 -1
  238. package/src/tokens/palette.ts +4 -1
@@ -0,0 +1,309 @@
1
+ /**
2
+ * EventList — a day-grouped feed or timeline of things that happened: a leading glyph, the actor and
3
+ * a sentence on line one; line two leads with the mono time, then the muted body and the chips. Choose it
4
+ * for activity, history and audit trails; a table is for comparing rows, this is for reading them
5
+ * in order. An HTML/CSS primitive (no chart engine).
6
+ *
7
+ * The caller's order is kept — the list never sorts. `order` only says which end is "earlier", so
8
+ * day groups and the `earlier` control land on the right edge. Days are local. Item `id`s are the
9
+ * rows' identity (keys, prepend anchoring): keep them unique and stable.
10
+ *
11
+ * The row is two lines at every width: line one is the glyph and `actor + sentence` (clamped to one line in
12
+ * `feed`, wrapping in `timeline`); line two leads with the time, then the body (it wraps, never
13
+ * truncates), then the chips (they wrap to the next line only if they must). A row with no body or
14
+ * chips still has line two, the time alone; an untimed row's line two is body and chips only.
15
+ *
16
+ * Above 200 rows the rows window through the package's one lazy virtual-list seam
17
+ * (`@tanstack/react-virtual`, an optional peer); at or below it the list is plain DOM and the peer is
18
+ * never loaded. A list crossing 200 rows keeps its scroll node and may land a few rows off its place. With `height` the list owns its scroll node — an oldest-first list then opens on its
19
+ * newest end and keeps the visible row across a prepend; without it the rows follow the nearest
20
+ * scrolling ancestor (the shell's scrollport) and the page keeps scrolling. States follow `BarList`:
21
+ * `loading` is row-shaped skeletons (the box keeps its height), an empty list is an `EmptyState` tile
22
+ * (`empty`) that sizes to its content.
23
+ * An error is the caller's: `QueryState` is not a public export, so put the list in a `Section`
24
+ * with `query` (it owns the failure and its retry) or render your own error note.
25
+ *
26
+ * @example
27
+ * import { EventList } from 'basalt-ui'
28
+ *
29
+ * <EventList
30
+ * label="Activity"
31
+ * items={[{ id: 'e1', at: Date.now(), actor: 'Ada', title: 'merged #482', chips: <Badge>main</Badge> }]}
32
+ * earlier={{ onLoad: loadMore, remaining: 12 }}
33
+ * />
34
+ *
35
+ * // A record's history: rail, full sentences, oldest first, in a box that opens on the newest event.
36
+ * <EventList label="History" density="timeline" order="oldest-first" height={440} items={events} />
37
+ */
38
+ import { Button, VisuallyHidden } from '@mantine/core'
39
+ import { useId, useRef, useState, useSyncExternalStore } from 'react'
40
+ import type { CSSProperties, ReactNode } from 'react'
41
+ import { cx } from '../common/props'
42
+ import type { BasaltProps } from '../common/props'
43
+ import { VirtualRows } from '../common/virtual-rows'
44
+ import classes from './event-list.module.css'
45
+ import { EmptyState } from './empty-state'
46
+ import { buildRows, DayHeader, EventRow } from './event-list-rows'
47
+ import {
48
+ defaultDayLabel,
49
+ groupByDay,
50
+ isValidEventDate,
51
+ present,
52
+ toEventDate,
53
+ } from './event-list-model'
54
+ import type { RowContext } from './event-list-model'
55
+ import { useHeldHeight, useOpenAtEnd, usePrependAnchor, useScrolledEdge } from './event-list-scroll'
56
+ import { SkeletonRows } from './event-list-skeleton'
57
+
58
+ /** Rows above this window through the virtual-list seam; at or below it the list is plain DOM. */
59
+ const VIRTUALIZE_THRESHOLD = 200
60
+
61
+ export type EventListProps = BasaltProps & {
62
+ /** Accessible name of the list. Default "Events". */
63
+ label?: string
64
+ /** Events in display order — kept as given, never re-sorted. `id`s must be unique within the list. */
65
+ items: readonly {
66
+ id: string
67
+ at: Date | number
68
+ actor?: ReactNode
69
+ title: ReactNode
70
+ body?: ReactNode
71
+ /** A glyph or avatar in the leading column. */
72
+ leading?: ReactNode
73
+ chips?: ReactNode
74
+ }[]
75
+ /** `feed`: one clamped line, about 52 px a two-line row. `timeline`: a rail, full sentences, body and chips in full. */
76
+ density?: 'feed' | 'timeline'
77
+ /** The 1 px line through the leading column joining rows within a day group. Default: `density === 'timeline'`. */
78
+ rail?: boolean
79
+ /** Day headers (`micro` mono, muted, with the row count) or one flat list. Default `day`. */
80
+ group?: 'day' | 'none'
81
+ /**
82
+ * The instant "Today" and relative times are measured from. Default: the client clock, read once
83
+ * after mount; until then (the server render, the hydrating paint) days read as dates and a
84
+ * `relative` time as a date-time, so server and client markup match.
85
+ */
86
+ now?: number | Date
87
+ /** Overrides the `Today` / `Yesterday` / short-date header text. Without a clock yet, `now` is the day itself. */
88
+ dayLabel?: (day: Date, now: Date) => string
89
+ /**
90
+ * The time column. Default `clock` when grouped by day, `date-time` when not. A function formats it
91
+ * yourself; one returning an empty string renders no time for that row (an untimed entry).
92
+ */
93
+ time?: 'clock' | 'relative' | 'date-time' | ((at: Date) => string)
94
+ /** Which end of `items` is earlier. Does not sort. Default `newest-first`. */
95
+ order?: 'newest-first' | 'oldest-first'
96
+ /**
97
+ * A quiet "Show earlier (N)" control at the earlier end (bottom for newest-first, top for
98
+ * oldest-first). With `height`, prepending (oldest-first) keeps the visible row where it is and a
99
+ * list opens on its newest end; a content-sized list leaves scrolling to the page.
100
+ */
101
+ earlier?: { onLoad: () => void; loading?: boolean; remaining?: number }
102
+ /** The list owns a scroll node of this height (modal, aside, card). Omitted: content-sized. */
103
+ height?: number | string
104
+ /** Renders row-shaped skeletons. */
105
+ loading?: boolean
106
+ /** Skeleton rows while loading. Default 5. */
107
+ loadingRows?: number
108
+ /**
109
+ * The empty state, an `EmptyState` in a ring-edged tile that sizes to its content (no void in a
110
+ * bounded `height`). Default: "Nothing has happened yet" with a one-line why.
111
+ */
112
+ empty?: { title: string; description?: string; action?: ReactNode }
113
+ }
114
+
115
+ const subscribeNever = (): (() => void) => () => {}
116
+
117
+ /**
118
+ * The client clock, read once after mount through `useSyncExternalStore` (the server snapshot is
119
+ * `null`, like `SyncButton`'s age): a server render never reads `Date.now()`, and the hydrating
120
+ * paint matches it before React re-renders with the real clock.
121
+ */
122
+ function useClientClock(): number | null {
123
+ const at = useRef<number | null>(null)
124
+ return useSyncExternalStore(
125
+ subscribeNever,
126
+ () => (at.current ??= Date.now()),
127
+ () => null,
128
+ )
129
+ }
130
+
131
+ /** Whether these rows were plain before: set while plain rows show, cleared when the rows go. */
132
+ function usePlainBefore(hasRows: boolean, windowed: boolean): boolean {
133
+ const [plain, setPlain] = useState(false)
134
+ const next = hasRows ? plain || !windowed : false
135
+ if (next !== plain) setPlain(next)
136
+ return next
137
+ }
138
+
139
+ const DEFAULT_EMPTY = {
140
+ title: 'Nothing has happened yet',
141
+ description: 'Events appear here as they happen.',
142
+ } as const
143
+
144
+ export function EventList({
145
+ label = 'Events',
146
+ items,
147
+ density = 'feed',
148
+ rail,
149
+ group = 'day',
150
+ now,
151
+ dayLabel,
152
+ time,
153
+ order = 'newest-first',
154
+ earlier,
155
+ height,
156
+ loading = false,
157
+ loadingRows = 5,
158
+ empty = DEFAULT_EMPTY,
159
+ className,
160
+ style,
161
+ }: EventListProps) {
162
+ const clock = useClientClock()
163
+ // The scroll node as state, so a windowed list can wait for it (see `VirtualRows` `scrollRoot`).
164
+ const [scrollEl, setScrollEl] = useState<HTMLDivElement | null>(null)
165
+ const labelId = useId()
166
+ const nowDate = now !== undefined ? new Date(now) : clock === null ? null : new Date(clock)
167
+ const grouped = group === 'day'
168
+ const withRail = rail ?? density === 'timeline'
169
+ const ctx: RowContext = {
170
+ density,
171
+ rail: withRail,
172
+ lead: withRail || items.some((i) => present(i.leading)),
173
+ timeMode: time ?? (grouped ? 'clock' : 'date-time'),
174
+ now: nowDate,
175
+ }
176
+ const oldestFirst = order === 'oldest-first'
177
+ const hasRows = !loading && items.length > 0
178
+ const virtualised = hasRows && items.length > VIRTUALIZE_THRESHOLD
179
+ const ownScroll = height !== undefined
180
+ const opensAtEnd = oldestFirst && ownScroll
181
+ const plainBefore = usePlainBefore(hasRows, virtualised)
182
+ usePrependAnchor(scrollEl, opensAtEnd && hasRows && !virtualised, items)
183
+ useOpenAtEnd(scrollEl, opensAtEnd && hasRows && !virtualised, items.length)
184
+ useScrolledEdge(ownScroll ? scrollEl : null)
185
+ useHeldHeight(scrollEl, !hasRows ? 'none' : virtualised ? 'windowed' : 'plain')
186
+
187
+ const control =
188
+ earlier === undefined || !hasRows ? null : (
189
+ <div className={classes.earlier} data-end={oldestFirst ? 'top' : 'bottom'}>
190
+ <Button
191
+ variant="subtle"
192
+ color="gray"
193
+ size="compact-sm"
194
+ className={classes.earlierButton}
195
+ loading={earlier.loading === true}
196
+ onClick={earlier.onLoad}
197
+ >
198
+ {earlier.remaining === undefined ? 'Show earlier' : `Show earlier (${earlier.remaining})`}
199
+ </Button>
200
+ </div>
201
+ )
202
+
203
+ let content: ReactNode
204
+ if (loading) {
205
+ content = (
206
+ <div aria-busy="true">
207
+ <VisuallyHidden>{`Loading ${label}`}</VisuallyHidden>
208
+ <SkeletonRows count={loadingRows} ctx={ctx} grouped={grouped} height={height} />
209
+ </div>
210
+ )
211
+ } else if (items.length === 0) {
212
+ content = (
213
+ // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a polite live region whose name is the visually hidden label inside
214
+ <div className={classes.empty} role="status">
215
+ <VisuallyHidden>{label}</VisuallyHidden>
216
+ <EmptyState
217
+ tier="section"
218
+ title={empty.title}
219
+ {...(empty.description !== undefined && { description: empty.description })}
220
+ {...(empty.action !== undefined && { action: empty.action })}
221
+ />
222
+ </div>
223
+ )
224
+ } else {
225
+ const groups = grouped
226
+ ? groupByDay(items)
227
+ : [{ day: toEventDate(items[0]?.at ?? 0), key: 'all', id: 'all#0', items }]
228
+ // A list with no real instant has no day to name: no headers, whatever `group` says.
229
+ const showHeaders = grouped && groups.some((g) => isValidEventDate(g.day))
230
+ // A caller's `dayLabel` only ever sees a real day.
231
+ const headerText = (day: Date): string =>
232
+ !isValidEventDate(day)
233
+ ? ''
234
+ : dayLabel === undefined
235
+ ? defaultDayLabel(day, nowDate)
236
+ : dayLabel(day, nowDate ?? day)
237
+ if (virtualised) {
238
+ const seam = {
239
+ rows: buildRows(groups, showHeaders, ctx, headerText),
240
+ overscan: 8,
241
+ estimateSize: density === 'timeline' ? 96 : 60,
242
+ className: classes.virtual,
243
+ anchorTo: oldestFirst ? ('end' as const) : ('start' as const),
244
+ // The shell scrollport is never jumped: only an own scroll node opens on its newest end.
245
+ // And only when the rows first appeared windowed: a list crossing 200 on an `earlier` load
246
+ // does not jump to the newest end.
247
+ initialScroll: opensAtEnd && !plainBefore ? ('end' as const) : ('start' as const),
248
+ // Own scroll node → the seam windows against it; none → the nearest scrolling ancestor.
249
+ ...(ownScroll && { scrollRoot: scrollEl }),
250
+ }
251
+ content = (
252
+ // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- the seam renders divs, so the list role is explicit
253
+ <div role="list" aria-label={label}>
254
+ <VirtualRows scroll="parent" {...seam} />
255
+ </div>
256
+ )
257
+ } else {
258
+ content = groups.map((g) => {
259
+ // Per run (day + occurrence), so the same day can open two runs and a same-day prepend
260
+ // does not remount the group.
261
+ const headerId = `${labelId}-${g.id}`
262
+ return (
263
+ <div key={g.id} className={classes.group}>
264
+ {showHeaders && (
265
+ <DayHeader id={headerId} text={headerText(g.day)} count={g.items.length} as="h3" />
266
+ )}
267
+ <ol
268
+ className={classes.list}
269
+ // The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one.
270
+ // oxlint-disable-next-line jsx-a11y/no-redundant-roles
271
+ role="list"
272
+ {...(showHeaders ? { 'aria-labelledby': headerId } : { 'aria-label': label })}
273
+ >
274
+ {g.items.map((item, i) => (
275
+ <EventRow
276
+ key={item.id}
277
+ item={item}
278
+ ctx={ctx}
279
+ first={i === 0}
280
+ last={i === g.items.length - 1}
281
+ tag="li"
282
+ />
283
+ ))}
284
+ </ol>
285
+ </div>
286
+ )
287
+ })
288
+ }
289
+ }
290
+
291
+ // The box keeps its height for rows and skeletons; an empty state sizes to its content.
292
+ const boxed = ownScroll && (loading || items.length > 0)
293
+ const scrollStyle: CSSProperties | undefined = boxed ? { height } : undefined
294
+ return (
295
+ <div className={cx(classes.frame, className)} style={style} data-density={density}>
296
+ {oldestFirst && control}
297
+ {/* theme-allow raw-scroll-container — the list owns its scroll node when given a height, like the virtual seam. */}
298
+ <div
299
+ ref={setScrollEl}
300
+ className={cx(classes.root, boxed && classes.scroll)}
301
+ style={scrollStyle}
302
+ >
303
+ {/* One wrapper around whatever shows, so its box is the content's box (see useHeldHeight). */}
304
+ <div>{content}</div>
305
+ </div>
306
+ {!oldestFirst && control}
307
+ </div>
308
+ )
309
+ }
@@ -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'
@@ -774,6 +774,9 @@ export function MeterBar(props: {
774
774
  ...labelled,
775
775
  ]
776
776
  const zoneLabels = compact ? [] : model.zoneLabels
777
+ // With no zone names to own the row below the track, the marker's reading shares the caption row
778
+ // with the end caption (both on one line when they fit), centred on the marker like ZoneReading.
779
+ const readingInRow = anchored && zoneLabels.length === 0
777
780
  // On a zoned track the zone names own the row below; the figures at its two ends sit above the
778
781
  // track, where nothing else competes for them. Every other tick label stays with the names.
779
782
  const isEnd = (t: TickMark) => t.pct <= 0 || t.pct >= 100
@@ -790,13 +793,15 @@ export function MeterBar(props: {
790
793
  const items: CaptionItem[] = compact
791
794
  ? []
792
795
  : [
793
- ...(start !== null && !anchored
796
+ ...(start !== null && (!anchored || readingInRow)
794
797
  ? [
795
798
  {
796
799
  key: 'start',
797
800
  node: glue(start),
801
+ ...(readingInRow && model.markerPct !== undefined && { pct: model.markerPct }),
798
802
  // The reading sits at its fill's end (clamped inside the track); `readingAt="start"` keeps the old start edge.
799
803
  ...(props.readingAt !== 'start' &&
804
+ !readingInRow &&
800
805
  model.fillEndPct !== undefined && {
801
806
  pct: model.fillEndPct,
802
807
  align: 'end' as const,
@@ -933,7 +938,9 @@ export function MeterBar(props: {
933
938
  )}
934
939
  </div>
935
940
  {zoneLabels.length > 0 && <LabelRow zones={zoneLabels} ticks={belowTicks} />}
936
- {anchored && quiet(<ZoneReading pct={model.markerPct ?? 0}>{start}</ZoneReading>)}
941
+ {anchored &&
942
+ !readingInRow &&
943
+ quiet(<ZoneReading pct={model.markerPct ?? 0}>{start}</ZoneReading>)}
937
944
  {!loading && model.describedByText !== null && (
938
945
  <VisuallyHidden id={describedId} className={classes.summary}>
939
946
  {model.describedByText}
@@ -142,7 +142,8 @@
142
142
  --basalt-reading-dir: 1;
143
143
  position: relative;
144
144
  height: 1.25em;
145
- overflow: clip;
145
+ /* Clipped along the row only: a descender hangs below the 1.25em box of a taller caption line. */
146
+ overflow-x: clip;
146
147
  font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
147
148
  font-variant-numeric: lining-nums;
148
149
  font-size: var(--basalt-meter-caption);
@@ -151,7 +151,7 @@ export function ErrorState({
151
151
  >
152
152
  <Group gap="xs" wrap="nowrap">
153
153
  <StatusDot color={VX.status.bad} />
154
- <Text size="sm" fw={500}>
154
+ <Text size={resolved === 'section' ? 'sm' : 'md'} fw={500}>
155
155
  {title}
156
156
  </Text>
157
157
  </Group>
@@ -21,13 +21,28 @@
21
21
  border-bottom: 1px solid var(--vx-divider);
22
22
  }
23
23
 
24
+ /* One row rule with FormRow (`controls/form-layout.module.css`): a 15rem label column, a control
25
+ * column capped at 20rem, left-packed; stacked under 600px of the section's OWN width. */
26
+ .rows {
27
+ container-type: inline-size;
28
+ container-name: basalt-form;
29
+ }
30
+
24
31
  .row {
25
- display: flex;
26
- align-items: flex-start;
27
- justify-content: space-between;
32
+ display: grid;
33
+ grid-template-columns: minmax(0, 15rem) minmax(0, 20rem);
34
+ justify-content: start;
35
+ align-items: start;
28
36
  gap: var(--vx-space-settings-row-gap);
29
37
  }
30
38
 
31
39
  .control {
32
- flex-shrink: 0;
40
+ min-inline-size: 0;
41
+ }
42
+
43
+ @container basalt-form (max-width: 599.9px) {
44
+ .row {
45
+ grid-template-columns: minmax(0, 1fr);
46
+ gap: var(--vx-space-stack-xs);
47
+ }
33
48
  }
@@ -104,7 +104,10 @@ export type SettingsRowProps = BasaltProps &
104
104
  label: string
105
105
  /** Optional 12px muted description under the label. */
106
106
  description?: string
107
- /** Right-aligned control (input/switch/button). */
107
+ /**
108
+ * Right-aligned control (input/switch/button). Mounted in a `CtlSlot`: a bound input is the 32 px
109
+ * field (44 under a coarse pointer), not Mantine's 42 px `md`; a control's own `size` still wins.
110
+ */
108
111
  control?: ReactNode
109
112
  /** Alternative to `control` for a fully custom right-hand region. */
110
113
  children?: ReactNode
@@ -130,7 +133,9 @@ export function SettingsRow({
130
133
  <span style={{ fontSize: VX.text.xs, color: VX.muted }}>{description}</span>
131
134
  )}
132
135
  </Stack>
133
- <div className={cx(classes.control, classNames?.control)}>{control ?? children}</div>
136
+ <div className={cx(classes.control, classNames?.control)}>
137
+ <CtlSlot>{control ?? children}</CtlSlot>
138
+ </div>
134
139
  </div>
135
140
  )
136
141
  }
@@ -106,12 +106,29 @@ export function rightSlotStyle(width: number, height: number): CSSProperties {
106
106
  } as CSSProperties
107
107
  }
108
108
 
109
- export function ValueSkeleton() {
110
- return <Skeleton className={classes.skeletonValue} radius="sm" />
109
+ /** The value bar, and a delta chip beside it when the loaded card carries a delta. */
110
+ export function ValueSkeleton({ delta }: { delta: boolean }) {
111
+ if (!delta) return <Skeleton className={classes.skeletonValue} radius="sm" />
112
+ return (
113
+ <div className={classes.skeletonValueRow}>
114
+ <Skeleton className={classes.skeletonValueWithDelta} radius="sm" />
115
+ <Skeleton className={classes.skeletonDelta} radius="sm" data-stat-skeleton-delta="" />
116
+ </div>
117
+ )
111
118
  }
112
119
 
120
+ /** A mild rise across the width in a 100 x 40 box: the sparkline's shape, not data. */
121
+ const SPARK_GHOST = '0,30 12,26 25,28 38,18 50,22 62,12 75,16 88,8 100,12'
122
+
123
+ /** The visual slot's loading shape: a line ghost at the sparkline's own height, no spinner. */
113
124
  export function VisualSkeleton() {
114
- return <Skeleton className={classes.skeletonVisual} />
125
+ return (
126
+ <div aria-hidden="true" className={classes.skeletonVisual} data-stat-skeleton-spark="">
127
+ <svg viewBox="0 0 100 40" preserveAspectRatio="none">
128
+ <polyline points={SPARK_GHOST} vectorEffect="non-scaling-stroke" />
129
+ </svg>
130
+ </div>
131
+ )
115
132
  }
116
133
 
117
134
  export function FooterSkeleton() {
@@ -213,14 +213,10 @@
213
213
 
214
214
  /* ── states ──────────────────────────────────────────────────────────────────────────────────── */
215
215
 
216
- /* The empty branch: one muted line in the figure's place, at the figure row's height. */
216
+ /* The empty branch (SPEC § 6.11): `EmptyState`'s section tile in the figure's place, at the card's
217
+ * own inset; `EmptyState`'s section tier sets its title at `sm`. */
217
218
  .empty {
218
- display: flex;
219
- align-items: center;
220
- margin: 0;
221
219
  min-height: var(--basalt-stat-figure-h);
222
- font-size: var(--vx-text-sm);
223
- color: var(--vx-muted);
224
220
  }
225
221
 
226
222
  /* The pending skeleton holds the card's own footprint: a value bar at the figure's height, the
@@ -233,10 +229,38 @@
233
229
  /* Inset on both sides, unlike the sparkline at rest (which bleeds): a placeholder that touches one
234
230
  * card edge and stops short of the other reads as misaligned, and a Meter in the slot is inset anyway. */
235
231
  .skeletonVisual {
236
- --skeleton-radius: 0;
237
232
  height: var(--basalt-stat-visual-h);
238
233
  }
239
234
 
235
+ .skeletonVisual svg {
236
+ display: block;
237
+ width: 100%;
238
+ height: 100%;
239
+ fill: none;
240
+ stroke: color-mix(in srgb, var(--vx-ink) 24%, var(--vx-surface-panel));
241
+ stroke-width: 2px;
242
+ stroke-linecap: round;
243
+ stroke-linejoin: round;
244
+ }
245
+
246
+ /* A skeleton value row with a delta: the value bar and the delta chip, on the loaded row's height. */
247
+ .skeletonValueRow {
248
+ display: flex;
249
+ align-items: center;
250
+ gap: var(--vx-space-stack-sm);
251
+ height: var(--basalt-stat-figure-h);
252
+ }
253
+
254
+ .skeletonValueWithDelta {
255
+ width: 28%;
256
+ height: 100%;
257
+ }
258
+
259
+ .skeletonDelta {
260
+ width: 22%;
261
+ height: 1rem;
262
+ }
263
+
240
264
  .sparklineRight .skeletonVisual {
241
265
  flex: 1 1 auto;
242
266
  }
@@ -19,6 +19,9 @@ declare const classes: {
19
19
  readonly empty: string
20
20
  readonly skeletonValue: string
21
21
  readonly skeletonVisual: string
22
+ readonly skeletonValueRow: string
23
+ readonly skeletonValueWithDelta: string
24
+ readonly skeletonDelta: string
22
25
  readonly skeletonFooter: string
23
26
  readonly skeletonRowBox: string
24
27
  readonly skeletonRow: string
@@ -109,6 +109,8 @@ import type {
109
109
  import { DeltaBadge } from './delta-badge'
110
110
  import { cx } from '../common/props'
111
111
  import type { BasaltProps, SlotStylesProps, Tone } from '../common/props'
112
+ import { splitEmptyCopy } from '../common/empty-copy'
113
+ import { EmptyState } from './empty-state'
112
114
  import { ErrorState, QueryState, resolveQueryBranch } from './query-state'
113
115
  import type { QueryBranch, QueryStateLike } from './query-state'
114
116
  import classes from './stat-card.module.css'
@@ -310,18 +312,21 @@ function renderValueBody({
310
312
  resolved,
311
313
  figure,
312
314
  emptyText,
315
+ hasDelta,
313
316
  }: {
317
+ hasDelta: boolean
314
318
  pending: boolean
315
319
  resolved: QueryBranch<unknown> | undefined
316
320
  figure: ReactNode
317
321
  emptyText: string
318
322
  }): ReactNode {
319
- if (resolved === undefined) return pending ? <ValueSkeleton /> : figure
323
+ const copy = splitEmptyCopy(emptyText)
324
+ if (resolved === undefined) return pending ? <ValueSkeleton delta={hasDelta} /> : figure
320
325
  // `loading` with a query still shows the skeleton, but a failed query is never hidden by it.
321
- if (pending && resolved.kind !== 'error') return <ValueSkeleton />
326
+ if (pending && resolved.kind !== 'error') return <ValueSkeleton delta={hasDelta} />
322
327
  switch (resolved.kind) {
323
328
  case 'pending':
324
- return <ValueSkeleton />
329
+ return <ValueSkeleton delta={hasDelta} />
325
330
  case 'error':
326
331
  // The error state itself — not `QueryState` with nothing to wrap, which over cached-empty data
327
332
  // would draw its "cached data" banner above an empty region.
@@ -335,7 +340,15 @@ function renderValueBody({
335
340
  />
336
341
  )
337
342
  case 'empty':
338
- return <p className={classes.empty}>{emptyText}</p>
343
+ return (
344
+ <EmptyState
345
+ tier="section"
346
+ title={copy.title}
347
+ {...(copy.description !== undefined && { description: copy.description })}
348
+ className={classes.empty}
349
+ style={{ padding: 'var(--vx-space-stack-md) var(--vx-space-stack-lg)' }}
350
+ />
351
+ )
339
352
  case 'ready':
340
353
  return figure
341
354
  default:
@@ -479,7 +492,13 @@ export function StatCard({
479
492
  </div>
480
493
  )
481
494
 
482
- const valueBody = renderValueBody({ pending, resolved, figure, emptyText })
495
+ const valueBody = renderValueBody({
496
+ pending,
497
+ resolved,
498
+ figure,
499
+ emptyText,
500
+ hasDelta: delta !== undefined,
501
+ })
483
502
 
484
503
  const breakdownCount = breakdown?.length ?? 0
485
504
  const hasBreakdown = breakdownCount > 0
@@ -378,15 +378,18 @@
378
378
  .footerCell {
379
379
  flex: 1 1 14rem;
380
380
  min-width: 0;
381
+ font-size: var(--vx-text-sm);
381
382
  padding: var(--vx-space-stack-md);
382
383
  border-inline-start: 1px solid var(--vx-divider);
383
384
  border-block-start: 1px solid var(--vx-divider);
384
385
  }
385
386
 
386
387
  /* A footer entry `under` a cell is part of that cell: it sits in the slot under the article, inset like
387
- * the article, split from the readings by the strip's own hairline. */
388
+ * the article, split from the readings by the strip's own hairline. Both footer slots take the strip's
389
+ * `sm` step, never the inherited body size (it would outrank the cell's own statement). */
388
390
  .underCell {
389
391
  min-width: 0;
392
+ font-size: var(--vx-text-sm);
390
393
  margin: var(--vx-space-stack-md) var(--vx-space-stack-md) 0;
391
394
  padding-block-start: var(--vx-space-stack-sm);
392
395
  border-block-start: 1px solid var(--vx-divider);
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * Layout keys on the enclosing card's OWN width (`container: basalt-card`, declared by ChartCard /
13
13
  * StatCard / Section — docs/DESIGN-CORE.md § Layout, elevation, shapes), never the viewport: below 480px the subtitle folds
14
- * into the info glyph; from 480px (wave 8) `value` + `delta` move onto the title row. Wrapping and
14
+ * into the info glyph (a ChartCard keeps it, wrapped to two lines — wave 43); from 480px (wave 8) `value` + `delta` move onto the title row. Wrapping and
15
15
  * shrinking are unconditional. The subtitle ALSO folds (regardless of width) whenever the card's own
16
16
  * height is under 280px — see the `[data-basalt-card-short]` block below (wave 8's header-economy
17
17
  * law). No enclosing card, no container: the standard layout. Container conditions are px literals
@@ -394,6 +394,22 @@
394
394
  .foldNote {
395
395
  display: block;
396
396
  }
397
+
398
+ /* A chart card keeps its subtitle (argo's line/dot key) on its own line at every width: up to two
399
+ * lines, then an ellipsis; the full text stays in the DOM. StatCard and Section still fold. The
400
+ * short-height block below out-ranks this (its selector is one class heavier). */
401
+ [data-basalt-chart-header] .subtitle {
402
+ display: -webkit-box;
403
+ -webkit-box-orient: vertical;
404
+ -webkit-line-clamp: 2;
405
+ line-clamp: 2;
406
+ overflow: hidden;
407
+ }
408
+
409
+ [data-basalt-chart-header] .foldGlyph,
410
+ [data-basalt-chart-header] .foldNote {
411
+ display: none;
412
+ }
397
413
  }
398
414
 
399
415
  /*
@@ -1073,6 +1073,8 @@ export const PLUGIN_RULE_IDS: ReadonlySet<string> = new Set([
1073
1073
  'no-dev-helper',
1074
1074
  // AST-only: a `<ViewTransition>` ancestor of `<Outlet>` is a JSX-ancestry claim over two import-resolved names.
1075
1075
  'route-view-transition',
1076
+ // AST-only: a text-colour position (`c=`, a `style` object's `color`) is a JSX/property claim over a member chain.
1077
+ 'status-fill-as-text',
1076
1078
  // These two honour `basalt-agent-allow`, never `theme-allow` — but they are still REAL ids, so
1077
1079
  // a `theme-allow ai-sdk-major` must parse as a (useless) scoped annotation rather than as prose.
1078
1080
  'agent-no-raw-usechat',