'use client';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfirmationDialog = ConfirmationDialog;
const jsx_runtime_1 = require("react/jsx-runtime");
const button_1 = require("../../../components/ui/button");
const dialog_1 = require("../../../components/ui/dialog");
const loading_button_1 = require("../../../components/ui/loading-button");
const lucide_react_1 = require("lucide-react");
const utils_1 = require("../../../lib/utils");
const class_variance_authority_1 = require("class-variance-authority");
const confirmationDialogIconVariants = (0, class_variance_authority_1.cva)('flex size-10 shrink-0 items-center justify-center rounded-lg [&>svg]:size-6', {
    variants: {
        variant: {
            default: 'bg-red-50 text-red-500',
            warning: 'bg-yellow-50 text-yellow-500',
            destructive: 'bg-red-50 text-red-500',
            success: 'bg-green-50 text-green-800'
        }
    },
    defaultVariants: {
        variant: 'default'
    }
});
const ConfirmationDialogIcon = ({ className, variant, ...props }) => ((0, jsx_runtime_1.jsxs)("span", { className: (0, utils_1.cn)(confirmationDialogIconVariants({ variant }), className), ...props, children: [variant === 'default' && (0, jsx_runtime_1.jsx)(lucide_react_1.Ban, {}), variant === 'warning' && (0, jsx_runtime_1.jsx)(lucide_react_1.TriangleAlert, {}), variant === 'destructive' && (0, jsx_runtime_1.jsx)(lucide_react_1.Ban, {}), variant === 'success' && (0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle2, {})] }));
function ConfirmationDialog({ open, onOpenChange, title = '', description = '', variant = 'default', loading, onConfirm = () => { }, onCancel = () => { }, confirmLabel, cancelLabel }) {
    return ((0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: open, onOpenChange: onOpenChange, children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { "data-testid": "dialog", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { className: "flex-row items-center", children: [(0, jsx_runtime_1.jsx)(ConfirmationDialogIcon, { variant: variant }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { children: title }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { children: description })] })] }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { className: "gap-4", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { onClick: onCancel, variant: "secondary", size: "small", children: cancelLabel ?? 'Cancel' }), (0, jsx_runtime_1.jsx)(loading_button_1.LoadingButton, { loading: loading, onClick: onConfirm, variant: "primary", size: "small", "data-testid": "confirm", children: confirmLabel ?? 'Confirm' })] })] }) }));
}
