@overdoser/react-toolkit 0.0.11 → 0.0.12
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/components/Table/Table.d.ts +13 -1
- package/index.js +1294 -1284
- package/llms.txt +16 -0
- package/manifest.json +2 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef as $e, createElement as an, useState as Le, useCallback as fe, useMemo as ke, useEffect as Ne, useLayoutEffect as jt, useRef as re, useId as Ye, isValidElement as dn, cloneElement as Xt, createContext as _t, useContext as ft, useImperativeHandle as un } from "react";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as z, jsx as s, Fragment as je } from "react/jsx-runtime";
|
|
3
3
|
import { createPortal as pt } from "react-dom";
|
|
4
4
|
import { FormProvider as hn, useFormContext as mn, useController as fn } from "react-hook-form";
|
|
5
5
|
function Ut(e) {
|
|
@@ -11,11 +11,11 @@ function Ut(e) {
|
|
|
11
11
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
12
12
|
return r;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function m() {
|
|
15
15
|
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = Ut(e)) && (r && (r += " "), r += t);
|
|
16
16
|
return r;
|
|
17
17
|
}
|
|
18
|
-
const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY", vn = "crk-secondary-j-3rj", bn = "crk-danger-Hxs5n", xn = "crk-ghost-kQ0A8", kn = "crk-sm-RXFPY",
|
|
18
|
+
const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY", vn = "crk-secondary-j-3rj", bn = "crk-danger-Hxs5n", xn = "crk-ghost-kQ0A8", kn = "crk-sm-RXFPY", Mn = "crk-md-nDnOD", wn = "crk-lg-qD-Qh", $n = "crk-fullWidth-AHpSl", Nn = "crk-iconOnly-FNrSu", Ln = "crk-content-PpYVU", Sn = "crk-shimmer-8iQSU", Rn = "crk-loadingShimmer-BVvFw", Tn = "crk-shimmerSweep-uiZ01", Cn = "crk-dots-U8wss", An = "crk-loadingDots-eKv64", Bn = "crk-dot-Owuk1", In = "crk-dotBounce-FwdcC", Dn = "crk-loadingBorder-9ULFw", En = "crk-borderSpin-EJ2gW", Be = {
|
|
19
19
|
root: pn,
|
|
20
20
|
loading: gn,
|
|
21
21
|
primary: yn,
|
|
@@ -23,8 +23,8 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
|
|
|
23
23
|
danger: bn,
|
|
24
24
|
ghost: xn,
|
|
25
25
|
sm: kn,
|
|
26
|
-
md:
|
|
27
|
-
lg:
|
|
26
|
+
md: Mn,
|
|
27
|
+
lg: wn,
|
|
28
28
|
fullWidth: $n,
|
|
29
29
|
iconOnly: Nn,
|
|
30
30
|
content: Ln,
|
|
@@ -55,11 +55,11 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
|
|
|
55
55
|
style: h,
|
|
56
56
|
children: u,
|
|
57
57
|
...d
|
|
58
|
-
},
|
|
58
|
+
}, f) => /* @__PURE__ */ z(
|
|
59
59
|
"button",
|
|
60
60
|
{
|
|
61
|
-
ref:
|
|
62
|
-
className:
|
|
61
|
+
ref: f,
|
|
62
|
+
className: m(
|
|
63
63
|
Be.root,
|
|
64
64
|
Be[e],
|
|
65
65
|
Be[t],
|
|
@@ -75,12 +75,12 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
|
|
|
75
75
|
"aria-busy": n || void 0,
|
|
76
76
|
...d,
|
|
77
77
|
children: [
|
|
78
|
-
/* @__PURE__ */ s("div", { className:
|
|
79
|
-
/* @__PURE__ */ s("span", { className:
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */ s("span", { className:
|
|
82
|
-
/* @__PURE__ */ s("span", { className:
|
|
83
|
-
/* @__PURE__ */ s("span", { className:
|
|
78
|
+
/* @__PURE__ */ s("div", { className: m(Be.shimmer, l?.shimmer) }),
|
|
79
|
+
/* @__PURE__ */ s("span", { className: m(Be.content, l?.content), children: u }),
|
|
80
|
+
/* @__PURE__ */ z("span", { className: m(Be.dots, l?.dots), "aria-hidden": "true", children: [
|
|
81
|
+
/* @__PURE__ */ s("span", { className: m(Be.dot, l?.dot) }),
|
|
82
|
+
/* @__PURE__ */ s("span", { className: m(Be.dot, l?.dot) }),
|
|
83
|
+
/* @__PURE__ */ s("span", { className: m(Be.dot, l?.dot) })
|
|
84
84
|
] })
|
|
85
85
|
]
|
|
86
86
|
}
|
|
@@ -101,11 +101,11 @@ const Wn = "crk-root-2j4Vp", Hn = "crk-muted-vReNc", On = "crk-danger-ugf9r", Fn
|
|
|
101
101
|
style: r,
|
|
102
102
|
children: o,
|
|
103
103
|
...c
|
|
104
|
-
}, i) => /* @__PURE__ */
|
|
104
|
+
}, i) => /* @__PURE__ */ z(
|
|
105
105
|
"a",
|
|
106
106
|
{
|
|
107
107
|
ref: i,
|
|
108
|
-
className:
|
|
108
|
+
className: m($t.root, $t[e], n),
|
|
109
109
|
style: r,
|
|
110
110
|
...t && {
|
|
111
111
|
target: "_blank",
|
|
@@ -159,7 +159,7 @@ const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", _n = "crk-h2-CV8Oo", Un = "crk
|
|
|
159
159
|
e,
|
|
160
160
|
{
|
|
161
161
|
ref: h,
|
|
162
|
-
className:
|
|
162
|
+
className: m(
|
|
163
163
|
Ue.root,
|
|
164
164
|
Ue[e],
|
|
165
165
|
t && Ue[t],
|
|
@@ -196,7 +196,7 @@ const ur = "crk-root-PVrgx", hr = "crk-unordered-FhCWT", mr = "crk-item-TfW82",
|
|
|
196
196
|
e === "ordered" ? "ol" : "ul",
|
|
197
197
|
{
|
|
198
198
|
ref: i,
|
|
199
|
-
className:
|
|
199
|
+
className: m(
|
|
200
200
|
ut.root,
|
|
201
201
|
ut[e],
|
|
202
202
|
ut[t],
|
|
@@ -214,7 +214,7 @@ const xr = $e(
|
|
|
214
214
|
"li",
|
|
215
215
|
{
|
|
216
216
|
ref: o,
|
|
217
|
-
className:
|
|
217
|
+
className: m(ut.item, e),
|
|
218
218
|
style: t,
|
|
219
219
|
...r,
|
|
220
220
|
children: n
|
|
@@ -222,10 +222,10 @@ const xr = $e(
|
|
|
222
222
|
)
|
|
223
223
|
);
|
|
224
224
|
xr.displayName = "ListItem";
|
|
225
|
-
const kr = "crk-wrapper-zxjMt",
|
|
225
|
+
const kr = "crk-wrapper-zxjMt", Mr = "crk-root-Gf85-", wr = "crk-headerCell-ePPZW", $r = "crk-headerCellSortable-NMybk", Nr = "crk-sortIndicator-WGD2S", Lr = "crk-sortArrow-1-ok4", Sr = "crk-sortArrowActive-yhWrO", Rr = "crk-sortIndex-HGoca", Tr = "crk-row-H0wL1", Cr = "crk-cell-ZfnbG", Ar = "crk-emptyRow-AoPfj", Br = "crk-emptyCell-99-7C", Ir = "crk-striped-6Qckq", Dr = "crk-hoverable-ljU9B", Er = "crk-compact-2-UWr", Pr = "crk-paginator-UlYIY", Wr = "crk-paginatorInfo-BVca4", Hr = "crk-paginatorText-sqWS0", Or = "crk-pageSizeSelect-yhqJQ", Fr = "crk-paginatorNav-MDSui", zr = "crk-pageButton-1PX-g", jr = "crk-pageButtonActive--D7Q7", Xr = "crk-pageEllipsis-en59J", ve = {
|
|
226
226
|
wrapper: kr,
|
|
227
|
-
root:
|
|
228
|
-
headerCell:
|
|
227
|
+
root: Mr,
|
|
228
|
+
headerCell: wr,
|
|
229
229
|
headerCellSortable: $r,
|
|
230
230
|
sortIndicator: Nr,
|
|
231
231
|
sortArrow: Lr,
|
|
@@ -258,31 +258,31 @@ function Ur(e, t = []) {
|
|
|
258
258
|
});
|
|
259
259
|
}, []), c = fe((a) => {
|
|
260
260
|
r((h) => {
|
|
261
|
-
const u = h.findIndex((
|
|
261
|
+
const u = h.findIndex((f) => f.key === a);
|
|
262
262
|
if (u === -1)
|
|
263
263
|
return [...h, { key: a, direction: "asc" }];
|
|
264
264
|
if (h[u].direction === "asc") {
|
|
265
|
-
const
|
|
266
|
-
return
|
|
265
|
+
const f = [...h];
|
|
266
|
+
return f[u] = { key: a, direction: "desc" }, f;
|
|
267
267
|
}
|
|
268
|
-
return h.filter((
|
|
268
|
+
return h.filter((f, y) => y !== u);
|
|
269
269
|
});
|
|
270
270
|
}, []), i = fe(() => {
|
|
271
271
|
r([]);
|
|
272
272
|
}, []);
|
|
273
273
|
return { sortedData: ke(() => n.length === 0 ? e : [...e].sort((a, h) => {
|
|
274
274
|
for (const { key: u, direction: d } of n) {
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
return d === "asc" ?
|
|
275
|
+
const f = _r(a[u], h[u]);
|
|
276
|
+
if (f !== 0)
|
|
277
|
+
return d === "asc" ? f : -f;
|
|
278
278
|
}
|
|
279
279
|
return 0;
|
|
280
280
|
}), [e, n]), sortConfig: n, requestSort: o, requestMultiSort: c, resetSort: i };
|
|
281
281
|
}
|
|
282
282
|
function Yr({ direction: e, sortIndex: t }) {
|
|
283
|
-
return /* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */ s("span", { className:
|
|
285
|
-
/* @__PURE__ */ s("span", { className:
|
|
283
|
+
return /* @__PURE__ */ z("span", { className: ve.sortIndicator, "aria-hidden": "true", children: [
|
|
284
|
+
/* @__PURE__ */ s("span", { className: m(ve.sortArrow, e === "asc" && ve.sortArrowActive), children: "▲" }),
|
|
285
|
+
/* @__PURE__ */ s("span", { className: m(ve.sortArrow, e === "desc" && ve.sortArrowActive), children: "▼" }),
|
|
286
286
|
t !== void 0 && t >= 0 && /* @__PURE__ */ s("span", { className: ve.sortIndex, children: t + 1 })
|
|
287
287
|
] });
|
|
288
288
|
}
|
|
@@ -306,8 +306,8 @@ function Vr({
|
|
|
306
306
|
}
|
|
307
307
|
return u;
|
|
308
308
|
}, [e, i]);
|
|
309
|
-
return /* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
309
|
+
return /* @__PURE__ */ z("nav", { className: m(ve.paginator, c?.paginator), "aria-label": "Table pagination", children: [
|
|
310
|
+
/* @__PURE__ */ z("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,19 +316,19 @@ function Vr({
|
|
|
316
316
|
value: t,
|
|
317
317
|
onChange: (u) => o(1, Number(u.target.value)),
|
|
318
318
|
"aria-label": "Rows per page",
|
|
319
|
-
children: r.map((u) => /* @__PURE__ */
|
|
319
|
+
children: r.map((u) => /* @__PURE__ */ z("option", { value: u, children: [
|
|
320
320
|
u,
|
|
321
321
|
" / page"
|
|
322
322
|
] }, u))
|
|
323
323
|
}
|
|
324
324
|
)
|
|
325
325
|
] }),
|
|
326
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ z("div", { className: ve.paginatorNav, children: [
|
|
327
327
|
/* @__PURE__ */ s(
|
|
328
328
|
"button",
|
|
329
329
|
{
|
|
330
330
|
type: "button",
|
|
331
|
-
className:
|
|
331
|
+
className: m(ve.pageButton, c?.pageButton),
|
|
332
332
|
disabled: e <= 1,
|
|
333
333
|
onClick: () => o(e - 1, t),
|
|
334
334
|
"aria-label": "Previous page",
|
|
@@ -340,7 +340,7 @@ function Vr({
|
|
|
340
340
|
"button",
|
|
341
341
|
{
|
|
342
342
|
type: "button",
|
|
343
|
-
className:
|
|
343
|
+
className: m(ve.pageButton, u === e && ve.pageButtonActive, c?.pageButton),
|
|
344
344
|
onClick: () => o(u, t),
|
|
345
345
|
"aria-label": `Page ${u}`,
|
|
346
346
|
"aria-current": u === e ? "page" : void 0,
|
|
@@ -353,7 +353,7 @@ function Vr({
|
|
|
353
353
|
"button",
|
|
354
354
|
{
|
|
355
355
|
type: "button",
|
|
356
|
-
className:
|
|
356
|
+
className: m(ve.pageButton, c?.pageButton),
|
|
357
357
|
disabled: e >= i,
|
|
358
358
|
onClick: () => o(e + 1, t),
|
|
359
359
|
"aria-label": "Next page",
|
|
@@ -375,116 +375,126 @@ function qr({
|
|
|
375
375
|
className: a,
|
|
376
376
|
style: h,
|
|
377
377
|
rowKey: u,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
rowClassName: d,
|
|
379
|
+
rowStyle: f,
|
|
380
|
+
emptyMessage: y = "No data",
|
|
381
|
+
pagination: L,
|
|
382
|
+
classes: v
|
|
381
383
|
}) {
|
|
382
384
|
const S = r !== void 0, {
|
|
383
|
-
sortedData:
|
|
384
|
-
sortConfig:
|
|
385
|
-
requestSort:
|
|
386
|
-
requestMultiSort:
|
|
387
|
-
} = Ur(e, n),
|
|
388
|
-
if (!
|
|
389
|
-
const
|
|
390
|
-
return
|
|
391
|
-
}, [
|
|
392
|
-
(
|
|
393
|
-
const
|
|
385
|
+
sortedData: N,
|
|
386
|
+
sortConfig: D,
|
|
387
|
+
requestSort: j,
|
|
388
|
+
requestMultiSort: Z
|
|
389
|
+
} = Ur(e, n), U = S ? n ?? [] : D, C = S ? e : N, $ = ke(() => {
|
|
390
|
+
if (!L || S) return C;
|
|
391
|
+
const R = (L.page - 1) * L.pageSize;
|
|
392
|
+
return C.slice(R, R + L.pageSize);
|
|
393
|
+
}, [C, L, S]), oe = L?.totalRows ?? C.length, ce = fe(
|
|
394
|
+
(R, te) => {
|
|
395
|
+
const H = o && (te.ctrlKey || te.metaKey);
|
|
394
396
|
if (S)
|
|
395
|
-
if (
|
|
396
|
-
const
|
|
397
|
-
let
|
|
398
|
-
|
|
399
|
-
(
|
|
400
|
-
) :
|
|
397
|
+
if (H) {
|
|
398
|
+
const O = U.findIndex((F) => F.key === R);
|
|
399
|
+
let A;
|
|
400
|
+
O === -1 ? A = [...U, { key: R, direction: "asc" }] : U[O].direction === "asc" ? A = U.map(
|
|
401
|
+
(F, ne) => ne === O ? { key: R, direction: "desc" } : F
|
|
402
|
+
) : A = U.filter((F, ne) => ne !== O), r(A);
|
|
401
403
|
} else {
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
+
const O = U.find((A) => A.key === R);
|
|
405
|
+
O ? O.direction === "asc" ? r([{ key: R, direction: "desc" }]) : r([]) : r([{ key: R, direction: "asc" }]);
|
|
404
406
|
}
|
|
405
407
|
else
|
|
406
|
-
|
|
408
|
+
H ? Z(R) : j(R);
|
|
407
409
|
},
|
|
408
410
|
[
|
|
409
411
|
S,
|
|
410
412
|
o,
|
|
411
|
-
|
|
413
|
+
U,
|
|
412
414
|
r,
|
|
413
|
-
|
|
414
|
-
|
|
415
|
+
j,
|
|
416
|
+
Z
|
|
415
417
|
]
|
|
416
|
-
),
|
|
417
|
-
if (
|
|
418
|
-
const
|
|
419
|
-
return
|
|
418
|
+
), q = (R) => U.find((H) => H.key === R)?.direction, ae = (R) => {
|
|
419
|
+
if (U.length <= 1) return;
|
|
420
|
+
const te = U.findIndex((H) => H.key === R);
|
|
421
|
+
return te >= 0 ? te : void 0;
|
|
420
422
|
};
|
|
421
|
-
return /* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
+
return /* @__PURE__ */ z("div", { className: m(ve.wrapper, v?.wrapper), children: [
|
|
424
|
+
/* @__PURE__ */ z(
|
|
423
425
|
"table",
|
|
424
426
|
{
|
|
425
|
-
className:
|
|
427
|
+
className: m(
|
|
426
428
|
ve.root,
|
|
427
429
|
c && ve.striped,
|
|
428
430
|
i && ve.hoverable,
|
|
429
431
|
l && ve.compact,
|
|
430
|
-
|
|
432
|
+
v?.root,
|
|
431
433
|
a
|
|
432
434
|
),
|
|
433
435
|
style: h,
|
|
434
436
|
children: [
|
|
435
|
-
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((
|
|
437
|
+
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((R) => /* @__PURE__ */ z(
|
|
436
438
|
"th",
|
|
437
439
|
{
|
|
438
|
-
className:
|
|
440
|
+
className: m(
|
|
439
441
|
ve.headerCell,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
+
R.sortable && ve.headerCellSortable,
|
|
443
|
+
v?.headerCell
|
|
442
444
|
),
|
|
443
445
|
style: {
|
|
444
|
-
width:
|
|
445
|
-
textAlign:
|
|
446
|
+
width: R.width,
|
|
447
|
+
textAlign: R.align
|
|
446
448
|
},
|
|
447
|
-
onClick:
|
|
448
|
-
"aria-sort":
|
|
449
|
+
onClick: R.sortable ? (te) => ce(R.key, te) : void 0,
|
|
450
|
+
"aria-sort": R.sortable ? q(R.key) === "asc" ? "ascending" : q(R.key) === "desc" ? "descending" : "none" : void 0,
|
|
449
451
|
children: [
|
|
450
|
-
|
|
451
|
-
|
|
452
|
+
R.header,
|
|
453
|
+
R.sortable && /* @__PURE__ */ s(
|
|
452
454
|
Yr,
|
|
453
455
|
{
|
|
454
|
-
direction:
|
|
455
|
-
sortIndex:
|
|
456
|
+
direction: q(R.key),
|
|
457
|
+
sortIndex: ae(R.key)
|
|
456
458
|
}
|
|
457
459
|
)
|
|
458
460
|
]
|
|
459
461
|
},
|
|
460
|
-
|
|
462
|
+
R.key
|
|
461
463
|
)) }) }),
|
|
462
|
-
/* @__PURE__ */ s("tbody", { children:
|
|
463
|
-
const
|
|
464
|
-
return /* @__PURE__ */ s(
|
|
465
|
-
"
|
|
464
|
+
/* @__PURE__ */ s("tbody", { children: $.length === 0 ? /* @__PURE__ */ s("tr", { className: ve.emptyRow, children: /* @__PURE__ */ s("td", { className: m(ve.emptyCell, v?.emptyCell), colSpan: t.length, children: y }) }) : $.map((R, te) => {
|
|
465
|
+
const H = u ? String(R[u]) : te, O = typeof d == "function" ? d(R, te) : d, A = typeof f == "function" ? f(R, te) : f;
|
|
466
|
+
return /* @__PURE__ */ s(
|
|
467
|
+
"tr",
|
|
466
468
|
{
|
|
467
|
-
className:
|
|
468
|
-
style:
|
|
469
|
-
children:
|
|
469
|
+
className: m(ve.row, v?.row, O),
|
|
470
|
+
style: A,
|
|
471
|
+
children: t.map((F) => /* @__PURE__ */ s(
|
|
472
|
+
"td",
|
|
473
|
+
{
|
|
474
|
+
className: m(ve.cell, v?.cell),
|
|
475
|
+
style: { textAlign: F.align },
|
|
476
|
+
children: F.render ? F.render(R[F.key], R, te) : R[F.key]
|
|
477
|
+
},
|
|
478
|
+
F.key
|
|
479
|
+
))
|
|
470
480
|
},
|
|
471
|
-
|
|
472
|
-
)
|
|
481
|
+
H
|
|
482
|
+
);
|
|
473
483
|
}) })
|
|
474
484
|
]
|
|
475
485
|
}
|
|
476
486
|
),
|
|
477
|
-
|
|
487
|
+
L && /* @__PURE__ */ s(
|
|
478
488
|
Vr,
|
|
479
489
|
{
|
|
480
|
-
...
|
|
481
|
-
totalRows:
|
|
482
|
-
paginatorClasses: { paginator:
|
|
490
|
+
...L,
|
|
491
|
+
totalRows: oe,
|
|
492
|
+
paginatorClasses: { paginator: v?.paginator, pageButton: v?.pageButton }
|
|
483
493
|
}
|
|
484
494
|
)
|
|
485
495
|
] });
|
|
486
496
|
}
|
|
487
|
-
const El = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trigger-LwPaD", Qr = "crk-triggerOpen-U4pa9", Jr = "crk-triggerLabel-QLITs", eo = "crk-triggerError-3jlu1", to = "crk-placeholder-fWdch", no = "crk-chevron-jmDNe", ro = "crk-menu-fxnKL", oo = "crk-menuOpen-HF-Y1", io = "crk-alignLeft-buCDJ", co = "crk-alignRight-05P9w", lo = "crk-item-f-Rhh", so = "crk-itemDisabled-L-d6i", ao = "crk-itemSelected-Fwmuo",
|
|
497
|
+
const El = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trigger-LwPaD", Qr = "crk-triggerOpen-U4pa9", Jr = "crk-triggerLabel-QLITs", eo = "crk-triggerError-3jlu1", to = "crk-placeholder-fWdch", no = "crk-chevron-jmDNe", ro = "crk-menu-fxnKL", oo = "crk-menuOpen-HF-Y1", io = "crk-alignLeft-buCDJ", co = "crk-alignRight-05P9w", lo = "crk-item-f-Rhh", so = "crk-itemDisabled-L-d6i", ao = "crk-itemSelected-Fwmuo", Me = {
|
|
488
498
|
root: Gr,
|
|
489
499
|
fullWidth: Zr,
|
|
490
500
|
trigger: Kr,
|
|
@@ -546,114 +556,114 @@ const Vt = $e(
|
|
|
546
556
|
placeholder: h = "Select...",
|
|
547
557
|
value: u,
|
|
548
558
|
onChange: d,
|
|
549
|
-
error:
|
|
550
|
-
fullWidth:
|
|
551
|
-
portal:
|
|
552
|
-
classes:
|
|
553
|
-
},
|
|
554
|
-
const [N,
|
|
559
|
+
error: f = !1,
|
|
560
|
+
fullWidth: y = !0,
|
|
561
|
+
portal: L = !0,
|
|
562
|
+
classes: v
|
|
563
|
+
}, S) => {
|
|
564
|
+
const [N, D] = Le(!1), j = re(null), Z = re(null), U = re(null), C = Ye();
|
|
555
565
|
Ne(() => {
|
|
556
|
-
N &&
|
|
566
|
+
N && Z.current && Z.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
|
|
557
567
|
}, [N]);
|
|
558
|
-
const
|
|
559
|
-
|
|
560
|
-
}, [l]),
|
|
561
|
-
|
|
562
|
-
const
|
|
563
|
-
return
|
|
568
|
+
const $ = fe(() => {
|
|
569
|
+
D(!1), l?.(), U.current?.focus();
|
|
570
|
+
}, [l]), oe = fe(() => {
|
|
571
|
+
D((A) => {
|
|
572
|
+
const F = !A;
|
|
573
|
+
return F ? i?.() : l?.(), F;
|
|
564
574
|
});
|
|
565
|
-
}, [i, l]),
|
|
566
|
-
(
|
|
567
|
-
d?.(
|
|
575
|
+
}, [i, l]), ce = fe(
|
|
576
|
+
(A) => {
|
|
577
|
+
d?.(A), $();
|
|
568
578
|
},
|
|
569
|
-
[d,
|
|
579
|
+
[d, $]
|
|
570
580
|
);
|
|
571
581
|
Ne(() => {
|
|
572
582
|
if (!N) return;
|
|
573
|
-
const
|
|
574
|
-
const
|
|
575
|
-
|
|
583
|
+
const A = (F) => {
|
|
584
|
+
const ne = F.target;
|
|
585
|
+
j.current?.contains(ne) || Z.current?.contains(ne) || $();
|
|
576
586
|
};
|
|
577
|
-
return document.addEventListener("mousedown",
|
|
578
|
-
}, [N,
|
|
587
|
+
return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
|
|
588
|
+
}, [N, $]), Rt(
|
|
579
589
|
{
|
|
580
|
-
Escape: () =>
|
|
590
|
+
Escape: () => $()
|
|
581
591
|
},
|
|
582
592
|
N
|
|
583
593
|
);
|
|
584
|
-
const
|
|
594
|
+
const q = Tt(U, N && L), ae = a?.find((A) => A.value === u)?.label, R = a ? ae || h : e, te = a && !ae, H = a ? a.map((A) => /* @__PURE__ */ s(
|
|
585
595
|
"button",
|
|
586
596
|
{
|
|
587
597
|
type: "button",
|
|
588
598
|
role: "menuitem",
|
|
589
|
-
className:
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
599
|
+
className: m(
|
|
600
|
+
Me.item,
|
|
601
|
+
A.disabled && Me.itemDisabled,
|
|
602
|
+
A.value === u && Me.itemSelected,
|
|
603
|
+
v?.item
|
|
594
604
|
),
|
|
595
|
-
disabled:
|
|
596
|
-
onClick: () =>
|
|
597
|
-
children:
|
|
605
|
+
disabled: A.disabled,
|
|
606
|
+
onClick: () => ce(A.value),
|
|
607
|
+
children: A.label
|
|
598
608
|
},
|
|
599
|
-
|
|
600
|
-
)) : t,
|
|
609
|
+
A.value
|
|
610
|
+
)) : t, O = (A) => /* @__PURE__ */ s(
|
|
601
611
|
"div",
|
|
602
612
|
{
|
|
603
|
-
ref:
|
|
604
|
-
id:
|
|
605
|
-
className:
|
|
606
|
-
|
|
607
|
-
N &&
|
|
608
|
-
n === "left" ?
|
|
609
|
-
!
|
|
610
|
-
|
|
613
|
+
ref: Z,
|
|
614
|
+
id: C,
|
|
615
|
+
className: m(
|
|
616
|
+
Me.menu,
|
|
617
|
+
N && Me.menuOpen,
|
|
618
|
+
n === "left" ? Me.alignLeft : Me.alignRight,
|
|
619
|
+
!L && y && Me.fullWidth,
|
|
620
|
+
v?.menu
|
|
611
621
|
),
|
|
612
|
-
style:
|
|
622
|
+
style: A,
|
|
613
623
|
role: "menu",
|
|
614
|
-
children:
|
|
624
|
+
children: H
|
|
615
625
|
}
|
|
616
626
|
);
|
|
617
|
-
return /* @__PURE__ */
|
|
627
|
+
return /* @__PURE__ */ z(
|
|
618
628
|
"div",
|
|
619
629
|
{
|
|
620
|
-
ref:
|
|
621
|
-
className:
|
|
630
|
+
ref: S,
|
|
631
|
+
className: m(Me.root, y && Me.fullWidth, v?.root, r),
|
|
622
632
|
style: o,
|
|
623
633
|
children: [
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
634
|
+
/* @__PURE__ */ z("div", { ref: j, style: y ? { width: "100%" } : void 0, children: [
|
|
635
|
+
/* @__PURE__ */ z(
|
|
626
636
|
"button",
|
|
627
637
|
{
|
|
628
|
-
ref:
|
|
638
|
+
ref: U,
|
|
629
639
|
id: c,
|
|
630
640
|
type: "button",
|
|
631
|
-
className:
|
|
632
|
-
|
|
633
|
-
N &&
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
641
|
+
className: m(
|
|
642
|
+
Me.trigger,
|
|
643
|
+
N && Me.triggerOpen,
|
|
644
|
+
f && Me.triggerError,
|
|
645
|
+
y && Me.fullWidth,
|
|
646
|
+
v?.trigger
|
|
637
647
|
),
|
|
638
|
-
onClick:
|
|
648
|
+
onClick: oe,
|
|
639
649
|
"aria-expanded": N,
|
|
640
650
|
"aria-haspopup": "menu",
|
|
641
|
-
"aria-controls": N ?
|
|
651
|
+
"aria-controls": N ? C : void 0,
|
|
642
652
|
children: [
|
|
643
|
-
/* @__PURE__ */ s("span", { className:
|
|
644
|
-
/* @__PURE__ */ s("span", { className:
|
|
653
|
+
/* @__PURE__ */ s("span", { className: m(Me.triggerLabel, te && Me.placeholder, v?.triggerLabel), children: R }),
|
|
654
|
+
/* @__PURE__ */ s("span", { className: m(Me.chevron, v?.chevron), "aria-hidden": "true" })
|
|
645
655
|
]
|
|
646
656
|
}
|
|
647
657
|
),
|
|
648
|
-
!
|
|
658
|
+
!L && O()
|
|
649
659
|
] }),
|
|
650
|
-
|
|
651
|
-
|
|
660
|
+
L && N && typeof document < "u" && pt(
|
|
661
|
+
O({
|
|
652
662
|
position: "fixed",
|
|
653
|
-
top:
|
|
654
|
-
left: n === "right" ? void 0 :
|
|
655
|
-
right: n === "right" ? window.innerWidth - (
|
|
656
|
-
minWidth:
|
|
663
|
+
top: q.top + 4,
|
|
664
|
+
left: n === "right" ? void 0 : q.left,
|
|
665
|
+
right: n === "right" ? window.innerWidth - (q.left + q.width) : void 0,
|
|
666
|
+
minWidth: q.width,
|
|
657
667
|
zIndex: "var(--crk-z-floating)"
|
|
658
668
|
}),
|
|
659
669
|
document.body
|
|
@@ -676,9 +686,9 @@ const uo = $e(
|
|
|
676
686
|
ref: o,
|
|
677
687
|
type: "button",
|
|
678
688
|
role: "menuitem",
|
|
679
|
-
className:
|
|
680
|
-
|
|
681
|
-
e &&
|
|
689
|
+
className: m(
|
|
690
|
+
Me.item,
|
|
691
|
+
e && Me.itemDisabled,
|
|
682
692
|
t
|
|
683
693
|
),
|
|
684
694
|
disabled: e,
|
|
@@ -727,53 +737,53 @@ const qt = $e(
|
|
|
727
737
|
className: l,
|
|
728
738
|
style: a
|
|
729
739
|
}, h) => {
|
|
730
|
-
const [u, d] = Le(!1),
|
|
731
|
-
(
|
|
732
|
-
|
|
740
|
+
const [u, d] = Le(!1), f = re(null), y = re(null), L = re(null), v = Ye(), S = o !== void 0, N = S ? o : u, D = fe(
|
|
741
|
+
(C) => {
|
|
742
|
+
S || d(C), c?.(C);
|
|
733
743
|
},
|
|
734
|
-
[
|
|
735
|
-
),
|
|
736
|
-
|
|
737
|
-
}, [
|
|
738
|
-
|
|
739
|
-
}, [N,
|
|
740
|
-
xo(
|
|
744
|
+
[S, c]
|
|
745
|
+
), j = fe(() => {
|
|
746
|
+
D(!1), L.current?.focus();
|
|
747
|
+
}, [D]), Z = fe(() => {
|
|
748
|
+
D(!N);
|
|
749
|
+
}, [N, D]);
|
|
750
|
+
xo(f, j, N), Rt(
|
|
741
751
|
{
|
|
742
|
-
Escape: () =>
|
|
752
|
+
Escape: () => j()
|
|
743
753
|
},
|
|
744
754
|
N
|
|
745
755
|
), Ne(() => {
|
|
746
|
-
if (N &&
|
|
747
|
-
const
|
|
756
|
+
if (N && y.current) {
|
|
757
|
+
const C = y.current.querySelector(
|
|
748
758
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
749
759
|
);
|
|
750
|
-
|
|
760
|
+
C ? C.focus() : y.current.focus();
|
|
751
761
|
}
|
|
752
762
|
}, [N]);
|
|
753
|
-
let
|
|
763
|
+
let U;
|
|
754
764
|
if (t && dn(e)) {
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
ref: ko(
|
|
758
|
-
onClick: (
|
|
759
|
-
|
|
765
|
+
const C = e, $ = C.ref;
|
|
766
|
+
U = Xt(C, {
|
|
767
|
+
ref: ko(L, $),
|
|
768
|
+
onClick: (oe) => {
|
|
769
|
+
C.props.onClick?.(oe), Z();
|
|
760
770
|
},
|
|
761
|
-
className:
|
|
771
|
+
className: m(C.props.className, i?.trigger),
|
|
762
772
|
"aria-expanded": N,
|
|
763
773
|
"aria-haspopup": "dialog",
|
|
764
|
-
"aria-controls": N ?
|
|
774
|
+
"aria-controls": N ? v : void 0
|
|
765
775
|
});
|
|
766
776
|
} else
|
|
767
|
-
|
|
777
|
+
U = /* @__PURE__ */ s(
|
|
768
778
|
"button",
|
|
769
779
|
{
|
|
770
|
-
ref:
|
|
780
|
+
ref: L,
|
|
771
781
|
type: "button",
|
|
772
|
-
className:
|
|
773
|
-
onClick:
|
|
782
|
+
className: m(at.trigger, i?.trigger),
|
|
783
|
+
onClick: Z,
|
|
774
784
|
"aria-expanded": N,
|
|
775
785
|
"aria-haspopup": "dialog",
|
|
776
|
-
"aria-controls": N ?
|
|
786
|
+
"aria-controls": N ? v : void 0,
|
|
777
787
|
children: e
|
|
778
788
|
}
|
|
779
789
|
);
|
|
@@ -781,18 +791,18 @@ const qt = $e(
|
|
|
781
791
|
"div",
|
|
782
792
|
{
|
|
783
793
|
ref: h,
|
|
784
|
-
className:
|
|
794
|
+
className: m(at.root, i?.root, l),
|
|
785
795
|
style: a,
|
|
786
|
-
children: /* @__PURE__ */
|
|
787
|
-
|
|
796
|
+
children: /* @__PURE__ */ z("div", { ref: f, children: [
|
|
797
|
+
U,
|
|
788
798
|
N && /* @__PURE__ */ s(
|
|
789
799
|
"div",
|
|
790
800
|
{
|
|
791
|
-
ref:
|
|
792
|
-
id:
|
|
801
|
+
ref: y,
|
|
802
|
+
id: v,
|
|
793
803
|
role: "dialog",
|
|
794
804
|
tabIndex: -1,
|
|
795
|
-
className:
|
|
805
|
+
className: m(at.popover, at[r], i?.popover),
|
|
796
806
|
children: n
|
|
797
807
|
}
|
|
798
808
|
)
|
|
@@ -810,7 +820,7 @@ const It = [
|
|
|
810
820
|
"a[href]",
|
|
811
821
|
'[tabindex]:not([tabindex="-1"])'
|
|
812
822
|
].join(", ");
|
|
813
|
-
function
|
|
823
|
+
function Mo(e, t) {
|
|
814
824
|
const n = re(null), r = fe(
|
|
815
825
|
(o) => {
|
|
816
826
|
if (o.key !== "Tab" || !e.current)
|
|
@@ -837,8 +847,8 @@ function wo(e, t) {
|
|
|
837
847
|
};
|
|
838
848
|
}, [t, e, r]);
|
|
839
849
|
}
|
|
840
|
-
const
|
|
841
|
-
backdrop:
|
|
850
|
+
const wo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yNG-7", Lo = "crk-modalIn-xFUwm", So = "crk-sm--xyY9", Ro = "crk-md-ETTfh", To = "crk-lg-5DBb7", Co = "crk-fullscreen-b4jQ-", Ao = "crk-header-NS30G", Bo = "crk-headerWithClose-4davm", Io = "crk-closeButton-JX-aq", Do = "crk-body-3zIj9", Eo = "crk-footer-Oyz-R", ze = {
|
|
851
|
+
backdrop: wo,
|
|
842
852
|
backdropIn: $o,
|
|
843
853
|
modal: No,
|
|
844
854
|
modalIn: Lo,
|
|
@@ -853,11 +863,11 @@ const Mo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
|
|
|
853
863
|
footer: Eo
|
|
854
864
|
}, gt = _t({ classes: {}, titleId: "" }), Gt = ({ children: e, className: t, style: n, onClose: r }) => {
|
|
855
865
|
const { classes: o, titleId: c } = ft(gt);
|
|
856
|
-
return /* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ z(
|
|
857
867
|
"div",
|
|
858
868
|
{
|
|
859
869
|
id: c,
|
|
860
|
-
className:
|
|
870
|
+
className: m(ze.header, r && ze.headerWithClose, o.header, t),
|
|
861
871
|
style: n,
|
|
862
872
|
children: [
|
|
863
873
|
e,
|
|
@@ -865,7 +875,7 @@ const Mo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
|
|
|
865
875
|
"button",
|
|
866
876
|
{
|
|
867
877
|
type: "button",
|
|
868
|
-
className:
|
|
878
|
+
className: m(ze.closeButton, o.closeButton),
|
|
869
879
|
onClick: r,
|
|
870
880
|
"aria-label": "Close",
|
|
871
881
|
children: "×"
|
|
@@ -878,12 +888,12 @@ const Mo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
|
|
|
878
888
|
Gt.displayName = "Modal.Header";
|
|
879
889
|
const Zt = ({ children: e, className: t, style: n }) => {
|
|
880
890
|
const { classes: r } = ft(gt);
|
|
881
|
-
return /* @__PURE__ */ s("div", { className:
|
|
891
|
+
return /* @__PURE__ */ s("div", { className: m(ze.body, r.body, t), style: n, children: e });
|
|
882
892
|
};
|
|
883
893
|
Zt.displayName = "Modal.Body";
|
|
884
894
|
const Kt = ({ children: e, className: t, style: n }) => {
|
|
885
895
|
const { classes: r } = ft(gt);
|
|
886
|
-
return /* @__PURE__ */ s("div", { className:
|
|
896
|
+
return /* @__PURE__ */ s("div", { className: m(ze.footer, r.footer, t), style: n, children: e });
|
|
887
897
|
};
|
|
888
898
|
Kt.displayName = "Modal.Footer";
|
|
889
899
|
const yt = $e(
|
|
@@ -900,9 +910,9 @@ const yt = $e(
|
|
|
900
910
|
"aria-label": h,
|
|
901
911
|
"aria-labelledby": u
|
|
902
912
|
}, d) => {
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
const
|
|
913
|
+
const f = re(null), y = d ?? f, L = Ye(), v = u ?? `${L}-title`;
|
|
914
|
+
Mo(y, e);
|
|
915
|
+
const S = ke(
|
|
906
916
|
() => ({
|
|
907
917
|
Escape: () => {
|
|
908
918
|
r && t();
|
|
@@ -910,34 +920,34 @@ const yt = $e(
|
|
|
910
920
|
}),
|
|
911
921
|
[r, t]
|
|
912
922
|
);
|
|
913
|
-
Rt(
|
|
923
|
+
Rt(S, e), Ne(() => {
|
|
914
924
|
if (!e) return;
|
|
915
|
-
const
|
|
925
|
+
const D = document.body.style.overflow;
|
|
916
926
|
return document.body.style.overflow = "hidden", () => {
|
|
917
|
-
document.body.style.overflow =
|
|
927
|
+
document.body.style.overflow = D;
|
|
918
928
|
};
|
|
919
929
|
}, [e]);
|
|
920
|
-
const N = (
|
|
921
|
-
n &&
|
|
930
|
+
const N = (D) => {
|
|
931
|
+
n && D.target === D.currentTarget && t();
|
|
922
932
|
};
|
|
923
933
|
return e ? pt(
|
|
924
934
|
/* @__PURE__ */ s(
|
|
925
935
|
"div",
|
|
926
936
|
{
|
|
927
|
-
className:
|
|
937
|
+
className: m(ze.backdrop, c?.backdrop),
|
|
928
938
|
onClick: N,
|
|
929
939
|
role: "presentation",
|
|
930
940
|
children: /* @__PURE__ */ s(
|
|
931
941
|
"div",
|
|
932
942
|
{
|
|
933
|
-
ref:
|
|
934
|
-
className:
|
|
943
|
+
ref: y,
|
|
944
|
+
className: m(ze.modal, ze[o], c?.modal, i),
|
|
935
945
|
style: l,
|
|
936
946
|
role: "dialog",
|
|
937
947
|
"aria-modal": "true",
|
|
938
948
|
"aria-label": h,
|
|
939
|
-
"aria-labelledby": h ? void 0 :
|
|
940
|
-
children: /* @__PURE__ */ s(gt.Provider, { value: { classes: c ?? {}, titleId:
|
|
949
|
+
"aria-labelledby": h ? void 0 : v,
|
|
950
|
+
children: /* @__PURE__ */ s(gt.Provider, { value: { classes: c ?? {}, titleId: v }, children: a })
|
|
941
951
|
}
|
|
942
952
|
)
|
|
943
953
|
}
|
|
@@ -971,11 +981,11 @@ function Pl({
|
|
|
971
981
|
children: c
|
|
972
982
|
}) {
|
|
973
983
|
const i = n && n.length > 0;
|
|
974
|
-
return /* @__PURE__ */ s(hn, { ...e, children: /* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ s(hn, { ...e, children: /* @__PURE__ */ z(
|
|
975
985
|
"form",
|
|
976
986
|
{
|
|
977
987
|
onSubmit: e.handleSubmit(t),
|
|
978
|
-
className:
|
|
988
|
+
className: m(We.root, r),
|
|
979
989
|
style: o,
|
|
980
990
|
children: [
|
|
981
991
|
i && /* @__PURE__ */ s("ul", { className: We.formErrors, role: "alert", children: n.map((l, a) => /* @__PURE__ */ s("li", { className: We.formError, children: l }, a)) }),
|
|
@@ -1002,27 +1012,27 @@ function Wl({
|
|
|
1002
1012
|
style: l,
|
|
1003
1013
|
children: a
|
|
1004
1014
|
}) {
|
|
1005
|
-
const { control: h } = mn(), { field: u, fieldState: d } = fn({ name: e, control: h, rules: o }),
|
|
1006
|
-
N.current =
|
|
1007
|
-
const
|
|
1008
|
-
(
|
|
1009
|
-
if (
|
|
1010
|
-
const
|
|
1011
|
-
N.current(
|
|
1015
|
+
const { control: h } = mn(), { field: u, fieldState: d } = fn({ name: e, control: h, rules: o }), f = a.type, y = typeof f == "string" ? "" : f?.displayName ?? f?.name ?? "", L = Yo.has(y), { ref: v, ...S } = u, N = re(v);
|
|
1016
|
+
N.current = v;
|
|
1017
|
+
const D = fe(
|
|
1018
|
+
(j) => {
|
|
1019
|
+
if (j) {
|
|
1020
|
+
const Z = j.matches("input, select, textarea, button, [tabindex]") ? j : j.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
|
|
1021
|
+
N.current(Z ?? j);
|
|
1012
1022
|
} else
|
|
1013
1023
|
N.current(null);
|
|
1014
1024
|
},
|
|
1015
1025
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1016
1026
|
[]
|
|
1017
1027
|
);
|
|
1018
|
-
return /* @__PURE__ */
|
|
1019
|
-
t && /* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ z("div", { className: m(We.field, c?.field, i), style: l, children: [
|
|
1029
|
+
t && /* @__PURE__ */ z("label", { className: m(We.label, d.error && We.labelError, c?.label), htmlFor: e, children: [
|
|
1020
1030
|
t,
|
|
1021
1031
|
r && /* @__PURE__ */ s("span", { className: We.required, children: "*" })
|
|
1022
1032
|
] }),
|
|
1023
1033
|
Xt(a, {
|
|
1024
|
-
...
|
|
1025
|
-
ref:
|
|
1034
|
+
...S,
|
|
1035
|
+
ref: D,
|
|
1026
1036
|
id: e,
|
|
1027
1037
|
error: !!d.error,
|
|
1028
1038
|
"aria-invalid": d.error ? !0 : void 0,
|
|
@@ -1030,18 +1040,18 @@ function Wl({
|
|
|
1030
1040
|
// Bridge for custom components that use onValueChange/onValuesChange (Select, Dropdown).
|
|
1031
1041
|
// Skip for native-input wrappers (Input, Textarea, Checkbox, Radio) so the unknown
|
|
1032
1042
|
// handler doesn't leak onto the DOM and trip React's "Unknown event handler" warning.
|
|
1033
|
-
...
|
|
1034
|
-
onValueChange:
|
|
1035
|
-
onValuesChange:
|
|
1043
|
+
...L && {
|
|
1044
|
+
onValueChange: S.onChange,
|
|
1045
|
+
onValuesChange: S.onChange
|
|
1036
1046
|
},
|
|
1037
1047
|
// Bridge for Checkbox (expects checked, not value)
|
|
1038
|
-
checked: typeof
|
|
1048
|
+
checked: typeof S.value == "boolean" ? S.value : void 0
|
|
1039
1049
|
}),
|
|
1040
|
-
d.error?.message ? /* @__PURE__ */ s("span", { id: `${e}-error`, className:
|
|
1050
|
+
d.error?.message ? /* @__PURE__ */ s("span", { id: `${e}-error`, className: m(We.error, c?.error), role: "alert", children: d.error.message }) : n ? /* @__PURE__ */ s("span", { id: `${e}-helper`, className: m(We.helperText, c?.helperText), children: n }) : null
|
|
1041
1051
|
] });
|
|
1042
1052
|
}
|
|
1043
1053
|
function Hl({ children: e, className: t, style: n }) {
|
|
1044
|
-
return /* @__PURE__ */ s("div", { className:
|
|
1054
|
+
return /* @__PURE__ */ s("div", { className: m(We.row, t), style: n, children: e });
|
|
1045
1055
|
}
|
|
1046
1056
|
const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo = "crk-md-F4B0G", Ko = "crk-lg-pBxwX", Qo = "crk-error-fucxe", Jo = "crk-prefix-w53Md", ei = "crk-suffix-fcNgR", ti = "crk-hasPrefix--bqPD", ni = "crk-hasSuffix-zO0nX", Pe = {
|
|
1047
1057
|
root: Vo,
|
|
@@ -1069,7 +1079,7 @@ const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo =
|
|
|
1069
1079
|
"input",
|
|
1070
1080
|
{
|
|
1071
1081
|
ref: a,
|
|
1072
|
-
className:
|
|
1082
|
+
className: m(
|
|
1073
1083
|
Pe.root,
|
|
1074
1084
|
Pe[e],
|
|
1075
1085
|
t && Pe.error,
|
|
@@ -1082,22 +1092,22 @@ const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo =
|
|
|
1082
1092
|
...l
|
|
1083
1093
|
}
|
|
1084
1094
|
);
|
|
1085
|
-
return n || r ? /* @__PURE__ */
|
|
1095
|
+
return n || r ? /* @__PURE__ */ z(
|
|
1086
1096
|
"div",
|
|
1087
1097
|
{
|
|
1088
|
-
className:
|
|
1098
|
+
className: m(Pe.wrapper, Pe[e], t && Pe.error, o?.wrapper, c),
|
|
1089
1099
|
style: i,
|
|
1090
1100
|
children: [
|
|
1091
|
-
n && /* @__PURE__ */ s("span", { className:
|
|
1101
|
+
n && /* @__PURE__ */ s("span", { className: m(Pe.prefix, o?.prefix), children: n }),
|
|
1092
1102
|
h,
|
|
1093
|
-
r && /* @__PURE__ */ s("span", { className:
|
|
1103
|
+
r && /* @__PURE__ */ s("span", { className: m(Pe.suffix, o?.suffix), children: r })
|
|
1094
1104
|
]
|
|
1095
1105
|
}
|
|
1096
1106
|
) : h;
|
|
1097
1107
|
}
|
|
1098
1108
|
);
|
|
1099
1109
|
ri.displayName = "Input";
|
|
1100
|
-
const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "crk-lg-24Xd3", si = "crk-root-Uu9Ah", ai = "crk-error-9oRU6", di = "crk-arrow-WU8ZW", ui = "crk-searchableWrapper-7AL4l", hi = "crk-hiddenSelect-s3DEx", mi = "crk-searchableTrigger-m-GWV", fi = "crk-triggerOpen-Lo8-j", pi = "crk-triggerLabel-5rETZ", gi = "crk-placeholder-teBBh", yi = "crk-arrowInline-m-roG", vi = "crk-disabled-pcSeq", bi = "crk-visuallyHidden-2tTD5", xi = "crk-menu--i-je", ki = "crk-menuEnter-vJjLV",
|
|
1110
|
+
const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "crk-lg-24Xd3", si = "crk-root-Uu9Ah", ai = "crk-error-9oRU6", di = "crk-arrow-WU8ZW", ui = "crk-searchableWrapper-7AL4l", hi = "crk-hiddenSelect-s3DEx", mi = "crk-searchableTrigger-m-GWV", fi = "crk-triggerOpen-Lo8-j", pi = "crk-triggerLabel-5rETZ", gi = "crk-placeholder-teBBh", yi = "crk-arrowInline-m-roG", vi = "crk-disabled-pcSeq", bi = "crk-visuallyHidden-2tTD5", xi = "crk-menu--i-je", ki = "crk-menuEnter-vJjLV", Mi = "crk-menuItems-VrZnE", wi = "crk-item-fU3XI", $i = "crk-itemHighlighted-MvR41", Ni = "crk-itemDisabled-KTUO8", Li = "crk-itemSelected-42-BG", Si = "crk-noResults-uicSW", Ri = "crk-multiTrigger-Pd3wJ", Ti = "crk-multiTriggerDisabled-9ajge", Ci = "crk-chip-TuYUB", Ai = "crk-chipLabel-H4JWu", Bi = "crk-chipRemove-Lfk0R", Ii = "crk-multiSearch-OrVeS", Di = "crk-arrowMulti-Nh9Hr", Ei = "crk-itemCheck-DPB5A", W = {
|
|
1101
1111
|
wrapper: oi,
|
|
1102
1112
|
sm: ii,
|
|
1103
1113
|
md: ci,
|
|
@@ -1116,8 +1126,8 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
|
|
|
1116
1126
|
visuallyHidden: bi,
|
|
1117
1127
|
menu: xi,
|
|
1118
1128
|
menuEnter: ki,
|
|
1119
|
-
menuItems:
|
|
1120
|
-
item:
|
|
1129
|
+
menuItems: Mi,
|
|
1130
|
+
item: wi,
|
|
1121
1131
|
itemHighlighted: $i,
|
|
1122
1132
|
itemDisabled: Ni,
|
|
1123
1133
|
itemSelected: Li,
|
|
@@ -1144,20 +1154,20 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
|
|
|
1144
1154
|
searchPlaceholder: h,
|
|
1145
1155
|
onValueChange: u,
|
|
1146
1156
|
...d
|
|
1147
|
-
},
|
|
1148
|
-
/* @__PURE__ */
|
|
1157
|
+
}, f) => /* @__PURE__ */ z("div", { className: m(W.wrapper, W[e], t && W.error, o?.wrapper, c), style: i, children: [
|
|
1158
|
+
/* @__PURE__ */ z(
|
|
1149
1159
|
"select",
|
|
1150
1160
|
{
|
|
1151
|
-
ref:
|
|
1152
|
-
className:
|
|
1161
|
+
ref: f,
|
|
1162
|
+
className: m(W.root, W[e], t && W.error, o?.root),
|
|
1153
1163
|
...d,
|
|
1154
1164
|
children: [
|
|
1155
1165
|
r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
|
|
1156
|
-
n ? n.map((
|
|
1166
|
+
n ? n.map((y) => /* @__PURE__ */ s("option", { value: y.value, disabled: y.disabled, children: y.label }, y.value)) : l
|
|
1157
1167
|
]
|
|
1158
1168
|
}
|
|
1159
1169
|
),
|
|
1160
|
-
/* @__PURE__ */ s("span", { className:
|
|
1170
|
+
/* @__PURE__ */ s("span", { className: m(W.arrow, o?.arrow) })
|
|
1161
1171
|
] })
|
|
1162
1172
|
);
|
|
1163
1173
|
Qt.displayName = "NativeSelect";
|
|
@@ -1175,80 +1185,80 @@ const Jt = $e(
|
|
|
1175
1185
|
id: h,
|
|
1176
1186
|
searchPlaceholder: u = "Search...",
|
|
1177
1187
|
onChange: d,
|
|
1178
|
-
onValueChange:
|
|
1179
|
-
portal:
|
|
1180
|
-
},
|
|
1181
|
-
const [
|
|
1188
|
+
onValueChange: f,
|
|
1189
|
+
portal: y = !0
|
|
1190
|
+
}, L) => {
|
|
1191
|
+
const [v, S] = Le(!1), [N, D] = Le(""), [j, Z] = Le(0), U = re(null), C = re(null), $ = re(null), oe = re(null), ce = re(null), q = Ye(), ae = Tt($, v && y), R = re(null), te = L ?? R, H = re(!1);
|
|
1182
1192
|
Ne(() => {
|
|
1183
|
-
|
|
1184
|
-
}, [
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
}, []),
|
|
1188
|
-
a || (
|
|
1189
|
-
}, [a]),
|
|
1193
|
+
H.current && !v && $.current?.focus(), H.current = v;
|
|
1194
|
+
}, [v]);
|
|
1195
|
+
const O = fe(() => {
|
|
1196
|
+
S(!1), D(""), Z(0);
|
|
1197
|
+
}, []), A = fe(() => {
|
|
1198
|
+
a || (S(!0), D(""), Z(0), setTimeout(() => C.current?.focus(), 0));
|
|
1199
|
+
}, [a]), F = fe(
|
|
1190
1200
|
(M) => {
|
|
1191
|
-
if (
|
|
1201
|
+
if (f?.(M), te.current) {
|
|
1192
1202
|
Object.getOwnPropertyDescriptor(
|
|
1193
1203
|
HTMLSelectElement.prototype,
|
|
1194
1204
|
"value"
|
|
1195
|
-
)?.set?.call(
|
|
1196
|
-
const
|
|
1197
|
-
|
|
1205
|
+
)?.set?.call(te.current, M);
|
|
1206
|
+
const k = new Event("change", { bubbles: !0 });
|
|
1207
|
+
te.current.dispatchEvent(k), d?.(k);
|
|
1198
1208
|
}
|
|
1199
|
-
|
|
1209
|
+
O();
|
|
1200
1210
|
},
|
|
1201
|
-
[
|
|
1202
|
-
),
|
|
1211
|
+
[f, d, te, O]
|
|
1212
|
+
), ne = ke(() => {
|
|
1203
1213
|
if (!N) return n;
|
|
1204
1214
|
const M = N.toLowerCase();
|
|
1205
|
-
return n.filter((
|
|
1215
|
+
return n.filter((g) => g.label.toLowerCase().includes(M));
|
|
1206
1216
|
}, [n, N]);
|
|
1207
1217
|
Ne(() => {
|
|
1208
|
-
const M =
|
|
1209
|
-
|
|
1210
|
-
}, [
|
|
1211
|
-
if (!
|
|
1212
|
-
const M =
|
|
1218
|
+
const M = ne.findIndex((g) => !g.disabled);
|
|
1219
|
+
Z(M >= 0 ? M : 0);
|
|
1220
|
+
}, [ne]), Ne(() => {
|
|
1221
|
+
if (!v) return;
|
|
1222
|
+
const M = ce.current;
|
|
1213
1223
|
if (!M) return;
|
|
1214
|
-
M.querySelectorAll('[role="option"]')[
|
|
1215
|
-
}, [
|
|
1224
|
+
M.querySelectorAll('[role="option"]')[j]?.scrollIntoView?.({ block: "nearest" });
|
|
1225
|
+
}, [j, v]);
|
|
1216
1226
|
const pe = fe(
|
|
1217
1227
|
(M) => {
|
|
1218
|
-
const
|
|
1219
|
-
if (
|
|
1228
|
+
const g = ne.map((k, B) => k.disabled ? -1 : B).filter((k) => k >= 0);
|
|
1229
|
+
if (g.length !== 0)
|
|
1220
1230
|
if (M.key === "ArrowDown")
|
|
1221
|
-
M.preventDefault(),
|
|
1222
|
-
const
|
|
1223
|
-
return
|
|
1231
|
+
M.preventDefault(), Z((k) => {
|
|
1232
|
+
const B = g.indexOf(k);
|
|
1233
|
+
return B < g.length - 1 ? g[B + 1] : g[0];
|
|
1224
1234
|
});
|
|
1225
1235
|
else if (M.key === "ArrowUp")
|
|
1226
|
-
M.preventDefault(),
|
|
1227
|
-
const
|
|
1228
|
-
return
|
|
1236
|
+
M.preventDefault(), Z((k) => {
|
|
1237
|
+
const B = g.indexOf(k);
|
|
1238
|
+
return B > 0 ? g[B - 1] : g[g.length - 1];
|
|
1229
1239
|
});
|
|
1230
1240
|
else if (M.key === "Enter") {
|
|
1231
1241
|
M.preventDefault();
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1234
|
-
} else M.key === "Escape" && (M.preventDefault(),
|
|
1242
|
+
const k = ne[j];
|
|
1243
|
+
k && !k.disabled && F(k.value);
|
|
1244
|
+
} else M.key === "Escape" && (M.preventDefault(), O());
|
|
1235
1245
|
},
|
|
1236
|
-
[
|
|
1246
|
+
[ne, j, F, O]
|
|
1237
1247
|
);
|
|
1238
1248
|
Ne(() => {
|
|
1239
|
-
if (!
|
|
1240
|
-
const M = (
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1249
|
+
if (!v) return;
|
|
1250
|
+
const M = (g) => {
|
|
1251
|
+
const k = g.target;
|
|
1252
|
+
U.current?.contains(k) || oe.current?.contains(k) || O();
|
|
1243
1253
|
};
|
|
1244
1254
|
return document.addEventListener("mousedown", M), () => document.removeEventListener("mousedown", M);
|
|
1245
|
-
}, [
|
|
1246
|
-
const
|
|
1247
|
-
return /* @__PURE__ */
|
|
1255
|
+
}, [v, O]);
|
|
1256
|
+
const K = n.find((M) => M.value === l)?.label, X = ne.filter((M) => !M.disabled);
|
|
1257
|
+
return /* @__PURE__ */ z(
|
|
1248
1258
|
"div",
|
|
1249
1259
|
{
|
|
1250
|
-
ref:
|
|
1251
|
-
className:
|
|
1260
|
+
ref: U,
|
|
1261
|
+
className: m(
|
|
1252
1262
|
W.wrapper,
|
|
1253
1263
|
W.searchableWrapper,
|
|
1254
1264
|
W[e],
|
|
@@ -1262,7 +1272,7 @@ const Jt = $e(
|
|
|
1262
1272
|
/* @__PURE__ */ s(
|
|
1263
1273
|
"select",
|
|
1264
1274
|
{
|
|
1265
|
-
ref:
|
|
1275
|
+
ref: te,
|
|
1266
1276
|
className: W.hiddenSelect,
|
|
1267
1277
|
value: l ?? "",
|
|
1268
1278
|
disabled: a,
|
|
@@ -1273,39 +1283,39 @@ const Jt = $e(
|
|
|
1273
1283
|
children: n.map((M) => /* @__PURE__ */ s("option", { value: M.value, children: M.label }, M.value))
|
|
1274
1284
|
}
|
|
1275
1285
|
),
|
|
1276
|
-
/* @__PURE__ */
|
|
1286
|
+
/* @__PURE__ */ z(
|
|
1277
1287
|
"button",
|
|
1278
1288
|
{
|
|
1279
|
-
ref:
|
|
1289
|
+
ref: $,
|
|
1280
1290
|
id: h,
|
|
1281
1291
|
type: "button",
|
|
1282
|
-
className:
|
|
1292
|
+
className: m(
|
|
1283
1293
|
W.root,
|
|
1284
1294
|
W.searchableTrigger,
|
|
1285
1295
|
W[e],
|
|
1286
|
-
|
|
1296
|
+
v && W.triggerOpen,
|
|
1287
1297
|
t && W.error,
|
|
1288
|
-
|
|
1298
|
+
v && W.visuallyHidden,
|
|
1289
1299
|
o?.root
|
|
1290
1300
|
),
|
|
1291
|
-
onClick:
|
|
1301
|
+
onClick: A,
|
|
1292
1302
|
disabled: a,
|
|
1293
|
-
"aria-expanded":
|
|
1303
|
+
"aria-expanded": v,
|
|
1294
1304
|
"aria-haspopup": "listbox",
|
|
1295
|
-
"aria-controls":
|
|
1305
|
+
"aria-controls": v ? q : void 0,
|
|
1296
1306
|
children: [
|
|
1297
|
-
/* @__PURE__ */ s("span", { className:
|
|
1298
|
-
/* @__PURE__ */ s("span", { className:
|
|
1307
|
+
/* @__PURE__ */ s("span", { className: m(W.triggerLabel, !K && W.placeholder), children: K || r }),
|
|
1308
|
+
/* @__PURE__ */ s("span", { className: m(W.arrow, W.arrowInline, o?.arrow) })
|
|
1299
1309
|
]
|
|
1300
1310
|
}
|
|
1301
1311
|
),
|
|
1302
|
-
|
|
1312
|
+
v && /* @__PURE__ */ s(
|
|
1303
1313
|
"input",
|
|
1304
1314
|
{
|
|
1305
|
-
ref:
|
|
1315
|
+
ref: C,
|
|
1306
1316
|
type: "text",
|
|
1307
1317
|
role: "combobox",
|
|
1308
|
-
className:
|
|
1318
|
+
className: m(
|
|
1309
1319
|
W.root,
|
|
1310
1320
|
W.searchableTrigger,
|
|
1311
1321
|
W[e],
|
|
@@ -1314,56 +1324,56 @@ const Jt = $e(
|
|
|
1314
1324
|
o?.root,
|
|
1315
1325
|
o?.search
|
|
1316
1326
|
),
|
|
1317
|
-
placeholder:
|
|
1327
|
+
placeholder: K || r,
|
|
1318
1328
|
value: N,
|
|
1319
|
-
onChange: (M) =>
|
|
1329
|
+
onChange: (M) => D(M.target.value),
|
|
1320
1330
|
onKeyDown: pe,
|
|
1321
1331
|
"aria-expanded": !0,
|
|
1322
1332
|
"aria-haspopup": "listbox",
|
|
1323
|
-
"aria-controls":
|
|
1324
|
-
"aria-activedescendant":
|
|
1333
|
+
"aria-controls": q,
|
|
1334
|
+
"aria-activedescendant": X.length > 0 ? `select-option-${ne[j]?.value}` : void 0
|
|
1325
1335
|
}
|
|
1326
1336
|
),
|
|
1327
|
-
|
|
1328
|
-
const M =
|
|
1337
|
+
v && (() => {
|
|
1338
|
+
const M = y ? {
|
|
1329
1339
|
position: "fixed",
|
|
1330
|
-
top:
|
|
1331
|
-
left:
|
|
1340
|
+
top: ae.top + 4,
|
|
1341
|
+
left: ae.left,
|
|
1332
1342
|
right: "auto",
|
|
1333
|
-
width:
|
|
1343
|
+
width: ae.width,
|
|
1334
1344
|
zIndex: "var(--crk-z-floating)"
|
|
1335
|
-
} : void 0,
|
|
1345
|
+
} : void 0, g = /* @__PURE__ */ s(
|
|
1336
1346
|
"div",
|
|
1337
1347
|
{
|
|
1338
|
-
id:
|
|
1339
|
-
ref:
|
|
1340
|
-
className:
|
|
1348
|
+
id: q,
|
|
1349
|
+
ref: oe,
|
|
1350
|
+
className: m(W.menu, o?.menu),
|
|
1341
1351
|
style: M,
|
|
1342
1352
|
role: "listbox",
|
|
1343
|
-
children: /* @__PURE__ */ s("div", { className: W.menuItems, ref:
|
|
1353
|
+
children: /* @__PURE__ */ s("div", { className: W.menuItems, ref: ce, children: ne.length === 0 ? /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }) : ne.map((k, B) => /* @__PURE__ */ s(
|
|
1344
1354
|
"button",
|
|
1345
1355
|
{
|
|
1346
|
-
id: `select-option-${
|
|
1356
|
+
id: `select-option-${k.value}`,
|
|
1347
1357
|
type: "button",
|
|
1348
1358
|
role: "option",
|
|
1349
|
-
"aria-selected":
|
|
1350
|
-
className:
|
|
1359
|
+
"aria-selected": k.value === l,
|
|
1360
|
+
className: m(
|
|
1351
1361
|
W.item,
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1362
|
+
k.disabled && W.itemDisabled,
|
|
1363
|
+
k.value === l && W.itemSelected,
|
|
1364
|
+
B === j && W.itemHighlighted,
|
|
1355
1365
|
o?.item
|
|
1356
1366
|
),
|
|
1357
|
-
disabled:
|
|
1358
|
-
onClick: () =>
|
|
1359
|
-
onMouseEnter: () =>
|
|
1360
|
-
children:
|
|
1367
|
+
disabled: k.disabled,
|
|
1368
|
+
onClick: () => F(k.value),
|
|
1369
|
+
onMouseEnter: () => Z(B),
|
|
1370
|
+
children: k.content ?? k.label
|
|
1361
1371
|
},
|
|
1362
|
-
|
|
1372
|
+
k.value
|
|
1363
1373
|
)) })
|
|
1364
1374
|
}
|
|
1365
1375
|
);
|
|
1366
|
-
return
|
|
1376
|
+
return y && typeof document < "u" ? pt(g, document.body) : g;
|
|
1367
1377
|
})()
|
|
1368
1378
|
]
|
|
1369
1379
|
}
|
|
@@ -1385,92 +1395,92 @@ const en = $e(
|
|
|
1385
1395
|
id: h,
|
|
1386
1396
|
searchPlaceholder: u,
|
|
1387
1397
|
onValuesChange: d,
|
|
1388
|
-
clearSearchOnSelect:
|
|
1389
|
-
allowCreate:
|
|
1390
|
-
onCreate:
|
|
1391
|
-
createLabel:
|
|
1392
|
-
portal:
|
|
1398
|
+
clearSearchOnSelect: f = !0,
|
|
1399
|
+
allowCreate: y = !1,
|
|
1400
|
+
onCreate: L,
|
|
1401
|
+
createLabel: v,
|
|
1402
|
+
portal: S = !0
|
|
1393
1403
|
}, N) => {
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1404
|
+
const D = Array.isArray(l) ? l : l ? [l] : [], [j, Z] = Le(!1), [U, C] = Le(""), [$, oe] = Le(0), ce = re(null), q = re(null), ae = re(null), R = re(null), te = re(null), H = Ye(), O = Tt(te, j && S), A = re(null), F = N ?? A, ne = fe(() => {
|
|
1405
|
+
Z(!1), C(""), oe(0);
|
|
1396
1406
|
}, []), pe = fe(() => {
|
|
1397
|
-
a || (
|
|
1398
|
-
}, [a]),
|
|
1399
|
-
(
|
|
1400
|
-
const
|
|
1401
|
-
d?.(
|
|
1407
|
+
a || (Z(!0), C(""), oe(0), setTimeout(() => q.current?.focus(), 0));
|
|
1408
|
+
}, [a]), K = fe(
|
|
1409
|
+
(b) => {
|
|
1410
|
+
const E = D.includes(b) ? D.filter((V) => V !== b) : [...D, b];
|
|
1411
|
+
d?.(E), f && C("");
|
|
1402
1412
|
},
|
|
1403
|
-
[
|
|
1404
|
-
),
|
|
1405
|
-
(
|
|
1406
|
-
|
|
1413
|
+
[D, d, f]
|
|
1414
|
+
), X = fe(
|
|
1415
|
+
(b, E) => {
|
|
1416
|
+
E.stopPropagation(), d?.(D.filter((V) => V !== b));
|
|
1407
1417
|
},
|
|
1408
|
-
[
|
|
1418
|
+
[D, d]
|
|
1409
1419
|
), M = ke(() => {
|
|
1410
|
-
if (!
|
|
1411
|
-
const
|
|
1412
|
-
return n.filter((
|
|
1413
|
-
}, [n,
|
|
1414
|
-
(
|
|
1415
|
-
) && !
|
|
1416
|
-
|
|
1417
|
-
}, [
|
|
1420
|
+
if (!U) return n;
|
|
1421
|
+
const b = U.toLowerCase();
|
|
1422
|
+
return n.filter((E) => E.label.toLowerCase().includes(b));
|
|
1423
|
+
}, [n, U]), g = U.trim(), k = y && g.length > 0 && !n.some(
|
|
1424
|
+
(b) => b.label.toLowerCase() === g.toLowerCase() || b.value === g
|
|
1425
|
+
) && !D.includes(g), B = fe(() => {
|
|
1426
|
+
g && (D.includes(g) || (L?.(g), d?.([...D, g]), f && C("")));
|
|
1427
|
+
}, [g, D, L, d, f]);
|
|
1418
1428
|
Ne(() => {
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1429
|
+
const b = M.findIndex((E) => !E.disabled);
|
|
1430
|
+
oe(b >= 0 ? b : 0);
|
|
1421
1431
|
}, [M]), Ne(() => {
|
|
1422
|
-
if (!
|
|
1423
|
-
const
|
|
1424
|
-
if (!
|
|
1425
|
-
|
|
1426
|
-
}, [
|
|
1427
|
-
const
|
|
1428
|
-
(
|
|
1429
|
-
const
|
|
1430
|
-
if (
|
|
1431
|
-
|
|
1432
|
+
if (!j) return;
|
|
1433
|
+
const b = R.current;
|
|
1434
|
+
if (!b) return;
|
|
1435
|
+
b.querySelectorAll('[role="option"]')[$]?.scrollIntoView?.({ block: "nearest" });
|
|
1436
|
+
}, [$, j]);
|
|
1437
|
+
const _ = M.length, J = fe(
|
|
1438
|
+
(b) => {
|
|
1439
|
+
const E = M.map((V, de) => V.disabled ? -1 : de).filter((V) => V >= 0);
|
|
1440
|
+
if (k && E.push(_), b.key === "Backspace" && U === "" && D.length > 0) {
|
|
1441
|
+
b.preventDefault(), d?.(D.slice(0, -1));
|
|
1432
1442
|
return;
|
|
1433
1443
|
}
|
|
1434
|
-
if (
|
|
1435
|
-
if (
|
|
1436
|
-
if (
|
|
1444
|
+
if (E.length !== 0)
|
|
1445
|
+
if (b.key === "ArrowDown") {
|
|
1446
|
+
if (b.preventDefault(), !j) {
|
|
1437
1447
|
pe();
|
|
1438
1448
|
return;
|
|
1439
1449
|
}
|
|
1440
|
-
|
|
1441
|
-
const de =
|
|
1442
|
-
return de <
|
|
1450
|
+
oe((V) => {
|
|
1451
|
+
const de = E.indexOf(V);
|
|
1452
|
+
return de < E.length - 1 ? E[de + 1] : E[0];
|
|
1443
1453
|
});
|
|
1444
|
-
} else if (
|
|
1445
|
-
|
|
1446
|
-
const de =
|
|
1447
|
-
return de > 0 ?
|
|
1454
|
+
} else if (b.key === "ArrowUp")
|
|
1455
|
+
b.preventDefault(), oe((V) => {
|
|
1456
|
+
const de = E.indexOf(V);
|
|
1457
|
+
return de > 0 ? E[de - 1] : E[E.length - 1];
|
|
1448
1458
|
});
|
|
1449
|
-
else if (
|
|
1450
|
-
if (
|
|
1451
|
-
|
|
1459
|
+
else if (b.key === "Enter") {
|
|
1460
|
+
if (b.preventDefault(), k && $ === _) {
|
|
1461
|
+
B();
|
|
1452
1462
|
return;
|
|
1453
1463
|
}
|
|
1454
|
-
const
|
|
1455
|
-
|
|
1456
|
-
} else
|
|
1464
|
+
const V = M[$];
|
|
1465
|
+
V && !V.disabled ? K(V.value) : k && B();
|
|
1466
|
+
} else b.key === "Escape" && (b.preventDefault(), ne());
|
|
1457
1467
|
},
|
|
1458
|
-
[M,
|
|
1468
|
+
[M, $, K, ne, U, D, d, j, pe, k, B, _]
|
|
1459
1469
|
);
|
|
1460
1470
|
Ne(() => {
|
|
1461
|
-
if (!
|
|
1462
|
-
const
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1471
|
+
if (!j) return;
|
|
1472
|
+
const b = (E) => {
|
|
1473
|
+
const V = E.target;
|
|
1474
|
+
ce.current?.contains(V) || ae.current?.contains(V) || ne();
|
|
1465
1475
|
};
|
|
1466
|
-
return document.addEventListener("mousedown",
|
|
1467
|
-
}, [
|
|
1468
|
-
const
|
|
1469
|
-
return /* @__PURE__ */
|
|
1476
|
+
return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
|
|
1477
|
+
}, [j, ne]);
|
|
1478
|
+
const Y = D.map((b) => n.find((V) => V.value === b) ?? { value: b, label: b });
|
|
1479
|
+
return /* @__PURE__ */ z(
|
|
1470
1480
|
"div",
|
|
1471
1481
|
{
|
|
1472
|
-
ref:
|
|
1473
|
-
className:
|
|
1482
|
+
ref: ce,
|
|
1483
|
+
className: m(
|
|
1474
1484
|
W.wrapper,
|
|
1475
1485
|
W.searchableWrapper,
|
|
1476
1486
|
W[e],
|
|
@@ -1484,135 +1494,135 @@ const en = $e(
|
|
|
1484
1494
|
/* @__PURE__ */ s(
|
|
1485
1495
|
"select",
|
|
1486
1496
|
{
|
|
1487
|
-
ref:
|
|
1497
|
+
ref: F,
|
|
1488
1498
|
className: W.hiddenSelect,
|
|
1489
1499
|
multiple: !0,
|
|
1490
|
-
value:
|
|
1500
|
+
value: D,
|
|
1491
1501
|
disabled: a,
|
|
1492
1502
|
tabIndex: -1,
|
|
1493
1503
|
"aria-hidden": "true",
|
|
1494
1504
|
onChange: () => {
|
|
1495
1505
|
},
|
|
1496
|
-
children: n.map((
|
|
1506
|
+
children: n.map((b) => /* @__PURE__ */ s("option", { value: b.value, children: b.label }, b.value))
|
|
1497
1507
|
}
|
|
1498
1508
|
),
|
|
1499
|
-
/* @__PURE__ */
|
|
1509
|
+
/* @__PURE__ */ z(
|
|
1500
1510
|
"div",
|
|
1501
1511
|
{
|
|
1502
|
-
ref:
|
|
1503
|
-
className:
|
|
1512
|
+
ref: te,
|
|
1513
|
+
className: m(
|
|
1504
1514
|
W.multiTrigger,
|
|
1505
1515
|
W[e],
|
|
1506
|
-
|
|
1516
|
+
j && W.triggerOpen,
|
|
1507
1517
|
t && W.error,
|
|
1508
1518
|
a && W.multiTriggerDisabled,
|
|
1509
1519
|
o?.root
|
|
1510
1520
|
),
|
|
1511
1521
|
onClick: () => {
|
|
1512
|
-
|
|
1522
|
+
j ? q.current?.focus() : pe();
|
|
1513
1523
|
},
|
|
1514
1524
|
role: "combobox",
|
|
1515
|
-
"aria-expanded":
|
|
1525
|
+
"aria-expanded": j,
|
|
1516
1526
|
"aria-haspopup": "listbox",
|
|
1517
|
-
"aria-controls":
|
|
1527
|
+
"aria-controls": j ? H : void 0,
|
|
1518
1528
|
children: [
|
|
1519
|
-
|
|
1520
|
-
/* @__PURE__ */ s("span", { className: W.chipLabel, children:
|
|
1529
|
+
Y.map((b) => /* @__PURE__ */ z("span", { className: m(W.chip, o?.chip), children: [
|
|
1530
|
+
/* @__PURE__ */ s("span", { className: W.chipLabel, children: b.content ?? b.label }),
|
|
1521
1531
|
/* @__PURE__ */ s(
|
|
1522
1532
|
"button",
|
|
1523
1533
|
{
|
|
1524
1534
|
type: "button",
|
|
1525
|
-
className:
|
|
1526
|
-
onClick: (
|
|
1527
|
-
"aria-label": `Remove ${
|
|
1535
|
+
className: m(W.chipRemove, o?.chipRemove),
|
|
1536
|
+
onClick: (E) => X(b.value, E),
|
|
1537
|
+
"aria-label": `Remove ${b.label}`,
|
|
1528
1538
|
tabIndex: -1,
|
|
1529
1539
|
children: "×"
|
|
1530
1540
|
}
|
|
1531
1541
|
)
|
|
1532
|
-
] },
|
|
1542
|
+
] }, b.value)),
|
|
1533
1543
|
/* @__PURE__ */ s(
|
|
1534
1544
|
"input",
|
|
1535
1545
|
{
|
|
1536
|
-
ref:
|
|
1546
|
+
ref: q,
|
|
1537
1547
|
id: h,
|
|
1538
1548
|
type: "text",
|
|
1539
1549
|
className: W.multiSearch,
|
|
1540
|
-
placeholder:
|
|
1541
|
-
value:
|
|
1542
|
-
onChange: (
|
|
1543
|
-
|
|
1550
|
+
placeholder: D.length === 0 ? r : "",
|
|
1551
|
+
value: U,
|
|
1552
|
+
onChange: (b) => {
|
|
1553
|
+
C(b.target.value), j || pe();
|
|
1544
1554
|
},
|
|
1545
|
-
onKeyDown:
|
|
1555
|
+
onKeyDown: J,
|
|
1546
1556
|
disabled: a,
|
|
1547
1557
|
"aria-label": "Search options"
|
|
1548
1558
|
}
|
|
1549
1559
|
),
|
|
1550
|
-
/* @__PURE__ */ s("span", { className:
|
|
1560
|
+
/* @__PURE__ */ s("span", { className: m(W.arrow, W.arrowMulti, o?.arrow) })
|
|
1551
1561
|
]
|
|
1552
1562
|
}
|
|
1553
1563
|
),
|
|
1554
|
-
|
|
1555
|
-
const
|
|
1564
|
+
j && (() => {
|
|
1565
|
+
const b = S ? {
|
|
1556
1566
|
position: "fixed",
|
|
1557
|
-
top:
|
|
1558
|
-
left:
|
|
1567
|
+
top: O.top + 4,
|
|
1568
|
+
left: O.left,
|
|
1559
1569
|
right: "auto",
|
|
1560
|
-
width:
|
|
1570
|
+
width: O.width,
|
|
1561
1571
|
zIndex: "var(--crk-z-floating)"
|
|
1562
|
-
} : void 0,
|
|
1572
|
+
} : void 0, E = /* @__PURE__ */ s(
|
|
1563
1573
|
"div",
|
|
1564
1574
|
{
|
|
1565
|
-
id:
|
|
1566
|
-
ref:
|
|
1567
|
-
className:
|
|
1568
|
-
style:
|
|
1575
|
+
id: H,
|
|
1576
|
+
ref: ae,
|
|
1577
|
+
className: m(W.menu, o?.menu),
|
|
1578
|
+
style: b,
|
|
1569
1579
|
role: "listbox",
|
|
1570
1580
|
"aria-multiselectable": "true",
|
|
1571
|
-
children: /* @__PURE__ */
|
|
1572
|
-
M.length === 0 && !
|
|
1573
|
-
M.map((
|
|
1574
|
-
const he =
|
|
1575
|
-
return /* @__PURE__ */
|
|
1581
|
+
children: /* @__PURE__ */ z("div", { className: W.menuItems, ref: R, children: [
|
|
1582
|
+
M.length === 0 && !k && /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }),
|
|
1583
|
+
M.map((V, de) => {
|
|
1584
|
+
const he = D.includes(V.value);
|
|
1585
|
+
return /* @__PURE__ */ z(
|
|
1576
1586
|
"button",
|
|
1577
1587
|
{
|
|
1578
|
-
id: `select-option-${
|
|
1588
|
+
id: `select-option-${V.value}`,
|
|
1579
1589
|
type: "button",
|
|
1580
1590
|
role: "option",
|
|
1581
1591
|
"aria-selected": he,
|
|
1582
|
-
className:
|
|
1592
|
+
className: m(
|
|
1583
1593
|
W.item,
|
|
1584
|
-
|
|
1594
|
+
V.disabled && W.itemDisabled,
|
|
1585
1595
|
he && W.itemSelected,
|
|
1586
|
-
de ===
|
|
1596
|
+
de === $ && W.itemHighlighted,
|
|
1587
1597
|
o?.item
|
|
1588
1598
|
),
|
|
1589
|
-
disabled:
|
|
1590
|
-
onClick: () =>
|
|
1591
|
-
onMouseEnter: () =>
|
|
1599
|
+
disabled: V.disabled,
|
|
1600
|
+
onClick: () => K(V.value),
|
|
1601
|
+
onMouseEnter: () => oe(de),
|
|
1592
1602
|
children: [
|
|
1593
1603
|
he && /* @__PURE__ */ s("span", { className: W.itemCheck, "aria-hidden": "true" }),
|
|
1594
|
-
|
|
1604
|
+
V.content ?? V.label
|
|
1595
1605
|
]
|
|
1596
1606
|
},
|
|
1597
|
-
|
|
1607
|
+
V.value
|
|
1598
1608
|
);
|
|
1599
1609
|
}),
|
|
1600
|
-
|
|
1610
|
+
k && /* @__PURE__ */ s(
|
|
1601
1611
|
"button",
|
|
1602
1612
|
{
|
|
1603
1613
|
type: "button",
|
|
1604
1614
|
role: "option",
|
|
1605
1615
|
"aria-selected": !1,
|
|
1606
|
-
className:
|
|
1616
|
+
className: m(
|
|
1607
1617
|
W.item,
|
|
1608
|
-
|
|
1618
|
+
$ === _ && W.itemHighlighted,
|
|
1609
1619
|
o?.item
|
|
1610
1620
|
),
|
|
1611
|
-
onClick:
|
|
1612
|
-
onMouseEnter: () =>
|
|
1613
|
-
children:
|
|
1621
|
+
onClick: B,
|
|
1622
|
+
onMouseEnter: () => oe(_),
|
|
1623
|
+
children: v ? v(g) : /* @__PURE__ */ z(je, { children: [
|
|
1614
1624
|
"Create “",
|
|
1615
|
-
/* @__PURE__ */ s("strong", { children:
|
|
1625
|
+
/* @__PURE__ */ s("strong", { children: g }),
|
|
1616
1626
|
"”"
|
|
1617
1627
|
] })
|
|
1618
1628
|
},
|
|
@@ -1621,7 +1631,7 @@ const en = $e(
|
|
|
1621
1631
|
] })
|
|
1622
1632
|
}
|
|
1623
1633
|
);
|
|
1624
|
-
return
|
|
1634
|
+
return S && typeof document < "u" ? pt(E, document.body) : E;
|
|
1625
1635
|
})()
|
|
1626
1636
|
]
|
|
1627
1637
|
}
|
|
@@ -1650,10 +1660,10 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
|
|
|
1650
1660
|
const l = re(null);
|
|
1651
1661
|
return Ne(() => {
|
|
1652
1662
|
l.current && (l.current.indeterminate = t);
|
|
1653
|
-
}, [t]), /* @__PURE__ */
|
|
1663
|
+
}, [t]), /* @__PURE__ */ z(
|
|
1654
1664
|
"label",
|
|
1655
1665
|
{
|
|
1656
|
-
className:
|
|
1666
|
+
className: m(dt.root, t && dt.indeterminate, n?.root, r),
|
|
1657
1667
|
style: o,
|
|
1658
1668
|
children: [
|
|
1659
1669
|
/* @__PURE__ */ s(
|
|
@@ -1663,11 +1673,11 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
|
|
|
1663
1673
|
l.current = a, typeof i == "function" ? i(a) : i && (i.current = a);
|
|
1664
1674
|
},
|
|
1665
1675
|
type: "checkbox",
|
|
1666
|
-
className:
|
|
1676
|
+
className: m(dt.input, n?.input),
|
|
1667
1677
|
...c
|
|
1668
1678
|
}
|
|
1669
1679
|
),
|
|
1670
|
-
e && /* @__PURE__ */ s("span", { className:
|
|
1680
|
+
e && /* @__PURE__ */ s("span", { className: m(dt.label, n?.label), children: e })
|
|
1671
1681
|
]
|
|
1672
1682
|
}
|
|
1673
1683
|
);
|
|
@@ -1694,7 +1704,7 @@ const ji = "crk-group-NNwCD", Xi = "crk-root-7fGik", _i = "crk-input-43PQW", Ui
|
|
|
1694
1704
|
"div",
|
|
1695
1705
|
{
|
|
1696
1706
|
id: i,
|
|
1697
|
-
className:
|
|
1707
|
+
className: m(ht.group, r),
|
|
1698
1708
|
style: o,
|
|
1699
1709
|
role: "radiogroup",
|
|
1700
1710
|
tabIndex: -1,
|
|
@@ -1717,24 +1727,24 @@ const Vi = $e(
|
|
|
1717
1727
|
name: l,
|
|
1718
1728
|
...a
|
|
1719
1729
|
}, h) => {
|
|
1720
|
-
const u = ft(tn), d = u?.name ?? l,
|
|
1721
|
-
u?.onChange?.(t), c?.(
|
|
1730
|
+
const u = ft(tn), d = u?.name ?? l, f = u ? u.value === t : i, y = (L) => {
|
|
1731
|
+
u?.onChange?.(t), c?.(L);
|
|
1722
1732
|
};
|
|
1723
|
-
return /* @__PURE__ */
|
|
1733
|
+
return /* @__PURE__ */ z("label", { className: m(ht.root, n?.root, r), style: o, children: [
|
|
1724
1734
|
/* @__PURE__ */ s(
|
|
1725
1735
|
"input",
|
|
1726
1736
|
{
|
|
1727
1737
|
ref: h,
|
|
1728
1738
|
type: "radio",
|
|
1729
|
-
className:
|
|
1739
|
+
className: m(ht.input, n?.input),
|
|
1730
1740
|
name: d,
|
|
1731
1741
|
value: t,
|
|
1732
|
-
checked:
|
|
1733
|
-
onChange:
|
|
1742
|
+
checked: f,
|
|
1743
|
+
onChange: y,
|
|
1734
1744
|
...a
|
|
1735
1745
|
}
|
|
1736
1746
|
),
|
|
1737
|
-
e && /* @__PURE__ */ s("span", { className:
|
|
1747
|
+
e && /* @__PURE__ */ s("span", { className: m(ht.label, n?.label), children: e })
|
|
1738
1748
|
] });
|
|
1739
1749
|
}
|
|
1740
1750
|
);
|
|
@@ -1767,25 +1777,25 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
|
|
|
1767
1777
|
...l
|
|
1768
1778
|
}, a) => {
|
|
1769
1779
|
const h = re(null), u = fe(() => {
|
|
1770
|
-
const
|
|
1771
|
-
|
|
1780
|
+
const y = h.current;
|
|
1781
|
+
y && (y.style.height = "auto", y.style.height = `${y.scrollHeight}px`);
|
|
1772
1782
|
}, []), d = l.value ?? "";
|
|
1773
1783
|
Ne(() => {
|
|
1774
1784
|
r && u();
|
|
1775
1785
|
}, [r, u, d]);
|
|
1776
|
-
const
|
|
1777
|
-
(
|
|
1778
|
-
r && u(), i?.(
|
|
1786
|
+
const f = fe(
|
|
1787
|
+
(y) => {
|
|
1788
|
+
r && u(), i?.(y);
|
|
1779
1789
|
},
|
|
1780
1790
|
[r, u, i]
|
|
1781
1791
|
);
|
|
1782
1792
|
return /* @__PURE__ */ s(
|
|
1783
1793
|
"textarea",
|
|
1784
1794
|
{
|
|
1785
|
-
ref: (
|
|
1786
|
-
h.current =
|
|
1795
|
+
ref: (y) => {
|
|
1796
|
+
h.current = y, typeof a == "function" ? a(y) : a && (a.current = y);
|
|
1787
1797
|
},
|
|
1788
|
-
className:
|
|
1798
|
+
className: m(
|
|
1789
1799
|
Ke.root,
|
|
1790
1800
|
Ke[e],
|
|
1791
1801
|
t && Ke.error,
|
|
@@ -1793,7 +1803,7 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
|
|
|
1793
1803
|
o
|
|
1794
1804
|
),
|
|
1795
1805
|
style: c,
|
|
1796
|
-
onChange:
|
|
1806
|
+
onChange: f,
|
|
1797
1807
|
rows: l.rows ?? 1,
|
|
1798
1808
|
...l
|
|
1799
1809
|
}
|
|
@@ -1807,8 +1817,8 @@ function cc(e, t = { width: 600, height: 300 }) {
|
|
|
1807
1817
|
const c = e.current;
|
|
1808
1818
|
if (!c || typeof ResizeObserver > "u") return;
|
|
1809
1819
|
const i = (h, u) => {
|
|
1810
|
-
const d = Math.max(0, Math.round(h)),
|
|
1811
|
-
o.current.width === d && o.current.height ===
|
|
1820
|
+
const d = Math.max(0, Math.round(h)), f = Math.max(0, Math.round(u));
|
|
1821
|
+
o.current.width === d && o.current.height === f || (o.current = { width: d, height: f }, r({ width: d, height: f }));
|
|
1812
1822
|
}, l = c.getBoundingClientRect();
|
|
1813
1823
|
(l.width > 0 || l.height > 0) && i(l.width, l.height);
|
|
1814
1824
|
const a = new ResizeObserver((h) => {
|
|
@@ -1820,7 +1830,7 @@ function cc(e, t = { width: 600, height: 300 }) {
|
|
|
1820
1830
|
return a.observe(c), () => a.disconnect();
|
|
1821
1831
|
}, [e]), n;
|
|
1822
1832
|
}
|
|
1823
|
-
const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc = "crk-gridLine-K2Gx9", uc = "crk-axis-Zum8-", hc = "crk-axisLabel-Ilv3u", mc = "crk-cursorLine-iNHim", fc = "crk-linePath-E4eYA", pc = "crk-areaPath-ZwMc6", gc = "crk-point-DTAoa", yc = "crk-bar-9sYbq", vc = "crk-barLabelInside-dlQh5", bc = "crk-activeBar-FJhPJ", xc = "crk-interactionLayer-dHNAG", kc = "crk-legend-JL6YI",
|
|
1833
|
+
const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc = "crk-gridLine-K2Gx9", uc = "crk-axis-Zum8-", hc = "crk-axisLabel-Ilv3u", mc = "crk-cursorLine-iNHim", fc = "crk-linePath-E4eYA", pc = "crk-areaPath-ZwMc6", gc = "crk-point-DTAoa", yc = "crk-bar-9sYbq", vc = "crk-barLabelInside-dlQh5", bc = "crk-activeBar-FJhPJ", xc = "crk-interactionLayer-dHNAG", kc = "crk-legend-JL6YI", Mc = "crk-legendItem-rcdvO", wc = "crk-legendSwatch-eJBsF", $c = "crk-legendIcon-6gzcO", Nc = "crk-legendLabel-C-eu3", Lc = "crk-tooltip-m55-N", Sc = "crk-tooltipTitle-0EfoX", Rc = "crk-tooltipRows-MC0wM", Tc = "crk-tooltipRow-ZQomr", Cc = "crk-tooltipLabel-s4OKX", Ac = "crk-tooltipValue-iwj1s", Bc = "crk-empty-aa4vk", Ic = "crk-sparkline-3-eRc", Dc = "crk-tradingHeader-Pb9wS", w = {
|
|
1824
1834
|
root: lc,
|
|
1825
1835
|
canvas: sc,
|
|
1826
1836
|
svg: ac,
|
|
@@ -1836,8 +1846,8 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
|
|
|
1836
1846
|
activeBar: bc,
|
|
1837
1847
|
interactionLayer: xc,
|
|
1838
1848
|
legend: kc,
|
|
1839
|
-
legendItem:
|
|
1840
|
-
legendSwatch:
|
|
1849
|
+
legendItem: Mc,
|
|
1850
|
+
legendSwatch: wc,
|
|
1841
1851
|
legendIcon: $c,
|
|
1842
1852
|
legendLabel: Nc,
|
|
1843
1853
|
tooltip: Lc,
|
|
@@ -1853,24 +1863,24 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
|
|
|
1853
1863
|
({ aspectRatio: e = 16 / 9, height: t, className: n, style: r, classes: o, legend: c, overlay: i, children: l }, a) => {
|
|
1854
1864
|
const h = re(null);
|
|
1855
1865
|
un(a, () => h.current);
|
|
1856
|
-
const { width: u } = cc(h), d = Math.max(0, u),
|
|
1857
|
-
return /* @__PURE__ */
|
|
1866
|
+
const { width: u } = cc(h), d = Math.max(0, u), f = t ?? Math.round(d / e);
|
|
1867
|
+
return /* @__PURE__ */ z(
|
|
1858
1868
|
"div",
|
|
1859
1869
|
{
|
|
1860
1870
|
ref: h,
|
|
1861
|
-
className:
|
|
1871
|
+
className: m(w.root, o?.root, n),
|
|
1862
1872
|
style: r,
|
|
1863
1873
|
children: [
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
d > 0 &&
|
|
1874
|
+
/* @__PURE__ */ z("div", { className: w.canvas, style: { height: f || void 0 }, children: [
|
|
1875
|
+
d > 0 && f > 0 && /* @__PURE__ */ s(
|
|
1866
1876
|
"svg",
|
|
1867
1877
|
{
|
|
1868
|
-
className:
|
|
1878
|
+
className: m(w.svg, o?.svg),
|
|
1869
1879
|
width: d,
|
|
1870
|
-
height:
|
|
1871
|
-
viewBox: `0 0 ${d} ${
|
|
1880
|
+
height: f,
|
|
1881
|
+
viewBox: `0 0 ${d} ${f}`,
|
|
1872
1882
|
role: "img",
|
|
1873
|
-
children: l({ width: d, height:
|
|
1883
|
+
children: l({ width: d, height: f })
|
|
1874
1884
|
}
|
|
1875
1885
|
),
|
|
1876
1886
|
i
|
|
@@ -1884,13 +1894,13 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
|
|
|
1884
1894
|
Ve.displayName = "ChartContainer";
|
|
1885
1895
|
function vt({ config: e, order: t, classes: n }) {
|
|
1886
1896
|
const r = t ?? Object.keys(e);
|
|
1887
|
-
return /* @__PURE__ */ s("div", { className:
|
|
1897
|
+
return /* @__PURE__ */ s("div", { className: m(w.legend, n?.legend), role: "list", children: r.map((o) => {
|
|
1888
1898
|
const c = e[o];
|
|
1889
|
-
return c ? /* @__PURE__ */
|
|
1899
|
+
return c ? /* @__PURE__ */ z("div", { className: m(w.legendItem, n?.legendItem), role: "listitem", children: [
|
|
1890
1900
|
c.icon ? /* @__PURE__ */ s(
|
|
1891
1901
|
"span",
|
|
1892
1902
|
{
|
|
1893
|
-
className:
|
|
1903
|
+
className: w.legendIcon,
|
|
1894
1904
|
style: { color: c.color },
|
|
1895
1905
|
"aria-hidden": "true",
|
|
1896
1906
|
children: c.icon
|
|
@@ -1898,12 +1908,12 @@ function vt({ config: e, order: t, classes: n }) {
|
|
|
1898
1908
|
) : /* @__PURE__ */ s(
|
|
1899
1909
|
"span",
|
|
1900
1910
|
{
|
|
1901
|
-
className:
|
|
1911
|
+
className: w.legendSwatch,
|
|
1902
1912
|
style: { background: c.color },
|
|
1903
1913
|
"aria-hidden": "true"
|
|
1904
1914
|
}
|
|
1905
1915
|
),
|
|
1906
|
-
/* @__PURE__ */ s("span", { className:
|
|
1916
|
+
/* @__PURE__ */ s("span", { className: w.legendLabel, children: c.label })
|
|
1907
1917
|
] }, o) : null;
|
|
1908
1918
|
}) });
|
|
1909
1919
|
}
|
|
@@ -1920,35 +1930,35 @@ function et({
|
|
|
1920
1930
|
classes: h
|
|
1921
1931
|
}) {
|
|
1922
1932
|
if (!e) return null;
|
|
1923
|
-
const u = 180,
|
|
1933
|
+
const u = 180, f = t + u + 16 > r ? t - u - 12 : t + 12, y = Math.max(8, n - 16);
|
|
1924
1934
|
return /* @__PURE__ */ s(
|
|
1925
1935
|
"div",
|
|
1926
1936
|
{
|
|
1927
|
-
className:
|
|
1928
|
-
style: { left:
|
|
1937
|
+
className: m(w.tooltip, h?.tooltip),
|
|
1938
|
+
style: { left: f, top: y, width: u },
|
|
1929
1939
|
role: "tooltip",
|
|
1930
|
-
children: c ? c(e) : /* @__PURE__ */
|
|
1931
|
-
l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className:
|
|
1932
|
-
/* @__PURE__ */ s("div", { className:
|
|
1933
|
-
const
|
|
1934
|
-
if (
|
|
1935
|
-
const N = typeof
|
|
1936
|
-
return /* @__PURE__ */
|
|
1937
|
-
/* @__PURE__ */ s("span", { className:
|
|
1938
|
-
/* @__PURE__ */ s("span", { className:
|
|
1939
|
-
/* @__PURE__ */ s("span", { className:
|
|
1940
|
-
] },
|
|
1940
|
+
children: c ? c(e) : /* @__PURE__ */ z(je, { children: [
|
|
1941
|
+
l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: w.tooltipTitle, children: String(e[l]) }),
|
|
1942
|
+
/* @__PURE__ */ s("div", { className: w.tooltipRows, children: Object.entries(o).map(([L, v]) => {
|
|
1943
|
+
const S = e[L];
|
|
1944
|
+
if (S == null) return null;
|
|
1945
|
+
const N = typeof S == "number" ? i(S) : String(S), D = a?.(L) ?? v.color;
|
|
1946
|
+
return /* @__PURE__ */ z("div", { className: w.tooltipRow, children: [
|
|
1947
|
+
/* @__PURE__ */ s("span", { className: w.legendSwatch, style: { background: D }, "aria-hidden": "true" }),
|
|
1948
|
+
/* @__PURE__ */ s("span", { className: w.tooltipLabel, children: v.label }),
|
|
1949
|
+
/* @__PURE__ */ s("span", { className: w.tooltipValue, children: N })
|
|
1950
|
+
] }, L);
|
|
1941
1951
|
}) })
|
|
1942
1952
|
] })
|
|
1943
1953
|
}
|
|
1944
1954
|
);
|
|
1945
1955
|
}
|
|
1946
1956
|
function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: c }) {
|
|
1947
|
-
return /* @__PURE__ */ s("g", { className:
|
|
1957
|
+
return /* @__PURE__ */ s("g", { className: m(w.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ z("g", { children: [
|
|
1948
1958
|
o && /* @__PURE__ */ s(
|
|
1949
1959
|
"line",
|
|
1950
1960
|
{
|
|
1951
|
-
className:
|
|
1961
|
+
className: m(w.gridLine, c?.grid),
|
|
1952
1962
|
x1: t,
|
|
1953
1963
|
x2: t + n,
|
|
1954
1964
|
y1: l,
|
|
@@ -1958,7 +1968,7 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
|
|
|
1958
1968
|
/* @__PURE__ */ s(
|
|
1959
1969
|
"text",
|
|
1960
1970
|
{
|
|
1961
|
-
className:
|
|
1971
|
+
className: m(w.axisLabel, c?.axisLabel),
|
|
1962
1972
|
x: t - 8,
|
|
1963
1973
|
y: l,
|
|
1964
1974
|
textAnchor: "end",
|
|
@@ -1969,10 +1979,10 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
|
|
|
1969
1979
|
] }, `y-${i}`)) });
|
|
1970
1980
|
}
|
|
1971
1981
|
function rn({ ticks: e, y: t, format: n, classes: r }) {
|
|
1972
|
-
return /* @__PURE__ */ s("g", { className:
|
|
1982
|
+
return /* @__PURE__ */ s("g", { className: m(w.axis, r?.axis), children: e.map(({ label: o, x: c }) => /* @__PURE__ */ s(
|
|
1973
1983
|
"text",
|
|
1974
1984
|
{
|
|
1975
|
-
className:
|
|
1985
|
+
className: m(w.axisLabel, r?.axisLabel),
|
|
1976
1986
|
x: c,
|
|
1977
1987
|
y: t + 16,
|
|
1978
1988
|
textAnchor: "middle",
|
|
@@ -2051,180 +2061,180 @@ function Ol({
|
|
|
2051
2061
|
showValues: h = !1,
|
|
2052
2062
|
valuePosition: u = "top",
|
|
2053
2063
|
renderLabel: d,
|
|
2054
|
-
activeIndex:
|
|
2055
|
-
onPointClick:
|
|
2056
|
-
showGrid:
|
|
2057
|
-
showLegend:
|
|
2058
|
-
showTooltip:
|
|
2064
|
+
activeIndex: f,
|
|
2065
|
+
onPointClick: y,
|
|
2066
|
+
showGrid: L = !0,
|
|
2067
|
+
showLegend: v = !0,
|
|
2068
|
+
showTooltip: S = !0,
|
|
2059
2069
|
yTickCount: N = 5,
|
|
2060
|
-
yFormat:
|
|
2061
|
-
xFormat:
|
|
2062
|
-
valueFormat:
|
|
2063
|
-
renderTooltip:
|
|
2064
|
-
margin:
|
|
2065
|
-
emptyMessage:
|
|
2066
|
-
className:
|
|
2067
|
-
style:
|
|
2068
|
-
classes:
|
|
2070
|
+
yFormat: D,
|
|
2071
|
+
xFormat: j,
|
|
2072
|
+
valueFormat: Z,
|
|
2073
|
+
renderTooltip: U,
|
|
2074
|
+
margin: C,
|
|
2075
|
+
emptyMessage: $ = "No data",
|
|
2076
|
+
className: oe,
|
|
2077
|
+
style: ce,
|
|
2078
|
+
classes: q
|
|
2069
2079
|
}) {
|
|
2070
|
-
const
|
|
2080
|
+
const ae = { ...Ec, ...C }, R = ke(() => Object.keys(n), [n]), [te, H] = Le(null), O = re(null), A = f ?? te, F = (pe, K) => {
|
|
2071
2081
|
if (l) {
|
|
2072
|
-
const
|
|
2073
|
-
if (typeof
|
|
2082
|
+
const X = e[K]?.[l];
|
|
2083
|
+
if (typeof X == "string") return X;
|
|
2074
2084
|
}
|
|
2075
2085
|
return n[pe]?.color ?? "var(--crk-chart-1)";
|
|
2076
2086
|
};
|
|
2077
2087
|
if (e.length === 0)
|
|
2078
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
2079
|
-
const
|
|
2088
|
+
return /* @__PURE__ */ s("div", { ref: O, className: m(w.root, q?.root, oe), style: ce, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: $ }) }) });
|
|
2089
|
+
const ne = S && A !== null ? /* @__PURE__ */ s(
|
|
2080
2090
|
et,
|
|
2081
2091
|
{
|
|
2082
|
-
row: e[
|
|
2083
|
-
x: Hc(e, t,
|
|
2092
|
+
row: e[A],
|
|
2093
|
+
x: Hc(e, t, ae, A, O),
|
|
2084
2094
|
y: 16,
|
|
2085
|
-
containerWidth:
|
|
2095
|
+
containerWidth: O.current?.getBoundingClientRect().width ?? 0,
|
|
2086
2096
|
config: n,
|
|
2087
|
-
render:
|
|
2088
|
-
valueFormat:
|
|
2097
|
+
render: U ? () => U(e[A]) : void 0,
|
|
2098
|
+
valueFormat: Z,
|
|
2089
2099
|
titleKey: t,
|
|
2090
|
-
resolveColor: l ? (pe) =>
|
|
2091
|
-
classes:
|
|
2100
|
+
resolveColor: l ? (pe) => F(pe, A) : void 0,
|
|
2101
|
+
classes: q
|
|
2092
2102
|
}
|
|
2093
2103
|
) : null;
|
|
2094
2104
|
return /* @__PURE__ */ s(
|
|
2095
2105
|
Ve,
|
|
2096
2106
|
{
|
|
2097
|
-
ref:
|
|
2107
|
+
ref: O,
|
|
2098
2108
|
aspectRatio: r,
|
|
2099
2109
|
height: o,
|
|
2100
|
-
className:
|
|
2101
|
-
style:
|
|
2102
|
-
classes:
|
|
2103
|
-
legend:
|
|
2104
|
-
overlay:
|
|
2105
|
-
children: ({ width: pe, height:
|
|
2106
|
-
const
|
|
2107
|
-
for (const
|
|
2108
|
-
for (const
|
|
2109
|
-
const
|
|
2110
|
-
typeof
|
|
2110
|
+
className: oe,
|
|
2111
|
+
style: ce,
|
|
2112
|
+
classes: q,
|
|
2113
|
+
legend: v ? /* @__PURE__ */ s(vt, { config: n, classes: q }) : void 0,
|
|
2114
|
+
overlay: ne,
|
|
2115
|
+
children: ({ width: pe, height: K }) => {
|
|
2116
|
+
const X = ae.left, M = pe - ae.right, g = ae.top, k = K - ae.bottom, B = Math.max(0, M - X), _ = Math.max(0, k - g), J = e.map((p) => String(p[t])), Y = Xe(J, [X, M], 0), b = [];
|
|
2117
|
+
for (const p of R)
|
|
2118
|
+
for (const x of e) {
|
|
2119
|
+
const ee = x[p];
|
|
2120
|
+
typeof ee == "number" && b.push(ee);
|
|
2111
2121
|
}
|
|
2112
|
-
const [
|
|
2113
|
-
return /* @__PURE__ */
|
|
2122
|
+
const [E, V] = bt(b), de = Math.min(0, E), he = qe(de, V, N), ye = Je([he[0], he[he.length - 1]], [k, g]), be = he.map((p) => ({ value: p, y: ye(p) })), Se = Wc(J).map((p) => ({ label: p, x: Y(p) }));
|
|
2123
|
+
return /* @__PURE__ */ z(je, { children: [
|
|
2114
2124
|
/* @__PURE__ */ s(
|
|
2115
2125
|
nn,
|
|
2116
2126
|
{
|
|
2117
2127
|
ticks: be,
|
|
2118
|
-
x:
|
|
2119
|
-
plotWidth:
|
|
2120
|
-
format:
|
|
2121
|
-
showGrid:
|
|
2122
|
-
classes:
|
|
2128
|
+
x: X,
|
|
2129
|
+
plotWidth: B,
|
|
2130
|
+
format: D,
|
|
2131
|
+
showGrid: L,
|
|
2132
|
+
classes: q
|
|
2123
2133
|
}
|
|
2124
2134
|
),
|
|
2125
|
-
/* @__PURE__ */ s(rn, { ticks: Se, y:
|
|
2126
|
-
|
|
2127
|
-
const
|
|
2128
|
-
const
|
|
2129
|
-
return { x:
|
|
2135
|
+
/* @__PURE__ */ s(rn, { ticks: Se, y: k, format: j, classes: q }),
|
|
2136
|
+
R.map((p) => {
|
|
2137
|
+
const x = n[p], ee = e.map((P, G) => {
|
|
2138
|
+
const I = P[p], me = typeof I == "number" ? I : 0;
|
|
2139
|
+
return { x: Y(J[G]), y: ye(me), value: me, row: P };
|
|
2130
2140
|
});
|
|
2131
|
-
return /* @__PURE__ */
|
|
2141
|
+
return /* @__PURE__ */ z("g", { className: m(w.series, q?.series), children: [
|
|
2132
2142
|
/* @__PURE__ */ s(
|
|
2133
2143
|
"path",
|
|
2134
2144
|
{
|
|
2135
|
-
className:
|
|
2136
|
-
d: Pc(
|
|
2137
|
-
stroke:
|
|
2145
|
+
className: m(w.linePath),
|
|
2146
|
+
d: Pc(ee, c),
|
|
2147
|
+
stroke: x.color
|
|
2138
2148
|
}
|
|
2139
2149
|
),
|
|
2140
|
-
i &&
|
|
2141
|
-
const
|
|
2150
|
+
i && ee.map((P, G) => {
|
|
2151
|
+
const I = F(p, G), me = A === G, Q = f !== void 0 && !me, T = y ? () => y({ row: P.row, value: P.value, seriesKey: p, index: G }) : void 0;
|
|
2142
2152
|
return a ? /* @__PURE__ */ s(
|
|
2143
2153
|
"g",
|
|
2144
2154
|
{
|
|
2145
|
-
onClick:
|
|
2146
|
-
style:
|
|
2147
|
-
opacity:
|
|
2155
|
+
onClick: T,
|
|
2156
|
+
style: T ? { cursor: "pointer" } : void 0,
|
|
2157
|
+
opacity: Q ? 0.45 : 1,
|
|
2148
2158
|
children: a({
|
|
2149
|
-
row:
|
|
2150
|
-
value:
|
|
2151
|
-
seriesKey:
|
|
2152
|
-
index:
|
|
2153
|
-
x:
|
|
2154
|
-
y:
|
|
2155
|
-
color:
|
|
2159
|
+
row: P.row,
|
|
2160
|
+
value: P.value,
|
|
2161
|
+
seriesKey: p,
|
|
2162
|
+
index: G,
|
|
2163
|
+
x: P.x,
|
|
2164
|
+
y: P.y,
|
|
2165
|
+
color: I,
|
|
2156
2166
|
active: me
|
|
2157
2167
|
})
|
|
2158
2168
|
},
|
|
2159
|
-
`${
|
|
2169
|
+
`${p}-${G}`
|
|
2160
2170
|
) : /* @__PURE__ */ s(
|
|
2161
2171
|
"circle",
|
|
2162
2172
|
{
|
|
2163
|
-
className:
|
|
2164
|
-
cx:
|
|
2165
|
-
cy:
|
|
2173
|
+
className: m(w.point, q?.point),
|
|
2174
|
+
cx: P.x,
|
|
2175
|
+
cy: P.y,
|
|
2166
2176
|
r: me ? 5 : 3.5,
|
|
2167
|
-
fill:
|
|
2168
|
-
onClick:
|
|
2169
|
-
style:
|
|
2170
|
-
opacity:
|
|
2177
|
+
fill: I,
|
|
2178
|
+
onClick: T,
|
|
2179
|
+
style: T ? { cursor: "pointer" } : void 0,
|
|
2180
|
+
opacity: Q ? 0.45 : 1
|
|
2171
2181
|
},
|
|
2172
|
-
`${
|
|
2182
|
+
`${p}-${G}`
|
|
2173
2183
|
);
|
|
2174
2184
|
}),
|
|
2175
|
-
(h || d) &&
|
|
2176
|
-
const
|
|
2177
|
-
if (
|
|
2178
|
-
const me = 10,
|
|
2185
|
+
(h || d) && ee.map((P, G) => {
|
|
2186
|
+
const I = d ? d({ row: P.row, value: P.value, seriesKey: p, index: G }) : h ? Z ? Z(P.value) : String(P.value) : null;
|
|
2187
|
+
if (I == null) return null;
|
|
2188
|
+
const me = 10, Q = u === "top" ? P.y - me : P.y + me + 4;
|
|
2179
2189
|
return /* @__PURE__ */ s(
|
|
2180
2190
|
"text",
|
|
2181
2191
|
{
|
|
2182
|
-
className:
|
|
2183
|
-
x:
|
|
2184
|
-
y:
|
|
2192
|
+
className: m(w.axisLabel),
|
|
2193
|
+
x: P.x,
|
|
2194
|
+
y: Q,
|
|
2185
2195
|
textAnchor: "middle",
|
|
2186
2196
|
dominantBaseline: u === "top" ? "auto" : "middle",
|
|
2187
|
-
children:
|
|
2197
|
+
children: I
|
|
2188
2198
|
},
|
|
2189
|
-
`label-${
|
|
2199
|
+
`label-${p}-${G}`
|
|
2190
2200
|
);
|
|
2191
2201
|
})
|
|
2192
|
-
] },
|
|
2202
|
+
] }, p);
|
|
2193
2203
|
}),
|
|
2194
|
-
|
|
2204
|
+
A !== null && /* @__PURE__ */ s(
|
|
2195
2205
|
"line",
|
|
2196
2206
|
{
|
|
2197
|
-
className:
|
|
2198
|
-
x1:
|
|
2199
|
-
x2:
|
|
2200
|
-
y1:
|
|
2201
|
-
y2:
|
|
2207
|
+
className: w.cursorLine,
|
|
2208
|
+
x1: Y(J[A]),
|
|
2209
|
+
x2: Y(J[A]),
|
|
2210
|
+
y1: g,
|
|
2211
|
+
y2: k
|
|
2202
2212
|
}
|
|
2203
2213
|
),
|
|
2204
2214
|
/* @__PURE__ */ s(
|
|
2205
2215
|
"rect",
|
|
2206
2216
|
{
|
|
2207
|
-
className:
|
|
2208
|
-
x:
|
|
2209
|
-
y,
|
|
2210
|
-
width:
|
|
2211
|
-
height:
|
|
2212
|
-
onMouseMove: (
|
|
2213
|
-
const
|
|
2217
|
+
className: w.interactionLayer,
|
|
2218
|
+
x: X,
|
|
2219
|
+
y: g,
|
|
2220
|
+
width: B,
|
|
2221
|
+
height: _,
|
|
2222
|
+
onMouseMove: (p) => {
|
|
2223
|
+
const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + X, P = Y.step(), G = Math.max(
|
|
2214
2224
|
0,
|
|
2215
|
-
Math.min(e.length - 1, Math.round((
|
|
2225
|
+
Math.min(e.length - 1, Math.round((ee - X - P / 2) / P))
|
|
2216
2226
|
);
|
|
2217
|
-
|
|
2227
|
+
H(G);
|
|
2218
2228
|
},
|
|
2219
|
-
onMouseLeave: () =>
|
|
2220
|
-
onClick:
|
|
2221
|
-
const
|
|
2229
|
+
onMouseLeave: () => H(null),
|
|
2230
|
+
onClick: y ? (p) => {
|
|
2231
|
+
const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + X, P = Y.step(), G = Math.max(
|
|
2222
2232
|
0,
|
|
2223
|
-
Math.min(e.length - 1, Math.round((
|
|
2224
|
-
),
|
|
2225
|
-
|
|
2233
|
+
Math.min(e.length - 1, Math.round((ee - X - P / 2) / P))
|
|
2234
|
+
), I = R[0], me = e[G][I], Q = typeof me == "number" ? me : 0;
|
|
2235
|
+
y({ row: e[G], value: Q, seriesKey: I, index: G });
|
|
2226
2236
|
} : void 0,
|
|
2227
|
-
style:
|
|
2237
|
+
style: y ? { cursor: "pointer" } : void 0
|
|
2228
2238
|
}
|
|
2229
2239
|
)
|
|
2230
2240
|
] });
|
|
@@ -2285,178 +2295,178 @@ function Fl({
|
|
|
2285
2295
|
showGrid: h = !0,
|
|
2286
2296
|
showXAxis: u = !0,
|
|
2287
2297
|
showYAxis: d = !0,
|
|
2288
|
-
showLegend:
|
|
2289
|
-
showTooltip:
|
|
2290
|
-
yTickCount:
|
|
2291
|
-
yFormat:
|
|
2292
|
-
xFormat:
|
|
2298
|
+
showLegend: f = !0,
|
|
2299
|
+
showTooltip: y = !0,
|
|
2300
|
+
yTickCount: L = 5,
|
|
2301
|
+
yFormat: v,
|
|
2302
|
+
xFormat: S,
|
|
2293
2303
|
valueFormat: N,
|
|
2294
|
-
renderTooltip:
|
|
2295
|
-
margin:
|
|
2296
|
-
emptyMessage:
|
|
2297
|
-
className:
|
|
2298
|
-
style:
|
|
2299
|
-
classes:
|
|
2304
|
+
renderTooltip: D,
|
|
2305
|
+
margin: j,
|
|
2306
|
+
emptyMessage: Z = "No data",
|
|
2307
|
+
className: U,
|
|
2308
|
+
style: C,
|
|
2309
|
+
classes: $
|
|
2300
2310
|
}) {
|
|
2301
|
-
const
|
|
2311
|
+
const oe = ke(
|
|
2302
2312
|
() => ({
|
|
2303
2313
|
...Oc,
|
|
2304
2314
|
...d ? {} : { left: 16 },
|
|
2305
|
-
...
|
|
2315
|
+
...j
|
|
2306
2316
|
}),
|
|
2307
|
-
[
|
|
2308
|
-
),
|
|
2317
|
+
[j, d]
|
|
2318
|
+
), ce = ke(() => Object.keys(n), [n]), q = i && ce.length > 0, ae = q && l === "expand", [R, te] = Le(null), H = re(null), O = Ye();
|
|
2309
2319
|
if (e.length === 0)
|
|
2310
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
2311
|
-
const
|
|
2312
|
-
const
|
|
2313
|
-
for (let
|
|
2314
|
-
let
|
|
2315
|
-
if (
|
|
2316
|
-
for (const
|
|
2317
|
-
const
|
|
2318
|
-
typeof
|
|
2320
|
+
return /* @__PURE__ */ s("div", { ref: H, className: m(w.root, $?.root, U), style: C, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: Z }) }) });
|
|
2321
|
+
const A = ke(() => {
|
|
2322
|
+
const X = ce.map(() => []), M = ce.map(() => []);
|
|
2323
|
+
for (let g = 0; g < e.length; g++) {
|
|
2324
|
+
let k = 0;
|
|
2325
|
+
if (ae) {
|
|
2326
|
+
for (const _ of ce) {
|
|
2327
|
+
const J = e[g][_];
|
|
2328
|
+
typeof J == "number" && J > 0 && (k += J);
|
|
2319
2329
|
}
|
|
2320
|
-
|
|
2330
|
+
k === 0 && (k = 1);
|
|
2321
2331
|
}
|
|
2322
|
-
let
|
|
2323
|
-
for (let
|
|
2324
|
-
const
|
|
2325
|
-
if (
|
|
2326
|
-
const
|
|
2327
|
-
M[
|
|
2332
|
+
let B = 0;
|
|
2333
|
+
for (let _ = 0; _ < ce.length; _++) {
|
|
2334
|
+
const J = ce[_], Y = e[g][J], b = typeof Y == "number" ? Y : 0;
|
|
2335
|
+
if (q) {
|
|
2336
|
+
const E = ae ? b / k : b;
|
|
2337
|
+
M[_][g] = B, B += E, X[_][g] = B;
|
|
2328
2338
|
} else
|
|
2329
|
-
M[
|
|
2339
|
+
M[_][g] = 0, X[_][g] = b;
|
|
2330
2340
|
}
|
|
2331
2341
|
}
|
|
2332
|
-
return { tops:
|
|
2333
|
-
}, [e,
|
|
2334
|
-
if (
|
|
2335
|
-
let
|
|
2336
|
-
for (const
|
|
2337
|
-
for (const
|
|
2338
|
-
|
|
2339
|
-
for (const
|
|
2340
|
-
for (const
|
|
2341
|
-
|
|
2342
|
-
return [Math.min(0,
|
|
2343
|
-
}, [
|
|
2342
|
+
return { tops: X, bottoms: M };
|
|
2343
|
+
}, [e, ce, q, ae]), { tops: F, bottoms: ne } = A, [pe, K] = ke(() => {
|
|
2344
|
+
if (ae) return [0, 1];
|
|
2345
|
+
let X = 0, M = 0;
|
|
2346
|
+
for (const g of F)
|
|
2347
|
+
for (const k of g)
|
|
2348
|
+
k < X && (X = k), k > M && (M = k);
|
|
2349
|
+
for (const g of ne)
|
|
2350
|
+
for (const k of g)
|
|
2351
|
+
k < X && (X = k);
|
|
2352
|
+
return [Math.min(0, X), M];
|
|
2353
|
+
}, [F, ne, ae]);
|
|
2344
2354
|
return /* @__PURE__ */ s(
|
|
2345
2355
|
Ve,
|
|
2346
2356
|
{
|
|
2347
|
-
ref:
|
|
2357
|
+
ref: H,
|
|
2348
2358
|
aspectRatio: r,
|
|
2349
2359
|
height: o,
|
|
2350
|
-
className:
|
|
2351
|
-
style:
|
|
2352
|
-
classes:
|
|
2353
|
-
legend:
|
|
2354
|
-
overlay:
|
|
2360
|
+
className: U,
|
|
2361
|
+
style: C,
|
|
2362
|
+
classes: $,
|
|
2363
|
+
legend: f ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
|
|
2364
|
+
overlay: y && R !== null ? /* @__PURE__ */ s(
|
|
2355
2365
|
et,
|
|
2356
2366
|
{
|
|
2357
|
-
row: e[
|
|
2358
|
-
x: zc(e, t,
|
|
2367
|
+
row: e[R],
|
|
2368
|
+
x: zc(e, t, oe, R, H),
|
|
2359
2369
|
y: 16,
|
|
2360
|
-
containerWidth:
|
|
2370
|
+
containerWidth: H.current?.getBoundingClientRect().width ?? 0,
|
|
2361
2371
|
config: n,
|
|
2362
|
-
render:
|
|
2363
|
-
valueFormat:
|
|
2372
|
+
render: D ? () => D(e[R]) : void 0,
|
|
2373
|
+
valueFormat: ae ? (X) => `${Math.round(X * 100)}%` : N,
|
|
2364
2374
|
titleKey: t,
|
|
2365
|
-
classes:
|
|
2375
|
+
classes: $
|
|
2366
2376
|
}
|
|
2367
2377
|
) : null,
|
|
2368
|
-
children: ({ width:
|
|
2369
|
-
const
|
|
2370
|
-
return /* @__PURE__ */
|
|
2371
|
-
a && /* @__PURE__ */ s("defs", { children:
|
|
2378
|
+
children: ({ width: X, height: M }) => {
|
|
2379
|
+
const g = oe.left, k = X - oe.right, B = oe.top, _ = M - oe.bottom, J = Math.max(0, k - g), Y = Math.max(0, _ - B), b = e.map((p) => String(p[t])), E = Xe(b, [g, k], 0), V = ae ? [0, 0.25, 0.5, 0.75, 1] : qe(pe, K, L), de = Je([V[0], V[V.length - 1]], [_, B]), he = de(0), ye = V.map((p) => ({ value: p, y: de(p) })), Ce = Fc(b).map((p) => ({ label: p, x: E(p) })), Se = ae ? (p) => `${Math.round(p * 100)}%` : v;
|
|
2380
|
+
return /* @__PURE__ */ z(je, { children: [
|
|
2381
|
+
a && /* @__PURE__ */ s("defs", { children: ce.map((p) => /* @__PURE__ */ z(
|
|
2372
2382
|
"linearGradient",
|
|
2373
2383
|
{
|
|
2374
|
-
id: `${
|
|
2384
|
+
id: `${O}-${p}`,
|
|
2375
2385
|
x1: "0",
|
|
2376
2386
|
y1: "0",
|
|
2377
2387
|
x2: "0",
|
|
2378
2388
|
y2: "1",
|
|
2379
2389
|
children: [
|
|
2380
|
-
/* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[
|
|
2381
|
-
/* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[
|
|
2390
|
+
/* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[p].color, stopOpacity: 0.6 }),
|
|
2391
|
+
/* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[p].color, stopOpacity: 0.05 })
|
|
2382
2392
|
]
|
|
2383
2393
|
},
|
|
2384
|
-
|
|
2394
|
+
p
|
|
2385
2395
|
)) }),
|
|
2386
2396
|
d ? /* @__PURE__ */ s(
|
|
2387
2397
|
nn,
|
|
2388
2398
|
{
|
|
2389
2399
|
ticks: ye,
|
|
2390
|
-
x:
|
|
2391
|
-
plotWidth:
|
|
2400
|
+
x: g,
|
|
2401
|
+
plotWidth: J,
|
|
2392
2402
|
format: Se,
|
|
2393
2403
|
showGrid: h,
|
|
2394
|
-
classes:
|
|
2404
|
+
classes: $
|
|
2395
2405
|
}
|
|
2396
|
-
) : h && /* @__PURE__ */ s("g", { className:
|
|
2406
|
+
) : h && /* @__PURE__ */ s("g", { className: m(w.axis, $?.axis), children: ye.map(({ value: p, y: x }) => /* @__PURE__ */ s(
|
|
2397
2407
|
"line",
|
|
2398
2408
|
{
|
|
2399
|
-
className:
|
|
2400
|
-
x1:
|
|
2401
|
-
x2:
|
|
2402
|
-
y1:
|
|
2403
|
-
y2:
|
|
2409
|
+
className: m(w.gridLine, $?.grid),
|
|
2410
|
+
x1: g,
|
|
2411
|
+
x2: k,
|
|
2412
|
+
y1: x,
|
|
2413
|
+
y2: x
|
|
2404
2414
|
},
|
|
2405
|
-
`grid-${
|
|
2415
|
+
`grid-${p}`
|
|
2406
2416
|
)) }),
|
|
2407
|
-
u && /* @__PURE__ */ s(rn, { ticks: Ce, y:
|
|
2408
|
-
|
|
2409
|
-
const
|
|
2410
|
-
x:
|
|
2411
|
-
y: de(
|
|
2412
|
-
})),
|
|
2413
|
-
return /* @__PURE__ */
|
|
2417
|
+
u && /* @__PURE__ */ s(rn, { ticks: Ce, y: _, format: S, classes: $ }),
|
|
2418
|
+
ce.map((p, x) => {
|
|
2419
|
+
const ee = n[p], P = e.map((Q, T) => ({
|
|
2420
|
+
x: E(b[T]),
|
|
2421
|
+
y: de(F[x][T])
|
|
2422
|
+
})), G = a ? `url(#${O}-${p})` : ee.color, I = a ? 1 : 0.18, me = q ? Dt(P, ne[x].map((Q) => de(Q)), c) : Dt(P, he, c);
|
|
2423
|
+
return /* @__PURE__ */ z("g", { className: m(w.series, $?.series), children: [
|
|
2414
2424
|
/* @__PURE__ */ s(
|
|
2415
2425
|
"path",
|
|
2416
2426
|
{
|
|
2417
|
-
className:
|
|
2427
|
+
className: w.areaPath,
|
|
2418
2428
|
d: me,
|
|
2419
|
-
fill:
|
|
2420
|
-
fillOpacity:
|
|
2429
|
+
fill: G,
|
|
2430
|
+
fillOpacity: I
|
|
2421
2431
|
}
|
|
2422
2432
|
),
|
|
2423
|
-
/* @__PURE__ */ s("path", { className:
|
|
2424
|
-
!
|
|
2433
|
+
/* @__PURE__ */ s("path", { className: w.linePath, d: St(P, c), stroke: ee.color }),
|
|
2434
|
+
!q && P.map((Q, T) => /* @__PURE__ */ s(
|
|
2425
2435
|
"circle",
|
|
2426
2436
|
{
|
|
2427
|
-
className:
|
|
2428
|
-
cx:
|
|
2429
|
-
cy:
|
|
2430
|
-
r:
|
|
2431
|
-
fill:
|
|
2437
|
+
className: m(w.point, $?.point),
|
|
2438
|
+
cx: Q.x,
|
|
2439
|
+
cy: Q.y,
|
|
2440
|
+
r: R === T ? 5 : 3,
|
|
2441
|
+
fill: ee.color
|
|
2432
2442
|
},
|
|
2433
|
-
`${
|
|
2443
|
+
`${p}-${T}`
|
|
2434
2444
|
))
|
|
2435
|
-
] },
|
|
2445
|
+
] }, p);
|
|
2436
2446
|
}),
|
|
2437
|
-
|
|
2447
|
+
R !== null && /* @__PURE__ */ s(
|
|
2438
2448
|
"line",
|
|
2439
2449
|
{
|
|
2440
|
-
className:
|
|
2441
|
-
x1:
|
|
2442
|
-
x2:
|
|
2443
|
-
y1:
|
|
2444
|
-
y2:
|
|
2450
|
+
className: w.cursorLine,
|
|
2451
|
+
x1: E(b[R]),
|
|
2452
|
+
x2: E(b[R]),
|
|
2453
|
+
y1: B,
|
|
2454
|
+
y2: _
|
|
2445
2455
|
}
|
|
2446
2456
|
),
|
|
2447
2457
|
/* @__PURE__ */ s(
|
|
2448
2458
|
"rect",
|
|
2449
2459
|
{
|
|
2450
|
-
className:
|
|
2451
|
-
x:
|
|
2452
|
-
y:
|
|
2453
|
-
width:
|
|
2454
|
-
height:
|
|
2455
|
-
onMouseMove: (
|
|
2456
|
-
const
|
|
2457
|
-
|
|
2460
|
+
className: w.interactionLayer,
|
|
2461
|
+
x: g,
|
|
2462
|
+
y: B,
|
|
2463
|
+
width: J,
|
|
2464
|
+
height: Y,
|
|
2465
|
+
onMouseMove: (p) => {
|
|
2466
|
+
const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + g, P = E.step(), G = Math.max(0, Math.min(e.length - 1, Math.round((ee - g - P / 2) / P)));
|
|
2467
|
+
te(G);
|
|
2458
2468
|
},
|
|
2459
|
-
onMouseLeave: () =>
|
|
2469
|
+
onMouseLeave: () => te(null)
|
|
2460
2470
|
}
|
|
2461
2471
|
)
|
|
2462
2472
|
] });
|
|
@@ -2495,193 +2505,193 @@ function zl({
|
|
|
2495
2505
|
barRadius: h = 4,
|
|
2496
2506
|
showGrid: u = !0,
|
|
2497
2507
|
showLegend: d = !0,
|
|
2498
|
-
showTooltip:
|
|
2499
|
-
showValues:
|
|
2500
|
-
valuePosition:
|
|
2501
|
-
renderLabel:
|
|
2502
|
-
colorBy:
|
|
2508
|
+
showTooltip: f = !0,
|
|
2509
|
+
showValues: y = !1,
|
|
2510
|
+
valuePosition: L = "outside",
|
|
2511
|
+
renderLabel: v,
|
|
2512
|
+
colorBy: S = "series",
|
|
2503
2513
|
colors: N = jc,
|
|
2504
|
-
negativeColor:
|
|
2505
|
-
activeIndex:
|
|
2506
|
-
onBarClick:
|
|
2507
|
-
yTickCount:
|
|
2508
|
-
yFormat:
|
|
2509
|
-
xFormat:
|
|
2510
|
-
valueFormat:
|
|
2511
|
-
renderTooltip:
|
|
2512
|
-
margin:
|
|
2513
|
-
emptyMessage:
|
|
2514
|
-
className:
|
|
2515
|
-
style:
|
|
2516
|
-
classes:
|
|
2514
|
+
negativeColor: D,
|
|
2515
|
+
activeIndex: j,
|
|
2516
|
+
onBarClick: Z,
|
|
2517
|
+
yTickCount: U = 5,
|
|
2518
|
+
yFormat: C,
|
|
2519
|
+
xFormat: $,
|
|
2520
|
+
valueFormat: oe,
|
|
2521
|
+
renderTooltip: ce,
|
|
2522
|
+
margin: q,
|
|
2523
|
+
emptyMessage: ae = "No data",
|
|
2524
|
+
className: R,
|
|
2525
|
+
style: te,
|
|
2526
|
+
classes: H
|
|
2517
2527
|
}) {
|
|
2518
|
-
const
|
|
2528
|
+
const O = r === "horizontal", A = { ...O ? _c : Xc, ...q }, F = ke(() => Object.keys(n), [n]), ne = o && F.length > 1, [pe, K] = Le(null), X = re(null);
|
|
2519
2529
|
if (e.length === 0)
|
|
2520
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
2521
|
-
const M = e.map((
|
|
2522
|
-
if (
|
|
2530
|
+
return /* @__PURE__ */ s("div", { ref: X, className: m(w.root, H?.root, R), style: te, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: ae }) }) });
|
|
2531
|
+
const M = e.map((E) => String(E[t])), g = j ?? pe, k = ke(() => {
|
|
2532
|
+
if (ne) {
|
|
2523
2533
|
let he = 0, ye = 0;
|
|
2524
2534
|
for (const be of e) {
|
|
2525
2535
|
let Ce = 0, Se = 0;
|
|
2526
|
-
for (const
|
|
2527
|
-
const
|
|
2528
|
-
typeof
|
|
2536
|
+
for (const p of F) {
|
|
2537
|
+
const x = be[p];
|
|
2538
|
+
typeof x == "number" && (x >= 0 ? Ce += x : Se += x);
|
|
2529
2539
|
}
|
|
2530
2540
|
Ce > he && (he = Ce), Se < ye && (ye = Se);
|
|
2531
2541
|
}
|
|
2532
2542
|
return [ye, he];
|
|
2533
2543
|
}
|
|
2534
|
-
const
|
|
2544
|
+
const E = [];
|
|
2535
2545
|
for (const he of e)
|
|
2536
|
-
for (const ye of
|
|
2546
|
+
for (const ye of F) {
|
|
2537
2547
|
const be = he[ye];
|
|
2538
|
-
typeof be == "number" &&
|
|
2548
|
+
typeof be == "number" && E.push(be);
|
|
2539
2549
|
}
|
|
2540
|
-
const [
|
|
2541
|
-
return [Math.min(0,
|
|
2542
|
-
}, [e,
|
|
2550
|
+
const [V, de] = bt(E);
|
|
2551
|
+
return [Math.min(0, V), Math.max(0, de)];
|
|
2552
|
+
}, [e, F, ne]), B = qe(k[0], k[1], U), _ = B[0], J = B[B.length - 1], Y = (E, V) => S === "index" ? N[V % N.length] : n[E]?.color ?? N[0], b = f && g !== null && e[g] ? /* @__PURE__ */ s(
|
|
2543
2553
|
et,
|
|
2544
2554
|
{
|
|
2545
|
-
row: e[
|
|
2546
|
-
x: Vc(e, t,
|
|
2547
|
-
y:
|
|
2548
|
-
containerWidth:
|
|
2555
|
+
row: e[g],
|
|
2556
|
+
x: Vc(e, t, A, g, X, O, l),
|
|
2557
|
+
y: O ? qc(e, t, A, g, X, l) : 16,
|
|
2558
|
+
containerWidth: X.current?.getBoundingClientRect().width ?? 0,
|
|
2549
2559
|
config: n,
|
|
2550
|
-
render:
|
|
2551
|
-
valueFormat:
|
|
2560
|
+
render: ce ? () => ce(e[g]) : void 0,
|
|
2561
|
+
valueFormat: oe,
|
|
2552
2562
|
titleKey: t,
|
|
2553
|
-
resolveColor: (
|
|
2554
|
-
const
|
|
2555
|
-
return typeof
|
|
2563
|
+
resolveColor: (E) => {
|
|
2564
|
+
const V = e[g][E], de = Y(E, g);
|
|
2565
|
+
return typeof V != "number" ? de : D !== void 0 && V < 0 ? D : de;
|
|
2556
2566
|
},
|
|
2557
|
-
classes:
|
|
2567
|
+
classes: H
|
|
2558
2568
|
}
|
|
2559
2569
|
) : null;
|
|
2560
2570
|
return /* @__PURE__ */ s(
|
|
2561
2571
|
Ve,
|
|
2562
2572
|
{
|
|
2563
|
-
ref:
|
|
2573
|
+
ref: X,
|
|
2564
2574
|
aspectRatio: c,
|
|
2565
2575
|
height: i,
|
|
2566
|
-
className:
|
|
2567
|
-
style:
|
|
2568
|
-
classes:
|
|
2569
|
-
legend: d ? /* @__PURE__ */ s(vt, { config: n, classes:
|
|
2570
|
-
overlay:
|
|
2571
|
-
children: ({ width:
|
|
2572
|
-
const de =
|
|
2573
|
-
value:
|
|
2574
|
-
pos:
|
|
2576
|
+
className: R,
|
|
2577
|
+
style: te,
|
|
2578
|
+
classes: H,
|
|
2579
|
+
legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: H }) : void 0,
|
|
2580
|
+
overlay: b,
|
|
2581
|
+
children: ({ width: E, height: V }) => {
|
|
2582
|
+
const de = A.left, he = E - A.right, ye = A.top, be = V - A.bottom, Ce = Math.max(0, he - de), Se = Math.max(0, be - ye), x = Xe(M, O ? [ye, be] : [de, he], l), ee = x.bandWidth(), G = Je([_, J], O ? [de, he] : [be, ye]), I = G(0), me = ne ? 1 : Math.max(1, F.length), Q = ee / me, T = Q * (1 - a), le = B.map((ie) => ({
|
|
2583
|
+
value: ie,
|
|
2584
|
+
pos: G(ie)
|
|
2575
2585
|
})), ge = Uc(M);
|
|
2576
|
-
return /* @__PURE__ */
|
|
2577
|
-
u && /* @__PURE__ */ s("g", { className:
|
|
2578
|
-
({ value:
|
|
2586
|
+
return /* @__PURE__ */ z(je, { children: [
|
|
2587
|
+
u && /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: le.map(
|
|
2588
|
+
({ value: ie, pos: ue }) => O ? /* @__PURE__ */ s(
|
|
2579
2589
|
"line",
|
|
2580
2590
|
{
|
|
2581
|
-
className:
|
|
2591
|
+
className: m(w.gridLine, H?.grid),
|
|
2582
2592
|
x1: ue,
|
|
2583
2593
|
x2: ue,
|
|
2584
2594
|
y1: ye,
|
|
2585
2595
|
y2: be
|
|
2586
2596
|
},
|
|
2587
|
-
`g-${
|
|
2597
|
+
`g-${ie}`
|
|
2588
2598
|
) : /* @__PURE__ */ s(
|
|
2589
2599
|
"line",
|
|
2590
2600
|
{
|
|
2591
|
-
className:
|
|
2601
|
+
className: m(w.gridLine, H?.grid),
|
|
2592
2602
|
x1: de,
|
|
2593
2603
|
x2: he,
|
|
2594
2604
|
y1: ue,
|
|
2595
2605
|
y2: ue
|
|
2596
2606
|
},
|
|
2597
|
-
`g-${
|
|
2607
|
+
`g-${ie}`
|
|
2598
2608
|
)
|
|
2599
2609
|
) }),
|
|
2600
|
-
/* @__PURE__ */ s("g", { className:
|
|
2601
|
-
const Ae =
|
|
2602
|
-
return
|
|
2610
|
+
/* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: le.map(({ value: ie, pos: ue }) => {
|
|
2611
|
+
const Ae = C ? C(ie) : String(ie);
|
|
2612
|
+
return O ? /* @__PURE__ */ s(
|
|
2603
2613
|
"text",
|
|
2604
2614
|
{
|
|
2605
|
-
className:
|
|
2615
|
+
className: m(w.axisLabel, H?.axisLabel),
|
|
2606
2616
|
x: ue,
|
|
2607
2617
|
y: be + 16,
|
|
2608
2618
|
textAnchor: "middle",
|
|
2609
2619
|
children: Ae
|
|
2610
2620
|
},
|
|
2611
|
-
`vt-${
|
|
2621
|
+
`vt-${ie}`
|
|
2612
2622
|
) : /* @__PURE__ */ s(
|
|
2613
2623
|
"text",
|
|
2614
2624
|
{
|
|
2615
|
-
className:
|
|
2625
|
+
className: m(w.axisLabel, H?.axisLabel),
|
|
2616
2626
|
x: de - 8,
|
|
2617
2627
|
y: ue,
|
|
2618
2628
|
textAnchor: "end",
|
|
2619
2629
|
dominantBaseline: "middle",
|
|
2620
2630
|
children: Ae
|
|
2621
2631
|
},
|
|
2622
|
-
`vt-${
|
|
2632
|
+
`vt-${ie}`
|
|
2623
2633
|
);
|
|
2624
2634
|
}) }),
|
|
2625
|
-
/* @__PURE__ */ s("g", { className:
|
|
2626
|
-
const ue =
|
|
2627
|
-
return
|
|
2635
|
+
/* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: ge.map((ie) => {
|
|
2636
|
+
const ue = x(ie), Ae = $ ? $(ie) : ie;
|
|
2637
|
+
return O ? /* @__PURE__ */ s(
|
|
2628
2638
|
"text",
|
|
2629
2639
|
{
|
|
2630
|
-
className:
|
|
2640
|
+
className: m(w.axisLabel, H?.axisLabel),
|
|
2631
2641
|
x: de - 8,
|
|
2632
2642
|
y: ue,
|
|
2633
2643
|
textAnchor: "end",
|
|
2634
2644
|
dominantBaseline: "middle",
|
|
2635
2645
|
children: Ae
|
|
2636
2646
|
},
|
|
2637
|
-
`c-${
|
|
2647
|
+
`c-${ie}`
|
|
2638
2648
|
) : /* @__PURE__ */ s(
|
|
2639
2649
|
"text",
|
|
2640
2650
|
{
|
|
2641
|
-
className:
|
|
2651
|
+
className: m(w.axisLabel, H?.axisLabel),
|
|
2642
2652
|
x: ue,
|
|
2643
2653
|
y: be + 16,
|
|
2644
2654
|
textAnchor: "middle",
|
|
2645
2655
|
children: Ae
|
|
2646
2656
|
},
|
|
2647
|
-
`c-${
|
|
2657
|
+
`c-${ie}`
|
|
2648
2658
|
);
|
|
2649
2659
|
}) }),
|
|
2650
|
-
e.map((
|
|
2651
|
-
const De =
|
|
2652
|
-
let xe = 0,
|
|
2653
|
-
return /* @__PURE__ */ s("g", { className:
|
|
2654
|
-
const Ge =
|
|
2660
|
+
e.map((ie, ue) => {
|
|
2661
|
+
const De = x(M[ue]) - ee / 2;
|
|
2662
|
+
let xe = 0, se = 0;
|
|
2663
|
+
return /* @__PURE__ */ s("g", { className: m(w.series, H?.series), children: F.map((Ie, He) => {
|
|
2664
|
+
const Ge = ie[Ie];
|
|
2655
2665
|
if (typeof Ge != "number") return null;
|
|
2656
|
-
const Ee = Ge, xt =
|
|
2666
|
+
const Ee = Ge, xt = Y(Ie, ue), kt = D !== void 0 && Ee < 0 ? D : xt, Oe = j !== void 0 ? j === ue : pe === ue, tt = j !== void 0 && !Oe;
|
|
2657
2667
|
let nt, _e;
|
|
2658
|
-
|
|
2659
|
-
const rt =
|
|
2668
|
+
ne ? Ee >= 0 ? (nt = xe, _e = xe + Ee, xe = _e) : (nt = se, _e = se + Ee, se = _e) : (nt = 0, _e = Ee);
|
|
2669
|
+
const rt = G(nt), ot = G(_e), Bt = ne ? (ee - T) / 2 : He * Q + (Q - T) / 2;
|
|
2660
2670
|
let it = 0, ct = 0, lt = 0, st = 0;
|
|
2661
|
-
if (
|
|
2662
|
-
const Ze = Math.min(rt, ot),
|
|
2663
|
-
it = Ze, lt =
|
|
2671
|
+
if (O) {
|
|
2672
|
+
const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
|
|
2673
|
+
it = Ze, lt = wt - Ze, ct = De + Bt, st = T;
|
|
2664
2674
|
} else {
|
|
2665
|
-
const Ze = Math.min(rt, ot),
|
|
2666
|
-
it = De + Bt, lt =
|
|
2675
|
+
const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
|
|
2676
|
+
it = De + Bt, lt = T, ct = Ze, st = wt - Ze;
|
|
2667
2677
|
}
|
|
2668
|
-
const
|
|
2669
|
-
isHorizontal:
|
|
2670
|
-
valuePosition:
|
|
2678
|
+
const Mt = v ? v({ row: ie, value: Ee, seriesKey: Ie, index: ue }) : y ? oe ? oe(Ee) : String(Ee) : null, Fe = Yc({
|
|
2679
|
+
isHorizontal: O,
|
|
2680
|
+
valuePosition: L,
|
|
2671
2681
|
x: it,
|
|
2672
2682
|
y: ct,
|
|
2673
2683
|
rectW: lt,
|
|
2674
2684
|
rectH: st,
|
|
2675
2685
|
value: Ee
|
|
2676
2686
|
});
|
|
2677
|
-
return /* @__PURE__ */
|
|
2687
|
+
return /* @__PURE__ */ z("g", { children: [
|
|
2678
2688
|
/* @__PURE__ */ s(
|
|
2679
2689
|
"rect",
|
|
2680
2690
|
{
|
|
2681
|
-
className:
|
|
2682
|
-
|
|
2683
|
-
Oe &&
|
|
2684
|
-
|
|
2691
|
+
className: m(
|
|
2692
|
+
w.bar,
|
|
2693
|
+
Oe && w.activeBar,
|
|
2694
|
+
H?.point
|
|
2685
2695
|
),
|
|
2686
2696
|
x: it,
|
|
2687
2697
|
y: ct,
|
|
@@ -2691,16 +2701,16 @@ function zl({
|
|
|
2691
2701
|
ry: h,
|
|
2692
2702
|
fill: kt,
|
|
2693
2703
|
opacity: tt ? 0.35 : 1,
|
|
2694
|
-
onClick:
|
|
2695
|
-
style:
|
|
2704
|
+
onClick: Z ? () => Z({ row: ie, value: Ee, seriesKey: Ie, index: ue }) : void 0,
|
|
2705
|
+
style: Z ? { cursor: "pointer" } : void 0
|
|
2696
2706
|
}
|
|
2697
2707
|
),
|
|
2698
|
-
|
|
2708
|
+
Mt != null && /* @__PURE__ */ s(
|
|
2699
2709
|
"text",
|
|
2700
2710
|
{
|
|
2701
|
-
className:
|
|
2702
|
-
|
|
2703
|
-
(
|
|
2711
|
+
className: m(
|
|
2712
|
+
w.axisLabel,
|
|
2713
|
+
(L === "inside" || L === "inside-start") && w.barLabelInside
|
|
2704
2714
|
),
|
|
2705
2715
|
x: Fe.x,
|
|
2706
2716
|
y: Fe.y,
|
|
@@ -2708,39 +2718,39 @@ function zl({
|
|
|
2708
2718
|
dominantBaseline: Fe.dominantBaseline,
|
|
2709
2719
|
transform: Fe.rotate ? `rotate(${Fe.rotate} ${Fe.x} ${Fe.y})` : void 0,
|
|
2710
2720
|
opacity: tt ? 0.5 : 1,
|
|
2711
|
-
children:
|
|
2721
|
+
children: Mt
|
|
2712
2722
|
}
|
|
2713
2723
|
)
|
|
2714
2724
|
] }, Ie);
|
|
2715
2725
|
}) }, `group-${ue}`);
|
|
2716
2726
|
}),
|
|
2717
|
-
|
|
2727
|
+
_ < 0 && J > 0 && /* @__PURE__ */ s(
|
|
2718
2728
|
"line",
|
|
2719
2729
|
{
|
|
2720
|
-
className:
|
|
2721
|
-
x1:
|
|
2722
|
-
x2:
|
|
2723
|
-
y1:
|
|
2724
|
-
y2:
|
|
2730
|
+
className: m(w.gridLine),
|
|
2731
|
+
x1: O ? I : de,
|
|
2732
|
+
x2: O ? I : he,
|
|
2733
|
+
y1: O ? ye : I,
|
|
2734
|
+
y2: O ? be : I,
|
|
2725
2735
|
opacity: 0.9
|
|
2726
2736
|
}
|
|
2727
2737
|
),
|
|
2728
2738
|
/* @__PURE__ */ s(
|
|
2729
2739
|
"rect",
|
|
2730
2740
|
{
|
|
2731
|
-
className:
|
|
2741
|
+
className: w.interactionLayer,
|
|
2732
2742
|
x: de,
|
|
2733
2743
|
y: ye,
|
|
2734
2744
|
width: Ce,
|
|
2735
2745
|
height: Se,
|
|
2736
|
-
onMouseMove: (
|
|
2737
|
-
const ue =
|
|
2746
|
+
onMouseMove: (ie) => {
|
|
2747
|
+
const ue = ie.currentTarget.getBoundingClientRect(), Ae = ie.clientX - ue.left + de, De = ie.clientY - ue.top + ye, xe = x.step(), se = O ? De - ye : Ae - de, Ie = Math.max(
|
|
2738
2748
|
0,
|
|
2739
|
-
Math.min(e.length - 1, Math.round((
|
|
2749
|
+
Math.min(e.length - 1, Math.round((se - xe / 2) / xe))
|
|
2740
2750
|
);
|
|
2741
|
-
|
|
2751
|
+
K(Ie);
|
|
2742
2752
|
},
|
|
2743
|
-
onMouseLeave: () =>
|
|
2753
|
+
onMouseLeave: () => K(null)
|
|
2744
2754
|
}
|
|
2745
2755
|
)
|
|
2746
2756
|
] });
|
|
@@ -2840,21 +2850,21 @@ function Zc(e, t, n, r, o, c) {
|
|
|
2840
2850
|
`A ${n} ${n} 0 1 1 ${e + n} ${t}`,
|
|
2841
2851
|
"Z"
|
|
2842
2852
|
].join(" ");
|
|
2843
|
-
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), u = t + n * Math.sin(i), d = e + n * Math.cos(l),
|
|
2853
|
+
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), u = t + n * Math.sin(i), d = e + n * Math.cos(l), f = t + n * Math.sin(l);
|
|
2844
2854
|
if (r > 0) {
|
|
2845
|
-
const
|
|
2855
|
+
const y = e + r * Math.cos(l), L = t + r * Math.sin(l), v = e + r * Math.cos(i), S = t + r * Math.sin(i);
|
|
2846
2856
|
return [
|
|
2847
2857
|
`M ${h} ${u}`,
|
|
2848
|
-
`A ${n} ${n} 0 ${a} 1 ${d} ${
|
|
2849
|
-
`L ${
|
|
2850
|
-
`A ${r} ${r} 0 ${a} 0 ${
|
|
2858
|
+
`A ${n} ${n} 0 ${a} 1 ${d} ${f}`,
|
|
2859
|
+
`L ${y} ${L}`,
|
|
2860
|
+
`A ${r} ${r} 0 ${a} 0 ${v} ${S}`,
|
|
2851
2861
|
"Z"
|
|
2852
2862
|
].join(" ");
|
|
2853
2863
|
}
|
|
2854
2864
|
return [
|
|
2855
2865
|
`M ${e} ${t}`,
|
|
2856
2866
|
`L ${h} ${u}`,
|
|
2857
|
-
`A ${n} ${n} 0 ${a} 1 ${d} ${
|
|
2867
|
+
`A ${n} ${n} 0 ${a} 1 ${d} ${f}`,
|
|
2858
2868
|
"Z"
|
|
2859
2869
|
].join(" ");
|
|
2860
2870
|
}
|
|
@@ -2875,96 +2885,96 @@ function jl({
|
|
|
2875
2885
|
strokeWidth: h = 2,
|
|
2876
2886
|
strokeColor: u = "var(--crk-color-bg)",
|
|
2877
2887
|
padAngle: d = 0,
|
|
2878
|
-
showLabels:
|
|
2879
|
-
valuePosition:
|
|
2880
|
-
showLabelLines:
|
|
2881
|
-
renderLabel:
|
|
2882
|
-
centerLabel:
|
|
2888
|
+
showLabels: f = !1,
|
|
2889
|
+
valuePosition: y = "outside",
|
|
2890
|
+
showLabelLines: L = !0,
|
|
2891
|
+
renderLabel: v,
|
|
2892
|
+
centerLabel: S,
|
|
2883
2893
|
activeIndex: N,
|
|
2884
|
-
onSliceClick:
|
|
2885
|
-
showLegend:
|
|
2886
|
-
showTooltip:
|
|
2887
|
-
valueFormat:
|
|
2888
|
-
renderTooltip:
|
|
2889
|
-
emptyMessage:
|
|
2890
|
-
className:
|
|
2891
|
-
style:
|
|
2892
|
-
classes:
|
|
2894
|
+
onSliceClick: D,
|
|
2895
|
+
showLegend: j = !0,
|
|
2896
|
+
showTooltip: Z = !0,
|
|
2897
|
+
valueFormat: U,
|
|
2898
|
+
renderTooltip: C,
|
|
2899
|
+
emptyMessage: $ = "No data",
|
|
2900
|
+
className: oe,
|
|
2901
|
+
style: ce,
|
|
2902
|
+
classes: q
|
|
2893
2903
|
}) {
|
|
2894
|
-
const [
|
|
2904
|
+
const [ae, R] = Le(null), te = re(null), H = N ?? ae, O = (K) => {
|
|
2895
2905
|
if (r) {
|
|
2896
|
-
const
|
|
2897
|
-
if (typeof
|
|
2906
|
+
const X = e[K]?.[r];
|
|
2907
|
+
if (typeof X == "string") return X;
|
|
2898
2908
|
}
|
|
2899
|
-
return o[
|
|
2900
|
-
},
|
|
2901
|
-
let
|
|
2902
|
-
for (const
|
|
2903
|
-
const M =
|
|
2904
|
-
typeof M == "number" && M > 0 && (
|
|
2909
|
+
return o[K % o.length];
|
|
2910
|
+
}, A = ke(() => {
|
|
2911
|
+
let K = 0;
|
|
2912
|
+
for (const X of e) {
|
|
2913
|
+
const M = X[t];
|
|
2914
|
+
typeof M == "number" && M > 0 && (K += M);
|
|
2905
2915
|
}
|
|
2906
|
-
return
|
|
2916
|
+
return K;
|
|
2907
2917
|
}, [e, t]);
|
|
2908
|
-
if (e.length === 0 ||
|
|
2909
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
2910
|
-
const
|
|
2911
|
-
const
|
|
2912
|
-
let
|
|
2918
|
+
if (e.length === 0 || A === 0)
|
|
2919
|
+
return /* @__PURE__ */ s("div", { ref: te, className: m(w.root, q?.root, oe), style: ce, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: $ }) }) });
|
|
2920
|
+
const F = ke(() => {
|
|
2921
|
+
const K = [];
|
|
2922
|
+
let X = 0;
|
|
2913
2923
|
for (let M = 0; M < e.length; M++) {
|
|
2914
|
-
const
|
|
2915
|
-
if (
|
|
2916
|
-
const
|
|
2917
|
-
|
|
2924
|
+
const g = e[M], k = g[t], B = typeof k == "number" && k > 0 ? k : 0;
|
|
2925
|
+
if (B === 0) continue;
|
|
2926
|
+
const _ = B / A, J = _ * 360;
|
|
2927
|
+
K.push({ index: M, row: g, value: B, start: X, end: X + J, fraction: _ }), X += J;
|
|
2918
2928
|
}
|
|
2919
|
-
return
|
|
2920
|
-
}, [e, t,
|
|
2929
|
+
return K;
|
|
2930
|
+
}, [e, t, A]), ne = j ? /* @__PURE__ */ s("div", { className: m(w.legend, q?.legend), role: "list", children: F.map((K) => /* @__PURE__ */ z("div", { className: m(w.legendItem, q?.legendItem), role: "listitem", children: [
|
|
2921
2931
|
/* @__PURE__ */ s(
|
|
2922
2932
|
"span",
|
|
2923
2933
|
{
|
|
2924
|
-
className:
|
|
2925
|
-
style: { background:
|
|
2934
|
+
className: w.legendSwatch,
|
|
2935
|
+
style: { background: O(K.index) },
|
|
2926
2936
|
"aria-hidden": "true"
|
|
2927
2937
|
}
|
|
2928
2938
|
),
|
|
2929
|
-
/* @__PURE__ */ s("span", { className:
|
|
2930
|
-
] },
|
|
2931
|
-
const
|
|
2932
|
-
for (const
|
|
2933
|
-
|
|
2934
|
-
label: String(
|
|
2935
|
-
color:
|
|
2939
|
+
/* @__PURE__ */ s("span", { className: w.legendLabel, children: String(K.row[n]) })
|
|
2940
|
+
] }, K.index)) }) : void 0, pe = ke(() => {
|
|
2941
|
+
const K = {};
|
|
2942
|
+
for (const X of F)
|
|
2943
|
+
K[X.index.toString()] = {
|
|
2944
|
+
label: String(X.row[n]),
|
|
2945
|
+
color: O(X.index)
|
|
2936
2946
|
};
|
|
2937
|
-
return
|
|
2938
|
-
}, [
|
|
2947
|
+
return K;
|
|
2948
|
+
}, [F]);
|
|
2939
2949
|
return /* @__PURE__ */ s(
|
|
2940
2950
|
Ve,
|
|
2941
2951
|
{
|
|
2942
|
-
ref:
|
|
2952
|
+
ref: te,
|
|
2943
2953
|
aspectRatio: c,
|
|
2944
2954
|
height: i,
|
|
2945
|
-
className:
|
|
2946
|
-
style:
|
|
2947
|
-
classes:
|
|
2948
|
-
legend:
|
|
2949
|
-
overlay:
|
|
2955
|
+
className: oe,
|
|
2956
|
+
style: ce,
|
|
2957
|
+
classes: q,
|
|
2958
|
+
legend: ne,
|
|
2959
|
+
overlay: Z && H !== null && e[H] ? /* @__PURE__ */ s(
|
|
2950
2960
|
et,
|
|
2951
2961
|
{
|
|
2952
|
-
row: { [
|
|
2953
|
-
x:
|
|
2962
|
+
row: { [H.toString()]: e[H][t] },
|
|
2963
|
+
x: te.current ? te.current.getBoundingClientRect().width / 2 : 0,
|
|
2954
2964
|
y: 16,
|
|
2955
|
-
containerWidth:
|
|
2956
|
-
config: { [
|
|
2957
|
-
render:
|
|
2958
|
-
valueFormat:
|
|
2965
|
+
containerWidth: te.current?.getBoundingClientRect().width ?? 0,
|
|
2966
|
+
config: { [H.toString()]: pe[H.toString()] },
|
|
2967
|
+
render: C ? () => C(e[H]) : void 0,
|
|
2968
|
+
valueFormat: U,
|
|
2959
2969
|
titleKey: void 0,
|
|
2960
|
-
classes:
|
|
2970
|
+
classes: q
|
|
2961
2971
|
}
|
|
2962
2972
|
) : null,
|
|
2963
|
-
children: ({ width:
|
|
2964
|
-
const M =
|
|
2965
|
-
return /* @__PURE__ */
|
|
2966
|
-
/* @__PURE__ */ s("g", { children:
|
|
2967
|
-
const
|
|
2973
|
+
children: ({ width: K, height: X }) => {
|
|
2974
|
+
const M = K / 2, g = X / 2, k = Math.min(K, X) / 2 - 4, B = Et(a, k), _ = Math.min(B - 1, Et(l, k)), J = Math.max(4, B * 0.06);
|
|
2975
|
+
return /* @__PURE__ */ z(je, { children: [
|
|
2976
|
+
/* @__PURE__ */ s("g", { children: F.map((Y) => {
|
|
2977
|
+
const b = d / 2, E = Math.min(Y.end, Y.start + b), V = Math.max(Y.start, Y.end - b), de = O(Y.index), he = H === Y.index, ye = N !== void 0 && !he, be = he && N !== void 0 ? B + J : B, Ce = Zc(M, g, be, _, E, V), Se = D ? () => D({ row: Y.row, value: Y.value, index: Y.index }) : void 0;
|
|
2968
2978
|
return /* @__PURE__ */ s(
|
|
2969
2979
|
"path",
|
|
2970
2980
|
{
|
|
@@ -2973,24 +2983,24 @@ function jl({
|
|
|
2973
2983
|
stroke: h > 0 ? u : "none",
|
|
2974
2984
|
strokeWidth: h,
|
|
2975
2985
|
opacity: ye ? 0.45 : 1,
|
|
2976
|
-
onMouseEnter: () =>
|
|
2977
|
-
onMouseLeave: () =>
|
|
2986
|
+
onMouseEnter: () => R(Y.index),
|
|
2987
|
+
onMouseLeave: () => R(null),
|
|
2978
2988
|
onClick: Se,
|
|
2979
2989
|
style: Se ? { cursor: "pointer" } : void 0
|
|
2980
2990
|
},
|
|
2981
|
-
|
|
2991
|
+
Y.index
|
|
2982
2992
|
);
|
|
2983
2993
|
}) }),
|
|
2984
|
-
(
|
|
2985
|
-
const
|
|
2986
|
-
if (
|
|
2987
|
-
const
|
|
2994
|
+
(f || v) && F.map((Y) => {
|
|
2995
|
+
const b = v ? v({ row: Y.row, value: Y.value, fraction: Y.fraction, index: Y.index }) : f ? `${String(Y.row[n])} ${U ? U(Y.value) : Math.round(Y.fraction * 100) + "%"}` : null;
|
|
2996
|
+
if (b == null) return null;
|
|
2997
|
+
const E = y === "inside", V = Math.max(16, B * 0.12), de = E ? (B + _) / 2 : B + V, he = Pt(M, g, de, Y.start, Y.end), ye = E ? "middle" : he.x < M - 1 ? "end" : he.x > M + 1 ? "start" : "middle";
|
|
2988
2998
|
let be = null;
|
|
2989
|
-
if (!
|
|
2990
|
-
const Ce = Pt(M,
|
|
2991
|
-
be = { x1: Ce.x, y1: Ce.y, x2: he.x +
|
|
2999
|
+
if (!E && L) {
|
|
3000
|
+
const Ce = Pt(M, g, B, Y.start, Y.end), Se = 4, p = ye === "end" ? Se : ye === "start" ? -Se : 0;
|
|
3001
|
+
be = { x1: Ce.x, y1: Ce.y, x2: he.x + p, y2: he.y };
|
|
2992
3002
|
}
|
|
2993
|
-
return /* @__PURE__ */
|
|
3003
|
+
return /* @__PURE__ */ z("g", { children: [
|
|
2994
3004
|
be && /* @__PURE__ */ s(
|
|
2995
3005
|
"line",
|
|
2996
3006
|
{
|
|
@@ -2998,7 +3008,7 @@ function jl({
|
|
|
2998
3008
|
y1: be.y1,
|
|
2999
3009
|
x2: be.x2,
|
|
3000
3010
|
y2: be.y2,
|
|
3001
|
-
stroke: Y
|
|
3011
|
+
stroke: O(Y.index),
|
|
3002
3012
|
strokeWidth: 1,
|
|
3003
3013
|
opacity: 0.7
|
|
3004
3014
|
}
|
|
@@ -3008,24 +3018,24 @@ function jl({
|
|
|
3008
3018
|
{
|
|
3009
3019
|
x: he.x,
|
|
3010
3020
|
y: he.y,
|
|
3011
|
-
className:
|
|
3012
|
-
|
|
3013
|
-
|
|
3021
|
+
className: m(
|
|
3022
|
+
w.axisLabel,
|
|
3023
|
+
E && w.barLabelInside
|
|
3014
3024
|
),
|
|
3015
3025
|
textAnchor: ye,
|
|
3016
3026
|
dominantBaseline: "middle",
|
|
3017
|
-
children:
|
|
3027
|
+
children: b
|
|
3018
3028
|
}
|
|
3019
3029
|
)
|
|
3020
|
-
] }, `label-${
|
|
3030
|
+
] }, `label-${Y.index}`);
|
|
3021
3031
|
}),
|
|
3022
|
-
|
|
3032
|
+
S !== void 0 && /* @__PURE__ */ s(
|
|
3023
3033
|
"foreignObject",
|
|
3024
3034
|
{
|
|
3025
|
-
x: M -
|
|
3026
|
-
y:
|
|
3027
|
-
width: Math.max(0,
|
|
3028
|
-
height: Math.max(0,
|
|
3035
|
+
x: M - _,
|
|
3036
|
+
y: g - _,
|
|
3037
|
+
width: Math.max(0, _ * 2),
|
|
3038
|
+
height: Math.max(0, _ * 2),
|
|
3029
3039
|
style: { pointerEvents: "none" },
|
|
3030
3040
|
children: /* @__PURE__ */ s(
|
|
3031
3041
|
"div",
|
|
@@ -3041,7 +3051,7 @@ function jl({
|
|
|
3041
3051
|
color: "var(--crk-color-text)",
|
|
3042
3052
|
fontFamily: "var(--crk-font-family)"
|
|
3043
3053
|
},
|
|
3044
|
-
children:
|
|
3054
|
+
children: S
|
|
3045
3055
|
}
|
|
3046
3056
|
)
|
|
3047
3057
|
}
|
|
@@ -3074,186 +3084,186 @@ function Xl({
|
|
|
3074
3084
|
showRadiusAxis: h = !1,
|
|
3075
3085
|
levels: u = 5,
|
|
3076
3086
|
showPoints: d = !0,
|
|
3077
|
-
fillOpacity:
|
|
3078
|
-
strokeWidth:
|
|
3079
|
-
renderAxisLabel:
|
|
3080
|
-
axisFormat:
|
|
3081
|
-
valueFormat:
|
|
3087
|
+
fillOpacity: f = 0.4,
|
|
3088
|
+
strokeWidth: y = 2,
|
|
3089
|
+
renderAxisLabel: L,
|
|
3090
|
+
axisFormat: v,
|
|
3091
|
+
valueFormat: S,
|
|
3082
3092
|
renderTooltip: N,
|
|
3083
|
-
showLegend:
|
|
3084
|
-
showTooltip:
|
|
3085
|
-
emptyMessage:
|
|
3086
|
-
className:
|
|
3087
|
-
style:
|
|
3088
|
-
classes:
|
|
3093
|
+
showLegend: D = !0,
|
|
3094
|
+
showTooltip: j = !0,
|
|
3095
|
+
emptyMessage: Z = "No data",
|
|
3096
|
+
className: U,
|
|
3097
|
+
style: C,
|
|
3098
|
+
classes: $
|
|
3089
3099
|
}) {
|
|
3090
|
-
const [
|
|
3100
|
+
const [oe, ce] = Le(null), q = re(null), ae = ke(() => Object.keys(n), [n]);
|
|
3091
3101
|
if (e.length === 0)
|
|
3092
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
3093
|
-
const
|
|
3094
|
-
() => e.map((
|
|
3102
|
+
return /* @__PURE__ */ s("div", { ref: q, className: m(w.root, $?.root, U), style: C, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: Z }) }) });
|
|
3103
|
+
const R = ke(
|
|
3104
|
+
() => e.map((A, F) => F / e.length * 360),
|
|
3095
3105
|
[e]
|
|
3096
|
-
),
|
|
3097
|
-
const
|
|
3098
|
-
for (const
|
|
3106
|
+
), te = ke(() => {
|
|
3107
|
+
const A = [];
|
|
3108
|
+
for (const ne of ae)
|
|
3099
3109
|
for (const pe of e) {
|
|
3100
|
-
const
|
|
3101
|
-
typeof
|
|
3110
|
+
const K = pe[ne];
|
|
3111
|
+
typeof K == "number" && A.push(K);
|
|
3102
3112
|
}
|
|
3103
|
-
const [,
|
|
3104
|
-
return Math.max(1,
|
|
3105
|
-
}, [e,
|
|
3113
|
+
const [, F] = bt(A);
|
|
3114
|
+
return Math.max(1, F);
|
|
3115
|
+
}, [e, ae]), H = ke(() => qe(0, te, u).filter((F) => F > 0), [te, u]), O = H[H.length - 1] ?? te;
|
|
3106
3116
|
return /* @__PURE__ */ s(
|
|
3107
3117
|
Ve,
|
|
3108
3118
|
{
|
|
3109
|
-
ref:
|
|
3119
|
+
ref: q,
|
|
3110
3120
|
aspectRatio: r,
|
|
3111
3121
|
height: o,
|
|
3112
|
-
className:
|
|
3113
|
-
style:
|
|
3114
|
-
classes:
|
|
3115
|
-
legend:
|
|
3116
|
-
overlay:
|
|
3122
|
+
className: U,
|
|
3123
|
+
style: C,
|
|
3124
|
+
classes: $,
|
|
3125
|
+
legend: D ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
|
|
3126
|
+
overlay: j && oe !== null ? /* @__PURE__ */ s(
|
|
3117
3127
|
et,
|
|
3118
3128
|
{
|
|
3119
|
-
row: e[
|
|
3120
|
-
x: (
|
|
3129
|
+
row: e[oe],
|
|
3130
|
+
x: (q.current?.getBoundingClientRect().width ?? 0) / 2,
|
|
3121
3131
|
y: 16,
|
|
3122
|
-
containerWidth:
|
|
3132
|
+
containerWidth: q.current?.getBoundingClientRect().width ?? 0,
|
|
3123
3133
|
config: n,
|
|
3124
|
-
render: N ? () => N(e[
|
|
3125
|
-
valueFormat:
|
|
3134
|
+
render: N ? () => N(e[oe]) : void 0,
|
|
3135
|
+
valueFormat: S,
|
|
3126
3136
|
titleKey: t,
|
|
3127
|
-
classes:
|
|
3137
|
+
classes: $
|
|
3128
3138
|
}
|
|
3129
3139
|
) : null,
|
|
3130
|
-
children: ({ width:
|
|
3131
|
-
const
|
|
3132
|
-
return /* @__PURE__ */
|
|
3133
|
-
i &&
|
|
3134
|
-
const
|
|
3140
|
+
children: ({ width: A, height: F }) => {
|
|
3141
|
+
const ne = a ? 32 : 8, pe = A / 2, K = F / 2, X = Math.max(0, Math.min(A, F) / 2 - ne), M = (g) => Math.max(0, g) / O * X;
|
|
3142
|
+
return /* @__PURE__ */ z(je, { children: [
|
|
3143
|
+
i && H.map((g) => {
|
|
3144
|
+
const k = M(g);
|
|
3135
3145
|
return c === "circle" ? /* @__PURE__ */ s(
|
|
3136
3146
|
"circle",
|
|
3137
3147
|
{
|
|
3138
|
-
className:
|
|
3148
|
+
className: m(w.gridLine, $?.grid),
|
|
3139
3149
|
cx: pe,
|
|
3140
|
-
cy:
|
|
3141
|
-
r:
|
|
3150
|
+
cy: K,
|
|
3151
|
+
r: k,
|
|
3142
3152
|
fill: "none"
|
|
3143
3153
|
},
|
|
3144
|
-
`ring-${
|
|
3154
|
+
`ring-${g}`
|
|
3145
3155
|
) : /* @__PURE__ */ s(
|
|
3146
3156
|
"polygon",
|
|
3147
3157
|
{
|
|
3148
|
-
className:
|
|
3149
|
-
points: Kc(pe,
|
|
3158
|
+
className: m(w.gridLine, $?.grid),
|
|
3159
|
+
points: Kc(pe, K, k, R),
|
|
3150
3160
|
fill: "none"
|
|
3151
3161
|
},
|
|
3152
|
-
`ring-${
|
|
3162
|
+
`ring-${g}`
|
|
3153
3163
|
);
|
|
3154
3164
|
}),
|
|
3155
|
-
l &&
|
|
3156
|
-
const
|
|
3165
|
+
l && R.map((g, k) => {
|
|
3166
|
+
const B = mt(pe, K, X, g);
|
|
3157
3167
|
return /* @__PURE__ */ s(
|
|
3158
3168
|
"line",
|
|
3159
3169
|
{
|
|
3160
|
-
className:
|
|
3170
|
+
className: m(w.gridLine, $?.grid),
|
|
3161
3171
|
x1: pe,
|
|
3162
|
-
y1:
|
|
3163
|
-
x2:
|
|
3164
|
-
y2:
|
|
3172
|
+
y1: K,
|
|
3173
|
+
x2: B.x,
|
|
3174
|
+
y2: B.y
|
|
3165
3175
|
},
|
|
3166
|
-
`spoke-${
|
|
3176
|
+
`spoke-${k}`
|
|
3167
3177
|
);
|
|
3168
3178
|
}),
|
|
3169
|
-
h &&
|
|
3170
|
-
const
|
|
3179
|
+
h && H.map((g) => {
|
|
3180
|
+
const k = M(g);
|
|
3171
3181
|
return /* @__PURE__ */ s(
|
|
3172
3182
|
"text",
|
|
3173
3183
|
{
|
|
3174
|
-
className:
|
|
3184
|
+
className: m(w.axisLabel, $?.axisLabel),
|
|
3175
3185
|
x: pe + 4,
|
|
3176
|
-
y:
|
|
3186
|
+
y: K - k,
|
|
3177
3187
|
textAnchor: "start",
|
|
3178
3188
|
dominantBaseline: "middle",
|
|
3179
|
-
children:
|
|
3189
|
+
children: S ? S(g) : g
|
|
3180
3190
|
},
|
|
3181
|
-
`raxis-${
|
|
3191
|
+
`raxis-${g}`
|
|
3182
3192
|
);
|
|
3183
3193
|
}),
|
|
3184
|
-
a && e.map((
|
|
3185
|
-
const
|
|
3186
|
-
if (
|
|
3187
|
-
return /* @__PURE__ */ s("g", { children:
|
|
3188
|
-
row:
|
|
3189
|
-
index:
|
|
3190
|
-
angle:
|
|
3191
|
-
x:
|
|
3192
|
-
y:
|
|
3193
|
-
textAnchor:
|
|
3194
|
-
}) }, `label-${
|
|
3195
|
-
const
|
|
3194
|
+
a && e.map((g, k) => {
|
|
3195
|
+
const B = R[k], _ = mt(pe, K, X + 14, B), J = _.x < pe - 1 ? "end" : _.x > pe + 1 ? "start" : "middle";
|
|
3196
|
+
if (L)
|
|
3197
|
+
return /* @__PURE__ */ s("g", { children: L({
|
|
3198
|
+
row: g,
|
|
3199
|
+
index: k,
|
|
3200
|
+
angle: B,
|
|
3201
|
+
x: _.x,
|
|
3202
|
+
y: _.y,
|
|
3203
|
+
textAnchor: J
|
|
3204
|
+
}) }, `label-${k}`);
|
|
3205
|
+
const Y = String(g[t]), b = v ? v(Y) : Y;
|
|
3196
3206
|
return /* @__PURE__ */ s(
|
|
3197
3207
|
"text",
|
|
3198
3208
|
{
|
|
3199
|
-
className:
|
|
3200
|
-
x:
|
|
3201
|
-
y:
|
|
3202
|
-
textAnchor:
|
|
3209
|
+
className: m(w.axisLabel, $?.axisLabel),
|
|
3210
|
+
x: _.x,
|
|
3211
|
+
y: _.y,
|
|
3212
|
+
textAnchor: J,
|
|
3203
3213
|
dominantBaseline: "middle",
|
|
3204
|
-
children:
|
|
3214
|
+
children: b
|
|
3205
3215
|
},
|
|
3206
|
-
`label-${
|
|
3216
|
+
`label-${k}`
|
|
3207
3217
|
);
|
|
3208
3218
|
}),
|
|
3209
|
-
|
|
3210
|
-
const
|
|
3211
|
-
const
|
|
3212
|
-
return mt(pe,
|
|
3213
|
-
}),
|
|
3214
|
-
return /* @__PURE__ */
|
|
3219
|
+
ae.map((g) => {
|
|
3220
|
+
const k = n[g], B = e.map((J, Y) => {
|
|
3221
|
+
const b = J[g], V = M(typeof b == "number" ? b : 0);
|
|
3222
|
+
return mt(pe, K, V, R[Y]);
|
|
3223
|
+
}), _ = B.map((J) => `${J.x},${J.y}`).join(" ");
|
|
3224
|
+
return /* @__PURE__ */ z("g", { className: m(w.series, $?.series), children: [
|
|
3215
3225
|
/* @__PURE__ */ s(
|
|
3216
3226
|
"polygon",
|
|
3217
3227
|
{
|
|
3218
|
-
points:
|
|
3219
|
-
fill:
|
|
3220
|
-
fillOpacity:
|
|
3221
|
-
stroke:
|
|
3222
|
-
strokeWidth:
|
|
3228
|
+
points: _,
|
|
3229
|
+
fill: k.color,
|
|
3230
|
+
fillOpacity: f,
|
|
3231
|
+
stroke: k.color,
|
|
3232
|
+
strokeWidth: y,
|
|
3223
3233
|
strokeLinejoin: "round",
|
|
3224
3234
|
strokeLinecap: "round"
|
|
3225
3235
|
}
|
|
3226
3236
|
),
|
|
3227
|
-
d &&
|
|
3237
|
+
d && B.map((J, Y) => /* @__PURE__ */ s(
|
|
3228
3238
|
"circle",
|
|
3229
3239
|
{
|
|
3230
|
-
className:
|
|
3231
|
-
cx:
|
|
3232
|
-
cy:
|
|
3233
|
-
r:
|
|
3234
|
-
fill:
|
|
3240
|
+
className: m(w.point, $?.point),
|
|
3241
|
+
cx: J.x,
|
|
3242
|
+
cy: J.y,
|
|
3243
|
+
r: oe === Y ? 5 : 3.5,
|
|
3244
|
+
fill: k.color
|
|
3235
3245
|
},
|
|
3236
|
-
`${
|
|
3246
|
+
`${g}-${Y}`
|
|
3237
3247
|
))
|
|
3238
|
-
] },
|
|
3248
|
+
] }, g);
|
|
3239
3249
|
}),
|
|
3240
3250
|
/* @__PURE__ */ s(
|
|
3241
3251
|
"rect",
|
|
3242
3252
|
{
|
|
3243
|
-
className:
|
|
3253
|
+
className: w.interactionLayer,
|
|
3244
3254
|
x: 0,
|
|
3245
3255
|
y: 0,
|
|
3246
|
-
width:
|
|
3247
|
-
height:
|
|
3248
|
-
onMouseMove: (
|
|
3249
|
-
const
|
|
3250
|
-
if (
|
|
3251
|
-
let
|
|
3252
|
-
|
|
3253
|
-
const
|
|
3254
|
-
|
|
3256
|
+
width: A,
|
|
3257
|
+
height: F,
|
|
3258
|
+
onMouseMove: (g) => {
|
|
3259
|
+
const k = g.currentTarget.getBoundingClientRect(), B = g.clientX - k.left - pe, _ = g.clientY - k.top - K;
|
|
3260
|
+
if (B === 0 && _ === 0) return;
|
|
3261
|
+
let J = Math.atan2(_, B) * 180 / Math.PI + 90;
|
|
3262
|
+
J < 0 && (J += 360), J >= 360 && (J -= 360);
|
|
3263
|
+
const Y = 360 / e.length, b = Math.round(J / Y) % e.length;
|
|
3264
|
+
ce(b);
|
|
3255
3265
|
},
|
|
3256
|
-
onMouseLeave: () =>
|
|
3266
|
+
onMouseLeave: () => ce(null)
|
|
3257
3267
|
}
|
|
3258
3268
|
)
|
|
3259
3269
|
] });
|
|
@@ -3288,12 +3298,12 @@ function el(e, t, n = 2) {
|
|
|
3288
3298
|
if (t <= 0 || r < t) return { middle: o, upper: c, lower: i };
|
|
3289
3299
|
for (let l = t - 1; l < r; l++) {
|
|
3290
3300
|
let a = 0;
|
|
3291
|
-
for (let
|
|
3301
|
+
for (let f = l - t + 1; f <= l; f++) a += e[f].close;
|
|
3292
3302
|
const h = a / t;
|
|
3293
3303
|
let u = 0;
|
|
3294
|
-
for (let
|
|
3295
|
-
const
|
|
3296
|
-
u +=
|
|
3304
|
+
for (let f = l - t + 1; f <= l; f++) {
|
|
3305
|
+
const y = e[f].close - h;
|
|
3306
|
+
u += y * y;
|
|
3297
3307
|
}
|
|
3298
3308
|
u /= t;
|
|
3299
3309
|
const d = Math.sqrt(u);
|
|
@@ -3391,209 +3401,209 @@ function Vl({
|
|
|
3391
3401
|
upColor: h = "var(--crk-color-success)",
|
|
3392
3402
|
downColor: u = "var(--crk-color-danger)",
|
|
3393
3403
|
lineColor: d = "var(--crk-chart-1)",
|
|
3394
|
-
timezone:
|
|
3395
|
-
defaultTimezone:
|
|
3396
|
-
onTimezoneChange:
|
|
3397
|
-
showConfigPanel:
|
|
3398
|
-
onCrosshair:
|
|
3404
|
+
timezone: f,
|
|
3405
|
+
defaultTimezone: y = "local",
|
|
3406
|
+
onTimezoneChange: L,
|
|
3407
|
+
showConfigPanel: v = !0,
|
|
3408
|
+
onCrosshair: S,
|
|
3399
3409
|
onVisibleRangeChange: N,
|
|
3400
|
-
className:
|
|
3401
|
-
style:
|
|
3410
|
+
className: D,
|
|
3411
|
+
style: j
|
|
3402
3412
|
}) {
|
|
3403
|
-
const
|
|
3404
|
-
}),
|
|
3405
|
-
|
|
3406
|
-
const [
|
|
3407
|
-
(
|
|
3408
|
-
|
|
3413
|
+
const Z = re(null), U = re(null), C = re([]), $ = re({ from: 0, to: 0 }), oe = re(null), ce = re(null), q = re(!1), ae = re(null), R = re(null), te = re(1), H = re({ width: 0, height: 0 }), O = re(() => {
|
|
3414
|
+
}), A = re(S), F = re(N);
|
|
3415
|
+
A.current = S, F.current = N;
|
|
3416
|
+
const [ne, pe] = Le(null), [K, X] = Le(y), M = f ?? K, g = fe(
|
|
3417
|
+
(p) => {
|
|
3418
|
+
f === void 0 && X(p), L?.(p);
|
|
3409
3419
|
},
|
|
3410
|
-
[
|
|
3411
|
-
),
|
|
3420
|
+
[f, L]
|
|
3421
|
+
), k = ke(
|
|
3412
3422
|
() => ({ up: h, down: u, line: d }),
|
|
3413
3423
|
[h, u, d]
|
|
3414
|
-
),
|
|
3415
|
-
const
|
|
3416
|
-
if (!
|
|
3417
|
-
const
|
|
3418
|
-
if (!
|
|
3419
|
-
const { width:
|
|
3420
|
-
if (
|
|
3421
|
-
const
|
|
3422
|
-
|
|
3423
|
-
const
|
|
3424
|
-
if (
|
|
3425
|
-
gl(
|
|
3424
|
+
), B = c, _ = B.some((p) => p.type === "rsi"), J = B.some((p) => p.type === "volume"), Y = fe(() => {
|
|
3425
|
+
const p = U.current;
|
|
3426
|
+
if (!p) return;
|
|
3427
|
+
const x = p.getContext("2d");
|
|
3428
|
+
if (!x) return;
|
|
3429
|
+
const { width: ee, height: P } = H.current;
|
|
3430
|
+
if (ee === 0 || P === 0) return;
|
|
3431
|
+
const G = te.current;
|
|
3432
|
+
x.save(), x.setTransform(1, 0, 0, 1, 0, 0), x.clearRect(0, 0, p.width, p.height), x.scale(G, G);
|
|
3433
|
+
const I = pl(Z.current, k), me = ln(Z.current), Q = C.current;
|
|
3434
|
+
if (Q.length === 0) {
|
|
3435
|
+
gl(x, ee, P, I), x.restore();
|
|
3426
3436
|
return;
|
|
3427
3437
|
}
|
|
3428
|
-
const
|
|
3429
|
-
|
|
3430
|
-
const
|
|
3431
|
-
const Ie = ge -
|
|
3432
|
-
return
|
|
3433
|
-
}, Ae =
|
|
3434
|
-
Lt(
|
|
3435
|
-
for (let
|
|
3436
|
-
const Ie =
|
|
3437
|
-
He && kl(
|
|
3438
|
+
const T = Nt(ee, P, _, J), { from: le, to: ge } = hl($.current, Q.length);
|
|
3439
|
+
$.current = { from: le, to: ge };
|
|
3440
|
+
const ie = Q.slice(Math.max(0, Math.floor(le)), Math.min(Q.length, Math.ceil(ge) + 1)), ue = (se) => {
|
|
3441
|
+
const Ie = ge - le + 1, He = T.plotWidth / Ie;
|
|
3442
|
+
return T.plotLeft + (se - le + 0.5) * He;
|
|
3443
|
+
}, Ae = T.plotWidth / (ge - le + 1), De = B.map((se) => ml(se, Q)).filter((se) => se !== null).map((se) => ({ ...se, color: me(se.color) })), xe = cn(T.main, ie, De, le, ge);
|
|
3444
|
+
Lt(x, T.plotLeft, T.plotRight, xe, I), yl(x, T, xe, i, I), x.save(), x.beginPath(), x.rect(T.plotLeft, xe.paneTop, T.plotWidth, xe.paneHeight), x.clip();
|
|
3445
|
+
for (let se = 0; se < B.length; se++) {
|
|
3446
|
+
const Ie = B[se], He = De[se];
|
|
3447
|
+
He && kl(x, He, Ie, Q, le, ge, ue, xe);
|
|
3438
3448
|
}
|
|
3439
|
-
if (o === "candle" ? vl(
|
|
3440
|
-
const
|
|
3441
|
-
Lt(
|
|
3449
|
+
if (o === "candle" ? vl(x, Q, le, ge, ue, Ae, xe, { up: I.up, down: I.down }) : o === "bar" ? bl(x, Q, le, ge, ue, Ae, xe, { up: I.up, down: I.down }) : xl(x, Q, le, ge, ue, xe, I.line, o === "area"), x.restore(), T.volume) {
|
|
3450
|
+
const se = fl(T.volume, Q, le, ge);
|
|
3451
|
+
Lt(x, T.plotLeft, T.plotRight, se, I, !0), Ft(x, T, T.volume, "Volume", I), x.save(), x.beginPath(), x.rect(T.plotLeft, se.paneTop, T.plotWidth, se.paneHeight), x.clip(), Ml(x, Q, le, ge, ue, Ae, se, { up: I.up, down: I.down }), x.restore();
|
|
3442
3452
|
}
|
|
3443
|
-
if (
|
|
3444
|
-
const
|
|
3445
|
-
paneTop:
|
|
3446
|
-
paneBottom:
|
|
3447
|
-
paneHeight:
|
|
3453
|
+
if (T.rsi) {
|
|
3454
|
+
const se = B.find((tt) => tt.type === "rsi"), Ie = se && se.type === "rsi" ? se.period ?? 14 : 14, He = se && se.type === "rsi" ? se.overbought ?? 70 : 70, Ge = se && se.type === "rsi" ? se.oversold ?? 30 : 30, Ee = (se && se.type === "rsi" ? se.color : void 0) ?? "var(--crk-chart-5)", xt = me(Ee), kt = tl(Q, Ie), Oe = {
|
|
3455
|
+
paneTop: T.rsi.top,
|
|
3456
|
+
paneBottom: T.rsi.bottom,
|
|
3457
|
+
paneHeight: T.rsi.height,
|
|
3448
3458
|
priceMin: 0,
|
|
3449
3459
|
priceMax: 100,
|
|
3450
3460
|
ticks: [Ge, 50, He]
|
|
3451
3461
|
};
|
|
3452
|
-
Lt(
|
|
3462
|
+
Lt(x, T.plotLeft, T.plotRight, Oe, I, !0), Ft(x, T, T.rsi, `RSI ${Ie}`, I), x.save(), x.beginPath(), x.rect(T.plotLeft, Oe.paneTop, T.plotWidth, Oe.paneHeight), x.clip(), Qe(x, kt, le, ge, ue, Oe, xt), x.restore(), wl(x, T, Oe, He, Ge, I);
|
|
3453
3463
|
}
|
|
3454
|
-
$l(
|
|
3455
|
-
}, [o,
|
|
3456
|
-
|
|
3457
|
-
const
|
|
3458
|
-
if (
|
|
3464
|
+
$l(x, T, Q, le, ge, n, I), oe.current && Nl(x, T, oe.current, Q, le, ge, ue, i, xe, M, I), x.restore();
|
|
3465
|
+
}, [o, B, _, J, i, k, n, M]);
|
|
3466
|
+
O.current = Y;
|
|
3467
|
+
const b = fe(() => {
|
|
3468
|
+
if (R.current === null) {
|
|
3459
3469
|
if (typeof requestAnimationFrame > "u") {
|
|
3460
|
-
|
|
3470
|
+
O.current();
|
|
3461
3471
|
return;
|
|
3462
3472
|
}
|
|
3463
|
-
|
|
3464
|
-
|
|
3473
|
+
R.current = requestAnimationFrame(() => {
|
|
3474
|
+
R.current = null, O.current();
|
|
3465
3475
|
});
|
|
3466
3476
|
}
|
|
3467
3477
|
}, []);
|
|
3468
3478
|
jt(() => {
|
|
3469
|
-
const
|
|
3470
|
-
if (!
|
|
3471
|
-
const
|
|
3472
|
-
const
|
|
3473
|
-
|
|
3474
|
-
const
|
|
3475
|
-
|
|
3479
|
+
const p = Z.current;
|
|
3480
|
+
if (!p) return;
|
|
3481
|
+
const x = () => {
|
|
3482
|
+
const P = p.getBoundingClientRect(), G = typeof window < "u" && window.devicePixelRatio || 1;
|
|
3483
|
+
te.current = G, H.current = { width: P.width, height: P.height };
|
|
3484
|
+
const I = U.current;
|
|
3485
|
+
I && (I.width = Math.round(P.width * G), I.height = Math.round(P.height * G), I.style.width = `${P.width}px`, I.style.height = `${P.height}px`), b();
|
|
3476
3486
|
};
|
|
3477
|
-
if (
|
|
3478
|
-
const
|
|
3479
|
-
return
|
|
3480
|
-
}, [
|
|
3481
|
-
let
|
|
3482
|
-
const
|
|
3483
|
-
|
|
3484
|
-
if (
|
|
3485
|
-
const
|
|
3486
|
-
|
|
3487
|
-
const
|
|
3487
|
+
if (x(), typeof ResizeObserver > "u") return;
|
|
3488
|
+
const ee = new ResizeObserver(x);
|
|
3489
|
+
return ee.observe(p), () => ee.disconnect();
|
|
3490
|
+
}, [b]), Ne(() => {
|
|
3491
|
+
let p = !1;
|
|
3492
|
+
const x = Math.floor(Date.now() / 1e3), ee = zt(n), P = r !== void 0 ? on(r) : ee * l, G = r !== void 0 ? Math.max(10, Math.ceil(P / ee)) : l, I = x - P;
|
|
3493
|
+
C.current = [], $.current = { from: 0, to: 0 }, b(), e.getBars({ symbol: t, resolution: n, from: I, to: x, countBack: G }).then((Q) => {
|
|
3494
|
+
if (p) return;
|
|
3495
|
+
const T = [...Q].sort((ge, ie) => ge.time - ie.time);
|
|
3496
|
+
C.current = T;
|
|
3497
|
+
const le = T.length - 1;
|
|
3488
3498
|
if (r !== void 0)
|
|
3489
|
-
|
|
3499
|
+
$.current = { from: 0, to: le };
|
|
3490
3500
|
else {
|
|
3491
|
-
const ge = Math.min(
|
|
3492
|
-
|
|
3493
|
-
from: Math.max(0,
|
|
3494
|
-
to:
|
|
3501
|
+
const ge = Math.min(T.length, Math.min(200, l));
|
|
3502
|
+
$.current = {
|
|
3503
|
+
from: Math.max(0, le - ge + 1),
|
|
3504
|
+
to: le
|
|
3495
3505
|
};
|
|
3496
3506
|
}
|
|
3497
|
-
|
|
3507
|
+
F.current?.($.current, T), b();
|
|
3498
3508
|
}).catch(() => {
|
|
3499
3509
|
});
|
|
3500
3510
|
const me = e.subscribeBars({
|
|
3501
3511
|
symbol: t,
|
|
3502
3512
|
resolution: n,
|
|
3503
|
-
onTick: (
|
|
3504
|
-
if (
|
|
3505
|
-
const
|
|
3506
|
-
if (
|
|
3507
|
-
|
|
3508
|
-
else if (!
|
|
3509
|
-
|
|
3510
|
-
const ge =
|
|
3511
|
-
ge.to >=
|
|
3513
|
+
onTick: (Q) => {
|
|
3514
|
+
if (p) return;
|
|
3515
|
+
const T = C.current, le = T[T.length - 1];
|
|
3516
|
+
if (le && le.time === Q.time)
|
|
3517
|
+
T[T.length - 1] = Q;
|
|
3518
|
+
else if (!le || Q.time > le.time) {
|
|
3519
|
+
T.push(Q);
|
|
3520
|
+
const ge = $.current;
|
|
3521
|
+
ge.to >= T.length - 2 && ($.current = { from: ge.from + 1, to: ge.to + 1 });
|
|
3512
3522
|
}
|
|
3513
|
-
|
|
3523
|
+
b();
|
|
3514
3524
|
}
|
|
3515
3525
|
});
|
|
3516
|
-
return
|
|
3517
|
-
|
|
3526
|
+
return ae.current = me, () => {
|
|
3527
|
+
p = !0, ae.current !== null && (e.unsubscribeBars(ae.current), ae.current = null);
|
|
3518
3528
|
};
|
|
3519
3529
|
}, [e, t, n, r, l]);
|
|
3520
|
-
const
|
|
3521
|
-
pe(
|
|
3522
|
-
}, []),
|
|
3523
|
-
|
|
3524
|
-
const
|
|
3525
|
-
|
|
3530
|
+
const E = fe((p) => {
|
|
3531
|
+
pe(p), A.current?.(p);
|
|
3532
|
+
}, []), V = fe((p) => {
|
|
3533
|
+
p.currentTarget.setPointerCapture(p.pointerId);
|
|
3534
|
+
const x = $.current;
|
|
3535
|
+
ce.current = { startX: p.clientX, from: x.from, to: x.to };
|
|
3526
3536
|
}, []), de = fe(
|
|
3527
|
-
(
|
|
3528
|
-
const
|
|
3529
|
-
if (
|
|
3530
|
-
const { startX: me, from:
|
|
3531
|
-
let De =
|
|
3532
|
-
const
|
|
3533
|
-
De < 0 && (Se(), De = 0, xe =
|
|
3537
|
+
(p) => {
|
|
3538
|
+
const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left, P = p.clientY - x.top;
|
|
3539
|
+
if (oe.current = { x: ee, y: P }, ce.current) {
|
|
3540
|
+
const { startX: me, from: Q, to: T } = ce.current, { width: le } = H.current, ge = Math.max(1, le - Ct), ie = T - Q + 1, ue = ge / ie, Ae = -(p.clientX - me) / ue;
|
|
3541
|
+
let De = Q + Ae, xe = T + Ae;
|
|
3542
|
+
const se = C.current.length;
|
|
3543
|
+
De < 0 && (Se(), De = 0, xe = ie - 1), xe > se - 1 && (xe = se - 1, De = xe - ie + 1), $.current = { from: De, to: xe }, F.current?.($.current, C.current);
|
|
3534
3544
|
}
|
|
3535
|
-
const
|
|
3536
|
-
if (
|
|
3537
|
-
const me =
|
|
3538
|
-
|
|
3545
|
+
const G = Nt(x.width, x.height, _, J), I = $.current;
|
|
3546
|
+
if (ee >= G.plotLeft && ee <= G.plotRight) {
|
|
3547
|
+
const me = I.to - I.from + 1, Q = G.plotWidth / me, T = Math.round(I.from + (ee - G.plotLeft) / Q - 0.5), le = C.current, ge = Math.max(0, Math.min(le.length - 1, T)), ie = le[ge] ?? null, ue = Ll(P, G, le, I.from, I.to);
|
|
3548
|
+
E({ barIndex: ge, bar: ie, priceAtCursor: ue });
|
|
3539
3549
|
} else
|
|
3540
|
-
|
|
3541
|
-
|
|
3550
|
+
E(null);
|
|
3551
|
+
b();
|
|
3542
3552
|
},
|
|
3543
|
-
[
|
|
3544
|
-
), he = fe((
|
|
3545
|
-
|
|
3553
|
+
[_, J, b, E]
|
|
3554
|
+
), he = fe((p) => {
|
|
3555
|
+
p.currentTarget.releasePointerCapture(p.pointerId), ce.current = null;
|
|
3546
3556
|
}, []), ye = fe(() => {
|
|
3547
|
-
|
|
3548
|
-
}, [
|
|
3549
|
-
(
|
|
3550
|
-
|
|
3551
|
-
const
|
|
3552
|
-
if (
|
|
3553
|
-
const me =
|
|
3554
|
-
|
|
3555
|
-
Math.min(
|
|
3556
|
-
),
|
|
3557
|
-
let
|
|
3558
|
-
|
|
3557
|
+
oe.current = null, ce.current = null, E(null), b();
|
|
3558
|
+
}, [b, E]), be = fe(
|
|
3559
|
+
(p) => {
|
|
3560
|
+
p.preventDefault();
|
|
3561
|
+
const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left, P = Nt(x.width, x.height, _, J), G = $.current, I = C.current;
|
|
3562
|
+
if (I.length === 0) return;
|
|
3563
|
+
const me = G.to - G.from + 1, Q = p.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot), T = Math.max(
|
|
3564
|
+
P.plotWidth / cl,
|
|
3565
|
+
Math.min(I.length, P.plotWidth / il, me * Q)
|
|
3566
|
+
), le = G.from + (ee - P.plotLeft) / (P.plotWidth / me), ge = (le - G.from) / me;
|
|
3567
|
+
let ie = le - ge * T, ue = ie + T - 1;
|
|
3568
|
+
ie < 0 && (ie = 0, ue = T - 1), ue > I.length - 1 && (ue = I.length - 1, ie = ue - T + 1), $.current = { from: ie, to: ue }, F.current?.($.current, I), b();
|
|
3559
3569
|
},
|
|
3560
|
-
[
|
|
3570
|
+
[_, J, b]
|
|
3561
3571
|
), Ce = fe(
|
|
3562
|
-
(
|
|
3563
|
-
const
|
|
3564
|
-
if (
|
|
3565
|
-
let
|
|
3566
|
-
if (
|
|
3567
|
-
else if (
|
|
3572
|
+
(p) => {
|
|
3573
|
+
const x = $.current, ee = x.to - x.from + 1, P = C.current;
|
|
3574
|
+
if (P.length === 0) return;
|
|
3575
|
+
let G = 0;
|
|
3576
|
+
if (p.key === "ArrowLeft") G = -Math.max(1, Math.floor(ee * 0.1));
|
|
3577
|
+
else if (p.key === "ArrowRight") G = Math.max(1, Math.floor(ee * 0.1));
|
|
3568
3578
|
else return;
|
|
3569
|
-
|
|
3570
|
-
let
|
|
3571
|
-
|
|
3579
|
+
p.preventDefault();
|
|
3580
|
+
let I = x.from + G, me = x.to + G;
|
|
3581
|
+
I < 0 && (I = 0, me = ee - 1), me > P.length - 1 && (me = P.length - 1, I = me - ee + 1), $.current = { from: I, to: me }, F.current?.($.current, P), b();
|
|
3572
3582
|
},
|
|
3573
|
-
[
|
|
3583
|
+
[b]
|
|
3574
3584
|
), Se = fe(() => {
|
|
3575
|
-
if (
|
|
3576
|
-
const
|
|
3577
|
-
if (
|
|
3578
|
-
|
|
3579
|
-
const
|
|
3580
|
-
e.getBars({ symbol: t, resolution: n, from:
|
|
3581
|
-
if (
|
|
3582
|
-
|
|
3585
|
+
if (q.current) return;
|
|
3586
|
+
const p = C.current;
|
|
3587
|
+
if (p.length === 0) return;
|
|
3588
|
+
q.current = !0;
|
|
3589
|
+
const x = zt(n), ee = p[0].time, P = ee - x * l, G = ee - x;
|
|
3590
|
+
e.getBars({ symbol: t, resolution: n, from: P, to: G, countBack: l }).then((I) => {
|
|
3591
|
+
if (I.length === 0) {
|
|
3592
|
+
q.current = !1;
|
|
3583
3593
|
return;
|
|
3584
3594
|
}
|
|
3585
|
-
const
|
|
3586
|
-
|
|
3595
|
+
const Q = [...I].sort((le, ge) => le.time - ge.time).filter((le) => le.time < ee), T = $.current;
|
|
3596
|
+
C.current = [...Q, ...p], $.current = { from: T.from + Q.length, to: T.to + Q.length }, q.current = !1, b();
|
|
3587
3597
|
}).catch(() => {
|
|
3588
|
-
|
|
3598
|
+
q.current = !1;
|
|
3589
3599
|
});
|
|
3590
|
-
}, [e, t, n, l,
|
|
3591
|
-
return /* @__PURE__ */
|
|
3600
|
+
}, [e, t, n, l, b]);
|
|
3601
|
+
return /* @__PURE__ */ z(
|
|
3592
3602
|
"div",
|
|
3593
3603
|
{
|
|
3594
|
-
ref:
|
|
3595
|
-
className:
|
|
3596
|
-
style: { ...
|
|
3604
|
+
ref: Z,
|
|
3605
|
+
className: m(w.root, D),
|
|
3606
|
+
style: { ...j, height: a, position: "relative" },
|
|
3597
3607
|
tabIndex: 0,
|
|
3598
3608
|
role: "figure",
|
|
3599
3609
|
"aria-label": `${t} ${n} chart`,
|
|
@@ -3602,20 +3612,20 @@ function Vl({
|
|
|
3602
3612
|
/* @__PURE__ */ s(
|
|
3603
3613
|
"canvas",
|
|
3604
3614
|
{
|
|
3605
|
-
ref:
|
|
3606
|
-
className:
|
|
3607
|
-
onPointerDown:
|
|
3615
|
+
ref: U,
|
|
3616
|
+
className: w.svg,
|
|
3617
|
+
onPointerDown: V,
|
|
3608
3618
|
onPointerMove: de,
|
|
3609
3619
|
onPointerUp: he,
|
|
3610
3620
|
onPointerLeave: ye,
|
|
3611
3621
|
onWheel: be,
|
|
3612
|
-
style: { cursor:
|
|
3622
|
+
style: { cursor: ce.current ? "grabbing" : "crosshair", touchAction: "none" }
|
|
3613
3623
|
}
|
|
3614
3624
|
),
|
|
3615
|
-
/* @__PURE__ */
|
|
3625
|
+
/* @__PURE__ */ z(
|
|
3616
3626
|
"div",
|
|
3617
3627
|
{
|
|
3618
|
-
className:
|
|
3628
|
+
className: w.tradingHeader,
|
|
3619
3629
|
style: {
|
|
3620
3630
|
position: "absolute",
|
|
3621
3631
|
top: ol,
|
|
@@ -3628,22 +3638,22 @@ function Vl({
|
|
|
3628
3638
|
gap: 8
|
|
3629
3639
|
},
|
|
3630
3640
|
children: [
|
|
3631
|
-
/* @__PURE__ */
|
|
3641
|
+
/* @__PURE__ */ z("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
|
|
3632
3642
|
/* @__PURE__ */ s("strong", { children: t }),
|
|
3633
3643
|
/* @__PURE__ */ s("span", { style: { color: "var(--crk-color-text-muted)" }, children: n }),
|
|
3634
|
-
|
|
3644
|
+
ne?.bar && /* @__PURE__ */ z("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
|
|
3635
3645
|
"O ",
|
|
3636
|
-
|
|
3646
|
+
ne.bar.open.toFixed(i),
|
|
3637
3647
|
" · H ",
|
|
3638
|
-
|
|
3648
|
+
ne.bar.high.toFixed(i),
|
|
3639
3649
|
" · L",
|
|
3640
3650
|
" ",
|
|
3641
|
-
|
|
3651
|
+
ne.bar.low.toFixed(i),
|
|
3642
3652
|
" · C ",
|
|
3643
|
-
|
|
3653
|
+
ne.bar.close.toFixed(i)
|
|
3644
3654
|
] })
|
|
3645
3655
|
] }),
|
|
3646
|
-
|
|
3656
|
+
v && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
|
|
3647
3657
|
qt,
|
|
3648
3658
|
{
|
|
3649
3659
|
position: "bottom",
|
|
@@ -3662,7 +3672,7 @@ function Vl({
|
|
|
3662
3672
|
dl,
|
|
3663
3673
|
{
|
|
3664
3674
|
timezone: M,
|
|
3665
|
-
onTimezoneChange:
|
|
3675
|
+
onTimezoneChange: g
|
|
3666
3676
|
}
|
|
3667
3677
|
)
|
|
3668
3678
|
}
|
|
@@ -3688,7 +3698,7 @@ function dl({
|
|
|
3688
3698
|
timezone: e,
|
|
3689
3699
|
onTimezoneChange: t
|
|
3690
3700
|
}) {
|
|
3691
|
-
return /* @__PURE__ */
|
|
3701
|
+
return /* @__PURE__ */ z("div", { style: { minWidth: 220, padding: 4 }, children: [
|
|
3692
3702
|
/* @__PURE__ */ s(
|
|
3693
3703
|
"div",
|
|
3694
3704
|
{
|
|
@@ -3700,7 +3710,7 @@ function dl({
|
|
|
3700
3710
|
children: "Settings"
|
|
3701
3711
|
}
|
|
3702
3712
|
),
|
|
3703
|
-
/* @__PURE__ */
|
|
3713
|
+
/* @__PURE__ */ z("label", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "4px" }, children: [
|
|
3704
3714
|
/* @__PURE__ */ s("span", { style: { fontSize: "var(--crk-font-size-xs)", color: "var(--crk-color-text-muted)" }, children: "Timezone" }),
|
|
3705
3715
|
/* @__PURE__ */ s(
|
|
3706
3716
|
Vt,
|
|
@@ -3714,7 +3724,7 @@ function dl({
|
|
|
3714
3724
|
] });
|
|
3715
3725
|
}
|
|
3716
3726
|
function ul() {
|
|
3717
|
-
return /* @__PURE__ */
|
|
3727
|
+
return /* @__PURE__ */ z(
|
|
3718
3728
|
"svg",
|
|
3719
3729
|
{
|
|
3720
3730
|
viewBox: "0 0 24 24",
|
|
@@ -3734,10 +3744,10 @@ function ul() {
|
|
|
3734
3744
|
function Nt(e, t, n, r) {
|
|
3735
3745
|
const c = Math.max(0, e - Ct), i = rl, l = Math.max(i, t - At), a = Math.max(0, c - 0), h = Math.max(0, l - i);
|
|
3736
3746
|
let u = h, d = i;
|
|
3737
|
-
const
|
|
3738
|
-
let
|
|
3739
|
-
const
|
|
3740
|
-
return u = h * (1 -
|
|
3747
|
+
const f = { top: i, bottom: l, height: h };
|
|
3748
|
+
let y = null, L = null;
|
|
3749
|
+
const v = n ? Ht.rsi : 0, S = r ? Ht.volume : 0;
|
|
3750
|
+
return u = h * (1 - v - S), f.top = d, f.height = u, f.bottom = f.top + u, d = f.bottom, n && (y = { top: d, height: h * v, bottom: d + h * v }, d = y.bottom), r && (L = { top: d, height: h * S, bottom: d + h * S }), { width: e, height: t, plotLeft: 0, plotRight: c, plotTop: i, plotBottom: l, plotWidth: a, plotHeight: h, main: f, rsi: y, volume: L };
|
|
3741
3751
|
}
|
|
3742
3752
|
function hl(e, t) {
|
|
3743
3753
|
if (t === 0) return { from: 0, to: 0 };
|
|
@@ -3771,11 +3781,11 @@ function cn(e, t, n, r, o) {
|
|
|
3771
3781
|
for (const d of t)
|
|
3772
3782
|
d.low < c && (c = d.low), d.high > i && (i = d.high);
|
|
3773
3783
|
for (const d of n) {
|
|
3774
|
-
const
|
|
3775
|
-
for (const
|
|
3776
|
-
const
|
|
3777
|
-
for (let
|
|
3778
|
-
const N =
|
|
3784
|
+
const f = d.kind === "line" ? [d.values] : [d.upper, d.lower];
|
|
3785
|
+
for (const y of f) {
|
|
3786
|
+
const L = Math.max(0, Math.floor(r)), v = Math.min(y.length - 1, Math.ceil(o));
|
|
3787
|
+
for (let S = L; S <= v; S++) {
|
|
3788
|
+
const N = y[S];
|
|
3779
3789
|
N != null && (N < c && (c = N), N > i && (i = N));
|
|
3780
3790
|
}
|
|
3781
3791
|
}
|
|
@@ -3794,7 +3804,7 @@ function fl(e, t, n, r) {
|
|
|
3794
3804
|
const l = qe(0, o || 1, 3), a = Math.max(l[l.length - 1], o);
|
|
3795
3805
|
return { paneTop: e.top, paneBottom: e.bottom, paneHeight: e.height, priceMin: 0, priceMax: a, ticks: l };
|
|
3796
3806
|
}
|
|
3797
|
-
function
|
|
3807
|
+
function we(e, t) {
|
|
3798
3808
|
const n = (e - t.priceMin) / (t.priceMax - t.priceMin || 1);
|
|
3799
3809
|
return t.paneBottom - n * t.paneHeight;
|
|
3800
3810
|
}
|
|
@@ -3834,7 +3844,7 @@ function gl(e, t, n, r) {
|
|
|
3834
3844
|
function Lt(e, t, n, r, o, c = !1) {
|
|
3835
3845
|
e.strokeStyle = o.grid, e.lineWidth = 1, e.beginPath();
|
|
3836
3846
|
for (const i of r.ticks) {
|
|
3837
|
-
const l = Math.round(
|
|
3847
|
+
const l = Math.round(we(i, r)) + 0.5;
|
|
3838
3848
|
e.moveTo(t, l), e.lineTo(n, l);
|
|
3839
3849
|
}
|
|
3840
3850
|
e.stroke();
|
|
@@ -3842,35 +3852,35 @@ function Lt(e, t, n, r, o, c = !1) {
|
|
|
3842
3852
|
function yl(e, t, n, r, o) {
|
|
3843
3853
|
e.fillStyle = o.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle";
|
|
3844
3854
|
for (const c of n.ticks) {
|
|
3845
|
-
const i =
|
|
3855
|
+
const i = we(c, n);
|
|
3846
3856
|
e.fillText(c.toFixed(r), t.plotRight + 6, i);
|
|
3847
3857
|
}
|
|
3848
3858
|
}
|
|
3849
3859
|
function vl(e, t, n, r, o, c, i, l) {
|
|
3850
3860
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, c * 0.7);
|
|
3851
3861
|
for (let d = a; d <= h; d++) {
|
|
3852
|
-
const
|
|
3853
|
-
e.strokeStyle =
|
|
3854
|
-
const
|
|
3855
|
-
e.moveTo(
|
|
3856
|
-
const
|
|
3857
|
-
e.fillRect(Math.round(
|
|
3862
|
+
const f = t[d], y = o(d), L = we(f.open, i), v = we(f.close, i), S = we(f.high, i), N = we(f.low, i), j = f.close >= f.open ? l.up : l.down;
|
|
3863
|
+
e.strokeStyle = j, e.fillStyle = j, e.beginPath();
|
|
3864
|
+
const Z = Math.round(y) + 0.5;
|
|
3865
|
+
e.moveTo(Z, S), e.lineTo(Z, N), e.stroke();
|
|
3866
|
+
const U = Math.min(L, v), C = Math.max(1, Math.abs(v - L));
|
|
3867
|
+
e.fillRect(Math.round(y - u / 2), Math.round(U), Math.round(u), Math.round(C));
|
|
3858
3868
|
}
|
|
3859
3869
|
}
|
|
3860
3870
|
function bl(e, t, n, r, o, c, i, l) {
|
|
3861
3871
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(2, Math.min(c * 0.4, 8));
|
|
3862
3872
|
e.lineWidth = Math.max(1, Math.min(2, c * 0.18)), e.lineCap = "butt";
|
|
3863
3873
|
for (let d = a; d <= h; d++) {
|
|
3864
|
-
const
|
|
3865
|
-
e.strokeStyle =
|
|
3874
|
+
const f = t[d], y = Math.round(o(d)) + 0.5, L = we(f.high, i), v = we(f.low, i), S = we(f.open, i), N = we(f.close, i), D = f.close >= f.open;
|
|
3875
|
+
e.strokeStyle = D ? l.up : l.down, e.beginPath(), e.moveTo(y, L), e.lineTo(y, v), e.moveTo(y - u, S), e.lineTo(y, S), e.moveTo(y, N), e.lineTo(y + u, N), e.stroke();
|
|
3866
3876
|
}
|
|
3867
3877
|
}
|
|
3868
3878
|
function xl(e, t, n, r, o, c, i, l) {
|
|
3869
3879
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r));
|
|
3870
3880
|
if (!(h <= a)) {
|
|
3871
|
-
e.strokeStyle = i, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a),
|
|
3881
|
+
e.strokeStyle = i, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), we(t[a].close, c));
|
|
3872
3882
|
for (let u = a + 1; u <= h; u++)
|
|
3873
|
-
e.lineTo(o(u),
|
|
3883
|
+
e.lineTo(o(u), we(t[u].close, c));
|
|
3874
3884
|
e.stroke(), l && (e.globalAlpha = 0.18, e.fillStyle = i, e.lineTo(o(h), c.paneBottom), e.lineTo(o(a), c.paneBottom), e.closePath(), e.fill(), e.globalAlpha = 1);
|
|
3875
3885
|
}
|
|
3876
3886
|
}
|
|
@@ -3883,14 +3893,14 @@ function kl(e, t, n, r, o, c, i, l) {
|
|
|
3883
3893
|
e.globalAlpha = t.fillOpacity, e.fillStyle = t.color, e.beginPath();
|
|
3884
3894
|
let u = !1;
|
|
3885
3895
|
for (let d = a; d <= h; d++) {
|
|
3886
|
-
const
|
|
3887
|
-
if (
|
|
3888
|
-
const
|
|
3889
|
-
u ? e.lineTo(
|
|
3896
|
+
const f = t.upper[d];
|
|
3897
|
+
if (f == null) continue;
|
|
3898
|
+
const y = i(d), L = we(f, l);
|
|
3899
|
+
u ? e.lineTo(y, L) : (e.moveTo(y, L), u = !0);
|
|
3890
3900
|
}
|
|
3891
3901
|
for (let d = h; d >= a; d--) {
|
|
3892
|
-
const
|
|
3893
|
-
|
|
3902
|
+
const f = t.lower[d];
|
|
3903
|
+
f != null && e.lineTo(i(d), we(f, l));
|
|
3894
3904
|
}
|
|
3895
3905
|
e.closePath(), e.fill(), e.globalAlpha = 1, Qe(e, t.upper, o, c, i, l, t.color), Qe(e, t.lower, o, c, i, l, t.color), Qe(e, t.middle, o, c, i, l, t.color);
|
|
3896
3906
|
}
|
|
@@ -3904,30 +3914,30 @@ function Qe(e, t, n, r, o, c, i) {
|
|
|
3904
3914
|
l = !1;
|
|
3905
3915
|
continue;
|
|
3906
3916
|
}
|
|
3907
|
-
const
|
|
3908
|
-
l ? e.lineTo(
|
|
3917
|
+
const f = o(u), y = we(d, c);
|
|
3918
|
+
l ? e.lineTo(f, y) : (e.moveTo(f, y), l = !0);
|
|
3909
3919
|
}
|
|
3910
3920
|
e.stroke();
|
|
3911
3921
|
}
|
|
3912
|
-
function
|
|
3922
|
+
function Ml(e, t, n, r, o, c, i, l) {
|
|
3913
3923
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, c * 0.7);
|
|
3914
3924
|
for (let d = a; d <= h; d++) {
|
|
3915
|
-
const
|
|
3916
|
-
if (
|
|
3917
|
-
const
|
|
3918
|
-
e.fillStyle =
|
|
3919
|
-
const
|
|
3920
|
-
e.fillRect(Math.round(o(d) - u / 2), Math.round(
|
|
3925
|
+
const f = t[d], y = f.volume ?? 0;
|
|
3926
|
+
if (y === 0) continue;
|
|
3927
|
+
const L = f.close >= f.open;
|
|
3928
|
+
e.fillStyle = L ? l.up : l.down, e.globalAlpha = 0.55;
|
|
3929
|
+
const v = we(y, i), S = i.paneBottom - v;
|
|
3930
|
+
e.fillRect(Math.round(o(d) - u / 2), Math.round(v), Math.round(u), Math.round(S));
|
|
3921
3931
|
}
|
|
3922
3932
|
e.globalAlpha = 1;
|
|
3923
3933
|
}
|
|
3924
|
-
function
|
|
3934
|
+
function wl(e, t, n, r, o, c) {
|
|
3925
3935
|
e.strokeStyle = c.grid, e.setLineDash([3, 3]), e.beginPath();
|
|
3926
3936
|
for (const i of [r, o]) {
|
|
3927
|
-
const l = Math.round(
|
|
3937
|
+
const l = Math.round(we(i, n)) + 0.5;
|
|
3928
3938
|
e.moveTo(t.plotLeft, l), e.lineTo(t.plotRight, l);
|
|
3929
3939
|
}
|
|
3930
|
-
e.stroke(), e.setLineDash([]), e.fillStyle = c.axis, e.font = "10px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(String(r), t.plotRight + 6,
|
|
3940
|
+
e.stroke(), e.setLineDash([]), e.fillStyle = c.axis, e.font = "10px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(String(r), t.plotRight + 6, we(r, n)), e.fillText(String(o), t.plotRight + 6, we(o, n));
|
|
3931
3941
|
}
|
|
3932
3942
|
function Ft(e, t, n, r, o) {
|
|
3933
3943
|
e.fillStyle = o.textMuted, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "top", e.fillText(r, t.plotLeft + 6, n.top + 4);
|
|
@@ -3935,27 +3945,27 @@ function Ft(e, t, n, r, o) {
|
|
|
3935
3945
|
function $l(e, t, n, r, o, c, i) {
|
|
3936
3946
|
const l = o - r + 1, a = t.plotWidth / l, h = Math.max(1, Math.round(80 / a));
|
|
3937
3947
|
e.fillStyle = i.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
|
|
3938
|
-
const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)),
|
|
3939
|
-
for (let
|
|
3940
|
-
const
|
|
3941
|
-
e.fillText(Sl(
|
|
3948
|
+
const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), f = t.plotBottom + At / 2;
|
|
3949
|
+
for (let y = u; y <= d; y += h) {
|
|
3950
|
+
const L = n[y], v = t.plotLeft + (y - r + 0.5) * a;
|
|
3951
|
+
e.fillText(Sl(L.time, c), v, f);
|
|
3942
3952
|
}
|
|
3943
3953
|
}
|
|
3944
3954
|
function Nl(e, t, n, r, o, c, i, l, a, h, u) {
|
|
3945
3955
|
if (n.x < t.plotLeft || n.x > t.plotRight) return;
|
|
3946
|
-
const d = c - o + 1,
|
|
3947
|
-
if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(
|
|
3956
|
+
const d = c - o + 1, f = t.plotWidth / d, y = o + (n.x - t.plotLeft) / f - 0.5, L = Math.round(y), v = Math.max(0, Math.min(r.length - 1, L)), S = i(v);
|
|
3957
|
+
if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(S + 0.5, t.plotTop), e.lineTo(S + 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) {
|
|
3948
3958
|
const N = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
|
|
3949
3959
|
e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Ct, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(N.toFixed(l), t.plotRight + 6, n.y);
|
|
3950
3960
|
}
|
|
3951
|
-
if (r[
|
|
3952
|
-
const N = sn(r[
|
|
3961
|
+
if (r[v]) {
|
|
3962
|
+
const N = sn(r[v].time, h);
|
|
3953
3963
|
e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
|
|
3954
|
-
const
|
|
3964
|
+
const Z = e.measureText(N).width + 8 * 2, U = At, C = Math.max(
|
|
3955
3965
|
t.plotLeft,
|
|
3956
|
-
Math.min(t.plotRight -
|
|
3957
|
-
),
|
|
3958
|
-
e.fillStyle = u.text, e.fillRect(
|
|
3966
|
+
Math.min(t.plotRight - Z, S - Z / 2)
|
|
3967
|
+
), $ = t.plotBottom;
|
|
3968
|
+
e.fillStyle = u.text, e.fillRect(C, $, Z, U), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(N, C + Z / 2, $ + U / 2);
|
|
3959
3969
|
}
|
|
3960
3970
|
e.restore();
|
|
3961
3971
|
}
|
|
@@ -4039,16 +4049,16 @@ const Cl = $e(
|
|
|
4039
4049
|
className: h,
|
|
4040
4050
|
style: u
|
|
4041
4051
|
}, d) => {
|
|
4042
|
-
const { line:
|
|
4052
|
+
const { line: f, area: y, last: L } = ke(() => {
|
|
4043
4053
|
if (e.length === 0) return { line: "", area: "", last: null };
|
|
4044
|
-
const
|
|
4045
|
-
return { line:
|
|
4054
|
+
const v = o, S = Math.max(1, t - v * 2), N = Math.max(1, n - v * 2), [D, j] = bt(e), Z = Je([0, Math.max(1, e.length - 1)], [v, v + S]), U = Je([D, j], [v + N, v]), C = e.map((ce, q) => ({ x: Z(q), y: U(ce) })), $ = Tl(C, c), oe = i ? `${$} L ${C[C.length - 1].x} ${v + N} L ${C[0].x} ${v + N} Z` : "";
|
|
4055
|
+
return { line: $, area: oe, last: C[C.length - 1] };
|
|
4046
4056
|
}, [e, t, n, o, c, i]);
|
|
4047
|
-
return /* @__PURE__ */
|
|
4057
|
+
return /* @__PURE__ */ z(
|
|
4048
4058
|
"svg",
|
|
4049
4059
|
{
|
|
4050
4060
|
ref: d,
|
|
4051
|
-
className:
|
|
4061
|
+
className: m(w.sparkline, h),
|
|
4052
4062
|
style: u,
|
|
4053
4063
|
width: t,
|
|
4054
4064
|
height: n,
|
|
@@ -4056,11 +4066,11 @@ const Cl = $e(
|
|
|
4056
4066
|
role: "img",
|
|
4057
4067
|
"aria-label": a,
|
|
4058
4068
|
children: [
|
|
4059
|
-
i &&
|
|
4060
|
-
|
|
4069
|
+
i && y && /* @__PURE__ */ s("path", { d: y, fill: r, opacity: 0.18 }),
|
|
4070
|
+
f && /* @__PURE__ */ s(
|
|
4061
4071
|
"path",
|
|
4062
4072
|
{
|
|
4063
|
-
d:
|
|
4073
|
+
d: f,
|
|
4064
4074
|
fill: "none",
|
|
4065
4075
|
stroke: r,
|
|
4066
4076
|
strokeWidth: o,
|
|
@@ -4068,7 +4078,7 @@ const Cl = $e(
|
|
|
4068
4078
|
strokeLinecap: "round"
|
|
4069
4079
|
}
|
|
4070
4080
|
),
|
|
4071
|
-
l &&
|
|
4081
|
+
l && L && /* @__PURE__ */ s("circle", { cx: L.x, cy: L.y, r: o + 1, fill: r })
|
|
4072
4082
|
]
|
|
4073
4083
|
}
|
|
4074
4084
|
);
|
|
@@ -4111,7 +4121,7 @@ export {
|
|
|
4111
4121
|
Yl as suggestPeriodForResolution,
|
|
4112
4122
|
Ul as suggestResolutionForPeriod,
|
|
4113
4123
|
xo as useClickOutside,
|
|
4114
|
-
|
|
4124
|
+
Mo as useFocusTrap,
|
|
4115
4125
|
Rt as useKeyboard,
|
|
4116
4126
|
Ur as useTableSort,
|
|
4117
4127
|
_l as volumeSeries
|