basalt-ui 1.31.0 → 1.32.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 +23 -0
- package/MIGRATING.md +101 -17
- package/agent/rules/basalt-mantine.md +4 -4
- package/configs/oxlint-plugin.js +159 -42
- package/configs/oxlint-plugin.test.ts +182 -0
- package/dist/charts/kinds/BandStrip.d.ts.map +1 -1
- package/dist/charts/kinds/BandStrip.js +18 -66
- package/dist/charts/kinds/DualPanel.d.ts.map +1 -1
- package/dist/charts/kinds/DualPanel.js +5 -26
- package/dist/charts/kinds/MirroredBars.d.ts.map +1 -1
- package/dist/charts/kinds/MirroredBars.js +10 -68
- package/dist/charts/kinds/band-chrome.d.ts +31 -0
- package/dist/charts/kinds/band-chrome.d.ts.map +1 -0
- package/dist/charts/kinds/band-chrome.js +71 -0
- package/dist/charts/primitives/CartesianChart.d.ts.map +1 -1
- package/dist/charts/primitives/CartesianChart.js +49 -76
- package/dist/charts/primitives/ChartCard.d.ts.map +1 -1
- package/dist/charts/primitives/ChartCard.js +5 -23
- package/dist/charts/primitives/ChartFrame.d.ts.map +1 -1
- package/dist/charts/primitives/ChartFrame.js +23 -40
- package/dist/charts/primitives/ChartLegend.d.ts.map +1 -1
- package/dist/charts/primitives/ChartLegend.js +5 -133
- package/dist/charts/primitives/ChartTooltip.d.ts +5 -0
- package/dist/charts/primitives/ChartTooltip.d.ts.map +1 -1
- package/dist/charts/primitives/ChartTooltip.js +16 -1
- package/dist/charts/primitives/HoverOverlay.d.ts +24 -9
- package/dist/charts/primitives/HoverOverlay.d.ts.map +1 -1
- package/dist/charts/primitives/HoverOverlay.js +17 -1
- package/dist/charts/primitives/chart-card-context.d.ts +17 -13
- package/dist/charts/primitives/chart-card-context.d.ts.map +1 -1
- package/dist/charts/primitives/chart-card-context.js +10 -5
- package/dist/charts/primitives/chart-frame-layout.d.ts.map +1 -1
- package/dist/charts/primitives/chart-frame-layout.js +25 -31
- package/dist/charts/primitives/legend-disclosure.d.ts +27 -0
- package/dist/charts/primitives/legend-disclosure.d.ts.map +1 -0
- package/dist/charts/primitives/legend-disclosure.js +153 -0
- package/dist/controls/controls.module.css +5 -0
- package/dist/controls/sync-button.module.css +1 -0
- package/dist/dashboard/stat-group.module.css +19 -64
- package/dist/dashboard/widget-grid.module.css +11 -38
- package/dist/data/data-table-state.d.ts +83 -0
- package/dist/data/data-table-state.d.ts.map +1 -0
- package/dist/data/data-table-state.js +139 -0
- package/dist/data/data-table.d.ts +33 -2
- package/dist/data/data-table.d.ts.map +1 -1
- package/dist/data/data-table.js +179 -277
- package/dist/forms/form-layout.module.css +3 -13
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +6 -5
- package/dist/notifications/center.d.ts.map +1 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +12 -10
- package/dist/shell/aside-docking.d.ts +31 -0
- package/dist/shell/aside-docking.d.ts.map +1 -0
- package/dist/shell/aside-docking.js +19 -0
- package/dist/shell/index.d.ts +0 -11
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +13 -14
- package/dist/shell/use-breakpoint.d.ts +1 -1
- package/dist/theme/floating.module.css +1 -0
- package/dist/theme-lab/derive-controls.d.ts.map +1 -1
- package/llms.txt +2 -2
- package/package.json +2 -1
- package/src/charts/kinds/BandStrip.tsx +18 -64
- package/src/charts/kinds/DualPanel.tsx +4 -24
- package/src/charts/kinds/MirroredBars.tsx +12 -66
- package/src/charts/kinds/band-chrome.tsx +91 -0
- package/src/charts/primitives/CartesianChart.tsx +79 -122
- package/src/charts/primitives/ChartCard.tsx +5 -27
- package/src/charts/primitives/ChartFrame.tsx +37 -76
- package/src/charts/primitives/ChartLegend.tsx +7 -154
- package/src/charts/primitives/ChartTooltip.tsx +16 -0
- package/src/charts/primitives/HoverOverlay.tsx +52 -21
- package/src/charts/primitives/chart-card-context.ts +25 -16
- package/src/charts/primitives/chart-frame-layout.ts +44 -56
- package/src/charts/primitives/legend-disclosure.tsx +177 -0
- package/src/controls/controls.module.css +5 -0
- package/src/controls/sync-button.module.css +1 -0
- package/src/dashboard/stat-group.module.css +19 -64
- package/src/dashboard/widget-grid.module.css +11 -38
- package/src/data/data-table-state.ts +218 -0
- package/src/data/data-table.tsx +127 -218
- package/src/forms/form-layout.module.css +3 -13
- package/src/guard/index.ts +21 -16
- package/src/notifications/center.tsx +3 -0
- package/src/provider/index.tsx +18 -17
- package/src/shell/aside-docking.ts +54 -0
- package/src/shell/index.tsx +15 -37
- package/src/shell/use-breakpoint.ts +2 -2
- package/src/theme/floating.module.css +1 -0
- package/src/theme-lab/derive-controls.tsx +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/CartesianChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAOzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAM/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAWzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAKhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C;;;qGAGqG;AACrG,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,GAA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AAC,EACD,EAAE,EACF,MAAM,EACN,WAAW,EACX,OAAqB,EACrB,YAAY,EACZ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,WAAW,EACX,IAAI,EACJ,MAAM,EACN,OAAO,EACP,MAAM,EAAE,cAAc,EACtB,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,SAAS,CAiDpC"}
|
|
@@ -25,9 +25,9 @@ import {
|
|
|
25
25
|
yTickCount
|
|
26
26
|
} from "./chart-layout.js";
|
|
27
27
|
import { useChartContainerClass, useChartMetrics } from "./chart-tier.js";
|
|
28
|
-
import { ChartTooltipFloat, TooltipBody, TooltipHeader,
|
|
28
|
+
import { ChartTooltipFloat, TooltipBody, TooltipHeader, TooltipRows } from "./ChartTooltip.js";
|
|
29
29
|
import { Crosshair, SeriesDot } from "./Crosshair.js";
|
|
30
|
-
import { HoverOverlay } from "./HoverOverlay.js";
|
|
30
|
+
import { cursorSliderProps, HoverOverlay } from "./HoverOverlay.js";
|
|
31
31
|
import { XZoneRects } from "./XZoneRects.js";
|
|
32
32
|
import { ZoneRects } from "./ZoneRects.js";
|
|
33
33
|
const DEFAULT_AUTO_PAD = 1.1;
|
|
@@ -109,16 +109,23 @@ function buildYScale(cfg, domain, yMax, ticks) {
|
|
|
109
109
|
...cfg?.nice === true && { nice: true }
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
const {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
function resolveXAxisLayout(input) {
|
|
113
|
+
const { marginInput, flatMargin, rotated45Margin, flatLabelPx, xLabels, fontPx, categorical } = input;
|
|
114
|
+
const flatXMax = Math.max(input.plotWidth - flatMargin.left - flatMargin.right, 0);
|
|
115
|
+
const xPlan = planXLabels({ labels: xLabels, plotWidth: flatXMax, fontPx, categorical });
|
|
116
|
+
const rotate = input.xLabelRotate ?? (categorical ? xPlan.rotate : 0);
|
|
117
|
+
if (rotate === 45) {
|
|
118
|
+
const tickLabelPx = rotatedXLabelPx(xLabels, fontPx);
|
|
119
|
+
return { baseMargin: rotated45Margin, rotate, wrapWidth: void 0, tickLabelPx };
|
|
120
|
+
}
|
|
121
|
+
if (rotate === 90) {
|
|
122
|
+
const baseMargin2 = autoMargin({ ...marginInput, rotate });
|
|
123
|
+
return { baseMargin: baseMargin2, rotate, wrapWidth: void 0, tickLabelPx: flatLabelPx };
|
|
124
|
+
}
|
|
125
|
+
if (!xPlan.wrap)
|
|
126
|
+
return { baseMargin: flatMargin, rotate, wrapWidth: void 0, tickLabelPx: flatLabelPx };
|
|
127
|
+
const baseMargin = autoMargin({ ...marginInput, bottomLines: xPlan.lines });
|
|
128
|
+
return { baseMargin, rotate, wrapWidth: xPlan.wrapPx, tickLabelPx: xPlan.labelPx };
|
|
122
129
|
}
|
|
123
130
|
function CartesianChart({
|
|
124
131
|
data,
|
|
@@ -269,9 +276,9 @@ function CartesianPlot({
|
|
|
269
276
|
const xLabels = useMemo(() => keys.map(formatX), [keys, formatX]);
|
|
270
277
|
const yPlacement = resolveYPlacement(containerClass, { marginOverrideLeft: marginOverride?.left });
|
|
271
278
|
const categorical = tight && classifyDomain(keys) === "band";
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
|
|
279
|
+
const flatLabelPx = useMemo(() => xLabelPxFor(xLabels, tier.axisFont), [xLabels, tier.axisFont]);
|
|
280
|
+
const measured = useMemo(() => {
|
|
281
|
+
const marginInput = {
|
|
275
282
|
left: yPlacement === "outside" ? leftLabels : [],
|
|
276
283
|
right: rightLabels,
|
|
277
284
|
bottom: xLabels,
|
|
@@ -281,45 +288,33 @@ function CartesianPlot({
|
|
|
281
288
|
floor: resolveMarginFloor(yPlacement, tier.margin),
|
|
282
289
|
anchorTerminals: tight,
|
|
283
290
|
...marginOverride !== void 0 && { override: marginOverride }
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
leftLabels,
|
|
287
|
-
rightLabels,
|
|
288
|
-
xLabels,
|
|
289
|
-
tier.axisFont,
|
|
290
|
-
tier.margin,
|
|
291
|
-
marginOverride,
|
|
292
|
-
tight,
|
|
293
|
-
yPlacement
|
|
294
|
-
]
|
|
295
|
-
);
|
|
296
|
-
const flatMargin = useMemo(() => autoMargin(marginInput), [marginInput]);
|
|
297
|
-
const rotated45Margin = useMemo(() => autoMargin({ ...marginInput, rotate: 45 }), [marginInput]);
|
|
298
|
-
const flatXMax = Math.max(plot.width - flatMargin.left - flatMargin.right, 0);
|
|
299
|
-
const xPlan = useMemo(
|
|
300
|
-
() => planXLabels({ labels: xLabels, plotWidth: flatXMax, fontPx: tier.axisFont, categorical }),
|
|
301
|
-
[xLabels, flatXMax, tier.axisFont, categorical]
|
|
302
|
-
);
|
|
303
|
-
const rotate = xLabelRotate ?? (categorical ? xPlan.rotate : 0);
|
|
304
|
-
const wrapWidth = rotate === 0 && xPlan.wrap ? xPlan.wrapPx : void 0;
|
|
305
|
-
const tickLabelPx = resolveTickLabelPx({
|
|
306
|
-
rotate,
|
|
307
|
-
wrapWidth,
|
|
308
|
-
xLabels,
|
|
309
|
-
axisFont: tier.axisFont,
|
|
310
|
-
flatLabelPx: xLabelPx,
|
|
311
|
-
wrappedLabelPx: xPlan.labelPx
|
|
312
|
-
});
|
|
313
|
-
const baseMargin = useMemo(
|
|
314
|
-
() => resolveBaseMargin({
|
|
315
|
-
rotate,
|
|
316
|
-
wrapWidth,
|
|
317
|
-
flatMargin,
|
|
318
|
-
rotated45Margin,
|
|
291
|
+
};
|
|
292
|
+
return {
|
|
319
293
|
marginInput,
|
|
320
|
-
|
|
294
|
+
flatMargin: autoMargin(marginInput),
|
|
295
|
+
rotated45Margin: autoMargin({ ...marginInput, rotate: 45 })
|
|
296
|
+
};
|
|
297
|
+
}, [
|
|
298
|
+
leftLabels,
|
|
299
|
+
rightLabels,
|
|
300
|
+
xLabels,
|
|
301
|
+
tier.axisFont,
|
|
302
|
+
tier.margin,
|
|
303
|
+
marginOverride,
|
|
304
|
+
tight,
|
|
305
|
+
yPlacement
|
|
306
|
+
]);
|
|
307
|
+
const { baseMargin, rotate, wrapWidth, tickLabelPx } = useMemo(
|
|
308
|
+
() => resolveXAxisLayout({
|
|
309
|
+
...measured,
|
|
310
|
+
flatLabelPx,
|
|
311
|
+
xLabels,
|
|
312
|
+
fontPx: tier.axisFont,
|
|
313
|
+
plotWidth: plot.width,
|
|
314
|
+
categorical,
|
|
315
|
+
xLabelRotate
|
|
321
316
|
}),
|
|
322
|
-
[
|
|
317
|
+
[measured, flatLabelPx, xLabels, tier.axisFont, plot.width, categorical, xLabelRotate]
|
|
323
318
|
);
|
|
324
319
|
const yMax = Math.max(plot.height - baseMargin.top - baseMargin.bottom, 0);
|
|
325
320
|
const yScale = useMemo(
|
|
@@ -523,18 +518,7 @@ function CartesianPlot({
|
|
|
523
518
|
{
|
|
524
519
|
width: xMax,
|
|
525
520
|
height: yMax,
|
|
526
|
-
|
|
527
|
-
onDown: cursor.onPointerDown,
|
|
528
|
-
onUp: cursor.onPointerUp,
|
|
529
|
-
onLeave: cursor.onPointerLeave,
|
|
530
|
-
onKeyDown: cursor.onKeyDown,
|
|
531
|
-
onBlur: cursor.onBlur,
|
|
532
|
-
valueMax: Math.max(data.length - 1, 0),
|
|
533
|
-
...point !== null && {
|
|
534
|
-
valueNow: data.indexOf(point),
|
|
535
|
-
valueText: formatX(getX(point))
|
|
536
|
-
},
|
|
537
|
-
...ariaLabel !== void 0 && { ariaLabel }
|
|
521
|
+
...cursorSliderProps({ cursor, data, getX, formatX, ariaLabel })
|
|
538
522
|
}
|
|
539
523
|
)
|
|
540
524
|
] })
|
|
@@ -553,18 +537,7 @@ function CartesianPlot({
|
|
|
553
537
|
),
|
|
554
538
|
/* @__PURE__ */ jsxs(TooltipBody, { children: [
|
|
555
539
|
tooltipCfg?.prependRows?.(point, { visible, hidden }),
|
|
556
|
-
|
|
557
|
-
TooltipRow,
|
|
558
|
-
{
|
|
559
|
-
color: row.color,
|
|
560
|
-
label: row.label,
|
|
561
|
-
value: row.value,
|
|
562
|
-
shape: row.shape,
|
|
563
|
-
dashed: row.dashed,
|
|
564
|
-
...row.strokeWidth !== void 0 && { strokeWidth: row.strokeWidth }
|
|
565
|
-
},
|
|
566
|
-
row.key
|
|
567
|
-
)),
|
|
540
|
+
/* @__PURE__ */ jsx(TooltipRows, { rows }),
|
|
568
541
|
tooltipCfg?.extraRows?.(point, { visible, hidden })
|
|
569
542
|
] })
|
|
570
543
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartCard.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartCard.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAKhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAuFhD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEtD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GACtC,eAAe,CAAC,aAAa,CAAC,GAAG;IAC/B,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;8FAC0F;IAC1F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,i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AAmG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;8FAC0F;IAC1F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;kEAC8D;IAC9D,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+FAA+F;IAC/F,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,8FAA8F;IAC9F,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;sDACkD;IAClD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB;oGACgG;IAChG,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAEH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,KAAK,EACL,WAAW,EACX,aAAa,EACb,KAAK,EACL,OAAO,EACP,KAAK,EACL,iBAAuB,EACvB,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,EACL,QAAQ,GACT,EAAE,cAAc,+BAsFhB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo, useReducer, useState } from "react";
|
|
3
3
|
import { cx } from "../../common/props.js";
|
|
4
4
|
import { VX } from "../../tokens/index.js";
|
|
5
5
|
import { WidgetHeader } from "../../dashboard/widget-header.js";
|
|
6
6
|
import { useChartSize } from "../hooks/useChartSize.js";
|
|
7
7
|
import { useHysteresis } from "../hooks/use-hysteresis.js";
|
|
8
|
-
import { ChartCardContext } from "./chart-card-context.js";
|
|
8
|
+
import { ChartCardContext, legendSlotReducer } from "./chart-card-context.js";
|
|
9
9
|
import { ChartEmpty, ChartError, ChartPending, resolveChartState } from "./ChartPending.js";
|
|
10
10
|
const CARD_SHORT_HEIGHT = 280;
|
|
11
11
|
const SHORT_EXIT_SLACK = 24;
|
|
@@ -68,28 +68,10 @@ function ChartCard({
|
|
|
68
68
|
(wasShort) => measuredHeight > 0 && measuredHeight < (wasShort ? CARD_SHORT_HEIGHT + SHORT_EXIT_SLACK : CARD_SHORT_HEIGHT),
|
|
69
69
|
false
|
|
70
70
|
);
|
|
71
|
-
const
|
|
72
|
-
const [legendSlotVersion, setLegendSlotVersion] = useState(0);
|
|
73
|
-
const claimLegendSlot = useCallback((id) => {
|
|
74
|
-
if (legendOwnerRef.current === null) legendOwnerRef.current = id;
|
|
75
|
-
return legendOwnerRef.current === id;
|
|
76
|
-
}, []);
|
|
77
|
-
const releaseLegendSlot = useCallback((id) => {
|
|
78
|
-
if (legendOwnerRef.current === id) {
|
|
79
|
-
legendOwnerRef.current = null;
|
|
80
|
-
setLegendSlotVersion((v) => v + 1);
|
|
81
|
-
}
|
|
82
|
-
}, []);
|
|
71
|
+
const [legendClaimants, dispatchLegendSlot] = useReducer(legendSlotReducer, []);
|
|
83
72
|
const context = useMemo(
|
|
84
|
-
() => ({
|
|
85
|
-
|
|
86
|
-
inCard: true,
|
|
87
|
-
short,
|
|
88
|
-
claimLegendSlot,
|
|
89
|
-
releaseLegendSlot,
|
|
90
|
-
legendSlotVersion
|
|
91
|
-
}),
|
|
92
|
-
[legendSlot, short, claimLegendSlot, releaseLegendSlot, legendSlotVersion]
|
|
73
|
+
() => ({ legendSlot, inCard: true, short, legendClaimants, dispatchLegendSlot }),
|
|
74
|
+
[legendSlot, short, legendClaimants]
|
|
93
75
|
);
|
|
94
76
|
return /* @__PURE__ */ jsx(ChartCardContext.Provider, { value: context, children: /* @__PURE__ */ jsxs(
|
|
95
77
|
"div",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAYrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAIhF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAIjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD;qGACqG;AACrG,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3F,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAIjE;0EAC0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,wBAAwB;IACxB,SAAS,CAAC,EAAE,eAAe,CAAA;IAC3B;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC1C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAC1C,uGAAuG;IACvG,MAAM,EAAE,SAAS,WAAW,EAAE,CAAA;IAC9B;;;;;;;;;;;OAW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;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,MAAM,EACN,WAAW,EACX,IAAY,EACZ,QAA4B,EAC5B,OAAO,EACP,MAAW,EACX,SAAS,EACT,SAAiB,EACjB,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,eAAe,GAAG,SAAS,CA6Q7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useContext, useId, useLayoutEffect, useMemo,
|
|
2
|
+
import { useCallback, useContext, useId, useLayoutEffect, useMemo, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import {
|
|
5
5
|
deprecatedProp,
|
|
@@ -63,52 +63,35 @@ function ChartFrame({
|
|
|
63
63
|
inCard,
|
|
64
64
|
legendSlot,
|
|
65
65
|
short: cardShort,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
legendSlotVersion
|
|
66
|
+
legendClaimants,
|
|
67
|
+
dispatchLegendSlot
|
|
69
68
|
} = useContext(ChartCardContext);
|
|
70
69
|
const frameId = useId();
|
|
71
|
-
const [ownsSlot, setOwnsSlot] = useState(false);
|
|
72
70
|
const [slotSeedW, setSlotSeedW] = useState(0);
|
|
73
|
-
const ownsSlotRef = useRef(false);
|
|
74
71
|
const placement = legend === false ? "bottom" : legend.placement ?? "bottom";
|
|
75
72
|
const vertical = placement === "left" || placement === "right";
|
|
76
|
-
const wantsHeaderSlot = legend !== false && legend.headerSlot !== false && !vertical;
|
|
73
|
+
const wantsHeaderSlot = legendSlot !== null && legend !== false && legend.headerSlot !== false && !vertical;
|
|
77
74
|
const resolvedState = resolveChartState({ ...state !== void 0 && { state }, isPending });
|
|
78
75
|
const legendVisible = legend !== false && resolvedState === null;
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
const ownsSlot = wantsHeaderSlot && legendClaimants[0] === frameId;
|
|
77
|
+
const slotDenied = wantsHeaderSlot && !ownsSlot && legendClaimants.includes(frameId);
|
|
78
|
+
useLayoutEffect(() => {
|
|
79
|
+
if (!wantsHeaderSlot) return void 0;
|
|
80
|
+
dispatchLegendSlot({ type: "claim", id: frameId });
|
|
81
|
+
return () => dispatchLegendSlot({ type: "release", id: frameId });
|
|
82
|
+
}, [wantsHeaderSlot, frameId, dispatchLegendSlot]);
|
|
83
|
+
useLayoutEffect(() => {
|
|
84
|
+
if (slotDenied && legendVisible) reportOnce("ChartFrame", legendSlotContention("ChartFrame"));
|
|
85
|
+
}, [slotDenied, legendVisible]);
|
|
86
|
+
useLayoutEffect(() => {
|
|
87
|
+
if (!ownsSlot || legendSlot === null) return void 0;
|
|
89
88
|
setSlotSeedW(legendSlot.getBoundingClientRect().width);
|
|
90
89
|
slotRef(legendSlot);
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
const releaseIfOwned = useCallback(() => {
|
|
94
|
-
if (!ownsSlotRef.current) return;
|
|
95
|
-
ownsSlotRef.current = false;
|
|
96
|
-
releaseLegendSlot(frameId);
|
|
97
|
-
slotRef(null);
|
|
98
|
-
}, [releaseLegendSlot, frameId, slotRef]);
|
|
99
|
-
useLayoutEffect(() => {
|
|
100
|
-
if (legendSlot === null || !wantsHeaderSlot) {
|
|
101
|
-
setOwnsSlot(false);
|
|
90
|
+
return () => {
|
|
91
|
+
slotRef(null);
|
|
102
92
|
setSlotSeedW(0);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
tryClaim();
|
|
106
|
-
return releaseIfOwned;
|
|
107
|
-
}, [legendSlot, wantsHeaderSlot, tryClaim, releaseIfOwned]);
|
|
108
|
-
useLayoutEffect(() => {
|
|
109
|
-
if (ownsSlotRef.current) return;
|
|
110
|
-
tryClaim();
|
|
111
|
-
}, [legendSlotVersion]);
|
|
93
|
+
};
|
|
94
|
+
}, [ownsSlot, legendSlot, slotRef]);
|
|
112
95
|
const viewportClass = useSizeClass();
|
|
113
96
|
const sizeClass = useContext(SizeClassHintContext) === void 0 ? "medium" : viewportClass;
|
|
114
97
|
const coarse = useCoarsePointer();
|
|
@@ -148,13 +131,13 @@ function ChartFrame({
|
|
|
148
131
|
"legend.maxRows",
|
|
149
132
|
"nothing (the legend fits by measured width)",
|
|
150
133
|
"1.32.0",
|
|
151
|
-
|
|
134
|
+
`Its UNIT changed from rows to entries: \`maxRows: ${legend.maxRows}\` is now read as a cap of ${legend.maxRows} legend ENTRIES (not rows), with the rest folded into an \`All N\` disclosure. An explicit value still wins this release.`
|
|
152
135
|
) : null
|
|
153
136
|
),
|
|
154
137
|
[legend, legendItems.length]
|
|
155
138
|
);
|
|
156
139
|
const statedHeight = height === void 0 ? void 0 : resolveFrameHeight(height, resolveFrameClass({ frameW: containerW, sizeClass }));
|
|
157
|
-
const slotW =
|
|
140
|
+
const slotW = ownsSlot ? Math.max(slotMeasuredW, slotSeedW) : 0;
|
|
158
141
|
const groups = legend !== false && legend.groups === true;
|
|
159
142
|
const legendKey = legendItems.map((item) => `${item.key}\0${item.label}\0${item.role ?? ""}\0${item.note ?? ""}`).join("");
|
|
160
143
|
const layout = useMemo(
|
|
@@ -176,7 +159,7 @@ function ChartFrame({
|
|
|
176
159
|
const fit = layout.legend.mode === "dots" || layout.legend.mode === "chips" ? layout.legend : null;
|
|
177
160
|
const legendMode = fit?.mode;
|
|
178
161
|
const showLegend = legendVisible && fit !== null;
|
|
179
|
-
const inHeader = showLegend &&
|
|
162
|
+
const inHeader = showLegend && ownsSlot && fit?.where === "header";
|
|
180
163
|
const sideLegendWidth = showLegend && vertical ? legendW : 0;
|
|
181
164
|
const topBottomLegendHeight = showLegend && !vertical && !inHeader ? legendH : 0;
|
|
182
165
|
const computedHeight = aspectRatio !== void 0 ? Math.round(containerW / aspectRatio) : layout.height;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartLegend.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartLegend.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChartLegend.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartLegend.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAK5D,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,WAAW,CAAA;IAC9C,mFAAmF;IACnF,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,kGAAkG;IAClG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;0EACsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mFAAmF;IACnF,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB;iFAC6E;IAC7E,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;IACxB;gCAC4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAsOD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,WAAkB,EAClB,WAAW,EACX,MAAkB,EAClB,QAAQ,EACR,OAAY,EACZ,SAAoB,EACpB,MAAc,EACd,OAAO,EACP,IAAc,EACd,SAAS,EACT,KAAK,GACN,EAAE,WAAW,GAAG;IACf,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC1C,kCAAkC;IAClC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC5B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACxB,+BA2GA"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
2
|
import { alpha, VX } from "../../tokens/index.js";
|
|
5
|
-
import { useDismissOnOutside } from "../cursor/touch-pin.js";
|
|
6
3
|
import { DOTS_HIT_GAP, LEGEND_DOT_SIZE, LEGEND_ROW_GAP, orderEntries } from "./chart-frame-layout.js";
|
|
7
4
|
import { useChartMetrics, useCoarsePointer } from "./chart-tier.js";
|
|
5
|
+
import { LegendDisclosure, useLegendDisclosure } from "./legend-disclosure.js";
|
|
8
6
|
const LEGEND_ITEM_BASE = {
|
|
9
7
|
display: "flex",
|
|
10
8
|
alignItems: "center",
|
|
@@ -24,48 +22,6 @@ const LEGEND_ITEM_BUTTON = {
|
|
|
24
22
|
textAlign: "inherit"
|
|
25
23
|
};
|
|
26
24
|
const NO_HIDDEN = /* @__PURE__ */ new Set();
|
|
27
|
-
const DISCLOSURE_PANEL = {
|
|
28
|
-
position: "fixed",
|
|
29
|
-
zIndex: VX.zIndexFloating,
|
|
30
|
-
display: "flex",
|
|
31
|
-
flexDirection: "column",
|
|
32
|
-
gap: LEGEND_ROW_GAP,
|
|
33
|
-
// theme-allow raw-scroll-container — a fixed floating panel of one legend, not app chrome
|
|
34
|
-
overflowY: "auto",
|
|
35
|
-
// `<dialog open>` brings UA chrome (centring margin, border, fit-content box) this resets.
|
|
36
|
-
margin: 0,
|
|
37
|
-
border: "none",
|
|
38
|
-
width: "auto",
|
|
39
|
-
height: "auto",
|
|
40
|
-
padding: 10,
|
|
41
|
-
boxSizing: "border-box",
|
|
42
|
-
backgroundColor: VX.surface.overlay,
|
|
43
|
-
boxShadow: VX.shadowOverlay,
|
|
44
|
-
color: VX.muted,
|
|
45
|
-
borderRadius: VX.radiusCard
|
|
46
|
-
};
|
|
47
|
-
const DISCLOSURE_MIN_HEIGHT = 96;
|
|
48
|
-
function disclosurePlacement(chip, coarse) {
|
|
49
|
-
if (coarse) {
|
|
50
|
-
return {
|
|
51
|
-
left: 0,
|
|
52
|
-
right: 0,
|
|
53
|
-
bottom: 0,
|
|
54
|
-
maxHeight: "60dvh",
|
|
55
|
-
borderBottomLeftRadius: 0,
|
|
56
|
-
borderBottomRightRadius: 0,
|
|
57
|
-
padding: "12px 16px calc(12px + env(safe-area-inset-bottom, 0px))"
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
const below = window.innerHeight - chip.bottom;
|
|
61
|
-
const left = Math.max(8, Math.min(chip.left, window.innerWidth - 248));
|
|
62
|
-
const base = { left, right: "auto", minWidth: 200, maxWidth: "calc(100vw - 16px)" };
|
|
63
|
-
return below >= 200 || below >= chip.top ? { ...base, top: chip.bottom + 4, maxHeight: Math.max(below - 12, DISCLOSURE_MIN_HEIGHT) } : {
|
|
64
|
-
...base,
|
|
65
|
-
bottom: window.innerHeight - chip.top + 4,
|
|
66
|
-
maxHeight: Math.max(chip.top - 12, DISCLOSURE_MIN_HEIGHT)
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
25
|
function wrapperStyle(placement, fontSize, dots) {
|
|
70
26
|
const vertical = placement === "left" || placement === "right";
|
|
71
27
|
const gap = dots ? DOTS_HIT_GAP : VX.legendGap;
|
|
@@ -252,55 +208,7 @@ function ChartLegend({
|
|
|
252
208
|
}) {
|
|
253
209
|
const tier = useChartMetrics();
|
|
254
210
|
const coarse = useCoarsePointer();
|
|
255
|
-
const
|
|
256
|
-
const triggerRef = useRef(null);
|
|
257
|
-
const panelRef = useRef(null);
|
|
258
|
-
const open = disclosure !== null;
|
|
259
|
-
const panelId = useId();
|
|
260
|
-
const wasOpen = useRef(false);
|
|
261
|
-
const openDisclosure = (trigger) => {
|
|
262
|
-
triggerRef.current = trigger;
|
|
263
|
-
setDisclosure(disclosurePlacement(trigger.getBoundingClientRect(), coarse));
|
|
264
|
-
};
|
|
265
|
-
useEffect(() => {
|
|
266
|
-
if (open) panelRef.current?.focus();
|
|
267
|
-
else if (wasOpen.current) triggerRef.current?.focus();
|
|
268
|
-
wasOpen.current = open;
|
|
269
|
-
}, [open]);
|
|
270
|
-
const isInsidePanel = useCallback(
|
|
271
|
-
(target) => panelRef.current?.contains(target) === true || triggerRef.current?.contains(target) === true,
|
|
272
|
-
[]
|
|
273
|
-
);
|
|
274
|
-
useDismissOnOutside({
|
|
275
|
-
enabled: open,
|
|
276
|
-
isInside: isInsidePanel,
|
|
277
|
-
onDismiss: () => setDisclosure(null),
|
|
278
|
-
dismissOnResize: true,
|
|
279
|
-
scrollExemptInside: true
|
|
280
|
-
});
|
|
281
|
-
useEffect(() => {
|
|
282
|
-
if (!open || !coarse) return;
|
|
283
|
-
const panel = panelRef.current;
|
|
284
|
-
if (panel === null) return;
|
|
285
|
-
const onKeyDown = (e) => {
|
|
286
|
-
if (e.key !== "Tab") return;
|
|
287
|
-
const focusable = panel.querySelectorAll(
|
|
288
|
-
'button, [tabindex]:not([tabindex="-1"])'
|
|
289
|
-
);
|
|
290
|
-
const first = focusable[0];
|
|
291
|
-
const last = focusable[focusable.length - 1];
|
|
292
|
-
if (first === void 0 || last === void 0) return;
|
|
293
|
-
if (e.shiftKey && document.activeElement === first) {
|
|
294
|
-
e.preventDefault();
|
|
295
|
-
last.focus();
|
|
296
|
-
} else if (!e.shiftKey && document.activeElement === last) {
|
|
297
|
-
e.preventDefault();
|
|
298
|
-
first.focus();
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
panel.addEventListener("keydown", onKeyDown);
|
|
302
|
-
return () => panel.removeEventListener("keydown", onKeyDown);
|
|
303
|
-
}, [open, coarse]);
|
|
211
|
+
const { open, panelId, openFrom, close, panel } = useLegendDisclosure(coarse);
|
|
304
212
|
const handleEnter = (key) => onHighlight?.(key);
|
|
305
213
|
const handleLeave = () => onHighlight?.(null);
|
|
306
214
|
const idPrefix = chartId ? `${chartId}-` : "";
|
|
@@ -327,7 +235,7 @@ function ChartLegend({
|
|
|
327
235
|
opacity: hidden.has(item.key) ? 0.35 : highlighted === null || highlighted === item.key ? 1 : 0.3,
|
|
328
236
|
textDecoration: hidden.has(item.key) ? "line-through" : "none"
|
|
329
237
|
},
|
|
330
|
-
...isDotTrigger ? { onClick: (e) =>
|
|
238
|
+
...isDotTrigger ? { onClick: (e) => openFrom(e.currentTarget) } : onToggle !== void 0 && { onClick: () => onToggle(item.key) },
|
|
331
239
|
onMouseEnter: () => handleEnter(item.key),
|
|
332
240
|
onMouseLeave: handleLeave,
|
|
333
241
|
onFocus: () => handleEnter(item.key),
|
|
@@ -358,7 +266,7 @@ function ChartLegend({
|
|
|
358
266
|
"aria-expanded": open,
|
|
359
267
|
"aria-haspopup": "dialog",
|
|
360
268
|
"aria-controls": panelId,
|
|
361
|
-
onClick: (e) => open ?
|
|
269
|
+
onClick: (e) => open ? close() : openFrom(e.currentTarget),
|
|
362
270
|
style: { ...LEGEND_ITEM_BUTTON, cursor: "pointer", textDecoration: "underline" },
|
|
363
271
|
children: `All ${entries.length}`
|
|
364
272
|
},
|
|
@@ -373,43 +281,7 @@ function ChartLegend({
|
|
|
373
281
|
style: { ...wrapperStyle(placement, tier.legendFontSize, mode === "dots"), ...style },
|
|
374
282
|
children: [
|
|
375
283
|
nodes,
|
|
376
|
-
|
|
377
|
-
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
378
|
-
coarse && /* @__PURE__ */ jsx(
|
|
379
|
-
"div",
|
|
380
|
-
{
|
|
381
|
-
"aria-hidden": true,
|
|
382
|
-
onPointerDown: (e) => {
|
|
383
|
-
e.stopPropagation();
|
|
384
|
-
setDisclosure(null);
|
|
385
|
-
},
|
|
386
|
-
style: {
|
|
387
|
-
position: "fixed",
|
|
388
|
-
inset: 0,
|
|
389
|
-
// One below the panel it sits behind — still `VX.zIndexFloating`-derived, never a
|
|
390
|
-
// second unrelated literal (B14).
|
|
391
|
-
zIndex: VX.zIndexFloating - 1,
|
|
392
|
-
backgroundColor: alpha(VX.neutral, 0.35)
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
),
|
|
396
|
-
/* @__PURE__ */ jsx(
|
|
397
|
-
"dialog",
|
|
398
|
-
{
|
|
399
|
-
ref: panelRef,
|
|
400
|
-
id: panelId,
|
|
401
|
-
open: true,
|
|
402
|
-
tabIndex: -1,
|
|
403
|
-
"aria-label": "Legend",
|
|
404
|
-
...coarse && { "aria-modal": true },
|
|
405
|
-
"data-basalt-legend-disclosure": coarse ? "sheet" : "popover",
|
|
406
|
-
style: { ...DISCLOSURE_PANEL, fontSize: tier.legendFontSize, ...disclosure },
|
|
407
|
-
children: entries.map((item) => entryButton(item, true))
|
|
408
|
-
}
|
|
409
|
-
)
|
|
410
|
-
] }),
|
|
411
|
-
document.body
|
|
412
|
-
)
|
|
284
|
+
/* @__PURE__ */ jsx(LegendDisclosure, { ...panel, fontSize: tier.legendFontSize, children: entries.map((item) => entryButton(item, true)) })
|
|
413
285
|
]
|
|
414
286
|
}
|
|
415
287
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import type { TooltipRowData } from '../series.js';
|
|
2
3
|
/** Tooltip header — shows formatted date + optional right-aligned label with color. */
|
|
3
4
|
export declare function TooltipHeader({ date, label, labelColor, format, }: {
|
|
4
5
|
date: string;
|
|
@@ -21,6 +22,10 @@ export declare function TooltipRow({ color, label, value, valueColor, shape, str
|
|
|
21
22
|
/** Render the line swatch as dashed (only applies to shape='line'). */
|
|
22
23
|
dashed?: boolean;
|
|
23
24
|
}): import("react").JSX.Element;
|
|
25
|
+
/** The derived rows (`deriveTooltipRows`), one {@link TooltipRow} each. */
|
|
26
|
+
export declare function TooltipRows({ rows }: {
|
|
27
|
+
rows: readonly TooltipRowData[];
|
|
28
|
+
}): import("react").JSX.Element[];
|
|
24
29
|
export declare function TooltipBody({ children }: {
|
|
25
30
|
children: ReactNode;
|
|
26
31
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartTooltip.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ChartTooltip.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAoB/C,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,UAAU,EACV,MAAuB,GACxB,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;sGAGkG;IAClG,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CAClC,+BAoCA;AAED,4CAA4C;AAC5C,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,MAAM,GACP,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uEAAuE;IACvE,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,+BA0CA;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,iCAYxE;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAEhE;AAsBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,QAAe,EACf,QAAQ,GACT,EAAE;IACD,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACvC;;;8CAG0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;CACpB,sCA2DA"}
|
|
@@ -114,6 +114,20 @@ function TooltipRow({
|
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
|
+
function TooltipRows({ rows }) {
|
|
118
|
+
return rows.map((row) => /* @__PURE__ */ jsx(
|
|
119
|
+
TooltipRow,
|
|
120
|
+
{
|
|
121
|
+
color: row.color,
|
|
122
|
+
label: row.label,
|
|
123
|
+
value: row.value,
|
|
124
|
+
shape: row.shape,
|
|
125
|
+
dashed: row.dashed,
|
|
126
|
+
...row.strokeWidth !== void 0 && { strokeWidth: row.strokeWidth }
|
|
127
|
+
},
|
|
128
|
+
row.key
|
|
129
|
+
));
|
|
130
|
+
}
|
|
117
131
|
function TooltipBody({ children }) {
|
|
118
132
|
return /* @__PURE__ */ jsx("div", { style: { padding: "5px 0" }, children });
|
|
119
133
|
}
|
|
@@ -178,5 +192,6 @@ export {
|
|
|
178
192
|
ChartTooltipFloat,
|
|
179
193
|
TooltipBody,
|
|
180
194
|
TooltipHeader,
|
|
181
|
-
TooltipRow
|
|
195
|
+
TooltipRow,
|
|
196
|
+
TooltipRows
|
|
182
197
|
};
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import type { FocusEventHandler, KeyboardEventHandler, PointerEventHandler } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* With `onKeyDown` it also becomes the chart's keyboard affordance: the rect takes focus and
|
|
7
|
-
* ←/→ scrub the cursor, so a chart's values are reachable without a pointer.
|
|
8
|
-
*/
|
|
9
|
-
export declare function HoverOverlay({ width, height, onMove, onDown, onUp, onLeave, onKeyDown, onBlur, ariaLabel, valueNow, valueMax, valueText, }: {
|
|
2
|
+
import type { ChartCursor } from '../hooks/useChartCursor.js';
|
|
3
|
+
/** Props of {@link HoverOverlay}. */
|
|
4
|
+
export type HoverOverlayProps = {
|
|
10
5
|
width: number;
|
|
11
6
|
height: number;
|
|
12
7
|
onMove: PointerEventHandler<SVGRectElement>;
|
|
@@ -26,5 +21,25 @@ export declare function HoverOverlay({ width, height, onMove, onDown, onUp, onLe
|
|
|
26
21
|
valueMax?: number;
|
|
27
22
|
/** Human-readable label for the focused point (the formatted x key). */
|
|
28
23
|
valueText?: string;
|
|
29
|
-
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Transparent <rect> that captures pointer events (mouse + touch + pen) for tooltip + crosshair
|
|
27
|
+
* sync.
|
|
28
|
+
*
|
|
29
|
+
* With `onKeyDown` it also becomes the chart's keyboard affordance: the rect takes focus and
|
|
30
|
+
* ←/→ scrub the cursor, so a chart's values are reachable without a pointer.
|
|
31
|
+
*/
|
|
32
|
+
export declare function HoverOverlay({ width, height, onMove, onDown, onUp, onLeave, onKeyDown, onBlur, ariaLabel, valueNow, valueMax, valueText, }: HoverOverlayProps): import("react").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Everything a FOCUSABLE overlay over indexed data takes besides its rect: the cursor's pointer and
|
|
35
|
+
* keyboard handlers plus the slider label/position. `CartesianChart`, `DualPanel`'s top pane and
|
|
36
|
+
* the banded kinds all wire it identically, so it is stated once.
|
|
37
|
+
*/
|
|
38
|
+
export declare function cursorSliderProps<T>(input: {
|
|
39
|
+
cursor: ChartCursor<T>;
|
|
40
|
+
data: readonly T[];
|
|
41
|
+
getX: (d: T) => string;
|
|
42
|
+
formatX: (key: string) => string;
|
|
43
|
+
ariaLabel: string | undefined;
|
|
44
|
+
}): Omit<HoverOverlayProps, 'width' | 'height'>;
|
|
30
45
|
//# sourceMappingURL=HoverOverlay.d.ts.map
|