"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StyledLoader = exports.StyledButton = void 0;
const Button_1 = __importDefault(require("@mui/material/Button"));
const Loader_1 = require("../Loader");
const styled_1 = require("../styled");
const enums_1 = require("./enums");
const getLoaderColor = (color, variant, theme, isDisabled) => {
    if (isDisabled) {
        return theme.palette.grey[500];
    }
    const variantColorMap = {
        contained: theme.palette.primary.contrastText,
        link: theme.palette.components.link.main,
        outlined: theme.palette[color][900],
        text: theme.palette[color][900],
        light: theme.palette[color][900],
    };
    return variantColorMap[variant];
};
exports.StyledButton = (0, styled_1.styled)(Button_1.default) `
  min-width: ${({ variant }) => variant === enums_1.ButtonVariants.Link ? 'auto' : ''};
  padding: ${({ variant }) => (variant === enums_1.ButtonVariants.Link ? 0 : '')};

  :active {
    box-shadow: none;
  }
`;
exports.StyledLoader = (0, styled_1.styled)(Loader_1.Loader, {
    shouldForwardProp: (prop) => !['$color', '$variant', '$isDisabled'].includes(prop),
}) `
  position: absolute;

  color: ${({ $color, $variant, theme, $isDisabled }) => getLoaderColor($color, $variant, theme, $isDisabled)};

  ${({ theme }) => theme.breakpoints.down('sm')} {
    width: 20px;
    height: 20px;
  }
`;
