"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.InfoBox = void 0;
var _react = _interopRequireDefault(require("react"));
var _Styles = require("./Styles");
var _utils = require("../../utils");
var _Icons = require("../Icons");
var _Typography = require("../Typography");
var _excluded = ["type", "children", "showIcon", "icon", "title", "action"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var InfoBox = exports.InfoBox = function InfoBox(_ref) {
  var _ref$type = _ref.type,
    type = _ref$type === void 0 ? "default" : _ref$type,
    children = _ref.children,
    showIcon = _ref.showIcon,
    icon = _ref.icon,
    _ref$title = _ref.title,
    title = _ref$title === void 0 ? null : _ref$title,
    _ref$action = _ref.action,
    action = _ref$action === void 0 ? null : _ref$action,
    rest = _objectWithoutProperties(_ref, _excluded);
  var statusColors = {
    success: _utils.colors.greenSuccess.color,
    warning: _utils.colors.redAlert.color,
    note: _utils.colors.yellowWarning.color,
    default: _utils.colors.blueSky.color,
    neutral: _utils.colors.gray.color
  };
  // https://davidwalsh.name/hex-opacity
  var opacity = "1A";
  return /*#__PURE__*/_react.default.createElement(_Styles.StyledInfoBoxWrapper, _extends({
    $color: "".concat(statusColors[type]),
    $opacity: opacity
  }, rest), /*#__PURE__*/_react.default.createElement(_Styles.StyledInfoBoxContainer, null, showIcon && /*#__PURE__*/_react.default.createElement("span", null, icon && /*#__PURE__*/_react.default.isValidElement(icon) ? ( /*#__PURE__*/_react.default.cloneElement(icon, {
    fill: statusColors[type],
    width: 18
  })) : type === "success" ? /*#__PURE__*/_react.default.createElement(_Icons.CheckboxBlankTogglerIcon, {
    fill: statusColors[type],
    width: 18
  }) : type === "warning" ? /*#__PURE__*/_react.default.createElement(_Icons.CloseCircleIcon, {
    fill: statusColors[type],
    width: 18
  }) : type === "note" || type === "default" ? /*#__PURE__*/_react.default.createElement(_Icons.InfoIcon, {
    fill: statusColors[type],
    width: 18
  }) : /*#__PURE__*/_react.default.createElement(_Icons.InfoIcon, {
    fill: statusColors["neutral"],
    width: 18
  })), /*#__PURE__*/_react.default.createElement(_Styles.StyledInfoBoxHeader, {
    $hasTitle: title ? true : false
  }, /*#__PURE__*/_react.default.createElement(_Styles.SyledInfoBoxInnerHeader, null, typeof title === "string" && title ? /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
    weight: "bold",
    lineHeight: "loose"
  }, title) : title, action), children)));
};
//# sourceMappingURL=InfoBox.js.map