@launchpad-ui/portal
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -0,19 +1,13 @@ | ||
import { jsx } from "react/jsx-runtime"; | ||
import { forwardRef, useState, useEffect } from "react"; | ||
import { createPortal } from "react-dom"; | ||
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; | ||
}); | ||
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"; | ||
@@ -20,0 +14,0 @@ export { |
"use strict"; | ||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | ||
const jsxRuntime = require("react/jsx-runtime"); | ||
const react = require("react"); | ||
const reactDom = require("react-dom"); | ||
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; | ||
}); | ||
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 |
import type { HTMLAttributes } from 'react'; | ||
declare type PortalProps = HTMLAttributes<HTMLDivElement> & { | ||
type PortalProps = HTMLAttributes<HTMLDivElement> & { | ||
container?: HTMLElement | null; | ||
@@ -4,0 +4,0 @@ 'data-test-id'?: string; |
{ | ||
"name": "@launchpad-ui/portal", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"status": "alpha", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
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
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
7179
11
0
47