@yamada-ui/charts 1.1.2-dev-20240430063353 → 1.1.2-dev-20240501174240

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.
Files changed (197) hide show
  1. package/package.json +5 -5
  2. package/dist/area-chart-gradient.d.mts +0 -11
  3. package/dist/area-chart-gradient.d.ts +0 -11
  4. package/dist/area-chart-gradient.js +0 -47
  5. package/dist/area-chart-gradient.js.map +0 -1
  6. package/dist/area-chart-gradient.mjs +0 -8
  7. package/dist/area-chart-gradient.mjs.map +0 -1
  8. package/dist/area-chart-split.d.mts +0 -10
  9. package/dist/area-chart-split.d.ts +0 -10
  10. package/dist/area-chart-split.js +0 -52
  11. package/dist/area-chart-split.js.map +0 -1
  12. package/dist/area-chart-split.mjs +0 -8
  13. package/dist/area-chart-split.mjs.map +0 -1
  14. package/dist/area-chart.d.mts +0 -41
  15. package/dist/area-chart.d.ts +0 -41
  16. package/dist/area-chart.js +0 -1223
  17. package/dist/area-chart.js.map +0 -1
  18. package/dist/area-chart.mjs +0 -21
  19. package/dist/area-chart.mjs.map +0 -1
  20. package/dist/bar-chart.d.mts +0 -38
  21. package/dist/bar-chart.d.ts +0 -38
  22. package/dist/bar-chart.js +0 -1027
  23. package/dist/bar-chart.js.map +0 -1
  24. package/dist/bar-chart.mjs +0 -19
  25. package/dist/bar-chart.mjs.map +0 -1
  26. package/dist/chart-legend.d.mts +0 -12
  27. package/dist/chart-legend.d.ts +0 -12
  28. package/dist/chart-legend.js +0 -90
  29. package/dist/chart-legend.js.map +0 -1
  30. package/dist/chart-legend.mjs +0 -11
  31. package/dist/chart-legend.mjs.map +0 -1
  32. package/dist/chart-tooltip.d.mts +0 -12
  33. package/dist/chart-tooltip.d.ts +0 -12
  34. package/dist/chart-tooltip.js +0 -121
  35. package/dist/chart-tooltip.js.map +0 -1
  36. package/dist/chart-tooltip.mjs +0 -11
  37. package/dist/chart-tooltip.mjs.map +0 -1
  38. package/dist/chart-utils.d.mts +0 -9
  39. package/dist/chart-utils.d.ts +0 -9
  40. package/dist/chart-utils.js +0 -45
  41. package/dist/chart-utils.js.map +0 -1
  42. package/dist/chart-utils.mjs +0 -10
  43. package/dist/chart-utils.mjs.map +0 -1
  44. package/dist/chart.types.d.mts +0 -78
  45. package/dist/chart.types.d.ts +0 -78
  46. package/dist/chart.types.js +0 -20
  47. package/dist/chart.types.js.map +0 -1
  48. package/dist/chart.types.mjs +0 -2
  49. package/dist/chart.types.mjs.map +0 -1
  50. package/dist/chunk-4WX5YS7M.mjs +0 -179
  51. package/dist/chunk-4WX5YS7M.mjs.map +0 -1
  52. package/dist/chunk-5TVYPA64.mjs +0 -256
  53. package/dist/chunk-5TVYPA64.mjs.map +0 -1
  54. package/dist/chunk-BPR7YL3O.mjs +0 -179
  55. package/dist/chunk-BPR7YL3O.mjs.map +0 -1
  56. package/dist/chunk-E2I2XAZ6.mjs +0 -232
  57. package/dist/chunk-E2I2XAZ6.mjs.map +0 -1
  58. package/dist/chunk-HDOYOHLA.mjs +0 -326
  59. package/dist/chunk-HDOYOHLA.mjs.map +0 -1
  60. package/dist/chunk-KNAADLWO.mjs +0 -225
  61. package/dist/chunk-KNAADLWO.mjs.map +0 -1
  62. package/dist/chunk-KT4YOMM4.mjs +0 -344
  63. package/dist/chunk-KT4YOMM4.mjs.map +0 -1
  64. package/dist/chunk-LBC2B6UX.mjs +0 -84
  65. package/dist/chunk-LBC2B6UX.mjs.map +0 -1
  66. package/dist/chunk-LGMALZCN.mjs +0 -42
  67. package/dist/chunk-LGMALZCN.mjs.map +0 -1
  68. package/dist/chunk-LHI57S6P.mjs +0 -215
  69. package/dist/chunk-LHI57S6P.mjs.map +0 -1
  70. package/dist/chunk-LM2DQK2P.mjs +0 -33
  71. package/dist/chunk-LM2DQK2P.mjs.map +0 -1
  72. package/dist/chunk-MSIOYYWR.mjs +0 -24
  73. package/dist/chunk-MSIOYYWR.mjs.map +0 -1
  74. package/dist/chunk-MWPICUEW.mjs +0 -56
  75. package/dist/chunk-MWPICUEW.mjs.map +0 -1
  76. package/dist/chunk-NEGDEVRX.mjs +0 -53
  77. package/dist/chunk-NEGDEVRX.mjs.map +0 -1
  78. package/dist/chunk-OSNFBRHL.mjs +0 -474
  79. package/dist/chunk-OSNFBRHL.mjs.map +0 -1
  80. package/dist/chunk-OW7SOTEF.mjs +0 -206
  81. package/dist/chunk-OW7SOTEF.mjs.map +0 -1
  82. package/dist/chunk-P7AFSM5W.mjs +0 -114
  83. package/dist/chunk-P7AFSM5W.mjs.map +0 -1
  84. package/dist/chunk-PNE3JG54.mjs +0 -29
  85. package/dist/chunk-PNE3JG54.mjs.map +0 -1
  86. package/dist/chunk-QL3DB7OJ.mjs +0 -21
  87. package/dist/chunk-QL3DB7OJ.mjs.map +0 -1
  88. package/dist/chunk-QZ5OXZ6Z.mjs +0 -251
  89. package/dist/chunk-QZ5OXZ6Z.mjs.map +0 -1
  90. package/dist/chunk-RN6PXJAD.mjs +0 -47
  91. package/dist/chunk-RN6PXJAD.mjs.map +0 -1
  92. package/dist/chunk-STBYRLC5.mjs +0 -208
  93. package/dist/chunk-STBYRLC5.mjs.map +0 -1
  94. package/dist/chunk-XIFDRM7J.mjs +0 -56
  95. package/dist/chunk-XIFDRM7J.mjs.map +0 -1
  96. package/dist/donut-chart.d.mts +0 -31
  97. package/dist/donut-chart.d.ts +0 -31
  98. package/dist/donut-chart.js +0 -702
  99. package/dist/donut-chart.js.map +0 -1
  100. package/dist/donut-chart.mjs +0 -16
  101. package/dist/donut-chart.mjs.map +0 -1
  102. package/dist/index.d.mts +0 -26
  103. package/dist/index.d.ts +0 -26
  104. package/dist/index.js +0 -3228
  105. package/dist/index.js.map +0 -1
  106. package/dist/index.mjs +0 -45
  107. package/dist/index.mjs.map +0 -1
  108. package/dist/line-chart.d.mts +0 -38
  109. package/dist/line-chart.d.ts +0 -38
  110. package/dist/line-chart.js +0 -1088
  111. package/dist/line-chart.js.map +0 -1
  112. package/dist/line-chart.mjs +0 -19
  113. package/dist/line-chart.mjs.map +0 -1
  114. package/dist/pie-chart.d.mts +0 -49
  115. package/dist/pie-chart.d.ts +0 -49
  116. package/dist/pie-chart.js +0 -702
  117. package/dist/pie-chart.js.map +0 -1
  118. package/dist/pie-chart.mjs +0 -16
  119. package/dist/pie-chart.mjs.map +0 -1
  120. package/dist/radar-chart.d.mts +0 -57
  121. package/dist/radar-chart.d.ts +0 -57
  122. package/dist/radar-chart.js +0 -918
  123. package/dist/radar-chart.js.map +0 -1
  124. package/dist/radar-chart.mjs +0 -16
  125. package/dist/radar-chart.mjs.map +0 -1
  126. package/dist/rechart-properties.d.mts +0 -26
  127. package/dist/rechart-properties.d.ts +0 -26
  128. package/dist/rechart-properties.js +0 -517
  129. package/dist/rechart-properties.js.map +0 -1
  130. package/dist/rechart-properties.mjs +0 -48
  131. package/dist/rechart-properties.mjs.map +0 -1
  132. package/dist/use-area-chart.d.mts +0 -123
  133. package/dist/use-area-chart.d.ts +0 -123
  134. package/dist/use-area-chart.js +0 -420
  135. package/dist/use-area-chart.js.map +0 -1
  136. package/dist/use-area-chart.mjs +0 -10
  137. package/dist/use-area-chart.mjs.map +0 -1
  138. package/dist/use-bar-chart.d.mts +0 -73
  139. package/dist/use-bar-chart.d.ts +0 -73
  140. package/dist/use-bar-chart.js +0 -290
  141. package/dist/use-bar-chart.js.map +0 -1
  142. package/dist/use-bar-chart.mjs +0 -10
  143. package/dist/use-bar-chart.mjs.map +0 -1
  144. package/dist/use-chart-axis.d.mts +0 -73
  145. package/dist/use-chart-axis.d.ts +0 -73
  146. package/dist/use-chart-axis.js +0 -227
  147. package/dist/use-chart-axis.js.map +0 -1
  148. package/dist/use-chart-axis.mjs +0 -10
  149. package/dist/use-chart-axis.mjs.map +0 -1
  150. package/dist/use-chart-grid.d.mts +0 -32
  151. package/dist/use-chart-grid.d.ts +0 -32
  152. package/dist/use-chart-grid.js +0 -92
  153. package/dist/use-chart-grid.js.map +0 -1
  154. package/dist/use-chart-grid.mjs +0 -10
  155. package/dist/use-chart-grid.mjs.map +0 -1
  156. package/dist/use-chart-legend.d.mts +0 -18
  157. package/dist/use-chart-legend.d.ts +0 -18
  158. package/dist/use-chart-legend.js +0 -81
  159. package/dist/use-chart-legend.js.map +0 -1
  160. package/dist/use-chart-legend.mjs +0 -9
  161. package/dist/use-chart-legend.mjs.map +0 -1
  162. package/dist/use-chart-reference-line.d.mts +0 -22
  163. package/dist/use-chart-reference-line.d.ts +0 -22
  164. package/dist/use-chart-reference-line.js +0 -105
  165. package/dist/use-chart-reference-line.js.map +0 -1
  166. package/dist/use-chart-reference-line.mjs +0 -10
  167. package/dist/use-chart-reference-line.mjs.map +0 -1
  168. package/dist/use-chart-tooltip.d.mts +0 -27
  169. package/dist/use-chart-tooltip.d.ts +0 -27
  170. package/dist/use-chart-tooltip.js +0 -100
  171. package/dist/use-chart-tooltip.js.map +0 -1
  172. package/dist/use-chart-tooltip.mjs +0 -10
  173. package/dist/use-chart-tooltip.mjs.map +0 -1
  174. package/dist/use-chart.d.mts +0 -33
  175. package/dist/use-chart.d.ts +0 -33
  176. package/dist/use-chart.js +0 -104
  177. package/dist/use-chart.js.map +0 -1
  178. package/dist/use-chart.mjs +0 -18
  179. package/dist/use-chart.mjs.map +0 -1
  180. package/dist/use-line-chart.d.mts +0 -97
  181. package/dist/use-line-chart.d.ts +0 -97
  182. package/dist/use-line-chart.js +0 -344
  183. package/dist/use-line-chart.js.map +0 -1
  184. package/dist/use-line-chart.mjs +0 -10
  185. package/dist/use-line-chart.mjs.map +0 -1
  186. package/dist/use-pie-chart.d.mts +0 -112
  187. package/dist/use-pie-chart.d.ts +0 -112
  188. package/dist/use-pie-chart.js +0 -282
  189. package/dist/use-pie-chart.js.map +0 -1
  190. package/dist/use-pie-chart.mjs +0 -10
  191. package/dist/use-pie-chart.mjs.map +0 -1
  192. package/dist/use-radar-chart.d.mts +0 -105
  193. package/dist/use-radar-chart.d.ts +0 -105
  194. package/dist/use-radar-chart.js +0 -473
  195. package/dist/use-radar-chart.js.map +0 -1
  196. package/dist/use-radar-chart.mjs +0 -10
  197. package/dist/use-radar-chart.mjs.map +0 -1
