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