import React, { useState, useRef } from 'react';
export var DragContext = React.createContext({
    drag: {},
    setDrag: function () { },
});
var DragContainer = function (props) {
    var _a = useState({}), drag = _a[0], setDrag = _a[1];
    var enterCounter = useRef(0);
    function setDragState(event) {
        event.stopPropagation();
        event.preventDefault();
        setDrag({ state: event.type });
    }
    function dragEnter(event) {
        enterCounter.current++;
        setDragState(event);
    }
    function dragLeave(event) {
        enterCounter.current--;
        if (enterCounter.current < 1) {
            setDragState(event);
        }
    }
    return (React.createElement(DragContext.Provider, { value: { drag: drag, setDrag: setDrag } },
        React.createElement("div", { onDragLeave: dragLeave, onDragExit: setDragState, onDragEnter: dragEnter, onDrop: setDragState }, props.children)));
};
export default DragContainer;
//# sourceMappingURL=index.js.map