import { ButtonStyleType } from "../Button/Button";
import Card from "../Card/Card";
import ConfirmModal from "../Modal/ConfirmModal";
import React, { useState } from "react";
const ActionCard = (props) => {
    const [currentAction, setCurrentAction] = useState(undefined);
    return (React.createElement(React.Fragment, null,
        React.createElement(Card, { title: props.title, description: props.description, buttons: props.actions.map((action) => {
                return {
                    title: action.actionName,
                    buttonStyle: action.actionButtonStyle || ButtonStyleType.NORMAL,
                    onClick: () => {
                        setCurrentAction(action);
                    },
                    icon: action.actionIcon,
                    isLoading: action.isLoading,
                };
            }) }),
        currentAction ? (React.createElement(ConfirmModal, { description: `Are you sure you want to ${currentAction.actionName}?`, title: `Confirm ${currentAction.actionName}`, onSubmit: () => {
                currentAction.onConfirmAction();
                setCurrentAction(undefined);
            }, submitButtonText: `Confirm`, onClose: () => {
                setCurrentAction(undefined);
            } })) : (React.createElement(React.Fragment, null))));
};
export default ActionCard;
//# sourceMappingURL=ActionCard.js.map