@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.
Files changed (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -0
  3. package/dist/area-chart-gradient.d.mts +11 -0
  4. package/dist/area-chart-gradient.d.ts +11 -0
  5. package/dist/area-chart-gradient.js +47 -0
  6. package/dist/area-chart-gradient.js.map +1 -0
  7. package/dist/area-chart-gradient.mjs +8 -0
  8. package/dist/area-chart-gradient.mjs.map +1 -0
  9. package/dist/area-chart-split.d.mts +10 -0
  10. package/dist/area-chart-split.d.ts +10 -0
  11. package/dist/area-chart-split.js +52 -0
  12. package/dist/area-chart-split.js.map +1 -0
  13. package/dist/area-chart-split.mjs +8 -0
  14. package/dist/area-chart-split.mjs.map +1 -0
  15. package/dist/area-chart.d.mts +36 -0
  16. package/dist/area-chart.d.ts +36 -0
  17. package/dist/area-chart.js +1249 -0
  18. package/dist/area-chart.js.map +1 -0
  19. package/dist/area-chart.mjs +21 -0
  20. package/dist/area-chart.mjs.map +1 -0
  21. package/dist/bar-chart.d.mts +33 -0
  22. package/dist/bar-chart.d.ts +33 -0
  23. package/dist/bar-chart.js +1053 -0
  24. package/dist/bar-chart.js.map +1 -0
  25. package/dist/bar-chart.mjs +19 -0
  26. package/dist/bar-chart.mjs.map +1 -0
  27. package/dist/chart-legend.d.mts +12 -0
  28. package/dist/chart-legend.d.ts +12 -0
  29. package/dist/chart-legend.js +87 -0
  30. package/dist/chart-legend.js.map +1 -0
  31. package/dist/chart-legend.mjs +11 -0
  32. package/dist/chart-legend.mjs.map +1 -0
  33. package/dist/chart-tooltip.d.mts +12 -0
  34. package/dist/chart-tooltip.d.ts +12 -0
  35. package/dist/chart-tooltip.js +120 -0
  36. package/dist/chart-tooltip.js.map +1 -0
  37. package/dist/chart-tooltip.mjs +11 -0
  38. package/dist/chart-tooltip.mjs.map +1 -0
  39. package/dist/chart-utils.d.mts +9 -0
  40. package/dist/chart-utils.d.ts +9 -0
  41. package/dist/chart-utils.js +45 -0
  42. package/dist/chart-utils.js.map +1 -0
  43. package/dist/chart-utils.mjs +10 -0
  44. package/dist/chart-utils.mjs.map +1 -0
  45. package/dist/chart.types.d.mts +65 -0
  46. package/dist/chart.types.d.ts +65 -0
  47. package/dist/chart.types.js +20 -0
  48. package/dist/chart.types.js.map +1 -0
  49. package/dist/chart.types.mjs +2 -0
  50. package/dist/chart.types.mjs.map +1 -0
  51. package/dist/chunk-32BO2QEP.mjs +83 -0
  52. package/dist/chunk-32BO2QEP.mjs.map +1 -0
  53. package/dist/chunk-3CY3IFRN.mjs +42 -0
  54. package/dist/chunk-3CY3IFRN.mjs.map +1 -0
  55. package/dist/chunk-3IBGJT6F.mjs +341 -0
  56. package/dist/chunk-3IBGJT6F.mjs.map +1 -0
  57. package/dist/chunk-5QCKM3B3.mjs +438 -0
  58. package/dist/chunk-5QCKM3B3.mjs.map +1 -0
  59. package/dist/chunk-AURFFNDQ.mjs +114 -0
  60. package/dist/chunk-AURFFNDQ.mjs.map +1 -0
  61. package/dist/chunk-FGDWJUA3.mjs +56 -0
  62. package/dist/chunk-FGDWJUA3.mjs.map +1 -0
  63. package/dist/chunk-GZLE5XDS.mjs +227 -0
  64. package/dist/chunk-GZLE5XDS.mjs.map +1 -0
  65. package/dist/chunk-HE6SM47L.mjs +234 -0
  66. package/dist/chunk-HE6SM47L.mjs.map +1 -0
  67. package/dist/chunk-LXZCGIND.mjs +33 -0
  68. package/dist/chunk-LXZCGIND.mjs.map +1 -0
  69. package/dist/chunk-MSIOYYWR.mjs +24 -0
  70. package/dist/chunk-MSIOYYWR.mjs.map +1 -0
  71. package/dist/chunk-PNE3JG54.mjs +29 -0
  72. package/dist/chunk-PNE3JG54.mjs.map +1 -0
  73. package/dist/chunk-QL3DB7OJ.mjs +21 -0
  74. package/dist/chunk-QL3DB7OJ.mjs.map +1 -0
  75. package/dist/chunk-RG5JQJXE.mjs +249 -0
  76. package/dist/chunk-RG5JQJXE.mjs.map +1 -0
  77. package/dist/chunk-RTTZPOUT.mjs +50 -0
  78. package/dist/chunk-RTTZPOUT.mjs.map +1 -0
  79. package/dist/chunk-RXWD2EJ2.mjs +56 -0
  80. package/dist/chunk-RXWD2EJ2.mjs.map +1 -0
  81. package/dist/chunk-TKLHZBVY.mjs +206 -0
  82. package/dist/chunk-TKLHZBVY.mjs.map +1 -0
  83. package/dist/chunk-WDSR6B47.mjs +324 -0
  84. package/dist/chunk-WDSR6B47.mjs.map +1 -0
  85. package/dist/chunk-WF3BD34Y.mjs +74 -0
  86. package/dist/chunk-WF3BD34Y.mjs.map +1 -0
  87. package/dist/chunk-YBAGOHS5.mjs +204 -0
  88. package/dist/chunk-YBAGOHS5.mjs.map +1 -0
  89. package/dist/chunk-YRY7MUCR.mjs +258 -0
  90. package/dist/chunk-YRY7MUCR.mjs.map +1 -0
  91. package/dist/index.d.mts +23 -0
  92. package/dist/index.d.ts +23 -0
  93. package/dist/index.js +2725 -0
  94. package/dist/index.js.map +1 -0
  95. package/dist/index.mjs +36 -0
  96. package/dist/index.mjs.map +1 -0
  97. package/dist/line-chart.d.mts +33 -0
  98. package/dist/line-chart.d.ts +33 -0
  99. package/dist/line-chart.js +1114 -0
  100. package/dist/line-chart.js.map +1 -0
  101. package/dist/line-chart.mjs +19 -0
  102. package/dist/line-chart.mjs.map +1 -0
  103. package/dist/radar-chart.d.mts +52 -0
  104. package/dist/radar-chart.d.ts +52 -0
  105. package/dist/radar-chart.js +940 -0
  106. package/dist/radar-chart.js.map +1 -0
  107. package/dist/radar-chart.mjs +16 -0
  108. package/dist/radar-chart.mjs.map +1 -0
  109. package/dist/rechart-properties.d.mts +24 -0
  110. package/dist/rechart-properties.d.ts +24 -0
  111. package/dist/rechart-properties.js +479 -0
  112. package/dist/rechart-properties.js.map +1 -0
  113. package/dist/rechart-properties.mjs +44 -0
  114. package/dist/rechart-properties.mjs.map +1 -0
  115. package/dist/use-area-chart.d.mts +118 -0
  116. package/dist/use-area-chart.d.ts +118 -0
  117. package/dist/use-area-chart.js +418 -0
  118. package/dist/use-area-chart.js.map +1 -0
  119. package/dist/use-area-chart.mjs +10 -0
  120. package/dist/use-area-chart.mjs.map +1 -0
  121. package/dist/use-bar-chart.d.mts +68 -0
  122. package/dist/use-bar-chart.d.ts +68 -0
  123. package/dist/use-bar-chart.js +288 -0
  124. package/dist/use-bar-chart.js.map +1 -0
  125. package/dist/use-bar-chart.mjs +10 -0
  126. package/dist/use-bar-chart.mjs.map +1 -0
  127. package/dist/use-chart-axis.d.mts +73 -0
  128. package/dist/use-chart-axis.d.ts +73 -0
  129. package/dist/use-chart-axis.js +227 -0
  130. package/dist/use-chart-axis.js.map +1 -0
  131. package/dist/use-chart-axis.mjs +10 -0
  132. package/dist/use-chart-axis.mjs.map +1 -0
  133. package/dist/use-chart-grid.d.mts +32 -0
  134. package/dist/use-chart-grid.d.ts +32 -0
  135. package/dist/use-chart-grid.js +92 -0
  136. package/dist/use-chart-grid.js.map +1 -0
  137. package/dist/use-chart-grid.mjs +10 -0
  138. package/dist/use-chart-grid.mjs.map +1 -0
  139. package/dist/use-chart-legend.d.mts +18 -0
  140. package/dist/use-chart-legend.d.ts +18 -0
  141. package/dist/use-chart-legend.js +81 -0
  142. package/dist/use-chart-legend.js.map +1 -0
  143. package/dist/use-chart-legend.mjs +9 -0
  144. package/dist/use-chart-legend.mjs.map +1 -0
  145. package/dist/use-chart-reference-line.d.mts +22 -0
  146. package/dist/use-chart-reference-line.d.ts +22 -0
  147. package/dist/use-chart-reference-line.js +105 -0
  148. package/dist/use-chart-reference-line.js.map +1 -0
  149. package/dist/use-chart-reference-line.mjs +10 -0
  150. package/dist/use-chart-reference-line.mjs.map +1 -0
  151. package/dist/use-chart-tooltip.d.mts +35 -0
  152. package/dist/use-chart-tooltip.d.ts +35 -0
  153. package/dist/use-chart-tooltip.js +121 -0
  154. package/dist/use-chart-tooltip.js.map +1 -0
  155. package/dist/use-chart-tooltip.mjs +9 -0
  156. package/dist/use-chart-tooltip.mjs.map +1 -0
  157. package/dist/use-chart.d.mts +33 -0
  158. package/dist/use-chart.d.ts +33 -0
  159. package/dist/use-chart.js +104 -0
  160. package/dist/use-chart.js.map +1 -0
  161. package/dist/use-chart.mjs +18 -0
  162. package/dist/use-chart.mjs.map +1 -0
  163. package/dist/use-line-chart.d.mts +92 -0
  164. package/dist/use-line-chart.d.ts +92 -0
  165. package/dist/use-line-chart.js +342 -0
  166. package/dist/use-line-chart.js.map +1 -0
  167. package/dist/use-line-chart.mjs +10 -0
  168. package/dist/use-line-chart.mjs.map +1 -0
  169. package/dist/use-radar-chart.d.mts +93 -0
  170. package/dist/use-radar-chart.d.ts +93 -0
  171. package/dist/use-radar-chart.js +471 -0
  172. package/dist/use-radar-chart.js.map +1 -0
  173. package/dist/use-radar-chart.mjs +10 -0
  174. package/dist/use-radar-chart.mjs.map +1 -0
  175. package/package.json +84 -0
package/dist/index.js ADDED
@@ -0,0 +1,2725 @@
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/index.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ AreaChart: () => AreaChart,
25
+ BarChart: () => BarChart,
26
+ LineChart: () => LineChart,
27
+ RadarChart: () => RadarChart
28
+ });
29
+ module.exports = __toCommonJS(src_exports);
30
+
31
+ // src/line-chart.tsx
32
+ var import_core9 = require("@yamada-ui/core");
33
+ var import_utils11 = require("@yamada-ui/utils");
34
+ var import_react8 = require("react");
35
+ var import_recharts = require("recharts");
36
+
37
+ // src/chart-legend.tsx
38
+ var import_core3 = require("@yamada-ui/core");
39
+ var import_utils3 = require("@yamada-ui/utils");
40
+
41
+ // src/use-chart.ts
42
+ var import_core2 = require("@yamada-ui/core");
43
+ var import_utils2 = require("@yamada-ui/utils");
44
+ var import_react = require("react");
45
+
46
+ // src/chart-utils.ts
47
+ var import_core = require("@yamada-ui/core");
48
+ var import_utils = require("@yamada-ui/utils");
49
+ var getClassName = (...styles) => (theme) => (0, import_utils.cx)(
50
+ ...styles.map(
51
+ (style) => (0, import_utils.isString)(style) ? style : (0, import_core.getCSS)(style)(theme)
52
+ )
53
+ );
54
+ var getComponentProps = ([obj, keys], ...props) => (theme, isContain) => {
55
+ const [pickedProps, omittedProps] = (0, import_utils.splitObject)(obj, keys);
56
+ const className = getClassName(...props, omittedProps)(theme);
57
+ return !isContain ? [pickedProps, className] : { ...pickedProps, className };
58
+ };
59
+
60
+ // src/rechart-properties.ts
61
+ var areaChartProperties = [
62
+ "layout",
63
+ "syncId",
64
+ "syncMethod",
65
+ "width",
66
+ "height",
67
+ "data",
68
+ "margin",
69
+ "stackOffset",
70
+ "onClick",
71
+ "onMouseEnter",
72
+ "onMouseMove",
73
+ "onMouseLeave"
74
+ ];
75
+ var barChartProperties = [
76
+ "layout",
77
+ "syncId",
78
+ "syncMethod",
79
+ "width",
80
+ "height",
81
+ "data",
82
+ "margin",
83
+ "barCategoryGap",
84
+ "barGap",
85
+ "barSize",
86
+ "maxBarSize",
87
+ "stackOffset",
88
+ "reverseStackOrder",
89
+ "onClick",
90
+ "onMouseEnter",
91
+ "onMouseMove",
92
+ "onMouseLeave"
93
+ ];
94
+ var lineChartProperties = [
95
+ "layout",
96
+ "syncId",
97
+ "syncMethod",
98
+ "width",
99
+ "height",
100
+ "data",
101
+ "margin",
102
+ "onClick",
103
+ "onMouseEnter",
104
+ "onMouseMove",
105
+ "onMouseLeave"
106
+ ];
107
+ var radarChartProperties = [
108
+ "width",
109
+ "height",
110
+ "data",
111
+ "cx",
112
+ "cy",
113
+ "startAngle",
114
+ "endAngle",
115
+ "innerRadius",
116
+ "outerRadius",
117
+ "margin",
118
+ "onMouseEnter",
119
+ "onClick"
120
+ ];
121
+ var referenceLineProperties = [
122
+ "xAxisId",
123
+ "yAxisId",
124
+ "x",
125
+ "y",
126
+ "ifOverflow",
127
+ "viewBox",
128
+ "xAxis",
129
+ "yAxis",
130
+ "label",
131
+ "isFront",
132
+ "strokeWidth",
133
+ "segment"
134
+ ];
135
+ var containerProperties = [
136
+ "aspect",
137
+ "width",
138
+ "height",
139
+ "minWidth",
140
+ "minHeight",
141
+ "debounce",
142
+ "onResize"
143
+ ];
144
+ var gridProperties = [
145
+ "x",
146
+ "y",
147
+ "width",
148
+ "height",
149
+ "horizontal",
150
+ "vertical",
151
+ "horizontalPoints",
152
+ "horizontalCoordinatesGenerator",
153
+ "verticalPoints",
154
+ "verticalCoordinatesGenerator",
155
+ "fill",
156
+ "fillOpacity",
157
+ "strokeDasharray"
158
+ ];
159
+ var xAxisProperties = [
160
+ "hide",
161
+ "dataKey",
162
+ "xAxisId",
163
+ "width",
164
+ "height",
165
+ "orientation",
166
+ "type",
167
+ "allowDecimals",
168
+ "allowDataOverflow",
169
+ "allowDuplicatedCategory",
170
+ "angle",
171
+ "tickCount",
172
+ "domain",
173
+ "includeHidden",
174
+ "interval",
175
+ "padding",
176
+ "minTickGap",
177
+ "axisLine",
178
+ "tickLine",
179
+ "tickSize",
180
+ "tickFormatter",
181
+ "ticks",
182
+ "tick",
183
+ "mirror",
184
+ "reversed",
185
+ "label",
186
+ "scale",
187
+ "unit",
188
+ "name",
189
+ "onClick",
190
+ "onMouseDown",
191
+ "onMouseUp",
192
+ "onMouseMove",
193
+ "onMouseOver",
194
+ "onMouseOut",
195
+ "onMouseEnter",
196
+ "onMouseLeave",
197
+ "tickMargin"
198
+ ];
199
+ var yAxisProperties = [
200
+ "hide",
201
+ "dataKey",
202
+ "yAxisId",
203
+ "width",
204
+ "height",
205
+ "orientation",
206
+ "type",
207
+ "tickCount",
208
+ "domain",
209
+ "includeHidden",
210
+ "interval",
211
+ "padding",
212
+ "minTickGap",
213
+ "allowDecimals",
214
+ "allowDataOverflow",
215
+ "allowDuplicatedCategory",
216
+ "axisLine",
217
+ "tickLine",
218
+ "tickSize",
219
+ "tickFormatter",
220
+ "ticks",
221
+ "tick",
222
+ "mirror",
223
+ "reversed",
224
+ "label",
225
+ "scale",
226
+ "unit",
227
+ "name",
228
+ "onClick",
229
+ "onMouseDown",
230
+ "onMouseUp",
231
+ "onMouseMove",
232
+ "onMouseOver",
233
+ "onMouseOut",
234
+ "onMouseEnter",
235
+ "onMouseLeave",
236
+ "tickMargin"
237
+ ];
238
+ var legendProperties = [
239
+ "width",
240
+ "height",
241
+ "layout",
242
+ "align",
243
+ "verticalAlign",
244
+ "iconSize",
245
+ "iconType",
246
+ "payload",
247
+ "chartWidth",
248
+ "chartHeight",
249
+ "margin",
250
+ "content",
251
+ "formatter",
252
+ "wrapperStyle",
253
+ "onClick",
254
+ "onMouseDown",
255
+ "onMouseUp",
256
+ "onMouseMove",
257
+ "onMouseOver",
258
+ "onMouseOut",
259
+ "onMouseEnter",
260
+ "onMouseLeave"
261
+ ];
262
+ var tooltipProperties = [
263
+ "offset",
264
+ "filterNull",
265
+ "itemStyle",
266
+ "wrapperStyle",
267
+ "contentStyle",
268
+ "labelStyle",
269
+ "cursor",
270
+ "viewBox",
271
+ "allowEscapeViewBox",
272
+ "active",
273
+ "position",
274
+ "coordinate",
275
+ "payload",
276
+ "label",
277
+ "content",
278
+ "formatter",
279
+ "labelFormatter",
280
+ "itemSorter",
281
+ "isAnimationActive",
282
+ "animationDuration",
283
+ "animationEasing"
284
+ ];
285
+ var areaProperties = [
286
+ "type",
287
+ "dataKey",
288
+ "xAxisId",
289
+ "yAxisId",
290
+ "legendType",
291
+ "dot",
292
+ "activeDot",
293
+ "label",
294
+ "stroke",
295
+ "strokeWidth",
296
+ "layout",
297
+ "baseLine",
298
+ "points",
299
+ "stackId",
300
+ "connectNulls",
301
+ "unit",
302
+ "name",
303
+ "isAnimationActive",
304
+ "animationBegin",
305
+ "animationDuration",
306
+ "animationEasing",
307
+ "id",
308
+ "onAnimationStart",
309
+ "onAnimationEnd",
310
+ "onClick",
311
+ "onMouseDown",
312
+ "onMouseUp",
313
+ "onMouseMove",
314
+ "onMouseOver",
315
+ "onMouseOut",
316
+ "onMouseEnter",
317
+ "onMouseLeave"
318
+ ];
319
+ var barProperties = [
320
+ "layout",
321
+ "dataKey",
322
+ "xAxisId",
323
+ "yAxisId",
324
+ "legendType",
325
+ "label",
326
+ "data",
327
+ "barSize",
328
+ "maxBarSize",
329
+ "minPointSize",
330
+ "background",
331
+ "shape",
332
+ "activeBar",
333
+ "stackId",
334
+ "unit",
335
+ "name",
336
+ "isAnimationActive",
337
+ "animationBegin",
338
+ "animationDuration",
339
+ "animationEasing",
340
+ "id",
341
+ "onAnimationStart",
342
+ "onAnimationEnd",
343
+ "onClick",
344
+ "onMouseDown",
345
+ "onMouseUp",
346
+ "onMouseMove",
347
+ "onMouseOver",
348
+ "onMouseOut",
349
+ "onMouseEnter",
350
+ "onMouseLeave",
351
+ "radius"
352
+ ];
353
+ var radarProperties = [
354
+ "dataKey",
355
+ "points",
356
+ "shape",
357
+ "dot",
358
+ "activeDot",
359
+ "legendType",
360
+ "label",
361
+ "isAnimationActive",
362
+ "animationBegin",
363
+ "animationDuration",
364
+ "animationEasing",
365
+ "onAnimationStart",
366
+ "onAnimationEnd"
367
+ ];
368
+ var lineProperties = [
369
+ "type",
370
+ "dataKey",
371
+ "xAxisId",
372
+ "yAxisId",
373
+ "legendType",
374
+ "dot",
375
+ "activeDot",
376
+ "label",
377
+ "hide",
378
+ "points",
379
+ "stroke",
380
+ "strokeWidth",
381
+ "layout",
382
+ "connectNulls",
383
+ "unit",
384
+ "name",
385
+ "isAnimationActive",
386
+ "animationBegin",
387
+ "animationDuration",
388
+ "animationEasing",
389
+ "id",
390
+ "onAnimationStart",
391
+ "onAnimationEnd",
392
+ "onClick",
393
+ "onMouseDown",
394
+ "onMouseUp",
395
+ "onMouseMove",
396
+ "onMouseOver",
397
+ "onMouseOut",
398
+ "onMouseEnter",
399
+ "onMouseLeave",
400
+ "strokeDasharray"
401
+ ];
402
+ var dotProperties = [
403
+ "cx",
404
+ "cy",
405
+ "r",
406
+ "onClick",
407
+ "onMouseDown",
408
+ "onMouseUp",
409
+ "onMouseMove",
410
+ "onMouseOver",
411
+ "onMouseOut",
412
+ "onMouseEnter",
413
+ "onMouseLeave"
414
+ ];
415
+ var polarGridProperties = [
416
+ "cx",
417
+ "cy",
418
+ "innerRadius",
419
+ "outerRadius",
420
+ "polarAngles",
421
+ "polarRadius",
422
+ "gridType"
423
+ ];
424
+ var polarAngleAxisProperties = [
425
+ "dataKey",
426
+ "cx",
427
+ "cy",
428
+ "radius",
429
+ "axisLine",
430
+ "axisLineType",
431
+ "tickLine",
432
+ "tickSize",
433
+ "tick",
434
+ "ticks",
435
+ "orient",
436
+ "tickFormatter",
437
+ "type",
438
+ "allowDuplicatedCategory",
439
+ "onClick",
440
+ "onMouseDown",
441
+ "onMouseUp",
442
+ "onMouseMove",
443
+ "onMouseOver",
444
+ "onMouseOut",
445
+ "onMouseEnter",
446
+ "onMouseLeave"
447
+ ];
448
+ var polarRadiusAxisProperties = [
449
+ "angle",
450
+ "type",
451
+ "allowDuplicatedCategory",
452
+ "cx",
453
+ "cy",
454
+ "domain",
455
+ "reversed",
456
+ "label",
457
+ "orientation",
458
+ "axisLine",
459
+ "tick",
460
+ "tickSize",
461
+ "tickFormatter",
462
+ "tickCount",
463
+ "scale",
464
+ "onClick",
465
+ "onMouseDown",
466
+ "onMouseUp",
467
+ "onMouseMove",
468
+ "onMouseOver",
469
+ "onMouseOut",
470
+ "onMouseEnter",
471
+ "onMouseLeave"
472
+ ];
473
+
474
+ // src/use-chart.ts
475
+ var [ChartProvider, useChartContext] = (0, import_utils2.createContext)({
476
+ name: "ChartContext",
477
+ errorMessage: `useChartContext returned is 'undefined'. Seems you forgot to wrap the components in "<LineChart />" or "<BarChart />" etc.`
478
+ });
479
+ var useChart = ({ containerProps = {} }) => {
480
+ const { theme } = (0, import_core2.useTheme)();
481
+ const [reChartsProps, propClassName] = getComponentProps([
482
+ containerProps,
483
+ containerProperties
484
+ ])(theme);
485
+ const getContainerProps = (0, import_react.useCallback)(
486
+ ({ className, ...props } = {}, ref = null) => ({
487
+ ref,
488
+ className: (0, import_utils2.cx)("ui-chart__container", className, propClassName),
489
+ ...props,
490
+ ...reChartsProps
491
+ }),
492
+ [propClassName, reChartsProps]
493
+ );
494
+ return {
495
+ getContainerProps
496
+ };
497
+ };
498
+ var useLegend = ({} = {}) => {
499
+ const { styles } = useChartContext();
500
+ return {
501
+ styles
502
+ };
503
+ };
504
+ var useTooltip = ({} = {}) => {
505
+ const { styles } = useChartContext();
506
+ return {
507
+ styles
508
+ };
509
+ };
510
+
511
+ // src/chart-legend.tsx
512
+ var import_jsx_runtime = require("react/jsx-runtime");
513
+ var ChartLegend = (0, import_core3.forwardRef)(
514
+ ({ className, payload = [], onHighlight, ...rest }, ref) => {
515
+ const { styles } = useLegend();
516
+ const items = payload.map(({ dataKey, color }, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
517
+ import_core3.ui.div,
518
+ {
519
+ className: "ui-chart__legend-item",
520
+ onMouseEnter: () => onHighlight(dataKey),
521
+ onMouseLeave: () => onHighlight(null),
522
+ __css: styles.legendItem,
523
+ children: [
524
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
525
+ import_core3.ui.div,
526
+ {
527
+ className: "ui-chart__legend-swatch",
528
+ background: color,
529
+ __css: styles.legendSwatch
530
+ }
531
+ ),
532
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core3.ui.span, { className: "ui-chart__legend-label", children: dataKey })
533
+ ]
534
+ },
535
+ `legend-${index}`
536
+ ));
537
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
538
+ import_core3.ui.div,
539
+ {
540
+ ref,
541
+ className: (0, import_utils3.cx)("ui-chart__legend", className),
542
+ __css: styles.legend,
543
+ ...rest,
544
+ children: items
545
+ }
546
+ );
547
+ }
548
+ );
549
+
550
+ // src/chart-tooltip.tsx
551
+ var import_core4 = require("@yamada-ui/core");
552
+ var import_utils4 = require("@yamada-ui/utils");
553
+ var import_jsx_runtime2 = require("react/jsx-runtime");
554
+ var ChartTooltip = (0, import_core4.forwardRef)(
555
+ ({ label, className, payload = [], valueFormatter, unit, ...rest }, ref) => {
556
+ const { styles } = useTooltip();
557
+ const items = payload.map(
558
+ ({ color, name, value: valueProp } = {}, index) => {
559
+ var _a;
560
+ let value;
561
+ if ((0, import_utils4.isArray)(valueProp)) {
562
+ value = valueProp.map((value2) => {
563
+ var _a2;
564
+ return `${(_a2 = valueFormatter == null ? void 0 : valueFormatter(value2)) != null ? _a2 : value2}`;
565
+ }).join(" - ");
566
+ } else {
567
+ value = (_a = valueFormatter == null ? void 0 : valueFormatter(valueProp)) != null ? _a : valueProp;
568
+ }
569
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
570
+ import_core4.ui.div,
571
+ {
572
+ className: "ui-chart__tooltip-item",
573
+ __css: styles.tooltipItem,
574
+ children: [
575
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
576
+ import_core4.ui.div,
577
+ {
578
+ className: "ui-chart__tooltip-swatch",
579
+ background: color,
580
+ __css: styles.tooltipSwatch
581
+ }
582
+ ),
583
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
584
+ import_core4.ui.span,
585
+ {
586
+ className: "ui-chart__tooltip-label",
587
+ __css: styles.tooltipLabel,
588
+ children: name
589
+ }
590
+ ),
591
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
592
+ import_core4.ui.span,
593
+ {
594
+ className: "ui-chart__tooltip-value",
595
+ __css: styles.tooltipValue,
596
+ children: [
597
+ value,
598
+ unit ? unit : ""
599
+ ]
600
+ }
601
+ )
602
+ ]
603
+ },
604
+ `tooltip-payload-${index}`
605
+ );
606
+ }
607
+ );
608
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
609
+ import_core4.ui.div,
610
+ {
611
+ ref,
612
+ className: (0, import_utils4.cx)("ui-chart__tooltip", className),
613
+ __css: styles.tooltip,
614
+ ...rest,
615
+ children: [
616
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.p, { className: "ui-chart__tooltip-title", __css: styles.tooltipTitle, children: label }),
617
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.div, { className: "ui-chart__tooltip-list", __css: styles.tooltipList, children: items })
618
+ ]
619
+ }
620
+ );
621
+ }
622
+ );
623
+
624
+ // src/use-chart-axis.ts
625
+ var import_core5 = require("@yamada-ui/core");
626
+ var import_utils5 = require("@yamada-ui/utils");
627
+ var import_react2 = require("react");
628
+ var useChartAxis = ({
629
+ dataKey,
630
+ type,
631
+ layoutType = "horizontal",
632
+ tickLine = "y",
633
+ gridAxis = "x",
634
+ withXAxis = true,
635
+ withYAxis = true,
636
+ xAxisProps: _xAxisProps = {},
637
+ yAxisProps: _yAxisProps = {},
638
+ unit,
639
+ valueFormatter,
640
+ styles
641
+ }) => {
642
+ const { theme } = (0, import_core5.useTheme)();
643
+ const xAxisKey = (0, import_react2.useMemo)(
644
+ () => layoutType === "vertical" ? { type: "number" } : { dataKey },
645
+ [dataKey, layoutType]
646
+ );
647
+ const yAxisKey = (0, import_react2.useMemo)(
648
+ () => layoutType === "vertical" ? { dataKey, type: "category" } : { type: "number" },
649
+ [dataKey, layoutType]
650
+ );
651
+ const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
652
+ const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
653
+ const getTickLine = (withTickLine) => withTickLine ? { stroke: "currentColor" } : false;
654
+ const xTickLine = getTickLine(withXTickLine);
655
+ const yTickLine = getTickLine(withYTickLine);
656
+ const yAxisTickFormatter = type === "percent" && layoutType !== "vertical" ? valueToPercent : valueFormatter;
657
+ const xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : valueFormatter;
658
+ const [xAxisReChartsProps, xAxisClassName] = getComponentProps(
659
+ [_xAxisProps, xAxisProperties],
660
+ styles.xAxis
661
+ )(theme);
662
+ const [yAxisReChartsProps, yAxisClassName] = getComponentProps(
663
+ [_yAxisProps, yAxisProperties],
664
+ styles.yAxis
665
+ )(theme);
666
+ const getXAxisProps = (0, import_react2.useCallback)(
667
+ ({ className, ...props } = {}) => ({
668
+ className: (0, import_utils5.cx)(className, xAxisClassName),
669
+ hide: !withXAxis,
670
+ ...xAxisKey,
671
+ tick: {
672
+ transform: "translate(0, 10)",
673
+ fill: "currentColor"
674
+ },
675
+ stroke: "",
676
+ interval: "preserveStartEnd",
677
+ tickLine: xTickLine,
678
+ minTickGap: 5,
679
+ tickFormatter: xAxisTickFormatter,
680
+ ...props,
681
+ ...xAxisReChartsProps
682
+ }),
683
+ [
684
+ xAxisClassName,
685
+ withXAxis,
686
+ xAxisKey,
687
+ xTickLine,
688
+ xAxisTickFormatter,
689
+ xAxisReChartsProps
690
+ ]
691
+ );
692
+ const getYAxisProps = (0, import_react2.useCallback)(
693
+ ({ className, ...props } = {}) => ({
694
+ className: (0, import_utils5.cx)(className, yAxisClassName),
695
+ hide: !withYAxis,
696
+ axisLine: false,
697
+ ...yAxisKey,
698
+ tickLine: yTickLine,
699
+ tick: {
700
+ transform: "translate(-10, 0)",
701
+ fill: "currentColor"
702
+ },
703
+ allowDecimals: true,
704
+ unit,
705
+ tickFormatter: yAxisTickFormatter,
706
+ ...props,
707
+ ...yAxisReChartsProps
708
+ }),
709
+ [
710
+ yAxisClassName,
711
+ withYAxis,
712
+ yAxisKey,
713
+ yTickLine,
714
+ unit,
715
+ yAxisTickFormatter,
716
+ yAxisReChartsProps
717
+ ]
718
+ );
719
+ return { getXAxisProps, getYAxisProps };
720
+ };
721
+ var valueToPercent = (value) => {
722
+ return `${(value * 100).toFixed(0)}%`;
723
+ };
724
+
725
+ // src/use-chart-grid.ts
726
+ var import_core6 = require("@yamada-ui/core");
727
+ var import_utils6 = require("@yamada-ui/utils");
728
+ var import_react3 = require("react");
729
+ var useChartGrid = ({
730
+ gridProps = {},
731
+ gridAxis = "x",
732
+ strokeDasharray = "5 5",
733
+ styles
734
+ }) => {
735
+ const { theme } = (0, import_core6.useTheme)();
736
+ const [reChartsProps, propClassName] = getComponentProps(
737
+ [gridProps, gridProperties],
738
+ styles.grid
739
+ )(theme);
740
+ const getGridProps = (0, import_react3.useCallback)(
741
+ ({ className, ...props } = {}, ref = null) => ({
742
+ ref,
743
+ className: (0, import_utils6.cx)("ui-chart__grid", className, propClassName),
744
+ strokeDasharray,
745
+ vertical: gridAxis === "y" || gridAxis === "xy",
746
+ horizontal: gridAxis === "x" || gridAxis === "xy",
747
+ ...props,
748
+ ...reChartsProps
749
+ }),
750
+ [propClassName, strokeDasharray, gridAxis, reChartsProps]
751
+ );
752
+ return { getGridProps };
753
+ };
754
+
755
+ // src/use-chart-legend.ts
756
+ var import_utils7 = require("@yamada-ui/utils");
757
+ var import_react4 = require("react");
758
+ var useChartLegend = ({
759
+ legendProps: _legendProps = {}
760
+ }) => {
761
+ const [rest, legendProps] = (0, import_utils7.splitObject)(
762
+ _legendProps,
763
+ legendProperties
764
+ );
765
+ const getLegendProps = (0, import_react4.useCallback)(
766
+ (props, ref = null) => {
767
+ return {
768
+ ref,
769
+ verticalAlign: "top",
770
+ ...props,
771
+ ...rest
772
+ };
773
+ },
774
+ [rest]
775
+ );
776
+ return { legendProps, getLegendProps };
777
+ };
778
+
779
+ // src/use-chart-reference-line.ts
780
+ var import_core7 = require("@yamada-ui/core");
781
+ var import_utils8 = require("@yamada-ui/utils");
782
+ var import_react5 = require("react");
783
+ var useChartReferenceLine = ({
784
+ referenceLineProps = [],
785
+ styles
786
+ }) => {
787
+ const { theme } = (0, import_core7.useTheme)();
788
+ const styleClassName = (0, import_core7.getCSS)(styles.referenceLine)(theme);
789
+ const propList = (0, import_react5.useMemo)(
790
+ () => referenceLineProps.map((props, index) => {
791
+ const [{ label: labelProp, ...rest }, propClassName] = getComponentProps(
792
+ [props, referenceLineProperties],
793
+ styleClassName
794
+ )(theme);
795
+ const color = `var(--ui-reference-line-${index})`;
796
+ const label = {
797
+ value: labelProp,
798
+ fill: color,
799
+ position: "insideBottomLeft",
800
+ ...(0, import_utils8.isObject)(labelProp) ? labelProp : {}
801
+ };
802
+ return { propClassName, color, label, ...rest };
803
+ }),
804
+ [referenceLineProps, styleClassName, theme]
805
+ );
806
+ const getReferenceLineProps = (0, import_react5.useCallback)(
807
+ ({ index, className, ...props }, ref = null) => {
808
+ const { propClassName, color, label, ...rest } = propList[index];
809
+ return {
810
+ ref,
811
+ className: (0, import_utils8.cx)(className, propClassName),
812
+ stroke: color,
813
+ label,
814
+ ...props,
815
+ ...rest
816
+ };
817
+ },
818
+ [propList]
819
+ );
820
+ return { getReferenceLineProps };
821
+ };
822
+
823
+ // src/use-chart-tooltip.ts
824
+ var import_utils9 = require("@yamada-ui/utils");
825
+ var import_react6 = require("react");
826
+ var useChartTooltip = ({
827
+ tooltipProps: _tooltipProps = {},
828
+ tooltipAnimationDuration = 0,
829
+ styles
830
+ }) => {
831
+ const { cursor, ...rest } = _tooltipProps;
832
+ const resolvedCursor = (0, import_react6.useMemo)(
833
+ () => ({ ...styles.cursor, ...cursor }),
834
+ [cursor, styles]
835
+ );
836
+ const tooltipVars = (0, import_react6.useMemo)(
837
+ () => [
838
+ {
839
+ __prefix: "ui",
840
+ name: "cursor-fill",
841
+ token: "colors",
842
+ value: resolvedCursor.fill
843
+ },
844
+ {
845
+ __prefix: "ui",
846
+ name: "cursor-stroke",
847
+ token: "colors",
848
+ value: resolvedCursor.stroke
849
+ },
850
+ {
851
+ __prefix: "ui",
852
+ name: "cursor-stroke-width",
853
+ token: "colors",
854
+ value: resolvedCursor.strokeWidth
855
+ },
856
+ {
857
+ __prefix: "ui",
858
+ name: "cursor-stroke-dasharray",
859
+ token: "colors",
860
+ value: resolvedCursor.strokeDasharray
861
+ }
862
+ ],
863
+ [resolvedCursor]
864
+ );
865
+ const [tooltipProps, tooltipUIProps] = (0, import_utils9.splitObject)(
866
+ rest,
867
+ tooltipProperties
868
+ );
869
+ const getTooltipProps = (0, import_react6.useCallback)(
870
+ (props, ref = null) => ({
871
+ ref,
872
+ animationDuration: tooltipAnimationDuration,
873
+ isAnimationActive: (tooltipAnimationDuration || 0) > 0,
874
+ cursor: {
875
+ fill: "var(--ui-cursor-fill)",
876
+ stroke: "var(--ui-cursor-stroke)",
877
+ strokeWidth: "var(--ui-cursor-stroke-width)",
878
+ strokeDasharray: "var(--ui-cursor-stroke-dasharray)"
879
+ },
880
+ ...props,
881
+ ...tooltipProps
882
+ }),
883
+ [tooltipAnimationDuration, tooltipProps]
884
+ );
885
+ return { tooltipProps: tooltipUIProps, getTooltipProps, tooltipVars };
886
+ };
887
+
888
+ // src/use-line-chart.ts
889
+ var import_core8 = require("@yamada-ui/core");
890
+ var import_utils10 = require("@yamada-ui/utils");
891
+ var import_react7 = require("react");
892
+ var useLineChart = ({
893
+ data,
894
+ series,
895
+ layoutType = "horizontal",
896
+ withDots = true,
897
+ withActiveDots = true,
898
+ curveType = "monotone",
899
+ strokeWidth = 2,
900
+ connectNulls = true,
901
+ referenceLineProps,
902
+ fillOpacity = 1,
903
+ styles,
904
+ ...rest
905
+ }) => {
906
+ var _a;
907
+ const { theme } = (0, import_core8.useTheme)();
908
+ const [highlightedArea, setHighlightedArea] = (0, import_react7.useState)(null);
909
+ const shouldHighlight = highlightedArea !== null;
910
+ const {
911
+ dot = {},
912
+ activeDot = {},
913
+ dimDot,
914
+ dimLine,
915
+ ...computedLineProps
916
+ } = (_a = rest.lineProps) != null ? _a : {};
917
+ const lineColors = (0, import_react7.useMemo)(
918
+ () => series.map(({ color }, index) => ({
919
+ __prefix: "ui",
920
+ name: `line-${index}`,
921
+ token: "colors",
922
+ value: color != null ? color : "transparent"
923
+ })),
924
+ [series]
925
+ );
926
+ const referenceLineColors = (0, import_react7.useMemo)(
927
+ () => referenceLineProps ? referenceLineProps.map(({ color }, index) => ({
928
+ __prefix: "ui",
929
+ name: `reference-line-${index}`,
930
+ token: "colors",
931
+ value: color != null ? color : "transparent"
932
+ })) : [],
933
+ [referenceLineProps]
934
+ );
935
+ const lineVars = (0, import_react7.useMemo)(
936
+ () => [
937
+ ...lineColors,
938
+ ...referenceLineColors,
939
+ { __prefix: "ui", name: "fill-opacity", value: fillOpacity }
940
+ ],
941
+ [fillOpacity, lineColors, referenceLineColors]
942
+ );
943
+ const [lineChartProps, lineChartClassName] = (0, import_react7.useMemo)(
944
+ () => {
945
+ var _a2;
946
+ return getComponentProps(
947
+ [(_a2 = rest.lineChartProps) != null ? _a2 : {}, lineChartProperties],
948
+ styles.chart
949
+ )(theme);
950
+ },
951
+ [rest.lineChartProps, styles.chart, theme]
952
+ );
953
+ const [lineProps, lineClassName] = (0, import_react7.useMemo)(() => {
954
+ const resolvedLineProps = {
955
+ fillOpacity: "var(--ui-fill-opacity)",
956
+ strokeOpacity: "var(--ui-fill-opacity)",
957
+ ...computedLineProps
958
+ };
959
+ return getComponentProps(
960
+ [resolvedLineProps, lineProperties],
961
+ styles.line
962
+ )(theme);
963
+ }, [computedLineProps, styles.line, theme]);
964
+ const [dimLineProps, dimLineClassName] = (0, import_react7.useMemo)(() => {
965
+ const resolvedDimLine = { fillOpacity: 0, strokeOpacity: 0.3, ...dimLine };
966
+ return getComponentProps([resolvedDimLine, lineProperties])(
967
+ theme
968
+ );
969
+ }, [dimLine, theme]);
970
+ const [dotProps, dotClassName] = (0, import_react7.useMemo)(() => {
971
+ const resolvedDot = { fillOpacity: 1, strokeOpacity: 1, ...dot };
972
+ return getComponentProps(
973
+ [resolvedDot, dotProperties],
974
+ styles.dot
975
+ )(theme);
976
+ }, [dot, styles.dot, theme]);
977
+ const [activeDotProps, activeDotClassName] = (0, import_react7.useMemo)(
978
+ () => getComponentProps(
979
+ [activeDot, dotProperties],
980
+ styles.activeDot
981
+ )(theme),
982
+ [activeDot, styles.activeDot, theme]
983
+ );
984
+ const [dimDotProps, dimDotClassName] = (0, import_react7.useMemo)(() => {
985
+ const resolvedDimDot = {
986
+ fillOpacity: 0,
987
+ strokeOpacity: 0,
988
+ ...dimDot
989
+ };
990
+ return getComponentProps([resolvedDimDot, dotProperties])(
991
+ theme
992
+ );
993
+ }, [dimDot, theme]);
994
+ const linePropList = (0, import_react7.useMemo)(
995
+ () => series.map((props, index) => {
996
+ const {
997
+ dataKey,
998
+ dot: dot2 = {},
999
+ activeDot: activeDot2 = {},
1000
+ dimDot: dimDot2 = {},
1001
+ dimLine: dimLine2 = {},
1002
+ ...computedProps
1003
+ } = props;
1004
+ const color = `var(--ui-line-${index})`;
1005
+ const dimmed = shouldHighlight && highlightedArea !== dataKey;
1006
+ const computedDimLine = { ...dimLineProps, ...dimLine2 };
1007
+ const resolvedProps = {
1008
+ ...lineProps,
1009
+ ...computedProps,
1010
+ ...dimmed ? computedDimLine : {}
1011
+ };
1012
+ const rest2 = getComponentProps(
1013
+ [resolvedProps, lineProperties],
1014
+ lineClassName,
1015
+ dimmed ? dimLineClassName : void 0
1016
+ )(theme, true);
1017
+ let resolvedActiveDot;
1018
+ if (withActiveDots) {
1019
+ const computedActiveDot = { ...activeDotProps, ...activeDot2 };
1020
+ const [rest3, className] = getComponentProps(
1021
+ [computedActiveDot, dotProperties],
1022
+ activeDotClassName
1023
+ )(theme);
1024
+ resolvedActiveDot = {
1025
+ className: (0, import_utils10.cx)("ui-line-chart__active-dot", className),
1026
+ fill: color,
1027
+ stroke: color,
1028
+ r: 4,
1029
+ ...rest3
1030
+ };
1031
+ } else {
1032
+ resolvedActiveDot = false;
1033
+ }
1034
+ let resolvedDot;
1035
+ if (withDots) {
1036
+ const computedDimDot = { ...dimDotProps, ...dimDot2 };
1037
+ const computedDot = {
1038
+ ...dotProps,
1039
+ ...dot2,
1040
+ ...dimmed ? computedDimDot : {}
1041
+ };
1042
+ const [rest3, className] = getComponentProps(
1043
+ [computedDot, dotProperties],
1044
+ dotClassName,
1045
+ dimmed ? dimDotClassName : void 0
1046
+ )(theme);
1047
+ resolvedDot = {
1048
+ className: (0, import_utils10.cx)("ui-line-chart__dot", className),
1049
+ fill: color,
1050
+ ...rest3
1051
+ };
1052
+ } else {
1053
+ resolvedDot = false;
1054
+ }
1055
+ return {
1056
+ ...rest2,
1057
+ color,
1058
+ dataKey,
1059
+ activeDot: resolvedActiveDot,
1060
+ dot: resolvedDot
1061
+ };
1062
+ }),
1063
+ [
1064
+ series,
1065
+ shouldHighlight,
1066
+ highlightedArea,
1067
+ dimLineProps,
1068
+ lineProps,
1069
+ lineClassName,
1070
+ dimLineClassName,
1071
+ theme,
1072
+ withActiveDots,
1073
+ withDots,
1074
+ activeDotProps,
1075
+ activeDotClassName,
1076
+ dimDotProps,
1077
+ dotProps,
1078
+ dotClassName,
1079
+ dimDotClassName
1080
+ ]
1081
+ );
1082
+ const getLineChartProps = (0, import_react7.useCallback)(
1083
+ ({ className, ...props } = {}, ref = null) => ({
1084
+ ref,
1085
+ className: (0, import_utils10.cx)(className, lineChartClassName),
1086
+ data,
1087
+ layout: layoutType,
1088
+ ...props,
1089
+ ...lineChartProps
1090
+ }),
1091
+ [data, layoutType, lineChartClassName, lineChartProps]
1092
+ );
1093
+ const getLineProps = (0, import_react7.useCallback)(
1094
+ ({ index, className: classNameProp, ...props }, ref = null) => {
1095
+ const { color, className, dataKey, activeDot: activeDot2, dot: dot2, ...rest2 } = linePropList[index];
1096
+ return {
1097
+ ref,
1098
+ className: (0, import_utils10.cx)(classNameProp, className),
1099
+ activeDot: activeDot2,
1100
+ dot: dot2,
1101
+ name: dataKey,
1102
+ type: curveType,
1103
+ dataKey,
1104
+ fill: color,
1105
+ strokeWidth,
1106
+ stroke: color,
1107
+ isAnimationActive: false,
1108
+ connectNulls,
1109
+ ...props,
1110
+ ...rest2
1111
+ };
1112
+ },
1113
+ [connectNulls, curveType, linePropList, strokeWidth]
1114
+ );
1115
+ return {
1116
+ getLineProps,
1117
+ getLineChartProps,
1118
+ lineVars,
1119
+ setHighlightedArea
1120
+ };
1121
+ };
1122
+
1123
+ // src/line-chart.tsx
1124
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1125
+ var LineChart = (0, import_core9.forwardRef)((props, ref) => {
1126
+ const [styles, mergedProps] = (0, import_core9.useMultiComponentStyle)("LineChart", props);
1127
+ const {
1128
+ className,
1129
+ containerProps,
1130
+ gridProps,
1131
+ gridAxis,
1132
+ strokeDasharray,
1133
+ dataKey,
1134
+ type,
1135
+ layoutType,
1136
+ tickLine,
1137
+ withXAxis,
1138
+ withYAxis,
1139
+ xAxisProps,
1140
+ yAxisProps,
1141
+ unit,
1142
+ valueFormatter,
1143
+ referenceLineProps,
1144
+ tooltipProps,
1145
+ tooltipAnimationDuration,
1146
+ legendProps,
1147
+ withLegend = false,
1148
+ withTooltip = true,
1149
+ series,
1150
+ data,
1151
+ lineChartProps,
1152
+ lineProps,
1153
+ withDots,
1154
+ withActiveDots,
1155
+ curveType,
1156
+ strokeWidth,
1157
+ connectNulls,
1158
+ fillOpacity,
1159
+ ...rest
1160
+ } = (0, import_core9.omitThemeProps)(mergedProps);
1161
+ const { getLineProps, getLineChartProps, lineVars, setHighlightedArea } = useLineChart({
1162
+ layoutType,
1163
+ series,
1164
+ referenceLineProps,
1165
+ data,
1166
+ lineChartProps,
1167
+ lineProps,
1168
+ withDots,
1169
+ withActiveDots,
1170
+ curveType,
1171
+ strokeWidth,
1172
+ connectNulls,
1173
+ fillOpacity,
1174
+ styles
1175
+ });
1176
+ const { getContainerProps } = useChart({ containerProps });
1177
+ const { getXAxisProps, getYAxisProps } = useChartAxis({
1178
+ dataKey,
1179
+ type,
1180
+ layoutType,
1181
+ tickLine,
1182
+ gridAxis,
1183
+ withXAxis,
1184
+ withYAxis,
1185
+ xAxisProps,
1186
+ yAxisProps,
1187
+ unit,
1188
+ valueFormatter,
1189
+ styles
1190
+ });
1191
+ const { getReferenceLineProps } = useChartReferenceLine({
1192
+ referenceLineProps,
1193
+ styles
1194
+ });
1195
+ const { getGridProps } = useChartGrid({
1196
+ gridProps,
1197
+ gridAxis,
1198
+ strokeDasharray,
1199
+ styles
1200
+ });
1201
+ const {
1202
+ tooltipProps: computedTooltipProps,
1203
+ getTooltipProps,
1204
+ tooltipVars
1205
+ } = useChartTooltip({
1206
+ tooltipProps,
1207
+ tooltipAnimationDuration,
1208
+ styles
1209
+ });
1210
+ const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
1211
+ legendProps
1212
+ });
1213
+ const lines = (0, import_react8.useMemo)(
1214
+ () => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1215
+ import_recharts.Line,
1216
+ {
1217
+ ...getLineProps({ index, className: "ui-line-chart__line" })
1218
+ },
1219
+ `line-${dataKey2}`
1220
+ )),
1221
+ [getLineProps, series]
1222
+ );
1223
+ const referenceLinesItems = (0, import_react8.useMemo)(
1224
+ () => referenceLineProps == null ? void 0 : referenceLineProps.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1225
+ import_recharts.ReferenceLine,
1226
+ {
1227
+ ...getReferenceLineProps({
1228
+ index,
1229
+ className: "ui-line-chart__reference-line"
1230
+ })
1231
+ },
1232
+ `referenceLine-${index}`
1233
+ )),
1234
+ [getReferenceLineProps, referenceLineProps]
1235
+ );
1236
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1237
+ import_core9.ui.div,
1238
+ {
1239
+ ref,
1240
+ className: (0, import_utils11.cx)("ui-line-chart", className),
1241
+ var: [...lineVars, ...tooltipVars],
1242
+ __css: { maxW: "full", ...styles.container },
1243
+ ...rest,
1244
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1245
+ import_recharts.ResponsiveContainer,
1246
+ {
1247
+ ...getContainerProps({ className: "ui-line-chart__container" }),
1248
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1249
+ import_recharts.LineChart,
1250
+ {
1251
+ ...getLineChartProps({ className: "ui-line-chart__chart" }),
1252
+ children: [
1253
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1254
+ import_recharts.CartesianGrid,
1255
+ {
1256
+ ...getGridProps({ className: "ui-line-chart__grid" })
1257
+ }
1258
+ ),
1259
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts.XAxis, { ...getXAxisProps({ className: "ui-line-chart__x-axis" }) }),
1260
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts.YAxis, { ...getYAxisProps({ className: "ui-line-chart__y-axis" }) }),
1261
+ withLegend ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1262
+ import_recharts.Legend,
1263
+ {
1264
+ content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1265
+ ChartLegend,
1266
+ {
1267
+ className: "ui-line-chart__legend",
1268
+ payload,
1269
+ onHighlight: setHighlightedArea,
1270
+ ...computedLegendProps
1271
+ }
1272
+ ),
1273
+ ...getLegendProps()
1274
+ }
1275
+ ) : null,
1276
+ withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1277
+ import_recharts.Tooltip,
1278
+ {
1279
+ content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1280
+ ChartTooltip,
1281
+ {
1282
+ className: "ui-line-chart__tooltip",
1283
+ label,
1284
+ payload,
1285
+ valueFormatter,
1286
+ unit,
1287
+ ...computedTooltipProps
1288
+ }
1289
+ ),
1290
+ ...getTooltipProps()
1291
+ }
1292
+ ) : null,
1293
+ lines,
1294
+ referenceLinesItems
1295
+ ]
1296
+ }
1297
+ )
1298
+ }
1299
+ )
1300
+ }
1301
+ ) });
1302
+ });
1303
+
1304
+ // src/bar-chart.tsx
1305
+ var import_core11 = require("@yamada-ui/core");
1306
+ var import_utils13 = require("@yamada-ui/utils");
1307
+ var import_react10 = require("react");
1308
+ var import_recharts2 = require("recharts");
1309
+
1310
+ // src/use-bar-chart.ts
1311
+ var import_core10 = require("@yamada-ui/core");
1312
+ var import_utils12 = require("@yamada-ui/utils");
1313
+ var import_react9 = require("react");
1314
+ var useBarChart = ({
1315
+ data,
1316
+ series,
1317
+ type = "default",
1318
+ layoutType = "horizontal",
1319
+ referenceLineProps = [],
1320
+ fillOpacity = 1,
1321
+ styles,
1322
+ ...rest
1323
+ }) => {
1324
+ var _a;
1325
+ const uuid = (0, import_react9.useId)();
1326
+ const { theme } = (0, import_core10.useTheme)();
1327
+ const [highlightedArea, setHighlightedArea] = (0, import_react9.useState)(null);
1328
+ const stacked = type === "stacked" || type === "percent";
1329
+ const shouldHighlight = highlightedArea !== null;
1330
+ const {
1331
+ activeBar = {},
1332
+ background = {},
1333
+ dimBar,
1334
+ ...computedBarProps
1335
+ } = (_a = rest.barProps) != null ? _a : {};
1336
+ const barColors = (0, import_react9.useMemo)(
1337
+ () => series.map(({ color }, index) => ({
1338
+ __prefix: "ui",
1339
+ name: `bar-${index}`,
1340
+ token: "colors",
1341
+ value: color != null ? color : "transparent"
1342
+ })),
1343
+ [series]
1344
+ );
1345
+ const referenceLineColors = (0, import_react9.useMemo)(
1346
+ () => referenceLineProps.map(({ color }, index) => ({
1347
+ __prefix: "ui",
1348
+ name: `reference-line-${index}`,
1349
+ token: "colors",
1350
+ value: color != null ? color : "transparent"
1351
+ })),
1352
+ [referenceLineProps]
1353
+ );
1354
+ const barVars = (0, import_react9.useMemo)(() => {
1355
+ return [
1356
+ ...barColors,
1357
+ ...referenceLineColors,
1358
+ { __prefix: "ui", name: "fill-opacity", value: fillOpacity }
1359
+ ];
1360
+ }, [barColors, fillOpacity, referenceLineColors]);
1361
+ const [barChartProps, barChartClassName] = (0, import_react9.useMemo)(() => {
1362
+ const resolvedBarChartProps = { barGap: 8, ...rest.barChartProps };
1363
+ return getComponentProps(
1364
+ [resolvedBarChartProps, barChartProperties],
1365
+ styles.chart
1366
+ )(theme);
1367
+ }, [rest.barChartProps, styles.chart, theme]);
1368
+ const [barProps, barClassName] = (0, import_react9.useMemo)(() => {
1369
+ const resolvedBarProps = {
1370
+ fillOpacity: "var(--ui-fill-opacity)",
1371
+ strokeOpacity: 1,
1372
+ ...computedBarProps
1373
+ };
1374
+ return getComponentProps(
1375
+ [resolvedBarProps, barProperties],
1376
+ styles.bar
1377
+ )(theme);
1378
+ }, [computedBarProps, styles.bar, theme]);
1379
+ const [dimBarProps, dimBarClassName] = (0, import_react9.useMemo)(() => {
1380
+ const resolvedDimBar = { fillOpacity: 0.3, strokeOpacity: 0, ...dimBar };
1381
+ return getComponentProps([resolvedDimBar, barProperties])(
1382
+ theme
1383
+ );
1384
+ }, [dimBar, theme]);
1385
+ const [activeBarProps, activeBarClassName] = (0, import_react9.useMemo)(
1386
+ () => getComponentProps(
1387
+ [activeBar, barProperties],
1388
+ styles.activeBar
1389
+ )(theme),
1390
+ [activeBar, styles.activeBar, theme]
1391
+ );
1392
+ const [backgroundProps, backgroundClassName] = (0, import_react9.useMemo)(
1393
+ () => getComponentProps(
1394
+ [background, barProperties],
1395
+ styles.background
1396
+ )(theme),
1397
+ [background, styles.background, theme]
1398
+ );
1399
+ const barPropsList = (0, import_react9.useMemo)(
1400
+ () => series.map((props, index) => {
1401
+ const {
1402
+ dataKey,
1403
+ activeBar: activeBar2 = {},
1404
+ background: background2 = {},
1405
+ dimBar: dimBar2 = {},
1406
+ ...computedProps
1407
+ } = props;
1408
+ const id = `${uuid}-${dataKey}`;
1409
+ const color = `var(--ui-bar-${index})`;
1410
+ const dimmed = shouldHighlight && highlightedArea !== dataKey;
1411
+ const computedDimBar = { ...dimBarProps, ...dimBar2 };
1412
+ const resolvedProps = {
1413
+ ...barProps,
1414
+ ...computedProps,
1415
+ ...dimmed ? computedDimBar : {}
1416
+ };
1417
+ const rest2 = getComponentProps(
1418
+ [resolvedProps, barProperties],
1419
+ barClassName,
1420
+ dimmed ? dimBarClassName : void 0
1421
+ )(theme, true);
1422
+ const computedActiveBar = { ...activeBarProps, ...activeBar2 };
1423
+ const resolvedActiveBar = getComponentProps(
1424
+ [computedActiveBar, barProperties],
1425
+ activeBarClassName
1426
+ )(theme, true);
1427
+ const computedBackground = { ...backgroundProps, ...background2 };
1428
+ const resolvedBackground = getComponentProps(
1429
+ [computedBackground, barProperties],
1430
+ backgroundClassName
1431
+ )(theme, true);
1432
+ return {
1433
+ ...rest2,
1434
+ id,
1435
+ activeBar: resolvedActiveBar,
1436
+ background: resolvedBackground,
1437
+ color,
1438
+ dataKey
1439
+ };
1440
+ }),
1441
+ [
1442
+ activeBarClassName,
1443
+ activeBarProps,
1444
+ backgroundClassName,
1445
+ backgroundProps,
1446
+ barClassName,
1447
+ barProps,
1448
+ dimBarClassName,
1449
+ dimBarProps,
1450
+ highlightedArea,
1451
+ series,
1452
+ shouldHighlight,
1453
+ theme,
1454
+ uuid
1455
+ ]
1456
+ );
1457
+ const getBarProps = (0, import_react9.useCallback)(
1458
+ ({ index, className: classNameProp, ...props }, ref = null) => {
1459
+ const { id, className, activeBar: activeBar2, background: background2, color, dataKey, ...rest2 } = barPropsList[index];
1460
+ return {
1461
+ ref,
1462
+ className: (0, import_utils12.cx)(classNameProp, className),
1463
+ activeBar: activeBar2,
1464
+ background: background2,
1465
+ id,
1466
+ name: dataKey,
1467
+ dataKey,
1468
+ fill: color,
1469
+ stroke: color,
1470
+ isAnimationActive: false,
1471
+ stackId: stacked ? "stack" : void 0,
1472
+ ...props,
1473
+ ...rest2
1474
+ };
1475
+ },
1476
+ [barPropsList, stacked]
1477
+ );
1478
+ const getBarChartProps = (0, import_react9.useCallback)(
1479
+ ({ className, ...props } = {}, ref = null) => ({
1480
+ ref,
1481
+ className: (0, import_utils12.cx)(className, barChartClassName),
1482
+ data,
1483
+ stackOffset: type === "percent" ? "expand" : void 0,
1484
+ layout: layoutType,
1485
+ ...props,
1486
+ ...barChartProps
1487
+ }),
1488
+ [barChartClassName, barChartProps, data, layoutType, type]
1489
+ );
1490
+ return {
1491
+ barVars,
1492
+ getBarProps,
1493
+ getBarChartProps,
1494
+ setHighlightedArea
1495
+ };
1496
+ };
1497
+
1498
+ // src/bar-chart.tsx
1499
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1500
+ var BarChart = (0, import_core11.forwardRef)((props, ref) => {
1501
+ const [styles, mergedProps] = (0, import_core11.useMultiComponentStyle)("BarChart", props);
1502
+ const {
1503
+ className,
1504
+ series,
1505
+ dataKey,
1506
+ layoutType,
1507
+ tickLine,
1508
+ gridAxis,
1509
+ withXAxis,
1510
+ withYAxis,
1511
+ barProps,
1512
+ xAxisProps,
1513
+ yAxisProps,
1514
+ type = "default",
1515
+ withTooltip = true,
1516
+ withLegend = false,
1517
+ containerProps,
1518
+ unit,
1519
+ valueFormatter,
1520
+ tooltipProps,
1521
+ tooltipAnimationDuration,
1522
+ legendProps,
1523
+ data,
1524
+ referenceLineProps = [],
1525
+ gridProps,
1526
+ strokeDasharray,
1527
+ fillOpacity,
1528
+ barChartProps,
1529
+ ...rest
1530
+ } = (0, import_core11.omitThemeProps)(mergedProps);
1531
+ const { getBarChartProps, getBarProps, barVars, setHighlightedArea } = useBarChart({
1532
+ data,
1533
+ series,
1534
+ type,
1535
+ layoutType,
1536
+ barChartProps,
1537
+ barProps,
1538
+ referenceLineProps,
1539
+ fillOpacity,
1540
+ styles
1541
+ });
1542
+ const { getContainerProps } = useChart({ containerProps });
1543
+ const { getXAxisProps, getYAxisProps } = useChartAxis({
1544
+ dataKey,
1545
+ type,
1546
+ layoutType,
1547
+ tickLine,
1548
+ gridAxis,
1549
+ withXAxis,
1550
+ withYAxis,
1551
+ xAxisProps,
1552
+ yAxisProps,
1553
+ unit,
1554
+ valueFormatter,
1555
+ styles
1556
+ });
1557
+ const { getReferenceLineProps } = useChartReferenceLine({
1558
+ referenceLineProps,
1559
+ styles
1560
+ });
1561
+ const { getGridProps } = useChartGrid({
1562
+ gridProps,
1563
+ gridAxis,
1564
+ strokeDasharray,
1565
+ styles
1566
+ });
1567
+ const {
1568
+ tooltipProps: computedTooltipProps,
1569
+ getTooltipProps,
1570
+ tooltipVars
1571
+ } = useChartTooltip({
1572
+ tooltipProps,
1573
+ tooltipAnimationDuration,
1574
+ styles
1575
+ });
1576
+ const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
1577
+ legendProps
1578
+ });
1579
+ const bars = (0, import_react10.useMemo)(
1580
+ () => series.map(({ dataKey: dataKey2 }, index) => {
1581
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1582
+ import_recharts2.Bar,
1583
+ {
1584
+ ...getBarProps({ index, className: "ui-bar-chart__bar" })
1585
+ },
1586
+ `bar-${dataKey2}`
1587
+ );
1588
+ }),
1589
+ [getBarProps, series]
1590
+ );
1591
+ const referenceLinesItems = (0, import_react10.useMemo)(
1592
+ () => referenceLineProps.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1593
+ import_recharts2.ReferenceLine,
1594
+ {
1595
+ ...getReferenceLineProps({
1596
+ index,
1597
+ className: "ui-bar-chart__reference-line"
1598
+ })
1599
+ },
1600
+ `referenceLine-${index}`
1601
+ )),
1602
+ [getReferenceLineProps, referenceLineProps]
1603
+ );
1604
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1605
+ import_core11.ui.div,
1606
+ {
1607
+ ref,
1608
+ className: (0, import_utils13.cx)("ui-bar-chart", className),
1609
+ var: [...barVars, ...tooltipVars],
1610
+ __css: { maxW: "full", ...styles.container },
1611
+ ...rest,
1612
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1613
+ import_recharts2.ResponsiveContainer,
1614
+ {
1615
+ ...getContainerProps({ className: "ui-bar-chart__container" }),
1616
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1617
+ import_recharts2.BarChart,
1618
+ {
1619
+ ...getBarChartProps({ className: "ui-bar-chart__chart" }),
1620
+ children: [
1621
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1622
+ import_recharts2.CartesianGrid,
1623
+ {
1624
+ ...getGridProps({ className: "ui-area-chart__grid" })
1625
+ }
1626
+ ),
1627
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts2.XAxis, { ...getXAxisProps({ className: "ui-bar-chart__x-axis" }) }),
1628
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts2.YAxis, { ...getYAxisProps({ className: "ui-bar-chart__y-axis" }) }),
1629
+ withLegend ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1630
+ import_recharts2.Legend,
1631
+ {
1632
+ content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1633
+ ChartLegend,
1634
+ {
1635
+ className: "ui-bar-chart__legend",
1636
+ payload,
1637
+ onHighlight: setHighlightedArea,
1638
+ ...computedLegendProps
1639
+ }
1640
+ ),
1641
+ ...getLegendProps()
1642
+ }
1643
+ ) : null,
1644
+ withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1645
+ import_recharts2.Tooltip,
1646
+ {
1647
+ content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1648
+ ChartTooltip,
1649
+ {
1650
+ className: "ui-bar-chart__tooltip",
1651
+ label,
1652
+ payload,
1653
+ valueFormatter,
1654
+ unit,
1655
+ ...computedTooltipProps
1656
+ }
1657
+ ),
1658
+ ...getTooltipProps()
1659
+ }
1660
+ ) : null,
1661
+ bars,
1662
+ referenceLinesItems
1663
+ ]
1664
+ }
1665
+ )
1666
+ }
1667
+ )
1668
+ }
1669
+ ) });
1670
+ });
1671
+
1672
+ // src/area-chart.tsx
1673
+ var import_core13 = require("@yamada-ui/core");
1674
+ var import_utils15 = require("@yamada-ui/utils");
1675
+ var import_react12 = require("react");
1676
+ var import_recharts3 = require("recharts");
1677
+
1678
+ // src/area-chart-gradient.tsx
1679
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1680
+ var AreaGradient = ({
1681
+ color,
1682
+ id,
1683
+ withGradient,
1684
+ fillOpacity
1685
+ }) => {
1686
+ if (withGradient) {
1687
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
1688
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: fillOpacity }),
1689
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: 0.01 })
1690
+ ] });
1691
+ } else {
1692
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("stop", { stopColor: color, stopOpacity: fillOpacity }) });
1693
+ }
1694
+ };
1695
+
1696
+ // src/area-chart-split.tsx
1697
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1698
+ var AreaSplit = ({ offset, id, fillOpacity }) => {
1699
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
1700
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1701
+ "stop",
1702
+ {
1703
+ offset,
1704
+ stopColor: "var(--ui-area-split-0)",
1705
+ stopOpacity: fillOpacity != null ? fillOpacity : 0.4
1706
+ }
1707
+ ),
1708
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1709
+ "stop",
1710
+ {
1711
+ offset,
1712
+ stopColor: "var(--ui-area-split-1)",
1713
+ stopOpacity: fillOpacity != null ? fillOpacity : 0.4
1714
+ }
1715
+ )
1716
+ ] });
1717
+ };
1718
+
1719
+ // src/use-area-chart.ts
1720
+ var import_core12 = require("@yamada-ui/core");
1721
+ var import_utils14 = require("@yamada-ui/utils");
1722
+ var import_react11 = require("react");
1723
+ var useAreaChart = ({
1724
+ data,
1725
+ series,
1726
+ type,
1727
+ layoutType = "horizontal",
1728
+ withGradient: withGradientProp,
1729
+ withDots = true,
1730
+ withActiveDots = true,
1731
+ curveType = "monotone",
1732
+ strokeWidth = 2,
1733
+ connectNulls = true,
1734
+ fillOpacity = 0.4,
1735
+ splitColors = ["#ee6a5d", "#5fce7d"],
1736
+ splitOffset,
1737
+ referenceLineProps,
1738
+ styles,
1739
+ ...rest
1740
+ }) => {
1741
+ var _a;
1742
+ const uuid = (0, import_react11.useId)();
1743
+ const { theme } = (0, import_core12.useTheme)();
1744
+ const [highlightedArea, setHighlightedArea] = (0, import_react11.useState)(null);
1745
+ const splitId = `${uuid}-split`;
1746
+ const stacked = type === "stacked" || type === "percent";
1747
+ const withGradient = typeof withGradientProp === "boolean" ? withGradientProp : type === "default";
1748
+ const shouldHighlight = highlightedArea !== null;
1749
+ const {
1750
+ dot = {},
1751
+ activeDot = {},
1752
+ dimDot,
1753
+ dimArea,
1754
+ ...computedAreaProps
1755
+ } = (_a = rest.areaProps) != null ? _a : {};
1756
+ const areaColors = (0, import_react11.useMemo)(
1757
+ () => series.map(({ color }, index) => ({
1758
+ __prefix: "ui",
1759
+ name: `area-${index}`,
1760
+ token: "colors",
1761
+ value: color != null ? color : "transparent"
1762
+ })),
1763
+ [series]
1764
+ );
1765
+ const areaSplitColors = (0, import_react11.useMemo)(
1766
+ () => splitColors.map((color, index) => ({
1767
+ __prefix: "ui",
1768
+ name: `area-split-${index}`,
1769
+ token: "colors",
1770
+ value: color != null ? color : "transparent"
1771
+ })),
1772
+ [splitColors]
1773
+ );
1774
+ const referenceLineColors = (0, import_react11.useMemo)(
1775
+ () => referenceLineProps ? referenceLineProps.map(({ color }, index) => ({
1776
+ __prefix: "ui",
1777
+ name: `reference-line-${index}`,
1778
+ token: "colors",
1779
+ value: color != null ? color : "transparent"
1780
+ })) : [],
1781
+ [referenceLineProps]
1782
+ );
1783
+ const areaVars = (0, import_react11.useMemo)(() => {
1784
+ return [
1785
+ ...areaColors,
1786
+ ...areaSplitColors,
1787
+ ...referenceLineColors,
1788
+ { __prefix: "ui", name: "fill-opacity", value: fillOpacity }
1789
+ ];
1790
+ }, [areaColors, areaSplitColors, referenceLineColors, fillOpacity]);
1791
+ const [areaChartProps, areaChartClassName] = (0, import_react11.useMemo)(
1792
+ () => {
1793
+ var _a2;
1794
+ return getComponentProps(
1795
+ [(_a2 = rest.areaChartProps) != null ? _a2 : {}, areaChartProperties],
1796
+ styles.chart
1797
+ )(theme);
1798
+ },
1799
+ [rest.areaChartProps, styles.chart, theme]
1800
+ );
1801
+ const [areaProps, areaClassName] = (0, import_react11.useMemo)(() => {
1802
+ const resolvedAreaProps = {
1803
+ fillOpacity: 1,
1804
+ strokeOpacity: 1,
1805
+ ...computedAreaProps
1806
+ };
1807
+ return getComponentProps(
1808
+ [resolvedAreaProps, areaProperties],
1809
+ styles.area
1810
+ )(theme);
1811
+ }, [computedAreaProps, styles.area, theme]);
1812
+ const [dimAreaProps, dimAreaClassName] = (0, import_react11.useMemo)(() => {
1813
+ const resolvedDimArea = {
1814
+ fillOpacity: 0,
1815
+ strokeOpacity: 0.3,
1816
+ ...dimArea
1817
+ };
1818
+ return getComponentProps([resolvedDimArea, areaProperties])(
1819
+ theme
1820
+ );
1821
+ }, [dimArea, theme]);
1822
+ const [dotProps, dotClassName] = (0, import_react11.useMemo)(() => {
1823
+ const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
1824
+ return getComponentProps(
1825
+ [resolvedDot, dotProperties],
1826
+ styles.dot
1827
+ )(theme);
1828
+ }, [dot, styles.dot, theme]);
1829
+ const [activeDotProps, activeDotClassName] = (0, import_react11.useMemo)(
1830
+ () => getComponentProps(
1831
+ [activeDot, dotProperties],
1832
+ styles.activeDot
1833
+ )(theme),
1834
+ [activeDot, styles.activeDot, theme]
1835
+ );
1836
+ const [dimDotProps, dimDotClassName] = (0, import_react11.useMemo)(() => {
1837
+ const resolvedDimDot = { fillOpacity: 0, strokeOpacity: 0, ...dimDot };
1838
+ return getComponentProps([resolvedDimDot, dotProperties])(
1839
+ theme
1840
+ );
1841
+ }, [dimDot, theme]);
1842
+ const defaultSplitOffset = (0, import_react11.useMemo)(() => {
1843
+ if (series.length === 1) {
1844
+ const dataKey = series[0].dataKey;
1845
+ const dataMax = Math.max(...data.map((item) => item[dataKey]));
1846
+ const dataMin = Math.min(...data.map((item) => item[dataKey]));
1847
+ if (dataMax <= 0)
1848
+ return 0;
1849
+ if (dataMin >= 0)
1850
+ return 1;
1851
+ return dataMax / (dataMax - dataMin);
1852
+ }
1853
+ return 0.5;
1854
+ }, [data, series]);
1855
+ const areaPropsList = (0, import_react11.useMemo)(
1856
+ () => series.map((props, index) => {
1857
+ const {
1858
+ dataKey,
1859
+ dot: dot2 = {},
1860
+ activeDot: activeDot2 = {},
1861
+ dimDot: dimDot2 = {},
1862
+ dimArea: dimArea2 = {},
1863
+ strokeDasharray,
1864
+ ...computedProps
1865
+ } = props;
1866
+ const id = `${uuid}-${dataKey}`;
1867
+ const color = `var(--ui-area-${index})`;
1868
+ const dimmed = shouldHighlight && highlightedArea !== dataKey;
1869
+ const computedDimArea = { ...dimAreaProps, ...dimArea2 };
1870
+ const resolvedProps = {
1871
+ ...areaProps,
1872
+ ...computedProps,
1873
+ ...dimmed ? computedDimArea : {}
1874
+ };
1875
+ const rest2 = getComponentProps(
1876
+ [resolvedProps, areaProperties],
1877
+ areaClassName,
1878
+ dimmed ? dimAreaClassName : void 0
1879
+ )(theme, true);
1880
+ let resolvedActiveDot;
1881
+ if (withActiveDots) {
1882
+ const computedActiveDot = { ...activeDotProps, ...activeDot2 };
1883
+ const [rest3, className] = getComponentProps(
1884
+ [computedActiveDot, dotProperties],
1885
+ activeDotClassName
1886
+ )(theme);
1887
+ resolvedActiveDot = {
1888
+ className: (0, import_utils14.cx)("ui-area-chart__active-dot", className),
1889
+ stroke: color,
1890
+ r: 4,
1891
+ ...rest3
1892
+ };
1893
+ } else {
1894
+ resolvedActiveDot = false;
1895
+ }
1896
+ let resolvedDot;
1897
+ if (withDots) {
1898
+ const computedDimDot = { ...dimDotProps, ...dimDot2 };
1899
+ const computedDot = {
1900
+ ...dotProps,
1901
+ ...dot2,
1902
+ ...dimmed ? computedDimDot : {}
1903
+ };
1904
+ const [rest3, className] = getComponentProps(
1905
+ [computedDot, dotProperties],
1906
+ dotClassName,
1907
+ dimmed ? dimDotClassName : void 0
1908
+ )(theme);
1909
+ resolvedDot = {
1910
+ className: (0, import_utils14.cx)("ui-area-chart__dot", className),
1911
+ fill: color,
1912
+ r: 4,
1913
+ ...rest3
1914
+ };
1915
+ } else {
1916
+ resolvedDot = false;
1917
+ }
1918
+ return {
1919
+ ...rest2,
1920
+ id,
1921
+ color,
1922
+ strokeDasharray,
1923
+ dataKey,
1924
+ activeDot: resolvedActiveDot,
1925
+ dot: resolvedDot
1926
+ };
1927
+ }),
1928
+ [
1929
+ series,
1930
+ uuid,
1931
+ shouldHighlight,
1932
+ highlightedArea,
1933
+ dimAreaProps,
1934
+ dimDotProps,
1935
+ areaProps,
1936
+ areaClassName,
1937
+ dimAreaClassName,
1938
+ theme,
1939
+ withActiveDots,
1940
+ withDots,
1941
+ activeDotProps,
1942
+ activeDotClassName,
1943
+ dotProps,
1944
+ dotClassName,
1945
+ dimDotClassName
1946
+ ]
1947
+ );
1948
+ const getAreaChartProps = (0, import_react11.useCallback)(
1949
+ ({ className, ...props } = {}, ref = null) => ({
1950
+ ref,
1951
+ className: (0, import_utils14.cx)(className, areaChartClassName),
1952
+ data,
1953
+ stackOffset: type === "percent" ? "expand" : void 0,
1954
+ layout: layoutType,
1955
+ ...props,
1956
+ ...areaChartProps
1957
+ }),
1958
+ [areaChartClassName, data, type, layoutType, areaChartProps]
1959
+ );
1960
+ const getAreaSplitProps = (0, import_react11.useCallback)(
1961
+ (props = {}) => ({
1962
+ id: splitId,
1963
+ offset: splitOffset != null ? splitOffset : defaultSplitOffset,
1964
+ fillOpacity: "var(--ui-fill-opacity)",
1965
+ ...props
1966
+ }),
1967
+ [defaultSplitOffset, splitId, splitOffset]
1968
+ );
1969
+ const getAreaProps = (0, import_react11.useCallback)(
1970
+ ({ index, className: classNameProp, ...props }, ref = null) => {
1971
+ const {
1972
+ id,
1973
+ color,
1974
+ className,
1975
+ dataKey,
1976
+ strokeDasharray,
1977
+ activeDot: activeDot2,
1978
+ dot: dot2,
1979
+ ...rest2
1980
+ } = areaPropsList[index];
1981
+ return {
1982
+ ref,
1983
+ className: (0, import_utils14.cx)(classNameProp, className),
1984
+ id,
1985
+ activeDot: activeDot2,
1986
+ dot: dot2,
1987
+ name: dataKey,
1988
+ type: curveType,
1989
+ dataKey,
1990
+ fill: type === "split" ? `url(#${splitId})` : `url(#${id})`,
1991
+ strokeWidth,
1992
+ stroke: color,
1993
+ isAnimationActive: false,
1994
+ connectNulls,
1995
+ stackId: stacked ? "stack" : void 0,
1996
+ strokeDasharray,
1997
+ ...props,
1998
+ ...rest2
1999
+ };
2000
+ },
2001
+ [
2002
+ areaPropsList,
2003
+ connectNulls,
2004
+ curveType,
2005
+ splitId,
2006
+ stacked,
2007
+ strokeWidth,
2008
+ type
2009
+ ]
2010
+ );
2011
+ const getAreaGradientProps = (0, import_react11.useCallback)(
2012
+ (props = {}) => ({
2013
+ withGradient,
2014
+ fillOpacity: "var(--ui-fill-opacity)",
2015
+ ...props
2016
+ }),
2017
+ [withGradient]
2018
+ );
2019
+ return {
2020
+ getAreaChartProps,
2021
+ getAreaSplitProps,
2022
+ getAreaProps,
2023
+ getAreaGradientProps,
2024
+ areaVars,
2025
+ setHighlightedArea
2026
+ };
2027
+ };
2028
+
2029
+ // src/area-chart.tsx
2030
+ var import_jsx_runtime7 = require("react/jsx-runtime");
2031
+ var AreaChart = (0, import_core13.forwardRef)((props, ref) => {
2032
+ const [styles, mergedProps] = (0, import_core13.useMultiComponentStyle)("AreaChart", props);
2033
+ const {
2034
+ className,
2035
+ series,
2036
+ dataKey,
2037
+ layoutType,
2038
+ tickLine,
2039
+ gridAxis,
2040
+ withXAxis,
2041
+ withYAxis,
2042
+ xAxisProps,
2043
+ yAxisProps,
2044
+ type = "default",
2045
+ withTooltip = true,
2046
+ withLegend = false,
2047
+ referenceLineProps = [],
2048
+ containerProps,
2049
+ unit,
2050
+ gridProps,
2051
+ strokeDasharray,
2052
+ valueFormatter,
2053
+ tooltipProps,
2054
+ tooltipAnimationDuration,
2055
+ legendProps,
2056
+ data,
2057
+ areaChartProps,
2058
+ areaProps,
2059
+ withGradient,
2060
+ withDots,
2061
+ withActiveDots,
2062
+ curveType,
2063
+ strokeWidth,
2064
+ connectNulls,
2065
+ fillOpacity,
2066
+ splitColors,
2067
+ splitOffset,
2068
+ ...rest
2069
+ } = (0, import_core13.omitThemeProps)(mergedProps);
2070
+ const {
2071
+ getAreaChartProps,
2072
+ getAreaSplitProps,
2073
+ getAreaProps,
2074
+ getAreaGradientProps,
2075
+ areaVars,
2076
+ setHighlightedArea
2077
+ } = useAreaChart({
2078
+ layoutType,
2079
+ type,
2080
+ series,
2081
+ referenceLineProps,
2082
+ data,
2083
+ areaChartProps,
2084
+ areaProps,
2085
+ withGradient,
2086
+ withDots,
2087
+ withActiveDots,
2088
+ curveType,
2089
+ strokeWidth,
2090
+ connectNulls,
2091
+ fillOpacity,
2092
+ splitColors,
2093
+ splitOffset,
2094
+ styles
2095
+ });
2096
+ const { getContainerProps } = useChart({ containerProps });
2097
+ const { getXAxisProps, getYAxisProps } = useChartAxis({
2098
+ dataKey,
2099
+ type,
2100
+ layoutType,
2101
+ tickLine,
2102
+ gridAxis,
2103
+ withXAxis,
2104
+ withYAxis,
2105
+ xAxisProps,
2106
+ yAxisProps,
2107
+ unit,
2108
+ valueFormatter,
2109
+ styles
2110
+ });
2111
+ const { getReferenceLineProps } = useChartReferenceLine({
2112
+ referenceLineProps,
2113
+ styles
2114
+ });
2115
+ const { getGridProps } = useChartGrid({
2116
+ gridProps,
2117
+ gridAxis,
2118
+ strokeDasharray,
2119
+ styles
2120
+ });
2121
+ const {
2122
+ tooltipProps: computedTooltipProps,
2123
+ getTooltipProps,
2124
+ tooltipVars
2125
+ } = useChartTooltip({
2126
+ tooltipProps,
2127
+ tooltipAnimationDuration,
2128
+ styles
2129
+ });
2130
+ const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
2131
+ legendProps
2132
+ });
2133
+ const areas = (0, import_react12.useMemo)(
2134
+ () => series.map(({ dataKey: dataKey2 }, index) => {
2135
+ const { id, stroke, ...rest2 } = getAreaProps({
2136
+ index,
2137
+ className: "ui-area-chart__area"
2138
+ });
2139
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react12.Fragment, { children: [
2140
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AreaGradient, { ...getAreaGradientProps({ id, color: stroke }) }) }),
2141
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_recharts3.Area, { id, stroke, ...rest2 })
2142
+ ] }, `area-${dataKey2}`);
2143
+ }),
2144
+ [getAreaGradientProps, getAreaProps, series]
2145
+ );
2146
+ const referenceLinesItems = (0, import_react12.useMemo)(
2147
+ () => referenceLineProps.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2148
+ import_recharts3.ReferenceLine,
2149
+ {
2150
+ ...getReferenceLineProps({
2151
+ index,
2152
+ className: "ui-area-chart__reference-line"
2153
+ })
2154
+ },
2155
+ `referenceLine-${index}`
2156
+ )),
2157
+ [getReferenceLineProps, referenceLineProps]
2158
+ );
2159
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2160
+ import_core13.ui.div,
2161
+ {
2162
+ ref,
2163
+ className: (0, import_utils15.cx)("ui-area-chart", className),
2164
+ var: [...areaVars, ...tooltipVars],
2165
+ __css: { maxW: "full", ...styles.container },
2166
+ ...rest,
2167
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2168
+ import_recharts3.ResponsiveContainer,
2169
+ {
2170
+ ...getContainerProps({ className: "ui-area-chart__container" }),
2171
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2172
+ import_recharts3.AreaChart,
2173
+ {
2174
+ ...getAreaChartProps({ className: "ui-area-chart__chart" }),
2175
+ children: [
2176
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2177
+ import_recharts3.CartesianGrid,
2178
+ {
2179
+ ...getGridProps({ className: "ui-area-chart__grid" })
2180
+ }
2181
+ ),
2182
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_recharts3.XAxis, { ...getXAxisProps({ className: "ui-area-chart__x-axis" }) }),
2183
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_recharts3.YAxis, { ...getYAxisProps({ className: "ui-area-chart__y-axis" }) }),
2184
+ withLegend ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2185
+ import_recharts3.Legend,
2186
+ {
2187
+ content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2188
+ ChartLegend,
2189
+ {
2190
+ className: "ui-area-chart__legend",
2191
+ payload,
2192
+ onHighlight: setHighlightedArea,
2193
+ ...computedLegendProps
2194
+ }
2195
+ ),
2196
+ ...getLegendProps()
2197
+ }
2198
+ ) : null,
2199
+ withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2200
+ import_recharts3.Tooltip,
2201
+ {
2202
+ content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2203
+ ChartTooltip,
2204
+ {
2205
+ className: "ui-area-chart__tooltip",
2206
+ label,
2207
+ payload,
2208
+ valueFormatter,
2209
+ unit,
2210
+ ...computedTooltipProps
2211
+ }
2212
+ ),
2213
+ ...getTooltipProps()
2214
+ }
2215
+ ) : null,
2216
+ type === "split" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AreaSplit, { ...getAreaSplitProps() }) }) : null,
2217
+ areas,
2218
+ referenceLinesItems
2219
+ ]
2220
+ }
2221
+ )
2222
+ }
2223
+ )
2224
+ }
2225
+ ) });
2226
+ });
2227
+
2228
+ // src/radar-chart.tsx
2229
+ var import_core15 = require("@yamada-ui/core");
2230
+ var import_utils17 = require("@yamada-ui/utils");
2231
+ var import_react14 = require("react");
2232
+ var import_recharts4 = require("recharts");
2233
+
2234
+ // src/use-radar-chart.ts
2235
+ var import_core14 = require("@yamada-ui/core");
2236
+ var import_utils16 = require("@yamada-ui/utils");
2237
+ var import_react13 = require("react");
2238
+ var useRadarChart = ({
2239
+ data,
2240
+ series,
2241
+ dataKey,
2242
+ withDots = false,
2243
+ withActiveDots = false,
2244
+ strokeWidth = 2,
2245
+ fillOpacity = 0.4,
2246
+ valueFormatter,
2247
+ styles,
2248
+ ...rest
2249
+ }) => {
2250
+ var _a;
2251
+ const { theme } = (0, import_core14.useTheme)();
2252
+ const [highlightedArea, setHighlightedArea] = (0, import_react13.useState)(null);
2253
+ const shouldHighlight = highlightedArea !== null;
2254
+ const {
2255
+ dot = {},
2256
+ activeDot = {},
2257
+ dimDot,
2258
+ dimRadar,
2259
+ ...computedRadarProps
2260
+ } = (_a = rest.radarProps) != null ? _a : {};
2261
+ const radarColors = (0, import_react13.useMemo)(
2262
+ () => series.map(({ color }, index) => ({
2263
+ __prefix: "ui",
2264
+ name: `radar-${index}`,
2265
+ token: "colors",
2266
+ value: color != null ? color : "transparent"
2267
+ })),
2268
+ [series]
2269
+ );
2270
+ const radarVars = (0, import_react13.useMemo)(
2271
+ () => [
2272
+ ...radarColors,
2273
+ { __prefix: "ui", name: "fill-opacity", value: fillOpacity }
2274
+ ],
2275
+ [fillOpacity, radarColors]
2276
+ );
2277
+ const [polarAngleAxisProps, polarAngleAxisStyles] = (0, import_react13.useMemo)(
2278
+ () => {
2279
+ var _a2;
2280
+ return (0, import_utils16.splitObject)(
2281
+ (_a2 = rest.polarAngleAxisProps) != null ? _a2 : {},
2282
+ polarAngleAxisProperties
2283
+ );
2284
+ },
2285
+ [rest.polarAngleAxisProps]
2286
+ );
2287
+ const [polarRadiusAxisProps, polarRadiusAxisStyles] = (0, import_react13.useMemo)(
2288
+ () => {
2289
+ var _a2;
2290
+ return (0, import_utils16.splitObject)(
2291
+ (_a2 = rest.polarRadiusAxisProps) != null ? _a2 : {},
2292
+ polarRadiusAxisProperties
2293
+ );
2294
+ },
2295
+ [rest.polarRadiusAxisProps]
2296
+ );
2297
+ const [radarChartProps, radarChartClassName] = (0, import_react13.useMemo)(() => {
2298
+ const resolvedRadarChartProps = {
2299
+ "& .recharts-polar-grid-concentric-polygon": { ...styles.polarGrid },
2300
+ "& .recharts-polar-grid-concentric-circle": { ...styles.polarGrid },
2301
+ "& .recharts-polar-angle-axis": {
2302
+ ...styles.polarAngleAxis,
2303
+ ...polarAngleAxisStyles
2304
+ },
2305
+ "& .recharts-polar-angle-axis-tick": { ...styles.polarAngleAxisTick },
2306
+ "& .recharts-polar-radius-axis": {
2307
+ ...styles.polarRadiusAxis,
2308
+ ...polarRadiusAxisStyles
2309
+ },
2310
+ "& .recharts-polar-radius-axis-tick": { ...styles.polarRadiusAxisTick },
2311
+ ...rest.radarChartProps
2312
+ };
2313
+ return getComponentProps(
2314
+ [resolvedRadarChartProps, radarChartProperties],
2315
+ styles.chart
2316
+ )(theme);
2317
+ }, [
2318
+ polarAngleAxisStyles,
2319
+ polarRadiusAxisStyles,
2320
+ rest.radarChartProps,
2321
+ styles.chart,
2322
+ styles.polarAngleAxis,
2323
+ styles.polarAngleAxisTick,
2324
+ styles.polarGrid,
2325
+ styles.polarRadiusAxis,
2326
+ styles.polarRadiusAxisTick,
2327
+ theme
2328
+ ]);
2329
+ const [polarGridProps, polarGridClassName] = (0, import_react13.useMemo)(
2330
+ () => {
2331
+ var _a2;
2332
+ return getComponentProps(
2333
+ [(_a2 = rest.polarGridProps) != null ? _a2 : {}, polarGridProperties],
2334
+ styles.polarGrid
2335
+ )(theme);
2336
+ },
2337
+ [rest.polarGridProps, styles.polarGrid, theme]
2338
+ );
2339
+ const [radarProps, radarClassName] = (0, import_react13.useMemo)(() => {
2340
+ const resolvedRadarProps = {
2341
+ fillOpacity: "var(--ui-fill-opacity)",
2342
+ ...computedRadarProps
2343
+ };
2344
+ return getComponentProps(
2345
+ [resolvedRadarProps, radarProperties],
2346
+ styles.radar
2347
+ )(theme);
2348
+ }, [computedRadarProps, styles.radar, theme]);
2349
+ const [dimRadarProps, dimRadarClassName] = (0, import_react13.useMemo)(() => {
2350
+ const resolvedDimRadar = {
2351
+ fillOpacity: 0.3,
2352
+ strokeOpacity: 0.3,
2353
+ ...dimRadar
2354
+ };
2355
+ return getComponentProps([resolvedDimRadar, radarProperties])(
2356
+ theme
2357
+ );
2358
+ }, [dimRadar, theme]);
2359
+ const [dotProps, dotClassName] = (0, import_react13.useMemo)(() => {
2360
+ const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
2361
+ return getComponentProps(
2362
+ [resolvedDot, dotProperties],
2363
+ styles.dot
2364
+ )(theme);
2365
+ }, [dot, styles.dot, theme]);
2366
+ const [activeDotProps, activeDotClassName] = (0, import_react13.useMemo)(
2367
+ () => getComponentProps(
2368
+ [activeDot, dotProperties],
2369
+ styles.activeDot
2370
+ )(theme),
2371
+ [activeDot, styles.activeDot, theme]
2372
+ );
2373
+ const [dimDotProps, dimDotClassName] = (0, import_react13.useMemo)(() => {
2374
+ const resolvedDimDot = { fillOpacity: 0, strokeOpacity: 0, ...dimDot };
2375
+ return getComponentProps([resolvedDimDot, dotProperties])(
2376
+ theme
2377
+ );
2378
+ }, [dimDot, theme]);
2379
+ const radarPropList = (0, import_react13.useMemo)(
2380
+ () => series.map((props, index) => {
2381
+ const {
2382
+ dataKey: dataKey2,
2383
+ dot: dot2 = {},
2384
+ activeDot: activeDot2 = {},
2385
+ dimDot: dimDot2 = {},
2386
+ dimRadar: dimRadar2 = {},
2387
+ ...computedProps
2388
+ } = props;
2389
+ const color = `var(--ui-radar-${index})`;
2390
+ const dimmed = shouldHighlight && highlightedArea !== dataKey2;
2391
+ const computedDimRadar = { ...dimRadarProps, ...dimRadar2 };
2392
+ const resolvedProps = {
2393
+ ...radarProps,
2394
+ ...computedProps,
2395
+ ...dimmed ? computedDimRadar : {}
2396
+ };
2397
+ const rest2 = getComponentProps(
2398
+ [resolvedProps, radarProperties],
2399
+ radarClassName,
2400
+ dimmed ? dimRadarClassName : void 0
2401
+ )(theme, true);
2402
+ let resolvedActiveDot;
2403
+ if (withActiveDots) {
2404
+ const computedActiveDot = {
2405
+ ...activeDotProps,
2406
+ ...activeDot2
2407
+ };
2408
+ const [rest3, className] = getComponentProps(
2409
+ [computedActiveDot, dotProperties],
2410
+ activeDotClassName
2411
+ )(theme);
2412
+ resolvedActiveDot = {
2413
+ className: (0, import_utils16.cx)("ui-radar-chart__active-dot", className),
2414
+ fill: color,
2415
+ stroke: color,
2416
+ r: 4,
2417
+ ...rest3
2418
+ };
2419
+ } else {
2420
+ resolvedActiveDot = false;
2421
+ }
2422
+ let resolvedDot;
2423
+ if (withDots) {
2424
+ const computedDimDot = { ...dimDotProps, ...dimDot2 };
2425
+ const computedDot = {
2426
+ ...dotProps,
2427
+ ...dot2,
2428
+ ...dimmed ? computedDimDot : {}
2429
+ };
2430
+ const [rest3, className] = getComponentProps(
2431
+ [computedDot, dotProperties],
2432
+ dotClassName,
2433
+ dimmed ? dimDotClassName : void 0
2434
+ )(theme);
2435
+ resolvedDot = {
2436
+ // BUG: className is not applied.
2437
+ className: (0, import_utils16.cx)("ui-radar-chart__dot", className),
2438
+ fill: color,
2439
+ r: 4,
2440
+ ...rest3
2441
+ };
2442
+ } else {
2443
+ resolvedDot = false;
2444
+ }
2445
+ return {
2446
+ ...rest2,
2447
+ color,
2448
+ dataKey: dataKey2,
2449
+ dot: resolvedDot,
2450
+ activeDot: resolvedActiveDot
2451
+ };
2452
+ }),
2453
+ [
2454
+ activeDotClassName,
2455
+ activeDotProps,
2456
+ dimDotClassName,
2457
+ dimDotProps,
2458
+ dimRadarClassName,
2459
+ dimRadarProps,
2460
+ dotClassName,
2461
+ dotProps,
2462
+ highlightedArea,
2463
+ radarClassName,
2464
+ radarProps,
2465
+ series,
2466
+ shouldHighlight,
2467
+ theme,
2468
+ withActiveDots,
2469
+ withDots
2470
+ ]
2471
+ );
2472
+ const getRadarChartProps = (0, import_react13.useCallback)(
2473
+ ({ className, ...props } = {}, ref = null) => ({
2474
+ ref,
2475
+ className: (0, import_utils16.cx)(className, radarChartClassName),
2476
+ data,
2477
+ ...props,
2478
+ ...radarChartProps
2479
+ }),
2480
+ [data, radarChartClassName, radarChartProps]
2481
+ );
2482
+ const getRadarProps = (0, import_react13.useCallback)(
2483
+ ({ index, className: classNameProp, ...props }, ref = null) => {
2484
+ const { color, className, dataKey: dataKey2, activeDot: activeDot2, dot: dot2, ...rest2 } = radarPropList[index];
2485
+ return {
2486
+ ref,
2487
+ className: (0, import_utils16.cx)(classNameProp, className),
2488
+ activeDot: activeDot2,
2489
+ dot: dot2,
2490
+ name: dataKey2,
2491
+ dataKey: dataKey2,
2492
+ fill: color,
2493
+ strokeWidth,
2494
+ stroke: color,
2495
+ isAnimationActive: false,
2496
+ ...props,
2497
+ ...rest2
2498
+ };
2499
+ },
2500
+ [radarPropList, strokeWidth]
2501
+ );
2502
+ const getPolarGridProps = (0, import_react13.useCallback)(
2503
+ ({ className, ...props } = {}, ref = null) => ({
2504
+ ref,
2505
+ // BUG: `.recharts-polar-grid-concentric-xxx` is not applied className.
2506
+ className: (0, import_utils16.cx)(className, polarGridClassName),
2507
+ ...props,
2508
+ ...polarGridProps
2509
+ }),
2510
+ [polarGridClassName, polarGridProps]
2511
+ );
2512
+ const getPolarAngleAxisProps = (0, import_react13.useCallback)(
2513
+ ({ className, ...props } = {}, ref = null) => ({
2514
+ ref,
2515
+ // BUG: className is not applied.
2516
+ // className: cx(className, polarAngleAxisClassName),
2517
+ className,
2518
+ dataKey,
2519
+ tickFormatter: valueFormatter,
2520
+ tickSize: 16,
2521
+ ...props,
2522
+ ...polarAngleAxisProps
2523
+ }),
2524
+ [
2525
+ dataKey,
2526
+ // polarAngleAxisClassName,
2527
+ polarAngleAxisProps,
2528
+ valueFormatter
2529
+ ]
2530
+ );
2531
+ const getPolarRadiusAxisProps = (0, import_react13.useCallback)(
2532
+ ({ className, ...props } = {}, ref = null) => ({
2533
+ ref,
2534
+ // BUG: className is not applied.
2535
+ // className: cx(className, polarRadiusAxisClassName),
2536
+ className,
2537
+ tickFormatter: valueFormatter,
2538
+ ...props,
2539
+ ...polarRadiusAxisProps
2540
+ }),
2541
+ [
2542
+ // polarRadiusAxisClassName,
2543
+ polarRadiusAxisProps,
2544
+ valueFormatter
2545
+ ]
2546
+ );
2547
+ return {
2548
+ radarVars,
2549
+ getRadarChartProps,
2550
+ getRadarProps,
2551
+ getPolarGridProps,
2552
+ getPolarAngleAxisProps,
2553
+ getPolarRadiusAxisProps,
2554
+ setHighlightedArea
2555
+ };
2556
+ };
2557
+
2558
+ // src/radar-chart.tsx
2559
+ var import_jsx_runtime8 = require("react/jsx-runtime");
2560
+ var RadarChart = (0, import_core15.forwardRef)((props, ref) => {
2561
+ const [styles, mergedProps] = (0, import_core15.useMultiComponentStyle)("RadarChart", props);
2562
+ const {
2563
+ className,
2564
+ data,
2565
+ series,
2566
+ dataKey,
2567
+ radarProps,
2568
+ radarChartProps,
2569
+ polarGridProps,
2570
+ polarAngleAxisProps,
2571
+ polarRadiusAxisProps,
2572
+ containerProps,
2573
+ tooltipProps,
2574
+ legendProps,
2575
+ tooltipAnimationDuration,
2576
+ unit,
2577
+ valueFormatter,
2578
+ withDots,
2579
+ withActiveDots,
2580
+ strokeWidth,
2581
+ fillOpacity,
2582
+ withTooltip = true,
2583
+ withLegend = false,
2584
+ withPolarGrid = true,
2585
+ withPolarAngleAxis = true,
2586
+ withPolarRadiusAxis = false,
2587
+ ...rest
2588
+ } = (0, import_core15.omitThemeProps)(mergedProps);
2589
+ const {
2590
+ getRadarProps,
2591
+ getRadarChartProps,
2592
+ getPolarGridProps,
2593
+ getPolarAngleAxisProps,
2594
+ getPolarRadiusAxisProps,
2595
+ radarVars,
2596
+ setHighlightedArea
2597
+ } = useRadarChart({
2598
+ data,
2599
+ series,
2600
+ dataKey,
2601
+ radarProps,
2602
+ radarChartProps,
2603
+ polarGridProps,
2604
+ polarAngleAxisProps,
2605
+ polarRadiusAxisProps,
2606
+ withDots,
2607
+ withActiveDots,
2608
+ strokeWidth,
2609
+ fillOpacity,
2610
+ valueFormatter,
2611
+ styles
2612
+ });
2613
+ const { getContainerProps } = useChart({ containerProps });
2614
+ const {
2615
+ tooltipProps: computedTooltipProps,
2616
+ getTooltipProps,
2617
+ tooltipVars
2618
+ } = useChartTooltip({
2619
+ tooltipProps,
2620
+ tooltipAnimationDuration,
2621
+ styles
2622
+ });
2623
+ const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
2624
+ legendProps
2625
+ });
2626
+ const radars = (0, import_react14.useMemo)(
2627
+ () => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2628
+ import_recharts4.Radar,
2629
+ {
2630
+ ...getRadarProps({ index, className: "ui-radar-chart__radar" })
2631
+ },
2632
+ `radar=${dataKey2}`
2633
+ )),
2634
+ [getRadarProps, series]
2635
+ );
2636
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2637
+ import_core15.ui.div,
2638
+ {
2639
+ ref,
2640
+ className: (0, import_utils17.cx)("ui-radar-chart", className),
2641
+ var: [...radarVars, ...tooltipVars],
2642
+ __css: { maxW: "full", ...styles.container },
2643
+ ...rest,
2644
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2645
+ import_recharts4.ResponsiveContainer,
2646
+ {
2647
+ ...getContainerProps({ className: "ui-radar-chart__container" }),
2648
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2649
+ import_recharts4.RadarChart,
2650
+ {
2651
+ ...getRadarChartProps({ className: "ui-radar-chart__chart" }),
2652
+ children: [
2653
+ withPolarGrid ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2654
+ import_recharts4.PolarGrid,
2655
+ {
2656
+ ...getPolarGridProps({
2657
+ className: "ui-radar-chart__polar-grid"
2658
+ })
2659
+ }
2660
+ ) : null,
2661
+ withPolarAngleAxis ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2662
+ import_recharts4.PolarAngleAxis,
2663
+ {
2664
+ ...getPolarAngleAxisProps({
2665
+ className: "ui-radar-chart__polar-angle-axis"
2666
+ })
2667
+ }
2668
+ ) : null,
2669
+ withPolarRadiusAxis ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2670
+ import_recharts4.PolarRadiusAxis,
2671
+ {
2672
+ ...getPolarRadiusAxisProps({
2673
+ className: "ui-radar-chart__polar-radius-axis"
2674
+ })
2675
+ }
2676
+ ) : null,
2677
+ withLegend ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2678
+ import_recharts4.Legend,
2679
+ {
2680
+ content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2681
+ ChartLegend,
2682
+ {
2683
+ className: "ui-area-chart__legend",
2684
+ payload,
2685
+ onHighlight: setHighlightedArea,
2686
+ ...computedLegendProps
2687
+ }
2688
+ ),
2689
+ ...getLegendProps()
2690
+ }
2691
+ ) : null,
2692
+ withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2693
+ import_recharts4.Tooltip,
2694
+ {
2695
+ content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2696
+ ChartTooltip,
2697
+ {
2698
+ className: "ui-line-chart__tooltip",
2699
+ label,
2700
+ payload,
2701
+ valueFormatter,
2702
+ unit,
2703
+ ...computedTooltipProps
2704
+ }
2705
+ ),
2706
+ ...getTooltipProps()
2707
+ }
2708
+ ) : null,
2709
+ radars
2710
+ ]
2711
+ }
2712
+ )
2713
+ }
2714
+ )
2715
+ }
2716
+ ) });
2717
+ });
2718
+ // Annotate the CommonJS export names for ESM import in node:
2719
+ 0 && (module.exports = {
2720
+ AreaChart,
2721
+ BarChart,
2722
+ LineChart,
2723
+ RadarChart
2724
+ });
2725
+ //# sourceMappingURL=index.js.map