"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classnames = _interopRequireDefault(require("classnames"));

var _react = _interopRequireDefault(require("react"));

var _reactTransitionGroup = require("react-transition-group");

var _theme = _interopRequireDefault(require("./theme.css"));

var ToastContainer = function ToastContainer(_ref) {
  var children = _ref.children,
      className = _ref.className,
      style = _ref.style;
  var classNames = (0, _classnames.default)(_theme.default['container'], className);

  if (!children) {
    return null;
  }

  return /*#__PURE__*/_react.default.createElement("ul", {
    className: classNames,
    style: style,
    "data-teamleader-ui": "toast-container"
  }, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, {
    component: "li"
  }, _react.default.Children.map(children, function (child, index) {
    return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
      timeout: 1000,
      key: index,
      classNames: {
        appear: (0, _classnames.default)(_theme.default['appear']),
        appearActive: (0, _classnames.default)(_theme.default['appear-active']),
        enter: (0, _classnames.default)(_theme.default['enter']),
        enterActive: (0, _classnames.default)(_theme.default['enter-active']),
        enterDone: (0, _classnames.default)(_theme.default['enter-done']),
        exit: (0, _classnames.default)(_theme.default['exit']),
        exitActive: (0, _classnames.default)(_theme.default['exit-active']),
        exitDone: (0, _classnames.default)(_theme.default['exit-done'])
      }
    }, child);
  })));
};

var _default = ToastContainer;
exports.default = _default;