@yamada-ui/charts 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/area-chart-gradient.d.mts +11 -0
- package/dist/area-chart-gradient.d.ts +11 -0
- package/dist/area-chart-gradient.js +47 -0
- package/dist/area-chart-gradient.js.map +1 -0
- package/dist/area-chart-gradient.mjs +8 -0
- package/dist/area-chart-gradient.mjs.map +1 -0
- package/dist/area-chart-split.d.mts +10 -0
- package/dist/area-chart-split.d.ts +10 -0
- package/dist/area-chart-split.js +52 -0
- package/dist/area-chart-split.js.map +1 -0
- package/dist/area-chart-split.mjs +8 -0
- package/dist/area-chart-split.mjs.map +1 -0
- package/dist/area-chart.d.mts +36 -0
- package/dist/area-chart.d.ts +36 -0
- package/dist/area-chart.js +1249 -0
- package/dist/area-chart.js.map +1 -0
- package/dist/area-chart.mjs +21 -0
- package/dist/area-chart.mjs.map +1 -0
- package/dist/bar-chart.d.mts +33 -0
- package/dist/bar-chart.d.ts +33 -0
- package/dist/bar-chart.js +1053 -0
- package/dist/bar-chart.js.map +1 -0
- package/dist/bar-chart.mjs +19 -0
- package/dist/bar-chart.mjs.map +1 -0
- package/dist/chart-legend.d.mts +12 -0
- package/dist/chart-legend.d.ts +12 -0
- package/dist/chart-legend.js +87 -0
- package/dist/chart-legend.js.map +1 -0
- package/dist/chart-legend.mjs +11 -0
- package/dist/chart-legend.mjs.map +1 -0
- package/dist/chart-tooltip.d.mts +12 -0
- package/dist/chart-tooltip.d.ts +12 -0
- package/dist/chart-tooltip.js +120 -0
- package/dist/chart-tooltip.js.map +1 -0
- package/dist/chart-tooltip.mjs +11 -0
- package/dist/chart-tooltip.mjs.map +1 -0
- package/dist/chart-utils.d.mts +9 -0
- package/dist/chart-utils.d.ts +9 -0
- package/dist/chart-utils.js +45 -0
- package/dist/chart-utils.js.map +1 -0
- package/dist/chart-utils.mjs +10 -0
- package/dist/chart-utils.mjs.map +1 -0
- package/dist/chart.types.d.mts +65 -0
- package/dist/chart.types.d.ts +65 -0
- package/dist/chart.types.js +20 -0
- package/dist/chart.types.js.map +1 -0
- package/dist/chart.types.mjs +2 -0
- package/dist/chart.types.mjs.map +1 -0
- package/dist/chunk-32BO2QEP.mjs +83 -0
- package/dist/chunk-32BO2QEP.mjs.map +1 -0
- package/dist/chunk-3CY3IFRN.mjs +42 -0
- package/dist/chunk-3CY3IFRN.mjs.map +1 -0
- package/dist/chunk-3IBGJT6F.mjs +341 -0
- package/dist/chunk-3IBGJT6F.mjs.map +1 -0
- package/dist/chunk-5QCKM3B3.mjs +438 -0
- package/dist/chunk-5QCKM3B3.mjs.map +1 -0
- package/dist/chunk-AURFFNDQ.mjs +114 -0
- package/dist/chunk-AURFFNDQ.mjs.map +1 -0
- package/dist/chunk-FGDWJUA3.mjs +56 -0
- package/dist/chunk-FGDWJUA3.mjs.map +1 -0
- package/dist/chunk-GZLE5XDS.mjs +227 -0
- package/dist/chunk-GZLE5XDS.mjs.map +1 -0
- package/dist/chunk-HE6SM47L.mjs +234 -0
- package/dist/chunk-HE6SM47L.mjs.map +1 -0
- package/dist/chunk-LXZCGIND.mjs +33 -0
- package/dist/chunk-LXZCGIND.mjs.map +1 -0
- package/dist/chunk-MSIOYYWR.mjs +24 -0
- package/dist/chunk-MSIOYYWR.mjs.map +1 -0
- package/dist/chunk-PNE3JG54.mjs +29 -0
- package/dist/chunk-PNE3JG54.mjs.map +1 -0
- package/dist/chunk-QL3DB7OJ.mjs +21 -0
- package/dist/chunk-QL3DB7OJ.mjs.map +1 -0
- package/dist/chunk-RG5JQJXE.mjs +249 -0
- package/dist/chunk-RG5JQJXE.mjs.map +1 -0
- package/dist/chunk-RTTZPOUT.mjs +50 -0
- package/dist/chunk-RTTZPOUT.mjs.map +1 -0
- package/dist/chunk-RXWD2EJ2.mjs +56 -0
- package/dist/chunk-RXWD2EJ2.mjs.map +1 -0
- package/dist/chunk-TKLHZBVY.mjs +206 -0
- package/dist/chunk-TKLHZBVY.mjs.map +1 -0
- package/dist/chunk-WDSR6B47.mjs +324 -0
- package/dist/chunk-WDSR6B47.mjs.map +1 -0
- package/dist/chunk-WF3BD34Y.mjs +74 -0
- package/dist/chunk-WF3BD34Y.mjs.map +1 -0
- package/dist/chunk-YBAGOHS5.mjs +204 -0
- package/dist/chunk-YBAGOHS5.mjs.map +1 -0
- package/dist/chunk-YRY7MUCR.mjs +258 -0
- package/dist/chunk-YRY7MUCR.mjs.map +1 -0
- package/dist/index.d.mts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +2725 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +36 -0
- package/dist/index.mjs.map +1 -0
- package/dist/line-chart.d.mts +33 -0
- package/dist/line-chart.d.ts +33 -0
- package/dist/line-chart.js +1114 -0
- package/dist/line-chart.js.map +1 -0
- package/dist/line-chart.mjs +19 -0
- package/dist/line-chart.mjs.map +1 -0
- package/dist/radar-chart.d.mts +52 -0
- package/dist/radar-chart.d.ts +52 -0
- package/dist/radar-chart.js +940 -0
- package/dist/radar-chart.js.map +1 -0
- package/dist/radar-chart.mjs +16 -0
- package/dist/radar-chart.mjs.map +1 -0
- package/dist/rechart-properties.d.mts +24 -0
- package/dist/rechart-properties.d.ts +24 -0
- package/dist/rechart-properties.js +479 -0
- package/dist/rechart-properties.js.map +1 -0
- package/dist/rechart-properties.mjs +44 -0
- package/dist/rechart-properties.mjs.map +1 -0
- package/dist/use-area-chart.d.mts +118 -0
- package/dist/use-area-chart.d.ts +118 -0
- package/dist/use-area-chart.js +418 -0
- package/dist/use-area-chart.js.map +1 -0
- package/dist/use-area-chart.mjs +10 -0
- package/dist/use-area-chart.mjs.map +1 -0
- package/dist/use-bar-chart.d.mts +68 -0
- package/dist/use-bar-chart.d.ts +68 -0
- package/dist/use-bar-chart.js +288 -0
- package/dist/use-bar-chart.js.map +1 -0
- package/dist/use-bar-chart.mjs +10 -0
- package/dist/use-bar-chart.mjs.map +1 -0
- package/dist/use-chart-axis.d.mts +73 -0
- package/dist/use-chart-axis.d.ts +73 -0
- package/dist/use-chart-axis.js +227 -0
- package/dist/use-chart-axis.js.map +1 -0
- package/dist/use-chart-axis.mjs +10 -0
- package/dist/use-chart-axis.mjs.map +1 -0
- package/dist/use-chart-grid.d.mts +32 -0
- package/dist/use-chart-grid.d.ts +32 -0
- package/dist/use-chart-grid.js +92 -0
- package/dist/use-chart-grid.js.map +1 -0
- package/dist/use-chart-grid.mjs +10 -0
- package/dist/use-chart-grid.mjs.map +1 -0
- package/dist/use-chart-legend.d.mts +18 -0
- package/dist/use-chart-legend.d.ts +18 -0
- package/dist/use-chart-legend.js +81 -0
- package/dist/use-chart-legend.js.map +1 -0
- package/dist/use-chart-legend.mjs +9 -0
- package/dist/use-chart-legend.mjs.map +1 -0
- package/dist/use-chart-reference-line.d.mts +22 -0
- package/dist/use-chart-reference-line.d.ts +22 -0
- package/dist/use-chart-reference-line.js +105 -0
- package/dist/use-chart-reference-line.js.map +1 -0
- package/dist/use-chart-reference-line.mjs +10 -0
- package/dist/use-chart-reference-line.mjs.map +1 -0
- package/dist/use-chart-tooltip.d.mts +35 -0
- package/dist/use-chart-tooltip.d.ts +35 -0
- package/dist/use-chart-tooltip.js +121 -0
- package/dist/use-chart-tooltip.js.map +1 -0
- package/dist/use-chart-tooltip.mjs +9 -0
- package/dist/use-chart-tooltip.mjs.map +1 -0
- package/dist/use-chart.d.mts +33 -0
- package/dist/use-chart.d.ts +33 -0
- package/dist/use-chart.js +104 -0
- package/dist/use-chart.js.map +1 -0
- package/dist/use-chart.mjs +18 -0
- package/dist/use-chart.mjs.map +1 -0
- package/dist/use-line-chart.d.mts +92 -0
- package/dist/use-line-chart.d.ts +92 -0
- package/dist/use-line-chart.js +342 -0
- package/dist/use-line-chart.js.map +1 -0
- package/dist/use-line-chart.mjs +10 -0
- package/dist/use-line-chart.mjs.map +1 -0
- package/dist/use-radar-chart.d.mts +93 -0
- package/dist/use-radar-chart.d.ts +93 -0
- package/dist/use-radar-chart.js +471 -0
- package/dist/use-radar-chart.js.map +1 -0
- package/dist/use-radar-chart.mjs +10 -0
- package/dist/use-radar-chart.mjs.map +1 -0
- package/package.json +84 -0
@@ -0,0 +1,324 @@
|
|
1
|
+
"use client"
|
2
|
+
import {
|
3
|
+
areaChartProperties,
|
4
|
+
areaProperties,
|
5
|
+
dotProperties
|
6
|
+
} from "./chunk-5QCKM3B3.mjs";
|
7
|
+
import {
|
8
|
+
getComponentProps
|
9
|
+
} from "./chunk-QL3DB7OJ.mjs";
|
10
|
+
|
11
|
+
// src/use-area-chart.ts
|
12
|
+
import { useTheme } from "@yamada-ui/core";
|
13
|
+
import { cx } from "@yamada-ui/utils";
|
14
|
+
import { useCallback, useId, useMemo, useState } from "react";
|
15
|
+
var useAreaChart = ({
|
16
|
+
data,
|
17
|
+
series,
|
18
|
+
type,
|
19
|
+
layoutType = "horizontal",
|
20
|
+
withGradient: withGradientProp,
|
21
|
+
withDots = true,
|
22
|
+
withActiveDots = true,
|
23
|
+
curveType = "monotone",
|
24
|
+
strokeWidth = 2,
|
25
|
+
connectNulls = true,
|
26
|
+
fillOpacity = 0.4,
|
27
|
+
splitColors = ["#ee6a5d", "#5fce7d"],
|
28
|
+
splitOffset,
|
29
|
+
referenceLineProps,
|
30
|
+
styles,
|
31
|
+
...rest
|
32
|
+
}) => {
|
33
|
+
var _a;
|
34
|
+
const uuid = useId();
|
35
|
+
const { theme } = useTheme();
|
36
|
+
const [highlightedArea, setHighlightedArea] = useState(null);
|
37
|
+
const splitId = `${uuid}-split`;
|
38
|
+
const stacked = type === "stacked" || type === "percent";
|
39
|
+
const withGradient = typeof withGradientProp === "boolean" ? withGradientProp : type === "default";
|
40
|
+
const shouldHighlight = highlightedArea !== null;
|
41
|
+
const {
|
42
|
+
dot = {},
|
43
|
+
activeDot = {},
|
44
|
+
dimDot,
|
45
|
+
dimArea,
|
46
|
+
...computedAreaProps
|
47
|
+
} = (_a = rest.areaProps) != null ? _a : {};
|
48
|
+
const areaColors = useMemo(
|
49
|
+
() => series.map(({ color }, index) => ({
|
50
|
+
__prefix: "ui",
|
51
|
+
name: `area-${index}`,
|
52
|
+
token: "colors",
|
53
|
+
value: color != null ? color : "transparent"
|
54
|
+
})),
|
55
|
+
[series]
|
56
|
+
);
|
57
|
+
const areaSplitColors = useMemo(
|
58
|
+
() => splitColors.map((color, index) => ({
|
59
|
+
__prefix: "ui",
|
60
|
+
name: `area-split-${index}`,
|
61
|
+
token: "colors",
|
62
|
+
value: color != null ? color : "transparent"
|
63
|
+
})),
|
64
|
+
[splitColors]
|
65
|
+
);
|
66
|
+
const referenceLineColors = useMemo(
|
67
|
+
() => referenceLineProps ? referenceLineProps.map(({ color }, index) => ({
|
68
|
+
__prefix: "ui",
|
69
|
+
name: `reference-line-${index}`,
|
70
|
+
token: "colors",
|
71
|
+
value: color != null ? color : "transparent"
|
72
|
+
})) : [],
|
73
|
+
[referenceLineProps]
|
74
|
+
);
|
75
|
+
const areaVars = useMemo(() => {
|
76
|
+
return [
|
77
|
+
...areaColors,
|
78
|
+
...areaSplitColors,
|
79
|
+
...referenceLineColors,
|
80
|
+
{ __prefix: "ui", name: "fill-opacity", value: fillOpacity }
|
81
|
+
];
|
82
|
+
}, [areaColors, areaSplitColors, referenceLineColors, fillOpacity]);
|
83
|
+
const [areaChartProps, areaChartClassName] = useMemo(
|
84
|
+
() => {
|
85
|
+
var _a2;
|
86
|
+
return getComponentProps(
|
87
|
+
[(_a2 = rest.areaChartProps) != null ? _a2 : {}, areaChartProperties],
|
88
|
+
styles.chart
|
89
|
+
)(theme);
|
90
|
+
},
|
91
|
+
[rest.areaChartProps, styles.chart, theme]
|
92
|
+
);
|
93
|
+
const [areaProps, areaClassName] = useMemo(() => {
|
94
|
+
const resolvedAreaProps = {
|
95
|
+
fillOpacity: 1,
|
96
|
+
strokeOpacity: 1,
|
97
|
+
...computedAreaProps
|
98
|
+
};
|
99
|
+
return getComponentProps(
|
100
|
+
[resolvedAreaProps, areaProperties],
|
101
|
+
styles.area
|
102
|
+
)(theme);
|
103
|
+
}, [computedAreaProps, styles.area, theme]);
|
104
|
+
const [dimAreaProps, dimAreaClassName] = useMemo(() => {
|
105
|
+
const resolvedDimArea = {
|
106
|
+
fillOpacity: 0,
|
107
|
+
strokeOpacity: 0.3,
|
108
|
+
...dimArea
|
109
|
+
};
|
110
|
+
return getComponentProps([resolvedDimArea, areaProperties])(
|
111
|
+
theme
|
112
|
+
);
|
113
|
+
}, [dimArea, theme]);
|
114
|
+
const [dotProps, dotClassName] = useMemo(() => {
|
115
|
+
const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
|
116
|
+
return getComponentProps(
|
117
|
+
[resolvedDot, dotProperties],
|
118
|
+
styles.dot
|
119
|
+
)(theme);
|
120
|
+
}, [dot, styles.dot, theme]);
|
121
|
+
const [activeDotProps, activeDotClassName] = useMemo(
|
122
|
+
() => getComponentProps(
|
123
|
+
[activeDot, dotProperties],
|
124
|
+
styles.activeDot
|
125
|
+
)(theme),
|
126
|
+
[activeDot, styles.activeDot, theme]
|
127
|
+
);
|
128
|
+
const [dimDotProps, dimDotClassName] = useMemo(() => {
|
129
|
+
const resolvedDimDot = { fillOpacity: 0, strokeOpacity: 0, ...dimDot };
|
130
|
+
return getComponentProps([resolvedDimDot, dotProperties])(
|
131
|
+
theme
|
132
|
+
);
|
133
|
+
}, [dimDot, theme]);
|
134
|
+
const defaultSplitOffset = useMemo(() => {
|
135
|
+
if (series.length === 1) {
|
136
|
+
const dataKey = series[0].dataKey;
|
137
|
+
const dataMax = Math.max(...data.map((item) => item[dataKey]));
|
138
|
+
const dataMin = Math.min(...data.map((item) => item[dataKey]));
|
139
|
+
if (dataMax <= 0)
|
140
|
+
return 0;
|
141
|
+
if (dataMin >= 0)
|
142
|
+
return 1;
|
143
|
+
return dataMax / (dataMax - dataMin);
|
144
|
+
}
|
145
|
+
return 0.5;
|
146
|
+
}, [data, series]);
|
147
|
+
const areaPropsList = useMemo(
|
148
|
+
() => series.map((props, index) => {
|
149
|
+
const {
|
150
|
+
dataKey,
|
151
|
+
dot: dot2 = {},
|
152
|
+
activeDot: activeDot2 = {},
|
153
|
+
dimDot: dimDot2 = {},
|
154
|
+
dimArea: dimArea2 = {},
|
155
|
+
strokeDasharray,
|
156
|
+
...computedProps
|
157
|
+
} = props;
|
158
|
+
const id = `${uuid}-${dataKey}`;
|
159
|
+
const color = `var(--ui-area-${index})`;
|
160
|
+
const dimmed = shouldHighlight && highlightedArea !== dataKey;
|
161
|
+
const computedDimArea = { ...dimAreaProps, ...dimArea2 };
|
162
|
+
const resolvedProps = {
|
163
|
+
...areaProps,
|
164
|
+
...computedProps,
|
165
|
+
...dimmed ? computedDimArea : {}
|
166
|
+
};
|
167
|
+
const rest2 = getComponentProps(
|
168
|
+
[resolvedProps, areaProperties],
|
169
|
+
areaClassName,
|
170
|
+
dimmed ? dimAreaClassName : void 0
|
171
|
+
)(theme, true);
|
172
|
+
let resolvedActiveDot;
|
173
|
+
if (withActiveDots) {
|
174
|
+
const computedActiveDot = { ...activeDotProps, ...activeDot2 };
|
175
|
+
const [rest3, className] = getComponentProps(
|
176
|
+
[computedActiveDot, dotProperties],
|
177
|
+
activeDotClassName
|
178
|
+
)(theme);
|
179
|
+
resolvedActiveDot = {
|
180
|
+
className: cx("ui-area-chart__active-dot", className),
|
181
|
+
stroke: color,
|
182
|
+
r: 4,
|
183
|
+
...rest3
|
184
|
+
};
|
185
|
+
} else {
|
186
|
+
resolvedActiveDot = false;
|
187
|
+
}
|
188
|
+
let resolvedDot;
|
189
|
+
if (withDots) {
|
190
|
+
const computedDimDot = { ...dimDotProps, ...dimDot2 };
|
191
|
+
const computedDot = {
|
192
|
+
...dotProps,
|
193
|
+
...dot2,
|
194
|
+
...dimmed ? computedDimDot : {}
|
195
|
+
};
|
196
|
+
const [rest3, className] = getComponentProps(
|
197
|
+
[computedDot, dotProperties],
|
198
|
+
dotClassName,
|
199
|
+
dimmed ? dimDotClassName : void 0
|
200
|
+
)(theme);
|
201
|
+
resolvedDot = {
|
202
|
+
className: cx("ui-area-chart__dot", className),
|
203
|
+
fill: color,
|
204
|
+
r: 4,
|
205
|
+
...rest3
|
206
|
+
};
|
207
|
+
} else {
|
208
|
+
resolvedDot = false;
|
209
|
+
}
|
210
|
+
return {
|
211
|
+
...rest2,
|
212
|
+
id,
|
213
|
+
color,
|
214
|
+
strokeDasharray,
|
215
|
+
dataKey,
|
216
|
+
activeDot: resolvedActiveDot,
|
217
|
+
dot: resolvedDot
|
218
|
+
};
|
219
|
+
}),
|
220
|
+
[
|
221
|
+
series,
|
222
|
+
uuid,
|
223
|
+
shouldHighlight,
|
224
|
+
highlightedArea,
|
225
|
+
dimAreaProps,
|
226
|
+
dimDotProps,
|
227
|
+
areaProps,
|
228
|
+
areaClassName,
|
229
|
+
dimAreaClassName,
|
230
|
+
theme,
|
231
|
+
withActiveDots,
|
232
|
+
withDots,
|
233
|
+
activeDotProps,
|
234
|
+
activeDotClassName,
|
235
|
+
dotProps,
|
236
|
+
dotClassName,
|
237
|
+
dimDotClassName
|
238
|
+
]
|
239
|
+
);
|
240
|
+
const getAreaChartProps = useCallback(
|
241
|
+
({ className, ...props } = {}, ref = null) => ({
|
242
|
+
ref,
|
243
|
+
className: cx(className, areaChartClassName),
|
244
|
+
data,
|
245
|
+
stackOffset: type === "percent" ? "expand" : void 0,
|
246
|
+
layout: layoutType,
|
247
|
+
...props,
|
248
|
+
...areaChartProps
|
249
|
+
}),
|
250
|
+
[areaChartClassName, data, type, layoutType, areaChartProps]
|
251
|
+
);
|
252
|
+
const getAreaSplitProps = useCallback(
|
253
|
+
(props = {}) => ({
|
254
|
+
id: splitId,
|
255
|
+
offset: splitOffset != null ? splitOffset : defaultSplitOffset,
|
256
|
+
fillOpacity: "var(--ui-fill-opacity)",
|
257
|
+
...props
|
258
|
+
}),
|
259
|
+
[defaultSplitOffset, splitId, splitOffset]
|
260
|
+
);
|
261
|
+
const getAreaProps = useCallback(
|
262
|
+
({ index, className: classNameProp, ...props }, ref = null) => {
|
263
|
+
const {
|
264
|
+
id,
|
265
|
+
color,
|
266
|
+
className,
|
267
|
+
dataKey,
|
268
|
+
strokeDasharray,
|
269
|
+
activeDot: activeDot2,
|
270
|
+
dot: dot2,
|
271
|
+
...rest2
|
272
|
+
} = areaPropsList[index];
|
273
|
+
return {
|
274
|
+
ref,
|
275
|
+
className: cx(classNameProp, className),
|
276
|
+
id,
|
277
|
+
activeDot: activeDot2,
|
278
|
+
dot: dot2,
|
279
|
+
name: dataKey,
|
280
|
+
type: curveType,
|
281
|
+
dataKey,
|
282
|
+
fill: type === "split" ? `url(#${splitId})` : `url(#${id})`,
|
283
|
+
strokeWidth,
|
284
|
+
stroke: color,
|
285
|
+
isAnimationActive: false,
|
286
|
+
connectNulls,
|
287
|
+
stackId: stacked ? "stack" : void 0,
|
288
|
+
strokeDasharray,
|
289
|
+
...props,
|
290
|
+
...rest2
|
291
|
+
};
|
292
|
+
},
|
293
|
+
[
|
294
|
+
areaPropsList,
|
295
|
+
connectNulls,
|
296
|
+
curveType,
|
297
|
+
splitId,
|
298
|
+
stacked,
|
299
|
+
strokeWidth,
|
300
|
+
type
|
301
|
+
]
|
302
|
+
);
|
303
|
+
const getAreaGradientProps = useCallback(
|
304
|
+
(props = {}) => ({
|
305
|
+
withGradient,
|
306
|
+
fillOpacity: "var(--ui-fill-opacity)",
|
307
|
+
...props
|
308
|
+
}),
|
309
|
+
[withGradient]
|
310
|
+
);
|
311
|
+
return {
|
312
|
+
getAreaChartProps,
|
313
|
+
getAreaSplitProps,
|
314
|
+
getAreaProps,
|
315
|
+
getAreaGradientProps,
|
316
|
+
areaVars,
|
317
|
+
setHighlightedArea
|
318
|
+
};
|
319
|
+
};
|
320
|
+
|
321
|
+
export {
|
322
|
+
useAreaChart
|
323
|
+
};
|
324
|
+
//# sourceMappingURL=chunk-WDSR6B47.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 areaChartProps?: AreaChartProps\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 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 [areaChartProps, areaChartClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.areaChartProps ?? {}, areaChartProperties],\n styles.chart,\n )(theme),\n [rest.areaChartProps, styles.chart, theme],\n )\n\n const [areaProps, areaClassName] = useMemo(() => {\n const resolvedAreaProps = {\n fillOpacity: 1,\n strokeOpacity: 1,\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 const resolvedDimArea = {\n fillOpacity: 0,\n strokeOpacity: 0.3,\n ...dimArea,\n }\n\n return getComponentProps<Dict, string>([resolvedDimArea, areaProperties])(\n theme,\n )\n }, [dimArea, theme])\n\n const [dotProps, dotClassName] = useMemo(() => {\n const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot }\n\n return getComponentProps<Dict, string>(\n [resolvedDot, dotProperties],\n styles.dot,\n )(theme)\n }, [dot, styles.dot, theme])\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 const resolvedDimDot = { fillOpacity: 0, strokeOpacity: 0, ...dimDot }\n return getComponentProps<Dict, string>([resolvedDimDot, dotProperties])(\n theme,\n )\n }, [dimDot, theme])\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 ...props,\n ...areaChartProps,\n }),\n [areaChartClassName, data, type, layoutType, areaChartProps],\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;AA+G/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,GAAG;AACL,MAAyB;AArIzB;AAsIE,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,YAAY,CAAC;AAAA,IACb;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,KAAI,UAAK,cAAL,YAAkB,CAAC;AAEvB,QAAM,aAAgC;AAAA,IACpC,MACE,OAAO,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;AAAA,MAChC,UAAU;AAAA,MACV,MAAM,QAAQ,KAAK;AAAA,MACnB,OAAO;AAAA,MACP,OAAO,wBAAS;AAAA,IAClB,EAAE;AAAA,IACJ,CAAC,MAA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E,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"]}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use client"
|
2
|
+
import {
|
3
|
+
tooltipProperties
|
4
|
+
} from "./chunk-5QCKM3B3.mjs";
|
5
|
+
|
6
|
+
// src/use-chart-tooltip.ts
|
7
|
+
import { splitObject } from "@yamada-ui/utils";
|
8
|
+
import { useCallback, useMemo } from "react";
|
9
|
+
var useChartTooltip = ({
|
10
|
+
tooltipProps: _tooltipProps = {},
|
11
|
+
tooltipAnimationDuration = 0,
|
12
|
+
styles
|
13
|
+
}) => {
|
14
|
+
const { cursor, ...rest } = _tooltipProps;
|
15
|
+
const resolvedCursor = useMemo(
|
16
|
+
() => ({ ...styles.cursor, ...cursor }),
|
17
|
+
[cursor, styles]
|
18
|
+
);
|
19
|
+
const tooltipVars = useMemo(
|
20
|
+
() => [
|
21
|
+
{
|
22
|
+
__prefix: "ui",
|
23
|
+
name: "cursor-fill",
|
24
|
+
token: "colors",
|
25
|
+
value: resolvedCursor.fill
|
26
|
+
},
|
27
|
+
{
|
28
|
+
__prefix: "ui",
|
29
|
+
name: "cursor-stroke",
|
30
|
+
token: "colors",
|
31
|
+
value: resolvedCursor.stroke
|
32
|
+
},
|
33
|
+
{
|
34
|
+
__prefix: "ui",
|
35
|
+
name: "cursor-stroke-width",
|
36
|
+
token: "colors",
|
37
|
+
value: resolvedCursor.strokeWidth
|
38
|
+
},
|
39
|
+
{
|
40
|
+
__prefix: "ui",
|
41
|
+
name: "cursor-stroke-dasharray",
|
42
|
+
token: "colors",
|
43
|
+
value: resolvedCursor.strokeDasharray
|
44
|
+
}
|
45
|
+
],
|
46
|
+
[resolvedCursor]
|
47
|
+
);
|
48
|
+
const [tooltipProps, tooltipUIProps] = splitObject(
|
49
|
+
rest,
|
50
|
+
tooltipProperties
|
51
|
+
);
|
52
|
+
const getTooltipProps = useCallback(
|
53
|
+
(props, ref = null) => ({
|
54
|
+
ref,
|
55
|
+
animationDuration: tooltipAnimationDuration,
|
56
|
+
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
57
|
+
cursor: {
|
58
|
+
fill: "var(--ui-cursor-fill)",
|
59
|
+
stroke: "var(--ui-cursor-stroke)",
|
60
|
+
strokeWidth: "var(--ui-cursor-stroke-width)",
|
61
|
+
strokeDasharray: "var(--ui-cursor-stroke-dasharray)"
|
62
|
+
},
|
63
|
+
...props,
|
64
|
+
...tooltipProps
|
65
|
+
}),
|
66
|
+
[tooltipAnimationDuration, tooltipProps]
|
67
|
+
);
|
68
|
+
return { tooltipProps: tooltipUIProps, getTooltipProps, tooltipVars };
|
69
|
+
};
|
70
|
+
|
71
|
+
export {
|
72
|
+
useChartTooltip
|
73
|
+
};
|
74
|
+
//# sourceMappingURL=chunk-WF3BD34Y.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-chart-tooltip.ts"],"sourcesContent":["import type { CSSUIObject, CSSUIProps } from \"@yamada-ui/core\"\nimport { splitObject, type Dict } from \"@yamada-ui/utils\"\nimport { useCallback, useMemo } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport type { ChartPropGetter, TooltipProps } from \"./chart.types\"\nimport { tooltipProperties } from \"./rechart-properties\"\n\nexport type UseChartTooltipOptions = {\n /**\n * Props passed down to recharts 'Tooltip' component.\n */\n tooltipProps?: TooltipProps\n /**\n * Specifies the duration of animation, the unit of this option is ms.\n *\n * @default 0\n */\n tooltipAnimationDuration?: number\n}\n\ntype UseChartTooltipProps = UseChartTooltipOptions & {\n styles: Dict<CSSUIObject>\n}\n\nexport const useChartTooltip = ({\n tooltipProps: _tooltipProps = {},\n tooltipAnimationDuration = 0,\n styles,\n}: UseChartTooltipProps) => {\n const { cursor, ...rest } = _tooltipProps\n const resolvedCursor = useMemo(\n () => ({ ...styles.cursor, ...cursor }),\n [cursor, styles],\n )\n\n // TODO: replace `className`\n const tooltipVars: Required<CSSUIProps>[\"var\"] = useMemo(\n () =>\n [\n {\n __prefix: \"ui\",\n name: \"cursor-fill\",\n token: \"colors\",\n value: resolvedCursor.fill,\n },\n {\n __prefix: \"ui\",\n name: \"cursor-stroke\",\n token: \"colors\",\n value: resolvedCursor.stroke,\n },\n {\n __prefix: \"ui\",\n name: \"cursor-stroke-width\",\n token: \"colors\",\n value: resolvedCursor.strokeWidth,\n },\n {\n __prefix: \"ui\",\n name: \"cursor-stroke-dasharray\",\n token: \"colors\",\n value: resolvedCursor.strokeDasharray,\n },\n ] as Required<CSSUIProps>[\"var\"],\n [resolvedCursor],\n )\n\n const [tooltipProps, tooltipUIProps] = splitObject<Dict, string>(\n rest,\n tooltipProperties,\n )\n\n const getTooltipProps: ChartPropGetter<\n \"div\",\n Partial<Recharts.TooltipProps<any, any>>,\n Omit<Recharts.TooltipProps<any, any>, \"ref\">\n > = useCallback(\n (props, ref = null) => ({\n ref,\n animationDuration: tooltipAnimationDuration,\n isAnimationActive: (tooltipAnimationDuration || 0) > 0,\n cursor: {\n fill: \"var(--ui-cursor-fill)\",\n stroke: \"var(--ui-cursor-stroke)\",\n strokeWidth: \"var(--ui-cursor-stroke-width)\",\n strokeDasharray: \"var(--ui-cursor-stroke-dasharray)\",\n },\n ...props,\n ...tooltipProps,\n }),\n [tooltipAnimationDuration, tooltipProps],\n )\n\n return { tooltipProps: tooltipUIProps, getTooltipProps, tooltipVars }\n}\n"],"mappings":";;;;;;AACA,SAAS,mBAA8B;AACvC,SAAS,aAAa,eAAe;AAsB9B,IAAM,kBAAkB,CAAC;AAAA,EAC9B,cAAc,gBAAgB,CAAC;AAAA,EAC/B,2BAA2B;AAAA,EAC3B;AACF,MAA4B;AAC1B,QAAM,EAAE,QAAQ,GAAG,KAAK,IAAI;AAC5B,QAAM,iBAAiB;AAAA,IACrB,OAAO,EAAE,GAAG,OAAO,QAAQ,GAAG,OAAO;AAAA,IACrC,CAAC,QAAQ,MAAM;AAAA,EACjB;AAGA,QAAM,cAA2C;AAAA,IAC/C,MACE;AAAA,MACE;AAAA,QACE,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO,eAAe;AAAA,MACxB;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO,eAAe;AAAA,MACxB;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO,eAAe;AAAA,MACxB;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACF,CAAC,cAAc;AAAA,EACjB;AAEA,QAAM,CAAC,cAAc,cAAc,IAAI;AAAA,IACrC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,kBAIF;AAAA,IACF,CAAC,OAAO,MAAM,UAAU;AAAA,MACtB;AAAA,MACA,mBAAmB;AAAA,MACnB,oBAAoB,4BAA4B,KAAK;AAAA,MACrD,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,aAAa;AAAA,QACb,iBAAiB;AAAA,MACnB;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA,CAAC,0BAA0B,YAAY;AAAA,EACzC;AAEA,SAAO,EAAE,cAAc,gBAAgB,iBAAiB,YAAY;AACtE;","names":[]}
|
@@ -0,0 +1,204 @@
|
|
1
|
+
"use client"
|
2
|
+
import {
|
3
|
+
useRadarChart
|
4
|
+
} from "./chunk-3IBGJT6F.mjs";
|
5
|
+
import {
|
6
|
+
useChartLegend
|
7
|
+
} from "./chunk-LXZCGIND.mjs";
|
8
|
+
import {
|
9
|
+
useChartTooltip
|
10
|
+
} from "./chunk-WF3BD34Y.mjs";
|
11
|
+
import {
|
12
|
+
ChartLegend
|
13
|
+
} from "./chunk-RTTZPOUT.mjs";
|
14
|
+
import {
|
15
|
+
ChartTooltip
|
16
|
+
} from "./chunk-32BO2QEP.mjs";
|
17
|
+
import {
|
18
|
+
ChartProvider,
|
19
|
+
useChart
|
20
|
+
} from "./chunk-RXWD2EJ2.mjs";
|
21
|
+
|
22
|
+
// src/radar-chart.tsx
|
23
|
+
import {
|
24
|
+
ui,
|
25
|
+
forwardRef,
|
26
|
+
useMultiComponentStyle,
|
27
|
+
omitThemeProps
|
28
|
+
} from "@yamada-ui/core";
|
29
|
+
import { cx } from "@yamada-ui/utils";
|
30
|
+
import { useMemo } from "react";
|
31
|
+
import {
|
32
|
+
ResponsiveContainer,
|
33
|
+
RadarChart as ReChartsRadarChart,
|
34
|
+
PolarGrid,
|
35
|
+
PolarAngleAxis,
|
36
|
+
PolarRadiusAxis,
|
37
|
+
Radar,
|
38
|
+
Tooltip,
|
39
|
+
Legend
|
40
|
+
} from "recharts";
|
41
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
42
|
+
var RadarChart = forwardRef((props, ref) => {
|
43
|
+
const [styles, mergedProps] = useMultiComponentStyle("RadarChart", props);
|
44
|
+
const {
|
45
|
+
className,
|
46
|
+
data,
|
47
|
+
series,
|
48
|
+
dataKey,
|
49
|
+
radarProps,
|
50
|
+
radarChartProps,
|
51
|
+
polarGridProps,
|
52
|
+
polarAngleAxisProps,
|
53
|
+
polarRadiusAxisProps,
|
54
|
+
containerProps,
|
55
|
+
tooltipProps,
|
56
|
+
legendProps,
|
57
|
+
tooltipAnimationDuration,
|
58
|
+
unit,
|
59
|
+
valueFormatter,
|
60
|
+
withDots,
|
61
|
+
withActiveDots,
|
62
|
+
strokeWidth,
|
63
|
+
fillOpacity,
|
64
|
+
withTooltip = true,
|
65
|
+
withLegend = false,
|
66
|
+
withPolarGrid = true,
|
67
|
+
withPolarAngleAxis = true,
|
68
|
+
withPolarRadiusAxis = false,
|
69
|
+
...rest
|
70
|
+
} = omitThemeProps(mergedProps);
|
71
|
+
const {
|
72
|
+
getRadarProps,
|
73
|
+
getRadarChartProps,
|
74
|
+
getPolarGridProps,
|
75
|
+
getPolarAngleAxisProps,
|
76
|
+
getPolarRadiusAxisProps,
|
77
|
+
radarVars,
|
78
|
+
setHighlightedArea
|
79
|
+
} = useRadarChart({
|
80
|
+
data,
|
81
|
+
series,
|
82
|
+
dataKey,
|
83
|
+
radarProps,
|
84
|
+
radarChartProps,
|
85
|
+
polarGridProps,
|
86
|
+
polarAngleAxisProps,
|
87
|
+
polarRadiusAxisProps,
|
88
|
+
withDots,
|
89
|
+
withActiveDots,
|
90
|
+
strokeWidth,
|
91
|
+
fillOpacity,
|
92
|
+
valueFormatter,
|
93
|
+
styles
|
94
|
+
});
|
95
|
+
const { getContainerProps } = useChart({ containerProps });
|
96
|
+
const {
|
97
|
+
tooltipProps: computedTooltipProps,
|
98
|
+
getTooltipProps,
|
99
|
+
tooltipVars
|
100
|
+
} = useChartTooltip({
|
101
|
+
tooltipProps,
|
102
|
+
tooltipAnimationDuration,
|
103
|
+
styles
|
104
|
+
});
|
105
|
+
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
106
|
+
legendProps
|
107
|
+
});
|
108
|
+
const radars = useMemo(
|
109
|
+
() => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ jsx(
|
110
|
+
Radar,
|
111
|
+
{
|
112
|
+
...getRadarProps({ index, className: "ui-radar-chart__radar" })
|
113
|
+
},
|
114
|
+
`radar=${dataKey2}`
|
115
|
+
)),
|
116
|
+
[getRadarProps, series]
|
117
|
+
);
|
118
|
+
return /* @__PURE__ */ jsx(ChartProvider, { value: { styles }, children: /* @__PURE__ */ jsx(
|
119
|
+
ui.div,
|
120
|
+
{
|
121
|
+
ref,
|
122
|
+
className: cx("ui-radar-chart", className),
|
123
|
+
var: [...radarVars, ...tooltipVars],
|
124
|
+
__css: { maxW: "full", ...styles.container },
|
125
|
+
...rest,
|
126
|
+
children: /* @__PURE__ */ jsx(
|
127
|
+
ResponsiveContainer,
|
128
|
+
{
|
129
|
+
...getContainerProps({ className: "ui-radar-chart__container" }),
|
130
|
+
children: /* @__PURE__ */ jsxs(
|
131
|
+
ReChartsRadarChart,
|
132
|
+
{
|
133
|
+
...getRadarChartProps({ className: "ui-radar-chart__chart" }),
|
134
|
+
children: [
|
135
|
+
withPolarGrid ? /* @__PURE__ */ jsx(
|
136
|
+
PolarGrid,
|
137
|
+
{
|
138
|
+
...getPolarGridProps({
|
139
|
+
className: "ui-radar-chart__polar-grid"
|
140
|
+
})
|
141
|
+
}
|
142
|
+
) : null,
|
143
|
+
withPolarAngleAxis ? /* @__PURE__ */ jsx(
|
144
|
+
PolarAngleAxis,
|
145
|
+
{
|
146
|
+
...getPolarAngleAxisProps({
|
147
|
+
className: "ui-radar-chart__polar-angle-axis"
|
148
|
+
})
|
149
|
+
}
|
150
|
+
) : null,
|
151
|
+
withPolarRadiusAxis ? /* @__PURE__ */ jsx(
|
152
|
+
PolarRadiusAxis,
|
153
|
+
{
|
154
|
+
...getPolarRadiusAxisProps({
|
155
|
+
className: "ui-radar-chart__polar-radius-axis"
|
156
|
+
})
|
157
|
+
}
|
158
|
+
) : null,
|
159
|
+
withLegend ? /* @__PURE__ */ jsx(
|
160
|
+
Legend,
|
161
|
+
{
|
162
|
+
content: ({ payload }) => /* @__PURE__ */ jsx(
|
163
|
+
ChartLegend,
|
164
|
+
{
|
165
|
+
className: "ui-area-chart__legend",
|
166
|
+
payload,
|
167
|
+
onHighlight: setHighlightedArea,
|
168
|
+
...computedLegendProps
|
169
|
+
}
|
170
|
+
),
|
171
|
+
...getLegendProps()
|
172
|
+
}
|
173
|
+
) : null,
|
174
|
+
withTooltip ? /* @__PURE__ */ jsx(
|
175
|
+
Tooltip,
|
176
|
+
{
|
177
|
+
content: ({ label, payload }) => /* @__PURE__ */ jsx(
|
178
|
+
ChartTooltip,
|
179
|
+
{
|
180
|
+
className: "ui-line-chart__tooltip",
|
181
|
+
label,
|
182
|
+
payload,
|
183
|
+
valueFormatter,
|
184
|
+
unit,
|
185
|
+
...computedTooltipProps
|
186
|
+
}
|
187
|
+
),
|
188
|
+
...getTooltipProps()
|
189
|
+
}
|
190
|
+
) : null,
|
191
|
+
radars
|
192
|
+
]
|
193
|
+
}
|
194
|
+
)
|
195
|
+
}
|
196
|
+
)
|
197
|
+
}
|
198
|
+
) });
|
199
|
+
});
|
200
|
+
|
201
|
+
export {
|
202
|
+
RadarChart
|
203
|
+
};
|
204
|
+
//# sourceMappingURL=chunk-YBAGOHS5.mjs.map
|
@@ -0,0 +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\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 radarChartProps,\n polarGridProps,\n polarAngleAxisProps,\n polarRadiusAxisProps,\n containerProps,\n tooltipProps,\n legendProps,\n tooltipAnimationDuration,\n unit,\n valueFormatter,\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 radarChartProps,\n polarGridProps,\n polarAngleAxisProps,\n polarRadiusAxisProps,\n withDots,\n withActiveDots,\n strokeWidth,\n fillOpacity,\n valueFormatter,\n styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const {\n tooltipProps: computedTooltipProps,\n getTooltipProps,\n tooltipVars,\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, ...tooltipVars]}\n __css={{ maxW: \"full\", ...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;AAgIC,cAoBE,YApBF;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;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,GAAG;AAAA,EACL,IAAI,eAAe,WA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