basalt-ui 2.22.0 → 2.24.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 +68 -0
- package/MIGRATING.md +400 -12
- package/agent/agents/basalt-design-reviewer.md +3 -3
- package/agent/skills/basalt-design/SKILL.md +2 -2
- package/agent/skills/basalt-design/references/catalogue.md +22 -19
- package/agent/skills/basalt-design/references/states.md +39 -0
- package/dist/charts/BandStrip.d.ts.map +1 -1
- package/dist/charts/BandStrip.js +51 -5
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/Bars.js +19 -3
- package/dist/charts/CartesianChart.d.ts +2 -0
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +7 -3
- package/dist/charts/ChartCard.d.ts +1 -1
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +25 -15
- package/dist/charts/Sparkline.d.ts +8 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +95 -15
- package/dist/charts/StackedArea.d.ts.map +1 -1
- package/dist/charts/StackedArea.js +5 -1
- package/dist/charts/band-fold.d.ts +22 -4
- package/dist/charts/band-fold.d.ts.map +1 -1
- package/dist/charts/band-fold.js +10 -2
- package/dist/charts/chart-dates.d.ts +12 -0
- package/dist/charts/chart-dates.d.ts.map +1 -0
- package/dist/charts/chart-dates.js +16 -0
- package/dist/charts/chart-legend.module.css +16 -0
- package/dist/charts/compile.d.ts +10 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +77 -24
- package/dist/charts/date-tick-format.d.ts +5 -5
- package/dist/charts/date-tick-format.d.ts.map +1 -1
- package/dist/charts/date-tick-format.js +3 -7
- package/dist/charts/labels.d.ts +7 -3
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +28 -17
- package/dist/charts/legend.d.ts +0 -6
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +87 -35
- package/dist/charts/ref-label.d.ts +17 -0
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +13 -1
- package/dist/charts/sparkline.module.css +62 -12
- package/dist/charts/sparkline.module.css.d.ts +1 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +4 -2
- package/dist/charts/types.d.ts +15 -3
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +9 -5
- package/dist/cli/shot/detect.js +8 -5
- package/dist/cli/shot/measure.js +19 -23
- package/dist/cli/shot/playwright.d.ts +8 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/cli/shot/playwright.js +5 -1
- package/dist/cli/shot/types.d.ts +2 -0
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/tokens-css.d.ts +5 -7
- package/dist/cli/tokens-css.d.ts.map +1 -1
- package/dist/cli/tokens-css.js +11 -12
- package/dist/dashboard/bar-list.d.ts +6 -1
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +8 -0
- package/dist/dashboard/bar-list.module.css +18 -0
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +2 -2
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/meter-model.d.ts +55 -21
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +98 -17
- package/dist/dashboard/meter-parts.d.ts +9 -2
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +99 -21
- package/dist/dashboard/meter.d.ts +21 -8
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +14 -3
- package/dist/dashboard/meter.module.css +57 -2
- package/dist/dashboard/meter.module.css.d.ts +5 -0
- package/dist/dashboard/query-state.d.ts +7 -3
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +15 -7
- package/dist/dashboard/section.d.ts +2 -1
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.module.css +12 -0
- package/dist/dashboard/settings-section.d.ts +1 -1
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +3 -3
- package/dist/dashboard/stat-card-parts.js +1 -1
- package/dist/dashboard/stat-card.module.css +43 -10
- package/dist/dashboard/stat-group.module.css +15 -0
- package/dist/dashboard/stat-strip.d.ts +16 -5
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +100 -74
- package/dist/dashboard/stat-strip.module.css +68 -62
- package/dist/dashboard/stat-strip.module.css.d.ts +1 -0
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +19 -1
- package/dist/dashboard/widget-header.module.css +6 -0
- package/dist/guard/index.d.ts +2 -2
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +1 -17
- package/dist/styles.css +18 -11
- package/dist/table/data-table.js +1 -1
- package/dist/theme/controls.module.css +19 -0
- package/dist/theme/controls.module.css.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +12 -7
- package/dist/theme/status-verdict.d.ts.map +1 -1
- package/dist/theme/status-verdict.js +9 -1
- package/dist/tokens/palette.d.ts +7 -10
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +7 -10
- package/llms.txt +7 -4
- package/package.json +1 -1
- package/src/charts/BandStrip.tsx +55 -5
- package/src/charts/Bars.tsx +31 -3
- package/src/charts/CartesianChart.tsx +9 -3
- package/src/charts/ChartCard.tsx +32 -19
- package/src/charts/Sparkline.tsx +139 -21
- package/src/charts/StackedArea.tsx +12 -1
- package/src/charts/band-fold.ts +25 -6
- package/src/charts/chart-dates.ts +30 -0
- package/src/charts/chart-legend.module.css +16 -0
- package/src/charts/compile.ts +148 -25
- package/src/charts/date-tick-format.ts +10 -13
- package/src/charts/labels.ts +43 -22
- package/src/charts/legend.tsx +70 -3
- package/src/charts/ref-label.ts +27 -0
- package/src/charts/sparkline.module.css +62 -12
- package/src/charts/sparkline.module.css.d.ts +1 -0
- package/src/charts/state.tsx +7 -4
- package/src/charts/types.ts +13 -3
- package/src/cli/shot/capture.ts +15 -3
- package/src/cli/shot/detect.ts +9 -9
- package/src/cli/shot/measure.ts +27 -27
- package/src/cli/shot/playwright.ts +18 -2
- package/src/cli/shot/types.ts +2 -0
- package/src/cli/tokens-css.ts +18 -20
- package/src/dashboard/bar-list.module.css +18 -0
- package/src/dashboard/bar-list.tsx +29 -0
- package/src/dashboard/delta-badge.tsx +6 -2
- package/src/dashboard/empty-state.tsx +4 -2
- package/src/dashboard/meter-model.ts +181 -47
- package/src/dashboard/meter-parts.tsx +187 -30
- package/src/dashboard/meter.module.css +57 -2
- package/src/dashboard/meter.module.css.d.ts +5 -0
- package/src/dashboard/meter.tsx +33 -10
- package/src/dashboard/query-state.tsx +20 -9
- package/src/dashboard/section.module.css +12 -0
- package/src/dashboard/section.tsx +2 -1
- package/src/dashboard/settings-section.tsx +4 -4
- package/src/dashboard/stat-card-parts.tsx +1 -1
- package/src/dashboard/stat-card.module.css +43 -10
- package/src/dashboard/stat-group.module.css +15 -0
- package/src/dashboard/stat-strip.module.css +68 -62
- package/src/dashboard/stat-strip.module.css.d.ts +1 -0
- package/src/dashboard/stat-strip.tsx +118 -59
- package/src/dashboard/widget-header.module.css +6 -0
- package/src/dashboard/widget-header.tsx +28 -1
- package/src/guard/index.ts +3 -19
- package/src/styles.css +18 -11
- package/src/table/data-table.tsx +1 -1
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +14 -8
- package/src/theme/controls.module.css +19 -0
- package/src/theme/controls.module.css.d.ts +1 -0
- package/src/theme/index.ts +12 -7
- package/src/theme/status-verdict.tsx +5 -1
- package/src/tokens/palette.ts +7 -10
|
@@ -6,8 +6,9 @@ import { cx } from "../common/props.js";
|
|
|
6
6
|
import {
|
|
7
7
|
ariaValues,
|
|
8
8
|
modelBar,
|
|
9
|
+
partColumns,
|
|
9
10
|
partsFitUnder,
|
|
10
|
-
|
|
11
|
+
placeCaptionRow,
|
|
11
12
|
placeRowLabels,
|
|
12
13
|
ringFraction,
|
|
13
14
|
ringMarks,
|
|
@@ -82,24 +83,39 @@ const UNIT_AFTER_NUMBER = new RegExp(`(\\d) (?=(?:${UNITS})(?![\\p{L}\\d]))`, "g
|
|
|
82
83
|
const SHORT_LAST_WORD = /([^ ]) ([^ ]{1,6})$/u;
|
|
83
84
|
const glueUnits = (text) => typeof text === "string" ? text.replace(UNIT_AFTER_NUMBER, "$1\xA0") : text;
|
|
84
85
|
const glue = (text) => typeof text === "string" ? String(glueUnits(text)).replace(SHORT_LAST_WORD, "$1\xA0$2") : text;
|
|
86
|
+
function Line({ zoned, children }) {
|
|
87
|
+
return /* @__PURE__ */ jsx("div", { className: cx(classes.line, zoned && classes.lineZoned), "data-meter-line": true, "aria-hidden": true, children });
|
|
88
|
+
}
|
|
85
89
|
function MeterLoading({
|
|
86
90
|
label,
|
|
87
91
|
ring,
|
|
92
|
+
zoned,
|
|
88
93
|
shell
|
|
89
94
|
}) {
|
|
90
95
|
return /* @__PURE__ */ jsxs("div", { ...rootProps(shell), "aria-busy": "true", children: [
|
|
91
96
|
/* @__PURE__ */ jsx(VisuallyHidden, { className: classes.summary, children: `Loading ${label}` }),
|
|
92
97
|
ring ? /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonRing, circle: true }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
98
|
+
zoned && /* @__PURE__ */ jsx(Line, { zoned, children: /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonCaption, radius: "sm" }) }),
|
|
93
99
|
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonTrack }),
|
|
94
|
-
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonCaption, radius: "sm" })
|
|
100
|
+
/* @__PURE__ */ jsx(Line, { zoned, children: /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonCaption, radius: "sm" }) })
|
|
95
101
|
] })
|
|
96
102
|
] });
|
|
97
103
|
}
|
|
104
|
+
const EMPTY_READING = "\u2014";
|
|
98
105
|
function MeterEmpty(props) {
|
|
99
|
-
const { label, text, ring, shell } = props;
|
|
106
|
+
const { label, text, ring, zoned, shell } = props;
|
|
100
107
|
return /* @__PURE__ */ jsxs("output", { ...rootProps(shell), "aria-label": label, children: [
|
|
101
|
-
ring ? /* @__PURE__ */
|
|
102
|
-
|
|
108
|
+
ring ? /* @__PURE__ */ jsxs("span", { className: classes.ringBox, children: [
|
|
109
|
+
/* @__PURE__ */ jsx(RingSvg, {}),
|
|
110
|
+
/* @__PURE__ */ jsx("span", { className: classes.ringValue, children: EMPTY_READING })
|
|
111
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
112
|
+
zoned && !shell.row && /* @__PURE__ */ jsx(Line, { zoned: true }),
|
|
113
|
+
/* @__PURE__ */ jsx("div", { className: classes.trackBox, children: /* @__PURE__ */ jsx("div", { className: classes.track, "data-meter-track": true }) })
|
|
114
|
+
] }),
|
|
115
|
+
text !== void 0 ? /* @__PURE__ */ jsx("span", { className: classes.empty, children: text }) : !ring && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { className: classes.summary, children: "No reading" }),
|
|
117
|
+
!shell.row && /* @__PURE__ */ jsx(Line, { zoned })
|
|
118
|
+
] })
|
|
103
119
|
] });
|
|
104
120
|
}
|
|
105
121
|
function MeterRing(props) {
|
|
@@ -304,12 +320,14 @@ function LabelRow({ zones, ticks }) {
|
|
|
304
320
|
function measureItems(row) {
|
|
305
321
|
const kids = [...row.children];
|
|
306
322
|
const widths = kids.map((kid) => {
|
|
307
|
-
const { whiteSpace, flex } = kid.style;
|
|
323
|
+
const { whiteSpace, flex, width: inline } = kid.style;
|
|
308
324
|
kid.style.whiteSpace = "nowrap";
|
|
309
325
|
kid.style.flex = "none";
|
|
326
|
+
kid.style.width = "max-content";
|
|
310
327
|
const width = kid.offsetWidth;
|
|
311
328
|
kid.style.whiteSpace = whiteSpace;
|
|
312
329
|
kid.style.flex = flex;
|
|
330
|
+
kid.style.width = inline;
|
|
313
331
|
return width;
|
|
314
332
|
});
|
|
315
333
|
return { widths, rowWidth: row.clientWidth, gap: columnGapOf(row) };
|
|
@@ -335,10 +353,10 @@ function useMeasured(rowRef, measure, key) {
|
|
|
335
353
|
};
|
|
336
354
|
}, [rowRef, key]);
|
|
337
355
|
}
|
|
338
|
-
const
|
|
356
|
+
const samePlacement = (a, b) => a === b || a !== null && b !== null && a.starts.length === b.starts.length && a.starts.every((v, i) => v === b.starts[i] && a.dropped[i] === b.dropped[i]);
|
|
339
357
|
function CaptionRow({ items }) {
|
|
340
358
|
const rowRef = useRef(null);
|
|
341
|
-
const [
|
|
359
|
+
const [placed, setPlaced] = useState(null);
|
|
342
360
|
useMeasured(
|
|
343
361
|
rowRef,
|
|
344
362
|
(row) => {
|
|
@@ -346,25 +364,32 @@ function CaptionRow({ items }) {
|
|
|
346
364
|
const marks = items.map((item, i) => ({
|
|
347
365
|
width: widths[i] ?? 0,
|
|
348
366
|
...item.pct !== void 0 && { pct: item.pct },
|
|
349
|
-
...item.edge !== void 0 && { edge: item.edge }
|
|
367
|
+
...item.edge !== void 0 && { edge: item.edge },
|
|
368
|
+
...item.align !== void 0 && { align: item.align },
|
|
369
|
+
...item.drop !== void 0 && { drop: item.drop }
|
|
350
370
|
}));
|
|
351
|
-
const next =
|
|
352
|
-
|
|
371
|
+
const next = placeCaptionRow(marks, rowWidth, gap);
|
|
372
|
+
setPlaced((prev) => samePlacement(prev, next) ? prev : next);
|
|
353
373
|
},
|
|
354
|
-
items.map(
|
|
374
|
+
items.map(
|
|
375
|
+
(i) => `${i.key}@${i.pct ?? i.edge ?? ""}${i.align ?? ""}${i.drop ?? ""}:${typeof i.node === "string" ? i.node : ""}`
|
|
376
|
+
).join("\0")
|
|
355
377
|
);
|
|
356
378
|
return /* @__PURE__ */ jsx(
|
|
357
379
|
"div",
|
|
358
380
|
{
|
|
359
381
|
ref: rowRef,
|
|
360
|
-
className: cx(classes.captions,
|
|
382
|
+
className: cx(classes.captions, placed !== null && classes.captionsAnchored),
|
|
361
383
|
"data-meter-captions": true,
|
|
362
|
-
"data-anchored":
|
|
384
|
+
"data-anchored": placed === null ? void 0 : "",
|
|
363
385
|
children: items.map((item, i) => /* @__PURE__ */ jsx(
|
|
364
386
|
"span",
|
|
365
387
|
{
|
|
366
|
-
className: item.end ? classes.captionEnd : classes.caption,
|
|
367
|
-
|
|
388
|
+
className: item.target ? classes.captionTarget : item.end ? classes.captionEnd : classes.caption,
|
|
389
|
+
"data-hidden": placed?.dropped[i] ? "" : void 0,
|
|
390
|
+
...placed?.starts[i] !== void 0 && {
|
|
391
|
+
style: { insetInlineStart: `${placed.starts[i]}px` }
|
|
392
|
+
},
|
|
368
393
|
children: item.node
|
|
369
394
|
},
|
|
370
395
|
item.key
|
|
@@ -375,16 +400,20 @@ function CaptionRow({ items }) {
|
|
|
375
400
|
function PartCaptions({ captions }) {
|
|
376
401
|
const rowRef = useRef(null);
|
|
377
402
|
const [under, setUnder] = useState(false);
|
|
403
|
+
const [overwide, setOverwide] = useState(false);
|
|
404
|
+
const [cols, setCols] = useState(0);
|
|
378
405
|
useMeasured(
|
|
379
406
|
rowRef,
|
|
380
407
|
(row) => {
|
|
381
408
|
const { widths, rowWidth, gap } = measureItems(row);
|
|
409
|
+
setOverwide(widths.some((w) => w > rowWidth));
|
|
382
410
|
const fits = partsFitUnder(
|
|
383
411
|
captions.map((c, i) => ({ startPct: c.startPct, width: widths[i] ?? 0 })),
|
|
384
412
|
rowWidth,
|
|
385
413
|
gap
|
|
386
414
|
);
|
|
387
415
|
setUnder(fits);
|
|
416
|
+
setCols(fits ? 0 : partColumns(widths, rowWidth, gap));
|
|
388
417
|
},
|
|
389
418
|
captions.map((c) => `${c.label} ${c.text}@${c.startPct}`).join("\0")
|
|
390
419
|
);
|
|
@@ -392,7 +421,13 @@ function PartCaptions({ captions }) {
|
|
|
392
421
|
"ul",
|
|
393
422
|
{
|
|
394
423
|
ref: rowRef,
|
|
395
|
-
className: cx(
|
|
424
|
+
className: cx(
|
|
425
|
+
classes.partCaptions,
|
|
426
|
+
under && classes.partCaptionsUnder,
|
|
427
|
+
overwide && classes.partCaptionsWrap,
|
|
428
|
+
cols > 0 && classes.partCaptionsGrid
|
|
429
|
+
),
|
|
430
|
+
style: cols > 0 ? { gridTemplateColumns: `repeat(${cols}, minmax(0, max-content))` } : void 0,
|
|
396
431
|
role: "list",
|
|
397
432
|
"data-meter-parts": true,
|
|
398
433
|
"data-anchored": under ? "" : void 0,
|
|
@@ -430,33 +465,74 @@ function MeterBar(props) {
|
|
|
430
465
|
const anchored = marked && start !== null;
|
|
431
466
|
const trackHidden = props.track === false && model.parts.length === 1 && props.segments === void 0 && props.target === void 0 && model.ticks.length === 0;
|
|
432
467
|
const hasParts = model.partCaptions.length > 0;
|
|
433
|
-
const
|
|
468
|
+
const zoned = zones !== void 0 && zones.length > 0;
|
|
469
|
+
const labelled = model.ticks.filter((t) => t.label !== void 0);
|
|
470
|
+
const startFigure = !compact && !zoned && props.startCaption !== null && (model.ticks.length > 0 || model.targetPct !== void 0) && !labelled.some((t) => t.pct <= 0);
|
|
471
|
+
const tickLabels = compact ? [] : [
|
|
472
|
+
...startFigure ? [
|
|
473
|
+
{
|
|
474
|
+
key: "start",
|
|
475
|
+
pct: 0,
|
|
476
|
+
label: format(min),
|
|
477
|
+
caption: void 0,
|
|
478
|
+
text: ""
|
|
479
|
+
}
|
|
480
|
+
] : [],
|
|
481
|
+
...labelled
|
|
482
|
+
];
|
|
434
483
|
const zoneLabels = compact ? [] : model.zoneLabels;
|
|
484
|
+
const isEnd = (t) => t.pct <= 0 || t.pct >= 100;
|
|
485
|
+
const aboveTicks = zoneLabels.length > 0 ? tickLabels.filter(isEnd) : tickLabels;
|
|
486
|
+
const belowTicks = zoneLabels.length > 0 ? tickLabels.filter((t) => !isEnd(t)) : [];
|
|
435
487
|
const describedBy = model.describedByText === null ? {} : { "aria-describedby": describedId };
|
|
436
488
|
const endOverride = props.endCaption !== void 0;
|
|
437
489
|
const targetHere = !endOverride && model.targetPct !== void 0 && model.endText !== null;
|
|
438
490
|
const end = compact ? null : endOverride ? props.endCaption : model.endText;
|
|
439
491
|
const items = compact ? [] : [
|
|
440
|
-
...start !== null && !anchored ? [
|
|
492
|
+
...start !== null && !anchored ? [
|
|
493
|
+
{
|
|
494
|
+
key: "start",
|
|
495
|
+
node: glue(start),
|
|
496
|
+
// The reading sits at its fill's end (clamped inside the track); `readingAt="start"` keeps the old start edge.
|
|
497
|
+
...props.readingAt !== "start" && model.fillEndPct !== void 0 && {
|
|
498
|
+
pct: model.fillEndPct,
|
|
499
|
+
align: "end"
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
] : [],
|
|
441
503
|
...model.forecastText !== null ? [
|
|
442
504
|
{
|
|
443
505
|
key: "forecast",
|
|
444
506
|
node: glue(model.forecastText),
|
|
507
|
+
drop: 2,
|
|
508
|
+
// The reading ends at the boundary, the forecast begins there.
|
|
509
|
+
...props.readingAt !== "start" && start !== null && { align: "start" },
|
|
445
510
|
...model.boundaryPct !== void 0 && { pct: model.boundaryPct }
|
|
446
511
|
}
|
|
447
512
|
] : [],
|
|
513
|
+
...compact ? [] : model.ticks.flatMap(
|
|
514
|
+
(t) => t.caption === void 0 ? [] : [
|
|
515
|
+
{
|
|
516
|
+
key: `tick${t.key}`,
|
|
517
|
+
node: glue(t.caption),
|
|
518
|
+
pct: t.pct,
|
|
519
|
+
drop: 1
|
|
520
|
+
}
|
|
521
|
+
]
|
|
522
|
+
),
|
|
448
523
|
...end !== null ? [
|
|
449
524
|
{
|
|
450
525
|
key: "end",
|
|
451
526
|
node: glue(end),
|
|
452
527
|
end: true,
|
|
528
|
+
...targetHere && { target: true },
|
|
453
529
|
...targetHere && model.targetPct !== void 0 ? { pct: model.targetPct } : { edge: "end" }
|
|
454
530
|
}
|
|
455
531
|
] : []
|
|
456
532
|
];
|
|
457
533
|
const root = rootProps(shell);
|
|
458
534
|
return /* @__PURE__ */ jsxs("div", { ...root, className: root.className, children: [
|
|
459
|
-
|
|
535
|
+
aboveTicks.length > 0 && /* @__PURE__ */ jsx(LabelRow, { zones: [], ticks: aboveTicks }),
|
|
460
536
|
/* @__PURE__ */ jsxs(
|
|
461
537
|
"div",
|
|
462
538
|
{
|
|
@@ -483,6 +559,7 @@ function MeterBar(props) {
|
|
|
483
559
|
{
|
|
484
560
|
className: classes.zone,
|
|
485
561
|
"data-meter-zone": z.label,
|
|
562
|
+
...i > 0 && zones[i - 1]?.tone === "muted" && z.tone === "muted" && { "data-meter-zone-seam": "" },
|
|
486
563
|
style: zoneStyle(z, i, zones.length, min, model.span)
|
|
487
564
|
},
|
|
488
565
|
i
|
|
@@ -493,6 +570,7 @@ function MeterBar(props) {
|
|
|
493
570
|
{
|
|
494
571
|
className: cx(classes.fill, p.forecast && classes.forecastFill),
|
|
495
572
|
"data-meter-fill": p.forecast ? "forecast" : "committed",
|
|
573
|
+
...p.seam && { "data-meter-seam": "" },
|
|
496
574
|
"data-tone": props.tone === "muted" && p.color === void 0 && !p.forecast ? "muted" : void 0,
|
|
497
575
|
style: fillStyle(p)
|
|
498
576
|
},
|
|
@@ -508,7 +586,7 @@ function MeterBar(props) {
|
|
|
508
586
|
]
|
|
509
587
|
}
|
|
510
588
|
),
|
|
511
|
-
zoneLabels.length > 0 && /* @__PURE__ */ jsx(LabelRow, { zones: zoneLabels, ticks:
|
|
589
|
+
zoneLabels.length > 0 && /* @__PURE__ */ jsx(LabelRow, { zones: zoneLabels, ticks: belowTicks }),
|
|
512
590
|
anchored && /* @__PURE__ */ jsx(ZoneReading, { pct: model.markerPct ?? 0, children: start }),
|
|
513
591
|
model.describedByText !== null && /* @__PURE__ */ jsx(VisuallyHidden, { id: describedId, className: classes.summary, children: model.describedByText }),
|
|
514
592
|
hasParts && /* @__PURE__ */ jsx(PartCaptions, { captions: model.partCaptions }),
|
|
@@ -12,7 +12,7 @@ type Common = BasaltProps & {
|
|
|
12
12
|
format?: (value: number) => string;
|
|
13
13
|
/** Renders a skeleton with the meter's footprint. */
|
|
14
14
|
loading?: boolean;
|
|
15
|
-
/** Muted line shown when there is no reading
|
|
15
|
+
/** Muted line shown when there is no reading; none by default (the muted track stands alone, caption rows blank). */
|
|
16
16
|
emptyText?: string;
|
|
17
17
|
};
|
|
18
18
|
type BarCommon = Common & {
|
|
@@ -21,10 +21,13 @@ type BarCommon = Common & {
|
|
|
21
21
|
target?: number;
|
|
22
22
|
/**
|
|
23
23
|
* More marks on the track (cut-offs, a window mean). Each is drawn at `at`; a `label` is captioned
|
|
24
|
-
* above the track, or on a zoned Meter in the zone-name row (the end ticks at the row's ends)
|
|
25
|
-
* caption
|
|
26
|
-
*
|
|
27
|
-
* and `target`.
|
|
24
|
+
* above the track, or on a zoned Meter in the zone-name row (the end ticks at the row's ends); a
|
|
25
|
+
* `caption` sits under the track, centred on the mark and clamped inside it. A label that would
|
|
26
|
+
* collide with another hides. A tick outside `[min, max]` is dropped, not clamped. All are listed
|
|
27
|
+
* in the accessible description. Works with `value`, `zones`, `segments` and `target`.
|
|
28
|
+
*
|
|
29
|
+
* Given `ticks` (or a `target`), a plain or segmented bar also labels where its track starts: the
|
|
30
|
+
* start figure `format(min)`, above the track. `startCaption={null}` drops it.
|
|
28
31
|
*/
|
|
29
32
|
ticks?: readonly MeterTick[];
|
|
30
33
|
/**
|
|
@@ -41,11 +44,14 @@ type BarCommon = Common & {
|
|
|
41
44
|
* Put the value beside it in your own layout.
|
|
42
45
|
*/
|
|
43
46
|
size?: 'row';
|
|
44
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Start caption (default: the formatted reading). `null` drops it, and the start figure that
|
|
49
|
+
* `ticks`/`target` add above the track; zone labels stay.
|
|
50
|
+
*/
|
|
45
51
|
startCaption?: ReactNode;
|
|
46
52
|
/**
|
|
47
|
-
* End caption (default: `Target <target
|
|
48
|
-
* when it fits). `null` drops it; zone labels stay.
|
|
53
|
+
* End caption (default: `Target <target>` with the Meter's `format`, drawn at the target's tick
|
|
54
|
+
* rather than the track end when it fits). `null` drops it; zone labels stay.
|
|
49
55
|
*/
|
|
50
56
|
endCaption?: ReactNode;
|
|
51
57
|
/**
|
|
@@ -55,6 +61,12 @@ type BarCommon = Common & {
|
|
|
55
61
|
* to print it inside a host. A `stops` track prints it only when `true`.
|
|
56
62
|
*/
|
|
57
63
|
reading?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Where the reading caption sits under a plain or segmented bar. `'fill'` (default): at the end of
|
|
66
|
+
* the fill, clamped inside the track (at the start when the fill is too short to hold it).
|
|
67
|
+
* `'start'`: at the track's start, as before 2.24.
|
|
68
|
+
*/
|
|
69
|
+
readingAt?: 'fill' | 'start';
|
|
58
70
|
};
|
|
59
71
|
/**
|
|
60
72
|
* One of four forms; mixing them is a compile error.
|
|
@@ -123,6 +135,7 @@ export type MeterProps = (BarCommon & {
|
|
|
123
135
|
startCaption?: never;
|
|
124
136
|
endCaption?: never;
|
|
125
137
|
reading?: never;
|
|
138
|
+
readingAt?: never;
|
|
126
139
|
stops?: never;
|
|
127
140
|
track?: never;
|
|
128
141
|
});
|
|
@@ -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,C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AK,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,+BA0DtC"}
|
package/dist/dashboard/meter.js
CHANGED
|
@@ -25,11 +25,21 @@ function Meter(props) {
|
|
|
25
25
|
warnInvalidTrack(min, max);
|
|
26
26
|
const hostTone = useContext(VisualSlotContext)?.tone;
|
|
27
27
|
const hostColor = hostTone === void 0 ? void 0 : VX.status[hostTone];
|
|
28
|
-
if (props.loading === true)
|
|
28
|
+
if (props.loading === true)
|
|
29
|
+
return /* @__PURE__ */ jsx(MeterLoading, { label, ring, zoned: props.zones !== void 0, shell });
|
|
29
30
|
const segments = props.segments === void 0 ? void 0 : normalizeSegments(props.segments);
|
|
30
31
|
const reading = segments === void 0 ? props.value : segmentReading(segments, min);
|
|
31
32
|
if (!isReading(reading) || segments?.length === 0) {
|
|
32
|
-
return /* @__PURE__ */ jsx(
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
MeterEmpty,
|
|
35
|
+
{
|
|
36
|
+
label,
|
|
37
|
+
text: props.emptyText,
|
|
38
|
+
ring,
|
|
39
|
+
zoned: props.zones !== void 0,
|
|
40
|
+
shell
|
|
41
|
+
}
|
|
42
|
+
);
|
|
33
43
|
}
|
|
34
44
|
if (props.shape === "ring") {
|
|
35
45
|
return /* @__PURE__ */ jsx(
|
|
@@ -58,7 +68,8 @@ function Meter(props) {
|
|
|
58
68
|
tone: barTone(props.tone, plain),
|
|
59
69
|
forecastCaption: props.segments === void 0 ? void 0 : props.forecastCaption,
|
|
60
70
|
startCaption: props.startCaption,
|
|
61
|
-
endCaption: props.endCaption
|
|
71
|
+
endCaption: props.endCaption,
|
|
72
|
+
readingAt: props.readingAt
|
|
62
73
|
}
|
|
63
74
|
);
|
|
64
75
|
}
|
|
@@ -62,6 +62,12 @@
|
|
|
62
62
|
background: color-mix(in srgb, var(--vx-muted) 65%, transparent);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/* Muted parts share one flat fill: a track-coloured hairline at the shared edge tells them apart. */
|
|
66
|
+
.fill[data-meter-seam] {
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
border-inline-start: 1px solid var(--vx-surface-subtle);
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
/* The committed/forecast pair: the same neutral at two strengths. Flat, never hatched. */
|
|
66
72
|
.forecastFill {
|
|
67
73
|
background: color-mix(in srgb, var(--vx-line) 45%, transparent);
|
|
@@ -200,6 +206,14 @@
|
|
|
200
206
|
white-space: nowrap;
|
|
201
207
|
}
|
|
202
208
|
|
|
209
|
+
/* `text-wrap` sets the same longhand as `white-space: nowrap`: `.caption`'s `balance`, declared below,
|
|
210
|
+
* would win on source order and let a caption placed at its measured width wrap on a sub-pixel
|
|
211
|
+
* difference. One class more outranks it. */
|
|
212
|
+
.captionsAnchored > :is(.caption) {
|
|
213
|
+
white-space: nowrap;
|
|
214
|
+
text-wrap: nowrap;
|
|
215
|
+
}
|
|
216
|
+
|
|
203
217
|
/* Captions never truncate: the row wraps, and a caption wider than the row wraps inside itself. */
|
|
204
218
|
.caption {
|
|
205
219
|
min-width: 0;
|
|
@@ -214,6 +228,19 @@
|
|
|
214
228
|
text-align: end;
|
|
215
229
|
}
|
|
216
230
|
|
|
231
|
+
/* The target figure is one line: it never wraps (the row drops other captions first). A consumer's
|
|
232
|
+
* own end caption is prose and may still wrap. */
|
|
233
|
+
.captionTarget {
|
|
234
|
+
composes: captionEnd;
|
|
235
|
+
flex: none;
|
|
236
|
+
white-space: nowrap;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* A caption the row has no room for: still laid out (so a resize can measure it again), not shown. */
|
|
240
|
+
.captionsAnchored > [data-hidden] {
|
|
241
|
+
visibility: hidden;
|
|
242
|
+
}
|
|
243
|
+
|
|
217
244
|
/* The visually-hidden summary and loading text are still text: they read the caption size, not the
|
|
218
245
|
* body size they would inherit. */
|
|
219
246
|
.root .summary {
|
|
@@ -235,11 +262,26 @@
|
|
|
235
262
|
color: var(--vx-muted);
|
|
236
263
|
}
|
|
237
264
|
|
|
265
|
+
/* An entry is one line: swatch, name and value never break apart; the row wraps between entries. */
|
|
238
266
|
.partCaption {
|
|
239
267
|
display: inline-flex;
|
|
268
|
+
flex: none;
|
|
240
269
|
align-items: baseline;
|
|
241
270
|
gap: var(--vx-space-control-gap, 0.375rem);
|
|
271
|
+
white-space: nowrap;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Not every entry fits one row: a grid with the measured column count, never one entry alone. */
|
|
275
|
+
.partCaptionsGrid {
|
|
276
|
+
display: grid;
|
|
277
|
+
justify-content: start;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* Only an entry wider than the whole row may break (measured), so nothing overflows the card. */
|
|
281
|
+
.partCaptionsWrap > .partCaption {
|
|
282
|
+
flex: 0 1 auto;
|
|
242
283
|
min-width: 0;
|
|
284
|
+
white-space: normal;
|
|
243
285
|
overflow-wrap: anywhere;
|
|
244
286
|
}
|
|
245
287
|
|
|
@@ -270,7 +312,20 @@
|
|
|
270
312
|
color: var(--vx-muted);
|
|
271
313
|
}
|
|
272
314
|
|
|
273
|
-
/*
|
|
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. */
|
|
317
|
+
.line {
|
|
318
|
+
display: flex;
|
|
319
|
+
align-items: center;
|
|
320
|
+
height: 1lh;
|
|
321
|
+
font-size: var(--basalt-meter-caption);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.lineZoned {
|
|
325
|
+
height: 1.25em;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* The skeleton holds the loaded footprint: figure row (zoned), track, caption / zone-name row. */
|
|
274
329
|
.skeletonTrack {
|
|
275
330
|
height: 0.375rem;
|
|
276
331
|
}
|
|
@@ -355,6 +410,6 @@
|
|
|
355
410
|
height: 1lh;
|
|
356
411
|
}
|
|
357
412
|
|
|
358
|
-
.row .
|
|
413
|
+
.row .line {
|
|
359
414
|
display: none;
|
|
360
415
|
}
|
|
@@ -23,12 +23,17 @@ declare const classes: {
|
|
|
23
23
|
readonly captions: string
|
|
24
24
|
readonly caption: string
|
|
25
25
|
readonly captionEnd: string
|
|
26
|
+
readonly captionTarget: string
|
|
26
27
|
readonly captionsAnchored: string
|
|
27
28
|
readonly partCaptions: string
|
|
28
29
|
readonly partCaption: string
|
|
29
30
|
readonly partCaptionsUnder: string
|
|
31
|
+
readonly partCaptionsWrap: string
|
|
32
|
+
readonly partCaptionsGrid: string
|
|
30
33
|
readonly swatch: string
|
|
31
34
|
readonly empty: string
|
|
35
|
+
readonly line: string
|
|
36
|
+
readonly lineZoned: string
|
|
32
37
|
readonly skeletonTrack: string
|
|
33
38
|
readonly skeletonCaption: string
|
|
34
39
|
readonly ringBox: string
|
|
@@ -30,10 +30,14 @@ export type QueryEmptyCopy = {
|
|
|
30
30
|
export type LoadingStateProps = BasaltProps & {
|
|
31
31
|
/** How loud this state is. Default `'page'`. */
|
|
32
32
|
tier?: QueryStateTier;
|
|
33
|
-
/** Accessible name for the
|
|
33
|
+
/** Accessible name for the loading state. Say what is loading. */
|
|
34
34
|
label?: string;
|
|
35
35
|
};
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* `tier="page"` centres a neutral spinner in a generous block (a route body whose shape is unknown);
|
|
38
|
+
* `'section'` is a neutral skeleton, never an accent spinner. A card region that knows its loaded
|
|
39
|
+
* shape passes `loading` to `QueryState` instead.
|
|
40
|
+
*/
|
|
37
41
|
export declare function LoadingState({ tier, label, className, style, }: LoadingStateProps): ReactNode;
|
|
38
42
|
export type ErrorStateProps = BasaltProps & {
|
|
39
43
|
/** Whatever was thrown — the raw Eden/fetch envelope is fine, it gets decoded. */
|
|
@@ -117,7 +121,7 @@ export type QueryStateProps<TData> = BasaltProps & SlotStylesProps<QueryStateSlo
|
|
|
117
121
|
errorAction?: ReactNode;
|
|
118
122
|
/** How loud every branch is. Default `'page'`. */
|
|
119
123
|
tier?: QueryStateTier;
|
|
120
|
-
/** Replace the default
|
|
124
|
+
/** Replace the default loading state (e.g. with a skeleton in the region's loaded shape). */
|
|
121
125
|
loading?: ReactNode;
|
|
122
126
|
};
|
|
123
127
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-state.d.ts","sourceRoot":"","sources":["../../src/dashboard/query-state.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAEhE;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,CAAA;AAE/C;;;;;GAKG;AACH,YAAY,EAAE,cAAc,EAAE,CAAA;AAE9B,kGA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,EAAE,MAAM,EACd,OAAO,GAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAwB,GACjD,WAAW,CAAC,KAAK,CAAC,CASpB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAA;AAEnC,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI,WAAW,GAC9C,eAAe,CAAC,cAAc,CAAC,GAAG;IAChC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAA;IAC5B,wFAAwF;IACxF,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,SAAS,CAAC,CAAA;IAClD,uDAAuD;IACvD,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,6FAA6F;IAC7F,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uDAAuD;IACvD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,kDAAkD;IAClD,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,6FAA6F;IAC7F,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,EAChC,KAAK,EACL,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAA6B,EAC7B,aAAqC,EACrC,WAAW,EACX,IAAI,EACJ,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CAqEpC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Center, Group, Loader, Stack, Text } from "@mantine/core";
|
|
2
|
+
import { Center, Group, Loader, Skeleton, Stack, Text, VisuallyHidden } from "@mantine/core";
|
|
3
3
|
import { toErrorMessage } from "../common/errors.js";
|
|
4
4
|
import { cx } from "../common/props.js";
|
|
5
5
|
import { RetryButton } from "../common/retry-button.js";
|
|
@@ -15,13 +15,21 @@ function LoadingState({
|
|
|
15
15
|
}) {
|
|
16
16
|
const resolved = tier ?? "page";
|
|
17
17
|
if (resolved === "section") {
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
Stack,
|
|
20
20
|
{
|
|
21
|
-
|
|
21
|
+
component: "output",
|
|
22
|
+
gap: "xs",
|
|
22
23
|
"aria-label": label,
|
|
24
|
+
"aria-busy": "true",
|
|
23
25
|
...className !== void 0 && { className },
|
|
24
|
-
...style !== void 0 && { style }
|
|
26
|
+
...style !== void 0 && { style },
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: label }),
|
|
29
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 14, width: "40%" }),
|
|
30
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 14 }),
|
|
31
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 14, width: "75%" })
|
|
32
|
+
]
|
|
25
33
|
}
|
|
26
34
|
);
|
|
27
35
|
}
|
|
@@ -30,13 +38,13 @@ function LoadingState({
|
|
|
30
38
|
{
|
|
31
39
|
...className !== void 0 && { className },
|
|
32
40
|
style: { paddingBlock: "calc(var(--vx-space-stack-xs, 0.25rem) * 16)", ...style },
|
|
33
|
-
children: /* @__PURE__ */ jsx(Loader, { size: "sm", "aria-label": label })
|
|
41
|
+
children: /* @__PURE__ */ jsx(Loader, { size: "sm", color: VX.muted, "aria-label": label })
|
|
34
42
|
}
|
|
35
43
|
);
|
|
36
44
|
}
|
|
37
45
|
function ErrorState({
|
|
38
46
|
error,
|
|
39
|
-
title = "
|
|
47
|
+
title = "Could not load",
|
|
40
48
|
fallback = "The request failed.",
|
|
41
49
|
onRetry,
|
|
42
50
|
retrying = false,
|
|
@@ -54,7 +54,8 @@ 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.
|
|
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. */
|
|
58
59
|
summary?: ReactNode;
|
|
59
60
|
/** Turns the root into a scroll anchor (`id` + `scroll-margin-top`). Inside `BasaltShell` the
|
|
60
61
|
* 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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,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"}
|
|
@@ -75,6 +75,18 @@
|
|
|
75
75
|
gap: var(--mantine-spacing-xs, 0.625rem);
|
|
76
76
|
}
|
|
77
77
|
|
|
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.
|
|
85
|
+
*/
|
|
86
|
+
.summary > :global(.mantine-Text-root) {
|
|
87
|
+
font-size: var(--vx-text-micro);
|
|
88
|
+
}
|
|
89
|
+
|
|
78
90
|
/*
|
|
79
91
|
* The collapse chevron — a plain control, not a Mantine ActionIcon, so it sits directly in the header
|
|
80
92
|
* row (its own CtlSlot fragment would nest a theme provider around one glyph). It is sized to the
|
|
@@ -23,7 +23,7 @@ export type SettingsRowSlot = 'root' | 'label' | 'control';
|
|
|
23
23
|
export type SettingsRowProps = BasaltProps & SlotStylesProps<SettingsRowSlot> & {
|
|
24
24
|
/** 13px ink label on the left. */
|
|
25
25
|
label: string;
|
|
26
|
-
/** Optional
|
|
26
|
+
/** Optional 12px muted description under the label. */
|
|
27
27
|
description?: string;
|
|
28
28
|
/** Right-aligned control (input/switch/button). */
|
|
29
29
|
control?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-section.d.ts","sourceRoot":"","sources":["../../src/dashboard/settings-section.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAYnE,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE5D;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAC5C,eAAe,CAAC,mBAAmB,CAAC,GACpC,sBAAsB,GAAG;IACvB,wDAAwD;IACxD,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,0DAA0D;IAC1D,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,oBAAoB,+BAgBtB;AAED,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;AAE1D,MAAM,MAAM,gBAAgB,GAAG,WAAW,GACxC,eAAe,CAAC,eAAe,CAAC,GAAG;IACjC,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,
|
|
1
|
+
{"version":3,"file":"settings-section.d.ts","sourceRoot":"","sources":["../../src/dashboard/settings-section.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAI7D,OAAO,KAAK,EAAE,WAAW,EAA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