@overdoser/react-toolkit 0.0.15 → 0.0.16
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/index.js +483 -476
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { forwardRef as Te, createElement as hn, useState as Ce, useCallback as me, useMemo as we, useEffect as Re, useLayoutEffect as
|
|
2
|
-
import { jsxs as
|
|
1
|
+
import { forwardRef as Te, createElement as hn, useState as Ce, useCallback as me, useMemo as we, useEffect as Re, useLayoutEffect as _t, useRef as ie, useId as Ge, isValidElement as mn, cloneElement as jt, createContext as zt, useContext as gt, useImperativeHandle as fn } from "react";
|
|
2
|
+
import { jsxs as _, jsx as s, Fragment as _e } from "react/jsx-runtime";
|
|
3
3
|
import { createPortal as yt } from "react-dom";
|
|
4
4
|
import { FormProvider as pn, useFormContext as gn, useController as yn } from "react-hook-form";
|
|
5
5
|
function Vt(e) {
|
|
@@ -55,7 +55,7 @@ const vn = "crk-root-8RX49", bn = "crk-loading-QfItr", xn = "crk-primary-st6yY",
|
|
|
55
55
|
style: h,
|
|
56
56
|
children: d,
|
|
57
57
|
...u
|
|
58
|
-
}, m) => /* @__PURE__ */
|
|
58
|
+
}, m) => /* @__PURE__ */ _(
|
|
59
59
|
"button",
|
|
60
60
|
{
|
|
61
61
|
ref: m,
|
|
@@ -77,7 +77,7 @@ const vn = "crk-root-8RX49", bn = "crk-loading-QfItr", xn = "crk-primary-st6yY",
|
|
|
77
77
|
children: [
|
|
78
78
|
/* @__PURE__ */ s("div", { className: f(Pe.shimmer, l?.shimmer) }),
|
|
79
79
|
/* @__PURE__ */ s("span", { className: f(Pe.content, l?.content), children: d }),
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ _("span", { className: f(Pe.dots, l?.dots), "aria-hidden": "true", children: [
|
|
81
81
|
/* @__PURE__ */ s("span", { className: f(Pe.dot, l?.dot) }),
|
|
82
82
|
/* @__PURE__ */ s("span", { className: f(Pe.dot, l?.dot) }),
|
|
83
83
|
/* @__PURE__ */ s("span", { className: f(Pe.dot, l?.dot) })
|
|
@@ -87,13 +87,13 @@ const vn = "crk-root-8RX49", bn = "crk-loading-QfItr", xn = "crk-primary-st6yY",
|
|
|
87
87
|
)
|
|
88
88
|
);
|
|
89
89
|
qt.displayName = "Button";
|
|
90
|
-
const Fn = "crk-root-2j4Vp", Xn = "crk-muted-vReNc", Un = "crk-danger-ugf9r",
|
|
90
|
+
const Fn = "crk-root-2j4Vp", Xn = "crk-muted-vReNc", Un = "crk-danger-ugf9r", Yn = "crk-srOnly-LGQgs", $t = {
|
|
91
91
|
root: Fn,
|
|
92
92
|
default: "crk-default-3TBlr",
|
|
93
93
|
muted: Xn,
|
|
94
94
|
danger: Un,
|
|
95
|
-
srOnly:
|
|
96
|
-
},
|
|
95
|
+
srOnly: Yn
|
|
96
|
+
}, _n = Te(
|
|
97
97
|
({
|
|
98
98
|
variant: e = "default",
|
|
99
99
|
external: t = !1,
|
|
@@ -101,7 +101,7 @@ const Fn = "crk-root-2j4Vp", Xn = "crk-muted-vReNc", Un = "crk-danger-ugf9r", _n
|
|
|
101
101
|
style: r,
|
|
102
102
|
children: o,
|
|
103
103
|
...c
|
|
104
|
-
}, i) => /* @__PURE__ */
|
|
104
|
+
}, i) => /* @__PURE__ */ _(
|
|
105
105
|
"a",
|
|
106
106
|
{
|
|
107
107
|
ref: i,
|
|
@@ -119,7 +119,7 @@ const Fn = "crk-root-2j4Vp", Xn = "crk-muted-vReNc", Un = "crk-danger-ugf9r", _n
|
|
|
119
119
|
}
|
|
120
120
|
)
|
|
121
121
|
);
|
|
122
|
-
|
|
122
|
+
_n.displayName = "Link";
|
|
123
123
|
const jn = "crk-root-U-oiq", zn = "crk-h1-Aivwz", Vn = "crk-h2-CV8Oo", qn = "crk-h3-lrbrK", Gn = "crk-h4--jkC1", Zn = "crk-h5-GnQvD", Kn = "crk-h6-MKlIN", Qn = "crk-p-FzRtm", Jn = "crk-span-NZvLx", er = "crk-label-Cwi6a", tr = "crk-normal-7AeZz", nr = "crk-medium-36OXr", rr = "crk-semibold-oQixc", or = "crk-bold-bk4b4", ir = "crk-muted-itOSW", cr = "crk-primary-rp36t", lr = "crk-danger-SyOy-", sr = "crk-success-w8PpD", ar = "crk-align-left-3AGYw", dr = "crk-align-center-h-x--", ur = "crk-align-right-IXFhK", hr = "crk-truncate-eqr85", qe = {
|
|
124
124
|
root: jn,
|
|
125
125
|
h1: zn,
|
|
@@ -222,7 +222,7 @@ const wr = Te(
|
|
|
222
222
|
)
|
|
223
223
|
);
|
|
224
224
|
wr.displayName = "ListItem";
|
|
225
|
-
const $r = "crk-wrapper-zxjMt", Nr = "crk-root-Gf85-", Lr = "crk-headerCell-ePPZW", Tr = "crk-headerCellSortable-NMybk", Sr = "crk-sortIndicator-WGD2S", Rr = "crk-sortArrow-1-ok4", Cr = "crk-sortArrowActive-yhWrO", Ar = "crk-sortIndex-HGoca", Dr = "crk-row-H0wL1", Ir = "crk-cell-ZfnbG", Br = "crk-emptyRow-AoPfj", Er = "crk-emptyCell-99-7C", Pr = "crk-striped-6Qckq", Wr = "crk-hoverable-ljU9B", Hr = "crk-compact-2-UWr", Or = "crk-paginator-UlYIY", Fr = "crk-paginatorInfo-BVca4", Xr = "crk-paginatorText-sqWS0", Ur = "crk-pageSizeSelect-yhqJQ",
|
|
225
|
+
const $r = "crk-wrapper-zxjMt", Nr = "crk-root-Gf85-", Lr = "crk-headerCell-ePPZW", Tr = "crk-headerCellSortable-NMybk", Sr = "crk-sortIndicator-WGD2S", Rr = "crk-sortArrow-1-ok4", Cr = "crk-sortArrowActive-yhWrO", Ar = "crk-sortIndex-HGoca", Dr = "crk-row-H0wL1", Ir = "crk-cell-ZfnbG", Br = "crk-emptyRow-AoPfj", Er = "crk-emptyCell-99-7C", Pr = "crk-striped-6Qckq", Wr = "crk-hoverable-ljU9B", Hr = "crk-compact-2-UWr", Or = "crk-paginator-UlYIY", Fr = "crk-paginatorInfo-BVca4", Xr = "crk-paginatorText-sqWS0", Ur = "crk-pageSizeSelect-yhqJQ", Yr = "crk-paginatorNav-MDSui", _r = "crk-pageButton-1PX-g", jr = "crk-pageButtonActive--D7Q7", zr = "crk-pageEllipsis-en59J", ve = {
|
|
226
226
|
wrapper: $r,
|
|
227
227
|
root: Nr,
|
|
228
228
|
headerCell: Lr,
|
|
@@ -242,8 +242,8 @@ const $r = "crk-wrapper-zxjMt", Nr = "crk-root-Gf85-", Lr = "crk-headerCell-ePPZ
|
|
|
242
242
|
paginatorInfo: Fr,
|
|
243
243
|
paginatorText: Xr,
|
|
244
244
|
pageSizeSelect: Ur,
|
|
245
|
-
paginatorNav:
|
|
246
|
-
pageButton:
|
|
245
|
+
paginatorNav: Yr,
|
|
246
|
+
pageButton: _r,
|
|
247
247
|
pageButtonActive: jr,
|
|
248
248
|
pageEllipsis: zr
|
|
249
249
|
};
|
|
@@ -280,7 +280,7 @@ function qr(e, t = []) {
|
|
|
280
280
|
}), [e, n]), sortConfig: n, requestSort: o, requestMultiSort: c, resetSort: i };
|
|
281
281
|
}
|
|
282
282
|
function Gr({ direction: e, sortIndex: t }) {
|
|
283
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ _("span", { className: ve.sortIndicator, "aria-hidden": "true", children: [
|
|
284
284
|
/* @__PURE__ */ s("span", { className: f(ve.sortArrow, e === "asc" && ve.sortArrowActive), children: "▲" }),
|
|
285
285
|
/* @__PURE__ */ s("span", { className: f(ve.sortArrow, e === "desc" && ve.sortArrowActive), children: "▼" }),
|
|
286
286
|
t !== void 0 && t >= 0 && /* @__PURE__ */ s("span", { className: ve.sortIndex, children: t + 1 })
|
|
@@ -306,8 +306,8 @@ function Zr({
|
|
|
306
306
|
}
|
|
307
307
|
return d;
|
|
308
308
|
}, [e, i]);
|
|
309
|
-
return /* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
309
|
+
return /* @__PURE__ */ _("nav", { className: f(ve.paginator, c?.paginator), "aria-label": "Table pagination", children: [
|
|
310
|
+
/* @__PURE__ */ _("div", { className: ve.paginatorInfo, children: [
|
|
311
311
|
/* @__PURE__ */ s("span", { className: ve.paginatorText, children: n > 0 ? `${l}–${a} of ${n}` : "No results" }),
|
|
312
312
|
r.length > 1 && /* @__PURE__ */ s(
|
|
313
313
|
"select",
|
|
@@ -316,14 +316,14 @@ function Zr({
|
|
|
316
316
|
value: t,
|
|
317
317
|
onChange: (d) => o(1, Number(d.target.value)),
|
|
318
318
|
"aria-label": "Rows per page",
|
|
319
|
-
children: r.map((d) => /* @__PURE__ */
|
|
319
|
+
children: r.map((d) => /* @__PURE__ */ _("option", { value: d, children: [
|
|
320
320
|
d,
|
|
321
321
|
" / page"
|
|
322
322
|
] }, d))
|
|
323
323
|
}
|
|
324
324
|
)
|
|
325
325
|
] }),
|
|
326
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ _("div", { className: ve.paginatorNav, children: [
|
|
327
327
|
/* @__PURE__ */ s(
|
|
328
328
|
"button",
|
|
329
329
|
{
|
|
@@ -378,8 +378,8 @@ function Kr({
|
|
|
378
378
|
rowClassName: u,
|
|
379
379
|
rowStyle: m,
|
|
380
380
|
emptyMessage: p = "No data",
|
|
381
|
-
pagination:
|
|
382
|
-
classes:
|
|
381
|
+
pagination: N,
|
|
382
|
+
classes: g
|
|
383
383
|
}) {
|
|
384
384
|
const C = r !== void 0, {
|
|
385
385
|
sortedData: w,
|
|
@@ -387,10 +387,10 @@ function Kr({
|
|
|
387
387
|
requestSort: D,
|
|
388
388
|
requestMultiSort: F
|
|
389
389
|
} = qr(e, n), V = C ? n ?? [] : J, U = C ? e : w, B = we(() => {
|
|
390
|
-
if (!
|
|
391
|
-
const $ = (
|
|
392
|
-
return U.slice($, $ +
|
|
393
|
-
}, [U,
|
|
390
|
+
if (!N || C) return U;
|
|
391
|
+
const $ = (N.page - 1) * N.pageSize;
|
|
392
|
+
return U.slice($, $ + N.pageSize);
|
|
393
|
+
}, [U, N, C]), ee = N?.totalRows ?? U.length, q = me(
|
|
394
394
|
($, Z) => {
|
|
395
395
|
const I = o && (Z.ctrlKey || Z.metaKey);
|
|
396
396
|
if (C)
|
|
@@ -415,13 +415,13 @@ function Kr({
|
|
|
415
415
|
D,
|
|
416
416
|
F
|
|
417
417
|
]
|
|
418
|
-
),
|
|
418
|
+
), L = ($) => V.find((I) => I.key === $)?.direction, te = ($) => {
|
|
419
419
|
if (V.length <= 1) return;
|
|
420
420
|
const Z = V.findIndex((I) => I.key === $);
|
|
421
421
|
return Z >= 0 ? Z : void 0;
|
|
422
422
|
};
|
|
423
|
-
return /* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
423
|
+
return /* @__PURE__ */ _("div", { className: f(ve.wrapper, g?.wrapper), children: [
|
|
424
|
+
/* @__PURE__ */ _(
|
|
425
425
|
"table",
|
|
426
426
|
{
|
|
427
427
|
className: f(
|
|
@@ -429,31 +429,31 @@ function Kr({
|
|
|
429
429
|
c && ve.striped,
|
|
430
430
|
i && ve.hoverable,
|
|
431
431
|
l && ve.compact,
|
|
432
|
-
|
|
432
|
+
g?.root,
|
|
433
433
|
a
|
|
434
434
|
),
|
|
435
435
|
style: h,
|
|
436
436
|
children: [
|
|
437
|
-
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map(($) => /* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map(($) => /* @__PURE__ */ _(
|
|
438
438
|
"th",
|
|
439
439
|
{
|
|
440
440
|
className: f(
|
|
441
441
|
ve.headerCell,
|
|
442
442
|
$.sortable && ve.headerCellSortable,
|
|
443
|
-
|
|
443
|
+
g?.headerCell
|
|
444
444
|
),
|
|
445
445
|
style: {
|
|
446
446
|
width: $.width,
|
|
447
447
|
textAlign: $.align
|
|
448
448
|
},
|
|
449
449
|
onClick: $.sortable ? (Z) => q($.key, Z) : void 0,
|
|
450
|
-
"aria-sort": $.sortable ?
|
|
450
|
+
"aria-sort": $.sortable ? L($.key) === "asc" ? "ascending" : L($.key) === "desc" ? "descending" : "none" : void 0,
|
|
451
451
|
children: [
|
|
452
452
|
$.header,
|
|
453
453
|
$.sortable && /* @__PURE__ */ s(
|
|
454
454
|
Gr,
|
|
455
455
|
{
|
|
456
|
-
direction:
|
|
456
|
+
direction: L($.key),
|
|
457
457
|
sortIndex: te($.key)
|
|
458
458
|
}
|
|
459
459
|
)
|
|
@@ -461,17 +461,17 @@ function Kr({
|
|
|
461
461
|
},
|
|
462
462
|
$.key
|
|
463
463
|
)) }) }),
|
|
464
|
-
/* @__PURE__ */ s("tbody", { children: B.length === 0 ? /* @__PURE__ */ s("tr", { className: ve.emptyRow, children: /* @__PURE__ */ s("td", { className: f(ve.emptyCell,
|
|
464
|
+
/* @__PURE__ */ s("tbody", { children: B.length === 0 ? /* @__PURE__ */ s("tr", { className: ve.emptyRow, children: /* @__PURE__ */ s("td", { className: f(ve.emptyCell, g?.emptyCell), colSpan: t.length, children: p }) }) : B.map(($, Z) => {
|
|
465
465
|
const I = d ? String($[d]) : Z, j = typeof u == "function" ? u($, Z) : u, A = typeof m == "function" ? m($, Z) : m;
|
|
466
466
|
return /* @__PURE__ */ s(
|
|
467
467
|
"tr",
|
|
468
468
|
{
|
|
469
|
-
className: f(ve.row,
|
|
469
|
+
className: f(ve.row, g?.row, j),
|
|
470
470
|
style: A,
|
|
471
471
|
children: t.map((z) => /* @__PURE__ */ s(
|
|
472
472
|
"td",
|
|
473
473
|
{
|
|
474
|
-
className: f(ve.cell,
|
|
474
|
+
className: f(ve.cell, g?.cell),
|
|
475
475
|
style: { textAlign: z.align },
|
|
476
476
|
children: z.render ? z.render($[z.key], $, Z) : $[z.key]
|
|
477
477
|
},
|
|
@@ -484,12 +484,12 @@ function Kr({
|
|
|
484
484
|
]
|
|
485
485
|
}
|
|
486
486
|
),
|
|
487
|
-
|
|
487
|
+
N && /* @__PURE__ */ s(
|
|
488
488
|
Zr,
|
|
489
489
|
{
|
|
490
|
-
...
|
|
490
|
+
...N,
|
|
491
491
|
totalRows: ee,
|
|
492
|
-
paginatorClasses: { paginator:
|
|
492
|
+
paginatorClasses: { paginator: g?.paginator, pageButton: g?.pageButton }
|
|
493
493
|
}
|
|
494
494
|
)
|
|
495
495
|
] });
|
|
@@ -528,7 +528,7 @@ function St(e, t = !0) {
|
|
|
528
528
|
}
|
|
529
529
|
function Rt(e, t) {
|
|
530
530
|
const [n, r] = Ce({ top: 0, left: 0, width: 0 });
|
|
531
|
-
return
|
|
531
|
+
return _t(() => {
|
|
532
532
|
if (!t) return;
|
|
533
533
|
const o = () => {
|
|
534
534
|
const c = e.current;
|
|
@@ -558,8 +558,8 @@ const Gt = Te(
|
|
|
558
558
|
onChange: u,
|
|
559
559
|
error: m = !1,
|
|
560
560
|
fullWidth: p = !0,
|
|
561
|
-
portal:
|
|
562
|
-
classes:
|
|
561
|
+
portal: N = !0,
|
|
562
|
+
classes: g
|
|
563
563
|
}, C) => {
|
|
564
564
|
const [w, J] = Ce(!1), D = ie(null), F = ie(null), V = ie(null), U = Ge();
|
|
565
565
|
Re(() => {
|
|
@@ -591,7 +591,7 @@ const Gt = Te(
|
|
|
591
591
|
},
|
|
592
592
|
w
|
|
593
593
|
);
|
|
594
|
-
const
|
|
594
|
+
const L = Rt(V, w && N), te = a?.find((A) => A.value === d)?.label, $ = a ? te || h : e, Z = a && !te, I = a ? a.map((A) => /* @__PURE__ */ s(
|
|
595
595
|
"button",
|
|
596
596
|
{
|
|
597
597
|
type: "button",
|
|
@@ -600,7 +600,7 @@ const Gt = Te(
|
|
|
600
600
|
Ne.item,
|
|
601
601
|
A.disabled && Ne.itemDisabled,
|
|
602
602
|
A.value === d && Ne.itemSelected,
|
|
603
|
-
|
|
603
|
+
g?.item
|
|
604
604
|
),
|
|
605
605
|
disabled: A.disabled,
|
|
606
606
|
onClick: () => q(A.value),
|
|
@@ -616,23 +616,23 @@ const Gt = Te(
|
|
|
616
616
|
Ne.menu,
|
|
617
617
|
w && Ne.menuOpen,
|
|
618
618
|
n === "left" ? Ne.alignLeft : Ne.alignRight,
|
|
619
|
-
!
|
|
620
|
-
|
|
619
|
+
!N && p && Ne.fullWidth,
|
|
620
|
+
g?.menu
|
|
621
621
|
),
|
|
622
622
|
style: A,
|
|
623
623
|
role: "menu",
|
|
624
624
|
children: I
|
|
625
625
|
}
|
|
626
626
|
);
|
|
627
|
-
return /* @__PURE__ */
|
|
627
|
+
return /* @__PURE__ */ _(
|
|
628
628
|
"div",
|
|
629
629
|
{
|
|
630
630
|
ref: C,
|
|
631
|
-
className: f(Ne.root, p && Ne.fullWidth,
|
|
631
|
+
className: f(Ne.root, p && Ne.fullWidth, g?.root, r),
|
|
632
632
|
style: o,
|
|
633
633
|
children: [
|
|
634
|
-
/* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
634
|
+
/* @__PURE__ */ _("div", { ref: D, style: p ? { width: "100%" } : void 0, children: [
|
|
635
|
+
/* @__PURE__ */ _(
|
|
636
636
|
"button",
|
|
637
637
|
{
|
|
638
638
|
ref: V,
|
|
@@ -643,27 +643,27 @@ const Gt = Te(
|
|
|
643
643
|
w && Ne.triggerOpen,
|
|
644
644
|
m && Ne.triggerError,
|
|
645
645
|
p && Ne.fullWidth,
|
|
646
|
-
|
|
646
|
+
g?.trigger
|
|
647
647
|
),
|
|
648
648
|
onClick: ee,
|
|
649
649
|
"aria-expanded": w,
|
|
650
650
|
"aria-haspopup": "menu",
|
|
651
651
|
"aria-controls": w ? U : void 0,
|
|
652
652
|
children: [
|
|
653
|
-
/* @__PURE__ */ s("span", { className: f(Ne.triggerLabel, Z && Ne.placeholder,
|
|
654
|
-
/* @__PURE__ */ s("span", { className: f(Ne.chevron,
|
|
653
|
+
/* @__PURE__ */ s("span", { className: f(Ne.triggerLabel, Z && Ne.placeholder, g?.triggerLabel), children: $ }),
|
|
654
|
+
/* @__PURE__ */ s("span", { className: f(Ne.chevron, g?.chevron), "aria-hidden": "true" })
|
|
655
655
|
]
|
|
656
656
|
}
|
|
657
657
|
),
|
|
658
|
-
!
|
|
658
|
+
!N && j()
|
|
659
659
|
] }),
|
|
660
|
-
|
|
660
|
+
N && w && typeof document < "u" && yt(
|
|
661
661
|
j({
|
|
662
662
|
position: "fixed",
|
|
663
|
-
top:
|
|
664
|
-
left: n === "right" ? void 0 :
|
|
665
|
-
right: n === "right" ? window.innerWidth - (
|
|
666
|
-
minWidth:
|
|
663
|
+
top: L.top + 4,
|
|
664
|
+
left: n === "right" ? void 0 : L.left,
|
|
665
|
+
right: n === "right" ? window.innerWidth - (L.left + L.width) : void 0,
|
|
666
|
+
minWidth: L.width,
|
|
667
667
|
zIndex: "var(--crk-z-floating)"
|
|
668
668
|
}),
|
|
669
669
|
document.body
|
|
@@ -737,13 +737,13 @@ const Zt = Te(
|
|
|
737
737
|
className: l,
|
|
738
738
|
style: a
|
|
739
739
|
}, h) => {
|
|
740
|
-
const [d, u] = Ce(!1), m = ie(null), p = ie(null),
|
|
740
|
+
const [d, u] = Ce(!1), m = ie(null), p = ie(null), N = ie(null), g = Ge(), C = o !== void 0, w = C ? o : d, J = me(
|
|
741
741
|
(U) => {
|
|
742
742
|
C || u(U), c?.(U);
|
|
743
743
|
},
|
|
744
744
|
[C, c]
|
|
745
745
|
), D = me(() => {
|
|
746
|
-
J(!1),
|
|
746
|
+
J(!1), N.current?.focus();
|
|
747
747
|
}, [J]), F = me(() => {
|
|
748
748
|
J(!w);
|
|
749
749
|
}, [w, J]);
|
|
@@ -764,26 +764,26 @@ const Zt = Te(
|
|
|
764
764
|
if (t && mn(e)) {
|
|
765
765
|
const U = e, B = U.ref;
|
|
766
766
|
V = jt(U, {
|
|
767
|
-
ref: $o(
|
|
767
|
+
ref: $o(N, B),
|
|
768
768
|
onClick: (ee) => {
|
|
769
769
|
U.props.onClick?.(ee), F();
|
|
770
770
|
},
|
|
771
771
|
className: f(U.props.className, i?.trigger),
|
|
772
772
|
"aria-expanded": w,
|
|
773
773
|
"aria-haspopup": "dialog",
|
|
774
|
-
"aria-controls": w ?
|
|
774
|
+
"aria-controls": w ? g : void 0
|
|
775
775
|
});
|
|
776
776
|
} else
|
|
777
777
|
V = /* @__PURE__ */ s(
|
|
778
778
|
"button",
|
|
779
779
|
{
|
|
780
|
-
ref:
|
|
780
|
+
ref: N,
|
|
781
781
|
type: "button",
|
|
782
782
|
className: f(ut.trigger, i?.trigger),
|
|
783
783
|
onClick: F,
|
|
784
784
|
"aria-expanded": w,
|
|
785
785
|
"aria-haspopup": "dialog",
|
|
786
|
-
"aria-controls": w ?
|
|
786
|
+
"aria-controls": w ? g : void 0,
|
|
787
787
|
children: e
|
|
788
788
|
}
|
|
789
789
|
);
|
|
@@ -793,13 +793,13 @@ const Zt = Te(
|
|
|
793
793
|
ref: h,
|
|
794
794
|
className: f(ut.root, i?.root, l),
|
|
795
795
|
style: a,
|
|
796
|
-
children: /* @__PURE__ */
|
|
796
|
+
children: /* @__PURE__ */ _("div", { ref: m, children: [
|
|
797
797
|
V,
|
|
798
798
|
w && /* @__PURE__ */ s(
|
|
799
799
|
"div",
|
|
800
800
|
{
|
|
801
801
|
ref: p,
|
|
802
|
-
id:
|
|
802
|
+
id: g,
|
|
803
803
|
role: "dialog",
|
|
804
804
|
tabIndex: -1,
|
|
805
805
|
className: f(ut.popover, ut[r], i?.popover),
|
|
@@ -847,7 +847,7 @@ function No(e, t) {
|
|
|
847
847
|
};
|
|
848
848
|
}, [t, e, r]);
|
|
849
849
|
}
|
|
850
|
-
const Lo = "crk-backdrop-jYpTA", To = "crk-backdropIn-x5Z-A", So = "crk-modal-yNG-7", Ro = "crk-modalIn-xFUwm", Co = "crk-sm--xyY9", Ao = "crk-md-ETTfh", Do = "crk-lg-5DBb7", Io = "crk-fullscreen-b4jQ-", Bo = "crk-header-NS30G", Eo = "crk-headerWithClose-4davm", Po = "crk-closeButton-JX-aq", Wo = "crk-body-3zIj9", Ho = "crk-footer-Oyz-R",
|
|
850
|
+
const Lo = "crk-backdrop-jYpTA", To = "crk-backdropIn-x5Z-A", So = "crk-modal-yNG-7", Ro = "crk-modalIn-xFUwm", Co = "crk-sm--xyY9", Ao = "crk-md-ETTfh", Do = "crk-lg-5DBb7", Io = "crk-fullscreen-b4jQ-", Bo = "crk-header-NS30G", Eo = "crk-headerWithClose-4davm", Po = "crk-closeButton-JX-aq", Wo = "crk-body-3zIj9", Ho = "crk-footer-Oyz-R", Ye = {
|
|
851
851
|
backdrop: Lo,
|
|
852
852
|
backdropIn: To,
|
|
853
853
|
modal: So,
|
|
@@ -863,11 +863,11 @@ const Lo = "crk-backdrop-jYpTA", To = "crk-backdropIn-x5Z-A", So = "crk-modal-yN
|
|
|
863
863
|
footer: Ho
|
|
864
864
|
}, vt = zt({ classes: {}, titleId: "" }), Kt = ({ children: e, className: t, style: n, onClose: r }) => {
|
|
865
865
|
const { classes: o, titleId: c } = gt(vt);
|
|
866
|
-
return /* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ _(
|
|
867
867
|
"div",
|
|
868
868
|
{
|
|
869
869
|
id: c,
|
|
870
|
-
className: f(
|
|
870
|
+
className: f(Ye.header, r && Ye.headerWithClose, o.header, t),
|
|
871
871
|
style: n,
|
|
872
872
|
children: [
|
|
873
873
|
e,
|
|
@@ -875,7 +875,7 @@ const Lo = "crk-backdrop-jYpTA", To = "crk-backdropIn-x5Z-A", So = "crk-modal-yN
|
|
|
875
875
|
"button",
|
|
876
876
|
{
|
|
877
877
|
type: "button",
|
|
878
|
-
className: f(
|
|
878
|
+
className: f(Ye.closeButton, o.closeButton),
|
|
879
879
|
onClick: r,
|
|
880
880
|
"aria-label": "Close",
|
|
881
881
|
children: "×"
|
|
@@ -888,12 +888,12 @@ const Lo = "crk-backdrop-jYpTA", To = "crk-backdropIn-x5Z-A", So = "crk-modal-yN
|
|
|
888
888
|
Kt.displayName = "Modal.Header";
|
|
889
889
|
const Qt = ({ children: e, className: t, style: n }) => {
|
|
890
890
|
const { classes: r } = gt(vt);
|
|
891
|
-
return /* @__PURE__ */ s("div", { className: f(
|
|
891
|
+
return /* @__PURE__ */ s("div", { className: f(Ye.body, r.body, t), style: n, children: e });
|
|
892
892
|
};
|
|
893
893
|
Qt.displayName = "Modal.Body";
|
|
894
894
|
const Jt = ({ children: e, className: t, style: n }) => {
|
|
895
895
|
const { classes: r } = gt(vt);
|
|
896
|
-
return /* @__PURE__ */ s("div", { className: f(
|
|
896
|
+
return /* @__PURE__ */ s("div", { className: f(Ye.footer, r.footer, t), style: n, children: e });
|
|
897
897
|
};
|
|
898
898
|
Jt.displayName = "Modal.Footer";
|
|
899
899
|
const bt = Te(
|
|
@@ -910,7 +910,7 @@ const bt = Te(
|
|
|
910
910
|
"aria-label": h,
|
|
911
911
|
"aria-labelledby": d
|
|
912
912
|
}, u) => {
|
|
913
|
-
const m = ie(null), p = u ?? m,
|
|
913
|
+
const m = ie(null), p = u ?? m, N = Ge(), g = d ?? `${N}-title`;
|
|
914
914
|
No(p, e);
|
|
915
915
|
const C = we(
|
|
916
916
|
() => ({
|
|
@@ -934,20 +934,20 @@ const bt = Te(
|
|
|
934
934
|
/* @__PURE__ */ s(
|
|
935
935
|
"div",
|
|
936
936
|
{
|
|
937
|
-
className: f(
|
|
937
|
+
className: f(Ye.backdrop, c?.backdrop),
|
|
938
938
|
onClick: w,
|
|
939
939
|
role: "presentation",
|
|
940
940
|
children: /* @__PURE__ */ s(
|
|
941
941
|
"div",
|
|
942
942
|
{
|
|
943
943
|
ref: p,
|
|
944
|
-
className: f(
|
|
944
|
+
className: f(Ye.modal, Ye[o], c?.modal, i),
|
|
945
945
|
style: l,
|
|
946
946
|
role: "dialog",
|
|
947
947
|
"aria-modal": "true",
|
|
948
948
|
"aria-label": h,
|
|
949
|
-
"aria-labelledby": h ? void 0 :
|
|
950
|
-
children: /* @__PURE__ */ s(vt.Provider, { value: { classes: c ?? {}, titleId:
|
|
949
|
+
"aria-labelledby": h ? void 0 : g,
|
|
950
|
+
children: /* @__PURE__ */ s(vt.Provider, { value: { classes: c ?? {}, titleId: g }, children: a })
|
|
951
951
|
}
|
|
952
952
|
)
|
|
953
953
|
}
|
|
@@ -960,13 +960,13 @@ bt.displayName = "Modal";
|
|
|
960
960
|
bt.Header = Kt;
|
|
961
961
|
bt.Body = Qt;
|
|
962
962
|
bt.Footer = Jt;
|
|
963
|
-
const Oo = "crk-root-jHIIP", Fo = "crk-formErrors-eh-OP", Xo = "crk-formError-XEuWv", Uo = "crk-field-OUlYz",
|
|
963
|
+
const Oo = "crk-root-jHIIP", Fo = "crk-formErrors-eh-OP", Xo = "crk-formError-XEuWv", Uo = "crk-field-OUlYz", Yo = "crk-label-udkR7", _o = "crk-labelError-LOgKi", jo = "crk-required-IYiA2", zo = "crk-error-yFZXm", Vo = "crk-helperText-Dm-rb", qo = "crk-row-nNbx-", Fe = {
|
|
964
964
|
root: Oo,
|
|
965
965
|
formErrors: Fo,
|
|
966
966
|
formError: Xo,
|
|
967
967
|
field: Uo,
|
|
968
|
-
label:
|
|
969
|
-
labelError:
|
|
968
|
+
label: Yo,
|
|
969
|
+
labelError: _o,
|
|
970
970
|
required: jo,
|
|
971
971
|
error: zo,
|
|
972
972
|
helperText: Vo,
|
|
@@ -981,7 +981,7 @@ function Ol({
|
|
|
981
981
|
children: c
|
|
982
982
|
}) {
|
|
983
983
|
const i = n && n.length > 0;
|
|
984
|
-
return /* @__PURE__ */ s(pn, { ...e, children: /* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ s(pn, { ...e, children: /* @__PURE__ */ _(
|
|
985
985
|
"form",
|
|
986
986
|
{
|
|
987
987
|
onSubmit: e.handleSubmit(t),
|
|
@@ -1012,8 +1012,8 @@ function Fl({
|
|
|
1012
1012
|
style: l,
|
|
1013
1013
|
children: a
|
|
1014
1014
|
}) {
|
|
1015
|
-
const { control: h } = gn(), { field: d, fieldState: u } = yn({ name: e, control: h, rules: o }), m = a.type, p = typeof m == "string" ? "" : m?.displayName ?? m?.name ?? "",
|
|
1016
|
-
w.current =
|
|
1015
|
+
const { control: h } = gn(), { field: d, fieldState: u } = yn({ name: e, control: h, rules: o }), m = a.type, p = typeof m == "string" ? "" : m?.displayName ?? m?.name ?? "", N = Go.has(p), { ref: g, ...C } = d, w = ie(g);
|
|
1016
|
+
w.current = g;
|
|
1017
1017
|
const J = me(
|
|
1018
1018
|
(D) => {
|
|
1019
1019
|
if (D) {
|
|
@@ -1025,8 +1025,8 @@ function Fl({
|
|
|
1025
1025
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1026
1026
|
[]
|
|
1027
1027
|
);
|
|
1028
|
-
return /* @__PURE__ */
|
|
1029
|
-
t && /* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ _("div", { className: f(Fe.field, c?.field, i), style: l, children: [
|
|
1029
|
+
t && /* @__PURE__ */ _("label", { className: f(Fe.label, u.error && Fe.labelError, c?.label), htmlFor: e, children: [
|
|
1030
1030
|
t,
|
|
1031
1031
|
r && /* @__PURE__ */ s("span", { className: Fe.required, children: "*" })
|
|
1032
1032
|
] }),
|
|
@@ -1040,7 +1040,7 @@ function Fl({
|
|
|
1040
1040
|
// Bridge for custom components that use onValueChange/onValuesChange (Select, Dropdown).
|
|
1041
1041
|
// Skip for native-input wrappers (Input, Textarea, Checkbox, Radio) so the unknown
|
|
1042
1042
|
// handler doesn't leak onto the DOM and trip React's "Unknown event handler" warning.
|
|
1043
|
-
...
|
|
1043
|
+
...N && {
|
|
1044
1044
|
onValueChange: C.onChange,
|
|
1045
1045
|
onValuesChange: C.onChange
|
|
1046
1046
|
},
|
|
@@ -1092,7 +1092,7 @@ const Zo = "crk-root-rSgdy", Ko = "crk-wrapper-GHy8V", Qo = "crk-sm-DptM5", Jo =
|
|
|
1092
1092
|
...l
|
|
1093
1093
|
}
|
|
1094
1094
|
);
|
|
1095
|
-
return n || r ? /* @__PURE__ */
|
|
1095
|
+
return n || r ? /* @__PURE__ */ _(
|
|
1096
1096
|
"div",
|
|
1097
1097
|
{
|
|
1098
1098
|
className: f(Oe.wrapper, Oe[e], t && Oe.error, o?.wrapper, c),
|
|
@@ -1152,23 +1152,30 @@ const li = "crk-wrapper-SP2JE", si = "crk-sm-DqshL", ai = "crk-md-j4AKI", di = "
|
|
|
1152
1152
|
children: l,
|
|
1153
1153
|
searchable: a,
|
|
1154
1154
|
searchPlaceholder: h,
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1155
|
+
onChange: d,
|
|
1156
|
+
onValueChange: u,
|
|
1157
|
+
...m
|
|
1158
|
+
}, p) => {
|
|
1159
|
+
const N = d || u ? (g) => {
|
|
1160
|
+
d?.(g), u?.(g.target.value);
|
|
1161
|
+
} : void 0;
|
|
1162
|
+
return /* @__PURE__ */ _("div", { className: f(H.wrapper, H[e], t && H.error, o?.wrapper, c), style: i, children: [
|
|
1163
|
+
/* @__PURE__ */ _(
|
|
1164
|
+
"select",
|
|
1165
|
+
{
|
|
1166
|
+
ref: p,
|
|
1167
|
+
className: f(H.root, H[e], t && H.error, o?.root),
|
|
1168
|
+
onChange: N,
|
|
1169
|
+
...m,
|
|
1170
|
+
children: [
|
|
1171
|
+
r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
|
|
1172
|
+
n ? n.map((g) => /* @__PURE__ */ s("option", { value: g.value, disabled: g.disabled, children: g.label }, g.value)) : l
|
|
1173
|
+
]
|
|
1174
|
+
}
|
|
1175
|
+
),
|
|
1176
|
+
/* @__PURE__ */ s("span", { className: f(H.arrow, o?.arrow) })
|
|
1177
|
+
] });
|
|
1178
|
+
}
|
|
1172
1179
|
);
|
|
1173
1180
|
en.displayName = "NativeSelect";
|
|
1174
1181
|
const tn = Te(
|
|
@@ -1187,22 +1194,22 @@ const tn = Te(
|
|
|
1187
1194
|
onChange: u,
|
|
1188
1195
|
onValueChange: m,
|
|
1189
1196
|
portal: p = !0
|
|
1190
|
-
},
|
|
1191
|
-
const [
|
|
1197
|
+
}, N) => {
|
|
1198
|
+
const [g, C] = Ce(!1), [w, J] = Ce(""), [D, F] = Ce(0), V = ie(null), U = ie(null), B = ie(null), ee = ie(null), q = ie(null), L = Ge(), te = Rt(B, g && p), $ = ie(null), Z = N ?? $, I = ie(!1);
|
|
1192
1199
|
Re(() => {
|
|
1193
|
-
I.current && !
|
|
1194
|
-
}, [
|
|
1200
|
+
I.current && !g && B.current?.focus(), I.current = g;
|
|
1201
|
+
}, [g]);
|
|
1195
1202
|
const j = me(() => {
|
|
1196
1203
|
C(!1), J(""), F(0);
|
|
1197
1204
|
}, []), A = me(() => {
|
|
1198
1205
|
a || (C(!0), J(""), F(0), setTimeout(() => U.current?.focus(), 0));
|
|
1199
1206
|
}, [a]), z = me(
|
|
1200
|
-
(
|
|
1201
|
-
if (m?.(
|
|
1207
|
+
(T) => {
|
|
1208
|
+
if (m?.(T), Z.current) {
|
|
1202
1209
|
Object.getOwnPropertyDescriptor(
|
|
1203
1210
|
HTMLSelectElement.prototype,
|
|
1204
1211
|
"value"
|
|
1205
|
-
)?.set?.call(Z.current,
|
|
1212
|
+
)?.set?.call(Z.current, T);
|
|
1206
1213
|
const v = new Event("change", { bubbles: !0 });
|
|
1207
1214
|
Z.current.dispatchEvent(v), u?.(v);
|
|
1208
1215
|
}
|
|
@@ -1211,50 +1218,50 @@ const tn = Te(
|
|
|
1211
1218
|
[m, u, Z, j]
|
|
1212
1219
|
), ae = we(() => {
|
|
1213
1220
|
if (!w) return n;
|
|
1214
|
-
const
|
|
1215
|
-
return n.filter((
|
|
1221
|
+
const T = w.toLowerCase();
|
|
1222
|
+
return n.filter((y) => y.label.toLowerCase().includes(T));
|
|
1216
1223
|
}, [n, w]);
|
|
1217
1224
|
Re(() => {
|
|
1218
|
-
const
|
|
1219
|
-
F(
|
|
1225
|
+
const T = ae.findIndex((y) => !y.disabled);
|
|
1226
|
+
F(T >= 0 ? T : 0);
|
|
1220
1227
|
}, [ae]), Re(() => {
|
|
1221
|
-
if (!
|
|
1222
|
-
const
|
|
1223
|
-
if (!
|
|
1224
|
-
|
|
1225
|
-
}, [D,
|
|
1228
|
+
if (!g) return;
|
|
1229
|
+
const T = q.current;
|
|
1230
|
+
if (!T) return;
|
|
1231
|
+
T.querySelectorAll('[role="option"]')[D]?.scrollIntoView?.({ block: "nearest" });
|
|
1232
|
+
}, [D, g]);
|
|
1226
1233
|
const de = me(
|
|
1227
|
-
(
|
|
1228
|
-
const
|
|
1229
|
-
if (
|
|
1230
|
-
if (
|
|
1231
|
-
|
|
1232
|
-
const P =
|
|
1233
|
-
return P <
|
|
1234
|
+
(T) => {
|
|
1235
|
+
const y = ae.map((v, P) => v.disabled ? -1 : P).filter((v) => v >= 0);
|
|
1236
|
+
if (y.length !== 0)
|
|
1237
|
+
if (T.key === "ArrowDown")
|
|
1238
|
+
T.preventDefault(), F((v) => {
|
|
1239
|
+
const P = y.indexOf(v);
|
|
1240
|
+
return P < y.length - 1 ? y[P + 1] : y[0];
|
|
1234
1241
|
});
|
|
1235
|
-
else if (
|
|
1236
|
-
|
|
1237
|
-
const P =
|
|
1238
|
-
return P > 0 ?
|
|
1242
|
+
else if (T.key === "ArrowUp")
|
|
1243
|
+
T.preventDefault(), F((v) => {
|
|
1244
|
+
const P = y.indexOf(v);
|
|
1245
|
+
return P > 0 ? y[P - 1] : y[y.length - 1];
|
|
1239
1246
|
});
|
|
1240
|
-
else if (
|
|
1241
|
-
|
|
1247
|
+
else if (T.key === "Enter") {
|
|
1248
|
+
T.preventDefault();
|
|
1242
1249
|
const v = ae[D];
|
|
1243
1250
|
v && !v.disabled && z(v.value);
|
|
1244
|
-
} else
|
|
1251
|
+
} else T.key === "Escape" && (T.preventDefault(), j());
|
|
1245
1252
|
},
|
|
1246
1253
|
[ae, D, z, j]
|
|
1247
1254
|
);
|
|
1248
1255
|
Re(() => {
|
|
1249
|
-
if (!
|
|
1250
|
-
const
|
|
1251
|
-
const v =
|
|
1256
|
+
if (!g) return;
|
|
1257
|
+
const T = (y) => {
|
|
1258
|
+
const v = y.target;
|
|
1252
1259
|
V.current?.contains(v) || ee.current?.contains(v) || j();
|
|
1253
1260
|
};
|
|
1254
|
-
return document.addEventListener("mousedown",
|
|
1255
|
-
}, [
|
|
1256
|
-
const G = n.find((
|
|
1257
|
-
return /* @__PURE__ */
|
|
1261
|
+
return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
|
|
1262
|
+
}, [g, j]);
|
|
1263
|
+
const G = n.find((T) => T.value === l)?.label, E = ae.filter((T) => !T.disabled);
|
|
1264
|
+
return /* @__PURE__ */ _(
|
|
1258
1265
|
"div",
|
|
1259
1266
|
{
|
|
1260
1267
|
ref: V,
|
|
@@ -1280,10 +1287,10 @@ const tn = Te(
|
|
|
1280
1287
|
"aria-hidden": "true",
|
|
1281
1288
|
onChange: () => {
|
|
1282
1289
|
},
|
|
1283
|
-
children: n.map((
|
|
1290
|
+
children: n.map((T) => /* @__PURE__ */ s("option", { value: T.value, children: T.label }, T.value))
|
|
1284
1291
|
}
|
|
1285
1292
|
),
|
|
1286
|
-
/* @__PURE__ */
|
|
1293
|
+
/* @__PURE__ */ _(
|
|
1287
1294
|
"button",
|
|
1288
1295
|
{
|
|
1289
1296
|
ref: B,
|
|
@@ -1293,23 +1300,23 @@ const tn = Te(
|
|
|
1293
1300
|
H.root,
|
|
1294
1301
|
H.searchableTrigger,
|
|
1295
1302
|
H[e],
|
|
1296
|
-
|
|
1303
|
+
g && H.triggerOpen,
|
|
1297
1304
|
t && H.error,
|
|
1298
|
-
|
|
1305
|
+
g && H.visuallyHidden,
|
|
1299
1306
|
o?.root
|
|
1300
1307
|
),
|
|
1301
1308
|
onClick: A,
|
|
1302
1309
|
disabled: a,
|
|
1303
|
-
"aria-expanded":
|
|
1310
|
+
"aria-expanded": g,
|
|
1304
1311
|
"aria-haspopup": "listbox",
|
|
1305
|
-
"aria-controls":
|
|
1312
|
+
"aria-controls": g ? L : void 0,
|
|
1306
1313
|
children: [
|
|
1307
1314
|
/* @__PURE__ */ s("span", { className: f(H.triggerLabel, !G && H.placeholder), children: G || r }),
|
|
1308
1315
|
/* @__PURE__ */ s("span", { className: f(H.arrow, H.arrowInline, o?.arrow) })
|
|
1309
1316
|
]
|
|
1310
1317
|
}
|
|
1311
1318
|
),
|
|
1312
|
-
|
|
1319
|
+
g && /* @__PURE__ */ s(
|
|
1313
1320
|
"input",
|
|
1314
1321
|
{
|
|
1315
1322
|
ref: U,
|
|
@@ -1326,29 +1333,29 @@ const tn = Te(
|
|
|
1326
1333
|
),
|
|
1327
1334
|
placeholder: G || r,
|
|
1328
1335
|
value: w,
|
|
1329
|
-
onChange: (
|
|
1336
|
+
onChange: (T) => J(T.target.value),
|
|
1330
1337
|
onKeyDown: de,
|
|
1331
1338
|
"aria-expanded": !0,
|
|
1332
1339
|
"aria-haspopup": "listbox",
|
|
1333
|
-
"aria-controls":
|
|
1340
|
+
"aria-controls": L,
|
|
1334
1341
|
"aria-activedescendant": E.length > 0 ? `select-option-${ae[D]?.value}` : void 0
|
|
1335
1342
|
}
|
|
1336
1343
|
),
|
|
1337
|
-
|
|
1338
|
-
const
|
|
1344
|
+
g && (() => {
|
|
1345
|
+
const T = p ? {
|
|
1339
1346
|
position: "fixed",
|
|
1340
1347
|
top: te.top + 4,
|
|
1341
1348
|
left: te.left,
|
|
1342
1349
|
right: "auto",
|
|
1343
1350
|
width: te.width,
|
|
1344
1351
|
zIndex: "var(--crk-z-floating)"
|
|
1345
|
-
} : void 0,
|
|
1352
|
+
} : void 0, y = /* @__PURE__ */ s(
|
|
1346
1353
|
"div",
|
|
1347
1354
|
{
|
|
1348
|
-
id:
|
|
1355
|
+
id: L,
|
|
1349
1356
|
ref: ee,
|
|
1350
1357
|
className: f(H.menu, o?.menu),
|
|
1351
|
-
style:
|
|
1358
|
+
style: T,
|
|
1352
1359
|
role: "listbox",
|
|
1353
1360
|
children: /* @__PURE__ */ s("div", { className: H.menuItems, ref: q, children: ae.length === 0 ? /* @__PURE__ */ s("div", { className: H.noResults, children: "No results" }) : ae.map((v, P) => /* @__PURE__ */ s(
|
|
1354
1361
|
"button",
|
|
@@ -1373,7 +1380,7 @@ const tn = Te(
|
|
|
1373
1380
|
)) })
|
|
1374
1381
|
}
|
|
1375
1382
|
);
|
|
1376
|
-
return p && typeof document < "u" ? yt(
|
|
1383
|
+
return p && typeof document < "u" ? yt(y, document.body) : y;
|
|
1377
1384
|
})()
|
|
1378
1385
|
]
|
|
1379
1386
|
}
|
|
@@ -1397,12 +1404,12 @@ const nn = Te(
|
|
|
1397
1404
|
onValuesChange: u,
|
|
1398
1405
|
clearSearchOnSelect: m = !0,
|
|
1399
1406
|
closeOnSelect: p = !0,
|
|
1400
|
-
allowCreate:
|
|
1401
|
-
onCreate:
|
|
1407
|
+
allowCreate: N = !1,
|
|
1408
|
+
onCreate: g,
|
|
1402
1409
|
createLabel: C,
|
|
1403
1410
|
portal: w = !0
|
|
1404
1411
|
}, J) => {
|
|
1405
|
-
const D = Array.isArray(l) ? l : l ? [l] : [], [F, V] = Ce(!1), [U, B] = Ce(""), [ee, q] = Ce(0),
|
|
1412
|
+
const D = Array.isArray(l) ? l : l ? [l] : [], [F, V] = Ce(!1), [U, B] = Ce(""), [ee, q] = Ce(0), L = ie(null), te = ie(null), $ = ie(null), Z = ie(null), I = ie(null), j = Ge(), A = Rt(I, F && w), z = ie(null), ae = J ?? z, de = me(() => {
|
|
1406
1413
|
V(!1), B(""), q(0);
|
|
1407
1414
|
}, []), G = me(() => {
|
|
1408
1415
|
a || (V(!0), B(""), q(0), setTimeout(() => te.current?.focus(), 0));
|
|
@@ -1412,32 +1419,32 @@ const nn = Te(
|
|
|
1412
1419
|
u?.(K), p ? de() : m && B("");
|
|
1413
1420
|
},
|
|
1414
1421
|
[D, u, p, de, m]
|
|
1415
|
-
),
|
|
1422
|
+
), T = me(
|
|
1416
1423
|
(x, K) => {
|
|
1417
1424
|
K.stopPropagation(), u?.(D.filter((R) => R !== x));
|
|
1418
1425
|
},
|
|
1419
1426
|
[D, u]
|
|
1420
|
-
),
|
|
1427
|
+
), y = we(() => {
|
|
1421
1428
|
if (!U) return n;
|
|
1422
1429
|
const x = U.toLowerCase();
|
|
1423
1430
|
return n.filter((K) => K.label.toLowerCase().includes(x));
|
|
1424
|
-
}, [n, U]), v = U.trim(), P =
|
|
1431
|
+
}, [n, U]), v = U.trim(), P = N && v.length > 0 && !n.some(
|
|
1425
1432
|
(x) => x.label.toLowerCase() === v.toLowerCase() || x.value === v
|
|
1426
1433
|
) && !D.includes(v), Q = me(() => {
|
|
1427
|
-
v && (D.includes(v) || (
|
|
1428
|
-
}, [v, D,
|
|
1434
|
+
v && (D.includes(v) || (g?.(v), u?.([...D, v]), p ? de() : m && B("")));
|
|
1435
|
+
}, [v, D, g, u, p, de, m]);
|
|
1429
1436
|
Re(() => {
|
|
1430
|
-
const x =
|
|
1437
|
+
const x = y.findIndex((K) => !K.disabled);
|
|
1431
1438
|
q(x >= 0 ? x : 0);
|
|
1432
|
-
}, [
|
|
1439
|
+
}, [y]), Re(() => {
|
|
1433
1440
|
if (!F) return;
|
|
1434
1441
|
const x = Z.current;
|
|
1435
1442
|
if (!x) return;
|
|
1436
1443
|
x.querySelectorAll('[role="option"]')[ee]?.scrollIntoView?.({ block: "nearest" });
|
|
1437
1444
|
}, [ee, F]);
|
|
1438
|
-
const ne =
|
|
1445
|
+
const ne = y.length, X = me(
|
|
1439
1446
|
(x) => {
|
|
1440
|
-
const K =
|
|
1447
|
+
const K = y.map((R, re) => R.disabled ? -1 : re).filter((R) => R >= 0);
|
|
1441
1448
|
if (P && K.push(ne), x.key === "Backspace" && U === "" && D.length > 0) {
|
|
1442
1449
|
x.preventDefault(), u?.(D.slice(0, -1));
|
|
1443
1450
|
return;
|
|
@@ -1462,25 +1469,25 @@ const nn = Te(
|
|
|
1462
1469
|
Q();
|
|
1463
1470
|
return;
|
|
1464
1471
|
}
|
|
1465
|
-
const R =
|
|
1472
|
+
const R = y[ee];
|
|
1466
1473
|
R && !R.disabled ? E(R.value) : P && Q();
|
|
1467
1474
|
} else x.key === "Escape" && (x.preventDefault(), de());
|
|
1468
1475
|
},
|
|
1469
|
-
[
|
|
1476
|
+
[y, ee, E, de, U, D, u, F, G, P, Q, ne]
|
|
1470
1477
|
);
|
|
1471
1478
|
Re(() => {
|
|
1472
1479
|
if (!F) return;
|
|
1473
1480
|
const x = (K) => {
|
|
1474
1481
|
const R = K.target;
|
|
1475
|
-
|
|
1482
|
+
L.current?.contains(R) || $.current?.contains(R) || de();
|
|
1476
1483
|
};
|
|
1477
1484
|
return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
|
|
1478
1485
|
}, [F, de]);
|
|
1479
1486
|
const ue = D.map((x) => n.find((R) => R.value === x) ?? { value: x, label: x });
|
|
1480
|
-
return /* @__PURE__ */
|
|
1487
|
+
return /* @__PURE__ */ _(
|
|
1481
1488
|
"div",
|
|
1482
1489
|
{
|
|
1483
|
-
ref:
|
|
1490
|
+
ref: L,
|
|
1484
1491
|
className: f(
|
|
1485
1492
|
H.wrapper,
|
|
1486
1493
|
H.searchableWrapper,
|
|
@@ -1507,7 +1514,7 @@ const nn = Te(
|
|
|
1507
1514
|
children: n.map((x) => /* @__PURE__ */ s("option", { value: x.value, children: x.label }, x.value))
|
|
1508
1515
|
}
|
|
1509
1516
|
),
|
|
1510
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ _(
|
|
1511
1518
|
"div",
|
|
1512
1519
|
{
|
|
1513
1520
|
ref: I,
|
|
@@ -1527,14 +1534,14 @@ const nn = Te(
|
|
|
1527
1534
|
"aria-haspopup": "listbox",
|
|
1528
1535
|
"aria-controls": F ? j : void 0,
|
|
1529
1536
|
children: [
|
|
1530
|
-
ue.map((x) => /* @__PURE__ */
|
|
1537
|
+
ue.map((x) => /* @__PURE__ */ _("span", { className: f(H.chip, o?.chip), children: [
|
|
1531
1538
|
/* @__PURE__ */ s("span", { className: H.chipLabel, children: x.content ?? x.label }),
|
|
1532
1539
|
/* @__PURE__ */ s(
|
|
1533
1540
|
"button",
|
|
1534
1541
|
{
|
|
1535
1542
|
type: "button",
|
|
1536
1543
|
className: f(H.chipRemove, o?.chipRemove),
|
|
1537
|
-
onClick: (K) =>
|
|
1544
|
+
onClick: (K) => T(x.value, K),
|
|
1538
1545
|
"aria-label": `Remove ${x.label}`,
|
|
1539
1546
|
tabIndex: -1,
|
|
1540
1547
|
children: "×"
|
|
@@ -1579,11 +1586,11 @@ const nn = Te(
|
|
|
1579
1586
|
style: x,
|
|
1580
1587
|
role: "listbox",
|
|
1581
1588
|
"aria-multiselectable": "true",
|
|
1582
|
-
children: /* @__PURE__ */
|
|
1583
|
-
|
|
1584
|
-
|
|
1589
|
+
children: /* @__PURE__ */ _("div", { className: H.menuItems, ref: Z, children: [
|
|
1590
|
+
y.length === 0 && !P && /* @__PURE__ */ s("div", { className: H.noResults, children: "No results" }),
|
|
1591
|
+
y.map((R, re) => {
|
|
1585
1592
|
const fe = D.includes(R.value);
|
|
1586
|
-
return /* @__PURE__ */
|
|
1593
|
+
return /* @__PURE__ */ _(
|
|
1587
1594
|
"button",
|
|
1588
1595
|
{
|
|
1589
1596
|
id: `select-option-${R.value}`,
|
|
@@ -1621,7 +1628,7 @@ const nn = Te(
|
|
|
1621
1628
|
),
|
|
1622
1629
|
onClick: Q,
|
|
1623
1630
|
onMouseEnter: () => q(ne),
|
|
1624
|
-
children: C ? C(v) : /* @__PURE__ */
|
|
1631
|
+
children: C ? C(v) : /* @__PURE__ */ _(_e, { children: [
|
|
1625
1632
|
"Create “",
|
|
1626
1633
|
/* @__PURE__ */ s("strong", { children: v }),
|
|
1627
1634
|
"”"
|
|
@@ -1644,12 +1651,12 @@ const Oi = Te(
|
|
|
1644
1651
|
(e, t) => e.multiple ? /* @__PURE__ */ s(nn, { ref: t, ...e }) : e.searchable ? /* @__PURE__ */ s(tn, { ref: t, ...e }) : /* @__PURE__ */ s(en, { ref: t, ...e })
|
|
1645
1652
|
);
|
|
1646
1653
|
Oi.displayName = "Select";
|
|
1647
|
-
const Fi = "crk-root-61cKD", Xi = "crk-input-bAjPU", Ui = "crk-label-W9IeS",
|
|
1654
|
+
const Fi = "crk-root-61cKD", Xi = "crk-input-bAjPU", Ui = "crk-label-W9IeS", Yi = "crk-indeterminate-mLarv", ht = {
|
|
1648
1655
|
root: Fi,
|
|
1649
1656
|
input: Xi,
|
|
1650
1657
|
label: Ui,
|
|
1651
|
-
indeterminate:
|
|
1652
|
-
},
|
|
1658
|
+
indeterminate: Yi
|
|
1659
|
+
}, _i = Te(
|
|
1653
1660
|
({
|
|
1654
1661
|
label: e,
|
|
1655
1662
|
indeterminate: t = !1,
|
|
@@ -1661,7 +1668,7 @@ const Fi = "crk-root-61cKD", Xi = "crk-input-bAjPU", Ui = "crk-label-W9IeS", _i
|
|
|
1661
1668
|
const l = ie(null);
|
|
1662
1669
|
return Re(() => {
|
|
1663
1670
|
l.current && (l.current.indeterminate = t);
|
|
1664
|
-
}, [t]), /* @__PURE__ */
|
|
1671
|
+
}, [t]), /* @__PURE__ */ _(
|
|
1665
1672
|
"label",
|
|
1666
1673
|
{
|
|
1667
1674
|
className: f(ht.root, t && ht.indeterminate, n?.root, r),
|
|
@@ -1684,7 +1691,7 @@ const Fi = "crk-root-61cKD", Xi = "crk-input-bAjPU", Ui = "crk-label-W9IeS", _i
|
|
|
1684
1691
|
);
|
|
1685
1692
|
}
|
|
1686
1693
|
);
|
|
1687
|
-
|
|
1694
|
+
_i.displayName = "Checkbox";
|
|
1688
1695
|
const ji = "crk-group-NNwCD", zi = "crk-root-7fGik", Vi = "crk-input-43PQW", qi = "crk-label-aW30x", ft = {
|
|
1689
1696
|
group: ji,
|
|
1690
1697
|
root: zi,
|
|
@@ -1728,10 +1735,10 @@ const Zi = Te(
|
|
|
1728
1735
|
name: l,
|
|
1729
1736
|
...a
|
|
1730
1737
|
}, h) => {
|
|
1731
|
-
const d = gt(rn), u = d?.name ?? l, m = d ? d.value === t : i, p = (
|
|
1732
|
-
d?.onChange?.(t), c?.(
|
|
1738
|
+
const d = gt(rn), u = d?.name ?? l, m = d ? d.value === t : i, p = (N) => {
|
|
1739
|
+
d?.onChange?.(t), c?.(N);
|
|
1733
1740
|
};
|
|
1734
|
-
return /* @__PURE__ */
|
|
1741
|
+
return /* @__PURE__ */ _("label", { className: f(ft.root, n?.root, r), style: o, children: [
|
|
1735
1742
|
/* @__PURE__ */ s(
|
|
1736
1743
|
"input",
|
|
1737
1744
|
{
|
|
@@ -1865,14 +1872,14 @@ const dc = "crk-root-uMSq0", uc = "crk-canvas-zhFr0", hc = "crk-svg-waPLB", mc =
|
|
|
1865
1872
|
const h = ie(null);
|
|
1866
1873
|
fn(a, () => h.current);
|
|
1867
1874
|
const { width: d } = ac(h), u = Math.max(0, d), m = t ?? Math.round(u / e);
|
|
1868
|
-
return /* @__PURE__ */
|
|
1875
|
+
return /* @__PURE__ */ _(
|
|
1869
1876
|
"div",
|
|
1870
1877
|
{
|
|
1871
1878
|
ref: h,
|
|
1872
1879
|
className: f(k.root, o?.root, n),
|
|
1873
1880
|
style: r,
|
|
1874
1881
|
children: [
|
|
1875
|
-
/* @__PURE__ */
|
|
1882
|
+
/* @__PURE__ */ _("div", { className: k.canvas, style: { height: m || void 0 }, children: [
|
|
1876
1883
|
u > 0 && m > 0 && /* @__PURE__ */ s(
|
|
1877
1884
|
"svg",
|
|
1878
1885
|
{
|
|
@@ -1897,7 +1904,7 @@ function xt({ config: e, order: t, classes: n }) {
|
|
|
1897
1904
|
const r = t ?? Object.keys(e);
|
|
1898
1905
|
return /* @__PURE__ */ s("div", { className: f(k.legend, n?.legend), role: "list", children: r.map((o) => {
|
|
1899
1906
|
const c = e[o];
|
|
1900
|
-
return c ? /* @__PURE__ */
|
|
1907
|
+
return c ? /* @__PURE__ */ _("div", { className: f(k.legendItem, n?.legendItem), role: "listitem", children: [
|
|
1901
1908
|
c.icon ? /* @__PURE__ */ s(
|
|
1902
1909
|
"span",
|
|
1903
1910
|
{
|
|
@@ -1938,24 +1945,24 @@ function nt({
|
|
|
1938
1945
|
className: f(k.tooltip, h?.tooltip),
|
|
1939
1946
|
style: { left: m, top: p, width: d },
|
|
1940
1947
|
role: "tooltip",
|
|
1941
|
-
children: c ? c(e) : /* @__PURE__ */
|
|
1948
|
+
children: c ? c(e) : /* @__PURE__ */ _(_e, { children: [
|
|
1942
1949
|
l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: k.tooltipTitle, children: String(e[l]) }),
|
|
1943
|
-
/* @__PURE__ */ s("div", { className: k.tooltipRows, children: Object.entries(o).map(([
|
|
1944
|
-
const C = e[
|
|
1950
|
+
/* @__PURE__ */ s("div", { className: k.tooltipRows, children: Object.entries(o).map(([N, g]) => {
|
|
1951
|
+
const C = e[N];
|
|
1945
1952
|
if (C == null) return null;
|
|
1946
|
-
const w = typeof C == "number" ? i(C) : String(C), J = a?.(
|
|
1947
|
-
return /* @__PURE__ */
|
|
1953
|
+
const w = typeof C == "number" ? i(C) : String(C), J = a?.(N) ?? g.color;
|
|
1954
|
+
return /* @__PURE__ */ _("div", { className: k.tooltipRow, children: [
|
|
1948
1955
|
/* @__PURE__ */ s("span", { className: k.legendSwatch, style: { background: J }, "aria-hidden": "true" }),
|
|
1949
|
-
/* @__PURE__ */ s("span", { className: k.tooltipLabel, children:
|
|
1956
|
+
/* @__PURE__ */ s("span", { className: k.tooltipLabel, children: g.label }),
|
|
1950
1957
|
/* @__PURE__ */ s("span", { className: k.tooltipValue, children: w })
|
|
1951
|
-
] },
|
|
1958
|
+
] }, N);
|
|
1952
1959
|
}) })
|
|
1953
1960
|
] })
|
|
1954
1961
|
}
|
|
1955
1962
|
);
|
|
1956
1963
|
}
|
|
1957
1964
|
function on({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: c }) {
|
|
1958
|
-
return /* @__PURE__ */ s("g", { className: f(k.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ s("g", { className: f(k.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ _("g", { children: [
|
|
1959
1966
|
o && /* @__PURE__ */ s(
|
|
1960
1967
|
"line",
|
|
1961
1968
|
{
|
|
@@ -2064,8 +2071,8 @@ function Ul({
|
|
|
2064
2071
|
renderLabel: u,
|
|
2065
2072
|
activeIndex: m,
|
|
2066
2073
|
onPointClick: p,
|
|
2067
|
-
showGrid:
|
|
2068
|
-
showLegend:
|
|
2074
|
+
showGrid: N = !0,
|
|
2075
|
+
showLegend: g = !0,
|
|
2069
2076
|
showTooltip: C = !0,
|
|
2070
2077
|
yTickCount: w = 5,
|
|
2071
2078
|
yFormat: J,
|
|
@@ -2076,7 +2083,7 @@ function Ul({
|
|
|
2076
2083
|
emptyMessage: B = "No data",
|
|
2077
2084
|
className: ee,
|
|
2078
2085
|
style: q,
|
|
2079
|
-
classes:
|
|
2086
|
+
classes: L
|
|
2080
2087
|
}) {
|
|
2081
2088
|
const te = { ...Hc, ...U }, $ = we(() => Object.keys(n), [n]), [Z, I] = Ce(null), j = ie(null), A = m ?? Z, z = (de, G) => {
|
|
2082
2089
|
if (l) {
|
|
@@ -2086,7 +2093,7 @@ function Ul({
|
|
|
2086
2093
|
return n[de]?.color ?? "var(--crk-chart-1)";
|
|
2087
2094
|
};
|
|
2088
2095
|
if (e.length === 0)
|
|
2089
|
-
return /* @__PURE__ */ s("div", { ref: j, className: f(k.root,
|
|
2096
|
+
return /* @__PURE__ */ s("div", { ref: j, className: f(k.root, L?.root, ee), style: q, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: B }) }) });
|
|
2090
2097
|
const ae = C && A !== null ? /* @__PURE__ */ s(
|
|
2091
2098
|
nt,
|
|
2092
2099
|
{
|
|
@@ -2099,7 +2106,7 @@ function Ul({
|
|
|
2099
2106
|
valueFormat: F,
|
|
2100
2107
|
titleKey: t,
|
|
2101
2108
|
resolveColor: l ? (de) => z(de, A) : void 0,
|
|
2102
|
-
classes:
|
|
2109
|
+
classes: L
|
|
2103
2110
|
}
|
|
2104
2111
|
) : null;
|
|
2105
2112
|
return /* @__PURE__ */ s(
|
|
@@ -2110,18 +2117,18 @@ function Ul({
|
|
|
2110
2117
|
height: o,
|
|
2111
2118
|
className: ee,
|
|
2112
2119
|
style: q,
|
|
2113
|
-
classes:
|
|
2114
|
-
legend:
|
|
2120
|
+
classes: L,
|
|
2121
|
+
legend: g ? /* @__PURE__ */ s(xt, { config: n, classes: L }) : void 0,
|
|
2115
2122
|
overlay: ae,
|
|
2116
2123
|
children: ({ width: de, height: G }) => {
|
|
2117
|
-
const E = te.left,
|
|
2118
|
-
for (const
|
|
2124
|
+
const E = te.left, T = de - te.right, y = te.top, v = G - te.bottom, P = Math.max(0, T - E), Q = Math.max(0, v - y), ne = e.map((Y) => String(Y[t])), X = je(ne, [E, T], 0), ue = [];
|
|
2125
|
+
for (const Y of $)
|
|
2119
2126
|
for (const ge of e) {
|
|
2120
|
-
const ke = ge[
|
|
2127
|
+
const ke = ge[Y];
|
|
2121
2128
|
typeof ke == "number" && ue.push(ke);
|
|
2122
2129
|
}
|
|
2123
|
-
const [x, K] = kt(ue), R = Math.min(0, x), re = Ke(R, K, w), fe = tt([re[0], re[re.length - 1]], [v,
|
|
2124
|
-
return /* @__PURE__ */
|
|
2130
|
+
const [x, K] = kt(ue), R = Math.min(0, x), re = Ke(R, K, w), fe = tt([re[0], re[re.length - 1]], [v, y]), be = re.map((Y) => ({ value: Y, y: fe(Y) })), Ae = Fc(ne).map((Y) => ({ label: Y, x: X(Y) }));
|
|
2131
|
+
return /* @__PURE__ */ _(_e, { children: [
|
|
2125
2132
|
/* @__PURE__ */ s(
|
|
2126
2133
|
on,
|
|
2127
2134
|
{
|
|
@@ -2129,17 +2136,17 @@ function Ul({
|
|
|
2129
2136
|
x: E,
|
|
2130
2137
|
plotWidth: P,
|
|
2131
2138
|
format: J,
|
|
2132
|
-
showGrid:
|
|
2133
|
-
classes:
|
|
2139
|
+
showGrid: N,
|
|
2140
|
+
classes: L
|
|
2134
2141
|
}
|
|
2135
2142
|
),
|
|
2136
|
-
/* @__PURE__ */ s(cn, { ticks: Ae, y: v, format: D, classes:
|
|
2137
|
-
$.map((
|
|
2138
|
-
const ge = n[
|
|
2139
|
-
const oe = M[
|
|
2143
|
+
/* @__PURE__ */ s(cn, { ticks: Ae, y: v, format: D, classes: L }),
|
|
2144
|
+
$.map((Y) => {
|
|
2145
|
+
const ge = n[Y], ke = e.map((M, b) => {
|
|
2146
|
+
const oe = M[Y], ce = typeof oe == "number" ? oe : 0;
|
|
2140
2147
|
return { x: X(ne[b]), y: fe(ce), value: ce, row: M };
|
|
2141
2148
|
});
|
|
2142
|
-
return /* @__PURE__ */
|
|
2149
|
+
return /* @__PURE__ */ _("g", { className: f(k.series, L?.series), children: [
|
|
2143
2150
|
/* @__PURE__ */ s(
|
|
2144
2151
|
"path",
|
|
2145
2152
|
{
|
|
@@ -2149,7 +2156,7 @@ function Ul({
|
|
|
2149
2156
|
}
|
|
2150
2157
|
),
|
|
2151
2158
|
i && ke.map((M, b) => {
|
|
2152
|
-
const oe = z(
|
|
2159
|
+
const oe = z(Y, b), ce = A === b, le = m !== void 0 && !ce, O = p ? () => p({ row: M.row, value: M.value, seriesKey: Y, index: b }) : void 0;
|
|
2153
2160
|
return a ? /* @__PURE__ */ s(
|
|
2154
2161
|
"g",
|
|
2155
2162
|
{
|
|
@@ -2159,7 +2166,7 @@ function Ul({
|
|
|
2159
2166
|
children: a({
|
|
2160
2167
|
row: M.row,
|
|
2161
2168
|
value: M.value,
|
|
2162
|
-
seriesKey:
|
|
2169
|
+
seriesKey: Y,
|
|
2163
2170
|
index: b,
|
|
2164
2171
|
x: M.x,
|
|
2165
2172
|
y: M.y,
|
|
@@ -2167,11 +2174,11 @@ function Ul({
|
|
|
2167
2174
|
active: ce
|
|
2168
2175
|
})
|
|
2169
2176
|
},
|
|
2170
|
-
`${
|
|
2177
|
+
`${Y}-${b}`
|
|
2171
2178
|
) : /* @__PURE__ */ s(
|
|
2172
2179
|
"circle",
|
|
2173
2180
|
{
|
|
2174
|
-
className: f(k.point,
|
|
2181
|
+
className: f(k.point, L?.point),
|
|
2175
2182
|
cx: M.x,
|
|
2176
2183
|
cy: M.y,
|
|
2177
2184
|
r: ce ? 5 : 3.5,
|
|
@@ -2180,11 +2187,11 @@ function Ul({
|
|
|
2180
2187
|
style: O ? { cursor: "pointer" } : void 0,
|
|
2181
2188
|
opacity: le ? 0.45 : 1
|
|
2182
2189
|
},
|
|
2183
|
-
`${
|
|
2190
|
+
`${Y}-${b}`
|
|
2184
2191
|
);
|
|
2185
2192
|
}),
|
|
2186
2193
|
(h || u) && ke.map((M, b) => {
|
|
2187
|
-
const oe = u ? u({ row: M.row, value: M.value, seriesKey:
|
|
2194
|
+
const oe = u ? u({ row: M.row, value: M.value, seriesKey: Y, index: b }) : h ? F ? F(M.value) : String(M.value) : null;
|
|
2188
2195
|
if (oe == null) return null;
|
|
2189
2196
|
const ce = 10, le = d === "top" ? M.y - ce : M.y + ce + 4;
|
|
2190
2197
|
return /* @__PURE__ */ s(
|
|
@@ -2197,10 +2204,10 @@ function Ul({
|
|
|
2197
2204
|
dominantBaseline: d === "top" ? "auto" : "middle",
|
|
2198
2205
|
children: oe
|
|
2199
2206
|
},
|
|
2200
|
-
`label-${
|
|
2207
|
+
`label-${Y}-${b}`
|
|
2201
2208
|
);
|
|
2202
2209
|
})
|
|
2203
|
-
] },
|
|
2210
|
+
] }, Y);
|
|
2204
2211
|
}),
|
|
2205
2212
|
A !== null && /* @__PURE__ */ s(
|
|
2206
2213
|
"line",
|
|
@@ -2208,7 +2215,7 @@ function Ul({
|
|
|
2208
2215
|
className: k.cursorLine,
|
|
2209
2216
|
x1: X(ne[A]),
|
|
2210
2217
|
x2: X(ne[A]),
|
|
2211
|
-
y1:
|
|
2218
|
+
y1: y,
|
|
2212
2219
|
y2: v
|
|
2213
2220
|
}
|
|
2214
2221
|
),
|
|
@@ -2217,19 +2224,19 @@ function Ul({
|
|
|
2217
2224
|
{
|
|
2218
2225
|
className: k.interactionLayer,
|
|
2219
2226
|
x: E,
|
|
2220
|
-
y
|
|
2227
|
+
y,
|
|
2221
2228
|
width: P,
|
|
2222
2229
|
height: Q,
|
|
2223
|
-
onMouseMove: (
|
|
2224
|
-
const ge =
|
|
2230
|
+
onMouseMove: (Y) => {
|
|
2231
|
+
const ge = Y.currentTarget.getBoundingClientRect(), ke = Y.clientX - ge.left + E, M = X.step(), b = Math.max(
|
|
2225
2232
|
0,
|
|
2226
2233
|
Math.min(e.length - 1, Math.round((ke - E - M / 2) / M))
|
|
2227
2234
|
);
|
|
2228
2235
|
I(b);
|
|
2229
2236
|
},
|
|
2230
2237
|
onMouseLeave: () => I(null),
|
|
2231
|
-
onClick: p ? (
|
|
2232
|
-
const ge =
|
|
2238
|
+
onClick: p ? (Y) => {
|
|
2239
|
+
const ge = Y.currentTarget.getBoundingClientRect(), ke = Y.clientX - ge.left + E, M = X.step(), b = Math.max(
|
|
2233
2240
|
0,
|
|
2234
2241
|
Math.min(e.length - 1, Math.round((ke - E - M / 2) / M))
|
|
2235
2242
|
), oe = $[0], ce = e[b][oe], le = typeof ce == "number" ? ce : 0;
|
|
@@ -2278,12 +2285,12 @@ function Bt(e, t, n) {
|
|
|
2278
2285
|
const o = e.map((l, a) => ({ x: l.x, y: t[a] })).reverse(), i = Tt(o, n).replace(/^M /, "L ");
|
|
2279
2286
|
return `${r} ${i} Z`;
|
|
2280
2287
|
}
|
|
2281
|
-
function
|
|
2288
|
+
function Yc(e, t = 8) {
|
|
2282
2289
|
if (e.length <= t) return e;
|
|
2283
2290
|
const n = Math.ceil(e.length / t);
|
|
2284
2291
|
return e.filter((r, o) => o % n === 0);
|
|
2285
2292
|
}
|
|
2286
|
-
function
|
|
2293
|
+
function Yl({
|
|
2287
2294
|
data: e,
|
|
2288
2295
|
xKey: t,
|
|
2289
2296
|
config: n,
|
|
@@ -2298,8 +2305,8 @@ function _l({
|
|
|
2298
2305
|
showYAxis: u = !0,
|
|
2299
2306
|
showLegend: m = !0,
|
|
2300
2307
|
showTooltip: p = !0,
|
|
2301
|
-
yTickCount:
|
|
2302
|
-
yFormat:
|
|
2308
|
+
yTickCount: N = 5,
|
|
2309
|
+
yFormat: g,
|
|
2303
2310
|
xFormat: C,
|
|
2304
2311
|
valueFormat: w,
|
|
2305
2312
|
renderTooltip: J,
|
|
@@ -2316,41 +2323,41 @@ function _l({
|
|
|
2316
2323
|
...D
|
|
2317
2324
|
}),
|
|
2318
2325
|
[D, u]
|
|
2319
|
-
), q = we(() => Object.keys(n), [n]),
|
|
2326
|
+
), q = we(() => Object.keys(n), [n]), L = i && q.length > 0, te = L && l === "expand", [$, Z] = Ce(null), I = ie(null), j = Ge();
|
|
2320
2327
|
if (e.length === 0)
|
|
2321
2328
|
return /* @__PURE__ */ s("div", { ref: I, className: f(k.root, B?.root, V), style: U, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: F }) }) });
|
|
2322
2329
|
const A = we(() => {
|
|
2323
|
-
const E = q.map(() => []),
|
|
2324
|
-
for (let
|
|
2330
|
+
const E = q.map(() => []), T = q.map(() => []);
|
|
2331
|
+
for (let y = 0; y < e.length; y++) {
|
|
2325
2332
|
let v = 0;
|
|
2326
2333
|
if (te) {
|
|
2327
2334
|
for (const Q of q) {
|
|
2328
|
-
const ne = e[
|
|
2335
|
+
const ne = e[y][Q];
|
|
2329
2336
|
typeof ne == "number" && ne > 0 && (v += ne);
|
|
2330
2337
|
}
|
|
2331
2338
|
v === 0 && (v = 1);
|
|
2332
2339
|
}
|
|
2333
2340
|
let P = 0;
|
|
2334
2341
|
for (let Q = 0; Q < q.length; Q++) {
|
|
2335
|
-
const ne = q[Q], X = e[
|
|
2336
|
-
if (
|
|
2342
|
+
const ne = q[Q], X = e[y][ne], ue = typeof X == "number" ? X : 0;
|
|
2343
|
+
if (L) {
|
|
2337
2344
|
const x = te ? ue / v : ue;
|
|
2338
|
-
|
|
2345
|
+
T[Q][y] = P, P += x, E[Q][y] = P;
|
|
2339
2346
|
} else
|
|
2340
|
-
|
|
2347
|
+
T[Q][y] = 0, E[Q][y] = ue;
|
|
2341
2348
|
}
|
|
2342
2349
|
}
|
|
2343
|
-
return { tops: E, bottoms:
|
|
2344
|
-
}, [e, q,
|
|
2350
|
+
return { tops: E, bottoms: T };
|
|
2351
|
+
}, [e, q, L, te]), { tops: z, bottoms: ae } = A, [de, G] = we(() => {
|
|
2345
2352
|
if (te) return [0, 1];
|
|
2346
|
-
let E = 0,
|
|
2347
|
-
for (const
|
|
2348
|
-
for (const v of
|
|
2349
|
-
v < E && (E = v), v >
|
|
2350
|
-
for (const
|
|
2351
|
-
for (const v of
|
|
2353
|
+
let E = 0, T = 0;
|
|
2354
|
+
for (const y of z)
|
|
2355
|
+
for (const v of y)
|
|
2356
|
+
v < E && (E = v), v > T && (T = v);
|
|
2357
|
+
for (const y of ae)
|
|
2358
|
+
for (const v of y)
|
|
2352
2359
|
v < E && (E = v);
|
|
2353
|
-
return [Math.min(0, E),
|
|
2360
|
+
return [Math.min(0, E), T];
|
|
2354
2361
|
}, [z, ae, te]);
|
|
2355
2362
|
return /* @__PURE__ */ s(
|
|
2356
2363
|
Ze,
|
|
@@ -2366,7 +2373,7 @@ function _l({
|
|
|
2366
2373
|
nt,
|
|
2367
2374
|
{
|
|
2368
2375
|
row: e[$],
|
|
2369
|
-
x:
|
|
2376
|
+
x: _c(e, t, ee, $, I),
|
|
2370
2377
|
y: 16,
|
|
2371
2378
|
containerWidth: I.current?.getBoundingClientRect().width ?? 0,
|
|
2372
2379
|
config: n,
|
|
@@ -2376,52 +2383,52 @@ function _l({
|
|
|
2376
2383
|
classes: B
|
|
2377
2384
|
}
|
|
2378
2385
|
) : null,
|
|
2379
|
-
children: ({ width: E, height:
|
|
2380
|
-
const
|
|
2381
|
-
return /* @__PURE__ */
|
|
2382
|
-
a && /* @__PURE__ */ s("defs", { children: q.map((
|
|
2386
|
+
children: ({ width: E, height: T }) => {
|
|
2387
|
+
const y = ee.left, v = E - ee.right, P = ee.top, Q = T - ee.bottom, ne = Math.max(0, v - y), X = Math.max(0, Q - P), ue = e.map((Y) => String(Y[t])), x = je(ue, [y, v], 0), K = te ? [0, 0.25, 0.5, 0.75, 1] : Ke(de, G, N), R = tt([K[0], K[K.length - 1]], [Q, P]), re = R(0), fe = K.map((Y) => ({ value: Y, y: R(Y) })), Be = Yc(ue).map((Y) => ({ label: Y, x: x(Y) })), Ae = te ? (Y) => `${Math.round(Y * 100)}%` : g;
|
|
2388
|
+
return /* @__PURE__ */ _(_e, { children: [
|
|
2389
|
+
a && /* @__PURE__ */ s("defs", { children: q.map((Y) => /* @__PURE__ */ _(
|
|
2383
2390
|
"linearGradient",
|
|
2384
2391
|
{
|
|
2385
|
-
id: `${j}-${
|
|
2392
|
+
id: `${j}-${Y}`,
|
|
2386
2393
|
x1: "0",
|
|
2387
2394
|
y1: "0",
|
|
2388
2395
|
x2: "0",
|
|
2389
2396
|
y2: "1",
|
|
2390
2397
|
children: [
|
|
2391
|
-
/* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[
|
|
2392
|
-
/* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[
|
|
2398
|
+
/* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[Y].color, stopOpacity: 0.6 }),
|
|
2399
|
+
/* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[Y].color, stopOpacity: 0.05 })
|
|
2393
2400
|
]
|
|
2394
2401
|
},
|
|
2395
|
-
|
|
2402
|
+
Y
|
|
2396
2403
|
)) }),
|
|
2397
2404
|
u ? /* @__PURE__ */ s(
|
|
2398
2405
|
on,
|
|
2399
2406
|
{
|
|
2400
2407
|
ticks: fe,
|
|
2401
|
-
x:
|
|
2408
|
+
x: y,
|
|
2402
2409
|
plotWidth: ne,
|
|
2403
2410
|
format: Ae,
|
|
2404
2411
|
showGrid: h,
|
|
2405
2412
|
classes: B
|
|
2406
2413
|
}
|
|
2407
|
-
) : h && /* @__PURE__ */ s("g", { className: f(k.axis, B?.axis), children: fe.map(({ value:
|
|
2414
|
+
) : h && /* @__PURE__ */ s("g", { className: f(k.axis, B?.axis), children: fe.map(({ value: Y, y: ge }) => /* @__PURE__ */ s(
|
|
2408
2415
|
"line",
|
|
2409
2416
|
{
|
|
2410
2417
|
className: f(k.gridLine, B?.grid),
|
|
2411
|
-
x1:
|
|
2418
|
+
x1: y,
|
|
2412
2419
|
x2: v,
|
|
2413
2420
|
y1: ge,
|
|
2414
2421
|
y2: ge
|
|
2415
2422
|
},
|
|
2416
|
-
`grid-${
|
|
2423
|
+
`grid-${Y}`
|
|
2417
2424
|
)) }),
|
|
2418
2425
|
d && /* @__PURE__ */ s(cn, { ticks: Be, y: Q, format: C, classes: B }),
|
|
2419
|
-
q.map((
|
|
2420
|
-
const ke = n[
|
|
2426
|
+
q.map((Y, ge) => {
|
|
2427
|
+
const ke = n[Y], M = e.map((le, O) => ({
|
|
2421
2428
|
x: x(ue[O]),
|
|
2422
2429
|
y: R(z[ge][O])
|
|
2423
|
-
})), b = a ? `url(#${j}-${
|
|
2424
|
-
return /* @__PURE__ */
|
|
2430
|
+
})), b = a ? `url(#${j}-${Y})` : ke.color, oe = a ? 1 : 0.18, ce = L ? Bt(M, ae[ge].map((le) => R(le)), c) : Bt(M, re, c);
|
|
2431
|
+
return /* @__PURE__ */ _("g", { className: f(k.series, B?.series), children: [
|
|
2425
2432
|
/* @__PURE__ */ s(
|
|
2426
2433
|
"path",
|
|
2427
2434
|
{
|
|
@@ -2432,7 +2439,7 @@ function _l({
|
|
|
2432
2439
|
}
|
|
2433
2440
|
),
|
|
2434
2441
|
/* @__PURE__ */ s("path", { className: k.linePath, d: Tt(M, c), stroke: ke.color }),
|
|
2435
|
-
!
|
|
2442
|
+
!L && M.map((le, O) => /* @__PURE__ */ s(
|
|
2436
2443
|
"circle",
|
|
2437
2444
|
{
|
|
2438
2445
|
className: f(k.point, B?.point),
|
|
@@ -2441,9 +2448,9 @@ function _l({
|
|
|
2441
2448
|
r: $ === O ? 5 : 3,
|
|
2442
2449
|
fill: ke.color
|
|
2443
2450
|
},
|
|
2444
|
-
`${
|
|
2451
|
+
`${Y}-${O}`
|
|
2445
2452
|
))
|
|
2446
|
-
] },
|
|
2453
|
+
] }, Y);
|
|
2447
2454
|
}),
|
|
2448
2455
|
$ !== null && /* @__PURE__ */ s(
|
|
2449
2456
|
"line",
|
|
@@ -2459,12 +2466,12 @@ function _l({
|
|
|
2459
2466
|
"rect",
|
|
2460
2467
|
{
|
|
2461
2468
|
className: k.interactionLayer,
|
|
2462
|
-
x:
|
|
2469
|
+
x: y,
|
|
2463
2470
|
y: P,
|
|
2464
2471
|
width: ne,
|
|
2465
2472
|
height: X,
|
|
2466
|
-
onMouseMove: (
|
|
2467
|
-
const ge =
|
|
2473
|
+
onMouseMove: (Y) => {
|
|
2474
|
+
const ge = Y.currentTarget.getBoundingClientRect(), ke = Y.clientX - ge.left + y, M = x.step(), b = Math.max(0, Math.min(e.length - 1, Math.round((ke - y - M / 2) / M)));
|
|
2468
2475
|
Z(b);
|
|
2469
2476
|
},
|
|
2470
2477
|
onMouseLeave: () => Z(null)
|
|
@@ -2475,7 +2482,7 @@ function _l({
|
|
|
2475
2482
|
}
|
|
2476
2483
|
);
|
|
2477
2484
|
}
|
|
2478
|
-
function
|
|
2485
|
+
function _c(e, t, n, r, o) {
|
|
2479
2486
|
const c = o.current;
|
|
2480
2487
|
if (!c) return 0;
|
|
2481
2488
|
const i = c.getBoundingClientRect().width, l = e.map((h) => String(h[t]));
|
|
@@ -2493,7 +2500,7 @@ function qc(e, t = 8) {
|
|
|
2493
2500
|
const n = Math.ceil(e.length / t);
|
|
2494
2501
|
return e.filter((r, o) => o % n === 0);
|
|
2495
2502
|
}
|
|
2496
|
-
function
|
|
2503
|
+
function _l({
|
|
2497
2504
|
data: e,
|
|
2498
2505
|
xKey: t,
|
|
2499
2506
|
config: n,
|
|
@@ -2508,8 +2515,8 @@ function Yl({
|
|
|
2508
2515
|
showLegend: u = !0,
|
|
2509
2516
|
showTooltip: m = !0,
|
|
2510
2517
|
showValues: p = !1,
|
|
2511
|
-
valuePosition:
|
|
2512
|
-
renderLabel:
|
|
2518
|
+
valuePosition: N = "outside",
|
|
2519
|
+
renderLabel: g,
|
|
2513
2520
|
colorBy: C = "series",
|
|
2514
2521
|
colors: w = jc,
|
|
2515
2522
|
negativeColor: J,
|
|
@@ -2520,22 +2527,22 @@ function Yl({
|
|
|
2520
2527
|
xFormat: B,
|
|
2521
2528
|
valueFormat: ee,
|
|
2522
2529
|
renderTooltip: q,
|
|
2523
|
-
margin:
|
|
2530
|
+
margin: L,
|
|
2524
2531
|
emptyMessage: te = "No data",
|
|
2525
2532
|
className: $,
|
|
2526
2533
|
style: Z,
|
|
2527
2534
|
classes: I
|
|
2528
2535
|
}) {
|
|
2529
|
-
const j = r === "horizontal", A = { ...j ? Vc : zc, ...
|
|
2536
|
+
const j = r === "horizontal", A = { ...j ? Vc : zc, ...L }, z = we(() => Object.keys(n), [n]), ae = o && z.length > 1, [de, G] = Ce(null), E = ie(null);
|
|
2530
2537
|
if (e.length === 0)
|
|
2531
2538
|
return /* @__PURE__ */ s("div", { ref: E, className: f(k.root, I?.root, $), style: Z, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: te }) }) });
|
|
2532
|
-
const
|
|
2539
|
+
const T = e.map((x) => String(x[t])), y = D ?? de, v = we(() => {
|
|
2533
2540
|
if (ae) {
|
|
2534
2541
|
let re = 0, fe = 0;
|
|
2535
2542
|
for (const be of e) {
|
|
2536
2543
|
let Be = 0, Ae = 0;
|
|
2537
|
-
for (const
|
|
2538
|
-
const ge = be[
|
|
2544
|
+
for (const Y of z) {
|
|
2545
|
+
const ge = be[Y];
|
|
2539
2546
|
typeof ge == "number" && (ge >= 0 ? Be += ge : Ae += ge);
|
|
2540
2547
|
}
|
|
2541
2548
|
Be > re && (re = Be), Ae < fe && (fe = Ae);
|
|
@@ -2550,19 +2557,19 @@ function Yl({
|
|
|
2550
2557
|
}
|
|
2551
2558
|
const [K, R] = kt(x);
|
|
2552
2559
|
return [Math.min(0, K), Math.max(0, R)];
|
|
2553
|
-
}, [e, z, ae]), P = Ke(v[0], v[1], V), Q = P[0], ne = P[P.length - 1], X = (x, K) => C === "index" ? w[K % w.length] : n[x]?.color ?? w[0], ue = m &&
|
|
2560
|
+
}, [e, z, ae]), P = Ke(v[0], v[1], V), Q = P[0], ne = P[P.length - 1], X = (x, K) => C === "index" ? w[K % w.length] : n[x]?.color ?? w[0], ue = m && y !== null && e[y] ? /* @__PURE__ */ s(
|
|
2554
2561
|
nt,
|
|
2555
2562
|
{
|
|
2556
|
-
row: e[
|
|
2557
|
-
x: Zc(e, t, A,
|
|
2558
|
-
y: j ? Kc(e, t, A,
|
|
2563
|
+
row: e[y],
|
|
2564
|
+
x: Zc(e, t, A, y, E, j, l),
|
|
2565
|
+
y: j ? Kc(e, t, A, y, E, l) : 16,
|
|
2559
2566
|
containerWidth: E.current?.getBoundingClientRect().width ?? 0,
|
|
2560
2567
|
config: n,
|
|
2561
|
-
render: q ? () => q(e[
|
|
2568
|
+
render: q ? () => q(e[y]) : void 0,
|
|
2562
2569
|
valueFormat: ee,
|
|
2563
2570
|
titleKey: t,
|
|
2564
2571
|
resolveColor: (x) => {
|
|
2565
|
-
const K = e[
|
|
2572
|
+
const K = e[y][x], R = X(x, y);
|
|
2566
2573
|
return typeof K != "number" ? R : J !== void 0 && K < 0 ? J : R;
|
|
2567
2574
|
},
|
|
2568
2575
|
classes: I
|
|
@@ -2580,13 +2587,13 @@ function Yl({
|
|
|
2580
2587
|
legend: u ? /* @__PURE__ */ s(xt, { config: n, classes: I }) : void 0,
|
|
2581
2588
|
overlay: ue,
|
|
2582
2589
|
children: ({ width: x, height: K }) => {
|
|
2583
|
-
const R = A.left, re = x - A.right, fe = A.top, be = K - A.bottom, Be = Math.max(0, re - R), Ae = Math.max(0, be - fe), ge = je(
|
|
2584
|
-
value:
|
|
2585
|
-
pos: b(
|
|
2586
|
-
})), pe = qc(
|
|
2587
|
-
return /* @__PURE__ */
|
|
2590
|
+
const R = A.left, re = x - A.right, fe = A.top, be = K - A.bottom, Be = Math.max(0, re - R), Ae = Math.max(0, be - fe), ge = je(T, j ? [fe, be] : [R, re], l), ke = ge.bandWidth(), b = tt([Q, ne], j ? [R, re] : [be, fe]), oe = b(0), ce = ae ? 1 : Math.max(1, z.length), le = ke / ce, O = le * (1 - a), Me = P.map((S) => ({
|
|
2591
|
+
value: S,
|
|
2592
|
+
pos: b(S)
|
|
2593
|
+
})), pe = qc(T);
|
|
2594
|
+
return /* @__PURE__ */ _(_e, { children: [
|
|
2588
2595
|
d && /* @__PURE__ */ s("g", { className: f(k.axis, I?.axis), children: Me.map(
|
|
2589
|
-
({ value:
|
|
2596
|
+
({ value: S, pos: W }) => j ? /* @__PURE__ */ s(
|
|
2590
2597
|
"line",
|
|
2591
2598
|
{
|
|
2592
2599
|
className: f(k.gridLine, I?.grid),
|
|
@@ -2595,7 +2602,7 @@ function Yl({
|
|
|
2595
2602
|
y1: fe,
|
|
2596
2603
|
y2: be
|
|
2597
2604
|
},
|
|
2598
|
-
`g-${
|
|
2605
|
+
`g-${S}`
|
|
2599
2606
|
) : /* @__PURE__ */ s(
|
|
2600
2607
|
"line",
|
|
2601
2608
|
{
|
|
@@ -2605,11 +2612,11 @@ function Yl({
|
|
|
2605
2612
|
y1: W,
|
|
2606
2613
|
y2: W
|
|
2607
2614
|
},
|
|
2608
|
-
`g-${
|
|
2615
|
+
`g-${S}`
|
|
2609
2616
|
)
|
|
2610
2617
|
) }),
|
|
2611
|
-
/* @__PURE__ */ s("g", { className: f(k.axis, I?.axis), children: Me.map(({ value:
|
|
2612
|
-
const se = U ? U(
|
|
2618
|
+
/* @__PURE__ */ s("g", { className: f(k.axis, I?.axis), children: Me.map(({ value: S, pos: W }) => {
|
|
2619
|
+
const se = U ? U(S) : String(S);
|
|
2613
2620
|
return j ? /* @__PURE__ */ s(
|
|
2614
2621
|
"text",
|
|
2615
2622
|
{
|
|
@@ -2619,7 +2626,7 @@ function Yl({
|
|
|
2619
2626
|
textAnchor: "middle",
|
|
2620
2627
|
children: se
|
|
2621
2628
|
},
|
|
2622
|
-
`vt-${
|
|
2629
|
+
`vt-${S}`
|
|
2623
2630
|
) : /* @__PURE__ */ s(
|
|
2624
2631
|
"text",
|
|
2625
2632
|
{
|
|
@@ -2630,11 +2637,11 @@ function Yl({
|
|
|
2630
2637
|
dominantBaseline: "middle",
|
|
2631
2638
|
children: se
|
|
2632
2639
|
},
|
|
2633
|
-
`vt-${
|
|
2640
|
+
`vt-${S}`
|
|
2634
2641
|
);
|
|
2635
2642
|
}) }),
|
|
2636
|
-
/* @__PURE__ */ s("g", { className: f(k.axis, I?.axis), children: pe.map((
|
|
2637
|
-
const W = ge(
|
|
2643
|
+
/* @__PURE__ */ s("g", { className: f(k.axis, I?.axis), children: pe.map((S) => {
|
|
2644
|
+
const W = ge(S), se = B ? B(S) : S;
|
|
2638
2645
|
return j ? /* @__PURE__ */ s(
|
|
2639
2646
|
"text",
|
|
2640
2647
|
{
|
|
@@ -2645,7 +2652,7 @@ function Yl({
|
|
|
2645
2652
|
dominantBaseline: "middle",
|
|
2646
2653
|
children: se
|
|
2647
2654
|
},
|
|
2648
|
-
`c-${
|
|
2655
|
+
`c-${S}`
|
|
2649
2656
|
) : /* @__PURE__ */ s(
|
|
2650
2657
|
"text",
|
|
2651
2658
|
{
|
|
@@ -2655,14 +2662,14 @@ function Yl({
|
|
|
2655
2662
|
textAnchor: "middle",
|
|
2656
2663
|
children: se
|
|
2657
2664
|
},
|
|
2658
|
-
`c-${
|
|
2665
|
+
`c-${S}`
|
|
2659
2666
|
);
|
|
2660
2667
|
}) }),
|
|
2661
|
-
e.map((
|
|
2662
|
-
const xe = ge(
|
|
2668
|
+
e.map((S, W) => {
|
|
2669
|
+
const xe = ge(T[W]) - ke / 2;
|
|
2663
2670
|
let ye = 0, We = 0;
|
|
2664
2671
|
return /* @__PURE__ */ s("g", { className: f(k.series, I?.series), children: z.map((Ee, De) => {
|
|
2665
|
-
const he =
|
|
2672
|
+
const he = S[Ee];
|
|
2666
2673
|
if (typeof he != "number") return null;
|
|
2667
2674
|
const Ie = he, Xe = X(Ee, W), rt = J !== void 0 && Ie < 0 ? J : Xe, ot = D !== void 0 ? D === W : de === W, it = D !== void 0 && !ot;
|
|
2668
2675
|
let ze, He;
|
|
@@ -2676,16 +2683,16 @@ function Yl({
|
|
|
2676
2683
|
const Qe = Math.min(Ve, ct), wt = Math.max(Ve, ct);
|
|
2677
2684
|
lt = xe + Dt, at = O, st = Qe, dt = wt - Qe;
|
|
2678
2685
|
}
|
|
2679
|
-
const Mt =
|
|
2686
|
+
const Mt = g ? g({ row: S, value: Ie, seriesKey: Ee, index: W }) : p ? ee ? ee(Ie) : String(Ie) : null, Ue = Gc({
|
|
2680
2687
|
isHorizontal: j,
|
|
2681
|
-
valuePosition:
|
|
2688
|
+
valuePosition: N,
|
|
2682
2689
|
x: lt,
|
|
2683
2690
|
y: st,
|
|
2684
2691
|
rectW: at,
|
|
2685
2692
|
rectH: dt,
|
|
2686
2693
|
value: Ie
|
|
2687
2694
|
});
|
|
2688
|
-
return /* @__PURE__ */
|
|
2695
|
+
return /* @__PURE__ */ _("g", { children: [
|
|
2689
2696
|
/* @__PURE__ */ s(
|
|
2690
2697
|
"rect",
|
|
2691
2698
|
{
|
|
@@ -2702,7 +2709,7 @@ function Yl({
|
|
|
2702
2709
|
ry: h,
|
|
2703
2710
|
fill: rt,
|
|
2704
2711
|
opacity: it ? 0.35 : 1,
|
|
2705
|
-
onClick: F ? () => F({ row:
|
|
2712
|
+
onClick: F ? () => F({ row: S, value: Ie, seriesKey: Ee, index: W }) : void 0,
|
|
2706
2713
|
style: F ? { cursor: "pointer" } : void 0
|
|
2707
2714
|
}
|
|
2708
2715
|
),
|
|
@@ -2711,7 +2718,7 @@ function Yl({
|
|
|
2711
2718
|
{
|
|
2712
2719
|
className: f(
|
|
2713
2720
|
k.axisLabel,
|
|
2714
|
-
(
|
|
2721
|
+
(N === "inside" || N === "inside-start") && k.barLabelInside
|
|
2715
2722
|
),
|
|
2716
2723
|
x: Ue.x,
|
|
2717
2724
|
y: Ue.y,
|
|
@@ -2744,8 +2751,8 @@ function Yl({
|
|
|
2744
2751
|
y: fe,
|
|
2745
2752
|
width: Be,
|
|
2746
2753
|
height: Ae,
|
|
2747
|
-
onMouseMove: (
|
|
2748
|
-
const W =
|
|
2754
|
+
onMouseMove: (S) => {
|
|
2755
|
+
const W = S.currentTarget.getBoundingClientRect(), se = S.clientX - W.left + R, xe = S.clientY - W.top + fe, ye = ge.step(), We = j ? xe - fe : se - R, Ee = Math.max(
|
|
2749
2756
|
0,
|
|
2750
2757
|
Math.min(e.length - 1, Math.round((We - ye / 2) / ye))
|
|
2751
2758
|
);
|
|
@@ -2853,12 +2860,12 @@ function Jc(e, t, n, r, o, c) {
|
|
|
2853
2860
|
].join(" ");
|
|
2854
2861
|
const i = (o - 90) * Math.PI / 180, l = (c - 90) * Math.PI / 180, a = c - o > 180 ? 1 : 0, h = e + n * Math.cos(i), d = t + n * Math.sin(i), u = e + n * Math.cos(l), m = t + n * Math.sin(l);
|
|
2855
2862
|
if (r > 0) {
|
|
2856
|
-
const p = e + r * Math.cos(l),
|
|
2863
|
+
const p = e + r * Math.cos(l), N = t + r * Math.sin(l), g = e + r * Math.cos(i), C = t + r * Math.sin(i);
|
|
2857
2864
|
return [
|
|
2858
2865
|
`M ${h} ${d}`,
|
|
2859
2866
|
`A ${n} ${n} 0 ${a} 1 ${u} ${m}`,
|
|
2860
|
-
`L ${p} ${
|
|
2861
|
-
`A ${r} ${r} 0 ${a} 0 ${
|
|
2867
|
+
`L ${p} ${N}`,
|
|
2868
|
+
`A ${r} ${r} 0 ${a} 0 ${g} ${C}`,
|
|
2862
2869
|
"Z"
|
|
2863
2870
|
].join(" ");
|
|
2864
2871
|
}
|
|
@@ -2888,8 +2895,8 @@ function jl({
|
|
|
2888
2895
|
padAngle: u = 0,
|
|
2889
2896
|
showLabels: m = !1,
|
|
2890
2897
|
valuePosition: p = "outside",
|
|
2891
|
-
showLabelLines:
|
|
2892
|
-
renderLabel:
|
|
2898
|
+
showLabelLines: N = !0,
|
|
2899
|
+
renderLabel: g,
|
|
2893
2900
|
centerLabel: C,
|
|
2894
2901
|
activeIndex: w,
|
|
2895
2902
|
onSliceClick: J,
|
|
@@ -2900,7 +2907,7 @@ function jl({
|
|
|
2900
2907
|
emptyMessage: B = "No data",
|
|
2901
2908
|
className: ee,
|
|
2902
2909
|
style: q,
|
|
2903
|
-
classes:
|
|
2910
|
+
classes: L
|
|
2904
2911
|
}) {
|
|
2905
2912
|
const [te, $] = Ce(null), Z = ie(null), I = w ?? te, j = (G) => {
|
|
2906
2913
|
if (r) {
|
|
@@ -2911,24 +2918,24 @@ function jl({
|
|
|
2911
2918
|
}, A = we(() => {
|
|
2912
2919
|
let G = 0;
|
|
2913
2920
|
for (const E of e) {
|
|
2914
|
-
const
|
|
2915
|
-
typeof
|
|
2921
|
+
const T = E[t];
|
|
2922
|
+
typeof T == "number" && T > 0 && (G += T);
|
|
2916
2923
|
}
|
|
2917
2924
|
return G;
|
|
2918
2925
|
}, [e, t]);
|
|
2919
2926
|
if (e.length === 0 || A === 0)
|
|
2920
|
-
return /* @__PURE__ */ s("div", { ref: Z, className: f(k.root,
|
|
2927
|
+
return /* @__PURE__ */ s("div", { ref: Z, className: f(k.root, L?.root, ee), style: q, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: B }) }) });
|
|
2921
2928
|
const z = we(() => {
|
|
2922
2929
|
const G = [];
|
|
2923
2930
|
let E = 0;
|
|
2924
|
-
for (let
|
|
2925
|
-
const
|
|
2931
|
+
for (let T = 0; T < e.length; T++) {
|
|
2932
|
+
const y = e[T], v = y[t], P = typeof v == "number" && v > 0 ? v : 0;
|
|
2926
2933
|
if (P === 0) continue;
|
|
2927
2934
|
const Q = P / A, ne = Q * 360;
|
|
2928
|
-
G.push({ index:
|
|
2935
|
+
G.push({ index: T, row: y, value: P, start: E, end: E + ne, fraction: Q }), E += ne;
|
|
2929
2936
|
}
|
|
2930
2937
|
return G;
|
|
2931
|
-
}, [e, t, A]), ae = D ? /* @__PURE__ */ s("div", { className: f(k.legend,
|
|
2938
|
+
}, [e, t, A]), ae = D ? /* @__PURE__ */ s("div", { className: f(k.legend, L?.legend), role: "list", children: z.map((G) => /* @__PURE__ */ _("div", { className: f(k.legendItem, L?.legendItem), role: "listitem", children: [
|
|
2932
2939
|
/* @__PURE__ */ s(
|
|
2933
2940
|
"span",
|
|
2934
2941
|
{
|
|
@@ -2955,7 +2962,7 @@ function jl({
|
|
|
2955
2962
|
height: i,
|
|
2956
2963
|
className: ee,
|
|
2957
2964
|
style: q,
|
|
2958
|
-
classes:
|
|
2965
|
+
classes: L,
|
|
2959
2966
|
legend: ae,
|
|
2960
2967
|
overlay: F && I !== null && e[I] ? /* @__PURE__ */ s(
|
|
2961
2968
|
nt,
|
|
@@ -2968,14 +2975,14 @@ function jl({
|
|
|
2968
2975
|
render: U ? () => U(e[I]) : void 0,
|
|
2969
2976
|
valueFormat: V,
|
|
2970
2977
|
titleKey: void 0,
|
|
2971
|
-
classes:
|
|
2978
|
+
classes: L
|
|
2972
2979
|
}
|
|
2973
2980
|
) : null,
|
|
2974
2981
|
children: ({ width: G, height: E }) => {
|
|
2975
|
-
const
|
|
2976
|
-
return /* @__PURE__ */
|
|
2982
|
+
const T = G / 2, y = E / 2, v = Math.min(G, E) / 2 - 4, P = Et(a, v), Q = Math.min(P - 1, Et(l, v)), ne = Math.max(4, P * 0.06);
|
|
2983
|
+
return /* @__PURE__ */ _(_e, { children: [
|
|
2977
2984
|
/* @__PURE__ */ s("g", { children: z.map((X) => {
|
|
2978
|
-
const ue = u / 2, x = Math.min(X.end, X.start + ue), K = Math.max(X.start, X.end - ue), R = j(X.index), re = I === X.index, fe = w !== void 0 && !re, be = re && w !== void 0 ? P + ne : P, Be = Jc(
|
|
2985
|
+
const ue = u / 2, x = Math.min(X.end, X.start + ue), K = Math.max(X.start, X.end - ue), R = j(X.index), re = I === X.index, fe = w !== void 0 && !re, be = re && w !== void 0 ? P + ne : P, Be = Jc(T, y, be, Q, x, K), Ae = J ? () => J({ row: X.row, value: X.value, index: X.index }) : void 0;
|
|
2979
2986
|
return /* @__PURE__ */ s(
|
|
2980
2987
|
"path",
|
|
2981
2988
|
{
|
|
@@ -2992,16 +2999,16 @@ function jl({
|
|
|
2992
2999
|
X.index
|
|
2993
3000
|
);
|
|
2994
3001
|
}) }),
|
|
2995
|
-
(m ||
|
|
2996
|
-
const ue =
|
|
3002
|
+
(m || g) && z.map((X) => {
|
|
3003
|
+
const ue = g ? g({ row: X.row, value: X.value, fraction: X.fraction, index: X.index }) : m ? `${String(X.row[n])} ${V ? V(X.value) : Math.round(X.fraction * 100) + "%"}` : null;
|
|
2997
3004
|
if (ue == null) return null;
|
|
2998
|
-
const x = p === "inside", K = Math.max(16, P * 0.12), R = x ? (P + Q) / 2 : P + K, re = Pt(
|
|
3005
|
+
const x = p === "inside", K = Math.max(16, P * 0.12), R = x ? (P + Q) / 2 : P + K, re = Pt(T, y, R, X.start, X.end), fe = x ? "middle" : re.x < T - 1 ? "end" : re.x > T + 1 ? "start" : "middle";
|
|
2999
3006
|
let be = null;
|
|
3000
|
-
if (!x &&
|
|
3001
|
-
const Be = Pt(
|
|
3002
|
-
be = { x1: Be.x, y1: Be.y, x2: re.x +
|
|
3007
|
+
if (!x && N) {
|
|
3008
|
+
const Be = Pt(T, y, P, X.start, X.end), Ae = 4, Y = fe === "end" ? Ae : fe === "start" ? -Ae : 0;
|
|
3009
|
+
be = { x1: Be.x, y1: Be.y, x2: re.x + Y, y2: re.y };
|
|
3003
3010
|
}
|
|
3004
|
-
return /* @__PURE__ */
|
|
3011
|
+
return /* @__PURE__ */ _("g", { children: [
|
|
3005
3012
|
be && /* @__PURE__ */ s(
|
|
3006
3013
|
"line",
|
|
3007
3014
|
{
|
|
@@ -3033,8 +3040,8 @@ function jl({
|
|
|
3033
3040
|
C !== void 0 && /* @__PURE__ */ s(
|
|
3034
3041
|
"foreignObject",
|
|
3035
3042
|
{
|
|
3036
|
-
x:
|
|
3037
|
-
y:
|
|
3043
|
+
x: T - Q,
|
|
3044
|
+
y: y - Q,
|
|
3038
3045
|
width: Math.max(0, Q * 2),
|
|
3039
3046
|
height: Math.max(0, Q * 2),
|
|
3040
3047
|
style: { pointerEvents: "none" },
|
|
@@ -3087,8 +3094,8 @@ function zl({
|
|
|
3087
3094
|
showPoints: u = !0,
|
|
3088
3095
|
fillOpacity: m = 0.4,
|
|
3089
3096
|
strokeWidth: p = 2,
|
|
3090
|
-
renderAxisLabel:
|
|
3091
|
-
axisFormat:
|
|
3097
|
+
renderAxisLabel: N,
|
|
3098
|
+
axisFormat: g,
|
|
3092
3099
|
valueFormat: C,
|
|
3093
3100
|
renderTooltip: w,
|
|
3094
3101
|
showLegend: J = !0,
|
|
@@ -3098,9 +3105,9 @@ function zl({
|
|
|
3098
3105
|
style: U,
|
|
3099
3106
|
classes: B
|
|
3100
3107
|
}) {
|
|
3101
|
-
const [ee, q] = Ce(null),
|
|
3108
|
+
const [ee, q] = Ce(null), L = ie(null), te = we(() => Object.keys(n), [n]);
|
|
3102
3109
|
if (e.length === 0)
|
|
3103
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
3110
|
+
return /* @__PURE__ */ s("div", { ref: L, className: f(k.root, B?.root, V), style: U, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: F }) }) });
|
|
3104
3111
|
const $ = we(
|
|
3105
3112
|
() => e.map((A, z) => z / e.length * 360),
|
|
3106
3113
|
[e]
|
|
@@ -3117,7 +3124,7 @@ function zl({
|
|
|
3117
3124
|
return /* @__PURE__ */ s(
|
|
3118
3125
|
Ze,
|
|
3119
3126
|
{
|
|
3120
|
-
ref:
|
|
3127
|
+
ref: L,
|
|
3121
3128
|
aspectRatio: r,
|
|
3122
3129
|
height: o,
|
|
3123
3130
|
className: V,
|
|
@@ -3128,9 +3135,9 @@ function zl({
|
|
|
3128
3135
|
nt,
|
|
3129
3136
|
{
|
|
3130
3137
|
row: e[ee],
|
|
3131
|
-
x: (
|
|
3138
|
+
x: (L.current?.getBoundingClientRect().width ?? 0) / 2,
|
|
3132
3139
|
y: 16,
|
|
3133
|
-
containerWidth:
|
|
3140
|
+
containerWidth: L.current?.getBoundingClientRect().width ?? 0,
|
|
3134
3141
|
config: n,
|
|
3135
3142
|
render: w ? () => w(e[ee]) : void 0,
|
|
3136
3143
|
valueFormat: C,
|
|
@@ -3139,10 +3146,10 @@ function zl({
|
|
|
3139
3146
|
}
|
|
3140
3147
|
) : null,
|
|
3141
3148
|
children: ({ width: A, height: z }) => {
|
|
3142
|
-
const ae = a ? 32 : 8, de = A / 2, G = z / 2, E = Math.max(0, Math.min(A, z) / 2 - ae),
|
|
3143
|
-
return /* @__PURE__ */
|
|
3144
|
-
i && I.map((
|
|
3145
|
-
const v =
|
|
3149
|
+
const ae = a ? 32 : 8, de = A / 2, G = z / 2, E = Math.max(0, Math.min(A, z) / 2 - ae), T = (y) => Math.max(0, y) / j * E;
|
|
3150
|
+
return /* @__PURE__ */ _(_e, { children: [
|
|
3151
|
+
i && I.map((y) => {
|
|
3152
|
+
const v = T(y);
|
|
3146
3153
|
return c === "circle" ? /* @__PURE__ */ s(
|
|
3147
3154
|
"circle",
|
|
3148
3155
|
{
|
|
@@ -3152,7 +3159,7 @@ function zl({
|
|
|
3152
3159
|
r: v,
|
|
3153
3160
|
fill: "none"
|
|
3154
3161
|
},
|
|
3155
|
-
`ring-${
|
|
3162
|
+
`ring-${y}`
|
|
3156
3163
|
) : /* @__PURE__ */ s(
|
|
3157
3164
|
"polygon",
|
|
3158
3165
|
{
|
|
@@ -3160,11 +3167,11 @@ function zl({
|
|
|
3160
3167
|
points: el(de, G, v, $),
|
|
3161
3168
|
fill: "none"
|
|
3162
3169
|
},
|
|
3163
|
-
`ring-${
|
|
3170
|
+
`ring-${y}`
|
|
3164
3171
|
);
|
|
3165
3172
|
}),
|
|
3166
|
-
l && $.map((
|
|
3167
|
-
const P = pt(de, G, E,
|
|
3173
|
+
l && $.map((y, v) => {
|
|
3174
|
+
const P = pt(de, G, E, y);
|
|
3168
3175
|
return /* @__PURE__ */ s(
|
|
3169
3176
|
"line",
|
|
3170
3177
|
{
|
|
@@ -3177,8 +3184,8 @@ function zl({
|
|
|
3177
3184
|
`spoke-${v}`
|
|
3178
3185
|
);
|
|
3179
3186
|
}),
|
|
3180
|
-
h && I.map((
|
|
3181
|
-
const v =
|
|
3187
|
+
h && I.map((y) => {
|
|
3188
|
+
const v = T(y);
|
|
3182
3189
|
return /* @__PURE__ */ s(
|
|
3183
3190
|
"text",
|
|
3184
3191
|
{
|
|
@@ -3187,23 +3194,23 @@ function zl({
|
|
|
3187
3194
|
y: G - v,
|
|
3188
3195
|
textAnchor: "start",
|
|
3189
3196
|
dominantBaseline: "middle",
|
|
3190
|
-
children: C ? C(
|
|
3197
|
+
children: C ? C(y) : y
|
|
3191
3198
|
},
|
|
3192
|
-
`raxis-${
|
|
3199
|
+
`raxis-${y}`
|
|
3193
3200
|
);
|
|
3194
3201
|
}),
|
|
3195
|
-
a && e.map((
|
|
3202
|
+
a && e.map((y, v) => {
|
|
3196
3203
|
const P = $[v], Q = pt(de, G, E + 14, P), ne = Q.x < de - 1 ? "end" : Q.x > de + 1 ? "start" : "middle";
|
|
3197
|
-
if (
|
|
3198
|
-
return /* @__PURE__ */ s("g", { children:
|
|
3199
|
-
row:
|
|
3204
|
+
if (N)
|
|
3205
|
+
return /* @__PURE__ */ s("g", { children: N({
|
|
3206
|
+
row: y,
|
|
3200
3207
|
index: v,
|
|
3201
3208
|
angle: P,
|
|
3202
3209
|
x: Q.x,
|
|
3203
3210
|
y: Q.y,
|
|
3204
3211
|
textAnchor: ne
|
|
3205
3212
|
}) }, `label-${v}`);
|
|
3206
|
-
const X = String(
|
|
3213
|
+
const X = String(y[t]), ue = g ? g(X) : X;
|
|
3207
3214
|
return /* @__PURE__ */ s(
|
|
3208
3215
|
"text",
|
|
3209
3216
|
{
|
|
@@ -3217,12 +3224,12 @@ function zl({
|
|
|
3217
3224
|
`label-${v}`
|
|
3218
3225
|
);
|
|
3219
3226
|
}),
|
|
3220
|
-
te.map((
|
|
3221
|
-
const v = n[
|
|
3222
|
-
const ue = ne[
|
|
3227
|
+
te.map((y) => {
|
|
3228
|
+
const v = n[y], P = e.map((ne, X) => {
|
|
3229
|
+
const ue = ne[y], K = T(typeof ue == "number" ? ue : 0);
|
|
3223
3230
|
return pt(de, G, K, $[X]);
|
|
3224
3231
|
}), Q = P.map((ne) => `${ne.x},${ne.y}`).join(" ");
|
|
3225
|
-
return /* @__PURE__ */
|
|
3232
|
+
return /* @__PURE__ */ _("g", { className: f(k.series, B?.series), children: [
|
|
3226
3233
|
/* @__PURE__ */ s(
|
|
3227
3234
|
"polygon",
|
|
3228
3235
|
{
|
|
@@ -3244,9 +3251,9 @@ function zl({
|
|
|
3244
3251
|
r: ee === X ? 5 : 3.5,
|
|
3245
3252
|
fill: v.color
|
|
3246
3253
|
},
|
|
3247
|
-
`${
|
|
3254
|
+
`${y}-${X}`
|
|
3248
3255
|
))
|
|
3249
|
-
] },
|
|
3256
|
+
] }, y);
|
|
3250
3257
|
}),
|
|
3251
3258
|
/* @__PURE__ */ s(
|
|
3252
3259
|
"rect",
|
|
@@ -3256,8 +3263,8 @@ function zl({
|
|
|
3256
3263
|
y: 0,
|
|
3257
3264
|
width: A,
|
|
3258
3265
|
height: z,
|
|
3259
|
-
onMouseMove: (
|
|
3260
|
-
const v =
|
|
3266
|
+
onMouseMove: (y) => {
|
|
3267
|
+
const v = y.currentTarget.getBoundingClientRect(), P = y.clientX - v.left - de, Q = y.clientY - v.top - G;
|
|
3261
3268
|
if (P === 0 && Q === 0) return;
|
|
3262
3269
|
let ne = Math.atan2(Q, P) * 180 / Math.PI + 90;
|
|
3263
3270
|
ne < 0 && (ne += 360), ne >= 360 && (ne -= 360);
|
|
@@ -3416,8 +3423,8 @@ function Zl({
|
|
|
3416
3423
|
lineColor: u = "var(--crk-chart-1)",
|
|
3417
3424
|
timezone: m,
|
|
3418
3425
|
defaultTimezone: p = "local",
|
|
3419
|
-
onTimezoneChange:
|
|
3420
|
-
showConfigPanel:
|
|
3426
|
+
onTimezoneChange: N,
|
|
3427
|
+
showConfigPanel: g = !0,
|
|
3421
3428
|
priceBadgeColorByDirection: C = !1,
|
|
3422
3429
|
priceBadgeShowTime: w = !1,
|
|
3423
3430
|
priceBadgeTimeFormat: J,
|
|
@@ -3426,14 +3433,14 @@ function Zl({
|
|
|
3426
3433
|
className: V,
|
|
3427
3434
|
style: U
|
|
3428
3435
|
}) {
|
|
3429
|
-
const B = ie(null), ee = ie(null), q = ie([]),
|
|
3436
|
+
const B = ie(null), ee = ie(null), q = ie([]), L = ie({ from: 0, to: 0 }), te = ie(null), $ = ie(null), Z = ie(!1), I = ie(null), j = ie(null), A = ie(1), z = ie({ width: 0, height: 0 }), ae = ie(() => {
|
|
3430
3437
|
}), de = ie(D), G = ie(F);
|
|
3431
3438
|
de.current = D, G.current = F;
|
|
3432
|
-
const [E,
|
|
3439
|
+
const [E, T] = Ce(null), [y, v] = Ce(p), P = m ?? y, Q = me(
|
|
3433
3440
|
(M) => {
|
|
3434
|
-
m === void 0 && v(M),
|
|
3441
|
+
m === void 0 && v(M), N?.(M);
|
|
3435
3442
|
},
|
|
3436
|
-
[m,
|
|
3443
|
+
[m, N]
|
|
3437
3444
|
), ne = we(
|
|
3438
3445
|
() => ({ up: h, down: d, line: u }),
|
|
3439
3446
|
[h, d, u]
|
|
@@ -3451,35 +3458,35 @@ function Zl({
|
|
|
3451
3458
|
bl(b, oe, ce, O), b.restore();
|
|
3452
3459
|
return;
|
|
3453
3460
|
}
|
|
3454
|
-
const
|
|
3455
|
-
|
|
3461
|
+
const S = Nt(oe, ce, ue, x), { from: W, to: se } = pl(L.current, pe.length);
|
|
3462
|
+
L.current = { from: W, to: se };
|
|
3456
3463
|
const xe = pe.slice(Math.max(0, Math.floor(W)), Math.min(pe.length, Math.ceil(se) + 1)), ye = (he) => {
|
|
3457
|
-
const Ie = se - W + 1, Xe =
|
|
3458
|
-
return
|
|
3459
|
-
}, We =
|
|
3460
|
-
Lt(b,
|
|
3464
|
+
const Ie = se - W + 1, Xe = S.plotWidth / Ie;
|
|
3465
|
+
return S.plotLeft + (he - W + 0.5) * Xe;
|
|
3466
|
+
}, We = S.plotWidth / (se - W + 1), Ee = X.map((he) => gl(he, pe)).filter((he) => he !== null).map((he) => ({ ...he, color: Me(he.color) })), De = sn(S.main, xe, Ee, W, se);
|
|
3467
|
+
Lt(b, S.plotLeft, S.plotRight, De, O), xl(b, S, De, i, O), b.save(), b.beginPath(), b.rect(S.plotLeft, De.paneTop, S.plotWidth, De.paneHeight), b.clip();
|
|
3461
3468
|
for (let he = 0; he < X.length; he++) {
|
|
3462
3469
|
const Ie = X[he], Xe = Ee[he];
|
|
3463
3470
|
Xe && $l(b, Xe, Ie, pe, W, se, ye, De);
|
|
3464
3471
|
}
|
|
3465
|
-
if (o === "candle" ? kl(b, pe, W, se, ye, We, De, { up: O.up, down: O.down }) : o === "bar" ? Ml(b, pe, W, se, ye, We, De, { up: O.up, down: O.down }) : wl(b, pe, W, se, ye, De, O.line, o === "area"), b.restore(),
|
|
3466
|
-
const he = yl(
|
|
3467
|
-
Lt(b,
|
|
3472
|
+
if (o === "candle" ? kl(b, pe, W, se, ye, We, De, { up: O.up, down: O.down }) : o === "bar" ? Ml(b, pe, W, se, ye, We, De, { up: O.up, down: O.down }) : wl(b, pe, W, se, ye, De, O.line, o === "area"), b.restore(), S.volume) {
|
|
3473
|
+
const he = yl(S.volume, pe, W, se);
|
|
3474
|
+
Lt(b, S.plotLeft, S.plotRight, he, O, !0), Ft(b, S, S.volume, "Volume", O), b.save(), b.beginPath(), b.rect(S.plotLeft, he.paneTop, S.plotWidth, he.paneHeight), b.clip(), Nl(b, pe, W, se, ye, We, he, { up: O.up, down: O.down }), b.restore();
|
|
3468
3475
|
}
|
|
3469
|
-
if (
|
|
3476
|
+
if (S.rsi) {
|
|
3470
3477
|
const he = X.find((Ve) => Ve.type === "rsi"), Ie = he && he.type === "rsi" ? he.period ?? 14 : 14, Xe = he && he.type === "rsi" ? he.overbought ?? 70 : 70, rt = he && he.type === "rsi" ? he.oversold ?? 30 : 30, ot = (he && he.type === "rsi" ? he.color : void 0) ?? "var(--crk-chart-5)", it = Me(ot), ze = ol(pe, Ie), He = {
|
|
3471
|
-
paneTop:
|
|
3472
|
-
paneBottom:
|
|
3473
|
-
paneHeight:
|
|
3478
|
+
paneTop: S.rsi.top,
|
|
3479
|
+
paneBottom: S.rsi.bottom,
|
|
3480
|
+
paneHeight: S.rsi.height,
|
|
3474
3481
|
priceMin: 0,
|
|
3475
3482
|
priceMax: 100,
|
|
3476
3483
|
ticks: [rt, 50, Xe]
|
|
3477
3484
|
};
|
|
3478
|
-
Lt(b,
|
|
3485
|
+
Lt(b, S.plotLeft, S.plotRight, He, O, !0), Ft(b, S, S.rsi, `RSI ${Ie}`, O), b.save(), b.beginPath(), b.rect(S.plotLeft, He.paneTop, S.plotWidth, He.paneHeight), b.clip(), et(b, ze, W, se, ye, He, it), b.restore(), Ll(b, S, He, Xe, rt, O);
|
|
3479
3486
|
}
|
|
3480
|
-
Tl(b,
|
|
3487
|
+
Tl(b, S, pe, W, se, n, O), te.current && Sl(
|
|
3481
3488
|
b,
|
|
3482
|
-
|
|
3489
|
+
S,
|
|
3483
3490
|
te.current,
|
|
3484
3491
|
pe,
|
|
3485
3492
|
W,
|
|
@@ -3507,7 +3514,7 @@ function Zl({
|
|
|
3507
3514
|
});
|
|
3508
3515
|
}
|
|
3509
3516
|
}, []);
|
|
3510
|
-
|
|
3517
|
+
_t(() => {
|
|
3511
3518
|
const M = B.current;
|
|
3512
3519
|
if (!M) return;
|
|
3513
3520
|
const b = () => {
|
|
@@ -3521,36 +3528,36 @@ function Zl({
|
|
|
3521
3528
|
return oe.observe(M), () => oe.disconnect();
|
|
3522
3529
|
}, [R]), Re(() => {
|
|
3523
3530
|
let M = !1;
|
|
3524
|
-
const b = Math.floor(Date.now() / 1e3), oe =
|
|
3525
|
-
q.current = [],
|
|
3531
|
+
const b = Math.floor(Date.now() / 1e3), oe = Yt(n), ce = r === "MAX", le = r !== void 0 ? ln(r) : oe * l, O = r !== void 0 ? Math.max(10, Math.ceil(le / oe)) : l, Me = ce ? 0 : b - le;
|
|
3532
|
+
q.current = [], L.current = { from: 0, to: 0 }, R(), e.getBars({ symbol: t, resolution: n, from: Me, to: b, countBack: O }).then((S) => {
|
|
3526
3533
|
if (M) return;
|
|
3527
|
-
const W = [...
|
|
3534
|
+
const W = [...S].sort((xe, ye) => xe.time - ye.time);
|
|
3528
3535
|
q.current = W;
|
|
3529
3536
|
const se = W.length - 1;
|
|
3530
3537
|
if (r !== void 0)
|
|
3531
|
-
|
|
3538
|
+
L.current = { from: 0, to: se };
|
|
3532
3539
|
else {
|
|
3533
3540
|
const xe = Math.min(W.length, Math.min(200, l));
|
|
3534
|
-
|
|
3541
|
+
L.current = {
|
|
3535
3542
|
from: Math.max(0, se - xe + 1),
|
|
3536
3543
|
to: se
|
|
3537
3544
|
};
|
|
3538
3545
|
}
|
|
3539
|
-
G.current?.(
|
|
3546
|
+
G.current?.(L.current, W), R();
|
|
3540
3547
|
}).catch(() => {
|
|
3541
3548
|
});
|
|
3542
3549
|
const pe = e.subscribeBars({
|
|
3543
3550
|
symbol: t,
|
|
3544
3551
|
resolution: n,
|
|
3545
|
-
onTick: (
|
|
3552
|
+
onTick: (S) => {
|
|
3546
3553
|
if (M) return;
|
|
3547
3554
|
const W = q.current, se = W[W.length - 1];
|
|
3548
|
-
if (se && se.time ===
|
|
3549
|
-
W[W.length - 1] =
|
|
3550
|
-
else if (!se ||
|
|
3551
|
-
W.push(
|
|
3552
|
-
const xe =
|
|
3553
|
-
xe.to >= W.length - 2 && (
|
|
3555
|
+
if (se && se.time === S.time)
|
|
3556
|
+
W[W.length - 1] = S;
|
|
3557
|
+
else if (!se || S.time > se.time) {
|
|
3558
|
+
W.push(S);
|
|
3559
|
+
const xe = L.current;
|
|
3560
|
+
xe.to >= W.length - 2 && (L.current = { from: xe.from + 1, to: xe.to + 1 });
|
|
3554
3561
|
}
|
|
3555
3562
|
R();
|
|
3556
3563
|
}
|
|
@@ -3560,23 +3567,23 @@ function Zl({
|
|
|
3560
3567
|
};
|
|
3561
3568
|
}, [e, t, n, r, l]);
|
|
3562
3569
|
const re = me((M) => {
|
|
3563
|
-
|
|
3570
|
+
T(M), de.current?.(M);
|
|
3564
3571
|
}, []), fe = me((M) => {
|
|
3565
3572
|
M.currentTarget.setPointerCapture(M.pointerId);
|
|
3566
|
-
const b =
|
|
3573
|
+
const b = L.current;
|
|
3567
3574
|
$.current = { startX: M.clientX, from: b.from, to: b.to };
|
|
3568
3575
|
}, []), be = me(
|
|
3569
3576
|
(M) => {
|
|
3570
3577
|
const b = M.currentTarget.getBoundingClientRect(), oe = M.clientX - b.left, ce = M.clientY - b.top;
|
|
3571
3578
|
if (te.current = { x: oe, y: ce }, $.current) {
|
|
3572
|
-
const { startX: Me, from: pe, to:
|
|
3573
|
-
let Ee = pe + We, De =
|
|
3579
|
+
const { startX: Me, from: pe, to: S } = $.current, { width: W } = z.current, se = Math.max(1, W - Ct), xe = S - pe + 1, ye = se / xe, We = -(M.clientX - Me) / ye;
|
|
3580
|
+
let Ee = pe + We, De = S + We;
|
|
3574
3581
|
const he = q.current.length;
|
|
3575
|
-
Ee < 0 && (ke(), Ee = 0, De = xe - 1), De > he - 1 && (De = he - 1, Ee = De - xe + 1),
|
|
3582
|
+
Ee < 0 && (ke(), Ee = 0, De = xe - 1), De > he - 1 && (De = he - 1, Ee = De - xe + 1), L.current = { from: Ee, to: De }, G.current?.(L.current, q.current);
|
|
3576
3583
|
}
|
|
3577
|
-
const le = Nt(b.width, b.height, ue, x), O =
|
|
3584
|
+
const le = Nt(b.width, b.height, ue, x), O = L.current;
|
|
3578
3585
|
if (oe >= le.plotLeft && oe <= le.plotRight) {
|
|
3579
|
-
const Me = O.to - O.from + 1, pe = le.plotWidth / Me,
|
|
3586
|
+
const Me = O.to - O.from + 1, pe = le.plotWidth / Me, S = Math.round(O.from + (oe - le.plotLeft) / pe - 0.5), W = q.current, se = Math.max(0, Math.min(W.length - 1, S)), xe = W[se] ?? null, ye = Rl(ce, le, W, O.from, O.to);
|
|
3580
3587
|
re({ barIndex: se, bar: xe, priceAtCursor: ye });
|
|
3581
3588
|
} else
|
|
3582
3589
|
re(null);
|
|
@@ -3587,22 +3594,22 @@ function Zl({
|
|
|
3587
3594
|
M.currentTarget.releasePointerCapture(M.pointerId), $.current = null;
|
|
3588
3595
|
}, []), Ae = me(() => {
|
|
3589
3596
|
te.current = null, $.current = null, re(null), R();
|
|
3590
|
-
}, [R, re]),
|
|
3597
|
+
}, [R, re]), Y = me(
|
|
3591
3598
|
(M) => {
|
|
3592
3599
|
M.preventDefault();
|
|
3593
|
-
const b = M.currentTarget.getBoundingClientRect(), oe = M.clientX - b.left, ce = Nt(b.width, b.height, ue, x), le =
|
|
3600
|
+
const b = M.currentTarget.getBoundingClientRect(), oe = M.clientX - b.left, ce = Nt(b.width, b.height, ue, x), le = L.current, O = q.current;
|
|
3594
3601
|
if (O.length === 0) return;
|
|
3595
|
-
const Me = le.to - le.from + 1, pe = M.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot),
|
|
3602
|
+
const Me = le.to - le.from + 1, pe = M.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot), S = Math.max(
|
|
3596
3603
|
ce.plotWidth / al,
|
|
3597
3604
|
Math.min(O.length, ce.plotWidth / sl, Me * pe)
|
|
3598
3605
|
), W = le.from + (oe - ce.plotLeft) / (ce.plotWidth / Me), se = (W - le.from) / Me;
|
|
3599
|
-
let xe = W - se *
|
|
3600
|
-
xe < 0 && (xe = 0, ye =
|
|
3606
|
+
let xe = W - se * S, ye = xe + S - 1;
|
|
3607
|
+
xe < 0 && (xe = 0, ye = S - 1), ye > O.length - 1 && (ye = O.length - 1, xe = ye - S + 1), L.current = { from: xe, to: ye }, G.current?.(L.current, O), R();
|
|
3601
3608
|
},
|
|
3602
3609
|
[ue, x, R]
|
|
3603
3610
|
), ge = me(
|
|
3604
3611
|
(M) => {
|
|
3605
|
-
const b =
|
|
3612
|
+
const b = L.current, oe = b.to - b.from + 1, ce = q.current;
|
|
3606
3613
|
if (ce.length === 0) return;
|
|
3607
3614
|
let le = 0;
|
|
3608
3615
|
if (M.key === "ArrowLeft") le = -Math.max(1, Math.floor(oe * 0.1));
|
|
@@ -3610,7 +3617,7 @@ function Zl({
|
|
|
3610
3617
|
else return;
|
|
3611
3618
|
M.preventDefault();
|
|
3612
3619
|
let O = b.from + le, Me = b.to + le;
|
|
3613
|
-
O < 0 && (O = 0, Me = oe - 1), Me > ce.length - 1 && (Me = ce.length - 1, O = Me - oe + 1),
|
|
3620
|
+
O < 0 && (O = 0, Me = oe - 1), Me > ce.length - 1 && (Me = ce.length - 1, O = Me - oe + 1), L.current = { from: O, to: Me }, G.current?.(L.current, ce), R();
|
|
3614
3621
|
},
|
|
3615
3622
|
[R]
|
|
3616
3623
|
), ke = me(() => {
|
|
@@ -3618,19 +3625,19 @@ function Zl({
|
|
|
3618
3625
|
const M = q.current;
|
|
3619
3626
|
if (M.length === 0) return;
|
|
3620
3627
|
Z.current = !0;
|
|
3621
|
-
const b =
|
|
3628
|
+
const b = Yt(n), oe = M[0].time, ce = oe - b * l, le = oe - b;
|
|
3622
3629
|
e.getBars({ symbol: t, resolution: n, from: ce, to: le, countBack: l }).then((O) => {
|
|
3623
3630
|
if (O.length === 0) {
|
|
3624
3631
|
Z.current = !1;
|
|
3625
3632
|
return;
|
|
3626
3633
|
}
|
|
3627
|
-
const pe = [...O].sort((W, se) => W.time - se.time).filter((W) => W.time < oe),
|
|
3628
|
-
q.current = [...pe, ...M],
|
|
3634
|
+
const pe = [...O].sort((W, se) => W.time - se.time).filter((W) => W.time < oe), S = L.current;
|
|
3635
|
+
q.current = [...pe, ...M], L.current = { from: S.from + pe.length, to: S.to + pe.length }, Z.current = !1, R();
|
|
3629
3636
|
}).catch(() => {
|
|
3630
3637
|
Z.current = !1;
|
|
3631
3638
|
});
|
|
3632
3639
|
}, [e, t, n, l, R]);
|
|
3633
|
-
return /* @__PURE__ */
|
|
3640
|
+
return /* @__PURE__ */ _(
|
|
3634
3641
|
"div",
|
|
3635
3642
|
{
|
|
3636
3643
|
ref: B,
|
|
@@ -3650,11 +3657,11 @@ function Zl({
|
|
|
3650
3657
|
onPointerMove: be,
|
|
3651
3658
|
onPointerUp: Be,
|
|
3652
3659
|
onPointerLeave: Ae,
|
|
3653
|
-
onWheel:
|
|
3660
|
+
onWheel: Y,
|
|
3654
3661
|
style: { cursor: $.current ? "grabbing" : "crosshair", touchAction: "none" }
|
|
3655
3662
|
}
|
|
3656
3663
|
),
|
|
3657
|
-
/* @__PURE__ */
|
|
3664
|
+
/* @__PURE__ */ _(
|
|
3658
3665
|
"div",
|
|
3659
3666
|
{
|
|
3660
3667
|
className: k.tradingHeader,
|
|
@@ -3670,10 +3677,10 @@ function Zl({
|
|
|
3670
3677
|
gap: 8
|
|
3671
3678
|
},
|
|
3672
3679
|
children: [
|
|
3673
|
-
/* @__PURE__ */
|
|
3680
|
+
/* @__PURE__ */ _("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
|
|
3674
3681
|
/* @__PURE__ */ s("strong", { children: t }),
|
|
3675
3682
|
/* @__PURE__ */ s("span", { style: { color: "var(--crk-color-text-muted)" }, children: n }),
|
|
3676
|
-
E?.bar && /* @__PURE__ */
|
|
3683
|
+
E?.bar && /* @__PURE__ */ _("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
|
|
3677
3684
|
"O ",
|
|
3678
3685
|
E.bar.open.toFixed(i),
|
|
3679
3686
|
" · H ",
|
|
@@ -3685,7 +3692,7 @@ function Zl({
|
|
|
3685
3692
|
E.bar.close.toFixed(i)
|
|
3686
3693
|
] })
|
|
3687
3694
|
] }),
|
|
3688
|
-
|
|
3695
|
+
g && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
|
|
3689
3696
|
Zt,
|
|
3690
3697
|
{
|
|
3691
3698
|
position: "bottom",
|
|
@@ -3730,7 +3737,7 @@ function ml({
|
|
|
3730
3737
|
timezone: e,
|
|
3731
3738
|
onTimezoneChange: t
|
|
3732
3739
|
}) {
|
|
3733
|
-
return /* @__PURE__ */
|
|
3740
|
+
return /* @__PURE__ */ _("div", { style: { minWidth: 220, padding: 4 }, children: [
|
|
3734
3741
|
/* @__PURE__ */ s(
|
|
3735
3742
|
"div",
|
|
3736
3743
|
{
|
|
@@ -3742,7 +3749,7 @@ function ml({
|
|
|
3742
3749
|
children: "Settings"
|
|
3743
3750
|
}
|
|
3744
3751
|
),
|
|
3745
|
-
/* @__PURE__ */
|
|
3752
|
+
/* @__PURE__ */ _("label", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "4px" }, children: [
|
|
3746
3753
|
/* @__PURE__ */ s("span", { style: { fontSize: "var(--crk-font-size-xs)", color: "var(--crk-color-text-muted)" }, children: "Timezone" }),
|
|
3747
3754
|
/* @__PURE__ */ s(
|
|
3748
3755
|
Gt,
|
|
@@ -3756,7 +3763,7 @@ function ml({
|
|
|
3756
3763
|
] });
|
|
3757
3764
|
}
|
|
3758
3765
|
function fl() {
|
|
3759
|
-
return /* @__PURE__ */
|
|
3766
|
+
return /* @__PURE__ */ _(
|
|
3760
3767
|
"svg",
|
|
3761
3768
|
{
|
|
3762
3769
|
viewBox: "0 0 24 24",
|
|
@@ -3777,9 +3784,9 @@ function Nt(e, t, n, r) {
|
|
|
3777
3784
|
const c = Math.max(0, e - Ct), i = cl, l = Math.max(i, t - At), a = Math.max(0, c - 0), h = Math.max(0, l - i);
|
|
3778
3785
|
let d = h, u = i;
|
|
3779
3786
|
const m = { top: i, bottom: l, height: h };
|
|
3780
|
-
let p = null,
|
|
3781
|
-
const
|
|
3782
|
-
return d = h * (1 -
|
|
3787
|
+
let p = null, N = null;
|
|
3788
|
+
const g = n ? Ht.rsi : 0, C = r ? Ht.volume : 0;
|
|
3789
|
+
return d = h * (1 - g - C), m.top = u, m.height = d, m.bottom = m.top + d, u = m.bottom, n && (p = { top: u, height: h * g, bottom: u + h * g }, u = p.bottom), r && (N = { top: u, height: h * C, bottom: u + h * C }), { width: e, height: t, plotLeft: 0, plotRight: c, plotTop: i, plotBottom: l, plotWidth: a, plotHeight: h, main: m, rsi: p, volume: N };
|
|
3783
3790
|
}
|
|
3784
3791
|
function pl(e, t) {
|
|
3785
3792
|
if (t === 0) return { from: 0, to: 0 };
|
|
@@ -3815,8 +3822,8 @@ function sn(e, t, n, r, o) {
|
|
|
3815
3822
|
for (const u of n) {
|
|
3816
3823
|
const m = u.kind === "line" ? [u.values] : [u.upper, u.lower];
|
|
3817
3824
|
for (const p of m) {
|
|
3818
|
-
const
|
|
3819
|
-
for (let C =
|
|
3825
|
+
const N = Math.max(0, Math.floor(r)), g = Math.min(p.length - 1, Math.ceil(o));
|
|
3826
|
+
for (let C = N; C <= g; C++) {
|
|
3820
3827
|
const w = p[C];
|
|
3821
3828
|
w != null && (w < c && (c = w), w > i && (i = w));
|
|
3822
3829
|
}
|
|
@@ -3891,11 +3898,11 @@ function xl(e, t, n, r, o) {
|
|
|
3891
3898
|
function kl(e, t, n, r, o, c, i, l) {
|
|
3892
3899
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), d = Math.max(1, c * 0.7);
|
|
3893
3900
|
for (let u = a; u <= h; u++) {
|
|
3894
|
-
const m = t[u], p = o(u),
|
|
3901
|
+
const m = t[u], p = o(u), N = Le(m.open, i), g = Le(m.close, i), C = Le(m.high, i), w = Le(m.low, i), D = m.close >= m.open ? l.up : l.down;
|
|
3895
3902
|
e.strokeStyle = D, e.fillStyle = D, e.beginPath();
|
|
3896
3903
|
const F = Math.round(p) + 0.5;
|
|
3897
3904
|
e.moveTo(F, C), e.lineTo(F, w), e.stroke();
|
|
3898
|
-
const V = Math.min(
|
|
3905
|
+
const V = Math.min(N, g), U = Math.max(1, Math.abs(g - N));
|
|
3899
3906
|
e.fillRect(Math.round(p - d / 2), Math.round(V), Math.round(d), Math.round(U));
|
|
3900
3907
|
}
|
|
3901
3908
|
}
|
|
@@ -3903,8 +3910,8 @@ function Ml(e, t, n, r, o, c, i, l) {
|
|
|
3903
3910
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), d = Math.max(2, Math.min(c * 0.4, 8));
|
|
3904
3911
|
e.lineWidth = Math.max(1, Math.min(2, c * 0.18)), e.lineCap = "butt";
|
|
3905
3912
|
for (let u = a; u <= h; u++) {
|
|
3906
|
-
const m = t[u], p = Math.round(o(u)) + 0.5,
|
|
3907
|
-
e.strokeStyle = J ? l.up : l.down, e.beginPath(), e.moveTo(p,
|
|
3913
|
+
const m = t[u], p = Math.round(o(u)) + 0.5, N = Le(m.high, i), g = Le(m.low, i), C = Le(m.open, i), w = Le(m.close, i), J = m.close >= m.open;
|
|
3914
|
+
e.strokeStyle = J ? l.up : l.down, e.beginPath(), e.moveTo(p, N), e.lineTo(p, g), e.moveTo(p - d, C), e.lineTo(p, C), e.moveTo(p, w), e.lineTo(p + d, w), e.stroke();
|
|
3908
3915
|
}
|
|
3909
3916
|
}
|
|
3910
3917
|
function wl(e, t, n, r, o, c, i, l) {
|
|
@@ -3927,8 +3934,8 @@ function $l(e, t, n, r, o, c, i, l) {
|
|
|
3927
3934
|
for (let u = a; u <= h; u++) {
|
|
3928
3935
|
const m = t.upper[u];
|
|
3929
3936
|
if (m == null) continue;
|
|
3930
|
-
const p = i(u),
|
|
3931
|
-
d ? e.lineTo(p,
|
|
3937
|
+
const p = i(u), N = Le(m, l);
|
|
3938
|
+
d ? e.lineTo(p, N) : (e.moveTo(p, N), d = !0);
|
|
3932
3939
|
}
|
|
3933
3940
|
for (let u = h; u >= a; u--) {
|
|
3934
3941
|
const m = t.lower[u];
|
|
@@ -3956,10 +3963,10 @@ function Nl(e, t, n, r, o, c, i, l) {
|
|
|
3956
3963
|
for (let u = a; u <= h; u++) {
|
|
3957
3964
|
const m = t[u], p = m.volume ?? 0;
|
|
3958
3965
|
if (p === 0) continue;
|
|
3959
|
-
const
|
|
3960
|
-
e.fillStyle =
|
|
3961
|
-
const
|
|
3962
|
-
e.fillRect(Math.round(o(u) - d / 2), Math.round(
|
|
3966
|
+
const N = m.close >= m.open;
|
|
3967
|
+
e.fillStyle = N ? l.up : l.down, e.globalAlpha = 0.55;
|
|
3968
|
+
const g = Le(p, i), C = i.paneBottom - g;
|
|
3969
|
+
e.fillRect(Math.round(o(u) - d / 2), Math.round(g), Math.round(d), Math.round(C));
|
|
3963
3970
|
}
|
|
3964
3971
|
e.globalAlpha = 1;
|
|
3965
3972
|
}
|
|
@@ -3979,13 +3986,13 @@ function Tl(e, t, n, r, o, c, i) {
|
|
|
3979
3986
|
e.fillStyle = i.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
|
|
3980
3987
|
const d = Math.max(0, Math.floor(r)), u = Math.min(n.length - 1, Math.ceil(o)), m = t.plotBottom + At / 2;
|
|
3981
3988
|
for (let p = d; p <= u; p += h) {
|
|
3982
|
-
const
|
|
3983
|
-
e.fillText(Cl(
|
|
3989
|
+
const N = n[p], g = t.plotLeft + (p - r + 0.5) * a;
|
|
3990
|
+
e.fillText(Cl(N.time, c), g, m);
|
|
3984
3991
|
}
|
|
3985
3992
|
}
|
|
3986
|
-
function Sl(e, t, n, r, o, c, i, l, a, h, d, u, m, p,
|
|
3993
|
+
function Sl(e, t, n, r, o, c, i, l, a, h, d, u, m, p, N) {
|
|
3987
3994
|
if (n.x < t.plotLeft || n.x > t.plotRight) return;
|
|
3988
|
-
const
|
|
3995
|
+
const g = c - o + 1, C = t.plotWidth / g, w = o + (n.x - t.plotLeft) / C - 0.5, J = Math.round(w), D = Math.max(0, Math.min(r.length - 1, J)), F = i(D);
|
|
3989
3996
|
if (e.save(), e.strokeStyle = d.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(F + 0.5, t.plotTop), e.lineTo(F + 0.5, t.plotBottom), e.moveTo(t.plotLeft, n.y + 0.5), e.lineTo(t.plotRight, n.y + 0.5), e.stroke(), e.setLineDash([]), n.y >= a.paneTop && n.y <= a.paneBottom) {
|
|
3990
3997
|
const V = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
|
|
3991
3998
|
e.fillStyle = d.text, e.fillRect(t.plotRight, n.y - 9, Ct, 18), e.fillStyle = d.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(V.toFixed(l), t.plotRight + 6, n.y);
|
|
@@ -3993,30 +4000,30 @@ function Sl(e, t, n, r, o, c, i, l, a, h, d, u, m, p, S) {
|
|
|
3993
4000
|
if (r[D]) {
|
|
3994
4001
|
const V = un(r[D].time, h);
|
|
3995
4002
|
e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
|
|
3996
|
-
const ee = e.measureText(V).width + 8 * 2, q = At,
|
|
4003
|
+
const ee = e.measureText(V).width + 8 * 2, q = At, L = Math.max(
|
|
3997
4004
|
t.plotLeft,
|
|
3998
4005
|
Math.min(t.plotRight - ee, F - ee / 2)
|
|
3999
4006
|
), te = t.plotBottom;
|
|
4000
|
-
e.fillStyle = d.text, e.fillRect(
|
|
4007
|
+
e.fillStyle = d.text, e.fillRect(L, te, ee, q), e.fillStyle = d.bg, e.textAlign = "center", e.fillText(V, L + ee / 2, te + q / 2);
|
|
4001
4008
|
}
|
|
4002
4009
|
if (r[D]) {
|
|
4003
4010
|
const V = r[D], U = V.close.toFixed(l);
|
|
4004
4011
|
let B = U;
|
|
4005
4012
|
if (p) {
|
|
4006
|
-
const I = (
|
|
4013
|
+
const I = (N ?? dn)(V.time, u, h);
|
|
4007
4014
|
I && (B = `${U} · ${I}`);
|
|
4008
4015
|
}
|
|
4009
4016
|
e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
|
|
4010
|
-
const
|
|
4017
|
+
const L = e.measureText(B).width + 8 * 2, te = 18, $ = Math.max(
|
|
4011
4018
|
t.plotLeft,
|
|
4012
|
-
Math.min(t.plotRight -
|
|
4019
|
+
Math.min(t.plotRight - L, F - L / 2)
|
|
4013
4020
|
), Z = Math.max(0, t.plotTop - te - 2);
|
|
4014
4021
|
if (m) {
|
|
4015
4022
|
const I = V.close >= V.open;
|
|
4016
|
-
e.fillStyle = I ? d.up : d.down, e.fillRect($, Z,
|
|
4023
|
+
e.fillStyle = I ? d.up : d.down, e.fillRect($, Z, L, te), e.fillStyle = "#ffffff";
|
|
4017
4024
|
} else
|
|
4018
|
-
e.fillStyle = d.text, e.fillRect($, Z,
|
|
4019
|
-
e.textAlign = "center", e.fillText(B, $ +
|
|
4025
|
+
e.fillStyle = d.text, e.fillRect($, Z, L, te), e.fillStyle = d.bg;
|
|
4026
|
+
e.textAlign = "center", e.fillText(B, $ + L / 2, Z + te / 2);
|
|
4020
4027
|
}
|
|
4021
4028
|
e.restore();
|
|
4022
4029
|
}
|
|
@@ -4063,8 +4070,8 @@ function dn(e, t, n) {
|
|
|
4063
4070
|
hourCycle: "h23"
|
|
4064
4071
|
}).formatToParts(r), p = (C) => m.find((w) => w.type === C)?.value ?? "";
|
|
4065
4072
|
c = Number(p("day")), i = Number(p("month")) - 1, l = Number(p("year")), a = Number(p("hour")), h = Number(p("minute"));
|
|
4066
|
-
const
|
|
4067
|
-
d =
|
|
4073
|
+
const N = p("weekday"), g = Ut.indexOf(N);
|
|
4074
|
+
d = g >= 0 ? g : 0;
|
|
4068
4075
|
} catch {
|
|
4069
4076
|
return dn(e, t, "utc");
|
|
4070
4077
|
}
|
|
@@ -4101,7 +4108,7 @@ function Al(e) {
|
|
|
4101
4108
|
function Se(e) {
|
|
4102
4109
|
return e < 10 ? `0${e}` : String(e);
|
|
4103
4110
|
}
|
|
4104
|
-
function
|
|
4111
|
+
function Yt(e) {
|
|
4105
4112
|
if (e === "D") return 86400;
|
|
4106
4113
|
if (e === "W") return 86400 * 7;
|
|
4107
4114
|
if (e === "M") return 86400 * 30;
|
|
@@ -4142,12 +4149,12 @@ const Il = Te(
|
|
|
4142
4149
|
className: h,
|
|
4143
4150
|
style: d
|
|
4144
4151
|
}, u) => {
|
|
4145
|
-
const { line: m, area: p, last:
|
|
4152
|
+
const { line: m, area: p, last: N } = we(() => {
|
|
4146
4153
|
if (e.length === 0) return { line: "", area: "", last: null };
|
|
4147
|
-
const
|
|
4154
|
+
const g = o, C = Math.max(1, t - g * 2), w = Math.max(1, n - g * 2), [J, D] = kt(e), F = tt([0, Math.max(1, e.length - 1)], [g, g + C]), V = tt([J, D], [g + w, g]), U = e.map((q, L) => ({ x: F(L), y: V(q) })), B = Dl(U, c), ee = i ? `${B} L ${U[U.length - 1].x} ${g + w} L ${U[0].x} ${g + w} Z` : "";
|
|
4148
4155
|
return { line: B, area: ee, last: U[U.length - 1] };
|
|
4149
4156
|
}, [e, t, n, o, c, i]);
|
|
4150
|
-
return /* @__PURE__ */
|
|
4157
|
+
return /* @__PURE__ */ _(
|
|
4151
4158
|
"svg",
|
|
4152
4159
|
{
|
|
4153
4160
|
ref: u,
|
|
@@ -4171,7 +4178,7 @@ const Il = Te(
|
|
|
4171
4178
|
strokeLinecap: "round"
|
|
4172
4179
|
}
|
|
4173
4180
|
),
|
|
4174
|
-
l &&
|
|
4181
|
+
l && N && /* @__PURE__ */ s("circle", { cx: N.x, cy: N.y, r: o + 1, fill: r })
|
|
4175
4182
|
]
|
|
4176
4183
|
}
|
|
4177
4184
|
);
|
|
@@ -4179,10 +4186,10 @@ const Il = Te(
|
|
|
4179
4186
|
);
|
|
4180
4187
|
Il.displayName = "Sparkline";
|
|
4181
4188
|
export {
|
|
4182
|
-
|
|
4183
|
-
|
|
4189
|
+
Yl as AreaChart,
|
|
4190
|
+
_l as BarChart,
|
|
4184
4191
|
qt as Button,
|
|
4185
|
-
|
|
4192
|
+
_i as Checkbox,
|
|
4186
4193
|
Gt as Dropdown,
|
|
4187
4194
|
fo as DropdownItem,
|
|
4188
4195
|
Ol as Form,
|
|
@@ -4190,7 +4197,7 @@ export {
|
|
|
4190
4197
|
Xl as FormRow,
|
|
4191
4198
|
ci as Input,
|
|
4192
4199
|
Ul as LineChart,
|
|
4193
|
-
|
|
4200
|
+
_n as Link,
|
|
4194
4201
|
Mr as List,
|
|
4195
4202
|
wr as ListItem,
|
|
4196
4203
|
bt as Modal,
|