@hybridcore/ui 1.6.28 → 1.6.30

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.
@@ -1,224 +1,218 @@
1
- import { useThemeProps as de } from "@mui/material";
2
- import { useRef as f, useState as N, useMemo as S, useCallback as ge, useEffect as B } from "react";
3
- import { c as s } from "../../createReactComponent-C7L-DMHj.js";
4
- import { a as he, I as pe } from "../../IconCheck-BcUcbvno.js";
5
- import { I as ve } from "../../IconCircle-HcgE1lHy.js";
1
+ import { useThemeProps as ae } from "@mui/material";
2
+ import { useState as b, useMemo as N } from "react";
3
+ import oe from "../../hooks/useInfinitePaging.js";
4
+ import { c as a } from "../../createReactComponent-C7L-DMHj.js";
5
+ import { a as ne, I as se } from "../../IconCheck-BcUcbvno.js";
6
+ import { I as ie } from "../../IconCircle-HcgE1lHy.js";
6
7
  /**
7
8
  * @license @tabler/icons-react v3.44.0 - MIT
8
9
  *
9
10
  * This source code is licensed under the MIT license.
10
11
  * See the LICENSE file in the root directory of this source tree.
11
12
  */
12
- const fe = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 8v4", key: "svg-1" }], ["path", { d: "M12 16h.01", key: "svg-2" }]], Me = s("outline", "alert-circle", "AlertCircle", fe);
13
+ const ce = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 8v4", key: "svg-1" }], ["path", { d: "M12 16h.01", key: "svg-2" }]], re = a("outline", "alert-circle", "AlertCircle", ce);
13
14
  /**
14
15
  * @license @tabler/icons-react v3.44.0 - MIT
15
16
  *
16
17
  * This source code is licensed under the MIT license.
17
18
  * See the LICENSE file in the root directory of this source tree.
18
19
  */
19
- const me = [["path", { d: "M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6", key: "svg-0" }], ["path", { d: "M9 17v1a3 3 0 0 0 6 0v-1", key: "svg-1" }]], ke = s("outline", "bell", "Bell", me);
20
+ const le = [["path", { d: "M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6", key: "svg-0" }], ["path", { d: "M9 17v1a3 3 0 0 0 6 0v-1", key: "svg-1" }]], de = a("outline", "bell", "Bell", le);
20
21
  /**
21
22
  * @license @tabler/icons-react v3.44.0 - MIT
22
23
  *
23
24
  * This source code is licensed under the MIT license.
24
25
  * See the LICENSE file in the root directory of this source tree.
25
26
  */
26
- const ye = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 7v5l3 3", key: "svg-1" }]], _e = s("outline", "clock", "Clock", ye);
27
+ const ge = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 7v5l3 3", key: "svg-1" }]], he = a("outline", "clock", "Clock", ge);
27
28
  /**
28
29
  * @license @tabler/icons-react v3.44.0 - MIT
29
30
  *
30
31
  * This source code is licensed under the MIT license.
31
32
  * See the LICENSE file in the root directory of this source tree.
32
33
  */
