@gostudent/shared-ui-library 1.33.0-DT-17051.6 → 1.33.0

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.
@@ -0,0 +1,155 @@
1
+ import { jsx as e, jsxs as n, Fragment as D } from "react/jsx-runtime";
2
+ import { ResponsiveContainer as y, LineChart as W, CartesianGrid as w, XAxis as C, YAxis as S, Tooltip as A, Legend as M, Line as m, ReferenceLine as _ } from "recharts";
3
+ import { s as t, f as g, e as B } from "./index-BetfWNU1.js";
4
+ const v = [
5
+ "var(--color-chart-series-1)",
6
+ "var(--color-chart-series-2)",
7
+ "var(--color-chart-series-3)",
8
+ "var(--color-chart-series-4)",
9
+ "var(--color-chart-series-5)",
10
+ "var(--color-chart-series-6)",
11
+ "var(--color-chart-series-7)",
12
+ "var(--color-chart-series-8)"
13
+ ];
14
+ function E(a) {
15
+ let r = 0;
16
+ for (let l = 0; l < a.length; l++)
17
+ r = a.charCodeAt(l) + ((r << 5) - r);
18
+ return v[Math.abs(r) % v.length];
19
+ }
20
+ function R({ active: a, payload: r, label: l, locale: c }) {
21
+ if (!a || !(r != null && r.length)) return null;
22
+ const d = l != null ? new Date(l) : null, i = d ? g(d, "d MMM yyyy", { locale: c }) : "";
23
+ return /* @__PURE__ */ n("div", { className: t.tooltip, role: "tooltip", children: [
24
+ i && /* @__PURE__ */ e("p", { className: t.tooltipDate, children: i }),
25
+ r.map((s) => /* @__PURE__ */ n("div", { className: t.tooltipRow, children: [
26
+ /* @__PURE__ */ e("span", { className: t.tooltipDot, style: { background: s.color }, "aria-hidden": "true" }),
27
+ /* @__PURE__ */ e("span", { className: t.tooltipLabel, children: s.name }),
28
+ /* @__PURE__ */ e("span", { className: t.tooltipValue, children: s.value })
29
+ ] }, s.name))
30
+ ] });
31
+ }
32
+ function T({ payload: a }) {
33
+ return a != null && a.length ? /* @__PURE__ */ e("ul", { className: t.legend, role: "list", children: a.map((r) => /* @__PURE__ */ n("li", { className: t.legendItem, children: [
34
+ r.type === "plainline" ? /* @__PURE__ */ e("svg", { className: t.legendLineSvg, viewBox: "0 0 24 4", "aria-hidden": "true", children: /* @__PURE__ */ e("line", { x1: "0", y1: "2", x2: "24", y2: "2", stroke: r.color, strokeWidth: "2", strokeDasharray: "4 3" }) }) : /* @__PURE__ */ e("svg", { className: t.legendLineSvg, viewBox: "0 0 24 4", "aria-hidden": "true", children: /* @__PURE__ */ e("line", { x1: "0", y1: "2", x2: "24", y2: "2", stroke: r.color, strokeWidth: "2" }) }),
35
+ /* @__PURE__ */ e("span", { className: t.legendLabel, children: r.value })
36
+ ] }, r.value)) }) : null;
37
+ }
38
+ function K({
39
+ data: a,
40
+ series: r,
41
+ yDomain: l,
42
+ yTicks: c,
43
+ reversed: d = !1,
44
+ referenceLine: i,
45
+ colorMap: s,
46
+ locale: k = B,
47
+ labels: p,
48
+ renderTooltipContent: f,
49
+ height: x = 240,
50
+ className: L
51
+ }) {
52
+ if (!a.length)
53
+ return /* @__PURE__ */ e("div", { className: t.empty, role: "status", children: p.noData });
54
+ const u = k, N = [t.root, L].filter(Boolean).join(" ");
55
+ return /* @__PURE__ */ e("figure", { className: N, children: /* @__PURE__ */ e("div", { className: t.chart, children: /* @__PURE__ */ e(y, { width: "100%", height: x, children: /* @__PURE__ */ n(W, { data: [...a], margin: { top: 8, right: 8, bottom: 0, left: -16 }, children: [
56
+ /* @__PURE__ */ e(
57
+ w,
58
+ {
59
+ strokeDasharray: "none",
60
+ stroke: "var(--color-border-default, #dadbe5)",
61
+ strokeWidth: 1,
62
+ vertical: !1
63
+ }
64
+ ),
65
+ /* @__PURE__ */ e(
66
+ C,
67
+ {
68
+ dataKey: "ts",
69
+ type: "number",
70
+ scale: "time",
71
+ domain: ["dataMin", "dataMax"],
72
+ tickFormatter: (o) => g(new Date(o), "d MMM", { locale: u }),
73
+ tick: { fontSize: 11, fill: "var(--color-text-secondary, #555978)" },
74
+ axisLine: { stroke: "var(--color-border-default, #dadbe5)" },
75
+ tickLine: !1,
76
+ minTickGap: 40
77
+ }
78
+ ),
79
+ /* @__PURE__ */ e(
80
+ S,
81
+ {
82
+ domain: [...l],
83
+ ticks: c ? [...c] : void 0,
84
+ reversed: d,
85
+ tick: { fontSize: 11, fill: "var(--color-text-secondary, #555978)" },
86
+ axisLine: !1,
87
+ tickLine: !1,
88
+ width: 28
89
+ }
90
+ ),
91
+ /* @__PURE__ */ e(
92
+ A,
93
+ {
94
+ content: (o) => {
95
+ const h = { ...o, locale: u };
96
+ return f ? f(h) : /* @__PURE__ */ e(R, { ...h });
97
+ },
98
+ cursor: { stroke: "var(--color-border-medium, #c3c5d5)", strokeWidth: 1 }
99
+ }
100
+ ),
101
+ /* @__PURE__ */ e(
102
+ M,
103
+ {
104
+ content: (o) => /* @__PURE__ */ e(T, { ...o }),
105
+ verticalAlign: "bottom"
106
+ }
107
+ ),
108
+ r.map(({ key: o, label: h }) => {
109
+ const b = (s == null ? void 0 : s[o]) ?? E(o);
110
+ return /* @__PURE__ */ e(
111
+ m,
112
+ {
113
+ type: "monotone",
114
+ dataKey: o,
115
+ name: h ?? o,
116
+ stroke: b,
117
+ strokeWidth: 2,
118
+ dot: { r: 4, strokeWidth: 2, fill: "var(--color-surface-default, #ffffff)" },
119
+ activeDot: { r: 6, strokeWidth: 2 },
120
+ connectNulls: !1
121
+ },
122
+ o
123
+ );
124
+ }),
125
+ i && /* @__PURE__ */ n(D, { children: [
126
+ /* @__PURE__ */ e(
127
+ m,
128
+ {
129
+ dataKey: "__ref__",
130
+ name: i.label,
131
+ stroke: "var(--color-chart-reference)",
132
+ strokeDasharray: "6 4",
133
+ strokeWidth: 1.5,
134
+ dot: !1,
135
+ activeDot: !1,
136
+ legendType: "plainline"
137
+ }
138
+ ),
139
+ /* @__PURE__ */ e(
140
+ _,
141
+ {
142
+ y: i.value,
143
+ stroke: "var(--color-chart-reference)",
144
+ strokeDasharray: "6 4",
145
+ strokeWidth: 1.5,
146
+ label: !1,
147
+ ifOverflow: "extendDomain"
148
+ }
149
+ )
150
+ ] })
151
+ ] }) }) }) });
152
+ }
153
+ export {
154
+ K as default
155
+ };