import React, { ReactNode } from 'react';
import { Color } from '../types.js';
export interface PopupRootProps {
/** Trigger + popup (+ optional close) elements. */
children: ReactNode;
/** Initial open state (uncontrolled). Default `false`. Ignored when `open` is provided. */
defaultOpen?: boolean;
/** Controlled open state. When provided, internal state is bypassed. */
open?: boolean;
/** Fires whenever the open state should change. */
onOpenChange?: (open: boolean) => void;
}
/**
* State container for the `Popup` + `PopupTrigger` + `Popup` compound. Use when you want
* the trigger and the popup to be siblings in JSX:
*
* ```tsx
*
*
* ...
*
* ```
*
* Skip this and pass `open`/`onOpenChange` directly to `` if you'd rather control state.
*/
export declare const PopupRoot: ({ children, defaultOpen, open: openProp, onOpenChange, }: PopupRootProps) => import("react/jsx-runtime").JSX.Element;
export interface PopupTriggerProps {
/** Single React element to clone as the trigger. Must accept `onClick`. */
children: ReactNode;
}
/**
* Wraps a single child element to act as the popup trigger. **Clones** the child to attach
* an `onClick` handler that toggles the surrounding `PopupRoot`'s open state (composed with
* any existing `onClick` on the child).
*
* No-ops (renders the child as-is) when used outside a `PopupRoot`.
*/
export declare const PopupTrigger: ({ children }: PopupTriggerProps) => import("react/jsx-runtime").JSX.Element;
export interface PopupCloseProps {
/** Single React element to clone as the close affordance. Must accept `onClick`. */
children: ReactNode;
}
/**
* Wraps a single child element to close the surrounding popup when clicked. **Clones** the
* child to attach an `onClick` handler that flips the surrounding `PopupRoot`'s open state
* to `false` (composed with any existing `onClick` on the child).
*
* ```tsx
*
*
*
* ...
*
*
*
* ```
*
* No-ops (renders the child as-is) when used outside a `PopupRoot`.
*/
export declare const PopupClose: ({ children }: PopupCloseProps) => import("react/jsx-runtime").JSX.Element;
export interface PopupProps {
/** Controlled open state. When omitted, falls back to the surrounding `PopupRoot` state, then `false`. */
open?: boolean;
/** Fires whenever the open state should change. */
onOpenChange?: (open: boolean) => void;
/** Fires when the open transition begins. */
onOpen?: () => void;
/** Fires after the open transition completes (`transitionend`). */
onOpened?: () => void;
/** Fires when the close transition begins. */
onClose?: () => void;
/** Fires after the close transition completes. */
onClosed?: () => void;
/** Extra classes applied to the outer popup container (positioning + overflow). */
className?: string;
/** Portal target selector. Default `'#app, #__next, #root'`. */
root?: string;
/** Selector for the container made `inert` while the popup is open. Default `'.app-container'`. */
inertContainer?: string;
/** Set to `true` when the popup is rendered inside a React `lazy()` + `Suspense` boundary so it opens on the next tick (after the lazy chunk has resolved and mounted). Default `false`. */
lazy?: boolean;
/** Extra classes for the inner content column (where children + header live). */
contentClassName?: string;
/** Extra classes for the scrollable wrap that holds the content column. */
wrapClassName?: string;
/** Render the top header (with close button + slots). Default `true`. */
header?: boolean;
/** Extra classes for the header row. */
headerClassName?: string;
/** Slot rendered on the left side of the header (e.g. title, breadcrumbs). */
headerLeft?: ReactNode;
/** Slot rendered on the right side of the header, before the auto-rendered close button. */
headerRight?: ReactNode;
/** Render the backdrop. Default `true`. */
backdrop?: boolean;
/** Extra classes for the backdrop element. */
backdropClassName?: string;
/** Default `true`. */
closeOnBackdropClick?: boolean;
/** Default `true`. Suppressed automatically when this popup contains another popover/dialog/popup, or task-edit overlays. */
closeOnEscape?: boolean;
/** Render the auto close button in the header. Default `true`. */
closeButton?: boolean;
/** Override the close-button glyph. Default is an inline SVG "X". */
closeButtonContent?: ReactNode;
/** Accent color token for the close button. */
closeButtonColor?: Color;
/** Fires before the popup closes from the close-button click. The popup also closes regardless. */
onCloseButtonClick?: () => void;
/**
* Imperative escape hatch - assigned the popup's `close()` function so callers can dismiss it from outside the React tree (e.g. from a non-child callback).
*
* The ref's `.current` is set on mount.
*/
closeRef?: React.RefObject<(() => void) | null>;
/** ARIA label for the dialog role. Use when there's no visible title. */
'aria-label'?: string;
/** Id of the element labelling this popup. */
'aria-labelledby'?: string;
/** Id of the element describing this popup. */
'aria-describedby'?: string;
/** Popup content. Rendered inside the inner content column, after the header. */
children?: ReactNode;
/** Slot rendered above the header, inside the popup content wrapper. */
beforeContent?: ReactNode;
}
/** Shape of `Popup` defaults that can be supplied via `CladdProvider`'s `defaults` prop. */
export type PopupDefaultProps = Partial>;
export declare const Popup: (props: PopupProps) => import("react/jsx-runtime").JSX.Element;
//# sourceMappingURL=Popup.d.ts.map