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