import React, { useRef } from "react";
export function HorizontalPanelDragHandle(_ref) {
  var onDrag = _ref.onDrag;
  var xStart = useRef(0);
  var resize = useRef(function (e) {
    var dx = xStart.current - e.clientX;
    onDrag({
      dx: dx
    });
    xStart.current = e.clientX;
  });
  var mouseup = useRef(function () {
    document.removeEventListener("mousemove", resize.current, false);
    document.removeEventListener("mousemove", mouseup.current, false);
  });
  return /*#__PURE__*/React.createElement("div", {
    onMouseDown: function onMouseDown(e) {
      xStart.current = e.clientX;
      document.addEventListener("mousemove", resize.current, false);
      document.addEventListener("mouseup", mouseup.current, false);
    },
    style: {
      position: "absolute",
      top: 0,
      right: -1,
      zIndex: 1000,
      height: "100%",
      cursor: "ew-resize",
      width: 3,
      opacity: 0,
      background: "blue"
    }
  });
}