/** * @license * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import * as React from "react"; /** * Resolves an MUI-style `timeout` (a single duration or per-direction * durations) to the millisecond value for the given direction. */ export type TransitionTimeout = number | { appear?: number; enter?: number; exit?: number; }; export declare function resolveTimeout(timeout: TransitionTimeout | undefined, direction: "appear" | "enter" | "exit", fallback: number): number; /** The discrete lifecycle phases of a transition. */ export type TransitionPhase = "entering" | "entered" | "exiting" | "exited"; /** Props shared by every transition component. */ export interface BaseTransitionProps { /** Whether the child should be shown. */ in: boolean; /** * Duration in ms, or per-direction durations. When omitted, the component's * M3 motion-token default is used. */ timeout?: TransitionTimeout; /** Animate on the initial mount when `in` is already true. */ appear?: boolean; /** Keep the child mounted while hidden instead of unmounting it. */ mountOnEnter?: boolean; /** Unmount the child once it has finished exiting. */ unmountOnExit?: boolean; /** The single React element to animate. */ children: React.ReactElement; } export interface UseTransitionStateResult { /** Whether the child should currently be rendered in the tree. */ mounted: boolean; /** The current lifecycle phase. */ phase: TransitionPhase; /** Whether this is the very first commit (used to gate `appear`). */ isAppearing: boolean; /** Call from the element's `onTransitionEnd` to settle the phase. */ handleTransitionEnd: () => void; } /** * Drives mount/unmount and entering/entered/exiting/exited phases from the * boolean `in` prop, using a small internal state machine. No external * dependency. SSR-safe (effects run only on the client). */ export declare function useTransitionState(inProp: boolean, { appear, mountOnEnter, unmountOnExit, enterTimeout, exitTimeout, appearTimeout, onEntered, onExited, }: { appear?: boolean; mountOnEnter?: boolean; unmountOnExit?: boolean; enterTimeout: number; exitTimeout: number; appearTimeout?: number; onEntered?: () => void; onExited?: () => void; }): UseTransitionStateResult; /** True while the element should be in its "shown" visual state. */ export declare function isVisible(phase: TransitionPhase): boolean; /** * What every transition component derives from its props: the resolved enter/exit durations, * the state machine and the current visual state. `durationMs` is the one of the running direction. */ export declare function useTransitionProps(props: BaseTransitionProps, enterFallbackMs: number, exitFallbackMs: number): { mounted: boolean; phase: TransitionPhase; visible: boolean; durationMs: number; }; //# sourceMappingURL=use-transition-state.d.ts.map