basalt-ui 2.18.0 → 2.20.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 +90 -0
- package/MIGRATING.md +238 -12
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/rules/basalt-charts.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/skills/basalt-app/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/templates/DESIGN.md.tpl +1 -1
- package/configs/oxlint-plugin.js +33 -19
- package/configs/oxlint-plugin.test.ts +32 -2
- package/dist/charts/ChartCard.d.ts +28 -3
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +33 -11
- package/dist/charts/Donut.d.ts.map +1 -1
- package/dist/charts/Donut.js +13 -1
- package/dist/charts/Heatmap.js +1 -1
- package/dist/charts/Sparkline.d.ts +7 -1
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +137 -18
- package/dist/charts/box.d.ts +2 -0
- package/dist/charts/box.d.ts.map +1 -1
- package/dist/charts/box.js +2 -0
- package/dist/charts/chart-box.module.css +30 -0
- package/dist/charts/chart-box.module.css.d.ts +1 -0
- package/dist/charts/chart-card.module.css +47 -0
- package/dist/charts/chart-card.module.css.d.ts +7 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +35 -8
- package/dist/charts/host.d.ts.map +1 -1
- package/dist/charts/host.js +2 -1
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/sparkline.module.css +59 -0
- package/dist/charts/sparkline.module.css.d.ts +13 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +32 -4
- package/dist/charts/types.d.ts +6 -0
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/commands/notifications/center.d.ts.map +1 -1
- package/dist/commands/notifications/center.js +18 -26
- package/dist/content/callout.d.ts +1 -1
- package/dist/content/callout.d.ts.map +1 -1
- package/dist/content/callout.js +10 -1
- package/dist/content/callout.module.css +15 -3
- package/dist/content/callout.module.css.d.ts +1 -0
- package/dist/controls/sync-button.d.ts +3 -0
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/dashboard/bar-list.d.ts +15 -4
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +56 -19
- package/dist/dashboard/bar-list.module.css +110 -17
- package/dist/dashboard/bar-list.module.css.d.ts +2 -0
- package/dist/dashboard/delta-badge.d.ts +8 -3
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +9 -2
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/meter-model.d.ts +68 -1
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +65 -4
- package/dist/dashboard/meter-parts.d.ts +5 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +234 -60
- package/dist/dashboard/meter.d.ts +38 -6
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +4 -1
- package/dist/dashboard/meter.module.css +209 -13
- package/dist/dashboard/meter.module.css.d.ts +16 -0
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +14 -9
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +14 -25
- package/dist/dashboard/stat-card-parts.d.ts +3 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +18 -3
- package/dist/dashboard/stat-card.d.ts +7 -6
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +51 -83
- package/dist/dashboard/stat-card.module.css +42 -14
- package/dist/dashboard/stat-group.d.ts +11 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +9 -7
- package/dist/dashboard/stat-strip.d.ts +50 -0
- package/dist/dashboard/stat-strip.d.ts.map +1 -0
- package/dist/dashboard/stat-strip.js +85 -0
- package/dist/dashboard/stat-strip.module.css +208 -0
- package/dist/dashboard/stat-strip.module.css.d.ts +28 -0
- package/dist/dashboard/widget-header.d.ts +3 -3
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +2 -1
- package/dist/dashboard/widget-header.module.css +38 -7
- package/dist/format/date.d.ts.map +1 -1
- package/dist/format/date.js +4 -3
- package/dist/format/shared.d.ts +6 -0
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +6 -2
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/styles.css +6 -0
- package/dist/theme/card-inset.module.css +76 -0
- package/dist/theme/card-inset.module.css.d.ts +9 -0
- package/dist/theme/chrome-vars.d.ts +29 -17
- package/dist/theme/chrome-vars.d.ts.map +1 -1
- package/dist/theme/chrome-vars.js +18 -8
- package/dist/theme/controls.module.css +3 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +32 -5
- package/dist/theme/nav-link.module.css +8 -10
- package/dist/theme/status-dot.d.ts +7 -0
- package/dist/theme/status-dot.d.ts.map +1 -0
- package/dist/theme/status-dot.js +18 -0
- package/dist/theme/status-dot.module.css +9 -0
- package/dist/theme/status-dot.module.css.d.ts +8 -0
- package/dist/theme/status-verdict.d.ts +10 -0
- package/dist/theme/status-verdict.d.ts.map +1 -0
- package/dist/theme/status-verdict.js +14 -0
- package/dist/theme/status-verdict.module.css +25 -0
- package/dist/theme/status-verdict.module.css.d.ts +9 -0
- package/llms.txt +30 -6
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +70 -4
- package/src/charts/Donut.tsx +9 -1
- package/src/charts/Heatmap.tsx +1 -1
- package/src/charts/Sparkline.tsx +180 -18
- package/src/charts/box.tsx +2 -0
- package/src/charts/chart-box.module.css +30 -0
- package/src/charts/chart-box.module.css.d.ts +1 -0
- package/src/charts/chart-card.module.css +47 -0
- package/src/charts/chart-card.module.css.d.ts +7 -0
- package/src/charts/compile.ts +42 -9
- package/src/charts/host.tsx +6 -3
- package/src/charts/index.ts +1 -1
- package/src/charts/sparkline.module.css +59 -0
- package/src/charts/sparkline.module.css.d.ts +13 -0
- package/src/charts/state.tsx +44 -4
- package/src/charts/types.ts +6 -0
- package/src/commands/notifications/center.tsx +29 -32
- package/src/content/callout.module.css +15 -3
- package/src/content/callout.module.css.d.ts +1 -0
- package/src/content/callout.tsx +15 -2
- package/src/controls/sync-button.tsx +3 -0
- package/src/dashboard/bar-list.module.css +110 -17
- package/src/dashboard/bar-list.module.css.d.ts +2 -0
- package/src/dashboard/bar-list.tsx +102 -21
- package/src/dashboard/delta-badge.tsx +21 -5
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +132 -4
- package/src/dashboard/meter-parts.tsx +305 -25
- package/src/dashboard/meter.module.css +209 -13
- package/src/dashboard/meter.module.css.d.ts +16 -0
- package/src/dashboard/meter.tsx +42 -7
- package/src/dashboard/query-state.tsx +28 -19
- package/src/dashboard/settings-section.tsx +1 -8
- package/src/dashboard/stat-card-parts.tsx +22 -2
- package/src/dashboard/stat-card.module.css +42 -14
- package/src/dashboard/stat-card.tsx +23 -60
- package/src/dashboard/stat-group.tsx +19 -8
- package/src/dashboard/stat-strip.module.css +208 -0
- package/src/dashboard/stat-strip.module.css.d.ts +28 -0
- package/src/dashboard/stat-strip.tsx +183 -0
- package/src/dashboard/widget-header.module.css +38 -7
- package/src/dashboard/widget-header.tsx +7 -4
- package/src/format/date.ts +6 -3
- package/src/format/shared.ts +11 -2
- package/src/guard/index.ts +1 -1
- package/src/index.ts +7 -0
- package/src/styles.css +6 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +242 -26
- package/src/theme/card-inset.module.css +76 -0
- package/src/theme/card-inset.module.css.d.ts +9 -0
- package/src/theme/chrome-vars.ts +48 -23
- package/src/theme/controls.module.css +3 -0
- package/src/theme/index.ts +40 -6
- package/src/theme/nav-link.module.css +8 -10
- package/src/theme/status-dot.module.css +9 -0
- package/src/theme/status-dot.module.css.d.ts +8 -0
- package/src/theme/status-dot.tsx +31 -0
- package/src/theme/status-verdict.module.css +25 -0
- package/src/theme/status-verdict.module.css.d.ts +9 -0
- package/src/theme/status-verdict.tsx +32 -0
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
gap: var(--vx-space-stack-xs, 0.25rem);
|
|
11
11
|
min-width: 0;
|
|
12
|
+
/* The ONE caption size: every caption below reads it. A host that wants captions at its own text
|
|
13
|
+
* size sets `--basalt-meter-caption: 1em` on the Meter. */
|
|
14
|
+
--basalt-meter-caption: var(--vx-text-micro);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.root.zoned {
|
|
18
|
+
position: relative;
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
.track {
|
|
@@ -31,6 +38,14 @@
|
|
|
31
38
|
background: var(--vx-line);
|
|
32
39
|
}
|
|
33
40
|
|
|
41
|
+
/*
|
|
42
|
+
* A non-verdict reading: --vx-muted at 65%. 35% (argo's alpha) measures 1.7:1 (light) / 2.4:1 (dark)
|
|
43
|
+
* against the track; 65% clears 3:1 in both, and is not the near-white of --vx-line in dark.
|
|
44
|
+
*/
|
|
45
|
+
.fill[data-tone='muted'] {
|
|
46
|
+
background: color-mix(in srgb, var(--vx-muted) 65%, transparent);
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
/* The committed/forecast pair: the same neutral at two strengths. Flat, never hatched. */
|
|
35
50
|
.forecastFill {
|
|
36
51
|
background: color-mix(in srgb, var(--vx-line) 45%, transparent);
|
|
@@ -41,6 +56,89 @@
|
|
|
41
56
|
inset-block: 0;
|
|
42
57
|
}
|
|
43
58
|
|
|
59
|
+
/*
|
|
60
|
+
* Zone names under the band: absolutely placed at each band start so they stay on the band. When
|
|
61
|
+
* they would collide the band collapses (hidden but still laid out, so it can be re-measured) and the
|
|
62
|
+
* same names wrap as a list. The holding zone is ink, the rest muted.
|
|
63
|
+
*/
|
|
64
|
+
.zoneBand {
|
|
65
|
+
position: relative;
|
|
66
|
+
/* Labels are absolutely placed, so the row needs its own line height. */
|
|
67
|
+
height: 1.25em;
|
|
68
|
+
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
69
|
+
font-variant-numeric: lining-nums;
|
|
70
|
+
font-size: var(--basalt-meter-caption);
|
|
71
|
+
color: var(--vx-muted);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Hidden but laid out, so a resize can measure it again. Absolute against `.root.zoned`, which has
|
|
76
|
+
* no inline padding, so `inset-inline: 0` gives the band the same width as when it was in flow.
|
|
77
|
+
*/
|
|
78
|
+
.zoneBand[data-collapsed] {
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 0;
|
|
81
|
+
inset-inline: 0;
|
|
82
|
+
visibility: hidden;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.zoneLabel {
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: 0;
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.zoneLabelHolding {
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
color: var(--vx-ink);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.zoneList {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-wrap: wrap;
|
|
100
|
+
gap: var(--vx-space-stack-xs) var(--vx-space-stack-sm);
|
|
101
|
+
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
102
|
+
font-variant-numeric: lining-nums;
|
|
103
|
+
font-size: var(--basalt-meter-caption);
|
|
104
|
+
color: var(--vx-muted);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.zoneListItem {
|
|
108
|
+
min-width: 0;
|
|
109
|
+
overflow-wrap: anywhere;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* The reading under the band, centred on the marker. Clipped so it never widens the row before the first measure. */
|
|
113
|
+
.zoneReadingRow {
|
|
114
|
+
--basalt-reading-dir: 1;
|
|
115
|
+
position: relative;
|
|
116
|
+
height: 1.25em;
|
|
117
|
+
overflow: clip;
|
|
118
|
+
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
119
|
+
font-variant-numeric: lining-nums;
|
|
120
|
+
font-size: var(--basalt-meter-caption);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.zoneReadingRow:dir(rtl) {
|
|
124
|
+
--basalt-reading-dir: -1;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Before the first measure the start edge sits AT the marker, so the label shifts back half its width
|
|
128
|
+
* along the inline axis (the physical `translate` flips sign in RTL). Measured, the start edge is exact. */
|
|
129
|
+
.zoneReading {
|
|
130
|
+
position: absolute;
|
|
131
|
+
top: 0;
|
|
132
|
+
translate: calc(-50% * var(--basalt-reading-dir)) 0;
|
|
133
|
+
white-space: nowrap;
|
|
134
|
+
font-weight: 500;
|
|
135
|
+
color: var(--vx-ink);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.zoneReading[data-measured] {
|
|
139
|
+
translate: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
44
142
|
/* The reading on a zone track: a notch standing proud of the bands, in ink. */
|
|
45
143
|
.marker {
|
|
46
144
|
position: absolute;
|
|
@@ -48,7 +146,7 @@
|
|
|
48
146
|
bottom: -3px;
|
|
49
147
|
width: 3px;
|
|
50
148
|
margin-inline-start: -1.5px;
|
|
51
|
-
border-radius:
|
|
149
|
+
border-radius: var(--vx-radius-fine);
|
|
52
150
|
background: var(--vx-ink);
|
|
53
151
|
}
|
|
54
152
|
|
|
@@ -58,8 +156,10 @@
|
|
|
58
156
|
bottom: -2px;
|
|
59
157
|
width: 2px;
|
|
60
158
|
margin-inline-start: -1px;
|
|
61
|
-
border-radius:
|
|
159
|
+
border-radius: var(--vx-radius-fine);
|
|
62
160
|
background: var(--vx-ink);
|
|
161
|
+
/* A track-coloured halo keeps an ink tick readable on a fill that is itself near-ink (dark). */
|
|
162
|
+
box-shadow: 0 0 0 1px var(--vx-surface-subtle);
|
|
63
163
|
}
|
|
64
164
|
|
|
65
165
|
.boundaryTick {
|
|
@@ -69,30 +169,70 @@
|
|
|
69
169
|
|
|
70
170
|
.captions {
|
|
71
171
|
display: flex;
|
|
172
|
+
flex-wrap: wrap;
|
|
72
173
|
align-items: baseline;
|
|
73
174
|
justify-content: space-between;
|
|
74
175
|
gap: var(--vx-space-control-gap, 0.375rem);
|
|
75
|
-
font-family: var(--basalt-font-
|
|
76
|
-
font-
|
|
176
|
+
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
177
|
+
font-variant-numeric: lining-nums;
|
|
178
|
+
font-size: var(--basalt-meter-caption);
|
|
179
|
+
text-wrap: balance;
|
|
77
180
|
color: var(--vx-muted);
|
|
78
181
|
}
|
|
79
182
|
|
|
183
|
+
/* Captions never truncate: the row wraps, and a caption wider than the row wraps inside itself. */
|
|
80
184
|
.caption {
|
|
81
|
-
|
|
185
|
+
min-width: 0;
|
|
186
|
+
text-wrap: balance;
|
|
187
|
+
overflow-wrap: anywhere;
|
|
82
188
|
}
|
|
83
189
|
|
|
190
|
+
/* Alone in the row, or wrapped onto its own line, the end caption still sits at the end. */
|
|
84
191
|
.captionEnd {
|
|
85
192
|
composes: caption;
|
|
193
|
+
margin-inline-start: auto;
|
|
86
194
|
text-align: end;
|
|
87
195
|
}
|
|
88
196
|
|
|
89
|
-
/*
|
|
90
|
-
.
|
|
91
|
-
|
|
197
|
+
/* The visually-hidden summary and loading text are still text: they read the caption size, not the
|
|
198
|
+
* body size they would inherit. */
|
|
199
|
+
.root .summary {
|
|
200
|
+
font-size: var(--basalt-meter-caption);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Categorical segments: one caption per part under the track, wrapping at narrow widths. */
|
|
204
|
+
.partCaptions {
|
|
205
|
+
display: flex;
|
|
206
|
+
flex-wrap: wrap;
|
|
207
|
+
gap: var(--vx-space-stack-xs, 0.25rem) var(--vx-space-stack-sm);
|
|
208
|
+
margin: 0;
|
|
209
|
+
padding: 0;
|
|
210
|
+
list-style: none;
|
|
211
|
+
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
212
|
+
font-variant-numeric: lining-nums;
|
|
213
|
+
font-size: var(--basalt-meter-caption);
|
|
214
|
+
text-wrap: balance;
|
|
215
|
+
color: var(--vx-muted);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.partCaption {
|
|
219
|
+
display: inline-flex;
|
|
220
|
+
align-items: baseline;
|
|
221
|
+
gap: var(--vx-space-control-gap, 0.375rem);
|
|
222
|
+
min-width: 0;
|
|
223
|
+
overflow-wrap: anywhere;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* A shape cue beside the name, so the part never reads by colour alone. */
|
|
227
|
+
.swatch {
|
|
228
|
+
flex: none;
|
|
229
|
+
width: 0.5rem;
|
|
230
|
+
height: 0.5rem;
|
|
231
|
+
border-radius: var(--vx-radius-fine);
|
|
92
232
|
}
|
|
93
233
|
|
|
94
234
|
.empty {
|
|
95
|
-
font-size: var(--
|
|
235
|
+
font-size: var(--basalt-meter-caption);
|
|
96
236
|
color: var(--vx-muted);
|
|
97
237
|
}
|
|
98
238
|
|
|
@@ -114,8 +254,13 @@
|
|
|
114
254
|
align-items: center;
|
|
115
255
|
justify-content: center;
|
|
116
256
|
align-self: flex-start;
|
|
117
|
-
|
|
118
|
-
|
|
257
|
+
box-sizing: border-box;
|
|
258
|
+
/* 80px, growing (still square) when the value is wider than the ring's inner circle. */
|
|
259
|
+
min-width: 5rem;
|
|
260
|
+
width: max-content;
|
|
261
|
+
aspect-ratio: 1;
|
|
262
|
+
/* 12px at the default step: keeps the value inside the ring's stroke. */
|
|
263
|
+
padding: calc(1.5 * var(--vx-space-stack-sm, 0.5rem));
|
|
119
264
|
}
|
|
120
265
|
|
|
121
266
|
.ring {
|
|
@@ -138,8 +283,9 @@
|
|
|
138
283
|
|
|
139
284
|
.ringValue {
|
|
140
285
|
position: relative;
|
|
141
|
-
font-family: var(--basalt-font-
|
|
142
|
-
font-
|
|
286
|
+
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
287
|
+
font-variant-numeric: lining-nums;
|
|
288
|
+
font-size: var(--vx-text-kpi);
|
|
143
289
|
font-weight: 500;
|
|
144
290
|
color: var(--vx-ink);
|
|
145
291
|
}
|
|
@@ -148,3 +294,53 @@
|
|
|
148
294
|
width: 5rem;
|
|
149
295
|
height: 5rem;
|
|
150
296
|
}
|
|
297
|
+
|
|
298
|
+
/* ── tick captions ───────────────────────────────────────────────────────────────────────────── */
|
|
299
|
+
|
|
300
|
+
/* Above the track, so they never share a row with the zone names or the captions below it. */
|
|
301
|
+
.tickLabels {
|
|
302
|
+
position: relative;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.tickBand {
|
|
306
|
+
position: relative;
|
|
307
|
+
height: 1.25em;
|
|
308
|
+
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
309
|
+
font-variant-numeric: lining-nums;
|
|
310
|
+
font-size: var(--basalt-meter-caption);
|
|
311
|
+
color: var(--vx-muted);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/* Hidden but laid out, so a resize can measure it again. */
|
|
315
|
+
.tickBand[data-collapsed] {
|
|
316
|
+
position: absolute;
|
|
317
|
+
top: 0;
|
|
318
|
+
inset-inline: 0;
|
|
319
|
+
visibility: hidden;
|
|
320
|
+
pointer-events: none;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.tickLabel {
|
|
324
|
+
position: absolute;
|
|
325
|
+
top: 0;
|
|
326
|
+
white-space: nowrap;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* ── size="row" ──────────────────────────────────────────────────────────────────────────────── */
|
|
330
|
+
|
|
331
|
+
.row {
|
|
332
|
+
gap: 0;
|
|
333
|
+
justify-content: center;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.row .track {
|
|
337
|
+
height: 1lh;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.row .skeletonTrack {
|
|
341
|
+
height: 1lh;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.row .skeletonCaption {
|
|
345
|
+
display: none;
|
|
346
|
+
}
|
|
@@ -4,17 +4,29 @@
|
|
|
4
4
|
*/
|
|
5
5
|
declare const classes: {
|
|
6
6
|
readonly root: string
|
|
7
|
+
readonly summary: string
|
|
8
|
+
readonly zoned: string
|
|
7
9
|
readonly track: string
|
|
8
10
|
readonly trackBox: string
|
|
9
11
|
readonly fill: string
|
|
10
12
|
readonly forecastFill: string
|
|
11
13
|
readonly zone: string
|
|
14
|
+
readonly zoneBand: string
|
|
15
|
+
readonly zoneLabel: string
|
|
16
|
+
readonly zoneLabelHolding: string
|
|
17
|
+
readonly zoneList: string
|
|
18
|
+
readonly zoneListItem: string
|
|
19
|
+
readonly zoneReadingRow: string
|
|
20
|
+
readonly zoneReading: string
|
|
12
21
|
readonly marker: string
|
|
13
22
|
readonly tick: string
|
|
14
23
|
readonly boundaryTick: string
|
|
15
24
|
readonly captions: string
|
|
16
25
|
readonly caption: string
|
|
17
26
|
readonly captionEnd: string
|
|
27
|
+
readonly partCaptions: string
|
|
28
|
+
readonly partCaption: string
|
|
29
|
+
readonly swatch: string
|
|
18
30
|
readonly empty: string
|
|
19
31
|
readonly skeletonTrack: string
|
|
20
32
|
readonly skeletonCaption: string
|
|
@@ -24,5 +36,9 @@ declare const classes: {
|
|
|
24
36
|
readonly ringArc: string
|
|
25
37
|
readonly ringValue: string
|
|
26
38
|
readonly skeletonRing: string
|
|
39
|
+
readonly tickLabels: string
|
|
40
|
+
readonly tickBand: string
|
|
41
|
+
readonly tickLabel: string
|
|
42
|
+
readonly row: string
|
|
27
43
|
}
|
|
28
44
|
export default classes
|
package/src/dashboard/meter.tsx
CHANGED
|
@@ -11,15 +11,26 @@
|
|
|
11
11
|
* track end; the caption still states the real value.
|
|
12
12
|
*
|
|
13
13
|
* `zones` (bar only) draws the track as contiguous bands (neutral at stepped strengths unless a zone
|
|
14
|
-
* passes a status colour) and the reading becomes a MARKER on the track, not a fill
|
|
15
|
-
* the
|
|
14
|
+
* passes a status colour) and the reading becomes a MARKER on the track, not a fill. Each zone is
|
|
15
|
+
* named under the band at its start, the one holding the value (`from` inclusive) in ink and a
|
|
16
|
+
* heavier weight; names that would collide wrap as a list instead. The fit is measured in the
|
|
17
|
+
* browser, so server markup shows the band and the list may appear after mount. Use it for a
|
|
18
|
+
* reading judged against ranges.
|
|
19
|
+
*
|
|
20
|
+
* Every state (bar, ring, empty, loading) carries `data-basalt-meter` on its root. That attribute is
|
|
21
|
+
* the contract with `StatCard`: a Meter passed as its `sparkline` visual makes the slot size to content
|
|
22
|
+
* and keep the card's inline inset (both placements) instead of the sparkline's fixed height and bleed.
|
|
23
|
+
*
|
|
24
|
+
* Categorical `segments` (no `forecast` part) are captioned one per part — swatch, name, value — under
|
|
25
|
+
* the track and the default start caption is dropped (an explicit `startCaption` still shows);
|
|
26
|
+
* committed/forecast keeps the reading plus the forecast caption.
|
|
16
27
|
*
|
|
17
28
|
* @example
|
|
18
29
|
* import { Meter } from 'basalt-ui'
|
|
19
30
|
*
|
|
20
31
|
* // Spend against a budget: past the target the end caption states the overage.
|
|
21
32
|
* <Meter label="Monthly spend" value={512} max={600} target={450} color="var(--vx-status-bad)" format={usd} />
|
|
22
|
-
* // Training load as a zone band with a marker:
|
|
33
|
+
* // Training load as a zone band with a marker: the zones are named under the band, "Optimal" in ink.
|
|
23
34
|
* <Meter
|
|
24
35
|
* label="Training load"
|
|
25
36
|
* max={1000}
|
|
@@ -42,7 +53,7 @@
|
|
|
42
53
|
import type { ReactNode } from 'react'
|
|
43
54
|
import type { BasaltProps } from '../common/props'
|
|
44
55
|
import { isReading, normalizeSegments, segmentReading, spanOf } from './meter-model'
|
|
45
|
-
import type { MeterSegment, MeterZone } from './meter-model'
|
|
56
|
+
import type { MeterSegment, MeterTick, MeterZone } from './meter-model'
|
|
46
57
|
import { MeterBar, MeterEmpty, MeterLoading, MeterRing } from './meter-parts'
|
|
47
58
|
import { asText } from './scale'
|
|
48
59
|
|
|
@@ -65,7 +76,25 @@ type BarCommon = Common & {
|
|
|
65
76
|
shape?: 'bar'
|
|
66
77
|
/** Target position; draws a tick and states it in the end caption (with the overage past it). */
|
|
67
78
|
target?: number
|
|
68
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* More marks on the track (cut-offs, a window mean). Each is drawn at `at`; a `label` is captioned
|
|
81
|
+
* above the track, wrapping to a list when two collide. A tick outside `[min, max]` is dropped, not
|
|
82
|
+
* clamped. All are listed in the accessible description. Works with `value`, `zones`, `segments`
|
|
83
|
+
* and `target`.
|
|
84
|
+
*/
|
|
85
|
+
ticks?: readonly MeterTick[]
|
|
86
|
+
/**
|
|
87
|
+
* `'muted'`: a non-verdict fill (a load, not a verdict) in `--vx-muted` at a strength that holds
|
|
88
|
+
* 3:1 against the track in both schemes — the neutral fill is near-white in dark. A `color` wins.
|
|
89
|
+
*/
|
|
90
|
+
tone?: 'muted'
|
|
91
|
+
/**
|
|
92
|
+
* `'row'`: in-line use — a track one text line tall and no caption rows (reading, target, forecast,
|
|
93
|
+
* part, zone and tick captions). The label stays as `aria-label`; the described-by text keeps the
|
|
94
|
+
* rest. Put the value beside it in your own layout.
|
|
95
|
+
*/
|
|
96
|
+
size?: 'row'
|
|
97
|
+
/** Start caption (default: the formatted reading). `null` drops it. */
|
|
69
98
|
startCaption?: ReactNode
|
|
70
99
|
/** End caption (default: `Target <target>`). `null` drops it. */
|
|
71
100
|
endCaption?: ReactNode
|
|
@@ -100,7 +129,7 @@ export type MeterProps =
|
|
|
100
129
|
value?: number | null | undefined
|
|
101
130
|
/**
|
|
102
131
|
* Contiguous bands drawn as the track, positioned from each `from`. The reading becomes a marker
|
|
103
|
-
* and
|
|
132
|
+
* and each band is named under the track, the one that holds it in ink.
|
|
104
133
|
*/
|
|
105
134
|
zones: readonly MeterZone[]
|
|
106
135
|
segments?: never
|
|
@@ -114,6 +143,9 @@ export type MeterProps =
|
|
|
114
143
|
segments?: never
|
|
115
144
|
zones?: never
|
|
116
145
|
target?: never
|
|
146
|
+
ticks?: never
|
|
147
|
+
tone?: never
|
|
148
|
+
size?: never
|
|
117
149
|
startCaption?: never
|
|
118
150
|
endCaption?: never
|
|
119
151
|
})
|
|
@@ -130,7 +162,8 @@ function warnInvalidTrack(min: number, max: number) {
|
|
|
130
162
|
|
|
131
163
|
export function Meter(props: MeterProps) {
|
|
132
164
|
const { label, min = 0, max = 100, format = asText, className, style } = props
|
|
133
|
-
const
|
|
165
|
+
const row = props.size === 'row'
|
|
166
|
+
const shell = { className, style, row }
|
|
134
167
|
const ring = props.shape === 'ring'
|
|
135
168
|
warnInvalidTrack(min, max)
|
|
136
169
|
|
|
@@ -154,6 +187,8 @@ export function Meter(props: MeterProps) {
|
|
|
154
187
|
segments={segments}
|
|
155
188
|
zones={props.zones}
|
|
156
189
|
target={isReading(props.target) ? props.target : undefined}
|
|
190
|
+
ticks={props.ticks}
|
|
191
|
+
tone={props.tone}
|
|
157
192
|
forecastCaption={props.segments === undefined ? undefined : props.forecastCaption}
|
|
158
193
|
startCaption={props.startCaption}
|
|
159
194
|
endCaption={props.endCaption}
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
* the re-derivation this exists to delete. `LoadingState` / `ErrorState` ship alongside as the
|
|
15
15
|
* escape hatch for a page that must place its branches in different DOM positions.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { Button, Center, Group, Loader, Stack, Text } from '@mantine/core'
|
|
18
18
|
import type { CSSProperties, ReactNode } from 'react'
|
|
19
19
|
import { toErrorMessage } from '../common/errors'
|
|
20
20
|
import { cx } from '../common/props'
|
|
21
21
|
import type { BasaltProps, SlotStylesProps } from '../common/props'
|
|
22
|
+
import { VX } from '../tokens'
|
|
23
|
+
import { StatusDot } from '../theme/status-dot'
|
|
22
24
|
import { EmptyState } from './empty-state'
|
|
23
25
|
import { assertQueryStateLike } from '../common/query-state-like'
|
|
24
26
|
import type { QueryStateLike } from '../common/query-state-like'
|
|
@@ -126,28 +128,35 @@ export function ErrorState({
|
|
|
126
128
|
style,
|
|
127
129
|
}: ErrorStateProps): ReactNode {
|
|
128
130
|
const resolved = tier ?? 'page'
|
|
131
|
+
// D28: a status dot + a word + the message + the retry, on the neutral surface — never a
|
|
132
|
+
// red-tinted filled panel (SPEC § 6.12).
|
|
129
133
|
const alert = (
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
title={title}
|
|
134
|
+
<Stack
|
|
135
|
+
gap="xs"
|
|
136
|
+
role="alert"
|
|
134
137
|
{...(resolved === 'section' && className !== undefined && { className })}
|
|
135
138
|
{...(resolved === 'section' && style !== undefined && { style })}
|
|
136
139
|
>
|
|
137
|
-
<
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
140
|
+
<Group gap="xs" wrap="nowrap">
|
|
141
|
+
<StatusDot color={VX.status.bad} />
|
|
142
|
+
<Text size="sm" fw={500}>
|
|
143
|
+
{title}
|
|
144
|
+
</Text>
|
|
145
|
+
</Group>
|
|
146
|
+
<Text size="sm" c="dimmed">
|
|
147
|
+
{toErrorMessage(error, fallback)}
|
|
148
|
+
</Text>
|
|
149
|
+
{(onRetry ?? action) !== undefined && (
|
|
150
|
+
<Group gap="xs">
|
|
151
|
+
{onRetry && (
|
|
152
|
+
<Button size="xs" variant="default" loading={retrying} onClick={onRetry}>
|
|
153
|
+
Retry
|
|
154
|
+
</Button>
|
|
155
|
+
)}
|
|
156
|
+
{action}
|
|
157
|
+
</Group>
|
|
158
|
+
)}
|
|
159
|
+
</Stack>
|
|
151
160
|
)
|
|
152
161
|
if (resolved === 'section') return alert
|
|
153
162
|
return (
|
|
@@ -79,13 +79,7 @@ export function SettingsSection({
|
|
|
79
79
|
classNames,
|
|
80
80
|
}: SettingsSectionProps) {
|
|
81
81
|
return (
|
|
82
|
-
<Card
|
|
83
|
-
className={cx(classNames?.root, className)}
|
|
84
|
-
style={{
|
|
85
|
-
padding: 'var(--vx-space-card-inset-y, 0.75rem) var(--vx-space-card-inset-x, 1rem)',
|
|
86
|
-
...style,
|
|
87
|
-
}}
|
|
88
|
-
>
|
|
82
|
+
<Card className={cx(classNames?.root, className)} style={style}>
|
|
89
83
|
<div className={cx(classes.header, classNames?.header)}>
|
|
90
84
|
<WidgetHeader
|
|
91
85
|
tier="section"
|
|
@@ -158,7 +152,6 @@ export function DangerZone({
|
|
|
158
152
|
<Card
|
|
159
153
|
className={cx(classNames?.root, className)}
|
|
160
154
|
style={{
|
|
161
|
-
padding: 'var(--vx-space-card-inset-y, 0.75rem) var(--vx-space-card-inset-x, 1rem)',
|
|
162
155
|
boxShadow: `${VX.shadowCard}, 0 0 0 1px ${alpha(VX.status.bad, 0.25)}`,
|
|
163
156
|
...style,
|
|
164
157
|
}}
|
|
@@ -7,6 +7,9 @@ import { Skeleton } from '@mantine/core'
|
|
|
7
7
|
import type { CSSProperties, ReactNode } from 'react'
|
|
8
8
|
import { IconSlot } from '../theme/icon-slot'
|
|
9
9
|
import { CtlSlot } from '../theme'
|
|
10
|
+
import { StatusVerdict } from '../theme/status-verdict'
|
|
11
|
+
import { VX } from '../tokens'
|
|
12
|
+
import type { Tone } from '../common/props'
|
|
10
13
|
import { InfoGlyph } from './widget-header'
|
|
11
14
|
import classes from './stat-card.module.css'
|
|
12
15
|
|
|
@@ -15,25 +18,42 @@ export type CaptionRowProps = {
|
|
|
15
18
|
icon?: ReactNode
|
|
16
19
|
info?: string
|
|
17
20
|
qualifier?: string
|
|
21
|
+
tone?: Tone
|
|
18
22
|
actions?: ReactNode
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
/** Visible verdict word, and the full phrase a screen reader hears instead of a bare "Over". */
|
|
26
|
+
const TONE_WORD: Record<Tone, { word: string; phrase: string }> = {
|
|
27
|
+
good: { word: 'OK', phrase: 'Within the good threshold' },
|
|
28
|
+
warn: { word: 'Watch', phrase: 'Past the warning threshold' },
|
|
29
|
+
bad: { word: 'Over', phrase: 'Past the severe threshold' },
|
|
30
|
+
}
|
|
31
|
+
|
|
21
32
|
/**
|
|
22
33
|
* Title, `info` glyph and `qualifier` in one wrapping group, `actions` pinned at the end. When
|
|
23
34
|
* caption + info + qualifier do not fit, the qualifier wraps UNDER the caption instead of truncating
|
|
24
35
|
* either: the container's width decides, never the viewport's.
|
|
25
36
|
*/
|
|
26
|
-
export function CaptionRow({ title, icon, info, qualifier, actions }: CaptionRowProps) {
|
|
37
|
+
export function CaptionRow({ title, icon, info, qualifier, tone, actions }: CaptionRowProps) {
|
|
27
38
|
return (
|
|
28
39
|
<div className={classes.captionRow}>
|
|
29
40
|
<div className={classes.captionMain}>
|
|
30
41
|
<div className={classes.lead}>
|
|
31
42
|
<h3 className={classes.caption}>
|
|
32
43
|
{icon !== undefined && <IconSlot className={classes.icon}>{icon}</IconSlot>}
|
|
33
|
-
<span className={classes.captionText}
|
|
44
|
+
<span className={classes.captionText} title={title} data-widget-title>
|
|
45
|
+
{title}
|
|
46
|
+
</span>
|
|
34
47
|
</h3>
|
|
35
48
|
{/* OUTSIDE the heading on purpose: `info` would otherwise become part of its name. */}
|
|
36
49
|
{info !== undefined && <InfoGlyph text={info} />}
|
|
50
|
+
{tone !== undefined && (
|
|
51
|
+
<StatusVerdict
|
|
52
|
+
color={VX.status[tone]}
|
|
53
|
+
word={TONE_WORD[tone].word}
|
|
54
|
+
phrase={TONE_WORD[tone].phrase}
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
37
57
|
</div>
|
|
38
58
|
{qualifier !== undefined && <span className={classes.qualifier}>{qualifier}</span>}
|
|
39
59
|
</div>
|