@mui/x-charts-pro 8.3.1 → 8.5.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 (206) hide show
  1. package/BarChartPro/BarChartPro.d.ts +13 -5
  2. package/BarChartPro/BarChartPro.js +56 -21
  3. package/CHANGELOG.md +213 -0
  4. package/ChartContainerPro/ChartContainerPro.d.ts +0 -1
  5. package/ChartContainerPro/ChartContainerPro.js +1 -0
  6. package/ChartContainerPro/ChartProApi.d.ts +26 -0
  7. package/ChartContainerPro/ChartProApi.js +5 -0
  8. package/ChartContainerPro/index.d.ts +2 -1
  9. package/ChartContainerPro/index.js +11 -0
  10. package/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
  11. package/ChartDataProviderPro/ChartDataProviderPro.js +19 -3
  12. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
  13. package/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
  14. package/ChartZoomSlider/index.d.ts +1 -1
  15. package/ChartZoomSlider/index.js +4 -4
  16. package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
  17. package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +31 -287
  18. package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
  19. package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +251 -0
  20. package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
  21. package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +92 -0
  22. package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
  23. package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +160 -0
  24. package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
  25. package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +58 -0
  26. package/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
  27. package/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +6 -6
  28. package/ChartZoomSlider/internals/constants.d.ts +5 -0
  29. package/ChartZoomSlider/internals/constants.js +11 -0
  30. package/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
  31. package/ChartZoomSlider/internals/zoom-utils.js +48 -0
  32. package/ChartsToolbarPro/ChartsToolbarPro.d.ts +8 -1
  33. package/ChartsToolbarPro/ChartsToolbarPro.js +42 -8
  34. package/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
  35. package/ChartsToolbarPro/ChartsToolbarZoomInButton.js +56 -0
  36. package/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
  37. package/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +56 -0
  38. package/ChartsToolbarPro/index.d.ts +3 -1
  39. package/ChartsToolbarPro/index.js +22 -0
  40. package/FunnelChart/FunnelChart.d.ts +2 -1
  41. package/FunnelChart/FunnelChart.js +6 -23
  42. package/FunnelChart/FunnelChart.plugins.d.ts +4 -0
  43. package/FunnelChart/FunnelChart.plugins.js +9 -0
  44. package/FunnelChart/FunnelPlot.js +2 -0
  45. package/FunnelChart/FunnelSection.js +2 -1
  46. package/FunnelChart/curves/curve.types.d.ts +4 -0
  47. package/FunnelChart/curves/pyramid.d.ts +3 -1
  48. package/FunnelChart/curves/pyramid.js +37 -10
  49. package/FunnelChart/curves/step-pyramid.d.ts +10 -2
  50. package/FunnelChart/curves/step-pyramid.js +96 -20
  51. package/FunnelChart/curves/step.d.ts +5 -1
  52. package/FunnelChart/curves/step.js +20 -2
  53. package/FunnelChart/funnel.types.d.ts +7 -0
  54. package/FunnelChart/funnelSlots.types.d.ts +4 -3
  55. package/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
  56. package/FunnelChart/useFunnelChartProps.d.ts +2 -1
  57. package/FunnelChart/useFunnelChartProps.js +3 -1
  58. package/Heatmap/Heatmap.d.ts +18 -5
  59. package/Heatmap/Heatmap.js +64 -26
  60. package/Heatmap/Heatmap.plugins.d.ts +2 -1
  61. package/Heatmap/Heatmap.plugins.js +2 -1
  62. package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
  63. package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +27 -0
  64. package/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
  65. package/Heatmap/HeatmapTooltip/HeatmapTooltip.js +4 -102
  66. package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
  67. package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +5 -0
  68. package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
  69. package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +96 -0
  70. package/Heatmap/HeatmapTooltip/index.d.ts +3 -1
  71. package/Heatmap/HeatmapTooltip/index.js +11 -0
  72. package/LineChartPro/LineChartPro.d.ts +13 -5
  73. package/LineChartPro/LineChartPro.js +56 -21
  74. package/RadarChartPro/RadarChartPro.d.ts +15 -0
  75. package/RadarChartPro/RadarChartPro.js +202 -0
  76. package/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
  77. package/RadarChartPro/RadarChartPro.plugins.js +9 -0
  78. package/RadarChartPro/index.d.ts +1 -0
  79. package/RadarChartPro/index.js +16 -0
  80. package/ScatterChartPro/ScatterChartPro.d.ts +13 -5
  81. package/ScatterChartPro/ScatterChartPro.js +57 -22
  82. package/context/index.d.ts +1 -0
  83. package/context/index.js +16 -0
  84. package/context/useChartApiContext.d.ts +9 -0
  85. package/context/useChartApiContext.js +17 -0
  86. package/esm/BarChartPro/BarChartPro.d.ts +13 -5
  87. package/esm/BarChartPro/BarChartPro.js +54 -19
  88. package/esm/ChartContainerPro/ChartContainerPro.d.ts +0 -1
  89. package/esm/ChartContainerPro/ChartContainerPro.js +1 -0
  90. package/esm/ChartContainerPro/ChartProApi.d.ts +26 -0
  91. package/esm/ChartContainerPro/ChartProApi.js +1 -0
  92. package/esm/ChartContainerPro/index.d.ts +2 -1
  93. package/esm/ChartContainerPro/index.js +2 -1
  94. package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
  95. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +20 -4
  96. package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
  97. package/esm/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
  98. package/esm/ChartZoomSlider/index.d.ts +1 -1
  99. package/esm/ChartZoomSlider/index.js +1 -1
  100. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
  101. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +30 -283
  102. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
  103. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +243 -0
  104. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
  105. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +85 -0
  106. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
  107. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +152 -0
  108. package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
  109. package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +52 -0
  110. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
  111. package/esm/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +4 -4
  112. package/esm/ChartZoomSlider/internals/constants.d.ts +5 -0
  113. package/esm/ChartZoomSlider/internals/constants.js +5 -0
  114. package/esm/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
  115. package/esm/ChartZoomSlider/internals/zoom-utils.js +40 -0
  116. package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +8 -1
  117. package/esm/ChartsToolbarPro/ChartsToolbarPro.js +42 -9
  118. package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
  119. package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.js +50 -0
  120. package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
  121. package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +50 -0
  122. package/esm/ChartsToolbarPro/index.d.ts +3 -1
  123. package/esm/ChartsToolbarPro/index.js +3 -1
  124. package/esm/FunnelChart/FunnelChart.d.ts +2 -1
  125. package/esm/FunnelChart/FunnelChart.js +6 -23
  126. package/esm/FunnelChart/FunnelChart.plugins.d.ts +4 -0
  127. package/esm/FunnelChart/FunnelChart.plugins.js +3 -0
  128. package/esm/FunnelChart/FunnelPlot.js +2 -0
  129. package/esm/FunnelChart/FunnelSection.js +1 -0
  130. package/esm/FunnelChart/curves/curve.types.d.ts +4 -0
  131. package/esm/FunnelChart/curves/pyramid.d.ts +3 -1
  132. package/esm/FunnelChart/curves/pyramid.js +37 -10
  133. package/esm/FunnelChart/curves/step-pyramid.d.ts +10 -2
  134. package/esm/FunnelChart/curves/step-pyramid.js +96 -20
  135. package/esm/FunnelChart/curves/step.d.ts +5 -1
  136. package/esm/FunnelChart/curves/step.js +20 -2
  137. package/esm/FunnelChart/funnel.types.d.ts +7 -0
  138. package/esm/FunnelChart/funnelSlots.types.d.ts +4 -3
  139. package/esm/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
  140. package/esm/FunnelChart/useFunnelChartProps.d.ts +2 -1
  141. package/esm/FunnelChart/useFunnelChartProps.js +3 -1
  142. package/esm/Heatmap/Heatmap.d.ts +18 -5
  143. package/esm/Heatmap/Heatmap.js +62 -24
  144. package/esm/Heatmap/Heatmap.plugins.d.ts +2 -1
  145. package/esm/Heatmap/Heatmap.plugins.js +2 -1
  146. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
  147. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +19 -0
  148. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
  149. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.js +5 -103
  150. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
  151. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +1 -0
  152. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
  153. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +89 -0
  154. package/esm/Heatmap/HeatmapTooltip/index.d.ts +3 -1
  155. package/esm/Heatmap/HeatmapTooltip/index.js +3 -1
  156. package/esm/LineChartPro/LineChartPro.d.ts +13 -5
  157. package/esm/LineChartPro/LineChartPro.js +54 -19
  158. package/esm/RadarChartPro/RadarChartPro.d.ts +15 -0
  159. package/esm/RadarChartPro/RadarChartPro.js +195 -0
  160. package/esm/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
  161. package/esm/RadarChartPro/RadarChartPro.plugins.js +3 -0
  162. package/esm/RadarChartPro/index.d.ts +1 -0
  163. package/esm/RadarChartPro/index.js +1 -0
  164. package/esm/ScatterChartPro/ScatterChartPro.d.ts +13 -5
  165. package/esm/ScatterChartPro/ScatterChartPro.js +55 -20
  166. package/esm/context/index.d.ts +1 -0
  167. package/esm/context/index.js +1 -0
  168. package/esm/context/useChartApiContext.d.ts +9 -0
  169. package/esm/context/useChartApiContext.js +11 -0
  170. package/esm/hooks/index.d.ts +2 -1
  171. package/esm/hooks/index.js +2 -1
  172. package/esm/index.d.ts +2 -1
  173. package/esm/index.js +2 -1
  174. package/esm/internals/material/index.d.ts +1 -0
  175. package/esm/internals/plugins/useChartProExport/exportImage.js +1 -1
  176. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
  177. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
  178. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +15 -1
  179. package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
  180. package/esm/models/index.d.ts +1 -1
  181. package/hooks/index.d.ts +2 -1
  182. package/hooks/index.js +21 -10
  183. package/index.d.ts +2 -1
  184. package/index.js +12 -1
  185. package/internals/material/index.d.ts +1 -0
  186. package/internals/plugins/useChartProExport/exportImage.js +1 -1
  187. package/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
  188. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
  189. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +16 -2
  190. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
  191. package/models/index.d.ts +1 -1
  192. package/package.json +5 -5
  193. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
  194. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -92
  195. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
  196. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
  197. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -36
  198. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
  199. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -36
  200. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
  201. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -85
  202. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
  203. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
  204. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -29
  205. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
  206. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -29
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.ChartsToolbarZoomOutButton = void 0;
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
+ var React = _interopRequireWildcard(require("react"));
13
+ var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _internals = require("@mui/x-charts/internals");
15
+ var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
16
+ var _useChartProZoom = require("../internals/plugins/useChartProZoom");
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
+ const _excluded = ["render"];
19
+ /**
20
+ * The zoom-out button for the chart toolbar.
21
+ */
22
+ const ChartsToolbarZoomOutButton = exports.ChartsToolbarZoomOutButton = /*#__PURE__*/React.forwardRef(function ChartsToolbarZoomOutButton(_ref, ref) {
23
+ let {
24
+ render
25
+ } = _ref,
26
+ other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
27
+ const {
28
+ slots,
29
+ slotProps
30
+ } = (0, _internals.useChartsSlots)();
31
+ const {
32
+ instance,
33
+ store
34
+ } = (0, _internals.useChartContext)();
35
+ const disabled = (0, _internals.useSelector)(store, _useChartProZoom.selectorChartCanZoomOut);
36
+ const element = (0, _useComponentRenderer.useComponentRenderer)(slots.baseIconButton, render, (0, _extends2.default)({}, slotProps?.baseIconButton, {
37
+ onClick: () => instance.zoomOut(),
38
+ disabled
39
+ }, other, {
40
+ ref
41
+ }));
42
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
43
+ children: element
44
+ });
45
+ });
46
+ if (process.env.NODE_ENV !== "production") ChartsToolbarZoomOutButton.displayName = "ChartsToolbarZoomOutButton";
47
+ process.env.NODE_ENV !== "production" ? ChartsToolbarZoomOutButton.propTypes = {
48
+ // ----------------------------- Warning --------------------------------
49
+ // | These PropTypes are generated from the TypeScript type definitions |
50
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
51
+ // ----------------------------------------------------------------------
52
+ /**
53
+ * A function to customize the rendering of the component.
54
+ */
55
+ render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func])
56
+ } : void 0;
@@ -1 +1,3 @@
1
- export * from "./ChartsToolbarPro.js";
1
+ export * from "./ChartsToolbarPro.js";
2
+ export * from "./ChartsToolbarZoomInButton.js";
3
+ export * from "./ChartsToolbarZoomOutButton.js";
@@ -13,4 +13,26 @@ Object.keys(_ChartsToolbarPro).forEach(function (key) {
13
13
  return _ChartsToolbarPro[key];
14
14
  }
15
15
  });
