UNPKG

norma-library

Version:

Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.

16 lines 553 B
import { useEffect } from 'react'; var useClickOutside = function (ref, callback) { var handleClickOutside = function (event) { if (ref.current && !ref.current.contains(event.target)) { callback(); } }; useEffect(function () { document.addEventListener('mousedown', handleClickOutside); return function () { document.removeEventListener('mousedown', handleClickOutside); }; }, [ref, callback]); }; export default useClickOutside; //# sourceMappingURL=useClickOutside.js.map