'use strict';

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

exports.__esModule = true;
exports.Message = void 0;

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

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

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

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

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

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

var MESSAGE_TYPE_DANGER = 'danger';
var MESSAGE_TYPE_WARNING = 'warning';
var MESSAGE_TYPE_SUCCESS = 'success';
var MESSAGE_TYPE_DEFAULT = 'default';
var MESSAGE_TYPE_MUTED = 'muted';

var Message =
/*#__PURE__*/
function (_React$Component) {
  (0, _inheritsLoose2.default)(Message, _React$Component);

  function Message() {
    return _React$Component.apply(this, arguments) || this;
  }

  var _proto = Message.prototype;

  _proto.render = function render() {
    var classNames = (0, _classnames.default)({
      'text-danger': this.props.messageType === MESSAGE_TYPE_DANGER,
      'text-warning': this.props.messageType === MESSAGE_TYPE_WARNING,
      'text-success': this.props.messageType === MESSAGE_TYPE_SUCCESS,
      'text-default': this.props.messageType === MESSAGE_TYPE_DEFAULT,
      'text-muted': this.props.messageType === MESSAGE_TYPE_MUTED
    });
    var idProp = this.props.id ? {
      id: this.props.id
    } : {};
    return _react.default.createElement("span", (0, _extends2.default)({}, idProp, {
      className: classNames,
      "data-test-automation-id": this.props.testAutomationId
    }), this.props.children);
  };

  return Message;
}(_react.default.Component);

exports.Message = Message;
(0, _defineProperty2.default)(Message, "propTypes", {
  children: _propTypes.default.node.isRequired,
  messageType: _propTypes.default.oneOf([MESSAGE_TYPE_DANGER, MESSAGE_TYPE_WARNING, MESSAGE_TYPE_SUCCESS, MESSAGE_TYPE_DEFAULT, MESSAGE_TYPE_MUTED]),
  testAutomationId: _propTypes.default.string,
  id: _propTypes.default.string
});
(0, _defineProperty2.default)(Message, "defaultProps", {
  testAutomationId: 'message',
  messageType: MESSAGE_TYPE_DEFAULT,
  id: null
});