@mui/x-charts-pro 8.0.0-alpha.1 → 8.0.0-alpha.11

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 (198) hide show
  1. package/BarChartPro/BarChartPro.d.ts +2 -2
  2. package/BarChartPro/BarChartPro.js +75 -34
  3. package/BarChartPro/BarChartPro.plugins.d.ts +10 -0
  4. package/BarChartPro/BarChartPro.plugins.js +3 -0
  5. package/CHANGELOG.md +2007 -230
  6. package/ChartContainerPro/ChartContainerPro.d.ts +33 -5
  7. package/ChartContainerPro/ChartContainerPro.js +55 -37
  8. package/ChartContainerPro/useChartContainerProProps.d.ts +6 -5
  9. package/ChartContainerPro/useChartContainerProProps.js +17 -13
  10. package/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
  11. package/ChartDataProviderPro/ChartDataProviderPro.js +105 -0
  12. package/{context → ChartDataProviderPro}/package.json +1 -1
  13. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
  14. package/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
  15. package/Heatmap/Heatmap.d.ts +1 -2
  16. package/Heatmap/Heatmap.js +36 -13
  17. package/Heatmap/Heatmap.plugins.d.ts +8 -0
  18. package/Heatmap/Heatmap.plugins.js +2 -0
  19. package/Heatmap/HeatmapItem.js +1 -1
  20. package/Heatmap/HeatmapTooltip.js +8 -28
  21. package/Heatmap/extremums.d.ts +2 -2
  22. package/Heatmap/formatter.d.ts +2 -2
  23. package/Heatmap/formatter.js +2 -1
  24. package/Heatmap/heatmapClasses.js +2 -1
  25. package/Heatmap/plugin.d.ts +2 -2
  26. package/Heatmap/plugin.js +4 -2
  27. package/Heatmap/tooltip.d.ts +3 -0
  28. package/Heatmap/tooltip.js +25 -0
  29. package/LineChartPro/LineChartPro.d.ts +2 -2
  30. package/LineChartPro/LineChartPro.js +81 -54
  31. package/LineChartPro/LineChartPro.plugins.d.ts +10 -0
  32. package/LineChartPro/LineChartPro.plugins.js +3 -0
  33. package/README.md +1 -1
  34. package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
  35. package/ScatterChartPro/ScatterChartPro.js +59 -34
  36. package/ScatterChartPro/ScatterChartPro.plugins.d.ts +10 -0
  37. package/ScatterChartPro/ScatterChartPro.plugins.js +3 -0
  38. package/hooks/index.d.ts +1 -0
  39. package/hooks/index.js +2 -1
  40. package/hooks/useSeries.d.ts +2 -4
  41. package/hooks/zoom/index.d.ts +1 -0
  42. package/hooks/zoom/index.js +1 -0
  43. package/hooks/zoom/useIsZoomInteracting.d.ts +6 -0
  44. package/hooks/zoom/useIsZoomInteracting.js +14 -0
  45. package/index.d.ts +3 -2
  46. package/index.js +5 -6
  47. package/internals/plugins/allPlugins.d.ts +11 -0
  48. package/internals/plugins/allPlugins.js +5 -0
  49. package/internals/plugins/useChartProZoom/creatZoomLookup.d.ts +3 -0
  50. package/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
  51. package/internals/plugins/useChartProZoom/defaultizeZoom.d.ts +2 -0
  52. package/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
  53. package/internals/plugins/useChartProZoom/index.d.ts +3 -0
  54. package/internals/plugins/useChartProZoom/index.js +3 -0
  55. package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +3 -0
  56. package/internals/plugins/useChartProZoom/useChartProZoom.js +303 -0
  57. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +377 -0
  58. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -0
  59. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +50 -0
  60. package/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +45 -0
  61. package/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
  62. package/internals/plugins/useChartProZoom/zoom.types.d.ts +53 -0
  63. package/internals/utils/releaseInfo.js +2 -2
  64. package/models/index.d.ts +1 -0
  65. package/models/index.js +2 -1
  66. package/modern/BarChartPro/BarChartPro.js +75 -34
  67. package/modern/BarChartPro/BarChartPro.plugins.js +3 -0
  68. package/modern/ChartContainerPro/ChartContainerPro.js +55 -37
  69. package/modern/ChartContainerPro/useChartContainerProProps.js +17 -13
  70. package/modern/ChartDataProviderPro/ChartDataProviderPro.js +105 -0
  71. package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
  72. package/modern/Heatmap/Heatmap.js +36 -13
  73. package/modern/Heatmap/Heatmap.plugins.js +2 -0
  74. package/modern/Heatmap/HeatmapItem.js +1 -1
  75. package/modern/Heatmap/HeatmapTooltip.js +8 -28
  76. package/modern/Heatmap/formatter.js +2 -1
  77. package/modern/Heatmap/heatmapClasses.js +2 -1
  78. package/modern/Heatmap/plugin.js +4 -2
  79. package/modern/Heatmap/tooltip.js +25 -0
  80. package/modern/LineChartPro/LineChartPro.js +81 -54
  81. package/modern/LineChartPro/LineChartPro.plugins.js +3 -0
  82. package/modern/ScatterChartPro/ScatterChartPro.js +59 -34
  83. package/modern/ScatterChartPro/ScatterChartPro.plugins.js +3 -0
  84. package/modern/hooks/index.js +2 -1
  85. package/modern/hooks/zoom/index.js +1 -0
  86. package/modern/hooks/zoom/useIsZoomInteracting.js +14 -0
  87. package/modern/index.js +5 -6
  88. package/modern/internals/plugins/allPlugins.js +5 -0
  89. package/modern/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
  90. package/modern/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
  91. package/modern/internals/plugins/useChartProZoom/index.js +3 -0
  92. package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +303 -0
  93. package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -0
  94. package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.js +1 -0
  95. package/modern/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
  96. package/modern/internals/plugins/useChartProZoom/zoom.types.js +1 -0
  97. package/modern/internals/utils/releaseInfo.js +2 -2
  98. package/modern/models/index.js +2 -1
  99. package/node/BarChartPro/BarChartPro.js +74 -33
  100. package/node/BarChartPro/BarChartPro.plugins.js +9 -0
  101. package/node/ChartContainerPro/ChartContainerPro.js +54 -36
  102. package/node/ChartContainerPro/useChartContainerProProps.js +17 -13
  103. package/node/ChartDataProviderPro/ChartDataProviderPro.js +111 -0
  104. package/node/ChartDataProviderPro/useChartDataProviderProProps.js +21 -0
  105. package/node/Heatmap/Heatmap.js +36 -13
  106. package/node/Heatmap/Heatmap.plugins.js +8 -0
  107. package/node/Heatmap/HeatmapItem.js +2 -2
  108. package/node/Heatmap/HeatmapTooltip.js +6 -26
  109. package/node/Heatmap/formatter.js +2 -1
  110. package/node/Heatmap/heatmapClasses.js +5 -4
  111. package/node/Heatmap/plugin.js +4 -2
  112. package/node/Heatmap/tooltip.js +31 -0
  113. package/node/LineChartPro/LineChartPro.js +80 -53
  114. package/node/LineChartPro/LineChartPro.plugins.js +9 -0
  115. package/node/ScatterChartPro/ScatterChartPro.js +58 -33
  116. package/node/ScatterChartPro/ScatterChartPro.plugins.js +9 -0
  117. package/node/hooks/index.js +16 -1
  118. package/node/{context/CartesianProviderPro → hooks/zoom}/index.js +4 -4
  119. package/node/hooks/zoom/useIsZoomInteracting.js +19 -0
  120. package/node/index.js +34 -23
  121. package/node/internals/plugins/allPlugins.js +11 -0
  122. package/node/internals/plugins/useChartProZoom/creatZoomLookup.js +19 -0
  123. package/node/internals/plugins/useChartProZoom/defaultizeZoom.js +33 -0
  124. package/node/internals/plugins/useChartProZoom/index.js +38 -0
  125. package/node/internals/plugins/useChartProZoom/useChartProZoom.js +310 -0
  126. package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +18 -0
  127. package/node/internals/plugins/useChartProZoom/useChartProZoom.utils.js +140 -0
  128. package/node/internals/plugins/useChartProZoom/zoom.types.js +5 -0
  129. package/node/internals/utils/releaseInfo.js +4 -3
  130. package/package.json +6 -6
  131. package/typeOverloads/modules.d.ts +8 -1
  132. package/context/CartesianProviderPro/CartesianProviderPro.d.ts +0 -6
  133. package/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
  134. package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +0 -12
  135. package/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
  136. package/context/CartesianProviderPro/index.d.ts +0 -1
  137. package/context/CartesianProviderPro/index.js +0 -1
  138. package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +0 -10
  139. package/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -299
  140. package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +0 -14
  141. package/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
  142. package/context/ZoomProvider/Zoom.types.d.ts +0 -144
  143. package/context/ZoomProvider/ZoomContext.d.ts +0 -4
  144. package/context/ZoomProvider/ZoomContext.js +0 -16
  145. package/context/ZoomProvider/ZoomProvider.d.ts +0 -3
  146. package/context/ZoomProvider/ZoomProvider.js +0 -56
  147. package/context/ZoomProvider/ZoomSetup.d.ts +0 -9
  148. package/context/ZoomProvider/ZoomSetup.js +0 -16
  149. package/context/ZoomProvider/defaultizeZoom.d.ts +0 -2
  150. package/context/ZoomProvider/defaultizeZoom.js +0 -32
  151. package/context/ZoomProvider/index.d.ts +0 -3
  152. package/context/ZoomProvider/index.js +0 -3
  153. package/context/ZoomProvider/initializeZoomData.d.ts +0 -6
  154. package/context/ZoomProvider/initializeZoomData.js +0 -13
  155. package/context/ZoomProvider/useSetupPan.d.ts +0 -1
  156. package/context/ZoomProvider/useSetupPan.js +0 -106
  157. package/context/ZoomProvider/useSetupZoom.d.ts +0 -1
  158. package/context/ZoomProvider/useSetupZoom.js +0 -274
  159. package/context/ZoomProvider/useZoom.d.ts +0 -7
  160. package/context/ZoomProvider/useZoom.js +0 -19
  161. package/context/index.d.ts +0 -3
  162. package/context/index.js +0 -5
  163. package/modern/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
  164. package/modern/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
  165. package/modern/context/CartesianProviderPro/index.js +0 -1
  166. package/modern/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -299
  167. package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
  168. package/modern/context/ZoomProvider/ZoomContext.js +0 -16
  169. package/modern/context/ZoomProvider/ZoomProvider.js +0 -56
  170. package/modern/context/ZoomProvider/ZoomSetup.js +0 -16
  171. package/modern/context/ZoomProvider/defaultizeZoom.js +0 -32
  172. package/modern/context/ZoomProvider/index.js +0 -3
  173. package/modern/context/ZoomProvider/initializeZoomData.js +0 -13
  174. package/modern/context/ZoomProvider/useSetupPan.js +0 -106
  175. package/modern/context/ZoomProvider/useSetupZoom.js +0 -274
  176. package/modern/context/ZoomProvider/useZoom.js +0 -19
  177. package/modern/context/index.js +0 -5
  178. package/node/context/CartesianProviderPro/CartesianProviderPro.js +0 -95
  179. package/node/context/CartesianProviderPro/createAxisFilterMapper.js +0 -68
  180. package/node/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -305
  181. package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -50
  182. package/node/context/ZoomProvider/ZoomContext.js +0 -23
  183. package/node/context/ZoomProvider/ZoomProvider.js +0 -63
  184. package/node/context/ZoomProvider/ZoomSetup.js +0 -20
  185. package/node/context/ZoomProvider/defaultizeZoom.js +0 -40
  186. package/node/context/ZoomProvider/index.js +0 -38
  187. package/node/context/ZoomProvider/initializeZoomData.js +0 -20
  188. package/node/context/ZoomProvider/useSetupPan.js +0 -114
  189. package/node/context/ZoomProvider/useSetupZoom.js +0 -281
  190. package/node/context/ZoomProvider/useZoom.js +0 -25
  191. package/node/context/index.js +0 -27
  192. /package/{context/ChartDataProviderPro → ChartDataProviderPro}/index.d.ts +0 -0
  193. /package/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
  194. /package/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
  195. /package/{modern/context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/zoom.types.js} +0 -0
  196. /package/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
  197. /package/node/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
  198. /package/node/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
