basalt-ui 2.22.0 → 2.23.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 +27 -0
- package/MIGRATING.md +187 -12
- package/agent/agents/basalt-design-reviewer.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/dist/charts/BandStrip.d.ts.map +1 -1
- package/dist/charts/BandStrip.js +51 -5
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/Bars.js +2 -1
- package/dist/charts/CartesianChart.d.ts +2 -0
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/ChartCard.d.ts +1 -1
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +25 -15
- package/dist/charts/Sparkline.d.ts +8 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +67 -13
- package/dist/charts/band-fold.d.ts +22 -4
- package/dist/charts/band-fold.d.ts.map +1 -1
- package/dist/charts/band-fold.js +10 -2
- package/dist/charts/chart-dates.d.ts +12 -0
- package/dist/charts/chart-dates.d.ts.map +1 -0
- package/dist/charts/chart-dates.js +16 -0
- package/dist/charts/compile.d.ts +8 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +30 -21
- package/dist/charts/date-tick-format.d.ts +5 -5
- package/dist/charts/date-tick-format.d.ts.map +1 -1
- package/dist/charts/date-tick-format.js +3 -7
- package/dist/charts/labels.d.ts +7 -3
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +28 -17
- package/dist/charts/ref-label.d.ts +17 -0
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +13 -1
- package/dist/charts/sparkline.module.css +8 -11
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +3 -1
- package/dist/charts/types.d.ts +4 -3
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +9 -5
- package/dist/cli/shot/detect.js +8 -5
- package/dist/cli/shot/playwright.d.ts +8 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/cli/shot/playwright.js +5 -1
- package/dist/cli/shot/types.d.ts +2 -0
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/tokens-css.d.ts +5 -7
- package/dist/cli/tokens-css.d.ts.map +1 -1
- package/dist/cli/tokens-css.js +11 -12
- package/dist/dashboard/bar-list.d.ts +6 -1
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +8 -0
- package/dist/dashboard/bar-list.module.css +30 -0
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +2 -2
- package/dist/dashboard/meter-model.d.ts +25 -20
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +24 -12
- package/dist/dashboard/meter-parts.d.ts +1 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +39 -4
- package/dist/dashboard/meter.d.ts +14 -8
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +1 -1
- package/dist/dashboard/meter.module.css +15 -0
- package/dist/dashboard/meter.module.css.d.ts +1 -0
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +1 -1
- package/dist/dashboard/stat-card-parts.js +1 -1
- package/dist/dashboard/stat-card.module.css +25 -6
- package/dist/dashboard/stat-group.module.css +7 -0
- package/dist/dashboard/stat-strip.d.ts +15 -5
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +50 -34
- package/dist/dashboard/stat-strip.module.css +83 -61
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +0 -5
- package/dist/styles.css +18 -11
- package/dist/theme/controls.module.css +14 -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 +10 -7
- package/dist/theme/status-verdict.d.ts.map +1 -1
- package/dist/theme/status-verdict.js +9 -1
- package/dist/tokens/palette.d.ts +7 -10
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +7 -10
- package/llms.txt +6 -4
- package/package.json +1 -1
- package/src/charts/BandStrip.tsx +55 -5
- package/src/charts/Bars.tsx +2 -1
- package/src/charts/CartesianChart.tsx +2 -0
- package/src/charts/ChartCard.tsx +32 -19
- package/src/charts/Sparkline.tsx +92 -19
- package/src/charts/band-fold.ts +25 -6
- package/src/charts/chart-dates.ts +30 -0
- package/src/charts/compile.ts +64 -23
- package/src/charts/date-tick-format.ts +10 -13
- package/src/charts/labels.ts +43 -22
- package/src/charts/ref-label.ts +27 -0
- package/src/charts/sparkline.module.css +8 -11
- package/src/charts/state.tsx +6 -3
- package/src/charts/types.ts +4 -3
- package/src/cli/shot/capture.ts +15 -3
- package/src/cli/shot/detect.ts +9 -9
- package/src/cli/shot/playwright.ts +18 -2
- package/src/cli/shot/types.ts +2 -0
- package/src/cli/tokens-css.ts +18 -20
- package/src/dashboard/bar-list.module.css +30 -0
- package/src/dashboard/bar-list.tsx +29 -0
- package/src/dashboard/delta-badge.tsx +6 -2
- package/src/dashboard/meter-model.ts +58 -41
- package/src/dashboard/meter-parts.tsx +66 -5
- package/src/dashboard/meter.module.css +15 -0
- package/src/dashboard/meter.module.css.d.ts +1 -0
- package/src/dashboard/meter.tsx +15 -11
- package/src/dashboard/query-state.tsx +1 -1
- package/src/dashboard/stat-card-parts.tsx +1 -1
- package/src/dashboard/stat-card.module.css +25 -6
- package/src/dashboard/stat-group.module.css +7 -0
- package/src/dashboard/stat-strip.module.css +83 -61
- package/src/dashboard/stat-strip.tsx +93 -54
- package/src/guard/index.ts +0 -5
- package/src/styles.css +18 -11
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +14 -8
- package/src/theme/controls.module.css +14 -0
- package/src/theme/controls.module.css.d.ts +1 -0
- package/src/theme/index.ts +10 -7
- package/src/theme/status-verdict.tsx +5 -1
- package/src/tokens/palette.ts +7 -10
package/src/dashboard/meter.tsx
CHANGED
|
@@ -72,7 +72,7 @@ type Common = BasaltProps & {
|
|
|
72
72
|
format?: (value: number) => string
|
|
73
73
|
/** Renders a skeleton with the meter's footprint. */
|
|
74
74
|
loading?: boolean
|
|
75
|
-
/** Muted line shown when there is no reading. The track stays so the footprint holds. */
|
|
75
|
+
/** Muted line shown when there is no reading; none by default (the reading is `—`). The track stays so the footprint holds. */
|
|
76
76
|
emptyText?: string
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -82,10 +82,13 @@ type BarCommon = Common & {
|
|
|
82
82
|
target?: number
|
|
83
83
|
/**
|
|
84
84
|
* More marks on the track (cut-offs, a window mean). Each is drawn at `at`; a `label` is captioned
|
|
85
|
-
* above the track, or on a zoned Meter in the zone-name row (the end ticks at the row's ends)
|
|
86
|
-
* caption
|
|
87
|
-
*
|
|
88
|
-
* and `target`.
|
|
85
|
+
* above the track, or on a zoned Meter in the zone-name row (the end ticks at the row's ends); a
|
|
86
|
+
* `caption` sits under the track, centred on the mark and clamped inside it. A label that would
|
|
87
|
+
* collide with another hides. A tick outside `[min, max]` is dropped, not clamped. All are listed
|
|
88
|
+
* in the accessible description. Works with `value`, `zones`, `segments` and `target`.
|
|
89
|
+
*
|
|
90
|
+
* Given `ticks` (or a `target`), a plain or segmented bar also labels where its track starts: the
|
|
91
|
+
* start figure `format(min)`, above the track. `startCaption={null}` drops it.
|
|
89
92
|
*/
|
|
90
93
|
ticks?: readonly MeterTick[]
|
|
91
94
|
/**
|
|
@@ -102,11 +105,14 @@ type BarCommon = Common & {
|
|
|
102
105
|
* Put the value beside it in your own layout.
|
|
103
106
|
*/
|
|
104
107
|
size?: 'row'
|
|
105
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Start caption (default: the formatted reading). `null` drops it, and the start figure that
|
|
110
|
+
* `ticks`/`target` add above the track; zone labels stay.
|
|
111
|
+
*/
|
|
106
112
|
startCaption?: ReactNode
|
|
107
113
|
/**
|
|
108
|
-
* End caption (default: `Target <target
|
|
109
|
-
* when it fits). `null` drops it; zone labels stay.
|
|
114
|
+
* End caption (default: `Target <target>` with the Meter's `format`, drawn at the target's tick
|
|
115
|
+
* rather than the track end when it fits). `null` drops it; zone labels stay.
|
|
110
116
|
*/
|
|
111
117
|
endCaption?: ReactNode
|
|
112
118
|
/**
|
|
@@ -220,9 +226,7 @@ export function Meter(props: MeterProps) {
|
|
|
220
226
|
const segments = props.segments === undefined ? undefined : normalizeSegments(props.segments)
|
|
221
227
|
const reading = segments === undefined ? props.value : segmentReading(segments, min)
|
|
222
228
|
if (!isReading(reading) || segments?.length === 0) {
|
|
223
|
-
return
|
|
224
|
-
<MeterEmpty label={label} text={props.emptyText ?? 'No data'} ring={ring} shell={shell} />
|
|
225
|
-
)
|
|
229
|
+
return <MeterEmpty label={label} text={props.emptyText} ring={ring} shell={shell} />
|
|
226
230
|
}
|
|
227
231
|
|
|
228
232
|
if (props.shape === 'ring') {
|
|
@@ -56,7 +56,7 @@ export function CaptionRow({ title, icon, info, qualifier, tone, actions }: Capt
|
|
|
56
56
|
)}
|
|
57
57
|
</div>
|
|
58
58
|
{qualifier !== undefined && (
|
|
59
|
-
<span className={classes.qualifier} title={qualifier}>
|
|
59
|
+
<span className={classes.qualifier} title={qualifier} data-stat-qualifier>
|
|
60
60
|
{qualifier}
|
|
61
61
|
</span>
|
|
62
62
|
)}
|
|
@@ -96,20 +96,39 @@
|
|
|
96
96
|
min-width: 0;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
/* A card too narrow to share its caption row (a two-column phone cell, ~170px)
|
|
100
|
-
*
|
|
101
|
-
*
|
|
99
|
+
/* A card too narrow to share its caption row (a two-column phone cell, ~170px): the qualifier is ALWAYS
|
|
100
|
+
* on its own line under the caption, and a card with one (or a StatGroup row-mate's) reserves that line, so the values of one StatGroup
|
|
101
|
+
* row share a baseline whether or not a sibling has a qualifier. The caption keeps the whole first
|
|
102
|
+
* line (it truncates, with its `title`, only when it alone does not fit); the qualifier is one line
|
|
103
|
+
* too (it truncates with its `title` only when it alone does not fit THAT line). */
|
|
102
104
|
@container basalt-card (max-width: 239.9px) {
|
|
105
|
+
.captionMain:has(> .qualifier) {
|
|
106
|
+
--basalt-stat-qualifier-reserve: 1;
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
.captionMain {
|
|
104
|
-
|
|
110
|
+
/* 1 when this card has a qualifier or a StatGroup sibling does (`stat-group.module.css`), else 0:
|
|
111
|
+
* a card nobody shares a row with a qualifier to reserves nothing. */
|
|
112
|
+
--basalt-stat-qualifier-h: calc(
|
|
113
|
+
var(--vx-text-micro) * 1.4 * var(--basalt-stat-qualifier-reserve, 0)
|
|
114
|
+
);
|
|
115
|
+
align-content: flex-start;
|
|
116
|
+
min-height: calc(
|
|
117
|
+
var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1) +
|
|
118
|
+
var(--basalt-stat-qualifier-h)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.lead {
|
|
123
|
+
min-height: calc(var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1));
|
|
105
124
|
}
|
|
106
125
|
|
|
107
126
|
.qualifier {
|
|
108
|
-
flex: 0
|
|
127
|
+
flex: 0 0 100%;
|
|
109
128
|
overflow: hidden;
|
|
110
129
|
text-overflow: ellipsis;
|
|
111
130
|
white-space: nowrap;
|
|
112
|
-
|
|
131
|
+
line-height: 1.4;
|
|
113
132
|
}
|
|
114
133
|
}
|
|
115
134
|
|
|
@@ -43,6 +43,13 @@
|
|
|
43
43
|
gap: var(--vx-space-stack-md);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/* A card with a qualifier tells its row-mates to reserve the qualifier line in a narrow card, so the
|
|
47
|
+
* values of one group share a baseline (`stat-card.module.css`). Group-wide, not per row: the row a
|
|
48
|
+
* card lands in depends on the container, which a selector cannot read. */
|
|
49
|
+
.root:has([data-stat-qualifier]) {
|
|
50
|
+
--basalt-stat-qualifier-reserve: 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
46
53
|
/* 260px is StatGroup's own literal (docs/DESIGN-CORE.md § Layout, elevation, shapes), not a container class: one column below it,
|
|
47
54
|
* so every cell leads a row and the rail draws no leading hairline at all. */
|
|
48
55
|
@container basalt-grid (max-width: 259.9px) {
|
|
@@ -28,27 +28,26 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
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.
|
|
31
|
+
* the cell inside it ends. It paints nothing else — the one surface stays the Card's. It is also the
|
|
32
|
+
* size container the caption line answers to (a cell is ~170px at 390, ~250px at 1440). */
|
|
32
33
|
.cell {
|
|
33
34
|
display: grid;
|
|
34
|
-
|
|
35
|
-
grid-template-rows: subgrid;
|
|
35
|
+
align-content: start;
|
|
36
36
|
min-width: 0;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
container-type: inline-size;
|
|
38
|
+
container-name: basalt-card;
|
|
39
|
+
/* The foot inset lives HERE, on the row-high slot, so a cell that ends early keeps the strip's
|
|
40
|
+
* surface under it. */
|
|
40
41
|
padding-block-end: var(--vx-space-stack-md);
|
|
41
42
|
box-shadow:
|
|
42
43
|
-1px 0 0 var(--vx-divider),
|
|
43
44
|
0 -1px 0 var(--vx-divider);
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
/* The CONTENT
|
|
47
|
-
* so its own box ends at its content instead of at the row's bottom. */
|
|
47
|
+
/* The CONTENT is a plain column: its box ends at its content, whatever a sibling holds below. */
|
|
48
48
|
.content {
|
|
49
|
-
display:
|
|
50
|
-
|
|
51
|
-
grid-template-rows: subgrid;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
52
51
|
align-self: start;
|
|
53
52
|
min-width: 0;
|
|
54
53
|
padding: var(--vx-space-stack-md) var(--vx-space-stack-md) 0;
|
|
@@ -63,18 +62,11 @@
|
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
/* Cells align by
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
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
|
|
73
|
-
* cell's footer uses the shared footer track. A hero-less cell (rows only) starts its rows in the
|
|
74
|
-
* visual track, so the hero track above them is the one void, and only as tall as a sibling's
|
|
75
|
-
* value. */
|
|
65
|
+
/* Cells align by CONSTRUCTION, not by shared tracks: the parts above the value have equal height in
|
|
66
|
+
* every cell of a row (one caption line; a reserved qualifier line in a narrow cell when any cell has
|
|
67
|
+
* a qualifier), so a row shares one caption top and one value baseline. Below the value each cell
|
|
68
|
+
* stacks its own parts and ends at its last one. */
|
|
76
69
|
.content > * {
|
|
77
|
-
grid-column: 1;
|
|
78
70
|
min-width: 0;
|
|
79
71
|
}
|
|
80
72
|
|
|
@@ -82,33 +74,6 @@
|
|
|
82
74
|
margin-block-start: var(--vx-space-stack-sm);
|
|
83
75
|
}
|
|
84
76
|
|
|
85
|
-
.valueRow,
|
|
86
|
-
.skeletonValue,
|
|
87
|
-
.error {
|
|
88
|
-
grid-row: 2;
|
|
89
|
-
}
|
|
90
|
-
|
|
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 {
|
|
94
|
-
grid-row: 3;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.content > .visualStack,
|
|
98
|
-
.content > .reason,
|
|
99
|
-
.content > .rows {
|
|
100
|
-
grid-row: 4;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.content[data-strip-has-visual] > .rows {
|
|
104
|
-
grid-row: 5;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.content > .footer:not(.heroFooter) {
|
|
108
|
-
grid-row: 6;
|
|
109
|
-
align-self: start;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
77
|
@container basalt-grid (max-width: 479.9px) {
|
|
113
78
|
.cells {
|
|
114
79
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
@@ -126,20 +91,25 @@
|
|
|
126
91
|
}
|
|
127
92
|
|
|
128
93
|
.captionLine {
|
|
129
|
-
grid-row: 1;
|
|
130
94
|
display: flex;
|
|
131
95
|
flex-wrap: nowrap;
|
|
132
|
-
align-items:
|
|
96
|
+
align-items: flex-start;
|
|
133
97
|
column-gap: var(--vx-space-control-gap);
|
|
134
98
|
min-width: 0;
|
|
135
99
|
}
|
|
136
100
|
|
|
137
|
-
/*
|
|
101
|
+
/* A cell with an action reserves the control's height on every caption line of the strip, so the
|
|
102
|
+
* values stay level whichever cell carries one. */
|
|
103
|
+
[data-strip-action-row] .captionLine {
|
|
104
|
+
min-height: calc(var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Caption and qualifier share one line: the caption keeps its words, the qualifier gives way first. */
|
|
138
108
|
.captionMain {
|
|
139
109
|
display: flex;
|
|
140
110
|
flex: 1 1 0;
|
|
141
|
-
flex-wrap:
|
|
142
|
-
align-items:
|
|
111
|
+
flex-wrap: nowrap;
|
|
112
|
+
align-items: baseline;
|
|
143
113
|
column-gap: var(--vx-space-control-gap);
|
|
144
114
|
min-width: 0;
|
|
145
115
|
}
|
|
@@ -162,17 +132,48 @@
|
|
|
162
132
|
font-family: var(--basalt-font-mono);
|
|
163
133
|
font-size: var(--vx-text-micro);
|
|
164
134
|
font-weight: 500;
|
|
135
|
+
line-height: 1.4;
|
|
165
136
|
letter-spacing: 0.06em;
|
|
166
137
|
text-transform: uppercase;
|
|
167
138
|
color: var(--vx-faint);
|
|
168
139
|
}
|
|
169
140
|
|
|
170
|
-
/* The lowercase qualifier is the muted sans (mono is for the UPPERCASE caption only).
|
|
171
|
-
* item, so when it does not fit beside the caption it wraps WHOLE onto its own line below. */
|
|
141
|
+
/* The lowercase qualifier is the muted sans (mono is for the UPPERCASE caption only). */
|
|
172
142
|
.qualifier {
|
|
143
|
+
flex: 0 100 auto;
|
|
144
|
+
min-width: 0;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
text-overflow: ellipsis;
|
|
147
|
+
white-space: nowrap;
|
|
173
148
|
font-size: var(--vx-text-micro);
|
|
149
|
+
line-height: 1.4;
|
|
174
150
|
color: var(--vx-muted);
|
|
175
|
-
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* A narrow cell (~170px at 390): the qualifier takes its own line under the caption, and when any cell
|
|
154
|
+
* of the strip has a qualifier every cell reserves that line, so values share a baseline. */
|
|
155
|
+
@container basalt-card (max-width: 239.9px) {
|
|
156
|
+
.captionMain {
|
|
157
|
+
flex-wrap: wrap;
|
|
158
|
+
align-content: flex-start;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.qualifier {
|
|
162
|
+
flex: 0 0 100%;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.qualifier {
|
|
166
|
+
line-height: 1.25;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
[data-strip-qualifier] .captionMain {
|
|
170
|
+
min-height: calc(var(--vx-text-micro) * (1.4 + 1.25));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* The two caption lines read as one block: the value follows at the tight step. */
|
|
174
|
+
[data-strip-qualifier] .captionLine + * {
|
|
175
|
+
margin-block-start: var(--vx-space-stack-xs);
|
|
176
|
+
}
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
/* A control at the end of the caption line: it keeps its size, the caption truncates first. */
|
|
@@ -230,10 +231,6 @@
|
|
|
230
231
|
min-width: 0;
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
.visualStack > .footer {
|
|
234
|
-
margin-block-start: var(--vx-space-stack-sm);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
234
|
/* A Sparkline's hover readout takes this line above its plot (`charts/sparkline.module.css`). The
|
|
238
235
|
* cell's own stack gap already sits above it; the slot reserves the rest, so the chip never covers
|
|
239
236
|
* the value. */
|
|
@@ -245,6 +242,12 @@
|
|
|
245
242
|
padding-top: max(0px, calc(var(--basalt-spark-readout-h) - var(--vx-space-stack-sm)));
|
|
246
243
|
}
|
|
247
244
|
|
|
245
|
+
/* The state copy keeps the cell's inset on every side: the article ends at its own last track, so the
|
|
246
|
+
* foot inset (carried by the row-high slot, further down) cannot reach it. */
|
|
247
|
+
.content[data-strip-has-state] {
|
|
248
|
+
padding-block-end: var(--vx-space-stack-md);
|
|
249
|
+
}
|
|
250
|
+
|
|
248
251
|
/* An empty cell's reason and an errored cell's message: one muted `sm` line, wrapping rather than
|
|
249
252
|
* clipping (a 390px two-column cell is ~170px wide). */
|
|
250
253
|
.reason {
|
|
@@ -329,6 +332,25 @@
|
|
|
329
332
|
text-align: start;
|
|
330
333
|
}
|
|
331
334
|
|
|
335
|
+
/* From the full desktop count a footer entry may sit under the cell it qualifies (`under`): the row
|
|
336
|
+
* takes the cells' column grid, an entry with `--basalt-strip-footer-col` sits in that column, and any
|
|
337
|
+
* other takes the full row. Each entry keeps its own leading hairlines (`.footerCell`, below), so a
|
|
338
|
+
* placed entry reads as attached to its column and the columns beside it stay the strip's surface. */
|
|
339
|
+
@container basalt-grid (min-width: 800px) {
|
|
340
|
+
.footerRow[data-placed] {
|
|
341
|
+
display: grid;
|
|
342
|
+
grid-template-columns: repeat(var(--basalt-strip-cols), minmax(0, 1fr));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.footerRow[data-placed] > .footerCell {
|
|
346
|
+
grid-column: 1 / -1;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.footerRow[data-placed] > .footerCell[data-under] {
|
|
350
|
+
grid-column: var(--basalt-strip-footer-col);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
332
354
|
.footerCell {
|
|
333
355
|
flex: 1 1 14rem;
|
|
334
356
|
min-width: 0;
|
|
@@ -10,18 +10,26 @@
|
|
|
10
10
|
*
|
|
11
11
|
* `state` replaces the readings (hero, visual, rows, footer) with the cell's empty or error body, at
|
|
12
12
|
* the cell's size. Empty: `—` in the value position and the reason, muted. Error: the shared error
|
|
13
|
-
* anatomy compact — status dot, the
|
|
13
|
+
* anatomy compact — status dot, the words `Could not load`, 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:
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* Alignment: a cell is a plain column that ends at its content (the slot around it runs the whole
|
|
17
|
+
* row, so the dividers do too). Cells of one row share a caption top and a value baseline BY
|
|
18
|
+
* CONSTRUCTION: the caption line is one line (it truncates with a `title`), and when any cell has a
|
|
19
|
+
* qualifier a narrow cell reserves the qualifier's own line, so the parts above the value have equal
|
|
20
|
+
* height. Below the value nothing is shared: a visual starts right under it, rows follow, and a
|
|
21
|
+
* footer rides with the last part it captions, so a short cell never holds a taller sibling's void.
|
|
22
|
+
* `action` sits at the end of the caption line (the caption truncates first); a row with `hideValue`
|
|
23
|
+
* prints its label alone.
|
|
22
24
|
*
|
|
23
25
|
* Anchors: each cell is `data-shot="strip-<key>"` and each footer cell
|
|
24
|
-
* `data-shot="strip-footer-<key>"` (derived — a consumer cannot choose another name).
|
|
26
|
+
* `data-shot="strip-footer-<key>"` (derived — a consumer cannot choose another name). A footer entry
|
|
27
|
+
* with `under: '<cell key>'` qualifies that one cell: from 800px it sits in the cell's column (an
|
|
28
|
+
* entry without `under` then takes the full row); below, every entry is full width under the grid.
|
|
29
|
+
*
|
|
30
|
+
* Absence: a page that hides the strip in a declared shot state sets `shotAbsent` on the group
|
|
31
|
+
* (`['empty']`): every derived anchor, cells and footer cells, then carries `data-shot-absent`. A
|
|
32
|
+
* cell's own `shotAbsent` replaces the group's for that cell (the exception).
|
|
25
33
|
*
|
|
26
34
|
* Mapping from a prototype: warden's JSX `qualifier` line UNDER the value is `footer`; the cell
|
|
27
35
|
* `qualifier` is the short `· text` on the caption line. Cells are equal-weight: unequal column
|
|
@@ -40,6 +48,12 @@ import { InfoGlyph } from './widget-header'
|
|
|
40
48
|
import classes from './stat-strip.module.css'
|
|
41
49
|
import { HOSTED, VisualSlotContext } from './visual-slot'
|
|
42
50
|
|
|
51
|
+
/** The URL shot states an anchor can declare itself absent in (`data-shot-absent`). */
|
|
52
|
+
type StatStripShotState = 'empty' | 'loading' | 'error'
|
|
53
|
+
|
|
54
|
+
const absentAttr = (states: readonly StatStripShotState[] | undefined) =>
|
|
55
|
+
states === undefined || states.length === 0 ? {} : { 'data-shot-absent': states.join(' ') }
|
|
56
|
+
|
|
43
57
|
export type StatStripRow = {
|
|
44
58
|
key: string
|
|
45
59
|
label: string
|
|
@@ -99,6 +113,16 @@ export type StatStripCell = {
|
|
|
99
113
|
stale?: boolean
|
|
100
114
|
/** Empty or failed: replaces the readings; `loading` wins while pending. */
|
|
101
115
|
state?: StatStripCellState
|
|
116
|
+
/** The shot states this cell's anchor is absent in; replaces the group's `shotAbsent`. */
|
|
117
|
+
shotAbsent?: readonly StatStripShotState[]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type StatStripFooterEntry = {
|
|
121
|
+
key: string
|
|
122
|
+
content: ReactNode
|
|
123
|
+
/** The `key` of the cell this entry qualifies. From the full desktop width (800px) it sits in that
|
|
124
|
+
* cell's column; below it, and for a key that names no cell, it takes the full width under the grid. */
|
|
125
|
+
under?: string
|
|
102
126
|
}
|
|
103
127
|
|
|
104
128
|
export type StatStripProps = BasaltProps & {
|
|
@@ -106,9 +130,11 @@ export type StatStripProps = BasaltProps & {
|
|
|
106
130
|
label: string
|
|
107
131
|
cells: readonly StatStripCell[]
|
|
108
132
|
/** Wider cells under the cells. */
|
|
109
|
-
footer?: readonly
|
|
133
|
+
footer?: readonly StatStripFooterEntry[]
|
|
110
134
|
/** The DESKTOP column count. Default: the cell count, capped at 6. */
|
|
111
135
|
cols?: 2 | 3 | 4 | 5 | 6
|
|
136
|
+
/** The shot states the page hides the whole strip in (`data-shot-absent` on every derived anchor). */
|
|
137
|
+
shotAbsent?: readonly StatStripShotState[]
|
|
112
138
|
}
|
|
113
139
|
|
|
114
140
|
const EMPTY = '—'
|
|
@@ -131,7 +157,7 @@ function CellState({ state }: { state: StatStripCellState }) {
|
|
|
131
157
|
<div className={classes.error} role="alert" data-strip-state="error">
|
|
132
158
|
<span className={classes.errorHead}>
|
|
133
159
|
<StatusDot color={VX.status.bad} />
|
|
134
|
-
|
|
160
|
+
Could not load
|
|
135
161
|
</span>
|
|
136
162
|
<p className={classes.reason}>{message}</p>
|
|
137
163
|
{state.onRetry !== undefined && (
|
|
@@ -141,32 +167,22 @@ function CellState({ state }: { state: StatStripCellState }) {
|
|
|
141
167
|
)
|
|
142
168
|
}
|
|
143
169
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function StripCell({ cell }: { cell: StatStripCell }) {
|
|
170
|
+
function StripCell({
|
|
171
|
+
cell,
|
|
172
|
+
shotAbsent,
|
|
173
|
+
}: {
|
|
174
|
+
cell: StatStripCell
|
|
175
|
+
shotAbsent: readonly StatStripShotState[] | undefined
|
|
176
|
+
}) {
|
|
154
177
|
const captionId = useId()
|
|
155
178
|
const { rows, loading } = cell
|
|
156
179
|
const state = loading ? undefined : cell.state
|
|
157
180
|
const hasHero = cell.value !== undefined || rows === undefined
|
|
158
|
-
// A footer under a visual (and no rows) rides with it, so it hugs that visual instead of dropping
|
|
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.
|
|
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
181
|
// The cell's verdict colours a plain Meter in its visual too (a hero host only).
|
|
166
182
|
const hostSlot = !hasHero ? null : cell.tone === undefined ? HOSTED : { tone: cell.tone }
|
|
167
|
-
|
|
183
|
+
// A footer rides with what it captions: it follows the cell's last part, whatever a sibling holds.
|
|
168
184
|
const footerEl = cell.footer !== undefined && (
|
|
169
|
-
<div className={
|
|
185
|
+
<div className={classes.footer} data-strip-footer>
|
|
170
186
|
{cell.footer}
|
|
171
187
|
</div>
|
|
172
188
|
)
|
|
@@ -188,14 +204,15 @@ function StripCell({ cell }: { cell: StatStripCell }) {
|
|
|
188
204
|
</div>
|
|
189
205
|
)
|
|
190
206
|
return (
|
|
191
|
-
// The slot owns the dividers and
|
|
207
|
+
// The slot owns the dividers and runs the row; the article inside ends at its content.
|
|
192
208
|
<div className={classes.cell} data-strip-slot>
|
|
193
209
|
<article
|
|
194
210
|
className={classes.content}
|
|
195
|
-
style={{ '--basalt-strip-span': lastTrack } as CSSProperties}
|
|
196
211
|
data-strip-cell={cell.key}
|
|
197
212
|
data-shot={`strip-${cell.key}`}
|
|
198
213
|
aria-labelledby={captionId}
|
|
214
|
+
{...absentAttr(cell.shotAbsent ?? shotAbsent)}
|
|
215
|
+
{...(state !== undefined && { 'data-strip-has-state': '' })}
|
|
199
216
|
{...(state === undefined && cell.visual !== undefined && { 'data-strip-has-visual': '' })}
|
|
200
217
|
{...(state === undefined && rows !== undefined && { 'data-strip-has-rows': '' })}
|
|
201
218
|
{...(cell.stale && { 'data-stale': 'true' })}
|
|
@@ -215,7 +232,9 @@ function StripCell({ cell }: { cell: StatStripCell }) {
|
|
|
215
232
|
{cell.info !== undefined && <InfoGlyph text={cell.info} />}
|
|
216
233
|
</span>
|
|
217
234
|
{cell.qualifier !== undefined && (
|
|
218
|
-
<span className={classes.qualifier}
|
|
235
|
+
<span className={classes.qualifier} title={cell.qualifier}>
|
|
236
|
+
{cell.qualifier}
|
|
237
|
+
</span>
|
|
219
238
|
)}
|
|
220
239
|
</div>
|
|
221
240
|
{cell.action !== undefined && (
|
|
@@ -226,15 +245,9 @@ function StripCell({ cell }: { cell: StatStripCell }) {
|
|
|
226
245
|
</div>
|
|
227
246
|
{state !== undefined && <CellState state={state} />}
|
|
228
247
|
{state === undefined && hasHero && heroEl}
|
|
229
|
-
{state === undefined && heroFooter && footerEl}
|
|
230
248
|
{state === undefined && cell.visual !== undefined && (
|
|
231
|
-
<div className={classes.
|
|
232
|
-
<
|
|
233
|
-
<VisualSlotContext.Provider value={hostSlot}>
|
|
234
|
-
{cell.visual}
|
|
235
|
-
</VisualSlotContext.Provider>
|
|
236
|
-
</div>
|
|
237
|
-
{ownFooter && footerEl}
|
|
249
|
+
<div className={classes.visual} data-strip-visual>
|
|
250
|
+
<VisualSlotContext.Provider value={hostSlot}>{cell.visual}</VisualSlotContext.Provider>
|
|
238
251
|
</div>
|
|
239
252
|
)}
|
|
240
253
|
{state === undefined &&
|
|
@@ -259,16 +272,32 @@ function StripCell({ cell }: { cell: StatStripCell }) {
|
|
|
259
272
|
))}
|
|
260
273
|
</ul>
|
|
261
274
|
))}
|
|
262
|
-
{state === undefined &&
|
|
275
|
+
{state === undefined && footerEl}
|
|
263
276
|
</article>
|
|
264
277
|
</div>
|
|
265
278
|
)
|
|
266
279
|
}
|
|
267
280
|
|
|
268
|
-
export function StatStrip({
|
|
281
|
+
export function StatStrip({
|
|
282
|
+
label,
|
|
283
|
+
cells,
|
|
284
|
+
footer,
|
|
285
|
+
cols,
|
|
286
|
+
shotAbsent,
|
|
287
|
+
className,
|
|
288
|
+
style,
|
|
289
|
+
}: StatStripProps) {
|
|
269
290
|
const desktop = cols ?? Math.min(Math.max(cells.length, 2), 6)
|
|
270
291
|
// `StatGroup`'s rule: four is 2 + 2 below the full count, never 3 + 1.
|
|
271
292
|
const mid = desktop === 4 ? 2 : Math.min(desktop, 3)
|
|
293
|
+
// A cell's column at the full count; `undefined` for a key that names no cell.
|
|
294
|
+
const columnOf = (key: string | undefined) => {
|
|
295
|
+
const at = cells.findIndex((cell) => cell.key === key)
|
|
296
|
+
return at < 0 ? undefined : (at % desktop) + 1
|
|
297
|
+
}
|
|
298
|
+
const hasQualifier = cells.some((cell) => cell.qualifier !== undefined)
|
|
299
|
+
const hasAction = cells.some((cell) => cell.action !== undefined)
|
|
300
|
+
const placed = footer?.some((entry) => columnOf(entry.under) !== undefined) ?? false
|
|
272
301
|
return (
|
|
273
302
|
<div className={cx(classes.container, className)} style={style}>
|
|
274
303
|
<Card>
|
|
@@ -276,6 +305,8 @@ export function StatStrip({ label, cells, footer, cols, className, style }: Stat
|
|
|
276
305
|
component="section"
|
|
277
306
|
aria-label={label}
|
|
278
307
|
className={classes.clip}
|
|
308
|
+
{...(hasQualifier && { 'data-strip-qualifier': '' })}
|
|
309
|
+
{...(hasAction && { 'data-strip-action-row': '' })}
|
|
279
310
|
style={
|
|
280
311
|
{
|
|
281
312
|
'--basalt-strip-cols': desktop,
|
|
@@ -285,21 +316,29 @@ export function StatStrip({ label, cells, footer, cols, className, style }: Stat
|
|
|
285
316
|
>
|
|
286
317
|
<div className={classes.cells}>
|
|
287
318
|
{cells.map((cell) => (
|
|
288
|
-
<StripCell key={cell.key} cell={cell} />
|
|
319
|
+
<StripCell key={cell.key} cell={cell} shotAbsent={shotAbsent} />
|
|
289
320
|
))}
|
|
290
321
|
</div>
|
|
291
322
|
{footer !== undefined && footer.length > 0 && (
|
|
292
|
-
<div className={classes.footerRow}>
|
|
293
|
-
{footer.map((entry) =>
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
323
|
+
<div className={classes.footerRow} {...(placed && { 'data-placed': '' })}>
|
|
324
|
+
{footer.map((entry) => {
|
|
325
|
+
const column = columnOf(entry.under)
|
|
326
|
+
return (
|
|
327
|
+
<div
|
|
328
|
+
key={entry.key}
|
|
329
|
+
className={classes.footerCell}
|
|
330
|
+
data-strip-footer-cell={entry.key}
|
|
331
|
+
data-shot={`strip-footer-${entry.key}`}
|
|
332
|
+
{...absentAttr(shotAbsent)}
|
|
333
|
+
{...(column !== undefined && {
|
|
334
|
+
'data-under': entry.under,
|
|
335
|
+
style: { '--basalt-strip-footer-col': column } as CSSProperties,
|
|
336
|
+
})}
|
|
337
|
+
>
|
|
338
|
+
{entry.content}
|
|
339
|
+
</div>
|
|
340
|
+
)
|
|
341
|
+
})}
|
|
303
342
|
</div>
|
|
304
343
|
)}
|
|
305
344
|
</Card.Section>
|
package/src/guard/index.ts
CHANGED
|
@@ -911,11 +911,6 @@ export const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>> = {
|
|
|
911
911
|
promote: '2.24.0',
|
|
912
912
|
why: 'The scale moved to 8/12/16/20/24 and the CSS micro ceiling dropped 10 → 7 in 2.16.0: a literal 8px/10px in CSS is newly a finding.',
|
|
913
913
|
},
|
|
914
|
-
'series-palette': {
|
|
915
|
-
since: '2.21.0',
|
|
916
|
-
promote: '2.23.0',
|
|
917
|
-
why: 'New in 2.21.0: the series file is judged by computed lightness, chroma, colour-blind separation and contrast; a palette that was tuned by eye is newly a finding.',
|
|
918
|
-
},
|
|
919
914
|
}
|
|
920
915
|
|
|
921
916
|
/** A kind's effective severity: consumer override first, then the grace table, then `error`. */
|