import type { CSSProperties, ComponentPropsWithRef, ComponentPropsWithoutRef, ReactElement, ReactNode } from "react";
import type { Dialog as BaseDialog } from "../unstyledPrimitives";
import type { ButtonProps } from "../Button";
type BaseUIPropsToExclude = "render" | "className" | "style" | "ref" | "children";
/** Width of the dialog; `fullScreen` fills the viewport. */
export type DialogSize = "small" | "base" | "large" | "fullScreen";
/** `alertdialog` blocks outside/backdrop dismissal; `dialog` allows it. */
export type DialogType = "dialog" | "alertdialog";
/**
 * Shared `className`/`style` contract for the composable Dialog parts.
 */
export interface DialogBaseProps {
    /** Class name applied to the part's root element. */
    readonly className?: string;
    /** Inline styles applied to the part's root element. */
    readonly style?: CSSProperties;
}
export type DialogHandle<Payload = unknown> = BaseDialog.Handle<Payload>;
export interface DialogRootProps<Payload = unknown> extends Pick<BaseDialog.Root.Props<Payload>, "open" | "onOpenChange" | "handle" | "triggerId" | "defaultTriggerId" | "onOpenChangeComplete"> {
    /**
     * Called when the user asks to close (escape, backdrop, dismiss button).
     * Receives BaseUI's change-event details (reason + originating event),
     * matching how BaseUI types its open/close callbacks.
     */
    readonly onRequestClose?: (eventDetails: BaseDialog.Root.ChangeEventDetails) => void;
    /**
     * Width of the dialog.
     * On mobile when this is set to "fullScreen" the bottom sheet will be full screen (100% height).
     * @default "base"
     */
    readonly size?: DialogSize;
    /**
     * Type of the dialog. An `alertdialog` requires the user to choose an action
     * before it can be closed (no outside/backdrop dismissal).
     * @default "dialog"
     */
    readonly type?: DialogType;
    /**
     * @see {@link https://base-ui.com/react/components/dialog#DialogPopup-finalFocus}
     * */
    readonly finalFocus?: BaseDialog.Popup.Props["finalFocus"];
    /**
     * The content of the dialog. This can be a regular React node or a render function that receives the payload of the active trigger.
     */
    readonly children?: ReactNode | ((state: {
        payload: Payload | undefined;
    }) => ReactNode);
}
/** Props BaseUI passes to a `Dialog.Trigger` `render` callback. */
export type DialogTriggerRenderProps = ComponentPropsWithRef<"button">;
/** A custom trigger element, or a function that renders one from BaseUI props. */
export type DialogTriggerRender = ReactElement | ((props: DialogTriggerRenderProps) => ReactElement);
interface DialogTriggerSharedProps<Payload> extends DialogBaseProps, Omit<BaseDialog.Trigger.Props, BaseUIPropsToExclude | "handle" | "payload"> {
    /**
     * Links a detached trigger to a `Dialog` with the matching `handle`, when the
     * trigger can't be nested inside the `Dialog`.
     */
    readonly handle?: DialogHandle<Payload>;
    /**
     * Data passed to the dialog when this trigger opens it (used with `handle`).
     */
    readonly payload?: Payload;
}
interface DialogTriggerDefaultProps<Payload> extends DialogTriggerSharedProps<Payload> {
    /** Trigger content; an Atlantis `<Button>` or raw text. */
    readonly children: ReactNode;
    readonly render?: undefined;
}
interface DialogTriggerCustomRenderProps<Payload> extends DialogTriggerSharedProps<Payload> {
    /** Optional content forwarded to the rendered element. */
    readonly children?: ReactNode;
    /** Renders a custom trigger element in place of the default `<Button>`. */
    readonly render: DialogTriggerRender;
}
/**
 * Either the default
 * (`children` required, `render` omitted) or custom-render (`render` required,
 * `children` optional).
 */
