import { addBodyClass, removeBodyClass } from "../../utils/dom.js";
import { noScrollClass } from "./consts.js";
import { useEffect, useState } from "react";

//#region src/core/vuiProvider/useBodyScrollLock.tsx
const useBodyScrollLock = () => {
	const [isScrollLocked, setIsScrollLocked] = useState(false);
	const toggleIsScrollLocked = () => setIsScrollLocked(!isScrollLocked);
	useEffect(() => {
		if (isScrollLocked) addBodyClass(noScrollClass);
		else removeBodyClass(noScrollClass);
		return () => removeBodyClass(noScrollClass);
	}, [isScrollLocked]);
	return {
		isScrollLocked,
		setIsScrollLocked,
		toggleIsScrollLocked
	};
};

//#endregion
export { useBodyScrollLock };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=useBodyScrollLock.js.map