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