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
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The pill reads the filter's name while the selection carries no information — empty (no
|
|
5
5
|
* constraint) or every option (the same thing said the long way) — and switches to a count once it
|
|
6
|
-
* does: `
|
|
7
|
-
*
|
|
6
|
+
* does: `Channels` → `Channels 3 selected` (label muted, count bright — the pill anatomy in
|
|
7
|
+
* `filter-pill.tsx`). A `noun` replaces `selected`: `Channels 3 channels`.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* <MultiSelectFilter field={analytics.field.channels} label="All channels" noun="channels" />
|
|
@@ -31,7 +31,7 @@ import type { MultiField } from '../state/fields'
|
|
|
31
31
|
import type { FilterBase, FilterOption } from './filter-base'
|
|
32
32
|
import classes from './controls.module.css'
|
|
33
33
|
import { POPOVER_ROW_HIT_GAP, useFilterRegistration, useFilterSurface } from './filter-context'
|
|
34
|
-
import { FilterClearButton, FilterPill } from './filter-pill'
|
|
34
|
+
import { FilterClearButton, FilterPill, filterReading } from './filter-pill'
|
|
35
35
|
import { useControlName } from './control-name'
|
|
36
36
|
import { CheckGlyph } from './glyphs'
|
|
37
37
|
import { PanelRow } from './panel-row'
|
|
@@ -52,9 +52,9 @@ export type MultiSelectFilterProps<T extends string> = UncontrolledProps &
|
|
|
52
52
|
*/
|
|
53
53
|
readonly clearable?: boolean
|
|
54
54
|
/**
|
|
55
|
-
* The
|
|
55
|
+
* The word after the count, in place of `selected`: `3 channels`.
|
|
56
56
|
*
|
|
57
|
-
* @default
|
|
57
|
+
* @default 'selected'
|
|
58
58
|
*/
|
|
59
59
|
readonly noun?: string
|
|
60
60
|
/**
|
|
@@ -106,14 +106,20 @@ export function MultiSelectFilter<T extends string>(props: MultiSelectFilterProp
|
|
|
106
106
|
const clearFilter = (): void => {
|
|
107
107
|
field.clear()
|
|
108
108
|
}
|
|
109
|
-
useFilterRegistration(!isDefault, clearFilter)
|
|
110
109
|
|
|
111
110
|
// The prop wins whole, never merged — same rule as `EnumFilter`: a catalogue that dropped a row
|
|
112
|
-
// must be able to drop it, and `All channels` is
|
|
111
|
+
// must be able to drop it, and `All channels` is judged against the rows actually shown.
|
|
113
112
|
const options: readonly FilterOption[] = optionsProp ?? field.options
|
|
114
113
|
const inSheet = surface === 'sheet'
|
|
115
114
|
const inPanel = surface === 'panel'
|
|
116
|
-
|
|
115
|
+
// ONE predicate for "this filter is filtering" — registration (the `Filters (n)` count and `Reset
|
|
116
|
+
// all`), the Clear button, the muted/bright anatomy and the accent border all read it. An empty
|
|
117
|
+
// selection or one holding EVERY offered option says nothing; "every" is set equality against the
|
|
118
|
+
// option values, never a length comparison (a deep link `[web, social]` over a catalogue
|
|
119
|
+
// `[web, email]` has the same length and still filters `email` out).
|
|
120
|
+
const everyOffered = options.every((option) => value.includes(option.value as T))
|
|
121
|
+
const informative = !isDefault && value.length > 0 && !everyOffered
|
|
122
|
+
useFilterRegistration(informative, clearFilter)
|
|
117
123
|
const { labelId } = useControlName(label, inSheet || inPanel)
|
|
118
124
|
|
|
119
125
|
// One toggle, shared by both list forms — the rows are rendered from `options`, whose values
|
|
@@ -175,14 +181,19 @@ export function MultiSelectFilter<T extends string>(props: MultiSelectFilterProp
|
|
|
175
181
|
/>
|
|
176
182
|
))}
|
|
177
183
|
</Stack>
|
|
178
|
-
{clearable &&
|
|
184
|
+
{clearable && informative && disabled !== true && <FilterClearButton onClear={clearFilter} />}
|
|
179
185
|
</Checkbox.Group>
|
|
180
186
|
)
|
|
181
187
|
|
|
182
188
|
return (
|
|
183
189
|
<FilterPill
|
|
184
|
-
|
|
185
|
-
|
|
190
|
+
{...filterReading({
|
|
191
|
+
name: label,
|
|
192
|
+
informative,
|
|
193
|
+
value: `${value.length} ${noun ?? 'selected'}`,
|
|
194
|
+
unsetText: label,
|
|
195
|
+
})}
|
|
196
|
+
active={informative}
|
|
186
197
|
{...(disabled === true && { disabled: true })}
|
|
187
198
|
{...(icon !== undefined && { icon })}
|
|
188
199
|
{...(className !== undefined && { className })}
|
|
@@ -40,7 +40,7 @@ import type { RangeField, RangeValue } from '../state/fields'
|
|
|
40
40
|
import classes from './controls.module.css'
|
|
41
41
|
import { useFilterRegistration, useFilterSurface } from './filter-context'
|
|
42
42
|
import type { FilterBase } from './filter-base'
|
|
43
|
-
import { FilterPill } from './filter-pill'
|
|
43
|
+
import { FilterPill, filterReading } from './filter-pill'
|
|
44
44
|
import { CalendarGlyph } from './glyphs'
|
|
45
45
|
import { useControlName } from './control-name'
|
|
46
46
|
import { PanelRow } from './panel-row'
|
|
@@ -67,7 +67,7 @@ export type RangeCustomPickerProps = {
|
|
|
67
67
|
/** Everything about the props that does not depend on the field's `custom` flag. */
|
|
68
68
|
type RangeFilterCommon<P extends string, C extends boolean> = UncontrolledProps &
|
|
69
69
|
Omit<FilterBase, 'clearable' | 'label'> & {
|
|
70
|
-
/**
|
|
70
|
+
/** The filter's name: the sheet-form heading, and the pill's muted label once a range is chosen (`Window 7d`); at the default the pill reads the range alone. @default 'Range' */
|
|
71
71
|
readonly label?: string
|
|
72
72
|
/**
|
|
73
73
|
* A range handle from either store factory. Generic over the field's `custom` flag so a
|
|
@@ -214,9 +214,15 @@ export function RangeFilter<P extends string>(
|
|
|
214
214
|
</Stack>
|
|
215
215
|
)
|
|
216
216
|
|
|
217
|
+
const rangeText = rangeLabel(value, options)
|
|
217
218
|
return (
|
|
218
219
|
<FilterPill
|
|
219
|
-
|
|
220
|
+
{...filterReading({
|
|
221
|
+
name: label,
|
|
222
|
+
informative: !isDefault,
|
|
223
|
+
value: rangeText,
|
|
224
|
+
unsetText: rangeText,
|
|
225
|
+
})}
|
|
220
226
|
active={!isDefault}
|
|
221
227
|
numeric={numeric && value.preset !== 'custom'}
|
|
222
228
|
{...(disabled === true && { disabled: true })}
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
* />
|
|
47
47
|
*/
|
|
48
48
|
import { Skeleton, VisuallyHidden } from '@mantine/core'
|
|
49
|
+
import { EmptyState } from './empty-state'
|
|
49
50
|
import { isValidElement } from 'react'
|
|
50
51
|
import type { ReactNode } from 'react'
|
|
51
52
|
import { cx } from '../common/props'
|
|
@@ -96,7 +97,7 @@ export type BarListProps = BasaltProps & {
|
|
|
96
97
|
loading?: boolean
|
|
97
98
|
/** Skeleton rows while loading. Default 5. */
|
|
98
99
|
loadingRows?: number
|
|
99
|
-
/**
|
|
100
|
+
/** Title of the `EmptyState` tile shown when `items` is empty. Default "No items to compare yet"; pass the cause for your list. */
|
|
100
101
|
emptyText?: string
|
|
101
102
|
}
|
|
102
103
|
|
|
@@ -127,7 +128,7 @@ export function BarList({
|
|
|
127
128
|
secondaryAlign,
|
|
128
129
|
loading = false,
|
|
129
130
|
loadingRows = 5,
|
|
130
|
-
emptyText = 'No
|
|
131
|
+
emptyText = 'No items to compare yet',
|
|
131
132
|
className,
|
|
132
133
|
style,
|
|
133
134
|
}: BarListProps) {
|
|
@@ -158,9 +159,11 @@ export function BarList({
|
|
|
158
159
|
if (items.length === 0) {
|
|
159
160
|
return (
|
|
160
161
|
<div className={cx(classes.frame, className)} style={style}>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
{/* oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a polite live region whose name is the visually hidden label inside; `<output>` cannot hold the tile's block content */}
|
|
163
|
+
<div className={classes.root} role="status">
|
|
164
|
+
<VisuallyHidden>{label}</VisuallyHidden>
|
|
165
|
+
<EmptyState tier="section" title={emptyText} className={classes.empty} />
|
|
166
|
+
</div>
|
|
164
167
|
</div>
|
|
165
168
|
)
|
|
166
169
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** Roving-focus movement for `Board`: pure, so the keyboard law is testable without a DOM. */
|
|
2
|
+
|
|
3
|
+
export type BoardKey = 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'Home' | 'End'
|
|
4
|
+
|
|
5
|
+
export const BOARD_KEYS = [
|
|
6
|
+
'ArrowUp',
|
|
7
|
+
'ArrowDown',
|
|
8
|
+
'ArrowLeft',
|
|
9
|
+
'ArrowRight',
|
|
10
|
+
'Home',
|
|
11
|
+
'End',
|
|
12
|
+
] as const satisfies readonly BoardKey[]
|
|
13
|
+
|
|
14
|
+
export function isBoardKey(key: string): key is BoardKey {
|
|
15
|
+
return (BOARD_KEYS as readonly string[]).includes(key)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type BoardPos = { col: number; row: number }
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The position `key` moves to from `from`, or `null` when it stays put. `sizes` is the card count of
|
|
22
|
+
* every column in order. Up/Down/Home/End stay in the column; Left/Right jump to the nearest
|
|
23
|
+
* non-empty column in that direction and land on the same row index, clamped to its last card.
|
|
24
|
+
*/
|
|
25
|
+
export function moveOnBoard(
|
|
26
|
+
sizes: readonly number[],
|
|
27
|
+
from: BoardPos,
|
|
28
|
+
key: BoardKey,
|
|
29
|
+
): BoardPos | null {
|
|
30
|
+
const size = sizes[from.col] ?? 0
|
|
31
|
+
let next: BoardPos
|
|
32
|
+
switch (key) {
|
|
33
|
+
case 'ArrowUp':
|
|
34
|
+
next = { col: from.col, row: from.row - 1 }
|
|
35
|
+
break
|
|
36
|
+
case 'ArrowDown':
|
|
37
|
+
next = { col: from.col, row: from.row + 1 }
|
|
38
|
+
break
|
|
39
|
+
case 'Home':
|
|
40
|
+
next = { col: from.col, row: 0 }
|
|
41
|
+
break
|
|
42
|
+
case 'End':
|
|
43
|
+
next = { col: from.col, row: size - 1 }
|
|
44
|
+
break
|
|
45
|
+
case 'ArrowLeft':
|
|
46
|
+
case 'ArrowRight': {
|
|
47
|
+
const step = key === 'ArrowLeft' ? -1 : 1
|
|
48
|
+
let col = from.col + step
|
|
49
|
+
while (col >= 0 && col < sizes.length && (sizes[col] ?? 0) === 0) col += step
|
|
50
|
+
if (col < 0 || col >= sizes.length) return null
|
|
51
|
+
next = { col, row: Math.min(from.row, (sizes[col] ?? 1) - 1) }
|
|
52
|
+
break
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (next.row < 0 || next.row >= (sizes[next.col] ?? 0)) return null
|
|
56
|
+
return next.col === from.col && next.row === from.row ? null : next
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Only http(s) and relative references render as links; anything else (`javascript:`, `data:`,
|
|
61
|
+
* `mailto:`) stays text. The scheme is case-insensitive (`HTTPS://` is http). A leading `/` must not
|
|
62
|
+
* be followed by another `/` or a `\` — browsers read both as a host (`//evil`, `/\evil`) — and a
|
|
63
|
+
* leading `\` is rejected the same way.
|
|
64
|
+
*/
|
|
65
|
+
export function isSafeHref(href: string): boolean {
|
|
66
|
+
return /^https?:\/\//i.test(href) || /^(?:\/(?![/\\])|\.{1,2}\/|#|\?)/.test(href)
|
|
67
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Board (docs/waves/design-parity/SPEC.md § 6.8). Columns share the row; each scrolls alone inside a
|
|
3
|
+
* Mantine ScrollArea bounded by `height`. Cards are Mantine Cards: the theme owns inset, radius and
|
|
4
|
+
* surface, so nothing here sets them. The open button is stretched over its card (one click target,
|
|
5
|
+
* one tab stop); the record link and the meter slot sit above that overlay.
|
|
6
|
+
*/
|
|
7
|
+
.root {
|
|
8
|
+
inline-size: 100%;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: var(--vx-space-stack-sm);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.columns {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: flex-start;
|
|
18
|
+
gap: var(--vx-space-stack-sm);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.column {
|
|
22
|
+
flex: 1 1 0;
|
|
23
|
+
min-width: 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: var(--vx-space-stack-sm);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.head {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: var(--vx-space-control-gap);
|
|
33
|
+
min-width: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.title {
|
|
37
|
+
margin: 0;
|
|
38
|
+
min-width: 0;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
text-overflow: ellipsis;
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
font-size: var(--vx-text-sm);
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
color: var(--vx-ink);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.count {
|
|
48
|
+
font-family: var(--basalt-font-mono);
|
|
49
|
+
font-size: var(--vx-text-micro);
|
|
50
|
+
color: var(--vx-muted);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.total {
|
|
54
|
+
margin-inline-start: auto;
|
|
55
|
+
font-family: var(--basalt-font-mono);
|
|
56
|
+
font-size: var(--vx-text-micro);
|
|
57
|
+
color: var(--vx-muted);
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.list {
|
|
62
|
+
margin: 0;
|
|
63
|
+
padding: 0;
|
|
64
|
+
list-style: none;
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
/* 6 px at level 0, riding the density multiplier like every other step. */
|
|
68
|
+
gap: calc(var(--vx-space-stack-xs) * 1.5);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.card {
|
|
72
|
+
position: relative;
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
gap: var(--vx-space-stack-xs);
|
|
76
|
+
min-width: 0;
|
|
77
|
+
overflow-wrap: anywhere;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.caption {
|
|
81
|
+
margin: 0;
|
|
82
|
+
font-family: var(--basalt-font-mono);
|
|
83
|
+
font-size: var(--vx-text-micro);
|
|
84
|
+
color: var(--vx-muted);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.open {
|
|
88
|
+
all: unset;
|
|
89
|
+
display: block;
|
|
90
|
+
font-size: var(--vx-text-sm);
|
|
91
|
+
color: var(--vx-ink);
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* The whole card is the target. */
|
|
96
|
+
.open::after {
|
|
97
|
+
content: '';
|
|
98
|
+
position: absolute;
|
|
99
|
+
inset: 0;
|
|
100
|
+
border-radius: inherit;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.open:focus-visible::after {
|
|
104
|
+
outline: 2px solid var(--vx-focus-ring, var(--mantine-primary-color-filled));
|
|
105
|
+
outline-offset: 1px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.record,
|
|
109
|
+
.meter {
|
|
110
|
+
position: relative;
|
|
111
|
+
z-index: 1;
|
|
112
|
+
font-size: var(--vx-text-xs);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* The record link is chrome, not an accent site (SPEC § 6.12): ink in both schemes, and a visited
|
|
116
|
+
record never changes colour. */
|
|
117
|
+
a.record,
|
|
118
|
+
a.record:visited {
|
|
119
|
+
color: var(--vx-ink);
|
|
120
|
+
text-decoration: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
a.record:hover {
|
|
124
|
+
text-decoration: underline;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
a.record:focus-visible {
|
|
128
|
+
outline: 2px solid var(--vx-focus-ring, var(--mantine-primary-color-filled));
|
|
129
|
+
outline-offset: 1px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.status {
|
|
133
|
+
margin: 0;
|
|
134
|
+
font-size: var(--vx-text-xs);
|
|
135
|
+
color: var(--vx-muted);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.empty {
|
|
139
|
+
display: block;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.skeletonTitle {
|
|
143
|
+
inline-size: 40%;
|
|
144
|
+
block-size: 0.75rem;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.skeletonCaption {
|
|
148
|
+
inline-size: 35%;
|
|
149
|
+
block-size: 0.5rem;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.skeletonLine {
|
|
153
|
+
inline-size: 85%;
|
|
154
|
+
block-size: 0.75rem;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.skeletonStatus {
|
|
158
|
+
inline-size: 50%;
|
|
159
|
+
block-size: 0.5rem;
|
|
160
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
|
|
3
|
+
* signature — so dot access stays verbatim under the package's strict flags.
|
|
4
|
+
*/
|
|
5
|
+
declare const classes: {
|
|
6
|
+
readonly root: string
|
|
7
|
+
readonly columns: string
|
|
8
|
+
readonly column: string
|
|
9
|
+
readonly head: string
|
|
10
|
+
readonly title: string
|
|
11
|
+
readonly count: string
|
|
12
|
+
readonly total: string
|
|
13
|
+
readonly list: string
|
|
14
|
+
readonly card: string
|
|
15
|
+
readonly caption: string
|
|
16
|
+
readonly open: string
|
|
17
|
+
readonly record: string
|
|
18
|
+
readonly meter: string
|
|
19
|
+
readonly status: string
|
|
20
|
+
readonly empty: string
|
|
21
|
+
readonly skeletonTitle: string
|
|
22
|
+
readonly skeletonCaption: string
|
|
23
|
+
readonly skeletonLine: string
|
|
24
|
+
readonly skeletonStatus: string
|
|
25
|
+
}
|
|
26
|
+
export default classes
|