@dss-kit/ui-kit 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/charts/LineChart/LineChart.js +17 -15
- package/dist/components/charts/PieProgressChart/PieProgressChart.js +16 -14
- package/dist/node_modules/@highcharts/react/Highcharts.js +161 -0
- package/dist/node_modules/@highcharts/react/options/Title.js +14 -0
- package/dist/node_modules/@highcharts/react/options/Tooltip.js +14 -0
- package/dist/ui-kit.cjs +8 -8
- package/package.json +1 -1
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { cx as h } from "@emotion/css";
|
|
3
|
-
import { Chart as b
|
|
3
|
+
import { Chart as b } from "../../../node_modules/@highcharts/react/Highcharts.js";
|
|
4
|
+
import "../../../node_modules/@highcharts/react/options/Title.js";
|
|
5
|
+
import { Tooltip as C } from "../../../node_modules/@highcharts/react/options/Tooltip.js";
|
|
4
6
|
import { useRef as T, useEffect as y, useMemo as o } from "react";
|
|
5
7
|
import { buildLineChartOptions as E, buildTooltipProps as L } from "./utils.js";
|
|
6
8
|
const j = ({
|
|
7
9
|
color: n = "positive",
|
|
8
|
-
data:
|
|
9
|
-
xAxis:
|
|
10
|
-
yAxis:
|
|
10
|
+
data: i = [],
|
|
11
|
+
xAxis: s,
|
|
12
|
+
yAxis: m,
|
|
11
13
|
containerProps: e,
|
|
12
|
-
highcharts:
|
|
14
|
+
highcharts: l,
|
|
13
15
|
tooltip: r,
|
|
14
|
-
className:
|
|
15
|
-
style:
|
|
16
|
+
className: p,
|
|
17
|
+
style: f
|
|
16
18
|
}) => {
|
|
17
19
|
const t = T(null);
|
|
18
20
|
y(() => () => {
|
|
19
21
|
typeof t == "object" && t?.current?.chart && t.current.chart.destroy();
|
|
20
22
|
}, []);
|
|
21
|
-
const c = o(() => E(n,
|
|
23
|
+
const c = o(() => E(n, i, s, m, !!r), [n, i, s, m, r]), u = o(() => r ? L(r) : { enabled: !1 }, [r]), d = o(
|
|
22
24
|
() => ({
|
|
23
25
|
...e,
|
|
24
|
-
className: h(e?.className,
|
|
25
|
-
style: { ...e?.style, ...
|
|
26
|
+
className: h(e?.className, p),
|
|
27
|
+
style: { ...e?.style, ...f }
|
|
26
28
|
}),
|
|
27
|
-
[e,
|
|
29
|
+
[e, p, f]
|
|
28
30
|
);
|
|
29
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ a(
|
|
30
32
|
b,
|
|
31
33
|
{
|
|
32
|
-
highcharts:
|
|
34
|
+
highcharts: l,
|
|
33
35
|
ref: t,
|
|
34
36
|
options: c,
|
|
35
37
|
containerProps: d,
|
|
36
|
-
children: /* @__PURE__ */
|
|
38
|
+
children: /* @__PURE__ */ a(C, { ...u })
|
|
37
39
|
}
|
|
38
40
|
);
|
|
39
41
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cx as
|
|
3
|
-
import { Chart as d
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { cx as l } from "@emotion/css";
|
|
3
|
+
import { Chart as d } from "../../../node_modules/@highcharts/react/Highcharts.js";
|
|
4
|
+
import { Title as C } from "../../../node_modules/@highcharts/react/options/Title.js";
|
|
5
|
+
import "../../../node_modules/@highcharts/react/options/Tooltip.js";
|
|
4
6
|
import { forwardRef as P, useRef as y, useEffect as R, useMemo as n } from "react";
|
|
5
7
|
import { buildPieProgressChartOptions as x } from "./utils.js";
|
|
6
8
|
const b = P(
|
|
@@ -11,28 +13,28 @@ const b = P(
|
|
|
11
13
|
label: a = (o) => `${o}%`,
|
|
12
14
|
containerProps: t,
|
|
13
15
|
className: i,
|
|
14
|
-
style:
|
|
15
|
-
},
|
|
16
|
-
const o = y(null), r =
|
|
16
|
+
style: m
|
|
17
|
+
}, p) => {
|
|
18
|
+
const o = y(null), r = p || o;
|
|
17
19
|
R(() => () => {
|
|
18
20
|
typeof r == "object" && r?.current?.chart && r.current.chart.destroy();
|
|
19
21
|
}, [r]);
|
|
20
|
-
const
|
|
22
|
+
const u = n(() => x(e, s), [e, s]), h = n(
|
|
21
23
|
() => ({
|
|
22
24
|
...t,
|
|
23
|
-
className:
|
|
24
|
-
style: { ...t?.style, ...
|
|
25
|
+
className: l(t?.className, i),
|
|
26
|
+
style: { ...t?.style, ...m }
|
|
25
27
|
}),
|
|
26
|
-
[t, i,
|
|
28
|
+
[t, i, m]
|
|
27
29
|
);
|
|
28
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ f(
|
|
29
31
|
d,
|
|
30
32
|
{
|
|
31
33
|
highcharts: c,
|
|
32
34
|
ref: r,
|
|
33
|
-
options:
|
|
34
|
-
containerProps:
|
|
35
|
-
children: /* @__PURE__ */
|
|
35
|
+
options: u,
|
|
36
|
+
containerProps: h,
|
|
37
|
+
children: /* @__PURE__ */ f(C, { children: a?.(e) })
|
|
36
38
|
}
|
|
37
39
|
);
|
|
38
40
|
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import $, { forwardRef as w, useRef as m, useImperativeHandle as I, useEffect as k } from "react";
|
|
2
|
+
import { renderToStaticMarkup as j } from "react-dom/server";
|
|
3
|
+
import H from "highcharts";
|
|
4
|
+
var P = function(o, l) {
|
|
5
|
+
var h = {};
|
|
6
|
+
for (var i in o) Object.prototype.hasOwnProperty.call(o, i) && l.indexOf(i) < 0 && (h[i] = o[i]);
|
|
7
|
+
if (o != null && typeof Object.getOwnPropertySymbols == "function")
|
|
8
|
+
for (var p = 0, i = Object.getOwnPropertySymbols(o); p < i.length; p++)
|
|
9
|
+
l.indexOf(i[p]) < 0 && Object.prototype.propertyIsEnumerable.call(o, i[p]) && (h[i[p]] = o[i[p]]);
|
|
10
|
+
return h;
|
|
11
|
+
};
|
|
12
|
+
H.AST.allowedAttributes.indexOf("data-hc-option") === -1 && H.AST.allowedAttributes.push("data-hc-option");
|
|
13
|
+
let O = H;
|
|
14
|
+
const A = {
|
|
15
|
+
logLevel: "silent",
|
|
16
|
+
log(...o) {
|
|
17
|
+
this.logLevel === "debug" && console.log(...o);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function J(o) {
|
|
21
|
+
if (o === void 0) {
|
|
22
|
+
O = H, delete O.__provided;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
O = o, O.__provided = !0;
|
|
26
|
+
}
|
|
27
|
+
function N() {
|
|
28
|
+
return O;
|
|
29
|
+
}
|
|
30
|
+
const S = (o) => Array.isArray(o) ? o.flat() : [o];
|
|
31
|
+
function b(o, l = void 0) {
|
|
32
|
+
const h = {};
|
|
33
|
+
function i(t, e, c = null) {
|
|
34
|
+
const a = e.split(".");
|
|
35
|
+
let u = t;
|
|
36
|
+
for (let f = 0; f < a.length - 1; f++) {
|
|
37
|
+
const r = a[f];
|
|
38
|
+
u[r] || (u[r] = {}), u = u[r];
|
|
39
|
+
}
|
|
40
|
+
return u[a[a.length - 1]] = c, t;
|
|
41
|
+
}
|
|
42
|
+
function p(t) {
|
|
43
|
+
return l ? l(t) : t.filter((e) => typeof e == "string").join("");
|
|
44
|
+
}
|
|
45
|
+
function g(t) {
|
|
46
|
+
return typeof t == "object" && t !== null && "$$typeof" in t && "props" in t;
|
|
47
|
+
}
|
|
48
|
+
function _(t, e) {
|
|
49
|
+
return Object.assign(Object.assign({}, t), { childOption: e.childOption ? `${e.childOption}.${t.childOption}` : t.childOption, HCOption: e.HCOption ? `${e.HCOption}.${t.HCOption}` : t.HCOption });
|
|
50
|
+
}
|
|
51
|
+
function C(t, e, c) {
|
|
52
|
+
var a, u, f;
|
|
53
|
+
if (!t)
|
|
54
|
+
return;
|
|
55
|
+
if (Array.isArray(t) && t.some((n) => {
|
|
56
|
+
var d;
|
|
57
|
+
return (d = n?.props) === null || d === void 0 ? void 0 : d["data-hc-option"];
|
|
58
|
+
})) {
|
|
59
|
+
const n = [];
|
|
60
|
+
for (const d of t) {
|
|
61
|
+
const v = (a = d?.props) === null || a === void 0 ? void 0 : a["data-hc-option"];
|
|
62
|
+
v ? i(e, v, p([d])) : n.push(d);
|
|
63
|
+
}
|
|
64
|
+
n.length && c.childOption && i(e, c.childOption, p(n));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const r = [];
|
|
68
|
+
if (Array.isArray(t))
|
|
69
|
+
for (const n of t) {
|
|
70
|
+
if (!((u = n?.type) === null || u === void 0) && u._HCReact) {
|
|
71
|
+
const d = n.type._HCReact;
|
|
72
|
+
n.type._HCReact = _(d, c), s(n);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
r.push(n);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const n = t;
|
|
79
|
+
if (!((f = n?.type) === null || f === void 0) && f._HCReact) {
|
|
80
|
+
const d = n.type._HCReact;
|
|
81
|
+
n.type._HCReact = _(d, c), s(n);
|
|
82
|
+
} else
|
|
83
|
+
r.push(n);
|
|
84
|
+
}
|
|
85
|
+
if (c.childOption) {
|
|
86
|
+
const n = r.length > 0 ? r : [t];
|
|
87
|
+
i(e, c.childOption, p(n));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function s(t) {
|
|
91
|
+
var e, c, a, u, f;
|
|
92
|
+
if (!t || typeof t != "object")
|
|
93
|
+
return;
|
|
94
|
+
const r = (e = t.type) === null || e === void 0 ? void 0 : e._HCReact;
|
|
95
|
+
if (!r?.HCOption)
|
|
96
|
+
return;
|
|
97
|
+
const n = (c = h[f = r.HCOption]) !== null && c !== void 0 ? c : h[f] = r.isArrayType ? [] : {}, d = Array.isArray(n), v = d ? {} : n, R = (a = t.props) !== null && a !== void 0 ? a : {}, { children: y } = R, E = P(R, ["children"]);
|
|
98
|
+
r.defaultOptions && Object.assign(v, r.defaultOptions), Object.assign(v, E), typeof y == "string" && r.childOption ? i(v, r.childOption, y) : Array.isArray(y) ? C(y, v, r) : g(y) && l && (!((u = y.props) === null || u === void 0) && u.children && Object.keys(y.props).length === 1 ? C(y.props.children, v, r) : r.childOption && i(v, r.childOption, l(y))), d && h[r.HCOption].push(v);
|
|
99
|
+
}
|
|
100
|
+
return Array.isArray(o) ? o.flat().forEach((t) => s(t)) : s(o), h;
|
|
101
|
+
}
|
|
102
|
+
const T = w(function(l, h) {
|
|
103
|
+
l.highcharts && J(l.highcharts);
|
|
104
|
+
const i = O.merge(Object.assign({
|
|
105
|
+
title: { text: l.title || void 0 }
|
|
106
|
+
}, l.options || {}), Object.assign({ series: l.children ? S(l.children).filter((s) => {
|
|
107
|
+
var t;
|
|
108
|
+
return ((t = s?.type) === null || t === void 0 ? void 0 : t.type) === "Series";
|
|
109
|
+
}).map((s) => {
|
|
110
|
+
var t, e, c;
|
|
111
|
+
return O.merge({
|
|
112
|
+
type: (t = s.props.type) !== null && t !== void 0 ? t : (c = (e = s.type) === null || e === void 0 ? void 0 : e._HCReact) === null || c === void 0 ? void 0 : c.HC_Option.replace("series.", ""),
|
|
113
|
+
data: s.props.data || []
|
|
114
|
+
}, Object.assign(Object.assign({}, s.props.options || {}), b(s.props.children, j)));
|
|
115
|
+
}) : [] }, b(l.children, j)), l.options || {}), p = m(), g = m();
|
|
116
|
+
I(h, () => ({
|
|
117
|
+
get chart() {
|
|
118
|
+
return g.current;
|
|
119
|
+
},
|
|
120
|
+
get container() {
|
|
121
|
+
return p.current;
|
|
122
|
+
}
|
|
123
|
+
}), []);
|
|
124
|
+
const _ = (s) => {
|
|
125
|
+
var t, e;
|
|
126
|
+
(t = (e = s.title).text) !== null && t !== void 0 || (e.text = l.title);
|
|
127
|
+
}, C = () => {
|
|
128
|
+
l.children && S(l.children).filter((t) => {
|
|
129
|
+
var e;
|
|
130
|
+
return ((e = t?.type) === null || e === void 0 ? void 0 : e.type) === "Series";
|
|
131
|
+
}).forEach((t, e) => {
|
|
132
|
+
var c;
|
|
133
|
+
if (t.props) {
|
|
134
|
+
const a = t.props, { children: u, type: f, options: r } = a, n = P(a, ["children", "type", "options"]);
|
|
135
|
+
r && (i.series[e] = O.merge(i.series[e], r)), i.series[e] = O.merge(i.series[e], Object.assign(Object.assign({ type: f ?? ((c = t?.type) === null || c === void 0 ? void 0 : c._HCReact.HC_Option.replace("series.", "")) }, b(t.props.children)), n));
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
return k(() => {
|
|
140
|
+
if (A.log(JSON.stringify(i, void 0, " ")), g.current)
|
|
141
|
+
A.log("Updating chart", JSON.parse(JSON.stringify(i))), _(i), C(), g.current.update(Object.assign(Object.assign({}, i), b(l.children, j)), !0, !0);
|
|
142
|
+
else {
|
|
143
|
+
const s = l.chartConstructor || "chart";
|
|
144
|
+
A.log("Creating chart using", s, "constructor"), g.current = N()[s](p.current, i);
|
|
145
|
+
}
|
|
146
|
+
}), $.createElement("div", Object.assign({}, l.containerProps, { ref: p }));
|
|
147
|
+
});
|
|
148
|
+
function x(o) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
x.type = "Series";
|
|
152
|
+
T.Series = x;
|
|
153
|
+
export {
|
|
154
|
+
T as Chart,
|
|
155
|
+
O as Highcharts,
|
|
156
|
+
A as Logger,
|
|
157
|
+
x as Series,
|
|
158
|
+
T as default,
|
|
159
|
+
N as getHighcharts,
|
|
160
|
+
J as setHighcharts
|
|
161
|
+
};
|