16
+ });
17
+ var _ChartsToolbarZoomInButton = require("./ChartsToolbarZoomInButton");
18
+ Object.keys(_ChartsToolbarZoomInButton).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _ChartsToolbarZoomInButton[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _ChartsToolbarZoomInButton[key];
25
+ }
26
+ });
27
+ });
28
+ var _ChartsToolbarZoomOutButton = require("./ChartsToolbarZoomOutButton");
29
+ Object.keys(_ChartsToolbarZoomOutButton).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _ChartsToolbarZoomOutButton[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _ChartsToolbarZoomOutButton[key];
36
+ }
37
+ });
16
38
  });
@@ -7,7 +7,8 @@ import { FunnelSeriesType } from "./funnel.types.js";
7
7
  import { ChartContainerProProps } from "../ChartContainerPro/index.js";
8
8
  import { FunnelChartSlotExtension } from "./funnelSlots.types.js";
9
9
  import { CategoryAxis } from "./categoryAxis.types.js";
10
- export interface FunnelChartProps extends Omit<ChartContainerProProps<'funnel'>, 'series' | 'plugins' | 'zAxis' | 'zoom' | 'onZoomChange' | 'dataset' | 'yAxis' | 'xAxis' | 'rotationAxis' | 'radiusAxis'>, Omit<FunnelPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, FunnelChartSlotExtension {
10
+ import { FunnelChartPluginsSignatures } from "./FunnelChart.plugins.js";
11
+ export interface FunnelChartProps extends Omit<ChartContainerProProps<'funnel', FunnelChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis' | 'zoom' | 'onZoomChange' | 'dataset' | 'yAxis' | 'xAxis' | 'rotationAxis' | 'radiusAxis' | 'slots' | 'slotProps'>, Omit<FunnelPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, FunnelChartSlotExtension {
11
12
  /**
12
13
  * The series to display in the funnel chart.
13
14
  * An array of [[FunnelSeriesType]] objects.
@@ -51,13 +51,14 @@ const FunnelChart = exports.FunnelChart = /*#__PURE__*/React.forwardRef(function
51
51
  seriesConfig: seriesConfig,
52
52
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_internals.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
53
53
  children: [!themedProps.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
54
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FunnelPlot.FunnelPlot, (0, _extends2.default)({}, funnelPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), !themedProps.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, themedProps.slotProps?.tooltip, {
55
- trigger: "item"
56
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), children]
54
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FunnelPlot.FunnelPlot, (0, _extends2.default)({}, funnelPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), children]
55
+ })), !themedProps.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, themedProps.slotProps?.tooltip, {
56
+ trigger: "item"
57
57
  }))]
