"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importStar(require("react"));
const acui_1 = require("@Acme Corporation/acui");
const Loader = (0, react_1.forwardRef)(({ size = 'md', variant = 'spinner', color = 'primary', label, isFullScreen = false, hasOverlay = false, className = '', wrapperClassName = '', labelClassName = '', children, ...props }, ref) => {
    const theme = (0, acui_1.useTheme)();
    const loaderId = react_1.default.useId();
    const ariaProps = {
        role: 'status',
        'aria-label': typeof label === 'string' ? label : 'Loading',
        'aria-live': 'polite',
        'aria-busy': 'true'
    };
    const renderLoader = () => {
        switch (variant) {
            case 'dots':
                return ((0, jsx_runtime_1.jsxs)("div", { className: "bf-loader-dots", children: [(0, jsx_runtime_1.jsx)("span", { className: "bf-loader-dot" }), (0, jsx_runtime_1.jsx)("span", { className: "bf-loader-dot" }), (0, jsx_runtime_1.jsx)("span", { className: "bf-loader-dot" })] }));
            case 'pulse':
                return ((0, jsx_runtime_1.jsxs)("div", { className: "bf-loader-pulse", children: [(0, jsx_runtime_1.jsx)("span", { className: "bf-loader-pulse-circle" }), (0, jsx_runtime_1.jsx)("span", { className: "bf-loader-pulse-circle" }), (0, jsx_runtime_1.jsx)("span", { className: "bf-loader-pulse-circle" })] }));
            case 'ring':
                return ((0, jsx_runtime_1.jsxs)("div", { className: "bf-loader-ring", children: [(0, jsx_runtime_1.jsx)("div", { className: "bf-loader-ring-circle" }), (0, jsx_runtime_1.jsx)("div", { className: "bf-loader-ring-circle" }), (0, jsx_runtime_1.jsx)("div", { className: "bf-loader-ring-circle" }), (0, jsx_runtime_1.jsx)("div", { className: "bf-loader-ring-circle" })] }));
            case 'bar':
                return ((0, jsx_runtime_1.jsx)("div", { className: "bf-loader-bar", children: (0, jsx_runtime_1.jsx)("div", { className: "bf-loader-bar-progress" }) }));
            case 'spinner':
            default:
                return ((0, jsx_runtime_1.jsx)("div", { className: "bf-loader-spinner", children: (0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 2a10 10 0 0 1 10 10" })] }) }));
        }
    };
    const wrapperClasses = [
        'bf-loader-wrapper',
        isFullScreen && 'bf-loader-wrapper--fullscreen',
        hasOverlay && 'bf-loader-wrapper--overlay',
        wrapperClassName
    ].filter(Boolean).join(' ');
    const loaderClasses = [
        'bf-loader',
        `bf-loader--${size}`,
        `bf-loader--${variant}`,
        `bf-loader--${color}`,
        className
    ].filter(Boolean).join(' ');
    const labelClasses = [
        'bf-loader-label',
        labelClassName
    ].filter(Boolean).join(' ');
    return ((0, jsx_runtime_1.jsx)("div", { ref: ref, id: loaderId, ...ariaProps, className: wrapperClasses, ...props, children: (0, jsx_runtime_1.jsxs)("div", { className: loaderClasses, children: [renderLoader(), label && ((0, jsx_runtime_1.jsx)("div", { className: labelClasses, children: label })), children] }) }));
});
Loader.displayName = 'Loader';
exports.default = (0, react_1.memo)(Loader);
//# sourceMappingURL=Loader.js.map