@yamada-ui/charts 1.1.2 → 1.1.4-dev-20240508155232

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/dist/area-chart-gradient.d.mts +11 -0
  2. package/dist/area-chart-gradient.d.ts +11 -0
  3. package/dist/area-chart-gradient.js +47 -0
  4. package/dist/area-chart-gradient.js.map +1 -0
  5. package/dist/area-chart-gradient.mjs +8 -0
  6. package/dist/area-chart-gradient.mjs.map +1 -0
  7. package/dist/area-chart-split.d.mts +10 -0
  8. package/dist/area-chart-split.d.ts +10 -0
  9. package/dist/area-chart-split.js +52 -0
  10. package/dist/area-chart-split.js.map +1 -0
  11. package/dist/area-chart-split.mjs +8 -0
  12. package/dist/area-chart-split.mjs.map +1 -0
  13. package/dist/area-chart.d.mts +41 -0
  14. package/dist/area-chart.d.ts +41 -0
  15. package/dist/area-chart.js +1223 -0
  16. package/dist/area-chart.js.map +1 -0
  17. package/dist/area-chart.mjs +21 -0
  18. package/dist/area-chart.mjs.map +1 -0
  19. package/dist/bar-chart.d.mts +38 -0
  20. package/dist/bar-chart.d.ts +38 -0
  21. package/dist/bar-chart.js +1027 -0
  22. package/dist/bar-chart.js.map +1 -0
  23. package/dist/bar-chart.mjs +19 -0
  24. package/dist/bar-chart.mjs.map +1 -0
  25. package/dist/chart-legend.d.mts +12 -0
  26. package/dist/chart-legend.d.ts +12 -0
  27. package/dist/chart-legend.js +90 -0
  28. package/dist/chart-legend.js.map +1 -0
  29. package/dist/chart-legend.mjs +11 -0
  30. package/dist/chart-legend.mjs.map +1 -0
  31. package/dist/chart-tooltip.d.mts +12 -0
  32. package/dist/chart-tooltip.d.ts +12 -0
  33. package/dist/chart-tooltip.js +121 -0
  34. package/dist/chart-tooltip.js.map +1 -0
  35. package/dist/chart-tooltip.mjs +11 -0
  36. package/dist/chart-tooltip.mjs.map +1 -0
  37. package/dist/chart-utils.d.mts +9 -0
  38. package/dist/chart-utils.d.ts +9 -0
  39. package/dist/chart-utils.js +45 -0
  40. package/dist/chart-utils.js.map +1 -0
  41. package/dist/chart-utils.mjs +10 -0
  42. package/dist/chart-utils.mjs.map +1 -0
  43. package/dist/chart.types.d.mts +78 -0
  44. package/dist/chart.types.d.ts +78 -0
  45. package/dist/chart.types.js +20 -0
  46. package/dist/chart.types.js.map +1 -0
  47. package/dist/chart.types.mjs +2 -0
  48. package/dist/chart.types.mjs.map +1 -0
  49. package/dist/chunk-4WX5YS7M.mjs +179 -0
  50. package/dist/chunk-4WX5YS7M.mjs.map +1 -0
  51. package/dist/chunk-5TVYPA64.mjs +256 -0
  52. package/dist/chunk-5TVYPA64.mjs.map +1 -0
  53. package/dist/chunk-BPR7YL3O.mjs +179 -0
  54. package/dist/chunk-BPR7YL3O.mjs.map +1 -0
  55. package/dist/chunk-E2I2XAZ6.mjs +232 -0
  56. package/dist/chunk-E2I2XAZ6.mjs.map +1 -0
  57. package/dist/chunk-HDOYOHLA.mjs +326 -0
  58. package/dist/chunk-HDOYOHLA.mjs.map +1 -0
  59. package/dist/chunk-KNAADLWO.mjs +225 -0
  60. package/dist/chunk-KNAADLWO.mjs.map +1 -0
  61. package/dist/chunk-KT4YOMM4.mjs +344 -0
  62. package/dist/chunk-KT4YOMM4.mjs.map +1 -0
  63. package/dist/chunk-LBC2B6UX.mjs +84 -0
  64. package/dist/chunk-LBC2B6UX.mjs.map +1 -0
  65. package/dist/chunk-LGMALZCN.mjs +42 -0
  66. package/dist/chunk-LGMALZCN.mjs.map +1 -0
  67. package/dist/chunk-LHI57S6P.mjs +215 -0
  68. package/dist/chunk-LHI57S6P.mjs.map +1 -0
  69. package/dist/chunk-LM2DQK2P.mjs +33 -0
  70. package/dist/chunk-LM2DQK2P.mjs.map +1 -0
  71. package/dist/chunk-MSIOYYWR.mjs +24 -0
  72. package/dist/chunk-MSIOYYWR.mjs.map +1 -0
  73. package/dist/chunk-MWPICUEW.mjs +56 -0
  74. package/dist/chunk-MWPICUEW.mjs.map +1 -0
  75. package/dist/chunk-NEGDEVRX.mjs +53 -0
  76. package/dist/chunk-NEGDEVRX.mjs.map +1 -0
  77. package/dist/chunk-OSNFBRHL.mjs +474 -0
  78. package/dist/chunk-OSNFBRHL.mjs.map +1 -0
  79. package/dist/chunk-OW7SOTEF.mjs +206 -0
  80. package/dist/chunk-OW7SOTEF.mjs.map +1 -0
  81. package/dist/chunk-P7AFSM5W.mjs +114 -0
  82. package/dist/chunk-P7AFSM5W.mjs.map +1 -0
  83. package/dist/chunk-PNE3JG54.mjs +29 -0
  84. package/dist/chunk-PNE3JG54.mjs.map +1 -0
  85. package/dist/chunk-QL3DB7OJ.mjs +21 -0
  86. package/dist/chunk-QL3DB7OJ.mjs.map +1 -0
  87. package/dist/chunk-QZ5OXZ6Z.mjs +251 -0
  88. package/dist/chunk-QZ5OXZ6Z.mjs.map +1 -0
  89. package/dist/chunk-RN6PXJAD.mjs +47 -0
  90. package/dist/chunk-RN6PXJAD.mjs.map +1 -0
  91. package/dist/chunk-STBYRLC5.mjs +208 -0
  92. package/dist/chunk-STBYRLC5.mjs.map +1 -0
  93. package/dist/chunk-XIFDRM7J.mjs +56 -0
  94. package/dist/chunk-XIFDRM7J.mjs.map +1 -0
  95. package/dist/donut-chart.d.mts +31 -0
  96. package/dist/donut-chart.d.ts +31 -0
  97. package/dist/donut-chart.js +702 -0
  98. package/dist/donut-chart.js.map +1 -0
  99. package/dist/donut-chart.mjs +16 -0
  100. package/dist/donut-chart.mjs.map +1 -0
  101. package/dist/index.d.mts +26 -0
  102. package/dist/index.d.ts +26 -0
  103. package/dist/index.js +3228 -0
  104. package/dist/index.js.map +1 -0
  105. package/dist/index.mjs +45 -0
  106. package/dist/index.mjs.map +1 -0
  107. package/dist/line-chart.d.mts +38 -0
  108. package/dist/line-chart.d.ts +38 -0
  109. package/dist/line-chart.js +1088 -0
  110. package/dist/line-chart.js.map +1 -0
  111. package/dist/line-chart.mjs +19 -0
  112. package/dist/line-chart.mjs.map +1 -0
  113. package/dist/pie-chart.d.mts +49 -0
  114. package/dist/pie-chart.d.ts +49 -0
  115. package/dist/pie-chart.js +702 -0
  116. package/dist/pie-chart.js.map +1 -0
  117. package/dist/pie-chart.mjs +16 -0
  118. package/dist/pie-chart.mjs.map +1 -0
  119. package/dist/radar-chart.d.mts +57 -0
  120. package/dist/radar-chart.d.ts +57 -0
  121. package/dist/radar-chart.js +918 -0
  122. package/dist/radar-chart.js.map +1 -0
  123. package/dist/radar-chart.mjs +16 -0
  124. package/dist/radar-chart.mjs.map +1 -0
  125. package/dist/rechart-properties.d.mts +26 -0
  126. package/dist/rechart-properties.d.ts +26 -0
  127. package/dist/rechart-properties.js +517 -0
  128. package/dist/rechart-properties.js.map +1 -0
  129. package/dist/rechart-properties.mjs +48 -0
  130. package/dist/rechart-properties.mjs.map +1 -0
  131. package/dist/use-area-chart.d.mts +123 -0
  132. package/dist/use-area-chart.d.ts +123 -0
  133. package/dist/use-area-chart.js +420 -0
  134. package/dist/use-area-chart.js.map +1 -0
  135. package/dist/use-area-chart.mjs +10 -0
  136. package/dist/use-area-chart.mjs.map +1 -0
  137. package/dist/use-bar-chart.d.mts +73 -0
  138. package/dist/use-bar-chart.d.ts +73 -0
  139. package/dist/use-bar-chart.js +290 -0
  140. package/dist/use-bar-chart.js.map +1 -0
  141. package/dist/use-bar-chart.mjs +10 -0
  142. package/dist/use-bar-chart.mjs.map +1 -0
  143. package/dist/use-chart-axis.d.mts +73 -0
  144. package/dist/use-chart-axis.d.ts +73 -0
  145. package/dist/use-chart-axis.js +227 -0
  146. package/dist/use-chart-axis.js.map +1 -0
  147. package/dist/use-chart-axis.mjs +10 -0
  148. package/dist/use-chart-axis.mjs.map +1 -0
  149. package/dist/use-chart-grid.d.mts +32 -0
  150. package/dist/use-chart-grid.d.ts +32 -0
  151. package/dist/use-chart-grid.js +92 -0
  152. package/dist/use-chart-grid.js.map +1 -0
  153. package/dist/use-chart-grid.mjs +10 -0
  154. package/dist/use-chart-grid.mjs.map +1 -0
  155. package/dist/use-chart-legend.d.mts +18 -0
  156. package/dist/use-chart-legend.d.ts +18 -0
  157. package/dist/use-chart-legend.js +81 -0
  158. package/dist/use-chart-legend.js.map +1 -0
  159. package/dist/use-chart-legend.mjs +9 -0
  160. package/dist/use-chart-legend.mjs.map +1 -0
  161. package/dist/use-chart-reference-line.d.mts +22 -0
  162. package/dist/use-chart-reference-line.d.ts +22 -0
  163. package/dist/use-chart-reference-line.js +105 -0
  164. package/dist/use-chart-reference-line.js.map +1 -0
  165. package/dist/use-chart-reference-line.mjs +10 -0
  166. package/dist/use-chart-reference-line.mjs.map +1 -0
  167. package/dist/use-chart-tooltip.d.mts +27 -0
  168. package/dist/use-chart-tooltip.d.ts +27 -0
  169. package/dist/use-chart-tooltip.js +100 -0
  170. package/dist/use-chart-tooltip.js.map +1 -0
  171. package/dist/use-chart-tooltip.mjs +10 -0
  172. package/dist/use-chart-tooltip.mjs.map +1 -0
  173. package/dist/use-chart.d.mts +33 -0
  174. package/dist/use-chart.d.ts +33 -0
  175. package/dist/use-chart.js +104 -0
  176. package/dist/use-chart.js.map +1 -0
  177. package/dist/use-chart.mjs +18 -0
  178. package/dist/use-chart.mjs.map +1 -0
  179. package/dist/use-line-chart.d.mts +97 -0
  180. package/dist/use-line-chart.d.ts +97 -0
  181. package/dist/use-line-chart.js +344 -0
  182. package/dist/use-line-chart.js.map +1 -0
  183. package/dist/use-line-chart.mjs +10 -0
  184. package/dist/use-line-chart.mjs.map +1 -0
  185. package/dist/use-pie-chart.d.mts +112 -0
  186. package/dist/use-pie-chart.d.ts +112 -0
  187. package/dist/use-pie-chart.js +282 -0
  188. package/dist/use-pie-chart.js.map +1 -0
  189. package/dist/use-pie-chart.mjs +10 -0
  190. package/dist/use-pie-chart.mjs.map +1 -0
  191. package/dist/use-radar-chart.d.mts +105 -0
  192. package/dist/use-radar-chart.d.ts +105 -0
  193. package/dist/use-radar-chart.js +473 -0
  194. package/dist/use-radar-chart.js.map +1 -0
  195. package/dist/use-radar-chart.mjs +10 -0
  196. package/dist/use-radar-chart.mjs.map +1 -0
  197. package/package.json +2 -5
