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 a6bba1d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 68 deletions.
2 changes: 1 addition & 1 deletion docs/pages/x/api/charts/charts-tooltip-container.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}<br>&#124;&nbsp;func<br>&#124;&nbsp;{ 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<br>&#124;&nbsp;object<br>&#124;&nbsp;func"
}
},
"children": { "type": { "name": "node" } },
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/charts/charts-tooltip.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}<br>&#124;&nbsp;func<br>&#124;&nbsp;{ 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<br>&#124;&nbsp;object<br>&#124;&nbsp;func"
}
},
"classes": { "type": { "name": "object" }, "additionalInfo": { "cssApi": true } },
Expand Down
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 a6bba1d

Please sign in to comment.