'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _getClassName2 = require('babel-plugin-react-css-modules/dist/browser/getClassName');

var _getClassName3 = _interopRequireDefault(_getClassName2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var _styleModuleImportMap = {
  './alert.scss': {
    'base': 'flive_alert_base',
    'small': 'flive_alert_small',
    'xsmall': 'flive_alert_xsmall',
    'alert-title': 'flive_alert_alert-title',
    'alert-text': 'flive_alert_alert-text',
    'alert-info': 'flive_alert_alert-info flive_alert_base',
    'alert-success': 'flive_alert_alert-success flive_alert_base',
    'alert-warning': 'flive_alert_alert-warning flive_alert_base',
    'alert-danger': 'flive_alert_alert-danger flive_alert_base',
    'inline-block': 'flive_alert_inline-block'
  }
};

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var Alert = function Alert(props) {
  var _classNames;

  var className = props.className,
      type = props.type,
      title = props.title,
      text = props.text,
      small = props.small,
      xsmall = props.xsmall,
      children = props.children,
      inlineBlock = props.inlineBlock,
      rest = _objectWithoutProperties(props, ['className', 'type', 'title', 'text', 'small', 'xsmall', 'children', 'inlineBlock']);

  return _react2.default.createElement(
    'div',
    _extends({}, rest, {
      role: 'alert',
      className: (className ? className + ' ' : '') + (0, _getClassName3.default)((0, _classnames2.default)((_classNames = {}, _defineProperty(_classNames, 'alert-' + type, type), _defineProperty(_classNames, 'xsmall', xsmall), _defineProperty(_classNames, 'small', small), _defineProperty(_classNames, 'inline-block', inlineBlock), _classNames)), _styleModuleImportMap)
    }),
    title && _react2.default.createElement(
      'p',
      { className: 'flive_alert_alert-title' },
      title
    ),
    text && _react2.default.createElement(
      'p',
      { className: 'flive_alert_alert-text' },
      text
    ),
    children
  );
};

Alert.propTypes = {
  /** @ignore */
  className: _propTypes2.default.string,
  type: _propTypes2.default.oneOf(['danger', 'warning', 'info', 'success']),
  title: _propTypes2.default.string,
  text: _propTypes2.default.string,
  small: _propTypes2.default.bool,
  xsmall: _propTypes2.default.bool,
  inlineBlock: _propTypes2.default.bool,
  /** @ignore */
  children: _propTypes2.default.node
};

Alert.defaultProps = {
  className: undefined,
  type: 'info',
  title: undefined,
  text: undefined,
  small: false,
  xsmall: false,
  inlineBlock: false,
  children: undefined
};

exports.default = Alert;
module.exports = exports['default'];