58
58
  }))
59
59
  }));
60
60
  });
61
+ if (process.env.NODE_ENV !== "production") FunnelChart.displayName = "FunnelChart";
61
62
  process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
62
63
  // ----------------------------- Warning --------------------------------
63
64
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -66,8 +67,7 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
66
67
  apiRef: _propTypes.default.shape({
67
68
  current: _propTypes.default.shape({
68
69
  exportAsImage: _propTypes.default.func.isRequired,
69
- exportAsPrint: _propTypes.default.func.isRequired,
70
- setZoomData: _propTypes.default.func.isRequired
70
+ exportAsPrint: _propTypes.default.func.isRequired
71
71
  })
72
72
  }),
73
73
  /**
@@ -206,15 +206,6 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
206
206
  * If you don't provide this prop. It falls back to a randomly generated id.
207
207
  */
208
208
  id: _propTypes.default.string,
209
- /**
210
- * The list of zoom data related to each axis.
211
- * Used to initialize the zoom in a specific configuration without controlling it.
212
- */
213
- initialZoom: _propTypes.default.arrayOf(_propTypes.default.shape({
214
- axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
215
- end: _propTypes.default.number.isRequired,
216
- start: _propTypes.default.number.isRequired
217
- })),
218
209
  /**
219
210
  * If `true`, a loading overlay is displayed.
220
211
  * @default false
@@ -281,13 +272,5 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
281
272
  /**
282
273
  * The width of the chart in px. If not defined, it takes the width of the parent element.
283
274
  */