@@ -4,10 +4,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
+ import HTMLElementType from '@mui/utils/HTMLElementType';
7
8
  import composeClasses from '@mui/utils/composeClasses';
8
- import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, ChartsTooltipMark, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
9
+ import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
9
10
  import { useXAxis, useYAxis } from '@mui/x-charts/hooks';
10
- import { getLabel } from '@mui/x-charts/internals';
11
+ import { getLabel, ChartsLabelMark } from '@mui/x-charts/internals';
11
12
  import { useHeatmapSeries } from "../hooks/useSeries.js";
12
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
14
  const useUtilityClasses = ownerState => {
@@ -27,10 +28,6 @@ const useUtilityClasses = ownerState => {
27
28
  };
28
29
  return composeClasses(slots, getChartsTooltipUtilityClass, classes);
29
30
  };
30
-
31
- /**
32
- * @ignore - internal component.
33
- */
34
31
  function DefaultHeatmapTooltipContent(props) {
35
32
  const {
36
33
  classes
@@ -50,7 +47,8 @@ function DefaultHeatmapTooltipContent(props) {
50
47
  const {
51
48
  color,
52
49
  value,
53
- identifier
50
+ identifier,
51
+ markType
54
52
  } = tooltipData;
55
53
  const [xIndex, yIndex] = value;
56
54
  const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
@@ -83,7 +81,8 @@ function DefaultHeatmapTooltipContent(props) {
83
81
  className: classes?.row,
84
82
  children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
85
83
  className: clsx(classes?.markCell, classes?.cell),
86
- children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
84
+ children: /*#__PURE__*/_jsx(ChartsLabelMark, {
85
+ type: markType,
87
86
  color: color,
88
87
  className: classes?.mark
89
88
  })
@@ -132,26 +131,7 @@ process.env.NODE_ENV !== "production" ? HeatmapTooltip.propTypes = {
132
131
  * It's used to set the position of the popper.
133
132
  * The return value will passed as the reference object of the Popper instance.
134
133
  */
135
- anchorEl: PropTypes.oneOfType([(props, propName) => {
136
- if (props[propName] == null) {
137
- return new Error(`Prop '${propName}' is required but wasn't specified`);
138
- }
139
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
140
- return new Error(`Expected prop '${propName}' to be of type Element`);
141
- }
142
- return null;
143
- }, PropTypes.func, PropTypes.shape({
144
- contextElement: (props, propName) => {
145
- if (props[propName] == null) {
146
- return null;
147
- }
148
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
149
- return new Error(`Expected prop '${propName}' to be of type Element`);
150
- }
151
- return null;
152
- },
153
- getBoundingClientRect: PropTypes.func.isRequired
154
- })]),
134
+ anchorEl: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.object, PropTypes.func]),
155
135
  /**
156
136
  * Override or extend the styles applied to the component.
157
137
  */
@@ -1,2 +1,2 @@
1
- import { ExtremumGetter } from '@mui/x-charts/internals';
2
- export declare const getBaseExtremum: ExtremumGetter<'heatmap'>;
1
+ import { CartesianExtremumGetter } from '@mui/x-charts/internals';
2
+ export declare const getBaseExtremum: CartesianExtremumGetter<'heatmap'>;
@@ -1,3 +1,3 @@
1
- import { SeriesFormatter } from '@mui/x-charts/internals';
2
- declare const formatter: SeriesFormatter<'heatmap'>;
1
+ import { SeriesProcessor } from '@mui/x-charts/internals';
2
+ declare const formatter: SeriesProcessor<'heatmap'>;
3
3
  export default formatter;
@@ -9,7 +9,8 @@ const formatter = params => {
9
9
  defaultizedSeries[seriesId] = _extends({
10
10
  // Defaultize the data and the value formatter.
11
11
  valueFormatter: v => v[2].toString(),
12
- data: []
12
+ data: [],
13
+ labelMarkType: 'square'
13
14
  }, series[seriesId]);
14
15
  });
