@mui/x-charts 8.4.0 → 8.5.1

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 (194) hide show
  1. package/BarChart/BarChart.d.ts +9 -2
  2. package/BarChart/BarChart.js +7 -1
  3. package/BarChart/BarLabel/BarLabel.d.ts +1 -1
  4. package/BarChart/seriesConfig/seriesProcessor.js +1 -1
  5. package/BarChart/useBarChartProps.js +1 -1
  6. package/CHANGELOG.md +215 -0
  7. package/ChartContainer/ChartContainer.d.ts +21 -2
  8. package/ChartContainer/ChartContainer.js +16 -0
  9. package/ChartContainer/useChartContainerProps.js +7 -3
  10. package/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  11. package/ChartDataProvider/ChartDataProvider.js +19 -2
  12. package/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  13. package/ChartDataProvider/useChartDataProviderProps.js +7 -3
  14. package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
  15. package/ChartsGrid/styledComponents.d.ts +2 -2
  16. package/ChartsReferenceLine/common.d.ts +1 -1
  17. package/ChartsTooltip/ChartsTooltip.js +1 -1
  18. package/ChartsTooltip/ChartsTooltipContainer.js +21 -16
  19. package/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
  20. package/ChartsTooltip/utils.d.ts +6 -0
  21. package/ChartsTooltip/utils.js +19 -1
  22. package/LineChart/LineChart.d.ts +9 -2
  23. package/LineChart/LineChart.js +7 -1
  24. package/LineChart/useLineChartProps.js +1 -1
  25. package/PieChart/PieChart.d.ts +10 -3
  26. package/PieChart/PieChart.js +12 -11
  27. package/RadarChart/RadarChart.d.ts +21 -3
  28. package/RadarChart/RadarChart.js +16 -2
  29. package/RadarChart/RadarChart.plugins.d.ts +5 -0
  30. package/RadarChart/RadarChart.plugins.js +10 -0
  31. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  32. package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
  33. package/RadarChart/index.d.ts +2 -0
  34. package/RadarChart/index.js +15 -1
  35. package/RadarChart/useRadarChartProps.d.ts +2 -1
  36. package/RadarChart/useRadarChartProps.js +3 -1
  37. package/ScatterChart/ScatterChart.d.ts +9 -2
  38. package/ScatterChart/ScatterChart.js +7 -1
  39. package/ScatterChart/useScatterChartProps.js +4 -2
  40. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  41. package/Toolbar/Toolbar.d.ts +11 -4
  42. package/Toolbar/Toolbar.js +38 -7
  43. package/Toolbar/Toolbar.types.d.ts +15 -0
  44. package/Toolbar/Toolbar.types.js +5 -0
  45. package/Toolbar/ToolbarButton.d.ts +8 -2
  46. package/Toolbar/ToolbarButton.js +39 -7
  47. package/Toolbar/chartToolbarClasses.d.ts +6 -0
  48. package/Toolbar/chartToolbarClasses.js +9 -0
  49. package/Toolbar/index.d.ts +3 -1
  50. package/Toolbar/index.js +22 -0
  51. package/context/ChartsSlotsContext.d.ts +20 -0
  52. package/context/ChartsSlotsContext.js +44 -0
  53. package/context/index.d.ts +2 -1
  54. package/context/index.js +11 -0
  55. package/context/useChartApiContext.d.ts +10 -0
  56. package/context/useChartApiContext.js +27 -0
  57. package/esm/BarChart/BarChart.d.ts +9 -2
  58. package/esm/BarChart/BarChart.js +7 -1
  59. package/esm/BarChart/BarLabel/BarLabel.d.ts +1 -1
  60. package/esm/BarChart/seriesConfig/seriesProcessor.js +1 -1
  61. package/esm/BarChart/useBarChartProps.js +1 -1
  62. package/esm/ChartContainer/ChartContainer.d.ts +21 -2
  63. package/esm/ChartContainer/ChartContainer.js +16 -0
  64. package/esm/ChartContainer/useChartContainerProps.js +7 -3
  65. package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  66. package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
  67. package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  68. package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
  69. package/esm/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
  70. package/esm/ChartsGrid/styledComponents.d.ts +2 -2
  71. package/esm/ChartsReferenceLine/common.d.ts +1 -1
  72. package/esm/ChartsTooltip/ChartsTooltip.js +1 -1
  73. package/esm/ChartsTooltip/ChartsTooltipContainer.js +22 -17
  74. package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
  75. package/esm/ChartsTooltip/utils.d.ts +6 -0
  76. package/esm/ChartsTooltip/utils.js +16 -1
  77. package/esm/LineChart/LineChart.d.ts +9 -2
  78. package/esm/LineChart/LineChart.js +7 -1
  79. package/esm/LineChart/useLineChartProps.js +1 -1
  80. package/esm/PieChart/PieChart.d.ts +10 -3
  81. package/esm/PieChart/PieChart.js +12 -11
  82. package/esm/RadarChart/RadarChart.d.ts +21 -3
  83. package/esm/RadarChart/RadarChart.js +16 -2
  84. package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
  85. package/esm/RadarChart/RadarChart.plugins.js +4 -0
  86. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  87. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
  88. package/esm/RadarChart/index.d.ts +2 -0
  89. package/esm/RadarChart/index.js +2 -0
  90. package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
  91. package/esm/RadarChart/useRadarChartProps.js +3 -1
  92. package/esm/ScatterChart/ScatterChart.d.ts +9 -2
  93. package/esm/ScatterChart/ScatterChart.js +7 -1
  94. package/esm/ScatterChart/useScatterChartProps.js +4 -2
  95. package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
  96. package/esm/Toolbar/Toolbar.d.ts +11 -4
  97. package/esm/Toolbar/Toolbar.js +36 -6
  98. package/esm/Toolbar/Toolbar.types.d.ts +15 -0
  99. package/esm/Toolbar/Toolbar.types.js +1 -0
  100. package/esm/Toolbar/ToolbarButton.d.ts +8 -2
  101. package/esm/Toolbar/ToolbarButton.js +39 -6
  102. package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
  103. package/esm/Toolbar/chartToolbarClasses.js +2 -0
  104. package/esm/Toolbar/index.d.ts +3 -1
  105. package/esm/Toolbar/index.js +3 -1
  106. package/esm/context/ChartsSlotsContext.d.ts +20 -0
  107. package/esm/context/ChartsSlotsContext.js +35 -0
  108. package/esm/context/index.d.ts +2 -1
  109. package/esm/context/index.js +1 -0
  110. package/esm/context/useChartApiContext.d.ts +10 -0
  111. package/esm/context/useChartApiContext.js +21 -0
  112. package/esm/hooks/index.d.ts +1 -0
  113. package/esm/hooks/index.js +1 -0
  114. package/esm/index.js +1 -1
  115. package/esm/internals/components/AxisSharedComponents.d.ts +1 -1
  116. package/esm/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  117. package/esm/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
  118. package/esm/internals/constants.d.ts +10 -1
  119. package/esm/internals/constants.js +10 -1
  120. package/esm/internals/dateHelpers.d.ts +15 -0
  121. package/esm/internals/dateHelpers.js +20 -0
  122. package/esm/internals/domUtils.d.ts +1 -2
  123. package/esm/internals/domUtils.js +8 -19
  124. package/esm/internals/index.d.ts +6 -1
  125. package/esm/internals/index.js +6 -1
  126. package/esm/internals/invertScale.d.ts +2 -0
  127. package/esm/internals/invertScale.js +8 -0
  128. package/esm/internals/material/index.d.ts +2 -0
  129. package/esm/internals/material/index.js +2 -0
  130. package/esm/internals/plugins/allPlugins.d.ts +1 -0
  131. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
  132. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  133. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
  134. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  135. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3000 -0
  136. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -1
  137. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
  138. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  139. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  140. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
  141. package/esm/locales/index.d.ts +3 -1
  142. package/esm/locales/index.js +2 -0
  143. package/esm/locales/ptBR.d.ts +16 -0
  144. package/esm/locales/ptBR.js +9 -0
  145. package/esm/locales/ptPT.d.ts +16 -0
  146. package/esm/locales/ptPT.js +9 -0
  147. package/esm/models/axis.d.ts +2 -1
  148. package/esm/models/index.d.ts +2 -2
  149. package/esm/models/index.js +1 -0
  150. package/esm/models/seriesType/bar.d.ts +2 -2
  151. package/esm/models/slots/chartsBaseSlotProps.d.ts +7 -0
  152. package/esm/models/slots/chartsBaseSlots.d.ts +2 -1
  153. package/hooks/index.d.ts +1 -0
  154. package/hooks/index.js +12 -0
  155. package/index.js +1 -1
  156. package/internals/components/AxisSharedComponents.d.ts +1 -1
  157. package/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  158. package/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
  159. package/internals/constants.d.ts +10 -1
  160. package/internals/constants.js +11 -2
  161. package/internals/dateHelpers.d.ts +15 -0
  162. package/internals/dateHelpers.js +28 -0
  163. package/internals/domUtils.d.ts +1 -2
  164. package/internals/domUtils.js +8 -20
  165. package/internals/index.d.ts +6 -1
  166. package/internals/index.js +68 -8
  167. package/internals/invertScale.d.ts +2 -0
  168. package/internals/invertScale.js +14 -0
  169. package/internals/material/index.d.ts +2 -0
  170. package/internals/material/index.js +2 -0
  171. package/internals/plugins/allPlugins.d.ts +1 -0
  172. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
  173. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  174. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
  175. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  176. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3000 -0
  177. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +10 -2
  178. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
  179. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  180. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  181. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
  182. package/locales/index.d.ts +3 -1
  183. package/locales/index.js +22 -0
  184. package/locales/ptBR.d.ts +16 -0
  185. package/locales/ptBR.js +15 -0
  186. package/locales/ptPT.d.ts +16 -0
  187. package/locales/ptPT.js +15 -0
  188. package/models/axis.d.ts +2 -1
  189. package/models/index.d.ts +2 -2
  190. package/models/index.js +11 -0
  191. package/models/seriesType/bar.d.ts +2 -2
  192. package/models/slots/chartsBaseSlotProps.d.ts +7 -0
  193. package/models/slots/chartsBaseSlots.d.ts +2 -1
  194. package/package.json +5 -5
