@yamada-ui/charts 1.0.7-dev-20240421014947 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/area-chart.js +27 -23
  2. package/dist/area-chart.js.map +1 -1
  3. package/dist/area-chart.mjs +11 -11
  4. package/dist/bar-chart.js +27 -23
  5. package/dist/bar-chart.js.map +1 -1
  6. package/dist/bar-chart.mjs +11 -11
  7. package/dist/chart-legend.js +24 -21
  8. package/dist/chart-legend.js.map +1 -1
  9. package/dist/chart-legend.mjs +3 -3
  10. package/dist/chart-tooltip.d.mts +1 -1
  11. package/dist/chart-tooltip.d.ts +1 -1
  12. package/dist/chart-tooltip.js +3 -2
  13. package/dist/chart-tooltip.js.map +1 -1
  14. package/dist/chart-tooltip.mjs +3 -3
  15. package/dist/chart.types.d.mts +14 -1
  16. package/dist/chart.types.d.ts +14 -1
  17. package/dist/chart.types.js.map +1 -1
  18. package/dist/{chunk-VRRNF4N5.mjs → chunk-45QHUJKU.mjs} +14 -14
  19. package/dist/chunk-4WX5YS7M.mjs +179 -0
  20. package/dist/chunk-4WX5YS7M.mjs.map +1 -0
  21. package/dist/{chunk-OOYQ4AGM.mjs → chunk-5TVYPA64.mjs} +14 -14
  22. package/dist/chunk-BPR7YL3O.mjs +179 -0
  23. package/dist/chunk-BPR7YL3O.mjs.map +1 -0
  24. package/dist/{chunk-4C4GNOFE.mjs → chunk-E2I2XAZ6.mjs} +14 -14
  25. package/dist/{chunk-FARS4FTP.mjs → chunk-HDOYOHLA.mjs} +2 -2
  26. package/dist/{chunk-Z74O4FHB.mjs → chunk-KT4YOMM4.mjs} +2 -2
  27. package/dist/{chunk-32BO2QEP.mjs → chunk-LBC2B6UX.mjs} +5 -4
  28. package/dist/chunk-LBC2B6UX.mjs.map +1 -0
  29. package/dist/{chunk-3CY3IFRN.mjs → chunk-LGMALZCN.mjs} +2 -2
  30. package/dist/chunk-LHI57S6P.mjs +215 -0
  31. package/dist/chunk-LHI57S6P.mjs.map +1 -0
  32. package/dist/{chunk-LXZCGIND.mjs → chunk-LM2DQK2P.mjs} +2 -2
  33. package/dist/{chunk-FGDWJUA3.mjs → chunk-MWPICUEW.mjs} +2 -2
  34. package/dist/chunk-NEGDEVRX.mjs +53 -0
  35. package/dist/chunk-NEGDEVRX.mjs.map +1 -0
  36. package/dist/{chunk-5QCKM3B3.mjs → chunk-OSNFBRHL.mjs} +37 -1
  37. package/dist/chunk-OSNFBRHL.mjs.map +1 -0
  38. package/dist/{chunk-NCR54J3C.mjs → chunk-OW7SOTEF.mjs} +7 -7
  39. package/dist/{chunk-AURFFNDQ.mjs → chunk-P7AFSM5W.mjs} +2 -2
  40. package/dist/{chunk-XZVEEDQN.mjs → chunk-QZ5OXZ6Z.mjs} +2 -2
  41. package/dist/{chunk-HBC7HBKQ.mjs → chunk-RN6PXJAD.mjs} +2 -2
  42. package/dist/{chunk-VGB36NOI.mjs → chunk-STBYRLC5.mjs} +2 -2
  43. package/dist/{chunk-RXWD2EJ2.mjs → chunk-XIFDRM7J.mjs} +2 -2
  44. package/dist/donut-chart.d.mts +31 -0
  45. package/dist/donut-chart.d.ts +31 -0
  46. package/dist/donut-chart.js +702 -0
  47. package/dist/donut-chart.js.map +1 -0
  48. package/dist/donut-chart.mjs +16 -0
  49. package/dist/donut-chart.mjs.map +1 -0
  50. package/dist/index.d.mts +4 -1
  51. package/dist/index.d.ts +4 -1
  52. package/dist/index.js +552 -23
  53. package/dist/index.js.map +1 -1
  54. package/dist/index.mjs +26 -17
  55. package/dist/line-chart.js +27 -23
  56. package/dist/line-chart.js.map +1 -1
  57. package/dist/line-chart.mjs +11 -11
  58. package/dist/pie-chart.d.mts +49 -0
  59. package/dist/pie-chart.d.ts +49 -0
  60. package/dist/pie-chart.js +702 -0
  61. package/dist/pie-chart.js.map +1 -0
  62. package/dist/pie-chart.mjs +16 -0
  63. package/dist/pie-chart.mjs.map +1 -0
  64. package/dist/radar-chart.js +27 -23
  65. package/dist/radar-chart.js.map +1 -1
  66. package/dist/radar-chart.mjs +8 -8
  67. package/dist/rechart-properties.d.mts +3 -1
  68. package/dist/rechart-properties.d.ts +3 -1
  69. package/dist/rechart-properties.js +38 -0
  70. package/dist/rechart-properties.js.map +1 -1
  71. package/dist/rechart-properties.mjs +5 -1
  72. package/dist/use-area-chart.d.mts +1 -1
  73. package/dist/use-area-chart.d.ts +1 -1
  74. package/dist/use-area-chart.js.map +1 -1
  75. package/dist/use-area-chart.mjs +2 -2
  76. package/dist/use-bar-chart.d.mts +1 -1
  77. package/dist/use-bar-chart.d.ts +1 -1
  78. package/dist/use-bar-chart.js.map +1 -1
  79. package/dist/use-bar-chart.mjs +2 -2
  80. package/dist/use-chart-axis.js.map +1 -1
  81. package/dist/use-chart-axis.mjs +2 -2
  82. package/dist/use-chart-grid.js.map +1 -1
  83. package/dist/use-chart-grid.mjs +2 -2
  84. package/dist/use-chart-legend.js.map +1 -1
  85. package/dist/use-chart-legend.mjs +2 -2
  86. package/dist/use-chart-reference-line.js.map +1 -1
  87. package/dist/use-chart-reference-line.mjs +2 -2
  88. package/dist/use-chart-tooltip.js.map +1 -1
  89. package/dist/use-chart-tooltip.mjs +2 -2
  90. package/dist/use-chart.js.map +1 -1
  91. package/dist/use-chart.mjs +2 -2
  92. package/dist/use-line-chart.d.mts +1 -1
  93. package/dist/use-line-chart.d.ts +1 -1
  94. package/dist/use-line-chart.js.map +1 -1
  95. package/dist/use-line-chart.mjs +2 -2
  96. package/dist/use-pie-chart.d.mts +112 -0
  97. package/dist/use-pie-chart.d.ts +112 -0
  98. package/dist/use-pie-chart.js +282 -0
  99. package/dist/use-pie-chart.js.map +1 -0
  100. package/dist/use-pie-chart.mjs +10 -0
  101. package/dist/use-pie-chart.mjs.map +1 -0
  102. package/dist/use-radar-chart.d.mts +1 -1
  103. package/dist/use-radar-chart.d.ts +1 -1
  104. package/dist/use-radar-chart.js.map +1 -1
  105. package/dist/use-radar-chart.mjs +2 -2
  106. package/package.json +5 -5
  107. package/dist/chunk-32BO2QEP.mjs.map +0 -1
  108. package/dist/chunk-5QCKM3B3.mjs.map +0 -1
  109. package/dist/chunk-RTTZPOUT.mjs +0 -50
  110. package/dist/chunk-RTTZPOUT.mjs.map +0 -1
  111. /package/dist/{chunk-VRRNF4N5.mjs.map → chunk-45QHUJKU.mjs.map} +0 -0
  112. /package/dist/{chunk-OOYQ4AGM.mjs.map → chunk-5TVYPA64.mjs.map} +0 -0
  113. /package/dist/{chunk-4C4GNOFE.mjs.map → chunk-E2I2XAZ6.mjs.map} +0 -0
  114. /package/dist/{chunk-FARS4FTP.mjs.map → chunk-HDOYOHLA.mjs.map} +0 -0
  115. /package/dist/{chunk-Z74O4FHB.mjs.map → chunk-KT4YOMM4.mjs.map} +0 -0
  116. /package/dist/{chunk-3CY3IFRN.mjs.map → chunk-LGMALZCN.mjs.map} +0 -0
  117. /package/dist/{chunk-LXZCGIND.mjs.map → chunk-LM2DQK2P.mjs.map} +0 -0
  118. /package/dist/{chunk-FGDWJUA3.mjs.map → chunk-MWPICUEW.mjs.map} +0 -0
  119. /package/dist/{chunk-NCR54J3C.mjs.map → chunk-OW7SOTEF.mjs.map} +0 -0
  120. /package/dist/{chunk-AURFFNDQ.mjs.map → chunk-P7AFSM5W.mjs.map} +0 -0
  121. /package/dist/{chunk-XZVEEDQN.mjs.map → chunk-QZ5OXZ6Z.mjs.map} +0 -0
  122. /package/dist/{chunk-HBC7HBKQ.mjs.map → chunk-RN6PXJAD.mjs.map} +0 -0
  123. /package/dist/{chunk-VGB36NOI.mjs.map → chunk-STBYRLC5.mjs.map} +0 -0
  124. /package/dist/{chunk-RXWD2EJ2.mjs.map → chunk-XIFDRM7J.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -23,7 +23,9 @@ var src_exports = {};
23
23
  __export(src_exports, {
24
24
  AreaChart: () => AreaChart,
25
25
  BarChart: () => BarChart,
26
+ DonutChart: () => DonutChart,
26
27
  LineChart: () => LineChart,
28
+ PieChart: () => PieChart,
27
29
  RadarChart: () => RadarChart
28
30
  });
29
31
  module.exports = __toCommonJS(src_exports);
@@ -118,6 +120,7 @@ var radarChartProperties = [
118
120
  "onMouseEnter",
119
121
  "onClick"
120
122
  ];
123
+ var pieChartProperties = ["width", "height", "margin", "onClick", "onMouseEnter", "onMouseLeave"];
121
124
  var referenceLineProperties = [
122
125
  "xAxisId",
123
126
  "yAxisId",
@@ -399,6 +402,39 @@ var lineProperties = [
399
402
  "onMouseLeave",
400
403
  "strokeDasharray"
401
404
  ];
405
+ var pieProperties = [
406
+ "cx",
407
+ "cy",
408
+ "innerRadius",
409
+ "outerRadius",
410
+ "startAngle",
411
+ "endAngle",
412
+ "minAngle",
413
+ "paddingAngle",
414
+ "nameKey",
415
+ "dataKey",
416
+ "legendType",
417
+ "label",
418
+ "labelLine",
419
+ "data",
420
+ "activeIndex",
421
+ "activeShape",
422
+ "inactiveShape",
423
+ "isAnimationActive",
424
+ "animationBegin",
425
+ "animationDuration",
426
+ "animationEasing",
427
+ "onAnimationStart",
428
+ "onAnimationEnd",
429
+ "onClick",
430
+ "onMouseDown",
431
+ "onMouseUp",
432
+ "onMouseMove",
433
+ "onMouseOver",
434
+ "onMouseOut",
435
+ "onMouseEnter",
436
+ "onMouseLeave"
437
+ ];
402
438
  var dotProperties = [
403
439
  "cx",
404
440
  "cy",
@@ -513,27 +549,30 @@ var import_jsx_runtime = require("react/jsx-runtime");
513
549
  var ChartLegend = (0, import_core3.forwardRef)(
514
550
  ({ className, payload = [], onHighlight, ...rest }, ref) => {
515
551
  const { styles } = useLegend();
516
- const items = payload.map(({ dataKey, color }, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
517
- import_core3.ui.div,
518
- {
519
- className: "ui-chart__legend-item",
520
- onMouseEnter: () => onHighlight(dataKey),
521
- onMouseLeave: () => onHighlight(null),
522
- __css: styles.legendItem,
523
- children: [
524
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
525
- import_core3.ui.div,
526
- {
527
- className: "ui-chart__legend-swatch",
528
- background: color,
529
- __css: styles.legendSwatch
530
- }
531
- ),
532
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core3.ui.span, { className: "ui-chart__legend-label", children: dataKey })
533
- ]
534
- },
535
- `legend-${index}`
536
- ));
552
+ const items = payload.map(({ dataKey, value: valueProp, color }, index) => {
553
+ const value = dataKey != null ? dataKey : valueProp;
554
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
555
+ import_core3.ui.div,
556
+ {
557
+ className: "ui-chart__legend-item",
558
+ onMouseEnter: () => onHighlight(value),
559
+ onMouseLeave: () => onHighlight(null),
560
+ __css: styles.legendItem,
561
+ children: [
562
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
563
+ import_core3.ui.div,
564
+ {
565
+ className: "ui-chart__legend-swatch",
566
+ background: color,
567
+ __css: styles.legendSwatch
568
+ }
569
+ ),
570
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core3.ui.span, { className: "ui-chart__legend-label", children: value })
571
+ ]
572
+ },
573
+ `legend-${index}`
574
+ );
575
+ });
537
576
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
538
577
  import_core3.ui.div,
