basalt-ui 2.25.0 → 2.26.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 +152 -19
- package/configs/oxlint-basalt.json +1 -1
- package/configs/oxlint-plugin.js +3 -9
- package/configs/oxlint-plugin.test.ts +6 -0
- package/dist/charts/ChartCard.d.ts +5 -3
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +10 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +65 -7
- package/dist/charts/chart-box.module.css +50 -7
- package/dist/charts/chart-box.module.css.d.ts +2 -0
- package/dist/charts/chart-card.module.css +34 -0
- package/dist/charts/chart-card.module.css.d.ts +2 -0
- package/dist/charts/chart-legend.module.css +5 -6
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +27 -1
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +42 -9
- package/dist/charts/sparkline.module.css +13 -9
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +6 -1
- package/dist/dashboard/meter-model.d.ts +2 -0
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +99 -7
- package/dist/dashboard/meter-parts.d.ts +4 -7
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +102 -78
- package/dist/dashboard/meter.d.ts +1 -1
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +10 -7
- package/dist/dashboard/meter.module.css +43 -12
- package/dist/dashboard/meter.module.css.d.ts +1 -2
- package/dist/dashboard/section.d.ts +1 -2
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.module.css +8 -7
- package/dist/dashboard/stat-card.module.css +17 -0
- package/dist/dashboard/stat-strip.d.ts +9 -1
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +32 -6
- package/dist/dashboard/stat-strip.module.css +38 -0
- package/dist/dashboard/stat-strip.module.css.d.ts +3 -0
- package/dist/dashboard/visual-slot.d.ts +4 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -1
- package/dist/dashboard/visual-slot.js +2 -0
- package/dist/dashboard/widget-header.module.css +9 -0
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +23 -4
- package/src/charts/Sparkline.tsx +105 -10
- package/src/charts/chart-box.module.css +50 -7
- package/src/charts/chart-box.module.css.d.ts +2 -0
- package/src/charts/chart-card.module.css +34 -0
- package/src/charts/chart-card.module.css.d.ts +2 -0
- package/src/charts/chart-legend.module.css +5 -6
- package/src/charts/compile.ts +40 -1
- package/src/charts/legend.tsx +64 -16
- package/src/charts/sparkline.module.css +13 -9
- package/src/charts/state.tsx +18 -1
- package/src/dashboard/meter-model.ts +147 -12
- package/src/dashboard/meter-parts.tsx +71 -50
- package/src/dashboard/meter.module.css +43 -12
- package/src/dashboard/meter.module.css.d.ts +1 -2
- package/src/dashboard/meter.tsx +22 -9
- package/src/dashboard/section.module.css +8 -7
- package/src/dashboard/section.tsx +1 -2
- package/src/dashboard/stat-card.module.css +17 -0
- package/src/dashboard/stat-strip.module.css +38 -0
- package/src/dashboard/stat-strip.module.css.d.ts +3 -0
- package/src/dashboard/stat-strip.tsx +49 -8
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +9 -0
|
@@ -137,8 +137,7 @@ 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.
|
|
141
|
-
* chart-text step): a `size` prop on a bare `Text` here is ignored — wrap it to opt out. */
|
|
140
|
+
* one row — the body is what `children` is for. A `Text` here renders at 11 (the chart-text step); wrap it to opt out. */
|
|
142
141
|
summary?: ReactNode
|
|
143
142
|
/** Turns the root into a scroll anchor (`id` + `scroll-margin-top`). Inside `BasaltShell` the
|
|
144
143
|
* offset is the clearance token; without a shell it also clears `PageBar`, which assumes the
|
|
@@ -194,6 +194,23 @@
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
+
/* Cards of one StatGroup share ONE figure size. In the two-column phone state the last odd card spans the
|
|
198
|
+
* row, so its own width would size its numeral 22 against its row-mates' 16; the group's columns (a
|
|
199
|
+
* narrow card's size) set it for every card instead, whether or not a qualifier sits on its own line.
|
|
200
|
+
* `--basalt-stat-group-figure` on the group (or a wrapper) replaces that size. */
|
|
201
|
+
@container basalt-grid (max-width: 479.9px) {
|
|
202
|
+
[data-sm-cols] .body {
|
|
203
|
+
--basalt-stat-figure-size: var(--basalt-stat-group-figure, var(--vx-text-lg));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* A one-column group (under 260px) has no spanning card: each keeps its own width's clamp. */
|
|
208
|
+
@container basalt-grid (max-width: 259.9px) {
|
|
209
|
+
[data-sm-cols] .body {
|
|
210
|
+
--basalt-stat-figure-size: clamp(var(--vx-text-lg), 8cqi, var(--vx-text-kpi));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
197
214
|
/* ── states ──────────────────────────────────────────────────────────────────────────────────── */
|
|
198
215
|
|
|
199
216
|
/* The empty branch: one muted line in the figure's place, at the figure row's height. */
|
|
@@ -223,6 +223,44 @@
|
|
|
223
223
|
min-width: 0;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
/* Loading keeps the slot's or footer's own box (the consumer's visual or footer, laid out as loaded) and
|
|
227
|
+
* hides it under a skeleton, so the cell has its loaded height. A `Meter` inside draws its own loading
|
|
228
|
+
* rows and so stays visible; any other visual is covered by the one skeleton bar. */
|
|
229
|
+
.hold {
|
|
230
|
+
position: relative;
|
|
231
|
+
visibility: hidden;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.hold [data-basalt-meter],
|
|
235
|
+
.holdSkeleton {
|
|
236
|
+
visibility: visible;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.holdSkeleton {
|
|
240
|
+
position: absolute;
|
|
241
|
+
inset-block: 0.25rem;
|
|
242
|
+
inset-inline-start: 0;
|
|
243
|
+
width: 55%;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* The hero's bar: the value row's first line, as the plain skeleton. */
|
|
247
|
+
.holdHero {
|
|
248
|
+
composes: holdSkeleton;
|
|
249
|
+
inset-block: 0 auto;
|
|
250
|
+
width: 45%;
|
|
251
|
+
height: calc(var(--vx-text-kpi) * 1.25);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.visual.hold > .holdSkeleton {
|
|
255
|
+
inset-block-start: max(0px, calc(var(--basalt-spark-readout-h) - var(--vx-space-stack-sm)));
|
|
256
|
+
inset-block-end: 0;
|
|
257
|
+
width: 100%;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.hold:has([data-basalt-meter]) > .holdSkeleton {
|
|
261
|
+
display: none;
|
|
262
|
+
}
|
|
263
|
+
|
|
226
264
|
/* A Sparkline's hover readout takes this line above its plot (`charts/sparkline.module.css`). The
|
|
227
265
|
* cell's own stack gap already sits above it; the slot reserves the rest, so the chip never covers
|
|
228
266
|
* the value. */
|
|
@@ -21,6 +21,9 @@ declare const classes: {
|
|
|
21
21
|
readonly skeletonValue: string
|
|
22
22
|
readonly skeletonRow: string
|
|
23
23
|
readonly visual: string
|
|
24
|
+
readonly hold: string
|
|
25
|
+
readonly holdSkeleton: string
|
|
26
|
+
readonly holdHero: string
|
|
24
27
|
readonly visualStack: string
|
|
25
28
|
readonly reason: string
|
|
26
29
|
readonly error: string
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* `tone` inks the VALUE only, for a verdict; a null reading is `—`. A cell may carry BOTH: the hero
|
|
9
9
|
* (e.g. VO2max) with `rows` under it; omit `value` to render the rows alone.
|
|
10
10
|
*
|
|
11
|
+
* `loading` keeps the loaded shape: the value bar, the visual slot and the footer line at their loaded
|
|
12
|
+
* height (the visual and footer are laid out hidden under a skeleton).
|
|
13
|
+
*
|
|
11
14
|
* `state` replaces the readings (hero, visual, rows, footer) with the cell's empty or error body, at
|
|
12
15
|
* the cell's size. Empty: the reason, muted, in the value's place (`—` only when no reason is given). Error: the shared error
|
|
13
16
|
* anatomy compact — status dot, the words `Could not load`, the message, the shared Retry. The caption stays.
|
|
@@ -48,7 +51,7 @@ import { StatusDot } from '../theme/status-dot'
|
|
|
48
51
|
import { VX } from '../tokens'
|
|
49
52
|
import { InfoGlyph } from './widget-header'
|
|
50
53
|
import classes from './stat-strip.module.css'
|
|
51
|
-
import { HOSTED, VisualSlotContext } from './visual-slot'
|
|
54
|
+
import { HOSTED, HOSTED_LOADING, VisualSlotContext } from './visual-slot'
|
|
52
55
|
|
|
53
56
|
/** The URL shot states an anchor can declare itself absent in (`data-shot-absent`). */
|
|
54
57
|
type StatStripShotState = 'empty' | 'loading' | 'error'
|
|
@@ -109,7 +112,12 @@ export type StatStripCell = {
|
|
|
109
112
|
rows?: readonly StatStripRow[]
|
|
110
113
|
/** Inks the value only — set it when the reading is a verdict. */
|
|
111
114
|
tone?: Tone
|
|
112
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Skeleton in place of the readings, in the loaded shape: the value bar, the `visual` slot and the
|
|
117
|
+
* `footer` line keep the height they have loaded. Pass the same `visual` and `footer` as at rest
|
|
118
|
+
* (empty data is fine): the slot is measured, never shown — a `Meter` in it draws its own loading
|
|
119
|
+
* rows, any other visual is covered by one skeleton.
|
|
120
|
+
*/
|
|
113
121
|
loading?: boolean
|
|
114
122
|
/** Dims the cell while placeholder data shows. */
|
|
115
123
|
stale?: boolean
|
|
@@ -126,6 +134,9 @@ export type StatStripFooterEntry = {
|
|
|
126
134
|
* every width, as a sibling AFTER the article (outside its `aria-labelledby` region). For a key that
|
|
127
135
|
* names no cell it takes the full width under the grid. */
|
|
128
136
|
under?: string
|
|
137
|
+
/** The shot states this entry is absent in; replaces the strip's `shotAbsent` (an entry production
|
|
138
|
+
* omits where the strip itself shows, e.g. a fact that needs data the empty state lacks). */
|
|
139
|
+
shotAbsent?: readonly StatStripShotState[]
|
|
129
140
|
}
|
|
130
141
|
|
|
131
142
|
export type StatStripProps = BasaltProps & {
|
|
@@ -189,7 +200,7 @@ function FooterCell({
|
|
|
189
200
|
className={under ? classes.underCell : classes.footerCell}
|
|
190
201
|
data-strip-footer-cell={entry.key}
|
|
191
202
|
data-shot={`strip-footer-${entry.key}`}
|
|
192
|
-
{...absentAttr(shotAbsent)}
|
|
203
|
+
{...absentAttr(entry.shotAbsent ?? shotAbsent)}
|
|
193
204
|
{...(under && { 'data-under': entry.under })}
|
|
194
205
|
>
|
|
195
206
|
{entry.content}
|
|
@@ -210,16 +221,41 @@ function StripCell({
|
|
|
210
221
|
const { rows, loading } = cell
|
|
211
222
|
const state = loading ? undefined : cell.state
|
|
212
223
|
const hasHero = cell.value !== undefined || rows === undefined
|
|
213
|
-
// The cell's verdict colours a plain Meter in its visual too (a hero host only).
|
|
214
|
-
|
|
224
|
+
// The cell's verdict colours a plain Meter in its visual too (a hero host only). While loading, a
|
|
225
|
+
// Meter in the slot draws its own loading state (the loaded rows, text painted as skeleton).
|
|
226
|
+
const hostSlot = !hasHero
|
|
227
|
+
? loading
|
|
228
|
+
? HOSTED_LOADING
|
|
229
|
+
: null
|
|
230
|
+
: cell.tone === undefined
|
|
231
|
+
? loading
|
|
232
|
+
? HOSTED_LOADING
|
|
233
|
+
: HOSTED
|
|
234
|
+
: { tone: cell.tone, ...(loading && { loading }) }
|
|
215
235
|
// A footer rides with what it captions: it follows the cell's last part, whatever a sibling holds.
|
|
236
|
+
// Loading keeps its box (so a wrapping footer keeps its lines) and lays a skeleton over it.
|
|
216
237
|
const footerEl = cell.footer !== undefined && (
|
|
217
|
-
<div
|
|
238
|
+
<div
|
|
239
|
+
className={cx(classes.footer, loading && classes.hold)}
|
|
240
|
+
data-strip-footer
|
|
241
|
+
{...(loading && { 'aria-hidden': true, inert: true })}
|
|
242
|
+
>
|
|
218
243
|
{cell.footer}
|
|
244
|
+
{loading && <Skeleton className={classes.holdSkeleton} radius="sm" />}
|
|
219
245
|
</div>
|
|
220
246
|
)
|
|
247
|
+
// A delta can wrap under the value in a narrow cell: with one, loading lays out the loaded value row
|
|
248
|
+
// (hidden) under the skeleton bar, so the cell has the lines the loaded one has.
|
|
221
249
|
const heroEl = loading ? (
|
|
222
|
-
|
|
250
|
+
cell.delta === undefined ? (
|
|
251
|
+
<Skeleton className={classes.skeletonValue} radius="sm" />
|
|
252
|
+
) : (
|
|
253
|
+
<div className={cx(classes.valueRow, classes.hold)} aria-hidden inert>
|
|
254
|
+
<span className={classes.value}>{cell.value ?? EMPTY}</span>
|
|
255
|
+
{cell.delta}
|
|
256
|
+
<Skeleton className={classes.holdHero} radius="sm" />
|
|
257
|
+
</div>
|
|
258
|
+
)
|
|
223
259
|
) : (
|
|
224
260
|
<div className={classes.valueRow}>
|
|
225
261
|
<span
|
|
@@ -276,8 +312,13 @@ function StripCell({
|
|
|
276
312
|
{state !== undefined && <CellState state={state} />}
|
|
277
313
|
{state === undefined && hasHero && heroEl}
|
|
278
314
|
{state === undefined && cell.visual !== undefined && (
|
|
279
|
-
<div
|
|
315
|
+
<div
|
|
316
|
+
className={cx(classes.visual, loading && classes.hold)}
|
|
317
|
+
data-strip-visual
|
|
318
|
+
{...(loading && { 'aria-hidden': true, inert: true })}
|
|
319
|
+
>
|
|
280
320
|
<VisualSlotContext.Provider value={hostSlot}>{cell.visual}</VisualSlotContext.Provider>
|
|
321
|
+
{loading && <Skeleton className={classes.holdSkeleton} radius="sm" />}
|
|
281
322
|
</div>
|
|
282
323
|
)}
|
|
283
324
|
{state === undefined &&
|
|
@@ -9,9 +9,14 @@ import type { Tone } from '../common/props'
|
|
|
9
9
|
|
|
10
10
|
export interface VisualSlot {
|
|
11
11
|
readonly tone?: Tone
|
|
12
|
+
/** The host is loading: a `Meter` in the slot draws its loading state without its own `loading`. */
|
|
13
|
+
readonly loading?: boolean
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/** A host with no verdict of its own: one shared object, so a provider never re-renders its readers. */
|
|
15
17
|
export const HOSTED: VisualSlot = {}
|
|
16
18
|
|
|
19
|
+
/** `HOSTED` while the host loads. */
|
|
20
|
+
export const HOSTED_LOADING: VisualSlot = { loading: true }
|
|
21
|
+
|
|
17
22
|
export const VisualSlotContext = createContext<VisualSlot | null>(null)
|
|
@@ -221,6 +221,15 @@
|
|
|
221
221
|
min-width: 0;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
/* A `widget` tier (ChartCard) caption in `actions` — `<Text size="xs">`, 12 — joins the chart text
|
|
225
|
+
* step beside the plot's ticks and legend (argo's strength cards: title 13 + caption 12 + ticks 11
|
|
226
|
+
* + section title 15 was four sizes). The cap is the `--text-fz` variable `Text` reads, pinned
|
|
227
|
+
* `!important` over the inline value its `size` prop writes; other sizes (`md` figures, `sm`) are
|
|
228
|
+
* not touched, and a `Text` sized by a consumer class never reads the variable. */
|
|
229
|
+
.root[data-tier='widget'] .actions :global(.mantine-Text-root[style*='--mantine-font-size-xs']) {
|
|
230
|
+
--text-fz: var(--vx-text-micro) !important;
|
|
231
|
+
}
|
|
232
|
+
|
|
224
233
|
/* Directly under the title row, 4px off it — 1px put it inside the title's own line box, so a
|
|
225
234
|
* section with both read as a two-line heading rather than a heading plus a note. */
|
|
226
235
|
.subtitle {
|