UNPKG

wix-style-react

Version:
30 lines 1.16 kB
import * as React from 'react'; import PropTypes from 'prop-types'; /** Animate Component */ const getDelayValue = (delay) => { switch (typeof delay) { case 'string': return delay; case 'number': return `${delay}ms`; default: return undefined; } }; const Animate = React.forwardRef(({ dataHook, animateClasses, delay, onStart, onEnd, children, animateInlineStyle, } = { children: undefined }, ref) => (React.createElement("div", { "data-hook": dataHook, className: animateClasses, style: { animationDelay: getDelayValue(delay), ...animateInlineStyle, }, onAnimationStart: onStart, onAnimationEnd: onEnd, ref: ref }, children && React.Children.only(children)))); Animate.propTypes = { animateClasses: PropTypes.string, dataHook: PropTypes.string, // @ts-ignore children: PropTypes.node.isRequired, onStart: PropTypes.func, onEnd: PropTypes.func, delay: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), animateInlineStyle: PropTypes.object, }; Animate.displayName = 'Animate'; export default Animate; //# sourceMappingURL=Animate.js.map