import _extends from "@babel/runtime/helpers/esm/extends";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["text", "type", "className"];
import * as React from 'react';
import classNames from 'classnames';
import Text from '../text/Text';
export var TYPE = {
  DEFAULT: 'default',
  SUCCESS: 'success',
  ERROR: 'error',
  INFO: 'info'
};

var FlashMessage = function FlashMessage(_ref) {
  var text = _ref.text,
      _ref$type = _ref.type,
      type = _ref$type === void 0 ? 'default' : _ref$type,
      className = _ref.className,
      props = _objectWithoutProperties(_ref, _excluded);

  var messageClass = classNames('sg-flash__message', _defineProperty({}, "sg-flash__message--".concat(type), type !== TYPE.DEFAULT), className);
  return /*#__PURE__*/React.createElement("div", _extends({}, props, {
    "aria-live": "assertive",
    className: "sg-flash",
    role: "alert"
  }), /*#__PURE__*/React.createElement("div", {
    className: messageClass
  }, /*#__PURE__*/React.createElement(Text, {
    size: "small",
    weight: "bold",
    align: "to-center"
  }, text)));
};

export default FlashMessage;