539
578
  {
@@ -555,8 +594,9 @@ var ChartTooltip = (0, import_core4.forwardRef)(
555
594
  ({ label, className, payload = [], valueFormatter, unit, ...rest }, ref) => {
556
595
  const { styles } = useTooltip();
557
596
  const items = payload.map(
558
- ({ color, name, value: valueProp } = {}, index) => {
597
+ ({ color: colorProp, name, value: valueProp, payload: payload2 } = {}, index) => {
559
598
  var _a;
599
+ const color = colorProp != null ? colorProp : payload2 == null ? void 0 : payload2.color;
560
600
  let value;
561
601
  if ((0, import_utils4.isArray)(valueProp)) {
562
602
  value = valueProp.map((value2) => {
@@ -613,7 +653,7 @@ var ChartTooltip = (0, import_core4.forwardRef)(
613
653
  __css: styles.tooltip,
614
654
  ...rest,
615
655
  children: [
616
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.p, { className: "ui-chart__tooltip-title", __css: styles.tooltipTitle, children: label }),
656
+ label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.p, { className: "ui-chart__tooltip-title", __css: styles.tooltipTitle, children: label }) : null,
617
657
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.div, { className: "ui-chart__tooltip-list", __css: styles.tooltipList, children: items })
618
658
  ]
619
659
  }
@@ -2689,11 +2729,500 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
2689
2729
  }
2690
2730
  ) });
2691
2731
  });
