@yamada-ui/charts 1.1.8-dev-20240619173525 → 2.0.0-next-20240619220221
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/area-chart.js +21 -28
- package/dist/area-chart.js.map +1 -1
- package/dist/area-chart.mjs +2 -2
- package/dist/bar-chart.js +9 -9
- package/dist/bar-chart.js.map +1 -1
- package/dist/bar-chart.mjs +2 -2
- package/dist/{chunk-4WX5YS7M.mjs → chunk-AIM5FCJI.mjs} +3 -3
- package/dist/chunk-AIM5FCJI.mjs.map +1 -0
- package/dist/{chunk-STBYRLC5.mjs → chunk-D3YZFAFO.mjs} +9 -9
- package/dist/chunk-D3YZFAFO.mjs.map +1 -0
- package/dist/{chunk-QZ5OXZ6Z.mjs → chunk-IIBF2GUV.mjs} +21 -26
- package/dist/chunk-IIBF2GUV.mjs.map +1 -0
- package/dist/{chunk-OW7SOTEF.mjs → chunk-JSDS6QWX.mjs} +3 -3
- package/dist/{chunk-OW7SOTEF.mjs.map → chunk-JSDS6QWX.mjs.map} +1 -1
- package/dist/{chunk-THT3VDBO.mjs → chunk-JXZPTLLZ.mjs} +21 -28
- package/dist/chunk-JXZPTLLZ.mjs.map +1 -0
- package/dist/{chunk-BPR7YL3O.mjs → chunk-K6OJ62SA.mjs} +3 -3
- package/dist/chunk-K6OJ62SA.mjs.map +1 -0
- package/dist/{chunk-LUFKURIL.mjs → chunk-LAYNVROX.mjs} +3 -3
- package/dist/{chunk-LUFKURIL.mjs.map → chunk-LAYNVROX.mjs.map} +1 -1
- package/dist/{chunk-LHI57S6P.mjs → chunk-MFYRHF3O.mjs} +5 -5
- package/dist/chunk-MFYRHF3O.mjs.map +1 -0
- package/dist/{chunk-KNAADLWO.mjs → chunk-OS3525CT.mjs} +3 -3
- package/dist/{chunk-KNAADLWO.mjs.map → chunk-OS3525CT.mjs.map} +1 -1
- package/dist/{chunk-E2I2XAZ6.mjs → chunk-SAP2SGIZ.mjs} +3 -3
- package/dist/{chunk-E2I2XAZ6.mjs.map → chunk-SAP2SGIZ.mjs.map} +1 -1
- package/dist/{chunk-KT4YOMM4.mjs → chunk-SEBQBOCB.mjs} +21 -26
- package/dist/chunk-SEBQBOCB.mjs.map +1 -0
- package/dist/donut-chart.js +5 -5
- package/dist/donut-chart.js.map +1 -1
- package/dist/donut-chart.mjs +2 -2
- package/dist/index.js +78 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/line-chart.js +21 -26
- package/dist/line-chart.js.map +1 -1
- package/dist/line-chart.mjs +2 -2
- package/dist/pie-chart.js +5 -5
- package/dist/pie-chart.js.map +1 -1
- package/dist/pie-chart.mjs +2 -2
- package/dist/radar-chart.js +21 -26
- package/dist/radar-chart.js.map +1 -1
- package/dist/radar-chart.mjs +2 -2
- package/dist/use-area-chart.js +20 -27
- package/dist/use-area-chart.js.map +1 -1
- package/dist/use-area-chart.mjs +1 -1
- package/dist/use-bar-chart.js +8 -8
- package/dist/use-bar-chart.js.map +1 -1
- package/dist/use-bar-chart.mjs +1 -1
- package/dist/use-line-chart.js +20 -25
- package/dist/use-line-chart.js.map +1 -1
- package/dist/use-line-chart.mjs +1 -1
- package/dist/use-pie-chart.js +4 -4
- package/dist/use-pie-chart.js.map +1 -1
- package/dist/use-pie-chart.mjs +1 -1
- package/dist/use-radar-chart.js +20 -25
- 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-4WX5YS7M.mjs.map +0 -1
- package/dist/chunk-BPR7YL3O.mjs.map +0 -1
- package/dist/chunk-KT4YOMM4.mjs.map +0 -1
- package/dist/chunk-LHI57S6P.mjs.map +0 -1
- package/dist/chunk-QZ5OXZ6Z.mjs.map +0 -1
- package/dist/chunk-STBYRLC5.mjs.map +0 -1
- package/dist/chunk-THT3VDBO.mjs.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/radar-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 ResponsiveContainer,\n RadarChart as ReChartsRadarChart,\n PolarGrid,\n PolarAngleAxis,\n PolarRadiusAxis,\n Radar,\n Tooltip,\n Legend,\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 { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport type { UseChartTooltipOptions } from \"./use-chart-tooltip\"\nimport { useChartTooltip } from \"./use-chart-tooltip\"\nimport type { UseRadarChartOptions } from \"./use-radar-chart\"\nimport { useRadarChart } from \"./use-radar-chart\"\n\ntype RadarChartOptions = {\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 true\n */\n withPolarGrid?: boolean\n /**\n * Determines whether polarAngleAxis should be displayed.\n *\n * @default true\n */\n withPolarAngleAxis?: boolean\n /**\n * Determines whether polarRadiusAxis should be displayed.\n *\n * @default false\n */\n withPolarRadiusAxis?: boolean\n /**\n * Unit displayed next to each tick in y-axis.\n */\n unit?: string\n}\n\nexport type RadarChartProps = HTMLUIProps<\"div\"> &\n ThemeProps<\"RadarChart\"> &\n RadarChartOptions &\n UseChartProps &\n UseChartTooltipOptions &\n UseChartLegendProps &\n UseRadarChartOptions\n\n/**\n * `RadarChart` is a component for drawing radar charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/radar-chart\n */\nexport const RadarChart = forwardRef<RadarChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"RadarChart\", props)\n const {\n className,\n data,\n series,\n dataKey,\n radarProps,\n chartProps,\n polarGridProps,\n polarAngleAxisProps,\n polarAngleAxisTickProps,\n polarRadiusAxisProps,\n polarRadiusAxisTickProps,\n containerProps,\n tooltipProps,\n legendProps,\n tooltipAnimationDuration,\n unit,\n valueFormatter,\n strokeDasharray,\n withDots,\n withActiveDots,\n strokeWidth,\n fillOpacity,\n withTooltip = true,\n withLegend = false,\n withPolarGrid = true,\n withPolarAngleAxis = true,\n withPolarRadiusAxis = false,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const {\n getRadarProps,\n getRadarChartProps,\n getPolarGridProps,\n getPolarAngleAxisProps,\n getPolarRadiusAxisProps,\n radarVars,\n setHighlightedArea,\n } = useRadarChart({\n data,\n series,\n dataKey,\n radarProps,\n chartProps,\n polarGridProps,\n polarAngleAxisProps,\n polarAngleAxisTickProps,\n polarRadiusAxisProps,\n polarRadiusAxisTickProps,\n withDots,\n withActiveDots,\n strokeWidth,\n fillOpacity,\n valueFormatter,\n strokeDasharray,\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 radars = useMemo(\n () =>\n series.map(({ dataKey }, index) => (\n <Radar\n key={`radar-${dataKey}`}\n {...getRadarProps({ index, className: \"ui-radar-chart__radar\" })}\n />\n )),\n [getRadarProps, series],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-radar-chart\", className)}\n var={radarVars}\n __css={{
|
1
|
+
{"version":3,"sources":["../src/radar-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 ResponsiveContainer,\n RadarChart as ReChartsRadarChart,\n PolarGrid,\n PolarAngleAxis,\n PolarRadiusAxis,\n Radar,\n Tooltip,\n Legend,\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 { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport type { UseChartTooltipOptions } from \"./use-chart-tooltip\"\nimport { useChartTooltip } from \"./use-chart-tooltip\"\nimport type { UseRadarChartOptions } from \"./use-radar-chart\"\nimport { useRadarChart } from \"./use-radar-chart\"\n\ntype RadarChartOptions = {\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 true\n */\n withPolarGrid?: boolean\n /**\n * Determines whether polarAngleAxis should be displayed.\n *\n * @default true\n */\n withPolarAngleAxis?: boolean\n /**\n * Determines whether polarRadiusAxis should be displayed.\n *\n * @default false\n */\n withPolarRadiusAxis?: boolean\n /**\n * Unit displayed next to each tick in y-axis.\n */\n unit?: string\n}\n\nexport type RadarChartProps = HTMLUIProps<\"div\"> &\n ThemeProps<\"RadarChart\"> &\n RadarChartOptions &\n UseChartProps &\n UseChartTooltipOptions &\n UseChartLegendProps &\n UseRadarChartOptions\n\n/**\n * `RadarChart` is a component for drawing radar charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/radar-chart\n */\nexport const RadarChart = forwardRef<RadarChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"RadarChart\", props)\n const {\n className,\n data,\n series,\n dataKey,\n radarProps,\n chartProps,\n polarGridProps,\n polarAngleAxisProps,\n polarAngleAxisTickProps,\n polarRadiusAxisProps,\n polarRadiusAxisTickProps,\n containerProps,\n tooltipProps,\n legendProps,\n tooltipAnimationDuration,\n unit,\n valueFormatter,\n strokeDasharray,\n withDots,\n withActiveDots,\n strokeWidth,\n fillOpacity,\n withTooltip = true,\n withLegend = false,\n withPolarGrid = true,\n withPolarAngleAxis = true,\n withPolarRadiusAxis = false,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const {\n getRadarProps,\n getRadarChartProps,\n getPolarGridProps,\n getPolarAngleAxisProps,\n getPolarRadiusAxisProps,\n radarVars,\n setHighlightedArea,\n } = useRadarChart({\n data,\n series,\n dataKey,\n radarProps,\n chartProps,\n polarGridProps,\n polarAngleAxisProps,\n polarAngleAxisTickProps,\n polarRadiusAxisProps,\n polarRadiusAxisTickProps,\n withDots,\n withActiveDots,\n strokeWidth,\n fillOpacity,\n valueFormatter,\n strokeDasharray,\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 radars = useMemo(\n () =>\n series.map(({ dataKey }, index) => (\n <Radar\n key={`radar-${dataKey}`}\n {...getRadarProps({ index, className: \"ui-radar-chart__radar\" })}\n />\n )),\n [getRadarProps, series],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-radar-chart\", className)}\n var={radarVars}\n __css={{ ...styles.container }}\n {...rest}\n >\n <ResponsiveContainer\n {...getContainerProps({ className: \"ui-radar-chart__container\" })}\n >\n <ReChartsRadarChart\n {...getRadarChartProps({ className: \"ui-radar-chart__chart\" })}\n >\n {withPolarGrid ? (\n <PolarGrid\n {...getPolarGridProps({\n className: \"ui-radar-chart__polar-grid\",\n })}\n />\n ) : null}\n {withPolarAngleAxis ? (\n <PolarAngleAxis\n {...getPolarAngleAxisProps({\n className: \"ui-radar-chart__polar-angle-axis\",\n })}\n />\n ) : null}\n {withPolarRadiusAxis ? (\n <PolarRadiusAxis\n {...getPolarRadiusAxisProps({\n className: \"ui-radar-chart__polar-radius-axis\",\n })}\n />\n ) : null}\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-line-chart__tooltip\"\n label={label}\n payload={payload}\n valueFormatter={valueFormatter}\n unit={unit}\n {...computedTooltipProps}\n />\n )}\n {...getTooltipProps()}\n />\n ) : null}\n\n {radars}\n </ReChartsRadarChart>\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,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAwIC,cAoBE,YApBF;AA1ED,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;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,cAAc;AAAA,IACd,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,qBAAqB;AAAA,IACrB,sBAAsB;AAAA,IACtB,GAA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;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,kBAAkB;AAAA,sBACpB,WAAW;AAAA,oBACb,CAAC;AAAA;AAAA,gBACH,IACE;AAAA,gBACH,qBACC;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,uBAAuB;AAAA,sBACzB,WAAW;AAAA,oBACb,CAAC;AAAA;AAAA,gBACH,IACE;AAAA,gBACH,sBACC;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,wBAAwB;AAAA,sBAC1B,WAAW;AAAA,oBACb,CAAC;AAAA;AAAA,gBACH,IACE;AAAA,gBAEH,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,wBACC,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,gBAAgB;AAAA;AAAA,gBACtB,IACE;AAAA,gBAEH;AAAA;AAAA;AAAA,UACH;AAAA;AAAA,MACF;AAAA;AAAA,EACF,GACF;AAEJ,CAAC;","names":["dataKey"]}
|
@@ -42,8 +42,8 @@ var useAreaChart = ({
|
|
42
42
|
const {
|
43
43
|
dot = {},
|
44
44
|
activeDot = {},
|
45
|
-
dimDot,
|
46
|
-
dimArea,
|
45
|
+
dimDot = {},
|
46
|
+
dimArea = {},
|
47
47
|
...computedAreaProps
|
48
48
|
} = (_a = rest.areaProps) != null ? _a : {};
|
49
49
|
const areaColors = useMemo(
|
@@ -93,8 +93,6 @@ var useAreaChart = ({
|
|
93
93
|
);
|
94
94
|
const [areaProps, areaClassName] = useMemo(() => {
|
95
95
|
const resolvedAreaProps = {
|
96
|
-
fillOpacity: 1,
|
97
|
-
strokeOpacity: 1,
|
98
96
|
...computedAreaProps
|
99
97
|
};
|
100
98
|
return getComponentProps(
|
@@ -102,23 +100,17 @@ var useAreaChart = ({
|
|
102
100
|
styles.area
|
103
101
|
)(theme);
|
104
102
|
}, [computedAreaProps, styles.area, theme]);
|
105
|
-
const [dimAreaProps, dimAreaClassName] = useMemo(
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
)
|
114
|
-
|
115
|
-
|
116
|
-
const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
|
117
|
-
return getComponentProps(
|
118
|
-
[resolvedDot, dotProperties],
|
119
|
-
styles.dot
|
120
|
-
)(theme);
|
121
|
-
}, [dot, styles.dot, theme]);
|
103
|
+
const [dimAreaProps, dimAreaClassName] = useMemo(
|
104
|
+
() => getComponentProps(
|
105
|
+
[dimArea, areaProperties],
|
106
|
+
styles.dimArea
|
107
|
+
)(theme),
|
108
|
+
[dimArea, styles.dimArea, theme]
|
109
|
+
);
|
110
|
+
const [dotProps, dotClassName] = useMemo(
|
111
|
+
() => getComponentProps([dot, dotProperties], styles.dot)(theme),
|
112
|
+
[dot, styles.dot, theme]
|
113
|
+
);
|
122
114
|
const [activeDotProps, activeDotClassName] = useMemo(
|
123
115
|
() => getComponentProps(
|
124
116
|
[activeDot, dotProperties],
|
@@ -126,12 +118,13 @@ var useAreaChart = ({
|
|
126
118
|
)(theme),
|
127
119
|
[activeDot, styles.activeDot, theme]
|
128
120
|
);
|
129
|
-
const [dimDotProps, dimDotClassName] = useMemo(
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
)
|
134
|
-
|
121
|
+
const [dimDotProps, dimDotClassName] = useMemo(
|
122
|
+
() => getComponentProps(
|
123
|
+
[dimDot, dotProperties],
|
124
|
+
styles.dimDot
|
125
|
+
)(theme),
|
126
|
+
[dimDot, styles.dimDot, theme]
|
127
|
+
);
|
135
128
|
const defaultSplitOffset = useMemo(() => {
|
136
129
|
if (series.length === 1) {
|
137
130
|
const dataKey = series[0].dataKey;
|
@@ -321,4 +314,4 @@ var useAreaChart = ({
|
|
321
314
|
export {
|
322
315
|
useAreaChart
|
323
316
|
};
|
324
|
-
//# sourceMappingURL=chunk-
|
317
|
+
//# sourceMappingURL=chunk-JXZPTLLZ.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-area-chart.ts"],"sourcesContent":["import type { CSSUIObject, CSSUIProps } from \"@yamada-ui/core\"\nimport { 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 ChartPropGetter,\n ChartLayoutType,\n ReferenceLineProps,\n RequiredChartPropGetter,\n} from \"./chart.types\"\nimport {\n areaChartProperties,\n dotProperties,\n areaProperties,\n} from \"./rechart-properties\"\n\nexport type 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\nexport type UseAreaChartProps = 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 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[\"var\"] = useMemo(\n () =>\n series.map(({ color }, index) => ({\n __prefix: \"ui\",\n name: `area-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n })),\n [series],\n )\n\n const areaSplitColors: CSSUIProps[\"var\"] = useMemo(\n () =>\n splitColors.map((color, index) => ({\n __prefix: \"ui\",\n name: `area-split-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n })),\n [splitColors],\n )\n\n const referenceLineColors: CSSUIProps[\"var\"] = useMemo(\n () =>\n referenceLineProps\n ? referenceLineProps.map(({ color }, index) => ({\n __prefix: \"ui\",\n name: `reference-line-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n }))\n : [],\n [referenceLineProps],\n )\n\n const areaVars: CSSUIProps[\"var\"] = useMemo(() => {\n return [\n ...areaColors,\n ...areaSplitColors,\n ...referenceLineColors,\n { __prefix: \"ui\", name: \"fill-opacity\", value: fillOpacity },\n ]\n }, [areaColors, areaSplitColors, referenceLineColors, fillOpacity])\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 = `var(--ui-area-${index})`\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(\"ui-area-chart__active-dot\", className),\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: ChartPropGetter<\n \"div\",\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 ...props,\n ...chartProps,\n }),\n [areaChartClassName, data, type, layoutType, syncId, chartProps],\n )\n\n const getAreaSplitProps: ChartPropGetter<\n \"div\",\n Partial<AreaSplitProps>,\n AreaSplitProps\n > = useCallback(\n (props = {}) => ({\n id: splitId,\n offset: splitOffset ?? defaultSplitOffset,\n fillOpacity: \"var(--ui-fill-opacity)\",\n ...props,\n }),\n [defaultSplitOffset, splitId, splitOffset],\n )\n\n const getAreaProps: RequiredChartPropGetter<\n \"div\",\n {\n index: number\n },\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: ChartPropGetter<\n \"div\",\n Partial<AreaGradientProps>,\n AreaGradientProps\n > = useCallback(\n (props = {}) => ({\n withGradient,\n fillOpacity: \"var(--ui-fill-opacity)\",\n ...props,\n }),\n [withGradient],\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":";;;;;;;;;;;AACA,SAAS,gBAAgB;AAEzB,SAAS,UAAU;AAEnB,SAAS,aAAa,OAAO,SAAS,gBAAgB;AAoH/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;AAAA,EACd,eAAe;AAAA,EACf,cAAc;AAAA,EACd,cAAc,CAAC,WAAW,SAAS;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AA3IzB;AA4IE,QAAM,OAAO,MAAM;AACnB,QAAM,EAAE,MAAM,IAAI,SAAS;AAC3B,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAwB,IAAI;AAC1E,QAAM,UAAU,GAAG,IAAI;AACvB,QAAM,UAAU,SAAS,aAAa,SAAS;AAC/C,QAAM,eACJ,OAAO,qBAAqB,YACxB,mBACA,SAAS;AACf,QAAM,kBAAkB,oBAAoB;AAC5C,QAAM;AAAA,IACJ,MAAM,CAAC;AAAA,IACP,YA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AG;AAAA,IACL;AAAA,IACA,CAAC,oBAAoB,SAAS,WAAW;AAAA,EAC3C;AAEA,QAAM,eAMF;AAAA,IACF,CAAC,EAAE,OAAO,WAAW,eAAe,GAAG,MAAM,GAAG,MAAM,SAAS;AAC7D,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAAH;AAAA,QACA,KAAAD;AAAA,QACA,GAAGI;AAAA,MACL,IAAI,cAAc,KAAK;AAEvB,aAAO;AAAA,QACL;AAAA,QACA,WAAW,GAAG,eAAe,SAAS;AAAA,QACtC;AAAA,QACA,WAAAH;AAAA,QACA,KAAAD;AAAA,QACA,MAAM;AAAA,QACN,MAAM;AAAA,QACN;AAAA,QACA,MAAM,SAAS,UAAU,QAAQ,OAAO,MAAM,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,uBAIF;AAAA,IACF,CAAC,QAAQ,CAAC,OAAO;AAAA,MACf;AAAA,MACA,aAAa;AAAA,MACb,GAAG;AAAA,IACL;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["_a","dot","activeDot","dimDot","dimArea","rest"]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
usePieChart
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-MFYRHF3O.mjs";
|
5
5
|
import {
|
6
6
|
useChartLegend
|
7
7
|
} from "./chunk-LM2DQK2P.mjs";
|
@@ -110,7 +110,7 @@ var DonutChart = forwardRef((props, ref) => {
|
|
110
110
|
ref,
|
111
111
|
className: cx("ui-donut-chart", className),
|
112
112
|
var: pieVars,
|
113
|
-
__css: {
|
113
|
+
__css: { ...styles.container },
|
114
114
|
...rest,
|
115
115
|
children: /* @__PURE__ */ jsx(
|
116
116
|
ResponsiveContainer,
|
@@ -176,4 +176,4 @@ var DonutChart = forwardRef((props, ref) => {
|
|
176
176
|
export {
|
177
177
|
DonutChart
|
178
178
|
};
|
179
|
-
//# sourceMappingURL=chunk-
|
179
|
+
//# sourceMappingURL=chunk-K6OJ62SA.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/donut-chart.tsx"],"sourcesContent":["import {\n forwardRef,\n omitThemeProps,\n ui,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMemo } from \"react\"\nimport {\n Cell,\n 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 { useChartLegend } from \"./use-chart-legend\"\nimport { useChartTooltip } from \"./use-chart-tooltip\"\nimport { usePieChart } from \"./use-pie-chart\"\n\ntype DonutChartOptions = {\n /**\n * Controls innerRadius of the chart segments.\n * If it is a number, it is the width of the radius.\n * For example, `60` means the radius is `60px` and the diameter is `120px`.\n *\n * @default '60%'\n */\n innerRadius?: number | string\n}\n\nexport type DonutChartProps = PieChartProps & DonutChartOptions\n\n/**\n * `DonutChart` is a component for drawing donut charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/donut-chart\n */\nexport const DonutChart = forwardRef<DonutChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"DonutChart\", props)\n const {\n className,\n data,\n pieProps,\n chartProps,\n cellProps,\n containerProps,\n withTooltip = true,\n withLegend = false,\n tooltipProps,\n tooltipAnimationDuration,\n tooltipDataSource = \"all\",\n valueFormatter,\n unit,\n paddingAngle,\n startAngle,\n endAngle,\n withLabels,\n withLabelLines,\n innerRadius = withLabels ? \"60%\" : \"80%\",\n outerRadius,\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 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={`donut-cell-${name}`}\n {...getCellProps({ index, className: \"ui-donut-chart__cell\" })}\n />\n )),\n [data, getCellProps],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-donut-chart\", className)}\n var={pieVars}\n __css={{ ...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 labelClassName: \"ui-donut-chart__label\",\n labelLineClassName: \"ui-donut-chart__label-line\",\n })}\n >\n {cells}\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,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,OACK;AA0FC,cAoBE,YApBF;AA/DD,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,cAAc,aAAa,QAAQ;AAAA,IACnC;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,EACF,IAAI,YAAY;AAAA,IACd;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,EACF,CAAC;AACD,QA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AA;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":[]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
useAreaChart
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-JXZPTLLZ.mjs";
|
5
5
|
import {
|
6
6
|
AreaGradient
|
7
7
|
} from "./chunk-MSIOYYWR.mjs";
|
@@ -187,7 +187,7 @@ var AreaChart = forwardRef((props, ref) => {
|
|
187
187
|
ref,
|
188
188
|
className: cx("ui-area-chart", className),
|
189
189
|
var: areaVars,
|
190
|
-
__css: {
|
190
|
+
__css: { ...styles.container },
|
191
191
|
...rest,
|
192
192
|
children: /* @__PURE__ */ jsx(
|
193
193
|
ResponsiveContainer,
|
@@ -253,4 +253,4 @@ var AreaChart = forwardRef((props, ref) => {
|
|
253
253
|
export {
|
254
254
|
AreaChart
|
255
255
|
};
|
256
|
-
//# sourceMappingURL=chunk-
|
256
|
+
//# sourceMappingURL=chunk-LAYNVROX.mjs.map
|
@@ -1 +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} 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 type = \"default\",\n withTooltip = true,\n withLegend = false,\n referenceLineProps = [],\n containerProps,\n unit,\n gridProps,\n strokeDasharray,\n valueFormatter,\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 styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const { getXAxisProps, getYAxisProps } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n unit,\n valueFormatter,\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={{ maxW: \"full\", ...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 <XAxis {...getXAxisProps({ className: \"ui-area-chart__x-axis\" })} />\n <YAxis {...getYAxisProps({ className: \"ui-area-chart__y-axis\" })} />\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 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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Q,GAAG,OAAO,UAAU;AAAA,MAC1C,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACE,GAAG,kBAAkB,EAAE,WAAW,2BAA2B,CAAC;AAAA,UAE/D;AAAA,YAAC;AAAA;AAAA,cACE,GAAG,kBAAkB,EAAE,WAAW,uBAAuB,CAAC;AAAA,cAE3D;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,aAAa,EAAE,WAAW,sBAAsB,CAAC;AAAA;AAAA,gBACvD;AAAA,gBACA,oBAAC,SAAO,GAAG,cAAc,EAAE,WAAW,wBAAwB,CAAC,GAAG;AAAA,gBAClE,oBAAC,SAAO,GAAG,cAAc,EAAE,WAAW,wBAAwB,CAAC,GAAG;AAAA,gBAEjE,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,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"]}
|
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} 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 type = \"default\",\n withTooltip = true,\n withLegend = false,\n referenceLineProps = [],\n containerProps,\n unit,\n gridProps,\n strokeDasharray,\n valueFormatter,\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 styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const { getXAxisProps, getYAxisProps } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n unit,\n valueFormatter,\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 <XAxis {...getXAxisProps({ className: \"ui-area-chart__x-axis\" })} />\n <YAxis {...getYAxisProps({ className: \"ui-area-chart__y-axis\" })} />\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 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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AAAA,EACF,GACF;AAEJ,CAAC;","names":["dataKey","rest"]}
|
@@ -80,12 +80,12 @@ var usePieChart = ({
|
|
80
80
|
return getClassName(resolvedCellProps)(theme);
|
81
81
|
}, [computedCellProps, styles.cell, theme]);
|
82
82
|
const dimCellClassName = useMemo(() => {
|
83
|
-
const resolvedDimCell = {
|
83
|
+
const resolvedDimCell = { ...styles.dimCell, ...dimCell };
|
84
84
|
return getClassName(resolvedDimCell)(theme);
|
85
|
-
}, [dimCell, theme]);
|
85
|
+
}, [dimCell, styles.dimCell, theme]);
|
86
86
|
const activeShapeProps = useMemo(
|
87
87
|
() => getComponentProps(
|
88
|
-
[
|
88
|
+
[activeShape, pieProperties],
|
89
89
|
styles.activeShape
|
90
90
|
)(theme, true),
|
91
91
|
[activeShape, styles.activeShape, theme]
|
@@ -98,7 +98,7 @@ var usePieChart = ({
|
|
98
98
|
[inactiveShape, styles.inactiveShape, theme]
|
99
99
|
);
|
100
100
|
const labelClassName = useMemo(
|
101
|
-
() => getClassName({
|
101
|
+
() => getClassName({ ...styles.label, ...label })(theme),
|
102
102
|
[label, styles.label, theme]
|
103
103
|
);
|
104
104
|
const labelLineClassName = useMemo(
|
@@ -212,4 +212,4 @@ var usePieChart = ({
|
|
212
212
|
export {
|
213
213
|
usePieChart
|
214
214
|
};
|
215
|
-
//# sourceMappingURL=chunk-
|
215
|
+
//# sourceMappingURL=chunk-MFYRHF3O.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 { 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 * 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 values inside the tooltip.\n */\n valueFormatter?: (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 strokeWidth = 1,\n fillOpacity = 1,\n innerRadius = \"0%\",\n outerRadius = withLabels ? \"80%\" : \"100%\",\n paddingAngle = 0,\n startAngle = 90,\n endAngle = -270,\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,\n labelLine,\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 labelClassName = useMemo(\n () => getClassName({ ...styles.label, ...label })(theme),\n [label, styles.label, theme],\n )\n\n const labelLineClassName = useMemo(\n () => getClassName({ ...styles.labelLine, ...labelLine })(theme),\n [labelLine, styles.labelLine, theme],\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 labelClassName: string\n labelLineClassName: string\n },\n Omit<Recharts.PieProps, \"ref\">\n > = useCallback(\n (\n {\n className,\n labelClassName: labelClassNameProp,\n labelLineClassName: labelLineClassNameProp,\n ...props\n },\n ref = null,\n ) => ({\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\n ? { className: cx(labelClassNameProp, labelClassName) }\n : false,\n labelLine: withLabelLines\n ? { className: cx(labelLineClassNameProp, labelLineClassName) }\n : 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 labelClassName,\n withLabelLines,\n labelLineClassName,\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;AAiGxC,IAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc,aAAa,QAAQ;AAAA,EACnC,eAAe;AAAA,EACf,aAAa;AAAA,EACb,WAAW;AAAA,EACX;AAAA,EACA,GAAG;AACL,MAAwB;AAjHxB;AAkHE,QAAM,EAAE,MAAM,IAAI,SAAS;AAC3B,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAwB,IAAI;AAC1E,QAAM,kBAAkB,oBAAoB;AAC5C,QAAM,EAAE,SAAS,GAAG,kBAAkB,KAAI,UAAK,cAAL,YAAkB,CAAC;AAC7D,QAAM;AAAA,IACJ,cAAc,CAAC;AAAA,IACf,gBAAgB,CAAC;AAAA,IACjB;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,KAAI,UAAK,aAAL,YAAiB,CAAC;AAEtB,QAAM,aAAgC;AAAA,IACpC,MACE,KAAK,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;AAAA,MAC9B,UAAU;AAAA,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7 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
useBarChart
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-D3YZFAFO.mjs";
|
5
5
|
import {
|
6
6
|
useChartAxis
|
7
7
|
} from "./chunk-P7AFSM5W.mjs";
|
@@ -157,7 +157,7 @@ var BarChart = forwardRef((props, ref) => {
|
|
157
157
|
ref,
|
158
158
|
className: cx("ui-bar-chart", className),
|
159
159
|
var: barVars,
|
160
|
-
__css: {
|
160
|
+
__css: { ...styles.container },
|
161
161
|
...rest,
|
162
162
|
children: /* @__PURE__ */ jsx(
|
163
163
|
ResponsiveContainer,
|
@@ -222,4 +222,4 @@ var BarChart = forwardRef((props, ref) => {
|
|
222
222
|
export {
|
223
223
|
BarChart
|
224
224
|
};
|
225
|
-
//# sourceMappingURL=chunk-
|
225
|
+
//# sourceMappingURL=chunk-OS3525CT.mjs.map
|
@@ -1 +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 Bar,\n CartesianGrid,\n Tooltip,\n XAxis,\n YAxis,\n ResponsiveContainer,\n ReferenceLine,\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 type = \"default\",\n withTooltip = true,\n withLegend = false,\n containerProps,\n unit,\n valueFormatter,\n tooltipProps,\n tooltipAnimationDuration,\n legendProps,\n data,\n referenceLineProps = [],\n gridProps,\n strokeDasharray,\n fillOpacity,\n chartProps,\n syncId,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const { getBarChartProps, getBarProps, barVars, setHighlightedArea } =\n useBarChart({\n data,\n series,\n type,\n layoutType,\n chartProps,\n barProps,\n referenceLineProps,\n fillOpacity,\n syncId,\n styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const { getXAxisProps, getYAxisProps } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n unit,\n valueFormatter,\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 bars = useMemo(\n () =>\n series.map(({ dataKey }, index) => {\n return (\n <Bar\n key={`bar-${dataKey}`}\n {...getBarProps({ index, className: \"ui-bar-chart__bar\" })}\n />\n )\n }),\n [getBarProps, 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-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={{
|
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 Bar,\n CartesianGrid,\n Tooltip,\n XAxis,\n YAxis,\n ResponsiveContainer,\n ReferenceLine,\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 type = \"default\",\n withTooltip = true,\n withLegend = false,\n containerProps,\n unit,\n valueFormatter,\n tooltipProps,\n tooltipAnimationDuration,\n legendProps,\n data,\n referenceLineProps = [],\n gridProps,\n strokeDasharray,\n fillOpacity,\n chartProps,\n syncId,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const { getBarChartProps, getBarProps, barVars, setHighlightedArea } =\n useBarChart({\n data,\n series,\n type,\n layoutType,\n chartProps,\n barProps,\n referenceLineProps,\n fillOpacity,\n syncId,\n styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const { getXAxisProps, getYAxisProps } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n unit,\n valueFormatter,\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 bars = useMemo(\n () =>\n series.map(({ dataKey }, index) => {\n return (\n <Bar\n key={`bar-${dataKey}`}\n {...getBarProps({ index, className: \"ui-bar-chart__bar\" })}\n />\n )\n }),\n [getBarProps, 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-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 <XAxis {...getXAxisProps({ className: \"ui-bar-chart__x-axis\" })} />\n <YAxis {...getYAxisProps({ className: \"ui-bar-chart__y-axis\" })} />\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 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;AAuIG,cAmCA,YAnCA;AArFH,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,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,cAAc;AAAA,IACd,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,qBAAqB,CAAC;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI,eAAe,WAAW;AAE9B,QAAM,EAAE,kBAAkB,aAAa,SAAS,mBAAmB,IACjE,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH,QAAM,EAAE,kBAAkB,IAAI,SAAS,EAAE,eAAe,CAAC;AACzD,QAAM,EAAE,eAAe,cAAc,IAAI,aAAa;AAAA,IACpD;AA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AAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACE,GAAG,kBAAkB,EAAE,WAAW,0BAA0B,CAAC;AAAA,UAE9D;AAAA,YAAC;AAAA;AAAA,cACE,GAAG,iBAAiB,EAAE,WAAW,sBAAsB,CAAC;AAAA,cAEzD;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,aAAa,EAAE,WAAW,qBAAqB,CAAC;AAAA;AAAA,gBACtD;AAAA,gBACA,oBAAC,SAAO,GAAG,cAAc,EAAE,WAAW,uBAAuB,CAAC,GAAG;AAAA,gBACjE,oBAAC,SAAO,GAAG,cAAc,EAAE,WAAW,uBAAuB,CAAC,GAAG;AAAA,gBAEhE,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,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"]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
useLineChart
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-IIBF2GUV.mjs";
|
5
5
|
import {
|
6
6
|
useChartAxis
|
7
7
|
} from "./chunk-P7AFSM5W.mjs";
|
@@ -164,7 +164,7 @@ var LineChart = forwardRef((props, ref) => {
|
|
164
164
|
ref,
|
165
165
|
className: cx("ui-line-chart", className),
|
166
166
|
var: lineVars,
|
167
|
-
__css: {
|
167
|
+
__css: { ...styles.container },
|
168
168
|
...rest,
|
169
169
|
children: /* @__PURE__ */ jsx(
|
170
170
|
ResponsiveContainer,
|
@@ -229,4 +229,4 @@ var LineChart = forwardRef((props, ref) => {
|
|
229
229
|
export {
|
230
230
|
LineChart
|
231
231
|
};
|
232
|
-
//# sourceMappingURL=chunk-
|
232
|
+
//# sourceMappingURL=chunk-SAP2SGIZ.mjs.map
|
@@ -1 +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} 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 unit,\n valueFormatter,\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 styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const { getXAxisProps, getYAxisProps } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n unit,\n valueFormatter,\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={{
|
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} 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 unit,\n valueFormatter,\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 styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const { getXAxisProps, getYAxisProps } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n unit,\n valueFormatter,\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 <XAxis {...getXAxisProps({ className: \"ui-line-chart__x-axis\" })} />\n <YAxis {...getYAxisProps({ className: \"ui-line-chart__y-axis\" })} />\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 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,OACK;AAgJC,cAkCE,YAlCF;AA7FD,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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,cAAc;AAAA,IACd;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,EAAE,cAAc,mBAAmB,UAAU,mBAAmB,IACpE,aAAa;AAAA,IACX;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,EACF,CAAC;AACH,QAAM,EAAE,kBAAkB,IAAI,SAAS,EAAE,eAAe,CAAC;AACzD,QAAM,EA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AAA,MAC5B,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACE,GAAG,kBAAkB,EAAE,WAAW,2BAA2B,CAAC;AAAA,UAE/D;AAAA,YAAC;AAAA;AAAA,cACE,GAAG,kBAAkB,EAAE,WAAW,uBAAuB,CAAC;AAAA,cAE3D;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACE,GAAG,aAAa,EAAE,WAAW,sBAAsB,CAAC;AAAA;AAAA,gBACvD;AAAA,gBACA,oBAAC,SAAO,GAAG,cAAc,EAAE,WAAW,wBAAwB,CAAC,GAAG;AAAA,gBAClE,oBAAC,SAAO,GAAG,cAAc,EAAE,WAAW,wBAAwB,CAAC,GAAG;AAAA,gBAEjE,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,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"]}
|
@@ -36,8 +36,8 @@ var useRadarChart = ({
|
|
36
36
|
const {
|
37
37
|
dot = {},
|
38
38
|
activeDot = {},
|
39
|
-
dimDot,
|
40
|
-
dimRadar,
|
39
|
+
dimDot = {},
|
40
|
+
dimRadar = {},
|
41
41
|
...computedRadarProps
|
42
42
|
} = (_a = rest.radarProps) != null ? _a : {};
|
43
43
|
const radarColors = useMemo(
|
@@ -120,23 +120,17 @@ var useRadarChart = ({
|
|
120
120
|
styles.radar
|
121
121
|
)(theme);
|
122
122
|
}, [computedRadarProps, styles.radar, theme]);
|
123
|
-
const [dimRadarProps, dimRadarClassName] = useMemo(
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
)
|
132
|
-
|
133
|
-
|
134
|
-
const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
|
135
|
-
return getComponentProps(
|
136
|
-
[resolvedDot, dotProperties],
|
137
|
-
styles.dot
|
138
|
-
)(theme);
|
139
|
-
}, [dot, styles.dot, theme]);
|
123
|
+
const [dimRadarProps, dimRadarClassName] = useMemo(
|
124
|
+
() => getComponentProps(
|
125
|
+
[dimRadar, radarProperties],
|
126
|
+
styles.dimRadar
|
127
|
+
)(theme),
|
128
|
+
[dimRadar, styles.dimRadar, theme]
|
129
|
+
);
|
130
|
+
const [dotProps, dotClassName] = useMemo(
|
131
|
+
() => getComponentProps([dot, dotProperties], styles.dot)(theme),
|
132
|
+
[dot, styles.dot, theme]
|
133
|
+
);
|
140
134
|
const [activeDotProps, activeDotClassName] = useMemo(
|
141
135
|
() => getComponentProps(
|
142
136
|
[activeDot, dotProperties],
|
@@ -144,12 +138,13 @@ var useRadarChart = ({
|
|
144
138
|
)(theme),
|
145
139
|
[activeDot, styles.activeDot, theme]
|
146
140
|
);
|
147
|
-
const [dimDotProps, dimDotClassName] = useMemo(
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
)
|
152
|
-
|
141
|
+
const [dimDotProps, dimDotClassName] = useMemo(
|
142
|
+
() => getComponentProps(
|
143
|
+
[dimDot, dotProperties],
|
144
|
+
styles.dimDot
|
145
|
+
)(theme),
|
146
|
+
[dimDot, styles.dimDot, theme]
|
147
|
+
);
|
153
148
|
const radarPropList = useMemo(
|
154
149
|
() => series.map((props, index) => {
|
155
150
|
const {
|
@@ -341,4 +336,4 @@ var useRadarChart = ({
|
|
341
336
|
export {
|
342
337
|
useRadarChart
|
343
338
|
};
|
344
|
-
//# sourceMappingURL=chunk-
|
339
|
+
//# sourceMappingURL=chunk-SEBQBOCB.mjs.map
|