You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
586 B
22 lines
586 B
import ReactDOM from 'react-dom';
|
|
import * as React from 'react';
|
|
import useWaitForDOMRef from './useWaitForDOMRef';
|
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
const Portal = ({
|
|
container,
|
|
children,
|
|
onRendered
|
|
}) => {
|
|
const resolvedContainer = useWaitForDOMRef(container, onRendered);
|
|
return resolvedContainer ? /*#__PURE__*/_jsx(_Fragment, {
|
|
children: /*#__PURE__*/ReactDOM.createPortal(children, resolvedContainer)
|
|
}) : null;
|
|
};
|
|
|
|
Portal.displayName = 'Portal';
|
|
export default Portal; |