basalt-ui 2.24.0 → 2.26.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 (90) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/MIGRATING.md +191 -19
  3. package/configs/oxlint-basalt.json +1 -1
  4. package/configs/oxlint-plugin.js +3 -9
  5. package/configs/oxlint-plugin.test.ts +6 -0
  6. package/dist/charts/Bars.d.ts.map +1 -1
  7. package/dist/charts/Bars.js +4 -1
  8. package/dist/charts/CartesianChart.d.ts +2 -0
  9. package/dist/charts/CartesianChart.d.ts.map +1 -1
  10. package/dist/charts/ChartCard.d.ts +11 -5
  11. package/dist/charts/ChartCard.d.ts.map +1 -1
  12. package/dist/charts/ChartCard.js +11 -3
  13. package/dist/charts/Sparkline.d.ts.map +1 -1
  14. package/dist/charts/Sparkline.js +65 -7
  15. package/dist/charts/chart-box.module.css +50 -7
  16. package/dist/charts/chart-box.module.css.d.ts +2 -0
  17. package/dist/charts/chart-card.module.css +34 -0
  18. package/dist/charts/chart-card.module.css.d.ts +2 -0
  19. package/dist/charts/chart-legend.module.css +5 -6
  20. package/dist/charts/compile.d.ts +2 -0
  21. package/dist/charts/compile.d.ts.map +1 -1
  22. package/dist/charts/compile.js +45 -1
  23. package/dist/charts/legend.d.ts.map +1 -1
  24. package/dist/charts/legend.js +42 -9
  25. package/dist/charts/sparkline.module.css +13 -9
  26. package/dist/charts/state.d.ts +3 -1
  27. package/dist/charts/state.d.ts.map +1 -1
  28. package/dist/charts/state.js +15 -2
  29. package/dist/cli/shot/detect.d.ts.map +1 -1
  30. package/dist/cli/shot/detect.js +25 -36
  31. package/dist/dashboard/bar-list.d.ts.map +1 -1
  32. package/dist/dashboard/bar-list.js +16 -2
  33. package/dist/dashboard/bar-list.module.css +7 -2
  34. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  35. package/dist/dashboard/meter-model.d.ts +2 -0
  36. package/dist/dashboard/meter-model.d.ts.map +1 -1
  37. package/dist/dashboard/meter-model.js +99 -7
  38. package/dist/dashboard/meter-parts.d.ts +4 -7
  39. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  40. package/dist/dashboard/meter-parts.js +102 -78
  41. package/dist/dashboard/meter.d.ts +1 -1
  42. package/dist/dashboard/meter.d.ts.map +1 -1
  43. package/dist/dashboard/meter.js +10 -7
  44. package/dist/dashboard/meter.module.css +43 -12
  45. package/dist/dashboard/meter.module.css.d.ts +1 -2
  46. package/dist/dashboard/section.d.ts +1 -2
  47. package/dist/dashboard/section.d.ts.map +1 -1
  48. package/dist/dashboard/section.module.css +8 -7
  49. package/dist/dashboard/stat-card.module.css +19 -2
  50. package/dist/dashboard/stat-strip.d.ts +9 -1
  51. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  52. package/dist/dashboard/stat-strip.js +32 -6
  53. package/dist/dashboard/stat-strip.module.css +40 -1
  54. package/dist/dashboard/stat-strip.module.css.d.ts +3 -0
  55. package/dist/dashboard/visual-slot.d.ts +4 -0
  56. package/dist/dashboard/visual-slot.d.ts.map +1 -1
  57. package/dist/dashboard/visual-slot.js +2 -0
  58. package/dist/dashboard/widget-header.module.css +9 -0
  59. package/llms.txt +3 -3
  60. package/package.json +1 -1
  61. package/src/charts/Bars.tsx +7 -2
  62. package/src/charts/CartesianChart.tsx +2 -0
  63. package/src/charts/ChartCard.tsx +30 -7
  64. package/src/charts/Sparkline.tsx +105 -10
  65. package/src/charts/chart-box.module.css +50 -7
  66. package/src/charts/chart-box.module.css.d.ts +2 -0
  67. package/src/charts/chart-card.module.css +34 -0
  68. package/src/charts/chart-card.module.css.d.ts +2 -0
  69. package/src/charts/chart-legend.module.css +5 -6
  70. package/src/charts/compile.ts +60 -1
  71. package/src/charts/legend.tsx +64 -16
  72. package/src/charts/sparkline.module.css +13 -9
  73. package/src/charts/state.tsx +33 -7
  74. package/src/cli/shot/detect.ts +26 -40
  75. package/src/dashboard/bar-list.module.css +7 -2
  76. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  77. package/src/dashboard/bar-list.tsx +14 -2
  78. package/src/dashboard/meter-model.ts +147 -12
  79. package/src/dashboard/meter-parts.tsx +71 -50
  80. package/src/dashboard/meter.module.css +43 -12
  81. package/src/dashboard/meter.module.css.d.ts +1 -2
  82. package/src/dashboard/meter.tsx +22 -9
  83. package/src/dashboard/section.module.css +8 -7
  84. package/src/dashboard/section.tsx +1 -2
  85. package/src/dashboard/stat-card.module.css +19 -2
  86. package/src/dashboard/stat-strip.module.css +40 -1
  87. package/src/dashboard/stat-strip.module.css.d.ts +3 -0
  88. package/src/dashboard/stat-strip.tsx +49 -8
  89. package/src/dashboard/visual-slot.ts +5 -0
  90. package/src/dashboard/widget-header.module.css +9 -0
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useContext } from "react";
3
3
  import { VX } from "../tokens/index.js";
