@yamada-ui/charts 2.0.0-next-20240908154823 → 2.0.0-next-20240923072418
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/area-chart-gradient.d.mts +4 -4
- package/dist/area-chart-gradient.d.ts +4 -4
- package/dist/area-chart-gradient.js.map +1 -1
- package/dist/area-chart-gradient.mjs +1 -1
- package/dist/area-chart-split.d.mts +4 -4
- package/dist/area-chart-split.d.ts +4 -4
- package/dist/area-chart-split.js.map +1 -1
- package/dist/area-chart-split.mjs +1 -1
- package/dist/area-chart.d.mts +4 -4
- package/dist/area-chart.d.ts +4 -4
- package/dist/area-chart.js +1 -1
- package/dist/area-chart.js.map +1 -1
- package/dist/area-chart.mjs +12 -12
- package/dist/bar-chart.d.mts +3 -3
- package/dist/bar-chart.d.ts +3 -3
- package/dist/bar-chart.js +1 -1
- package/dist/bar-chart.js.map +1 -1
- package/dist/bar-chart.mjs +10 -10
- package/dist/chart-legend.d.mts +4 -3
- package/dist/chart-legend.d.ts +4 -3
- package/dist/chart-legend.js.map +1 -1
- package/dist/chart-legend.mjs +2 -2
- package/dist/chart-tooltip.d.mts +2 -2
- package/dist/chart-tooltip.d.ts +2 -2
- package/dist/chart-tooltip.js.map +1 -1
- package/dist/chart-tooltip.mjs +2 -2
- package/dist/chart.types.d.mts +64 -46
- package/dist/chart.types.d.ts +64 -46
- package/dist/chart.types.js.map +1 -1
- package/dist/{chunk-PPBHLDVN.mjs → chunk-2GQHI23M.mjs} +1 -1
- package/dist/chunk-2GQHI23M.mjs.map +1 -0
- package/dist/{chunk-YNJ423BR.mjs → chunk-3EHZJFIA.mjs} +1 -1
- package/dist/chunk-3EHZJFIA.mjs.map +1 -0
- package/dist/{chunk-FPFCMFCJ.mjs → chunk-4TQ4VOYH.mjs} +2 -3
- package/dist/chunk-4TQ4VOYH.mjs.map +1 -0
- package/dist/{chunk-BYL7HWNN.mjs → chunk-5A6462N5.mjs} +12 -12
- package/dist/chunk-5A6462N5.mjs.map +1 -0
- package/dist/{chunk-3AOICU4Q.mjs → chunk-A3IWA366.mjs} +1 -1
- package/dist/chunk-A3IWA366.mjs.map +1 -0
- package/dist/{chunk-SWATR7CU.mjs → chunk-AZB43WEN.mjs} +14 -14
- package/dist/chunk-AZB43WEN.mjs.map +1 -0
- package/dist/{chunk-JTQ5QCML.mjs → chunk-FYAC4RRZ.mjs} +1 -1
- package/dist/chunk-FYAC4RRZ.mjs.map +1 -0
- package/dist/{chunk-5PSRSNGH.mjs → chunk-H3B6RJ63.mjs} +1 -1
- package/dist/chunk-H3B6RJ63.mjs.map +1 -0
- package/dist/{chunk-TCSYDMC7.mjs → chunk-IJRYXT4V.mjs} +1 -1
- package/dist/chunk-IJRYXT4V.mjs.map +1 -0
- package/dist/{chunk-EL2VTGFB.mjs → chunk-LLOU2WIV.mjs} +2 -2
- package/dist/chunk-LLOU2WIV.mjs.map +1 -0
- package/dist/{chunk-MGTMKKSH.mjs → chunk-MN7T76SY.mjs} +1 -1
- package/dist/chunk-MN7T76SY.mjs.map +1 -0
- package/dist/{chunk-D5IRVU4W.mjs → chunk-MSG3WFBO.mjs} +1 -1
- package/dist/chunk-MSG3WFBO.mjs.map +1 -0
- package/dist/{chunk-KVE6VXTJ.mjs → chunk-MVRWZTQ5.mjs} +1 -1
- package/dist/chunk-MVRWZTQ5.mjs.map +1 -0
- package/dist/{chunk-MSIOYYWR.mjs → chunk-NHHJ5XFF.mjs} +1 -1
- package/dist/chunk-NHHJ5XFF.mjs.map +1 -0
- package/dist/{chunk-TMHSYM3V.mjs → chunk-NR7N3R5C.mjs} +10 -10
- package/dist/chunk-NR7N3R5C.mjs.map +1 -0
- package/dist/{chunk-ZQWVMOT6.mjs → chunk-OFD66B3S.mjs} +3 -6
- package/dist/chunk-OFD66B3S.mjs.map +1 -0
- package/dist/{chunk-VMBRDEM2.mjs → chunk-OJ2MLZZ7.mjs} +1 -1
- package/dist/chunk-OJ2MLZZ7.mjs.map +1 -0
- package/dist/{chunk-XRF3TNSQ.mjs → chunk-QGVADS6Z.mjs} +1 -1
- package/dist/chunk-QGVADS6Z.mjs.map +1 -0
- package/dist/{chunk-3VKCTSPC.mjs → chunk-RMYXEG2O.mjs} +9 -9
- package/dist/chunk-RMYXEG2O.mjs.map +1 -0
- package/dist/{chunk-T5DNDBW6.mjs → chunk-UANITMH7.mjs} +2 -2
- package/dist/chunk-UANITMH7.mjs.map +1 -0
- package/dist/{chunk-4MW4FB2T.mjs → chunk-VEFEKDMH.mjs} +1 -1
- package/dist/chunk-VEFEKDMH.mjs.map +1 -0
- package/dist/{chunk-RKO6KM3T.mjs → chunk-VFDCEQYP.mjs} +12 -12
- package/dist/chunk-VFDCEQYP.mjs.map +1 -0
- package/dist/{chunk-X7XFG7TS.mjs → chunk-VQJ6VQ45.mjs} +1 -1
- package/dist/chunk-VQJ6VQ45.mjs.map +1 -0
- package/dist/{chunk-PG7ZV76C.mjs → chunk-VUTCH2CU.mjs} +1 -1
- package/dist/chunk-VUTCH2CU.mjs.map +1 -0
- package/dist/{chunk-WMG5U5AU.mjs → chunk-W7BIYCYH.mjs} +10 -10
- package/dist/chunk-W7BIYCYH.mjs.map +1 -0
- package/dist/{chunk-3HQ2UC3I.mjs → chunk-XYUYAHJX.mjs} +1 -1
- package/dist/chunk-XYUYAHJX.mjs.map +1 -0
- package/dist/{chunk-SBPKRYF2.mjs → chunk-ZGXEF3LO.mjs} +11 -11
- package/dist/chunk-ZGXEF3LO.mjs.map +1 -0
- package/dist/donut-chart.d.mts +4 -3
- package/dist/donut-chart.d.ts +4 -3
- package/dist/donut-chart.js +1 -1
- package/dist/donut-chart.js.map +1 -1
- package/dist/donut-chart.mjs +9 -9
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -27
- package/dist/line-chart.d.mts +4 -3
- package/dist/line-chart.d.ts +4 -3
- package/dist/line-chart.js +2 -3
- package/dist/line-chart.js.map +1 -1
- package/dist/line-chart.mjs +10 -10
- package/dist/pie-chart-label.d.mts +9 -8
- package/dist/pie-chart-label.d.ts +9 -8
- package/dist/pie-chart-label.js.map +1 -1
- package/dist/pie-chart-label.mjs +1 -1
- package/dist/pie-chart.d.mts +4 -3
- package/dist/pie-chart.d.ts +4 -3
- package/dist/pie-chart.js +1 -1
- package/dist/pie-chart.js.map +1 -1
- package/dist/pie-chart.mjs +8 -8
- package/dist/radar-chart.d.mts +4 -3
- package/dist/radar-chart.d.ts +4 -3
- package/dist/radar-chart.js +1 -1
- package/dist/radar-chart.js.map +1 -1
- package/dist/radar-chart.mjs +8 -8
- package/dist/radial-chart.d.mts +4 -3
- package/dist/radial-chart.d.ts +4 -3
- package/dist/radial-chart.js +1 -1
- package/dist/radial-chart.js.map +1 -1
- package/dist/radial-chart.mjs +9 -9
- package/dist/use-area-chart.d.mts +11 -12
- package/dist/use-area-chart.d.ts +11 -12
- package/dist/use-area-chart.js.map +1 -1
- package/dist/use-area-chart.mjs +1 -1
- package/dist/use-bar-chart.d.mts +10 -10
- package/dist/use-bar-chart.d.ts +10 -10
- package/dist/use-bar-chart.js.map +1 -1
- package/dist/use-bar-chart.mjs +1 -1
- package/dist/use-chart-axis.d.mts +10 -10
- package/dist/use-chart-axis.d.ts +10 -10
- package/dist/use-chart-axis.js.map +1 -1
- package/dist/use-chart-axis.mjs +1 -1
- package/dist/use-chart-grid.d.mts +7 -7
- package/dist/use-chart-grid.d.ts +7 -7
- package/dist/use-chart-grid.js.map +1 -1
- package/dist/use-chart-grid.mjs +1 -1
- package/dist/use-chart-label-list.d.mts +8 -8
- package/dist/use-chart-label-list.d.ts +8 -8
- package/dist/use-chart-label-list.js.map +1 -1
- package/dist/use-chart-label-list.mjs +1 -1
- package/dist/use-chart-label.d.mts +7 -7
- package/dist/use-chart-label.d.ts +7 -7
- package/dist/use-chart-label.js.map +1 -1
- package/dist/use-chart-label.mjs +1 -1
- package/dist/use-chart-legend.d.mts +6 -6
- package/dist/use-chart-legend.d.ts +6 -6
- package/dist/use-chart-legend.js.map +1 -1
- package/dist/use-chart-legend.mjs +1 -1
- package/dist/use-chart-reference-line.d.mts +7 -7
- package/dist/use-chart-reference-line.d.ts +7 -7
- package/dist/use-chart-reference-line.js.map +1 -1
- package/dist/use-chart-reference-line.mjs +1 -1
- package/dist/use-chart-tooltip.d.mts +8 -8
- package/dist/use-chart-tooltip.d.ts +8 -8
- package/dist/use-chart-tooltip.js.map +1 -1
- package/dist/use-chart-tooltip.mjs +1 -1
- package/dist/use-chart.d.mts +20 -12
- package/dist/use-chart.d.ts +20 -12
- package/dist/use-chart.js.map +1 -1
- package/dist/use-chart.mjs +1 -1
- package/dist/use-line-chart.d.mts +8 -8
- package/dist/use-line-chart.d.ts +8 -8
- package/dist/use-line-chart.js +1 -2
- package/dist/use-line-chart.js.map +1 -1
- package/dist/use-line-chart.mjs +1 -1
- package/dist/use-pie-chart.d.mts +10 -10
- package/dist/use-pie-chart.d.ts +10 -10
- package/dist/use-pie-chart.js.map +1 -1
- package/dist/use-pie-chart.mjs +2 -2
- package/dist/use-polar-grid.d.mts +7 -7
- package/dist/use-polar-grid.d.ts +7 -7
- package/dist/use-polar-grid.js.map +1 -1
- package/dist/use-polar-grid.mjs +1 -1
- package/dist/use-radar-chart.d.mts +10 -10
- package/dist/use-radar-chart.d.ts +10 -10
- package/dist/use-radar-chart.js.map +1 -1
- package/dist/use-radar-chart.mjs +1 -1
- package/dist/use-radial-chart.d.mts +8 -8
- package/dist/use-radial-chart.d.ts +8 -8
- package/dist/use-radial-chart.js.map +1 -1
- package/dist/use-radial-chart.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-3AOICU4Q.mjs.map +0 -1
- package/dist/chunk-3HQ2UC3I.mjs.map +0 -1
- package/dist/chunk-3VKCTSPC.mjs.map +0 -1
- package/dist/chunk-4MW4FB2T.mjs.map +0 -1
- package/dist/chunk-5PSRSNGH.mjs.map +0 -1
- package/dist/chunk-BYL7HWNN.mjs.map +0 -1
- package/dist/chunk-D5IRVU4W.mjs.map +0 -1
- package/dist/chunk-EL2VTGFB.mjs.map +0 -1
- package/dist/chunk-FPFCMFCJ.mjs.map +0 -1
- package/dist/chunk-JTQ5QCML.mjs.map +0 -1
- package/dist/chunk-KVE6VXTJ.mjs.map +0 -1
- package/dist/chunk-MGTMKKSH.mjs.map +0 -1
- package/dist/chunk-MSIOYYWR.mjs.map +0 -1
- package/dist/chunk-PG7ZV76C.mjs.map +0 -1
- package/dist/chunk-PPBHLDVN.mjs.map +0 -1
- package/dist/chunk-RKO6KM3T.mjs.map +0 -1
- package/dist/chunk-SBPKRYF2.mjs.map +0 -1
- package/dist/chunk-SWATR7CU.mjs.map +0 -1
- package/dist/chunk-T5DNDBW6.mjs.map +0 -1
- package/dist/chunk-TCSYDMC7.mjs.map +0 -1
- package/dist/chunk-TMHSYM3V.mjs.map +0 -1
- package/dist/chunk-VMBRDEM2.mjs.map +0 -1
- package/dist/chunk-WMG5U5AU.mjs.map +0 -1
- package/dist/chunk-X7XFG7TS.mjs.map +0 -1
- package/dist/chunk-XRF3TNSQ.mjs.map +0 -1
- package/dist/chunk-YNJ423BR.mjs.map +0 -1
- package/dist/chunk-ZQWVMOT6.mjs.map +0 -1
@@ -1,38 +1,38 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
useBarChart
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-H3B6RJ63.mjs";
|
5
5
|
import {
|
6
6
|
useChartAxis
|
7
|
-
} from "./chunk-
|
7
|
+
} from "./chunk-3EHZJFIA.mjs";
|
8
8
|
import {
|
9
9
|
useChartGrid
|
10
|
-
} from "./chunk-
|
10
|
+
} from "./chunk-2GQHI23M.mjs";
|
11
11
|
import {
|
12
12
|
useChartReferenceLine
|
13
|
-
} from "./chunk-
|
13
|
+
} from "./chunk-FYAC4RRZ.mjs";
|
14
14
|
import {
|
15
15
|
useChartTooltip
|
16
|
-
} from "./chunk-
|
16
|
+
} from "./chunk-OJ2MLZZ7.mjs";
|
17
17
|
import {
|
18
18
|
useChartLegend
|
19
|
-
} from "./chunk-
|
19
|
+
} from "./chunk-IJRYXT4V.mjs";
|
20
20
|
import {
|
21
21
|
ChartLegend
|
22
|
-
} from "./chunk-
|
22
|
+
} from "./chunk-LLOU2WIV.mjs";
|
23
23
|
import {
|
24
24
|
ChartTooltip
|
25
|
-
} from "./chunk-
|
25
|
+
} from "./chunk-UANITMH7.mjs";
|
26
26
|
import {
|
27
27
|
ChartProvider,
|
28
28
|
useChart
|
29
|
-
} from "./chunk-
|
29
|
+
} from "./chunk-A3IWA366.mjs";
|
30
30
|
|
31
31
|
// src/bar-chart.tsx
|
32
32
|
import {
|
33
33
|
ui,
|
34
34
|
forwardRef,
|
35
|
-
|
35
|
+
useComponentMultiStyle,
|
36
36
|
omitThemeProps
|
37
37
|
} from "@yamada-ui/core";
|
38
38
|
import { cx } from "@yamada-ui/utils";
|
@@ -50,7 +50,7 @@ import {
|
|
50
50
|
} from "recharts";
|
51
51
|
import { jsx, jsxs } from "react/jsx-runtime";
|
52
52
|
var BarChart = forwardRef((props, ref) => {
|
53
|
-
const [styles, mergedProps] =
|
53
|
+
const [styles, mergedProps] = useComponentMultiStyle("BarChart", props);
|
54
54
|
const {
|
55
55
|
className,
|
56
56
|
series,
|
@@ -245,4 +245,4 @@ var BarChart = forwardRef((props, ref) => {
|
|
245
245
|
export {
|
246
246
|
BarChart
|
247
247
|
};
|
248
|
-
//# sourceMappingURL=chunk-
|
248
|
+
//# sourceMappingURL=chunk-VFDCEQYP.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 useComponentMultiStyle,\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 } from \"./use-chart-grid\"\nimport type { UseChartGridOptions } from \"./use-chart-grid\"\nimport type { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport { useChartReferenceLine } from \"./use-chart-reference-line\"\nimport type { UseChartReferenceLineOptions } from \"./use-chart-reference-line\"\nimport type { UseChartTooltipOptions } from \"./use-chart-tooltip\"\nimport { useChartTooltip } from \"./use-chart-tooltip\"\n\ninterface 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 &\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/data-display/bar-chart\n */\nexport const BarChart = forwardRef<BarChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"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 __css={{ maxW: \"full\", vars: barVars, ...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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAyJC,cAsBE,YAtBF;AAxGD,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;AAAA,IACA;AAAA,IACA;AAAA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AC;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-area-chart.ts"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n PropGetter,\n RequiredPropGetter,\n} from \"@yamada-ui/core\"\nimport { getVar, useTheme } from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ComponentPropsWithoutRef } from \"react\"\nimport { useCallback, useId, useMemo, useState } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport type { AreaGradientProps } from \"./area-chart-gradient\"\nimport type { AreaSplitProps } from \"./area-chart-split\"\nimport { getComponentProps } from \"./chart-utils\"\nimport type {\n ChartCurveType,\n AreaProps,\n AreaChartType,\n AreaChartProps,\n ChartLayoutType,\n ReferenceLineProps,\n} from \"./chart.types\"\nimport {\n areaChartProperties,\n dotProperties,\n areaProperties,\n} from \"./rechart-properties\"\n\nexport interface UseAreaChartOptions {\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: AreaProps[]\n /**\n * Props for the areas.\n */\n areaProps?: Partial<AreaProps>\n /**\n * Controls how chart areas are positioned relative to each other.\n *\n * @default `default`\n */\n type?: AreaChartType\n /**\n * Props passed down to recharts `AreaChart` component.\n */\n chartProps?: AreaChartProps\n /**\n * If any two categorical charts have the same syncId,\n * these two charts can sync the position tooltip, and the startIndex, endIndex of Brush.\n */\n syncId?: number | string\n /**\n * Chart orientation.\n *\n * @default 'horizontal'\n */\n layoutType?: ChartLayoutType\n /**\n * Determines whether the chart area should be represented with a gradient instead of the solid color.\n */\n withGradient?: boolean\n /**\n * Determines whether dots should be displayed.\n *\n * @default true\n */\n withDots?: boolean\n /**\n * Determines whether activeDots should be displayed.\n *\n * @default true\n */\n withActiveDots?: boolean\n /**\n * Type of the curve.\n *\n * @default `monotone`\n */\n curveType?: ChartCurveType\n /**\n * Stroke width for the chart areas.\n *\n * @default 2\n */\n strokeWidth?: number\n /**\n * Determines whether points with `null` values should be connected.\n *\n * @default true\n */\n connectNulls?: boolean\n /**\n * A tuple of colors used when `type=\"split\"` is set, ignored in all other cases.\n *\n * @default '[\"red.400\", \"green.400\"]'\n */\n splitColors?: [string, string]\n /**\n * Offset for the split gradient. By default, value is inferred from `data` and `series` if possible.\n * Must be generated from the data array with `getSplitOffset` function.\n */\n splitOffset?: number\n /**\n * Reference lines that should be displayed on the chart.\n */\n referenceLineProps?: ReferenceLineProps[]\n /**\n * Controls fill opacity of all areas.\n *\n * @default 0.4\n */\n fillOpacity?: number | [number, number]\n /**\n * A label to display below the X axis.\n */\n xAxisLabel?: string\n /**\n * A label to display below the Y axis.\n */\n yAxisLabel?: string\n}\n\ninterface UseAreaChartProps extends UseAreaChartOptions {\n styles: Dict<CSSUIObject>\n}\n\nexport const useAreaChart = ({\n data,\n series,\n type,\n layoutType = \"horizontal\",\n withGradient: withGradientProp,\n withDots = true,\n withActiveDots = true,\n curveType = \"monotone\",\n strokeWidth = 2,\n connectNulls = true,\n fillOpacity = 0.4,\n splitColors = [\"#ee6a5d\", \"#5fce7d\"],\n splitOffset,\n referenceLineProps,\n syncId,\n xAxisLabel,\n yAxisLabel,\n styles,\n ...rest\n}: UseAreaChartProps) => {\n const uuid = useId()\n const { theme } = useTheme()\n const [highlightedArea, setHighlightedArea] = useState<string | null>(null)\n const splitId = `${uuid}-split`\n const stacked = type === \"stacked\" || type === \"percent\"\n const withGradient =\n typeof withGradientProp === \"boolean\"\n ? withGradientProp\n : type === \"default\"\n const shouldHighlight = highlightedArea !== null\n const {\n dot = {},\n activeDot = {},\n dimDot = {},\n dimArea = {},\n ...computedAreaProps\n } = rest.areaProps ?? {}\n\n const areaColors: CSSUIProps[\"vars\"] = useMemo(\n () =>\n series.map(({ color }, index) => ({\n name: `area-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n })),\n [series],\n )\n\n const areaSplitColors: CSSUIProps[\"vars\"] = useMemo(\n () =>\n splitColors.map((color, index) => ({\n name: `area-split-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n })),\n [splitColors],\n )\n\n const referenceLineColors: CSSUIProps[\"vars\"] = useMemo(\n () =>\n referenceLineProps\n ? referenceLineProps.map(({ color }, index) => ({\n name: `reference-line-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n }))\n : [],\n [referenceLineProps],\n )\n\n const areaVars: CSSUIProps[\"vars\"] = useMemo(() => {\n return [\n ...areaColors,\n ...areaSplitColors,\n ...referenceLineColors,\n { name: \"fill-opacity\", value: fillOpacity },\n ]\n }, [areaColors, areaSplitColors, referenceLineColors, fillOpacity])\n const fillOpacityVar = useMemo(() => getVar(\"fill-opacity\")(theme), [theme])\n\n const [chartProps, areaChartClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.chartProps ?? {}, areaChartProperties],\n styles.chart,\n )(theme),\n [rest.chartProps, styles.chart, theme],\n )\n\n const [areaProps, areaClassName] = useMemo(() => {\n const resolvedAreaProps = {\n ...computedAreaProps,\n }\n\n return getComponentProps<Dict, string>(\n [resolvedAreaProps, areaProperties],\n styles.area,\n )(theme)\n }, [computedAreaProps, styles.area, theme])\n\n const [dimAreaProps, dimAreaClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [dimArea, areaProperties],\n styles.dimArea,\n )(theme),\n [dimArea, styles.dimArea, 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 defaultSplitOffset = useMemo(() => {\n if (series.length === 1) {\n const dataKey = series[0].dataKey as string\n\n const dataMax = Math.max(...data.map((item) => item[dataKey]))\n const dataMin = Math.min(...data.map((item) => item[dataKey]))\n\n if (dataMax <= 0) return 0\n if (dataMin >= 0) return 1\n\n return dataMax / (dataMax - dataMin)\n }\n\n return 0.5\n }, [data, series])\n\n const areaPropsList = useMemo(\n () =>\n series.map((props, index) => {\n const {\n dataKey,\n dot = {},\n activeDot = {},\n dimDot = {},\n dimArea = {},\n strokeDasharray,\n ...computedProps\n } = props\n const id = `${uuid}-${dataKey}`\n const color = getVar(`area-${index}`)(theme)\n const dimmed = shouldHighlight && highlightedArea !== dataKey\n const computedDimArea = { ...dimAreaProps, ...dimArea }\n\n const resolvedProps = {\n ...areaProps,\n ...computedProps,\n ...(dimmed ? computedDimArea : {}),\n }\n const rest = getComponentProps<Dict, string>(\n [resolvedProps, areaProperties],\n areaClassName,\n dimmed ? dimAreaClassName : undefined,\n )(theme, true)\n\n let resolvedActiveDot: Recharts.DotProps | boolean\n\n if (withActiveDots) {\n const computedActiveDot = { ...activeDotProps, ...activeDot }\n\n const [rest, className] = getComponentProps(\n [computedActiveDot, dotProperties],\n activeDotClassName,\n )(theme)\n\n resolvedActiveDot = {\n className: cx(\n \"ui-area-chart__dot\",\n \"ui-area-chart__dot--active\",\n className,\n ),\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-area-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 id,\n color,\n strokeDasharray,\n dataKey,\n activeDot: resolvedActiveDot,\n dot: resolvedDot,\n }\n }),\n [\n series,\n uuid,\n shouldHighlight,\n highlightedArea,\n dimAreaProps,\n dimDotProps,\n areaProps,\n areaClassName,\n dimAreaClassName,\n theme,\n withActiveDots,\n withDots,\n activeDotProps,\n activeDotClassName,\n dotProps,\n dotClassName,\n dimDotClassName,\n ],\n )\n\n const getAreaChartProps: RequiredPropGetter<\n ComponentPropsWithoutRef<typeof Recharts.AreaChart>,\n ComponentPropsWithoutRef<typeof Recharts.AreaChart>\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, areaChartClassName),\n data,\n stackOffset: type === \"percent\" ? \"expand\" : undefined,\n layout: layoutType,\n syncId,\n margin: {\n bottom: xAxisLabel ? 30 : undefined,\n left: yAxisLabel ? 10 : undefined,\n right: yAxisLabel ? 5 : undefined,\n },\n ...props,\n ...chartProps,\n }),\n [\n areaChartClassName,\n data,\n type,\n layoutType,\n syncId,\n xAxisLabel,\n yAxisLabel,\n chartProps,\n ],\n )\n\n const getAreaSplitProps: PropGetter<\n Partial<AreaSplitProps>,\n AreaSplitProps\n > = useCallback(\n (props = {}) => ({\n id: splitId,\n offset: splitOffset ?? defaultSplitOffset,\n fillOpacity: fillOpacityVar,\n ...props,\n }),\n [defaultSplitOffset, splitId, splitOffset, fillOpacityVar],\n )\n\n const getAreaProps: RequiredPropGetter<\n Partial<Recharts.AreaProps> & { index: number },\n Omit<Recharts.AreaProps, \"ref\">\n > = useCallback(\n ({ index, className: classNameProp, ...props }, ref = null) => {\n const {\n id,\n color,\n className,\n dataKey,\n strokeDasharray,\n activeDot,\n dot,\n ...rest\n } = areaPropsList[index]\n\n return {\n ref,\n className: cx(classNameProp, className),\n id,\n activeDot,\n dot,\n name: dataKey as string,\n type: curveType,\n dataKey,\n fill: type === \"split\" ? `url(#${splitId})` : `url(#${id})`,\n strokeWidth,\n stroke: color,\n isAnimationActive: false,\n connectNulls,\n stackId: stacked ? \"stack\" : undefined,\n strokeDasharray,\n ...(props as Omit<Recharts.AreaProps, \"dataKey\">),\n ...rest,\n }\n },\n [\n areaPropsList,\n connectNulls,\n curveType,\n splitId,\n stacked,\n strokeWidth,\n type,\n ],\n )\n\n const getAreaGradientProps: PropGetter<\n Partial<AreaGradientProps>,\n AreaGradientProps\n > = useCallback(\n (props = {}) => ({\n withGradient,\n fillOpacity: fillOpacityVar,\n ...props,\n }),\n [withGradient, fillOpacityVar],\n )\n\n return {\n getAreaChartProps,\n getAreaSplitProps,\n getAreaProps,\n getAreaGradientProps,\n areaVars,\n setHighlightedArea,\n }\n}\n\nexport type UseAreaChartReturn = ReturnType<typeof useAreaChart>\n"],"mappings":";;;;;;;;;;;AAMA,SAAS,QAAQ,gBAAgB;AAEjC,SAAS,UAAU;AAEnB,SAAS,aAAa,OAAO,SAAS,gBAAgB;AA0H/C,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,cAAc;A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AAM,QAAQ,EAAE;AAAA,QACxD;AAAA,QACA,QAAQ;AAAA,QACR,mBAAmB;AAAA,QACnB;AAAA,QACA,SAAS,UAAU,UAAU;AAAA,QAC7B;AAAA,QACA,GAAI;AAAA,QACJ,GAAGI;AAAA,MACL;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,uBAGF;AAAA,IACF,CAAC,QAAQ,CAAC,OAAO;AAAA,MACf;AAAA,MACA,aAAa;AAAA,MACb,GAAG;AAAA,IACL;AAAA,IACA,CAAC,cAAc,cAAc;AAAA,EAC/B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["_a","dot","activeDot","dimDot","dimArea","rest"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-radial-chart.ts"],"sourcesContent":["import type {\n CSSUIProps,\n CSSUIObject,\n PropGetter,\n RequiredPropGetter,\n} from \"@yamada-ui/core\"\nimport { getVar, useTheme } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport { useCallback, useMemo, useState } from \"react\"\nimport type { ComponentPropsWithoutRef } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport { getClassName, getComponentProps } from \"./chart-utils\"\nimport type { RadialBarProps, RadialChartProps } from \"./chart.types\"\nimport {\n radialBarProperties,\n radialChartProperties,\n} from \"./rechart-properties\"\n\nexport interface UseRadialChartOptions {\n /**\n * Chart data.\n */\n data: Dict[]\n /**\n * The key of a group of data which should be unique in an chart.\n *\n * @default 'value'\n */\n dataKey?: string\n /**\n * Props passed down to recharts `RadialBarChart` component.\n */\n chartProps?: RadialChartProps\n /**\n * Props for the radialBar.\n */\n radialBarProps?: Partial<RadialBarProps>\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 '10%'\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 angle at which chart starts.\n *\n * @default 90\n */\n startAngle?: number\n /**\n * Controls angle at which chart ends.\n *\n * @default -180\n */\n endAngle?: number\n /**\n * Controls fill opacity of all pies.\n *\n * @default 1\n */\n fillOpacity?: number | [number, number]\n}\n\ninterface UseRadialChartProps extends UseRadialChartOptions {\n styles: Dict<CSSUIObject>\n}\n\nexport const useRadialChart = ({\n data: dataProp,\n dataKey = \"value\",\n innerRadius = \"10%\",\n outerRadius = \"80%\",\n startAngle = 90,\n endAngle = -180,\n fillOpacity = 1,\n styles,\n ...rest\n}: UseRadialChartProps) => {\n const { theme } = useTheme()\n const [highlightedArea, setHighlightedArea] = useState<string | null>(null)\n const shouldHighlight = highlightedArea !== null\n const {\n background: backgroundProps = {},\n dimRadialBar: dimRadialBarProps = {},\n ...computedRadialBarProps\n } = rest.radialBarProps ?? {}\n\n const radialVars: CSSUIProps[\"vars\"] = useMemo(\n () =>\n dataProp.map(({ color }, index) => ({\n name: `radial-bar-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n })),\n [dataProp],\n )\n\n const dimRadialBarClassName = useMemo(() => {\n const resolvedDimRadialBar = {\n fillOpacity: 0.3,\n strokeOpacity: 0,\n ...dimRadialBarProps,\n }\n\n return getClassName(resolvedDimRadialBar)(theme)\n }, [dimRadialBarProps, theme])\n\n const [chartProps, chartClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.chartProps ?? {}, radialChartProperties],\n styles.chart,\n )(theme),\n [rest.chartProps, styles.chart, theme],\n )\n\n const background = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [backgroundProps, radialBarProperties],\n styles.background,\n )(theme, true),\n [backgroundProps, styles.background, theme],\n )\n\n const [radialBarProps, radialBarClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [computedRadialBarProps ?? {}, radialBarProperties],\n styles.radialBar,\n )(theme),\n [computedRadialBarProps, styles.radialBar, theme],\n )\n\n const data = useMemo(\n () =>\n dataProp.map((props, index) => {\n const {\n name,\n value,\n color,\n dimRadialBar = {},\n ...computedProps\n } = props\n const dimmed = shouldHighlight && highlightedArea !== name\n const resolvedProps = {\n ...computedProps,\n ...(dimmed ? dimRadialBar : { fillOpacity }),\n }\n\n const className = getClassName(\n resolvedProps,\n dimmed ? dimRadialBarClassName : undefined,\n )(theme)\n\n return {\n className,\n fill: getVar(`radial-bar-${index}`)(theme),\n name,\n value,\n color,\n }\n }),\n [\n dataProp,\n dimRadialBarClassName,\n fillOpacity,\n highlightedArea,\n shouldHighlight,\n theme,\n ],\n )\n\n const getRadialChartProps: PropGetter<\n ComponentPropsWithoutRef<typeof Recharts.RadialBarChart>,\n ComponentPropsWithoutRef<typeof Recharts.RadialBarChart>\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, chartClassName),\n data,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...props,\n ...chartProps,\n }),\n [\n chartClassName,\n chartProps,\n data,\n endAngle,\n innerRadius,\n outerRadius,\n startAngle,\n ],\n )\n\n const getRadialBarProps: RequiredPropGetter<\n Partial<Recharts.RadialBarProps>,\n Omit<Recharts.RadialBarProps, \"ref\">\n > = useCallback(\n ({ className, ...props }, ref = null) => ({\n ref,\n className: cx(className, radialBarClassName),\n dataKey,\n isAnimationActive: false,\n background,\n ...props,\n ...radialBarProps,\n }),\n [background, dataKey, radialBarClassName, radialBarProps],\n )\n\n return {\n radialVars,\n setHighlightedArea,\n getRadialChartProps,\n getRadialBarProps,\n }\n}\n\nexport type UseRadialChartReturn = ReturnType<typeof useRadialChart>\n"],"mappings":";;;;;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AA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,oBAGF;AAAA,IACF,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,UAAU;AAAA,MACxC;AAAA,MACA,WAAW,GAAG,WAAW,kBAAkB;AAAA,MAC3C;AAAA,MACA,mBAAmB;AAAA,MACnB;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA,CAAC,YAAY,SAAS,oBAAoB,cAAc;AAAA,EAC1D;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["_a"]}
|
@@ -1,33 +1,33 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
useChartLabel
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-MVRWZTQ5.mjs";
|
5
5
|
import {
|
6
6
|
usePieChart
|
7
|
-
} from "./chunk-
|
7
|
+
} from "./chunk-OFD66B3S.mjs";
|
8
8
|
import {
|
9
9
|
useChartTooltip
|
10
|
-
} from "./chunk-
|
10
|
+
} from "./chunk-OJ2MLZZ7.mjs";
|
11
11
|
import {
|
12
12
|
useChartLegend
|
13
|
-
} from "./chunk-
|
13
|
+
} from "./chunk-IJRYXT4V.mjs";
|
14
14
|
import {
|
15
15
|
ChartLegend
|
16
|
-
} from "./chunk-
|
16
|
+
} from "./chunk-LLOU2WIV.mjs";
|
17
17
|
import {
|
18
18
|
ChartTooltip
|
19
|
-
} from "./chunk-
|
19
|
+
} from "./chunk-UANITMH7.mjs";
|
20
20
|
import {
|
21
21
|
ChartProvider,
|
22
22
|
useChart
|
23
|
-
} from "./chunk-
|
23
|
+
} from "./chunk-A3IWA366.mjs";
|
24
24
|
|
25
25
|
// src/donut-chart.tsx
|
26
26
|
import {
|
27
27
|
forwardRef,
|
28
28
|
omitThemeProps,
|
29
29
|
ui,
|
30
|
-
|
30
|
+
useComponentMultiStyle
|
31
31
|
} from "@yamada-ui/core";
|
32
32
|
import { cx } from "@yamada-ui/utils";
|
33
33
|
import { useMemo } from "react";
|
@@ -42,7 +42,7 @@ import {
|
|
42
42
|
} from "recharts";
|
43
43
|
import { jsx, jsxs } from "react/jsx-runtime";
|
44
44
|
var DonutChart = forwardRef((props, ref) => {
|
45
|
-
const [styles, mergedProps] =
|
45
|
+
const [styles, mergedProps] = useComponentMultiStyle("DonutChart", props);
|
46
46
|
const {
|
47
47
|
className,
|
48
48
|
data,
|
@@ -193,4 +193,4 @@ var DonutChart = forwardRef((props, ref) => {
|
|
193
193
|
export {
|
194
194
|
DonutChart
|
195
195
|
};
|
196
|
-
//# sourceMappingURL=chunk-
|
196
|
+
//# sourceMappingURL=chunk-W7BIYCYH.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/donut-chart.tsx"],"sourcesContent":["import {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\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 } from \"./use-chart-label\"\nimport 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\ninterface 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 interface DonutChartProps\n extends 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/data-display/donut-chart\n */\nexport const DonutChart = forwardRef<DonutChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"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 __css={{ maxW: \"full\", vars: pieVars, ...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":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;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;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,OACK;AAuGC,cAsBI,YAtBJ;AAvED,IAAM,aAAa,WAAmC,CAAC,OAAO,QAAQ;AAC3E,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,cAAc,KAAK;AACxE,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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,aAAa,QAAQ;AAAA,IACnC;AAAA,IACA;AA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G,iBAAiB,EAAE,WAAW,wBAAwB,CAAC;AAAA,cAE3D;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,YAAY;AAAA,sBACd,WAAW;AAAA,oBACb,CAAC;AAAA,oBAEA;AAAA;AAAA,sBACD;AAAA,wBAAC;AAAA;AAAA,0BACE,GAAG,cAAc,EAAE,WAAW,wBAAwB,CAAC;AAAA;AAAA,sBAC1D;AAAA;AAAA;AAAA,gBACF;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":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-polar-grid.tsx"],"sourcesContent":["import { useTheme } from \"@yamada-ui/core\"\nimport type { CSSUIObject, PropGetter } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport { useCallback, useMemo } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport { getComponentProps } from \"./chart-utils\"\nimport type { PolarGridProps } from \"./chart.types\"\nimport { polarGridProperties } from \"./rechart-properties\"\n\nexport interface UsePolarGridOptions {\n /**\n * Props passed down to recharts `PolarGrid` component.\n */\n polarGridProps?: PolarGridProps\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\ninterface UsePolarGridProps extends UsePolarGridOptions {\n styles: Dict<CSSUIObject>\n}\n\nexport const usePolarGrid = ({\n strokeDasharray,\n styles,\n ...rest\n}: UsePolarGridProps) => {\n const { theme } = useTheme()\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 getPolarGridProps: PropGetter<\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 return { getPolarGridProps }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,gBAAgB;AAEzB,SAAS,UAAU;AAEnB,SAAS,aAAa,eAAe;AAqB9B,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,EAAE,MAAM,IAAI,SAAS;AAE3B,QAAM,CAAC,gBAAgB,kBAAkB,IAAI;AAAA,IAC3C,MAAG;AAjCP;AAkCM;AAAA,QACE,EAAC,UAAK,mBAAL,YAAuB,CAAC,GAAG,mBAAmB;AAAA,QAC/C,OAAO;AAAA,MACT,EAAE,KAAK;AAAA;AAAA,IACT,CAAC,KAAK,gBAAgB,OAAO,WAAW,KAAK;AAAA,EAC/C;AAEA,QAAM,oBAGF;AAAA,IACF,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,MAAM,UAAU;AAAA,MAC7C;AAAA,MACA,WAAW,GAAG,WAAW,kBAAkB;AAAA,MAC3C;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA,CAAC,oBAAoB,gBAAgB,eAAe;AAAA,EACtD;AAEA,SAAO,EAAE,kBAAkB;AAC7B;","names":[]}
|
@@ -1,36 +1,36 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
useRadialChart
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-VUTCH2CU.mjs";
|
5
5
|
import {
|
6
6
|
useChartLabelList
|
7
|
-
} from "./chunk-
|
7
|
+
} from "./chunk-MSG3WFBO.mjs";
|
8
8
|
import {
|
9
9
|
usePolarGrid
|
10
|
-
} from "./chunk-
|
10
|
+
} from "./chunk-XYUYAHJX.mjs";
|
11
11
|
import {
|
12
12
|
useChartTooltip
|
13
|
-
} from "./chunk-
|
13
|
+
} from "./chunk-OJ2MLZZ7.mjs";
|
14
14
|
import {
|
15
15
|
useChartLegend
|
16
|
-
} from "./chunk-
|
16
|
+
} from "./chunk-IJRYXT4V.mjs";
|
17
17
|
import {
|
18
18
|
ChartLegend
|
19
|
-
} from "./chunk-
|
19
|
+
} from "./chunk-LLOU2WIV.mjs";
|
20
20
|
import {
|
21
21
|
ChartTooltip
|
22
|
-
} from "./chunk-
|
22
|
+
} from "./chunk-UANITMH7.mjs";
|
23
23
|
import {
|
24
24
|
ChartProvider,
|
25
25
|
useChart
|
26
|
-
} from "./chunk-
|
26
|
+
} from "./chunk-A3IWA366.mjs";
|
27
27
|
|
28
28
|
// src/radial-chart.tsx
|
29
29
|
import {
|
30
30
|
forwardRef,
|
31
31
|
omitThemeProps,
|
32
32
|
ui,
|
33
|
-
|
33
|
+
useComponentMultiStyle
|
34
34
|
} from "@yamada-ui/core";
|
35
35
|
import { cx } from "@yamada-ui/utils";
|
36
36
|
import { useMemo } from "react";
|
@@ -45,7 +45,7 @@ import {
|
|
45
45
|
} from "recharts";
|
46
46
|
import { jsx, jsxs } from "react/jsx-runtime";
|
47
47
|
var RadialChart = forwardRef((props, ref) => {
|
48
|
-
const [styles, mergedProps] =
|
48
|
+
const [styles, mergedProps] = useComponentMultiStyle("RadialChart", props);
|
49
49
|
const {
|
50
50
|
className,
|
51
51
|
data,
|
@@ -196,4 +196,4 @@ var RadialChart = forwardRef((props, ref) => {
|
|
196
196
|
export {
|
197
197
|
RadialChart
|
198
198
|
};
|
199
|
-
//# sourceMappingURL=chunk-
|
199
|
+
//# sourceMappingURL=chunk-ZGXEF3LO.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/radial-chart.tsx"],"sourcesContent":["import {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport type { HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMemo } from \"react\"\nimport {\n ResponsiveContainer,\n RadialBarChart as RechartsRadialChart,\n Legend,\n Tooltip,\n RadialBar,\n LabelList,\n PolarGrid,\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 { useChartLabelList } from \"./use-chart-label-list\"\nimport type { UseChartLabelListOptions } from \"./use-chart-label-list\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport type { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartTooltip } from \"./use-chart-tooltip\"\nimport type { UseChartTooltipOptions } from \"./use-chart-tooltip\"\nimport type { UsePolarGridOptions } from \"./use-polar-grid\"\nimport { usePolarGrid } from \"./use-polar-grid\"\nimport { useRadialChart } from \"./use-radial-chart\"\nimport type { UseRadialChartOptions } from \"./use-radial-chart\"\n\ninterface RadialChartOptions {\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 whether polarGrid should be displayed.\n *\n * @default false\n */\n withPolarGrid?: 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 value in tooltip.\n */\n unit?: string\n}\n\nexport interface RadialChartProps\n extends Omit<HTMLUIProps, \"fillOpacity\" | \"strokeDasharray\">,\n ThemeProps<\"radialChart\">,\n RadialChartOptions,\n UseRadialChartOptions,\n UseChartTooltipOptions,\n UseChartLegendProps,\n UseChartLabelListOptions,\n UsePolarGridOptions,\n UseChartProps {}\n\n/**\n * `RadialChart` is a component for drawing radial charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/data-display/radial-chart\n */\nexport const RadialChart = forwardRef<RadialChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"RadialChart\", props)\n const {\n className,\n data,\n dataKey,\n chartProps,\n radialBarProps,\n containerProps,\n withPolarGrid = false,\n withTooltip = true,\n withLegend = false,\n tooltipProps,\n tooltipAnimationDuration,\n tooltipDataSource = \"all\",\n valueFormatter,\n unit,\n legendProps,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n fillOpacity,\n labelListProps = [],\n polarGridProps,\n strokeDasharray,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const {\n getRadialChartProps,\n getRadialBarProps,\n radialVars,\n setHighlightedArea,\n } = useRadialChart({\n data,\n dataKey,\n styles,\n chartProps,\n radialBarProps,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n fillOpacity,\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 { getLabelLineProps } = useChartLabelList({ labelListProps, styles })\n const { getPolarGridProps } = usePolarGrid({\n polarGridProps,\n strokeDasharray,\n styles,\n })\n\n const labelLists = useMemo(\n () =>\n labelListProps.map((_, index) => (\n <LabelList\n key={`labelList-${index}`}\n {...getLabelLineProps({\n index,\n className: \"ui-radial-chart__label-list\",\n })}\n />\n )),\n [getLabelLineProps, labelListProps],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-radial-chart\", className)}\n __css={{ maxW: \"full\", vars: radialVars, ...styles.container }}\n {...rest}\n >\n <ResponsiveContainer\n {...getContainerProps({ className: \"ui-radial-chart__container\" })}\n >\n <RechartsRadialChart\n {...getRadialChartProps({\n className: \"ui-radial-chart__chart\",\n })}\n >\n {withPolarGrid ? (\n <PolarGrid\n {...getPolarGridProps({\n className: \"ui-radial-chart__polar-grid\",\n })}\n />\n ) : null}\n\n <RadialBar\n {...getRadialBarProps({\n className: \"ui-radial-chart__radial-bar\",\n })}\n >\n {labelLists}\n </RadialBar>\n\n {withLegend ? (\n <Legend\n content={({ payload }) => (\n <ChartLegend\n className=\"ui-radial-chart__legend\"\n payload={payload}\n onHighlight={setHighlightedArea}\n {...computedLegendProps}\n />\n )}\n {...getLegendProps()}\n />\n ) : null}\n\n {withTooltip ? (\n <Tooltip\n content={({ payload }) => (\n <ChartTooltip\n className=\"ui-radial-chart__tooltip\"\n isRadialChart={\n tooltipDataSource === \"segment\" ? true : false\n }\n payload={tooltipDataSource === \"segment\" ? payload : data}\n valueFormatter={valueFormatter}\n unit={unit}\n {...computedTooltipProps}\n />\n )}\n {...getTooltipProps()}\n />\n ) : null}\n </RechartsRadialChart>\n </ResponsiveContainer>\n </ui.div>\n </ChartProvider>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA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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":[]}
|
package/dist/donut-chart.d.mts
CHANGED
@@ -11,7 +11,7 @@ import './use-chart-tooltip.mjs';
|
|
11
11
|
import './use-pie-chart.mjs';
|
12
12
|
import 'recharts/types/chart/generateCategoricalChart';
|
13
13
|
|
14
|
-
|
14
|
+
interface DonutChartOptions {
|
15
15
|
/**
|
16
16
|
* Controls innerRadius of the chart segments.
|
17
17
|
* If it is a number, it is the width of the radius.
|
@@ -20,8 +20,9 @@ type DonutChartOptions = {
|
|
20
20
|
* @default '60%'
|
21
21
|
*/
|
22
22
|
innerRadius?: number | string;
|
23
|
-
}
|
24
|
-
|
23
|
+
}
|
24
|
+
interface DonutChartProps extends PieChartProps, DonutChartOptions, UseChartLabelOptions {
|
25
|
+
}
|
25
26
|
/**
|
26
27
|
* `DonutChart` is a component for drawing donut charts to compare multiple sets of data.
|
27
28
|
*
|
package/dist/donut-chart.d.ts
CHANGED
@@ -11,7 +11,7 @@ import './use-chart-tooltip.js';
|
|
11
11
|
import './use-pie-chart.js';
|
12
12
|
import 'recharts/types/chart/generateCategoricalChart';
|
13
13
|
|
14
|
-
|
14
|
+
interface DonutChartOptions {
|
15
15
|
/**
|
16
16
|
* Controls innerRadius of the chart segments.
|
17
17
|
* If it is a number, it is the width of the radius.
|
@@ -20,8 +20,9 @@ type DonutChartOptions = {
|
|
20
20
|
* @default '60%'
|
21
21
|
*/
|
22
22
|
innerRadius?: number | string;
|
23
|
-
}
|
24
|
-
|
23
|
+
}
|
24
|
+
interface DonutChartProps extends PieChartProps, DonutChartOptions, UseChartLabelOptions {
|
25
|
+
}
|
25
26
|
/**
|
26
27
|
* `DonutChart` is a component for drawing donut charts to compare multiple sets of data.
|
27
28
|
*
|
package/dist/donut-chart.js
CHANGED
@@ -703,7 +703,7 @@ var usePieChart = ({
|
|
703
703
|
// src/donut-chart.tsx
|
704
704
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
705
705
|
var DonutChart = (0, import_core9.forwardRef)((props, ref) => {
|
706
|
-
const [styles, mergedProps] = (0, import_core9.
|
706
|
+
const [styles, mergedProps] = (0, import_core9.useComponentMultiStyle)("DonutChart", props);
|
707
707
|
const {
|
708
708
|
className,
|
709
709
|
data,
|