@mui/x-charts-pro 8.0.0 → 8.2.0

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 (134) hide show
  1. package/BarChartPro/BarChartPro.js +7 -1
  2. package/BarChartPro/BarChartPro.plugins.d.ts +2 -1
  3. package/BarChartPro/BarChartPro.plugins.js +2 -1
  4. package/CHANGELOG.md +230 -5
  5. package/ChartContainerPro/ChartContainerPro.d.ts +1 -0
  6. package/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
  7. package/ChartDataProviderPro/ChartDataProviderPro.js +11 -2
  8. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -2
  9. package/ChartDataProviderPro/useChartDataProviderProProps.js +2 -0
  10. package/FunnelChart/FunnelChart.js +12 -1
  11. package/FunnelChart/FunnelPlot.d.ts +5 -0
  12. package/FunnelChart/FunnelPlot.js +13 -16
  13. package/FunnelChart/curves/bump.d.ts +24 -0
  14. package/FunnelChart/curves/bump.js +82 -0
  15. package/FunnelChart/curves/curve.types.d.ts +8 -0
  16. package/FunnelChart/curves/curve.types.js +5 -0
  17. package/FunnelChart/curves/funnelStep.d.ts +25 -0
  18. package/FunnelChart/{funnelStepCurve.js → curves/funnelStep.js} +32 -19
  19. package/FunnelChart/curves/getFunnelCurve.d.ts +3 -0
  20. package/FunnelChart/curves/getFunnelCurve.js +22 -0
  21. package/FunnelChart/curves/index.d.ts +2 -0
  22. package/FunnelChart/curves/index.js +27 -0
  23. package/FunnelChart/curves/linear.d.ts +24 -0
  24. package/FunnelChart/curves/linear.js +113 -0
  25. package/FunnelChart/funnel.types.d.ts +2 -2
  26. package/FunnelChart/funnelPlotSlots.types.d.ts +1 -1
  27. package/FunnelChart/funnelSectionClasses.d.ts +1 -1
  28. package/FunnelChart/index.d.ts +3 -2
  29. package/FunnelChart/useFunnelChartProps.d.ts +1 -1
  30. package/FunnelChart/useFunnelChartProps.js +7 -4
  31. package/Heatmap/Heatmap.js +5 -1
  32. package/Heatmap/HeatmapItem.js +1 -1
  33. package/LineChartPro/LineChartPro.js +7 -1
  34. package/LineChartPro/LineChartPro.plugins.d.ts +2 -1
  35. package/LineChartPro/LineChartPro.plugins.js +2 -1
  36. package/ScatterChartPro/ScatterChartPro.js +7 -1
  37. package/ScatterChartPro/ScatterChartPro.plugins.d.ts +2 -1
  38. package/ScatterChartPro/ScatterChartPro.plugins.js +2 -1
  39. package/esm/BarChartPro/BarChartPro.js +7 -1
  40. package/esm/BarChartPro/BarChartPro.plugins.d.ts +2 -1
  41. package/esm/BarChartPro/BarChartPro.plugins.js +2 -1
  42. package/esm/ChartContainerPro/ChartContainerPro.d.ts +1 -0
  43. package/esm/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
  44. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +11 -2
  45. package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -2
  46. package/esm/ChartDataProviderPro/useChartDataProviderProProps.js +2 -0
  47. package/esm/FunnelChart/FunnelChart.js +12 -1
  48. package/esm/FunnelChart/FunnelPlot.d.ts +5 -0
  49. package/esm/FunnelChart/FunnelPlot.js +14 -17
  50. package/esm/FunnelChart/curves/bump.d.ts +24 -0
  51. package/esm/FunnelChart/curves/bump.js +75 -0
  52. package/esm/FunnelChart/curves/curve.types.d.ts +8 -0
  53. package/esm/FunnelChart/curves/curve.types.js +1 -0
  54. package/esm/FunnelChart/curves/funnelStep.d.ts +25 -0
  55. package/esm/FunnelChart/{funnelStepCurve.js → curves/funnelStep.js} +32 -19
  56. package/esm/FunnelChart/curves/getFunnelCurve.d.ts +3 -0
  57. package/esm/FunnelChart/curves/getFunnelCurve.js +15 -0
  58. package/esm/FunnelChart/curves/index.d.ts +2 -0
  59. package/esm/FunnelChart/curves/index.js +2 -0
  60. package/esm/FunnelChart/curves/linear.d.ts +24 -0
  61. package/esm/FunnelChart/curves/linear.js +106 -0
  62. package/esm/FunnelChart/funnel.types.d.ts +2 -2
  63. package/esm/FunnelChart/funnelPlotSlots.types.d.ts +1 -1
  64. package/esm/FunnelChart/funnelSectionClasses.d.ts +1 -1
  65. package/esm/FunnelChart/index.d.ts +3 -2
  66. package/esm/FunnelChart/useFunnelChartProps.d.ts +1 -1
  67. package/esm/FunnelChart/useFunnelChartProps.js +7 -4
  68. package/esm/Heatmap/Heatmap.js +5 -1
  69. package/esm/Heatmap/HeatmapItem.js +1 -1
  70. package/esm/LineChartPro/LineChartPro.js +7 -1
  71. package/esm/LineChartPro/LineChartPro.plugins.d.ts +2 -1
  72. package/esm/LineChartPro/LineChartPro.plugins.js +2 -1
  73. package/esm/ScatterChartPro/ScatterChartPro.js +7 -1
  74. package/esm/ScatterChartPro/ScatterChartPro.plugins.d.ts +2 -1
  75. package/esm/ScatterChartPro/ScatterChartPro.plugins.js +2 -1
  76. package/esm/index.d.ts +1 -0
  77. package/esm/index.js +2 -1
  78. package/esm/internals/plugins/allPlugins.d.ts +5 -4
  79. package/esm/internals/plugins/allPlugins.js +3 -2
  80. package/esm/internals/plugins/useChartProExport/common.d.ts +1 -0
  81. package/esm/internals/plugins/useChartProExport/common.js +8 -0
  82. package/esm/internals/plugins/useChartProExport/exportImage.d.ts +3 -0
  83. package/esm/internals/plugins/useChartProExport/exportImage.js +85 -0
  84. package/esm/internals/plugins/useChartProExport/index.d.ts +2 -0
  85. package/esm/internals/plugins/useChartProExport/index.js +2 -0
  86. package/esm/internals/plugins/useChartProExport/print.d.ts +4 -0
  87. package/esm/internals/plugins/useChartProExport/print.js +28 -0
  88. package/esm/internals/plugins/useChartProExport/useChartProExport.d.ts +3 -0
  89. package/esm/internals/plugins/useChartProExport/useChartProExport.js +65 -0
  90. package/esm/internals/plugins/useChartProExport/useChartProExport.types.d.ts +67 -0
  91. package/esm/internals/plugins/useChartProExport/useChartProExport.types.js +1 -0
  92. package/esm/internals/plugins/useChartProZoom/useChartProZoom.d.ts +2 -1
  93. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +54 -30
  94. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +25 -25
  95. package/esm/locales/index.d.ts +1 -0
  96. package/esm/locales/index.js +1 -0
  97. package/esm/themeAugmentation/components.d.ts +0 -4
  98. package/esm/themeAugmentation/components.js +1 -0
  99. package/esm/themeAugmentation/index.d.ts +3 -3
  100. package/esm/themeAugmentation/overrides.d.ts +0 -3
  101. package/esm/themeAugmentation/overrides.js +2 -0
  102. package/esm/themeAugmentation/props.d.ts +0 -6
  103. package/esm/themeAugmentation/props.js +2 -0
  104. package/index.d.ts +1 -0
  105. package/index.js +12 -1
  106. package/internals/plugins/allPlugins.d.ts +5 -4
  107. package/internals/plugins/allPlugins.js +3 -2
  108. package/internals/plugins/useChartProExport/common.d.ts +1 -0
  109. package/internals/plugins/useChartProExport/common.js +14 -0
  110. package/internals/plugins/useChartProExport/exportImage.d.ts +3 -0
  111. package/internals/plugins/useChartProExport/exportImage.js +95 -0
  112. package/internals/plugins/useChartProExport/index.d.ts +2 -0
  113. package/internals/plugins/useChartProExport/index.js +27 -0
  114. package/internals/plugins/useChartProExport/print.d.ts +4 -0
  115. package/internals/plugins/useChartProExport/print.js +35 -0
  116. package/internals/plugins/useChartProExport/useChartProExport.d.ts +3 -0
  117. package/internals/plugins/useChartProExport/useChartProExport.js +73 -0
  118. package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +67 -0
  119. package/internals/plugins/useChartProExport/useChartProExport.types.js +5 -0
  120. package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +2 -1
  121. package/internals/plugins/useChartProZoom/useChartProZoom.js +54 -30
  122. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +25 -25
  123. package/locales/index.d.ts +1 -0
  124. package/locales/index.js +16 -0
  125. package/package.json +7 -4
  126. package/themeAugmentation/components.d.ts +0 -4
  127. package/themeAugmentation/components.js +5 -0
  128. package/themeAugmentation/index.d.ts +3 -3
  129. package/themeAugmentation/overrides.d.ts +0 -3
  130. package/themeAugmentation/overrides.js +5 -0
  131. package/themeAugmentation/props.d.ts +0 -6
  132. package/themeAugmentation/props.js +5 -0
  133. package/FunnelChart/funnelStepCurve.d.ts +0 -4
  134. package/esm/FunnelChart/funnelStepCurve.d.ts +0 -4
