basalt-ui 2.17.0 → 2.19.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 (120) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/MIGRATING.md +108 -12
  3. package/agent/agents/basalt-design-reviewer.md +2 -2
  4. package/agent/skills/basalt-design/SKILL.md +1 -1
  5. package/dist/cli/help.d.ts +1 -0
  6. package/dist/cli/help.d.ts.map +1 -1
  7. package/dist/cli/help.js +8 -2
  8. package/dist/cli/shot/capture.d.ts +12 -1
  9. package/dist/cli/shot/capture.d.ts.map +1 -1
  10. package/dist/cli/shot/capture.js +72 -10
  11. package/dist/cli/shot/index.d.ts +10 -1
  12. package/dist/cli/shot/index.d.ts.map +1 -1
  13. package/dist/cli/shot/index.js +40 -5
  14. package/dist/cli/shot/real-data.d.ts +35 -0
  15. package/dist/cli/shot/real-data.d.ts.map +1 -0
  16. package/dist/cli/shot/real-data.js +120 -0
  17. package/dist/cli/shot/serve.d.ts +2 -2
  18. package/dist/cli/shot/serve.d.ts.map +1 -1
  19. package/dist/cli/shot/serve.js +16 -2
  20. package/dist/commands/notifications/center.d.ts.map +1 -1
  21. package/dist/commands/notifications/center.js +18 -26
  22. package/dist/content/callout.d.ts +1 -1
  23. package/dist/content/callout.d.ts.map +1 -1
  24. package/dist/content/callout.js +10 -1
  25. package/dist/content/callout.module.css +15 -3
  26. package/dist/content/callout.module.css.d.ts +1 -0
  27. package/dist/dashboard/bar-list.d.ts +29 -0
  28. package/dist/dashboard/bar-list.d.ts.map +1 -0
  29. package/dist/dashboard/bar-list.js +65 -0
  30. package/dist/dashboard/bar-list.module.css +91 -0
  31. package/dist/dashboard/bar-list.module.css.d.ts +17 -0
  32. package/dist/dashboard/index.d.ts +2 -0
  33. package/dist/dashboard/index.d.ts.map +1 -1
  34. package/dist/dashboard/index.js +4 -0
  35. package/dist/dashboard/meter-model.d.ts +126 -0
  36. package/dist/dashboard/meter-model.d.ts.map +1 -0
  37. package/dist/dashboard/meter-model.js +135 -0
  38. package/dist/dashboard/meter-parts.d.ts +42 -0
  39. package/dist/dashboard/meter-parts.d.ts.map +1 -0
  40. package/dist/dashboard/meter-parts.js +297 -0
  41. package/dist/dashboard/meter.d.ts +123 -0
  42. package/dist/dashboard/meter.d.ts.map +1 -0
  43. package/dist/dashboard/meter.js +43 -0
  44. package/dist/dashboard/meter.module.css +268 -0
  45. package/dist/dashboard/meter.module.css.d.ts +39 -0
  46. package/dist/dashboard/scale.d.ts +9 -0
  47. package/dist/dashboard/scale.d.ts.map +1 -0
  48. package/dist/dashboard/scale.js +10 -0
  49. package/dist/dashboard/stat-card-parts.d.ts +3 -1
  50. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  51. package/dist/dashboard/stat-card-parts.js +18 -3
  52. package/dist/dashboard/stat-card.d.ts +6 -5
  53. package/dist/dashboard/stat-card.d.ts.map +1 -1
  54. package/dist/dashboard/stat-card.js +48 -77
  55. package/dist/dashboard/stat-card.module.css +27 -7
  56. package/dist/dashboard/widget-header.d.ts.map +1 -1
  57. package/dist/dashboard/widget-header.js +2 -1
  58. package/dist/dashboard/widget-header.module.css +28 -1
  59. package/dist/index.d.ts +1 -1
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +5 -1
  62. package/dist/theme/chrome-vars.d.ts +29 -17
  63. package/dist/theme/chrome-vars.d.ts.map +1 -1
  64. package/dist/theme/chrome-vars.js +18 -8
  65. package/dist/theme/index.d.ts.map +1 -1
  66. package/dist/theme/index.js +9 -5
  67. package/dist/theme/status-dot.d.ts +6 -0
  68. package/dist/theme/status-dot.d.ts.map +1 -0
  69. package/dist/theme/status-dot.js +9 -0
  70. package/dist/theme/status-dot.module.css +9 -0
  71. package/dist/theme/status-dot.module.css.d.ts +8 -0
  72. package/dist/theme/status-verdict.d.ts +9 -0
  73. package/dist/theme/status-verdict.d.ts.map +1 -0
  74. package/dist/theme/status-verdict.js +13 -0
  75. package/dist/theme/status-verdict.module.css +23 -0
  76. package/dist/theme/status-verdict.module.css.d.ts +9 -0
  77. package/dist/tokens/derive.d.ts +11 -1
  78. package/dist/tokens/derive.d.ts.map +1 -1
  79. package/dist/tokens/derive.js +9 -24
  80. package/dist/tokens/status-text.d.ts +26 -0
  81. package/dist/tokens/status-text.d.ts.map +1 -0
  82. package/dist/tokens/status-text.js +68 -0
  83. package/llms.txt +32 -3
  84. package/package.json +1 -1
  85. package/src/cli/help.ts +22 -2
  86. package/src/cli/shot/capture.ts +98 -9
  87. package/src/cli/shot/index.ts +50 -4
  88. package/src/cli/shot/real-data.ts +165 -0
  89. package/src/cli/shot/serve.ts +28 -3
  90. package/src/commands/notifications/center.tsx +29 -32
  91. package/src/content/callout.module.css +15 -3
  92. package/src/content/callout.module.css.d.ts +1 -0
  93. package/src/content/callout.tsx +15 -2
  94. package/src/dashboard/bar-list.module.css +91 -0
  95. package/src/dashboard/bar-list.module.css.d.ts +17 -0
  96. package/src/dashboard/bar-list.tsx +125 -0
  97. package/src/dashboard/index.ts +2 -0
  98. package/src/dashboard/meter-model.ts +254 -0
  99. package/src/dashboard/meter-parts.tsx +407 -0
  100. package/src/dashboard/meter.module.css +268 -0
  101. package/src/dashboard/meter.module.css.d.ts +39 -0
  102. package/src/dashboard/meter.tsx +173 -0
  103. package/src/dashboard/scale.ts +13 -0
  104. package/src/dashboard/stat-card-parts.tsx +22 -2
  105. package/src/dashboard/stat-card.module.css +27 -7
  106. package/src/dashboard/stat-card.tsx +18 -52
  107. package/src/dashboard/widget-header.module.css +28 -1
  108. package/src/dashboard/widget-header.tsx +4 -1
  109. package/src/index.ts +4 -0
  110. package/src/theme/__snapshots__/plain-theme.test.ts.snap +88 -16
  111. package/src/theme/chrome-vars.ts +48 -23
  112. package/src/theme/index.ts +10 -6
  113. package/src/theme/status-dot.module.css +9 -0
  114. package/src/theme/status-dot.module.css.d.ts +8 -0
  115. package/src/theme/status-dot.tsx +19 -0
  116. package/src/theme/status-verdict.module.css +23 -0
  117. package/src/theme/status-verdict.module.css.d.ts +9 -0
  118. package/src/theme/status-verdict.tsx +27 -0
  119. package/src/tokens/derive.ts +19 -31
  120. package/src/tokens/status-text.ts +85 -0