4
4
  import { isReading, normalizeSegments, segmentReading, spanOf } from "./meter-model.js";
5
- import { MeterBar, MeterEmpty, MeterLoading, MeterRing } from "./meter-parts.js";
5
+ import { MeterBar, MeterEmpty, MeterRing, MeterRingLoading } from "./meter-parts.js";
6
6
  import { asText } from "./scale.js";
7
7
  import { VisualSlotContext } from "./visual-slot.js";
8
8
  let warnedTrack = false;
@@ -23,12 +23,14 @@ function Meter(props) {
23
23
  const shell = { className, style, row };
24
24
  const ring = props.shape === "ring";
25
25
  warnInvalidTrack(min, max);
26
- const hostTone = useContext(VisualSlotContext)?.tone;
26
+ const host = useContext(VisualSlotContext);
27
+ const hostTone = host?.tone;
27
28
  const hostColor = hostTone === void 0 ? void 0 : VX.status[hostTone];
28
- if (props.loading === true)
29
- return /* @__PURE__ */ jsx(MeterLoading, { label, ring, zoned: props.zones !== void 0, shell });
30
- const segments = props.segments === void 0 ? void 0 : normalizeSegments(props.segments);
31
- const reading = segments === void 0 ? props.value : segmentReading(segments, min);
29
+ const loading = props.loading === true || host?.loading === true;
30
+ if (loading && ring) return /* @__PURE__ */ jsx(MeterRingLoading, { label, shell });
31
+ const segments = props.segments === void 0 || loading && props.segments.length === 0 ? void 0 : normalizeSegments(props.segments);
32
+ const placeholder = props.zones !== void 0 && props.zones.length > 0 ? min + spanOf(min, max).span / 2 : min;
33
+ const reading = loading ? segments === void 0 ? placeholder : segmentReading(segments, min) : segments === void 0 ? props.value : segmentReading(segments, min);
32
34
  if (!isReading(reading) || segments?.length === 0) {
33
35
  return /* @__PURE__ */ jsx(
34
36
  MeterEmpty,
@@ -69,7 +71,8 @@ function Meter(props) {
69
71
  forecastCaption: props.segments === void 0 ? void 0 : props.forecastCaption,
70
72
  startCaption: props.startCaption,
71
73
  endCaption: props.endCaption,
72
- readingAt: props.readingAt
74
+ readingAt: props.readingAt,
75
+ loading
73
76
  }
74
77
  );
75
78
  }
@@ -312,8 +312,7 @@
312
312
  color: var(--vx-muted);
313
313
  }
314
314
 
315
- /* One caption-height line: a blank caption row (empty) or the home of a skeleton line (loading), so
316
- * both stand at the loaded Meter's height. */
315
+ /* One caption-height line: a blank caption row of an empty Meter, so it stands at the loaded height. */
317
316
  .line {
318
317
  display: flex;
319
318
  align-items: center;
@@ -325,14 +324,50 @@
325
324
  height: 1.25em;
326
325
  }
327
326
 