15
16
  return {
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
2
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
4
  export function getHeatmapUtilityClass(slot) {
4
5
  // Those should be common to all charts
5
6
  if (['highlighted', 'faded'].includes(slot)) {
@@ -1,2 +1,2 @@
1
- import { ChartsPlugin } from '@mui/x-charts/internals';
2
- export declare const plugin: ChartsPlugin<'heatmap'>;
1
+ import { ChartSeriesTypeConfig } from '@mui/x-charts/internals';
2
+ export declare const plugin: ChartSeriesTypeConfig<'heatmap'>;
package/Heatmap/plugin.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import { getBaseExtremum } from "./extremums.js";
2
2
  import formatter from "./formatter.js";
3
3
  import getColor from "./getColor.js";
4
+ import tooltipGetter from "./tooltip.js";
4
5
  export const plugin = {
5
- seriesType: 'heatmap',
6
- seriesFormatter: formatter,
6
+ seriesProcessor: formatter,
7
7
  colorProcessor: getColor,
8
+ legendGetter: () => [],
9
+ tooltipGetter,
8
10
  xExtremumGetter: getBaseExtremum,
9
11
  yExtremumGetter: getBaseExtremum
10
12
  };
@@ -0,0 +1,3 @@
1
+ import { TooltipGetter } from '@mui/x-charts/internals';
2
+ declare const tooltipGetter: TooltipGetter<'heatmap'>;
3
+ export default tooltipGetter;
@@ -0,0 +1,25 @@
1
+ import { getLabel } from '@mui/x-charts/internals';
2
+ const tooltipGetter = params => {
3
+ const {
4
+ series,
5
+ getColor,
6
+ identifier
7
+ } = params;
8
+ if (!identifier || identifier.dataIndex === undefined) {
9
+ return null;
10
+ }
11
+ const label = getLabel(series.label, 'tooltip');
12
+ const value = series.data[identifier.dataIndex];
13
+ const formattedValue = series.valueFormatter(value, {
14
+ dataIndex: identifier.dataIndex
15
+ });
16
+ return {
17
+ identifier,
18
+ color: getColor(identifier.dataIndex),
19
+ label,
20
+ value,
21
+ formattedValue,
22
+ markType: series.labelMarkType
23
+ };
24
+ };
25
+ export default tooltipGetter;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { LineChartProps } from '@mui/x-charts/LineChart';
3
- import { ZoomProps } from '../context/ZoomProvider';
4
- export interface LineChartProProps extends LineChartProps, ZoomProps {
3
+ import { ChartContainerProProps } from '../ChartContainerPro';
4
+ export interface LineChartProProps extends Omit<LineChartProps, 'apiRef'>, Omit<ChartContainerProProps<'line'>, 'series' | 'plugins' | 'seriesConfig'> {
5
5
  }
6
6
  /**
7
7
  * Demos:
@@ -2,12 +2,11 @@
2
2
 
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
- const _excluded = ["zoom", "onZoomChange"];
5
+ const _excluded = ["initialZoom", "onZoomChange", "apiRef"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { useThemeProps } from '@mui/material/styles';
9
9
  import { AreaPlot, LineHighlightPlot, LinePlot, MarkPlot } from '@mui/x-charts/LineChart';
10
- import { ChartsOnAxisClickHandler } from '@mui/x-charts/ChartsOnAxisClickHandler';
11
10
  import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
12
11
  import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
13
12
  import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
@@ -15,17 +14,17 @@ import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
15
14
  import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
16
15
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
17
16
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
18
- import { useLineChartProps } from '@mui/x-charts/internals';
19
- import { ChartContainerPro } from "../ChartContainerPro/index.js";
20
- import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
21
- import { useZoom } from "../context/ZoomProvider/useZoom.js";
17
+ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
18
+ import { useLineChartProps, ChartsWrapper } from '@mui/x-charts/internals';
19
+ import { useIsZoomInteracting } from "../hooks/zoom/index.js";
20
+ import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
21
+ import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
22
+ import { LINE_CHART_PRO_PLUGINS } from "./LineChartPro.plugins.js";
22
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
24
  function AreaPlotZoom(props) {
24
- const {
25
- isInteracting
26
- } = useZoom();
25
+ const isInteracting = useIsZoomInteracting();
27
26
  return /*#__PURE__*/_jsx(AreaPlot, _extends({}, props, {
28
- skipAnimation: isInteracting || undefined
27
+ skipAnimation: isInteracting || props.skipAnimation
29
28
  }));
30
29
  }
31
30
  process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
@@ -56,11 +55,9 @@ process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
56
55
  slots: PropTypes.object
57
56
  } : void 0;
58
57
  function LinePlotZoom(props) {
59
- const {
60
- isInteracting
61
- } = useZoom();
58
+ const isInteracting = useIsZoomInteracting();
62
59
  return /*#__PURE__*/_jsx(LinePlot, _extends({}, props, {
63
- skipAnimation: isInteracting || undefined
60
+ skipAnimation: isInteracting || props.skipAnimation
64
61
  }));
65
62
  }
66
63
  process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
@@ -91,9 +88,7 @@ process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
91
88
  slots: PropTypes.object
92
89
  } : void 0;
93
90
  function MarkPlotZoom(props) {
94
- const {
95
- isInteracting
96
- } = useZoom();
91
+ const isInteracting = useIsZoomInteracting();
97
92
  return /*#__PURE__*/_jsx(MarkPlot, _extends({}, props, {
98
93
  skipAnimation: isInteracting || undefined
99
94
  }));
@@ -103,12 +98,6 @@ process.env.NODE_ENV !== "production" ? MarkPlotZoom.propTypes = {
103
98
  // | These PropTypes are generated from the TypeScript type definitions |
104
99
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
105
100
  // ----------------------------------------------------------------------
106
- /**
107
- * If `true` the mark element will only be able to render circle.
108
- * Giving fewer customization options, but saving around 40ms per 1.000 marks.
109
- * @default false
110
- */
111
- experimentalRendering: PropTypes.bool,
112
101
  /**
113
102
  * Callback fired when a line mark item is clicked.
114
103
  * @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
@@ -147,13 +136,14 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
147
136
  name: 'MuiLineChartPro'
148
137
  });
149
138
  const {
150
- zoom,
151
- onZoomChange
139
+ initialZoom,
140
+ onZoomChange,
141
+ apiRef
152
142
  } = props,
153
143
  other = _objectWithoutPropertiesLoose(props, _excluded);
154
144
  const {
145
+ chartsWrapperProps,
155
146
  chartContainerProps,
156
- axisClickHandlerProps,
157
147
  gridProps,
158
148
  clipPathProps,
159
149
  clipPathGroupProps,
@@ -167,18 +157,27 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
167
157
  legendProps,
168
158
  children
169
159
  } = useLineChartProps(other);
160
+ const {
161
+ chartDataProviderProProps,
162
+ chartsSurfaceProps
163
+ } = useChartContainerProProps(_extends({}, chartContainerProps, {
164
+ initialZoom,
165
+ onZoomChange,
166
+ apiRef,
167
+ plugins: LINE_CHART_PRO_PLUGINS
168
+ }), ref);
170
169
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
171
- return /*#__PURE__*/_jsxs(ChartContainerPro, _extends({
172
- ref: ref
173
- }, chartContainerProps, {
174
- zoom: zoom,
175
- onZoomChange: onZoomChange,
176
- children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
177
- children: [/*#__PURE__*/_jsx(AreaPlotZoom, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlotZoom, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
178
- })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
179
- "data-drawing-container": true,
180
- children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
181
- }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
170
+ return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
171
+ children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
172
+ children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
173
+ children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
174
+ children: [/*#__PURE__*/_jsx(AreaPlotZoom, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlotZoom, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
175
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
176
+ "data-drawing-container": true,
177
+ children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
178
+ }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
179
+ }))]
180
+ }))
182
181
  }));
