basalt-ui 2.21.0 → 2.22.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 +33 -0
- package/MIGRATING.md +277 -12
- package/agent/agents/basalt-design-reviewer.md +1 -1
- package/agent/rules/basalt-tokens.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/skills/basalt-design/references/anti-defaults.md +1 -1
- package/agent/skills/basalt-design/references/catalogue.md +1 -0
- package/dist/charts/BandStrip.d.ts.map +1 -1
- package/dist/charts/BandStrip.js +27 -3
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/Bars.js +5 -0
- package/dist/charts/CartesianChart.d.ts +8 -0
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +8 -5
- package/dist/charts/ChartCard.d.ts +12 -3
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +29 -8
- package/dist/charts/DualPanel.d.ts.map +1 -1
- package/dist/charts/DualPanel.js +5 -8
- package/dist/charts/Heatmap.d.ts +12 -1
- package/dist/charts/Heatmap.d.ts.map +1 -1
- package/dist/charts/Heatmap.js +34 -5
- package/dist/charts/Lines.d.ts +3 -0
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +29 -6
- package/dist/charts/MirroredBars.d.ts.map +1 -1
- package/dist/charts/MirroredBars.js +4 -6
- package/dist/charts/Sparkline.d.ts +7 -1
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +39 -14
- package/dist/charts/StackedArea.d.ts +4 -1
- package/dist/charts/StackedArea.d.ts.map +1 -1
- package/dist/charts/StackedArea.js +9 -3
- package/dist/charts/band-fold.d.ts +20 -1
- package/dist/charts/band-fold.d.ts.map +1 -1
- package/dist/charts/band-fold.js +9 -0
- package/dist/charts/chart-box.module.css +19 -0
- package/dist/charts/chart-card.module.css +25 -0
- package/dist/charts/chart-legend.module.css +7 -0
- package/dist/charts/compile.d.ts +17 -6
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +145 -74
- package/dist/charts/labels.d.ts +15 -4
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +34 -10
- package/dist/charts/legend.d.ts +2 -0
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +7 -21
- package/dist/charts/marks.js +1 -1
- package/dist/charts/panel.d.ts +0 -6
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +1 -10
- package/dist/charts/ref-label.d.ts +26 -0
- package/dist/charts/ref-label.d.ts.map +1 -0
- package/dist/charts/ref-label.js +63 -0
- package/dist/charts/scales.d.ts +4 -1
- package/dist/charts/scales.d.ts.map +1 -1
- package/dist/charts/scales.js +14 -3
- package/dist/charts/sparkline.module.css +10 -11
- package/dist/charts/sparkline.module.css.d.ts +1 -2
- package/dist/charts/state.d.ts +2 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +2 -1
- package/dist/charts/types.d.ts +14 -5
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.d.ts +1 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +1 -0
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +68 -4
- package/dist/cli/shot/capture.d.ts +21 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +194 -32
- package/dist/cli/shot/detect.d.ts.map +1 -1
- package/dist/cli/shot/detect.js +14 -1
- package/dist/cli/shot/playwright.d.ts +5 -2
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/cli/shot/types.d.ts +2 -0
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/shot/types.js +2 -0
- package/dist/controls/controls.module.css +11 -1
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +1 -0
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/controls/sync-button.js +22 -3
- package/dist/controls/sync-button.module.css +34 -2
- package/dist/controls/sync-button.module.css.d.ts +1 -0
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +7 -8
- package/dist/dashboard/bar-list.module.css +53 -0
- package/dist/dashboard/bar-list.module.css.d.ts +1 -0
- package/dist/dashboard/index.d.ts +1 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +2 -0
- package/dist/dashboard/meter-model.d.ts +77 -3
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +88 -15
- package/dist/dashboard/meter-parts.d.ts +8 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +238 -71
- package/dist/dashboard/meter.d.ts +43 -60
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +20 -3
- package/dist/dashboard/meter.module.css +61 -0
- package/dist/dashboard/meter.module.css.d.ts +5 -0
- package/dist/dashboard/page-summary.d.ts +20 -0
- package/dist/dashboard/page-summary.d.ts.map +1 -0
- package/dist/dashboard/page-summary.js +28 -0
- package/dist/dashboard/page-summary.module.css +89 -0
- package/dist/dashboard/page-summary.module.css.d.ts +15 -0
- package/dist/dashboard/section.d.ts +25 -2
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +10 -5
- package/dist/dashboard/section.module.css +23 -0
- package/dist/dashboard/section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +1 -1
- package/dist/dashboard/stat-card.d.ts +4 -2
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +7 -5
- package/dist/dashboard/stat-card.module.css +17 -0
- package/dist/dashboard/stat-strip.d.ts +7 -1
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +74 -46
- package/dist/dashboard/stat-strip.module.css +67 -20
- package/dist/dashboard/stat-strip.module.css.d.ts +4 -0
- package/dist/dashboard/visual-slot.d.ts +7 -1
- package/dist/dashboard/visual-slot.d.ts.map +1 -1
- package/dist/dashboard/visual-slot.js +3 -1
- package/dist/guard/vx-names.d.ts.map +1 -1
- package/dist/guard/vx-names.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/styles.css +34 -2
- package/dist/theme/chrome-vars.d.ts +20 -5
- package/dist/theme/chrome-vars.d.ts.map +1 -1
- package/dist/theme/chrome-vars.js +46 -3
- package/dist/theme/controls.module.css +23 -0
- package/dist/theme/controls.module.css.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +8 -20
- package/dist/tokens/core.d.ts +2 -1
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +6 -1
- package/dist/tokens/derive.d.ts +3 -1
- package/dist/tokens/derive.d.ts.map +1 -1
- package/dist/tokens/derive.js +16 -1
- package/dist/tokens/palette.d.ts +4 -0
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +4 -0
- package/dist/tokens/status-text.d.ts.map +1 -1
- package/dist/tokens/status-text.js +3 -1
- package/llms.txt +38 -20
- package/package.json +1 -1
- package/src/charts/BandStrip.tsx +33 -3
- package/src/charts/Bars.tsx +6 -0
- package/src/charts/CartesianChart.tsx +16 -3
- package/src/charts/ChartCard.tsx +34 -6
- package/src/charts/DualPanel.tsx +3 -6
- package/src/charts/Heatmap.tsx +54 -5
- package/src/charts/Lines.tsx +56 -10
- package/src/charts/MirroredBars.tsx +3 -5
- package/src/charts/Sparkline.tsx +50 -13
- package/src/charts/StackedArea.tsx +14 -4
- package/src/charts/band-fold.ts +31 -1
- package/src/charts/chart-box.module.css +19 -0
- package/src/charts/chart-card.module.css +25 -0
- package/src/charts/chart-legend.module.css +7 -0
- package/src/charts/compile.ts +210 -85
- package/src/charts/labels.ts +48 -14
- package/src/charts/legend.tsx +10 -20
- package/src/charts/marks.ts +1 -1
- package/src/charts/panel.tsx +1 -16
- package/src/charts/ref-label.ts +104 -0
- package/src/charts/scales.ts +22 -2
- package/src/charts/sparkline.module.css +10 -11
- package/src/charts/sparkline.module.css.d.ts +1 -2
- package/src/charts/state.tsx +3 -1
- package/src/charts/types.ts +14 -5
- package/src/cli/doctor-upgrade.ts +1 -1
- package/src/cli/init.ts +100 -3
- package/src/cli/shot/capture.ts +251 -32
- package/src/cli/shot/detect.ts +18 -1
- package/src/cli/shot/playwright.ts +2 -2
- package/src/cli/shot/types.ts +3 -0
- package/src/controls/controls.module.css +11 -1
- package/src/controls/filter-pill.tsx +2 -0
- package/src/controls/sync-button.module.css +34 -2
- package/src/controls/sync-button.module.css.d.ts +1 -0
- package/src/controls/sync-button.tsx +40 -4
- package/src/dashboard/bar-list.module.css +53 -0
- package/src/dashboard/bar-list.module.css.d.ts +1 -0
- package/src/dashboard/bar-list.tsx +78 -69
- package/src/dashboard/index.ts +1 -0
- package/src/dashboard/meter-model.ts +186 -20
- package/src/dashboard/meter-parts.tsx +285 -64
- package/src/dashboard/meter.module.css +61 -0
- package/src/dashboard/meter.module.css.d.ts +5 -0
- package/src/dashboard/meter.tsx +60 -10
- package/src/dashboard/page-summary.module.css +89 -0
- package/src/dashboard/page-summary.module.css.d.ts +15 -0
- package/src/dashboard/page-summary.tsx +95 -0
- package/src/dashboard/section.module.css +23 -0
- package/src/dashboard/section.module.css.d.ts +1 -0
- package/src/dashboard/section.tsx +59 -11
- package/src/dashboard/stat-card-parts.tsx +5 -1
- package/src/dashboard/stat-card.module.css +17 -0
- package/src/dashboard/stat-card.tsx +12 -6
- package/src/dashboard/stat-strip.module.css +67 -20
- package/src/dashboard/stat-strip.module.css.d.ts +4 -0
- package/src/dashboard/stat-strip.tsx +118 -72
- package/src/dashboard/visual-slot.ts +12 -3
- package/src/guard/vx-names.ts +2 -0
- package/src/index.ts +2 -0
- package/src/styles.css +34 -2
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +186 -60
- package/src/theme/chrome-vars.ts +77 -8
- package/src/theme/controls.module.css +23 -0
- package/src/theme/controls.module.css.d.ts +1 -0
- package/src/theme/index.ts +12 -25
- package/src/tokens/core.ts +4 -1
- package/src/tokens/derive.ts +32 -3
- package/src/tokens/palette.ts +4 -0
- package/src/tokens/status-text.ts +2 -0
|
@@ -27,17 +27,33 @@
|
|
|
27
27
|
margin: -1px 0 0 -1px;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/* The CELL is the row-high column: it owns the hairlines, so they run the whole row however short
|
|
31
|
+
* the cell inside it ends. It paints nothing else — the one surface stays the Card's. */
|
|
30
32
|
.cell {
|
|
31
33
|
display: grid;
|
|
32
|
-
grid-row: span
|
|
34
|
+
grid-row: span 6;
|
|
33
35
|
grid-template-rows: subgrid;
|
|
34
36
|
min-width: 0;
|
|
35
|
-
|
|
37
|
+
/* The foot inset lives HERE, on the row-high slot (it lands on the last track of every cell
|
|
38
|
+
* alike). A cell that ends early must not carry it: its padding would inflate the shared track
|
|
39
|
+
* it ends in and push the parts below out of line. */
|
|
40
|
+
padding-block-end: var(--vx-space-stack-md);
|
|
36
41
|
box-shadow:
|
|
37
42
|
-1px 0 0 var(--vx-divider),
|
|
38
43
|
0 -1px 0 var(--vx-divider);
|
|
39
44
|
}
|
|
40
45
|
|
|
46
|
+
/* The CONTENT spans the same six tracks (parts align through the subgrid) but is `align-self: start`,
|
|
47
|
+
* so its own box ends at its content instead of at the row's bottom. */
|
|
48
|
+
.content {
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-row: 1 / span var(--basalt-strip-span, 6);
|
|
51
|
+
grid-template-rows: subgrid;
|
|
52
|
+
align-self: start;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
padding: var(--vx-space-stack-md) var(--vx-space-stack-md) 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
41
57
|
/* Forced colors drop box-shadows, so the hairlines come back as CanvasText borders. Every cell takes
|
|
42
58
|
* both, so they stay level with each other; `.clip` still hides the leading ones. */
|
|
43
59
|
@media (forced-colors: active) {
|
|
@@ -47,22 +63,22 @@
|
|
|
47
63
|
}
|
|
48
64
|
}
|
|
49
65
|
|
|
50
|
-
/* Cells align by PART. Every cell
|
|
51
|
-
* rows, footer), so a row of cells shares one caption top and one value baseline, and a void opens
|
|
52
|
-
* only where a sibling's same part is taller. A
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* rides in the visual track
|
|
66
|
+
/* Cells align by PART. Every cell sits on the same six tracks of `.cells` (caption, hero, hero footer,
|
|
67
|
+
* visual, rows, footer), so a row of cells shares one caption top and one value baseline, and a void opens
|
|
68
|
+
* only where a sibling's same part is taller. A cell SPANS only down to its last part
|
|
69
|
+
* (`--basalt-strip-span`), so its own box ends at its content; the slot around it runs the whole
|
|
70
|
+
* row. A part a cell lacks collapses its track (the spacing is a margin on the part, not a gap).
|
|
71
|
+
* A footer rides with what it captions: under a hero alone it takes the hero-footer track right
|
|
72
|
+
* below the hero, under a visual it rides in the visual track (`.visualStack`); only a rows
|
|
57
73
|
* cell's footer uses the shared footer track. A hero-less cell (rows only) starts its rows in the
|
|
58
74
|
* visual track, so the hero track above them is the one void, and only as tall as a sibling's
|
|
59
75
|
* value. */
|
|
60
|
-
.
|
|
76
|
+
.content > * {
|
|
61
77
|
grid-column: 1;
|
|
62
78
|
min-width: 0;
|
|
63
79
|
}
|
|
64
80
|
|
|
65
|
-
.
|
|
81
|
+
.content > :not(.captionLine) {
|
|
66
82
|
margin-block-start: var(--vx-space-stack-sm);
|
|
67
83
|
}
|
|
68
84
|
|
|
@@ -72,22 +88,24 @@
|
|
|
72
88
|
grid-row: 2;
|
|
73
89
|
}
|
|
74
90
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
.
|
|
78
|
-
.cell > .footer {
|
|
91
|
+
/* A hero's footer has its own track right under the hero track, so it hugs the value however tall a
|
|
92
|
+
* sibling's visual is, and a cell without a footer never spans (or reserves) it. */
|
|
93
|
+
.content > .heroFooter {
|
|
79
94
|
grid-row: 3;
|
|
80
95
|
}
|
|
81
96
|
|
|
82
|
-
.
|
|
97
|
+
.content > .visualStack,
|
|
98
|
+
.content > .reason,
|
|
99
|
+
.content > .rows {
|
|
83
100
|
grid-row: 4;
|
|
84
101
|
}
|
|
85
102
|
|
|
86
|
-
.
|
|
103
|
+
.content[data-strip-has-visual] > .rows {
|
|
87
104
|
grid-row: 5;
|
|
88
105
|
}
|
|
89
106
|
|
|
90
|
-
.
|
|
107
|
+
.content > .footer:not(.heroFooter) {
|
|
108
|
+
grid-row: 6;
|
|
91
109
|
align-self: start;
|
|
92
110
|
}
|
|
93
111
|
|
|
@@ -110,6 +128,16 @@
|
|
|
110
128
|
.captionLine {
|
|
111
129
|
grid-row: 1;
|
|
112
130
|
display: flex;
|
|
131
|
+
flex-wrap: nowrap;
|
|
132
|
+
align-items: center;
|
|
133
|
+
column-gap: var(--vx-space-control-gap);
|
|
134
|
+
min-width: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Caption + qualifier wrap among themselves; the `action` beside them never joins the wrap. */
|
|
138
|
+
.captionMain {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex: 1 1 0;
|
|
113
141
|
flex-wrap: wrap;
|
|
114
142
|
align-items: center;
|
|
115
143
|
column-gap: var(--vx-space-control-gap);
|
|
@@ -147,6 +175,14 @@
|
|
|
147
175
|
overflow-wrap: anywhere;
|
|
148
176
|
}
|
|
149
177
|
|
|
178
|
+
/* A control at the end of the caption line: it keeps its size, the caption truncates first. */
|
|
179
|
+
.action {
|
|
180
|
+
display: inline-flex;
|
|
181
|
+
flex: none;
|
|
182
|
+
align-items: center;
|
|
183
|
+
margin-inline-start: auto;
|
|
184
|
+
}
|
|
185
|
+
|
|
150
186
|
.valueRow {
|
|
151
187
|
display: flex;
|
|
152
188
|
flex-wrap: wrap;
|
|
@@ -180,7 +216,7 @@
|
|
|
180
216
|
height: calc(var(--vx-text-kpi) * 1.25);
|
|
181
217
|
}
|
|
182
218
|
|
|
183
|
-
.
|
|
219
|
+
.content[data-stale] {
|
|
184
220
|
/* The package's one dimmed-state value (controls.module.css, panel-row.module.css). */
|
|
185
221
|
opacity: 0.55;
|
|
186
222
|
}
|
|
@@ -201,7 +237,7 @@
|
|
|
201
237
|
/* A Sparkline's hover readout takes this line above its plot (`charts/sparkline.module.css`). The
|
|
202
238
|
* cell's own stack gap already sits above it; the slot reserves the rest, so the chip never covers
|
|
203
239
|
* the value. */
|
|
204
|
-
.
|
|
240
|
+
.content {
|
|
205
241
|
--basalt-spark-readout-h: 1.125rem;
|
|
206
242
|
}
|
|
207
243
|
|
|
@@ -282,6 +318,17 @@
|
|
|
282
318
|
margin-left: -1px;
|
|
283
319
|
}
|
|
284
320
|
|
|
321
|
+
/* A meter's start and end captions read as one phrase (name, then value) however wide the track. */
|
|
322
|
+
.footerCell [data-meter-captions] {
|
|
323
|
+
justify-content: flex-start;
|
|
324
|
+
column-gap: var(--vx-space-stack-md);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.footerCell [data-meter-captions] > * {
|
|
328
|
+
margin-inline-start: 0;
|
|
329
|
+
text-align: start;
|
|
330
|
+
}
|
|
331
|
+
|
|
285
332
|
.footerCell {
|
|
286
333
|
flex: 1 1 14rem;
|
|
287
334
|
min-width: 0;
|
|
@@ -7,11 +7,15 @@ declare const classes: {
|
|
|
7
7
|
readonly clip: string
|
|
8
8
|
readonly cells: string
|
|
9
9
|
readonly cell: string
|
|
10
|
+
readonly content: string
|
|
11
|
+
readonly action: string
|
|
10
12
|
readonly captionLine: string
|
|
13
|
+
readonly captionMain: string
|
|
11
14
|
readonly lead: string
|
|
12
15
|
readonly caption: string
|
|
13
16
|
readonly qualifier: string
|
|
14
17
|
readonly valueRow: string
|
|
18
|
+
readonly heroFooter: string
|
|
15
19
|
readonly value: string
|
|
16
20
|
readonly unit: string
|
|
17
21
|
readonly skeletonValue: string
|
|
@@ -13,8 +13,12 @@
|
|
|
13
13
|
* anatomy compact — status dot, the word `Failed`, the message, the shared Retry. The caption stays.
|
|
14
14
|
* A `visual` is a hero host: a zoned `Meter` in it does not repeat the value at its marker.
|
|
15
15
|
*
|
|
16
|
-
* Alignment: cells of one row align by PART (caption, value, visual, rows, footer share
|
|
17
|
-
* subgrid),
|
|
16
|
+
* Alignment: cells of one row align by PART (caption, value, hero footer, visual, rows, footer share
|
|
17
|
+
* tracks via subgrid), and each cell spans only down to its last part, so its own box ends at its
|
|
18
|
+
* content. A footer rides with what it captions (under the hero: its own track right below it).
|
|
19
|
+
* The dividers belong to a row-high slot around the cell, so they run the whole row and the area
|
|
20
|
+
* under a short cell is the strip's own surface. `action` sits at the end of the caption line (the
|
|
21
|
+
* caption truncates first); a row with `hideValue` prints its label alone.
|
|
18
22
|
*
|
|
19
23
|
* Anchors: each cell is `data-shot="strip-<key>"` and each footer cell
|
|
20
24
|
* `data-shot="strip-footer-<key>"` (derived — a consumer cannot choose another name).
|
|
@@ -34,7 +38,7 @@ import { StatusDot } from '../theme/status-dot'
|
|
|
34
38
|
import { VX } from '../tokens'
|
|
35
39
|
import { InfoGlyph } from './widget-header'
|
|
36
40
|
import classes from './stat-strip.module.css'
|
|
37
|
-
import { VisualSlotContext } from './visual-slot'
|
|
41
|
+
import { HOSTED, VisualSlotContext } from './visual-slot'
|
|
38
42
|
|
|
39
43
|
export type StatStripRow = {
|
|
40
44
|
key: string
|
|
@@ -44,6 +48,8 @@ export type StatStripRow = {
|
|
|
44
48
|
visual?: ReactNode
|
|
45
49
|
/** A `DeltaBadge`. */
|
|
46
50
|
delta?: ReactNode
|
|
51
|
+
/** The reading is already shown (the hero): print the label alone. `value` is ignored. */
|
|
52
|
+
hideValue?: boolean
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
/** What a cell shows instead of its readings. Mirrors `StatCard`'s `query` branches. */
|
|
@@ -66,8 +72,12 @@ type StatStripCellState =
|
|
|
66
72
|
export type StatStripCell = {
|
|
67
73
|
key: string
|
|
68
74
|
caption: string
|
|
69
|
-
/** Muted, on the caption line: `CAPTION · qualifier`.
|
|
75
|
+
/** Muted, on the caption line: `CAPTION · qualifier`. It wraps whole under the caption when it
|
|
76
|
+
* does not fit (by design: no truncation, so no `title`). */
|
|
70
77
|
qualifier?: string
|
|
78
|
+
/** A control at the end of the caption line (a popover trigger). Never wraps the line: the
|
|
79
|
+
* caption truncates first. */
|
|
80
|
+
action?: ReactNode
|
|
71
81
|
/** The definition behind the caption, in the info-glyph tooltip. */
|
|
72
82
|
info?: string
|
|
73
83
|
/** `null` = no reading, printed as `—`. Omit only when `rows` carries the cell. */
|
|
@@ -131,91 +141,127 @@ function CellState({ state }: { state: StatStripCellState }) {
|
|
|
131
141
|
)
|
|
132
142
|
}
|
|
133
143
|
|
|
144
|
+
/** The last of the six shared tracks (caption, hero, hero footer, visual, rows, footer) a cell paints into. */
|
|
145
|
+
function lastTrackOf(cell: StatStripCell, state: StatStripCellState | undefined) {
|
|
146
|
+
if (state !== undefined) return state.kind === 'empty' && state.reason !== undefined ? 4 : 2
|
|
147
|
+
if (cell.rows !== undefined)
|
|
148
|
+
return cell.footer !== undefined ? 6 : cell.visual !== undefined ? 5 : 4
|
|
149
|
+
if (cell.visual !== undefined) return 4
|
|
150
|
+
return cell.footer !== undefined ? 3 : 2
|
|
151
|
+
}
|
|
152
|
+
|
|
134
153
|
function StripCell({ cell }: { cell: StatStripCell }) {
|
|
135
154
|
const captionId = useId()
|
|
136
155
|
const { rows, loading } = cell
|
|
137
156
|
const state = loading ? undefined : cell.state
|
|
138
157
|
const hasHero = cell.value !== undefined || rows === undefined
|
|
139
158
|
// A footer under a visual (and no rows) rides with it, so it hugs that visual instead of dropping
|
|
140
|
-
// to a taller sibling's; under
|
|
159
|
+
// to a taller sibling's; under a hero alone it rides with the value; only under rows does it take
|
|
160
|
+
// the row's shared footer track.
|
|
141
161
|
const ownFooter = cell.visual !== undefined && rows === undefined
|
|
162
|
+
const heroFooter = hasHero && cell.visual === undefined && rows === undefined
|
|
163
|
+
// The cell spans the tracks down to its last part, so its box ends at its content (the slot
|
|
164
|
+
// around it still runs the whole row for the dividers).
|
|
165
|
+
// The cell's verdict colours a plain Meter in its visual too (a hero host only).
|
|
166
|
+
const hostSlot = !hasHero ? null : cell.tone === undefined ? HOSTED : { tone: cell.tone }
|
|
167
|
+
const lastTrack = lastTrackOf(cell, state)
|
|
142
168
|
const footerEl = cell.footer !== undefined && (
|
|
143
|
-
<div className={classes.footer} data-strip-footer>
|
|
169
|
+
<div className={cx(classes.footer, heroFooter && classes.heroFooter)} data-strip-footer>
|
|
144
170
|
{cell.footer}
|
|
145
171
|
</div>
|
|
146
172
|
)
|
|
173
|
+
const heroEl = loading ? (
|
|
174
|
+
<Skeleton className={classes.skeletonValue} radius="sm" />
|
|
175
|
+
) : (
|
|
176
|
+
<div className={classes.valueRow}>
|
|
177
|
+
<span
|
|
178
|
+
className={classes.value}
|
|
179
|
+
data-strip-value
|
|
180
|
+
style={cell.tone !== undefined ? { color: VX.status[cell.tone] } : undefined}
|
|
181
|
+
>
|
|
182
|
+
{cell.value ?? EMPTY}
|
|
183
|
+
</span>
|
|
184
|
+
{cell.value !== undefined && cell.value !== null && cell.unit !== undefined && (
|
|
185
|
+
<span className={classes.unit}>{cell.unit}</span>
|
|
186
|
+
)}
|
|
187
|
+
{cell.delta}
|
|
188
|
+
</div>
|
|
189
|
+
)
|
|
147
190
|
return (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
{
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
<Skeleton className={classes.skeletonValue} radius="sm" />
|
|
174
|
-
) : (
|
|
175
|
-
<div className={classes.valueRow}>
|
|
176
|
-
<span
|
|
177
|
-
className={classes.value}
|
|
178
|
-
data-strip-value
|
|
179
|
-
style={cell.tone !== undefined ? { color: VX.status[cell.tone] } : undefined}
|
|
180
|
-
>
|
|
181
|
-
{cell.value ?? EMPTY}
|
|
191
|
+
// The slot owns the dividers and stretches to the row; the article inside ends at its content.
|
|
192
|
+
<div className={classes.cell} data-strip-slot>
|
|
193
|
+
<article
|
|
194
|
+
className={classes.content}
|
|
195
|
+
style={{ '--basalt-strip-span': lastTrack } as CSSProperties}
|
|
196
|
+
data-strip-cell={cell.key}
|
|
197
|
+
data-shot={`strip-${cell.key}`}
|
|
198
|
+
aria-labelledby={captionId}
|
|
199
|
+
{...(state === undefined && cell.visual !== undefined && { 'data-strip-has-visual': '' })}
|
|
200
|
+
{...(state === undefined && rows !== undefined && { 'data-strip-has-rows': '' })}
|
|
201
|
+
{...(cell.stale && { 'data-stale': 'true' })}
|
|
202
|
+
>
|
|
203
|
+
<div className={classes.captionLine}>
|
|
204
|
+
<div className={classes.captionMain}>
|
|
205
|
+
{/* The caption and its info glyph are one unit: the qualifier wraps whole, never between them. */}
|
|
206
|
+
<span className={classes.lead}>
|
|
207
|
+
<span
|
|
208
|
+
className={classes.caption}
|
|
209
|
+
id={captionId}
|
|
210
|
+
title={cell.caption}
|
|
211
|
+
data-strip-caption
|
|
212
|
+
>
|
|
213
|
+
{cell.caption}
|
|
214
|
+
</span>
|
|
215
|
+
{cell.info !== undefined && <InfoGlyph text={cell.info} />}
|
|
182
216
|
</span>
|
|
183
|
-
{cell.
|
|
184
|
-
<span className={classes.
|
|
217
|
+
{cell.qualifier !== undefined && (
|
|
218
|
+
<span className={classes.qualifier}>{cell.qualifier}</span>
|
|
185
219
|
)}
|
|
186
|
-
{cell.delta}
|
|
187
220
|
</div>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
</div>
|
|
194
|
-
{ownFooter && footerEl}
|
|
221
|
+
{cell.action !== undefined && (
|
|
222
|
+
<span className={classes.action} data-strip-action>
|
|
223
|
+
{cell.action}
|
|
224
|
+
</span>
|
|
225
|
+
)}
|
|
195
226
|
</div>
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
<div className={classes.
|
|
201
|
-
{
|
|
202
|
-
<
|
|
203
|
-
|
|
227
|
+
{state !== undefined && <CellState state={state} />}
|
|
228
|
+
{state === undefined && hasHero && heroEl}
|
|
229
|
+
{state === undefined && heroFooter && footerEl}
|
|
230
|
+
{state === undefined && cell.visual !== undefined && (
|
|
231
|
+
<div className={classes.visualStack}>
|
|
232
|
+
<div className={classes.visual} data-strip-visual>
|
|
233
|
+
<VisualSlotContext.Provider value={hostSlot}>
|
|
234
|
+
{cell.visual}
|
|
235
|
+
</VisualSlotContext.Provider>
|
|
236
|
+
</div>
|
|
237
|
+
{ownFooter && footerEl}
|
|
204
238
|
</div>
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
239
|
+
)}
|
|
240
|
+
{state === undefined &&
|
|
241
|
+
rows !== undefined &&
|
|
242
|
+
(loading ? (
|
|
243
|
+
<div className={classes.rows} aria-hidden="true">
|
|
244
|
+
{rows.map((row) => (
|
|
245
|
+
<Skeleton key={row.key} className={classes.skeletonRow} radius="sm" />
|
|
246
|
+
))}
|
|
247
|
+
</div>
|
|
248
|
+
) : (
|
|
249
|
+
<ul className={classes.rows} data-strip-rows>
|
|
250
|
+
{rows.map((row) => (
|
|
251
|
+
<li key={row.key} className={classes.row} data-strip-row={row.key}>
|
|
252
|
+
<span className={classes.rowLabel}>{row.label}</span>
|
|
253
|
+
<span className={classes.visual}>{row.visual}</span>
|
|
254
|
+
<span className={classes.rowValue}>
|
|
255
|
+
{row.hideValue ? null : (row.value ?? EMPTY)}
|
|
256
|
+
</span>
|
|
257
|
+
<span>{row.delta}</span>
|
|
258
|
+
</li>
|
|
259
|
+
))}
|
|
260
|
+
</ul>
|
|
261
|
+
))}
|
|
262
|
+
{state === undefined && !ownFooter && !heroFooter && footerEl}
|
|
263
|
+
</article>
|
|
264
|
+
</div>
|
|
219
265
|
)
|
|
220
266
|
}
|
|
221
267
|
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Set by a host that already shows the reading as its hero (a `StatCard` sparkline slot, a strip
|
|
3
|
-
* cell's `visual`). A `Meter`
|
|
4
|
-
*
|
|
3
|
+
* cell's `visual`). A `Meter` reads it: a zoned track drops the reading it would draw at the marker
|
|
4
|
+
* (the headline is not printed twice; `reading` overrides), and a plain bar or ring with no `tone` or
|
|
5
|
+
* `color` of its own takes the host's `tone` as its verdict colour. Internal: never exported.
|
|
5
6
|
*/
|
|
6
7
|
import { createContext } from 'react'
|
|
8
|
+
import type { Tone } from '../common/props'
|
|
7
9
|
|
|
8
|
-
export
|
|
10
|
+
export interface VisualSlot {
|
|
11
|
+
readonly tone?: Tone
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** A host with no verdict of its own: one shared object, so a provider never re-renders its readers. */
|
|
15
|
+
export const HOSTED: VisualSlot = {}
|
|
16
|
+
|
|
17
|
+
export const VisualSlotContext = createContext<VisualSlot | null>(null)
|
package/src/guard/vx-names.ts
CHANGED
|
@@ -203,6 +203,8 @@ export const BASALT_VX_NAMES: readonly string[] = [
|
|
|
203
203
|
'--vx-surface-overlay',
|
|
204
204
|
'--vx-surface-panel',
|
|
205
205
|
'--vx-surface-panel-hover',
|
|
206
|
+
'--vx-surface-row-hover',
|
|
207
|
+
'--vx-surface-row-selected',
|
|
206
208
|
'--vx-surface-subtle',
|
|
207
209
|
'--vx-text-display',
|
|
208
210
|
'--vx-text-h1',
|
package/src/index.ts
CHANGED
package/src/styles.css
CHANGED
|
@@ -67,6 +67,32 @@
|
|
|
67
67
|
text-size-adjust: 100%;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/* A slashed zero belongs to data text only. Hubot Sans (the heading face) draws one, and it leaked
|
|
71
|
+
into every title that borrows the face (`2026`, `90 days`). `zero` is OFF by default and nothing
|
|
72
|
+
in the package turns it on, so this is the off state at the root: it inherits into every head-face
|
|
73
|
+
surface whether a heading element, a Mantine title or a CSS-module class that only sets the
|
|
74
|
+
family, and is a no-op on the mono stack. */
|
|
75
|
+
:root {
|
|
76
|
+
font-feature-settings: 'zero' 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Mono data text drops its ligatures: `<>` in a facts line is two characters, not a diamond. Reaches
|
|
80
|
+
the mono stack by element (code, kbd, samp, pre), by contract (`data-numeric`, `data-monospace`),
|
|
81
|
+
by Mantine's `ff="monospace"` inline style, and by the stack's own var in an inline style. Body
|
|
82
|
+
sans keeps its ligatures. A CSS-module class that only sets the mono family is out of reach. */
|
|
83
|
+
code,
|
|
84
|
+
kbd,
|
|
85
|
+
samp,
|
|
86
|
+
pre,
|
|
87
|
+
[data-numeric],
|
|
88
|
+
[data-monospace],
|
|
89
|
+
[style*='font-family-monospace'],
|
|
90
|
+
[style*='basalt-font-mono'],
|
|
91
|
+
.mantine-Code-root,
|
|
92
|
+
.mantine-Kbd-root {
|
|
93
|
+
font-variant-ligatures: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
70
96
|
/* Removes the grey tap-highlight flash on iOS/Android for anything actually tappable. Scoped to
|
|
71
97
|
the interactive roles/tags rather than `*` (argo's own rule): a highlight on non-interactive
|
|
72
98
|
content is not the flash this exists to remove, and `*` would also numb a consumer's own
|
|
@@ -144,6 +170,14 @@
|
|
|
144
170
|
outline-color: var(--vx-accent);
|
|
145
171
|
}
|
|
146
172
|
|
|
173
|
+
/* The chart host is a focusable element Mantine does not own, so no `mantine-focus-*` class reaches
|
|
174
|
+
it and the UA ring paints instead: a white double ring in dark (argo strength strip and
|
|
175
|
+
diagnostics at dark 390). There is no media or pointer branch behind it. */
|
|
176
|
+
.basalt-chart:focus-visible {
|
|
177
|
+
outline: 2px solid var(--vx-accent);
|
|
178
|
+
outline-offset: calc(0.125rem * var(--mantine-scale));
|
|
179
|
+
}
|
|
180
|
+
|
|
147
181
|
/* Hubot Sans is a condensed display face — the spec pins it at 88% font-stretch everywhere it
|
|
148
182
|
lands (headings + the Mantine Title component). Read from the knob declared above rather than
|
|
149
183
|
hardcoded here, so a consumer retunes it in one declaration instead of fighting these bare
|
|
@@ -156,8 +190,6 @@
|
|
|
156
190
|
h6,
|
|
157
191
|
.mantine-Title-root {
|
|
158
192
|
font-stretch: var(--basalt-font-head-stretch, 88%);
|
|
159
|
-
/* Hubot Sans draws a slashed zero by default; a heading numeral is a figure, not code. */
|
|
160
|
-
font-feature-settings: 'zero' 0;
|
|
161
193
|
font-variant-numeric: lining-nums;
|
|
162
194
|
}
|
|
163
195
|
|