Skip to content

Commit

Permalink
[docs][charts] Fix anchorEl API page
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Nov 26, 2024
1 parent aa7f984 commit 4421f9f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 66 deletions.
26 changes: 4 additions & 22 deletions packages/x-charts-pro/src/Heatmap/HeatmapTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
26 changes: 4 additions & 22 deletions packages/x-charts/src/ChartsTooltip/ChartsTooltip.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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.
Expand Down
26 changes: 4 additions & 22 deletions packages/x-charts/src/ChartsTooltip/ChartsTooltipContainer.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 4421f9f

Please sign in to comment.