import React, { cloneElement, useMemo } from "react";
import { Transition } from "react-transition-group";
const transitionStyles = {
  entered: {
    transform: "scale(1)"
  },
  exiting: {
    transform: "scale(0)"
  }
};
export const Scale = _ref => {
  let {
    in: inProp = false,
    onEnter,
    onExited,
    children,
    style,
    timeout = 200
  } = _ref;
  const defaultStyle = useMemo(() => {
    return {
      transitionProperty: "transform",
      transitionDuration: timeout + "ms",
      transform: "scale(0)"
    };
  }, [timeout]);
  return /*#__PURE__*/React.createElement(Transition, {
    in: inProp,
    timeout: timeout,
    onEnter: onEnter,
    onExited: onExited
  }, state => {
    return /*#__PURE__*/cloneElement(children, {
      style: {
        ...defaultStyle,
        ...transitionStyles[state],
        ...style,
        ...children.props.style
      }
    });
  });
};
Scale.displayName = "Scale";
//# sourceMappingURL=Scale.js.map