@yamada-ui/charts 2.0.0-next-20240729113003 → 2.0.0-next-20240820160301
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/area-chart.d.mts +1 -0
- package/dist/area-chart.d.ts +1 -0
- package/dist/area-chart.js +23 -10
- package/dist/area-chart.js.map +1 -1
- package/dist/area-chart.mjs +4 -4
- package/dist/bar-chart.d.mts +2 -0
- package/dist/bar-chart.d.ts +2 -0
- package/dist/bar-chart.js +84 -45
- package/dist/bar-chart.js.map +1 -1
- package/dist/bar-chart.mjs +5 -5
- package/dist/chart-tooltip.d.mts +2 -1
- package/dist/chart-tooltip.d.ts +2 -1
- package/dist/chart-tooltip.js +15 -6
- package/dist/chart-tooltip.js.map +1 -1
- package/dist/chart-tooltip.mjs +1 -1
- package/dist/chart.types.d.mts +7 -5
- package/dist/chart.types.d.ts +7 -5
- package/dist/chart.types.js.map +1 -1
- package/dist/{chunk-J2HFHUKE.mjs → chunk-4MW4FB2T.mjs} +4 -4
- package/dist/{chunk-J2HFHUKE.mjs.map → chunk-4MW4FB2T.mjs.map} +1 -1
- package/dist/{chunk-IOVOXWUL.mjs → chunk-AODYT4HF.mjs} +14 -20
- package/dist/chunk-AODYT4HF.mjs.map +1 -0
- package/dist/{chunk-UK6B6KJ7.mjs → chunk-AOGTJ4EN.mjs} +1 -1
- package/dist/chunk-AOGTJ4EN.mjs.map +1 -0
- package/dist/{chunk-FTAFXLVL.mjs → chunk-BGMNYKQY.mjs} +5 -5
- package/dist/chunk-BGMNYKQY.mjs.map +1 -0
- package/dist/{chunk-OOWHC7AF.mjs → chunk-FALZDKAW.mjs} +6 -5
- package/dist/chunk-FALZDKAW.mjs.map +1 -0
- package/dist/{chunk-X7MOM6U4.mjs → chunk-FCMP6QEZ.mjs} +10 -5
- package/dist/chunk-FCMP6QEZ.mjs.map +1 -0
- package/dist/{chunk-KPKLW25H.mjs → chunk-KBBHISBO.mjs} +10 -5
- package/dist/chunk-KBBHISBO.mjs.map +1 -0
- package/dist/{chunk-CIRGC4FT.mjs → chunk-MOFNE6PO.mjs} +7 -6
- package/dist/chunk-MOFNE6PO.mjs.map +1 -0
- package/dist/{chunk-PSJKBKOF.mjs → chunk-MT5JI4OR.mjs} +16 -7
- package/dist/chunk-MT5JI4OR.mjs.map +1 -0
- package/dist/{chunk-MVKJVXAK.mjs → chunk-S5NKKKV5.mjs} +40 -9
- package/dist/chunk-S5NKKKV5.mjs.map +1 -0
- package/dist/{chunk-CCFQC3T6.mjs → chunk-UHQ6WE5D.mjs} +8 -5
- package/dist/chunk-UHQ6WE5D.mjs.map +1 -0
- package/dist/{chunk-XHDDK4ZU.mjs → chunk-VK4VQQYY.mjs} +3 -4
- package/dist/chunk-VK4VQQYY.mjs.map +1 -0
- package/dist/{chunk-TSAITPYC.mjs → chunk-XUAAKVRL.mjs} +6 -5
- package/dist/chunk-XUAAKVRL.mjs.map +1 -0
- package/dist/donut-chart.d.mts +1 -0
- package/dist/donut-chart.d.ts +1 -0
- package/dist/donut-chart.js +23 -13
- package/dist/donut-chart.js.map +1 -1
- package/dist/donut-chart.mjs +5 -5
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +213 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -13
- package/dist/index.mjs.map +1 -1
- package/dist/line-chart.d.mts +1 -0
- package/dist/line-chart.d.ts +1 -0
- package/dist/line-chart.js +23 -10
- package/dist/line-chart.js.map +1 -1
- package/dist/line-chart.mjs +4 -4
- package/dist/pie-chart-label.d.mts +1 -1
- package/dist/pie-chart-label.d.ts +1 -1
- package/dist/pie-chart-label.js +3 -3
- package/dist/pie-chart-label.js.map +1 -1
- package/dist/pie-chart-label.mjs +1 -1
- package/dist/pie-chart.d.mts +2 -5
- package/dist/pie-chart.d.ts +2 -5
- package/dist/pie-chart.js +23 -13
- package/dist/pie-chart.js.map +1 -1
- package/dist/pie-chart.mjs +5 -5
- package/dist/radar-chart.d.mts +2 -1
- package/dist/radar-chart.d.ts +2 -1
- package/dist/radar-chart.js +25 -12
- package/dist/radar-chart.js.map +1 -1
- package/dist/radar-chart.mjs +4 -4
- package/dist/use-area-chart.d.mts +1 -0
- package/dist/use-area-chart.d.ts +1 -0
- package/dist/use-bar-chart.d.mts +16 -2
- package/dist/use-bar-chart.d.ts +16 -2
- package/dist/use-bar-chart.js +38 -2
- package/dist/use-bar-chart.js.map +1 -1
- package/dist/use-bar-chart.mjs +1 -1
- package/dist/use-chart-axis.d.mts +8 -3
- package/dist/use-chart-axis.d.ts +8 -3
- package/dist/use-chart-axis.js +2 -3
- package/dist/use-chart-axis.js.map +1 -1
- package/dist/use-chart-axis.mjs +1 -1
- package/dist/use-chart-grid.d.mts +1 -0
- package/dist/use-chart-grid.d.ts +1 -0
- package/dist/use-chart-legend.d.mts +1 -0
- package/dist/use-chart-legend.d.ts +1 -0
- package/dist/use-chart-reference-line.d.mts +1 -0
- package/dist/use-chart-reference-line.d.ts +1 -0
- package/dist/use-chart-tooltip.d.mts +9 -0
- package/dist/use-chart-tooltip.d.ts +9 -0
- package/dist/use-chart-tooltip.js.map +1 -1
- package/dist/use-chart-tooltip.mjs +1 -1
- package/dist/use-chart.d.mts +1 -0
- package/dist/use-chart.d.ts +1 -0
- package/dist/use-line-chart.d.mts +1 -0
- package/dist/use-line-chart.d.ts +1 -0
- package/dist/use-pie-chart.d.mts +4 -3
- package/dist/use-pie-chart.d.ts +4 -3
- package/dist/use-pie-chart.js +6 -6
- package/dist/use-pie-chart.js.map +1 -1
- package/dist/use-pie-chart.mjs +2 -2
- package/dist/use-radar-chart.d.mts +8 -3
- package/dist/use-radar-chart.d.ts +8 -3
- package/dist/use-radar-chart.js +6 -5
- package/dist/use-radar-chart.js.map +1 -1
- package/dist/use-radar-chart.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-CCFQC3T6.mjs.map +0 -1
- package/dist/chunk-CIRGC4FT.mjs.map +0 -1
- package/dist/chunk-FTAFXLVL.mjs.map +0 -1
- package/dist/chunk-IOVOXWUL.mjs.map +0 -1
- package/dist/chunk-KPKLW25H.mjs.map +0 -1
- package/dist/chunk-MVKJVXAK.mjs.map +0 -1
- package/dist/chunk-OOWHC7AF.mjs.map +0 -1
- package/dist/chunk-PSJKBKOF.mjs.map +0 -1
- package/dist/chunk-TSAITPYC.mjs.map +0 -1
- package/dist/chunk-UK6B6KJ7.mjs.map +0 -1
- package/dist/chunk-X7MOM6U4.mjs.map +0 -1
- package/dist/chunk-XHDDK4ZU.mjs.map +0 -1
@@ -19,7 +19,7 @@ var pieChartLabel = ({
|
|
19
19
|
labelOffset: labelOffsetProp,
|
20
20
|
isPercent,
|
21
21
|
labelProps,
|
22
|
-
|
22
|
+
labelFormatter,
|
23
23
|
styles
|
24
24
|
}) => {
|
25
25
|
const labelOffset = labelOffsetProp != null ? labelOffsetProp : (outerRadius - innerRadius) * 0.5 + DEFAULT_LABEL_OFFSET;
|
@@ -29,8 +29,8 @@ var pieChartLabel = ({
|
|
29
29
|
const displayLabel = () => {
|
30
30
|
if (isPercent) {
|
31
31
|
return parseFloat((percent * 100).toFixed(0)) > 0 && `${(percent * 100).toFixed(0)}%`;
|
32
|
-
} else if (!isUndefined(
|
33
|
-
return
|
32
|
+
} else if (!isUndefined(labelFormatter)) {
|
33
|
+
return labelFormatter(value);
|
34
34
|
} else {
|
35
35
|
return value;
|
36
36
|
}
|
@@ -81,4 +81,4 @@ export {
|
|
81
81
|
pieChartLabel,
|
82
82
|
pieChartLabelLine
|
83
83
|
};
|
84
|
-
//# sourceMappingURL=chunk-
|
84
|
+
//# sourceMappingURL=chunk-4MW4FB2T.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/pie-chart-label.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui } from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport { cx, isUndefined } from \"@yamada-ui/utils\"\n\nconst RADIAN = Math.PI / 180\nconst DEFAULT_LABEL_OFFSET = 22\n\nexport type PieChartLabelProps = {\n className?: string\n cx?: number\n cy?: number\n midAngle?: number\n innerRadius?: number\n outerRadius?: number\n middleRadius?: number\n percent?: number\n value?: number\n labelOffset?: number\n isPercent?: boolean\n labelProps?: HTMLUIProps<\"text\">\n
|
1
|
+
{"version":3,"sources":["../src/pie-chart-label.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui } from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport { cx, isUndefined } from \"@yamada-ui/utils\"\n\nconst RADIAN = Math.PI / 180\nconst DEFAULT_LABEL_OFFSET = 22\n\nexport type PieChartLabelProps = {\n className?: string\n cx?: number\n cy?: number\n midAngle?: number\n innerRadius?: number\n outerRadius?: number\n middleRadius?: number\n percent?: number\n value?: number\n labelOffset?: number\n isPercent?: boolean\n labelProps?: HTMLUIProps<\"text\">\n labelFormatter?: (value: number) => string\n styles: Dict<CSSUIObject>\n}\n\nexport const pieChartLabel: (props: PieChartLabelProps) => React.ReactNode = ({\n className: cellClassName,\n cx: cxProp = 0,\n cy: cyProp = 0,\n midAngle = 0,\n innerRadius = 0,\n outerRadius = 0,\n middleRadius = 0,\n percent = 0,\n value = 0,\n labelOffset: labelOffsetProp,\n isPercent,\n labelProps,\n labelFormatter,\n styles,\n}) => {\n const labelOffset =\n labelOffsetProp ?? (outerRadius - innerRadius) * 0.5 + DEFAULT_LABEL_OFFSET\n\n const x = cxProp + (middleRadius + labelOffset) * Math.cos(-midAngle * RADIAN)\n const y = cyProp + (middleRadius + labelOffset) * Math.sin(-midAngle * RADIAN)\n\n const textAnchor = x > cxProp ? \"start\" : x < cxProp ? \"end\" : \"middle\"\n const displayLabel = () => {\n if (isPercent) {\n return (\n parseFloat((percent * 100).toFixed(0)) > 0 &&\n `${(percent * 100).toFixed(0)}%`\n )\n } else if (!isUndefined(labelFormatter)) {\n return labelFormatter(value)\n } else {\n return value\n }\n }\n\n return (\n <ui.text\n className={cx(cellClassName, \"ui-chart__label\")}\n x={x}\n y={y}\n textAnchor={textAnchor}\n dominantBaseline=\"central\"\n __css={styles}\n {...labelProps}\n >\n {displayLabel()}\n </ui.text>\n )\n}\n\ntype Point = { x: number; y: number }\n\nexport type PieChartLabelLineProps = {\n className?: string\n cx?: number\n cy?: number\n innerRadius?: number\n midAngle?: number\n middleRadius?: number\n outerRadius?: number\n points?: Array<Point>\n labelOffset?: number\n labelLineProps?: HTMLUIProps<\"path\">\n styles: Dict<CSSUIObject>\n}\n\nexport const pieChartLabelLine: (\n props: PieChartLabelLineProps,\n) => React.ReactElement<SVGElement> = ({\n className: cellClassName,\n cx: cxProp = 0,\n cy: cyProp = 0,\n innerRadius = 0,\n midAngle = 0,\n middleRadius = 0,\n outerRadius = 0,\n points = [{ x: 0, y: 0 }],\n labelOffset: labelOffsetProp,\n labelLineProps,\n styles,\n}) => {\n const labelOffset =\n labelOffsetProp ?? (outerRadius - innerRadius) * 0.5 + DEFAULT_LABEL_OFFSET\n\n const x = cxProp + (middleRadius + labelOffset) * Math.cos(-midAngle * RADIAN)\n const y = cyProp + (middleRadius + labelOffset) * Math.sin(-midAngle * RADIAN)\n\n const d: string = `M ${points[0].x} ${points[0].y} L ${x} ${y}`\n\n return (\n <ui.path\n className={cx(cellClassName, \"ui-chart__label-line\")}\n d={d}\n __css={styles}\n {...labelLineProps}\n />\n )\n}\n"],"mappings":";;;AACA,SAAS,UAAU;AAEnB,SAAS,IAAI,mBAAmB;AA2D5B;AAzDJ,IAAM,SAAS,KAAK,KAAK;AACzB,IAAM,uBAAuB;AAmBtB,IAAM,gBAAgE,CAAC;AAAA,EAC5E,WAAW;AAAA,EACX,IAAI,SAAS;AAAA,EACb,IAAI,SAAS;AAAA,EACb,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EACd,eAAe;AAAA,EACf,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AA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O,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;AAE7D,SACE;AAAA,IAAC,GAAG;AAAA,IAAH;AAAA,MACC,WAAW,GAAG,eAAe,sBAAsB;AAAA,MACnD;AAAA,MACA,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
useBarChart
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-S5NKKKV5.mjs";
|
5
5
|
import {
|
6
6
|
useChartAxis
|
7
|
-
} from "./chunk-
|
7
|
+
} from "./chunk-VK4VQQYY.mjs";
|
8
8
|
import {
|
9
9
|
useChartGrid
|
10
10
|
} from "./chunk-D7EZKGCJ.mjs";
|
@@ -16,13 +16,13 @@ import {
|
|
16
16
|
} from "./chunk-5Q6O726L.mjs";
|
17
17
|
import {
|
18
18
|
useChartTooltip
|
19
|
-
} from "./chunk-
|
19
|
+
} from "./chunk-AOGTJ4EN.mjs";
|
20
20
|
import {
|
21
21
|
ChartLegend
|
22
22
|
} from "./chunk-DGOXJ373.mjs";
|
23
23
|
import {
|
24
24
|
ChartTooltip
|
25
|
-
} from "./chunk-
|
25
|
+
} from "./chunk-MT5JI4OR.mjs";
|
26
26
|
import {
|
27
27
|
ChartProvider,
|
28
28
|
useChart
|
@@ -40,7 +40,6 @@ import { useMemo } from "react";
|
|
40
40
|
import {
|
41
41
|
Legend,
|
42
42
|
BarChart as ReChartsBarChart,
|
43
|
-
Bar,
|
44
43
|
CartesianGrid,
|
45
44
|
Tooltip,
|
46
45
|
XAxis,
|
@@ -73,7 +72,10 @@ var BarChart = forwardRef((props, ref) => {
|
|
73
72
|
withLegend = false,
|
74
73
|
containerProps,
|
75
74
|
unit,
|
75
|
+
yAxisTickFormatter,
|
76
|
+
xAxisTickFormatter,
|
76
77
|
valueFormatter,
|
78
|
+
labelFormatter,
|
77
79
|
tooltipProps,
|
78
80
|
tooltipAnimationDuration,
|
79
81
|
legendProps,
|
@@ -84,11 +86,13 @@ var BarChart = forwardRef((props, ref) => {
|
|
84
86
|
fillOpacity,
|
85
87
|
chartProps,
|
86
88
|
syncId,
|
89
|
+
cell,
|
87
90
|
...rest
|
88
91
|
} = omitThemeProps(mergedProps);
|
89
|
-
const {
|
92
|
+
const { bars, barVars, getBarChartProps, setHighlightedArea } = useBarChart({
|
90
93
|
data,
|
91
94
|
series,
|
95
|
+
cell,
|
92
96
|
type,
|
93
97
|
layoutType,
|
94
98
|
chartProps,
|
@@ -121,7 +125,8 @@ var BarChart = forwardRef((props, ref) => {
|
|
121
125
|
xAxisLabelProps,
|
122
126
|
yAxisLabelProps,
|
123
127
|
unit,
|
124
|
-
|
128
|
+
yAxisTickFormatter,
|
129
|
+
xAxisTickFormatter,
|
125
130
|
styles
|
126
131
|
});
|
127
132
|
const { getReferenceLineProps } = useChartReferenceLine({
|
@@ -142,18 +147,6 @@ var BarChart = forwardRef((props, ref) => {
|
|
142
147
|
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
143
148
|
legendProps
|
144
149
|
});
|
145
|
-
const bars = useMemo(
|
146
|
-
() => series.map(({ dataKey: dataKey2 }, index) => {
|
147
|
-
return /* @__PURE__ */ jsx(
|
148
|
-
Bar,
|
149
|
-
{
|
150
|
-
...getBarProps({ index, className: "ui-bar-chart__bar" })
|
151
|
-
},
|
152
|
-
`bar-${dataKey2}`
|
153
|
-
);
|
154
|
-
}),
|
155
|
-
[getBarProps, series]
|
156
|
-
);
|
157
150
|
const referenceLinesItems = useMemo(
|
158
151
|
() => referenceLineProps.map((_, index) => /* @__PURE__ */ jsx(
|
159
152
|
ReferenceLine,
|
@@ -231,6 +224,7 @@ var BarChart = forwardRef((props, ref) => {
|
|
231
224
|
label,
|
232
225
|
payload,
|
233
226
|
valueFormatter,
|
227
|
+
labelFormatter,
|
234
228
|
unit,
|
235
229
|
...computedTooltipProps
|
236
230
|
}
|
@@ -252,4 +246,4 @@ var BarChart = forwardRef((props, ref) => {
|
|
252
246
|
export {
|
253
247
|
BarChart
|
254
248
|
};
|
255
|
-
//# sourceMappingURL=chunk-
|
249
|
+
//# sourceMappingURL=chunk-AODYT4HF.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/bar-chart.tsx"],"sourcesContent":["import type { HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMemo } from \"react\"\nimport {\n Legend,\n BarChart as ReChartsBarChart,\n CartesianGrid,\n Tooltip,\n XAxis,\n YAxis,\n ResponsiveContainer,\n ReferenceLine,\n Label,\n} from \"recharts\"\nimport { ChartLegend } from \"./chart-legend\"\nimport { ChartTooltip } from \"./chart-tooltip\"\nimport { useBarChart } from \"./use-bar-chart\"\nimport type { UseBarChartOptions } from \"./use-bar-chart\"\nimport type { UseChartProps } from \"./use-chart\"\nimport { ChartProvider, useChart } from \"./use-chart\"\nimport type { UseChartAxisOptions } from \"./use-chart-axis\"\nimport { useChartAxis } from \"./use-chart-axis\"\nimport { useChartGrid, type UseChartGridOptions } from \"./use-chart-grid\"\nimport type { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport {\n useChartReferenceLine,\n type UseChartReferenceLineOptions,\n} from \"./use-chart-reference-line\"\nimport type { UseChartTooltipOptions } from \"./use-chart-tooltip\"\nimport { useChartTooltip } from \"./use-chart-tooltip\"\n\ntype BarChartOptions = {\n /**\n * If `true`, tooltip is visible.\n *\n * @default true\n */\n withTooltip?: boolean\n /**\n * If `true`, legend is visible.\n *\n * @default false\n */\n withLegend?: boolean\n}\n\nexport type BarChartProps = HTMLUIProps<\"div\"> &\n ThemeProps<\"BarChart\"> &\n BarChartOptions &\n UseBarChartOptions &\n UseChartProps &\n UseChartAxisOptions &\n UseChartReferenceLineOptions &\n UseChartGridOptions &\n UseChartTooltipOptions &\n UseChartLegendProps\n\n/**\n * `BarChart` is a component for drawing bar charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/bar-chart\n */\nexport const BarChart = forwardRef<BarChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"BarChart\", props)\n const {\n className,\n series,\n dataKey,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n barProps,\n xAxisProps,\n yAxisProps,\n xAxisLabel,\n yAxisLabel,\n xAxisLabelProps,\n yAxisLabelProps,\n type = \"default\",\n withTooltip = true,\n withLegend = false,\n containerProps,\n unit,\n yAxisTickFormatter,\n xAxisTickFormatter,\n valueFormatter,\n labelFormatter,\n tooltipProps,\n tooltipAnimationDuration,\n legendProps,\n data,\n referenceLineProps = [],\n gridProps,\n strokeDasharray,\n fillOpacity,\n chartProps,\n syncId,\n cell,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const { bars, barVars, getBarChartProps, setHighlightedArea } = useBarChart({\n data,\n series,\n cell,\n type,\n layoutType,\n chartProps,\n barProps,\n referenceLineProps,\n fillOpacity,\n syncId,\n xAxisLabel,\n yAxisLabel,\n styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const {\n getXAxisProps,\n getYAxisProps,\n getXAxisLabelProps,\n getYAxisLabelProps,\n } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n xAxisLabel,\n yAxisLabel,\n xAxisLabelProps,\n yAxisLabelProps,\n unit,\n yAxisTickFormatter,\n xAxisTickFormatter,\n styles,\n })\n const { getReferenceLineProps } = useChartReferenceLine({\n referenceLineProps,\n styles,\n })\n const { getGridProps } = useChartGrid({\n gridProps,\n gridAxis,\n strokeDasharray,\n styles,\n })\n const { tooltipProps: computedTooltipProps, getTooltipProps } =\n useChartTooltip({\n tooltipProps,\n tooltipAnimationDuration,\n styles,\n })\n const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({\n legendProps,\n })\n\n const referenceLinesItems = useMemo(\n () =>\n referenceLineProps.map((_, index) => (\n <ReferenceLine\n key={`referenceLine-${index}`}\n {...getReferenceLineProps({\n index,\n className: \"ui-bar-chart__reference-line\",\n })}\n />\n )),\n [getReferenceLineProps, referenceLineProps],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-bar-chart\", className)}\n var={barVars}\n __css={{ ...styles.container }}\n {...rest}\n >\n <ResponsiveContainer\n {...getContainerProps({ className: \"ui-bar-chart__container\" })}\n >\n <ReChartsBarChart\n {...getBarChartProps({ className: \"ui-bar-chart__chart\" })}\n >\n <CartesianGrid\n {...getGridProps({ className: \"ui-bar-chart__grid\" })}\n />\n\n <XAxis {...getXAxisProps({ className: \"ui-bar-chart__x-axis\" })}>\n <Label\n {...getXAxisLabelProps({\n className: \"ui-bar-chart__x-axis-label\",\n })}\n />\n </XAxis>\n\n <YAxis {...getYAxisProps({ className: \"ui-bar-chart__y-axis\" })}>\n <Label\n {...getYAxisLabelProps({\n className: \"ui-bar-chart__y-axis-label\",\n })}\n />\n </YAxis>\n\n {withLegend ? (\n <Legend\n content={({ payload }) => (\n <ChartLegend\n className=\"ui-bar-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-bar-chart__tooltip\"\n label={label}\n payload={payload}\n valueFormatter={valueFormatter}\n labelFormatter={labelFormatter}\n unit={unit}\n {...computedTooltipProps}\n />\n )}\n {...getTooltipProps()}\n />\n ) : null}\n\n {bars}\n {referenceLinesItems}\n </ReChartsBarChart>\n </ResponsiveContainer>\n </ui.div>\n </ChartProvider>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA,EACE;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oBAAC,SAAO,GAAG,cAAc,EAAE,WAAW,uBAAuB,CAAC,GAC5D;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,mBAAmB;AAAA,sBACrB,WAAW;AAAA,oBACb,CAAC;AAAA;AAAA,gBACH,GACF;AAAA,gBAEA,oBAAC,SAAO,GAAG,cAAc,EAAE,WAAW,uBAAuB,CAAC,GAC5D;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,mBAAmB;AAAA,sBACrB,WAAW;AAAA,oBACb,CAAC;AAAA;AAAA,gBACH,GACF;AAAA,gBAEC,aACC;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS,CAAC,EAAE,QAAQ,MAClB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA,aAAa;AAAA,wBACZ,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,eAAe;AAAA;AAAA,gBACrB,IACE;AAAA,gBAEH,cACC;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS,CAAC,EAAE,OAAO,QAAQ,MACzB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA;AAAA,wBACA;AAAA,wBACA;AAAA,wBACA;AAAA,wBACC,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,gBAAgB;AAAA;AAAA,gBACtB,IACE;AAAA,gBAEH;AAAA,gBACA;AAAA;AAAA;AAAA,UACH;AAAA;AAAA,MACF;AAAA;AAAA,EACF,GACF;AAEJ,CAAC;","names":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-chart-tooltip.ts"],"sourcesContent":["import { useTheme, type CSSUIObject } from \"@yamada-ui/core\"\nimport { splitObject, type Dict, cx } from \"@yamada-ui/utils\"\nimport { useCallback, useMemo } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport { getClassName } from \"./chart-utils\"\nimport type { ChartPropGetter, TooltipProps } from \"./chart.types\"\nimport { tooltipProperties } from \"./rechart-properties\"\n\nexport type UseChartTooltipOptions = {\n /**\n * Props passed down to recharts 'Tooltip' component.\n */\n tooltipProps?: TooltipProps\n /**\n * Specifies the duration of animation, the unit of this option is ms.\n *\n * @default 0\n */\n tooltipAnimationDuration?: number\n /**\n * A function to format values on inside the tooltip.\n */\n valueFormatter?: (value: any) => string\n /**\n * A function to format labels on inside the tooltip.\n */\n labelFormatter?: (label: string) => string\n}\n\ntype UseChartTooltipProps = UseChartTooltipOptions & {\n styles: Dict<CSSUIObject>\n}\n\nexport const useChartTooltip = ({\n tooltipProps: _tooltipProps = {},\n tooltipAnimationDuration = 0,\n styles,\n}: UseChartTooltipProps) => {\n const { theme } = useTheme()\n const { cursor, ...rest } = _tooltipProps\n const cursorClassName = useMemo(\n () => getClassName({ ...styles.cursor, ...cursor })(theme),\n [cursor, styles.cursor, theme],\n )\n\n const [tooltipProps, tooltipUIProps] = splitObject<Dict, string>(\n rest,\n tooltipProperties,\n )\n\n const getTooltipProps: ChartPropGetter<\n \"div\",\n Partial<Recharts.TooltipProps<any, any>>,\n Omit<Recharts.TooltipProps<any, any>, \"ref\">\n > = useCallback(\n (props, ref = null) => ({\n ref,\n animationDuration: tooltipAnimationDuration,\n isAnimationActive: (tooltipAnimationDuration || 0) > 0,\n cursor: {\n className: cx(\"ui-chart__cursor\", cursorClassName),\n },\n ...props,\n ...tooltipProps,\n }),\n [cursorClassName, tooltipAnimationDuration, tooltipProps],\n )\n\n return { tooltipProps: tooltipUIProps, getTooltipProps }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,gBAAkC;AAC3C,SAAS,aAAwB,UAAU;AAC3C,SAAS,aAAa,eAAe;AA+B9B,IAAM,kBAAkB,CAAC;AAAA,EAC9B,cAAc,gBAAgB,CAAC;AAAA,EAC/B,2BAA2B;AAAA,EAC3B;AACF,MAA4B;AAC1B,QAAM,EAAE,MAAM,IAAI,SAAS;AAC3B,QAAM,EAAE,QAAQ,GAAG,KAAK,IAAI;AAC5B,QAAM,kBAAkB;AAAA,IACtB,MAAM,aAAa,EAAE,GAAG,OAAO,QAAQ,GAAG,OAAO,CAAC,EAAE,KAAK;AAAA,IACzD,CAAC,QAAQ,OAAO,QAAQ,KAAK;AAAA,EAC/B;AAEA,QAAM,CAAC,cAAc,cAAc,IAAI;AAAA,IACrC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,kBAIF;AAAA,IACF,CAAC,OAAO,MAAM,UAAU;AAAA,MACtB;AAAA,MACA,mBAAmB;AAAA,MACnB,oBAAoB,4BAA4B,KAAK;AAAA,MACrD,QAAQ;AAAA,QACN,WAAW,GAAG,oBAAoB,eAAe;AAAA,MACnD;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA,CAAC,iBAAiB,0BAA0B,YAAY;AAAA,EAC1D;AAEA,SAAO,EAAE,cAAc,gBAAgB,gBAAgB;AACzD;","names":[]}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import {
|
3
3
|
pieChartLabel,
|
4
4
|
pieChartLabelLine
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-4MW4FB2T.mjs";
|
6
6
|
import {
|
7
7
|
pieChartProperties,
|
8
8
|
pieProperties
|
@@ -29,7 +29,7 @@ var usePieChart = ({
|
|
29
29
|
paddingAngle = 0,
|
30
30
|
startAngle = 90,
|
31
31
|
endAngle = -270,
|
32
|
-
|
32
|
+
labelFormatter,
|
33
33
|
styles,
|
34
34
|
...rest
|
35
35
|
}) => {
|
@@ -109,11 +109,11 @@ var usePieChart = ({
|
|
109
109
|
labelOffset,
|
110
110
|
isPercent,
|
111
111
|
labelProps,
|
112
|
-
|
112
|
+
labelFormatter,
|
113
113
|
styles: styles.label,
|
114
114
|
...props
|
115
115
|
}),
|
116
|
-
[isPercent, labelOffset, labelProps, styles.label,
|
116
|
+
[isPercent, labelOffset, labelProps, styles.label, labelFormatter]
|
117
117
|
);
|
118
118
|
const labelLine = useCallback(
|
119
119
|
(props) => {
|
@@ -228,4 +228,4 @@ var usePieChart = ({
|
|
228
228
|
export {
|
229
229
|
usePieChart
|
230
230
|
};
|
231
|
-
//# sourceMappingURL=chunk-
|
231
|
+
//# sourceMappingURL=chunk-BGMNYKQY.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-pie-chart.ts"],"sourcesContent":["import { useTheme, type CSSUIObject, type CSSUIProps } from \"@yamada-ui/core\"\nimport { cx, type Dict } from \"@yamada-ui/utils\"\nimport type { ComponentPropsWithoutRef } from \"react\"\nimport { useCallback, useMemo, useState } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport { getClassName, getComponentProps } from \"./chart-utils\"\nimport type {\n CellProps,\n ChartPropGetter,\n PieChartProps,\n PieProps,\n RequiredChartPropGetter,\n} from \"./chart.types\"\nimport { pieChartLabel, pieChartLabelLine } from \"./pie-chart-label\"\nimport { pieChartProperties, pieProperties } from \"./rechart-properties\"\n\nexport type UsePieChartOptions = {\n /**\n * Chart data.\n */\n data: CellProps[]\n /**\n * Props passed down to recharts `PieChart` component.\n */\n chartProps?: PieChartProps\n /**\n * Props for the pie.\n */\n pieProps?: Partial<PieProps>\n /**\n * Props for the cell.\n */\n cellProps?: Partial<CellProps>\n /**\n * Determines whether each segment should have associated label.\n *\n * @default false\n */\n withLabels?: boolean\n /**\n * Determines whether segments labels should have lines that connect the segment with the label.\n *\n * @default false\n */\n withLabelLines?: boolean\n /**\n * Distance between chart and label.\n */\n labelOffset?: number\n /**\n * Determines whether labels should be displayed as percentages.\n *\n * @default false\n */\n isPercent?: boolean\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 '0%'\n */\n innerRadius?: number | string\n /**\n * Controls thickness of the chart segments. If it is a number, it is calculated as px.\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 '80%'\n */\n outerRadius?: number | string\n /**\n * Controls padding between segments.\n *\n * @default 0\n */\n paddingAngle?: number\n /**\n * Stroke width for the chart pies.\n *\n * @default 1\n */\n strokeWidth?: number\n /**\n * Controls angle at which chart starts.\n *\n * @default 90\n */\n startAngle?: number\n /**\n * Controls angle at which chart ends.\n *\n * @default -270\n */\n endAngle?: number\n /**\n * Controls fill opacity of all pies.\n *\n * @default 1\n */\n fillOpacity?: number | [number, number]\n /**\n * A function to format labels.\n */\n labelFormatter?: (value: number) => string\n}\n\ntype UsePieChartProps = UsePieChartOptions & {\n styles: Dict<CSSUIObject>\n}\n\nexport const usePieChart = ({\n data,\n withLabels = false,\n withLabelLines = false,\n labelOffset,\n isPercent = false,\n strokeWidth = 1,\n fillOpacity = 1,\n innerRadius = \"0%\",\n outerRadius = withLabels ? \"80%\" : \"100%\",\n paddingAngle = 0,\n startAngle = 90,\n endAngle = -270,\n labelFormatter,\n styles,\n ...rest\n}: UsePieChartProps) => {\n const { theme } = useTheme()\n const [highlightedArea, setHighlightedArea] = useState<string | null>(null)\n const shouldHighlight = highlightedArea !== null\n const { dimCell, ...computedCellProps } = rest.cellProps ?? {}\n const {\n activeShape = {},\n inactiveShape = {},\n label: labelProps,\n labelLine: labelLineProps,\n ...computedPieProps\n } = rest.pieProps ?? {}\n\n const cellColors: CSSUIProps[\"var\"] = useMemo(\n () =>\n data.map(({ color }, index) => ({\n __prefix: \"ui\",\n name: `cell-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n })),\n [data],\n )\n\n const pieVars: CSSUIProps[\"var\"] = useMemo(\n () =>\n [\n ...cellColors,\n { __prefix: \"ui\", name: \"fill-opacity\", value: fillOpacity },\n ] as Required<CSSUIProps>[\"var\"],\n [fillOpacity, cellColors],\n )\n\n const [chartProps, chartClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.chartProps ?? {}, pieChartProperties],\n styles.chart,\n )(theme),\n [rest.chartProps, styles.chart, theme],\n )\n\n const [pieProps, pieClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [computedPieProps, pieProperties],\n styles.pie,\n )(theme),\n [computedPieProps, styles.pie, theme],\n )\n\n const cellClassName = useMemo(() => {\n const resolvedCellProps = {\n fillOpacity: \"var(--ui-fill-opacity)\",\n ...styles.cell,\n ...computedCellProps,\n }\n\n return getClassName(resolvedCellProps)(theme)\n }, [computedCellProps, styles.cell, theme])\n\n const dimCellClassName = useMemo(() => {\n const resolvedDimCell = { ...styles.dimCell, ...dimCell }\n\n return getClassName(resolvedDimCell)(theme)\n }, [dimCell, styles.dimCell, theme])\n\n const activeShapeProps = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [activeShape, pieProperties],\n styles.activeShape,\n )(theme, true),\n [activeShape, styles.activeShape, theme],\n )\n\n const inactiveShapeProps = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [inactiveShape, pieProperties],\n styles.inactiveShape,\n )(theme, true),\n [inactiveShape, styles.inactiveShape, theme],\n )\n\n const label: Recharts.PieLabel = useCallback(\n (props: any) =>\n pieChartLabel({\n labelOffset,\n isPercent,\n labelProps,\n labelFormatter,\n styles: styles.label,\n ...props,\n }),\n [isPercent, labelOffset, labelProps, styles.label, labelFormatter],\n )\n\n const labelLine = useCallback(\n (props: any) => {\n return pieChartLabelLine({\n labelOffset,\n labelLineProps,\n styles: styles.labelLine,\n ...props,\n })\n },\n [labelLineProps, labelOffset, styles.labelLine],\n )\n\n const cellPropList = useMemo(\n () =>\n data.map((props, index) => {\n const { name, dimCell = {}, ...computedProps } = props\n const color = `var(--ui-cell-${index})`\n const dimmed = shouldHighlight && highlightedArea !== name\n const resolvedProps = {\n ...computedProps,\n ...(dimmed ? dimCell : {}),\n }\n\n const className = getClassName(\n {\n cellClassName,\n ...resolvedProps,\n },\n dimmed ? dimCellClassName : undefined,\n )(theme)\n\n return {\n color,\n className,\n }\n }),\n [\n cellClassName,\n data,\n dimCellClassName,\n highlightedArea,\n shouldHighlight,\n theme,\n ],\n )\n\n const getPieChartProps: ChartPropGetter<\n \"div\",\n ComponentPropsWithoutRef<typeof Recharts.PieChart>,\n ComponentPropsWithoutRef<typeof Recharts.PieChart>\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, chartClassName),\n ...props,\n ...chartProps,\n }),\n [chartProps, chartClassName],\n )\n\n const getPieProps: RequiredChartPropGetter<\n \"div\",\n Partial<Recharts.PieProps>,\n Omit<Recharts.PieProps, \"ref\">\n > = useCallback(\n ({ className, ...props }, ref = null) => ({\n ref,\n className: cx(className, pieClassName),\n dataKey: \"value\",\n data,\n rootTabIndex: -1,\n outerRadius,\n innerRadius,\n paddingAngle,\n startAngle,\n endAngle,\n isAnimationActive: false,\n label: withLabels ? label : false,\n labelLine: withLabelLines ? labelLine : false,\n activeShape: activeShapeProps,\n inactiveShape: inactiveShapeProps,\n ...(props as Omit<Recharts.PieProps, \"dataKey\">),\n ...pieProps,\n }),\n [\n pieClassName,\n data,\n outerRadius,\n innerRadius,\n paddingAngle,\n startAngle,\n endAngle,\n withLabels,\n label,\n withLabelLines,\n labelLine,\n activeShapeProps,\n inactiveShapeProps,\n pieProps,\n ],\n )\n\n const getCellProps: RequiredChartPropGetter<\n \"div\",\n Omit<Recharts.CellProps, \"ref\"> & { index: number },\n Omit<Recharts.CellProps, \"ref\">\n > = useCallback(\n ({ index, className: classNameProp, ...props }, ref = null) => {\n const { className, color } = cellPropList[index]\n\n return {\n ref,\n className: cx(classNameProp, className),\n fill: color,\n stroke: color,\n strokeWidth,\n ...(props as Recharts.CellProps),\n }\n },\n [cellPropList, strokeWidth],\n )\n\n return {\n pieVars,\n getPieProps,\n getPieChartProps,\n getCellProps,\n setHighlightedArea,\n }\n}\n\nexport type UsePieChartReturn = ReturnType<typeof usePieChart>\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,gBAAmD;AAC5D,SAAS,UAAqB;AAE9B,SAAS,aAAa,SAAS,gBAAgB;AA4GxC,IAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA,aAAa;AAAA,EACb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eAAe;AAAA,MACf,GAAI;AAAA,MACJ,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,eAIF;AAAA,IACF,CAAC,EAAE,OAAO,WAAW,eAAe,GAAG,MAAM,GAAG,MAAM,SAAS;AAC7D,YAAM,EAAE,WAAW,MAAM,IAAI,aAAa,KAAK;AAE/C,aAAO;AAAA,QACL;AAAA,QACA,WAAW,GAAG,eAAe,SAAS;AAAA,QACtC,MAAM;AAAA,QACN,QAAQ;AAAA,QACR;AAAA,QACA,GAAI;AAAA,MACN;AAAA,IACF;AAAA,IACA,CAAC,cAAc,WAAW;AAAA,EAC5B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["_a","dimCell"]}
|
@@ -1,19 +1,19 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
usePieChart
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-BGMNYKQY.mjs";
|
5
5
|
import {
|
6
6
|
useChartLegend
|
7
7
|
} from "./chunk-5Q6O726L.mjs";
|
8
8
|
import {
|
9
9
|
useChartTooltip
|
10
|
-
} from "./chunk-
|
10
|
+
} from "./chunk-AOGTJ4EN.mjs";
|
11
11
|
import {
|
12
12
|
ChartLegend
|
13
13
|
} from "./chunk-DGOXJ373.mjs";
|
14
14
|
import {
|
15
15
|
ChartTooltip
|
16
|
-
} from "./chunk-
|
16
|
+
} from "./chunk-MT5JI4OR.mjs";
|
17
17
|
import {
|
18
18
|
ChartProvider,
|
19
19
|
useChart
|
@@ -52,6 +52,7 @@ var PieChart = forwardRef((props, ref) => {
|
|
52
52
|
tooltipAnimationDuration,
|
53
53
|
tooltipDataSource = "all",
|
54
54
|
valueFormatter,
|
55
|
+
labelFormatter,
|
55
56
|
unit,
|
56
57
|
innerRadius,
|
57
58
|
outerRadius,
|
@@ -87,7 +88,7 @@ var PieChart = forwardRef((props, ref) => {
|
|
87
88
|
withLabelLines,
|
88
89
|
labelOffset,
|
89
90
|
isPercent,
|
90
|
-
|
91
|
+
labelFormatter,
|
91
92
|
styles
|
92
93
|
});
|
93
94
|
const { getContainerProps } = useChart({ containerProps });
|
@@ -179,4 +180,4 @@ var PieChart = forwardRef((props, ref) => {
|
|
179
180
|
export {
|
180
181
|
PieChart
|
181
182
|
};
|
182
|
-
//# sourceMappingURL=chunk-
|
183
|
+
//# sourceMappingURL=chunk-FALZDKAW.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/pie-chart.tsx"],"sourcesContent":["import type { HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\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 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 { TooltipDataSourceType } from \"./chart.types\"\nimport type { UseChartProps } from \"./use-chart\"\nimport { ChartProvider, useChart } from \"./use-chart\"\nimport type { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport {\n useChartTooltip,\n type UseChartTooltipOptions,\n} from \"./use-chart-tooltip\"\nimport type { UsePieChartOptions } from \"./use-pie-chart\"\nimport { usePieChart } from \"./use-pie-chart\"\n\ntype PieChartOptions = {\n /**\n * If `true`, tooltip is visible.\n *\n * @default true\n */\n withTooltip?: boolean\n /**\n * If `true`, legend is visible.\n *\n * @default false\n */\n withLegend?: boolean\n /**\n * Determines which data is displayed in the tooltip.\n *\n * @default 'all'\n */\n tooltipDataSource?: TooltipDataSourceType\n /**\n * Unit displayed next to each tick in y-axis.\n */\n unit?: string\n}\n\nexport type PieChartProps = HTMLUIProps<\"div\"> &\n ThemeProps<\"pieChart\"> &\n PieChartOptions &\n UsePieChartOptions &\n Omit<UseChartTooltipOptions, \"labelFormatter\"> &\n UseChartLegendProps &\n UseChartProps\n\n/**\n * `PieChart` is a component for drawing pie charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/pie-chart\n */\nexport const PieChart = forwardRef<PieChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"PieChart\", 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 innerRadius,\n outerRadius,\n paddingAngle,\n startAngle,\n endAngle,\n withLabels,\n withLabelLines,\n labelOffset,\n isPercent,\n strokeWidth,\n legendProps,\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\n const cells = useMemo(\n () =>\n data.map(({ name }, index) => (\n <Cell\n key={`pie-cell-${name}`}\n {...getCellProps({ index, className: \"ui-pie-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-pie-chart\", className)}\n var={pieVars}\n __css={{ ...styles.container }}\n {...rest}\n >\n <ResponsiveContainer\n {...getContainerProps({ className: \"ui-pie-chart__container\" })}\n >\n <RechartsPieChart\n {...getPieChartProps({ className: \"ui-pie-chart__chart\" })}\n >\n <Pie\n {...getPieProps({\n className: \"ui-pie-chart__pie\",\n })}\n >\n {cells}\n </Pie>\n\n {withLegend ? (\n <Legend\n content={({ payload }) => (\n <ChartLegend\n className=\"ui-pie-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-pie-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":";;;;;;;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,OACK;AA0HC,cAoBE,YApBF;AArED,IAAM,WAAW,WAAiC,CAAC,OAAO,QAAQ;AACvE,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,YAAY,KAAK;AACtE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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cACE,GAAG,iBAAiB,EAAE,WAAW,sBAAsB,CAAC;AAAA,cAEzD;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,YAAY;AAAA,sBACd,WAAW;AAAA,oBACb,CAAC;AAAA,oBAEA;AAAA;AAAA,gBACH;AAAA,gBAEC,aACC;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS,CAAC,EAAE,QAAQ,MAClB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA,aAAa;AAAA,wBACZ,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,eAAe;AAAA;AAAA,gBACrB,IACE;AAAA,gBAEH,cACC;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS,CAAC,EAAE,OAAO,QAAQ,MACzB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA,SAAS,sBAAsB,YAAY,UAAU;AAAA,wBACrD;AAAA,wBACA;AAAA,wBACC,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,gBAAgB;AAAA;AAAA,gBACtB,IACE;AAAA;AAAA;AAAA,UACN;AAAA;AAAA,MACF;AAAA;AAAA,EACF,GACF;AAEJ,CAAC;","names":[]}
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
} from "./chunk-PNE3JG54.mjs";
|
11
11
|
import {
|
12
12
|
useChartAxis
|
13
|
-
} from "./chunk-
|
13
|
+
} from "./chunk-VK4VQQYY.mjs";
|
14
14
|
import {
|
15
15
|
useChartGrid
|
16
16
|
} from "./chunk-D7EZKGCJ.mjs";
|
@@ -22,13 +22,13 @@ import {
|
|
22
22
|
} from "./chunk-5Q6O726L.mjs";
|
23
23
|
import {
|
24
24
|
useChartTooltip
|
25
|
-
} from "./chunk-
|
25
|
+
} from "./chunk-AOGTJ4EN.mjs";
|
26
26
|
import {
|
27
27
|
ChartLegend
|
28
28
|
} from "./chunk-DGOXJ373.mjs";
|
29
29
|
import {
|
30
30
|
ChartTooltip
|
31
|
-
} from "./chunk-
|
31
|
+
} from "./chunk-MT5JI4OR.mjs";
|
32
32
|
import {
|
33
33
|
ChartProvider,
|
34
34
|
useChart
|
@@ -81,7 +81,10 @@ var AreaChart = forwardRef((props, ref) => {
|
|
81
81
|
unit,
|
82
82
|
gridProps,
|
83
83
|
strokeDasharray,
|
84
|
+
yAxisTickFormatter,
|
85
|
+
xAxisTickFormatter,
|
84
86
|
valueFormatter,
|
87
|
+
labelFormatter,
|
85
88
|
tooltipProps,
|
86
89
|
tooltipAnimationDuration,
|
87
90
|
legendProps,
|
@@ -150,7 +153,8 @@ var AreaChart = forwardRef((props, ref) => {
|
|
150
153
|
xAxisLabelProps,
|
151
154
|
yAxisLabelProps,
|
152
155
|
unit,
|
153
|
-
|
156
|
+
yAxisTickFormatter,
|
157
|
+
xAxisTickFormatter,
|
154
158
|
styles
|
155
159
|
});
|
156
160
|
const { getReferenceLineProps } = useChartReferenceLine({
|
@@ -261,6 +265,7 @@ var AreaChart = forwardRef((props, ref) => {
|
|
261
265
|
label,
|
262
266
|
payload,
|
263
267
|
valueFormatter,
|
268
|
+
labelFormatter,
|
264
269
|
unit,
|
265
270
|
...computedTooltipProps
|
266
271
|
}
|
@@ -283,4 +288,4 @@ var AreaChart = forwardRef((props, ref) => {
|
|
283
288
|
export {
|
284
289
|
AreaChart
|
285
290
|
};
|
286
|
-
//# sourceMappingURL=chunk-
|
291
|
+
//# sourceMappingURL=chunk-FCMP6QEZ.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/area-chart.tsx"],"sourcesContent":["import type { HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { Fragment, useMemo } from \"react\"\nimport {\n CartesianGrid,\n Legend,\n AreaChart as ReChartsAreaChart,\n Area,\n ReferenceLine,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n Label,\n} from \"recharts\"\nimport { AreaGradient } from \"./area-chart-gradient\"\nimport { AreaSplit } from \"./area-chart-split\"\nimport { ChartLegend } from \"./chart-legend\"\nimport { ChartTooltip } from \"./chart-tooltip\"\nimport type { UseAreaChartOptions } from \"./use-area-chart\"\nimport { useAreaChart } from \"./use-area-chart\"\nimport type { UseChartProps } from \"./use-chart\"\nimport { ChartProvider, useChart } from \"./use-chart\"\nimport type { UseChartAxisOptions } from \"./use-chart-axis\"\nimport { useChartAxis } from \"./use-chart-axis\"\nimport type { UseChartGridOptions } from \"./use-chart-grid\"\nimport { useChartGrid } from \"./use-chart-grid\"\nimport type { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport type { UseChartReferenceLineOptions } from \"./use-chart-reference-line\"\nimport { useChartReferenceLine } from \"./use-chart-reference-line\"\nimport type { UseChartTooltipOptions } from \"./use-chart-tooltip\"\nimport { useChartTooltip } from \"./use-chart-tooltip\"\n\ntype AreaChartOptions = {\n /**\n * If `true`, tooltip is visible.\n *\n * @default true\n */\n withTooltip?: boolean\n /**\n * If `true`, legend is visible.\n *\n * @default false\n */\n withLegend?: boolean\n}\n\nexport type AreaChartProps = HTMLUIProps<\"div\"> &\n ThemeProps<\"AreaChart\"> &\n AreaChartOptions &\n UseAreaChartOptions &\n UseChartProps &\n UseChartAxisOptions &\n UseChartReferenceLineOptions &\n UseChartGridOptions &\n UseChartTooltipOptions &\n UseChartLegendProps\n\n/**\n * `AreaChart` is a component for drawing area charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/area-chart\n */\nexport const AreaChart = forwardRef<AreaChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"AreaChart\", props)\n const {\n className,\n series,\n dataKey,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n xAxisLabel,\n yAxisLabel,\n xAxisLabelProps,\n yAxisLabelProps,\n type = \"default\",\n withTooltip = true,\n withLegend = false,\n referenceLineProps = [],\n containerProps,\n unit,\n gridProps,\n strokeDasharray,\n yAxisTickFormatter,\n xAxisTickFormatter,\n valueFormatter,\n labelFormatter,\n tooltipProps,\n tooltipAnimationDuration,\n legendProps,\n data,\n chartProps,\n areaProps,\n withGradient,\n withDots,\n withActiveDots,\n curveType,\n strokeWidth,\n connectNulls,\n fillOpacity,\n splitColors,\n splitOffset,\n syncId,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const {\n getAreaChartProps,\n getAreaSplitProps,\n getAreaProps,\n getAreaGradientProps,\n areaVars,\n setHighlightedArea,\n } = useAreaChart({\n layoutType,\n type,\n series,\n referenceLineProps,\n data,\n chartProps,\n areaProps,\n withGradient,\n withDots,\n withActiveDots,\n curveType,\n strokeWidth,\n connectNulls,\n fillOpacity,\n splitColors,\n splitOffset,\n syncId,\n xAxisLabel,\n yAxisLabel,\n styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const {\n getXAxisProps,\n getYAxisProps,\n getXAxisLabelProps,\n getYAxisLabelProps,\n } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n xAxisLabel,\n yAxisLabel,\n xAxisLabelProps,\n yAxisLabelProps,\n unit,\n yAxisTickFormatter,\n xAxisTickFormatter,\n styles,\n })\n const { getReferenceLineProps } = useChartReferenceLine({\n referenceLineProps,\n styles,\n })\n const { getGridProps } = useChartGrid({\n gridProps,\n gridAxis,\n strokeDasharray,\n styles,\n })\n const { tooltipProps: computedTooltipProps, getTooltipProps } =\n useChartTooltip({\n tooltipProps,\n tooltipAnimationDuration,\n styles,\n })\n const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({\n legendProps,\n })\n\n const areas = useMemo(\n () =>\n series.map(({ dataKey }, index) => {\n const { id, stroke, ...rest } = getAreaProps({\n index,\n className: \"ui-area-chart__area\",\n })\n\n return (\n <Fragment key={`area-${dataKey}`}>\n <defs>\n <AreaGradient {...getAreaGradientProps({ id, color: stroke })} />\n </defs>\n\n <Area id={id} stroke={stroke} {...rest} />\n </Fragment>\n )\n }),\n [getAreaGradientProps, getAreaProps, series],\n )\n\n const referenceLinesItems = useMemo(\n () =>\n referenceLineProps.map((_, index) => (\n <ReferenceLine\n key={`referenceLine-${index}`}\n {...getReferenceLineProps({\n index,\n className: \"ui-area-chart__reference-line\",\n })}\n />\n )),\n [getReferenceLineProps, referenceLineProps],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-area-chart\", className)}\n var={areaVars}\n __css={{ ...styles.container }}\n {...rest}\n >\n <ResponsiveContainer\n {...getContainerProps({ className: \"ui-area-chart__container\" })}\n >\n <ReChartsAreaChart\n {...getAreaChartProps({ className: \"ui-area-chart__chart\" })}\n >\n <CartesianGrid\n {...getGridProps({ className: \"ui-area-chart__grid\" })}\n />\n\n <XAxis {...getXAxisProps({ className: \"ui-area-chart__x-axis\" })}>\n <Label\n {...getXAxisLabelProps({\n className: \"ui-area-chart__x-axis-label\",\n })}\n />\n </XAxis>\n\n <YAxis {...getYAxisProps({ className: \"ui-area-chart__y-axis\" })}>\n <Label\n {...getYAxisLabelProps({\n className: \"ui-area-chart__y-axis-label\",\n })}\n />\n </YAxis>\n\n {withLegend ? (\n <Legend\n content={({ payload }) => (\n <ChartLegend\n className=\"ui-area-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-area-chart__tooltip\"\n label={label}\n payload={payload}\n valueFormatter={valueFormatter}\n labelFormatter={labelFormatter}\n unit={unit}\n {...computedTooltipProps}\n />\n )}\n {...getTooltipProps()}\n />\n ) : null}\n\n {type === \"split\" ? (\n <defs>\n <AreaSplit {...getAreaSplitProps()} />\n </defs>\n ) : null}\n\n {areas}\n {referenceLinesItems}\n </ReChartsAreaChart>\n </ResponsiveContainer>\n </ui.div>\n </ChartProvider>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,UAAU,eAAe;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAsLG,SAEI,KAFJ;AAnIH,IAAM,YAAY,WAAkC,CAAC,OAAO,QAAQ;AACzE,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,aAAa,KAAK;AACvE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,cAAc;AAAA,IACd,aAAa;AAAA,IACb,qBAAqB,CAAC;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI,eAAe,WAAW;AAE9B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,aAAa;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;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AAC;AAAA;AAAA,oBACC,SAAS,CAAC,EAAE,QAAQ,MAClB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA,aAAa;AAAA,wBACZ,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,eAAe;AAAA;AAAA,gBACrB,IACE;AAAA,gBAEH,cACC;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS,CAAC,EAAE,OAAO,QAAQ,MACzB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA;AAAA,wBACA;AAAA,wBACA;AAAA,wBACA;AAAA,wBACC,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,gBAAgB;AAAA;AAAA,gBACtB,IACE;AAAA,gBAEH,SAAS,UACR,oBAAC,UACC,8BAAC,aAAW,GAAG,kBAAkB,GAAG,GACtC,IACE;AAAA,gBAEH;AAAA,gBACA;AAAA;AAAA;AAAA,UACH;AAAA;AAAA,MACF;AAAA;AAAA,EACF,GACF;AAEJ,CAAC;","names":["dataKey","rest"]}
|
@@ -4,7 +4,7 @@ import {
|
|
4
4
|
} from "./chunk-6L73M52L.mjs";
|
5
5
|
import {
|
6
6
|
useChartAxis
|
7
|
-
} from "./chunk-
|
7
|
+
} from "./chunk-VK4VQQYY.mjs";
|
8
8
|
import {
|
9
9
|
useChartGrid
|
10
10
|
} from "./chunk-D7EZKGCJ.mjs";
|
@@ -16,13 +16,13 @@ import {
|
|
16
16
|
} from "./chunk-5Q6O726L.mjs";
|
17
17
|
import {
|
18
18
|
useChartTooltip
|
19
|
-
} from "./chunk-
|
19
|
+
} from "./chunk-AOGTJ4EN.mjs";
|
20
20
|
import {
|
21
21
|
ChartLegend
|
22
22
|
} from "./chunk-DGOXJ373.mjs";
|
23
23
|
import {
|
24
24
|
ChartTooltip
|
25
|
-
} from "./chunk-
|
25
|
+
} from "./chunk-MT5JI4OR.mjs";
|
26
26
|
import {
|
27
27
|
ChartProvider,
|
28
28
|
useChart
|
@@ -71,7 +71,10 @@ var LineChart = forwardRef((props, ref) => {
|
|
71
71
|
xAxisLabelProps,
|
72
72
|
yAxisLabelProps,
|
73
73
|
unit,
|
74
|
+
yAxisTickFormatter,
|
75
|
+
xAxisTickFormatter,
|
74
76
|
valueFormatter,
|
77
|
+
labelFormatter,
|
75
78
|
referenceLineProps,
|
76
79
|
tooltipProps,
|
77
80
|
tooltipAnimationDuration,
|
@@ -130,7 +133,8 @@ var LineChart = forwardRef((props, ref) => {
|
|
130
133
|
xAxisLabelProps,
|
131
134
|
yAxisLabelProps,
|
132
135
|
unit,
|
133
|
-
|
136
|
+
yAxisTickFormatter,
|
137
|
+
xAxisTickFormatter,
|
134
138
|
styles
|
135
139
|
});
|
136
140
|
const { getReferenceLineProps } = useChartReferenceLine({
|
@@ -238,6 +242,7 @@ var LineChart = forwardRef((props, ref) => {
|
|
238
242
|
label,
|
239
243
|
payload,
|
240
244
|
valueFormatter,
|
245
|
+
labelFormatter,
|
241
246
|
unit,
|
242
247
|
...computedTooltipProps
|
243
248
|
}
|
@@ -259,4 +264,4 @@ var LineChart = forwardRef((props, ref) => {
|
|
259
264
|
export {
|
260
265
|
LineChart
|
261
266
|
};
|
262
|
-
//# sourceMappingURL=chunk-
|
267
|
+
//# sourceMappingURL=chunk-KBBHISBO.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/line-chart.tsx"],"sourcesContent":["import type { HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMemo } from \"react\"\nimport {\n LineChart as ReChartsLineChart,\n Legend,\n CartesianGrid,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n ReferenceLine,\n Line,\n Label,\n} from \"recharts\"\nimport { ChartLegend } from \"./chart-legend\"\nimport { ChartTooltip } from \"./chart-tooltip\"\nimport type { UseChartProps } from \"./use-chart\"\nimport { ChartProvider, useChart } from \"./use-chart\"\nimport type { UseChartAxisOptions } from \"./use-chart-axis\"\nimport { useChartAxis } from \"./use-chart-axis\"\nimport type { UseChartGridOptions } from \"./use-chart-grid\"\nimport { useChartGrid } from \"./use-chart-grid\"\nimport type { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport type { UseChartReferenceLineOptions } from \"./use-chart-reference-line\"\nimport { useChartReferenceLine } from \"./use-chart-reference-line\"\nimport {\n useChartTooltip,\n type UseChartTooltipOptions,\n} from \"./use-chart-tooltip\"\nimport { useLineChart } from \"./use-line-chart\"\nimport type { UseLineChartOptions } from \"./use-line-chart\"\n\ntype LineChartOptions = {\n /**\n * If `true`, tooltip is visible.\n *\n * @default true\n */\n withTooltip?: boolean\n /**\n * If `true`, legend is visible.\n *\n * @default false\n */\n withLegend?: boolean\n}\n\nexport type LineChartProps = HTMLUIProps<\"div\"> &\n ThemeProps<\"LineChart\"> &\n LineChartOptions &\n UseChartProps &\n UseChartAxisOptions &\n UseChartReferenceLineOptions &\n UseChartGridOptions &\n UseChartTooltipOptions &\n UseChartLegendProps &\n UseLineChartOptions\n\n/**\n * `LineChart` is a component for drawing line charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/line-chart\n */\nexport const LineChart = forwardRef<LineChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"LineChart\", props)\n const {\n className,\n containerProps,\n gridProps,\n gridAxis,\n strokeDasharray,\n dataKey,\n type,\n layoutType,\n tickLine,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n xAxisLabel,\n yAxisLabel,\n xAxisLabelProps,\n yAxisLabelProps,\n unit,\n yAxisTickFormatter,\n xAxisTickFormatter,\n valueFormatter,\n labelFormatter,\n referenceLineProps,\n tooltipProps,\n tooltipAnimationDuration,\n legendProps,\n withLegend = false,\n withTooltip = true,\n series,\n data,\n chartProps,\n lineProps,\n withDots,\n withActiveDots,\n curveType,\n strokeWidth,\n connectNulls,\n fillOpacity,\n syncId,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const { getLineProps, getLineChartProps, lineVars, setHighlightedArea } =\n useLineChart({\n layoutType,\n series,\n referenceLineProps,\n data,\n chartProps,\n lineProps,\n withDots,\n withActiveDots,\n curveType,\n strokeWidth,\n connectNulls,\n fillOpacity,\n syncId,\n xAxisLabel,\n yAxisLabel,\n styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const {\n getXAxisProps,\n getYAxisProps,\n getXAxisLabelProps,\n getYAxisLabelProps,\n } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n xAxisLabel,\n yAxisLabel,\n xAxisLabelProps,\n yAxisLabelProps,\n unit,\n yAxisTickFormatter,\n xAxisTickFormatter,\n styles,\n })\n const { getReferenceLineProps } = useChartReferenceLine({\n referenceLineProps,\n styles,\n })\n const { getGridProps } = useChartGrid({\n gridProps,\n gridAxis,\n strokeDasharray,\n styles,\n })\n const { tooltipProps: computedTooltipProps, getTooltipProps } =\n useChartTooltip({\n tooltipProps,\n tooltipAnimationDuration,\n styles,\n })\n const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({\n legendProps,\n })\n\n const lines = useMemo(\n () =>\n series.map(({ dataKey }, index) => (\n <Line\n key={`line-${dataKey}`}\n {...getLineProps({ index, className: \"ui-line-chart__line\" })}\n />\n )),\n [getLineProps, series],\n )\n\n const referenceLinesItems = useMemo(\n () =>\n referenceLineProps?.map((_, index) => (\n <ReferenceLine\n key={`referenceLine-${index}`}\n {...getReferenceLineProps({\n index,\n className: \"ui-line-chart__reference-line\",\n })}\n />\n )),\n [getReferenceLineProps, referenceLineProps],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-line-chart\", className)}\n var={lineVars}\n __css={{ ...styles.container }}\n {...rest}\n >\n <ResponsiveContainer\n {...getContainerProps({ className: \"ui-line-chart__container\" })}\n >\n <ReChartsLineChart\n {...getLineChartProps({ className: \"ui-line-chart__chart\" })}\n >\n <CartesianGrid\n {...getGridProps({ className: \"ui-line-chart__grid\" })}\n />\n\n <XAxis {...getXAxisProps({ className: \"ui-line-chart__x-axis\" })}>\n <Label\n {...getXAxisLabelProps({\n className: \"ui-line-chart__x-axis-label\",\n })}\n />\n </XAxis>\n\n <YAxis {...getYAxisProps({ className: \"ui-line-chart__y-axis\" })}>\n <Label\n {...getYAxisLabelProps({\n className: \"ui-line-chart__y-axis-label\",\n })}\n />\n </YAxis>\n\n {withLegend ? (\n <Legend\n content={({ payload }) => (\n <ChartLegend\n className=\"ui-line-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-line-chart__tooltip\"\n label={label}\n payload={payload}\n valueFormatter={valueFormatter}\n labelFormatter={labelFormatter}\n unit={unit}\n {...computedTooltipProps}\n />\n )}\n {...getTooltipProps()}\n />\n ) : null}\n\n {lines}\n {referenceLinesItems}\n </ReChartsLineChart>\n </ResponsiveContainer>\n </ui.div>\n </ChartProvider>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB;AAAA,EACE,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAmKC,cAkCE,YAlCF;AAhHD,IAAM,YAAY,WAAkC,CAAC,OAAO,QAAQ;AACzE,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAu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AAO,GAAG,cAAc,EAAE,WAAW,wBAAwB,CAAC,GAC7D;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,mBAAmB;AAAA,sBACrB,WAAW;AAAA,oBACb,CAAC;AAAA;AAAA,gBACH,GACF;AAAA,gBAEA,oBAAC,SAAO,GAAG,cAAc,EAAE,WAAW,wBAAwB,CAAC,GAC7D;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,mBAAmB;AAAA,sBACrB,WAAW;AAAA,oBACb,CAAC;AAAA;AAAA,gBACH,GACF;AAAA,gBAEC,aACC;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS,CAAC,EAAE,QAAQ,MAClB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA,aAAa;AAAA,wBACZ,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,eAAe;AAAA;AAAA,gBACrB,IACE;AAAA,gBAEH,cACC;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS,CAAC,EAAE,OAAO,QAAQ,MACzB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA;AAAA,wBACA;AAAA,wBACA;AAAA,wBACA;AAAA,wBACC,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,gBAAgB;AAAA;AAAA,gBACtB,IACE;AAAA,gBAEH;AAAA,gBACA;AAAA;AAAA;AAAA,UACH;AAAA;AAAA,MACF;AAAA;AAAA,EACF,GACF;AAEJ,CAAC;","names":["dataKey"]}
|
@@ -24,7 +24,8 @@ var useRadarChart = ({
|
|
24
24
|
withActiveDots = false,
|
25
25
|
strokeWidth = 2,
|
26
26
|
fillOpacity = 0.4,
|
27
|
-
|
27
|
+
polarAngleAxisTickFormatter,
|
28
|
+
polarRadiusAxisTickFormatter,
|
28
29
|
strokeDasharray,
|
29
30
|
styles,
|
30
31
|
...rest
|
@@ -292,7 +293,7 @@ var useRadarChart = ({
|
|
292
293
|
polarAngleAxisTickClassName
|
293
294
|
)
|
294
295
|
},
|
295
|
-
tickFormatter:
|
296
|
+
tickFormatter: polarAngleAxisTickFormatter,
|
296
297
|
tickSize: 16,
|
297
298
|
...props,
|
298
299
|
...polarAngleAxisProps
|
@@ -302,7 +303,7 @@ var useRadarChart = ({
|
|
302
303
|
polarAngleAxisClassName,
|
303
304
|
polarAngleAxisProps,
|
304
305
|
polarAngleAxisTickClassName,
|
305
|
-
|
306
|
+
polarAngleAxisTickFormatter
|
306
307
|
]
|
307
308
|
);
|
308
309
|
const getPolarRadiusAxisProps = useCallback(
|
@@ -315,7 +316,7 @@ var useRadarChart = ({
|
|
315
316
|
polarRadiusAxisTickClassName
|
316
317
|
)
|
317
318
|
},
|
318
|
-
tickFormatter:
|
319
|
+
tickFormatter: polarRadiusAxisTickFormatter,
|
319
320
|
...props,
|
320
321
|
...polarRadiusAxisProps
|
321
322
|
}),
|
@@ -323,7 +324,7 @@ var useRadarChart = ({
|
|
323
324
|
polarRadiusAxisClassName,
|
324
325
|
polarRadiusAxisProps,
|
325
326
|
polarRadiusAxisTickClassName,
|
326
|
-
|
327
|
+
polarRadiusAxisTickFormatter
|
327
328
|
]
|
328
329
|
);
|
329
330
|
return {
|
@@ -340,4 +341,4 @@ var useRadarChart = ({
|
|
340
341
|
export {
|
341
342
|
useRadarChart
|
342
343
|
};
|
343
|
-
//# sourceMappingURL=chunk-
|
344
|
+
//# sourceMappingURL=chunk-MOFNE6PO.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-radar-chart.ts"],"sourcesContent":["import { useTheme } from \"@yamada-ui/core\"\nimport type { CSSUIObject, CSSUIProps } from \"@yamada-ui/core\"\nimport { cx, type Dict } from \"@yamada-ui/utils\"\nimport type { ComponentPropsWithoutRef } from \"react\"\nimport { useCallback, useMemo, useState } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport { getClassName, getComponentProps } from \"./chart-utils\"\nimport type {\n ChartPropGetter,\n PolarAngleAxisProps,\n PolarGridProps,\n PolarRadiusAxisProps,\n RadarChartProps,\n RadarProps,\n RequiredChartPropGetter,\n} from \"./chart.types\"\nimport {\n dotProperties,\n polarAngleAxisProperties,\n polarGridProperties,\n polarRadiusAxisProperties,\n radarChartProperties,\n radarProperties,\n} from \"./rechart-properties\"\n\nexport type UseRadarChartOptions = {\n /**\n * Chart data.\n */\n data: Dict[]\n /**\n * An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.\n */\n series: RadarProps[]\n /**\n * The key of a group of data which should be unique in an chart.\n */\n dataKey: string\n /**\n * Props for the radar.\n */\n radarProps?: Partial<RadarProps>\n /**\n * Props passed down to recharts `RadarChart` component.\n */\n chartProps?: RadarChartProps\n /**\n * Props passed down to recharts `PolarGrid` component.\n */\n polarGridProps?: PolarGridProps\n /**\n * Props passed down to recharts `PolarAngleAxis` component.\n */\n polarAngleAxisProps?: PolarAngleAxisProps\n /**\n * Props passed down to recharts `tick` of `PolarAngleAxis` component.\n */\n polarAngleAxisTickProps?: CSSUIProps\n /**\n * Props passed down to recharts `PolarRadiusAxis` component.\n */\n polarRadiusAxisProps?: PolarRadiusAxisProps\n /**\n * Props passed down to recharts `tick` of `PolarRadiusAxis` component.\n */\n polarRadiusAxisTickProps?: CSSUIProps\n /**\n * Determines whether dots should be displayed.\n *\n * @default false\n */\n withDots?: boolean\n /**\n * Determines whether activeDots should be displayed.\n *\n * @default true\n */\n withActiveDots?: boolean\n /**\n * Stroke width for the chart radars.\n *\n * @default 2\n */\n strokeWidth?: number\n /**\n * Controls fill opacity of all radars.\n *\n * @default 1\n */\n fillOpacity?: number | [number, number]\n /**\n * A function to format Y axis tick.\n */\n polarAngleAxisTickFormatter?: (value: number) => string\n /**\n * A function to format X axis tick.\n */\n polarRadiusAxisTickFormatter?: (value: number) => string\n /**\n * Dash array for the grid lines and cursor. The first number is the length of the solid line section and the second number is the length of the interval.\n */\n strokeDasharray?: string | number\n}\n\ntype UseRadarChartProps = UseRadarChartOptions & {\n styles: Dict<CSSUIObject>\n}\n\nexport const useRadarChart = ({\n data,\n series,\n dataKey,\n withDots = false,\n withActiveDots = false,\n strokeWidth = 2,\n fillOpacity = 0.4,\n polarAngleAxisTickFormatter,\n polarRadiusAxisTickFormatter,\n strokeDasharray,\n styles,\n ...rest\n}: UseRadarChartProps) => {\n const { theme } = useTheme()\n const [highlightedArea, setHighlightedArea] = useState<string | null>(null)\n const shouldHighlight = highlightedArea !== null\n const {\n dot = {},\n activeDot = {},\n dimDot = {},\n dimRadar = {},\n ...computedRadarProps\n } = rest.radarProps ?? {}\n\n const radarColors: CSSUIProps[\"var\"] = useMemo(\n () =>\n series.map(({ color }, index) => ({\n __prefix: \"ui\",\n name: `radar-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n })),\n [series],\n )\n\n const radarVars: CSSUIProps[\"var\"] = useMemo(\n () =>\n [\n ...radarColors,\n { __prefix: \"ui\", name: \"fill-opacity\", value: fillOpacity },\n ] as Required<CSSUIProps>[\"var\"],\n [fillOpacity, radarColors],\n )\n\n const [chartProps, radarChartClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.chartProps ?? {}, radarChartProperties],\n styles.chart,\n )(theme),\n [rest.chartProps, styles.chart, theme],\n )\n\n const [polarGridProps, polarGridClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.polarGridProps ?? {}, polarGridProperties],\n styles.polarGrid,\n )(theme),\n [rest.polarGridProps, styles.polarGrid, theme],\n )\n\n const [polarAngleAxisProps, polarAngleAxisClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.polarAngleAxisProps ?? {}, polarAngleAxisProperties],\n styles.polarAngleAxis,\n )(theme),\n [rest.polarAngleAxisProps, styles.polarAngleAxis, theme],\n )\n\n const polarAngleAxisTickClassName = useMemo(\n () =>\n getClassName({\n ...styles.polarAngleAxisTick,\n ...rest.polarAngleAxisTickProps,\n })(theme),\n [rest.polarAngleAxisTickProps, styles.polarAngleAxisTick, theme],\n )\n\n const [polarRadiusAxisProps, polarRadiusAxisClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.polarRadiusAxisProps ?? {}, polarRadiusAxisProperties],\n styles.polarRadiusAxis,\n )(theme),\n [rest.polarRadiusAxisProps, styles.polarRadiusAxis, theme],\n )\n\n const polarRadiusAxisTickClassName = useMemo(\n () =>\n getClassName({\n ...styles.polarRadiusAxisTick,\n ...rest.polarRadiusAxisTickProps,\n })(theme),\n [rest.polarRadiusAxisTickProps, styles.polarRadiusAxisTick, theme],\n )\n\n const [radarProps, radarClassName] = useMemo(() => {\n const resolvedRadarProps = {\n fillOpacity: \"var(--ui-fill-opacity)\",\n ...computedRadarProps,\n }\n\n return getComponentProps<Dict, string>(\n [resolvedRadarProps, radarProperties],\n styles.radar,\n )(theme)\n }, [computedRadarProps, styles.radar, theme])\n\n const [dimRadarProps, dimRadarClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [dimRadar, radarProperties],\n styles.dimRadar,\n )(theme),\n [dimRadar, styles.dimRadar, theme],\n )\n\n const [dotProps, dotClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>([dot, dotProperties], styles.dot)(theme),\n [dot, styles.dot, theme],\n )\n\n const [activeDotProps, activeDotClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [activeDot, dotProperties],\n styles.activeDot,\n )(theme),\n [activeDot, styles.activeDot, theme],\n )\n\n const [dimDotProps, dimDotClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [dimDot, dotProperties],\n styles.dimDot,\n )(theme),\n [dimDot, styles.dimDot, theme],\n )\n\n const radarPropList = useMemo(\n () =>\n series.map((props, index) => {\n const {\n dataKey,\n dot = {},\n activeDot = {},\n dimDot = {},\n dimRadar = {},\n ...computedProps\n } = props\n const color = `var(--ui-radar-${index})`\n const dimmed = shouldHighlight && highlightedArea !== dataKey\n const computedDimRadar = { ...dimRadarProps, ...dimRadar }\n\n const resolvedProps = {\n ...radarProps,\n ...computedProps,\n ...(dimmed ? computedDimRadar : {}),\n }\n const rest = getComponentProps<Dict, string>(\n [resolvedProps, radarProperties],\n radarClassName,\n dimmed ? dimRadarClassName : undefined,\n )(theme, true)\n\n let resolvedActiveDot: Recharts.DotProps | boolean\n\n if (withActiveDots) {\n const computedActiveDot = {\n ...activeDotProps,\n ...activeDot,\n }\n\n const [rest, className] = getComponentProps<Dict, string>(\n [computedActiveDot, dotProperties],\n activeDotClassName,\n )(theme)\n\n resolvedActiveDot = {\n className: cx(\n \"ui-radar-chart__dot\",\n \"ui-radar-chart__dot--active\",\n className,\n ),\n fill: color,\n stroke: color,\n r: 4,\n ...rest,\n } as Recharts.DotProps\n } else {\n resolvedActiveDot = false\n }\n\n let resolvedDot: Recharts.DotProps | boolean\n\n if (withDots) {\n const computedDimDot = { ...dimDotProps, ...dimDot }\n const computedDot = {\n ...dotProps,\n ...dot,\n ...(dimmed ? computedDimDot : {}),\n }\n\n const [rest, className] = getComponentProps(\n [computedDot, dotProperties],\n dotClassName,\n dimmed ? dimDotClassName : undefined,\n )(theme)\n\n resolvedDot = {\n className: cx(\"ui-radar-chart__dot\", className),\n fill: color,\n r: 4,\n ...rest,\n } as Recharts.DotProps\n } else {\n resolvedDot = false\n }\n\n return {\n ...rest,\n color,\n dataKey,\n dot: resolvedDot,\n activeDot: resolvedActiveDot,\n }\n }),\n [\n activeDotClassName,\n activeDotProps,\n dimDotClassName,\n dimDotProps,\n dimRadarClassName,\n dimRadarProps,\n dotClassName,\n dotProps,\n highlightedArea,\n radarClassName,\n radarProps,\n series,\n shouldHighlight,\n theme,\n withActiveDots,\n withDots,\n ],\n )\n\n const getRadarChartProps: ChartPropGetter<\n \"div\",\n ComponentPropsWithoutRef<typeof Recharts.RadarChart>,\n ComponentPropsWithoutRef<typeof Recharts.RadarChart>\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, radarChartClassName),\n data,\n ...props,\n ...chartProps,\n }),\n [data, radarChartClassName, chartProps],\n )\n\n const getRadarProps: RequiredChartPropGetter<\n \"div\",\n { index: number },\n Omit<Recharts.RadarProps, \"ref\">\n > = useCallback(\n ({ index, className: classNameProp, ...props }, ref = null) => {\n const { color, className, dataKey, activeDot, dot, ...rest } =\n radarPropList[index]\n\n return {\n ref,\n className: cx(classNameProp, className),\n activeDot,\n dot,\n name: dataKey as string,\n dataKey,\n fill: color,\n strokeWidth,\n stroke: color,\n isAnimationActive: false,\n ...(props as Omit<Recharts.RadarProps, \"dataKey\">),\n ...rest,\n }\n },\n [radarPropList, strokeWidth],\n )\n\n const getPolarGridProps: ChartPropGetter<\n \"div\",\n Recharts.PolarGridProps,\n Recharts.PolarGridProps\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, polarGridClassName),\n strokeDasharray,\n ...props,\n ...polarGridProps,\n }),\n [polarGridClassName, polarGridProps, strokeDasharray],\n )\n\n const getPolarAngleAxisProps: ChartPropGetter<\n \"div\",\n Recharts.PolarAngleAxisProps,\n Omit<Recharts.PolarAngleAxisProps, \"ref\">\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, polarAngleAxisClassName),\n dataKey,\n tick: {\n className: cx(\n \"ui-radar-chart__polar-angle-axis-tick\",\n polarAngleAxisTickClassName,\n ),\n },\n tickFormatter: polarAngleAxisTickFormatter,\n tickSize: 16,\n ...props,\n ...polarAngleAxisProps,\n }),\n [\n dataKey,\n polarAngleAxisClassName,\n polarAngleAxisProps,\n polarAngleAxisTickClassName,\n polarAngleAxisTickFormatter,\n ],\n )\n\n const getPolarRadiusAxisProps: ChartPropGetter<\n \"div\",\n Recharts.PolarRadiusAxisProps,\n Omit<Recharts.PolarRadiusAxisProps, \"ref\">\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, polarRadiusAxisClassName),\n tick: {\n className: cx(\n \"ui-radar-chart__polar-radius-axis-tick\",\n polarRadiusAxisTickClassName,\n ),\n },\n tickFormatter: polarRadiusAxisTickFormatter,\n ...props,\n ...polarRadiusAxisProps,\n }),\n [\n polarRadiusAxisClassName,\n polarRadiusAxisProps,\n polarRadiusAxisTickClassName,\n polarRadiusAxisTickFormatter,\n ],\n )\n\n return {\n radarVars,\n getRadarChartProps,\n getRadarProps,\n getPolarGridProps,\n getPolarAngleAxisProps,\n getPolarRadiusAxisProps,\n setHighlightedArea,\n }\n}\n\nexport type UseRadarChartReturn = ReturnType<typeof useRadarChart>\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AAEzB,SAAS,UAAqB;AAE9B,SAAS,aAAa,SAAS,gBAAgB;AAwGxC,IAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAA0B;AAzH1B;AA0HE,QAAM,EAAE,MAAM,IAAI,SAAS;AAC3B,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAwB,IAAI;AAC1E,QAAM,kBAAkB,oBAAoB;AAC5C,QAAM;AAAA,IACJ,MAAM,CAAC;AAAA,IACP,YAAY,CAAC;AAAA,IACb,SAAS,CAAC;AAAA,IACV,WAAW,CAAC;AAAA,IACZ,GAAG;AAAA,EACL,KAAI,UAAK,eAAL,YAAmB,CAAC;AAExB,QAAM,cAAiC;AAAA,IACrC,MACE,OAAO,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;AAAA,MAChC,UAAU;AAAA,MACV,MAAM,SAAS,KAAK;AAAA,MACpB,OAAO;AAAA,MACP,OAAO,wBAAS;AAAA,IAClB,EAAE;AAAA,IACJ,CAAC,MAAM;AAAA,EACT;AAEA,QAAM,YAA+B;AAAA,IACnC,MACE;AAAA,MACE,GAAG;AAAA,MACH,EAAE,UAAU,MAAM,MAAM,gBAAgB,OAAO,YAA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