@gravitee/graphene-charts 2.49.0 → 2.50.0-renovate-react.45a19df
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/BarChart/BarChart.d.ts +8 -1
- package/dist/charts/BarChart/BarChart.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1241 -1238
- package/dist/lib/inferDataKeys.d.ts +5 -2
- package/dist/lib/inferDataKeys.d.ts.map +1 -1
- package/dist/lineage/index.js +1 -1
- package/dist/primitives/CartesianChart.d.ts +8 -2
- package/dist/primitives/CartesianChart.d.ts.map +1 -1
- package/dist/primitives/CartesianContext.d.ts +2 -0
- package/dist/primitives/CartesianContext.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/{primitives-Bg3s-Qxq.js → primitives-CBHhjCs9.js} +212 -191
- package/dist/series/BarSeries.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -143,14 +143,14 @@ function ee() {
|
|
|
143
143
|
//#endregion
|
|
144
144
|
//#region src/primitives/CartesianContext.tsx
|
|
145
145
|
var j = a.createContext(null);
|
|
146
|
-
function
|
|
146
|
+
function te() {
|
|
147
147
|
let e = a.useContext(j);
|
|
148
148
|
if (!e) throw Error("useCartesianContext must be used within a <CartesianChart>");
|
|
149
149
|
return e;
|
|
150
150
|
}
|
|
151
151
|
//#endregion
|
|
152
152
|
//#region src/primitives/Grid.tsx
|
|
153
|
-
function
|
|
153
|
+
function M({ scale: e, length: t, orientation: n, tickCount: r = 5 }) {
|
|
154
154
|
let i = a.useContext(j), s = e ?? i?.valueScale, c = i?.layout === "vertical", l = n ?? (c ? "horizontal" : "vertical"), u = t ?? (l === "horizontal" ? i?.innerWidth : i?.innerHeight) ?? 0;
|
|
155
155
|
if (!s) return null;
|
|
156
156
|
let d = s.ticks(r), f = l === "horizontal";
|
|
@@ -177,8 +177,8 @@ function te({ scale: e, length: t, orientation: n, tickCount: r = 5 }) {
|
|
|
177
177
|
}
|
|
178
178
|
//#endregion
|
|
179
179
|
//#region src/primitives/ReferenceLine.tsx
|
|
180
|
-
var N = 6, P = 20, F = 6.2, I = 12,
|
|
181
|
-
function
|
|
180
|
+
var N = 6, P = 20, F = 6.2, I = 12, L = "\n@keyframes graphene-refline-fadein {\n from { opacity: 0; }\n to { opacity: var(--_refline-opacity); }\n}\n@keyframes graphene-refline-pulse {\n 0%, 100% { stroke-opacity: 0.7; }\n 50% { stroke-opacity: 0.3; }\n}\n[data-graphene-refline] {\n animation: graphene-refline-fadein 300ms ease-out forwards;\n}\n[data-graphene-refline-pulse] {\n animation: graphene-refline-pulse 2s ease-in-out infinite;\n}\n@media (prefers-reduced-motion: reduce) {\n [data-graphene-refline] {\n animation: none;\n opacity: var(--_refline-opacity);\n }\n [data-graphene-refline-pulse] {\n animation: none;\n }\n}\n";
|
|
181
|
+
function R({ x: e, y: t, axisId: n, stroke: r = "currentColor", strokeDasharray: i, strokeWidth: c = 1.5, label: l, labelPosition: u = "end", pulse: d = !1 }) {
|
|
182
182
|
let f = a.useContext(j);
|
|
183
183
|
if (!f) return null;
|
|
184
184
|
let { categoryScale: p, resolveValueScale: m, innerWidth: h, innerHeight: g, layout: _ } = f, v = m(n), y = _ === "vertical", b = e !== void 0, x = t !== void 0;
|
|
@@ -197,7 +197,7 @@ function L({ x: e, y: t, axisId: n, stroke: r = "currentColor", strokeDasharray:
|
|
|
197
197
|
}
|
|
198
198
|
let E = w && S >= 0 && S <= h, D = T && C >= 0 && C <= g;
|
|
199
199
|
if (!E && !D) return null;
|
|
200
|
-
let O = d ? .7 : .8, k = l ?
|
|
200
|
+
let O = d ? .7 : .8, k = l ? z(u, {
|
|
201
201
|
xPos: S,
|
|
202
202
|
yPos: C,
|
|
203
203
|
xInBounds: E,
|
|
@@ -215,7 +215,7 @@ function L({ x: e, y: t, axisId: n, stroke: r = "currentColor", strokeDasharray:
|
|
|
215
215
|
children: [
|
|
216
216
|
/* @__PURE__ */ o("style", {
|
|
217
217
|
precedence: "graphene-charts",
|
|
218
|
-
children:
|
|
218
|
+
children: L
|
|
219
219
|
}),
|
|
220
220
|
E && /* @__PURE__ */ o("line", {
|
|
221
221
|
x1: S,
|
|
@@ -260,11 +260,11 @@ function L({ x: e, y: t, axisId: n, stroke: r = "currentColor", strokeDasharray:
|
|
|
260
260
|
]
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function ne(e) {
|
|
264
264
|
return e * F + I;
|
|
265
265
|
}
|
|
266
|
-
function
|
|
267
|
-
let { xPos: n, yPos: r, xInBounds: i, yInBounds: a, hasX: o, hasY: s, innerWidth: c, innerHeight: l, labelLength: u } = t, d =
|
|
266
|
+
function z(e, t) {
|
|
267
|
+
let { xPos: n, yPos: r, xInBounds: i, yInBounds: a, hasX: o, hasY: s, innerWidth: c, innerHeight: l, labelLength: u } = t, d = ne(u);
|
|
268
268
|
if (o && s && i && a) {
|
|
269
269
|
let e = n + N + d > c, t = r + N + P > l;
|
|
270
270
|
return {
|
|
@@ -276,49 +276,49 @@ function re(e, t) {
|
|
|
276
276
|
if (s && a) {
|
|
277
277
|
let t = r - N - P < 0;
|
|
278
278
|
return {
|
|
279
|
-
x:
|
|
279
|
+
x: re(e, c, d),
|
|
280
280
|
y: t ? r + N : r - N - P,
|
|
281
281
|
width: d
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
return o && i ? {
|
|
285
285
|
x: n + N + d > c ? n - N - d : n + N,
|
|
286
|
-
y:
|
|
286
|
+
y: B(e, l),
|
|
287
287
|
width: d
|
|
288
288
|
} : null;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function B(e, t) {
|
|
291
291
|
return e === "start" ? N : e === "center" ? t / 2 - P / 2 : t - P - N;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function re(e, t, n) {
|
|
294
294
|
return e === "start" ? N : e === "center" ? t / 2 - n / 2 : t - n - N;
|
|
295
295
|
}
|
|
296
296
|
//#endregion
|
|
297
297
|
//#region src/primitives/Axis.tsx
|
|
298
|
-
var
|
|
299
|
-
function
|
|
298
|
+
var V = 7, H = 16, U = 8, W = "…";
|
|
299
|
+
function ie(e, t, n) {
|
|
300
300
|
let r = e.length;
|
|
301
301
|
if (r <= 1) return new Set(Array.from({ length: r }, (e, t) => t));
|
|
302
|
-
let i = n ? Math.max(...e.map((e) => e.length *
|
|
302
|
+
let i = n ? Math.max(...e.map((e) => e.length * V)) : H, a = Math.max(1, Math.floor(t / (i + U)));
|
|
303
303
|
if (a >= r) return new Set(Array.from({ length: r }, (e, t) => t));
|
|
304
304
|
let o = Math.ceil(r / a), s = /* @__PURE__ */ new Set();
|
|
305
305
|
for (let e = 0; e < r; e += o) s.add(e);
|
|
306
306
|
let c = r - 1;
|
|
307
307
|
return c - Math.floor((c - 1) / o) * o >= o && s.add(c), s;
|
|
308
308
|
}
|
|
309
|
-
function
|
|
310
|
-
let n = Math.floor(t /
|
|
311
|
-
return n <= 1 ?
|
|
309
|
+
function G(e, t) {
|
|
310
|
+
let n = Math.floor(t / V);
|
|
311
|
+
return n <= 1 ? W : e.length <= n ? e : e.slice(0, n - 1) + W;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function K(e, t, n, r) {
|
|
314
314
|
if (t) return Math.max(1, Math.floor(e / 24));
|
|
315
|
-
let i = Math.max(...n.map((e) => r(e).length)) *
|
|
316
|
-
return Math.max(1, Math.floor(e / (i +
|
|
315
|
+
let i = Math.max(...n.map((e) => r(e).length)) * V;
|
|
316
|
+
return Math.max(1, Math.floor(e / (i + U)));
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function ae({ scale: e, orientation: t, length: n }) {
|
|
319
319
|
let r = a.useContext(j), i = e ?? r?.categoryScale, s = r?.layout !== "horizontal", c = t ?? (s ? "bottom" : "left"), l = n ?? (c === "bottom" ? r?.innerHeight : 0) ?? 0, u = r?.categoryTickFormatter ?? ((e) => e);
|
|
320
320
|
if (!i) return null;
|
|
321
|
-
let d = i.domain(), f = d.map(u), p =
|
|
321
|
+
let d = i.domain(), f = d.map(u), p = ie(f, c === "bottom" ? r?.innerWidth ?? 0 : r?.innerHeight ?? 0, c === "bottom");
|
|
322
322
|
if (c === "bottom") return /* @__PURE__ */ o("g", {
|
|
323
323
|
transform: `translate(0,${l})`,
|
|
324
324
|
"aria-hidden": "true",
|
|
@@ -330,7 +330,7 @@ function G({ scale: e, orientation: t, length: n }) {
|
|
|
330
330
|
children: f[t]
|
|
331
331
|
}, e) : null)
|
|
332
332
|
});
|
|
333
|
-
let m = r?.marginLeft ?? 40, h = Math.max(0, m -
|
|
333
|
+
let m = r?.marginLeft ?? 40, h = Math.max(0, m - U);
|
|
334
334
|
return /* @__PURE__ */ o("g", {
|
|
335
335
|
"aria-hidden": "true",
|
|
336
336
|
children: d.map((e, t) => p.has(t) ? /* @__PURE__ */ o("text", {
|
|
@@ -339,14 +339,14 @@ function G({ scale: e, orientation: t, length: n }) {
|
|
|
339
339
|
textAnchor: "end",
|
|
340
340
|
dominantBaseline: "middle",
|
|
341
341
|
className: "fill-muted-foreground text-xs",
|
|
342
|
-
children:
|
|
342
|
+
children: G(f[t], h)
|
|
343
343
|
}, e) : null)
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function q({ scale: e, orientation: t, axisId: n, unit: r, length: i, tickCount: s = 5, tickFormatter: c }) {
|
|
347
347
|
let l = a.useContext(j), u = n && l?.resolveValueScale ? l.resolveValueScale(n) : l?.valueScale, d = e ?? u, f = l?.layout !== "horizontal", p = t ?? (f ? "left" : "bottom"), m = i ?? (p === "bottom" ? l?.innerHeight : 0) ?? 0, h = c ?? l?.valueTickFormatter ?? String, g = r ?? l?.axisUnits?.[n ?? "left"];
|
|
348
348
|
if (!d) return null;
|
|
349
|
-
let _ = d.ticks(s), v = p === "left" || p === "right", y =
|
|
349
|
+
let _ = d.ticks(s), v = p === "left" || p === "right", y = K(v ? l?.innerHeight ?? 0 : l?.innerWidth ?? 0, v, _, h), b = y >= _.length ? _ : d.ticks(y), x = b.length > 0 ? Math.max(...b) : void 0, S = (e) => {
|
|
350
350
|
let t = h(e);
|
|
351
351
|
return g && e === x ? `${t} ${g}` : t;
|
|
352
352
|
};
|
|
@@ -366,7 +366,7 @@ function K({ scale: e, orientation: t, axisId: n, unit: r, length: i, tickCount:
|
|
|
366
366
|
return /* @__PURE__ */ o("g", {
|
|
367
367
|
"aria-hidden": "true",
|
|
368
368
|
children: b.map((t) => /* @__PURE__ */ o("text", {
|
|
369
|
-
x: e +
|
|
369
|
+
x: e + U,
|
|
370
370
|
y: d(t),
|
|
371
371
|
textAnchor: "start",
|
|
372
372
|
dominantBaseline: "middle",
|
|
@@ -388,7 +388,7 @@ function K({ scale: e, orientation: t, axisId: n, unit: r, length: i, tickCount:
|
|
|
388
388
|
}
|
|
389
389
|
//#endregion
|
|
390
390
|
//#region src/primitives/roundedRect.ts
|
|
391
|
-
function
|
|
391
|
+
function J(e, t, n, r, i) {
|
|
392
392
|
let a = Math.min(i.tl, n / 2, r / 2), o = Math.min(i.tr, n / 2, r / 2), s = Math.min(i.br, n / 2, r / 2), c = Math.min(i.bl, n / 2, r / 2);
|
|
393
393
|
return [
|
|
394
394
|
`M${e + a},${t}`,
|
|
@@ -405,30 +405,30 @@ function q(e, t, n, r, i) {
|
|
|
405
405
|
}
|
|
406
406
|
//#endregion
|
|
407
407
|
//#region src/primitives/ChartSlots.tsx
|
|
408
|
-
var
|
|
409
|
-
function
|
|
410
|
-
return a.useContext(
|
|
408
|
+
var Y = a.createContext(null);
|
|
409
|
+
function oe() {
|
|
410
|
+
return a.useContext(Y) || {
|
|
411
411
|
tooltip: null,
|
|
412
412
|
legend: null,
|
|
413
413
|
setTooltip: () => void 0,
|
|
414
414
|
setLegend: () => void 0
|
|
415
415
|
};
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function X({ children: e }) {
|
|
418
418
|
let [t, n] = a.useState(null), [r, i] = a.useState(null), s = a.useMemo(() => ({
|
|
419
419
|
tooltip: t,
|
|
420
420
|
legend: r,
|
|
421
421
|
setTooltip: n,
|
|
422
422
|
setLegend: i
|
|
423
423
|
}), [t, r]);
|
|
424
|
-
return /* @__PURE__ */ o(
|
|
424
|
+
return /* @__PURE__ */ o(Y.Provider, {
|
|
425
425
|
value: s,
|
|
426
426
|
children: e
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
429
|
//#endregion
|
|
430
430
|
//#region src/primitives/useResolvedCssLength.tsx
|
|
431
|
-
function
|
|
431
|
+
function se(e, t) {
|
|
432
432
|
let n = a.useRef(null), [r, i] = a.useState(t), s = a.useCallback(() => {
|
|
433
433
|
let e = n.current;
|
|
434
434
|
if (!e) return;
|
|
@@ -453,12 +453,12 @@ function ce(e, t) {
|
|
|
453
453
|
}
|
|
454
454
|
//#endregion
|
|
455
455
|
//#region src/lib/resolveChartState.ts
|
|
456
|
-
function
|
|
456
|
+
function ce(e, t) {
|
|
457
457
|
return e ?? (t === 0 ? "empty" : "ready");
|
|
458
458
|
}
|
|
459
459
|
//#endregion
|
|
460
460
|
//#region src/primitives/BarChartSkeleton.tsx
|
|
461
|
-
var
|
|
461
|
+
var le = [
|
|
462
462
|
{
|
|
463
463
|
x: 55,
|
|
464
464
|
height: 120
|
|
@@ -484,7 +484,7 @@ var Z = [
|
|
|
484
484
|
height: 85
|
|
485
485
|
}
|
|
486
486
|
];
|
|
487
|
-
function
|
|
487
|
+
function Z({ ariaLabel: t = "Loading chart", className: n, ...r }) {
|
|
488
488
|
return /* @__PURE__ */ o("div", {
|
|
489
489
|
role: "img",
|
|
490
490
|
"aria-label": t,
|
|
@@ -493,7 +493,7 @@ function Q({ ariaLabel: t = "Loading chart", className: n, ...r }) {
|
|
|
493
493
|
...r,
|
|
494
494
|
children: /* @__PURE__ */ o("div", {
|
|
495
495
|
className: "flex min-h-0 flex-1 items-end gap-2 px-8 py-4",
|
|
496
|
-
children:
|
|
496
|
+
children: le.map((e) => /* @__PURE__ */ o("div", {
|
|
497
497
|
className: "flex-1 animate-pulse rounded-t-sm bg-muted",
|
|
498
498
|
style: { height: `${e.height / 200 * 100}%` }
|
|
499
499
|
}, e.x))
|
|
@@ -502,7 +502,7 @@ function Q({ ariaLabel: t = "Loading chart", className: n, ...r }) {
|
|
|
502
502
|
}
|
|
503
503
|
//#endregion
|
|
504
504
|
//#region src/primitives/LineChartSkeleton.tsx
|
|
505
|
-
function
|
|
505
|
+
function Q({ ariaLabel: t = "Loading chart", className: n, ...r }) {
|
|
506
506
|
return /* @__PURE__ */ o("div", {
|
|
507
507
|
role: "img",
|
|
508
508
|
"aria-label": t,
|
|
@@ -535,17 +535,17 @@ function $({ ariaLabel: t = "Loading chart", className: n, ...r }) {
|
|
|
535
535
|
}
|
|
536
536
|
//#endregion
|
|
537
537
|
//#region src/primitives/CartesianChartSkeleton.tsx
|
|
538
|
-
function
|
|
538
|
+
function $({ ariaLabel: t = "Loading chart", className: n, ...r }) {
|
|
539
539
|
return /* @__PURE__ */ s("div", {
|
|
540
540
|
role: "img",
|
|
541
541
|
"aria-label": t,
|
|
542
542
|
"aria-busy": "true",
|
|
543
543
|
className: e("relative flex h-full w-full overflow-hidden", n),
|
|
544
544
|
...r,
|
|
545
|
-
children: [/* @__PURE__ */ o(
|
|
545
|
+
children: [/* @__PURE__ */ o(Z, {
|
|
546
546
|
"aria-hidden": "true",
|
|
547
547
|
className: "absolute inset-0"
|
|
548
|
-
}), /* @__PURE__ */ o(
|
|
548
|
+
}), /* @__PURE__ */ o(Q, {
|
|
549
549
|
"aria-hidden": "true",
|
|
550
550
|
className: "absolute inset-0"
|
|
551
551
|
})]
|
|
@@ -645,36 +645,37 @@ function pe(e) {
|
|
|
645
645
|
};
|
|
646
646
|
return n(e), t;
|
|
647
647
|
}
|
|
648
|
-
function me({ state: e, className: t, data: n, margin: r, categoryPadding: i, categoryScaleType: a, layout: s,
|
|
649
|
-
let
|
|
650
|
-
return
|
|
651
|
-
ariaLabel:
|
|
648
|
+
function me({ state: e, className: t, data: n, margin: r, categoryPadding: i, categoryScaleType: a, layout: s, colorMode: c, animated: l, ariaLabel: u, valueTickFormatter: d, categoryTickFormatter: f, onPointHover: p, onPointLeave: m, children: h, ...g }) {
|
|
649
|
+
let _ = ce(e, n.length);
|
|
650
|
+
return _ === "loading" ? /* @__PURE__ */ o($, {
|
|
651
|
+
ariaLabel: u,
|
|
652
652
|
className: t,
|
|
653
|
-
...
|
|
654
|
-
}) :
|
|
655
|
-
ariaLabel:
|
|
653
|
+
...g
|
|
654
|
+
}) : _ === "empty" ? /* @__PURE__ */ o(ue, {
|
|
655
|
+
ariaLabel: u ?? "No data",
|
|
656
656
|
className: t,
|
|
657
|
-
...
|
|
658
|
-
}) : /* @__PURE__ */ o(
|
|
657
|
+
...g
|
|
658
|
+
}) : /* @__PURE__ */ o(X, { children: /* @__PURE__ */ o(he, {
|
|
659
659
|
data: n,
|
|
660
660
|
margin: r,
|
|
661
661
|
categoryPadding: i,
|
|
662
662
|
categoryScaleType: a,
|
|
663
663
|
layout: s,
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
664
|
+
colorMode: c,
|
|
665
|
+
animated: l,
|
|
666
|
+
ariaLabel: u,
|
|
667
|
+
valueTickFormatter: d,
|
|
668
|
+
categoryTickFormatter: f,
|
|
669
|
+
onPointHover: p,
|
|
670
|
+
onPointLeave: m,
|
|
670
671
|
className: t,
|
|
671
|
-
...
|
|
672
|
-
children:
|
|
672
|
+
...g,
|
|
673
|
+
children: h
|
|
673
674
|
}) });
|
|
674
675
|
}
|
|
675
|
-
function he({ data: t, margin: n, categoryPadding: r = .1, categoryScaleType: i = "band", layout: m = "vertical",
|
|
676
|
-
let { config:
|
|
677
|
-
let e = fe(
|
|
676
|
+
function he({ data: t, margin: n, categoryPadding: r = .1, categoryScaleType: i = "band", layout: m = "vertical", colorMode: h = "series", animated: _ = !0, ariaLabel: y, valueTickFormatter: x = g, categoryTickFormatter: C = String, onPointHover: w, onPointLeave: T, className: E, children: O, ...k }) {
|
|
677
|
+
let { config: A, id: te } = S(), { tooltip: M, legend: N } = oe(), P = a.useMemo(() => pe(O), [O]), F = a.useMemo(() => {
|
|
678
|
+
let e = fe(O), n = {};
|
|
678
679
|
for (let r of ["left", "right"]) {
|
|
679
680
|
let i = e.filter((e) => (e.axisId ?? "left") === r).map((e) => e.dataKey);
|
|
680
681
|
if (i.length === 0) continue;
|
|
@@ -685,9 +686,9 @@ function he({ data: t, margin: n, categoryPadding: r = .1, categoryScaleType: i
|
|
|
685
686
|
let r = Number(n);
|
|
686
687
|
Number.isFinite(r) && Math.abs(r) > a && (a = Math.abs(r));
|
|
687
688
|
}
|
|
688
|
-
let o =
|
|
689
|
+
let o = x(Math.ceil(a * 1.1)), s = "";
|
|
689
690
|
for (let t of e) if ((t.axisId ?? "left") === r) {
|
|
690
|
-
let e =
|
|
691
|
+
let e = A[t.dataKey]?.unit;
|
|
691
692
|
if (e) {
|
|
692
693
|
s = e;
|
|
693
694
|
break;
|
|
@@ -697,18 +698,18 @@ function he({ data: t, margin: n, categoryPadding: r = .1, categoryScaleType: i
|
|
|
697
698
|
}
|
|
698
699
|
return n;
|
|
699
700
|
}, [
|
|
700
|
-
T,
|
|
701
|
-
t,
|
|
702
701
|
O,
|
|
703
|
-
|
|
704
|
-
|
|
702
|
+
t,
|
|
703
|
+
A,
|
|
704
|
+
x
|
|
705
|
+
]), I = {
|
|
705
706
|
...v,
|
|
706
707
|
...n
|
|
707
708
|
};
|
|
708
|
-
|
|
709
|
-
let
|
|
709
|
+
F.left !== void 0 && n?.left === void 0 && (I.left = Math.max(I.left, F.left)), P && n?.right === void 0 && (I.right = Math.max(I.right, F.right ?? 40));
|
|
710
|
+
let L = m === "vertical", R = a.useRef(null), ne = a.useRef(null), z = D(ne), B = ee(), [re, V] = a.useState(null), [H, U] = a.useState(null), W = a.useCallback((e) => U(e), []), ie = a.useCallback(() => U(null), []), G = Math.max(0, z.width - I.left - I.right), K = Math.max(0, z.height - I.top - I.bottom), ae = I.left, q = a.useMemo(() => t.map((e) => e.category), [t]), J = a.useMemo(() => fe(O), [O]), Y = a.useMemo(() => J.map((e) => e.dataKey), [J]), X = a.useMemo(() => {
|
|
710
711
|
let e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
711
|
-
for (let e of
|
|
712
|
+
for (let e of J) {
|
|
712
713
|
if (!e.stackId) continue;
|
|
713
714
|
let t = n.get(e.stackId) ?? [];
|
|
714
715
|
t.push(e.dataKey), n.set(e.stackId, t);
|
|
@@ -723,20 +724,20 @@ function he({ data: t, margin: n, categoryPadding: r = .1, categoryScaleType: i
|
|
|
723
724
|
e.set(r, n(t));
|
|
724
725
|
}
|
|
725
726
|
return e;
|
|
726
|
-
}, [t,
|
|
727
|
+
}, [t, J]), se = a.useMemo(() => J.filter((e) => e.seriesType === "BarSeries" && !e.stackId).map((e) => e.dataKey), [J]), ce = a.useMemo(() => {
|
|
727
728
|
let e = /* @__PURE__ */ new Map();
|
|
728
|
-
for (let t of
|
|
729
|
+
for (let t of J) {
|
|
729
730
|
let n = t.axisId ?? "left", r = e.get(n) ?? [];
|
|
730
731
|
r.push(t.dataKey), e.set(n, r);
|
|
731
732
|
}
|
|
732
733
|
return e;
|
|
733
|
-
}, [
|
|
734
|
+
}, [J]), le = a.useMemo(() => {
|
|
734
735
|
let e = /* @__PURE__ */ new Map();
|
|
735
|
-
for (let [n, r] of
|
|
736
|
-
let i = new Set(r), a =
|
|
736
|
+
for (let [n, r] of ce) {
|
|
737
|
+
let i = new Set(r), a = J.some((e) => e.stackId && i.has(e.dataKey)), o = r.filter((e) => !J.find((t) => t.dataKey === e && t.stackId));
|
|
737
738
|
if (a) {
|
|
738
739
|
let r = -Infinity;
|
|
739
|
-
for (let e of
|
|
740
|
+
for (let e of X.values()) if (e.some((e) => i.has(e.key))) for (let t of e) for (let e of t) e[1] > r && (r = e[1]);
|
|
740
741
|
for (let e of t) for (let t of o) {
|
|
741
742
|
let n = e[t];
|
|
742
743
|
if (n == null) continue;
|
|
@@ -757,76 +758,93 @@ function he({ data: t, margin: n, categoryPadding: r = .1, categoryScaleType: i
|
|
|
757
758
|
}
|
|
758
759
|
return e;
|
|
759
760
|
}, [
|
|
760
|
-
|
|
761
|
+
ce,
|
|
761
762
|
t,
|
|
763
|
+
X,
|
|
764
|
+
J
|
|
765
|
+
]), Z = a.useMemo(() => i === "point" ? Object.assign(u().domain(q).range([0, L ? G : K]).padding(0), { bandwidth: () => 0 }) : c().domain(q).range([0, L ? G : K]).padding(r), [
|
|
762
766
|
q,
|
|
763
|
-
G
|
|
764
|
-
]), X = a.useMemo(() => i === "point" ? Object.assign(u().domain(W).range([0, F ? H : U]).padding(0), { bandwidth: () => 0 }) : c().domain(W).range([0, F ? H : U]).padding(r), [
|
|
765
|
-
W,
|
|
766
767
|
i,
|
|
767
768
|
r,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
]),
|
|
769
|
+
L,
|
|
770
|
+
G,
|
|
771
|
+
K
|
|
772
|
+
]), Q = a.useMemo(() => {
|
|
772
773
|
let e = {};
|
|
773
|
-
for (let [t, [n, r]] of
|
|
774
|
-
return e.left ||= l().domain([0, 1]).nice().range(
|
|
774
|
+
for (let [t, [n, r]] of le) e[t] = l().domain([Math.min(0, n), r * 1.1 || 1]).nice().range(L ? [K, 0] : [0, G]);
|
|
775
|
+
return e.left ||= l().domain([0, 1]).nice().range(L ? [K, 0] : [0, G]), e;
|
|
775
776
|
}, [
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
]),
|
|
777
|
+
le,
|
|
778
|
+
L,
|
|
779
|
+
K,
|
|
780
|
+
G
|
|
781
|
+
]), $ = Q.left, ue = a.useCallback((e) => e ? Q[e] ?? $ : $, [$, Q]), me = a.useMemo(() => {
|
|
781
782
|
let e = {};
|
|
782
|
-
for (let t of
|
|
783
|
+
for (let t of J) {
|
|
783
784
|
let n = t.axisId ?? "left";
|
|
784
785
|
if (e[n]) continue;
|
|
785
|
-
let r =
|
|
786
|
+
let r = A[t.dataKey]?.unit;
|
|
786
787
|
r && (e[n] = r);
|
|
787
788
|
}
|
|
788
789
|
return e;
|
|
789
|
-
}, [
|
|
790
|
+
}, [J, A]), he = a.useMemo(() => se.length <= 1 ? null : c().domain(se).range([0, Z.bandwidth()]).padding(.05), [se, Z]), ge = h === "category" ? q.map((e) => ({
|
|
791
|
+
dataKey: e,
|
|
792
|
+
value: e
|
|
793
|
+
})) : Y.map((e) => ({
|
|
790
794
|
dataKey: e,
|
|
791
795
|
value: e
|
|
792
796
|
}));
|
|
793
|
-
function
|
|
794
|
-
|
|
797
|
+
function _e(e) {
|
|
798
|
+
if (h === "category") {
|
|
799
|
+
let t = Y[0], n = t === void 0 ? 0 : Number(e[t]) || 0;
|
|
800
|
+
return [{
|
|
801
|
+
dataKey: e.category,
|
|
802
|
+
name: e.category,
|
|
803
|
+
value: n,
|
|
804
|
+
color: `var(--color-${b(e.category)})`
|
|
805
|
+
}];
|
|
806
|
+
}
|
|
807
|
+
return Y.filter((t) => e[t] !== null && e[t] !== void 0).map((t) => ({
|
|
795
808
|
dataKey: t,
|
|
796
809
|
name: t,
|
|
797
810
|
value: Number(e[t]) || 0
|
|
798
811
|
}));
|
|
799
812
|
}
|
|
800
|
-
function
|
|
801
|
-
let n =
|
|
813
|
+
function ve(e) {
|
|
814
|
+
let n = R.current?.getBoundingClientRect();
|
|
802
815
|
if (!n) return;
|
|
803
|
-
let r =
|
|
804
|
-
for (let e = 0; e <
|
|
805
|
-
let t = (
|
|
816
|
+
let r = L ? e.clientX - n.left - I.left : e.clientY - n.top - I.top, i = 0, a = Infinity;
|
|
817
|
+
for (let e = 0; e < q.length; e++) {
|
|
818
|
+
let t = (Z(q[e]) ?? 0) + Z.bandwidth() / 2, n = Math.abs(r - t);
|
|
806
819
|
n < a && (a = n, i = e);
|
|
807
820
|
}
|
|
808
821
|
let o = t[i];
|
|
809
822
|
if (!o) return;
|
|
810
|
-
|
|
811
|
-
let s =
|
|
812
|
-
clientX: n.left +
|
|
823
|
+
V(o.category);
|
|
824
|
+
let s = _e(o), c = (Z(o.category) ?? 0) + Z.bandwidth() / 2, l = L ? {
|
|
825
|
+
clientX: n.left + I.left + c,
|
|
813
826
|
clientY: e.clientY
|
|
814
827
|
} : {
|
|
815
828
|
clientX: e.clientX,
|
|
816
|
-
clientY: n.top +
|
|
829
|
+
clientY: n.top + I.top + c
|
|
817
830
|
};
|
|
818
|
-
|
|
831
|
+
M && B.show(s, o.category, l, n), w?.(s, o.category, e);
|
|
819
832
|
}
|
|
820
|
-
function
|
|
821
|
-
|
|
833
|
+
function ye() {
|
|
834
|
+
V(null), B.hide(), T?.();
|
|
822
835
|
}
|
|
823
|
-
let
|
|
824
|
-
if (!
|
|
825
|
-
let r =
|
|
836
|
+
let be = a.useCallback((e, n) => {
|
|
837
|
+
if (!M) return;
|
|
838
|
+
let r = R.current?.getBoundingClientRect();
|
|
826
839
|
if (!r) return;
|
|
827
840
|
let i = t.find((t) => t.category === e);
|
|
828
841
|
if (!i) return;
|
|
829
|
-
let a =
|
|
842
|
+
let a = h === "category" ? [{
|
|
843
|
+
dataKey: e,
|
|
844
|
+
name: e,
|
|
845
|
+
value: Y[0] === void 0 ? 0 : Number(i[Y[0]]) || 0,
|
|
846
|
+
color: `var(--color-${b(e)})`
|
|
847
|
+
}] : Y.filter((e) => i[e] !== null && i[e] !== void 0).map((e) => ({
|
|
830
848
|
dataKey: e,
|
|
831
849
|
name: e,
|
|
832
850
|
value: Number(i[e]) || 0
|
|
@@ -834,127 +852,130 @@ function he({ data: t, margin: n, categoryPadding: r = .1, categoryScaleType: i
|
|
|
834
852
|
clientX: n.left + n.width / 2,
|
|
835
853
|
clientY: n.top + n.height / 2
|
|
836
854
|
};
|
|
837
|
-
|
|
855
|
+
B.show(a, e, o, r);
|
|
838
856
|
}, [
|
|
839
|
-
|
|
857
|
+
M,
|
|
840
858
|
t,
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
859
|
+
Y,
|
|
860
|
+
h,
|
|
861
|
+
B
|
|
862
|
+
]), xe = a.useCallback(() => {
|
|
863
|
+
B.hide();
|
|
864
|
+
}, [B]), Se = N?.verticalAlign ?? "bottom", Ce = y ?? `Chart with ${t.length} categor${t.length === 1 ? "y" : "ies"} and ${Y.length} series`, we = a.useMemo(() => ({
|
|
846
865
|
data: t,
|
|
847
|
-
dataKeys:
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
866
|
+
dataKeys: Y,
|
|
867
|
+
colorMode: h,
|
|
868
|
+
categoryScale: Z,
|
|
869
|
+
valueScale: $,
|
|
870
|
+
valueScales: Q,
|
|
871
|
+
resolveValueScale: ue,
|
|
872
|
+
axisUnits: me,
|
|
873
|
+
innerWidth: G,
|
|
874
|
+
innerHeight: K,
|
|
875
|
+
marginLeft: ae,
|
|
856
876
|
layout: m,
|
|
857
|
-
animated:
|
|
877
|
+
animated: _,
|
|
858
878
|
hoveredCategory: re,
|
|
859
|
-
hoveredLegendKey:
|
|
860
|
-
config:
|
|
861
|
-
stackedLayers:
|
|
862
|
-
barGroupScale:
|
|
863
|
-
valueTickFormatter:
|
|
864
|
-
categoryTickFormatter:
|
|
865
|
-
chartWrapperRef:
|
|
866
|
-
chartId:
|
|
867
|
-
showTooltipAt:
|
|
868
|
-
hideTooltip:
|
|
879
|
+
hoveredLegendKey: H,
|
|
880
|
+
config: A,
|
|
881
|
+
stackedLayers: X,
|
|
882
|
+
barGroupScale: he,
|
|
883
|
+
valueTickFormatter: x,
|
|
884
|
+
categoryTickFormatter: C,
|
|
885
|
+
chartWrapperRef: R,
|
|
886
|
+
chartId: te,
|
|
887
|
+
showTooltipAt: be,
|
|
888
|
+
hideTooltip: xe
|
|
869
889
|
}), [
|
|
870
890
|
t,
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
Q,
|
|
891
|
+
Y,
|
|
892
|
+
h,
|
|
874
893
|
Z,
|
|
875
894
|
$,
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
895
|
+
Q,
|
|
896
|
+
ue,
|
|
897
|
+
me,
|
|
898
|
+
G,
|
|
899
|
+
K,
|
|
900
|
+
ae,
|
|
880
901
|
m,
|
|
881
|
-
|
|
902
|
+
_,
|
|
882
903
|
re,
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
904
|
+
H,
|
|
905
|
+
A,
|
|
906
|
+
X,
|
|
907
|
+
he,
|
|
908
|
+
x,
|
|
909
|
+
C,
|
|
910
|
+
te,
|
|
911
|
+
be,
|
|
912
|
+
xe
|
|
892
913
|
]);
|
|
893
914
|
return /* @__PURE__ */ o(j.Provider, {
|
|
894
|
-
value:
|
|
915
|
+
value: we,
|
|
895
916
|
children: /* @__PURE__ */ s("div", {
|
|
896
|
-
className: e("flex h-full w-full flex-col",
|
|
897
|
-
...
|
|
917
|
+
className: e("flex h-full w-full flex-col", E),
|
|
918
|
+
...k,
|
|
898
919
|
children: [
|
|
899
|
-
|
|
900
|
-
items:
|
|
920
|
+
N && Se === "top" && a.cloneElement(N.content, {
|
|
921
|
+
items: ge,
|
|
901
922
|
verticalAlign: "top",
|
|
902
|
-
onItemHover:
|
|
903
|
-
onItemLeave:
|
|
904
|
-
hoveredLegendKey:
|
|
923
|
+
onItemHover: W,
|
|
924
|
+
onItemLeave: ie,
|
|
925
|
+
hoveredLegendKey: H
|
|
905
926
|
}),
|
|
906
927
|
/* @__PURE__ */ s("div", {
|
|
907
|
-
ref:
|
|
928
|
+
ref: R,
|
|
908
929
|
className: "relative min-h-0 flex-1",
|
|
909
|
-
onMouseMove:
|
|
910
|
-
onMouseLeave:
|
|
930
|
+
onMouseMove: ve,
|
|
931
|
+
onMouseLeave: ye,
|
|
911
932
|
children: [
|
|
912
933
|
/* @__PURE__ */ o("svg", {
|
|
913
934
|
ref: ne,
|
|
914
935
|
role: "img",
|
|
915
|
-
"aria-label":
|
|
936
|
+
"aria-label": Ce,
|
|
916
937
|
className: "h-full w-full",
|
|
917
938
|
overflow: "visible",
|
|
918
|
-
children:
|
|
919
|
-
transform: `translate(${
|
|
920
|
-
children:
|
|
939
|
+
children: z.width > 0 && z.height > 0 && /* @__PURE__ */ o("g", {
|
|
940
|
+
transform: `translate(${I.left},${I.top})`,
|
|
941
|
+
children: O
|
|
921
942
|
})
|
|
922
943
|
}),
|
|
923
944
|
/* @__PURE__ */ o("div", {
|
|
924
945
|
className: "sr-only",
|
|
925
946
|
children: /* @__PURE__ */ s("table", { children: [
|
|
926
|
-
/* @__PURE__ */ o("caption", { children:
|
|
947
|
+
/* @__PURE__ */ o("caption", { children: Ce }),
|
|
927
948
|
/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [/* @__PURE__ */ o("th", {
|
|
928
949
|
scope: "col",
|
|
929
950
|
children: "Category"
|
|
930
|
-
}),
|
|
951
|
+
}), Y.map((e) => /* @__PURE__ */ o("th", {
|
|
931
952
|
scope: "col",
|
|
932
|
-
children: typeof
|
|
953
|
+
children: typeof A[e]?.label == "string" ? A[e]?.label : e
|
|
933
954
|
}, e))] }) }),
|
|
934
955
|
/* @__PURE__ */ o("tbody", { children: t.map((e) => /* @__PURE__ */ s("tr", { children: [/* @__PURE__ */ o("th", {
|
|
935
956
|
scope: "row",
|
|
936
957
|
children: e.category
|
|
937
|
-
}),
|
|
958
|
+
}), Y.map((t) => /* @__PURE__ */ o("td", { children: e[t] !== null && e[t] !== void 0 ? x(Number(e[t]) || 0) : "—" }, t))] }, e.category)) })
|
|
938
959
|
] })
|
|
939
960
|
}),
|
|
940
|
-
|
|
941
|
-
state:
|
|
942
|
-
containerRef:
|
|
943
|
-
chartId:
|
|
944
|
-
children: a.cloneElement(
|
|
945
|
-
label:
|
|
946
|
-
items:
|
|
961
|
+
M && B.state && /* @__PURE__ */ o(de, {
|
|
962
|
+
state: B.state,
|
|
963
|
+
containerRef: R,
|
|
964
|
+
chartId: te,
|
|
965
|
+
children: a.cloneElement(M.content, {
|
|
966
|
+
label: B.state.label,
|
|
967
|
+
items: B.state.items,
|
|
947
968
|
active: !0
|
|
948
969
|
})
|
|
949
970
|
})
|
|
950
971
|
]
|
|
951
972
|
}),
|
|
952
|
-
|
|
953
|
-
items:
|
|
973
|
+
N && Se === "bottom" && a.cloneElement(N.content, {
|
|
974
|
+
items: ge,
|
|
954
975
|
verticalAlign: "bottom",
|
|
955
|
-
onItemHover:
|
|
956
|
-
onItemLeave:
|
|
957
|
-
hoveredLegendKey:
|
|
976
|
+
onItemHover: W,
|
|
977
|
+
onItemLeave: ie,
|
|
978
|
+
hoveredLegendKey: H
|
|
958
979
|
})
|
|
959
980
|
]
|
|
960
981
|
})
|
|
@@ -1040,4 +1061,4 @@ function ve({ ariaLabel: t = "Loading chart", className: n, ...r }) {
|
|
|
1040
1061
|
});
|
|
1041
1062
|
}
|
|
1042
1063
|
//#endregion
|
|
1043
|
-
export { S as C, g as D, v as E, E as S, _ as T,
|
|
1064
|
+
export { S as C, g as D, v as E, E as S, _ as T, M as _, de as a, D as b, Z as c, X as d, oe as f, R as g, q as h, me as i, ce as l, ae as m, _e as n, ue as o, J as p, ge as r, Q as s, ve as t, se as u, te as v, b as w, T as x, ee as y };
|