basalt-ui 2.27.1 → 2.28.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 +111 -0
- package/MIGRATING.md +172 -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-design/SKILL.md +1 -1
- package/agent/skills/basalt-design/references/catalogue.md +40 -36
- package/agent/skills/basalt-design/references/recipes.md +47 -0
- package/configs/oxlint-basalt.json +2 -1
- package/configs/oxlint-plugin.js +110 -2
- package/configs/oxlint-plugin.test.ts +99 -4
- 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 +5 -2
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +46 -13
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +11 -4
- package/dist/charts/Sparkline.d.ts +9 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +104 -41
- package/dist/charts/chart-box.module.css +69 -3
- package/dist/charts/chart-box.module.css.d.ts +5 -0
- package/dist/charts/chart-card.module.css +12 -4
- package/dist/charts/chart-card.module.css.d.ts +1 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +21 -19
- 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 +31 -8
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +40 -9
- package/dist/charts/sparkline.module.css +6 -0
- package/dist/charts/state.d.ts +3 -3
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +20 -2
- package/dist/cli/shot/capture.d.ts +6 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +18 -5
- 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/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 +1 -1
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +6 -2
- package/dist/dashboard/bar-list.module.css +0 -2
- 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 +228 -0
- package/dist/dashboard/board.module.css +160 -0
- package/dist/dashboard/board.module.css.d.ts +26 -0
- package/dist/dashboard/empty-state.d.ts +3 -3
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +13 -6
- package/dist/dashboard/event-list-model.d.ts +51 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -0
- package/dist/dashboard/event-list-model.js +72 -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 +93 -0
- package/dist/dashboard/event-list-scroll.d.ts +27 -0
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
- package/dist/dashboard/event-list-scroll.js +103 -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 +36 -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 +178 -0
- package/dist/dashboard/event-list.module.css +283 -0
- package/dist/dashboard/event-list.module.css.d.ts +33 -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-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +5 -3
- package/dist/dashboard/meter.module.css +2 -1
- package/dist/dashboard/query-state.js +1 -1
- package/dist/dashboard/settings-section.d.ts +4 -1
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +1 -1
- package/dist/dashboard/settings-section.module.css +19 -4
- 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.map +1 -1
- package/dist/dashboard/stat-card.js +26 -7
- package/dist/dashboard/stat-card.module.css +31 -7
- package/dist/dashboard/stat-card.module.css.d.ts +3 -0
- package/dist/dashboard/stat-strip.js +1 -1
- package/dist/dashboard/stat-strip.module.css +4 -1
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +15 -2
- package/dist/dashboard/widget-header.module.css +17 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +2 -0
- 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 +46 -8
- 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 +44 -0
- package/dist/table/cell-kinds.d.ts.map +1 -0
- package/dist/table/cell-kinds.js +169 -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 +147 -0
- package/dist/table/data-table-fold.d.ts.map +1 -0
- package/dist/table/data-table-fold.js +288 -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 +11 -26
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +354 -254
- package/dist/table/data-table.module.css +210 -3
- package/dist/table/data-table.module.css.d.ts +12 -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 +32 -0
- 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 +34 -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 +79 -17
- package/src/charts/Lines.tsx +13 -4
- package/src/charts/Sparkline.tsx +131 -45
- package/src/charts/chart-box.module.css +69 -3
- package/src/charts/chart-box.module.css.d.ts +5 -0
- package/src/charts/chart-card.module.css +12 -4
- package/src/charts/chart-card.module.css.d.ts +1 -0
- package/src/charts/compile.ts +24 -20
- package/src/charts/labels.ts +175 -24
- package/src/charts/legend.tsx +3 -2
- package/src/charts/ref-label.ts +86 -17
- package/src/charts/sparkline.module.css +6 -0
- package/src/charts/state.tsx +36 -7
- package/src/cli/shot/capture.ts +29 -6
- package/src/common/empty-copy.ts +17 -0
- 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 +0 -2
- package/src/dashboard/bar-list.tsx +8 -5
- package/src/dashboard/board-nav.ts +67 -0
- package/src/dashboard/board.module.css +160 -0
- package/src/dashboard/board.module.css.d.ts +26 -0
- package/src/dashboard/board.tsx +394 -0
- package/src/dashboard/empty-state.tsx +16 -9
- package/src/dashboard/event-list-model.ts +113 -0
- package/src/dashboard/event-list-rows.tsx +120 -0
- package/src/dashboard/event-list-scroll.ts +145 -0
- package/src/dashboard/event-list-skeleton.tsx +58 -0
- package/src/dashboard/event-list.module.css +283 -0
- package/src/dashboard/event-list.module.css.d.ts +33 -0
- package/src/dashboard/event-list.tsx +309 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-parts.tsx +9 -2
- package/src/dashboard/meter.module.css +2 -1
- package/src/dashboard/query-state.tsx +1 -1
- package/src/dashboard/settings-section.module.css +19 -4
- package/src/dashboard/settings-section.tsx +7 -2
- package/src/dashboard/stat-card-parts.tsx +20 -3
- package/src/dashboard/stat-card.module.css +31 -7
- package/src/dashboard/stat-card.module.css.d.ts +3 -0
- package/src/dashboard/stat-card.tsx +25 -6
- package/src/dashboard/stat-strip.module.css +4 -1
- package/src/dashboard/stat-strip.tsx +1 -1
- package/src/dashboard/widget-header.module.css +17 -1
- package/src/dashboard/widget-header.tsx +29 -5
- package/src/guard/index.ts +2 -0
- package/src/index.ts +4 -0
- package/src/shell/app-main.module.css +18 -0
- package/src/styles.css +46 -8
- 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 +234 -0
- package/src/table/data-table-fold.tsx +514 -0
- package/src/table/data-table-state.ts +24 -13
- package/src/table/data-table.module.css +210 -3
- package/src/table/data-table.module.css.d.ts +12 -0
- package/src/table/data-table.tsx +406 -359
- 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 +32 -0
- 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
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventList — a day-grouped feed or timeline of things that happened: a leading glyph, the actor and
|
|
3
|
+
* a sentence on line one; line two leads with the mono time, then the muted body and the chips. Choose it
|
|
4
|
+
* for activity, history and audit trails; a table is for comparing rows, this is for reading them
|
|
5
|
+
* in order. An HTML/CSS primitive (no chart engine).
|
|
6
|
+
*
|
|
7
|
+
* The caller's order is kept — the list never sorts. `order` only says which end is "earlier", so
|
|
8
|
+
* day groups and the `earlier` control land on the right edge. Days are local. Item `id`s are the
|
|
9
|
+
* rows' identity (keys, prepend anchoring): keep them unique and stable.
|
|
10
|
+
*
|
|
11
|
+
* The row is two lines at every width: line one is the glyph and `actor + sentence` (clamped to one line in
|
|
12
|
+
* `feed`, wrapping in `timeline`); line two leads with the time, then the body (it wraps, never
|
|
13
|
+
* truncates), then the chips (they wrap to the next line only if they must). A row with no body or
|
|
14
|
+
* chips still has line two, the time alone; an untimed row's line two is body and chips only.
|
|
15
|
+
*
|
|
16
|
+
* Above 200 rows the rows window through the package's one lazy virtual-list seam
|
|
17
|
+
* (`@tanstack/react-virtual`, an optional peer); at or below it the list is plain DOM and the peer is
|
|
18
|
+
* never loaded. A list crossing 200 rows keeps its scroll node and may land a few rows off its place. With `height` the list owns its scroll node — an oldest-first list then opens on its
|
|
19
|
+
* newest end and keeps the visible row across a prepend; without it the rows follow the nearest
|
|
20
|
+
* scrolling ancestor (the shell's scrollport) and the page keeps scrolling. States follow `BarList`:
|
|
21
|
+
* `loading` is row-shaped skeletons (the box keeps its height), an empty list is an `EmptyState` tile
|
|
22
|
+
* (`empty`) that sizes to its content.
|
|
23
|
+
* An error is the caller's: `QueryState` is not a public export, so put the list in a `Section`
|
|
24
|
+
* with `query` (it owns the failure and its retry) or render your own error note.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* import { EventList } from 'basalt-ui'
|
|
28
|
+
*
|
|
29
|
+
* <EventList
|
|
30
|
+
* label="Activity"
|
|
31
|
+
* items={[{ id: 'e1', at: Date.now(), actor: 'Ada', title: 'merged #482', chips: <Badge>main</Badge> }]}
|
|
32
|
+
* earlier={{ onLoad: loadMore, remaining: 12 }}
|
|
33
|
+
* />
|
|
34
|
+
*
|
|
35
|
+
* // A record's history: rail, full sentences, oldest first, in a box that opens on the newest event.
|
|
36
|
+
* <EventList label="History" density="timeline" order="oldest-first" height={440} items={events} />
|
|
37
|
+
*/
|
|
38
|
+
import { Button, VisuallyHidden } from '@mantine/core'
|
|
39
|
+
import { useId, useRef, useState, useSyncExternalStore } from 'react'
|
|
40
|
+
import type { CSSProperties, ReactNode } from 'react'
|
|
41
|
+
import { cx } from '../common/props'
|
|
42
|
+
import type { BasaltProps } from '../common/props'
|
|
43
|
+
import { VirtualRows } from '../common/virtual-rows'
|
|
44
|
+
import classes from './event-list.module.css'
|
|
45
|
+
import { EmptyState } from './empty-state'
|
|
46
|
+
import { buildRows, DayHeader, EventRow } from './event-list-rows'
|
|
47
|
+
import {
|
|
48
|
+
defaultDayLabel,
|
|
49
|
+
groupByDay,
|
|
50
|
+
isValidEventDate,
|
|
51
|
+
present,
|
|
52
|
+
toEventDate,
|
|
53
|
+
} from './event-list-model'
|
|
54
|
+
import type { RowContext } from './event-list-model'
|
|
55
|
+
import { useHeldHeight, useOpenAtEnd, usePrependAnchor, useScrolledEdge } from './event-list-scroll'
|
|
56
|
+
import { SkeletonRows } from './event-list-skeleton'
|
|
57
|
+
|
|
58
|
+
/** Rows above this window through the virtual-list seam; at or below it the list is plain DOM. */
|
|
59
|
+
const VIRTUALIZE_THRESHOLD = 200
|
|
60
|
+
|
|
61
|
+
export type EventListProps = BasaltProps & {
|
|
62
|
+
/** Accessible name of the list. Default "Events". */
|
|
63
|
+
label?: string
|
|
64
|
+
/** Events in display order — kept as given, never re-sorted. `id`s must be unique within the list. */
|
|
65
|
+
items: readonly {
|
|
66
|
+
id: string
|
|
67
|
+
at: Date | number
|
|
68
|
+
actor?: ReactNode
|
|
69
|
+
title: ReactNode
|
|
70
|
+
body?: ReactNode
|
|
71
|
+
/** A glyph or avatar in the leading column. */
|
|
72
|
+
leading?: ReactNode
|
|
73
|
+
chips?: ReactNode
|
|
74
|
+
}[]
|
|
75
|
+
/** `feed`: one clamped line, about 52 px a two-line row. `timeline`: a rail, full sentences, body and chips in full. */
|
|
76
|
+
density?: 'feed' | 'timeline'
|
|
77
|
+
/** The 1 px line through the leading column joining rows within a day group. Default: `density === 'timeline'`. */
|
|
78
|
+
rail?: boolean
|
|
79
|
+
/** Day headers (`micro` mono, muted, with the row count) or one flat list. Default `day`. */
|
|
80
|
+
group?: 'day' | 'none'
|
|
81
|
+
/**
|
|
82
|
+
* The instant "Today" and relative times are measured from. Default: the client clock, read once
|
|
83
|
+
* after mount; until then (the server render, the hydrating paint) days read as dates and a
|
|
84
|
+
* `relative` time as a date-time, so server and client markup match.
|
|
85
|
+
*/
|
|
86
|
+
now?: number | Date
|
|
87
|
+
/** Overrides the `Today` / `Yesterday` / short-date header text. Without a clock yet, `now` is the day itself. */
|
|
88
|
+
dayLabel?: (day: Date, now: Date) => string
|
|
89
|
+
/**
|
|
90
|
+
* The time column. Default `clock` when grouped by day, `date-time` when not. A function formats it
|
|
91
|
+
* yourself; one returning an empty string renders no time for that row (an untimed entry).
|
|
92
|
+
*/
|
|
93
|
+
time?: 'clock' | 'relative' | 'date-time' | ((at: Date) => string)
|
|
94
|
+
/** Which end of `items` is earlier. Does not sort. Default `newest-first`. */
|
|
95
|
+
order?: 'newest-first' | 'oldest-first'
|
|
96
|
+
/**
|
|
97
|
+
* A quiet "Show earlier (N)" control at the earlier end (bottom for newest-first, top for
|
|
98
|
+
* oldest-first). With `height`, prepending (oldest-first) keeps the visible row where it is and a
|
|
99
|
+
* list opens on its newest end; a content-sized list leaves scrolling to the page.
|
|
100
|
+
*/
|
|
101
|
+
earlier?: { onLoad: () => void; loading?: boolean; remaining?: number }
|
|
102
|
+
/** The list owns a scroll node of this height (modal, aside, card). Omitted: content-sized. */
|
|
103
|
+
height?: number | string
|
|
104
|
+
/** Renders row-shaped skeletons. */
|
|
105
|
+
loading?: boolean
|
|
106
|
+
/** Skeleton rows while loading. Default 5. */
|
|
107
|
+
loadingRows?: number
|
|
108
|
+
/**
|
|
109
|
+
* The empty state, an `EmptyState` in a ring-edged tile that sizes to its content (no void in a
|
|
110
|
+
* bounded `height`). Default: "Nothing has happened yet" with a one-line why.
|
|
111
|
+
*/
|
|
112
|
+
empty?: { title: string; description?: string; action?: ReactNode }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const subscribeNever = (): (() => void) => () => {}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The client clock, read once after mount through `useSyncExternalStore` (the server snapshot is
|
|
119
|
+
* `null`, like `SyncButton`'s age): a server render never reads `Date.now()`, and the hydrating
|
|
120
|
+
* paint matches it before React re-renders with the real clock.
|
|
121
|
+
*/
|
|
122
|
+
function useClientClock(): number | null {
|
|
123
|
+
const at = useRef<number | null>(null)
|
|
124
|
+
return useSyncExternalStore(
|
|
125
|
+
subscribeNever,
|
|
126
|
+
() => (at.current ??= Date.now()),
|
|
127
|
+
() => null,
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Whether these rows were plain before: set while plain rows show, cleared when the rows go. */
|
|
132
|
+
function usePlainBefore(hasRows: boolean, windowed: boolean): boolean {
|
|
133
|
+
const [plain, setPlain] = useState(false)
|
|
134
|
+
const next = hasRows ? plain || !windowed : false
|
|
135
|
+
if (next !== plain) setPlain(next)
|
|
136
|
+
return next
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const DEFAULT_EMPTY = {
|
|
140
|
+
title: 'Nothing has happened yet',
|
|
141
|
+
description: 'Events appear here as they happen.',
|
|
142
|
+
} as const
|
|
143
|
+
|
|
144
|
+
export function EventList({
|
|
145
|
+
label = 'Events',
|
|
146
|
+
items,
|
|
147
|
+
density = 'feed',
|
|
148
|
+
rail,
|
|
149
|
+
group = 'day',
|
|
150
|
+
now,
|
|
151
|
+
dayLabel,
|
|
152
|
+
time,
|
|
153
|
+
order = 'newest-first',
|
|
154
|
+
earlier,
|
|
155
|
+
height,
|
|
156
|
+
loading = false,
|
|
157
|
+
loadingRows = 5,
|
|
158
|
+
empty = DEFAULT_EMPTY,
|
|
159
|
+
className,
|
|
160
|
+
style,
|
|
161
|
+
}: EventListProps) {
|
|
162
|
+
const clock = useClientClock()
|
|
163
|
+
// The scroll node as state, so a windowed list can wait for it (see `VirtualRows` `scrollRoot`).
|
|
164
|
+
const [scrollEl, setScrollEl] = useState<HTMLDivElement | null>(null)
|
|
165
|
+
const labelId = useId()
|
|
166
|
+
const nowDate = now !== undefined ? new Date(now) : clock === null ? null : new Date(clock)
|
|
167
|
+
const grouped = group === 'day'
|
|
168
|
+
const withRail = rail ?? density === 'timeline'
|
|
169
|
+
const ctx: RowContext = {
|
|
170
|
+
density,
|
|
171
|
+
rail: withRail,
|
|
172
|
+
lead: withRail || items.some((i) => present(i.leading)),
|
|
173
|
+
timeMode: time ?? (grouped ? 'clock' : 'date-time'),
|
|
174
|
+
now: nowDate,
|
|
175
|
+
}
|
|
176
|
+
const oldestFirst = order === 'oldest-first'
|
|
177
|
+
const hasRows = !loading && items.length > 0
|
|
178
|
+
const virtualised = hasRows && items.length > VIRTUALIZE_THRESHOLD
|
|
179
|
+
const ownScroll = height !== undefined
|
|
180
|
+
const opensAtEnd = oldestFirst && ownScroll
|
|
181
|
+
const plainBefore = usePlainBefore(hasRows, virtualised)
|
|
182
|
+
usePrependAnchor(scrollEl, opensAtEnd && hasRows && !virtualised, items)
|
|
183
|
+
useOpenAtEnd(scrollEl, opensAtEnd && hasRows && !virtualised, items.length)
|
|
184
|
+
useScrolledEdge(ownScroll ? scrollEl : null)
|
|
185
|
+
useHeldHeight(scrollEl, !hasRows ? 'none' : virtualised ? 'windowed' : 'plain')
|
|
186
|
+
|
|
187
|
+
const control =
|
|
188
|
+
earlier === undefined || !hasRows ? null : (
|
|
189
|
+
<div className={classes.earlier} data-end={oldestFirst ? 'top' : 'bottom'}>
|
|
190
|
+
<Button
|
|
191
|
+
variant="subtle"
|
|
192
|
+
color="gray"
|
|
193
|
+
size="compact-sm"
|
|
194
|
+
className={classes.earlierButton}
|
|
195
|
+
loading={earlier.loading === true}
|
|
196
|
+
onClick={earlier.onLoad}
|
|
197
|
+
>
|
|
198
|
+
{earlier.remaining === undefined ? 'Show earlier' : `Show earlier (${earlier.remaining})`}
|
|
199
|
+
</Button>
|
|
200
|
+
</div>
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
let content: ReactNode
|
|
204
|
+
if (loading) {
|
|
205
|
+
content = (
|
|
206
|
+
<div aria-busy="true">
|
|
207
|
+
<VisuallyHidden>{`Loading ${label}`}</VisuallyHidden>
|
|
208
|
+
<SkeletonRows count={loadingRows} ctx={ctx} grouped={grouped} height={height} />
|
|
209
|
+
</div>
|
|
210
|
+
)
|
|
211
|
+
} else if (items.length === 0) {
|
|
212
|
+
content = (
|
|
213
|
+
// oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a polite live region whose name is the visually hidden label inside
|
|
214
|
+
<div className={classes.empty} role="status">
|
|
215
|
+
<VisuallyHidden>{label}</VisuallyHidden>
|
|
216
|
+
<EmptyState
|
|
217
|
+
tier="section"
|
|
218
|
+
title={empty.title}
|
|
219
|
+
{...(empty.description !== undefined && { description: empty.description })}
|
|
220
|
+
{...(empty.action !== undefined && { action: empty.action })}
|
|
221
|
+
/>
|
|
222
|
+
</div>
|
|
223
|
+
)
|
|
224
|
+
} else {
|
|
225
|
+
const groups = grouped
|
|
226
|
+
? groupByDay(items)
|
|
227
|
+
: [{ day: toEventDate(items[0]?.at ?? 0), key: 'all', id: 'all#0', items }]
|
|
228
|
+
// A list with no real instant has no day to name: no headers, whatever `group` says.
|
|
229
|
+
const showHeaders = grouped && groups.some((g) => isValidEventDate(g.day))
|
|
230
|
+
// A caller's `dayLabel` only ever sees a real day.
|
|
231
|
+
const headerText = (day: Date): string =>
|
|
232
|
+
!isValidEventDate(day)
|
|
233
|
+
? ''
|
|
234
|
+
: dayLabel === undefined
|
|
235
|
+
? defaultDayLabel(day, nowDate)
|
|
236
|
+
: dayLabel(day, nowDate ?? day)
|
|
237
|
+
if (virtualised) {
|
|
238
|
+
const seam = {
|
|
239
|
+
rows: buildRows(groups, showHeaders, ctx, headerText),
|
|
240
|
+
overscan: 8,
|
|
241
|
+
estimateSize: density === 'timeline' ? 96 : 60,
|
|
242
|
+
className: classes.virtual,
|
|
243
|
+
anchorTo: oldestFirst ? ('end' as const) : ('start' as const),
|
|
244
|
+
// The shell scrollport is never jumped: only an own scroll node opens on its newest end.
|
|
245
|
+
// And only when the rows first appeared windowed: a list crossing 200 on an `earlier` load
|
|
246
|
+
// does not jump to the newest end.
|
|
247
|
+
initialScroll: opensAtEnd && !plainBefore ? ('end' as const) : ('start' as const),
|
|
248
|
+
// Own scroll node → the seam windows against it; none → the nearest scrolling ancestor.
|
|
249
|
+
...(ownScroll && { scrollRoot: scrollEl }),
|
|
250
|
+
}
|
|
251
|
+
content = (
|
|
252
|
+
// oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- the seam renders divs, so the list role is explicit
|
|
253
|
+
<div role="list" aria-label={label}>
|
|
254
|
+
<VirtualRows scroll="parent" {...seam} />
|
|
255
|
+
</div>
|
|
256
|
+
)
|
|
257
|
+
} else {
|
|
258
|
+
content = groups.map((g) => {
|
|
259
|
+
// Per run (day + occurrence), so the same day can open two runs and a same-day prepend
|
|
260
|
+
// does not remount the group.
|
|
261
|
+
const headerId = `${labelId}-${g.id}`
|
|
262
|
+
return (
|
|
263
|
+
<div key={g.id} className={classes.group}>
|
|
264
|
+
{showHeaders && (
|
|
265
|
+
<DayHeader id={headerId} text={headerText(g.day)} count={g.items.length} as="h3" />
|
|
266
|
+
)}
|
|
267
|
+
<ol
|
|
268
|
+
className={classes.list}
|
|
269
|
+
// The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one.
|
|
270
|
+
// oxlint-disable-next-line jsx-a11y/no-redundant-roles
|
|
271
|
+
role="list"
|
|
272
|
+
{...(showHeaders ? { 'aria-labelledby': headerId } : { 'aria-label': label })}
|
|
273
|
+
>
|
|
274
|
+
{g.items.map((item, i) => (
|
|
275
|
+
<EventRow
|
|
276
|
+
key={item.id}
|
|
277
|
+
item={item}
|
|
278
|
+
ctx={ctx}
|
|
279
|
+
first={i === 0}
|
|
280
|
+
last={i === g.items.length - 1}
|
|
281
|
+
tag="li"
|
|
282
|
+
/>
|
|
283
|
+
))}
|
|
284
|
+
</ol>
|
|
285
|
+
</div>
|
|
286
|
+
)
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// The box keeps its height for rows and skeletons; an empty state sizes to its content.
|
|
292
|
+
const boxed = ownScroll && (loading || items.length > 0)
|
|
293
|
+
const scrollStyle: CSSProperties | undefined = boxed ? { height } : undefined
|
|
294
|
+
return (
|
|
295
|
+
<div className={cx(classes.frame, className)} style={style} data-density={density}>
|
|
296
|
+
{oldestFirst && control}
|
|
297
|
+
{/* theme-allow raw-scroll-container — the list owns its scroll node when given a height, like the virtual seam. */}
|
|
298
|
+
<div
|
|
299
|
+
ref={setScrollEl}
|
|
300
|
+
className={cx(classes.root, boxed && classes.scroll)}
|
|
301
|
+
style={scrollStyle}
|
|
302
|
+
>
|
|
303
|
+
{/* One wrapper around whatever shows, so its box is the content's box (see useHeldHeight). */}
|
|
304
|
+
<div>{content}</div>
|
|
305
|
+
</div>
|
|
306
|
+
{!oldestFirst && control}
|
|
307
|
+
</div>
|
|
308
|
+
)
|
|
309
|
+
}
|
package/src/dashboard/index.ts
CHANGED
|
@@ -10,3 +10,5 @@ export { SettingsSection, SettingsRow, DangerZone } from './settings-section'
|
|
|
10
10
|
export { Meter, type MeterProps } from './meter'
|
|
11
11
|
export type { MeterSegment, MeterTick, MeterZone } from './meter-model'
|
|
12
12
|
export { BarList, type BarListProps } from './bar-list'
|
|
13
|
+
export { EventList, type EventListProps } from './event-list'
|
|
14
|
+
export { Board, type BoardProps } from './board'
|
|
@@ -774,6 +774,9 @@ export function MeterBar(props: {
|
|
|
774
774
|
...labelled,
|
|
775
775
|
]
|
|
776
776
|
const zoneLabels = compact ? [] : model.zoneLabels
|
|
777
|
+
// With no zone names to own the row below the track, the marker's reading shares the caption row
|
|
778
|
+
// with the end caption (both on one line when they fit), centred on the marker like ZoneReading.
|
|
779
|
+
const readingInRow = anchored && zoneLabels.length === 0
|
|
777
780
|
// On a zoned track the zone names own the row below; the figures at its two ends sit above the
|
|
778
781
|
// track, where nothing else competes for them. Every other tick label stays with the names.
|
|
779
782
|
const isEnd = (t: TickMark) => t.pct <= 0 || t.pct >= 100
|
|
@@ -790,13 +793,15 @@ export function MeterBar(props: {
|
|
|
790
793
|
const items: CaptionItem[] = compact
|
|
791
794
|
? []
|
|
792
795
|
: [
|
|
793
|
-
...(start !== null && !anchored
|
|
796
|
+
...(start !== null && (!anchored || readingInRow)
|
|
794
797
|
? [
|
|
795
798
|
{
|
|
796
799
|
key: 'start',
|
|
797
800
|
node: glue(start),
|
|
801
|
+
...(readingInRow && model.markerPct !== undefined && { pct: model.markerPct }),
|
|
798
802
|
// The reading sits at its fill's end (clamped inside the track); `readingAt="start"` keeps the old start edge.
|
|
799
803
|
...(props.readingAt !== 'start' &&
|
|
804
|
+
!readingInRow &&
|
|
800
805
|
model.fillEndPct !== undefined && {
|
|
801
806
|
pct: model.fillEndPct,
|
|
802
807
|
align: 'end' as const,
|
|
@@ -933,7 +938,9 @@ export function MeterBar(props: {
|
|
|
933
938
|
)}
|
|
934
939
|
</div>
|
|
935
940
|
{zoneLabels.length > 0 && <LabelRow zones={zoneLabels} ticks={belowTicks} />}
|
|
936
|
-
{anchored &&
|
|
941
|
+
{anchored &&
|
|
942
|
+
!readingInRow &&
|
|
943
|
+
quiet(<ZoneReading pct={model.markerPct ?? 0}>{start}</ZoneReading>)}
|
|
937
944
|
{!loading && model.describedByText !== null && (
|
|
938
945
|
<VisuallyHidden id={describedId} className={classes.summary}>
|
|
939
946
|
{model.describedByText}
|
|
@@ -142,7 +142,8 @@
|
|
|
142
142
|
--basalt-reading-dir: 1;
|
|
143
143
|
position: relative;
|
|
144
144
|
height: 1.25em;
|
|
145
|
-
|
|
145
|
+
/* Clipped along the row only: a descender hangs below the 1.25em box of a taller caption line. */
|
|
146
|
+
overflow-x: clip;
|
|
146
147
|
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
147
148
|
font-variant-numeric: lining-nums;
|
|
148
149
|
font-size: var(--basalt-meter-caption);
|
|
@@ -21,13 +21,28 @@
|
|
|
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
|
+
}
|
|
33
48
|
}
|
|
@@ -104,7 +104,10 @@ export type SettingsRowProps = BasaltProps &
|
|
|
104
104
|
label: string
|
|
105
105
|
/** Optional 12px muted description under the label. */
|
|
106
106
|
description?: string
|
|
107
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Right-aligned control (input/switch/button). Mounted in a `CtlSlot`: a bound input is the 32 px
|
|
109
|
+
* field (44 under a coarse pointer), not Mantine's 42 px `md`; a control's own `size` still wins.
|
|
110
|
+
*/
|
|
108
111
|
control?: ReactNode
|
|
109
112
|
/** Alternative to `control` for a fully custom right-hand region. */
|
|
110
113
|
children?: ReactNode
|
|
@@ -130,7 +133,9 @@ export function SettingsRow({
|
|
|
130
133
|
<span style={{ fontSize: VX.text.xs, color: VX.muted }}>{description}</span>
|
|
131
134
|
)}
|
|
132
135
|
</Stack>
|
|
133
|
-
<div className={cx(classes.control, classNames?.control)}>
|
|
136
|
+
<div className={cx(classes.control, classNames?.control)}>
|
|
137
|
+
<CtlSlot>{control ?? children}</CtlSlot>
|
|
138
|
+
</div>
|
|
134
139
|
</div>
|
|
135
140
|
)
|
|
136
141
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
|
@@ -109,6 +109,8 @@ import type {
|
|
|
109
109
|
import { DeltaBadge } from './delta-badge'
|
|
110
110
|
import { cx } from '../common/props'
|
|
111
111
|
import type { BasaltProps, SlotStylesProps, Tone } from '../common/props'
|
|
112
|
+
import { splitEmptyCopy } from '../common/empty-copy'
|
|
113
|
+
import { EmptyState } from './empty-state'
|
|
112
114
|
import { ErrorState, QueryState, resolveQueryBranch } from './query-state'
|
|
113
115
|
import type { QueryBranch, QueryStateLike } from './query-state'
|
|
114
116
|
import classes from './stat-card.module.css'
|
|
@@ -310,18 +312,21 @@ function renderValueBody({
|
|
|
310
312
|
resolved,
|
|
311
313
|
figure,
|
|
312
314
|
emptyText,
|
|
315
|
+
hasDelta,
|
|
313
316
|
}: {
|
|
317
|
+
hasDelta: boolean
|
|
314
318
|
pending: boolean
|
|
315
319
|
resolved: QueryBranch<unknown> | undefined
|
|
316
320
|
figure: ReactNode
|
|
317
321
|
emptyText: string
|
|
318
322
|
}): ReactNode {
|
|
319
|
-
|
|
323
|
+
const copy = splitEmptyCopy(emptyText)
|
|
324
|
+
if (resolved === undefined) return pending ? <ValueSkeleton delta={hasDelta} /> : figure
|
|
320
325
|
// `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 />
|
|
326
|
+
if (pending && resolved.kind !== 'error') return <ValueSkeleton delta={hasDelta} />
|
|
322
327
|
switch (resolved.kind) {
|
|
323
328
|
case 'pending':
|
|
324
|
-
return <ValueSkeleton />
|
|
329
|
+
return <ValueSkeleton delta={hasDelta} />
|
|
325
330
|
case 'error':
|
|
326
331
|
// The error state itself — not `QueryState` with nothing to wrap, which over cached-empty data
|
|
327
332
|
// would draw its "cached data" banner above an empty region.
|
|
@@ -335,7 +340,15 @@ function renderValueBody({
|
|
|
335
340
|
/>
|
|
336
341
|
)
|
|
337
342
|
case 'empty':
|
|
338
|
-
return
|
|
343
|
+
return (
|
|
344
|
+
<EmptyState
|
|
345
|
+
tier="section"
|
|
346
|
+
title={copy.title}
|
|
347
|
+
{...(copy.description !== undefined && { description: copy.description })}
|
|
348
|
+
className={classes.empty}
|
|
349
|
+
style={{ padding: 'var(--vx-space-stack-md) var(--vx-space-stack-lg)' }}
|
|
350
|
+
/>
|
|
351
|
+
)
|
|
339
352
|
case 'ready':
|
|
340
353
|
return figure
|
|
341
354
|
default:
|
|
@@ -479,7 +492,13 @@ export function StatCard({
|
|
|
479
492
|
</div>
|
|
480
493
|
)
|
|
481
494
|
|
|
482
|
-
const valueBody = renderValueBody({
|
|
495
|
+
const valueBody = renderValueBody({
|
|
496
|
+
pending,
|
|
497
|
+
resolved,
|
|
498
|
+
figure,
|
|
499
|
+
emptyText,
|
|
500
|
+
hasDelta: delta !== undefined,
|
|
501
|
+
})
|
|
483
502
|
|
|
484
503
|
const breakdownCount = breakdown?.length ?? 0
|
|
485
504
|
const hasBreakdown = breakdownCount > 0
|
|
@@ -525,7 +544,7 @@ export function StatCard({
|
|
|
525
544
|
{...(pending && { 'aria-busy': true })}
|
|
526
545
|
>
|
|
527
546
|
{pending && <VisuallyHidden>{`Loading ${title}`}</VisuallyHidden>}
|
|
528
|
-
<div className={cx(classes.header, classNames?.header)}>
|
|
547
|
+
<div className={cx(classes.header, classNames?.header)} data-basalt-header-block>
|
|
529
548
|
<CaptionRow
|
|
530
549
|
title={title}
|
|
531
550
|
{...(icon !== undefined && { icon })}
|
|
@@ -378,15 +378,18 @@
|
|
|
378
378
|
.footerCell {
|
|
379
379
|
flex: 1 1 14rem;
|
|
380
380
|
min-width: 0;
|
|
381
|
+
font-size: var(--vx-text-sm);
|
|
381
382
|
padding: var(--vx-space-stack-md);
|
|
382
383
|
border-inline-start: 1px solid var(--vx-divider);
|
|
383
384
|
border-block-start: 1px solid var(--vx-divider);
|
|
384
385
|
}
|
|
385
386
|
|
|
386
387
|
/* 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.
|
|
388
|
+
* the article, split from the readings by the strip's own hairline. Both footer slots take the strip's
|
|
389
|
+
* `sm` step, never the inherited body size (it would outrank the cell's own statement). */
|
|
388
390
|
.underCell {
|
|
389
391
|
min-width: 0;
|
|
392
|
+
font-size: var(--vx-text-sm);
|
|
390
393
|
margin: var(--vx-space-stack-md) var(--vx-space-stack-md) 0;
|
|
391
394
|
padding-block-start: var(--vx-space-stack-sm);
|
|
392
395
|
border-block-start: 1px solid var(--vx-divider);
|
|
@@ -286,7 +286,7 @@ function StripCell({
|
|
|
286
286
|
{...(state === undefined && rows !== undefined && { 'data-strip-has-rows': '' })}
|
|
287
287
|
{...(cell.stale && { 'data-stale': 'true' })}
|
|
288
288
|
>
|
|
289
|
-
<div className={classes.head} data-strip-head>
|
|
289
|
+
<div className={classes.head} data-strip-head data-basalt-header-block>
|
|
290
290
|
<div className={classes.captionLine}>
|
|
291
291
|
<div className={classes.captionMain}>
|
|
292
292
|
{/* The caption and its info glyph are one unit: the qualifier wraps whole, never between them. */}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Layout keys on the enclosing card's OWN width (`container: basalt-card`, declared by ChartCard /
|
|
13
13
|
* StatCard / Section — docs/DESIGN-CORE.md § Layout, elevation, shapes), never the viewport: below 480px the subtitle folds
|
|
14
|
-
* into the info glyph; from 480px (wave 8) `value` + `delta` move onto the title row. Wrapping and
|
|
14
|
+
* into the info glyph (a ChartCard keeps it, wrapped to two lines — wave 43); from 480px (wave 8) `value` + `delta` move onto the title row. Wrapping and
|
|
15
15
|
* shrinking are unconditional. The subtitle ALSO folds (regardless of width) whenever the card's own
|
|
16
16
|
* height is under 280px — see the `[data-basalt-card-short]` block below (wave 8's header-economy
|
|
17
17
|
* law). No enclosing card, no container: the standard layout. Container conditions are px literals
|
|
@@ -394,6 +394,22 @@
|
|
|
394
394
|
.foldNote {
|
|
395
395
|
display: block;
|
|
396
396
|
}
|
|
397
|
+
|
|
398
|
+
/* A chart card keeps its subtitle (argo's line/dot key) on its own line at every width: up to two
|
|
399
|
+
* lines, then an ellipsis; the full text stays in the DOM. StatCard and Section still fold. The
|
|
400
|
+
* short-height block below out-ranks this (its selector is one class heavier). */
|
|
401
|
+
[data-basalt-chart-header] .subtitle {
|
|
402
|
+
display: -webkit-box;
|
|
403
|
+
-webkit-box-orient: vertical;
|
|
404
|
+
-webkit-line-clamp: 2;
|
|
405
|
+
line-clamp: 2;
|
|
406
|
+
overflow: hidden;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
[data-basalt-chart-header] .foldGlyph,
|
|
410
|
+
[data-basalt-chart-header] .foldNote {
|
|
411
|
+
display: none;
|
|
412
|
+
}
|
|
397
413
|
}
|
|
398
414
|
|
|
399
415
|
/*
|