basalt-ui 2.27.2 → 2.29.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 +466 -307
- package/MIGRATING.md +358 -12
- package/agent/rules/basalt-batteries.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/rules/basalt-tokens.md +2 -2
- package/agent/skills/basalt-app/SKILL.md +3 -3
- package/agent/skills/basalt-charts/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +12 -6
- package/agent/skills/basalt-design/references/catalogue.md +42 -36
- package/agent/skills/basalt-design/references/recipes.md +47 -0
- package/agent/skills/basalt-design/references/states.md +1 -1
- package/configs/oxlint-basalt.json +2 -1
- package/configs/oxlint-plugin.js +112 -3
- package/configs/oxlint-plugin.test.ts +99 -4
- package/configs/oxlint.json +1 -0
- package/dist/agent/chat/thread-message.d.ts +1 -160
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +7 -162
- package/dist/agent/chat/virtualize.d.ts +5 -5
- package/dist/charts/ChartCard.d.ts +14 -7
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +112 -23
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +11 -4
- package/dist/charts/Sparkline.d.ts +14 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +155 -44
- package/dist/charts/chart-box.module.css +59 -2
- package/dist/charts/chart-box.module.css.d.ts +5 -0
- package/dist/charts/chart-card.module.css +28 -17
- package/dist/charts/chart-card.module.css.d.ts +3 -0
- package/dist/charts/compile.d.ts +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +38 -27
- package/dist/charts/labels.d.ts +13 -3
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +131 -20
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +1 -1
- package/dist/charts/ref-label.d.ts +37 -8
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +55 -10
- package/dist/charts/sparkline.module.css +50 -0
- package/dist/charts/sparkline.module.css.d.ts +3 -0
- package/dist/charts/state.d.ts +4 -4
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +23 -5
- package/dist/cli/doctor-upgrade.d.ts +11 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +54 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -3
- package/dist/cli/index.d.ts +13 -13
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -2
- package/dist/cli/init.d.ts +6 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +118 -27
- package/dist/cli/router-wiring.d.ts +3 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +2 -0
- package/dist/cli/shot/capture.d.ts +34 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +95 -12
- package/dist/cli/shot/detect.d.ts +4 -1
- package/dist/cli/shot/detect.d.ts.map +1 -1
- package/dist/cli/shot/detect.js +38 -16
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +9 -2
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +11 -2
- package/dist/cli/shot/types.d.ts +4 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +10 -2
- package/dist/common/could-not-load.d.ts +13 -0
- package/dist/common/could-not-load.d.ts.map +1 -0
- package/dist/common/could-not-load.js +14 -0
- package/dist/common/empty-copy.d.ts +16 -0
- package/dist/common/empty-copy.d.ts.map +1 -0
- package/dist/common/empty-copy.js +9 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +3 -0
- package/dist/common/props.d.ts +20 -0
- package/dist/common/props.d.ts.map +1 -1
- package/dist/common/props.js +13 -1
- package/dist/common/retry-button.module.css +7 -3
- package/dist/common/virtual-rows.d.ts +196 -0
- package/dist/common/virtual-rows.d.ts.map +1 -0
- package/dist/common/virtual-rows.js +290 -0
- package/dist/controls/controls.module.css +33 -1
- package/dist/controls/controls.module.css.d.ts +2 -0
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -2
- package/dist/controls/filter-pill.d.ts +27 -3
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +15 -4
- package/dist/controls/form-layout.d.ts +9 -3
- package/dist/controls/form-layout.d.ts.map +1 -1
- package/dist/controls/form-layout.js +74 -12
- package/dist/controls/form-layout.module.css +112 -7
- package/dist/controls/form-layout.module.css.d.ts +1 -0
- package/dist/controls/multi-select-filter.d.ts +2 -2
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +12 -6
- package/dist/controls/range-filter.d.ts +1 -1
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +8 -2
- package/dist/dashboard/bar-list.d.ts +5 -5
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +15 -8
- package/dist/dashboard/bar-list.module.css +21 -5
- package/dist/dashboard/board-nav.d.ts +22 -0
- package/dist/dashboard/board-nav.d.ts.map +1 -0
- package/dist/dashboard/board-nav.js +49 -0
- package/dist/dashboard/board.d.ts +52 -0
- package/dist/dashboard/board.d.ts.map +1 -0
- package/dist/dashboard/board.js +247 -0
- package/dist/dashboard/board.module.css +179 -0
- package/dist/dashboard/board.module.css.d.ts +28 -0
- package/dist/dashboard/empty-state.d.ts +6 -6
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +17 -8
- package/dist/dashboard/event-list-model.d.ts +54 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -0
- package/dist/dashboard/event-list-model.js +76 -0
- package/dist/dashboard/event-list-rows.d.ts +23 -0
- package/dist/dashboard/event-list-rows.d.ts.map +1 -0
- package/dist/dashboard/event-list-rows.js +89 -0
- package/dist/dashboard/event-list-scroll.d.ts +55 -0
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
- package/dist/dashboard/event-list-scroll.js +216 -0
- package/dist/dashboard/event-list-skeleton.d.ts +10 -0
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
- package/dist/dashboard/event-list-skeleton.js +34 -0
- package/dist/dashboard/event-list.d.ts +65 -0
- package/dist/dashboard/event-list.d.ts.map +1 -0
- package/dist/dashboard/event-list.js +208 -0
- package/dist/dashboard/event-list.module.css +336 -0
- package/dist/dashboard/event-list.module.css.d.ts +34 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -0
- package/dist/dashboard/meter-model.d.ts +6 -3
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +9 -4
- package/dist/dashboard/meter-parts.d.ts +3 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +36 -6
- package/dist/dashboard/meter.d.ts +3 -3
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +10 -2
- package/dist/dashboard/meter.module.css +20 -12
- package/dist/dashboard/meter.module.css.d.ts +0 -1
- package/dist/dashboard/page-summary.d.ts +3 -3
- package/dist/dashboard/page-summary.d.ts.map +1 -1
- package/dist/dashboard/page-summary.js +7 -2
- package/dist/dashboard/page-summary.module.css +5 -2
- package/dist/dashboard/query-state.d.ts +9 -8
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +29 -11
- package/dist/dashboard/section.d.ts +11 -3
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +34 -7
- package/dist/dashboard/settings-section.d.ts +8 -5
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +12 -8
- package/dist/dashboard/settings-section.module.css +25 -4
- package/dist/dashboard/settings-section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card-parts.d.ts +5 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +8 -3
- package/dist/dashboard/stat-card.d.ts +3 -3
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +47 -12
- package/dist/dashboard/stat-card.module.css +42 -7
- package/dist/dashboard/stat-card.module.css.d.ts +3 -0
- package/dist/dashboard/stat-group.d.ts +2 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +10 -3
- package/dist/dashboard/stat-strip.d.ts +5 -4
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +41 -31
- package/dist/dashboard/stat-strip.module.css +8 -6
- 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.d.ts +6 -6
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +4 -2
- package/dist/dashboard/widget-header.module.css +12 -15
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +24 -1
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/shell/app-main.module.css +18 -0
- package/dist/styles.css +69 -0
- package/dist/surfaces.d.ts +2 -2
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +8 -2
- package/dist/table/cell-kinds.d.ts +47 -0
- package/dist/table/cell-kinds.d.ts.map +1 -0
- package/dist/table/cell-kinds.js +180 -0
- package/dist/table/cell-kinds.module.css +55 -0
- package/dist/table/cell-kinds.module.css.d.ts +15 -0
- package/dist/table/data-table-fold.d.ts +155 -0
- package/dist/table/data-table-fold.d.ts.map +1 -0
- package/dist/table/data-table-fold.js +320 -0
- package/dist/table/data-table-state.d.ts +10 -3
- package/dist/table/data-table-state.d.ts.map +1 -1
- package/dist/table/data-table-state.js +11 -6
- package/dist/table/data-table.d.ts +13 -28
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +362 -255
- package/dist/table/data-table.module.css +282 -3
- package/dist/table/data-table.module.css.d.ts +16 -0
- package/dist/table/table-features.d.ts +34 -4
- package/dist/table/table-features.d.ts.map +1 -1
- package/dist/table/table-features.js +10 -0
- package/dist/theme/card-inset.module.css +35 -0
- package/dist/theme/controls.module.css +55 -2
- package/dist/theme/ctl-theme.d.ts.map +1 -1
- package/dist/theme/ctl-theme.js +5 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +14 -10
- package/dist/tokens/core.d.ts +1 -0
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +1 -0
- package/dist/tokens/derive.js +1 -1
- package/dist/tokens/palette.d.ts +2 -1
- package/dist/tokens/palette.d.ts.map +1 -1
- package/llms.txt +295 -5
- package/package.json +1 -1
- package/src/agent/chat/thread-message.tsx +10 -403
- package/src/agent/chat/virtualize.ts +5 -5
- package/src/charts/ChartCard.tsx +175 -31
- package/src/charts/Lines.tsx +13 -4
- package/src/charts/Sparkline.tsx +213 -48
- package/src/charts/chart-box.module.css +59 -2
- package/src/charts/chart-box.module.css.d.ts +5 -0
- package/src/charts/chart-card.module.css +28 -17
- package/src/charts/chart-card.module.css.d.ts +3 -0
- package/src/charts/compile.ts +59 -33
- package/src/charts/labels.ts +175 -24
- package/src/charts/legend.tsx +3 -2
- package/src/charts/ref-label.ts +114 -18
- package/src/charts/sparkline.module.css +50 -0
- package/src/charts/sparkline.module.css.d.ts +3 -0
- package/src/charts/state.tsx +40 -10
- package/src/cli/doctor-upgrade.ts +75 -0
- package/src/cli/doctor.ts +36 -0
- package/src/cli/help.ts +16 -6
- package/src/cli/index.ts +73 -67
- package/src/cli/init.ts +157 -36
- package/src/cli/router-wiring.ts +2 -2
- package/src/cli/shot/capture.ts +138 -16
- package/src/cli/shot/detect.ts +46 -22
- package/src/cli/shot/index.ts +8 -2
- package/src/cli/shot/measure.ts +11 -2
- package/src/cli/shot/types.ts +4 -1
- package/src/cli/sync.ts +12 -2
- package/src/common/could-not-load.ts +22 -0
- package/src/common/empty-copy.ts +17 -0
- package/src/common/index.ts +1 -0
- package/src/common/props.ts +30 -0
- package/src/common/retry-button.module.css +7 -3
- package/src/common/virtual-rows.tsx +682 -0
- package/src/controls/controls.module.css +33 -1
- package/src/controls/controls.module.css.d.ts +2 -0
- package/src/controls/enum-filter.tsx +8 -2
- package/src/controls/filter-pill.tsx +80 -27
- package/src/controls/form-layout.module.css +112 -7
- package/src/controls/form-layout.module.css.d.ts +1 -0
- package/src/controls/form-layout.tsx +115 -22
- package/src/controls/multi-select-filter.tsx +22 -11
- package/src/controls/range-filter.tsx +9 -3
- package/src/dashboard/bar-list.module.css +21 -5
- package/src/dashboard/bar-list.tsx +53 -45
- package/src/dashboard/board-nav.ts +67 -0
- package/src/dashboard/board.module.css +179 -0
- package/src/dashboard/board.module.css.d.ts +28 -0
- package/src/dashboard/board.tsx +415 -0
- package/src/dashboard/empty-state.tsx +21 -11
- package/src/dashboard/event-list-model.ts +125 -0
- package/src/dashboard/event-list-rows.tsx +117 -0
- package/src/dashboard/event-list-scroll.ts +291 -0
- package/src/dashboard/event-list-skeleton.tsx +62 -0
- package/src/dashboard/event-list.module.css +336 -0
- package/src/dashboard/event-list.module.css.d.ts +34 -0
- package/src/dashboard/event-list.tsx +336 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +16 -7
- package/src/dashboard/meter-parts.tsx +53 -14
- package/src/dashboard/meter.module.css +20 -12
- package/src/dashboard/meter.module.css.d.ts +0 -1
- package/src/dashboard/meter.tsx +36 -18
- package/src/dashboard/page-summary.module.css +5 -2
- package/src/dashboard/page-summary.tsx +13 -6
- package/src/dashboard/query-state.tsx +55 -30
- package/src/dashboard/section.tsx +83 -41
- package/src/dashboard/settings-section.module.css +25 -4
- package/src/dashboard/settings-section.module.css.d.ts +1 -0
- package/src/dashboard/settings-section.tsx +18 -8
- package/src/dashboard/stat-card-parts.tsx +20 -3
- package/src/dashboard/stat-card.module.css +42 -7
- package/src/dashboard/stat-card.module.css.d.ts +3 -0
- package/src/dashboard/stat-card.tsx +55 -13
- package/src/dashboard/stat-group.tsx +22 -14
- package/src/dashboard/stat-strip.module.css +8 -6
- package/src/dashboard/stat-strip.tsx +29 -20
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +12 -15
- package/src/dashboard/widget-header.tsx +8 -5
- package/src/format/shared.ts +30 -1
- package/src/guard/index.ts +7 -1
- package/src/index.ts +4 -0
- package/src/shell/app-main.module.css +18 -0
- package/src/styles.css +69 -0
- package/src/surfaces.ts +7 -1
- package/src/table/cell-kinds.module.css +55 -0
- package/src/table/cell-kinds.module.css.d.ts +15 -0
- package/src/table/cell-kinds.tsx +263 -0
- package/src/table/data-table-fold.tsx +567 -0
- package/src/table/data-table-state.ts +24 -13
- package/src/table/data-table.module.css +282 -3
- package/src/table/data-table.module.css.d.ts +16 -0
- package/src/table/data-table.tsx +430 -362
- package/src/table/table-features.ts +44 -4
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
- package/src/theme/card-inset.module.css +35 -0
- package/src/theme/controls.module.css +55 -2
- package/src/theme/ctl-theme.tsx +8 -0
- package/src/theme/index.ts +12 -8
- package/src/tokens/core.ts +1 -0
- package/src/tokens/derive.ts +1 -1
- package/src/tokens/palette.ts +4 -1
|
@@ -11,10 +11,13 @@ import {
|
|
|
11
11
|
rightSlotStyle
|
|
12
12
|
} from "./stat-card-parts.js";
|
|
13
13
|
import { DeltaBadge } from "./delta-badge.js";
|
|
14
|
-
import { cx } from "../common/props.js";
|
|
14
|
+
import { cx, pickDataAttributes } from "../common/props.js";
|
|
15
|
+
import { splitEmptyCopy } from "../common/empty-copy.js";
|
|
16
|
+
import { EmptyState } from "./empty-state.js";
|
|
17
|
+
import { couldNotLoad, HostTitleContext } from "../common/could-not-load.js";
|
|
15
18
|
import { ErrorState, QueryState, resolveQueryBranch } from "./query-state.js";
|
|
16
19
|
import classes from "./stat-card.module.css";
|
|
17
|
-
import { HOSTED, VisualSlotContext } from "./visual-slot.js";
|
|
20
|
+
import { HOSTED, HOSTED_COMPACT, VisualSlotContext } from "./visual-slot.js";
|
|
18
21
|
const SPARKLINE_RIGHT_WIDTH = 72;
|
|
19
22
|
const SPARKLINE_HEIGHT = 22;
|
|
20
23
|
function useSlotWidth(active) {
|
|
@@ -39,26 +42,38 @@ function renderValueBody({
|
|
|
39
42
|
pending,
|
|
40
43
|
resolved,
|
|
41
44
|
figure,
|
|
42
|
-
emptyText
|
|
45
|
+
emptyText,
|
|
46
|
+
hasDelta,
|
|
47
|
+
label
|
|
43
48
|
}) {
|
|
44
|
-
|
|
45
|
-
if (
|
|
49
|
+
const copy = splitEmptyCopy(emptyText);
|
|
50
|
+
if (resolved === void 0) return pending ? /* @__PURE__ */ jsx(ValueSkeleton, { delta: hasDelta }) : figure;
|
|
51
|
+
if (pending && resolved.kind !== "error") return /* @__PURE__ */ jsx(ValueSkeleton, { delta: hasDelta });
|
|
46
52
|
switch (resolved.kind) {
|
|
47
53
|
case "pending":
|
|
48
|
-
return /* @__PURE__ */ jsx(ValueSkeleton, {});
|
|
54
|
+
return /* @__PURE__ */ jsx(ValueSkeleton, { delta: hasDelta });
|
|
49
55
|
case "error":
|
|
50
56
|
return /* @__PURE__ */ jsx(
|
|
51
57
|
ErrorState,
|
|
52
58
|
{
|
|
53
59
|
error: resolved.error,
|
|
54
|
-
title:
|
|
60
|
+
title: couldNotLoad(label),
|
|
55
61
|
tier: "section",
|
|
56
62
|
onRetry: () => void resolved.query.refetch(),
|
|
57
63
|
retrying: resolved.query.fetchStatus === "fetching"
|
|
58
64
|
}
|
|
59
65
|
);
|
|
60
66
|
case "empty":
|
|
61
|
-
return /* @__PURE__ */ jsx(
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
68
|
+
EmptyState,
|
|
69
|
+
{
|
|
70
|
+
tier: "section",
|
|
71
|
+
title: copy.title,
|
|
72
|
+
...copy.description !== void 0 && { description: copy.description },
|
|
73
|
+
className: classes.empty,
|
|
74
|
+
style: { padding: "var(--vx-space-stack-md) var(--vx-space-stack-lg)" }
|
|
75
|
+
}
|
|
76
|
+
);
|
|
62
77
|
case "ready":
|
|
63
78
|
return figure;
|
|
64
79
|
default:
|
|
@@ -84,6 +99,16 @@ function renderFooterNode({
|
|
|
84
99
|
if (!ready) return null;
|
|
85
100
|
return /* @__PURE__ */ jsx("p", { className: classes.footer, title: subtitle, children: subtitle });
|
|
86
101
|
}
|
|
102
|
+
const toneSlots = /* @__PURE__ */ new Map();
|
|
103
|
+
function slotFor(tone, compact) {
|
|
104
|
+
if (tone === void 0) return compact ? HOSTED_COMPACT : HOSTED;
|
|
105
|
+
const key = `${tone}:${compact}`;
|
|
106
|
+
const known = toneSlots.get(key);
|
|
107
|
+
if (known !== void 0) return known;
|
|
108
|
+
const slot = compact ? { tone, compact: true } : { tone };
|
|
109
|
+
toneSlots.set(key, slot);
|
|
110
|
+
return slot;
|
|
111
|
+
}
|
|
87
112
|
function StatCard({
|
|
88
113
|
title,
|
|
89
114
|
icon,
|
|
@@ -107,7 +132,8 @@ function StatCard({
|
|
|
107
132
|
tone,
|
|
108
133
|
className,
|
|
109
134
|
style,
|
|
110
|
-
classNames
|
|
135
|
+
classNames,
|
|
136
|
+
...rest
|
|
111
137
|
}) {
|
|
112
138
|
const isRender = typeof sparkline === "function";
|
|
113
139
|
const bleeds = sparklinePlacement === "bleed";
|
|
@@ -129,7 +155,8 @@ function StatCard({
|
|
|
129
155
|
},
|
|
130
156
|
row.label
|
|
131
157
|
)) });
|
|
132
|
-
const breakdownContent = query === void 0 ? breakdownRows : /* @__PURE__ */ jsx(QueryState, { query, tier: "section", children: breakdownRows });
|
|
158
|
+
const breakdownContent = query === void 0 ? breakdownRows : /* @__PURE__ */ jsx(HostTitleContext, { value: title, children: /* @__PURE__ */ jsx(QueryState, { query, tier: "section", children: breakdownRows }) });
|
|
159
|
+
const hostSlot = slotFor(tone, !bleeds);
|
|
133
160
|
const sparklineSlot = !ready || sparkline === void 0 ? null : /* @__PURE__ */ jsx(
|
|
134
161
|
"div",
|
|
135
162
|
{
|
|
@@ -139,7 +166,7 @@ function StatCard({
|
|
|
139
166
|
classNames?.sparkline
|
|
140
167
|
),
|
|
141
168
|
...!bleeds && { style: rightSlotStyle(SPARKLINE_RIGHT_WIDTH, SPARKLINE_HEIGHT) },
|
|
142
|
-
children: /* @__PURE__ */ jsx(VisualSlotContext.Provider, { value:
|
|
169
|
+
children: /* @__PURE__ */ jsx(VisualSlotContext.Provider, { value: hostSlot, children: isRender ? measured.width > 0 && sparkline(measured) : sparkline })
|
|
143
170
|
}
|
|
144
171
|
);
|
|
145
172
|
const figure = /* @__PURE__ */ jsxs("div", { className: classes.valueRow, children: [
|
|
@@ -158,7 +185,14 @@ function StatCard({
|
|
|
158
185
|
}
|
|
159
186
|
)
|
|
160
187
|
] });
|
|
161
|
-
const valueBody = renderValueBody({
|
|
188
|
+
const valueBody = renderValueBody({
|
|
189
|
+
pending,
|
|
190
|
+
resolved,
|
|
191
|
+
figure,
|
|
192
|
+
emptyText,
|
|
193
|
+
hasDelta: delta !== void 0,
|
|
194
|
+
label: title
|
|
195
|
+
});
|
|
162
196
|
const breakdownCount = breakdown?.length ?? 0;
|
|
163
197
|
const hasBreakdown = breakdownCount > 0;
|
|
164
198
|
const rightRow = !bleeds && (ready ? breakdownContent !== null || sparklineSlot !== null : pending && (hasBreakdown || sparkline !== void 0));
|
|
@@ -168,6 +202,7 @@ function StatCard({
|
|
|
168
202
|
return /* @__PURE__ */ jsx(
|
|
169
203
|
Card,
|
|
170
204
|
{
|
|
205
|
+
...pickDataAttributes(rest),
|
|
171
206
|
className: cx(classNames?.root, className),
|
|
172
207
|
style: {
|
|
173
208
|
// The inset is the theme's (`card-inset.module.css`: the `cardInsetY`/`cardInsetX` tokens, 12/16
|
|
@@ -213,14 +213,10 @@
|
|
|
213
213
|
|
|
214
214
|
/* ── states ──────────────────────────────────────────────────────────────────────────────────── */
|
|
215
215
|
|
|
216
|
-
/* The empty branch:
|
|
216
|
+
/* The empty branch (SPEC § 6.11): `EmptyState`'s section tile in the figure's place, at the card's
|
|
217
|
+
* own inset; `EmptyState`'s section tier sets its title at `sm`. */
|
|
217
218
|
.empty {
|
|
218
|
-
display: flex;
|
|
219
|
-
align-items: center;
|
|
220
|
-
margin: 0;
|
|
221
219
|
min-height: var(--basalt-stat-figure-h);
|
|
222
|
-
font-size: var(--vx-text-sm);
|
|
223
|
-
color: var(--vx-muted);
|
|
224
220
|
}
|
|
225
221
|
|
|
226
222
|
/* The pending skeleton holds the card's own footprint: a value bar at the figure's height, the
|
|
@@ -233,10 +229,38 @@
|
|
|
233
229
|
/* Inset on both sides, unlike the sparkline at rest (which bleeds): a placeholder that touches one
|
|
234
230
|
* card edge and stops short of the other reads as misaligned, and a Meter in the slot is inset anyway. */
|
|
235
231
|
.skeletonVisual {
|
|
236
|
-
--skeleton-radius: 0;
|
|
237
232
|
height: var(--basalt-stat-visual-h);
|
|
238
233
|
}
|
|
239
234
|
|
|
235
|
+
.skeletonVisual svg {
|
|
236
|
+
display: block;
|
|
237
|
+
width: 100%;
|
|
238
|
+
height: 100%;
|
|
239
|
+
fill: none;
|
|
240
|
+
stroke: color-mix(in srgb, var(--vx-ink) 24%, var(--vx-surface-panel));
|
|
241
|
+
stroke-width: 2px;
|
|
242
|
+
stroke-linecap: round;
|
|
243
|
+
stroke-linejoin: round;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* A skeleton value row with a delta: the value bar and the delta chip, on the loaded row's height. */
|
|
247
|
+
.skeletonValueRow {
|
|
248
|
+
display: flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
gap: var(--vx-space-stack-sm);
|
|
251
|
+
height: var(--basalt-stat-figure-h);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.skeletonValueWithDelta {
|
|
255
|
+
width: 28%;
|
|
256
|
+
height: 100%;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.skeletonDelta {
|
|
260
|
+
width: 22%;
|
|
261
|
+
height: 1rem;
|
|
262
|
+
}
|
|
263
|
+
|
|
240
264
|
.sparklineRight .skeletonVisual {
|
|
241
265
|
flex: 1 1 auto;
|
|
242
266
|
}
|
|
@@ -413,6 +437,17 @@
|
|
|
413
437
|
padding-top: var(--basalt-spark-readout-reserve);
|
|
414
438
|
}
|
|
415
439
|
|
|
440
|
+
/* A sparkline that states its window has a caption line under its plot: the slot grows by it rather than
|
|
441
|
+
* letting the caption run into the footer. */
|
|
442
|
+
.sparklineBleed:has([data-basalt-sparkline-caption]) {
|
|
443
|
+
height: auto;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/* The slot bleeds past the card's inset, the plot with it; the caption is text and takes the inset back. */
|
|
447
|
+
.sparklineBleed [data-basalt-sparkline-caption] {
|
|
448
|
+
padding-inline: var(--vx-space-card-inset-x, 1rem);
|
|
449
|
+
}
|
|
450
|
+
|
|
416
451
|
/* A Meter in the visual slot is a block, not a chart: it sizes to its content and keeps the card's
|
|
417
452
|
* inline inset instead of the sparkline's fixed 22px and side bleed. */
|
|
418
453
|
.sparklineBleed:has(> [data-basalt-meter]) {
|
|
@@ -19,6 +19,9 @@ declare const classes: {
|
|
|
19
19
|
readonly empty: string
|
|
20
20
|
readonly skeletonValue: string
|
|
21
21
|
readonly skeletonVisual: string
|
|
22
|
+
readonly skeletonValueRow: string
|
|
23
|
+
readonly skeletonValueWithDelta: string
|
|
24
|
+
readonly skeletonDelta: string
|
|
22
25
|
readonly skeletonFooter: string
|
|
23
26
|
readonly skeletonRowBox: string
|
|
24
27
|
readonly skeletonRow: string
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
* </StatGroup>
|
|
34
34
|
*/
|
|
35
35
|
import type { ReactNode } from 'react';
|
|
36
|
-
import type { BasaltProps } from '../common/props.js';
|
|
36
|
+
import type { BasaltProps, DataAttributes } from '../common/props.js';
|
|
37
37
|
import type { StatStripProps } from './stat-strip.js';
|
|
38
38
|
/** The desktop KPI column count. */
|
|
39
39
|
export type StatGroupCols = 2 | 3 | 4 | 5;
|
|
40
|
-
export type StatGridProps = BasaltProps & {
|
|
40
|
+
export type StatGridProps = BasaltProps & DataAttributes & {
|
|
41
41
|
variant?: 'grid';
|
|
42
42
|
/** The DESKTOP column count (`lg` and up). Default `4`. `sm` gets `min(cols, 3)` — except `4`, which gets 2 rather than an orphan row. A phone gets 2.
|
|
43
43
|
* Never a responsive object — the law is basalt's, see the module docblock. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat-group.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-group.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"stat-group.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-group.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAGlD,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAEzC,MAAM,MAAM,aAAa,GAAG,WAAW,GACrC,cAAc,GAAG;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;mFAC+E;IAC/E,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4CAA4C;IAC5C,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH;4FAC4F;AAC5F,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,cAAc,CAAC,CAAA;AAEpF,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAM9C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cx } from "../common/props.js";
|
|
2
|
+
import { cx, pickDataAttributes } from "../common/props.js";
|
|
3
3
|
import { StatStrip } from "./stat-strip.js";
|
|
4
4
|
import classes from "./stat-group.module.css";
|
|
5
5
|
function StatGroup(props) {
|
|
@@ -9,7 +9,14 @@ function StatGroup(props) {
|
|
|
9
9
|
}
|
|
10
10
|
return /* @__PURE__ */ jsx(StatGrid, { ...props });
|
|
11
11
|
}
|
|
12
|
-
function StatGrid({
|
|
12
|
+
function StatGrid({
|
|
13
|
+
cols = 4,
|
|
14
|
+
divided = false,
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
style,
|
|
18
|
+
...rest
|
|
19
|
+
}) {
|
|
13
20
|
const smCols = cols === 4 ? 2 : Math.min(cols, 3);
|
|
14
21
|
return (
|
|
15
22
|
// Two boxes, and the outer one is not decoration: a size container is a container for its
|
|
@@ -19,7 +26,7 @@ function StatGrid({ cols = 4, divided = false, children, className, style }) {
|
|
|
19
26
|
// sized is the whole point. `container-type: inline-size` contains the inline axis only, so the
|
|
20
27
|
// wrapper's block size still comes from the grid: no percentage height resolves differently,
|
|
21
28
|
// and there is no paint containment, so nothing inside is clipped.
|
|
22
|
-
/* @__PURE__ */ jsx("div", { className: cx(classes.container, className), style, children: /* @__PURE__ */ jsx(
|
|
29
|
+
/* @__PURE__ */ jsx("div", { ...pickDataAttributes(rest), className: cx(classes.container, className), style, children: /* @__PURE__ */ jsx(
|
|
23
30
|
"div",
|
|
24
31
|
{
|
|
25
32
|
className: classes.root,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { BasaltProps, Tone } from '../common/props.js';
|
|
2
|
+
import type { BasaltProps, DataAttributes, Tone } from '../common/props.js';
|
|
3
3
|
/** The URL shot states an anchor can declare itself absent in (`data-shot-absent`). */
|
|
4
4
|
type StatStripShotState = 'empty' | 'loading' | 'error';
|
|
5
5
|
export type StatStripRow = {
|
|
@@ -76,17 +76,18 @@ export type StatStripFooterEntry = {
|
|
|
76
76
|
* omits where the strip itself shows, e.g. a fact that needs data the empty state lacks). */
|
|
77
77
|
shotAbsent?: readonly StatStripShotState[];
|
|
78
78
|
};
|
|
79
|
-
export type StatStripProps = BasaltProps & {
|
|
79
|
+
export type StatStripProps = BasaltProps & DataAttributes & {
|
|
80
80
|
/** The strip's accessible name. */
|
|
81
81
|
label: string;
|
|
82
82
|
cells: readonly StatStripCell[];
|
|
83
83
|
/** Wider cells under the cells. */
|
|
84
84
|
footer?: readonly StatStripFooterEntry[];
|
|
85
|
-
/** The DESKTOP column count. Default: the cell count, capped at 6.
|
|
85
|
+
/** The DESKTOP column count. Default: the cell count, capped at 6. A lone cell takes the whole strip
|
|
86
|
+
* whatever `cols` says. */
|
|
86
87
|
cols?: 2 | 3 | 4 | 5 | 6;
|
|
87
88
|
/** The shot states the page hides the whole strip in (`data-shot-absent` on every derived anchor). */
|
|
88
89
|
shotAbsent?: readonly StatStripShotState[];
|
|
89
90
|
};
|
|
90
|
-
export declare function StatStrip({ label, cells, footer, cols, shotAbsent, className, style, }: StatStripProps): import("react").JSX.Element;
|
|
91
|
+
export declare function StatStrip({ label, cells, footer, cols, shotAbsent, className, style, ...domProps }: StatStripProps): import("react").JSX.Element;
|
|
91
92
|
export {};
|
|
92
93
|
//# sourceMappingURL=stat-strip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat-strip.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-strip.tsx"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"stat-strip.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-strip.tsx"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AASxE,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,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,wFAAwF;AACxF,KAAK,kBAAkB,GACnB;IACE,IAAI,EAAE,OAAO,CAAA;IACb,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GACD;IACE,IAAI,EAAE,OAAO,CAAA;IACb,wDAAwD;IACxD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAEL,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf;iEAC6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;kCAC8B;IAC9B,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sBAAsB;IACtB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,yEAAyE;IACzE,IAAI,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;IAC9B,kEAAkE;IAClE,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kDAAkD;IAClD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,4EAA4E;IAC5E,KAAK,CAAC,EAAE,kBAAkB,CAAA;IAC1B,0FAA0F;IAC1F,UAAU,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,SAAS,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,GACtC,cAAc,GAAG;IACf,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;+BAC2B;IAC3B,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;AAyPH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,MAAM,EACN,IAAI,EACJ,UAAU,EACV,SAAS,EACT,KAAK,EACL,GAAG,QAAQ,EACZ,EAAE,cAAc,+BA4FhB"}
|
|
@@ -3,16 +3,17 @@ import { Card, Skeleton } from "@mantine/core";
|
|
|
3
3
|
import { useId, useRef } from "react";
|
|
4
4
|
import { toErrorMessage } from "../common/errors.js";
|
|
5
5
|
import { useIsomorphicLayoutEffect } from "../common/isomorphic-layout-effect.js";
|
|
6
|
-
import { cx } from "../common/props.js";
|
|
6
|
+
import { cx, pickDataAttributes } from "../common/props.js";
|
|
7
7
|
import { RetryButton } from "../common/retry-button.js";
|
|
8
8
|
import { StatusDot } from "../theme/status-dot.js";
|
|
9
9
|
import { VX } from "../tokens/index.js";
|
|
10
10
|
import { InfoGlyph } from "./widget-header.js";
|
|
11
11
|
import classes from "./stat-strip.module.css";
|
|
12
|
-
import {
|
|
12
|
+
import { couldNotLoad } from "../common/could-not-load.js";
|
|
13
|
+
import { HOSTED, HOSTED_LOADING, HOSTED_COMPACT, VisualSlotContext } from "./visual-slot.js";
|
|
13
14
|
const absentAttr = (states) => states === void 0 || states.length === 0 ? {} : { "data-shot-absent": states.join(" ") };
|
|
14
15
|
const EMPTY = "\u2014";
|
|
15
|
-
function CellState({ state }) {
|
|
16
|
+
function CellState({ state, caption }) {
|
|
16
17
|
if (state.kind === "empty") {
|
|
17
18
|
if (state.reason !== void 0) {
|
|
18
19
|
return /* @__PURE__ */ jsx("p", { className: classes.reason, "data-strip-reason": true, children: state.reason });
|
|
@@ -23,7 +24,7 @@ function CellState({ state }) {
|
|
|
23
24
|
return /* @__PURE__ */ jsxs("div", { className: classes.error, role: "alert", "data-strip-state": "error", children: [
|
|
24
25
|
/* @__PURE__ */ jsxs("span", { className: classes.errorHead, children: [
|
|
25
26
|
/* @__PURE__ */ jsx(StatusDot, { color: VX.status.bad }),
|
|
26
|
-
|
|
27
|
+
couldNotLoad(caption)
|
|
27
28
|
] }),
|
|
28
29
|
/* @__PURE__ */ jsx("p", { className: classes.reason, children: message }),
|
|
29
30
|
state.onRetry !== void 0 && /* @__PURE__ */ jsx(RetryButton, { onClick: state.onRetry, retrying: state.retrying ?? false })
|
|
@@ -121,7 +122,7 @@ function StripCell({
|
|
|
121
122
|
] }),
|
|
122
123
|
cell.action !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.action, "data-strip-action": true, children: cell.action })
|
|
123
124
|
] }),
|
|
124
|
-
state !== void 0 && /* @__PURE__ */ jsx(CellState, { state }),
|
|
125
|
+
state !== void 0 && /* @__PURE__ */ jsx(CellState, { state, caption: cell.caption }),
|
|
125
126
|
state === void 0 && hasHero && heroEl
|
|
126
127
|
] }),
|
|
127
128
|
state === void 0 && cell.visual !== void 0 && /* @__PURE__ */ jsxs(
|
|
@@ -138,7 +139,7 @@ function StripCell({
|
|
|
138
139
|
),
|
|
139
140
|
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: [
|
|
140
141
|
/* @__PURE__ */ jsx("span", { className: classes.rowLabel, children: row.label }),
|
|
141
|
-
/* @__PURE__ */ jsx("span", { className: classes.visual, children: /* @__PURE__ */ jsx(VisualSlotContext.Provider, { value:
|
|
142
|
+
/* @__PURE__ */ jsx("span", { className: classes.visual, children: /* @__PURE__ */ jsx(VisualSlotContext.Provider, { value: HOSTED_COMPACT, children: row.visual }) }),
|
|
142
143
|
/* @__PURE__ */ jsx("span", { className: classes.rowValue, "data-strip-row-value": true, children: row.hideValue ? null : row.value ?? EMPTY }),
|
|
143
144
|
/* @__PURE__ */ jsx("span", { children: row.delta })
|
|
144
145
|
] }, row.key)) })),
|
|
@@ -185,9 +186,10 @@ function StatStrip({
|
|
|
185
186
|
cols,
|
|
186
187
|
shotAbsent,
|
|
187
188
|
className,
|
|
188
|
-
style
|
|
189
|
+
style,
|
|
190
|
+
...domProps
|
|
189
191
|
}) {
|
|
190
|
-
const desktop = cols ?? Math.min(Math.max(cells.length, 2), 6);
|
|
192
|
+
const desktop = cells.length === 1 ? 1 : cols ?? Math.min(Math.max(cells.length, 2), 6);
|
|
191
193
|
const mid = desktop === 4 ? 2 : Math.min(desktop, 3);
|
|
192
194
|
const keys = new Set(cells.map((cell) => cell.key));
|
|
193
195
|
const underOf = (key) => footer?.filter((entry) => entry.under === key) ?? [];
|
|
@@ -231,32 +233,40 @@ function StatStrip({
|
|
|
231
233
|
observer.observe(grid);
|
|
232
234
|
for (const head of grid.querySelectorAll("[data-strip-head]")) observer.observe(head);
|
|
233
235
|
}, [cells, footer]);
|
|
234
|
-
return /* @__PURE__ */ jsx(
|
|
235
|
-
|
|
236
|
+
return /* @__PURE__ */ jsx(
|
|
237
|
+
"div",
|
|
236
238
|
{
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
shotAbsent,
|
|
252
|
-
under: underOf(cell.key)
|
|
239
|
+
...pickDataAttributes(domProps),
|
|
240
|
+
className: cx(classes.container, className),
|
|
241
|
+
style,
|
|
242
|
+
children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(
|
|
243
|
+
Card.Section,
|
|
244
|
+
{
|
|
245
|
+
component: "section",
|
|
246
|
+
"aria-label": label,
|
|
247
|
+
className: classes.clip,
|
|
248
|
+
...hasQualifier && { "data-strip-qualifier": "" },
|
|
249
|
+
...hasAction && { "data-strip-action-row": "" },
|
|
250
|
+
style: {
|
|
251
|
+
"--basalt-strip-cols": desktop,
|
|
252
|
+
"--basalt-strip-cols-sm": mid
|
|
253
253
|
},
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ jsx("div", { ref: gridRef, className: classes.cells, children: cells.map((cell) => /* @__PURE__ */ jsx(
|
|
256
|
+
StripCell,
|
|
257
|
+
{
|
|
258
|
+
cell,
|
|
259
|
+
shotAbsent,
|
|
260
|
+
under: underOf(cell.key)
|
|
261
|
+
},
|
|
262
|
+
cell.key
|
|
263
|
+
)) }),
|
|
264
|
+
rest.length > 0 && /* @__PURE__ */ jsx("div", { className: classes.footerRow, children: rest.map((entry) => /* @__PURE__ */ jsx(FooterCell, { entry, shotAbsent, under: false }, entry.key)) })
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
) })
|
|
258
268
|
}
|
|
259
|
-
)
|
|
269
|
+
);
|
|
260
270
|
}
|
|
261
271
|
export {
|
|
262
272
|
StatStrip
|
|
@@ -36,9 +36,6 @@
|
|
|
36
36
|
min-width: 0;
|
|
37
37
|
container-type: inline-size;
|
|
38
38
|
container-name: basalt-card;
|
|
39
|
-
/* The foot inset lives HERE, on the row-high slot, so a cell that ends early keeps the strip's
|
|
40
|
-
* surface under it. */
|
|
41
|
-
padding-block-end: var(--vx-space-stack-md);
|
|
42
39
|
box-shadow:
|
|
43
40
|
-1px 0 0 var(--vx-divider),
|
|
44
41
|
0 -1px 0 var(--vx-divider);
|
|
@@ -50,7 +47,7 @@
|
|
|
50
47
|
flex-direction: column;
|
|
51
48
|
align-self: start;
|
|
52
49
|
min-width: 0;
|
|
53
|
-
padding: var(--vx-space-stack-md)
|
|
50
|
+
padding: var(--vx-space-stack-md);
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
/* Forced colors drop box-shadows, so the hairlines come back as CanvasText borders. Every cell takes
|
|
@@ -166,6 +163,8 @@
|
|
|
166
163
|
* it, whether it sat beside the caption or wrapped under it, so values share a baseline. */
|
|
167
164
|
@container basalt-card (max-width: 239.9px) {
|
|
168
165
|
.qualifier {
|
|
166
|
+
/* Always on its own line under the caption: whether it fits beside it must not vary cell to cell. */
|
|
167
|
+
flex-basis: 100%;
|
|
169
168
|
line-height: 1.25;
|
|
170
169
|
}
|
|
171
170
|
|
|
@@ -378,16 +377,19 @@
|
|
|
378
377
|
.footerCell {
|
|
379
378
|
flex: 1 1 14rem;
|
|
380
379
|
min-width: 0;
|
|
380
|
+
font-size: var(--vx-text-sm);
|
|
381
381
|
padding: var(--vx-space-stack-md);
|
|
382
382
|
border-inline-start: 1px solid var(--vx-divider);
|
|
383
383
|
border-block-start: 1px solid var(--vx-divider);
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
/* A footer entry `under` a cell is part of that cell: it sits in the slot under the article, inset like
|
|
387
|
-
* the article, split from the readings by the strip's own hairline.
|
|
387
|
+
* the article, split from the readings by the strip's own hairline. Both footer slots take the strip's
|
|
388
|
+
* `sm` step, never the inherited body size (it would outrank the cell's own statement). */
|
|
388
389
|
.underCell {
|
|
389
390
|
min-width: 0;
|
|
390
|
-
|
|
391
|
+
font-size: var(--vx-text-sm);
|
|
392
|
+
margin: var(--vx-space-stack-md);
|
|
391
393
|
padding-block-start: var(--vx-space-stack-sm);
|
|
392
394
|
border-block-start: 1px solid var(--vx-divider);
|
|
393
395
|
}
|
|
@@ -3,10 +3,14 @@ export interface VisualSlot {
|
|
|
3
3
|
readonly tone?: Tone;
|
|
4
4
|
/** The host is loading: a `Meter` in the slot draws its loading state without its own `loading`. */
|
|
5
5
|
readonly loading?: boolean;
|
|
6
|
+
/** A slot with no room for a caption (a multi-row cell's row, a `right`-placed sparkline): its `Sparkline` states no window of its own. */
|
|
7
|
+
readonly compact?: true;
|
|
6
8
|
}
|
|
7
9
|
/** A host with no verdict of its own: one shared object, so a provider never re-renders its readers. */
|
|
8
10
|
export declare const HOSTED: VisualSlot;
|
|
9
11
|
/** `HOSTED` while the host loads. */
|
|
10
12
|
export declare const HOSTED_LOADING: VisualSlot;
|
|
13
|
+
/** A slot too small for a caption under its visual. */
|
|
14
|
+
export declare const HOSTED_COMPACT: VisualSlot;
|
|
11
15
|
export declare const VisualSlotContext: import("react").Context<VisualSlot | null>;
|
|
12
16
|
//# 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;IACpB,oGAAoG;IACpG,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,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;IAC1B,2IAA2I;IAC3I,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAA;CACxB;AAED,wGAAwG;AACxG,eAAO,MAAM,MAAM,EAAE,UAAe,CAAA;AAEpC,qCAAqC;AACrC,eAAO,MAAM,cAAc,EAAE,UAA8B,CAAA;AAE3D,uDAAuD;AACvD,eAAO,MAAM,cAAc,EAAE,UAA8B,CAAA;AAE3D,eAAO,MAAM,iBAAiB,4CAAyC,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
const HOSTED = {};
|
|
3
3
|
const HOSTED_LOADING = { loading: true };
|
|
4
|
+
const HOSTED_COMPACT = { compact: true };
|
|
4
5
|
const VisualSlotContext = createContext(null);
|
|
5
6
|
export {
|
|
6
7
|
HOSTED,
|
|
8
|
+
HOSTED_COMPACT,
|
|
7
9
|
HOSTED_LOADING,
|
|
8
10
|
VisualSlotContext
|
|
9
11
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { BasaltProps, SlotStylesProps } from '../common/props.js';
|
|
2
|
+
import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props.js';
|
|
3
3
|
import type { DeltaPolarity } from './delta-badge.js';
|
|
4
4
|
export type WidgetHeaderTier = 'section' | 'widget' | 'group';
|
|
5
5
|
/**
|
|
@@ -13,7 +13,7 @@ export type WidgetHeaderTier = 'section' | 'widget' | 'group';
|
|
|
13
13
|
* caller can class itself.
|
|
14
14
|
*/
|
|
15
15
|
export type WidgetHeaderSlot = 'root' | 'title' | 'metric' | 'icon';
|
|
16
|
-
export type WidgetHeaderProps = BasaltProps & SlotStylesProps<WidgetHeaderSlot> & {
|
|
16
|
+
export type WidgetHeaderProps = BasaltProps & DataAttributes & SlotStylesProps<WidgetHeaderSlot> & {
|
|
17
17
|
/** `section` renders an `<h2>` at the section-header height; `widget` renders an `<h3>` at the
|
|
18
18
|
* tighter icon-tier height, display-only; `group` also renders an `<h3>` but as the quietest
|
|
19
19
|
* heading rank on the page — mono micro uppercase faint, one step below `widget` — for an
|
|
@@ -24,9 +24,9 @@ export type WidgetHeaderProps = BasaltProps & SlotStylesProps<WidgetHeaderSlot>
|
|
|
24
24
|
title: string;
|
|
25
25
|
/** Optional leading icon, rendered before the title. Decorative — hidden from assistive tech. */
|
|
26
26
|
icon?: ReactNode;
|
|
27
|
-
/** Optional muted line rendered below the title row.
|
|
28
|
-
*
|
|
29
|
-
* exactly one of the two shows). */
|
|
27
|
+
/** Optional muted line rendered below the title row. Visible text at every width (it wraps
|
|
28
|
+
* under the title); in a card shorter than 280px it folds into the info glyph's bubble instead
|
|
29
|
+
* (CSS only — exactly one of the two shows). */
|
|
30
30
|
subtitle?: string;
|
|
31
31
|
/**
|
|
32
32
|
* Renders an info glyph BESIDE the heading (never inside it — this text would otherwise become
|
|
@@ -138,5 +138,5 @@ export declare function InfoGlyph({ text, note, ariaLabel, className, }: {
|
|
|
138
138
|
ariaLabel?: string;
|
|
139
139
|
className?: string;
|
|
140
140
|
}): import("react").JSX.Element;
|
|
141
|
-
export declare function WidgetHeader({ tier, title, icon, subtitle, info, value, unit, delta, deltaPeriod, deltaPolarity, deltaFormat, deltaGlyph, sparkline, count, actions, className, style, classNames, }: WidgetHeaderProps): import("react").JSX.Element;
|
|
141
|
+
export declare function WidgetHeader({ tier, title, icon, subtitle, info, value, unit, delta, deltaPeriod, deltaPolarity, deltaFormat, deltaGlyph, sparkline, count, actions, className, style, classNames, ...rest }: WidgetHeaderProps): import("react").JSX.Element;
|
|
142
142
|
//# sourceMappingURL=widget-header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-header.d.ts","sourceRoot":"","sources":["../../src/dashboard/widget-header.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"widget-header.d.ts","sourceRoot":"","sources":["../../src/dashboard/widget-header.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAGlD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE7D;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEnE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GACzC,cAAc,GACd,eAAe,CAAC,gBAAgB,CAAC,GAAG;IAClC;;;;gDAI4C;IAC5C,IAAI,EAAE,gBAAgB,CAAA;IACtB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAA;IACb,iGAAiG;IACjG,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;oDAEgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;oFACgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;qEACiE;IACjE,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC;4DACwD;IACxD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;yDACqD;IACrD,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;2EACuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4FAA4F;IAC5F,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,CAAA;AAEpG;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM,CAAC,CAAA;AAE/E;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,iBAAiB,EACjB,OAAO,GAAG,aAAa,GAAG,eAAe,GAAG,aAAa,GAAG,YAAY,CACzE,CAAA;AA0HD;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,IAAI,EACJ,SAA8B,EAC9B,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;2DAGuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA2EA;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,EACV,GAAG,IAAI,EACR,EAAE,iBAAiB,+BAoEnB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { useIsomorphicLayoutEffect } from "../common/isomorphic-layout-effect.js";
|
|
4
|
-
import { cx } from "../common/props.js";
|
|
4
|
+
import { cx, pickDataAttributes } from "../common/props.js";
|
|
5
5
|
import { IconSlot } from "../theme/icon-slot.js";
|
|
6
6
|
import { DeltaBadge } from "./delta-badge.js";
|
|
7
7
|
import classes from "./widget-header.module.css";
|
|
@@ -164,12 +164,14 @@ function WidgetHeader({
|
|
|
164
164
|
actions,
|
|
165
165
|
className,
|
|
166
166
|
style,
|
|
167
|
-
classNames
|
|
167
|
+
classNames,
|
|
168
|
+
...rest
|
|
168
169
|
}) {
|
|
169
170
|
const Heading = tier === "section" ? "h2" : "h3";
|
|
170
171
|
return /* @__PURE__ */ jsxs(
|
|
171
172
|
"div",
|
|
172
173
|
{
|
|
174
|
+
...pickDataAttributes(rest),
|
|
173
175
|
className: cx(classes.root, classNames?.root, className),
|
|
174
176
|
"data-tier": tier,
|
|
175
177
|
...style !== void 0 && { style },
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
* `--mantine-spacing-*` fallbacks.
|
|
11
11
|
*
|
|
12
12
|
* Layout keys on the enclosing card's OWN width (`container: basalt-card`, declared by ChartCard /
|
|
13
|
-
* StatCard / Section — docs/DESIGN-CORE.md § Layout, elevation, shapes), never the viewport:
|
|
14
|
-
* into the info glyph
|
|
15
|
-
* shrinking are unconditional. The subtitle ALSO folds (regardless of width) whenever the card's own
|
|
13
|
+
* StatCard / Section — docs/DESIGN-CORE.md § Layout, elevation, shapes), never the viewport: the subtitle stays visible text at every width (it wraps under the title); from 480px (wave 8) `value` + `delta` move onto the title row. Wrapping and
|
|
14
|
+
* shrinking are unconditional. The subtitle folds into the info glyph (regardless of width) only when the card's own
|
|
16
15
|
* height is under 280px — see the `[data-basalt-card-short]` block below (wave 8's header-economy
|
|
17
16
|
* law). No enclosing card, no container: the standard layout. Container conditions are px literals
|
|
18
17
|
* of CONTAINER_CLASSES.
|
|
@@ -234,6 +233,7 @@
|
|
|
234
233
|
* section with both read as a two-line heading rather than a heading plus a note. */
|
|
235
234
|
.subtitle {
|
|
236
235
|
margin-top: 4px;
|
|
236
|
+
overflow-wrap: anywhere;
|
|
237
237
|
font-size: var(--vx-text-sm);
|
|
238
238
|
font-weight: 400;
|
|
239
239
|
color: var(--vx-muted);
|
|
@@ -380,19 +380,16 @@
|
|
|
380
380
|
color: var(--vx-muted);
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
/* Card narrower than 480px: the subtitle
|
|
384
|
-
*
|
|
383
|
+
/* Card narrower than 480px: the subtitle stays visible text under the title and wraps (a touch
|
|
384
|
+
* surface has no hover to open a fold glyph). A chart card also clamps it to two lines, then an
|
|
385
|
+
* ellipsis; the full text stays in the DOM. Only the short-height fold below still moves it. */
|
|
385
386
|
@container basalt-card (max-width: 479.9px) {
|
|
386
|
-
.subtitle {
|
|
387
|
-
display:
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
.foldNote {
|
|
395
|
-
display: block;
|
|
387
|
+
[data-basalt-chart-header] .subtitle {
|
|
388
|
+
display: -webkit-box;
|
|
389
|
+
-webkit-box-orient: vertical;
|
|
390
|
+
-webkit-line-clamp: 2;
|
|
391
|
+
line-clamp: 2;
|
|
392
|
+
overflow: hidden;
|
|
396
393
|
}
|
|
397
394
|
}
|
|
398
395
|
|