var _excluded = ["children", "className", "color", "label", "loading", "size", "variant", "centered"];
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; }
import React from 'react';
import { StyledCircle, StyledSpinnerContainer, StyledSpinnerContainerWithLabel, StyledSpinnerOverlay, StyledSpinnerOverlayContainer, StyledSpinnerOverlayLabel, StyledSpinnerSVG } from './Spinner.styles';
var radiusMap = {
  xs: 18.5,
  sm: 18,
  md: 20,
  lg: 20.5
};
export var defaultSpinnerSize = 'lg';

/**

 Spinners indicate a loading state on either a full page or smaller component,
 like a menu, select or button.

 @since 10.19.0

 @see [Storybook](https://procore.github.io/core/core-react/latest/?path=/story/demos-spinner--demo)

 @see [Design Guidelines](https://design.procore.com/spinner)

 */
export var Spinner = /*#__PURE__*/React.forwardRef(function Spinner(_ref, ref) {
  var children = _ref.children,
    _ref$className = _ref.className,
    className = _ref$className === void 0 ? '' : _ref$className,
    color = _ref.color,
    label = _ref.label,
    _ref$loading = _ref.loading,
    loading = _ref$loading === void 0 ? false : _ref$loading,
    _ref$size = _ref.size,
    size = _ref$size === void 0 ? defaultSpinnerSize : _ref$size,
    variant = _ref.variant,
    _ref$centered = _ref.centered,
    centered = _ref$centered === void 0 ? false : _ref$centered,
    props = _objectWithoutProperties(_ref, _excluded);
  var mountTime = React.useRef(Date.now());
  var circle = /*#__PURE__*/React.createElement(StyledSpinnerContainer, {
    className: !children ? className : '',
    $color: color,
    $size: size,
    $variant: variant,
    ref: ref
  }, /*#__PURE__*/React.createElement(StyledSpinnerSVG, {
    viewBox: "0 0 48 48",
    xmlns: "http://www.w3.org/2000/svg",
    mountTime: mountTime.current
  }, /*#__PURE__*/React.createElement(StyledCircle, {
    cx: "24",
    cy: "24",
    r: radiusMap[size],
    mountTime: mountTime.current
  })));
  if (!children) {
    return circle;
  }
  return /*#__PURE__*/React.createElement(StyledSpinnerOverlayContainer, _extends({
    $loading: loading,
    className: className,
    $centered: centered
  }, props), /*#__PURE__*/React.createElement(StyledSpinnerOverlay, null), /*#__PURE__*/React.createElement(StyledSpinnerContainerWithLabel, null, circle, /*#__PURE__*/React.createElement(StyledSpinnerOverlayLabel, null, label)), children);
});
Spinner.displayName = 'Spinner';
//# sourceMappingURL=Spinner.js.map