import type * as React from 'react'; import type { PrimitivePropsWithRef } from '../utils/primitive.cjs'; /** @internal Shared state distributed from {@link Collapsible} to its parts via context. Not part of the public API. */ export interface CollapsibleContextValue { contentId: string; open: boolean; disabled: boolean; /** Flips the panel; the click event reaches it so a family can tell a keyboard activation from a pointer one. */ onOpenToggle: (event?: { detail: number; }) => void; /** Opens the collapsible without toggling it — the `beforematch` path, where the browser has already revealed the panel. */ onOpen: () => void; /** Reports that the panel has settled into `open`. See {@link CollapsibleProps.onOpenChangeComplete}. */ onOpenChangeComplete: (open: boolean) => void; /** Whether the content element is currently in the DOM, so the trigger only publishes `aria-controls` for a panel that exists. */ contentMounted: boolean; setContentMounted: (mounted: boolean) => void; } /** Props for the {@link CollapsibleRoot}. */ export interface CollapsibleRootProps extends PrimitivePropsWithRef<'div'> { /** * Open state, for controlled usage. Pair with `onOpenChange`. * @default undefined — uncontrolled, tracks its own open state internally. */ open?: boolean | undefined; /** * Initial open state, for uncontrolled usage. * @default false */ defaultOpen?: boolean | undefined; /** * Fires with the new open state whenever it changes, controlled or not. * @default undefined — no-op if omitted. */ onOpenChange?: ((open: boolean) => void) | undefined; /** * Fires with the settled open state after the content panel finishes transitioning. * @default undefined — no-op if omitted. */ onOpenChangeComplete?: ((open: boolean) => void) | undefined; /** * Prevents the trigger from toggling the content when set. * @default false */ disabled?: boolean | undefined; } /** Props for the {@link Collapsible} recipe, which always wraps children in the derived anatomy. */ export interface CollapsibleProps extends Omit { /** * Text of the derived `CollapsibleTrigger` — the button that toggles the panel. * @default undefined — no trigger is rendered. */ title?: React.ReactNode | undefined; } /** Props for {@link CollapsibleTrigger}, the button that toggles the content open/closed. */ export interface CollapsibleTriggerProps extends PrimitivePropsWithRef<'button'> { } /** Props for {@link CollapsibleIndicator}, the chevron inside the trigger. */ export interface CollapsibleIndicatorProps extends PrimitivePropsWithRef<'span'> { } /** Props for {@link CollapsibleContent}, the panel revealed when open. */ export interface CollapsibleContentProps extends PrimitivePropsWithRef<'div'> { /** * Keeps the panel mounted (hidden via the `hidden` attribute) while closed * instead of unmounting it, for animation libraries needing it during exit transitions. * @default false */ forceMount?: boolean | undefined; /** * Keeps the panel mounted as `hidden="until-found"` for find-in-page and fragment * navigation instead of plain `hidden=""`. Implies `forceMount`; do not apply * `display: none` on closed panels or the text becomes unsearchable. * @default false */ hiddenUntilFound?: boolean | undefined; }