@@ -1,1223 +0,0 @@
1
- "use client"
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/area-chart.tsx
22
- var area_chart_exports = {};
23
- __export(area_chart_exports, {
24
- AreaChart: () => AreaChart
25
- });
26
- module.exports = __toCommonJS(area_chart_exports);
27
- var import_core10 = require("@yamada-ui/core");
28
- var import_utils11 = require("@yamada-ui/utils");
29
- var import_react8 = require("react");
30
- var import_recharts = require("recharts");
31
-
32
- // src/area-chart-gradient.tsx
33
- var import_jsx_runtime = require("react/jsx-runtime");
34
- var AreaGradient = ({
35
- color,
36
- id,
37
- withGradient,
38
- fillOpacity
39
- }) => {
40
- if (withGradient) {
41
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
42
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: fillOpacity }),
43
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: 0.01 })
44
- ] });
45
- } else {
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: color, stopOpacity: fillOpacity }) });
47
- }
48
- };
49
-
50
- // src/area-chart-split.tsx
51
- var import_jsx_runtime2 = require("react/jsx-runtime");
52
- var AreaSplit = ({ offset, id, fillOpacity }) => {
53
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
54
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
55
- "stop",
56
- {
57
- offset,
58
- stopColor: "var(--ui-area-split-0)",
59
- stopOpacity: fillOpacity != null ? fillOpacity : 0.4
60
- }
61
- ),
62
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
63
- "stop",
64
- {
65
- offset,
66
- stopColor: "var(--ui-area-split-1)",
67
- stopOpacity: fillOpacity != null ? fillOpacity : 0.4
68
- }
69
- )
70
- ] });
71
- };
72
-
73
- // src/chart-legend.tsx
74
- var import_core3 = require("@yamada-ui/core");
75
- var import_utils3 = require("@yamada-ui/utils");
76
-
77
- // src/use-chart.ts
78
- var import_core2 = require("@yamada-ui/core");
79
- var import_utils2 = require("@yamada-ui/utils");
80
- var import_react = require("react");
81
-
82
- // src/chart-utils.ts
83
- var import_core = require("@yamada-ui/core");
84
- var import_utils = require("@yamada-ui/utils");
85
- var getClassName = (...styles) => (theme) => (0, import_utils.cx)(
86
- ...styles.map(
87
- (style) => (0, import_utils.isString)(style) ? style : (0, import_core.getCSS)(style)(theme)
88
- )
89
- );
90
- var getComponentProps = ([obj, keys], ...props) => (theme, isContain) => {
91
- const [pickedProps, omittedProps] = (0, import_utils.splitObject)(obj, keys);
92
- const className = getClassName(...props, omittedProps)(theme);
93
- return !isContain ? [pickedProps, className] : { ...pickedProps, className };
94
- };
95
-
96
- // src/rechart-properties.ts
97
- var areaChartProperties = [
98
- "layout",
99
- "syncId",
100
- "syncMethod",
101
- "width",
102
- "height",
103
- "data",
104
- "margin",
105
- "stackOffset",
106
- "onClick",
107
- "onMouseEnter",
108
- "onMouseMove",
109
- "onMouseLeave"
110
- ];
111
- var referenceLineProperties = [
112
- "xAxisId",
113
- "yAxisId",
114
- "x",
115
- "y",
116
- "ifOverflow",
117
- "viewBox",
118
- "xAxis",
119
- "yAxis",
120
- "label",
121
- "isFront",
122
- "strokeWidth",
123
- "segment"
124
- ];
125
- var containerProperties = [
126
- "aspect",
127
- "width",
128
- "height",
129
- "minWidth",
130
- "minHeight",
131
- "debounce",
132
- "onResize"
133
- ];
134
- var gridProperties = [
135
- "x",
136
- "y",
137
- "width",
138
- "height",
139
- "horizontal",
140
- "vertical",
141
- "horizontalPoints",
142
- "horizontalCoordinatesGenerator",
143
- "verticalPoints",
144
- "verticalCoordinatesGenerator",
145
- "fill",
146
- "fillOpacity",
147
- "strokeDasharray"
148
- ];
149
- var xAxisProperties = [
150
- "hide",
151
- "dataKey",
152
- "xAxisId",
153
- "width",
154
- "height",
155
- "orientation",
156
- "type",
157
- "allowDecimals",
158
- "allowDataOverflow",
159
- "allowDuplicatedCategory",
160
- "angle",
161
- "tickCount",
162
- "domain",
163
- "includeHidden",
164
- "interval",
165
- "padding",
166
- "minTickGap",
167
- "axisLine",
168
- "tickLine",
169
- "tickSize",
170
- "tickFormatter",
171
- "ticks",
172
- "tick",
173
- "mirror",
174
- "reversed",
175
- "label",
176
- "scale",
177
- "unit",
178
- "name",
179
- "onClick",
180
- "onMouseDown",
181
- "onMouseUp",
182
- "onMouseMove",
183
- "onMouseOver",
184
- "onMouseOut",
185
- "onMouseEnter",
186
- "onMouseLeave",
187
- "tickMargin"
188
- ];
189
- var yAxisProperties = [
190
- "hide",
191
- "dataKey",
192
- "yAxisId",
193
- "width",
194
- "height",
195
- "orientation",
196
- "type",
197
- "tickCount",
198
- "domain",
199
- "includeHidden",
200
- "interval",
201
- "padding",
202
- "minTickGap",
203
- "allowDecimals",
204
- "allowDataOverflow",
205
- "allowDuplicatedCategory",
206
- "axisLine",
207
- "tickLine",
208
- "tickSize",
209
- "tickFormatter",
210
- "ticks",
211
- "tick",
212
- "mirror",
213
- "reversed",
214
- "label",
215
- "scale",
216
- "unit",
217
- "name",
218
- "onClick",
219
- "onMouseDown",
220
- "onMouseUp",
221
- "onMouseMove",
222
- "onMouseOver",
223
- "onMouseOut",
224
- "onMouseEnter",
225
- "onMouseLeave",
226
- "tickMargin"
227
- ];
228
- var legendProperties = [
229
- "width",
230
- "height",
231
- "layout",
232
- "align",
233
- "verticalAlign",
234
- "iconSize",
235
- "iconType",
236
- "payload",
237
- "chartWidth",
238
- "chartHeight",
239
- "margin",
240
- "content",
241
- "formatter",
242
- "wrapperStyle",
243
- "onClick",
244
- "onMouseDown",
245
- "onMouseUp",
246
- "onMouseMove",
247
- "onMouseOver",
248
- "onMouseOut",
249
- "onMouseEnter",
250
- "onMouseLeave"
251
- ];
252
- var tooltipProperties = [
253
- "offset",
254
- "filterNull",
255
- "itemStyle",
256
- "wrapperStyle",
257
- "contentStyle",
258
- "labelStyle",
259
- "cursor",
260
- "viewBox",
261
- "allowEscapeViewBox",
262
- "active",
263
- "position",
264
- "coordinate",
265
- "payload",
266
- "label",
267
- "content",
268
- "formatter",
269
- "labelFormatter",
270
- "itemSorter",
271
- "isAnimationActive",
272
- "animationDuration",
273
- "animationEasing"
274
- ];
275
- var areaProperties = [
276
- "type",
277
- "dataKey",
278
- "xAxisId",
279
- "yAxisId",
280
- "legendType",
281
- "dot",
282
- "activeDot",
283
- "label",
284
- "stroke",
285
- "strokeWidth",
286
- "layout",
287
- "baseLine",
288
- "points",
289
- "stackId",
290
- "connectNulls",
291
- "unit",
292
- "name",
293
- "isAnimationActive",
294
- "animationBegin",
295
- "animationDuration",
296
- "animationEasing",
297
- "id",
298
- "onAnimationStart",
299
- "onAnimationEnd",
300
- "onClick",
301
- "onMouseDown",
302
- "onMouseUp",
303
- "onMouseMove",
304
- "onMouseOver",
305
- "onMouseOut",
306
- "onMouseEnter",
307
- "onMouseLeave"
308
- ];
309
- var dotProperties = [
310
- "cx",
311
- "cy",
312
- "r",
313
- "onClick",
314
- "onMouseDown",
315
- "onMouseUp",
316
- "onMouseMove",
317
- "onMouseOver",
318
- "onMouseOut",
319
- "onMouseEnter",
320
- "onMouseLeave"
321
- ];
322
-
323
- // src/use-chart.ts
324
- var [ChartProvider, useChartContext] = (0, import_utils2.createContext)({
325
- name: "ChartContext",
326
- errorMessage: `useChartContext returned is 'undefined'. Seems you forgot to wrap the components in "<LineChart />" or "<BarChart />" etc.`
327
- });
328
- var useChart = ({ containerProps = {} }) => {
329
- const { theme } = (0, import_core2.useTheme)();
330
- const [reChartsProps, propClassName] = getComponentProps([
331
- containerProps,
332
- containerProperties
333
- ])(theme);
334
- const getContainerProps = (0, import_react.useCallback)(
335
- ({ className, ...props } = {}, ref = null) => ({
336
- ref,
337
- className: (0, import_utils2.cx)("ui-chart__container", className, propClassName),
338
- ...props,
339
- ...reChartsProps
340
- }),
341
- [propClassName, reChartsProps]
342
- );
343
- return {
344
- getContainerProps
345
- };
346
- };
347
- var useLegend = ({} = {}) => {
348
- const { styles } = useChartContext();
349
- return {
350
- styles
351
- };
352
- };
353
- var useTooltip = ({} = {}) => {
354
- const { styles } = useChartContext();
355
- return {
356
- styles
357
- };
358
- };
359
-
360
- // src/chart-legend.tsx
361
- var import_jsx_runtime3 = require("react/jsx-runtime");
362
- var ChartLegend = (0, import_core3.forwardRef)(
363
- ({ className, payload = [], onHighlight, ...rest }, ref) => {
364
- const { styles } = useLegend();
365
- const items = payload.map(({ dataKey, value: valueProp, color }, index) => {
366
- const value = dataKey != null ? dataKey : valueProp;
367
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
368
- import_core3.ui.div,
369
- {
370
- className: "ui-chart__legend-item",
371
- onMouseEnter: () => onHighlight(value),
372
- onMouseLeave: () => onHighlight(null),
373
- __css: styles.legendItem,
374
- children: [
375
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
376
- import_core3.ui.div,
377
- {
378
- className: "ui-chart__legend-swatch",
379
- background: color,
380
- __css: styles.legendSwatch
381
- }
382
- ),
383
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.span, { className: "ui-chart__legend-label", children: value })
384
- ]
385
- },
386
- `legend-${index}`
387
- );
388
- });
389
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
390
- import_core3.ui.div,
391
- {
392
- ref,
393
- className: (0, import_utils3.cx)("ui-chart__legend", className),
394
- __css: styles.legend,
395
- ...rest,
396
- children: items
397
- }
398
- );
399
- }
400
- );
401
-
402
- // src/chart-tooltip.tsx
403
- var import_core4 = require("@yamada-ui/core");
404
- var import_utils4 = require("@yamada-ui/utils");
405
- var import_jsx_runtime4 = require("react/jsx-runtime");
406
- var ChartTooltip = (0, import_core4.forwardRef)(
407
- ({ label, className, payload = [], valueFormatter, unit, ...rest }, ref) => {
408
- const { styles } = useTooltip();
409
- const items = payload.map(
410
- ({ color: colorProp, name, value: valueProp, payload: payload2 } = {}, index) => {
411
- var _a;
412
- const color = colorProp != null ? colorProp : payload2 == null ? void 0 : payload2.color;
413
- let value;
414
- if ((0, import_utils4.isArray)(valueProp)) {
415
- value = valueProp.map((value2) => {
416
- var _a2;
417
- return `${(_a2 = valueFormatter == null ? void 0 : valueFormatter(value2)) != null ? _a2 : value2}`;
418
- }).join(" - ");
419
- } else {
420
- value = (_a = valueFormatter == null ? void 0 : valueFormatter(valueProp)) != null ? _a : valueProp;
421
- }
422
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
423
- import_core4.ui.div,
424
- {
425
- className: "ui-chart__tooltip-item",
426
- __css: styles.tooltipItem,
427
- children: [
428
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
429
- import_core4.ui.div,
430
- {
431
- className: "ui-chart__tooltip-swatch",
432
- background: color,
433
- __css: styles.tooltipSwatch
434
- }
435
- ),
436
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
437
- import_core4.ui.span,
438
- {
439
- className: "ui-chart__tooltip-label",
440
- __css: styles.tooltipLabel,
441
- children: name
442
- }
443
- ),
444
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
445
- import_core4.ui.span,
446
- {
447
- className: "ui-chart__tooltip-value",
448
- __css: styles.tooltipValue,
449
- children: [
450
- value,
451
- unit ? unit : ""
452
- ]
453
- }
454
- )
455
- ]
456
- },
457
- `tooltip-payload-${index}`
458
- );
459
- }
460
- );
461
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
462
- import_core4.ui.div,
463
- {
464
- ref,
465
- className: (0, import_utils4.cx)("ui-chart__tooltip", className),
466
- __css: styles.tooltip,
467
- ...rest,
468
- children: [
469
- label ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.ui.p, { className: "ui-chart__tooltip-title", __css: styles.tooltipTitle, children: label }) : null,
470
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.ui.div, { className: "ui-chart__tooltip-list", __css: styles.tooltipList, children: items })
471
- ]
472
- }
473
- );
474
- }
475
- );
476
-
477
- // src/use-area-chart.ts
478
- var import_core5 = require("@yamada-ui/core");
479
- var import_utils5 = require("@yamada-ui/utils");
480
- var import_react2 = require("react");
481
- var useAreaChart = ({
482
- data,
483
- series,
484
- type,
485
- layoutType = "horizontal",
486
- withGradient: withGradientProp,
487
- withDots = true,
488
- withActiveDots = true,
489
- curveType = "monotone",
490
- strokeWidth = 2,
491
- connectNulls = true,
492
- fillOpacity = 0.4,
493
- splitColors = ["#ee6a5d", "#5fce7d"],
494
- splitOffset,
495
- referenceLineProps,
496
- syncId,
497
- styles,
498
- ...rest
499
- }) => {
500
- var _a;
501
- const uuid = (0, import_react2.useId)();
502
- const { theme } = (0, import_core5.useTheme)();
503
- const [highlightedArea, setHighlightedArea] = (0, import_react2.useState)(null);
504
- const splitId = `${uuid}-split`;
505
- const stacked = type === "stacked" || type === "percent";
506
- const withGradient = typeof withGradientProp === "boolean" ? withGradientProp : type === "default";
507
- const shouldHighlight = highlightedArea !== null;
508
- const {
509
- dot = {},
510
- activeDot = {},
511
- dimDot,
512
- dimArea,
513
- ...computedAreaProps
514
- } = (_a = rest.areaProps) != null ? _a : {};
515
- const areaColors = (0, import_react2.useMemo)(
516
- () => series.map(({ color }, index) => ({
517
- __prefix: "ui",
518
- name: `area-${index}`,
519
- token: "colors",
520
- value: color != null ? color : "transparent"
521
- })),
522
- [series]
523
- );
524
- const areaSplitColors = (0, import_react2.useMemo)(
525
- () => splitColors.map((color, index) => ({
526
- __prefix: "ui",
527
- name: `area-split-${index}`,
528
- token: "colors",
529
- value: color != null ? color : "transparent"
530
- })),
531
- [splitColors]
532
- );
533
- const referenceLineColors = (0, import_react2.useMemo)(
534
- () => referenceLineProps ? referenceLineProps.map(({ color }, index) => ({
535
- __prefix: "ui",
536
- name: `reference-line-${index}`,
537
- token: "colors",
538
- value: color != null ? color : "transparent"
539
- })) : [],
540
- [referenceLineProps]
541
- );
542
- const areaVars = (0, import_react2.useMemo)(() => {
543
- return [
544
- ...areaColors,
545
- ...areaSplitColors,
546
- ...referenceLineColors,
547
- { __prefix: "ui", name: "fill-opacity", value: fillOpacity }
548
- ];
549
- }, [areaColors, areaSplitColors, referenceLineColors, fillOpacity]);
550
- const [chartProps, areaChartClassName] = (0, import_react2.useMemo)(
551
- () => {
552
- var _a2;
553
- return getComponentProps(
554
- [(_a2 = rest.chartProps) != null ? _a2 : {}, areaChartProperties],
555
- styles.chart
556
- )(theme);
557
- },
558
- [rest.chartProps, styles.chart, theme]
559
- );
560
- const [areaProps, areaClassName] = (0, import_react2.useMemo)(() => {
561
- const resolvedAreaProps = {
562
- fillOpacity: 1,
563
- strokeOpacity: 1,
564
- ...computedAreaProps
565
- };
566
- return getComponentProps(
567
- [resolvedAreaProps, areaProperties],
568
- styles.area
569
- )(theme);
570
- }, [computedAreaProps, styles.area, theme]);
571
- const [dimAreaProps, dimAreaClassName] = (0, import_react2.useMemo)(() => {
572
- const resolvedDimArea = {
573
- fillOpacity: 0,
574
- strokeOpacity: 0.3,
575
- ...dimArea
576
- };
577
- return getComponentProps([resolvedDimArea, areaProperties])(
578
- theme
579
- );
580
- }, [dimArea, theme]);
581
- const [dotProps, dotClassName] = (0, import_react2.useMemo)(() => {
582
- const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
583
- return getComponentProps(
584
- [resolvedDot, dotProperties],
585
- styles.dot
586
- )(theme);
587
- }, [dot, styles.dot, theme]);
588
- const [activeDotProps, activeDotClassName] = (0, import_react2.useMemo)(
589
- () => getComponentProps(
590
- [activeDot, dotProperties],
591
- styles.activeDot
592
- )(theme),
593
- [activeDot, styles.activeDot, theme]
594
- );
595
- const [dimDotProps, dimDotClassName] = (0, import_react2.useMemo)(() => {
596
- const resolvedDimDot = { fillOpacity: 0, strokeOpacity: 0, ...dimDot };
597
- return getComponentProps([resolvedDimDot, dotProperties])(
598
- theme
599
- );
600
- }, [dimDot, theme]);
601
- const defaultSplitOffset = (0, import_react2.useMemo)(() => {
602
- if (series.length === 1) {
603
- const dataKey = series[0].dataKey;
604
- const dataMax = Math.max(...data.map((item) => item[dataKey]));
605
- const dataMin = Math.min(...data.map((item) => item[dataKey]));
606
- if (dataMax <= 0)
607
- return 0;
608
- if (dataMin >= 0)
609
- return 1;
610
- return dataMax / (dataMax - dataMin);
611
- }
612
- return 0.5;
613
- }, [data, series]);
614
- const areaPropsList = (0, import_react2.useMemo)(
615
- () => series.map((props, index) => {
616
- const {
617
- dataKey,
618
- dot: dot2 = {},
619
- activeDot: activeDot2 = {},
620
- dimDot: dimDot2 = {},
621
- dimArea: dimArea2 = {},
622
- strokeDasharray,
623
- ...computedProps
624
- } = props;
625
- const id = `${uuid}-${dataKey}`;
626
- const color = `var(--ui-area-${index})`;
627
- const dimmed = shouldHighlight && highlightedArea !== dataKey;
628
- const computedDimArea = { ...dimAreaProps, ...dimArea2 };
629
- const resolvedProps = {
630
- ...areaProps,
631
- ...computedProps,
632
- ...dimmed ? computedDimArea : {}
633
- };
634
- const rest2 = getComponentProps(
635
- [resolvedProps, areaProperties],
636
- areaClassName,
637
- dimmed ? dimAreaClassName : void 0
638
- )(theme, true);
639
- let resolvedActiveDot;
640
- if (withActiveDots) {
641
- const computedActiveDot = { ...activeDotProps, ...activeDot2 };
642
- const [rest3, className] = getComponentProps(
643
- [computedActiveDot, dotProperties],
644
- activeDotClassName
645
- )(theme);
646
- resolvedActiveDot = {
647
- className: (0, import_utils5.cx)("ui-area-chart__active-dot", className),
648
- stroke: color,
649
- r: 4,
650
- ...rest3
651
- };
652
- } else {
653
- resolvedActiveDot = false;
654
- }
655
- let resolvedDot;
656
- if (withDots) {
657
- const computedDimDot = { ...dimDotProps, ...dimDot2 };
658
- const computedDot = {
659
- ...dotProps,
660
- ...dot2,
661
- ...dimmed ? computedDimDot : {}
662
- };
663
- const [rest3, className] = getComponentProps(
664
- [computedDot, dotProperties],
665
- dotClassName,
666
- dimmed ? dimDotClassName : void 0
667
- )(theme);
668
- resolvedDot = {
669
- className: (0, import_utils5.cx)("ui-area-chart__dot", className),
670
- fill: color,
671
- r: 4,
672
- ...rest3
673
- };
674
- } else {
675
- resolvedDot = false;
676
- }
677
- return {
678
- ...rest2,
679
- id,
680
- color,
681
- strokeDasharray,
682
- dataKey,
683
- activeDot: resolvedActiveDot,
684
- dot: resolvedDot
685
- };
686
- }),
687
- [
688
- series,
689
- uuid,
690
- shouldHighlight,
691
- highlightedArea,
692
- dimAreaProps,
693
- dimDotProps,
694
- areaProps,
695
- areaClassName,
696
- dimAreaClassName,
697
- theme,
698
- withActiveDots,
699
- withDots,
700
- activeDotProps,
701
- activeDotClassName,
702
- dotProps,
703
- dotClassName,
704
- dimDotClassName
705
- ]
706
- );
707
- const getAreaChartProps = (0, import_react2.useCallback)(
708
- ({ className, ...props } = {}, ref = null) => ({
709
- ref,
710
- className: (0, import_utils5.cx)(className, areaChartClassName),
711
- data,
712
- stackOffset: type === "percent" ? "expand" : void 0,
713
- layout: layoutType,
714
- syncId,
715
- ...props,
716
- ...chartProps
717
- }),
718
- [areaChartClassName, data, type, layoutType, syncId, chartProps]
719
- );
720
- const getAreaSplitProps = (0, import_react2.useCallback)(
721
- (props = {}) => ({
722
- id: splitId,
723
- offset: splitOffset != null ? splitOffset : defaultSplitOffset,
724
- fillOpacity: "var(--ui-fill-opacity)",
725
- ...props
726
- }),
727
- [defaultSplitOffset, splitId, splitOffset]
728
- );
729
- const getAreaProps = (0, import_react2.useCallback)(
730
- ({ index, className: classNameProp, ...props }, ref = null) => {
731
- const {
732
- id,
733
- color,
734
- className,
735
- dataKey,
736
- strokeDasharray,
737
- activeDot: activeDot2,
738
- dot: dot2,
739
- ...rest2
740
- } = areaPropsList[index];
741
- return {
742
- ref,
743
- className: (0, import_utils5.cx)(classNameProp, className),
744
- id,
745
- activeDot: activeDot2,
746
- dot: dot2,
747
- name: dataKey,
748
- type: curveType,
749
- dataKey,
750
- fill: type === "split" ? `url(#${splitId})` : `url(#${id})`,
751
- strokeWidth,
752
- stroke: color,
753
- isAnimationActive: false,
754
- connectNulls,
755
- stackId: stacked ? "stack" : void 0,
756
- strokeDasharray,
757
- ...props,
758
- ...rest2
759
- };
760
- },
761
- [
762
- areaPropsList,
763
- connectNulls,
764
- curveType,
765
- splitId,
766
- stacked,
767
- strokeWidth,
768
- type
769
- ]
770
- );
771
- const getAreaGradientProps = (0, import_react2.useCallback)(
772
- (props = {}) => ({
773
- withGradient,
774
- fillOpacity: "var(--ui-fill-opacity)",
775
- ...props
776
- }),
777
- [withGradient]
778
- );
779
- return {
780
- getAreaChartProps,
781
- getAreaSplitProps,
782
- getAreaProps,
783
- getAreaGradientProps,
784
- areaVars,
785
- setHighlightedArea
786
- };
787
- };
788
-
789
- // src/use-chart-axis.ts
790
- var import_core6 = require("@yamada-ui/core");
791
- var import_utils6 = require("@yamada-ui/utils");
792
- var import_react3 = require("react");
793
- var useChartAxis = ({
794
- dataKey,
795
- type,
796
- layoutType = "horizontal",
797
- tickLine = "y",
798
- gridAxis = "x",
799
- withXAxis = true,
800
- withYAxis = true,
801
- xAxisProps: _xAxisProps = {},
802
- yAxisProps: _yAxisProps = {},
803
- unit,
804
- valueFormatter,
805
- styles
806
- }) => {
807
- const { theme } = (0, import_core6.useTheme)();
808
- const xAxisKey = (0, import_react3.useMemo)(
809
- () => layoutType === "vertical" ? { type: "number" } : { dataKey },
810
- [dataKey, layoutType]
811
- );
812
- const yAxisKey = (0, import_react3.useMemo)(
813
- () => layoutType === "vertical" ? { dataKey, type: "category" } : { type: "number" },
814
- [dataKey, layoutType]
815
- );
816
- const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
817
- const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
818
- const getTickLine = (withTickLine) => withTickLine ? { stroke: "currentColor" } : false;
819
- const xTickLine = getTickLine(withXTickLine);
820
- const yTickLine = getTickLine(withYTickLine);
821
- const yAxisTickFormatter = type === "percent" && layoutType !== "vertical" ? valueToPercent : valueFormatter;
822
- const xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : valueFormatter;
823
- const [xAxisReChartsProps, xAxisClassName] = getComponentProps(
824
- [_xAxisProps, xAxisProperties],
825
- styles.xAxis
826
- )(theme);
827
- const [yAxisReChartsProps, yAxisClassName] = getComponentProps(
828
- [_yAxisProps, yAxisProperties],
829
- styles.yAxis
830
- )(theme);
831
- const getXAxisProps = (0, import_react3.useCallback)(
832
- ({ className, ...props } = {}) => ({
833
- className: (0, import_utils6.cx)(className, xAxisClassName),
834
- hide: !withXAxis,
835
- ...xAxisKey,
836
- tick: {
837
- transform: "translate(0, 10)",
838
- fill: "currentColor"
839
- },
840
- stroke: "",
841
- interval: "preserveStartEnd",
842
- tickLine: xTickLine,
843
- minTickGap: 5,
844
- tickFormatter: xAxisTickFormatter,
845
- ...props,
846
- ...xAxisReChartsProps
847
- }),
848
- [
849
- xAxisClassName,
850
- withXAxis,
851
- xAxisKey,
852
- xTickLine,
853
- xAxisTickFormatter,
854
- xAxisReChartsProps
855
- ]
856
- );
857
- const getYAxisProps = (0, import_react3.useCallback)(
858
- ({ className, ...props } = {}) => ({
859
- className: (0, import_utils6.cx)(className, yAxisClassName),
860
- hide: !withYAxis,
861
- axisLine: false,
862
- ...yAxisKey,
863
- tickLine: yTickLine,
864
- tick: {
865
- transform: "translate(-10, 0)",
866
- fill: "currentColor"
867
- },
868
- allowDecimals: true,
869
- unit,
870
- tickFormatter: yAxisTickFormatter,
871
- ...props,
872
- ...yAxisReChartsProps
873
- }),
874
- [
875
- yAxisClassName,
876
- withYAxis,
877
- yAxisKey,
878
- yTickLine,
879
- unit,
880
- yAxisTickFormatter,
881
- yAxisReChartsProps
882
- ]
883
- );
884
- return { getXAxisProps, getYAxisProps };
885
- };
886
- var valueToPercent = (value) => {
887
- return `${(value * 100).toFixed(0)}%`;
888
- };
889
-
890
- // src/use-chart-grid.ts
891
- var import_core7 = require("@yamada-ui/core");
892
- var import_utils7 = require("@yamada-ui/utils");
893
- var import_react4 = require("react");
894
- var useChartGrid = ({
895
- gridProps = {},
896
- gridAxis = "x",
897
- strokeDasharray = "5 5",
898
- styles
899
- }) => {
900
- const { theme } = (0, import_core7.useTheme)();
901
- const [reChartsProps, propClassName] = getComponentProps(
902
- [gridProps, gridProperties],
903
- styles.grid
904
- )(theme);
905
- const getGridProps = (0, import_react4.useCallback)(
906
- ({ className, ...props } = {}, ref = null) => ({
907
- ref,
908
- className: (0, import_utils7.cx)("ui-chart__grid", className, propClassName),
909
- strokeDasharray,
910
- vertical: gridAxis === "y" || gridAxis === "xy",
911
- horizontal: gridAxis === "x" || gridAxis === "xy",
912
- ...props,
913
- ...reChartsProps
914
- }),
915
- [propClassName, strokeDasharray, gridAxis, reChartsProps]
916
- );
917
- return { getGridProps };
918
- };
919
-
920
- // src/use-chart-legend.ts
921
- var import_utils8 = require("@yamada-ui/utils");
922
- var import_react5 = require("react");
923
- var useChartLegend = ({
924
- legendProps: _legendProps = {}
925
- }) => {
926
- const [rest, legendProps] = (0, import_utils8.splitObject)(
927
- _legendProps,
928
- legendProperties
929
- );
930
- const getLegendProps = (0, import_react5.useCallback)(
931
- (props, ref = null) => {
932
- return {
933
- ref,
934
- verticalAlign: "top",
935
- ...props,
936
- ...rest
937
- };
938
- },
939
- [rest]
940
- );
941
- return { legendProps, getLegendProps };
942
- };
943
-
944
- // src/use-chart-reference-line.ts
945
- var import_core8 = require("@yamada-ui/core");
946
- var import_utils9 = require("@yamada-ui/utils");
947
- var import_react6 = require("react");
948
- var useChartReferenceLine = ({
949
- referenceLineProps = [],
950
- styles
951
- }) => {
952
- const { theme } = (0, import_core8.useTheme)();
953
- const styleClassName = (0, import_core8.getCSS)(styles.referenceLine)(theme);
954
- const propList = (0, import_react6.useMemo)(
955
- () => referenceLineProps.map((props, index) => {
956
- const [{ label: labelProp, ...rest }, propClassName] = getComponentProps(
957
- [props, referenceLineProperties],
958
- styleClassName
959
- )(theme);
960
- const color = `var(--ui-reference-line-${index})`;
961
- const label = {
962
- value: labelProp,
963
- fill: color,
964
- position: "insideBottomLeft",
965
- ...(0, import_utils9.isObject)(labelProp) ? labelProp : {}
966
- };
967
- return { propClassName, color, label, ...rest };
968
- }),
969
- [referenceLineProps, styleClassName, theme]
970
- );
971
- const getReferenceLineProps = (0, import_react6.useCallback)(
972
- ({ index, className, ...props }, ref = null) => {
973
- const { propClassName, color, label, ...rest } = propList[index];
974
- return {
975
- ref,
976
- className: (0, import_utils9.cx)(className, propClassName),
977
- stroke: color,
978
- label,
979
- ...props,
980
- ...rest
981
- };
982
- },
983
- [propList]
984
- );
985
- return { getReferenceLineProps };
986
- };
987
-
988
- // src/use-chart-tooltip.ts
989
- var import_core9 = require("@yamada-ui/core");
990
- var import_utils10 = require("@yamada-ui/utils");
991
- var import_react7 = require("react");
992
- var useChartTooltip = ({
993
- tooltipProps: _tooltipProps = {},
994
- tooltipAnimationDuration = 0,
995
- styles
996
- }) => {
997
- const { theme } = (0, import_core9.useTheme)();
998
- const { cursor, ...rest } = _tooltipProps;
999
- const cursorClassName = (0, import_react7.useMemo)(
1000
- () => getClassName({ ...styles.cursor, ...cursor })(theme),
1001
- [cursor, styles.cursor, theme]
1002
- );
1003
- const [tooltipProps, tooltipUIProps] = (0, import_utils10.splitObject)(
1004
- rest,
1005
- tooltipProperties
1006
- );
1007
- const getTooltipProps = (0, import_react7.useCallback)(
1008
- (props, ref = null) => ({
1009
- ref,
1010
- animationDuration: tooltipAnimationDuration,
1011
- isAnimationActive: (tooltipAnimationDuration || 0) > 0,
1012
- cursor: {
1013
- className: (0, import_utils10.cx)("ui-chart__cursor", cursorClassName)
1014
- },
1015
- ...props,
1016
- ...tooltipProps
1017
- }),
1018
- [cursorClassName, tooltipAnimationDuration, tooltipProps]
1019
- );
1020
- return { tooltipProps: tooltipUIProps, getTooltipProps };
1021
- };
1022
-
1023
- // src/area-chart.tsx
1024
- var import_jsx_runtime5 = require("react/jsx-runtime");
1025
- var AreaChart = (0, import_core10.forwardRef)((props, ref) => {
1026
- const [styles, mergedProps] = (0, import_core10.useMultiComponentStyle)("AreaChart", props);
1027
- const {
1028
- className,
1029
- series,
1030
- dataKey,
1031
- layoutType,
1032
- tickLine,
1033
- gridAxis,
1034
- withXAxis,
1035
- withYAxis,
1036
- xAxisProps,
1037
- yAxisProps,
1038
- type = "default",
1039
- withTooltip = true,
1040
- withLegend = false,
1041
- referenceLineProps = [],
1042
- containerProps,
1043
- unit,
1044
- gridProps,
1045
- strokeDasharray,
1046
- valueFormatter,
1047
- tooltipProps,
1048
- tooltipAnimationDuration,
1049
- legendProps,
1050
- data,
1051
- chartProps,
1052
- areaProps,
1053
- withGradient,
1054
- withDots,
1055
- withActiveDots,
1056
- curveType,
1057
- strokeWidth,
1058
- connectNulls,
1059
- fillOpacity,
1060
- splitColors,
1061
- splitOffset,
1062
- syncId,
1063
- ...rest
1064
- } = (0, import_core10.omitThemeProps)(mergedProps);
1065
- const {
1066
- getAreaChartProps,
1067
- getAreaSplitProps,
1068
- getAreaProps,
1069
- getAreaGradientProps,
1070
- areaVars,
1071
- setHighlightedArea
1072
- } = useAreaChart({
1073
- layoutType,
1074
- type,
1075
- series,
1076
- referenceLineProps,
1077
- data,
1078
- chartProps,
1079
- areaProps,
1080
- withGradient,
1081
- withDots,
1082
- withActiveDots,
1083
- curveType,
1084
- strokeWidth,
1085
- connectNulls,
1086
- fillOpacity,
1087
- splitColors,
1088
- splitOffset,
1089
- syncId,
1090
- styles
1091
- });
1092
- const { getContainerProps } = useChart({ containerProps });
1093
- const { getXAxisProps, getYAxisProps } = useChartAxis({
1094
- dataKey,
1095
- type,
1096
- layoutType,
1097
- tickLine,
1098
- gridAxis,
1099
- withXAxis,
1100
- withYAxis,
1101
- xAxisProps,
1102
- yAxisProps,
1103
- unit,
1104
- valueFormatter,
1105
- styles
1106
- });
1107
- const { getReferenceLineProps } = useChartReferenceLine({
1108
- referenceLineProps,
1109
- styles
1110
- });
1111
- const { getGridProps } = useChartGrid({
1112
- gridProps,
1113
- gridAxis,
1114
- strokeDasharray,
1115
- styles
1116
- });
1117
- const { tooltipProps: computedTooltipProps, getTooltipProps } = useChartTooltip({
1118
- tooltipProps,
1119
- tooltipAnimationDuration,
1120
- styles
1121
- });
1122
- const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
1123
- legendProps
1124
- });
1125
- const areas = (0, import_react8.useMemo)(
1126
- () => series.map(({ dataKey: dataKey2 }, index) => {
1127
- const { id, stroke, ...rest2 } = getAreaProps({
1128
- index,
1129
- className: "ui-area-chart__area"
1130
- });
1131
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react8.Fragment, { children: [
1132
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AreaGradient, { ...getAreaGradientProps({ id, color: stroke }) }) }),
1133
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_recharts.Area, { id, stroke, ...rest2 })
1134
- ] }, `area-${dataKey2}`);
1135
- }),
1136
- [getAreaGradientProps, getAreaProps, series]
1137
- );
1138
- const referenceLinesItems = (0, import_react8.useMemo)(
1139
- () => referenceLineProps.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1140
- import_recharts.ReferenceLine,
1141
- {
1142
- ...getReferenceLineProps({
1143
- index,
1144
- className: "ui-area-chart__reference-line"
1145
- })
1146
- },
1147
- `referenceLine-${index}`
1148
- )),
1149
- [getReferenceLineProps, referenceLineProps]
1150
- );
1151
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1152
- import_core10.ui.div,
1153
- {
1154
- ref,
1155
- className: (0, import_utils11.cx)("ui-area-chart", className),
1156
- var: areaVars,
1157
- __css: { maxW: "full", ...styles.container },
1158
- ...rest,
1159
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1160
- import_recharts.ResponsiveContainer,
1161
- {
1162
- ...getContainerProps({ className: "ui-area-chart__container" }),
1163
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1164
- import_recharts.AreaChart,
1165
- {
1166
- ...getAreaChartProps({ className: "ui-area-chart__chart" }),
1167
- children: [
1168
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1169
- import_recharts.CartesianGrid,
1170
- {
1171
- ...getGridProps({ className: "ui-area-chart__grid" })
1172
- }
1173
- ),
1174
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_recharts.XAxis, { ...getXAxisProps({ className: "ui-area-chart__x-axis" }) }),
1175
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_recharts.YAxis, { ...getYAxisProps({ className: "ui-area-chart__y-axis" }) }),
1176
- withLegend ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1177
- import_recharts.Legend,
1178
- {
1179
- content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1180
- ChartLegend,
1181
- {
1182
- className: "ui-area-chart__legend",
1183
- payload,
1184
- onHighlight: setHighlightedArea,
1185
- ...computedLegendProps
1186
- }
1187
- ),
1188
- ...getLegendProps()
1189
- }
1190
- ) : null,
1191
- withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1192
- import_recharts.Tooltip,
1193
- {
1194
- content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1195
- ChartTooltip,
1196
- {
1197
- className: "ui-area-chart__tooltip",
1198
- label,
1199
- payload,
1200
- valueFormatter,
1201
- unit,
1202
- ...computedTooltipProps
1203
- }
1204
- ),
1205
- ...getTooltipProps()
1206
- }
1207
- ) : null,
1208
- type === "split" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AreaSplit, { ...getAreaSplitProps() }) }) : null,
1209
- areas,
1210
- referenceLinesItems
1211
- ]
1212
- }
1213
- )
1214
- }
1215
- )
1216
- }
1217
- ) });
1218
- });
1219
- // Annotate the CommonJS export names for ESM import in node:
1220
- 0 && (module.exports = {
1221
- AreaChart
1222
- });
1223
- //# sourceMappingURL=area-chart.js.map