@gerege-systems/ui 0.15.0 → 0.16.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/README.md +6 -6
- package/dist-lib/components/ui/Alert.js +11 -9
- package/dist-lib/components/ui/Alert.js.map +1 -1
- package/dist-lib/components/ui/Button.js +19 -16
- package/dist-lib/components/ui/Button.js.map +1 -1
- package/dist-lib/components/ui/Calendar.js +3 -1
- package/dist-lib/components/ui/Calendar.js.map +1 -1
- package/dist-lib/components/ui/Carousel.js.map +1 -1
- package/dist-lib/components/ui/Chart.js +107 -105
- package/dist-lib/components/ui/Chart.js.map +1 -1
- package/dist-lib/components/ui/Combobox.js +19 -18
- package/dist-lib/components/ui/Combobox.js.map +1 -1
- package/dist-lib/components/ui/FileUpload.js +34 -35
- package/dist-lib/components/ui/FileUpload.js.map +1 -1
- package/dist-lib/components/ui/Icon.js +12 -12
- package/dist-lib/components/ui/Icon.js.map +1 -1
- package/dist-lib/components/ui/IconButton.js +4 -4
- package/dist-lib/components/ui/IconButton.js.map +1 -1
- package/dist-lib/components/ui/Pagination.js +35 -33
- package/dist-lib/components/ui/Pagination.js.map +1 -1
- package/dist-lib/components/ui/Spinner.d.ts +1 -1
- package/dist-lib/components/ui/Spinner.js.map +1 -1
- package/dist-lib/components/ui/Toast.js +0 -1
- package/dist-lib/components/ui/Toast.js.map +1 -1
- package/dist-lib/hooks/use-debounce.js +14 -17
- package/dist-lib/hooks/use-debounce.js.map +1 -1
- package/dist-lib/hooks/use-delayed-loading.js +8 -8
- package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
- package/dist-lib/hooks/use-modifier-key.d.ts +0 -4
- package/dist-lib/hooks/use-modifier-key.js +11 -12
- package/dist-lib/hooks/use-modifier-key.js.map +1 -1
- package/dist-lib/styles.css +1 -1
- package/dist-lib/theme.css +38 -28
- package/package.json +5 -11
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as s, jsxs as $, Fragment as U } from "react/jsx-runtime";
|
|
3
|
-
import { useId as oe, useState as
|
|
3
|
+
import { useId as oe, useState as K, useRef as ae, useCallback as se, useEffect as ie, useLayoutEffect as ce } from "react";
|
|
4
4
|
import { cn as w } from "../../lib/utils.js";
|
|
5
5
|
import { useStrings as X } from "../../hooks/use-strings.js";
|
|
6
|
-
import { formatString as
|
|
6
|
+
import { formatString as z } from "../../lib/strings.js";
|
|
7
7
|
import { Skeleton as le } from "./Skeleton.js";
|
|
8
|
-
const
|
|
8
|
+
const Ce = {
|
|
9
9
|
summary: ({ name: e, count: n, min: r, max: t, lastX: o, lastY: a }) => `${e}: ${n} points, min ${r}, max ${t}, last ${o}: ${a}`,
|
|
10
10
|
point: (e, n, r) => `${e ? `${e} — ` : ""}${n}: ${r}`,
|
|
11
11
|
series: (e, n) => `${e}, ${n} points. Use arrow keys to move between points.`
|
|
12
12
|
};
|
|
13
13
|
function V(e) {
|
|
14
14
|
return {
|
|
15
|
-
summary: ({ name: n, count: r, min: t, max: o, lastX: a, lastY: i }) =>
|
|
16
|
-
point: (n, r, t) => (n ? `${n} — ` : "") +
|
|
17
|
-
series: (n, r) =>
|
|
15
|
+
summary: ({ name: n, count: r, min: t, max: o, lastX: a, lastY: i }) => z(e.summary, { name: n, count: r, min: t, max: o, x: a, y: i }),
|
|
16
|
+
point: (n, r, t) => (n ? `${n} — ` : "") + z(e.point, { x: r, y: t }),
|
|
17
|
+
series: (n, r) => z(e.seriesNav, { name: n, count: r })
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
const q = [
|
|
@@ -24,31 +24,31 @@ const q = [
|
|
|
24
24
|
"var(--chart-4)",
|
|
25
25
|
"var(--chart-5)",
|
|
26
26
|
"var(--chart-6)"
|
|
27
|
-
], de = 600, S = 6;
|
|
28
|
-
function
|
|
29
|
-
const e = ae(null), [n, r] =
|
|
30
|
-
return (
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
return
|
|
27
|
+
], de = 600, S = 6, ue = typeof window > "u" ? ie : ce;
|
|
28
|
+
function fe() {
|
|
29
|
+
const e = ae(null), [n, r] = K(0);
|
|
30
|
+
return ue(() => {
|
|
31
|
+
const t = e.current;
|
|
32
|
+
if (!t) return;
|
|
33
|
+
const o = () => r(t.clientWidth);
|
|
34
|
+
if (o(), typeof ResizeObserver > "u") return;
|
|
35
|
+
const a = new ResizeObserver(o);
|
|
36
|
+
return a.observe(t), () => a.disconnect();
|
|
37
37
|
}, []), { ref: e, width: n || de };
|
|
38
38
|
}
|
|
39
39
|
const he = 5;
|
|
40
|
-
function
|
|
40
|
+
function me(e) {
|
|
41
41
|
const n = Math.abs(e), r = (t, o) => `${(Math.round(t * 10) / 10).toString()}${o}`;
|
|
42
42
|
return n >= 1e9 ? r(e / 1e9, "B") : n >= 1e6 ? r(e / 1e6, "M") : n >= 1e3 ? r(e / 1e3, "K") : Number.isInteger(e) ? String(e) : (Math.round(e * 100) / 100).toString();
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function xe(e) {
|
|
45
45
|
if (e <= 0) return 1;
|
|
46
46
|
const r = 10 ** Math.floor(Math.log10(e)), t = e / r;
|
|
47
47
|
return (t <= 1 ? 1 : t <= 2 ? 2 : t <= 2.5 ? 2.5 : t <= 5 ? 5 : 10) * r;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function pe(e, n, r = he) {
|
|
50
50
|
n === e && (n = e + 1);
|
|
51
|
-
const t =
|
|
51
|
+
const t = xe((n - e) / Math.max(1, r - 1)), o = Math.floor(e / t) * t, a = Math.ceil(n / t) * t, i = [];
|
|
52
52
|
for (let c = a; c >= o - t / 2; c -= t) i.push(Number(c.toFixed(10)));
|
|
53
53
|
return { min: o, max: a, ticks: i };
|
|
54
54
|
}
|
|
@@ -57,7 +57,7 @@ function J(e, n) {
|
|
|
57
57
|
}
|
|
58
58
|
const k = (e) => typeof e == "number";
|
|
59
59
|
function Q(e, n = !0) {
|
|
60
|
-
const r = e.flatMap((
|
|
60
|
+
const r = e.flatMap((h) => h.data.map((u) => u.y).filter(k)), t = n ? Math.min(0, ...r) : Math.min(...r), o = Math.max(...r, n ? 1 : -1 / 0), { min: a, max: i, ticks: c } = pe(
|
|
61
61
|
Number.isFinite(t) ? t : 0,
|
|
62
62
|
o === -1 / 0 ? 1 : o
|
|
63
63
|
);
|
|
@@ -72,24 +72,24 @@ function G(e) {
|
|
|
72
72
|
if (e.length < 3) return e.map((r, t) => `${t ? "L" : "M"}${r[0]},${r[1]}`).join(" ");
|
|
73
73
|
let n = `M${e[0][0]},${e[0][1]}`;
|
|
74
74
|
for (let r = 0; r < e.length - 1; r++) {
|
|
75
|
-
const t = e[r - 1] ?? e[r], o = e[r], a = e[r + 1], i = e[r + 2] ?? a, c = o[0] + (a[0] - t[0]) / 6,
|
|
76
|
-
n += ` C${c.toFixed(1)},${
|
|
75
|
+
const t = e[r - 1] ?? e[r], o = e[r], a = e[r + 1], i = e[r + 2] ?? a, c = o[0] + (a[0] - t[0]) / 6, h = o[1] + (a[1] - t[1]) / 6, u = a[0] - (i[0] - o[0]) / 6, l = a[1] - (i[1] - o[1]) / 6;
|
|
76
|
+
n += ` C${c.toFixed(1)},${h.toFixed(1)} ${u.toFixed(1)},${l.toFixed(1)} ${a[0].toFixed(1)},${a[1].toFixed(1)}`;
|
|
77
77
|
}
|
|
78
78
|
return n;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function ye(e, n, r) {
|
|
81
81
|
const t = [];
|
|
82
82
|
let o = [];
|
|
83
83
|
return e.forEach((a, i) => {
|
|
84
84
|
k(a.y) ? o.push([n(i), r(a.y)]) : o.length && (t.push(o), o = []);
|
|
85
85
|
}), o.length && t.push(o), t;
|
|
86
86
|
}
|
|
87
|
-
const Y = (e, n, r) => e.name ??
|
|
88
|
-
function
|
|
87
|
+
const Y = (e, n, r) => e.name ?? z(r.series, { n: n + 1 });
|
|
88
|
+
function be(e, n, r) {
|
|
89
89
|
return e.map((t, o) => {
|
|
90
|
-
const a = t.data.map((
|
|
90
|
+
const a = t.data.map((h) => h.y).filter(k), i = Y(t, o, n);
|
|
91
91
|
if (!a.length) return `${i}: ${n.noData}`;
|
|
92
|
-
const c = [...t.data].reverse().find((
|
|
92
|
+
const c = [...t.data].reverse().find((h) => k(h.y));
|
|
93
93
|
return r.summary({
|
|
94
94
|
name: i,
|
|
95
95
|
count: a.length,
|
|
@@ -125,32 +125,32 @@ function ge({ ticks: e }) {
|
|
|
125
125
|
{
|
|
126
126
|
"aria-hidden": !0,
|
|
127
127
|
className: "tabular text-foreground-subtle pointer-events-none flex shrink-0 flex-col justify-between py-1.5 pr-1.5 text-right text-xs",
|
|
128
|
-
children: e.map((n, r) => /* @__PURE__ */ s("span", { className: "leading-none", children:
|
|
128
|
+
children: e.map((n, r) => /* @__PURE__ */ s("span", { className: "leading-none", children: me(n) }, r))
|
|
129
129
|
}
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function ve({ first: e, last: n }) {
|
|
133
133
|
return e ? /* @__PURE__ */ $("div", { "aria-hidden": !0, className: "text-foreground-subtle flex justify-between text-xs", children: [
|
|
134
134
|
/* @__PURE__ */ s("span", { children: String(e.x) }),
|
|
135
135
|
n && n !== e && /* @__PURE__ */ s("span", { children: String(n.x) })
|
|
136
136
|
] }) : null;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function $e({
|
|
139
139
|
id: e,
|
|
140
140
|
all: n,
|
|
141
141
|
name: r,
|
|
142
142
|
visible: t,
|
|
143
143
|
t: o
|
|
144
144
|
}) {
|
|
145
|
-
var
|
|
146
|
-
const a = Math.max(...n.map((u) => u.data.length)), i = ((
|
|
145
|
+
var h;
|
|
146
|
+
const a = Math.max(...n.map((u) => u.data.length)), i = ((h = n.find((u) => u.data.length === a)) == null ? void 0 : h.data) ?? [], c = /* @__PURE__ */ $(
|
|
147
147
|
"table",
|
|
148
148
|
{
|
|
149
149
|
id: e,
|
|
150
150
|
"data-chart-table": !0,
|
|
151
151
|
className: w(t && "tabular text-foreground-muted mt-2 w-full text-left text-xs"),
|
|
152
152
|
children: [
|
|
153
|
-
/* @__PURE__ */ s("caption", { className: w(t && "text-foreground-subtle pb-1 text-left"), children:
|
|
153
|
+
/* @__PURE__ */ s("caption", { className: w(t && "text-foreground-subtle pb-1 text-left"), children: z(o.tableCaption, { name: r ?? "" }).trim() }),
|
|
154
154
|
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ $("tr", { children: [
|
|
155
155
|
/* @__PURE__ */ s("th", { scope: "col", className: w(t && "border-border border-b py-1 pr-3 font-medium"), children: "x" }),
|
|
156
156
|
n.map((u, l) => /* @__PURE__ */ s(
|
|
@@ -166,8 +166,8 @@ function ve({
|
|
|
166
166
|
/* @__PURE__ */ s("tbody", { children: i.map((u, l) => /* @__PURE__ */ $("tr", { children: [
|
|
167
167
|
/* @__PURE__ */ s("th", { scope: "row", className: w(t && "py-0.5 pr-3 font-normal"), children: String(u.x) }),
|
|
168
168
|
n.map((d, m) => {
|
|
169
|
-
var
|
|
170
|
-
return /* @__PURE__ */ s("td", { className: w(t && "py-0.5 pr-3"), children: k((
|
|
169
|
+
var f, y;
|
|
170
|
+
return /* @__PURE__ */ s("td", { className: w(t && "py-0.5 pr-3"), children: k((f = d.data[l]) == null ? void 0 : f.y) ? String((y = d.data[l]) == null ? void 0 : y.y) : "—" }, m);
|
|
171
171
|
})
|
|
172
172
|
] }, l)) })
|
|
173
173
|
]
|
|
@@ -184,36 +184,36 @@ function te({
|
|
|
184
184
|
width: a,
|
|
185
185
|
className: i,
|
|
186
186
|
showAxis: c,
|
|
187
|
-
ticks:
|
|
187
|
+
ticks: h,
|
|
188
188
|
xFirst: u,
|
|
189
189
|
xLast: l,
|
|
190
190
|
tableFallback: d,
|
|
191
191
|
showTableToggle: m,
|
|
192
|
-
state:
|
|
192
|
+
state: f,
|
|
193
193
|
labels: y,
|
|
194
|
-
children:
|
|
194
|
+
children: _
|
|
195
195
|
}) {
|
|
196
|
-
const
|
|
196
|
+
const b = X().chart, x = oe().replace(/:/g, ""), I = `chart-cap-${x}`, F = `chart-title-${x}`, C = `chart-desc-${x}`, O = `chart-table-${x}`, v = n ?? r, [p, M] = K(!1), { ref: P, width: A } = fe(), N = Me(t, b, y);
|
|
197
197
|
typeof process < "u" && process.env.NODE_ENV !== "production" && !v && !e && console.warn(
|
|
198
198
|
"[gerege-systems/ui] Chart: provide `caption`, `aria-label`, or `title` so the chart has an accessible name."
|
|
199
199
|
);
|
|
200
|
-
const L = (d || p) && !
|
|
200
|
+
const L = (d || p) && !f, R = f === "loading" ? /* @__PURE__ */ $("div", { role: "status", "aria-label": b.loading, style: { height: o }, className: "w-full", children: [
|
|
201
201
|
/* @__PURE__ */ s(le, { style: { height: o }, className: "w-full" }),
|
|
202
|
-
/* @__PURE__ */ s("span", { className: "sr-only", children:
|
|
203
|
-
] }) :
|
|
202
|
+
/* @__PURE__ */ s("span", { className: "sr-only", children: b.loading })
|
|
203
|
+
] }) : f ? /* @__PURE__ */ s(
|
|
204
204
|
"div",
|
|
205
205
|
{
|
|
206
|
-
role:
|
|
206
|
+
role: f === "error" ? "alert" : "status",
|
|
207
207
|
style: { height: o },
|
|
208
208
|
className: "text-foreground-subtle flex w-full items-center justify-center text-sm",
|
|
209
|
-
children:
|
|
209
|
+
children: f === "error" ? b.error : b.empty
|
|
210
210
|
}
|
|
211
211
|
) : null;
|
|
212
212
|
return /* @__PURE__ */ $("figure", { className: w("flex flex-col gap-1.5", i), style: { width: a }, children: [
|
|
213
213
|
e && /* @__PURE__ */ s("figcaption", { id: I, className: "text-foreground-muted text-xs", children: e }),
|
|
214
214
|
R ?? /* @__PURE__ */ $(U, { children: [
|
|
215
215
|
/* @__PURE__ */ $("div", { className: "flex", children: [
|
|
216
|
-
c && /* @__PURE__ */ s(ge, { ticks:
|
|
216
|
+
c && /* @__PURE__ */ s(ge, { ticks: h }),
|
|
217
217
|
/* @__PURE__ */ s("div", { ref: P, className: "min-w-0 flex-1", children: /* @__PURE__ */ $(
|
|
218
218
|
"svg",
|
|
219
219
|
{
|
|
@@ -227,16 +227,16 @@ function te({
|
|
|
227
227
|
className: "block max-w-full overflow-visible",
|
|
228
228
|
children: [
|
|
229
229
|
v && /* @__PURE__ */ s("title", { id: F, children: v }),
|
|
230
|
-
/* @__PURE__ */ s("desc", { id: C, children:
|
|
231
|
-
|
|
230
|
+
/* @__PURE__ */ s("desc", { id: C, children: be(t, b, y) }),
|
|
231
|
+
_({ width: A, ...N })
|
|
232
232
|
]
|
|
233
233
|
}
|
|
234
234
|
) })
|
|
235
235
|
] }),
|
|
236
|
-
c && /* @__PURE__ */ s(
|
|
236
|
+
c && /* @__PURE__ */ s(ve, { first: u, last: l }),
|
|
237
237
|
/* @__PURE__ */ s("span", { className: "sr-only", "aria-live": "polite", "aria-atomic": "true", children: N.announcement })
|
|
238
238
|
] }),
|
|
239
|
-
m && !
|
|
239
|
+
m && !f && /* @__PURE__ */ s(
|
|
240
240
|
"button",
|
|
241
241
|
{
|
|
242
242
|
type: "button",
|
|
@@ -245,35 +245,37 @@ function te({
|
|
|
245
245
|
"aria-controls": L ? O : void 0,
|
|
246
246
|
className: w(
|
|
247
247
|
"text-foreground-subtle hover:text-foreground self-start rounded-sm text-xs underline-offset-2 outline-hidden hover:underline",
|
|
248
|
+
// Text-sized: the 24×24 target (WCAG 2.5.8) is an invisible centred hit area.
|
|
249
|
+
'relative before:absolute before:top-1/2 before:left-1/2 before:size-[max(100%,1.5rem)] before:-translate-x-1/2 before:-translate-y-1/2 before:content-[""]',
|
|
248
250
|
"focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2"
|
|
249
251
|
),
|
|
250
|
-
children: p ?
|
|
252
|
+
children: p ? b.hideTable : b.viewAsTable
|
|
251
253
|
}
|
|
252
254
|
),
|
|
253
255
|
L && /* @__PURE__ */ s(
|
|
254
|
-
|
|
256
|
+
$e,
|
|
255
257
|
{
|
|
256
258
|
id: O,
|
|
257
259
|
all: t,
|
|
258
260
|
name: v ?? (typeof e == "string" ? e : void 0),
|
|
259
261
|
visible: p,
|
|
260
|
-
t:
|
|
262
|
+
t: b
|
|
261
263
|
}
|
|
262
264
|
)
|
|
263
265
|
] });
|
|
264
266
|
}
|
|
265
|
-
function
|
|
266
|
-
const [t, o] =
|
|
267
|
+
function Me(e, n, r) {
|
|
268
|
+
const [t, o] = K(null), [a, i] = K(""), c = se(
|
|
267
269
|
(l, d) => {
|
|
268
|
-
const m = e[l],
|
|
269
|
-
!
|
|
270
|
+
const m = e[l], f = m == null ? void 0 : m.data[d];
|
|
271
|
+
!f || !k(f.y) || (o({ series: l, index: d }), i(r.point(m.name, f.x, f.y)));
|
|
270
272
|
},
|
|
271
273
|
[e, r]
|
|
272
|
-
),
|
|
274
|
+
), h = (l) => e[l].data.map((d, m) => k(d.y) ? m : -1).filter((d) => d >= 0);
|
|
273
275
|
return { active: t, announcement: a, seriesProps: (l) => ({
|
|
274
276
|
tabIndex: 0,
|
|
275
277
|
role: "group",
|
|
276
|
-
"aria-label": r.series(Y(e[l], l, n),
|
|
278
|
+
"aria-label": r.series(Y(e[l], l, n), h(l).length),
|
|
277
279
|
// Focus ring comes from theme.css `[data-chart-series]:focus-visible`
|
|
278
280
|
// (CSS outline — Tailwind's box-shadow ring does not paint on SVG <g>).
|
|
279
281
|
"data-chart-series": !0,
|
|
@@ -281,19 +283,19 @@ function $e(e, n, r) {
|
|
|
281
283
|
"[&:focus-visible_[data-active]]:stroke-[var(--ring)] [&:focus-visible_[data-active]]:stroke-[3px]"
|
|
282
284
|
),
|
|
283
285
|
onFocus: () => {
|
|
284
|
-
const d =
|
|
286
|
+
const d = h(l);
|
|
285
287
|
d.length && c(l, (t == null ? void 0 : t.series) === l ? t.index : d[d.length - 1]);
|
|
286
288
|
},
|
|
287
289
|
onBlur: () => {
|
|
288
290
|
o(null), i("");
|
|
289
291
|
},
|
|
290
292
|
onKeyDown: (d) => {
|
|
291
|
-
const m =
|
|
293
|
+
const m = h(l);
|
|
292
294
|
if (!m.length) return;
|
|
293
|
-
const
|
|
294
|
-
let y =
|
|
295
|
-
if (d.key === "ArrowRight" || d.key === "ArrowUp") y = Math.min(m.length - 1,
|
|
296
|
-
else if (d.key === "ArrowLeft" || d.key === "ArrowDown") y = Math.max(0,
|
|
295
|
+
const f = (t == null ? void 0 : t.series) === l ? m.indexOf(t.index) : m.length - 1;
|
|
296
|
+
let y = f;
|
|
297
|
+
if (d.key === "ArrowRight" || d.key === "ArrowUp") y = Math.min(m.length - 1, f + 1);
|
|
298
|
+
else if (d.key === "ArrowLeft" || d.key === "ArrowDown") y = Math.max(0, f - 1);
|
|
297
299
|
else if (d.key === "Home") y = 0;
|
|
298
300
|
else if (d.key === "End") y = m.length - 1;
|
|
299
301
|
else return;
|
|
@@ -301,7 +303,7 @@ function $e(e, n, r) {
|
|
|
301
303
|
}
|
|
302
304
|
}) };
|
|
303
305
|
}
|
|
304
|
-
function
|
|
306
|
+
function Ne({
|
|
305
307
|
x: e,
|
|
306
308
|
y: n,
|
|
307
309
|
color: r,
|
|
@@ -322,7 +324,7 @@ function Me({
|
|
|
322
324
|
}
|
|
323
325
|
);
|
|
324
326
|
}
|
|
325
|
-
function
|
|
327
|
+
function we({
|
|
326
328
|
data: e,
|
|
327
329
|
series: n,
|
|
328
330
|
colors: r = q,
|
|
@@ -331,15 +333,15 @@ function Ne({
|
|
|
331
333
|
caption: a,
|
|
332
334
|
"aria-label": i,
|
|
333
335
|
title: c,
|
|
334
|
-
grid:
|
|
336
|
+
grid: h = !0,
|
|
335
337
|
showAxis: u = !0,
|
|
336
338
|
tableFallback: l = !0,
|
|
337
339
|
showTableToggle: d,
|
|
338
340
|
state: m,
|
|
339
|
-
labels:
|
|
341
|
+
labels: f,
|
|
340
342
|
className: y
|
|
341
343
|
}) {
|
|
342
|
-
const
|
|
344
|
+
const _ = X().chart, b = { ...V(_), ...f }, x = J(e, n), { min: I, range: F, ticks: C } = Q(x), O = Math.max(...x.map((p) => p.data.length)), v = x[0].data;
|
|
343
345
|
return /* @__PURE__ */ s(
|
|
344
346
|
te,
|
|
345
347
|
{
|
|
@@ -357,19 +359,19 @@ function Ne({
|
|
|
357
359
|
tableFallback: l,
|
|
358
360
|
showTableToggle: d,
|
|
359
361
|
state: m,
|
|
360
|
-
labels:
|
|
362
|
+
labels: b,
|
|
361
363
|
children: ({ width: p, active: M, seriesProps: P }) => /* @__PURE__ */ $(U, { children: [
|
|
362
|
-
|
|
364
|
+
h && /* @__PURE__ */ s(ee, { width: p, height: t, lines: C.length - 1 }),
|
|
363
365
|
x.map((A, N) => {
|
|
364
|
-
const L = r[N % r.length], { sx: R, sy: W } = Z(O, p, t, I, F), D =
|
|
365
|
-
(
|
|
366
|
-
).join(" "), B = A.data.map((
|
|
366
|
+
const L = r[N % r.length], { sx: R, sy: W } = Z(O, p, t, I, F), D = ye(A.data, R, W), H = D.map(G).join(" "), j = W(Math.max(I, 0)), E = D.map(
|
|
367
|
+
(g) => `${G(g)} L${g[g.length - 1][0].toFixed(1)},${j.toFixed(1)} L${g[0][0].toFixed(1)},${j.toFixed(1)} Z`
|
|
368
|
+
).join(" "), B = A.data.map((g) => k(g.y)).lastIndexOf(!0);
|
|
367
369
|
return /* @__PURE__ */ $("g", { ...P(N), children: [
|
|
368
|
-
|
|
370
|
+
E && /* @__PURE__ */ s("path", { d: E, fill: L, fillOpacity: 0.08 }),
|
|
369
371
|
/* @__PURE__ */ s(
|
|
370
372
|
"path",
|
|
371
373
|
{
|
|
372
|
-
d:
|
|
374
|
+
d: H,
|
|
373
375
|
fill: "none",
|
|
374
376
|
stroke: L,
|
|
375
377
|
strokeWidth: 2,
|
|
@@ -378,17 +380,17 @@ function Ne({
|
|
|
378
380
|
}
|
|
379
381
|
),
|
|
380
382
|
A.data.map(
|
|
381
|
-
(
|
|
382
|
-
|
|
383
|
+
(g, T) => k(g.y) ? /* @__PURE__ */ s(
|
|
384
|
+
Ne,
|
|
383
385
|
{
|
|
384
|
-
x: R(
|
|
385
|
-
y: W(
|
|
386
|
+
x: R(T),
|
|
387
|
+
y: W(g.y),
|
|
386
388
|
color: L,
|
|
387
|
-
always:
|
|
388
|
-
active: (M == null ? void 0 : M.series) === N && M.index ===
|
|
389
|
-
label:
|
|
389
|
+
always: T === B,
|
|
390
|
+
active: (M == null ? void 0 : M.series) === N && M.index === T,
|
|
391
|
+
label: b.point(A.name, g.x, g.y)
|
|
390
392
|
},
|
|
391
|
-
|
|
393
|
+
T
|
|
392
394
|
) : null
|
|
393
395
|
)
|
|
394
396
|
] }, N);
|
|
@@ -397,10 +399,10 @@ function Ne({
|
|
|
397
399
|
}
|
|
398
400
|
);
|
|
399
401
|
}
|
|
400
|
-
function
|
|
401
|
-
return /* @__PURE__ */ s(
|
|
402
|
+
function We(e) {
|
|
403
|
+
return /* @__PURE__ */ s(we, { ...e });
|
|
402
404
|
}
|
|
403
|
-
function
|
|
405
|
+
function je({
|
|
404
406
|
data: e,
|
|
405
407
|
series: n,
|
|
406
408
|
colors: r = q,
|
|
@@ -409,15 +411,15 @@ function We({
|
|
|
409
411
|
caption: a,
|
|
410
412
|
"aria-label": i,
|
|
411
413
|
title: c,
|
|
412
|
-
grid:
|
|
414
|
+
grid: h = !0,
|
|
413
415
|
showAxis: u = !0,
|
|
414
416
|
tableFallback: l = !0,
|
|
415
417
|
showTableToggle: d,
|
|
416
418
|
state: m,
|
|
417
|
-
labels:
|
|
419
|
+
labels: f,
|
|
418
420
|
className: y
|
|
419
421
|
}) {
|
|
420
|
-
const
|
|
422
|
+
const _ = X().chart, b = { ...V(_), ...f }, x = J(e, n), I = Math.max(...x.map((p) => p.data.length)), { min: F, range: C, ticks: O } = Q(x), v = x[0].data;
|
|
421
423
|
return /* @__PURE__ */ s(
|
|
422
424
|
te,
|
|
423
425
|
{
|
|
@@ -435,11 +437,11 @@ function We({
|
|
|
435
437
|
tableFallback: l,
|
|
436
438
|
showTableToggle: d,
|
|
437
439
|
state: m,
|
|
438
|
-
labels:
|
|
440
|
+
labels: b,
|
|
439
441
|
children: ({ width: p, active: M, seriesProps: P }) => {
|
|
440
442
|
const N = (p - S * 2) / Math.max(1, I), L = N * 0.62, R = Math.max(2, L / x.length), { sy: W } = Z(I, p, t, F, C), D = W(Math.min(Math.max(0, F), F + C));
|
|
441
443
|
return /* @__PURE__ */ $(U, { children: [
|
|
442
|
-
|
|
444
|
+
h && /* @__PURE__ */ s(ee, { width: p, height: t, lines: O.length - 1 }),
|
|
443
445
|
F < 0 && /* @__PURE__ */ s(
|
|
444
446
|
"line",
|
|
445
447
|
{
|
|
@@ -452,16 +454,16 @@ function We({
|
|
|
452
454
|
strokeWidth: 1
|
|
453
455
|
}
|
|
454
456
|
),
|
|
455
|
-
x.map((
|
|
456
|
-
if (!k(
|
|
457
|
-
const
|
|
457
|
+
x.map((H, j) => /* @__PURE__ */ s("g", { ...P(j), children: H.data.map((E, B) => {
|
|
458
|
+
if (!k(E.y)) return null;
|
|
459
|
+
const g = W(E.y), T = S + B * N + (N - L) / 2 + j * R, ne = b.point(H.name, E.x, E.y), re = (M == null ? void 0 : M.series) === j && M.index === B;
|
|
458
460
|
return /* @__PURE__ */ s(
|
|
459
461
|
"rect",
|
|
460
462
|
{
|
|
461
|
-
x:
|
|
462
|
-
y: Math.min(D,
|
|
463
|
+
x: T,
|
|
464
|
+
y: Math.min(D, g),
|
|
463
465
|
width: R,
|
|
464
|
-
height: Math.abs(D -
|
|
466
|
+
height: Math.abs(D - g),
|
|
465
467
|
fill: r[j % r.length],
|
|
466
468
|
rx: 2,
|
|
467
469
|
"data-active": re || void 0,
|
|
@@ -477,12 +479,12 @@ function We({
|
|
|
477
479
|
);
|
|
478
480
|
}
|
|
479
481
|
export {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
+
We as AreaChart,
|
|
483
|
+
je as BarChart,
|
|
482
484
|
q as DEFAULT_CHART_COLORS,
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
485
|
+
we as LineChart,
|
|
486
|
+
me as abbreviateNumber,
|
|
487
|
+
Ce as defaultChartLabels,
|
|
488
|
+
pe as niceTicks
|
|
487
489
|
};
|
|
488
490
|
//# sourceMappingURL=Chart.js.map
|