@cleen/ui 0.1.1 → 0.1.2

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,611 +1 @@
1
- // src/charts/chart/Chart.tsx
2
- import { cn } from "@cleen/ui-core";
3
- import { forwardRef } from "react";
4
- import ReactApexChart from "react-apexcharts";
5
-
6
- // src/charts/chart/constant.ts
7
- var defaultOptions = {
8
- chart: {
9
- toolbar: {
10
- show: true,
11
- tools: {
12
- download: true,
13
- selection: true,
14
- zoom: true,
15
- zoomin: true,
16
- zoomout: true,
17
- pan: true,
18
- reset: true
19
- }
20
- },
21
- animations: {
22
- enabled: true
23
- }
24
- },
25
- dataLabels: {
26
- enabled: false
27
- },
28
- stroke: {
29
- curve: "smooth",
30
- width: 2
31
- },
32
- xaxis: {
33
- labels: {
34
- style: {
35
- fontSize: "12px"
36
- }
37
- }
38
- },
39
- yaxis: {
40
- labels: {
41
- style: {
42
- fontSize: "12px"
43
- }
44
- }
45
- },
46
- legend: {
47
- position: "top",
48
- horizontalAlign: "left"
49
- },
50
- tooltip: {
51
- enabled: true,
52
- theme: "light"
53
- }
54
- };
55
-
56
- // src/charts/chart/Chart.tsx
57
- import { jsx } from "react/jsx-runtime";
58
- var Chart = forwardRef(function Chart2({
59
- type = "line",
60
- series,
61
- options = {},
62
- width = "100%",
63
- height = 350,
64
- className,
65
- style
66
- }, ref) {
67
- const mergedOptions = {
68
- ...defaultOptions,
69
- ...options,
70
- chart: {
71
- ...defaultOptions.chart,
72
- ...options.chart,
73
- type
74
- }
75
- };
76
- return /* @__PURE__ */ jsx("div", { className: cn("cleen", className), style, children: /* @__PURE__ */ jsx(
77
- ReactApexChart,
78
- {
79
- options: mergedOptions,
80
- series,
81
- type,
82
- width,
83
- height,
84
- ref
85
- }
86
- ) });
87
- });
88
- var Chart_default = Chart;
89
-
90
- // src/charts/chart/variants/BellCurve/BellCurve.tsx
91
- import { applyDefaults } from "@cleen/ui-core";
92
- import { forwardRef as forwardRef2, useMemo } from "react";
93
-
94
- // src/charts/chart/variants/BellCurve/constant.ts
95
- import { ColorHelpers } from "@cleen/ui-core";
96
- var POINT_ANNOTATIONS_PROPS = {
97
- marker: {
98
- size: 2,
99
- fillColor: "rgba(var(--cleen-gray), 0.8)",
100
- strokeColor: "rgba(var(--cleen-gray), 0.8)",
101
- offsetY: -16,
102
- shape: "triangle"
103
- },
104
- label: {
105
- borderWidth: 0,
106
- offsetY: -20,
107
- style: {
108
- color: "rgba(var(--cleen-gray), 0.8)",
109
- background: "transparent",
110
- fontSize: "11px"
111
- }
112
- }
113
- };
114
- var RANGE_ANNOTATIONS_PROPS = {
115
- label: {
116
- borderColor: "transparent",
117
- style: {
118
- color: "rgba(var(--cleen-white))",
119
- background: "rgba(var(--cleen-primary))"
120
- }
121
- },
122
- fillColor: "rgba(var(--cleen-primary))"
123
- };
124
- var HIGHLIGHT_LABEL_ANNOTATIONS_PROPS = {
125
- label: {
126
- borderWidth: 0,
127
- offsetY: -15,
128
- orientation: "horizontal",
129
- style: {
130
- color: "rgba(var(--cleen-primary))",
131
- background: "transparent",
132
- fontSize: "16px",
133
- fontWeight: 700
134
- }
135
- },
136
- borderColor: "rgba(var(--cleen-primary))"
137
- };
138
- var HIGHLIGHT_MARKER_ANNOTATIONS_PROPS = {
139
- marker: {
140
- size: 8,
141
- fillColor: "rgba(var(--cleen-primary))",
142
- strokeColor: "rgba(var(--cleen-white))"
143
- }
144
- };
145
- var DEFAULT_CHART_OPTIONS = {
146
- chart: {
147
- zoom: { enabled: false },
148
- toolbar: { show: false },
149
- animations: {
150
- enabled: false
151
- }
152
- },
153
- stroke: { curve: "monotoneCubic", width: 2.5 },
154
- colors: [
155
- ColorHelpers.getComputedColor("var(--cleen-error)"),
156
- ColorHelpers.getComputedColor("var(--cleen-primary)"),
157
- ColorHelpers.getComputedColor("var(--cleen-success)")
158
- ],
159
- fill: {
160
- type: "gradient",
161
- gradient: {
162
- shade: "light",
163
- type: "vertical",
164
- shadeIntensity: 0.6,
165
- gradientToColors: [
166
- ColorHelpers.getComputedColor("var(--cleen-error)") || "",
167
- ColorHelpers.getComputedColor("var(--cleen-primary)") || "",
168
- ColorHelpers.getComputedColor("var(--cleen-success)") || ""
169
- ],
170
- inverseColors: false,
171
- opacityFrom: 0.95,
172
- opacityTo: 0.6
173
- }
174
- },
175
- yaxis: {
176
- show: false
177
- },
178
- tooltip: {
179
- enabled: true,
180
- x: {
181
- formatter: function(val) {
182
- const n = typeof val === "string" ? Number(val) : val;
183
- return `Score: ${n}`;
184
- }
185
- },
186
- y: {
187
- formatter: function(val) {
188
- return `${Number(val).toFixed(4)}`;
189
- }
190
- }
191
- },
192
- grid: { show: false },
193
- legend: {
194
- show: false
195
- }
196
- };
197
-
198
- // src/charts/chart/variants/BellCurve/helper.ts
199
- var getAnnotationPointX = (middle, sigma) => {
200
- return {
201
- middle,
202
- leftSigma: middle - sigma,
203
- left2Sigma: middle - 2 * sigma,
204
- left: middle - 3 * sigma,
205
- rightSigma: middle + 2 * sigma,
206
- right2Sigma: middle + 2 * sigma,
207
- right: middle + 3 * sigma
208
- };
209
- };
210
- var getAnnotationAxisX = (middle, sigma, minX, maxX) => {
211
- return {
212
- middle,
213
- leftSigma: middle - sigma,
214
- left2Sigma: middle - 2 * sigma,
215
- left: minX,
216
- rightSigma: middle + sigma,
217
- right2Sigma: middle + 2 * sigma,
218
- right: maxX
219
- };
220
- };
221
- var calculateAnnotationAxisX = (annotation, positions) => {
222
- let props = {};
223
- switch (annotation.type) {
224
- case "range":
225
- props = {
226
- x: positions[annotation.x],
227
- x2: positions[annotation.x2]
228
- };
229
- break;
230
- case "offset":
231
- props = {
232
- x: annotation.x - annotation.offset,
233
- x2: annotation.x + annotation.offset
234
- };
235
- break;
236
- case "region":
237
- if (annotation.x >= positions.left && annotation.x < positions.left2Sigma) {
238
- props = {
239
- x: positions.left,
240
- x2: positions.left2Sigma
241
- };
242
- } else if (annotation.x >= positions.left2Sigma && annotation.x < positions.leftSigma) {
243
- props = {
244
- x: positions.left2Sigma,
245
- x2: positions.leftSigma
246
- };
247
- } else if (annotation.x >= positions.leftSigma && annotation.x < positions.middle) {
248
- props = {
249
- x: positions.leftSigma,
250
- x2: positions.middle
251
- };
252
- } else if (annotation.x >= positions.middle && annotation.x < positions.rightSigma) {
253
- props = {
254
- x: positions.middle,
255
- x2: positions.rightSigma
256
- };
257
- } else if (annotation.x >= positions.rightSigma && annotation.x < positions.right2Sigma) {
258
- props = {
259
- x: positions.rightSigma,
260
- x2: positions.right2Sigma
261
- };
262
- } else if (annotation.x >= positions.right2Sigma && annotation.x < positions.right) {
263
- props = {
264
- x: positions.right2Sigma,
265
- x2: positions.right
266
- };
267
- }
268
- break;
269
- case "custom":
270
- default:
271
- props = {
272
- x: annotation.x,
273
- x2: annotation.x2
274
- };
275
- break;
276
- }
277
- return props;
278
- };
279
-
280
- // src/charts/chart/variants/BellCurve/BellCurve.tsx
281
- import { jsx as jsx2 } from "react/jsx-runtime";
282
- var BellCurve = forwardRef2(
283
- function BellCurve2({
284
- serie,
285
- labels,
286
- sigma,
287
- pointAnnotations,
288
- rangeAnnotations,
289
- highlightAnnotations,
290
- options,
291
- height = 360,
292
- ...props
293
- }, ref) {
294
- const sortedSerie = useMemo(() => serie.sort((a, b) => a.x - b.x), [serie]);
295
- const serieMap = useMemo(() => {
296
- const map = /* @__PURE__ */ new Map();
297
- serie.forEach((el) => map.set(el.x, el.y));
298
- return map;
299
- }, [serie]);
300
- const middlePoint = sortedSerie[Math.floor(sortedSerie.length / 2)];
301
- const calculatedSeries = useMemo(() => {
302
- const { below, middle, above } = serie.reduce(
303
- (acc, val) => {
304
- if (val.x < middlePoint.x - 2 * sigma) {
305
- acc.below.push(val);
306
- } else if (val.x >= middlePoint.x + 2 * sigma) {
307
- if (val.x === middlePoint.x + 2 * sigma) {
308
- acc.middle.push(val);
309
- }
310
- acc.above.push(val);
311
- } else {
312
- if (val.x === middlePoint.x - 2 * sigma) {
313
- acc.below.push(val);
314
- }
315
- acc.middle.push(val);
316
- }
317
- return acc;
318
- },
319
- { below: [], middle: [], above: [] }
320
- );
321
- return [
322
- { name: labels?.below || "Below threshold", data: below },
323
- { name: labels?.middle || "Middle grounds", data: middle },
324
- { name: labels?.above || "Above threshold", data: above }
325
- ];
326
- }, [sigma, serie, labels, middlePoint]);
327
- const formattedPointAnnotations = useMemo(() => {
328
- if (!pointAnnotations) {
329
- return [];
330
- }
331
- const positions = getAnnotationPointX(middlePoint.x, sigma);
332
- return Object.entries(pointAnnotations).map(
333
- ([field, value]) => {
334
- const x = positions[field];
335
- return {
336
- x,
337
- y: serieMap.get(x) || 0,
338
- ...applyDefaults(POINT_ANNOTATIONS_PROPS, value)
339
- };
340
- }
341
- );
342
- }, [pointAnnotations, sigma, serieMap]);
343
- const formattedXAxisAnnotations = useMemo(() => {
344
- if (!rangeAnnotations) {
345
- return [];
346
- }
347
- const positions = getAnnotationAxisX(
348
- middlePoint.x,
349
- sigma,
350
- sortedSerie[0].x,
351
- sortedSerie[sortedSerie.length - 1].x
352
- );
353
- return rangeAnnotations.map((annotation) => {
354
- const pos = calculateAnnotationAxisX(annotation, positions);
355
- return {
356
- ...applyDefaults(RANGE_ANNOTATIONS_PROPS, annotation),
357
- ...pos
358
- };
359
- });
360
- }, [rangeAnnotations, sigma, sortedSerie]);
361
- const { highlightPointAnnotations, highlightLineAnnotations } = useMemo(() => {
362
- if (!highlightAnnotations) {
363
- return {
364
- highlightLineAnnotations: [],
365
- highlightPointAnnotations: []
366
- };
367
- }
368
- const highlightPointAnnotations2 = [];
369
- const highlightLineAnnotations2 = [];
370
- const addLine = ({ x, line }) => {
371
- highlightLineAnnotations2.push(
372
- applyDefaults(HIGHLIGHT_LABEL_ANNOTATIONS_PROPS, {
373
- x,
374
- ...line
375
- })
376
- );
377
- };
378
- const addPoint = ({ x, y, point }) => {
379
- highlightPointAnnotations2.push(
380
- applyDefaults(HIGHLIGHT_MARKER_ANNOTATIONS_PROPS, {
381
- x,
382
- y,
383
- ...point
384
- })
385
- );
386
- };
387
- highlightAnnotations?.forEach((annotation) => {
388
- switch (annotation.show) {
389
- case "line":
390
- addLine(annotation);
391
- break;
392
- case "point":
393
- addPoint(annotation);
394
- break;
395
- case "both":
396
- addLine(annotation);
397
- addPoint(annotation);
398
- break;
399
- default:
400
- break;
401
- }
402
- });
403
- return {
404
- highlightPointAnnotations: highlightPointAnnotations2,
405
- highlightLineAnnotations: highlightLineAnnotations2
406
- };
407
- }, [highlightAnnotations]);
408
- return /* @__PURE__ */ jsx2(
409
- Chart_default,
410
- {
411
- series: calculatedSeries,
412
- options: {
413
- ...applyDefaults(DEFAULT_CHART_OPTIONS, options),
414
- annotations: {
415
- ...options?.annotations,
416
- points: [
417
- ...formattedPointAnnotations,
418
- ...highlightPointAnnotations,
419
- ...options?.annotations?.points || []
420
- ],
421
- xaxis: [
422
- ...formattedXAxisAnnotations,
423
- ...highlightLineAnnotations,
424
- ...options?.annotations?.xaxis || []
425
- ]
426
- }
427
- },
428
- height,
429
- ref,
430
- type: "area",
431
- ...props
432
- }
433
- );
434
- }
435
- );
436
-
437
- // src/charts/chart/variants/RadarChart/RadarChart.tsx
438
- import { applyDefaults as applyDefaults2 } from "@cleen/ui-core";
439
- import { forwardRef as forwardRef3 } from "react";
440
-
441
- // src/charts/chart/variants/RadarChart/constant.ts
442
- var DEFAULT_CHART_OPTIONS2 = {
443
- chart: {
444
- type: "radar",
445
- zoom: { enabled: false },
446
- toolbar: { show: false }
447
- },
448
- stroke: {
449
- width: 2
450
- },
451
- fill: {
452
- opacity: 0.25
453
- },
454
- markers: {
455
- size: 4,
456
- colors: "transparent",
457
- strokeColors: "transparent"
458
- },
459
- tooltip: {
460
- marker: {
461
- show: false
462
- }
463
- },
464
- legend: {
465
- show: false
466
- }
467
- };
468
-
469
- // src/charts/chart/variants/RadarChart/RadarChart.tsx
470
- import { jsx as jsx3 } from "react/jsx-runtime";
471
- var RadarChart = forwardRef3(
472
- function RadarChart2({ options, ...props }, ref) {
473
- return /* @__PURE__ */ jsx3(
474
- Chart_default,
475
- {
476
- type: "radar",
477
- ref,
478
- options: applyDefaults2(DEFAULT_CHART_OPTIONS2, options),
479
- ...props
480
- }
481
- );
482
- }
483
- );
484
-
485
- // src/charts/chart/variants/ScatterChart/ScatterChart.tsx
486
- import { applyDefaults as applyDefaults3 } from "@cleen/ui-core";
487
- import { forwardRef as forwardRef4 } from "react";
488
-
489
- // src/charts/chart/variants/ScatterChart/constant.ts
490
- var DEFAULT_CHART_OPTIONS3 = {
491
- chart: {
492
- type: "scatter",
493
- zoom: { enabled: false },
494
- toolbar: { show: false }
495
- },
496
- markers: {
497
- shape: "square",
498
- size: 8,
499
- strokeWidth: 0
500
- },
501
- grid: {
502
- strokeDashArray: 8
503
- },
504
- legend: {
505
- show: true,
506
- horizontalAlign: "right",
507
- position: "top",
508
- labels: {
509
- colors: "rgba(var(--cleen-gray), 0.8)"
510
- }
511
- },
512
- yaxis: {
513
- axisBorder: {
514
- show: true,
515
- color: "rgba(var(--cleen-gray), .2)"
516
- },
517
- labels: {
518
- style: {
519
- colors: "rgba(var(--cleen-gray), 0.8)"
520
- }
521
- }
522
- },
523
- xaxis: {
524
- axisBorder: {
525
- show: true,
526
- color: "rgba(var(--cleen-gray), .2)"
527
- },
528
- labels: {
529
- style: {
530
- colors: "rgba(var(--cleen-gray), 0.8)"
531
- }
532
- }
533
- },
534
- title: {
535
- align: "left",
536
- floating: true,
537
- style: {
538
- color: "rgba(var(--cleen-black))"
539
- }
540
- }
541
- };
542
-
543
- // src/charts/chart/variants/ScatterChart/ScatterChart.tsx
544
- import { jsx as jsx4 } from "react/jsx-runtime";
545
- var ScatterChart = forwardRef4(function ScatterChart2({ options, ...props }, ref) {
546
- return /* @__PURE__ */ jsx4(
547
- Chart_default,
548
- {
549
- type: "scatter",
550
- ref,
551
- options: applyDefaults3(DEFAULT_CHART_OPTIONS3, options),
552
- ...props
553
- }
554
- );
555
- });
556
-
557
- // src/charts/simpleChart/SimpleChart.tsx
558
- import "react";
559
- import { jsx as jsx5, jsxs } from "react/jsx-runtime";
560
- var SimpleChart = ({
561
- width = 240,
562
- height = 80,
563
- data = [12, 28, 18, 30, 24, 36],
564
- className = "",
565
- style
566
- }) => {
567
- const max = Math.max(...data, 1);
568
- const points = data.map(
569
- (d, i) => `${i / (data.length - 1) * width},${height - d / max * height}`
570
- ).join(" ");
571
- return /* @__PURE__ */ jsxs(
572
- "svg",
573
- {
574
- width,
575
- height,
576
- viewBox: `0 0 ${width} ${height}`,
577
- className,
578
- style,
579
- role: "img",
580
- "aria-label": "Simple line chart",
581
- children: [
582
- /* @__PURE__ */ jsx5("rect", { width: "100%", height: "100%", fill: "transparent" }),
583
- /* @__PURE__ */ jsx5(
584
- "polyline",
585
- {
586
- fill: "none",
587
- stroke: "rgba(59,130,246,0.9)",
588
- strokeWidth: 2,
589
- points,
590
- strokeLinecap: "round",
591
- strokeLinejoin: "round"
592
- }
593
- ),
594
- /* @__PURE__ */ jsx5(
595
- "polygon",
596
- {
597
- points: `${points} ${width},${height} 0,${height}`,
598
- fill: "rgba(59,130,246,0.08)"
599
- }
600
- )
601
- ]
602
- }
603
- );
604
- };
605
- export {
606
- BellCurve,
607
- Chart,
608
- RadarChart,
609
- ScatterChart,
610
- SimpleChart
611
- };
1
+ import{cn as U}from"@cleen/ui-core";import{forwardRef as W}from"react";import Y from"react-apexcharts";var S={chart:{toolbar:{show:!0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0}},animations:{enabled:!0}},dataLabels:{enabled:!1},stroke:{curve:"smooth",width:2},xaxis:{labels:{style:{fontSize:"12px"}}},yaxis:{labels:{style:{fontSize:"12px"}}},legend:{position:"top",horizontalAlign:"left"},tooltip:{enabled:!0,theme:"light"}};import{jsx as T}from"react/jsx-runtime";var v=W(function({type:e="line",series:t,options:o={},width:f="100%",height:h=350,className:i,style:s},y){let d={...S,...o,chart:{...S.chart,...o.chart,type:e}};return T("div",{className:U("cleen",i),style:s,children:T(Y,{options:d,series:t,type:e,width:f,height:h,ref:y})})}),g=v;import{applyDefaults as b}from"@cleen/ui-core";import{forwardRef as K,useMemo as A}from"react";import{ColorHelpers as u}from"@cleen/ui-core";var R={marker:{size:2,fillColor:"rgba(var(--cleen-gray), 0.8)",strokeColor:"rgba(var(--cleen-gray), 0.8)",offsetY:-16,shape:"triangle"},label:{borderWidth:0,offsetY:-20,style:{color:"rgba(var(--cleen-gray), 0.8)",background:"transparent",fontSize:"11px"}}},N={label:{borderColor:"transparent",style:{color:"rgba(var(--cleen-white))",background:"rgba(var(--cleen-primary))"}},fillColor:"rgba(var(--cleen-primary))"},w={label:{borderWidth:0,offsetY:-15,orientation:"horizontal",style:{color:"rgba(var(--cleen-primary))",background:"transparent",fontSize:"16px",fontWeight:700}},borderColor:"rgba(var(--cleen-primary))"},_={marker:{size:8,fillColor:"rgba(var(--cleen-primary))",strokeColor:"rgba(var(--cleen-white))"}},k={chart:{zoom:{enabled:!1},toolbar:{show:!1},animations:{enabled:!1}},stroke:{curve:"monotoneCubic",width:2.5},colors:[u.getComputedColor("var(--cleen-error)"),u.getComputedColor("var(--cleen-primary)"),u.getComputedColor("var(--cleen-success)")],fill:{type:"gradient",gradient:{shade:"light",type:"vertical",shadeIntensity:.6,gradientToColors:[u.getComputedColor("var(--cleen-error)")||"",u.getComputedColor("var(--cleen-primary)")||"",u.getComputedColor("var(--cleen-success)")||""],inverseColors:!1,opacityFrom:.95,opacityTo:.6}},yaxis:{show:!1},tooltip:{enabled:!0,x:{formatter:function(r){return`Score: ${typeof r=="string"?Number(r):r}`}},y:{formatter:function(r){return`${Number(r).toFixed(4)}`}}},grid:{show:!1},legend:{show:!1}};var I=(r,e)=>({middle:r,leftSigma:r-e,left2Sigma:r-2*e,left:r-3*e,rightSigma:r+2*e,right2Sigma:r+2*e,right:r+3*e}),H=(r,e,t,o)=>({middle:r,leftSigma:r-e,left2Sigma:r-2*e,left:t,rightSigma:r+e,right2Sigma:r+2*e,right:o}),L=(r,e)=>{let t={};switch(r.type){case"range":t={x:e[r.x],x2:e[r.x2]};break;case"offset":t={x:r.x-r.offset,x2:r.x+r.offset};break;case"region":r.x>=e.left&&r.x<e.left2Sigma?t={x:e.left,x2:e.left2Sigma}:r.x>=e.left2Sigma&&r.x<e.leftSigma?t={x:e.left2Sigma,x2:e.leftSigma}:r.x>=e.leftSigma&&r.x<e.middle?t={x:e.leftSigma,x2:e.middle}:r.x>=e.middle&&r.x<e.rightSigma?t={x:e.middle,x2:e.rightSigma}:r.x>=e.rightSigma&&r.x<e.right2Sigma?t={x:e.rightSigma,x2:e.right2Sigma}:r.x>=e.right2Sigma&&r.x<e.right&&(t={x:e.right2Sigma,x2:e.right});break;default:t={x:r.x,x2:r.x2};break}return t};import{jsx as J}from"react/jsx-runtime";var q=K(function({serie:e,labels:t,sigma:o,pointAnnotations:f,rangeAnnotations:h,highlightAnnotations:i,options:s,height:y=360,...d},X){let x=A(()=>e.sort((l,n)=>l.x-n.x),[e]),P=A(()=>{let l=new Map;return e.forEach(n=>l.set(n.x,n.y)),l},[e]),c=x[Math.floor(x.length/2)],E=A(()=>{let{below:l,middle:n,above:m}=e.reduce((p,a)=>(a.x<c.x-2*o?p.below.push(a):a.x>=c.x+2*o?(a.x===c.x+2*o&&p.middle.push(a),p.above.push(a)):(a.x===c.x-2*o&&p.below.push(a),p.middle.push(a)),p),{below:[],middle:[],above:[]});return[{name:t?.below||"Below threshold",data:l},{name:t?.middle||"Middle grounds",data:n},{name:t?.above||"Above threshold",data:m}]},[o,e,t,c]),D=A(()=>{if(!f)return[];let l=I(c.x,o);return Object.entries(f).map(([n,m])=>{let p=l[n];return{x:p,y:P.get(p)||0,...b(R,m)}})},[f,o,P]),G=A(()=>{if(!h)return[];let l=H(c.x,o,x[0].x,x[x.length-1].x);return h.map(n=>{let m=L(n,l);return{...b(N,n),...m}})},[h,o,x]),{highlightPointAnnotations:$,highlightLineAnnotations:F}=A(()=>{if(!i)return{highlightLineAnnotations:[],highlightPointAnnotations:[]};let l=[],n=[],m=({x:a,line:C})=>{n.push(b(w,{x:a,...C}))},p=({x:a,y:C,point:M})=>{l.push(b(_,{x:a,y:C,...M}))};return i?.forEach(a=>{switch(a.show){case"line":m(a);break;case"point":p(a);break;case"both":m(a),p(a);break;default:break}}),{highlightPointAnnotations:l,highlightLineAnnotations:n}},[i]);return J(g,{series:E,options:{...b(k,s),annotations:{...s?.annotations,points:[...D,...$,...s?.annotations?.points||[]],xaxis:[...G,...F,...s?.annotations?.xaxis||[]]}},height:y,ref:X,type:"area",...d})});import{applyDefaults as Q}from"@cleen/ui-core";import{forwardRef as V}from"react";var B={chart:{type:"radar",zoom:{enabled:!1},toolbar:{show:!1}},stroke:{width:2},fill:{opacity:.25},markers:{size:4,colors:"transparent",strokeColors:"transparent"},tooltip:{marker:{show:!1}},legend:{show:!1}};import{jsx as j}from"react/jsx-runtime";var Z=V(function({options:e,...t},o){return j(g,{type:"radar",ref:o,options:Q(B,e),...t})});import{applyDefaults as ee}from"@cleen/ui-core";import{forwardRef as re}from"react";var z={chart:{type:"scatter",zoom:{enabled:!1},toolbar:{show:!1}},markers:{shape:"square",size:8,strokeWidth:0},grid:{strokeDashArray:8},legend:{show:!0,horizontalAlign:"right",position:"top",labels:{colors:"rgba(var(--cleen-gray), 0.8)"}},yaxis:{axisBorder:{show:!0,color:"rgba(var(--cleen-gray), .2)"},labels:{style:{colors:"rgba(var(--cleen-gray), 0.8)"}}},xaxis:{axisBorder:{show:!0,color:"rgba(var(--cleen-gray), .2)"},labels:{style:{colors:"rgba(var(--cleen-gray), 0.8)"}}},title:{align:"left",floating:!0,style:{color:"rgba(var(--cleen-black))"}}};import{jsx as oe}from"react/jsx-runtime";var te=re(function({options:e,...t},o){return oe(g,{type:"scatter",ref:o,options:ee(z,e),...t})});import"react";import{jsx as O,jsxs as ne}from"react/jsx-runtime";var ae=({width:r=240,height:e=80,data:t=[12,28,18,30,24,36],className:o="",style:f})=>{let h=Math.max(...t,1),i=t.map((s,y)=>`${y/(t.length-1)*r},${e-s/h*e}`).join(" ");return ne("svg",{width:r,height:e,viewBox:`0 0 ${r} ${e}`,className:o,style:f,role:"img","aria-label":"Simple line chart",children:[O("rect",{width:"100%",height:"100%",fill:"transparent"}),O("polyline",{fill:"none",stroke:"rgba(59,130,246,0.9)",strokeWidth:2,points:i,strokeLinecap:"round",strokeLinejoin:"round"}),O("polygon",{points:`${i} ${r},${e} 0,${e}`,fill:"rgba(59,130,246,0.08)"})]})};export{q as BellCurve,v as Chart,Z as RadarChart,te as ScatterChart,ae as SimpleChart};
@@ -1,77 +1 @@
1
- // src/icons/IconFromLibrary.tsx
2
- import "react";
3
- import { jsx } from "react/jsx-runtime";
4
- var IconFromLibrary = ({
5
- icon: OriginalIcon,
6
- ...props
7
- }) => {
8
- return /* @__PURE__ */ jsx(OriginalIcon, { ...props });
9
- };
10
-
11
- // src/icons/getIconByName.ts
12
- var getIconByName = async (iconName) => {
13
- if (!iconName || typeof iconName !== "string") {
14
- return null;
15
- }
16
- const prefix = iconName.substring(0, 2);
17
- try {
18
- let iconModule;
19
- switch (prefix) {
20
- case "Fa":
21
- iconModule = await import("react-icons/fa");
22
- break;
23
- case "Md":
24
- iconModule = await import("react-icons/md");
25
- break;
26
- case "Ai":
27
- iconModule = await import("react-icons/ai");
28
- break;
29
- case "Bi":
30
- iconModule = await import("react-icons/bi");
31
- break;
32
- case "Bs":
33
- iconModule = await import("react-icons/bs");
34
- break;
35
- case "Fi":
36
- iconModule = await import("react-icons/fi");
37
- break;
38
- case "Hi":
39
- iconModule = await import("react-icons/hi");
40
- break;
41
- case "Io":
42
- iconModule = await import("react-icons/io");
43
- break;
44
- case "Ri":
45
- iconModule = await import("react-icons/ri");
46
- break;
47
- default:
48
- console.warn(
49
- `Unknown icon library prefix: ${prefix} in icon name: ${iconName}`
50
- );
51
- return null;
52
- }
53
- const iconComponent = iconModule[iconName];
54
- if (!iconComponent || typeof iconComponent !== "function") {
55
- return null;
56
- }
57
- return iconComponent;
58
- } catch (error) {
59
- console.error(`Error loading icon "${iconName}":`, error);
60
- return null;
61
- }
62
- };
63
-
64
- // src/icons/index.ts
65
- export * from "react-icons/fa";
66
- export * from "react-icons/md";
67
- export * from "react-icons/ai";
68
- export * from "react-icons/bi";
69
- export * from "react-icons/bs";
70
- export * from "react-icons/fi";
71
- export * from "react-icons/hi";
72
- export * from "react-icons/io";
73
- export * from "react-icons/ri";
74
- export {
75
- IconFromLibrary,
76
- getIconByName
77
- };
1
+ import"react";import{jsx as a}from"react/jsx-runtime";var n=({icon:o,...e})=>a(o,{...e});var i=async o=>{if(!o||typeof o!="string")return null;let e=o.substring(0,2);try{let r;switch(e){case"Fa":r=await import("react-icons/fa");break;case"Md":r=await import("react-icons/md");break;case"Ai":r=await import("react-icons/ai");break;case"Bi":r=await import("react-icons/bi");break;case"Bs":r=await import("react-icons/bs");break;case"Fi":r=await import("react-icons/fi");break;case"Hi":r=await import("react-icons/hi");break;case"Io":r=await import("react-icons/io");break;case"Ri":r=await import("react-icons/ri");break;default:return console.warn(`Unknown icon library prefix: ${e} in icon name: ${o}`),null}let t=r[o];return!t||typeof t!="function"?null:t}catch(r){return console.error(`Error loading icon "${o}":`,r),null}};export*from"react-icons/fa";export*from"react-icons/md";export*from"react-icons/ai";export*from"react-icons/bi";export*from"react-icons/bs";export*from"react-icons/fi";export*from"react-icons/hi";export*from"react-icons/io";export*from"react-icons/ri";export{n as IconFromLibrary,i as getIconByName};