UNPKG

koval-ui

Version:

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

26 lines (25 loc) 845 B
"use client"; import { useState as o, useCallback as w, useEffect as g } from "react"; import { useDebouncedCallback as O } from "use-debounce"; import { useEventListener as m } from "./useEventListener.js"; const p = (t) => { const [r, f] = o(0), [c, h] = o(0), [u, i] = o(void 0), [a, n] = o(void 0), d = w(() => { const { current: e } = t; if (e) { const s = c > e.offsetHeight, l = r > e.offsetWidth; i(s), n(l); } }, [t, c, r]), v = O(d, 666, { trailing: !0 }); return m("resize", v), g(() => { const { current: e } = t; if (e) { f(e.scrollWidth), h(e.scrollHeight); const s = e.scrollHeight > e.offsetHeight, l = e.scrollWidth > e.offsetWidth; i(s), n(l); } }, [t]), { overflowY: u, overflowX: a }; }; export { p as useIsOverflow }; //# sourceMappingURL=useIsOverflow.js.map