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
package/src/styles.css
CHANGED
|
@@ -153,6 +153,29 @@
|
|
|
153
153
|
font-size: max(var(--basalt-input-fz-floor, 16px), var(--input-fz, 1rem)) !important;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/* Browser autofill paints its own yellow/blue over a field, and a focused Select keeps it. The UA
|
|
157
|
+
background cannot be overridden directly, so the field surface is painted over it with an inset
|
|
158
|
+
shadow and the long transition holds the UA colour off; text and caret keep the ink. A themed
|
|
159
|
+
`.input` sets its own `box-shadow` UNLAYERED, which outranks this layer: `controls.module.css`
|
|
160
|
+
re-points `--field-depth` under `:-webkit-autofill` for those. */
|
|
161
|
+
input:-webkit-autofill,
|
|
162
|
+
input:-webkit-autofill:hover,
|
|
163
|
+
input:-webkit-autofill:focus {
|
|
164
|
+
-webkit-text-fill-color: var(--vx-ink);
|
|
165
|
+
caret-color: var(--vx-ink);
|
|
166
|
+
box-shadow: 0 0 0 100vmax var(--vx-surface-field) inset;
|
|
167
|
+
transition: background-color 600000s 0s;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* A Slider's bar and thumb fill in ink, not the accent, unless it encodes a status: an explicit
|
|
171
|
+
`color=` writes `--slider-color` inline, which outranks this. Mantine's own default sits in
|
|
172
|
+
`@layer mantine`, so this layer wins. In the dark scheme the thumb is filled with the same var,
|
|
173
|
+
a light disc with its white border; the drag-value label does not read it. */
|
|
174
|
+
.mantine-Slider-root,
|
|
175
|
+
.mantine-RangeSlider-root {
|
|
176
|
+
--slider-color: var(--vx-ink);
|
|
177
|
+
}
|
|
178
|
+
|
|
156
179
|
/* `data-numeric` — one typographic law, every element. A number read as a MEASUREMENT (a preset
|
|
157
180
|
like `7d`/`30d`, a KPI value, a table cell, a count tag) is mono with tabular figures, so
|
|
158
181
|
digits line up column-wise and a changing value does not reflow its neighbours. Declared here,
|
|
@@ -386,6 +409,52 @@
|
|
|
386
409
|
}
|
|
387
410
|
}
|
|
388
411
|
|
|
412
|
+
/* MapLibre's compact attribution (Wave 43, argo's astro Map tab). basalt has no maplibre dependency;
|
|
413
|
+
* this only restyles the control a consumer's map renders, onto the radius scale and the micro text
|
|
414
|
+
* size: the shipped 12 px radius on the box and its 24 px button is off the scale and, over a card,
|
|
415
|
+
* a nested step under 3 px. The box takes the control tier (4 px under a flush card), the button the
|
|
416
|
+
* Mantine `xs` step (4 px under the box).
|
|
417
|
+
*
|
|
418
|
+
* UNLAYERED on purpose: `maplibre-gl.css` is unlayered, and an unlayered rule beats every layered
|
|
419
|
+
* one whatever the specificity, so a `@layer basalt` block would lose to it. The doubled `:root`
|
|
420
|
+
* lifts each rule to (0,4,0), over maplibre's highest (0,3,0) (`.maplibregl-ctrl-bottom-left >
|
|
421
|
+
* .maplibregl-ctrl-attrib.maplibregl-compact-show`, which sets its own 12 px radius), whichever
|
|
422
|
+
* stylesheet loads last and in every corner and state. A consumer overrides with a longer selector,
|
|
423
|
+
* or an equal one later in source. `.maplibregl-ctrl-group` is not here: its 4 px radius is already
|
|
424
|
+
* a scale step. */
|
|
425
|
+
:root:root .maplibregl-ctrl.maplibregl-ctrl-attrib {
|
|
426
|
+
border-radius: var(--vx-radius-ctrl);
|
|
427
|
+
background-color: var(--vx-surface-panel);
|
|
428
|
+
color: var(--vx-muted);
|
|
429
|
+
font-size: var(--vx-text-micro);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
:root:root .maplibregl-ctrl-attrib a {
|
|
433
|
+
color: inherit;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/* One step under the box, snapped onto the scale like the SegmentedControl indicator: 2 when the box
|
|
437
|
+
* leaves a 3 px step, else square. */
|
|
438
|
+
:root:root .maplibregl-ctrl-attrib-button {
|
|
439
|
+
/* theme-allow css-raw-surface — a snapped nested step: the scale's 2 px xs, or square under a small box */
|
|
440
|
+
border-radius: round(down, min(2px, max(0px, var(--vx-radius-ctrl) - 3px)), 2px);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/* The glyph is maplibre's dark SVG background-image, drawn again as a mask in the muted ink so it
|
|
444
|
+
* follows the scheme (a `filter` would also invert the button's own fill). */
|
|
445
|
+
:root:root .maplibregl-ctrl-attrib-button {
|
|
446
|
+
background-image: none;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
:root:root .maplibregl-ctrl-attrib-button::after {
|
|
450
|
+
content: '';
|
|
451
|
+
position: absolute;
|
|
452
|
+
inset: 0;
|
|
453
|
+
background-color: var(--vx-muted);
|
|
454
|
+
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0v-3'/%3E%3C/svg%3E")
|
|
455
|
+
center / 24px 24px no-repeat;
|
|
456
|
+
}
|
|
457
|
+
|
|
389
458
|
/* chart-engine:start — generated by scripts/gen-chart-css.ts from chartEngineCss() */
|
|
390
459
|
@layer basalt {
|
|
391
460
|
:root {
|
package/src/surfaces.ts
CHANGED
|
@@ -63,6 +63,7 @@ export const PLUGIN_RULE_ID_LIST = [
|
|
|
63
63
|
'raw-breakpoint',
|
|
64
64
|
'no-dev-helper',
|
|
65
65
|
'route-view-transition',
|
|
66
|
+
'status-fill-as-text',
|
|
66
67
|
] as const
|
|
67
68
|
|
|
68
69
|
/** One registered oxlint plugin rule id — the literal union of {@link PLUGIN_RULE_ID_LIST}. */
|
|
@@ -357,7 +358,12 @@ export const SURFACES = {
|
|
|
357
358
|
// The type-scale rules live with the tokens, not with `.`: both police a value that left the
|
|
358
359
|
// `--vx-*` system, which is this surface's whole subject. `token-layer-boundary` is the
|
|
359
360
|
// repo-local-only rule that keeps the layer upstream of Mantine (see below).
|
|
360
|
-
pluginRules: [
|
|
361
|
+
pluginRules: [
|
|
362
|
+
'no-raw-font-size',
|
|
363
|
+
'raw-size-literal',
|
|
364
|
+
'status-fill-as-text',
|
|
365
|
+
'token-layer-boundary',
|
|
366
|
+
],
|
|
361
367
|
description:
|
|
362
368
|
'VX token refs, buildPaletteCss, defineSeries, seriesTokens, groupTokens, alpha (Mantine-free)',
|
|
363
369
|
globs: {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Cell kinds (`meta.kind`, SPEC § 6.6). Each class is the CHROME of one kind on its `<td>`; the font
|
|
3
|
+
* SIZE stays the theme's `sm` on `td`. Colours are tokens, never literals.
|
|
4
|
+
*/
|
|
5
|
+
.entity {
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
font-weight: 500;
|
|
9
|
+
color: var(--vx-ink);
|
|
10
|
+
text-overflow: ellipsis;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.status {
|
|
15
|
+
white-space: nowrap;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* SPEC D33: figures are the proportional sans with lining tabular numerals; only times are mono. */
|
|
19
|
+
.number {
|
|
20
|
+
font-variant-numeric: tabular-nums;
|
|
21
|
+
font-weight: 500;
|
|
22
|
+
color: var(--vx-ink);
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.relativeTime {
|
|
27
|
+
font-family: var(--mantine-font-family-monospace);
|
|
28
|
+
font-variant-numeric: tabular-nums;
|
|
29
|
+
color: var(--vx-muted);
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.meter {
|
|
34
|
+
min-width: calc(4rem * var(--mantine-scale));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.text {
|
|
38
|
+
color: var(--vx-ink);
|
|
39
|
+
white-space: normal;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* An absent value: a muted em dash, never an empty cell. */
|
|
43
|
+
.dash {
|
|
44
|
+
color: var(--vx-faint);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* The full date for assistive tech, inside the `<time>`: visually hidden, still announced. */
|
|
48
|
+
.srOnly {
|
|
49
|
+
position: absolute;
|
|
50
|
+
width: 1px;
|
|
51
|
+
height: 1px;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
clip-path: inset(50%);
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 dash: string
|
|
7
|
+
readonly entity: string
|
|
8
|
+
readonly meter: string
|
|
9
|
+
readonly number: string
|
|
10
|
+
readonly relativeTime: string
|
|
11
|
+
readonly srOnly: string
|
|
12
|
+
readonly status: string
|
|
13
|
+
readonly text: string
|
|
14
|
+
}
|
|
15
|
+
export default classes
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `meta.kind` for `BasaltDataTable` (`docs/waves/design-parity/SPEC.md` § 6.6): the chrome a cell
|
|
3
|
+
* takes by KIND, and the content a kind supplies when its column has no `cell` of its own. The table
|
|
4
|
+
* calls three seams from its header and cell render sites: {@link resolveKind} (validate),
|
|
5
|
+
* {@link kindClass} / {@link kindAlign} (chrome) and {@link KindCell} (content).
|
|
6
|
+
*/
|
|
7
|
+
import { Badge, Skeleton, Tooltip } from '@mantine/core'
|
|
8
|
+
import type { Cell, Column, Row, RowData } from '@tanstack/react-table'
|
|
9
|
+
import { FlexRender } from '@tanstack/react-table'
|
|
10
|
+
import type { ReactNode } from 'react'
|
|
11
|
+
import { cx } from '../common/props'
|
|
12
|
+
import { Meter } from '../dashboard/meter'
|
|
13
|
+
import { dateTime, integer, relativeTime } from '../format'
|
|
14
|
+
import { numberFormat } from '../format/shared'
|
|
15
|
+
import { DATA_TABLE_COLUMN_KINDS } from './table-features'
|
|
16
|
+
import type { BasaltTableFeatures, DataTableAlign, DataTableColumnKind } from './table-features'
|
|
17
|
+
import classes from './cell-kinds.module.css'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The table's own default `cell` (TanStack's, restated), installed as `defaultColumn.cell` so a
|
|
21
|
+
* column WITHOUT a renderer is identifiable by identity: v9 merges its default into every
|
|
22
|
+
* `columnDef`, so `columnDef.cell === undefined` can never be asked.
|
|
23
|
+
*/
|
|
24
|
+
export function DEFAULT_CELL(props: { renderValue(): unknown }) {
|
|
25
|
+
return (props.renderValue() as { toString?(): string } | null | undefined)?.toString?.() ?? null
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const KINDS: ReadonlySet<string> = new Set(DATA_TABLE_COLUMN_KINDS)
|
|
29
|
+
|
|
30
|
+
/** Reads `meta.kind`, throwing on a value outside the seven — the check a type cannot make at runtime. */
|
|
31
|
+
export function resolveKind<T extends RowData>(
|
|
32
|
+
column: Column<BasaltTableFeatures, T, unknown>,
|
|
33
|
+
): DataTableColumnKind | undefined {
|
|
34
|
+
const kind = column.columnDef.meta?.kind
|
|
35
|
+
if (kind === undefined) return undefined
|
|
36
|
+
if (!KINDS.has(kind)) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`BasaltDataTable: column "${column.id}" has meta.kind=${JSON.stringify(kind)} — ` +
|
|
39
|
+
`expected ${DATA_TABLE_COLUMN_KINDS.map((k) => `'${k}'`).join(' | ')}.`,
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
return kind
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Figures read right: the kind's default alignment, which an explicit `meta.align` overrides. */
|
|
46
|
+
export function kindAlign(kind: DataTableColumnKind | undefined): DataTableAlign | undefined {
|
|
47
|
+
return kind === 'number' || kind === 'money' ? 'right' : undefined
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** A `text` column whose longest cell is this many characters or fewer has nothing to wrap. */
|
|
51
|
+
const SHORT_TEXT = 32
|
|
52
|
+
|
|
53
|
+
/** Whether every cell of the column renders a short string (needs at least one row to say so). */
|
|
54
|
+
function isShortText<T extends RowData>(
|
|
55
|
+
id: string,
|
|
56
|
+
rows: readonly Row<BasaltTableFeatures, T>[],
|
|
57
|
+
): boolean {
|
|
58
|
+
return (
|
|
59
|
+
rows.length > 0 &&
|
|
60
|
+
rows.every((row) => {
|
|
61
|
+
const value: unknown = row.getValue(id)
|
|
62
|
+
return typeof value === 'string' && value.length <= SHORT_TEXT
|
|
63
|
+
})
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Column sizing law (SPEC § 6.6): a data column is as wide as its header or widest cell (body cells
|
|
69
|
+
* hold one line), and the slack of a wide container goes to ONE place, so a value sits beside its name:
|
|
70
|
+
* the LAST data column when it is a `text`, `entity` or kindless one (the row's tail reads on after the
|
|
71
|
+
* columns before it); else the LAST `text` column (a notes/detail column that may wrap, ahead of figures);
|
|
72
|
+
* (one whose cells are not all short); else a trailing spacer after the last data column — never an `entity` with columns after it, which
|
|
73
|
+
* would put a short name hundreds of pixels from its next value.
|
|
74
|
+
* `fixedIds` (the checkbox and actions columns) fit too but are not data. An earlier `text` column
|
|
75
|
+
* keeps its auto share (it may wrap) unless every cell it holds is short ({@link SHORT_TEXT} characters:
|
|
76
|
+
* nothing to wrap, so it takes no slack either; `rows` says what it holds), and a table where no column
|
|
77
|
+
* opted into a kind renders as before: no fit marks, no spacer.
|
|
78
|
+
*/
|
|
79
|
+
export function planColumnSizing<T extends RowData>(
|
|
80
|
+
columns: readonly Column<BasaltTableFeatures, T, unknown>[],
|
|
81
|
+
fixedIds: ReadonlySet<string>,
|
|
82
|
+
rows: readonly Row<BasaltTableFeatures, T>[],
|
|
83
|
+
): { fitIds: ReadonlySet<string>; spacer: boolean } {
|
|
84
|
+
const data = columns.filter((column) => !fixedIds.has(column.id))
|
|
85
|
+
const kinds = new Map(data.map((column) => [column.id, resolveKind(column)]))
|
|
86
|
+
const fitIds = new Set(columns.filter((column) => fixedIds.has(column.id)).map((c) => c.id))
|
|
87
|
+
const hasKinds = data.some((column) => kinds.get(column.id) !== undefined)
|
|
88
|
+
if (!hasKinds) return { fitIds, spacer: false }
|
|
89
|
+
const tail = data.at(-1)
|
|
90
|
+
const tailKind = tail === undefined ? undefined : kinds.get(tail.id)
|
|
91
|
+
const slackId =
|
|
92
|
+
tail !== undefined && (tailKind === undefined || tailKind === 'text' || tailKind === 'entity')
|
|
93
|
+
? tail.id
|
|
94
|
+
: data.findLast((column) => kinds.get(column.id) === 'text' && !isShortText(column.id, rows))
|
|
95
|
+
?.id
|
|
96
|
+
for (const column of data) {
|
|
97
|
+
if (column.id === slackId) continue
|
|
98
|
+
if (kinds.get(column.id) === 'text' && !isShortText(column.id, rows)) continue
|
|
99
|
+
fitIds.add(column.id)
|
|
100
|
+
}
|
|
101
|
+
return { fitIds, spacer: slackId === undefined }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* A bar's width by kind. A share (`100%`) of a content-sized cell is that cell's own width, so the
|
|
106
|
+
* fit columns take it; the slack column (a text, else the last entity) has no width of its own and takes a fixed length.
|
|
107
|
+
*/
|
|
108
|
+
const SKELETON_WIDTH: Record<DataTableColumnKind | 'kindless', string> = {
|
|
109
|
+
number: '3rem',
|
|
110
|
+
money: '3rem',
|
|
111
|
+
status: '4.5rem',
|
|
112
|
+
'relative-time': '4.5rem',
|
|
113
|
+
meter: '4rem',
|
|
114
|
+
entity: 'min(100%, 10rem)',
|
|
115
|
+
text: 'min(100%, 10rem)',
|
|
116
|
+
kindless: '100%',
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A loading bar shaped like the kind's value: a figure short and flush right, a chip chip-sized. */
|
|
120
|
+
export function KindSkeleton({
|
|
121
|
+
kind,
|
|
122
|
+
right,
|
|
123
|
+
}: {
|
|
124
|
+
kind: DataTableColumnKind | undefined
|
|
125
|
+
right: boolean
|
|
126
|
+
}): ReactNode {
|
|
127
|
+
const chip = kind === 'status'
|
|
128
|
+
const width = SKELETON_WIDTH[kind ?? 'kindless']
|
|
129
|
+
return (
|
|
130
|
+
<Skeleton
|
|
131
|
+
height={chip ? 20 : 16}
|
|
132
|
+
radius="sm"
|
|
133
|
+
w={width}
|
|
134
|
+
maw="100%"
|
|
135
|
+
{...(right && { ml: 'auto' })}
|
|
136
|
+
/>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const KIND_CLASS: Record<DataTableColumnKind, string> = {
|
|
141
|
+
entity: classes.entity,
|
|
142
|
+
status: classes.status,
|
|
143
|
+
number: classes.number,
|
|
144
|
+
money: classes.number,
|
|
145
|
+
'relative-time': classes.relativeTime,
|
|
146
|
+
meter: classes.meter,
|
|
147
|
+
text: classes.text,
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function kindClass(kind: DataTableColumnKind): string {
|
|
151
|
+
return cx(KIND_CLASS[kind])
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** A whole number groups; a fraction is kept whole (`integer` would round 12.5 to 13). */
|
|
155
|
+
function formatFigure(value: number): string {
|
|
156
|
+
return Number.isInteger(value)
|
|
157
|
+
? integer(value)
|
|
158
|
+
: numberFormat(undefined, { signDisplay: 'negative', maximumFractionDigits: 20 }).format(value)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* A `money` figure: grouped, with the currency's own minor digits (`120,000.00` USD, `120,000` JPY)
|
|
163
|
+
* and no symbol — the header names the code (`Salary (USD / yr)`, SPEC § 6.6).
|
|
164
|
+
*/
|
|
165
|
+
function formatMoney(value: number, currency: string): string {
|
|
166
|
+
const digits = numberFormat(undefined, { style: 'currency', currency }).resolvedOptions()
|
|
167
|
+
.maximumFractionDigits
|
|
168
|
+
return numberFormat(undefined, {
|
|
169
|
+
signDisplay: 'negative',
|
|
170
|
+
minimumFractionDigits: digits,
|
|
171
|
+
maximumFractionDigits: digits,
|
|
172
|
+
}).format(value)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** The theme draws no dot for plain `gray`, but every chip in a status column carries one. */
|
|
176
|
+
const chipColor = (color: string | undefined): string =>
|
|
177
|
+
color === undefined || color === 'gray' ? 'var(--vx-faint)' : color
|
|
178
|
+
|
|
179
|
+
const Dash = () => <span className={classes.dash}>—</span>
|
|
180
|
+
|
|
181
|
+
function isAbsent(value: unknown): boolean {
|
|
182
|
+
return value === null || value === undefined || value === ''
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function toDate(value: unknown): Date | undefined {
|
|
186
|
+
if (!(value instanceof Date) && typeof value !== 'number' && typeof value !== 'string') {
|
|
187
|
+
return undefined
|
|
188
|
+
}
|
|
189
|
+
const date = new Date(value)
|
|
190
|
+
return Number.isNaN(date.getTime()) ? undefined : date
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function columnLabel<T extends RowData>(column: Column<BasaltTableFeatures, T, unknown>): string {
|
|
194
|
+
const { header } = column.columnDef
|
|
195
|
+
return typeof header === 'string' ? header : column.id
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function RelativeTime({ value }: { value: unknown }) {
|
|
199
|
+
const date = toDate(value)
|
|
200
|
+
if (date === undefined) return <Dash />
|
|
201
|
+
const full = dateTime(date)
|
|
202
|
+
return (
|
|
203
|
+
// Beside the cell, on hover and keyboard focus: below it the tip covered the next row's time, above it
|
|
204
|
+
// the header's label on row one.
|
|
205
|
+
<Tooltip label={full} position="right" events={{ hover: true, focus: true, touch: false }}>
|
|
206
|
+
{/* oxlint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- the tooltip opens on focus */}
|
|
207
|
+
<time dateTime={date.toISOString()} tabIndex={0}>
|
|
208
|
+
{relativeTime(date)}
|
|
209
|
+
<span className={classes.srOnly}>{`, ${full}`}</span>
|
|
210
|
+
</time>
|
|
211
|
+
</Tooltip>
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** The cell of a column with a `kind`: the column's own `cell` if it has one, else the kind's content. */
|
|
216
|
+
export function KindCell<T extends RowData>({
|
|
217
|
+
kind,
|
|
218
|
+
cell,
|
|
219
|
+
}: {
|
|
220
|
+
kind: DataTableColumnKind
|
|
221
|
+
cell: Cell<BasaltTableFeatures, T, unknown>
|
|
222
|
+
}): ReactNode {
|
|
223
|
+
const { column } = cell
|
|
224
|
+
const { cell: render, meta } = column.columnDef
|
|
225
|
+
if (render !== DEFAULT_CELL) return <FlexRender cell={cell} />
|
|
226
|
+
const value = cell.getValue()
|
|
227
|
+
switch (kind) {
|
|
228
|
+
case 'number':
|
|
229
|
+
case 'money': {
|
|
230
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) return <Dash />
|
|
231
|
+
return kind === 'money' ? formatMoney(value, meta?.currency ?? 'USD') : formatFigure(value)
|
|
232
|
+
}
|
|
233
|
+
case 'relative-time':
|
|
234
|
+
return <RelativeTime value={value} />
|
|
235
|
+
case 'status':
|
|
236
|
+
if (isAbsent(value)) return <Dash />
|
|
237
|
+
return <Badge color={chipColor(meta?.statusColor?.(value))}>{String(value)}</Badge>
|
|
238
|
+
case 'meter':
|
|
239
|
+
return (
|
|
240
|
+
<Meter
|
|
241
|
+
size="row"
|
|
242
|
+
label={columnLabel(column)}
|
|
243
|
+
value={typeof value === 'number' ? value : null}
|
|
244
|
+
max={meta?.meterMax ?? 1}
|
|
245
|
+
/>
|
|
246
|
+
)
|
|
247
|
+
case 'entity':
|
|
248
|
+
case 'text':
|
|
249
|
+
return isAbsent(value) ? <Dash /> : String(value)
|
|
250
|
+
default:
|
|
251
|
+
return kind satisfies never
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** A cell's content through its kind when it has one — the body cell and the fold disclosure share it. */
|
|
256
|
+
export function CellContent<T extends RowData>({
|
|
257
|
+
cell,
|
|
258
|
+
}: {
|
|
259
|
+
cell: Cell<BasaltTableFeatures, T, unknown>
|
|
260
|
+
}): ReactNode {
|
|
261
|
+
const kind = resolveKind(cell.column)
|
|
262
|
+
return kind === undefined ? <FlexRender cell={cell} /> : <KindCell kind={kind} cell={cell} />
|
|
263
|
+
}
|