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
|
@@ -107,12 +107,16 @@ import type {
|
|
|
107
107
|
WidgetHeaderTitleProps,
|
|
108
108
|
} from './widget-header'
|
|
109
109
|
import { DeltaBadge } from './delta-badge'
|
|
110
|
-
import { cx } from '../common/props'
|
|
111
|
-
import type { BasaltProps, SlotStylesProps, Tone } from '../common/props'
|
|
110
|
+
import { cx, pickDataAttributes } from '../common/props'
|
|
111
|
+
import type { BasaltProps, DataAttributes, SlotStylesProps, Tone } from '../common/props'
|
|
112
|
+
import { splitEmptyCopy } from '../common/empty-copy'
|
|
113
|
+
import { EmptyState } from './empty-state'
|
|
114
|
+
import { couldNotLoad, HostTitleContext } from '../common/could-not-load'
|
|
112
115
|
import { ErrorState, QueryState, resolveQueryBranch } from './query-state'
|
|
113
116
|
import type { QueryBranch, QueryStateLike } from './query-state'
|
|
114
117
|
import classes from './stat-card.module.css'
|
|
115
|
-
import { HOSTED, VisualSlotContext } from './visual-slot'
|
|
118
|
+
import { HOSTED, HOSTED_COMPACT, VisualSlotContext } from './visual-slot'
|
|
119
|
+
import type { VisualSlot } from './visual-slot'
|
|
116
120
|
|
|
117
121
|
/**
|
|
118
122
|
* The boxes `StatCard` paints, and the whole styling seam it offers (`common/props.ts`).
|
|
@@ -208,6 +212,7 @@ function useSlotWidth(active: boolean): {
|
|
|
208
212
|
* three slices.
|
|
209
213
|
*/
|
|
210
214
|
export type StatCardProps = BasaltProps &
|
|
215
|
+
DataAttributes &
|
|
211
216
|
SlotStylesProps<StatCardSlot> &
|
|
212
217
|
Omit<WidgetHeaderTitleProps, 'subtitle'> &
|
|
213
218
|
Omit<WidgetHeaderMetricProps, 'value'> &
|
|
@@ -310,32 +315,45 @@ function renderValueBody({
|
|
|
310
315
|
resolved,
|
|
311
316
|
figure,
|
|
312
317
|
emptyText,
|
|
318
|
+
hasDelta,
|
|
319
|
+
label,
|
|
313
320
|
}: {
|
|
321
|
+
hasDelta: boolean
|
|
322
|
+
label: string | undefined
|
|
314
323
|
pending: boolean
|
|
315
324
|
resolved: QueryBranch<unknown> | undefined
|
|
316
325
|
figure: ReactNode
|
|
317
326
|
emptyText: string
|
|
318
327
|
}): ReactNode {
|
|
319
|
-
|
|
328
|
+
const copy = splitEmptyCopy(emptyText)
|
|
329
|
+
if (resolved === undefined) return pending ? <ValueSkeleton delta={hasDelta} /> : figure
|
|
320
330
|
// `loading` with a query still shows the skeleton, but a failed query is never hidden by it.
|
|
321
|
-
if (pending && resolved.kind !== 'error') return <ValueSkeleton />
|
|
331
|
+
if (pending && resolved.kind !== 'error') return <ValueSkeleton delta={hasDelta} />
|
|
322
332
|
switch (resolved.kind) {
|
|
323
333
|
case 'pending':
|
|
324
|
-
return <ValueSkeleton />
|
|
334
|
+
return <ValueSkeleton delta={hasDelta} />
|
|
325
335
|
case 'error':
|
|
326
336
|
// The error state itself — not `QueryState` with nothing to wrap, which over cached-empty data
|
|
327
337
|
// would draw its "cached data" banner above an empty region.
|
|
328
338
|
return (
|
|
329
339
|
<ErrorState
|
|
330
340
|
error={resolved.error}
|
|
331
|
-
title=
|
|
341
|
+
title={couldNotLoad(label)}
|
|
332
342
|
tier="section"
|
|
333
343
|
onRetry={() => void resolved.query.refetch()}
|
|
334
344
|
retrying={resolved.query.fetchStatus === 'fetching'}
|
|
335
345
|
/>
|
|
336
346
|
)
|
|
337
347
|
case 'empty':
|
|
338
|
-
return
|
|
348
|
+
return (
|
|
349
|
+
<EmptyState
|
|
350
|
+
tier="section"
|
|
351
|
+
title={copy.title}
|
|
352
|
+
{...(copy.description !== undefined && { description: copy.description })}
|
|
353
|
+
className={classes.empty}
|
|
354
|
+
style={{ padding: 'var(--vx-space-stack-md) var(--vx-space-stack-lg)' }}
|
|
355
|
+
/>
|
|
356
|
+
)
|
|
339
357
|
case 'ready':
|
|
340
358
|
return figure
|
|
341
359
|
default:
|
|
@@ -377,6 +395,18 @@ function renderFooterNode({
|
|
|
377
395
|
)
|
|
378
396
|
}
|
|
379
397
|
|
|
398
|
+
/** One shared slot object per tone and size, so a provider never re-renders its readers (`visual-slot.ts`). */
|
|
399
|
+
const toneSlots = new Map<string, VisualSlot>()
|
|
400
|
+
function slotFor(tone: Tone | undefined, compact: boolean): VisualSlot {
|
|
401
|
+
if (tone === undefined) return compact ? HOSTED_COMPACT : HOSTED
|
|
402
|
+
const key = `${tone}:${compact}`
|
|
403
|
+
const known = toneSlots.get(key)
|
|
404
|
+
if (known !== undefined) return known
|
|
405
|
+
const slot: VisualSlot = compact ? { tone, compact: true } : { tone }
|
|
406
|
+
toneSlots.set(key, slot)
|
|
407
|
+
return slot
|
|
408
|
+
}
|
|
409
|
+
|
|
380
410
|
export function StatCard({
|
|
381
411
|
title,
|
|
382
412
|
icon,
|
|
@@ -401,6 +431,7 @@ export function StatCard({
|
|
|
401
431
|
className,
|
|
402
432
|
style,
|
|
403
433
|
classNames,
|
|
434
|
+
...rest
|
|
404
435
|
}: StatCardProps) {
|
|
405
436
|
const isRender = typeof sparkline === 'function'
|
|
406
437
|
const bleeds = sparklinePlacement === 'bleed'
|
|
@@ -436,13 +467,16 @@ export function StatCard({
|
|
|
436
467
|
query === undefined ? (
|
|
437
468
|
breakdownRows
|
|
438
469
|
) : (
|
|
439
|
-
<
|
|
440
|
-
{
|
|
441
|
-
|
|
470
|
+
<HostTitleContext value={title}>
|
|
471
|
+
<QueryState query={query} tier="section">
|
|
472
|
+
{breakdownRows}
|
|
473
|
+
</QueryState>
|
|
474
|
+
</HostTitleContext>
|
|
442
475
|
)
|
|
443
476
|
|
|
444
477
|
// Built ONLY when ready: the render prop must not run in a pending / failed / empty branch, where
|
|
445
478
|
// the last measured width is stale.
|
|
479
|
+
const hostSlot = slotFor(tone, !bleeds)
|
|
446
480
|
const sparklineSlot: ReactNode =
|
|
447
481
|
!ready || sparkline === undefined ? null : (
|
|
448
482
|
<div
|
|
@@ -455,7 +489,7 @@ export function StatCard({
|
|
|
455
489
|
>
|
|
456
490
|
{/* A measured slot renders nothing on the first commit (width 0) — an SVG at width 0 is a
|
|
457
491
|
visible 0-width box that then jumps, which is worse than one frame of nothing. */}
|
|
458
|
-
<VisualSlotContext.Provider value={
|
|
492
|
+
<VisualSlotContext.Provider value={hostSlot}>
|
|
459
493
|
{isRender ? measured.width > 0 && sparkline(measured) : sparkline}
|
|
460
494
|
</VisualSlotContext.Provider>
|
|
461
495
|
</div>
|
|
@@ -479,7 +513,14 @@ export function StatCard({
|
|
|
479
513
|
</div>
|
|
480
514
|
)
|
|
481
515
|
|
|
482
|
-
const valueBody = renderValueBody({
|
|
516
|
+
const valueBody = renderValueBody({
|
|
517
|
+
pending,
|
|
518
|
+
resolved,
|
|
519
|
+
figure,
|
|
520
|
+
emptyText,
|
|
521
|
+
hasDelta: delta !== undefined,
|
|
522
|
+
label: title,
|
|
523
|
+
})
|
|
483
524
|
|
|
484
525
|
const breakdownCount = breakdown?.length ?? 0
|
|
485
526
|
const hasBreakdown = breakdownCount > 0
|
|
@@ -497,6 +538,7 @@ export function StatCard({
|
|
|
497
538
|
|
|
498
539
|
return (
|
|
499
540
|
<Card
|
|
541
|
+
{...pickDataAttributes(rest)}
|
|
500
542
|
className={cx(classNames?.root, className)}
|
|
501
543
|
style={{
|
|
502
544
|
// The inset is the theme's (`card-inset.module.css`: the `cardInsetY`/`cardInsetX` tokens, 12/16
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
* </StatGroup>
|
|
34
34
|
*/
|
|
35
35
|
import type { CSSProperties, ReactNode } from 'react'
|
|
36
|
-
import { cx } from '../common/props'
|
|
37
|
-
import type { BasaltProps } from '../common/props'
|
|
36
|
+
import { cx, pickDataAttributes } from '../common/props'
|
|
37
|
+
import type { BasaltProps, DataAttributes } from '../common/props'
|
|
38
38
|
import { StatStrip } from './stat-strip'
|
|
39
39
|
import type { StatStripProps } from './stat-strip'
|
|
40
40
|
import classes from './stat-group.module.css'
|
|
@@ -42,16 +42,17 @@ import classes from './stat-group.module.css'
|
|
|
42
42
|
/** The desktop KPI column count. */
|
|
43
43
|
export type StatGroupCols = 2 | 3 | 4 | 5
|
|
44
44
|
|
|
45
|
-
export type StatGridProps = BasaltProps &
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
export type StatGridProps = BasaltProps &
|
|
46
|
+
DataAttributes & {
|
|
47
|
+
variant?: 'grid'
|
|
48
|
+
/** The DESKTOP column count (`lg` and up). Default `4`. `sm` gets `min(cols, 3)` — except `4`, which gets 2 rather than an orphan row. A phone gets 2.
|
|
49
|
+
* Never a responsive object — the law is basalt's, see the module docblock. */
|
|
50
|
+
cols?: StatGroupCols
|
|
51
|
+
/** Swap the column gap for a hairline rail between cells. Default `false`. */
|
|
52
|
+
divided?: boolean
|
|
53
|
+
/** The KPI cells — normally `StatCard`s. */
|
|
54
|
+
children: ReactNode
|
|
55
|
+
}
|
|
55
56
|
|
|
56
57
|
/** `variant="strip"`: one joined surface of typed `cells` split by hairlines, plus an optional
|
|
57
58
|
* `footer` row — see `StatStripProps`. `cols` here may be 6 (the strip's desktop count). */
|
|
@@ -65,7 +66,14 @@ export function StatGroup(props: StatGroupProps) {
|
|
|
65
66
|
return <StatGrid {...props} />
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
function StatGrid({
|
|
69
|
+
function StatGrid({
|
|
70
|
+
cols = 4,
|
|
71
|
+
divided = false,
|
|
72
|
+
children,
|
|
73
|
+
className,
|
|
74
|
+
style,
|
|
75
|
+
...rest
|
|
76
|
+
}: StatGridProps) {
|
|
69
77
|
// `4 -> 2`, not `4 -> 3`. `min(cols, 3)` is the general rule and it is right for 2, 3 and 5, but
|
|
70
78
|
// FOUR is the default and the overwhelmingly common count, and three columns leave a four-KPI row
|
|
71
79
|
// as 3 + 1 — one orphan cell against two thirds of empty track. MEASURED on the playground
|
|
@@ -82,7 +90,7 @@ function StatGrid({ cols = 4, divided = false, children, className, style }: Sta
|
|
|
82
90
|
// sized is the whole point. `container-type: inline-size` contains the inline axis only, so the
|
|
83
91
|
// wrapper's block size still comes from the grid: no percentage height resolves differently,
|
|
84
92
|
// and there is no paint containment, so nothing inside is clipped.
|
|
85
|
-
<div className={cx(classes.container, className)} style={style}>
|
|
93
|
+
<div {...pickDataAttributes(rest)} className={cx(classes.container, className)} style={style}>
|
|
86
94
|
<div
|
|
87
95
|
className={classes.root}
|
|
88
96
|
data-cols={cols}
|
|
@@ -36,9 +36,6 @@
|
|
|
36
36
|
min-width: 0;
|
|
37
37
|
container-type: inline-size;
|
|
38
38
|
container-name: basalt-card;
|
|
39
|
-
/* The foot inset lives HERE, on the row-high slot, so a cell that ends early keeps the strip's
|
|
40
|
-
* surface under it. */
|
|
41
|
-
padding-block-end: var(--vx-space-stack-md);
|
|
42
39
|
box-shadow:
|
|
43
40
|
-1px 0 0 var(--vx-divider),
|
|
44
41
|
0 -1px 0 var(--vx-divider);
|
|
@@ -50,7 +47,7 @@
|
|
|
50
47
|
flex-direction: column;
|
|
51
48
|
align-self: start;
|
|
52
49
|
min-width: 0;
|
|
53
|
-
padding: var(--vx-space-stack-md)
|
|
50
|
+
padding: var(--vx-space-stack-md);
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
/* Forced colors drop box-shadows, so the hairlines come back as CanvasText borders. Every cell takes
|
|
@@ -166,6 +163,8 @@
|
|
|
166
163
|
* it, whether it sat beside the caption or wrapped under it, so values share a baseline. */
|
|
167
164
|
@container basalt-card (max-width: 239.9px) {
|
|
168
165
|
.qualifier {
|
|
166
|
+
/* Always on its own line under the caption: whether it fits beside it must not vary cell to cell. */
|
|
167
|
+
flex-basis: 100%;
|
|
169
168
|
line-height: 1.25;
|
|
170
169
|
}
|
|
171
170
|
|
|
@@ -378,16 +377,19 @@
|
|
|
378
377
|
.footerCell {
|
|
379
378
|
flex: 1 1 14rem;
|
|
380
379
|
min-width: 0;
|
|
380
|
+
font-size: var(--vx-text-sm);
|
|
381
381
|
padding: var(--vx-space-stack-md);
|
|
382
382
|
border-inline-start: 1px solid var(--vx-divider);
|
|
383
383
|
border-block-start: 1px solid var(--vx-divider);
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
/* A footer entry `under` a cell is part of that cell: it sits in the slot under the article, inset like
|
|
387
|
-
* the article, split from the readings by the strip's own hairline.
|
|
387
|
+
* the article, split from the readings by the strip's own hairline. Both footer slots take the strip's
|
|
388
|
+
* `sm` step, never the inherited body size (it would outrank the cell's own statement). */
|
|
388
389
|
.underCell {
|
|
389
390
|
min-width: 0;
|
|
390
|
-
|
|
391
|
+
font-size: var(--vx-text-sm);
|
|
392
|
+
margin: var(--vx-space-stack-md);
|
|
391
393
|
padding-block-start: var(--vx-space-stack-sm);
|
|
392
394
|
border-block-start: 1px solid var(--vx-divider);
|
|
393
395
|
}
|
|
@@ -45,14 +45,15 @@ import { useId, useRef } from 'react'
|
|
|
45
45
|
import type { CSSProperties, ReactNode } from 'react'
|
|
46
46
|
import { toErrorMessage } from '../common/errors'
|
|
47
47
|
import { useIsomorphicLayoutEffect } from '../common/isomorphic-layout-effect'
|
|
48
|
-
import { cx } from '../common/props'
|
|
49
|
-
import type { BasaltProps, Tone } from '../common/props'
|
|
48
|
+
import { cx, pickDataAttributes } from '../common/props'
|
|
49
|
+
import type { BasaltProps, DataAttributes, Tone } from '../common/props'
|
|
50
50
|
import { RetryButton } from '../common/retry-button'
|
|
51
51
|
import { StatusDot } from '../theme/status-dot'
|
|
52
52
|
import { VX } from '../tokens'
|
|
53
53
|
import { InfoGlyph } from './widget-header'
|
|
54
54
|
import classes from './stat-strip.module.css'
|
|
55
|
-
import {
|
|
55
|
+
import { couldNotLoad } from '../common/could-not-load'
|
|
56
|
+
import { HOSTED, HOSTED_LOADING, HOSTED_COMPACT, VisualSlotContext } from './visual-slot'
|
|
56
57
|
|
|
57
58
|
/** The URL shot states an anchor can declare itself absent in (`data-shot-absent`). */
|
|
58
59
|
type StatStripShotState = 'empty' | 'loading' | 'error'
|
|
@@ -140,21 +141,23 @@ export type StatStripFooterEntry = {
|
|
|
140
141
|
shotAbsent?: readonly StatStripShotState[]
|
|
141
142
|
}
|
|
142
143
|
|
|
143
|
-
export type StatStripProps = BasaltProps &
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
144
|
+
export type StatStripProps = BasaltProps &
|
|
145
|
+
DataAttributes & {
|
|
146
|
+
/** The strip's accessible name. */
|
|
147
|
+
label: string
|
|
148
|
+
cells: readonly StatStripCell[]
|
|
149
|
+
/** Wider cells under the cells. */
|
|
150
|
+
footer?: readonly StatStripFooterEntry[]
|
|
151
|
+
/** The DESKTOP column count. Default: the cell count, capped at 6. A lone cell takes the whole strip
|
|
152
|
+
* whatever `cols` says. */
|
|
153
|
+
cols?: 2 | 3 | 4 | 5 | 6
|
|
154
|
+
/** The shot states the page hides the whole strip in (`data-shot-absent` on every derived anchor). */
|
|
155
|
+
shotAbsent?: readonly StatStripShotState[]
|
|
156
|
+
}
|
|
154
157
|
|
|
155
158
|
const EMPTY = '—'
|
|
156
159
|
|
|
157
|
-
function CellState({ state }: { state: StatStripCellState }) {
|
|
160
|
+
function CellState({ state, caption }: { state: StatStripCellState; caption: string }) {
|
|
158
161
|
if (state.kind === 'empty') {
|
|
159
162
|
// A stated reason IS the gap: it takes the value's place, so no bare dash sits above it.
|
|
160
163
|
if (state.reason !== undefined) {
|
|
@@ -177,7 +180,7 @@ function CellState({ state }: { state: StatStripCellState }) {
|
|
|
177
180
|
<div className={classes.error} role="alert" data-strip-state="error">
|
|
178
181
|
<span className={classes.errorHead}>
|
|
179
182
|
<StatusDot color={VX.status.bad} />
|
|
180
|
-
|
|
183
|
+
{couldNotLoad(caption)}
|
|
181
184
|
</span>
|
|
182
185
|
<p className={classes.reason}>{message}</p>
|
|
183
186
|
{state.onRetry !== undefined && (
|
|
@@ -311,7 +314,7 @@ function StripCell({
|
|
|
311
314
|
</span>
|
|
312
315
|
)}
|
|
313
316
|
</div>
|
|
314
|
-
{state !== undefined && <CellState state={state} />}
|
|
317
|
+
{state !== undefined && <CellState state={state} caption={cell.caption} />}
|
|
315
318
|
{state === undefined && hasHero && heroEl}
|
|
316
319
|
</div>
|
|
317
320
|
{state === undefined && cell.visual !== undefined && (
|
|
@@ -338,7 +341,7 @@ function StripCell({
|
|
|
338
341
|
<li key={row.key} className={classes.row} data-strip-row={row.key}>
|
|
339
342
|
<span className={classes.rowLabel}>{row.label}</span>
|
|
340
343
|
<span className={classes.visual}>
|
|
341
|
-
<VisualSlotContext.Provider value={
|
|
344
|
+
<VisualSlotContext.Provider value={HOSTED_COMPACT}>
|
|
342
345
|
{row.visual}
|
|
343
346
|
</VisualSlotContext.Provider>
|
|
344
347
|
</span>
|
|
@@ -407,8 +410,10 @@ export function StatStrip({
|
|
|
407
410
|
shotAbsent,
|
|
408
411
|
className,
|
|
409
412
|
style,
|
|
413
|
+
...domProps
|
|
410
414
|
}: StatStripProps) {
|
|
411
|
-
|
|
415
|
+
// A lone cell is the whole strip: a stated `cols` would leave it one track of an empty grid.
|
|
416
|
+
const desktop = cells.length === 1 ? 1 : (cols ?? Math.min(Math.max(cells.length, 2), 6))
|
|
412
417
|
// `StatGroup`'s rule: four is 2 + 2 below the full count, never 3 + 1.
|
|
413
418
|
const mid = desktop === 4 ? 2 : Math.min(desktop, 3)
|
|
414
419
|
const keys = new Set(cells.map((cell) => cell.key))
|
|
@@ -458,7 +463,11 @@ export function StatStrip({
|
|
|
458
463
|
for (const head of grid.querySelectorAll('[data-strip-head]')) observer.observe(head)
|
|
459
464
|
}, [cells, footer])
|
|
460
465
|
return (
|
|
461
|
-
<div
|
|
466
|
+
<div
|
|
467
|
+
{...pickDataAttributes(domProps)}
|
|
468
|
+
className={cx(classes.container, className)}
|
|
469
|
+
style={style}
|
|
470
|
+
>
|
|
462
471
|
<Card>
|
|
463
472
|
<Card.Section
|
|
464
473
|
component="section"
|
|
@@ -11,6 +11,8 @@ export interface VisualSlot {
|
|
|
11
11
|
readonly tone?: Tone
|
|
12
12
|
/** The host is loading: a `Meter` in the slot draws its loading state without its own `loading`. */
|
|
13
13
|
readonly loading?: boolean
|
|
14
|
+
/** A slot with no room for a caption (a multi-row cell's row, a `right`-placed sparkline): its `Sparkline` states no window of its own. */
|
|
15
|
+
readonly compact?: true
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
/** A host with no verdict of its own: one shared object, so a provider never re-renders its readers. */
|
|
@@ -19,4 +21,7 @@ export const HOSTED: VisualSlot = {}
|
|
|
19
21
|
/** `HOSTED` while the host loads. */
|
|
20
22
|
export const HOSTED_LOADING: VisualSlot = { loading: true }
|
|
21
23
|
|
|
24
|
+
/** A slot too small for a caption under its visual. */
|
|
25
|
+
export const HOSTED_COMPACT: VisualSlot = { compact: true }
|
|
26
|
+
|
|
22
27
|
export const VisualSlotContext = createContext<VisualSlot | null>(null)
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
* `--mantine-spacing-*` fallbacks.
|
|
11
11
|
*
|
|
12
12
|
* Layout keys on the enclosing card's OWN width (`container: basalt-card`, declared by ChartCard /
|
|
13
|
-
* StatCard / Section — docs/DESIGN-CORE.md § Layout, elevation, shapes), never the viewport:
|
|
14
|
-
* into the info glyph
|
|
15
|
-
* shrinking are unconditional. The subtitle ALSO folds (regardless of width) whenever the card's own
|
|
13
|
+
* StatCard / Section — docs/DESIGN-CORE.md § Layout, elevation, shapes), never the viewport: the subtitle stays visible text at every width (it wraps under the title); from 480px (wave 8) `value` + `delta` move onto the title row. Wrapping and
|
|
14
|
+
* shrinking are unconditional. The subtitle folds into the info glyph (regardless of width) only when the card's own
|
|
16
15
|
* height is under 280px — see the `[data-basalt-card-short]` block below (wave 8's header-economy
|
|
17
16
|
* law). No enclosing card, no container: the standard layout. Container conditions are px literals
|
|
18
17
|
* of CONTAINER_CLASSES.
|
|
@@ -234,6 +233,7 @@
|
|
|
234
233
|
* section with both read as a two-line heading rather than a heading plus a note. */
|
|
235
234
|
.subtitle {
|
|
236
235
|
margin-top: 4px;
|
|
236
|
+
overflow-wrap: anywhere;
|
|
237
237
|
font-size: var(--vx-text-sm);
|
|
238
238
|
font-weight: 400;
|
|
239
239
|
color: var(--vx-muted);
|
|
@@ -380,19 +380,16 @@
|
|
|
380
380
|
color: var(--vx-muted);
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
/* Card narrower than 480px: the subtitle
|
|
384
|
-
*
|
|
383
|
+
/* Card narrower than 480px: the subtitle stays visible text under the title and wraps (a touch
|
|
384
|
+
* surface has no hover to open a fold glyph). A chart card also clamps it to two lines, then an
|
|
385
|
+
* ellipsis; the full text stays in the DOM. Only the short-height fold below still moves it. */
|
|
385
386
|
@container basalt-card (max-width: 479.9px) {
|
|
386
|
-
.subtitle {
|
|
387
|
-
display:
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
.foldNote {
|
|
395
|
-
display: block;
|
|
387
|
+
[data-basalt-chart-header] .subtitle {
|
|
388
|
+
display: -webkit-box;
|
|
389
|
+
-webkit-box-orient: vertical;
|
|
390
|
+
-webkit-line-clamp: 2;
|
|
391
|
+
line-clamp: 2;
|
|
392
|
+
overflow: hidden;
|
|
396
393
|
}
|
|
397
394
|
}
|
|
398
395
|
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
import { useEffect, useId, useRef, useState } from 'react'
|
|
33
33
|
import type { ReactNode, RefObject } from 'react'
|
|
34
34
|
import { useIsomorphicLayoutEffect } from '../common/isomorphic-layout-effect'
|
|
35
|
-
import { cx } from '../common/props'
|
|
36
|
-
import type { BasaltProps, SlotStylesProps } from '../common/props'
|
|
35
|
+
import { cx, pickDataAttributes } from '../common/props'
|
|
36
|
+
import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props'
|
|
37
37
|
import { IconSlot } from '../theme/icon-slot'
|
|
38
38
|
import { DeltaBadge } from './delta-badge'
|
|
39
39
|
import type { DeltaPolarity } from './delta-badge'
|
|
@@ -54,6 +54,7 @@ export type WidgetHeaderTier = 'section' | 'widget' | 'group'
|
|
|
54
54
|
export type WidgetHeaderSlot = 'root' | 'title' | 'metric' | 'icon'
|
|
55
55
|
|
|
56
56
|
export type WidgetHeaderProps = BasaltProps &
|
|
57
|
+
DataAttributes &
|
|
57
58
|
SlotStylesProps<WidgetHeaderSlot> & {
|
|
58
59
|
/** `section` renders an `<h2>` at the section-header height; `widget` renders an `<h3>` at the
|
|
59
60
|
* tighter icon-tier height, display-only; `group` also renders an `<h3>` but as the quietest
|
|
@@ -65,9 +66,9 @@ export type WidgetHeaderProps = BasaltProps &
|
|
|
65
66
|
title: string
|
|
66
67
|
/** Optional leading icon, rendered before the title. Decorative — hidden from assistive tech. */
|
|
67
68
|
icon?: ReactNode
|
|
68
|
-
/** Optional muted line rendered below the title row.
|
|
69
|
-
*
|
|
70
|
-
* exactly one of the two shows). */
|
|
69
|
+
/** Optional muted line rendered below the title row. Visible text at every width (it wraps
|
|
70
|
+
* under the title); in a card shorter than 280px it folds into the info glyph's bubble instead
|
|
71
|
+
* (CSS only — exactly one of the two shows). */
|
|
71
72
|
subtitle?: string
|
|
72
73
|
/**
|
|
73
74
|
* Renders an info glyph BESIDE the heading (never inside it — this text would otherwise become
|
|
@@ -406,11 +407,13 @@ export function WidgetHeader({
|
|
|
406
407
|
className,
|
|
407
408
|
style,
|
|
408
409
|
classNames,
|
|
410
|
+
...rest
|
|
409
411
|
}: WidgetHeaderProps) {
|
|
410
412
|
const Heading = tier === 'section' ? 'h2' : 'h3'
|
|
411
413
|
|
|
412
414
|
return (
|
|
413
415
|
<div
|
|
416
|
+
{...pickDataAttributes(rest)}
|
|
414
417
|
className={cx(classes.root, classNames?.root, className)}
|
|
415
418
|
data-tier={tier}
|
|
416
419
|
{...(style !== undefined && { style })}
|
package/src/format/shared.ts
CHANGED
|
@@ -118,7 +118,36 @@ export function dateFormat(
|
|
|
118
118
|
options.timeZone === undefined && defaults.timeZone !== undefined
|
|
119
119
|
? { ...options, timeZone: defaults.timeZone }
|
|
120
120
|
: options
|
|
121
|
-
return memoize(dateCaches, resolved, withZone, () =>
|
|
121
|
+
return memoize(dateCaches, resolved, withZone, () =>
|
|
122
|
+
shortSeptember(new Intl.DateTimeFormat(resolved, withZone)),
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const toShortSeptember = (text: string): string => text.replace(/\bSept\b/g, 'Sep')
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* ICU 72+ writes September as `Sept` in en-GB (and kin) but `Sep` in en-US. One short month form
|
|
130
|
+
* across every basalt date text: an English formatter prints `Sep`, whichever region tag it got.
|
|
131
|
+
* Other languages keep their own abbreviation (`Sept.` in German is correct).
|
|
132
|
+
*/
|
|
133
|
+
function shortSeptember(formatter: Intl.DateTimeFormat): Intl.DateTimeFormat {
|
|
134
|
+
if (!formatter.resolvedOptions().locale.startsWith('en')) return formatter
|
|
135
|
+
const nativeFormat = formatter.format
|
|
136
|
+
const nativeParts = formatter.formatToParts.bind(formatter)
|
|
137
|
+
const format = (date?: Date | number): string => toShortSeptember(nativeFormat(date))
|
|
138
|
+
const formatToParts = (date?: Date | number): Intl.DateTimeFormatPart[] =>
|
|
139
|
+
nativeParts(date).map((part) =>
|
|
140
|
+
part.type === 'month' ? { ...part, value: toShortSeptember(part.value) } : part,
|
|
141
|
+
)
|
|
142
|
+
const nativeRange = formatter.formatRange.bind(formatter)
|
|
143
|
+
const formatRange = (start: Date | number, end: Date | number): string =>
|
|
144
|
+
toShortSeptember(nativeRange(start, end))
|
|
145
|
+
Object.defineProperties(formatter, {
|
|
146
|
+
format: { value: format },
|
|
147
|
+
formatRange: { value: formatRange },
|
|
148
|
+
formatToParts: { value: formatToParts },
|
|
149
|
+
})
|
|
150
|
+
return formatter
|
|
122
151
|
}
|
|
123
152
|
|
|
124
153
|
/** What every number/measure formatter accepts. */
|
package/src/guard/index.ts
CHANGED
|
@@ -828,6 +828,10 @@ const SUB_16_FONT_SIZE = /font-?[Ss]ize\s*:\s*['"]?(-?\d+(?:\.\d+)?)(?:px)?['"]?
|
|
|
828
828
|
const DEFAULT_SPACING_STEPS: readonly number[] = Object.values(SPACE_SCALE_LEVEL0).toSorted(
|
|
829
829
|
(a, b) => a - b,
|
|
830
830
|
)
|
|
831
|
+
const SPACING_TOKEN_LIST = Object.entries(SPACE_SCALE_LEVEL0)
|
|
832
|
+
.map(([name, px]) => `${px} → "${name}"`)
|
|
833
|
+
.join(', ')
|
|
834
|
+
|
|
831
835
|
/** Default off-identity Mantine accent families. */
|
|
832
836
|
const DEFAULT_FORBIDDEN_ACCENTS: readonly string[] = ['teal', 'violet', 'grape', 'indigo', 'pink']
|
|
833
837
|
|
|
@@ -1073,6 +1077,8 @@ export const PLUGIN_RULE_IDS: ReadonlySet<string> = new Set([
|
|
|
1073
1077
|
'no-dev-helper',
|
|
1074
1078
|
// AST-only: a `<ViewTransition>` ancestor of `<Outlet>` is a JSX-ancestry claim over two import-resolved names.
|
|
1075
1079
|
'route-view-transition',
|
|
1080
|
+
// AST-only: a text-colour position (`c=`, a `style` object's `color`) is a JSX/property claim over a member chain.
|
|
1081
|
+
'status-fill-as-text',
|
|
1076
1082
|
// These two honour `basalt-agent-allow`, never `theme-allow` — but they are still REAL ids, so
|
|
1077
1083
|
// a `theme-allow ai-sdk-major` must parse as a (useless) scoped annotation rather than as prose.
|
|
1078
1084
|
'agent-no-raw-usechat',
|
|
@@ -2037,7 +2043,7 @@ export const GUARD_RULES = {
|
|
|
2037
2043
|
// JSX-prop-shaped (`p={16}`) — CSS has no `=`/`{}` prop syntax; gated off explicitly (see
|
|
2038
2044
|
// off-identity-accent above for why "never matches today" still gets an explicit gate).
|
|
2039
2045
|
appliesTo: (relPath) => !relPath.endsWith('.css'),
|
|
2040
|
-
message:
|
|
2046
|
+
message: `Use the Mantine spacing token, not the number (p/m/gap): ${SPACING_TOKEN_LIST}. A number that equals a step IS that token.`,
|
|
2041
2047
|
},
|
|
2042
2048
|
'raw-radius': {
|
|
2043
2049
|
kind: 'raw-radius',
|
package/src/index.ts
CHANGED
|
@@ -107,6 +107,24 @@
|
|
|
107
107
|
* table's page-sticky offset reads it instead of repeating this module's `sm` switch.
|
|
108
108
|
*/
|
|
109
109
|
--basalt-main-pad-block: var(--vx-space-stack-md);
|
|
110
|
+
/*
|
|
111
|
+
* PUBLIC `--basalt-main-content-h` — the height of Main's CONTENT box: what an element at
|
|
112
|
+
* `height: var(--basalt-main-content-h)` needs to fill the scrollport with nothing to scroll (a
|
|
113
|
+
* map, an editor, a full-page canvas). Descendants inherit the resolved length.
|
|
114
|
+
*
|
|
115
|
+
* It is the viewport minus the five things that are not content: the header offset, the footer
|
|
116
|
+
* offset PLUS the safe-area inset (same pair as `margin-bottom` above), the band, and Main's block
|
|
117
|
+
* padding twice. The band is `--basalt-page-bar-h` (its content box, published by `PageBar`) plus
|
|
118
|
+
* its own 1 px `border-bottom` the var never counts (`page-aside.module.css` explains the same
|
|
119
|
+
* pixel): `var(--basalt-page-bar-h, -1px) + 1px` adds it only while a band exists and nets to 0
|
|
120
|
+
* without one. `h="100%"` cannot do this job — Main sizes itself by flex, so a percentage height
|
|
121
|
+
* on a child does not resolve against it.
|
|
122
|
+
*/
|
|
123
|
+
--basalt-main-content-h: calc(
|
|
124
|
+
100dvh - var(--app-shell-header-offset, 0px) - var(--app-shell-footer-offset, 0px) -
|
|
125
|
+
env(safe-area-inset-bottom, 0px) - (var(--basalt-page-bar-h, -1px) + 1px) - 2 *
|
|
126
|
+
var(--basalt-main-pad-block)
|
|
127
|
+
);
|
|
110
128
|
padding: var(--basalt-main-pad-block) var(--app-shell-padding);
|
|
111
129
|
/* Without this a wide flex/grid child (a bare table, a nowrap control row) sizes Main to ITSELF. */
|
|
112
130
|
min-width: 0;
|