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