@@ -0,0 +1,78 @@
1
+ import { As, HTMLUIProps, CSSUIProps } from '@yamada-ui/core';
2
+ import { Merge } from '@yamada-ui/utils';
3
+ import { ComponentPropsWithoutRef, SVGProps, ReactElement, ReactNode } from 'react';
4
+ import * as Recharts from 'recharts';
5
+
6
+ type ChartPropGetter<Y extends As = "div", M = undefined, D = undefined> = (props?: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D;
7
+ type RequiredChartPropGetter<Y extends As = "div", M = undefined, D = undefined> = (props: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D;
8
+ type ChartLayoutType = "horizontal" | "vertical";
9
+ type AreaChartType = "default" | "stacked" | "percent" | "split";
10
+ type BarChartType = Exclude<AreaChartType, "split">;
11
+ type ChartAxisType = "x" | "y" | "xy" | "none";
12
+ type ChartCurveType = "bump" | "linear" | "natural" | "monotone" | "step" | "stepBefore" | "stepAfter";
13
+ type TooltipDataSourceType = "segment" | "all";
14
+ type AreaChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.AreaChart>>;
15
+ type BarChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.BarChart>>;
16
+ type LineChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.LineChart>>;
17
+ type RadarChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.RadarChart>>;
18
+ type PieChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.PieChart>>;
19
+ type ReferenceLineProps = Merge<CSSUIProps, Recharts.ReferenceLineProps>;
20
+ type ResponsiveContainerProps = Merge<CSSUIProps, Omit<Recharts.ResponsiveContainerProps, "children">>;
21
+ type AreaProps = Merge<Merge<CSSUIProps, Recharts.AreaProps>, {
22
+ color: CSSUIProps["color"];
23
+ dot?: DotProps;
24
+ activeDot?: DotProps;
25
+ dimDot?: DotProps;
26
+ dimArea?: Partial<AreaProps>;
27
+ }>;
28
+ type LineProps = Merge<Merge<CSSUIProps, Recharts.LineProps>, {
29
+ color: CSSUIProps["color"];
30
+ activeDot?: DotProps;
31
+ dot?: DotProps;
32
+ dimDot?: DotProps;
33
+ dimLine?: Partial<LineProps>;
34
+ }>;
35
+ type BarProps = Merge<Merge<CSSUIProps, Recharts.BarProps>, {
36
+ color: CSSUIProps["color"];
37
+ activeBar?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
38
+ background?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
39
+ dimBar?: Partial<BarProps>;
40
+ }>;
41
+ type RadarProps = Merge<Merge<CSSUIProps, Recharts.RadarProps>, {
42
+ color: CSSUIProps["color"];
43
+ dot?: DotProps;
44
+ activeDot?: DotProps;
45
+ dimDot?: DotProps;
46
+ dimRadar?: Partial<RadarProps>;
47
+ }>;
48
+ type PieProps = Merge<Merge<CSSUIProps, Recharts.PieProps>, {
49
+ activeShape?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
50
+ inactiveShape?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
51
+ label?: CSSUIProps;
52
+ labelLine?: CSSUIProps;
53
+ }>;
54
+ type CellProps = Merge<CSSUIProps, {
55
+ name: string;
56
+ value: number;
57
+ dimCell?: Partial<CellProps>;
58
+ }>;
59
+ type DotProps = Merge<Omit<Recharts.DotProps, "ref">, CSSUIProps>;
60
+ type XAxisProps = Merge<Merge<CSSUIProps, Recharts.XAxisProps>, {
61
+ color?: CSSUIProps["color"];
62
+ stroke?: CSSUIProps["color"];
63
+ fill?: CSSUIProps["color"];
64
+ }>;
65
+ type YAxisProps = Merge<Merge<CSSUIProps, Recharts.YAxisProps>, {
66
+ color?: CSSUIProps["color"];
67
+ }>;
68
+ type LegendProps = Merge<CSSUIProps, Omit<Recharts.LegendProps, "ref">>;
69
+ type TooltipProps = Merge<Merge<CSSUIProps, Omit<Recharts.TooltipProps<any, any>, "ref">>, {
70
+ cursor?: CSSUIProps;
71
+ }>;
72
+ type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>;
73
+ type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>;
74
+ type PolarAngleAxisProps = Merge<Recharts.PolarAngleAxisProps, CSSUIProps>;
75
+ type PolarRadiusAxisProps = Merge<CSSUIProps, Recharts.PolarRadiusAxisProps>;
76
+ type ChartTooltip = ReactElement | ((props: Recharts.TooltipProps<number | string | Array<number | string>, number | string>) => ReactNode);
77
+
78
+ export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, CellProps, ChartAxisType, ChartCurveType, ChartLayoutType, ChartPropGetter, ChartTooltip, DotProps, GridProps, LegendProps, LineChartProps, LineProps, PieChartProps, PieProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, ReferenceLineProps, RequiredChartPropGetter, ResponsiveContainerProps, TooltipDataSourceType, TooltipProps, XAxisProps, YAxisProps };
@@ -0,0 +1,78 @@
1
+ import { As, HTMLUIProps, CSSUIProps } from '@yamada-ui/core';
2
+ import { Merge } from '@yamada-ui/utils';
3
+ import { ComponentPropsWithoutRef, SVGProps, ReactElement, ReactNode } from 'react';
4
+ import * as Recharts from 'recharts';
5
+
6
+ type ChartPropGetter<Y extends As = "div", M = undefined, D = undefined> = (props?: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D;
7
+ type RequiredChartPropGetter<Y extends As = "div", M = undefined, D = undefined> = (props: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D;
8
+ type ChartLayoutType = "horizontal" | "vertical";
9
+ type AreaChartType = "default" | "stacked" | "percent" | "split";
10
+ type BarChartType = Exclude<AreaChartType, "split">;
11
+ type ChartAxisType = "x" | "y" | "xy" | "none";
12
+ type ChartCurveType = "bump" | "linear" | "natural" | "monotone" | "step" | "stepBefore" | "stepAfter";
13
+ type TooltipDataSourceType = "segment" | "all";
14
+ type AreaChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.AreaChart>>;
15
+ type BarChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.BarChart>>;
16
+ type LineChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.LineChart>>;
17
+ type RadarChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.RadarChart>>;
18
+ type PieChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.PieChart>>;
19
+ type ReferenceLineProps = Merge<CSSUIProps, Recharts.ReferenceLineProps>;
20
+ type ResponsiveContainerProps = Merge<CSSUIProps, Omit<Recharts.ResponsiveContainerProps, "children">>;
21
+ type AreaProps = Merge<Merge<CSSUIProps, Recharts.AreaProps>, {
22
+ color: CSSUIProps["color"];
23
+ dot?: DotProps;
24
+ activeDot?: DotProps;
25
+ dimDot?: DotProps;
26
+ dimArea?: Partial<AreaProps>;
27
+ }>;
28
+ type LineProps = Merge<Merge<CSSUIProps, Recharts.LineProps>, {
29
+ color: CSSUIProps["color"];
30
+ activeDot?: DotProps;
31
+ dot?: DotProps;
32
+ dimDot?: DotProps;
33
+ dimLine?: Partial<LineProps>;
34
+ }>;
35
+ type BarProps = Merge<Merge<CSSUIProps, Recharts.BarProps>, {
36
+ color: CSSUIProps["color"];
37
+ activeBar?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
38
+ background?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
39
+ dimBar?: Partial<BarProps>;
40
+ }>;
41
+ type RadarProps = Merge<Merge<CSSUIProps, Recharts.RadarProps>, {
42
+ color: CSSUIProps["color"];
43
+ dot?: DotProps;
44
+ activeDot?: DotProps;
45
+ dimDot?: DotProps;
46
+ dimRadar?: Partial<RadarProps>;
47
+ }>;
48
+ type PieProps = Merge<Merge<CSSUIProps, Recharts.PieProps>, {
49
+ activeShape?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
50
+ inactiveShape?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
51
+ label?: CSSUIProps;
52
+ labelLine?: CSSUIProps;
53
+ }>;
54
+ type CellProps = Merge<CSSUIProps, {
55
+ name: string;
56
+ value: number;
57
+ dimCell?: Partial<CellProps>;
58
+ }>;
59
+ type DotProps = Merge<Omit<Recharts.DotProps, "ref">, CSSUIProps>;
60
+ type XAxisProps = Merge<Merge<CSSUIProps, Recharts.XAxisProps>, {
61
+ color?: CSSUIProps["color"];
62
+ stroke?: CSSUIProps["color"];
63
+ fill?: CSSUIProps["color"];
64
+ }>;
65
+ type YAxisProps = Merge<Merge<CSSUIProps, Recharts.YAxisProps>, {
66
+ color?: CSSUIProps["color"];
67
+ }>;
68
+ type LegendProps = Merge<CSSUIProps, Omit<Recharts.LegendProps, "ref">>;
69
+ type TooltipProps = Merge<Merge<CSSUIProps, Omit<Recharts.TooltipProps<any, any>, "ref">>, {
70
+ cursor?: CSSUIProps;
71
+ }>;
72
+ type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>;
73
+ type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>;
74
+ type PolarAngleAxisProps = Merge<Recharts.PolarAngleAxisProps, CSSUIProps>;
75
+ type PolarRadiusAxisProps = Merge<CSSUIProps, Recharts.PolarRadiusAxisProps>;
76
+ type ChartTooltip = ReactElement | ((props: Recharts.TooltipProps<number | string | Array<number | string>, number | string>) => ReactNode);
77
+
78
+ export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, CellProps, ChartAxisType, ChartCurveType, ChartLayoutType, ChartPropGetter, ChartTooltip, DotProps, GridProps, LegendProps, LineChartProps, LineProps, PieChartProps, PieProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, ReferenceLineProps, RequiredChartPropGetter, ResponsiveContainerProps, TooltipDataSourceType, TooltipProps, XAxisProps, YAxisProps };
@@ -0,0 +1,20 @@
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 __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from))
10
+ if (!__hasOwnProp.call(to, key) && key !== except)
11
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ }
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+
17
+ // src/chart.types.ts
18
+ var chart_types_exports = {};
19
+ module.exports = __toCommonJS(chart_types_exports);
20
+ //# sourceMappingURL=chart.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/chart.types.ts"],"sourcesContent":["import type { As, CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ComponentPropsWithoutRef,\n ReactElement,\n ReactNode,\n SVGProps,\n} from \"react\"\nimport type * as Recharts from \"recharts\"\n\nexport type ChartPropGetter<\n Y extends As = \"div\",\n M = undefined,\n D = undefined,\n> = (props?: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D\n\nexport type RequiredChartPropGetter<\n Y extends As = \"div\",\n M = undefined,\n D = undefined,\n> = (props: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D\n\nexport type ChartLayoutType = \"horizontal\" | \"vertical\"\nexport type AreaChartType = \"default\" | \"stacked\" | \"percent\" | \"split\"\nexport type BarChartType = Exclude<AreaChartType, \"split\">\nexport type ChartAxisType = \"x\" | \"y\" | \"xy\" | \"none\"\nexport type ChartCurveType =\n | \"bump\"\n | \"linear\"\n | \"natural\"\n | \"monotone\"\n | \"step\"\n | \"stepBefore\"\n | \"stepAfter\"\nexport type TooltipDataSourceType = \"segment\" | \"all\"\n\nexport type AreaChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.AreaChart>\n>\nexport type BarChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.BarChart>\n>\nexport type LineChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.LineChart>\n>\nexport type RadarChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.RadarChart>\n>\nexport type PieChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.PieChart>\n>\nexport type ReferenceLineProps = Merge<CSSUIProps, Recharts.ReferenceLineProps>\nexport type ResponsiveContainerProps = Merge<\n CSSUIProps,\n Omit<Recharts.ResponsiveContainerProps, \"children\">\n>\nexport type AreaProps = Merge<\n Merge<CSSUIProps, Recharts.AreaProps>,\n {\n color: CSSUIProps[\"color\"]\n dot?: DotProps\n activeDot?: DotProps\n dimDot?: DotProps\n dimArea?: Partial<AreaProps>\n }\n>\nexport type LineProps = Merge<\n Merge<CSSUIProps, Recharts.LineProps>,\n {\n color: CSSUIProps[\"color\"]\n activeDot?: DotProps\n dot?: DotProps\n dimDot?: DotProps\n dimLine?: Partial<LineProps>\n }\n>\nexport type BarProps = Merge<\n Merge<CSSUIProps, Recharts.BarProps>,\n {\n color: CSSUIProps[\"color\"]\n activeBar?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n background?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n dimBar?: Partial<BarProps>\n }\n>\nexport type RadarProps = Merge<\n Merge<CSSUIProps, Recharts.RadarProps>,\n {\n color: CSSUIProps[\"color\"]\n dot?: DotProps\n activeDot?: DotProps\n dimDot?: DotProps\n dimRadar?: Partial<RadarProps>\n }\n>\nexport type PieProps = Merge<\n Merge<CSSUIProps, Recharts.PieProps>,\n {\n activeShape?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n inactiveShape?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n label?: CSSUIProps\n labelLine?: CSSUIProps\n }\n>\nexport type CellProps = Merge<\n CSSUIProps,\n {\n name: string\n value: number\n dimCell?: Partial<CellProps>\n }\n>\nexport type DotProps = Merge<Omit<Recharts.DotProps, \"ref\">, CSSUIProps>\nexport type XAxisProps = Merge<\n Merge<CSSUIProps, Recharts.XAxisProps>,\n {\n color?: CSSUIProps[\"color\"]\n stroke?: CSSUIProps[\"color\"]\n fill?: CSSUIProps[\"color\"]\n }\n>\nexport type YAxisProps = Merge<\n Merge<CSSUIProps, Recharts.YAxisProps>,\n { color?: CSSUIProps[\"color\"] }\n>\nexport type LegendProps = Merge<CSSUIProps, Omit<Recharts.LegendProps, \"ref\">>\nexport type TooltipProps = Merge<\n Merge<CSSUIProps, Omit<Recharts.TooltipProps<any, any>, \"ref\">>,\n { cursor?: CSSUIProps }\n>\nexport type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>\nexport type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>\nexport type PolarAngleAxisProps = Merge<\n Recharts.PolarAngleAxisProps,\n CSSUIProps\n>\nexport type PolarRadiusAxisProps = Merge<\n CSSUIProps,\n Recharts.PolarRadiusAxisProps\n>\n\nexport type ChartTooltip =\n | ReactElement\n | ((\n props: Recharts.TooltipProps<\n number | string | Array<number | string>,\n number | string\n >,\n ) => ReactNode)\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,2 @@
1
+ "use client"
2
+ //# sourceMappingURL=chart.types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,179 @@
1
+ "use client"
2
+ import {
3
+ usePieChart
4
+ } from "./chunk-LHI57S6P.mjs";
5
+ import {
6
+ useChartLegend
7
+ } from "./chunk-LM2DQK2P.mjs";
8
+ import {
9
+ useChartTooltip
10
+ } from "./chunk-RN6PXJAD.mjs";
11
+ import {
12
+ ChartLegend
13
+ } from "./chunk-NEGDEVRX.mjs";
14
+ import {
15
+ ChartTooltip
16
+ } from "./chunk-LBC2B6UX.mjs";
17
+ import {
18
+ ChartProvider,
19
+ useChart
20
+ } from "./chunk-XIFDRM7J.mjs";
21
+
22
+ // src/pie-chart.tsx
23
+ import {
24
+ forwardRef,
25
+ omitThemeProps,
26
+ ui,
27
+ useMultiComponentStyle
28
+ } from "@yamada-ui/core";
29
+ import { cx } from "@yamada-ui/utils";
30
+ import { useMemo } from "react";
31
+ import {
32
+ Cell,
33
+ Legend,
34
+ Pie,
35
+ PieChart as RechartsPieChart,
36
+ ResponsiveContainer,
37
+ Tooltip
38
+ } from "recharts";
39
+ import { jsx, jsxs } from "react/jsx-runtime";
40
+ var PieChart = forwardRef((props, ref) => {
41
+ const [styles, mergedProps] = useMultiComponentStyle("PieChart", props);
42
+ const {
43
+ className,
44
+ data,
45
+ pieProps,
46
+ chartProps,
47
+ cellProps,
48
+ containerProps,
49
+ withTooltip = true,
50
+ withLegend = false,
51
+ tooltipProps,
52
+ tooltipAnimationDuration,
53
+ tooltipDataSource = "all",
54
+ valueFormatter,
55
+ unit,
56
+ innerRadius,
57
+ outerRadius,
58
+ paddingAngle,
59
+ startAngle,
60
+ endAngle,
61
+ withLabels,
62
+ withLabelLines,
63
+ strokeWidth,
64
+ legendProps,
65
+ ...rest
66
+ } = omitThemeProps(mergedProps);
67
+ const {
68
+ pieVars,
69
+ getPieProps,
70
+ getPieChartProps,
71
+ getCellProps,
72
+ setHighlightedArea
73
+ } = usePieChart({
74
+ data,
75
+ pieProps,
76
+ chartProps,
77
+ cellProps,
78
+ innerRadius,
79
+ outerRadius,
80
+ paddingAngle,
81
+ startAngle,
82
+ endAngle,
83
+ strokeWidth,
84
+ withLabels,
85
+ withLabelLines,
86
+ styles
87
+ });
88
+ const { getContainerProps } = useChart({ containerProps });
89
+ const { tooltipProps: computedTooltipProps, getTooltipProps } = useChartTooltip({
90
+ tooltipProps,
91
+ tooltipAnimationDuration,
92
+ styles
93
+ });
94
+ const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
95
+ legendProps
96
+ });
97
+ const cells = useMemo(
98
+ () => data.map(({ name }, index) => /* @__PURE__ */ jsx(
99
+ Cell,
100
+ {
101
+ ...getCellProps({ index, className: "ui-pie-chart__cell" })
102
+ },
103
+ `pie-cell-${name}`
104
+ )),
105
+ [data, getCellProps]
106
+ );
107
+ return /* @__PURE__ */ jsx(ChartProvider, { value: { styles }, children: /* @__PURE__ */ jsx(
108
+ ui.div,
109
+ {
110
+ ref,
111
+ className: cx("ui-pie-chart", className),
112
+ var: pieVars,
113
+ __css: { maxW: "full", ...styles.container },
114
+ ...rest,
115
+ children: /* @__PURE__ */ jsx(
116
+ ResponsiveContainer,
117
+ {
118
+ ...getContainerProps({ className: "ui-pie-chart__container" }),
119
+ children: /* @__PURE__ */ jsxs(
120
+ RechartsPieChart,
121
+ {
122
+ ...getPieChartProps({ className: "ui-pie-chart__chart" }),
123
+ children: [
124
+ /* @__PURE__ */ jsx(
125
+ Pie,
126
+ {
127
+ ...getPieProps({
128
+ className: "ui-pie-chart__pie",
129
+ labelClassName: "ui-pie-chart__label",
130
+ labelLineClassName: "ui-pie-chart__label-line"
131
+ }),
132
+ children: cells
133
+ }
134
+ ),
135
+ withLegend ? /* @__PURE__ */ jsx(
136
+ Legend,
137
+ {
138
+ content: ({ payload }) => /* @__PURE__ */ jsx(
139
+ ChartLegend,
140
+ {
141
+ className: "ui-pie-chart__legend",
142
+ payload,
143
+ onHighlight: setHighlightedArea,
144
+ ...computedLegendProps
145
+ }
146
+ ),
147
+ ...getLegendProps()
148
+ }
149
+ ) : null,
150
+ withTooltip ? /* @__PURE__ */ jsx(
151
+ Tooltip,
152
+ {
153
+ content: ({ label, payload }) => /* @__PURE__ */ jsx(
154
+ ChartTooltip,
155
+ {
156
+ className: "ui-pie-chart__tooltip",
157
+ label,
158
+ payload: tooltipDataSource === "segment" ? payload : data,
159
+ valueFormatter,
160
+ unit,
161
+ ...computedTooltipProps
162
+ }
163
+ ),
164
+ ...getTooltipProps()
165
+ }
166
+ ) : null
167
+ ]
168
+ }
169
+ )
170
+ }
171
+ )
172
+ }
173
+ ) });
174
+ });
175
+
176
+ export {
177
+ PieChart
178
+ };
179
+ //# sourceMappingURL=chunk-4WX5YS7M.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/pie-chart.tsx"],"sourcesContent":["import type { HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMemo } from \"react\"\nimport {\n Cell,\n Legend,\n Pie,\n PieChart as RechartsPieChart,\n ResponsiveContainer,\n Tooltip,\n} from \"recharts\"\nimport { ChartLegend } from \"./chart-legend\"\nimport { ChartTooltip } from \"./chart-tooltip\"\nimport type { TooltipDataSourceType } from \"./chart.types\"\nimport type { UseChartProps } from \"./use-chart\"\nimport { ChartProvider, useChart } from \"./use-chart\"\nimport type { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport {\n useChartTooltip,\n type UseChartTooltipOptions,\n} from \"./use-chart-tooltip\"\nimport type { UsePieChartOptions } from \"./use-pie-chart\"\nimport { usePieChart } from \"./use-pie-chart\"\n\ntype PieChartOptions = {\n /**\n * If `true`, tooltip is visible.\n *\n * @default true\n */\n withTooltip?: boolean\n /**\n * If `true`, legend is visible.\n *\n * @default false\n */\n withLegend?: boolean\n /**\n * Determines which data is displayed in the tooltip.\n *\n * @default 'all'\n */\n tooltipDataSource?: TooltipDataSourceType\n /**\n * A function to format values inside the tooltip\n */\n valueFormatter?: (value: number) => string\n /**\n * Unit displayed next to each tick in y-axis.\n */\n unit?: string\n}\n\nexport type PieChartProps = HTMLUIProps<\"div\"> &\n ThemeProps<\"pieChart\"> &\n PieChartOptions &\n UsePieChartOptions &\n UseChartTooltipOptions &\n UseChartLegendProps &\n UseChartProps\n\n/**\n * `PieChart` is a component for drawing pie charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/pie-chart\n */\nexport const PieChart = forwardRef<PieChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"PieChart\", props)\n const {\n className,\n data,\n pieProps,\n chartProps,\n cellProps,\n containerProps,\n withTooltip = true,\n withLegend = false,\n tooltipProps,\n tooltipAnimationDuration,\n tooltipDataSource = \"all\",\n valueFormatter,\n unit,\n innerRadius,\n outerRadius,\n paddingAngle,\n startAngle,\n endAngle,\n withLabels,\n withLabelLines,\n strokeWidth,\n legendProps,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const {\n pieVars,\n getPieProps,\n getPieChartProps,\n getCellProps,\n setHighlightedArea,\n } = usePieChart({\n data,\n pieProps,\n chartProps,\n cellProps,\n innerRadius,\n outerRadius,\n paddingAngle,\n startAngle,\n endAngle,\n strokeWidth,\n withLabels,\n withLabelLines,\n styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const { tooltipProps: computedTooltipProps, getTooltipProps } =\n useChartTooltip({\n tooltipProps,\n tooltipAnimationDuration,\n styles,\n })\n const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({\n legendProps,\n })\n\n const cells = useMemo(\n () =>\n data.map(({ name }, index) => (\n <Cell\n key={`pie-cell-${name}`}\n {...getCellProps({ index, className: \"ui-pie-chart__cell\" })}\n />\n )),\n [data, getCellProps],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-pie-chart\", className)}\n var={pieVars}\n __css={{ maxW: \"full\", ...styles.container }}\n {...rest}\n >\n <ResponsiveContainer\n {...getContainerProps({ className: \"ui-pie-chart__container\" })}\n >\n <RechartsPieChart\n {...getPieChartProps({ className: \"ui-pie-chart__chart\" })}\n >\n <Pie\n {...getPieProps({\n className: \"ui-pie-chart__pie\",\n labelClassName: \"ui-pie-chart__label\",\n labelLineClassName: \"ui-pie-chart__label-line\",\n })}\n >\n {cells}\n </Pie>\n\n {withLegend ? (\n <Legend\n content={({ payload }) => (\n <ChartLegend\n className=\"ui-pie-chart__legend\"\n payload={payload}\n onHighlight={setHighlightedArea}\n {...computedLegendProps}\n />\n )}\n {...getLegendProps()}\n />\n ) : null}\n\n {withTooltip ? (\n <Tooltip\n content={({ label, payload }) => (\n <ChartTooltip\n className=\"ui-pie-chart__tooltip\"\n label={label}\n payload={tooltipDataSource === \"segment\" ? payload : data}\n valueFormatter={valueFormatter}\n unit={unit}\n {...computedTooltipProps}\n />\n )}\n {...getTooltipProps()}\n />\n ) : null}\n </RechartsPieChart>\n </ResponsiveContainer>\n </ui.div>\n </ChartProvider>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,OACK;AAwHC,cAoBE,YApBF;AA/DD,IAAM,WAAW,WAAiC,CAAC,OAAO,QAAQ;AACvE,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,YAAY,KAAK;AACtE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI,eAAe,WAAW;AAE9B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,YAAY;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA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Q,MAClB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA,aAAa;AAAA,wBACZ,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,eAAe;AAAA;AAAA,gBACrB,IACE;AAAA,gBAEH,cACC;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS,CAAC,EAAE,OAAO,QAAQ,MACzB;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAU;AAAA,wBACV;AAAA,wBACA,SAAS,sBAAsB,YAAY,UAAU;AAAA,wBACrD;AAAA,wBACA;AAAA,wBACC,GAAG;AAAA;AAAA,oBACN;AAAA,oBAED,GAAG,gBAAgB;AAAA;AAAA,gBACtB,IACE;AAAA;AAAA;AAAA,UACN;AAAA;AAAA,MACF;AAAA;AAAA,EACF,GACF;AAEJ,CAAC;","names":[]}
@@ -0,0 +1,256 @@
1
+ "use client"
2
+ import {
3
+ useAreaChart
4
+ } from "./chunk-HDOYOHLA.mjs";
5
+ import {
6
+ AreaGradient
7
+ } from "./chunk-MSIOYYWR.mjs";
8
+ import {
9
+ AreaSplit
10
+ } from "./chunk-PNE3JG54.mjs";
11
+ import {
12
+ useChartAxis
13
+ } from "./chunk-P7AFSM5W.mjs";
14
+ import {
15
+ useChartGrid
16
+ } from "./chunk-LGMALZCN.mjs";
17
+ import {
18
+ useChartReferenceLine
19
+ } from "./chunk-MWPICUEW.mjs";
20
+ import {
21
+ useChartLegend
22
+ } from "./chunk-LM2DQK2P.mjs";
23
+ import {
24
+ useChartTooltip
25
+ } from "./chunk-RN6PXJAD.mjs";
26
+ import {
27
+ ChartLegend
28
+ } from "./chunk-NEGDEVRX.mjs";
29
+ import {
30
+ ChartTooltip
31
+ } from "./chunk-LBC2B6UX.mjs";
32
+ import {
33
+ ChartProvider,
34
+ useChart
35
+ } from "./chunk-XIFDRM7J.mjs";
36
+
37
+ // src/area-chart.tsx
38
+ import {
39
+ ui,
40
+ forwardRef,
41
+ useMultiComponentStyle,
42
+ omitThemeProps
43
+ } from "@yamada-ui/core";
44
+ import { cx } from "@yamada-ui/utils";
45
+ import { Fragment, useMemo } from "react";
46
+ import {
47
+ CartesianGrid,
48
+ Legend,
49
+ AreaChart as ReChartsAreaChart,
50
+ Area,
51
+ ReferenceLine,
52
+ ResponsiveContainer,
53
+ Tooltip,
54
+ XAxis,
55
+ YAxis
56
+ } from "recharts";
57
+ import { jsx, jsxs } from "react/jsx-runtime";
58
+ var AreaChart = forwardRef((props, ref) => {
59
+ const [styles, mergedProps] = useMultiComponentStyle("AreaChart", props);
60
+ const {
61
+ className,
62
+ series,
63
+ dataKey,
64
+ layoutType,
65
+ tickLine,
66
+ gridAxis,
67
+ withXAxis,
68
+ withYAxis,
69
+ xAxisProps,
70
+ yAxisProps,
71
+ type = "default",
72
+ withTooltip = true,
73
+ withLegend = false,
74
+ referenceLineProps = [],
75
+ containerProps,
76
+ unit,
77
+ gridProps,
78
+ strokeDasharray,
79
+ valueFormatter,
80
+ tooltipProps,
81
+ tooltipAnimationDuration,
82
+ legendProps,
83
+ data,
84
+ chartProps,
85
+ areaProps,
86
+ withGradient,
87
+ withDots,
88
+ withActiveDots,
89
+ curveType,
90
+ strokeWidth,
91
+ connectNulls,
92
+ fillOpacity,
93
+ splitColors,
94
+ splitOffset,
95
+ syncId,
96
+ ...rest
97
+ } = omitThemeProps(mergedProps);
98
+ const {
99
+ getAreaChartProps,
100
+ getAreaSplitProps,
101
+ getAreaProps,
102
+ getAreaGradientProps,
103
+ areaVars,
104
+ setHighlightedArea
105
+ } = useAreaChart({
106
+ layoutType,
107
+ type,
108
+ series,
109
+ referenceLineProps,
110
+ data,
111
+ chartProps,
112
+ areaProps,
113
+ withGradient,
114
+ withDots,
115
+ withActiveDots,
116
+ curveType,
117
+ strokeWidth,
118
+ connectNulls,
119
+ fillOpacity,
120
+ splitColors,
121
+ splitOffset,
122
+ syncId,
123
+ styles
124
+ });
125
+ const { getContainerProps } = useChart({ containerProps });
126
+ const { getXAxisProps, getYAxisProps } = useChartAxis({
127
+ dataKey,
128
+ type,
129
+ layoutType,
130
+ tickLine,
131
+ gridAxis,
132
+ withXAxis,
133
+ withYAxis,
134
+ xAxisProps,
135
+ yAxisProps,
136
+ unit,
137
+ valueFormatter,
138
+ styles
139
+ });
140
+ const { getReferenceLineProps } = useChartReferenceLine({
141
+ referenceLineProps,
142
+ styles
143
+ });
144
+ const { getGridProps } = useChartGrid({
145
+ gridProps,
146
+ gridAxis,
147
+ strokeDasharray,
148
+ styles
149
+ });
150
+ const { tooltipProps: computedTooltipProps, getTooltipProps } = useChartTooltip({
151
+ tooltipProps,
152
+ tooltipAnimationDuration,
153
+ styles
154
+ });
155
+ const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
156
+ legendProps
157
+ });
158
+ const areas = useMemo(
159
+ () => series.map(({ dataKey: dataKey2 }, index) => {
160
+ const { id, stroke, ...rest2 } = getAreaProps({
161
+ index,
162
+ className: "ui-area-chart__area"
163
+ });
164
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
165
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(AreaGradient, { ...getAreaGradientProps({ id, color: stroke }) }) }),
166
+ /* @__PURE__ */ jsx(Area, { id, stroke, ...rest2 })
167
+ ] }, `area-${dataKey2}`);
168
+ }),
169
+ [getAreaGradientProps, getAreaProps, series]
170
+ );
171
+ const referenceLinesItems = useMemo(
172
+ () => referenceLineProps.map((_, index) => /* @__PURE__ */ jsx(
173
+ ReferenceLine,
174
+ {
175
+ ...getReferenceLineProps({
176
+ index,
177
+ className: "ui-area-chart__reference-line"
178
+ })
179
+ },
180
+ `referenceLine-${index}`
181
+ )),
182
+ [getReferenceLineProps, referenceLineProps]
183
+ );
184
+ return /* @__PURE__ */ jsx(ChartProvider, { value: { styles }, children: /* @__PURE__ */ jsx(
185
+ ui.div,
186
+ {
187
+ ref,
188
+ className: cx("ui-area-chart", className),
189
+ var: areaVars,
190
+ __css: { maxW: "full", ...styles.container },
191
+ ...rest,
192
+ children: /* @__PURE__ */ jsx(
193
+ ResponsiveContainer,
194
+ {
195
+ ...getContainerProps({ className: "ui-area-chart__container" }),
196
+ children: /* @__PURE__ */ jsxs(
197
+ ReChartsAreaChart,
198
+ {
199
+ ...getAreaChartProps({ className: "ui-area-chart__chart" }),
200
+ children: [
201
+ /* @__PURE__ */ jsx(
202
+ CartesianGrid,
203
+ {
204
+ ...getGridProps({ className: "ui-area-chart__grid" })
205
+ }
206
+ ),
207
+ /* @__PURE__ */ jsx(XAxis, { ...getXAxisProps({ className: "ui-area-chart__x-axis" }) }),
208
+ /* @__PURE__ */ jsx(YAxis, { ...getYAxisProps({ className: "ui-area-chart__y-axis" }) }),
209
+ withLegend ? /* @__PURE__ */ jsx(
210
+ Legend,
211
+ {
212
+ content: ({ payload }) => /* @__PURE__ */ jsx(
213
+ ChartLegend,
214
+ {
215
+ className: "ui-area-chart__legend",
216
+ payload,
217
+ onHighlight: setHighlightedArea,
218
+ ...computedLegendProps
219
+ }
220
+ ),
221
+ ...getLegendProps()
222
+ }
223
+ ) : null,
224
+ withTooltip ? /* @__PURE__ */ jsx(
225
+ Tooltip,
226
+ {
227
+ content: ({ label, payload }) => /* @__PURE__ */ jsx(
228
+ ChartTooltip,
229
+ {
230
+ className: "ui-area-chart__tooltip",
231
+ label,
232
+ payload,
233
+ valueFormatter,
234
+ unit,
235
+ ...computedTooltipProps
236
+ }
237
+ ),
238
+ ...getTooltipProps()
239
+ }
240
+ ) : null,
241
+ type === "split" ? /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(AreaSplit, { ...getAreaSplitProps() }) }) : null,
242
+ areas,
243
+ referenceLinesItems
244
+ ]
245
+ }
246
+ )
247
+ }
248
+ )
249
+ }
250
+ ) });
251
+ });
252
+
253
+ export {
254
+ AreaChart
255
+ };
256
+ //# sourceMappingURL=chunk-5TVYPA64.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/area-chart.tsx"],"sourcesContent":["import type { HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { Fragment, useMemo } from \"react\"\nimport {\n CartesianGrid,\n Legend,\n AreaChart as ReChartsAreaChart,\n Area,\n ReferenceLine,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\"\nimport { AreaGradient } from \"./area-chart-gradient\"\nimport { AreaSplit } from \"./area-chart-split\"\nimport { ChartLegend } from \"./chart-legend\"\nimport { ChartTooltip } from \"./chart-tooltip\"\nimport type { UseAreaChartOptions } from \"./use-area-chart\"\nimport { useAreaChart } from \"./use-area-chart\"\nimport type { UseChartProps } from \"./use-chart\"\nimport { ChartProvider, useChart } from \"./use-chart\"\nimport type { UseChartAxisOptions } from \"./use-chart-axis\"\nimport { useChartAxis } from \"./use-chart-axis\"\nimport type { UseChartGridOptions } from \"./use-chart-grid\"\nimport { useChartGrid } from \"./use-chart-grid\"\nimport type { UseChartLegendProps } from \"./use-chart-legend\"\nimport { useChartLegend } from \"./use-chart-legend\"\nimport type { UseChartReferenceLineOptions } from \"./use-chart-reference-line\"\nimport { useChartReferenceLine } from \"./use-chart-reference-line\"\nimport type { UseChartTooltipOptions } from \"./use-chart-tooltip\"\nimport { useChartTooltip } from \"./use-chart-tooltip\"\n\ntype AreaChartOptions = {\n /**\n * If `true`, tooltip is visible.\n *\n * @default true\n */\n withTooltip?: boolean\n /**\n * If `true`, legend is visible.\n *\n * @default false\n */\n withLegend?: boolean\n}\n\nexport type AreaChartProps = HTMLUIProps<\"div\"> &\n ThemeProps<\"AreaChart\"> &\n AreaChartOptions &\n UseAreaChartOptions &\n UseChartProps &\n UseChartAxisOptions &\n UseChartReferenceLineOptions &\n UseChartGridOptions &\n UseChartTooltipOptions &\n UseChartLegendProps\n\n/**\n * `AreaChart` is a component for drawing area charts to compare multiple sets of data.\n *\n * @see Docs https://yamada-ui.com/components/feedback/area-chart\n */\nexport const AreaChart = forwardRef<AreaChartProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"AreaChart\", props)\n const {\n className,\n series,\n dataKey,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n type = \"default\",\n withTooltip = true,\n withLegend = false,\n referenceLineProps = [],\n containerProps,\n unit,\n gridProps,\n strokeDasharray,\n valueFormatter,\n tooltipProps,\n tooltipAnimationDuration,\n legendProps,\n data,\n chartProps,\n areaProps,\n withGradient,\n withDots,\n withActiveDots,\n curveType,\n strokeWidth,\n connectNulls,\n fillOpacity,\n splitColors,\n splitOffset,\n syncId,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const {\n getAreaChartProps,\n getAreaSplitProps,\n getAreaProps,\n getAreaGradientProps,\n areaVars,\n setHighlightedArea,\n } = useAreaChart({\n layoutType,\n type,\n series,\n referenceLineProps,\n data,\n chartProps,\n areaProps,\n withGradient,\n withDots,\n withActiveDots,\n curveType,\n strokeWidth,\n connectNulls,\n fillOpacity,\n splitColors,\n splitOffset,\n syncId,\n styles,\n })\n const { getContainerProps } = useChart({ containerProps })\n const { getXAxisProps, getYAxisProps } = useChartAxis({\n dataKey,\n type,\n layoutType,\n tickLine,\n gridAxis,\n withXAxis,\n withYAxis,\n xAxisProps,\n yAxisProps,\n unit,\n valueFormatter,\n styles,\n })\n const { getReferenceLineProps } = useChartReferenceLine({\n referenceLineProps,\n styles,\n })\n const { getGridProps } = useChartGrid({\n gridProps,\n gridAxis,\n strokeDasharray,\n styles,\n })\n const { tooltipProps: computedTooltipProps, getTooltipProps } =\n useChartTooltip({\n tooltipProps,\n tooltipAnimationDuration,\n styles,\n })\n const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({\n legendProps,\n })\n\n const areas = useMemo(\n () =>\n series.map(({ dataKey }, index) => {\n const { id, stroke, ...rest } = getAreaProps({\n index,\n className: \"ui-area-chart__area\",\n })\n\n return (\n <Fragment key={`area-${dataKey}`}>\n <defs>\n <AreaGradient {...getAreaGradientProps({ id, color: stroke })} />\n </defs>\n\n <Area id={id} stroke={stroke} {...rest} />\n </Fragment>\n )\n }),\n [getAreaGradientProps, getAreaProps, series],\n )\n\n const referenceLinesItems = useMemo(\n () =>\n referenceLineProps.map((_, index) => (\n <ReferenceLine\n key={`referenceLine-${index}`}\n {...getReferenceLineProps({\n index,\n className: \"ui-area-chart__reference-line\",\n })}\n />\n )),\n [getReferenceLineProps, referenceLineProps],\n )\n\n return (\n <ChartProvider value={{ styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-area-chart\", className)}\n var={areaVars}\n __css={{ maxW: \"full\", ...styles.container }}\n {...rest}\n >\n <ResponsiveContainer\n {...getContainerProps({ className: \"ui-area-chart__container\" })}\n >\n <ReChartsAreaChart\n {...getAreaChartProps({ className: \"ui-area-chart__chart\" })}\n >\n <CartesianGrid\n {...getGridProps({ className: \"ui-area-chart__grid\" })}\n />\n <XAxis {...getXAxisProps({ className: \"ui-area-chart__x-axis\" })} />\n <YAxis {...getYAxisProps({ className: \"ui-area-chart__y-axis\" })} />\n\n {withLegend ? (\n <Legend\n content={({ payload }) => (\n <ChartLegend\n className=\"ui-area-chart__legend\"\n payload={payload}\n onHighlight={setHighlightedArea}\n {...computedLegendProps}\n />\n )}\n {...getLegendProps()}\n />\n ) : null}\n\n {withTooltip ? (\n <Tooltip\n content={({ label, payload }) => (\n <ChartTooltip\n className=\"ui-area-chart__tooltip\"\n label={label}\n payload={payload}\n valueFormatter={valueFormatter}\n unit={unit}\n {...computedTooltipProps}\n />\n )}\n {...getTooltipProps()}\n />\n ) : null}\n\n {type === \"split\" ? (\n <defs>\n <AreaSplit {...getAreaSplitProps()} />\n </defs>\n ) : null}\n\n {areas}\n {referenceLinesItems}\n </ReChartsAreaChart>\n </ResponsiveContainer>\n </ui.div>\n </ChartProvider>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;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