1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | exports.__esModule = true;
|
6 | exports["default"] = void 0;
|
7 |
|
8 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
9 |
|
10 | var _reactDom = _interopRequireDefault(require("react-dom"));
|
11 |
|
12 | var _react = _interopRequireDefault(require("react"));
|
13 |
|
14 | var _useWaitForDOMRef = _interopRequireDefault(require("./useWaitForDOMRef"));
|
15 |
|
16 | var propTypes = {
|
17 | |
18 |
|
19 |
|
20 |
|
21 | container: _propTypes["default"].any,
|
22 | onRendered: _propTypes["default"].func
|
23 | };
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | var Portal = function Portal(_ref) {
|
29 | var container = _ref.container,
|
30 | children = _ref.children,
|
31 | onRendered = _ref.onRendered;
|
32 | var resolvedContainer = (0, _useWaitForDOMRef["default"])(container, onRendered);
|
33 | return resolvedContainer ? _react["default"].createElement(_react["default"].Fragment, null, _reactDom["default"].createPortal(children, resolvedContainer)) : null;
|
34 | };
|
35 |
|
36 | Portal.displayName = 'Portal';
|
37 | Portal.propTypes = propTypes;
|
38 | var _default = Portal;
|
39 | exports["default"] = _default;
|
40 | module.exports = exports.default; |
\ | No newline at end of file |