import React from 'react'; import PropTypes from 'prop-types'; import { ComponentProps } from '../utils/types'; /** @public */ type AnimationType = 'slideFromTop' | 'slideFromRight' | 'slideFromBottom' | 'slideFromLeft' | 'expandHeight' | 'expandWidth' | 'none'; /** @public */ type AnimationOnOpen = { open: AnimationType; close: 'none'; }; /** @public */ type AnimationOnClose = { open: 'none'; close: AnimationType; }; type AnimationProp = AnimationType | AnimationOnOpen | AnimationOnClose; interface TransitionOpenPropsBase { /** * The animation to use when opening and closing. Can be: * - A string (e.g., 'expandHeight') to animate both open and close * - An object with `{ open: AnimationType, close: 'none' }` to animate only when opening * - An object with `{ open: 'none', close: AnimationType }` to animate only when closing */ animation?: AnimationProp; animateOnMount?: boolean; children?: React.ReactNode; /** @private */ className?: string; /** * A React ref which is set to the DOM element when the component mounts and null when it unmounts. */ elementRef?: React.Ref; /** The `id` of the inner container. */ id?: string; /** An additional className to inner container. */ innerClassName?: string; innerStyle?: React.CSSProperties; onAnimationEnd?: () => void; onAnimationStart?: () => void; /** Whether the component is currently open or not. */ open?: boolean; /** An additional className to outer container. */ outerClassName?: string; /** The `id` of the outer container. */ outerId?: string; outerStyle?: React.CSSProperties; /** * When true, children are always rendered whether open or closed. */ renderChildrenWhenCollapsed?: boolean; /** * Keep focus within `TransitionOpen` while open. */ retainFocus?: boolean; /** * When true, the `TransitionOpen` automatically takes focus when 'open' changes to true. */ takeFocus?: boolean; } type TransitionOpenProps = ComponentProps; declare function TransitionOpen({ animation: animationProp, animateOnMount, children, className, elementRef, id, innerClassName, innerStyle, onAnimationEnd, onAnimationStart, open: openProp, outerClassName, outerId, outerStyle, renderChildrenWhenCollapsed, retainFocus, takeFocus: takeFocusProp, ...otherProps }: TransitionOpenProps): React.JSX.Element; declare namespace TransitionOpen { var propTypes: { animation: PropTypes.Requireable>; close: PropTypes.Validator; }> | PropTypes.InferProps<{ open: PropTypes.Validator; close: PropTypes.Validator>; }> | null | undefined>>; animateOnMount: PropTypes.Requireable; children: PropTypes.Requireable; elementRef: PropTypes.Requireable; className: PropTypes.Requireable; id: PropTypes.Requireable; innerClassName: PropTypes.Requireable; innerStyle: PropTypes.Requireable; onAnimationEnd: PropTypes.Requireable<(...args: any[]) => any>; onAnimationStart: PropTypes.Requireable<(...args: any[]) => any>; open: PropTypes.Requireable; outerClassName: PropTypes.Requireable; outerId: PropTypes.Requireable; outerStyle: PropTypes.Requireable; renderChildrenWhenCollapsed: PropTypes.Requireable; retainFocus: PropTypes.Requireable; takeFocus: PropTypes.Requireable; }; } export default TransitionOpen; export { AnimationType, AnimationOnOpen, AnimationOnClose, TransitionOpenPropsBase };