@@ -0,0 +1,407 @@
1
+ /** Meter's internal pieces: bar, ring, empty and loading. `meter.tsx` dispatches between them. */
2
+ import { Skeleton, VisuallyHidden } from '@mantine/core'
3
+ import { useId, useRef, useState } from 'react'
4
+ import type { CSSProperties, HTMLAttributes, ReactNode, RefObject } from 'react'
5
+ import { useIsomorphicLayoutEffect } from '../common/isomorphic-layout-effect'
6
+ import { cx } from '../common/props'
7
+ import {
8
+ ariaValues,
9
+ modelBar,
10
+ ringFraction,
11
+ startCaptionText,
12
+ zoneBand,
13
+ zoneLabelsFit,
14
+ } from './meter-model'
15
+ import type { MeterSegment, MeterZone, Part, ZoneLabel } from './meter-model'
16
+ import classes from './meter.module.css'
17
+ import { toPct } from './scale'
18
+
19
+ export type Shell = { className: string | undefined; style: CSSProperties | undefined }
20
+
21
+ /**
22
+ * The one root contract of every Meter state. `data-basalt-meter` is the handle `StatCard` keys its
23
+ * visual slot on (`:has([data-basalt-meter])`), so every state must carry it.
24
+ */
25
+ function rootProps(shell: Shell) {
26
+ return {
27
+ className: cx(classes.root, shell.className),
28
+ style: shell.style,
29
+ 'data-basalt-meter': '',
30
+ } as const
31
+ }
32
+
33
+ const RING_VIEWBOX = 36
34
+ const RING_STROKE = 4
35
+ const RING_RADIUS = (RING_VIEWBOX - RING_STROKE) / 2
36
+ const RING_LENGTH = 2 * Math.PI * RING_RADIUS
37
+ const RING_CENTER = RING_VIEWBOX / 2
38
+
39
+ /** The one ring drawing: a track and, when there is a reading, its arc (a fraction of the circle). */
40
+ function RingSvg({ fraction, color }: { fraction?: number; color?: string | undefined }) {
41
+ return (
42
+ <svg className={classes.ring} viewBox={`0 0 ${RING_VIEWBOX} ${RING_VIEWBOX}`} aria-hidden>
43
+ <circle
44
+ className={classes.ringTrack}
45
+ cx={RING_CENTER}
46
+ cy={RING_CENTER}
47
+ r={RING_RADIUS}
48
+ strokeWidth={RING_STROKE}
49
+ />
50
+ {fraction !== undefined && (
51
+ <circle
52
+ className={classes.ringArc}
53
+ cx={RING_CENTER}
54
+ cy={RING_CENTER}
55
+ r={RING_RADIUS}
56
+ strokeWidth={RING_STROKE}
57
+ strokeDasharray={`${fraction * RING_LENGTH} ${RING_LENGTH}`}
58
+ {...(color !== undefined && { style: { stroke: color } })}
59
+ />
60
+ )}
61
+ </svg>
62
+ )
63
+ }
64
+
65
+ export function MeterLoading({
66
+ label,
67
+ ring,
68
+ shell,
69
+ }: {
70
+ label: string
71
+ ring: boolean
72
+ shell: Shell
73
+ }) {
74
+ return (
75
+ <div {...rootProps(shell)} aria-busy="true">
76
+ <VisuallyHidden>{`Loading ${label}`}</VisuallyHidden>
77
+ {ring ? (
78
+ <Skeleton className={classes.skeletonRing} circle />
79
+ ) : (
80
+ <>
81
+ <Skeleton className={classes.skeletonTrack} />
82
+ <Skeleton className={classes.skeletonCaption} radius="sm" />
83
+ </>
84
+ )}
85
+ </div>
86
+ )
87
+ }
88
+
89
+ export function MeterEmpty(props: { label: string; text: string; ring: boolean; shell: Shell }) {
90
+ const { label, text, ring, shell } = props
91
+ return (
92
+ <output {...rootProps(shell)} aria-label={label}>
93
+ {ring ? (
94
+ <span className={classes.ringBox}>
95
+ <RingSvg />
96
+ </span>
97
+ ) : (
98
+ <div className={classes.trackBox}>
99
+ <div className={classes.track} data-meter-track />
100
+ </div>
101
+ )}
102
+ <span className={classes.empty}>{text}</span>
103
+ </output>
104
+ )
105
+ }
106
+
107
+ export function MeterRing(props: {
108
+ label: string
109
+ reading: number
110
+ min: number
111
+ max: number
112
+ color: string | undefined
113
+ format: (value: number) => string
114
+ shell: Shell
115
+ }) {
116
+ const { label, reading, min, max, color, format, shell } = props
117
+ return (
118
+ <div {...rootProps(shell)}>
119
+ <span
120
+ className={classes.ringBox}
121
+ aria-label={label}
122
+ {...ariaValues(reading, min, max, format)}
123
+ >
124
+ <RingSvg fraction={ringFraction(reading, min, max)} color={color} />
125
+ <span className={classes.ringValue}>{format(reading)}</span>
126
+ </span>
127
+ </div>
128
+ )
129
+ }
130
+
131
+ function fillStyle(p: Part): CSSProperties {
132
+ return { width: `${toPct(p.size)}%`, ...(p.color !== undefined && { background: p.color }) }
133
+ }
134
+
135
+ /** Uncoloured zones step from `MIN` to `MIN + STEP` percent of the neutral, so order reads without hue. */
136
+ const ZONE_STRENGTH_MIN = 15
137
+ const ZONE_STRENGTH_STEP = 45
138
+ const ZONE_STRENGTH_SOLO = 40
139
+ /** Every band after the first gives up its leading pixel, so a boundary never relies on fill strength. */
140
+ const ZONE_GAP = '1px'
141
+
142
+ function zoneStyle(zone: MeterZone, index: number, count: number, min: number, span: number) {
143
+ const band = zoneBand(zone, min, span)
144
+ const gap = index > 0
145
+ const strength =
146
+ count > 1 ? ZONE_STRENGTH_MIN + (index / (count - 1)) * ZONE_STRENGTH_STEP : ZONE_STRENGTH_SOLO
147
+ return {
148
+ insetInlineStart: gap ? `calc(${band.start}% + ${ZONE_GAP})` : `${band.start}%`,
149
+ width: gap ? `calc(${band.width}% - ${ZONE_GAP})` : `${band.width}%`,
150
+ background: zone.color ?? `color-mix(in srgb, var(--vx-line) ${strength}%, transparent)`,
151
+ } satisfies CSSProperties
152
+ }
153
+
154
+ /**
155
+ * Joins the names with a character no label carries, so the effect re-runs only when they change.
156
+ * The holding zone is part of the key: its label is bolder, so a reading that crosses a boundary
157
+ * changes widths with no row resize.
158
+ */
159
+ const labelsKey = (labels: readonly ZoneLabel[]) =>
160
+ labels.map((l) => l.label + (l.holding ? '*' : '')).join('\u0000')
161
+
162
+ /**
163
+ * Whether the zone names fit on the band, re-measured when the row resizes, when web fonts finish
164
+ * loading (a mono swap changes label widths without resizing the row) and when the names change.
165
+ * Server markup shows the band; the list may appear after mount, when the measurement fails.
166
+ */
167
+ function useZoneLabelLayout(rowRef: RefObject<HTMLDivElement | null>, key: string): boolean {
168
+ const [fits, setFits] = useState(true)
169
+
170
+ // Keyed on a string of the names, not the `labels` array: the model rebuilds that every render.
171
+ useIsomorphicLayoutEffect(() => {
172
+ const row = rowRef.current
173
+ if (!row) return
174
+ const measure = () => {
175
+ const origin = row.getBoundingClientRect()
176
+ const boxes = [...row.children].map((c) => {
177
+ const r = c.getBoundingClientRect()
178
+ return { left: r.left - origin.left, right: r.right - origin.left }
179
+ })
180
+ setFits(zoneLabelsFit(boxes, origin.width))
181
+ }
182
+ measure()
183
+ const observer = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(measure)
184
+ observer?.observe(row)
185
+ // `document.fonts` is absent (or partial) outside a full browser; every use is guarded.
186
+ const fonts =
187
+ typeof document === 'undefined' ? undefined : (document.fonts as FontFaceSet | undefined)
188
+ let live = true
189
+ void fonts?.ready?.then(() => live && measure())
190
+ fonts?.addEventListener?.('loadingdone', measure)
191
+ return () => {
192
+ live = false
193
+ observer?.disconnect()
194
+ fonts?.removeEventListener?.('loadingdone', measure)
195
+ }
196
+ }, [rowRef, key])
197
+
198
+ return fits
199
+ }
200
+
201
+ /**
202
+ * The reading on a zoned track, centred on the marker so number and notch are one mark. Measured,
203
+ * its start edge is clamped to the row (a label wider than the row overflows the end, never the
204
+ * start) and placed logically, so it holds under `dir="rtl"`. Observing the label as well as the row
205
+ * catches a font swap that changes its width with no row resize. Until the first measure (server
206
+ * markup) it sits at the marker, centred by a direction-aware translate, and the row clips.
207
+ */
208
+ function ZoneReading({ pct, children }: { pct: number; children: ReactNode }) {
209
+ const rowRef = useRef<HTMLDivElement>(null)
210
+ const textRef = useRef<HTMLSpanElement>(null)
211
+ const [start, setStart] = useState<number>()
212
+ useIsomorphicLayoutEffect(() => {
213
+ const row = rowRef.current
214
+ const text = textRef.current
215
+ if (!row || !text) return
216
+ const measure = () => {
217
+ const centre = (row.clientWidth * pct) / 100
218
+ setStart(
219
+ Math.max(0, Math.min(centre - text.offsetWidth / 2, row.clientWidth - text.offsetWidth)),
220
+ )
221
+ }
222
+ measure()
223
+ if (typeof ResizeObserver === 'undefined') return
224
+ const observer = new ResizeObserver(measure)
225
+ observer.observe(row)
226
+ observer.observe(text)
227
+ return () => observer.disconnect()
228
+ }, [pct])
229
+ return (
230
+ <div ref={rowRef} className={classes.zoneReadingRow} data-meter-reading-row>
231
+ <span
232
+ ref={textRef}
233
+ className={classes.zoneReading}
234
+ data-measured={start === undefined ? undefined : ''}
235
+ style={{ insetInlineStart: start === undefined ? `${pct}%` : `${start}px` }}
236
+ >
237
+ {children}
238
+ </span>
239
+ </div>
240
+ )
241
+ }
242
+
243
+ function ZoneName({ label, ...rest }: { label: ZoneLabel } & HTMLAttributes<HTMLSpanElement>) {
244
+ return (
245
+ <span
246
+ {...rest}
247
+ className={cx(rest.className, label.holding && classes.zoneLabelHolding)}
248
+ data-meter-zone-label={label.label}
249
+ data-holding={label.holding || undefined}
250
+ >
251
+ {label.label}
252
+ </span>
253
+ )
254
+ }
255
+
256
+ /**
257
+ * Names each zone under its band, the holding one in ink and a heavier weight. Labels sit
258
+ * left-aligned at their band start; when two would overlap (or one would leave the row) the band
259
+ * hides and the same names wrap as a list in zone order instead. The band stays laid out (hidden,
260
+ * not removed) so a resize can measure it again. Decorative: the zone names and the holding zone
261
+ * are in the described-by text.
262
+ */
263
+ function ZoneLabels({ labels }: { labels: readonly ZoneLabel[] }) {
264
+ const rowRef = useRef<HTMLDivElement>(null)
265
+ const fits = useZoneLabelLayout(rowRef, labelsKey(labels))
266
+
267
+ return (
268
+ <>
269
+ <div
270
+ ref={rowRef}
271
+ className={classes.zoneBand}
272
+ data-meter-zone-band
273
+ data-collapsed={fits ? undefined : ''}
274
+ aria-hidden
275
+ >
276
+ {labels.map((l) => (
277
+ <ZoneName
278
+ key={l.key}
279
+ label={l}
280
+ className={classes.zoneLabel}
281
+ style={{ insetInlineStart: `${l.startPct}%` }}
282
+ />
283
+ ))}
284
+ </div>
285
+ {!fits && (
286
+ <div className={classes.zoneList} data-meter-zone-list aria-hidden>
287
+ {labels.map((l) => (
288
+ <ZoneName key={l.key} label={l} className={classes.zoneListItem} />
289
+ ))}
290
+ </div>
291
+ )}
292
+ </>
293
+ )
294
+ }
295
+
296
+ export function MeterBar(props: {
297
+ label: string
298
+ reading: number
299
+ min: number
300
+ max: number
301
+ format: (value: number) => string
302
+ color: string | undefined
303
+ segments: readonly MeterSegment[] | undefined
304
+ zones: readonly MeterZone[] | undefined
305
+ target: number | undefined
306
+ forecastCaption: string | undefined
307
+ startCaption: ReactNode
308
+ endCaption: ReactNode
309
+ shell: Shell
310
+ }) {
311
+ const { label, reading, min, max, format, zones, shell } = props
312
+ const describedId = useId()
313
+ const model = modelBar(props)
314
+ const start = startCaptionText(model, props.startCaption)
315
+ const end = props.endCaption === undefined ? model.endText : props.endCaption
316
+ const anchored = model.markerPct !== undefined && start !== null
317
+ const hasCaptions = (start !== null && !anchored) || end !== null || model.forecastText !== null
318
+ const hasParts = model.partCaptions.length > 0
319
+ const describedBy =
320
+ model.describedByText === null ? {} : ({ 'aria-describedby': describedId } as const)
321
+
322
+ const root = rootProps(shell)
323
+ return (
324
+ <div {...root} className={cx(root.className, model.zoneLabels.length > 0 && classes.zoned)}>
325
+ <div
326
+ className={classes.trackBox}
327
+ aria-label={label}
328
+ {...ariaValues(reading, min, max, format)}
329
+ {...describedBy}
330
+ >
331
+ <div className={classes.track} data-meter-track>
332
+ {model.markerPct !== undefined &&
333
+ zones?.map((z, i) => (
334
+ <div
335
+ key={i}
336
+ className={classes.zone}
337
+ data-meter-zone={z.label}
338
+ style={zoneStyle(z, i, zones.length, min, model.span)}
339
+ />
340
+ ))}
341
+ {model.parts.map((p, i) => (
342
+ <div
343
+ key={i}
344
+ className={cx(classes.fill, p.forecast && classes.forecastFill)}
345
+ data-meter-fill={p.forecast ? 'forecast' : 'committed'}
346
+ style={fillStyle(p)}
347
+ />
348
+ ))}
349
+ </div>
350
+ <Tick kind="marker" className={classes.marker} pct={model.markerPct} />
351
+ <Tick kind="boundary" className={classes.boundaryTick} pct={model.boundaryPct} />
352
+ <Tick kind="target" className={classes.tick} pct={model.targetPct} />
353
+ </div>
354
+ {model.zoneLabels.length > 0 && <ZoneLabels labels={model.zoneLabels} />}
355
+ {anchored && <ZoneReading pct={model.markerPct ?? 0}>{start}</ZoneReading>}
356
+ {model.describedByText !== null && (
357
+ <VisuallyHidden id={describedId}>{model.describedByText}</VisuallyHidden>
358
+ )}
359
+ {hasParts && (
360
+ // The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one.
361
+ // oxlint-disable-next-line jsx-a11y/no-redundant-roles
362
+ <ul className={classes.partCaptions} role="list" data-meter-parts>
363
+ {model.partCaptions.map((c) => (
364
+ <li key={c.key} className={classes.partCaption}>
365
+ <span
366
+ className={classes.swatch}
367
+ // theme-allow hidden-inline-style — the swatch repeats the part's fill colour (data)
368
+ style={{ background: c.color ?? 'var(--vx-line)' }}
369
+ aria-hidden
370
+ />
371
+ {c.label} {c.text}
372
+ </li>
373
+ ))}
374
+ </ul>
375
+ )}
376
+ {hasCaptions && (
377
+ <div className={classes.captions} data-meter-captions>
378
+ {start !== null && !anchored && <span className={classes.caption}>{start}</span>}
379
+ {model.forecastText !== null && (
380
+ <span className={classes.caption}>{model.forecastText}</span>
381
+ )}
382
+ {end !== null && <span className={classes.captionEnd}>{end}</span>}
383
+ </div>
384
+ )}
385
+ </div>
386
+ )
387
+ }
388
+
389
+ function Tick({
390
+ kind,
391
+ className,
392
+ pct,
393
+ }: {
394
+ kind: 'marker' | 'boundary' | 'target'
395
+ className: string
396
+ pct: number | undefined
397
+ }) {
398
+ if (pct === undefined) return null
399
+ return (
400
+ <div
401
+ className={className}
402
+ data-meter-tick={kind}
403
+ style={{ insetInlineStart: `${pct}%` }}
404
+ aria-hidden
405
+ />
406
+ )
407
+ }
@@ -0,0 +1,268 @@
1
+ /*
2
+ * Meter — one neutral track, ordered fills, optional target tick (docs/waves/design-parity/SPEC.md
3
+ * § 6.3). Flat fills, no hatching. Bar height 6 is the measured reference; the radius is the `fine`
4
+ * step so the track follows the radius knob.
5
+ */
6
+
7
+ .root {
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: var(--vx-space-stack-xs, 0.25rem);
11
+ min-width: 0;
12
+ }
13
+
14
+ .root.zoned {
15
+ position: relative;
16
+ }
17
+
18
+ .track {
19
+ position: relative;
20
+ display: flex;
21
+ height: 0.375rem;
22
+ overflow: hidden;
23
+ border-radius: var(--vx-radius-fine);
24
+ background: var(--vx-surface-subtle);
25
+ }
26
+
27
+ /* The tick is drawn OVER the fills and outside the clipped track, so it can stand 2px proud of it. */
28
+ .trackBox {
29
+ position: relative;
30
+ }
31
+
32
+ .fill {
33
+ flex: none;
34
+ height: 100%;
35
+ background: var(--vx-line);
36
+ }
37
+
38
+ /* The committed/forecast pair: the same neutral at two strengths. Flat, never hatched. */
39
+ .forecastFill {
40
+ background: color-mix(in srgb, var(--vx-line) 45%, transparent);
41
+ }
42
+
43
+ .zone {
44
+ position: absolute;
45
+ inset-block: 0;
46
+ }
47
+
48
+ /*
49
+ * Zone names under the band: absolutely placed at each band start so they stay on the band. When
50
+ * they would collide the band collapses (hidden but still laid out, so it can be re-measured) and the
51
+ * same names wrap as a list. The holding zone is ink, the rest muted.
52
+ */
53
+ .zoneBand {
54
+ position: relative;
55
+ /* Labels are absolutely placed, so the row needs its own line height. */
56
+ height: 1.25em;
57
+ font-family: var(--basalt-font-mono);
58
+ font-size: var(--vx-text-micro);
59
+ color: var(--vx-muted);
60
+ }
61
+
62
+ /*
63
+ * Hidden but laid out, so a resize can measure it again. Absolute against `.root.zoned`, which has
64
+ * no inline padding, so `inset-inline: 0` gives the band the same width as when it was in flow.
65
+ */
66
+ .zoneBand[data-collapsed] {
67
+ position: absolute;
68
+ top: 0;
69
+ inset-inline: 0;
70
+ visibility: hidden;
71
+ pointer-events: none;
72
+ }
73
+
74
+ .zoneLabel {
75
+ position: absolute;
76
+ top: 0;
77
+ white-space: nowrap;
78
+ }
79
+
80
+ .zoneLabelHolding {
81
+ font-weight: 500;
82
+ color: var(--vx-ink);
83
+ }
84
+
85
+ .zoneList {
86
+ display: flex;
87
+ flex-wrap: wrap;
88
+ gap: var(--vx-space-stack-xs) var(--vx-space-stack-sm);
89
+ font-family: var(--basalt-font-mono);
90
+ font-size: var(--vx-text-micro);
91
+ color: var(--vx-muted);
92
+ }
93
+
94
+ .zoneListItem {
95
+ min-width: 0;
96
+ overflow-wrap: anywhere;
97
+ }
98
+
99
+ /* The reading under the band, centred on the marker. Clipped so it never widens the row before the first measure. */
100
+ .zoneReadingRow {
101
+ --basalt-reading-dir: 1;
102
+ position: relative;
103
+ height: 1.25em;
104
+ overflow: clip;
105
+ font-family: var(--basalt-font-mono);
106
+ font-size: var(--vx-text-micro);
107
+ }
108
+
109
+ .zoneReadingRow:dir(rtl) {
110
+ --basalt-reading-dir: -1;
111
+ }
112
+
113
+ /* Before the first measure the start edge sits AT the marker, so the label shifts back half its width
114
+ * along the inline axis (the physical `translate` flips sign in RTL). Measured, the start edge is exact. */
115
+ .zoneReading {
116
+ position: absolute;
117
+ top: 0;
118
+ translate: calc(-50% * var(--basalt-reading-dir)) 0;
119
+ white-space: nowrap;
120
+ font-weight: 500;
121
+ color: var(--vx-ink);
122
+ }
123
+
124
+ .zoneReading[data-measured] {
125
+ translate: none;
126
+ }
127
+
128
+ /* The reading on a zone track: a notch standing proud of the bands, in ink. */
129
+ .marker {
130
+ position: absolute;
131
+ top: -3px;
132
+ bottom: -3px;
133
+ width: 3px;
134
+ margin-inline-start: -1.5px;
135
+ border-radius: var(--vx-radius-fine);
136
+ background: var(--vx-ink);
137
+ }
138
+
139
+ .tick {
140
+ position: absolute;
141
+ top: -2px;
142
+ bottom: -2px;
143
+ width: 2px;
144
+ margin-inline-start: -1px;
145
+ border-radius: var(--vx-radius-fine);
146
+ background: var(--vx-ink);
147
+ }
148
+
149
+ .boundaryTick {
150
+ composes: tick;
151
+ background: var(--vx-muted);
152
+ }
153
+
154
+ .captions {
155
+ display: flex;
156
+ flex-wrap: wrap;
157
+ align-items: baseline;
158
+ justify-content: space-between;
159
+ gap: var(--vx-space-control-gap, 0.375rem);
160
+ font-family: var(--basalt-font-mono);
161
+ font-size: var(--vx-text-micro);
162
+ color: var(--vx-muted);
163
+ }
164
+
165
+ /* Captions never truncate: the row wraps, and a caption wider than the row wraps inside itself. */
166
+ .caption {
167
+ min-width: 0;
168
+ overflow-wrap: anywhere;
169
+ }
170
+
171
+ /* Alone in the row, or wrapped onto its own line, the end caption still sits at the end. */
172
+ .captionEnd {
173
+ composes: caption;
174
+ margin-inline-start: auto;
175
+ text-align: end;
176
+ }
177
+
178
+ /* Categorical segments: one caption per part under the track, wrapping at narrow widths. */
179
+ .partCaptions {
180
+ display: flex;
181
+ flex-wrap: wrap;
182
+ gap: var(--vx-space-stack-xs, 0.25rem) var(--vx-space-stack-sm);
183
+ margin: 0;
184
+ padding: 0;
185
+ list-style: none;
186
+ font-family: var(--basalt-font-mono);
187
+ font-size: var(--vx-text-micro);
188
+ color: var(--vx-muted);
189
+ }
190
+
191
+ .partCaption {
192
+ display: inline-flex;
193
+ align-items: baseline;
194
+ gap: var(--vx-space-control-gap, 0.375rem);
195
+ min-width: 0;
196
+ overflow-wrap: anywhere;
197
+ }
198
+
199
+ /* A shape cue beside the name, so the part never reads by colour alone. */
200
+ .swatch {
201
+ flex: none;
202
+ width: 0.5rem;
203
+ height: 0.5rem;
204
+ border-radius: var(--vx-radius-fine);
205
+ }
206
+
207
+ .empty {
208
+ font-size: var(--vx-text-sm);
209
+ color: var(--vx-muted);
210
+ }
211
+
212
+ /* The skeleton holds the track + one caption line: 6 + 4 + a micro line. */
213
+ .skeletonTrack {
214
+ height: 0.375rem;
215
+ }
216
+
217
+ .skeletonCaption {
218
+ width: 40%;
219
+ height: 0.75rem;
220
+ }
221
+
222
+ /* ── ring ────────────────────────────────────────────────────────────────────────────────────── */
223
+
224
+ .ringBox {
225
+ position: relative;
226
+ display: inline-flex;
227
+ align-items: center;
228
+ justify-content: center;
229
+ align-self: flex-start;
230
+ box-sizing: border-box;
231
+ /* 80px, growing (still square) when the value is wider than the ring's inner circle. */
232
+ min-width: 5rem;
233
+ width: max-content;
234
+ aspect-ratio: 1;
235
+ /* 12px at the default step: keeps the value inside the ring's stroke. */
236
+ padding: calc(1.5 * var(--vx-space-stack-sm, 0.5rem));
237
+ }
238
+
239
+ .ring {
240
+ position: absolute;
241
+ inset: 0;
242
+ width: 100%;
243
+ height: 100%;
244
+ transform: rotate(-90deg);
245
+ }
246
+
247
+ .ringTrack {
248
+ fill: none;
249
+ stroke: var(--vx-surface-subtle);
250
+ }
251
+
252
+ .ringArc {
253
+ fill: none;
254
+ stroke: var(--vx-line);
255
+ }
256
+
257
+ .ringValue {
258
+ position: relative;
259
+ font-family: var(--basalt-font-mono);
260
+ font-size: var(--vx-text-kpi);
261
+ font-weight: 500;
262
+ color: var(--vx-ink);
263
+ }
264
+
265
+ .skeletonRing {
266
+ width: 5rem;
267
+ height: 5rem;
268
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
3
+ * signature — so dot access stays verbatim under the package's strict flags.
4
+ */
5
+ declare const classes: {
6
+ readonly root: string
7
+ readonly zoned: string
8
+ readonly track: string
9
+ readonly trackBox: string
10
+ readonly fill: string
11
+ readonly forecastFill: string
12
+ readonly zone: string
13
+ readonly zoneBand: string
14
+ readonly zoneLabel: string
15
+ readonly zoneLabelHolding: string
16
+ readonly zoneList: string
17
+ readonly zoneListItem: string
18
+ readonly zoneReadingRow: string
19
+ readonly zoneReading: string
20
+ readonly marker: string
21
+ readonly tick: string
22
+ readonly boundaryTick: string
23
+ readonly captions: string
24
+ readonly caption: string
25
+ readonly captionEnd: string
26
+ readonly partCaptions: string
27
+ readonly partCaption: string
28
+ readonly swatch: string
29
+ readonly empty: string
30
+ readonly skeletonTrack: string
31
+ readonly skeletonCaption: string
32
+ readonly ringBox: string
33
+ readonly ring: string
34
+ readonly ringTrack: string
35
+ readonly ringArc: string
36
+ readonly ringValue: string
37
+ readonly skeletonRing: string
38
+ }
39
+ export default classes