@mantine/charts 9.0.0-alpha.5 → 9.0.0-alpha.7

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 (233) hide show
  1. package/cjs/AreaChart/AreaChart.cjs +305 -376
  2. package/cjs/AreaChart/AreaChart.cjs.map +1 -1
  3. package/cjs/AreaChart/AreaGradient.cjs +33 -11
  4. package/cjs/AreaChart/AreaGradient.cjs.map +1 -1
  5. package/cjs/AreaChart/AreaSplit.cjs +25 -27
  6. package/cjs/AreaChart/AreaSplit.cjs.map +1 -1
  7. package/cjs/AreaChart/get-split-offset.cjs +18 -19
  8. package/cjs/AreaChart/get-split-offset.cjs.map +1 -1
  9. package/cjs/BarChart/BarChart.cjs +283 -364
  10. package/cjs/BarChart/BarChart.cjs.map +1 -1
  11. package/cjs/BarsList/BarsList.cjs +86 -115
  12. package/cjs/BarsList/BarsList.cjs.map +1 -1
  13. package/cjs/BarsList/BarsList.module.cjs +13 -0
  14. package/cjs/BarsList/BarsList.module.cjs.map +1 -0
  15. package/cjs/BubbleChart/BubbleChart.cjs +124 -143
  16. package/cjs/BubbleChart/BubbleChart.cjs.map +1 -1
  17. package/cjs/ChartLegend/ChartLegend.cjs +66 -83
  18. package/cjs/ChartLegend/ChartLegend.cjs.map +1 -1
  19. package/cjs/ChartLegend/ChartLegend.module.cjs +12 -0
  20. package/cjs/ChartLegend/ChartLegend.module.cjs.map +1 -0
  21. package/cjs/ChartTooltip/ChartTooltip.cjs +101 -116
  22. package/cjs/ChartTooltip/ChartTooltip.cjs.map +1 -1
  23. package/cjs/ChartTooltip/ChartTooltip.module.cjs +16 -0
  24. package/cjs/ChartTooltip/ChartTooltip.module.cjs.map +1 -0
  25. package/cjs/CompositeChart/CompositeChart.cjs +301 -389
  26. package/cjs/CompositeChart/CompositeChart.cjs.map +1 -1
  27. package/cjs/DonutChart/DonutChart.cjs +122 -168
  28. package/cjs/DonutChart/DonutChart.cjs.map +1 -1
  29. package/cjs/DonutChart/DonutChart.module.cjs +10 -0
  30. package/cjs/DonutChart/DonutChart.module.cjs.map +1 -0
  31. package/cjs/FunnelChart/FunnelChart.cjs +91 -129
  32. package/cjs/FunnelChart/FunnelChart.cjs.map +1 -1
  33. package/cjs/FunnelChart/FunnelChart.module.cjs +7 -0
  34. package/cjs/FunnelChart/FunnelChart.module.cjs.map +1 -0
  35. package/cjs/Heatmap/Heatmap.cjs +156 -188
  36. package/cjs/Heatmap/Heatmap.cjs.map +1 -1
  37. package/cjs/Heatmap/Heatmap.module.cjs +12 -0
  38. package/cjs/Heatmap/Heatmap.module.cjs.map +1 -0
  39. package/cjs/Heatmap/HeatmapSplitWeeks.cjs +48 -72
  40. package/cjs/Heatmap/HeatmapSplitWeeks.cjs.map +1 -1
  41. package/cjs/Heatmap/HeatmapWeeks.cjs +45 -57
  42. package/cjs/Heatmap/HeatmapWeeks.cjs.map +1 -1
  43. package/cjs/Heatmap/get-boundaries/get-boundaries.cjs +8 -10
  44. package/cjs/Heatmap/get-boundaries/get-boundaries.cjs.map +1 -1
  45. package/cjs/Heatmap/get-columns/get-columns.cjs +74 -64
  46. package/cjs/Heatmap/get-columns/get-columns.cjs.map +1 -1
  47. package/cjs/Heatmap/get-dates-range/get-dates-range.cjs +43 -54
  48. package/cjs/Heatmap/get-dates-range/get-dates-range.cjs.map +1 -1
  49. package/cjs/Heatmap/get-heat-color/get-heat-color.cjs +7 -8
  50. package/cjs/Heatmap/get-heat-color/get-heat-color.cjs.map +1 -1
  51. package/cjs/Heatmap/get-months-range/get-months-range.cjs +23 -19
  52. package/cjs/Heatmap/get-months-range/get-months-range.cjs.map +1 -1
  53. package/cjs/Heatmap/rotate-weekdays-names/rotate-weekdays-names.cjs +8 -10
  54. package/cjs/Heatmap/rotate-weekdays-names/rotate-weekdays-names.cjs.map +1 -1
  55. package/cjs/LineChart/LineChart.cjs +275 -341
  56. package/cjs/LineChart/LineChart.cjs.map +1 -1
  57. package/cjs/PieChart/PieChart.cjs +125 -171
  58. package/cjs/PieChart/PieChart.cjs.map +1 -1
  59. package/cjs/PieChart/PieChart.module.cjs +7 -0
  60. package/cjs/PieChart/PieChart.module.cjs.map +1 -0
  61. package/cjs/PointLabel/PointLabel.cjs +20 -20
  62. package/cjs/PointLabel/PointLabel.cjs.map +1 -1
  63. package/cjs/RadarChart/RadarChart.cjs +128 -157
  64. package/cjs/RadarChart/RadarChart.cjs.map +1 -1
  65. package/cjs/RadarChart/RadarChart.module.cjs +10 -0
  66. package/cjs/RadarChart/RadarChart.module.cjs.map +1 -0
  67. package/cjs/RadialBarChart/RadialBarChart.cjs +117 -147
  68. package/cjs/RadialBarChart/RadialBarChart.cjs.map +1 -1
  69. package/cjs/RadialBarChart/RadialBarChart.module.cjs +10 -0
  70. package/cjs/RadialBarChart/RadialBarChart.module.cjs.map +1 -0
  71. package/cjs/ScatterChart/ScatterChart.cjs +219 -278
  72. package/cjs/ScatterChart/ScatterChart.cjs.map +1 -1
  73. package/cjs/Sparkline/Sparkline.cjs +71 -99
  74. package/cjs/Sparkline/Sparkline.cjs.map +1 -1
  75. package/cjs/Sparkline/Sparkline.module.cjs +7 -0
  76. package/cjs/Sparkline/Sparkline.module.cjs.map +1 -0
  77. package/cjs/_virtual/_rolldown/runtime.cjs +24 -0
  78. package/cjs/grid-chart.module.cjs +14 -0
  79. package/cjs/grid-chart.module.cjs.map +1 -0
  80. package/cjs/index.cjs +39 -44
  81. package/cjs/utils/get-series-labels/get-series-labels.cjs +16 -18
  82. package/cjs/utils/get-series-labels/get-series-labels.cjs.map +1 -1
  83. package/esm/AreaChart/AreaChart.mjs +306 -376
  84. package/esm/AreaChart/AreaChart.mjs.map +1 -1
  85. package/esm/AreaChart/AreaGradient.mjs +32 -9
  86. package/esm/AreaChart/AreaGradient.mjs.map +1 -1
  87. package/esm/AreaChart/AreaSplit.mjs +24 -25
  88. package/esm/AreaChart/AreaSplit.mjs.map +1 -1
  89. package/esm/AreaChart/get-split-offset.mjs +18 -17
  90. package/esm/AreaChart/get-split-offset.mjs.map +1 -1
  91. package/esm/BarChart/BarChart.mjs +283 -364
  92. package/esm/BarChart/BarChart.mjs.map +1 -1
  93. package/esm/BarsList/BarsList.mjs +84 -112
  94. package/esm/BarsList/BarsList.mjs.map +1 -1
  95. package/esm/BarsList/BarsList.module.mjs +13 -0
  96. package/esm/BarsList/BarsList.module.mjs.map +1 -0
  97. package/esm/BubbleChart/BubbleChart.mjs +122 -140
  98. package/esm/BubbleChart/BubbleChart.mjs.map +1 -1
  99. package/esm/ChartLegend/ChartLegend.mjs +64 -80
  100. package/esm/ChartLegend/ChartLegend.mjs.map +1 -1
  101. package/esm/ChartLegend/ChartLegend.module.mjs +12 -0
  102. package/esm/ChartLegend/ChartLegend.module.mjs.map +1 -0
  103. package/esm/ChartTooltip/ChartTooltip.mjs +99 -113
  104. package/esm/ChartTooltip/ChartTooltip.mjs.map +1 -1
  105. package/esm/ChartTooltip/ChartTooltip.module.mjs +16 -0
  106. package/esm/ChartTooltip/ChartTooltip.module.mjs.map +1 -0
  107. package/esm/CompositeChart/CompositeChart.mjs +299 -386
  108. package/esm/CompositeChart/CompositeChart.mjs.map +1 -1
  109. package/esm/DonutChart/DonutChart.mjs +120 -165
  110. package/esm/DonutChart/DonutChart.mjs.map +1 -1
  111. package/esm/DonutChart/DonutChart.module.mjs +10 -0
  112. package/esm/DonutChart/DonutChart.module.mjs.map +1 -0
  113. package/esm/FunnelChart/FunnelChart.mjs +92 -129
  114. package/esm/FunnelChart/FunnelChart.mjs.map +1 -1
  115. package/esm/FunnelChart/FunnelChart.module.mjs +7 -0
  116. package/esm/FunnelChart/FunnelChart.module.mjs.map +1 -0
  117. package/esm/Heatmap/Heatmap.mjs +154 -185
  118. package/esm/Heatmap/Heatmap.mjs.map +1 -1
  119. package/esm/Heatmap/Heatmap.module.mjs +12 -0
  120. package/esm/Heatmap/Heatmap.module.mjs.map +1 -0
  121. package/esm/Heatmap/HeatmapSplitWeeks.mjs +47 -70
  122. package/esm/Heatmap/HeatmapSplitWeeks.mjs.map +1 -1
  123. package/esm/Heatmap/HeatmapWeeks.mjs +44 -55
  124. package/esm/Heatmap/HeatmapWeeks.mjs.map +1 -1
  125. package/esm/Heatmap/get-boundaries/get-boundaries.mjs +8 -8
  126. package/esm/Heatmap/get-boundaries/get-boundaries.mjs.map +1 -1
  127. package/esm/Heatmap/get-columns/get-columns.mjs +74 -62
  128. package/esm/Heatmap/get-columns/get-columns.mjs.map +1 -1
  129. package/esm/Heatmap/get-dates-range/get-dates-range.mjs +43 -52
  130. package/esm/Heatmap/get-dates-range/get-dates-range.mjs.map +1 -1
  131. package/esm/Heatmap/get-heat-color/get-heat-color.mjs +7 -6
  132. package/esm/Heatmap/get-heat-color/get-heat-color.mjs.map +1 -1
  133. package/esm/Heatmap/get-months-range/get-months-range.mjs +23 -17
  134. package/esm/Heatmap/get-months-range/get-months-range.mjs.map +1 -1
  135. package/esm/Heatmap/rotate-weekdays-names/rotate-weekdays-names.mjs +8 -8
  136. package/esm/Heatmap/rotate-weekdays-names/rotate-weekdays-names.mjs.map +1 -1
  137. package/esm/LineChart/LineChart.mjs +276 -341
  138. package/esm/LineChart/LineChart.mjs.map +1 -1
  139. package/esm/PieChart/PieChart.mjs +126 -171
  140. package/esm/PieChart/PieChart.mjs.map +1 -1
  141. package/esm/PieChart/PieChart.module.mjs +7 -0
  142. package/esm/PieChart/PieChart.module.mjs.map +1 -0
  143. package/esm/PointLabel/PointLabel.mjs +19 -18
  144. package/esm/PointLabel/PointLabel.mjs.map +1 -1
  145. package/esm/RadarChart/RadarChart.mjs +129 -157
  146. package/esm/RadarChart/RadarChart.mjs.map +1 -1
  147. package/esm/RadarChart/RadarChart.module.mjs +10 -0
  148. package/esm/RadarChart/RadarChart.module.mjs.map +1 -0
  149. package/esm/RadialBarChart/RadialBarChart.mjs +118 -147
  150. package/esm/RadialBarChart/RadialBarChart.mjs.map +1 -1
  151. package/esm/RadialBarChart/RadialBarChart.module.mjs +10 -0
  152. package/esm/RadialBarChart/RadialBarChart.module.mjs.map +1 -0
  153. package/esm/ScatterChart/ScatterChart.mjs +220 -278
  154. package/esm/ScatterChart/ScatterChart.mjs.map +1 -1
  155. package/esm/Sparkline/Sparkline.mjs +69 -96
  156. package/esm/Sparkline/Sparkline.mjs.map +1 -1
  157. package/esm/Sparkline/Sparkline.module.mjs +7 -0
  158. package/esm/Sparkline/Sparkline.module.mjs.map +1 -0
  159. package/esm/grid-chart.module.mjs +14 -0
  160. package/esm/grid-chart.module.mjs.map +1 -0
  161. package/esm/index.mjs +19 -19
  162. package/esm/utils/get-series-labels/get-series-labels.mjs +16 -16
  163. package/esm/utils/get-series-labels/get-series-labels.mjs.map +1 -1
  164. package/lib/BarChart/BarChart.d.ts +1 -0
  165. package/lib/DonutChart/DonutChart.d.ts +3 -3
  166. package/lib/PieChart/PieChart.d.ts +3 -3
  167. package/package.json +3 -3
  168. package/cjs/BarsList/BarsList.module.css.cjs +0 -7
  169. package/cjs/BarsList/BarsList.module.css.cjs.map +0 -1
  170. package/cjs/ChartLegend/ChartLegend.module.css.cjs +0 -7
  171. package/cjs/ChartLegend/ChartLegend.module.css.cjs.map +0 -1
  172. package/cjs/ChartTooltip/ChartTooltip.module.css.cjs +0 -7
  173. package/cjs/ChartTooltip/ChartTooltip.module.css.cjs.map +0 -1
  174. package/cjs/DonutChart/DonutChart.module.css.cjs +0 -7
  175. package/cjs/DonutChart/DonutChart.module.css.cjs.map +0 -1
  176. package/cjs/FunnelChart/FunnelChart.module.css.cjs +0 -7
  177. package/cjs/FunnelChart/FunnelChart.module.css.cjs.map +0 -1
  178. package/cjs/Heatmap/Heatmap.module.css.cjs +0 -7
  179. package/cjs/Heatmap/Heatmap.module.css.cjs.map +0 -1
  180. package/cjs/PieChart/PieChart.module.css.cjs +0 -7
  181. package/cjs/PieChart/PieChart.module.css.cjs.map +0 -1
  182. package/cjs/RadarChart/RadarChart.module.css.cjs +0 -7
  183. package/cjs/RadarChart/RadarChart.module.css.cjs.map +0 -1
  184. package/cjs/RadialBarChart/RadialBarChart.module.css.cjs +0 -7
  185. package/cjs/RadialBarChart/RadialBarChart.module.css.cjs.map +0 -1
  186. package/cjs/SankeyChart/SankeyChart.cjs +0 -276
  187. package/cjs/SankeyChart/SankeyChart.cjs.map +0 -1
  188. package/cjs/SankeyChart/SankeyChart.module.css.cjs +0 -7
  189. package/cjs/SankeyChart/SankeyChart.module.css.cjs.map +0 -1
  190. package/cjs/Sparkline/Sparkline.module.css.cjs +0 -7
  191. package/cjs/Sparkline/Sparkline.module.css.cjs.map +0 -1
  192. package/cjs/Treemap/Treemap.cjs +0 -198
  193. package/cjs/Treemap/Treemap.cjs.map +0 -1
  194. package/cjs/Treemap/Treemap.module.css.cjs +0 -7
  195. package/cjs/Treemap/Treemap.module.css.cjs.map +0 -1
  196. package/cjs/grid-chart.module.css.cjs +0 -7
  197. package/cjs/grid-chart.module.css.cjs.map +0 -1
  198. package/cjs/index.cjs.map +0 -1
  199. package/esm/BarsList/BarsList.module.css.mjs +0 -5
  200. package/esm/BarsList/BarsList.module.css.mjs.map +0 -1
  201. package/esm/ChartLegend/ChartLegend.module.css.mjs +0 -5
  202. package/esm/ChartLegend/ChartLegend.module.css.mjs.map +0 -1
  203. package/esm/ChartTooltip/ChartTooltip.module.css.mjs +0 -5
  204. package/esm/ChartTooltip/ChartTooltip.module.css.mjs.map +0 -1
  205. package/esm/DonutChart/DonutChart.module.css.mjs +0 -5
  206. package/esm/DonutChart/DonutChart.module.css.mjs.map +0 -1
  207. package/esm/FunnelChart/FunnelChart.module.css.mjs +0 -5
  208. package/esm/FunnelChart/FunnelChart.module.css.mjs.map +0 -1
  209. package/esm/Heatmap/Heatmap.module.css.mjs +0 -5
  210. package/esm/Heatmap/Heatmap.module.css.mjs.map +0 -1
  211. package/esm/PieChart/PieChart.module.css.mjs +0 -5
  212. package/esm/PieChart/PieChart.module.css.mjs.map +0 -1
  213. package/esm/RadarChart/RadarChart.module.css.mjs +0 -5
  214. package/esm/RadarChart/RadarChart.module.css.mjs.map +0 -1
  215. package/esm/RadialBarChart/RadialBarChart.module.css.mjs +0 -5
  216. package/esm/RadialBarChart/RadialBarChart.module.css.mjs.map +0 -1
  217. package/esm/SankeyChart/SankeyChart.mjs +0 -274
  218. package/esm/SankeyChart/SankeyChart.mjs.map +0 -1
  219. package/esm/SankeyChart/SankeyChart.module.css.mjs +0 -5
  220. package/esm/SankeyChart/SankeyChart.module.css.mjs.map +0 -1
  221. package/esm/Sparkline/Sparkline.module.css.mjs +0 -5
  222. package/esm/Sparkline/Sparkline.module.css.mjs.map +0 -1
  223. package/esm/Treemap/Treemap.mjs +0 -196
  224. package/esm/Treemap/Treemap.mjs.map +0 -1
  225. package/esm/Treemap/Treemap.module.css.mjs +0 -5
  226. package/esm/Treemap/Treemap.module.css.mjs.map +0 -1
  227. package/esm/grid-chart.module.css.mjs +0 -5
  228. package/esm/grid-chart.module.css.mjs.map +0 -1
  229. package/esm/index.mjs.map +0 -1
  230. package/lib/SankeyChart/SankeyChart.d.ts +0 -71
  231. package/lib/SankeyChart/index.d.ts +0 -12
  232. package/lib/Treemap/Treemap.d.ts +0 -57
  233. package/lib/Treemap/index.d.ts +0 -10
