ÿØÿà JPEG ÿþ;
| Server IP : 68.65.120.201 / Your IP : 216.73.216.126 Web Server : LiteSpeed System : Linux server179.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64 User : taxhyuvu ( 2294) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/taxhyuvu/nodevenv/public_html/dp_taxhelplines/14/lib/node_modules/@mui/base/Portal/ |
Upload File : |
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { exactProp, HTMLElementType, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useForkRef as useForkRef, unstable_setRef as setRef } from '@mui/utils';
import { jsx as _jsx } from "react/jsx-runtime";
function getContainer(container) {
return typeof container === 'function' ? container() : container;
}
/**
* Portals provide a first-class way to render children into a DOM node
* that exists outside the DOM hierarchy of the parent component.
*
* Demos:
*
* - [Portal](https://mui.com/base/react-portal/)
*
* API:
*
* - [Portal API](https://mui.com/base/api/portal/)
*/
const Portal = /*#__PURE__*/React.forwardRef(function Portal(props, ref) {
const {
children,
container,
disablePortal = false
} = props;
const [mountNode, setMountNode] = React.useState(null);
// @ts-expect-error TODO upstream fix
const handleRef = useForkRef( /*#__PURE__*/React.isValidElement(children) ? children.ref : null, ref);
useEnhancedEffect(() => {
if (!disablePortal) {
setMountNode(getContainer(container) || document.body);
}
}, [container, disablePortal]);
useEnhancedEffect(() => {
if (mountNode && !disablePortal) {
setRef(ref, mountNode);
return () => {
setRef(ref, null);
};
}
return undefined;
}, [ref, mountNode, disablePortal]);
if (disablePortal) {
if ( /*#__PURE__*/React.isValidElement(children)) {
const newProps = {
ref: handleRef
};
return /*#__PURE__*/React.cloneElement(children, newProps);
}
return /*#__PURE__*/_jsx(React.Fragment, {
children: children
});
}
return /*#__PURE__*/_jsx(React.Fragment, {
children: mountNode ? /*#__PURE__*/ReactDOM.createPortal(children, mountNode) : mountNode
});
});
process.env.NODE_ENV !== "production" ? Portal.propTypes /* remove-proptypes */ = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The children to render into the `container`.
*/
children: PropTypes.node,
/**
* An HTML element or function that returns one.
* The `container` will have the portal children appended to it.
*
* By default, it uses the body of the top-level document object,
* so it's simply `document.body` most of the time.
*/
container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),
/**
* The `children` will be under the DOM hierarchy of the parent component.
* @default false
*/
disablePortal: PropTypes.bool
} : void 0;
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line
Portal['propTypes' + ''] = exactProp(Portal.propTypes);
}
export default Portal;