basalt-ui 2.22.0 → 2.23.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 (131) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/MIGRATING.md +187 -12
  3. package/agent/agents/basalt-design-reviewer.md +1 -1
  4. package/agent/skills/basalt-design/SKILL.md +1 -1
  5. package/dist/charts/BandStrip.d.ts.map +1 -1
  6. package/dist/charts/BandStrip.js +51 -5
  7. package/dist/charts/Bars.d.ts.map +1 -1
  8. package/dist/charts/Bars.js +2 -1
  9. package/dist/charts/CartesianChart.d.ts +2 -0
  10. package/dist/charts/CartesianChart.d.ts.map +1 -1
  11. package/dist/charts/ChartCard.d.ts +1 -1
  12. package/dist/charts/ChartCard.d.ts.map +1 -1
  13. package/dist/charts/ChartCard.js +25 -15
  14. package/dist/charts/Sparkline.d.ts +8 -2
  15. package/dist/charts/Sparkline.d.ts.map +1 -1
  16. package/dist/charts/Sparkline.js +67 -13
  17. package/dist/charts/band-fold.d.ts +22 -4
  18. package/dist/charts/band-fold.d.ts.map +1 -1
  19. package/dist/charts/band-fold.js +10 -2
  20. package/dist/charts/chart-dates.d.ts +12 -0
  21. package/dist/charts/chart-dates.d.ts.map +1 -0
  22. package/dist/charts/chart-dates.js +16 -0
  23. package/dist/charts/compile.d.ts +8 -0
  24. package/dist/charts/compile.d.ts.map +1 -1
  25. package/dist/charts/compile.js +30 -21
  26. package/dist/charts/date-tick-format.d.ts +5 -5
  27. package/dist/charts/date-tick-format.d.ts.map +1 -1
  28. package/dist/charts/date-tick-format.js +3 -7
  29. package/dist/charts/labels.d.ts +7 -3
  30. package/dist/charts/labels.d.ts.map +1 -1
  31. package/dist/charts/labels.js +28 -17
  32. package/dist/charts/ref-label.d.ts +17 -0
  33. package/dist/charts/ref-label.d.ts.map +1 -1
  34. package/dist/charts/ref-label.js +13 -1
  35. package/dist/charts/sparkline.module.css +8 -11
  36. package/dist/charts/state.d.ts.map +1 -1
  37. package/dist/charts/state.js +3 -1
  38. package/dist/charts/types.d.ts +4 -3
  39. package/dist/charts/types.d.ts.map +1 -1
  40. package/dist/cli/shot/capture.d.ts.map +1 -1
  41. package/dist/cli/shot/capture.js +9 -5
  42. package/dist/cli/shot/detect.js +8 -5
  43. package/dist/cli/shot/playwright.d.ts +8 -0
  44. package/dist/cli/shot/playwright.d.ts.map +1 -1
  45. package/dist/cli/shot/playwright.js +5 -1
  46. package/dist/cli/shot/types.d.ts +2 -0
  47. package/dist/cli/shot/types.d.ts.map +1 -1
  48. package/dist/cli/tokens-css.d.ts +5 -7
  49. package/dist/cli/tokens-css.d.ts.map +1 -1
  50. package/dist/cli/tokens-css.js +11 -12
  51. package/dist/dashboard/bar-list.d.ts +6 -1
  52. package/dist/dashboard/bar-list.d.ts.map +1 -1
  53. package/dist/dashboard/bar-list.js +8 -0
  54. package/dist/dashboard/bar-list.module.css +30 -0
  55. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  56. package/dist/dashboard/delta-badge.js +2 -2
  57. package/dist/dashboard/meter-model.d.ts +25 -20
  58. package/dist/dashboard/meter-model.d.ts.map +1 -1
  59. package/dist/dashboard/meter-model.js +24 -12
  60. package/dist/dashboard/meter-parts.d.ts +1 -1
  61. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  62. package/dist/dashboard/meter-parts.js +39 -4
  63. package/dist/dashboard/meter.d.ts +14 -8
  64. package/dist/dashboard/meter.d.ts.map +1 -1
  65. package/dist/dashboard/meter.js +1 -1
  66. package/dist/dashboard/meter.module.css +15 -0
  67. package/dist/dashboard/meter.module.css.d.ts +1 -0
  68. package/dist/dashboard/query-state.d.ts.map +1 -1
  69. package/dist/dashboard/query-state.js +1 -1
  70. package/dist/dashboard/stat-card-parts.js +1 -1
  71. package/dist/dashboard/stat-card.module.css +25 -6
  72. package/dist/dashboard/stat-group.module.css +7 -0
  73. package/dist/dashboard/stat-strip.d.ts +15 -5
  74. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  75. package/dist/dashboard/stat-strip.js +50 -34
  76. package/dist/dashboard/stat-strip.module.css +83 -61
  77. package/dist/guard/index.d.ts.map +1 -1
  78. package/dist/guard/index.js +0 -5
  79. package/dist/styles.css +18 -11
  80. package/dist/theme/controls.module.css +14 -0
  81. package/dist/theme/controls.module.css.d.ts +1 -0
  82. package/dist/theme/index.d.ts.map +1 -1
  83. package/dist/theme/index.js +10 -7
  84. package/dist/theme/status-verdict.d.ts.map +1 -1
  85. package/dist/theme/status-verdict.js +9 -1
  86. package/dist/tokens/palette.d.ts +7 -10
  87. package/dist/tokens/palette.d.ts.map +1 -1
  88. package/dist/tokens/palette.js +7 -10
  89. package/llms.txt +6 -4
  90. package/package.json +1 -1
  91. package/src/charts/BandStrip.tsx +55 -5
  92. package/src/charts/Bars.tsx +2 -1
  93. package/src/charts/CartesianChart.tsx +2 -0
  94. package/src/charts/ChartCard.tsx +32 -19
  95. package/src/charts/Sparkline.tsx +92 -19
  96. package/src/charts/band-fold.ts +25 -6
  97. package/src/charts/chart-dates.ts +30 -0
  98. package/src/charts/compile.ts +64 -23
  99. package/src/charts/date-tick-format.ts +10 -13
  100. package/src/charts/labels.ts +43 -22
  101. package/src/charts/ref-label.ts +27 -0
  102. package/src/charts/sparkline.module.css +8 -11
  103. package/src/charts/state.tsx +6 -3
  104. package/src/charts/types.ts +4 -3
  105. package/src/cli/shot/capture.ts +15 -3
  106. package/src/cli/shot/detect.ts +9 -9
  107. package/src/cli/shot/playwright.ts +18 -2
  108. package/src/cli/shot/types.ts +2 -0
  109. package/src/cli/tokens-css.ts +18 -20
  110. package/src/dashboard/bar-list.module.css +30 -0
  111. package/src/dashboard/bar-list.tsx +29 -0
  112. package/src/dashboard/delta-badge.tsx +6 -2
  113. package/src/dashboard/meter-model.ts +58 -41
  114. package/src/dashboard/meter-parts.tsx +66 -5
  115. package/src/dashboard/meter.module.css +15 -0
  116. package/src/dashboard/meter.module.css.d.ts +1 -0
  117. package/src/dashboard/meter.tsx +15 -11
  118. package/src/dashboard/query-state.tsx +1 -1
  119. package/src/dashboard/stat-card-parts.tsx +1 -1
  120. package/src/dashboard/stat-card.module.css +25 -6
  121. package/src/dashboard/stat-group.module.css +7 -0
  122. package/src/dashboard/stat-strip.module.css +83 -61
  123. package/src/dashboard/stat-strip.tsx +93 -54
  124. package/src/guard/index.ts +0 -5
  125. package/src/styles.css +18 -11
  126. package/src/theme/__snapshots__/plain-theme.test.ts.snap +14 -8
  127. package/src/theme/controls.module.css +14 -0
  128. package/src/theme/controls.module.css.d.ts +1 -0
  129. package/src/theme/index.ts +10 -7
  130. package/src/theme/status-verdict.tsx +5 -1
  131. package/src/tokens/palette.ts +7 -10
