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