@mui/x-charts-pro 8.6.0 → 8.7.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 (78) hide show
  1. package/CHANGELOG.md +104 -1
  2. package/ChartContainerPro/index.d.ts +7 -1
  3. package/ChartContainerPro/index.js +0 -11
  4. package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  5. package/ChartZoomSlider/index.d.ts +2 -1
  6. package/ChartZoomSlider/index.js +10 -2
  7. package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +4 -0
  8. package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +7 -1
  9. package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +9 -1
  10. package/ChartZoomSlider/internals/chartAxisZoomSliderTrackClasses.d.ts +15 -0
  11. package/ChartZoomSlider/internals/chartAxisZoomSliderTrackClasses.js +31 -0
  12. package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +1 -1
  13. package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +1 -1
  14. package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +43 -33
  15. package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
  16. package/{ChartContainerPro → context}/ChartProApi.d.ts +2 -3
  17. package/context/index.d.ts +2 -1
  18. package/context/index.js +4 -4
  19. package/context/useChartProApiContext.d.ts +9 -0
  20. package/context/{useChartApiContext.js → useChartProApiContext.js} +4 -4
  21. package/esm/ChartContainerPro/index.d.ts +7 -1
  22. package/esm/ChartContainerPro/index.js +4 -1
  23. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  24. package/esm/ChartZoomSlider/index.d.ts +2 -1
  25. package/esm/ChartZoomSlider/index.js +2 -1
  26. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +4 -0
  27. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +8 -1
  28. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +10 -1
  29. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderTrackClasses.d.ts +15 -0
  30. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderTrackClasses.js +21 -0
  31. package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +2 -2
  32. package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +2 -2
  33. package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +43 -33
  34. package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
  35. package/esm/{ChartContainerPro → context}/ChartProApi.d.ts +2 -3
  36. package/esm/context/index.d.ts +2 -1
  37. package/esm/context/index.js +2 -1
  38. package/esm/context/useChartProApiContext.d.ts +9 -0
  39. package/esm/context/{useChartApiContext.js → useChartProApiContext.js} +3 -3
  40. package/esm/hooks/index.d.ts +2 -1
  41. package/esm/hooks/index.js +2 -1
  42. package/esm/hooks/useChartProApiRef.d.ts +23 -0
  43. package/esm/hooks/useChartProApiRef.js +20 -0
  44. package/esm/index.d.ts +4 -2
  45. package/esm/index.js +3 -3
  46. package/esm/internals/plugins/allPlugins.d.ts +2 -2
  47. package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +8 -0
  48. package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +58 -0
  49. package/esm/internals/plugins/useChartProZoom/{useChartProZoom.utils.d.ts → gestureHooks/useZoom.utils.d.ts} +14 -10
  50. package/esm/internals/plugins/useChartProZoom/{useChartProZoom.utils.js → gestureHooks/useZoom.utils.js} +41 -31
  51. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +8 -0
  52. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +59 -0
  53. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +8 -0
  54. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +79 -0
  55. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +15 -227
  56. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
  57. package/hooks/index.d.ts +2 -1
  58. package/hooks/index.js +11 -0
  59. package/hooks/useChartProApiRef.d.ts +23 -0
  60. package/hooks/useChartProApiRef.js +28 -0
  61. package/index.d.ts +4 -2
  62. package/index.js +58 -22
  63. package/internals/plugins/allPlugins.d.ts +2 -2
  64. package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +8 -0
  65. package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +65 -0
  66. package/internals/plugins/useChartProZoom/{useChartProZoom.utils.d.ts → gestureHooks/useZoom.utils.d.ts} +14 -10
  67. package/internals/plugins/useChartProZoom/{useChartProZoom.utils.js → gestureHooks/useZoom.utils.js} +43 -34
  68. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +8 -0
  69. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +66 -0
  70. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +8 -0
  71. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +86 -0
  72. package/internals/plugins/useChartProZoom/useChartProZoom.js +14 -226
  73. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
  74. package/package.json +5 -4
  75. package/context/useChartApiContext.d.ts +0 -9
  76. package/esm/context/useChartApiContext.d.ts +0 -9
  77. /package/{ChartContainerPro → context}/ChartProApi.js +0 -0
  78. /package/esm/{ChartContainerPro → context}/ChartProApi.js +0 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,109 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.7.0
