basalt-ui 2.19.0 → 2.21.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 (234) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/MIGRATING.md +291 -12
  3. package/agent/agents/basalt-design-reviewer.md +22 -5
  4. package/agent/rules/basalt-charts.md +1 -1
  5. package/agent/rules/basalt-mantine.md +1 -1
  6. package/agent/rules/basalt-tokens.md +2 -2
  7. package/agent/skills/basalt-app/SKILL.md +1 -1
  8. package/agent/skills/basalt-design/SKILL.md +10 -23
  9. package/agent/skills/basalt-design/references/anti-defaults.md +24 -0
  10. package/agent/skills/basalt-design/references/catalogue.md +48 -0
  11. package/agent/skills/basalt-design/references/concept.md +36 -0
  12. package/agent/skills/basalt-design/references/encoding-rules.md +45 -0
  13. package/agent/skills/basalt-design/references/stat-tile.md +24 -0
  14. package/agent/templates/AGENTS-block.md.tpl +3 -3
  15. package/agent/templates/DESIGN.md.tpl +1 -1
  16. package/configs/oxlint-plugin.js +34 -19
  17. package/configs/oxlint-plugin.test.ts +32 -2
  18. package/dist/charts/ChartCard.d.ts +33 -4
  19. package/dist/charts/ChartCard.d.ts.map +1 -1
  20. package/dist/charts/ChartCard.js +37 -11
  21. package/dist/charts/Donut.d.ts.map +1 -1
  22. package/dist/charts/Donut.js +13 -1
  23. package/dist/charts/Heatmap.js +1 -1
  24. package/dist/charts/Sparkline.d.ts +7 -1
  25. package/dist/charts/Sparkline.d.ts.map +1 -1
  26. package/dist/charts/Sparkline.js +137 -18
  27. package/dist/charts/box.d.ts +2 -0
  28. package/dist/charts/box.d.ts.map +1 -1
  29. package/dist/charts/box.js +2 -0
  30. package/dist/charts/chart-box.module.css +30 -0
  31. package/dist/charts/chart-box.module.css.d.ts +1 -0
  32. package/dist/charts/chart-card.module.css +47 -0
  33. package/dist/charts/chart-card.module.css.d.ts +7 -0
  34. package/dist/charts/compile.d.ts.map +1 -1
  35. package/dist/charts/compile.js +35 -8
  36. package/dist/charts/host.d.ts.map +1 -1
  37. package/dist/charts/host.js +2 -1
  38. package/dist/charts/index.d.ts +1 -1
  39. package/dist/charts/index.d.ts.map +1 -1
  40. package/dist/charts/sparkline.module.css +59 -0
  41. package/dist/charts/sparkline.module.css.d.ts +13 -0
  42. package/dist/charts/state.d.ts +5 -0
  43. package/dist/charts/state.d.ts.map +1 -1
  44. package/dist/charts/state.js +34 -4
  45. package/dist/charts/types.d.ts +6 -0
  46. package/dist/charts/types.d.ts.map +1 -1
  47. package/dist/cli/check-theme.d.ts.map +1 -1
  48. package/dist/cli/check-theme.js +3 -0
  49. package/dist/cli/help.d.ts.map +1 -1
  50. package/dist/cli/help.js +3 -2
  51. package/dist/cli/index.d.ts +4 -2
  52. package/dist/cli/index.d.ts.map +1 -1
  53. package/dist/cli/index.js +27 -15
  54. package/dist/cli/init.d.ts.map +1 -1
  55. package/dist/cli/init.js +3 -2
  56. package/dist/cli/shot/capture.d.ts.map +1 -1
  57. package/dist/cli/shot/capture.js +6 -1
  58. package/dist/cli/shot/detect.d.ts +51 -0
  59. package/dist/cli/shot/detect.d.ts.map +1 -0
  60. package/dist/cli/shot/detect.js +396 -0
  61. package/dist/cli/shot/index.d.ts.map +1 -1
  62. package/dist/cli/shot/index.js +7 -4
  63. package/dist/cli/shot/measure.d.ts +2 -0
  64. package/dist/cli/shot/measure.d.ts.map +1 -1
  65. package/dist/cli/shot/measure.js +2 -0
  66. package/dist/cli/shot/types.d.ts +4 -1
  67. package/dist/cli/shot/types.d.ts.map +1 -1
  68. package/dist/cli/shot/types.js +2 -0
  69. package/dist/cli/sync.d.ts +2 -0
  70. package/dist/cli/sync.d.ts.map +1 -1
  71. package/dist/cli/sync.js +2 -2
  72. package/dist/common/retry-button.d.ts +12 -0
  73. package/dist/common/retry-button.d.ts.map +1 -0
  74. package/dist/common/retry-button.js +22 -0
  75. package/dist/common/retry-button.module.css +58 -0
  76. package/dist/common/retry-button.module.css.d.ts +8 -0
  77. package/dist/controls/sync-button.d.ts +3 -0
  78. package/dist/controls/sync-button.d.ts.map +1 -1
  79. package/dist/dashboard/bar-list.d.ts +18 -4
  80. package/dist/dashboard/bar-list.d.ts.map +1 -1
  81. package/dist/dashboard/bar-list.js +39 -15
  82. package/dist/dashboard/bar-list.module.css +77 -2
  83. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  84. package/dist/dashboard/delta-badge.d.ts +8 -3
  85. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  86. package/dist/dashboard/delta-badge.js +9 -2
  87. package/dist/dashboard/index.d.ts +2 -0
  88. package/dist/dashboard/index.d.ts.map +1 -1
  89. package/dist/dashboard/meter-model.d.ts +53 -6
  90. package/dist/dashboard/meter-model.d.ts.map +1 -1
  91. package/dist/dashboard/meter-model.js +62 -14
  92. package/dist/dashboard/meter-parts.d.ts +5 -1
  93. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  94. package/dist/dashboard/meter-parts.js +140 -68
  95. package/dist/dashboard/meter.d.ts +29 -4
  96. package/dist/dashboard/meter.d.ts.map +1 -1
  97. package/dist/dashboard/meter.js +8 -1
  98. package/dist/dashboard/meter.module.css +74 -43
  99. package/dist/dashboard/meter.module.css.d.ts +4 -4
  100. package/dist/dashboard/query-state.d.ts +1 -1
  101. package/dist/dashboard/query-state.d.ts.map +1 -1
  102. package/dist/dashboard/query-state.js +16 -10
  103. package/dist/dashboard/settings-section.d.ts.map +1 -1
  104. package/dist/dashboard/settings-section.js +14 -25
  105. package/dist/dashboard/stat-card-parts.js +1 -1
  106. package/dist/dashboard/stat-card.d.ts +1 -1
  107. package/dist/dashboard/stat-card.d.ts.map +1 -1
  108. package/dist/dashboard/stat-card.js +5 -7
  109. package/dist/dashboard/stat-card.module.css +15 -7
  110. package/dist/dashboard/stat-group.d.ts +11 -2
  111. package/dist/dashboard/stat-group.d.ts.map +1 -1
  112. package/dist/dashboard/stat-group.js +9 -7
  113. package/dist/dashboard/stat-strip.d.ts +67 -0
  114. package/dist/dashboard/stat-strip.d.ts.map +1 -0
  115. package/dist/dashboard/stat-strip.js +115 -0
  116. package/dist/dashboard/stat-strip.module.css +291 -0
  117. package/dist/dashboard/stat-strip.module.css.d.ts +32 -0
  118. package/dist/dashboard/visual-slot.d.ts +2 -0
  119. package/dist/dashboard/visual-slot.d.ts.map +1 -0
  120. package/dist/dashboard/visual-slot.js +5 -0
  121. package/dist/dashboard/widget-header.d.ts +3 -3
  122. package/dist/dashboard/widget-header.module.css +10 -6
  123. package/dist/format/date.d.ts.map +1 -1
  124. package/dist/format/date.js +4 -3
  125. package/dist/format/shared.d.ts +6 -0
  126. package/dist/format/shared.d.ts.map +1 -1
  127. package/dist/format/shared.js +6 -2
  128. package/dist/guard/index.d.ts +16 -3
  129. package/dist/guard/index.d.ts.map +1 -1
  130. package/dist/guard/index.js +15 -1
  131. package/dist/guard/palette.d.ts +51 -0
  132. package/dist/guard/palette.d.ts.map +1 -0
  133. package/dist/guard/palette.js +190 -0
  134. package/dist/guard/series-file.d.ts +15 -0
  135. package/dist/guard/series-file.d.ts.map +1 -0
  136. package/dist/guard/series-file.js +29 -0
  137. package/dist/guard/types.d.ts +3 -3
  138. package/dist/guard/types.d.ts.map +1 -1
  139. package/dist/index.d.ts +3 -1
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +4 -0
  142. package/dist/styles.css +6 -0
  143. package/dist/surfaces.d.ts +1 -1
  144. package/dist/surfaces.d.ts.map +1 -1
  145. package/dist/surfaces.js +2 -0
  146. package/dist/theme/card-inset.module.css +76 -0
  147. package/dist/theme/card-inset.module.css.d.ts +9 -0
  148. package/dist/theme/controls.module.css +13 -0
  149. package/dist/theme/index.d.ts.map +1 -1
  150. package/dist/theme/index.js +41 -0
  151. package/dist/theme/nav-link.module.css +8 -10
  152. package/dist/theme/status-dot.d.ts +3 -2
  153. package/dist/theme/status-dot.d.ts.map +1 -1
  154. package/dist/theme/status-dot.js +12 -3
  155. package/dist/theme/status-verdict.d.ts +3 -2
  156. package/dist/theme/status-verdict.d.ts.map +1 -1
  157. package/dist/theme/status-verdict.js +3 -2
  158. package/dist/theme/status-verdict.module.css +4 -2
  159. package/dist/tokens/oklab.d.ts +28 -0
  160. package/dist/tokens/oklab.d.ts.map +1 -0
  161. package/dist/tokens/oklab.js +73 -0
  162. package/llms.txt +33 -7
  163. package/package.json +1 -1
  164. package/src/charts/ChartCard.tsx +79 -5
  165. package/src/charts/Donut.tsx +9 -1
  166. package/src/charts/Heatmap.tsx +1 -1
  167. package/src/charts/Sparkline.tsx +180 -18
  168. package/src/charts/box.tsx +2 -0
  169. package/src/charts/chart-box.module.css +30 -0
  170. package/src/charts/chart-box.module.css.d.ts +1 -0
  171. package/src/charts/chart-card.module.css +47 -0
  172. package/src/charts/chart-card.module.css.d.ts +7 -0
  173. package/src/charts/compile.ts +42 -9
  174. package/src/charts/host.tsx +6 -3
  175. package/src/charts/index.ts +1 -1
  176. package/src/charts/sparkline.module.css +59 -0
  177. package/src/charts/sparkline.module.css.d.ts +13 -0
  178. package/src/charts/state.tsx +53 -4
  179. package/src/charts/types.ts +6 -0
  180. package/src/cli/check-theme.ts +3 -0
  181. package/src/cli/help.ts +18 -1
  182. package/src/cli/index.ts +48 -17
  183. package/src/cli/init.ts +2 -1
  184. package/src/cli/shot/capture.ts +15 -2
  185. package/src/cli/shot/detect.ts +533 -0
  186. package/src/cli/shot/index.ts +8 -4
  187. package/src/cli/shot/measure.ts +4 -0
  188. package/src/cli/shot/types.ts +5 -1
  189. package/src/cli/sync.ts +4 -2
  190. package/src/common/retry-button.module.css +58 -0
  191. package/src/common/retry-button.module.css.d.ts +8 -0
  192. package/src/common/retry-button.tsx +29 -0
  193. package/src/controls/sync-button.tsx +3 -0
  194. package/src/dashboard/bar-list.module.css +77 -2
  195. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  196. package/src/dashboard/bar-list.tsx +89 -18
  197. package/src/dashboard/delta-badge.tsx +21 -5
  198. package/src/dashboard/index.ts +2 -0
  199. package/src/dashboard/meter-model.ts +126 -20
  200. package/src/dashboard/meter-parts.tsx +224 -88
  201. package/src/dashboard/meter.module.css +74 -43
  202. package/src/dashboard/meter.module.css.d.ts +4 -4
  203. package/src/dashboard/meter.tsx +39 -5
  204. package/src/dashboard/query-state.tsx +26 -20
  205. package/src/dashboard/settings-section.tsx +1 -8
  206. package/src/dashboard/stat-card-parts.tsx +1 -1
  207. package/src/dashboard/stat-card.module.css +15 -7
  208. package/src/dashboard/stat-card.tsx +9 -9
  209. package/src/dashboard/stat-group.tsx +19 -8
  210. package/src/dashboard/stat-strip.module.css +291 -0
  211. package/src/dashboard/stat-strip.module.css.d.ts +32 -0
  212. package/src/dashboard/stat-strip.tsx +263 -0
  213. package/src/dashboard/visual-slot.ts +8 -0
  214. package/src/dashboard/widget-header.module.css +10 -6
  215. package/src/dashboard/widget-header.tsx +3 -3
  216. package/src/format/date.ts +6 -3
  217. package/src/format/shared.ts +11 -2
  218. package/src/guard/index.ts +17 -5
  219. package/src/guard/palette.ts +261 -0
  220. package/src/guard/series-file.ts +51 -0
  221. package/src/guard/types.ts +3 -2
  222. package/src/index.ts +7 -0
  223. package/src/styles.css +6 -0
  224. package/src/surfaces.ts +2 -0
  225. package/src/theme/__snapshots__/plain-theme.test.ts.snap +202 -24
  226. package/src/theme/card-inset.module.css +76 -0
  227. package/src/theme/card-inset.module.css.d.ts +9 -0
  228. package/src/theme/controls.module.css +13 -0
  229. package/src/theme/index.ts +56 -0
  230. package/src/theme/nav-link.module.css +8 -10
  231. package/src/theme/status-dot.tsx +17 -5
  232. package/src/theme/status-verdict.module.css +4 -2
  233. package/src/theme/status-verdict.tsx +9 -4
  234. package/src/tokens/oklab.ts +97 -0
