var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
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/latest/?path=/story/demos-spinner--demo)

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

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