@@ -1,384 +1,313 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var react = require('react');
6
- var recharts = require('recharts');
7
- var core = require('@mantine/core');
8
- var ChartLegend = require('../ChartLegend/ChartLegend.cjs');
9
- var ChartTooltip = require('../ChartTooltip/ChartTooltip.cjs');
10
- var PointLabel = require('../PointLabel/PointLabel.cjs');
11
- var AreaGradient = require('./AreaGradient.cjs');
12
- var AreaSplit = require('./AreaSplit.cjs');
13
- var getSplitOffset = require('./get-split-offset.cjs');
14
- var gridChart_module = require('../grid-chart.module.css.cjs');
15
-
1
+ "use client";
2
+ require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_ChartTooltip = require("../ChartTooltip/ChartTooltip.cjs");
4
+ const require_ChartLegend = require("../ChartLegend/ChartLegend.cjs");
5
+ const require_PointLabel = require("../PointLabel/PointLabel.cjs");
6
+ const require_AreaGradient = require("./AreaGradient.cjs");
7
+ const require_AreaSplit = require("./AreaSplit.cjs");
8
+ const require_get_split_offset = require("./get-split-offset.cjs");
9
+ const require_grid_chart_module = require("../grid-chart.module.cjs");
10
+ let _mantine_core = require("@mantine/core");
11
+ let react_jsx_runtime = require("react/jsx-runtime");
12
+ let react = require("react");
13
+ let recharts = require("recharts");
14
+ //#region packages/@mantine/charts/src/AreaChart/AreaChart.tsx
16
15
  function valueToPercent(value) {
17
- return `${(value * 100).toFixed(0)}%`;
16
+ return `${(value * 100).toFixed(0)}%`;
18
17
  }
