@launchpad-ui/portal
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -1,13 +0,19 @@ | ||
import { jsx } from "react/jsx-runtime"; | ||
import { forwardRef, useState, useEffect } from "react"; | ||
import { createPortal } from "react-dom"; | ||
const Portal = forwardRef( | ||
({ container = ((_a) => (_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body)(), "data-test-id": testId = "portal", ...props }, ref) => { | ||
const [mounted, setMounted] = useState(false); | ||
useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
return mounted && container ? createPortal(/* @__PURE__ */ jsx("div", { ...props, ref, "data-test-id": testId }), container) : null; | ||
} | ||
); | ||
import { jsx } from "react/jsx-runtime"; | ||
const Portal = forwardRef(({ | ||
container = ((_a) => (_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body)(), | ||
"data-test-id": testId = "portal", | ||
...props | ||
}, ref) => { | ||
const [mounted, setMounted] = useState(false); | ||
useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
return mounted && container ? createPortal(/* @__PURE__ */ jsx("div", { | ||
...props, | ||
ref, | ||
"data-test-id": testId | ||
}), container) : null; | ||
}); | ||
Portal.displayName = "Portal"; | ||
@@ -14,0 +20,0 @@ export { |
"use strict"; | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | ||
const jsxRuntime = require("react/jsx-runtime"); | ||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); | ||
const react = require("react"); | ||
const reactDom = require("react-dom"); | ||
const Portal = react.forwardRef( | ||
({ container = ((_a) => (_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body)(), "data-test-id": testId = "portal", ...props }, ref) => { | ||
const [mounted, setMounted] = react.useState(false); | ||
react.useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
return mounted && container ? reactDom.createPortal(/* @__PURE__ */ jsxRuntime.jsx("div", { ...props, ref, "data-test-id": testId }), container) : null; | ||
} | ||
); | ||
const jsxRuntime = require("react/jsx-runtime"); | ||
const Portal = react.forwardRef(({ | ||
container = ((_a) => (_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body)(), | ||
"data-test-id": testId = "portal", | ||
...props | ||
}, ref) => { | ||
const [mounted, setMounted] = react.useState(false); | ||
react.useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
return mounted && container ? reactDom.createPortal(/* @__PURE__ */ jsxRuntime.jsx("div", { | ||
...props, | ||
ref, | ||
"data-test-id": testId | ||
}), container) : null; | ||
}); | ||
Portal.displayName = "Portal"; | ||
exports.Portal = Portal; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@launchpad-ui/portal", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"status": "alpha", | ||
@@ -26,8 +26,8 @@ "publishConfig": { | ||
"peerDependencies": { | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
}, | ||
"devDependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7596
59