UNPKG

@massds/mayflower-react

Version:

React versions of Mayflower design system UI components

59 lines (58 loc) 2.81 kB
import React from 'react'; export interface CollapseProps { /** Show the component; triggers the expand or collapse animation */ in?: boolean; /** Wait until the first "enter" transition to mount the component (add it to the DOM) */ mountOnEnter?: boolean; /** Unmount the component (remove it from the DOM) when it is collapsed */ unmountOnExit?: boolean; /** Run the expand animation when the component mounts, if it is initially shown */ appear?: boolean; /** Duration of the collapse animation in milliseconds */ timeout?: number; /** Callback fired before the component expands */ onEnter?(...args: unknown[]): unknown; /** Callback fired after the component starts to expand */ onEntering?(...args: unknown[]): unknown; /** Callback fired after the component has expanded */ onEntered?(...args: unknown[]): unknown; /** Callback fired before the component collapses */ onExit?(...args: unknown[]): unknown; /** Callback fired after the component starts to collapse */ onExiting?(...args: unknown[]): unknown; /** Callback fired after the component has collapsed */ onExited?(...args: unknown[]): unknown; /** The dimension used when collapsing, or a function that returns the dimension */ dimension?: "height" | "width" | ((...args: unknown[]) => unknown); /** Function that returns the height or width of the animating DOM node Allows for providing some custom * logic for how much the Collapse component should animate in its specified dimension. Called with * the current dimension prop value and the DOM node. */ getDimensionValue?(...args: unknown[]): unknown; /** ARIA role of collapsible element */ role?: string; /** classNames for direct children */ className?: string; /** child node */ children?: React.ReactNode; /** The minimum dimension, height or width, that you want the animation to collapse to. * This should be in number of pixels (i.e. pass 200 if you want it to collapse to a height of 200px. The default value is 0. */ minDimension?: number; /** Whether you want to set the minimum height of the child on its initial mount */ minDimensionOnMount?: boolean; } /** The following animation component was implemented following the same logic/strucure * as React-Bootstrap's Collapse component. * (https://react-bootstrap.github.io/utilities/transitions/#transitions-collapse) */ declare class Collapse extends React.Component<CollapseProps> { constructor(props: any); handleEnter(elem: any): void; handleEntering(elem: any): void; handleEntered(elem: any): void; handleExit(elem: any): void; handleExiting(elem: any): void; getDimension(): any; render(): any; } export default Collapse;