diff --git a/docs/pages/x/api/charts/charts-tooltip-container.json b/docs/pages/x/api/charts/charts-tooltip-container.json
index 5eae783a77e06..9cd49bc06e0b5 100644
--- a/docs/pages/x/api/charts/charts-tooltip-container.json
+++ b/docs/pages/x/api/charts/charts-tooltip-container.json
@@ -3,7 +3,7 @@
"anchorEl": {
"type": {
"name": "union",
- "description": "(props, propName) => {\n if (props[propName] == null) {\n return new Error(`Prop '${propName}' is required but wasn't specified`);\n }\n if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {\n return new Error(`Expected prop '${propName}' to be of type Element`);\n }\n return null;\n}
| func
| { contextElement?: (props, propName) => {\n if (props[propName] == null) {\n return null;\n }\n if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {\n return new Error(`Expected prop '${propName}' to be of type Element`);\n }\n return null;\n}, getBoundingClientRect: func }"
+ "description": "HTML element
| object
| func"
}
},
"children": { "type": { "name": "node" } },
diff --git a/docs/pages/x/api/charts/charts-tooltip.json b/docs/pages/x/api/charts/charts-tooltip.json
index 551707108abdb..a93f7eb3ce178 100644
--- a/docs/pages/x/api/charts/charts-tooltip.json
+++ b/docs/pages/x/api/charts/charts-tooltip.json
@@ -3,7 +3,7 @@
"anchorEl": {
"type": {
"name": "union",
- "description": "(props, propName) => {\n if (props[propName] == null) {\n return new Error(`Prop '${propName}' is required but wasn't specified`);\n }\n if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {\n return new Error(`Expected prop '${propName}' to be of type Element`);\n }\n return null;\n}
| func
| { contextElement?: (props, propName) => {\n if (props[propName] == null) {\n return null;\n }\n if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {\n return new Error(`Expected prop '${propName}' to be of type Element`);\n }\n return null;\n}, getBoundingClientRect: func }"
+ "description": "HTML element
| object
| func"
}
},
"classes": { "type": { "name": "object" }, "additionalInfo": { "cssApi": true } },
diff --git a/packages/x-charts-pro/src/Heatmap/HeatmapTooltip.tsx b/packages/x-charts-pro/src/Heatmap/HeatmapTooltip.tsx
index 2ecefa914ce36..8e46baed39db9 100644
--- a/packages/x-charts-pro/src/Heatmap/HeatmapTooltip.tsx
+++ b/packages/x-charts-pro/src/Heatmap/HeatmapTooltip.tsx
@@ -2,6 +2,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
+import HTMLElementType from '@mui/utils/HTMLElementType';
import composeClasses from '@mui/utils/composeClasses';
import {
ChartsTooltipPaper,
@@ -134,29 +135,10 @@ HeatmapTooltip.propTypes = {
* It's used to set the position of the popper.
* The return value will passed as the reference object of the Popper instance.
*/
- anchorEl: PropTypes.oneOfType([
- (props, propName) => {
- if (props[propName] == null) {
- return new Error(`Prop '${propName}' is required but wasn't specified`);
- }
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
- return new Error(`Expected prop '${propName}' to be of type Element`);
- }
- return null;
- },
+ anchorEl: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
+ HTMLElementType,
+ PropTypes.object,
PropTypes.func,
- PropTypes.shape({
- contextElement: (props, propName) => {
- if (props[propName] == null) {
- return null;
- }
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
- return new Error(`Expected prop '${propName}' to be of type Element`);
- }
- return null;
- },
- getBoundingClientRect: PropTypes.func.isRequired,
- }),
]),
/**
* Override or extend the styles applied to the component.
diff --git a/packages/x-charts/src/ChartsTooltip/ChartsTooltip.tsx b/packages/x-charts/src/ChartsTooltip/ChartsTooltip.tsx
index 6173a3f6bd2f3..894ba438c9d25 100644
--- a/packages/x-charts/src/ChartsTooltip/ChartsTooltip.tsx
+++ b/packages/x-charts/src/ChartsTooltip/ChartsTooltip.tsx
@@ -1,6 +1,7 @@
'use client';
import * as React from 'react';
import PropTypes from 'prop-types';
+import HTMLElementType from '@mui/utils/HTMLElementType';
import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
import { ChartsAxisTooltipContent } from './ChartsAxisTooltipContent';
import { ChartsTooltipContainer, ChartsTooltipContainerProps } from './ChartsTooltipContainer';
@@ -44,29 +45,10 @@ ChartsTooltip.propTypes = {
* It's used to set the position of the popper.
* The return value will passed as the reference object of the Popper instance.
*/
- anchorEl: PropTypes.oneOfType([
- (props, propName) => {
- if (props[propName] == null) {
- return new Error(`Prop '${propName}' is required but wasn't specified`);
- }
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
- return new Error(`Expected prop '${propName}' to be of type Element`);
- }
- return null;
- },
+ anchorEl: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
+ HTMLElementType,
+ PropTypes.object,
PropTypes.func,
- PropTypes.shape({
- contextElement: (props, propName) => {
- if (props[propName] == null) {
- return null;
- }
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
- return new Error(`Expected prop '${propName}' to be of type Element`);
- }
- return null;
- },
- getBoundingClientRect: PropTypes.func.isRequired,
- }),
]),
/**
* Override or extend the styles applied to the component.
diff --git a/packages/x-charts/src/ChartsTooltip/ChartsTooltipContainer.tsx b/packages/x-charts/src/ChartsTooltip/ChartsTooltipContainer.tsx
index 140bfb8f25c77..d48312ba337fe 100644
--- a/packages/x-charts/src/ChartsTooltip/ChartsTooltipContainer.tsx
+++ b/packages/x-charts/src/ChartsTooltip/ChartsTooltipContainer.tsx
@@ -1,6 +1,7 @@
'use client';
import * as React from 'react';
import PropTypes from 'prop-types';
+import HTMLElementType from '@mui/utils/HTMLElementType';
import useLazyRef from '@mui/utils/useLazyRef';
import { styled, useThemeProps } from '@mui/material/styles';
import Popper, { PopperProps } from '@mui/material/Popper';
@@ -153,29 +154,10 @@ ChartsTooltipContainer.propTypes = {
* It's used to set the position of the popper.
* The return value will passed as the reference object of the Popper instance.
*/
- anchorEl: PropTypes.oneOfType([
- (props, propName) => {
- if (props[propName] == null) {
- return new Error(`Prop '${propName}' is required but wasn't specified`);
- }
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
- return new Error(`Expected prop '${propName}' to be of type Element`);
- }
- return null;
- },
+ anchorEl: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
+ HTMLElementType,
+ PropTypes.object,
PropTypes.func,
- PropTypes.shape({
- contextElement: (props, propName) => {
- if (props[propName] == null) {
- return null;
- }
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
- return new Error(`Expected prop '${propName}' to be of type Element`);
- }
- return null;
- },
- getBoundingClientRect: PropTypes.func.isRequired,
- }),
]),
/**
* Popper render function or node.