import { CSSProperties, ReactNode, Ref } from 'react'; import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types.js'; export type FlipAxis = 'x' | 'y'; export type FlipSlots = 'root' | 'perspective' | 'surface' | 'front' | 'back'; export interface FlipHandle { /** Toggles the flip state. No-op (with a dev warning) when `flipped` is controlled. */ flip: () => void; /** Explicitly sets the flip state. No-op (with a dev warning) when `flipped` is controlled. */ setFlipped: (value: boolean) => void; /** Returns to unflipped (front-facing). */ reset: () => void; } export interface FlipProps extends HtmlProps { /** Front-face content. */ front: ReactNode; /** Back-face content. */ back: ReactNode; /** Controlled flip state. */ flipped?: boolean; /** Initial flip state when uncontrolled. @default false */ defaultFlipped?: boolean; /** Clicking the element toggles the flip state (uncontrolled) or calls `onFlip` (controlled). @default false */ flipOnClick?: boolean; /** Which edge the flip hinges on. @default 'y' */ flipAxis?: FlipAxis; /** Flips the rotation sign on `flipAxis` (+180deg vs -180deg), so the flip sweeps the opposite way without changing which edge it hinges on. @default false */ reverse?: boolean; /** Flip transition duration in ms. @default 600 */ flipDuration?: number; /** CSS `perspective` in px, applied to the perspective wrapper. Pass `'none'` when nesting inside something that already establishes its own perspective (e.g. `Tilt`), to avoid two stacked perspective contexts. @default 800 */ perspective?: number | 'none'; /** Disables `flipOnClick`; programmatic flips via prop or ref still work. @default false */ disabled?: boolean; /** Fires after a user-initiated flip (click or ref call), not fired for externally-driven `flipped` prop changes. */ onFlip?: (flipped: boolean) => void; /** Fires once the flip transition finishes settling on the new face, for any trigger (click, controlled prop change, or ref call). Fires synchronously under `prefers-reduced-motion: reduce`, since no transition runs to wait for. */ onFlipEnd?: (flipped: boolean) => void; /** Imperative handle for flipping without owning the state. */ ref?: Ref; className?: string; style?: CSSProperties; classNames?: SlotClassNames; styles?: SlotStyles; }