import type { JSX, ValidComponent } from "@solidjs/web"; import type { BaseUIChangeEventDetails, REASONS } from "../../internals/change-event-details.js"; import { type MaybeAccessor } from "../../internals/maybe-accessor.js"; import type { TransitionStatus } from "../../internals/use-transition-status/use-transition-status.js"; import { type CollapsibleApi, type CollapsibleChangeReason } from "../create-collapsible.js"; /** * Change-reason namespace for `Collapsible.Root` (shipped public type). * Mirrors Base UI React: explicit trigger presses use {@link REASONS.triggerPress}; * indirect flows (e.g. `beforematch` from `hiddenUntilFound`) use {@link REASONS.none}. * * NOTE: the new primitive's `onOpenChange(next, event, reason)` signature uses * the `CollapsibleChangeReason` taxonomy directly. This `BaseUIChangeEventDetails`- * shaped type is kept as a public re-export for downstream consumers that * imported it from `quoin` before the primitive rewrite. */ export type CollapsibleRootChangeEventReason = typeof REASONS.triggerPress | typeof REASONS.none; export type CollapsibleRootChangeEventDetails = BaseUIChangeEventDetails; /** * Public state surface — kept as a shipped type for any consumer projecting * accordion/collapsible state through their own `data-*` mappings. Stage-01c * cleanup: the wrapper itself no longer reads `transitionStatus` (it's now * owned by the panel's local `createMountTransition`); this type still * surfaces it for `accordionItemStateAttributesMapping` and any consumer-side * mappings that rely on the same shape. */ export interface CollapsibleRootState { open: boolean; disabled: boolean; transitionStatus: TransitionStatus; } /** * Props for {@link CollapsibleRoot}. * * Stage-01 spike rewire: the wrapper is a structural adapter over the * `createCollapsible` primitive (axes A + P). * * - `onOpenChange` is `(open, event, reason)` — cancel via * `event.preventDefault()` (axis C). Reason is the third argument: * `"trigger-press"` / `"beforematch"` / `"imperative"`. * - `render={(p) => ...}` is replaced by `as="..."` (axis G). * - Optional `api` prop lets a consumer pre-build the primitive (so they can * `createEffect(c.open, ...)` outside the wrapper) and pass it back in. */ export interface CollapsibleRootProps { /** * Pre-built primitive. When supplied, the root uses it instead of * calling `createCollapsible(...)` itself. The pre-built primitive * already owns its own `open` accessor; consumers can ignore the * `open` / `onOpenChange` props on this component when supplying one. */ api?: CollapsibleApi; /** * Controlled open state. When provided (resolved value not * `undefined`), the consumer owns the state — pair with * {@link onOpenChange}. When omitted, the collapsible manages its own * open state (seeded from {@link defaultOpen}). Ignored when `api` is * supplied (the pre-built primitive owns the accessor). */ open?: MaybeAccessor; /** * Initial open state when uncontrolled. Read once at mount. * @default false */ defaultOpen?: MaybeAccessor; /** Whether interaction is suppressed. */ disabled?: MaybeAccessor; /** * Pre-change callback. Fired before the uncontrolled state write; * calling `event.preventDefault()` vetoes the write so an * uncontrolled collapsible keeps its current state (the quoin * equivalent of React Base UI's `eventDetails.cancel()`). Controlled * consumers simply don't update their signal. Third argument is the * {@link CollapsibleChangeReason}. */ onOpenChange?: (open: boolean, event: Event, reason: CollapsibleChangeReason) => void; /** Keep the panel mounted while closed (passes through to the primitive). */ keepMounted?: MaybeAccessor; /** Browser-page-search expansion (passes through to the primitive). */ hiddenUntilFound?: MaybeAccessor; /** Tag/component to render. Defaults to `"div"`. */ as?: ValidComponent; children?: JSX.Element; [key: string]: unknown; } /** * Groups all parts of the collapsible. Renders a `
` (or `as` override). * * Implementation notes: * * - Calls `createCollapsible` (or reuses `props.api`) once at setup. * - Provides the `CollapsibleContext` (consumed by ``, * ``, the directives, and any inline `useCollapsible()`). * - Owns its own `createMountTransition(c.open)` instance bound to the root * element. Emits `data-open` / `data-closed` plus `data-starting-style` / * `data-ending-style` so consumers can drive root-level CSS transitions * independently from the panel's own lifecycle. The Panel wrapper has its * own instance for panel-anchored animation — the two are independent * (each tracks the CSS animations on its own element). */ export declare function CollapsibleRoot(props: CollapsibleRootProps): JSX.Element; //# sourceMappingURL=collapsible-root.d.ts.map