@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
@@ -1,13 +1,13 @@
1
+ import * as recharts_types_chart_generateCategoricalChart from 'recharts/types/chart/generateCategoricalChart';
1
2
  import * as react from 'react';
2
3
  import * as _yamada_ui_utils from '@yamada-ui/utils';
3
4
  import { Dict } from '@yamada-ui/utils';
4
5
  import * as _yamada_ui_core from '@yamada-ui/core';
5
6
  import { RequiredPropGetter, PropGetter, CSSUIObject } from '@yamada-ui/core';
6
- import * as recharts_types_chart_generateCategoricalChart from 'recharts/types/chart/generateCategoricalChart';
7
7
  import * as Recharts from 'recharts';
8
8
  import { AreaGradientProps } from './area-chart-gradient.mjs';
9
9
  import { AreaSplitProps } from './area-chart-split.mjs';
10
- import { AreaProps, AreaChartType, AreaChartProps, ChartLayoutType, ChartCurveType, ReferenceLineProps } from './chart.types.mjs';
10
+ import { AreaProps, AreaChartType, ChartCurveType, ChartLayoutType, AreaChartProps, ReferenceLineProps } from './chart.types.mjs';
11
11
 
12
12
  interface UseAreaChartOptions {
13
13
  /**
@@ -18,10 +18,6 @@ interface UseAreaChartOptions {
18
18
  * An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.
19
19
  */
20
20
  series: AreaProps[];
21
- /**
22
- * Props for the areas.
23
- */
24
- areaProps?: Partial<AreaProps>;
25
21
  /**
26
22
  * Controls how chart areas are positioned relative to each other.
27
23
  *
@@ -29,36 +25,11 @@ interface UseAreaChartOptions {
29
25
  */
30
26
  type?: AreaChartType;
31
27
  /**
32
- * Props passed down to recharts `AreaChart` component.
33
- */
34
- chartProps?: AreaChartProps;
35
- /**
36
- * If any two categorical charts have the same syncId,
37
- * these two charts can sync the position tooltip, and the startIndex, endIndex of Brush.
38
- */
39
- syncId?: number | string;
40
- /**
41
- * Chart orientation.
42
- *
43
- * @default 'horizontal'
44
- */
45
- layoutType?: ChartLayoutType;
46
- /**
47
- * Determines whether the chart area should be represented with a gradient instead of the solid color.
48
- */
49
- withGradient?: boolean;
50
- /**
51
- * Determines whether dots should be displayed.
52
- *
53
- * @default true
54
- */
55
- withDots?: boolean;
56
- /**
57
- * Determines whether activeDots should be displayed.
28
+ * Determines whether points with `null` values should be connected.
58
29
  *
59
30
  * @default true
60
31
  */
61
- withActiveDots?: boolean;
32
+ connectNulls?: boolean;
62
33
  /**
63
34
  * Type of the curve.
64
35
  *
@@ -66,17 +37,17 @@ interface UseAreaChartOptions {
66
37
  */
67
38
  curveType?: ChartCurveType;
68
39
  /**
69
- * Stroke width for the chart areas.
40
+ * Controls fill opacity of all areas.
70
41
  *
71
- * @default 2
42
+ * @default 0.4
72
43
  */
73
- strokeWidth?: number;
44
+ fillOpacity?: [number, number] | number;
74
45
  /**
75
- * Determines whether points with `null` values should be connected.
46
+ * Chart orientation.
76
47
  *
77
- * @default true
48
+ * @default 'horizontal'
78
49
  */
79
- connectNulls?: boolean;
50
+ layoutType?: ChartLayoutType;
80
51
  /**
81
52
  * A tuple of colors used when `type="split"` is set, ignored in all other cases.
82
53
  *
@@ -89,15 +60,32 @@ interface UseAreaChartOptions {
89
60
  */
90
61
  splitOffset?: number;
91
62
  /**
92
- * Reference lines that should be displayed on the chart.
63
+ * Stroke width for the chart areas.
64
+ *
65
+ * @default 2
93
66
  */
94
- referenceLineProps?: ReferenceLineProps[];
67
+ strokeWidth?: number;
95
68
  /**
96
- * Controls fill opacity of all areas.
69
+ * If any two categorical charts have the same syncId,
70
+ * these two charts can sync the position tooltip, and the startIndex, endIndex of Brush.
71
+ */
72
+ syncId?: number | string;
73
+ /**
74
+ * Determines whether activeDots should be displayed.
97
75
  *
98
- * @default 0.4
76
+ * @default true
77
+ */
78
+ withActiveDots?: boolean;
79
+ /**
80
+ * Determines whether dots should be displayed.
81
+ *
82
+ * @default true
99
83
  */
100
- fillOpacity?: number | [number, number];
84
+ withDots?: boolean;
85
+ /**
86
+ * Determines whether the chart area should be represented with a gradient instead of the solid color.
87
+ */
88
+ withGradient?: boolean;
101
89
  /**
102
90
  * A label to display below the X axis.
103
91
  */
@@ -106,24 +94,36 @@ interface UseAreaChartOptions {
106
94
  * A label to display below the Y axis.
107
95
  */
108
96
  yAxisLabel?: string;
97
+ /**
98
+ * Props for the areas.
99
+ */
100
+ areaProps?: Partial<AreaProps>;
101
+ /**
102
+ * Props passed down to recharts `AreaChart` component.
103
+ */
104
+ chartProps?: AreaChartProps;
105
+ /**
106
+ * Reference lines that should be displayed on the chart.
107
+ */
108
+ referenceLineProps?: ReferenceLineProps[];
109
109
  }
110
110
  interface UseAreaChartProps extends UseAreaChartOptions {
111
- styles: Dict<CSSUIObject>;
111
+ styles: Dict<CSSUIObject | undefined>;
112
112
  }
113
- declare const useAreaChart: ({ data, series, type, layoutType, withGradient: withGradientProp, withDots, withActiveDots, curveType, strokeWidth, connectNulls, fillOpacity, splitColors, splitOffset, referenceLineProps, syncId, xAxisLabel, yAxisLabel, styles, ...rest }: UseAreaChartProps) => {
114
- getAreaChartProps: RequiredPropGetter<recharts_types_chart_generateCategoricalChart.CategoricalChartProps, recharts_types_chart_generateCategoricalChart.CategoricalChartProps>;
115
- getAreaSplitProps: PropGetter<Partial<AreaSplitProps>, AreaSplitProps>;
116
- getAreaProps: RequiredPropGetter<Partial<Recharts.AreaProps> & {
117
- index: number;
118
- }, Omit<Recharts.AreaProps, "ref">>;
119
- getAreaGradientProps: PropGetter<Partial<AreaGradientProps>, AreaGradientProps>;
113
+ declare const useAreaChart: ({ type, connectNulls, curveType, data, fillOpacity, layoutType, series, splitColors, splitOffset, strokeWidth, styles, syncId, withActiveDots, withDots, withGradient: withGradientProp, xAxisLabel, yAxisLabel, referenceLineProps, ...rest }: UseAreaChartProps) => {
120
114
  areaVars: {
121
- __prefix?: string;
122
115
  name: string;
123
116
  token?: _yamada_ui_core.ThemeToken;
124
117
  value?: _yamada_ui_core.Token<number | _yamada_ui_utils.StringLiteral>;
118
+ __prefix?: string;
125
119
  }[];
126
120
  setHighlightedArea: react.Dispatch<react.SetStateAction<string | null>>;
121
+ getAreaChartProps: RequiredPropGetter<recharts_types_chart_generateCategoricalChart.CategoricalChartProps, recharts_types_chart_generateCategoricalChart.CategoricalChartProps>;
122
+ getAreaGradientProps: PropGetter<Partial<AreaGradientProps>, AreaGradientProps>;
123
+ getAreaProps: RequiredPropGetter<{
124
+ index: number;
125
+ } & Partial<Recharts.AreaProps>, Omit<Recharts.AreaProps, "ref">>;
126
+ getAreaSplitProps: PropGetter<Partial<AreaSplitProps>, AreaSplitProps>;
127
127
  };
128
128
  type UseAreaChartReturn = ReturnType<typeof useAreaChart>;
129
129
 
@@ -1,13 +1,13 @@
1
+ import * as recharts_types_chart_generateCategoricalChart from 'recharts/types/chart/generateCategoricalChart';
1
2
  import * as react from 'react';
2
3
  import * as _yamada_ui_utils from '@yamada-ui/utils';
3
4
  import { Dict } from '@yamada-ui/utils';
4
5
  import * as _yamada_ui_core from '@yamada-ui/core';
5
6
  import { RequiredPropGetter, PropGetter, CSSUIObject } from '@yamada-ui/core';
6
- import * as recharts_types_chart_generateCategoricalChart from 'recharts/types/chart/generateCategoricalChart';
7
7
  import * as Recharts from 'recharts';
8
8
  import { AreaGradientProps } from './area-chart-gradient.js';
9
9
  import { AreaSplitProps } from './area-chart-split.js';
10
- import { AreaProps, AreaChartType, AreaChartProps, ChartLayoutType, ChartCurveType, ReferenceLineProps } from './chart.types.js';
10
+ import { AreaProps, AreaChartType, ChartCurveType, ChartLayoutType, AreaChartProps, ReferenceLineProps } from './chart.types.js';
11
11
 
12
12
  interface UseAreaChartOptions {
13
13
  /**
@@ -18,10 +18,6 @@ interface UseAreaChartOptions {
18
18
  * An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.
19
19
  */
20
20
  series: AreaProps[];
21
- /**
22
- * Props for the areas.
23
- */
24
- areaProps?: Partial<AreaProps>;
25
21
  /**
26
22
  * Controls how chart areas are positioned relative to each other.
27
23
  *
@@ -29,36 +25,11 @@ interface UseAreaChartOptions {
29
25
  */
30
26
  type?: AreaChartType;
31
27
  /**
32
- * Props passed down to recharts `AreaChart` component.
33
- */
34
- chartProps?: AreaChartProps;
35
- /**
36
- * If any two categorical charts have the same syncId,
37
- * these two charts can sync the position tooltip, and the startIndex, endIndex of Brush.
38
- */
39
- syncId?: number | string;
40
- /**
41
- * Chart orientation.
42
- *
43
- * @default 'horizontal'
44
- */
45
- layoutType?: ChartLayoutType;
46
- /**
47
- * Determines whether the chart area should be represented with a gradient instead of the solid color.
48
- */
49
- withGradient?: boolean;
50
- /**
51
- * Determines whether dots should be displayed.
52
- *
53
- * @default true
54
- */
55
- withDots?: boolean;
56
- /**
57
- * Determines whether activeDots should be displayed.
28
+ * Determines whether points with `null` values should be connected.
58
29
  *
59
30
  * @default true
60
31
  */
61
- withActiveDots?: boolean;
32
+ connectNulls?: boolean;
62
33
  /**
63
34
  * Type of the curve.
64
35
  *
@@ -66,17 +37,17 @@ interface UseAreaChartOptions {
66
37
  */
67
38
  curveType?: ChartCurveType;
68
39
  /**
69
- * Stroke width for the chart areas.
40
+ * Controls fill opacity of all areas.
70
41
  *
71
- * @default 2
42
+ * @default 0.4
72
43
  */
73
- strokeWidth?: number;
44
+ fillOpacity?: [number, number] | number;
74
45
  /**
75
- * Determines whether points with `null` values should be connected.
46
+ * Chart orientation.
76
47
  *
77
- * @default true
48
+ * @default 'horizontal'
78
49
  */
79
- connectNulls?: boolean;
50
+ layoutType?: ChartLayoutType;
80
51
  /**
81
52
  * A tuple of colors used when `type="split"` is set, ignored in all other cases.
82
53
  *
@@ -89,15 +60,32 @@ interface UseAreaChartOptions {
89
60
  */
90
61
  splitOffset?: number;
91
62
  /**
92
- * Reference lines that should be displayed on the chart.
63
+ * Stroke width for the chart areas.
64
+ *
65
+ * @default 2
93
66
  */
94
- referenceLineProps?: ReferenceLineProps[];
67
+ strokeWidth?: number;
95
68
  /**
96
- * Controls fill opacity of all areas.
69
+ * If any two categorical charts have the same syncId,
70
+ * these two charts can sync the position tooltip, and the startIndex, endIndex of Brush.
71
+ */
72
+ syncId?: number | string;
73
+ /**
74
+ * Determines whether activeDots should be displayed.
97
75
  *
98
- * @default 0.4
76
+ * @default true
77
+ */
78
+ withActiveDots?: boolean;
79
+ /**
80
+ * Determines whether dots should be displayed.
81
+ *
82
+ * @default true
99
83
  */
100
- fillOpacity?: number | [number, number];
84
+ withDots?: boolean;
85
+ /**
86
+ * Determines whether the chart area should be represented with a gradient instead of the solid color.
87
+ */
88
+ withGradient?: boolean;
101
89
  /**
102
90
  * A label to display below the X axis.
103
91
  */
@@ -106,24 +94,36 @@ interface UseAreaChartOptions {
106
94
  * A label to display below the Y axis.
107
95
  */
108
96
  yAxisLabel?: string;
97
+ /**
98
+ * Props for the areas.
99
+ */
100
+ areaProps?: Partial<AreaProps>;
101
+ /**
102
+ * Props passed down to recharts `AreaChart` component.
103
+ */
104
+ chartProps?: AreaChartProps;
105
+ /**
106
+ * Reference lines that should be displayed on the chart.
107
+ */
108
+ referenceLineProps?: ReferenceLineProps[];
109
109
  }
110
110
  interface UseAreaChartProps extends UseAreaChartOptions {
111
- styles: Dict<CSSUIObject>;
111
+ styles: Dict<CSSUIObject | undefined>;
112
112
  }
113
- declare const useAreaChart: ({ data, series, type, layoutType, withGradient: withGradientProp, withDots, withActiveDots, curveType, strokeWidth, connectNulls, fillOpacity, splitColors, splitOffset, referenceLineProps, syncId, xAxisLabel, yAxisLabel, styles, ...rest }: UseAreaChartProps) => {
114
- getAreaChartProps: RequiredPropGetter<recharts_types_chart_generateCategoricalChart.CategoricalChartProps, recharts_types_chart_generateCategoricalChart.CategoricalChartProps>;
115
- getAreaSplitProps: PropGetter<Partial<AreaSplitProps>, AreaSplitProps>;
116
- getAreaProps: RequiredPropGetter<Partial<Recharts.AreaProps> & {
117
- index: number;
118
- }, Omit<Recharts.AreaProps, "ref">>;
119
- getAreaGradientProps: PropGetter<Partial<AreaGradientProps>, AreaGradientProps>;
113
+ declare const useAreaChart: ({ type, connectNulls, curveType, data, fillOpacity, layoutType, series, splitColors, splitOffset, strokeWidth, styles, syncId, withActiveDots, withDots, withGradient: withGradientProp, xAxisLabel, yAxisLabel, referenceLineProps, ...rest }: UseAreaChartProps) => {
120
114
  areaVars: {
121
- __prefix?: string;
122
115
  name: string;
123
116
  token?: _yamada_ui_core.ThemeToken;
124
117
  value?: _yamada_ui_core.Token<number | _yamada_ui_utils.StringLiteral>;
118
+ __prefix?: string;
125
119
  }[];
126
120
  setHighlightedArea: react.Dispatch<react.SetStateAction<string | null>>;
121
+ getAreaChartProps: RequiredPropGetter<recharts_types_chart_generateCategoricalChart.CategoricalChartProps, recharts_types_chart_generateCategoricalChart.CategoricalChartProps>;
122
+ getAreaGradientProps: PropGetter<Partial<AreaGradientProps>, AreaGradientProps>;
123
+ getAreaProps: RequiredPropGetter<{
124
+ index: number;
125
+ } & Partial<Recharts.AreaProps>, Omit<Recharts.AreaProps, "ref">>;
126
+ getAreaSplitProps: PropGetter<Partial<AreaSplitProps>, AreaSplitProps>;
127
127
  };
128
128
  type UseAreaChartReturn = ReturnType<typeof useAreaChart>;
129
129
 
@@ -107,24 +107,24 @@ var dotProperties = [
107
107
 
108
108
  // src/use-area-chart.ts
109
109
  var useAreaChart = ({
110
- data,
111
- series,
112
110
  type,
113
- layoutType = "horizontal",
114
- withGradient: withGradientProp,
115
- withDots = true,
116
- withActiveDots = true,
117
- curveType = "monotone",
118
- strokeWidth = 2,
119
111
  connectNulls = true,
112
+ curveType = "monotone",
113
+ data,
120
114
  fillOpacity = 0.4,
115
+ layoutType = "horizontal",
116
+ series,
121
117
  splitColors = ["#ee6a5d", "#5fce7d"],
122
118
  splitOffset,
123
- referenceLineProps,
119
+ strokeWidth = 2,
120
+ styles,
124
121
  syncId,
122
+ withActiveDots = true,
123
+ withDots = true,
124
+ withGradient: withGradientProp,
125
125
  xAxisLabel,
126
126
  yAxisLabel,
127
- styles,
127
+ referenceLineProps,
128
128
  ...rest
129
129
  }) => {
130
130
  var _a;
@@ -136,10 +136,10 @@ var useAreaChart = ({
136
136
  const withGradient = typeof withGradientProp === "boolean" ? withGradientProp : type === "default";
137
137
  const shouldHighlight = highlightedArea !== null;
138
138
  const {
139
- dot = {},
140
139
  activeDot = {},
141
- dimDot,
142
140
  dimArea,
141
+ dimDot,
142
+ dot = {},
143
143
  ...computedAreaProps
144
144
  } = (_a = rest.areaProps) != null ? _a : {};
145
145
  const areaColors = (0, import_react.useMemo)(
@@ -154,7 +154,7 @@ var useAreaChart = ({
154
154
  () => splitColors.map((color, index) => ({
155
155
  name: `area-split-${index}`,
156
156
  token: "colors",
157
- value: color != null ? color : "transparent"
157
+ value: color || "transparent"
158
158
  })),
159
159
  [splitColors]
160
160
  );
@@ -227,24 +227,27 @@ var useAreaChart = ({
227
227
  );
228
228
  }, [dimDot, theme]);
229
229
  const defaultSplitOffset = (0, import_react.useMemo)(() => {
230
+ var _a2;
230
231
  if (series.length === 1) {
231
- const dataKey = series[0].dataKey;
232
- const dataMax = Math.max(...data.map((item) => item[dataKey]));
233
- const dataMin = Math.min(...data.map((item) => item[dataKey]));
234
- if (dataMax <= 0) return 0;
235
- if (dataMin >= 0) return 1;
236
- return dataMax / (dataMax - dataMin);
232
+ const dataKey = (_a2 = series[0]) == null ? void 0 : _a2.dataKey;
233
+ if (dataKey) {
234
+ const dataMax = Math.max(...data.map((item) => item[dataKey]));
235
+ const dataMin = Math.min(...data.map((item) => item[dataKey]));
236
+ if (dataMax <= 0) return 0;
237
+ if (dataMin >= 0) return 1;
238
+ return dataMax / (dataMax - dataMin);
239
+ }
237
240
  }
238
241
  return 0.5;
239
242
  }, [data, series]);
240
243
  const areaPropsList = (0, import_react.useMemo)(
241
244
  () => series.map((props, index) => {
242
245
  const {
243
- dataKey,
244
- dot: dot2 = {},
245
246
  activeDot: activeDot2 = {},
246
- dimDot: dimDot2 = {},
247
+ dataKey,
247
248
  dimArea: dimArea2 = {},
249
+ dimDot: dimDot2 = {},
250
+ dot: dot2 = {},
248
251
  strokeDasharray,
249
252
  ...computedProps
250
253
  } = props;
@@ -271,8 +274,8 @@ var useAreaChart = ({
271
274
  )(theme);
272
275
  resolvedActiveDot = {
273
276
  className: (0, import_utils2.cx)("ui-area-chart__active-dot", className),
274
- stroke: color,
275
277
  r: 4,
278
+ stroke: color,
276
279
  ...rest3
277
280
  };
278
281
  } else {
@@ -303,11 +306,11 @@ var useAreaChart = ({
303
306
  return {
304
307
  ...rest2,
305
308
  id,
309
+ activeDot: resolvedActiveDot,
306
310
  color,
307
- strokeDasharray,
308
311
  dataKey,
309
- activeDot: resolvedActiveDot,
310
- dot: resolvedDot
312
+ dot: resolvedDot,
313
+ strokeDasharray
311
314
  };
312
315
  }),
313
316
  [
@@ -335,14 +338,14 @@ var useAreaChart = ({
335
338
  ref,
336
339
  className: (0, import_utils2.cx)(className, areaChartClassName),
337
340
  data,
338
- stackOffset: type === "percent" ? "expand" : void 0,
339
341
  layout: layoutType,
340
- syncId,
341
342
  margin: {
342
343
  bottom: xAxisLabel ? 30 : void 0,
343
344
  left: yAxisLabel ? 10 : void 0,
344
345
  right: yAxisLabel ? 5 : void 0
345
346
  },
347
+ stackOffset: type === "percent" ? "expand" : void 0,
348
+ syncId,
346
349
  ...props,
347
350
  ...chartProps
348
351
  }),
@@ -360,40 +363,41 @@ var useAreaChart = ({
360
363
  const getAreaSplitProps = (0, import_react.useCallback)(
361
364
  (props = {}) => ({
362
365
  id: splitId,
363
- offset: splitOffset != null ? splitOffset : defaultSplitOffset,
364
366
  fillOpacity: fillOpacityVar,
367
+ offset: splitOffset != null ? splitOffset : defaultSplitOffset,
365
368
  ...props
366
369
  }),
367
370
  [defaultSplitOffset, splitId, splitOffset, fillOpacityVar]
368
371
  );
369
372
  const getAreaProps = (0, import_react.useCallback)(
370
- ({ index, className: classNameProp, ...props }, ref = null) => {
373
+ ({ className: classNameProp, index, ...props }, ref = null) => {
374
+ var _a2;
371
375
  const {
372
376
  id,
373
- color,
374
377
  className,
375
- dataKey,
376
- strokeDasharray,
377
378
  activeDot: activeDot2,
379
+ color,
380
+ dataKey = "",
378
381
  dot: dot2,
382
+ strokeDasharray,
379
383
  ...rest2
380
- } = areaPropsList[index];
384
+ } = (_a2 = areaPropsList[index]) != null ? _a2 : {};
381
385
  return {
386
+ id,
382
387
  ref,
388
+ type: curveType,
389
+ name: dataKey,
383
390
  className: (0, import_utils2.cx)(classNameProp, className),
384
- id,
385
391
  activeDot: activeDot2,
386
- dot: dot2,
387
- name: dataKey,
388
- type: curveType,
392
+ connectNulls,
389
393
  dataKey,
394
+ dot: dot2,
390
395
  fill: type === "split" ? `url(#${splitId})` : `url(#${id})`,
391
- strokeWidth,
392
- stroke: color,
393
396
  isAnimationActive: false,
394
- connectNulls,
395
397
  stackId: stacked ? "stack" : void 0,
398
+ stroke: color,
396
399
  strokeDasharray,
400
+ strokeWidth,
397
401
  ...props,
398
402
  ...rest2
399
403
  };
@@ -410,19 +414,19 @@ var useAreaChart = ({
410
414
  );
411
415
  const getAreaGradientProps = (0, import_react.useCallback)(
412
416
  (props = {}) => ({
413
- withGradient,
414
417
  fillOpacity: fillOpacityVar,
418
+ withGradient,
415
419
  ...props
416
420
  }),
417
421
  [withGradient, fillOpacityVar]
418
422
  );
419
423
  return {
424
+ areaVars,
425
+ setHighlightedArea,
420
426
  getAreaChartProps,
421
- getAreaSplitProps,
422
- getAreaProps,
423
427
  getAreaGradientProps,
424
- areaVars,
425
- setHighlightedArea
428
+ getAreaProps,
429
+ getAreaSplitProps
426
430
  };
427
431
  };
428
432
  // Annotate the CommonJS export names for ESM import in node: