@galaxy-io/dls 1.4.3 → 1.4.4
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/charts/BarChart.d.ts +1 -1
- package/dist/charts/BarChart.js +2 -1
- package/dist/charts/ChartFrame.d.ts +3 -1
- package/dist/charts/ChartFrame.js +3 -1
- package/dist/charts/ChartLegend.d.ts +23 -1
- package/dist/charts/ChartLegend.js +139 -28
- package/dist/charts/ChartPrimitives.d.ts +23 -0
- package/dist/charts/ChartPrimitives.js +51 -9
- package/dist/charts/LineChart.d.ts +1 -1
- package/dist/charts/LineChart.js +2 -1
- package/dist/charts/PieChart.d.ts +1 -1
- package/dist/charts/PieChart.js +3 -2
- package/dist/charts/constants.d.ts +19 -0
- package/dist/charts/constants.js +20 -1
- package/dist/charts/types.d.ts +10 -0
- package/dist/styles.css +9 -7
- package/package.json +1 -1
|
@@ -21,5 +21,5 @@ export type BarChartProps<TMetric extends string, TComponentKey extends string =
|
|
|
21
21
|
* `bars` in a group render side by side, several `components` in a bar stack,
|
|
22
22
|
* and a chart doing both at once needs no extra configuration.
|
|
23
23
|
*/
|
|
24
|
-
declare const BarChart: <TMetric extends string, TComponentKey extends string = string>({ series, groups, width, height, fillWidth, fillHeight, aspectRatio, margin, normalization, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid, showLegend, noTooltip, tooltipRenderer, isLoading, contentWhenEmpty, ariaLabel, ariaDescription, }: BarChartProps<TMetric, TComponentKey>) => import("react").JSX.Element;
|
|
24
|
+
declare const BarChart: <TMetric extends string, TComponentKey extends string = string>({ series, groups, width, height, fillWidth, fillHeight, aspectRatio, margin, normalization, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid, showLegend, legendMaxItems, noTooltip, tooltipRenderer, isLoading, contentWhenEmpty, ariaLabel, ariaDescription, }: BarChartProps<TMetric, TComponentKey>) => import("react").JSX.Element;
|
|
25
25
|
export default BarChart;
|
package/dist/charts/BarChart.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
* `bars` in a group render side by side, several `components` in a bar stack,
|
|
18
18
|
* and a chart doing both at once needs no extra configuration.
|
|
19
19
|
*/
|
|
20
|
-
var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRatio, margin, normalization = BarChartNormalization.NONE, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid = true, showLegend = true, noTooltip = false, tooltipRenderer, isLoading = false, contentWhenEmpty, ariaLabel, ariaDescription }) => {
|
|
20
|
+
var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRatio, margin, normalization = BarChartNormalization.NONE, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid = true, showLegend = true, legendMaxItems, noTooltip = false, tooltipRenderer, isLoading = false, contentWhenEmpty, ariaLabel, ariaDescription }) => {
|
|
21
21
|
const containerRef = useRef(null);
|
|
22
22
|
const colors = useSeriesColorResolver(series);
|
|
23
23
|
/**
|
|
@@ -179,6 +179,7 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
179
179
|
contentWhenEmpty,
|
|
180
180
|
showLegend,
|
|
181
181
|
legendItems,
|
|
182
|
+
legendMaxItems,
|
|
182
183
|
children: geometry.rects.map((rect) => /* @__PURE__ */ jsx(ChartBarPath, {
|
|
183
184
|
d: roundedRectPath(rect.x, rect.y, rect.width, rect.height, rect.radius, rect.corners),
|
|
184
185
|
fill: rect.color,
|
|
@@ -99,6 +99,8 @@ export interface ChartFrameProps {
|
|
|
99
99
|
contentWhenEmpty?: ReactNode;
|
|
100
100
|
showLegend?: boolean;
|
|
101
101
|
legendItems: ChartLegendItem[];
|
|
102
|
+
/** Inline cap; the rest collapse behind "+N more". See {@link BaseChartProps.legendMaxItems}. */
|
|
103
|
+
legendMaxItems?: number;
|
|
102
104
|
/** Where the legend sits. RIGHT stacks it beside the plot, vertically centred. */
|
|
103
105
|
legendPlacement?: ChartLegendPlacement;
|
|
104
106
|
/**
|
|
@@ -108,5 +110,5 @@ export interface ChartFrameProps {
|
|
|
108
110
|
*/
|
|
109
111
|
legendInset?: number;
|
|
110
112
|
}
|
|
111
|
-
declare const ChartFrame: ({ containerRef, dimensions, fillWidth, fillHeight, interaction, kind, categoryCount, ariaLabel, ariaDescription, axes, children, plotOverlay, noTooltip, buildCategoryTooltip, tooltipRenderer, categoryTargets, categoryTargetsTransform, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading, contentWhenEmpty, showLegend, legendItems, legendPlacement, legendInset, }: ChartFrameProps) => import("react").JSX.Element;
|
|
113
|
+
declare const ChartFrame: ({ containerRef, dimensions, fillWidth, fillHeight, interaction, kind, categoryCount, ariaLabel, ariaDescription, axes, children, plotOverlay, noTooltip, buildCategoryTooltip, tooltipRenderer, categoryTargets, categoryTargetsTransform, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading, contentWhenEmpty, showLegend, legendItems, legendMaxItems, legendPlacement, legendInset, }: ChartFrameProps) => import("react").JSX.Element;
|
|
112
114
|
export default ChartFrame;
|
|
@@ -9,7 +9,7 @@ import { match } from "ts-pattern";
|
|
|
9
9
|
import { useId, useMemo } from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region src/charts/ChartFrame.tsx
|
|
12
|
-
var ChartFrame = ({ containerRef, dimensions, fillWidth, fillHeight, interaction, kind, categoryCount, ariaLabel, ariaDescription, axes, children, plotOverlay, noTooltip = false, buildCategoryTooltip, tooltipRenderer, categoryTargets, categoryTargetsTransform, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading = false, contentWhenEmpty, showLegend = false, legendItems, legendPlacement = ChartLegendPlacement.BOTTOM, legendInset }) => {
|
|
12
|
+
var ChartFrame = ({ containerRef, dimensions, fillWidth, fillHeight, interaction, kind, categoryCount, ariaLabel, ariaDescription, axes, children, plotOverlay, noTooltip = false, buildCategoryTooltip, tooltipRenderer, categoryTargets, categoryTargetsTransform, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading = false, contentWhenEmpty, showLegend = false, legendItems, legendMaxItems, legendPlacement = ChartLegendPlacement.BOTTOM, legendInset }) => {
|
|
13
13
|
const { width, height, margin, isMeasured, reservedHeight, reservedAspectRatio } = dimensions;
|
|
14
14
|
const generatedId = useId();
|
|
15
15
|
const descriptionId = ariaDescription ? `${generatedId}-desc` : void 0;
|
|
@@ -121,6 +121,8 @@ var ChartFrame = ({ containerRef, dimensions, fillWidth, fillHeight, interaction
|
|
|
121
121
|
items: legendItems,
|
|
122
122
|
inset: legendInset ?? (legendRight ? 16 : margin.left),
|
|
123
123
|
vertical: legendRight,
|
|
124
|
+
verticalExtent: legendRight ? height : void 0,
|
|
125
|
+
maxItems: legendMaxItems,
|
|
124
126
|
hoveredKey: interaction.hoveredSeriesKey,
|
|
125
127
|
onItemEnter: interaction.onSeriesEnter,
|
|
126
128
|
onItemLeave: interaction.onSeriesLeave
|
|
@@ -7,6 +7,20 @@ interface ChartLegendProps {
|
|
|
7
7
|
hoveredKey?: string | null;
|
|
8
8
|
/** Stack entries in a column — the side-placed layout. */
|
|
9
9
|
vertical?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Plot box height in px — the vertical legend's fit extent. Height needs to
|
|
12
|
+
* arrive as a number because, unlike width, a percentage of the root's
|
|
13
|
+
* auto height is indefinite and computes to nothing. Absent (or 0, the
|
|
14
|
+
* unmeasured plot) there is no height constraint and every entry renders.
|
|
15
|
+
*/
|
|
16
|
+
verticalExtent?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Stricter cap on inline entries, on top of the automatic fit. The legend
|
|
19
|
+
* already collapses whatever won't fit inside the plot's extent — width for
|
|
20
|
+
* the horizontal layout, height for the side-placed one — behind the
|
|
21
|
+
* "+N more" trigger; this only lowers that number further.
|
|
22
|
+
*/
|
|
23
|
+
maxItems?: number;
|
|
10
24
|
/**
|
|
11
25
|
* Supplying these makes the legend interactive. Omit them and it renders as
|
|
12
26
|
* inert text, with no button semantics for a screen reader to announce.
|
|
@@ -19,11 +33,19 @@ interface ChartLegendProps {
|
|
|
19
33
|
*
|
|
20
34
|
* Hovering or focusing an entry isolates its series; leaving releases it.
|
|
21
35
|
*
|
|
36
|
+
* The legend never outgrows the plot. A horizontal legend holds exactly one
|
|
37
|
+
* line of the plot's width; a side-placed legend holds one column of the
|
|
38
|
+
* plot's height. Entries that would not fit collapse behind a "+N more"
|
|
39
|
+
* trigger whose tooltip lists them — still hoverable, so a collapsed series
|
|
40
|
+
* isolates exactly like a visible one. The fit is measured, not guessed: a
|
|
41
|
+
* hidden copy of every entry is laid out unconstrained, and the visible count
|
|
42
|
+
* is however many real sizes fit beside the trigger.
|
|
43
|
+
*
|
|
22
44
|
* Deliberately *not* a visibility toggle: hiding a series would have to rescale
|
|
23
45
|
* the value axis to stay honest — otherwise the remaining bars sit mysteriously
|
|
24
46
|
* short — and that belongs with the geometry layer rather than bolted on here.
|
|
25
47
|
* Isolation only changes opacity, so the domain is untouched and the numbers
|
|
26
48
|
* keep meaning what they did.
|
|
27
49
|
*/
|
|
28
|
-
declare const ChartLegend: ({ items, inset, hoveredKey, vertical, onItemEnter, onItemLeave, }: ChartLegendProps) => import("react").JSX.Element | null;
|
|
50
|
+
declare const ChartLegend: ({ items, inset, hoveredKey, vertical, verticalExtent, maxItems, onItemEnter, onItemLeave, }: ChartLegendProps) => import("react").JSX.Element | null;
|
|
29
51
|
export default ChartLegend;
|
|
@@ -1,51 +1,162 @@
|
|
|
1
|
-
import Text, { TextSize } from "../text/Text.js";
|
|
1
|
+
import Text, { TextSize, TextVariant } from "../text/Text.js";
|
|
2
|
+
import Tooltip, { TooltipPosition, TooltipVariant } from "../tooltip/Tooltip.js";
|
|
2
3
|
import Circle from "../shapes/Circle.js";
|
|
3
4
|
import { ChartMarkState } from "./types.js";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
5
|
+
import "./constants.js";
|
|
6
|
+
import { ChartLegendItemButton, ChartLegendItemStatic, ChartLegendMeasure, ChartLegendOverflowList, ChartLegendRow } from "./ChartPrimitives.js";
|
|
7
|
+
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
9
|
//#region src/charts/ChartLegend.tsx
|
|
7
10
|
/**
|
|
8
11
|
* Legend for the chart components.
|
|
9
12
|
*
|
|
10
13
|
* Hovering or focusing an entry isolates its series; leaving releases it.
|
|
11
14
|
*
|
|
15
|
+
* The legend never outgrows the plot. A horizontal legend holds exactly one
|
|
16
|
+
* line of the plot's width; a side-placed legend holds one column of the
|
|
17
|
+
* plot's height. Entries that would not fit collapse behind a "+N more"
|
|
18
|
+
* trigger whose tooltip lists them — still hoverable, so a collapsed series
|
|
19
|
+
* isolates exactly like a visible one. The fit is measured, not guessed: a
|
|
20
|
+
* hidden copy of every entry is laid out unconstrained, and the visible count
|
|
21
|
+
* is however many real sizes fit beside the trigger.
|
|
22
|
+
*
|
|
12
23
|
* Deliberately *not* a visibility toggle: hiding a series would have to rescale
|
|
13
24
|
* the value axis to stay honest — otherwise the remaining bars sit mysteriously
|
|
14
25
|
* short — and that belongs with the geometry layer rather than bolted on here.
|
|
15
26
|
* Isolation only changes opacity, so the domain is untouched and the numbers
|
|
16
27
|
* keep meaning what they did.
|
|
17
28
|
*/
|
|
18
|
-
var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, onItemEnter, onItemLeave }) => {
|
|
29
|
+
var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, verticalExtent, maxItems, onItemEnter, onItemLeave }) => {
|
|
30
|
+
const rowRef = useRef(null);
|
|
31
|
+
const measureRef = useRef(null);
|
|
32
|
+
/** How many entries fit inline. `null` until the first measurement lands. */
|
|
33
|
+
const [fitCount, setFitCount] = useState(null);
|
|
34
|
+
const recompute = useCallback(() => {
|
|
35
|
+
const row = rowRef.current;
|
|
36
|
+
const measure = measureRef.current;
|
|
37
|
+
if (!row || !measure) return;
|
|
38
|
+
const rendered = Array.from(measure.children);
|
|
39
|
+
const trigger = rendered.pop();
|
|
40
|
+
if (!trigger) return;
|
|
41
|
+
const gap = vertical ? 8 : 16;
|
|
42
|
+
const available = vertical ? verticalExtent || Number.POSITIVE_INFINITY : row.clientWidth - inset;
|
|
43
|
+
const sizeOf = (el) => {
|
|
44
|
+
const rect = el.getBoundingClientRect();
|
|
45
|
+
return Math.ceil(vertical ? rect.height : rect.width);
|
|
46
|
+
};
|
|
47
|
+
const sizes = rendered.map(sizeOf);
|
|
48
|
+
if (sizes.reduce((sum, size, i) => sum + size + (i > 0 ? gap : 0), 0) <= available) {
|
|
49
|
+
setFitCount(sizes.length);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const triggerSize = sizeOf(trigger);
|
|
53
|
+
let used = 0;
|
|
54
|
+
let count = 0;
|
|
55
|
+
for (const [i, size] of sizes.entries()) {
|
|
56
|
+
used += size + (i > 0 ? gap : 0);
|
|
57
|
+
if (used + gap + triggerSize > available) break;
|
|
58
|
+
count = i + 1;
|
|
59
|
+
}
|
|
60
|
+
setFitCount(Math.max(1, count));
|
|
61
|
+
}, [
|
|
62
|
+
inset,
|
|
63
|
+
vertical,
|
|
64
|
+
verticalExtent
|
|
65
|
+
]);
|
|
66
|
+
useLayoutEffect(() => {
|
|
67
|
+
recompute();
|
|
68
|
+
}, [
|
|
69
|
+
recompute,
|
|
70
|
+
items,
|
|
71
|
+
maxItems
|
|
72
|
+
]);
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
const row = rowRef.current;
|
|
75
|
+
if (!row) return;
|
|
76
|
+
const observer = new ResizeObserver(() => recompute());
|
|
77
|
+
observer.observe(row);
|
|
78
|
+
return () => observer.disconnect();
|
|
79
|
+
}, [recompute]);
|
|
19
80
|
if (items.length === 0) return null;
|
|
20
81
|
const isInteractive = Boolean(onItemEnter);
|
|
21
82
|
const activeKey = hoveredKey;
|
|
22
|
-
|
|
83
|
+
const renderItem = (item) => {
|
|
84
|
+
const state = activeKey === null || item.key === activeKey ? ChartMarkState.ACTIVE : ChartMarkState.MUTED;
|
|
85
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Circle, {
|
|
86
|
+
size: 8,
|
|
87
|
+
hex: item.color
|
|
88
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
89
|
+
size: TextSize.BODY_SM,
|
|
90
|
+
children: item.label
|
|
91
|
+
})] });
|
|
92
|
+
if (!isInteractive) return /* @__PURE__ */ jsx(ChartLegendItemStatic, {
|
|
93
|
+
"data-state": state,
|
|
94
|
+
children: content
|
|
95
|
+
}, item.key);
|
|
96
|
+
return /* @__PURE__ */ jsx(ChartLegendItemButton, {
|
|
97
|
+
type: "button",
|
|
98
|
+
"data-state": state,
|
|
99
|
+
onMouseEnter: () => onItemEnter?.(item.key),
|
|
100
|
+
onMouseLeave: () => onItemLeave?.(),
|
|
101
|
+
onFocus: () => onItemEnter?.(item.key),
|
|
102
|
+
onBlur: () => onItemLeave?.(),
|
|
103
|
+
children: content
|
|
104
|
+
}, item.key);
|
|
105
|
+
};
|
|
106
|
+
const capFromProp = maxItems === void 0 ? items.length : Math.max(1, maxItems);
|
|
107
|
+
const capFromFit = fitCount === null ? items.length : fitCount;
|
|
108
|
+
const inlineItems = items.slice(0, Math.min(capFromProp, capFromFit));
|
|
109
|
+
const overflowItems = items.slice(inlineItems.length);
|
|
110
|
+
/**
|
|
111
|
+
* The trigger holds full strength while a *collapsed* series is engaged — the
|
|
112
|
+
* one visual cue that the isolated series lives behind it — and recedes with
|
|
113
|
+
* the other entries when a visible one is.
|
|
114
|
+
*/
|
|
115
|
+
const isOverflowEngaged = activeKey !== null && overflowItems.some((item) => item.key === activeKey);
|
|
116
|
+
const triggerState = activeKey === null || isOverflowEngaged ? ChartMarkState.ACTIVE : ChartMarkState.MUTED;
|
|
117
|
+
return /* @__PURE__ */ jsxs(ChartLegendRow, {
|
|
118
|
+
ref: rowRef,
|
|
23
119
|
$inset: inset,
|
|
24
120
|
$vertical: vertical,
|
|
121
|
+
$extent: verticalExtent,
|
|
25
122
|
"data-active": activeKey !== null ? "true" : "false",
|
|
26
|
-
children:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
children:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsxs(ChartLegendMeasure, {
|
|
125
|
+
ref: measureRef,
|
|
126
|
+
$vertical: vertical,
|
|
127
|
+
"aria-hidden": "true",
|
|
128
|
+
children: [items.map((item) => /* @__PURE__ */ jsxs(ChartLegendItemStatic, { children: [/* @__PURE__ */ jsx(Circle, {
|
|
129
|
+
size: 8,
|
|
130
|
+
hex: item.color
|
|
131
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
132
|
+
size: TextSize.BODY_SM,
|
|
133
|
+
children: item.label
|
|
134
|
+
})] }, item.key)), /* @__PURE__ */ jsx(ChartLegendItemStatic, { children: /* @__PURE__ */ jsx(Text, {
|
|
135
|
+
size: TextSize.BODY_SM,
|
|
136
|
+
variant: TextVariant.SECONDARY,
|
|
137
|
+
children: `+${items.length - 1} more`
|
|
138
|
+
}) })]
|
|
139
|
+
}),
|
|
140
|
+
inlineItems.map(renderItem),
|
|
141
|
+
overflowItems.length > 0 && /* @__PURE__ */ jsx(Tooltip, {
|
|
142
|
+
isInteractive: true,
|
|
143
|
+
position: vertical ? TooltipPosition.RIGHT : TooltipPosition.TOP,
|
|
144
|
+
variant: TooltipVariant.TERTIARY,
|
|
145
|
+
body: /* @__PURE__ */ jsx(ChartLegendOverflowList, {
|
|
146
|
+
"data-active": activeKey !== null ? "true" : "false",
|
|
147
|
+
children: overflowItems.map(renderItem)
|
|
148
|
+
}),
|
|
149
|
+
children: /* @__PURE__ */ jsx(ChartLegendItemButton, {
|
|
150
|
+
type: "button",
|
|
151
|
+
"data-state": triggerState,
|
|
152
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
153
|
+
size: TextSize.BODY_SM,
|
|
154
|
+
variant: TextVariant.SECONDARY,
|
|
155
|
+
children: `+${overflowItems.length} more`
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
]
|
|
49
160
|
});
|
|
50
161
|
};
|
|
51
162
|
//#endregion
|
|
@@ -213,7 +213,30 @@ export declare const ChartEmptyOverlay: import("react").ComponentType<Pick<impor
|
|
|
213
213
|
export declare const ChartLegendRow: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
214
214
|
$inset: number;
|
|
215
215
|
$vertical?: boolean;
|
|
216
|
+
/** Plot box height in px — the side legend's fit extent. */
|
|
217
|
+
$extent?: number;
|
|
216
218
|
}>;
|
|
219
|
+
/**
|
|
220
|
+
* Invisible copy of every legend entry plus a worst-case trigger, laid out
|
|
221
|
+
* unconstrained along the legend's own axis so the fit computation can read
|
|
222
|
+
* real sizes.
|
|
223
|
+
*
|
|
224
|
+
* Absolute and hidden: it must not affect the row's layout, and measuring live
|
|
225
|
+
* entries instead would conflate "what fits" with "what is currently shown".
|
|
226
|
+
*/
|
|
227
|
+
export declare const ChartLegendMeasure: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
228
|
+
$vertical?: boolean;
|
|
229
|
+
}>;
|
|
230
|
+
/**
|
|
231
|
+
* Column of legend entries collapsed behind the "+N more" trigger, rendered as
|
|
232
|
+
* the body of an interactive tooltip.
|
|
233
|
+
*
|
|
234
|
+
* 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. Carries its own
|
|
236
|
+
* `data-active` delay-cancel rule: the tooltip content mounts outside
|
|
237
|
+
* {@link ChartLegendRow}, where the row's selector cannot reach it.
|
|
238
|
+
*/
|
|
239
|
+
export declare const ChartLegendOverflowList: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
217
240
|
/**
|
|
218
241
|
* One legend entry, when the legend is interactive.
|
|
219
242
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { withTheme } from "../theme/GalaxyTheme.js";
|
|
2
|
+
import "./constants.js";
|
|
2
3
|
/* empty css */
|
|
3
4
|
import { styled } from "@linaria/react";
|
|
4
5
|
//#region src/charts/ChartPrimitives.tsx
|
|
@@ -287,11 +288,14 @@ var ChartEmptyOverlay = withTheme(/*#__PURE__*/ styled("div")({
|
|
|
287
288
|
* {@link CHART_RESTORE_DELAY_MS}, and the two visibly fall out of step.
|
|
288
289
|
*/
|
|
289
290
|
var _exp33 = () => ({ $vertical }) => $vertical ? "column" : "row";
|
|
290
|
-
var _exp34 = () => ({ $vertical }) => $vertical ? "
|
|
291
|
-
var _exp35 = () => ({ $vertical }) => $vertical ? "
|
|
292
|
-
var _exp36 = () => ({ $vertical }) => $vertical ?
|
|
293
|
-
var _exp37 = () => ({ $vertical }) => $vertical ? "
|
|
294
|
-
var _exp38 = () => ({ $
|
|
291
|
+
var _exp34 = () => ({ $vertical }) => $vertical ? "flex-start" : "center";
|
|
292
|
+
var _exp35 = () => ({ $vertical }) => $vertical ? "center" : "flex-start";
|
|
293
|
+
var _exp36 = () => ({ $vertical }) => $vertical ? `8px` : `16px`;
|
|
294
|
+
var _exp37 = () => ({ $vertical }) => $vertical ? "auto" : "0";
|
|
295
|
+
var _exp38 = () => ({ $vertical }) => $vertical ? "0" : "100%";
|
|
296
|
+
var _exp39 = () => ({ $vertical, $extent }) => $vertical && $extent ? `${$extent}px` : "auto";
|
|
297
|
+
var _exp40 = () => ({ $vertical }) => $vertical ? "0" : "10px";
|
|
298
|
+
var _exp41 = () => ({ $inset }) => `${$inset}px`;
|
|
295
299
|
var ChartLegendRow = /*#__PURE__*/ styled("div")({
|
|
296
300
|
name: "ChartLegendRow",
|
|
297
301
|
class: "cjirv6a",
|
|
@@ -302,10 +306,48 @@ var ChartLegendRow = /*#__PURE__*/ styled("div")({
|
|
|
302
306
|
"cjirv6a-2": [_exp35()],
|
|
303
307
|
"cjirv6a-3": [_exp36()],
|
|
304
308
|
"cjirv6a-4": [_exp37()],
|
|
305
|
-
"cjirv6a-5": [_exp38()]
|
|
309
|
+
"cjirv6a-5": [_exp38()],
|
|
310
|
+
"cjirv6a-6": [_exp39()],
|
|
311
|
+
"cjirv6a-7": [_exp40()],
|
|
312
|
+
"cjirv6a-8": [_exp41()]
|
|
306
313
|
}
|
|
307
314
|
});
|
|
308
315
|
/**
|
|
316
|
+
* Invisible copy of every legend entry plus a worst-case trigger, laid out
|
|
317
|
+
* unconstrained along the legend's own axis so the fit computation can read
|
|
318
|
+
* real sizes.
|
|
319
|
+
*
|
|
320
|
+
* Absolute and hidden: it must not affect the row's layout, and measuring live
|
|
321
|
+
* entries instead would conflate "what fits" with "what is currently shown".
|
|
322
|
+
*/
|
|
323
|
+
var _exp42 = () => ({ $vertical }) => $vertical ? "column" : "row";
|
|
324
|
+
var _exp43 = () => ({ $vertical }) => $vertical ? "flex-start" : "center";
|
|
325
|
+
var _exp44 = () => ({ $vertical }) => $vertical ? `8px` : `16px`;
|
|
326
|
+
var ChartLegendMeasure = /*#__PURE__*/ styled("div")({
|
|
327
|
+
name: "ChartLegendMeasure",
|
|
328
|
+
class: "c1armna5",
|
|
329
|
+
propsAsIs: false,
|
|
330
|
+
vars: {
|
|
331
|
+
"c1armna5-0": [_exp42()],
|
|
332
|
+
"c1armna5-1": [_exp43()],
|
|
333
|
+
"c1armna5-2": [_exp44()]
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
/**
|
|
337
|
+
* Column of legend entries collapsed behind the "+N more" trigger, rendered as
|
|
338
|
+
* the body of an interactive tooltip.
|
|
339
|
+
*
|
|
340
|
+
* 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. Carries its own
|
|
342
|
+
* `data-active` delay-cancel rule: the tooltip content mounts outside
|
|
343
|
+
* {@link ChartLegendRow}, where the row's selector cannot reach it.
|
|
344
|
+
*/
|
|
345
|
+
var ChartLegendOverflowList = /*#__PURE__*/ styled("div")({
|
|
346
|
+
name: "ChartLegendOverflowList",
|
|
347
|
+
class: "cgd77rv",
|
|
348
|
+
propsAsIs: false
|
|
349
|
+
});
|
|
350
|
+
/**
|
|
309
351
|
* One legend entry, when the legend is interactive.
|
|
310
352
|
*
|
|
311
353
|
* A real `<button>` rather than a styled div so it sits in the tab order:
|
|
@@ -319,14 +361,14 @@ var ChartLegendRow = /*#__PURE__*/ styled("div")({
|
|
|
319
361
|
*/
|
|
320
362
|
var ChartLegendItemButton = /*#__PURE__*/ styled("button")({
|
|
321
363
|
name: "ChartLegendItemButton",
|
|
322
|
-
class: "
|
|
364
|
+
class: "cutidpi",
|
|
323
365
|
propsAsIs: false
|
|
324
366
|
});
|
|
325
367
|
/** The same row, when the legend is inert — no button semantics to announce. */
|
|
326
368
|
var ChartLegendItemStatic = /*#__PURE__*/ styled("div")({
|
|
327
369
|
name: "ChartLegendItemStatic",
|
|
328
|
-
class: "
|
|
370
|
+
class: "ccpczg",
|
|
329
371
|
propsAsIs: false
|
|
330
372
|
});
|
|
331
373
|
//#endregion
|
|
332
|
-
export { ChartArcPath, ChartAreaPath, ChartAxisLabelBox, ChartBarPath, ChartCenterBox, ChartCursorLine, ChartEmptyOverlay, ChartGridLine, ChartHitTarget, ChartHitTargetPath, ChartLegendItemButton, ChartLegendItemStatic, ChartLegendRow, ChartLinePath, ChartPlotBox, ChartPlotGroup, ChartPointCircle, ChartRoot, ChartSvg, ChartTooltipGrid, ChartTooltipLabelCell, ChartTooltipPositioner, ChartTooltipValueCell };
|
|
374
|
+
export { ChartArcPath, ChartAreaPath, ChartAxisLabelBox, ChartBarPath, ChartCenterBox, ChartCursorLine, ChartEmptyOverlay, ChartGridLine, ChartHitTarget, ChartHitTargetPath, ChartLegendItemButton, ChartLegendItemStatic, ChartLegendMeasure, ChartLegendOverflowList, ChartLegendRow, ChartLinePath, ChartPlotBox, ChartPlotGroup, ChartPointCircle, ChartRoot, ChartSvg, ChartTooltipGrid, ChartTooltipLabelCell, ChartTooltipPositioner, ChartTooltipValueCell };
|
|
@@ -34,5 +34,5 @@ export type LineChartProps<TMetric extends string> = BaseCartesianChartProps & C
|
|
|
34
34
|
* what a reader wants, and it avoids the proximity search a
|
|
35
35
|
* nearest-point-to-cursor model needs.
|
|
36
36
|
*/
|
|
37
|
-
declare const LineChart: <TMetric extends string>({ series, lines, categories, width, height, fillWidth, fillHeight, aspectRatio, margin, curve, strokeWidth, showCursor, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid, showLegend, noTooltip, tooltipRenderer, isLoading, contentWhenEmpty, ariaLabel, ariaDescription, }: LineChartProps<TMetric>) => import("react").JSX.Element;
|
|
37
|
+
declare const LineChart: <TMetric extends string>({ series, lines, categories, width, height, fillWidth, fillHeight, aspectRatio, margin, curve, strokeWidth, showCursor, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid, showLegend, legendMaxItems, noTooltip, tooltipRenderer, isLoading, contentWhenEmpty, ariaLabel, ariaDescription, }: LineChartProps<TMetric>) => import("react").JSX.Element;
|
|
38
38
|
export default LineChart;
|
package/dist/charts/LineChart.js
CHANGED
|
@@ -18,7 +18,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
* what a reader wants, and it avoids the proximity search a
|
|
19
19
|
* nearest-point-to-cursor model needs.
|
|
20
20
|
*/
|
|
21
|
-
var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeight, aspectRatio, margin, curve = LineChartCurve.SMOOTH, strokeWidth, showCursor = true, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid = true, showLegend = true, noTooltip = false, tooltipRenderer, isLoading = false, contentWhenEmpty, ariaLabel, ariaDescription }) => {
|
|
21
|
+
var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeight, aspectRatio, margin, curve = LineChartCurve.SMOOTH, strokeWidth, showCursor = true, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid = true, showLegend = true, legendMaxItems, noTooltip = false, tooltipRenderer, isLoading = false, contentWhenEmpty, ariaLabel, ariaDescription }) => {
|
|
22
22
|
const containerRef = useRef(null);
|
|
23
23
|
const colors = useSeriesColorResolver(series);
|
|
24
24
|
const { dimensions, domain, valueTicks, formatValue, formatLabel } = useCartesianChartLayout({
|
|
@@ -142,6 +142,7 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
142
142
|
contentWhenEmpty,
|
|
143
143
|
showLegend,
|
|
144
144
|
legendItems,
|
|
145
|
+
legendMaxItems,
|
|
145
146
|
children: [
|
|
146
147
|
geometry.paths.map((linePath) => linePath.areaPath ? /* @__PURE__ */ jsx(ChartAreaPath, {
|
|
147
148
|
d: linePath.areaPath,
|
|
@@ -40,5 +40,5 @@ export type PieChartProps<TSlice extends string> = BaseChartProps & ChartSize &
|
|
|
40
40
|
* each arc is its own target. Small slices are folded into an "Other" bucket by
|
|
41
41
|
* default, which keeps every remaining arc large enough to actually hit.
|
|
42
42
|
*/
|
|
43
|
-
declare const PieChart: <TSlice extends string>({ series, slices, width, height, fillWidth, fillHeight, aspectRatio, margin, innerRadiusRatio, padAngle, cornerRadius, minSliceShare, aggregatedLabel, centerContent, valueUnit, valueFormatter, labelFormatter, showLegend, noTooltip, tooltipRenderer, isLoading, contentWhenEmpty, ariaLabel, ariaDescription, }: PieChartProps<TSlice>) => import("react").JSX.Element;
|
|
43
|
+
declare const PieChart: <TSlice extends string>({ series, slices, width, height, fillWidth, fillHeight, aspectRatio, margin, innerRadiusRatio, padAngle, cornerRadius, minSliceShare, aggregatedLabel, centerContent, valueUnit, valueFormatter, labelFormatter, showLegend, legendMaxItems, noTooltip, tooltipRenderer, isLoading, contentWhenEmpty, ariaLabel, ariaDescription, }: PieChartProps<TSlice>) => import("react").JSX.Element;
|
|
44
44
|
export default PieChart;
|
package/dist/charts/PieChart.js
CHANGED
|
@@ -19,12 +19,12 @@ import { jsx } from "react/jsx-runtime";
|
|
|
19
19
|
* each arc is its own target. Small slices are folded into an "Other" bucket by
|
|
20
20
|
* default, which keeps every remaining arc large enough to actually hit.
|
|
21
21
|
*/
|
|
22
|
-
var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRatio, margin, innerRadiusRatio, padAngle, cornerRadius, minSliceShare = PIE_MIN_SLICE_SHARE, aggregatedLabel, centerContent, valueUnit, valueFormatter, labelFormatter, showLegend = true, noTooltip = false, tooltipRenderer, isLoading = false, contentWhenEmpty, ariaLabel, ariaDescription }) => {
|
|
22
|
+
var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRatio, margin, innerRadiusRatio, padAngle, cornerRadius, minSliceShare = PIE_MIN_SLICE_SHARE, aggregatedLabel, centerContent, valueUnit, valueFormatter, labelFormatter, showLegend = true, legendMaxItems, noTooltip = false, tooltipRenderer, isLoading = false, contentWhenEmpty, ariaLabel, ariaDescription }) => {
|
|
23
23
|
const containerRef = useRef(null);
|
|
24
24
|
const colors = useSeriesColorResolver(series);
|
|
25
25
|
const dimensions = useChartDimensions({
|
|
26
26
|
containerRef,
|
|
27
|
-
width,
|
|
27
|
+
width: showLegend && width !== void 0 && height !== void 0 ? Math.min(width, height) : width,
|
|
28
28
|
height,
|
|
29
29
|
fillWidth,
|
|
30
30
|
fillHeight,
|
|
@@ -133,6 +133,7 @@ var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRa
|
|
|
133
133
|
contentWhenEmpty,
|
|
134
134
|
showLegend,
|
|
135
135
|
legendItems,
|
|
136
|
+
legendMaxItems,
|
|
136
137
|
legendPlacement: ChartLegendPlacement.RIGHT,
|
|
137
138
|
plotOverlay: showCenter && !isEmpty ? /* @__PURE__ */ jsx(ChartDonutCenter, {
|
|
138
139
|
centerX: dimensions.margin.left + geometry.centerX,
|
|
@@ -203,6 +203,25 @@ export declare const CHART_TOOLTIP_MIN_WIDTH = 168;
|
|
|
203
203
|
export declare const CHART_TOOLTIP_MAX_WIDTH = 320;
|
|
204
204
|
/** Gap in px between the plot box and a side-placed legend. */
|
|
205
205
|
export declare const CHART_LEGEND_SIDE_GAP = 16;
|
|
206
|
+
/**
|
|
207
|
+
* Gap in px between entries in a horizontal legend.
|
|
208
|
+
*
|
|
209
|
+
* Also the number the fit computation adds between measured entries, so the
|
|
210
|
+
* CSS and the arithmetic cannot disagree — which is what makes the collapse
|
|
211
|
+
* exact rather than "usually right".
|
|
212
|
+
*/
|
|
213
|
+
export declare const CHART_LEGEND_COLUMN_GAP = 16;
|
|
214
|
+
/** Gap in px between entries in a vertical legend. Same contract as
|
|
215
|
+
* {@link CHART_LEGEND_COLUMN_GAP}: shared by the CSS and the fit arithmetic. */
|
|
216
|
+
export declare const CHART_LEGEND_VERTICAL_GAP = 8;
|
|
217
|
+
/**
|
|
218
|
+
* Ceiling on the collapsed-legend popover's height, in px.
|
|
219
|
+
*
|
|
220
|
+
* Roughly eight entries. Past that the list scrolls rather than growing into a
|
|
221
|
+
* popover taller than the chart it annotates — the cap on *visible* entries is
|
|
222
|
+
* the caller's `legendMaxItems`; this one only bounds the overflow list itself.
|
|
223
|
+
*/
|
|
224
|
+
export declare const CHART_LEGEND_OVERFLOW_MAX_HEIGHT = 208;
|
|
206
225
|
/**
|
|
207
226
|
* Approximate width of one CAPTION-size character.
|
|
208
227
|
*
|
package/dist/charts/constants.js
CHANGED
|
@@ -214,6 +214,25 @@ var CHART_TOOLTIP_MAX_WIDTH = 320;
|
|
|
214
214
|
/** Gap in px between the plot box and a side-placed legend. */
|
|
215
215
|
var CHART_LEGEND_SIDE_GAP = 16;
|
|
216
216
|
/**
|
|
217
|
+
* Gap in px between entries in a horizontal legend.
|
|
218
|
+
*
|
|
219
|
+
* Also the number the fit computation adds between measured entries, so the
|
|
220
|
+
* CSS and the arithmetic cannot disagree — which is what makes the collapse
|
|
221
|
+
* exact rather than "usually right".
|
|
222
|
+
*/
|
|
223
|
+
var CHART_LEGEND_COLUMN_GAP = 16;
|
|
224
|
+
/** Gap in px between entries in a vertical legend. Same contract as
|
|
225
|
+
* {@link CHART_LEGEND_COLUMN_GAP}: shared by the CSS and the fit arithmetic. */
|
|
226
|
+
var CHART_LEGEND_VERTICAL_GAP = 8;
|
|
227
|
+
/**
|
|
228
|
+
* Ceiling on the collapsed-legend popover's height, in px.
|
|
229
|
+
*
|
|
230
|
+
* Roughly eight entries. Past that the list scrolls rather than growing into a
|
|
231
|
+
* popover taller than the chart it annotates — the cap on *visible* entries is
|
|
232
|
+
* the caller's `legendMaxItems`; this one only bounds the overflow list itself.
|
|
233
|
+
*/
|
|
234
|
+
var CHART_LEGEND_OVERFLOW_MAX_HEIGHT = 208;
|
|
235
|
+
/**
|
|
217
236
|
* Approximate width of one CAPTION-size character.
|
|
218
237
|
*
|
|
219
238
|
* Axis sizing estimates label widths arithmetically rather than measuring the
|
|
@@ -261,4 +280,4 @@ var CHART_PALETTE_ORDER = [
|
|
|
261
280
|
ChartPalette.RED
|
|
262
281
|
];
|
|
263
282
|
//#endregion
|
|
264
|
-
export { AGGREGATED_SLICE_KEY, AUTO_MARGIN_LEFT_STEP, AXIS_TITLE_BAND, AXIS_TITLE_GAP, BAR_GAP_COMFORTABLE, BAR_GAP_MEDIUM, BAR_GAP_TIGHT, BAR_RADIUS, BAR_RADIUS_NARROW, BAR_WIDTH_RATIO, CAPTION_CHAR_WIDTH_PX, CATEGORY_AXIS_LABEL_GAP, CATEGORY_AXIS_LABEL_HEIGHT, CHART_LEGEND_SIDE_GAP, CHART_MARK_OPACITY_ACTIVE, CHART_MARK_OPACITY_MUTED, CHART_PALETTE_ORDER, CHART_RESTORE_DELAY_MS, CHART_TOOLTIP_MAX_WIDTH, CHART_TOOLTIP_MIN_WIDTH, CHART_TOOLTIP_OFFSET, CHART_TRANSITION_MS, DEFAULT_CHART_MARGIN, DEFAULT_LINE_STROKE_WIDTH, DEFAULT_VALUE_TICK_COUNT, GRID_LINE_BLEED, GROUP_GAP_COMFORTABLE, GROUP_GAP_MEDIUM, GROUP_GAP_TIGHT, LINE_AREA_OPACITY, LINE_POINT_RADIUS, MAX_AUTO_MARGIN_LEFT, MAX_BAR_WIDTH, MAX_GAP_SHARE, MIN_AUTO_MARGIN_LEFT, MIN_BARS_FOR_TIGHT_SPACING, MIN_BAR_LENGTH, MIN_CATEGORY_LABEL_GAP, NARROW_BAR_WIDTH, PIE_CHART_MARGIN, PIE_CORNER_RADIUS, PIE_DONUT_INNER_RATIO, PIE_MAX_AUTO_INNER_RATIO, PIE_MAX_INSET_SHARE, PIE_MIN_SLICE_SHARE, PIE_PAD_ANGLE, PIE_TOOLTIP_ANCHOR_INSET, STACK_SEGMENT_GAP, VALUE_AXIS_LABEL_HEIGHT, VALUE_AXIS_TICK_GAP, WIDTH_FOR_MEDIUM_SPACING, WIDTH_FOR_TIGHT_SPACING };
|
|
283
|
+
export { AGGREGATED_SLICE_KEY, AUTO_MARGIN_LEFT_STEP, AXIS_TITLE_BAND, AXIS_TITLE_GAP, BAR_GAP_COMFORTABLE, BAR_GAP_MEDIUM, BAR_GAP_TIGHT, BAR_RADIUS, BAR_RADIUS_NARROW, BAR_WIDTH_RATIO, CAPTION_CHAR_WIDTH_PX, CATEGORY_AXIS_LABEL_GAP, CATEGORY_AXIS_LABEL_HEIGHT, CHART_LEGEND_COLUMN_GAP, CHART_LEGEND_OVERFLOW_MAX_HEIGHT, CHART_LEGEND_SIDE_GAP, CHART_LEGEND_VERTICAL_GAP, CHART_MARK_OPACITY_ACTIVE, CHART_MARK_OPACITY_MUTED, CHART_PALETTE_ORDER, CHART_RESTORE_DELAY_MS, CHART_TOOLTIP_MAX_WIDTH, CHART_TOOLTIP_MIN_WIDTH, CHART_TOOLTIP_OFFSET, CHART_TRANSITION_MS, DEFAULT_CHART_MARGIN, DEFAULT_LINE_STROKE_WIDTH, DEFAULT_VALUE_TICK_COUNT, GRID_LINE_BLEED, GROUP_GAP_COMFORTABLE, GROUP_GAP_MEDIUM, GROUP_GAP_TIGHT, LINE_AREA_OPACITY, LINE_POINT_RADIUS, MAX_AUTO_MARGIN_LEFT, MAX_BAR_WIDTH, MAX_GAP_SHARE, MIN_AUTO_MARGIN_LEFT, MIN_BARS_FOR_TIGHT_SPACING, MIN_BAR_LENGTH, MIN_CATEGORY_LABEL_GAP, NARROW_BAR_WIDTH, PIE_CHART_MARGIN, PIE_CORNER_RADIUS, PIE_DONUT_INNER_RATIO, PIE_MAX_AUTO_INNER_RATIO, PIE_MAX_INSET_SHARE, PIE_MIN_SLICE_SHARE, PIE_PAD_ANGLE, PIE_TOOLTIP_ANCHOR_INSET, STACK_SEGMENT_GAP, VALUE_AXIS_LABEL_HEIGHT, VALUE_AXIS_TICK_GAP, WIDTH_FOR_MEDIUM_SPACING, WIDTH_FOR_TIGHT_SPACING };
|
package/dist/charts/types.d.ts
CHANGED
|
@@ -435,6 +435,16 @@ export interface BaseChartProps {
|
|
|
435
435
|
noTooltip?: boolean;
|
|
436
436
|
/** Show the legend beneath the plot. */
|
|
437
437
|
showLegend?: boolean;
|
|
438
|
+
/**
|
|
439
|
+
* Stricter cap on inline legend entries, on top of the automatic fit. The
|
|
440
|
+
* legend never outgrows the plot: a horizontal legend holds one line of the
|
|
441
|
+
* plot's width, a side-placed legend one column of the plot's height, and
|
|
442
|
+
* entries that would not fit collapse behind a "+N more" trigger whose
|
|
443
|
+
* tooltip lists them — still hoverable, so a collapsed series isolates
|
|
444
|
+
* exactly like a visible one. This prop only lowers the inline count
|
|
445
|
+
* further.
|
|
446
|
+
*/
|
|
447
|
+
legendMaxItems?: number;
|
|
438
448
|
/** Render the loading treatment instead of the data. */
|
|
439
449
|
isLoading?: boolean;
|
|
440
450
|
/** Shown when there is nothing to plot. Defaults to a centred "No data". */
|
package/dist/styles.css
CHANGED
|
@@ -41,10 +41,14 @@
|
|
|
41
41
|
.c1iaray{text-align:right;white-space:nowrap;}
|
|
42
42
|
.cz6jod1{position:absolute;left:var(--cz6jod1-0);top:var(--cz6jod1-1);width:var(--cz6jod1-2);height:var(--cz6jod1-2);-webkit-transform:translate(-50%, -50%);-moz-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%);pointer-events:none;text-align:center;}
|
|
43
43
|
.c1de5mqk{position:absolute;top:38%;left:50%;-webkit-transform:translate(-50%, -50%);-moz-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%);max-width:60%;padding:6px 8px;border:0.5px solid var(--c1de5mqk-0);border-radius:6px;background-color:var(--c1de5mqk-1);pointer-events:none;text-align:center;}
|
|
44
|
-
.cjirv6a{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:var(--cjirv6a-0);-ms-flex-direction:var(--cjirv6a-0);flex-direction:var(--cjirv6a-0);-webkit-box-flex-wrap:var(--cjirv6a-1);-webkit-
|
|
45
|
-
.c1armna5{display:-webkit-
|
|
46
|
-
.cgd77rv{display:-webkit-
|
|
44
|
+
.cjirv6a{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:var(--cjirv6a-0);-ms-flex-direction:var(--cjirv6a-0);flex-direction:var(--cjirv6a-0);-webkit-box-flex-wrap:nowrap;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-align-items:var(--cjirv6a-1);-webkit-box-align:var(--cjirv6a-1);-ms-flex-align:var(--cjirv6a-1);align-items:var(--cjirv6a-1);-webkit-box-pack:var(--cjirv6a-2);-ms-flex-pack:var(--cjirv6a-2);-webkit-justify-content:var(--cjirv6a-2);justify-content:var(--cjirv6a-2);gap:var(--cjirv6a-3);width:var(--cjirv6a-4);min-width:var(--cjirv6a-5);height:var(--cjirv6a-6);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;padding-top:var(--cjirv6a-7);padding-left:var(--cjirv6a-8);}.cjirv6a[data-active="true"] [data-state]{transition-delay:0ms;}
|
|
45
|
+
.c1armna5{position:absolute;visibility:hidden;pointer-events:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:var(--c1armna5-0);-ms-flex-direction:var(--c1armna5-0);flex-direction:var(--c1armna5-0);-webkit-box-flex-wrap:nowrap;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-align-items:var(--c1armna5-1);-webkit-box-align:var(--c1armna5-1);-ms-flex-align:var(--c1armna5-1);align-items:var(--c1armna5-1);gap:var(--c1armna5-2);width:-webkit-max-content;width:-moz-max-content;width:max-content;height:-webkit-max-content;height:-moz-max-content;height:max-content;white-space:nowrap;}
|
|
46
|
+
.cgd77rv{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;gap:8px;max-height:208px;overflow-y:auto;}.cgd77rv[data-active="true"] [data-state]{transition-delay:0ms;}
|
|
47
|
+
.cutidpi{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:6px;-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;appearance:none;background:none;border:0;padding:0;margin:0;font:inherit;color:inherit;cursor:default;border-radius:2px;opacity:1;-webkit-transition:opacity 100ms ease-in-out 200ms;transition:opacity 100ms ease-in-out 200ms;}.cutidpi[data-state="muted"]{opacity:0.1;}@media (prefers-reduced-motion: reduce){.cutidpi{-webkit-transition:none;transition:none;}}.cutidpi:focus-visible{outline:1.5px solid currentColor;outline-offset:2px;}
|
|
48
|
+
.ccpczg{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:6px;opacity:1;-webkit-transition:opacity 100ms ease-in-out 200ms;transition:opacity 100ms ease-in-out 200ms;}.ccpczg[data-state="muted"]{opacity:0.1;}@media (prefers-reduced-motion: reduce){.ccpczg{-webkit-transition:none;transition:none;}}
|
|
47
49
|
.cmbdg2q{width:var(--cmbdg2q-0);height:var(--cmbdg2q-0);border-radius:50%;background-color:var(--cmbdg2q-1);}
|
|
50
|
+
.tbnx4ok{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
|
|
51
|
+
.tjda4tq{display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content;padding:var(--tjda4tq-0);background-color:var(--tjda4tq-1);border:var(--tjda4tq-2);border-radius:5px;}
|
|
48
52
|
.s1yc7aow{position:relative;height:var(--s1yc7aow-0);width:100%;background-color:var(--s1yc7aow-1);border:0.5px solid var(--s1yc7aow-2);border-radius:4px;overflow:hidden;}
|
|
49
53
|
.p1sc05jm{position:absolute;top:0;left:0;height:100%;width:var(--p1sc05jm-0);background-color:var(--p1sc05jm-1);-webkit-animation:var(--p1sc05jm-2);animation:var(--p1sc05jm-2);-webkit-transition:width 0.075s ease-in-out;transition:width 0.075s ease-in-out;}@-webkit-keyframes pulse-p1sc05jm{0%,100%{opacity:0.9;}50%{opacity:0.6;}}@keyframes pulse-p1sc05jm{0%,100%{opacity:0.9;}50%{opacity:0.6;}}
|
|
50
54
|
.slaxlp8{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-flex-basis:auto;-ms-flex-preferred-size:auto;flex-basis:auto;min-width:140px;background-color:var(--slaxlp8-0);padding:12px 16px;border:0.5px solid var(--slaxlp8-1);border-radius:5px;}
|
|
@@ -85,8 +89,6 @@
|
|
|
85
89
|
.ixmrsxd{position:relative;width:var(--ixmrsxd-0);}
|
|
86
90
|
.l8jap54{position:absolute;left:var(--l8jap54-0);top:50%;-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;pointer-events:none;}
|
|
87
91
|
.t16cwjje{position:absolute;right:var(--t16cwjje-0);top:50%;-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;cursor:var(--t16cwjje-1);}
|
|
88
|
-
.tbnx4ok{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
|
|
89
|
-
.tjda4tq{display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content;padding:var(--tjda4tq-0);background-color:var(--tjda4tq-1);border:var(--tjda4tq-2);border-radius:5px;}
|
|
90
92
|
.s1902pw9{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:space-between;-webkit-justify-content:space-between;justify-content:space-between;padding:var(--s1902pw9-0);height:var(--s1902pw9-1);width:var(--s1902pw9-2);cursor:var(--s1902pw9-3);opacity:var(--s1902pw9-4);background:var(--s1902pw9-5);border:0.5px solid var(--s1902pw9-6);border-radius:5px;-webkit-transition:border-color 0.075s ease-in-out;transition:border-color 0.075s ease-in-out;}.s1902pw9:hover{border-color:var(--s1902pw9-7);}
|
|
91
93
|
.c179xo5d{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;padding:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
|
92
94
|
.d60emtx{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;width:36px;height:36px;border:none;border-radius:4px;cursor:var(--d60emtx-0);opacity:var(--d60emtx-1);background-color:var(--d60emtx-2);border:var(--d60emtx-3);-webkit-transition:all 0.075s ease-in-out;transition:all 0.075s ease-in-out;}.d60emtx:hover:not(:disabled){background-color:var(--d60emtx-4);}.d60emtx:focus{outline:none;}
|
|
@@ -141,7 +143,7 @@
|
|
|
141
143
|
.c1kvxq2r{position:absolute;inset:0;z-index:10;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;background-color:var(--c1kvxq2r-0);border:1.5px solid var(--c1kvxq2r-1);border-radius:4px;}
|
|
142
144
|
.cz6gl36{width:100%;height:12px;border-radius:4px;background-color:var(--cz6gl36-0);-webkit-animation:spreadsheetSkeletonPulse-cz6gl36 1.4s ease-in-out infinite;animation:spreadsheetSkeletonPulse-cz6gl36 1.4s ease-in-out infinite;}@-webkit-keyframes spreadsheetSkeletonPulse-cz6gl36{0%,100%{opacity:1;}50%{opacity:0.4;}}@keyframes spreadsheetSkeletonPulse-cz6gl36{0%,100%{opacity:1;}50%{opacity:0.4;}}@media (prefers-reduced-motion: reduce){.cz6gl36{-webkit-animation:none;animation:none;}}
|
|
143
145
|
.tldpbjd{width:var(--tldpbjd-0);height:var(--tldpbjd-1);position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;border-radius:5px;overflow:hidden;}
|
|
144
|
-
.t1ltwowk{-webkit-flex:1;-ms-flex:1;flex:1;overflow:auto;position:relative;min-height:0;overflow-anchor:none;overscroll-behavior:none;-webkit-overflow-scrolling:touch;padding-bottom:var(--t1ltwowk-0);}
|
|
146
|
+
.t1ltwowk{-webkit-flex:1;-ms-flex:1;flex:1;overflow:auto;position:relative;min-height:0;overflow-anchor:none;overscroll-behavior-x:none;-webkit-overflow-scrolling:touch;padding-bottom:var(--t1ltwowk-0);}
|
|
145
147
|
.sfoers7{width:100%;min-width:var(--sfoers7-0);border-collapse:separate;border-spacing:0;table-layout:fixed;}
|
|
146
148
|
.tmoy46{display:table-header-group;position:-webkit-sticky;position:sticky;top:0px;z-index:20;}
|
|
147
149
|
.tyata5l{display:block;position:relative;height:var(--tyata5l-0);}
|
|
@@ -162,7 +164,7 @@
|
|
|
162
164
|
.e11cd6rt{display:block;width:100%;padding:0;box-sizing:border-box;background-color:var(--e11cd6rt-0);border-bottom:var(--e11cd6rt-1);}
|
|
163
165
|
.eg2e964{position:-webkit-sticky;position:sticky;left:0;width:var(--eg2e964-0);display:-ms-grid;display:grid;-ms-grid-columns:var(--eg2e964-1);grid-template-columns:var(--eg2e964-1);box-sizing:border-box;}
|
|
164
166
|
.e1s9jmet{background-color:var(--e1s9jmet-0);border-right:0.5px solid var(--e1s9jmet-1);}
|
|
165
|
-
.e1yjhd51{min-width:0;width:100%;border-top:0.5px solid var(--e1yjhd51-0);box-sizing:border-box;
|
|
167
|
+
.e1yjhd51{min-width:0;width:100%;border-top:0.5px solid var(--e1yjhd51-0);box-sizing:border-box;}
|
|
166
168
|
.s10i74tu{font-weight:var(--s10i74tu-0);}
|
|
167
169
|
.sdpyy92{font-family:var(--sdpyy92-0);font-weight:var(--sdpyy92-1);font-size:var(--sdpyy92-2);border:0.5px solid var(--sdpyy92-3);border-radius:4px;padding:2px 4px;background-color:var(--sdpyy92-4);}
|
|
168
170
|
.et5f6jm{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}
|