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