328
- /* The skeleton holds the loaded footprint: figure row (zoned), track, caption / zone-name row. */
329
- .skeletonTrack {
330
- height: 0.375rem;
327
+ /* Loading is the loaded tree (`MeterBar` with `loading`): every row stands where it will and the
328
+ * height is the loaded one. Text is painted as skeleton in place: transparent ink on a pulsing pill
329
+ * the width of the caption, the track a pulsing bar. A caption the layout dropped stays hidden. */
330
+ .hold {
331
+ display: contents;
332
+ }
333
+
334
+ [data-meter-loading] {
335
+ --basalt-meter-skeleton: color-mix(in srgb, var(--vx-muted) 28%, transparent);
336
+ }
337
+
338
+ [data-meter-loading]
339
+ :is(.rowLabel, .caption, .captionEnd, .captionTarget, .zoneReading, .partCaption) {
340
+ color: transparent;
341
+ background: var(--basalt-meter-skeleton);
342
+ border-radius: var(--vx-radius-fine);
343
+ animation: meterPulse 1500ms linear infinite;
344
+ }
345
+
346
+ [data-meter-loading] .swatch {
347
+ visibility: hidden;
331
348
  }
332
349
 
333
- .skeletonCaption {
334
- width: 40%;
335
- height: 0.75rem;
350
+ [data-meter-loading] .track {
351
+ background: var(--basalt-meter-skeleton);
352
+ animation: meterPulse 1500ms linear infinite;
353
+ }
354
+
355
+ @keyframes meterPulse {
356
+ 0%,
357
+ 100% {
358
+ opacity: 0.4;
359
+ }
360
+
361
+ 50% {
362
+ opacity: 1;
363
+ }
364
+ }
365
+
366
+ @media (prefers-reduced-motion: reduce) {
367
+ [data-meter-loading]
368
+ :is(.rowLabel, .caption, .captionEnd, .captionTarget, .zoneReading, .partCaption, .track) {
369
+ animation: none;
370
+ }
336
371
  }
337
372
 
338
373
  /* ── ring ────────────────────────────────────────────────────────────────────────────────────── */
@@ -406,10 +441,6 @@
406
441
  height: 1lh;
407
442
  }
408
443
 
409
- .row .skeletonTrack {
410
- height: 1lh;
411
- }
412
-
413
444
  .row .line {
414
445
  display: none;
415
446
  }
@@ -34,8 +34,7 @@ declare const classes: {
34
34
  readonly empty: string
35
35
  readonly line: string
36
36
  readonly lineZoned: string
37
- readonly skeletonTrack: string
38
- readonly skeletonCaption: string
37
+ readonly hold: string
39
38
  readonly ringBox: string
40
39
  readonly ring: string
41
40
  readonly ringTrack: string
@@ -54,8 +54,7 @@ type SectionBaseProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'actions
54
54
  defaultOpen?: boolean;
55
55
  /** Rendered directly under the header and ALWAYS visible, collapsed or not: a collapsed section
56
56
  * still states its headline figures, which is what makes collapsing it a real option. Keep it to
57
- * one row — the body is what `children` is for. Section owns the summary text size (11 px, the
58
- * chart-text step): a `size` prop on a bare `Text` here is ignored — wrap it to opt out. */
57
+ * one row — the body is what `children` is for. A `Text` here renders at 11 (the chart-text step); wrap it to opt out. */
59
58
  summary?: ReactNode;
60
59
  /** Turns the root into a scroll anchor (`id` + `scroll-margin-top`). Inside `BasaltShell` the
61
60
  * offset is the clearance token; without a shell it also clears `PageBar`, which assumes the
@@ -1 +1 @@
1
- {"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../src/dashboard/section.tsx"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAInE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAGxD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAMpD,iGAAiG;AACjG,KAAK,aAAa,GACd,MAAM,GACN,UAAU,GACV,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,aAAa,GACb,eAAe,GACf,aAAa,GACb,YAAY,GACZ,WAAW,GACX,OAAO,CAAA;AAEX,KAAK,gBAAgB,GAAG,IAAI,CAC1B,iBAAiB,EACjB,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAC5D,GACC,WAAW,GACX,eAAe,CAAC,WAAW,CAAC,GAAG;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;IAC/B;;;;OAIG;IACH,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,gGAAgG;IAChG,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;8CAC0C;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;uBACmB;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;sGAEkG;IAClG,IAAI,CAAC,EAAE,OAAO,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AG,gBAAgB,GACzC,CACI,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GAClF,CAAC;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;KAC9D,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,KAAK;CAC7B,CAAC,CACL,CAAA;AA6CH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,KAAK,EACL,KAAK,EACL,IAAI,EACJ,WAAmB,EACnB,UAAU,EACV,WAAkB,EAClB,IAAI,EAAE,QAAQ,EACd,YAAY,EACZ,OAAO,EACP,EAAE,EACF,QAAQ,EACR,SAAS,EACT,KAAK,EACL,UAAU,EACV,YAAY,EAAE,SAAS,EACvB,GAAG,WAAW,EACf,EAAE,YAAY,+BA8Gd"}
@@ -76,15 +76,16 @@
76
76
  }
77
77
 
78
78
  /*
79
- * A bare `<Text size="xs">` summary line (argo's strength diagnostics shell: title 15 + chart-card
80
- * title 13 + summary 12 + chart ticks and legend 11 = four sizes) joins the chart text step, so the
81
- * shell stays at three: 15, 13, 11. Mantine's `Text` writes `--text-fz` inline from its `size` prop,
82
- * so no inherited custom property can reach it: this rule sets `font-size` itself, and the inline
83
- * `--text-fz` is then unused. Only a direct `Text` child is capped; a `Group` of stats keeps
84
- * the sizes its own parts ask for.
79
+ * A `Text` summary line (argo's strength diagnostics shell: title 15 + chart-card title 13 + summary
80
+ * 12 + chart ticks and legend 11 = four sizes) joins the chart text step, so the shell stays at
81
+ * three: 15, 13, 11. The cap is the `--text-fz` variable Mantine's `Text` reads for its font size,
82
+ * pinned `!important` so it outranks the inline value a `size` prop writes; a `Text` sized by the
83
+ * consumer's own CLASS sets `font-size` directly, never reads the variable, and keeps that size
84
+ * (argo's reading backlog `.facts`, 13). Only a direct `Text` child is capped; a `Group` of stats
85
+ * keeps the sizes its own parts ask for.
85
86
  */
86
87
  .summary > :global(.mantine-Text-root) {
87
- font-size: var(--vx-text-micro);
88
+ --text-fz: var(--vx-text-micro) !important;
88
89
  }
89
90
 
90
91
  /*
@@ -194,6 +194,23 @@
194
194
  }
195
195
  }
196
196
 
197
+ /* Cards of one StatGroup share ONE figure size. In the two-column phone state the last odd card spans the
198
+ * row, so its own width would size its numeral 22 against its row-mates' 16; the group's columns (a
199
+ * narrow card's size) set it for every card instead, whether or not a qualifier sits on its own line.
200
+ * `--basalt-stat-group-figure` on the group (or a wrapper) replaces that size. */
201
+ @container basalt-grid (max-width: 479.9px) {
202
+ [data-sm-cols] .body {
203
+ --basalt-stat-figure-size: var(--basalt-stat-group-figure, var(--vx-text-lg));
204
+ }
205
+ }
206
+
207
+ /* A one-column group (under 260px) has no spanning card: each keeps its own width's clamp. */
208
+ @container basalt-grid (max-width: 259.9px) {
209
+ [data-sm-cols] .body {
210
+ --basalt-stat-figure-size: clamp(var(--vx-text-lg), 8cqi, var(--vx-text-kpi));
211
+ }
212
+ }
213
+
197
214
  /* ── states ──────────────────────────────────────────────────────────────────────────────────── */
198
215
 
199
216
  /* The empty branch: one muted line in the figure's place, at the figure row's height. */
@@ -388,10 +405,10 @@
388
405
  margin-inline: calc(-1 * var(--vx-space-card-inset-x, 1rem));
389
406
  }
390
407
 
391
- /* A Sparkline's readout line (`--basalt-spark-readout-h`) above its plot: the card gap already sits
408
+ /* A slotted chart's readout line (`--basalt-spark-readout-h`) above its plot: the card gap already sits
392
409
  * above the slot, the slot reserves the rest, so the chip never covers the delta or qualifier row.
393
410
  * `.foot` reserves the same, so a card with a sparkline and one without keep the same height. */
394
- .sparklineBleed:has([data-basalt-sparkline]) {
411
+ .sparklineBleed:has([data-basalt-sparkline], [data-basalt-chart]) {
395
412
  box-sizing: content-box;
396
413
  padding-top: var(--basalt-spark-readout-reserve);
397
414
  }
@@ -51,7 +51,12 @@ export type StatStripCell = {
51
51
  rows?: readonly StatStripRow[];
52
52
  /** Inks the value only — set it when the reading is a verdict. */
53
53
  tone?: Tone;
54
- /** Skeleton in place of the readings. */
54
+ /**
55
+ * Skeleton in place of the readings, in the loaded shape: the value bar, the `visual` slot and the
56
+ * `footer` line keep the height they have loaded. Pass the same `visual` and `footer` as at rest
57
+ * (empty data is fine): the slot is measured, never shown — a `Meter` in it draws its own loading
58
+ * rows, any other visual is covered by one skeleton.
59
+ */
55
60
  loading?: boolean;
56
61
  /** Dims the cell while placeholder data shows. */
57
62
  stale?: boolean;
@@ -67,6 +72,9 @@ export type StatStripFooterEntry = {
67
72
  * every width, as a sibling AFTER the article (outside its `aria-labelledby` region). For a key that
68
73
  * names no cell it takes the full width under the grid. */
69
74
  under?: string;
75
+ /** The shot states this entry is absent in; replaces the strip's `shotAbsent` (an entry production
76
+ * omits where the strip itself shows, e.g. a fact that needs data the empty state lacks). */
77
+ shotAbsent?: readonly StatStripShotState[];
70
78
  };
71
79
  export type StatStripProps = BasaltProps & {
72
80
  /** The strip's accessible name. */
@@ -1 +1 @@
1
- {"version":3,"file":"stat-strip.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-strip.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAQxD,uFAAuF;AACvF,KAAK,kBAAkB,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAKvD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,sBAAsB;IACtB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,0FAA0F;IAC1F,SAAS,CAA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,CAAA;IAClB;;+DAE2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;iGAC6F;IAC7F,UAAU,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,SAAS,aAAa,EAAE,CAAA;IAC/B,mCAAmC;IACnC,MAAM,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAA;IACxC,sEAAsE;IACtE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACxB,sGAAsG;IACtG,UAAU,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAC3C,CAAA;AA2MD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,MAAM,EACN,IAAI,EACJ,UAAU,EACV,SAAS,EACT,KAAK,GACN,EAAE,cAAc,+BA8ChB"}
@@ -8,7 +8,7 @@ import { StatusDot } from "../theme/status-dot.js";
8
8
  import { VX } from "../tokens/index.js";
9
9
  import { InfoGlyph } from "./widget-header.js";
10
10
  import classes from "./stat-strip.module.css";
11
- import { HOSTED, VisualSlotContext } from "./visual-slot.js";
11
+ import { HOSTED, HOSTED_LOADING, VisualSlotContext } from "./visual-slot.js";
12
12
  const absentAttr = (states) => states === void 0 || states.length === 0 ? {} : { "data-shot-absent": states.join(" ") };
13
13
  const EMPTY = "\u2014";
14
14
  function CellState({ state }) {
@@ -39,7 +39,7 @@ function FooterCell({
39
39
  className: under ? classes.underCell : classes.footerCell,
40
40
  "data-strip-footer-cell": entry.key,
41
41
  "data-shot": `strip-footer-${entry.key}`,
42
- ...absentAttr(shotAbsent),
42
+ ...absentAttr(entry.shotAbsent ?? shotAbsent),
43
43
  ...under && { "data-under": entry.under },
44
44
  children: entry.content
45
45
  }
@@ -54,9 +54,24 @@ function StripCell({
54
54
  const { rows, loading } = cell;
55
55
  const state = loading ? void 0 : cell.state;
56
56
  const hasHero = cell.value !== void 0 || rows === void 0;
57
- const hostSlot = !hasHero ? null : cell.tone === void 0 ? HOSTED : { tone: cell.tone };
58
- const footerEl = cell.footer !== void 0 && /* @__PURE__ */ jsx("div", { className: classes.footer, "data-strip-footer": true, children: cell.footer });
59
- const heroEl = loading ? /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonValue, radius: "sm" }) : /* @__PURE__ */ jsxs("div", { className: classes.valueRow, children: [
57
+ const hostSlot = !hasHero ? loading ? HOSTED_LOADING : null : cell.tone === void 0 ? loading ? HOSTED_LOADING : HOSTED : { tone: cell.tone, ...loading && { loading } };
58
+ const footerEl = cell.footer !== void 0 && /* @__PURE__ */ jsxs(
59
+ "div",
60
+ {
61
+ className: cx(classes.footer, loading && classes.hold),
62
+ "data-strip-footer": true,
63
+ ...loading && { "aria-hidden": true, inert: true },
64
+ children: [
65
+ cell.footer,
66
+ loading && /* @__PURE__ */ jsx(Skeleton, { className: classes.holdSkeleton, radius: "sm" })
67
+ ]
68
+ }
69
+ );
70
+ const heroEl = loading ? cell.delta === void 0 ? /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonValue, radius: "sm" }) : /* @__PURE__ */ jsxs("div", { className: cx(classes.valueRow, classes.hold), "aria-hidden": true, inert: true, children: [
71
+ /* @__PURE__ */ jsx("span", { className: classes.value, children: cell.value ?? EMPTY }),
72
+ cell.delta,
73
+ /* @__PURE__ */ jsx(Skeleton, { className: classes.holdHero, radius: "sm" })
74
+ ] }) : /* @__PURE__ */ jsxs("div", { className: classes.valueRow, children: [
60
75
  /* @__PURE__ */ jsx(
61
76
  "span",
62
77
  {
@@ -106,7 +121,18 @@ function StripCell({
106
121
  ] }),
107
122
  state !== void 0 && /* @__PURE__ */ jsx(CellState, { state }),
108
123
  state === void 0 && hasHero && heroEl,
109
- state === void 0 && cell.visual !== void 0 && /* @__PURE__ */ jsx("div", { className: classes.visual, "data-strip-visual": true, children: /* @__PURE__ */ jsx(VisualSlotContext.Provider, { value: hostSlot, children: cell.visual }) }),
124
+ state === void 0 && cell.visual !== void 0 && /* @__PURE__ */ jsxs(
125
+ "div",
126
+ {
127
+ className: cx(classes.visual, loading && classes.hold),
128
+ "data-strip-visual": true,
129
+ ...loading && { "aria-hidden": true, inert: true },
130
+ children: [
131
+ /* @__PURE__ */ jsx(VisualSlotContext.Provider, { value: hostSlot, children: cell.visual }),
132
+ loading && /* @__PURE__ */ jsx(Skeleton, { className: classes.holdSkeleton, radius: "sm" })
133
+ ]
134
+ }
135
+ ),
110
136
  state === void 0 && rows !== void 0 && (loading ? /* @__PURE__ */ jsx("div", { className: classes.rows, "aria-hidden": "true", children: rows.map((row) => /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonRow, radius: "sm" }, row.key)) }) : /* @__PURE__ */ jsx("ul", { className: classes.rows, "data-strip-rows": true, children: rows.map((row) => /* @__PURE__ */ jsxs("li", { className: classes.row, "data-strip-row": row.key, children: [
111
137
  /* @__PURE__ */ jsx("span", { className: classes.rowLabel, children: row.label }),
112
138
  /* @__PURE__ */ jsx("span", { className: classes.visual, children: row.visual }),
@@ -223,6 +223,44 @@
223
223
  min-width: 0;
224
224
  }
225
225
 
226
+ /* Loading keeps the slot's or footer's own box (the consumer's visual or footer, laid out as loaded) and
227
+ * hides it under a skeleton, so the cell has its loaded height. A `Meter` inside draws its own loading
228
+ * rows and so stays visible; any other visual is covered by the one skeleton bar. */
229
+ .hold {
230
+ position: relative;
231
+ visibility: hidden;
232
+ }
233
+
234
+ .hold [data-basalt-meter],
235
+ .holdSkeleton {
236
+ visibility: visible;
237
+ }
238
+
239
+ .holdSkeleton {
240
+ position: absolute;
241
+ inset-block: 0.25rem;
242
+ inset-inline-start: 0;
243
+ width: 55%;
244
+ }
245
+
246
+ /* The hero's bar: the value row's first line, as the plain skeleton. */
247
+ .holdHero {
248
+ composes: holdSkeleton;
249
+ inset-block: 0 auto;
250
+ width: 45%;
251
+ height: calc(var(--vx-text-kpi) * 1.25);
252
+ }
253
+
254
+ .visual.hold > .holdSkeleton {
255
+ inset-block-start: max(0px, calc(var(--basalt-spark-readout-h) - var(--vx-space-stack-sm)));
256
+ inset-block-end: 0;
257
+ width: 100%;
258
+ }
259
+
260
+ .hold:has([data-basalt-meter]) > .holdSkeleton {
261
+ display: none;
262
+ }
263
+
226
264
  /* A Sparkline's hover readout takes this line above its plot (`charts/sparkline.module.css`). The
227
265
  * cell's own stack gap already sits above it; the slot reserves the rest, so the chip never covers
228
266
  * the value. */
@@ -230,7 +268,8 @@
230
268
  --basalt-spark-readout-h: 1.125rem;
231
269
  }
232
270
 
233
- .visual:has([data-basalt-sparkline]) {
271
+ /* A slotted chart's readout line above its plot: the cell reserves it so the chip never covers the value. */
272
+ .visual:has([data-basalt-sparkline], [data-basalt-chart]) {
234
273
  padding-top: max(0px, calc(var(--basalt-spark-readout-h) - var(--vx-space-stack-sm)));
235
274
  }
236
275
 
@@ -21,6 +21,9 @@ declare const classes: {
21
21
  readonly skeletonValue: string
22
22
  readonly skeletonRow: string
23
23
  readonly visual: string
24
+ readonly hold: string
25
+ readonly holdSkeleton: string
26
+ readonly holdHero: string
24
27
  readonly visualStack: string
25
28
  readonly reason: string
26
29
  readonly error: string
@@ -1,8 +1,12 @@
1
1
  import type { Tone } from '../common/props.js';
2
2
  export interface VisualSlot {
3
3
  readonly tone?: Tone;
4
+ /** The host is loading: a `Meter` in the slot draws its loading state without its own `loading`. */
5
+ readonly loading?: boolean;
4
6
  }
5
7
  /** A host with no verdict of its own: one shared object, so a provider never re-renders its readers. */
6
8
  export declare const HOSTED: VisualSlot;
9
+ /** `HOSTED` while the host loads. */
10
+ export declare const HOSTED_LOADING: VisualSlot;
7
11
  export declare const VisualSlotContext: import("react").Context<VisualSlot | null>;
8
12
  //# sourceMappingURL=visual-slot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"visual-slot.d.ts","sourceRoot":"","sources":["../../src/dashboard/visual-slot.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CACrB;AAED,wGAAwG;AACxG,eAAO,MAAM,MAAM,EAAE,UAAe,CAAA;AAEpC,eAAO,MAAM,iBAAiB,4CAAyC,CAAA"}
1
+ {"version":3,"file":"visual-slot.d.ts","sourceRoot":"","sources":["../../src/dashboard/visual-slot.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;IACpB,oGAAoG;IACpG,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,wGAAwG;AACxG,eAAO,MAAM,MAAM,EAAE,UAAe,CAAA;AAEpC,qCAAqC;AACrC,eAAO,MAAM,cAAc,EAAE,UAA8B,CAAA;AAE3D,eAAO,MAAM,iBAAiB,4CAAyC,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import { createContext } from "react";
2
2
  const HOSTED = {};
3
+ const HOSTED_LOADING = { loading: true };
3
4
  const VisualSlotContext = createContext(null);
4
5
  export {
5
6
  HOSTED,
7
+ HOSTED_LOADING,
6
8
  VisualSlotContext
7
9
  };
@@ -221,6 +221,15 @@
221
221
  min-width: 0;
222
222
  }
223
223
 
224
+ /* A `widget` tier (ChartCard) caption in `actions` — `<Text size="xs">`, 12 — joins the chart text
225
+ * step beside the plot's ticks and legend (argo's strength cards: title 13 + caption 12 + ticks 11
226
+ * + section title 15 was four sizes). The cap is the `--text-fz` variable `Text` reads, pinned
227
+ * `!important` over the inline value its `size` prop writes; other sizes (`md` figures, `sm`) are
228
+ * not touched, and a `Text` sized by a consumer class never reads the variable. */
229
+ .root[data-tier='widget'] .actions :global(.mantine-Text-root[style*='--mantine-font-size-xs']) {
230
+ --text-fz: var(--vx-text-micro) !important;
231
+ }
232
+
224
233
  /* Directly under the title row, 4px off it — 1px put it inside the title's own line box, so a
225
234
  * section with both read as a two-line heading rather than a heading plus a note. */
226
235
  .subtitle {
package/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # basalt-ui v2.24.0
1
+ # basalt-ui v2.26.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.24.0
16
+ Version: 2.26.0
17
17
 
18
18
  ## basalt-ui
19
19
  Import: import { ... } from 'basalt-ui'
@@ -384,7 +384,7 @@ Signature: ChartCard(props: ChartCardProps): ReactElement<unknown, string | JSXE
384
384
  count?: number
385
385
  actions?: ReactNode
386
386
  state?: ChartState
387
- placeholderHeight?: number | ResponsiveChartHeight
387
+ placeholderHeight?: number | ResponsiveChartHeight | "content"
388
388
  stale?: boolean
389
389
  stateNoun?: string
390
390
  onRetry?: (() => void)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basalt-ui",
3
- "version": "2.24.0",
3
+ "version": "2.26.0",
4
4
  "description": "Opinionated framework for Mantine-based React apps — theme, app shell, TanStack Charts, toolchain presets",
5
5
  "keywords": [
6
6
  "charts",
@@ -2,14 +2,17 @@
2
2
  * `Bars` — bar series on a band x scale (Date, number or string), stacked, grouped or normalized,
3
3
  * with line overlays on `y`/`y2` (`docs/V2-SPEC.md` § 9.3). A negative value draws below zero: a
4
4
  * stack diverges around the baseline (the 1.x `negativeBars`, now just a signed value). Zones,
5
- * reference lines, legend, cursor and tooltip are the rung's.
5
+ * reference lines, legend, cursor and tooltip are the rung's. In a visual slot (a `StatCard`
6
+ * `sparkline`, a strip cell's `visual`) it drops both axes, the grid, the margin and the legend and
7
+ * fills the slot like a `Sparkline`: a small histogram, its bins named in the tooltip below it.
6
8
  */
7
9
  import { barY } from '@tanstack/charts/bar'
8
10
  import { group } from '@tanstack/charts/group'
9
11
  import { stack } from '@tanstack/charts/stack'
10
- import { useCallback, useMemo } from 'react'
12
+ import { useCallback, useContext, useMemo } from 'react'
11
13
  import type { ReactElement } from 'react'
12
14
  import { CartesianRung } from './CartesianChart'
15
+ import { VisualSlotContext } from '../dashboard/visual-slot'
13
16
  import { VX } from '../tokens'
14
17
  import { emphasis, lineMark } from './marks'
15
18
  import { rowX } from './types'
@@ -107,6 +110,7 @@ export function Bars<T, X extends ChartX = ChartX>(props: BarsProps<T, X>): Reac
107
110
  const sharedColor = bars.some((b, i) => bars.findIndex((o) => o.color === b.color) !== i)
108
111
  guardLogStack(layout, bars.length > 0 && rest.y?.scale === 'log')
109
112
  const sample = rest.data[0]
113
+ const bare = useContext(VisualSlotContext) !== null
110
114
  const series = useMemo<ChartSeries<T>[]>(
111
115
  () => [
112
116
  // The legend has no datum: its swatch wears the shade the bars draw on the first row, so
@@ -179,6 +183,7 @@ export function Bars<T, X extends ChartX = ChartX>(props: BarsProps<T, X>): Reac
179
183
  crosshair={false}
180
184
  focusRing={false}
181
185
  reverseRows={layout !== 'grouped'}
186
+ {...(bare && { bare, tooltipBelow: true, legend: false as const })}
182
187
  {...(layout !== 'grouped' && { stack: layout })}
183
188
  />
184
189
  )
@@ -35,6 +35,8 @@ export type RungOptions = {
35
35
  focusRing?: boolean
36
36
  /** The legend goes from the wide class up, where `Lines`' end labels name the series. */
37
37
  hideLegendAtWide?: boolean
38
+ /** No axes, grid, margin or legend: the plot is the whole box (`Bars` in a visual slot). */
39
+ bare?: boolean
38
40
  }
39
41
 
40
42
  // A size container: the legend picks none/dots/chips from this box's width in CSS, so the server
@@ -136,14 +136,19 @@ type ChartCardBaseProps = BasaltProps &
136
136
  deltaPolarity?: DeltaPolarity | undefined
137
137
  /** A mono count tag after the title. */
138
138
  count?: number | undefined
139
- /** Right-aligned controls. */
139
+ /** Right-aligned controls. A `<Text size="xs">` caption here renders at 11 (the chart-text step,
140
+ * beside the plot's ticks); wrap it in a `span` or give it your own class to opt out. */
140
141
  actions?: ReactNode
141
142
  /** A resolved state replaces `children` with its placeholder; the header stays. */
142
143
  state?: ChartState | undefined
143
144
  /** Body height while a placeholder shows. Default: the chart height law, i.e. exactly the box an
144
145
  * unsized chart takes — pass the chart's own `height` when it states one, so a `<Suspense
145
- * fallback={<ChartCard state={{ pending: true }} …/>}>` reserves the final size. */
146
- placeholderHeight?: number | ResponsiveChartHeight | undefined
146
+ * fallback={<ChartCard state={{ pending: true }} …/>}>` reserves the final size.
147
+ * `'content'` is for a body that is not a chart (a list, a `Meter`): an error or empty state
148
+ * ends at its content. A pending state renders `children` as they are, so the body must draw
149
+ * its own loading (`BarList loading`, a loading `Meter`); a children-less `<Suspense
150
+ * fallback>` should pass a numeric height instead. */
151
+ placeholderHeight?: number | ResponsiveChartHeight | 'content' | undefined
147
152
  /** Placeholder data is showing: the facts row dims with the plot (a strip cell's `stale`). */
148
153
  stale?: boolean | undefined
149
154
  /** What an errored `state` names: "Could not load {stateNoun}". Default: no noun. */
@@ -159,8 +164,9 @@ type ChartCardBaseProps = BasaltProps &
159
164
 
160
165
  /**
161
166
  * `facts` replaces the legacy `value`/`delta` hero: the two are mutually exclusive in the type. The
162
- * facts show only at rest: while `state` is pending, errored or empty the figure would sit above a
163
- * skeleton or a placeholder that contradicts it, so the header keeps its title row alone.
167
+ * figures show only at rest: while `state` is errored or empty one would sit above a placeholder that
168
+ * contradicts it, so the header keeps its title row alone. While pending the row keeps its footprint
169
+ * as a skeleton (a figure bar and, with a `subtitle`, a basis line), never the stale figure.
164
170
  */
165
171
  export type ChartCardProps = ChartCardBaseProps &
166
172
  (
@@ -228,6 +234,18 @@ function Facts({
228
234
  )
229
235
  }
230
236
 
237
+ /** The facts row of a pending card: bars at the loaded row's height, no figure. */
238
+ function FactsSkeleton({ basis }: { basis: boolean }): ReactElement {
239
+ return (
240
+ <div data-basalt-facts-skeleton="" aria-hidden="true" className={classes.facts}>
241
+ <div className={classes.factsRow}>
242
+ <span className={classes.skeletonFigure} />
243
+ </div>
244
+ {basis && <p className={cx(classes.factsBasis, classes.skeletonBasis)} />}
245
+ </div>
246
+ )
247
+ }
248
+
231
249
  export function ChartCard({
232
250
  actions,
233
251
  state,
@@ -247,8 +265,12 @@ export function ChartCard({
247
265
  const { ref, short } = useShortCard()
248
266
  const resolved = resolveChartState(state)
249
267
  const showFacts = facts !== undefined && resolved === null
268
+ const skeletonFacts = facts !== undefined && resolved === 'pending'
250
269
  const hasHeader =
251
- actions !== undefined || showFacts || HEADER_TRIGGERS.some((k) => header[k] !== undefined)
270
+ actions !== undefined ||
271
+ showFacts ||
272
+ skeletonFacts ||
273
+ HEADER_TRIGGERS.some((k) => header[k] !== undefined)
252
274
  // With facts the subtitle is the basis line after them, not WidgetHeader's foldable row.
253
275
  const { subtitle, ...rest } = header
254
276
  const headerProps = facts === undefined ? header : rest
@@ -274,13 +296,14 @@ export function ChartCard({
274
296
  })}
275
297
  />
276
298
  {showFacts && <Facts facts={facts} basis={subtitle} stale={stale} />}
299
+ {skeletonFacts && <FactsSkeleton basis={subtitle !== undefined} />}
277
300
  </div>
278
301
  )}
279
302
  <div
280
303
  {...(classNames?.body !== undefined && { className: classNames.body })}
281
304
  style={bodyClipStyle}
282
305
  >
283
- {resolved === null ? (
306
+ {resolved === null || (resolved === 'pending' && placeholderHeight === 'content') ? (
284
307
  children
285
308
  ) : (
286
309
  <ChartPlaceholder