UNPKG

koval-ui

Version:

React components collection with minimalistic design. Supports theming, layout, and input validation.

21 lines (20 loc) 587 B
"use client"; import { useId as d, useState as m } from "react"; import { createPortal as c } from "react-dom"; import { useSafeLayoutEffect as u } from "../hooks/useSafeLayoutEffect.js"; const i = ({ children: r }) => { const e = d(), [t, n] = m(!1); return u(() => { if (!t) { const o = document.createElement("div"); o.id = e, document.body.appendChild(o), n(!0); } return () => { t && document.getElementById(e).remove(); }; }, [e, t]), t && c(r, document.getElementById(e), e); }; export { i as Portal }; //# sourceMappingURL=Portal.js.map