Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs][charts] Fix anchorEl API page #15625

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion docs/pages/x/api/charts/heatmap-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 @@ -131,29 +132,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