export type DialogTriggerProps<Payload = unknown> = DialogTriggerDefaultProps<Payload> | DialogTriggerCustomRenderProps<Payload>;
export interface DialogContentProps extends DialogBaseProps, Omit<BaseDialog.Popup.Props, BaseUIPropsToExclude | "role" | "finalFocus" | "initialFocus"> {
    readonly children: ReactNode;
    /**
     * @see {@link https://base-ui.com/react/components/dialog#DialogPopup-render}
     */
    readonly render?: BaseDialog.Popup.Props["render"];
}
export interface DialogHeaderProps extends DialogBaseProps, Omit<ComponentPropsWithoutRef<"div">, BaseUIPropsToExclude> {
    /**
     * Header content — commonly a `Dialog.Title` and a `Dialog.Close`. The header
     * only owns layout; it does not impose typography or actions.
     */
    readonly children: ReactNode;
}
export interface DialogTitleProps extends DialogBaseProps, Omit<BaseDialog.Title.Props, BaseUIPropsToExclude> {
    /**
     * Title text. Rendered as a `Heading` and auto-wired to the dialog's
     * `aria-labelledby`.
     */
    readonly children: ReactNode;
}
/** Props BaseUI passes to a `Dialog.Close` `render` callback. */
export type DialogCloseRenderProps = ComponentPropsWithRef<"button">;
/** A custom dismiss element, or a function that renders one from BaseUI props. */
export type DialogCloseRender = ReactElement | ((props: DialogCloseRenderProps) => ReactElement);
export interface DialogCloseProps extends DialogBaseProps, Omit<BaseDialog.Close.Props, BaseUIPropsToExclude> {
    /**
     * Optional content for the dismiss control. An Atlantis `<Button>` is adapted
     * automatically; any other valid element is used as-is. The default ButtonDismiss is used if no children or render is provided.
     */
    readonly children?: ReactNode;
    /**
     * Renders a custom dismiss element in place of the default `ButtonDismiss`
     * Pass an element or a function that receives the
     * BaseUI close props (so the element stays wired to close the dialog).
     */
    readonly render?: DialogCloseRender;
}
export interface DialogBodyProps extends DialogBaseProps, Omit<BaseDialog.Description.Props, BaseUIPropsToExclude> {
    /** Body content; describes the dialog (wired to `aria-describedby`). */
    readonly children: ReactNode;
    /**
     * Removes body padding
     * @default false
     */
    readonly fullBleed?: boolean;
}
export interface DialogFooterProps extends DialogBaseProps, Omit<ComponentPropsWithoutRef<"div">, BaseUIPropsToExclude> {
    /**
     * Footer content. Commonly a `Dialog.Actions`, but the footer is a generic
     * region — it can hold anything (a note, a checkbox, a custom layout).
     */
    readonly children: ReactNode;
}
/**
 * `Dialog.ScrollArea` — the advanced scroll region. Content placed inside it
 * scrolls (and owns the scrollbar); parts left as siblings of it in
 * `Dialog.Content` stay pinned. Most dialogs don't need it — `Dialog.Body` is
 * the scroll region for the common case.
 */
export interface DialogScrollAreaProps extends DialogBaseProps {
    /**
     * Content that scrolls together — typically a `Dialog.Body` and a non-pinned
     * `Dialog.Header`/`Dialog.Footer`.
     */
    readonly children: ReactNode;
}
export type DialogShellRootProps = BaseDialog.Root.Props;
/** Value shared with the Dialog parts via context. */
export interface DialogContextValue {
    /** Dialog vs. alertdialog mode. */
    readonly type: DialogType;
    /** Configured dialog width. */
    readonly size: DialogSize;
    /**
     * Whether the dialog should present as a mobile bottom sheet. Computed once at
     * the root (like Menu's shell selection) and read by the parts.
     */
    readonly isMobile: boolean;
    readonly finalFocus?: BaseDialog.Popup.Props["finalFocus"];
}
export interface DialogProviderProps extends DialogContextValue {
    readonly children: ReactNode;
}
export type DialogActionsAlign = "left" | "right" | "fullWidth";
interface DialogActionsBaseProps extends DialogBaseProps, Omit<ComponentPropsWithoutRef<"div">, "className" | "style" | "children"> {
    /** Primary action (right). */
    readonly primary?: ButtonProps | ReactElement;
    /** Secondary action (right, subtle). */
    readonly secondary?: ButtonProps | ReactElement;
    /** Tertiary/destructive action (left). */
    readonly tertiary?: ButtonProps | ReactElement;
    /**
     * Layout for the right-hand action group.
     * @default "right"
     */
    readonly align?: DialogActionsAlign;
}
/**
 * At least one of `primary`, `secondary`, or `tertiary` is required; any other
 * combination of the three is allowed. Modeled as a union where each member
 * pins one action as required while the rest stay optional from the base.
 */
export type DialogActionsProps = (DialogActionsBaseProps & {
    readonly primary: ButtonProps | ReactElement;
}) | (DialogActionsBaseProps & {
    readonly secondary: ButtonProps | ReactElement;
}) | (DialogActionsBaseProps & {
    readonly tertiary: ButtonProps | ReactElement;
});
export {};