19
18
  const defaultProps = {
20
- withXAxis: true,
21
- withYAxis: true,
22
- withDots: true,
23
- withTooltip: true,
24
- connectNulls: true,
25
- strokeWidth: 2,
26
- tooltipAnimationDuration: 0,
27
- fillOpacity: 0.2,
28
- tickLine: "y",
29
- strokeDasharray: "5 5",
30
- curveType: "monotone",
31
- gridAxis: "x",
32
- type: "default",
33
- splitColors: ["green.7", "red.7"],
34
- orientation: "horizontal"
19
+ withXAxis: true,
20
+ withYAxis: true,
21
+ withDots: true,
22
+ withTooltip: true,
23
+ connectNulls: true,
24
+ strokeWidth: 2,
25
+ tooltipAnimationDuration: 0,
26
+ fillOpacity: .2,
27
+ tickLine: "y",
28
+ strokeDasharray: "5 5",
29
+ curveType: "monotone",
30
+ gridAxis: "x",
31
+ type: "default",
32
+ splitColors: ["green.7", "red.7"],
33
+ orientation: "horizontal"
35
34
  };
36
- const varsResolver = core.createVarsResolver((theme, { textColor, gridColor }) => ({
37
- root: {
38
- "--chart-text-color": textColor ? core.getThemeColor(textColor, theme) : void 0,
39
- "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0
40
- }
41
- }));
42
- const AreaChart = core.factory((_props) => {
43
- const props = core.useProps("AreaChart", defaultProps, _props);
44
- const {
45
- classNames,
46
- className,
47
- style,
48
- styles,
49
- unstyled,
50
- vars,
51
- data,
52
- series,
53
- withGradient,
54
- dataKey,
55
- withXAxis,
56
- withYAxis,
57
- curveType,
58
- gridProps,
59
- withDots,
60
- tickLine,
61
- strokeDasharray,
62
- gridAxis,
63
- unit,
64
- yAxisProps,
65
- xAxisProps,
66
- dotProps,
67
- activeDotProps,
68
- strokeWidth,
69
- tooltipAnimationDuration,
70
- type,
71
- legendProps,
72
- tooltipProps,
73
- withLegend,
74
- withTooltip,
75
- areaChartProps,
76
- fillOpacity,
77
- splitColors,
78
- splitOffset,
79
- connectNulls,
80
- onMouseLeave,
81
- orientation,
82
- referenceLines,
83
- dir,
84
- valueFormatter,
85
- children,
86
- areaProps,
87
- xAxisLabel,
88
- yAxisLabel,
89
- withRightYAxis,
90
- rightYAxisLabel,
91
- rightYAxisProps,
92
- withPointLabels,
93
- gridColor,
94
- textColor,
95
- attributes,
96
- ...others
97
- } = props;
98
- const theme = core.useMantineTheme();
99
- const baseId = react.useId();
100
- const splitId = `${baseId}-split`;
101
- const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
102
- const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
103
- const isAnimationActive = (tooltipAnimationDuration || 0) > 0;
104
- const _withGradient = typeof withGradient === "boolean" ? withGradient : type === "default";
105
- const stacked = type === "stacked" || type === "percent";
106
- const [highlightedArea, setHighlightedArea] = react.useState(null);
107
- const shouldHighlight = highlightedArea !== null;
108
- const handleMouseLeave = (event) => {
109
- setHighlightedArea(null);
110
- onMouseLeave?.(event);
111
- };
112
- const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
113
- classNames,
114
- styles,
115
- props
116
- });
117
- const getStyles = core.useStyles({
118
- name: "AreaChart",
119
- classes: gridChart_module,
120
- props,
121
- className,
122
- style,
123
- classNames,
124
- styles,
125
- unstyled,
126
- attributes,
127
- vars,
128
- varsResolver
129
- });
130
- const dotsAreas = series.map((item) => {
131
- const color = core.getThemeColor(item.color, theme);
132
- const dimmed = shouldHighlight && highlightedArea !== item.name;
133
- return /* @__PURE__ */ react.createElement(
134
- recharts.Area,
135
- {
136
- ...getStyles("area"),
137
- activeDot: { fill: theme.white, stroke: color, strokeWidth: 2, r: 4, ...activeDotProps },
138
- dot: { fill: color, fillOpacity: dimmed ? 0 : 1, strokeWidth: 2, r: 4, ...dotProps },
139
- key: item.name,
140
- name: item.name,
141
- type: curveType,
142
- dataKey: item.name,
143
- fill: "none",
144
- strokeWidth,
145
- stroke: "none",
146
- isAnimationActive: false,
147
- connectNulls,
148
- stackId: stacked ? "stack-dots" : void 0,
149
- yAxisId: item.yAxisId || void 0,
150
- ...typeof areaProps === "function" ? areaProps(item) : areaProps
151
- }
152
- );
153
- });
154
- const areas = series.map((item) => {
155
- const id = `${baseId}-${item.color.replace(/[^a-zA-Z0-9]/g, "")}`;
156
- const color = core.getThemeColor(item.color, theme);
157
- const dimmed = shouldHighlight && highlightedArea !== item.name;
158
- return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
159
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
160
- AreaGradient.AreaGradient,
161
- {
162
- color,
163
- withGradient: _withGradient,
164
- id,
165
- fillOpacity
166
- }
167
- ) }),
168
- /* @__PURE__ */ jsxRuntime.jsx(
169
- recharts.Area,
170
- {
171
- ...getStyles("area"),
172
- activeDot: false,
173
- dot: false,
174
- name: item.name,
175
- type: item.curveType ?? curveType,
176
- dataKey: item.name,
177
- fill: type === "split" ? `url(#${splitId})` : `url(#${id})`,
178
- strokeWidth,
179
- stroke: color,
180
- isAnimationActive: false,
181
- connectNulls,
182
- stackId: stacked ? "stack" : void 0,
183
- fillOpacity: dimmed ? 0 : 1,
184
- strokeOpacity: dimmed ? 0.5 : 1,
185
- strokeDasharray: item.strokeDasharray,
186
- yAxisId: item.yAxisId || void 0,
187
- label: withPointLabels ? /* @__PURE__ */ jsxRuntime.jsx(PointLabel.PointLabel, { valueFormatter }) : void 0,
188
- ...typeof areaProps === "function" ? areaProps(item) : areaProps
189
- }
190
- )
191
- ] }, item.name);
192
- });
193
- const referenceLinesItems = referenceLines?.map((line, index) => {
194
- const color = core.getThemeColor(line.color, theme);
195
- return /* @__PURE__ */ jsxRuntime.jsx(
196
- recharts.ReferenceLine,
197
- {
198
- stroke: line.color ? color : "var(--chart-grid-color)",
199
- strokeWidth: 1,
200
- yAxisId: line.yAxisId || void 0,
201
- ...line,
202
- label: {
203
- value: line.label,
204
- fill: line.color ? color : "currentColor",
205
- fontSize: 12,
206
- position: line.labelPosition ?? "insideBottomLeft"
207
- },
208
- ...getStyles("referenceLine")
209
- },
210
- index
211
- );
212
- });
213
- const tickFormatter = type === "percent" ? valueToPercent : valueFormatter;
214
- const sharedYAxisProps = {
215
- axisLine: false,
216
- ...orientation === "vertical" ? { dataKey, type: "category" } : { type: "number" },
217
- tickLine: withYTickLine ? { stroke: "currentColor" } : false,
218
- allowDecimals: true,
219
- unit,
220
- tickFormatter: orientation === "vertical" ? void 0 : tickFormatter,
221
- ...getStyles("axis")
222
- };
223
- return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { ...getStyles("root"), onMouseLeave: handleMouseLeave, dir: dir || "ltr", ...others, children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { ...getStyles("container"), children: /* @__PURE__ */ jsxRuntime.jsxs(
224
- recharts.AreaChart,
225
- {
226
- data,
227
- stackOffset: type === "percent" ? "expand" : void 0,
228
- layout: orientation,
229
- margin: {
230
- bottom: xAxisLabel ? 30 : void 0,
231
- left: yAxisLabel ? 10 : void 0,
232
- right: yAxisLabel ? 5 : void 0
233
- },
234
- ...areaChartProps,
235
- children: [
236
- referenceLinesItems,
237
- withLegend && /* @__PURE__ */ jsxRuntime.jsx(
238
- recharts.Legend,
239
- {
240
- verticalAlign: "top",
241
- content: (payload) => /* @__PURE__ */ jsxRuntime.jsx(
242
- ChartLegend.ChartLegend,
243
- {
244
- payload: payload.payload,
245
- onHighlight: setHighlightedArea,
246
- legendPosition: legendProps?.verticalAlign || "top",
247
- classNames: resolvedClassNames,
248
- styles: resolvedStyles,
249
- series,
250
- attributes
251
- }
252
- ),
253
- ...legendProps
254
- }
255
- ),
256
- /* @__PURE__ */ jsxRuntime.jsx(
257
- recharts.CartesianGrid,
258
- {
259
- strokeDasharray,
260
- vertical: gridAxis === "y" || gridAxis === "xy",
261
- horizontal: gridAxis === "x" || gridAxis === "xy",
262
- ...getStyles("grid"),
263
- ...gridProps
264
- }
265
- ),
266
- /* @__PURE__ */ jsxRuntime.jsxs(
267
- recharts.XAxis,
268
- {
269
- hide: !withXAxis,
270
- ...orientation === "vertical" ? { type: "number" } : { dataKey },
271
- tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
272
- stroke: "",
273
- interval: "preserveStartEnd",
274
- tickLine: withXTickLine ? { stroke: "currentColor" } : false,
275
- minTickGap: 5,
276
- tickFormatter: orientation === "vertical" ? tickFormatter : void 0,
277
- ...getStyles("axis"),
278
- ...xAxisProps,
279
- children: [
280
- xAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(recharts.Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
281
- xAxisProps?.children
282
- ]
283
- }
284
- ),
285
- /* @__PURE__ */ jsxRuntime.jsxs(
286
- recharts.YAxis,
287
- {
288
- orientation: "left",
289
- tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
290
- hide: !withYAxis,
291
- ...sharedYAxisProps,
292
- ...yAxisProps,
293
- children: [
294
- yAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
295
- recharts.Label,
296
- {
297
- position: "insideLeft",
298
- angle: -90,
299
- textAnchor: "middle",
300
- fontSize: 12,
301
- offset: -5,
302
- ...getStyles("axisLabel"),
303
- children: yAxisLabel
304
- }
305
- ),
306
- yAxisProps?.children
307
- ]
308
- }
309
- ),
310
- /* @__PURE__ */ jsxRuntime.jsxs(
311
- recharts.YAxis,
312
- {
313
- yAxisId: "right",
314
- orientation: "right",
315
- tick: { transform: "translate(10, 0)", fontSize: 12, fill: "currentColor" },
316
- hide: !withRightYAxis,
317
- ...sharedYAxisProps,
318
- ...rightYAxisProps,
319
- children: [
320
- rightYAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
321
- recharts.Label,
322
- {
323
- position: "insideRight",
324
- angle: 90,
325
- textAnchor: "middle",
326
- fontSize: 12,
327
- offset: -5,
328
- ...getStyles("axisLabel"),
329
- children: rightYAxisLabel
330
- }
331
- ),
332
- yAxisProps?.children
333
- ]
334
- }
335
- ),
336
- withTooltip && /* @__PURE__ */ jsxRuntime.jsx(
337
- recharts.Tooltip,
338
- {
339
- animationDuration: tooltipAnimationDuration,
340
- isAnimationActive,
341
- position: orientation === "vertical" ? {} : { y: 0 },
342
- cursor: {
343
- stroke: "var(--chart-grid-color)",
344
- strokeWidth: 1,
345
- strokeDasharray
346
- },
347
- content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ jsxRuntime.jsx(
348
- ChartTooltip.ChartTooltip,
349
- {
350
- label: labelFormatter && payload ? labelFormatter(label, payload) : label,
351
- payload,
352
- unit,
353
- classNames: resolvedClassNames,
354
- styles: resolvedStyles,
355
- series,
356
- valueFormatter,
357
- attributes
358
- }
359
- ),
360
- ...tooltipProps
361
- }
362
- ),
363
- type === "split" && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
364
- AreaSplit.AreaSplit,
365
- {
366
- colors: splitColors,
367
- id: splitId,
368
- offset: splitOffset ?? getSplitOffset.getDefaultSplitOffset({ data, series }),
369
- fillOpacity
370
- }
371
- ) }),
372
- areas,
373
- withDots && dotsAreas,
374
- children
375
- ]
376
- }
377
- ) }) });
35
+ const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { textColor, gridColor }) => ({ root: {
36
+ "--chart-text-color": textColor ? (0, _mantine_core.getThemeColor)(textColor, theme) : void 0,
37
+ "--chart-grid-color": gridColor ? (0, _mantine_core.getThemeColor)(gridColor, theme) : void 0
38
+ } }));
39
+ const AreaChart = (0, _mantine_core.factory)((_props) => {
40
+ const props = (0, _mantine_core.useProps)("AreaChart", defaultProps, _props);
41
+ const { classNames, className, style, styles, unstyled, vars, data, series, withGradient, dataKey, withXAxis, withYAxis, curveType, gridProps, withDots, tickLine, strokeDasharray, gridAxis, unit, yAxisProps, xAxisProps, dotProps, activeDotProps, strokeWidth, tooltipAnimationDuration, type, legendProps, tooltipProps, withLegend, withTooltip, areaChartProps, fillOpacity, splitColors, splitOffset, connectNulls, onMouseLeave, orientation, referenceLines, dir, valueFormatter, children, areaProps, xAxisLabel, yAxisLabel, withRightYAxis, rightYAxisLabel, rightYAxisProps, withPointLabels, gridColor, textColor, attributes, ...others } = props;
42
+ const theme = (0, _mantine_core.useMantineTheme)();
43
+ const baseId = (0, react.useId)();
44
+ const splitId = `${baseId}-split`;
45
+ const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
46
+ const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
47
+ const isAnimationActive = (tooltipAnimationDuration || 0) > 0;
48
+ const _withGradient = typeof withGradient === "boolean" ? withGradient : type === "default";
49
+ const stacked = type === "stacked" || type === "percent";
50
+ const [highlightedArea, setHighlightedArea] = (0, react.useState)(null);
51
+ const shouldHighlight = highlightedArea !== null;
52
+ const handleMouseLeave = (event) => {
53
+ setHighlightedArea(null);
54
+ onMouseLeave?.(event);
55
+ };
56
+ const { resolvedClassNames, resolvedStyles } = (0, _mantine_core.useResolvedStylesApi)({
57
+ classNames,
58
+ styles,
59
+ props
60
+ });
61
+ const getStyles = (0, _mantine_core.useStyles)({
62
+ name: "AreaChart",
63
+ classes: require_grid_chart_module.default,
64
+ props,
65
+ className,
66
+ style,
67
+ classNames,
68
+ styles,
69
+ unstyled,
70
+ attributes,
71
+ vars,
72
+ varsResolver
73
+ });
74
+ const dotsAreas = series.map((item) => {
75
+ const color = (0, _mantine_core.getThemeColor)(item.color, theme);
76
+ const dimmed = shouldHighlight && highlightedArea !== item.name;
77
+ return /* @__PURE__ */ (0, react.createElement)(recharts.Area, {
78
+ ...getStyles("area"),
79
+ activeDot: {
80
+ fill: theme.white,
81
+ stroke: color,
82
+ strokeWidth: 2,
83
+ r: 4,
84
+ ...activeDotProps
85
+ },
86
+ dot: {
87
+ fill: color,
88
+ fillOpacity: dimmed ? 0 : 1,
89
+ strokeWidth: 2,
90
+ r: 4,
91
+ ...dotProps
92
+ },
93
+ key: item.name,
94
+ name: item.name,
95
+ type: curveType,
96
+ dataKey: item.name,
97
+ fill: "none",
98
+ strokeWidth,
99
+ stroke: "none",
100
+ isAnimationActive: false,
101
+ connectNulls,
102
+ stackId: stacked ? "stack-dots" : void 0,
103
+ yAxisId: item.yAxisId || void 0,
104
+ ...typeof areaProps === "function" ? areaProps(item) : areaProps
105
+ });
106
+ });
107
+ const areas = series.map((item) => {
108
+ const id = `${baseId}-${item.color.replace(/[^a-zA-Z0-9]/g, "")}`;
109
+ const color = (0, _mantine_core.getThemeColor)(item.color, theme);
110
+ const dimmed = shouldHighlight && highlightedArea !== item.name;
111
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AreaGradient.AreaGradient, {
112
+ color,
113
+ withGradient: _withGradient,
114
+ id,
115
+ fillOpacity
116
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Area, {
117
+ ...getStyles("area"),
118
+ activeDot: false,
119
+ dot: false,
120
+ name: item.name,
121
+ type: item.curveType ?? curveType,
122
+ dataKey: item.name,
123
+ fill: type === "split" ? `url(#${splitId})` : `url(#${id})`,
124
+ strokeWidth,
125
+ stroke: color,
126
+ isAnimationActive: false,
127
+ connectNulls,
128
+ stackId: stacked ? "stack" : void 0,
129
+ fillOpacity: dimmed ? 0 : 1,
130
+ strokeOpacity: dimmed ? .5 : 1,
131
+ strokeDasharray: item.strokeDasharray,
132
+ yAxisId: item.yAxisId || void 0,
133
+ label: withPointLabels ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PointLabel.PointLabel, { valueFormatter }) : void 0,
134
+ ...typeof areaProps === "function" ? areaProps(item) : areaProps
135
+ })] }, item.name);
136
+ });
137
+ const referenceLinesItems = referenceLines?.map((line, index) => {
138
+ const color = (0, _mantine_core.getThemeColor)(line.color, theme);
139
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.ReferenceLine, {
140
+ stroke: line.color ? color : "var(--chart-grid-color)",
141
+ strokeWidth: 1,
142
+ yAxisId: line.yAxisId || void 0,
143
+ ...line,
144
+ label: {
145
+ value: line.label,
146
+ fill: line.color ? color : "currentColor",
147
+ fontSize: 12,
148
+ position: line.labelPosition ?? "insideBottomLeft"
149
+ },
150
+ ...getStyles("referenceLine")
151
+ }, index);
152
+ });
153
+ const tickFormatter = type === "percent" ? valueToPercent : valueFormatter;
154
+ const sharedYAxisProps = {
155
+ axisLine: false,
156
+ ...orientation === "vertical" ? {
157
+ dataKey,
158
+ type: "category"
159
+ } : { type: "number" },
160
+ tickLine: withYTickLine ? { stroke: "currentColor" } : false,
161
+ allowDecimals: true,
162
+ unit,
163
+ tickFormatter: orientation === "vertical" ? void 0 : tickFormatter,
164
+ ...getStyles("axis")
165
+ };
166
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Box, {
167
+ ...getStyles("root"),
168
+ onMouseLeave: handleMouseLeave,
169
+ dir: dir || "ltr",
170
+ ...others,
171
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.ResponsiveContainer, {
172
+ ...getStyles("container"),
173
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.AreaChart, {
174
+ data,
175
+ stackOffset: type === "percent" ? "expand" : void 0,
176
+ layout: orientation,
177
+ margin: {
178
+ bottom: xAxisLabel ? 30 : void 0,
179
+ left: yAxisLabel ? 10 : void 0,
180
+ right: yAxisLabel ? 5 : void 0
181
+ },
182
+ ...areaChartProps,
183
+ children: [
184
+ referenceLinesItems,
185
+ withLegend && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Legend, {
186
+ verticalAlign: "top",
187
+ content: (payload) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChartLegend.ChartLegend, {
188
+ payload: payload.payload,
189
+ onHighlight: setHighlightedArea,
190
+ legendPosition: legendProps?.verticalAlign || "top",
191
+ classNames: resolvedClassNames,
192
+ styles: resolvedStyles,
193
+ series,
194
+ attributes
195
+ }),
196
+ ...legendProps
197
+ }),
198
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.CartesianGrid, {
199
+ strokeDasharray,
200
+ vertical: gridAxis === "y" || gridAxis === "xy",
201
+ horizontal: gridAxis === "x" || gridAxis === "xy",
202
+ ...getStyles("grid"),
203
+ ...gridProps
204
+ }),
205
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.XAxis, {
206
+ hide: !withXAxis,
207
+ ...orientation === "vertical" ? { type: "number" } : { dataKey },
208
+ tick: {
209
+ transform: "translate(0, 10)",
210
+ fontSize: 12,
211
+ fill: "currentColor"
212
+ },
213
+ stroke: "",
214
+ interval: "preserveStartEnd",
215
+ tickLine: withXTickLine ? { stroke: "currentColor" } : false,
216
+ minTickGap: 5,
217
+ tickFormatter: orientation === "vertical" ? tickFormatter : void 0,
218
+ ...getStyles("axis"),
219
+ ...xAxisProps,
220
+ children: [xAxisLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Label, {
221
+ position: "insideBottom",
222
+ offset: -20,
223
+ fontSize: 12,
224
+ ...getStyles("axisLabel"),
225
+ children: xAxisLabel
226
+ }), xAxisProps?.children]
227
+ }),
228
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.YAxis, {
229
+ orientation: "left",
230
+ tick: {
231
+ transform: "translate(-10, 0)",
232
+ fontSize: 12,
233
+ fill: "currentColor"
234
+ },
235
+ hide: !withYAxis,
236
+ ...sharedYAxisProps,
237
+ ...yAxisProps,
238
+ children: [yAxisLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Label, {
239
+ position: "insideLeft",
240
+ angle: -90,
241
+ textAnchor: "middle",
242
+ fontSize: 12,
243
+ offset: -5,
244
+ ...getStyles("axisLabel"),
245
+ children: yAxisLabel
246
+ }), yAxisProps?.children]
247
+ }),
248
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.YAxis, {
249
+ yAxisId: "right",
250
+ orientation: "right",
251
+ tick: {
252
+ transform: "translate(10, 0)",
253
+ fontSize: 12,
254
+ fill: "currentColor"
255
+ },
256
+ hide: !withRightYAxis,
257
+ ...sharedYAxisProps,
258
+ ...rightYAxisProps,
259
+ children: [rightYAxisLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Label, {
260
+ position: "insideRight",
261
+ angle: 90,
262
+ textAnchor: "middle",
263
+ fontSize: 12,
264
+ offset: -5,
265
+ ...getStyles("axisLabel"),
266
+ children: rightYAxisLabel
267
+ }), yAxisProps?.children]
268
+ }),
269
+ withTooltip && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Tooltip, {
270
+ animationDuration: tooltipAnimationDuration,
271
+ isAnimationActive,
272
+ position: orientation === "vertical" ? {} : { y: 0 },
273
+ cursor: {
274
+ stroke: "var(--chart-grid-color)",
275
+ strokeWidth: 1,
276
+ strokeDasharray
277
+ },
278
+ content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChartTooltip.ChartTooltip, {
279
+ label: labelFormatter && payload ? labelFormatter(label, payload) : label,
280
+ payload,
281
+ unit,
282
+ classNames: resolvedClassNames,
283
+ styles: resolvedStyles,
284
+ series,
285
+ valueFormatter,
286
+ attributes
287
+ }),
288
+ ...tooltipProps
289
+ }),
290
+ type === "split" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AreaSplit.AreaSplit, {
291
+ colors: splitColors,
292
+ id: splitId,
293
+ offset: splitOffset ?? require_get_split_offset.getDefaultSplitOffset({
294
+ data,
295
+ series
296
+ }),
297
+ fillOpacity
298
+ }) }),
299
+ areas,
300
+ withDots && dotsAreas,
301
+ children
302
+ ]
303
+ })
304
+ })
305
+ });
378
306
  });
379
- AreaChart.classes = gridChart_module;
307
+ AreaChart.classes = require_grid_chart_module.default;
380
308
  AreaChart.varsResolver = varsResolver;
381
309
  AreaChart.displayName = "@mantine/charts/AreaChart";
382
-
310
+ //#endregion
383
311
  exports.AreaChart = AreaChart;
384
- //# sourceMappingURL=AreaChart.cjs.map
312
+
313
+ //# sourceMappingURL=AreaChart.cjs.map