@panneau/ui 5.0.0-alpha.36 → 5.0.0-alpha.37
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/README.md +8 -2
- package/dist/bar-chart/BarChart.css +76 -0
- package/dist/bar-chart/BarChart.d.ts +33 -0
- package/dist/bar-chart/BarChart.d.ts.map +1 -0
- package/dist/bar-chart/BarChart.js +151 -0
- package/dist/bar-chart/BarChart.js.map +1 -0
- package/dist/bar-chart/BarChart.module.js +26 -0
- package/dist/bar-chart/BarChart.module.js.map +1 -0
- package/dist/bar-chart/tokens.d.ts +3 -0
- package/dist/bar-chart/tokens.d.ts.map +1 -0
- package/dist/bar-chart/tokens.js +17 -0
- package/dist/bar-chart/tokens.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/line-chart/LineChart.css +223 -24
- package/dist/line-chart/LineChart.d.ts +45 -10
- package/dist/line-chart/LineChart.d.ts.map +1 -1
- package/dist/line-chart/LineChart.js +580 -265
- package/dist/line-chart/LineChart.js.map +1 -1
- package/dist/line-chart/LineChart.module.js +42 -5
- package/dist/line-chart/LineChart.module.js.map +1 -1
- package/dist/line-chart/geometry.d.ts +37 -0
- package/dist/line-chart/geometry.d.ts.map +1 -0
- package/dist/line-chart/geometry.js +115 -0
- package/dist/line-chart/geometry.js.map +1 -0
- package/dist/line-chart/tokens.d.ts +1 -1
- package/dist/line-chart/tokens.d.ts.map +1 -1
- package/dist/line-chart/tokens.js +11 -7
- package/dist/line-chart/tokens.js.map +1 -1
- package/dist/meter/Meter.css +23 -0
- package/dist/meter/Meter.d.ts +26 -0
- package/dist/meter/Meter.d.ts.map +1 -0
- package/dist/meter/Meter.js +99 -0
- package/dist/meter/Meter.js.map +1 -0
- package/dist/meter/Meter.module.js +16 -0
- package/dist/meter/Meter.module.js.map +1 -0
- package/dist/meter/tokens.d.ts +3 -0
- package/dist/meter/tokens.d.ts.map +1 -0
- package/dist/meter/tokens.js +15 -0
- package/dist/meter/tokens.js.map +1 -0
- package/dist/stat/Stat.css +4 -0
- package/dist/stat/Stat.d.ts +11 -3
- package/dist/stat/Stat.d.ts.map +1 -1
- package/dist/stat/Stat.js +67 -42
- package/dist/stat/Stat.js.map +1 -1
- package/dist/stat/Stat.module.js +3 -1
- package/dist/stat/Stat.module.js.map +1 -1
- package/dist/theme/components.d.ts +3 -1
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +4 -0
- package/dist/theme/components.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,326 +1,641 @@
|
|
|
1
1
|
import { cx } from "../utils/cx.js";
|
|
2
|
+
import { messages } from "../intl/messages.js";
|
|
2
3
|
import { usePanneauIntl } from "../intl/usePanneauIntl.js";
|
|
3
4
|
import { Skeleton } from "../skeleton/Skeleton.js";
|
|
4
5
|
import { chartColors } from "../theme/chartColors.js";
|
|
5
6
|
import LineChart_module_default from "./LineChart.module.js";
|
|
7
|
+
import { axisLabelIndices, linearPath, monotonePath, niceScale } from "./geometry.js";
|
|
6
8
|
import { c } from "react/compiler-runtime";
|
|
7
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { useId, useState } from "react";
|
|
8
11
|
//#region src/line-chart/LineChart.tsx
|
|
9
|
-
/**
|
|
10
|
-
var
|
|
12
|
+
/** At most this number of labels under the chart, half of them when it is narrow. */
|
|
13
|
+
var MAX_AXIS_LABELS = 7;
|
|
14
|
+
/** Closer than this (in percents of the width), the highest value isn't labeled beside the last one. */
|
|
15
|
+
var LABEL_GAP = 12;
|
|
11
16
|
/**
|
|
12
|
-
* A line of values over time, on the categorical chart colors of the theme:
|
|
13
|
-
* under it,
|
|
14
|
-
* from assistive technologies, which read the values in a table
|
|
17
|
+
* A line of values over time, on the categorical chart colors of the theme: a curve and the area
|
|
18
|
+
* under it, a scale of round graduations, labels of dates under it, and the last value at the end
|
|
19
|
+
* of the line. The plot is hidden from assistive technologies, which read the values in a table;
|
|
20
|
+
* with `isInteractive`, the pointer and the arrow keys also show the value of each point.
|
|
15
21
|
*/
|
|
16
22
|
function LineChart(t0) {
|
|
17
|
-
const $ = c(
|
|
18
|
-
const { label, points, formatValue, height, color:
|
|
19
|
-
const
|
|
23
|
+
const $ = c(146);
|
|
24
|
+
const { label, points, formatValue, formatTick, axisLabel, showAxis: t1, showLast: t2, showMax: t3, isInteractive: t4, domain, curve: t5, height, color: t6, className } = t0;
|
|
25
|
+
const showAxis = t1 === void 0 ? true : t1;
|
|
26
|
+
const showLast = t2 === void 0 ? true : t2;
|
|
27
|
+
const showMax = t3 === void 0 ? false : t3;
|
|
28
|
+
const isInteractive = t4 === void 0 ? false : t4;
|
|
29
|
+
const curve = t5 === void 0 ? "monotone" : t5;
|
|
30
|
+
const color = t6 === void 0 ? 0 : t6;
|
|
20
31
|
const intl = usePanneauIntl();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
$[
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
if ($[
|
|
37
|
-
|
|
38
|
-
$[
|
|
39
|
-
$[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
const t7 = useId();
|
|
33
|
+
let t8;
|
|
34
|
+
if ($[0] !== t7) {
|
|
35
|
+
let t9;
|
|
36
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
37
|
+
t9 = /[^\w-]/g;
|
|
38
|
+
$[2] = t9;
|
|
39
|
+
} else t9 = $[2];
|
|
40
|
+
t8 = t7.replace(t9, "");
|
|
41
|
+
$[0] = t7;
|
|
42
|
+
$[1] = t8;
|
|
43
|
+
} else t8 = $[1];
|
|
44
|
+
const gradientId = `panneau-line-chart-${t8}`;
|
|
45
|
+
const [active, setActive] = useState(null);
|
|
46
|
+
let t9;
|
|
47
|
+
if ($[3] !== formatValue || $[4] !== intl) {
|
|
48
|
+
t9 = formatValue ?? ((value) => intl.formatNumber(value));
|
|
49
|
+
$[3] = formatValue;
|
|
50
|
+
$[4] = intl;
|
|
51
|
+
$[5] = t9;
|
|
52
|
+
} else t9 = $[5];
|
|
53
|
+
const format = t9;
|
|
54
|
+
let t10;
|
|
55
|
+
if ($[6] !== color) {
|
|
56
|
+
t10 = chartColors.categorical(color);
|
|
57
|
+
$[6] = color;
|
|
58
|
+
$[7] = t10;
|
|
59
|
+
} else t10 = $[7];
|
|
60
|
+
let t11;
|
|
61
|
+
if ($[8] !== height) {
|
|
62
|
+
t11 = height !== void 0 ? { "--_panneau-line-chart-height": height } : {};
|
|
63
|
+
$[8] = height;
|
|
64
|
+
$[9] = t11;
|
|
65
|
+
} else t11 = $[9];
|
|
66
|
+
let t12;
|
|
67
|
+
if ($[10] !== t10 || $[11] !== t11) {
|
|
68
|
+
t12 = {
|
|
69
|
+
"--_panneau-line-chart-color": t10,
|
|
70
|
+
...t11
|
|
46
71
|
};
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
} else
|
|
51
|
-
const style =
|
|
72
|
+
$[10] = t10;
|
|
73
|
+
$[11] = t11;
|
|
74
|
+
$[12] = t12;
|
|
75
|
+
} else t12 = $[12];
|
|
76
|
+
const style = t12;
|
|
52
77
|
if (points === void 0) {
|
|
53
|
-
let
|
|
54
|
-
if ($[
|
|
55
|
-
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
} else
|
|
59
|
-
let
|
|
60
|
-
let
|
|
61
|
-
if ($[
|
|
62
|
-
|
|
63
|
-
className: LineChart_module_default.
|
|
78
|
+
let t13;
|
|
79
|
+
if ($[13] !== className) {
|
|
80
|
+
t13 = cx("panneau-line-chart", LineChart_module_default.chart, className);
|
|
81
|
+
$[13] = className;
|
|
82
|
+
$[14] = t13;
|
|
83
|
+
} else t13 = $[14];
|
|
84
|
+
let t14;
|
|
85
|
+
let t15;
|
|
86
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
87
|
+
t14 = /* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: LineChart_module_default.skeleton,
|
|
64
89
|
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
65
90
|
shape: "rect",
|
|
66
91
|
height: "100%"
|
|
67
92
|
})
|
|
68
93
|
});
|
|
69
|
-
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
94
|
+
t15 = /* @__PURE__ */ jsx(Skeleton, { width: "100%" });
|
|
95
|
+
$[15] = t14;
|
|
96
|
+
$[16] = t15;
|
|
72
97
|
} else {
|
|
73
|
-
|
|
74
|
-
|
|
98
|
+
t14 = $[15];
|
|
99
|
+
t15 = $[16];
|
|
75
100
|
}
|
|
76
|
-
let
|
|
77
|
-
if ($[
|
|
78
|
-
|
|
79
|
-
className:
|
|
101
|
+
let t16;
|
|
102
|
+
if ($[17] !== style || $[18] !== t13) {
|
|
103
|
+
t16 = /* @__PURE__ */ jsxs("div", {
|
|
104
|
+
className: t13,
|
|
80
105
|
style,
|
|
81
|
-
children: [
|
|
106
|
+
children: [t14, t15]
|
|
82
107
|
});
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
} else
|
|
87
|
-
return
|
|
108
|
+
$[17] = style;
|
|
109
|
+
$[18] = t13;
|
|
110
|
+
$[19] = t16;
|
|
111
|
+
} else t16 = $[19];
|
|
112
|
+
return t16;
|
|
88
113
|
}
|
|
89
|
-
let
|
|
90
|
-
let
|
|
91
|
-
let
|
|
92
|
-
let
|
|
93
|
-
let
|
|
94
|
-
let
|
|
95
|
-
let
|
|
96
|
-
|
|
114
|
+
let lastIndex;
|
|
115
|
+
let plotted;
|
|
116
|
+
let shortLabel;
|
|
117
|
+
let t13;
|
|
118
|
+
let t14;
|
|
119
|
+
let t15;
|
|
120
|
+
let t16;
|
|
121
|
+
let t17;
|
|
122
|
+
let t18;
|
|
123
|
+
let t19;
|
|
124
|
+
let t20;
|
|
125
|
+
let t21;
|
|
126
|
+
let t22;
|
|
127
|
+
let t23;
|
|
128
|
+
let t24;
|
|
129
|
+
let t25;
|
|
130
|
+
let t26;
|
|
131
|
+
let t27;
|
|
132
|
+
let t28;
|
|
133
|
+
let t29;
|
|
134
|
+
let t30;
|
|
135
|
+
let t31;
|
|
136
|
+
if ($[20] !== active || $[21] !== axisLabel || $[22] !== className || $[23] !== curve || $[24] !== domain || $[25] !== format || $[26] !== formatTick || $[27] !== gradientId || $[28] !== intl || $[29] !== isInteractive || $[30] !== label || $[31] !== points || $[32] !== showAxis || $[33] !== showLast || $[34] !== showMax || $[35] !== style) {
|
|
97
137
|
const values = points.map(_temp);
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
let
|
|
102
|
-
if ($[
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
138
|
+
const scale = niceScale(Math.min(...values, 0), Math.max(...values, 0), domain);
|
|
139
|
+
const tick = formatTick ?? ((value_0) => intl.formatNumber(value_0, scale.max >= 1e4 ? { notation: "compact" } : {}));
|
|
140
|
+
const y = (value_1) => 100 - (value_1 - scale.min) / (scale.max - scale.min) * 100;
|
|
141
|
+
let t32;
|
|
142
|
+
if ($[58] !== points.length || $[59] !== y) {
|
|
143
|
+
t32 = (point_0, index) => ({
|
|
144
|
+
x: points.length === 1 ? 50 : index / (points.length - 1) * 100,
|
|
145
|
+
y: y(point_0.value)
|
|
146
|
+
});
|
|
147
|
+
$[58] = points.length;
|
|
148
|
+
$[59] = y;
|
|
149
|
+
$[60] = t32;
|
|
150
|
+
} else t32 = $[60];
|
|
151
|
+
plotted = points.map(t32);
|
|
152
|
+
const line = curve === "linear" ? linearPath(plotted) : monotonePath(plotted);
|
|
153
|
+
const zero = y(Math.min(Math.max(0, scale.min), scale.max));
|
|
154
|
+
const firstPoint = plotted[0];
|
|
155
|
+
lastIndex = points.length - 1;
|
|
156
|
+
const lastPoint = plotted[lastIndex];
|
|
157
|
+
const maxValue = Math.max(...values);
|
|
158
|
+
const maxIndex = values.indexOf(maxValue);
|
|
159
|
+
const maxPoint = plotted[maxIndex];
|
|
160
|
+
const labelLast = showLast && lastPoint !== void 0;
|
|
161
|
+
const labelMax = showMax && maxPoint !== void 0 && maxValue > scale.min && !(labelLast && lastPoint.x - maxPoint.x < LABEL_GAP);
|
|
162
|
+
const activePoint = active !== null ? plotted[active] : void 0;
|
|
163
|
+
const activeData = active !== null ? points[active] : void 0;
|
|
164
|
+
shortLabel = _temp2;
|
|
165
|
+
let t33;
|
|
166
|
+
if ($[61] !== format || $[62] !== intl) {
|
|
167
|
+
t33 = (point_2) => intl.formatMessage(messages.chartPoint, {
|
|
168
|
+
label: point_2.label,
|
|
169
|
+
value: format(point_2.value)
|
|
170
|
+
});
|
|
171
|
+
$[61] = format;
|
|
172
|
+
$[62] = intl;
|
|
173
|
+
$[63] = t33;
|
|
174
|
+
} else t33 = $[63];
|
|
175
|
+
const describe = t33;
|
|
176
|
+
let t34;
|
|
177
|
+
if ($[64] !== lastIndex || $[65] !== points.length) {
|
|
178
|
+
t34 = (event) => {
|
|
179
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
180
|
+
if (rect.width > 0 && points.length > 0) {
|
|
181
|
+
const ratio = Math.min(Math.max((event.clientX - rect.left) / rect.width, 0), 1);
|
|
182
|
+
setActive(Math.round(ratio * lastIndex));
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
$[64] = lastIndex;
|
|
186
|
+
$[65] = points.length;
|
|
187
|
+
$[66] = t34;
|
|
188
|
+
} else t34 = $[66];
|
|
189
|
+
const point_3 = t34;
|
|
190
|
+
let t35;
|
|
191
|
+
if ($[67] !== active || $[68] !== lastIndex) {
|
|
192
|
+
t35 = (event_0) => {
|
|
193
|
+
const current = active ?? lastIndex;
|
|
194
|
+
const next = event_0.key === "ArrowLeft" || event_0.key === "ArrowDown" ? current - 1 : event_0.key === "ArrowRight" || event_0.key === "ArrowUp" ? current + 1 : event_0.key === "Home" ? 0 : event_0.key === "End" ? lastIndex : null;
|
|
195
|
+
if (next !== null) {
|
|
196
|
+
event_0.preventDefault();
|
|
197
|
+
setActive(Math.min(Math.max(next, 0), lastIndex));
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
$[67] = active;
|
|
201
|
+
$[68] = lastIndex;
|
|
202
|
+
$[69] = t35;
|
|
203
|
+
} else t35 = $[69];
|
|
204
|
+
const move = t35;
|
|
205
|
+
const focused = points[active ?? lastIndex];
|
|
206
|
+
let t36;
|
|
207
|
+
if ($[70] !== active || $[71] !== describe || $[72] !== focused || $[73] !== isInteractive || $[74] !== label || $[75] !== lastIndex || $[76] !== move || $[77] !== point_3) {
|
|
208
|
+
t36 = isInteractive && focused !== void 0 ? {
|
|
209
|
+
role: "slider",
|
|
210
|
+
tabIndex: 0,
|
|
211
|
+
"aria-label": label,
|
|
212
|
+
"aria-orientation": "horizontal",
|
|
213
|
+
"aria-valuemin": 0,
|
|
214
|
+
"aria-valuemax": lastIndex,
|
|
215
|
+
"aria-valuenow": active ?? lastIndex,
|
|
216
|
+
"aria-valuetext": describe(focused),
|
|
217
|
+
onPointerMove: point_3,
|
|
218
|
+
onPointerDown: point_3,
|
|
219
|
+
onPointerLeave: () => setActive(null),
|
|
220
|
+
onFocus: () => setActive((current_0) => current_0 ?? lastIndex),
|
|
221
|
+
onBlur: () => setActive(null),
|
|
222
|
+
onKeyDown: move
|
|
223
|
+
} : {};
|
|
224
|
+
$[70] = active;
|
|
225
|
+
$[71] = describe;
|
|
226
|
+
$[72] = focused;
|
|
227
|
+
$[73] = isInteractive;
|
|
228
|
+
$[74] = label;
|
|
229
|
+
$[75] = lastIndex;
|
|
230
|
+
$[76] = move;
|
|
231
|
+
$[77] = point_3;
|
|
232
|
+
$[78] = t36;
|
|
233
|
+
} else t36 = $[78];
|
|
234
|
+
const interaction = t36;
|
|
235
|
+
const widestTick = scale.ticks.map(tick).reduce(_temp3, "");
|
|
236
|
+
let t37;
|
|
237
|
+
if ($[79] !== points) {
|
|
238
|
+
t37 = (index_0) => {
|
|
239
|
+
const previous = points[index_0 - 1];
|
|
240
|
+
const current_1 = points[index_0];
|
|
241
|
+
return previous !== void 0 && current_1 !== void 0 && previous.value > current_1.value ? "below" : "above";
|
|
242
|
+
};
|
|
243
|
+
$[79] = points;
|
|
244
|
+
$[80] = t37;
|
|
245
|
+
} else t37 = $[80];
|
|
246
|
+
const placement = t37;
|
|
247
|
+
let t38;
|
|
248
|
+
if ($[81] !== format || $[82] !== points) {
|
|
249
|
+
t38 = (index_1, where, placedAt) => {
|
|
250
|
+
const data = points[index_1];
|
|
251
|
+
return data !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
252
|
+
className: LineChart_module_default.valueLabel,
|
|
253
|
+
"data-placement": placedAt,
|
|
254
|
+
style: positionOf(where),
|
|
255
|
+
children: format(data.value)
|
|
256
|
+
}) : null;
|
|
257
|
+
};
|
|
258
|
+
$[81] = format;
|
|
259
|
+
$[82] = points;
|
|
260
|
+
$[83] = t38;
|
|
261
|
+
} else t38 = $[83];
|
|
262
|
+
const valueLabel = t38;
|
|
263
|
+
if ($[84] !== className) {
|
|
264
|
+
t27 = cx("panneau-line-chart", LineChart_module_default.chart, className);
|
|
265
|
+
$[84] = className;
|
|
266
|
+
$[85] = t27;
|
|
267
|
+
} else t27 = $[85];
|
|
268
|
+
t28 = style;
|
|
269
|
+
t29 = showAxis ? "" : void 0;
|
|
270
|
+
t30 = labelLast || labelMax ? "" : void 0;
|
|
271
|
+
if ($[86] !== axisLabel) {
|
|
272
|
+
t31 = axisLabel !== void 0 ? /* @__PURE__ */ jsx("div", {
|
|
273
|
+
className: LineChart_module_default.axisLabel,
|
|
274
|
+
"aria-hidden": "true",
|
|
275
|
+
children: axisLabel
|
|
276
|
+
}) : null;
|
|
277
|
+
$[86] = axisLabel;
|
|
278
|
+
$[87] = t31;
|
|
279
|
+
} else t31 = $[87];
|
|
280
|
+
t25 = LineChart_module_default.body;
|
|
281
|
+
t26 = showAxis ? /* @__PURE__ */ jsxs("div", {
|
|
282
|
+
className: LineChart_module_default.scale,
|
|
283
|
+
"aria-hidden": "true",
|
|
284
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
285
|
+
className: LineChart_module_default.widest,
|
|
286
|
+
children: widestTick
|
|
287
|
+
}), scale.ticks.map((value_2) => /* @__PURE__ */ jsx("span", {
|
|
288
|
+
className: LineChart_module_default.tick,
|
|
289
|
+
style: { top: `${y(value_2)}%` },
|
|
290
|
+
children: tick(value_2)
|
|
291
|
+
}, value_2))]
|
|
292
|
+
}) : null;
|
|
293
|
+
t21 = LineChart_module_default.plot;
|
|
294
|
+
t22 = interaction;
|
|
295
|
+
let t39;
|
|
296
|
+
let t40;
|
|
297
|
+
if ($[88] === Symbol.for("react.memo_cache_sentinel")) {
|
|
298
|
+
t39 = /* @__PURE__ */ jsx("stop", {
|
|
299
|
+
offset: "0",
|
|
300
|
+
className: LineChart_module_default.areaTop
|
|
301
|
+
});
|
|
302
|
+
t40 = /* @__PURE__ */ jsx("stop", {
|
|
303
|
+
offset: "1",
|
|
304
|
+
className: LineChart_module_default.areaBottom
|
|
305
|
+
});
|
|
306
|
+
$[88] = t39;
|
|
307
|
+
$[89] = t40;
|
|
308
|
+
} else {
|
|
309
|
+
t39 = $[88];
|
|
310
|
+
t40 = $[89];
|
|
311
|
+
}
|
|
312
|
+
let t41;
|
|
313
|
+
if ($[90] !== gradientId) {
|
|
314
|
+
t41 = /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
|
|
315
|
+
id: gradientId,
|
|
316
|
+
x1: "0",
|
|
317
|
+
y1: "0",
|
|
318
|
+
x2: "0",
|
|
319
|
+
y2: "1",
|
|
320
|
+
children: [t39, t40]
|
|
321
|
+
}) });
|
|
322
|
+
$[90] = gradientId;
|
|
323
|
+
$[91] = t41;
|
|
324
|
+
} else t41 = $[91];
|
|
325
|
+
const t42 = showAxis ? scale.ticks.map((value_3) => /* @__PURE__ */ jsx("line", {
|
|
326
|
+
className: LineChart_module_default.grid,
|
|
327
|
+
x1: "0",
|
|
328
|
+
x2: "100",
|
|
329
|
+
y1: y(value_3),
|
|
330
|
+
y2: y(value_3)
|
|
331
|
+
}, value_3)) : null;
|
|
332
|
+
let t43;
|
|
333
|
+
if ($[92] !== zero) {
|
|
334
|
+
t43 = /* @__PURE__ */ jsx("line", {
|
|
151
335
|
className: LineChart_module_default.baseline,
|
|
152
336
|
x1: "0",
|
|
153
337
|
x2: "100",
|
|
154
338
|
y1: zero,
|
|
155
339
|
y2: zero
|
|
156
340
|
});
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
} else
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
341
|
+
$[92] = zero;
|
|
342
|
+
$[93] = t43;
|
|
343
|
+
} else t43 = $[93];
|
|
344
|
+
const t44 = firstPoint !== void 0 && lastPoint !== void 0 && points.length > 1 ? /* @__PURE__ */ jsxs("g", {
|
|
345
|
+
className: LineChart_module_default.reveal,
|
|
346
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
163
347
|
className: LineChart_module_default.area,
|
|
164
|
-
|
|
348
|
+
fill: `url(#${gradientId})`,
|
|
349
|
+
d: `${line} L${lastPoint.x},${zero} L${firstPoint.x},${zero} Z`
|
|
165
350
|
}), /* @__PURE__ */ jsx("path", {
|
|
166
351
|
className: LineChart_module_default.line,
|
|
167
352
|
d: line
|
|
168
|
-
})]
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
$[49] = zero;
|
|
173
|
-
$[50] = t16;
|
|
174
|
-
} else t16 = $[50];
|
|
175
|
-
let t17;
|
|
176
|
-
if ($[51] !== format || $[52] !== points || $[53] !== x || $[54] !== y) {
|
|
177
|
-
let t18;
|
|
178
|
-
if ($[56] !== format || $[57] !== points.length || $[58] !== x || $[59] !== y) {
|
|
179
|
-
t18 = (point_1, index_1) => points.length <= MAX_DOTS || index_1 === points.length - 1 ? /* @__PURE__ */ jsx("path", {
|
|
180
|
-
className: LineChart_module_default.dot,
|
|
181
|
-
d: `M${x(index_1)},${y(point_1.value)} h0`,
|
|
182
|
-
children: /* @__PURE__ */ jsx("title", { children: `${point_1.label}: ${format(point_1.value)}` })
|
|
183
|
-
}, point_1.label) : null;
|
|
184
|
-
$[56] = format;
|
|
185
|
-
$[57] = points.length;
|
|
186
|
-
$[58] = x;
|
|
187
|
-
$[59] = y;
|
|
188
|
-
$[60] = t18;
|
|
189
|
-
} else t18 = $[60];
|
|
190
|
-
t17 = points.map(t18);
|
|
191
|
-
$[51] = format;
|
|
192
|
-
$[52] = points;
|
|
193
|
-
$[53] = x;
|
|
194
|
-
$[54] = y;
|
|
195
|
-
$[55] = t17;
|
|
196
|
-
} else t17 = $[55];
|
|
197
|
-
if ($[61] !== t15 || $[62] !== t16 || $[63] !== t17) {
|
|
198
|
-
t7 = /* @__PURE__ */ jsxs("svg", {
|
|
353
|
+
})]
|
|
354
|
+
}) : null;
|
|
355
|
+
if ($[94] !== t41 || $[95] !== t42 || $[96] !== t43 || $[97] !== t44) {
|
|
356
|
+
t23 = /* @__PURE__ */ jsxs("svg", {
|
|
199
357
|
className: LineChart_module_default.svg,
|
|
200
358
|
viewBox: "0 0 100 100",
|
|
201
359
|
preserveAspectRatio: "none",
|
|
202
360
|
"aria-hidden": "true",
|
|
203
361
|
focusable: "false",
|
|
204
362
|
children: [
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
363
|
+
t41,
|
|
364
|
+
t42,
|
|
365
|
+
t43,
|
|
366
|
+
t44
|
|
208
367
|
]
|
|
209
368
|
});
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
369
|
+
$[94] = t41;
|
|
370
|
+
$[95] = t42;
|
|
371
|
+
$[96] = t43;
|
|
372
|
+
$[97] = t44;
|
|
373
|
+
$[98] = t23;
|
|
374
|
+
} else t23 = $[98];
|
|
375
|
+
t24 = activePoint !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
376
|
+
className: LineChart_module_default.crosshair,
|
|
377
|
+
style: { left: `${activePoint.x}%` },
|
|
378
|
+
"aria-hidden": "true"
|
|
379
|
+
}) : null;
|
|
380
|
+
t13 = LineChart_module_default.marks;
|
|
381
|
+
t14 = "true";
|
|
382
|
+
t15 = points.length === 1 && firstPoint !== void 0 && !labelLast ? /* @__PURE__ */ jsx("span", {
|
|
383
|
+
className: LineChart_module_default.dot,
|
|
384
|
+
style: positionOf(firstPoint)
|
|
385
|
+
}) : null;
|
|
386
|
+
t16 = labelMax && maxPoint !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
387
|
+
className: LineChart_module_default.dot,
|
|
388
|
+
style: positionOf(maxPoint)
|
|
389
|
+
}) : null;
|
|
390
|
+
t17 = labelLast && lastPoint !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
391
|
+
className: LineChart_module_default.dot,
|
|
392
|
+
style: positionOf(lastPoint)
|
|
219
393
|
}) : null;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
394
|
+
t18 = activePoint === void 0 && labelMax && maxPoint !== void 0 ? valueLabel(maxIndex, maxPoint, "above") : null;
|
|
395
|
+
t19 = activePoint === void 0 && labelLast && lastPoint !== void 0 ? valueLabel(lastIndex, lastPoint, placement(lastIndex)) : null;
|
|
396
|
+
t20 = activePoint !== void 0 && activeData !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
397
|
+
className: cx(LineChart_module_default.dot, LineChart_module_default.activeDot),
|
|
398
|
+
style: positionOf(activePoint)
|
|
399
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
400
|
+
className: LineChart_module_default.tooltip,
|
|
401
|
+
"data-placement": activePoint.y < 30 ? "below" : "above",
|
|
402
|
+
style: positionOf(activePoint),
|
|
403
|
+
children: [/* @__PURE__ */ jsx("strong", {
|
|
404
|
+
className: LineChart_module_default.tooltipValue,
|
|
405
|
+
children: format(activeData.value)
|
|
406
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
407
|
+
className: LineChart_module_default.tooltipLabel,
|
|
408
|
+
children: activeData.label
|
|
409
|
+
})]
|
|
410
|
+
})] }) : null;
|
|
411
|
+
$[20] = active;
|
|
412
|
+
$[21] = axisLabel;
|
|
413
|
+
$[22] = className;
|
|
414
|
+
$[23] = curve;
|
|
415
|
+
$[24] = domain;
|
|
416
|
+
$[25] = format;
|
|
417
|
+
$[26] = formatTick;
|
|
418
|
+
$[27] = gradientId;
|
|
419
|
+
$[28] = intl;
|
|
420
|
+
$[29] = isInteractive;
|
|
421
|
+
$[30] = label;
|
|
422
|
+
$[31] = points;
|
|
423
|
+
$[32] = showAxis;
|
|
424
|
+
$[33] = showLast;
|
|
425
|
+
$[34] = showMax;
|
|
426
|
+
$[35] = style;
|
|
427
|
+
$[36] = lastIndex;
|
|
428
|
+
$[37] = plotted;
|
|
429
|
+
$[38] = shortLabel;
|
|
430
|
+
$[39] = t13;
|
|
431
|
+
$[40] = t14;
|
|
432
|
+
$[41] = t15;
|
|
433
|
+
$[42] = t16;
|
|
434
|
+
$[43] = t17;
|
|
435
|
+
$[44] = t18;
|
|
436
|
+
$[45] = t19;
|
|
437
|
+
$[46] = t20;
|
|
438
|
+
$[47] = t21;
|
|
439
|
+
$[48] = t22;
|
|
440
|
+
$[49] = t23;
|
|
441
|
+
$[50] = t24;
|
|
442
|
+
$[51] = t25;
|
|
443
|
+
$[52] = t26;
|
|
444
|
+
$[53] = t27;
|
|
445
|
+
$[54] = t28;
|
|
446
|
+
$[55] = t29;
|
|
447
|
+
$[56] = t30;
|
|
448
|
+
$[57] = t31;
|
|
231
449
|
} else {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
450
|
+
lastIndex = $[36];
|
|
451
|
+
plotted = $[37];
|
|
452
|
+
shortLabel = $[38];
|
|
453
|
+
t13 = $[39];
|
|
454
|
+
t14 = $[40];
|
|
455
|
+
t15 = $[41];
|
|
456
|
+
t16 = $[42];
|
|
457
|
+
t17 = $[43];
|
|
458
|
+
t18 = $[44];
|
|
459
|
+
t19 = $[45];
|
|
460
|
+
t20 = $[46];
|
|
461
|
+
t21 = $[47];
|
|
462
|
+
t22 = $[48];
|
|
463
|
+
t23 = $[49];
|
|
464
|
+
t24 = $[50];
|
|
465
|
+
t25 = $[51];
|
|
466
|
+
t26 = $[52];
|
|
467
|
+
t27 = $[53];
|
|
468
|
+
t28 = $[54];
|
|
469
|
+
t29 = $[55];
|
|
470
|
+
t30 = $[56];
|
|
471
|
+
t31 = $[57];
|
|
239
472
|
}
|
|
240
|
-
let
|
|
241
|
-
if ($[
|
|
242
|
-
|
|
243
|
-
className:
|
|
244
|
-
|
|
473
|
+
let t32;
|
|
474
|
+
if ($[99] !== t13 || $[100] !== t14 || $[101] !== t15 || $[102] !== t16 || $[103] !== t17 || $[104] !== t18 || $[105] !== t19 || $[106] !== t20) {
|
|
475
|
+
t32 = /* @__PURE__ */ jsxs("div", {
|
|
476
|
+
className: t13,
|
|
477
|
+
"aria-hidden": t14,
|
|
478
|
+
children: [
|
|
479
|
+
t15,
|
|
480
|
+
t16,
|
|
481
|
+
t17,
|
|
482
|
+
t18,
|
|
483
|
+
t19,
|
|
484
|
+
t20
|
|
485
|
+
]
|
|
245
486
|
});
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
487
|
+
$[99] = t13;
|
|
488
|
+
$[100] = t14;
|
|
489
|
+
$[101] = t15;
|
|
490
|
+
$[102] = t16;
|
|
491
|
+
$[103] = t17;
|
|
492
|
+
$[104] = t18;
|
|
493
|
+
$[105] = t19;
|
|
494
|
+
$[106] = t20;
|
|
495
|
+
$[107] = t32;
|
|
496
|
+
} else t32 = $[107];
|
|
497
|
+
let t33;
|
|
498
|
+
if ($[108] !== t21 || $[109] !== t22 || $[110] !== t23 || $[111] !== t24 || $[112] !== t32) {
|
|
499
|
+
t33 = /* @__PURE__ */ jsxs("div", {
|
|
500
|
+
className: t21,
|
|
501
|
+
...t22,
|
|
502
|
+
children: [
|
|
503
|
+
t23,
|
|
504
|
+
t24,
|
|
505
|
+
t32
|
|
506
|
+
]
|
|
507
|
+
});
|
|
508
|
+
$[108] = t21;
|
|
509
|
+
$[109] = t22;
|
|
510
|
+
$[110] = t23;
|
|
511
|
+
$[111] = t24;
|
|
512
|
+
$[112] = t32;
|
|
513
|
+
$[113] = t33;
|
|
514
|
+
} else t33 = $[113];
|
|
515
|
+
let t34;
|
|
516
|
+
if ($[114] !== lastIndex || $[115] !== plotted || $[116] !== points || $[117] !== shortLabel) {
|
|
517
|
+
t34 = axisLabelIndices(points.length, MAX_AXIS_LABELS).map((t35) => {
|
|
518
|
+
const { index: index_2, minor } = t35;
|
|
519
|
+
const data_0 = points[index_2];
|
|
520
|
+
const where_0 = plotted[index_2];
|
|
521
|
+
return data_0 !== void 0 && where_0 !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
522
|
+
className: cx(LineChart_module_default.date, minor && LineChart_module_default.minor),
|
|
523
|
+
"data-edge": points.length === 1 ? void 0 : index_2 === 0 ? "start" : index_2 === lastIndex ? "end" : void 0,
|
|
524
|
+
style: { left: `${where_0.x}%` },
|
|
525
|
+
children: shortLabel(data_0)
|
|
526
|
+
}, index_2) : null;
|
|
527
|
+
});
|
|
528
|
+
$[114] = lastIndex;
|
|
529
|
+
$[115] = plotted;
|
|
530
|
+
$[116] = points;
|
|
531
|
+
$[117] = shortLabel;
|
|
532
|
+
$[118] = t34;
|
|
533
|
+
} else t34 = $[118];
|
|
534
|
+
let t35;
|
|
535
|
+
if ($[119] !== t34) {
|
|
536
|
+
t35 = /* @__PURE__ */ jsx("div", {
|
|
537
|
+
className: LineChart_module_default.dates,
|
|
255
538
|
"aria-hidden": "true",
|
|
256
|
-
children:
|
|
257
|
-
})
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
539
|
+
children: t34
|
|
540
|
+
});
|
|
541
|
+
$[119] = t34;
|
|
542
|
+
$[120] = t35;
|
|
543
|
+
} else t35 = $[120];
|
|
544
|
+
let t36;
|
|
545
|
+
if ($[121] !== t25 || $[122] !== t26 || $[123] !== t33 || $[124] !== t35) {
|
|
546
|
+
t36 = /* @__PURE__ */ jsxs("div", {
|
|
547
|
+
className: t25,
|
|
548
|
+
children: [
|
|
549
|
+
t26,
|
|
550
|
+
t33,
|
|
551
|
+
t35
|
|
552
|
+
]
|
|
553
|
+
});
|
|
554
|
+
$[121] = t25;
|
|
555
|
+
$[122] = t26;
|
|
556
|
+
$[123] = t33;
|
|
557
|
+
$[124] = t35;
|
|
558
|
+
$[125] = t36;
|
|
559
|
+
} else t36 = $[125];
|
|
560
|
+
let t37;
|
|
561
|
+
if ($[126] !== label) {
|
|
562
|
+
t37 = /* @__PURE__ */ jsx("caption", { children: label });
|
|
563
|
+
$[126] = label;
|
|
564
|
+
$[127] = t37;
|
|
565
|
+
} else t37 = $[127];
|
|
566
|
+
let t38;
|
|
567
|
+
if ($[128] !== format || $[129] !== points) {
|
|
568
|
+
let t39;
|
|
569
|
+
if ($[131] !== format) {
|
|
570
|
+
t39 = (data_1, index_3) => /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
|
|
274
571
|
scope: "row",
|
|
275
|
-
children:
|
|
276
|
-
}), /* @__PURE__ */ jsx("td", { children: format(
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
} else
|
|
280
|
-
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
} else
|
|
285
|
-
let
|
|
286
|
-
if ($[
|
|
287
|
-
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
} else
|
|
291
|
-
let
|
|
292
|
-
if ($[
|
|
293
|
-
|
|
572
|
+
children: data_1.label
|
|
573
|
+
}), /* @__PURE__ */ jsx("td", { children: format(data_1.value) })] }, index_3);
|
|
574
|
+
$[131] = format;
|
|
575
|
+
$[132] = t39;
|
|
576
|
+
} else t39 = $[132];
|
|
577
|
+
t38 = points.map(t39);
|
|
578
|
+
$[128] = format;
|
|
579
|
+
$[129] = points;
|
|
580
|
+
$[130] = t38;
|
|
581
|
+
} else t38 = $[130];
|
|
582
|
+
let t39;
|
|
583
|
+
if ($[133] !== t38) {
|
|
584
|
+
t39 = /* @__PURE__ */ jsx("tbody", { children: t38 });
|
|
585
|
+
$[133] = t38;
|
|
586
|
+
$[134] = t39;
|
|
587
|
+
} else t39 = $[134];
|
|
588
|
+
let t40;
|
|
589
|
+
if ($[135] !== t37 || $[136] !== t39) {
|
|
590
|
+
t40 = /* @__PURE__ */ jsx("div", {
|
|
294
591
|
className: LineChart_module_default.visuallyHidden,
|
|
295
|
-
children: /* @__PURE__ */ jsxs("table", { children: [
|
|
592
|
+
children: /* @__PURE__ */ jsxs("table", { children: [t37, t39] })
|
|
296
593
|
});
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
} else
|
|
301
|
-
let
|
|
302
|
-
if ($[
|
|
303
|
-
|
|
304
|
-
className:
|
|
305
|
-
style:
|
|
594
|
+
$[135] = t37;
|
|
595
|
+
$[136] = t39;
|
|
596
|
+
$[137] = t40;
|
|
597
|
+
} else t40 = $[137];
|
|
598
|
+
let t41;
|
|
599
|
+
if ($[138] !== t27 || $[139] !== t28 || $[140] !== t29 || $[141] !== t30 || $[142] !== t31 || $[143] !== t36 || $[144] !== t40) {
|
|
600
|
+
t41 = /* @__PURE__ */ jsxs("figure", {
|
|
601
|
+
className: t27,
|
|
602
|
+
style: t28,
|
|
603
|
+
"data-axis": t29,
|
|
604
|
+
"data-labels": t30,
|
|
306
605
|
children: [
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
606
|
+
t31,
|
|
607
|
+
t36,
|
|
608
|
+
t40
|
|
310
609
|
]
|
|
311
610
|
});
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
$[
|
|
318
|
-
|
|
319
|
-
|
|
611
|
+
$[138] = t27;
|
|
612
|
+
$[139] = t28;
|
|
613
|
+
$[140] = t29;
|
|
614
|
+
$[141] = t30;
|
|
615
|
+
$[142] = t31;
|
|
616
|
+
$[143] = t36;
|
|
617
|
+
$[144] = t40;
|
|
618
|
+
$[145] = t41;
|
|
619
|
+
} else t41 = $[145];
|
|
620
|
+
return t41;
|
|
621
|
+
}
|
|
622
|
+
/** The position of a mark on the plot, and its place along the width, to keep its label inside. */
|
|
623
|
+
function _temp3(widest, text) {
|
|
624
|
+
return text.length > widest.length ? text : widest;
|
|
625
|
+
}
|
|
626
|
+
function _temp2(point_1) {
|
|
627
|
+
return point_1.shortLabel ?? point_1.label;
|
|
320
628
|
}
|
|
321
629
|
function _temp(point) {
|
|
322
630
|
return point.value;
|
|
323
631
|
}
|
|
632
|
+
function positionOf(where) {
|
|
633
|
+
return {
|
|
634
|
+
left: `${where.x}%`,
|
|
635
|
+
top: `${where.y}%`,
|
|
636
|
+
"--_x": where.x
|
|
637
|
+
};
|
|
638
|
+
}
|
|
324
639
|
//#endregion
|
|
325
640
|
export { LineChart };
|
|
326
641
|
|