@@ -4,17 +4,16 @@
4
4
  */
5
5
  declare const classes: {
6
6
  readonly root: string
7
- readonly zoned: string
7
+ readonly summary: string
8
8
  readonly track: string
9
9
  readonly trackBox: string
10
10
  readonly fill: string
11
11
  readonly forecastFill: string
12
12
  readonly zone: string
13
- readonly zoneBand: string
13
+ readonly labelRow: string
14
+ readonly rowLabel: string
14
15
  readonly zoneLabel: string
15
16
  readonly zoneLabelHolding: string
16
- readonly zoneList: string
17
- readonly zoneListItem: string
18
17
  readonly zoneReadingRow: string
19
18
  readonly zoneReading: string
20
19
  readonly marker: string
@@ -35,5 +34,6 @@ declare const classes: {
35
34
  readonly ringArc: string
36
35
  readonly ringValue: string
37
36
  readonly skeletonRing: string
37
+ readonly row: string
38
38
  }
39
39
  export default classes
@@ -4,9 +4,10 @@
4
4
  * along is this against a limit"; choose `BarList` for a ranking and a chart for a trend. An HTML/CSS
5
5
  * primitive, not a chart kind (no scale, axis or tooltip).
6
6
  *
7
- * Colour law: the fill is neutral (`VX.line`). `color` is for a VERDICT only (over budget, below
8
- * target) and is a status colour the consumer passes; categorical `segments` take the consumer's
9
- * series colours. Committed vs forecast is the same neutral at two strengths — never colour alone: a
7
+ * Colour law: a plain `value` bar's fill is neutral (`--vx-muted` at a strength that holds 3:1 on
8
+ * the track; `tone="ink"` for full ink); `segments` and `zones` keep their own fills. `color` is
9
+ * for a VERDICT only (over budget, below target) and is a status colour the consumer passes;
10
+ * categorical `segments` take the consumer's series colours. Committed vs forecast is the same neutral at two strengths — never colour alone: a
10
11
  * tick marks the boundary and a caption names the forecast. A value past `max` clamps the fill at the
