@galaxy-io/dls 1.3.6 → 1.4.1
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.js +2 -2
- package/dist/avatar/AvatarShimmer.d.ts +1 -1
- package/dist/buttons/Button.js +2 -2
- package/dist/charts/BarChart.js +20 -43
- package/dist/charts/ChartAxis.d.ts +2 -11
- package/dist/charts/ChartAxis.js +4 -5
- package/dist/charts/ChartEmptyState.js +3 -3
- package/dist/charts/ChartFrame.js +1 -3
- package/dist/charts/ChartLegend.d.ts +1 -9
- package/dist/charts/ChartLegend.js +1 -27
- package/dist/charts/ChartPrimitives.d.ts +16 -15
- package/dist/charts/ChartPrimitives.js +74 -65
- package/dist/charts/ChartTooltip.js +19 -37
- package/dist/charts/LineChart.js +48 -69
- package/dist/charts/PieChart.js +19 -33
- package/dist/charts/constants.d.ts +0 -19
- package/dist/charts/constants.js +1 -78
- package/dist/charts/useChartInteraction.d.ts +11 -1
- package/dist/charts/useChartInteraction.js +7 -2
- package/dist/charts/useSeriesColorResolver.d.ts +0 -7
- package/dist/charts/useSeriesColorResolver.js +1 -2
- package/dist/dividers/HorizontalDivider.d.ts +4 -1
- package/dist/dividers/HorizontalDivider.js +28 -7
- package/dist/icons/GalaxyLogomark3D.js +4 -4
- package/dist/inputs/ColorInput.js +2 -2
- package/dist/inputs/CopyInput.js +4 -1
- package/dist/inputs/Input.d.ts +1 -1
- package/dist/inputs/MultiSelectInput.js +6 -6
- package/dist/inputs/SelectInput.js +6 -6
- package/dist/inputs/SwitcherInput.d.ts +11 -0
- package/dist/inputs/SwitcherInput.js +41 -0
- package/dist/shapes/Square.d.ts +6 -0
- package/dist/shapes/Square.js +25 -0
- package/dist/styles.css +28 -26
- package/dist/table/SpreadsheetCell.js +2 -2
- package/dist/table/SpreadsheetPrimitives.d.ts +6 -6
- package/dist/table/TablePrimitives.d.ts +6 -6
- package/dist/text/HotKeys.d.ts +20 -0
- package/dist/text/HotKeys.js +68 -0
- package/dist/toast/ToastProvider.js +3 -3
- package/dist/{animations → transform}/Fade.js +1 -1
- package/dist/transform/Flash.d.ts +3 -0
- package/dist/transform/Flash.js +14 -0
- package/dist/transform/Rotate.d.ts +8 -0
- package/dist/transform/Rotate.js +28 -0
- package/dist/{animations → transform}/ScaleFade.js +1 -1
- package/dist/transform/Spin.d.ts +7 -0
- package/dist/transform/Spin.js +20 -0
- package/package.json +4 -12
- package/dist/animations/Flashing.d.ts +0 -3
- package/dist/animations/Flashing.js +0 -14
- package/dist/animations/RotateWithTransition.d.ts +0 -8
- package/dist/animations/RotateWithTransition.js +0 -28
- package/dist/animations/SpinAnimation.d.ts +0 -7
- package/dist/animations/SpinAnimation.js +0 -20
- package/dist/animations/SpinVerticalAnimation.d.ts +0 -6
- package/dist/animations/SpinVerticalAnimation.js +0 -19
- package/dist/hotkeys/HotKeyBindings.d.ts +0 -7
- package/dist/hotkeys/HotKeyBindings.js +0 -23
- package/dist/hotkeys/HotKeySymbol.d.ts +0 -13
- package/dist/hotkeys/HotKeySymbol.js +0 -49
- package/dist/switcher/Switcher.d.ts +0 -11
- package/dist/switcher/Switcher.js +0 -41
- /package/dist/{animations → transform}/Fade.d.ts +0 -0
- /package/dist/{animations → transform}/ScaleFade.d.ts +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { withTheme } from "../theme/GalaxyTheme.js";
|
|
2
2
|
import { getCssSizeValue } from "../utils/linaria.js";
|
|
3
|
+
import Rotate from "../transform/Rotate.js";
|
|
3
4
|
import Text, { TextSize, TextVariant, TextWeight } from "../text/Text.js";
|
|
4
5
|
import FlexItem from "../containers/FlexItem.js";
|
|
5
6
|
import Icon, { IconVariant } from "../icons/Icon.js";
|
|
6
7
|
import FlexWrapper, { AlignItems, FlexDirection } from "../containers/FlexWrapper.js";
|
|
7
|
-
import RotateWithTransition from "../animations/RotateWithTransition.js";
|
|
8
8
|
import HorizontalDivider from "../dividers/HorizontalDivider.js";
|
|
9
9
|
/* empty css */
|
|
10
10
|
import { styled } from "@linaria/react";
|
|
@@ -107,7 +107,7 @@ var Accordion = ({ children, variant = "PRIMARY", size = "MEDIUM", icon, header,
|
|
|
107
107
|
}), /* @__PURE__ */ jsxs(FlexWrapper, {
|
|
108
108
|
alignItems: AlignItems.CENTER,
|
|
109
109
|
gap: 8,
|
|
110
|
-
children: [metric && metric, /* @__PURE__ */ jsx(
|
|
110
|
+
children: [metric && metric, /* @__PURE__ */ jsx(Rotate, {
|
|
111
111
|
isRotated: isOpen,
|
|
112
112
|
deg: -180,
|
|
113
113
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
@@ -7,7 +7,7 @@ export declare const StyledAvatarShimmer: import("react").ComponentType<Pick<imp
|
|
|
7
7
|
theme: import("../theme").Theme;
|
|
8
8
|
} & {
|
|
9
9
|
as?: React.ElementType;
|
|
10
|
-
}, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement
|
|
10
|
+
}, "$size" | "as" | keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
11
11
|
theme?: import("@callstack/react-theme-provider").$DeepPartial<import("../theme").Theme> | undefined;
|
|
12
12
|
}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<import("react").ComponentType<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
13
13
|
$size?: number;
|
package/dist/buttons/Button.js
CHANGED
|
@@ -83,10 +83,10 @@ var LabelWrapper = /*#__PURE__*/ styled("span")({
|
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
function getTextVariant(variant, activeTheme) {
|
|
86
|
-
return match(variant).with("PRIMARY", () => activeTheme === GalaxyTheme.DARK ? TextVariant.PRIMARY : TextVariant.PRIMARY_ALT).with("PRIMARY_ALT", () => TextVariant.PRIMARY_ALT).with("SECONDARY", () => TextVariant.PRIMARY).with("TERTIARY", () => TextVariant.PRIMARY).with("SUCCESS", () => TextVariant.PRIMARY).with("ERROR", () => TextVariant.PRIMARY).exhaustive();
|
|
86
|
+
return match(variant).with("PRIMARY", () => activeTheme === GalaxyTheme.DARK ? TextVariant.PRIMARY : TextVariant.PRIMARY_ALT).with("PRIMARY_ALT", () => TextVariant.PRIMARY_ALT).with("SECONDARY", () => TextVariant.PRIMARY).with("TERTIARY", () => TextVariant.PRIMARY).with("SUCCESS", () => activeTheme === GalaxyTheme.DARK ? TextVariant.PRIMARY : TextVariant.PRIMARY_ALT).with("ERROR", () => activeTheme === GalaxyTheme.DARK ? TextVariant.PRIMARY : TextVariant.PRIMARY_ALT).exhaustive();
|
|
87
87
|
}
|
|
88
88
|
function getIconVariant(variant, activeTheme) {
|
|
89
|
-
return match(variant).with("PRIMARY", () => activeTheme === GalaxyTheme.DARK ? IconVariant.PRIMARY : IconVariant.PRIMARY_ALT).with("PRIMARY_ALT", () => IconVariant.PRIMARY_ALT).with("SECONDARY", () => IconVariant.PRIMARY).with("TERTIARY", () => IconVariant.PRIMARY).with("SUCCESS", () => IconVariant.PRIMARY).with("ERROR", () => IconVariant.PRIMARY).exhaustive();
|
|
89
|
+
return match(variant).with("PRIMARY", () => activeTheme === GalaxyTheme.DARK ? IconVariant.PRIMARY : IconVariant.PRIMARY_ALT).with("PRIMARY_ALT", () => IconVariant.PRIMARY_ALT).with("SECONDARY", () => IconVariant.PRIMARY).with("TERTIARY", () => IconVariant.PRIMARY).with("SUCCESS", () => activeTheme === GalaxyTheme.DARK ? IconVariant.PRIMARY : IconVariant.PRIMARY_ALT).with("ERROR", () => activeTheme === GalaxyTheme.DARK ? IconVariant.PRIMARY : IconVariant.PRIMARY_ALT).exhaustive();
|
|
90
90
|
}
|
|
91
91
|
var BUTTON_SIZE_TO_TEXT_SIZE_MAP = {
|
|
92
92
|
["SMALL"]: TextSize.BODY_SM,
|
package/dist/charts/BarChart.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { BarChartNormalization, ChartKind, ChartTargetShape } from "./types.js";
|
|
2
|
-
import { SKELETON_BAR_GROUPS } from "./constants.js";
|
|
3
2
|
import { useSeriesColorResolver } from "./useSeriesColorResolver.js";
|
|
4
3
|
import { useChartInteraction } from "./useChartInteraction.js";
|
|
5
4
|
import { useCartesianChartLayout } from "./useCartesianChartLayout.js";
|
|
6
5
|
import { getBarLegendItems } from "./barChartLegend.js";
|
|
7
6
|
import { buildBarChartGeometry, getBarValueDomain, roundedRectPath } from "./barChartGeometry.js";
|
|
8
|
-
import { ChartBarPath
|
|
7
|
+
import { ChartBarPath } from "./ChartPrimitives.js";
|
|
9
8
|
import ChartFrame from "./ChartFrame.js";
|
|
10
9
|
import { ChartCategoryAxis, ChartValueAxis } from "./ChartAxis.js";
|
|
11
10
|
import { useCallback, useMemo, useRef } from "react";
|
|
12
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
12
|
//#region src/charts/BarChart.tsx
|
|
14
13
|
/**
|
|
15
14
|
* Bar chart with a three-level data model.
|
|
@@ -43,29 +42,9 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
43
42
|
valueFormatter,
|
|
44
43
|
valueUnit
|
|
45
44
|
]);
|
|
46
|
-
/**
|
|
47
|
-
* The data actually rendered: the caller's, or the skeleton's while loading.
|
|
48
|
-
*
|
|
49
|
-
* Loading replaces the chart wholesale with ghost bars pushed through the
|
|
50
|
-
* real geometry pipeline, so the skeleton gets the true radii and spacing.
|
|
51
|
-
* The cast is safe because nothing derived from skeleton data ever surfaces:
|
|
52
|
-
* labels are hidden, targets are off, the legend shows stubs, and the
|
|
53
|
-
* accessible name says "loading" instead of counting.
|
|
54
|
-
*/
|
|
55
|
-
const displayGroups = useMemo(() => isLoading ? SKELETON_BAR_GROUPS.map((values, groupIndex) => ({
|
|
56
|
-
label: `skeleton-${groupIndex}`,
|
|
57
|
-
bars: values.map((value, barIndex) => ({
|
|
58
|
-
metric: `skeleton-${barIndex}`,
|
|
59
|
-
components: [{
|
|
60
|
-
key: "skeleton",
|
|
61
|
-
label: "",
|
|
62
|
-
value
|
|
63
|
-
}]
|
|
64
|
-
}))
|
|
65
|
-
})) : groups, [isLoading, groups]);
|
|
66
45
|
const { dimensions, domain, valueTicks, formatValue, formatLabel, formatAxisValue } = useCartesianChartLayout({
|
|
67
46
|
containerRef,
|
|
68
|
-
rawDomain: useMemo(() => getBarValueDomain(
|
|
47
|
+
rawDomain: useMemo(() => getBarValueDomain(groups, normalization), [groups, normalization]),
|
|
69
48
|
valueDomain,
|
|
70
49
|
width,
|
|
71
50
|
height,
|
|
@@ -90,10 +69,10 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
90
69
|
* takes its metric's colour. Applying the metric colour to a stack would
|
|
91
70
|
* paint every segment identically.
|
|
92
71
|
*/
|
|
93
|
-
const isStacked = useMemo(() =>
|
|
94
|
-
const resolveColor = useCallback(({ metric, componentIndex, isStacked: barIsStacked, explicit }) =>
|
|
72
|
+
const isStacked = useMemo(() => groups.some((group) => group.bars.some((bar) => bar.components.length > 1)), [groups]);
|
|
73
|
+
const resolveColor = useCallback(({ metric, componentIndex, isStacked: barIsStacked, explicit }) => barIsStacked ? colors.resolveByIndex(componentIndex, explicit) : colors.resolve(metric, explicit), [colors]);
|
|
95
74
|
const geometry = useMemo(() => buildBarChartGeometry({
|
|
96
|
-
groups
|
|
75
|
+
groups,
|
|
97
76
|
plotWidth,
|
|
98
77
|
plotHeight,
|
|
99
78
|
normalization,
|
|
@@ -101,7 +80,7 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
101
80
|
domain,
|
|
102
81
|
resolveColor
|
|
103
82
|
}), [
|
|
104
|
-
|
|
83
|
+
groups,
|
|
105
84
|
plotWidth,
|
|
106
85
|
plotHeight,
|
|
107
86
|
normalization,
|
|
@@ -109,7 +88,7 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
109
88
|
domain,
|
|
110
89
|
resolveColor
|
|
111
90
|
]);
|
|
112
|
-
const isEmpty =
|
|
91
|
+
const isEmpty = groups.length === 0;
|
|
113
92
|
const legendItems = useMemo(() => getBarLegendItems({
|
|
114
93
|
isStacked,
|
|
115
94
|
series,
|
|
@@ -125,7 +104,8 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
125
104
|
const interaction = useChartInteraction({
|
|
126
105
|
categoryCount: geometry.bands.length,
|
|
127
106
|
seriesKeys: legendKeys,
|
|
128
|
-
disabled: noTooltip || isLoading || isEmpty
|
|
107
|
+
disabled: noTooltip || isLoading || isEmpty,
|
|
108
|
+
isLoading
|
|
129
109
|
});
|
|
130
110
|
const buildCategoryTooltip = useCallback((index) => {
|
|
131
111
|
const band = geometry.bands[index];
|
|
@@ -160,14 +140,6 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
160
140
|
width: band.width,
|
|
161
141
|
height: band.height
|
|
162
142
|
})), [geometry.bands]);
|
|
163
|
-
const marks = geometry.rects.map((rect) => /* @__PURE__ */ jsx(ChartBarPath, {
|
|
164
|
-
d: roundedRectPath(rect.x, rect.y, rect.width, rect.height, rect.radius, rect.corners),
|
|
165
|
-
fill: rect.color,
|
|
166
|
-
"data-state": interaction.getMarkState({
|
|
167
|
-
categoryIndex: rect.groupIndex,
|
|
168
|
-
seriesKey: isStacked ? rect.componentKey : rect.metric
|
|
169
|
-
})
|
|
170
|
-
}, rect.id));
|
|
171
143
|
return /* @__PURE__ */ jsx(ChartFrame, {
|
|
172
144
|
containerRef,
|
|
173
145
|
dimensions,
|
|
@@ -178,7 +150,7 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
178
150
|
categoryCount: groups.length,
|
|
179
151
|
ariaLabel,
|
|
180
152
|
ariaDescription,
|
|
181
|
-
axes: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ChartValueAxis, {
|
|
153
|
+
axes: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ChartValueAxis, {
|
|
182
154
|
ticks: valueTicks,
|
|
183
155
|
scale: geometry.valueScale,
|
|
184
156
|
plotWidth,
|
|
@@ -186,17 +158,15 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
186
158
|
marginLeft: dimensions.margin.left,
|
|
187
159
|
formatter: formatAxisValue,
|
|
188
160
|
showGrid,
|
|
189
|
-
showLabels: !isLoading,
|
|
190
161
|
title: valueAxisTitle
|
|
191
162
|
}), /* @__PURE__ */ jsx(ChartCategoryAxis, {
|
|
192
|
-
labels:
|
|
163
|
+
labels: groups.map((group) => group.label),
|
|
193
164
|
positions: categoryPositions,
|
|
194
165
|
step: categoryStep,
|
|
195
166
|
plotWidth,
|
|
196
167
|
plotHeight,
|
|
197
168
|
formatter: formatLabel,
|
|
198
169
|
mode: categoryLabelMode,
|
|
199
|
-
showLabels: !isLoading,
|
|
200
170
|
title: categoryAxisTitle
|
|
201
171
|
})] }),
|
|
202
172
|
noTooltip,
|
|
@@ -209,7 +179,14 @@ var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRa
|
|
|
209
179
|
contentWhenEmpty,
|
|
210
180
|
showLegend,
|
|
211
181
|
legendItems,
|
|
212
|
-
children:
|
|
182
|
+
children: geometry.rects.map((rect) => /* @__PURE__ */ jsx(ChartBarPath, {
|
|
183
|
+
d: roundedRectPath(rect.x, rect.y, rect.width, rect.height, rect.radius, rect.corners),
|
|
184
|
+
fill: rect.color,
|
|
185
|
+
"data-state": interaction.getMarkState({
|
|
186
|
+
categoryIndex: rect.groupIndex,
|
|
187
|
+
seriesKey: isStacked ? rect.componentKey : rect.metric
|
|
188
|
+
})
|
|
189
|
+
}, rect.id))
|
|
213
190
|
});
|
|
214
191
|
};
|
|
215
192
|
//#endregion
|
|
@@ -22,13 +22,6 @@ interface ChartValueAxisProps {
|
|
|
22
22
|
plotHeight: number;
|
|
23
23
|
formatter: ChartValueFormatter;
|
|
24
24
|
showGrid?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Render the tick labels and title.
|
|
27
|
-
*
|
|
28
|
-
* Off while the chart is loading: the grid keeps the plot's structure, but
|
|
29
|
-
* numbers derived from placeholder data would read as data.
|
|
30
|
-
*/
|
|
31
|
-
showLabels?: boolean;
|
|
32
25
|
/**
|
|
33
26
|
* Rotated title in the left gutter.
|
|
34
27
|
*
|
|
@@ -37,7 +30,7 @@ interface ChartValueAxisProps {
|
|
|
37
30
|
*/
|
|
38
31
|
title?: string;
|
|
39
32
|
}
|
|
40
|
-
export declare const ChartValueAxis: ({ ticks, scale, plotWidth, plotHeight, marginLeft, formatter, showGrid,
|
|
33
|
+
export declare const ChartValueAxis: ({ ticks, scale, plotWidth, plotHeight, marginLeft, formatter, showGrid, title, }: ChartValueAxisProps) => import("react").JSX.Element;
|
|
41
34
|
interface ChartCategoryAxisProps {
|
|
42
35
|
labels: string[];
|
|
43
36
|
/** Left edge of each category's slot, in plot coordinates. */
|
|
@@ -49,8 +42,6 @@ interface ChartCategoryAxisProps {
|
|
|
49
42
|
plotHeight: number;
|
|
50
43
|
formatter: ChartLabelFormatter;
|
|
51
44
|
mode?: ChartCategoryLabelMode;
|
|
52
|
-
/** Render the labels and title. Off while loading — see the value axis. */
|
|
53
|
-
showLabels?: boolean;
|
|
54
45
|
/**
|
|
55
46
|
* Title below the tick labels.
|
|
56
47
|
*
|
|
@@ -58,5 +49,5 @@ interface ChartCategoryAxisProps {
|
|
|
58
49
|
*/
|
|
59
50
|
title?: string;
|
|
60
51
|
}
|
|
61
|
-
export declare const ChartCategoryAxis: ({ labels, positions, step, plotWidth, plotHeight, formatter, mode,
|
|
52
|
+
export declare const ChartCategoryAxis: ({ labels, positions, step, plotWidth, plotHeight, formatter, mode, title, }: ChartCategoryAxisProps) => import("react").JSX.Element;
|
|
62
53
|
export {};
|
package/dist/charts/ChartAxis.js
CHANGED
|
@@ -6,7 +6,7 @@ import { getCategoryLabelStride } from "./chartScales.js";
|
|
|
6
6
|
import { ChartAxisLabelBox, ChartGridLine } from "./ChartPrimitives.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/charts/ChartAxis.tsx
|
|
9
|
-
var ChartValueAxis = ({ ticks, scale, plotWidth, plotHeight, marginLeft, formatter, showGrid = true,
|
|
9
|
+
var ChartValueAxis = ({ ticks, scale, plotWidth, plotHeight, marginLeft, formatter, showGrid = true, title }) => {
|
|
10
10
|
const titleBand = title ? 26 : 0;
|
|
11
11
|
const labelWidth = Math.max(0, marginLeft - titleBand - 12);
|
|
12
12
|
return /* @__PURE__ */ jsxs("g", {
|
|
@@ -18,7 +18,7 @@ var ChartValueAxis = ({ ticks, scale, plotWidth, plotHeight, marginLeft, formatt
|
|
|
18
18
|
x2: plotWidth + 12,
|
|
19
19
|
y1: 0,
|
|
20
20
|
y2: 0
|
|
21
|
-
}),
|
|
21
|
+
}), labelWidth > 0 && /* @__PURE__ */ jsx(ChartAxisLabelBox, {
|
|
22
22
|
x: -marginLeft + titleBand,
|
|
23
23
|
y: -20 / 2,
|
|
24
24
|
width: labelWidth,
|
|
@@ -37,7 +37,7 @@ var ChartValueAxis = ({ ticks, scale, plotWidth, plotHeight, marginLeft, formatt
|
|
|
37
37
|
})
|
|
38
38
|
})
|
|
39
39
|
})]
|
|
40
|
-
}, tick)),
|
|
40
|
+
}, tick)), title && /* @__PURE__ */ jsx("g", {
|
|
41
41
|
transform: `translate(${-marginLeft + 18 / 2}, ${plotHeight / 2}) rotate(-90)`,
|
|
42
42
|
children: /* @__PURE__ */ jsx(ChartAxisLabelBox, {
|
|
43
43
|
x: -plotHeight / 2,
|
|
@@ -61,8 +61,7 @@ var ChartValueAxis = ({ ticks, scale, plotWidth, plotHeight, marginLeft, formatt
|
|
|
61
61
|
})]
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
-
var ChartCategoryAxis = ({ labels, positions, step, plotWidth, plotHeight, formatter, mode = ChartCategoryLabelMode.AUTO,
|
|
65
|
-
if (!showLabels) return null;
|
|
64
|
+
var ChartCategoryAxis = ({ labels, positions, step, plotWidth, plotHeight, formatter, mode = ChartCategoryLabelMode.AUTO, title }) => {
|
|
66
65
|
const formatted = labels.map(formatter);
|
|
67
66
|
const stride = mode === ChartCategoryLabelMode.AUTO ? getCategoryLabelStride(formatted, step) : 1;
|
|
68
67
|
const labelWidth = step * stride;
|
|
@@ -19,9 +19,9 @@ var ChartEmptyState = ({ content }) => /* @__PURE__ */ jsx(ChartEmptyOverlay, {
|
|
|
19
19
|
justifyContent: JustifyContent.CENTER,
|
|
20
20
|
alignItems: AlignItems.CENTER,
|
|
21
21
|
children: /* @__PURE__ */ jsx(Text, {
|
|
22
|
-
size: TextSize.
|
|
23
|
-
variant: TextVariant.
|
|
24
|
-
children: "No data"
|
|
22
|
+
size: TextSize.BODY_SM,
|
|
23
|
+
variant: TextVariant.SECONDARY,
|
|
24
|
+
children: "No data available"
|
|
25
25
|
})
|
|
26
26
|
})
|
|
27
27
|
});
|
|
@@ -22,8 +22,7 @@ var ChartFrame = ({ containerRef, dimensions, fillWidth, fillHeight, interaction
|
|
|
22
22
|
* showing three. The two charts previously counted different things for the
|
|
23
23
|
* same situation, which is the drift this removes.
|
|
24
24
|
*/
|
|
25
|
-
const
|
|
26
|
-
const resolvedAriaLabel = ariaLabel ?? (isLoading ? `${kindLabel} chart, loading` : 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());
|
|
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();
|
|
27
26
|
const tooltipModel = useMemo(() => noTooltip || interaction.activeIndex === null ? null : buildCategoryTooltip(interaction.activeIndex), [
|
|
28
27
|
noTooltip,
|
|
29
28
|
buildCategoryTooltip,
|
|
@@ -122,7 +121,6 @@ var ChartFrame = ({ containerRef, dimensions, fillWidth, fillHeight, interaction
|
|
|
122
121
|
items: legendItems,
|
|
123
122
|
inset: legendInset ?? (legendRight ? 16 : margin.left),
|
|
124
123
|
vertical: legendRight,
|
|
125
|
-
isLoading,
|
|
126
124
|
hoveredKey: interaction.hoveredSeriesKey,
|
|
127
125
|
onItemEnter: interaction.onSeriesEnter,
|
|
128
126
|
onItemLeave: interaction.onSeriesLeave
|
|
@@ -7,14 +7,6 @@ interface ChartLegendProps {
|
|
|
7
7
|
hoveredKey?: string | null;
|
|
8
8
|
/** Stack entries in a column — the side-placed layout. */
|
|
9
9
|
vertical?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Render shimmer stubs instead of items.
|
|
12
|
-
*
|
|
13
|
-
* Keeps the legend's space reserved while the chart shows its skeleton, so
|
|
14
|
-
* data arriving doesn't shift the layout — which matters most beside a pie,
|
|
15
|
-
* where the legend's width decides the plot box's.
|
|
16
|
-
*/
|
|
17
|
-
isLoading?: boolean;
|
|
18
10
|
/**
|
|
19
11
|
* Supplying these makes the legend interactive. Omit them and it renders as
|
|
20
12
|
* inert text, with no button semantics for a screen reader to announce.
|
|
@@ -33,5 +25,5 @@ interface ChartLegendProps {
|
|
|
33
25
|
* Isolation only changes opacity, so the domain is untouched and the numbers
|
|
34
26
|
* keep meaning what they did.
|
|
35
27
|
*/
|
|
36
|
-
declare const ChartLegend: ({ items, inset, hoveredKey, vertical,
|
|
28
|
+
declare const ChartLegend: ({ items, inset, hoveredKey, vertical, onItemEnter, onItemLeave, }: ChartLegendProps) => import("react").JSX.Element | null;
|
|
37
29
|
export default ChartLegend;
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import Text, { TextSize } from "../text/Text.js";
|
|
2
|
-
import TextShimmer from "../text/TextShimmer.js";
|
|
3
2
|
import Circle from "../shapes/Circle.js";
|
|
4
3
|
import { ChartMarkState } from "./types.js";
|
|
5
4
|
import { ChartLegendItemButton, ChartLegendItemStatic, ChartLegendRow } from "./ChartPrimitives.js";
|
|
6
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
//#region src/charts/ChartLegend.tsx
|
|
8
7
|
/**
|
|
9
|
-
* Stub label widths in px, staggered so the placeholder reads as a legend
|
|
10
|
-
* rather than a repeated block. Three entries: enough to hold a legend's
|
|
11
|
-
* space without promising a series count.
|
|
12
|
-
*/
|
|
13
|
-
var SKELETON_LABEL_WIDTHS = [
|
|
14
|
-
40,
|
|
15
|
-
56,
|
|
16
|
-
48
|
|
17
|
-
];
|
|
18
|
-
/**
|
|
19
8
|
* Legend for the chart components.
|
|
20
9
|
*
|
|
21
10
|
* Hovering or focusing an entry isolates its series; leaving releases it.
|
|
@@ -26,22 +15,7 @@ var SKELETON_LABEL_WIDTHS = [
|
|
|
26
15
|
* Isolation only changes opacity, so the domain is untouched and the numbers
|
|
27
16
|
* keep meaning what they did.
|
|
28
17
|
*/
|
|
29
|
-
var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false,
|
|
30
|
-
if (isLoading) return /* @__PURE__ */ jsx(ChartLegendRow, {
|
|
31
|
-
$inset: inset,
|
|
32
|
-
$vertical: vertical,
|
|
33
|
-
"data-active": "false",
|
|
34
|
-
children: SKELETON_LABEL_WIDTHS.map((labelWidth, index) => /* @__PURE__ */ jsxs(ChartLegendItemStatic, {
|
|
35
|
-
"data-state": ChartMarkState.ACTIVE,
|
|
36
|
-
children: [/* @__PURE__ */ jsx(TextShimmer, {
|
|
37
|
-
height: 8,
|
|
38
|
-
width: 8
|
|
39
|
-
}), /* @__PURE__ */ jsx(TextShimmer, {
|
|
40
|
-
height: 10,
|
|
41
|
-
width: labelWidth
|
|
42
|
-
})]
|
|
43
|
-
}, index))
|
|
44
|
-
});
|
|
18
|
+
var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, onItemEnter, onItemLeave }) => {
|
|
45
19
|
if (items.length === 0) return null;
|
|
46
20
|
const isInteractive = Boolean(onItemEnter);
|
|
47
21
|
const activeKey = hoveredKey;
|
|
@@ -55,19 +55,6 @@ export declare const ChartLinePath: import("@linaria/react").StyledComponent<imp
|
|
|
55
55
|
export declare const ChartAreaPath: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGPathElement> & Record<never, unknown>>;
|
|
56
56
|
export declare const ChartPointCircle: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGCircleElement> & Record<never, unknown>>;
|
|
57
57
|
export declare const ChartArcPath: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGPathElement> & Record<never, unknown>>;
|
|
58
|
-
/**
|
|
59
|
-
* Wraps the marks while the chart is loading.
|
|
60
|
-
*
|
|
61
|
-
* Only motion lives here — the slow pulse shared with `TextShimmer` and
|
|
62
|
-
* `AvatarShimmer`, so a loading chart breathes in step with every other
|
|
63
|
-
* skeleton on the page. Colour arrives through the series resolver like any
|
|
64
|
-
* other mark colour, which is what lets bars and arcs ghost by `fill` and
|
|
65
|
-
* lines by `stroke` without per-shape CSS here.
|
|
66
|
-
*
|
|
67
|
-
* Under reduced motion the pulse pins at its midpoint rather than sitting at
|
|
68
|
-
* full strength, so the chart still reads as a placeholder and not as data.
|
|
69
|
-
*/
|
|
70
|
-
export declare const ChartSkeletonGroup: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGGElement> & Record<never, unknown>>;
|
|
71
58
|
/**
|
|
72
59
|
* Per-category hit target, rendered above the marks.
|
|
73
60
|
*
|
|
@@ -145,7 +132,7 @@ export declare const ChartTooltipPositioner: import("react").ComponentType<Pick<
|
|
|
145
132
|
theme: import("../theme").Theme;
|
|
146
133
|
} & {
|
|
147
134
|
as?: React.ElementType;
|
|
148
|
-
}, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement> | "
|
|
135
|
+
}, "as" | keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement> | "$x" | "$y" | "$isVisible"> & {
|
|
149
136
|
theme?: import("@callstack/react-theme-provider").$DeepPartial<import("../theme").Theme> | undefined;
|
|
150
137
|
}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<import("react").ComponentType<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
151
138
|
$x: number;
|
|
@@ -166,6 +153,20 @@ export declare const ChartTooltipPositioner: import("react").ComponentType<Pick<
|
|
|
166
153
|
} & {
|
|
167
154
|
as?: React.ElementType;
|
|
168
155
|
}>, {}>;
|
|
156
|
+
/**
|
|
157
|
+
* Two-column tooltip body: label column, one gutter, value column.
|
|
158
|
+
*
|
|
159
|
+
* A grid rather than per-row `space-between`, so every row shares the same
|
|
160
|
+
* column boundary: the value column is sized by the widest value and every
|
|
161
|
+
* value is guaranteed its full width, while the labels take the remainder and
|
|
162
|
+
* all ellipsize against the same edge. Per-row flex made the label→value gap
|
|
163
|
+
* drift with each label's length, which read as misalignment down the list.
|
|
164
|
+
*/
|
|
165
|
+
export declare const ChartTooltipGrid: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
166
|
+
/** Swatch + label. `min-width: 0` is what lets the label actually ellipsize. */
|
|
167
|
+
export declare const ChartTooltipLabelCell: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
168
|
+
/** Right-aligned and never wrapped — the value always shows in full. */
|
|
169
|
+
export declare const ChartTooltipValueCell: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
169
170
|
/**
|
|
170
171
|
* Content well inside a donut hole.
|
|
171
172
|
*
|
|
@@ -187,7 +188,7 @@ export declare const ChartEmptyOverlay: import("react").ComponentType<Pick<impor
|
|
|
187
188
|
theme: import("../theme").Theme;
|
|
188
189
|
} & {
|
|
189
190
|
as?: React.ElementType;
|
|
190
|
-
}, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement
|
|
191
|
+
}, "as" | keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
191
192
|
theme?: import("@callstack/react-theme-provider").$DeepPartial<import("../theme").Theme> | undefined;
|
|
192
193
|
}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<import("react").ComponentType<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
193
194
|
theme: import("../theme").Theme;
|