import { type KeyboardEvent, type RefObject } from 'react'; /** * @public */ export interface OverlayTriggerState { /** Whether the overlay is currently open. */ readonly isOpen: boolean; /** Opens the overlay. */ open(): void; /** Closes the overlay. */ close(): void; /** Toggles the overlay's visibility. */ toggle(): void; } /** * @public */ export type OverlayAria = { /** Props to apply to the overlay container element. */ overlayProps: { onKeyDown?: (e: KeyboardEvent) => void; onFocus?: (e: FocusEvent) => void; onBlur?: (e: FocusEvent) => void; }; }; /** @internal */ export interface UseOverlayProps { /** Whether the overlay is currently open. */ isOpen?: boolean; /** Handler that is called when the overlay should close. */ onClose?: (reason: string) => void; /** * Whether to close the overlay when the user interacts outside it. * Known Issue: If set to true, clicking on some other overlays (e.g. Microguide) * also closes this overlay. The issue is irrelevant for smaller overlays that usually * don't contain a clickable overlay but might need some extra handling for bigger ones (e.g. Sheet). * @defaultValue false */ isDismissible?: boolean; /** Whether the overlay should close when focus is lost or moves outside it. */ shouldCloseOnBlur?: boolean; /** * Whether pressing the escape key to close the overlay should be disabled. * @defaultValue false */ isKeyboardDismissDisabled?: boolean; /** * When user interacts with the argument element outside of the overlay ref, * return true if onClose should be called. This gives you a chance to filter * out interaction with elements that should not dismiss the overlay. * By default, onClose will always be called on interaction outside the overlay ref. */ shouldCloseOnInteractOutside?: (element: HTMLElement) => boolean; } interface OverlayTriggerProps { /** Whether the overlay is open by default (controlled). */ isOpen?: boolean; /** Whether the overlay is open by default (uncontrolled). */ defaultOpen?: boolean; /** Handler that is called when the overlay's open state changes. */ onOpenChange?: (isOpen: boolean) => void; } /** * Provides the behavior for overlays such as dialogs, popovers, and menus. * Hides the overlay when the user interacts outside it, when the Escape key is pressed, * or optionally, on blur. Only the top-most overlay will close at once. * @internal */ export declare function useOverlay(props: UseOverlayProps, ref: RefObject): OverlayAria; /** * Manages state for an overlay trigger. Tracks whether the overlay is open, and provides * methods to toggle this state. * @internal */ export declare function useOverlayTriggerState(props: OverlayTriggerProps): OverlayTriggerState; /** * @public */ export interface DismissButtonProps { /** Called when the dismiss button is activated. */ onDismiss?: () => void; } /** * A visually hidden button that can be used to allow screen reader * users to dismiss a modal or popup when there is no visual * affordance to do so. * @public */ export declare function DismissButton(props: DismissButtonProps): import("react/jsx-runtime.js").JSX.Element; export {};