import { type RefObject } from "react"; type Callback = (e: Event) => void; /** * Detects clicks outside of a specified element. * * @remarks * This hook returns a ref to attach to the element you want to monitor. * It subscribes to global pointer down events and checks if the click target is outside the ref element. * * @typeParam T - The HTML element type. * @param cb - The callback to execute when an outside click occurs. * @returns A ref object to attach to the target element. * * @example * ```tsx * const ref = useOutsideClick(() => { * closeModal(); * }); * return