2732
+
2733
+ // src/donut-chart.tsx
2734
+ var import_core18 = require("@yamada-ui/core");
2735
+ var import_utils19 = require("@yamada-ui/utils");
2736
+ var import_react16 = require("react");
2737
+ var import_recharts5 = require("recharts");
2738
+
2739
+ // src/use-pie-chart.ts
2740
+ var import_core17 = require("@yamada-ui/core");
2741
+ var import_utils18 = require("@yamada-ui/utils");
2742
+ var import_react15 = require("react");
2743
+ var usePieChart = ({
2744
+ data,
2745
+ withLabels = false,
2746
+ withLabelLines = false,
2747
+ strokeWidth = 1,
2748
+ fillOpacity = 1,
2749
+ innerRadius = "0%",
2750
+ outerRadius = withLabels ? "80%" : "100%",
2751
+ paddingAngle = 0,
2752
+ startAngle = 90,
2753
+ endAngle = -270,
2754
+ styles,
2755
+ ...rest
2756
+ }) => {
2757
+ var _a, _b;
2758
+ const { theme } = (0, import_core17.useTheme)();
2759
+ const [highlightedArea, setHighlightedArea] = (0, import_react15.useState)(null);
2760
+ const shouldHighlight = highlightedArea !== null;
2761
+ const { dimCell, ...computedCellProps } = (_a = rest.cellProps) != null ? _a : {};
2762
+ const {
2763
+ activeShape = {},
2764
+ inactiveShape = {},
2765
+ label,
2766
+ labelLine,
2767
+ ...computedPieProps
2768
+ } = (_b = rest.pieProps) != null ? _b : {};
2769
+ const cellColors = (0, import_react15.useMemo)(
2770
+ () => data.map(({ color }, index) => ({
2771
+ __prefix: "ui",
2772
+ name: `cell-${index}`,
2773
+ token: "colors",
2774
+ value: color != null ? color : "transparent"
2775
+ })),
2776
+ [data]
2777
+ );
2778
+ const pieVars = (0, import_react15.useMemo)(
2779
+ () => [
2780
+ ...cellColors,
2781
+ { __prefix: "ui", name: "fill-opacity", value: fillOpacity }
2782
+ ],
2783
+ [fillOpacity, cellColors]
2784
+ );
2785
+ const [chartProps, chartClassName] = (0, import_react15.useMemo)(
2786
+ () => {
2787
+ var _a2;
2788
+ return getComponentProps(
2789
+ [(_a2 = rest.chartProps) != null ? _a2 : {}, pieChartProperties],
2790
+ styles.chart
2791
+ )(theme);
2792
+ },
2793
+ [rest.chartProps, styles.chart, theme]
2794
+ );
2795
+ const [pieProps, pieClassName] = (0, import_react15.useMemo)(
2796
+ () => getComponentProps(
2797
+ [computedPieProps, pieProperties],
2798
+ styles.pie
2799
+ )(theme),
2800
+ [computedPieProps, styles.pie, theme]
2801
+ );
2802
+ const cellClassName = (0, import_react15.useMemo)(() => {
2803
+ const resolvedCellProps = {
2804
+ fillOpacity: "var(--ui-fill-opacity)",
2805
+ ...styles.cell,
2806
+ ...computedCellProps
2807
+ };
2808
+ return getClassName(resolvedCellProps)(theme);
2809
+ }, [computedCellProps, styles.cell, theme]);
2810
+ const dimCellClassName = (0, import_react15.useMemo)(() => {
2811
+ const resolvedDimCell = { fillOpacity: 0.3, strokeOpacity: 0, ...dimCell };
2812
+ return getClassName(resolvedDimCell)(theme);
2813
+ }, [dimCell, theme]);
2814
+ const activeShapeProps = (0, import_react15.useMemo)(
2815
+ () => getComponentProps(
2816
+ [{ _focus: { outline: "none" }, ...activeShape }, pieProperties],
2817
+ styles.activeShape
2818
+ )(theme, true),
2819
+ [activeShape, styles.activeShape, theme]
2820
+ );
2821
+ const inactiveShapeProps = (0, import_react15.useMemo)(
2822
+ () => getComponentProps(
2823
+ [inactiveShape, pieProperties],
2824
+ styles.inactiveShape
2825
+ )(theme, true),
2826
+ [inactiveShape, styles.inactiveShape, theme]
2827
+ );
2828
+ const labelClassName = (0, import_react15.useMemo)(
2829
+ () => getClassName({ fillOpacity: 1, ...styles.label, ...label })(theme),
2830
+ [label, styles.label, theme]
2831
+ );
2832
+ const labelLineClassName = (0, import_react15.useMemo)(
2833
+ () => getClassName({ ...styles.labelLine, ...labelLine })(theme),
2834
+ [labelLine, styles.labelLine, theme]
2835
+ );
2836
+ const cellPropList = (0, import_react15.useMemo)(
2837
+ () => data.map((props, index) => {
2838
+ const { name, dimCell: dimCell2 = {}, ...computedProps } = props;
2839
+ const color = `var(--ui-cell-${index})`;
2840
+ const dimmed = shouldHighlight && highlightedArea !== name;
2841
+ const resolvedProps = {
2842
+ ...computedProps,
2843
+ ...dimmed ? dimCell2 : {}
2844
+ };
2845
+ const className = getClassName(
2846
+ {
2847
+ cellClassName,
2848
+ ...resolvedProps
2849
+ },
2850
+ dimmed ? dimCellClassName : void 0
2851
+ )(theme);
2852
+ return {
2853
+ color,
2854
+ className
2855
+ };
2856
+ }),
2857
+ [
2858
+ cellClassName,
2859
+ data,
2860
+ dimCellClassName,
2861
+ highlightedArea,
2862
+ shouldHighlight,
2863
+ theme
2864
+ ]
2865
+ );
2866
+ const getPieChartProps = (0, import_react15.useCallback)(
2867
+ ({ className, ...props } = {}, ref = null) => ({
2868
+ ref,
2869
+ className: (0, import_utils18.cx)(className, chartClassName),
2870
+ ...props,
2871
+ ...chartProps
2872
+ }),
2873
+ [chartProps, chartClassName]
2874
+ );
2875
+ const getPieProps = (0, import_react15.useCallback)(
2876
+ ({
2877
+ className,
2878
+ labelClassName: labelClassNameProp,
2879
+ labelLineClassName: labelLineClassNameProp,
2880
+ ...props
2881
+ }, ref = null) => ({
2882
+ ref,
2883
+ className: (0, import_utils18.cx)(className, pieClassName),
2884
+ dataKey: "value",
2885
+ data,
2886
+ rootTabIndex: -1,
2887
+ outerRadius,
2888
+ innerRadius,
2889
+ paddingAngle,
2890
+ startAngle,
2891
+ endAngle,
2892
+ isAnimationActive: false,
2893
+ label: withLabels ? { className: (0, import_utils18.cx)(labelClassNameProp, labelClassName) } : false,
2894
+ labelLine: withLabelLines ? { className: (0, import_utils18.cx)(labelLineClassNameProp, labelLineClassName) } : false,
2895
+ activeShape: activeShapeProps,
2896
+ inactiveShape: inactiveShapeProps,
2897
+ ...props,
2898
+ ...pieProps
2899
+ }),
2900
+ [
2901
+ pieClassName,
2902
+ data,
2903
+ outerRadius,
2904
+ innerRadius,
2905
+ paddingAngle,
2906
+ startAngle,
2907
+ endAngle,
2908
+ withLabels,
2909
+ labelClassName,
2910
+ withLabelLines,
2911
+ labelLineClassName,
2912
+ activeShapeProps,
2913
+ inactiveShapeProps,
2914
+ pieProps
2915
+ ]
2916
+ );
2917
+ const getCellProps = (0, import_react15.useCallback)(
2918
+ ({ index, className: classNameProp, ...props }, ref = null) => {
2919
+ const { className, color } = cellPropList[index];
2920
+ return {
2921
+ ref,
2922
+ className: (0, import_utils18.cx)(classNameProp, className),
2923
+ fill: color,
2924
+ stroke: color,
2925
+ strokeWidth,
2926
+ ...props
2927
+ };
2928
+ },
2929
+ [cellPropList, strokeWidth]
2930
+ );
2931
+ return {
2932
+ pieVars,
2933
+ getPieProps,
2934
+ getPieChartProps,
2935
+ getCellProps,
2936
+ setHighlightedArea
2937
+ };
2938
+ };
2939
+
2940
+ // src/donut-chart.tsx
2941
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2942
+ var DonutChart = (0, import_core18.forwardRef)((props, ref) => {
2943
+ const [styles, mergedProps] = (0, import_core18.useMultiComponentStyle)("DonutChart", props);
2944
+ const {
2945
+ className,
2946
+ data,
2947
+ pieProps,
2948
+ chartProps,
2949
+ cellProps,
2950
+ containerProps,
2951
+ withTooltip = true,
2952
+ withLegend = false,
2953
+ tooltipProps,
2954
+ tooltipAnimationDuration,
2955
+ tooltipDataSource = "all",
2956
+ valueFormatter,
2957
+ unit,
2958
+ paddingAngle,
2959
+ startAngle,
2960
+ endAngle,
2961
+ withLabels,
2962
+ withLabelLines,
2963
+ innerRadius = withLabels ? "60%" : "80%",
2964
+ outerRadius,
2965
+ strokeWidth,
2966
+ legendProps,
2967
+ ...rest
2968
+ } = (0, import_core18.omitThemeProps)(mergedProps);
2969
+ const {
2970
+ pieVars,
2971
+ getPieProps,
2972
+ getPieChartProps,
2973
+ getCellProps,
2974
+ setHighlightedArea
2975
+ } = usePieChart({
2976
+ data,
2977
+ pieProps,
2978
+ chartProps,
2979
+ cellProps,
2980
+ innerRadius,
2981
+ outerRadius,
2982
+ paddingAngle,
2983
+ startAngle,
2984
+ endAngle,
2985
+ strokeWidth,
2986
+ withLabels,
2987
+ withLabelLines,
2988
+ styles
2989
+ });
2990
+ const { getContainerProps } = useChart({ containerProps });
2991
+ const { tooltipProps: computedTooltipProps, getTooltipProps } = useChartTooltip({
2992
+ tooltipProps,
2993
+ tooltipAnimationDuration,
2994
+ styles
2995
+ });
2996
+ const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
2997
+ legendProps
2998
+ });
2999
+ const cells = (0, import_react16.useMemo)(
3000
+ () => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3001
+ import_recharts5.Cell,
3002
+ {
3003
+ ...getCellProps({ index, className: "ui-donut-chart__cell" })
3004
+ },
3005
+ `donut-cell-${name}`
3006
+ )),
3007
+ [data, getCellProps]
3008
+ );
3009
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3010
+ import_core18.ui.div,
3011
+ {
3012
+ ref,
3013
+ className: (0, import_utils19.cx)("ui-donut-chart", className),
3014
+ var: pieVars,
3015
+ __css: { maxW: "full", ...styles.container },
3016
+ ...rest,
3017
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3018
+ import_recharts5.ResponsiveContainer,
3019
+ {
3020
+ ...getContainerProps({ className: "ui-donut-chart__container" }),
3021
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3022
+ import_recharts5.PieChart,
3023
+ {
3024
+ ...getPieChartProps({ className: "ui-donut-chart__chart" }),
3025
+ children: [
3026
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3027
+ import_recharts5.Pie,
3028
+ {
3029
+ ...getPieProps({
3030
+ className: "ui-donut-chart__donut",
3031
+ labelClassName: "ui-donut-chart__label",
3032
+ labelLineClassName: "ui-donut-chart__label-line"
3033
+ }),
3034
+ children: cells
3035
+ }
3036
+ ),
3037
+ withLegend ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3038
+ import_recharts5.Legend,
3039
+ {
3040
+ content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3041
+ ChartLegend,
3042
+ {
3043
+ className: "ui-donut-chart__legend",
3044
+ payload,
3045
+ onHighlight: setHighlightedArea,
3046
+ ...computedLegendProps
3047
+ }
3048
+ ),
3049
+ ...getLegendProps()
3050
+ }
3051
+ ) : null,
3052
+ withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3053
+ import_recharts5.Tooltip,
3054
+ {
3055
+ content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3056
+ ChartTooltip,
3057
+ {
3058
+ className: "ui-donut-chart__tooltip",
3059
+ label,
3060
+ payload: tooltipDataSource === "segment" ? payload : data,
3061
+ valueFormatter,
3062
+ unit,
3063
+ ...computedTooltipProps
3064
+ }
3065
+ ),
3066
+ ...getTooltipProps()
3067
+ }
3068
+ ) : null
3069
+ ]
3070
+ }
3071
+ )
3072
+ }
3073
+ )
3074
+ }
3075
+ ) });
3076
+ });
3077
+
3078
+ // src/pie-chart.tsx
3079
+ var import_core19 = require("@yamada-ui/core");
3080
+ var import_utils20 = require("@yamada-ui/utils");
3081
+ var import_react17 = require("react");
3082
+ var import_recharts6 = require("recharts");
3083
+ var import_jsx_runtime10 = require("react/jsx-runtime");
3084
+ var PieChart = (0, import_core19.forwardRef)((props, ref) => {
3085
+ const [styles, mergedProps] = (0, import_core19.useMultiComponentStyle)("PieChart", props);
3086
+ const {
3087
+ className,
3088
+ data,
3089
+ pieProps,
3090
+ chartProps,
3091
+ cellProps,
3092
+ containerProps,
3093
+ withTooltip = true,
3094
+ withLegend = false,
3095
+ tooltipProps,
3096
+ tooltipAnimationDuration,
3097
+ tooltipDataSource = "all",
3098
+ valueFormatter,
3099
+ unit,
3100
+ innerRadius,
3101
+ outerRadius,
3102
+ paddingAngle,
3103
+ startAngle,
3104
+ endAngle,
3105
+ withLabels,
3106
+ withLabelLines,
3107
+ strokeWidth,
3108
+ legendProps,
3109
+ ...rest
3110
+ } = (0, import_core19.omitThemeProps)(mergedProps);
3111
+ const {
3112
+ pieVars,
3113
+ getPieProps,
3114
+ getPieChartProps,
3115
+ getCellProps,
3116
+ setHighlightedArea
3117
+ } = usePieChart({
3118
+ data,
3119
+ pieProps,
3120
+ chartProps,
3121
+ cellProps,
3122
+ innerRadius,
3123
+ outerRadius,
3124
+ paddingAngle,
3125
+ startAngle,
3126
+ endAngle,
3127
+ strokeWidth,
3128
+ withLabels,
3129
+ withLabelLines,
3130
+ styles
3131
+ });
3132
+ const { getContainerProps } = useChart({ containerProps });
3133
+ const { tooltipProps: computedTooltipProps, getTooltipProps } = useChartTooltip({
3134
+ tooltipProps,
3135
+ tooltipAnimationDuration,
3136
+ styles
3137
+ });
3138
+ const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
3139
+ legendProps
3140
+ });
3141
+ const cells = (0, import_react17.useMemo)(
3142
+ () => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3143
+ import_recharts6.Cell,
3144
+ {
3145
+ ...getCellProps({ index, className: "ui-pie-chart__cell" })
3146
+ },
3147
+ `pie-cell-${name}`
3148
+ )),
3149
+ [data, getCellProps]
3150
+ );
3151
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3152
+ import_core19.ui.div,
3153
+ {
3154
+ ref,
3155
+ className: (0, import_utils20.cx)("ui-pie-chart", className),
3156
+ var: pieVars,
3157
+ __css: { maxW: "full", ...styles.container },
3158
+ ...rest,
3159
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3160
+ import_recharts6.ResponsiveContainer,
3161
+ {
3162
+ ...getContainerProps({ className: "ui-pie-chart__container" }),
3163
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3164
+ import_recharts6.PieChart,
3165
+ {
3166
+ ...getPieChartProps({ className: "ui-pie-chart__chart" }),
3167
+ children: [
3168
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3169
+ import_recharts6.Pie,
3170
+ {
3171
+ ...getPieProps({
3172
+ className: "ui-pie-chart__pie",
3173
+ labelClassName: "ui-pie-chart__label",
3174
+ labelLineClassName: "ui-pie-chart__label-line"
3175
+ }),
3176
+ children: cells
3177
+ }
3178
+ ),
3179
+ withLegend ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3180
+ import_recharts6.Legend,
3181
+ {
3182
+ content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3183
+ ChartLegend,
3184
+ {
3185
+ className: "ui-pie-chart__legend",
3186
+ payload,
3187
+ onHighlight: setHighlightedArea,
3188
+ ...computedLegendProps
3189
+ }
3190
+ ),
3191
+ ...getLegendProps()
3192
+ }
3193
+ ) : null,
3194
+ withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3195
+ import_recharts6.Tooltip,
3196
+ {
3197
+ content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3198
+ ChartTooltip,
3199
+ {
3200
+ className: "ui-pie-chart__tooltip",
3201
+ label,
3202
+ payload: tooltipDataSource === "segment" ? payload : data,
3203
+ valueFormatter,
3204
+ unit,
3205
+ ...computedTooltipProps
3206
+ }
3207
+ ),
3208
+ ...getTooltipProps()
3209
+ }
3210
+ ) : null
3211
+ ]
3212
+ }
3213
+ )
3214
+ }
3215
+ )
3216
+ }
3217
+ ) });
3218
+ });
2692
3219
  // Annotate the CommonJS export names for ESM import in node:
2693
3220
  0 && (module.exports = {
2694
3221
  AreaChart,
2695
3222
  BarChart,
3223
+ DonutChart,
2696
3224
  LineChart,
3225
+ PieChart,
2697
3226
  RadarChart
2698
3227
  });
2699
3228
  //# sourceMappingURL=index.js.map