@yamada-ui/charts 1.4.1-next-20240820155044 → 1.5.0-dev-20240822150649

Sign up to get free protection for your applications and to get access to all the features.
@@ -74,8 +74,10 @@ type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>;
74
74
  type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>;
75
75
  type PolarAngleAxisProps = Merge<Recharts.PolarAngleAxisProps, CSSUIProps>;
76
76
  type PolarRadiusAxisProps = Merge<CSSUIProps, Recharts.PolarRadiusAxisProps>;
77
- type LabelProps = Merge<CSSUIProps, Recharts.LabelProps>;
77
+ type LabelProps = Merge<CSSUIProps, Omit<Recharts.LabelProps, "fill">>;
78
78
  type ChartTooltipProps = Recharts.TooltipProps<number | string | Array<number | string>, number | string>;
79
79
  type ChartTooltip = ReactElement | ((props: ChartTooltipProps) => ReactNode);
80
+ type ChartLabelProps = Omit<React.SVGProps<SVGTextElement>, "viewBox"> & LabelProps;
81
+ type ChartLabel = ReactElement | ((props: ChartLabelProps) => ReactNode);
80
82
 
81
- export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, CellProps, ChartAxisType, ChartCurveType, ChartLayoutType, ChartPropGetter, ChartTooltip, ChartTooltipProps, DotProps, GridProps, LabelProps, LegendProps, LineChartProps, LineProps, PieChartProps, PieProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, ReferenceLineProps, RequiredChartPropGetter, ResponsiveContainerProps, TooltipDataSourceType, TooltipProps, XAxisProps, YAxisProps };
83
+ export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, CellProps, ChartAxisType, ChartCurveType, ChartLabel, ChartLabelProps, ChartLayoutType, ChartPropGetter, ChartTooltip, ChartTooltipProps, DotProps, GridProps, LabelProps, LegendProps, LineChartProps, LineProps, PieChartProps, PieProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, ReferenceLineProps, RequiredChartPropGetter, ResponsiveContainerProps, TooltipDataSourceType, TooltipProps, XAxisProps, YAxisProps };
@@ -74,8 +74,10 @@ type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>;
74
74
  type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>;
75
75
  type PolarAngleAxisProps = Merge<Recharts.PolarAngleAxisProps, CSSUIProps>;
76
76
  type PolarRadiusAxisProps = Merge<CSSUIProps, Recharts.PolarRadiusAxisProps>;
77
- type LabelProps = Merge<CSSUIProps, Recharts.LabelProps>;
77
+ type LabelProps = Merge<CSSUIProps, Omit<Recharts.LabelProps, "fill">>;
78
78
  type ChartTooltipProps = Recharts.TooltipProps<number | string | Array<number | string>, number | string>;
79
79
  type ChartTooltip = ReactElement | ((props: ChartTooltipProps) => ReactNode);
80
+ type ChartLabelProps = Omit<React.SVGProps<SVGTextElement>, "viewBox"> & LabelProps;
81
+ type ChartLabel = ReactElement | ((props: ChartLabelProps) => ReactNode);
80
82
 
