import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
/**
* Explicit stand-ins for the Radix prop shapes we re-expose.
*
* The runtime bundle inlines Radix (see vite.config.ts — only React is
* external), so consumers never install `@radix-ui/*`. If a public type were
* derived from a Radix type (`ComponentPropsWithoutRef`),
* the emitted `.d.ts` would `import '@radix-ui/…'` and every prop on that
* component would silently resolve to `unknown` for anyone who doesn't happen
* to have Radix installed. Declaring the props here keeps `dist/index.d.ts`
* self-contained.
*
* Keep these in sync with the Radix version pinned in devDependencies.
*/
/** Render into the child element instead of the primitive's own DOM node. */
export interface AsChildProps {
/** Merge props onto the single child element rather than rendering a wrapper. */
asChild?: boolean;
}
/** Reading direction, accepted by most Radix roots. */
export type Direction = 'ltr' | 'rtl';
/** Side a floating panel prefers relative to its trigger. */
export type PopperSide = 'top' | 'right' | 'bottom' | 'left';
/** Alignment of a floating panel along its trigger's edge. */
export type PopperAlign = 'start' | 'center' | 'end';
/** A button-like trigger that can defer rendering to its child. */
export type TriggerProps = ButtonHTMLAttributes & AsChildProps;
/** Positioning and dismissal props shared by popper-based content panels. */
export interface PopperContentProps extends Omit, 'dir'>, AsChildProps {
/** Preferred side relative to the trigger. */
side?: PopperSide;
/** Distance in px from the trigger. */
sideOffset?: number;
/** Alignment along the trigger's edge. */
align?: PopperAlign;
/** Offset in px along the alignment axis. */
alignOffset?: number;
/** Flip to the opposite side when there isn't room. Default: true. */
avoidCollisions?: boolean;
/** Padding kept between the panel and the viewport edge. */
collisionPadding?: number | Partial>;
/** Element(s) treated as the collision boundary. */
collisionBoundary?: Element | null | Array;
/** How to behave when the trigger is fully hidden. */
hideWhenDetached?: boolean;
/** Keep mounted so animation libraries can control presence. */
forceMount?: true;
/** Fires on Escape. Call `preventDefault()` to keep the panel open. */
onEscapeKeyDown?: (event: KeyboardEvent) => void;
/** Fires on pointer down outside the panel. */
onPointerDownOutside?: (event: Event) => void;
/** Fires on focus or pointer interaction outside the panel. */
onInteractOutside?: (event: Event) => void;
/** Fires when focus moves outside the panel. */
onFocusOutside?: (event: Event) => void;
/** Fires when auto-focus would move into the panel on open. */
onOpenAutoFocus?: (event: Event) => void;
/** Fires when auto-focus would return to the trigger on close. */
onCloseAutoFocus?: (event: Event) => void;
}
/** Open/close state shared by dialog-, popover- and menu-style roots. */
export interface OpenStateProps {
/** Controlled open state. */
open?: boolean;
/** Uncontrolled initial open state. */
defaultOpen?: boolean;
/** Fires when the open state changes. */
onOpenChange?: (open: boolean) => void;
/** Whether the surface blocks interaction with the rest of the page. */
modal?: boolean;
/** Reading direction. */
dir?: Direction;
children?: ReactNode;
}
/** Single-value form control state (Select, RadioGroup, Tabs…). */
export interface ValueStateProps {
/** Controlled value. */
value?: string;
/** Uncontrolled initial value. */
defaultValue?: string;
/** Fires when the value changes. */
onValueChange?: (value: string) => void;
}
/** Form-participation props shared by the input-like primitives. */
export interface FormControlProps {
/** Name submitted with the enclosing form. */
name?: string;
/** Marks the control required for form validation. */
required?: boolean;
/** Disables interaction. */
disabled?: boolean;
/** Associates the control with a form by id. */
form?: string;
}