@object-ui/plugin-charts 4.0.4 → 4.0.6
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/CHANGELOG.md +44 -0
- package/dist/index.js +613 -67
- package/package.json +6 -6
- package/dist/AdvancedChartImpl-DkX8ZQ5Y.js +0 -412
- package/dist/ChartImpl-ZGY2c86F.js +0 -133
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-charts",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Chart components plugin for Object UI, powered by Recharts",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"lucide-react": "^1.14.0",
|
|
28
28
|
"recharts": "^3.8.1",
|
|
29
|
-
"@object-ui/components": "4.0.
|
|
30
|
-
"@object-ui/core": "4.0.
|
|
31
|
-
"@object-ui/i18n": "4.0.
|
|
32
|
-
"@object-ui/react": "4.0.
|
|
33
|
-
"@object-ui/types": "4.0.
|
|
29
|
+
"@object-ui/components": "4.0.6",
|
|
30
|
+
"@object-ui/core": "4.0.6",
|
|
31
|
+
"@object-ui/i18n": "4.0.6",
|
|
32
|
+
"@object-ui/react": "4.0.6",
|
|
33
|
+
"@object-ui/types": "4.0.6"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
import * as e from "react";
|
|
2
|
-
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
|
-
import { Area as i, AreaChart as a, Bar as o, BarChart as s, CartesianGrid as c, Cell as l, Legend as u, Line as d, LineChart as f, Pie as p, PieChart as m, PolarAngleAxis as h, PolarGrid as g, PolarRadiusAxis as _, Radar as v, RadarChart as y, ResponsiveContainer as b, Scatter as x, ScatterChart as S, Tooltip as C, XAxis as w, YAxis as T, ZAxis as E } from "recharts";
|
|
4
|
-
//#region src/ChartContainerImpl.tsx
|
|
5
|
-
var D = (...e) => e.filter(Boolean).join(" "), O = {
|
|
6
|
-
light: "",
|
|
7
|
-
dark: ".dark"
|
|
8
|
-
}, k = e.createContext(null);
|
|
9
|
-
function A() {
|
|
10
|
-
let t = e.useContext(k);
|
|
11
|
-
if (!t) throw Error("useChart must be used within a <ChartContainer />");
|
|
12
|
-
return t;
|
|
13
|
-
}
|
|
14
|
-
function j({ id: t, className: i, children: a, config: o, ...s }) {
|
|
15
|
-
let c = e.useId(), l = `chart-${t || c.replace(/:/g, "")}`;
|
|
16
|
-
return /* @__PURE__ */ n(k.Provider, {
|
|
17
|
-
value: { config: o },
|
|
18
|
-
children: /* @__PURE__ */ r("div", {
|
|
19
|
-
"data-slot": "chart",
|
|
20
|
-
"data-chart": l,
|
|
21
|
-
className: D("flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", i),
|
|
22
|
-
...s,
|
|
23
|
-
children: [/* @__PURE__ */ n(M, {
|
|
24
|
-
id: l,
|
|
25
|
-
config: o
|
|
26
|
-
}), /* @__PURE__ */ n(b, {
|
|
27
|
-
width: "100%",
|
|
28
|
-
height: "100%",
|
|
29
|
-
children: a
|
|
30
|
-
})]
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
var M = ({ id: e, config: t }) => {
|
|
35
|
-
let r = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
36
|
-
return r.length ? /* @__PURE__ */ n("style", { dangerouslySetInnerHTML: { __html: Object.entries(O).map(([t, n]) => `
|
|
37
|
-
${n} [data-chart=${e}] {
|
|
38
|
-
${r.map(([e, n]) => {
|
|
39
|
-
let r = n.theme?.[t] || n.color;
|
|
40
|
-
return r ? ` --color-${e}: ${r};` : null;
|
|
41
|
-
}).join("\n")}
|
|
42
|
-
}
|
|
43
|
-
`).join("\n") } }) : null;
|
|
44
|
-
}, N = C;
|
|
45
|
-
function P({ active: i, payload: a, className: o, indicator: s = "dot", hideLabel: c = !1, hideIndicator: l = !1, label: u, labelFormatter: d, labelClassName: f, formatter: p, color: m, nameKey: h, labelKey: g }) {
|
|
46
|
-
let { config: _ } = A(), v = e.useMemo(() => {
|
|
47
|
-
if (c || !a?.length) return null;
|
|
48
|
-
let [e] = a, t = L(_, e, `${g || e?.dataKey || e?.name || "value"}`), r = !g && typeof u == "string" ? _[u]?.label || u : t?.label;
|
|
49
|
-
return d ? /* @__PURE__ */ n("div", {
|
|
50
|
-
className: D("font-medium", f),
|
|
51
|
-
children: d(r, a)
|
|
52
|
-
}) : r ? /* @__PURE__ */ n("div", {
|
|
53
|
-
className: D("font-medium", f),
|
|
54
|
-
children: r
|
|
55
|
-
}) : null;
|
|
56
|
-
}, [
|
|
57
|
-
u,
|
|
58
|
-
d,
|
|
59
|
-
a,
|
|
60
|
-
c,
|
|
61
|
-
f,
|
|
62
|
-
_,
|
|
63
|
-
g
|
|
64
|
-
]);
|
|
65
|
-
if (!i || !a?.length) return null;
|
|
66
|
-
let y = a.length === 1 && s !== "dot";
|
|
67
|
-
return /* @__PURE__ */ r("div", {
|
|
68
|
-
className: D("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", o),
|
|
69
|
-
children: [y ? null : v, /* @__PURE__ */ n("div", {
|
|
70
|
-
className: "grid gap-1.5",
|
|
71
|
-
children: a.filter((e) => e.type !== "none").map((e, i) => {
|
|
72
|
-
let a = L(_, e, `${h || e.name || e.dataKey || "value"}`), o = m || e.payload.fill || e.color;
|
|
73
|
-
return /* @__PURE__ */ n("div", {
|
|
74
|
-
className: D("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", s === "dot" ? "items-center" : ""),
|
|
75
|
-
children: p && e?.value !== void 0 && e.name ? p(e.value, e.name, e, i, e.payload) : /* @__PURE__ */ r(t, { children: [a?.icon ? /* @__PURE__ */ n(a.icon, {}) : !l && /* @__PURE__ */ n("div", {
|
|
76
|
-
className: D("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", s === "dot" ? "h-2.5 w-2.5" : "", s === "line" ? "w-1" : "", s === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", y && s === "dashed" ? "my-0.5" : ""),
|
|
77
|
-
style: {
|
|
78
|
-
"--color-bg": o,
|
|
79
|
-
"--color-border": o
|
|
80
|
-
}
|
|
81
|
-
}), /* @__PURE__ */ r("div", {
|
|
82
|
-
className: D("flex flex-1 justify-between leading-none", y ? "items-end" : "items-center"),
|
|
83
|
-
children: [/* @__PURE__ */ r("div", {
|
|
84
|
-
className: "grid gap-1.5",
|
|
85
|
-
children: [y ? v : null, /* @__PURE__ */ n("span", {
|
|
86
|
-
className: "text-muted-foreground",
|
|
87
|
-
children: a?.label || e.name
|
|
88
|
-
})]
|
|
89
|
-
}), e.value && /* @__PURE__ */ n("span", {
|
|
90
|
-
className: "text-foreground font-mono font-medium tabular-nums",
|
|
91
|
-
children: e.value.toLocaleString()
|
|
92
|
-
})]
|
|
93
|
-
})] })
|
|
94
|
-
}, e.dataKey);
|
|
95
|
-
})
|
|
96
|
-
})]
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
var F = u;
|
|
100
|
-
function I({ className: e, hideIcon: t = !1, payload: i, verticalAlign: a = "bottom", nameKey: o }) {
|
|
101
|
-
let { config: s } = A();
|
|
102
|
-
return i?.length ? /* @__PURE__ */ n("div", {
|
|
103
|
-
className: D("flex items-center justify-center gap-4", a === "top" ? "pb-3" : "pt-3", e),
|
|
104
|
-
children: i.filter((e) => e.type !== "none").map((e) => {
|
|
105
|
-
let i = L(s, e, `${o || e.dataKey || "value"}`);
|
|
106
|
-
return /* @__PURE__ */ r("div", {
|
|
107
|
-
className: D("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
108
|
-
children: [i?.icon && !t ? /* @__PURE__ */ n(i.icon, {}) : /* @__PURE__ */ n("div", {
|
|
109
|
-
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
110
|
-
style: { backgroundColor: e.color }
|
|
111
|
-
}), i?.label]
|
|
112
|
-
}, e.value);
|
|
113
|
-
})
|
|
114
|
-
}) : null;
|
|
115
|
-
}
|
|
116
|
-
function L(e, t, n) {
|
|
117
|
-
if (typeof t != "object" || !t) return;
|
|
118
|
-
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
119
|
-
return n in t && typeof t[n] == "string" ? i = t[n] : r && n in r && typeof r[n] == "string" && (i = r[n]), i in e ? e[i] : e[n];
|
|
120
|
-
}
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region src/AdvancedChartImpl.tsx
|
|
123
|
-
var R = "hsl(var(--primary))", z = {
|
|
124
|
-
slate: "#64748b",
|
|
125
|
-
gray: "#6b7280",
|
|
126
|
-
zinc: "#71717a",
|
|
127
|
-
neutral: "#737373",
|
|
128
|
-
stone: "#78716c",
|
|
129
|
-
red: "#ef4444",
|
|
130
|
-
orange: "#f97316",
|
|
131
|
-
amber: "#f59e0b",
|
|
132
|
-
yellow: "#eab308",
|
|
133
|
-
lime: "#84cc16",
|
|
134
|
-
green: "#22c55e",
|
|
135
|
-
emerald: "#10b981",
|
|
136
|
-
teal: "#14b8a6",
|
|
137
|
-
cyan: "#06b6d4",
|
|
138
|
-
sky: "#0ea5e9",
|
|
139
|
-
blue: "#3b82f6",
|
|
140
|
-
indigo: "#6366f1",
|
|
141
|
-
violet: "#8b5cf6",
|
|
142
|
-
purple: "#a855f7",
|
|
143
|
-
fuchsia: "#d946ef",
|
|
144
|
-
pink: "#ec4899",
|
|
145
|
-
rose: "#f43f5e"
|
|
146
|
-
}, B = (e) => z[e] || e;
|
|
147
|
-
function V({ chartType: t = "bar", data: u = [], config: b = {}, xAxisKey: C = "name", series: D = [], className: O = "" }) {
|
|
148
|
-
let k = Array.isArray(u) ? u : [], [A, M] = e.useState(!1);
|
|
149
|
-
e.useEffect(() => {
|
|
150
|
-
let e = () => M(window.innerWidth < 640);
|
|
151
|
-
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
152
|
-
}, []);
|
|
153
|
-
let L = {
|
|
154
|
-
bar: s,
|
|
155
|
-
line: f,
|
|
156
|
-
area: a,
|
|
157
|
-
pie: m,
|
|
158
|
-
donut: m,
|
|
159
|
-
radar: y,
|
|
160
|
-
scatter: S,
|
|
161
|
-
combo: s
|
|
162
|
-
}[t] || s, z = e.useMemo(() => k.some((e) => String(e[C] || "").length > 5), [k, C]), V = () => [
|
|
163
|
-
"hsl(var(--chart-1))",
|
|
164
|
-
"hsl(var(--chart-2))",
|
|
165
|
-
"hsl(var(--chart-3))",
|
|
166
|
-
"hsl(var(--chart-4))",
|
|
167
|
-
"hsl(var(--chart-5))"
|
|
168
|
-
];
|
|
169
|
-
if (t === "pie" || t === "donut") {
|
|
170
|
-
let e = t === "donut" ? 60 : 0;
|
|
171
|
-
return /* @__PURE__ */ n(j, {
|
|
172
|
-
config: b,
|
|
173
|
-
className: O,
|
|
174
|
-
children: /* @__PURE__ */ r(m, { children: [
|
|
175
|
-
/* @__PURE__ */ n(N, {
|
|
176
|
-
cursor: !1,
|
|
177
|
-
content: /* @__PURE__ */ n(P, { hideLabel: !0 })
|
|
178
|
-
}),
|
|
179
|
-
/* @__PURE__ */ n(p, {
|
|
180
|
-
data: k,
|
|
181
|
-
dataKey: D[0]?.dataKey || "value",
|
|
182
|
-
nameKey: C || "name",
|
|
183
|
-
innerRadius: e,
|
|
184
|
-
strokeWidth: 5,
|
|
185
|
-
paddingAngle: 2,
|
|
186
|
-
outerRadius: 80,
|
|
187
|
-
children: k.map((e, t) => {
|
|
188
|
-
let r = b[e[C]]?.color;
|
|
189
|
-
if (!r) {
|
|
190
|
-
let e = V();
|
|
191
|
-
r = e[t % e.length];
|
|
192
|
-
}
|
|
193
|
-
return /* @__PURE__ */ n(l, { fill: B(r) }, `cell-${t}`);
|
|
194
|
-
})
|
|
195
|
-
}),
|
|
196
|
-
/* @__PURE__ */ n(F, {
|
|
197
|
-
content: /* @__PURE__ */ n(I, { nameKey: C }),
|
|
198
|
-
...A && {
|
|
199
|
-
verticalAlign: "bottom",
|
|
200
|
-
wrapperStyle: {
|
|
201
|
-
fontSize: "11px",
|
|
202
|
-
paddingTop: "8px"
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
})
|
|
206
|
-
] })
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
return t === "radar" ? /* @__PURE__ */ n(j, {
|
|
210
|
-
config: b,
|
|
211
|
-
className: O,
|
|
212
|
-
children: /* @__PURE__ */ r(y, {
|
|
213
|
-
data: k,
|
|
214
|
-
children: [
|
|
215
|
-
/* @__PURE__ */ n(g, {}),
|
|
216
|
-
/* @__PURE__ */ n(h, { dataKey: C }),
|
|
217
|
-
/* @__PURE__ */ n(_, {}),
|
|
218
|
-
/* @__PURE__ */ n(N, { content: /* @__PURE__ */ n(P, {}) }),
|
|
219
|
-
/* @__PURE__ */ n(F, {
|
|
220
|
-
content: /* @__PURE__ */ n(I, {}),
|
|
221
|
-
...A && {
|
|
222
|
-
verticalAlign: "bottom",
|
|
223
|
-
wrapperStyle: {
|
|
224
|
-
fontSize: "11px",
|
|
225
|
-
paddingTop: "8px"
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}),
|
|
229
|
-
D.map((e) => {
|
|
230
|
-
let t = B(b[e.dataKey]?.color || R);
|
|
231
|
-
return /* @__PURE__ */ n(v, {
|
|
232
|
-
dataKey: e.dataKey,
|
|
233
|
-
stroke: t,
|
|
234
|
-
fill: t,
|
|
235
|
-
fillOpacity: .6
|
|
236
|
-
}, e.dataKey);
|
|
237
|
-
})
|
|
238
|
-
]
|
|
239
|
-
})
|
|
240
|
-
}) : t === "scatter" ? /* @__PURE__ */ n(j, {
|
|
241
|
-
config: b,
|
|
242
|
-
className: O,
|
|
243
|
-
children: /* @__PURE__ */ r(S, { children: [
|
|
244
|
-
/* @__PURE__ */ n(c, { vertical: !1 }),
|
|
245
|
-
/* @__PURE__ */ n(w, {
|
|
246
|
-
type: "number",
|
|
247
|
-
dataKey: C,
|
|
248
|
-
name: String(b[C]?.label || C),
|
|
249
|
-
tickLine: !1,
|
|
250
|
-
axisLine: !1,
|
|
251
|
-
interval: A ? Math.ceil(k.length / 5) : 0
|
|
252
|
-
}),
|
|
253
|
-
/* @__PURE__ */ n(T, {
|
|
254
|
-
type: "number",
|
|
255
|
-
dataKey: D[0]?.dataKey || "value",
|
|
256
|
-
name: String(b[D[0]?.dataKey]?.label || D[0]?.dataKey),
|
|
257
|
-
tickLine: !1,
|
|
258
|
-
axisLine: !1
|
|
259
|
-
}),
|
|
260
|
-
/* @__PURE__ */ n(E, {
|
|
261
|
-
type: "number",
|
|
262
|
-
range: [60, 400]
|
|
263
|
-
}),
|
|
264
|
-
/* @__PURE__ */ n(N, { content: /* @__PURE__ */ n(P, {}) }),
|
|
265
|
-
/* @__PURE__ */ n(F, {
|
|
266
|
-
content: /* @__PURE__ */ n(I, {}),
|
|
267
|
-
...A && {
|
|
268
|
-
verticalAlign: "bottom",
|
|
269
|
-
wrapperStyle: {
|
|
270
|
-
fontSize: "11px",
|
|
271
|
-
paddingTop: "8px"
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}),
|
|
275
|
-
D.map((e, t) => {
|
|
276
|
-
let r = V(), i = B(b[e.dataKey]?.color || r[t % r.length]);
|
|
277
|
-
return /* @__PURE__ */ n(x, {
|
|
278
|
-
name: b[e.dataKey]?.label || e.dataKey,
|
|
279
|
-
data: k,
|
|
280
|
-
fill: i
|
|
281
|
-
}, e.dataKey);
|
|
282
|
-
})
|
|
283
|
-
] })
|
|
284
|
-
}) : t === "combo" ? /* @__PURE__ */ n(j, {
|
|
285
|
-
config: b,
|
|
286
|
-
className: O,
|
|
287
|
-
children: /* @__PURE__ */ r(s, {
|
|
288
|
-
data: k,
|
|
289
|
-
children: [
|
|
290
|
-
/* @__PURE__ */ n(c, { vertical: !1 }),
|
|
291
|
-
/* @__PURE__ */ n(w, {
|
|
292
|
-
dataKey: C,
|
|
293
|
-
tickLine: !1,
|
|
294
|
-
tickMargin: 10,
|
|
295
|
-
axisLine: !1,
|
|
296
|
-
interval: A ? Math.ceil(k.length / 5) : 0,
|
|
297
|
-
tickFormatter: (e) => !e || typeof e != "string" ? e : A && e.length > 8 ? e.slice(0, 8) + "…" : e,
|
|
298
|
-
...!A && z && {
|
|
299
|
-
angle: -35,
|
|
300
|
-
textAnchor: "end",
|
|
301
|
-
height: 60
|
|
302
|
-
}
|
|
303
|
-
}),
|
|
304
|
-
/* @__PURE__ */ n(T, {
|
|
305
|
-
yAxisId: "left",
|
|
306
|
-
tickLine: !1,
|
|
307
|
-
axisLine: !1
|
|
308
|
-
}),
|
|
309
|
-
/* @__PURE__ */ n(T, {
|
|
310
|
-
yAxisId: "right",
|
|
311
|
-
orientation: "right",
|
|
312
|
-
tickLine: !1,
|
|
313
|
-
axisLine: !1
|
|
314
|
-
}),
|
|
315
|
-
/* @__PURE__ */ n(N, { content: /* @__PURE__ */ n(P, {}) }),
|
|
316
|
-
/* @__PURE__ */ n(F, {
|
|
317
|
-
content: /* @__PURE__ */ n(I, {}),
|
|
318
|
-
...A && {
|
|
319
|
-
verticalAlign: "bottom",
|
|
320
|
-
wrapperStyle: {
|
|
321
|
-
fontSize: "11px",
|
|
322
|
-
paddingTop: "8px"
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}),
|
|
326
|
-
D.map((e, t) => {
|
|
327
|
-
let r = B(b[e.dataKey]?.color || R), a = e.chartType || (t === 0 ? "bar" : "line"), s = a === "bar" ? "left" : "right";
|
|
328
|
-
return a === "line" ? /* @__PURE__ */ n(d, {
|
|
329
|
-
yAxisId: s,
|
|
330
|
-
type: "monotone",
|
|
331
|
-
dataKey: e.dataKey,
|
|
332
|
-
stroke: r,
|
|
333
|
-
strokeWidth: 2,
|
|
334
|
-
dot: !1
|
|
335
|
-
}, e.dataKey) : a === "area" ? /* @__PURE__ */ n(i, {
|
|
336
|
-
yAxisId: s,
|
|
337
|
-
type: "monotone",
|
|
338
|
-
dataKey: e.dataKey,
|
|
339
|
-
fill: r,
|
|
340
|
-
stroke: r,
|
|
341
|
-
fillOpacity: .4
|
|
342
|
-
}, e.dataKey) : /* @__PURE__ */ n(o, {
|
|
343
|
-
yAxisId: s,
|
|
344
|
-
dataKey: e.dataKey,
|
|
345
|
-
fill: r,
|
|
346
|
-
radius: 4
|
|
347
|
-
}, e.dataKey);
|
|
348
|
-
})
|
|
349
|
-
]
|
|
350
|
-
})
|
|
351
|
-
}) : /* @__PURE__ */ n(j, {
|
|
352
|
-
config: b,
|
|
353
|
-
className: O,
|
|
354
|
-
children: /* @__PURE__ */ r(L, {
|
|
355
|
-
data: k,
|
|
356
|
-
children: [
|
|
357
|
-
/* @__PURE__ */ n(c, { vertical: !1 }),
|
|
358
|
-
/* @__PURE__ */ n(w, {
|
|
359
|
-
dataKey: C,
|
|
360
|
-
tickLine: !1,
|
|
361
|
-
tickMargin: 10,
|
|
362
|
-
axisLine: !1,
|
|
363
|
-
interval: A ? Math.ceil(k.length / 5) : 0,
|
|
364
|
-
tickFormatter: (e) => !e || typeof e != "string" ? e : A && e.length > 8 ? e.slice(0, 8) + "…" : e,
|
|
365
|
-
...!A && z && {
|
|
366
|
-
angle: -35,
|
|
367
|
-
textAnchor: "end",
|
|
368
|
-
height: 60
|
|
369
|
-
}
|
|
370
|
-
}),
|
|
371
|
-
/* @__PURE__ */ n(N, { content: /* @__PURE__ */ n(P, {}) }),
|
|
372
|
-
/* @__PURE__ */ n(F, {
|
|
373
|
-
content: /* @__PURE__ */ n(I, {}),
|
|
374
|
-
...A && {
|
|
375
|
-
verticalAlign: "bottom",
|
|
376
|
-
wrapperStyle: {
|
|
377
|
-
fontSize: "11px",
|
|
378
|
-
paddingTop: "8px"
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}),
|
|
382
|
-
D.map((e, r) => {
|
|
383
|
-
let a = V(), s = B(b[e.dataKey]?.color || a[r % a.length] || R);
|
|
384
|
-
if (t === "bar") {
|
|
385
|
-
let t = D.length === 1 && k.length > 1;
|
|
386
|
-
return /* @__PURE__ */ n(o, {
|
|
387
|
-
dataKey: e.dataKey,
|
|
388
|
-
fill: s,
|
|
389
|
-
radius: 4,
|
|
390
|
-
children: t && k.map((e, t) => /* @__PURE__ */ n(l, { fill: B(a[t % a.length]) }, `cell-${t}`))
|
|
391
|
-
}, e.dataKey);
|
|
392
|
-
}
|
|
393
|
-
return t === "line" ? /* @__PURE__ */ n(d, {
|
|
394
|
-
type: "monotone",
|
|
395
|
-
dataKey: e.dataKey,
|
|
396
|
-
stroke: s,
|
|
397
|
-
strokeWidth: 2,
|
|
398
|
-
dot: !1
|
|
399
|
-
}, e.dataKey) : t === "area" ? /* @__PURE__ */ n(i, {
|
|
400
|
-
type: "monotone",
|
|
401
|
-
dataKey: e.dataKey,
|
|
402
|
-
fill: s,
|
|
403
|
-
stroke: s,
|
|
404
|
-
fillOpacity: .4
|
|
405
|
-
}, e.dataKey) : null;
|
|
406
|
-
})
|
|
407
|
-
]
|
|
408
|
-
})
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
//#endregion
|
|
412
|
-
export { V as default };
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import { Bar as n, BarChart as r, CartesianGrid as i, Legend as a, ResponsiveContainer as o, Tooltip as s, XAxis as c, YAxis as l } from "recharts";
|
|
3
|
-
//#region src/ChartImpl.tsx
|
|
4
|
-
function u({ data: u = [], dataKey: d = "value", xAxisKey: f = "name", height: p = 400, className: m = "", color: h = "hsl(var(--primary))" }) {
|
|
5
|
-
return /* @__PURE__ */ e("div", {
|
|
6
|
-
className: `p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${m}`,
|
|
7
|
-
children: /* @__PURE__ */ e(o, {
|
|
8
|
-
width: "100%",
|
|
9
|
-
height: p,
|
|
10
|
-
children: /* @__PURE__ */ t(r, {
|
|
11
|
-
data: u,
|
|
12
|
-
margin: {
|
|
13
|
-
top: 10,
|
|
14
|
-
right: 10,
|
|
15
|
-
left: 10,
|
|
16
|
-
bottom: 5
|
|
17
|
-
},
|
|
18
|
-
children: [
|
|
19
|
-
/* @__PURE__ */ t("defs", { children: [/* @__PURE__ */ t("linearGradient", {
|
|
20
|
-
id: "barGradient",
|
|
21
|
-
x1: "0",
|
|
22
|
-
y1: "0",
|
|
23
|
-
x2: "0",
|
|
24
|
-
y2: "1",
|
|
25
|
-
children: [
|
|
26
|
-
/* @__PURE__ */ e("stop", {
|
|
27
|
-
offset: "0%",
|
|
28
|
-
stopColor: h,
|
|
29
|
-
stopOpacity: 1
|
|
30
|
-
}),
|
|
31
|
-
/* @__PURE__ */ e("stop", {
|
|
32
|
-
offset: "90%",
|
|
33
|
-
stopColor: h,
|
|
34
|
-
stopOpacity: .6
|
|
35
|
-
}),
|
|
36
|
-
/* @__PURE__ */ e("stop", {
|
|
37
|
-
offset: "100%",
|
|
38
|
-
stopColor: h,
|
|
39
|
-
stopOpacity: .3
|
|
40
|
-
})
|
|
41
|
-
]
|
|
42
|
-
}), /* @__PURE__ */ t("filter", {
|
|
43
|
-
id: "glow",
|
|
44
|
-
height: "130%",
|
|
45
|
-
children: [
|
|
46
|
-
/* @__PURE__ */ e("feGaussianBlur", {
|
|
47
|
-
in: "SourceAlpha",
|
|
48
|
-
stdDeviation: "3",
|
|
49
|
-
result: "blur"
|
|
50
|
-
}),
|
|
51
|
-
/* @__PURE__ */ e("feOffset", {
|
|
52
|
-
in: "blur",
|
|
53
|
-
dx: "0",
|
|
54
|
-
dy: "0",
|
|
55
|
-
result: "offsetBlur"
|
|
56
|
-
}),
|
|
57
|
-
/* @__PURE__ */ e("feFlood", {
|
|
58
|
-
floodColor: h,
|
|
59
|
-
floodOpacity: "0.5",
|
|
60
|
-
result: "offsetColor"
|
|
61
|
-
}),
|
|
62
|
-
/* @__PURE__ */ e("feComposite", {
|
|
63
|
-
in: "offsetColor",
|
|
64
|
-
in2: "offsetBlur",
|
|
65
|
-
operator: "in",
|
|
66
|
-
result: "offsetBlur"
|
|
67
|
-
}),
|
|
68
|
-
/* @__PURE__ */ t("feMerge", { children: [/* @__PURE__ */ e("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ e("feMergeNode", { in: "SourceGraphic" })] })
|
|
69
|
-
]
|
|
70
|
-
})] }),
|
|
71
|
-
/* @__PURE__ */ e(i, {
|
|
72
|
-
strokeDasharray: "3 3",
|
|
73
|
-
stroke: "hsl(var(--border))",
|
|
74
|
-
vertical: !1
|
|
75
|
-
}),
|
|
76
|
-
/* @__PURE__ */ e(c, {
|
|
77
|
-
dataKey: f,
|
|
78
|
-
tick: {
|
|
79
|
-
fill: "hsl(var(--muted-foreground))",
|
|
80
|
-
fontSize: 12,
|
|
81
|
-
fontFamily: "monospace"
|
|
82
|
-
},
|
|
83
|
-
tickLine: !1,
|
|
84
|
-
axisLine: { stroke: "hsl(var(--border))" },
|
|
85
|
-
dy: 10
|
|
86
|
-
}),
|
|
87
|
-
/* @__PURE__ */ e(l, {
|
|
88
|
-
tick: {
|
|
89
|
-
fill: "hsl(var(--muted-foreground))",
|
|
90
|
-
fontSize: 12,
|
|
91
|
-
fontFamily: "monospace"
|
|
92
|
-
},
|
|
93
|
-
tickLine: !1,
|
|
94
|
-
axisLine: !1
|
|
95
|
-
}),
|
|
96
|
-
/* @__PURE__ */ e(s, {
|
|
97
|
-
cursor: {
|
|
98
|
-
fill: "hsl(var(--muted))",
|
|
99
|
-
opacity: .2
|
|
100
|
-
},
|
|
101
|
-
contentStyle: {
|
|
102
|
-
backgroundColor: "hsl(var(--popover))",
|
|
103
|
-
borderColor: "hsl(var(--border))",
|
|
104
|
-
color: "hsl(var(--popover-foreground))",
|
|
105
|
-
borderRadius: "8px",
|
|
106
|
-
fontFamily: "monospace",
|
|
107
|
-
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
|
|
108
|
-
},
|
|
109
|
-
itemStyle: { color: "hsl(var(--primary))" }
|
|
110
|
-
}),
|
|
111
|
-
/* @__PURE__ */ e(a, { wrapperStyle: {
|
|
112
|
-
paddingTop: "20px",
|
|
113
|
-
fontFamily: "monospace"
|
|
114
|
-
} }),
|
|
115
|
-
/* @__PURE__ */ e(n, {
|
|
116
|
-
dataKey: d,
|
|
117
|
-
fill: "url(#barGradient)",
|
|
118
|
-
radius: [
|
|
119
|
-
4,
|
|
120
|
-
4,
|
|
121
|
-
0,
|
|
122
|
-
0
|
|
123
|
-
],
|
|
124
|
-
filter: "url(#glow)",
|
|
125
|
-
animationDuration: 1500
|
|
126
|
-
})
|
|
127
|
-
]
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
//#endregion
|
|
133
|
-
export { u as default };
|