basalt-ui 2.23.0 → 2.24.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 +41 -0
- package/MIGRATING.md +225 -12
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/skills/basalt-design/references/catalogue.md +22 -19
- package/agent/skills/basalt-design/references/states.md +39 -0
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/Bars.js +17 -2
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +7 -3
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +32 -6
- package/dist/charts/StackedArea.d.ts.map +1 -1
- package/dist/charts/StackedArea.js +5 -1
- package/dist/charts/chart-legend.module.css +16 -0
- package/dist/charts/compile.d.ts +2 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +47 -3
- package/dist/charts/legend.d.ts +0 -6
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +87 -35
- package/dist/charts/sparkline.module.css +59 -6
- package/dist/charts/sparkline.module.css.d.ts +1 -0
- package/dist/charts/state.js +1 -1
- package/dist/charts/types.d.ts +11 -0
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +19 -23
- package/dist/dashboard/bar-list.module.css +3 -15
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/meter-model.d.ts +30 -1
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +74 -5
- package/dist/dashboard/meter-parts.d.ts +8 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +64 -21
- package/dist/dashboard/meter.d.ts +8 -1
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +14 -3
- package/dist/dashboard/meter.module.css +42 -2
- package/dist/dashboard/meter.module.css.d.ts +4 -0
- package/dist/dashboard/query-state.d.ts +7 -3
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +14 -6
- package/dist/dashboard/section.d.ts +2 -1
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.module.css +12 -0
- package/dist/dashboard/settings-section.d.ts +1 -1
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +3 -3
- package/dist/dashboard/stat-card.module.css +24 -10
- package/dist/dashboard/stat-group.module.css +8 -0
- package/dist/dashboard/stat-strip.d.ts +3 -2
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +83 -73
- package/dist/dashboard/stat-strip.module.css +22 -38
- package/dist/dashboard/stat-strip.module.css.d.ts +1 -0
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +19 -1
- package/dist/dashboard/widget-header.module.css +6 -0
- package/dist/guard/index.d.ts +2 -2
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +1 -12
- package/dist/table/data-table.js +1 -1
- package/dist/theme/controls.module.css +7 -2
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +7 -5
- package/dist/tokens/palette.d.ts +2 -2
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +2 -2
- package/llms.txt +3 -2
- package/package.json +1 -1
- package/src/charts/Bars.tsx +29 -2
- package/src/charts/CartesianChart.tsx +7 -3
- package/src/charts/Sparkline.tsx +66 -21
- package/src/charts/StackedArea.tsx +12 -1
- package/src/charts/chart-legend.module.css +16 -0
- package/src/charts/compile.ts +84 -2
- package/src/charts/legend.tsx +70 -3
- package/src/charts/sparkline.module.css +59 -6
- package/src/charts/sparkline.module.css.d.ts +1 -0
- package/src/charts/state.tsx +1 -1
- package/src/charts/types.ts +9 -0
- package/src/cli/shot/measure.ts +27 -27
- package/src/dashboard/bar-list.module.css +3 -15
- package/src/dashboard/empty-state.tsx +4 -2
- package/src/dashboard/meter-model.ts +124 -7
- package/src/dashboard/meter-parts.tsx +127 -31
- package/src/dashboard/meter.module.css +42 -2
- package/src/dashboard/meter.module.css.d.ts +4 -0
- package/src/dashboard/meter.tsx +22 -3
- package/src/dashboard/query-state.tsx +19 -8
- package/src/dashboard/section.module.css +12 -0
- package/src/dashboard/section.tsx +2 -1
- package/src/dashboard/settings-section.tsx +4 -4
- package/src/dashboard/stat-card.module.css +24 -10
- package/src/dashboard/stat-group.module.css +8 -0
- package/src/dashboard/stat-strip.module.css +22 -38
- package/src/dashboard/stat-strip.module.css.d.ts +1 -0
- package/src/dashboard/stat-strip.tsx +63 -43
- package/src/dashboard/widget-header.module.css +6 -0
- package/src/dashboard/widget-header.tsx +28 -1
- package/src/guard/index.ts +3 -14
- package/src/table/data-table.tsx +1 -1
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +6 -6
- package/src/theme/controls.module.css +7 -2
- package/src/theme/index.ts +7 -5
- package/src/tokens/palette.ts +2 -2
|
@@ -206,6 +206,14 @@
|
|
|
206
206
|
white-space: nowrap;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
/* `text-wrap` sets the same longhand as `white-space: nowrap`: `.caption`'s `balance`, declared below,
|
|
210
|
+
* would win on source order and let a caption placed at its measured width wrap on a sub-pixel
|
|
211
|
+
* difference. One class more outranks it. */
|
|
212
|
+
.captionsAnchored > :is(.caption) {
|
|
213
|
+
white-space: nowrap;
|
|
214
|
+
text-wrap: nowrap;
|
|
215
|
+
}
|
|
216
|
+
|
|
209
217
|
/* Captions never truncate: the row wraps, and a caption wider than the row wraps inside itself. */
|
|
210
218
|
.caption {
|
|
211
219
|
min-width: 0;
|
|
@@ -220,6 +228,19 @@
|
|
|
220
228
|
text-align: end;
|
|
221
229
|
}
|
|
222
230
|
|
|
231
|
+
/* The target figure is one line: it never wraps (the row drops other captions first). A consumer's
|
|
232
|
+
* own end caption is prose and may still wrap. */
|
|
233
|
+
.captionTarget {
|
|
234
|
+
composes: captionEnd;
|
|
235
|
+
flex: none;
|
|
236
|
+
white-space: nowrap;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* A caption the row has no room for: still laid out (so a resize can measure it again), not shown. */
|
|
240
|
+
.captionsAnchored > [data-hidden] {
|
|
241
|
+
visibility: hidden;
|
|
242
|
+
}
|
|
243
|
+
|
|
223
244
|
/* The visually-hidden summary and loading text are still text: they read the caption size, not the
|
|
224
245
|
* body size they would inherit. */
|
|
225
246
|
.root .summary {
|
|
@@ -250,6 +271,12 @@
|
|
|
250
271
|
white-space: nowrap;
|
|
251
272
|
}
|
|
252
273
|
|
|
274
|
+
/* Not every entry fits one row: a grid with the measured column count, never one entry alone. */
|
|
275
|
+
.partCaptionsGrid {
|
|
276
|
+
display: grid;
|
|
277
|
+
justify-content: start;
|
|
278
|
+
}
|
|
279
|
+
|
|
253
280
|
/* Only an entry wider than the whole row may break (measured), so nothing overflows the card. */
|
|
254
281
|
.partCaptionsWrap > .partCaption {
|
|
255
282
|
flex: 0 1 auto;
|
|
@@ -285,7 +312,20 @@
|
|
|
285
312
|
color: var(--vx-muted);
|
|
286
313
|
}
|
|
287
314
|
|
|
288
|
-
/*
|
|
315
|
+
/* One caption-height line: a blank caption row (empty) or the home of a skeleton line (loading), so
|
|
316
|
+
* both stand at the loaded Meter's height. */
|
|
317
|
+
.line {
|
|
318
|
+
display: flex;
|
|
319
|
+
align-items: center;
|
|
320
|
+
height: 1lh;
|
|
321
|
+
font-size: var(--basalt-meter-caption);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.lineZoned {
|
|
325
|
+
height: 1.25em;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* The skeleton holds the loaded footprint: figure row (zoned), track, caption / zone-name row. */
|
|
289
329
|
.skeletonTrack {
|
|
290
330
|
height: 0.375rem;
|
|
291
331
|
}
|
|
@@ -370,6 +410,6 @@
|
|
|
370
410
|
height: 1lh;
|
|
371
411
|
}
|
|
372
412
|
|
|
373
|
-
.row .
|
|
413
|
+
.row .line {
|
|
374
414
|
display: none;
|
|
375
415
|
}
|
|
@@ -23,13 +23,17 @@ declare const classes: {
|
|
|
23
23
|
readonly captions: string
|
|
24
24
|
readonly caption: string
|
|
25
25
|
readonly captionEnd: string
|
|
26
|
+
readonly captionTarget: string
|
|
26
27
|
readonly captionsAnchored: string
|
|
27
28
|
readonly partCaptions: string
|
|
28
29
|
readonly partCaption: string
|
|
29
30
|
readonly partCaptionsUnder: string
|
|
30
31
|
readonly partCaptionsWrap: string
|
|
32
|
+
readonly partCaptionsGrid: string
|
|
31
33
|
readonly swatch: string
|
|
32
34
|
readonly empty: string
|
|
35
|
+
readonly line: string
|
|
36
|
+
readonly lineZoned: string
|
|
33
37
|
readonly skeletonTrack: string
|
|
34
38
|
readonly skeletonCaption: string
|
|
35
39
|
readonly ringBox: string
|
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; none by default (the
|
|
75
|
+
/** Muted line shown when there is no reading; none by default (the muted track stands alone, caption rows blank). */
|
|
76
76
|
emptyText?: string
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -122,6 +122,12 @@ type BarCommon = Common & {
|
|
|
122
122
|
* to print it inside a host. A `stops` track prints it only when `true`.
|
|
123
123
|
*/
|
|
124
124
|
reading?: boolean
|
|
125
|
+
/**
|
|
126
|
+
* Where the reading caption sits under a plain or segmented bar. `'fill'` (default): at the end of
|
|
127
|
+
* the fill, clamped inside the track (at the start when the fill is too short to hold it).
|
|
128
|
+
* `'start'`: at the track's start, as before 2.24.
|
|
129
|
+
*/
|
|
130
|
+
readingAt?: 'fill' | 'start'
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
/**
|
|
@@ -192,6 +198,7 @@ export type MeterProps =
|
|
|
192
198
|
startCaption?: never
|
|
193
199
|
endCaption?: never
|
|
194
200
|
reading?: never
|
|
201
|
+
readingAt?: never
|
|
195
202
|
stops?: never
|
|
196
203
|
track?: never
|
|
197
204
|
})
|
|
@@ -221,12 +228,23 @@ export function Meter(props: MeterProps) {
|
|
|
221
228
|
const hostTone = useContext(VisualSlotContext)?.tone
|
|
222
229
|
const hostColor = hostTone === undefined ? undefined : VX.status[hostTone]
|
|
223
230
|
|
|
224
|
-
if (props.loading === true)
|
|
231
|
+
if (props.loading === true)
|
|
232
|
+
return (
|
|
233
|
+
<MeterLoading label={label} ring={ring} zoned={props.zones !== undefined} shell={shell} />
|
|
234
|
+
)
|
|
225
235
|
|
|
226
236
|
const segments = props.segments === undefined ? undefined : normalizeSegments(props.segments)
|
|
227
237
|
const reading = segments === undefined ? props.value : segmentReading(segments, min)
|
|
228
238
|
if (!isReading(reading) || segments?.length === 0) {
|
|
229
|
-
return
|
|
239
|
+
return (
|
|
240
|
+
<MeterEmpty
|
|
241
|
+
label={label}
|
|
242
|
+
text={props.emptyText}
|
|
243
|
+
ring={ring}
|
|
244
|
+
zoned={props.zones !== undefined}
|
|
245
|
+
shell={shell}
|
|
246
|
+
/>
|
|
247
|
+
)
|
|
230
248
|
}
|
|
231
249
|
|
|
232
250
|
if (props.shape === 'ring') {
|
|
@@ -256,6 +274,7 @@ export function Meter(props: MeterProps) {
|
|
|
256
274
|
forecastCaption={props.segments === undefined ? undefined : props.forecastCaption}
|
|
257
275
|
startCaption={props.startCaption}
|
|
258
276
|
endCaption={props.endCaption}
|
|
277
|
+
readingAt={props.readingAt}
|
|
259
278
|
/>
|
|
260
279
|
)
|
|
261
280
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
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 { Center, Group, Loader, Stack, Text } from '@mantine/core'
|
|
17
|
+
import { Center, Group, Loader, Skeleton, Stack, Text, VisuallyHidden } 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'
|
|
@@ -60,11 +60,15 @@ export type QueryEmptyCopy = {
|
|
|
60
60
|
export type LoadingStateProps = BasaltProps & {
|
|
61
61
|
/** How loud this state is. Default `'page'`. */
|
|
62
62
|
tier?: QueryStateTier
|
|
63
|
-
/** Accessible name for the
|
|
63
|
+
/** Accessible name for the loading state. Say what is loading. */
|
|
64
64
|
label?: string
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* `tier="page"` centres a neutral spinner in a generous block (a route body whose shape is unknown);
|
|
69
|
+
* `'section'` is a neutral skeleton, never an accent spinner. A card region that knows its loaded
|
|
70
|
+
* shape passes `loading` to `QueryState` instead.
|
|
71
|
+
*/
|
|
68
72
|
export function LoadingState({
|
|
69
73
|
tier,
|
|
70
74
|
label = 'Loading',
|
|
@@ -74,12 +78,19 @@ export function LoadingState({
|
|
|
74
78
|
const resolved = tier ?? 'page'
|
|
75
79
|
if (resolved === 'section') {
|
|
76
80
|
return (
|
|
77
|
-
<
|
|
78
|
-
|
|
81
|
+
<Stack
|
|
82
|
+
component="output"
|
|
83
|
+
gap="xs"
|
|
79
84
|
aria-label={label}
|
|
85
|
+
aria-busy="true"
|
|
80
86
|
{...(className !== undefined && { className })}
|
|
81
87
|
{...(style !== undefined && { style })}
|
|
82
|
-
|
|
88
|
+
>
|
|
89
|
+
<VisuallyHidden>{label}</VisuallyHidden>
|
|
90
|
+
<Skeleton height={14} width="40%" />
|
|
91
|
+
<Skeleton height={14} />
|
|
92
|
+
<Skeleton height={14} width="75%" />
|
|
93
|
+
</Stack>
|
|
83
94
|
)
|
|
84
95
|
}
|
|
85
96
|
// Same page-level vertical inset `EmptyState`'s `'page'` variant uses (`empty-state.tsx`'s
|
|
@@ -90,7 +101,7 @@ export function LoadingState({
|
|
|
90
101
|
{...(className !== undefined && { className })}
|
|
91
102
|
style={{ paddingBlock: 'calc(var(--vx-space-stack-xs, 0.25rem) * 16)', ...style }}
|
|
92
103
|
>
|
|
93
|
-
<Loader size="sm" aria-label={label} />
|
|
104
|
+
<Loader size="sm" color={VX.muted} aria-label={label} />
|
|
94
105
|
</Center>
|
|
95
106
|
)
|
|
96
107
|
}
|
|
@@ -246,7 +257,7 @@ export type QueryStateProps<TData> = BasaltProps &
|
|
|
246
257
|
errorAction?: ReactNode
|
|
247
258
|
/** How loud every branch is. Default `'page'`. */
|
|
248
259
|
tier?: QueryStateTier
|
|
249
|
-
/** Replace the default
|
|
260
|
+
/** Replace the default loading state (e.g. with a skeleton in the region's loaded shape). */
|
|
250
261
|
loading?: ReactNode
|
|
251
262
|
}
|
|
252
263
|
|
|
@@ -75,6 +75,18 @@
|
|
|
75
75
|
gap: var(--mantine-spacing-xs, 0.625rem);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/*
|
|
79
|
+
* A bare `<Text size="xs">` summary line (argo's strength diagnostics shell: title 15 + chart-card
|
|
80
|
+
* title 13 + summary 12 + chart ticks and legend 11 = four sizes) joins the chart text step, so the
|
|
81
|
+
* shell stays at three: 15, 13, 11. Mantine's `Text` writes `--text-fz` inline from its `size` prop,
|
|
82
|
+
* so no inherited custom property can reach it: this rule sets `font-size` itself, and the inline
|
|
83
|
+
* `--text-fz` is then unused. Only a direct `Text` child is capped; a `Group` of stats keeps
|
|
84
|
+
* the sizes its own parts ask for.
|
|
85
|
+
*/
|
|
86
|
+
.summary > :global(.mantine-Text-root) {
|
|
87
|
+
font-size: var(--vx-text-micro);
|
|
88
|
+
}
|
|
89
|
+
|
|
78
90
|
/*
|
|
79
91
|
* The collapse chevron — a plain control, not a Mantine ActionIcon, so it sits directly in the header
|
|
80
92
|
* row (its own CtlSlot fragment would nest a theme provider around one glyph). It is sized to the
|
|
@@ -137,7 +137,8 @@ type SectionBaseProps = Omit<
|
|
|
137
137
|
defaultOpen?: boolean
|
|
138
138
|
/** Rendered directly under the header and ALWAYS visible, collapsed or not: a collapsed section
|
|
139
139
|
* still states its headline figures, which is what makes collapsing it a real option. Keep it to
|
|
140
|
-
* one row — the body is what `children` is for.
|
|
140
|
+
* one row — the body is what `children` is for. Section owns the summary text size (11 px, the
|
|
141
|
+
* chart-text step): a `size` prop on a bare `Text` here is ignored — wrap it to opt out. */
|
|
141
142
|
summary?: ReactNode
|
|
142
143
|
/** Turns the root into a scroll anchor (`id` + `scroll-margin-top`). Inside `BasaltShell` the
|
|
143
144
|
* offset is the clearance token; without a shell it also clears `PageBar`, which assumes the
|
|
@@ -40,7 +40,7 @@ import classes from './settings-section.module.css'
|
|
|
40
40
|
|
|
41
41
|
const eyebrowStyle = {
|
|
42
42
|
fontFamily: 'var(--basalt-font-mono)',
|
|
43
|
-
fontSize: VX.text.
|
|
43
|
+
fontSize: VX.text.xs,
|
|
44
44
|
fontWeight: 500,
|
|
45
45
|
letterSpacing: '0.06em',
|
|
46
46
|
textTransform: 'uppercase' as const,
|
|
@@ -102,7 +102,7 @@ export type SettingsRowProps = BasaltProps &
|
|
|
102
102
|
SlotStylesProps<SettingsRowSlot> & {
|
|
103
103
|
/** 13px ink label on the left. */
|
|
104
104
|
label: string
|
|
105
|
-
/** Optional
|
|
105
|
+
/** Optional 12px muted description under the label. */
|
|
106
106
|
description?: string
|
|
107
107
|
/** Right-aligned control (input/switch/button). */
|
|
108
108
|
control?: ReactNode
|
|
@@ -125,9 +125,9 @@ export function SettingsRow({
|
|
|
125
125
|
{...(style !== undefined && { style })}
|
|
126
126
|
>
|
|
127
127
|
<Stack gap={2} {...(classNames?.label !== undefined && { className: classNames.label })}>
|
|
128
|
-
<span style={{ fontSize: VX.text.
|
|
128
|
+
<span style={{ fontSize: VX.text.sm, color: VX.ink }}>{label}</span>
|
|
129
129
|
{description && (
|
|
130
|
-
<span style={{ fontSize: VX.text.
|
|
130
|
+
<span style={{ fontSize: VX.text.xs, color: VX.muted }}>{description}</span>
|
|
131
131
|
)}
|
|
132
132
|
</Stack>
|
|
133
133
|
<div className={cx(classes.control, classNames?.control)}>{control ?? children}</div>
|
|
@@ -96,11 +96,11 @@
|
|
|
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): the qualifier
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
99
|
+
/* A card too narrow to share its caption row (a two-column phone cell, ~170px): the qualifier takes its
|
|
100
|
+
* own line under the caption, where it wraps again rather than truncating (a qualifier can be the only place
|
|
101
|
+
* a band is stated). A card without one reserves the line when a StatGroup row-mate has one, so the values of
|
|
102
|
+
* one StatGroup row share a baseline. The caption keeps its line (it truncates, with
|
|
103
|
+
* its `title`, only when it alone does not fit). */
|
|
104
104
|
@container basalt-card (max-width: 239.9px) {
|
|
105
105
|
.captionMain:has(> .qualifier) {
|
|
106
106
|
--basalt-stat-qualifier-reserve: 1;
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
var(--vx-text-micro) * 1.4 * var(--basalt-stat-qualifier-reserve, 0)
|
|
114
114
|
);
|
|
115
115
|
align-content: flex-start;
|
|
116
|
+
justify-content: flex-start;
|
|
116
117
|
min-height: calc(
|
|
117
118
|
var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1) +
|
|
118
119
|
var(--basalt-stat-qualifier-h)
|
|
@@ -123,12 +124,11 @@
|
|
|
123
124
|
min-height: calc(var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1));
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
/* Always its own line: siblings of one group never place it differently (beside, or under). */
|
|
126
128
|
.qualifier {
|
|
127
|
-
flex:
|
|
128
|
-
overflow: hidden;
|
|
129
|
-
text-overflow: ellipsis;
|
|
130
|
-
white-space: nowrap;
|
|
129
|
+
flex-basis: 100%;
|
|
131
130
|
line-height: 1.4;
|
|
131
|
+
text-wrap: balance;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -252,8 +252,14 @@
|
|
|
252
252
|
gap: var(--basalt-stat-foot-gap);
|
|
253
253
|
margin-top: auto;
|
|
254
254
|
min-width: 0;
|
|
255
|
+
/* The sparkline slot's readout reserve (`.sparklineBleed`): the readout line less the card gap above. */
|
|
256
|
+
--basalt-spark-readout-reserve: max(
|
|
257
|
+
0px,
|
|
258
|
+
calc(var(--basalt-spark-readout-h) - var(--vx-space-stat-card-gap))
|
|
259
|
+
);
|
|
255
260
|
min-height: calc(
|
|
256
|
-
var(--basalt-stat-visual-h) + var(--basalt-
|
|
261
|
+
var(--basalt-stat-visual-h) + var(--basalt-spark-readout-reserve) +
|
|
262
|
+
var(--basalt-stat-foot-gap) + var(--basalt-stat-footer-h)
|
|
257
263
|
);
|
|
258
264
|
}
|
|
259
265
|
|
|
@@ -382,6 +388,14 @@
|
|
|
382
388
|
margin-inline: calc(-1 * var(--vx-space-card-inset-x, 1rem));
|
|
383
389
|
}
|
|
384
390
|
|
|
391
|
+
/* A Sparkline's readout line (`--basalt-spark-readout-h`) above its plot: the card gap already sits
|
|
392
|
+
* above the slot, the slot reserves the rest, so the chip never covers the delta or qualifier row.
|
|
393
|
+
* `.foot` reserves the same, so a card with a sparkline and one without keep the same height. */
|
|
394
|
+
.sparklineBleed:has([data-basalt-sparkline]) {
|
|
395
|
+
box-sizing: content-box;
|
|
396
|
+
padding-top: var(--basalt-spark-readout-reserve);
|
|
397
|
+
}
|
|
398
|
+
|
|
385
399
|
/* A Meter in the visual slot is a block, not a chart: it sizes to its content and keeps the card's
|
|
386
400
|
* inline inset instead of the sparkline's fixed 22px and side bleed. */
|
|
387
401
|
.sparklineBleed:has(> [data-basalt-meter]) {
|
|
@@ -63,6 +63,14 @@
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/* An odd count never leaves one cell alone on a half-empty row: below 480px (two columns) the last
|
|
67
|
+
* odd cell spans the row, as the strip's does. */
|
|
68
|
+
@container basalt-grid (max-width: 479.9px) {
|
|
69
|
+
.root > *:last-child:nth-child(odd) {
|
|
70
|
+
grid-column: 1 / -1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
@container basalt-grid (min-width: 800px) {
|
|
67
75
|
.root {
|
|
68
76
|
grid-template-columns: repeat(var(--basalt-stat-group-cols-sm), minmax(0, 1fr));
|
|
@@ -104,12 +104,14 @@
|
|
|
104
104
|
min-height: calc(var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1));
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
/* Caption and qualifier share one line
|
|
107
|
+
/* Caption and qualifier share one line while the qualifier fits; when it does not it wraps whole under the
|
|
108
|
+
* caption and wraps again rather than truncating (it can be the only place a band is stated). */
|
|
108
109
|
.captionMain {
|
|
109
110
|
display: flex;
|
|
110
111
|
flex: 1 1 0;
|
|
111
|
-
flex-wrap:
|
|
112
|
+
flex-wrap: wrap;
|
|
112
113
|
align-items: baseline;
|
|
114
|
+
align-content: flex-start;
|
|
113
115
|
column-gap: var(--vx-space-control-gap);
|
|
114
116
|
min-width: 0;
|
|
115
117
|
}
|
|
@@ -140,28 +142,18 @@
|
|
|
140
142
|
|
|
141
143
|
/* The lowercase qualifier is the muted sans (mono is for the UPPERCASE caption only). */
|
|
142
144
|
.qualifier {
|
|
143
|
-
flex: 0
|
|
145
|
+
flex: 0 1 auto;
|
|
144
146
|
min-width: 0;
|
|
145
|
-
overflow:
|
|
146
|
-
text-
|
|
147
|
-
white-space: nowrap;
|
|
147
|
+
overflow-wrap: anywhere;
|
|
148
|
+
text-wrap: balance;
|
|
148
149
|
font-size: var(--vx-text-micro);
|
|
149
150
|
line-height: 1.4;
|
|
150
151
|
color: var(--vx-muted);
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
/* A narrow cell (~170px at 390):
|
|
154
|
-
*
|
|
154
|
+
/* A narrow cell (~170px at 390): when any cell of the strip has a qualifier every cell reserves one line for
|
|
155
|
+
* it, whether it sat beside the caption or wrapped under it, so values share a baseline. */
|
|
155
156
|
@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
157
|
.qualifier {
|
|
166
158
|
line-height: 1.25;
|
|
167
159
|
}
|
|
@@ -322,35 +314,18 @@
|
|
|
322
314
|
}
|
|
323
315
|
|
|
324
316
|
/* A meter's start and end captions read as one phrase (name, then value) however wide the track. */
|
|
325
|
-
.footerCell [data-meter-captions]
|
|
317
|
+
.footerCell [data-meter-captions],
|
|
318
|
+
.underCell [data-meter-captions] {
|
|
326
319
|
justify-content: flex-start;
|
|
327
320
|
column-gap: var(--vx-space-stack-md);
|
|
328
321
|
}
|
|
329
322
|
|
|
330
|
-
.footerCell [data-meter-captions] >
|
|
323
|
+
.footerCell [data-meter-captions] > *,
|
|
324
|
+
.underCell [data-meter-captions] > * {
|
|
331
325
|
margin-inline-start: 0;
|
|
332
326
|
text-align: start;
|
|
333
327
|
}
|
|
334
328
|
|
|
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
|
-
|
|
354
329
|
.footerCell {
|
|
355
330
|
flex: 1 1 14rem;
|
|
356
331
|
min-width: 0;
|
|
@@ -358,3 +333,12 @@
|
|
|
358
333
|
border-inline-start: 1px solid var(--vx-divider);
|
|
359
334
|
border-block-start: 1px solid var(--vx-divider);
|
|
360
335
|
}
|
|
336
|
+
|
|
337
|
+
/* A footer entry `under` a cell is part of that cell: it sits in the slot under the article, inset like
|
|
338
|
+
* the article, split from the readings by the strip's own hairline. */
|
|
339
|
+
.underCell {
|
|
340
|
+
min-width: 0;
|
|
341
|
+
margin: var(--vx-space-stack-md) var(--vx-space-stack-md) 0;
|
|
342
|
+
padding-block-start: var(--vx-space-stack-sm);
|
|
343
|
+
border-block-start: 1px solid var(--vx-divider);
|
|
344
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* (e.g. VO2max) with `rows` under it; omit `value` to render the rows alone.
|
|
10
10
|
*
|
|
11
11
|
* `state` replaces the readings (hero, visual, rows, footer) with the cell's empty or error body, at
|
|
12
|
-
* the cell's size. Empty:
|
|
12
|
+
* the cell's size. Empty: the reason, muted, in the value's place (`—` only when no reason is given). Error: the shared error
|
|
13
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
|
*
|
|
@@ -24,8 +24,10 @@
|
|
|
24
24
|
*
|
|
25
25
|
* Anchors: each cell is `data-shot="strip-<key>"` and each footer cell
|
|
26
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
|
|
28
|
-
*
|
|
27
|
+
* with `under: '<cell key>'` qualifies that one cell and is PART of it, at every width: it renders in
|
|
28
|
+
* the cell's own slot under its content, so it neither stretches its siblings nor opens a void, and it
|
|
29
|
+
* follows its cell when the strip folds. An entry without `under` (or naming no cell) is full width
|
|
30
|
+
* under the grid.
|
|
29
31
|
*
|
|
30
32
|
* Absence: a page that hides the strip in a declared shot state sets `shotAbsent` on the group
|
|
31
33
|
* (`['empty']`): every derived anchor, cells and footer cells, then carries `data-shot-absent`. A
|
|
@@ -120,8 +122,9 @@ export type StatStripCell = {
|
|
|
120
122
|
export type StatStripFooterEntry = {
|
|
121
123
|
key: string
|
|
122
124
|
content: ReactNode
|
|
123
|
-
/** The `key` of the cell this entry qualifies
|
|
124
|
-
*
|
|
125
|
+
/** The `key` of the cell this entry qualifies: it renders inside that cell, under its content, at
|
|
126
|
+
* every width, as a sibling AFTER the article (outside its `aria-labelledby` region). For a key that
|
|
127
|
+
* names no cell it takes the full width under the grid. */
|
|
125
128
|
under?: string
|
|
126
129
|
}
|
|
127
130
|
|
|
@@ -141,15 +144,20 @@ const EMPTY = '—'
|
|
|
141
144
|
|
|
142
145
|
function CellState({ state }: { state: StatStripCellState }) {
|
|
143
146
|
if (state.kind === 'empty') {
|
|
147
|
+
// A stated reason IS the gap: it takes the value's place, so no bare dash sits above it.
|
|
148
|
+
if (state.reason !== undefined) {
|
|
149
|
+
return (
|
|
150
|
+
<p className={classes.reason} data-strip-reason>
|
|
151
|
+
{state.reason}
|
|
152
|
+
</p>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
144
155
|
return (
|
|
145
|
-
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
</div>
|
|
151
|
-
{state.reason !== undefined && <p className={classes.reason}>{state.reason}</p>}
|
|
152
|
-
</>
|
|
156
|
+
<div className={classes.valueRow}>
|
|
157
|
+
<span className={classes.value} data-strip-value>
|
|
158
|
+
{EMPTY}
|
|
159
|
+
</span>
|
|
160
|
+
</div>
|
|
153
161
|
)
|
|
154
162
|
}
|
|
155
163
|
const message = toErrorMessage(state.error, 'The request failed.')
|
|
@@ -167,12 +175,36 @@ function CellState({ state }: { state: StatStripCellState }) {
|
|
|
167
175
|
)
|
|
168
176
|
}
|
|
169
177
|
|
|
178
|
+
function FooterCell({
|
|
179
|
+
entry,
|
|
180
|
+
shotAbsent,
|
|
181
|
+
under,
|
|
182
|
+
}: {
|
|
183
|
+
entry: StatStripFooterEntry
|
|
184
|
+
shotAbsent: readonly StatStripShotState[] | undefined
|
|
185
|
+
under: boolean
|
|
186
|
+
}) {
|
|
187
|
+
return (
|
|
188
|
+
<div
|
|
189
|
+
className={under ? classes.underCell : classes.footerCell}
|
|
190
|
+
data-strip-footer-cell={entry.key}
|
|
191
|
+
data-shot={`strip-footer-${entry.key}`}
|
|
192
|
+
{...absentAttr(shotAbsent)}
|
|
193
|
+
{...(under && { 'data-under': entry.under })}
|
|
194
|
+
>
|
|
195
|
+
{entry.content}
|
|
196
|
+
</div>
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
170
200
|
function StripCell({
|
|
171
201
|
cell,
|
|
172
202
|
shotAbsent,
|
|
203
|
+
under,
|
|
173
204
|
}: {
|
|
174
205
|
cell: StatStripCell
|
|
175
206
|
shotAbsent: readonly StatStripShotState[] | undefined
|
|
207
|
+
under: readonly StatStripFooterEntry[]
|
|
176
208
|
}) {
|
|
177
209
|
const captionId = useId()
|
|
178
210
|
const { rows, loading } = cell
|
|
@@ -232,9 +264,7 @@ function StripCell({
|
|
|
232
264
|
{cell.info !== undefined && <InfoGlyph text={cell.info} />}
|
|
233
265
|
</span>
|
|
234
266
|
{cell.qualifier !== undefined && (
|
|
235
|
-
<span className={classes.qualifier}
|
|
236
|
-
{cell.qualifier}
|
|
237
|
-
</span>
|
|
267
|
+
<span className={classes.qualifier}>{cell.qualifier}</span>
|
|
238
268
|
)}
|
|
239
269
|
</div>
|
|
240
270
|
{cell.action !== undefined && (
|
|
@@ -274,6 +304,9 @@ function StripCell({
|
|
|
274
304
|
))}
|
|
275
305
|
{state === undefined && footerEl}
|
|
276
306
|
</article>
|
|
307
|
+
{under.map((entry) => (
|
|
308
|
+
<FooterCell key={entry.key} entry={entry} shotAbsent={shotAbsent} under />
|
|
309
|
+
))}
|
|
277
310
|
</div>
|
|
278
311
|
)
|
|
279
312
|
}
|
|
@@ -290,14 +323,11 @@ export function StatStrip({
|
|
|
290
323
|
const desktop = cols ?? Math.min(Math.max(cells.length, 2), 6)
|
|
291
324
|
// `StatGroup`'s rule: four is 2 + 2 below the full count, never 3 + 1.
|
|
292
325
|
const mid = desktop === 4 ? 2 : Math.min(desktop, 3)
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
return at < 0 ? undefined : (at % desktop) + 1
|
|
297
|
-
}
|
|
326
|
+
const keys = new Set(cells.map((cell) => cell.key))
|
|
327
|
+
const underOf = (key: string) => footer?.filter((entry) => entry.under === key) ?? []
|
|
328
|
+
const rest = footer?.filter((entry) => entry.under === undefined || !keys.has(entry.under)) ?? []
|
|
298
329
|
const hasQualifier = cells.some((cell) => cell.qualifier !== undefined)
|
|
299
330
|
const hasAction = cells.some((cell) => cell.action !== undefined)
|
|
300
|
-
const placed = footer?.some((entry) => columnOf(entry.under) !== undefined) ?? false
|
|
301
331
|
return (
|
|
302
332
|
<div className={cx(classes.container, className)} style={style}>
|
|
303
333
|
<Card>
|
|
@@ -316,29 +346,19 @@ export function StatStrip({
|
|
|
316
346
|
>
|
|
317
347
|
<div className={classes.cells}>
|
|
318
348
|
{cells.map((cell) => (
|
|
319
|
-
<StripCell
|
|
349
|
+
<StripCell
|
|
350
|
+
key={cell.key}
|
|
351
|
+
cell={cell}
|
|
352
|
+
shotAbsent={shotAbsent}
|
|
353
|
+
under={underOf(cell.key)}
|
|
354
|
+
/>
|
|
320
355
|
))}
|
|
321
356
|
</div>
|
|
322
|
-
{
|
|
323
|
-
<div className={classes.footerRow}
|
|
324
|
-
{
|
|
325
|
-
|
|
326
|
-
|
|
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
|
-
})}
|
|
357
|
+
{rest.length > 0 && (
|
|
358
|
+
<div className={classes.footerRow}>
|
|
359
|
+
{rest.map((entry) => (
|
|
360
|
+
<FooterCell key={entry.key} entry={entry} shotAbsent={shotAbsent} under={false} />
|
|
361
|
+
))}
|
|
342
362
|
</div>
|
|
343
363
|
)}
|
|
344
364
|
</Card.Section>
|