33
- const Ie = [["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-0" }], ["path", { d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2", key: "svg-1" }], ["path", { d: "M9 9l1 0", key: "svg-2" }], ["path", { d: "M9 13l6 0", key: "svg-3" }], ["path", { d: "M9 17l6 0", key: "svg-4" }]], Pe = s("outline", "file-text", "FileText", Ie);
34
+ const pe = [["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-0" }], ["path", { d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2", key: "svg-1" }], ["path", { d: "M9 9l1 0", key: "svg-2" }], ["path", { d: "M9 13l6 0", key: "svg-3" }], ["path", { d: "M9 17l6 0", key: "svg-4" }]], ve = a("outline", "file-text", "FileText", pe);
34
35
  /**
35
36
  * @license @tabler/icons-react v3.44.0 - MIT
36
37
  *
37
38
  * This source code is licensed under the MIT license.
38
39
  * See the LICENSE file in the root directory of this source tree.
39
40
  */
40
- const be = [["path", { d: "M5 5a5 5 0 0 1 7 0a5 5 0 0 0 7 0v9a5 5 0 0 1 -7 0a5 5 0 0 0 -7 0v-9", key: "svg-0" }], ["path", { d: "M5 21v-7", key: "svg-1" }]], Ne = s("outline", "flag", "Flag", be);
41
+ const ue = [["path", { d: "M5 5a5 5 0 0 1 7 0a5 5 0 0 0 7 0v9a5 5 0 0 1 -7 0a5 5 0 0 0 -7 0v-9", key: "svg-0" }], ["path", { d: "M5 21v-7", key: "svg-1" }]], me = a("outline", "flag", "Flag", ue);
41
42
  /**
42
43
  * @license @tabler/icons-react v3.44.0 - MIT
43
44
  *
44
45
  * This source code is licensed under the MIT license.
45
46
  * See the LICENSE file in the root directory of this source tree.
46
47
  */
47
- const Se = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 9h.01", key: "svg-1" }], ["path", { d: "M11 12h1v4h1", key: "svg-2" }]], we = s("outline", "info-circle", "InfoCircle", Se);
48
+ const Me = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 9h.01", key: "svg-1" }], ["path", { d: "M11 12h1v4h1", key: "svg-2" }]], fe = a("outline", "info-circle", "InfoCircle", Me);
48
49
  /**
49
50
  * @license @tabler/icons-react v3.44.0 - MIT
50
51
  *
51
52
  * This source code is licensed under the MIT license.
52
53
  * See the LICENSE file in the root directory of this source tree.
53
54
  */
54
- const Re = [["path", { d: "M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0", key: "svg-0" }], ["path", { d: "M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0", key: "svg-1" }]], $e = s("outline", "map-pin", "MapPin", Re);
55
+ const ke = [["path", { d: "M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0", key: "svg-0" }], ["path", { d: "M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0", key: "svg-1" }]], ye = a("outline", "map-pin", "MapPin", ke);
55
56
  /**
56
57
  * @license @tabler/icons-react v3.44.0 - MIT
57
58
  *
58
59
  * This source code is licensed under the MIT license.
59
60
  * See the LICENSE file in the root directory of this source tree.
60
61
  */
61
- const Ce = [["path", { d: "M8 9h8", key: "svg-0" }], ["path", { d: "M8 13h6", key: "svg-1" }], ["path", { d: "M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12", key: "svg-2" }]], Oe = s("outline", "message", "Message", Ce);
62
+ const Pe = [["path", { d: "M8 9h8", key: "svg-0" }], ["path", { d: "M8 13h6", key: "svg-1" }], ["path", { d: "M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12", key: "svg-2" }]], _e = a("outline", "message", "Message", Pe);
62
63
  /**
63
64
  * @license @tabler/icons-react v3.44.0 - MIT
64
65
  *
65
66
  * This source code is licensed under the MIT license.
66
67
  * See the LICENSE file in the root directory of this source tree.
67
68
  */
68
- const Le = [["path", { d: "M15.04 19.745c-.942 .551 -1.964 .976 -3.04 1.255a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3a12 12 0 0 0 8.5 3a12 12 0 0 1 .195 6.015", key: "svg-0" }], ["path", { d: "M19 16v3", key: "svg-1" }], ["path", { d: "M19 22v.01", key: "svg-2" }]], xe = s("outline", "shield-exclamation", "ShieldExclamation", Le);
69
+ const Ie = [["path", { d: "M15.04 19.745c-.942 .551 -1.964 .976 -3.04 1.255a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3a12 12 0 0 0 8.5 3a12 12 0 0 1 .195 6.015", key: "svg-0" }], ["path", { d: "M19 16v3", key: "svg-1" }], ["path", { d: "M19 22v.01", key: "svg-2" }]], be = a("outline", "shield-exclamation", "ShieldExclamation", Ie);
69
70
  /**
70
71
  * @license @tabler/icons-react v3.44.0 - MIT
71
72
  *
72
73
  * This source code is licensed under the MIT license.
73
74
  * See the LICENSE file in the root directory of this source tree.
74
75
  */
75
- const Te = [["path", { d: "M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3", key: "svg-0" }]], Ae = s("outline", "shield", "Shield", Te);
76
+ const Ne = [["path", { d: "M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3", key: "svg-0" }]], Se = a("outline", "shield", "Shield", Ne);
76
77
  /**
77
78
  * @license @tabler/icons-react v3.44.0 - MIT
78
79
  *
79
80
  * This source code is licensed under the MIT license.
80
81
  * See the LICENSE file in the root directory of this source tree.
81
82
  */
82
- const Ee = [["path", { d: "M7 11v8a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1h3a4 4 0 0 0 4 -4v-1a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1 -2 2h-7a3 3 0 0 1 -3 -3", key: "svg-0" }]], Be = s("outline", "thumb-up", "ThumbUp", Ee);
83
+ const we = [["path", { d: "M7 11v8a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1h3a4 4 0 0 0 4 -4v-1a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1 -2 2h-7a3 3 0 0 1 -3 -3", key: "svg-0" }]], $e = a("outline", "thumb-up", "ThumbUp", we);
83
84
  /**
84
85
  * @license @tabler/icons-react v3.44.0 - MIT
85
86
  *
86
87
  * This source code is licensed under the MIT license.
87
88
  * See the LICENSE file in the root directory of this source tree.
88
89
  */
89
- const Fe = [["path", { d: "M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0", key: "svg-0" }], ["path", { d: "M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2", key: "svg-1" }], ["path", { d: "M16 3.13a4 4 0 0 1 0 7.75", key: "svg-2" }], ["path", { d: "M21 21v-2a4 4 0 0 0 -3 -3.85", key: "svg-3" }]], Ve = s("outline", "users", "Users", Fe), De = {
90
- shield: Ae,
91
- "shield-alert": xe,
92
- "alert-triangle": he,
93
- "alert-circle": Me,
94
- info: we,
95
- bell: ke,
96
- check: pe,
97
- clock: _e,
98
- flag: Ne,
99
- file: Pe,
100
- "map-pin": $e,
101
- message: Oe,
102
- "thumb-up": Be,
103
- users: Ve,
104
- circle: ve
105
- }, Ue = [5, 10, 25, 50], Ge = "120px", F = (g, d) => {
106
- if (!(g != null && g.length) || d === void 0 || d === null) return;
107
- const o = `${d}`.trim().toLowerCase();
108
- if (o)
109
- return g.find((k) => `${k.value}`.trim().toLowerCase() === o);
110
- }, qe = (g) => {
111
- const d = de({ props: g, name: "HCDataList" }), {
112
- data: o = [],
113
- totalCount: k,
114
- payload: i,
115
- onChange: r,
116
- onItemClick: M,
117
- iconStates: V,
118
- iconShape: D = "circle",
119
- badgeStates: U,
120
- endSlot: w = "badge",
121
- metaSeparator: G = "",
122
- descriptionLines: j = 1,
123
- dense: H = !1,
124
- divider: J = !0,
125
- headerGutter: K = !1,
126
- paginationMode: y = "infinite",
127
- rowsPerPage: W = 10,
128
- resetKey: q,
129
- loading: _ = !1,
130
- loadingMore: z = !1
131
- } = d, R = f(null), $ = f(null), [Q, C] = N(0), [X, Y] = N(W), l = (i == null ? void 0 : i.pageNumber) ?? Q, a = (i == null ? void 0 : i.rows) ?? X, c = !!r, u = y === "infinite", [O, L] = N(a), p = f(/* @__PURE__ */ new Map()), m = `${q ?? ""}`, x = f(m), h = f(null);
132
- x.current !== m && (x.current = m, p.current.clear(), h.current = null), c && u && (l === 0 && p.current.clear(), p.current.set(l, o), h.current === l && (h.current = null));
133
- const T = S(() => !c || !u ? o : Array.from(p.current.keys()).sort((e, t) => e - t).flatMap((e) => p.current.get(e) ?? []), [c, u, o, l]), I = c ? k ?? 0 : o.length, v = S(() => u ? c ? T : o.slice(0, O) : c ? o : o.slice(l * a, (l + 1) * a), [u, c, T, o, O, l, a]), P = u && v.length < I, Z = y === "buttons" && I > a, b = ge(() => {
134
- if (!c) {
135
- L((t) => t + a);
136
- return;
137
- }
138
- const e = l + 1;
139
- h.current === null && (h.current = e, r == null || r({ ...i, pageNumber: e, rows: a }));
140
- }, [c, a, l, r, i]);
141
- B(() => {
142
- if (!u || !P || _) return;
143
- const e = $.current;
144
- if (!e || typeof IntersectionObserver > "u") return;
145
- const t = new IntersectionObserver(
146
- (n) => {
147
- n.some((ue) => ue.isIntersecting) && b();
148
- },
149
- { root: R.current, rootMargin: Ge }
150
- );
151
- return t.observe(e), () => t.disconnect();
152
- }, [u, P, _, b]), B(() => {
153
- u && !c && L(a);
154
- }, [u, c, a, m, o.length]);
155
- const ee = (e, t) => {
156
- C(t), r == null || r({ ...i, pageNumber: t, rows: a });
157
- }, te = (e) => {
90
+ const Ce = [["path", { d: "M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0", key: "svg-0" }], ["path", { d: "M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2", key: "svg-1" }], ["path", { d: "M16 3.13a4 4 0 0 1 0 7.75", key: "svg-2" }], ["path", { d: "M21 21v-2a4 4 0 0 0 -3 -3.85", key: "svg-3" }]], Le = a("outline", "users", "Users", Ce), Re = {
91
+ shield: Se,
92
+ "shield-alert": be,
93
+ "alert-triangle": ne,
94
+ "alert-circle": re,
95
+ info: fe,
96
+ bell: de,
97
+ check: se,
98
+ clock: he,
99
+ flag: me,
100
+ file: ve,
101
+ "map-pin": ye,
102
+ message: _e,
103
+ "thumb-up": $e,
104
+ users: Le,
105
+ circle: ie
106
+ }, xe = [5, 10, 25, 50], S = (l, n) => {
107
+ if (!(l != null && l.length) || n === void 0 || n === null)
108
+ return;
109
+ const i = `${n}`.trim().toLowerCase();
110
+ if (i)
111
+ return l.find((g) => `${g.value}`.trim().toLowerCase() === i);
112
+ }, Ae = (l) => {
113
+ const n = ae({ props: l, name: "HCDataList" }), {
114
+ data: i = [],
115
+ totalCount: g,
116
+ payload: s,
117
+ onChange: c,
118
+ onItemClick: h,
119
+ iconStates: w,
120
+ iconShape: $ = "circle",
121
+ badgeStates: C,
122
+ endSlot: M = "badge",
123
+ metaSeparator: L = "•",
124
+ descriptionLines: R = 1,
125
+ dense: x = !1,
126
+ divider: T = !0,
127
+ headerGutter: O = !1,
128
+ paginationMode: v = "infinite",
129
+ rowsPerPage: B = 10,
130
+ resetKey: D,
131
+ loading: f = !1,
132
+ loadingMore: E = !1
133
+ } = n, [F, k] = b(0), [A, U] = b(B), d = (s == null ? void 0 : s.pageNumber) ?? F, r = (s == null ? void 0 : s.rows) ?? A, u = !!c, m = v === "infinite", {
134
+ displayData: y,
135
+ hasMore: V,
136
+ isLoadingMore: G,
137
+ scrollRef: j,
138
+ sentinelRef: H
139
+ } = oe({
140
+ data: i,
141
+ totalCount: g,
142
+ page: d,
143
+ rowsPerPage: r,
144
+ payload: s,
145
+ onChange: c,
146
+ resetKey: D,
147
+ loading: f,
148
+ loadingMore: E,
149
+ enabled: m
150
+ }), P = u ? g ?? 0 : i.length, p = N(() => m ? y : u ? i : i.slice(d * r, (d + 1) * r), [m, y, u, i, d, r]), J = v === "buttons" && P > r, K = (e, t) => {
151
+ k(t), c == null || c({ ...s, pageNumber: t, rows: r });
152
+ }, W = (e) => {
158
153
  const t = parseInt(e.target.value, 10);
159
- Y(t), C(0), r == null || r({ ...i, pageNumber: 0, rows: t });
160
- }, ne = (e) => () => {
161
- e.disabled || M == null || M(e);
162
- }, oe = (e) => !!M && !e.disabled, ae = (e) => {
154
+ U(t), k(0), c == null || c({ ...s, pageNumber: 0, rows: t });
155
+ }, q = (e) => () => {
156
+ e.disabled || h == null || h(e);
157
+ }, z = (e) => !!h && !e.disabled, Q = (e) => {
163
158
  if (!e.meta) return e.description;
164
- const t = e.meta.filter((n) => n != null && `${n}`.trim() !== "").map((n) => `${n}`.trim());
165
- return t.length ? t.join(` ${G} `) : void 0;
166
- }, A = (e) => F(V, e.iconValue), se = (e) => {
167
- var n;
168
- const t = (n = A(e)) == null ? void 0 : n.icon;
169
- return t ? De[t] : void 0;
170
- }, E = (e) => F(U, e.status), re = (e) => {
171
- var n;
172
- const t = E(e);
173
- return t ? t.label ?? t.value : ((n = e.status) == null ? void 0 : n.trim()) || void 0;
174
- }, ce = (e) => {
159
+ const t = e.meta.filter((o) => o != null && `${o}`.trim() !== "").map((o) => `${o}`.trim());
160
+ return t.length ? t.join(` ${L} `) : void 0;
161
+ }, _ = (e) => S(w, e.iconValue), X = (e) => {
162
+ var o;
163
+ const t = (o = _(e)) == null ? void 0 : o.icon;
164
+ return t ? Re[t] : void 0;
165
+ }, I = (e) => S(C, e.status), Y = (e) => {
166
+ var o;
167
+ const t = I(e);
168
+ return t ? t.label ?? t.value : ((o = e.status) == null ? void 0 : o.trim()) || void 0;
169
+ }, Z = (e) => {
175
170
  const t = typeof e.endValue == "string" ? Number(e.endValue) : e.endValue;
176
171
  return Number.isFinite(t) ? Math.min(100, Math.max(0, t)) : 0;
177
- }, ie = S(
178
- () => JSON.stringify({ title: d.title, data: v }),
179
- [d.title, v]
180
- ), le = {
181
- ...d,
182
- iconShape: D,
183
- endSlot: w,
184
- dense: H,
185
- divider: J,
186
- descriptionLines: j,
187
- headerGutter: K,
188
- paginationMode: y,
189
- isEmpty: !_ && v.length === 0
172
+ }, ee = N(
173
+ () => JSON.stringify({ title: n.title, data: p }),
174
+ [n.title, p]
175
+ ), te = {
176
+ ...n,
177
+ iconShape: $,
178
+ endSlot: M,
179
+ dense: x,
180
+ divider: T,
181
+ descriptionLines: R,
182
+ headerGutter: O,
183
+ paginationMode: v,
184
+ isEmpty: !f && p.length === 0
190
185
  };
191
186
  return {
192
- refs: { listRef: R, sentinelRef: $ },
187
+ refs: { listRef: j, sentinelRef: H },
193
188
  state: {
194
- ownerState: le,
195
- displayData: v,
196
- count: I,
197
- page: l,
198
- rowsPerPage: a,
199
- rowsPerPageOptions: d.rowsPerPageOptions ?? Ue,
200
- showPagination: Z,
201
- hasMore: P,
189
+ ownerState: te,
190
+ displayData: p,
191
+ count: P,
192
+ page: d,
193
+ rowsPerPage: r,
194
+ rowsPerPageOptions: n.rowsPerPageOptions ?? xe,
195
+ showPagination: J,
196
+ hasMore: V,
202
197
  // Either the caller says a request is running, or we know one is in flight.
203
- isLoadingMore: z || h.current !== null,
204
- snapshot: ie,
205
- endSlot: w,
206
- isItemClickable: oe,
207
- getSecondaryText: ae,
208
- getIconState: A,
209
- getIcon: se,
210
- getBadgeState: E,
211
- getBadgeLabel: re,
212
- getProgressValue: ce
198
+ isLoadingMore: G,
199
+ snapshot: ee,
200
+ endSlot: M,
201
+ isItemClickable: z,
202
+ getSecondaryText: Q,
203
+ getIconState: _,
204
+ getIcon: X,
205
+ getBadgeState: I,
206
+ getBadgeLabel: Y,
207
+ getProgressValue: Z
213
208
  },
214
209
  actions: {
215
- handleChangePage: ee,
216
- handleChangeRowsPerPage: te,
217
- handleItemClick: ne,
218
- loadMore: b
210
+ handleChangePage: K,
211
+ handleChangeRowsPerPage: W,
212
+ handleItemClick: q
219
213
  }
220
214
  };
221
215
  };
222
216
  export {
223
- qe as useDataListLogic
217
+ Ae as useDataListLogic
224
218
  };
@@ -1,28 +1,28 @@
1
- import { jsx as h } from "react/jsx-runtime";
2
- import { R as u, A } from "../../AnimatedTheme-ktdO3Bel.js";
3
- import { useTheme as g, alpha as v } from "@mui/material";
4
- import { useRef as w, useLayoutEffect as x } from "react";
5
- import { X as y, V as R } from "../../AxisRenderer-BCQoUJw6.js";
6
- import { C as L } from "../../CategoryAxis-B6NqW8qd.js";
7
- import { A as T, a as b } from "../../AxisRendererY-AXWvGU6r.js";
8
- import { T as X } from "../../Tooltip-vyZRZWih.js";
9
- import { C } from "../../ColumnSeries-CtRTsn-E.js";
10
- import { c as a } from "../../Entity-BJCuhdq_.js";
1
+ import { jsx as A } from "react/jsx-runtime";
2
+ import { R as g, A as T } from "../../AnimatedTheme-ktdO3Bel.js";
3
+ import { useTheme as w, alpha as x } from "@mui/material";
4
+ import { useRef as R, useLayoutEffect as y } from "react";
5
+ import { X as v, V as L } from "../../AxisRenderer-BCQoUJw6.js";
6
+ import { C as X } from "../../CategoryAxis-B6NqW8qd.js";
7
+ import { A as b, a as C } from "../../AxisRendererY-AXWvGU6r.js";
8
+ import { T as F } from "../../Tooltip-vyZRZWih.js";
9
+ import { C as S } from "../../ColumnSeries-CtRTsn-E.js";
10
+ import { c as i } from "../../Entity-BJCuhdq_.js";
11
11
  import { L as Y } from "../../LineSeries-D_IL2qGF.js";
12
- import { L as F } from "../../LinearGradient-CxQyCSEB.js";
13
- const z = ({
14
- data: o,
12
+ import { L as G } from "../../LinearGradient-CxQyCSEB.js";
13
+ const u = 10, k = 21, q = ({
14
+ data: a,
15
15
  type: p,
16
- inset: d = !1,
17
- gradient: m = !1
16
+ fill: n = "solid",
17
+ color: h
18
18
  }) => {
19
- const l = w(null), t = g();
20
- return x(() => {
19
+ const l = R(null), c = w(), r = h ?? c.palette.divider;
20
+ return y(() => {
21
21
  if (!l.current) return;
22
- const e = u.new(l.current);
23
- e.setThemes([A.new(e)]);
24
- const i = e.container.children.push(
25
- y.new(e, {
22
+ const e = g.new(l.current);
23
+ e.setThemes([T.new(e)]);
24
+ const s = e.container.children.push(
25
+ v.new(e, {
26
26
  panX: !1,
27
27
  panY: !1,
28
28
  wheelX: "none",
@@ -32,80 +32,82 @@ const z = ({
32
32
  paddingTop: 0,
33
33
  paddingBottom: 0
34
34
  })
35
- ), s = i.xAxes.push(
36
- L.new(e, {
35
+ ), o = s.xAxes.push(
36
+ X.new(e, {
37
37
  categoryField: "t",
38
- renderer: T.new(e, {
38
+ renderer: b.new(e, {
39
39
  minGridDistance: 10
40
40
  }),
41
- tooltip: X.new(e, {})
41
+ tooltip: F.new(e, {})
42
42
  })
43
- ), c = s.get("renderer");
44
- c.grid.template.set("visible", !1), c.labels.template.set("visible", !1), s.setAll({
43
+ ), d = o.get("renderer");
44
+ d.grid.template.set("visible", !1), d.labels.template.set("visible", !1), o.setAll({
45
45
  startLocation: 0.5,
46
46
  endLocation: 0.5
47
- }), s.data.setAll(o);
48
- const n = i.yAxes.push(
49
- R.new(e, {
50
- renderer: b.new(e, {})
47
+ }), o.data.setAll(a);
48
+ const m = s.yAxes.push(
49
+ L.new(e, {
50
+ renderer: C.new(e, {})
51
51
  })
52
- ), f = n.get("renderer");
52
+ ), f = m.get("renderer");
53
53
  f.grid.template.set("visible", !1), f.labels.template.set("visible", !1);
54
- let r;
55
- return p === "column" ? (r = i.series.push(
56
- C.new(e, {
54
+ let t;
55
+ return p === "column" ? (t = s.series.push(
56
+ S.new(e, {
57
57
  name: "Series",
58
- xAxis: s,
59
- yAxis: n,
58
+ xAxis: o,
59
+ yAxis: m,
60
60
  valueYField: "v",
61
61
  categoryXField: "t",
62
- fill: a(t.palette.divider)
62
+ fill: i(r)
63
63
  })
64
- ), r.columns.template.setAll({
64
+ ), t.columns.template.setAll({
65
65
  cornerRadiusTL: 2,
66
66
  cornerRadiusTR: 2,
67
67
  strokeOpacity: 0
68
- })) : (r = i.series.push(
68
+ })) : (t = s.series.push(
69
69
  Y.new(e, {
70
70
  name: "Series",
71
- xAxis: s,
72
- yAxis: n,
71
+ xAxis: o,
72
+ yAxis: m,
73
73
  valueYField: "v",
74
74
  categoryXField: "t",
75
75
  // @ts-expect-error amcharts5 typing accepts string/Color; alpha returns rgba string
76
- fill: v(t.palette.divider, 0.25),
77
- stroke: a(t.palette.divider)
76
+ fill: x(r, 0.25),
77
+ stroke: i(r)
78
78
  })
79
- ), r.strokes.template.setAll({
79
+ ), t.strokes.template.setAll({
80
80
  strokeWidth: 1
81
- }), r.fills.template.setAll({
81
+ }), t.fills.template.setAll({
82
82
  fillOpacity: 1,
83
- visible: !0,
84
- ...m && {
85
- fillGradient: F.new(e, {
83
+ // "none" leaves the stroke alone on the card surface, which is what the plain
84
+ // sparklines want; anything else paints the band beneath it.
85
+ visible: n !== "none",
86
+ ...n === "gradient" && {
87
+ fillGradient: G.new(e, {
86
88
  rotation: 90,
87
89
  stops: [
88
- { color: a(t.palette.divider), opacity: 0.6 },
89
- { color: a(t.palette.divider), opacity: 0 }
90
+ { color: i(r), opacity: 0.6 },
91
+ { color: i(r), opacity: 0 }
90
92
  ]
91
93
  })
92
94
  }
93
- })), r.data.setAll(o), r.appear(1e3), i.appear(1e3, 100), () => {
95
+ })), t.data.setAll(a), t.appear(1e3), s.appear(1e3, 100), () => {
94
96
  e.dispose();
95
97
  };
96
- }, [o, p, d, m, t.palette.mode, t.palette.divider]), /* @__PURE__ */ h(
98
+ }, [a, p, n, r, c.palette.mode]), /* @__PURE__ */ A(
97
99
  "div",
98
100
  {
99
101
  ref: l,
100
- style: d ? { width: "100%", height: "100%" } : {
101
- width: "calc(100% + 10px)",
102
+ style: {
103
+ width: `calc(100% + ${u}px)`,
102
104
  height: "100%",
103
- marginBottom: -21,
104
- marginLeft: -10
105
+ marginLeft: -u,
106
+ marginBottom: -k
105
107
  }
106
108
  }
107
109
  );
108
110
  };
109
111
  export {
110
- z as MetricChart
112
+ q as MetricChart
111
113
  };