@object-ui/plugin-charts 0.3.1 → 2.0.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.
@@ -1,275 +0,0 @@
1
- import { j as a } from "./index-CTfEtwhn.js";
2
- import { a as Y, r as B, i as s, d as v, u as S, b as E, g as F, c as G, e as I, f as R, h as m, s as _, j as z, k as M, l as N, m as H, n as K, o as W, p as q, C as V, q as X, R as $, B as J, t as Q, X as U, T as Z, L as ee, v as re } from "./BarChart-RKJxvg5Y.js";
3
- import * as d from "react";
4
- import { useRef as h, useMemo as te, useLayoutEffect as g, isValidElement as ie } from "react";
5
- var ae = ["type"], se = ["dangerouslySetInnerHTML", "ticks", "scale"], ne = ["id", "scale"];
6
- function b() {
7
- return b = Object.assign ? Object.assign.bind() : function(r) {
8
- for (var e = 1; e < arguments.length; e++) {
9
- var t = arguments[e];
10
- for (var i in t) ({}).hasOwnProperty.call(t, i) && (r[i] = t[i]);
11
- }
12
- return r;
13
- }, b.apply(null, arguments);
14
- }
15
- function A(r, e) {
16
- var t = Object.keys(r);
17
- if (Object.getOwnPropertySymbols) {
18
- var i = Object.getOwnPropertySymbols(r);
19
- e && (i = i.filter(function(o) {
20
- return Object.getOwnPropertyDescriptor(r, o).enumerable;
21
- })), t.push.apply(t, i);
22
- }
23
- return t;
24
- }
25
- function P(r) {
26
- for (var e = 1; e < arguments.length; e++) {
27
- var t = arguments[e] != null ? arguments[e] : {};
28
- e % 2 ? A(Object(t), !0).forEach(function(i) {
29
- oe(r, i, t[i]);
30
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : A(Object(t)).forEach(function(i) {
31
- Object.defineProperty(r, i, Object.getOwnPropertyDescriptor(t, i));
32
- });
33
- }
34
- return r;
35
- }
36
- function oe(r, e, t) {
37
- return (e = le(e)) in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
38
- }
39
- function le(r) {
40
- var e = ue(r, "string");
41
- return typeof e == "symbol" ? e : e + "";
42
- }
43
- function ue(r, e) {
44
- if (typeof r != "object" || !r) return r;
45
- var t = r[Symbol.toPrimitive];
46
- if (t !== void 0) {
47
- var i = t.call(r, e);
48
- if (typeof i != "object") return i;
49
- throw new TypeError("@@toPrimitive must return a primitive value.");
50
- }
51
- return (e === "string" ? String : Number)(r);
52
- }
53
- function w(r, e) {
54
- if (r == null) return {};
55
- var t, i, o = ce(r, e);
56
- if (Object.getOwnPropertySymbols) {
57
- var n = Object.getOwnPropertySymbols(r);
58
- for (i = 0; i < n.length; i++) t = n[i], e.indexOf(t) === -1 && {}.propertyIsEnumerable.call(r, t) && (o[t] = r[t]);
59
- }
60
- return o;
61
- }
62
- function ce(r, e) {
63
- if (r == null) return {};
64
- var t = {};
65
- for (var i in r) if ({}.hasOwnProperty.call(r, i)) {
66
- if (e.indexOf(i) !== -1) continue;
67
- t[i] = r[i];
68
- }
69
- return t;
70
- }
71
- function de(r) {
72
- var e = S(), t = h(null), i = E(), {
73
- type: o
74
- } = r, n = w(r, ae), p = F(i, "yAxis", o), u = te(() => {
75
- if (p != null)
76
- return P(P({}, n), {}, {
77
- type: p
78
- });
79
- }, [p, n]);
80
- return g(() => {
81
- u != null && (t.current === null ? e(G(u)) : t.current !== u && e(I({
82
- prev: t.current,
83
- next: u
84
- })), t.current = u);
85
- }, [u, e]), g(() => () => {
86
- t.current && (e(R(t.current)), t.current = null);
87
- }, [e]), null;
88
- }
89
- function pe(r) {
90
- var {
91
- yAxisId: e,
92
- className: t,
93
- width: i,
94
- label: o
95
- } = r, n = h(null), p = h(null), u = m(_), D = z(), j = S(), x = "yAxis", c = m((l) => M(l, e)), y = m((l) => N(l, e)), O = m((l) => H(l, x, e, D)), f = m((l) => K(l, e));
96
- if (g(() => {
97
- if (!(i !== "auto" || !c || W(o) || /* @__PURE__ */ ie(o) || f == null)) {
98
- var l = n.current;
99
- if (l) {
100
- var k = l.getCalculatedWidth();
101
- Math.round(c.width) !== Math.round(k) && j(q({
102
- id: e,
103
- width: k
104
- }));
105
- }
106
- }
107
- }, [
108
- // The dependency on cartesianAxisRef.current is not needed because useLayoutEffect will run after every render.
109
- // The ref will be populated by then.
110
- // To re-run this effect when ticks change, we can depend on the ticks array from the store.
111
- O,
112
- c,
113
- j,
114
- o,
115
- e,
116
- i,
117
- f
118
- ]), c == null || y == null || f == null)
119
- return null;
120
- var {
121
- dangerouslySetInnerHTML: xe,
122
- ticks: ye,
123
- scale: ve
124
- } = r, L = w(r, se), {
125
- id: he,
126
- scale: ge
127
- } = f, T = w(f, ne);
128
- return /* @__PURE__ */ d.createElement(V, b({}, L, T, {
129
- ref: n,
130
- labelRef: p,
131
- x: y.x,
132
- y: y.y,
133
- tickTextProps: i === "auto" ? {
134
- width: void 0
135
- } : {
136
- width: i
137
- },
138
- width: c.width,
139
- height: c.height,
140
- className: X("recharts-".concat(x, " ").concat(x), t),
141
- viewBox: u,
142
- ticks: O,
143
- axisType: x
144
- }));
145
- }
146
- var fe = {
147
- allowDataOverflow: s.allowDataOverflow,
148
- allowDecimals: s.allowDecimals,
149
- allowDuplicatedCategory: s.allowDuplicatedCategory,
150
- angle: s.angle,
151
- axisLine: v.axisLine,
152
- hide: !1,
153
- includeHidden: s.includeHidden,
154
- interval: s.interval,
155
- label: !1,
156
- minTickGap: s.minTickGap,
157
- mirror: s.mirror,
158
- orientation: s.orientation,
159
- padding: s.padding,
160
- reversed: s.reversed,
161
- scale: s.scale,
162
- tick: s.tick,
163
- tickCount: s.tickCount,
164
- tickLine: v.tickLine,
165
- tickSize: v.tickSize,
166
- type: s.type,
167
- width: s.width,
168
- yAxisId: 0
169
- }, me = (r) => {
170
- var e = B(r, fe);
171
- return /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement(de, {
172
- interval: e.interval,
173
- id: e.yAxisId,
174
- scale: e.scale,
175
- type: e.type,
176
- domain: e.domain,
177
- allowDataOverflow: e.allowDataOverflow,
178
- dataKey: e.dataKey,
179
- allowDuplicatedCategory: e.allowDuplicatedCategory,
180
- allowDecimals: e.allowDecimals,
181
- tickCount: e.tickCount,
182
- padding: e.padding,
183
- includeHidden: e.includeHidden,
184
- reversed: e.reversed,
185
- ticks: e.ticks,
186
- width: e.width,
187
- orientation: e.orientation,
188
- mirror: e.mirror,
189
- hide: e.hide,
190
- unit: e.unit,
191
- name: e.name,
192
- angle: e.angle,
193
- minTickGap: e.minTickGap,
194
- tick: e.tick,
195
- tickFormatter: e.tickFormatter
196
- }), /* @__PURE__ */ d.createElement(pe, e));
197
- }, C = /* @__PURE__ */ d.memo(me, Y);
198
- C.displayName = "YAxis";
199
- function Oe({
200
- data: r = [],
201
- dataKey: e = "value",
202
- xAxisKey: t = "name",
203
- height: i = 400,
204
- className: o = "",
205
- // Default to standard primary color
206
- color: n = "hsl(var(--primary))"
207
- }) {
208
- return /* @__PURE__ */ a.jsx("div", { className: `p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${o}`, children: /* @__PURE__ */ a.jsx($, { width: "100%", height: i, children: /* @__PURE__ */ a.jsxs(J, { data: r, margin: { top: 20, right: 30, left: 20, bottom: 5 }, children: [
209
- /* @__PURE__ */ a.jsxs("defs", { children: [
210
- /* @__PURE__ */ a.jsxs("linearGradient", { id: "barGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
211
- /* @__PURE__ */ a.jsx("stop", { offset: "0%", stopColor: n, stopOpacity: 1 }),
212
- /* @__PURE__ */ a.jsx("stop", { offset: "90%", stopColor: n, stopOpacity: 0.6 }),
213
- /* @__PURE__ */ a.jsx("stop", { offset: "100%", stopColor: n, stopOpacity: 0.3 })
214
- ] }),
215
- /* @__PURE__ */ a.jsxs("filter", { id: "glow", height: "130%", children: [
216
- /* @__PURE__ */ a.jsx("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "3", result: "blur" }),
217
- /* @__PURE__ */ a.jsx("feOffset", { in: "blur", dx: "0", dy: "0", result: "offsetBlur" }),
218
- /* @__PURE__ */ a.jsx("feFlood", { floodColor: n, floodOpacity: "0.5", result: "offsetColor" }),
219
- /* @__PURE__ */ a.jsx("feComposite", { in: "offsetColor", in2: "offsetBlur", operator: "in", result: "offsetBlur" }),
220
- /* @__PURE__ */ a.jsxs("feMerge", { children: [
221
- /* @__PURE__ */ a.jsx("feMergeNode", { in: "offsetBlur" }),
222
- /* @__PURE__ */ a.jsx("feMergeNode", { in: "SourceGraphic" })
223
- ] })
224
- ] })
225
- ] }),
226
- /* @__PURE__ */ a.jsx(Q, { strokeDasharray: "3 3", stroke: "hsl(var(--border))", vertical: !1 }),
227
- /* @__PURE__ */ a.jsx(
228
- U,
229
- {
230
- dataKey: t,
231
- tick: { fill: "hsl(var(--muted-foreground))", fontSize: 12, fontFamily: "monospace" },
232
- tickLine: !1,
233
- axisLine: { stroke: "hsl(var(--border))" },
234
- dy: 10
235
- }
236
- ),
237
- /* @__PURE__ */ a.jsx(
238
- C,
239
- {
240
- tick: { fill: "hsl(var(--muted-foreground))", fontSize: 12, fontFamily: "monospace" },
241
- tickLine: !1,
242
- axisLine: !1
243
- }
244
- ),
245
- /* @__PURE__ */ a.jsx(
246
- Z,
247
- {
248
- cursor: { fill: "hsl(var(--muted))", opacity: 0.2 },
249
- contentStyle: {
250
- backgroundColor: "hsl(var(--popover))",
251
- borderColor: "hsl(var(--border))",
252
- color: "hsl(var(--popover-foreground))",
253
- borderRadius: "8px",
254
- fontFamily: "monospace",
255
- boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
256
- },
257
- itemStyle: { color: "hsl(var(--primary))" }
258
- }
259
- ),
260
- /* @__PURE__ */ a.jsx(ee, { wrapperStyle: { paddingTop: "20px", fontFamily: "monospace" } }),
261
- /* @__PURE__ */ a.jsx(
262
- re,
263
- {
264
- dataKey: e,
265
- fill: "url(#barGradient)",
266
- radius: [4, 4, 0, 0],
267
- filter: "url(#glow)",
268
- animationDuration: 1500
269
- }
270
- )
271
- ] }) }) });
272
- }
273
- export {
274
- Oe as default
275
- };
@@ -1,387 +0,0 @@
1
- import R, { Suspense as L } from "react";
2
- import { ComponentRegistry as V } from "@object-ui/core";
3
- import { Skeleton as J } from "@object-ui/components";
4
- var E = { exports: {} }, b = {};
5
- var M;
6
- function oe() {
7
- if (M) return b;
8
- M = 1;
9
- var a = /* @__PURE__ */ Symbol.for("react.transitional.element"), i = /* @__PURE__ */ Symbol.for("react.fragment");
10
- function u(c, o, s) {
11
- var f = null;
12
- if (s !== void 0 && (f = "" + s), o.key !== void 0 && (f = "" + o.key), "key" in o) {
13
- s = {};
14
- for (var d in o)
15
- d !== "key" && (s[d] = o[d]);
16
- } else s = o;
17
- return o = s.ref, {
18
- $$typeof: a,
19
- type: c,
20
- key: f,
21
- ref: o !== void 0 ? o : null,
22
- props: s
23
- };
24
- }
25
- return b.Fragment = i, b.jsx = u, b.jsxs = u, b;
26
- }
27
- var y = {};
28
- var I;
29
- function se() {
30
- return I || (I = 1, process.env.NODE_ENV !== "production" && (function() {
31
- function a(e) {
32
- if (e == null) return null;
33
- if (typeof e == "function")
34
- return e.$$typeof === te ? null : e.displayName || e.name || null;
35
- if (typeof e == "string") return e;
36
- switch (e) {
37
- case T:
38
- return "Fragment";
39
- case G:
40
- return "Profiler";
41
- case X:
42
- return "StrictMode";
43
- case Q:
44
- return "Suspense";
45
- case ee:
46
- return "SuspenseList";
47
- case ae:
48
- return "Activity";
49
- }
50
- if (typeof e == "object")
51
- switch (typeof e.tag == "number" && console.error(
52
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
53
- ), e.$$typeof) {
54
- case U:
55
- return "Portal";
56
- case H:
57
- return e.displayName || "Context";
58
- case B:
59
- return (e._context.displayName || "Context") + ".Consumer";
60
- case Z:
61
- var r = e.render;
62
- return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
63
- case re:
64
- return r = e.displayName || null, r !== null ? r : a(e.type) || "Memo";
65
- case g:
66
- r = e._payload, e = e._init;
67
- try {
68
- return a(e(r));
69
- } catch {
70
- }
71
- }
72
- return null;
73
- }
74
- function i(e) {
75
- return "" + e;
76
- }
77
- function u(e) {
78
- try {
79
- i(e);
80
- var r = !1;
81
- } catch {
82
- r = !0;
83
- }
84
- if (r) {
85
- r = console;
86
- var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
87
- return t.call(
88
- r,
89
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
90
- n
91
- ), i(e);
92
- }
93
- }
94
- function c(e) {
95
- if (e === T) return "<>";
96
- if (typeof e == "object" && e !== null && e.$$typeof === g)
97
- return "<...>";
98
- try {
99
- var r = a(e);
100
- return r ? "<" + r + ">" : "<...>";
101
- } catch {
102
- return "<...>";
103
- }
104
- }
105
- function o() {
106
- var e = A.A;
107
- return e === null ? null : e.getOwner();
108
- }
109
- function s() {
110
- return Error("react-stack-top-frame");
111
- }
112
- function f(e) {
113
- if (w.call(e, "key")) {
114
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
115
- if (r && r.isReactWarning) return !1;
116
- }
117
- return e.key !== void 0;
118
- }
119
- function d(e, r) {
120
- function t() {
121
- C || (C = !0, console.error(
122
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
123
- r
124
- ));
125
- }
126
- t.isReactWarning = !0, Object.defineProperty(e, "key", {
127
- get: t,
128
- configurable: !0
129
- });
130
- }
131
- function x() {
132
- var e = a(this.type);
133
- return K[e] || (K[e] = !0, console.error(
134
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
135
- )), e = this.props.ref, e !== void 0 ? e : null;
136
- }
137
- function q(e, r, t, n, _, k) {
138
- var l = t.ref;
139
- return e = {
140
- $$typeof: P,
141
- type: e,
142
- key: r,
143
- props: t,
144
- _owner: n
145
- }, (l !== void 0 ? l : null) !== null ? Object.defineProperty(e, "ref", {
146
- enumerable: !1,
147
- get: x
148
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
149
- configurable: !1,
150
- enumerable: !1,
151
- writable: !0,
152
- value: 0
153
- }), Object.defineProperty(e, "_debugInfo", {
154
- configurable: !1,
155
- enumerable: !1,
156
- writable: !0,
157
- value: null
158
- }), Object.defineProperty(e, "_debugStack", {
159
- configurable: !1,
160
- enumerable: !1,
161
- writable: !0,
162
- value: _
163
- }), Object.defineProperty(e, "_debugTask", {
164
- configurable: !1,
165
- enumerable: !1,
166
- writable: !0,
167
- value: k
168
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
169
- }
170
- function O(e, r, t, n, _, k) {
171
- var l = r.children;
172
- if (l !== void 0)
173
- if (n)
174
- if (ne(l)) {
175
- for (n = 0; n < l.length; n++)
176
- j(l[n]);
177
- Object.freeze && Object.freeze(l);
178
- } else
179
- console.error(
180
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
181
- );
182
- else j(l);
183
- if (w.call(r, "key")) {
184
- l = a(e);
185
- var m = Object.keys(r).filter(function(le) {
186
- return le !== "key";
187
- });
188
- n = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", F[l + n] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error(
189
- `A props object containing a "key" prop is being spread into JSX:
190
- let props = %s;
191
- <%s {...props} />
192
- React keys must be passed directly to JSX without using spread:
193
- let props = %s;
194
- <%s key={someKey} {...props} />`,
195
- n,
196
- l,
197
- m,
198
- l
199
- ), F[l + n] = !0);
200
- }
201
- if (l = null, t !== void 0 && (u(t), l = "" + t), f(r) && (u(r.key), l = "" + r.key), "key" in r) {
202
- t = {};
203
- for (var S in r)
204
- S !== "key" && (t[S] = r[S]);
205
- } else t = r;
206
- return l && d(
207
- t,
208
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
209
- ), q(
210
- e,
211
- l,
212
- t,
213
- o(),
214
- _,
215
- k
216
- );
217
- }
218
- function j(e) {
219
- N(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === g && (e._payload.status === "fulfilled" ? N(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
220
- }
221
- function N(e) {
222
- return typeof e == "object" && e !== null && e.$$typeof === P;
223
- }
224
- var v = R, P = /* @__PURE__ */ Symbol.for("react.transitional.element"), U = /* @__PURE__ */ Symbol.for("react.portal"), T = /* @__PURE__ */ Symbol.for("react.fragment"), X = /* @__PURE__ */ Symbol.for("react.strict_mode"), G = /* @__PURE__ */ Symbol.for("react.profiler"), B = /* @__PURE__ */ Symbol.for("react.consumer"), H = /* @__PURE__ */ Symbol.for("react.context"), Z = /* @__PURE__ */ Symbol.for("react.forward_ref"), Q = /* @__PURE__ */ Symbol.for("react.suspense"), ee = /* @__PURE__ */ Symbol.for("react.suspense_list"), re = /* @__PURE__ */ Symbol.for("react.memo"), g = /* @__PURE__ */ Symbol.for("react.lazy"), ae = /* @__PURE__ */ Symbol.for("react.activity"), te = /* @__PURE__ */ Symbol.for("react.client.reference"), A = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, w = Object.prototype.hasOwnProperty, ne = Array.isArray, h = console.createTask ? console.createTask : function() {
225
- return null;
226
- };
227
- v = {
228
- react_stack_bottom_frame: function(e) {
229
- return e();
230
- }
231
- };
232
- var C, K = {}, Y = v.react_stack_bottom_frame.bind(
233
- v,
234
- s
235
- )(), D = h(c(s)), F = {};
236
- y.Fragment = T, y.jsx = function(e, r, t) {
237
- var n = 1e4 > A.recentlyCreatedOwnerStacks++;
238
- return O(
239
- e,
240
- r,
241
- t,
242
- !1,
243
- n ? Error("react-stack-top-frame") : Y,
244
- n ? h(c(e)) : D
245
- );
246
- }, y.jsxs = function(e, r, t) {
247
- var n = 1e4 > A.recentlyCreatedOwnerStacks++;
248
- return O(
249
- e,
250
- r,
251
- t,
252
- !0,
253
- n ? Error("react-stack-top-frame") : Y,
254
- n ? h(c(e)) : D
255
- );
256
- };
257
- })()), y;
258
- }
259
- var $;
260
- function ue() {
261
- return $ || ($ = 1, process.env.NODE_ENV === "production" ? E.exports = oe() : E.exports = se()), E.exports;
262
- }
263
- var p = ue();
264
- const ie = R.lazy(() => import("./ChartImpl-CE1UGkNR.js")), ce = R.lazy(() => import("./AdvancedChartImpl-DJcN3TPx.js")), z = ({ schema: a }) => /* @__PURE__ */ p.jsx(L, { fallback: /* @__PURE__ */ p.jsx(J, { className: "w-full h-[400px]" }), children: /* @__PURE__ */ p.jsx(
265
- ie,
266
- {
267
- data: a.data,
268
- dataKey: a.dataKey,
269
- xAxisKey: a.xAxisKey,
270
- height: a.height,
271
- className: a.className,
272
- color: a.color
273
- }
274
- ) });
275
- V.register(
276
- "bar-chart",
277
- z,
278
- {
279
- label: "Bar Chart",
280
- category: "plugin",
281
- inputs: [
282
- { name: "data", type: "array", label: "Data", required: !0 },
283
- { name: "dataKey", type: "string", label: "Data Key", defaultValue: "value" },
284
- { name: "xAxisKey", type: "string", label: "X-Axis Key", defaultValue: "name" },
285
- { name: "height", type: "number", label: "Height", defaultValue: 400 },
286
- { name: "color", type: "color", label: "Color", defaultValue: "#8884d8" }
287
- ],
288
- defaultProps: {
289
- data: [
290
- { name: "Jan", value: 400 },
291
- { name: "Feb", value: 300 },
292
- { name: "Mar", value: 600 },
293
- { name: "Apr", value: 800 },
294
- { name: "May", value: 500 }
295
- ],
296
- dataKey: "value",
297
- xAxisKey: "name",
298
- height: 400,
299
- color: "#8884d8"
300
- }
301
- }
302
- );
303
- const W = ({ schema: a }) => {
304
- const i = R.useMemo(() => {
305
- let u = a.series, c = a.xAxisKey, o = a.config;
306
- if (c || (a.index ? c = a.index : a.category && (c = a.category)), u || (a.categories ? u = a.categories.map((s) => ({ dataKey: s })) : a.value && (u = [{ dataKey: a.value }])), !o && u) {
307
- const s = a.colors || ["hsl(var(--chart-1))", "hsl(var(--chart-2))", "hsl(var(--chart-3))"], f = {};
308
- u.forEach((d, x) => {
309
- f[d.dataKey] = { label: d.dataKey, color: s[x % s.length] };
310
- }), o = f;
311
- }
312
- return {
313
- chartType: a.chartType,
314
- data: a.data,
315
- config: o,
316
- xAxisKey: c,
317
- series: u,
318
- className: a.className
319
- };
320
- }, [a]);
321
- return /* @__PURE__ */ p.jsx(L, { fallback: /* @__PURE__ */ p.jsx(J, { className: "w-full h-[400px]" }), children: /* @__PURE__ */ p.jsx(
322
- ce,
323
- {
324
- chartType: i.chartType,
325
- data: i.data,
326
- config: i.config,
327
- xAxisKey: i.xAxisKey,
328
- series: i.series,
329
- className: i.className
330
- }
331
- ) });
332
- };
333
- V.register(
334
- "chart",
335
- W,
336
- {
337
- label: "Chart",
338
- category: "plugin",
339
- inputs: [
340
- {
341
- name: "chartType",
342
- type: "enum",
343
- label: "Chart Type",
344
- enum: [
345
- { label: "Bar", value: "bar" },
346
- { label: "Line", value: "line" },
347
- { label: "Area", value: "area" }
348
- ],
349
- defaultValue: "bar"
350
- },
351
- { name: "data", type: "code", label: "Data (JSON)", required: !0 },
352
- { name: "config", type: "code", label: "Config (JSON)" },
353
- { name: "xAxisKey", type: "string", label: "X Axis Key", defaultValue: "name" },
354
- { name: "series", type: "code", label: "Series (JSON Array)", required: !0 },
355
- { name: "className", type: "string", label: "CSS Class" }
356
- ],
357
- defaultProps: {
358
- chartType: "bar",
359
- data: [
360
- { name: "Jan", sales: 400, revenue: 240 },
361
- { name: "Feb", sales: 300, revenue: 139 },
362
- { name: "Mar", sales: 600, revenue: 380 },
363
- { name: "Apr", sales: 800, revenue: 430 },
364
- { name: "May", sales: 500, revenue: 220 }
365
- ],
366
- config: {
367
- sales: { label: "Sales", color: "#8884d8" },
368
- revenue: { label: "Revenue", color: "#82ca9d" }
369
- },
370
- xAxisKey: "name",
371
- series: [
372
- { dataKey: "sales" },
373
- { dataKey: "revenue" }
374
- ]
375
- }
376
- }
377
- );
378
- const pe = {
379
- "bar-chart": z,
380
- chart: W
381
- };
382
- export {
383
- z as C,
384
- W as a,
385
- pe as c,
386
- p as j
387
- };