import { RefObject } from 'react'; export interface UseOverlayArgs { /** Whether the overlay is currently visible. Everything below is set up while this is true. */ isActive: boolean; /** The overlay panel. Focus is trapped inside it and Escape is scoped to it. */ containerRef: RefObject; /** Called when Escape is pressed while this is the topmost overlay. Omit to not handle Escape. */ onEscape?: () => void; /** * Keep Tab inside the panel and restore focus to the previously focused element on close, unless * an overlay opened after this one is still open. */ trapFocus?: boolean; /** Prevent the page behind the overlay from scrolling. */ lockScroll?: boolean; } /** * The three behaviours every blocking overlay needs: Escape to dismiss, a focus trap, and a * scroll lock on the page behind it. * * They share one module-level stack because they share one question: overlays nest (a * ConfirmModal opened from inside a Modal), every instance listens on `document`, and only the * innermost one may react. Without the stack, Escape would close every open layer at once and * the outer trap would yank focus out of the inner panel on the next Tab. * * The scroll lock is reference-counted for the same reason: the page stays locked until the last * overlay closes, and the body's original inline styles are restored rather than cleared. */ export declare function useOverlay({ isActive, containerRef, onEscape, trapFocus, lockScroll }: UseOverlayArgs): void;