@yamada-ui/charts 1.5.0-dev-20240825095648 → 1.5.0-dev-20240825115929
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/area-chart-split.js +4 -2
- package/dist/area-chart-split.js.map +1 -1
- package/dist/area-chart-split.mjs +1 -1
- package/dist/area-chart.d.mts +0 -1
- package/dist/area-chart.d.ts +0 -1
- package/dist/area-chart.js +56 -48
- package/dist/area-chart.js.map +1 -1
- package/dist/area-chart.mjs +12 -12
- package/dist/bar-chart.d.mts +0 -1
- package/dist/bar-chart.d.ts +0 -1
- package/dist/bar-chart.js +13 -7
- package/dist/bar-chart.js.map +1 -1
- package/dist/bar-chart.mjs +11 -11
- package/dist/chart-legend.mjs +3 -3
- package/dist/chart-tooltip.d.mts +3 -1
- package/dist/chart-tooltip.d.ts +3 -1
- package/dist/chart-tooltip.js +9 -1
- package/dist/chart-tooltip.js.map +1 -1
- package/dist/chart-tooltip.mjs +3 -3
- package/dist/chart.types.d.mts +9 -4
- package/dist/chart.types.d.ts +9 -4
- package/dist/chart.types.js.map +1 -1
- package/dist/{chunk-STBYN5JW.mjs → chunk-3AOICU4Q.mjs} +2 -2
- package/dist/chunk-3HQ2UC3I.mjs +45 -0
- package/dist/chunk-3HQ2UC3I.mjs.map +1 -0
- package/dist/{chunk-FIWHBTKQ.mjs → chunk-6IEXTVWL.mjs} +7 -9
- package/dist/chunk-6IEXTVWL.mjs.map +1 -0
- package/dist/{chunk-F34FV5DY.mjs → chunk-6YUJLLGN.mjs} +59 -3
- package/dist/chunk-6YUJLLGN.mjs.map +1 -0
- package/dist/{chunk-LHW3WK3C.mjs → chunk-AJYZ7MDC.mjs} +6 -30
- package/dist/chunk-AJYZ7MDC.mjs.map +1 -0
- package/dist/chunk-D5IRVU4W.mjs +46 -0
- package/dist/chunk-D5IRVU4W.mjs.map +1 -0
- package/dist/{chunk-DGOXJ373.mjs → chunk-EL2VTGFB.mjs} +2 -2
- package/dist/chunk-EL6SJYI5.mjs +200 -0
- package/dist/chunk-EL6SJYI5.mjs.map +1 -0
- package/dist/{chunk-LF3ENX7Z.mjs → chunk-FQTDUZK2.mjs} +16 -11
- package/dist/chunk-FQTDUZK2.mjs.map +1 -0
- package/dist/{chunk-Q7CCSKX3.mjs → chunk-JTQ5QCML.mjs} +4 -4
- package/dist/chunk-JTQ5QCML.mjs.map +1 -0
- package/dist/{chunk-7HKRIEAT.mjs → chunk-KBZKJSZJ.mjs} +10 -10
- package/dist/{chunk-5XSML5U3.mjs → chunk-KVE6VXTJ.mjs} +2 -2
- package/dist/{chunk-PNE3JG54.mjs → chunk-MGTMKKSH.mjs} +5 -3
- package/dist/chunk-MGTMKKSH.mjs.map +1 -0
- package/dist/chunk-NUAKNL26.mjs +155 -0
- package/dist/chunk-NUAKNL26.mjs.map +1 -0
- package/dist/{chunk-QNX4DJVS.mjs → chunk-OOSVO2GS.mjs} +12 -12
- package/dist/{chunk-WY5PI2CR.mjs → chunk-PBPH3WDW.mjs} +12 -12
- package/dist/{chunk-D7EZKGCJ.mjs → chunk-PPBHLDVN.mjs} +2 -2
- package/dist/{chunk-IF4O4CBA.mjs → chunk-PSPBUPC7.mjs} +9 -7
- package/dist/chunk-PSPBUPC7.mjs.map +1 -0
- package/dist/{chunk-DKZISSE6.mjs → chunk-S6C5VMIZ.mjs} +13 -13
- package/dist/{chunk-MT5JI4OR.mjs → chunk-T5DNDBW6.mjs} +11 -3
- package/dist/chunk-T5DNDBW6.mjs.map +1 -0
- package/dist/{chunk-5Q6O726L.mjs → chunk-TCSYDMC7.mjs} +2 -2
- package/dist/{chunk-6ICKO7GY.mjs → chunk-TQRELNDO.mjs} +6 -8
- package/dist/chunk-TQRELNDO.mjs.map +1 -0
- package/dist/{chunk-AOGTJ4EN.mjs → chunk-VMBRDEM2.mjs} +2 -2
- package/dist/{chunk-BNTTQQFO.mjs → chunk-VMKJ4Z46.mjs} +9 -9
- package/dist/chunk-VMKJ4Z46.mjs.map +1 -0
- package/dist/{chunk-WPJDHMPD.mjs → chunk-YASR4L6D.mjs} +10 -12
- package/dist/chunk-YASR4L6D.mjs.map +1 -0
- package/dist/{chunk-VK4VQQYY.mjs → chunk-YNJ423BR.mjs} +2 -2
- package/dist/donut-chart.d.mts +0 -1
- package/dist/donut-chart.d.ts +0 -1
- package/dist/donut-chart.js +12 -5
- package/dist/donut-chart.js.map +1 -1
- package/dist/donut-chart.mjs +9 -9
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +563 -160
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -23
- package/dist/index.mjs.map +1 -1
- package/dist/line-chart.d.mts +0 -1
- package/dist/line-chart.d.ts +0 -1
- package/dist/line-chart.js +14 -8
- package/dist/line-chart.js.map +1 -1
- package/dist/line-chart.mjs +11 -11
- package/dist/pie-chart.d.mts +1 -2
- package/dist/pie-chart.d.ts +1 -2
- package/dist/pie-chart.js +12 -5
- package/dist/pie-chart.js.map +1 -1
- package/dist/pie-chart.mjs +8 -8
- package/dist/radar-chart.d.mts +2 -2
- package/dist/radar-chart.d.ts +2 -2
- package/dist/radar-chart.js +89 -68
- package/dist/radar-chart.js.map +1 -1
- package/dist/radar-chart.mjs +9 -8
- package/dist/radial-chart.d.mts +53 -0
- package/dist/radial-chart.d.ts +53 -0
- package/dist/radial-chart.js +768 -0
- package/dist/radial-chart.js.map +1 -0
- package/dist/radial-chart.mjs +18 -0
- package/dist/radial-chart.mjs.map +1 -0
- package/dist/rechart-properties.d.mts +5 -1
- package/dist/rechart-properties.d.ts +5 -1
- package/dist/rechart-properties.js +60 -1
- package/dist/rechart-properties.js.map +1 -1
- package/dist/rechart-properties.mjs +7 -1
- package/dist/use-area-chart.d.mts +0 -1
- package/dist/use-area-chart.d.ts +0 -1
- package/dist/use-area-chart.js +7 -9
- package/dist/use-area-chart.js.map +1 -1
- package/dist/use-area-chart.mjs +2 -2
- package/dist/use-bar-chart.d.mts +0 -1
- package/dist/use-bar-chart.d.ts +0 -1
- package/dist/use-bar-chart.js +3 -5
- package/dist/use-bar-chart.js.map +1 -1
- package/dist/use-bar-chart.mjs +2 -2
- package/dist/use-chart-axis.d.mts +0 -1
- package/dist/use-chart-axis.d.ts +0 -1
- package/dist/use-chart-axis.js.map +1 -1
- package/dist/use-chart-axis.mjs +2 -2
- package/dist/use-chart-grid.d.mts +0 -1
- package/dist/use-chart-grid.d.ts +0 -1
- package/dist/use-chart-grid.js.map +1 -1
- package/dist/use-chart-grid.mjs +2 -2
- package/dist/use-chart-label-list.d.mts +22 -0
- package/dist/use-chart-label-list.d.ts +22 -0
- package/dist/use-chart-label-list.js +93 -0
- package/dist/use-chart-label-list.js.map +1 -0
- package/dist/use-chart-label-list.mjs +10 -0
- package/dist/use-chart-label-list.mjs.map +1 -0
- package/dist/use-chart-label.d.mts +0 -1
- package/dist/use-chart-label.d.ts +0 -1
- package/dist/use-chart-label.js.map +1 -1
- package/dist/use-chart-label.mjs +2 -2
- package/dist/use-chart-legend.d.mts +0 -1
- package/dist/use-chart-legend.d.ts +0 -1
- package/dist/use-chart-legend.js.map +1 -1
- package/dist/use-chart-legend.mjs +2 -2
- package/dist/use-chart-reference-line.d.mts +0 -1
- package/dist/use-chart-reference-line.d.ts +0 -1
- package/dist/use-chart-reference-line.js +1 -1
- package/dist/use-chart-reference-line.js.map +1 -1
- package/dist/use-chart-reference-line.mjs +2 -2
- package/dist/use-chart-tooltip.d.mts +0 -1
- package/dist/use-chart-tooltip.d.ts +0 -1
- package/dist/use-chart-tooltip.js.map +1 -1
- package/dist/use-chart-tooltip.mjs +2 -2
- package/dist/use-chart.d.mts +0 -1
- package/dist/use-chart.d.ts +0 -1
- package/dist/use-chart.js.map +1 -1
- package/dist/use-chart.mjs +2 -2
- package/dist/use-line-chart.d.mts +0 -1
- package/dist/use-line-chart.d.ts +0 -1
- package/dist/use-line-chart.js +4 -6
- package/dist/use-line-chart.js.map +1 -1
- package/dist/use-line-chart.mjs +2 -2
- package/dist/use-pie-chart.d.mts +0 -1
- package/dist/use-pie-chart.d.ts +0 -1
- package/dist/use-pie-chart.js +3 -4
- package/dist/use-pie-chart.js.map +1 -1
- package/dist/use-pie-chart.mjs +2 -2
- package/dist/use-polar-grid.d.mts +24 -0
- package/dist/use-polar-grid.d.ts +24 -0
- package/dist/use-polar-grid.js +90 -0
- package/dist/use-polar-grid.js.map +1 -0
- package/dist/use-polar-grid.mjs +10 -0
- package/dist/use-polar-grid.mjs.map +1 -0
- package/dist/use-radar-chart.d.mts +2 -12
- package/dist/use-radar-chart.d.ts +2 -12
- package/dist/use-radar-chart.js +3 -35
- package/dist/use-radar-chart.js.map +1 -1
- package/dist/use-radar-chart.mjs +2 -2
- package/dist/use-radial-chart.d.mts +80 -0
- package/dist/use-radial-chart.d.ts +80 -0
- package/dist/use-radial-chart.js +228 -0
- package/dist/use-radial-chart.js.map +1 -0
- package/dist/use-radial-chart.mjs +10 -0
- package/dist/use-radial-chart.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/chunk-6ICKO7GY.mjs.map +0 -1
- package/dist/chunk-BNTTQQFO.mjs.map +0 -1
- package/dist/chunk-F34FV5DY.mjs.map +0 -1
- package/dist/chunk-FIWHBTKQ.mjs.map +0 -1
- package/dist/chunk-IF4O4CBA.mjs.map +0 -1
- package/dist/chunk-LF3ENX7Z.mjs.map +0 -1
- package/dist/chunk-LHW3WK3C.mjs.map +0 -1
- package/dist/chunk-MT5JI4OR.mjs.map +0 -1
- package/dist/chunk-PNE3JG54.mjs.map +0 -1
- package/dist/chunk-Q7CCSKX3.mjs.map +0 -1
- package/dist/chunk-WPJDHMPD.mjs.map +0 -1
- /package/dist/{chunk-STBYN5JW.mjs.map → chunk-3AOICU4Q.mjs.map} +0 -0
- /package/dist/{chunk-DGOXJ373.mjs.map → chunk-EL2VTGFB.mjs.map} +0 -0
- /package/dist/{chunk-7HKRIEAT.mjs.map → chunk-KBZKJSZJ.mjs.map} +0 -0
- /package/dist/{chunk-5XSML5U3.mjs.map → chunk-KVE6VXTJ.mjs.map} +0 -0
- /package/dist/{chunk-QNX4DJVS.mjs.map → chunk-OOSVO2GS.mjs.map} +0 -0
- /package/dist/{chunk-WY5PI2CR.mjs.map → chunk-PBPH3WDW.mjs.map} +0 -0
- /package/dist/{chunk-D7EZKGCJ.mjs.map → chunk-PPBHLDVN.mjs.map} +0 -0
- /package/dist/{chunk-DKZISSE6.mjs.map → chunk-S6C5VMIZ.mjs.map} +0 -0
- /package/dist/{chunk-5Q6O726L.mjs.map → chunk-TCSYDMC7.mjs.map} +0 -0
- /package/dist/{chunk-AOGTJ4EN.mjs.map → chunk-VMBRDEM2.mjs.map} +0 -0
- /package/dist/{chunk-VK4VQQYY.mjs.map → chunk-YNJ423BR.mjs.map} +0 -0
package/dist/index.js
CHANGED
@@ -23,11 +23,12 @@ var src_exports = {};
|
|
23
23
|
__export(src_exports, {
|
24
24
|
AreaChart: () => AreaChart,
|
25
25
|
BarChart: () => BarChart,
|
26
|
-
ChartCell: () =>
|
26
|
+
ChartCell: () => import_recharts9.Cell,
|
27
27
|
DonutChart: () => DonutChart,
|
28
28
|
LineChart: () => LineChart,
|
29
29
|
PieChart: () => PieChart,
|
30
|
-
RadarChart: () => RadarChart
|
30
|
+
RadarChart: () => RadarChart,
|
31
|
+
RadialChart: () => RadialChart
|
31
32
|
});
|
32
33
|
module.exports = __toCommonJS(src_exports);
|
33
34
|
|
@@ -122,6 +123,24 @@ var radarChartProperties = [
|
|
122
123
|
"onClick"
|
123
124
|
];
|
124
125
|
var pieChartProperties = ["width", "height", "margin", "onClick", "onMouseEnter", "onMouseLeave"];
|
126
|
+
var radialChartProperties = [
|
127
|
+
"width",
|
128
|
+
"height",
|
129
|
+
"data",
|
130
|
+
"margin",
|
131
|
+
"barCategoryGap",
|
132
|
+
"barGap",
|
133
|
+
"cx",
|
134
|
+
"cy",
|
135
|
+
"startAngle",
|
136
|
+
"endAngle",
|
137
|
+
"innerRadius",
|
138
|
+
"outerRadius",
|
139
|
+
"barSize",
|
140
|
+
"onMouseEnter",
|
141
|
+
"onMouseLeave",
|
142
|
+
"onClick"
|
143
|
+
];
|
125
144
|
var referenceLineProperties = [
|
126
145
|
"xAxisId",
|
127
146
|
"yAxisId",
|
@@ -436,6 +455,28 @@ var pieProperties = [
|
|
436
455
|
"onMouseEnter",
|
437
456
|
"onMouseLeave"
|
438
457
|
];
|
458
|
+
var radialBarProperties = [
|
459
|
+
"legendType",
|
460
|
+
"label",
|
461
|
+
"background",
|
462
|
+
"data",
|
463
|
+
"dataKey",
|
464
|
+
"isAnimationActive",
|
465
|
+
"animationBegin",
|
466
|
+
"animationDuration",
|
467
|
+
"animationEasing",
|
468
|
+
"onAnimationStart",
|
469
|
+
"onAnimationEnd",
|
470
|
+
"onClick",
|
471
|
+
"onMouseDown",
|
472
|
+
"onMouseUp",
|
473
|
+
"onMouseMove",
|
474
|
+
"onMouseOver",
|
475
|
+
"onMouseOut",
|
476
|
+
"onMouseEnter",
|
477
|
+
"onMouseLeave",
|
478
|
+
"cornerRadius"
|
479
|
+
];
|
439
480
|
var dotProperties = [
|
440
481
|
"cx",
|
441
482
|
"cy",
|
@@ -456,7 +497,8 @@ var polarGridProperties = [
|
|
456
497
|
"outerRadius",
|
457
498
|
"polarAngles",
|
458
499
|
"polarRadius",
|
459
|
-
"gridType"
|
500
|
+
"gridType",
|
501
|
+
"radialLines"
|
460
502
|
];
|
461
503
|
var polarAngleAxisProperties = [
|
462
504
|
"dataKey",
|
@@ -517,6 +559,18 @@ var labelProperties = [
|
|
517
559
|
"content",
|
518
560
|
"id"
|
519
561
|
];
|
562
|
+
var labelListProperties = [
|
563
|
+
"dataKey",
|
564
|
+
"valueAccessor",
|
565
|
+
"content",
|
566
|
+
"position",
|
567
|
+
"offset",
|
568
|
+
"formatter",
|
569
|
+
"data",
|
570
|
+
"clockWise",
|
571
|
+
"id",
|
572
|
+
"position"
|
573
|
+
];
|
520
574
|
|
521
575
|
// src/use-chart.ts
|
522
576
|
var [ChartProvider, useChartContext] = (0, import_utils2.createContext)({
|
@@ -604,18 +658,26 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
604
658
|
var ChartTooltip = (0, import_core4.forwardRef)(
|
605
659
|
({
|
606
660
|
label,
|
661
|
+
dataKey = "value",
|
607
662
|
className,
|
608
663
|
payload = [],
|
609
664
|
valueFormatter,
|
610
665
|
labelFormatter,
|
611
666
|
unit,
|
667
|
+
isRadialChart,
|
612
668
|
...rest
|
613
669
|
}, ref) => {
|
614
670
|
var _a;
|
615
671
|
const { styles } = useTooltip();
|
616
672
|
const items = payload.map(
|
617
|
-
({
|
673
|
+
({
|
674
|
+
color: colorProp,
|
675
|
+
name: nameProp,
|
676
|
+
[dataKey]: valueProp,
|
677
|
+
payload: payload2
|
678
|
+
} = {}, index) => {
|
618
679
|
var _a2;
|
680
|
+
const name = isRadialChart ? payload2 == null ? void 0 : payload2.name : nameProp;
|
619
681
|
const color = colorProp != null ? colorProp : payload2 == null ? void 0 : payload2.color;
|
620
682
|
let value;
|
621
683
|
if ((0, import_utils4.isArray)(valueProp)) {
|
@@ -892,7 +954,7 @@ var useChartReferenceLine = ({
|
|
892
954
|
[props, referenceLineProperties],
|
893
955
|
styleClassName
|
894
956
|
)(theme);
|
895
|
-
const color = `
|
957
|
+
const color = (0, import_core7.getVar)(`reference-line-${index}`)(theme);
|
896
958
|
const label = {
|
897
959
|
value: labelProp,
|
898
960
|
fill: color,
|
@@ -989,7 +1051,6 @@ var useLineChart = ({
|
|
989
1051
|
} = (_a = rest.lineProps) != null ? _a : {};
|
990
1052
|
const lineColors = (0, import_react7.useMemo)(
|
991
1053
|
() => series.map(({ color }, index) => ({
|
992
|
-
__prefix: "ui",
|
993
1054
|
name: `line-${index}`,
|
994
1055
|
token: "colors",
|
995
1056
|
value: color != null ? color : "transparent"
|
@@ -998,7 +1059,6 @@ var useLineChart = ({
|
|
998
1059
|
);
|
999
1060
|
const referenceLineColors = (0, import_react7.useMemo)(
|
1000
1061
|
() => referenceLineProps ? referenceLineProps.map(({ color }, index) => ({
|
1001
|
-
__prefix: "ui",
|
1002
1062
|
name: `reference-line-${index}`,
|
1003
1063
|
token: "colors",
|
1004
1064
|
value: color != null ? color : "transparent"
|
@@ -1009,7 +1069,7 @@ var useLineChart = ({
|
|
1009
1069
|
() => [
|
1010
1070
|
...lineColors,
|
1011
1071
|
...referenceLineColors,
|
1012
|
-
{
|
1072
|
+
{ name: "fill-opacity", value: fillOpacity }
|
1013
1073
|
],
|
1014
1074
|
[fillOpacity, lineColors, referenceLineColors]
|
1015
1075
|
);
|
@@ -1025,8 +1085,8 @@ var useLineChart = ({
|
|
1025
1085
|
);
|
1026
1086
|
const [lineProps, lineClassName] = (0, import_react7.useMemo)(() => {
|
1027
1087
|
const resolvedLineProps = {
|
1028
|
-
fillOpacity: "
|
1029
|
-
strokeOpacity: "
|
1088
|
+
fillOpacity: "$fill-opacity",
|
1089
|
+
strokeOpacity: "$fill-opacity",
|
1030
1090
|
...computedLineProps
|
1031
1091
|
};
|
1032
1092
|
return getComponentProps(
|
@@ -1074,7 +1134,7 @@ var useLineChart = ({
|
|
1074
1134
|
dimLine: dimLine2 = {},
|
1075
1135
|
...computedProps
|
1076
1136
|
} = props;
|
1077
|
-
const color = `
|
1137
|
+
const color = (0, import_core9.getVar)(`line-${index}`)(theme);
|
1078
1138
|
const dimmed = shouldHighlight && highlightedArea !== dataKey;
|
1079
1139
|
const computedDimLine = { ...dimLineProps, ...dimLine2 };
|
1080
1140
|
const resolvedProps = {
|
@@ -1460,7 +1520,6 @@ var useBarChart = ({
|
|
1460
1520
|
} = (_a = rest.barProps) != null ? _a : {};
|
1461
1521
|
const barColors = (0, import_react9.useMemo)(
|
1462
1522
|
() => series.map(({ color }, index) => ({
|
1463
|
-
__prefix: "ui",
|
1464
1523
|
name: `bar-${index}`,
|
1465
1524
|
token: "colors",
|
1466
1525
|
value: color != null ? color : "transparent"
|
@@ -1469,7 +1528,6 @@ var useBarChart = ({
|
|
1469
1528
|
);
|
1470
1529
|
const referenceLineColors = (0, import_react9.useMemo)(
|
1471
1530
|
() => referenceLineProps.map(({ color }, index) => ({
|
1472
|
-
__prefix: "ui",
|
1473
1531
|
name: `reference-line-${index}`,
|
1474
1532
|
token: "colors",
|
1475
1533
|
value: color != null ? color : "transparent"
|
@@ -1480,7 +1538,7 @@ var useBarChart = ({
|
|
1480
1538
|
return [
|
1481
1539
|
...barColors,
|
1482
1540
|
...referenceLineColors,
|
1483
|
-
{
|
1541
|
+
{ name: "fill-opacity", value: fillOpacity }
|
1484
1542
|
];
|
1485
1543
|
}, [barColors, fillOpacity, referenceLineColors]);
|
1486
1544
|
const [chartProps, barChartClassName] = (0, import_react9.useMemo)(() => {
|
@@ -1492,7 +1550,7 @@ var useBarChart = ({
|
|
1492
1550
|
}, [rest.chartProps, styles.chart, theme]);
|
1493
1551
|
const [barProps, barClassName] = (0, import_react9.useMemo)(() => {
|
1494
1552
|
const resolvedBarProps = {
|
1495
|
-
fillOpacity: "
|
1553
|
+
fillOpacity: "$fill-opacity",
|
1496
1554
|
strokeOpacity: 1,
|
1497
1555
|
...computedBarProps
|
1498
1556
|
};
|
@@ -1531,7 +1589,7 @@ var useBarChart = ({
|
|
1531
1589
|
...computedProps
|
1532
1590
|
} = props;
|
1533
1591
|
const id = `${uuid}-${dataKey}`;
|
1534
|
-
const color = `
|
1592
|
+
const color = (0, import_core11.getVar)(`bar-${index}`)(theme);
|
1535
1593
|
const dimmed = shouldHighlight && highlightedArea !== dataKey;
|
1536
1594
|
const computedDimBar = { ...dimBarProps, ...dimBar2 };
|
1537
1595
|
const resolvedProps = {
|
@@ -1865,7 +1923,7 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1865
1923
|
});
|
1866
1924
|
|
1867
1925
|
// src/area-chart.tsx
|
1868
|
-
var
|
1926
|
+
var import_core15 = require("@yamada-ui/core");
|
1869
1927
|
var import_utils15 = require("@yamada-ui/utils");
|
1870
1928
|
var import_react12 = require("react");
|
1871
1929
|
var import_recharts4 = require("recharts");
|
@@ -1889,14 +1947,16 @@ var AreaGradient = ({
|
|
1889
1947
|
};
|
1890
1948
|
|
1891
1949
|
// src/area-chart-split.tsx
|
1950
|
+
var import_core13 = require("@yamada-ui/core");
|
1892
1951
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
1893
1952
|
var AreaSplit = ({ offset, id, fillOpacity }) => {
|
1953
|
+
const { theme } = (0, import_core13.useTheme)();
|
1894
1954
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
1895
1955
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
1896
1956
|
"stop",
|
1897
1957
|
{
|
1898
1958
|
offset,
|
1899
|
-
stopColor:
|
1959
|
+
stopColor: (0, import_core13.getVar)(`area-split-0`)(theme),
|
1900
1960
|
stopOpacity: fillOpacity != null ? fillOpacity : 0.4
|
1901
1961
|
}
|
1902
1962
|
),
|
@@ -1904,7 +1964,7 @@ var AreaSplit = ({ offset, id, fillOpacity }) => {
|
|
1904
1964
|
"stop",
|
1905
1965
|
{
|
1906
1966
|
offset,
|
1907
|
-
stopColor:
|
1967
|
+
stopColor: (0, import_core13.getVar)(`area-split-1`)(theme),
|
1908
1968
|
stopOpacity: fillOpacity != null ? fillOpacity : 0.4
|
1909
1969
|
}
|
1910
1970
|
)
|
@@ -1912,7 +1972,7 @@ var AreaSplit = ({ offset, id, fillOpacity }) => {
|
|
1912
1972
|
};
|
1913
1973
|
|
1914
1974
|
// src/use-area-chart.ts
|
1915
|
-
var
|
1975
|
+
var import_core14 = require("@yamada-ui/core");
|
1916
1976
|
var import_utils14 = require("@yamada-ui/utils");
|
1917
1977
|
var import_react11 = require("react");
|
1918
1978
|
var useAreaChart = ({
|
@@ -1938,7 +1998,7 @@ var useAreaChart = ({
|
|
1938
1998
|
}) => {
|
1939
1999
|
var _a;
|
1940
2000
|
const uuid = (0, import_react11.useId)();
|
1941
|
-
const { theme } = (0,
|
2001
|
+
const { theme } = (0, import_core14.useTheme)();
|
1942
2002
|
const [highlightedArea, setHighlightedArea] = (0, import_react11.useState)(null);
|
1943
2003
|
const splitId = `${uuid}-split`;
|
1944
2004
|
const stacked = type === "stacked" || type === "percent";
|
@@ -1953,7 +2013,6 @@ var useAreaChart = ({
|
|
1953
2013
|
} = (_a = rest.areaProps) != null ? _a : {};
|
1954
2014
|
const areaColors = (0, import_react11.useMemo)(
|
1955
2015
|
() => series.map(({ color }, index) => ({
|
1956
|
-
__prefix: "ui",
|
1957
2016
|
name: `area-${index}`,
|
1958
2017
|
token: "colors",
|
1959
2018
|
value: color != null ? color : "transparent"
|
@@ -1962,7 +2021,6 @@ var useAreaChart = ({
|
|
1962
2021
|
);
|
1963
2022
|
const areaSplitColors = (0, import_react11.useMemo)(
|
1964
2023
|
() => splitColors.map((color, index) => ({
|
1965
|
-
__prefix: "ui",
|
1966
2024
|
name: `area-split-${index}`,
|
1967
2025
|
token: "colors",
|
1968
2026
|
value: color != null ? color : "transparent"
|
@@ -1971,7 +2029,6 @@ var useAreaChart = ({
|
|
1971
2029
|
);
|
1972
2030
|
const referenceLineColors = (0, import_react11.useMemo)(
|
1973
2031
|
() => referenceLineProps ? referenceLineProps.map(({ color }, index) => ({
|
1974
|
-
__prefix: "ui",
|
1975
2032
|
name: `reference-line-${index}`,
|
1976
2033
|
token: "colors",
|
1977
2034
|
value: color != null ? color : "transparent"
|
@@ -1983,9 +2040,10 @@ var useAreaChart = ({
|
|
1983
2040
|
...areaColors,
|
1984
2041
|
...areaSplitColors,
|
1985
2042
|
...referenceLineColors,
|
1986
|
-
{
|
2043
|
+
{ name: "fill-opacity", value: fillOpacity }
|
1987
2044
|
];
|
1988
2045
|
}, [areaColors, areaSplitColors, referenceLineColors, fillOpacity]);
|
2046
|
+
const fillOpacityVar = (0, import_react11.useMemo)(() => (0, import_core14.getVar)("fill-opacity")(theme), [theme]);
|
1989
2047
|
const [chartProps, areaChartClassName] = (0, import_react11.useMemo)(
|
1990
2048
|
() => {
|
1991
2049
|
var _a2;
|
@@ -2060,7 +2118,7 @@ var useAreaChart = ({
|
|
2060
2118
|
...computedProps
|
2061
2119
|
} = props;
|
2062
2120
|
const id = `${uuid}-${dataKey}`;
|
2063
|
-
const color = `
|
2121
|
+
const color = (0, import_core14.getVar)(`area-${index}`)(theme);
|
2064
2122
|
const dimmed = shouldHighlight && highlightedArea !== dataKey;
|
2065
2123
|
const computedDimArea = { ...dimAreaProps, ...dimArea2 };
|
2066
2124
|
const resolvedProps = {
|
@@ -2172,10 +2230,10 @@ var useAreaChart = ({
|
|
2172
2230
|
(props = {}) => ({
|
2173
2231
|
id: splitId,
|
2174
2232
|
offset: splitOffset != null ? splitOffset : defaultSplitOffset,
|
2175
|
-
fillOpacity:
|
2233
|
+
fillOpacity: fillOpacityVar,
|
2176
2234
|
...props
|
2177
2235
|
}),
|
2178
|
-
[defaultSplitOffset, splitId, splitOffset]
|
2236
|
+
[defaultSplitOffset, splitId, splitOffset, fillOpacityVar]
|
2179
2237
|
);
|
2180
2238
|
const getAreaProps = (0, import_react11.useCallback)(
|
2181
2239
|
({ index, className: classNameProp, ...props }, ref = null) => {
|
@@ -2222,10 +2280,10 @@ var useAreaChart = ({
|
|
2222
2280
|
const getAreaGradientProps = (0, import_react11.useCallback)(
|
2223
2281
|
(props = {}) => ({
|
2224
2282
|
withGradient,
|
2225
|
-
fillOpacity:
|
2283
|
+
fillOpacity: fillOpacityVar,
|
2226
2284
|
...props
|
2227
2285
|
}),
|
2228
|
-
[withGradient]
|
2286
|
+
[withGradient, fillOpacityVar]
|
2229
2287
|
);
|
2230
2288
|
return {
|
2231
2289
|
getAreaChartProps,
|
@@ -2239,8 +2297,8 @@ var useAreaChart = ({
|
|
2239
2297
|
|
2240
2298
|
// src/area-chart.tsx
|
2241
2299
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
2242
|
-
var AreaChart = (0,
|
2243
|
-
const [styles, mergedProps] = (0,
|
2300
|
+
var AreaChart = (0, import_core15.forwardRef)((props, ref) => {
|
2301
|
+
const [styles, mergedProps] = (0, import_core15.useMultiComponentStyle)("AreaChart", props);
|
2244
2302
|
const {
|
2245
2303
|
className,
|
2246
2304
|
series,
|
@@ -2285,7 +2343,7 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2285
2343
|
splitOffset,
|
2286
2344
|
syncId,
|
2287
2345
|
...rest
|
2288
|
-
} = (0,
|
2346
|
+
} = (0, import_core15.omitThemeProps)(mergedProps);
|
2289
2347
|
const {
|
2290
2348
|
getAreaChartProps,
|
2291
2349
|
getAreaSplitProps,
|
@@ -2385,7 +2443,7 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2385
2443
|
[getReferenceLineProps, referenceLineProps]
|
2386
2444
|
);
|
2387
2445
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2388
|
-
|
2446
|
+
import_core15.ui.div,
|
2389
2447
|
{
|
2390
2448
|
ref,
|
2391
2449
|
className: (0, import_utils15.cx)("ui-area-chart", className),
|
@@ -2469,15 +2527,48 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2469
2527
|
});
|
2470
2528
|
|
2471
2529
|
// src/radar-chart.tsx
|
2472
|
-
var
|
2473
|
-
var
|
2474
|
-
var
|
2530
|
+
var import_core18 = require("@yamada-ui/core");
|
2531
|
+
var import_utils18 = require("@yamada-ui/utils");
|
2532
|
+
var import_react15 = require("react");
|
2475
2533
|
var import_recharts5 = require("recharts");
|
2476
2534
|
|
2477
|
-
// src/use-
|
2478
|
-
var
|
2535
|
+
// src/use-polar-grid.tsx
|
2536
|
+
var import_core16 = require("@yamada-ui/core");
|
2479
2537
|
var import_utils16 = require("@yamada-ui/utils");
|
2480
2538
|
var import_react13 = require("react");
|
2539
|
+
var usePolarGrid = ({
|
2540
|
+
strokeDasharray,
|
2541
|
+
styles,
|
2542
|
+
...rest
|
2543
|
+
}) => {
|
2544
|
+
const { theme } = (0, import_core16.useTheme)();
|
2545
|
+
const [polarGridProps, polarGridClassName] = (0, import_react13.useMemo)(
|
2546
|
+
() => {
|
2547
|
+
var _a;
|
2548
|
+
return getComponentProps(
|
2549
|
+
[(_a = rest.polarGridProps) != null ? _a : {}, polarGridProperties],
|
2550
|
+
styles.polarGrid
|
2551
|
+
)(theme);
|
2552
|
+
},
|
2553
|
+
[rest.polarGridProps, styles.polarGrid, theme]
|
2554
|
+
);
|
2555
|
+
const getPolarGridProps = (0, import_react13.useCallback)(
|
2556
|
+
({ className, ...props } = {}, ref = null) => ({
|
2557
|
+
ref,
|
2558
|
+
className: (0, import_utils16.cx)(className, polarGridClassName),
|
2559
|
+
strokeDasharray,
|
2560
|
+
...props,
|
2561
|
+
...polarGridProps
|
2562
|
+
}),
|
2563
|
+
[polarGridClassName, polarGridProps, strokeDasharray]
|
2564
|
+
);
|
2565
|
+
return { getPolarGridProps };
|
2566
|
+
};
|
2567
|
+
|
2568
|
+
// src/use-radar-chart.ts
|
2569
|
+
var import_core17 = require("@yamada-ui/core");
|
2570
|
+
var import_utils17 = require("@yamada-ui/utils");
|
2571
|
+
var import_react14 = require("react");
|
2481
2572
|
var useRadarChart = ({
|
2482
2573
|
data,
|
2483
2574
|
series,
|
@@ -2488,13 +2579,12 @@ var useRadarChart = ({
|
|
2488
2579
|
fillOpacity = 0.4,
|
2489
2580
|
polarAngleAxisTickFormatter,
|
2490
2581
|
polarRadiusAxisTickFormatter,
|
2491
|
-
strokeDasharray,
|
2492
2582
|
styles,
|
2493
2583
|
...rest
|
2494
2584
|
}) => {
|
2495
2585
|
var _a;
|
2496
|
-
const { theme } = (0,
|
2497
|
-
const [highlightedArea, setHighlightedArea] = (0,
|
2586
|
+
const { theme } = (0, import_core17.useTheme)();
|
2587
|
+
const [highlightedArea, setHighlightedArea] = (0, import_react14.useState)(null);
|
2498
2588
|
const shouldHighlight = highlightedArea !== null;
|
2499
2589
|
const {
|
2500
2590
|
dot = {},
|
@@ -2503,23 +2593,22 @@ var useRadarChart = ({
|
|
2503
2593
|
dimRadar,
|
2504
2594
|
...computedRadarProps
|
2505
2595
|
} = (_a = rest.radarProps) != null ? _a : {};
|
2506
|
-
const radarColors = (0,
|
2596
|
+
const radarColors = (0, import_react14.useMemo)(
|
2507
2597
|
() => series.map(({ color }, index) => ({
|
2508
|
-
__prefix: "ui",
|
2509
2598
|
name: `radar-${index}`,
|
2510
2599
|
token: "colors",
|
2511
2600
|
value: color != null ? color : "transparent"
|
2512
2601
|
})),
|
2513
2602
|
[series]
|
2514
2603
|
);
|
2515
|
-
const radarVars = (0,
|
2604
|
+
const radarVars = (0, import_react14.useMemo)(
|
2516
2605
|
() => [
|
2517
2606
|
...radarColors,
|
2518
|
-
{
|
2607
|
+
{ name: "fill-opacity", value: fillOpacity }
|
2519
2608
|
],
|
2520
2609
|
[fillOpacity, radarColors]
|
2521
2610
|
);
|
2522
|
-
const [chartProps, radarChartClassName] = (0,
|
2611
|
+
const [chartProps, radarChartClassName] = (0, import_react14.useMemo)(
|
2523
2612
|
() => {
|
2524
2613
|
var _a2;
|
2525
2614
|
return getComponentProps(
|
@@ -2529,17 +2618,7 @@ var useRadarChart = ({
|
|
2529
2618
|
},
|
2530
2619
|
[rest.chartProps, styles.chart, theme]
|
2531
2620
|
);
|
2532
|
-
const [
|
2533
|
-
() => {
|
2534
|
-
var _a2;
|
2535
|
-
return getComponentProps(
|
2536
|
-
[(_a2 = rest.polarGridProps) != null ? _a2 : {}, polarGridProperties],
|
2537
|
-
styles.polarGrid
|
2538
|
-
)(theme);
|
2539
|
-
},
|
2540
|
-
[rest.polarGridProps, styles.polarGrid, theme]
|
2541
|
-
);
|
2542
|
-
const [polarAngleAxisProps, polarAngleAxisClassName] = (0, import_react13.useMemo)(
|
2621
|
+
const [polarAngleAxisProps, polarAngleAxisClassName] = (0, import_react14.useMemo)(
|
2543
2622
|
() => {
|
2544
2623
|
var _a2;
|
2545
2624
|
return getComponentProps(
|
@@ -2549,14 +2628,14 @@ var useRadarChart = ({
|
|
2549
2628
|
},
|
2550
2629
|
[rest.polarAngleAxisProps, styles.polarAngleAxis, theme]
|
2551
2630
|
);
|
2552
|
-
const polarAngleAxisTickClassName = (0,
|
2631
|
+
const polarAngleAxisTickClassName = (0, import_react14.useMemo)(
|
2553
2632
|
() => getClassName({
|
2554
2633
|
...styles.polarAngleAxisTick,
|
2555
2634
|
...rest.polarAngleAxisTickProps
|
2556
2635
|
})(theme),
|
2557
2636
|
[rest.polarAngleAxisTickProps, styles.polarAngleAxisTick, theme]
|
2558
2637
|
);
|
2559
|
-
const [polarRadiusAxisProps, polarRadiusAxisClassName] = (0,
|
2638
|
+
const [polarRadiusAxisProps, polarRadiusAxisClassName] = (0, import_react14.useMemo)(
|
2560
2639
|
() => {
|
2561
2640
|
var _a2;
|
2562
2641
|
return getComponentProps(
|
@@ -2566,16 +2645,16 @@ var useRadarChart = ({
|
|
2566
2645
|
},
|
2567
2646
|
[rest.polarRadiusAxisProps, styles.polarRadiusAxis, theme]
|
2568
2647
|
);
|
2569
|
-
const polarRadiusAxisTickClassName = (0,
|
2648
|
+
const polarRadiusAxisTickClassName = (0, import_react14.useMemo)(
|
2570
2649
|
() => getClassName({
|
2571
2650
|
...styles.polarRadiusAxisTick,
|
2572
2651
|
...rest.polarRadiusAxisTickProps
|
2573
2652
|
})(theme),
|
2574
2653
|
[rest.polarRadiusAxisTickProps, styles.polarRadiusAxisTick, theme]
|
2575
2654
|
);
|
2576
|
-
const [radarProps, radarClassName] = (0,
|
2655
|
+
const [radarProps, radarClassName] = (0, import_react14.useMemo)(() => {
|
2577
2656
|
const resolvedRadarProps = {
|
2578
|
-
fillOpacity: "
|
2657
|
+
fillOpacity: "$fill-opacity",
|
2579
2658
|
...computedRadarProps
|
2580
2659
|
};
|
2581
2660
|
return getComponentProps(
|
@@ -2583,7 +2662,7 @@ var useRadarChart = ({
|
|
2583
2662
|
styles.radar
|
2584
2663
|
)(theme);
|
2585
2664
|
}, [computedRadarProps, styles.radar, theme]);
|
2586
|
-
const [dimRadarProps, dimRadarClassName] = (0,
|
2665
|
+
const [dimRadarProps, dimRadarClassName] = (0, import_react14.useMemo)(() => {
|
2587
2666
|
const resolvedDimRadar = {
|
2588
2667
|
fillOpacity: 0.3,
|
2589
2668
|
strokeOpacity: 0.3,
|
@@ -2593,27 +2672,27 @@ var useRadarChart = ({
|
|
2593
2672
|
theme
|
2594
2673
|
);
|
2595
2674
|
}, [dimRadar, theme]);
|
2596
|
-
const [dotProps, dotClassName] = (0,
|
2675
|
+
const [dotProps, dotClassName] = (0, import_react14.useMemo)(() => {
|
2597
2676
|
const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
|
2598
2677
|
return getComponentProps(
|
2599
2678
|
[resolvedDot, dotProperties],
|
2600
2679
|
styles.dot
|
2601
2680
|
)(theme);
|
2602
2681
|
}, [dot, styles.dot, theme]);
|
2603
|
-
const [activeDotProps, activeDotClassName] = (0,
|
2682
|
+
const [activeDotProps, activeDotClassName] = (0, import_react14.useMemo)(
|
2604
2683
|
() => getComponentProps(
|
2605
2684
|
[activeDot, dotProperties],
|
2606
2685
|
styles.activeDot
|
2607
2686
|
)(theme),
|
2608
2687
|
[activeDot, styles.activeDot, theme]
|
2609
2688
|
);
|
2610
|
-
const [dimDotProps, dimDotClassName] = (0,
|
2689
|
+
const [dimDotProps, dimDotClassName] = (0, import_react14.useMemo)(() => {
|
2611
2690
|
const resolvedDimDot = { fillOpacity: 0, strokeOpacity: 0, ...dimDot };
|
2612
2691
|
return getComponentProps([resolvedDimDot, dotProperties])(
|
2613
2692
|
theme
|
2614
2693
|
);
|
2615
2694
|
}, [dimDot, theme]);
|
2616
|
-
const radarPropList = (0,
|
2695
|
+
const radarPropList = (0, import_react14.useMemo)(
|
2617
2696
|
() => series.map((props, index) => {
|
2618
2697
|
const {
|
2619
2698
|
dataKey: dataKey2,
|
@@ -2623,7 +2702,7 @@ var useRadarChart = ({
|
|
2623
2702
|
dimRadar: dimRadar2 = {},
|
2624
2703
|
...computedProps
|
2625
2704
|
} = props;
|
2626
|
-
const color = `
|
2705
|
+
const color = (0, import_core17.getVar)(`radar-${index}`)(theme);
|
2627
2706
|
const dimmed = shouldHighlight && highlightedArea !== dataKey2;
|
2628
2707
|
const computedDimRadar = { ...dimRadarProps, ...dimRadar2 };
|
2629
2708
|
const resolvedProps = {
|
@@ -2647,7 +2726,7 @@ var useRadarChart = ({
|
|
2647
2726
|
activeDotClassName
|
2648
2727
|
)(theme);
|
2649
2728
|
resolvedActiveDot = {
|
2650
|
-
className: (0,
|
2729
|
+
className: (0, import_utils17.cx)("ui-radar-chart__active-dot", className),
|
2651
2730
|
fill: color,
|
2652
2731
|
stroke: color,
|
2653
2732
|
r: 4,
|
@@ -2670,7 +2749,7 @@ var useRadarChart = ({
|
|
2670
2749
|
dimmed ? dimDotClassName : void 0
|
2671
2750
|
)(theme);
|
2672
2751
|
resolvedDot = {
|
2673
|
-
className: (0,
|
2752
|
+
className: (0, import_utils17.cx)("ui-radar-chart__dot", className),
|
2674
2753
|
fill: color,
|
2675
2754
|
r: 4,
|
2676
2755
|
...rest3
|
@@ -2705,22 +2784,22 @@ var useRadarChart = ({
|
|
2705
2784
|
withDots
|
2706
2785
|
]
|
2707
2786
|
);
|
2708
|
-
const getRadarChartProps = (0,
|
2787
|
+
const getRadarChartProps = (0, import_react14.useCallback)(
|
2709
2788
|
({ className, ...props } = {}, ref = null) => ({
|
2710
2789
|
ref,
|
2711
|
-
className: (0,
|
2790
|
+
className: (0, import_utils17.cx)(className, radarChartClassName),
|
2712
2791
|
data,
|
2713
2792
|
...props,
|
2714
2793
|
...chartProps
|
2715
2794
|
}),
|
2716
2795
|
[data, radarChartClassName, chartProps]
|
2717
2796
|
);
|
2718
|
-
const getRadarProps = (0,
|
2797
|
+
const getRadarProps = (0, import_react14.useCallback)(
|
2719
2798
|
({ index, className: classNameProp, ...props }, ref = null) => {
|
2720
2799
|
const { color, className, dataKey: dataKey2, activeDot: activeDot2, dot: dot2, ...rest2 } = radarPropList[index];
|
2721
2800
|
return {
|
2722
2801
|
ref,
|
2723
|
-
className: (0,
|
2802
|
+
className: (0, import_utils17.cx)(classNameProp, className),
|
2724
2803
|
activeDot: activeDot2,
|
2725
2804
|
dot: dot2,
|
2726
2805
|
name: dataKey2,
|
@@ -2735,23 +2814,13 @@ var useRadarChart = ({
|
|
2735
2814
|
},
|
2736
2815
|
[radarPropList, strokeWidth]
|
2737
2816
|
);
|
2738
|
-
const
|
2817
|
+
const getPolarAngleAxisProps = (0, import_react14.useCallback)(
|
2739
2818
|
({ className, ...props } = {}, ref = null) => ({
|
2740
2819
|
ref,
|
2741
|
-
className: (0,
|
2742
|
-
strokeDasharray,
|
2743
|
-
...props,
|
2744
|
-
...polarGridProps
|
2745
|
-
}),
|
2746
|
-
[polarGridClassName, polarGridProps, strokeDasharray]
|
2747
|
-
);
|
2748
|
-
const getPolarAngleAxisProps = (0, import_react13.useCallback)(
|
2749
|
-
({ className, ...props } = {}, ref = null) => ({
|
2750
|
-
ref,
|
2751
|
-
className: (0, import_utils16.cx)(className, polarAngleAxisClassName),
|
2820
|
+
className: (0, import_utils17.cx)(className, polarAngleAxisClassName),
|
2752
2821
|
dataKey,
|
2753
2822
|
tick: {
|
2754
|
-
className: (0,
|
2823
|
+
className: (0, import_utils17.cx)(
|
2755
2824
|
"ui-radar-chart__polar-angle-axis-tick",
|
2756
2825
|
polarAngleAxisTickClassName
|
2757
2826
|
)
|
@@ -2769,12 +2838,12 @@ var useRadarChart = ({
|
|
2769
2838
|
polarAngleAxisTickFormatter
|
2770
2839
|
]
|
2771
2840
|
);
|
2772
|
-
const getPolarRadiusAxisProps = (0,
|
2841
|
+
const getPolarRadiusAxisProps = (0, import_react14.useCallback)(
|
2773
2842
|
({ className, ...props } = {}, ref = null) => ({
|
2774
2843
|
ref,
|
2775
|
-
className: (0,
|
2844
|
+
className: (0, import_utils17.cx)(className, polarRadiusAxisClassName),
|
2776
2845
|
tick: {
|
2777
|
-
className: (0,
|
2846
|
+
className: (0, import_utils17.cx)(
|
2778
2847
|
"ui-radar-chart__polar-radius-axis-tick",
|
2779
2848
|
polarRadiusAxisTickClassName
|
2780
2849
|
)
|
@@ -2794,7 +2863,6 @@ var useRadarChart = ({
|
|
2794
2863
|
radarVars,
|
2795
2864
|
getRadarChartProps,
|
2796
2865
|
getRadarProps,
|
2797
|
-
getPolarGridProps,
|
2798
2866
|
getPolarAngleAxisProps,
|
2799
2867
|
getPolarRadiusAxisProps,
|
2800
2868
|
setHighlightedArea
|
@@ -2803,8 +2871,8 @@ var useRadarChart = ({
|
|
2803
2871
|
|
2804
2872
|
// src/radar-chart.tsx
|
2805
2873
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
2806
|
-
var RadarChart = (0,
|
2807
|
-
const [styles, mergedProps] = (0,
|
2874
|
+
var RadarChart = (0, import_core18.forwardRef)((props, ref) => {
|
2875
|
+
const [styles, mergedProps] = (0, import_core18.useMultiComponentStyle)("RadarChart", props);
|
2808
2876
|
const {
|
2809
2877
|
className,
|
2810
2878
|
data,
|
@@ -2836,11 +2904,10 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2836
2904
|
withPolarAngleAxis = true,
|
2837
2905
|
withPolarRadiusAxis = false,
|
2838
2906
|
...rest
|
2839
|
-
} = (0,
|
2907
|
+
} = (0, import_core18.omitThemeProps)(mergedProps);
|
2840
2908
|
const {
|
2841
2909
|
getRadarProps,
|
2842
2910
|
getRadarChartProps,
|
2843
|
-
getPolarGridProps,
|
2844
2911
|
getPolarAngleAxisProps,
|
2845
2912
|
getPolarRadiusAxisProps,
|
2846
2913
|
radarVars,
|
@@ -2851,7 +2918,6 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2851
2918
|
dataKey,
|
2852
2919
|
radarProps,
|
2853
2920
|
chartProps,
|
2854
|
-
polarGridProps,
|
2855
2921
|
polarAngleAxisProps,
|
2856
2922
|
polarAngleAxisTickProps,
|
2857
2923
|
polarRadiusAxisProps,
|
@@ -2862,7 +2928,6 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2862
2928
|
fillOpacity,
|
2863
2929
|
polarAngleAxisTickFormatter,
|
2864
2930
|
polarRadiusAxisTickFormatter,
|
2865
|
-
strokeDasharray,
|
2866
2931
|
styles
|
2867
2932
|
});
|
2868
2933
|
const { getContainerProps } = useChart({ containerProps });
|
@@ -2874,7 +2939,12 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2874
2939
|
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
2875
2940
|
legendProps
|
2876
2941
|
});
|
2877
|
-
const
|
2942
|
+
const { getPolarGridProps } = usePolarGrid({
|
2943
|
+
polarGridProps,
|
2944
|
+
strokeDasharray,
|
2945
|
+
styles
|
2946
|
+
});
|
2947
|
+
const radars = (0, import_react15.useMemo)(
|
2878
2948
|
() => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2879
2949
|
import_recharts5.Radar,
|
2880
2950
|
{
|
@@ -2885,10 +2955,10 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2885
2955
|
[getRadarProps, series]
|
2886
2956
|
);
|
2887
2957
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2888
|
-
|
2958
|
+
import_core18.ui.div,
|
2889
2959
|
{
|
2890
2960
|
ref,
|
2891
|
-
className: (0,
|
2961
|
+
className: (0, import_utils18.cx)("ui-radar-chart", className),
|
2892
2962
|
var: radarVars,
|
2893
2963
|
__css: { maxW: "full", ...styles.container },
|
2894
2964
|
...rest,
|
@@ -2968,27 +3038,27 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2968
3038
|
});
|
2969
3039
|
|
2970
3040
|
// src/donut-chart.tsx
|
2971
|
-
var
|
2972
|
-
var
|
2973
|
-
var
|
3041
|
+
var import_core22 = require("@yamada-ui/core");
|
3042
|
+
var import_utils22 = require("@yamada-ui/utils");
|
3043
|
+
var import_react18 = require("react");
|
2974
3044
|
var import_recharts6 = require("recharts");
|
2975
3045
|
|
2976
3046
|
// src/use-chart-label.ts
|
2977
|
-
var
|
2978
|
-
var
|
2979
|
-
var
|
3047
|
+
var import_core19 = require("@yamada-ui/core");
|
3048
|
+
var import_utils19 = require("@yamada-ui/utils");
|
3049
|
+
var import_react16 = require("react");
|
2980
3050
|
var useChartLabel = ({ styles, ...rest }) => {
|
2981
3051
|
var _a;
|
2982
|
-
const { theme } = (0,
|
3052
|
+
const { theme } = (0, import_core19.useTheme)();
|
2983
3053
|
const [labelProps, labelClassName] = getComponentProps(
|
2984
3054
|
[(_a = rest.labelProps) != null ? _a : {}, labelProperties],
|
2985
3055
|
styles.label
|
2986
3056
|
)(theme);
|
2987
|
-
const getLabelProps = (0,
|
3057
|
+
const getLabelProps = (0, import_react16.useCallback)(
|
2988
3058
|
({ className, ...props } = {}, ref = null) => {
|
2989
3059
|
return {
|
2990
3060
|
ref,
|
2991
|
-
className: (0,
|
3061
|
+
className: (0, import_utils19.cx)(className, labelClassName),
|
2992
3062
|
...props,
|
2993
3063
|
...labelProps
|
2994
3064
|
};
|
@@ -2999,13 +3069,13 @@ var useChartLabel = ({ styles, ...rest }) => {
|
|
2999
3069
|
};
|
3000
3070
|
|
3001
3071
|
// src/use-pie-chart.ts
|
3002
|
-
var
|
3003
|
-
var
|
3004
|
-
var
|
3072
|
+
var import_core21 = require("@yamada-ui/core");
|
3073
|
+
var import_utils21 = require("@yamada-ui/utils");
|
3074
|
+
var import_react17 = require("react");
|
3005
3075
|
|
3006
3076
|
// src/pie-chart-label.tsx
|
3007
|
-
var
|
3008
|
-
var
|
3077
|
+
var import_core20 = require("@yamada-ui/core");
|
3078
|
+
var import_utils20 = require("@yamada-ui/utils");
|
3009
3079
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
3010
3080
|
var RADIAN = Math.PI / 180;
|
3011
3081
|
var DEFAULT_LABEL_OFFSET = 22;
|
@@ -3032,16 +3102,16 @@ var pieChartLabel = ({
|
|
3032
3102
|
const displayLabel = () => {
|
3033
3103
|
if (isPercent) {
|
3034
3104
|
return parseFloat((percent * 100).toFixed(0)) > 0 && `${(percent * 100).toFixed(0)}%`;
|
3035
|
-
} else if (!(0,
|
3105
|
+
} else if (!(0, import_utils20.isUndefined)(labelFormatter)) {
|
3036
3106
|
return labelFormatter(value);
|
3037
3107
|
} else {
|
3038
3108
|
return value;
|
3039
3109
|
}
|
3040
3110
|
};
|
3041
3111
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3042
|
-
|
3112
|
+
import_core20.ui.text,
|
3043
3113
|
{
|
3044
|
-
className: (0,
|
3114
|
+
className: (0, import_utils20.cx)(cellClassName, "ui-chart__label"),
|
3045
3115
|
x,
|
3046
3116
|
y,
|
3047
3117
|
textAnchor,
|
@@ -3070,9 +3140,9 @@ var pieChartLabelLine = ({
|
|
3070
3140
|
const y = cyProp + (middleRadius + labelOffset) * Math.sin(-midAngle * RADIAN);
|
3071
3141
|
const d = `M ${points[0].x} ${points[0].y} L ${x} ${y}`;
|
3072
3142
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3073
|
-
|
3143
|
+
import_core20.ui.path,
|
3074
3144
|
{
|
3075
|
-
className: (0,
|
3145
|
+
className: (0, import_utils20.cx)(cellClassName, "ui-chart__label-line"),
|
3076
3146
|
d,
|
3077
3147
|
__css: styles,
|
3078
3148
|
...labelLineProps
|
@@ -3099,8 +3169,8 @@ var usePieChart = ({
|
|
3099
3169
|
...rest
|
3100
3170
|
}) => {
|
3101
3171
|
var _a, _b;
|
3102
|
-
const { theme } = (0,
|
3103
|
-
const [highlightedArea, setHighlightedArea] = (0,
|
3172
|
+
const { theme } = (0, import_core21.useTheme)();
|
3173
|
+
const [highlightedArea, setHighlightedArea] = (0, import_react17.useState)(null);
|
3104
3174
|
const shouldHighlight = highlightedArea !== null;
|
3105
3175
|
const { dimCell, ...computedCellProps } = (_a = rest.cellProps) != null ? _a : {};
|
3106
3176
|
const {
|
@@ -3110,23 +3180,22 @@ var usePieChart = ({
|
|
3110
3180
|
labelLine: labelLineProps,
|
3111
3181
|
...computedPieProps
|
3112
3182
|
} = (_b = rest.pieProps) != null ? _b : {};
|
3113
|
-
const cellColors = (0,
|
3183
|
+
const cellColors = (0, import_react17.useMemo)(
|
3114
3184
|
() => data.map(({ color }, index) => ({
|
3115
|
-
__prefix: "ui",
|
3116
3185
|
name: `cell-${index}`,
|
3117
3186
|
token: "colors",
|
3118
3187
|
value: color != null ? color : "transparent"
|
3119
3188
|
})),
|
3120
3189
|
[data]
|
3121
3190
|
);
|
3122
|
-
const pieVars = (0,
|
3191
|
+
const pieVars = (0, import_react17.useMemo)(
|
3123
3192
|
() => [
|
3124
3193
|
...cellColors,
|
3125
|
-
{
|
3194
|
+
{ name: "fill-opacity", value: fillOpacity }
|
3126
3195
|
],
|
3127
3196
|
[fillOpacity, cellColors]
|
3128
3197
|
);
|
3129
|
-
const [chartProps, chartClassName] = (0,
|
3198
|
+
const [chartProps, chartClassName] = (0, import_react17.useMemo)(
|
3130
3199
|
() => {
|
3131
3200
|
var _a2;
|
3132
3201
|
return getComponentProps(
|
@@ -3136,40 +3205,40 @@ var usePieChart = ({
|
|
3136
3205
|
},
|
3137
3206
|
[rest.chartProps, styles.chart, theme]
|
3138
3207
|
);
|
3139
|
-
const [pieProps, pieClassName] = (0,
|
3208
|
+
const [pieProps, pieClassName] = (0, import_react17.useMemo)(
|
3140
3209
|
() => getComponentProps(
|
3141
3210
|
[computedPieProps, pieProperties],
|
3142
3211
|
styles.pie
|
3143
3212
|
)(theme),
|
3144
3213
|
[computedPieProps, styles.pie, theme]
|
3145
3214
|
);
|
3146
|
-
const cellClassName = (0,
|
3215
|
+
const cellClassName = (0, import_react17.useMemo)(() => {
|
3147
3216
|
const resolvedCellProps = {
|
3148
|
-
fillOpacity: "
|
3217
|
+
fillOpacity: "$fill-opacity",
|
3149
3218
|
...styles.cell,
|
3150
3219
|
...computedCellProps
|
3151
3220
|
};
|
3152
3221
|
return getClassName(resolvedCellProps)(theme);
|
3153
3222
|
}, [computedCellProps, styles.cell, theme]);
|
3154
|
-
const dimCellClassName = (0,
|
3223
|
+
const dimCellClassName = (0, import_react17.useMemo)(() => {
|
3155
3224
|
const resolvedDimCell = { fillOpacity: 0.3, strokeOpacity: 0, ...dimCell };
|
3156
3225
|
return getClassName(resolvedDimCell)(theme);
|
3157
3226
|
}, [dimCell, theme]);
|
3158
|
-
const activeShapeProps = (0,
|
3227
|
+
const activeShapeProps = (0, import_react17.useMemo)(
|
3159
3228
|
() => getComponentProps(
|
3160
3229
|
[{ _focus: { outline: "none" }, ...activeShape }, pieProperties],
|
3161
3230
|
styles.activeShape
|
3162
3231
|
)(theme, true),
|
3163
3232
|
[activeShape, styles.activeShape, theme]
|
3164
3233
|
);
|
3165
|
-
const inactiveShapeProps = (0,
|
3234
|
+
const inactiveShapeProps = (0, import_react17.useMemo)(
|
3166
3235
|
() => getComponentProps(
|
3167
3236
|
[inactiveShape, pieProperties],
|
3168
3237
|
styles.inactiveShape
|
3169
3238
|
)(theme, true),
|
3170
3239
|
[inactiveShape, styles.inactiveShape, theme]
|
3171
3240
|
);
|
3172
|
-
const label = (0,
|
3241
|
+
const label = (0, import_react17.useCallback)(
|
3173
3242
|
(props) => pieChartLabel({
|
3174
3243
|
labelOffset,
|
3175
3244
|
isPercent,
|
@@ -3180,7 +3249,7 @@ var usePieChart = ({
|
|
3180
3249
|
}),
|
3181
3250
|
[isPercent, labelOffset, labelProps, styles.label, labelFormatter]
|
3182
3251
|
);
|
3183
|
-
const labelLine = (0,
|
3252
|
+
const labelLine = (0, import_react17.useCallback)(
|
3184
3253
|
(props) => {
|
3185
3254
|
return pieChartLabelLine({
|
3186
3255
|
labelOffset,
|
@@ -3191,10 +3260,10 @@ var usePieChart = ({
|
|
3191
3260
|
},
|
3192
3261
|
[labelLineProps, labelOffset, styles.labelLine]
|
3193
3262
|
);
|
3194
|
-
const cellPropList = (0,
|
3263
|
+
const cellPropList = (0, import_react17.useMemo)(
|
3195
3264
|
() => data.map((props, index) => {
|
3196
3265
|
const { name, dimCell: dimCell2 = {}, ...computedProps } = props;
|
3197
|
-
const color = `
|
3266
|
+
const color = (0, import_core21.getVar)(`cell-${index}`)(theme);
|
3198
3267
|
const dimmed = shouldHighlight && highlightedArea !== name;
|
3199
3268
|
const resolvedProps = {
|
3200
3269
|
...computedProps,
|
@@ -3221,19 +3290,19 @@ var usePieChart = ({
|
|
3221
3290
|
theme
|
3222
3291
|
]
|
3223
3292
|
);
|
3224
|
-
const getPieChartProps = (0,
|
3293
|
+
const getPieChartProps = (0, import_react17.useCallback)(
|
3225
3294
|
({ className, ...props } = {}, ref = null) => ({
|
3226
3295
|
ref,
|
3227
|
-
className: (0,
|
3296
|
+
className: (0, import_utils21.cx)(className, chartClassName),
|
3228
3297
|
...props,
|
3229
3298
|
...chartProps
|
3230
3299
|
}),
|
3231
3300
|
[chartProps, chartClassName]
|
3232
3301
|
);
|
3233
|
-
const getPieProps = (0,
|
3302
|
+
const getPieProps = (0, import_react17.useCallback)(
|
3234
3303
|
({ className, ...props }, ref = null) => ({
|
3235
3304
|
ref,
|
3236
|
-
className: (0,
|
3305
|
+
className: (0, import_utils21.cx)(className, pieClassName),
|
3237
3306
|
dataKey: "value",
|
3238
3307
|
data,
|
3239
3308
|
rootTabIndex: -1,
|
@@ -3267,12 +3336,12 @@ var usePieChart = ({
|
|
3267
3336
|
pieProps
|
3268
3337
|
]
|
3269
3338
|
);
|
3270
|
-
const getCellProps = (0,
|
3339
|
+
const getCellProps = (0, import_react17.useCallback)(
|
3271
3340
|
({ index, className: classNameProp, ...props }, ref = null) => {
|
3272
3341
|
const { className, color } = cellPropList[index];
|
3273
3342
|
return {
|
3274
3343
|
ref,
|
3275
|
-
className: (0,
|
3344
|
+
className: (0, import_utils21.cx)(classNameProp, className),
|
3276
3345
|
fill: color,
|
3277
3346
|
stroke: color,
|
3278
3347
|
strokeWidth,
|
@@ -3292,8 +3361,8 @@ var usePieChart = ({
|
|
3292
3361
|
|
3293
3362
|
// src/donut-chart.tsx
|
3294
3363
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
3295
|
-
var DonutChart = (0,
|
3296
|
-
const [styles, mergedProps] = (0,
|
3364
|
+
var DonutChart = (0, import_core22.forwardRef)((props, ref) => {
|
3365
|
+
const [styles, mergedProps] = (0, import_core22.useMultiComponentStyle)("DonutChart", props);
|
3297
3366
|
const {
|
3298
3367
|
className,
|
3299
3368
|
data,
|
@@ -3322,7 +3391,7 @@ var DonutChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3322
3391
|
legendProps,
|
3323
3392
|
labelProps,
|
3324
3393
|
...rest
|
3325
|
-
} = (0,
|
3394
|
+
} = (0, import_core22.omitThemeProps)(mergedProps);
|
3326
3395
|
const {
|
3327
3396
|
pieVars,
|
3328
3397
|
getPieProps,
|
@@ -3357,7 +3426,7 @@ var DonutChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3357
3426
|
legendProps
|
3358
3427
|
});
|
3359
3428
|
const { getLabelProps } = useChartLabel({ labelProps, styles });
|
3360
|
-
const cells = (0,
|
3429
|
+
const cells = (0, import_react18.useMemo)(
|
3361
3430
|
() => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3362
3431
|
import_recharts6.Cell,
|
3363
3432
|
{
|
@@ -3368,10 +3437,10 @@ var DonutChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3368
3437
|
[data, getCellProps]
|
3369
3438
|
);
|
3370
3439
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3371
|
-
|
3440
|
+
import_core22.ui.div,
|
3372
3441
|
{
|
3373
3442
|
ref,
|
3374
|
-
className: (0,
|
3443
|
+
className: (0, import_utils22.cx)("ui-donut-chart", className),
|
3375
3444
|
var: pieVars,
|
3376
3445
|
__css: { maxW: "full", ...styles.container },
|
3377
3446
|
...rest,
|
@@ -3443,13 +3512,13 @@ var DonutChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3443
3512
|
});
|
3444
3513
|
|
3445
3514
|
// src/pie-chart.tsx
|
3446
|
-
var
|
3447
|
-
var
|
3448
|
-
var
|
3515
|
+
var import_core23 = require("@yamada-ui/core");
|
3516
|
+
var import_utils23 = require("@yamada-ui/utils");
|
3517
|
+
var import_react19 = require("react");
|
3449
3518
|
var import_recharts7 = require("recharts");
|
3450
3519
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
3451
|
-
var PieChart = (0,
|
3452
|
-
const [styles, mergedProps] = (0,
|
3520
|
+
var PieChart = (0, import_core23.forwardRef)((props, ref) => {
|
3521
|
+
const [styles, mergedProps] = (0, import_core23.useMultiComponentStyle)("PieChart", props);
|
3453
3522
|
const {
|
3454
3523
|
className,
|
3455
3524
|
data,
|
@@ -3477,7 +3546,7 @@ var PieChart = (0, import_core21.forwardRef)((props, ref) => {
|
|
3477
3546
|
strokeWidth,
|
3478
3547
|
legendProps,
|
3479
3548
|
...rest
|
3480
|
-
} = (0,
|
3549
|
+
} = (0, import_core23.omitThemeProps)(mergedProps);
|
3481
3550
|
const {
|
3482
3551
|
pieVars,
|
3483
3552
|
getPieProps,
|
@@ -3511,7 +3580,7 @@ var PieChart = (0, import_core21.forwardRef)((props, ref) => {
|
|
3511
3580
|
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
3512
3581
|
legendProps
|
3513
3582
|
});
|
3514
|
-
const cells = (0,
|
3583
|
+
const cells = (0, import_react19.useMemo)(
|
3515
3584
|
() => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3516
3585
|
import_recharts7.Cell,
|
3517
3586
|
{
|
@@ -3522,10 +3591,10 @@ var PieChart = (0, import_core21.forwardRef)((props, ref) => {
|
|
3522
3591
|
[data, getCellProps]
|
3523
3592
|
);
|
3524
3593
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3525
|
-
|
3594
|
+
import_core23.ui.div,
|
3526
3595
|
{
|
3527
3596
|
ref,
|
3528
|
-
className: (0,
|
3597
|
+
className: (0, import_utils23.cx)("ui-pie-chart", className),
|
3529
3598
|
var: pieVars,
|
3530
3599
|
__css: { maxW: "full", ...styles.container },
|
3531
3600
|
...rest,
|
@@ -3588,8 +3657,341 @@ var PieChart = (0, import_core21.forwardRef)((props, ref) => {
|
|
3588
3657
|
) });
|
3589
3658
|
});
|
3590
3659
|
|
3591
|
-
// src/
|
3660
|
+
// src/radial-chart.tsx
|
3661
|
+
var import_core26 = require("@yamada-ui/core");
|
3662
|
+
var import_utils26 = require("@yamada-ui/utils");
|
3663
|
+
var import_react22 = require("react");
|
3592
3664
|
var import_recharts8 = require("recharts");
|
3665
|
+
|
3666
|
+
// src/use-chart-label-list.ts
|
3667
|
+
var import_core24 = require("@yamada-ui/core");
|
3668
|
+
var import_utils24 = require("@yamada-ui/utils");
|
3669
|
+
var import_react20 = require("react");
|
3670
|
+
var useChartLabelList = ({
|
3671
|
+
labelListProps = [],
|
3672
|
+
styles
|
3673
|
+
}) => {
|
3674
|
+
const { theme } = (0, import_core24.useTheme)();
|
3675
|
+
const styleClassName = (0, import_core24.getCSS)(styles.labelList)(theme);
|
3676
|
+
const propList = (0, import_react20.useMemo)(
|
3677
|
+
() => labelListProps.map(
|
3678
|
+
(props) => getComponentProps(
|
3679
|
+
[props, labelListProperties],
|
3680
|
+
styleClassName
|
3681
|
+
)(theme, true)
|
3682
|
+
),
|
3683
|
+
[labelListProps, styleClassName, theme]
|
3684
|
+
);
|
3685
|
+
const getLabelLineProps = (0, import_react20.useCallback)(
|
3686
|
+
({ index, className, ...props }, ref = null) => {
|
3687
|
+
const { className: propClassName, ...rest } = propList[index];
|
3688
|
+
return {
|
3689
|
+
ref,
|
3690
|
+
className: (0, import_utils24.cx)(className, propClassName),
|
3691
|
+
...props,
|
3692
|
+
...rest
|
3693
|
+
};
|
3694
|
+
},
|
3695
|
+
[propList]
|
3696
|
+
);
|
3697
|
+
return { getLabelLineProps };
|
3698
|
+
};
|
3699
|
+
|
3700
|
+
// src/use-radial-chart.ts
|
3701
|
+
var import_core25 = require("@yamada-ui/core");
|
3702
|
+
var import_utils25 = require("@yamada-ui/utils");
|
3703
|
+
var import_react21 = require("react");
|
3704
|
+
var useRadialChart = ({
|
3705
|
+
data: dataProp,
|
3706
|
+
dataKey = "value",
|
3707
|
+
innerRadius = "10%",
|
3708
|
+
outerRadius = "80%",
|
3709
|
+
startAngle = 180,
|
3710
|
+
endAngle = 0,
|
3711
|
+
fillOpacity = 1,
|
3712
|
+
styles,
|
3713
|
+
...rest
|
3714
|
+
}) => {
|
3715
|
+
var _a;
|
3716
|
+
const { theme } = (0, import_core25.useTheme)();
|
3717
|
+
const [highlightedArea, setHighlightedArea] = (0, import_react21.useState)(null);
|
3718
|
+
const shouldHighlight = highlightedArea !== null;
|
3719
|
+
const {
|
3720
|
+
background: backgroundProps = {},
|
3721
|
+
dimRadialBar: dimRadialBarProps = {},
|
3722
|
+
...computedRadialBarProps
|
3723
|
+
} = (_a = rest.radialBarProps) != null ? _a : {};
|
3724
|
+
const radialVars = (0, import_react21.useMemo)(
|
3725
|
+
() => dataProp.map(({ color }, index) => ({
|
3726
|
+
name: `radial-bar-${index}`,
|
3727
|
+
token: "colors",
|
3728
|
+
value: color != null ? color : "transparent"
|
3729
|
+
})),
|
3730
|
+
[dataProp]
|
3731
|
+
);
|
3732
|
+
const dimRadialBarClassName = (0, import_react21.useMemo)(() => {
|
3733
|
+
const resolvedDimRadialBar = {
|
3734
|
+
fillOpacity: 0.3,
|
3735
|
+
strokeOpacity: 0,
|
3736
|
+
...dimRadialBarProps
|
3737
|
+
};
|
3738
|
+
return getClassName(resolvedDimRadialBar)(theme);
|
3739
|
+
}, [dimRadialBarProps, theme]);
|
3740
|
+
const [chartProps, chartClassName] = (0, import_react21.useMemo)(
|
3741
|
+
() => {
|
3742
|
+
var _a2;
|
3743
|
+
return getComponentProps(
|
3744
|
+
[(_a2 = rest.chartProps) != null ? _a2 : {}, radialChartProperties],
|
3745
|
+
styles.chart
|
3746
|
+
)(theme);
|
3747
|
+
},
|
3748
|
+
[rest.chartProps, styles.chart, theme]
|
3749
|
+
);
|
3750
|
+
const background = (0, import_react21.useMemo)(
|
3751
|
+
() => getComponentProps(
|
3752
|
+
[backgroundProps, radialBarProperties],
|
3753
|
+
styles.background
|
3754
|
+
)(theme, true),
|
3755
|
+
[backgroundProps, styles.background, theme]
|
3756
|
+
);
|
3757
|
+
const [radialBarProps, radialBarClassName] = (0, import_react21.useMemo)(
|
3758
|
+
() => getComponentProps(
|
3759
|
+
[computedRadialBarProps != null ? computedRadialBarProps : {}, radialBarProperties],
|
3760
|
+
styles.radialBar
|
3761
|
+
)(theme),
|
3762
|
+
[computedRadialBarProps, styles.radialBar, theme]
|
3763
|
+
);
|
3764
|
+
const data = (0, import_react21.useMemo)(
|
3765
|
+
() => dataProp.map((props, index) => {
|
3766
|
+
const {
|
3767
|
+
name,
|
3768
|
+
value,
|
3769
|
+
color,
|
3770
|
+
dimRadialBar = {},
|
3771
|
+
...computedProps
|
3772
|
+
} = props;
|
3773
|
+
const dimmed = shouldHighlight && highlightedArea !== name;
|
3774
|
+
const resolvedProps = {
|
3775
|
+
...computedProps,
|
3776
|
+
...dimmed ? dimRadialBar : { fillOpacity }
|
3777
|
+
};
|
3778
|
+
const className = getClassName(
|
3779
|
+
resolvedProps,
|
3780
|
+
dimmed ? dimRadialBarClassName : void 0
|
3781
|
+
)(theme);
|
3782
|
+
return {
|
3783
|
+
className,
|
3784
|
+
fill: (0, import_core25.getVar)(`radial-bar-${index}`)(theme),
|
3785
|
+
name,
|
3786
|
+
value,
|
3787
|
+
color
|
3788
|
+
};
|
3789
|
+
}),
|
3790
|
+
[
|
3791
|
+
dataProp,
|
3792
|
+
dimRadialBarClassName,
|
3793
|
+
fillOpacity,
|
3794
|
+
highlightedArea,
|
3795
|
+
shouldHighlight,
|
3796
|
+
theme
|
3797
|
+
]
|
3798
|
+
);
|
3799
|
+
const getRadialChartProps = (0, import_react21.useCallback)(
|
3800
|
+
({ className, ...props } = {}, ref = null) => ({
|
3801
|
+
ref,
|
3802
|
+
className: (0, import_utils25.cx)(className, chartClassName),
|
3803
|
+
data,
|
3804
|
+
innerRadius,
|
3805
|
+
outerRadius,
|
3806
|
+
startAngle,
|
3807
|
+
endAngle,
|
3808
|
+
...props,
|
3809
|
+
...chartProps
|
3810
|
+
}),
|
3811
|
+
[
|
3812
|
+
chartClassName,
|
3813
|
+
chartProps,
|
3814
|
+
data,
|
3815
|
+
endAngle,
|
3816
|
+
innerRadius,
|
3817
|
+
outerRadius,
|
3818
|
+
startAngle
|
3819
|
+
]
|
3820
|
+
);
|
3821
|
+
const getRadialBarProps = (0, import_react21.useCallback)(
|
3822
|
+
({ className, ...props }, ref = null) => ({
|
3823
|
+
ref,
|
3824
|
+
className: (0, import_utils25.cx)(className, radialBarClassName),
|
3825
|
+
dataKey,
|
3826
|
+
isAnimationActive: false,
|
3827
|
+
background,
|
3828
|
+
...props,
|
3829
|
+
...radialBarProps
|
3830
|
+
}),
|
3831
|
+
[background, dataKey, radialBarClassName, radialBarProps]
|
3832
|
+
);
|
3833
|
+
return {
|
3834
|
+
radialVars,
|
3835
|
+
setHighlightedArea,
|
3836
|
+
getRadialChartProps,
|
3837
|
+
getRadialBarProps
|
3838
|
+
};
|
3839
|
+
};
|
3840
|
+
|
3841
|
+
// src/radial-chart.tsx
|
3842
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
3843
|
+
var RadialChart = (0, import_core26.forwardRef)((props, ref) => {
|
3844
|
+
const [styles, mergedProps] = (0, import_core26.useMultiComponentStyle)("RadialChart", props);
|
3845
|
+
const {
|
3846
|
+
className,
|
3847
|
+
data,
|
3848
|
+
dataKey,
|
3849
|
+
chartProps,
|
3850
|
+
radialBarProps,
|
3851
|
+
containerProps,
|
3852
|
+
withPolarGrid = false,
|
3853
|
+
withTooltip = true,
|
3854
|
+
withLegend = false,
|
3855
|
+
tooltipProps,
|
3856
|
+
tooltipAnimationDuration,
|
3857
|
+
tooltipDataSource = "all",
|
3858
|
+
valueFormatter,
|
3859
|
+
unit,
|
3860
|
+
legendProps,
|
3861
|
+
innerRadius,
|
3862
|
+
outerRadius,
|
3863
|
+
startAngle,
|
3864
|
+
endAngle,
|
3865
|
+
fillOpacity,
|
3866
|
+
labelListProps = [],
|
3867
|
+
polarGridProps,
|
3868
|
+
strokeDasharray,
|
3869
|
+
...rest
|
3870
|
+
} = (0, import_core26.omitThemeProps)(mergedProps);
|
3871
|
+
const {
|
3872
|
+
getRadialChartProps,
|
3873
|
+
getRadialBarProps,
|
3874
|
+
radialVars,
|
3875
|
+
setHighlightedArea
|
3876
|
+
} = useRadialChart({
|
3877
|
+
data,
|
3878
|
+
dataKey,
|
3879
|
+
styles,
|
3880
|
+
chartProps,
|
3881
|
+
radialBarProps,
|
3882
|
+
innerRadius,
|
3883
|
+
outerRadius,
|
3884
|
+
startAngle,
|
3885
|
+
endAngle,
|
3886
|
+
fillOpacity
|
3887
|
+
});
|
3888
|
+
const { getContainerProps } = useChart({ containerProps });
|
3889
|
+
const { tooltipProps: computedTooltipProps, getTooltipProps } = useChartTooltip({
|
3890
|
+
tooltipProps,
|
3891
|
+
tooltipAnimationDuration,
|
3892
|
+
styles
|
3893
|
+
});
|
3894
|
+
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
3895
|
+
legendProps
|
3896
|
+
});
|
3897
|
+
const { getLabelLineProps } = useChartLabelList({ labelListProps, styles });
|
3898
|
+
const { getPolarGridProps } = usePolarGrid({
|
3899
|
+
polarGridProps,
|
3900
|
+
strokeDasharray,
|
3901
|
+
styles
|
3902
|
+
});
|
3903
|
+
const labelLists = (0, import_react22.useMemo)(
|
3904
|
+
() => labelListProps.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3905
|
+
import_recharts8.LabelList,
|
3906
|
+
{
|
3907
|
+
...getLabelLineProps({
|
3908
|
+
index,
|
3909
|
+
className: "ui-radial-chart__label-list"
|
3910
|
+
})
|
3911
|
+
},
|
3912
|
+
`labelList-${index}`
|
3913
|
+
)),
|
3914
|
+
[getLabelLineProps, labelListProps]
|
3915
|
+
);
|
3916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3917
|
+
import_core26.ui.div,
|
3918
|
+
{
|
3919
|
+
ref,
|
3920
|
+
className: (0, import_utils26.cx)("ui-radial-chart", className),
|
3921
|
+
var: radialVars,
|
3922
|
+
__css: { maxW: "full", ...styles.container },
|
3923
|
+
...rest,
|
3924
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3925
|
+
import_recharts8.ResponsiveContainer,
|
3926
|
+
{
|
3927
|
+
...getContainerProps({ className: "ui-radial-chart__container" }),
|
3928
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
3929
|
+
import_recharts8.RadialBarChart,
|
3930
|
+
{
|
3931
|
+
...getRadialChartProps({
|
3932
|
+
className: "ui-radial-chart__chart"
|
3933
|
+
}),
|
3934
|
+
children: [
|
3935
|
+
withPolarGrid ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3936
|
+
import_recharts8.PolarGrid,
|
3937
|
+
{
|
3938
|
+
...getPolarGridProps({
|
3939
|
+
className: "ui-radial-chart__polar-grid"
|
3940
|
+
})
|
3941
|
+
}
|
3942
|
+
) : null,
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3944
|
+
import_recharts8.RadialBar,
|
3945
|
+
{
|
3946
|
+
...getRadialBarProps({
|
3947
|
+
className: "ui-radial-chart__radial-bar"
|
3948
|
+
}),
|
3949
|
+
children: labelLists
|
3950
|
+
}
|
3951
|
+
),
|
3952
|
+
withLegend ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3953
|
+
import_recharts8.Legend,
|
3954
|
+
{
|
3955
|
+
content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3956
|
+
ChartLegend,
|
3957
|
+
{
|
3958
|
+
className: "ui-radial-chart__legend",
|
3959
|
+
payload,
|
3960
|
+
onHighlight: setHighlightedArea,
|
3961
|
+
...computedLegendProps
|
3962
|
+
}
|
3963
|
+
),
|
3964
|
+
...getLegendProps()
|
3965
|
+
}
|
3966
|
+
) : null,
|
3967
|
+
withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3968
|
+
import_recharts8.Tooltip,
|
3969
|
+
{
|
3970
|
+
content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3971
|
+
ChartTooltip,
|
3972
|
+
{
|
3973
|
+
className: "ui-radial-chart__tooltip",
|
3974
|
+
isRadialChart: tooltipDataSource === "segment" ? true : false,
|
3975
|
+
payload: tooltipDataSource === "segment" ? payload : data,
|
3976
|
+
valueFormatter,
|
3977
|
+
unit,
|
3978
|
+
...computedTooltipProps
|
3979
|
+
}
|
3980
|
+
),
|
3981
|
+
...getTooltipProps()
|
3982
|
+
}
|
3983
|
+
) : null
|
3984
|
+
]
|
3985
|
+
}
|
3986
|
+
)
|
3987
|
+
}
|
3988
|
+
)
|
3989
|
+
}
|
3990
|
+
) });
|
3991
|
+
});
|
3992
|
+
|
3993
|
+
// src/index.ts
|
3994
|
+
var import_recharts9 = require("recharts");
|
3593
3995
|
// Annotate the CommonJS export names for ESM import in node:
|
3594
3996
|
0 && (module.exports = {
|
3595
3997
|
AreaChart,
|
@@ -3598,6 +4000,7 @@ var import_recharts8 = require("recharts");
|
|
3598
4000
|
DonutChart,
|
3599
4001
|
LineChart,
|
3600
4002
|
PieChart,
|
3601
|
-
RadarChart
|
4003
|
+
RadarChart,
|
4004
|
+
RadialChart
|
3602
4005
|
});
|
3603
4006
|
//# sourceMappingURL=index.js.map
|