@yamada-ui/charts 2.0.0-next-20240820160301 → 2.0.0-next-20240908154823
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/README.md +7 -13
- 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 +1 -2
- package/dist/area-chart.d.ts +1 -2
- package/dist/area-chart.js +57 -50
- package/dist/area-chart.js.map +1 -1
- package/dist/area-chart.mjs +12 -12
- package/dist/bar-chart.d.mts +1 -2
- package/dist/bar-chart.d.ts +1 -2
- package/dist/bar-chart.js +15 -9
- 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 +12 -5
- package/dist/chart.types.d.ts +12 -5
- 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-FALZDKAW.mjs → chunk-3VKCTSPC.mjs} +10 -11
- package/dist/chunk-3VKCTSPC.mjs.map +1 -0
- package/dist/{chunk-S5NKKKV5.mjs → chunk-5PSRSNGH.mjs} +7 -8
- package/dist/chunk-5PSRSNGH.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-KBBHISBO.mjs → chunk-BYL7HWNN.mjs} +13 -14
- package/dist/chunk-BYL7HWNN.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-6L73M52L.mjs → chunk-FPFCMFCJ.mjs} +7 -9
- package/dist/chunk-FPFCMFCJ.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-KVE6VXTJ.mjs +37 -0
- package/dist/chunk-KVE6VXTJ.mjs.map +1 -0
- package/dist/{chunk-PNE3JG54.mjs → chunk-MGTMKKSH.mjs} +5 -3
- package/dist/chunk-MGTMKKSH.mjs.map +1 -0
- package/dist/chunk-PG7ZV76C.mjs +155 -0
- package/dist/chunk-PG7ZV76C.mjs.map +1 -0
- package/dist/{chunk-D7EZKGCJ.mjs → chunk-PPBHLDVN.mjs} +2 -2
- package/dist/{chunk-AODYT4HF.mjs → chunk-RKO6KM3T.mjs} +13 -14
- package/dist/chunk-RKO6KM3T.mjs.map +1 -0
- package/dist/chunk-SBPKRYF2.mjs +199 -0
- package/dist/chunk-SBPKRYF2.mjs.map +1 -0
- package/dist/{chunk-FCMP6QEZ.mjs → chunk-SWATR7CU.mjs} +14 -15
- package/dist/chunk-SWATR7CU.mjs.map +1 -0
- 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-UHQ6WE5D.mjs → chunk-TMHSYM3V.mjs} +17 -13
- package/dist/chunk-TMHSYM3V.mjs.map +1 -0
- package/dist/{chunk-AOGTJ4EN.mjs → chunk-VMBRDEM2.mjs} +2 -2
- package/dist/{chunk-XUAAKVRL.mjs → chunk-WMG5U5AU.mjs} +26 -13
- package/dist/chunk-WMG5U5AU.mjs.map +1 -0
- package/dist/{chunk-6BNJZIBK.mjs → chunk-X7XFG7TS.mjs} +10 -12
- package/dist/chunk-X7XFG7TS.mjs.map +1 -0
- package/dist/{chunk-MOFNE6PO.mjs → chunk-XRF3TNSQ.mjs} +6 -30
- package/dist/chunk-XRF3TNSQ.mjs.map +1 -0
- package/dist/{chunk-VK4VQQYY.mjs → chunk-YNJ423BR.mjs} +2 -2
- package/dist/{chunk-BGMNYKQY.mjs → chunk-ZQWVMOT6.mjs} +9 -7
- package/dist/chunk-ZQWVMOT6.mjs.map +1 -0
- package/dist/donut-chart.d.mts +3 -3
- package/dist/donut-chart.d.ts +3 -3
- package/dist/donut-chart.js +109 -58
- package/dist/donut-chart.js.map +1 -1
- package/dist/donut-chart.mjs +9 -8
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +599 -167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -22
- package/dist/index.mjs.map +1 -1
- package/dist/line-chart.d.mts +1 -2
- package/dist/line-chart.d.ts +1 -2
- package/dist/line-chart.js +15 -10
- package/dist/line-chart.js.map +1 -1
- package/dist/line-chart.mjs +11 -11
- package/dist/pie-chart.d.mts +2 -3
- package/dist/pie-chart.d.ts +2 -3
- package/dist/pie-chart.js +13 -7
- package/dist/pie-chart.js.map +1 -1
- package/dist/pie-chart.mjs +8 -8
- package/dist/radar-chart.d.mts +3 -3
- package/dist/radar-chart.d.ts +3 -3
- package/dist/radar-chart.js +90 -70
- 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 +767 -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 +1 -2
- package/dist/use-area-chart.d.ts +1 -2
- 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 +1 -2
- package/dist/use-bar-chart.d.ts +1 -2
- package/dist/use-bar-chart.js +4 -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 +20 -0
- package/dist/use-chart-label.d.ts +20 -0
- package/dist/use-chart-label.js +82 -0
- package/dist/use-chart-label.js.map +1 -0
- package/dist/use-chart-label.mjs +10 -0
- package/dist/use-chart-label.mjs.map +1 -0
- 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 +1 -2
- package/dist/use-line-chart.d.ts +1 -2
- 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 +1 -2
- package/dist/use-pie-chart.d.ts +1 -2
- 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 +3 -13
- package/dist/use-radar-chart.d.ts +3 -13
- 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 +4 -4
- package/dist/chunk-6BNJZIBK.mjs.map +0 -1
- package/dist/chunk-6L73M52L.mjs.map +0 -1
- package/dist/chunk-AODYT4HF.mjs.map +0 -1
- package/dist/chunk-BGMNYKQY.mjs.map +0 -1
- package/dist/chunk-F34FV5DY.mjs.map +0 -1
- package/dist/chunk-FALZDKAW.mjs.map +0 -1
- package/dist/chunk-FCMP6QEZ.mjs.map +0 -1
- package/dist/chunk-KBBHISBO.mjs.map +0 -1
- package/dist/chunk-MOFNE6PO.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-S5NKKKV5.mjs.map +0 -1
- package/dist/chunk-UHQ6WE5D.mjs.map +0 -1
- package/dist/chunk-XUAAKVRL.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-D7EZKGCJ.mjs.map → chunk-PPBHLDVN.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(
|
@@ -1069,7 +1129,7 @@ var useLineChart = ({
|
|
1069
1129
|
dimLine: dimLine2 = {},
|
1070
1130
|
...computedProps
|
1071
1131
|
} = props;
|
1072
|
-
const color = `
|
1132
|
+
const color = (0, import_core9.getVar)(`line-${index}`)(theme);
|
1073
1133
|
const dimmed = shouldHighlight && highlightedArea !== dataKey;
|
1074
1134
|
const computedDimLine = { ...dimLineProps, ...dimLine2 };
|
1075
1135
|
const resolvedProps = {
|
@@ -1341,8 +1401,7 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1341
1401
|
{
|
1342
1402
|
ref,
|
1343
1403
|
className: (0, import_utils11.cx)("ui-line-chart", className),
|
1344
|
-
|
1345
|
-
__css: { ...styles.container },
|
1404
|
+
__css: { maxW: "full", vars: lineVars, ...styles.container },
|
1346
1405
|
...rest,
|
1347
1406
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
1348
1407
|
import_recharts.ResponsiveContainer,
|
@@ -1459,7 +1518,6 @@ var useBarChart = ({
|
|
1459
1518
|
} = (_a = rest.barProps) != null ? _a : {};
|
1460
1519
|
const barColors = (0, import_react9.useMemo)(
|
1461
1520
|
() => series.map(({ color }, index) => ({
|
1462
|
-
__prefix: "ui",
|
1463
1521
|
name: `bar-${index}`,
|
1464
1522
|
token: "colors",
|
1465
1523
|
value: color != null ? color : "transparent"
|
@@ -1468,7 +1526,6 @@ var useBarChart = ({
|
|
1468
1526
|
);
|
1469
1527
|
const referenceLineColors = (0, import_react9.useMemo)(
|
1470
1528
|
() => referenceLineProps.map(({ color }, index) => ({
|
1471
|
-
__prefix: "ui",
|
1472
1529
|
name: `reference-line-${index}`,
|
1473
1530
|
token: "colors",
|
1474
1531
|
value: color != null ? color : "transparent"
|
@@ -1479,7 +1536,7 @@ var useBarChart = ({
|
|
1479
1536
|
return [
|
1480
1537
|
...barColors,
|
1481
1538
|
...referenceLineColors,
|
1482
|
-
{
|
1539
|
+
{ name: "fill-opacity", value: fillOpacity }
|
1483
1540
|
];
|
1484
1541
|
}, [barColors, fillOpacity, referenceLineColors]);
|
1485
1542
|
const [chartProps, barChartClassName] = (0, import_react9.useMemo)(() => {
|
@@ -1491,7 +1548,8 @@ var useBarChart = ({
|
|
1491
1548
|
}, [rest.chartProps, styles.chart, theme]);
|
1492
1549
|
const [barProps, barClassName] = (0, import_react9.useMemo)(() => {
|
1493
1550
|
const resolvedBarProps = {
|
1494
|
-
fillOpacity: "
|
1551
|
+
fillOpacity: "$fill-opacity",
|
1552
|
+
strokeOpacity: 1,
|
1495
1553
|
...computedBarProps
|
1496
1554
|
};
|
1497
1555
|
return getComponentProps(
|
@@ -1530,7 +1588,7 @@ var useBarChart = ({
|
|
1530
1588
|
...computedProps
|
1531
1589
|
} = props;
|
1532
1590
|
const id = `${uuid}-${dataKey}`;
|
1533
|
-
const color = `
|
1591
|
+
const color = (0, import_core11.getVar)(`bar-${index}`)(theme);
|
1534
1592
|
const dimmed = shouldHighlight && highlightedArea !== dataKey;
|
1535
1593
|
const computedDimBar = { ...dimBarProps, ...dimBar2 };
|
1536
1594
|
const resolvedProps = {
|
@@ -1785,8 +1843,7 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1785
1843
|
{
|
1786
1844
|
ref,
|
1787
1845
|
className: (0, import_utils13.cx)("ui-bar-chart", className),
|
1788
|
-
|
1789
|
-
__css: { ...styles.container },
|
1846
|
+
__css: { maxW: "full", vars: barVars, ...styles.container },
|
1790
1847
|
...rest,
|
1791
1848
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1792
1849
|
import_recharts3.ResponsiveContainer,
|
@@ -1864,7 +1921,7 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1864
1921
|
});
|
1865
1922
|
|
1866
1923
|
// src/area-chart.tsx
|
1867
|
-
var
|
1924
|
+
var import_core15 = require("@yamada-ui/core");
|
1868
1925
|
var import_utils15 = require("@yamada-ui/utils");
|
1869
1926
|
var import_react12 = require("react");
|
1870
1927
|
var import_recharts4 = require("recharts");
|
@@ -1888,14 +1945,16 @@ var AreaGradient = ({
|
|
1888
1945
|
};
|
1889
1946
|
|
1890
1947
|
// src/area-chart-split.tsx
|
1948
|
+
var import_core13 = require("@yamada-ui/core");
|
1891
1949
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
1892
1950
|
var AreaSplit = ({ offset, id, fillOpacity }) => {
|
1951
|
+
const { theme } = (0, import_core13.useTheme)();
|
1893
1952
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
1894
1953
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
1895
1954
|
"stop",
|
1896
1955
|
{
|
1897
1956
|
offset,
|
1898
|
-
stopColor:
|
1957
|
+
stopColor: (0, import_core13.getVar)(`area-split-0`)(theme),
|
1899
1958
|
stopOpacity: fillOpacity != null ? fillOpacity : 0.4
|
1900
1959
|
}
|
1901
1960
|
),
|
@@ -1903,7 +1962,7 @@ var AreaSplit = ({ offset, id, fillOpacity }) => {
|
|
1903
1962
|
"stop",
|
1904
1963
|
{
|
1905
1964
|
offset,
|
1906
|
-
stopColor:
|
1965
|
+
stopColor: (0, import_core13.getVar)(`area-split-1`)(theme),
|
1907
1966
|
stopOpacity: fillOpacity != null ? fillOpacity : 0.4
|
1908
1967
|
}
|
1909
1968
|
)
|
@@ -1911,7 +1970,7 @@ var AreaSplit = ({ offset, id, fillOpacity }) => {
|
|
1911
1970
|
};
|
1912
1971
|
|
1913
1972
|
// src/use-area-chart.ts
|
1914
|
-
var
|
1973
|
+
var import_core14 = require("@yamada-ui/core");
|
1915
1974
|
var import_utils14 = require("@yamada-ui/utils");
|
1916
1975
|
var import_react11 = require("react");
|
1917
1976
|
var useAreaChart = ({
|
@@ -1937,7 +1996,7 @@ var useAreaChart = ({
|
|
1937
1996
|
}) => {
|
1938
1997
|
var _a;
|
1939
1998
|
const uuid = (0, import_react11.useId)();
|
1940
|
-
const { theme } = (0,
|
1999
|
+
const { theme } = (0, import_core14.useTheme)();
|
1941
2000
|
const [highlightedArea, setHighlightedArea] = (0, import_react11.useState)(null);
|
1942
2001
|
const splitId = `${uuid}-split`;
|
1943
2002
|
const stacked = type === "stacked" || type === "percent";
|
@@ -1952,7 +2011,6 @@ var useAreaChart = ({
|
|
1952
2011
|
} = (_a = rest.areaProps) != null ? _a : {};
|
1953
2012
|
const areaColors = (0, import_react11.useMemo)(
|
1954
2013
|
() => series.map(({ color }, index) => ({
|
1955
|
-
__prefix: "ui",
|
1956
2014
|
name: `area-${index}`,
|
1957
2015
|
token: "colors",
|
1958
2016
|
value: color != null ? color : "transparent"
|
@@ -1961,7 +2019,6 @@ var useAreaChart = ({
|
|
1961
2019
|
);
|
1962
2020
|
const areaSplitColors = (0, import_react11.useMemo)(
|
1963
2021
|
() => splitColors.map((color, index) => ({
|
1964
|
-
__prefix: "ui",
|
1965
2022
|
name: `area-split-${index}`,
|
1966
2023
|
token: "colors",
|
1967
2024
|
value: color != null ? color : "transparent"
|
@@ -1970,7 +2027,6 @@ var useAreaChart = ({
|
|
1970
2027
|
);
|
1971
2028
|
const referenceLineColors = (0, import_react11.useMemo)(
|
1972
2029
|
() => referenceLineProps ? referenceLineProps.map(({ color }, index) => ({
|
1973
|
-
__prefix: "ui",
|
1974
2030
|
name: `reference-line-${index}`,
|
1975
2031
|
token: "colors",
|
1976
2032
|
value: color != null ? color : "transparent"
|
@@ -1982,9 +2038,10 @@ var useAreaChart = ({
|
|
1982
2038
|
...areaColors,
|
1983
2039
|
...areaSplitColors,
|
1984
2040
|
...referenceLineColors,
|
1985
|
-
{
|
2041
|
+
{ name: "fill-opacity", value: fillOpacity }
|
1986
2042
|
];
|
1987
2043
|
}, [areaColors, areaSplitColors, referenceLineColors, fillOpacity]);
|
2044
|
+
const fillOpacityVar = (0, import_react11.useMemo)(() => (0, import_core14.getVar)("fill-opacity")(theme), [theme]);
|
1988
2045
|
const [chartProps, areaChartClassName] = (0, import_react11.useMemo)(
|
1989
2046
|
() => {
|
1990
2047
|
var _a2;
|
@@ -2052,7 +2109,7 @@ var useAreaChart = ({
|
|
2052
2109
|
...computedProps
|
2053
2110
|
} = props;
|
2054
2111
|
const id = `${uuid}-${dataKey}`;
|
2055
|
-
const color = `
|
2112
|
+
const color = (0, import_core14.getVar)(`area-${index}`)(theme);
|
2056
2113
|
const dimmed = shouldHighlight && highlightedArea !== dataKey;
|
2057
2114
|
const computedDimArea = { ...dimAreaProps, ...dimArea2 };
|
2058
2115
|
const resolvedProps = {
|
@@ -2168,10 +2225,10 @@ var useAreaChart = ({
|
|
2168
2225
|
(props = {}) => ({
|
2169
2226
|
id: splitId,
|
2170
2227
|
offset: splitOffset != null ? splitOffset : defaultSplitOffset,
|
2171
|
-
fillOpacity:
|
2228
|
+
fillOpacity: fillOpacityVar,
|
2172
2229
|
...props
|
2173
2230
|
}),
|
2174
|
-
[defaultSplitOffset, splitId, splitOffset]
|
2231
|
+
[defaultSplitOffset, splitId, splitOffset, fillOpacityVar]
|
2175
2232
|
);
|
2176
2233
|
const getAreaProps = (0, import_react11.useCallback)(
|
2177
2234
|
({ index, className: classNameProp, ...props }, ref = null) => {
|
@@ -2218,10 +2275,10 @@ var useAreaChart = ({
|
|
2218
2275
|
const getAreaGradientProps = (0, import_react11.useCallback)(
|
2219
2276
|
(props = {}) => ({
|
2220
2277
|
withGradient,
|
2221
|
-
fillOpacity:
|
2278
|
+
fillOpacity: fillOpacityVar,
|
2222
2279
|
...props
|
2223
2280
|
}),
|
2224
|
-
[withGradient]
|
2281
|
+
[withGradient, fillOpacityVar]
|
2225
2282
|
);
|
2226
2283
|
return {
|
2227
2284
|
getAreaChartProps,
|
@@ -2235,8 +2292,8 @@ var useAreaChart = ({
|
|
2235
2292
|
|
2236
2293
|
// src/area-chart.tsx
|
2237
2294
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
2238
|
-
var AreaChart = (0,
|
2239
|
-
const [styles, mergedProps] = (0,
|
2295
|
+
var AreaChart = (0, import_core15.forwardRef)((props, ref) => {
|
2296
|
+
const [styles, mergedProps] = (0, import_core15.useMultiComponentStyle)("AreaChart", props);
|
2240
2297
|
const {
|
2241
2298
|
className,
|
2242
2299
|
series,
|
@@ -2281,7 +2338,7 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2281
2338
|
splitOffset,
|
2282
2339
|
syncId,
|
2283
2340
|
...rest
|
2284
|
-
} = (0,
|
2341
|
+
} = (0, import_core15.omitThemeProps)(mergedProps);
|
2285
2342
|
const {
|
2286
2343
|
getAreaChartProps,
|
2287
2344
|
getAreaSplitProps,
|
@@ -2381,12 +2438,11 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2381
2438
|
[getReferenceLineProps, referenceLineProps]
|
2382
2439
|
);
|
2383
2440
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2384
|
-
|
2441
|
+
import_core15.ui.div,
|
2385
2442
|
{
|
2386
2443
|
ref,
|
2387
2444
|
className: (0, import_utils15.cx)("ui-area-chart", className),
|
2388
|
-
|
2389
|
-
__css: { ...styles.container },
|
2445
|
+
__css: { maxW: "full", vars: areaVars, ...styles.container },
|
2390
2446
|
...rest,
|
2391
2447
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2392
2448
|
import_recharts4.ResponsiveContainer,
|
@@ -2465,15 +2521,48 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2465
2521
|
});
|
2466
2522
|
|
2467
2523
|
// src/radar-chart.tsx
|
2468
|
-
var
|
2469
|
-
var
|
2470
|
-
var
|
2524
|
+
var import_core18 = require("@yamada-ui/core");
|
2525
|
+
var import_utils18 = require("@yamada-ui/utils");
|
2526
|
+
var import_react15 = require("react");
|
2471
2527
|
var import_recharts5 = require("recharts");
|
2472
2528
|
|
2473
|
-
// src/use-
|
2474
|
-
var
|
2529
|
+
// src/use-polar-grid.tsx
|
2530
|
+
var import_core16 = require("@yamada-ui/core");
|
2475
2531
|
var import_utils16 = require("@yamada-ui/utils");
|
2476
2532
|
var import_react13 = require("react");
|
2533
|
+
var usePolarGrid = ({
|
2534
|
+
strokeDasharray,
|
2535
|
+
styles,
|
2536
|
+
...rest
|
2537
|
+
}) => {
|
2538
|
+
const { theme } = (0, import_core16.useTheme)();
|
2539
|
+
const [polarGridProps, polarGridClassName] = (0, import_react13.useMemo)(
|
2540
|
+
() => {
|
2541
|
+
var _a;
|
2542
|
+
return getComponentProps(
|
2543
|
+
[(_a = rest.polarGridProps) != null ? _a : {}, polarGridProperties],
|
2544
|
+
styles.polarGrid
|
2545
|
+
)(theme);
|
2546
|
+
},
|
2547
|
+
[rest.polarGridProps, styles.polarGrid, theme]
|
2548
|
+
);
|
2549
|
+
const getPolarGridProps = (0, import_react13.useCallback)(
|
2550
|
+
({ className, ...props } = {}, ref = null) => ({
|
2551
|
+
ref,
|
2552
|
+
className: (0, import_utils16.cx)(className, polarGridClassName),
|
2553
|
+
strokeDasharray,
|
2554
|
+
...props,
|
2555
|
+
...polarGridProps
|
2556
|
+
}),
|
2557
|
+
[polarGridClassName, polarGridProps, strokeDasharray]
|
2558
|
+
);
|
2559
|
+
return { getPolarGridProps };
|
2560
|
+
};
|
2561
|
+
|
2562
|
+
// src/use-radar-chart.ts
|
2563
|
+
var import_core17 = require("@yamada-ui/core");
|
2564
|
+
var import_utils17 = require("@yamada-ui/utils");
|
2565
|
+
var import_react14 = require("react");
|
2477
2566
|
var useRadarChart = ({
|
2478
2567
|
data,
|
2479
2568
|
series,
|
@@ -2484,13 +2573,12 @@ var useRadarChart = ({
|
|
2484
2573
|
fillOpacity = 0.4,
|
2485
2574
|
polarAngleAxisTickFormatter,
|
2486
2575
|
polarRadiusAxisTickFormatter,
|
2487
|
-
strokeDasharray,
|
2488
2576
|
styles,
|
2489
2577
|
...rest
|
2490
2578
|
}) => {
|
2491
2579
|
var _a;
|
2492
|
-
const { theme } = (0,
|
2493
|
-
const [highlightedArea, setHighlightedArea] = (0,
|
2580
|
+
const { theme } = (0, import_core17.useTheme)();
|
2581
|
+
const [highlightedArea, setHighlightedArea] = (0, import_react14.useState)(null);
|
2494
2582
|
const shouldHighlight = highlightedArea !== null;
|
2495
2583
|
const {
|
2496
2584
|
dot = {},
|
@@ -2499,23 +2587,22 @@ var useRadarChart = ({
|
|
2499
2587
|
dimRadar = {},
|
2500
2588
|
...computedRadarProps
|
2501
2589
|
} = (_a = rest.radarProps) != null ? _a : {};
|
2502
|
-
const radarColors = (0,
|
2590
|
+
const radarColors = (0, import_react14.useMemo)(
|
2503
2591
|
() => series.map(({ color }, index) => ({
|
2504
|
-
__prefix: "ui",
|
2505
2592
|
name: `radar-${index}`,
|
2506
2593
|
token: "colors",
|
2507
2594
|
value: color != null ? color : "transparent"
|
2508
2595
|
})),
|
2509
2596
|
[series]
|
2510
2597
|
);
|
2511
|
-
const radarVars = (0,
|
2598
|
+
const radarVars = (0, import_react14.useMemo)(
|
2512
2599
|
() => [
|
2513
2600
|
...radarColors,
|
2514
|
-
{
|
2601
|
+
{ name: "fill-opacity", value: fillOpacity }
|
2515
2602
|
],
|
2516
2603
|
[fillOpacity, radarColors]
|
2517
2604
|
);
|
2518
|
-
const [chartProps, radarChartClassName] = (0,
|
2605
|
+
const [chartProps, radarChartClassName] = (0, import_react14.useMemo)(
|
2519
2606
|
() => {
|
2520
2607
|
var _a2;
|
2521
2608
|
return getComponentProps(
|
@@ -2525,17 +2612,7 @@ var useRadarChart = ({
|
|
2525
2612
|
},
|
2526
2613
|
[rest.chartProps, styles.chart, theme]
|
2527
2614
|
);
|
2528
|
-
const [
|
2529
|
-
() => {
|
2530
|
-
var _a2;
|
2531
|
-
return getComponentProps(
|
2532
|
-
[(_a2 = rest.polarGridProps) != null ? _a2 : {}, polarGridProperties],
|
2533
|
-
styles.polarGrid
|
2534
|
-
)(theme);
|
2535
|
-
},
|
2536
|
-
[rest.polarGridProps, styles.polarGrid, theme]
|
2537
|
-
);
|
2538
|
-
const [polarAngleAxisProps, polarAngleAxisClassName] = (0, import_react13.useMemo)(
|
2615
|
+
const [polarAngleAxisProps, polarAngleAxisClassName] = (0, import_react14.useMemo)(
|
2539
2616
|
() => {
|
2540
2617
|
var _a2;
|
2541
2618
|
return getComponentProps(
|
@@ -2545,14 +2622,14 @@ var useRadarChart = ({
|
|
2545
2622
|
},
|
2546
2623
|
[rest.polarAngleAxisProps, styles.polarAngleAxis, theme]
|
2547
2624
|
);
|
2548
|
-
const polarAngleAxisTickClassName = (0,
|
2625
|
+
const polarAngleAxisTickClassName = (0, import_react14.useMemo)(
|
2549
2626
|
() => getClassName({
|
2550
2627
|
...styles.polarAngleAxisTick,
|
2551
2628
|
...rest.polarAngleAxisTickProps
|
2552
2629
|
})(theme),
|
2553
2630
|
[rest.polarAngleAxisTickProps, styles.polarAngleAxisTick, theme]
|
2554
2631
|
);
|
2555
|
-
const [polarRadiusAxisProps, polarRadiusAxisClassName] = (0,
|
2632
|
+
const [polarRadiusAxisProps, polarRadiusAxisClassName] = (0, import_react14.useMemo)(
|
2556
2633
|
() => {
|
2557
2634
|
var _a2;
|
2558
2635
|
return getComponentProps(
|
@@ -2562,16 +2639,16 @@ var useRadarChart = ({
|
|
2562
2639
|
},
|
2563
2640
|
[rest.polarRadiusAxisProps, styles.polarRadiusAxis, theme]
|
2564
2641
|
);
|
2565
|
-
const polarRadiusAxisTickClassName = (0,
|
2642
|
+
const polarRadiusAxisTickClassName = (0, import_react14.useMemo)(
|
2566
2643
|
() => getClassName({
|
2567
2644
|
...styles.polarRadiusAxisTick,
|
2568
2645
|
...rest.polarRadiusAxisTickProps
|
2569
2646
|
})(theme),
|
2570
2647
|
[rest.polarRadiusAxisTickProps, styles.polarRadiusAxisTick, theme]
|
2571
2648
|
);
|
2572
|
-
const [radarProps, radarClassName] = (0,
|
2649
|
+
const [radarProps, radarClassName] = (0, import_react14.useMemo)(() => {
|
2573
2650
|
const resolvedRadarProps = {
|
2574
|
-
fillOpacity: "
|
2651
|
+
fillOpacity: "$fill-opacity",
|
2575
2652
|
...computedRadarProps
|
2576
2653
|
};
|
2577
2654
|
return getComponentProps(
|
@@ -2579,32 +2656,32 @@ var useRadarChart = ({
|
|
2579
2656
|
styles.radar
|
2580
2657
|
)(theme);
|
2581
2658
|
}, [computedRadarProps, styles.radar, theme]);
|
2582
|
-
const [dimRadarProps, dimRadarClassName] = (0,
|
2659
|
+
const [dimRadarProps, dimRadarClassName] = (0, import_react14.useMemo)(
|
2583
2660
|
() => getComponentProps(
|
2584
2661
|
[dimRadar, radarProperties],
|
2585
2662
|
styles.dimRadar
|
2586
2663
|
)(theme),
|
2587
2664
|
[dimRadar, styles.dimRadar, theme]
|
2588
2665
|
);
|
2589
|
-
const [dotProps, dotClassName] = (0,
|
2666
|
+
const [dotProps, dotClassName] = (0, import_react14.useMemo)(
|
2590
2667
|
() => getComponentProps([dot, dotProperties], styles.dot)(theme),
|
2591
2668
|
[dot, styles.dot, theme]
|
2592
2669
|
);
|
2593
|
-
const [activeDotProps, activeDotClassName] = (0,
|
2670
|
+
const [activeDotProps, activeDotClassName] = (0, import_react14.useMemo)(
|
2594
2671
|
() => getComponentProps(
|
2595
2672
|
[activeDot, dotProperties],
|
2596
2673
|
styles.activeDot
|
2597
2674
|
)(theme),
|
2598
2675
|
[activeDot, styles.activeDot, theme]
|
2599
2676
|
);
|
2600
|
-
const [dimDotProps, dimDotClassName] = (0,
|
2677
|
+
const [dimDotProps, dimDotClassName] = (0, import_react14.useMemo)(
|
2601
2678
|
() => getComponentProps(
|
2602
2679
|
[dimDot, dotProperties],
|
2603
2680
|
styles.dimDot
|
2604
2681
|
)(theme),
|
2605
2682
|
[dimDot, styles.dimDot, theme]
|
2606
2683
|
);
|
2607
|
-
const radarPropList = (0,
|
2684
|
+
const radarPropList = (0, import_react14.useMemo)(
|
2608
2685
|
() => series.map((props, index) => {
|
2609
2686
|
const {
|
2610
2687
|
dataKey: dataKey2,
|
@@ -2614,7 +2691,7 @@ var useRadarChart = ({
|
|
2614
2691
|
dimRadar: dimRadar2 = {},
|
2615
2692
|
...computedProps
|
2616
2693
|
} = props;
|
2617
|
-
const color = `
|
2694
|
+
const color = (0, import_core17.getVar)(`radar-${index}`)(theme);
|
2618
2695
|
const dimmed = shouldHighlight && highlightedArea !== dataKey2;
|
2619
2696
|
const computedDimRadar = { ...dimRadarProps, ...dimRadar2 };
|
2620
2697
|
const resolvedProps = {
|
@@ -2638,7 +2715,7 @@ var useRadarChart = ({
|
|
2638
2715
|
activeDotClassName
|
2639
2716
|
)(theme);
|
2640
2717
|
resolvedActiveDot = {
|
2641
|
-
className: (0,
|
2718
|
+
className: (0, import_utils17.cx)(
|
2642
2719
|
"ui-radar-chart__dot",
|
2643
2720
|
"ui-radar-chart__dot--active",
|
2644
2721
|
className
|
@@ -2665,7 +2742,7 @@ var useRadarChart = ({
|
|
2665
2742
|
dimmed ? dimDotClassName : void 0
|
2666
2743
|
)(theme);
|
2667
2744
|
resolvedDot = {
|
2668
|
-
className: (0,
|
2745
|
+
className: (0, import_utils17.cx)("ui-radar-chart__dot", className),
|
2669
2746
|
fill: color,
|
2670
2747
|
r: 4,
|
2671
2748
|
...rest3
|
@@ -2700,22 +2777,22 @@ var useRadarChart = ({
|
|
2700
2777
|
withDots
|
2701
2778
|
]
|
2702
2779
|
);
|
2703
|
-
const getRadarChartProps = (0,
|
2780
|
+
const getRadarChartProps = (0, import_react14.useCallback)(
|
2704
2781
|
({ className, ...props } = {}, ref = null) => ({
|
2705
2782
|
ref,
|
2706
|
-
className: (0,
|
2783
|
+
className: (0, import_utils17.cx)(className, radarChartClassName),
|
2707
2784
|
data,
|
2708
2785
|
...props,
|
2709
2786
|
...chartProps
|
2710
2787
|
}),
|
2711
2788
|
[data, radarChartClassName, chartProps]
|
2712
2789
|
);
|
2713
|
-
const getRadarProps = (0,
|
2790
|
+
const getRadarProps = (0, import_react14.useCallback)(
|
2714
2791
|
({ index, className: classNameProp, ...props }, ref = null) => {
|
2715
2792
|
const { color, className, dataKey: dataKey2, activeDot: activeDot2, dot: dot2, ...rest2 } = radarPropList[index];
|
2716
2793
|
return {
|
2717
2794
|
ref,
|
2718
|
-
className: (0,
|
2795
|
+
className: (0, import_utils17.cx)(classNameProp, className),
|
2719
2796
|
activeDot: activeDot2,
|
2720
2797
|
dot: dot2,
|
2721
2798
|
name: dataKey2,
|
@@ -2730,23 +2807,13 @@ var useRadarChart = ({
|
|
2730
2807
|
},
|
2731
2808
|
[radarPropList, strokeWidth]
|
2732
2809
|
);
|
2733
|
-
const
|
2734
|
-
({ className, ...props } = {}, ref = null) => ({
|
2735
|
-
ref,
|
2736
|
-
className: (0, import_utils16.cx)(className, polarGridClassName),
|
2737
|
-
strokeDasharray,
|
2738
|
-
...props,
|
2739
|
-
...polarGridProps
|
2740
|
-
}),
|
2741
|
-
[polarGridClassName, polarGridProps, strokeDasharray]
|
2742
|
-
);
|
2743
|
-
const getPolarAngleAxisProps = (0, import_react13.useCallback)(
|
2810
|
+
const getPolarAngleAxisProps = (0, import_react14.useCallback)(
|
2744
2811
|
({ className, ...props } = {}, ref = null) => ({
|
2745
2812
|
ref,
|
2746
|
-
className: (0,
|
2813
|
+
className: (0, import_utils17.cx)(className, polarAngleAxisClassName),
|
2747
2814
|
dataKey,
|
2748
2815
|
tick: {
|
2749
|
-
className: (0,
|
2816
|
+
className: (0, import_utils17.cx)(
|
2750
2817
|
"ui-radar-chart__polar-angle-axis-tick",
|
2751
2818
|
polarAngleAxisTickClassName
|
2752
2819
|
)
|
@@ -2764,12 +2831,12 @@ var useRadarChart = ({
|
|
2764
2831
|
polarAngleAxisTickFormatter
|
2765
2832
|
]
|
2766
2833
|
);
|
2767
|
-
const getPolarRadiusAxisProps = (0,
|
2834
|
+
const getPolarRadiusAxisProps = (0, import_react14.useCallback)(
|
2768
2835
|
({ className, ...props } = {}, ref = null) => ({
|
2769
2836
|
ref,
|
2770
|
-
className: (0,
|
2837
|
+
className: (0, import_utils17.cx)(className, polarRadiusAxisClassName),
|
2771
2838
|
tick: {
|
2772
|
-
className: (0,
|
2839
|
+
className: (0, import_utils17.cx)(
|
2773
2840
|
"ui-radar-chart__polar-radius-axis-tick",
|
2774
2841
|
polarRadiusAxisTickClassName
|
2775
2842
|
)
|
@@ -2789,7 +2856,6 @@ var useRadarChart = ({
|
|
2789
2856
|
radarVars,
|
2790
2857
|
getRadarChartProps,
|
2791
2858
|
getRadarProps,
|
2792
|
-
getPolarGridProps,
|
2793
2859
|
getPolarAngleAxisProps,
|
2794
2860
|
getPolarRadiusAxisProps,
|
2795
2861
|
setHighlightedArea
|
@@ -2798,8 +2864,8 @@ var useRadarChart = ({
|
|
2798
2864
|
|
2799
2865
|
// src/radar-chart.tsx
|
2800
2866
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
2801
|
-
var RadarChart = (0,
|
2802
|
-
const [styles, mergedProps] = (0,
|
2867
|
+
var RadarChart = (0, import_core18.forwardRef)((props, ref) => {
|
2868
|
+
const [styles, mergedProps] = (0, import_core18.useMultiComponentStyle)("RadarChart", props);
|
2803
2869
|
const {
|
2804
2870
|
className,
|
2805
2871
|
data,
|
@@ -2831,11 +2897,10 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2831
2897
|
withPolarAngleAxis = true,
|
2832
2898
|
withPolarRadiusAxis = false,
|
2833
2899
|
...rest
|
2834
|
-
} = (0,
|
2900
|
+
} = (0, import_core18.omitThemeProps)(mergedProps);
|
2835
2901
|
const {
|
2836
2902
|
getRadarProps,
|
2837
2903
|
getRadarChartProps,
|
2838
|
-
getPolarGridProps,
|
2839
2904
|
getPolarAngleAxisProps,
|
2840
2905
|
getPolarRadiusAxisProps,
|
2841
2906
|
radarVars,
|
@@ -2846,7 +2911,6 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2846
2911
|
dataKey,
|
2847
2912
|
radarProps,
|
2848
2913
|
chartProps,
|
2849
|
-
polarGridProps,
|
2850
2914
|
polarAngleAxisProps,
|
2851
2915
|
polarAngleAxisTickProps,
|
2852
2916
|
polarRadiusAxisProps,
|
@@ -2857,7 +2921,6 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2857
2921
|
fillOpacity,
|
2858
2922
|
polarAngleAxisTickFormatter,
|
2859
2923
|
polarRadiusAxisTickFormatter,
|
2860
|
-
strokeDasharray,
|
2861
2924
|
styles
|
2862
2925
|
});
|
2863
2926
|
const { getContainerProps } = useChart({ containerProps });
|
@@ -2869,7 +2932,12 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2869
2932
|
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
2870
2933
|
legendProps
|
2871
2934
|
});
|
2872
|
-
const
|
2935
|
+
const { getPolarGridProps } = usePolarGrid({
|
2936
|
+
polarGridProps,
|
2937
|
+
strokeDasharray,
|
2938
|
+
styles
|
2939
|
+
});
|
2940
|
+
const radars = (0, import_react15.useMemo)(
|
2873
2941
|
() => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2874
2942
|
import_recharts5.Radar,
|
2875
2943
|
{
|
@@ -2880,12 +2948,11 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2880
2948
|
[getRadarProps, series]
|
2881
2949
|
);
|
2882
2950
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2883
|
-
|
2951
|
+
import_core18.ui.div,
|
2884
2952
|
{
|
2885
2953
|
ref,
|
2886
|
-
className: (0,
|
2887
|
-
|
2888
|
-
__css: { ...styles.container },
|
2954
|
+
className: (0, import_utils18.cx)("ui-radar-chart", className),
|
2955
|
+
__css: { maxW: "full", vars: radarVars, ...styles.container },
|
2889
2956
|
...rest,
|
2890
2957
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2891
2958
|
import_recharts5.ResponsiveContainer,
|
@@ -2963,19 +3030,44 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2963
3030
|
});
|
2964
3031
|
|
2965
3032
|
// src/donut-chart.tsx
|
3033
|
+
var import_core22 = require("@yamada-ui/core");
|
3034
|
+
var import_utils22 = require("@yamada-ui/utils");
|
3035
|
+
var import_react18 = require("react");
|
3036
|
+
var import_recharts6 = require("recharts");
|
3037
|
+
|
3038
|
+
// src/use-chart-label.ts
|
2966
3039
|
var import_core19 = require("@yamada-ui/core");
|
2967
|
-
var
|
3040
|
+
var import_utils19 = require("@yamada-ui/utils");
|
2968
3041
|
var import_react16 = require("react");
|
2969
|
-
var
|
3042
|
+
var useChartLabel = ({ styles, ...rest }) => {
|
3043
|
+
var _a;
|
3044
|
+
const { theme } = (0, import_core19.useTheme)();
|
3045
|
+
const [labelProps, labelClassName] = getComponentProps(
|
3046
|
+
[(_a = rest.labelProps) != null ? _a : {}, labelProperties],
|
3047
|
+
styles.label
|
3048
|
+
)(theme);
|
3049
|
+
const getLabelProps = (0, import_react16.useCallback)(
|
3050
|
+
({ className, ...props } = {}, ref = null) => {
|
3051
|
+
return {
|
3052
|
+
ref,
|
3053
|
+
className: (0, import_utils19.cx)(className, labelClassName),
|
3054
|
+
...props,
|
3055
|
+
...labelProps
|
3056
|
+
};
|
3057
|
+
},
|
3058
|
+
[labelClassName, labelProps]
|
3059
|
+
);
|
3060
|
+
return { getLabelProps };
|
3061
|
+
};
|
2970
3062
|
|
2971
3063
|
// src/use-pie-chart.ts
|
2972
|
-
var
|
2973
|
-
var
|
2974
|
-
var
|
3064
|
+
var import_core21 = require("@yamada-ui/core");
|
3065
|
+
var import_utils21 = require("@yamada-ui/utils");
|
3066
|
+
var import_react17 = require("react");
|
2975
3067
|
|
2976
3068
|
// src/pie-chart-label.tsx
|
2977
|
-
var
|
2978
|
-
var
|
3069
|
+
var import_core20 = require("@yamada-ui/core");
|
3070
|
+
var import_utils20 = require("@yamada-ui/utils");
|
2979
3071
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
2980
3072
|
var RADIAN = Math.PI / 180;
|
2981
3073
|
var DEFAULT_LABEL_OFFSET = 22;
|
@@ -3002,16 +3094,16 @@ var pieChartLabel = ({
|
|
3002
3094
|
const displayLabel = () => {
|
3003
3095
|
if (isPercent) {
|
3004
3096
|
return parseFloat((percent * 100).toFixed(0)) > 0 && `${(percent * 100).toFixed(0)}%`;
|
3005
|
-
} else if (!(0,
|
3097
|
+
} else if (!(0, import_utils20.isUndefined)(labelFormatter)) {
|
3006
3098
|
return labelFormatter(value);
|
3007
3099
|
} else {
|
3008
3100
|
return value;
|
3009
3101
|
}
|
3010
3102
|
};
|
3011
3103
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3012
|
-
|
3104
|
+
import_core20.ui.text,
|
3013
3105
|
{
|
3014
|
-
className: (0,
|
3106
|
+
className: (0, import_utils20.cx)(cellClassName, "ui-chart__label"),
|
3015
3107
|
x,
|
3016
3108
|
y,
|
3017
3109
|
textAnchor,
|
@@ -3040,9 +3132,9 @@ var pieChartLabelLine = ({
|
|
3040
3132
|
const y = cyProp + (middleRadius + labelOffset) * Math.sin(-midAngle * RADIAN);
|
3041
3133
|
const d = `M ${points[0].x} ${points[0].y} L ${x} ${y}`;
|
3042
3134
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3043
|
-
|
3135
|
+
import_core20.ui.path,
|
3044
3136
|
{
|
3045
|
-
className: (0,
|
3137
|
+
className: (0, import_utils20.cx)(cellClassName, "ui-chart__label-line"),
|
3046
3138
|
d,
|
3047
3139
|
__css: styles,
|
3048
3140
|
...labelLineProps
|
@@ -3069,8 +3161,8 @@ var usePieChart = ({
|
|
3069
3161
|
...rest
|
3070
3162
|
}) => {
|
3071
3163
|
var _a, _b;
|
3072
|
-
const { theme } = (0,
|
3073
|
-
const [highlightedArea, setHighlightedArea] = (0,
|
3164
|
+
const { theme } = (0, import_core21.useTheme)();
|
3165
|
+
const [highlightedArea, setHighlightedArea] = (0, import_react17.useState)(null);
|
3074
3166
|
const shouldHighlight = highlightedArea !== null;
|
3075
3167
|
const { dimCell, ...computedCellProps } = (_a = rest.cellProps) != null ? _a : {};
|
3076
3168
|
const {
|
@@ -3080,23 +3172,22 @@ var usePieChart = ({
|
|
3080
3172
|
labelLine: labelLineProps,
|
3081
3173
|
...computedPieProps
|
3082
3174
|
} = (_b = rest.pieProps) != null ? _b : {};
|
3083
|
-
const cellColors = (0,
|
3175
|
+
const cellColors = (0, import_react17.useMemo)(
|
3084
3176
|
() => data.map(({ color }, index) => ({
|
3085
|
-
__prefix: "ui",
|
3086
3177
|
name: `cell-${index}`,
|
3087
3178
|
token: "colors",
|
3088
3179
|
value: color != null ? color : "transparent"
|
3089
3180
|
})),
|
3090
3181
|
[data]
|
3091
3182
|
);
|
3092
|
-
const pieVars = (0,
|
3183
|
+
const pieVars = (0, import_react17.useMemo)(
|
3093
3184
|
() => [
|
3094
3185
|
...cellColors,
|
3095
|
-
{
|
3186
|
+
{ name: "fill-opacity", value: fillOpacity }
|
3096
3187
|
],
|
3097
3188
|
[fillOpacity, cellColors]
|
3098
3189
|
);
|
3099
|
-
const [chartProps, chartClassName] = (0,
|
3190
|
+
const [chartProps, chartClassName] = (0, import_react17.useMemo)(
|
3100
3191
|
() => {
|
3101
3192
|
var _a2;
|
3102
3193
|
return getComponentProps(
|
@@ -3106,40 +3197,40 @@ var usePieChart = ({
|
|
3106
3197
|
},
|
3107
3198
|
[rest.chartProps, styles.chart, theme]
|
3108
3199
|
);
|
3109
|
-
const [pieProps, pieClassName] = (0,
|
3200
|
+
const [pieProps, pieClassName] = (0, import_react17.useMemo)(
|
3110
3201
|
() => getComponentProps(
|
3111
3202
|
[computedPieProps, pieProperties],
|
3112
3203
|
styles.pie
|
3113
3204
|
)(theme),
|
3114
3205
|
[computedPieProps, styles.pie, theme]
|
3115
3206
|
);
|
3116
|
-
const cellClassName = (0,
|
3207
|
+
const cellClassName = (0, import_react17.useMemo)(() => {
|
3117
3208
|
const resolvedCellProps = {
|
3118
|
-
fillOpacity: "
|
3209
|
+
fillOpacity: "$fill-opacity",
|
3119
3210
|
...styles.cell,
|
3120
3211
|
...computedCellProps
|
3121
3212
|
};
|
3122
3213
|
return getClassName(resolvedCellProps)(theme);
|
3123
3214
|
}, [computedCellProps, styles.cell, theme]);
|
3124
|
-
const dimCellClassName = (0,
|
3215
|
+
const dimCellClassName = (0, import_react17.useMemo)(() => {
|
3125
3216
|
const resolvedDimCell = { ...styles.dimCell, ...dimCell };
|
3126
3217
|
return getClassName(resolvedDimCell)(theme);
|
3127
3218
|
}, [dimCell, styles.dimCell, theme]);
|
3128
|
-
const activeShapeProps = (0,
|
3219
|
+
const activeShapeProps = (0, import_react17.useMemo)(
|
3129
3220
|
() => getComponentProps(
|
3130
3221
|
[activeShape, pieProperties],
|
3131
3222
|
styles.activeShape
|
3132
3223
|
)(theme, true),
|
3133
3224
|
[activeShape, styles.activeShape, theme]
|
3134
3225
|
);
|
3135
|
-
const inactiveShapeProps = (0,
|
3226
|
+
const inactiveShapeProps = (0, import_react17.useMemo)(
|
3136
3227
|
() => getComponentProps(
|
3137
3228
|
[inactiveShape, pieProperties],
|
3138
3229
|
styles.inactiveShape
|
3139
3230
|
)(theme, true),
|
3140
3231
|
[inactiveShape, styles.inactiveShape, theme]
|
3141
3232
|
);
|
3142
|
-
const label = (0,
|
3233
|
+
const label = (0, import_react17.useCallback)(
|
3143
3234
|
(props) => pieChartLabel({
|
3144
3235
|
labelOffset,
|
3145
3236
|
isPercent,
|
@@ -3150,7 +3241,7 @@ var usePieChart = ({
|
|
3150
3241
|
}),
|
3151
3242
|
[isPercent, labelOffset, labelProps, styles.label, labelFormatter]
|
3152
3243
|
);
|
3153
|
-
const labelLine = (0,
|
3244
|
+
const labelLine = (0, import_react17.useCallback)(
|
3154
3245
|
(props) => {
|
3155
3246
|
return pieChartLabelLine({
|
3156
3247
|
labelOffset,
|
@@ -3161,10 +3252,10 @@ var usePieChart = ({
|
|
3161
3252
|
},
|
3162
3253
|
[labelLineProps, labelOffset, styles.labelLine]
|
3163
3254
|
);
|
3164
|
-
const cellPropList = (0,
|
3255
|
+
const cellPropList = (0, import_react17.useMemo)(
|
3165
3256
|
() => data.map((props, index) => {
|
3166
3257
|
const { name, dimCell: dimCell2 = {}, ...computedProps } = props;
|
3167
|
-
const color = `
|
3258
|
+
const color = (0, import_core21.getVar)(`cell-${index}`)(theme);
|
3168
3259
|
const dimmed = shouldHighlight && highlightedArea !== name;
|
3169
3260
|
const resolvedProps = {
|
3170
3261
|
...computedProps,
|
@@ -3191,19 +3282,19 @@ var usePieChart = ({
|
|
3191
3282
|
theme
|
3192
3283
|
]
|
3193
3284
|
);
|
3194
|
-
const getPieChartProps = (0,
|
3285
|
+
const getPieChartProps = (0, import_react17.useCallback)(
|
3195
3286
|
({ className, ...props } = {}, ref = null) => ({
|
3196
3287
|
ref,
|
3197
|
-
className: (0,
|
3288
|
+
className: (0, import_utils21.cx)(className, chartClassName),
|
3198
3289
|
...props,
|
3199
3290
|
...chartProps
|
3200
3291
|
}),
|
3201
3292
|
[chartProps, chartClassName]
|
3202
3293
|
);
|
3203
|
-
const getPieProps = (0,
|
3294
|
+
const getPieProps = (0, import_react17.useCallback)(
|
3204
3295
|
({ className, ...props }, ref = null) => ({
|
3205
3296
|
ref,
|
3206
|
-
className: (0,
|
3297
|
+
className: (0, import_utils21.cx)(className, pieClassName),
|
3207
3298
|
dataKey: "value",
|
3208
3299
|
data,
|
3209
3300
|
rootTabIndex: -1,
|
@@ -3237,12 +3328,12 @@ var usePieChart = ({
|
|
3237
3328
|
pieProps
|
3238
3329
|
]
|
3239
3330
|
);
|
3240
|
-
const getCellProps = (0,
|
3331
|
+
const getCellProps = (0, import_react17.useCallback)(
|
3241
3332
|
({ index, className: classNameProp, ...props }, ref = null) => {
|
3242
3333
|
const { className, color } = cellPropList[index];
|
3243
3334
|
return {
|
3244
3335
|
ref,
|
3245
|
-
className: (0,
|
3336
|
+
className: (0, import_utils21.cx)(classNameProp, className),
|
3246
3337
|
fill: color,
|
3247
3338
|
stroke: color,
|
3248
3339
|
strokeWidth,
|
@@ -3262,8 +3353,8 @@ var usePieChart = ({
|
|
3262
3353
|
|
3263
3354
|
// src/donut-chart.tsx
|
3264
3355
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
3265
|
-
var DonutChart = (0,
|
3266
|
-
const [styles, mergedProps] = (0,
|
3356
|
+
var DonutChart = (0, import_core22.forwardRef)((props, ref) => {
|
3357
|
+
const [styles, mergedProps] = (0, import_core22.useMultiComponentStyle)("DonutChart", props);
|
3267
3358
|
const {
|
3268
3359
|
className,
|
3269
3360
|
data,
|
@@ -3290,8 +3381,9 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3290
3381
|
outerRadius,
|
3291
3382
|
strokeWidth,
|
3292
3383
|
legendProps,
|
3384
|
+
labelProps,
|
3293
3385
|
...rest
|
3294
|
-
} = (0,
|
3386
|
+
} = (0, import_core22.omitThemeProps)(mergedProps);
|
3295
3387
|
const {
|
3296
3388
|
pieVars,
|
3297
3389
|
getPieProps,
|
@@ -3325,7 +3417,8 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3325
3417
|
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
3326
3418
|
legendProps
|
3327
3419
|
});
|
3328
|
-
const
|
3420
|
+
const { getLabelProps } = useChartLabel({ labelProps, styles });
|
3421
|
+
const cells = (0, import_react18.useMemo)(
|
3329
3422
|
() => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3330
3423
|
import_recharts6.Cell,
|
3331
3424
|
{
|
@@ -3336,12 +3429,11 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3336
3429
|
[data, getCellProps]
|
3337
3430
|
);
|
3338
3431
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3339
|
-
|
3432
|
+
import_core22.ui.div,
|
3340
3433
|
{
|
3341
3434
|
ref,
|
3342
|
-
className: (0,
|
3343
|
-
|
3344
|
-
__css: { ...styles.container },
|
3435
|
+
className: (0, import_utils22.cx)("ui-donut-chart", className),
|
3436
|
+
__css: { maxW: "full", vars: pieVars, ...styles.container },
|
3345
3437
|
...rest,
|
3346
3438
|
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3347
3439
|
import_recharts6.ResponsiveContainer,
|
@@ -3352,13 +3444,21 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3352
3444
|
{
|
3353
3445
|
...getPieChartProps({ className: "ui-donut-chart__chart" }),
|
3354
3446
|
children: [
|
3355
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.
|
3447
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
3356
3448
|
import_recharts6.Pie,
|
3357
3449
|
{
|
3358
3450
|
...getPieProps({
|
3359
3451
|
className: "ui-donut-chart__donut"
|
3360
3452
|
}),
|
3361
|
-
children:
|
3453
|
+
children: [
|
3454
|
+
cells,
|
3455
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3456
|
+
import_recharts6.Label,
|
3457
|
+
{
|
3458
|
+
...getLabelProps({ className: "ui-donut-chart__label" })
|
3459
|
+
}
|
3460
|
+
)
|
3461
|
+
]
|
3362
3462
|
}
|
3363
3463
|
),
|
3364
3464
|
withLegend ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
@@ -3403,13 +3503,13 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3403
3503
|
});
|
3404
3504
|
|
3405
3505
|
// src/pie-chart.tsx
|
3406
|
-
var
|
3407
|
-
var
|
3408
|
-
var
|
3506
|
+
var import_core23 = require("@yamada-ui/core");
|
3507
|
+
var import_utils23 = require("@yamada-ui/utils");
|
3508
|
+
var import_react19 = require("react");
|
3409
3509
|
var import_recharts7 = require("recharts");
|
3410
3510
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
3411
|
-
var PieChart = (0,
|
3412
|
-
const [styles, mergedProps] = (0,
|
3511
|
+
var PieChart = (0, import_core23.forwardRef)((props, ref) => {
|
3512
|
+
const [styles, mergedProps] = (0, import_core23.useMultiComponentStyle)("PieChart", props);
|
3413
3513
|
const {
|
3414
3514
|
className,
|
3415
3515
|
data,
|
@@ -3437,7 +3537,7 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3437
3537
|
strokeWidth,
|
3438
3538
|
legendProps,
|
3439
3539
|
...rest
|
3440
|
-
} = (0,
|
3540
|
+
} = (0, import_core23.omitThemeProps)(mergedProps);
|
3441
3541
|
const {
|
3442
3542
|
pieVars,
|
3443
3543
|
getPieProps,
|
@@ -3471,7 +3571,7 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3471
3571
|
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
3472
3572
|
legendProps
|
3473
3573
|
});
|
3474
|
-
const cells = (0,
|
3574
|
+
const cells = (0, import_react19.useMemo)(
|
3475
3575
|
() => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3476
3576
|
import_recharts7.Cell,
|
3477
3577
|
{
|
@@ -3482,12 +3582,11 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3482
3582
|
[data, getCellProps]
|
3483
3583
|
);
|
3484
3584
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3485
|
-
|
3585
|
+
import_core23.ui.div,
|
3486
3586
|
{
|
3487
3587
|
ref,
|
3488
|
-
className: (0,
|
3489
|
-
|
3490
|
-
__css: { ...styles.container },
|
3588
|
+
className: (0, import_utils23.cx)("ui-pie-chart", className),
|
3589
|
+
__css: { maxW: "full", vars: pieVars, ...styles.container },
|
3491
3590
|
...rest,
|
3492
3591
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3493
3592
|
import_recharts7.ResponsiveContainer,
|
@@ -3548,8 +3647,340 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3548
3647
|
) });
|
3549
3648
|
});
|
3550
3649
|
|
3551
|
-
// src/
|
3650
|
+
// src/radial-chart.tsx
|
3651
|
+
var import_core26 = require("@yamada-ui/core");
|
3652
|
+
var import_utils26 = require("@yamada-ui/utils");
|
3653
|
+
var import_react22 = require("react");
|
3552
3654
|
var import_recharts8 = require("recharts");
|
3655
|
+
|
3656
|
+
// src/use-chart-label-list.ts
|
3657
|
+
var import_core24 = require("@yamada-ui/core");
|
3658
|
+
var import_utils24 = require("@yamada-ui/utils");
|
3659
|
+
var import_react20 = require("react");
|
3660
|
+
var useChartLabelList = ({
|
3661
|
+
labelListProps = [],
|
3662
|
+
styles
|
3663
|
+
}) => {
|
3664
|
+
const { theme } = (0, import_core24.useTheme)();
|
3665
|
+
const styleClassName = (0, import_core24.getCSS)(styles.labelList)(theme);
|
3666
|
+
const propList = (0, import_react20.useMemo)(
|
3667
|
+
() => labelListProps.map(
|
3668
|
+
(props) => getComponentProps(
|
3669
|
+
[props, labelListProperties],
|
3670
|
+
styleClassName
|
3671
|
+
)(theme, true)
|
3672
|
+
),
|
3673
|
+
[labelListProps, styleClassName, theme]
|
3674
|
+
);
|
3675
|
+
const getLabelLineProps = (0, import_react20.useCallback)(
|
3676
|
+
({ index, className, ...props }, ref = null) => {
|
3677
|
+
const { className: propClassName, ...rest } = propList[index];
|
3678
|
+
return {
|
3679
|
+
ref,
|
3680
|
+
className: (0, import_utils24.cx)(className, propClassName),
|
3681
|
+
...props,
|
3682
|
+
...rest
|
3683
|
+
};
|
3684
|
+
},
|
3685
|
+
[propList]
|
3686
|
+
);
|
3687
|
+
return { getLabelLineProps };
|
3688
|
+
};
|
3689
|
+
|
3690
|
+
// src/use-radial-chart.ts
|
3691
|
+
var import_core25 = require("@yamada-ui/core");
|
3692
|
+
var import_utils25 = require("@yamada-ui/utils");
|
3693
|
+
var import_react21 = require("react");
|
3694
|
+
var useRadialChart = ({
|
3695
|
+
data: dataProp,
|
3696
|
+
dataKey = "value",
|
3697
|
+
innerRadius = "10%",
|
3698
|
+
outerRadius = "80%",
|
3699
|
+
startAngle = 90,
|
3700
|
+
endAngle = -180,
|
3701
|
+
fillOpacity = 1,
|
3702
|
+
styles,
|
3703
|
+
...rest
|
3704
|
+
}) => {
|
3705
|
+
var _a;
|
3706
|
+
const { theme } = (0, import_core25.useTheme)();
|
3707
|
+
const [highlightedArea, setHighlightedArea] = (0, import_react21.useState)(null);
|
3708
|
+
const shouldHighlight = highlightedArea !== null;
|
3709
|
+
const {
|
3710
|
+
background: backgroundProps = {},
|
3711
|
+
dimRadialBar: dimRadialBarProps = {},
|
3712
|
+
...computedRadialBarProps
|
3713
|
+
} = (_a = rest.radialBarProps) != null ? _a : {};
|
3714
|
+
const radialVars = (0, import_react21.useMemo)(
|
3715
|
+
() => dataProp.map(({ color }, index) => ({
|
3716
|
+
name: `radial-bar-${index}`,
|
3717
|
+
token: "colors",
|
3718
|
+
value: color != null ? color : "transparent"
|
3719
|
+
})),
|
3720
|
+
[dataProp]
|
3721
|
+
);
|
3722
|
+
const dimRadialBarClassName = (0, import_react21.useMemo)(() => {
|
3723
|
+
const resolvedDimRadialBar = {
|
3724
|
+
fillOpacity: 0.3,
|
3725
|
+
strokeOpacity: 0,
|
3726
|
+
...dimRadialBarProps
|
3727
|
+
};
|
3728
|
+
return getClassName(resolvedDimRadialBar)(theme);
|
3729
|
+
}, [dimRadialBarProps, theme]);
|
3730
|
+
const [chartProps, chartClassName] = (0, import_react21.useMemo)(
|
3731
|
+
() => {
|
3732
|
+
var _a2;
|
3733
|
+
return getComponentProps(
|
3734
|
+
[(_a2 = rest.chartProps) != null ? _a2 : {}, radialChartProperties],
|
3735
|
+
styles.chart
|
3736
|
+
)(theme);
|
3737
|
+
},
|
3738
|
+
[rest.chartProps, styles.chart, theme]
|
3739
|
+
);
|
3740
|
+
const background = (0, import_react21.useMemo)(
|
3741
|
+
() => getComponentProps(
|
3742
|
+
[backgroundProps, radialBarProperties],
|
3743
|
+
styles.background
|
3744
|
+
)(theme, true),
|
3745
|
+
[backgroundProps, styles.background, theme]
|
3746
|
+
);
|
3747
|
+
const [radialBarProps, radialBarClassName] = (0, import_react21.useMemo)(
|
3748
|
+
() => getComponentProps(
|
3749
|
+
[computedRadialBarProps != null ? computedRadialBarProps : {}, radialBarProperties],
|
3750
|
+
styles.radialBar
|
3751
|
+
)(theme),
|
3752
|
+
[computedRadialBarProps, styles.radialBar, theme]
|
3753
|
+
);
|
3754
|
+
const data = (0, import_react21.useMemo)(
|
3755
|
+
() => dataProp.map((props, index) => {
|
3756
|
+
const {
|
3757
|
+
name,
|
3758
|
+
value,
|
3759
|
+
color,
|
3760
|
+
dimRadialBar = {},
|
3761
|
+
...computedProps
|
3762
|
+
} = props;
|
3763
|
+
const dimmed = shouldHighlight && highlightedArea !== name;
|
3764
|
+
const resolvedProps = {
|
3765
|
+
...computedProps,
|
3766
|
+
...dimmed ? dimRadialBar : { fillOpacity }
|
3767
|
+
};
|
3768
|
+
const className = getClassName(
|
3769
|
+
resolvedProps,
|
3770
|
+
dimmed ? dimRadialBarClassName : void 0
|
3771
|
+
)(theme);
|
3772
|
+
return {
|
3773
|
+
className,
|
3774
|
+
fill: (0, import_core25.getVar)(`radial-bar-${index}`)(theme),
|
3775
|
+
name,
|
3776
|
+
value,
|
3777
|
+
color
|
3778
|
+
};
|
3779
|
+
}),
|
3780
|
+
[
|
3781
|
+
dataProp,
|
3782
|
+
dimRadialBarClassName,
|
3783
|
+
fillOpacity,
|
3784
|
+
highlightedArea,
|
3785
|
+
shouldHighlight,
|
3786
|
+
theme
|
3787
|
+
]
|
3788
|
+
);
|
3789
|
+
const getRadialChartProps = (0, import_react21.useCallback)(
|
3790
|
+
({ className, ...props } = {}, ref = null) => ({
|
3791
|
+
ref,
|
3792
|
+
className: (0, import_utils25.cx)(className, chartClassName),
|
3793
|
+
data,
|
3794
|
+
innerRadius,
|
3795
|
+
outerRadius,
|
3796
|
+
startAngle,
|
3797
|
+
endAngle,
|
3798
|
+
...props,
|
3799
|
+
...chartProps
|
3800
|
+
}),
|
3801
|
+
[
|
3802
|
+
chartClassName,
|
3803
|
+
chartProps,
|
3804
|
+
data,
|
3805
|
+
endAngle,
|
3806
|
+
innerRadius,
|
3807
|
+
outerRadius,
|
3808
|
+
startAngle
|
3809
|
+
]
|
3810
|
+
);
|
3811
|
+
const getRadialBarProps = (0, import_react21.useCallback)(
|
3812
|
+
({ className, ...props }, ref = null) => ({
|
3813
|
+
ref,
|
3814
|
+
className: (0, import_utils25.cx)(className, radialBarClassName),
|
3815
|
+
dataKey,
|
3816
|
+
isAnimationActive: false,
|
3817
|
+
background,
|
3818
|
+
...props,
|
3819
|
+
...radialBarProps
|
3820
|
+
}),
|
3821
|
+
[background, dataKey, radialBarClassName, radialBarProps]
|
3822
|
+
);
|
3823
|
+
return {
|
3824
|
+
radialVars,
|
3825
|
+
setHighlightedArea,
|
3826
|
+
getRadialChartProps,
|
3827
|
+
getRadialBarProps
|
3828
|
+
};
|
3829
|
+
};
|
3830
|
+
|
3831
|
+
// src/radial-chart.tsx
|
3832
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
3833
|
+
var RadialChart = (0, import_core26.forwardRef)((props, ref) => {
|
3834
|
+
const [styles, mergedProps] = (0, import_core26.useMultiComponentStyle)("RadialChart", props);
|
3835
|
+
const {
|
3836
|
+
className,
|
3837
|
+
data,
|
3838
|
+
dataKey,
|
3839
|
+
chartProps,
|
3840
|
+
radialBarProps,
|
3841
|
+
containerProps,
|
3842
|
+
withPolarGrid = false,
|
3843
|
+
withTooltip = true,
|
3844
|
+
withLegend = false,
|
3845
|
+
tooltipProps,
|
3846
|
+
tooltipAnimationDuration,
|
3847
|
+
tooltipDataSource = "all",
|
3848
|
+
valueFormatter,
|
3849
|
+
unit,
|
3850
|
+
legendProps,
|
3851
|
+
innerRadius,
|
3852
|
+
outerRadius,
|
3853
|
+
startAngle,
|
3854
|
+
endAngle,
|
3855
|
+
fillOpacity,
|
3856
|
+
labelListProps = [],
|
3857
|
+
polarGridProps,
|
3858
|
+
strokeDasharray,
|
3859
|
+
...rest
|
3860
|
+
} = (0, import_core26.omitThemeProps)(mergedProps);
|
3861
|
+
const {
|
3862
|
+
getRadialChartProps,
|
3863
|
+
getRadialBarProps,
|
3864
|
+
radialVars,
|
3865
|
+
setHighlightedArea
|
3866
|
+
} = useRadialChart({
|
3867
|
+
data,
|
3868
|
+
dataKey,
|
3869
|
+
styles,
|
3870
|
+
chartProps,
|
3871
|
+
radialBarProps,
|
3872
|
+
innerRadius,
|
3873
|
+
outerRadius,
|
3874
|
+
startAngle,
|
3875
|
+
endAngle,
|
3876
|
+
fillOpacity
|
3877
|
+
});
|
3878
|
+
const { getContainerProps } = useChart({ containerProps });
|
3879
|
+
const { tooltipProps: computedTooltipProps, getTooltipProps } = useChartTooltip({
|
3880
|
+
tooltipProps,
|
3881
|
+
tooltipAnimationDuration,
|
3882
|
+
styles
|
3883
|
+
});
|
3884
|
+
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
3885
|
+
legendProps
|
3886
|
+
});
|
3887
|
+
const { getLabelLineProps } = useChartLabelList({ labelListProps, styles });
|
3888
|
+
const { getPolarGridProps } = usePolarGrid({
|
3889
|
+
polarGridProps,
|
3890
|
+
strokeDasharray,
|
3891
|
+
styles
|
3892
|
+
});
|
3893
|
+
const labelLists = (0, import_react22.useMemo)(
|
3894
|
+
() => labelListProps.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3895
|
+
import_recharts8.LabelList,
|
3896
|
+
{
|
3897
|
+
...getLabelLineProps({
|
3898
|
+
index,
|
3899
|
+
className: "ui-radial-chart__label-list"
|
3900
|
+
})
|
3901
|
+
},
|
3902
|
+
`labelList-${index}`
|
3903
|
+
)),
|
3904
|
+
[getLabelLineProps, labelListProps]
|
3905
|
+
);
|
3906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3907
|
+
import_core26.ui.div,
|
3908
|
+
{
|
3909
|
+
ref,
|
3910
|
+
className: (0, import_utils26.cx)("ui-radial-chart", className),
|
3911
|
+
__css: { maxW: "full", vars: radialVars, ...styles.container },
|
3912
|
+
...rest,
|
3913
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3914
|
+
import_recharts8.ResponsiveContainer,
|
3915
|
+
{
|
3916
|
+
...getContainerProps({ className: "ui-radial-chart__container" }),
|
3917
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
3918
|
+
import_recharts8.RadialBarChart,
|
3919
|
+
{
|
3920
|
+
...getRadialChartProps({
|
3921
|
+
className: "ui-radial-chart__chart"
|
3922
|
+
}),
|
3923
|
+
children: [
|
3924
|
+
withPolarGrid ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3925
|
+
import_recharts8.PolarGrid,
|
3926
|
+
{
|
3927
|
+
...getPolarGridProps({
|
3928
|
+
className: "ui-radial-chart__polar-grid"
|
3929
|
+
})
|
3930
|
+
}
|
3931
|
+
) : null,
|
3932
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3933
|
+
import_recharts8.RadialBar,
|
3934
|
+
{
|
3935
|
+
...getRadialBarProps({
|
3936
|
+
className: "ui-radial-chart__radial-bar"
|
3937
|
+
}),
|
3938
|
+
children: labelLists
|
3939
|
+
}
|
3940
|
+
),
|
3941
|
+
withLegend ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3942
|
+
import_recharts8.Legend,
|
3943
|
+
{
|
3944
|
+
content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3945
|
+
ChartLegend,
|
3946
|
+
{
|
3947
|
+
className: "ui-radial-chart__legend",
|
3948
|
+
payload,
|
3949
|
+
onHighlight: setHighlightedArea,
|
3950
|
+
...computedLegendProps
|
3951
|
+
}
|
3952
|
+
),
|
3953
|
+
...getLegendProps()
|
3954
|
+
}
|
3955
|
+
) : null,
|
3956
|
+
withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3957
|
+
import_recharts8.Tooltip,
|
3958
|
+
{
|
3959
|
+
content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3960
|
+
ChartTooltip,
|
3961
|
+
{
|
3962
|
+
className: "ui-radial-chart__tooltip",
|
3963
|
+
isRadialChart: tooltipDataSource === "segment" ? true : false,
|
3964
|
+
payload: tooltipDataSource === "segment" ? payload : data,
|
3965
|
+
valueFormatter,
|
3966
|
+
unit,
|
3967
|
+
...computedTooltipProps
|
3968
|
+
}
|
3969
|
+
),
|
3970
|
+
...getTooltipProps()
|
3971
|
+
}
|
3972
|
+
) : null
|
3973
|
+
]
|
3974
|
+
}
|
3975
|
+
)
|
3976
|
+
}
|
3977
|
+
)
|
3978
|
+
}
|
3979
|
+
) });
|
3980
|
+
});
|
3981
|
+
|
3982
|
+
// src/index.ts
|
3983
|
+
var import_recharts9 = require("recharts");
|
3553
3984
|
// Annotate the CommonJS export names for ESM import in node:
|
3554
3985
|
0 && (module.exports = {
|
3555
3986
|
AreaChart,
|
@@ -3558,6 +3989,7 @@ var import_recharts8 = require("recharts");
|
|
3558
3989
|
DonutChart,
|
3559
3990
|
LineChart,
|
3560
3991
|
PieChart,
|
3561
|
-
RadarChart
|
3992
|
+
RadarChart,
|
3993
|
+
RadialChart
|
3562
3994
|
});
|
3563
3995
|
//# sourceMappingURL=index.js.map
|