@yamada-ui/charts 1.1.2-dev-20240430063353 → 1.1.2-dev-20240501174240

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/package.json +5 -5
  2. package/dist/area-chart-gradient.d.mts +0 -11
  3. package/dist/area-chart-gradient.d.ts +0 -11
  4. package/dist/area-chart-gradient.js +0 -47
  5. package/dist/area-chart-gradient.js.map +0 -1
  6. package/dist/area-chart-gradient.mjs +0 -8
  7. package/dist/area-chart-gradient.mjs.map +0 -1
  8. package/dist/area-chart-split.d.mts +0 -10
  9. package/dist/area-chart-split.d.ts +0 -10
  10. package/dist/area-chart-split.js +0 -52
  11. package/dist/area-chart-split.js.map +0 -1
  12. package/dist/area-chart-split.mjs +0 -8
  13. package/dist/area-chart-split.mjs.map +0 -1
  14. package/dist/area-chart.d.mts +0 -41
  15. package/dist/area-chart.d.ts +0 -41
  16. package/dist/area-chart.js +0 -1223
  17. package/dist/area-chart.js.map +0 -1
  18. package/dist/area-chart.mjs +0 -21
  19. package/dist/area-chart.mjs.map +0 -1
  20. package/dist/bar-chart.d.mts +0 -38
  21. package/dist/bar-chart.d.ts +0 -38
  22. package/dist/bar-chart.js +0 -1027
  23. package/dist/bar-chart.js.map +0 -1
  24. package/dist/bar-chart.mjs +0 -19
  25. package/dist/bar-chart.mjs.map +0 -1
  26. package/dist/chart-legend.d.mts +0 -12
  27. package/dist/chart-legend.d.ts +0 -12
  28. package/dist/chart-legend.js +0 -90
  29. package/dist/chart-legend.js.map +0 -1
  30. package/dist/chart-legend.mjs +0 -11
  31. package/dist/chart-legend.mjs.map +0 -1
  32. package/dist/chart-tooltip.d.mts +0 -12
  33. package/dist/chart-tooltip.d.ts +0 -12
  34. package/dist/chart-tooltip.js +0 -121
  35. package/dist/chart-tooltip.js.map +0 -1
  36. package/dist/chart-tooltip.mjs +0 -11
  37. package/dist/chart-tooltip.mjs.map +0 -1
  38. package/dist/chart-utils.d.mts +0 -9
  39. package/dist/chart-utils.d.ts +0 -9
  40. package/dist/chart-utils.js +0 -45
  41. package/dist/chart-utils.js.map +0 -1
  42. package/dist/chart-utils.mjs +0 -10
  43. package/dist/chart-utils.mjs.map +0 -1
  44. package/dist/chart.types.d.mts +0 -78
  45. package/dist/chart.types.d.ts +0 -78
  46. package/dist/chart.types.js +0 -20
  47. package/dist/chart.types.js.map +0 -1
  48. package/dist/chart.types.mjs +0 -2
  49. package/dist/chart.types.mjs.map +0 -1
  50. package/dist/chunk-4WX5YS7M.mjs +0 -179
  51. package/dist/chunk-4WX5YS7M.mjs.map +0 -1
  52. package/dist/chunk-5TVYPA64.mjs +0 -256
  53. package/dist/chunk-5TVYPA64.mjs.map +0 -1
  54. package/dist/chunk-BPR7YL3O.mjs +0 -179
  55. package/dist/chunk-BPR7YL3O.mjs.map +0 -1
  56. package/dist/chunk-E2I2XAZ6.mjs +0 -232
  57. package/dist/chunk-E2I2XAZ6.mjs.map +0 -1
  58. package/dist/chunk-HDOYOHLA.mjs +0 -326
  59. package/dist/chunk-HDOYOHLA.mjs.map +0 -1
  60. package/dist/chunk-KNAADLWO.mjs +0 -225
  61. package/dist/chunk-KNAADLWO.mjs.map +0 -1
  62. package/dist/chunk-KT4YOMM4.mjs +0 -344
  63. package/dist/chunk-KT4YOMM4.mjs.map +0 -1
  64. package/dist/chunk-LBC2B6UX.mjs +0 -84
  65. package/dist/chunk-LBC2B6UX.mjs.map +0 -1
  66. package/dist/chunk-LGMALZCN.mjs +0 -42
  67. package/dist/chunk-LGMALZCN.mjs.map +0 -1
  68. package/dist/chunk-LHI57S6P.mjs +0 -215
  69. package/dist/chunk-LHI57S6P.mjs.map +0 -1
  70. package/dist/chunk-LM2DQK2P.mjs +0 -33
  71. package/dist/chunk-LM2DQK2P.mjs.map +0 -1
  72. package/dist/chunk-MSIOYYWR.mjs +0 -24
  73. package/dist/chunk-MSIOYYWR.mjs.map +0 -1
  74. package/dist/chunk-MWPICUEW.mjs +0 -56
  75. package/dist/chunk-MWPICUEW.mjs.map +0 -1
  76. package/dist/chunk-NEGDEVRX.mjs +0 -53
  77. package/dist/chunk-NEGDEVRX.mjs.map +0 -1
  78. package/dist/chunk-OSNFBRHL.mjs +0 -474
  79. package/dist/chunk-OSNFBRHL.mjs.map +0 -1
  80. package/dist/chunk-OW7SOTEF.mjs +0 -206
  81. package/dist/chunk-OW7SOTEF.mjs.map +0 -1
  82. package/dist/chunk-P7AFSM5W.mjs +0 -114
  83. package/dist/chunk-P7AFSM5W.mjs.map +0 -1
  84. package/dist/chunk-PNE3JG54.mjs +0 -29
  85. package/dist/chunk-PNE3JG54.mjs.map +0 -1
  86. package/dist/chunk-QL3DB7OJ.mjs +0 -21
  87. package/dist/chunk-QL3DB7OJ.mjs.map +0 -1
  88. package/dist/chunk-QZ5OXZ6Z.mjs +0 -251
  89. package/dist/chunk-QZ5OXZ6Z.mjs.map +0 -1
  90. package/dist/chunk-RN6PXJAD.mjs +0 -47
  91. package/dist/chunk-RN6PXJAD.mjs.map +0 -1
  92. package/dist/chunk-STBYRLC5.mjs +0 -208
  93. package/dist/chunk-STBYRLC5.mjs.map +0 -1
  94. package/dist/chunk-XIFDRM7J.mjs +0 -56
  95. package/dist/chunk-XIFDRM7J.mjs.map +0 -1
  96. package/dist/donut-chart.d.mts +0 -31
  97. package/dist/donut-chart.d.ts +0 -31
  98. package/dist/donut-chart.js +0 -702
  99. package/dist/donut-chart.js.map +0 -1
  100. package/dist/donut-chart.mjs +0 -16
  101. package/dist/donut-chart.mjs.map +0 -1
  102. package/dist/index.d.mts +0 -26
  103. package/dist/index.d.ts +0 -26
  104. package/dist/index.js +0 -3228
  105. package/dist/index.js.map +0 -1
  106. package/dist/index.mjs +0 -45
  107. package/dist/index.mjs.map +0 -1
  108. package/dist/line-chart.d.mts +0 -38
  109. package/dist/line-chart.d.ts +0 -38
  110. package/dist/line-chart.js +0 -1088
  111. package/dist/line-chart.js.map +0 -1
  112. package/dist/line-chart.mjs +0 -19
  113. package/dist/line-chart.mjs.map +0 -1
  114. package/dist/pie-chart.d.mts +0 -49
  115. package/dist/pie-chart.d.ts +0 -49
  116. package/dist/pie-chart.js +0 -702
  117. package/dist/pie-chart.js.map +0 -1
  118. package/dist/pie-chart.mjs +0 -16
  119. package/dist/pie-chart.mjs.map +0 -1
  120. package/dist/radar-chart.d.mts +0 -57
  121. package/dist/radar-chart.d.ts +0 -57
  122. package/dist/radar-chart.js +0 -918
  123. package/dist/radar-chart.js.map +0 -1
  124. package/dist/radar-chart.mjs +0 -16
  125. package/dist/radar-chart.mjs.map +0 -1
  126. package/dist/rechart-properties.d.mts +0 -26
  127. package/dist/rechart-properties.d.ts +0 -26
  128. package/dist/rechart-properties.js +0 -517
  129. package/dist/rechart-properties.js.map +0 -1
  130. package/dist/rechart-properties.mjs +0 -48
  131. package/dist/rechart-properties.mjs.map +0 -1
  132. package/dist/use-area-chart.d.mts +0 -123
  133. package/dist/use-area-chart.d.ts +0 -123
  134. package/dist/use-area-chart.js +0 -420
  135. package/dist/use-area-chart.js.map +0 -1
  136. package/dist/use-area-chart.mjs +0 -10
  137. package/dist/use-area-chart.mjs.map +0 -1
  138. package/dist/use-bar-chart.d.mts +0 -73
  139. package/dist/use-bar-chart.d.ts +0 -73
  140. package/dist/use-bar-chart.js +0 -290
  141. package/dist/use-bar-chart.js.map +0 -1
  142. package/dist/use-bar-chart.mjs +0 -10
  143. package/dist/use-bar-chart.mjs.map +0 -1
  144. package/dist/use-chart-axis.d.mts +0 -73
  145. package/dist/use-chart-axis.d.ts +0 -73
  146. package/dist/use-chart-axis.js +0 -227
  147. package/dist/use-chart-axis.js.map +0 -1
  148. package/dist/use-chart-axis.mjs +0 -10
  149. package/dist/use-chart-axis.mjs.map +0 -1
  150. package/dist/use-chart-grid.d.mts +0 -32
  151. package/dist/use-chart-grid.d.ts +0 -32
  152. package/dist/use-chart-grid.js +0 -92
  153. package/dist/use-chart-grid.js.map +0 -1
  154. package/dist/use-chart-grid.mjs +0 -10
  155. package/dist/use-chart-grid.mjs.map +0 -1
  156. package/dist/use-chart-legend.d.mts +0 -18
  157. package/dist/use-chart-legend.d.ts +0 -18
  158. package/dist/use-chart-legend.js +0 -81
  159. package/dist/use-chart-legend.js.map +0 -1
  160. package/dist/use-chart-legend.mjs +0 -9
  161. package/dist/use-chart-legend.mjs.map +0 -1
  162. package/dist/use-chart-reference-line.d.mts +0 -22
  163. package/dist/use-chart-reference-line.d.ts +0 -22
  164. package/dist/use-chart-reference-line.js +0 -105
  165. package/dist/use-chart-reference-line.js.map +0 -1
  166. package/dist/use-chart-reference-line.mjs +0 -10
  167. package/dist/use-chart-reference-line.mjs.map +0 -1
  168. package/dist/use-chart-tooltip.d.mts +0 -27
  169. package/dist/use-chart-tooltip.d.ts +0 -27
  170. package/dist/use-chart-tooltip.js +0 -100
  171. package/dist/use-chart-tooltip.js.map +0 -1
  172. package/dist/use-chart-tooltip.mjs +0 -10
  173. package/dist/use-chart-tooltip.mjs.map +0 -1
  174. package/dist/use-chart.d.mts +0 -33
  175. package/dist/use-chart.d.ts +0 -33
  176. package/dist/use-chart.js +0 -104
  177. package/dist/use-chart.js.map +0 -1
  178. package/dist/use-chart.mjs +0 -18
  179. package/dist/use-chart.mjs.map +0 -1
  180. package/dist/use-line-chart.d.mts +0 -97
  181. package/dist/use-line-chart.d.ts +0 -97
  182. package/dist/use-line-chart.js +0 -344
  183. package/dist/use-line-chart.js.map +0 -1
  184. package/dist/use-line-chart.mjs +0 -10
  185. package/dist/use-line-chart.mjs.map +0 -1
  186. package/dist/use-pie-chart.d.mts +0 -112
  187. package/dist/use-pie-chart.d.ts +0 -112
  188. package/dist/use-pie-chart.js +0 -282
  189. package/dist/use-pie-chart.js.map +0 -1
  190. package/dist/use-pie-chart.mjs +0 -10
  191. package/dist/use-pie-chart.mjs.map +0 -1
  192. package/dist/use-radar-chart.d.mts +0 -105
  193. package/dist/use-radar-chart.d.ts +0 -105
  194. package/dist/use-radar-chart.js +0 -473
  195. package/dist/use-radar-chart.js.map +0 -1
  196. package/dist/use-radar-chart.mjs +0 -10
  197. package/dist/use-radar-chart.mjs.map +0 -1
