UNPKG

@wbe/react-transition

Version:

![](https://img.shields.io/npm/v/@wbe/react-transition/latest.svg) ![](https://img.shields.io/bundlephobia/minzip/@wbe/react-transition.svg) ![](https://img.shields.io/npm/dt/@wbe/react-transition.svg) ![](https://img.shields.io/npm/l/@wbe/react-transi

66 lines (65 loc) 2 kB
import React, { ReactElement } from "react"; /** * TPlay type is used in order to get/set current transtion step * hidden: Transition playOut is completed * play-out: Transition playOut is in perfoming * play-in: Transition playIn is in perfoming * visible: Transition playIn is completed */ export declare type TPlay = "hidden" | "play-out" | "play-in" | "visible"; declare type TProps = { /** * If * toggle start play-in / play-out children with transition * @default true */ if?: boolean; /** * React children to transit */ children?: ReactElement; /** * playIn transition * @param {HTMLElement} el DOM element to animate * @param {()=> void} done Execute function on transition end */ playIn?: (el: HTMLElement, done: () => any) => void; /** * When playIn transition complete, execute callback */ onPlayInComplete?: () => void; /** * playOut transition * @param {HTMLElement} el DOM element to animate * @param {()=> void} done Execute function on transition end */ playOut?: (el: HTMLElement, done: () => any) => void; /** * When playOut transition complete, execute callback */ onPlayOutComplete?: () => void; /** * Start transition on first mount * if false, children is visible but transition start only when "if" props change * @default false */ appear?: boolean; /** * Unmount children React element after playOut transition * @default true */ unmountAfterPlayOut?: boolean; /** * Dispatch current TPlay string type * @param play */ dispatchPlayState?: (play: TPlay) => void; }; /** * @name Transition */ export declare function Transition(props: TProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>; export declare namespace Transition { var defaultProps: TProps; } export {};