import type { Dispatch, SetStateAction } from 'react'; /** * A custom hook that handles detecting outside clicks for a given element. * It sets up a reference to the element and listens for `mousedown` events on the document. * If a click is detected outside of the referenced element, it triggers the provided `setIsOpen` callback to close the element. * * @param setIsOpen A function to update the state of the element, typically used to close it when an outside click is detected. * @param onClose A callback function that is called when an outside click is detected, allowing for additional cleanup or actions to be performed. * @returns A ref object that can be attached to the element to monitor for outside clicks. * * @example * ```tsx * const MyDropdown = () => { * const [isOpen, setIsOpen] = useState(false); * const dropdownRef = useOutsideClick(setIsOpen); * * return ( *
* {isOpen && } *
* ); * }; * ``` */ export declare const useOutsideClick: (setIsOpen: Dispatch>, onClose?: () => void) => import("react").RefObject;