You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
958 B
20 lines
958 B
/// <reference types="react" />
|
|
import { ClickOutsideOptions } from './useClickOutside';
|
|
export interface RootCloseOptions extends ClickOutsideOptions {
|
|
disabled?: boolean;
|
|
}
|
|
/**
|
|
* The `useRootClose` hook registers your callback on the document
|
|
* when rendered. Powers the `<Overlay/>` component. This is used achieve modal
|
|
* style behavior where your callback is triggered when the user tries to
|
|
* interact with the rest of the document or hits the `esc` key.
|
|
*
|
|
* @param {Ref<HTMLElement>| HTMLElement} ref The element boundary
|
|
* @param {function} onRootClose
|
|
* @param {object=} options
|
|
* @param {boolean=} options.disabled
|
|
* @param {string=} options.clickTrigger The DOM event name (click, mousedown, etc) to attach listeners on
|
|
*/
|
|
declare function useRootClose(ref: React.RefObject<Element> | Element | null | undefined, onRootClose: (e: Event) => void, { disabled, clickTrigger }?: RootCloseOptions): void;
|
|
export default useRootClose;
|