@@ -1,11 +1,30 @@
1
1
  import * as React from 'react';
2
+ import { PieChartPluginSignatures } from "../PieChart/PieChart.plugins.js";
3
+ import { BarChartPluginsSignatures } from "../BarChart/BarChart.plugins.js";
4
+ import { ScatterChartPluginsSignatures } from "../ScatterChart/ScatterChart.plugins.js";
5
+ import { LineChartPluginsSignatures } from "../LineChart/LineChart.plugins.js";
2
6
  import { ChartSeriesType } from "../models/seriesType/config.js";
3
7
  import { ChartDataProviderProps } from "../ChartDataProvider/index.js";
4
8
  import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
5
- import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
9
+ import { AllPluginSignatures, DefaultPluginSignatures } from "../internals/plugins/allPlugins.js";
6
10
  import { ChartAnyPluginSignature } from "../internals/plugins/models/plugin.js";
11
+ import { ChartPublicAPI } from "../internals/plugins/models/index.js";
7
12
  export type ChartContainerProps<SeriesType extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<SeriesType>> = Omit<ChartDataProviderProps<SeriesType, TSignatures>, 'children'> & ChartsSurfaceProps;
8
- export type ChartApi = NonNullable<NonNullable<ChartContainerProps['apiRef']>['current']>;
13
+ type PluginsPerSeriesType = {
14
+ line: LineChartPluginsSignatures;
15
+ scatter: ScatterChartPluginsSignatures;
16
+ bar: BarChartPluginsSignatures;
17
+ pie: PieChartPluginSignatures;
18
+ composition: DefaultPluginSignatures;
19
+ };
20
+ /**
21
+ * The API of the chart `apiRef` object.
22
+ * The chart type can be passed as the first generic parameter to narrow down the API to the specific chart type.
23
+ * @example ChartApi<'bar'>
24
+ * If the chart is being created using composition, the `composition` value can be used.
25
+ * @example ChartApi<'composition'>
26
+ */
27
+ export type ChartApi<TSeries extends keyof PluginsPerSeriesType | undefined = undefined, TSignatures extends readonly ChartAnyPluginSignature[] = (TSeries extends keyof PluginsPerSeriesType ? PluginsPerSeriesType[TSeries] : AllPluginSignatures)> = ChartPublicAPI<TSignatures>;
9
28
  /**
10
29
  * It sets up the data providers as well as the `<svg>` for the chart.
11
30
  *
@@ -6,6 +6,14 @@ import PropTypes from 'prop-types';
6
6
  import { ChartDataProvider } from "../ChartDataProvider/index.js";
7
7
  import { useChartContainerProps } from "./useChartContainerProps.js";
8
8
  import { ChartsSurface } from "../ChartsSurface/index.js";
9
+
10
+ /**
11
+ * The API of the chart `apiRef` object.
12
+ * The chart type can be passed as the first generic parameter to narrow down the API to the specific chart type.
13
+ * @example ChartApi<'bar'>
14
+ * If the chart is being created using composition, the `composition` value can be used.
15
+ * @example ChartApi<'composition'>
16
+ */
9
17
  import { jsx as _jsx } from "react/jsx-runtime";
