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 = ["color", "size", "aria-label", "aria-live", "className"];
import * as React from 'react';
import classNames from 'classnames';
export var SPINNER_SIZE = {
  SMALL: 'small',
  XSMALL: 'xsmall',
  XXSMALL: 'xxsmall'
};
export var SPINNER_COLOR = {
  black: 'black',
  white: 'white',
  'indigo-50': 'indigo-50',
  'gray-70': 'gray-70',
  'gray-50': 'gray-50',
  'red-40': 'red-40',
  'red-50': 'red-50',
  'yellow-40': 'yellow-40',
  'blue-40': 'blue-40',
  'blue-60': 'blue-60'
};

var Spinner = function Spinner(_ref) {
  var _classNames;

  var _ref$color = _ref.color,
      color = _ref$color === void 0 ? 'gray-70' : _ref$color,
      _ref$size = _ref.size,
      size = _ref$size === void 0 ? SPINNER_SIZE.SMALL : _ref$size,
      _ref$ariaLabel = _ref['aria-label'],
      ariaLabel = _ref$ariaLabel === void 0 ? 'loading' : _ref$ariaLabel,
      _ref$ariaLive = _ref['aria-live'],
      ariaLive = _ref$ariaLive === void 0 ? 'assertive' : _ref$ariaLive,
      className = _ref.className,
      props = _objectWithoutProperties(_ref, _excluded);

  var spinnerClassNames = classNames('sg-spinner', (_classNames = {}, _defineProperty(_classNames, "sg-spinner--".concat(String(color)), color), _defineProperty(_classNames, "sg-spinner--".concat(String(size)), size), _classNames), className);
  return /*#__PURE__*/React.createElement("div", _extends({}, props, {
    className: spinnerClassNames,
    "aria-live": ariaLive,
    role: "status",
    "aria-atomic": "true"
  }), /*#__PURE__*/React.createElement("span", {
    className: "sg-visually-hidden"
  }, ariaLabel));
};

export default Spinner;