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

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