183
182
  });
184
183
  process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
@@ -186,6 +185,11 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
186
185
  // | These PropTypes are generated from the TypeScript type definitions |
187
186
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
188
187
  // ----------------------------------------------------------------------
188
+ apiRef: PropTypes.shape({
189
+ current: PropTypes.shape({
190
+ setZoomData: PropTypes.func.isRequired
191
+ })
192
+ }),
189
193
  /**
190
194
  * The configuration of axes highlight.
191
195
  * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
@@ -205,7 +209,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
205
209
  className: PropTypes.string,
206
210
  /**
207
211
  * Color palette used to colorize multiple series.
208
- * @default blueberryTwilightPalette
212
+ * @default rainbowSurgePalette
209
213
  */
210
214
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
211
215
  /**
@@ -223,10 +227,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
223
227
  * If `true`, render the line highlight item.
224
228
  */
225
229
  disableLineItemHighlight: PropTypes.bool,
226
- /**
227
- * If `true` marks will render `<circle />` instead of `<path />` and drop theme override for faster rendering.
228
- */
229
- experimentalMarkRendering: PropTypes.bool,
230
230
  /**
231
231
  * Option to display a cartesian grid in the background.
232
232
  */
@@ -243,12 +243,26 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
243
243
  */
244
244
  hideLegend: PropTypes.bool,
