@galaxy-io/dls 1.3.6 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +18 -41
- package/dist/charts/ChartAxis.d.ts +2 -11
- package/dist/charts/ChartAxis.js +4 -5
- 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 +2 -15
- package/dist/charts/ChartPrimitives.js +48 -65
- package/dist/charts/ChartTooltip.js +4 -9
- package/dist/charts/LineChart.js +46 -67
- 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/inputs/CopyInput.js +4 -1
- package/dist/inputs/Input.d.ts +1 -1
- package/dist/inputs/MultiSelectInput.js +3 -3
- package/dist/inputs/SelectInput.js +3 -3
- 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 +25 -26
- 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 +1 -1
- 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
package/dist/charts/LineChart.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ChartKind, ChartTargetShape, LineChartCurve } from "./types.js";
|
|
2
|
-
import { LINE_AREA_OPACITY, LINE_POINT_RADIUS
|
|
2
|
+
import { LINE_AREA_OPACITY, LINE_POINT_RADIUS } from "./constants.js";
|
|
3
3
|
import { useSeriesColorResolver } from "./useSeriesColorResolver.js";
|
|
4
4
|
import { useChartInteraction } from "./useChartInteraction.js";
|
|
5
5
|
import { useCartesianChartLayout } from "./useCartesianChartLayout.js";
|
|
6
6
|
import { buildLineChartGeometry, getLineValueDomain } from "./lineChartGeometry.js";
|
|
7
|
-
import { ChartAreaPath, ChartCursorLine, ChartLinePath, ChartPointCircle
|
|
7
|
+
import { ChartAreaPath, ChartCursorLine, ChartLinePath, ChartPointCircle } from "./ChartPrimitives.js";
|
|
8
8
|
import ChartFrame from "./ChartFrame.js";
|
|
9
9
|
import { ChartCategoryAxis, ChartValueAxis } from "./ChartAxis.js";
|
|
10
10
|
import { useCallback, useMemo, useRef } from "react";
|
|
@@ -21,27 +21,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
21
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 }) => {
|
|
22
22
|
const containerRef = useRef(null);
|
|
23
23
|
const colors = useSeriesColorResolver(series);
|
|
24
|
-
/**
|
|
25
|
-
* The data actually rendered: the caller's, or ghost lines while loading.
|
|
26
|
-
*
|
|
27
|
-
* Loading replaces the chart wholesale with skeleton data pushed through the
|
|
28
|
-
* real geometry pipeline — offset lines drawn with their area fills, so the
|
|
29
|
-
* placeholder has the layered depth of a real multi-series chart. The cast is
|
|
30
|
-
* safe because nothing derived from it ever surfaces: labels are hidden,
|
|
31
|
-
* targets are off, the legend shows stubs, and the accessible name says
|
|
32
|
-
* "loading" instead of counting.
|
|
33
|
-
*/
|
|
34
|
-
const displayLines = useMemo(() => isLoading ? SKELETON_LINE_SERIES.map((values, lineIndex) => ({
|
|
35
|
-
metric: `skeleton-${lineIndex}`,
|
|
36
|
-
showArea: true,
|
|
37
|
-
points: values.map((value, index) => ({
|
|
38
|
-
x: `skeleton-${index}`,
|
|
39
|
-
y: value
|
|
40
|
-
}))
|
|
41
|
-
})) : lines, [isLoading, lines]);
|
|
42
24
|
const { dimensions, domain, valueTicks, formatValue, formatLabel } = useCartesianChartLayout({
|
|
43
25
|
containerRef,
|
|
44
|
-
rawDomain: useMemo(() => getLineValueDomain(
|
|
26
|
+
rawDomain: useMemo(() => getLineValueDomain(lines), [lines]),
|
|
45
27
|
valueDomain,
|
|
46
28
|
width,
|
|
47
29
|
height,
|
|
@@ -56,10 +38,10 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
56
38
|
categoryAxisTitle
|
|
57
39
|
});
|
|
58
40
|
const { plotWidth, plotHeight } = dimensions;
|
|
59
|
-
const resolveColor = useCallback(({ metric }) =>
|
|
41
|
+
const resolveColor = useCallback(({ metric }) => colors.resolve(metric), [colors]);
|
|
60
42
|
const geometry = useMemo(() => buildLineChartGeometry({
|
|
61
|
-
lines
|
|
62
|
-
categories
|
|
43
|
+
lines,
|
|
44
|
+
categories,
|
|
63
45
|
plotWidth,
|
|
64
46
|
plotHeight,
|
|
65
47
|
curve,
|
|
@@ -67,8 +49,7 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
67
49
|
strokeWidth,
|
|
68
50
|
resolveColor
|
|
69
51
|
}), [
|
|
70
|
-
|
|
71
|
-
isLoading,
|
|
52
|
+
lines,
|
|
72
53
|
categories,
|
|
73
54
|
plotWidth,
|
|
74
55
|
plotHeight,
|
|
@@ -77,7 +58,7 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
77
58
|
strokeWidth,
|
|
78
59
|
resolveColor
|
|
79
60
|
]);
|
|
80
|
-
const isEmpty = geometry.categories.length === 0 ||
|
|
61
|
+
const isEmpty = geometry.categories.length === 0 || lines.length === 0;
|
|
81
62
|
const legendItems = useMemo(() => colors.keys.map((metric) => ({
|
|
82
63
|
key: metric,
|
|
83
64
|
label: series[metric].label,
|
|
@@ -87,7 +68,8 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
87
68
|
const interaction = useChartInteraction({
|
|
88
69
|
categoryCount: geometry.columns.length,
|
|
89
70
|
seriesKeys: legendKeys,
|
|
90
|
-
disabled: noTooltip || isLoading || isEmpty
|
|
71
|
+
disabled: noTooltip || isLoading || isEmpty,
|
|
72
|
+
isLoading
|
|
91
73
|
});
|
|
92
74
|
const activeColumn = interaction.activeIndex === null ? null : geometry.columns[interaction.activeIndex];
|
|
93
75
|
const buildCategoryTooltip = useCallback((index) => {
|
|
@@ -121,42 +103,7 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
121
103
|
width: column.bandWidth,
|
|
122
104
|
height: plotHeight
|
|
123
105
|
})), [geometry.columns, plotHeight]);
|
|
124
|
-
|
|
125
|
-
geometry.paths.map((linePath) => linePath.areaPath ? /* @__PURE__ */ jsx(ChartAreaPath, {
|
|
126
|
-
d: linePath.areaPath,
|
|
127
|
-
fill: linePath.color,
|
|
128
|
-
fillOpacity: LINE_AREA_OPACITY,
|
|
129
|
-
"data-state": interaction.getMarkState({ seriesKey: linePath.metric })
|
|
130
|
-
}, `${linePath.id}:area`) : null),
|
|
131
|
-
showCursor && activeColumn && /* @__PURE__ */ jsx(ChartCursorLine, {
|
|
132
|
-
x1: activeColumn.x,
|
|
133
|
-
x2: activeColumn.x,
|
|
134
|
-
y1: 0,
|
|
135
|
-
y2: plotHeight
|
|
136
|
-
}),
|
|
137
|
-
geometry.paths.map((linePath) => /* @__PURE__ */ jsx(ChartLinePath, {
|
|
138
|
-
d: linePath.path,
|
|
139
|
-
stroke: linePath.color,
|
|
140
|
-
strokeWidth: linePath.strokeWidth,
|
|
141
|
-
strokeDasharray: linePath.dashArray,
|
|
142
|
-
"data-state": interaction.getMarkState({ seriesKey: linePath.metric })
|
|
143
|
-
}, linePath.id)),
|
|
144
|
-
geometry.isolatedPoints.map((point) => /* @__PURE__ */ jsx(ChartPointCircle, {
|
|
145
|
-
cx: point.x,
|
|
146
|
-
cy: point.y,
|
|
147
|
-
r: LINE_POINT_RADIUS,
|
|
148
|
-
fill: point.color,
|
|
149
|
-
"data-state": interaction.getMarkState({ seriesKey: point.metric })
|
|
150
|
-
}, `${point.id}:isolated`)),
|
|
151
|
-
activeColumn?.points.map((point) => /* @__PURE__ */ jsx(ChartPointCircle, {
|
|
152
|
-
cx: point.x,
|
|
153
|
-
cy: point.y,
|
|
154
|
-
r: LINE_POINT_RADIUS,
|
|
155
|
-
fill: point.color,
|
|
156
|
-
"data-state": interaction.getMarkState({ seriesKey: point.metric })
|
|
157
|
-
}, point.id))
|
|
158
|
-
] });
|
|
159
|
-
return /* @__PURE__ */ jsx(ChartFrame, {
|
|
106
|
+
return /* @__PURE__ */ jsxs(ChartFrame, {
|
|
160
107
|
containerRef,
|
|
161
108
|
dimensions,
|
|
162
109
|
fillWidth,
|
|
@@ -174,7 +121,6 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
174
121
|
marginLeft: dimensions.margin.left,
|
|
175
122
|
formatter: formatValue,
|
|
176
123
|
showGrid,
|
|
177
|
-
showLabels: !isLoading,
|
|
178
124
|
title: valueAxisTitle
|
|
179
125
|
}), /* @__PURE__ */ jsx(ChartCategoryAxis, {
|
|
180
126
|
labels: geometry.categories,
|
|
@@ -184,7 +130,6 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
184
130
|
plotHeight,
|
|
185
131
|
formatter: formatLabel,
|
|
186
132
|
mode: categoryLabelMode,
|
|
187
|
-
showLabels: !isLoading,
|
|
188
133
|
title: categoryAxisTitle
|
|
189
134
|
})] }),
|
|
190
135
|
noTooltip,
|
|
@@ -197,7 +142,41 @@ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeig
|
|
|
197
142
|
contentWhenEmpty,
|
|
198
143
|
showLegend,
|
|
199
144
|
legendItems,
|
|
200
|
-
children:
|
|
145
|
+
children: [
|
|
146
|
+
geometry.paths.map((linePath) => linePath.areaPath ? /* @__PURE__ */ jsx(ChartAreaPath, {
|
|
147
|
+
d: linePath.areaPath,
|
|
148
|
+
fill: linePath.color,
|
|
149
|
+
fillOpacity: LINE_AREA_OPACITY,
|
|
150
|
+
"data-state": interaction.getMarkState({ seriesKey: linePath.metric })
|
|
151
|
+
}, `${linePath.id}:area`) : null),
|
|
152
|
+
showCursor && activeColumn && /* @__PURE__ */ jsx(ChartCursorLine, {
|
|
153
|
+
x1: activeColumn.x,
|
|
154
|
+
x2: activeColumn.x,
|
|
155
|
+
y1: 0,
|
|
156
|
+
y2: plotHeight
|
|
157
|
+
}),
|
|
158
|
+
geometry.paths.map((linePath) => /* @__PURE__ */ jsx(ChartLinePath, {
|
|
159
|
+
d: linePath.path,
|
|
160
|
+
stroke: linePath.color,
|
|
161
|
+
strokeWidth: linePath.strokeWidth,
|
|
162
|
+
strokeDasharray: linePath.dashArray,
|
|
163
|
+
"data-state": interaction.getMarkState({ seriesKey: linePath.metric })
|
|
164
|
+
}, linePath.id)),
|
|
165
|
+
geometry.isolatedPoints.map((point) => /* @__PURE__ */ jsx(ChartPointCircle, {
|
|
166
|
+
cx: point.x,
|
|
167
|
+
cy: point.y,
|
|
168
|
+
r: LINE_POINT_RADIUS,
|
|
169
|
+
fill: point.color,
|
|
170
|
+
"data-state": interaction.getMarkState({ seriesKey: point.metric })
|
|
171
|
+
}, `${point.id}:isolated`)),
|
|
172
|
+
activeColumn?.points.map((point) => /* @__PURE__ */ jsx(ChartPointCircle, {
|
|
173
|
+
cx: point.x,
|
|
174
|
+
cy: point.y,
|
|
175
|
+
r: LINE_POINT_RADIUS,
|
|
176
|
+
fill: point.color,
|
|
177
|
+
"data-state": interaction.getMarkState({ seriesKey: point.metric })
|
|
178
|
+
}, point.id))
|
|
179
|
+
]
|
|
201
180
|
});
|
|
202
181
|
};
|
|
203
182
|
//#endregion
|
package/dist/charts/PieChart.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import FlexWrapper, { AlignItems, FlexDirection, JustifyContent } from "../containers/FlexWrapper.js";
|
|
2
2
|
import { ChartKind, ChartLegendPlacement, ChartTargetShape } from "./types.js";
|
|
3
|
-
import { PIE_CHART_MARGIN, PIE_MIN_SLICE_SHARE
|
|
3
|
+
import { PIE_CHART_MARGIN, PIE_MIN_SLICE_SHARE } from "./constants.js";
|
|
4
4
|
import { useSeriesColorResolver } from "./useSeriesColorResolver.js";
|
|
5
5
|
import { ChartTooltipVerticalAlign } from "./useChartTooltipPosition.js";
|
|
6
6
|
import { useChartInteraction } from "./useChartInteraction.js";
|
|
7
7
|
import { useChartFormatters } from "./useChartFormatters.js";
|
|
8
8
|
import { useChartDimensions } from "./useChartDimensions.js";
|
|
9
9
|
import { buildPieChartGeometry } from "./pieChartGeometry.js";
|
|
10
|
-
import { ChartArcPath, ChartCenterBox
|
|
10
|
+
import { ChartArcPath, ChartCenterBox } from "./ChartPrimitives.js";
|
|
11
11
|
import ChartFrame from "./ChartFrame.js";
|
|
12
12
|
import { useCallback, useMemo, useRef } from "react";
|
|
13
13
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -40,23 +40,9 @@ var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRa
|
|
|
40
40
|
});
|
|
41
41
|
const getSliceLabel = useCallback((sliceKey) => series[sliceKey]?.label ?? sliceKey, [series]);
|
|
42
42
|
const getSliceColor = useCallback((sliceKey) => series[sliceKey]?.color, [series]);
|
|
43
|
-
|
|
44
|
-
* The slices actually rendered: the caller's, or three ghost arcs while
|
|
45
|
-
* loading, pushed through the real geometry so the skeleton donut gets the
|
|
46
|
-
* true pad angles and corner radii. The cast is safe because nothing derived
|
|
47
|
-
* from skeleton data ever surfaces: targets are off, the legend shows stubs,
|
|
48
|
-
* and the accessible name says "loading" instead of counting slices.
|
|
49
|
-
*/
|
|
50
|
-
const displaySlices = useMemo(() => isLoading ? SKELETON_PIE_VALUES.map((value, index) => ({
|
|
51
|
-
key: `skeleton-${index}`,
|
|
52
|
-
value
|
|
53
|
-
})) : slices, [isLoading, slices]);
|
|
54
|
-
const resolveColor = useCallback(({ sliceKey, explicit }) => {
|
|
55
|
-
if (isLoading) return colors.placeholder;
|
|
56
|
-
return sliceKey === null ? colors.neutral : colors.resolve(sliceKey, explicit);
|
|
57
|
-
}, [colors, isLoading]);
|
|
43
|
+
const resolveColor = useCallback(({ sliceKey, explicit }) => sliceKey === null ? colors.neutral : colors.resolve(sliceKey, explicit), [colors]);
|
|
58
44
|
const geometry = useMemo(() => buildPieChartGeometry({
|
|
59
|
-
slices
|
|
45
|
+
slices,
|
|
60
46
|
plotWidth,
|
|
61
47
|
plotHeight,
|
|
62
48
|
innerRadiusRatio,
|
|
@@ -68,7 +54,7 @@ var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRa
|
|
|
68
54
|
getSliceColor,
|
|
69
55
|
getSliceLabel
|
|
70
56
|
}), [
|
|
71
|
-
|
|
57
|
+
slices,
|
|
72
58
|
plotWidth,
|
|
73
59
|
plotHeight,
|
|
74
60
|
innerRadiusRatio,
|
|
@@ -90,7 +76,8 @@ var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRa
|
|
|
90
76
|
const interaction = useChartInteraction({
|
|
91
77
|
categoryCount: geometry.arcs.length,
|
|
92
78
|
seriesKeys: legendKeys,
|
|
93
|
-
disabled: noTooltip || isLoading || isEmpty
|
|
79
|
+
disabled: noTooltip || isLoading || isEmpty,
|
|
80
|
+
isLoading
|
|
94
81
|
});
|
|
95
82
|
const buildCategoryTooltip = useCallback((index) => {
|
|
96
83
|
const chartArc = geometry.arcs[index];
|
|
@@ -123,18 +110,7 @@ var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRa
|
|
|
123
110
|
shape: ChartTargetShape.PATH,
|
|
124
111
|
d: chartArc.path
|
|
125
112
|
})), [geometry.arcs]);
|
|
126
|
-
const showCenter = centerContent &&
|
|
127
|
-
const marks = /* @__PURE__ */ jsx("g", {
|
|
128
|
-
transform: `translate(${geometry.centerX}, ${geometry.centerY})`,
|
|
129
|
-
children: geometry.arcs.map((chartArc, index) => /* @__PURE__ */ jsx(ChartArcPath, {
|
|
130
|
-
d: chartArc.path,
|
|
131
|
-
fill: chartArc.color,
|
|
132
|
-
"data-state": interaction.getMarkState({
|
|
133
|
-
categoryIndex: index,
|
|
134
|
-
seriesKey: chartArc.id
|
|
135
|
-
})
|
|
136
|
-
}, chartArc.id))
|
|
137
|
-
});
|
|
113
|
+
const showCenter = centerContent && (innerRadiusRatio ?? .62) > 0;
|
|
138
114
|
return /* @__PURE__ */ jsx(ChartFrame, {
|
|
139
115
|
containerRef,
|
|
140
116
|
dimensions,
|
|
@@ -164,7 +140,17 @@ var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRa
|
|
|
164
140
|
diameter: geometry.innerRadius * 2,
|
|
165
141
|
children: centerContent
|
|
166
142
|
}) : null,
|
|
167
|
-
children:
|
|
143
|
+
children: /* @__PURE__ */ jsx("g", {
|
|
144
|
+
transform: `translate(${geometry.centerX}, ${geometry.centerY})`,
|
|
145
|
+
children: geometry.arcs.map((chartArc, index) => /* @__PURE__ */ jsx(ChartArcPath, {
|
|
146
|
+
d: chartArc.path,
|
|
147
|
+
fill: chartArc.color,
|
|
148
|
+
"data-state": interaction.getMarkState({
|
|
149
|
+
categoryIndex: index,
|
|
150
|
+
seriesKey: chartArc.id
|
|
151
|
+
})
|
|
152
|
+
}, chartArc.id))
|
|
153
|
+
})
|
|
168
154
|
});
|
|
169
155
|
};
|
|
170
156
|
/** Positions arbitrary content inside the donut hole. */
|
|
@@ -203,25 +203,6 @@ 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
|
-
* Ghost bar heights, one inner array per group — three bars each, so the
|
|
208
|
-
* skeleton reads as the grouped chart it usually stands in for rather than a
|
|
209
|
-
* sparse row of lone bars.
|
|
210
|
-
*/
|
|
211
|
-
export declare const SKELETON_BAR_GROUPS: number[][];
|
|
212
|
-
/**
|
|
213
|
-
* Ghost lines, one inner array per line, offset from each other and drawn with
|
|
214
|
-
* their area fills so the skeleton has the layered depth of a real multi-series
|
|
215
|
-
* chart instead of a single bare stroke.
|
|
216
|
-
*/
|
|
217
|
-
export declare const SKELETON_LINE_SERIES: number[][];
|
|
218
|
-
/** Ghost donut shares — three arcs, halving. */
|
|
219
|
-
export declare const SKELETON_PIE_VALUES: number[];
|
|
220
|
-
/**
|
|
221
|
-
* Skeleton pulse period, matching the cadence of `TextShimmer` and
|
|
222
|
-
* `AvatarShimmer` so charts load in step with everything else on the page.
|
|
223
|
-
*/
|
|
224
|
-
export declare const CHART_SKELETON_PULSE_MS = 2500;
|
|
225
206
|
/**
|
|
226
207
|
* Approximate width of one CAPTION-size character.
|
|
227
208
|
*
|
package/dist/charts/constants.js
CHANGED
|
@@ -214,83 +214,6 @@ 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
|
-
* Ghost bar heights, one inner array per group — three bars each, so the
|
|
218
|
-
* skeleton reads as the grouped chart it usually stands in for rather than a
|
|
219
|
-
* sparse row of lone bars.
|
|
220
|
-
*/
|
|
221
|
-
var SKELETON_BAR_GROUPS = [
|
|
222
|
-
[
|
|
223
|
-
65,
|
|
224
|
-
45,
|
|
225
|
-
25
|
|
226
|
-
],
|
|
227
|
-
[
|
|
228
|
-
80,
|
|
229
|
-
55,
|
|
230
|
-
30
|
|
231
|
-
],
|
|
232
|
-
[
|
|
233
|
-
45,
|
|
234
|
-
70,
|
|
235
|
-
35
|
|
236
|
-
],
|
|
237
|
-
[
|
|
238
|
-
70,
|
|
239
|
-
50,
|
|
240
|
-
40
|
|
241
|
-
],
|
|
242
|
-
[
|
|
243
|
-
55,
|
|
244
|
-
75,
|
|
245
|
-
30
|
|
246
|
-
]
|
|
247
|
-
];
|
|
248
|
-
/**
|
|
249
|
-
* Ghost lines, one inner array per line, offset from each other and drawn with
|
|
250
|
-
* their area fills so the skeleton has the layered depth of a real multi-series
|
|
251
|
-
* chart instead of a single bare stroke.
|
|
252
|
-
*/
|
|
253
|
-
var SKELETON_LINE_SERIES = [
|
|
254
|
-
[
|
|
255
|
-
30,
|
|
256
|
-
55,
|
|
257
|
-
45,
|
|
258
|
-
70,
|
|
259
|
-
60,
|
|
260
|
-
85,
|
|
261
|
-
75
|
|
262
|
-
],
|
|
263
|
-
[
|
|
264
|
-
20,
|
|
265
|
-
35,
|
|
266
|
-
50,
|
|
267
|
-
40,
|
|
268
|
-
60,
|
|
269
|
-
55,
|
|
270
|
-
70
|
|
271
|
-
],
|
|
272
|
-
[
|
|
273
|
-
10,
|
|
274
|
-
25,
|
|
275
|
-
20,
|
|
276
|
-
35,
|
|
277
|
-
30,
|
|
278
|
-
45,
|
|
279
|
-
40
|
|
280
|
-
]
|
|
281
|
-
];
|
|
282
|
-
/** Ghost donut shares — three arcs, halving. */
|
|
283
|
-
var SKELETON_PIE_VALUES = [
|
|
284
|
-
5,
|
|
285
|
-
3,
|
|
286
|
-
2
|
|
287
|
-
];
|
|
288
|
-
/**
|
|
289
|
-
* Skeleton pulse period, matching the cadence of `TextShimmer` and
|
|
290
|
-
* `AvatarShimmer` so charts load in step with everything else on the page.
|
|
291
|
-
*/
|
|
292
|
-
var CHART_SKELETON_PULSE_MS = 2500;
|
|
293
|
-
/**
|
|
294
217
|
* Approximate width of one CAPTION-size character.
|
|
295
218
|
*
|
|
296
219
|
* Axis sizing estimates label widths arithmetically rather than measuring the
|
|
@@ -338,4 +261,4 @@ var CHART_PALETTE_ORDER = [
|
|
|
338
261
|
ChartPalette.RED
|
|
339
262
|
];
|
|
340
263
|
//#endregion
|
|
341
|
-
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,
|
|
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 };
|
|
@@ -25,6 +25,16 @@ interface UseChartInteractionOptions {
|
|
|
25
25
|
seriesKeys?: string[];
|
|
26
26
|
/** Suppress all interaction — used while loading and when the tooltip is off. */
|
|
27
27
|
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Render every mark muted, whatever the two axes say.
|
|
30
|
+
*
|
|
31
|
+
* Distinct from {@link disabled}, which suppresses *input*. Loading suppresses
|
|
32
|
+
* *emphasis*: there is nothing yet worth drawing attention to. Folded in here
|
|
33
|
+
* rather than left to each mark, because the alternative is the same
|
|
34
|
+
* `isLoading ? MUTED : getMarkState(…)` ternary hand-copied at every mark —
|
|
35
|
+
* which is exactly how one of them came to be missing it.
|
|
36
|
+
*/
|
|
37
|
+
isLoading?: boolean;
|
|
28
38
|
}
|
|
29
39
|
interface MarkStateArgs {
|
|
30
40
|
/** Omit for marks that belong to no particular category, such as a line. */
|
|
@@ -55,5 +65,5 @@ export interface ChartInteraction {
|
|
|
55
65
|
onSeriesEnter: (seriesKey: string) => void;
|
|
56
66
|
onSeriesLeave: () => void;
|
|
57
67
|
}
|
|
58
|
-
export declare function useChartInteraction({ categoryCount, seriesKeys, disabled, }: UseChartInteractionOptions): ChartInteraction;
|
|
68
|
+
export declare function useChartInteraction({ categoryCount, seriesKeys, disabled, isLoading, }: UseChartInteractionOptions): ChartInteraction;
|
|
59
69
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChartMarkState } from "./types.js";
|
|
2
2
|
import { useCallback, useMemo, useState } from "react";
|
|
3
3
|
//#region src/charts/useChartInteraction.ts
|
|
4
|
-
function useChartInteraction({ categoryCount, seriesKeys, disabled = false }) {
|
|
4
|
+
function useChartInteraction({ categoryCount, seriesKeys, disabled = false, isLoading = false }) {
|
|
5
5
|
const [hoveredIndex, setHoveredIndex] = useState(null);
|
|
6
6
|
const [hoveredSeriesKey, setHoveredSeriesKey] = useState(null);
|
|
7
7
|
const safeHovered = hoveredIndex !== null && hoveredIndex < categoryCount ? hoveredIndex : null;
|
|
@@ -21,8 +21,13 @@ function useChartInteraction({ categoryCount, seriesKeys, disabled = false }) {
|
|
|
21
21
|
setHoveredSeriesKey(null);
|
|
22
22
|
}, []);
|
|
23
23
|
const getMarkState = useCallback(({ categoryIndex, seriesKey }) => {
|
|
24
|
+
if (isLoading) return ChartMarkState.MUTED;
|
|
24
25
|
return categoryIndex !== void 0 && safeHovered !== null && categoryIndex !== safeHovered || seriesKey !== void 0 && safeHoveredSeries !== null && seriesKey !== safeHoveredSeries ? ChartMarkState.MUTED : ChartMarkState.ACTIVE;
|
|
25
|
-
}, [
|
|
26
|
+
}, [
|
|
27
|
+
isLoading,
|
|
28
|
+
safeHovered,
|
|
29
|
+
safeHoveredSeries
|
|
30
|
+
]);
|
|
26
31
|
return useMemo(() => ({
|
|
27
32
|
activeIndex: safeHovered,
|
|
28
33
|
hoveredSeriesKey: safeHoveredSeries,
|
|
@@ -33,12 +33,5 @@ export interface SeriesColorResolver<TKey extends string> {
|
|
|
33
33
|
* imply it is.
|
|
34
34
|
*/
|
|
35
35
|
neutral: string;
|
|
36
|
-
/**
|
|
37
|
-
* Ghost colour for skeleton marks while the chart is loading.
|
|
38
|
-
*
|
|
39
|
-
* The same token the shimmer components use, so the loading vocabulary is
|
|
40
|
-
* one colour everywhere.
|
|
41
|
-
*/
|
|
42
|
-
placeholder: string;
|
|
43
36
|
}
|
|
44
37
|
export declare function useSeriesColorResolver<TKey extends string>(series: ChartSeriesStyles<TKey>): SeriesColorResolver<TKey>;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export interface HorizontalDividerProps {
|
|
2
|
+
label?: string;
|
|
3
|
+
}
|
|
4
|
+
declare const HorizontalDivider: ({ label }: HorizontalDividerProps) => import("react").JSX.Element;
|
|
2
5
|
export default HorizontalDivider;
|
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
import { withTheme } from "../theme/GalaxyTheme.js";
|
|
2
|
+
import Text, { TextSize, TextVariant } from "../text/Text.js";
|
|
2
3
|
/* empty css */
|
|
3
4
|
import { styled } from "@linaria/react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
//#region src/dividers/HorizontalDivider.tsx
|
|
6
|
-
var _exp = () => ({
|
|
7
|
-
var
|
|
8
|
-
|
|
7
|
+
var _exp = () => ({ $flex }) => $flex ? "auto" : "100%";
|
|
8
|
+
var _exp2 = () => ({ $flex }) => $flex ? "1 1 0%" : "0 0 auto";
|
|
9
|
+
var _exp3 = () => ({ theme }) => theme.color.border.primary;
|
|
10
|
+
var HorizontalDividerLine = withTheme(/*#__PURE__*/ styled("div")({
|
|
11
|
+
name: "HorizontalDividerLine",
|
|
9
12
|
class: "h1sww5hz",
|
|
10
13
|
propsAsIs: false,
|
|
11
|
-
vars: {
|
|
14
|
+
vars: {
|
|
15
|
+
"h1sww5hz-0": [_exp()],
|
|
16
|
+
"h1sww5hz-1": [_exp2()],
|
|
17
|
+
"h1sww5hz-2": [_exp3()]
|
|
18
|
+
}
|
|
12
19
|
}));
|
|
13
|
-
var
|
|
14
|
-
|
|
20
|
+
var LabeledDividerWrapper = /*#__PURE__*/ styled("div")({
|
|
21
|
+
name: "LabeledDividerWrapper",
|
|
22
|
+
class: "l44ah51",
|
|
23
|
+
propsAsIs: false
|
|
24
|
+
});
|
|
25
|
+
var HorizontalDivider = ({ label }) => {
|
|
26
|
+
if (!label) return /* @__PURE__ */ jsx(HorizontalDividerLine, {});
|
|
27
|
+
return /* @__PURE__ */ jsxs(LabeledDividerWrapper, { children: [
|
|
28
|
+
/* @__PURE__ */ jsx(HorizontalDividerLine, { $flex: true }),
|
|
29
|
+
/* @__PURE__ */ jsx(Text, {
|
|
30
|
+
size: TextSize.CAPTION,
|
|
31
|
+
variant: TextVariant.TERTIARY,
|
|
32
|
+
children: label
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ jsx(HorizontalDividerLine, { $flex: true })
|
|
35
|
+
] });
|
|
15
36
|
};
|
|
16
37
|
//#endregion
|
|
17
38
|
export { HorizontalDivider as default };
|
package/dist/inputs/CopyInput.js
CHANGED
|
@@ -2,7 +2,7 @@ import Button, { ButtonSize, ButtonVariant } from "../buttons/Button.js";
|
|
|
2
2
|
import FlexWrapper, { AlignItems } from "../containers/FlexWrapper.js";
|
|
3
3
|
import { InputSize } from "./Input.js";
|
|
4
4
|
import TextInput from "./TextInput.js";
|
|
5
|
-
import { useCallback, useState } from "react";
|
|
5
|
+
import { useCallback, useRef, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { CheckIcon, CopyIcon } from "@phosphor-icons/react";
|
|
8
8
|
//#region src/inputs/CopyInput.tsx
|
|
@@ -13,7 +13,9 @@ var INPUT_SIZE_TO_BUTTON_SIZE = {
|
|
|
13
13
|
};
|
|
14
14
|
var CopyInput = ({ value, label, labelTooltip, size = InputSize.MEDIUM, width, fillWidth, isMonospace = false }) => {
|
|
15
15
|
const [copied, setCopied] = useState(false);
|
|
16
|
+
const inputRef = useRef(null);
|
|
16
17
|
const handleCopy = useCallback(() => {
|
|
18
|
+
inputRef.current?.select();
|
|
17
19
|
navigator.clipboard.writeText(value).then(() => {
|
|
18
20
|
setCopied(true);
|
|
19
21
|
setTimeout(() => setCopied(false), 2e3);
|
|
@@ -24,6 +26,7 @@ var CopyInput = ({ value, label, labelTooltip, size = InputSize.MEDIUM, width, f
|
|
|
24
26
|
gap: 8,
|
|
25
27
|
fillWidth,
|
|
26
28
|
children: [/* @__PURE__ */ jsx(TextInput, {
|
|
29
|
+
ref: inputRef,
|
|
27
30
|
label,
|
|
28
31
|
labelTooltip,
|
|
29
32
|
value,
|
package/dist/inputs/Input.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare const StyledInput: import("react").ComponentType<Pick<import("rea
|
|
|
24
24
|
theme: import("../theme").Theme;
|
|
25
25
|
} & {
|
|
26
26
|
as?: React.ElementType;
|
|
27
|
-
}, "$width" | "$fillWidth" | "
|
|
27
|
+
}, "$width" | "$fillWidth" | "$size" | "$isMonospace" | "as" | "$isError" | "$hasLeadingIcon" | "$hasTrailingAction" | "$isDisabled" | keyof import("react").ClassAttributes<HTMLInputElement> | keyof import("react").InputHTMLAttributes<HTMLInputElement>> & {
|
|
28
28
|
theme?: import("@callstack/react-theme-provider").$DeepPartial<import("../theme").Theme> | undefined;
|
|
29
29
|
}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<import("react").ComponentType<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
30
30
|
$size: InputSize;
|
|
@@ -1,5 +1,6 @@
|
|
|
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 } from "../text/Text.js";
|
|
4
5
|
import FlexItem from "../containers/FlexItem.js";
|
|
5
6
|
import Icon, { IconVariant } from "../icons/Icon.js";
|
|
@@ -7,7 +8,6 @@ import FlexWrapper, { AlignItems, FlexDirection } from "../containers/FlexWrappe
|
|
|
7
8
|
import CheckboxInput, { CheckboxInputVariant } from "./CheckboxInput.js";
|
|
8
9
|
import Dropdown, { DropdownPosition, DropdownVariant } from "../dropdown/Dropdown.js";
|
|
9
10
|
import { InputLabel, InputSize } from "./Input.js";
|
|
10
|
-
import RotateWithTransition from "../animations/RotateWithTransition.js";
|
|
11
11
|
import HorizontalDivider from "../dividers/HorizontalDivider.js";
|
|
12
12
|
import { useElementWidth } from "../hooks/useElementWidth.js";
|
|
13
13
|
import { useControlledOpenState, useDebouncedValue } from "./hooks.js";
|
|
@@ -503,7 +503,7 @@ var MultiSelectInput = ({ label, icon, variant = SelectInputVariant.PRIMARY, siz
|
|
|
503
503
|
disabled: effectiveIsDisabled,
|
|
504
504
|
onClick: (e) => e.stopPropagation()
|
|
505
505
|
}),
|
|
506
|
-
/* @__PURE__ */ jsx(FlexWrapper, { children: /* @__PURE__ */ jsx(
|
|
506
|
+
/* @__PURE__ */ jsx(FlexWrapper, { children: /* @__PURE__ */ jsx(Rotate, {
|
|
507
507
|
isRotated: visible,
|
|
508
508
|
deg: -180,
|
|
509
509
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
@@ -541,7 +541,7 @@ var MultiSelectInput = ({ label, icon, variant = SelectInputVariant.PRIMARY, siz
|
|
|
541
541
|
isEllipsis: true,
|
|
542
542
|
children: displayValue
|
|
543
543
|
}),
|
|
544
|
-
/* @__PURE__ */ jsx(FlexWrapper, { children: /* @__PURE__ */ jsx(
|
|
544
|
+
/* @__PURE__ */ jsx(FlexWrapper, { children: /* @__PURE__ */ jsx(Rotate, {
|
|
545
545
|
isRotated: visible,
|
|
546
546
|
deg: -180,
|
|
547
547
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
@@ -1,5 +1,6 @@
|
|
|
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 } from "../text/Text.js";
|
|
4
5
|
import FlexItem from "../containers/FlexItem.js";
|
|
5
6
|
import Icon, { IconVariant, IconWeight } from "../icons/Icon.js";
|
|
@@ -7,7 +8,6 @@ import FlexWrapper, { AlignItems, FlexDirection } from "../containers/FlexWrappe
|
|
|
7
8
|
import Dropdown, { DropdownVariant } from "../dropdown/Dropdown.js";
|
|
8
9
|
import Spacing from "../containers/Spacing.js";
|
|
9
10
|
import { InputLabel, InputSize } from "./Input.js";
|
|
10
|
-
import RotateWithTransition from "../animations/RotateWithTransition.js";
|
|
11
11
|
import HorizontalDivider from "../dividers/HorizontalDivider.js";
|
|
12
12
|
import { useElementWidth } from "../hooks/useElementWidth.js";
|
|
13
13
|
import { useControlledOpenState, useDebouncedValue } from "./hooks.js";
|
|
@@ -451,7 +451,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
|
|
|
451
451
|
onClick: (e) => e.stopPropagation()
|
|
452
452
|
}),
|
|
453
453
|
/* @__PURE__ */ jsx(Spacing, { left: 8 }),
|
|
454
|
-
/* @__PURE__ */ jsx(FlexWrapper, { children: /* @__PURE__ */ jsx(
|
|
454
|
+
/* @__PURE__ */ jsx(FlexWrapper, { children: /* @__PURE__ */ jsx(Rotate, {
|
|
455
455
|
isRotated: visible,
|
|
456
456
|
deg: -180,
|
|
457
457
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
@@ -498,7 +498,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
|
|
|
498
498
|
})]
|
|
499
499
|
}),
|
|
500
500
|
/* @__PURE__ */ jsx(Spacing, { left: 8 }),
|
|
501
|
-
/* @__PURE__ */ jsx(FlexWrapper, { children: /* @__PURE__ */ jsx(
|
|
501
|
+
/* @__PURE__ */ jsx(FlexWrapper, { children: /* @__PURE__ */ jsx(Rotate, {
|
|
502
502
|
isRotated: visible,
|
|
503
503
|
deg: -180,
|
|
504
504
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SwitcherInputItem {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
}
|
|
6
|
+
interface SwitcherInputProps {
|
|
7
|
+
items: SwitcherInputItem[];
|
|
8
|
+
selectedId: string;
|
|
9
|
+
}
|
|
10
|
+
declare const SwitcherInput: ({ items, selectedId }: SwitcherInputProps) => import("react").JSX.Element;
|
|
11
|
+
export default SwitcherInput;
|