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