basalt-ui 2.20.0 → 2.22.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 +72 -0
- package/MIGRATING.md +394 -12
- package/agent/agents/basalt-design-reviewer.md +22 -5
- package/agent/rules/basalt-tokens.md +3 -3
- package/agent/skills/basalt-design/SKILL.md +10 -23
- package/agent/skills/basalt-design/references/anti-defaults.md +24 -0
- package/agent/skills/basalt-design/references/catalogue.md +49 -0
- package/agent/skills/basalt-design/references/concept.md +36 -0
- package/agent/skills/basalt-design/references/encoding-rules.md +45 -0
- package/agent/skills/basalt-design/references/stat-tile.md +24 -0
- package/agent/templates/AGENTS-block.md.tpl +3 -3
- package/configs/oxlint-plugin.js +1 -0
- package/dist/charts/BandStrip.d.ts.map +1 -1
- package/dist/charts/BandStrip.js +27 -3
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/Bars.js +5 -0
- package/dist/charts/CartesianChart.d.ts +8 -0
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +8 -5
- package/dist/charts/ChartCard.d.ts +17 -4
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +33 -8
- package/dist/charts/DualPanel.d.ts.map +1 -1
- package/dist/charts/DualPanel.js +5 -8
- package/dist/charts/Heatmap.d.ts +12 -1
- package/dist/charts/Heatmap.d.ts.map +1 -1
- package/dist/charts/Heatmap.js +34 -5
- package/dist/charts/Lines.d.ts +3 -0
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +29 -6
- package/dist/charts/MirroredBars.d.ts.map +1 -1
- package/dist/charts/MirroredBars.js +4 -6
- package/dist/charts/Sparkline.d.ts +7 -1
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +39 -14
- package/dist/charts/StackedArea.d.ts +4 -1
- package/dist/charts/StackedArea.d.ts.map +1 -1
- package/dist/charts/StackedArea.js +9 -3
- package/dist/charts/band-fold.d.ts +20 -1
- package/dist/charts/band-fold.d.ts.map +1 -1
- package/dist/charts/band-fold.js +9 -0
- package/dist/charts/chart-box.module.css +19 -0
- package/dist/charts/chart-card.module.css +25 -0
- package/dist/charts/chart-legend.module.css +7 -0
- package/dist/charts/compile.d.ts +17 -6
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +145 -74
- package/dist/charts/labels.d.ts +15 -4
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +34 -10
- package/dist/charts/legend.d.ts +2 -0
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +7 -21
- package/dist/charts/marks.js +1 -1
- package/dist/charts/panel.d.ts +0 -6
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +1 -10
- package/dist/charts/ref-label.d.ts +26 -0
- package/dist/charts/ref-label.d.ts.map +1 -0
- package/dist/charts/ref-label.js +63 -0
- package/dist/charts/scales.d.ts +4 -1
- package/dist/charts/scales.d.ts.map +1 -1
- package/dist/charts/scales.js +14 -3
- package/dist/charts/sparkline.module.css +10 -11
- package/dist/charts/sparkline.module.css.d.ts +1 -2
- package/dist/charts/state.d.ts +7 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +4 -1
- package/dist/charts/types.d.ts +14 -5
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/check-theme.d.ts.map +1 -1
- package/dist/cli/check-theme.js +3 -0
- package/dist/cli/doctor-upgrade.d.ts +1 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +1 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +3 -2
- package/dist/cli/index.d.ts +4 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +27 -15
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +71 -6
- package/dist/cli/shot/capture.d.ts +21 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +200 -33
- package/dist/cli/shot/detect.d.ts +51 -0
- package/dist/cli/shot/detect.d.ts.map +1 -0
- package/dist/cli/shot/detect.js +409 -0
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +7 -4
- package/dist/cli/shot/measure.d.ts +2 -0
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +2 -0
- package/dist/cli/shot/playwright.d.ts +5 -2
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/cli/shot/types.d.ts +6 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/shot/types.js +4 -0
- package/dist/cli/sync.d.ts +2 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +2 -2
- package/dist/common/retry-button.d.ts +12 -0
- package/dist/common/retry-button.d.ts.map +1 -0
- package/dist/common/retry-button.js +22 -0
- package/dist/common/retry-button.module.css +58 -0
- package/dist/common/retry-button.module.css.d.ts +8 -0
- package/dist/controls/controls.module.css +11 -1
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +1 -0
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/controls/sync-button.js +22 -3
- package/dist/controls/sync-button.module.css +34 -2
- package/dist/controls/sync-button.module.css.d.ts +1 -0
- package/dist/dashboard/bar-list.d.ts +5 -2
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +9 -10
- package/dist/dashboard/bar-list.module.css +53 -0
- package/dist/dashboard/bar-list.module.css.d.ts +1 -0
- package/dist/dashboard/index.d.ts +1 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +2 -0
- package/dist/dashboard/meter-model.d.ts +108 -6
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +123 -19
- package/dist/dashboard/meter-parts.d.ts +8 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +345 -146
- package/dist/dashboard/meter.d.ts +50 -63
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +24 -3
- package/dist/dashboard/meter.module.css +79 -65
- package/dist/dashboard/meter.module.css.d.ts +7 -7
- package/dist/dashboard/page-summary.d.ts +20 -0
- package/dist/dashboard/page-summary.d.ts.map +1 -0
- package/dist/dashboard/page-summary.js +28 -0
- package/dist/dashboard/page-summary.module.css +89 -0
- package/dist/dashboard/page-summary.module.css.d.ts +15 -0
- package/dist/dashboard/query-state.d.ts +1 -1
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +3 -2
- package/dist/dashboard/section.d.ts +25 -2
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +10 -5
- package/dist/dashboard/section.module.css +23 -0
- package/dist/dashboard/section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +1 -1
- package/dist/dashboard/stat-card.d.ts +4 -2
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +7 -4
- package/dist/dashboard/stat-card.module.css +17 -0
- package/dist/dashboard/stat-strip.d.ts +24 -1
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +97 -39
- package/dist/dashboard/stat-strip.module.css +147 -17
- package/dist/dashboard/stat-strip.module.css.d.ts +8 -0
- package/dist/dashboard/visual-slot.d.ts +8 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -0
- package/dist/dashboard/visual-slot.js +7 -0
- package/dist/guard/index.d.ts +15 -2
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +14 -0
- package/dist/guard/palette.d.ts +51 -0
- package/dist/guard/palette.d.ts.map +1 -0
- package/dist/guard/palette.js +190 -0
- package/dist/guard/series-file.d.ts +15 -0
- package/dist/guard/series-file.d.ts.map +1 -0
- package/dist/guard/series-file.js +29 -0
- package/dist/guard/types.d.ts +3 -3
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/guard/vx-names.d.ts.map +1 -1
- package/dist/guard/vx-names.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/styles.css +34 -2
- package/dist/surfaces.d.ts +1 -1
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +2 -0
- package/dist/theme/chrome-vars.d.ts +20 -5
- package/dist/theme/chrome-vars.d.ts.map +1 -1
- package/dist/theme/chrome-vars.js +46 -3
- package/dist/theme/controls.module.css +33 -0
- package/dist/theme/controls.module.css.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +11 -5
- package/dist/tokens/core.d.ts +2 -1
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +6 -1
- package/dist/tokens/derive.d.ts +3 -1
- package/dist/tokens/derive.d.ts.map +1 -1
- package/dist/tokens/derive.js +16 -1
- package/dist/tokens/oklab.d.ts +28 -0
- package/dist/tokens/oklab.d.ts.map +1 -0
- package/dist/tokens/oklab.js +73 -0
- package/dist/tokens/palette.d.ts +4 -0
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +4 -0
- package/dist/tokens/status-text.d.ts.map +1 -1
- package/dist/tokens/status-text.js +3 -1
- package/llms.txt +43 -23
- package/package.json +1 -1
- package/src/charts/BandStrip.tsx +33 -3
- package/src/charts/Bars.tsx +6 -0
- package/src/charts/CartesianChart.tsx +16 -3
- package/src/charts/ChartCard.tsx +43 -7
- package/src/charts/DualPanel.tsx +3 -6
- package/src/charts/Heatmap.tsx +54 -5
- package/src/charts/Lines.tsx +56 -10
- package/src/charts/MirroredBars.tsx +3 -5
- package/src/charts/Sparkline.tsx +50 -13
- package/src/charts/StackedArea.tsx +14 -4
- package/src/charts/band-fold.ts +31 -1
- package/src/charts/chart-box.module.css +19 -0
- package/src/charts/chart-card.module.css +25 -0
- package/src/charts/chart-legend.module.css +7 -0
- package/src/charts/compile.ts +210 -85
- package/src/charts/labels.ts +48 -14
- package/src/charts/legend.tsx +10 -20
- package/src/charts/marks.ts +1 -1
- package/src/charts/panel.tsx +1 -16
- package/src/charts/ref-label.ts +104 -0
- package/src/charts/scales.ts +22 -2
- package/src/charts/sparkline.module.css +10 -11
- package/src/charts/sparkline.module.css.d.ts +1 -2
- package/src/charts/state.tsx +12 -1
- package/src/charts/types.ts +14 -5
- package/src/cli/check-theme.ts +3 -0
- package/src/cli/doctor-upgrade.ts +1 -1
- package/src/cli/help.ts +18 -1
- package/src/cli/index.ts +48 -17
- package/src/cli/init.ts +102 -4
- package/src/cli/shot/capture.ts +266 -34
- package/src/cli/shot/detect.ts +550 -0
- package/src/cli/shot/index.ts +8 -4
- package/src/cli/shot/measure.ts +4 -0
- package/src/cli/shot/playwright.ts +2 -2
- package/src/cli/shot/types.ts +8 -1
- package/src/cli/sync.ts +4 -2
- package/src/common/retry-button.module.css +58 -0
- package/src/common/retry-button.module.css.d.ts +8 -0
- package/src/common/retry-button.tsx +29 -0
- package/src/controls/controls.module.css +11 -1
- package/src/controls/filter-pill.tsx +2 -0
- package/src/controls/sync-button.module.css +34 -2
- package/src/controls/sync-button.module.css.d.ts +1 -0
- package/src/controls/sync-button.tsx +40 -4
- package/src/dashboard/bar-list.module.css +53 -0
- package/src/dashboard/bar-list.module.css.d.ts +1 -0
- package/src/dashboard/bar-list.tsx +88 -76
- package/src/dashboard/index.ts +1 -0
- package/src/dashboard/meter-model.ts +265 -28
- package/src/dashboard/meter-parts.tsx +424 -163
- package/src/dashboard/meter.module.css +79 -65
- package/src/dashboard/meter.module.css.d.ts +7 -7
- package/src/dashboard/meter.tsx +77 -17
- package/src/dashboard/page-summary.module.css +89 -0
- package/src/dashboard/page-summary.module.css.d.ts +15 -0
- package/src/dashboard/page-summary.tsx +95 -0
- package/src/dashboard/query-state.tsx +4 -7
- package/src/dashboard/section.module.css +23 -0
- package/src/dashboard/section.module.css.d.ts +1 -0
- package/src/dashboard/section.tsx +59 -11
- package/src/dashboard/stat-card-parts.tsx +5 -1
- package/src/dashboard/stat-card.module.css +17 -0
- package/src/dashboard/stat-card.tsx +14 -5
- package/src/dashboard/stat-strip.module.css +147 -17
- package/src/dashboard/stat-strip.module.css.d.ts +8 -0
- package/src/dashboard/stat-strip.tsx +182 -56
- package/src/dashboard/visual-slot.ts +17 -0
- package/src/guard/index.ts +16 -4
- package/src/guard/palette.ts +261 -0
- package/src/guard/series-file.ts +51 -0
- package/src/guard/types.ts +3 -2
- package/src/guard/vx-names.ts +2 -0
- package/src/index.ts +2 -0
- package/src/styles.css +34 -2
- package/src/surfaces.ts +2 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +220 -60
- package/src/theme/chrome-vars.ts +77 -8
- package/src/theme/controls.module.css +33 -0
- package/src/theme/controls.module.css.d.ts +1 -0
- package/src/theme/index.ts +18 -5
- package/src/tokens/core.ts +4 -1
- package/src/tokens/derive.ts +32 -3
- package/src/tokens/oklab.ts +97 -0
- package/src/tokens/palette.ts +4 -0
- package/src/tokens/status-text.ts +2 -0
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
* the re-derivation this exists to delete. `LoadingState` / `ErrorState` ship alongside as the
|
|
15
15
|
* escape hatch for a page that must place its branches in different DOM positions.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { Center, Group, Loader, Stack, Text } from '@mantine/core'
|
|
18
18
|
import type { CSSProperties, ReactNode } from 'react'
|
|
19
19
|
import { toErrorMessage } from '../common/errors'
|
|
20
20
|
import { cx } from '../common/props'
|
|
21
|
+
import { RetryButton } from '../common/retry-button'
|
|
21
22
|
import type { BasaltProps, SlotStylesProps } from '../common/props'
|
|
22
23
|
import { VX } from '../tokens'
|
|
23
24
|
import { StatusDot } from '../theme/status-dot'
|
|
@@ -104,7 +105,7 @@ export type ErrorStateProps = BasaltProps & {
|
|
|
104
105
|
/** Shown only when the server body carries no readable message. */
|
|
105
106
|
fallback?: string
|
|
106
107
|
onRetry?: () => void
|
|
107
|
-
/** Disables
|
|
108
|
+
/** Disables the retry button while a refetch is in flight. */
|
|
108
109
|
retrying?: boolean
|
|
109
110
|
/** How loud this state is. Default `'page'`. */
|
|
110
111
|
tier?: QueryStateTier
|
|
@@ -148,11 +149,7 @@ export function ErrorState({
|
|
|
148
149
|
</Text>
|
|
149
150
|
{(onRetry ?? action) !== undefined && (
|
|
150
151
|
<Group gap="xs">
|
|
151
|
-
{onRetry &&
|
|
152
|
-
<Button size="xs" variant="default" loading={retrying} onClick={onRetry}>
|
|
153
|
-
Retry
|
|
154
|
-
</Button>
|
|
155
|
-
)}
|
|
152
|
+
{onRetry && <RetryButton onClick={onRetry} retrying={retrying} />}
|
|
156
153
|
{action}
|
|
157
154
|
</Group>
|
|
158
155
|
)}
|
|
@@ -41,6 +41,29 @@
|
|
|
41
41
|
gap: 0;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/*
|
|
45
|
+
* Three type sizes in one section, not four (argo calendar next-days counted group head 11 + row
|
|
46
|
+
* title 13 + meta 12 + section title 15). The `group` tier is the one head this package draws below
|
|
47
|
+
* the section title, and it was on `micro` (11) — a step of its own. It joins the `xs` (12) step the
|
|
48
|
+
* rows' meta already uses; the head stays a mono UPPERCASE caption, which is the one place D33 keeps
|
|
49
|
+
* mono, so only its size moves and the rank is still carried by case, face and tracking. Section
|
|
50
|
+
* title (15), row title (13) and meta + group head (12) are then the whole ladder.
|
|
51
|
+
*/
|
|
52
|
+
.root[data-tier='group'] [data-widget-title] {
|
|
53
|
+
font-size: var(--vx-text-xs);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
* The untitled header: `tabs` (and `actions`) alone, one control row at the `ctl` height, so the
|
|
58
|
+
* row costs what the controls cost and nothing for a heading that is not there.
|
|
59
|
+
*/
|
|
60
|
+
.tabsRow {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: var(--vx-space-control-gap);
|
|
64
|
+
min-width: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
44
67
|
/*
|
|
45
68
|
* `summary` — the always-visible row under the header. No border, no background (the Section owns
|
|
46
69
|
* neither); it is a plain flow row, so a consumer's `Group` of stats or one line of `Text` lands
|
|
@@ -75,7 +75,25 @@ export type SectionSlot = 'root' | 'header' | 'body'
|
|
|
75
75
|
// intersecting the two would let a caller write `classNames={{ metric: … }}` on a `Section` and get
|
|
76
76
|
// silence. Section's three slots are its whole styling contract; the header's own slots are reached
|
|
77
77
|
// on a `WidgetHeader`.
|
|
78
|
-
|
|
78
|
+
/** The props only a drawn heading can carry; an untitled `Section` forbids each (`?: never`). */
|
|
79
|
+
type HeaderOnlyKey =
|
|
80
|
+
| 'icon'
|
|
81
|
+
| 'subtitle'
|
|
82
|
+
| 'info'
|
|
83
|
+
| 'value'
|
|
84
|
+
| 'unit'
|
|
85
|
+
| 'delta'
|
|
86
|
+
| 'deltaPeriod'
|
|
87
|
+
| 'deltaPolarity'
|
|
88
|
+
| 'deltaFormat'
|
|
89
|
+
| 'deltaGlyph'
|
|
90
|
+
| 'sparkline'
|
|
91
|
+
| 'count'
|
|
92
|
+
|
|
93
|
+
type SectionBaseProps = Omit<
|
|
94
|
+
WidgetHeaderProps,
|
|
95
|
+
'tier' | 'classNames' | 'actions' | 'title' | HeaderOnlyKey
|
|
96
|
+
> &
|
|
79
97
|
BasaltProps &
|
|
80
98
|
SlotStylesProps<SectionSlot> & {
|
|
81
99
|
/**
|
|
@@ -128,6 +146,24 @@ export type SectionProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'acti
|
|
|
128
146
|
children: ReactNode
|
|
129
147
|
}
|
|
130
148
|
|
|
149
|
+
/**
|
|
150
|
+
* A Section names itself with `title` — or, with no title, by its `tabs` alone (argo's m365 phone
|
|
151
|
+
* pane switch: a heading restating the open pane's name beside the tabs that already say it). The
|
|
152
|
+
* header row then collapses to the tabs (and `actions`): no heading, no fold, and none of the
|
|
153
|
+
* heading-only props (`count`, `info`, `subtitle`, `icon`, the hero metric) — each is a type error.
|
|
154
|
+
*
|
|
155
|
+
* Naming: a `ViewTabs` in `tabs` already names its own tablist, so the section adds no second name
|
|
156
|
+
* and no `group` role. Pass `aria-label` only when the tabs are not self-naming — it then makes the
|
|
157
|
+
* root a labelled `group`.
|
|
158
|
+
*/
|
|
159
|
+
export type SectionProps = SectionBaseProps &
|
|
160
|
+
(
|
|
161
|
+
| (Pick<WidgetHeaderProps, HeaderOnlyKey> & { title: string; 'aria-label'?: never })
|
|
162
|
+
| ({ title?: undefined; tabs: ReactNode; 'aria-label'?: string } & {
|
|
163
|
+
[K in HeaderOnlyKey]?: never
|
|
164
|
+
})
|
|
165
|
+
)
|
|
166
|
+
|
|
131
167
|
function ChevronToggle({
|
|
132
168
|
open,
|
|
133
169
|
onToggle,
|
|
@@ -187,9 +223,11 @@ export function Section({
|
|
|
187
223
|
className,
|
|
188
224
|
style,
|
|
189
225
|
classNames,
|
|
226
|
+
'aria-label': ariaLabel,
|
|
190
227
|
...headerProps
|
|
191
228
|
}: SectionProps) {
|
|
192
229
|
const { title } = headerProps
|
|
230
|
+
const untitled = title === undefined
|
|
193
231
|
|
|
194
232
|
// A `persistKey` with nothing to fold writes a localStorage key nobody ever reads back — the
|
|
195
233
|
// shape a consumer lands on after deleting `collapsible` and leaving the key behind. It renders
|
|
@@ -242,16 +280,18 @@ export function Section({
|
|
|
242
280
|
const rootStyle =
|
|
243
281
|
anchorStyle === undefined && style === undefined ? undefined : { ...anchorStyle, ...style }
|
|
244
282
|
|
|
283
|
+
// An untitled section has nothing to fold behind: the tabs ARE the header.
|
|
284
|
+
const foldable = collapsible && !untitled
|
|
245
285
|
const headerActions =
|
|
246
|
-
tabs !== undefined || actions !== undefined ||
|
|
286
|
+
tabs !== undefined || actions !== undefined || foldable ? (
|
|
247
287
|
<>
|
|
248
|
-
{tabs !== undefined && open && <CtlSlot>{tabs}</CtlSlot>}
|
|
288
|
+
{tabs !== undefined && (open || untitled) && <CtlSlot>{tabs}</CtlSlot>}
|
|
249
289
|
{actions !== undefined && (
|
|
250
290
|
<CtlSlot>
|
|
251
291
|
<BarActionSlot actions={actions} />
|
|
252
292
|
</CtlSlot>
|
|
253
293
|
)}
|
|
254
|
-
{
|
|
294
|
+
{foldable && (
|
|
255
295
|
<ChevronToggle open={open} onToggle={() => setOpen(!open)} controls={bodyId} />
|
|
256
296
|
)}
|
|
257
297
|
</>
|
|
@@ -261,17 +301,25 @@ export function Section({
|
|
|
261
301
|
<div
|
|
262
302
|
className={cx(classes.root, classNames?.root, className)}
|
|
263
303
|
data-tier={tier}
|
|
304
|
+
{...(untitled && ariaLabel !== undefined && { role: 'group', 'aria-label': ariaLabel })}
|
|
264
305
|
{...(id !== undefined && { id })}
|
|
265
306
|
{...(rootStyle !== undefined && { style: rootStyle })}
|
|
266
307
|
>
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
308
|
+
{untitled ? (
|
|
309
|
+
<div className={cx(classes.tabsRow, classNames?.header)} data-basalt-hit-scope>
|
|
310
|
+
{headerActions}
|
|
311
|
+
</div>
|
|
312
|
+
) : (
|
|
313
|
+
<WidgetHeader
|
|
314
|
+
tier={tier}
|
|
315
|
+
{...(headerProps as Pick<WidgetHeaderProps, HeaderOnlyKey>)}
|
|
316
|
+
title={title}
|
|
317
|
+
{...(classNames?.header !== undefined && { className: classNames.header })}
|
|
318
|
+
{...(headerActions !== undefined && { actions: headerActions })}
|
|
319
|
+
/>
|
|
320
|
+
)}
|
|
273
321
|
{summary !== undefined && <div className={classes.summary}>{summary}</div>}
|
|
274
|
-
{open && (
|
|
322
|
+
{(open || untitled) && (
|
|
275
323
|
<div id={bodyId} className={cx(classes.body, classNames?.body)}>
|
|
276
324
|
{query === undefined ? (
|
|
277
325
|
children
|
|
@@ -55,7 +55,11 @@ export function CaptionRow({ title, icon, info, qualifier, tone, actions }: Capt
|
|
|
55
55
|
/>
|
|
56
56
|
)}
|
|
57
57
|
</div>
|
|
58
|
-
{qualifier !== undefined &&
|
|
58
|
+
{qualifier !== undefined && (
|
|
59
|
+
<span className={classes.qualifier} title={qualifier}>
|
|
60
|
+
{qualifier}
|
|
61
|
+
</span>
|
|
62
|
+
)}
|
|
59
63
|
</div>
|
|
60
64
|
{/* `tier="widget"`: the caption row is 24px (`--vx-space-control-height-widget`), so a card
|
|
61
65
|
with a kebab is the same height as one without (`theme/ctl-theme.tsx`). */}
|
|
@@ -96,6 +96,23 @@
|
|
|
96
96
|
min-width: 0;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/* A card too narrow to share its caption row (a two-column phone cell, ~170px) never wraps the
|
|
100
|
+
* qualifier under the caption: that second line pushed the value below its row neighbours'. The
|
|
101
|
+
* caption row stays one line; the qualifier truncates (full text in its `title`). */
|
|
102
|
+
@container basalt-card (max-width: 239.9px) {
|
|
103
|
+
.captionMain {
|
|
104
|
+
flex-wrap: nowrap;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.qualifier {
|
|
108
|
+
flex: 0 1 auto;
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
text-overflow: ellipsis;
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
text-align: end;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
99
116
|
/* Law C15: the shared hit overlay; `--vx-hit-gap` caps the expansion at the control gap. */
|
|
100
117
|
.actions {
|
|
101
118
|
--vx-hit-gap: var(--vx-space-control-gap);
|
|
@@ -112,6 +112,7 @@ import type { BasaltProps, SlotStylesProps, Tone } from '../common/props'
|
|
|
112
112
|
import { ErrorState, QueryState, resolveQueryBranch } from './query-state'
|
|
113
113
|
import type { QueryBranch, QueryStateLike } from './query-state'
|
|
114
114
|
import classes from './stat-card.module.css'
|
|
115
|
+
import { HOSTED, VisualSlotContext } from './visual-slot'
|
|
115
116
|
|
|
116
117
|
/**
|
|
117
118
|
* The boxes `StatCard` paints, and the whole styling seam it offers (`common/props.ts`).
|
|
@@ -216,8 +217,10 @@ export type StatCardProps = BasaltProps &
|
|
|
216
217
|
value: string
|
|
217
218
|
/**
|
|
218
219
|
* Right-aligned on the caption row, `micro` muted: the period, target or source the figure is
|
|
219
|
-
* measured over (`30 days`, `target 99.9%`). Wraps under the caption when the card is too
|
|
220
|
-
* for both.
|
|
220
|
+
* measured over (`30 days`, `target 99.9%`). Wraps under the caption when the card is too
|
|
221
|
+
* narrow for both. Only in a card narrower than 240px does it truncate instead (the full text
|
|
222
|
+
* is its `title`); between 240px and the width it fits, a long one still wraps and moves the
|
|
223
|
+
* value down a line. Not a restatement of the caption.
|
|
221
224
|
*/
|
|
222
225
|
qualifier?: string
|
|
223
226
|
/**
|
|
@@ -325,7 +328,7 @@ function renderValueBody({
|
|
|
325
328
|
return (
|
|
326
329
|
<ErrorState
|
|
327
330
|
error={resolved.error}
|
|
328
|
-
title="Could not load
|
|
331
|
+
title="Could not load"
|
|
329
332
|
tier="section"
|
|
330
333
|
onRetry={() => void resolved.query.refetch()}
|
|
331
334
|
retrying={resolved.query.fetchStatus === 'fetching'}
|
|
@@ -357,12 +360,16 @@ function renderVisualNode({
|
|
|
357
360
|
function renderFooterNode({
|
|
358
361
|
subtitle,
|
|
359
362
|
pending,
|
|
363
|
+
ready,
|
|
360
364
|
}: {
|
|
361
365
|
subtitle: string | undefined
|
|
362
366
|
pending: boolean
|
|
367
|
+
ready: boolean
|
|
363
368
|
}): ReactNode {
|
|
364
369
|
if (subtitle === undefined) return null
|
|
365
370
|
if (pending) return <FooterSkeleton />
|
|
371
|
+
// The footer captions the visual; with no figure drawn (empty, failed) it would caption nothing.
|
|
372
|
+
if (!ready) return null
|
|
366
373
|
return (
|
|
367
374
|
<p className={classes.footer} title={subtitle}>
|
|
368
375
|
{subtitle}
|
|
@@ -448,7 +455,9 @@ export function StatCard({
|
|
|
448
455
|
>
|
|
449
456
|
{/* A measured slot renders nothing on the first commit (width 0) — an SVG at width 0 is a
|
|
450
457
|
visible 0-width box that then jumps, which is worse than one frame of nothing. */}
|
|
451
|
-
{
|
|
458
|
+
<VisualSlotContext.Provider value={tone === undefined ? HOSTED : { tone }}>
|
|
459
|
+
{isRender ? measured.width > 0 && sparkline(measured) : sparkline}
|
|
460
|
+
</VisualSlotContext.Provider>
|
|
452
461
|
</div>
|
|
453
462
|
)
|
|
454
463
|
|
|
@@ -484,7 +493,7 @@ export function StatCard({
|
|
|
484
493
|
|
|
485
494
|
const hasBleedVisual = sparkline !== undefined && bleeds
|
|
486
495
|
const visualNode = renderVisualNode({ show: hasBleedVisual, pending, slot: sparklineSlot })
|
|
487
|
-
const footerNode = renderFooterNode({ subtitle, pending })
|
|
496
|
+
const footerNode = renderFooterNode({ subtitle, pending, ready })
|
|
488
497
|
|
|
489
498
|
return (
|
|
490
499
|
<Card
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* StatGroup `variant="strip"`: one joined surface, cells split by 1px hairlines.
|
|
3
3
|
*
|
|
4
|
-
* The hairlines are LEADING
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* coloured edge: the one
|
|
4
|
+
* The hairlines are LEADING edges (inline-start + block-start) drawn as outer box-shadows, so they
|
|
5
|
+
* take no layout space and every cell keeps the same `stack-md` inset. `.clip` hides the ones that
|
|
6
|
+
* lead a row or the strip by pulling the grid 1px up/left inside an `overflow: hidden` box. That is
|
|
7
|
+
* why the rail survives any column count and any wrap with no `nth-child` bookkeeping
|
|
8
|
+
* (`stat-group.module.css` needs it because its cells are not clipped). No coloured edge: the one
|
|
9
|
+
* surface is the Card's.
|
|
9
10
|
*
|
|
10
11
|
* The column law keys on the CONTAINER like `StatGroup`'s own: two columns at < 480px (the `regular` class boundary) with an odd
|
|
11
12
|
* last cell spanning, never one; up to three below 800px; the full `cols` from 800px.
|
|
@@ -26,19 +27,86 @@
|
|
|
26
27
|
margin: -1px 0 0 -1px;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
/* The CELL is the row-high column: it owns the hairlines, so they run the whole row however short
|
|
31
|
+
* the cell inside it ends. It paints nothing else — the one surface stays the Card's. */
|
|
29
32
|
.cell {
|
|
30
|
-
display:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
display: grid;
|
|
34
|
+
grid-row: span 6;
|
|
35
|
+
grid-template-rows: subgrid;
|
|
33
36
|
min-width: 0;
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
/* The foot inset lives HERE, on the row-high slot (it lands on the last track of every cell
|
|
38
|
+
* alike). A cell that ends early must not carry it: its padding would inflate the shared track
|
|
39
|
+
* it ends in and push the parts below out of line. */
|
|
40
|
+
padding-block-end: var(--vx-space-stack-md);
|
|
41
|
+
box-shadow:
|
|
42
|
+
-1px 0 0 var(--vx-divider),
|
|
43
|
+
0 -1px 0 var(--vx-divider);
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
/* The
|
|
39
|
-
*
|
|
40
|
-
.
|
|
41
|
-
|
|
46
|
+
/* The CONTENT spans the same six tracks (parts align through the subgrid) but is `align-self: start`,
|
|
47
|
+
* so its own box ends at its content instead of at the row's bottom. */
|
|
48
|
+
.content {
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-row: 1 / span var(--basalt-strip-span, 6);
|
|
51
|
+
grid-template-rows: subgrid;
|
|
52
|
+
align-self: start;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
padding: var(--vx-space-stack-md) var(--vx-space-stack-md) 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Forced colors drop box-shadows, so the hairlines come back as CanvasText borders. Every cell takes
|
|
58
|
+
* both, so they stay level with each other; `.clip` still hides the leading ones. */
|
|
59
|
+
@media (forced-colors: active) {
|
|
60
|
+
.cell {
|
|
61
|
+
border-inline-start: 1px solid CanvasText;
|
|
62
|
+
border-block-start: 1px solid CanvasText;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Cells align by PART. Every cell sits on the same six tracks of `.cells` (caption, hero, hero footer,
|
|
67
|
+
* visual, rows, footer), so a row of cells shares one caption top and one value baseline, and a void opens
|
|
68
|
+
* only where a sibling's same part is taller. A cell SPANS only down to its last part
|
|
69
|
+
* (`--basalt-strip-span`), so its own box ends at its content; the slot around it runs the whole
|
|
70
|
+
* row. A part a cell lacks collapses its track (the spacing is a margin on the part, not a gap).
|
|
71
|
+
* A footer rides with what it captions: under a hero alone it takes the hero-footer track right
|
|
72
|
+
* below the hero, under a visual it rides in the visual track (`.visualStack`); only a rows
|
|
73
|
+
* cell's footer uses the shared footer track. A hero-less cell (rows only) starts its rows in the
|
|
74
|
+
* visual track, so the hero track above them is the one void, and only as tall as a sibling's
|
|
75
|
+
* value. */
|
|
76
|
+
.content > * {
|
|
77
|
+
grid-column: 1;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.content > :not(.captionLine) {
|
|
82
|
+
margin-block-start: var(--vx-space-stack-sm);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.valueRow,
|
|
86
|
+
.skeletonValue,
|
|
87
|
+
.error {
|
|
88
|
+
grid-row: 2;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* A hero's footer has its own track right under the hero track, so it hugs the value however tall a
|
|
92
|
+
* sibling's visual is, and a cell without a footer never spans (or reserves) it. */
|
|
93
|
+
.content > .heroFooter {
|
|
94
|
+
grid-row: 3;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.content > .visualStack,
|
|
98
|
+
.content > .reason,
|
|
99
|
+
.content > .rows {
|
|
100
|
+
grid-row: 4;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.content[data-strip-has-visual] > .rows {
|
|
104
|
+
grid-row: 5;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.content > .footer:not(.heroFooter) {
|
|
108
|
+
grid-row: 6;
|
|
109
|
+
align-self: start;
|
|
42
110
|
}
|
|
43
111
|
|
|
44
112
|
@container basalt-grid (max-width: 479.9px) {
|
|
@@ -58,7 +126,18 @@
|
|
|
58
126
|
}
|
|
59
127
|
|
|
60
128
|
.captionLine {
|
|
129
|
+
grid-row: 1;
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-wrap: nowrap;
|
|
132
|
+
align-items: center;
|
|
133
|
+
column-gap: var(--vx-space-control-gap);
|
|
134
|
+
min-width: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Caption + qualifier wrap among themselves; the `action` beside them never joins the wrap. */
|
|
138
|
+
.captionMain {
|
|
61
139
|
display: flex;
|
|
140
|
+
flex: 1 1 0;
|
|
62
141
|
flex-wrap: wrap;
|
|
63
142
|
align-items: center;
|
|
64
143
|
column-gap: var(--vx-space-control-gap);
|
|
@@ -96,6 +175,14 @@
|
|
|
96
175
|
overflow-wrap: anywhere;
|
|
97
176
|
}
|
|
98
177
|
|
|
178
|
+
/* A control at the end of the caption line: it keeps its size, the caption truncates first. */
|
|
179
|
+
.action {
|
|
180
|
+
display: inline-flex;
|
|
181
|
+
flex: none;
|
|
182
|
+
align-items: center;
|
|
183
|
+
margin-inline-start: auto;
|
|
184
|
+
}
|
|
185
|
+
|
|
99
186
|
.valueRow {
|
|
100
187
|
display: flex;
|
|
101
188
|
flex-wrap: wrap;
|
|
@@ -129,7 +216,7 @@
|
|
|
129
216
|
height: calc(var(--vx-text-kpi) * 1.25);
|
|
130
217
|
}
|
|
131
218
|
|
|
132
|
-
.
|
|
219
|
+
.content[data-stale] {
|
|
133
220
|
/* The package's one dimmed-state value (controls.module.css, panel-row.module.css). */
|
|
134
221
|
opacity: 0.55;
|
|
135
222
|
}
|
|
@@ -143,10 +230,14 @@
|
|
|
143
230
|
min-width: 0;
|
|
144
231
|
}
|
|
145
232
|
|
|
233
|
+
.visualStack > .footer {
|
|
234
|
+
margin-block-start: var(--vx-space-stack-sm);
|
|
235
|
+
}
|
|
236
|
+
|
|
146
237
|
/* A Sparkline's hover readout takes this line above its plot (`charts/sparkline.module.css`). The
|
|
147
238
|
* cell's own stack gap already sits above it; the slot reserves the rest, so the chip never covers
|
|
148
239
|
* the value. */
|
|
149
|
-
.
|
|
240
|
+
.content {
|
|
150
241
|
--basalt-spark-readout-h: 1.125rem;
|
|
151
242
|
}
|
|
152
243
|
|
|
@@ -154,8 +245,36 @@
|
|
|
154
245
|
padding-top: max(0px, calc(var(--basalt-spark-readout-h) - var(--vx-space-stack-sm)));
|
|
155
246
|
}
|
|
156
247
|
|
|
248
|
+
/* An empty cell's reason and an errored cell's message: one muted `sm` line, wrapping rather than
|
|
249
|
+
* clipping (a 390px two-column cell is ~170px wide). */
|
|
250
|
+
.reason {
|
|
251
|
+
margin: 0;
|
|
252
|
+
min-width: 0;
|
|
253
|
+
font-size: var(--vx-text-sm);
|
|
254
|
+
line-height: 1.3;
|
|
255
|
+
color: var(--vx-muted);
|
|
256
|
+
overflow-wrap: anywhere;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* The compact error anatomy: dot + word, the message, Retry — a left-aligned stack in the cell. */
|
|
260
|
+
.error {
|
|
261
|
+
display: flex;
|
|
262
|
+
flex-direction: column;
|
|
263
|
+
align-items: flex-start;
|
|
264
|
+
gap: var(--vx-space-stack-xs);
|
|
265
|
+
min-width: 0;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.errorHead {
|
|
269
|
+
display: inline-flex;
|
|
270
|
+
align-items: center;
|
|
271
|
+
gap: var(--vx-space-stack-sm);
|
|
272
|
+
font-size: var(--vx-text-sm);
|
|
273
|
+
font-weight: 500;
|
|
274
|
+
color: var(--vx-ink);
|
|
275
|
+
}
|
|
276
|
+
|
|
157
277
|
.footer {
|
|
158
|
-
margin-top: auto;
|
|
159
278
|
font-size: var(--vx-text-sm);
|
|
160
279
|
color: var(--vx-muted);
|
|
161
280
|
}
|
|
@@ -199,6 +318,17 @@
|
|
|
199
318
|
margin-left: -1px;
|
|
200
319
|
}
|
|
201
320
|
|
|
321
|
+
/* A meter's start and end captions read as one phrase (name, then value) however wide the track. */
|
|
322
|
+
.footerCell [data-meter-captions] {
|
|
323
|
+
justify-content: flex-start;
|
|
324
|
+
column-gap: var(--vx-space-stack-md);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.footerCell [data-meter-captions] > * {
|
|
328
|
+
margin-inline-start: 0;
|
|
329
|
+
text-align: start;
|
|
330
|
+
}
|
|
331
|
+
|
|
202
332
|
.footerCell {
|
|
203
333
|
flex: 1 1 14rem;
|
|
204
334
|
min-width: 0;
|
|
@@ -7,16 +7,24 @@ declare const classes: {
|
|
|
7
7
|
readonly clip: string
|
|
8
8
|
readonly cells: string
|
|
9
9
|
readonly cell: string
|
|
10
|
+
readonly content: string
|
|
11
|
+
readonly action: string
|
|
10
12
|
readonly captionLine: string
|
|
13
|
+
readonly captionMain: string
|
|
11
14
|
readonly lead: string
|
|
12
15
|
readonly caption: string
|
|
13
16
|
readonly qualifier: string
|
|
14
17
|
readonly valueRow: string
|
|
18
|
+
readonly heroFooter: string
|
|
15
19
|
readonly value: string
|
|
16
20
|
readonly unit: string
|
|
17
21
|
readonly skeletonValue: string
|
|
18
22
|
readonly skeletonRow: string
|
|
19
23
|
readonly visual: string
|
|
24
|
+
readonly visualStack: string
|
|
25
|
+
readonly reason: string
|
|
26
|
+
readonly error: string
|
|
27
|
+
readonly errorHead: string
|
|
20
28
|
readonly footer: string
|
|
21
29
|
readonly rows: string
|
|
22
30
|
readonly row: string
|