@galaxy-io/dls 1.4.10 → 1.4.12
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/dist/accordion/Accordion.d.ts +19 -2
- package/dist/accordion/Accordion.js +8 -0
- package/dist/avatar/Avatar.d.ts +9 -0
- package/dist/avatar/Avatar.js +4 -0
- package/dist/avatar/AvatarShimmer.d.ts +2 -0
- package/dist/avatar/AvatarShimmer.js +1 -0
- package/dist/backgrounds/CellGridBackground.d.ts +12 -1
- package/dist/backgrounds/CellGridBackground.js +5 -0
- package/dist/backgrounds/CrossGridBackground.d.ts +13 -1
- package/dist/backgrounds/CrossGridBackground.js +4 -0
- package/dist/backgrounds/DotGridBackground.d.ts +12 -1
- package/dist/backgrounds/DotGridBackground.js +4 -0
- package/dist/badge/Badge.d.ts +12 -0
- package/dist/badge/Badge.js +7 -0
- package/dist/beacons/Beacon.d.ts +7 -13
- package/dist/beacons/Beacon.js +3 -0
- package/dist/buttons/Button.d.ts +18 -0
- package/dist/buttons/Button.js +10 -1
- package/dist/charts/BarChart.d.ts +4 -1
- package/dist/charts/BarChart.js +17 -8
- package/dist/charts/ChartCategoryTargets.d.ts +5 -12
- package/dist/charts/ChartCategoryTargets.js +1 -2
- package/dist/charts/ChartFrame.d.ts +3 -4
- package/dist/charts/ChartFrame.js +10 -25
- package/dist/charts/ChartLegend.js +26 -23
- package/dist/charts/ChartPrimitives.d.ts +38 -17
- package/dist/charts/ChartPrimitives.js +74 -73
- package/dist/charts/DashboardProvider.d.ts +57 -0
- package/dist/charts/DashboardProvider.js +30 -0
- package/dist/charts/LineChart.js +2 -1
- package/dist/charts/PieChart.js +1 -1
- package/dist/charts/ProgressBar.d.ts +13 -1
- package/dist/charts/ProgressBar.js +7 -0
- package/dist/charts/StatChart.d.ts +10 -1
- package/dist/charts/StatChart.js +5 -0
- package/dist/charts/constants.d.ts +20 -24
- package/dist/charts/constants.js +21 -25
- package/dist/charts/types.d.ts +10 -2
- package/dist/charts/types.js +9 -1
- package/dist/charts/useChartInteraction.d.ts +37 -10
- package/dist/charts/useChartInteraction.js +72 -12
- package/dist/chips/Chip.d.ts +20 -1
- package/dist/chips/Chip.js +9 -1
- package/dist/containers/FlexItem.d.ts +14 -12
- package/dist/containers/FlexItem.js +4 -0
- package/dist/containers/FlexWrapper.d.ts +29 -96
- package/dist/containers/FlexWrapper.js +12 -0
- package/dist/containers/GridWrapper.d.ts +25 -66
- package/dist/containers/GridWrapper.js +8 -0
- package/dist/containers/Spacing.d.ts +10 -0
- package/dist/containers/Spacing.js +7 -0
- package/dist/containers/Wrapper.d.ts +11 -1
- package/dist/containers/Wrapper.js +4 -0
- package/dist/dividers/HorizontalDivider.d.ts +2 -0
- package/dist/dividers/HorizontalDivider.js +1 -0
- package/dist/dividers/VerticalDivider.d.ts +4 -0
- package/dist/dividers/VerticalDivider.js +4 -0
- package/dist/drawer/Drawer.d.ts +11 -4
- package/dist/drawer/Drawer.js +7 -0
- package/dist/dropdown/Dropdown.d.ts +24 -0
- package/dist/dropdown/Dropdown.js +9 -0
- package/dist/editor/CodeEditor.d.ts +23 -42
- package/dist/editor/CodeEditor.js +9 -1
- package/dist/hooks/useDismiss.d.ts +6 -0
- package/dist/hooks/useDismiss.js +6 -0
- package/dist/hooks/useElementClientSize.d.ts +2 -2
- package/dist/hooks/useResize.d.ts +5 -2
- package/dist/icons/GalaxyLogomark.d.ts +9 -1
- package/dist/icons/GalaxyLogomark.js +7 -1
- package/dist/icons/GalaxyLogomark3D.d.ts +15 -0
- package/dist/icons/GalaxyLogomark3D.js +9 -0
- package/dist/icons/GalaxyLogomarkAnimation.d.ts +10 -0
- package/dist/icons/GalaxyLogomarkAnimation.js +7 -1
- package/dist/icons/GalaxyWordmark.d.ts +7 -1
- package/dist/icons/GalaxyWordmark.js +5 -1
- package/dist/icons/Icon.d.ts +10 -0
- package/dist/icons/Icon.js +5 -0
- package/dist/inputs/CheckboxInput.d.ts +13 -0
- package/dist/inputs/CheckboxInput.js +8 -0
- package/dist/inputs/ColorInput.d.ts +15 -0
- package/dist/inputs/ColorInput.js +6 -0
- package/dist/inputs/CopyInput.d.ts +9 -0
- package/dist/inputs/CopyInput.js +4 -0
- package/dist/inputs/DateInput.d.ts +13 -0
- package/dist/inputs/DateInput.js +5 -0
- package/dist/inputs/Input.d.ts +37 -0
- package/dist/inputs/Input.js +13 -0
- package/dist/inputs/MultiSelectInput.d.ts +26 -0
- package/dist/inputs/MultiSelectInput.js +6 -0
- package/dist/inputs/MultiTextInput.d.ts +16 -0
- package/dist/inputs/MultiTextInput.js +9 -0
- package/dist/inputs/NumberInput.d.ts +7 -1
- package/dist/inputs/NumberInput.js +5 -0
- package/dist/inputs/PasswordInput.d.ts +9 -1
- package/dist/inputs/PasswordInput.js +4 -0
- package/dist/inputs/RadioInput.d.ts +13 -0
- package/dist/inputs/RadioInput.js +8 -0
- package/dist/inputs/SelectInput.d.ts +30 -0
- package/dist/inputs/SelectInput.js +8 -0
- package/dist/inputs/SliderInput.d.ts +15 -0
- package/dist/inputs/SliderInput.js +6 -0
- package/dist/inputs/SwitcherInput.d.ts +10 -1
- package/dist/inputs/SwitcherInput.js +4 -0
- package/dist/inputs/TextAreaInput.d.ts +24 -0
- package/dist/inputs/TextAreaInput.js +9 -0
- package/dist/inputs/TextInput.d.ts +8 -1
- package/dist/inputs/TextInput.js +6 -0
- package/dist/inputs/ToggleInput.d.ts +11 -0
- package/dist/inputs/ToggleInput.js +6 -0
- package/dist/lists/BulletedList.d.ts +4 -0
- package/dist/lists/BulletedList.js +2 -0
- package/dist/modal/Modal.d.ts +8 -0
- package/dist/modal/Modal.js +6 -0
- package/dist/overlay/OverlayProvider.d.ts +11 -0
- package/dist/overlay/OverlayProvider.js +7 -0
- package/dist/overlay/constants.d.ts +1 -0
- package/dist/overlay/constants.js +1 -0
- package/dist/overlay/useOverlay.d.ts +11 -0
- package/dist/overlay/useOverlay.js +9 -0
- package/dist/resizable/HorizontalResizeHandle.d.ts +8 -1
- package/dist/resizable/HorizontalResizeHandle.js +6 -0
- package/dist/resizable/VerticalResizeHandle.d.ts +8 -1
- package/dist/resizable/VerticalResizeHandle.js +6 -0
- package/dist/shapes/Circle.d.ts +4 -1
- package/dist/shapes/Circle.js +1 -0
- package/dist/shapes/Square.d.ts +4 -1
- package/dist/shapes/Square.js +1 -0
- package/dist/styles.css +14 -14
- package/dist/table/InfiniteSpreadsheet.d.ts +7 -0
- package/dist/table/InfiniteSpreadsheet.js +7 -0
- package/dist/table/InfiniteTable.d.ts +8 -0
- package/dist/table/InfiniteTable.js +8 -0
- package/dist/table/VirtualizedInfiniteTable.d.ts +7 -0
- package/dist/table/VirtualizedInfiniteTable.js +7 -0
- package/dist/text/Bold.d.ts +4 -0
- package/dist/text/Bold.js +4 -0
- package/dist/text/Code.d.ts +4 -0
- package/dist/text/Code.js +4 -0
- package/dist/text/EditableText.d.ts +10 -1
- package/dist/text/EditableText.js +7 -0
- package/dist/text/Ellipsis.d.ts +6 -4
- package/dist/text/Ellipsis.js +4 -0
- package/dist/text/HotKeys.d.ts +10 -0
- package/dist/text/HotKeys.js +6 -0
- package/dist/text/MarkdownText.d.ts +9 -1
- package/dist/text/MarkdownText.js +6 -0
- package/dist/text/Paragraph.d.ts +17 -0
- package/dist/text/Paragraph.js +7 -0
- package/dist/text/RequiredMarker.d.ts +3 -1
- package/dist/text/RequiredMarker.js +1 -0
- package/dist/text/Selectable.d.ts +4 -0
- package/dist/text/Selectable.js +4 -0
- package/dist/text/Text.d.ts +19 -0
- package/dist/text/Text.js +10 -0
- package/dist/text/TextShimmer.d.ts +7 -0
- package/dist/text/TextShimmer.js +4 -0
- package/dist/theme/GalaxyTheme.d.ts +35 -4
- package/dist/theme/GalaxyTheme.js +13 -1
- package/dist/theme/constants.d.ts +1 -6
- package/dist/theme/constants.js +10 -15
- package/dist/theme/index.js +2 -1
- package/dist/theme/types.d.ts +21 -0
- package/dist/theme/types.js +10 -0
- package/dist/toast/Toast.d.ts +11 -0
- package/dist/toast/Toast.js +5 -0
- package/dist/toast/ToastProvider.d.ts +9 -0
- package/dist/toast/ToastProvider.js +4 -0
- package/dist/toast/useToast.d.ts +7 -0
- package/dist/toast/useToast.js +7 -0
- package/dist/tooltip/Tooltip.d.ts +19 -1
- package/dist/tooltip/Tooltip.js +9 -0
- package/dist/transform/Fade.d.ts +7 -0
- package/dist/transform/Fade.js +6 -0
- package/dist/transform/Flash.d.ts +4 -0
- package/dist/transform/Flash.js +4 -0
- package/dist/transform/Rotate.d.ts +7 -0
- package/dist/transform/Rotate.js +4 -0
- package/dist/transform/ScaleFade.d.ts +7 -0
- package/dist/transform/ScaleFade.js +6 -0
- package/dist/transform/Spin.d.ts +7 -0
- package/dist/transform/Spin.js +5 -0
- package/dist/widget/Widget.d.ts +18 -1
- package/dist/widget/Widget.js +5 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartKind, ChartLegendPlacement } from "./types.js";
|
|
2
2
|
import "./constants.js";
|
|
3
|
-
import { ChartPlotBox,
|
|
3
|
+
import { ChartPlotBox, ChartRoot, ChartSvg } from "./ChartPrimitives.js";
|
|
4
4
|
import ChartCategoryTargets from "./ChartCategoryTargets.js";
|
|
5
5
|
import ChartEmptyState from "./ChartEmptyState.js";
|
|
6
6
|
import ChartLegend from "./ChartLegend.js";
|
|
@@ -23,10 +23,15 @@ var ChartFrame = ({ containerRef, dimensions, fillWidth, fillHeight, interaction
|
|
|
23
23
|
* same situation, which is the drift this removes.
|
|
24
24
|
*/
|
|
25
25
|
const resolvedAriaLabel = ariaLabel ?? match(kind).with(ChartKind.PIE, () => `Pie chart with ${categoryCount} slices`).with(ChartKind.BAR, () => `Bar chart with ${categoryCount} categories and ${legendItems.length} series`).with(ChartKind.LINE, () => `Line chart with ${categoryCount} categories and ${legendItems.length} series`).exhaustive();
|
|
26
|
-
const tooltipModel = useMemo(() =>
|
|
26
|
+
const tooltipModel = useMemo(() => {
|
|
27
|
+
if (noTooltip || !interaction.showTooltip || interaction.activeIndex === null) return null;
|
|
28
|
+
const model = buildCategoryTooltip(interaction.activeIndex);
|
|
29
|
+
return model === null || model.rows.length === 0 ? null : model;
|
|
30
|
+
}, [
|
|
27
31
|
noTooltip,
|
|
28
32
|
buildCategoryTooltip,
|
|
29
|
-
interaction.activeIndex
|
|
33
|
+
interaction.activeIndex,
|
|
34
|
+
interaction.showTooltip
|
|
30
35
|
]);
|
|
31
36
|
/**
|
|
32
37
|
* Plot space → container space, applied once, here.
|
|
@@ -47,22 +52,6 @@ var ChartFrame = ({ containerRef, dimensions, fillWidth, fillHeight, interaction
|
|
|
47
52
|
margin.left,
|
|
48
53
|
margin.top
|
|
49
54
|
]);
|
|
50
|
-
/**
|
|
51
|
-
* Categories whose tooltip would have no rows.
|
|
52
|
-
*
|
|
53
|
-
* Decided here — from the same builder that feeds the visible tooltip — so
|
|
54
|
-
* "no data at this X" means exactly one thing in every chart: an all-zero
|
|
55
|
-
* bar group and an all-null line column both produce a rowless model, and
|
|
56
|
-
* neither should be hoverable. Their targets are simply not rendered.
|
|
57
|
-
*/
|
|
58
|
-
const inertIndices = useMemo(() => {
|
|
59
|
-
const inert = /* @__PURE__ */ new Set();
|
|
60
|
-
(categoryTargets ?? []).forEach((_, index) => {
|
|
61
|
-
const model = buildCategoryTooltip(index);
|
|
62
|
-
if (!model || model.rows.length === 0) inert.add(index);
|
|
63
|
-
});
|
|
64
|
-
return inert;
|
|
65
|
-
}, [categoryTargets, buildCategoryTooltip]);
|
|
66
55
|
const hasTargets = isMeasured && !noTooltip && !isLoading && !isEmpty && (categoryTargets?.length ?? 0) > 0;
|
|
67
56
|
const legendRight = legendPlacement === ChartLegendPlacement.RIGHT;
|
|
68
57
|
return /* @__PURE__ */ jsxs(ChartRoot, {
|
|
@@ -90,16 +79,12 @@ var ChartFrame = ({ containerRef, dimensions, fillWidth, fillHeight, interaction
|
|
|
90
79
|
transform: `translate(${margin.left}, ${margin.top})`,
|
|
91
80
|
children: [
|
|
92
81
|
axes,
|
|
93
|
-
/* @__PURE__ */ jsx(
|
|
94
|
-
"data-active": interaction.isEngaged ? "true" : "false",
|
|
95
|
-
children
|
|
96
|
-
}),
|
|
82
|
+
/* @__PURE__ */ jsx("g", { children }),
|
|
97
83
|
hasTargets && categoryTargets && /* @__PURE__ */ jsx("g", {
|
|
98
84
|
transform: categoryTargetsTransform,
|
|
99
85
|
children: /* @__PURE__ */ jsx(ChartCategoryTargets, {
|
|
100
86
|
targets: categoryTargets,
|
|
101
|
-
interaction
|
|
102
|
-
inertIndices
|
|
87
|
+
interaction
|
|
103
88
|
})
|
|
104
89
|
})
|
|
105
90
|
]
|
|
@@ -2,7 +2,6 @@ import Text, { TextSize, TextVariant } from "../text/Text.js";
|
|
|
2
2
|
import Tooltip, { TooltipPosition, TooltipVariant } from "../tooltip/Tooltip.js";
|
|
3
3
|
import Circle from "../shapes/Circle.js";
|
|
4
4
|
import { ChartMarkState } from "./types.js";
|
|
5
|
-
import "./constants.js";
|
|
6
5
|
import { ChartLegendItemButton, ChartLegendItemStatic, ChartLegendMeasure, ChartLegendOverflowList, ChartLegendRow } from "./ChartPrimitives.js";
|
|
7
6
|
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
8
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -38,14 +37,13 @@ var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, vertical
|
|
|
38
37
|
const rendered = Array.from(measure.children);
|
|
39
38
|
const trigger = rendered.pop();
|
|
40
39
|
if (!trigger) return;
|
|
41
|
-
const gap = vertical ? 8 : 16;
|
|
42
40
|
const available = vertical ? verticalExtent || Number.POSITIVE_INFINITY : row.clientWidth - inset;
|
|
43
41
|
const sizeOf = (el) => {
|
|
44
42
|
const rect = el.getBoundingClientRect();
|
|
45
43
|
return Math.ceil(vertical ? rect.height : rect.width);
|
|
46
44
|
};
|
|
47
45
|
const sizes = rendered.map(sizeOf);
|
|
48
|
-
if (sizes.reduce((sum, size
|
|
46
|
+
if (sizes.reduce((sum, size) => sum + size, 0) <= available) {
|
|
49
47
|
setFitCount(sizes.length);
|
|
50
48
|
return;
|
|
51
49
|
}
|
|
@@ -53,8 +51,8 @@ var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, vertical
|
|
|
53
51
|
let used = 0;
|
|
54
52
|
let count = 0;
|
|
55
53
|
for (const [i, size] of sizes.entries()) {
|
|
56
|
-
used += size
|
|
57
|
-
if (used +
|
|
54
|
+
used += size;
|
|
55
|
+
if (used + triggerSize > available) break;
|
|
58
56
|
count = i + 1;
|
|
59
57
|
}
|
|
60
58
|
setFitCount(Math.max(1, count));
|
|
@@ -80,7 +78,7 @@ var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, vertical
|
|
|
80
78
|
if (items.length === 0) return null;
|
|
81
79
|
const isInteractive = Boolean(onItemEnter);
|
|
82
80
|
const activeKey = hoveredKey;
|
|
83
|
-
const renderItem = (item) => {
|
|
81
|
+
const renderItem = (item, verticalPadding) => {
|
|
84
82
|
const state = activeKey === null || item.key === activeKey ? ChartMarkState.ACTIVE : ChartMarkState.MUTED;
|
|
85
83
|
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Circle, {
|
|
86
84
|
size: 8,
|
|
@@ -90,11 +88,13 @@ var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, vertical
|
|
|
90
88
|
children: item.label
|
|
91
89
|
})] });
|
|
92
90
|
if (!isInteractive) return /* @__PURE__ */ jsx(ChartLegendItemStatic, {
|
|
91
|
+
$vertical: verticalPadding,
|
|
93
92
|
"data-state": state,
|
|
94
93
|
children: content
|
|
95
94
|
}, item.key);
|
|
96
95
|
return /* @__PURE__ */ jsx(ChartLegendItemButton, {
|
|
97
96
|
type: "button",
|
|
97
|
+
$vertical: verticalPadding,
|
|
98
98
|
"data-state": state,
|
|
99
99
|
onMouseEnter: () => onItemEnter?.(item.key),
|
|
100
100
|
onMouseLeave: () => onItemLeave?.(),
|
|
@@ -119,35 +119,38 @@ var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, vertical
|
|
|
119
119
|
$inset: inset,
|
|
120
120
|
$vertical: vertical,
|
|
121
121
|
$extent: verticalExtent,
|
|
122
|
-
"data-active": activeKey !== null ? "true" : "false",
|
|
123
122
|
children: [
|
|
124
123
|
/* @__PURE__ */ jsxs(ChartLegendMeasure, {
|
|
125
124
|
ref: measureRef,
|
|
126
125
|
$vertical: vertical,
|
|
127
126
|
"aria-hidden": "true",
|
|
128
|
-
children: [items.map((item) => /* @__PURE__ */ jsxs(ChartLegendItemStatic, {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
127
|
+
children: [items.map((item) => /* @__PURE__ */ jsxs(ChartLegendItemStatic, {
|
|
128
|
+
$vertical: vertical,
|
|
129
|
+
children: [/* @__PURE__ */ jsx(Circle, {
|
|
130
|
+
size: 8,
|
|
131
|
+
hex: item.color
|
|
132
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
133
|
+
size: TextSize.BODY_SM,
|
|
134
|
+
children: item.label
|
|
135
|
+
})]
|
|
136
|
+
}, item.key)), /* @__PURE__ */ jsx(ChartLegendItemStatic, {
|
|
137
|
+
$vertical: vertical,
|
|
138
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
139
|
+
size: TextSize.BODY_SM,
|
|
140
|
+
variant: TextVariant.SECONDARY,
|
|
141
|
+
children: `+${items.length - 1} more`
|
|
142
|
+
})
|
|
143
|
+
})]
|
|
139
144
|
}),
|
|
140
|
-
inlineItems.map(renderItem),
|
|
145
|
+
inlineItems.map((item) => renderItem(item, vertical)),
|
|
141
146
|
overflowItems.length > 0 && /* @__PURE__ */ jsx(Tooltip, {
|
|
142
147
|
isInteractive: true,
|
|
143
148
|
position: vertical ? TooltipPosition.RIGHT : TooltipPosition.TOP,
|
|
144
149
|
variant: TooltipVariant.TERTIARY,
|
|
145
|
-
body: /* @__PURE__ */ jsx(ChartLegendOverflowList, {
|
|
146
|
-
"data-active": activeKey !== null ? "true" : "false",
|
|
147
|
-
children: overflowItems.map(renderItem)
|
|
148
|
-
}),
|
|
150
|
+
body: /* @__PURE__ */ jsx(ChartLegendOverflowList, { children: overflowItems.map((item) => renderItem(item, true)) }),
|
|
149
151
|
children: /* @__PURE__ */ jsx(ChartLegendItemButton, {
|
|
150
152
|
type: "button",
|
|
153
|
+
$vertical: vertical,
|
|
151
154
|
"data-state": triggerState,
|
|
152
155
|
children: /* @__PURE__ */ jsx(Text, {
|
|
153
156
|
size: TextSize.BODY_SM,
|
|
@@ -45,11 +45,6 @@ export declare const ChartPlotBox: import("@linaria/react").StyledComponent<impo
|
|
|
45
45
|
* the plot rather than being clipped by the root SVG.
|
|
46
46
|
*/
|
|
47
47
|
export declare const ChartSvg: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGSVGElement> & Record<never, unknown>>;
|
|
48
|
-
/**
|
|
49
|
-
* Cancels the restore delay for every mark beneath it while a category is
|
|
50
|
-
* engaged. See {@link markState}.
|
|
51
|
-
*/
|
|
52
|
-
export declare const ChartPlotGroup: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGGElement> & Record<never, unknown>>;
|
|
53
48
|
export declare const ChartBarPath: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGPathElement> & Record<never, unknown>>;
|
|
54
49
|
export declare const ChartLinePath: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGPathElement> & Record<never, unknown>>;
|
|
55
50
|
export declare const ChartAreaPath: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGPathElement> & Record<never, unknown>>;
|
|
@@ -116,6 +111,29 @@ export declare const ChartCursorLine: import("react").ComponentType<Pick<import(
|
|
|
116
111
|
} & {
|
|
117
112
|
as?: React.ElementType;
|
|
118
113
|
}>, {}>;
|
|
114
|
+
/**
|
|
115
|
+
* Full-height tint over the hovered category's band on a bar chart — the bar
|
|
116
|
+
* counterpart to {@link ChartCursorLine}. A rule reads oddly threaded through
|
|
117
|
+
* wide filled marks; a quiet band behind them marks the same position without
|
|
118
|
+
* touching them. 8% of the foreground, so it survives both themes.
|
|
119
|
+
*/
|
|
120
|
+
export declare const ChartCursorBand: import("react").ComponentType<Pick<import("react").SVGProps<SVGRectElement> & {
|
|
121
|
+
theme: import("../theme").Theme;
|
|
122
|
+
} & {
|
|
123
|
+
as?: React.ElementType;
|
|
124
|
+
}, "as" | keyof import("react").SVGProps<SVGRectElement>> & {
|
|
125
|
+
theme?: import("@callstack/react-theme-provider").$DeepPartial<import("../theme").Theme> | undefined;
|
|
126
|
+
}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<import("react").ComponentType<import("react").SVGProps<SVGRectElement> & {
|
|
127
|
+
theme: import("../theme").Theme;
|
|
128
|
+
} & {
|
|
129
|
+
as?: React.ElementType;
|
|
130
|
+
}> & {
|
|
131
|
+
__wyw_meta: unknown;
|
|
132
|
+
} & import("react").FunctionComponent<import("react").SVGProps<SVGRectElement> & {
|
|
133
|
+
theme: import("../theme").Theme;
|
|
134
|
+
} & {
|
|
135
|
+
as?: React.ElementType;
|
|
136
|
+
}>, {}>;
|
|
119
137
|
export declare const ChartAxisLabelBox: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGForeignObjectElement> & Record<never, unknown>>;
|
|
120
138
|
/**
|
|
121
139
|
* Positioned from coordinates already clamped to the chart box.
|
|
@@ -203,12 +221,6 @@ export declare const ChartEmptyOverlay: import("react").ComponentType<Pick<impor
|
|
|
203
221
|
}>, {}>;
|
|
204
222
|
/**
|
|
205
223
|
* Aligns the legend under the plot rather than the value-axis gutter.
|
|
206
|
-
*
|
|
207
|
-
* Also cancels the restore delay for its entries while the legend is dimming,
|
|
208
|
-
* exactly as {@link ChartPlotGroup} does for the marks. The legend renders
|
|
209
|
-
* *outside* the SVG, so the plot group's selector cannot reach it — without this
|
|
210
|
-
* the marks dim instantly while their legend entries sit through the full
|
|
211
|
-
* {@link CHART_RESTORE_DELAY_MS}, and the two visibly fall out of step.
|
|
212
224
|
*/
|
|
213
225
|
export declare const ChartLegendRow: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
214
226
|
$inset: number;
|
|
@@ -232,9 +244,7 @@ export declare const ChartLegendMeasure: import("@linaria/react").StyledComponen
|
|
|
232
244
|
* the body of an interactive tooltip.
|
|
233
245
|
*
|
|
234
246
|
* Scrolls past {@link CHART_LEGEND_OVERFLOW_MAX_HEIGHT} so a fifty-series chart
|
|
235
|
-
* gets a bounded popover rather than one taller than the plot.
|
|
236
|
-
* `data-active` delay-cancel rule: the tooltip content mounts outside
|
|
237
|
-
* {@link ChartLegendRow}, where the row's selector cannot reach it.
|
|
247
|
+
* gets a bounded popover rather than one taller than the plot.
|
|
238
248
|
*/
|
|
239
249
|
export declare const ChartLegendOverflowList: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
240
250
|
/**
|
|
@@ -248,7 +258,18 @@ export declare const ChartLegendOverflowList: import("@linaria/react").StyledCom
|
|
|
248
258
|
*
|
|
249
259
|
* Shares the mark opacity ramp via `data-state`, so an entry recedes in step
|
|
250
260
|
* with the series it names.
|
|
261
|
+
*
|
|
262
|
+
* The trailing padding is the inter-entry spacing — deliberately padding on
|
|
263
|
+
* the entry rather than a gap on the container, so the hover surfaces of
|
|
264
|
+
* adjacent entries touch and a sweep hands the isolation directly from one
|
|
265
|
+
* series to the next. Trailing only, so the first entry stays flush with the
|
|
266
|
+
* plot's left edge (or the column's top).
|
|
251
267
|
*/
|
|
252
|
-
export declare const ChartLegendItemButton: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> &
|
|
253
|
-
|
|
254
|
-
|
|
268
|
+
export declare const ChartLegendItemButton: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
269
|
+
$vertical?: boolean;
|
|
270
|
+
}>;
|
|
271
|
+
/** The same row, when the legend is inert — no button semantics to announce.
|
|
272
|
+
* Carries the same trailing padding; see {@link ChartLegendItemButton}. */
|
|
273
|
+
export declare const ChartLegendItemStatic: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
274
|
+
$vertical?: boolean;
|
|
275
|
+
}>;
|
|
@@ -22,12 +22,10 @@ import { styled } from "@linaria/react";
|
|
|
22
22
|
* HOC's return type erases the element type, so a mismatched ref would compile.
|
|
23
23
|
*/
|
|
24
24
|
/**
|
|
25
|
-
* Shared emphasis
|
|
25
|
+
* Shared emphasis states.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* gesture instead of a strobe. The plot sets `data-active` while any category is
|
|
30
|
-
* engaged, which cancels the delay for the whole subtree.
|
|
27
|
+
* Deliberately no transition: emphasis is feedback, and feedback that eases in
|
|
28
|
+
* reads as lag. The states snap.
|
|
31
29
|
*/
|
|
32
30
|
/**
|
|
33
31
|
* Outer container. Receives the measurement ref.
|
|
@@ -104,38 +102,29 @@ var ChartSvg = /*#__PURE__*/ styled("svg")({
|
|
|
104
102
|
class: "c10uj5yt",
|
|
105
103
|
propsAsIs: false
|
|
106
104
|
});
|
|
107
|
-
/**
|
|
108
|
-
* Cancels the restore delay for every mark beneath it while a category is
|
|
109
|
-
* engaged. See {@link markState}.
|
|
110
|
-
*/
|
|
111
|
-
var ChartPlotGroup = /*#__PURE__*/ styled("g")({
|
|
112
|
-
name: "ChartPlotGroup",
|
|
113
|
-
class: "cyuty3o",
|
|
114
|
-
propsAsIs: true
|
|
115
|
-
});
|
|
116
105
|
var ChartBarPath = /*#__PURE__*/ styled("path")({
|
|
117
106
|
name: "ChartBarPath",
|
|
118
|
-
class: "
|
|
107
|
+
class: "cyuty3o",
|
|
119
108
|
propsAsIs: true
|
|
120
109
|
});
|
|
121
110
|
var ChartLinePath = /*#__PURE__*/ styled("path")({
|
|
122
111
|
name: "ChartLinePath",
|
|
123
|
-
class: "
|
|
112
|
+
class: "c1ob2op2",
|
|
124
113
|
propsAsIs: true
|
|
125
114
|
});
|
|
126
115
|
var ChartAreaPath = /*#__PURE__*/ styled("path")({
|
|
127
116
|
name: "ChartAreaPath",
|
|
128
|
-
class: "
|
|
117
|
+
class: "c8c506o",
|
|
129
118
|
propsAsIs: true
|
|
130
119
|
});
|
|
131
120
|
var ChartPointCircle = /*#__PURE__*/ styled("circle")({
|
|
132
121
|
name: "ChartPointCircle",
|
|
133
|
-
class: "
|
|
122
|
+
class: "ceqlpek",
|
|
134
123
|
propsAsIs: true
|
|
135
124
|
});
|
|
136
125
|
var ChartArcPath = /*#__PURE__*/ styled("path")({
|
|
137
126
|
name: "ChartArcPath",
|
|
138
|
-
class: "
|
|
127
|
+
class: "c1fcbddl",
|
|
139
128
|
propsAsIs: true
|
|
140
129
|
});
|
|
141
130
|
/**
|
|
@@ -151,7 +140,7 @@ var ChartArcPath = /*#__PURE__*/ styled("path")({
|
|
|
151
140
|
*/
|
|
152
141
|
var ChartHitTarget = /*#__PURE__*/ styled("rect")({
|
|
153
142
|
name: "ChartHitTarget",
|
|
154
|
-
class: "
|
|
143
|
+
class: "cpcxr59",
|
|
155
144
|
propsAsIs: true
|
|
156
145
|
});
|
|
157
146
|
/**
|
|
@@ -164,7 +153,7 @@ var ChartHitTarget = /*#__PURE__*/ styled("rect")({
|
|
|
164
153
|
*/
|
|
165
154
|
var ChartHitTargetPath = /*#__PURE__*/ styled("path")({
|
|
166
155
|
name: "ChartHitTargetPath",
|
|
167
|
-
class: "
|
|
156
|
+
class: "c1wvzvu4",
|
|
168
157
|
propsAsIs: true
|
|
169
158
|
});
|
|
170
159
|
/**
|
|
@@ -175,17 +164,30 @@ var ChartHitTargetPath = /*#__PURE__*/ styled("path")({
|
|
|
175
164
|
var _exp15 = () => ({ theme }) => theme.color.border.primary;
|
|
176
165
|
var ChartGridLine = withTheme(/*#__PURE__*/ styled("line")({
|
|
177
166
|
name: "ChartGridLine",
|
|
178
|
-
class: "
|
|
167
|
+
class: "c17guewt",
|
|
179
168
|
propsAsIs: true,
|
|
180
|
-
vars: { "
|
|
169
|
+
vars: { "c17guewt-0": [_exp15()] }
|
|
181
170
|
}));
|
|
182
171
|
/** Vertical rule marking the hovered category on a line chart. */
|
|
183
172
|
var _exp16 = () => ({ theme }) => theme.color.border.secondary;
|
|
184
173
|
var ChartCursorLine = withTheme(/*#__PURE__*/ styled("line")({
|
|
185
174
|
name: "ChartCursorLine",
|
|
175
|
+
class: "cblgiyf",
|
|
176
|
+
propsAsIs: true,
|
|
177
|
+
vars: { "cblgiyf-0": [_exp16()] }
|
|
178
|
+
}));
|
|
179
|
+
/**
|
|
180
|
+
* Full-height tint over the hovered category's band on a bar chart — the bar
|
|
181
|
+
* counterpart to {@link ChartCursorLine}. A rule reads oddly threaded through
|
|
182
|
+
* wide filled marks; a quiet band behind them marks the same position without
|
|
183
|
+
* touching them. 8% of the foreground, so it survives both themes.
|
|
184
|
+
*/
|
|
185
|
+
var _exp17 = () => ({ theme }) => theme.color.opacity.bw8Alt;
|
|
186
|
+
var ChartCursorBand = withTheme(/*#__PURE__*/ styled("rect")({
|
|
187
|
+
name: "ChartCursorBand",
|
|
186
188
|
class: "c1lr03cc",
|
|
187
189
|
propsAsIs: true,
|
|
188
|
-
vars: { "c1lr03cc-0": [
|
|
190
|
+
vars: { "c1lr03cc-0": [_exp17()] }
|
|
189
191
|
}));
|
|
190
192
|
var ChartAxisLabelBox = /*#__PURE__*/ styled("foreignObject")({
|
|
191
193
|
name: "ChartAxisLabelBox",
|
|
@@ -199,21 +201,21 @@ var ChartAxisLabelBox = /*#__PURE__*/ styled("foreignObject")({
|
|
|
199
201
|
* than teleporting, and it stays mounted while hidden so the fade can actually
|
|
200
202
|
* run — unmounting on hide is why a fade-out never appears.
|
|
201
203
|
*/
|
|
202
|
-
var
|
|
203
|
-
var
|
|
204
|
-
var
|
|
205
|
-
var
|
|
206
|
-
var
|
|
204
|
+
var _exp18 = () => ({ $x }) => `${$x}px`;
|
|
205
|
+
var _exp19 = () => ({ $y }) => `${$y}px`;
|
|
206
|
+
var _exp22 = () => ({ theme }) => theme.color.border.primary;
|
|
207
|
+
var _exp23 = () => ({ theme }) => theme.color.background.tertiary;
|
|
208
|
+
var _exp24 = () => ({ $isVisible }) => $isVisible ? 1 : 0;
|
|
207
209
|
var ChartTooltipPositioner = withTheme(/*#__PURE__*/ styled("div")({
|
|
208
210
|
name: "ChartTooltipPositioner",
|
|
209
211
|
class: "c1ukq11d",
|
|
210
212
|
propsAsIs: false,
|
|
211
213
|
vars: {
|
|
212
|
-
"c1ukq11d-0": [
|
|
213
|
-
"c1ukq11d-1": [
|
|
214
|
-
"c1ukq11d-2": [
|
|
215
|
-
"c1ukq11d-3": [
|
|
216
|
-
"c1ukq11d-4": [
|
|
214
|
+
"c1ukq11d-0": [_exp18()],
|
|
215
|
+
"c1ukq11d-1": [_exp19()],
|
|
216
|
+
"c1ukq11d-2": [_exp22()],
|
|
217
|
+
"c1ukq11d-3": [_exp23()],
|
|
218
|
+
"c1ukq11d-4": [_exp24()]
|
|
217
219
|
}
|
|
218
220
|
}));
|
|
219
221
|
/**
|
|
@@ -250,47 +252,40 @@ var ChartTooltipValueCell = /*#__PURE__*/ styled("div")({
|
|
|
250
252
|
* of the DLS. `pointer-events: none` keeps it from stealing hover from the arc
|
|
251
253
|
* behind it.
|
|
252
254
|
*/
|
|
253
|
-
var
|
|
254
|
-
var
|
|
255
|
-
var
|
|
255
|
+
var _exp28 = () => ({ $centerX }) => `${$centerX}px`;
|
|
256
|
+
var _exp29 = () => ({ $centerY }) => `${$centerY}px`;
|
|
257
|
+
var _exp31 = () => ({ $diameter }) => `${$diameter}px`;
|
|
256
258
|
var ChartCenterBox = /*#__PURE__*/ styled("div")({
|
|
257
259
|
name: "ChartCenterBox",
|
|
258
260
|
class: "cz6jod1",
|
|
259
261
|
propsAsIs: false,
|
|
260
262
|
vars: {
|
|
261
|
-
"cz6jod1-0": [
|
|
262
|
-
"cz6jod1-1": [
|
|
263
|
-
"cz6jod1-2": [
|
|
263
|
+
"cz6jod1-0": [_exp28()],
|
|
264
|
+
"cz6jod1-1": [_exp29()],
|
|
265
|
+
"cz6jod1-2": [_exp31()]
|
|
264
266
|
}
|
|
265
267
|
});
|
|
266
268
|
/**
|
|
267
269
|
* Sits slightly above centre, over where the bars would be, so the axes stay
|
|
268
270
|
* legible underneath.
|
|
269
271
|
*/
|
|
270
|
-
var
|
|
271
|
-
var
|
|
272
|
+
var _exp32 = () => ({ theme }) => theme.color.border.primary;
|
|
273
|
+
var _exp33 = () => ({ theme }) => theme.color.background.primary;
|
|
272
274
|
var ChartEmptyOverlay = withTheme(/*#__PURE__*/ styled("div")({
|
|
273
275
|
name: "ChartEmptyOverlay",
|
|
274
276
|
class: "c1de5mqk",
|
|
275
277
|
propsAsIs: false,
|
|
276
278
|
vars: {
|
|
277
|
-
"c1de5mqk-0": [
|
|
278
|
-
"c1de5mqk-1": [
|
|
279
|
+
"c1de5mqk-0": [_exp32()],
|
|
280
|
+
"c1de5mqk-1": [_exp33()]
|
|
279
281
|
}
|
|
280
282
|
}));
|
|
281
283
|
/**
|
|
282
284
|
* Aligns the legend under the plot rather than the value-axis gutter.
|
|
283
|
-
*
|
|
284
|
-
* Also cancels the restore delay for its entries while the legend is dimming,
|
|
285
|
-
* exactly as {@link ChartPlotGroup} does for the marks. The legend renders
|
|
286
|
-
* *outside* the SVG, so the plot group's selector cannot reach it — without this
|
|
287
|
-
* the marks dim instantly while their legend entries sit through the full
|
|
288
|
-
* {@link CHART_RESTORE_DELAY_MS}, and the two visibly fall out of step.
|
|
289
285
|
*/
|
|
290
|
-
var
|
|
291
|
-
var
|
|
292
|
-
var
|
|
293
|
-
var _exp36 = () => ({ $vertical }) => $vertical ? `8px` : `16px`;
|
|
286
|
+
var _exp34 = () => ({ $vertical }) => $vertical ? "column" : "row";
|
|
287
|
+
var _exp35 = () => ({ $vertical }) => $vertical ? "flex-start" : "center";
|
|
288
|
+
var _exp36 = () => ({ $vertical }) => $vertical ? "center" : "flex-start";
|
|
294
289
|
var _exp37 = () => ({ $vertical }) => $vertical ? "auto" : "0";
|
|
295
290
|
var _exp38 = () => ({ $vertical }) => $vertical ? "0" : "100%";
|
|
296
291
|
var _exp39 = () => ({ $vertical, $extent }) => $vertical && $extent ? `${$extent}px` : "auto";
|
|
@@ -301,15 +296,14 @@ var ChartLegendRow = /*#__PURE__*/ styled("div")({
|
|
|
301
296
|
class: "cjirv6a",
|
|
302
297
|
propsAsIs: false,
|
|
303
298
|
vars: {
|
|
304
|
-
"cjirv6a-0": [
|
|
305
|
-
"cjirv6a-1": [
|
|
306
|
-
"cjirv6a-2": [
|
|
307
|
-
"cjirv6a-3": [
|
|
308
|
-
"cjirv6a-4": [
|
|
309
|
-
"cjirv6a-5": [
|
|
310
|
-
"cjirv6a-6": [
|
|
311
|
-
"cjirv6a-7": [
|
|
312
|
-
"cjirv6a-8": [_exp41()]
|
|
299
|
+
"cjirv6a-0": [_exp34()],
|
|
300
|
+
"cjirv6a-1": [_exp35()],
|
|
301
|
+
"cjirv6a-2": [_exp36()],
|
|
302
|
+
"cjirv6a-3": [_exp37()],
|
|
303
|
+
"cjirv6a-4": [_exp38()],
|
|
304
|
+
"cjirv6a-5": [_exp39()],
|
|
305
|
+
"cjirv6a-6": [_exp40()],
|
|
306
|
+
"cjirv6a-7": [_exp41()]
|
|
313
307
|
}
|
|
314
308
|
});
|
|
315
309
|
/**
|
|
@@ -322,15 +316,13 @@ var ChartLegendRow = /*#__PURE__*/ styled("div")({
|
|
|
322
316
|
*/
|
|
323
317
|
var _exp42 = () => ({ $vertical }) => $vertical ? "column" : "row";
|
|
324
318
|
var _exp43 = () => ({ $vertical }) => $vertical ? "flex-start" : "center";
|
|
325
|
-
var _exp44 = () => ({ $vertical }) => $vertical ? `8px` : `16px`;
|
|
326
319
|
var ChartLegendMeasure = /*#__PURE__*/ styled("div")({
|
|
327
320
|
name: "ChartLegendMeasure",
|
|
328
321
|
class: "c1armna5",
|
|
329
322
|
propsAsIs: false,
|
|
330
323
|
vars: {
|
|
331
324
|
"c1armna5-0": [_exp42()],
|
|
332
|
-
"c1armna5-1": [_exp43()]
|
|
333
|
-
"c1armna5-2": [_exp44()]
|
|
325
|
+
"c1armna5-1": [_exp43()]
|
|
334
326
|
}
|
|
335
327
|
});
|
|
336
328
|
/**
|
|
@@ -338,9 +330,7 @@ var ChartLegendMeasure = /*#__PURE__*/ styled("div")({
|
|
|
338
330
|
* the body of an interactive tooltip.
|
|
339
331
|
*
|
|
340
332
|
* Scrolls past {@link CHART_LEGEND_OVERFLOW_MAX_HEIGHT} so a fifty-series chart
|
|
341
|
-
* gets a bounded popover rather than one taller than the plot.
|
|
342
|
-
* `data-active` delay-cancel rule: the tooltip content mounts outside
|
|
343
|
-
* {@link ChartLegendRow}, where the row's selector cannot reach it.
|
|
333
|
+
* gets a bounded popover rather than one taller than the plot.
|
|
344
334
|
*/
|
|
345
335
|
var ChartLegendOverflowList = /*#__PURE__*/ styled("div")({
|
|
346
336
|
name: "ChartLegendOverflowList",
|
|
@@ -358,17 +348,28 @@ var ChartLegendOverflowList = /*#__PURE__*/ styled("div")({
|
|
|
358
348
|
*
|
|
359
349
|
* Shares the mark opacity ramp via `data-state`, so an entry recedes in step
|
|
360
350
|
* with the series it names.
|
|
351
|
+
*
|
|
352
|
+
* The trailing padding is the inter-entry spacing — deliberately padding on
|
|
353
|
+
* the entry rather than a gap on the container, so the hover surfaces of
|
|
354
|
+
* adjacent entries touch and a sweep hands the isolation directly from one
|
|
355
|
+
* series to the next. Trailing only, so the first entry stays flush with the
|
|
356
|
+
* plot's left edge (or the column's top).
|
|
361
357
|
*/
|
|
358
|
+
var _exp45 = () => ({ $vertical }) => $vertical ? `0 0 8px 0` : `0 16px 0 0`;
|
|
362
359
|
var ChartLegendItemButton = /*#__PURE__*/ styled("button")({
|
|
363
360
|
name: "ChartLegendItemButton",
|
|
364
361
|
class: "cutidpi",
|
|
365
|
-
propsAsIs: false
|
|
362
|
+
propsAsIs: false,
|
|
363
|
+
vars: { "cutidpi-0": [_exp45()] }
|
|
366
364
|
});
|
|
367
|
-
/** The same row, when the legend is inert — no button semantics to announce.
|
|
365
|
+
/** The same row, when the legend is inert — no button semantics to announce.
|
|
366
|
+
* Carries the same trailing padding; see {@link ChartLegendItemButton}. */
|
|
367
|
+
var _exp47 = () => ({ $vertical }) => $vertical ? `0 0 8px 0` : `0 16px 0 0`;
|
|
368
368
|
var ChartLegendItemStatic = /*#__PURE__*/ styled("div")({
|
|
369
369
|
name: "ChartLegendItemStatic",
|
|
370
370
|
class: "ccpczg",
|
|
371
|
-
propsAsIs: false
|
|
371
|
+
propsAsIs: false,
|
|
372
|
+
vars: { "ccpczg-0": [_exp47()] }
|
|
372
373
|
});
|
|
373
374
|
//#endregion
|
|
374
|
-
export { ChartArcPath, ChartAreaPath, ChartAxisLabelBox, ChartBarPath, ChartCenterBox, ChartCursorLine, ChartEmptyOverlay, ChartGridLine, ChartHitTarget, ChartHitTargetPath, ChartLegendItemButton, ChartLegendItemStatic, ChartLegendMeasure, ChartLegendOverflowList, ChartLegendRow, ChartLinePath, ChartPlotBox,
|
|
375
|
+
export { ChartArcPath, ChartAreaPath, ChartAxisLabelBox, ChartBarPath, ChartCenterBox, ChartCursorBand, ChartCursorLine, ChartEmptyOverlay, ChartGridLine, ChartHitTarget, ChartHitTargetPath, ChartLegendItemButton, ChartLegendItemStatic, ChartLegendMeasure, ChartLegendOverflowList, ChartLegendRow, ChartLinePath, ChartPlotBox, ChartPointCircle, ChartRoot, ChartSvg, ChartTooltipGrid, ChartTooltipLabelCell, ChartTooltipPositioner, ChartTooltipValueCell };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The category one chart's pointer is currently over, broadcast to its
|
|
4
|
+
* siblings.
|
|
5
|
+
*/
|
|
6
|
+
export interface DashboardSyncEntry {
|
|
7
|
+
/** `useId` of the chart whose pointer produced this entry. */
|
|
8
|
+
sourceId: string;
|
|
9
|
+
/**
|
|
10
|
+
* The raw category label under the pointer — never `labelFormatter` output,
|
|
11
|
+
* so two charts formatting the same label differently still match.
|
|
12
|
+
*/
|
|
13
|
+
categoryKey: string;
|
|
14
|
+
}
|
|
15
|
+
export interface DashboardContextValue {
|
|
16
|
+
activeEntry: DashboardSyncEntry | null;
|
|
17
|
+
setActive: (entry: DashboardSyncEntry) => void;
|
|
18
|
+
/** Clears only if the current entry belongs to `sourceId`. */
|
|
19
|
+
clearActive: (sourceId: string) => void;
|
|
20
|
+
/** Followers open their own tooltip at the synced category. */
|
|
21
|
+
sharedTooltip: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const DashboardContext: import("react").Context<DashboardContextValue | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Shares the hovered category between the cartesian charts inside it.
|
|
26
|
+
*
|
|
27
|
+
* Hovering a category in one chart shows the same category emphasized in every
|
|
28
|
+
* sibling — matched by raw category label, so charts whose category sets only
|
|
29
|
+
* partially overlap simply show nothing for the labels they lack. By default
|
|
30
|
+
* the tooltip stays local to the chart under the pointer; siblings get the
|
|
31
|
+
* quiet emphasis only (LineChart its cursor line and dots, BarChart its band
|
|
32
|
+
* tint and gentle dim). `sharedTooltip` opts every synced chart into opening its
|
|
33
|
+
* own tooltip at the shared category — the tooltip anchors to the category's
|
|
34
|
+
* geometry, not the pointer, so a follower's opens exactly where a local
|
|
35
|
+
* hover's would.
|
|
36
|
+
*
|
|
37
|
+
* Scope, deliberately narrow:
|
|
38
|
+
* - Only the category axis syncs. Legend (series) hover stays local.
|
|
39
|
+
* - PieChart never participates — it has no category axis.
|
|
40
|
+
* - There is no per-chart opt-out prop. The opt-out is rendering the chart
|
|
41
|
+
* outside the provider, and nesting a second provider isolates a subset —
|
|
42
|
+
* charts sync with their nearest ancestor.
|
|
43
|
+
*
|
|
44
|
+
* Renders no DOM and holds no layout opinion — unlike `OverlayProvider` it is
|
|
45
|
+
* not a page-root singleton, and several can coexist on a page.
|
|
46
|
+
*
|
|
47
|
+
* Plain context state is the right transport here: entries change at category
|
|
48
|
+
* granularity (once per hit band crossed, not per mousemove), so a sweep
|
|
49
|
+
* across a chart re-renders the group a handful of times. No subscription or
|
|
50
|
+
* selector machinery is warranted.
|
|
51
|
+
*/
|
|
52
|
+
export interface DashboardProviderProps {
|
|
53
|
+
/** Every synced chart opens its own tooltip at the shared category. @default false */
|
|
54
|
+
sharedTooltip?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare const DashboardProvider: ({ sharedTooltip, children, }: PropsWithChildren<DashboardProviderProps>) => import("react").JSX.Element;
|
|
57
|
+
export default DashboardProvider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createContext, useCallback, useMemo, useState } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/charts/DashboardProvider.tsx
|
|
4
|
+
var DashboardContext = createContext(null);
|
|
5
|
+
var DashboardProvider = ({ sharedTooltip = false, children }) => {
|
|
6
|
+
const [activeEntry, setActiveEntry] = useState(null);
|
|
7
|
+
const setActive = useCallback((entry) => {
|
|
8
|
+
setActiveEntry((prev) => prev !== null && prev.sourceId === entry.sourceId && prev.categoryKey === entry.categoryKey ? prev : entry);
|
|
9
|
+
}, []);
|
|
10
|
+
const clearActive = useCallback((sourceId) => {
|
|
11
|
+
setActiveEntry((prev) => prev !== null && prev.sourceId === sourceId ? null : prev);
|
|
12
|
+
}, []);
|
|
13
|
+
const contextValue = useMemo(() => ({
|
|
14
|
+
activeEntry,
|
|
15
|
+
setActive,
|
|
16
|
+
clearActive,
|
|
17
|
+
sharedTooltip
|
|
18
|
+
}), [
|
|
19
|
+
activeEntry,
|
|
20
|
+
setActive,
|
|
21
|
+
clearActive,
|
|
22
|
+
sharedTooltip
|
|
23
|
+
]);
|
|
24
|
+
return /* @__PURE__ */ jsx(DashboardContext.Provider, {
|
|
25
|
+
value: contextValue,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { DashboardContext, DashboardProvider, DashboardProvider as default };
|
package/dist/charts/LineChart.js
CHANGED
|
@@ -68,7 +68,8 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
68
68
|
const interaction = useChartInteraction({
|
|
69
69
|
categoryCount: geometry.columns.length,
|
|
70
70
|
seriesKeys: legendKeys,
|
|
71
|
-
|
|
71
|
+
categoryKeys: geometry.categories,
|
|
72
|
+
isDisabled: noTooltip || isLoading || isEmpty,
|
|
72
73
|
isLoading
|
|
73
74
|
});
|
|
74
75
|
const activeColumn = interaction.activeIndex === null ? null : geometry.columns[interaction.activeIndex];
|