"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "useDisableScroll", {
    enumerable: true,
    get: function() {
        return useDisableScroll;
    }
});
const _react = require("react");
function useDisableScroll(ref, enabled = true) {
    (0, _react.useEffect)(()=>{
        if (!enabled || !ref.current) return;
        const el = ref.current;
        const preventScroll = (e)=>{
            e.preventDefault();
            e.stopPropagation();
        };
        el.addEventListener('wheel', preventScroll, {
            passive: false
        });
        el.addEventListener('touchmove', preventScroll, {
            passive: false
        });
        return ()=>{
            el.removeEventListener('wheel', preventScroll);
            el.removeEventListener('touchmove', preventScroll);
        };
    }, [
        ref,
        enabled
    ]);
}
