basalt-ui 2.25.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.
- package/CHANGELOG.md +33 -0
- package/MIGRATING.md +152 -19
- package/configs/oxlint-basalt.json +1 -1
- package/configs/oxlint-plugin.js +3 -9
- package/configs/oxlint-plugin.test.ts +6 -0
- package/dist/charts/ChartCard.d.ts +5 -3
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +10 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +65 -7
- package/dist/charts/chart-box.module.css +50 -7
- package/dist/charts/chart-box.module.css.d.ts +2 -0
- package/dist/charts/chart-card.module.css +34 -0
- package/dist/charts/chart-card.module.css.d.ts +2 -0
- package/dist/charts/chart-legend.module.css +5 -6
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +27 -1
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +42 -9
- package/dist/charts/sparkline.module.css +13 -9
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +6 -1
- package/dist/dashboard/meter-model.d.ts +2 -0
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +99 -7
- package/dist/dashboard/meter-parts.d.ts +4 -7
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +102 -78
- package/dist/dashboard/meter.d.ts +1 -1
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +10 -7
- package/dist/dashboard/meter.module.css +43 -12
- package/dist/dashboard/meter.module.css.d.ts +1 -2
- package/dist/dashboard/section.d.ts +1 -2
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.module.css +8 -7
- package/dist/dashboard/stat-card.module.css +17 -0
- package/dist/dashboard/stat-strip.d.ts +9 -1
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +32 -6
- package/dist/dashboard/stat-strip.module.css +38 -0
- package/dist/dashboard/stat-strip.module.css.d.ts +3 -0
- package/dist/dashboard/visual-slot.d.ts +4 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -1
- package/dist/dashboard/visual-slot.js +2 -0
- package/dist/dashboard/widget-header.module.css +9 -0
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +23 -4
- package/src/charts/Sparkline.tsx +105 -10
- package/src/charts/chart-box.module.css +50 -7
- package/src/charts/chart-box.module.css.d.ts +2 -0
- package/src/charts/chart-card.module.css +34 -0
- package/src/charts/chart-card.module.css.d.ts +2 -0
- package/src/charts/chart-legend.module.css +5 -6
- package/src/charts/compile.ts +40 -1
- package/src/charts/legend.tsx +64 -16
- package/src/charts/sparkline.module.css +13 -9
- package/src/charts/state.tsx +18 -1
- package/src/dashboard/meter-model.ts +147 -12
- package/src/dashboard/meter-parts.tsx +71 -50
- package/src/dashboard/meter.module.css +43 -12
- package/src/dashboard/meter.module.css.d.ts +1 -2
- package/src/dashboard/meter.tsx +22 -9
- package/src/dashboard/section.module.css +8 -7
- package/src/dashboard/section.tsx +1 -2
- package/src/dashboard/stat-card.module.css +17 -0
- package/src/dashboard/stat-strip.module.css +38 -0
- package/src/dashboard/stat-strip.module.css.d.ts +3 -0
- package/src/dashboard/stat-strip.tsx +49 -8
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +9 -0
|
@@ -86,19 +86,10 @@ const glue = (text) => typeof text === "string" ? String(glueUnits(text)).replac
|
|
|
86
86
|
function Line({ zoned, children }) {
|
|
87
87
|
return /* @__PURE__ */ jsx("div", { className: cx(classes.line, zoned && classes.lineZoned), "data-meter-line": true, "aria-hidden": true, children });
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
label,
|
|
91
|
-
ring,
|
|
92
|
-
zoned,
|
|
93
|
-
shell
|
|
94
|
-
}) {
|
|
89
|
+
function MeterRingLoading({ label, shell }) {
|
|
95
90
|
return /* @__PURE__ */ jsxs("div", { ...rootProps(shell), "aria-busy": "true", children: [
|
|
96
91
|
/* @__PURE__ */ jsx(VisuallyHidden, { className: classes.summary, children: `Loading ${label}` }),
|
|
97
|
-
|
|
98
|
-
zoned && /* @__PURE__ */ jsx(Line, { zoned, children: /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonCaption, radius: "sm" }) }),
|
|
99
|
-
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonTrack }),
|
|
100
|
-
/* @__PURE__ */ jsx(Line, { zoned, children: /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonCaption, radius: "sm" }) })
|
|
101
|
-
] })
|
|
92
|
+
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonRing, circle: true })
|
|
102
93
|
] });
|
|
103
94
|
}
|
|
104
95
|
const EMPTY_READING = "\u2014";
|
|
@@ -368,11 +359,20 @@ function CaptionRow({ items }) {
|
|
|
368
359
|
...item.align !== void 0 && { align: item.align },
|
|
369
360
|
...item.drop !== void 0 && { drop: item.drop }
|
|
370
361
|
}));
|
|
371
|
-
|
|
362
|
+
let next = placeCaptionRow(marks, rowWidth, gap);
|
|
363
|
+
items.forEach((item, i) => {
|
|
364
|
+
if (item.alt === void 0 || !next?.dropped[i]) return;
|
|
365
|
+
const retry = placeCaptionRow(
|
|
366
|
+
marks.map((m, j) => j === i ? { ...m, ...item.alt } : m),
|
|
367
|
+
rowWidth,
|
|
368
|
+
gap
|
|
369
|
+
);
|
|
370
|
+
if (retry !== null && !retry.dropped[i]) next = retry;
|
|
371
|
+
});
|
|
372
372
|
setPlaced((prev) => samePlacement(prev, next) ? prev : next);
|
|
373
373
|
},
|
|
374
374
|
items.map(
|
|
375
|
-
(i) => `${i.key}@${i.pct ?? i.edge ?? ""}${i.align ?? ""}${i.drop ?? ""}:${typeof i.node === "string" ? i.node : ""}`
|
|
375
|
+
(i) => `${i.key}@${i.pct ?? i.edge ?? ""}${i.align ?? ""}${i.drop ?? ""}${i.alt?.pct ?? ""}:${typeof i.node === "string" ? i.node : ""}`
|
|
376
376
|
).join("\0")
|
|
377
377
|
);
|
|
378
378
|
return /* @__PURE__ */ jsx(
|
|
@@ -455,6 +455,7 @@ function PartCaptions({ captions }) {
|
|
|
455
455
|
}
|
|
456
456
|
function MeterBar(props) {
|
|
457
457
|
const { label, min, max, format, zones, shell } = props;
|
|
458
|
+
const loading = props.loading === true;
|
|
458
459
|
const describedId = useId();
|
|
459
460
|
const model = modelBar(props);
|
|
460
461
|
const compact = shell.row;
|
|
@@ -505,9 +506,18 @@ function MeterBar(props) {
|
|
|
505
506
|
key: "forecast",
|
|
506
507
|
node: glue(model.forecastText),
|
|
507
508
|
drop: 2,
|
|
508
|
-
// The reading ends at the boundary, the forecast
|
|
509
|
-
|
|
510
|
-
...model.
|
|
509
|
+
// The reading ends at the boundary, the forecast ends where its fill does.
|
|
510
|
+
// If that collides, it falls back to starting at the boundary before it drops.
|
|
511
|
+
...props.readingAt !== "start" && model.forecastEndPct !== void 0 ? {
|
|
512
|
+
pct: model.forecastEndPct,
|
|
513
|
+
align: "end",
|
|
514
|
+
...model.boundaryPct !== void 0 && {
|
|
515
|
+
alt: {
|
|
516
|
+
pct: model.boundaryPct,
|
|
517
|
+
...start !== null && { align: "start" }
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
} : model.boundaryPct !== void 0 && { pct: model.boundaryPct }
|
|
511
521
|
}
|
|
512
522
|
] : [],
|
|
513
523
|
...compact ? [] : model.ticks.flatMap(
|
|
@@ -531,67 +541,81 @@ function MeterBar(props) {
|
|
|
531
541
|
] : []
|
|
532
542
|
];
|
|
533
543
|
const root = rootProps(shell);
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
},
|
|
565
|
-
i
|
|
566
|
-
)
|
|
567
|
-
),
|
|
568
|
-
model.parts.map((p, i) => /* @__PURE__ */ jsx(
|
|
569
|
-
"div",
|
|
570
|
-
{
|
|
571
|
-
className: cx(classes.fill, p.forecast && classes.forecastFill),
|
|
572
|
-
"data-meter-fill": p.forecast ? "forecast" : "committed",
|
|
573
|
-
...p.seam && { "data-meter-seam": "" },
|
|
574
|
-
"data-tone": props.tone === "muted" && p.color === void 0 && !p.forecast ? "muted" : void 0,
|
|
575
|
-
style: fillStyle(p)
|
|
544
|
+
const quiet = (node) => loading ? /* @__PURE__ */ jsx("div", { className: classes.hold, "aria-hidden": true, children: node }) : node;
|
|
545
|
+
return /* @__PURE__ */ jsxs(
|
|
546
|
+
"div",
|
|
547
|
+
{
|
|
548
|
+
...root,
|
|
549
|
+
className: root.className,
|
|
550
|
+
...loading && { "aria-busy": "true", "data-meter-loading": "" },
|
|
551
|
+
children: [
|
|
552
|
+
loading && /* @__PURE__ */ jsx(VisuallyHidden, { className: classes.summary, children: `Loading ${label}` }),
|
|
553
|
+
aboveTicks.length > 0 && /* @__PURE__ */ jsx(LabelRow, { zones: [], ticks: aboveTicks }),
|
|
554
|
+
/* @__PURE__ */ jsxs(
|
|
555
|
+
"div",
|
|
556
|
+
{
|
|
557
|
+
className: cx(classes.trackBox, trackHidden && classes.trackHidden),
|
|
558
|
+
"data-meter-track-hidden": trackHidden ? "" : void 0,
|
|
559
|
+
...!loading && {
|
|
560
|
+
"aria-label": label,
|
|
561
|
+
...ariaValues(props.reading, min, max, format),
|
|
562
|
+
...describedBy
|
|
563
|
+
},
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ jsxs(
|
|
566
|
+
"div",
|
|
567
|
+
{
|
|
568
|
+
className: classes.track,
|
|
569
|
+
"data-meter-track": true,
|
|
570
|
+
...model.stopsCss !== void 0 && {
|
|
571
|
+
"data-meter-stops": "",
|
|
572
|
+
// theme-allow hidden-inline-style — the gradient is the consumer's colour data
|
|
573
|
+
style: { "--basalt-stops": model.stopsCss }
|
|
576
574
|
},
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
575
|
+
children: [
|
|
576
|
+
zones?.map(
|
|
577
|
+
(z, i) => !loading && model.markerPct !== void 0 && /* @__PURE__ */ jsx(
|
|
578
|
+
"div",
|
|
579
|
+
{
|
|
580
|
+
className: classes.zone,
|
|
581
|
+
"data-meter-zone": z.label,
|
|
582
|
+
...i > 0 && zones[i - 1]?.tone === "muted" && z.tone === "muted" && { "data-meter-zone-seam": "" },
|
|
583
|
+
style: zoneStyle(z, i, zones.length, min, model.span)
|
|
584
|
+
},
|
|
585
|
+
i
|
|
586
|
+
)
|
|
587
|
+
),
|
|
588
|
+
(loading ? [] : model.parts).map((p, i) => /* @__PURE__ */ jsx(
|
|
589
|
+
"div",
|
|
590
|
+
{
|
|
591
|
+
className: cx(classes.fill, p.forecast && classes.forecastFill),
|
|
592
|
+
"data-meter-fill": p.forecast ? "forecast" : "committed",
|
|
593
|
+
...p.seam && { "data-meter-seam": "" },
|
|
594
|
+
"data-tone": props.tone === "muted" && p.color === void 0 && !p.forecast ? "muted" : void 0,
|
|
595
|
+
style: fillStyle(p)
|
|
596
|
+
},
|
|
597
|
+
i
|
|
598
|
+
))
|
|
599
|
+
]
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
!loading && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
603
|
+
/* @__PURE__ */ jsx(Tick, { kind: "marker", className: classes.marker, pct: model.markerPct }),
|
|
604
|
+
/* @__PURE__ */ jsx(Tick, { kind: "boundary", className: classes.boundaryTick, pct: model.boundaryPct }),
|
|
605
|
+
model.ticks.map((t) => /* @__PURE__ */ jsx(Tick, { kind: "tick", className: classes.tick, pct: t.pct }, t.key)),
|
|
606
|
+
/* @__PURE__ */ jsx(Tick, { kind: "target", className: classes.tick, pct: model.targetPct })
|
|
607
|
+
] })
|
|
608
|
+
]
|
|
609
|
+
}
|
|
610
|
+
),
|
|
611
|
+
zoneLabels.length > 0 && /* @__PURE__ */ jsx(LabelRow, { zones: zoneLabels, ticks: belowTicks }),
|
|
612
|
+
anchored && quiet(/* @__PURE__ */ jsx(ZoneReading, { pct: model.markerPct ?? 0, children: start })),
|
|
613
|
+
!loading && model.describedByText !== null && /* @__PURE__ */ jsx(VisuallyHidden, { id: describedId, className: classes.summary, children: model.describedByText }),
|
|
614
|
+
hasParts && quiet(/* @__PURE__ */ jsx(PartCaptions, { captions: model.partCaptions })),
|
|
615
|
+
items.length > 0 && quiet(/* @__PURE__ */ jsx(CaptionRow, { items }))
|
|
616
|
+
]
|
|
617
|
+
}
|
|
618
|
+
);
|
|
595
619
|
}
|
|
596
620
|
const TICK_WIDTH = "2px";
|
|
597
621
|
function tickPosition(kind, pct) {
|
|
@@ -609,6 +633,6 @@ function Tick({
|
|
|
609
633
|
export {
|
|
610
634
|
MeterBar,
|
|
611
635
|
MeterEmpty,
|
|
612
|
-
|
|
613
|
-
|
|
636
|
+
MeterRing,
|
|
637
|
+
MeterRingLoading
|
|
614
638
|
};
|
|
@@ -101,7 +101,7 @@ export type MeterProps = (BarCommon & {
|
|
|
101
101
|
}) | (BarCommon & {
|
|
102
102
|
/** Ordered parts, accumulated from `min`; their sum is the reading. `forecast` parts render lighter. */
|
|
103
103
|
segments: readonly MeterSegment[];
|
|
104
|
-
/** Names the forecast
|
|
104
|
+
/** Names the forecast, ending where its fill ends (default: `Forecast: <labels>`). */
|
|
105
105
|
forecastCaption?: string;
|
|
106
106
|
value?: never;
|
|
107
107
|
color?: never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter.d.ts","sourceRoot":"","sources":["../../src/dashboard/meter.tsx"],"names":[],"mappings":"AAsDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAKvE,KAAK,MAAM,GAAG,WAAW,GAAG;IAC1B,mGAAmG;IACnG,KAAK,EAAE,MAAM,CAAA;IACb,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,0FAA0F;IAC1F,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAClC,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qHAAqH;IACrH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,KAAK,SAAS,GAAG,MAAM,GAAG;IACxB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,iGAAiG;IACjG,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;IAC5B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IACtB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB;;;;;OAKG;IACH,OAAO,CAAC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AK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAC,GACF,CAAC,SAAS,GAAG;IACX,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACjC;;;OAGG;IACH,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAC,GACF,CAAC,MAAM,GAAG;IACR,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACjC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uGAAuG;IACvG,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sFAAsF;IACtF,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,OAAO,CAAC,EAAE,KAAK,CAAA;IACf,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAC,CAAA;AAkBN,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,+BAuEtC"}
|
package/dist/dashboard/meter.js
CHANGED
|
@@ -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,
|
|
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
|
|
26
|
+
const host = useContext(VisualSlotContext);
|
|
27
|
+
const hostTone = host?.tone;
|
|
27
28
|
const hostColor = hostTone === void 0 ? void 0 : VX.status[hostTone];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const segments = props.segments === void 0 ? void 0 : normalizeSegments(props.segments);
|
|
31
|
-
const
|
|
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
|
|
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
|
-
/*
|
|
329
|
-
.
|
|
330
|
-
|
|
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
|
-
.
|
|
334
|
-
|
|
335
|
-
|
|
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
|
|
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.
|
|
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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-
* A
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* so
|
|
83
|
-
*
|
|
84
|
-
*
|
|
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
|
-
|
|
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. */
|
|
@@ -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
|
-
/**
|
|
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":"
|
|
1
|
+
{"version":3,"file":"stat-strip.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-strip.tsx"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAA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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__ */
|
|
59
|
-
|
|
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__ */
|
|
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. */
|
|
@@ -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;
|
|
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"}
|