basalt-ui 2.9.1 → 2.10.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 +46 -38
- package/MIGRATING.md +20 -12
- package/dist/charts/BandStrip.d.ts +6 -4
- package/dist/charts/BandStrip.d.ts.map +1 -1
- package/dist/charts/BandStrip.js +8 -8
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +4 -3
- package/dist/charts/MirroredBars.d.ts +16 -5
- package/dist/charts/MirroredBars.d.ts.map +1 -1
- package/dist/charts/MirroredBars.js +46 -9
- package/dist/charts/band-fold.d.ts +6 -0
- package/dist/charts/band-fold.d.ts.map +1 -1
- package/dist/charts/band-fold.js +11 -1
- package/dist/charts/legend.d.ts +2 -0
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +14 -10
- package/dist/charts/types.d.ts +7 -1
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/controls/enum-filter.d.ts +4 -1
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +2 -1
- package/dist/controls/number-filter.d.ts.map +1 -1
- package/dist/controls/number-filter.js +2 -0
- package/llms.txt +8 -7
- package/package.json +1 -1
- package/src/charts/BandStrip.tsx +17 -15
- package/src/charts/CartesianChart.tsx +3 -2
- package/src/charts/MirroredBars.tsx +71 -18
- package/src/charts/band-fold.ts +21 -0
- package/src/charts/legend.tsx +21 -12
- package/src/charts/types.ts +7 -1
- package/src/controls/enum-filter.tsx +5 -1
- package/src/controls/number-filter.tsx +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,59 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
# [2.10.0](https://github.com/jkrumm/basalt-ui/compare/v2.9.1...v2.10.0) (2026-10-15)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
* route files lint clean under the shipped preset ([a51c1ee](https://github.com/jkrumm/basalt-ui/commit/a51c1ee4e9f6c1b9d81902e74d87340be73caaaa))
|
|
8
|
-
* shell-less apps get no nav seed ([9944893](https://github.com/jkrumm/basalt-ui/commit/994489391b46ee944acb57032de99746aae35019))
|
|
6
|
+
* name the unset state of a preset number filter ([ed43eeb](https://github.com/jkrumm/basalt-ui/commit/ed43eeb0cde5a1ff1bc42ae118ab637d08007d64))
|
|
9
7
|
|
|
10
|
-
# [2.9.0](https://github.com/jkrumm/basalt-ui/compare/v2.8.1...v2.9.0) (2026-10-15)
|
|
11
8
|
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* band charts hide a pending legend and mirror their fills ([22a491e](https://github.com/jkrumm/basalt-ui/commit/22a491ef5cfdbcd9bfac1c5284c8566f453b50af))
|
|
12
|
+
|
|
13
|
+
## [2.9.1](https://github.com/jkrumm/basalt-ui/compare/v2.9.0...v2.9.1) (2026-10-15)
|
|
12
14
|
|
|
13
15
|
### Bug Fixes
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* guide a settings-row selection to a bound filter ([e1136b7](https://github.com/jkrumm/basalt-ui/commit/e1136b7d4ab362bf094209d0f8752d8a5f9106f4))
|
|
19
|
-
* home a settings-row control prop in the raw-selection-control scan ([d2b955c](https://github.com/jkrumm/basalt-ui/commit/d2b955ca7a38c9982705be285df6db91fac40dca))
|
|
20
|
-
* let sync run from a workspace app and name its bin ([5cf854f](https://github.com/jkrumm/basalt-ui/commit/5cf854f2a0613b3b1a8503d33b94ec95487a7a10))
|
|
21
|
-
* print unions in an llms.txt glossary instead of rewriting signatures ([6b8d917](https://github.com/jkrumm/basalt-ui/commit/6b8d91792781266581c11a4b7dddd39b9ca8e2ab))
|
|
22
|
-
* re-aim a cold hash load once the page bar is measured ([a218a89](https://github.com/jkrumm/basalt-ui/commit/a218a8948a316933b360e98a3b5b39caf0e48a4b))
|
|
23
|
-
* settle a toc click on a quiet scroller, not a fixed deadline ([e14cb8d](https://github.com/jkrumm/basalt-ui/commit/e14cb8d53726d9f18082b7bf28883e93344ee1ae))
|
|
24
|
-
* share one install-root predicate between sync and doctor ([9d85846](https://github.com/jkrumm/basalt-ui/commit/9d858467bd4d71f55b62d0404b0607cc201d3f9f))
|
|
25
|
-
* spell out unions, token maps and constants in llms.txt ([ec1a4e1](https://github.com/jkrumm/basalt-ui/commit/ec1a4e14e328a5caaa513485438e6fe23a2b8156))
|
|
17
|
+
- declare shell-less apps with basalt.shell, scope the route override ([0ea148d](https://github.com/jkrumm/basalt-ui/commit/0ea148d8949a37a65e91b5d0cf9ffaa04c6f98c7))
|
|
18
|
+
- route files lint clean under the shipped preset ([a51c1ee](https://github.com/jkrumm/basalt-ui/commit/a51c1ee4e9f6c1b9d81902e74d87340be73caaaa))
|
|
19
|
+
- shell-less apps get no nav seed ([9944893](https://github.com/jkrumm/basalt-ui/commit/994489391b46ee944acb57032de99746aae35019))
|
|
26
20
|
|
|
21
|
+
# [2.9.0](https://github.com/jkrumm/basalt-ui/compare/v2.8.1...v2.9.0) (2026-10-15)
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
- activate the last toc entry at the end of the scroll ([797f41d](https://github.com/jkrumm/basalt-ui/commit/797f41df602cd8835629f430ae26fc03a3c14909))
|
|
26
|
+
- address review of the 1.x compat removal ([8c7918f](https://github.com/jkrumm/basalt-ui/commit/8c7918f08fa66ef1712111ab2ef15a47ea41014e))
|
|
27
|
+
- clear a shell-less page bar from section anchors ([9df0585](https://github.com/jkrumm/basalt-ui/commit/9df0585ccd493fc65372fdc8d4a933db32ea5666)), closes [#anchor](https://github.com/jkrumm/basalt-ui/issues/anchor)
|
|
28
|
+
- guide a settings-row selection to a bound filter ([e1136b7](https://github.com/jkrumm/basalt-ui/commit/e1136b7d4ab362bf094209d0f8752d8a5f9106f4))
|
|
29
|
+
- home a settings-row control prop in the raw-selection-control scan ([d2b955c](https://github.com/jkrumm/basalt-ui/commit/d2b955ca7a38c9982705be285df6db91fac40dca))
|
|
30
|
+
- let sync run from a workspace app and name its bin ([5cf854f](https://github.com/jkrumm/basalt-ui/commit/5cf854f2a0613b3b1a8503d33b94ec95487a7a10))
|
|
31
|
+
- print unions in an llms.txt glossary instead of rewriting signatures ([6b8d917](https://github.com/jkrumm/basalt-ui/commit/6b8d91792781266581c11a4b7dddd39b9ca8e2ab))
|
|
32
|
+
- re-aim a cold hash load once the page bar is measured ([a218a89](https://github.com/jkrumm/basalt-ui/commit/a218a8948a316933b360e98a3b5b39caf0e48a4b))
|
|
33
|
+
- settle a toc click on a quiet scroller, not a fixed deadline ([e14cb8d](https://github.com/jkrumm/basalt-ui/commit/e14cb8d53726d9f18082b7bf28883e93344ee1ae))
|
|
34
|
+
- share one install-root predicate between sync and doctor ([9d85846](https://github.com/jkrumm/basalt-ui/commit/9d858467bd4d71f55b62d0404b0607cc201d3f9f))
|
|
35
|
+
- spell out unions, token maps and constants in llms.txt ([ec1a4e1](https://github.com/jkrumm/basalt-ui/commit/ec1a4e14e328a5caaa513485438e6fe23a2b8156))
|
|
27
36
|
|
|
28
37
|
### Features
|
|
29
38
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
- export foldBands for testing a band merge ([8343f19](https://github.com/jkrumm/basalt-ui/commit/8343f1985fffef07447ce202f512b17ebbf3ce7c))
|
|
40
|
+
- name the unset state of a number filter ([02ed3ba](https://github.com/jkrumm/basalt-ui/commit/02ed3bacc5094fca61401795a6440513754150aa))
|
|
41
|
+
- remove the 1.x compatibility layer from 2.x ([66f4517](https://github.com/jkrumm/basalt-ui/commit/66f4517df998f5a304a90d2cd9824654772de31d))
|
|
33
42
|
|
|
34
43
|
## [2.8.1](https://github.com/jkrumm/basalt-ui/compare/v2.8.0...v2.8.1) (2026-10-15)
|
|
35
44
|
|
|
36
|
-
|
|
37
45
|
### Bug Fixes
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
- anchor code-routed detection to real imports and calls ([115f8b4](https://github.com/jkrumm/basalt-ui/commit/115f8b40b2013b5dc613c83c6ec112b4e8b7e111))
|
|
48
|
+
- bound the mermaid import matcher and widen sanitizer tests ([4f6f39a](https://github.com/jkrumm/basalt-ui/commit/4f6f39a4469527277b5f0d3ec476d5f7c597858f))
|
|
49
|
+
- classify code-routed apps by wiring, keep seeds self-healing ([e07d38b](https://github.com/jkrumm/basalt-ui/commit/e07d38b13436485d13f07ceb4e5f6029e77aa5b9))
|
|
50
|
+
- keep dev-only chunks out of production builds ([fab9b09](https://github.com/jkrumm/basalt-ui/commit/fab9b0927aadbc0bbf93d88466ed15dd2dbadba4))
|
|
51
|
+
- keep the code block copy button clear of the first line ([c02498a](https://github.com/jkrumm/basalt-ui/commit/c02498aab9c1c38f5fb1f195a2aa02d10cabd09c))
|
|
52
|
+
- let sync and doctor accept a code-defined route tree ([9bb8571](https://github.com/jkrumm/basalt-ui/commit/9bb857153a2a441293dec3271fa3db45f11ed561))
|
|
53
|
+
- move router detection into a leaf module and require calls ([fb147a7](https://github.com/jkrumm/basalt-ui/commit/fb147a7ff571afe9a47c6f4f237cd2a937c98d9c))
|
|
54
|
+
- one code-routed predicate for init, sync and doctor ([9611d34](https://github.com/jkrumm/basalt-ui/commit/9611d34ecee1bcdf1c8e9c9260d52037403efd0c))
|
|
55
|
+
- paint the stored color scheme before the app boots ([14dd4ff](https://github.com/jkrumm/basalt-ui/commit/14dd4ff1dac2fbd8feaf8258594c60e349afd0b1))
|
|
56
|
+
- reset the fallback pre margin and pin the copy button reserve ([4955f4f](https://github.com/jkrumm/basalt-ui/commit/4955f4f1e30a88c7f64bb02c4b0259f4390c974d))
|
|
57
|
+
- run dropped-subpaths for tokens-only consumers in doctor ([2da07a7](https://github.com/jkrumm/basalt-ui/commit/2da07a7497e1c1c2bcdb72f8c9cd8ad6858118d9))
|
|
58
|
+
- scope the boot script, move the boot subsystem to vite-boot.ts ([b37a44e](https://github.com/jkrumm/basalt-ui/commit/b37a44e1dd9acdd6243ad1cdd592597cd40f4d12))
|
|
59
|
+
- scope the mermaid font sanitizer to style blocks ([e0dacfe](https://github.com/jkrumm/basalt-ui/commit/e0dacfefc3e6afa40794d27b58494c20e9f9c1f2))
|
|
60
|
+
- stop calling a code-defined route tree generated in doctor output ([838e3f3](https://github.com/jkrumm/basalt-ui/commit/838e3f3cee83ceaa3f5ad1b3b05fdd3ebf7d2e47))
|
|
61
|
+
- strip the remote font import from mermaid diagrams ([5e5fc8f](https://github.com/jkrumm/basalt-ui/commit/5e5fc8f3c346c58aadc5640ad87e429379a92bc7))
|
|
62
|
+
- tighten the boot subsystem types and share the plugin test fixtures ([d3f828a](https://github.com/jkrumm/basalt-ui/commit/d3f828a5598e9c0a98e9cff597ce5caf76ea2761))
|
|
63
|
+
- tighten the dev-chunk gate and the provider ceiling ([0b280b0](https://github.com/jkrumm/basalt-ui/commit/0b280b0bf15034d7edfebab567a5877afdea99fb))
|
|
64
|
+
- unquote the font-family var in mermaid diagrams ([9c2e485](https://github.com/jkrumm/basalt-ui/commit/9c2e485c415d6c3df4eefd4e3d5406e415c71d47))
|
|
57
65
|
|
|
58
66
|
# [2.8.0](https://github.com/jkrumm/basalt-ui/compare/v2.7.3...v2.8.0) (2026-10-15)
|
|
59
67
|
|
package/MIGRATING.md
CHANGED
|
@@ -66,18 +66,18 @@ There is one row per SURFACE, not per export, and a surface earns a row once any
|
|
|
66
66
|
shipped lefthook preset both changed in 1.30.0 with no row that owned them — which is how a
|
|
67
67
|
consumer read this index, found nothing, and diffed a KPI row that had silently gone 4-up → 2-up.
|
|
68
68
|
|
|
69
|
-
| Surface | 1.27.0 | 1.28.0 | 1.29.0 | 1.30.0 | 1.30.1 | 1.30.2 | 1.31.0 | 1.32.0 | 1.32.1 | 1.33.0 | 1.34.0 | 1.34.1 | 1.35.0 | 1.36.0 | 1.36.1 | 1.37.0 | 1.37.1 | 1.38.0 | 1.38.1 | 1.39.0 | 1.40.0 | 1.40.1 | 1.40.2 | 1.40.3 | 1.41.0 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | 2.0.4 | 2.0.5 | 2.1.0 | 2.2.0 | 2.3.0 | 2.4.0 | 2.5.0 | 2.6.0 | 2.6.1 | 2.7.0 | 2.7.1 | 2.7.2 | 2.7.3 | 2.8.0 | 2.8.1 | 2.9.0 | 2.9.1 | Unreleased |
|
|
70
|
-
| ----------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------- | ------ | ------ | -------------------------------------------------------------------------------------------- | ------ | ------ | ------ | ------ | ------ | ----------------------------------------------- | ------ | ------ | ------ | ------ | ------------------------------------------------------------ | ---------- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
71
|
-
| **tokens** (`./tokens`) | — | `--vx-divider` → `rgba()` on both schemes (§ Shell) | `--vx-space-touch-target` added (§ Additions) | eight spacing numbers (§ Chrome) | — | — | `--vx-hit` replaces the touch vars; `SIZE_CLASSES` (§ 1.31.0) | — | `SIZE_CLASSES`/`CONTAINER_CLASSES` actually exported (§ Fixes) | `CONTAINER_GRID_BREAKPOINTS`; `raw-breakpoint` trusts it (§ 1.33.0) | `CONTAINER_KEYS` (§ 1.34.0) | — | — | — | — | — | — | — | | `appShellInset` 20 → 16 (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | § 1.x compatibility layer removed | — | — |
|
|
72
|
-
| **charts** (`./charts`) | — | phone tier, `curve`, formatters, `state`, log axis (§ preamble) | `ChartState.empty: string`, `AxisBottomNumeric` (§ Additions) | responsive `height`, `legend.maxRows` (§ Charts) | `height` reaches the kinds; `maxRows` beats the `fill` fit (§ Charts) | — | container-class tier + `height` keys (§ 1.31.0) | — | `ResponsiveChartHeight` `sm` → key (§ Container recipes) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | `BandSpan.absentFraction` + `absentState` (§ 2.8.0) | — | — | — | — |
|
|
73
|
-
| **shell** (`.`) | — | scrollport, region seams, **the brand left the sidebar** (§§ scrollport, brand, Shell) | `PageTitle`, `BasaltDevDock`, `useBreakpoint` (§ Additions) | More popover, aside pill, the responsive gutter, `useBasaltSpacing` (§ Chrome) | — | — | `theme.breakpoints` derived, `useSizeClass`, `data-basalt-host`, `useBreakpoint` on notice (§ 1.31.0) | `useBreakpoint` removal → 1.33.0; `useSizeClass` is shell-only (§ 1.32.0) | shell-less `shell/` gutter, `AppShell` breakpoints, `useSizeClass` for overlays (§§ Shell-less, `useSizeClass`) | — | `useBreakpoint` removed (§ 1.34.0) | — | — | `useCoarsePointer()` (§ `useCoarsePointer()`) | — | — | — | — | | content gutter 16, block 8 from `sm` (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | `BasaltProvider` embedded mode, `spotlight` (§ 2.8.0) | — | — | — | — |
|
|
74
|
-
| **controls** (`./controls`) | `NumberFilter`, `field.number` (§ Controls) | sheet renders panel rows; `PanelRow`, `SliderControl` (§ `basalt-ui/controls`) | — | — | — | — | — | — | — | `NumberFilter clearable`; `createSearchStore` `resets` (§ State and controls) | — | — | — | `FormSection`/`FormRow`/`FormGroup`/`FormActions` move here (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
75
|
-
| **forms** (`./forms`) | — | `field` → `inputProps`, **`inputProps` drops `key`**, the layout tier (§ `inputProps`) | `field` DELETED — and the `--fix` recipe no longer works (§ Consolidation) | — | — | — | — | — | `FormGroup` row no longer stretches (§ Fixes) | — | — | — | — | the layout + `useForm`/`schemaResolver` deprecated, removed 1.37.0 (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | § 1.x compatibility layer removed | — | — |
|
|
76
|
-
| **data** (`./data/table`) | — | root is a `<div>`, row selection, `getItemKey` required (§ `basalt-ui/data`) | `./data` + `./query` + `./connectivity` dropped (§ Consolidation) | — | — | — | — | — | `renderCard` documented (§ `renderCard`) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
77
|
-
| **dashboard** (`.`) | `StatCard`: `unit`, `breakdown`, delta format (§ `StatCard`) | `StatGroup`, `WidgetGrid`, query-aware `StatCard` — additive | — | **the column law keys on the CONTAINER; `cols={4}` is 2-up at `sm`** (§ Dashboard) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | § 1.x compatibility layer removed | — | — |
|
|
78
|
-
| **toolchain** (`./configs/*`) | — | — | the shipped lefthook preset's `check-theme` BROKE — the CLI resolver stopped ascending (§ CLI) | the preset's default bin, and the `root:` recipe (§ Toolchain) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
79
|
-
| **CLI** (`basalt-ui`) | — | — | **resolver stops relocating; `doctor` loses 6 of 10 checks** (§ CLI) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | the managed block moves `CLAUDE.md` → `AGENTS.md` (§ 1.41.0) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | `doctor`: CSS + forced dropped subpaths, `oxlint-floor`, Start wiring (§ 2.8.0) | — | § 1.x compatibility layer removed | — | — |
|
|
80
|
-
| **guards** | five rules → `error` (§ Guards) | six new ids at `warn` (§ preamble) | `query-dual-import` retired in 1.29.1 (§ Guards) | four rules → `error` (§ Guards) | — | — | — | `raw-breakpoint`: the container-grid answer, `error` at 1.33.0 (§ 1.32.0) | `FormRow`/`FormGroup` homes in both lanes; `basalt-main` dropped (§ Fixes) | C1 + breakpoint pairs → `error`; `unknown-vx-token` `warn` (§ Guards) | — | — | — | `unknown-vx-token` → `error`; the token factories throw (§ Guards) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | § 1.x compatibility layer removed | — | — |
|
|
69
|
+
| Surface | 1.27.0 | 1.28.0 | 1.29.0 | 1.30.0 | 1.30.1 | 1.30.2 | 1.31.0 | 1.32.0 | 1.32.1 | 1.33.0 | 1.34.0 | 1.34.1 | 1.35.0 | 1.36.0 | 1.36.1 | 1.37.0 | 1.37.1 | 1.38.0 | 1.38.1 | 1.39.0 | 1.40.0 | 1.40.1 | 1.40.2 | 1.40.3 | 1.41.0 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | 2.0.4 | 2.0.5 | 2.1.0 | 2.2.0 | 2.3.0 | 2.4.0 | 2.5.0 | 2.6.0 | 2.6.1 | 2.7.0 | 2.7.1 | 2.7.2 | 2.7.3 | 2.8.0 | 2.8.1 | 2.9.0 | 2.9.1 | 2.10.0 | Unreleased |
|
|
70
|
+
| ----------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------- | ------ | ------ | -------------------------------------------------------------------------------------------- | ------ | ------ | ------ | ------ | ------ | ----------------------------------------------- | ------ | ------ | ------ | ------ | ------------------------------------------------------------ | ---------- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
71
|
+
| **tokens** (`./tokens`) | — | `--vx-divider` → `rgba()` on both schemes (§ Shell) | `--vx-space-touch-target` added (§ Additions) | eight spacing numbers (§ Chrome) | — | — | `--vx-hit` replaces the touch vars; `SIZE_CLASSES` (§ 1.31.0) | — | `SIZE_CLASSES`/`CONTAINER_CLASSES` actually exported (§ Fixes) | `CONTAINER_GRID_BREAKPOINTS`; `raw-breakpoint` trusts it (§ 1.33.0) | `CONTAINER_KEYS` (§ 1.34.0) | — | — | — | — | — | — | — | | `appShellInset` 20 → 16 (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | § 1.x compatibility layer removed | — | — | — |
|
|
72
|
+
| **charts** (`./charts`) | — | phone tier, `curve`, formatters, `state`, log axis (§ preamble) | `ChartState.empty: string`, `AxisBottomNumeric` (§ Additions) | responsive `height`, `legend.maxRows` (§ Charts) | `height` reaches the kinds; `maxRows` beats the `fill` fit (§ Charts) | — | container-class tier + `height` keys (§ 1.31.0) | — | `ResponsiveChartHeight` `sm` → key (§ Container recipes) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | `BandSpan.absentFraction` + `absentState` (§ 2.8.0) | — | — | — | — | — |
|
|
73
|
+
| **shell** (`.`) | — | scrollport, region seams, **the brand left the sidebar** (§§ scrollport, brand, Shell) | `PageTitle`, `BasaltDevDock`, `useBreakpoint` (§ Additions) | More popover, aside pill, the responsive gutter, `useBasaltSpacing` (§ Chrome) | — | — | `theme.breakpoints` derived, `useSizeClass`, `data-basalt-host`, `useBreakpoint` on notice (§ 1.31.0) | `useBreakpoint` removal → 1.33.0; `useSizeClass` is shell-only (§ 1.32.0) | shell-less `shell/` gutter, `AppShell` breakpoints, `useSizeClass` for overlays (§§ Shell-less, `useSizeClass`) | — | `useBreakpoint` removed (§ 1.34.0) | — | — | `useCoarsePointer()` (§ `useCoarsePointer()`) | — | — | — | — | | content gutter 16, block 8 from `sm` (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | `BasaltProvider` embedded mode, `spotlight` (§ 2.8.0) | — | — | — | — | — |
|
|
74
|
+
| **controls** (`./controls`) | `NumberFilter`, `field.number` (§ Controls) | sheet renders panel rows; `PanelRow`, `SliderControl` (§ `basalt-ui/controls`) | — | — | — | — | — | — | — | `NumberFilter clearable`; `createSearchStore` `resets` (§ State and controls) | — | — | — | `FormSection`/`FormRow`/`FormGroup`/`FormActions` move here (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
75
|
+
| **forms** (`./forms`) | — | `field` → `inputProps`, **`inputProps` drops `key`**, the layout tier (§ `inputProps`) | `field` DELETED — and the `--fix` recipe no longer works (§ Consolidation) | — | — | — | — | — | `FormGroup` row no longer stretches (§ Fixes) | — | — | — | — | the layout + `useForm`/`schemaResolver` deprecated, removed 1.37.0 (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | § 1.x compatibility layer removed | — | — | — |
|
|
76
|
+
| **data** (`./data/table`) | — | root is a `<div>`, row selection, `getItemKey` required (§ `basalt-ui/data`) | `./data` + `./query` + `./connectivity` dropped (§ Consolidation) | — | — | — | — | — | `renderCard` documented (§ `renderCard`) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
77
|
+
| **dashboard** (`.`) | `StatCard`: `unit`, `breakdown`, delta format (§ `StatCard`) | `StatGroup`, `WidgetGrid`, query-aware `StatCard` — additive | — | **the column law keys on the CONTAINER; `cols={4}` is 2-up at `sm`** (§ Dashboard) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | § 1.x compatibility layer removed | — | — | — |
|
|
78
|
+
| **toolchain** (`./configs/*`) | — | — | the shipped lefthook preset's `check-theme` BROKE — the CLI resolver stopped ascending (§ CLI) | the preset's default bin, and the `root:` recipe (§ Toolchain) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
79
|
+
| **CLI** (`basalt-ui`) | — | — | **resolver stops relocating; `doctor` loses 6 of 10 checks** (§ CLI) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | the managed block moves `CLAUDE.md` → `AGENTS.md` (§ 1.41.0) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | `doctor`: CSS + forced dropped subpaths, `oxlint-floor`, Start wiring (§ 2.8.0) | — | § 1.x compatibility layer removed | — | — | — |
|
|
80
|
+
| **guards** | five rules → `error` (§ Guards) | six new ids at `warn` (§ preamble) | `query-dual-import` retired in 1.29.1 (§ Guards) | four rules → `error` (§ Guards) | — | — | — | `raw-breakpoint`: the container-grid answer, `error` at 1.33.0 (§ 1.32.0) | `FormRow`/`FormGroup` homes in both lanes; `basalt-main` dropped (§ Fixes) | C1 + breakpoint pairs → `error`; `unknown-vx-token` `warn` (§ Guards) | — | — | — | `unknown-vx-token` → `error`; the token factories throw (§ Guards) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | § 1.x compatibility layer removed | — | — | — |
|
|
81
81
|
|
|
82
82
|
---
|
|
83
83
|
|
|
@@ -1046,6 +1046,14 @@ The `basalt-ui/router-tanstack` subpath is **removed** in 2.x, not moved: an imp
|
|
|
1046
1046
|
_Nothing yet. Author the next section under this heading as `## Unreleased — <title>`; the
|
|
1047
1047
|
release renames it and opens a new one here._
|
|
1048
1048
|
|
|
1049
|
+
## 2.10.0 — preset filters honour `.labels()`
|
|
1050
|
+
|
|
1051
|
+
- `NumberFilter` with `options`: a value `.labels()` names (`{ 0: 'Any' }`) now reads as that name in the pill though it is not an option, as the stepper form already did; no `Any` row needed. **Opt-out: none — drop the literal row if you added one.**
|
|
1052
|
+
- **A `state` chart hides its legend (every kind).** `pending`, `error` and `empty` conceal the legend (`visibility: hidden`, plus `aria-hidden`) instead of listing series over a plot with no marks; its row is kept, so the chart does not shift when the data arrives (layout-probed: `Lines`, `BandStrip`, `MirroredBars`; error and empty on `BandStrip`). **Opt-out: none.**
|
|
1053
|
+
- **`MirroredBars` takes `absentState`** (a `series` key, as `BandStrip.absentState`): that entry's colour (and `fillOpacity`) fills the absent share and its legend entry labels it; hiding the entry in the legend widens the measured bars to the full cell. Unset, the share stays `--vx-neutral` with no legend entry. A key naming no entry throws in dev and falls back to unset in production.
|
|
1054
|
+
- **`BandStrip` legend swatches mirror a state's `fillOpacity`** (a state at 0.14 no longer draws a solid swatch over a pale plot).
|
|
1055
|
+
- **`height` is the frame in every kind** (documented, nothing changes): a `BandStrip` or `MirroredBars` frame is the plot plus the x axis, so a band of a given height is `height` less the axis (about 21 px at the default font and density: a 44 px band is `height: 65`). No `plotHeight` prop.
|
|
1056
|
+
|
|
1049
1057
|
## 2.9.1
|
|
1050
1058
|
|
|
1051
1059
|
_Nothing to migrate in this release._
|
|
@@ -42,8 +42,10 @@ export type BandFold<T> = {
|
|
|
42
42
|
*/
|
|
43
43
|
merge: (group: T[]) => T;
|
|
44
44
|
};
|
|
45
|
-
export type BandStripProps<T, X extends ChartX = ChartX> = Omit<CartesianChartProps<T, X>, 'marks' | 'series' | 'y' | 'y2' | 'zones' | 'xZones' | 'refLines'> & {
|
|
46
|
-
states: readonly BandStripSeries<T>
|
|
45
|
+
export type BandStripProps<T, X extends ChartX = ChartX, K extends string = string> = Omit<CartesianChartProps<T, X>, 'marks' | 'series' | 'y' | 'y2' | 'zones' | 'xZones' | 'refLines'> & {
|
|
46
|
+
states: readonly (BandStripSeries<T> & {
|
|
47
|
+
key: K;
|
|
48
|
+
})[];
|
|
47
49
|
/** Which state, fill and marker each datum has. Memoize it: a new function recompiles the chart. */
|
|
48
50
|
getBand: (d: T) => BandSpan;
|
|
49
51
|
fold?: BandFold<T> | undefined;
|
|
@@ -53,7 +55,7 @@ export type BandStripProps<T, X extends ChartX = ChartX> = Omit<CartesianChartPr
|
|
|
53
55
|
* tooltip adds this state's row. Absent stays a legended, flat state, never a
|
|
54
56
|
* hatch: it reads as "no data" by hue and by sitting at the band's right edge, not as zero.
|
|
55
57
|
*/
|
|
56
|
-
absentState?:
|
|
58
|
+
absentState?: K | undefined;
|
|
57
59
|
};
|
|
58
|
-
export declare function BandStrip<T, X extends ChartX = ChartX>(props: BandStripProps<T, X>): ReactElement;
|
|
60
|
+
export declare function BandStrip<T, X extends ChartX = ChartX, K extends string = string>(props: BandStripProps<T, X, K>): ReactElement;
|
|
59
61
|
//# sourceMappingURL=BandStrip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BandStrip.d.ts","sourceRoot":"","sources":["../../src/charts/BandStrip.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BandStrip.d.ts","sourceRoot":"","sources":["../../src/charts/BandStrip.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AASzC,OAAO,KAAK,EAEV,mBAAmB,EAEnB,WAAW,EACX,MAAM,EAGP,MAAM,SAAS,CAAA;AAEhB,gGAAgG;AAChG,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,IAAI,CACnC,WAAW,CAAC,CAAC,CAAC,EACd,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;IACpG,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAA;IAC3B,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IAC9B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,SAAS,CAAA;CAC5B,CAAA;AAoMD,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAC/E,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC7B,YAAY,CA+Id"}
|
package/dist/charts/BandStrip.js
CHANGED
|
@@ -7,7 +7,7 @@ import { oneOf, requiredProp } from "../common/errors.js";
|
|
|
7
7
|
import { NON_FINITE } from "../format/shared.js";
|
|
8
8
|
import { VX, alpha } from "../tokens/index.js";
|
|
9
9
|
import { CartesianRung } from "./CartesianChart.js";
|
|
10
|
-
import { groupsOf } from "./band-fold.js";
|
|
10
|
+
import { groupsOf, resolveNamedState } from "./band-fold.js";
|
|
11
11
|
import { emphasis } from "./marks.js";
|
|
12
12
|
import { rowX } from "./types.js";
|
|
13
13
|
const DEFAULT_MIN_BAND_PX = 3;
|
|
@@ -119,19 +119,19 @@ function BandStrip(props) {
|
|
|
119
119
|
...rest
|
|
120
120
|
} = props;
|
|
121
121
|
const { data, x } = rest;
|
|
122
|
-
const absentKey =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
);
|
|
122
|
+
const absentKey = resolveNamedState(
|
|
123
|
+
"BandStrip",
|
|
124
|
+
"BandStrip.absentState",
|
|
125
|
+
absentState,
|
|
126
|
+
states.map((s) => s.key)
|
|
127
|
+
);
|
|
129
128
|
const series = useMemo(
|
|
130
129
|
() => states.map((s) => ({
|
|
131
130
|
key: s.key,
|
|
132
131
|
label: s.label,
|
|
133
132
|
color: s.color,
|
|
134
133
|
mark: "bar",
|
|
134
|
+
...s.fillOpacity !== void 0 && { fillOpacity: s.fillOpacity },
|
|
135
135
|
...s.tooltip !== void 0 && { tooltip: s.tooltip },
|
|
136
136
|
...s.legend !== void 0 && { legend: s.legend },
|
|
137
137
|
...s.note !== void 0 && { note: s.note },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../src/charts/CartesianChart.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAiB,YAAY,EAAa,MAAM,OAAO,CAAA;AAGnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAKpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEvE,6DAA6D;AAC7D,MAAM,MAAM,WAAW,GAAG;IACxB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,yDAAyD;IACzD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,sDAAsD;IACtD,KAAK,CAAC,EAAE,SAAS,GAAG,YAAY,CAAA;CACjC,CAAA;AAgCD,kGAAkG;AAClG,MAAM,MAAM,YAAY,GAAG;IACzB,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAA;IACf,8CAA8C;IAC9C,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC3B,0CAA0C;IAC1C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,gCAAgC;IAChC,MAAM,EAAE,OAAO,CAAA;IACf,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,IAAI,CACnC,mBAAmB,CAAC,CAAC,EAAE,MAAM,CAAC,EAC9B,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,GAAG,OAAO,CACpE,GAAG;IACF,qCAAqC;IACrC,MAAM,EAA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AQ,GAAG,OAAO,GAAG,WAAW,GAAG,OAAO,CACpE,GAAG;IACF,qCAAqC;IACrC,MAAM,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;IACjC,6FAA6F;IAC7F,OAAO,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,mBAAmB,CAAA;IACnD,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,YAAY,CAwErE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAC/C,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,GAC7C,YAAY,CAwBd;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAChD,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC/B,YAAY,CAEd"}
|
|
@@ -48,6 +48,7 @@ function ChartShell(props) {
|
|
|
48
48
|
return next;
|
|
49
49
|
});
|
|
50
50
|
}, []);
|
|
51
|
+
const resolved = resolveChartState(state);
|
|
51
52
|
const legendNode = useMemo(
|
|
52
53
|
() => shown ? /* @__PURE__ */ jsx(
|
|
53
54
|
ChartLegend,
|
|
@@ -58,14 +59,14 @@ function ChartShell(props) {
|
|
|
58
59
|
groups: config?.groups === true,
|
|
59
60
|
toggle,
|
|
60
61
|
onToggle,
|
|
61
|
-
onHighlight: setHighlighted
|
|
62
|
+
onHighlight: setHighlighted,
|
|
63
|
+
concealed: resolved !== null
|
|
62
64
|
}
|
|
63
65
|
) : null,
|
|
64
|
-
[shown, series, hidden, config?.groups, toggle, onToggle]
|
|
66
|
+
[shown, series, hidden, config?.groups, toggle, onToggle, resolved]
|
|
65
67
|
);
|
|
66
68
|
const atTop = config?.placement === "top" || config?.placement === "header";
|
|
67
69
|
const asHeaderRow = config?.placement === "header" && inCard;
|
|
68
|
-
const resolved = resolveChartState(state);
|
|
69
70
|
return /* @__PURE__ */ jsxs(
|
|
70
71
|
"div",
|
|
71
72
|
{
|
|
@@ -15,18 +15,29 @@ export type MirroredBarPane = {
|
|
|
15
15
|
format: (v: number) => string;
|
|
16
16
|
};
|
|
17
17
|
/** A bar series. Any entry that is neither pane is legend-only (give it `getValue: () => null`). */
|
|
18
|
-
export type MirroredBarsSeries<T> = Pick<ChartSeries<T>, '
|
|
19
|
-
|
|
18
|
+
export type MirroredBarsSeries<T, K extends string = string> = Pick<ChartSeries<T>, 'label' | 'color' | 'getValue' | 'formatValue' | 'tooltip' | 'legend' | 'role' | 'note'> & {
|
|
19
|
+
key: K;
|
|
20
|
+
/** Read for the `absentState` entry only (its fill and swatch); the panes draw at full colour. */
|
|
21
|
+
fillOpacity?: number | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type MirroredBarsProps<T, X extends ChartX = ChartX, K extends string = string> = Pick<CartesianChartProps<T, X>, 'ariaLabel' | 'data' | 'x' | 'formatX' | 'legend' | 'height' | 'state' | 'cursorGroup' | 'tooltip' | 'className' | 'style'> & {
|
|
20
24
|
/** The single source of colours, legend entries and tooltip rows. */
|
|
21
|
-
series: readonly MirroredBarsSeries<T>[];
|
|
25
|
+
series: readonly MirroredBarsSeries<T, K>[];
|
|
22
26
|
/** Drawn above the baseline. */
|
|
23
27
|
up: MirroredBarPane;
|
|
24
28
|
/** Drawn below the baseline. */
|
|
25
29
|
down: MirroredBarPane;
|
|
26
30
|
/** The up pane's share of the height. Default 0.35: the pair is usually asymmetric. */
|
|
27
31
|
upFraction?: number | undefined;
|
|
28
|
-
/** 0..1 of a bar's width that no source sample covers, drawn
|
|
32
|
+
/** 0..1 of a bar's width that no source sample covers, drawn across both panes. */
|
|
29
33
|
getAbsentFraction?: ((d: T) => number) | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The `series` key that names the absent share: its colour fills it and its legend entry labels
|
|
36
|
+
* it (give it `getValue: () => null`, it is legend-only). `BandStrip.absentState`'s shape. Its
|
|
37
|
+
* colour must differ from every measured series', not only by alpha. Default: a flat
|
|
38
|
+
* `--vx-neutral` with no legend entry. A key naming no entry throws.
|
|
39
|
+
*/
|
|
40
|
+
absentState?: K | undefined;
|
|
30
41
|
/** Per-datum bar opacity: a real but qualified measurement (a short bucket) drawn dimmer. */
|
|
31
42
|
getBarOpacity?: ((d: T) => number) | undefined;
|
|
32
43
|
/**
|
|
@@ -40,5 +51,5 @@ export type MirroredBarsProps<T, X extends ChartX = ChartX> = Pick<CartesianChar
|
|
|
40
51
|
/** Default `'leading'`: x is a slot's start. */
|
|
41
52
|
cursorResolution?: CartesianChartProps<T, X>['cursorResolution'] | undefined;
|
|
42
53
|
};
|
|
43
|
-
export declare function MirroredBars<T, X extends ChartX = ChartX>(props: MirroredBarsProps<T, X>): ReactElement;
|
|
54
|
+
export declare function MirroredBars<T, X extends ChartX = ChartX, K extends string = string>(props: MirroredBarsProps<T, X, K>): ReactElement;
|
|
44
55
|
//# sourceMappingURL=MirroredBars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MirroredBars.d.ts","sourceRoot":"","sources":["../../src/charts/MirroredBars.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAUzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,EAAW,MAAM,SAAS,CAAA;AAEhF,4BAA4B;AAC5B,MAAM,MAAM,eAAe,GAAG;IAC5B;8EAC0E;IAC1E,GAAG,EAAE,MAAM,CAAA;IACX,+FAA+F;IAC/F,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACjC,sGAAsG;IACtG,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,sDAAsD;IACtD,KAAK,CAAC,EAA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@@ -10,7 +10,7 @@ import { defaultFormatX, defaultNumberFormat, seriesRow, visibleSeries } from ".
|
|
|
10
10
|
import { barMark, emphasis } from "./marks.js";
|
|
11
11
|
import { PanelRung, chartHeightOf, paneX, paneY, rowsOf } from "./panel.js";
|
|
12
12
|
import { xScaleFor } from "./scales.js";
|
|
13
|
-
import { foldBands } from "./band-fold.js";
|
|
13
|
+
import { foldBands, resolveNamedState } from "./band-fold.js";
|
|
14
14
|
import { rowX } from "./types.js";
|
|
15
15
|
const DEFAULT_UP_FRACTION = 0.35;
|
|
16
16
|
const DEFAULT_PANE_TICKS = 3;
|
|
@@ -36,14 +36,37 @@ function assertPaneKey(side, key, series) {
|
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
function MirroredBars(props) {
|
|
39
|
-
const {
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const {
|
|
40
|
+
data,
|
|
41
|
+
x,
|
|
42
|
+
series,
|
|
43
|
+
up,
|
|
44
|
+
down,
|
|
45
|
+
upFraction = DEFAULT_UP_FRACTION,
|
|
46
|
+
getAbsentFraction,
|
|
47
|
+
getBarOpacity,
|
|
48
|
+
fold: foldConfig,
|
|
49
|
+
cursorResolution = "leading",
|
|
50
|
+
absentState,
|
|
51
|
+
...rung
|
|
52
|
+
} = props;
|
|
42
53
|
const { formatX } = rung;
|
|
54
|
+
const absentKey = resolveNamedState(
|
|
55
|
+
"MirroredBars",
|
|
56
|
+
"absentState",
|
|
57
|
+
absentState,
|
|
58
|
+
series.map((s) => s.key)
|
|
59
|
+
);
|
|
43
60
|
const bars = useMemo(
|
|
44
|
-
() => series.map((s) => ({
|
|
45
|
-
|
|
61
|
+
() => series.map((s) => ({
|
|
62
|
+
...s,
|
|
63
|
+
mark: "bar",
|
|
64
|
+
// A pane draws at full colour, so its swatch must not claim an opacity the plot lacks.
|
|
65
|
+
...s.key !== absentKey && { fillOpacity: void 0 }
|
|
66
|
+
})),
|
|
67
|
+
[series, absentKey]
|
|
46
68
|
);
|
|
69
|
+
const absentEntry = bars.find((s) => s.key === absentKey);
|
|
47
70
|
const plan = useCallback(
|
|
48
71
|
({ hidden, highlighted, width }) => {
|
|
49
72
|
const upSeries = assertPaneKey("up", up.key, bars);
|
|
@@ -55,6 +78,8 @@ function MirroredBars(props) {
|
|
|
55
78
|
) : data;
|
|
56
79
|
const model = xScaleFor(drawn.map(x), true);
|
|
57
80
|
const visible = visibleSeries(bars, hidden);
|
|
81
|
+
const absentOn = !absentEntry || visible.includes(absentEntry);
|
|
82
|
+
const absentFill = absentEntry ? alpha(absentEntry.color, absentEntry.fillOpacity ?? 1) : VX.neutral;
|
|
58
83
|
const upOn = visible.includes(upSeries);
|
|
59
84
|
const downOn = visible.includes(downSeries);
|
|
60
85
|
const format = (v) => formatX ? formatX(v) : defaultFormatX(v);
|
|
@@ -69,7 +94,7 @@ function MirroredBars(props) {
|
|
|
69
94
|
const rows = on ? rowsOf(drawn, x, s) : [];
|
|
70
95
|
const opacity = (d) => (getBarOpacity?.(d) ?? BAR_OPACITY) * emphasis(highlighted, s);
|
|
71
96
|
const left = (row) => (model.fraction(row.x) ?? 0) - bandWidth / 2;
|
|
72
|
-
const absent = (d) => clamp01(getAbsentFraction?.(d));
|
|
97
|
+
const absent = (d) => absentOn ? clamp01(getAbsentFraction?.(d)) : 0;
|
|
73
98
|
const measured = rows.filter(
|
|
74
99
|
(r) => r.y !== null && absent(r.datum) > 0 && absent(r.datum) < 1
|
|
75
100
|
);
|
|
@@ -125,7 +150,7 @@ function MirroredBars(props) {
|
|
|
125
150
|
y1: () => 0,
|
|
126
151
|
y2: () => max,
|
|
127
152
|
xScale: "zx",
|
|
128
|
-
fill:
|
|
153
|
+
fill: absentFill,
|
|
129
154
|
inset: 0
|
|
130
155
|
})
|
|
131
156
|
)
|
|
@@ -168,7 +193,19 @@ function MirroredBars(props) {
|
|
|
168
193
|
}
|
|
169
194
|
};
|
|
170
195
|
},
|
|
171
|
-
[
|
|
196
|
+
[
|
|
197
|
+
data,
|
|
198
|
+
x,
|
|
199
|
+
bars,
|
|
200
|
+
up,
|
|
201
|
+
down,
|
|
202
|
+
upFraction,
|
|
203
|
+
getAbsentFraction,
|
|
204
|
+
getBarOpacity,
|
|
205
|
+
foldConfig,
|
|
206
|
+
formatX,
|
|
207
|
+
absentEntry
|
|
208
|
+
]
|
|
172
209
|
);
|
|
173
210
|
return /* @__PURE__ */ jsx(
|
|
174
211
|
PanelRung,
|
|
@@ -12,4 +12,10 @@ export declare function groupsOf<T>(data: readonly T[], cap: number): Group<T>[]
|
|
|
12
12
|
* `floor(width / minBandPx)`.
|
|
13
13
|
*/
|
|
14
14
|
export declare function foldBands<T>(data: readonly T[], cap: number, merge: (group: T[]) => T): T[];
|
|
15
|
+
/**
|
|
16
|
+
* Resolves a prop that names a `series` / `states` key (`absentState`): the key when it names an
|
|
17
|
+
* entry, `undefined` when it is unset. A key naming nothing throws in dev, naming the valid set;
|
|
18
|
+
* in production the chart degrades to the unset behaviour.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveNamedState<K extends string>(component: string, prop: string, requested: K | undefined, known: readonly string[]): K | undefined;
|
|
15
21
|
//# sourceMappingURL=band-fold.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"band-fold.d.ts","sourceRoot":"","sources":["../../src/charts/band-fold.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"band-fold.d.ts","sourceRoot":"","sources":["../../src/charts/band-fold.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,CAAA;AAEpD,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CASvE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAI3F;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,GAAG,SAAS,EACxB,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,CAAC,GAAG,SAAS,CAOf"}
|
package/dist/charts/band-fold.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { oneOf } from "../common/errors.js";
|
|
1
2
|
function groupsOf(data, cap) {
|
|
2
3
|
const size = Math.max(1, Math.ceil(data.length / Math.max(cap, 1)));
|
|
3
4
|
const out = [];
|
|
@@ -13,7 +14,16 @@ function foldBands(data, cap, merge) {
|
|
|
13
14
|
if (data.length <= cap) return [...data];
|
|
14
15
|
return groupsOf(data, cap).map((g) => merge(g.items));
|
|
15
16
|
}
|
|
17
|
+
function resolveNamedState(component, prop, requested, known) {
|
|
18
|
+
if (requested === void 0) return void 0;
|
|
19
|
+
if (known.includes(requested)) return requested;
|
|
20
|
+
if (process.env.NODE_ENV !== "production") {
|
|
21
|
+
throw new Error(oneOf(component, prop, [...known], requested));
|
|
22
|
+
}
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
16
25
|
export {
|
|
17
26
|
foldBands,
|
|
18
|
-
groupsOf
|
|
27
|
+
groupsOf,
|
|
28
|
+
resolveNamedState
|
|
19
29
|
};
|
package/dist/charts/legend.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export type ChartLegendProps<T> = {
|
|
|
31
31
|
toggle: boolean;
|
|
32
32
|
onToggle: (key: string) => void;
|
|
33
33
|
onHighlight: (key: string | null) => void;
|
|
34
|
+
/** Keeps the legend's box but shows and offers nothing: a chart with no marks names no series. */
|
|
35
|
+
concealed?: boolean;
|
|
34
36
|
};
|
|
35
37
|
export declare function ChartLegend<T>(props: ChartLegendProps<T>): ReactElement | null;
|
|
36
38
|
//# sourceMappingURL=legend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/charts/legend.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAA;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAUlD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,CAAC,EAC7B,MAAM,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EACjC,MAAM,EAAE,OAAO,GACd,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAMpB;
|
|
1
|
+
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/charts/legend.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAA;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAUlD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,CAAC,EAC7B,MAAM,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EACjC,MAAM,EAAE,OAAO,GACd,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAMpB;AAsDD;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAoErF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,MAAM,EAAE,SAAS,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;IAClC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACzC,kGAAkG;IAClG,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,IAAI,CA2D9E"}
|
package/dist/charts/legend.js
CHANGED
|
@@ -28,6 +28,18 @@ const autoRowStyle = {
|
|
|
28
28
|
"--bc-legend-gap": `${VX.legendGap}px`,
|
|
29
29
|
"--bc-dots-gap": `${DOTS_GAP}px`
|
|
30
30
|
};
|
|
31
|
+
function rowLayout(mode, concealed) {
|
|
32
|
+
const hide = concealed ? { visibility: "hidden" } : {};
|
|
33
|
+
if (mode === "auto") return { ...autoRowStyle, ...hide };
|
|
34
|
+
const gap = mode === "dots" ? DOTS_GAP : VX.legendGap;
|
|
35
|
+
return {
|
|
36
|
+
...rowStyle,
|
|
37
|
+
columnGap: gap,
|
|
38
|
+
// Caps each entry's `[data-basalt-hit]` overlay at the real gap between entries.
|
|
39
|
+
...{ "--vx-hit-gap": `${gap}px` },
|
|
40
|
+
...hide
|
|
41
|
+
};
|
|
42
|
+
}
|
|
31
43
|
const dividerStyle = { width: 1, alignSelf: "stretch", background: VX.divider };
|
|
32
44
|
const buttonStyle = {
|
|
33
45
|
all: "unset",
|
|
@@ -103,22 +115,14 @@ function ChartLegend(props) {
|
|
|
103
115
|
const groups = legendEntries(props.series, props.groups);
|
|
104
116
|
if (groups.length === 0) return null;
|
|
105
117
|
const auto = props.mode === "auto";
|
|
106
|
-
const gap = props.mode === "dots" ? DOTS_GAP : VX.legendGap;
|
|
107
118
|
return /* @__PURE__ */ jsx(
|
|
108
119
|
"fieldset",
|
|
109
120
|
{
|
|
110
121
|
"aria-label": "Legend",
|
|
111
122
|
"data-basalt-chart-legend": props.mode,
|
|
123
|
+
...props.concealed && { "aria-hidden": true },
|
|
112
124
|
...auto && { className: classes.auto },
|
|
113
|
-
style:
|
|
114
|
-
// `display` and the gaps are the stylesheet's: the container picks them by width.
|
|
115
|
-
autoRowStyle
|
|
116
|
-
) : {
|
|
117
|
-
...rowStyle,
|
|
118
|
-
columnGap: gap,
|
|
119
|
-
// Caps each entry's `[data-basalt-hit]` overlay at the real gap between entries.
|
|
120
|
-
...{ "--vx-hit-gap": `${gap}px` }
|
|
121
|
-
},
|
|
125
|
+
style: rowLayout(props.mode, props.concealed === true),
|
|
122
126
|
children: groups.map((group, gi) => [
|
|
123
127
|
gi > 0 && /* @__PURE__ */ jsx("span", { "aria-hidden": true, style: dividerStyle }, `divider-${gi}`),
|
|
124
128
|
...group.map((s) => {
|
package/dist/charts/types.d.ts
CHANGED
|
@@ -252,7 +252,13 @@ export type CartesianChartProps<T, X extends ChartX = ChartX> = BasaltProps & {
|
|
|
252
252
|
refLines?: readonly RefLine[] | undefined;
|
|
253
253
|
/** `false` hides the legend. */
|
|
254
254
|
legend?: ChartLegendConfig | false | undefined;
|
|
255
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* Default: the height law (measured width × class ratio, 160–420px, ≤ 45vh on touch). Always the
|
|
257
|
+
* FRAME, in every kind: the plot plus the axis the engine measures. A `BandStrip` band is the
|
|
258
|
+
* frame less the x axis (about 21 px at the default font and density, so `height: 65` for a
|
|
259
|
+
* 44 px band). There is no separate plot height: the box is CSS-owned before any measurement
|
|
260
|
+
* exists, and a plot height would add a guess to it.
|
|
261
|
+
*/
|
|
256
262
|
height?: number | ResponsiveChartHeight | undefined;
|
|
257
263
|
state?: ChartState | undefined;
|
|
258
264
|
/** Joins a named cursor group instead of the page-shared default. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/charts/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC;8CAC8C;AAC9C,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAE3C;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAA;IACb;oGACgG;IAChG,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAA;IACjC,kGAAkG;IAClG,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAA;IAC1C,+FAA+F;IAC/F,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;IACrC;4FACwF;IACxF,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;IACtC,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,sBAAsB;IACtB,WAA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G,SAAS,CAAA;IAC9B,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,SAAS,CAAA;IAC1C,gGAAgG;IAChG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;IACxC,KAAK,CAAC,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,CAAA;IACvC,MAAM,CAAC,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAA;IAC5C,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,CAAA;IACzC,gCAAgC;IAChC,MAAM,CAAC,EAAE,iBAAiB,GAAG,KAAK,GAAG,SAAS,CAAA;IAC9C;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAAA;IACnD,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAC9B,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC;qCACiC;IACjC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAA;IAC/C,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,GAAG,SAAS,CAAA;CACvD,CAAA;AAED;mBACmB;AACnB,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,CAAU,CAAA"}
|
|
@@ -29,6 +29,9 @@ export type EnumFilterProps<T extends string> = BasaltProps & {
|
|
|
29
29
|
* into, and `exactOptionalPropertyTypes` rejects a possibly-undefined member on a bare optional.
|
|
30
30
|
*/
|
|
31
31
|
readonly options?: readonly FilterOption[] | undefined;
|
|
32
|
+
/** Pill text for a value no rendered option matches, ahead of `label` — the name `.labels()` gave
|
|
33
|
+
* an unset state that is deliberately not a row (`NumberFilter`'s preset form). */
|
|
34
|
+
readonly unmatchedLabel?: string | undefined;
|
|
32
35
|
/**
|
|
33
36
|
* Mono pill label — forwarded to `FilterPill.numeric`. Set by `NumberFilter`, whose values ARE
|
|
34
37
|
* numbers (`1` / `2` / `7`), and by nothing else: the same law `[data-numeric]` applies to a
|
|
@@ -36,5 +39,5 @@ export type EnumFilterProps<T extends string> = BasaltProps & {
|
|
|
36
39
|
*/
|
|
37
40
|
readonly numeric?: boolean | undefined;
|
|
38
41
|
};
|
|
39
|
-
export declare function EnumFilter<T extends string>({ field, label, icon, clearable, numeric, options: optionsProp, className, style, }: EnumFilterProps<T>): ReactNode;
|
|
42
|
+
export declare function EnumFilter<T extends string>({ field, label, icon, clearable, numeric, options: optionsProp, unmatchedLabel, className, style, }: EnumFilterProps<T>): ReactNode;
|
|
40
43
|
//# sourceMappingURL=enum-filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum-filter.d.ts","sourceRoot":"","sources":["../../src/controls/enum-filter.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAMlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI;IAC3C,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAA;IACxC,GAAG,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,CAAA;IACtC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAA;IACxB;kFA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AC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,CAAA;IACtC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAA;IACxB;kFAC8E;IAC9E,KAAK,IAAI,IAAI,CAAA;CACd,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,WAAW,GAAG;IAC5D,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,gGAAgG;IAChG,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,CAAA;IACtD;wFACoF;IACpF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACvC,CAAA;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,EAC3C,KAAK,EACL,KAAK,EACL,IAAI,EACJ,SAAS,EACT,OAAO,EACP,OAAO,EAAE,WAAW,EACpB,cAAc,EACd,SAAS,EACT,KAAK,GACN,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CA2FhC"}
|
|
@@ -12,6 +12,7 @@ function EnumFilter({
|
|
|
12
12
|
clearable,
|
|
13
13
|
numeric,
|
|
14
14
|
options: optionsProp,
|
|
15
|
+
unmatchedLabel,
|
|
15
16
|
className,
|
|
16
17
|
style
|
|
17
18
|
}) {
|
|
@@ -83,7 +84,7 @@ function EnumFilter({
|
|
|
83
84
|
return /* @__PURE__ */ jsx(
|
|
84
85
|
FilterPill,
|
|
85
86
|
{
|
|
86
|
-
label: selected?.label ?? label,
|
|
87
|
+
label: selected?.label ?? unmatchedLabel ?? label,
|
|
87
88
|
active: !isDefault,
|
|
88
89
|
...numeric === true && { numeric: true },
|
|
89
90
|
...icon !== void 0 && { icon },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-filter.d.ts","sourceRoot":"","sources":["../../src/controls/number-filter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"number-filter.d.ts","sourceRoot":"","sources":["../../src/controls/number-filter.tsx"],"names":[],"mappings":"AAmEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAQlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD;6FAC6F;AAC7F,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG;IAClD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;IACxC;yFACqF;IACrF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB;kEAC8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAqChE"}
|
|
@@ -52,6 +52,7 @@ function NumberChoice({
|
|
|
52
52
|
}) {
|
|
53
53
|
const [value, setValue] = field.use();
|
|
54
54
|
const rows = options.map((option) => ({ value: String(option.value), label: option.label }));
|
|
55
|
+
const named = field.options.find((option) => option.value === String(value))?.label;
|
|
55
56
|
const choice = {
|
|
56
57
|
fallback: String(field.fallback),
|
|
57
58
|
options: rows,
|
|
@@ -73,6 +74,7 @@ function NumberChoice({
|
|
|
73
74
|
label,
|
|
74
75
|
numeric: true,
|
|
75
76
|
options: rows,
|
|
77
|
+
...named !== void 0 && { unmatchedLabel: named },
|
|
76
78
|
...clearable === true && { clearable: true },
|
|
77
79
|
...icon !== void 0 && { icon },
|
|
78
80
|
...className !== void 0 && { className },
|
package/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# basalt-ui v2.
|
|
1
|
+
# basalt-ui v2.10.0
|
|
2
2
|
# Opinionated framework for Mantine-based React apps — theme, app shell, TanStack Charts, toolchain presets
|
|
3
3
|
#
|
|
4
4
|
# Entry points: use the exact import specifier below; do not guess.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# A subpath's `Install:` line is its required peers; `OptionalPeers:` are import()-only, install on use.
|
|
14
14
|
|
|
15
15
|
Package: basalt-ui
|
|
16
|
-
Version: 2.
|
|
16
|
+
Version: 2.10.0
|
|
17
17
|
|
|
18
18
|
## basalt-ui
|
|
19
19
|
Import: import { ... } from 'basalt-ui'
|
|
@@ -231,7 +231,7 @@ Import: import { ... } from 'basalt-ui/charts'
|
|
|
231
231
|
Description: CartesianChart (the TanStack Charts rung), the Lines and Bars kinds, ChartCard and the shared chartCursor (Mantine-free; @tanstack/charts + d3-scale peers)
|
|
232
232
|
Layer: headless
|
|
233
233
|
Rule: basalt-charts
|
|
234
|
-
Signature: BandStrip(props: BandStripProps<T, X>): ReactElement<unknown, string | JSXElementConstructor<any>>
|
|
234
|
+
Signature: BandStrip(props: BandStripProps<T, X, K>): ReactElement<unknown, string | JSXElementConstructor<any>>
|
|
235
235
|
className?: string
|
|
236
236
|
style?: CSSProperties
|
|
237
237
|
ariaLabel: string
|
|
@@ -245,10 +245,10 @@ Signature: BandStrip(props: BandStripProps<T, X>): ReactElement<unknown, string
|
|
|
245
245
|
cursorGroup?: string
|
|
246
246
|
cursorResolution?: CursorResolution
|
|
247
247
|
tooltip?: false | ChartTooltipConfig<T, X>
|
|
248
|
-
states: readonly
|
|
248
|
+
states: readonly (Pick<ChartSeries<T>, "label" | "legend" | "toolti…
|
|
249
249
|
getBand: (d: T) => BandSpan
|
|
250
250
|
fold?: BandFold<T>
|
|
251
|
-
absentState?:
|
|
251
|
+
absentState?: K
|
|
252
252
|
Signature: Bars(props: BarsProps<T, X>): ReactElement<unknown, string | JSXElementConstructor<any>>
|
|
253
253
|
className?: string
|
|
254
254
|
style?: CSSProperties
|
|
@@ -382,7 +382,7 @@ Signature: Lines(props: LinesProps<T, X>): ReactElement<unknown, string | JSXEle
|
|
|
382
382
|
cursorResolution?: CursorResolution
|
|
383
383
|
tooltip?: false | ChartTooltipConfig<T, X>
|
|
384
384
|
thresholds?: [X] extends [string] ? never : readonly Threshold[]
|
|
385
|
-
Signature: MirroredBars(props: MirroredBarsProps<T, X>): ReactElement<unknown, string | JSXElementConstructor<any>>
|
|
385
|
+
Signature: MirroredBars(props: MirroredBarsProps<T, X, K>): ReactElement<unknown, string | JSXElementConstructor<any>>
|
|
386
386
|
className?: string
|
|
387
387
|
style?: CSSProperties
|
|
388
388
|
ariaLabel: string
|
|
@@ -394,11 +394,12 @@ Signature: MirroredBars(props: MirroredBarsProps<T, X>): ReactElement<unknown, s
|
|
|
394
394
|
state?: ChartState
|
|
395
395
|
cursorGroup?: string
|
|
396
396
|
tooltip?: false | ChartTooltipConfig<T, X>
|
|
397
|
-
series: readonly MirroredBarsSeries<T>[]
|
|
397
|
+
series: readonly MirroredBarsSeries<T, K>[]
|
|
398
398
|
up: MirroredBarPane
|
|
399
399
|
down: MirroredBarPane
|
|
400
400
|
upFraction?: number
|
|
401
401
|
getAbsentFraction?: ((d: T) => number)
|
|
402
|
+
absentState?: K
|
|
402
403
|
getBarOpacity?: ((d: T) => number)
|
|
403
404
|
fold?: { minBandPx?: number | undefined; merge: (group: T[]) => T;…
|
|
404
405
|
cursorResolution?: CursorResolution
|
package/package.json
CHANGED
package/src/charts/BandStrip.tsx
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* `BandStrip` — a 1-D state strip: one gap-free band per slot over the shared x axis, no y
|
|
3
3
|
* dimension (`docs/V2-SPEC.md` § 9.3). Each band is in one of the `states`, tinted by the state's
|
|
4
4
|
* color (or an intensity `fill` of the datum's own), optionally carrying an inset `marker`.
|
|
5
|
-
* Absence is a state like any other: a flat, unhatched fill whose color differs from every
|
|
6
|
-
* with `absentState` and a folded band can carry an
|
|
5
|
+
* Absence is a state like any other: a flat, unhatched fill whose color differs from every
|
|
6
|
+
* measured state's, not only by alpha. Name it with `absentState` and a folded band can carry an
|
|
7
|
+
* `absentFraction` share of it.
|
|
7
8
|
*
|
|
8
9
|
* The rung supplies the legend, cursor, crosshair and tooltip. The visible bands are decorative
|
|
9
10
|
* rects on the rung's `[0, 1]` zone scale (a band scale pads its slots, a strip must not), and an
|
|
@@ -19,7 +20,7 @@ import { oneOf, requiredProp } from '../common/errors'
|
|
|
19
20
|
import { NON_FINITE } from '../format/shared'
|
|
20
21
|
import { VX, alpha } from '../tokens'
|
|
21
22
|
import { CartesianRung } from './CartesianChart'
|
|
22
|
-
import { groupsOf } from './band-fold'
|
|
23
|
+
import { groupsOf, resolveNamedState } from './band-fold'
|
|
23
24
|
import type { Group } from './band-fold'
|
|
24
25
|
import { emphasis } from './marks'
|
|
25
26
|
import { rowX } from './types'
|
|
@@ -83,11 +84,11 @@ export type BandFold<T> = {
|
|
|
83
84
|
merge: (group: T[]) => T
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
export type BandStripProps<T, X extends ChartX = ChartX> = Omit<
|
|
87
|
+
export type BandStripProps<T, X extends ChartX = ChartX, K extends string = string> = Omit<
|
|
87
88
|
CartesianChartProps<T, X>,
|
|
88
89
|
'marks' | 'series' | 'y' | 'y2' | 'zones' | 'xZones' | 'refLines'
|
|
89
90
|
> & {
|
|
90
|
-
states: readonly BandStripSeries<T>[]
|
|
91
|
+
states: readonly (BandStripSeries<T> & { key: K })[]
|
|
91
92
|
/** Which state, fill and marker each datum has. Memoize it: a new function recompiles the chart. */
|
|
92
93
|
getBand: (d: T) => BandSpan
|
|
93
94
|
fold?: BandFold<T> | undefined
|
|
@@ -97,7 +98,7 @@ export type BandStripProps<T, X extends ChartX = ChartX> = Omit<
|
|
|
97
98
|
* tooltip adds this state's row. Absent stays a legended, flat state, never a
|
|
98
99
|
* hatch: it reads as "no data" by hue and by sitting at the band's right edge, not as zero.
|
|
99
100
|
*/
|
|
100
|
-
absentState?:
|
|
101
|
+
absentState?: K | undefined
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
const DEFAULT_MIN_BAND_PX = 3
|
|
@@ -294,7 +295,9 @@ function layoutBands<T>(input: LayoutInput<T>): {
|
|
|
294
295
|
return { base: [...ctx.base.values()], markers: [...ctx.markers.values()], hits }
|
|
295
296
|
}
|
|
296
297
|
|
|
297
|
-
export function BandStrip<T, X extends ChartX = ChartX
|
|
298
|
+
export function BandStrip<T, X extends ChartX = ChartX, K extends string = string>(
|
|
299
|
+
props: BandStripProps<T, X, K>,
|
|
300
|
+
): ReactElement {
|
|
298
301
|
const {
|
|
299
302
|
states,
|
|
300
303
|
getBand,
|
|
@@ -306,14 +309,12 @@ export function BandStrip<T, X extends ChartX = ChartX>(props: BandStripProps<T,
|
|
|
306
309
|
} = props
|
|
307
310
|
const { data, x } = rest
|
|
308
311
|
// Resolved once: a misconfigured absent state degrades to primary-only paint, hits and rows.
|
|
309
|
-
const absentKey =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
states.map((s) => s.key),
|
|
316
|
-
)
|
|
312
|
+
const absentKey = resolveNamedState(
|
|
313
|
+
'BandStrip',
|
|
314
|
+
'BandStrip.absentState',
|
|
315
|
+
absentState,
|
|
316
|
+
states.map((s) => s.key),
|
|
317
|
+
)
|
|
317
318
|
|
|
318
319
|
const series = useMemo<ChartSeries<T>[]>(
|
|
319
320
|
() =>
|
|
@@ -322,6 +323,7 @@ export function BandStrip<T, X extends ChartX = ChartX>(props: BandStripProps<T,
|
|
|
322
323
|
label: s.label,
|
|
323
324
|
color: s.color,
|
|
324
325
|
mark: 'bar' as const,
|
|
326
|
+
...(s.fillOpacity !== undefined && { fillOpacity: s.fillOpacity }),
|
|
325
327
|
...(s.tooltip !== undefined && { tooltip: s.tooltip }),
|
|
326
328
|
...(s.legend !== undefined && { legend: s.legend }),
|
|
327
329
|
...(s.note !== undefined && { note: s.note }),
|
|
@@ -116,6 +116,7 @@ export function ChartShell<T>(props: ChartShellProps<T>): ReactElement {
|
|
|
116
116
|
return next
|
|
117
117
|
})
|
|
118
118
|
}, [])
|
|
119
|
+
const resolved = resolveChartState(state)
|
|
119
120
|
const legendNode: ReactNode = useMemo(
|
|
120
121
|
() =>
|
|
121
122
|
shown ? (
|
|
@@ -127,16 +128,16 @@ export function ChartShell<T>(props: ChartShellProps<T>): ReactElement {
|
|
|
127
128
|
toggle={toggle}
|
|
128
129
|
onToggle={onToggle}
|
|
129
130
|
onHighlight={setHighlighted}
|
|
131
|
+
concealed={resolved !== null}
|
|
130
132
|
/>
|
|
131
133
|
) : null,
|
|
132
|
-
[shown, series, hidden, config?.groups, toggle, onToggle],
|
|
134
|
+
[shown, series, hidden, config?.groups, toggle, onToggle, resolved],
|
|
133
135
|
)
|
|
134
136
|
// `header` is the enclosing card's header row (`top` outside a card); either way the legend is
|
|
135
137
|
// the first thing in the chart's own markup.
|
|
136
138
|
const atTop = config?.placement === 'top' || config?.placement === 'header'
|
|
137
139
|
const asHeaderRow = config?.placement === 'header' && inCard
|
|
138
140
|
|
|
139
|
-
const resolved = resolveChartState(state)
|
|
140
141
|
return (
|
|
141
142
|
<div
|
|
142
143
|
ref={ref}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* configure — its zero IS the baseline.
|
|
10
10
|
*
|
|
11
11
|
* ABSENCE is a state a reader cannot decode from either axis, so it is drawn across the full height
|
|
12
|
-
* of both panes in one flat `--vx-neutral`
|
|
12
|
+
* of both panes in one flat fill (`--vx-neutral`, or the `absentState` entry's colour): a `getAbsentFraction` share of a bar's width that no
|
|
13
13
|
* source sample covers. A bar that measured zero draws nothing; an absent one draws neutral.
|
|
14
14
|
*/
|
|
15
15
|
import { decorative } from '@tanstack/charts/mark/decorative'
|
|
@@ -26,7 +26,7 @@ import { barMark, emphasis } from './marks'
|
|
|
26
26
|
import { PanelRung, chartHeightOf, paneX, paneY, rowsOf } from './panel'
|
|
27
27
|
import type { PaneBuilder, PanelInput, PanelPlan } from './panel'
|
|
28
28
|
import { xScaleFor } from './scales'
|
|
29
|
-
import { foldBands } from './band-fold'
|
|
29
|
+
import { foldBands, resolveNamedState } from './band-fold'
|
|
30
30
|
import { rowX } from './types'
|
|
31
31
|
import type { CartesianChartProps, ChartSeries, ChartX, PlotRow } from './types'
|
|
32
32
|
|
|
@@ -46,12 +46,16 @@ export type MirroredBarPane = {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/** A bar series. Any entry that is neither pane is legend-only (give it `getValue: () => null`). */
|
|
49
|
-
export type MirroredBarsSeries<T> = Pick<
|
|
49
|
+
export type MirroredBarsSeries<T, K extends string = string> = Pick<
|
|
50
50
|
ChartSeries<T>,
|
|
51
|
-
'
|
|
52
|
-
>
|
|
51
|
+
'label' | 'color' | 'getValue' | 'formatValue' | 'tooltip' | 'legend' | 'role' | 'note'
|
|
52
|
+
> & {
|
|
53
|
+
key: K
|
|
54
|
+
/** Read for the `absentState` entry only (its fill and swatch); the panes draw at full colour. */
|
|
55
|
+
fillOpacity?: number | undefined
|
|
56
|
+
}
|
|
53
57
|
|
|
54
|
-
export type MirroredBarsProps<T, X extends ChartX = ChartX> = Pick<
|
|
58
|
+
export type MirroredBarsProps<T, X extends ChartX = ChartX, K extends string = string> = Pick<
|
|
55
59
|
CartesianChartProps<T, X>,
|
|
56
60
|
| 'ariaLabel'
|
|
57
61
|
| 'data'
|
|
@@ -66,15 +70,22 @@ export type MirroredBarsProps<T, X extends ChartX = ChartX> = Pick<
|
|
|
66
70
|
| 'style'
|
|
67
71
|
> & {
|
|
68
72
|
/** The single source of colours, legend entries and tooltip rows. */
|
|
69
|
-
series: readonly MirroredBarsSeries<T>[]
|
|
73
|
+
series: readonly MirroredBarsSeries<T, K>[]
|
|
70
74
|
/** Drawn above the baseline. */
|
|
71
75
|
up: MirroredBarPane
|
|
72
76
|
/** Drawn below the baseline. */
|
|
73
77
|
down: MirroredBarPane
|
|
74
78
|
/** The up pane's share of the height. Default 0.35: the pair is usually asymmetric. */
|
|
75
79
|
upFraction?: number | undefined
|
|
76
|
-
/** 0..1 of a bar's width that no source sample covers, drawn
|
|
80
|
+
/** 0..1 of a bar's width that no source sample covers, drawn across both panes. */
|
|
77
81
|
getAbsentFraction?: ((d: T) => number) | undefined
|
|
82
|
+
/**
|
|
83
|
+
* The `series` key that names the absent share: its colour fills it and its legend entry labels
|
|
84
|
+
* it (give it `getValue: () => null`, it is legend-only). `BandStrip.absentState`'s shape. Its
|
|
85
|
+
* colour must differ from every measured series', not only by alpha. Default: a flat
|
|
86
|
+
* `--vx-neutral` with no legend entry. A key naming no entry throws.
|
|
87
|
+
*/
|
|
88
|
+
absentState?: K | undefined
|
|
78
89
|
/** Per-datum bar opacity: a real but qualified measurement (a short bucket) drawn dimmer. */
|
|
79
90
|
getBarOpacity?: ((d: T) => number) | undefined
|
|
80
91
|
/**
|
|
@@ -122,18 +133,42 @@ function assertPaneKey<T>(
|
|
|
122
133
|
)
|
|
123
134
|
}
|
|
124
135
|
|
|
125
|
-
export function MirroredBars<T, X extends ChartX = ChartX>(
|
|
126
|
-
props: MirroredBarsProps<T, X>,
|
|
136
|
+
export function MirroredBars<T, X extends ChartX = ChartX, K extends string = string>(
|
|
137
|
+
props: MirroredBarsProps<T, X, K>,
|
|
127
138
|
): ReactElement {
|
|
128
|
-
const {
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
const {
|
|
140
|
+
data,
|
|
141
|
+
x,
|
|
142
|
+
series,
|
|
143
|
+
up,
|
|
144
|
+
down,
|
|
145
|
+
upFraction = DEFAULT_UP_FRACTION,
|
|
146
|
+
getAbsentFraction,
|
|
147
|
+
getBarOpacity,
|
|
148
|
+
fold: foldConfig,
|
|
149
|
+
cursorResolution = 'leading',
|
|
150
|
+
absentState,
|
|
151
|
+
...rung
|
|
152
|
+
} = props
|
|
131
153
|
const { formatX } = rung
|
|
132
154
|
|
|
155
|
+
const absentKey = resolveNamedState(
|
|
156
|
+
'MirroredBars',
|
|
157
|
+
'absentState',
|
|
158
|
+
absentState,
|
|
159
|
+
series.map((s) => s.key),
|
|
160
|
+
)
|
|
133
161
|
const bars = useMemo<ChartSeries<T>[]>(
|
|
134
|
-
() =>
|
|
135
|
-
|
|
162
|
+
() =>
|
|
163
|
+
series.map((s) => ({
|
|
164
|
+
...s,
|
|
165
|
+
mark: 'bar' as const,
|
|
166
|
+
// A pane draws at full colour, so its swatch must not claim an opacity the plot lacks.
|
|
167
|
+
...(s.key !== absentKey && { fillOpacity: undefined }),
|
|
168
|
+
})),
|
|
169
|
+
[series, absentKey],
|
|
136
170
|
)
|
|
171
|
+
const absentEntry = bars.find((s) => s.key === absentKey)
|
|
137
172
|
|
|
138
173
|
const plan = useCallback(
|
|
139
174
|
({ hidden, highlighted, width }: PanelInput): PanelPlan<T> => {
|
|
@@ -148,6 +183,12 @@ export function MirroredBars<T, X extends ChartX = ChartX>(
|
|
|
148
183
|
: data
|
|
149
184
|
const model = xScaleFor<X>(drawn.map(x), true)
|
|
150
185
|
const visible = visibleSeries(bars, hidden)
|
|
186
|
+
// A legend-hidden absent entry gives its share back to the measured bar, as `BandStrip`
|
|
187
|
+
// does; with no entry the share is always drawn, flat neutral.
|
|
188
|
+
const absentOn = !absentEntry || visible.includes(absentEntry)
|
|
189
|
+
const absentFill = absentEntry
|
|
190
|
+
? alpha(absentEntry.color, absentEntry.fillOpacity ?? 1)
|
|
191
|
+
: VX.neutral
|
|
151
192
|
const upOn = visible.includes(upSeries)
|
|
152
193
|
const downOn = visible.includes(downSeries)
|
|
153
194
|
const format = (v: ChartValue): string => (formatX ? formatX(v as X) : defaultFormatX(v))
|
|
@@ -176,7 +217,7 @@ export function MirroredBars<T, X extends ChartX = ChartX>(
|
|
|
176
217
|
// A partly-absent bar is painted by rects on the plot-fraction scale, so its measured share
|
|
177
218
|
// is narrower than its band; the bar itself stays as the (transparent) focus target.
|
|
178
219
|
const left = (row: PlotRow<T, X>): number => (model.fraction(row.x) ?? 0) - bandWidth / 2
|
|
179
|
-
const absent = (d: T): number => clamp01(getAbsentFraction?.(d))
|
|
220
|
+
const absent = (d: T): number => (absentOn ? clamp01(getAbsentFraction?.(d)) : 0)
|
|
180
221
|
const measured = rows.filter(
|
|
181
222
|
(r) => r.y !== null && absent(r.datum) > 0 && absent(r.datum) < 1,
|
|
182
223
|
)
|
|
@@ -233,7 +274,7 @@ export function MirroredBars<T, X extends ChartX = ChartX>(
|
|
|
233
274
|
y1: () => 0,
|
|
234
275
|
y2: () => max,
|
|
235
276
|
xScale: 'zx',
|
|
236
|
-
fill:
|
|
277
|
+
fill: absentFill,
|
|
237
278
|
inset: 0,
|
|
238
279
|
}),
|
|
239
280
|
),
|
|
@@ -282,7 +323,19 @@ export function MirroredBars<T, X extends ChartX = ChartX>(
|
|
|
282
323
|
},
|
|
283
324
|
}
|
|
284
325
|
},
|
|
285
|
-
[
|
|
326
|
+
[
|
|
327
|
+
data,
|
|
328
|
+
x,
|
|
329
|
+
bars,
|
|
330
|
+
up,
|
|
331
|
+
down,
|
|
332
|
+
upFraction,
|
|
333
|
+
getAbsentFraction,
|
|
334
|
+
getBarOpacity,
|
|
335
|
+
foldConfig,
|
|
336
|
+
formatX,
|
|
337
|
+
absentEntry,
|
|
338
|
+
],
|
|
286
339
|
)
|
|
287
340
|
|
|
288
341
|
return (
|
package/src/charts/band-fold.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { oneOf } from '../common/errors'
|
|
2
|
+
|
|
1
3
|
/** A run of adjacent slots drawn as one band; `items` are the source data it stands for. */
|
|
2
4
|
export type Group<T> = { start: number; items: T[] }
|
|
3
5
|
|
|
@@ -24,3 +26,22 @@ export function foldBands<T>(data: readonly T[], cap: number, merge: (group: T[]
|
|
|
24
26
|
if (data.length <= cap) return [...data]
|
|
25
27
|
return groupsOf(data, cap).map((g) => merge(g.items))
|
|
26
28
|
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Resolves a prop that names a `series` / `states` key (`absentState`): the key when it names an
|
|
32
|
+
* entry, `undefined` when it is unset. A key naming nothing throws in dev, naming the valid set;
|
|
33
|
+
* in production the chart degrades to the unset behaviour.
|
|
34
|
+
*/
|
|
35
|
+
export function resolveNamedState<K extends string>(
|
|
36
|
+
component: string,
|
|
37
|
+
prop: string,
|
|
38
|
+
requested: K | undefined,
|
|
39
|
+
known: readonly string[],
|
|
40
|
+
): K | undefined {
|
|
41
|
+
if (requested === undefined) return undefined
|
|
42
|
+
if (known.includes(requested)) return requested
|
|
43
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
+
throw new Error(oneOf(component, prop, [...known], requested))
|
|
45
|
+
}
|
|
46
|
+
return undefined
|
|
47
|
+
}
|
package/src/charts/legend.tsx
CHANGED
|
@@ -58,6 +58,21 @@ const autoRowStyle: LegendVars = {
|
|
|
58
58
|
'--bc-legend-gap': `${VX.legendGap}px`,
|
|
59
59
|
'--bc-dots-gap': `${DOTS_GAP}px`,
|
|
60
60
|
}
|
|
61
|
+
/** The row's layout; a concealed legend keeps it (and so its height) but is not visible. */
|
|
62
|
+
function rowLayout(mode: LegendMode, concealed: boolean): CSSProperties {
|
|
63
|
+
// Hidden, not removed: the data arriving must not shift the chart below it.
|
|
64
|
+
const hide: CSSProperties = concealed ? { visibility: 'hidden' } : {}
|
|
65
|
+
// `display` and the gaps are the stylesheet's in `auto`: the container picks them by width.
|
|
66
|
+
if (mode === 'auto') return { ...autoRowStyle, ...hide }
|
|
67
|
+
const gap = mode === 'dots' ? DOTS_GAP : VX.legendGap
|
|
68
|
+
return {
|
|
69
|
+
...rowStyle,
|
|
70
|
+
columnGap: gap,
|
|
71
|
+
// Caps each entry's `[data-basalt-hit]` overlay at the real gap between entries.
|
|
72
|
+
...({ '--vx-hit-gap': `${gap}px` } as CSSProperties),
|
|
73
|
+
...hide,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
61
76
|
const dividerStyle: CSSProperties = { width: 1, alignSelf: 'stretch', background: VX.divider }
|
|
62
77
|
const buttonStyle: CSSProperties = {
|
|
63
78
|
all: 'unset',
|
|
@@ -155,29 +170,23 @@ export type ChartLegendProps<T> = {
|
|
|
155
170
|
toggle: boolean
|
|
156
171
|
onToggle: (key: string) => void
|
|
157
172
|
onHighlight: (key: string | null) => void
|
|
173
|
+
/** Keeps the legend's box but shows and offers nothing: a chart with no marks names no series. */
|
|
174
|
+
concealed?: boolean
|
|
158
175
|
}
|
|
159
176
|
|
|
160
177
|
export function ChartLegend<T>(props: ChartLegendProps<T>): ReactElement | null {
|
|
161
178
|
const groups = legendEntries(props.series, props.groups)
|
|
162
179
|
if (groups.length === 0) return null
|
|
163
180
|
const auto = props.mode === 'auto'
|
|
164
|
-
const gap = props.mode === 'dots' ? DOTS_GAP : VX.legendGap
|
|
165
181
|
return (
|
|
166
182
|
<fieldset
|
|
167
183
|
aria-label="Legend"
|
|
168
184
|
data-basalt-chart-legend={props.mode}
|
|
185
|
+
// `visibility: hidden` is the real guard (nothing is announced, focused or clickable);
|
|
186
|
+
// `aria-hidden` is belt-and-braces for a tree that ignores computed visibility.
|
|
187
|
+
{...(props.concealed && { 'aria-hidden': true })}
|
|
169
188
|
{...(auto && { className: classes.auto })}
|
|
170
|
-
style={
|
|
171
|
-
auto
|
|
172
|
-
? // `display` and the gaps are the stylesheet's: the container picks them by width.
|
|
173
|
-
autoRowStyle
|
|
174
|
-
: {
|
|
175
|
-
...rowStyle,
|
|
176
|
-
columnGap: gap,
|
|
177
|
-
// Caps each entry's `[data-basalt-hit]` overlay at the real gap between entries.
|
|
178
|
-
...({ '--vx-hit-gap': `${gap}px` } as CSSProperties),
|
|
179
|
-
}
|
|
180
|
-
}
|
|
189
|
+
style={rowLayout(props.mode, props.concealed === true)}
|
|
181
190
|
>
|
|
182
191
|
{groups.map((group, gi) => [
|
|
183
192
|
gi > 0 && <span key={`divider-${gi}`} aria-hidden style={dividerStyle} />,
|
package/src/charts/types.ts
CHANGED
|
@@ -275,7 +275,13 @@ export type CartesianChartProps<T, X extends ChartX = ChartX> = BasaltProps & {
|
|
|
275
275
|
refLines?: readonly RefLine[] | undefined
|
|
276
276
|
/** `false` hides the legend. */
|
|
277
277
|
legend?: ChartLegendConfig | false | undefined
|
|
278
|
-
/**
|
|
278
|
+
/**
|
|
279
|
+
* Default: the height law (measured width × class ratio, 160–420px, ≤ 45vh on touch). Always the
|
|
280
|
+
* FRAME, in every kind: the plot plus the axis the engine measures. A `BandStrip` band is the
|
|
281
|
+
* frame less the x axis (about 21 px at the default font and density, so `height: 65` for a
|
|
282
|
+
* 44 px band). There is no separate plot height: the box is CSS-owned before any measurement
|
|
283
|
+
* exists, and a plot height would add a guess to it.
|
|
284
|
+
*/
|
|
279
285
|
height?: number | ResponsiveChartHeight | undefined
|
|
280
286
|
state?: ChartState | undefined
|
|
281
287
|
/** Joins a named cursor group instead of the page-shared default. */
|
|
@@ -65,6 +65,9 @@ export type EnumFilterProps<T extends string> = BasaltProps & {
|
|
|
65
65
|
* into, and `exactOptionalPropertyTypes` rejects a possibly-undefined member on a bare optional.
|
|
66
66
|
*/
|
|
67
67
|
readonly options?: readonly FilterOption[] | undefined
|
|
68
|
+
/** Pill text for a value no rendered option matches, ahead of `label` — the name `.labels()` gave
|
|
69
|
+
* an unset state that is deliberately not a row (`NumberFilter`'s preset form). */
|
|
70
|
+
readonly unmatchedLabel?: string | undefined
|
|
68
71
|
/**
|
|
69
72
|
* Mono pill label — forwarded to `FilterPill.numeric`. Set by `NumberFilter`, whose values ARE
|
|
70
73
|
* numbers (`1` / `2` / `7`), and by nothing else: the same law `[data-numeric]` applies to a
|
|
@@ -80,6 +83,7 @@ export function EnumFilter<T extends string>({
|
|
|
80
83
|
clearable,
|
|
81
84
|
numeric,
|
|
82
85
|
options: optionsProp,
|
|
86
|
+
unmatchedLabel,
|
|
83
87
|
className,
|
|
84
88
|
style,
|
|
85
89
|
}: EnumFilterProps<T>): ReactNode {
|
|
@@ -163,7 +167,7 @@ export function EnumFilter<T extends string>({
|
|
|
163
167
|
|
|
164
168
|
return (
|
|
165
169
|
<FilterPill
|
|
166
|
-
label={selected?.label ?? label}
|
|
170
|
+
label={selected?.label ?? unmatchedLabel ?? label}
|
|
167
171
|
active={!isDefault}
|
|
168
172
|
{...(numeric === true && { numeric: true })}
|
|
169
173
|
{...(icon !== undefined && { icon })}
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
*
|
|
59
59
|
* @example
|
|
60
60
|
* // "No filter" is the fallback, not a row: `clearable` writes it back, and the pill reads the
|
|
61
|
-
* // filter's name while no preset is picked
|
|
61
|
+
* // filter's name while no preset is picked — or the name `.labels({ difficulty: { 0: 'Any' } })`
|
|
62
|
+
* // gave the fallback, in this form as in the stepper's.
|
|
62
63
|
* // difficulty: field.number({ fallback: 0, min: 0, max: 5, int: true })
|
|
63
64
|
* <NumberFilter field={library.field.difficulty} label="Difficulty" options={LEVELS} clearable />
|
|
64
65
|
*/
|
|
@@ -176,6 +177,9 @@ function NumberChoice({
|
|
|
176
177
|
}): ReactNode {
|
|
177
178
|
const [value, setValue] = field.use()
|
|
178
179
|
const rows = options.map((option) => ({ value: String(option.value), label: option.label }))
|
|
180
|
+
// The same `.labels()` naming the stepper pill reads: a value it names (`{ 0: 'Any' }`) prints
|
|
181
|
+
// that name though it is not a row, so "no filter" needs no literal `Any` option.
|
|
182
|
+
const named = field.options.find((option) => option.value === String(value))?.label
|
|
179
183
|
const choice: ChoiceHandle<string> = {
|
|
180
184
|
fallback: String(field.fallback),
|
|
181
185
|
options: rows,
|
|
@@ -201,6 +205,7 @@ function NumberChoice({
|
|
|
201
205
|
label={label}
|
|
202
206
|
numeric
|
|
203
207
|
options={rows}
|
|
208
|
+
{...(named !== undefined && { unmatchedLabel: named })}
|
|
204
209
|
{...(clearable === true && { clearable: true })}
|
|
205
210
|
{...(icon !== undefined && { icon })}
|
|
206
211
|
{...(className !== undefined && { className })}
|