import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import theme from './theme.css';
import cx from 'classnames';
import { TransitionGroup, CSSTransition } from 'react-transition-group';
/** @type {React.ComponentType<any>} */

var ToastContainer = /*#__PURE__*/function (_PureComponent) {
  _inherits(ToastContainer, _PureComponent);

  var _super = _createSuper(ToastContainer);

  function ToastContainer() {
    _classCallCheck(this, ToastContainer);

    return _super.apply(this, arguments);
  }

  _createClass(ToastContainer, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          children = _this$props.children,
          className = _this$props.className,
          style = _this$props.style;
      var classNames = cx(theme['container'], className);
      return /*#__PURE__*/React.createElement("ul", {
        className: classNames,
        style: style,
        "data-teamleader-ui": "toast-container"
      }, /*#__PURE__*/React.createElement(TransitionGroup, {
        component: "li"
      }, React.Children.map(children, function (child) {
        return /*#__PURE__*/React.createElement(CSSTransition, {
          timeout: 1000,
          key: child.key,
          classNames: {
            appear: cx(theme['appear']),
            appearActive: cx(theme['appear-active']),
            enter: cx(theme['enter']),
            enterActive: cx(theme['enter-active']),
            enterDone: cx(theme['enter-done']),
            exit: cx(theme['exit']),
            exitActive: cx(theme['exit-active']),
            exitDone: cx(theme['exit-done'])
          }
        }, child);
      })));
    }
  }]);

  return ToastContainer;
}(PureComponent);

export default ToastContainer;