@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,286 +1,227 @@
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
-
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_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/ScatterChart/ScatterChart.tsx
12
11
  function getAxis(key, dataKey) {
13
- return key === dataKey.x ? "x" : "y";
12
+ return key === dataKey.x ? "x" : "y";
14
13
  }
15
14
  const defaultProps = {
16
- withXAxis: true,
17
- withYAxis: true,
18
- withTooltip: true,
19
- tooltipAnimationDuration: 0,
20
- tickLine: "y",
21
- strokeDasharray: "5 5",
22
- gridAxis: "x"
15
+ withXAxis: true,
16
+ withYAxis: true,
17
+ withTooltip: true,
18
+ tooltipAnimationDuration: 0,
19
+ tickLine: "y",
20
+ strokeDasharray: "5 5",
21
+ gridAxis: "x"
23
22
  };
24
- const varsResolver = core.createVarsResolver((theme, { textColor, gridColor }) => ({
25
- root: {
26
- "--chart-text-color": textColor ? core.getThemeColor(textColor, theme) : void 0,
27
- "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0
28
- }
29
- }));
30
- const ScatterChart = core.factory((_props) => {
31
- const props = core.useProps("ScatterChart", defaultProps, _props);
32
- const {
33
- classNames,
34
- className,
35
- style,
36
- styles,
37
- unstyled,
38
- vars,
39
- referenceLines,
40
- dir,
41
- withLegend,
42
- withTooltip,
43
- withXAxis,
44
- withYAxis,
45
- xAxisProps,
46
- yAxisProps,
47
- orientation,
48
- scatterChartProps,
49
- legendProps,
50
- data,
51
- gridAxis,
52
- tickLine,
53
- strokeDasharray,
54
- gridProps,
55
- tooltipAnimationDuration,
56
- tooltipProps,
57
- children,
58
- onMouseLeave,
59
- dataKey,
60
- textColor,
61
- gridColor,
62
- xAxisLabel,
63
- yAxisLabel,
64
- unit,
65
- labels,
66
- valueFormatter,
67
- scatterProps,
68
- pointLabels,
69
- attributes,
70
- ...others
71
- } = props;
72
- const getFormatter = (axis) => typeof valueFormatter === "function" ? valueFormatter : valueFormatter?.[axis];
73
- const xFormatter = getFormatter("x");
74
- const yFormatter = getFormatter("y");
75
- const theme = core.useMantineTheme();
76
- const mappedData = data.map((item) => ({
77
- ...item,
78
- data: item.data.map((point) => ({ ...point, name: item.name }))
79
- }));
80
- const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
81
- classNames,
82
- styles,
83
- props
84
- });
85
- const getStyles = core.useStyles({
86
- name: "ScatterChart",
87
- classes: gridChart_module,
88
- props,
89
- className,
90
- style,
91
- classNames,
92
- styles,
93
- unstyled,
94
- attributes,
95
- vars,
96
- varsResolver
97
- });
98
- const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
99
- const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
100
- const [highlightedArea, setHighlightedArea] = react.useState(null);
101
- const shouldHighlight = highlightedArea !== null;
102
- const handleMouseLeave = (event) => {
103
- setHighlightedArea(null);
104
- onMouseLeave?.(event);
105
- };
106
- const referenceLinesItems = referenceLines?.map((line, index) => {
107
- const color = core.getThemeColor(line.color, theme);
108
- return /* @__PURE__ */ jsxRuntime.jsx(
109
- recharts.ReferenceLine,
110
- {
111
- stroke: line.color ? color : "var(--chart-grid-color)",
112
- strokeWidth: 1,
113
- ...line,
114
- label: {
115
- value: line.label,
116
- fill: line.color ? color : "currentColor",
117
- fontSize: 12,
118
- position: line.labelPosition ?? "insideBottomLeft"
119
- },
120
- ...getStyles("referenceLine")
121
- },
122
- index
123
- );
124
- });
125
- const scatters = mappedData.map((item, index) => {
126
- const dimmed = shouldHighlight && highlightedArea !== item.name;
127
- return /* @__PURE__ */ jsxRuntime.jsxs(
128
- recharts.Scatter,
129
- {
130
- data: item.data,
131
- fill: core.getThemeColor(item.color, theme),
132
- isAnimationActive: false,
133
- fillOpacity: dimmed ? 0.1 : 1,
134
- ...scatterProps,
135
- children: [
136
- pointLabels && /* @__PURE__ */ jsxRuntime.jsx(recharts.LabelList, { dataKey: dataKey[pointLabels], fontSize: 8, dy: 10 }),
137
- scatterProps?.children
138
- ]
139
- },
140
- index
141
- );
142
- });
143
- 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(
144
- recharts.ScatterChart,
145
- {
146
- margin: {
147
- bottom: xAxisLabel ? 30 : void 0,
148
- left: yAxisLabel ? 10 : void 0,
149
- right: yAxisLabel ? 5 : void 0
150
- },
151
- ...scatterChartProps,
152
- children: [
153
- /* @__PURE__ */ jsxRuntime.jsx(
154
- recharts.CartesianGrid,
155
- {
156
- strokeDasharray,
157
- vertical: gridAxis === "y" || gridAxis === "xy",
158
- horizontal: gridAxis === "x" || gridAxis === "xy",
159
- ...getStyles("grid"),
160
- ...gridProps
161
- }
162
- ),
163
- /* @__PURE__ */ jsxRuntime.jsxs(
164
- recharts.XAxis,
165
- {
166
- type: "number",
167
- hide: !withXAxis,
168
- dataKey: dataKey.x,
169
- tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
170
- stroke: "",
171
- interval: "preserveStartEnd",
172
- tickLine: withXTickLine ? { stroke: "currentColor" } : false,
173
- minTickGap: 5,
174
- unit: unit?.x,
175
- tickFormatter: xFormatter,
176
- ...getStyles("axis"),
177
- ...xAxisProps,
178
- children: [
179
- xAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(recharts.Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
180
- xAxisProps?.children
181
- ]
182
- }
183
- ),
184
- /* @__PURE__ */ jsxRuntime.jsxs(
185
- recharts.YAxis,
186
- {
187
- type: "number",
188
- hide: !withYAxis,
189
- axisLine: false,
190
- dataKey: dataKey.y,
191
- tickLine: withYTickLine ? { stroke: "currentColor" } : false,
192
- tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
193
- allowDecimals: true,
194
- unit: unit?.y,
195
- tickFormatter: yFormatter,
196
- ...getStyles("axis"),
197
- ...yAxisProps,
198
- children: [
199
- yAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
200
- recharts.Label,
201
- {
202
- position: "insideLeft",
203
- angle: -90,
204
- textAnchor: "middle",
205
- fontSize: 12,
206
- offset: -5,
207
- ...getStyles("axisLabel"),
208
- children: yAxisLabel
209
- }
210
- ),
211
- yAxisProps?.children
212
- ]
213
- }
214
- ),
215
- withTooltip && /* @__PURE__ */ jsxRuntime.jsx(
216
- recharts.Tooltip,
217
- {
218
- animationDuration: tooltipAnimationDuration,
219
- isAnimationActive: tooltipAnimationDuration !== 0,
220
- position: { y: 0 },
221
- cursor: {
222
- stroke: "var(--chart-grid-color)",
223
- strokeWidth: 1,
224
- strokeDasharray
225
- },
226
- content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ jsxRuntime.jsx(
227
- ChartTooltip.ChartTooltip,
228
- {
229
- type: "scatter",
230
- label: labelFormatter && payload ? labelFormatter(label, payload) : label,
231
- payload: labels ? payload?.map((item) => ({
232
- ...item,
233
- name: labels[getAxis(item.name, dataKey)] || item.name,
234
- value: getFormatter(getAxis(item.name, dataKey))?.(
235
- item.value
236
- ) ?? item.value
237
- })) : payload?.map((item) => ({
238
- ...item,
239
- value: getFormatter(getAxis(item.name, dataKey))?.(
240
- item.value
241
- ) ?? item.value
242
- })),
243
- classNames: resolvedClassNames,
244
- styles: resolvedStyles,
245
- series: data,
246
- attributes
247
- }
248
- ),
249
- ...tooltipProps
250
- }
251
- ),
252
- withLegend && /* @__PURE__ */ jsxRuntime.jsx(
253
- recharts.Legend,
254
- {
255
- verticalAlign: "top",
256
- content: (payload) => /* @__PURE__ */ jsxRuntime.jsx(
257
- ChartLegend.ChartLegend,
258
- {
259
- payload: payload.payload?.map((item, index) => ({
260
- ...item,
261
- dataKey: data[index].name
262
- })),
263
- onHighlight: setHighlightedArea,
264
- legendPosition: legendProps?.verticalAlign || "top",
265
- classNames: resolvedClassNames,
266
- styles: resolvedStyles,
267
- series: data,
268
- attributes
269
- }
270
- ),
271
- height: 44,
272
- ...legendProps
273
- }
274
- ),
275
- referenceLinesItems,
276
- scatters
277
- ]
278
- }
279
- ) }) });
23
+ const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { textColor, gridColor }) => ({ root: {
24
+ "--chart-text-color": textColor ? (0, _mantine_core.getThemeColor)(textColor, theme) : void 0,
25
+ "--chart-grid-color": gridColor ? (0, _mantine_core.getThemeColor)(gridColor, theme) : void 0
26
+ } }));
27
+ const ScatterChart = (0, _mantine_core.factory)((_props) => {
28
+ const props = (0, _mantine_core.useProps)("ScatterChart", defaultProps, _props);
29
+ const { classNames, className, style, styles, unstyled, vars, referenceLines, dir, withLegend, withTooltip, withXAxis, withYAxis, xAxisProps, yAxisProps, orientation, scatterChartProps, legendProps, data, gridAxis, tickLine, strokeDasharray, gridProps, tooltipAnimationDuration, tooltipProps, children, onMouseLeave, dataKey, textColor, gridColor, xAxisLabel, yAxisLabel, unit, labels, valueFormatter, scatterProps, pointLabels, attributes, ...others } = props;
30
+ const getFormatter = (axis) => typeof valueFormatter === "function" ? valueFormatter : valueFormatter?.[axis];
31
+ const xFormatter = getFormatter("x");
32
+ const yFormatter = getFormatter("y");
33
+ const theme = (0, _mantine_core.useMantineTheme)();
34
+ const mappedData = data.map((item) => ({
35
+ ...item,
36
+ data: item.data.map((point) => ({
37
+ ...point,
38
+ name: item.name
39
+ }))
40
+ }));
41
+ const { resolvedClassNames, resolvedStyles } = (0, _mantine_core.useResolvedStylesApi)({
42
+ classNames,
43
+ styles,
44
+ props
45
+ });
46
+ const getStyles = (0, _mantine_core.useStyles)({
47
+ name: "ScatterChart",
48
+ classes: require_grid_chart_module.default,
49
+ props,
50
+ className,
51
+ style,
52
+ classNames,
53
+ styles,
54
+ unstyled,
55
+ attributes,
56
+ vars,
57
+ varsResolver
58
+ });
59
+ const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
60
+ const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
61
+ const [highlightedArea, setHighlightedArea] = (0, react.useState)(null);
62
+ const shouldHighlight = highlightedArea !== null;
63
+ const handleMouseLeave = (event) => {
64
+ setHighlightedArea(null);
65
+ onMouseLeave?.(event);
66
+ };
67
+ const referenceLinesItems = referenceLines?.map((line, index) => {
68
+ const color = (0, _mantine_core.getThemeColor)(line.color, theme);
69
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.ReferenceLine, {
70
+ stroke: line.color ? color : "var(--chart-grid-color)",
71
+ strokeWidth: 1,
72
+ ...line,
73
+ label: {
74
+ value: line.label,
75
+ fill: line.color ? color : "currentColor",
76
+ fontSize: 12,
77
+ position: line.labelPosition ?? "insideBottomLeft"
78
+ },
79
+ ...getStyles("referenceLine")
80
+ }, index);
81
+ });
82
+ const scatters = mappedData.map((item, index) => {
83
+ const dimmed = shouldHighlight && highlightedArea !== item.name;
84
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.Scatter, {
85
+ data: item.data,
86
+ fill: (0, _mantine_core.getThemeColor)(item.color, theme),
87
+ isAnimationActive: false,
88
+ fillOpacity: dimmed ? .1 : 1,
89
+ ...scatterProps,
90
+ children: [pointLabels && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.LabelList, {
91
+ dataKey: dataKey[pointLabels],
92
+ fontSize: 8,
93
+ dy: 10
94
+ }), scatterProps?.children]
95
+ }, index);
96
+ });
97
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Box, {
98
+ ...getStyles("root"),
99
+ onMouseLeave: handleMouseLeave,
100
+ dir: dir || "ltr",
101
+ ...others,
102
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.ResponsiveContainer, {
103
+ ...getStyles("container"),
104
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.ScatterChart, {
105
+ margin: {
106
+ bottom: xAxisLabel ? 30 : void 0,
107
+ left: yAxisLabel ? 10 : void 0,
108
+ right: yAxisLabel ? 5 : void 0
109
+ },
110
+ ...scatterChartProps,
111
+ children: [
112
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.CartesianGrid, {
113
+ strokeDasharray,
114
+ vertical: gridAxis === "y" || gridAxis === "xy",
115
+ horizontal: gridAxis === "x" || gridAxis === "xy",
116
+ ...getStyles("grid"),
117
+ ...gridProps
118
+ }),
119
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.XAxis, {
120
+ type: "number",
121
+ hide: !withXAxis,
122
+ dataKey: dataKey.x,
123
+ tick: {
124
+ transform: "translate(0, 10)",
125
+ fontSize: 12,
126
+ fill: "currentColor"
127
+ },
128
+ stroke: "",
129
+ interval: "preserveStartEnd",
130
+ tickLine: withXTickLine ? { stroke: "currentColor" } : false,
131
+ minTickGap: 5,
132
+ unit: unit?.x,
133
+ tickFormatter: xFormatter,
134
+ ...getStyles("axis"),
135
+ ...xAxisProps,
136
+ children: [xAxisLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Label, {
137
+ position: "insideBottom",
138
+ offset: -20,
139
+ fontSize: 12,
140
+ ...getStyles("axisLabel"),
141
+ children: xAxisLabel
142
+ }), xAxisProps?.children]
143
+ }),
144
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.YAxis, {
145
+ type: "number",
146
+ hide: !withYAxis,
147
+ axisLine: false,
148
+ dataKey: dataKey.y,
149
+ tickLine: withYTickLine ? { stroke: "currentColor" } : false,
150
+ tick: {
151
+ transform: "translate(-10, 0)",
152
+ fontSize: 12,
153
+ fill: "currentColor"
154
+ },
155
+ allowDecimals: true,
156
+ unit: unit?.y,
157
+ tickFormatter: yFormatter,
158
+ ...getStyles("axis"),
159
+ ...yAxisProps,
160
+ children: [yAxisLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Label, {
161
+ position: "insideLeft",
162
+ angle: -90,
163
+ textAnchor: "middle",
164
+ fontSize: 12,
165
+ offset: -5,
166
+ ...getStyles("axisLabel"),
167
+ children: yAxisLabel
168
+ }), yAxisProps?.children]
169
+ }),
170
+ withTooltip && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Tooltip, {
171
+ animationDuration: tooltipAnimationDuration,
172
+ isAnimationActive: tooltipAnimationDuration !== 0,
173
+ position: { y: 0 },
174
+ cursor: {
175
+ stroke: "var(--chart-grid-color)",
176
+ strokeWidth: 1,
177
+ strokeDasharray
178
+ },
179
+ content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChartTooltip.ChartTooltip, {
180
+ type: "scatter",
181
+ label: labelFormatter && payload ? labelFormatter(label, payload) : label,
182
+ payload: labels ? payload?.map((item) => ({
183
+ ...item,
184
+ name: labels[getAxis(item.name, dataKey)] || item.name,
185
+ value: getFormatter(getAxis(item.name, dataKey))?.(item.value) ?? item.value
186
+ })) : payload?.map((item) => ({
187
+ ...item,
188
+ value: getFormatter(getAxis(item.name, dataKey))?.(item.value) ?? item.value
189
+ })),
190
+ classNames: resolvedClassNames,
191
+ styles: resolvedStyles,
192
+ series: data,
193
+ attributes
194
+ }),
195
+ ...tooltipProps
196
+ }),
197
+ withLegend && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Legend, {
198
+ verticalAlign: "top",
199
+ content: (payload) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChartLegend.ChartLegend, {
200
+ payload: payload.payload?.map((item, index) => ({
201
+ ...item,
202
+ dataKey: data[index].name
203
+ })),
204
+ onHighlight: setHighlightedArea,
205
+ legendPosition: legendProps?.verticalAlign || "top",
206
+ classNames: resolvedClassNames,
207
+ styles: resolvedStyles,
208
+ series: data,
209
+ attributes
210
+ }),
211
+ height: 44,
212
+ ...legendProps
213
+ }),
214
+ referenceLinesItems,
215
+ scatters
216
+ ]
217
+ })
218
+ })
219
+ });
280
220
  });
281
221
  ScatterChart.displayName = "@mantine/charts/ScatterChart";
282
- ScatterChart.classes = gridChart_module;
222
+ ScatterChart.classes = require_grid_chart_module.default;
283
223
  ScatterChart.varsResolver = varsResolver;
284
-
224
+ //#endregion
285
225
  exports.ScatterChart = ScatterChart;
286
- //# sourceMappingURL=ScatterChart.cjs.map
226
+
227
+ //# sourceMappingURL=ScatterChart.cjs.map