@@ -0,0 +1,25 @@
1
+ import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
+ /**
3
+ * This is a custom "step" curve generator for the funnel chart.
4
+ * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
5
+ *
6
+ * It takes into account the gap between the points and draws a smooth curve between them.
7
+ *
8
+ * It is based on the d3-shape step curve generator.
9
+ * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
10
+ */
11
+ export declare class FunnelStep implements CurveGenerator {
12
+ private context;
13
+ private line;
14
+ private x;
15
+ private y;
16
+ private currentPoint;
17
+ private isHorizontal;
18
+ private gap;
19
+ constructor(context: CanvasRenderingContext2D, isHorizontal: boolean, gap?: number);
20
+ areaStart(): void;
21
+ areaEnd(): void;
22
+ lineStart(): void;
23
+ lineEnd(): void;
24
+ point(x: number, y: number): void;
25
+ }
@@ -3,24 +3,28 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.funnelVerticalStepCurve = exports.funnelHorizontalStepCurve = void 0;
6
+ exports.FunnelStep = void 0;
7
7
  /**
8
8
  * This is a custom "step" curve generator for the funnel chart.
9
9
  * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
10
10
  *
11
+ * It takes into account the gap between the points and draws a smooth curve between them.
12
+ *
11
13
  * It is based on the d3-shape step curve generator.
12
14
  * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
13
15
  */
