basalt-ui 2.16.0 → 2.18.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 +165 -124
- package/MIGRATING.md +133 -15
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +3 -3
- package/configs/oxlint-plugin.js +2 -2
- package/dist/charts/Donut.d.ts.map +1 -1
- package/dist/charts/Donut.js +2 -2
- package/dist/charts/DualPanel.js +2 -2
- package/dist/charts/Heatmap.d.ts.map +1 -1
- package/dist/charts/Heatmap.js +2 -2
- package/dist/charts/MirroredBars.js +2 -2
- package/dist/charts/Sparkline.d.ts +4 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +3 -3
- package/dist/charts/compile.d.ts +8 -3
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +19 -9
- package/dist/charts/cursor.d.ts +14 -1
- package/dist/charts/cursor.d.ts.map +1 -1
- package/dist/charts/cursor.js +29 -3
- package/dist/charts/date-tick-format.d.ts +17 -0
- package/dist/charts/date-tick-format.d.ts.map +1 -0
- package/dist/charts/date-tick-format.js +81 -0
- package/dist/charts/panel.d.ts +2 -1
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +3 -2
- package/dist/charts/types.d.ts +5 -1
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/help.d.ts +1 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -2
- package/dist/cli/shot/capture.d.ts +28 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +96 -13
- package/dist/cli/shot/index.d.ts +10 -1
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +40 -5
- package/dist/cli/shot/playwright.d.ts +4 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/cli/shot/real-data.d.ts +35 -0
- package/dist/cli/shot/real-data.d.ts.map +1 -0
- package/dist/cli/shot/real-data.js +120 -0
- package/dist/cli/shot/serve.d.ts +2 -2
- package/dist/cli/shot/serve.d.ts.map +1 -1
- package/dist/cli/shot/serve.js +16 -2
- package/dist/dashboard/bar-list.d.ts +29 -0
- package/dist/dashboard/bar-list.d.ts.map +1 -0
- package/dist/dashboard/bar-list.js +52 -0
- package/dist/dashboard/bar-list.module.css +73 -0
- package/dist/dashboard/bar-list.module.css.d.ts +16 -0
- package/dist/dashboard/delta-badge.d.ts +2 -2
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +12 -14
- 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 +78 -0
- package/dist/dashboard/meter-model.d.ts.map +1 -0
- package/dist/dashboard/meter-model.js +91 -0
- package/dist/dashboard/meter-parts.d.ts +42 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -0
- package/dist/dashboard/meter-parts.js +163 -0
- package/dist/dashboard/meter.d.ts +112 -0
- package/dist/dashboard/meter.d.ts.map +1 -0
- package/dist/dashboard/meter.js +43 -0
- package/dist/dashboard/meter.module.css +150 -0
- package/dist/dashboard/meter.module.css.d.ts +28 -0
- package/dist/dashboard/query-state.d.ts +35 -0
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +12 -1
- package/dist/dashboard/scale.d.ts +9 -0
- package/dist/dashboard/scale.d.ts.map +1 -0
- package/dist/dashboard/scale.js +10 -0
- package/dist/dashboard/stat-card-parts.d.ts +40 -0
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -0
- package/dist/dashboard/stat-card-parts.js +55 -0
- package/dist/dashboard/stat-card.d.ts +46 -34
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +148 -79
- package/dist/dashboard/stat-card.module.css +220 -7
- package/dist/dashboard/stat-card.module.css.d.ts +20 -0
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +73 -9
- package/dist/dashboard/widget-header.module.css +25 -17
- package/dist/guard/index.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/theme/chrome-vars.d.ts +82 -0
- package/dist/theme/chrome-vars.d.ts.map +1 -0
- package/dist/theme/chrome-vars.js +36 -0
- package/dist/theme/controls.module.css +20 -1
- package/dist/theme/controls.module.css.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +30 -33
- package/dist/tokens/derive.d.ts +11 -1
- package/dist/tokens/derive.d.ts.map +1 -1
- package/dist/tokens/derive.js +9 -24
- package/dist/tokens/status-text.d.ts +26 -0
- package/dist/tokens/status-text.d.ts.map +1 -0
- package/dist/tokens/status-text.js +68 -0
- package/llms.txt +36 -4
- package/package.json +1 -1
- package/src/charts/Donut.tsx +2 -2
- package/src/charts/DualPanel.tsx +2 -2
- package/src/charts/Heatmap.tsx +2 -2
- package/src/charts/MirroredBars.tsx +2 -2
- package/src/charts/Sparkline.tsx +7 -5
- package/src/charts/compile.ts +31 -11
- package/src/charts/cursor.ts +48 -3
- package/src/charts/date-tick-format.ts +132 -0
- package/src/charts/panel.tsx +5 -3
- package/src/charts/types.ts +5 -1
- package/src/cli/help.ts +22 -2
- package/src/cli/shot/capture.ts +133 -12
- package/src/cli/shot/index.ts +50 -4
- package/src/cli/shot/playwright.ts +1 -1
- package/src/cli/shot/real-data.ts +165 -0
- package/src/cli/shot/serve.ts +28 -3
- package/src/dashboard/bar-list.module.css +73 -0
- package/src/dashboard/bar-list.module.css.d.ts +16 -0
- package/src/dashboard/bar-list.tsx +112 -0
- package/src/dashboard/delta-badge.tsx +24 -18
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +161 -0
- package/src/dashboard/meter-parts.tsx +223 -0
- package/src/dashboard/meter.module.css +150 -0
- package/src/dashboard/meter.module.css.d.ts +28 -0
- package/src/dashboard/meter.tsx +162 -0
- package/src/dashboard/query-state.tsx +38 -0
- package/src/dashboard/scale.ts +13 -0
- package/src/dashboard/stat-card-parts.tsx +108 -0
- package/src/dashboard/stat-card.module.css +220 -7
- package/src/dashboard/stat-card.module.css.d.ts +20 -0
- package/src/dashboard/stat-card.tsx +282 -174
- package/src/dashboard/widget-header.module.css +25 -17
- package/src/dashboard/widget-header.tsx +103 -7
- package/src/guard/index.ts +2 -2
- package/src/index.ts +4 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +128 -40
- package/src/theme/chrome-vars.ts +111 -0
- package/src/theme/controls.module.css +20 -1
- package/src/theme/controls.module.css.d.ts +1 -0
- package/src/theme/index.ts +39 -101
- package/src/tokens/derive.ts +19 -26
- package/src/tokens/status-text.ts +85 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Meter — one neutral track, ordered fills, optional target tick (docs/waves/design-parity/SPEC.md
|
|
3
|
+
* § 6.3). Flat fills, no hatching. Bar height 6 is the measured reference; the radius is the `fine`
|
|
4
|
+
* step so the track follows the radius knob.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.root {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: var(--vx-space-stack-xs, 0.25rem);
|
|
11
|
+
min-width: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.track {
|
|
15
|
+
position: relative;
|
|
16
|
+
display: flex;
|
|
17
|
+
height: 0.375rem;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
border-radius: var(--vx-radius-fine);
|
|
20
|
+
background: var(--vx-surface-subtle);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* The tick is drawn OVER the fills and outside the clipped track, so it can stand 2px proud of it. */
|
|
24
|
+
.trackBox {
|
|
25
|
+
position: relative;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.fill {
|
|
29
|
+
flex: none;
|
|
30
|
+
height: 100%;
|
|
31
|
+
background: var(--vx-line);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* The committed/forecast pair: the same neutral at two strengths. Flat, never hatched. */
|
|
35
|
+
.forecastFill {
|
|
36
|
+
background: color-mix(in srgb, var(--vx-line) 45%, transparent);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.zone {
|
|
40
|
+
position: absolute;
|
|
41
|
+
inset-block: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* The reading on a zone track: a notch standing proud of the bands, in ink. */
|
|
45
|
+
.marker {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: -3px;
|
|
48
|
+
bottom: -3px;
|
|
49
|
+
width: 3px;
|
|
50
|
+
margin-inline-start: -1.5px;
|
|
51
|
+
border-radius: 1px;
|
|
52
|
+
background: var(--vx-ink);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tick {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: -2px;
|
|
58
|
+
bottom: -2px;
|
|
59
|
+
width: 2px;
|
|
60
|
+
margin-inline-start: -1px;
|
|
61
|
+
border-radius: 1px;
|
|
62
|
+
background: var(--vx-ink);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.boundaryTick {
|
|
66
|
+
composes: tick;
|
|
67
|
+
background: var(--vx-muted);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.captions {
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: baseline;
|
|
73
|
+
justify-content: space-between;
|
|
74
|
+
gap: var(--vx-space-control-gap, 0.375rem);
|
|
75
|
+
font-family: var(--basalt-font-mono);
|
|
76
|
+
font-size: var(--vx-text-micro);
|
|
77
|
+
color: var(--vx-muted);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.caption {
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.captionEnd {
|
|
85
|
+
composes: caption;
|
|
86
|
+
text-align: end;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Alone in the row, the end caption still sits at the end. */
|
|
90
|
+
.captionEnd:first-child {
|
|
91
|
+
margin-inline-start: auto;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.empty {
|
|
95
|
+
font-size: var(--vx-text-sm);
|
|
96
|
+
color: var(--vx-muted);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* The skeleton holds the track + one caption line: 6 + 4 + a micro line. */
|
|
100
|
+
.skeletonTrack {
|
|
101
|
+
height: 0.375rem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.skeletonCaption {
|
|
105
|
+
width: 40%;
|
|
106
|
+
height: 0.75rem;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* ── ring ────────────────────────────────────────────────────────────────────────────────────── */
|
|
110
|
+
|
|
111
|
+
.ringBox {
|
|
112
|
+
position: relative;
|
|
113
|
+
display: inline-flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
align-self: flex-start;
|
|
117
|
+
width: 5rem;
|
|
118
|
+
height: 5rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.ring {
|
|
122
|
+
position: absolute;
|
|
123
|
+
inset: 0;
|
|
124
|
+
width: 100%;
|
|
125
|
+
height: 100%;
|
|
126
|
+
transform: rotate(-90deg);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.ringTrack {
|
|
130
|
+
fill: none;
|
|
131
|
+
stroke: var(--vx-surface-subtle);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.ringArc {
|
|
135
|
+
fill: none;
|
|
136
|
+
stroke: var(--vx-line);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.ringValue {
|
|
140
|
+
position: relative;
|
|
141
|
+
font-family: var(--basalt-font-mono);
|
|
142
|
+
font-size: var(--vx-text-md);
|
|
143
|
+
font-weight: 500;
|
|
144
|
+
color: var(--vx-ink);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.skeletonRing {
|
|
148
|
+
width: 5rem;
|
|
149
|
+
height: 5rem;
|
|
150
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
|
|
3
|
+
* signature — so dot access stays verbatim under the package's strict flags.
|
|
4
|
+
*/
|
|
5
|
+
declare const classes: {
|
|
6
|
+
readonly root: string
|
|
7
|
+
readonly track: string
|
|
8
|
+
readonly trackBox: string
|
|
9
|
+
readonly fill: string
|
|
10
|
+
readonly forecastFill: string
|
|
11
|
+
readonly zone: string
|
|
12
|
+
readonly marker: string
|
|
13
|
+
readonly tick: string
|
|
14
|
+
readonly boundaryTick: string
|
|
15
|
+
readonly captions: string
|
|
16
|
+
readonly caption: string
|
|
17
|
+
readonly captionEnd: string
|
|
18
|
+
readonly empty: string
|
|
19
|
+
readonly skeletonTrack: string
|
|
20
|
+
readonly skeletonCaption: string
|
|
21
|
+
readonly ringBox: string
|
|
22
|
+
readonly ring: string
|
|
23
|
+
readonly ringTrack: string
|
|
24
|
+
readonly ringArc: string
|
|
25
|
+
readonly ringValue: string
|
|
26
|
+
readonly skeletonRing: string
|
|
27
|
+
}
|
|
28
|
+
export default classes
|
|
@@ -55,6 +55,41 @@ export type ErrorStateProps = BasaltProps & {
|
|
|
55
55
|
* outside a query — an auth gate or a boundary fallback renders it directly.
|
|
56
56
|
*/
|
|
57
57
|
export declare function ErrorState({ error, title, fallback, onRetry, retrying, tier, action, className, style, }: ErrorStateProps): ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* The body a card-sized consumer should show for `query`, resolved by ONE precedence:
|
|
60
|
+
* error > pending > empty > ready.
|
|
61
|
+
*
|
|
62
|
+
* - `error`: the fetch failed and there is nothing to show — no data, or data that is empty (an
|
|
63
|
+
* errored refetch over a cached `[]` is a failure, never "no data");
|
|
64
|
+
* - `pending`: no data, not failed, and a fetch is in flight or paused;
|
|
65
|
+
* - `empty`: no data and nothing in flight (an `enabled: false` query), or data that is empty by
|
|
66
|
+
* the same rule as {@link QueryState} (`null`, `[]`, `{ data: [] }`);
|
|
67
|
+
* - `ready`: data worth showing; `refreshFailed` is true when a background refetch failed over it
|
|
68
|
+
* (the "showing cached data" banner case).
|
|
69
|
+
*
|
|
70
|
+
* `QueryState` renders a whole region and keeps its own branch order; this is for a consumer that
|
|
71
|
+
* swaps one region of a larger surface (`StatCard`'s figure) and needs the same words for the same
|
|
72
|
+
* states. Switch over `kind` and end with `default: return branch satisfies never`.
|
|
73
|
+
*/
|
|
74
|
+
export type QueryBranch<TData> = {
|
|
75
|
+
kind: 'error';
|
|
76
|
+
query: QueryStateLike<TData>;
|
|
77
|
+
error: unknown;
|
|
78
|
+
} | {
|
|
79
|
+
kind: 'pending';
|
|
80
|
+
query: QueryStateLike<TData>;
|
|
81
|
+
} | {
|
|
82
|
+
kind: 'empty';
|
|
83
|
+
query: QueryStateLike<TData>;
|
|
84
|
+
} | {
|
|
85
|
+
kind: 'ready';
|
|
86
|
+
query: QueryStateLike<TData>;
|
|
87
|
+
data: TData;
|
|
88
|
+
refreshFailed: boolean;
|
|
89
|
+
};
|
|
90
|
+
export declare function resolveQueryBranch<TData>(query: QueryStateLike<TData>,
|
|
91
|
+
/** Names the container in the throw on a malformed `query` (`'StatCard'`). */
|
|
92
|
+
caller: string, isEmpty?: (data: TData) => boolean): QueryBranch<TData>;
|
|
58
93
|
/**
|
|
59
94
|
* ONE slot, and the single-member union is the statement (`common/props.ts` lists this among the
|
|
60
95
|
* composites): `root` is whichever branch is live — the error alert's stack, the spinner's centre,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-state.d.ts","sourceRoot":"","sources":["../../src/dashboard/query-state.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAGrD,OAAO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EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uDAAuD;IACvD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,kDAAkD;IAClD,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,EAChC,KAAK,EACL,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAA6B,EAC7B,aAAqC,EACrC,WAAW,EACX,IAAI,EACJ,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CAqEpC"}
|
|
@@ -79,6 +79,16 @@ function defaultIsEmpty(data) {
|
|
|
79
79
|
}
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
|
+
function resolveQueryBranch(query, caller, isEmpty = defaultIsEmpty) {
|
|
83
|
+
assertQueryStateLike(caller, query);
|
|
84
|
+
const { data, isError, error, fetchStatus } = query;
|
|
85
|
+
if (data === void 0) {
|
|
86
|
+
if (isError) return { kind: "error", query, error };
|
|
87
|
+
return fetchStatus === "idle" ? { kind: "empty", query } : { kind: "pending", query };
|
|
88
|
+
}
|
|
89
|
+
if (isEmpty(data)) return isError ? { kind: "error", query, error } : { kind: "empty", query };
|
|
90
|
+
return { kind: "ready", query, data, refreshFailed: isError };
|
|
91
|
+
}
|
|
82
92
|
function QueryState({
|
|
83
93
|
query,
|
|
84
94
|
children,
|
|
@@ -170,5 +180,6 @@ function renderEmpty(empty, tier, className, style) {
|
|
|
170
180
|
export {
|
|
171
181
|
ErrorState,
|
|
172
182
|
LoadingState,
|
|
173
|
-
QueryState
|
|
183
|
+
QueryState,
|
|
184
|
+
resolveQueryBranch
|
|
174
185
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Shared by `Meter` and `BarList`: the one place a value becomes a track percentage. Internal. */
|
|
2
|
+
/** Clamps to 0–1; a non-finite fraction is 0. */
|
|
3
|
+
export declare const clamp01: (n: number) => number;
|
|
4
|
+
/** A 0–1 fraction as a percent, rounded so float noise never reaches the DOM. */
|
|
5
|
+
export declare const toPct: (n: number) => number;
|
|
6
|
+
/** A value on a track that ends at `scale`; a non-finite value or an empty scale draws nothing. */
|
|
7
|
+
export declare const barPercent: (value: number, scale: number) => number;
|
|
8
|
+
export declare const asText: (n: number) => string;
|
|
9
|
+
//# sourceMappingURL=scale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale.d.ts","sourceRoot":"","sources":["../../src/dashboard/scale.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG,iDAAiD;AACjD,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,KAAG,MAAgE,CAAA;AAEpG,iFAAiF;AACjF,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,KAAG,MAA8C,CAAA;AAEhF,mGAAmG;AACnG,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,KAAG,MACgC,CAAA;AAE1F,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,MAAmB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const clamp01 = (n) => Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 0;
|
|
2
|
+
const toPct = (n) => Math.round(clamp01(n) * 1e4) / 100;
|
|
3
|
+
const barPercent = (value, scale) => Number.isFinite(value) && Number.isFinite(scale) && scale > 0 ? toPct(value / scale) : 0;
|
|
4
|
+
const asText = (n) => String(n);
|
|
5
|
+
export {
|
|
6
|
+
asText,
|
|
7
|
+
barPercent,
|
|
8
|
+
clamp01,
|
|
9
|
+
toPct
|
|
10
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export type CaptionRowProps = {
|
|
3
|
+
title: string;
|
|
4
|
+
icon?: ReactNode;
|
|
5
|
+
info?: string;
|
|
6
|
+
qualifier?: string;
|
|
7
|
+
actions?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Title, `info` glyph and `qualifier` in one wrapping group, `actions` pinned at the end. When
|
|
11
|
+
* caption + info + qualifier do not fit, the qualifier wraps UNDER the caption instead of truncating
|
|
12
|
+
* either: the container's width decides, never the viewport's.
|
|
13
|
+
*/
|
|
14
|
+
export declare function CaptionRow({ title, icon, info, qualifier, actions }: CaptionRowProps): import("react").JSX.Element;
|
|
15
|
+
export type FootProps = {
|
|
16
|
+
/** Reserve the foot's height (a visual AND a footer line) even when a branch shows neither. */
|
|
17
|
+
reserve: boolean;
|
|
18
|
+
/** The visual band is part of the reservation only for the `bleed` placement; `right` keeps its
|
|
19
|
+
* slot beside the breakdown, so a footer there reserves one line, not a band. */
|
|
20
|
+
visualBand: boolean;
|
|
21
|
+
visualNode: ReactNode;
|
|
22
|
+
footerNode: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The visual and its footer line, pinned to the card's bottom. It reserves visual + gap + footer
|
|
26
|
+
* whenever `reserve` is set, so a card with a sparkline and no footer, one with both, and one in a
|
|
27
|
+
* pending or failed branch are the same height (SPEC § 6.1 footprint).
|
|
28
|
+
*/
|
|
29
|
+
export declare function Foot({ reserve, visualBand, visualNode, footerNode }: FootProps): import("react").JSX.Element | null;
|
|
30
|
+
/** The `'right'` slot's size, handed to CSS as custom properties (an inline `flex-basis` would also
|
|
31
|
+
* apply in a narrow card, where the row is a column and the basis becomes the HEIGHT). */
|
|
32
|
+
export declare function rightSlotStyle(width: number, height: number): CSSProperties;
|
|
33
|
+
export declare function ValueSkeleton(): import("react").JSX.Element;
|
|
34
|
+
export declare function VisualSkeleton(): import("react").JSX.Element;
|
|
35
|
+
export declare function FooterSkeleton(): import("react").JSX.Element;
|
|
36
|
+
/** One placeholder row per `breakdown` row, each at the real row's height. */
|
|
37
|
+
export declare function BreakdownSkeleton({ rows }: {
|
|
38
|
+
rows: number;
|
|
39
|
+
}): import("react").JSX.Element;
|
|
40
|
+
//# sourceMappingURL=stat-card-parts.d.ts.map
|
|
@@ -0,0 +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;AAMrD,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,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,eAAe,+BAuBpF;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,gCAE5B;AAED,wBAAgB,cAAc,gCAE7B;AAED,wBAAgB,cAAc,gCAE7B;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,+BAU3D"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton } from "@mantine/core";
|
|
3
|
+
import { IconSlot } from "../theme/icon-slot.js";
|
|
4
|
+
import { CtlSlot } from "../theme/index.js";
|
|
5
|
+
import { InfoGlyph } from "./widget-header.js";
|
|
6
|
+
import classes from "./stat-card.module.css";
|
|
7
|
+
function CaptionRow({ title, icon, info, qualifier, actions }) {
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.captionRow, children: [
|
|
9
|
+
/* @__PURE__ */ jsxs("div", { className: classes.captionMain, children: [
|
|
10
|
+
/* @__PURE__ */ jsxs("div", { className: classes.lead, children: [
|
|
11
|
+
/* @__PURE__ */ jsxs("h3", { className: classes.caption, children: [
|
|
12
|
+
icon !== void 0 && /* @__PURE__ */ jsx(IconSlot, { className: classes.icon, children: icon }),
|
|
13
|
+
/* @__PURE__ */ jsx("span", { className: classes.captionText, children: title })
|
|
14
|
+
] }),
|
|
15
|
+
info !== void 0 && /* @__PURE__ */ jsx(InfoGlyph, { text: info })
|
|
16
|
+
] }),
|
|
17
|
+
qualifier !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.qualifier, children: qualifier })
|
|
18
|
+
] }),
|
|
19
|
+
actions !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.actions, "data-basalt-hit-scope": true, children: /* @__PURE__ */ jsx(CtlSlot, { tier: "widget", children: actions }) })
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
function Foot({ reserve, visualBand, visualNode, footerNode }) {
|
|
23
|
+
if (!reserve) return null;
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.foot, "data-band": visualBand, children: [
|
|
25
|
+
visualNode,
|
|
26
|
+
footerNode
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
function rightSlotStyle(width, height) {
|
|
30
|
+
return {
|
|
31
|
+
"--basalt-stat-sparkline-w": `${width}px`,
|
|
32
|
+
"--basalt-stat-sparkline-h": `${height}px`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function ValueSkeleton() {
|
|
36
|
+
return /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonValue, radius: "sm" });
|
|
37
|
+
}
|
|
38
|
+
function VisualSkeleton() {
|
|
39
|
+
return /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonVisual });
|
|
40
|
+
}
|
|
41
|
+
function FooterSkeleton() {
|
|
42
|
+
return /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonFooter, radius: "sm" });
|
|
43
|
+
}
|
|
44
|
+
function BreakdownSkeleton({ rows }) {
|
|
45
|
+
return /* @__PURE__ */ jsx("div", { className: classes.breakdown, "aria-hidden": "true", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsx("div", { className: classes.skeletonRowBox, children: /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonRow, radius: "sm" }) }, i)) });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
BreakdownSkeleton,
|
|
49
|
+
CaptionRow,
|
|
50
|
+
Foot,
|
|
51
|
+
FooterSkeleton,
|
|
52
|
+
ValueSkeleton,
|
|
53
|
+
VisualSkeleton,
|
|
54
|
+
rightSlotStyle
|
|
55
|
+
};
|
|
@@ -3,9 +3,8 @@ import type { WidgetHeaderDeltaProps, WidgetHeaderMetricProps, WidgetHeaderTitle
|
|
|
3
3
|
import type { BasaltProps, SlotStylesProps, Tone } from '../common/props.js';
|
|
4
4
|
import type { QueryStateLike } from './query-state.js';
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
7
|
-
* `value` is not its own slot: the hero number is painted
|
|
8
|
-
* which does not yet accept a slot class of its own.
|
|
6
|
+
* The boxes `StatCard` paints, and the whole styling seam it offers (`common/props.ts`).
|
|
7
|
+
* `value` is not its own slot: the hero number is painted inside the `header` box.
|
|
9
8
|
*/
|
|
10
9
|
export type StatCardSlot = 'root' | 'header' | 'body' | 'sparkline';
|
|
11
10
|
/**
|
|
@@ -33,17 +32,6 @@ export type StatCardBreakdownRow = {
|
|
|
33
32
|
export type StatCardSparklineSize = {
|
|
34
33
|
width: number;
|
|
35
34
|
height: number;
|
|
36
|
-
/**
|
|
37
|
-
* The card's `query` as a chart state — present only while the sparkline has nothing to draw
|
|
38
|
-
* (pending, or failed with no data), so `<Sparkline {...size} />` forwards it and the tile shows a
|
|
39
|
-
* sized placeholder instead of a hand-rolled `'—'`. Structurally a `ChartState`: this module
|
|
40
|
-
* stays chart-free. Absent without a `query`, and once data has arrived.
|
|
41
|
-
*/
|
|
42
|
-
state?: {
|
|
43
|
-
pending?: boolean;
|
|
44
|
-
error?: unknown;
|
|
45
|
-
empty?: boolean;
|
|
46
|
-
};
|
|
47
35
|
};
|
|
48
36
|
/**
|
|
49
37
|
* `StatCard` re-publishes three NAMED `WidgetHeader` slices (`WidgetHeaderTitleProps` /
|
|
@@ -60,10 +48,32 @@ export type StatCardSparklineSize = {
|
|
|
60
48
|
* `Section` and `ChartCard` still cut their own ad-hoc subsets; both should move onto these same
|
|
61
49
|
* three slices.
|
|
62
50
|
*/
|
|
63
|
-
export type StatCardProps = BasaltProps & SlotStylesProps<StatCardSlot> & WidgetHeaderTitleProps & Omit<WidgetHeaderMetricProps, 'value'> & WidgetHeaderDeltaProps & {
|
|
64
|
-
/** Pre-formatted
|
|
65
|
-
*
|
|
51
|
+
export type StatCardProps = BasaltProps & SlotStylesProps<StatCardSlot> & Omit<WidgetHeaderTitleProps, 'subtitle'> & Omit<WidgetHeaderMetricProps, 'value'> & WidgetHeaderDeltaProps & {
|
|
52
|
+
/** Pre-formatted hero figure (mono `kpi`, weight 500, ink). Required here, unlike on
|
|
53
|
+
* `WidgetHeader`: see the type's own doc. */
|
|
66
54
|
value: string;
|
|
55
|
+
/**
|
|
56
|
+
* Right-aligned on the caption row, `micro` muted: the period, target or source the figure is
|
|
57
|
+
* measured over (`30 days`, `target 99.9%`). Wraps under the caption when the card is too narrow
|
|
58
|
+
* for both. Not a restatement of the caption.
|
|
59
|
+
*/
|
|
60
|
+
qualifier?: string;
|
|
61
|
+
/**
|
|
62
|
+
* One muted `sm` line in the foot, under the visual: a source or "as of"
|
|
63
|
+
* (`Source: events table`, `as of 14:02`), never a restatement of the caption. It was a line
|
|
64
|
+
* under the title before; the old placement has no replacement — put the text in `qualifier`
|
|
65
|
+
* (period/target) or `info` (method).
|
|
66
|
+
*/
|
|
67
|
+
subtitle?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Shows the skeleton at the card's own footprint (caption stays, value bar, visual slot) without
|
|
70
|
+
* a query — for a streamed or suspended value. With a `query` the pending branch shows it by
|
|
71
|
+
* itself. No spinner ever renders inside a card.
|
|
72
|
+
*/
|
|
73
|
+
loading?: boolean;
|
|
74
|
+
/** The one muted line the empty branch shows in place of the figure. Say why it is empty.
|
|
75
|
+
* Default `No data for this period`. */
|
|
76
|
+
emptyText?: string;
|
|
67
77
|
/**
|
|
68
78
|
* The parts the hero number is made of — compact rows under it, one line each, no hairlines.
|
|
69
79
|
*
|
|
@@ -79,15 +89,16 @@ export type StatCardProps = BasaltProps & SlotStylesProps<StatCardSlot> & Widget
|
|
|
79
89
|
*/
|
|
80
90
|
breakdown?: readonly StatCardBreakdownRow[];
|
|
81
91
|
/**
|
|
82
|
-
* The async result behind the number. Supplied, the card
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
92
|
+
* The async result behind the number. Supplied, the card picks its body from it, at the card's
|
|
93
|
+
* own footprint and with the caption row untouched:
|
|
94
|
+
*
|
|
95
|
+
* - pending → the skeleton (caption, value bar, visual slot), never a spinner;
|
|
96
|
+
* - error with no data → `QueryState`'s error at the `'section'` tier: one sentence and Retry;
|
|
97
|
+
* - empty (`[]`, `{ data: [] }`, or idle with no data) → one muted line, {@link emptyText};
|
|
98
|
+
* - data → the figure, with `breakdown` behind `QueryState`. A failed background refetch shows
|
|
99
|
+
* its "cached data" banner over the breakdown only; the figure path adds no banner.
|
|
86
100
|
*
|
|
87
|
-
*
|
|
88
|
-
* exists to delete, and got it wrong in the direction that renders "no data" over a 500. The
|
|
89
|
-
* BRANCH is basalt's; the number is not — `value` is still whatever you formatted, so pass a
|
|
90
|
-
* placeholder (`'—'`) while the query is pending rather than a stale one.
|
|
101
|
+
* The BRANCH is basalt's; the number is not — `value` is still whatever you formatted.
|
|
91
102
|
*
|
|
92
103
|
* @example
|
|
93
104
|
* <StatCard title="Active users" value={q.data ? fmt(q.data.count) : '—'} query={q} />
|
|
@@ -99,22 +110,23 @@ export type StatCardProps = BasaltProps & SlotStylesProps<StatCardSlot> & Widget
|
|
|
99
110
|
* Prefer the render prop for any SVG sparkline: those take numeric `width`/`height`
|
|
100
111
|
* (SVG attributes), so a plain node has to hardcode a width, and a hardcoded width is not
|
|
101
112
|
* full-bleed on any viewport but the one it was typed on. With `sparklinePlacement="bleed"` the
|
|
102
|
-
* measured width is the card's own inner width including the bled inset
|
|
103
|
-
*
|
|
113
|
+
* measured width is the card's own inner width including the bled inset, 22 px tall; with
|
|
114
|
+
* `'right'` it is the 72×22 slot (see {@link SPARKLINE_RIGHT_WIDTH} for why the width is a basis).
|
|
104
115
|
*
|
|
105
116
|
* A render prop is a sanctioned pattern here, so `react/no-unstable-nested-components` is
|
|
106
|
-
* configured with `allowAsProps` in the shipped preset. Spread the size (`{...size}`)
|
|
107
|
-
*
|
|
117
|
+
* configured with `allowAsProps` in the shipped preset. Spread the size (`{...size}`) into the
|
|
118
|
+
* chart.
|
|
108
119
|
*
|
|
109
120
|
* @example
|
|
110
121
|
* sparkline={(size) => <Sparkline ariaLabel="Active users" data={history} {...size} />}
|
|
111
122
|
*/
|
|
112
123
|
sparkline?: ReactNode | ((size: StatCardSparklineSize) => ReactNode);
|
|
113
|
-
/** Where `sparkline` sits. `'bleed'` (default) is
|
|
114
|
-
* `'right'` sits it beside the
|
|
124
|
+
/** Where `sparkline` sits. `'bleed'` (default) is the foot, full card width, bled to the side
|
|
125
|
+
* edges; `'right'` sits it beside the `breakdown` rows. Collapses to `'bleed'` in a card narrower
|
|
126
|
+
* than 480px. */
|
|
115
127
|
sparklinePlacement?: 'bleed' | 'right';
|
|
116
|
-
/**
|
|
117
|
-
* raw `ActionIcon` with no `size` lands on the 24px step the
|
|
128
|
+
/** Caption-row right slot (e.g. a ghost "..." menu trigger) — wrapped in `CtlSlot tier="widget"`,
|
|
129
|
+
* so a raw `ActionIcon` with no `size` lands on the 24px step the caption row holds (C1/C5). */
|
|
118
130
|
actions?: ReactNode;
|
|
119
131
|
/** Threshold verdict — draws an accent rail down the card's leading edge and announces itself to
|
|
120
132
|
* assistive tech. Omitting it is NOT `'good'`: omitted covers a reading that is fine AND one that
|
|
@@ -122,5 +134,5 @@ export type StatCardProps = BasaltProps & SlotStylesProps<StatCardSlot> & Widget
|
|
|
122
134
|
* `'good'` only to assert a measured value that has earned the verdict. */
|
|
123
135
|
tone?: Tone;
|
|
124
136
|
};
|
|
125
|
-
export declare function StatCard({ title, icon,
|
|
137
|
+
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;
|
|
126
138
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"stat-card.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-card.tsx"],"names":[],"mappings":"AA8FA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAUtC,OAA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