import React from "react";
import { LoadingSpinner } from "../LoadingSpinner";
import * as styles from "./styles";
export const Button = React.forwardRef(({ children, disabled = false, onClick, variant = "contained", startAdornment, size = "medium", type = "button", isLoading, props, }, ref) => {
    const handleClick = (e) => {
        if (disabled)
            return;
        if (!onClick)
            return;
        if (isLoading)
            return;
        onClick(e);
    };
    return (React.createElement("button", Object.assign({ "data-variant": variant, "data-size": size, onClick: handleClick, disabled: disabled || isLoading, className: styles.button, type: type, ref: ref }, props), isLoading ? (React.createElement(LoadingSpinner, null)) : (React.createElement(React.Fragment, null,
        startAdornment && (React.createElement("div", { className: styles.iconContainer }, startAdornment)),
        children))));
});
Button.displayName = "Button";
//# sourceMappingURL=index.js.map