@@ -1,123 +0,0 @@
1
- import * as react from 'react';
2
- import * as _yamada_ui_core from '@yamada-ui/core';
3
- import { CSSUIObject } from '@yamada-ui/core';
4
- import * as _yamada_ui_utils from '@yamada-ui/utils';
5
- import { Dict } from '@yamada-ui/utils';
6
- import * as recharts_types_chart_generateCategoricalChart from 'recharts/types/chart/generateCategoricalChart';
7
- import * as Recharts from 'recharts';
8
- import { AreaGradientProps } from './area-chart-gradient.mjs';
9
- import { AreaSplitProps } from './area-chart-split.mjs';
10
- import { AreaProps, AreaChartType, AreaChartProps, ChartLayoutType, ChartCurveType, ReferenceLineProps, ChartPropGetter, RequiredChartPropGetter } from './chart.types.mjs';
11
- import 'react/jsx-runtime';
12
-
13
- type UseAreaChartOptions = {
14
- /**
15
- * Chart data.
16
- */
17
- data: Dict[];
18
- /**
19
- * An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.
20
- */
21
- series: AreaProps[];
22
- /**
23
- * Props for the areas.
24
- */
25
- areaProps?: Partial<AreaProps>;
26
- /**
27
- * Controls how chart areas are positioned relative to each other.
28
- *
29
- * @default `default`
30
- */
31
- type?: AreaChartType;
32
- /**
33
- * Props passed down to recharts `AreaChart` component.
34
- */
35
- chartProps?: AreaChartProps;
36
- /**
37
- * If any two categorical charts have the same syncId,
38
- * these two charts can sync the position tooltip, and the startIndex, endIndex of Brush.
39
- */
40
- syncId?: number | string;
41
- /**
42
- * Chart orientation.
43
- *
44
- * @default 'horizontal'
45
- */
46
- layoutType?: ChartLayoutType;
47
- /**
48
- * Determines whether the chart area should be represented with a gradient instead of the solid color.
49
- */
50
- withGradient?: boolean;
51
- /**
52
- * Determines whether dots should be displayed.
53
- *
54
- * @default true
55
- */
56
- withDots?: boolean;
57
- /**
58
- * Determines whether activeDots should be displayed.
59
- *
60
- * @default true
61
- */
62
- withActiveDots?: boolean;
63
- /**
64
- * Type of the curve.
65
- *
66
- * @default `monotone`
67
- */
68
- curveType?: ChartCurveType;
69
- /**
70
- * Stroke width for the chart areas.
71
- *
72
- * @default 2
73
- */
74
- strokeWidth?: number;
75
- /**
76
- * Determines whether points with `null` values should be connected.
77
- *
78
- * @default true
79
- */
80
- connectNulls?: boolean;
81
- /**
82
- * A tuple of colors used when `type="split"` is set, ignored in all other cases.
83
- *
84
- * @default '["red.400", "green.400"]'
85
- */
86
- splitColors?: [string, string];
87
- /**
88
- * Offset for the split gradient. By default, value is inferred from `data` and `series` if possible.
89
- * Must be generated from the data array with `getSplitOffset` function.
90
- */
91
- splitOffset?: number;
92
- /**
93
- * Reference lines that should be displayed on the chart.
94
- */
95
- referenceLineProps?: ReferenceLineProps[];
96
- /**
97
- * Controls fill opacity of all areas.
98
- *
99
- * @default 0.4
100
- */
101
- fillOpacity?: number | [number, number];
102
- };
103
- type UseAreaChartProps = UseAreaChartOptions & {
104
- styles: Dict<CSSUIObject>;
105
- };
106
- declare const useAreaChart: ({ data, series, type, layoutType, withGradient: withGradientProp, withDots, withActiveDots, curveType, strokeWidth, connectNulls, fillOpacity, splitColors, splitOffset, referenceLineProps, syncId, styles, ...rest }: UseAreaChartProps) => {
107
- getAreaChartProps: ChartPropGetter<"div", recharts_types_chart_generateCategoricalChart.CategoricalChartProps, recharts_types_chart_generateCategoricalChart.CategoricalChartProps>;
108
- getAreaSplitProps: ChartPropGetter<"div", Partial<AreaSplitProps>, AreaSplitProps>;
109
- getAreaProps: RequiredChartPropGetter<"div", {
110
- index: number;
111
- }, Omit<Recharts.AreaProps, "ref">>;
112
- getAreaGradientProps: ChartPropGetter<"div", Partial<AreaGradientProps>, AreaGradientProps>;
113
- areaVars: {
114
- __prefix?: string | undefined;
115
- name: string;
116
- token?: "colors" | "transitionDuration" | "transitionProperty" | "animations" | "blurs" | "borders" | "breakpoints" | "fonts" | "fontSizes" | "fontWeights" | "gradients" | "layerStyles" | "letterSpacings" | "lineHeights" | "radii" | "shadows" | "sizes" | "spaces" | "textStyles" | "transitionEasing" | "zIndices" | undefined;
117
- value?: (number | _yamada_ui_utils.StringLiteral | _yamada_ui_core.ResponsiveObject<number | _yamada_ui_utils.StringLiteral> | _yamada_ui_core.ColorModeArray<number | _yamada_ui_utils.StringLiteral>) | undefined;
118
- }[];
119
- setHighlightedArea: react.Dispatch<react.SetStateAction<string | null>>;
120
- };
121
- type UseAreaChartReturn = ReturnType<typeof useAreaChart>;
122
-
123
- export { type UseAreaChartOptions, type UseAreaChartProps, type UseAreaChartReturn, useAreaChart };
@@ -1,123 +0,0 @@
1
- import * as react from 'react';
2
- import * as _yamada_ui_core from '@yamada-ui/core';
3
- import { CSSUIObject } from '@yamada-ui/core';
4
- import * as _yamada_ui_utils from '@yamada-ui/utils';
5
- import { Dict } from '@yamada-ui/utils';
6
- import * as recharts_types_chart_generateCategoricalChart from 'recharts/types/chart/generateCategoricalChart';
7
- import * as Recharts from 'recharts';
8
- import { AreaGradientProps } from './area-chart-gradient.js';
9
- import { AreaSplitProps } from './area-chart-split.js';
10
- import { AreaProps, AreaChartType, AreaChartProps, ChartLayoutType, ChartCurveType, ReferenceLineProps, ChartPropGetter, RequiredChartPropGetter } from './chart.types.js';
11
- import 'react/jsx-runtime';
12
-
13
- type UseAreaChartOptions = {
14
- /**
15
- * Chart data.
16
- */
17
- data: Dict[];
18
- /**
19
- * An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.
20
- */
21
- series: AreaProps[];
22
- /**
23
- * Props for the areas.
24
- */
25
- areaProps?: Partial<AreaProps>;
26
- /**
27
- * Controls how chart areas are positioned relative to each other.
28
- *
29
- * @default `default`
30
- */
31
- type?: AreaChartType;
32
- /**
33
- * Props passed down to recharts `AreaChart` component.
34
- */
35
- chartProps?: AreaChartProps;
36
- /**
37
- * If any two categorical charts have the same syncId,
38
- * these two charts can sync the position tooltip, and the startIndex, endIndex of Brush.
39
- */
40
- syncId?: number | string;
41
- /**
42
- * Chart orientation.
43
- *
44
- * @default 'horizontal'
45
- */
46
- layoutType?: ChartLayoutType;
47
- /**
48
- * Determines whether the chart area should be represented with a gradient instead of the solid color.
49
- */
50
- withGradient?: boolean;
51
- /**
52
- * Determines whether dots should be displayed.
53
- *
54
- * @default true
55
- */
56
- withDots?: boolean;
57
- /**
58
- * Determines whether activeDots should be displayed.
59
- *
60
- * @default true
61
- */
62
- withActiveDots?: boolean;
63
- /**
64
- * Type of the curve.
65
- *
66
- * @default `monotone`
67
- */
68
- curveType?: ChartCurveType;
69
- /**
70
- * Stroke width for the chart areas.
71
- *
72
- * @default 2
73
- */
74
- strokeWidth?: number;
75
- /**
76
- * Determines whether points with `null` values should be connected.
77
- *
78
- * @default true
79
- */
80
- connectNulls?: boolean;
81
- /**
82
- * A tuple of colors used when `type="split"` is set, ignored in all other cases.
83
- *
84
- * @default '["red.400", "green.400"]'
85
- */
86
- splitColors?: [string, string];
87
- /**
88
- * Offset for the split gradient. By default, value is inferred from `data` and `series` if possible.
89
- * Must be generated from the data array with `getSplitOffset` function.
90
- */
91
- splitOffset?: number;
92
- /**
93
- * Reference lines that should be displayed on the chart.
94
- */
95
- referenceLineProps?: ReferenceLineProps[];
96
- /**
97
- * Controls fill opacity of all areas.
98
- *
99
- * @default 0.4
100
- */
101
- fillOpacity?: number | [number, number];
102
- };
103
- type UseAreaChartProps = UseAreaChartOptions & {
104
- styles: Dict<CSSUIObject>;
105
- };
106
- declare const useAreaChart: ({ data, series, type, layoutType, withGradient: withGradientProp, withDots, withActiveDots, curveType, strokeWidth, connectNulls, fillOpacity, splitColors, splitOffset, referenceLineProps, syncId, styles, ...rest }: UseAreaChartProps) => {
107
- getAreaChartProps: ChartPropGetter<"div", recharts_types_chart_generateCategoricalChart.CategoricalChartProps, recharts_types_chart_generateCategoricalChart.CategoricalChartProps>;
108
- getAreaSplitProps: ChartPropGetter<"div", Partial<AreaSplitProps>, AreaSplitProps>;
109
- getAreaProps: RequiredChartPropGetter<"div", {
110
- index: number;
111
- }, Omit<Recharts.AreaProps, "ref">>;
112
- getAreaGradientProps: ChartPropGetter<"div", Partial<AreaGradientProps>, AreaGradientProps>;
113
- areaVars: {
114
- __prefix?: string | undefined;
115
- name: string;
116
- token?: "colors" | "transitionDuration" | "transitionProperty" | "animations" | "blurs" | "borders" | "breakpoints" | "fonts" | "fontSizes" | "fontWeights" | "gradients" | "layerStyles" | "letterSpacings" | "lineHeights" | "radii" | "shadows" | "sizes" | "spaces" | "textStyles" | "transitionEasing" | "zIndices" | undefined;
117
- value?: (number | _yamada_ui_utils.StringLiteral | _yamada_ui_core.ResponsiveObject<number | _yamada_ui_utils.StringLiteral> | _yamada_ui_core.ColorModeArray<number | _yamada_ui_utils.StringLiteral>) | undefined;
118
- }[];
119
- setHighlightedArea: react.Dispatch<react.SetStateAction<string | null>>;
120
- };
121
- type UseAreaChartReturn = ReturnType<typeof useAreaChart>;
122
-
123
- export { type UseAreaChartOptions, type UseAreaChartProps, type UseAreaChartReturn, useAreaChart };
@@ -1,420 +0,0 @@
1
- "use client"
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/use-area-chart.ts
22
- var use_area_chart_exports = {};
23
- __export(use_area_chart_exports, {
24
- useAreaChart: () => useAreaChart
25
- });
26
- module.exports = __toCommonJS(use_area_chart_exports);
27
- var import_core2 = require("@yamada-ui/core");
28
- var import_utils2 = require("@yamada-ui/utils");
29
- var import_react = require("react");
30
-
31
- // src/chart-utils.ts
32
- var import_core = require("@yamada-ui/core");
33
- var import_utils = require("@yamada-ui/utils");
34
- var getClassName = (...styles) => (theme) => (0, import_utils.cx)(
35
- ...styles.map(
36
- (style) => (0, import_utils.isString)(style) ? style : (0, import_core.getCSS)(style)(theme)
37
- )
38
- );
39
- var getComponentProps = ([obj, keys], ...props) => (theme, isContain) => {
40
- const [pickedProps, omittedProps] = (0, import_utils.splitObject)(obj, keys);
41
- const className = getClassName(...props, omittedProps)(theme);
42
- return !isContain ? [pickedProps, className] : { ...pickedProps, className };
43
- };
44
-
45
- // src/rechart-properties.ts
46
- var areaChartProperties = [
47
- "layout",
48
- "syncId",
49
- "syncMethod",
50
- "width",
51
- "height",
52
- "data",
53
- "margin",
54
- "stackOffset",
55
- "onClick",
56
- "onMouseEnter",
57
- "onMouseMove",
58
- "onMouseLeave"
59
- ];
60
- var areaProperties = [
61
- "type",
62
- "dataKey",
63
- "xAxisId",
64
- "yAxisId",
65
- "legendType",
66
- "dot",
67
- "activeDot",
68
- "label",
69
- "stroke",
70
- "strokeWidth",
71
- "layout",
72
- "baseLine",
73
- "points",
74
- "stackId",
75
- "connectNulls",
76
- "unit",
77
- "name",
78
- "isAnimationActive",
79
- "animationBegin",
80
- "animationDuration",
81
- "animationEasing",
82
- "id",
83
- "onAnimationStart",
84
- "onAnimationEnd",
85
- "onClick",
86
- "onMouseDown",
87
- "onMouseUp",
88
- "onMouseMove",
89
- "onMouseOver",
90
- "onMouseOut",
91
- "onMouseEnter",
92
- "onMouseLeave"
93
- ];
94
- var dotProperties = [
95
- "cx",
96
- "cy",
97
- "r",
98
- "onClick",
99
- "onMouseDown",
100
- "onMouseUp",
101
- "onMouseMove",
102
- "onMouseOver",
103
- "onMouseOut",
104
- "onMouseEnter",
105
- "onMouseLeave"
106
- ];
107
-
108
- // src/use-area-chart.ts
109
- var useAreaChart = ({
110
- data,
111
- series,
112
- type,
113
- layoutType = "horizontal",
114
- withGradient: withGradientProp,
115
- withDots = true,
116
- withActiveDots = true,
117
- curveType = "monotone",
118
- strokeWidth = 2,
119
- connectNulls = true,
120
- fillOpacity = 0.4,
121
- splitColors = ["#ee6a5d", "#5fce7d"],
122
- splitOffset,
123
- referenceLineProps,
124
- syncId,
125
- styles,
126
- ...rest
127
- }) => {
128
- var _a;
129
- const uuid = (0, import_react.useId)();
130
- const { theme } = (0, import_core2.useTheme)();
131
- const [highlightedArea, setHighlightedArea] = (0, import_react.useState)(null);
132
- const splitId = `${uuid}-split`;
133
- const stacked = type === "stacked" || type === "percent";
134
- const withGradient = typeof withGradientProp === "boolean" ? withGradientProp : type === "default";
135
- const shouldHighlight = highlightedArea !== null;
136
- const {
137
- dot = {},
138
- activeDot = {},
139
- dimDot,
140
- dimArea,
141
- ...computedAreaProps
142
- } = (_a = rest.areaProps) != null ? _a : {};
143
- const areaColors = (0, import_react.useMemo)(
144
- () => series.map(({ color }, index) => ({
145
- __prefix: "ui",
146
- name: `area-${index}`,
147
- token: "colors",
148
- value: color != null ? color : "transparent"
149
- })),
150
- [series]
151
- );
152
- const areaSplitColors = (0, import_react.useMemo)(
153
- () => splitColors.map((color, index) => ({
154
- __prefix: "ui",
155
- name: `area-split-${index}`,
156
- token: "colors",
157
- value: color != null ? color : "transparent"
158
- })),
159
- [splitColors]
160
- );
161
- const referenceLineColors = (0, import_react.useMemo)(
162
- () => referenceLineProps ? referenceLineProps.map(({ color }, index) => ({
163
- __prefix: "ui",
164
- name: `reference-line-${index}`,
165
- token: "colors",
166
- value: color != null ? color : "transparent"
167
- })) : [],
168
- [referenceLineProps]
169
- );
170
- const areaVars = (0, import_react.useMemo)(() => {
171
- return [
172
- ...areaColors,
173
- ...areaSplitColors,
174
- ...referenceLineColors,
175
- { __prefix: "ui", name: "fill-opacity", value: fillOpacity }
176
- ];
177
- }, [areaColors, areaSplitColors, referenceLineColors, fillOpacity]);
178
- const [chartProps, areaChartClassName] = (0, import_react.useMemo)(
179
- () => {
180
- var _a2;
181
- return getComponentProps(
182
- [(_a2 = rest.chartProps) != null ? _a2 : {}, areaChartProperties],
183
- styles.chart
184
- )(theme);
185
- },
186
- [rest.chartProps, styles.chart, theme]
187
- );
188
- const [areaProps, areaClassName] = (0, import_react.useMemo)(() => {
189
- const resolvedAreaProps = {
190
- fillOpacity: 1,
191
- strokeOpacity: 1,
192
- ...computedAreaProps
193
- };
194
- return getComponentProps(
195
- [resolvedAreaProps, areaProperties],
196
- styles.area
197
- )(theme);
198
- }, [computedAreaProps, styles.area, theme]);
199
- const [dimAreaProps, dimAreaClassName] = (0, import_react.useMemo)(() => {
200
- const resolvedDimArea = {
201
- fillOpacity: 0,
202
- strokeOpacity: 0.3,
203
- ...dimArea
204
- };
205
- return getComponentProps([resolvedDimArea, areaProperties])(
206
- theme
207
- );
208
- }, [dimArea, theme]);
209
- const [dotProps, dotClassName] = (0, import_react.useMemo)(() => {
210
- const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
211
- return getComponentProps(
212
- [resolvedDot, dotProperties],
213
- styles.dot
214
- )(theme);
215
- }, [dot, styles.dot, theme]);
216
- const [activeDotProps, activeDotClassName] = (0, import_react.useMemo)(
217
- () => getComponentProps(
218
- [activeDot, dotProperties],
219
- styles.activeDot
220
- )(theme),
221
- [activeDot, styles.activeDot, theme]
222
- );
223
- const [dimDotProps, dimDotClassName] = (0, import_react.useMemo)(() => {
224
- const resolvedDimDot = { fillOpacity: 0, strokeOpacity: 0, ...dimDot };
225
- return getComponentProps([resolvedDimDot, dotProperties])(
226
- theme
227
- );
228
- }, [dimDot, theme]);
229
- const defaultSplitOffset = (0, import_react.useMemo)(() => {
230
- 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)
235
- return 0;
236
- if (dataMin >= 0)
237
- return 1;
238
- return dataMax / (dataMax - dataMin);
239
- }
240
- return 0.5;
241
- }, [data, series]);
242
- const areaPropsList = (0, import_react.useMemo)(
243
- () => series.map((props, index) => {
244
- const {
245
- dataKey,
246
- dot: dot2 = {},
247
- activeDot: activeDot2 = {},
248
- dimDot: dimDot2 = {},
249
- dimArea: dimArea2 = {},
250
- strokeDasharray,
251
- ...computedProps
252
- } = props;
253
- const id = `${uuid}-${dataKey}`;
254
- const color = `var(--ui-area-${index})`;
255
- const dimmed = shouldHighlight && highlightedArea !== dataKey;
256
- const computedDimArea = { ...dimAreaProps, ...dimArea2 };
257
- const resolvedProps = {
258
- ...areaProps,
259
- ...computedProps,
260
- ...dimmed ? computedDimArea : {}
261
- };
262
- const rest2 = getComponentProps(
263
- [resolvedProps, areaProperties],
264
- areaClassName,
265
- dimmed ? dimAreaClassName : void 0
266
- )(theme, true);
267
- let resolvedActiveDot;
268
- if (withActiveDots) {
269
- const computedActiveDot = { ...activeDotProps, ...activeDot2 };
270
- const [rest3, className] = getComponentProps(
271
- [computedActiveDot, dotProperties],
272
- activeDotClassName
273
- )(theme);
274
- resolvedActiveDot = {
275
- className: (0, import_utils2.cx)("ui-area-chart__active-dot", className),
276
- stroke: color,
277
- r: 4,
278
- ...rest3
279
- };
280
- } else {
281
- resolvedActiveDot = false;
282
- }
283
- let resolvedDot;
284
- if (withDots) {
285
- const computedDimDot = { ...dimDotProps, ...dimDot2 };
286
- const computedDot = {
287
- ...dotProps,
288
- ...dot2,
289
- ...dimmed ? computedDimDot : {}
290
- };
291
- const [rest3, className] = getComponentProps(
292
- [computedDot, dotProperties],
293
- dotClassName,
294
- dimmed ? dimDotClassName : void 0
295
- )(theme);
296
- resolvedDot = {
297
- className: (0, import_utils2.cx)("ui-area-chart__dot", className),
298
- fill: color,
299
- r: 4,
300
- ...rest3
301
- };
302
- } else {
303
- resolvedDot = false;
304
- }
305
- return {
306
- ...rest2,
307
- id,
308
- color,
309
- strokeDasharray,
310
- dataKey,
311
- activeDot: resolvedActiveDot,
312
- dot: resolvedDot
313
- };
314
- }),
315
- [
316
- series,
317
- uuid,
318
- shouldHighlight,
319
- highlightedArea,
320
- dimAreaProps,
321
- dimDotProps,
322
- areaProps,
323
- areaClassName,
324
- dimAreaClassName,
325
- theme,
326
- withActiveDots,
327
- withDots,
328
- activeDotProps,
329
- activeDotClassName,
330
- dotProps,
331
- dotClassName,
332
- dimDotClassName
333
- ]
334
- );
335
- const getAreaChartProps = (0, import_react.useCallback)(
336
- ({ className, ...props } = {}, ref = null) => ({
337
- ref,
338
- className: (0, import_utils2.cx)(className, areaChartClassName),
339
- data,
340
- stackOffset: type === "percent" ? "expand" : void 0,
341
- layout: layoutType,
342
- syncId,
343
- ...props,
344
- ...chartProps
345
- }),
346
- [areaChartClassName, data, type, layoutType, syncId, chartProps]
347
- );
348
- const getAreaSplitProps = (0, import_react.useCallback)(
349
- (props = {}) => ({
350
- id: splitId,
351
- offset: splitOffset != null ? splitOffset : defaultSplitOffset,
352
- fillOpacity: "var(--ui-fill-opacity)",
353
- ...props
354
- }),
355
- [defaultSplitOffset, splitId, splitOffset]
356
- );
357
- const getAreaProps = (0, import_react.useCallback)(
358
- ({ index, className: classNameProp, ...props }, ref = null) => {
359
- const {
360
- id,
361
- color,
362
- className,
363
- dataKey,
364
- strokeDasharray,
365
- activeDot: activeDot2,
366
- dot: dot2,
367
- ...rest2
368
- } = areaPropsList[index];
369
- return {
370
- ref,
371
- className: (0, import_utils2.cx)(classNameProp, className),
372
- id,
373
- activeDot: activeDot2,
374
- dot: dot2,
375
- name: dataKey,
376
- type: curveType,
377
- dataKey,
378
- fill: type === "split" ? `url(#${splitId})` : `url(#${id})`,
379
- strokeWidth,
380
- stroke: color,
381
- isAnimationActive: false,
382
- connectNulls,
383
- stackId: stacked ? "stack" : void 0,
384
- strokeDasharray,
385
- ...props,
386
- ...rest2
387
- };
388
- },
389
- [
390
- areaPropsList,
391
- connectNulls,
392
- curveType,
393
- splitId,
394
- stacked,
395
- strokeWidth,
396
- type
397
- ]
398
- );
399
- const getAreaGradientProps = (0, import_react.useCallback)(
400
- (props = {}) => ({
401
- withGradient,
402
- fillOpacity: "var(--ui-fill-opacity)",
403
- ...props
404
- }),
405
- [withGradient]
406
- );
407
- return {
408
- getAreaChartProps,
409
- getAreaSplitProps,
410
- getAreaProps,
411
- getAreaGradientProps,
412
- areaVars,
413
- setHighlightedArea
414
- };
415
- };
416
- // Annotate the CommonJS export names for ESM import in node:
417
- 0 && (module.exports = {
418
- useAreaChart
419
- });
420
- //# sourceMappingURL=use-area-chart.js.map