"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

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

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

var _propTypes = _interopRequireDefault(require("prop-types"));

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

var _styledComponents = _interopRequireWildcard(require("styled-components"));

var _injectE2E = _interopRequireDefault(require("../../Tools/injectE2E"));

var _interpolation = require("../../Tools/interpolation");

var _Icons = require("../../Atoms/Icons");

//  strict
var PADDING = '1.025rem';

var Wrapper =
/*#__PURE__*/
_styledComponents.default.div.attrs(_injectE2E.default).withConfig({
  componentId: "w76f97-0"
})(["\n  display: inline-flex;\n  padding: ", ";\n  font-family: ", ";\n  background-color: ", ";\n  border-radius: ", ";\n  color: ", ";\n  box-shadow: rgba(67, 90, 111, 0.416) 0 0 1px,\n    rgba(67, 90, 111, 0.3) 0 8px 10px -4px;\n  min-width: 250px;\n  max-width: 560px;\n"], PADDING, (0, _interpolation.theme)('fontPrimary'), (0, _interpolation.theme)('toastBackgroundColor'), (0, _interpolation.theme)('toastBorderRadius'), (0, _interpolation.theme)('toastTextColor'));

var Content =
/*#__PURE__*/
_styledComponents.default.div.withConfig({
  componentId: "w76f97-1"
})(["\n  display: flex;\n  flex: 1 1 0%;\n  flex-direction: column;\n"]);

var Title =
/*#__PURE__*/
_styledComponents.default.div.withConfig({
  componentId: "w76f97-2"
})(["\n  display: flex;\n  font-weight: 600;\n"]);

var Description =
/*#__PURE__*/
_styledComponents.default.div.withConfig({
  componentId: "w76f97-3"
})(["\n  display: flex;\n  padding-top: 0.325rem;\n"]);

var Close =
/*#__PURE__*/
_styledComponents.default.div.withConfig({
  componentId: "w76f97-4"
})(["\n  padding-left: ", ";\n"], PADDING);

var IndicatorCss =
/*#__PURE__*/
(0, _styledComponents.css)(["\n  margin-right: ", ";\n  margin-top: 2px;\n"], PADDING);
var IndicatorSuccess =
/*#__PURE__*/
(0, _styledComponents.default)(_Icons.FasCheckCircle).withConfig({
  componentId: "w76f97-5"
})(["\n  ", ";\n  fill: ", ";\n\n  &:hover {\n    fill: ", ";\n  }\n"], IndicatorCss, (0, _interpolation.theme)('successColor'), (0, _interpolation.theme)('successColor'));
var IndicatorWarning =
/*#__PURE__*/
(0, _styledComponents.default)(_Icons.FasExclamationCircle).withConfig({
  componentId: "w76f97-6"
})(["\n  ", ";\n  fill: ", ";\n\n  &:hover {\n    fill: ", ";\n  }\n"], IndicatorCss, (0, _interpolation.theme)('warningColor'), (0, _interpolation.theme)('warningColor'));
var IndicatorDanger =
/*#__PURE__*/
(0, _styledComponents.default)(IndicatorWarning).withConfig({
  componentId: "w76f97-7"
})(["\n  ", ";\n  fill: ", ";\n\n  &:hover {\n    fill: ", ";\n  }\n"], IndicatorCss, (0, _interpolation.theme)('dangerColor'), (0, _interpolation.theme)('dangerColor'));

var Toast = function Toast(_ref) {
  var description = _ref.description,
      onClose = _ref.onClose,
      title = _ref.title,
      type = _ref.type,
      rest = (0, _objectWithoutProperties2.default)(_ref, ["description", "onClose", "title", "type"]);
  return _react.default.createElement(Wrapper, rest, type === 'success' && _react.default.createElement(IndicatorSuccess, {
    size: "16px"
  }), type === 'warning' && _react.default.createElement(IndicatorWarning, {
    size: "16px"
  }), type === 'danger' && _react.default.createElement(IndicatorDanger, {
    size: "16px"
  }), _react.default.createElement(Content, null, _react.default.createElement(Title, null, title), description != null && _react.default.createElement(Description, null, description)), _react.default.createElement(Close, null, _react.default.createElement(_Icons.FasTimes, {
    onClick: onClose,
    selectable: true,
    size: "16px"
  })));
};

Toast.propTypes = process.env.NODE_ENV !== "production" ? {
  description: _propTypes.default.string,
  e2e: _propTypes.default.string,
  onClose: _propTypes.default.func,
  title: _propTypes.default.string.isRequired,
  type: _propTypes.default.oneOf(['default', 'danger', 'success', 'warning'])
} : {};
Toast.defaultProps = {
  e2e: 'defaultToast',
  type: 'default'
};
var _default = Toast;
exports.default = _default;