"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StepIcon = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const StepDefaultFillMd_1 = require("../../../icons/StepDefaultFillMd");
const StepErrorFillMd_1 = require("../../../icons/StepErrorFillMd");
const StepSuccessFillMd_1 = require("../../../icons/StepSuccessFillMd");
const cva_1 = require("../../utils/cva");
const constants_1 = require("./constants");
const stepIcon = (0, cva_1.cva)(constants_1.stepIconClassnames.root, {
    variants: {
        isActive: {
            true: constants_1.stepIconClassnames.active,
        },
        isCompleted: {
            true: constants_1.stepIconClassnames.success,
        },
        isError: {
            true: constants_1.stepIconClassnames.error,
        },
        isWarning: {
            true: constants_1.stepIconClassnames.warning,
        },
    },
});
const StepIcon = ({ icon: Icon, isActive, isCompleted, isError, isWarning, }) => {
    if (Icon) {
        return ((0, jsx_runtime_1.jsx)(Icon, { isActive: isActive, isCompleted: isCompleted, isError: isError, isWarning: isWarning, className: stepIcon({ isActive, isCompleted, isError, isWarning }) }));
    }
    if (isError && !isActive) {
        return (0, jsx_runtime_1.jsx)(StepErrorFillMd_1.StepErrorFillMd, { className: stepIcon({ isError: true }) });
    }
    if ((isCompleted && !isActive) || (isCompleted && isWarning && !isActive)) {
        return ((0, jsx_runtime_1.jsx)(StepSuccessFillMd_1.StepSuccessFillMd, { className: stepIcon({ isCompleted: true, isWarning }) }));
    }
    return ((0, jsx_runtime_1.jsx)(StepDefaultFillMd_1.StepDefaultFillMd, { className: stepIcon({ isActive, isCompleted, isError, isWarning }) }));
};
exports.StepIcon = StepIcon;
