@alfalab/core-components-portal
Advanced tools
Comparing version 1.1.3 to 1.2.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = require("react"); | ||
const react_dom_1 = require("react-dom"); | ||
const portalContainer_1 = require("./portalContainer"); | ||
exports.Portal = ({ children, getPortalContainer = portalContainer_1.getDefaultPortalContainer, }) => { | ||
const [isMount, setIsMount] = react_1.useState(false); | ||
react_1.useEffect(() => { | ||
var react_1 = require("react"); | ||
var react_dom_1 = require("react-dom"); | ||
var portalContainer_1 = require("./portalContainer"); | ||
exports.Portal = function (_a) { | ||
var children = _a.children, _b = _a.getPortalContainer, getPortalContainer = _b === void 0 ? portalContainer_1.getDefaultPortalContainer : _b; | ||
var _c = react_1.useState(false), isMount = _c[0], setIsMount = _c[1]; | ||
react_1.useEffect(function () { | ||
setIsMount(true); | ||
@@ -10,0 +11,0 @@ }, []); |
@@ -5,3 +5,3 @@ "use strict"; | ||
function createPortalContainer() { | ||
const portalContainer = document.createElement('div'); | ||
var portalContainer = document.createElement('div'); | ||
portalContainer.setAttribute(exports.PORTAL_CONTAINER_ATTRIBUTE, ''); | ||
@@ -11,2 +11,4 @@ document.body.appendChild(portalContainer); | ||
} | ||
exports.getDefaultPortalContainer = () => document.querySelector(`[${exports.PORTAL_CONTAINER_ATTRIBUTE}]`) || createPortalContainer(); | ||
exports.getDefaultPortalContainer = function () { | ||
return document.querySelector("[" + exports.PORTAL_CONTAINER_ATTRIBUTE + "]") || createPortalContainer(); | ||
}; |
{ | ||
"name": "@alfalab/core-components-portal", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "Portal component", | ||
@@ -18,3 +18,3 @@ "keywords": [], | ||
}, | ||
"gitHead": "e76512cbc5336ab0420b6ea5afa8c0979cebb749" | ||
"gitHead": "dc692d3f87268477e5b61271fa883588d251a88e" | ||
} |
3690
13
72