@wso2/oxygen-ui-charts-react 0.2.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.
package/dist/index.js ADDED
@@ -0,0 +1,1599 @@
1
+ // src/components/charts/BarChart/BarChart.tsx
2
+ import React from "react";
3
+ import { useTheme } from "@mui/material/styles";
4
+ import { useColorScheme } from "@wso2/oxygen-ui";
5
+ import {
6
+ BarChart as RechartsBarChart,
7
+ Bar,
8
+ XAxis,
9
+ YAxis,
10
+ CartesianGrid,
11
+ Tooltip,
12
+ Legend,
13
+ ResponsiveContainer
14
+ } from "recharts";
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
+ var BarChart = ({
17
+ data,
18
+ bars,
19
+ xAxisDataKey,
20
+ height = 300,
21
+ width = "100%",
22
+ legend,
23
+ grid,
24
+ tooltip,
25
+ layout = "horizontal",
26
+ margin,
27
+ barCategoryGap,
28
+ barGap,
29
+ barSize,
30
+ maxBarSize,
31
+ stackOffset = "none",
32
+ accessibilityLayer = true,
33
+ xAxis,
34
+ yAxis,
35
+ isAnimationActive = true,
36
+ animationDuration = 1500,
37
+ animationBegin = 0,
38
+ animationEasing = "ease",
39
+ colors: customColors,
40
+ children,
41
+ onClick,
42
+ onMouseEnter,
43
+ onMouseLeave,
44
+ onMouseDown,
45
+ onMouseUp,
46
+ onMouseMove
47
+ }) => {
48
+ const theme = useTheme();
49
+ const { mode, systemMode } = useColorScheme();
50
+ const isDark = mode === "dark" || mode === "system" && systemMode === "dark";
51
+ const colors = React.useMemo(() => {
52
+ const defaultColors = {
53
+ primary: isDark ? "#F87643" : "#fa7b3f",
54
+ background: isDark ? "#1e1e1e" : "#f5f5f5",
55
+ text: isDark ? "#d4d4d4" : "#24292e",
56
+ comment: isDark ? "#6a9955" : "#6a737d",
57
+ keyword: isDark ? "#569cd6" : "#d73a49",
58
+ string: isDark ? "#ce9178" : "#032f62",
59
+ function: isDark ? "#dcdcaa" : "#6f42c1",
60
+ number: isDark ? "#b5cea8" : "#005cc5",
61
+ operator: isDark ? "#d4d4d4" : "#d73a49"
62
+ };
63
+ const themeSyntax = isDark ? theme.vars?.syntax?.dark : theme.vars?.syntax?.light;
64
+ return {
65
+ ...defaultColors,
66
+ ...themeSyntax,
67
+ primary: theme.palette.primary?.main || themeSyntax?.primary || defaultColors.primary
68
+ };
69
+ }, [isDark, theme.palette.primary?.main, theme.vars]);
70
+ const barColors = React.useMemo(() => {
71
+ if (customColors && customColors.length > 0) return customColors;
72
+ return [
73
+ colors.primary,
74
+ colors.keyword,
75
+ colors.string,
76
+ colors.function,
77
+ colors.number,
78
+ colors.operator
79
+ ];
80
+ }, [
81
+ customColors,
82
+ colors.primary,
83
+ colors.keyword,
84
+ colors.string,
85
+ colors.function,
86
+ colors.number,
87
+ colors.operator
88
+ ]);
89
+ const legendConfig = React.useMemo(
90
+ () => ({ show: true, align: "center", verticalAlign: "bottom", ...legend }),
91
+ [legend]
92
+ );
93
+ const gridConfig = React.useMemo(() => ({ show: true, strokeDasharray: "3 3", ...grid }), [grid]);
94
+ const marginConfig = React.useMemo(
95
+ () => ({ top: 12, right: 24, left: 24, bottom: 40, ...margin }),
96
+ [margin]
97
+ );
98
+ const xAxisConfig = React.useMemo(() => ({ show: true, ...xAxis }), [xAxis]);
99
+ const yAxisConfig = React.useMemo(() => ({ show: true, ...yAxis }), [yAxis]);
100
+ return /* @__PURE__ */ jsx(ResponsiveContainer, { width, height, children: /* @__PURE__ */ jsxs(
101
+ RechartsBarChart,
102
+ {
103
+ data,
104
+ layout,
105
+ margin: marginConfig,
106
+ barCategoryGap,
107
+ barGap,
108
+ barSize,
109
+ maxBarSize,
110
+ stackOffset,
111
+ accessibilityLayer,
112
+ children: [
113
+ gridConfig?.show && /* @__PURE__ */ jsx(
114
+ CartesianGrid,
115
+ {
116
+ strokeDasharray: gridConfig.strokeDasharray,
117
+ stroke: colors.text,
118
+ vertical: false
119
+ }
120
+ ),
121
+ xAxisConfig?.show && /* @__PURE__ */ jsx(
122
+ XAxis,
123
+ {
124
+ type: layout === "vertical" ? "number" : "category",
125
+ dataKey: layout === "vertical" ? void 0 : xAxisDataKey,
126
+ stroke: colors.text,
127
+ tick: {
128
+ fill: colors.text,
129
+ fontSize: 12
130
+ },
131
+ tickMargin: 8,
132
+ axisLine: { stroke: colors.text },
133
+ tickLine: { stroke: colors.text },
134
+ label: xAxisConfig.name ? {
135
+ value: xAxisConfig.name,
136
+ position: "insideBottom",
137
+ offset: -18,
138
+ fill: colors.text,
139
+ fontSize: 12
140
+ } : void 0
141
+ }
142
+ ),
143
+ yAxisConfig?.show && /* @__PURE__ */ jsx(
144
+ YAxis,
145
+ {
146
+ type: layout === "vertical" ? "category" : "number",
147
+ dataKey: layout === "vertical" ? xAxisDataKey : void 0,
148
+ stroke: colors.text,
149
+ tick: {
150
+ fill: colors.text,
151
+ fontSize: 12
152
+ },
153
+ tickMargin: 8,
154
+ axisLine: { stroke: colors.text },
155
+ tickLine: { stroke: colors.text },
156
+ label: yAxisConfig.name ? {
157
+ value: yAxisConfig.name,
158
+ angle: -90,
159
+ position: "insideLeft",
160
+ offset: 0,
161
+ fill: colors.text,
162
+ fontSize: 12
163
+ } : void 0
164
+ }
165
+ ),
166
+ tooltip?.show !== false && (() => {
167
+ const { contentStyle, itemStyle, labelStyle, show, ...rest } = tooltip || {};
168
+ return /* @__PURE__ */ jsx(
169
+ Tooltip,
170
+ {
171
+ cursor: {
172
+ fill: isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)"
173
+ },
174
+ ...rest,
175
+ contentStyle: {
176
+ backgroundColor: colors.background,
177
+ border: `1px solid ${colors.text}`,
178
+ borderRadius: theme.shape.borderRadius ?? 8,
179
+ color: colors.text,
180
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
181
+ ...contentStyle
182
+ },
183
+ itemStyle: {
184
+ color: colors.text,
185
+ fontSize: 12,
186
+ ...itemStyle
187
+ },
188
+ labelStyle: {
189
+ color: colors.text,
190
+ fontWeight: 600,
191
+ marginBottom: 4,
192
+ ...labelStyle
193
+ }
194
+ }
195
+ );
196
+ })(),
197
+ legendConfig.show && /* @__PURE__ */ jsx(
198
+ Legend,
199
+ {
200
+ align: legendConfig.align,
201
+ verticalAlign: legendConfig.verticalAlign,
202
+ iconType: "circle",
203
+ formatter: (value) => /* @__PURE__ */ jsx(
204
+ "span",
205
+ {
206
+ style: {
207
+ color: colors.text,
208
+ fontSize: 13,
209
+ fontWeight: 500
210
+ },
211
+ children: value
212
+ }
213
+ ),
214
+ wrapperStyle: { paddingTop: 32 }
215
+ }
216
+ ),
217
+ bars?.map((bar, index) => /* @__PURE__ */ jsx(
218
+ Bar,
219
+ {
220
+ dataKey: bar.dataKey,
221
+ name: bar.name,
222
+ fill: bar.fill || barColors[index % barColors.length],
223
+ radius: bar.radius ?? [4, 4, 0, 0],
224
+ stackId: bar.stackId,
225
+ hide: bar.hide,
226
+ label: bar.label,
227
+ isAnimationActive: bar.isAnimationActive ?? isAnimationActive,
228
+ animationDuration: bar.animationDuration ?? animationDuration,
229
+ animationBegin: bar.animationBegin ?? animationBegin,
230
+ animationEasing: bar.animationEasing ?? animationEasing,
231
+ onClick: bar.onClick || onClick,
232
+ onMouseEnter: bar.onMouseEnter || onMouseEnter,
233
+ onMouseLeave: bar.onMouseLeave || onMouseLeave,
234
+ onMouseDown: bar.onMouseDown || onMouseDown,
235
+ onMouseUp: bar.onMouseUp || onMouseUp,
236
+ onMouseMove: bar.onMouseMove || onMouseMove
237
+ },
238
+ `${bar.dataKey}-${index}`
239
+ )),
240
+ children
241
+ ]
242
+ }
243
+ ) });
244
+ };
245
+ BarChart.displayName = "BarChart";
246
+ var BarChart_default = BarChart;
247
+
248
+ // src/components/charts/PieChart/PieChart.tsx
249
+ import React2 from "react";
250
+ import { useTheme as useTheme2 } from "@mui/material/styles";
251
+ import { useColorScheme as useColorScheme2 } from "@wso2/oxygen-ui";
252
+ import {
253
+ PieChart as RechartsPieChart,
254
+ Pie,
255
+ Cell,
256
+ Tooltip as Tooltip2,
257
+ Legend as Legend2,
258
+ ResponsiveContainer as ResponsiveContainer2
259
+ } from "recharts";
260
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
261
+ var PieChart = ({
262
+ data = [],
263
+ pies,
264
+ nameKey,
265
+ height = 300,
266
+ width = "100%",
267
+ legend,
268
+ tooltip,
269
+ margin,
270
+ cx = "50%",
271
+ cy = "50%",
272
+ startAngle = 0,
273
+ endAngle = 360,
274
+ innerRadius = 0,
275
+ outerRadius = "80%",
276
+ paddingAngle = 0,
277
+ cornerRadius = 0,
278
+ minAngle = 0,
279
+ isAnimationActive = true,
280
+ animationDuration = 1500,
281
+ animationBegin = 0,
282
+ animationEasing = "ease",
283
+ colors: customColors,
284
+ label,
285
+ labelLine,
286
+ onClick,
287
+ onMouseEnter,
288
+ onMouseLeave,
289
+ onMouseDown,
290
+ onMouseUp,
291
+ onMouseMove,
292
+ onContextMenu,
293
+ onDoubleClick,
294
+ children
295
+ }) => {
296
+ const theme = useTheme2();
297
+ const { mode, systemMode } = useColorScheme2();
298
+ const isDark = mode === "dark" || mode === "system" && systemMode === "dark";
299
+ const syntaxColors = React2.useMemo(() => {
300
+ const defaultColors = {
301
+ primary: isDark ? "#F87643" : "#fa7b3f",
302
+ background: isDark ? "#1e1e1e" : "#f5f5f5",
303
+ text: isDark ? "#d4d4d4" : "#24292e",
304
+ comment: isDark ? "#6a9955" : "#6a737d",
305
+ keyword: isDark ? "#569cd6" : "#d73a49",
306
+ string: isDark ? "#ce9178" : "#032f62",
307
+ function: isDark ? "#dcdcaa" : "#6f42c1",
308
+ number: isDark ? "#b5cea8" : "#005cc5",
309
+ operator: isDark ? "#d4d4d4" : "#d73a49"
310
+ };
311
+ const themeSyntax = isDark ? theme.vars?.syntax?.dark : theme.vars?.syntax?.light;
312
+ return {
313
+ ...defaultColors,
314
+ ...themeSyntax,
315
+ primary: theme.palette.primary?.main || themeSyntax?.primary || defaultColors.primary
316
+ };
317
+ }, [isDark, theme.palette.primary?.main, theme.vars]);
318
+ const chartColors = React2.useMemo(() => {
319
+ if (customColors && customColors.length > 0) return customColors;
320
+ return [
321
+ syntaxColors.primary,
322
+ syntaxColors.keyword,
323
+ syntaxColors.string,
324
+ syntaxColors.function,
325
+ syntaxColors.number,
326
+ syntaxColors.operator
327
+ ];
328
+ }, [
329
+ customColors,
330
+ syntaxColors.primary,
331
+ syntaxColors.keyword,
332
+ syntaxColors.string,
333
+ syntaxColors.function,
334
+ syntaxColors.number,
335
+ syntaxColors.operator
336
+ ]);
337
+ const legendConfig = React2.useMemo(
338
+ () => ({ show: true, align: "center", verticalAlign: "bottom", ...legend }),
339
+ [legend]
340
+ );
341
+ const marginConfig = React2.useMemo(
342
+ () => ({ top: 12, right: 24, left: 24, bottom: 40, ...margin }),
343
+ [margin]
344
+ );
345
+ return /* @__PURE__ */ jsx2(ResponsiveContainer2, { width, height, children: /* @__PURE__ */ jsxs2(RechartsPieChart, { data, margin: marginConfig, children: [
346
+ pies?.map((pie, index) => /* @__PURE__ */ jsx2(
347
+ Pie,
348
+ {
349
+ data,
350
+ dataKey: pie.dataKey,
351
+ nameKey: pie.nameKey || nameKey,
352
+ name: pie.name,
353
+ cx: pie.cx ?? cx,
354
+ cy: pie.cy ?? cy,
355
+ startAngle: pie.startAngle ?? startAngle,
356
+ endAngle: pie.endAngle ?? endAngle,
357
+ innerRadius: pie.innerRadius ?? innerRadius,
358
+ outerRadius: pie.outerRadius ?? outerRadius,
359
+ paddingAngle: pie.paddingAngle ?? paddingAngle,
360
+ cornerRadius: pie.cornerRadius ?? cornerRadius,
361
+ minAngle: pie.minAngle ?? minAngle,
362
+ isAnimationActive: pie.isAnimationActive ?? isAnimationActive,
363
+ animationDuration: pie.animationDuration ?? animationDuration,
364
+ animationBegin: pie.animationBegin ?? animationBegin,
365
+ animationEasing: pie.animationEasing ?? animationEasing,
366
+ label: pie.label ?? label,
367
+ labelLine: pie.labelLine ?? labelLine,
368
+ onClick: pie.onClick || onClick,
369
+ onMouseEnter: pie.onMouseEnter || onMouseEnter,
370
+ onMouseLeave: pie.onMouseLeave || onMouseLeave,
371
+ onMouseDown: pie.onMouseDown || onMouseDown,
372
+ onMouseUp: pie.onMouseUp || onMouseUp,
373
+ onMouseMove: pie.onMouseMove || onMouseMove,
374
+ onContextMenu: pie.onContextMenu || onContextMenu,
375
+ onDoubleClick: pie.onDoubleClick || onDoubleClick,
376
+ children: data.map((entry, index2) => /* @__PURE__ */ jsx2(Cell, { fill: chartColors[index2 % chartColors.length] }, `cell-${index2}`))
377
+ },
378
+ `${pie.dataKey}-${index}`
379
+ )),
380
+ tooltip?.show !== false && (() => {
381
+ const { contentStyle, itemStyle, labelStyle, show, ...rest } = tooltip || {};
382
+ return /* @__PURE__ */ jsx2(
383
+ Tooltip2,
384
+ {
385
+ ...rest,
386
+ contentStyle: {
387
+ backgroundColor: syntaxColors.background,
388
+ border: `1px solid ${syntaxColors.text}`,
389
+ borderRadius: theme.shape.borderRadius ?? 8,
390
+ color: syntaxColors.text,
391
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
392
+ ...contentStyle
393
+ },
394
+ itemStyle: {
395
+ color: syntaxColors.text,
396
+ fontSize: 12,
397
+ ...itemStyle
398
+ },
399
+ labelStyle: {
400
+ color: syntaxColors.text,
401
+ fontWeight: 600,
402
+ marginBottom: 4,
403
+ ...labelStyle
404
+ }
405
+ }
406
+ );
407
+ })(),
408
+ legendConfig.show && /* @__PURE__ */ jsx2(
409
+ Legend2,
410
+ {
411
+ align: legendConfig.align,
412
+ verticalAlign: legendConfig.verticalAlign,
413
+ iconType: "circle",
414
+ formatter: (value) => /* @__PURE__ */ jsx2(
415
+ "span",
416
+ {
417
+ style: {
418
+ color: syntaxColors.text,
419
+ fontSize: 13,
420
+ fontWeight: 500
421
+ },
422
+ children: value
423
+ }
424
+ ),
425
+ wrapperStyle: { paddingTop: 32 }
426
+ }
427
+ ),
428
+ children
429
+ ] }) });
430
+ };
431
+ PieChart.displayName = "PieChart";
432
+ var PieChart_default = PieChart;
433
+
434
+ // src/components/charts/LineChart/LineChart.tsx
435
+ import React3 from "react";
436
+ import { useTheme as useTheme3 } from "@mui/material/styles";
437
+ import { useColorScheme as useColorScheme3 } from "@wso2/oxygen-ui";
438
+ import {
439
+ LineChart as RechartsLineChart,
440
+ Line,
441
+ XAxis as XAxis2,
442
+ YAxis as YAxis2,
443
+ CartesianGrid as CartesianGrid2,
444
+ Tooltip as Tooltip3,
445
+ Legend as Legend3,
446
+ ResponsiveContainer as ResponsiveContainer3
447
+ } from "recharts";
448
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
449
+ var LineChart = ({
450
+ data,
451
+ lines,
452
+ xAxisDataKey,
453
+ height = 300,
454
+ width = "100%",
455
+ legend,
456
+ grid,
457
+ tooltip,
458
+ layout = "horizontal",
459
+ margin,
460
+ syncId,
461
+ syncMethod,
462
+ role,
463
+ title,
464
+ desc,
465
+ accessibilityLayer = true,
466
+ xAxis,
467
+ yAxis,
468
+ onClick,
469
+ onMouseDown,
470
+ onMouseUp,
471
+ onMouseMove,
472
+ onMouseEnter,
473
+ onMouseLeave,
474
+ isAnimationActive = true,
475
+ animationDuration = 1500,
476
+ animationBegin = 0,
477
+ animationEasing = "ease",
478
+ colors: customColors,
479
+ children
480
+ }) => {
481
+ const theme = useTheme3();
482
+ const { mode, systemMode } = useColorScheme3();
483
+ const isDark = mode === "dark" || mode === "system" && systemMode === "dark";
484
+ const colors = React3.useMemo(() => {
485
+ const defaultColors = {
486
+ primary: isDark ? "#F87643" : "#fa7b3f",
487
+ background: isDark ? "#1e1e1e" : "#f5f5f5",
488
+ text: isDark ? "#d4d4d4" : "#24292e",
489
+ comment: isDark ? "#6a9955" : "#6a737d",
490
+ keyword: isDark ? "#569cd6" : "#d73a49",
491
+ string: isDark ? "#ce9178" : "#032f62",
492
+ function: isDark ? "#dcdcaa" : "#6f42c1",
493
+ number: isDark ? "#b5cea8" : "#005cc5",
494
+ operator: isDark ? "#d4d4d4" : "#d73a49"
495
+ };
496
+ const themeSyntax = isDark ? theme.vars?.syntax?.dark : theme.vars?.syntax?.light;
497
+ return {
498
+ ...defaultColors,
499
+ ...themeSyntax,
500
+ primary: theme.palette.primary?.main || themeSyntax?.primary || defaultColors.primary
501
+ };
502
+ }, [isDark, theme.palette.primary?.main, theme.vars]);
503
+ const lineColors = React3.useMemo(() => {
504
+ if (customColors && customColors.length > 0) return customColors;
505
+ return [
506
+ colors.primary,
507
+ colors.keyword,
508
+ colors.string,
509
+ colors.function,
510
+ colors.number,
511
+ colors.operator
512
+ ];
513
+ }, [
514
+ customColors,
515
+ colors.primary,
516
+ colors.keyword,
517
+ colors.string,
518
+ colors.function,
519
+ colors.number,
520
+ colors.operator
521
+ ]);
522
+ const legendConfig = React3.useMemo(
523
+ () => ({ show: true, align: "center", verticalAlign: "bottom", ...legend }),
524
+ [legend]
525
+ );
526
+ const gridConfig = React3.useMemo(() => ({ show: true, strokeDasharray: "3 3", ...grid }), [grid]);
527
+ const marginConfig = React3.useMemo(
528
+ () => ({ top: 12, right: 24, left: 24, bottom: 40, ...margin }),
529
+ [margin]
530
+ );
531
+ const xAxisConfig = React3.useMemo(() => ({ show: true, ...xAxis }), [xAxis]);
532
+ const yAxisConfig = React3.useMemo(() => ({ show: true, ...yAxis }), [yAxis]);
533
+ return /* @__PURE__ */ jsx3(ResponsiveContainer3, { width, height, children: /* @__PURE__ */ jsxs3(
534
+ RechartsLineChart,
535
+ {
536
+ data,
537
+ layout,
538
+ margin: marginConfig,
539
+ syncId,
540
+ syncMethod,
541
+ role,
542
+ title,
543
+ desc,
544
+ accessibilityLayer,
545
+ onClick,
546
+ onMouseDown,
547
+ onMouseUp,
548
+ onMouseMove,
549
+ onMouseEnter,
550
+ onMouseLeave,
551
+ children: [
552
+ gridConfig?.show && /* @__PURE__ */ jsx3(
553
+ CartesianGrid2,
554
+ {
555
+ strokeDasharray: gridConfig.strokeDasharray,
556
+ stroke: colors.text,
557
+ vertical: false
558
+ }
559
+ ),
560
+ xAxisConfig?.show && /* @__PURE__ */ jsx3(
561
+ XAxis2,
562
+ {
563
+ type: xAxisConfig.type || (layout === "vertical" ? "number" : "category"),
564
+ dataKey: layout === "vertical" ? void 0 : xAxisDataKey,
565
+ stroke: colors.text,
566
+ domain: xAxisConfig.domain,
567
+ tickCount: xAxisConfig.tickCount,
568
+ interval: xAxisConfig.interval,
569
+ tick: {
570
+ fill: colors.text,
571
+ fontSize: 12
572
+ },
573
+ tickMargin: 8,
574
+ axisLine: { stroke: colors.text },
575
+ tickLine: { stroke: colors.text },
576
+ label: xAxisConfig.name ? {
577
+ value: xAxisConfig.name,
578
+ position: "insideBottom",
579
+ offset: -18,
580
+ fill: colors.text,
581
+ fontSize: 12
582
+ } : void 0
583
+ }
584
+ ),
585
+ yAxisConfig?.show && /* @__PURE__ */ jsx3(
586
+ YAxis2,
587
+ {
588
+ type: yAxisConfig.type || (layout === "vertical" ? "category" : "number"),
589
+ dataKey: layout === "vertical" ? xAxisDataKey : void 0,
590
+ stroke: colors.text,
591
+ domain: yAxisConfig.domain,
592
+ tickCount: yAxisConfig.tickCount,
593
+ interval: yAxisConfig.interval,
594
+ tick: {
595
+ fill: colors.text,
596
+ fontSize: 12
597
+ },
598
+ tickMargin: 8,
599
+ axisLine: { stroke: colors.text },
600
+ tickLine: { stroke: colors.text },
601
+ label: yAxisConfig.name ? {
602
+ value: yAxisConfig.name,
603
+ angle: -90,
604
+ position: "insideLeft",
605
+ offset: 0,
606
+ fill: colors.text,
607
+ fontSize: 12
608
+ } : void 0
609
+ }
610
+ ),
611
+ tooltip?.show !== false && (() => {
612
+ const { contentStyle, itemStyle, labelStyle, show, ...rest } = tooltip || {};
613
+ return /* @__PURE__ */ jsx3(
614
+ Tooltip3,
615
+ {
616
+ ...rest,
617
+ contentStyle: {
618
+ backgroundColor: colors.background,
619
+ border: `1px solid ${colors.text}`,
620
+ borderRadius: theme.shape.borderRadius ?? 8,
621
+ color: colors.text,
622
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
623
+ ...contentStyle
624
+ },
625
+ itemStyle: {
626
+ color: colors.text,
627
+ fontSize: 12,
628
+ ...itemStyle
629
+ },
630
+ labelStyle: {
631
+ color: colors.text,
632
+ fontWeight: 600,
633
+ marginBottom: 4,
634
+ ...labelStyle
635
+ }
636
+ }
637
+ );
638
+ })(),
639
+ legendConfig.show && /* @__PURE__ */ jsx3(
640
+ Legend3,
641
+ {
642
+ align: legendConfig.align,
643
+ verticalAlign: legendConfig.verticalAlign,
644
+ iconType: "circle",
645
+ formatter: (value) => /* @__PURE__ */ jsx3(
646
+ "span",
647
+ {
648
+ style: {
649
+ color: colors.text,
650
+ fontSize: 13,
651
+ fontWeight: 500
652
+ },
653
+ children: value
654
+ }
655
+ ),
656
+ wrapperStyle: { paddingTop: 32 }
657
+ }
658
+ ),
659
+ lines?.map((line, index) => /* @__PURE__ */ jsx3(
660
+ Line,
661
+ {
662
+ dataKey: line.dataKey,
663
+ name: line.name,
664
+ stroke: line.stroke || lineColors[index % lineColors.length],
665
+ strokeWidth: line.strokeWidth ?? 2,
666
+ strokeDasharray: line.strokeDasharray,
667
+ type: line.type || "monotone",
668
+ hide: line.hide,
669
+ label: line.label,
670
+ dot: line.dot ?? true,
671
+ activeDot: line.activeDot ?? true,
672
+ connectNulls: line.connectNulls,
673
+ unit: line.unit,
674
+ legendType: line.legendType || "line",
675
+ onClick: line.onClick,
676
+ onMouseDown: line.onMouseDown,
677
+ onMouseUp: line.onMouseUp,
678
+ onMouseMove: line.onMouseMove,
679
+ onMouseOver: line.onMouseOver,
680
+ onMouseOut: line.onMouseOut,
681
+ onMouseEnter: line.onMouseEnter,
682
+ onMouseLeave: line.onMouseLeave,
683
+ isAnimationActive: line.isAnimationActive ?? isAnimationActive,
684
+ animationDuration: line.animationDuration ?? animationDuration,
685
+ animationBegin: line.animationBegin ?? animationBegin,
686
+ animationEasing: line.animationEasing ?? animationEasing
687
+ },
688
+ `${line.dataKey}-${index}`
689
+ )),
690
+ children
691
+ ]
692
+ }
693
+ ) });
694
+ };
695
+ LineChart.displayName = "LineChart";
696
+ var LineChart_default = LineChart;
697
+
698
+ // src/components/charts/AreaChart/AreaChart.tsx
699
+ import React4 from "react";
700
+ import { useTheme as useTheme4 } from "@mui/material/styles";
701
+ import { useColorScheme as useColorScheme4 } from "@wso2/oxygen-ui";
702
+ import {
703
+ AreaChart as RechartsAreaChart,
704
+ Area,
705
+ XAxis as XAxis3,
706
+ YAxis as YAxis3,
707
+ CartesianGrid as CartesianGrid3,
708
+ Tooltip as Tooltip4,
709
+ Legend as Legend4,
710
+ ResponsiveContainer as ResponsiveContainer4
711
+ } from "recharts";
712
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
713
+ var AreaChart = ({
714
+ data,
715
+ areas,
716
+ xAxisDataKey,
717
+ height = 300,
718
+ width = "100%",
719
+ legend,
720
+ grid,
721
+ tooltip,
722
+ layout = "horizontal",
723
+ margin,
724
+ syncId,
725
+ syncMethod,
726
+ role,
727
+ title,
728
+ desc,
729
+ accessibilityLayer = true,
730
+ xAxis,
731
+ yAxis,
732
+ onClick,
733
+ onMouseDown,
734
+ onMouseUp,
735
+ onMouseMove,
736
+ onMouseEnter,
737
+ onMouseLeave,
738
+ isAnimationActive = true,
739
+ animationDuration = 1500,
740
+ animationBegin = 0,
741
+ animationEasing = "ease",
742
+ colors: customColors,
743
+ children
744
+ }) => {
745
+ const theme = useTheme4();
746
+ const { mode, systemMode } = useColorScheme4();
747
+ const isDark = mode === "dark" || mode === "system" && systemMode === "dark";
748
+ const colors = React4.useMemo(() => {
749
+ const defaultColors = {
750
+ primary: isDark ? "#F87643" : "#fa7b3f",
751
+ background: isDark ? "#1e1e1e" : "#f5f5f5",
752
+ text: isDark ? "#d4d4d4" : "#24292e",
753
+ comment: isDark ? "#6a9955" : "#6a737d",
754
+ keyword: isDark ? "#569cd6" : "#d73a49",
755
+ string: isDark ? "#ce9178" : "#032f62",
756
+ function: isDark ? "#dcdcaa" : "#6f42c1",
757
+ number: isDark ? "#b5cea8" : "#005cc5",
758
+ operator: isDark ? "#d4d4d4" : "#d73a49"
759
+ };
760
+ const themeSyntax = isDark ? theme.vars?.syntax?.dark : theme.vars?.syntax?.light;
761
+ return {
762
+ ...defaultColors,
763
+ ...themeSyntax,
764
+ primary: theme.palette.primary?.main || themeSyntax?.primary || defaultColors.primary
765
+ };
766
+ }, [isDark, theme.palette.primary?.main, theme.vars]);
767
+ const idPrefix = React4.useId();
768
+ const areaColors = React4.useMemo(() => {
769
+ if (customColors && customColors.length > 0) return customColors;
770
+ return [
771
+ colors.primary,
772
+ colors.keyword,
773
+ colors.string,
774
+ colors.function,
775
+ colors.number,
776
+ colors.operator
777
+ ];
778
+ }, [
779
+ customColors,
780
+ colors.primary,
781
+ colors.keyword,
782
+ colors.string,
783
+ colors.function,
784
+ colors.number,
785
+ colors.operator
786
+ ]);
787
+ const legendConfig = React4.useMemo(
788
+ () => ({ show: true, align: "center", verticalAlign: "bottom", ...legend }),
789
+ [legend]
790
+ );
791
+ const gridConfig = React4.useMemo(() => ({ show: true, strokeDasharray: "3 3", ...grid }), [grid]);
792
+ const marginConfig = React4.useMemo(
793
+ () => ({ top: 12, right: 24, left: 24, bottom: 40, ...margin }),
794
+ [margin]
795
+ );
796
+ const xAxisConfig = React4.useMemo(() => ({ show: true, ...xAxis }), [xAxis]);
797
+ const yAxisConfig = React4.useMemo(() => ({ show: true, ...yAxis }), [yAxis]);
798
+ return /* @__PURE__ */ jsx4(ResponsiveContainer4, { width, height, children: /* @__PURE__ */ jsxs4(
799
+ RechartsAreaChart,
800
+ {
801
+ data,
802
+ layout,
803
+ margin: marginConfig,
804
+ syncId,
805
+ syncMethod,
806
+ role,
807
+ title,
808
+ desc,
809
+ accessibilityLayer,
810
+ children: [
811
+ /* @__PURE__ */ jsx4("defs", { children: areas?.map((area, index) => {
812
+ const color = area.fill || area.stroke || areaColors[index % areaColors.length];
813
+ return /* @__PURE__ */ jsxs4(
814
+ "linearGradient",
815
+ {
816
+ id: `${idPrefix}-gradient-${area.dataKey}`,
817
+ x1: "0",
818
+ y1: "0",
819
+ x2: "0",
820
+ y2: "1",
821
+ children: [
822
+ /* @__PURE__ */ jsx4("stop", { offset: "5%", stopColor: color, stopOpacity: area.fillOpacity ?? 0.8 }),
823
+ /* @__PURE__ */ jsx4("stop", { offset: "95%", stopColor: color, stopOpacity: 0 })
824
+ ]
825
+ },
826
+ `${idPrefix}-gradient-${area.dataKey}`
827
+ );
828
+ }) }),
829
+ gridConfig?.show && /* @__PURE__ */ jsx4(
830
+ CartesianGrid3,
831
+ {
832
+ strokeDasharray: gridConfig.strokeDasharray,
833
+ stroke: colors.text,
834
+ vertical: false
835
+ }
836
+ ),
837
+ xAxisConfig?.show && /* @__PURE__ */ jsx4(
838
+ XAxis3,
839
+ {
840
+ type: xAxisConfig.type || (layout === "vertical" ? "number" : "category"),
841
+ dataKey: layout === "vertical" ? void 0 : xAxisDataKey,
842
+ stroke: colors.text,
843
+ domain: xAxisConfig.domain,
844
+ tickCount: xAxisConfig.tickCount,
845
+ interval: xAxisConfig.interval,
846
+ tick: {
847
+ fill: colors.text,
848
+ fontSize: 12
849
+ },
850
+ tickMargin: 8,
851
+ axisLine: { stroke: colors.text },
852
+ tickLine: { stroke: colors.text },
853
+ label: xAxisConfig.name ? {
854
+ value: xAxisConfig.name,
855
+ position: "insideBottom",
856
+ offset: -18,
857
+ fill: colors.text,
858
+ fontSize: 12
859
+ } : void 0
860
+ }
861
+ ),
862
+ yAxisConfig?.show && /* @__PURE__ */ jsx4(
863
+ YAxis3,
864
+ {
865
+ type: yAxisConfig.type || (layout === "vertical" ? "category" : "number"),
866
+ dataKey: layout === "vertical" ? xAxisDataKey : void 0,
867
+ stroke: colors.text,
868
+ domain: yAxisConfig.domain,
869
+ tickCount: yAxisConfig.tickCount,
870
+ interval: yAxisConfig.interval,
871
+ tick: {
872
+ fill: colors.text,
873
+ fontSize: 12
874
+ },
875
+ tickMargin: 8,
876
+ axisLine: { stroke: colors.text },
877
+ tickLine: { stroke: colors.text },
878
+ label: yAxisConfig.name ? {
879
+ value: yAxisConfig.name,
880
+ angle: -90,
881
+ position: "insideLeft",
882
+ offset: 0,
883
+ fill: colors.text,
884
+ fontSize: 12
885
+ } : void 0
886
+ }
887
+ ),
888
+ tooltip?.show !== false && (() => {
889
+ const { contentStyle, itemStyle, labelStyle, show, ...rest } = tooltip || {};
890
+ return /* @__PURE__ */ jsx4(
891
+ Tooltip4,
892
+ {
893
+ ...rest,
894
+ contentStyle: {
895
+ backgroundColor: colors.background,
896
+ border: `1px solid ${colors.text}`,
897
+ borderRadius: theme.shape.borderRadius ?? 8,
898
+ color: colors.text,
899
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
900
+ ...contentStyle
901
+ },
902
+ itemStyle: {
903
+ color: colors.text,
904
+ fontSize: 12,
905
+ ...itemStyle
906
+ },
907
+ labelStyle: {
908
+ color: colors.text,
909
+ fontWeight: 600,
910
+ marginBottom: 4,
911
+ ...labelStyle
912
+ }
913
+ }
914
+ );
915
+ })(),
916
+ legendConfig.show && /* @__PURE__ */ jsx4(
917
+ Legend4,
918
+ {
919
+ align: legendConfig.align,
920
+ verticalAlign: legendConfig.verticalAlign,
921
+ iconType: "circle",
922
+ formatter: (value) => /* @__PURE__ */ jsx4(
923
+ "span",
924
+ {
925
+ style: {
926
+ color: colors.text,
927
+ fontSize: 13,
928
+ fontWeight: 500
929
+ },
930
+ children: value
931
+ }
932
+ ),
933
+ wrapperStyle: { paddingTop: 32 }
934
+ }
935
+ ),
936
+ areas?.map((area, index) => /* @__PURE__ */ jsx4(
937
+ Area,
938
+ {
939
+ dataKey: area.dataKey,
940
+ name: area.name,
941
+ stroke: area.stroke || areaColors[index % areaColors.length],
942
+ fill: `url(#${idPrefix}-gradient-${area.dataKey})`,
943
+ strokeWidth: area.strokeWidth ?? 2,
944
+ strokeDasharray: area.strokeDasharray,
945
+ type: area.type || "monotone",
946
+ stackId: area.stackId,
947
+ hide: area.hide,
948
+ label: area.label,
949
+ dot: area.dot ?? true,
950
+ activeDot: area.activeDot ?? true,
951
+ connectNulls: area.connectNulls,
952
+ unit: area.unit,
953
+ legendType: area.legendType || "line",
954
+ onClick: area.onClick || onClick,
955
+ onMouseDown: area.onMouseDown || onMouseDown,
956
+ onMouseUp: area.onMouseUp || onMouseUp,
957
+ onMouseMove: area.onMouseMove || onMouseMove,
958
+ onMouseOver: area.onMouseOver,
959
+ onMouseOut: area.onMouseOut,
960
+ onMouseEnter: area.onMouseEnter || onMouseEnter,
961
+ onMouseLeave: area.onMouseLeave || onMouseLeave,
962
+ isAnimationActive: area.isAnimationActive ?? isAnimationActive,
963
+ animationDuration: area.animationDuration ?? animationDuration,
964
+ animationBegin: area.animationBegin ?? animationBegin,
965
+ animationEasing: area.animationEasing ?? animationEasing
966
+ },
967
+ `${area.dataKey}-${index}`
968
+ )),
969
+ children
970
+ ]
971
+ }
972
+ ) });
973
+ };
974
+ AreaChart.displayName = "AreaChart";
975
+ var AreaChart_default = AreaChart;
976
+
977
+ // src/components/charts/RadarChart/RadarChart.tsx
978
+ import React5 from "react";
979
+ import { useTheme as useTheme5 } from "@mui/material/styles";
980
+ import { useColorScheme as useColorScheme5 } from "@wso2/oxygen-ui";
981
+ import {
982
+ RadarChart as RechartsRadarChart,
983
+ Radar,
984
+ PolarGrid,
985
+ PolarAngleAxis,
986
+ PolarRadiusAxis,
987
+ RadialBar,
988
+ Tooltip as Tooltip5,
989
+ Legend as Legend5,
990
+ ResponsiveContainer as ResponsiveContainer5
991
+ } from "recharts";
992
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
993
+ var RadarChart = ({
994
+ data,
995
+ radars,
996
+ radialBars,
997
+ angleKey,
998
+ height = 300,
999
+ width = "100%",
1000
+ legend,
1001
+ tooltip,
1002
+ innerRadius = 0,
1003
+ outerRadius = "80%",
1004
+ cx = "50%",
1005
+ cy = "50%",
1006
+ startAngle = 90,
1007
+ endAngle = -270,
1008
+ margin,
1009
+ polarGrid,
1010
+ polarAngleAxis,
1011
+ polarRadiusAxis,
1012
+ syncId,
1013
+ syncMethod,
1014
+ role,
1015
+ title,
1016
+ desc,
1017
+ id,
1018
+ className,
1019
+ style,
1020
+ tabIndex,
1021
+ layout = "centric",
1022
+ stackOffset,
1023
+ reverseStackOrder,
1024
+ barSize,
1025
+ barCategoryGap,
1026
+ barGap,
1027
+ maxBarSize,
1028
+ onClick,
1029
+ onMouseDown,
1030
+ onMouseUp,
1031
+ onMouseMove,
1032
+ onMouseEnter,
1033
+ onMouseLeave,
1034
+ onContextMenu,
1035
+ onDoubleClick,
1036
+ accessibilityLayer = true,
1037
+ colors: customColors,
1038
+ children
1039
+ }) => {
1040
+ const theme = useTheme5();
1041
+ const { mode, systemMode } = useColorScheme5();
1042
+ const isDark = mode === "dark" || mode === "system" && systemMode === "dark";
1043
+ const colors = React5.useMemo(() => {
1044
+ const defaultColors = {
1045
+ primary: isDark ? "#F87643" : "#fa7b3f",
1046
+ background: isDark ? "#1e1e1e" : "#f5f5f5",
1047
+ text: isDark ? "#d4d4d4" : "#24292e",
1048
+ comment: isDark ? "#6a9955" : "#6a737d",
1049
+ keyword: isDark ? "#569cd6" : "#d73a49",
1050
+ string: isDark ? "#ce9178" : "#032f62",
1051
+ function: isDark ? "#dcdcaa" : "#6f42c1",
1052
+ number: isDark ? "#b5cea8" : "#005cc5",
1053
+ operator: isDark ? "#d4d4d4" : "#d73a49"
1054
+ };
1055
+ const themeSyntax = isDark ? theme.vars?.syntax?.dark : theme.vars?.syntax?.light;
1056
+ return {
1057
+ ...defaultColors,
1058
+ ...themeSyntax,
1059
+ primary: theme.palette.primary?.main || themeSyntax?.primary || defaultColors.primary
1060
+ };
1061
+ }, [isDark, theme.palette.primary?.main, theme.vars]);
1062
+ const radarColors = React5.useMemo(() => {
1063
+ if (customColors && customColors.length > 0) return customColors;
1064
+ return [
1065
+ colors.primary,
1066
+ colors.keyword,
1067
+ colors.string,
1068
+ colors.function,
1069
+ colors.number,
1070
+ colors.operator
1071
+ ];
1072
+ }, [
1073
+ customColors,
1074
+ colors.primary,
1075
+ colors.keyword,
1076
+ colors.string,
1077
+ colors.function,
1078
+ colors.number,
1079
+ colors.operator
1080
+ ]);
1081
+ const legendConfig = React5.useMemo(
1082
+ () => ({ show: true, align: "center", verticalAlign: "bottom", ...legend }),
1083
+ [legend]
1084
+ );
1085
+ const marginConfig = React5.useMemo(
1086
+ () => ({ top: 20, right: 20, bottom: 20, left: 20, ...margin }),
1087
+ [margin]
1088
+ );
1089
+ const polarGridConfig = React5.useMemo(
1090
+ () => ({ show: true, gridType: "polygon", ...polarGrid }),
1091
+ [polarGrid]
1092
+ );
1093
+ const polarAngleAxisConfig = React5.useMemo(
1094
+ () => ({ show: true, ...polarAngleAxis }),
1095
+ [polarAngleAxis]
1096
+ );
1097
+ const polarRadiusAxisConfig = React5.useMemo(
1098
+ () => ({ show: false, ...polarRadiusAxis }),
1099
+ [polarRadiusAxis]
1100
+ );
1101
+ return /* @__PURE__ */ jsx5(ResponsiveContainer5, { width, height, children: /* @__PURE__ */ jsxs5(
1102
+ RechartsRadarChart,
1103
+ {
1104
+ data,
1105
+ cx,
1106
+ cy,
1107
+ innerRadius,
1108
+ outerRadius,
1109
+ startAngle,
1110
+ endAngle,
1111
+ margin: marginConfig,
1112
+ syncId,
1113
+ syncMethod,
1114
+ role,
1115
+ title,
1116
+ desc,
1117
+ id,
1118
+ className,
1119
+ style,
1120
+ tabIndex,
1121
+ layout,
1122
+ stackOffset,
1123
+ reverseStackOrder,
1124
+ barSize,
1125
+ barCategoryGap,
1126
+ barGap,
1127
+ maxBarSize,
1128
+ onClick,
1129
+ onMouseDown,
1130
+ onMouseUp,
1131
+ onMouseMove,
1132
+ onMouseEnter,
1133
+ onMouseLeave,
1134
+ onContextMenu,
1135
+ onDoubleClick,
1136
+ accessibilityLayer,
1137
+ children: [
1138
+ polarGridConfig?.show && /* @__PURE__ */ jsx5(
1139
+ PolarGrid,
1140
+ {
1141
+ gridType: polarGridConfig.gridType,
1142
+ radialLines: polarGridConfig.radialLines,
1143
+ polarAngles: polarGridConfig.polarAngles,
1144
+ polarRadius: polarGridConfig.polarRadius,
1145
+ stroke: colors.comment,
1146
+ strokeOpacity: 0.3
1147
+ }
1148
+ ),
1149
+ polarAngleAxisConfig?.show && /* @__PURE__ */ jsx5(
1150
+ PolarAngleAxis,
1151
+ {
1152
+ dataKey: polarAngleAxisConfig.dataKey || angleKey,
1153
+ tick: polarAngleAxisConfig.tick ?? { fill: colors.text, fontSize: 12 },
1154
+ axisLine: polarAngleAxisConfig.axisLine ?? { stroke: colors.comment, strokeOpacity: 0.3 },
1155
+ axisLineType: polarAngleAxisConfig.axisLineType,
1156
+ orientation: polarAngleAxisConfig.orientation,
1157
+ ticks: polarAngleAxisConfig.ticks ? polarAngleAxisConfig.ticks.map((tick, index) => ({ ...tick, index })) : void 0
1158
+ }
1159
+ ),
1160
+ polarRadiusAxisConfig?.show && /* @__PURE__ */ jsx5(
1161
+ PolarRadiusAxis,
1162
+ {
1163
+ angle: polarRadiusAxisConfig.angle,
1164
+ domain: polarRadiusAxisConfig.domain,
1165
+ tick: polarRadiusAxisConfig.tick ?? { fill: colors.text, fontSize: 10 },
1166
+ axisLine: polarRadiusAxisConfig.axisLine ?? { stroke: colors.comment, strokeOpacity: 0.3 },
1167
+ orientation: polarRadiusAxisConfig.orientation,
1168
+ reversed: polarRadiusAxisConfig.reversed,
1169
+ ticks: polarRadiusAxisConfig.ticks ? polarRadiusAxisConfig.ticks.map((tick, index) => ({
1170
+ ...tick,
1171
+ index
1172
+ })) : void 0
1173
+ }
1174
+ ),
1175
+ tooltip?.show !== false && (() => {
1176
+ const { contentStyle, itemStyle, labelStyle, show, ...rest } = tooltip || {};
1177
+ return /* @__PURE__ */ jsx5(
1178
+ Tooltip5,
1179
+ {
1180
+ ...rest,
1181
+ contentStyle: {
1182
+ backgroundColor: colors.background,
1183
+ border: `1px solid ${colors.text}`,
1184
+ borderRadius: theme.shape.borderRadius || 8,
1185
+ color: colors.text,
1186
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
1187
+ ...contentStyle
1188
+ },
1189
+ itemStyle: {
1190
+ color: colors.text,
1191
+ fontSize: 12,
1192
+ ...itemStyle
1193
+ },
1194
+ labelStyle: {
1195
+ color: colors.text,
1196
+ fontWeight: 600,
1197
+ marginBottom: 4,
1198
+ ...labelStyle
1199
+ }
1200
+ }
1201
+ );
1202
+ })(),
1203
+ legendConfig.show && /* @__PURE__ */ jsx5(
1204
+ Legend5,
1205
+ {
1206
+ align: legendConfig.align,
1207
+ verticalAlign: legendConfig.verticalAlign,
1208
+ layout: legendConfig.layout,
1209
+ iconType: legendConfig.iconType || "circle",
1210
+ formatter: (value) => /* @__PURE__ */ jsx5("span", { style: { color: colors.text, fontSize: 13, fontWeight: 500 }, children: value }),
1211
+ wrapperStyle: { paddingTop: 20 }
1212
+ }
1213
+ ),
1214
+ radars?.map((radar, index) => /* @__PURE__ */ jsx5(
1215
+ Radar,
1216
+ {
1217
+ name: radar.name,
1218
+ dataKey: radar.dataKey,
1219
+ stroke: radar.stroke || radarColors[index % radarColors.length],
1220
+ strokeWidth: radar.strokeWidth ?? 2,
1221
+ strokeDasharray: radar.strokeDasharray,
1222
+ fill: radar.fill || radarColors[index % radarColors.length],
1223
+ fillOpacity: radar.fillOpacity ?? 0.6,
1224
+ hide: radar.hide,
1225
+ label: radar.label,
1226
+ dot: radar.dot ?? true,
1227
+ activeDot: radar.activeDot ?? true,
1228
+ connectNulls: radar.connectNulls,
1229
+ legendType: radar.legendType,
1230
+ tooltipType: radar.tooltipType,
1231
+ onMouseEnter: radar.onMouseEnter,
1232
+ onMouseLeave: radar.onMouseLeave,
1233
+ onClick: radar.onClick,
1234
+ isAnimationActive: radar.isAnimationActive,
1235
+ animationDuration: radar.animationDuration,
1236
+ animationBegin: radar.animationBegin,
1237
+ animationEasing: radar.animationEasing
1238
+ },
1239
+ `${radar.dataKey}-${index}`
1240
+ )),
1241
+ radialBars?.map((bar, index) => /* @__PURE__ */ jsx5(
1242
+ RadialBar,
1243
+ {
1244
+ name: bar.name,
1245
+ dataKey: bar.dataKey,
1246
+ fill: bar.fill || radarColors[index % radarColors.length],
1247
+ background: bar.background,
1248
+ cornerRadius: bar.cornerRadius,
1249
+ minPointSize: bar.minPointSize,
1250
+ maxBarSize: bar.maxBarSize,
1251
+ hide: bar.hide,
1252
+ label: bar.label,
1253
+ stackId: bar.stackId,
1254
+ isAnimationActive: bar.isAnimationActive,
1255
+ animationDuration: bar.animationDuration,
1256
+ animationBegin: bar.animationBegin,
1257
+ animationEasing: bar.animationEasing,
1258
+ onClick: bar.onClick,
1259
+ onMouseEnter: bar.onMouseEnter,
1260
+ onMouseLeave: bar.onMouseLeave
1261
+ },
1262
+ `${bar.dataKey}-${index}`
1263
+ )),
1264
+ children
1265
+ ]
1266
+ }
1267
+ ) });
1268
+ };
1269
+ RadarChart.displayName = "RadarChart";
1270
+ var RadarChart_default = RadarChart;
1271
+
1272
+ // src/components/charts/RadialBarChart/RadialBarChart.tsx
1273
+ import React6 from "react";
1274
+ import { useTheme as useTheme6 } from "@mui/material/styles";
1275
+ import { useColorScheme as useColorScheme6 } from "@wso2/oxygen-ui";
1276
+ import {
1277
+ RadialBarChart as RechartsRadialBarChart,
1278
+ RadialBar as RadialBar2,
1279
+ PolarGrid as PolarGrid2,
1280
+ PolarAngleAxis as PolarAngleAxis2,
1281
+ PolarRadiusAxis as PolarRadiusAxis2,
1282
+ Tooltip as Tooltip6,
1283
+ Legend as Legend6,
1284
+ ResponsiveContainer as ResponsiveContainer6
1285
+ } from "recharts";
1286
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1287
+ var RadialBarChart = ({
1288
+ data,
1289
+ radialBars,
1290
+ height = 300,
1291
+ width = "100%",
1292
+ legend,
1293
+ tooltip,
1294
+ innerRadius = 0,
1295
+ outerRadius = "80%",
1296
+ cx = "50%",
1297
+ cy = "50%",
1298
+ startAngle = 0,
1299
+ endAngle = 360,
1300
+ margin,
1301
+ barSize,
1302
+ barCategoryGap,
1303
+ barGap,
1304
+ maxBarSize,
1305
+ polarGrid,
1306
+ polarAngleAxis,
1307
+ polarRadiusAxis,
1308
+ syncId,
1309
+ syncMethod,
1310
+ role,
1311
+ title,
1312
+ desc,
1313
+ id,
1314
+ className,
1315
+ style,
1316
+ tabIndex,
1317
+ stackOffset,
1318
+ reverseStackOrder,
1319
+ onClick,
1320
+ onMouseDown,
1321
+ onMouseUp,
1322
+ onMouseMove,
1323
+ onMouseEnter,
1324
+ onMouseLeave,
1325
+ onContextMenu,
1326
+ onDoubleClick,
1327
+ accessibilityLayer = true,
1328
+ colors: customColors,
1329
+ children
1330
+ }) => {
1331
+ const theme = useTheme6();
1332
+ const { mode, systemMode } = useColorScheme6();
1333
+ const isDark = mode === "dark" || mode === "system" && systemMode === "dark";
1334
+ const colors = React6.useMemo(() => {
1335
+ const defaultColors = {
1336
+ primary: isDark ? "#F87643" : "#fa7b3f",
1337
+ background: isDark ? "#1e1e1e" : "#f5f5f5",
1338
+ text: isDark ? "#d4d4d4" : "#24292e",
1339
+ comment: isDark ? "#6a9955" : "#6a737d",
1340
+ keyword: isDark ? "#569cd6" : "#d73a49",
1341
+ string: isDark ? "#ce9178" : "#032f62",
1342
+ function: isDark ? "#dcdcaa" : "#6f42c1",
1343
+ number: isDark ? "#b5cea8" : "#005cc5",
1344
+ operator: isDark ? "#d4d4d4" : "#d73a49"
1345
+ };
1346
+ const themeSyntax = isDark ? theme.vars?.syntax?.dark : theme.vars?.syntax?.light;
1347
+ return {
1348
+ ...defaultColors,
1349
+ ...themeSyntax,
1350
+ primary: theme.palette.primary?.main || themeSyntax?.primary || defaultColors.primary
1351
+ };
1352
+ }, [isDark, theme.palette.primary?.main, theme.vars]);
1353
+ const barColors = React6.useMemo(() => {
1354
+ if (customColors && customColors.length > 0) return customColors;
1355
+ return [
1356
+ colors.primary,
1357
+ colors.keyword,
1358
+ colors.string,
1359
+ colors.function,
1360
+ colors.number,
1361
+ colors.operator
1362
+ ];
1363
+ }, [
1364
+ customColors,
1365
+ colors.primary,
1366
+ colors.keyword,
1367
+ colors.string,
1368
+ colors.function,
1369
+ colors.number,
1370
+ colors.operator
1371
+ ]);
1372
+ const legendConfig = React6.useMemo(
1373
+ () => ({ show: true, align: "center", verticalAlign: "bottom", ...legend }),
1374
+ [legend]
1375
+ );
1376
+ const marginConfig = React6.useMemo(
1377
+ () => ({ top: 20, right: 20, bottom: 20, left: 20, ...margin }),
1378
+ [margin]
1379
+ );
1380
+ const polarGridConfig = React6.useMemo(() => ({ show: false, ...polarGrid }), [polarGrid]);
1381
+ const polarAngleAxisConfig = React6.useMemo(
1382
+ () => ({ show: false, ...polarAngleAxis }),
1383
+ [polarAngleAxis]
1384
+ );
1385
+ const polarRadiusAxisConfig = React6.useMemo(
1386
+ () => ({ show: false, ...polarRadiusAxis }),
1387
+ [polarRadiusAxis]
1388
+ );
1389
+ return /* @__PURE__ */ jsx6(ResponsiveContainer6, { width, height, children: /* @__PURE__ */ jsxs6(
1390
+ RechartsRadialBarChart,
1391
+ {
1392
+ data,
1393
+ cx,
1394
+ cy,
1395
+ innerRadius,
1396
+ outerRadius,
1397
+ startAngle,
1398
+ endAngle,
1399
+ margin: marginConfig,
1400
+ barSize,
1401
+ barCategoryGap,
1402
+ barGap,
1403
+ maxBarSize,
1404
+ syncId,
1405
+ syncMethod,
1406
+ role,
1407
+ title,
1408
+ desc,
1409
+ id,
1410
+ className,
1411
+ style,
1412
+ tabIndex,
1413
+ stackOffset,
1414
+ reverseStackOrder,
1415
+ onClick,
1416
+ onMouseDown,
1417
+ onMouseUp,
1418
+ onMouseMove,
1419
+ onMouseEnter,
1420
+ onMouseLeave,
1421
+ onContextMenu,
1422
+ onDoubleClick,
1423
+ accessibilityLayer,
1424
+ children: [
1425
+ polarGridConfig?.show && /* @__PURE__ */ jsx6(
1426
+ PolarGrid2,
1427
+ {
1428
+ gridType: polarGridConfig.gridType,
1429
+ radialLines: polarGridConfig.radialLines,
1430
+ polarAngles: polarGridConfig.polarAngles,
1431
+ polarRadius: polarGridConfig.polarRadius,
1432
+ stroke: colors.comment,
1433
+ strokeOpacity: 0.3
1434
+ }
1435
+ ),
1436
+ polarAngleAxisConfig?.show && /* @__PURE__ */ jsx6(
1437
+ PolarAngleAxis2,
1438
+ {
1439
+ dataKey: polarAngleAxisConfig.dataKey,
1440
+ tick: polarAngleAxisConfig.tick ?? { fill: colors.text, fontSize: 12 },
1441
+ axisLine: polarAngleAxisConfig.axisLine ?? { stroke: colors.comment, strokeOpacity: 0.3 },
1442
+ axisLineType: polarAngleAxisConfig.axisLineType,
1443
+ orientation: polarAngleAxisConfig.orientation,
1444
+ ticks: polarAngleAxisConfig.ticks ? polarAngleAxisConfig.ticks.map((tick, index) => {
1445
+ if (typeof tick === "object" && tick !== null) {
1446
+ return { ...tick, index };
1447
+ }
1448
+ return tick;
1449
+ }) : void 0
1450
+ }
1451
+ ),
1452
+ polarRadiusAxisConfig?.show && /* @__PURE__ */ jsx6(
1453
+ PolarRadiusAxis2,
1454
+ {
1455
+ angle: polarRadiusAxisConfig.angle,
1456
+ domain: polarRadiusAxisConfig.domain,
1457
+ tick: polarRadiusAxisConfig.tick ?? { fill: colors.text, fontSize: 10 },
1458
+ axisLine: polarRadiusAxisConfig.axisLine ?? { stroke: colors.comment, strokeOpacity: 0.3 },
1459
+ orientation: polarRadiusAxisConfig.orientation,
1460
+ reversed: polarRadiusAxisConfig.reversed,
1461
+ ticks: polarRadiusAxisConfig.ticks ? polarRadiusAxisConfig.ticks.map((tick, index) => {
1462
+ if (typeof tick === "object" && tick !== null) {
1463
+ return { ...tick, index };
1464
+ }
1465
+ return tick;
1466
+ }) : void 0
1467
+ }
1468
+ ),
1469
+ tooltip?.show !== false && (() => {
1470
+ const { contentStyle, itemStyle, labelStyle, show, ...rest } = tooltip || {};
1471
+ return /* @__PURE__ */ jsx6(
1472
+ Tooltip6,
1473
+ {
1474
+ ...rest,
1475
+ contentStyle: {
1476
+ backgroundColor: colors.background,
1477
+ border: `1px solid ${colors.text}`,
1478
+ borderRadius: theme.shape.borderRadius ?? 8,
1479
+ color: colors.text,
1480
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
1481
+ ...contentStyle
1482
+ },
1483
+ itemStyle: {
1484
+ color: colors.text,
1485
+ fontSize: 12,
1486
+ ...itemStyle
1487
+ },
1488
+ labelStyle: {
1489
+ color: colors.text,
1490
+ fontWeight: 600,
1491
+ marginBottom: 4,
1492
+ ...labelStyle
1493
+ }
1494
+ }
1495
+ );
1496
+ })(),
1497
+ legendConfig.show && /* @__PURE__ */ jsx6(
1498
+ Legend6,
1499
+ {
1500
+ align: legendConfig.align,
1501
+ verticalAlign: legendConfig.verticalAlign,
1502
+ layout: legendConfig.layout,
1503
+ iconType: legendConfig.iconType || "circle",
1504
+ formatter: (value) => /* @__PURE__ */ jsx6("span", { style: { color: colors.text, fontSize: 13, fontWeight: 500 }, children: value }),
1505
+ wrapperStyle: { paddingTop: 20 }
1506
+ }
1507
+ ),
1508
+ radialBars?.map((bar, index) => /* @__PURE__ */ jsx6(
1509
+ RadialBar2,
1510
+ {
1511
+ name: bar.name,
1512
+ dataKey: bar.dataKey,
1513
+ fill: bar.fill || barColors[index % barColors.length],
1514
+ background: bar.background ?? { fill: colors.comment, opacity: 0.1 },
1515
+ cornerRadius: bar.cornerRadius,
1516
+ minPointSize: bar.minPointSize,
1517
+ maxBarSize: bar.maxBarSize,
1518
+ hide: bar.hide,
1519
+ label: bar.label,
1520
+ stackId: bar.stackId,
1521
+ legendType: bar.legendType,
1522
+ tooltipType: bar.tooltipType,
1523
+ isAnimationActive: bar.isAnimationActive,
1524
+ animationDuration: bar.animationDuration,
1525
+ animationBegin: bar.animationBegin,
1526
+ animationEasing: bar.animationEasing,
1527
+ onClick: bar.onClick,
1528
+ onMouseDown: bar.onMouseDown,
1529
+ onMouseUp: bar.onMouseUp,
1530
+ onMouseMove: bar.onMouseMove,
1531
+ onMouseOver: bar.onMouseOver,
1532
+ onMouseOut: bar.onMouseOut,
1533
+ onMouseEnter: bar.onMouseEnter,
1534
+ onMouseLeave: bar.onMouseLeave,
1535
+ onAnimationStart: bar.onAnimationStart,
1536
+ onAnimationEnd: bar.onAnimationEnd
1537
+ },
1538
+ `${bar.dataKey}-${index}`
1539
+ )),
1540
+ children
1541
+ ]
1542
+ }
1543
+ ) });
1544
+ };
1545
+ RadialBarChart.displayName = "RadialBarChart";
1546
+ var RadialBarChart_default = RadialBarChart;
1547
+
1548
+ // src/index.ts
1549
+ import {
1550
+ XAxis as XAxis4,
1551
+ YAxis as YAxis4,
1552
+ Bar as Bar2,
1553
+ Line as Line2,
1554
+ Area as Area2,
1555
+ Radar as Radar2,
1556
+ PolarGrid as PolarGrid3,
1557
+ PolarAngleAxis as PolarAngleAxis3,
1558
+ PolarRadiusAxis as PolarRadiusAxis3,
1559
+ CartesianGrid as CartesianGrid4,
1560
+ Tooltip as Tooltip7,
1561
+ Legend as Legend7,
1562
+ ResponsiveContainer as ResponsiveContainer7,
1563
+ Pie as Pie2,
1564
+ RadialBar as RadialBar3,
1565
+ Scatter,
1566
+ ZAxis,
1567
+ Cell as Cell2,
1568
+ Label,
1569
+ LabelList
1570
+ } from "recharts";
1571
+ export {
1572
+ Area2 as Area,
1573
+ AreaChart_default as AreaChart,
1574
+ Bar2 as Bar,
1575
+ BarChart_default as BarChart,
1576
+ CartesianGrid4 as CartesianGrid,
1577
+ Cell2 as Cell,
1578
+ Tooltip7 as ChartTooltip,
1579
+ Label,
1580
+ LabelList,
1581
+ Legend7 as Legend,
1582
+ Line2 as Line,
1583
+ LineChart_default as LineChart,
1584
+ Pie2 as Pie,
1585
+ PieChart_default as PieChart,
1586
+ PolarAngleAxis3 as PolarAngleAxis,
1587
+ PolarGrid3 as PolarGrid,
1588
+ PolarRadiusAxis3 as PolarRadiusAxis,
1589
+ Radar2 as Radar,
1590
+ RadarChart_default as RadarChart,
1591
+ RadialBar3 as RadialBar,
1592
+ RadialBarChart_default as RadialBarChart,
1593
+ ResponsiveContainer7 as ResponsiveContainer,
1594
+ Scatter,
1595
+ XAxis4 as XAxis,
1596
+ YAxis4 as YAxis,
1597
+ ZAxis
1598
+ };
1599
+ //# sourceMappingURL=index.js.map