import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from "react";
import { Portal } from "../Portal.js";
import { NotificationPanel } from "./NotificationPanel.js";
import { ToastContext } from "./ToastContext.js";
export function ToastProvider({ children }) {
    const [data, setData] = useState(null);
    const toast = (data) => {
        setData(data);
    };
    return (_jsxs(_Fragment, { children: [_jsx(ToastContext.Provider, { value: toast, children: children }), data && _jsx(Portal, { children: _jsx(NotificationPanel, { data: data, onClose: () => toast(null) }) })] }));
}
//# sourceMappingURL=ToastProvider.js.map