@yamada-ui/charts 1.5.4-next-20241005220055 → 1.5.4-next-20241008193728

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. package/dist/area-chart-gradient.d.mts +2 -2
  2. package/dist/area-chart-gradient.d.ts +2 -2
  3. package/dist/area-chart-gradient.js +7 -5
  4. package/dist/area-chart-gradient.js.map +1 -1
  5. package/dist/area-chart-gradient.mjs +1 -1
  6. package/dist/area-chart-split.d.mts +2 -2
  7. package/dist/area-chart-split.d.ts +2 -2
  8. package/dist/area-chart-split.js +4 -2
  9. package/dist/area-chart-split.js.map +1 -1
  10. package/dist/area-chart-split.mjs +1 -1
  11. package/dist/area-chart.d.mts +8 -8
  12. package/dist/area-chart.d.ts +8 -8
  13. package/dist/area-chart.js +190 -175
  14. package/dist/area-chart.js.map +1 -1
  15. package/dist/area-chart.mjs +13 -13
  16. package/dist/bar-chart.d.mts +8 -8
  17. package/dist/bar-chart.d.ts +8 -8
  18. package/dist/bar-chart.js +143 -127
  19. package/dist/bar-chart.js.map +1 -1
  20. package/dist/bar-chart.mjs +11 -11
  21. package/dist/chart-legend.d.mts +1 -1
  22. package/dist/chart-legend.d.ts +1 -1
  23. package/dist/chart-legend.js +4 -2
  24. package/dist/chart-legend.js.map +1 -1
  25. package/dist/chart-legend.mjs +3 -3
  26. package/dist/chart-tooltip.d.mts +4 -4
  27. package/dist/chart-tooltip.d.ts +4 -4
  28. package/dist/chart-tooltip.js +9 -7
  29. package/dist/chart-tooltip.js.map +1 -1
  30. package/dist/chart-tooltip.mjs +3 -3
  31. package/dist/chart-utils.js.map +1 -1
  32. package/dist/chart-utils.mjs +1 -1
  33. package/dist/chart.types.d.mts +14 -14
  34. package/dist/chart.types.d.ts +14 -14
  35. package/dist/chart.types.js.map +1 -1
  36. package/dist/{chunk-UANITMH7.mjs → chunk-5VLSGWQD.mjs} +10 -8
  37. package/dist/chunk-5VLSGWQD.mjs.map +1 -0
  38. package/dist/{chunk-XYUYAHJX.mjs → chunk-6JRMEI6J.mjs} +2 -2
  39. package/dist/chunk-6JRMEI6J.mjs.map +1 -0
  40. package/dist/{chunk-VKBRU4Z4.mjs → chunk-AYVTBRCS.mjs} +29 -28
  41. package/dist/chunk-AYVTBRCS.mjs.map +1 -0
  42. package/dist/{chunk-6O5G3WYP.mjs → chunk-EZG52466.mjs} +29 -21
  43. package/dist/chunk-EZG52466.mjs.map +1 -0
  44. package/dist/{chunk-VEFEKDMH.mjs → chunk-FDALM73K.mjs} +15 -14
  45. package/dist/chunk-FDALM73K.mjs.map +1 -0
  46. package/dist/{chunk-2GQHI23M.mjs → chunk-GU4SGNWX.mjs} +5 -5
  47. package/dist/chunk-GU4SGNWX.mjs.map +1 -0
  48. package/dist/{chunk-MVRWZTQ5.mjs → chunk-NLXYCM5J.mjs} +2 -2
  49. package/dist/chunk-NLXYCM5J.mjs.map +1 -0
  50. package/dist/{chunk-EXBYAVSP.mjs → chunk-NMPNNSBN.mjs} +76 -74
  51. package/dist/chunk-NMPNNSBN.mjs.map +1 -0
  52. package/dist/{chunk-AL4MDJ4U.mjs → chunk-NQPC5LPY.mjs} +84 -82
  53. package/dist/chunk-NQPC5LPY.mjs.map +1 -0
  54. package/dist/{chunk-MN7T76SY.mjs → chunk-OG5CVPPV.mjs} +5 -3
  55. package/dist/chunk-OG5CVPPV.mjs.map +1 -0
  56. package/dist/{chunk-LLOU2WIV.mjs → chunk-OUIKA4AX.mjs} +5 -3
  57. package/dist/chunk-OUIKA4AX.mjs.map +1 -0
  58. package/dist/{chunk-3EHZJFIA.mjs → chunk-PKQB4BFG.mjs} +28 -28
  59. package/dist/chunk-PKQB4BFG.mjs.map +1 -0
  60. package/dist/{chunk-C3ZYUDXE.mjs → chunk-QPMW56KA.mjs} +52 -48
  61. package/dist/chunk-QPMW56KA.mjs.map +1 -0
  62. package/dist/{chunk-IJRYXT4V.mjs → chunk-R2LOTDR3.mjs} +2 -2
  63. package/dist/{chunk-IJRYXT4V.mjs.map → chunk-R2LOTDR3.mjs.map} +1 -1
  64. package/dist/{chunk-LSCPL7PM.mjs → chunk-SCY5V45W.mjs} +58 -56
  65. package/dist/chunk-SCY5V45W.mjs.map +1 -0
  66. package/dist/{chunk-VGNCWS23.mjs → chunk-SYBJTMPL.mjs} +92 -90
  67. package/dist/chunk-SYBJTMPL.mjs.map +1 -0
  68. package/dist/{chunk-ZGXEF3LO.mjs → chunk-TA7YJAW4.mjs} +49 -47
  69. package/dist/chunk-TA7YJAW4.mjs.map +1 -0
  70. package/dist/{chunk-O3LMKYXK.mjs → chunk-TU6MKMMV.mjs} +29 -28
  71. package/dist/chunk-TU6MKMMV.mjs.map +1 -0
  72. package/dist/{chunk-QL3DB7OJ.mjs → chunk-TXNC7GLT.mjs} +1 -1
  73. package/dist/{chunk-QL3DB7OJ.mjs.map → chunk-TXNC7GLT.mjs.map} +1 -1
  74. package/dist/{chunk-NHHJ5XFF.mjs → chunk-U325CYNR.mjs} +8 -6
  75. package/dist/chunk-U325CYNR.mjs.map +1 -0
  76. package/dist/{chunk-OPPMMNGP.mjs → chunk-UER5GW4M.mjs} +33 -24
  77. package/dist/chunk-UER5GW4M.mjs.map +1 -0
  78. package/dist/{chunk-FYAC4RRZ.mjs → chunk-UTD4XZDM.mjs} +11 -10
  79. package/dist/chunk-UTD4XZDM.mjs.map +1 -0
  80. package/dist/{chunk-A3IWA366.mjs → chunk-VK65X6Q2.mjs} +4 -4
  81. package/dist/chunk-VK65X6Q2.mjs.map +1 -0
  82. package/dist/{chunk-OJ2MLZZ7.mjs → chunk-X6PIY2M3.mjs} +7 -7
  83. package/dist/chunk-X6PIY2M3.mjs.map +1 -0
  84. package/dist/{chunk-MSG3WFBO.mjs → chunk-YIAK5DIM.mjs} +7 -6
  85. package/dist/chunk-YIAK5DIM.mjs.map +1 -0
  86. package/dist/{chunk-ZXBE4ERW.mjs → chunk-YTUEG4IY.mjs} +47 -45
  87. package/dist/chunk-YTUEG4IY.mjs.map +1 -0
  88. package/dist/{chunk-VUTCH2CU.mjs → chunk-YX23LEQ7.mjs} +13 -13
  89. package/dist/chunk-YX23LEQ7.mjs.map +1 -0
  90. package/dist/{chunk-BQT5TIKZ.mjs → chunk-ZRV4LO67.mjs} +44 -42
  91. package/dist/chunk-ZRV4LO67.mjs.map +1 -0
  92. package/dist/donut-chart.js +97 -89
  93. package/dist/donut-chart.js.map +1 -1
  94. package/dist/donut-chart.mjs +10 -10
  95. package/dist/index.d.mts +14 -14
  96. package/dist/index.d.ts +14 -14
  97. package/dist/index.js +2084 -2036
  98. package/dist/index.js.map +1 -1
  99. package/dist/index.mjs +28 -28
  100. package/dist/index.mjs.map +1 -1
  101. package/dist/line-chart.d.mts +7 -7
  102. package/dist/line-chart.d.ts +7 -7
  103. package/dist/line-chart.js +146 -138
  104. package/dist/line-chart.js.map +1 -1
  105. package/dist/line-chart.mjs +11 -11
  106. package/dist/pie-chart-label.d.mts +9 -9
  107. package/dist/pie-chart-label.d.ts +9 -9
  108. package/dist/pie-chart-label.js +14 -13
  109. package/dist/pie-chart-label.js.map +1 -1
  110. package/dist/pie-chart-label.mjs +1 -1
  111. package/dist/pie-chart.d.mts +11 -11
  112. package/dist/pie-chart.d.ts +11 -11
  113. package/dist/pie-chart.js +95 -87
  114. package/dist/pie-chart.js.map +1 -1
  115. package/dist/pie-chart.mjs +9 -9
  116. package/dist/radar-chart.d.mts +11 -11
  117. package/dist/radar-chart.d.ts +11 -11
  118. package/dist/radar-chart.js +87 -73
  119. package/dist/radar-chart.js.map +1 -1
  120. package/dist/radar-chart.mjs +9 -9
  121. package/dist/radial-chart.d.mts +10 -10
  122. package/dist/radial-chart.d.ts +10 -10
  123. package/dist/radial-chart.js +69 -62
  124. package/dist/radial-chart.js.map +1 -1
  125. package/dist/radial-chart.mjs +10 -10
  126. package/dist/use-area-chart.d.mts +53 -53
  127. package/dist/use-area-chart.d.ts +53 -53
  128. package/dist/use-area-chart.js +50 -46
  129. package/dist/use-area-chart.js.map +1 -1
  130. package/dist/use-area-chart.mjs +2 -2
  131. package/dist/use-bar-chart.d.mts +32 -32
  132. package/dist/use-bar-chart.d.ts +32 -32
  133. package/dist/use-bar-chart.js +30 -21
  134. package/dist/use-bar-chart.js.map +1 -1
  135. package/dist/use-bar-chart.mjs +2 -2
  136. package/dist/use-chart-axis.d.mts +27 -27
  137. package/dist/use-chart-axis.d.ts +27 -27
  138. package/dist/use-chart-axis.js +26 -26
  139. package/dist/use-chart-axis.js.map +1 -1
  140. package/dist/use-chart-axis.mjs +2 -2
  141. package/dist/use-chart-grid.d.mts +8 -8
  142. package/dist/use-chart-grid.d.ts +8 -8
  143. package/dist/use-chart-grid.js +3 -3
  144. package/dist/use-chart-grid.js.map +1 -1
  145. package/dist/use-chart-grid.mjs +2 -2
  146. package/dist/use-chart-label-list.d.mts +4 -4
  147. package/dist/use-chart-label-list.d.ts +4 -4
  148. package/dist/use-chart-label-list.js +5 -4
  149. package/dist/use-chart-label-list.js.map +1 -1
  150. package/dist/use-chart-label-list.mjs +2 -2
  151. package/dist/use-chart-label.d.mts +1 -1
  152. package/dist/use-chart-label.d.ts +1 -1
  153. package/dist/use-chart-label.js.map +1 -1
  154. package/dist/use-chart-label.mjs +2 -2
  155. package/dist/use-chart-legend.d.mts +1 -1
  156. package/dist/use-chart-legend.d.ts +1 -1
  157. package/dist/use-chart-legend.js +1 -1
  158. package/dist/use-chart-legend.js.map +1 -1
  159. package/dist/use-chart-legend.mjs +1 -1
  160. package/dist/use-chart-reference-line.d.mts +4 -4
  161. package/dist/use-chart-reference-line.d.ts +4 -4
  162. package/dist/use-chart-reference-line.js +8 -7
  163. package/dist/use-chart-reference-line.js.map +1 -1
  164. package/dist/use-chart-reference-line.mjs +2 -2
  165. package/dist/use-chart-tooltip.d.mts +7 -7
  166. package/dist/use-chart-tooltip.d.ts +7 -7
  167. package/dist/use-chart-tooltip.js +4 -4
  168. package/dist/use-chart-tooltip.js.map +1 -1
  169. package/dist/use-chart-tooltip.mjs +2 -2
  170. package/dist/use-chart.d.mts +6 -10
  171. package/dist/use-chart.d.ts +6 -10
  172. package/dist/use-chart.js +2 -2
  173. package/dist/use-chart.js.map +1 -1
  174. package/dist/use-chart.mjs +2 -2
  175. package/dist/use-line-chart.d.mts +43 -43
  176. package/dist/use-line-chart.d.ts +43 -43
  177. package/dist/use-line-chart.js +26 -25
  178. package/dist/use-line-chart.js.map +1 -1
  179. package/dist/use-line-chart.mjs +2 -2
  180. package/dist/use-pie-chart.d.mts +47 -47
  181. package/dist/use-pie-chart.d.ts +47 -47
  182. package/dist/use-pie-chart.js +40 -38
  183. package/dist/use-pie-chart.js.map +1 -1
  184. package/dist/use-pie-chart.mjs +3 -3
  185. package/dist/use-polar-grid.d.mts +5 -5
  186. package/dist/use-polar-grid.d.ts +5 -5
  187. package/dist/use-polar-grid.js.map +1 -1
  188. package/dist/use-polar-grid.mjs +2 -2
  189. package/dist/use-radar-chart.d.mts +41 -41
  190. package/dist/use-radar-chart.d.ts +41 -41
  191. package/dist/use-radar-chart.js +27 -19
  192. package/dist/use-radar-chart.js.map +1 -1
  193. package/dist/use-radar-chart.mjs +2 -2
  194. package/dist/use-radial-chart.d.mts +17 -17
  195. package/dist/use-radial-chart.d.ts +17 -17
  196. package/dist/use-radial-chart.js +11 -11
  197. package/dist/use-radial-chart.js.map +1 -1
  198. package/dist/use-radial-chart.mjs +2 -2
  199. package/package.json +3 -3
  200. package/dist/chunk-2GQHI23M.mjs.map +0 -1
  201. package/dist/chunk-3EHZJFIA.mjs.map +0 -1
  202. package/dist/chunk-6O5G3WYP.mjs.map +0 -1
  203. package/dist/chunk-A3IWA366.mjs.map +0 -1
  204. package/dist/chunk-AL4MDJ4U.mjs.map +0 -1
  205. package/dist/chunk-BQT5TIKZ.mjs.map +0 -1
  206. package/dist/chunk-C3ZYUDXE.mjs.map +0 -1
  207. package/dist/chunk-EXBYAVSP.mjs.map +0 -1
  208. package/dist/chunk-FYAC4RRZ.mjs.map +0 -1
  209. package/dist/chunk-LLOU2WIV.mjs.map +0 -1
  210. package/dist/chunk-LSCPL7PM.mjs.map +0 -1
  211. package/dist/chunk-MN7T76SY.mjs.map +0 -1
  212. package/dist/chunk-MSG3WFBO.mjs.map +0 -1
  213. package/dist/chunk-MVRWZTQ5.mjs.map +0 -1
  214. package/dist/chunk-NHHJ5XFF.mjs.map +0 -1
  215. package/dist/chunk-O3LMKYXK.mjs.map +0 -1
  216. package/dist/chunk-OJ2MLZZ7.mjs.map +0 -1
  217. package/dist/chunk-OPPMMNGP.mjs.map +0 -1
  218. package/dist/chunk-UANITMH7.mjs.map +0 -1
  219. package/dist/chunk-VEFEKDMH.mjs.map +0 -1
  220. package/dist/chunk-VGNCWS23.mjs.map +0 -1
  221. package/dist/chunk-VKBRU4Z4.mjs.map +0 -1
  222. package/dist/chunk-VUTCH2CU.mjs.map +0 -1
  223. package/dist/chunk-XYUYAHJX.mjs.map +0 -1
  224. package/dist/chunk-ZGXEF3LO.mjs.map +0 -1
  225. package/dist/chunk-ZXBE4ERW.mjs.map +0 -1
