import type { Popover } from '@base-ui/react/popover'; import * as React from 'react'; export interface PortalContainerProviderProps { /** * The DOM node non-modal popups (Select, DropdownMenu, Popover, Tooltip, * HoverCard) should portal into. Pass `null` to explicitly fall back to * the base-ui default (the document body). */ container: HTMLElement | null | undefined; children?: React.ReactNode; } /** * Makes a shared portal container available to descendant non-modal popup * components via `usePortalContainer`. This lets an app route floating * content (e.g. Select options) inside a landmark such as `
` instead * of the document body, which keeps accessibility tooling (axe `region` * rule) happy. * * Modal overlays (Dialog, AlertDialog, Sheet, Drawer) intentionally ignore * this provider: their focus trap and scroll-lock semantics expect body * portals. */ declare function PortalContainerProvider({ container, children, }: PortalContainerProviderProps): React.JSX.Element; declare namespace PortalContainerProvider { var displayName: string; } /** * Reads the app-chosen portal container from context. Returns `undefined` * when no `PortalContainerProvider` is present, or when the provider was * given `null`/`undefined`, which means "use the base-ui default" * (the document body). */ declare function usePortalContainer(): HTMLElement | undefined; /** * Resolves the portal container a non-modal popup should render into, * given an optional explicit `container` prop. * * Resolution order: * 1. The explicit `container` argument, if it is not `undefined` (this * includes an explicit `null`, which opts back into the base-ui * default). * 2. Otherwise, the value from `usePortalContainer()` (the nearest * `PortalContainerProvider`, or `undefined` if there is none). * * This centralizes the resolution logic shared by every non-modal popup * wrapper (Select, DropdownMenu, Popover, Tooltip, HoverCard) so it isn't * copy-pasted at each call site. */ export declare function usePortalContainerOverride(container?: T | null): T | HTMLElement | undefined; /** * Internal popup ref: a destination replacement is not a fresh opening. * Base UI remounts portal children; restore focus by child path for unchanged * content. DOM identity and uncontrolled child state cannot survive that remount. * Popover passes an initial-focus target ref: the root on fresh opens, false on * replacement, so Base UI does not queue a second initial-focus request. */ export declare function usePortalReplacementRef(container: unknown, forwardedRef?: React.Ref, initialFocusTarget?: React.RefObject, finalFocus?: Popover.Popup.Props['finalFocus']): { ref: React.RefCallback; finalFocus: Popover.Popup.Props['finalFocus']; }; export { PortalContainerProvider, usePortalContainer };