UNPKG

@anoki/fse-ui

Version:

FSE UI components library

24 lines (23 loc) 502 B
import { useEffect as r } from "react"; function m(t, o, e, n, i) { r(() => { const u = (a) => { t.current && !t.current.contains(a.target) && (!a.target.closest( '[data-navigation="true"]' ) || !i) && (e(), n && n()); }; return o && document.addEventListener("mousedown", u), () => { document.removeEventListener("mousedown", u); }; }, [ t, o, e, n, i ]); } export { m as useClickOutside }; //# sourceMappingURL=index.es307.js.map