basalt-ui 2.28.0 → 2.29.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 +461 -401
- package/MIGRATING.md +202 -12
- package/agent/skills/basalt-app/SKILL.md +3 -3
- package/agent/skills/basalt-charts/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +11 -5
- package/agent/skills/basalt-design/references/catalogue.md +3 -1
- package/agent/skills/basalt-design/references/recipes.md +1 -1
- package/agent/skills/basalt-design/references/states.md +1 -1
- package/configs/oxlint-plugin.js +2 -1
- package/configs/oxlint.json +1 -0
- package/dist/charts/ChartCard.d.ts +9 -5
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +68 -12
- package/dist/charts/Sparkline.d.ts +5 -0
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +53 -5
- package/dist/charts/chart-box.module.css +9 -2
- package/dist/charts/chart-card.module.css +16 -13
- package/dist/charts/chart-card.module.css.d.ts +2 -0
- package/dist/charts/compile.d.ts +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +18 -9
- package/dist/charts/ref-label.d.ts +6 -0
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +19 -5
- package/dist/charts/sparkline.module.css +44 -0
- package/dist/charts/sparkline.module.css.d.ts +3 -0
- package/dist/charts/state.d.ts +1 -1
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +3 -3
- package/dist/cli/doctor-upgrade.d.ts +11 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +54 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -3
- package/dist/cli/index.d.ts +13 -13
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -2
- package/dist/cli/init.d.ts +6 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +118 -27
- package/dist/cli/router-wiring.d.ts +3 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +2 -0
- package/dist/cli/shot/capture.d.ts +28 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +77 -7
- package/dist/cli/shot/detect.d.ts +4 -1
- package/dist/cli/shot/detect.d.ts.map +1 -1
- package/dist/cli/shot/detect.js +38 -16
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +9 -2
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +11 -2
- package/dist/cli/shot/types.d.ts +4 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +10 -2
- package/dist/common/could-not-load.d.ts +13 -0
- package/dist/common/could-not-load.d.ts.map +1 -0
- package/dist/common/could-not-load.js +14 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +3 -0
- package/dist/common/props.d.ts +20 -0
- package/dist/common/props.d.ts.map +1 -1
- package/dist/common/props.js +13 -1
- package/dist/common/retry-button.module.css +7 -3
- package/dist/dashboard/bar-list.d.ts +4 -4
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +10 -7
- package/dist/dashboard/bar-list.module.css +21 -3
- package/dist/dashboard/board.d.ts +2 -2
- package/dist/dashboard/board.d.ts.map +1 -1
- package/dist/dashboard/board.js +31 -12
- package/dist/dashboard/board.module.css +19 -0
- package/dist/dashboard/board.module.css.d.ts +2 -0
- package/dist/dashboard/empty-state.d.ts +3 -3
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +4 -2
- package/dist/dashboard/event-list-model.d.ts +3 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -1
- package/dist/dashboard/event-list-model.js +5 -1
- package/dist/dashboard/event-list-rows.d.ts.map +1 -1
- package/dist/dashboard/event-list-rows.js +2 -6
- package/dist/dashboard/event-list-scroll.d.ts +32 -4
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -1
- package/dist/dashboard/event-list-scroll.js +117 -4
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -1
- package/dist/dashboard/event-list-skeleton.js +2 -4
- package/dist/dashboard/event-list.d.ts +4 -4
- package/dist/dashboard/event-list.d.ts.map +1 -1
- package/dist/dashboard/event-list.js +53 -23
- package/dist/dashboard/event-list.module.css +90 -37
- package/dist/dashboard/event-list.module.css.d.ts +1 -0
- package/dist/dashboard/meter-model.d.ts +6 -3
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +9 -4
- package/dist/dashboard/meter-parts.d.ts +3 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +32 -4
- package/dist/dashboard/meter.d.ts +3 -3
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +10 -2
- package/dist/dashboard/meter.module.css +18 -11
- package/dist/dashboard/meter.module.css.d.ts +0 -1
- package/dist/dashboard/page-summary.d.ts +3 -3
- package/dist/dashboard/page-summary.d.ts.map +1 -1
- package/dist/dashboard/page-summary.js +7 -2
- package/dist/dashboard/page-summary.module.css +5 -2
- package/dist/dashboard/query-state.d.ts +9 -8
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +28 -10
- package/dist/dashboard/section.d.ts +11 -3
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +34 -7
- package/dist/dashboard/settings-section.d.ts +4 -4
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +11 -7
- package/dist/dashboard/settings-section.module.css +6 -0
- package/dist/dashboard/settings-section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card.d.ts +3 -3
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +24 -8
- package/dist/dashboard/stat-card.module.css +11 -0
- package/dist/dashboard/stat-group.d.ts +2 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +10 -3
- package/dist/dashboard/stat-strip.d.ts +5 -4
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +41 -31
- package/dist/dashboard/stat-strip.module.css +4 -5
- 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.d.ts +6 -6
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +4 -2
- package/dist/dashboard/widget-header.module.css +6 -25
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +24 -1
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +2 -1
- package/dist/styles.css +23 -0
- package/dist/table/cell-kinds.d.ts +10 -7
- package/dist/table/cell-kinds.d.ts.map +1 -1
- package/dist/table/cell-kinds.js +18 -7
- package/dist/table/data-table-fold.d.ts +13 -5
- package/dist/table/data-table-fold.d.ts.map +1 -1
- package/dist/table/data-table-fold.js +48 -16
- package/dist/table/data-table.d.ts +2 -2
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +16 -9
- package/dist/table/data-table.module.css +74 -2
- package/dist/table/data-table.module.css.d.ts +4 -0
- package/dist/theme/controls.module.css +23 -2
- package/llms.txt +263 -2
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +98 -16
- package/src/charts/Sparkline.tsx +84 -5
- package/src/charts/chart-box.module.css +9 -2
- package/src/charts/chart-card.module.css +16 -13
- package/src/charts/chart-card.module.css.d.ts +2 -0
- package/src/charts/compile.ts +37 -15
- package/src/charts/ref-label.ts +36 -9
- package/src/charts/sparkline.module.css +44 -0
- package/src/charts/sparkline.module.css.d.ts +3 -0
- package/src/charts/state.tsx +4 -3
- package/src/cli/doctor-upgrade.ts +75 -0
- package/src/cli/doctor.ts +36 -0
- package/src/cli/help.ts +16 -6
- package/src/cli/index.ts +73 -67
- package/src/cli/init.ts +157 -36
- package/src/cli/router-wiring.ts +2 -2
- package/src/cli/shot/capture.ts +109 -10
- package/src/cli/shot/detect.ts +46 -22
- package/src/cli/shot/index.ts +8 -2
- package/src/cli/shot/measure.ts +11 -2
- package/src/cli/shot/types.ts +4 -1
- package/src/cli/sync.ts +12 -2
- package/src/common/could-not-load.ts +22 -0
- package/src/common/index.ts +1 -0
- package/src/common/props.ts +30 -0
- package/src/common/retry-button.module.css +7 -3
- package/src/dashboard/bar-list.module.css +21 -3
- package/src/dashboard/bar-list.tsx +46 -41
- package/src/dashboard/board.module.css +19 -0
- package/src/dashboard/board.module.css.d.ts +2 -0
- package/src/dashboard/board.tsx +69 -48
- package/src/dashboard/empty-state.tsx +5 -2
- package/src/dashboard/event-list-model.ts +13 -1
- package/src/dashboard/event-list-rows.tsx +3 -6
- package/src/dashboard/event-list-scroll.ts +154 -8
- package/src/dashboard/event-list-skeleton.tsx +5 -1
- package/src/dashboard/event-list.module.css +90 -37
- package/src/dashboard/event-list.module.css.d.ts +1 -0
- package/src/dashboard/event-list.tsx +92 -65
- package/src/dashboard/meter-model.ts +16 -7
- package/src/dashboard/meter-parts.tsx +45 -13
- package/src/dashboard/meter.module.css +18 -11
- package/src/dashboard/meter.module.css.d.ts +0 -1
- package/src/dashboard/meter.tsx +36 -18
- package/src/dashboard/page-summary.module.css +5 -2
- package/src/dashboard/page-summary.tsx +13 -6
- package/src/dashboard/query-state.tsx +54 -29
- package/src/dashboard/section.tsx +83 -41
- package/src/dashboard/settings-section.module.css +6 -0
- package/src/dashboard/settings-section.module.css.d.ts +1 -0
- package/src/dashboard/settings-section.tsx +11 -6
- package/src/dashboard/stat-card.module.css +11 -0
- package/src/dashboard/stat-card.tsx +31 -8
- package/src/dashboard/stat-group.tsx +22 -14
- package/src/dashboard/stat-strip.module.css +4 -5
- package/src/dashboard/stat-strip.tsx +29 -20
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +6 -25
- package/src/dashboard/widget-header.tsx +8 -5
- package/src/format/shared.ts +30 -1
- package/src/guard/index.ts +5 -1
- package/src/styles.css +23 -0
- package/src/table/cell-kinds.tsx +42 -13
- package/src/table/data-table-fold.tsx +65 -12
- package/src/table/data-table.module.css +74 -2
- package/src/table/data-table.module.css.d.ts +4 -0
- package/src/table/data-table.tsx +34 -13
- package/src/theme/controls.module.css +23 -2
|
@@ -10,8 +10,9 @@ export type MeterSegment = {
|
|
|
10
10
|
label: string
|
|
11
11
|
color?: string
|
|
12
12
|
/**
|
|
13
|
-
* `'muted'`: the part takes the one flat muted fill every muted part shares, a
|
|
14
|
-
* between neighbours (never a lightness step). A `color` wins.
|
|
13
|
+
* `'muted'`: the part takes the one flat muted fill every muted part shares, a visible 2px
|
|
14
|
+
* separator between neighbours (never a lightness step). A `color` wins. Give each categorical part its own
|
|
15
|
+
* series `color`; `muted` is for a tail "other" part, and a bar of only muted parts reads as one slab.
|
|
15
16
|
*/
|
|
16
17
|
tone?: 'muted'
|
|
17
18
|
forecast?: boolean
|
|
@@ -87,7 +88,7 @@ export type Part = {
|
|
|
87
88
|
readonly size: number
|
|
88
89
|
readonly color: string | undefined
|
|
89
90
|
readonly forecast: boolean
|
|
90
|
-
/** A
|
|
91
|
+
/** A categorical part right after another: a 2px separator (not a hairline) keeps neighbours, muted ones included, apart. */
|
|
91
92
|
readonly seam: boolean
|
|
92
93
|
readonly label: string
|
|
93
94
|
/** The segment's own (normalised) amount, in the reading's units — what its caption states. */
|
|
@@ -205,11 +206,18 @@ export function normalizeSegments(segments: readonly MeterSegment[]): MeterSegme
|
|
|
205
206
|
return segments.map((s) => ({ ...s, value: Number.isFinite(s.value) ? Math.max(0, s.value) : 0 }))
|
|
206
207
|
}
|
|
207
208
|
|
|
209
|
+
const isMuted = (s: MeterSegment) => s.tone === 'muted' && s.color === undefined && !s.forecast
|
|
210
|
+
|
|
211
|
+
/** Three or more categorical parts that all take the one muted fill read as a single slab. */
|
|
212
|
+
export function allPartsMuted(segments: readonly MeterSegment[]): boolean {
|
|
213
|
+
const parts = segments.filter((s) => s.forecast !== true)
|
|
214
|
+
return parts.length >= 3 && parts.every(isMuted)
|
|
215
|
+
}
|
|
216
|
+
|
|
208
217
|
/** Segment amounts (already normalised) accumulate from `min`; a part never passes the track end. */
|
|
209
218
|
export function layoutSegments(segments: readonly MeterSegment[], span: number): Part[] {
|
|
210
219
|
let cursor = 0
|
|
211
|
-
|
|
212
|
-
let prevMuted = false
|
|
220
|
+
let prevCategorical = false
|
|
213
221
|
return segments.map((s) => {
|
|
214
222
|
const size = Math.max(0, Math.min(clamp01(s.value / span), 1 - cursor))
|
|
215
223
|
const forecast = s.forecast === true
|
|
@@ -219,12 +227,13 @@ export function layoutSegments(segments: readonly MeterSegment[], span: number):
|
|
|
219
227
|
size,
|
|
220
228
|
color: forecast ? undefined : isMuted(s) ? mutedFill(MUTED_PART) : s.color,
|
|
221
229
|
forecast,
|
|
222
|
-
seam:
|
|
230
|
+
seam: !forecast && prevCategorical,
|
|
223
231
|
label: s.label,
|
|
224
232
|
amount: s.value,
|
|
225
233
|
}
|
|
226
234
|
cursor += size
|
|
227
|
-
|
|
235
|
+
// A zero-size part has no visible edge: the next part has no neighbour to be separated from.
|
|
236
|
+
if (size > 0) prevCategorical = !forecast
|
|
228
237
|
return part
|
|
229
238
|
})
|
|
230
239
|
}
|
|
@@ -3,7 +3,9 @@ import { Skeleton, VisuallyHidden } from '@mantine/core'
|
|
|
3
3
|
import { useContext, useId, useRef, useState } from 'react'
|
|
4
4
|
import type { CSSProperties, ReactNode, RefObject } from 'react'
|
|
5
5
|
import { useIsomorphicLayoutEffect } from '../common/isomorphic-layout-effect'
|
|
6
|
+
import { splitEmptyCopy } from '../common/empty-copy'
|
|
6
7
|
import { cx } from '../common/props'
|
|
8
|
+
import type { DataAttributes } from '../common/props'
|
|
7
9
|
import {
|
|
8
10
|
ariaValues,
|
|
9
11
|
modelBar,
|
|
@@ -30,6 +32,7 @@ import type {
|
|
|
30
32
|
ZoneLabel,
|
|
31
33
|
} from './meter-model'
|
|
32
34
|
import classes from './meter.module.css'
|
|
35
|
+
import { EmptyState } from './empty-state'
|
|
33
36
|
import { VisualSlotContext } from './visual-slot'
|
|
34
37
|
import { toPct } from './scale'
|
|
35
38
|
|
|
@@ -38,6 +41,8 @@ export type Shell = {
|
|
|
38
41
|
style: CSSProperties | undefined
|
|
39
42
|
/** `size="row"`: one text line tall, no caption rows. */
|
|
40
43
|
row: boolean
|
|
44
|
+
/** The consumer's `data-*` (`data-shot`), on the root of every state. */
|
|
45
|
+
data: DataAttributes
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
/**
|
|
@@ -46,6 +51,7 @@ export type Shell = {
|
|
|
46
51
|
*/
|
|
47
52
|
function rootProps(shell: Shell) {
|
|
48
53
|
return {
|
|
54
|
+
...shell.data,
|
|
49
55
|
className: cx(classes.root, shell.row && classes.row, shell.className),
|
|
50
56
|
style: shell.style,
|
|
51
57
|
'data-basalt-meter': '',
|
|
@@ -160,6 +166,21 @@ export function MeterEmpty(props: {
|
|
|
160
166
|
shell: Shell
|
|
161
167
|
}) {
|
|
162
168
|
const { label, text, ring, zoned, shell } = props
|
|
169
|
+
// A host that states its gap (non-blank `text`) gets the one empty box `BarList` and `EventList` draw: no
|
|
170
|
+
// track, no ring, the same `EmptyState` tile.
|
|
171
|
+
if (text !== undefined && text.trim() !== '') {
|
|
172
|
+
const copy = splitEmptyCopy(text)
|
|
173
|
+
return (
|
|
174
|
+
// oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a polite live region named by the Meter's label; `<output>` cannot hold the tile's block content
|
|
175
|
+
<div {...rootProps(shell)} role="status" aria-label={label}>
|
|
176
|
+
<EmptyState
|
|
177
|
+
tier="section"
|
|
178
|
+
title={copy.title}
|
|
179
|
+
{...(copy.description !== undefined && { description: copy.description })}
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
163
184
|
// The ring has a reading slot (its centre), so the dash sits there as the reading. A bar states its
|
|
164
185
|
// gap once, and only if the host says so (`text`): otherwise the caption rows a loaded Meter would
|
|
165
186
|
// have stay blank, so the muted track keeps the loaded height without a dash under it.
|
|
@@ -178,15 +199,11 @@ export function MeterEmpty(props: {
|
|
|
178
199
|
</div>
|
|
179
200
|
</>
|
|
180
201
|
)}
|
|
181
|
-
{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
<VisuallyHidden className={classes.summary}>No reading</VisuallyHidden>
|
|
187
|
-
{!shell.row && <Line zoned={zoned} />}
|
|
188
|
-
</>
|
|
189
|
-
)
|
|
202
|
+
{!ring && (
|
|
203
|
+
<>
|
|
204
|
+
<VisuallyHidden className={classes.summary}>No reading</VisuallyHidden>
|
|
205
|
+
{!shell.row && <Line zoned={zoned} />}
|
|
206
|
+
</>
|
|
190
207
|
)}
|
|
191
208
|
</output>
|
|
192
209
|
)
|
|
@@ -798,7 +815,11 @@ export function MeterBar(props: {
|
|
|
798
815
|
{
|
|
799
816
|
key: 'start',
|
|
800
817
|
node: glue(start),
|
|
801
|
-
|
|
818
|
+
// `readingAt="start"` labels the track's start edge ("60-day low"), not the reading: it stays
|
|
819
|
+
// at the edge instead of sitting centred under the reading tick as if it were its caption.
|
|
820
|
+
...(readingInRow &&
|
|
821
|
+
props.readingAt !== 'start' &&
|
|
822
|
+
model.markerPct !== undefined && { pct: model.markerPct }),
|
|
802
823
|
// The reading sits at its fill's end (clamped inside the track); `readingAt="start"` keeps the old start edge.
|
|
803
824
|
...(props.readingAt !== 'start' &&
|
|
804
825
|
!readingInRow &&
|
|
@@ -815,8 +836,9 @@ export function MeterBar(props: {
|
|
|
815
836
|
key: 'forecast',
|
|
816
837
|
node: glue(model.forecastText),
|
|
817
838
|
drop: 2,
|
|
818
|
-
// The reading ends at the boundary, the forecast ends where its fill does
|
|
819
|
-
// If that
|
|
839
|
+
// The reading ends at the boundary, the forecast ends where its fill does (a tick
|
|
840
|
+
// marks that end). If that would cover the reading, it falls back to starting at the
|
|
841
|
+
// boundary before it drops.
|
|
820
842
|
...(props.readingAt !== 'start' && model.forecastEndPct !== undefined
|
|
821
843
|
? {
|
|
822
844
|
pct: model.forecastEndPct,
|
|
@@ -930,6 +952,16 @@ export function MeterBar(props: {
|
|
|
930
952
|
<>
|
|
931
953
|
<Tick kind="marker" className={classes.marker} pct={model.markerPct} />
|
|
932
954
|
<Tick kind="boundary" className={classes.boundaryTick} pct={model.boundaryPct} />
|
|
955
|
+
{/* At the track end the track itself marks the forecast end. */}
|
|
956
|
+
<Tick
|
|
957
|
+
kind="forecastEnd"
|
|
958
|
+
className={classes.boundaryTick}
|
|
959
|
+
pct={
|
|
960
|
+
model.forecastEndPct !== undefined && model.forecastEndPct < 100
|
|
961
|
+
? model.forecastEndPct
|
|
962
|
+
: undefined
|
|
963
|
+
}
|
|
964
|
+
/>
|
|
933
965
|
{model.ticks.map((t) => (
|
|
934
966
|
<Tick key={t.key} kind="tick" className={classes.tick} pct={t.pct} />
|
|
935
967
|
))}
|
|
@@ -965,7 +997,7 @@ function tickPosition(kind: TickKind, pct: number): CSSProperties {
|
|
|
965
997
|
return { insetInlineStart: `calc(100% - ${TICK_WIDTH})`, marginInlineStart: 0 }
|
|
966
998
|
}
|
|
967
999
|
|
|
968
|
-
type TickKind = 'marker' | 'boundary' | 'target' | 'tick'
|
|
1000
|
+
type TickKind = 'marker' | 'boundary' | 'forecastEnd' | 'target' | 'tick'
|
|
969
1001
|
|
|
970
1002
|
function Tick({
|
|
971
1003
|
kind,
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
--basalt-meter-caption: var(--vx-text-micro);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/* A bar fills its container's width: as a flex item (a StatCard visual, a strip cell) it would
|
|
18
|
+
* otherwise size to its captions and stop part-way across the card. */
|
|
19
|
+
.root:has(> .trackBox) {
|
|
20
|
+
inline-size: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
.track {
|
|
18
24
|
position: relative;
|
|
19
25
|
display: flex;
|
|
@@ -62,10 +68,10 @@
|
|
|
62
68
|
background: color-mix(in srgb, var(--vx-muted) 65%, transparent);
|
|
63
69
|
}
|
|
64
70
|
|
|
65
|
-
/*
|
|
71
|
+
/* Adjacent categorical parts (muted ones share one fill): a track-coloured gap, not a hairline, tells them apart. */
|
|
66
72
|
.fill[data-meter-seam] {
|
|
67
73
|
box-sizing: border-box;
|
|
68
|
-
border-inline-start:
|
|
74
|
+
border-inline-start: 2px solid var(--vx-surface-subtle);
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
/* The committed/forecast pair: the same neutral at two strengths. Flat, never hatched. */
|
|
@@ -168,7 +174,11 @@
|
|
|
168
174
|
translate: none;
|
|
169
175
|
}
|
|
170
176
|
|
|
171
|
-
/*
|
|
177
|
+
/*
|
|
178
|
+
* The reading on a zone track: a notch standing proud of the bands. A panel core in an ink ring, so
|
|
179
|
+
* one of the two always contrasts with the fill under it: the core on an ink fill, the ring on a
|
|
180
|
+
* light one (an ink core on an ink track vanished).
|
|
181
|
+
*/
|
|
172
182
|
.marker {
|
|
173
183
|
position: absolute;
|
|
174
184
|
top: -3px;
|
|
@@ -176,7 +186,8 @@
|
|
|
176
186
|
width: 3px;
|
|
177
187
|
margin-inline-start: -1.5px;
|
|
178
188
|
border-radius: var(--vx-radius-fine);
|
|
179
|
-
background: var(--vx-
|
|
189
|
+
background: var(--vx-surface-panel);
|
|
190
|
+
box-shadow: 0 0 0 1.5px var(--vx-ink);
|
|
180
191
|
}
|
|
181
192
|
|
|
182
193
|
.tick {
|
|
@@ -187,8 +198,9 @@
|
|
|
187
198
|
margin-inline-start: -1px;
|
|
188
199
|
border-radius: var(--vx-radius-fine);
|
|
189
200
|
background: var(--vx-ink);
|
|
190
|
-
/* A
|
|
191
|
-
|
|
201
|
+
/* A panel-coloured 2px halo (the opposite pole of ink in both schemes) keeps the tick readable on
|
|
202
|
+
* a fill that is itself near-ink: `tone="ink"`, or --vx-line in dark. */
|
|
203
|
+
box-shadow: 0 0 0 2px var(--vx-surface-panel);
|
|
192
204
|
}
|
|
193
205
|
|
|
194
206
|
.boundaryTick {
|
|
@@ -324,11 +336,6 @@
|
|
|
324
336
|
border-radius: var(--vx-radius-fine);
|
|
325
337
|
}
|
|
326
338
|
|
|
327
|
-
.empty {
|
|
328
|
-
font-size: var(--basalt-meter-caption);
|
|
329
|
-
color: var(--vx-muted);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
339
|
/* One caption-height line: a blank caption row of an empty Meter, so it stands at the loaded height. */
|
|
333
340
|
.line {
|
|
334
341
|
display: flex;
|
package/src/dashboard/meter.tsx
CHANGED
|
@@ -24,7 +24,16 @@
|
|
|
24
24
|
*
|
|
25
25
|
* Categorical `segments` (no `forecast` part) are captioned one per part — swatch, name, value — under
|
|
26
26
|
* the track and the default start caption is dropped (an explicit `startCaption` still shows);
|
|
27
|
-
* committed/forecast keeps the reading plus the forecast caption.
|
|
27
|
+
* committed/forecast keeps the reading plus the forecast caption. The reading is captioned at the
|
|
28
|
+
* committed fill's end and the forecast at the forecast's end, which a tick marks (none when it
|
|
29
|
+
* reaches the track end); the forecast caption drops before it ever sits under the boundary tick.
|
|
30
|
+
* Adjacent categorical parts are separated by a 2px separator, muted ones included; give each part its own
|
|
31
|
+
* series colour (`tone="muted"` is for a tail "other" part — a bar of only muted parts warns once in
|
|
32
|
+
* development).
|
|
33
|
+
*
|
|
34
|
+
* Captions keep at least a gap step between them at any width: at
|
|
35
|
+
* narrow widths the lower-priority ones drop first (tick captions, then the forecast), and what is
|
|
36
|
+
* dropped stays in the described-by text. A bar fills its container's width.
|
|
28
37
|
*
|
|
29
38
|
* @example
|
|
30
39
|
* import { Meter } from 'basalt-ui'
|
|
@@ -53,28 +62,31 @@
|
|
|
53
62
|
*/
|
|
54
63
|
import { useContext } from 'react'
|
|
55
64
|
import type { ReactNode } from 'react'
|
|
56
|
-
import
|
|
65
|
+
import { pickDataAttributes } from '../common/props'
|
|
66
|
+
import type { BasaltProps, DataAttributes } from '../common/props'
|
|
57
67
|
import { VX } from '../tokens'
|
|
58
|
-
import {
|
|
68
|
+
import { reportOnce } from '../common/validate'
|
|
69
|
+
import { allPartsMuted, isReading, normalizeSegments, segmentReading, spanOf } from './meter-model'
|
|
59
70
|
import type { MeterSegment, MeterTick, MeterZone } from './meter-model'
|
|
60
71
|
import { MeterBar, MeterEmpty, MeterRing, MeterRingLoading } from './meter-parts'
|
|
61
72
|
import { asText } from './scale'
|
|
62
73
|
import { VisualSlotContext } from './visual-slot'
|
|
63
74
|
|
|
64
|
-
type Common = BasaltProps &
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
type Common = BasaltProps &
|
|
76
|
+
DataAttributes & {
|
|
77
|
+
/** Accessible name (`aria-label`). Required: a meter without one is announced as a bare number. */
|
|
78
|
+
label: string
|
|
79
|
+
/** Track start. Default 0. */
|
|
80
|
+
min?: number
|
|
81
|
+
/** Track end. Default 100. */
|
|
82
|
+
max?: number
|
|
83
|
+
/** Formats values in captions and the accessible text. Default: the number as written. */
|
|
84
|
+
format?: (value: number) => string
|
|
85
|
+
/** Renders a skeleton with the meter's footprint. */
|
|
86
|
+
loading?: boolean
|
|
87
|
+
/** The empty box shown when there is no reading (the same `EmptyState` tile `BarList` and `EventList` draw, no track; the first sentence is its title, the rest its muted line). None by default: the muted track stands alone, caption rows blank. */
|
|
88
|
+
emptyText?: string
|
|
89
|
+
}
|
|
78
90
|
|
|
79
91
|
type BarCommon = Common & {
|
|
80
92
|
shape?: 'bar'
|
|
@@ -222,7 +234,7 @@ function barTone(tone: 'muted' | 'ink' | undefined, plain: boolean): 'muted' | u
|
|
|
222
234
|
export function Meter(props: MeterProps) {
|
|
223
235
|
const { label, min = 0, max = 100, format = asText, className, style } = props
|
|
224
236
|
const row = props.size === 'row'
|
|
225
|
-
const shell = { className, style, row }
|
|
237
|
+
const shell = { className, style, row, data: pickDataAttributes(props) }
|
|
226
238
|
const ring = props.shape === 'ring'
|
|
227
239
|
warnInvalidTrack(min, max)
|
|
228
240
|
const host = useContext(VisualSlotContext)
|
|
@@ -238,6 +250,12 @@ export function Meter(props: MeterProps) {
|
|
|
238
250
|
props.segments === undefined || (loading && props.segments.length === 0)
|
|
239
251
|
? undefined
|
|
240
252
|
: normalizeSegments(props.segments)
|
|
253
|
+
if (segments !== undefined && allPartsMuted(segments)) {
|
|
254
|
+
reportOnce(
|
|
255
|
+
'Meter',
|
|
256
|
+
'[basalt] Meter: every segment is tone="muted", so the parts read as one slab; give each part its own series colour (muted is for a tail "other" part)',
|
|
257
|
+
)
|
|
258
|
+
}
|
|
241
259
|
const placeholder =
|
|
242
260
|
props.zones !== undefined && props.zones.length > 0 ? min + spanOf(min, max).span / 2 : min
|
|
243
261
|
const reading = loading
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
min-width: 0;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/* The aside sits right after the sentence it dates and wraps under it when the line is full — never
|
|
13
|
+
* pinned to the far edge, where it read as belonging to nothing. */
|
|
12
14
|
.top {
|
|
13
15
|
display: flex;
|
|
16
|
+
flex-wrap: wrap;
|
|
14
17
|
align-items: baseline;
|
|
15
|
-
|
|
16
|
-
gap: var(--vx-space-stack-
|
|
18
|
+
column-gap: var(--vx-space-stack-md);
|
|
19
|
+
row-gap: var(--vx-space-stack-xs);
|
|
17
20
|
min-width: 0;
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PageSummary — a page's opening (docs/waves/design-parity/SPEC.md § 6.9): one headline sentence
|
|
3
3
|
* that carries at least one live number, an optional facts line under it, and an optional `aside`
|
|
4
|
-
*
|
|
4
|
+
* after the headline (beside it, wrapping under it when the line is full). It renders an `h2` at the `h1` type step (head face, −0.02em): the page's own
|
|
5
5
|
* h1 is the shell breadcrumb's / `PageTitle`'s, and a second one would split the outline. The facts
|
|
6
6
|
* are the proportional sans at `xs`, muted, `·`-separated — a time fact may take mono itself, the line does
|
|
7
7
|
* not (D33).
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
*/
|
|
33
33
|
import { Skeleton } from '@mantine/core'
|
|
34
34
|
import type { ReactNode } from 'react'
|
|
35
|
-
import { cx } from '../common/props'
|
|
36
|
-
import type { BasaltProps } from '../common/props'
|
|
35
|
+
import { cx, pickDataAttributes } from '../common/props'
|
|
36
|
+
import type { BasaltProps, DataAttributes } from '../common/props'
|
|
37
37
|
import classes from './page-summary.module.css'
|
|
38
38
|
|
|
39
39
|
type Fact = ReactNode | null | false | undefined
|
|
@@ -43,7 +43,7 @@ type PageSummaryContent = {
|
|
|
43
43
|
sentence: ReactNode
|
|
44
44
|
/** Short facts under the headline, e.g. `['3 need you', oldest && `oldest ${oldest}`]`. */
|
|
45
45
|
facts?: readonly Fact[]
|
|
46
|
-
/**
|
|
46
|
+
/** After the headline: a date or a freshness word. */
|
|
47
47
|
aside?: ReactNode
|
|
48
48
|
loading?: false
|
|
49
49
|
}
|
|
@@ -51,7 +51,9 @@ type PageSummaryContent = {
|
|
|
51
51
|
/** While the sentence's data loads: a skeleton of the same shape, no content props needed. */
|
|
52
52
|
type PageSummaryLoading = Partial<Omit<PageSummaryContent, 'loading'>> & { loading: true }
|
|
53
53
|
|
|
54
|
-
export type PageSummaryProps = BasaltProps &
|
|
54
|
+
export type PageSummaryProps = BasaltProps &
|
|
55
|
+
DataAttributes &
|
|
56
|
+
(PageSummaryContent | PageSummaryLoading)
|
|
55
57
|
|
|
56
58
|
const NO_FACTS: readonly Fact[] = []
|
|
57
59
|
|
|
@@ -60,7 +62,12 @@ const isShown = (fact: Fact): boolean =>
|
|
|
60
62
|
|
|
61
63
|
export function PageSummary(props: PageSummaryProps) {
|
|
62
64
|
const { className, style } = props
|
|
63
|
-
const common = {
|
|
65
|
+
const common = {
|
|
66
|
+
...pickDataAttributes(props),
|
|
67
|
+
className: cx(classes.root, className),
|
|
68
|
+
'data-page-summary': '',
|
|
69
|
+
style,
|
|
70
|
+
}
|
|
64
71
|
|
|
65
72
|
if (props.loading === true) {
|
|
66
73
|
return (
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
* escape hatch for a page that must place its branches in different DOM positions.
|
|
16
16
|
*/
|
|
17
17
|
import { Center, Group, Loader, Skeleton, Stack, Text, VisuallyHidden } from '@mantine/core'
|
|
18
|
+
import { useContext } from 'react'
|
|
18
19
|
import type { CSSProperties, ReactNode } from 'react'
|
|
19
20
|
import { toErrorMessage } from '../common/errors'
|
|
20
|
-
import {
|
|
21
|
+
import { couldNotLoad, HostTitleContext } from '../common/could-not-load'
|
|
22
|
+
import { cx, pickDataAttributes } from '../common/props'
|
|
21
23
|
import { RetryButton } from '../common/retry-button'
|
|
22
|
-
import type { BasaltProps, SlotStylesProps } from '../common/props'
|
|
24
|
+
import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props'
|
|
23
25
|
import { VX } from '../tokens'
|
|
24
26
|
import { StatusDot } from '../theme/status-dot'
|
|
25
27
|
import { EmptyState } from './empty-state'
|
|
@@ -57,12 +59,13 @@ export type QueryEmptyCopy = {
|
|
|
57
59
|
|
|
58
60
|
// ── LoadingState ──────────────────────────────────────────────────────────────────────────────────
|
|
59
61
|
|
|
60
|
-
export type LoadingStateProps = BasaltProps &
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
export type LoadingStateProps = BasaltProps &
|
|
63
|
+
DataAttributes & {
|
|
64
|
+
/** How loud this state is. Default `'page'`. */
|
|
65
|
+
tier?: QueryStateTier
|
|
66
|
+
/** Accessible name for the loading state. Say what is loading. */
|
|
67
|
+
label?: string
|
|
68
|
+
}
|
|
66
69
|
|
|
67
70
|
/**
|
|
68
71
|
* `tier="page"` centres a neutral spinner in a generous block (a route body whose shape is unknown);
|
|
@@ -74,11 +77,14 @@ export function LoadingState({
|
|
|
74
77
|
label = 'Loading',
|
|
75
78
|
className,
|
|
76
79
|
style,
|
|
80
|
+
...rest
|
|
77
81
|
}: LoadingStateProps): ReactNode {
|
|
78
82
|
const resolved = tier ?? 'page'
|
|
83
|
+
const data = pickDataAttributes(rest)
|
|
79
84
|
if (resolved === 'section') {
|
|
80
85
|
return (
|
|
81
86
|
<Stack
|
|
87
|
+
{...data}
|
|
82
88
|
component="output"
|
|
83
89
|
gap="xs"
|
|
84
90
|
aria-label={label}
|
|
@@ -98,6 +104,7 @@ export function LoadingState({
|
|
|
98
104
|
// renders at today's 64px at level 0 and tracks every other density level with it.
|
|
99
105
|
return (
|
|
100
106
|
<Center
|
|
107
|
+
{...data}
|
|
101
108
|
{...(className !== undefined && { className })}
|
|
102
109
|
style={{ paddingBlock: 'calc(var(--vx-space-stack-xs, 0.25rem) * 16)', ...style }}
|
|
103
110
|
>
|
|
@@ -108,21 +115,22 @@ export function LoadingState({
|
|
|
108
115
|
|
|
109
116
|
// ── ErrorState ────────────────────────────────────────────────────────────────────────────────────
|
|
110
117
|
|
|
111
|
-
export type ErrorStateProps = BasaltProps &
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
export type ErrorStateProps = BasaltProps &
|
|
119
|
+
DataAttributes & {
|
|
120
|
+
/** Whatever was thrown — the raw Eden/fetch envelope is fine, it gets decoded. */
|
|
121
|
+
error: unknown
|
|
122
|
+
/** Alert heading. Say what failed, e.g. `Could not load images`. */
|
|
123
|
+
title?: string
|
|
124
|
+
/** Shown only when the server body carries no readable message. */
|
|
125
|
+
fallback?: string
|
|
126
|
+
onRetry?: () => void
|
|
127
|
+
/** Disables the retry button while a refetch is in flight. */
|
|
128
|
+
retrying?: boolean
|
|
129
|
+
/** How loud this state is. Default `'page'`. */
|
|
130
|
+
tier?: QueryStateTier
|
|
131
|
+
/** Extra controls beside Retry (e.g. a "Back to shares" link). */
|
|
132
|
+
action?: ReactNode
|
|
133
|
+
}
|
|
126
134
|
|
|
127
135
|
/**
|
|
128
136
|
* The error branch: the REAL server message (via `toErrorMessage`) plus a retry. Usable on its own,
|
|
@@ -130,7 +138,7 @@ export type ErrorStateProps = BasaltProps & {
|
|
|
130
138
|
*/
|
|
131
139
|
export function ErrorState({
|
|
132
140
|
error,
|
|
133
|
-
title
|
|
141
|
+
title: titleProp,
|
|
134
142
|
fallback = 'The request failed.',
|
|
135
143
|
onRetry,
|
|
136
144
|
retrying = false,
|
|
@@ -138,7 +146,11 @@ export function ErrorState({
|
|
|
138
146
|
action,
|
|
139
147
|
className,
|
|
140
148
|
style,
|
|
149
|
+
...rest
|
|
141
150
|
}: ErrorStateProps): ReactNode {
|
|
151
|
+
const data = pickDataAttributes(rest)
|
|
152
|
+
const hostTitle = useContext(HostTitleContext)
|
|
153
|
+
const title = titleProp ?? couldNotLoad(hostTitle)
|
|
142
154
|
const resolved = tier ?? 'page'
|
|
143
155
|
// D28: a status dot + a word + the message + the retry, on the neutral surface — never a
|
|
144
156
|
// red-tinted filled panel (SPEC § 6.12).
|
|
@@ -146,6 +158,7 @@ export function ErrorState({
|
|
|
146
158
|
<Stack
|
|
147
159
|
gap="xs"
|
|
148
160
|
role="alert"
|
|
161
|
+
{...(resolved === 'section' && data)}
|
|
149
162
|
{...(resolved === 'section' && className !== undefined && { className })}
|
|
150
163
|
{...(resolved === 'section' && style !== undefined && { style })}
|
|
151
164
|
>
|
|
@@ -170,6 +183,7 @@ export function ErrorState({
|
|
|
170
183
|
return (
|
|
171
184
|
<Stack
|
|
172
185
|
py="md"
|
|
186
|
+
{...data}
|
|
173
187
|
{...(className !== undefined && { className })}
|
|
174
188
|
{...(style !== undefined && { style })}
|
|
175
189
|
>
|
|
@@ -241,6 +255,7 @@ export function resolveQueryBranch<TData>(
|
|
|
241
255
|
export type QueryStateSlot = 'root'
|
|
242
256
|
|
|
243
257
|
export type QueryStateProps<TData> = BasaltProps &
|
|
258
|
+
DataAttributes &
|
|
244
259
|
SlotStylesProps<QueryStateSlot> & {
|
|
245
260
|
query: QueryStateLike<TData>
|
|
246
261
|
/** A render function gets `data` narrowed to non-undefined; a plain node also works. */
|
|
@@ -249,7 +264,8 @@ export type QueryStateProps<TData> = BasaltProps &
|
|
|
249
264
|
empty?: QueryEmptyCopy
|
|
250
265
|
/** Override the default `[]` / `{ data: [] }` emptiness test — `() => false` disables it. */
|
|
251
266
|
isEmpty?: (data: TData) => boolean
|
|
252
|
-
/** Alert heading on the error branch — say what failed.
|
|
267
|
+
/** Alert heading on the error branch — say what failed. Omitted inside a titled `Section`, it
|
|
268
|
+
* names that section ("Could not load practice record"); elsewhere it is "Could not load". */
|
|
253
269
|
errorTitle?: string
|
|
254
270
|
/** Shown only when the server body carries no readable message. */
|
|
255
271
|
errorFallback?: string
|
|
@@ -285,7 +301,7 @@ export function QueryState<TData>({
|
|
|
285
301
|
children,
|
|
286
302
|
empty,
|
|
287
303
|
isEmpty,
|
|
288
|
-
errorTitle
|
|
304
|
+
errorTitle,
|
|
289
305
|
errorFallback = 'The request failed.',
|
|
290
306
|
errorAction,
|
|
291
307
|
tier,
|
|
@@ -293,8 +309,12 @@ export function QueryState<TData>({
|
|
|
293
309
|
className,
|
|
294
310
|
style,
|
|
295
311
|
classNames,
|
|
312
|
+
...rest
|
|
296
313
|
}: QueryStateProps<TData>): ReactNode {
|
|
297
314
|
assertQueryStateLike('QueryState', query)
|
|
315
|
+
// The live branch's root carries the consumer's `data-*`. The READY branch renders `children`
|
|
316
|
+
// alone and has no root of its own, so an anchor there belongs on the host (`Section`, a card).
|
|
317
|
+
const dataAttrs = pickDataAttributes(rest)
|
|
298
318
|
const resolvedTier = tier ?? 'page'
|
|
299
319
|
// One class for every branch — see {@link QueryStateSlot}. `cx` returns `''` when both are
|
|
300
320
|
// absent, and an empty `className` on a branch that previously carried none would be a DOM diff,
|
|
@@ -307,8 +327,9 @@ export function QueryState<TData>({
|
|
|
307
327
|
if (isError && data === undefined) {
|
|
308
328
|
return (
|
|
309
329
|
<ErrorState
|
|
330
|
+
{...dataAttrs}
|
|
310
331
|
error={error}
|
|
311
|
-
|
|
332
|
+
{...(errorTitle !== undefined && { title: errorTitle })}
|
|
312
333
|
fallback={errorFallback}
|
|
313
334
|
onRetry={retry}
|
|
314
335
|
retrying={retrying}
|
|
@@ -322,10 +343,11 @@ export function QueryState<TData>({
|
|
|
322
343
|
|
|
323
344
|
if (data === undefined) {
|
|
324
345
|
if (fetchStatus === 'idle' && !isError)
|
|
325
|
-
return empty ? renderEmpty(empty, resolvedTier, rootClassName, style) : null
|
|
346
|
+
return empty ? renderEmpty(empty, resolvedTier, rootClassName, style, dataAttrs) : null
|
|
326
347
|
return (
|
|
327
348
|
loading ?? (
|
|
328
349
|
<LoadingState
|
|
350
|
+
{...dataAttrs}
|
|
329
351
|
tier={resolvedTier}
|
|
330
352
|
{...(rootClassName !== undefined && { className: rootClassName })}
|
|
331
353
|
{...(style !== undefined && { style })}
|
|
@@ -337,7 +359,7 @@ export function QueryState<TData>({
|
|
|
337
359
|
const emptyNow = isEmpty ? isEmpty(data) : defaultIsEmpty(data)
|
|
338
360
|
const body = emptyNow
|
|
339
361
|
? empty
|
|
340
|
-
? renderEmpty(empty, resolvedTier, rootClassName, style)
|
|
362
|
+
? renderEmpty(empty, resolvedTier, rootClassName, style, dataAttrs)
|
|
341
363
|
: null
|
|
342
364
|
: typeof children === 'function'
|
|
343
365
|
? children(data)
|
|
@@ -347,6 +369,7 @@ export function QueryState<TData>({
|
|
|
347
369
|
|
|
348
370
|
return (
|
|
349
371
|
<Stack
|
|
372
|
+
{...dataAttrs}
|
|
350
373
|
gap="sm"
|
|
351
374
|
{...(rootClassName !== undefined && { className: rootClassName })}
|
|
352
375
|
{...(style !== undefined && { style })}
|
|
@@ -369,9 +392,11 @@ function renderEmpty(
|
|
|
369
392
|
tier: QueryStateTier,
|
|
370
393
|
className?: string,
|
|
371
394
|
style?: CSSProperties,
|
|
395
|
+
data?: DataAttributes,
|
|
372
396
|
): ReactNode {
|
|
373
397
|
return (
|
|
374
398
|
<EmptyState
|
|
399
|
+
{...data}
|
|
375
400
|
title={empty.title}
|
|
376
401
|
tier={tier}
|
|
377
402
|
{...(empty.description !== undefined && { description: empty.description })}
|