81
- export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, CellProps, ChartAxisType, ChartCurveType, ChartLayoutType, ChartPropGetter, ChartTooltip, ChartTooltipProps, DotProps, GridProps, LabelProps, LegendProps, LineChartProps, LineProps, PieChartProps, PieProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, ReferenceLineProps, RequiredChartPropGetter, ResponsiveContainerProps, TooltipDataSourceType, TooltipProps, XAxisProps, YAxisProps };
83
+ export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, CellProps, ChartAxisType, ChartCurveType, ChartLabel, ChartLabelProps, ChartLayoutType, ChartPropGetter, ChartTooltip, ChartTooltipProps, DotProps, GridProps, LabelProps, LegendProps, LineChartProps, LineProps, PieChartProps, PieProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, ReferenceLineProps, RequiredChartPropGetter, ResponsiveContainerProps, TooltipDataSourceType, TooltipProps, XAxisProps, YAxisProps };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chart.types.ts"],"sourcesContent":["import type { As, CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ComponentPropsWithoutRef,\n ReactElement,\n ReactNode,\n SVGProps,\n} from \"react\"\nimport type * as Recharts from \"recharts\"\nimport type { pieProperties } from \"./rechart-properties\"\n\nexport type ChartPropGetter<\n Y extends As = \"div\",\n M = undefined,\n D = undefined,\n> = (props?: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D\n\nexport type RequiredChartPropGetter<\n Y extends As = \"div\",\n M = undefined,\n D = undefined,\n> = (props: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D\nexport type ChartLayoutType = \"horizontal\" | \"vertical\"\nexport type AreaChartType = \"default\" | \"stacked\" | \"percent\" | \"split\"\nexport type BarChartType = Exclude<AreaChartType, \"split\">\nexport type ChartAxisType = \"x\" | \"y\" | \"xy\" | \"none\"\nexport type ChartCurveType =\n | \"bump\"\n | \"linear\"\n | \"natural\"\n | \"monotone\"\n | \"step\"\n | \"stepBefore\"\n | \"stepAfter\"\nexport type TooltipDataSourceType = \"segment\" | \"all\"\n\nexport type AreaChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.AreaChart>\n>\nexport type BarChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.BarChart>\n>\nexport type LineChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.LineChart>\n>\nexport type RadarChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.RadarChart>\n>\nexport type PieChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.PieChart>\n>\nexport type ReferenceLineProps = Merge<CSSUIProps, Recharts.ReferenceLineProps>\nexport type ResponsiveContainerProps = Merge<\n CSSUIProps,\n Omit<Recharts.ResponsiveContainerProps, \"children\">\n>\nexport type AreaProps = Merge<\n Merge<CSSUIProps, Recharts.AreaProps>,\n {\n color: CSSUIProps[\"color\"]\n dot?: DotProps\n activeDot?: DotProps\n dimDot?: DotProps\n dimArea?: Partial<AreaProps>\n }\n>\nexport type LineProps = Merge<\n Merge<CSSUIProps, Recharts.LineProps>,\n {\n color: CSSUIProps[\"color\"]\n activeDot?: DotProps\n dot?: DotProps\n dimDot?: DotProps\n dimLine?: Partial<LineProps>\n }\n>\nexport type BarProps = Merge<\n Merge<CSSUIProps, Recharts.BarProps>,\n {\n color: CSSUIProps[\"color\"]\n activeBar?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n background?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n dimBar?: Partial<BarProps>\n }\n>\nexport type RadarProps = Merge<\n Merge<CSSUIProps, Recharts.RadarProps>,\n {\n color: CSSUIProps[\"color\"]\n dot?: DotProps\n activeDot?: DotProps\n dimDot?: DotProps\n dimRadar?: Partial<RadarProps>\n }\n>\nexport type PieProps = Merge<\n Merge<Pick<Recharts.PieProps, (typeof pieProperties)[number]>, CSSUIProps>,\n {\n activeShape?: Partial<PieProps>\n inactiveShape?: Partial<PieProps>\n label?: HTMLUIProps<\"text\">\n labelLine?: HTMLUIProps<\"path\">\n }\n>\nexport type CellProps = Merge<\n CSSUIProps,\n {\n name: string\n value: number\n dimCell?: Partial<CellProps>\n }\n>\nexport type DotProps = Merge<Omit<Recharts.DotProps, \"ref\">, CSSUIProps>\nexport type XAxisProps = Merge<\n Merge<CSSUIProps, Recharts.XAxisProps>,\n {\n color?: CSSUIProps[\"color\"]\n stroke?: CSSUIProps[\"color\"]\n fill?: CSSUIProps[\"color\"]\n }\n>\nexport type YAxisProps = Merge<\n Merge<CSSUIProps, Recharts.YAxisProps>,\n { color?: CSSUIProps[\"color\"] }\n>\nexport type LegendProps = Merge<CSSUIProps, Omit<Recharts.LegendProps, \"ref\">>\nexport type TooltipProps = Merge<\n Merge<CSSUIProps, Omit<Recharts.TooltipProps<any, any>, \"ref\">>,\n { cursor?: CSSUIProps }\n>\nexport type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>\nexport type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>\nexport type PolarAngleAxisProps = Merge<\n Recharts.PolarAngleAxisProps,\n CSSUIProps\n>\nexport type PolarRadiusAxisProps = Merge<\n CSSUIProps,\n Recharts.PolarRadiusAxisProps\n>\nexport type LabelProps = Merge<CSSUIProps, Recharts.LabelProps>\nexport type ChartTooltipProps = Recharts.TooltipProps<\n number | string | Array<number | string>,\n number | string\n>\nexport type ChartTooltip =\n | ReactElement\n | ((props: ChartTooltipProps) => ReactNode)\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../src/chart.types.ts"],"sourcesContent":["import type { As, CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ComponentPropsWithoutRef,\n ReactElement,\n ReactNode,\n SVGProps,\n} from \"react\"\nimport type * as Recharts from \"recharts\"\nimport type { pieProperties } from \"./rechart-properties\"\n\nexport type ChartPropGetter<\n Y extends As = \"div\",\n M = undefined,\n D = undefined,\n> = (props?: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D\n\nexport type RequiredChartPropGetter<\n Y extends As = \"div\",\n M = undefined,\n D = undefined,\n> = (props: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D\nexport type ChartLayoutType = \"horizontal\" | \"vertical\"\nexport type AreaChartType = \"default\" | \"stacked\" | \"percent\" | \"split\"\nexport type BarChartType = Exclude<AreaChartType, \"split\">\nexport type ChartAxisType = \"x\" | \"y\" | \"xy\" | \"none\"\nexport type ChartCurveType =\n | \"bump\"\n | \"linear\"\n | \"natural\"\n | \"monotone\"\n | \"step\"\n | \"stepBefore\"\n | \"stepAfter\"\nexport type TooltipDataSourceType = \"segment\" | \"all\"\n\nexport type AreaChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.AreaChart>\n>\nexport type BarChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.BarChart>\n>\nexport type LineChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.LineChart>\n>\nexport type RadarChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.RadarChart>\n>\nexport type PieChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.PieChart>\n>\nexport type ReferenceLineProps = Merge<CSSUIProps, Recharts.ReferenceLineProps>\nexport type ResponsiveContainerProps = Merge<\n CSSUIProps,\n Omit<Recharts.ResponsiveContainerProps, \"children\">\n>\nexport type AreaProps = Merge<\n Merge<CSSUIProps, Recharts.AreaProps>,\n {\n color: CSSUIProps[\"color\"]\n dot?: DotProps\n activeDot?: DotProps\n dimDot?: DotProps\n dimArea?: Partial<AreaProps>\n }\n>\nexport type LineProps = Merge<\n Merge<CSSUIProps, Recharts.LineProps>,\n {\n color: CSSUIProps[\"color\"]\n activeDot?: DotProps\n dot?: DotProps\n dimDot?: DotProps\n dimLine?: Partial<LineProps>\n }\n>\nexport type BarProps = Merge<\n Merge<CSSUIProps, Recharts.BarProps>,\n {\n color: CSSUIProps[\"color\"]\n activeBar?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n background?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n dimBar?: Partial<BarProps>\n }\n>\nexport type RadarProps = Merge<\n Merge<CSSUIProps, Recharts.RadarProps>,\n {\n color: CSSUIProps[\"color\"]\n dot?: DotProps\n activeDot?: DotProps\n dimDot?: DotProps\n dimRadar?: Partial<RadarProps>\n }\n>\nexport type PieProps = Merge<\n Merge<Pick<Recharts.PieProps, (typeof pieProperties)[number]>, CSSUIProps>,\n {\n activeShape?: Partial<PieProps>\n inactiveShape?: Partial<PieProps>\n label?: HTMLUIProps<\"text\">\n labelLine?: HTMLUIProps<\"path\">\n }\n>\nexport type CellProps = Merge<\n CSSUIProps,\n {\n name: string\n value: number\n dimCell?: Partial<CellProps>\n }\n>\nexport type DotProps = Merge<Omit<Recharts.DotProps, \"ref\">, CSSUIProps>\nexport type XAxisProps = Merge<\n Merge<CSSUIProps, Recharts.XAxisProps>,\n {\n color?: CSSUIProps[\"color\"]\n stroke?: CSSUIProps[\"color\"]\n fill?: CSSUIProps[\"color\"]\n }\n>\nexport type YAxisProps = Merge<\n Merge<CSSUIProps, Recharts.YAxisProps>,\n { color?: CSSUIProps[\"color\"] }\n>\nexport type LegendProps = Merge<CSSUIProps, Omit<Recharts.LegendProps, \"ref\">>\nexport type TooltipProps = Merge<\n Merge<CSSUIProps, Omit<Recharts.TooltipProps<any, any>, \"ref\">>,\n { cursor?: CSSUIProps }\n>\nexport type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>\nexport type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>\nexport type PolarAngleAxisProps = Merge<\n Recharts.PolarAngleAxisProps,\n CSSUIProps\n>\nexport type PolarRadiusAxisProps = Merge<\n CSSUIProps,\n Recharts.PolarRadiusAxisProps\n>\nexport type LabelProps = Merge<CSSUIProps, Omit<Recharts.LabelProps, \"fill\">>\nexport type ChartTooltipProps = Recharts.TooltipProps<\n number | string | Array<number | string>,\n number | string\n>\nexport type ChartTooltip =\n | ReactElement\n | ((props: ChartTooltipProps) => ReactNode)\n\nexport type ChartLabelProps = Omit<React.SVGProps<SVGTextElement>, \"viewBox\"> &\n LabelProps\nexport type ChartLabel = ReactElement | ((props: ChartLabelProps) => ReactNode)\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,37 @@
1
+ "use client"
2
+ import {
3
+ labelProperties
4
+ } from "./chunk-F34FV5DY.mjs";
5
+ import {
6
+ getComponentProps
7
+ } from "./chunk-QL3DB7OJ.mjs";
8
+
9
+ // src/use-chart-label.ts
10
+ import { useTheme } from "@yamada-ui/core";
11
+ import { cx } from "@yamada-ui/utils";
12
+ import { useCallback } from "react";
13
+ var useChartLabel = ({ styles, ...rest }) => {
14
+ var _a;
15
+ const { theme } = useTheme();
16
+ const [labelProps, labelClassName] = getComponentProps(
17
+ [(_a = rest.labelProps) != null ? _a : {}, labelProperties],
18
+ styles.label
19
+ )(theme);
20
+ const getLabelProps = useCallback(
21
+ ({ className, ...props } = {}, ref = null) => {
22
+ return {
23
+ ref,
24
+ className: cx(className, labelClassName),
25
+ ...props,
26
+ ...labelProps
27
+ };
28
+ },
29
+ [labelClassName, labelProps]
30
+ );
31
+ return { getLabelProps };
32
+ };
33
+
34
+ export {
35
+ useChartLabel
36
+ };
37
+ //# sourceMappingURL=chunk-5XSML5U3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/use-chart-label.ts"],"sourcesContent":["import { useTheme, type CSSUIObject } from \"@yamada-ui/core\"\nimport { cx, type Dict } from \"@yamada-ui/utils\"\nimport { useCallback } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport { getComponentProps } from \"./chart-utils\"\nimport type { ChartPropGetter, LabelProps } from \"./chart.types\"\nimport { labelProperties } from \"./rechart-properties\"\n\nexport type UseChartLabelOptions = {\n /**\n * Props passed down to recharts 'Label' component.\n */\n labelProps?: LabelProps\n}\n\nexport type UseChartLabelProps = UseChartLabelOptions & {\n styles: Dict<CSSUIObject>\n}\n\nexport const useChartLabel = ({ styles, ...rest }: UseChartLabelProps) => {\n const { theme } = useTheme()\n\n const [labelProps, labelClassName] = getComponentProps<Dict, string>(\n [rest.labelProps ?? {}, labelProperties],\n styles.label,\n )(theme)\n\n const getLabelProps: ChartPropGetter<\n \"div\",\n Omit<Recharts.LabelProps, \"ref\">,\n Omit<Recharts.LabelProps, \"ref\">\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => {\n return {\n ref,\n className: cx(className, labelClassName),\n ...props,\n ...labelProps,\n }\n },\n [labelClassName, labelProps],\n )\n\n return { getLabelProps }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,gBAAkC;AAC3C,SAAS,UAAqB;AAC9B,SAAS,mBAAmB;AAiBrB,IAAM,gBAAgB,CAAC,EAAE,QAAQ,GAAG,KAAK,MAA0B;AAnB1E;AAoBE,QAAM,EAAE,MAAM,IAAI,SAAS;AAE3B,QAAM,CAAC,YAAY,cAAc,IAAI;AAAA,IACnC,EAAC,UAAK,eAAL,YAAmB,CAAC,GAAG,eAAe;AAAA,IACvC,OAAO;AAAA,EACT,EAAE,KAAK;AAEP,QAAM,gBAIF;AAAA,IACF,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,MAAM,SAAS;AAC5C,aAAO;AAAA,QACL;AAAA,QACA,WAAW,GAAG,WAAW,cAAc;AAAA,QACvC,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,gBAAgB,UAAU;AAAA,EAC7B;AAEA,SAAO,EAAE,cAAc;AACzB;","names":[]}
@@ -1,4 +1,7 @@
1
1
  "use client"
2
+ import {
3
+ useChartLabel
4
+ } from "./chunk-5XSML5U3.mjs";
2
5
  import {
3
6
  usePieChart
4
7
  } from "./chunk-IF4O4CBA.mjs";
@@ -30,6 +33,7 @@ import { cx } from "@yamada-ui/utils";
30
33
  import { useMemo } from "react";
31
34
  import {
32
35
  Cell,
36
+ Label,
33
37
  Legend,
34
38
  Pie,
35
39
  PieChart as RechartsPieChart,
@@ -65,6 +69,7 @@ var DonutChart = forwardRef((props, ref) => {
65
69
  outerRadius,
66
70
  strokeWidth,
67
71
  legendProps,
72
+ labelProps,
68
73
  ...rest
69
74
  } = omitThemeProps(mergedProps);
70
75
  const {
@@ -100,6 +105,7 @@ var DonutChart = forwardRef((props, ref) => {
100
105
  const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
101
106
  legendProps
102
107
  });
108
+ const { getLabelProps } = useChartLabel({ labelProps, styles });
103
109
  const cells = useMemo(
104
110
  () => data.map(({ name }, index) => /* @__PURE__ */ jsx(
105
111
  Cell,
@@ -127,13 +133,21 @@ var DonutChart = forwardRef((props, ref) => {
127
133
  {
128
134
  ...getPieChartProps({ className: "ui-donut-chart__chart" }),
129
135
  children: [
130
- /* @__PURE__ */ jsx(
136
+ /* @__PURE__ */ jsxs(
131
137
  Pie,
132
138
  {
133
139
  ...getPieProps({
134
140
  className: "ui-donut-chart__donut"
135
141
  }),
136
- children: cells
142
+ children: [
143
+ cells,
144
+ /* @__PURE__ */ jsx(
145
+ Label,
146
+ {
147
+ ...getLabelProps({ className: "ui-donut-chart__label" })
148
+ }
149
+ )
150
+ ]
137
151
  }
138
152
  ),
139
153
  withLegend ? /* @__PURE__ */ jsx(
@@ -180,4 +194,4 @@ var DonutChart = forwardRef((props, ref) => {
180
194
  export {
181
195
  DonutChart
182
196
  };
183
- //# sourceMappingURL=chunk-U2HWHZYI.mjs.map
197
+ //# sourceMappingURL=chunk-7HKRIEAT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/donut-chart.tsx"],"sourcesContent":["import {\n forwardRef,\n omitThemeProps,\n ui,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMemo } from \"react\"\nimport {\n Cell,\n Label,\n Legend,\n Pie,\n PieChart as RechartsPieChart,\n ResponsiveContainer,\n Tooltip,\n} from \"recharts\"\nimport { ChartLegend } from \"./chart-legend\"\nimport { ChartTooltip } from \"./chart-tooltip\"\nimport type { PieChartProps } from \"./pie-chart\"\nimport { ChartProvider, useChart } from \"./use-chart\"\nimport { useChartLabel, type UseChartLabelOptions } from \"./use-chart-label\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport { useChartTooltip } from \"./use-chart-tooltip\"\nimport { usePieChart } from \"./use-pie-chart\"\n\ntype DonutChartOptions = {\n /**\n * Controls innerRadius of the chart segments.\n * If it is a number, it is the width of the radius.\n * For example, `60` means the radius is `60px` and the diameter is `120px`.\n *\n * @default '60%'\n */\n innerRadius?: number | string\n}\n\nexport type DonutChartProps = PieChartProps &\n DonutChartOptions &\n UseChartLabelOptions\n\n/**\n * `DonutChart` is a component for drawing donut charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/donut-chart\n */\nexport const DonutChart = forwardRef<DonutChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"DonutChart\", props)\n const {\n className,\n data,\n pieProps,\n chartProps,\n cellProps,\n containerProps,\n withTooltip = true,\n withLegend = false,\n tooltipProps,\n tooltipAnimationDuration,\n tooltipDataSource = \"all\",\n valueFormatter,\n labelFormatter,\n unit,\n paddingAngle,\n startAngle,\n endAngle,\n withLabels,\n withLabelLines,\n labelOffset,\n isPercent,\n innerRadius = withLabels ? \"60%\" : \"80%\",\n outerRadius,\n strokeWidth,\n legendProps,\n labelProps,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const {\n pieVars,\n getPieProps,\n getPieChartProps,\n getCellProps,\n setHighlightedArea,\n } = usePieChart({\n data,\n pieProps,\n chartProps,\n cellProps,\n innerRadius,\n outerRadius,\n paddingAngle,\n startAngle,\n endAngle,\n strokeWidth,\n withLabels,\n withLabelLines,\n labelOffset,\n isPercent,\n labelFormatter,\n styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const { tooltipProps: computedTooltipProps, getTooltipProps } =\n useChartTooltip({\n tooltipProps,\n tooltipAnimationDuration,\n styles,\n })\n const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({\n legendProps,\n })\n const { getLabelProps } = useChartLabel({ labelProps, styles })\n\n const cells = useMemo(\n () =>\n data.map(({ name }, index) => (\n <Cell\n key={`donut-cell-${name}`}\n {...getCellProps({ index, className: \"ui-donut-chart__cell\" })}\n />\n )),\n [data, getCellProps],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-donut-chart\", className)}\n var={pieVars}\n __css={{ maxW: \"full\", ...styles.container }}\n {...rest}\n >\n <ResponsiveContainer\n {...getContainerProps({ className: \"ui-donut-chart__container\" })}\n >\n <RechartsPieChart\n {...getPieChartProps({ className: \"ui-donut-chart__chart\" })}\n >\n <Pie\n {...getPieProps({\n className: \"ui-donut-chart__donut\",\n })}\n >\n {cells}\n <Label\n {...getLabelProps({ className: \"ui-donut-chart__label\" })}\n />\n </Pie>\n\n {withLegend ? (\n <Legend\n content={({ payload }) => (\n <ChartLegend\n className=\"ui-donut-chart__legend\"\n payload={payload}\n onHighlight={setHighlightedArea}\n {...computedLegendProps}\n />\n )}\n {...getLegendProps()}\n />\n ) : null}\n\n {withTooltip ? (\n <Tooltip\n content={({ label, payload }) => (\n <ChartTooltip\n className=\"ui-donut-chart__tooltip\"\n label={label}\n payload={tooltipDataSource === \"segment\" ? payload : data}\n valueFormatter={valueFormatter}\n unit={unit}\n {...computedTooltipProps}\n />\n )}\n {...getTooltipProps()}\n />\n ) : null}\n </RechartsPieChart>\n </ResponsiveContainer>\n </ui.div>\n </ChartProvider>\n )\n})\n"],"mappings":"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","names":[]}
@@ -1,5 +1,6 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { PieChartProps } from './pie-chart.mjs';
3
+ import { UseChartLabelOptions } from './use-chart-label.mjs';
3
4
  import './chart.types.mjs';
4
5
  import '@yamada-ui/utils';
5
6
  import 'react';
@@ -21,7 +22,7 @@ type DonutChartOptions = {
21
22
  */
22
23
  innerRadius?: number | string;
23
24
  };
24
- type DonutChartProps = PieChartProps & DonutChartOptions;
25
+ type DonutChartProps = PieChartProps & DonutChartOptions & UseChartLabelOptions;
25
26
  /**
26
27
  * `DonutChart` is a component for drawing donut charts to compare multiple sets of data.
27
28
  *
@@ -1,5 +1,6 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { PieChartProps } from './pie-chart.js';
3
+ import { UseChartLabelOptions } from './use-chart-label.js';
3
4
  import './chart.types.js';
4
5
  import '@yamada-ui/utils';
5
6
  import 'react';
@@ -21,7 +22,7 @@ type DonutChartOptions = {
21
22
  */
22
23
  innerRadius?: number | string;
23
24
  };
24
- type DonutChartProps = PieChartProps & DonutChartOptions;
25
+ type DonutChartProps = PieChartProps & DonutChartOptions & UseChartLabelOptions;
25
26
  /**
26
27
  * `DonutChart` is a component for drawing donut charts to compare multiple sets of data.
27
28
  *
@@ -24,9 +24,9 @@ __export(donut_chart_exports, {
24
24
  DonutChart: () => DonutChart
25
25
  });
26
26
  module.exports = __toCommonJS(donut_chart_exports);
27
- var import_core8 = require("@yamada-ui/core");
28
- var import_utils9 = require("@yamada-ui/utils");
29
- var import_react5 = require("react");
27
+ var import_core9 = require("@yamada-ui/core");
28
+ var import_utils10 = require("@yamada-ui/utils");
29
+ var import_react6 = require("react");
30
30
  var import_recharts = require("recharts");
31
31
 
32
32
  // src/chart-legend.tsx
@@ -143,6 +143,16 @@ var pieProperties = [
143
143
  "onMouseEnter",
144
144
  "onMouseLeave"
145
145
  ];
146
+ var labelProperties = [
147
+ "viewBox",
148
+ "formatter",
149
+ "value",
150
+ "position",
151
+ "offset",
152
+ "children",
153
+ "content",
154
+ "id"
155
+ ];
146
156
 
147
157
  // src/use-chart.ts
148
158
  var [ChartProvider, useChartContext] = (0, import_utils2.createContext)({
@@ -307,17 +317,42 @@ var ChartTooltip = (0, import_core4.forwardRef)(
307
317
  }
308
318
  );
309
319
 
310
- // src/use-chart-legend.ts
320
+ // src/use-chart-label.ts
321
+ var import_core5 = require("@yamada-ui/core");
311
322
  var import_utils5 = require("@yamada-ui/utils");
312
323
  var import_react2 = require("react");
324
+ var useChartLabel = ({ styles, ...rest }) => {
325
+ var _a;
326
+ const { theme } = (0, import_core5.useTheme)();
327
+ const [labelProps, labelClassName] = getComponentProps(
328
+ [(_a = rest.labelProps) != null ? _a : {}, labelProperties],
329
+ styles.label
330
+ )(theme);
331
+ const getLabelProps = (0, import_react2.useCallback)(
332
+ ({ className, ...props } = {}, ref = null) => {
333
+ return {
334
+ ref,
335
+ className: (0, import_utils5.cx)(className, labelClassName),
336
+ ...props,
337
+ ...labelProps
338
+ };
339
+ },
340
+ [labelClassName, labelProps]
341
+ );
342
+ return { getLabelProps };
343
+ };
344
+
345
+ // src/use-chart-legend.ts
346
+ var import_utils6 = require("@yamada-ui/utils");
347
+ var import_react3 = require("react");
313
348
  var useChartLegend = ({
314
349
  legendProps: _legendProps = {}
315
350
  }) => {
316
- const [rest, legendProps] = (0, import_utils5.splitObject)(
351
+ const [rest, legendProps] = (0, import_utils6.splitObject)(
317
352
  _legendProps,
318
353
  legendProperties
319
354
  );
320
- const getLegendProps = (0, import_react2.useCallback)(
355
+ const getLegendProps = (0, import_react3.useCallback)(
321
356
  (props, ref = null) => {
322
357
  return {
323
358
  ref,
@@ -332,31 +367,31 @@ var useChartLegend = ({
332
367
  };
333
368
 
334
369
  // src/use-chart-tooltip.ts
335
- var import_core5 = require("@yamada-ui/core");
336
- var import_utils6 = require("@yamada-ui/utils");
337
- var import_react3 = require("react");
370
+ var import_core6 = require("@yamada-ui/core");
371
+ var import_utils7 = require("@yamada-ui/utils");
372
+ var import_react4 = require("react");
338
373
  var useChartTooltip = ({
339
374
  tooltipProps: _tooltipProps = {},
340
375
  tooltipAnimationDuration = 0,
341
376
  styles
342
377
  }) => {
343
- const { theme } = (0, import_core5.useTheme)();
378
+ const { theme } = (0, import_core6.useTheme)();
344
379
  const { cursor, ...rest } = _tooltipProps;
345
- const cursorClassName = (0, import_react3.useMemo)(
380
+ const cursorClassName = (0, import_react4.useMemo)(
346
381
  () => getClassName({ ...styles.cursor, ...cursor })(theme),
347
382
  [cursor, styles.cursor, theme]
348
383
  );
349
- const [tooltipProps, tooltipUIProps] = (0, import_utils6.splitObject)(
384
+ const [tooltipProps, tooltipUIProps] = (0, import_utils7.splitObject)(
350
385
  rest,
351
386
  tooltipProperties
352
387
  );
353
- const getTooltipProps = (0, import_react3.useCallback)(
388
+ const getTooltipProps = (0, import_react4.useCallback)(
354
389
  (props, ref = null) => ({
355
390
  ref,
356
391
  animationDuration: tooltipAnimationDuration,
357
392
  isAnimationActive: (tooltipAnimationDuration || 0) > 0,
358
393
  cursor: {
359
- className: (0, import_utils6.cx)("ui-chart__cursor", cursorClassName)
394
+ className: (0, import_utils7.cx)("ui-chart__cursor", cursorClassName)
360
395
  },
361
396
  ...props,
362
397
  ...tooltipProps
@@ -367,13 +402,13 @@ var useChartTooltip = ({
367
402
  };
368
403
 
369
404
  // src/use-pie-chart.ts
370
- var import_core7 = require("@yamada-ui/core");
371
- var import_utils8 = require("@yamada-ui/utils");
372
- var import_react4 = require("react");
405
+ var import_core8 = require("@yamada-ui/core");
406
+ var import_utils9 = require("@yamada-ui/utils");
407
+ var import_react5 = require("react");
373
408
 
374
409
  // src/pie-chart-label.tsx
375
- var import_core6 = require("@yamada-ui/core");
376
- var import_utils7 = require("@yamada-ui/utils");
410
+ var import_core7 = require("@yamada-ui/core");
411
+ var import_utils8 = require("@yamada-ui/utils");
377
412
  var import_jsx_runtime3 = require("react/jsx-runtime");
378
413
  var RADIAN = Math.PI / 180;
379
414
  var DEFAULT_LABEL_OFFSET = 22;
@@ -400,16 +435,16 @@ var pieChartLabel = ({
400
435
  const displayLabel = () => {
401
436
  if (isPercent) {
402
437
  return parseFloat((percent * 100).toFixed(0)) > 0 && `${(percent * 100).toFixed(0)}%`;
403
- } else if (!(0, import_utils7.isUndefined)(labelFormatter)) {
438
+ } else if (!(0, import_utils8.isUndefined)(labelFormatter)) {
404
439
  return labelFormatter(value);
405
440
  } else {
406
441
  return value;
407
442
  }
408
443
  };
409
444
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
410
- import_core6.ui.text,
445
+ import_core7.ui.text,
411
446
  {
412
- className: (0, import_utils7.cx)(cellClassName, "ui-chart__label"),
447
+ className: (0, import_utils8.cx)(cellClassName, "ui-chart__label"),
413
448
  x,
414
449
  y,
415
450
  textAnchor,
@@ -438,9 +473,9 @@ var pieChartLabelLine = ({
438
473
  const y = cyProp + (middleRadius + labelOffset) * Math.sin(-midAngle * RADIAN);
439
474
  const d = `M ${points[0].x} ${points[0].y} L ${x} ${y}`;
440
475
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
441
- import_core6.ui.path,
476
+ import_core7.ui.path,
442
477
  {
443
- className: (0, import_utils7.cx)(cellClassName, "ui-chart__label-line"),
478
+ className: (0, import_utils8.cx)(cellClassName, "ui-chart__label-line"),
444
479
  d,
445
480
  __css: styles,
446
481
  ...labelLineProps
@@ -467,8 +502,8 @@ var usePieChart = ({
467
502
  ...rest
468
503
  }) => {
469
504
  var _a, _b;
470
- const { theme } = (0, import_core7.useTheme)();
471
- const [highlightedArea, setHighlightedArea] = (0, import_react4.useState)(null);
505
+ const { theme } = (0, import_core8.useTheme)();
506
+ const [highlightedArea, setHighlightedArea] = (0, import_react5.useState)(null);
472
507
  const shouldHighlight = highlightedArea !== null;
473
508
  const { dimCell, ...computedCellProps } = (_a = rest.cellProps) != null ? _a : {};
474
509
  const {
@@ -478,7 +513,7 @@ var usePieChart = ({
478
513
  labelLine: labelLineProps,
479
514
  ...computedPieProps
480
515
  } = (_b = rest.pieProps) != null ? _b : {};
481
- const cellColors = (0, import_react4.useMemo)(
516
+ const cellColors = (0, import_react5.useMemo)(
482
517
  () => data.map(({ color }, index) => ({
483
518
  __prefix: "ui",
484
519
  name: `cell-${index}`,
@@ -487,14 +522,14 @@ var usePieChart = ({
487
522
  })),
488
523
  [data]
489
524
  );
490
- const pieVars = (0, import_react4.useMemo)(
525
+ const pieVars = (0, import_react5.useMemo)(
491
526
  () => [
492
527
  ...cellColors,
493
528
  { __prefix: "ui", name: "fill-opacity", value: fillOpacity }
494
529
  ],
495
530
  [fillOpacity, cellColors]
496
531
  );
497
- const [chartProps, chartClassName] = (0, import_react4.useMemo)(
532
+ const [chartProps, chartClassName] = (0, import_react5.useMemo)(
498
533
  () => {
499
534
  var _a2;
500
535
  return getComponentProps(
@@ -504,14 +539,14 @@ var usePieChart = ({
504
539
  },
505
540
  [rest.chartProps, styles.chart, theme]
506
541
  );
507
- const [pieProps, pieClassName] = (0, import_react4.useMemo)(
542
+ const [pieProps, pieClassName] = (0, import_react5.useMemo)(
508
543
  () => getComponentProps(
509
544
  [computedPieProps, pieProperties],
510
545
  styles.pie
511
546
  )(theme),
512
547
  [computedPieProps, styles.pie, theme]
513
548
  );
514
- const cellClassName = (0, import_react4.useMemo)(() => {
549
+ const cellClassName = (0, import_react5.useMemo)(() => {
515
550
  const resolvedCellProps = {
516
551
  fillOpacity: "var(--ui-fill-opacity)",
517
552
  ...styles.cell,
@@ -519,25 +554,25 @@ var usePieChart = ({
519
554
  };
520
555
  return getClassName(resolvedCellProps)(theme);
521
556
  }, [computedCellProps, styles.cell, theme]);
522
- const dimCellClassName = (0, import_react4.useMemo)(() => {
557
+ const dimCellClassName = (0, import_react5.useMemo)(() => {
523
558
  const resolvedDimCell = { fillOpacity: 0.3, strokeOpacity: 0, ...dimCell };
524
559
  return getClassName(resolvedDimCell)(theme);
525
560
  }, [dimCell, theme]);
526
- const activeShapeProps = (0, import_react4.useMemo)(
561
+ const activeShapeProps = (0, import_react5.useMemo)(
527
562
  () => getComponentProps(
528
563
  [{ _focus: { outline: "none" }, ...activeShape }, pieProperties],
529
564
  styles.activeShape
530
565
  )(theme, true),
531
566
  [activeShape, styles.activeShape, theme]
532
567
  );
533
- const inactiveShapeProps = (0, import_react4.useMemo)(
568
+ const inactiveShapeProps = (0, import_react5.useMemo)(
534
569
  () => getComponentProps(
535
570
  [inactiveShape, pieProperties],
536
571
  styles.inactiveShape
537
572
  )(theme, true),
538
573
  [inactiveShape, styles.inactiveShape, theme]
539
574
  );
540
- const label = (0, import_react4.useCallback)(
575
+ const label = (0, import_react5.useCallback)(
541
576
  (props) => pieChartLabel({
542
577
  labelOffset,
543
578
  isPercent,
@@ -548,7 +583,7 @@ var usePieChart = ({
548
583
  }),
549
584
  [isPercent, labelOffset, labelProps, styles.label, labelFormatter]
550
585
  );
551
- const labelLine = (0, import_react4.useCallback)(
586
+ const labelLine = (0, import_react5.useCallback)(
552
587
  (props) => {
553
588
  return pieChartLabelLine({
554
589
  labelOffset,
@@ -559,7 +594,7 @@ var usePieChart = ({
559
594
  },
560
595
  [labelLineProps, labelOffset, styles.labelLine]
561
596
  );
562
- const cellPropList = (0, import_react4.useMemo)(
597
+ const cellPropList = (0, import_react5.useMemo)(
563
598
  () => data.map((props, index) => {
564
599
  const { name, dimCell: dimCell2 = {}, ...computedProps } = props;
565
600
  const color = `var(--ui-cell-${index})`;
@@ -589,19 +624,19 @@ var usePieChart = ({
589
624
  theme
590
625
  ]
591
626
  );
592
- const getPieChartProps = (0, import_react4.useCallback)(
627
+ const getPieChartProps = (0, import_react5.useCallback)(
593
628
  ({ className, ...props } = {}, ref = null) => ({
594
629
  ref,
595
- className: (0, import_utils8.cx)(className, chartClassName),
630
+ className: (0, import_utils9.cx)(className, chartClassName),
596
631
  ...props,
597
632
  ...chartProps
598
633
  }),
599
634
  [chartProps, chartClassName]
600
635
  );
601
- const getPieProps = (0, import_react4.useCallback)(
636
+ const getPieProps = (0, import_react5.useCallback)(
602
637
  ({ className, ...props }, ref = null) => ({
603
638
  ref,
604
- className: (0, import_utils8.cx)(className, pieClassName),
639
+ className: (0, import_utils9.cx)(className, pieClassName),
605
640
  dataKey: "value",
606
641
  data,
607
642
  rootTabIndex: -1,
@@ -635,12 +670,12 @@ var usePieChart = ({
635
670
  pieProps
636
671
  ]
637
672
  );
638
- const getCellProps = (0, import_react4.useCallback)(
673
+ const getCellProps = (0, import_react5.useCallback)(
639
674
  ({ index, className: classNameProp, ...props }, ref = null) => {
640
675
  const { className, color } = cellPropList[index];
641
676
  return {
642
677
  ref,
643
- className: (0, import_utils8.cx)(classNameProp, className),
678
+ className: (0, import_utils9.cx)(classNameProp, className),
644
679
  fill: color,
645
680
  stroke: color,
646
681
  strokeWidth,
@@ -660,8 +695,8 @@ var usePieChart = ({
660
695
 
661
696
  // src/donut-chart.tsx
662
697
  var import_jsx_runtime4 = require("react/jsx-runtime");
663
- var DonutChart = (0, import_core8.forwardRef)((props, ref) => {
664
- const [styles, mergedProps] = (0, import_core8.useMultiComponentStyle)("DonutChart", props);
698
+ var DonutChart = (0, import_core9.forwardRef)((props, ref) => {
699
+ const [styles, mergedProps] = (0, import_core9.useMultiComponentStyle)("DonutChart", props);
665
700
  const {
666
701
  className,
667
702
  data,
@@ -688,8 +723,9 @@ var DonutChart = (0, import_core8.forwardRef)((props, ref) => {
688
723
  outerRadius,
689
724
  strokeWidth,
690
725
  legendProps,
726
+ labelProps,
691
727
  ...rest
692
- } = (0, import_core8.omitThemeProps)(mergedProps);
728
+ } = (0, import_core9.omitThemeProps)(mergedProps);
693
729
  const {
694
730
  pieVars,
695
731
  getPieProps,
@@ -723,7 +759,8 @@ var DonutChart = (0, import_core8.forwardRef)((props, ref) => {
723
759
  const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
724
760
  legendProps
725
761
  });
726
- const cells = (0, import_react5.useMemo)(
762
+ const { getLabelProps } = useChartLabel({ labelProps, styles });
763
+ const cells = (0, import_react6.useMemo)(
727
764
  () => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
728
765
  import_recharts.Cell,
729
766
  {
@@ -734,10 +771,10 @@ var DonutChart = (0, import_core8.forwardRef)((props, ref) => {
734
771
  [data, getCellProps]
735
772
  );
736
773
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
737
- import_core8.ui.div,
774
+ import_core9.ui.div,
738
775
  {
739
776
  ref,
740
- className: (0, import_utils9.cx)("ui-donut-chart", className),
777
+ className: (0, import_utils10.cx)("ui-donut-chart", className),
741
778
  var: pieVars,
742
779
  __css: { maxW: "full", ...styles.container },
743
780
  ...rest,
@@ -750,13 +787,21 @@ var DonutChart = (0, import_core8.forwardRef)((props, ref) => {
750
787
  {
751
788
  ...getPieChartProps({ className: "ui-donut-chart__chart" }),
752
789
  children: [
753
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
790
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
754
791
  import_recharts.Pie,
755
792
  {
756
793
  ...getPieProps({
757
794
  className: "ui-donut-chart__donut"
758
795
  }),
759
- children: cells
796
+ children: [
797
+ cells,
798
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
799
+ import_recharts.Label,
800
+ {
801
+ ...getLabelProps({ className: "ui-donut-chart__label" })
802
+ }
803
+ )
804
+ ]
760
805
  }
761
806
  ),
762
807
  withLegend ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(