basalt-ui 2.27.2 → 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 +466 -307
- package/MIGRATING.md +358 -12
- package/agent/rules/basalt-batteries.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/rules/basalt-tokens.md +2 -2
- 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 +12 -6
- package/agent/skills/basalt-design/references/catalogue.md +42 -36
- package/agent/skills/basalt-design/references/recipes.md +47 -0
- package/agent/skills/basalt-design/references/states.md +1 -1
- package/configs/oxlint-basalt.json +2 -1
- package/configs/oxlint-plugin.js +112 -3
- package/configs/oxlint-plugin.test.ts +99 -4
- package/configs/oxlint.json +1 -0
- package/dist/agent/chat/thread-message.d.ts +1 -160
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +7 -162
- package/dist/agent/chat/virtualize.d.ts +5 -5
- package/dist/charts/ChartCard.d.ts +14 -7
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +112 -23
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +11 -4
- package/dist/charts/Sparkline.d.ts +14 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +155 -44
- package/dist/charts/chart-box.module.css +59 -2
- package/dist/charts/chart-box.module.css.d.ts +5 -0
- package/dist/charts/chart-card.module.css +28 -17
- package/dist/charts/chart-card.module.css.d.ts +3 -0
- package/dist/charts/compile.d.ts +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +38 -27
- package/dist/charts/labels.d.ts +13 -3
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +131 -20
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +1 -1
- package/dist/charts/ref-label.d.ts +37 -8
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +55 -10
- package/dist/charts/sparkline.module.css +50 -0
- package/dist/charts/sparkline.module.css.d.ts +3 -0
- package/dist/charts/state.d.ts +4 -4
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +23 -5
- 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 +34 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +95 -12
- 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/empty-copy.d.ts +16 -0
- package/dist/common/empty-copy.d.ts.map +1 -0
- package/dist/common/empty-copy.js +9 -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/common/virtual-rows.d.ts +196 -0
- package/dist/common/virtual-rows.d.ts.map +1 -0
- package/dist/common/virtual-rows.js +290 -0
- package/dist/controls/controls.module.css +33 -1
- package/dist/controls/controls.module.css.d.ts +2 -0
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -2
- package/dist/controls/filter-pill.d.ts +27 -3
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +15 -4
- package/dist/controls/form-layout.d.ts +9 -3
- package/dist/controls/form-layout.d.ts.map +1 -1
- package/dist/controls/form-layout.js +74 -12
- package/dist/controls/form-layout.module.css +112 -7
- package/dist/controls/form-layout.module.css.d.ts +1 -0
- package/dist/controls/multi-select-filter.d.ts +2 -2
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +12 -6
- package/dist/controls/range-filter.d.ts +1 -1
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +8 -2
- package/dist/dashboard/bar-list.d.ts +5 -5
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +15 -8
- package/dist/dashboard/bar-list.module.css +21 -5
- package/dist/dashboard/board-nav.d.ts +22 -0
- package/dist/dashboard/board-nav.d.ts.map +1 -0
- package/dist/dashboard/board-nav.js +49 -0
- package/dist/dashboard/board.d.ts +52 -0
- package/dist/dashboard/board.d.ts.map +1 -0
- package/dist/dashboard/board.js +247 -0
- package/dist/dashboard/board.module.css +179 -0
- package/dist/dashboard/board.module.css.d.ts +28 -0
- package/dist/dashboard/empty-state.d.ts +6 -6
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +17 -8
- package/dist/dashboard/event-list-model.d.ts +54 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -0
- package/dist/dashboard/event-list-model.js +76 -0
- package/dist/dashboard/event-list-rows.d.ts +23 -0
- package/dist/dashboard/event-list-rows.d.ts.map +1 -0
- package/dist/dashboard/event-list-rows.js +89 -0
- package/dist/dashboard/event-list-scroll.d.ts +55 -0
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
- package/dist/dashboard/event-list-scroll.js +216 -0
- package/dist/dashboard/event-list-skeleton.d.ts +10 -0
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
- package/dist/dashboard/event-list-skeleton.js +34 -0
- package/dist/dashboard/event-list.d.ts +65 -0
- package/dist/dashboard/event-list.d.ts.map +1 -0
- package/dist/dashboard/event-list.js +208 -0
- package/dist/dashboard/event-list.module.css +336 -0
- package/dist/dashboard/event-list.module.css.d.ts +34 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -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 +36 -6
- 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 +20 -12
- 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 +29 -11
- 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 +8 -5
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +12 -8
- package/dist/dashboard/settings-section.module.css +25 -4
- package/dist/dashboard/settings-section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card-parts.d.ts +5 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +8 -3
- 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 +47 -12
- package/dist/dashboard/stat-card.module.css +42 -7
- package/dist/dashboard/stat-card.module.css.d.ts +3 -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 +8 -6
- 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 +12 -15
- 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 +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/shell/app-main.module.css +18 -0
- package/dist/styles.css +69 -0
- package/dist/surfaces.d.ts +2 -2
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +8 -2
- package/dist/table/cell-kinds.d.ts +47 -0
- package/dist/table/cell-kinds.d.ts.map +1 -0
- package/dist/table/cell-kinds.js +180 -0
- package/dist/table/cell-kinds.module.css +55 -0
- package/dist/table/cell-kinds.module.css.d.ts +15 -0
- package/dist/table/data-table-fold.d.ts +155 -0
- package/dist/table/data-table-fold.d.ts.map +1 -0
- package/dist/table/data-table-fold.js +320 -0
- package/dist/table/data-table-state.d.ts +10 -3
- package/dist/table/data-table-state.d.ts.map +1 -1
- package/dist/table/data-table-state.js +11 -6
- package/dist/table/data-table.d.ts +13 -28
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +362 -255
- package/dist/table/data-table.module.css +282 -3
- package/dist/table/data-table.module.css.d.ts +16 -0
- package/dist/table/table-features.d.ts +34 -4
- package/dist/table/table-features.d.ts.map +1 -1
- package/dist/table/table-features.js +10 -0
- package/dist/theme/card-inset.module.css +35 -0
- package/dist/theme/controls.module.css +55 -2
- package/dist/theme/ctl-theme.d.ts.map +1 -1
- package/dist/theme/ctl-theme.js +5 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +14 -10
- package/dist/tokens/core.d.ts +1 -0
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +1 -0
- package/dist/tokens/derive.js +1 -1
- package/dist/tokens/palette.d.ts +2 -1
- package/dist/tokens/palette.d.ts.map +1 -1
- package/llms.txt +295 -5
- package/package.json +1 -1
- package/src/agent/chat/thread-message.tsx +10 -403
- package/src/agent/chat/virtualize.ts +5 -5
- package/src/charts/ChartCard.tsx +175 -31
- package/src/charts/Lines.tsx +13 -4
- package/src/charts/Sparkline.tsx +213 -48
- package/src/charts/chart-box.module.css +59 -2
- package/src/charts/chart-box.module.css.d.ts +5 -0
- package/src/charts/chart-card.module.css +28 -17
- package/src/charts/chart-card.module.css.d.ts +3 -0
- package/src/charts/compile.ts +59 -33
- package/src/charts/labels.ts +175 -24
- package/src/charts/legend.tsx +3 -2
- package/src/charts/ref-label.ts +114 -18
- package/src/charts/sparkline.module.css +50 -0
- package/src/charts/sparkline.module.css.d.ts +3 -0
- package/src/charts/state.tsx +40 -10
- 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 +138 -16
- 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/empty-copy.ts +17 -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/common/virtual-rows.tsx +682 -0
- package/src/controls/controls.module.css +33 -1
- package/src/controls/controls.module.css.d.ts +2 -0
- package/src/controls/enum-filter.tsx +8 -2
- package/src/controls/filter-pill.tsx +80 -27
- package/src/controls/form-layout.module.css +112 -7
- package/src/controls/form-layout.module.css.d.ts +1 -0
- package/src/controls/form-layout.tsx +115 -22
- package/src/controls/multi-select-filter.tsx +22 -11
- package/src/controls/range-filter.tsx +9 -3
- package/src/dashboard/bar-list.module.css +21 -5
- package/src/dashboard/bar-list.tsx +53 -45
- package/src/dashboard/board-nav.ts +67 -0
- package/src/dashboard/board.module.css +179 -0
- package/src/dashboard/board.module.css.d.ts +28 -0
- package/src/dashboard/board.tsx +415 -0
- package/src/dashboard/empty-state.tsx +21 -11
- package/src/dashboard/event-list-model.ts +125 -0
- package/src/dashboard/event-list-rows.tsx +117 -0
- package/src/dashboard/event-list-scroll.ts +291 -0
- package/src/dashboard/event-list-skeleton.tsx +62 -0
- package/src/dashboard/event-list.module.css +336 -0
- package/src/dashboard/event-list.module.css.d.ts +34 -0
- package/src/dashboard/event-list.tsx +336 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +16 -7
- package/src/dashboard/meter-parts.tsx +53 -14
- package/src/dashboard/meter.module.css +20 -12
- 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 +55 -30
- package/src/dashboard/section.tsx +83 -41
- package/src/dashboard/settings-section.module.css +25 -4
- package/src/dashboard/settings-section.module.css.d.ts +1 -0
- package/src/dashboard/settings-section.tsx +18 -8
- package/src/dashboard/stat-card-parts.tsx +20 -3
- package/src/dashboard/stat-card.module.css +42 -7
- package/src/dashboard/stat-card.module.css.d.ts +3 -0
- package/src/dashboard/stat-card.tsx +55 -13
- package/src/dashboard/stat-group.tsx +22 -14
- package/src/dashboard/stat-strip.module.css +8 -6
- package/src/dashboard/stat-strip.tsx +29 -20
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +12 -15
- package/src/dashboard/widget-header.tsx +8 -5
- package/src/format/shared.ts +30 -1
- package/src/guard/index.ts +7 -1
- package/src/index.ts +4 -0
- package/src/shell/app-main.module.css +18 -0
- package/src/styles.css +69 -0
- package/src/surfaces.ts +7 -1
- package/src/table/cell-kinds.module.css +55 -0
- package/src/table/cell-kinds.module.css.d.ts +15 -0
- package/src/table/cell-kinds.tsx +263 -0
- package/src/table/data-table-fold.tsx +567 -0
- package/src/table/data-table-state.ts +24 -13
- package/src/table/data-table.module.css +282 -3
- package/src/table/data-table.module.css.d.ts +16 -0
- package/src/table/data-table.tsx +430 -362
- package/src/table/table-features.ts +44 -4
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
- package/src/theme/card-inset.module.css +35 -0
- package/src/theme/controls.module.css +55 -2
- package/src/theme/ctl-theme.tsx +8 -0
- package/src/theme/index.ts +12 -8
- package/src/tokens/core.ts +1 -0
- package/src/tokens/derive.ts +1 -1
- package/src/tokens/palette.ts +4 -1
|
@@ -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,12 +158,13 @@ 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
|
>
|
|
152
165
|
<Group gap="xs" wrap="nowrap">
|
|
153
166
|
<StatusDot color={VX.status.bad} />
|
|
154
|
-
<Text size=
|
|
167
|
+
<Text size={resolved === 'section' ? 'sm' : 'md'} fw={500}>
|
|
155
168
|
{title}
|
|
156
169
|
</Text>
|
|
157
170
|
</Group>
|
|
@@ -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 })}
|
|
@@ -45,20 +45,24 @@
|
|
|
45
45
|
* <UsageChart />
|
|
46
46
|
* </Section>
|
|
47
47
|
*/
|
|
48
|
-
import { useEffect, useId } from 'react'
|
|
48
|
+
import { Children, cloneElement, isValidElement, useContext, useEffect, useId } from 'react'
|
|
49
49
|
import type { ReactNode } from 'react'
|
|
50
|
-
import { cx } from '../common/props'
|
|
51
|
-
import type { BasaltProps, SlotStylesProps } from '../common/props'
|
|
50
|
+
import { cx, splitDataAttributes } from '../common/props'
|
|
51
|
+
import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props'
|
|
52
52
|
import { BASALT_PREFIX } from '../common/errors'
|
|
53
53
|
import { useValidateProps } from '../common/validate'
|
|
54
54
|
import { CtlSlot } from '../theme'
|
|
55
55
|
import { BarActionSlot } from '../controls/actions'
|
|
56
56
|
import type { SectionActions } from '../controls/actions'
|
|
57
57
|
import { useFilterSurface } from '../controls/filter-context'
|
|
58
|
-
import {
|
|
58
|
+
import { HostTitleContext } from '../common/could-not-load'
|
|
59
|
+
import { LoadingState, QueryState } from './query-state'
|
|
59
60
|
import type { QueryEmptyCopy, QueryStateLike } from './query-state'
|
|
60
61
|
import { usePersistedOrLocal } from '../state/persisted-or-local'
|
|
61
62
|
import { PAGE_BAR_HEIGHT_VAR, useInPageBarShell } from '../shell'
|
|
63
|
+
import { BarList } from './bar-list'
|
|
64
|
+
import { EventList } from './event-list'
|
|
65
|
+
import { Meter } from './meter'
|
|
62
66
|
import { WidgetHeader } from './widget-header'
|
|
63
67
|
import type { WidgetHeaderProps } from './widget-header'
|
|
64
68
|
import classes from './section.module.css'
|
|
@@ -95,6 +99,7 @@ type SectionBaseProps = Omit<
|
|
|
95
99
|
'tier' | 'classNames' | 'actions' | 'title' | HeaderOnlyKey
|
|
96
100
|
> &
|
|
97
101
|
BasaltProps &
|
|
102
|
+
DataAttributes &
|
|
98
103
|
SlotStylesProps<SectionSlot> & {
|
|
99
104
|
/**
|
|
100
105
|
* Header actions as typed data (law C15), projected through the SAME row `PageBar` uses — one
|
|
@@ -118,6 +123,14 @@ type SectionBaseProps = Omit<
|
|
|
118
123
|
* without `query`.
|
|
119
124
|
*/
|
|
120
125
|
empty?: QueryEmptyCopy
|
|
126
|
+
/**
|
|
127
|
+
* The loaded body's height in px. While `query` is pending the loading skeleton fills it, so
|
|
128
|
+
* the section does not jump when the data lands. Declared, not measured: a first load has no
|
|
129
|
+
* previous body to measure. Omitted, a body that is one `BarList`, `EventList` or `Meter`
|
|
130
|
+
* loads as that figure's own skeleton (set its `loadingRows` to the loaded count); any other
|
|
131
|
+
* body gets the three-bar default. Ignored without `query`.
|
|
132
|
+
*/
|
|
133
|
+
loadingHeight?: number
|
|
121
134
|
/** Rendered in the header row, in its own `CtlSlot` — hidden while the section is collapsed. */
|
|
122
135
|
tabs?: ReactNode
|
|
123
136
|
/** Renders a chevron toggle in the header; the header stays drawn when closed, only `children`
|
|
@@ -199,6 +212,18 @@ function ChevronToggle({
|
|
|
199
212
|
)
|
|
200
213
|
}
|
|
201
214
|
|
|
215
|
+
/**
|
|
216
|
+
* A body that is ONE figure with a row-shaped loading state loads as that figure, so the skeleton has
|
|
217
|
+
* the loaded footprint (rows, track) rather than a guess. Anything else has no shape to borrow.
|
|
218
|
+
*/
|
|
219
|
+
function figureLoading(children: ReactNode): ReactNode {
|
|
220
|
+
const only = Children.toArray(children)
|
|
221
|
+
const [child] = only
|
|
222
|
+
if (only.length !== 1 || !isValidElement<{ loading?: boolean }>(child)) return null
|
|
223
|
+
if (child.type !== BarList && child.type !== EventList && child.type !== Meter) return null
|
|
224
|
+
return cloneElement(child, { loading: true })
|
|
225
|
+
}
|
|
226
|
+
|
|
202
227
|
const ANCHOR_CLEARANCE = 'var(--vx-space-sticky-header-clearance)'
|
|
203
228
|
|
|
204
229
|
/** The `scroll-margin-top` of an anchored Section; the bar term only exists without a shell. */
|
|
@@ -211,6 +236,7 @@ export function Section({
|
|
|
211
236
|
actions,
|
|
212
237
|
query,
|
|
213
238
|
empty,
|
|
239
|
+
loadingHeight,
|
|
214
240
|
tabs,
|
|
215
241
|
collapsible = false,
|
|
216
242
|
persistKey,
|
|
@@ -224,9 +250,11 @@ export function Section({
|
|
|
224
250
|
style,
|
|
225
251
|
classNames,
|
|
226
252
|
'aria-label': ariaLabel,
|
|
227
|
-
...
|
|
253
|
+
...headerAndData
|
|
228
254
|
}: SectionProps) {
|
|
255
|
+
const { data, rest: headerProps } = splitDataAttributes(headerAndData)
|
|
229
256
|
const { title } = headerProps
|
|
257
|
+
const outerTitle = useContext(HostTitleContext)
|
|
230
258
|
const untitled = title === undefined
|
|
231
259
|
|
|
232
260
|
// A `persistKey` with nothing to fold writes a localStorage key nobody ever reads back — the
|
|
@@ -297,42 +325,56 @@ export function Section({
|
|
|
297
325
|
</>
|
|
298
326
|
) : undefined
|
|
299
327
|
|
|
328
|
+
const figure = query !== undefined && loadingHeight === undefined ? figureLoading(children) : null
|
|
329
|
+
|
|
300
330
|
return (
|
|
301
|
-
<
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
<div
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
331
|
+
<HostTitleContext value={title ?? outerTitle}>
|
|
332
|
+
<div
|
|
333
|
+
{...data}
|
|
334
|
+
className={cx(classes.root, classNames?.root, className)}
|
|
335
|
+
data-tier={tier}
|
|
336
|
+
{...(untitled && ariaLabel !== undefined && { role: 'group', 'aria-label': ariaLabel })}
|
|
337
|
+
{...(id !== undefined && { id })}
|
|
338
|
+
{...(rootStyle !== undefined && { style: rootStyle })}
|
|
339
|
+
>
|
|
340
|
+
{untitled ? (
|
|
341
|
+
<div className={cx(classes.tabsRow, classNames?.header)} data-basalt-hit-scope>
|
|
342
|
+
{headerActions}
|
|
343
|
+
</div>
|
|
344
|
+
) : (
|
|
345
|
+
<WidgetHeader
|
|
346
|
+
tier={tier}
|
|
347
|
+
{...(headerProps as Pick<WidgetHeaderProps, HeaderOnlyKey>)}
|
|
348
|
+
title={title}
|
|
349
|
+
{...(classNames?.header !== undefined && { className: classNames.header })}
|
|
350
|
+
{...(headerActions !== undefined && { actions: headerActions })}
|
|
351
|
+
/>
|
|
352
|
+
)}
|
|
353
|
+
{summary !== undefined && <div className={classes.summary}>{summary}</div>}
|
|
354
|
+
{(open || untitled) && (
|
|
355
|
+
<div id={bodyId} className={cx(classes.body, classNames?.body)}>
|
|
356
|
+
{query === undefined ? (
|
|
357
|
+
children
|
|
358
|
+
) : (
|
|
359
|
+
// `tier="section"` is the compact one: a bare spinner rather than a 64px centred
|
|
360
|
+
// block, and the error alert without the page-level stack around it. A Section IS the
|
|
361
|
+
// region, so the state belongs inside its body, never around its header.
|
|
362
|
+
<QueryState
|
|
363
|
+
query={query}
|
|
364
|
+
tier="section"
|
|
365
|
+
{...(empty !== undefined && { empty })}
|
|
366
|
+
{...(loadingHeight !== undefined
|
|
367
|
+
? {
|
|
368
|
+
loading: <LoadingState tier="section" style={{ minHeight: loadingHeight }} />,
|
|
369
|
+
}
|
|
370
|
+
: figure !== null && { loading: figure })}
|
|
371
|
+
>
|
|
372
|
+
{children}
|
|
373
|
+
</QueryState>
|
|
374
|
+
)}
|
|
375
|
+
</div>
|
|
376
|
+
)}
|
|
377
|
+
</div>
|
|
378
|
+
</HostTitleContext>
|
|
337
379
|
)
|
|
338
380
|
}
|
|
@@ -21,13 +21,34 @@
|
|
|
21
21
|
border-bottom: 1px solid var(--vx-divider);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/* One row rule with FormRow (`controls/form-layout.module.css`): a 15rem label column, a control
|
|
25
|
+
* column capped at 20rem, left-packed; stacked under 600px of the section's OWN width. */
|
|
26
|
+
.rows {
|
|
27
|
+
container-type: inline-size;
|
|
28
|
+
container-name: basalt-form;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
.row {
|
|
25
|
-
display:
|
|
26
|
-
|
|
27
|
-
justify-content:
|
|
32
|
+
display: grid;
|
|
33
|
+
grid-template-columns: minmax(0, 15rem) minmax(0, 20rem);
|
|
34
|
+
justify-content: start;
|
|
35
|
+
align-items: start;
|
|
28
36
|
gap: var(--vx-space-settings-row-gap);
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
.control {
|
|
32
|
-
|
|
40
|
+
min-inline-size: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@container basalt-form (max-width: 599.9px) {
|
|
44
|
+
.row {
|
|
45
|
+
grid-template-columns: minmax(0, 1fr);
|
|
46
|
+
gap: var(--vx-space-stack-xs);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* DangerZone's ring colour: the status token mixed into the panel surface — one formula in both
|
|
51
|
+
* schemes, never an alpha over whatever sits behind it. The component layers it on `shadow-card`. */
|
|
52
|
+
.danger {
|
|
53
|
+
--danger-ring: color-mix(in srgb, var(--vx-status-bad) 40%, var(--vx-surface-panel));
|
|
33
54
|
}
|
|
@@ -33,9 +33,9 @@ import type { ReactNode } from 'react'
|
|
|
33
33
|
import { WidgetHeader } from './widget-header'
|
|
34
34
|
import type { WidgetHeaderTitleProps } from './widget-header'
|
|
35
35
|
import { CtlSlot } from '../theme'
|
|
36
|
-
import {
|
|
37
|
-
import { cx } from '../common/props'
|
|
38
|
-
import type { BasaltProps, SlotStylesProps } from '../common/props'
|
|
36
|
+
import { VX } from '../tokens'
|
|
37
|
+
import { cx, pickDataAttributes } from '../common/props'
|
|
38
|
+
import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props'
|
|
39
39
|
import classes from './settings-section.module.css'
|
|
40
40
|
|
|
41
41
|
const eyebrowStyle = {
|
|
@@ -59,6 +59,7 @@ export type SettingsSectionSlot = 'root' | 'header' | 'body'
|
|
|
59
59
|
* slices.
|
|
60
60
|
*/
|
|
61
61
|
export type SettingsSectionProps = BasaltProps &
|
|
62
|
+
DataAttributes &
|
|
62
63
|
SlotStylesProps<SettingsSectionSlot> &
|
|
63
64
|
WidgetHeaderTitleProps & {
|
|
64
65
|
/** Header-right slot — wrapped in `CtlSlot` (C1/C5). */
|
|
@@ -77,9 +78,10 @@ export function SettingsSection({
|
|
|
77
78
|
className,
|
|
78
79
|
style,
|
|
79
80
|
classNames,
|
|
81
|
+
...rest
|
|
80
82
|
}: SettingsSectionProps) {
|
|
81
83
|
return (
|
|
82
|
-
<Card className={cx(classNames?.root, className)} style={style}>
|
|
84
|
+
<Card {...pickDataAttributes(rest)} className={cx(classNames?.root, className)} style={style}>
|
|
83
85
|
<div className={cx(classes.header, classNames?.header)}>
|
|
84
86
|
<WidgetHeader
|
|
85
87
|
tier="section"
|
|
@@ -104,7 +106,10 @@ export type SettingsRowProps = BasaltProps &
|
|
|
104
106
|
label: string
|
|
105
107
|
/** Optional 12px muted description under the label. */
|
|
106
108
|
description?: string
|
|
107
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Right-aligned control (input/switch/button). Mounted in a `CtlSlot`: a bound input is the 32 px
|
|
111
|
+
* field (44 under a coarse pointer), not Mantine's 42 px `md`; a control's own `size` still wins.
|
|
112
|
+
*/
|
|
108
113
|
control?: ReactNode
|
|
109
114
|
/** Alternative to `control` for a fully custom right-hand region. */
|
|
110
115
|
children?: ReactNode
|
|
@@ -130,7 +135,9 @@ export function SettingsRow({
|
|
|
130
135
|
<span style={{ fontSize: VX.text.xs, color: VX.muted }}>{description}</span>
|
|
131
136
|
)}
|
|
132
137
|
</Stack>
|
|
133
|
-
<div className={cx(classes.control, classNames?.control)}>
|
|
138
|
+
<div className={cx(classes.control, classNames?.control)}>
|
|
139
|
+
<CtlSlot>{control ?? children}</CtlSlot>
|
|
140
|
+
</div>
|
|
134
141
|
</div>
|
|
135
142
|
)
|
|
136
143
|
}
|
|
@@ -147,12 +154,15 @@ export function DangerZone({
|
|
|
147
154
|
className,
|
|
148
155
|
style,
|
|
149
156
|
classNames,
|
|
157
|
+
...rest
|
|
150
158
|
}: DangerZoneProps) {
|
|
151
159
|
return (
|
|
152
160
|
<Card
|
|
153
|
-
|
|
161
|
+
{...pickDataAttributes(rest)}
|
|
162
|
+
className={cx(classes.danger, classNames?.root, className)}
|
|
154
163
|
style={{
|
|
155
|
-
|
|
164
|
+
// The card's depth plus ONE edge in the class's scheme-independent ring colour.
|
|
165
|
+
boxShadow: `${VX.shadowCard}, 0 0 0 1px var(--danger-ring)`,
|
|
156
166
|
...style,
|
|
157
167
|
}}
|
|
158
168
|
>
|
|
@@ -106,12 +106,29 @@ export function rightSlotStyle(width: number, height: number): CSSProperties {
|
|
|
106
106
|
} as CSSProperties
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
/** The value bar, and a delta chip beside it when the loaded card carries a delta. */
|
|
110
|
+
export function ValueSkeleton({ delta }: { delta: boolean }) {
|
|
111
|
+
if (!delta) return <Skeleton className={classes.skeletonValue} radius="sm" />
|
|
112
|
+
return (
|
|
113
|
+
<div className={classes.skeletonValueRow}>
|
|
114
|
+
<Skeleton className={classes.skeletonValueWithDelta} radius="sm" />
|
|
115
|
+
<Skeleton className={classes.skeletonDelta} radius="sm" data-stat-skeleton-delta="" />
|
|
116
|
+
</div>
|
|
117
|
+
)
|
|
111
118
|
}
|
|
112
119
|
|
|
120
|
+
/** A mild rise across the width in a 100 x 40 box: the sparkline's shape, not data. */
|
|
121
|
+
const SPARK_GHOST = '0,30 12,26 25,28 38,18 50,22 62,12 75,16 88,8 100,12'
|
|
122
|
+
|
|
123
|
+
/** The visual slot's loading shape: a line ghost at the sparkline's own height, no spinner. */
|
|
113
124
|
export function VisualSkeleton() {
|
|
114
|
-
return
|
|
125
|
+
return (
|
|
126
|
+
<div aria-hidden="true" className={classes.skeletonVisual} data-stat-skeleton-spark="">
|
|
127
|
+
<svg viewBox="0 0 100 40" preserveAspectRatio="none">
|
|
128
|
+
<polyline points={SPARK_GHOST} vectorEffect="non-scaling-stroke" />
|
|
129
|
+
</svg>
|
|
130
|
+
</div>
|
|
131
|
+
)
|
|
115
132
|
}
|
|
116
133
|
|
|
117
134
|
export function FooterSkeleton() {
|
|
@@ -213,14 +213,10 @@
|
|
|
213
213
|
|
|
214
214
|
/* ── states ──────────────────────────────────────────────────────────────────────────────────── */
|
|
215
215
|
|
|
216
|
-
/* The empty branch:
|
|
216
|
+
/* The empty branch (SPEC § 6.11): `EmptyState`'s section tile in the figure's place, at the card's
|
|
217
|
+
* own inset; `EmptyState`'s section tier sets its title at `sm`. */
|
|
217
218
|
.empty {
|
|
218
|
-
display: flex;
|
|
219
|
-
align-items: center;
|
|
220
|
-
margin: 0;
|
|
221
219
|
min-height: var(--basalt-stat-figure-h);
|
|
222
|
-
font-size: var(--vx-text-sm);
|
|
223
|
-
color: var(--vx-muted);
|
|
224
220
|
}
|
|
225
221
|
|
|
226
222
|
/* The pending skeleton holds the card's own footprint: a value bar at the figure's height, the
|
|
@@ -233,10 +229,38 @@
|
|
|
233
229
|
/* Inset on both sides, unlike the sparkline at rest (which bleeds): a placeholder that touches one
|
|
234
230
|
* card edge and stops short of the other reads as misaligned, and a Meter in the slot is inset anyway. */
|
|
235
231
|
.skeletonVisual {
|
|
236
|
-
--skeleton-radius: 0;
|
|
237
232
|
height: var(--basalt-stat-visual-h);
|
|
238
233
|
}
|
|
239
234
|
|
|
235
|
+
.skeletonVisual svg {
|
|
236
|
+
display: block;
|
|
237
|
+
width: 100%;
|
|
238
|
+
height: 100%;
|
|
239
|
+
fill: none;
|
|
240
|
+
stroke: color-mix(in srgb, var(--vx-ink) 24%, var(--vx-surface-panel));
|
|
241
|
+
stroke-width: 2px;
|
|
242
|
+
stroke-linecap: round;
|
|
243
|
+
stroke-linejoin: round;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* A skeleton value row with a delta: the value bar and the delta chip, on the loaded row's height. */
|
|
247
|
+
.skeletonValueRow {
|
|
248
|
+
display: flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
gap: var(--vx-space-stack-sm);
|
|
251
|
+
height: var(--basalt-stat-figure-h);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.skeletonValueWithDelta {
|
|
255
|
+
width: 28%;
|
|
256
|
+
height: 100%;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.skeletonDelta {
|
|
260
|
+
width: 22%;
|
|
261
|
+
height: 1rem;
|
|
262
|
+
}
|
|
263
|
+
|
|
240
264
|
.sparklineRight .skeletonVisual {
|
|
241
265
|
flex: 1 1 auto;
|
|
242
266
|
}
|
|
@@ -413,6 +437,17 @@
|
|
|
413
437
|
padding-top: var(--basalt-spark-readout-reserve);
|
|
414
438
|
}
|
|
415
439
|
|
|
440
|
+
/* A sparkline that states its window has a caption line under its plot: the slot grows by it rather than
|
|
441
|
+
* letting the caption run into the footer. */
|
|
442
|
+
.sparklineBleed:has([data-basalt-sparkline-caption]) {
|
|
443
|
+
height: auto;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/* The slot bleeds past the card's inset, the plot with it; the caption is text and takes the inset back. */
|
|
447
|
+
.sparklineBleed [data-basalt-sparkline-caption] {
|
|
448
|
+
padding-inline: var(--vx-space-card-inset-x, 1rem);
|
|
449
|
+
}
|
|
450
|
+
|
|
416
451
|
/* A Meter in the visual slot is a block, not a chart: it sizes to its content and keeps the card's
|
|
417
452
|
* inline inset instead of the sparkline's fixed 22px and side bleed. */
|
|
418
453
|
.sparklineBleed:has(> [data-basalt-meter]) {
|
|
@@ -19,6 +19,9 @@ declare const classes: {
|
|
|
19
19
|
readonly empty: string
|
|
20
20
|
readonly skeletonValue: string
|
|
21
21
|
readonly skeletonVisual: string
|
|
22
|
+
readonly skeletonValueRow: string
|
|
23
|
+
readonly skeletonValueWithDelta: string
|
|
24
|
+
readonly skeletonDelta: string
|
|
22
25
|
readonly skeletonFooter: string
|
|
23
26
|
readonly skeletonRowBox: string
|
|
24
27
|
readonly skeletonRow: string
|