245
245
  /**
246
- * The item currently highlighted. Turns highlighting into a controlled prop.
246
+ * The highlighted item.
247
+ * Used when the highlight is controlled.
247
248
  */
248
249
  highlightedItem: PropTypes.shape({
249
250
  dataIndex: PropTypes.number,
250
- seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
251
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
251
252
  }),
253
+ /**
254
+ * This prop is used to help implement the accessibility logic.
255
+ * If you don't provide this prop. It falls back to a randomly generated id.
256
+ */
257
+ id: PropTypes.string,
258
+ /**
259
+ * The list of zoom data related to each axis.
260
+ */
261
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
262
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
263
+ end: PropTypes.number.isRequired,
264
+ start: PropTypes.number.isRequired
265
+ })),
252
266
  /**
253
267
  * Indicate which axis to display the left of the charts.
254
268
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -264,7 +278,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
264
278
  * The margin between the SVG and the drawing area.
265
279
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
266
280
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
267
- * @default object Depends on the charts type.
268
281
  */
269
282
  margin: PropTypes.shape({
270
283
  bottom: PropTypes.number,
@@ -330,6 +343,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
330
343
  */
331
344
  slots: PropTypes.object,
332
345
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
346
+ theme: PropTypes.oneOf(['dark', 'light']),
333
347
  title: PropTypes.string,
334
348
  /**
335
349
  * Indicate which axis to display the top of the charts.
@@ -372,7 +386,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
372
386
  hideTooltip: PropTypes.bool,
373
387
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
374
388
  label: PropTypes.string,
375
- labelFontSize: PropTypes.number,
376
389
  labelStyle: PropTypes.object,
377
390
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
378
391
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -383,7 +396,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
383
396
  slots: PropTypes.object,
384
397
  stroke: PropTypes.string,
385
398
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
386
- tickFontSize: PropTypes.number,
387
399
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
388
400
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
389
401
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -435,7 +447,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
435
447
  hideTooltip: PropTypes.bool,
436
448
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
437
449
  label: PropTypes.string,
438
- labelFontSize: PropTypes.number,
439
450
  labelStyle: PropTypes.object,
440
451
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
441
452
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -446,7 +457,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
446
457
  slots: PropTypes.object,
447
458
  stroke: PropTypes.string,
448
459
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
449
- tickFontSize: PropTypes.number,
450
460
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
451
461
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
452
462
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -468,12 +478,29 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
468
478
  }), PropTypes.bool])
469
479
  })),
470
480
  /**
471
- * The list of zoom data related to each axis.
481
+ * The configuration of the z-axes.
472
482
  */
473
- zoom: PropTypes.arrayOf(PropTypes.shape({
474
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
475
- end: PropTypes.number.isRequired,
476
- start: PropTypes.number.isRequired
483
+ zAxis: PropTypes.arrayOf(PropTypes.shape({
484
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
485
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
486
+ type: PropTypes.oneOf(['ordinal']).isRequired,
487
+ unknownColor: PropTypes.string,
488
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
489
+ }), PropTypes.shape({
490
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
491
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
492
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
493
+ type: PropTypes.oneOf(['continuous']).isRequired
494
+ }), PropTypes.shape({
495
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
496
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
497
+ type: PropTypes.oneOf(['piecewise']).isRequired
498
+ })]),
499
+ data: PropTypes.array,
500
+ dataKey: PropTypes.string,
501
+ id: PropTypes.string,
502
+ max: PropTypes.number,
503
+ min: PropTypes.number
477
504
  }))
478
505
  } : void 0;
