import type { RefObject } from "react"; /** * The first focusable element within `container` (the container itself counts if * it is focusable). Skips hidden elements. Returns `null` when nothing inside is * focusable. */ export declare function getFirstFocusableWithin(container: HTMLElement | null): HTMLElement | null; /** Options for {@link getDialogReturnFocus}. */ export interface DialogReturnFocusOptions { /** * The element focus should return to when it is still in the DOM at close * time — typically the trigger (an autocomplete/combobox input, a button). */ readonly trigger?: RefObject | null; /** * A container that stays mounted while the trigger may unmount. When the * trigger is gone, focus returns to the first focusable element inside it — * e.g. the card that replaced the trigger. Keep it scoped tightly around the * region that swaps so the "closest" element is the one the user expects. */ readonly boundary: RefObject; } /** * Builds a `finalFocus` callback for `Dialog` that keeps keyboard focus near the * trigger even when the trigger unmounts while the dialog is open (e.g. an * autocomplete "Create" action whose row is replaced by a card on save). * * Resolution order on close: * 1. the `trigger`, if it is still connected; * 2. otherwise the first focusable element inside `boundary` (the "closest" * landing spot); * 3. otherwise `null`, which lets BaseUI fall back to its default behavior. * * @example * const triggerRef = useRef(null); * const boundaryRef = useRef(null); *
* */ export declare function getDialogReturnFocus({ trigger, boundary, }: DialogReturnFocusOptions): () => HTMLElement | null;