11
12
  * track end; the caption still states the real value.
12
13
  *
@@ -53,7 +54,7 @@
53
54
  import type { ReactNode } from 'react'
54
55
  import type { BasaltProps } from '../common/props'
55
56
  import { isReading, normalizeSegments, segmentReading, spanOf } from './meter-model'
56
- import type { MeterSegment, MeterZone } from './meter-model'
57
+ import type { MeterSegment, MeterTick, MeterZone } from './meter-model'
57
58
  import { MeterBar, MeterEmpty, MeterLoading, MeterRing } from './meter-parts'
58
59
  import { asText } from './scale'
59
60
 
@@ -76,6 +77,27 @@ type BarCommon = Common & {
76
77
  shape?: 'bar'
77
78
  /** Target position; draws a tick and states it in the end caption (with the overage past it). */
78
79
  target?: number
80
+ /**
81
+ * More marks on the track (cut-offs, a window mean). Each is drawn at `at`; a `label` is captioned
82
+ * above the track, or on a zoned Meter in the zone-name row (the end ticks at the row's ends). A
83
+ * caption that would collide with another hides. A tick outside `[min, max]` is dropped, not
84
+ * clamped. All are listed in the accessible description. Works with `value`, `zones`, `segments`
85
+ * and `target`.
86
+ */
87
+ ticks?: readonly MeterTick[]
88
+ /**
89
+ * `'muted'` (default for a plain `value` bar; `segments` and `zones` keep their fills): a
90
+ * non-verdict fill (a load, not a verdict) in `--vx-muted` at a strength that holds 3:1 against
91
+ * the track in both schemes — the ink fill is near-white in dark. `'ink'` restores the full-ink
92
+ * `--vx-line` fill. A `color` wins over both.
93
+ */
94
+ tone?: 'muted' | 'ink'
95
+ /**
96
+ * `'row'`: in-line use — a track one text line tall and no caption rows (reading, target, forecast,
97
+ * part, zone and tick captions). The label stays as `aria-label`; the described-by text keeps the
98
+ * rest. Put the value beside it in your own layout.
99
+ */
100
+ size?: 'row'
79
101
  /** Start caption (default: the formatted reading). `null` drops it. */
80
102
  startCaption?: ReactNode
81
103
  /** End caption (default: `Target <target>`). `null` drops it. */
@@ -125,6 +147,9 @@ export type MeterProps =
125
147
  segments?: never
126
148
  zones?: never
127
149
  target?: never
150
+ ticks?: never
151
+ tone?: never
152
+ size?: never
128
153
  startCaption?: never
129
154
  endCaption?: never
130
155
  })