@@ -185,7 +185,9 @@ export declare const RADIUS_STEP: {
185
185
  readonly floating: number;
186
186
  /** SegmentedControl's active indicator, Kbd, Code — one step below the control radius. */
187
187
  readonly tight: number;
188
- /** Progress bar, and the Mantine scale's `sm` step — two steps below the control radius. */
188
+ /** Progress bar, and the Mantine scale's `sm` step — two steps below the control radius. (No
189
+ * longer the SegmentedControl indicator: that is the track radius − 3 px, the nested-radius lint
190
+ * step, set in `theme/index.ts`.) */
189
191
  readonly fine: number;
190
192
  /** The Mantine `radius` scale's `xs` step — independent of both anchors. */
191
193
  readonly scaleXs: 2;
@@ -703,15 +705,10 @@ export declare const SPACE_FIXED: {
703
705
  readonly readingProgressHeight: 2;
704
706
  /** SegmentedControl track's optical inset (`styles.root` padding) — moved OUT of `SPACE_STEP` and
705
707
  * exempted from the density knob because it is load-bearing for the nested-corner law
706
- * (docs/DESIGN-SPEC.md §4): `RADIUS.ctrl === RADIUS_STEP.fine + segmentedTrackInset` (`6 = 4 +
707
- * 2`; the track takes the control radius, the indicator the `fine` tier). `RADIUS.ctrl`/
708
- * `RADIUS_STEP.fine` both shift together under the RADIUS knob (`ctrl = 6 + level`, `fine = ctrl
709
- * - 2`), so their difference is exactly 2 regardless of that knob (down to level -4; at -5 `fine`
710
- * clamps to 0 against `ctrl` 1) — a density-tracking inset would break concentricity in both directions (verified: this
711
- * inset's own value, HAD it stayed density-tracking, resolves via `scaleSpace(2, level, multiplier)`
712
- * to 1 at density's floor level -3 and 3 at its ceiling level +3 — the widest swing `deriveSpacing`'s
713
- * `[-3, 3]` range can produce) for no compensating benefit, since the two radii it sits between
714
- * never move independently of each other. */
708
+ * (docs/DESIGN-SPEC.md §4). The indicator radius is the track radius − 3 px (the nested-radius
709
+ * lint step wins over exact concentricity, which would be track − inset), so the inset no longer
710
+ * sets a corner; it stays fixed because a density-tracking inset (1 at density -3, 3 at +3 via
711
+ * `scaleSpace(2, level, multiplier)`) would make the track's optical weight swing for no benefit. */
715
712
  readonly segmentedTrackInset: 2;
716
713
  };
717
714
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/tokens/palette.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;CAgCL,CAAA;AAEV;;;;GAIG;AACH,eAAO,MAAM,CAAC,GAAI,KAAK,SAAS,MAAM,EAAE,EAAE,cAAS,EAAE,aAAQ,KAAG,SAG9D,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;;;;;IASjB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;;;;;;;;;CAaK,CAAA;AAEV;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAOD;;;8DAG8D;AAC9D,e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;;;;;;;CAA8B,CAAA;AAElD,0FAA0F;AAC1F,eAAO,MAAM,GAAG;;;;;CAA0B,CAAA;AAE1C,mFAAmF;AACnF,eAAO,MAAM,MAAM;;;;;;CAA6B,CAAA;AAEhD;+BAC+B;AAC/B,eAAO,MAAM,IAAI;;;;;;;;;;;;;CAA2B,CAAA;AAE5C;+CAC+C;AAC/C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;CAA8B,CAAA"}
@@ -121,7 +121,9 @@ const RADIUS_STEP = {
121
121
  /** SegmentedControl's active indicator, Kbd, Code — one step below the control radius. */
122
122
  tight: DEFAULT_RADIUS_VALUES.tight,
123
123
  // 5
124
- /** Progress bar, and the Mantine scale's `sm` step — two steps below the control radius. */
124
+ /** Progress bar, and the Mantine scale's `sm` step — two steps below the control radius. (No
125
+ * longer the SegmentedControl indicator: that is the track radius − 3 px, the nested-radius lint
126
+ * step, set in `theme/index.ts`.) */
125
127
  fine: DEFAULT_RADIUS_VALUES.fine,
126
128
  // 4
127
129
  /** The Mantine `radius` scale's `xs` step — independent of both anchors. */
@@ -631,15 +633,10 @@ const SPACE_FIXED = {
631
633
  readingProgressHeight: 2,
632
634
  /** SegmentedControl track's optical inset (`styles.root` padding) — moved OUT of `SPACE_STEP` and
633
635
  * exempted from the density knob because it is load-bearing for the nested-corner law
634
- * (docs/DESIGN-SPEC.md §4): `RADIUS.ctrl === RADIUS_STEP.fine + segmentedTrackInset` (`6 = 4 +
635
- * 2`; the track takes the control radius, the indicator the `fine` tier). `RADIUS.ctrl`/
636
- * `RADIUS_STEP.fine` both shift together under the RADIUS knob (`ctrl = 6 + level`, `fine = ctrl
637
- * - 2`), so their difference is exactly 2 regardless of that knob (down to level -4; at -5 `fine`
638
- * clamps to 0 against `ctrl` 1) — a density-tracking inset would break concentricity in both directions (verified: this
639
- * inset's own value, HAD it stayed density-tracking, resolves via `scaleSpace(2, level, multiplier)`
640
- * to 1 at density's floor level -3 and 3 at its ceiling level +3 — the widest swing `deriveSpacing`'s
641
- * `[-3, 3]` range can produce) for no compensating benefit, since the two radii it sits between
642
- * never move independently of each other. */
636
+ * (docs/DESIGN-SPEC.md §4). The indicator radius is the track radius − 3 px (the nested-radius
637
+ * lint step wins over exact concentricity, which would be track − inset), so the inset no longer
638
+ * sets a corner; it stays fixed because a density-tracking inset (1 at density -3, 3 at +3 via
639
+ * `scaleSpace(2, level, multiplier)`) would make the track's optical weight swing for no benefit. */
643
640
  segmentedTrackInset: 2
644
641
  };
645
642
  function scaleSpace(value, level, multiplier) {
package/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # basalt-ui v2.22.0
1
+ # basalt-ui v2.23.0
2
2
  # Opinionated framework for Mantine-based React apps — theme, app shell, TanStack Charts, toolchain presets
3
3
  #
4
4
  # Entry points: use the exact import specifier below; do not guess.
@@ -13,7 +13,7 @@
13
13
  # A subpath's `Install:` line is its required peers; `OptionalPeers:` are import()-only, install on use.
14
14
 
15
15
  Package: basalt-ui
16
- Version: 2.22.0
16
+ Version: 2.23.0
17
17
 
18
18
  ## basalt-ui
19
19
  Import: import { ... } from 'basalt-ui'
@@ -29,6 +29,7 @@ Signature: BarList(props: BarListProps): JSX.Element
29
29
  max?: number
30
30
  variant?: "thin" | "inline"
31
31
  accentLeader?: boolean
32
+ secondaryAlign?: "start" | "end"
32
33
  loading?: boolean
33
34
  loadingRows?: number
34
35
  emptyText?: string
@@ -233,7 +234,8 @@ Signature: StatGroup(props: StatGroupProps): JSX.Element
233
234
  children: ReactNode [with variant="grid"]
234
235
  label: string [with variant="strip"]
235
236
  cells: readonly StatStripCell[] [with variant="strip"]
236
- footer?: readonly { key: string; content: ReactNode; }[] [with variant="strip"]
237
+ footer?: readonly StatStripFooterEntry[] [with variant="strip"]
238
+ shotAbsent?: readonly StatStripShotState[] [with variant="strip"]
237
239
  Signature: StatusDot(props: StatusDotProps): JSX.Element
238
240
  className?: string
239
241
  style?: CSSProperties
@@ -490,7 +492,7 @@ Signature: Sparkline(props: SparklineProps): ReactElement<unknown, string | JSXE
490
492
  className?: string
491
493
  style?: CSSProperties
492
494
  ariaLabel: string
493
- data: readonly number[]
495
+ data: readonly number[] | readonly { at: Date | number | string; …
494
496
  height: number
495
497
  width?: number
496
498
  mark?: "bar" | "line"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basalt-ui",
3
- "version": "2.22.0",
3
+ "version": "2.23.0",
4
4
  "description": "Opinionated framework for Mantine-based React apps — theme, app shell, TanStack Charts, toolchain presets",
5
5
  "keywords": [
6
6
  "charts",
@@ -21,7 +21,14 @@ import { oneOf, requiredProp } from '../common/errors'
21
21
  import { NON_FINITE } from '../format/shared'
22
22
  import { VX, alpha } from '../tokens'
23
23
  import { CartesianRung } from './CartesianChart'
24
- import { GLYPH_MIN_PX, glyphOf, groupsOf, resolveNamedState } from './band-fold'
24
+ import {
25
+ BAND_GLYPH_MIN_PX,
26
+ NOTCH_PX,
27
+ glyphOf,
28
+ groupsOf,
29
+ resolveNamedState,
30
+ toneOf,
31
+ } from './band-fold'
25
32
  import type { Group, NamedChartState } from './band-fold'
26
33
  import { emphasis } from './marks'
27
34
  import { rowX } from './types'
@@ -262,6 +269,7 @@ function layoutBands<T>(input: LayoutInput<T>): {
262
269
  markers: Layer[]
263
270
  hits: Hit<T>[]
264
271
  glyphs: Glyph[]
272
+ notches: Layer[]
265
273
  } {
266
274
  const { data, getBand, fold, absentState: absentKey } = input
267
275
  const cap = Math.floor(input.width / (fold?.minBandPx ?? DEFAULT_MIN_BAND_PX))
@@ -280,6 +288,7 @@ function layoutBands<T>(input: LayoutInput<T>): {
280
288
  }
281
289
  const hits: Hit<T>[] = []
282
290
  const glyphs: Glyph[] = []
291
+ const notches = new Map<string, Layer>()
283
292
 
284
293
  for (const g of groups) {
285
294
  const datum = fold && g.items.length > 1 ? fold.merge(g.items) : g.items[0]
@@ -290,9 +299,29 @@ function layoutBands<T>(input: LayoutInput<T>): {
290
299
  const named = input.states.get(span.state)
291
300
  const glyph = named && glyphOf(named)
292
301
  // The primary part's centre: an absent share is taken from the right edge.
293
- if (answers.primary && glyph && (cell.f1 - cell.f0) * input.width >= GLYPH_MIN_PX) {
302
+ if (answers.primary && glyph) {
294
303
  const share = absentShareOf(span, absentKey)
295
- glyphs.push({ f: cell.f0 + ((cell.f1 - cell.f0) * (1 - share)) / 2, glyph })
304
+ const width = cell.f1 - cell.f0
305
+ // The fractions are float differences: a 16 px cell may measure 15.999… px.
306
+ if (width * input.width >= BAND_GLYPH_MIN_PX - 1e-6)
307
+ glyphs.push({ f: cell.f0 + (width * (1 - share)) / 2, glyph })
308
+ else {
309
+ // Too narrow for the glyph: a notch along the bottom keeps the state off hue alone.
310
+ const px = NOTCH_PX[toneOf(named) === 'bad' ? 'bad' : 'warn']
311
+ // The state's own fill pulled towards the ink: it reads on any surface, as a cut-out would not.
312
+ const fill = span.fill ?? named.color
313
+ paintInto(
314
+ notches,
315
+ `color-mix(in srgb, ${fill} 50%, ${VX.ink})`,
316
+ input.emphasis(span.state),
317
+ {
318
+ f0: cell.f0,
319
+ f1: cell.f0 + width * (1 - share),
320
+ y0: 0,
321
+ y1: Math.min(px / Math.max(input.height, 1), 0.5),
322
+ },
323
+ )
324
+ }
296
325
  }
297
326
  g.items.forEach((source, i) => {
298
327
  const slot = g.start + i
@@ -301,7 +330,13 @@ function layoutBands<T>(input: LayoutInput<T>): {
301
330
  hits.push({ slot, source, state: absentKey, datum })
302
331
  })
303
332
  }
304
- return { base: [...ctx.base.values()], markers: [...ctx.markers.values()], hits, glyphs }
333
+ return {
334
+ base: [...ctx.base.values()],
335
+ markers: [...ctx.markers.values()],
336
+ hits,
337
+ glyphs,
338
+ notches: [...notches.values()],
339
+ }
305
340
  }
306
341
 
307
342
  export function BandStrip<T, X extends ChartX = ChartX, K extends string = string>(
@@ -349,7 +384,7 @@ export function BandStrip<T, X extends ChartX = ChartX, K extends string = strin
349
384
 
350
385
  const marks = useCallback(
351
386
  (plot: PlotContext<T, X>): ChartMarks => {
352
- const { base, markers, hits, glyphs } = layoutBands({
387
+ const { base, markers, hits, glyphs, notches } = layoutBands({
353
388
  data,
354
389
  getBand,
355
390
  fold,
@@ -382,6 +417,21 @@ export function BandStrip<T, X extends ChartX = ChartX, K extends string = strin
382
417
  }),
383
418
  ),
384
419
  ),
420
+ ...notches.map(({ fill, opacity, cells }, i) =>
421
+ decorative(
422
+ rect(cells, {
423
+ id: `band-notches-${i}`,
424
+ x1: 'f0',
425
+ x2: 'f1',
426
+ y1: 'y0',
427
+ y2: 'y1',
428
+ xScale: 'zx',
429
+ fill,
430
+ inset: 0,
431
+ ...(opacity < 1 && { fillOpacity: opacity }),
432
+ }),
433
+ ),
434
+ ),
385
435
  ...(glyphs.length > 0
386
436
  ? [
387
437
  decorative(
@@ -126,7 +126,7 @@ export function Bars<T, X extends ChartX = ChartX>(props: BarsProps<T, X>): Reac
126
126
  z: 'series',
127
127
  fill,
128
128
  // The hovered x is its own highlight: the bar reads at full strength (no dimming, no
129
- // point marker, no crosshair rule: that is line-chart chrome).
129
+ // point marker, no crosshair rule: that is line-chart chrome; `focusRing={false}` on the rung).
130
130
  states: [{ when: { focus: 'x' }, style: { fill: solid } }],
131
131
  layout:
132
132
  layout === 'grouped'
@@ -150,6 +150,7 @@ export function Bars<T, X extends ChartX = ChartX>(props: BarsProps<T, X>): Reac
150
150
  marks={marks}
151
151
  band
152
152
  crosshair={false}
153
+ focusRing={false}
153
154
  reverseRows={layout !== 'grouped'}
154
155
  {...(layout !== 'grouped' && { stack: layout })}
155
156
  />
@@ -31,6 +31,8 @@ export type RungOptions = {
31
31
  tooltipBelow?: boolean
32
32
  /** No vertical rule under the cursor (a bar kind's hover is the bar itself). */
33
33
  crosshair?: boolean
34
+ /** No engine point marker on the focused datum (a bar kind's hover is the bar itself). */
35
+ focusRing?: boolean
34
36
  /** The legend goes from the wide class up, where `Lines`' end labels name the series. */
35
37
  hideLegendAtWide?: boolean
36
38
  }
@@ -87,6 +87,20 @@ const bodyClipStyle: CSSProperties = {
87
87
  padding: '2px var(--vx-space-card-inset-x, 1rem) var(--vx-space-card-inset-y, 0.75rem)',
88
88
  }
89
89
 
90
+ const PERIOD_SEPARATOR = '· '
91
+
92
+ /**
93
+ * A period list joins with `·`; behind a unit it leads with one too, so a one-item list is
94
+ * separated from the unit as the items are from each other (an item that already leads with it
95
+ * is not doubled). A plain string is written as is.
96
+ */
97
+ function periodText(period: string | readonly string[], afterUnit: boolean): string {
98
+ if (typeof period === 'string') return period
99
+ if (period.length === 0) return ''
100
+ const text = period.join(' · ')
101
+ return afterUnit && !text.startsWith(PERIOD_SEPARATOR.trim()) ? PERIOD_SEPARATOR + text : text
102
+ }
103
+
90
104
  /** One headline figure: the value is the hero, then its unit, a comparison node and the period. */
91
105
  export type ChartFact = {
92
106
  value: ReactNode
@@ -94,7 +108,7 @@ export type ChartFact = {
94
108
  /** Usually a `DeltaBadge`. */
95
109
  comparison?: ReactNode
96
110
  /** Plain text the figure covers, e.g. `last 30 d`. A list is joined by ` · ` (`['last entry 3 d
97
- * ago', '12 entries']`). */
111
+ * ago', '12 entries']`) and, behind a `unit`, led by one. */
98
112
  period?: string | readonly string[] | undefined
99
113
  /** Ink for the whole fact (text only, never a fill): a stale or off-target figure reads `warn`. */
100
114
  tone?: ChartFactTone | undefined
@@ -186,25 +200,24 @@ function Facts({
186
200
  {...(stale && { 'data-stale': 'true' })}
187
201
  className={classes.factsRow}
188
202
  >
189
- {list.map((f, i) => (
190
- <span
191
- key={i}
192
- data-basalt-fact=""
193
- {...(f.tone !== undefined && { 'data-tone': f.tone })}
194
- className={classes.fact}
195
- >
196
- <span data-basalt-fact-value="" className={classes.factValue}>
197
- {f.value}
198
- </span>
199
- {f.unit !== undefined && <span className={classes.factUnit}>{f.unit}</span>}
200
- {f.comparison}
201
- {f.period !== undefined && (
202
- <span className={classes.factPeriod}>
203
- {typeof f.period === 'string' ? f.period : f.period.join(' · ')}
203
+ {list.map((f, i) => {
204
+ const period = f.period === undefined ? '' : periodText(f.period, f.unit !== undefined)
205
+ return (
206
+ <span
207
+ key={i}
208
+ data-basalt-fact=""
209
+ {...(f.tone !== undefined && { 'data-tone': f.tone })}
210
+ className={classes.fact}
211
+ >
212
+ <span data-basalt-fact-value="" className={classes.factValue}>
213
+ {f.value}
204
214
  </span>
205
- )}
206
- </span>
207
- ))}
215
+ {f.unit !== undefined && <span className={classes.factUnit}>{f.unit}</span>}
216
+ {f.comparison}
217
+ {period !== '' && <span className={classes.factPeriod}>{period}</span>}
218
+ </span>
219
+ )
220
+ })}
208
221
  </div>
209
222
  {basis !== undefined && (
210
223
  <p data-basalt-facts-basis="" className={classes.factsBasis}>
@@ -20,7 +20,10 @@ import { VX, alpha } from '../tokens'
20
20
  import type { CartesianDefinition } from './compile'
21
21
  import { chartCurve } from './curves'
22
22
  import { barMark } from './marks'
23
- import { defaultNumberFormat } from './compile'
23
+ import { bucketDay, dayGranular, defaultNumberFormat } from './compile'
24
+ import { referenceLabelPlacement } from './ref-label'
25
+ import { readoutClock, readoutDay } from './chart-dates'
26
+ import { toDate } from '../format/shared'
24
27
  import { ChartEngine, idPrefixOf } from './host'
25
28
  import classes from './sparkline.module.css'
26
29
  import { ChartPlaceholder, resolveChartState } from './state'
@@ -30,7 +33,9 @@ import type { ChartMarks, ChartState } from './types'
30
33
  export type SparklineProps = BasaltProps & {
31
34
  /** The accessible name. Required: a chart without one is an unlabeled image. */
32
35
  ariaLabel: string
33
- data: readonly number[]
36
+ /** The values, or `{ at, value }` points: `at` (a Date, epoch ms or ISO string) names the point in
37
+ * the readout, as a day or, within one day, an hour, in the page's format locale. */
38
+ data: readonly number[] | readonly { at: Date | number | string; value: number }[]
34
39
  /** Height in px. */
35
40
  height: number
36
41
  /** Width in px. Default: the container's, measured by the host. */
@@ -59,7 +64,8 @@ export type SparklineProps = BasaltProps & {
59
64
  /** Formats the readout's value. Default: the compact number format. */
60
65
  format?: ((value: number) => string) | undefined
61
66
  /** The readout's x label per point, index-aligned with `data`: pass the point's day ("12 Oct"),
62
- * and the readout reads `3 items · 12 Oct` beside the point. Omitted: the value alone. */
67
+ * and the readout reads `3 items · 12 Oct` beside the point. Omitted: the moment of an `{ at }`
68
+ * point, else the value alone. */
63
69
  labels?: readonly string[] | undefined
64
70
  }
65
71
 
@@ -68,20 +74,52 @@ type Point = { i: number; v: number | null }
68
74
  const LINE_WIDTH = 1.5
69
75
  const DOT_R = 2.5
70
76
  const BAR_GAP = 0.15
77
+ /** Air between the hovered point and the readout chip beside it, px. */
78
+ const READOUT_GAP = 8
71
79
  /** Air round a line's plot, px (the engine's plot margin): the end marker stays inside the svg box,
72
80
  * so it clears the 2px focus outline round it. A bar plot is flush. */
73
81
  const LINE_INSET = 3
74
82
  /** The muted tone's line: the same alpha the consumers hand-built (`alpha(VX.muted, .35)`). */
75
83
  const MUTED_LINE = alpha(VX.muted, 0.35)
76
- const REFERENCE_LABEL_DY = -4
84
+ /** Air between the plot's start and the reference label, so the focus outline never covers it. */
85
+ const REFERENCE_LABEL_DX = 3
77
86
  // Pixel policy of the self-pooling (`poolSparkline`): the densest a series may draw.
78
87
  const LINE_PX_PER_POINT = 1
79
88
  const BAR_PX_PER_BAR = 2
80
89
  /** First, last and one min/max pair: the fewest points a pooled line can hold. */
81
90
  const LINE_POOL_MIN = 4
82
91
 
92
+ const DAY_MS = 86_400_000
93
+
83
94
  const finite = (v: number): number | null => (Number.isFinite(v) ? v : null)
84
95
 
96
+ /** The readout's moment per point of `{ at }` data: the day when the points are a day or more apart,
97
+ * else the hour (with the day once they span several). `undefined` for plain values. */
98
+ function momentsOf(data: SparklineProps['data']): readonly (string | undefined)[] | undefined {
99
+ const dates: (Date | null)[] = []
100
+ for (const d of data) {
101
+ if (typeof d !== 'object' || d === null) return undefined
102
+ dates.push(toDate(d.at))
103
+ }
104
+ const known = dates.filter((d): d is Date => d !== null)
105
+ if (known.length === 0) return undefined
106
+ // By loop: a spread overflows the stack on a long series.
107
+ let lo = Number.POSITIVE_INFINITY
108
+ let hi = Number.NEGATIVE_INFINITY
109
+ for (const d of known) {
110
+ const day = Math.floor(d.getTime() / DAY_MS)
111
+ if (day < lo) lo = day
112
+ if (day > hi) hi = day
113
+ }
114
+ const oneDay = lo === hi
115
+ const byDay = dayGranular(known)
116
+ return dates.map((d) => {
117
+ if (d === null) return undefined
118
+ if (byDay) return readoutDay(bucketDay(d))
119
+ return oneDay ? readoutClock(d) : `${readoutDay(d)} ${readoutClock(d)}`
120
+ })
121
+ }
122
+
85
123
  /** Min and max of the finite values, by loop (a spread overflows the stack on long series). */
86
124
  function extent(rows: readonly Point[]): readonly [number, number] | null {
87
125
  let lo = Number.POSITIVE_INFINITY
@@ -217,7 +255,7 @@ function compileSparkline(
217
255
  referenceLabel: string | undefined,
218
256
  ): CartesianDefinition {
219
257
  const frame = frameOf(extentOf, mark, source.length, emphasisColor !== null)
220
- const referenceMark = (): ChartMarks =>
258
+ const referenceMark = (height: number): ChartMarks =>
221
259
  reference === null
222
260
  ? []
223
261
  : [
@@ -240,19 +278,29 @@ function compileSparkline(
240
278
  fill: VX.ink2,
241
279
  fontSize: VX.text.micro,
242
280
  anchor: 'start',
243
- dy: REFERENCE_LABEL_DY,
281
+ dx: REFERENCE_LABEL_DX,
282
+ dy: referenceLabelPlacement({
283
+ value: reference,
284
+ domain: frame.y,
285
+ height,
286
+ inset: mark === 'bar' ? 0 : LINE_INSET,
287
+ fontSize: VX.text.micro,
288
+ }).dy,
244
289
  }),
245
290
  ),
246
291
  ]),
247
292
  ]
248
293
  return {
249
- chart: ({ width }) => {
294
+ // A bar's hover is the bar and the readout chip: no engine point marker (bar chrome only, as
295
+ // `Bars`).
296
+ ...(mark === 'bar' && { focusRing: false as const }),
297
+ chart: ({ width, height }) => {
250
298
  const rows = poolSparkline(source, width, mark)
251
299
  const last = rows.at(-1)
252
300
  if (mark === 'bar') {
253
301
  return {
254
302
  marks: [
255
- ...referenceMark(),
303
+ ...referenceMark(height),
256
304
  barMark(rows, {
257
305
  id: 'bars',
258
306
  x: 'i',
@@ -280,7 +328,7 @@ function compileSparkline(
280
328
  }
281
329
  return {
282
330
  marks: [
283
- ...referenceMark(),
331
+ ...referenceMark(height),
284
332
  lineY(rows, {
285
333
  id: 'line',
286
334
  x: 'i',
@@ -363,7 +411,10 @@ export function Sparkline(props: SparklineProps): ReactElement {
363
411
  const [keyed, setKeyed] = useState<number | null>(null)
364
412
  const active = hover ?? keyed
365
413
  const model = useMemo(() => {
366
- const rows: Point[] = data.map((v, i) => ({ i, v: finite(v) }))
414
+ const rows: Point[] = data.map((d, i) => ({
415
+ i,
416
+ v: finite(typeof d === 'object' && d !== null ? d.value : d),
417
+ }))
367
418
  const range = extent(rows)
368
419
  // No finite value means nothing to scale: the empty render, never an Infinity domain.
369
420
  if (range === null) return null
@@ -375,6 +426,7 @@ export function Sparkline(props: SparklineProps): ReactElement {
375
426
  const end = emphasizeLast ? emphasisColor : null
376
427
  return {
377
428
  rows,
429
+ moments: momentsOf(data),
378
430
  frame: frameOf(full, mark, rows.length, end !== null),
379
431
  definition: compileSparkline(rows, full, mark, color, end, ref, referenceLabel),
380
432
  }
@@ -422,7 +474,7 @@ export function Sparkline(props: SparklineProps): ReactElement {
422
474
  }
423
475
 
424
476
  const inset = mark === 'line' ? LINE_INSET : 0
425
- const layerStyle = { inset, '--basalt-spark-lift': `${inset}px` } as CSSProperties
477
+ const layerStyle: CSSProperties = { inset }
426
478
  const value = active === null ? null : (rows?.[active]?.v ?? null)
427
479
  const at =
428
480
  interactive && active !== null && value !== null
@@ -433,9 +485,27 @@ export function Sparkline(props: SparklineProps): ReactElement {
433
485
  ? (active + 0.5) / model.rows.length
434
486
  : (active - model.frame.x[0]) / (model.frame.x[1] - model.frame.x[0]),
435
487
  fy: (model.frame.y[1] - value) / (model.frame.y[1] - model.frame.y[0]),
436
- label: labels?.[active],
488
+ label: labels?.[active] ?? model.moments?.[active],
437
489
  }
438
490
  : null
491
+ // Beside the point, on the roomier side, and on the half of the box away from it: the chip never
492
+ // covers the dot or the host's text, and stays inside the box whatever clips above it.
493
+ const beside = at === null ? null : at.fx > 0.5 ? 'left' : 'right'
494
+ const readoutStyle: CSSProperties | undefined =
495
+ at === null
496
+ ? undefined
497
+ : {
498
+ ...(beside === 'right'
499
+ ? {
500
+ left: `calc(${at.fx * 100}% + ${READOUT_GAP}px)`,
501
+ maxWidth: `calc(${(1 - at.fx) * 100}% - ${READOUT_GAP}px)`,
502
+ }
503
+ : {
504
+ right: `calc(${(1 - at.fx) * 100}% + ${READOUT_GAP}px)`,
505
+ maxWidth: `calc(${at.fx * 100}% - ${READOUT_GAP}px)`,
506
+ }),
507
+ ...(at.fy > 0.5 ? { top: 0 } : { bottom: 0 }),
508
+ }
439
509
  return (
440
510
  <div
441
511
  data-basalt-sparkline=""
@@ -463,18 +533,21 @@ export function Sparkline(props: SparklineProps): ReactElement {
463
533
  )}
464
534
  {at !== null && (
465
535
  // One layer on the plot rect (inside a line's margin): the dot and the readout take their
466
- // fractions of the same box, so both land where the mark did.
536
+ // fractions of the same box, so both land where the mark did. A bar has no dot: the bar
537
+ // is the marker.
467
538
  <span aria-hidden="true" className={classes.layer} style={layerStyle}>
468
- <span
469
- data-basalt-sparkline-dot=""
470
- className={classes.dot}
471
- style={{ left: `${at.fx * 100}%`, top: `${at.fy * 100}%` }}
472
- />
539
+ {mark === 'line' && (
540
+ <span
541
+ data-basalt-sparkline-dot=""
542
+ className={classes.dot}
543
+ style={{ left: `${at.fx * 100}%`, top: `${at.fy * 100}%` }}
544
+ />
545
+ )}
473
546
  <output
474
547
  data-basalt-sparkline-readout=""
475
548
  aria-live={hover === null ? 'polite' : 'off'}
476
549
  className={classes.readout}
477
- style={{ left: `${at.fx * 100}%`, transform: `translateX(-${at.fx * 100}%)` }}
550
+ style={readoutStyle}
478
551
  >
479
552
  {format(at.value)}
480
553
  {at.label !== undefined && <span className={classes.label}> · {at.label}</span>}
@@ -29,18 +29,37 @@ export type StatusTone = 'good' | 'warn' | 'bad' | 'neutral'
29
29
  /** `warn` and `bad` carry a glyph by default: a status state is not told apart by hue alone. */
30
30
  const TONE_GLYPH: Partial<Record<StatusTone, string>> = { warn: '!', bad: '×' }
31
31
 
32
- /** The glyph a state draws: its own, else its status tone's default, else none. */
33
- export function glyphOf(
34
- s: Pick<NamedChartState, 'glyph' | 'tone'> & { color?: string | undefined },
35
- ): string | undefined {
36
- const tone =
32
+ type ToneSource = Pick<NamedChartState, 'glyph' | 'tone'> & { color?: string | undefined }
33
+
34
+ /** A state's status tone: its own, else the one its status colour names. */
35
+ export function toneOf(s: ToneSource): StatusTone | undefined {
36
+ return (
37
37
  s.tone ?? (s.color === VX.status.warn ? 'warn' : s.color === VX.status.bad ? 'bad' : undefined)
38
+ )
39
+ }
40
+
41
+ /** The glyph a state draws: its own, else its status tone's default, else none. */
42
+ export function glyphOf(s: ToneSource): string | undefined {
43
+ const tone = toneOf(s)
38
44
  return s.glyph ?? (tone === undefined ? undefined : TONE_GLYPH[tone])
39
45
  }
40
46
 
41
- /** A cell narrower than this (px) draws no glyph: it would not fit inside the fill. */
47
+ /** A heat cell narrower than this (px) draws no glyph: it would not fit inside the fill. */
42
48
  export const GLYPH_MIN_PX = 12
43
49
 
50
+ /**
51
+ * A `BandStrip` cell narrower than this (px) draws no glyph: its fill is full-height, so the glyph
52
+ * is set at the xs size (a 16 px line), and a `!` or `×` is unreadable in less. Such a cell draws a
53
+ * notch instead, see {@link NOTCH_PX}. A `Heatmap` keeps {@link GLYPH_MIN_PX}.
54
+ */
55
+ export const BAND_GLYPH_MIN_PX = 16
56
+
57
+ /**
58
+ * The height (px) of the bottom notch a glyph state draws where the glyph does not fit: a warn
59
+ * notch is shorter than a bad one, so the state is never told by hue alone.
60
+ */
61
+ export const NOTCH_PX = { warn: 3, bad: 6 } as const
62
+
44
63
  /** A run of adjacent slots drawn as one band; `items` are the source data it stands for. */
45
64
  export type Group<T> = { start: number; items: T[] }
46
65
 
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The chart layer's one date locale: the axis's day labels, the tooltip header and a sparkline's
3
+ * readout all read the page's `defineFormat` / `BasaltProvider` locale through here (the runtime's
4
+ * when none is set), so no card mixes two orders: `04.10` ticks under a `Sat, Oct 10, 2026` header
5
+ * under a `3 Oct` fact. Every read is UTC, like the time scale that placed the ticks.
6
+ */
7
+ import { dateFormat } from '../format/shared'
8
+
9
+ const utcFormat = (options: Intl.DateTimeFormatOptions, d: Date): string =>
10
+ dateFormat(undefined, { ...options, timeZone: 'UTC' }).format(d)
11
+
12
+ /** An axis tick's day: `4 Oct` (the page locale's own order). */
13
+ export const axisDay = (d: Date): string => utcFormat({ day: 'numeric', month: 'short' }, d)
14
+
15
+ /** {@link axisDay} with a two-digit year. */
16
+ export const axisDayYear = (d: Date): string =>
17
+ utcFormat({ day: 'numeric', month: 'short', year: '2-digit' }, d)
18
+
19
+ export const monthName = (d: Date): string => utcFormat({ month: 'short' }, d)
20
+
21
+ /** The tooltip header's date: weekday, day, month and year. */
22
+ export const headerDay = (d: Date): string =>
23
+ utcFormat({ weekday: 'short', day: 'numeric', month: 'short', year: 'numeric' }, d)
24
+
25
+ /** A day written out for a readout (`12 Oct`): the same format as an axis tick. */
26
+ export const readoutDay = axisDay
27
+
28
+ /** A clock time for a readout, `HH:MM` in the page locale's digits. */
29
+ export const readoutClock = (d: Date): string =>
30
+ utcFormat({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }, d)