@hypothesis/frontend-shared
Version:
Shared components, styles and utilities for Hypothesis projects
13 lines (12 loc) • 521 B
TypeScript
import type { RefObject } from 'preact';
type UseClickAwayOptions = {
/** Enable listening for away-click events? Can be set to false to disable */
enabled?: boolean;
};
/**
* Listen on document.body for click events. If a click event's target is
* outside the `container` element, invoke the `callback`. Do not listen if
* not `enabled`.
*/
export declare function useClickAway(container: RefObject<HTMLElement | undefined>, callback: (e: Event) => void, { enabled }?: UseClickAwayOptions): void;
export {};