@@ -139,9 +164,16 @@ function warnInvalidTrack(min: number, max: number) {
139
164
  )
140
165
  }
141
166
 
167
+ /** Muted is the default for a plain `value` bar only; `segments`/`zones` keep their fills unless asked. */
168
+ function barTone(tone: 'muted' | 'ink' | undefined, plain: boolean): 'muted' | undefined {
169
+ if (tone === 'ink') return undefined
170
+ return tone === 'muted' || plain ? 'muted' : undefined
171
+ }
172
+
142
173
  export function Meter(props: MeterProps) {
143
174
  const { label, min = 0, max = 100, format = asText, className, style } = props
144
- const shell = { className, style }
175
+ const row = props.size === 'row'
176
+ const shell = { className, style, row }
145
177
  const ring = props.shape === 'ring'
146
178
  warnInvalidTrack(min, max)
147
179
 
@@ -165,6 +197,8 @@ export function Meter(props: MeterProps) {
165
197
  segments={segments}
166
198
  zones={props.zones}
167
199
  target={isReading(props.target) ? props.target : undefined}
200
+ ticks={props.ticks}
201
+ tone={barTone(props.tone, props.segments === undefined && props.zones === undefined)}
168
202
  forecastCaption={props.segments === undefined ? undefined : props.forecastCaption}
169
203
  startCaption={props.startCaption}
170
204
  endCaption={props.endCaption}
@@ -14,11 +14,14 @@
14
14
  * the re-derivation this exists to delete. `LoadingState` / `ErrorState` ship alongside as the
15
15
  * escape hatch for a page that must place its branches in different DOM positions.
16
16
  */
17
- import { Alert, Button, Center, Group, Loader, Stack, Text } from '@mantine/core'
17
+ import { Center, Group, Loader, Stack, Text } from '@mantine/core'
18
18
  import type { CSSProperties, ReactNode } from 'react'
19
19
  import { toErrorMessage } from '../common/errors'
20
20
  import { cx } from '../common/props'
21
+ import { RetryButton } from '../common/retry-button'
21
22
  import type { BasaltProps, SlotStylesProps } from '../common/props'
23
+ import { VX } from '../tokens'
24
+ import { StatusDot } from '../theme/status-dot'
22
25
  import { EmptyState } from './empty-state'
23
26
  import { assertQueryStateLike } from '../common/query-state-like'
24
27
  import type { QueryStateLike } from '../common/query-state-like'
@@ -102,7 +105,7 @@ export type ErrorStateProps = BasaltProps & {
102
105
  /** Shown only when the server body carries no readable message. */
103
106
  fallback?: string
104
107
  onRetry?: () => void
105
- /** Disables/spins the retry button while a refetch is in flight. */
108
+ /** Disables the retry button while a refetch is in flight. */
106
109
  retrying?: boolean
107
110
  /** How loud this state is. Default `'page'`. */
108
111
  tier?: QueryStateTier
@@ -126,28 +129,31 @@ export function ErrorState({
126
129
  style,
127
130
  }: ErrorStateProps): ReactNode {
128
131
  const resolved = tier ?? 'page'
132
+ // D28: a status dot + a word + the message + the retry, on the neutral surface — never a
133
+ // red-tinted filled panel (SPEC § 6.12).
129
134
  const alert = (
130
- <Alert
131
- color="red"
132
- variant="light"
133
- title={title}
135
+ <Stack
136
+ gap="xs"
137
+ role="alert"
134
138
  {...(resolved === 'section' && className !== undefined && { className })}
135
139
  {...(resolved === 'section' && style !== undefined && { style })}
136
140
  >
137
- <Stack gap="sm">
138
- <Text size="sm">{toErrorMessage(error, fallback)}</Text>
139
- {(onRetry ?? action) !== undefined && (
140
- <Group gap="xs">
141
- {onRetry && (
142
- <Button size="xs" variant="default" loading={retrying} onClick={onRetry}>
143
- Retry
144
- </Button>
145
- )}
146
- {action}
147
- </Group>
148
- )}
149
- </Stack>
150
- </Alert>
141
+ <Group gap="xs" wrap="nowrap">
142
+ <StatusDot color={VX.status.bad} />
143
+ <Text size="sm" fw={500}>
144
+ {title}
145
+ </Text>
146
+ </Group>
147
+ <Text size="sm" c="dimmed">
148
+ {toErrorMessage(error, fallback)}
149
+ </Text>
150
+ {(onRetry ?? action) !== undefined && (
151
+ <Group gap="xs">
152
+ {onRetry && <RetryButton onClick={onRetry} retrying={retrying} />}
153
+ {action}
154
+ </Group>
155
+ )}
156
+ </Stack>
151
157
  )
152
158
  if (resolved === 'section') return alert
153
159
  return (
@@ -79,13 +79,7 @@ export function SettingsSection({
79
79
  classNames,
80
80
  }: SettingsSectionProps) {
81
81
  return (
82
- <Card
83
- className={cx(classNames?.root, className)}
84
- style={{
85
- padding: 'var(--vx-space-card-inset-y, 0.75rem) var(--vx-space-card-inset-x, 1rem)',
86
- ...style,
87
- }}
88
- >
82
+ <Card className={cx(classNames?.root, className)} style={style}>
89
83
  <div className={cx(classes.header, classNames?.header)}>
90
84
  <WidgetHeader
91
85
  tier="section"
@@ -158,7 +152,6 @@ export function DangerZone({
158
152
  <Card
159
153
  className={cx(classNames?.root, className)}
160
154
  style={{
161
- padding: 'var(--vx-space-card-inset-y, 0.75rem) var(--vx-space-card-inset-x, 1rem)',
162
155
  boxShadow: `${VX.shadowCard}, 0 0 0 1px ${alpha(VX.status.bad, 0.25)}`,
163
156
  ...style,
164
157
  }}
@@ -41,7 +41,7 @@ export function CaptionRow({ title, icon, info, qualifier, tone, actions }: Capt
41
41
  <div className={classes.lead}>
42
42
  <h3 className={classes.caption}>
43
43
  {icon !== undefined && <IconSlot className={classes.icon}>{icon}</IconSlot>}
44
- <span className={classes.captionText} data-widget-title>
44
+ <span className={classes.captionText} title={title} data-widget-title>
45
45
  {title}
46
46
  </span>
47
47
  </h3>
@@ -12,6 +12,9 @@
12
12
  --basalt-stat-visual-h: 1.375rem;
13
13
  --basalt-stat-footer-h: 1.25rem;
14
14
  --basalt-stat-foot-gap: 0.25rem;
15
+ /* The line a Sparkline's hover readout takes above its plot (`charts/sparkline.module.css` reads
16
+ * it too). A slot that cannot spare it reserves it as padding, so the chip never covers the hero. */
17
+ --basalt-spark-readout-h: 1.125rem;
15
18
  /* The figure's size and line box, in one place: `.value`, the empty line and the pending skeleton
16
19
  * all read them, so nothing moves when a reading lands. */
17
20
  --basalt-stat-figure-size: var(--vx-text-kpi);
@@ -86,7 +89,6 @@
86
89
  }
87
90
 
88
91
  .qualifier {
89
- font-family: var(--basalt-font-mono);
90
92
  font-size: var(--vx-text-micro);
91
93
  color: var(--vx-muted);
92
94
  /* Wraps before it is ever cut: a qualifier too long for the row on its own line breaks its words. */
@@ -128,7 +130,8 @@
128
130
  .value {
129
131
  min-width: 0;
130
132
  overflow-wrap: anywhere;
131
- font-family: var(--basalt-font-mono);
133
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
134
+ font-variant-numeric: lining-nums;
132
135
  font-size: var(--basalt-stat-figure-size);
133
136
  line-height: var(--basalt-stat-figure-line);
134
137
  font-weight: 500;
@@ -136,11 +139,12 @@
136
139
  color: var(--vx-ink);
137
140
  }
138
141
 
139
- /* Mono like the number it qualifies, `sm` and muted: the SMALL half of the pair. Never shrinks — a
142
+ /* Sans like the number it qualifies, `sm` and muted: the SMALL half of the pair. Never shrinks — a
140
143
  * unit clipped to `TS…` would state nothing. */
141
144
  .unit {
142
145
  flex-shrink: 0;
143
- font-family: var(--basalt-font-mono);
146
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
147
+ font-variant-numeric: lining-nums;
144
148
  font-size: var(--vx-text-sm);
145
149
  font-weight: 500;
146
150
  color: var(--vx-muted);
@@ -306,12 +310,13 @@
306
310
  color: var(--vx-muted);
307
311
  }
308
312
 
309
- /* Mono and ink — a breakdown value is a number, and it is the half of the row worth reading. Never
313
+ /* Sans and ink — a breakdown value is a number, and it is the half of the row worth reading. Never
310
314
  * shrinks: the LABEL is the prose half and the one that may ellipsize. */
311
315
  .breakdownValue {
312
316
  flex-shrink: 0;
313
317
  margin: 0;
314
- font-family: var(--basalt-font-mono);
318
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
319
+ font-variant-numeric: lining-nums;
315
320
  font-size: var(--vx-text-sm);
316
321
  font-weight: 500;
317
322
  color: var(--vx-ink);
@@ -353,6 +358,7 @@
353
358
  .sparklineRight:has(> [data-basalt-meter]) {
354
359
  flex: 1 1 auto;
355
360
  height: auto;
361
+ padding-top: 0;
356
362
  overflow: visible;
357
363
  align-items: stretch;
358
364
  }
@@ -367,7 +373,9 @@
367
373
  display: flex;
368
374
  flex: 0 1 var(--basalt-stat-sparkline-w, 4.5rem);
369
375
  min-width: 0;
370
- height: var(--basalt-stat-sparkline-h, 1.375rem);
376
+ /* The slot clips, so it holds the Sparkline's readout line inside its own box (padding-top). */
377
+ height: calc(var(--basalt-stat-sparkline-h, 1.375rem) + var(--basalt-spark-readout-h));
378
+ padding-top: var(--basalt-spark-readout-h);
371
379
  align-items: flex-end;
372
380
  align-self: flex-end;
373
381
  overflow: hidden;
@@ -5,7 +5,7 @@
5
5
  * 1. the CAPTION row — `title` as a mono uppercase `micro` faint label, the optional `info` glyph,
6
6
  * `qualifier` right-aligned (period, target or source; it takes its own line UNDER the caption,
7
7
  * left-aligned, when the card is too narrow for both), and the `actions` slot;
8
- * 2. the VALUE row — the hero figure (`kpi`, mono 500), `unit` inline at `sm` muted on the same
8
+ * 2. the VALUE row — the hero figure (`kpi`, sans 500, lining), `unit` inline at `sm` muted on the same
9
9
  * baseline, then the delta (text only — see `DeltaBadge`) and its muted `deltaPeriod`;
10
10
  * 3. the FOOT — the `sparkline` visual (22 px, bled to the card's side edges) and one muted `sm`
11
11
  * `subtitle` line under it (a source or "as of", never a restatement of the caption).
@@ -112,6 +112,7 @@ import type { BasaltProps, SlotStylesProps, Tone } from '../common/props'
112
112
  import { ErrorState, QueryState, resolveQueryBranch } from './query-state'
113
113
  import type { QueryBranch, QueryStateLike } from './query-state'
114
114
  import classes from './stat-card.module.css'
115
+ import { VisualSlotContext } from './visual-slot'
115
116
 
116
117
  /**
117
118
  * The boxes `StatCard` paints, and the whole styling seam it offers (`common/props.ts`).
@@ -211,7 +212,7 @@ export type StatCardProps = BasaltProps &
211
212
  Omit<WidgetHeaderTitleProps, 'subtitle'> &
212
213
  Omit<WidgetHeaderMetricProps, 'value'> &
213
214
  WidgetHeaderDeltaProps & {
214
- /** Pre-formatted hero figure (mono `kpi`, weight 500, ink). Required here, unlike on
215
+ /** Pre-formatted hero figure (sans `kpi`, weight 500, lining, ink). Required here, unlike on
215
216
  * `WidgetHeader`: see the type's own doc. */
216
217
  value: string
217
218
  /**
@@ -448,7 +449,9 @@ export function StatCard({
448
449
  >
449
450
  {/* A measured slot renders nothing on the first commit (width 0) — an SVG at width 0 is a
450
451
  visible 0-width box that then jumps, which is worse than one frame of nothing. */}
451
- {isRender ? measured.width > 0 && sparkline(measured) : sparkline}
452
+ <VisualSlotContext.Provider value>
453
+ {isRender ? measured.width > 0 && sparkline(measured) : sparkline}
454
+ </VisualSlotContext.Provider>
452
455
  </div>
453
456
  )
454
457
 
@@ -490,11 +493,9 @@ export function StatCard({
490
493
  <Card
491
494
  className={cx(classNames?.root, className)}
492
495
  style={{
493
- // Card inset = the `cardInsetY`/`cardInsetX` role tokens (12/16 at level 0, the `sm`/`md`
494
- // rungs of the spacing grid), matching every other basalt card because `ChartCard` reads
495
- // the SAME two vars. Below `sm` the horizontal one steps a rung down (to 12) on its own:
496
- // the responsive half of the ladder lives in `spaceMobileDecls` (`tokens/index.ts`), which
497
- // is the only home that can reach an inline style like this one.
496
+ // The inset is the theme's (`card-inset.module.css`: the `cardInsetY`/`cardInsetX` tokens, 12/16
497
+ // at level 0, stepping the horizontal one down a rung below `sm`), so it is NOT restated here —
498
+ // an inline copy would bypass `variant="flush"`.
498
499
  //
499
500
  // `overflow: hidden` clips the full-bleed sparkline to the card's rounded corners. An
500
501
  // element's own `box-shadow` renders outside its border box and is NOT clipped by its own
@@ -502,7 +503,6 @@ export function StatCard({
502
503
  //
503
504
  // NO `minHeight`: the content states the height (the foot reserves its own), and cards in a
504
505
  // grid row stretch to the tallest.
505
- padding: 'var(--vx-space-card-inset-y, 0.75rem) var(--vx-space-card-inset-x, 1rem)',
506
506
  overflow: 'hidden',
507
507
  // Consumers may anchor overlays (badges, menus) to the card, so it stays a positioned box.
508
508
  position: 'relative',
@@ -21,6 +21,8 @@
21
21
  * rule on the GROUP, so the cells stay whatever they are; on `StatCard`s (which carry their own
22
22
  * panel and shadow ring) the rail reads as a second frame, so pair it with unadorned children.
23
23
  *
24
+ * `variant="strip"` is the joined-surface form with typed cells and a footer row (`stat-strip.tsx`).
25
+ *
24
26
  * @example
25
27
  * import { StatCard, StatGroup } from 'basalt-ui'
26
28
  *
@@ -33,12 +35,15 @@
33
35
  import type { CSSProperties, ReactNode } from 'react'
34
36
  import { cx } from '../common/props'
35
37
  import type { BasaltProps } from '../common/props'
38
+ import { StatStrip } from './stat-strip'
39
+ import type { StatStripProps } from './stat-strip'
36
40
  import classes from './stat-group.module.css'
37
41
 
38
42
  /** The desktop KPI column count. */
39
43
  export type StatGroupCols = 2 | 3 | 4 | 5
40
44
 
41
- export type StatGroupProps = BasaltProps & {
45
+ export type StatGridProps = BasaltProps & {
46
+ variant?: 'grid'
42
47
  /** The DESKTOP column count (`lg` and up). Default `4`. `sm` gets `min(cols, 3)` — except `4`, which gets 2 rather than an orphan row. A phone gets 2.
43
48
  * Never a responsive object — the law is basalt's, see the module docblock. */
44
49
  cols?: StatGroupCols
@@ -48,13 +53,19 @@ export type StatGroupProps = BasaltProps & {
48
53
  children: ReactNode
49
54
  }
50
55
 
51
- export function StatGroup({
52
- cols = 4,
53
- divided = false,
54
- children,
55
- className,
56
- style,
57
- }: StatGroupProps) {
56
+ /** `variant="strip"`: one joined surface of typed `cells` split by hairlines, plus an optional
57
+ * `footer` row — see `StatStripProps`. `cols` here may be 6 (the strip's desktop count). */
58
+ export type StatGroupProps = StatGridProps | ({ variant: 'strip' } & StatStripProps)
59
+
60
+ export function StatGroup(props: StatGroupProps) {
61
+ if (props.variant === 'strip') {
62
+ const { variant: _variant, ...strip } = props
63
+ return <StatStrip {...strip} />
64
+ }
65
+ return <StatGrid {...props} />
66
+ }
67
+
68
+ function StatGrid({ cols = 4, divided = false, children, className, style }: StatGridProps) {
58
69
  // `4 -> 2`, not `4 -> 3`. `min(cols, 3)` is the general rule and it is right for 2, 3 and 5, but
59
70
  // FOUR is the default and the overwhelmingly common count, and three columns leave a four-KPI row
60
71
  // as 3 + 1 — one orphan cell against two thirds of empty track. MEASURED on the playground