"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 });
exports.ButtonGroup = exports.Button = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
/**
* Button Component
*
* Used for actions, submitting forms, and other interactive UI elements
*/
const React = __importStar(require("react"));
// Button Component
const Button = ({ children, variant = 'primary', size = 'medium', disabled = false, loading = false, icon, iconPosition = 'left', fullWidth = false, onClick, type = 'button', className = '', ...props }) => {
    const buttonClasses = [
        'bf-button',
        `bf-button--${variant}`,
        `bf-button--${size}`,
        fullWidth && 'bf-button--full-width',
        loading && 'bf-button--loading',
        className
    ].filter(Boolean).join(' ');
    const handleClick = (event) => {
        if (!disabled && !loading && onClick) {
            onClick(event);
        }
    };
    return ((0, jsx_runtime_1.jsxs)("button", { type: type, className: buttonClasses, disabled: disabled || loading, onClick: handleClick, ...props, children: [loading && (0, jsx_runtime_1.jsx)("span", { className: "bf-button__loader", children: "Loading..." }), !loading && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon && iconPosition === 'left' && ((0, jsx_runtime_1.jsx)("span", { className: "bf-button__icon bf-button__icon--left", children: icon })), (0, jsx_runtime_1.jsx)("span", { className: "bf-button__text", children: children }), icon && iconPosition === 'right' && ((0, jsx_runtime_1.jsx)("span", { className: "bf-button__icon bf-button__icon--right", children: icon }))] }))] }));
};
exports.Button = Button;
// Button Group Component
const ButtonGroup = ({ children, variant = 'primary', size = 'medium', vertical = false, ...props }) => {
    const groupClasses = [
        'bf-button-group',
        vertical && 'bf-button-group--vertical',
        `bf-button-group--${variant}`,
        `bf-button-group--${size}`
    ].filter(Boolean).join(' ');
    const buttons = React.Children.map(children, (child) => {
        if (React.isValidElement(child) && child.type === Button) {
            const btn = child;
            return React.cloneElement(btn, {
                variant: variant || btn.props.variant,
                size: size || btn.props.size
            });
        }
        return child;
    });
    return ((0, jsx_runtime_1.jsx)("div", { className: groupClasses, ...props, children: buttons }));
};
exports.ButtonGroup = ButtonGroup;
exports.default = Button;
//# sourceMappingURL=Button.js.map