10
18
  /**
11
19
  * It sets up the data providers as well as the `<svg>` for the chart.
@@ -586,6 +594,14 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
586
594
  * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
587
595
  */
588
596
  skipAnimation: PropTypes.bool,
597
+ /**
598
+ * The props for the slots.
599
+ */
600
+ slotProps: PropTypes.object,
601
+ /**
602
+ * Slots to customize charts' components.
603
+ */
604
+ slots: PropTypes.object,
589
605
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
590
606
  theme: PropTypes.oneOf(['dark', 'light']),
591
607
  title: PropTypes.string,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText"];
5
+ const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText", "slots", "slotProps"];
6
6
  import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
7
7
  export const useChartContainerProps = (props, ref) => {
8
8
  const _ref = props,
@@ -32,7 +32,9 @@ export const useChartContainerProps = (props, ref) => {
32
32
  skipAnimation,
33
33
  seriesConfig,
34
34
  plugins,
35
- localeText
35
+ localeText,
36
+ slots,
37
+ slotProps
36
38
  } = _ref,
37
39
  other = _objectWithoutPropertiesLoose(_ref, _excluded);
38
40
  const chartsSurfaceProps = _extends({
@@ -63,7 +65,9 @@ export const useChartContainerProps = (props, ref) => {
63
65
  height,
64
66
  localeText,
65
67
  seriesConfig,
66
- plugins: plugins ?? DEFAULT_PLUGINS
68
+ plugins: plugins ?? DEFAULT_PLUGINS,
69
+ slots,
70
+ slotProps
67
71
  };
68
72
  return {
69
73
  chartDataProviderProps,
@@ -1,10 +1,20 @@
1
1
  import * as React from 'react';
2
+ import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
2
3
  import { ChartProviderProps } from "../context/ChartProvider/index.js";
3
4
  import { ChartSeriesType } from "../models/seriesType/config.js";
4
5
  import { ChartAnyPluginSignature } from "../internals/plugins/models/plugin.js";
5
6
  import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
6
7
  import { ChartsLocalizationProviderProps } from "../ChartsLocalizationProvider/index.js";
7
- export type ChartDataProviderProps<TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>> = React.PropsWithChildren<ChartProviderProps<TSeries, TSignatures>['pluginParams'] & Pick<ChartProviderProps<TSeries, TSignatures>, 'seriesConfig' | 'plugins'>> & ChartsLocalizationProviderProps;
8
+ export type ChartDataProviderProps<TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>> = React.PropsWithChildren<ChartProviderProps<TSeries, TSignatures>['pluginParams'] & Pick<ChartProviderProps<TSeries, TSignatures>, 'seriesConfig' | 'plugins'>> & ChartsLocalizationProviderProps & {
9
+ /**
10
+ * Slots to customize charts' components.
11
+ */
12
+ slots?: Partial<ChartsSlots>;
13
+ /**
14
+ * The props for the slots.
15
+ */
16
+ slotProps?: Partial<ChartsSlotProps>;
17
+ };
8
18
  /**
9
19
  * Orchestrates the data providers for the chart components and hooks.
10
20
  *
@@ -3,6 +3,8 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import { defaultSlotsMaterial } from "../internals/material/index.js";
7
+ import { ChartsSlotsProvider } from "../context/ChartsSlotsContext.js";
6
8
  import { useChartDataProviderProps } from "./useChartDataProviderProps.js";
7
9
  import { ChartProvider } from "../context/ChartProvider/index.js";
8
10
  import { ChartsLocalizationProvider } from "../ChartsLocalizationProvider/index.js";
@@ -38,12 +40,19 @@ function ChartDataProvider(props) {
38
40
  const {
39
41
  children,
40
42
  localeText,
41
- chartProviderProps
43
+ chartProviderProps,
44
+ slots,
45
+ slotProps
42
46
  } = useChartDataProviderProps(props);
43
47
  return /*#__PURE__*/_jsx(ChartProvider, _extends({}, chartProviderProps, {
44
48
  children: /*#__PURE__*/_jsx(ChartsLocalizationProvider, {
45
49
  localeText: localeText,
46
- children: children
50
+ children: /*#__PURE__*/_jsx(ChartsSlotsProvider, {
51
+ slots: slots,
52
+ slotProps: slotProps,
53
+ defaultSlots: defaultSlotsMaterial,
54
+ children: children
55
+ })
47
56
  })
48
57
  }));
49
58
  }
@@ -100,6 +109,14 @@ process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
100
109
  * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
101
110
  */
102
111
  skipAnimation: PropTypes.bool,
112
+ /**
113
+ * The props for the slots.
114
+ */
115
+ slotProps: PropTypes.object,
116
+ /**
117
+ * Slots to customize charts' components.
118
+ */
119
+ slots: PropTypes.object,
103
120
  theme: PropTypes.oneOf(['dark', 'light']),
104
121
  /**
105
122
  * The width of the chart in px. If not defined, it takes the width of the parent element.
@@ -8,4 +8,6 @@ export declare const useChartDataProviderProps: <TSeries extends ChartSeriesType
8
8
  children: import("react").ReactNode;
9
9
  localeText: Partial<import("../locales/index.js").ChartsLocaleText> | undefined;
10
10
  chartProviderProps: ChartProviderProps<TSeries, TSignatures>;
11
+ slots: Partial<import("../internals/index.js").ChartsSlots> | undefined;
12
+ slotProps: Partial<import("../internals/index.js").ChartsSlotProps> | undefined;
11
13
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["children", "localeText", "plugins", "seriesConfig"];
5
+ const _excluded = ["children", "localeText", "plugins", "seriesConfig", "slots", "slotProps"];
6
6
  import { useTheme } from '@mui/material/styles';
7
7
  import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
8
8
  export const useChartDataProviderProps = props => {
@@ -10,7 +10,9 @@ export const useChartDataProviderProps = props => {
10
10
  children,
11
11
  localeText,
12
12
  plugins = DEFAULT_PLUGINS,
13
- seriesConfig
13
+ seriesConfig,
14
+ slots,
15
+ slotProps
14
16
  } = props,
15
17
  other = _objectWithoutPropertiesLoose(props, _excluded);
16
18
  const theme = useTheme();
@@ -24,6 +26,8 @@ export const useChartDataProviderProps = props => {
24
26
  return {
25
27
  children,
26
28
  localeText,
27
- chartProviderProps
29
+ chartProviderProps,
30
+ slots,
31
+ slotProps
28
32
  };
29
33
  };
@@ -1,5 +1,5 @@
1
1
  import { ChartsAxisHighlightType } from "./ChartsAxisHighlight.types.js";
2
- export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
2
+ export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
3
3
  ownerState: {
4
4
  axisHighlight: ChartsAxisHighlightType;
5
5
  };
@@ -1,2 +1,2 @@
1
- export declare const GridRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
2
- export declare const GridLine: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").SVGLineElementAttributes<SVGLineElement>, keyof import("react").SVGLineElementAttributes<SVGLineElement>>, {}>;
1
+ export declare const GridRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
2
+ export declare const GridLine: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGLineElementAttributes<SVGLineElement>, keyof import("react").SVGLineElementAttributes<SVGLineElement>>, {}>;
@@ -38,4 +38,4 @@ export type CommonChartsReferenceLineProps = {
38
38
  */
39
39
  classes?: Partial<ChartsReferenceLineClasses>;
40
40
  };
41
- export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGGElement>, {}>;
41
+ export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").SVGProps<SVGGElement>, {}>;
@@ -25,7 +25,7 @@ function ChartsTooltip(props) {
25
25
  } = props;
26
26
  const classes = useUtilityClasses(propClasses);
27
27
  return /*#__PURE__*/_jsx(ChartsTooltipContainer, _extends({}, props, {
28
- classes: classes,
28
+ classes: propClasses,
29
29
  children: trigger === 'axis' ? /*#__PURE__*/_jsx(ChartsAxisTooltipContent, {
30
30
  classes: classes
31
31
  }) : /*#__PURE__*/_jsx(ChartsItemTooltipContent, {
@@ -11,7 +11,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
11
11
  import Popper from '@mui/material/Popper';
12
12
  import NoSsr from '@mui/material/NoSsr';
13
13
  import { useSvgRef } from "../hooks/useSvgRef.js";
14
- import { usePointerType } from "./utils.js";
14
+ import { useIsFineMainPointer, usePointerType } from "./utils.js";
15
+ import { useUtilityClasses } from "./chartsTooltipClasses.js";
15
16
  import { useSelector } from "../internals/store/useSelector.js";
16
17
  import { useStore } from "../internals/store/useStore.js";
17
18
  import { selectorChartsInteractionItemIsDefined } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
@@ -46,12 +47,14 @@ function ChartsTooltipContainer(inProps) {
46
47
  });
47
48
  const {
48
49
  trigger = 'axis',
49
- classes,
50
+ classes: propClasses,
50
51
  children
51
52
  } = props,
52
53
  other = _objectWithoutPropertiesLoose(props, _excluded);
54
+ const classes = useUtilityClasses(propClasses);
53
55
  const svgRef = useSvgRef();
54
56
  const pointerType = usePointerType();
57
+ const isFineMainPointer = useIsFineMainPointer();
55
58
  const popperRef = React.useRef(null);
56
59
  const positionRef = useLazyRef(() => ({
57
60
  x: 0,
@@ -60,14 +63,12 @@ function ChartsTooltipContainer(inProps) {
60
63
  const axisSystem = useAxisSystem();
61
64
  const store = useStore();
62
65
  const isOpen = useSelector(store, trigger === 'axis' ? axisSystem === 'polar' && selectorChartsInteractionPolarAxisTooltip || axisSystem === 'cartesian' && selectorChartsInteractionAxisTooltip || noAxis : selectorChartsInteractionItemIsDefined);
63
- const popperOpen = pointerType !== null && isOpen; // tooltipHasData;
64
-
65
66
  React.useEffect(() => {
66
67
  const element = svgRef.current;
67
68
  if (element === null) {
68
69
  return () => {};
69
70
  }
70
- const handleMove = event => {
71
+ const handlePointerEvent = event => {
71
72
  // eslint-disable-next-line react-compiler/react-compiler
72
73
  positionRef.current = {
73
74
  x: event.clientX,
@@ -75,9 +76,11 @@ function ChartsTooltipContainer(inProps) {
75
76
  };
76
77
  popperRef.current?.update();
77
78
  };
78
- element.addEventListener('pointermove', handleMove);
79
+ element.addEventListener('pointerdown', handlePointerEvent);
80
+ element.addEventListener('pointermove', handlePointerEvent);
79
81
  return () => {
80
- element.removeEventListener('pointermove', handleMove);
82
+ element.removeEventListener('pointerdown', handlePointerEvent);
83
+ element.removeEventListener('pointermove', handlePointerEvent);
81
84
  };
82
85
  }, [svgRef, positionRef]);
83
86
  const anchorEl = React.useMemo(() => ({
@@ -93,32 +96,34 @@ function ChartsTooltipContainer(inProps) {
93
96
  toJSON: () => ''
94
97
  })
95
98
  }), [positionRef]);
99
+ const isMouse = pointerType?.pointerType === 'mouse' || isFineMainPointer;
100
+ const isTouch = pointerType?.pointerType === 'touch' || !isFineMainPointer;
96
101
  const modifiers = React.useMemo(() => [{
97
102
  name: 'offset',
98
103
  options: {
99
104
  offset: () => {
100
- if (pointerType?.pointerType !== 'touch') {
101
- // The popper offset: [skidding, distance]
102
- return [0, 8];
105
+ if (isTouch) {
106
+ return [0, 64];
103
107
  }
104
- return [0, 64];
108
+ // The popper offset: [skidding, distance]
109
+ return [0, 8];
105
110
  }
106
111
  }
107
- }, ...(pointerType?.pointerType === 'mouse' ? [] // Keep default behavior
108
- : [{
112
+ }, ...(!isMouse ? [{
109
113
  name: 'flip',
110
114
  options: {
111
115
  fallbackPlacements: ['top-end', 'top-start', 'bottom-end', 'bottom']
112
116
  }
113
- }])], [pointerType]);
117
+ }] : []) // Keep default behavior
118
+ ], [isMouse, isTouch]);
114
119
  if (trigger === 'none') {
115
120
  return null;
116
121
  }
117
122
  return /*#__PURE__*/_jsx(NoSsr, {
118
- children: popperOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({
123
+ children: isOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({
119
124
  className: classes?.root,
120
- open: popperOpen,
121
- placement: pointerType?.pointerType === 'mouse' ? 'right-start' : 'top',
125
+ open: isOpen,
126
+ placement: isMouse ? 'right-start' : 'top',
122
127
  popperRef: popperRef,
123
128
  anchorEl: anchorEl,
124
129
  modifiers: modifiers
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * @ignore - internal component.
3
3
  */
4
- export declare const ChartsTooltipPaper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
4
+ export declare const ChartsTooltipPaper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
5
5
  /**
6
6
  * @ignore - internal component.
7
7
  */
8
- export declare const ChartsTooltipTable: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, keyof import("react").ClassAttributes<HTMLTableElement> | keyof import("react").TableHTMLAttributes<HTMLTableElement>>, {}>;
8
+ export declare const ChartsTooltipTable: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, keyof import("react").ClassAttributes<HTMLTableElement> | keyof import("react").TableHTMLAttributes<HTMLTableElement>>, {}>;
9
9
  /**
10
10
  * @ignore - internal component.
11
11
  */
12
- export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, keyof import("react").ClassAttributes<HTMLTableRowElement> | keyof import("react").HTMLAttributes<HTMLTableRowElement>>, {}>;
12
+ export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, keyof import("react").ClassAttributes<HTMLTableRowElement> | keyof import("react").HTMLAttributes<HTMLTableRowElement>>, {}>;
13
13
  /**
14
14
  * @ignore - internal component.
15
15
  */
16
- export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "sx" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
16
+ export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
17
17
  component?: React.ElementType;
18
18
  }, {}, {}>;
@@ -13,4 +13,10 @@ type PointerType = Pick<MousePosition, 'pointerType'>;
13
13
  export declare function usePointerType(): null | PointerType;
14
14
  export type TriggerOptions = 'item' | 'axis' | 'none';
15
15
  export declare function utcFormatter(v: string | number | Date): string;
16
+ /**
17
+ * Returns true if the main pointer is fine (e.g. mouse).
18
+ * This is useful for determining how to position tooltips or other UI elements based on the type of input device.
19
+ * @returns true if the main pointer is fine, false otherwise.
20
+ */
21
+ export declare const useIsFineMainPointer: () => boolean;
16
22
  export {};
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import * as React from 'react';
4
+ import useMediaQuery from '@mui/material/useMediaQuery';
4
5
  import { useSvgRef } from "../hooks/index.js";
5
6
  /**
6
7
  * @deprecated We recommend using vanilla JS to let popper track mouse position.
@@ -80,4 +81,18 @@ export function utcFormatter(v) {
80
81
  return v.toUTCString();
81
82
  }
82
83
  return v.toLocaleString();
83
- }
84
+ }
85
+
86
+ // Taken from @mui/x-date-time-pickers
87
+ const mainPointerFineMediaQuery = '@media (pointer: fine)';
88
+
89
+ /**
90
+ * Returns true if the main pointer is fine (e.g. mouse).
91
+ * This is useful for determining how to position tooltips or other UI elements based on the type of input device.
92
+ * @returns true if the main pointer is fine, false otherwise.
93
+ */
94
+ export const useIsFineMainPointer = () => {
95
+ return useMediaQuery(mainPointerFineMediaQuery, {
96
+ defaultMatches: true
97
+ });
98
+ };
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { MakeOptional } from '@mui/x-internals/types';
3
+ import { ChartsSlots, ChartsSlotProps } from "../internals/material/index.js";
3
4
  import { AreaPlotProps, AreaPlotSlotProps, AreaPlotSlots } from "./AreaPlot.js";
4
5
  import { LinePlotProps, LinePlotSlotProps, LinePlotSlots } from "./LinePlot.js";
5
6
  import { ChartContainerProps } from "../ChartContainer/index.js";
@@ -14,8 +15,9 @@ import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from "./LineHighli
14
15
  import { ChartsGridProps } from "../ChartsGrid/index.js";
15
16
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
16
17
  import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
17
- export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
18
- export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
18
+ import { ChartsToolbarSlots, ChartsToolbarSlotProps } from "../Toolbar/index.js";
19
+ export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
20
+ export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
19
21
  export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
20
22
  /**
21
23
  * The series to display in the line chart.
@@ -67,6 +69,11 @@ export interface LineChartProps extends Omit<ChartContainerProps<'line', LineCha
67
69
  * @default false
68
70
  */
69
71
  skipAnimation?: boolean;
72
+ /**
73
+ * If true, shows the default chart toolbar.
74
+ * @default false
75
+ */
76
+ showToolbar?: boolean;
70
77
  }
71
78
  /**
72
79
  * Demos:
@@ -57,9 +57,10 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
57
57
  chartsSurfaceProps
58
58
  } = useChartContainerProps(chartContainerProps, ref);
59
59
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
60
+ const Toolbar = props.slots?.toolbar;
60
61
  return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
61
62
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
62
- children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
63
+ children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
63
64
  children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
64
65
  children: [/*#__PURE__*/_jsx(AreaPlot, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlot, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
65
66
  })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
@@ -189,6 +190,11 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
189
190
  * An array of [[LineSeriesType]] objects.
190
191
  */
191
192
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
193
+ /**
194
+ * If true, shows the default chart toolbar.
195
+ * @default false
196
+ */
197
+ showToolbar: PropTypes.bool,
192
198
  /**
193
199
  * If `true`, animations are skipped.
194
200
  * @default false
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className"];
5
+ const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
6
6
  import * as React from 'react';
7
7
  import useId from '@mui/utils/useId';
8
8
  import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { MakeOptional } from '@mui/x-internals/types';
3
+ import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
4
+ import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
3
5
  import { ChartContainerProps } from "../ChartContainer/index.js";
4
6
  import { PieSeriesType } from "../models/seriesType/index.js";
5
7
  import { ChartsTooltipSlots, ChartsTooltipSlotProps } from "../ChartsTooltip/ChartTooltip.types.js";
@@ -8,9 +10,9 @@ import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from "./PiePlot.js";
8
10
  import { PieValueType } from "../models/seriesType/pie.js";
9
11
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
10
12
  import { PieChartPluginSignatures } from "./PieChart.plugins.js";
11
- export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
12
- export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
13
- export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
13
+ export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
14
+ export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
15
+ export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series' | 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
14
16
  /**
15
17
  * The series to display in the pie chart.
16
18
  * An array of [[PieSeriesType]] objects.
@@ -24,6 +26,11 @@ export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartP
24
26
  * Callback fired when a pie arc is clicked.
25
27
  */
26
28
  onItemClick?: PiePlotProps['onItemClick'];
29
+ /**
30
+ * If true, shows the default chart toolbar.
31
+ * @default false
32
+ */
33
+ showToolbar?: boolean;
27
34
  /**
28
35
  * Overridable component slots.
29
36
  * @default {}