"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Confirmation = void 0;
const react_1 = __importDefault(require("react"));
const Button_1 = require("../Button");
const Styled_1 = require("../Styled");
const icons_1 = require("../../icons");
const varsUtilities_1 = require("../../varsUtilities");
const Text_1 = require("../Text");
const Modal_1 = require("../Modal");
const Confirmation = ({ onConfirm, onCancel, value, style, variant, label, }) => {
    const modal = (0, Modal_1.useModal)();
    return variant === 'icons' ? (react_1.default.createElement(Styled_1.RowEnd, { style: {
            borderTop: (0, varsUtilities_1.border)(1),
            width: '100%',
            marginTop: 16,
            paddingTop: 16,
            marginRight: 8,
        } },
        label ? react_1.default.createElement(Text_1.Text, { light: true }, label) : null,
        react_1.default.createElement(Button_1.Button, { onClick: () => {
                if (modal) {
                    modal.setOpen(false);
                }
                return onCancel(value);
            }, ghost: true, style: { marginLeft: 16 }, icon: react_1.default.createElement(icons_1.IconClose, null) }),
        react_1.default.createElement(Button_1.Button, { color: "primary", onClick: async () => {
                if (modal) {
                    modal.setOpen(false);
                }
                return onConfirm(value);
            }, ghost: true, style: { marginLeft: 4 }, icon: react_1.default.createElement(icons_1.IconCheckLarge, null) }))) : (react_1.default.createElement(Styled_1.RowEnd, null,
        react_1.default.createElement(Button_1.Button, { onClick: () => {
                if (modal) {
                    modal.setOpen(false);
                }
                return onCancel(value);
            }, style: { marginRight: 24, marginLeft: 16 }, color: "system", displayShortcut: true, keyboardShortcut: "Esc" }, "Cancel"),
        react_1.default.createElement(Button_1.Button, { displayShortcut: true, keyboardShortcut: "Enter", onClick: async () => {
                if (modal) {
                    modal.setOpen(false);
                }
                return onConfirm(value);
            } }, label ?? 'Confirm')));
};
exports.Confirmation = Confirmation;
//# sourceMappingURL=index.js.map