479
506
  export { LineChartPro };
@@ -0,0 +1,10 @@
1
+ import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
2
+ import { UseChartProZoomSignature } from '../internals/plugins/useChartProZoom';
3
+ export type LineChartProPluginsSignatures = [
4
+ UseChartZAxisSignature,
5
+ UseChartCartesianAxisSignature<'line'>,
6
+ UseChartInteractionSignature,
7
+ UseChartHighlightSignature,
8
+ UseChartProZoomSignature
9
+ ];
10
+ export declare const LINE_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<LineChartProPluginsSignatures>;
@@ -0,0 +1,3 @@
1
+ import { useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight } from '@mui/x-charts/internals';
2
+ import { useChartProZoom } from "../internals/plugins/useChartProZoom/index.js";
3
+ export const LINE_CHART_PRO_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartProZoom];
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # MUI X Pro
2
2
 
3
3
  This package is the Pro plan edition of the chart components.
4
- It's part of [MUI X](https://mui.com/x/), an open-core extension of MUI Core, with advanced components.
4
+ It's part of [MUI X](https://mui.com/x/), an open-core extension of our Core libraries, with advanced components.
5
5
 
6
6
  ## Installation
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ScatterChartProps } from '@mui/x-charts/ScatterChart';
3
- import { ZoomProps } from '../context/ZoomProvider';
4
- export interface ScatterChartProProps extends ScatterChartProps, ZoomProps {
3
+ import { ChartContainerProProps } from '../ChartContainerPro/ChartContainerPro';
4
+ export interface ScatterChartProProps extends Omit<ScatterChartProps, 'apiRef'>, Omit<ChartContainerProProps<'scatter'>, 'series' | 'plugins' | 'seriesConfig'> {
5
5
  }
6
6
  /**
7
7
  * Demos: