import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2026 GoodData Corporation
import { createContext, useCallback, useContext, useMemo, useState } from "react";
const ExportCsvDialogContext = createContext({
    isOpen: false,
    dialogConfig: undefined,
    closeDialog: () => { },
    openDialog: () => { },
});
/**
 * @internal
 */
export const useExportCsvDialogContext = () => {
    return useContext(ExportCsvDialogContext);
};
/**
 * @internal
 */
export function ExportCsvDialogContextProvider({ children }) {
    const [isOpen, setIsOpen] = useState(false);
    const [dialogConfig, setDialogConfig] = useState();
    const openDialog = useCallback((config) => {
        setDialogConfig(config);
        setIsOpen(true);
    }, []);
    const closeDialog = useCallback(() => {
        setIsOpen(false);
    }, []);
    const contextValue = useMemo(() => ({ isOpen, dialogConfig, openDialog, closeDialog }), [isOpen, dialogConfig, openDialog, closeDialog]);
    return _jsx(ExportCsvDialogContext.Provider, { value: contextValue, children: children });
}
//# sourceMappingURL=ExportCsvDialogContext.js.map