import { useCallback, useMemo } from "react";
import { resolveDataGridSettings } from "../../data-grid-preferences/helpers/data-grid-settings.js";
import { useControllableState } from "../../utils/hooks/index.js";
function useDataGridSettings(args) {
    const { settings: userSettings, defaultSettings, onSettingsChange } = args;
    const [settings, setSettings] = useControllableState({
        defaultValue: defaultSettings !== null && defaultSettings !== void 0 ? defaultSettings : {},
        value: userSettings,
        onChange: onSettingsChange,
    });
    const resolvedSettings = useMemo(() => resolveDataGridSettings(settings), [settings]);
    const updateSettings = useCallback((newSettings) => {
        setSettings((prevSettings) => (Object.assign(Object.assign({}, prevSettings), newSettings)));
    }, [setSettings]);
    return {
        settings: resolvedSettings,
        updateSettings,
    };
}
export { useDataGridSettings };
//# sourceMappingURL=useDataGridSettings.js.map