@yamada-ui/charts 1.5.0-dev-20240825094045 → 1.5.0-dev-20240825101928
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/area-chart.d.mts +0 -1
- package/dist/area-chart.d.ts +0 -1
- package/dist/area-chart.js +9 -1
- package/dist/area-chart.js.map +1 -1
- package/dist/area-chart.mjs +11 -11
- package/dist/bar-chart.d.mts +0 -1
- package/dist/bar-chart.d.ts +0 -1
- package/dist/bar-chart.js +9 -1
- 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-BRSSQCO4.mjs → chunk-6IEXTVWL.mjs} +2 -2
- package/dist/{chunk-F34FV5DY.mjs → chunk-6YUJLLGN.mjs} +59 -3
- package/dist/chunk-6YUJLLGN.mjs.map +1 -0
- package/dist/{chunk-WRKSJCFE.mjs → chunk-AJYZ7MDC.mjs} +2 -25
- 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-UCZQ22IS.mjs → chunk-FQTDUZK2.mjs} +16 -11
- package/dist/chunk-FQTDUZK2.mjs.map +1 -0
- package/dist/{chunk-LOXFDA6Z.mjs → chunk-JTQ5QCML.mjs} +2 -2
- package/dist/{chunk-WDGSALCA.mjs → chunk-KBZKJSZJ.mjs} +10 -10
- package/dist/{chunk-5XSML5U3.mjs → chunk-KVE6VXTJ.mjs} +2 -2
- package/dist/chunk-NUAKNL26.mjs +155 -0
- package/dist/chunk-NUAKNL26.mjs.map +1 -0
- package/dist/{chunk-VO2I73WT.mjs → chunk-OOSVO2GS.mjs} +12 -12
- package/dist/{chunk-ZHM6LP7J.mjs → chunk-PBPH3WDW.mjs} +12 -12
- package/dist/{chunk-D7EZKGCJ.mjs → chunk-PPBHLDVN.mjs} +2 -2
- package/dist/{chunk-TZ62XGYL.mjs → chunk-PSPBUPC7.mjs} +2 -2
- package/dist/{chunk-RXQNFP7K.mjs → chunk-S6C5VMIZ.mjs} +12 -12
- 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-NHJDUFKO.mjs → chunk-TQRELNDO.mjs} +2 -2
- package/dist/{chunk-AOGTJ4EN.mjs → chunk-VMBRDEM2.mjs} +2 -2
- package/dist/{chunk-PKRKJQQL.mjs → chunk-VMKJ4Z46.mjs} +9 -9
- package/dist/chunk-VMKJ4Z46.mjs.map +1 -0
- package/dist/{chunk-WAKQGKGK.mjs → chunk-YASR4L6D.mjs} +2 -2
- 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 +9 -1
- 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 +532 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -22
- 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 +9 -1
- 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 +9 -1
- 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 +87 -65
- 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.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.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.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.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.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 +0 -31
- 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-F34FV5DY.mjs.map +0 -1
- package/dist/chunk-MT5JI4OR.mjs.map +0 -1
- package/dist/chunk-PKRKJQQL.mjs.map +0 -1
- package/dist/chunk-UCZQ22IS.mjs.map +0 -1
- package/dist/chunk-WRKSJCFE.mjs.map +0 -1
- /package/dist/{chunk-STBYN5JW.mjs.map → chunk-3AOICU4Q.mjs.map} +0 -0
- /package/dist/{chunk-BRSSQCO4.mjs.map → chunk-6IEXTVWL.mjs.map} +0 -0
- /package/dist/{chunk-DGOXJ373.mjs.map → chunk-EL2VTGFB.mjs.map} +0 -0
- /package/dist/{chunk-LOXFDA6Z.mjs.map → chunk-JTQ5QCML.mjs.map} +0 -0
- /package/dist/{chunk-WDGSALCA.mjs.map → chunk-KBZKJSZJ.mjs.map} +0 -0
- /package/dist/{chunk-5XSML5U3.mjs.map → chunk-KVE6VXTJ.mjs.map} +0 -0
- /package/dist/{chunk-VO2I73WT.mjs.map → chunk-OOSVO2GS.mjs.map} +0 -0
- /package/dist/{chunk-ZHM6LP7J.mjs.map → chunk-PBPH3WDW.mjs.map} +0 -0
- /package/dist/{chunk-D7EZKGCJ.mjs.map → chunk-PPBHLDVN.mjs.map} +0 -0
- /package/dist/{chunk-TZ62XGYL.mjs.map → chunk-PSPBUPC7.mjs.map} +0 -0
- /package/dist/{chunk-RXQNFP7K.mjs.map → chunk-S6C5VMIZ.mjs.map} +0 -0
- /package/dist/{chunk-5Q6O726L.mjs.map → chunk-TCSYDMC7.mjs.map} +0 -0
- /package/dist/{chunk-NHJDUFKO.mjs.map → chunk-TQRELNDO.mjs.map} +0 -0
- /package/dist/{chunk-AOGTJ4EN.mjs.map → chunk-VMBRDEM2.mjs.map} +0 -0
- /package/dist/{chunk-WAKQGKGK.mjs.map → chunk-YASR4L6D.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)) {
|
@@ -2465,15 +2527,48 @@ var AreaChart = (0, import_core15.forwardRef)((props, ref) => {
|
|
2465
2527
|
});
|
2466
2528
|
|
2467
2529
|
// src/radar-chart.tsx
|
2468
|
-
var
|
2469
|
-
var
|
2470
|
-
var
|
2530
|
+
var import_core18 = require("@yamada-ui/core");
|
2531
|
+
var import_utils18 = require("@yamada-ui/utils");
|
2532
|
+
var import_react15 = require("react");
|
2471
2533
|
var import_recharts5 = require("recharts");
|
2472
2534
|
|
2473
|
-
// src/use-
|
2535
|
+
// src/use-polar-grid.tsx
|
2474
2536
|
var import_core16 = require("@yamada-ui/core");
|
2475
2537
|
var import_utils16 = require("@yamada-ui/utils");
|
2476
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");
|
2477
2572
|
var useRadarChart = ({
|
2478
2573
|
data,
|
2479
2574
|
series,
|
@@ -2484,13 +2579,12 @@ var useRadarChart = ({
|
|
2484
2579
|
fillOpacity = 0.4,
|
2485
2580
|
polarAngleAxisTickFormatter,
|
2486
2581
|
polarRadiusAxisTickFormatter,
|
2487
|
-
strokeDasharray,
|
2488
2582
|
styles,
|
2489
2583
|
...rest
|
2490
2584
|
}) => {
|
2491
2585
|
var _a;
|
2492
|
-
const { theme } = (0,
|
2493
|
-
const [highlightedArea, setHighlightedArea] = (0,
|
2586
|
+
const { theme } = (0, import_core17.useTheme)();
|
2587
|
+
const [highlightedArea, setHighlightedArea] = (0, import_react14.useState)(null);
|
2494
2588
|
const shouldHighlight = highlightedArea !== null;
|
2495
2589
|
const {
|
2496
2590
|
dot = {},
|
@@ -2499,7 +2593,7 @@ var useRadarChart = ({
|
|
2499
2593
|
dimRadar,
|
2500
2594
|
...computedRadarProps
|
2501
2595
|
} = (_a = rest.radarProps) != null ? _a : {};
|
2502
|
-
const radarColors = (0,
|
2596
|
+
const radarColors = (0, import_react14.useMemo)(
|
2503
2597
|
() => series.map(({ color }, index) => ({
|
2504
2598
|
name: `radar-${index}`,
|
2505
2599
|
token: "colors",
|
@@ -2507,14 +2601,14 @@ var useRadarChart = ({
|
|
2507
2601
|
})),
|
2508
2602
|
[series]
|
2509
2603
|
);
|
2510
|
-
const radarVars = (0,
|
2604
|
+
const radarVars = (0, import_react14.useMemo)(
|
2511
2605
|
() => [
|
2512
2606
|
...radarColors,
|
2513
2607
|
{ name: "fill-opacity", value: fillOpacity }
|
2514
2608
|
],
|
2515
2609
|
[fillOpacity, radarColors]
|
2516
2610
|
);
|
2517
|
-
const [chartProps, radarChartClassName] = (0,
|
2611
|
+
const [chartProps, radarChartClassName] = (0, import_react14.useMemo)(
|
2518
2612
|
() => {
|
2519
2613
|
var _a2;
|
2520
2614
|
return getComponentProps(
|
@@ -2524,17 +2618,7 @@ var useRadarChart = ({
|
|
2524
2618
|
},
|
2525
2619
|
[rest.chartProps, styles.chart, theme]
|
2526
2620
|
);
|
2527
|
-
const [
|
2528
|
-
() => {
|
2529
|
-
var _a2;
|
2530
|
-
return getComponentProps(
|
2531
|
-
[(_a2 = rest.polarGridProps) != null ? _a2 : {}, polarGridProperties],
|
2532
|
-
styles.polarGrid
|
2533
|
-
)(theme);
|
2534
|
-
},
|
2535
|
-
[rest.polarGridProps, styles.polarGrid, theme]
|
2536
|
-
);
|
2537
|
-
const [polarAngleAxisProps, polarAngleAxisClassName] = (0, import_react13.useMemo)(
|
2621
|
+
const [polarAngleAxisProps, polarAngleAxisClassName] = (0, import_react14.useMemo)(
|
2538
2622
|
() => {
|
2539
2623
|
var _a2;
|
2540
2624
|
return getComponentProps(
|
@@ -2544,14 +2628,14 @@ var useRadarChart = ({
|
|
2544
2628
|
},
|
2545
2629
|
[rest.polarAngleAxisProps, styles.polarAngleAxis, theme]
|
2546
2630
|
);
|
2547
|
-
const polarAngleAxisTickClassName = (0,
|
2631
|
+
const polarAngleAxisTickClassName = (0, import_react14.useMemo)(
|
2548
2632
|
() => getClassName({
|
2549
2633
|
...styles.polarAngleAxisTick,
|
2550
2634
|
...rest.polarAngleAxisTickProps
|
2551
2635
|
})(theme),
|
2552
2636
|
[rest.polarAngleAxisTickProps, styles.polarAngleAxisTick, theme]
|
2553
2637
|
);
|
2554
|
-
const [polarRadiusAxisProps, polarRadiusAxisClassName] = (0,
|
2638
|
+
const [polarRadiusAxisProps, polarRadiusAxisClassName] = (0, import_react14.useMemo)(
|
2555
2639
|
() => {
|
2556
2640
|
var _a2;
|
2557
2641
|
return getComponentProps(
|
@@ -2561,14 +2645,14 @@ var useRadarChart = ({
|
|
2561
2645
|
},
|
2562
2646
|
[rest.polarRadiusAxisProps, styles.polarRadiusAxis, theme]
|
2563
2647
|
);
|
2564
|
-
const polarRadiusAxisTickClassName = (0,
|
2648
|
+
const polarRadiusAxisTickClassName = (0, import_react14.useMemo)(
|
2565
2649
|
() => getClassName({
|
2566
2650
|
...styles.polarRadiusAxisTick,
|
2567
2651
|
...rest.polarRadiusAxisTickProps
|
2568
2652
|
})(theme),
|
2569
2653
|
[rest.polarRadiusAxisTickProps, styles.polarRadiusAxisTick, theme]
|
2570
2654
|
);
|
2571
|
-
const [radarProps, radarClassName] = (0,
|
2655
|
+
const [radarProps, radarClassName] = (0, import_react14.useMemo)(() => {
|
2572
2656
|
const resolvedRadarProps = {
|
2573
2657
|
fillOpacity: "$fill-opacity",
|
2574
2658
|
...computedRadarProps
|
@@ -2578,7 +2662,7 @@ var useRadarChart = ({
|
|
2578
2662
|
styles.radar
|
2579
2663
|
)(theme);
|
2580
2664
|
}, [computedRadarProps, styles.radar, theme]);
|
2581
|
-
const [dimRadarProps, dimRadarClassName] = (0,
|
2665
|
+
const [dimRadarProps, dimRadarClassName] = (0, import_react14.useMemo)(() => {
|
2582
2666
|
const resolvedDimRadar = {
|
2583
2667
|
fillOpacity: 0.3,
|
2584
2668
|
strokeOpacity: 0.3,
|
@@ -2588,27 +2672,27 @@ var useRadarChart = ({
|
|
2588
2672
|
theme
|
2589
2673
|
);
|
2590
2674
|
}, [dimRadar, theme]);
|
2591
|
-
const [dotProps, dotClassName] = (0,
|
2675
|
+
const [dotProps, dotClassName] = (0, import_react14.useMemo)(() => {
|
2592
2676
|
const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
|
2593
2677
|
return getComponentProps(
|
2594
2678
|
[resolvedDot, dotProperties],
|
2595
2679
|
styles.dot
|
2596
2680
|
)(theme);
|
2597
2681
|
}, [dot, styles.dot, theme]);
|
2598
|
-
const [activeDotProps, activeDotClassName] = (0,
|
2682
|
+
const [activeDotProps, activeDotClassName] = (0, import_react14.useMemo)(
|
2599
2683
|
() => getComponentProps(
|
2600
2684
|
[activeDot, dotProperties],
|
2601
2685
|
styles.activeDot
|
2602
2686
|
)(theme),
|
2603
2687
|
[activeDot, styles.activeDot, theme]
|
2604
2688
|
);
|
2605
|
-
const [dimDotProps, dimDotClassName] = (0,
|
2689
|
+
const [dimDotProps, dimDotClassName] = (0, import_react14.useMemo)(() => {
|
2606
2690
|
const resolvedDimDot = { fillOpacity: 0, strokeOpacity: 0, ...dimDot };
|
2607
2691
|
return getComponentProps([resolvedDimDot, dotProperties])(
|
2608
2692
|
theme
|
2609
2693
|
);
|
2610
2694
|
}, [dimDot, theme]);
|
2611
|
-
const radarPropList = (0,
|
2695
|
+
const radarPropList = (0, import_react14.useMemo)(
|
2612
2696
|
() => series.map((props, index) => {
|
2613
2697
|
const {
|
2614
2698
|
dataKey: dataKey2,
|
@@ -2618,7 +2702,7 @@ var useRadarChart = ({
|
|
2618
2702
|
dimRadar: dimRadar2 = {},
|
2619
2703
|
...computedProps
|
2620
2704
|
} = props;
|
2621
|
-
const color = (0,
|
2705
|
+
const color = (0, import_core17.getVar)(`radar-${index}`)(theme);
|
2622
2706
|
const dimmed = shouldHighlight && highlightedArea !== dataKey2;
|
2623
2707
|
const computedDimRadar = { ...dimRadarProps, ...dimRadar2 };
|
2624
2708
|
const resolvedProps = {
|
@@ -2642,7 +2726,7 @@ var useRadarChart = ({
|
|
2642
2726
|
activeDotClassName
|
2643
2727
|
)(theme);
|
2644
2728
|
resolvedActiveDot = {
|
2645
|
-
className: (0,
|
2729
|
+
className: (0, import_utils17.cx)("ui-radar-chart__active-dot", className),
|
2646
2730
|
fill: color,
|
2647
2731
|
stroke: color,
|
2648
2732
|
r: 4,
|
@@ -2665,7 +2749,7 @@ var useRadarChart = ({
|
|
2665
2749
|
dimmed ? dimDotClassName : void 0
|
2666
2750
|
)(theme);
|
2667
2751
|
resolvedDot = {
|
2668
|
-
className: (0,
|
2752
|
+
className: (0, import_utils17.cx)("ui-radar-chart__dot", className),
|
2669
2753
|
fill: color,
|
2670
2754
|
r: 4,
|
2671
2755
|
...rest3
|
@@ -2700,22 +2784,22 @@ var useRadarChart = ({
|
|
2700
2784
|
withDots
|
2701
2785
|
]
|
2702
2786
|
);
|
2703
|
-
const getRadarChartProps = (0,
|
2787
|
+
const getRadarChartProps = (0, import_react14.useCallback)(
|
2704
2788
|
({ className, ...props } = {}, ref = null) => ({
|
2705
2789
|
ref,
|
2706
|
-
className: (0,
|
2790
|
+
className: (0, import_utils17.cx)(className, radarChartClassName),
|
2707
2791
|
data,
|
2708
2792
|
...props,
|
2709
2793
|
...chartProps
|
2710
2794
|
}),
|
2711
2795
|
[data, radarChartClassName, chartProps]
|
2712
2796
|
);
|
2713
|
-
const getRadarProps = (0,
|
2797
|
+
const getRadarProps = (0, import_react14.useCallback)(
|
2714
2798
|
({ index, className: classNameProp, ...props }, ref = null) => {
|
2715
2799
|
const { color, className, dataKey: dataKey2, activeDot: activeDot2, dot: dot2, ...rest2 } = radarPropList[index];
|
2716
2800
|
return {
|
2717
2801
|
ref,
|
2718
|
-
className: (0,
|
2802
|
+
className: (0, import_utils17.cx)(classNameProp, className),
|
2719
2803
|
activeDot: activeDot2,
|
2720
2804
|
dot: dot2,
|
2721
2805
|
name: dataKey2,
|
@@ -2730,23 +2814,13 @@ var useRadarChart = ({
|
|
2730
2814
|
},
|
2731
2815
|
[radarPropList, strokeWidth]
|
2732
2816
|
);
|
2733
|
-
const
|
2817
|
+
const getPolarAngleAxisProps = (0, import_react14.useCallback)(
|
2734
2818
|
({ className, ...props } = {}, ref = null) => ({
|
2735
2819
|
ref,
|
2736
|
-
className: (0,
|
2737
|
-
strokeDasharray,
|
2738
|
-
...props,
|
2739
|
-
...polarGridProps
|
2740
|
-
}),
|
2741
|
-
[polarGridClassName, polarGridProps, strokeDasharray]
|
2742
|
-
);
|
2743
|
-
const getPolarAngleAxisProps = (0, import_react13.useCallback)(
|
2744
|
-
({ className, ...props } = {}, ref = null) => ({
|
2745
|
-
ref,
|
2746
|
-
className: (0, import_utils16.cx)(className, polarAngleAxisClassName),
|
2820
|
+
className: (0, import_utils17.cx)(className, polarAngleAxisClassName),
|
2747
2821
|
dataKey,
|
2748
2822
|
tick: {
|
2749
|
-
className: (0,
|
2823
|
+
className: (0, import_utils17.cx)(
|
2750
2824
|
"ui-radar-chart__polar-angle-axis-tick",
|
2751
2825
|
polarAngleAxisTickClassName
|
2752
2826
|
)
|
@@ -2764,12 +2838,12 @@ var useRadarChart = ({
|
|
2764
2838
|
polarAngleAxisTickFormatter
|
2765
2839
|
]
|
2766
2840
|
);
|
2767
|
-
const getPolarRadiusAxisProps = (0,
|
2841
|
+
const getPolarRadiusAxisProps = (0, import_react14.useCallback)(
|
2768
2842
|
({ className, ...props } = {}, ref = null) => ({
|
2769
2843
|
ref,
|
2770
|
-
className: (0,
|
2844
|
+
className: (0, import_utils17.cx)(className, polarRadiusAxisClassName),
|
2771
2845
|
tick: {
|
2772
|
-
className: (0,
|
2846
|
+
className: (0, import_utils17.cx)(
|
2773
2847
|
"ui-radar-chart__polar-radius-axis-tick",
|
2774
2848
|
polarRadiusAxisTickClassName
|
2775
2849
|
)
|
@@ -2789,7 +2863,6 @@ var useRadarChart = ({
|
|
2789
2863
|
radarVars,
|
2790
2864
|
getRadarChartProps,
|
2791
2865
|
getRadarProps,
|
2792
|
-
getPolarGridProps,
|
2793
2866
|
getPolarAngleAxisProps,
|
2794
2867
|
getPolarRadiusAxisProps,
|
2795
2868
|
setHighlightedArea
|
@@ -2798,8 +2871,8 @@ var useRadarChart = ({
|
|
2798
2871
|
|
2799
2872
|
// src/radar-chart.tsx
|
2800
2873
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
2801
|
-
var RadarChart = (0,
|
2802
|
-
const [styles, mergedProps] = (0,
|
2874
|
+
var RadarChart = (0, import_core18.forwardRef)((props, ref) => {
|
2875
|
+
const [styles, mergedProps] = (0, import_core18.useMultiComponentStyle)("RadarChart", props);
|
2803
2876
|
const {
|
2804
2877
|
className,
|
2805
2878
|
data,
|
@@ -2831,11 +2904,10 @@ var RadarChart = (0, import_core17.forwardRef)((props, ref) => {
|
|
2831
2904
|
withPolarAngleAxis = true,
|
2832
2905
|
withPolarRadiusAxis = false,
|
2833
2906
|
...rest
|
2834
|
-
} = (0,
|
2907
|
+
} = (0, import_core18.omitThemeProps)(mergedProps);
|
2835
2908
|
const {
|
2836
2909
|
getRadarProps,
|
2837
2910
|
getRadarChartProps,
|
2838
|
-
getPolarGridProps,
|
2839
2911
|
getPolarAngleAxisProps,
|
2840
2912
|
getPolarRadiusAxisProps,
|
2841
2913
|
radarVars,
|
@@ -2846,7 +2918,6 @@ var RadarChart = (0, import_core17.forwardRef)((props, ref) => {
|
|
2846
2918
|
dataKey,
|
2847
2919
|
radarProps,
|
2848
2920
|
chartProps,
|
2849
|
-
polarGridProps,
|
2850
2921
|
polarAngleAxisProps,
|
2851
2922
|
polarAngleAxisTickProps,
|
2852
2923
|
polarRadiusAxisProps,
|
@@ -2857,7 +2928,6 @@ var RadarChart = (0, import_core17.forwardRef)((props, ref) => {
|
|
2857
2928
|
fillOpacity,
|
2858
2929
|
polarAngleAxisTickFormatter,
|
2859
2930
|
polarRadiusAxisTickFormatter,
|
2860
|
-
strokeDasharray,
|
2861
2931
|
styles
|
2862
2932
|
});
|
2863
2933
|
const { getContainerProps } = useChart({ containerProps });
|
@@ -2869,7 +2939,12 @@ var RadarChart = (0, import_core17.forwardRef)((props, ref) => {
|
|
2869
2939
|
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
2870
2940
|
legendProps
|
2871
2941
|
});
|
2872
|
-
const
|
2942
|
+
const { getPolarGridProps } = usePolarGrid({
|
2943
|
+
polarGridProps,
|
2944
|
+
strokeDasharray,
|
2945
|
+
styles
|
2946
|
+
});
|
2947
|
+
const radars = (0, import_react15.useMemo)(
|
2873
2948
|
() => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2874
2949
|
import_recharts5.Radar,
|
2875
2950
|
{
|
@@ -2880,10 +2955,10 @@ var RadarChart = (0, import_core17.forwardRef)((props, ref) => {
|
|
2880
2955
|
[getRadarProps, series]
|
2881
2956
|
);
|
2882
2957
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2883
|
-
|
2958
|
+
import_core18.ui.div,
|
2884
2959
|
{
|
2885
2960
|
ref,
|
2886
|
-
className: (0,
|
2961
|
+
className: (0, import_utils18.cx)("ui-radar-chart", className),
|
2887
2962
|
var: radarVars,
|
2888
2963
|
__css: { maxW: "full", ...styles.container },
|
2889
2964
|
...rest,
|
@@ -2963,27 +3038,27 @@ var RadarChart = (0, import_core17.forwardRef)((props, ref) => {
|
|
2963
3038
|
});
|
2964
3039
|
|
2965
3040
|
// src/donut-chart.tsx
|
2966
|
-
var
|
2967
|
-
var
|
2968
|
-
var
|
3041
|
+
var import_core22 = require("@yamada-ui/core");
|
3042
|
+
var import_utils22 = require("@yamada-ui/utils");
|
3043
|
+
var import_react18 = require("react");
|
2969
3044
|
var import_recharts6 = require("recharts");
|
2970
3045
|
|
2971
3046
|
// src/use-chart-label.ts
|
2972
|
-
var
|
2973
|
-
var
|
2974
|
-
var
|
3047
|
+
var import_core19 = require("@yamada-ui/core");
|
3048
|
+
var import_utils19 = require("@yamada-ui/utils");
|
3049
|
+
var import_react16 = require("react");
|
2975
3050
|
var useChartLabel = ({ styles, ...rest }) => {
|
2976
3051
|
var _a;
|
2977
|
-
const { theme } = (0,
|
3052
|
+
const { theme } = (0, import_core19.useTheme)();
|
2978
3053
|
const [labelProps, labelClassName] = getComponentProps(
|
2979
3054
|
[(_a = rest.labelProps) != null ? _a : {}, labelProperties],
|
2980
3055
|
styles.label
|
2981
3056
|
)(theme);
|
2982
|
-
const getLabelProps = (0,
|
3057
|
+
const getLabelProps = (0, import_react16.useCallback)(
|
2983
3058
|
({ className, ...props } = {}, ref = null) => {
|
2984
3059
|
return {
|
2985
3060
|
ref,
|
2986
|
-
className: (0,
|
3061
|
+
className: (0, import_utils19.cx)(className, labelClassName),
|
2987
3062
|
...props,
|
2988
3063
|
...labelProps
|
2989
3064
|
};
|
@@ -2994,13 +3069,13 @@ var useChartLabel = ({ styles, ...rest }) => {
|
|
2994
3069
|
};
|
2995
3070
|
|
2996
3071
|
// src/use-pie-chart.ts
|
2997
|
-
var
|
2998
|
-
var
|
2999
|
-
var
|
3072
|
+
var import_core21 = require("@yamada-ui/core");
|
3073
|
+
var import_utils21 = require("@yamada-ui/utils");
|
3074
|
+
var import_react17 = require("react");
|
3000
3075
|
|
3001
3076
|
// src/pie-chart-label.tsx
|
3002
|
-
var
|
3003
|
-
var
|
3077
|
+
var import_core20 = require("@yamada-ui/core");
|
3078
|
+
var import_utils20 = require("@yamada-ui/utils");
|
3004
3079
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
3005
3080
|
var RADIAN = Math.PI / 180;
|
3006
3081
|
var DEFAULT_LABEL_OFFSET = 22;
|
@@ -3027,16 +3102,16 @@ var pieChartLabel = ({
|
|
3027
3102
|
const displayLabel = () => {
|
3028
3103
|
if (isPercent) {
|
3029
3104
|
return parseFloat((percent * 100).toFixed(0)) > 0 && `${(percent * 100).toFixed(0)}%`;
|
3030
|
-
} else if (!(0,
|
3105
|
+
} else if (!(0, import_utils20.isUndefined)(labelFormatter)) {
|
3031
3106
|
return labelFormatter(value);
|
3032
3107
|
} else {
|
3033
3108
|
return value;
|
3034
3109
|
}
|
3035
3110
|
};
|
3036
3111
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3037
|
-
|
3112
|
+
import_core20.ui.text,
|
3038
3113
|
{
|
3039
|
-
className: (0,
|
3114
|
+
className: (0, import_utils20.cx)(cellClassName, "ui-chart__label"),
|
3040
3115
|
x,
|
3041
3116
|
y,
|
3042
3117
|
textAnchor,
|
@@ -3065,9 +3140,9 @@ var pieChartLabelLine = ({
|
|
3065
3140
|
const y = cyProp + (middleRadius + labelOffset) * Math.sin(-midAngle * RADIAN);
|
3066
3141
|
const d = `M ${points[0].x} ${points[0].y} L ${x} ${y}`;
|
3067
3142
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3068
|
-
|
3143
|
+
import_core20.ui.path,
|
3069
3144
|
{
|
3070
|
-
className: (0,
|
3145
|
+
className: (0, import_utils20.cx)(cellClassName, "ui-chart__label-line"),
|
3071
3146
|
d,
|
3072
3147
|
__css: styles,
|
3073
3148
|
...labelLineProps
|
@@ -3094,8 +3169,8 @@ var usePieChart = ({
|
|
3094
3169
|
...rest
|
3095
3170
|
}) => {
|
3096
3171
|
var _a, _b;
|
3097
|
-
const { theme } = (0,
|
3098
|
-
const [highlightedArea, setHighlightedArea] = (0,
|
3172
|
+
const { theme } = (0, import_core21.useTheme)();
|
3173
|
+
const [highlightedArea, setHighlightedArea] = (0, import_react17.useState)(null);
|
3099
3174
|
const shouldHighlight = highlightedArea !== null;
|
3100
3175
|
const { dimCell, ...computedCellProps } = (_a = rest.cellProps) != null ? _a : {};
|
3101
3176
|
const {
|
@@ -3105,7 +3180,7 @@ var usePieChart = ({
|
|
3105
3180
|
labelLine: labelLineProps,
|
3106
3181
|
...computedPieProps
|
3107
3182
|
} = (_b = rest.pieProps) != null ? _b : {};
|
3108
|
-
const cellColors = (0,
|
3183
|
+
const cellColors = (0, import_react17.useMemo)(
|
3109
3184
|
() => data.map(({ color }, index) => ({
|
3110
3185
|
name: `cell-${index}`,
|
3111
3186
|
token: "colors",
|
@@ -3113,14 +3188,14 @@ var usePieChart = ({
|
|
3113
3188
|
})),
|
3114
3189
|
[data]
|
3115
3190
|
);
|
3116
|
-
const pieVars = (0,
|
3191
|
+
const pieVars = (0, import_react17.useMemo)(
|
3117
3192
|
() => [
|
3118
3193
|
...cellColors,
|
3119
3194
|
{ name: "fill-opacity", value: fillOpacity }
|
3120
3195
|
],
|
3121
3196
|
[fillOpacity, cellColors]
|
3122
3197
|
);
|
3123
|
-
const [chartProps, chartClassName] = (0,
|
3198
|
+
const [chartProps, chartClassName] = (0, import_react17.useMemo)(
|
3124
3199
|
() => {
|
3125
3200
|
var _a2;
|
3126
3201
|
return getComponentProps(
|
@@ -3130,14 +3205,14 @@ var usePieChart = ({
|
|
3130
3205
|
},
|
3131
3206
|
[rest.chartProps, styles.chart, theme]
|
3132
3207
|
);
|
3133
|
-
const [pieProps, pieClassName] = (0,
|
3208
|
+
const [pieProps, pieClassName] = (0, import_react17.useMemo)(
|
3134
3209
|
() => getComponentProps(
|
3135
3210
|
[computedPieProps, pieProperties],
|
3136
3211
|
styles.pie
|
3137
3212
|
)(theme),
|
3138
3213
|
[computedPieProps, styles.pie, theme]
|
3139
3214
|
);
|
3140
|
-
const cellClassName = (0,
|
3215
|
+
const cellClassName = (0, import_react17.useMemo)(() => {
|
3141
3216
|
const resolvedCellProps = {
|
3142
3217
|
fillOpacity: "$fill-opacity",
|
3143
3218
|
...styles.cell,
|
@@ -3145,25 +3220,25 @@ var usePieChart = ({
|
|
3145
3220
|
};
|
3146
3221
|
return getClassName(resolvedCellProps)(theme);
|
3147
3222
|
}, [computedCellProps, styles.cell, theme]);
|
3148
|
-
const dimCellClassName = (0,
|
3223
|
+
const dimCellClassName = (0, import_react17.useMemo)(() => {
|
3149
3224
|
const resolvedDimCell = { fillOpacity: 0.3, strokeOpacity: 0, ...dimCell };
|
3150
3225
|
return getClassName(resolvedDimCell)(theme);
|
3151
3226
|
}, [dimCell, theme]);
|
3152
|
-
const activeShapeProps = (0,
|
3227
|
+
const activeShapeProps = (0, import_react17.useMemo)(
|
3153
3228
|
() => getComponentProps(
|
3154
3229
|
[{ _focus: { outline: "none" }, ...activeShape }, pieProperties],
|
3155
3230
|
styles.activeShape
|
3156
3231
|
)(theme, true),
|
3157
3232
|
[activeShape, styles.activeShape, theme]
|
3158
3233
|
);
|
3159
|
-
const inactiveShapeProps = (0,
|
3234
|
+
const inactiveShapeProps = (0, import_react17.useMemo)(
|
3160
3235
|
() => getComponentProps(
|
3161
3236
|
[inactiveShape, pieProperties],
|
3162
3237
|
styles.inactiveShape
|
3163
3238
|
)(theme, true),
|
3164
3239
|
[inactiveShape, styles.inactiveShape, theme]
|
3165
3240
|
);
|
3166
|
-
const label = (0,
|
3241
|
+
const label = (0, import_react17.useCallback)(
|
3167
3242
|
(props) => pieChartLabel({
|
3168
3243
|
labelOffset,
|
3169
3244
|
isPercent,
|
@@ -3174,7 +3249,7 @@ var usePieChart = ({
|
|
3174
3249
|
}),
|
3175
3250
|
[isPercent, labelOffset, labelProps, styles.label, labelFormatter]
|
3176
3251
|
);
|
3177
|
-
const labelLine = (0,
|
3252
|
+
const labelLine = (0, import_react17.useCallback)(
|
3178
3253
|
(props) => {
|
3179
3254
|
return pieChartLabelLine({
|
3180
3255
|
labelOffset,
|
@@ -3185,10 +3260,10 @@ var usePieChart = ({
|
|
3185
3260
|
},
|
3186
3261
|
[labelLineProps, labelOffset, styles.labelLine]
|
3187
3262
|
);
|
3188
|
-
const cellPropList = (0,
|
3263
|
+
const cellPropList = (0, import_react17.useMemo)(
|
3189
3264
|
() => data.map((props, index) => {
|
3190
3265
|
const { name, dimCell: dimCell2 = {}, ...computedProps } = props;
|
3191
|
-
const color = (0,
|
3266
|
+
const color = (0, import_core21.getVar)(`cell-${index}`)(theme);
|
3192
3267
|
const dimmed = shouldHighlight && highlightedArea !== name;
|
3193
3268
|
const resolvedProps = {
|
3194
3269
|
...computedProps,
|
@@ -3215,19 +3290,19 @@ var usePieChart = ({
|
|
3215
3290
|
theme
|
3216
3291
|
]
|
3217
3292
|
);
|
3218
|
-
const getPieChartProps = (0,
|
3293
|
+
const getPieChartProps = (0, import_react17.useCallback)(
|
3219
3294
|
({ className, ...props } = {}, ref = null) => ({
|
3220
3295
|
ref,
|
3221
|
-
className: (0,
|
3296
|
+
className: (0, import_utils21.cx)(className, chartClassName),
|
3222
3297
|
...props,
|
3223
3298
|
...chartProps
|
3224
3299
|
}),
|
3225
3300
|
[chartProps, chartClassName]
|
3226
3301
|
);
|
3227
|
-
const getPieProps = (0,
|
3302
|
+
const getPieProps = (0, import_react17.useCallback)(
|
3228
3303
|
({ className, ...props }, ref = null) => ({
|
3229
3304
|
ref,
|
3230
|
-
className: (0,
|
3305
|
+
className: (0, import_utils21.cx)(className, pieClassName),
|
3231
3306
|
dataKey: "value",
|
3232
3307
|
data,
|
3233
3308
|
rootTabIndex: -1,
|
@@ -3261,12 +3336,12 @@ var usePieChart = ({
|
|
3261
3336
|
pieProps
|
3262
3337
|
]
|
3263
3338
|
);
|
3264
|
-
const getCellProps = (0,
|
3339
|
+
const getCellProps = (0, import_react17.useCallback)(
|
3265
3340
|
({ index, className: classNameProp, ...props }, ref = null) => {
|
3266
3341
|
const { className, color } = cellPropList[index];
|
3267
3342
|
return {
|
3268
3343
|
ref,
|
3269
|
-
className: (0,
|
3344
|
+
className: (0, import_utils21.cx)(classNameProp, className),
|
3270
3345
|
fill: color,
|
3271
3346
|
stroke: color,
|
3272
3347
|
strokeWidth,
|
@@ -3286,8 +3361,8 @@ var usePieChart = ({
|
|
3286
3361
|
|
3287
3362
|
// src/donut-chart.tsx
|
3288
3363
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
3289
|
-
var DonutChart = (0,
|
3290
|
-
const [styles, mergedProps] = (0,
|
3364
|
+
var DonutChart = (0, import_core22.forwardRef)((props, ref) => {
|
3365
|
+
const [styles, mergedProps] = (0, import_core22.useMultiComponentStyle)("DonutChart", props);
|
3291
3366
|
const {
|
3292
3367
|
className,
|
3293
3368
|
data,
|
@@ -3316,7 +3391,7 @@ var DonutChart = (0, import_core21.forwardRef)((props, ref) => {
|
|
3316
3391
|
legendProps,
|
3317
3392
|
labelProps,
|
3318
3393
|
...rest
|
3319
|
-
} = (0,
|
3394
|
+
} = (0, import_core22.omitThemeProps)(mergedProps);
|
3320
3395
|
const {
|
3321
3396
|
pieVars,
|
3322
3397
|
getPieProps,
|
@@ -3351,7 +3426,7 @@ var DonutChart = (0, import_core21.forwardRef)((props, ref) => {
|
|
3351
3426
|
legendProps
|
3352
3427
|
});
|
3353
3428
|
const { getLabelProps } = useChartLabel({ labelProps, styles });
|
3354
|
-
const cells = (0,
|
3429
|
+
const cells = (0, import_react18.useMemo)(
|
3355
3430
|
() => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3356
3431
|
import_recharts6.Cell,
|
3357
3432
|
{
|
@@ -3362,10 +3437,10 @@ var DonutChart = (0, import_core21.forwardRef)((props, ref) => {
|
|
3362
3437
|
[data, getCellProps]
|
3363
3438
|
);
|
3364
3439
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3365
|
-
|
3440
|
+
import_core22.ui.div,
|
3366
3441
|
{
|
3367
3442
|
ref,
|
3368
|
-
className: (0,
|
3443
|
+
className: (0, import_utils22.cx)("ui-donut-chart", className),
|
3369
3444
|
var: pieVars,
|
3370
3445
|
__css: { maxW: "full", ...styles.container },
|
3371
3446
|
...rest,
|
@@ -3437,13 +3512,13 @@ var DonutChart = (0, import_core21.forwardRef)((props, ref) => {
|
|
3437
3512
|
});
|
3438
3513
|
|
3439
3514
|
// src/pie-chart.tsx
|
3440
|
-
var
|
3441
|
-
var
|
3442
|
-
var
|
3515
|
+
var import_core23 = require("@yamada-ui/core");
|
3516
|
+
var import_utils23 = require("@yamada-ui/utils");
|
3517
|
+
var import_react19 = require("react");
|
3443
3518
|
var import_recharts7 = require("recharts");
|
3444
3519
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
3445
|
-
var PieChart = (0,
|
3446
|
-
const [styles, mergedProps] = (0,
|
3520
|
+
var PieChart = (0, import_core23.forwardRef)((props, ref) => {
|
3521
|
+
const [styles, mergedProps] = (0, import_core23.useMultiComponentStyle)("PieChart", props);
|
3447
3522
|
const {
|
3448
3523
|
className,
|
3449
3524
|
data,
|
@@ -3471,7 +3546,7 @@ var PieChart = (0, import_core22.forwardRef)((props, ref) => {
|
|
3471
3546
|
strokeWidth,
|
3472
3547
|
legendProps,
|
3473
3548
|
...rest
|
3474
|
-
} = (0,
|
3549
|
+
} = (0, import_core23.omitThemeProps)(mergedProps);
|
3475
3550
|
const {
|
3476
3551
|
pieVars,
|
3477
3552
|
getPieProps,
|
@@ -3505,7 +3580,7 @@ var PieChart = (0, import_core22.forwardRef)((props, ref) => {
|
|
3505
3580
|
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
3506
3581
|
legendProps
|
3507
3582
|
});
|
3508
|
-
const cells = (0,
|
3583
|
+
const cells = (0, import_react19.useMemo)(
|
3509
3584
|
() => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3510
3585
|
import_recharts7.Cell,
|
3511
3586
|
{
|
@@ -3516,10 +3591,10 @@ var PieChart = (0, import_core22.forwardRef)((props, ref) => {
|
|
3516
3591
|
[data, getCellProps]
|
3517
3592
|
);
|
3518
3593
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3519
|
-
|
3594
|
+
import_core23.ui.div,
|
3520
3595
|
{
|
3521
3596
|
ref,
|
3522
|
-
className: (0,
|
3597
|
+
className: (0, import_utils23.cx)("ui-pie-chart", className),
|
3523
3598
|
var: pieVars,
|
3524
3599
|
__css: { maxW: "full", ...styles.container },
|
3525
3600
|
...rest,
|
@@ -3582,8 +3657,341 @@ var PieChart = (0, import_core22.forwardRef)((props, ref) => {
|
|
3582
3657
|
) });
|
3583
3658
|
});
|
3584
3659
|
|
3585
|
-
// 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");
|
3586
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");
|
3587
3995
|
// Annotate the CommonJS export names for ESM import in node:
|
3588
3996
|
0 && (module.exports = {
|
3589
3997
|
AreaChart,
|
@@ -3592,6 +4000,7 @@ var import_recharts8 = require("recharts");
|
|
3592
4000
|
DonutChart,
|
3593
4001
|
LineChart,
|
3594
4002
|
PieChart,
|
3595
|
-
RadarChart
|
4003
|
+
RadarChart,
|
4004
|
+
RadialChart
|
3596
4005
|
});
|
3597
4006
|
//# sourceMappingURL=index.js.map
|