14
16
  class FunnelStep {
15
- constructor(context, isHorizontal) {
17
+ constructor(context, isHorizontal, gap = 0) {
16
18
  this.context = void 0;
17
19
  this.line = NaN;
18
20
  this.x = NaN;
19
21
  this.y = NaN;
20
22
  this.currentPoint = 0;
21
23
  this.isHorizontal = false;
24
+ this.gap = 0;
22
25
  this.context = context;
23
26
  this.isHorizontal = isHorizontal;
27
+ this.gap = gap / 2;
24
28
  }
25
29
  areaStart() {
26
30
  this.line = 0;
@@ -47,28 +51,37 @@ class FunnelStep {
47
51
  point(x, y) {
48
52
  x = +x;
49
53
  y = +y;
54
+
55
+ // 0 is the top-left corner.
56
+ if (this.isHorizontal) {
57
+ if (this.currentPoint === 0) {
58
+ this.context.moveTo(x + this.gap, y);
59
+ } else if (this.currentPoint === 1 || this.currentPoint === 2) {
60
+ this.context.lineTo(x - this.gap, this.y);
61
+ this.context.lineTo(x - this.gap, y);
62
+ } else {
63
+ this.context.lineTo(this.x - this.gap, y);
64
+ this.context.lineTo(x + this.gap, y);
65
+ }
66
+ this.currentPoint += 1;
67
+ this.x = x;
68
+ this.y = y;
69
+ return;
70
+ }
71
+
72
+ // 0 is the top-right corner.
50
73
  if (this.currentPoint === 0) {
51
- this.context.moveTo(x, y);
52
- } else if (this.isHorizontal && (this.currentPoint === 2 || this.currentPoint === 1)) {
53
- this.context.lineTo(x, this.y);
54
- this.context.lineTo(x, y);
55
- } else if (this.currentPoint === 3 && !this.isHorizontal) {
56
- this.context.lineTo(x, this.y);
57
- this.context.lineTo(x, y);
74
+ this.context.moveTo(x, y + this.gap);
75
+ } else if (this.currentPoint === 3) {
76
+ this.context.lineTo(x, this.y - this.gap);
77
+ this.context.lineTo(x, y + this.gap);
58
78
  } else {
59
- this.context.lineTo(this.x, y);
60
- this.context.lineTo(x, y);
79
+ this.context.lineTo(this.x, y - this.gap);
80
+ this.context.lineTo(x, y - this.gap);
61
81
  }
62
82
  this.currentPoint += 1;
63
83
  this.x = x;
64
84
  this.y = y;
65
85
  }
66
86
  }
67
- const funnelHorizontalStepCurve = context => {
68
- return new FunnelStep(context, true);
69
- };
70
- exports.funnelHorizontalStepCurve = funnelHorizontalStepCurve;
71
- const funnelVerticalStepCurve = context => {
72
- return new FunnelStep(context, false);
73
- };
74
- exports.funnelVerticalStepCurve = funnelVerticalStepCurve;
87
+ exports.FunnelStep = FunnelStep;
@@ -0,0 +1,3 @@
1
+ import { CurveFactory } from '@mui/x-charts-vendor/d3-shape';
2
+ import { FunnelCurveType } from "./curve.types.js";
3
+ export declare const getFunnelCurve: (curve: FunnelCurveType | undefined, isHorizontal: boolean, gap?: number) => CurveFactory;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getFunnelCurve = void 0;
7
+ var _funnelStep = require("./funnelStep");
8
+ var _linear = require("./linear");
9
+ var _bump = require("./bump");
10
+ const curveConstructor = curve => {
11
+ if (curve === 'step') {
12
+ return _funnelStep.FunnelStep;
13
+ }
14
+ if (curve === 'bump') {
15
+ return _bump.Bump;
16
+ }
17
+ return _linear.Linear;
18
+ };
19
+ const getFunnelCurve = (curve, isHorizontal, gap = 0) => {
20
+ return context => new (curveConstructor(curve))(context, isHorizontal, gap);
21
+ };
22
+ exports.getFunnelCurve = getFunnelCurve;
@@ -0,0 +1,2 @@
1
+ export * from "./curve.types.js";
2
+ export * from "./getFunnelCurve.js";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _curve = require("./curve.types");
7
+ Object.keys(_curve).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _curve[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _curve[key];
14
+ }
15
+ });
16
+ });
17
+ var _getFunnelCurve = require("./getFunnelCurve");
18
+ Object.keys(_getFunnelCurve).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _getFunnelCurve[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _getFunnelCurve[key];
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,24 @@
1
+ import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
+ /**
3
+ * This is a custom "linear" curve generator.
4
+ *
5
+ * It takes into account the gap between the points and draws a smooth curve between them.
6
+ *
7
+ * It is based on the d3-shape linear curve generator.
8
+ * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/linear.js
9
+ */
10
+ export declare class Linear implements CurveGenerator {
11
+ private context;
12
+ private line;
13
+ private x;
14
+ private y;
15
+ private currentPoint;
16
+ private isHorizontal;
17
+ private gap;
18
+ constructor(context: CanvasRenderingContext2D, isHorizontal: boolean, gap?: number);
19
+ areaStart(): void;
20
+ areaEnd(): void;
21
+ lineStart(): void;
22
+ lineEnd(): void;
23
+ point(x: number, y: number): void;
24
+ }
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Linear = void 0;
7
+ // From point1 to point2, get the x value from y
8
+ const xFromY = (x1, y1, x2, y2) => y => {
9
+ if (y1 === y2) {
10
+ return x1;
11
+ }
12
+ const result = (x2 - x1) * (y - y1) / (y2 - y1) + x1;
13
+ return Number.isNaN(result) ? 0 : result;
14
+ };
15
+
16
+ // From point1 to point2, get the y value from x
17
+ const yFromX = (x1, y1, x2, y2) => x => {
18
+ if (x1 === x2) {
19
+ return y1;
20
+ }
21
+ const result = (y2 - y1) * (x - x1) / (x2 - x1) + y1;
22
+ return Number.isNaN(result) ? 0 : result;
23
+ };
24
+
25
+ /**
26
+ * This is a custom "linear" curve generator.
27
+ *
28
+ * It takes into account the gap between the points and draws a smooth curve between them.
29
+ *
30
+ * It is based on the d3-shape linear curve generator.
31
+ * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/linear.js
32
+ */
33
+ class Linear {
34
+ constructor(context, isHorizontal, gap = 0) {
35
+ this.context = void 0;
36
+ this.line = NaN;
37
+ this.x = NaN;
38
+ this.y = NaN;
39
+ this.currentPoint = 0;
40
+ this.isHorizontal = false;
41
+ this.gap = 0;
42
+ this.context = context;
43
+ this.isHorizontal = isHorizontal;
44
+ this.gap = gap / 2;
45
+ }
46
+ areaStart() {
47
+ this.line = 0;
48
+ }
49
+ areaEnd() {
50
+ this.line = NaN;
51
+ }
52
+ lineStart() {
53
+ this.currentPoint = 0;
54
+ }
55
+ lineEnd() {
56
+ if (this.line || this.line !== 0 && this.currentPoint === 1) {
57
+ this.context.closePath();
58
+ }
59
+ this.line = 1 - this.line;
60
+ }
61
+ point(x, y) {
62
+ x = +x;
63
+ y = +y;
64
+
65
+ // We draw the lines only at currentPoint 1 & 3 because we need
66
+ // The data of a pair of points to draw the lines.
67
+ // Hence currentPoint 1 draws a line from point 0 to point 1 and point 1 to point 2.
68
+ // currentPoint 3 draws a line from point 2 to point 3 and point 3 to point 0.
69
+
70
+ if (this.isHorizontal) {
71
+ const yGetter = yFromX(this.x, this.y, x, y);
72
+ let xGap = 0;
73
+
74
+ // 0 is the top-left corner.
75
+ if (this.currentPoint === 1) {
76
+ xGap = this.x + this.gap;
77
+ this.context.moveTo(xGap, yGetter(xGap));
78
+ this.context.lineTo(xGap, yGetter(xGap));
79
+ xGap = x - this.gap;
80
+ this.context.lineTo(xGap, yGetter(xGap));
81
+ } else if (this.currentPoint === 3) {
82
+ xGap = this.x - this.gap;
83
+ this.context.lineTo(xGap, yGetter(xGap));
84
+ xGap = x + this.gap;
85
+ this.context.lineTo(xGap, yGetter(xGap));
86
+ }
87
+ }
88
+ if (!this.isHorizontal) {
89
+ const xGetter = xFromY(this.x, this.y, x, y);
90
+ let yGap = 0;
91
+
92
+ // 0 is the top-right corner.
93
+ if (this.currentPoint === 1) {
94
+ yGap = this.y + this.gap;
95
+ this.context.moveTo(xGetter(yGap), yGap);
96
+ this.context.lineTo(xGetter(yGap), yGap);
97
+ yGap = y - this.gap;
98
+ this.context.lineTo(xGetter(yGap), yGap);
99
+ } else if (this.currentPoint === 3) {
100
+ yGap = this.y - this.gap;
101
+ this.context.lineTo(xGetter(yGap), yGap);
102
+ yGap = y + this.gap;
103
+ this.context.lineTo(xGetter(yGap), yGap);
104
+ }
105
+ }
106
+
107
+ // Increment the values
108
+ this.currentPoint += 1;
109
+ this.x = x;
110
+ this.y = y;
111
+ }
112
+ }
113
+ exports.Linear = Linear;
@@ -1,9 +1,9 @@
1
1
  import { ChartsLabelMarkProps } from '@mui/x-charts/ChartsLabel';
2
2
  import { CommonSeriesType, CartesianSeriesType, CommonDefaultizedProps, SeriesId } from '@mui/x-charts/internals';
3
- import { CurveType, Position } from '@mui/x-charts/models';
3
+ import { Position } from '@mui/x-charts/models';
4
4
  import { DefaultizedProps, MakeRequired } from '@mui/x-internals/types';
5
+ import { FunnelCurveType } from "./curves/index.js";
5
6
  export type FunnelItemId = string | number;
6
- export type FunnelCurveType = Extract<CurveType, 'linear' | 'step'> | 'bump';
7
7
  export type FunnelValueType = {
8
8
  /**
9
9
  * A unique identifier of the funnel section.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { FunnelSectionProps } from './FunnelSection';
2
+ import type { FunnelSectionProps } from "./FunnelSection.js";
3
3
  export interface FunnelPlotSlots {
4
4
  funnelSection?: React.ElementType<FunnelSectionProps>;
5
5
  }
@@ -1,4 +1,4 @@
1
- import type { FunnelSectionProps } from './FunnelSection';
1
+ import type { FunnelSectionProps } from "./FunnelSection.js";
2
2
  export interface FunnelSectionClasses {
3
3
  /** Styles applied to the root element. */
4
4
  root: string;
@@ -1,8 +1,9 @@
1
1
  export { FunnelChart as Unstable_FunnelChart } from "./FunnelChart.js";
2
- export type { FunnelChartProps } from './FunnelChart';
2
+ export type { FunnelChartProps } from "./FunnelChart.js";
3
3
  export * from "./FunnelPlot.js";
4
4
  export * from "./funnel.types.js";
5
5
  export * from "./categoryAxis.types.js";
6
6
  export * from "./funnelSlots.types.js";
7
+ export type { FunnelCurveType } from "./curves/index.js";
7
8
  export { funnelSectionClasses } from "./funnelSectionClasses.js";
8
- export type { FunnelSectionClasses } from './funnelSectionClasses';
9
+ export type { FunnelSectionClasses } from "./funnelSectionClasses.js";
@@ -5,7 +5,7 @@ import { ChartsClipPathProps } from '@mui/x-charts/ChartsClipPath';
5
5
  import { ChartsWrapperProps } from '@mui/x-charts/internals';
6
6
  import { ChartsAxisHighlightProps } from '@mui/x-charts/ChartsAxisHighlight';
7
7
  import { FunnelPlotProps } from "./FunnelPlot.js";
8
- import type { FunnelChartProps } from './FunnelChart';
8
+ import type { FunnelChartProps } from "./FunnelChart.js";
9
9
  import { ChartContainerProProps } from "../ChartContainerPro/index.js";
10
10
  /**
11
11
  * A helper function that extracts FunnelChartProps from the input props
@@ -12,7 +12,8 @@ var _constants = require("@mui/x-charts/constants");
12
12
  var _useId = _interopRequireDefault(require("@mui/utils/useId"));
13
13
  var _internals = require("@mui/x-charts/internals");
14
14
  var _warning = require("@mui/x-internals/warning");
15
- const _excluded = ["categoryAxis", "series", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "onItemClick", "highlightedItem", "onHighlightChange", "className", "hideLegend", "axisHighlight", "apiRef"];
15
+ var _colorPalettes = require("@mui/x-charts/colorPalettes");
16
+ const _excluded = ["categoryAxis", "series", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "onItemClick", "highlightedItem", "onHighlightChange", "className", "hideLegend", "axisHighlight", "apiRef", "gap"];
16
17
  function getCategoryAxisConfig(categoryAxis, series, isHorizontal, direction) {
17
18
  const maxSeriesLength = Math.max(...series.map(s => (s.data ?? []).length), 0);
18
19
  const maxSeriesValue = Array.from({
@@ -20,7 +21,7 @@ function getCategoryAxisConfig(categoryAxis, series, isHorizontal, direction) {
20
21
  }, (_, index) => series.reduce((a, s) => a + (s.data?.[index]?.value ?? 0), 0));
21
22
  if (process.env.NODE_ENV !== 'production') {
22
23
  if ((categoryAxis?.position === 'left' || categoryAxis?.position === 'right') && isHorizontal || (categoryAxis?.position === 'top' || categoryAxis?.position === 'bottom') && !isHorizontal) {
23
- (0, _warning.warnOnce)([`MUI X: the categoryAxis position is set to '${categoryAxis.position}' but the series layout is ${isHorizontal ? 'horizontal' : 'vertical'}.`, `Ensure that the categoryAxis position is set to '${isHorizontal ? 'top' : 'left'}' or '${isHorizontal ? 'bottom' : 'right'}' for ${isHorizontal ? 'horizontal' : 'vertical'} layout.\n`], 'warning');
24
+ (0, _warning.warnOnce)([`MUI X Charts: the categoryAxis position is set to '${categoryAxis.position}' but the series layout is ${isHorizontal ? 'horizontal' : 'vertical'}.`, `Ensure that the categoryAxis position is set to '${isHorizontal ? 'top' : 'left'}' or '${isHorizontal ? 'bottom' : 'right'}' for ${isHorizontal ? 'horizontal' : 'vertical'} layout.\n`], 'warning');
24
25
  }
25
26
  }
26
27
  const side = isHorizontal ? 'bottom' : 'left';
@@ -90,7 +91,8 @@ const useFunnelChartProps = props => {
90
91
  onHighlightChange,
91
92
  className,
92
93
  axisHighlight,
93
- apiRef
94
+ apiRef,
95
+ gap
94
96
  } = props,
95
97
  rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
96
98
  const margin = (0, _internals.defaultizeMargin)(marginProps, _constants.DEFAULT_MARGINS);
@@ -113,7 +115,7 @@ const useFunnelChartProps = props => {
113
115
  width,
114
116
  height,
115
117
  margin,
116
- colors,
118
+ colors: colors ?? _colorPalettes.strawberrySkyPalette,
117
119
  xAxis: [xAxis],
118
120
  yAxis: [yAxis],
119
121
  sx,
@@ -123,6 +125,7 @@ const useFunnelChartProps = props => {
123
125
  apiRef
124
126
  });
125
127
  const funnelPlotProps = {
128
+ gap,
126
129
  onItemClick,
127
130
  slots,
128
131
  slotProps
@@ -174,6 +174,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
174
174
  * @default false
175
175
  */
176
176
  loading: _propTypes.default.bool,
177
+ /**
178
+ * Localized text for chart components.
179
+ */
180
+ localeText: _propTypes.default.object,
177
181
  /**
178
182
  * The margin between the SVG and the drawing area.
179
183
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -190,7 +194,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
190
194
  * The function called for onClick events.
191
195
  * The second argument contains information about all line/bar elements at the current mouse position.
192
196
  * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
193
- * @param {null | AxisData} data The data about the clicked axis and items associated with it.
197
+ * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
194
198
  */
195
199
  onAxisClick: _propTypes.default.func,
196
200
  /**
@@ -21,7 +21,7 @@ const _excluded = ["seriesId", "dataIndex", "color", "value", "slotProps", "slot
21
21
  const HeatmapCell = (0, _styles.styled)('rect', {
22
22
  name: 'MuiHeatmap',
23
23
  slot: 'Cell',
24
- overridesResolver: (_, styles) => styles.arc
24
+ overridesResolver: (_, styles) => styles.arc // FIXME: Inconsistent naming with slot
25
25
  })(({
26
26
  ownerState
27
27
  }) => ({
@@ -96,6 +96,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
96
96
  // ----------------------------------------------------------------------
97
97
  apiRef: _propTypes.default.shape({
98
98
  current: _propTypes.default.shape({
99
+ exportAsImage: _propTypes.default.func.isRequired,
100
+ exportAsPrint: _propTypes.default.func.isRequired,
99
101
  setZoomData: _propTypes.default.func.isRequired
100
102
  })
101
103
  }),
@@ -172,6 +174,10 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
172
174
  * @default false
173
175
  */
174
176
  loading: _propTypes.default.bool,
177
+ /**
178
+ * Localized text for chart components.
179
+ */
180
+ localeText: _propTypes.default.object,
175
181
  /**
176
182
  * The margin between the SVG and the drawing area.
177
183
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -192,7 +198,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
192
198
  * The function called for onClick events.
193
199
  * The second argument contains information about all line/bar elements at the current mouse position.
194
200
  * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
195
- * @param {null | AxisData} data The data about the clicked axis and items associated with it.
201
+ * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
196
202
  */
197
203
  onAxisClick: _propTypes.default.func,
198
204
  /**
@@ -1,4 +1,5 @@
1
1
  import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
2
+ import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
2
3
  import { UseChartProZoomSignature } from "../internals/plugins/useChartProZoom/index.js";
3
- export type LineChartProPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProZoomSignature];
4
+ export type LineChartProPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProZoomSignature, UseChartProExportSignature];
4
5
  export declare const LINE_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<LineChartProPluginsSignatures>;
@@ -5,5 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.LINE_CHART_PRO_PLUGINS = void 0;
7
7
  var _internals = require("@mui/x-charts/internals");
8
+ var _useChartProExport = require("../internals/plugins/useChartProExport");
8
9
  var _useChartProZoom = require("../internals/plugins/useChartProZoom");
9
- const LINE_CHART_PRO_PLUGINS = exports.LINE_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _useChartProZoom.useChartProZoom];
10
+ const LINE_CHART_PRO_PLUGINS = exports.LINE_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport];
@@ -90,6 +90,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
90
90
  // ----------------------------------------------------------------------
91
91
  apiRef: _propTypes.default.shape({
92
92
  current: _propTypes.default.shape({
93
+ exportAsImage: _propTypes.default.func.isRequired,
94
+ exportAsPrint: _propTypes.default.func.isRequired,
93
95
  setZoomData: _propTypes.default.func.isRequired
94
96
  })
95
97
  }),
@@ -167,6 +169,10 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
167
169
  * @default false
168
170
  */
169
171
  loading: _propTypes.default.bool,
172
+ /**
173
+ * Localized text for chart components.
174
+ */
175
+ localeText: _propTypes.default.object,
170
176
  /**
171
177
  * The margin between the SVG and the drawing area.
172
178
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -183,7 +189,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
183
189
  * The function called for onClick events.
184
190
  * The second argument contains information about all line/bar elements at the current mouse position.
185
191
  * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
186
- * @param {null | AxisData} data The data about the clicked axis and items associated with it.
192
+ * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
187
193
  */
188
194
  onAxisClick: _propTypes.default.func,
189
195
  /**
@@ -1,4 +1,5 @@
1
1
  import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
2
+ import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
2
3
  import { UseChartProZoomSignature } from "../internals/plugins/useChartProZoom/index.js";
3
- export type ScatterChartProPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature, UseChartProZoomSignature];
4
+ export type ScatterChartProPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature, UseChartProZoomSignature, UseChartProExportSignature];
4
5
  export declare const SCATTER_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartProPluginsSignatures>;
@@ -5,5 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SCATTER_CHART_PRO_PLUGINS = void 0;
7
7
  var _internals = require("@mui/x-charts/internals");
8
+ var _useChartProExport = require("../internals/plugins/useChartProExport");
8
9
  var _useChartProZoom = require("../internals/plugins/useChartProZoom");
9
- const SCATTER_CHART_PRO_PLUGINS = exports.SCATTER_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _internals.useChartVoronoi, _useChartProZoom.useChartProZoom];
10
+ const SCATTER_CHART_PRO_PLUGINS = exports.SCATTER_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _internals.useChartVoronoi, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport];
@@ -84,6 +84,8 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
84
84
  // ----------------------------------------------------------------------
85
85
  apiRef: PropTypes.shape({
86
86
  current: PropTypes.shape({
87
+ exportAsImage: PropTypes.func.isRequired,
88
+ exportAsPrint: PropTypes.func.isRequired,
87
89
  setZoomData: PropTypes.func.isRequired
88
90
  })
89
91
  }),
@@ -174,6 +176,10 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
174
176
  * @default false
175
177
  */
176
178
  loading: PropTypes.bool,
179
+ /**
180
+ * Localized text for chart components.
181
+ */
182
+ localeText: PropTypes.object,
177
183
  /**
178
184
  * The margin between the SVG and the drawing area.
179
185
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -190,7 +196,7 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
190
196
  * The function called for onClick events.
191
197
  * The second argument contains information about all line/bar elements at the current mouse position.
192
198
  * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
193
- * @param {null | AxisData} data The data about the clicked axis and items associated with it.
199
+ * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
194
200
  */
195
201
  onAxisClick: PropTypes.func,
196
202
  /**
@@ -1,4 +1,5 @@
1
1
  import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
2
+ import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
2
3
  import { UseChartProZoomSignature } from "../internals/plugins/useChartProZoom/index.js";
3
- export type BarChartProPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'bar'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProZoomSignature];
4
+ export type BarChartProPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'bar'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProZoomSignature, UseChartProExportSignature];
4
5
  export declare const BAR_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<BarChartProPluginsSignatures>;
@@ -1,3 +1,4 @@
1
1
  import { useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight } from '@mui/x-charts/internals';
2
+ import { useChartProExport } from "../internals/plugins/useChartProExport/index.js";
2
3
  import { useChartProZoom } from "../internals/plugins/useChartProZoom/index.js";
3
- export const BAR_CHART_PRO_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartProZoom];
4
+ export const BAR_CHART_PRO_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartProZoom, useChartProExport];
@@ -7,6 +7,7 @@ export type ChartContainerProProps<TSeries extends ChartSeriesType = ChartSeries
7
7
  type ChartContainerProComponent = <TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartContainerProProps<TSeries, TSignatures> & {
8
8
  ref?: React.ForwardedRef<SVGSVGElement>;
9
9
  }) => React.JSX.Element;
10
+ export type ChartProApi = NonNullable<NonNullable<ChartContainerProProps['apiRef']>['current']>;
10
11
  /**
11
12
  * It sets up the data providers as well as the `<svg>` for the chart.
12
13
  *
@@ -1,7 +1,7 @@
1
1
  import { ChartAnyPluginSignature, ChartSeriesType, UseChartContainerPropsReturnValue } from '@mui/x-charts/internals';
2
2
  import * as React from 'react';
3
3
  import { ChartDataProviderProps } from '@mui/x-charts/ChartDataProvider';
4
- import type { ChartContainerProProps } from './ChartContainerPro';
4
+ import type { ChartContainerProProps } from "./ChartContainerPro.js";
5
5
  import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
6
6
  export type UseChartContainerProPropsReturnValue<TSeries extends ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[]> = Pick<UseChartContainerPropsReturnValue<TSeries, TSignatures>, 'chartsSurfaceProps' | 'children'> & {
7
7
  chartDataProviderProProps: ChartDataProviderProps<TSeries, TSignatures>;
@@ -5,11 +5,12 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { Watermark } from '@mui/x-license/Watermark';
7
7
  import { ChartProvider } from '@mui/x-charts/internals';
8
+ import { ChartsLocalizationProvider } from '@mui/x-charts/ChartsLocalizationProvider';
8
9
  import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
9
10
  import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
10
11
  import { useChartDataProviderProProps } from "./useChartDataProviderProProps.js";
11
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- const releaseInfo = "MTc0NDg0MDgwMDAwMA==";
13
+ const releaseInfo = "MTc0NjA0NjgwMDAwMA==";
13
14
  const packageIdentifier = 'x-charts-pro';
14
15
  /**
15
16
  * Orchestrates the data providers for the chart components and hooks.
@@ -41,13 +42,17 @@ const packageIdentifier = 'x-charts-pro';
41
42
  function ChartDataProviderPro(props) {
42
43
  const {
43
44
  children,
45
+ localeText,
44
46
  chartProviderProps
45
47
  } = useChartDataProviderProProps(_extends({}, props, {
46
48
  plugins: props.plugins ?? DEFAULT_PLUGINS
47
49
  }));
48
50
  useLicenseVerifier(packageIdentifier, releaseInfo);
49
51
  return /*#__PURE__*/_jsxs(ChartProvider, _extends({}, chartProviderProps, {
50
- children: [children, /*#__PURE__*/_jsx(Watermark, {
52
+ children: [/*#__PURE__*/_jsx(ChartsLocalizationProvider, {
53
+ localeText: localeText,
54
+ children: children
55
+ }), /*#__PURE__*/_jsx(Watermark, {
51
56
  packageName: packageIdentifier,
52
57
  releaseInfo: releaseInfo
53
58
  })]
@@ -79,6 +84,10 @@ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
79
84
  * If you don't provide this prop. It falls back to a randomly generated id.
80
85
  */
81
86
  id: PropTypes.string,
87
+ /**
88
+ * Localized text for chart components.
89
+ */
90
+ localeText: PropTypes.object,
82
91
  /**
83
92
  * The margin between the SVG and the drawing area.
84
93
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.