basalt-ui 1.30.2 → 1.31.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/AGENTS.md +1 -1
- package/CHANGELOG.md +31 -0
- package/MIGRATING.md +172 -12
- package/agent/rules/basalt-controls.md +19 -19
- package/agent/rules/basalt-mantine.md +1 -1
- package/configs/oxlint-plugin.js +254 -4
- package/configs/oxlint-plugin.test.ts +145 -2
- package/configs/oxlint.json +2 -1
- package/dist/agent-chat/composer.d.ts.map +1 -1
- package/dist/agent-chat/composer.js +41 -43
- package/dist/agent-chat/thread-workspace.d.ts +2 -2
- package/dist/agent-chat/thread-workspace.d.ts.map +1 -1
- package/dist/agent-chat/thread-workspace.js +3 -4
- package/dist/agent-chat/use-keyboard-inset.d.ts +2 -0
- package/dist/agent-chat/use-keyboard-inset.d.ts.map +1 -0
- package/dist/agent-chat/use-keyboard-inset.js +34 -0
- package/dist/charts/cursor/touch-pin.d.ts +45 -0
- package/dist/charts/cursor/touch-pin.d.ts.map +1 -0
- package/dist/charts/cursor/touch-pin.js +79 -0
- package/dist/charts/hooks/use-discrete-cursor.d.ts +66 -0
- package/dist/charts/hooks/use-discrete-cursor.d.ts.map +1 -0
- package/dist/charts/hooks/use-discrete-cursor.js +198 -0
- package/dist/charts/hooks/use-hysteresis.d.ts +18 -0
- package/dist/charts/hooks/use-hysteresis.d.ts.map +1 -0
- package/dist/charts/hooks/use-hysteresis.js +12 -0
- package/dist/charts/hooks/useBandPlot.d.ts +7 -0
- package/dist/charts/hooks/useBandPlot.d.ts.map +1 -1
- package/dist/charts/hooks/useBandPlot.js +62 -18
- package/dist/charts/hooks/useChartCursor.d.ts +40 -11
- package/dist/charts/hooks/useChartCursor.d.ts.map +1 -1
- package/dist/charts/hooks/useChartCursor.js +102 -11
- package/dist/charts/index.d.ts +0 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/index.js +0 -10
- package/dist/charts/kinds/BandStrip.d.ts.map +1 -1
- package/dist/charts/kinds/BandStrip.js +54 -41
- package/dist/charts/kinds/Donut.d.ts +9 -3
- package/dist/charts/kinds/Donut.d.ts.map +1 -1
- package/dist/charts/kinds/Donut.js +110 -48
- package/dist/charts/kinds/DualPanel.d.ts.map +1 -1
- package/dist/charts/kinds/DualPanel.js +145 -131
- package/dist/charts/kinds/Heatmap.d.ts +7 -0
- package/dist/charts/kinds/Heatmap.d.ts.map +1 -1
- package/dist/charts/kinds/Heatmap.js +37 -16
- package/dist/charts/kinds/MirroredBars.d.ts.map +1 -1
- package/dist/charts/kinds/MirroredBars.js +83 -68
- package/dist/charts/kinds/donut-layout.d.ts +47 -0
- package/dist/charts/kinds/donut-layout.d.ts.map +1 -0
- package/dist/charts/kinds/donut-layout.js +52 -0
- package/dist/charts/layout/auto-margin.d.ts +7 -2
- package/dist/charts/layout/auto-margin.d.ts.map +1 -1
- package/dist/charts/layout/auto-margin.js +12 -3
- package/dist/charts/layout/end-labels.d.ts +64 -0
- package/dist/charts/layout/end-labels.d.ts.map +1 -0
- package/dist/charts/layout/end-labels.js +76 -0
- package/dist/charts/primitives/Axes.d.ts +32 -4
- package/dist/charts/primitives/Axes.d.ts.map +1 -1
- package/dist/charts/primitives/Axes.js +62 -16
- package/dist/charts/primitives/CartesianChart.d.ts +7 -6
- package/dist/charts/primitives/CartesianChart.d.ts.map +1 -1
- package/dist/charts/primitives/CartesianChart.js +271 -125
- package/dist/charts/primitives/ChartCard.d.ts +0 -14
- package/dist/charts/primitives/ChartCard.d.ts.map +1 -1
- package/dist/charts/primitives/ChartCard.js +74 -21
- package/dist/charts/primitives/ChartFrame.d.ts +28 -22
- package/dist/charts/primitives/ChartFrame.d.ts.map +1 -1
- package/dist/charts/primitives/ChartFrame.js +133 -34
- package/dist/charts/primitives/ChartLegend.d.ts +19 -15
- package/dist/charts/primitives/ChartLegend.d.ts.map +1 -1
- package/dist/charts/primitives/ChartLegend.js +212 -71
- package/dist/charts/primitives/ChartTooltip.d.ts.map +1 -1
- package/dist/charts/primitives/ChartTooltip.js +4 -3
- package/dist/charts/primitives/Crosshair.js +2 -2
- package/dist/charts/primitives/HoverOverlay.d.ts +6 -1
- package/dist/charts/primitives/HoverOverlay.d.ts.map +1 -1
- package/dist/charts/primitives/HoverOverlay.js +37 -26
- package/dist/charts/primitives/HoverOverlay.module.css +13 -0
- package/dist/charts/primitives/HoverOverlay.module.css.d.ts +8 -0
- package/dist/charts/primitives/chart-card-context.d.ts +29 -0
- package/dist/charts/primitives/chart-card-context.d.ts.map +1 -0
- package/dist/charts/primitives/chart-card-context.js +13 -0
- package/dist/charts/primitives/chart-frame-layout.d.ts +93 -113
- package/dist/charts/primitives/chart-frame-layout.d.ts.map +1 -1
- package/dist/charts/primitives/chart-frame-layout.js +76 -29
- package/dist/charts/primitives/chart-layout.d.ts +112 -0
- package/dist/charts/primitives/chart-layout.d.ts.map +1 -0
- package/dist/charts/primitives/chart-layout.js +175 -0
- package/dist/charts/primitives/chart-tier.d.ts +13 -11
- package/dist/charts/primitives/chart-tier.d.ts.map +1 -1
- package/dist/charts/primitives/chart-tier.js +42 -13
- package/dist/charts/series.d.ts +4 -1
- package/dist/charts/series.d.ts.map +1 -1
- package/dist/charts/utils/ticks.d.ts +27 -8
- package/dist/charts/utils/ticks.d.ts.map +1 -1
- package/dist/charts/utils/ticks.js +35 -11
- package/dist/common/errors.d.ts +11 -1
- package/dist/common/errors.d.ts.map +1 -1
- package/dist/common/errors.js +16 -2
- package/dist/common/hit-floor.d.ts +10 -0
- package/dist/common/hit-floor.d.ts.map +1 -0
- package/dist/common/hit-floor.js +6 -0
- package/dist/{shell → common}/isomorphic-layout-effect.d.ts +4 -3
- package/dist/common/isomorphic-layout-effect.d.ts.map +1 -0
- package/dist/common/use-measured-widths.d.ts +37 -0
- package/dist/common/use-measured-widths.d.ts.map +1 -0
- package/dist/common/use-measured-widths.js +51 -0
- package/dist/common/use-media-query.d.ts +6 -0
- package/dist/common/use-media-query.d.ts.map +1 -0
- package/dist/common/use-media-query.js +40 -0
- package/dist/common/validate.d.ts +9 -0
- package/dist/common/validate.d.ts.map +1 -1
- package/dist/common/validate.js +9 -4
- package/dist/content/article-layout.d.ts +4 -2
- package/dist/content/article-layout.d.ts.map +1 -1
- package/dist/content/article-layout.js +43 -3
- package/dist/content/article-layout.module.css +45 -4
- package/dist/content/article-layout.module.css.d.ts +3 -0
- package/dist/content/code-block.d.ts.map +1 -1
- package/dist/content/code-block.js +40 -2
- package/dist/content/code-block.module.css +32 -2
- package/dist/content/prose.module.css +13 -8
- package/dist/controls/actions.d.ts +29 -6
- package/dist/controls/actions.d.ts.map +1 -1
- package/dist/controls/actions.js +158 -27
- package/dist/controls/actions.module.css +14 -1
- package/dist/controls/actions.module.css.d.ts +1 -0
- package/dist/controls/controls.module.css +8 -31
- package/dist/controls/enum-filter.js +2 -2
- package/dist/controls/filter-context.d.ts +10 -0
- package/dist/controls/filter-context.d.ts.map +1 -1
- package/dist/controls/filter-context.js +2 -0
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +1 -0
- package/dist/controls/index.d.ts +1 -1
- package/dist/controls/index.d.ts.map +1 -1
- package/dist/controls/index.js +0 -2
- package/dist/controls/multi-select-filter.js +2 -2
- package/dist/controls/sync-button.module.css +1 -1
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +1 -0
- package/dist/dashboard/section.module.css +1 -26
- package/dist/dashboard/stat-card.d.ts +1 -1
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +4 -1
- package/dist/dashboard/stat-card.module.css +6 -9
- package/dist/dashboard/stat-group.module.css +16 -4
- package/dist/dashboard/widget-grid.d.ts.map +1 -1
- package/dist/dashboard/widget-header.d.ts +14 -4
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +23 -6
- package/dist/dashboard/widget-header.module.css +145 -133
- package/dist/dashboard/widget-header.module.css.d.ts +2 -0
- package/dist/data/data-table.d.ts +23 -0
- package/dist/data/data-table.d.ts.map +1 -1
- package/dist/data/data-table.js +339 -141
- package/dist/data/data-table.module.css +94 -0
- package/dist/data/data-table.module.css.d.ts +11 -0
- package/dist/data/virtual-list.d.ts.map +1 -1
- package/dist/data/virtual-list.js +10 -0
- package/dist/forms/form-layout.d.ts.map +1 -1
- package/dist/forms/form-layout.js +3 -3
- package/dist/forms/form-layout.module.css +30 -5
- package/dist/forms/form-layout.module.css.d.ts +1 -0
- package/dist/guard/index.d.ts +8 -2
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +67 -2
- package/dist/guard/types.d.ts +3 -3
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/provider/index.d.ts +20 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +22 -2
- package/dist/shell/app-brand.d.ts.map +1 -1
- package/dist/shell/app-brand.js +1 -0
- package/dist/shell/app-brand.module.css +2 -2
- package/dist/shell/app-header.module.css +18 -8
- package/dist/shell/app-main.module.css +54 -3
- package/dist/shell/app-main.module.css.d.ts +1 -0
- package/dist/shell/app-mobile-nav.module.css +16 -4
- package/dist/shell/app-sidebar.module.css +4 -6
- package/dist/shell/index.d.ts +12 -0
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +57 -16
- package/dist/shell/mobile-nav-model.d.ts +1 -1
- package/dist/shell/page-aside.d.ts +22 -3
- package/dist/shell/page-aside.d.ts.map +1 -1
- package/dist/shell/page-aside.js +27 -13
- package/dist/shell/page-bar.d.ts.map +1 -1
- package/dist/shell/page-bar.js +10 -5
- package/dist/shell/page-bar.module.css +10 -34
- package/dist/shell/use-breakpoint.d.ts +3 -4
- package/dist/shell/use-breakpoint.d.ts.map +1 -1
- package/dist/shell/use-breakpoint.js +3 -25
- package/dist/shell/use-size-class.d.ts +6 -0
- package/dist/shell/use-size-class.d.ts.map +1 -0
- package/dist/shell/use-size-class.js +19 -0
- package/dist/state/persisted-or-local.d.ts +4 -1
- package/dist/state/persisted-or-local.d.ts.map +1 -1
- package/dist/state/persisted-or-local.js +4 -3
- package/dist/state/persisted.d.ts +10 -0
- package/dist/state/persisted.d.ts.map +1 -1
- package/dist/state/persisted.js +44 -14
- package/dist/styles.css +41 -0
- package/dist/surfaces.d.ts +4 -4
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +11 -3
- package/dist/theme/controls.module.css +7 -0
- package/dist/theme/ctl-theme.d.ts +1 -0
- package/dist/theme/ctl-theme.d.ts.map +1 -1
- package/dist/theme/ctl-theme.js +12 -4
- package/dist/theme/floating.module.css +36 -0
- package/dist/theme/floating.module.css.d.ts +3 -0
- package/dist/theme/index.d.ts +2 -2
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +34 -5
- package/dist/theme/nav-link.module.css +7 -0
- package/dist/tokens/index.d.ts +7 -16
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +23 -28
- package/dist/tokens/palette.d.ts +5 -27
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +8 -30
- package/dist/tokens/size-classes.d.ts +40 -0
- package/dist/tokens/size-classes.d.ts.map +1 -0
- package/dist/tokens/size-classes.js +29 -0
- package/dist/tokens.css +8 -4
- package/llms.txt +3 -3
- package/package.json +17 -17
- package/src/agent-chat/composer.tsx +74 -47
- package/src/agent-chat/thread-workspace.tsx +8 -11
- package/src/agent-chat/use-keyboard-inset.ts +68 -0
- package/src/charts/cursor/touch-pin.ts +138 -0
- package/src/charts/hooks/use-discrete-cursor.ts +335 -0
- package/src/charts/hooks/use-hysteresis.ts +26 -0
- package/src/charts/hooks/useBandPlot.ts +90 -27
- package/src/charts/hooks/useChartCursor.ts +211 -26
- package/src/charts/index.ts +0 -8
- package/src/charts/kinds/BandStrip.tsx +11 -1
- package/src/charts/kinds/Donut.tsx +153 -62
- package/src/charts/kinds/DualPanel.tsx +19 -4
- package/src/charts/kinds/Heatmap.tsx +61 -22
- package/src/charts/kinds/MirroredBars.tsx +15 -3
- package/src/charts/kinds/donut-layout.ts +82 -0
- package/src/charts/layout/auto-margin.ts +24 -5
- package/src/charts/layout/end-labels.ts +135 -0
- package/src/charts/primitives/Axes.tsx +112 -21
- package/src/charts/primitives/CartesianChart.tsx +282 -68
- package/src/charts/primitives/ChartCard.tsx +141 -48
- package/src/charts/primitives/ChartFrame.tsx +243 -60
- package/src/charts/primitives/ChartLegend.tsx +257 -73
- package/src/charts/primitives/ChartTooltip.tsx +8 -3
- package/src/charts/primitives/Crosshair.tsx +2 -2
- package/src/charts/primitives/HoverOverlay.module.css +13 -0
- package/src/charts/primitives/HoverOverlay.module.css.d.ts +8 -0
- package/src/charts/primitives/HoverOverlay.tsx +15 -4
- package/src/charts/primitives/chart-card-context.ts +37 -0
- package/src/charts/primitives/chart-frame-layout.ts +214 -177
- package/src/charts/primitives/chart-layout.ts +318 -0
- package/src/charts/primitives/chart-tier.tsx +66 -21
- package/src/charts/series.ts +4 -1
- package/src/charts/utils/ticks.ts +95 -19
- package/src/common/errors.ts +25 -1
- package/src/common/hit-floor.ts +9 -0
- package/src/{shell → common}/isomorphic-layout-effect.ts +4 -3
- package/src/common/use-measured-widths.ts +88 -0
- package/src/common/use-media-query.ts +56 -0
- package/src/common/validate.ts +17 -4
- package/src/content/article-layout.module.css +45 -4
- package/src/content/article-layout.module.css.d.ts +3 -0
- package/src/content/article-layout.tsx +60 -5
- package/src/content/code-block.module.css +32 -2
- package/src/content/code-block.tsx +47 -3
- package/src/content/prose.module.css +13 -8
- package/src/controls/actions.module.css +14 -1
- package/src/controls/actions.module.css.d.ts +1 -0
- package/src/controls/actions.tsx +223 -75
- package/src/controls/controls.module.css +8 -31
- package/src/controls/enum-filter.tsx +2 -2
- package/src/controls/filter-context.tsx +11 -0
- package/src/controls/filter-pill.tsx +1 -0
- package/src/controls/index.ts +0 -1
- package/src/controls/multi-select-filter.tsx +2 -2
- package/src/controls/sync-button.module.css +1 -1
- package/src/dashboard/section.module.css +1 -26
- package/src/dashboard/section.tsx +1 -0
- package/src/dashboard/stat-card.module.css +6 -9
- package/src/dashboard/stat-card.tsx +6 -3
- package/src/dashboard/stat-group.module.css +16 -4
- package/src/dashboard/widget-grid.tsx +7 -6
- package/src/dashboard/widget-header.module.css +145 -133
- package/src/dashboard/widget-header.module.css.d.ts +2 -0
- package/src/dashboard/widget-header.tsx +45 -11
- package/src/data/data-table.module.css +94 -0
- package/src/data/data-table.module.css.d.ts +11 -0
- package/src/data/data-table.tsx +503 -164
- package/src/data/virtual-list.tsx +31 -0
- package/src/forms/form-layout.module.css +30 -5
- package/src/forms/form-layout.module.css.d.ts +1 -0
- package/src/forms/form-layout.tsx +12 -10
- package/src/guard/index.ts +183 -3
- package/src/guard/types.ts +3 -2
- package/src/index.ts +2 -0
- package/src/provider/index.tsx +53 -1
- package/src/shell/app-brand.module.css +2 -2
- package/src/shell/app-brand.tsx +1 -0
- package/src/shell/app-header.module.css +18 -8
- package/src/shell/app-main.module.css +54 -3
- package/src/shell/app-main.module.css.d.ts +1 -0
- package/src/shell/app-mobile-nav.module.css +16 -4
- package/src/shell/app-sidebar.module.css +4 -6
- package/src/shell/index.tsx +200 -129
- package/src/shell/mobile-nav-model.ts +1 -1
- package/src/shell/page-aside.tsx +70 -21
- package/src/shell/page-bar.module.css +10 -34
- package/src/shell/page-bar.tsx +10 -5
- package/src/shell/use-breakpoint.ts +9 -45
- package/src/shell/use-size-class.ts +31 -0
- package/src/state/persisted-or-local.ts +10 -4
- package/src/state/persisted.ts +76 -17
- package/src/styles.css +41 -0
- package/src/surfaces.ts +9 -1
- package/src/theme/controls.module.css +7 -0
- package/src/theme/ctl-theme.tsx +15 -3
- package/src/theme/floating.module.css +36 -0
- package/src/theme/floating.module.css.d.ts +3 -0
- package/src/theme/index.ts +46 -8
- package/src/theme/nav-link.module.css +7 -0
- package/src/tokens/index.ts +20 -30
- package/src/tokens/palette.ts +6 -28
- package/src/tokens/size-classes.ts +46 -0
- package/dist/shell/isomorphic-layout-effect.d.ts.map +0 -1
- /package/dist/{shell → common}/isomorphic-layout-effect.js +0 -0
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { scaleBand } from "@visx/scale";
|
|
2
2
|
import { useCallback, useMemo, useRef } from "react";
|
|
3
3
|
import { autoMargin } from "../layout/auto-margin.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
isTightClass,
|
|
6
|
+
planXLabels,
|
|
7
|
+
resolveMarginFloor,
|
|
8
|
+
resolveYPlacement
|
|
9
|
+
} from "../primitives/chart-layout.js";
|
|
10
|
+
import { useChartContainerClass, useChartMetrics } from "../primitives/chart-tier.js";
|
|
5
11
|
import { maxTextWidth } from "../utils/measure-text.js";
|
|
6
12
|
import { smartTicks, xLabelPxFor } from "../utils/ticks.js";
|
|
7
13
|
import { useChartCursor } from "./useChartCursor.js";
|
|
@@ -29,27 +35,47 @@ function useBandPlot(input) {
|
|
|
29
35
|
margin: marginOverride,
|
|
30
36
|
tooltip
|
|
31
37
|
} = input;
|
|
32
|
-
const tier =
|
|
38
|
+
const tier = useChartMetrics();
|
|
39
|
+
const containerClass = useChartContainerClass();
|
|
40
|
+
const tight = isTightClass(containerClass);
|
|
33
41
|
const hasLeftAxis = leftLabels !== void 0 && leftLabels.length > 0;
|
|
42
|
+
const yPlacement = resolveYPlacement(containerClass, {
|
|
43
|
+
hasLeftAxis,
|
|
44
|
+
marginOverrideLeft: marginOverride?.left
|
|
45
|
+
});
|
|
34
46
|
const xLabelsAll = useMemo(() => data.map((d) => formatX(getX(d))), [data, getX, formatX]);
|
|
47
|
+
const xPlan = useMemo(
|
|
48
|
+
() => planXLabels({
|
|
49
|
+
labels: xLabelsAll,
|
|
50
|
+
plotWidth: width - tier.margin.left - tier.margin.right,
|
|
51
|
+
fontPx: tier.axisFont,
|
|
52
|
+
categorical: tight
|
|
53
|
+
}),
|
|
54
|
+
[xLabelsAll, width, tier.margin, tier.axisFont, tight]
|
|
55
|
+
);
|
|
56
|
+
const xWrapWidth = xPlan.wrap ? xPlan.wrapPx : void 0;
|
|
35
57
|
const margin = useMemo(() => {
|
|
36
58
|
const measured = autoMargin({
|
|
37
|
-
...leftLabels !== void 0 && { left: leftLabels },
|
|
59
|
+
...leftLabels !== void 0 && { left: yPlacement === "outside" ? leftLabels : [] },
|
|
38
60
|
bottom: xLabelsAll,
|
|
39
61
|
fontPx: tier.axisFont,
|
|
40
|
-
floor
|
|
62
|
+
// An inside-placed left axis paints IN the plot, so the outside label-width floor is dead
|
|
63
|
+
// space there — same law as `CartesianChart`'s `marginInput.floor`.
|
|
64
|
+
floor: resolveMarginFloor(yPlacement, tier.margin),
|
|
65
|
+
anchorTerminals: tight,
|
|
66
|
+
bottomLines: xPlan.lines,
|
|
41
67
|
...marginOverride !== void 0 && { override: marginOverride }
|
|
42
68
|
});
|
|
43
69
|
if (marginOverride?.left !== void 0 && marginOverride.right !== void 0) return measured;
|
|
44
70
|
const halfXLabel = Math.ceil(maxTextWidth(xLabelsAll, tier.axisFont) / 2);
|
|
45
|
-
const left = hasLeftAxis ? measured.left : Math.max(measured.left, halfXLabel);
|
|
71
|
+
const left = hasLeftAxis || tight ? measured.left : Math.max(measured.left, halfXLabel);
|
|
46
72
|
return {
|
|
47
73
|
...measured,
|
|
48
74
|
...marginOverride?.left === void 0 && {
|
|
49
|
-
left: hasLeftAxis ? left : capTerminalGutter(left, width, TERMINAL_GUTTER_MAX_FRACTION.left, tier.margin.left)
|
|
75
|
+
left: hasLeftAxis || tight ? left : capTerminalGutter(left, width, TERMINAL_GUTTER_MAX_FRACTION.left, tier.margin.left)
|
|
50
76
|
},
|
|
51
77
|
...marginOverride?.right === void 0 && {
|
|
52
|
-
right: capTerminalGutter(
|
|
78
|
+
right: tight ? measured.right : capTerminalGutter(
|
|
53
79
|
measured.right,
|
|
54
80
|
width,
|
|
55
81
|
TERMINAL_GUTTER_MAX_FRACTION.right,
|
|
@@ -57,7 +83,18 @@ function useBandPlot(input) {
|
|
|
57
83
|
)
|
|
58
84
|
}
|
|
59
85
|
};
|
|
60
|
-
}, [
|
|
86
|
+
}, [
|
|
87
|
+
leftLabels,
|
|
88
|
+
xLabelsAll,
|
|
89
|
+
marginOverride,
|
|
90
|
+
hasLeftAxis,
|
|
91
|
+
width,
|
|
92
|
+
tier.axisFont,
|
|
93
|
+
tier.margin,
|
|
94
|
+
tight,
|
|
95
|
+
yPlacement,
|
|
96
|
+
xPlan.lines
|
|
97
|
+
]);
|
|
61
98
|
const plotWidth = Math.max(width - margin.left - margin.right, 0);
|
|
62
99
|
const minBandPx = fold?.minBandPx ?? DEFAULT_MIN_BAND_PX;
|
|
63
100
|
const merge = fold?.merge;
|
|
@@ -77,31 +114,35 @@ function useBandPlot(input) {
|
|
|
77
114
|
},
|
|
78
115
|
[scale]
|
|
79
116
|
);
|
|
117
|
+
const svgRef = useRef(null);
|
|
80
118
|
const cursor = useChartCursor({
|
|
81
119
|
data: bands,
|
|
82
120
|
chartId,
|
|
83
121
|
getKey: getX,
|
|
84
122
|
xScale: bandCenter,
|
|
85
123
|
marginLeft: margin.left,
|
|
124
|
+
// Both callers (`BandStrip`, `MirroredBars`) mount exactly one `<svg ref={band.svgRef}>`, so
|
|
125
|
+
// it doubles as the tap-outside boundary (`docs/CHARTS-SPEC.md` §4, Tooltip) with no separate
|
|
126
|
+
// passthrough option — reusing the ref this hook already returns, not a new one.
|
|
127
|
+
boundaryRef: svgRef,
|
|
86
128
|
...cursorResolution !== void 0 && { resolution: cursorResolution }
|
|
87
129
|
});
|
|
88
130
|
const xLabelPx = useMemo(
|
|
89
|
-
() => xLabelPxFor(keys.map(formatX), tier.axisFont),
|
|
90
|
-
[keys, formatX, tier.axisFont]
|
|
131
|
+
() => xWrapWidth === void 0 ? xLabelPxFor(keys.map(formatX), tier.axisFont) : xPlan.labelPx,
|
|
132
|
+
[keys, formatX, tier.axisFont, xWrapWidth, xPlan.labelPx]
|
|
91
133
|
);
|
|
92
|
-
const tickValues = useMemo(
|
|
93
|
-
()
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
[keys, plotWidth,
|
|
97
|
-
);
|
|
98
|
-
const svgRef = useRef(null);
|
|
134
|
+
const tickValues = useMemo(() => {
|
|
135
|
+
if (xTickValues !== void 0) return [...xTickValues(keys, plotWidth)];
|
|
136
|
+
if (containerClass === "micro")
|
|
137
|
+
return keys.length > 1 ? [keys[0], keys[keys.length - 1]] : [...keys];
|
|
138
|
+
return [...smartTicks(keys, plotWidth, xLabelPx, tight)];
|
|
139
|
+
}, [keys, plotWidth, xTickValues, xLabelPx, containerClass, tight]);
|
|
99
140
|
const point = cursor.point;
|
|
100
141
|
const crosshairX = point === null ? null : bandCenter(getX(point)) ?? null;
|
|
101
142
|
const cfg = tooltip === false ? void 0 : tooltip;
|
|
102
143
|
const isFollowerRender = !cursor.isSource && cfg?.onFollow === true;
|
|
103
144
|
const showTooltip = tooltip !== false && point !== null && (cursor.isSource || isFollowerRender);
|
|
104
|
-
const useAnchored = cfg?.follow === false || isFollowerRender;
|
|
145
|
+
const useAnchored = cfg?.follow === false || cfg?.follow === void 0 && cursor.isTouch || isFollowerRender;
|
|
105
146
|
const anchorX = useAnchored ? crosshairX : null;
|
|
106
147
|
const svgRect = anchorX === null ? void 0 : svgRef.current?.getBoundingClientRect();
|
|
107
148
|
const tooltipAnchor = svgRect === void 0 || anchorX === null ? cursor.anchor : { x: svgRect.left + margin.left + anchorX, y: svgRect.top + margin.top };
|
|
@@ -119,6 +160,9 @@ function useBandPlot(input) {
|
|
|
119
160
|
step,
|
|
120
161
|
bandWidth,
|
|
121
162
|
tickValues,
|
|
163
|
+
yPlacement,
|
|
164
|
+
xAnchorTerminals: tight,
|
|
165
|
+
xWrapWidth,
|
|
122
166
|
svgRef,
|
|
123
167
|
tooltipAnchor,
|
|
124
168
|
showTooltip,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KeyboardEvent, PointerEvent } from 'react';
|
|
1
|
+
import type { KeyboardEvent, PointerEvent, RefObject } from 'react';
|
|
2
2
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
3
3
|
/** Viewport-space pointer anchor the tooltip positions against. */
|
|
4
4
|
export type CursorAnchor = {
|
|
@@ -12,24 +12,46 @@ export type ChartCursor<T> = {
|
|
|
12
12
|
isSource: boolean;
|
|
13
13
|
/** Latest pointer position in viewport coords, or null when not hovered. */
|
|
14
14
|
anchor: CursorAnchor | null;
|
|
15
|
+
/**
|
|
16
|
+
* True when the interaction that most recently placed THIS chart's cursor had
|
|
17
|
+
* `event.pointerType !== 'mouse'` (touch or pen). Callers fold it into the anchored-tooltip
|
|
18
|
+
* condition (`tooltip.follow` defaulting to `false` on touch, docs/CHARTS-SPEC.md §4) — a follower's own
|
|
19
|
+
* anchoring is unaffected, since a follower is never the one whose pointer set this flag.
|
|
20
|
+
*/
|
|
21
|
+
isTouch: boolean;
|
|
15
22
|
onPointerMove: (event: PointerEvent<SVGRectElement>) => void;
|
|
16
|
-
|
|
23
|
+
/** Coarse-pointer equivalent of hover: resolves the nearest point and shows the tooltip
|
|
24
|
+
* immediately, with no preceding `pointermove` — a plain tap otherwise fires only
|
|
25
|
+
* `pointerdown`/`pointerup`. The press is PROVISIONAL: it shows the tooltip but does not commit a
|
|
26
|
+
* pin, which only `onPointerUp` does. Also what MOVES an existing touch pin to a new tap elsewhere
|
|
27
|
+
* in the same chart (fine pointers ignore it; `onPointerMove` already covers hover for them). */
|
|
28
|
+
onPointerDown: (event: PointerEvent<SVGRectElement>) => void;
|
|
29
|
+
/** Commits the provisional touch press — the same `pointerId` as the matching `onPointerDown` —
|
|
30
|
+
* so the pin survives the lift. A `pointerup` for any other pointer is ignored. */
|
|
31
|
+
onPointerUp: (event: PointerEvent<SVGRectElement>) => void;
|
|
32
|
+
/** `pointerleave`/`pointercancel`, sharing one handler. A still-UNCOMMITTED touch press cancelled
|
|
33
|
+
* here is the browser taking the gesture (a scroll) and clears; once committed, touch no-ops so a
|
|
34
|
+
* stray `pointercancel` cannot undo the pin. A fine pointer always clears. */
|
|
35
|
+
onPointerLeave: (event: PointerEvent<SVGRectElement>) => void;
|
|
17
36
|
onKeyDown: (event: KeyboardEvent<SVGRectElement>) => void;
|
|
18
37
|
onBlur: () => void;
|
|
19
38
|
};
|
|
20
39
|
/**
|
|
21
40
|
* Wires a chart into the ambient cursor store: snaps the pointer to the nearest own point,
|
|
22
|
-
* broadcasts it, and reads back a sibling's broadcast through domain-aware resolution
|
|
23
|
-
*
|
|
24
|
-
*
|
|
41
|
+
* broadcasts it, and reads back a sibling's broadcast through domain-aware resolution — automatic,
|
|
42
|
+
* no `resolveKey` escape hatch.
|
|
43
|
+
*
|
|
44
|
+
* The tooltip anchor is coalesced through `requestAnimationFrame` (one local write per frame on a
|
|
45
|
+
* fast scrub); the BROADCAST is deduped instead, so a within-bucket scrub costs nothing and a real
|
|
46
|
+
* bucket change reaches siblings on the same tick.
|
|
25
47
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
48
|
+
* Touch model (`docs/CHARTS-SPEC.md` §4): a fine pointer keeps hovering. A coarse pointer
|
|
49
|
+
* (`onPointerDown`) resolves and shows the tooltip immediately, drag-scrubs via `onPointerMove`,
|
|
50
|
+
* and COMMITS a pin on `onPointerUp` — `onPointerLeave` (also wired to `pointercancel`) no-ops once
|
|
51
|
+
* committed. A press the browser turns into a scroll clears instead. The pin moves on a fresh tap,
|
|
52
|
+
* clears on a `document` tap outside `boundaryRef`, on any scroll, or on Escape.
|
|
31
53
|
*/
|
|
32
|
-
export declare function useChartCursor<T>({ data, chartId, getKey, xScale, marginLeft, resolution, }: {
|
|
54
|
+
export declare function useChartCursor<T>({ data, chartId, getKey, xScale, marginLeft, resolution, boundaryRef, }: {
|
|
33
55
|
data: readonly T[];
|
|
34
56
|
chartId: string;
|
|
35
57
|
getKey: (d: T) => string;
|
|
@@ -42,5 +64,12 @@ export declare function useChartCursor<T>({ data, chartId, getKey, xScale, margi
|
|
|
42
64
|
* series keyed by its Monday, a monthly series keyed by its 1st) — see {@link CursorResolution}.
|
|
43
65
|
*/
|
|
44
66
|
resolution?: CursorResolution;
|
|
67
|
+
/**
|
|
68
|
+
* Element a touch tap OUTSIDE dismisses the pin against (`docs/CHARTS-SPEC.md` §4). One
|
|
69
|
+
* capture-phase `document` `pointerdown` listener clears the pin when the target falls outside
|
|
70
|
+
* this ref — added on pinning, removed on unpin/unmount. Omit to skip outside-dismiss (a tap
|
|
71
|
+
* elsewhere in the chart and Escape still work); never throws for a missing ref.
|
|
72
|
+
*/
|
|
73
|
+
boundaryRef?: RefObject<Element | null>;
|
|
45
74
|
}): ChartCursor<T>;
|
|
46
75
|
//# sourceMappingURL=useChartCursor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChartCursor.d.ts","sourceRoot":"","sources":["../../../src/charts/hooks/useChartCursor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useChartCursor.d.ts","sourceRoot":"","sources":["../../../src/charts/hooks/useChartCursor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAMzD,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnD,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,kGAAkG;IAClG,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IACf,kGAAkG;IAClG,QAAQ,EAAE,OAAO,CAAA;IACjB,4EAA4E;IAC5E,MAAM,EAAE,Y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useState } from "react";
|
|
3
3
|
import { buildDomainIndex, classifyDomain, resolveCursorPoint } from "../cursor/resolve.js";
|
|
4
4
|
import { useCursorState, useCursorStore } from "../cursor/scope.js";
|
|
5
|
+
import { useDismissOnOutside, useTouchPin } from "../cursor/touch-pin.js";
|
|
5
6
|
function useChartCursor({
|
|
6
7
|
data,
|
|
7
8
|
chartId,
|
|
8
9
|
getKey,
|
|
9
10
|
xScale,
|
|
10
11
|
marginLeft,
|
|
11
|
-
resolution = "nearest"
|
|
12
|
+
resolution = "nearest",
|
|
13
|
+
boundaryRef
|
|
12
14
|
}) {
|
|
13
15
|
const store = useCursorStore();
|
|
14
16
|
const cursor = useCursorState();
|
|
15
17
|
const [anchor, setAnchor] = useState(null);
|
|
18
|
+
const [isTouch, setIsTouch] = useState(false);
|
|
19
|
+
const pinnedRef = useRef(false);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (cursor.source !== chartId) pinnedRef.current = false;
|
|
22
|
+
}, [cursor.source, chartId]);
|
|
16
23
|
const getKeyRef = useRef(getKey);
|
|
17
24
|
getKeyRef.current = getKey;
|
|
18
25
|
const xScaleRef = useRef(xScale);
|
|
@@ -24,9 +31,14 @@ function useChartCursor({
|
|
|
24
31
|
const kind = useMemo(() => classifyDomain(data.map((d) => getKeyRef.current(d))), [data]);
|
|
25
32
|
const frameRef = useRef(null);
|
|
26
33
|
const pendingRef = useRef(null);
|
|
34
|
+
const moveFrameRef = useRef(null);
|
|
35
|
+
const pendingMoveRef = useRef(
|
|
36
|
+
null
|
|
37
|
+
);
|
|
27
38
|
useEffect(
|
|
28
39
|
() => () => {
|
|
29
40
|
if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);
|
|
41
|
+
if (moveFrameRef.current !== null) cancelAnimationFrame(moveFrameRef.current);
|
|
30
42
|
if (store.get().source === chartId) store.set(null, null, null);
|
|
31
43
|
},
|
|
32
44
|
[store, chartId]
|
|
@@ -39,12 +51,14 @@ function useChartCursor({
|
|
|
39
51
|
setAnchor(pendingRef.current);
|
|
40
52
|
});
|
|
41
53
|
}, []);
|
|
42
|
-
const
|
|
43
|
-
(
|
|
54
|
+
const touchPin = useTouchPin({
|
|
55
|
+
getCommitted: () => store.get(),
|
|
56
|
+
setCommitted: (v) => store.set(v.key, v.source, v.kind)
|
|
57
|
+
});
|
|
58
|
+
const resolveNearestAt = useCallback(
|
|
59
|
+
(px, anchor2, pointerType) => {
|
|
44
60
|
if (data.length === 0) return;
|
|
45
|
-
|
|
46
|
-
if (local === null) return;
|
|
47
|
-
const px = local.x - marginLeft;
|
|
61
|
+
if (pointerType === "mouse" && pinnedRef.current && store.get().source === chartId) return;
|
|
48
62
|
let closest = data[0];
|
|
49
63
|
let minDist = Infinity;
|
|
50
64
|
for (const d of data) {
|
|
@@ -55,20 +69,84 @@ function useChartCursor({
|
|
|
55
69
|
closest = d;
|
|
56
70
|
}
|
|
57
71
|
}
|
|
58
|
-
|
|
72
|
+
setIsTouch(pointerType !== "mouse");
|
|
73
|
+
scheduleAnchor(anchor2);
|
|
59
74
|
store.set(getKeyRef.current(closest), chartId, kind);
|
|
60
75
|
},
|
|
61
|
-
[data,
|
|
76
|
+
[data, chartId, store, scheduleAnchor, kind]
|
|
77
|
+
);
|
|
78
|
+
const localX = useCallback(
|
|
79
|
+
(event) => {
|
|
80
|
+
const local = localPoint(event.currentTarget, event.nativeEvent);
|
|
81
|
+
return local === null ? null : local.x - marginLeft;
|
|
82
|
+
},
|
|
83
|
+
[marginLeft]
|
|
84
|
+
);
|
|
85
|
+
const resolveImmediate = useCallback(
|
|
86
|
+
(event) => {
|
|
87
|
+
const px = localX(event);
|
|
88
|
+
if (px === null) return;
|
|
89
|
+
resolveNearestAt(px, { x: event.clientX, y: event.clientY }, event.pointerType);
|
|
90
|
+
},
|
|
91
|
+
[localX, resolveNearestAt]
|
|
92
|
+
);
|
|
93
|
+
const onPointerMove = useCallback(
|
|
94
|
+
(event) => {
|
|
95
|
+
const px = localX(event);
|
|
96
|
+
if (px === null) return;
|
|
97
|
+
pendingMoveRef.current = {
|
|
98
|
+
px,
|
|
99
|
+
anchor: { x: event.clientX, y: event.clientY },
|
|
100
|
+
pointerType: event.pointerType
|
|
101
|
+
};
|
|
102
|
+
if (moveFrameRef.current !== null) return;
|
|
103
|
+
moveFrameRef.current = requestAnimationFrame(() => {
|
|
104
|
+
moveFrameRef.current = null;
|
|
105
|
+
const pending = pendingMoveRef.current;
|
|
106
|
+
pendingMoveRef.current = null;
|
|
107
|
+
if (pending !== null) resolveNearestAt(pending.px, pending.anchor, pending.pointerType);
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
[localX, resolveNearestAt]
|
|
111
|
+
);
|
|
112
|
+
const onPointerDown = useCallback(
|
|
113
|
+
(event) => {
|
|
114
|
+
if (event.pointerType !== "mouse") touchPin.begin(event.pointerId);
|
|
115
|
+
resolveImmediate(event);
|
|
116
|
+
},
|
|
117
|
+
[resolveImmediate, touchPin]
|
|
118
|
+
);
|
|
119
|
+
const onPointerUp = useCallback(
|
|
120
|
+
(event) => {
|
|
121
|
+
if (event.pointerType === "mouse") return;
|
|
122
|
+
if (touchPin.commit(event.pointerId)) pinnedRef.current = true;
|
|
123
|
+
},
|
|
124
|
+
[touchPin]
|
|
62
125
|
);
|
|
63
126
|
const clear = useCallback(() => {
|
|
64
127
|
if (frameRef.current !== null) {
|
|
65
128
|
cancelAnimationFrame(frameRef.current);
|
|
66
129
|
frameRef.current = null;
|
|
67
130
|
}
|
|
131
|
+
if (moveFrameRef.current !== null) {
|
|
132
|
+
cancelAnimationFrame(moveFrameRef.current);
|
|
133
|
+
moveFrameRef.current = null;
|
|
134
|
+
}
|
|
68
135
|
pendingRef.current = null;
|
|
136
|
+
pendingMoveRef.current = null;
|
|
137
|
+
touchPin.reset();
|
|
138
|
+
pinnedRef.current = false;
|
|
69
139
|
setAnchor(null);
|
|
70
140
|
if (store.get().source === chartId) store.set(null, null, null);
|
|
71
|
-
}, [store, chartId]);
|
|
141
|
+
}, [store, chartId, touchPin]);
|
|
142
|
+
const onPointerLeave = useCallback(
|
|
143
|
+
(event) => {
|
|
144
|
+
if (touchPin.cancel(event.pointerId)) return;
|
|
145
|
+
if (isTouch) return;
|
|
146
|
+
clear();
|
|
147
|
+
},
|
|
148
|
+
[isTouch, clear, touchPin]
|
|
149
|
+
);
|
|
72
150
|
const onKeyDown = useCallback(
|
|
73
151
|
(event) => {
|
|
74
152
|
if (data.length === 0) return;
|
|
@@ -94,12 +172,25 @@ function useChartCursor({
|
|
|
94
172
|
[data, store, chartId, clear, scheduleAnchor, kind]
|
|
95
173
|
);
|
|
96
174
|
const point = cursor.key === null || cursor.kind !== kind ? null : resolveCursorPoint(index, cursor.key);
|
|
175
|
+
const isSource = cursor.source === chartId;
|
|
176
|
+
const isInsideBoundary = useCallback(
|
|
177
|
+
(target) => boundaryRef?.current?.contains(target) === true,
|
|
178
|
+
[boundaryRef]
|
|
179
|
+
);
|
|
180
|
+
useDismissOnOutside({
|
|
181
|
+
enabled: isTouch && isSource && boundaryRef !== void 0,
|
|
182
|
+
isInside: isInsideBoundary,
|
|
183
|
+
onDismiss: clear
|
|
184
|
+
});
|
|
97
185
|
return {
|
|
98
186
|
point,
|
|
99
|
-
isSource
|
|
187
|
+
isSource,
|
|
100
188
|
anchor,
|
|
189
|
+
isTouch,
|
|
101
190
|
onPointerMove,
|
|
102
|
-
|
|
191
|
+
onPointerDown,
|
|
192
|
+
onPointerUp,
|
|
193
|
+
onPointerLeave,
|
|
103
194
|
onKeyDown,
|
|
104
195
|
onBlur: clear
|
|
105
196
|
};
|
package/dist/charts/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export { type SeriesMark, type SeriesDash, type SeriesCurve, curveFor, type Seri
|
|
|
19
19
|
export { CartesianChart, resolveAxisDomain, type CartesianChartProps, type CartesianTooltipConfig, type CartesianTooltipRowContext, type AxisConfig, type PlotContext, } from './primitives/CartesianChart.js';
|
|
20
20
|
export { ChartFrame, type ChartFrameProps, type ChartFrameLegend, type ResponsiveChartHeight, type PlotRect, resolveLegend, } from './primitives/ChartFrame.js';
|
|
21
21
|
export { ChartCenter, type ChartCenterProps, ChartPending, type ChartPendingProps, ChartEmpty, type ChartEmptyProps, ChartError, type ChartErrorProps, type ChartState, type ResolvedChartState, resolveChartState, } from './primitives/ChartPending.js';
|
|
22
|
-
export { useChartTier, useChartTierMetrics, chartTierMetrics, resolveChartTier, type ChartTier, type ChartTierMetrics, } from './primitives/chart-tier.js';
|
|
23
22
|
export { Crosshair, SeriesDot } from './primitives/Crosshair.js';
|
|
24
23
|
export { HatchPattern, hatchFill, hatchSizeFor } from './primitives/HatchPattern.js';
|
|
25
24
|
export { ChartCard, type ChartCardProps, type ChartCardSlot } from './primitives/ChartCard.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/charts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,EAAE,EACF,KAAK,EACL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,KAAK,WAAW,GACjB,MAAM,WAAW,CAAA;AAGlB,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAG5C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC7F,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,YAAY,EACZ,iBAAiB,GAClB,MAAM,UAAU,CAAA;AAGjB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACb,aAAa,GACd,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,YAAY,EACZ,KAAK,iBAAiB,EACtB,UAAU,EACV,KAAK,eAAe,EACpB,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,iBAAiB,GAClB,MAAM,2BAA2B,CAAA;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/charts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,EAAE,EACF,KAAK,EACL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,KAAK,WAAW,GACjB,MAAM,WAAW,CAAA;AAGlB,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAG5C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC7F,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,QAA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E,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAEvE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,QAAQ,GACd,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGjG,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAA;AAMrB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EACL,cAAc,EACd,WAAW,EACX,eAAe,EACf,SAAS,EACT,cAAc,EACd,eAAe,EACf,UAAU,GACX,MAAM,aAAa,CAAA"}
|
package/dist/charts/index.js
CHANGED
|
@@ -33,12 +33,6 @@ import {
|
|
|
33
33
|
ChartError,
|
|
34
34
|
resolveChartState
|
|
35
35
|
} from "./primitives/ChartPending.js";
|
|
36
|
-
import {
|
|
37
|
-
useChartTier,
|
|
38
|
-
useChartTierMetrics,
|
|
39
|
-
chartTierMetrics,
|
|
40
|
-
resolveChartTier
|
|
41
|
-
} from "./primitives/chart-tier.js";
|
|
42
36
|
import { Crosshair, SeriesDot } from "./primitives/Crosshair.js";
|
|
43
37
|
import { HatchPattern, hatchFill, hatchSizeFor } from "./primitives/HatchPattern.js";
|
|
44
38
|
import { ChartCard } from "./primitives/ChartCard.js";
|
|
@@ -163,7 +157,6 @@ export {
|
|
|
163
157
|
autoXLabelRotate,
|
|
164
158
|
buildPaletteCss,
|
|
165
159
|
chartMargin,
|
|
166
|
-
chartTierMetrics,
|
|
167
160
|
createCursorStore,
|
|
168
161
|
curveBasis,
|
|
169
162
|
curveCatmullRom,
|
|
@@ -193,7 +186,6 @@ export {
|
|
|
193
186
|
probeAxisLabels,
|
|
194
187
|
resolveAxisDomain,
|
|
195
188
|
resolveChartState,
|
|
196
|
-
resolveChartTier,
|
|
197
189
|
resolveLegend,
|
|
198
190
|
scaleBand,
|
|
199
191
|
scaleLinear,
|
|
@@ -204,8 +196,6 @@ export {
|
|
|
204
196
|
smartTicksEvery,
|
|
205
197
|
useChartCursor,
|
|
206
198
|
useChartSize,
|
|
207
|
-
useChartTier,
|
|
208
|
-
useChartTierMetrics,
|
|
209
199
|
useCursorState,
|
|
210
200
|
useVxTheme,
|
|
211
201
|
xLabelPxFor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BandStrip.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/BandStrip.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAGvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA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AAM,EAAE,EAAE,SAAS,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAA;IAC/E,4EAA4E;IAC5E,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IAClB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;IACtC,MAAM,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAA;IAClC;;;;;wEAKoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAC7B;iDAC6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;4FACwF;IACxF,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AA2CD;;;;;;;;;;;;;GAaG;AACH,iBAAS,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,+BAwBlD;AAkRD,eAAO,MAAM,SAAS,EAAoB,OAAO,cAAc,CAAA"}
|
|
@@ -175,47 +175,60 @@ function BandStripPlot(props) {
|
|
|
175
175
|
const badge = cfg?.label === void 0 || point === null ? null : cfg.label(point);
|
|
176
176
|
const row = point === null ? null : deriveBandRow(getBand(point), styleByKey, hidden, point);
|
|
177
177
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
178
|
-
/* @__PURE__ */ jsxs(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
178
|
+
/* @__PURE__ */ jsxs(
|
|
179
|
+
"svg",
|
|
180
|
+
{
|
|
181
|
+
ref: band.svgRef,
|
|
182
|
+
width: plot.width,
|
|
183
|
+
height: plot.height,
|
|
184
|
+
style: { touchAction: "pan-y" },
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
|
|
187
|
+
HatchPattern,
|
|
188
|
+
{
|
|
189
|
+
id: hatchId,
|
|
190
|
+
color: absentColor,
|
|
191
|
+
opacity: 0.7,
|
|
192
|
+
size: hatchSizeFor(bandWidth)
|
|
193
|
+
}
|
|
194
|
+
) }),
|
|
195
|
+
/* @__PURE__ */ jsxs(Group, { left: margin.left, top: margin.top, children: [
|
|
196
|
+
rects,
|
|
197
|
+
crosshairX !== null && /* @__PURE__ */ jsx(Crosshair, { x: crosshairX, top: 0, bottom: stripHeight }),
|
|
198
|
+
/* @__PURE__ */ jsx(
|
|
199
|
+
AxisBottomDate,
|
|
200
|
+
{
|
|
201
|
+
top: stripHeight,
|
|
202
|
+
scale,
|
|
203
|
+
tickValues: band.tickValues,
|
|
204
|
+
tickFormat: (v) => formatX(String(v)),
|
|
205
|
+
anchorTerminals: band.xAnchorTerminals,
|
|
206
|
+
...band.xWrapWidth !== void 0 && { wrapWidth: band.xWrapWidth }
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ jsx(
|
|
210
|
+
HoverOverlay,
|
|
211
|
+
{
|
|
212
|
+
width: plotWidth,
|
|
213
|
+
height: stripHeight,
|
|
214
|
+
onMove: cursor.onPointerMove,
|
|
215
|
+
onDown: cursor.onPointerDown,
|
|
216
|
+
onUp: cursor.onPointerUp,
|
|
217
|
+
onLeave: cursor.onPointerLeave,
|
|
218
|
+
onKeyDown: cursor.onKeyDown,
|
|
219
|
+
onBlur: cursor.onBlur,
|
|
220
|
+
valueMax: Math.max(bands.length - 1, 0),
|
|
221
|
+
...point !== null && {
|
|
222
|
+
valueNow: bands.indexOf(point),
|
|
223
|
+
valueText: formatX(getX(point))
|
|
224
|
+
},
|
|
225
|
+
...ariaLabel !== void 0 && { ariaLabel }
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
] })
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
),
|
|
219
232
|
band.showTooltip && point !== null && /* @__PURE__ */ jsxs(ChartTooltipFloat, { anchor: band.tooltipAnchor, ariaLive: band.ariaLive, children: [
|
|
220
233
|
/* @__PURE__ */ jsx(
|
|
221
234
|
TooltipHeader,
|
|
@@ -59,11 +59,17 @@ export type DonutProps<K extends string = SeriesKey> = BasaltProps & {
|
|
|
59
59
|
/**
|
|
60
60
|
* Radial slice-share chart with a punched-out center label. Composes `ChartFrame` for a
|
|
61
61
|
* categorical legend derived from the slices (one `SeriesStyle` per slice, `mark: 'bar'`) so the
|
|
62
|
-
* legend can never drift from what's plotted — legend-hidden slices drop out of the ring
|
|
63
|
-
*
|
|
64
|
-
* meaningless for a radial layout. Hover stays local to the pie (dimming siblings on hover) rather
|
|
62
|
+
* legend can never drift from what's plotted — legend-hidden slices drop out of the ring and the
|
|
63
|
+
* tooltip together, while every share is taken of ALL slices so the legend and the tooltip never
|
|
64
|
+
* disagree (`docs/CHARTS-SPEC.md` §5). No crosshair — meaningless for a radial layout. Hover stays local to the pie (dimming siblings on hover) rather
|
|
65
65
|
* than joining the shared cursor: a date-keyed cursor has no counterpart on a donut, and cross-kind
|
|
66
66
|
* category sync (donut ↔ bar, via a generalized key) is a distinct, deliberately deferred feature.
|
|
67
|
+
* Tap-to-pin, keyboard stepping and focus over the slice ring come from `useDiscreteCursor`
|
|
68
|
+
* (`docs/CHARTS-SPEC.md` §4, Tooltip), the discrete counterpart of `HoverOverlay`.
|
|
69
|
+
*
|
|
70
|
+
* Layout law (`docs/CHARTS-SPEC.md` §5, Legend): frame W/H > 1.5 puts the legend beside the ring
|
|
71
|
+
* with value and %, the ring capped at `min(h, 0.55w)`; `micro`/`compact` stack the full legend
|
|
72
|
+
* under the ring, never rolled up. 7 or more slices fold the smallest into a neutral "Other".
|
|
67
73
|
*/
|
|
68
74
|
declare function DonutInner<K extends string = SeriesKey>(props: DonutProps<K>): import("react").JSX.Element;
|
|
69
75
|
export declare const Donut: typeof DonutInner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Donut.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/Donut.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Donut.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/Donut.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAY5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,IAAI;IAAE,GAAG,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,IAAI,WAAW,GAAG;IACnE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAA;IACrB;kGAC8F;IA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