@@ -32,27 +32,29 @@ var import_recharts = require("recharts");
32
32
  // src/area-chart-gradient.tsx
33
33
  var import_jsx_runtime = require("react/jsx-runtime");
34
34
  var AreaGradient = ({
35
- color,
36
35
  id,
37
- withGradient,
38
- fillOpacity
36
+ color,
37
+ fillOpacity,
38
+ withGradient
39
39
  }) => {
40
40
  if (withGradient) {
41
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
41
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id, x1: "0", x2: "0", y1: "0", y2: "1", children: [
42
42
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: fillOpacity }),
43
43
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: 0.01 })
44
44
  ] });
45
45
  } else {
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: color, stopOpacity: fillOpacity }) });
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("linearGradient", { id, x1: "0", x2: "0", y1: "0", y2: "1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: color, stopOpacity: fillOpacity }) });
47
47
  }
48
48
  };
49
+ AreaGradient.displayName = "AreaGradient";
50
+ AreaGradient.__ui__ = "AreaGradient";
49
51
 
50
52
  // src/area-chart-split.tsx
51
53
  var import_core = require("@yamada-ui/core");
52
54
  var import_jsx_runtime2 = require("react/jsx-runtime");
53
- var AreaSplit = ({ offset, id, fillOpacity }) => {
55
+ var AreaSplit = ({ id, fillOpacity, offset }) => {
54
56
  const { theme } = (0, import_core.useTheme)();
55
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
57
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("linearGradient", { id, x1: "0", x2: "0", y1: "0", y2: "1", children: [
56
58
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
57
59
  "stop",
58
60
  {
@@ -71,6 +73,8 @@ var AreaSplit = ({ offset, id, fillOpacity }) => {
71
73
  )
72
74
  ] });
73
75
  };
76
+ AreaSplit.displayName = "AreaSplit";
77
+ AreaSplit.__ui__ = "AreaSplit";
74
78
 
75
79
  // src/chart-legend.tsx
76
80
  var import_core4 = require("@yamada-ui/core");
@@ -356,13 +360,13 @@ var useChart = ({ containerProps = {} }) => {
356
360
  getContainerProps
357
361
  };
358
362
  };
359
- var useLegend = ({} = {}) => {
363
+ var useLegend = () => {
360
364
  const { styles } = useChartContext();
361
365
  return {
362
366
  styles
363
367
  };
364
368
  };
365
- var useTooltip = ({} = {}) => {
369
+ var useTooltip = () => {
366
370
  const { styles } = useChartContext();
367
371
  return {
368
372
  styles
@@ -374,7 +378,7 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
374
378
  var ChartLegend = (0, import_core4.forwardRef)(
375
379
  ({ className, payload = [], onHighlight, ...rest }, ref) => {
376
380
  const { styles } = useLegend();
377
- const items = payload.map(({ dataKey, value: valueProp, color }, index) => {
381
+ const items = payload.map(({ color, dataKey, value: valueProp }, index) => {
378
382
  const value = dataKey != null ? dataKey : valueProp;
379
383
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
380
384
  import_core4.ui.div,
@@ -410,6 +414,8 @@ var ChartLegend = (0, import_core4.forwardRef)(
410
414
  );
411
415
  }
412
416
  );
417
+ ChartLegend.displayName = "ChartLegend";
418
+ ChartLegend.__ui__ = "ChartLegend";
413
419
 
414
420
  // src/chart-tooltip.tsx
415
421
  var import_core5 = require("@yamada-ui/core");
@@ -417,22 +423,22 @@ var import_utils4 = require("@yamada-ui/utils");
417
423
  var import_jsx_runtime4 = require("react/jsx-runtime");
418
424
  var ChartTooltip = (0, import_core5.forwardRef)(
419
425
  ({
420
- label,
421
- dataKey = "value",
422
426
  className,
423
- payload = [],
424
- valueFormatter,
427
+ dataKey = "value",
428
+ isRadialChart,
429
+ label,
425
430
  labelFormatter,
431
+ payload = [],
426
432
  unit,
427
- isRadialChart,
433
+ valueFormatter,
428
434
  ...rest
429
435
  }, ref) => {
430
436
  var _a;
431
437
  const { styles } = useTooltip();
432
438
  const items = payload.map(
433
439
  ({
434
- color: colorProp,
435
440
  name: nameProp,
441
+ color: colorProp,
436
442
  [dataKey]: valueProp,
437
443
  payload: payload2
438
444
  } = {}, index) => {
@@ -502,30 +508,32 @@ var ChartTooltip = (0, import_core5.forwardRef)(
502
508
  );
503
509
  }
504
510
  );
511
+ ChartTooltip.displayName = "ChartTooltip";
512
+ ChartTooltip.__ui__ = "ChartTooltip";
505
513
 
506
514
  // src/use-area-chart.ts
507
515
  var import_core6 = require("@yamada-ui/core");
508
516
  var import_utils5 = require("@yamada-ui/utils");
509
517
  var import_react2 = require("react");
510
518
  var useAreaChart = ({
511
- data,
512
- series,
513
519
  type,
514
- layoutType = "horizontal",
515
- withGradient: withGradientProp,
516
- withDots = true,
517
- withActiveDots = true,
518
- curveType = "monotone",
519
- strokeWidth = 2,
520
520
  connectNulls = true,
521
+ curveType = "monotone",
522
+ data,
521
523
  fillOpacity = 0.4,
524
+ layoutType = "horizontal",
525
+ series,
522
526
  splitColors = ["#ee6a5d", "#5fce7d"],
523
527
  splitOffset,
524
- referenceLineProps,
528
+ strokeWidth = 2,
529
+ styles,
525
530
  syncId,
531
+ withActiveDots = true,
532
+ withDots = true,
533
+ withGradient: withGradientProp,
526
534
  xAxisLabel,
527
535
  yAxisLabel,
528
- styles,
536
+ referenceLineProps,
529
537
  ...rest
530
538
  }) => {
531
539
  var _a;
@@ -537,10 +545,10 @@ var useAreaChart = ({
537
545
  const withGradient = typeof withGradientProp === "boolean" ? withGradientProp : type === "default";
538
546
  const shouldHighlight = highlightedArea !== null;
539
547
  const {
540
- dot = {},
541
548
  activeDot = {},
542
- dimDot,
543
549
  dimArea,
550
+ dimDot,
551
+ dot = {},
544
552
  ...computedAreaProps
545
553
  } = (_a = rest.areaProps) != null ? _a : {};
546
554
  const areaColors = (0, import_react2.useMemo)(
@@ -555,7 +563,7 @@ var useAreaChart = ({
555
563
  () => splitColors.map((color, index) => ({
556
564
  name: `area-split-${index}`,
557
565
  token: "colors",
558
- value: color != null ? color : "transparent"
566
+ value: color || "transparent"
559
567
  })),
560
568
  [splitColors]
561
569
  );
@@ -628,24 +636,27 @@ var useAreaChart = ({
628
636
  );
629
637
  }, [dimDot, theme]);
630
638
  const defaultSplitOffset = (0, import_react2.useMemo)(() => {
639
+ var _a2;
631
640
  if (series.length === 1) {
632
- const dataKey = series[0].dataKey;
633
- const dataMax = Math.max(...data.map((item) => item[dataKey]));
634
- const dataMin = Math.min(...data.map((item) => item[dataKey]));
635
- if (dataMax <= 0) return 0;
636
- if (dataMin >= 0) return 1;
637
- return dataMax / (dataMax - dataMin);
641
+ const dataKey = (_a2 = series[0]) == null ? void 0 : _a2.dataKey;
642
+ if (dataKey) {
643
+ const dataMax = Math.max(...data.map((item) => item[dataKey]));
644
+ const dataMin = Math.min(...data.map((item) => item[dataKey]));
645
+ if (dataMax <= 0) return 0;
646
+ if (dataMin >= 0) return 1;
647
+ return dataMax / (dataMax - dataMin);
648
+ }
638
649
  }
639
650
  return 0.5;
640
651
  }, [data, series]);
641
652
  const areaPropsList = (0, import_react2.useMemo)(
642
653
  () => series.map((props, index) => {
643
654
  const {
644
- dataKey,
645
- dot: dot2 = {},
646
655
  activeDot: activeDot2 = {},
647
- dimDot: dimDot2 = {},
656
+ dataKey,
648
657
  dimArea: dimArea2 = {},
658
+ dimDot: dimDot2 = {},
659
+ dot: dot2 = {},
649
660
  strokeDasharray,
650
661
  ...computedProps
651
662
  } = props;
@@ -672,8 +683,8 @@ var useAreaChart = ({
672
683
  )(theme);
673
684
  resolvedActiveDot = {
674
685
  className: (0, import_utils5.cx)("ui-area-chart__active-dot", className),
675
- stroke: color,
676
686
  r: 4,
687
+ stroke: color,
677
688
  ...rest3
678
689
  };
679
690
  } else {
@@ -704,11 +715,11 @@ var useAreaChart = ({
704
715
  return {
705
716
  ...rest2,
706
717
  id,
718
+ activeDot: resolvedActiveDot,
707
719
  color,
708
- strokeDasharray,
709
720
  dataKey,
710
- activeDot: resolvedActiveDot,
711
- dot: resolvedDot
721
+ dot: resolvedDot,
722
+ strokeDasharray
712
723
  };
713
724
  }),
714
725
  [
@@ -736,14 +747,14 @@ var useAreaChart = ({
736
747
  ref,
737
748
  className: (0, import_utils5.cx)(className, areaChartClassName),
738
749
  data,
739
- stackOffset: type === "percent" ? "expand" : void 0,
740
750
  layout: layoutType,
741
- syncId,
742
751
  margin: {
743
752
  bottom: xAxisLabel ? 30 : void 0,
744
753
  left: yAxisLabel ? 10 : void 0,
745
754
  right: yAxisLabel ? 5 : void 0
746
755
  },
756
+ stackOffset: type === "percent" ? "expand" : void 0,
757
+ syncId,
747
758
  ...props,
748
759
  ...chartProps
749
760
  }),
@@ -761,40 +772,41 @@ var useAreaChart = ({
761
772
  const getAreaSplitProps = (0, import_react2.useCallback)(
762
773
  (props = {}) => ({
763
774
  id: splitId,
764
- offset: splitOffset != null ? splitOffset : defaultSplitOffset,
765
775
  fillOpacity: fillOpacityVar,
776
+ offset: splitOffset != null ? splitOffset : defaultSplitOffset,
766
777
  ...props
767
778
  }),
768
779
  [defaultSplitOffset, splitId, splitOffset, fillOpacityVar]
769
780
  );
770
781
  const getAreaProps = (0, import_react2.useCallback)(
771
- ({ index, className: classNameProp, ...props }, ref = null) => {
782
+ ({ className: classNameProp, index, ...props }, ref = null) => {
783
+ var _a2;
772
784
  const {
773
785
  id,
774
- color,
775
786
  className,
776
- dataKey,
777
- strokeDasharray,
778
787
  activeDot: activeDot2,
788
+ color,
789
+ dataKey = "",
779
790
  dot: dot2,
791
+ strokeDasharray,
780
792
  ...rest2
781
- } = areaPropsList[index];
793
+ } = (_a2 = areaPropsList[index]) != null ? _a2 : {};
782
794
  return {
795
+ id,
783
796
  ref,
797
+ type: curveType,
798
+ name: dataKey,
784
799
  className: (0, import_utils5.cx)(classNameProp, className),
785
- id,
786
800
  activeDot: activeDot2,
787
- dot: dot2,
788
- name: dataKey,
789
- type: curveType,
801
+ connectNulls,
790
802
  dataKey,
803
+ dot: dot2,
791
804
  fill: type === "split" ? `url(#${splitId})` : `url(#${id})`,
792
- strokeWidth,
793
- stroke: color,
794
805
  isAnimationActive: false,
795
- connectNulls,
796
806
  stackId: stacked ? "stack" : void 0,
807
+ stroke: color,
797
808
  strokeDasharray,
809
+ strokeWidth,
798
810
  ...props,
799
811
  ...rest2
800
812
  };
@@ -811,19 +823,19 @@ var useAreaChart = ({
811
823
  );
812
824
  const getAreaGradientProps = (0, import_react2.useCallback)(
813
825
  (props = {}) => ({
814
- withGradient,
815
826
  fillOpacity: fillOpacityVar,
827
+ withGradient,
816
828
  ...props
817
829
  }),
818
830
  [withGradient, fillOpacityVar]
819
831
  );
820
832
  return {
833
+ areaVars,
834
+ setHighlightedArea,
821
835
  getAreaChartProps,
822
- getAreaSplitProps,
823
- getAreaProps,
824
836
  getAreaGradientProps,
825
- areaVars,
826
- setHighlightedArea
837
+ getAreaProps,
838
+ getAreaSplitProps
827
839
  };
828
840
  };
829
841
 
@@ -832,19 +844,19 @@ var import_core7 = require("@yamada-ui/core");
832
844
  var import_utils6 = require("@yamada-ui/utils");
833
845
  var import_react3 = require("react");
834
846
  var useChartAxis = ({
835
- dataKey,
836
847
  type,
848
+ dataKey,
849
+ gridAxis = "x",
837
850
  layoutType = "horizontal",
851
+ styles,
838
852
  tickLine = "y",
839
- gridAxis = "x",
853
+ unit,
840
854
  withXAxis = true,
841
855
  withYAxis = true,
842
856
  xAxisLabel: xAxisLabelProp,
857
+ xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
843
858
  yAxisLabel: yAxisLabelProp,
844
- unit,
845
859
  yAxisTickFormatter = type === "percent" && layoutType === "horizontal" ? valueToPercent : void 0,
846
- xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
847
- styles,
848
860
  ...rest
849
861
  }) => {
850
862
  var _a, _b, _c, _d;
@@ -854,7 +866,7 @@ var useChartAxis = ({
854
866
  [dataKey, layoutType]
855
867
  );
856
868
  const yAxisKey = (0, import_react3.useMemo)(
857
- () => layoutType === "vertical" ? { dataKey, type: "category" } : { type: "number" },
869
+ () => layoutType === "vertical" ? { type: "category", dataKey } : { type: "number" },
858
870
  [dataKey, layoutType]
859
871
  );
860
872
  const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
@@ -885,15 +897,15 @@ var useChartAxis = ({
885
897
  className: (0, import_utils6.cx)(className, xAxisClassName),
886
898
  hide: !withXAxis,
887
899
  ...xAxisKey,
888
- tick: {
889
- transform: "translate(0, 10)",
890
- fill: "currentColor"
891
- },
892
- stroke: "",
893
900
  interval: "preserveStartEnd",
894
- tickLine: xTickLine,
895
901
  minTickGap: 5,
902
+ stroke: "",
903
+ tick: {
904
+ fill: "currentColor",
905
+ transform: "translate(0, 10)"
906
+ },
896
907
  tickFormatter: xAxisTickFormatter,
908
+ tickLine: xTickLine,
897
909
  ...props,
898
910
  ...xAxisProps
899
911
  }),
@@ -909,17 +921,17 @@ var useChartAxis = ({
909
921
  const getYAxisProps = (0, import_react3.useCallback)(
910
922
  ({ className, ...props } = {}) => ({
911
923
  className: (0, import_utils6.cx)(className, yAxisClassName),
912
- hide: !withYAxis,
913
924
  axisLine: false,
925
+ hide: !withYAxis,
914
926
  ...yAxisKey,
915
- tickLine: yTickLine,
927
+ allowDecimals: true,
916
928
  tick: {
917
- transform: "translate(-10, 0)",
918
- fill: "currentColor"
929
+ fill: "currentColor",
930
+ transform: "translate(-10, 0)"
919
931
  },
920
- allowDecimals: true,
921
- unit,
922
932
  tickFormatter: yAxisTickFormatter,
933
+ tickLine: yTickLine,
934
+ unit,
923
935
  ...props,
924
936
  ...yAxisProps
925
937
  }),
@@ -936,9 +948,9 @@ var useChartAxis = ({
936
948
  const getXAxisLabelProps = (0, import_react3.useCallback)(
937
949
  ({ className, ...props } = {}) => ({
938
950
  className: (0, import_utils6.cx)(className, xAxisLabelClassName),
939
- value: xAxisLabel,
940
- position: "insideBottom",
941
951
  offset: -20,
952
+ position: "insideBottom",
953
+ value: xAxisLabel,
942
954
  ...props,
943
955
  ...xAxisLabelProps
944
956
  }),
@@ -947,21 +959,21 @@ var useChartAxis = ({
947
959
  const getYAxisLabelProps = (0, import_react3.useCallback)(
948
960
  ({ className, ...props } = {}) => ({
949
961
  className: (0, import_utils6.cx)(className, yAxisLabelClassName),
950
- value: yAxisLabel,
951
- position: "insideLeft",
952
962
  angle: -90,
953
- textAnchor: "middle",
954
963
  offset: -5,
964
+ position: "insideLeft",
965
+ textAnchor: "middle",
966
+ value: yAxisLabel,
955
967
  ...props,
956
968
  ...yAxisLabelProps
957
969
  }),
958
970
  [yAxisLabel, yAxisLabelClassName, yAxisLabelProps]
959
971
  );
960
972
  return {
961
- getXAxisProps,
962
- getYAxisProps,
963
973
  getXAxisLabelProps,
964
- getYAxisLabelProps
974
+ getXAxisProps,
975
+ getYAxisLabelProps,
976
+ getYAxisProps
965
977
  };
966
978
  };
967
979
  var valueToPercent = (value) => {
@@ -973,10 +985,10 @@ var import_core8 = require("@yamada-ui/core");
973
985
  var import_utils7 = require("@yamada-ui/utils");
974
986
  var import_react4 = require("react");
975
987
  var useChartGrid = ({
976
- gridProps = {},
977
988
  gridAxis = "x",
978
989
  strokeDasharray = "5 5",
979
- styles
990
+ styles,
991
+ gridProps = {}
980
992
  }) => {
981
993
  const { theme } = (0, import_core8.useTheme)();
982
994
  const [reChartsProps, propClassName] = getComponentProps(
@@ -987,9 +999,9 @@ var useChartGrid = ({
987
999
  ({ className, ...props } = {}, ref = null) => ({
988
1000
  ref,
989
1001
  className: (0, import_utils7.cx)("ui-chart__grid", className, propClassName),
1002
+ horizontal: gridAxis === "x" || gridAxis === "xy",
990
1003
  strokeDasharray,
991
1004
  vertical: gridAxis === "y" || gridAxis === "xy",
992
- horizontal: gridAxis === "x" || gridAxis === "xy",
993
1005
  ...props,
994
1006
  ...reChartsProps
995
1007
  }),
@@ -1019,7 +1031,7 @@ var useChartLegend = ({
1019
1031
  },
1020
1032
  [rest]
1021
1033
  );
1022
- return { legendProps, getLegendProps };
1034
+ return { getLegendProps, legendProps };
1023
1035
  };
1024
1036
 
1025
1037
  // src/use-chart-reference-line.ts
@@ -1027,8 +1039,8 @@ var import_core9 = require("@yamada-ui/core");
1027
1039
  var import_utils9 = require("@yamada-ui/utils");
1028
1040
  var import_react6 = require("react");
1029
1041
  var useChartReferenceLine = ({
1030
- referenceLineProps = [],
1031
- styles
1042
+ styles,
1043
+ referenceLineProps = []
1032
1044
  }) => {
1033
1045
  const { theme } = (0, import_core9.useTheme)();
1034
1046
  const styleClassName = (0, import_core9.getCSS)(styles.referenceLine)(theme);
@@ -1040,23 +1052,24 @@ var useChartReferenceLine = ({
1040
1052
  )(theme);
1041
1053
  const color = (0, import_core9.getVar)(`reference-line-${index}`)(theme);
1042
1054
  const label = {
1043
- value: labelProp,
1044
1055
  fill: color,
1045
1056
  position: "insideBottomLeft",
1057
+ value: labelProp,
1046
1058
  ...(0, import_utils9.isObject)(labelProp) ? labelProp : {}
1047
1059
  };
1048
- return { propClassName, color, label, ...rest };
1060
+ return { color, label, propClassName, ...rest };
1049
1061
  }),
1050
1062
  [referenceLineProps, styleClassName, theme]
1051
1063
  );
1052
1064
  const getReferenceLineProps = (0, import_react6.useCallback)(
1053
- ({ index, className, ...props }, ref = null) => {
1054
- const { propClassName, color, label, ...rest } = propList[index];
1065
+ ({ className, index, ...props }, ref = null) => {
1066
+ var _a;
1067
+ const { color, label, propClassName, ...rest } = (_a = propList[index]) != null ? _a : {};
1055
1068
  return {
1056
1069
  ref,
1057
1070
  className: (0, import_utils9.cx)(className, propClassName),
1058
- stroke: color,
1059
1071
  label,
1072
+ stroke: color,
1060
1073
  ...props,
1061
1074
  ...rest
1062
1075
  };
@@ -1071,9 +1084,9 @@ var import_core10 = require("@yamada-ui/core");
1071
1084
  var import_utils10 = require("@yamada-ui/utils");
1072
1085
  var import_react7 = require("react");
1073
1086
  var useChartTooltip = ({
1074
- tooltipProps: _tooltipProps = {},
1087
+ styles,
1075
1088
  tooltipAnimationDuration = 0,
1076
- styles
1089
+ tooltipProps: _tooltipProps = {}
1077
1090
  }) => {
1078
1091
  const { theme } = (0, import_core10.useTheme)();
1079
1092
  const { cursor, ...rest } = _tooltipProps;
@@ -1089,16 +1102,16 @@ var useChartTooltip = ({
1089
1102
  (props, ref = null) => ({
1090
1103
  ref,
1091
1104
  animationDuration: tooltipAnimationDuration,
1092
- isAnimationActive: (tooltipAnimationDuration || 0) > 0,
1093
1105
  cursor: {
1094
1106
  className: (0, import_utils10.cx)("ui-chart__cursor", cursorClassName)
1095
1107
  },
1108
+ isAnimationActive: (tooltipAnimationDuration || 0) > 0,
1096
1109
  ...props,
1097
1110
  ...tooltipProps
1098
1111
  }),
1099
1112
  [cursorClassName, tooltipAnimationDuration, tooltipProps]
1100
1113
  );
1101
- return { tooltipProps: tooltipUIProps, getTooltipProps };
1114
+ return { getTooltipProps, tooltipProps: tooltipUIProps };
1102
1115
  };
1103
1116
 
1104
1117
  // src/area-chart.tsx
@@ -1106,127 +1119,127 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
1106
1119
  var AreaChart = (0, import_core11.forwardRef)((props, ref) => {
1107
1120
  const [styles, mergedProps] = (0, import_core11.useComponentMultiStyle)("AreaChart", props);
1108
1121
  const {
1122
+ type = "default",
1109
1123
  className,
1110
- series,
1124
+ connectNulls,
1125
+ curveType,
1126
+ data,
1111
1127
  dataKey,
1128
+ fillOpacity,
1129
+ gridAxis,
1130
+ labelFormatter,
1112
1131
  layoutType,
1132
+ series,
1133
+ splitColors,
1134
+ splitOffset,
1135
+ strokeDasharray,
1136
+ strokeWidth,
1137
+ syncId,
1113
1138
  tickLine,
1114
- gridAxis,
1139
+ tooltipAnimationDuration,
1140
+ unit,
1141
+ valueFormatter,
1142
+ withActiveDots,
1143
+ withDots,
1144
+ withGradient,
1145
+ withLegend = false,
1146
+ withTooltip = true,
1115
1147
  withXAxis,
1116
1148
  withYAxis,
1117
- xAxisProps,
1118
- yAxisProps,
1119
1149
  xAxisLabel,
1150
+ xAxisTickFormatter,
1120
1151
  yAxisLabel,
1121
- xAxisLabelProps,
1122
- yAxisLabelProps,
1123
- type = "default",
1124
- withTooltip = true,
1125
- withLegend = false,
1126
- referenceLineProps = [],
1152
+ yAxisTickFormatter,
1153
+ areaProps,
1154
+ chartProps,
1127
1155
  containerProps,
1128
- unit,
1129
1156
  gridProps,
1130
- strokeDasharray,
1131
- yAxisTickFormatter,
1132
- xAxisTickFormatter,
1133
- valueFormatter,
1134
- labelFormatter,
1135
- tooltipProps,
1136
- tooltipAnimationDuration,
1137
1157
  legendProps,
1138
- data,
1139
- chartProps,
1140
- areaProps,
1141
- withGradient,
1142
- withDots,
1143
- withActiveDots,
1144
- curveType,
1145
- strokeWidth,
1146
- connectNulls,
1147
- fillOpacity,
1148
- splitColors,
1149
- splitOffset,
1150
- syncId,
1158
+ referenceLineProps = [],
1159
+ tooltipProps,
1160
+ xAxisLabelProps,
1161
+ xAxisProps,
1162
+ yAxisLabelProps,
1163
+ yAxisProps,
1151
1164
  ...rest
1152
1165
  } = (0, import_core11.omitThemeProps)(mergedProps);
1153
1166
  const {
1167
+ areaVars,
1168
+ setHighlightedArea,
1154
1169
  getAreaChartProps,
1155
- getAreaSplitProps,
1156
- getAreaProps,
1157
1170
  getAreaGradientProps,
1158
- areaVars,
1159
- setHighlightedArea
1171
+ getAreaProps,
1172
+ getAreaSplitProps
1160
1173
  } = useAreaChart({
1161
- layoutType,
1162
1174
  type,
1163
- series,
1164
- referenceLineProps,
1165
- data,
1166
- chartProps,
1167
- areaProps,
1168
- withGradient,
1169
- withDots,
1170
- withActiveDots,
1171
- curveType,
1172
- strokeWidth,
1173
1175
  connectNulls,
1176
+ curveType,
1177
+ data,
1174
1178
  fillOpacity,
1179
+ layoutType,
1180
+ series,
1175
1181
  splitColors,
1176
1182
  splitOffset,
1183
+ strokeWidth,
1184
+ styles,
1177
1185
  syncId,
1186
+ withActiveDots,
1187
+ withDots,
1188
+ withGradient,
1178
1189
  xAxisLabel,
1179
1190
  yAxisLabel,
1180
- styles
1191
+ areaProps,
1192
+ chartProps,
1193
+ referenceLineProps
1181
1194
  });
1182
1195
  const { getContainerProps } = useChart({ containerProps });
1183
1196
  const {
1184
- getXAxisProps,
1185
- getYAxisProps,
1186
1197
  getXAxisLabelProps,
1187
- getYAxisLabelProps
1198
+ getXAxisProps,
1199
+ getYAxisLabelProps,
1200
+ getYAxisProps
1188
1201
  } = useChartAxis({
1189
- dataKey,
1190
1202
  type,
1203
+ dataKey,
1204
+ gridAxis,
1191
1205
  layoutType,
1206
+ styles,
1192
1207
  tickLine,
1193
- gridAxis,
1208
+ unit,
1194
1209
  withXAxis,
1195
1210
  withYAxis,
1196
- xAxisProps,
1197
- yAxisProps,
1198
1211
  xAxisLabel,
1212
+ xAxisTickFormatter,
1199
1213
  yAxisLabel,
1214
+ yAxisTickFormatter,
1200
1215
  xAxisLabelProps,
1216
+ xAxisProps,
1201
1217
  yAxisLabelProps,
1202
- unit,
1203
- yAxisTickFormatter,
1204
- xAxisTickFormatter,
1205
- styles
1218
+ yAxisProps
1206
1219
  });
1207
1220
  const { getReferenceLineProps } = useChartReferenceLine({
1208
- referenceLineProps,
1209
- styles
1221
+ styles,
1222
+ referenceLineProps
1210
1223
  });
1211
1224
  const { getGridProps } = useChartGrid({
1212
- gridProps,
1213
1225
  gridAxis,
1214
1226
  strokeDasharray,
1215
- styles
1227
+ styles,
1228
+ gridProps
1216
1229
  });
1217
- const { tooltipProps: computedTooltipProps, getTooltipProps } = useChartTooltip({
1218
- tooltipProps,
1230
+ const { getTooltipProps, tooltipProps: computedTooltipProps } = useChartTooltip({
1231
+ styles,
1219
1232
  tooltipAnimationDuration,
1220
- styles
1233
+ tooltipProps
1221
1234
  });
1222
- const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
1235
+ const { getLegendProps, legendProps: computedLegendProps } = useChartLegend({
1223
1236
  legendProps
1224
1237
  });
1225
1238
  const areas = (0, import_react8.useMemo)(
1226
1239
  () => series.map(({ dataKey: dataKey2 }, index) => {
1227
1240
  const { id, stroke, ...rest2 } = getAreaProps({
1228
- index,
1229
- className: "ui-area-chart__area"
1241
+ className: "ui-area-chart__area",
1242
+ index
1230
1243
  });
1231
1244
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react8.Fragment, { children: [
1232
1245
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AreaGradient, { ...getAreaGradientProps({ id, color: stroke }) }) }),
@@ -1240,8 +1253,8 @@ var AreaChart = (0, import_core11.forwardRef)((props, ref) => {
1240
1253
  import_recharts.ReferenceLine,
1241
1254
  {
1242
1255
  ...getReferenceLineProps({
1243
- index,
1244
- className: "ui-area-chart__reference-line"
1256
+ className: "ui-area-chart__reference-line",
1257
+ index
1245
1258
  })
1246
1259
  },
1247
1260
  `referenceLine-${index}`
@@ -1309,10 +1322,10 @@ var AreaChart = (0, import_core11.forwardRef)((props, ref) => {
1309
1322
  {
1310
1323
  className: "ui-area-chart__tooltip",
1311
1324
  label,
1312
- payload,
1313
- valueFormatter,
1314
1325
  labelFormatter,
1326
+ payload,
1315
1327
  unit,
1328
+ valueFormatter,
1316
1329
  ...computedTooltipProps
1317
1330
  }
1318
1331
  ),
@@ -1330,6 +1343,8 @@ var AreaChart = (0, import_core11.forwardRef)((props, ref) => {
1330
1343
  }
1331
1344
  ) });
1332
1345
  });
1346
+ AreaChart.displayName = "AreaChart";
1347
+ AreaChart.__ui__ = "AreaChart";
1333
1348
  // Annotate the CommonJS export names for ESM import in node:
1334
1349
  0 && (module.exports = {
1335
1350
  AreaChart