indicator-ui 0.1.112 → 0.1.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -54251,7 +54251,11 @@ function useDrag() {
54251
54251
  args[_key] = arguments[_key];
54252
54252
  }
54253
54253
  var ref = args[0],
54254
- callback = args[1];
54254
+ callback = args[1],
54255
+ _args$ = args[2],
54256
+ options = _args$ === void 0 ? {} : _args$;
54257
+ var _options$dropDragging = options.dropDraggingOnLeave,
54258
+ dropDraggingOnLeave = _options$dropDragging === void 0 ? false : _options$dropDragging;
54255
54259
  var _useSimpleRefElementW = (0,_hooks__WEBPACK_IMPORTED_MODULE_1__.useSimpleRefElementWork)(ref),
54256
54260
  _useSimpleRefElementW2 = _slicedToArray(_useSimpleRefElementW, 1),
54257
54261
  getObj = _useSimpleRefElementW2[0];
@@ -54332,28 +54336,34 @@ function useDrag() {
54332
54336
  });
54333
54337
  }, []);
54334
54338
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
54339
+ var _window;
54335
54340
  var obj = getObj();
54336
54341
  obj === null || obj === void 0 || obj.addEventListener("mousedown", onStart);
54337
54342
  obj === null || obj === void 0 || obj.addEventListener("mousemove", onMove);
54338
- obj === null || obj === void 0 || obj.addEventListener("mouseup", onEnd);
54339
- obj === null || obj === void 0 || obj.addEventListener("mouseleave", onEnd);
54343
+ (_window = window) === null || _window === void 0 || _window.addEventListener("mouseup", onEnd);
54340
54344
  obj === null || obj === void 0 || obj.addEventListener("touchstart", onStart);
54341
54345
  obj === null || obj === void 0 || obj.addEventListener("touchmove", onMove, {
54342
54346
  passive: false
54343
54347
  });
54344
54348
  obj === null || obj === void 0 || obj.addEventListener("touchend", onEnd);
54345
54349
  obj === null || obj === void 0 || obj.addEventListener("touchcancel", onEnd);
54350
+ if (dropDraggingOnLeave) {
54351
+ obj === null || obj === void 0 || obj.addEventListener("mouseleave", onEnd);
54352
+ } else {
54353
+ obj === null || obj === void 0 || obj.removeEventListener("mouseleave", onEnd);
54354
+ }
54346
54355
  return function () {
54356
+ var _window2;
54347
54357
  obj === null || obj === void 0 || obj.removeEventListener("mousedown", onStart);
54348
54358
  obj === null || obj === void 0 || obj.removeEventListener("mousemove", onMove);
54349
- obj === null || obj === void 0 || obj.removeEventListener("mouseup", onEnd);
54350
- obj === null || obj === void 0 || obj.removeEventListener("mouseleave", onEnd);
54359
+ (_window2 = window) === null || _window2 === void 0 || _window2.removeEventListener("mouseup", onEnd);
54351
54360
  obj === null || obj === void 0 || obj.removeEventListener("touchstart", onStart);
54352
54361
  obj === null || obj === void 0 || obj.removeEventListener("touchmove", onMove);
54353
54362
  obj === null || obj === void 0 || obj.removeEventListener("touchend", onEnd);
54354
54363
  obj === null || obj === void 0 || obj.removeEventListener("touchcancel", onEnd);
54364
+ obj === null || obj === void 0 || obj.removeEventListener("mouseleave", onEnd);
54355
54365
  };
54356
- }, [onMove, onEnd]);
54366
+ }, [onMove, onEnd, dropDraggingOnLeave]);
54357
54367
  return {
54358
54368
  isDrag: isDrag
54359
54369
  };