9
+
10
+ _Jul 4, 2025_
11
+
12
+ We'd like to extend a big thank you to the 15 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 📊 Add `useChartProApiRef` for easier access to the API
15
+ - 📆 Support different start and end `referenceDate` props on range components
16
+ - 📚 Documentation improvements
17
+ - 🐞 Bugfixes
18
+ - 🌎 Improve Greek (el-GR) translations on the Charts
19
+ - 🌎 Improve Danish (da-DK) locale on the Data Grid
20
+
21
+ Special thanks go out to the community members for their valuable contributions:
22
+ @ShahrazH, @vadimkuragkovskiy, @whythecode
23
+
24
+ The following are all team members who have contributed to this release:
25
+ @alexfauquette, @brijeshb42, @mapache-salvaje, @arminmeh, @bernardobelchior, @bharatkashyap, @Janpot, @JCQuintas, @KenanYusuf, @LukasTy, @michelengelen, @rita-codes
26
+
27
+ ### Data Grid
28
+
29
+ #### `@mui/x-data-grid@8.7.0`
30
+
31
+ - [DataGrid] Fix column state restore with controlled column visibility model (#18567) @arminmeh
32
+ - [DataGrid] Fix styling virtualized column headers (#18603) @KenanYusuf
33
+ - [l10n] Improve Danish (da-DK) locale (#18537) @ShahrazH
34
+
35
+ #### `@mui/x-data-grid-pro@8.7.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
36
+
37
+ Same changes as in `@mui/x-data-grid@8.7.0`.
38
+
39
+ #### `@mui/x-data-grid-premium@8.7.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
40
+
41
+ Same changes as in `@mui/x-data-grid-pro@8.7.0`.
42
+
43
+ ### Date and Time Pickers
44
+
45
+ #### `@mui/x-date-pickers@8.7.0`
46
+
47
+ - [pickers] Support different `start` and `end` `referenceDate` props on range components (#18549) @LukasTy
48
+
49
+ #### `@mui/x-date-pickers-pro@8.7.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
50
+
51
+ Same changes as in `@mui/x-date-pickers@8.7.0`.
52
+
53
+ ### Charts
54
+
55
+ #### `@mui/x-charts@8.7.0`
56
+
57
+ - [charts] Export `ChartsReferenceLineProps` (#18598) @bernardobelchior
58
+ - [charts] Extract bar and line plot logic into reusable hooks (#18541) @bernardobelchior
59
+ - [charts] Extract plot logic into separate files for reuse (#18522) @bernardobelchior
60
+ - [charts] Profile charts benchmarks using chromium (#18528) @bernardobelchior
61
+ - [l10n] Add Greek (el-GR) locale to charts (#18548) @whythecode
62
+
63
+ #### `@mui/x-charts-pro@8.7.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
64
+
65
+ Same changes as in `@mui/x-charts@8.7.0`, plus:
66
+
67
+ - [charts-pro] Add `useChartProApiRef` for easier refs (#18013) @JCQuintas
68
+ - [charts-pro] Add tests and classes to zoom slider (#18660) @JCQuintas
69
+ - [charts-pro] Fix geometry not handling gestures in specific scenarios (#18651) @JCQuintas
70
+ - [charts-pro] Rename `useChartApiContext` to `useChartProApiContext` (#18565) @JCQuintas
71
+ - [charts-pro] Zoom pointer improvements (#17480) @JCQuintas
72
+
73
+ ### Tree View
74
+
75
+ #### `@mui/x-tree-view@8.7.0`
76
+
77
+ Internal changes.
78
+
79
+ #### `@mui/x-tree-view-pro@8.7.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
80
+
81
+ Same changes as in `@mui/x-tree-view@8.7.0`, plus:
82
+
83
+ - [tree view pro] Add missing `dataSource` JSDoc (#18650) @LukasTy
84
+
85
+ ### Docs
86
+
87
+ - [docs] Add MCP stub (#18204) @bharatkashyap
88
+ - [docs] Fix AI Assistant proxy rewrite prefix (#18661) @arminmeh
89
+ - [docs] Improve test README.MD (#18634) @LukasTy
90
+ - [docs] Provide workaround for pie chart composition (#18600) @alexfauquette
91
+ - [docs][charts] Add donut chart as a special case of a pie chart (#18652) @bernardobelchior
92
+ - [docs][charts] Centralize country and continent data (#18604) @bernardobelchior
93
+ - [docs][data grid] Audit and revise the Pro row docs (#17926) @mapache-salvaje
94
+ - [docs][pickers] Add mention of theme augmentation in relevant migration section (#18608) @LukasTy
95
+
96
+ ### Core
97
+
98
+ - [core] Avoid stringifying `document` object (#18657) @vadimkuragkovskiy
99
+
100
+ ### Miscellaneous
101
+
102
+ - [code-infra] Bump code-infra version and fix breaking changes (#18653) @brijeshb42
103
+ - [code-infra] Ensure `material-ui/disallow-react-api-in-server-components` ESLint rule is applied (#18570) @LukasTy
104
+ - [code-infra] Migrate to flat eslint config (#18562) @brijeshb42
105
+ - [code-infra] Refactor eslint config (#18643) @LukasTy
106
+ - [infra] Add renovatebot rule for latest infra packages (#18609) @Janpot
107
+ - [infra] Move pushArgos script to code-infra (#18667) @Janpot
108
+ - [infra] Updates release script to fetch latest major version from upstream (#18552) @michelengelen
109
+ - [release] Add missing contributor to changelog (#18561) @bernardobelchior
110
+
8
111
  ## 8.6.0
9
112
 
10
113
  _Jun 27, 2025_
@@ -19,7 +122,7 @@ We'd like to extend a big thank you to the 12 contributors who made this release
19
122
  - 🌎 Improve German (de-DE) locale
20
123
 
21
124
  Special thanks go out to the community members for their valuable contributions:
22
- @ShahrazH, @vadimka123
125
+ @omalyutin, @ShahrazH, @vadimka123
23
126
 
24
127
  The following are all team members who have contributed to this release:
25
128
  @arminmeh, @bernardobelchior, @JCQuintas, @KenanYusuf, @LukasTy, @MBilalShafi, @michelengelen, @noraleonte, @rita-codes, @sai6855
@@ -1,3 +1,9 @@
1
1
  import "../typeOverloads/index.js";
2
+ import type { ChartAnyPluginSignature } from '@mui/x-charts/internals';
3
+ import type { ChartProApi as ChartProApiOriginal, ProPluginsPerSeriesType } from "../context/ChartProApi.js";
4
+ import type { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
2
5
  export * from "./ChartContainerPro.js";
3
- export * from "./ChartProApi.js";
6
+ /**
7
+ * @deprecated Use `ChartProApi` from `@mui/x-charts/context` instead.
8
+ */
9
+ export type ChartProApi<ChartType extends keyof ProPluginsPerSeriesType | undefined = undefined, Signatures extends readonly ChartAnyPluginSignature[] = (ChartType extends keyof ProPluginsPerSeriesType ? ProPluginsPerSeriesType[ChartType] : AllPluginSignatures)> = ChartProApiOriginal<ChartType, Signatures>;
@@ -14,15 +14,4 @@ Object.keys(_ChartContainerPro).forEach(function (key) {
14
14
  return _ChartContainerPro[key];
15
15
  }
16
16
  });
17
- });
18
- var _ChartProApi = require("./ChartProApi");
19
- Object.keys(_ChartProApi).forEach(function (key) {
20
- if (key === "default" || key === "__esModule") return;
21
- if (key in exports && exports[key] === _ChartProApi[key]) return;
22
- Object.defineProperty(exports, key, {
23
- enumerable: true,
24
- get: function () {
25
- return _ChartProApi[key];
26
- }
27
- });
28
17
  });
@@ -18,7 +18,7 @@ var _material = require("../internals/material");
18
18
  var _allPlugins = require("../internals/plugins/allPlugins");
19
19
  var _useChartDataProviderProProps = require("./useChartDataProviderProProps");
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
- const releaseInfo = "MTc1MDk3NTIwMDAwMA==";
21
+ const releaseInfo = "MTc1MTU4MDAwMDAwMA==";
22
22
  const packageIdentifier = 'x-charts-pro';
23
23
  /**
24
24
  * Orchestrates the data providers for the chart components and hooks.
@@ -1,2 +1,3 @@
1
1
  export * from "./ChartZoomSlider.js";
2
- export { type ChartAxisZoomSliderThumbClasses, type ChartAxisZoomSliderThumbClassKey, chartAxisZoomSliderThumbClasses } from "./internals/chartAxisZoomSliderThumbClasses.js";
2
+ export { type ChartAxisZoomSliderThumbClasses, type ChartAxisZoomSliderThumbClassKey, chartAxisZoomSliderThumbClasses } from "./internals/chartAxisZoomSliderThumbClasses.js";
3
+ export { type ChartAxisZoomSliderTrackClasses, type ChartAxisZoomSliderTrackClassKey, chartAxisZoomSliderTrackClasses } from "./internals/chartAxisZoomSliderTrackClasses.js";
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  var _exportNames = {
7
- chartAxisZoomSliderThumbClasses: true
7
+ chartAxisZoomSliderThumbClasses: true,
8
+ chartAxisZoomSliderTrackClasses: true
8
9
  };
9
10
  Object.defineProperty(exports, "chartAxisZoomSliderThumbClasses", {
10
11
  enumerable: true,
@@ -12,6 +13,12 @@ Object.defineProperty(exports, "chartAxisZoomSliderThumbClasses", {
12
13
  return _chartAxisZoomSliderThumbClasses.chartAxisZoomSliderThumbClasses;
13
14
  }
14
15
  });
16
+ Object.defineProperty(exports, "chartAxisZoomSliderTrackClasses", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _chartAxisZoomSliderTrackClasses.chartAxisZoomSliderTrackClasses;
20
+ }
21
+ });
15
22
  var _ChartZoomSlider = require("./ChartZoomSlider");
16
23
  Object.keys(_ChartZoomSlider).forEach(function (key) {
17
24
  if (key === "default" || key === "__esModule") return;
@@ -24,4 +31,5 @@ Object.keys(_ChartZoomSlider).forEach(function (key) {
24
31
  }
25
32
  });
26
33
  });
27
- var _chartAxisZoomSliderThumbClasses = require("./internals/chartAxisZoomSliderThumbClasses");
34
+ var _chartAxisZoomSliderThumbClasses = require("./internals/chartAxisZoomSliderThumbClasses");
35
+ var _chartAxisZoomSliderTrackClasses = require("./internals/chartAxisZoomSliderTrackClasses");
@@ -65,7 +65,11 @@ function ChartAxisZoomSlider({
65
65
  }
66
66
  const backgroundRectOffset = (_constants.ZOOM_SLIDER_SIZE - _constants.ZOOM_SLIDER_TRACK_SIZE) / 2;
67
67
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
68
+ "data-charts-zoom-slider": true,
68
69
  transform: `translate(${x} ${y})`,
70
+ style: {
71
+ touchAction: 'none'
72
+ },
69
73
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartAxisZoomSliderTrack.ChartAxisZoomSliderTrack, {
70
74
  x: axisDirection === 'x' ? 0 : backgroundRectOffset,
71
75
  y: axisDirection === 'x' ? backgroundRectOffset : 0,
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
@@ -16,6 +17,7 @@ var _ChartAxisZoomSliderThumb = require("./ChartAxisZoomSliderThumb");
16
17
  var _ChartsTooltipZoomSliderValue = require("./ChartsTooltipZoomSliderValue");
17
18
  var _zoomUtils = require("./zoom-utils");
18
19
  var _constants = require("./constants");
20
+ var _chartAxisZoomSliderTrackClasses = require("./chartAxisZoomSliderTrackClasses");
19
21
  var _jsxRuntime = require("react/jsx-runtime");
20
22
  const ZoomSliderActiveTrackRect = (0, _styles.styled)('rect')(({
21
23
  theme
@@ -49,6 +51,9 @@ function ChartAxisZoomSliderActiveTrack({
49
51
  tooltipStart,
50
52
  tooltipEnd
51
53
  } = getZoomSliderTooltipsText(axis, drawingArea);
54
+ const classes = (0, _chartAxisZoomSliderTrackClasses.useUtilityClasses)({
55
+ axisDirection
56
+ });
52
57
  const previewThumbWidth = axisDirection === 'x' ? _constants.ZOOM_SLIDER_THUMB_WIDTH : _constants.ZOOM_SLIDER_THUMB_HEIGHT;
53
58
  const previewThumbHeight = axisDirection === 'x' ? _constants.ZOOM_SLIDER_THUMB_HEIGHT : _constants.ZOOM_SLIDER_THUMB_WIDTH;
54
59
  React.useEffect(() => {
@@ -202,7 +207,8 @@ function ChartAxisZoomSliderActiveTrack({
202
207
  width: previewWidth,
203
208
  height: previewHeight,
204
209
  onPointerEnter: onPointerEnter,
205
- onPointerLeave: onPointerLeave
210
+ onPointerLeave: onPointerLeave,
211
+ className: classes.active
206
212
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartAxisZoomSliderThumb.ChartAxisZoomSliderThumb, {
207
213
  ref: setStartThumbEl,
208
214
  x: startThumbX,
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
@@ -13,7 +14,9 @@ var _internals = require("@mui/x-charts/internals");
13
14
  var _styles = require("@mui/material/styles");
14
15
  var _rafThrottle = require("@mui/x-internals/rafThrottle");
15
16
  var _system = require("@mui/system");
17
+ var _clsx = _interopRequireDefault(require("clsx"));
16
18
  var _zoomUtils = require("./zoom-utils");
19
+ var _chartAxisZoomSliderTrackClasses = require("./chartAxisZoomSliderTrackClasses");
17
20
  var _jsxRuntime = require("react/jsx-runtime");
18
21
  const _excluded = ["axisId", "axisDirection", "reverse", "onSelectStart", "onSelectEnd"];
19
22
  const ZoomSliderTrack = (0, _styles.styled)('rect', {
@@ -56,6 +59,9 @@ function ChartAxisZoomSliderTrack(_ref) {
56
59
  } = (0, _internals.useChartContext)();
57
60
  const store = (0, _internals.useStore)();
58
61
  const [isSelecting, setIsSelecting] = React.useState(false);
62
+ const classes = (0, _chartAxisZoomSliderTrackClasses.useUtilityClasses)({
63
+ axisDirection
64
+ });
59
65
  const onPointerDown = function onPointerDown(event) {
60
66
  const rect = ref.current;
61
67
  const element = svgRef.current;
@@ -127,5 +133,7 @@ function ChartAxisZoomSliderTrack(_ref) {
127
133
  onPointerDown: onPointerDown,
128
134
  axisDirection: axisDirection,
129
135
  isSelecting: isSelecting
130
- }, other));
136
+ }, other, {
137
+ className: (0, _clsx.default)(classes.background, other.className)
138
+ }));
131
139
  }
@@ -0,0 +1,15 @@
1
+ import type { ChartAxisZoomSliderActiveTrackProps } from "./ChartAxisZoomSliderActiveTrack.js";
2
+ export interface ChartAxisZoomSliderTrackClasses {
3
+ /** Styles applied to the root element when it is horizontal. */
4
+ horizontal: string;
5
+ /** Styles applied to the root element when it is vertical. */
6
+ vertical: string;
7
+ /** Styles applied to the root element to the active part of the track. */
8
+ active: string;
9
+ /** Styles applied to the root element to the background part of the track. */
10
+ background: string;
11
+ }
12
+ export type ChartAxisZoomSliderTrackClassKey = keyof ChartAxisZoomSliderTrackClasses;
13
+ export declare const chartAxisZoomSliderTrackClasses: ChartAxisZoomSliderTrackClasses;
14
+ export declare function getAxisZoomSliderTrackUtilityClass(slot: string): string;
15
+ export declare const useUtilityClasses: (props: Partial<ChartAxisZoomSliderActiveTrackProps>) => Record<"background" | "active", string>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.chartAxisZoomSliderTrackClasses = void 0;
8
+ exports.getAxisZoomSliderTrackUtilityClass = getAxisZoomSliderTrackUtilityClass;
9
+ exports.useUtilityClasses = void 0;
10
+ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
11
+ var _ClassNameGenerator = _interopRequireDefault(require("@mui/utils/ClassNameGenerator"));
12
+ const chartAxisZoomSliderTrackClasses = exports.chartAxisZoomSliderTrackClasses = ['horizontal', 'vertical', 'background', 'active'].reduce((acc, slot) => {
13
+ acc[slot] = getAxisZoomSliderTrackUtilityClass(slot);
14
+ return acc;
15
+ }, {});
16
+ function getAxisZoomSliderTrackUtilityClass(slot) {
17
+ // We use the `ClassNameGenerator` because the original `generateUtilityClass` function
18
+ // has a special case for the `active` slot.
19
+ return `${_ClassNameGenerator.default.generate('MuiChartAxisZoomSliderTrack')}-${slot}`;
20
+ }
21
+ const useUtilityClasses = props => {
22
+ const {
23
+ axisDirection
24
+ } = props;
25
+ const slots = {
26
+ background: [axisDirection === 'x' ? 'horizontal' : 'vertical', 'background'],
27
+ active: [axisDirection === 'x' ? 'horizontal' : 'vertical', 'active']
28
+ };
29
+ return (0, _composeClasses.default)(slots, getAxisZoomSliderTrackUtilityClass);
30
+ };
31
+ exports.useUtilityClasses = useUtilityClasses;
@@ -35,7 +35,7 @@ const ChartsToolbarImageExportTrigger = exports.ChartsToolbarImageExportTrigger
35
35
  slots,
36
36
  slotProps
37
37
  } = (0, _internals.useChartsSlots)();
38
- const apiRef = (0, _context.useChartApiContext)();
38
+ const apiRef = (0, _context.useChartProApiContext)();
39
39
  const handleClick = event => {
40
40
  apiRef.current.exportAsImage(options);
41
41
  onClick?.(event);
@@ -35,7 +35,7 @@ const ChartsToolbarPrintExportTrigger = exports.ChartsToolbarPrintExportTrigger
35
35
  slots,
36
36
  slotProps
37
37
  } = (0, _internals.useChartsSlots)();
38
- const apiRef = (0, _context.useChartApiContext)();
38
+ const apiRef = (0, _context.useChartProApiContext)();
39
39
  const handleClick = event => {
40
40
  apiRef.current.exportAsPrint(options);
41
41
  onClick?.(event);
@@ -52,39 +52,51 @@ const useChartFunnelAxis = ({
52
52
  }, [seriesConfig, drawingArea, xAxis, yAxis, dataset, store, gap]);
53
53
  React.useEffect(() => {
54
54
  const element = svgRef.current;
55
- if (!isInteractionEnabled || element === null || params.disableAxisListener) {
55
+ if (!isInteractionEnabled || !element || params.disableAxisListener) {
56
56
  return () => {};
57
57
  }
58
- const handleOut = () => {
59
- instance.cleanInteraction?.();
60
- };
61
- const handleMove = event => {
62
- const target = 'targetTouches' in event ? event.targetTouches[0] : event;
63
- const svgPoint = (0, _internals.getSVGPoint)(element, target);
64
- if (!instance.isPointInside(svgPoint.x, svgPoint.y, event.target)) {
58
+
59
+ // Clean the interaction when the mouse leaves the chart.
60
+ const moveEndHandler = instance.addInteractionListener('moveEnd', event => {
61
+ if (!event.detail.activeGestures.pan) {
65
62
  instance.cleanInteraction?.();
66
- return;
67
63
  }
68
- instance.setPointerCoordinate?.(svgPoint);
69
- };
70
- const handleDown = event => {
71
- const target = event.currentTarget;
72
- if (!target) {
73
- return;
64
+ });
65
+ const panEndHandler = instance.addInteractionListener('panEnd', event => {
66
+ if (!event.detail.activeGestures.move) {
67
+ instance.cleanInteraction?.();
74
68
  }
75
- if ('hasPointerCapture' in target && target.hasPointerCapture(event.pointerId)) {
76
- target.releasePointerCapture(event.pointerId);
69
+ });
70
+ const pressEndHandler = instance.addInteractionListener('quickPressEnd', event => {
71
+ if (!event.detail.activeGestures.move && !event.detail.activeGestures.pan) {
72
+ instance.cleanInteraction?.();
73
+ }
74
+ });
75
+ const gestureHandler = event => {
76
+ const srvEvent = event.detail.srcEvent;
77
+ const target = event.detail.target;
78
+ const svgPoint = (0, _internals.getSVGPoint)(element, srvEvent);
79
+ // Release the pointer capture if we are panning, as this would cause the tooltip to
80
+ // be locked to the first "section" it touches.
81
+ if (event.detail.srcEvent.buttons >= 1 && target?.hasPointerCapture(event.detail.srcEvent.pointerId)) {
82
+ target?.releasePointerCapture(event.detail.srcEvent.pointerId);
77
83
  }
84
+ if (!instance.isPointInside(svgPoint.x, svgPoint.y, target)) {
85
+ instance.cleanInteraction?.();
86
+ return;
87
+ }
88
+ instance.setPointerCoordinate?.(svgPoint);
78
89
  };
79
- element.addEventListener('pointerdown', handleDown);
80
- element.addEventListener('pointermove', handleMove);
81
- element.addEventListener('pointercancel', handleOut);
82
- element.addEventListener('pointerleave', handleOut);
90
+ const moveHandler = instance.addInteractionListener('move', gestureHandler);
91
+ const panHandler = instance.addInteractionListener('pan', gestureHandler);
92
+ const pressHandler = instance.addInteractionListener('quickPress', gestureHandler);
83
93
  return () => {
84
- element.removeEventListener('pointerdown', handleDown);
85
- element.removeEventListener('pointermove', handleMove);
86
- element.removeEventListener('pointercancel', handleOut);
87
- element.removeEventListener('pointerleave', handleOut);
94
+ moveHandler.cleanup();
95
+ moveEndHandler.cleanup();
96
+ panHandler.cleanup();
97
+ panEndHandler.cleanup();
98
+ pressHandler.cleanup();
99
+ pressEndHandler.cleanup();
88
100
  };
89
101
  }, [svgRef, instance, params.disableAxisListener, isInteractionEnabled]);
90
102
  React.useEffect(() => {
@@ -93,8 +105,7 @@ const useChartFunnelAxis = ({
93
105
  if (element === null || !onAxisClick) {
94
106
  return () => {};
95
107
  }
96
- const handleMouseClick = event => {
97
- event.preventDefault();
108
+ const axisClickHandler = instance.addInteractionListener('tap', event => {
98
109
  const {
99
110
  axis: xAxisWithScale,
100
111
  axisIds: xAxisIds
@@ -108,7 +119,7 @@ const useChartFunnelAxis = ({
108
119
  const usedYAxis = yAxisIds[0];
109
120
  let dataIndex = null;
110
121
  let isXAxis = false;
111
- const svgPoint = (0, _internals.getSVGPoint)(element, event);
122
+ const svgPoint = (0, _internals.getSVGPoint)(element, event.detail.srcEvent);
112
123
  const xIndex = (0, _internals.getCartesianAxisIndex)(xAxisWithScale[usedXAxis], svgPoint.x);
113
124
  isXAxis = xIndex !== -1;
114
125
  dataIndex = isXAxis ? xIndex : (0, _internals.getCartesianAxisIndex)(yAxisWithScale[usedYAxis], svgPoint.y);
@@ -129,17 +140,16 @@ const useChartFunnelAxis = ({
129
140
  seriesValues[seriesId] = seriesItem.data[dataIndex].value;
130
141
  }
131
142
  });
132
- onAxisClick(event, {
143
+ onAxisClick(event.detail.srcEvent, {
133
144
  dataIndex,
134
145
  axisValue,
135
146
  seriesValues
136
147
  });
137
- };
138
- element.addEventListener('click', handleMouseClick);
148
+ });
139
149
  return () => {
140
- element.removeEventListener('click', handleMouseClick);
150
+ axisClickHandler.cleanup();
141
151
  };
142
- }, [params.onAxisClick, svgRef, store]);
152
+ }, [params.onAxisClick, svgRef, store, instance]);
143
153
  return {};
144
154
  };
145
155
  exports.useChartFunnelAxis = useChartFunnelAxis;
@@ -3,7 +3,7 @@ import { UseChartFunnelAxisSignature } from "./useChartFunnelAxis.types.js";
3
3
  export declare const selectorFunnel: (state: ChartState<[], [UseChartFunnelAxisSignature]>) => {
4
4
  gap: number;
5
5
  } | undefined;
6
- export declare const selectorFunnelGap: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & Partial<Pick<import("@mui/x-charts/internals").UseChartCartesianAxisState, "cartesianAxis"> & {
6
+ export declare const selectorFunnelGap: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<Pick<import("@mui/x-charts/internals").UseChartCartesianAxisState, "cartesianAxis"> & {
7
7
  funnel: {
8
8
  gap: number;
9
9
  };
@@ -12,7 +12,7 @@ export declare const selectorFunnelGap: import("reselect").Selector<import("@mui
12
12
  } & {
13
13
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
14
14
  }, number, []>;
15
- export declare const selectorChartXAxis: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
15
+ export declare const selectorChartXAxis: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
16
16
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
17
17
  } & Partial<{}> & {
18
18
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
@@ -33,7 +33,7 @@ export declare const selectorChartXAxis: import("reselect").Selector<import("@mu
33
33
  }> & {
34
34
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
35
35
  }, import("./computeAxisValue.js").ComputeResult<import("@mui/x-charts").ChartsXAxisProps>, []>;
36
- export declare const selectorChartYAxis: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
36
+ export declare const selectorChartYAxis: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
37
37
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
38
38
  } & Partial<{}> & {
39
39
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
@@ -7,7 +7,7 @@ import { AllPluginSignatures, DefaultPluginSignatures } from "../internals/plugi
7
7
  import { FunnelChartPluginsSignatures } from "../FunnelChart/FunnelChart.plugins.js";
8
8
  import { RadarChartProPluginsSignatures } from "../RadarChartPro/RadarChartPro.plugins.js";
9
9
  import { PieChartProPluginSignatures } from "../PieChartPro/PieChartPro.plugins.js";
10
- type PluginsPerSeriesType = {
10
+ export type ProPluginsPerSeriesType = {
11
11
  heatmap: HeatmapPluginsSignatures;
12
12
  line: LineChartProPluginsSignatures;
13
13
  scatter: ScatterChartProPluginsSignatures;
@@ -24,5 +24,4 @@ type PluginsPerSeriesType = {
24
24
  * If the chart is being created using composition, the `composition` value can be used.
25
25
  * @example ChartProApi<'composition'>
26
26
  */
27
- export type ChartProApi<TSeries extends keyof PluginsPerSeriesType | undefined = undefined, TSignatures extends readonly ChartAnyPluginSignature[] = (TSeries extends keyof PluginsPerSeriesType ? PluginsPerSeriesType[TSeries] : AllPluginSignatures)> = ChartPublicAPI<TSignatures>;
28
- export {};
27
+ export type ChartProApi<ChartType extends keyof ProPluginsPerSeriesType | undefined = undefined, Signatures extends readonly ChartAnyPluginSignature[] = (ChartType extends keyof ProPluginsPerSeriesType ? ProPluginsPerSeriesType[ChartType] : AllPluginSignatures)> = ChartPublicAPI<Signatures>;
@@ -1 +1,2 @@
1
- export * from "./useChartApiContext.js";
1
+ export * from "./useChartProApiContext.js";
2
+ export type { ChartProApi } from "./ChartProApi.js";
package/context/index.js CHANGED
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _useChartApiContext = require("./useChartApiContext");
7
- Object.keys(_useChartApiContext).forEach(function (key) {
6
+ var _useChartProApiContext = require("./useChartProApiContext");
7
+ Object.keys(_useChartProApiContext).forEach(function (key) {
8
8
  if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _useChartApiContext[key]) return;
9
+ if (key in exports && exports[key] === _useChartProApiContext[key]) return;
10
10
  Object.defineProperty(exports, key, {
11
11
  enumerable: true,
12
12
  get: function () {
13
- return _useChartApiContext[key];
13
+ return _useChartProApiContext[key];
14
14
  }
15
15
  });
16
16
  });
@@ -0,0 +1,9 @@
1
+ import { ChartProApi } from "./ChartProApi.js";
2
+ /**
3
+ * The `useChartProApiContext` hook provides access to the chart API.
4
+ * This is only available when the chart is rendered within a chart or a `ChartDataProvider` component.
5
+ * If you want to access the chart API outside those components, you should use the `apiRef` prop instead.
6
+ * @example
7
+ * const apiRef = useChartProApiContext<ChartProApi<'bar'>>();
8
+ */
9
+ export declare function useChartProApiContext<Api extends ChartProApi>(): import("react").RefObject<Api>;
@@ -3,15 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useChartApiContext = useChartApiContext;
6
+ exports.useChartProApiContext = useChartProApiContext;
7
7
  var _context = require("@mui/x-charts/context");
8
8
  /**
9
- * The `useChartApiContext` hook provides access to the chart API.
9
+ * The `useChartProApiContext` hook provides access to the chart API.
10
10
  * This is only available when the chart is rendered within a chart or a `ChartDataProvider` component.
11
11
  * If you want to access the chart API outside those components, you should use the `apiRef` prop instead.
12
12
  * @example
13
- * const apiRef = useChartApiContext<ChartProApi<'bar'>>();
13
+ * const apiRef = useChartProApiContext<ChartProApi<'bar'>>();
14
14
  */
15
- function useChartApiContext() {
15
+ function useChartProApiContext() {
16
16
  return (0, _context.useChartApiContext)();
17
17
  }
@@ -1,3 +1,9 @@
1
1
  import "../typeOverloads/index.js";
2
+ import type { ChartAnyPluginSignature } from '@mui/x-charts/internals';
3
+ import type { ChartProApi as ChartProApiOriginal, ProPluginsPerSeriesType } from "../context/ChartProApi.js";
4
+ import type { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
2
5
  export * from "./ChartContainerPro.js";
3
- export * from "./ChartProApi.js";
6
+ /**
7
+ * @deprecated Use `ChartProApi` from `@mui/x-charts/context` instead.
8
+ */
9
+ export type ChartProApi<ChartType extends keyof ProPluginsPerSeriesType | undefined = undefined, Signatures extends readonly ChartAnyPluginSignature[] = (ChartType extends keyof ProPluginsPerSeriesType ? ProPluginsPerSeriesType[ChartType] : AllPluginSignatures)> = ChartProApiOriginal<ChartType, Signatures>;
@@ -1,3 +1,6 @@
1
1
  import "../typeOverloads/index.js";
2
2
  export * from "./ChartContainerPro.js";
3
- export * from "./ChartProApi.js";
3
+
4
+ /**
5
+ * @deprecated Use `ChartProApi` from `@mui/x-charts/context` instead.
6
+ */
@@ -11,7 +11,7 @@ import { defaultSlotsMaterial } from "../internals/material/index.js";
11
11
  import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
12
12
  import { useChartDataProviderProProps } from "./useChartDataProviderProProps.js";
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- const releaseInfo = "MTc1MDk3NTIwMDAwMA==";
14
+ const releaseInfo = "MTc1MTU4MDAwMDAwMA==";
15
15
  const packageIdentifier = 'x-charts-pro';
16
16
  /**
17
17
  * Orchestrates the data providers for the chart components and hooks.
@@ -1,2 +1,3 @@
1
1
  export * from "./ChartZoomSlider.js";
2
- export { type ChartAxisZoomSliderThumbClasses, type ChartAxisZoomSliderThumbClassKey, chartAxisZoomSliderThumbClasses } from "./internals/chartAxisZoomSliderThumbClasses.js";
2
+ export { type ChartAxisZoomSliderThumbClasses, type ChartAxisZoomSliderThumbClassKey, chartAxisZoomSliderThumbClasses } from "./internals/chartAxisZoomSliderThumbClasses.js";
3
+ export { type ChartAxisZoomSliderTrackClasses, type ChartAxisZoomSliderTrackClassKey, chartAxisZoomSliderTrackClasses } from "./internals/chartAxisZoomSliderTrackClasses.js";
@@ -1,2 +1,3 @@
1
1
  export * from "./ChartZoomSlider.js";
2
- export { chartAxisZoomSliderThumbClasses } from "./internals/chartAxisZoomSliderThumbClasses.js";
2
+ export { chartAxisZoomSliderThumbClasses } from "./internals/chartAxisZoomSliderThumbClasses.js";
3
+ export { chartAxisZoomSliderTrackClasses } from "./internals/chartAxisZoomSliderTrackClasses.js";
@@ -59,7 +59,11 @@ export function ChartAxisZoomSlider({
59
59
  }
60
60
  const backgroundRectOffset = (ZOOM_SLIDER_SIZE - ZOOM_SLIDER_TRACK_SIZE) / 2;
61
61
  return /*#__PURE__*/_jsxs("g", {
62
+ "data-charts-zoom-slider": true,
62
63
  transform: `translate(${x} ${y})`,
64
+ style: {
65
+ touchAction: 'none'
66
+ },
63
67
  children: [/*#__PURE__*/_jsx(ChartAxisZoomSliderTrack, {
64
68
  x: axisDirection === 'x' ? 0 : backgroundRectOffset,
65
69
  y: axisDirection === 'x' ? backgroundRectOffset : 0,