"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UILoader = exports.UISpinnerSize = void 0;
const react_1 = __importDefault(require("react"));
const react_2 = require("@fluentui/react");
Object.defineProperty(exports, "UISpinnerSize", { enumerable: true, get: function () { return react_2.SpinnerSize; } });
require("./UILoader.scss");
/**
 * UILoader component
 * based on https://developer.microsoft.com/en-us/fluentui#/controls/web/spinner
 *
 * @exports
 * @class UILoader
 * @extends {React.Component<ISpinnerProps, {}>}
 */
class UILoader extends react_1.default.Component {
    /**
     * Initializes component properties.
     *
     * @param {UILoaderProps} props
     */
    constructor(props) {
        super(props);
    }
    /**
     * @returns {JSX.Element}
     */
    render() {
        const { blockDOM, delayed } = this.props;
        const loaderStyles = () => ({
            ...{
                root: {
                    ...(blockDOM && { height: '100%' })
                },
                circle: [
                    {
                        borderColor: 'var(--vscode-progressBar-background) var(--vscode-terminal-ansiBrightWhite) var(--vscode-terminal-ansiBrightWhite)',
                        borderWidth: 2,
                        zIndex: 1
                    }
                ],
                label: {
                    color: 'var(--vscode-foreground)',
                    fontSize: 14,
                    fontWeight: 'bold',
                    zIndex: 1
                }
            }
        });
        const spinner = react_1.default.createElement(react_2.Spinner, { ...this.props, styles: loaderStyles });
        if (!blockDOM) {
            return spinner;
        }
        else {
            const overlayStyles = () => ({
                ...{
                    root: {
                        backgroundColor: 'transparent',
                        selectors: {
                            '&:before': {
                                content: '""',
                                position: 'absolute',
                                inset: 0,
                                backgroundColor: 'var(--vscode-editor-background)',
                                opacity: 0.6,
                                zIndex: 1
                            }
                        }
                    }
                }
            });
            return (react_1.default.createElement(react_2.Overlay, { className: `ui-loader-blocker${delayed ? ' ui-loader--delayed' : ''}`, styles: overlayStyles }, spinner));
        }
    }
}
exports.UILoader = UILoader;
//# sourceMappingURL=UILoader.js.map