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