@object-ui/plugin-charts 0.3.0 → 0.3.1

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,738 +0,0 @@
1
- import V, { Suspense as Pe } from "react";
2
- import { ComponentRegistry as we } from "@object-ui/core";
3
- import { Skeleton as je } from "@object-ui/components";
4
- var J = { exports: {} }, I = {};
5
- var Ce;
6
- function gr() {
7
- if (Ce) return I;
8
- Ce = 1;
9
- var u = V, g = /* @__PURE__ */ Symbol.for("react.element"), m = /* @__PURE__ */ Symbol.for("react.fragment"), h = Object.prototype.hasOwnProperty, R = u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, E = { key: !0, ref: !0, __self: !0, __source: !0 };
10
- function T(_, c, w) {
11
- var y, x = {}, S = null, W = null;
12
- w !== void 0 && (S = "" + w), c.key !== void 0 && (S = "" + c.key), c.ref !== void 0 && (W = c.ref);
13
- for (y in c) h.call(c, y) && !E.hasOwnProperty(y) && (x[y] = c[y]);
14
- if (_ && _.defaultProps) for (y in c = _.defaultProps, c) x[y] === void 0 && (x[y] = c[y]);
15
- return { $$typeof: g, type: _, key: S, ref: W, props: x, _owner: R.current };
16
- }
17
- return I.Fragment = m, I.jsx = T, I.jsxs = T, I;
18
- }
19
- var N = {};
20
- var Se;
21
- function br() {
22
- return Se || (Se = 1, process.env.NODE_ENV !== "production" && (function() {
23
- var u = V, g = /* @__PURE__ */ Symbol.for("react.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), h = /* @__PURE__ */ Symbol.for("react.fragment"), R = /* @__PURE__ */ Symbol.for("react.strict_mode"), E = /* @__PURE__ */ Symbol.for("react.profiler"), T = /* @__PURE__ */ Symbol.for("react.provider"), _ = /* @__PURE__ */ Symbol.for("react.context"), c = /* @__PURE__ */ Symbol.for("react.forward_ref"), w = /* @__PURE__ */ Symbol.for("react.suspense"), y = /* @__PURE__ */ Symbol.for("react.suspense_list"), x = /* @__PURE__ */ Symbol.for("react.memo"), S = /* @__PURE__ */ Symbol.for("react.lazy"), W = /* @__PURE__ */ Symbol.for("react.offscreen"), Q = Symbol.iterator, De = "@@iterator";
24
- function Fe(e) {
25
- if (e === null || typeof e != "object")
26
- return null;
27
- var r = Q && e[Q] || e[De];
28
- return typeof r == "function" ? r : null;
29
- }
30
- var j = u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
31
- function d(e) {
32
- {
33
- for (var r = arguments.length, a = new Array(r > 1 ? r - 1 : 0), t = 1; t < r; t++)
34
- a[t - 1] = arguments[t];
35
- Ke("error", e, a);
36
- }
37
- }
38
- function Ke(e, r, a) {
39
- {
40
- var t = j.ReactDebugCurrentFrame, o = t.getStackAddendum();
41
- o !== "" && (r += "%s", a = a.concat([o]));
42
- var l = a.map(function(i) {
43
- return String(i);
44
- });
45
- l.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, l);
46
- }
47
- }
48
- var Ie = !1, Ne = !1, Ve = !1, We = !1, Ye = !1, ee;
49
- ee = /* @__PURE__ */ Symbol.for("react.module.reference");
50
- function $e(e) {
51
- return !!(typeof e == "string" || typeof e == "function" || e === h || e === E || Ye || e === R || e === w || e === y || We || e === W || Ie || Ne || Ve || typeof e == "object" && e !== null && (e.$$typeof === S || e.$$typeof === x || e.$$typeof === T || e.$$typeof === _ || e.$$typeof === c || // This needs to include all possible module reference object
52
- // types supported by any Flight configuration anywhere since
53
- // we don't know which Flight build this will end up being used
54
- // with.
55
- e.$$typeof === ee || e.getModuleId !== void 0));
56
- }
57
- function Me(e, r, a) {
58
- var t = e.displayName;
59
- if (t)
60
- return t;
61
- var o = r.displayName || r.name || "";
62
- return o !== "" ? a + "(" + o + ")" : a;
63
- }
64
- function re(e) {
65
- return e.displayName || "Context";
66
- }
67
- function C(e) {
68
- if (e == null)
69
- return null;
70
- if (typeof e.tag == "number" && d("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
71
- return e.displayName || e.name || null;
72
- if (typeof e == "string")
73
- return e;
74
- switch (e) {
75
- case h:
76
- return "Fragment";
77
- case m:
78
- return "Portal";
79
- case E:
80
- return "Profiler";
81
- case R:
82
- return "StrictMode";
83
- case w:
84
- return "Suspense";
85
- case y:
86
- return "SuspenseList";
87
- }
88
- if (typeof e == "object")
89
- switch (e.$$typeof) {
90
- case _:
91
- var r = e;
92
- return re(r) + ".Consumer";
93
- case T:
94
- var a = e;
95
- return re(a._context) + ".Provider";
96
- case c:
97
- return Me(e, e.render, "ForwardRef");
98
- case x:
99
- var t = e.displayName || null;
100
- return t !== null ? t : C(e.type) || "Memo";
101
- case S: {
102
- var o = e, l = o._payload, i = o._init;
103
- try {
104
- return C(i(l));
105
- } catch {
106
- return null;
107
- }
108
- }
109
- }
110
- return null;
111
- }
112
- var O = Object.assign, F = 0, ae, te, ne, ie, oe, ue, le;
113
- function se() {
114
- }
115
- se.__reactDisabledLog = !0;
116
- function Le() {
117
- {
118
- if (F === 0) {
119
- ae = console.log, te = console.info, ne = console.warn, ie = console.error, oe = console.group, ue = console.groupCollapsed, le = console.groupEnd;
120
- var e = {
121
- configurable: !0,
122
- enumerable: !0,
123
- value: se,
124
- writable: !0
125
- };
126
- Object.defineProperties(console, {
127
- info: e,
128
- log: e,
129
- warn: e,
130
- error: e,
131
- group: e,
132
- groupCollapsed: e,
133
- groupEnd: e
134
- });
135
- }
136
- F++;
137
- }
138
- }
139
- function Je() {
140
- {
141
- if (F--, F === 0) {
142
- var e = {
143
- configurable: !0,
144
- enumerable: !0,
145
- writable: !0
146
- };
147
- Object.defineProperties(console, {
148
- log: O({}, e, {
149
- value: ae
150
- }),
151
- info: O({}, e, {
152
- value: te
153
- }),
154
- warn: O({}, e, {
155
- value: ne
156
- }),
157
- error: O({}, e, {
158
- value: ie
159
- }),
160
- group: O({}, e, {
161
- value: oe
162
- }),
163
- groupCollapsed: O({}, e, {
164
- value: ue
165
- }),
166
- groupEnd: O({}, e, {
167
- value: le
168
- })
169
- });
170
- }
171
- F < 0 && d("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
172
- }
173
- }
174
- var U = j.ReactCurrentDispatcher, q;
175
- function Y(e, r, a) {
176
- {
177
- if (q === void 0)
178
- try {
179
- throw Error();
180
- } catch (o) {
181
- var t = o.stack.trim().match(/\n( *(at )?)/);
182
- q = t && t[1] || "";
183
- }
184
- return `
185
- ` + q + e;
186
- }
187
- }
188
- var B = !1, $;
189
- {
190
- var Ue = typeof WeakMap == "function" ? WeakMap : Map;
191
- $ = new Ue();
192
- }
193
- function fe(e, r) {
194
- if (!e || B)
195
- return "";
196
- {
197
- var a = $.get(e);
198
- if (a !== void 0)
199
- return a;
200
- }
201
- var t;
202
- B = !0;
203
- var o = Error.prepareStackTrace;
204
- Error.prepareStackTrace = void 0;
205
- var l;
206
- l = U.current, U.current = null, Le();
207
- try {
208
- if (r) {
209
- var i = function() {
210
- throw Error();
211
- };
212
- if (Object.defineProperty(i.prototype, "props", {
213
- set: function() {
214
- throw Error();
215
- }
216
- }), typeof Reflect == "object" && Reflect.construct) {
217
- try {
218
- Reflect.construct(i, []);
219
- } catch (p) {
220
- t = p;
221
- }
222
- Reflect.construct(e, [], i);
223
- } else {
224
- try {
225
- i.call();
226
- } catch (p) {
227
- t = p;
228
- }
229
- e.call(i.prototype);
230
- }
231
- } else {
232
- try {
233
- throw Error();
234
- } catch (p) {
235
- t = p;
236
- }
237
- e();
238
- }
239
- } catch (p) {
240
- if (p && t && typeof p.stack == "string") {
241
- for (var n = p.stack.split(`
242
- `), v = t.stack.split(`
243
- `), s = n.length - 1, f = v.length - 1; s >= 1 && f >= 0 && n[s] !== v[f]; )
244
- f--;
245
- for (; s >= 1 && f >= 0; s--, f--)
246
- if (n[s] !== v[f]) {
247
- if (s !== 1 || f !== 1)
248
- do
249
- if (s--, f--, f < 0 || n[s] !== v[f]) {
250
- var b = `
251
- ` + n[s].replace(" at new ", " at ");
252
- return e.displayName && b.includes("<anonymous>") && (b = b.replace("<anonymous>", e.displayName)), typeof e == "function" && $.set(e, b), b;
253
- }
254
- while (s >= 1 && f >= 0);
255
- break;
256
- }
257
- }
258
- } finally {
259
- B = !1, U.current = l, Je(), Error.prepareStackTrace = o;
260
- }
261
- var k = e ? e.displayName || e.name : "", P = k ? Y(k) : "";
262
- return typeof e == "function" && $.set(e, P), P;
263
- }
264
- function qe(e, r, a) {
265
- return fe(e, !1);
266
- }
267
- function Be(e) {
268
- var r = e.prototype;
269
- return !!(r && r.isReactComponent);
270
- }
271
- function M(e, r, a) {
272
- if (e == null)
273
- return "";
274
- if (typeof e == "function")
275
- return fe(e, Be(e));
276
- if (typeof e == "string")
277
- return Y(e);
278
- switch (e) {
279
- case w:
280
- return Y("Suspense");
281
- case y:
282
- return Y("SuspenseList");
283
- }
284
- if (typeof e == "object")
285
- switch (e.$$typeof) {
286
- case c:
287
- return qe(e.render);
288
- case x:
289
- return M(e.type, r, a);
290
- case S: {
291
- var t = e, o = t._payload, l = t._init;
292
- try {
293
- return M(l(o), r, a);
294
- } catch {
295
- }
296
- }
297
- }
298
- return "";
299
- }
300
- var K = Object.prototype.hasOwnProperty, ce = {}, de = j.ReactDebugCurrentFrame;
301
- function L(e) {
302
- if (e) {
303
- var r = e._owner, a = M(e.type, e._source, r ? r.type : null);
304
- de.setExtraStackFrame(a);
305
- } else
306
- de.setExtraStackFrame(null);
307
- }
308
- function ze(e, r, a, t, o) {
309
- {
310
- var l = Function.call.bind(K);
311
- for (var i in e)
312
- if (l(e, i)) {
313
- var n = void 0;
314
- try {
315
- if (typeof e[i] != "function") {
316
- var v = Error((t || "React class") + ": " + a + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
317
- throw v.name = "Invariant Violation", v;
318
- }
319
- n = e[i](r, i, t, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
320
- } catch (s) {
321
- n = s;
322
- }
323
- n && !(n instanceof Error) && (L(o), d("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", t || "React class", a, i, typeof n), L(null)), n instanceof Error && !(n.message in ce) && (ce[n.message] = !0, L(o), d("Failed %s type: %s", a, n.message), L(null));
324
- }
325
- }
326
- }
327
- var Xe = Array.isArray;
328
- function z(e) {
329
- return Xe(e);
330
- }
331
- function Ge(e) {
332
- {
333
- var r = typeof Symbol == "function" && Symbol.toStringTag, a = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
334
- return a;
335
- }
336
- }
337
- function He(e) {
338
- try {
339
- return ve(e), !1;
340
- } catch {
341
- return !0;
342
- }
343
- }
344
- function ve(e) {
345
- return "" + e;
346
- }
347
- function pe(e) {
348
- if (He(e))
349
- return d("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ge(e)), ve(e);
350
- }
351
- var ye = j.ReactCurrentOwner, Ze = {
352
- key: !0,
353
- ref: !0,
354
- __self: !0,
355
- __source: !0
356
- }, ge, be;
357
- function Qe(e) {
358
- if (K.call(e, "ref")) {
359
- var r = Object.getOwnPropertyDescriptor(e, "ref").get;
360
- if (r && r.isReactWarning)
361
- return !1;
362
- }
363
- return e.ref !== void 0;
364
- }
365
- function er(e) {
366
- if (K.call(e, "key")) {
367
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
368
- if (r && r.isReactWarning)
369
- return !1;
370
- }
371
- return e.key !== void 0;
372
- }
373
- function rr(e, r) {
374
- typeof e.ref == "string" && ye.current;
375
- }
376
- function ar(e, r) {
377
- {
378
- var a = function() {
379
- ge || (ge = !0, d("%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://reactjs.org/link/special-props)", r));
380
- };
381
- a.isReactWarning = !0, Object.defineProperty(e, "key", {
382
- get: a,
383
- configurable: !0
384
- });
385
- }
386
- }
387
- function tr(e, r) {
388
- {
389
- var a = function() {
390
- be || (be = !0, d("%s: `ref` 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://reactjs.org/link/special-props)", r));
391
- };
392
- a.isReactWarning = !0, Object.defineProperty(e, "ref", {
393
- get: a,
394
- configurable: !0
395
- });
396
- }
397
- }
398
- var nr = function(e, r, a, t, o, l, i) {
399
- var n = {
400
- // This tag allows us to uniquely identify this as a React Element
401
- $$typeof: g,
402
- // Built-in properties that belong on the element
403
- type: e,
404
- key: r,
405
- ref: a,
406
- props: i,
407
- // Record the component responsible for creating this element.
408
- _owner: l
409
- };
410
- return n._store = {}, Object.defineProperty(n._store, "validated", {
411
- configurable: !1,
412
- enumerable: !1,
413
- writable: !0,
414
- value: !1
415
- }), Object.defineProperty(n, "_self", {
416
- configurable: !1,
417
- enumerable: !1,
418
- writable: !1,
419
- value: t
420
- }), Object.defineProperty(n, "_source", {
421
- configurable: !1,
422
- enumerable: !1,
423
- writable: !1,
424
- value: o
425
- }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
426
- };
427
- function ir(e, r, a, t, o) {
428
- {
429
- var l, i = {}, n = null, v = null;
430
- a !== void 0 && (pe(a), n = "" + a), er(r) && (pe(r.key), n = "" + r.key), Qe(r) && (v = r.ref, rr(r, o));
431
- for (l in r)
432
- K.call(r, l) && !Ze.hasOwnProperty(l) && (i[l] = r[l]);
433
- if (e && e.defaultProps) {
434
- var s = e.defaultProps;
435
- for (l in s)
436
- i[l] === void 0 && (i[l] = s[l]);
437
- }
438
- if (n || v) {
439
- var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
440
- n && ar(i, f), v && tr(i, f);
441
- }
442
- return nr(e, n, v, o, t, ye.current, i);
443
- }
444
- }
445
- var X = j.ReactCurrentOwner, he = j.ReactDebugCurrentFrame;
446
- function A(e) {
447
- if (e) {
448
- var r = e._owner, a = M(e.type, e._source, r ? r.type : null);
449
- he.setExtraStackFrame(a);
450
- } else
451
- he.setExtraStackFrame(null);
452
- }
453
- var G;
454
- G = !1;
455
- function H(e) {
456
- return typeof e == "object" && e !== null && e.$$typeof === g;
457
- }
458
- function me() {
459
- {
460
- if (X.current) {
461
- var e = C(X.current.type);
462
- if (e)
463
- return `
464
-
465
- Check the render method of \`` + e + "`.";
466
- }
467
- return "";
468
- }
469
- }
470
- function or(e) {
471
- return "";
472
- }
473
- var Re = {};
474
- function ur(e) {
475
- {
476
- var r = me();
477
- if (!r) {
478
- var a = typeof e == "string" ? e : e.displayName || e.name;
479
- a && (r = `
480
-
481
- Check the top-level render call using <` + a + ">.");
482
- }
483
- return r;
484
- }
485
- }
486
- function Ee(e, r) {
487
- {
488
- if (!e._store || e._store.validated || e.key != null)
489
- return;
490
- e._store.validated = !0;
491
- var a = ur(r);
492
- if (Re[a])
493
- return;
494
- Re[a] = !0;
495
- var t = "";
496
- e && e._owner && e._owner !== X.current && (t = " It was passed a child from " + C(e._owner.type) + "."), A(e), d('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, t), A(null);
497
- }
498
- }
499
- function _e(e, r) {
500
- {
501
- if (typeof e != "object")
502
- return;
503
- if (z(e))
504
- for (var a = 0; a < e.length; a++) {
505
- var t = e[a];
506
- H(t) && Ee(t, r);
507
- }
508
- else if (H(e))
509
- e._store && (e._store.validated = !0);
510
- else if (e) {
511
- var o = Fe(e);
512
- if (typeof o == "function" && o !== e.entries)
513
- for (var l = o.call(e), i; !(i = l.next()).done; )
514
- H(i.value) && Ee(i.value, r);
515
- }
516
- }
517
- }
518
- function lr(e) {
519
- {
520
- var r = e.type;
521
- if (r == null || typeof r == "string")
522
- return;
523
- var a;
524
- if (typeof r == "function")
525
- a = r.propTypes;
526
- else if (typeof r == "object" && (r.$$typeof === c || // Note: Memo only checks outer props here.
527
- // Inner props are checked in the reconciler.
528
- r.$$typeof === x))
529
- a = r.propTypes;
530
- else
531
- return;
532
- if (a) {
533
- var t = C(r);
534
- ze(a, e.props, "prop", t, e);
535
- } else if (r.PropTypes !== void 0 && !G) {
536
- G = !0;
537
- var o = C(r);
538
- d("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", o || "Unknown");
539
- }
540
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && d("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
541
- }
542
- }
543
- function sr(e) {
544
- {
545
- for (var r = Object.keys(e.props), a = 0; a < r.length; a++) {
546
- var t = r[a];
547
- if (t !== "children" && t !== "key") {
548
- A(e), d("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", t), A(null);
549
- break;
550
- }
551
- }
552
- e.ref !== null && (A(e), d("Invalid attribute `ref` supplied to `React.Fragment`."), A(null));
553
- }
554
- }
555
- var xe = {};
556
- function Te(e, r, a, t, o, l) {
557
- {
558
- var i = $e(e);
559
- if (!i) {
560
- var n = "";
561
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (n += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
562
- var v = or();
563
- v ? n += v : n += me();
564
- var s;
565
- e === null ? s = "null" : z(e) ? s = "array" : e !== void 0 && e.$$typeof === g ? (s = "<" + (C(e.type) || "Unknown") + " />", n = " Did you accidentally export a JSX literal instead of a component?") : s = typeof e, d("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", s, n);
566
- }
567
- var f = ir(e, r, a, o, l);
568
- if (f == null)
569
- return f;
570
- if (i) {
571
- var b = r.children;
572
- if (b !== void 0)
573
- if (t)
574
- if (z(b)) {
575
- for (var k = 0; k < b.length; k++)
576
- _e(b[k], e);
577
- Object.freeze && Object.freeze(b);
578
- } else
579
- d("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
580
- else
581
- _e(b, e);
582
- }
583
- if (K.call(r, "key")) {
584
- var P = C(e), p = Object.keys(r).filter(function(yr) {
585
- return yr !== "key";
586
- }), Z = p.length > 0 ? "{key: someKey, " + p.join(": ..., ") + ": ...}" : "{key: someKey}";
587
- if (!xe[P + Z]) {
588
- var pr = p.length > 0 ? "{" + p.join(": ..., ") + ": ...}" : "{}";
589
- d(`A props object containing a "key" prop is being spread into JSX:
590
- let props = %s;
591
- <%s {...props} />
592
- React keys must be passed directly to JSX without using spread:
593
- let props = %s;
594
- <%s key={someKey} {...props} />`, Z, P, pr, P), xe[P + Z] = !0;
595
- }
596
- }
597
- return e === h ? sr(f) : lr(f), f;
598
- }
599
- }
600
- function fr(e, r, a) {
601
- return Te(e, r, a, !0);
602
- }
603
- function cr(e, r, a) {
604
- return Te(e, r, a, !1);
605
- }
606
- var dr = cr, vr = fr;
607
- N.Fragment = h, N.jsx = dr, N.jsxs = vr;
608
- })()), N;
609
- }
610
- var Oe;
611
- function hr() {
612
- return Oe || (Oe = 1, process.env.NODE_ENV === "production" ? J.exports = gr() : J.exports = br()), J.exports;
613
- }
614
- var D = hr();
615
- const mr = V.lazy(() => import("./ChartImpl-DiqV9Evl.js")), Rr = V.lazy(() => import("./AdvancedChartImpl-LUnT2ZAf.js")), Ae = ({ schema: u }) => /* @__PURE__ */ D.jsx(Pe, { fallback: /* @__PURE__ */ D.jsx(je, { className: "w-full h-[400px]" }), children: /* @__PURE__ */ D.jsx(
616
- mr,
617
- {
618
- data: u.data,
619
- dataKey: u.dataKey,
620
- xAxisKey: u.xAxisKey,
621
- height: u.height,
622
- className: u.className,
623
- color: u.color
624
- }
625
- ) });
626
- we.register(
627
- "chart-bar",
628
- Ae,
629
- {
630
- label: "Bar Chart",
631
- category: "plugin",
632
- inputs: [
633
- { name: "data", type: "array", label: "Data", required: !0 },
634
- { name: "dataKey", type: "string", label: "Data Key", defaultValue: "value" },
635
- { name: "xAxisKey", type: "string", label: "X-Axis Key", defaultValue: "name" },
636
- { name: "height", type: "number", label: "Height", defaultValue: 400 },
637
- { name: "color", type: "color", label: "Color", defaultValue: "#8884d8" }
638
- ],
639
- defaultProps: {
640
- data: [
641
- { name: "Jan", value: 400 },
642
- { name: "Feb", value: 300 },
643
- { name: "Mar", value: 600 },
644
- { name: "Apr", value: 800 },
645
- { name: "May", value: 500 }
646
- ],
647
- dataKey: "value",
648
- xAxisKey: "name",
649
- height: 400,
650
- color: "#8884d8"
651
- }
652
- }
653
- );
654
- const ke = ({ schema: u }) => {
655
- const g = V.useMemo(() => {
656
- let m = u.series, h = u.xAxisKey, R = u.config;
657
- if (h || (u.index ? h = u.index : u.category && (h = u.category)), m || (u.categories ? m = u.categories.map((E) => ({ dataKey: E })) : u.value && (m = [{ dataKey: u.value }])), !R && m) {
658
- const E = u.colors || ["hsl(var(--chart-1))", "hsl(var(--chart-2))", "hsl(var(--chart-3))"];
659
- R = {}, m.forEach((T, _) => {
660
- R[T.dataKey] = { label: T.dataKey, color: E[_ % E.length] };
661
- });
662
- }
663
- return {
664
- chartType: u.chartType,
665
- data: u.data,
666
- config: R,
667
- xAxisKey: h,
668
- series: m,
669
- className: u.className
670
- };
671
- }, [u]);
672
- return /* @__PURE__ */ D.jsx(Pe, { fallback: /* @__PURE__ */ D.jsx(je, { className: "w-full h-[400px]" }), children: /* @__PURE__ */ D.jsx(
673
- Rr,
674
- {
675
- chartType: g.chartType,
676
- data: g.data,
677
- config: g.config,
678
- xAxisKey: g.xAxisKey,
679
- series: g.series,
680
- className: g.className
681
- }
682
- ) });
683
- };
684
- we.register(
685
- "chart",
686
- ke,
687
- {
688
- label: "Chart",
689
- category: "plugin",
690
- inputs: [
691
- {
692
- name: "chartType",
693
- type: "enum",
694
- label: "Chart Type",
695
- enum: [
696
- { label: "Bar", value: "bar" },
697
- { label: "Line", value: "line" },
698
- { label: "Area", value: "area" }
699
- ],
700
- defaultValue: "bar"
701
- },
702
- { name: "data", type: "code", label: "Data (JSON)", required: !0 },
703
- { name: "config", type: "code", label: "Config (JSON)" },
704
- { name: "xAxisKey", type: "string", label: "X Axis Key", defaultValue: "name" },
705
- { name: "series", type: "code", label: "Series (JSON Array)", required: !0 },
706
- { name: "className", type: "string", label: "CSS Class" }
707
- ],
708
- defaultProps: {
709
- chartType: "bar",
710
- data: [
711
- { name: "Jan", sales: 400, revenue: 240 },
712
- { name: "Feb", sales: 300, revenue: 139 },
713
- { name: "Mar", sales: 600, revenue: 380 },
714
- { name: "Apr", sales: 800, revenue: 430 },
715
- { name: "May", sales: 500, revenue: 220 }
716
- ],
717
- config: {
718
- sales: { label: "Sales", color: "#8884d8" },
719
- revenue: { label: "Revenue", color: "#82ca9d" }
720
- },
721
- xAxisKey: "name",
722
- series: [
723
- { dataKey: "sales" },
724
- { dataKey: "revenue" }
725
- ]
726
- }
727
- }
728
- );
729
- const Tr = {
730
- "chart-bar": Ae,
731
- chart: ke
732
- };
733
- export {
734
- Ae as C,
735
- ke as a,
736
- Tr as c,
737
- D as j
738
- };