import { jsx as _jsx } from "react/jsx-runtime";
import { Icon } from "@powerhousedao/design-system";
import { ToastContainer as RToastContainer, toast as rToast, } from "react-toastify";
export function isConnectTypeOptions(type) {
    return (type === "connect-success" ||
        type === "connect-warning" ||
        type === "connect-loading" ||
        type === "connect-deleted");
}
function getDefaultOptions(type) {
    if (isConnectTypeOptions(type)) {
        const options = {};
        switch (type) {
            case "connect-success":
                options.type = "success";
                options.icon = (_jsx(Icon, { className: "text-green-800", name: "CheckCircleFill", size: 24 }));
                break;
            case "connect-warning":
                options.type = "warning";
                options.icon = (_jsx(Icon, { className: "text-gray-600", name: "WarningFill", size: 24 }));
                break;
            case "connect-loading":
                options.type = "default";
                options.icon = (_jsx(Icon, { className: "text-gray-600", name: "ClockFill", size: 24 }));
                break;
            case "connect-deleted":
                options.type = "error";
                options.icon = (_jsx(Icon, { className: "text-red-800", name: "TrashFill", size: 24 }));
                break;
        }
        return options;
    }
    return { type };
}
export function toast(content, options) {
    const { type = "default", ...restOptions } = options || {};
    const defaultOptions = getDefaultOptions(type);
    return rToast(content, { ...defaultOptions, ...restOptions });
}
const CloseButton = ({ closeToast }) => (_jsx("button", { className: "flex items-center text-gray-500 hover:text-gray-600", onClick: closeToast, children: _jsx(Icon, { name: "XmarkLight", size: 16 }) }));
export const ToastContainer = (props) => (_jsx(RToastContainer, { closeButton: CloseButton, ...props }));
//# sourceMappingURL=toast.js.map