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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Center, Group, Loader, Skeleton, Stack, Text, VisuallyHidden } from "@mantine/core";
|
|
3
|
+
import { useContext } from "react";
|
|
3
4
|
import { toErrorMessage } from "../common/errors.js";
|
|
4
|
-
import {
|
|
5
|
+
import { couldNotLoad, HostTitleContext } from "../common/could-not-load.js";
|
|
6
|
+
import { cx, pickDataAttributes } from "../common/props.js";
|
|
5
7
|
import { RetryButton } from "../common/retry-button.js";
|
|
6
8
|
import { VX } from "../tokens/index.js";
|
|
7
9
|
import { StatusDot } from "../theme/status-dot.js";
|
|
@@ -11,13 +13,16 @@ function LoadingState({
|
|
|
11
13
|
tier,
|
|
12
14
|
label = "Loading",
|
|
13
15
|
className,
|
|
14
|
-
style
|
|
16
|
+
style,
|
|
17
|
+
...rest
|
|
15
18
|
}) {
|
|
16
19
|
const resolved = tier ?? "page";
|
|
20
|
+
const data = pickDataAttributes(rest);
|
|
17
21
|
if (resolved === "section") {
|
|
18
22
|
return /* @__PURE__ */ jsxs(
|
|
19
23
|
Stack,
|
|
20
24
|
{
|
|
25
|
+
...data,
|
|
21
26
|
component: "output",
|
|
22
27
|
gap: "xs",
|
|
23
28
|
"aria-label": label,
|
|
@@ -36,6 +41,7 @@ function LoadingState({
|
|
|
36
41
|
return /* @__PURE__ */ jsx(
|
|
37
42
|
Center,
|
|
38
43
|
{
|
|
44
|
+
...data,
|
|
39
45
|
...className !== void 0 && { className },
|
|
40
46
|
style: { paddingBlock: "calc(var(--vx-space-stack-xs, 0.25rem) * 16)", ...style },
|
|
41
47
|
children: /* @__PURE__ */ jsx(Loader, { size: "sm", color: VX.muted, "aria-label": label })
|
|
@@ -44,27 +50,32 @@ function LoadingState({
|
|
|
44
50
|
}
|
|
45
51
|
function ErrorState({
|
|
46
52
|
error,
|
|
47
|
-
title
|
|
53
|
+
title: titleProp,
|
|
48
54
|
fallback = "The request failed.",
|
|
49
55
|
onRetry,
|
|
50
56
|
retrying = false,
|
|
51
57
|
tier,
|
|
52
58
|
action,
|
|
53
59
|
className,
|
|
54
|
-
style
|
|
60
|
+
style,
|
|
61
|
+
...rest
|
|
55
62
|
}) {
|
|
63
|
+
const data = pickDataAttributes(rest);
|
|
64
|
+
const hostTitle = useContext(HostTitleContext);
|
|
65
|
+
const title = titleProp ?? couldNotLoad(hostTitle);
|
|
56
66
|
const resolved = tier ?? "page";
|
|
57
67
|
const alert = /* @__PURE__ */ jsxs(
|
|
58
68
|
Stack,
|
|
59
69
|
{
|
|
60
70
|
gap: "xs",
|
|
61
71
|
role: "alert",
|
|
72
|
+
...resolved === "section" && data,
|
|
62
73
|
...resolved === "section" && className !== void 0 && { className },
|
|
63
74
|
...resolved === "section" && style !== void 0 && { style },
|
|
64
75
|
children: [
|
|
65
76
|
/* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
|
|
66
77
|
/* @__PURE__ */ jsx(StatusDot, { color: VX.status.bad }),
|
|
67
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: title })
|
|
78
|
+
/* @__PURE__ */ jsx(Text, { size: resolved === "section" ? "sm" : "md", fw: 500, children: title })
|
|
68
79
|
] }),
|
|
69
80
|
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: toErrorMessage(error, fallback) }),
|
|
70
81
|
(onRetry ?? action) !== void 0 && /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
@@ -79,6 +90,7 @@ function ErrorState({
|
|
|
79
90
|
Stack,
|
|
80
91
|
{
|
|
81
92
|
py: "md",
|
|
93
|
+
...data,
|
|
82
94
|
...className !== void 0 && { className },
|
|
83
95
|
...style !== void 0 && { style },
|
|
84
96
|
children: alert
|
|
@@ -108,16 +120,18 @@ function QueryState({
|
|
|
108
120
|
children,
|
|
109
121
|
empty,
|
|
110
122
|
isEmpty,
|
|
111
|
-
errorTitle
|
|
123
|
+
errorTitle,
|
|
112
124
|
errorFallback = "The request failed.",
|
|
113
125
|
errorAction,
|
|
114
126
|
tier,
|
|
115
127
|
loading,
|
|
116
128
|
className,
|
|
117
129
|
style,
|
|
118
|
-
classNames
|
|
130
|
+
classNames,
|
|
131
|
+
...rest
|
|
119
132
|
}) {
|
|
120
133
|
assertQueryStateLike("QueryState", query);
|
|
134
|
+
const dataAttrs = pickDataAttributes(rest);
|
|
121
135
|
const resolvedTier = tier ?? "page";
|
|
122
136
|
const rootClassName = cx(classNames?.root, className) || void 0;
|
|
123
137
|
const { data, isError, error, fetchStatus } = query;
|
|
@@ -127,8 +141,9 @@ function QueryState({
|
|
|
127
141
|
return /* @__PURE__ */ jsx(
|
|
128
142
|
ErrorState,
|
|
129
143
|
{
|
|
144
|
+
...dataAttrs,
|
|
130
145
|
error,
|
|
131
|
-
title: errorTitle,
|
|
146
|
+
...errorTitle !== void 0 && { title: errorTitle },
|
|
132
147
|
fallback: errorFallback,
|
|
133
148
|
onRetry: retry,
|
|
134
149
|
retrying,
|
|
@@ -141,10 +156,11 @@ function QueryState({
|
|
|
141
156
|
}
|
|
142
157
|
if (data === void 0) {
|
|
143
158
|
if (fetchStatus === "idle" && !isError)
|
|
144
|
-
return empty ? renderEmpty(empty, resolvedTier, rootClassName, style) : null;
|
|
159
|
+
return empty ? renderEmpty(empty, resolvedTier, rootClassName, style, dataAttrs) : null;
|
|
145
160
|
return loading ?? /* @__PURE__ */ jsx(
|
|
146
161
|
LoadingState,
|
|
147
162
|
{
|
|
163
|
+
...dataAttrs,
|
|
148
164
|
tier: resolvedTier,
|
|
149
165
|
...rootClassName !== void 0 && { className: rootClassName },
|
|
150
166
|
...style !== void 0 && { style }
|
|
@@ -152,11 +168,12 @@ function QueryState({
|
|
|
152
168
|
);
|
|
153
169
|
}
|
|
154
170
|
const emptyNow = isEmpty ? isEmpty(data) : defaultIsEmpty(data);
|
|
155
|
-
const body = emptyNow ? empty ? renderEmpty(empty, resolvedTier, rootClassName, style) : null : typeof children === "function" ? children(data) : children;
|
|
171
|
+
const body = emptyNow ? empty ? renderEmpty(empty, resolvedTier, rootClassName, style, dataAttrs) : null : typeof children === "function" ? children(data) : children;
|
|
156
172
|
if (!isError) return body;
|
|
157
173
|
return /* @__PURE__ */ jsxs(
|
|
158
174
|
Stack,
|
|
159
175
|
{
|
|
176
|
+
...dataAttrs,
|
|
160
177
|
gap: "sm",
|
|
161
178
|
...rootClassName !== void 0 && { className: rootClassName },
|
|
162
179
|
...style !== void 0 && { style },
|
|
@@ -177,10 +194,11 @@ function QueryState({
|
|
|
177
194
|
}
|
|
178
195
|
);
|
|
179
196
|
}
|
|
180
|
-
function renderEmpty(empty, tier, className, style) {
|
|
197
|
+
function renderEmpty(empty, tier, className, style, data) {
|
|
181
198
|
return /* @__PURE__ */ jsx(
|
|
182
199
|
EmptyState,
|
|
183
200
|
{
|
|
201
|
+
...data,
|
|
184
202
|
title: empty.title,
|
|
185
203
|
tier,
|
|
186
204
|
...empty.description !== void 0 && { description: empty.description },
|
|
@@ -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 { SectionActions } from '../controls/actions.js';
|
|
4
4
|
import type { QueryEmptyCopy, QueryStateLike } from './query-state.js';
|
|
5
5
|
import type { WidgetHeaderProps } from './widget-header.js';
|
|
@@ -12,7 +12,7 @@ import type { WidgetHeaderProps } from './widget-header.js';
|
|
|
12
12
|
export type SectionSlot = 'root' | 'header' | 'body';
|
|
13
13
|
/** The props only a drawn heading can carry; an untitled `Section` forbids each (`?: never`). */
|
|
14
14
|
type HeaderOnlyKey = 'icon' | 'subtitle' | 'info' | 'value' | 'unit' | 'delta' | 'deltaPeriod' | 'deltaPolarity' | 'deltaFormat' | 'deltaGlyph' | 'sparkline' | 'count';
|
|
15
|
-
type SectionBaseProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'actions' | 'title' | HeaderOnlyKey> & BasaltProps & SlotStylesProps<SectionSlot> & {
|
|
15
|
+
type SectionBaseProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'actions' | 'title' | HeaderOnlyKey> & BasaltProps & DataAttributes & SlotStylesProps<SectionSlot> & {
|
|
16
16
|
/**
|
|
17
17
|
* Header actions as typed data (law C15), projected through the SAME row `PageBar` uses — one
|
|
18
18
|
* kebab below `sm`. At most three: a fourth is a tsc error (law C6, `docs/V2-SPEC.md` §3).
|
|
@@ -35,6 +35,14 @@ type SectionBaseProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'actions
|
|
|
35
35
|
* without `query`.
|
|
36
36
|
*/
|
|
37
37
|
empty?: QueryEmptyCopy;
|
|
38
|
+
/**
|
|
39
|
+
* The loaded body's height in px. While `query` is pending the loading skeleton fills it, so
|
|
40
|
+
* the section does not jump when the data lands. Declared, not measured: a first load has no
|
|
41
|
+
* previous body to measure. Omitted, a body that is one `BarList`, `EventList` or `Meter`
|
|
42
|
+
* loads as that figure's own skeleton (set its `loadingRows` to the loaded count); any other
|
|
43
|
+
* body gets the three-bar default. Ignored without `query`.
|
|
44
|
+
*/
|
|
45
|
+
loadingHeight?: number;
|
|
38
46
|
/** Rendered in the header row, in its own `CtlSlot` — hidden while the section is collapsed. */
|
|
39
47
|
tabs?: ReactNode;
|
|
40
48
|
/** Renders a chevron toggle in the header; the header stays drawn when closed, only `children`
|
|
@@ -82,6 +90,6 @@ export type SectionProps = SectionBaseProps & ((Pick<WidgetHeaderProps, HeaderOn
|
|
|
82
90
|
} & {
|
|
83
91
|
[K in HeaderOnlyKey]?: never;
|
|
84
92
|
}));
|
|
85
|
-
export declare function Section({ actions, query, empty, tabs, collapsible, persistKey, defaultOpen, open: openProp, onOpenChange, summary, id, children, className, style, classNames, 'aria-label': ariaLabel, ...
|
|
93
|
+
export declare function Section({ actions, query, empty, loadingHeight, tabs, collapsible, persistKey, defaultOpen, open: openProp, onOpenChange, summary, id, children, className, style, classNames, 'aria-label': ariaLabel, ...headerAndData }: SectionProps): import("react").JSX.Element;
|
|
86
94
|
export {};
|
|
87
95
|
//# sourceMappingURL=section.d.ts.map
|
|
@@ -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;
|
|
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,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAKnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAIzD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAOnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAGxD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAMpD,iGAAiG;AACjG,KAAK,aAAa,GACd,MAAM,GACN,UAAU,GACV,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,aAAa,GACb,eAAe,GACf,aAAa,GACb,YAAY,GACZ,WAAW,GACX,OAAO,CAAA;AAEX,KAAK,gBAAgB,GAAG,IAAI,CAC1B,iBAAiB,EACjB,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAC5D,GACC,WAAW,GACX,cAAc,GACd,eAAe,CAAC,WAAW,CAAC,GAAG;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;;;;;;;O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R,SAAS,EACT,KAAK,EACL,UAAU,EACV,YAAY,EAAE,SAAS,EACvB,GAAG,aAAa,EACjB,EAAE,YAAY,+BA8Hd"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useId } from "react";
|
|
3
|
-
import { cx } from "../common/props.js";
|
|
2
|
+
import { Children, cloneElement, isValidElement, useContext, useEffect, useId } from "react";
|
|
3
|
+
import { cx, splitDataAttributes } from "../common/props.js";
|
|
4
4
|
import { BASALT_PREFIX } from "../common/errors.js";
|
|
5
5
|
import { useValidateProps } from "../common/validate.js";
|
|
6
6
|
import { CtlSlot } from "../theme/index.js";
|
|
7
7
|
import { BarActionSlot } from "../controls/actions.js";
|
|
8
8
|
import { useFilterSurface } from "../controls/filter-context.js";
|
|
9
|
-
import {
|
|
9
|
+
import { HostTitleContext } from "../common/could-not-load.js";
|
|
10
|
+
import { LoadingState, QueryState } from "./query-state.js";
|
|
10
11
|
import { usePersistedOrLocal } from "../state/persisted-or-local.js";
|
|
11
12
|
import { PAGE_BAR_HEIGHT_VAR, useInPageBarShell } from "../shell/index.js";
|
|
13
|
+
import { BarList } from "./bar-list.js";
|
|
14
|
+
import { EventList } from "./event-list.js";
|
|
15
|
+
import { Meter } from "./meter.js";
|
|
12
16
|
import { WidgetHeader } from "./widget-header.js";
|
|
13
17
|
import classes from "./section.module.css";
|
|
14
18
|
function ChevronToggle({
|
|
@@ -43,6 +47,13 @@ function ChevronToggle({
|
|
|
43
47
|
}
|
|
44
48
|
);
|
|
45
49
|
}
|
|
50
|
+
function figureLoading(children) {
|
|
51
|
+
const only = Children.toArray(children);
|
|
52
|
+
const [child] = only;
|
|
53
|
+
if (only.length !== 1 || !isValidElement(child)) return null;
|
|
54
|
+
if (child.type !== BarList && child.type !== EventList && child.type !== Meter) return null;
|
|
55
|
+
return cloneElement(child, { loading: true });
|
|
56
|
+
}
|
|
46
57
|
const ANCHOR_CLEARANCE = "var(--vx-space-sticky-header-clearance)";
|
|
47
58
|
function anchorOffset(inShell) {
|
|
48
59
|
if (inShell) return ANCHOR_CLEARANCE;
|
|
@@ -52,6 +63,7 @@ function Section({
|
|
|
52
63
|
actions,
|
|
53
64
|
query,
|
|
54
65
|
empty,
|
|
66
|
+
loadingHeight,
|
|
55
67
|
tabs,
|
|
56
68
|
collapsible = false,
|
|
57
69
|
persistKey,
|
|
@@ -65,9 +77,11 @@ function Section({
|
|
|
65
77
|
style,
|
|
66
78
|
classNames,
|
|
67
79
|
"aria-label": ariaLabel,
|
|
68
|
-
...
|
|
80
|
+
...headerAndData
|
|
69
81
|
}) {
|
|
82
|
+
const { data, rest: headerProps } = splitDataAttributes(headerAndData);
|
|
70
83
|
const { title } = headerProps;
|
|
84
|
+
const outerTitle = useContext(HostTitleContext);
|
|
71
85
|
const untitled = title === void 0;
|
|
72
86
|
useValidateProps(
|
|
73
87
|
"Section",
|
|
@@ -100,9 +114,11 @@ function Section({
|
|
|
100
114
|
actions !== void 0 && /* @__PURE__ */ jsx(CtlSlot, { children: /* @__PURE__ */ jsx(BarActionSlot, { actions }) }),
|
|
101
115
|
foldable && /* @__PURE__ */ jsx(ChevronToggle, { open, onToggle: () => setOpen(!open), controls: bodyId })
|
|
102
116
|
] }) : void 0;
|
|
103
|
-
|
|
117
|
+
const figure = query !== void 0 && loadingHeight === void 0 ? figureLoading(children) : null;
|
|
118
|
+
return /* @__PURE__ */ jsx(HostTitleContext, { value: title ?? outerTitle, children: /* @__PURE__ */ jsxs(
|
|
104
119
|
"div",
|
|
105
120
|
{
|
|
121
|
+
...data,
|
|
106
122
|
className: cx(classes.root, classNames?.root, className),
|
|
107
123
|
"data-tier": tier,
|
|
108
124
|
...untitled && ariaLabel !== void 0 && { role: "group", "aria-label": ariaLabel },
|
|
@@ -124,11 +140,22 @@ function Section({
|
|
|
124
140
|
// `tier="section"` is the compact one: a bare spinner rather than a 64px centred
|
|
125
141
|
// block, and the error alert without the page-level stack around it. A Section IS the
|
|
126
142
|
// region, so the state belongs inside its body, never around its header.
|
|
127
|
-
/* @__PURE__ */ jsx(
|
|
143
|
+
/* @__PURE__ */ jsx(
|
|
144
|
+
QueryState,
|
|
145
|
+
{
|
|
146
|
+
query,
|
|
147
|
+
tier: "section",
|
|
148
|
+
...empty !== void 0 && { empty },
|
|
149
|
+
...loadingHeight !== void 0 ? {
|
|
150
|
+
loading: /* @__PURE__ */ jsx(LoadingState, { tier: "section", style: { minHeight: loadingHeight } })
|
|
151
|
+
} : figure !== null && { loading: figure },
|
|
152
|
+
children
|
|
153
|
+
}
|
|
154
|
+
)
|
|
128
155
|
) })
|
|
129
156
|
]
|
|
130
157
|
}
|
|
131
|
-
);
|
|
158
|
+
) });
|
|
132
159
|
}
|
|
133
160
|
export {
|
|
134
161
|
Section
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { WidgetHeaderTitleProps } from './widget-header.js';
|
|
3
|
-
import type { BasaltProps, SlotStylesProps } from '../common/props.js';
|
|
3
|
+
import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props.js';
|
|
4
4
|
/** The three boxes `SettingsSection`/`DangerZone` paint (`common/props.ts`). */
|
|
5
5
|
export type SettingsSectionSlot = 'root' | 'header' | 'body';
|
|
6
6
|
/**
|
|
@@ -11,13 +11,13 @@ export type SettingsSectionSlot = 'root' | 'header' | 'body';
|
|
|
11
11
|
* `Section` and `ChartCard` still cut their own ad-hoc subsets; both should move onto the same
|
|
12
12
|
* slices.
|
|
13
13
|
*/
|
|
14
|
-
export type SettingsSectionProps = BasaltProps & SlotStylesProps<SettingsSectionSlot> & WidgetHeaderTitleProps & {
|
|
14
|
+
export type SettingsSectionProps = BasaltProps & DataAttributes & SlotStylesProps<SettingsSectionSlot> & WidgetHeaderTitleProps & {
|
|
15
15
|
/** Header-right slot — wrapped in `CtlSlot` (C1/C5). */
|
|
16
16
|
actions?: ReactNode;
|
|
17
17
|
/** Section body — typically a stack of `SettingsRow`s. */
|
|
18
18
|
children: ReactNode;
|
|
19
19
|
};
|
|
20
|
-
export declare function SettingsSection({ title, icon, subtitle, info, actions, children, className, style, classNames, }: SettingsSectionProps): import("react").JSX.Element;
|
|
20
|
+
export declare function SettingsSection({ title, icon, subtitle, info, actions, children, className, style, classNames, ...rest }: SettingsSectionProps): import("react").JSX.Element;
|
|
21
21
|
/** The three boxes `SettingsRow` paints (`common/props.ts`). */
|
|
22
22
|
export type SettingsRowSlot = 'root' | 'label' | 'control';
|
|
23
23
|
export type SettingsRowProps = BasaltProps & SlotStylesProps<SettingsRowSlot> & {
|
|
@@ -25,12 +25,15 @@ export type SettingsRowProps = BasaltProps & SlotStylesProps<SettingsRowSlot> &
|
|
|
25
25
|
label: string;
|
|
26
26
|
/** Optional 12px muted description under the label. */
|
|
27
27
|
description?: string;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Right-aligned control (input/switch/button). Mounted in a `CtlSlot`: a bound input is the 32 px
|
|
30
|
+
* field (44 under a coarse pointer), not Mantine's 42 px `md`; a control's own `size` still wins.
|
|
31
|
+
*/
|
|
29
32
|
control?: ReactNode;
|
|
30
33
|
/** Alternative to `control` for a fully custom right-hand region. */
|
|
31
34
|
children?: ReactNode;
|
|
32
35
|
};
|
|
33
36
|
export declare function SettingsRow({ label, description, control, children, className, style, classNames, }: SettingsRowProps): import("react").JSX.Element;
|
|
34
37
|
export type DangerZoneProps = SettingsSectionProps;
|
|
35
|
-
export declare function DangerZone({ title, icon, subtitle, info, actions, children, className, style, classNames, }: DangerZoneProps): import("react").JSX.Element;
|
|
38
|
+
export declare function DangerZone({ title, icon, subtitle, info, actions, children, className, style, classNames, ...rest }: DangerZoneProps): import("react").JSX.Element;
|
|
36
39
|
//# sourceMappingURL=settings-section.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-section.d.ts","sourceRoot":"","sources":["../../src/dashboard/settings-section.tsx"],"names":[],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AGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAEH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,gBAAgB,+BAiBlB;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAA;AAElD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,UAAU,EACV,GAAG,IAAI,EACR,EAAE,eAAe,+BAyBjB"}
|
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Card, Stack } from "@mantine/core";
|
|
3
3
|
import { WidgetHeader } from "./widget-header.js";
|
|
4
4
|
import { CtlSlot } from "../theme/index.js";
|
|
5
|
-
import {
|
|
6
|
-
import { cx } from "../common/props.js";
|
|
5
|
+
import { VX } from "../tokens/index.js";
|
|
6
|
+
import { cx, pickDataAttributes } from "../common/props.js";
|
|
7
7
|
import classes from "./settings-section.module.css";
|
|
8
8
|
const eyebrowStyle = {
|
|
9
9
|
fontFamily: "var(--basalt-font-mono)",
|
|
@@ -22,9 +22,10 @@ function SettingsSection({
|
|
|
22
22
|
children,
|
|
23
23
|
className,
|
|
24
24
|
style,
|
|
25
|
-
classNames
|
|
25
|
+
classNames,
|
|
26
|
+
...rest
|
|
26
27
|
}) {
|
|
27
|
-
return /* @__PURE__ */ jsxs(Card, { className: cx(classNames?.root, className), style, children: [
|
|
28
|
+
return /* @__PURE__ */ jsxs(Card, { ...pickDataAttributes(rest), className: cx(classNames?.root, className), style, children: [
|
|
28
29
|
/* @__PURE__ */ jsx("div", { className: cx(classes.header, classNames?.header), children: /* @__PURE__ */ jsx(
|
|
29
30
|
WidgetHeader,
|
|
30
31
|
{
|
|
@@ -58,7 +59,7 @@ function SettingsRow({
|
|
|
58
59
|
/* @__PURE__ */ jsx("span", { style: { fontSize: VX.text.sm, color: VX.ink }, children: label }),
|
|
59
60
|
description && /* @__PURE__ */ jsx("span", { style: { fontSize: VX.text.xs, color: VX.muted }, children: description })
|
|
60
61
|
] }),
|
|
61
|
-
/* @__PURE__ */ jsx("div", { className: cx(classes.control, classNames?.control), children: control ?? children })
|
|
62
|
+
/* @__PURE__ */ jsx("div", { className: cx(classes.control, classNames?.control), children: /* @__PURE__ */ jsx(CtlSlot, { children: control ?? children }) })
|
|
62
63
|
]
|
|
63
64
|
}
|
|
64
65
|
);
|
|
@@ -72,14 +73,17 @@ function DangerZone({
|
|
|
72
73
|
children,
|
|
73
74
|
className,
|
|
74
75
|
style,
|
|
75
|
-
classNames
|
|
76
|
+
classNames,
|
|
77
|
+
...rest
|
|
76
78
|
}) {
|
|
77
79
|
return /* @__PURE__ */ jsxs(
|
|
78
80
|
Card,
|
|
79
81
|
{
|
|
80
|
-
|
|
82
|
+
...pickDataAttributes(rest),
|
|
83
|
+
className: cx(classes.danger, classNames?.root, className),
|
|
81
84
|
style: {
|
|
82
|
-
|
|
85
|
+
// The card's depth plus ONE edge in the class's scheme-independent ring colour.
|
|
86
|
+
boxShadow: `${VX.shadowCard}, 0 0 0 1px var(--danger-ring)`,
|
|
83
87
|
...style
|
|
84
88
|
},
|
|
85
89
|
children: [
|
|
@@ -21,13 +21,34 @@
|
|
|
21
21
|
border-bottom: 1px solid var(--vx-divider);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/* One row rule with FormRow (`controls/form-layout.module.css`): a 15rem label column, a control
|
|
25
|
+
* column capped at 20rem, left-packed; stacked under 600px of the section's OWN width. */
|
|
26
|
+
.rows {
|
|
27
|
+
container-type: inline-size;
|
|
28
|
+
container-name: basalt-form;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
.row {
|
|
25
|
-
display:
|
|
26
|
-
|
|
27
|
-
justify-content:
|
|
32
|
+
display: grid;
|
|
33
|
+
grid-template-columns: minmax(0, 15rem) minmax(0, 20rem);
|
|
34
|
+
justify-content: start;
|
|
35
|
+
align-items: start;
|
|
28
36
|
gap: var(--vx-space-settings-row-gap);
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
.control {
|
|
32
|
-
|
|
40
|
+
min-inline-size: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@container basalt-form (max-width: 599.9px) {
|
|
44
|
+
.row {
|
|
45
|
+
grid-template-columns: minmax(0, 1fr);
|
|
46
|
+
gap: var(--vx-space-stack-xs);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* DangerZone's ring colour: the status token mixed into the panel surface — one formula in both
|
|
51
|
+
* schemes, never an alpha over whatever sits behind it. The component layers it on `shadow-card`. */
|
|
52
|
+
.danger {
|
|
53
|
+
--danger-ring: color-mix(in srgb, var(--vx-status-bad) 40%, var(--vx-surface-panel));
|
|
33
54
|
}
|
|
@@ -32,7 +32,11 @@ export declare function Foot({ reserve, visualBand, visualNode, footerNode }: Fo
|
|
|
32
32
|
/** The `'right'` slot's size, handed to CSS as custom properties (an inline `flex-basis` would also
|
|
33
33
|
* apply in a narrow card, where the row is a column and the basis becomes the HEIGHT). */
|
|
34
34
|
export declare function rightSlotStyle(width: number, height: number): CSSProperties;
|
|
35
|
-
|
|
35
|
+
/** The value bar, and a delta chip beside it when the loaded card carries a delta. */
|
|
36
|
+
export declare function ValueSkeleton({ delta }: {
|
|
37
|
+
delta: boolean;
|
|
38
|
+
}): import("react").JSX.Element;
|
|
39
|
+
/** The visual slot's loading shape: a line ghost at the sparkline's own height, no spinner. */
|
|
36
40
|
export declare function VisualSkeleton(): import("react").JSX.Element;
|
|
37
41
|
export declare function FooterSkeleton(): import("react").JSX.Element;
|
|
38
42
|
/** One placeholder row per `breakdown` row, each at the real row's height. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat-card-parts.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-card-parts.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAI3C,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AASD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,eAAe,+BAoC1F;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,+FAA+F;IAC/F,OAAO,EAAE,OAAO,CAAA;IAChB;qFACiF;IACjF,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,SAAS,CAAA;IACrB,UAAU,EAAE,SAAS,CAAA;CACtB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,SAAS,sCAQ9E;AAED;0FAC0F;AAC1F,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAK3E;AAED,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"stat-card-parts.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-card-parts.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CA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keleton() {
|
|
51
|
-
return /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonValue, radius: "sm" });
|
|
50
|
+
function ValueSkeleton({ delta }) {
|
|
51
|
+
if (!delta) return /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonValue, radius: "sm" });
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.skeletonValueRow, children: [
|
|
53
|
+
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonValueWithDelta, radius: "sm" }),
|
|
54
|
+
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonDelta, radius: "sm", "data-stat-skeleton-delta": "" })
|
|
55
|
+
] });
|
|
52
56
|
}
|
|
57
|
+
const SPARK_GHOST = "0,30 12,26 25,28 38,18 50,22 62,12 75,16 88,8 100,12";
|
|
53
58
|
function VisualSkeleton() {
|
|
54
|
-
return /* @__PURE__ */ jsx(
|
|
59
|
+
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: classes.skeletonVisual, "data-stat-skeleton-spark": "", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 100 40", preserveAspectRatio: "none", children: /* @__PURE__ */ jsx("polyline", { points: SPARK_GHOST, vectorEffect: "non-scaling-stroke" }) }) });
|
|
55
60
|
}
|
|
56
61
|
function FooterSkeleton() {
|
|
57
62
|
return /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonFooter, radius: "sm" });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { WidgetHeaderDeltaProps, WidgetHeaderMetricProps, WidgetHeaderTitleProps } from './widget-header.js';
|
|
3
|
-
import type { BasaltProps, SlotStylesProps, Tone } from '../common/props.js';
|
|
3
|
+
import type { BasaltProps, DataAttributes, SlotStylesProps, Tone } from '../common/props.js';
|
|
4
4
|
import type { QueryStateLike } from './query-state.js';
|
|
5
5
|
/**
|
|
6
6
|
* The boxes `StatCard` paints, and the whole styling seam it offers (`common/props.ts`).
|
|
@@ -48,7 +48,7 @@ export type StatCardSparklineSize = {
|
|
|
48
48
|
* `Section` and `ChartCard` still cut their own ad-hoc subsets; both should move onto these same
|
|
49
49
|
* three slices.
|
|
50
50
|
*/
|
|
51
|
-
export type StatCardProps = BasaltProps & SlotStylesProps<StatCardSlot> & Omit<WidgetHeaderTitleProps, 'subtitle'> & Omit<WidgetHeaderMetricProps, 'value'> & WidgetHeaderDeltaProps & {
|
|
51
|
+
export type StatCardProps = BasaltProps & DataAttributes & SlotStylesProps<StatCardSlot> & Omit<WidgetHeaderTitleProps, 'subtitle'> & Omit<WidgetHeaderMetricProps, 'value'> & WidgetHeaderDeltaProps & {
|
|
52
52
|
/** Pre-formatted hero figure (sans `kpi`, weight 500, lining, ink). Required here, unlike on
|
|
53
53
|
* `WidgetHeader`: see the type's own doc. */
|
|
54
54
|
value: string;
|
|
@@ -137,5 +137,5 @@ export type StatCardProps = BasaltProps & SlotStylesProps<StatCardSlot> & Omit<W
|
|
|
137
137
|
* earned the verdict. */
|
|
138
138
|
tone?: Tone;
|
|
139
139
|
};
|
|
140
|
-
export declare function StatCard({ title, icon, info, qualifier, subtitle, value, unit, breakdown, query, loading, emptyText, delta, deltaPeriod, deltaPolarity, deltaFormat, deltaGlyph, sparkline, sparklinePlacement, actions, tone, className, style, classNames, }: StatCardProps): import("react").JSX.Element;
|
|
140
|
+
export declare function StatCard({ title, icon, info, qualifier, subtitle, value, unit, breakdown, query, loading, emptyText, delta, deltaPeriod, deltaPolarity, deltaFormat, deltaGlyph, sparkline, sparklinePlacement, actions, tone, className, style, classNames, ...rest }: StatCardProps): import("react").JSX.Element;
|
|
141
141
|
//# sourceMappingURL=stat-card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat-card.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-card.tsx"],"names":[],"mappings":"AA6FA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAUtC,OAAO,KAAK,EACV,sBA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