import type { JSX } from "@solidjs/web"; /** * `useDialogRootInternal` — shared root-body helper consumed by * `` and ``. Mirrors Base UI React's * `useDialogRoot` hook (`packages/react/src/dialog/root/useDialogRoot.ts`) * in spirit: collects the open-state + floating-context + dismiss + role * wiring into one place so the two roots differ only in three knobs. * * Composition: * * - The wrapper builds a headless primitive (`createDialog` / * `createAlertDialog`) and threads its `DialogApi`-shaped surface in * via `options.api`. `useDialogRootInternal` delegates `open`, * `modal`, and `disablePointerDismissal` reads to the primitive * instead of declaring its own. AlertDialog's primitive pins * `modal: true` and `disablePointerDismissal: true` as fixed * invariants, so the previous `modalOverride` / `disablePointerDismissalOverride` * knobs are no longer needed. * * Knobs: * * - `role`: `"dialog"` or `"alertdialog"`. Threaded into `useRole` + * surfaced on the context so `` sets the correct DOM * `role` attribute. * - `api`: the primitive's reactive accessors for `open`, `modal`, and * `disablePointerDismissal`. */ import { type Accessor } from "solid-js"; import { type DialogModalKind, type DialogRootChangeEventDetails } from "../dialog-root-context.js"; import { type DialogHandle } from "../store/dialog-store.js"; export interface DialogRootInternalActions { close: () => void; unmount: () => void; } export type DialogPayloadChildRenderFunction = (ctx: { payload: Payload | undefined; }) => JSX.Element; export interface DialogRootInternalProps { onOpenChange?: ((open: boolean, eventDetails: DialogRootChangeEventDetails) => void) | undefined; onOpenChangeComplete?: ((open: boolean) => void) | undefined; actionsRef?: ((actions: DialogRootInternalActions | null) => void) | { current: DialogRootInternalActions | null; } | undefined; handle?: DialogHandle | undefined; triggerId?: string | null | undefined; children?: JSX.Element | DialogPayloadChildRenderFunction; } /** * Subset of the headless primitive surface that `useDialogRootInternal` * consumes. Both `DialogApi` and `AlertDialogApi` are structurally * assignable. */ export interface DialogRootInternalApi { open: Accessor; modal: Accessor; disablePointerDismissal: Accessor; } export interface UseDialogRootInternalOptions { /** `"dialog"` or `"alertdialog"`. */ role: "dialog" | "alertdialog"; /** * Headless primitive instance — owns `open`, `modal`, and * `disablePointerDismissal`. The wrapper builds it from props (and any * compound-specific invariants — e.g. AlertDialog pins `modal: true`, * `disablePointerDismissal: true`). */ api: DialogRootInternalApi; /** * Writer for the uncontrolled half of the wrapper's * `createControlledState` pair. Called by `setOpen` after the * `onOpenChange` cancel gate — a no-op for reads while the `open` prop * is controlled (the controlled value wins). */ setUncontrolledOpen?: (next: boolean) => void; } /** * Shared `` / `` body. Returns the JSX * element (a `` + `` provider pair * wrapping the resolved children). */ export declare function useDialogRootInternal(props: DialogRootInternalProps, options: UseDialogRootInternalOptions): JSX.Element; //# sourceMappingURL=use-dialog-root-internal.d.ts.map