284
- width: _propTypes.default.number,
285
- /**
286
- * The list of zoom data related to each axis.
287
- */
288
- zoomData: _propTypes.default.arrayOf(_propTypes.default.shape({
289
- axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
290
- end: _propTypes.default.number.isRequired,
291
- start: _propTypes.default.number.isRequired
292
- }))
275
+ width: _propTypes.default.number
293
276
  } : void 0;
@@ -0,0 +1,4 @@
1
+ import { ConvertSignaturesIntoPlugins, UseChartCartesianAxisSignature, UseChartHighlightSignature, UseChartInteractionSignature } from '@mui/x-charts/internals';
2
+ import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
3
+ export type FunnelChartPluginsSignatures = [UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProExportSignature];
4
+ export declare const FUNNEL_CHART_PLUGINS: ConvertSignaturesIntoPlugins<FunnelChartPluginsSignatures>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FUNNEL_CHART_PLUGINS = void 0;
7
+ var _internals = require("@mui/x-charts/internals");
8
+ var _useChartProExport = require("../internals/plugins/useChartProExport");
9
+ const FUNNEL_CHART_PLUGINS = exports.FUNNEL_CHART_PLUGINS = [_internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _useChartProExport.useChartProExport];
@@ -86,12 +86,14 @@ const useAggregatedData = gap => {
86
86
  seriesId,
87
87
  value: currentSeries.data[dataIndex].value
88
88
  }) : currentSeries.sectionLabel;
