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