import type { JSX } from "@solidjs/web"; import { type MaybeAccessor } from "../../internals/maybe-accessor.js"; import { type PopoverModalKind, type PopoverRootChangeEventDetails, type PopoverRootChangeEventReason } from "../popover-root-context.js"; import { type PopoverHandle } from "../store/popover-store.js"; export type { PopoverModalKind, PopoverRootChangeEventDetails, PopoverRootChangeEventReason, }; /** * Imperative actions surface written into `actionsRef` on ``. * Mirrors React's `PopoverRoot.Actions`. */ export interface PopoverRootActions { /** Close the popover imperatively. */ close: () => void; /** * Force-unmount the popover subtree immediately. Useful for JS-animated * closes where the consumer wants to guarantee DOM removal after their * animation finishes. Solid port note: currently wired as a synchronous * close; no separate "prevent unmount on close" state is tracked yet, * so `unmount()` is equivalent to `close()` until the full transition- * aware path lands. */ unmount: () => void; } /** * Render-function variant for popover children — mirrors React's * `PayloadChildRenderFunction`. Called with the active trigger's * `payload`. */ export type PopoverPayloadChildRenderFunction = (ctx: { payload: Payload | undefined; }) => JSX.Element; export interface PopoverRootProps { /** * Controlled open state. While its resolved value is not `undefined` * the consumer owns the state — pair with `onOpenChange`. When * omitted, the popover manages its own open state (seeded from * {@link defaultOpen}), matching React Base UI. */ open?: MaybeAccessor; /** * Initial open state when uncontrolled. Read once at mount. * @default false */ defaultOpen?: MaybeAccessor; /** * Fires on every open/close request (trigger press, outside press, * Escape, Close button, etc.). Calling `eventDetails.cancel()` keeps * the popover's own (uncontrolled) state unchanged, mirroring React * Base UI; controlled consumers simply don't update their signal. */ onOpenChange?: ((open: boolean, eventDetails: PopoverRootChangeEventDetails) => void) | undefined; /** * Fires once the open/close transition has settled. Currently wired * synchronously on open/close — see the root's implementation notes for * the transition-aware follow-up. */ onOpenChangeComplete?: ((open: boolean) => void) | undefined; /** * Modal surface kind. * * - `false` (default): no focus trap, no scroll lock, no backdrop. * - `true`: focus is trapped in the popup AND outside pointer interactions * are blocked via the internal backdrop. * - `'trap-focus'`: focus is trapped but outside pointer interaction * remains enabled. * * @default false */ modal?: MaybeAccessor; /** * Callback ref for imperative actions. Call with the resulting * `{ close, unmount }` on mount to retain a handle that later closes * or unmounts the popover programmatically. Solid deviation: * React exposes this as `RefObject`; the Solid * port uses the idiomatic callback-ref shape to avoid the * `ref.current` allocation-at-component-boundary footgun. */ actionsRef?: ((actions: PopoverRootActions | null) => void) | { current: PopoverRootActions | null; } | undefined; /** * Handle to connect the root with detached `` * components. Allows external triggers to drive the popover's open * state and to associate multiple triggers with one popover. */ handle?: PopoverHandle | undefined; /** * ID of the active trigger. Pair with `open` for controlled * multi-trigger scenarios. */ triggerId?: string | null | undefined; /** * The content of the popover. May be a plain child or a render * function `({ payload }) => JSX.Element` — the render-function form * receives the active trigger's `payload`. */ children?: JSX.Element | PopoverPayloadChildRenderFunction; } /** * Groups all parts of the popover. */ export declare function PopoverRoot(props: PopoverRootProps): JSX.Element; //# sourceMappingURL=popover-root.d.ts.map