89
+ const isIncreasing = currentSeries.dataDirection === 'increasing';
89
90
  const curve = (0, _curves.getFunnelCurve)(currentSeries.curve, {
90
91
  isHorizontal,
91
92
  gap,
92
93
  position: dataIndex,
93
94
  sections: currentSeries.dataPoints.length,
94
95
  borderRadius: currentSeries.borderRadius,
96
+ isIncreasing,
95
97
  min: minPoint,
96
98
  max: maxPoint
97
99
  });
@@ -64,4 +64,5 @@ const FunnelSection = exports.FunnelSection = (0, _internals.consumeSlots)('MuiF
64
64
  }, other, {
65
65
  ref: ref
66
66
  }));
67
- }));
67
+ }));
68
+ if (process.env.NODE_ENV !== "production") FunnelSection.displayName = "FunnelSection";
@@ -8,6 +8,10 @@ export type CurveOptions = {
8
8
  * Indicates if the main axis of the visualization.
9
9
  */
10
10
  isHorizontal?: boolean;
11
+ /**
12
+ * Indicates if the segments values are increasing or decreasing.
13
+ */
14
+ isIncreasing?: boolean;
11
15
  /**
12
16
  * The order position of the segment.
13
17
  */
@@ -11,6 +11,7 @@ export declare class Pyramid implements CurveGenerator {
11
11
  private position;
12
12
  private sections;
13
13
  private isHorizontal;
14
+ private isIncreasing;
14
15
  private gap;
15
16
  private borderRadius;
16
17
  private min;
@@ -23,7 +24,8 @@ export declare class Pyramid implements CurveGenerator {
23
24
  sections,
24
25
  borderRadius,
25
26
  min,
26
- max
27
+ max,
28
+ isIncreasing
27
29
  }: CurveOptions);
28
30
  areaStart(): void;
29
31
  areaEnd(): void;
@@ -22,12 +22,14 @@ class Pyramid {
22
22
  sections,
23
23
  borderRadius,
24
24
  min,
25
- max
25
+ max,
26
+ isIncreasing
26
27
  }) {
27
28
  this.context = void 0;
28
29
  this.position = 0;
29
30
  this.sections = 0;
30
31
  this.isHorizontal = false;
32
+ this.isIncreasing = false;
31
33
  this.gap = 0;
32
34
  this.borderRadius = 0;
33
35
  this.min = {
@@ -45,6 +47,7 @@ class Pyramid {
45
47
  this.position = position ?? 0;
46
48
  this.sections = sections ?? 1;
47
49
  this.borderRadius = borderRadius ?? 0;
50
+ this.isIncreasing = isIncreasing ?? false;
48
51
  this.min = min ?? {
49
52
  x: 0,
50
53
  y: 0
@@ -53,6 +56,12 @@ class Pyramid {
53
56
  x: 0,
54
57
  y: 0
55
58
  };
59
+ if (isIncreasing) {
60
+ const currentMin = this.min;
61
+ const currentMax = this.max;
62
+ this.min = currentMax;
63
+ this.max = currentMin;
64
+ }
56
65
  }
57
66
  areaStart() {}
58
67
  areaEnd() {}
@@ -62,14 +71,25 @@ class Pyramid {
62
71
  if (this.gap > 0) {
63
72
  return this.borderRadius;
64
73
  }
65
- if (this.position === 0) {
66
- return [0, 0, this.borderRadius, this.borderRadius];
67
- }
68
- if (this.position === this.sections - 1 && this.gap <= 0) {
69
- return [this.borderRadius];
74
+ if (this.isIncreasing) {
75
+ // Is largest section
76
+ if (this.position === this.sections - 1) {
77
+ return [this.borderRadius, this.borderRadius];
78
+ }
79
+ // Is smallest section and shaped like a triangle
80
+ if (this.position === 0) {
81
+ return [0, 0, this.borderRadius];
82
+ }
70
83
  }
71
- if (this.position === this.sections - 1) {
72
- return [this.borderRadius, this.borderRadius];
84
+ if (!this.isIncreasing) {
85
+ // Is largest section
86
+ if (this.position === 0) {
87
+ return [0, 0, this.borderRadius, this.borderRadius];
88
+ }
89
+ // Is smallest section and shaped like a triangle
90
+ if (this.position === this.sections - 1) {
91
+ return [this.borderRadius];
92
+ }
73
93
  }
74
94
  return 0;
75
95
  }
@@ -118,8 +138,15 @@ class Pyramid {
118
138
 
119
139
  // In the last section, to form a triangle we need 3 points instead of 4
120
140
  // Else the algorithm will break.
121
- if (this.position === this.sections - 1 && this.gap <= 0) {
122
- this.points = [this.points[0], this.points[1], this.points[3]];
141
+ const isLastSection = this.position === this.sections - 1;
142
+ const isFirstSection = this.position === 0;
143
+ if (this.gap <= 0) {
144
+ if (isFirstSection && this.isIncreasing) {
145
+ this.points = [this.points[0], this.points[1], this.points[2]];
146
+ }
147
+ if (isLastSection && !this.isIncreasing) {
148
+ this.points = [this.points[0], this.points[1], this.points[3]];
149
+ }
123
150
  }
124
151
  (0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
125
152
  }
@@ -1,5 +1,5 @@
1
1
  import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
- import { CurveOptions } from "./curve.types.js";
2
+ import { CurveOptions, Point } from "./curve.types.js";
3
3
  /**
4
4
  * This is a custom "step-pyramid" curve generator.
5
5
  * It creates a step pyramid, which is a step-like shape with static lengths.
@@ -8,7 +8,9 @@ import { CurveOptions } from "./curve.types.js";
8
8
  export declare class StepPyramid implements CurveGenerator {
9
9
  private context;
10
10
  private position;
11
+ private sections;
11
12
  private isHorizontal;
13
+ private isIncreasing;
12
14
  private gap;
13
15
  private borderRadius;
14
16
  private min;
@@ -18,14 +20,20 @@ export declare class StepPyramid implements CurveGenerator {
18
20
  isHorizontal,
19
21
  gap,
20
22
  position,
23
+ sections,
21
24
  borderRadius,
22
25
  min,
23
- max
26
+ max,
27
+ isIncreasing
24
28
  }: CurveOptions);
25
29
  areaStart(): void;
26
30
  areaEnd(): void;
27
31
  lineStart(): void;
28
32
  lineEnd(): void;
29
33
  protected getBorderRadius(): number | number[];
34
+ slopeStart(index: number): Point;
35
+ slopeEnd(index: number): Point;
36
+ initialX(index: number): number;
37
+ initialY(index: number): number;
30
38
  point(xIn: number, yIn: number): void;
31
39
  }
@@ -18,13 +18,17 @@ class StepPyramid {
18
18
  isHorizontal,
19
19
  gap,
20
20
  position,
21
+ sections,
21
22
  borderRadius,
22
23
  min,
23
- max
24
+ max,
25
+ isIncreasing
24
26
  }) {
25
27
  this.context = void 0;
26
28
  this.position = 0;
29
+ this.sections = 0;
27
30
  this.isHorizontal = false;
31
+ this.isIncreasing = false;
28
32
  this.gap = 0;
29
33
  this.borderRadius = 0;
30
34
  this.min = {
@@ -40,7 +44,9 @@ class StepPyramid {
40
44
  this.isHorizontal = isHorizontal ?? false;
41
45
  this.gap = (gap ?? 0) / 2;
42
46
  this.position = position ?? 0;
47
+ this.sections = sections ?? 1;
43
48
  this.borderRadius = borderRadius ?? 0;
49
+ this.isIncreasing = isIncreasing ?? false;
44
50
  this.min = min ?? {
45
51
  x: 0,
46
52
  y: 0
@@ -55,7 +61,91 @@ class StepPyramid {
55
61
  lineStart() {}
56
62
  lineEnd() {}
57
63
  getBorderRadius() {
58
- return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
64
+ if (this.gap > 0) {
65
+ return this.borderRadius;
66
+ }
67
+ if (this.isIncreasing) {
68
+ if (this.position === this.sections - 1) {
69
+ return this.borderRadius;
70
+ }
71
+ return [0, 0, this.borderRadius, this.borderRadius];
72
+ }
73
+ if (this.position === 0) {
74
+ return this.borderRadius;
75
+ }
76
+ return [this.borderRadius, this.borderRadius];
77
+ }
78
+ slopeStart(index) {
79
+ if (this.isIncreasing) {
80
+ if (this.isHorizontal) {
81
+ return {
82
+ x: this.min.x,
83
+ y: (this.min.y + this.max.y) / 2
84
+ };
85
+ }
86
+ return {
87
+ x: (this.min.x + this.max.x) / 2,
88
+ y: this.min.y
89
+ };
90
+ }
91
+ if (this.isHorizontal) {
92
+ if (index <= 1) {
93
+ return this.min;
94
+ }
95
+ return {
96
+ x: this.min.x,
97
+ y: this.max.y
98
+ };
99
+ }
100
+ if (index <= 1) {
101
+ return {
102
+ x: this.max.x,
103
+ y: this.min.y
104
+ };
105
+ }
106
+ return this.min;
107
+ }
108
+ slopeEnd(index) {
109
+ if (this.isIncreasing) {
110
+ if (this.isHorizontal) {
111
+ if (index <= 1) {
112
+ return {
113
+ x: this.max.x,
114
+ y: this.min.y
115
+ };
116
+ }
117
+ return this.max;
118
+ }
119
+ if (index <= 1) {
120
+ return this.max;
121
+ }
122
+ return {
123
+ x: this.min.x,
124
+ y: this.max.y
125
+ };
126
+ }
127
+ if (this.isHorizontal) {
128
+ return {
129
+ x: this.max.x,
130
+ y: (this.max.y + this.min.y) / 2
131
+ };
132
+ }
133
+ return {
134
+ x: (this.max.x + this.min.x) / 2,
135
+ y: this.max.y
136
+ };
137
+ }
138
+ initialX(index) {
139
+ if (this.isIncreasing) {
140
+ return index === 0 || index === 1 ? this.points.at(1).x : this.points.at(2).x;
141
+ }
142
+ return index === 0 || index === 1 ? this.points.at(0).x : this.points.at(3).x;
143
+ }
144
+ initialY(index) {
145
+ if (this.isIncreasing) {
146
+ return index === 0 || index === 1 ? this.points.at(1).y : this.points.at(2).y;
147
+ }
148
+ return index === 0 || index === 1 ? this.points.at(0).y : this.points.at(3).y;
59
149
  }
60
150
  point(xIn, yIn) {
61
151
  this.points.push({
@@ -68,34 +158,20 @@ class StepPyramid {
68
158
 
69
159
  // Add gaps where they are needed.
70
160
  this.points = this.points.map((point, index) => {
161
+ const slopeStart = this.slopeStart(index);
162
+ const slopeEnd = this.slopeEnd(index);
71
163
  if (this.isHorizontal) {
72
- const slopeEnd = {
73
- x: this.max.x,
74
- y: (this.max.y + this.min.y) / 2
75
- };
76
- const slopeStart = index <= 1 ? this.min : {
77
- x: this.min.x,
78
- y: this.max.y
79
- };
80
164
  const yGetter = (0, _utils.lerpY)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
81
165
  const xGap = point.x + (index === 0 || index === 3 ? this.gap : -this.gap);
82
- const xInitial = index === 0 || index === 1 ? this.points.at(0).x : this.points.at(3).x;
166
+ const xInitial = this.initialX(index);
83
167
  return {
84
168
  x: xGap,
85
169
  y: yGetter(xInitial)
86
170
  };
87
171
  }
88
- const slopeEnd = {
89
- x: (this.max.x + this.min.x) / 2,
90
- y: this.max.y
91
- };
92
- const slopeStart = index <= 1 ? {
93
- x: this.max.x,
94
- y: this.min.y
95
- } : this.min;
96
172
  const xGetter = (0, _utils.lerpX)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
97
173
  const yGap = point.y + (index === 0 || index === 3 ? this.gap : -this.gap);
98
- const yInitial = index === 0 || index === 1 ? this.points.at(0).y : this.points.at(3).y;
174
+ const yInitial = this.initialY(index);
99
175
  return {
100
176
  x: xGetter(yInitial),
101
177
  y: yGap
@@ -13,15 +13,19 @@ import { CurveOptions } from "./curve.types.js";
13
13
  export declare class Step implements CurveGenerator {
14
14
  private context;
15
15
  private isHorizontal;
16
+ private isIncreasing;
16
17
  private gap;
17
18
  private borderRadius;
18
19
  private position;
20
+ private sections;
19
21
  private points;
20
22
  constructor(context: CanvasRenderingContext2D, {
21
23
  isHorizontal,
22
24
  gap,
23
25
  position,
24
- borderRadius
26
+ borderRadius,
27
+ isIncreasing,
28
+ sections
25
29
  }: CurveOptions);
26
30
  areaStart(): void;
27
31
  areaEnd(): void;
@@ -23,26 +23,44 @@ class Step {
23
23
  isHorizontal,
24
24
  gap,
25
25
  position,
26
- borderRadius
26
+ borderRadius,
27
+ isIncreasing,
28
+ sections
27
29
  }) {
28
30
  this.context = void 0;
29
31
  this.isHorizontal = false;
32
+ this.isIncreasing = false;
30
33
  this.gap = 0;
31
34
  this.borderRadius = 0;
32
35
  this.position = 0;
36
+ this.sections = 0;
33
37
  this.points = [];
34
38
  this.context = context;
35
39
  this.isHorizontal = isHorizontal ?? false;
36
40
  this.gap = (gap ?? 0) / 2;
37
41
  this.position = position ?? 0;
42
+ this.sections = sections ?? 1;
38
43
  this.borderRadius = borderRadius ?? 0;
44
+ this.isIncreasing = isIncreasing ?? false;
39
45
  }
40
46
  areaStart() {}
41
47
  areaEnd() {}
42
48
  lineStart() {}
43
49
  lineEnd() {}
44
50
  getBorderRadius() {
45
- return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
51
+ if (this.gap > 0) {
52
+ return this.borderRadius;
53
+ }
54
+ if (this.isIncreasing) {
55
+ if (this.position === this.sections - 1) {
56
+ return this.borderRadius;
57
+ }
58
+ return [0, 0, this.borderRadius, this.borderRadius];
59
+ }
60
+ if (this.position === 0) {
61
+ return this.borderRadius;
62
+ }
63
+ return [this.borderRadius, this.borderRadius];
46
64
  }
47
65
  point(xIn, yIn) {
48
66
  this.points.push({
@@ -110,6 +110,13 @@ export type FunnelItem = {
110
110
  export interface DefaultizedFunnelSeriesType extends DefaultizedProps<FunnelSeriesType, CommonDefaultizedProps | 'layout'> {
111
111
  dataPoints: FunnelDataPoints[][];
112
112
  data: Readonly<MakeRequired<FunnelValueType, 'id' | 'color'>[]>;
113
+ /**
114
+ * Denotes if the data is increasing, first data point is less than the last data point.
115
+ * While the data is decreasing if the first data point is greater than the last data point.
116
+ *
117
+ * This is used to determine the direction of the funnel.
118
+ */
119
+ dataDirection: 'increasing' | 'decreasing';
113
120
  }
114
121
  export type FunnelDataPoints = Record<'x' | 'y', number> & {
115
122
  useBandWidth: boolean;
@@ -1,10 +1,11 @@
1
1
  import { ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
2
2
  import { ChartsTooltipSlotProps, ChartsTooltipSlots } from '@mui/x-charts/ChartsTooltip';
3
- import { ChartsAxisSlotProps, ChartsAxisSlots } from '@mui/x-charts/internals';
3
+ import { ChartsAxisSlotProps, ChartsAxisSlots, ChartsSlotProps, ChartsSlots } from '@mui/x-charts/internals';
4
4
  import { ChartsLegendSlotProps, ChartsLegendSlots } from '@mui/x-charts/ChartsLegend';
5
+ import { ChartsToolbarSlotProps, ChartsToolbarSlots } from '@mui/x-charts/Toolbar';
5
6
  import { FunnelPlotSlotProps, FunnelPlotSlots } from "./funnelPlotSlots.types.js";
6
- export interface FunnelChartSlots extends ChartsAxisSlots, FunnelPlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots, ChartsAxisSlots {}
7
- export interface FunnelChartSlotProps extends ChartsAxisSlotProps, FunnelPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsAxisSlotProps {}
7
+ export interface FunnelChartSlots extends ChartsAxisSlots, FunnelPlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots, ChartsAxisSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
8
+ export interface FunnelChartSlotProps extends ChartsAxisSlotProps, FunnelPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsAxisSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
8
9
  export interface FunnelChartSlotExtension {
9
10
  /**
10
11
  * Overridable component slots.