'use strict';

import _extends from "@babel/runtime/helpers/extends";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import PropTypes from 'prop-types';
import classnames from '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';
export var Message =
/*#__PURE__*/
function (_React$Component) {
  _inheritsLoose(Message, _React$Component);

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

  var _proto = Message.prototype;

  _proto.render = function render() {
    var classNames = classnames({
      '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.createElement("span", _extends({}, idProp, {
      className: classNames,
      "data-test-automation-id": this.props.testAutomationId
    }), this.props.children);
  };

  return Message;
}(React.Component);

_defineProperty(Message, "propTypes", {
  children: PropTypes.node.isRequired,
  messageType: PropTypes.oneOf([MESSAGE_TYPE_DANGER, MESSAGE_TYPE_WARNING, MESSAGE_TYPE_SUCCESS, MESSAGE_TYPE_DEFAULT, MESSAGE_TYPE_MUTED]),
  testAutomationId: PropTypes.string,
  id: PropTypes.string
});

_defineProperty(Message, "defaultProps", {
  testAutomationId: 'message',
  messageType: MESSAGE_TYPE_DEFAULT,
  id: null
});