@os-design/drag-sort 1.0.14 → 1.0.15

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.
Files changed (88) hide show
  1. package/dist/cjs/DragAndDrop.js +50 -72
  2. package/dist/cjs/DragAndDrop.js.map +1 -1
  3. package/dist/cjs/Draggable.js +19 -36
  4. package/dist/cjs/Draggable.js.map +1 -1
  5. package/dist/cjs/Droppable.js +24 -33
  6. package/dist/cjs/Droppable.js.map +1 -1
  7. package/dist/cjs/index.js +0 -9
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/utils/ListStore.js +4 -13
  10. package/dist/cjs/utils/ListStore.js.map +1 -1
  11. package/dist/cjs/utils/NodeList.js +25 -56
  12. package/dist/cjs/utils/NodeList.js.map +1 -1
  13. package/dist/cjs/utils/getElementOffset.js +0 -4
  14. package/dist/cjs/utils/getElementOffset.js.map +1 -1
  15. package/dist/cjs/utils/getElementScroll.js +0 -4
  16. package/dist/cjs/utils/getElementScroll.js.map +1 -1
  17. package/dist/cjs/utils/getNodeRect.js +9 -18
  18. package/dist/cjs/utils/getNodeRect.js.map +1 -1
  19. package/dist/cjs/utils/useAppendClassName.js +0 -3
  20. package/dist/cjs/utils/useAppendClassName.js.map +1 -1
  21. package/dist/cjs/utils/useBlankNode.js +17 -26
  22. package/dist/cjs/utils/useBlankNode.js.map +1 -1
  23. package/dist/cjs/utils/useDragAndDrop.js +0 -8
  24. package/dist/cjs/utils/useDragAndDrop.js.map +1 -1
  25. package/dist/cjs/utils/useDragEffect.js +104 -163
  26. package/dist/cjs/utils/useDragEffect.js.map +1 -1
  27. package/dist/cjs/utils/useDroppable.js +0 -8
  28. package/dist/cjs/utils/useDroppable.js.map +1 -1
  29. package/dist/cjs/utils/useGeneratedId.js +0 -3
  30. package/dist/cjs/utils/useGeneratedId.js.map +1 -1
  31. package/dist/cjs/utils/useGetNodeStyle.js +0 -3
  32. package/dist/cjs/utils/useGetNodeStyle.js.map +1 -1
  33. package/dist/cjs/utils/useInitRect.js +0 -3
  34. package/dist/cjs/utils/useInitRect.js.map +1 -1
  35. package/dist/cjs/utils/useInitScrollOffset.js +0 -5
  36. package/dist/cjs/utils/useInitScrollOffset.js.map +1 -1
  37. package/dist/cjs/utils/useMoveNode.js +23 -48
  38. package/dist/cjs/utils/useMoveNode.js.map +1 -1
  39. package/dist/cjs/utils/useScrollEventByPoint.js +2 -10
  40. package/dist/cjs/utils/useScrollEventByPoint.js.map +1 -1
  41. package/dist/cjs/utils/useTargetList.js +8 -21
  42. package/dist/cjs/utils/useTargetList.js.map +1 -1
  43. package/dist/cjs/utils/useTransitionStyle.js +2 -5
  44. package/dist/cjs/utils/useTransitionStyle.js.map +1 -1
  45. package/dist/esm/DragAndDrop.js +19 -12
  46. package/dist/esm/DragAndDrop.js.map +1 -1
  47. package/dist/esm/Draggable.js +10 -9
  48. package/dist/esm/Draggable.js.map +1 -1
  49. package/dist/esm/Droppable.js +17 -14
  50. package/dist/esm/Droppable.js.map +1 -1
  51. package/dist/esm/index.js.map +1 -1
  52. package/dist/esm/utils/ListStore.js +3 -8
  53. package/dist/esm/utils/ListStore.js.map +1 -1
  54. package/dist/esm/utils/NodeList.js +17 -36
  55. package/dist/esm/utils/NodeList.js.map +1 -1
  56. package/dist/esm/utils/getElementOffset.js +0 -3
  57. package/dist/esm/utils/getElementOffset.js.map +1 -1
  58. package/dist/esm/utils/getElementScroll.js +0 -3
  59. package/dist/esm/utils/getElementScroll.js.map +1 -1
  60. package/dist/esm/utils/getNodeRect.js +1 -2
  61. package/dist/esm/utils/getNodeRect.js.map +1 -1
  62. package/dist/esm/utils/useAppendClassName.js +1 -2
  63. package/dist/esm/utils/useAppendClassName.js.map +1 -1
  64. package/dist/esm/utils/useBlankNode.js +10 -9
  65. package/dist/esm/utils/useBlankNode.js.map +1 -1
  66. package/dist/esm/utils/useDragAndDrop.js +0 -2
  67. package/dist/esm/utils/useDragAndDrop.js.map +1 -1
  68. package/dist/esm/utils/useDragEffect.js +57 -60
  69. package/dist/esm/utils/useDragEffect.js.map +1 -1
  70. package/dist/esm/utils/useDroppable.js +0 -2
  71. package/dist/esm/utils/useDroppable.js.map +1 -1
  72. package/dist/esm/utils/useGeneratedId.js +0 -2
  73. package/dist/esm/utils/useGeneratedId.js.map +1 -1
  74. package/dist/esm/utils/useGetNodeStyle.js +0 -2
  75. package/dist/esm/utils/useGetNodeStyle.js.map +1 -1
  76. package/dist/esm/utils/useInitRect.js +0 -2
  77. package/dist/esm/utils/useInitRect.js.map +1 -1
  78. package/dist/esm/utils/useInitScrollOffset.js +0 -2
  79. package/dist/esm/utils/useInitScrollOffset.js.map +1 -1
  80. package/dist/esm/utils/useMoveNode.js +1 -11
  81. package/dist/esm/utils/useMoveNode.js.map +1 -1
  82. package/dist/esm/utils/useScrollEventByPoint.js +0 -5
  83. package/dist/esm/utils/useScrollEventByPoint.js.map +1 -1
  84. package/dist/esm/utils/useTargetList.js +2 -3
  85. package/dist/esm/utils/useTargetList.js.map +1 -1
  86. package/dist/esm/utils/useTransitionStyle.js +0 -2
  87. package/dist/esm/utils/useTransitionStyle.js.map +1 -1
  88. package/package.json +11 -11
@@ -1,105 +1,84 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _usePreventDefaultEvent = _interopRequireDefault(require("@os-design/use-prevent-default-event"));
13
-
14
10
  var _useMemoObject = _interopRequireDefault(require("@os-design/use-memo-object"));
15
-
16
11
  var _useDrag2 = _interopRequireDefault(require("@os-design/use-drag"));
17
-
18
12
  var _portal = _interopRequireDefault(require("@os-design/portal"));
19
-
20
13
  var _useAutoScroll = _interopRequireDefault(require("@os-design/use-auto-scroll"));
21
-
22
14
  var _useDragAndDrop = require("./utils/useDragAndDrop");
23
-
24
15
  var _ListStore = _interopRequireDefault(require("./utils/ListStore"));
25
-
26
16
  var _useDragEffect = _interopRequireDefault(require("./utils/useDragEffect"));
27
-
28
17
  var _useGeneratedId = _interopRequireDefault(require("./utils/useGeneratedId"));
29
-
30
18
  var _useTransitionStyle = _interopRequireDefault(require("./utils/useTransitionStyle"));
31
-
32
19
  var _useInitRect = _interopRequireDefault(require("./utils/useInitRect"));
33
-
34
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
35
-
36
21
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37
-
38
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
39
-
40
23
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
41
-
42
24
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
43
-
44
25
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
45
-
46
26
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
47
-
48
27
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
49
-
50
28
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
51
-
52
29
  /**
53
30
  * The container containing one or more lists with draggable nodes.
54
31
  */
55
32
  var DragAndDrop = function DragAndDrop(_ref) {
56
33
  var draggedNodeContainer = _ref.draggedNodeContainer,
57
- _ref$minMouseDistPx = _ref.minMouseDistPx,
58
- minMouseDistPx = _ref$minMouseDistPx === void 0 ? 10 : _ref$minMouseDistPx,
59
- _ref$longPressMs = _ref.longPressMs,
60
- longPressMs = _ref$longPressMs === void 0 ? 500 : _ref$longPressMs,
61
- _ref$autoScrollDistPe = _ref.autoScrollDistPercent,
62
- autoScrollDistPercent = _ref$autoScrollDistPe === void 0 ? 20 : _ref$autoScrollDistPe,
63
- _ref$autoScrollMaxSpe = _ref.autoScrollMaxSpeedPx,
64
- autoScrollMaxSpeedPx = _ref$autoScrollMaxSpe === void 0 ? 100 : _ref$autoScrollMaxSpe,
65
- _ref$transitionDelayM = _ref.transitionDelayMs,
66
- transitionDelayMs = _ref$transitionDelayM === void 0 ? 250 : _ref$transitionDelayM,
67
- _ref$onDragEnd = _ref.onDragEnd,
68
- onDragEnd = _ref$onDragEnd === void 0 ? function () {} : _ref$onDragEnd,
69
- children = _ref.children;
34
+ _ref$minMouseDistPx = _ref.minMouseDistPx,
35
+ minMouseDistPx = _ref$minMouseDistPx === void 0 ? 10 : _ref$minMouseDistPx,
36
+ _ref$longPressMs = _ref.longPressMs,
37
+ longPressMs = _ref$longPressMs === void 0 ? 500 : _ref$longPressMs,
38
+ _ref$autoScrollDistPe = _ref.autoScrollDistPercent,
39
+ autoScrollDistPercent = _ref$autoScrollDistPe === void 0 ? 20 : _ref$autoScrollDistPe,
40
+ _ref$autoScrollMaxSpe = _ref.autoScrollMaxSpeedPx,
41
+ autoScrollMaxSpeedPx = _ref$autoScrollMaxSpe === void 0 ? 100 : _ref$autoScrollMaxSpe,
42
+ _ref$transitionDelayM = _ref.transitionDelayMs,
43
+ transitionDelayMs = _ref$transitionDelayM === void 0 ? 250 : _ref$transitionDelayM,
44
+ _ref$onDragEnd = _ref.onDragEnd,
45
+ onDragEnd = _ref$onDragEnd === void 0 ? function () {} : _ref$onDragEnd,
46
+ children = _ref.children;
70
47
  // The user can drag a node between the lists (the Droppable components).
71
48
  // To determine which list a node should be dropped in, we need to store refs to all the lists.
72
- var listStoreRef = (0, _react.useRef)(new _ListStore["default"]()); // The class name for a node used to set the transition style
49
+ var listStoreRef = (0, _react.useRef)(new _ListStore["default"]());
73
50
 
51
+ // The class name for a node used to set the transition style
74
52
  var generatedId = (0, _useGeneratedId["default"])();
75
53
  var nodeClassName = (0, _react.useMemo)(function () {
76
54
  return "n".concat(generatedId);
77
- }, [generatedId]); // The node that is currently being dragged
55
+ }, [generatedId]);
78
56
 
57
+ // The node that is currently being dragged
79
58
  var _useState = (0, _react.useState)(null),
80
- _useState2 = _slicedToArray(_useState, 2),
81
- draggedNode = _useState2[0],
82
- setDraggedNode = _useState2[1];
83
-
59
+ _useState2 = _slicedToArray(_useState, 2),
60
+ draggedNode = _useState2[0],
61
+ setDraggedNode = _useState2[1];
84
62
  var startNodeRef = (0, _react.useRef)(null);
85
-
86
63
  var _useState3 = (0, _react.useState)({
87
- x: 0,
88
- y: 0
89
- }),
90
- _useState4 = _slicedToArray(_useState3, 2),
91
- cursorPosition = _useState4[0],
92
- setCursorPosition = _useState4[1]; // Add a new list to the store
93
-
94
-
64
+ x: 0,
65
+ y: 0
66
+ }),
67
+ _useState4 = _slicedToArray(_useState3, 2),
68
+ cursorPosition = _useState4[0],
69
+ setCursorPosition = _useState4[1];
70
+
71
+ // Add a new list to the store
95
72
  var registerList = (0, _react.useCallback)(function (list) {
96
73
  listStoreRef.current.add(list);
97
- }, []); // Remove the existing list from the store
74
+ }, []);
98
75
 
76
+ // Remove the existing list from the store
99
77
  var deregisterList = (0, _react.useCallback)(function (id) {
100
78
  listStoreRef.current.remove(id);
101
- }, []); // Set the style to delay transitions when the node is dragging
79
+ }, []);
102
80
 
81
+ // Set the style to delay transitions when the node is dragging
103
82
  (0, _useTransitionStyle["default"])({
104
83
  className: nodeClassName,
105
84
  ms: transitionDelayMs,
@@ -108,10 +87,8 @@ var DragAndDrop = function DragAndDrop(_ref) {
108
87
  var onDragStart = (0, _react.useCallback)(function (pos, startPos) {
109
88
  var startNode = startNodeRef.current;
110
89
  if (!startNode) return;
111
-
112
90
  var _startNode$node = _slicedToArray(startNode.node, 3),
113
- nodeRef = _startNode$node[2];
114
-
91
+ nodeRef = _startNode$node[2];
115
92
  if (!nodeRef.current) return;
116
93
  var rect = nodeRef.current.getBoundingClientRect();
117
94
  setCursorPosition(pos);
@@ -131,18 +108,17 @@ var DragAndDrop = function DragAndDrop(_ref) {
131
108
  var dragEndHandler = (0, _react.useCallback)(function () {
132
109
  setDraggedNode(null);
133
110
  }, []);
134
-
135
111
  var _useDrag = (0, _useDrag2["default"])({
136
- onDragStart: onDragStart,
137
- onDragMove: onDragMove,
138
- onDragEnd: dragEndHandler,
139
- minMouseDistPx: minMouseDistPx,
140
- longPressMs: longPressMs
141
- }),
142
- onMouseDown = _useDrag.onMouseDown,
143
- onTouchStart = _useDrag.onTouchStart; // Handlers that determine whether a user clicks on the node
144
-
145
-
112
+ onDragStart: onDragStart,
113
+ onDragMove: onDragMove,
114
+ onDragEnd: dragEndHandler,
115
+ minMouseDistPx: minMouseDistPx,
116
+ longPressMs: longPressMs
117
+ }),
118
+ onMouseDown = _useDrag.onMouseDown,
119
+ onTouchStart = _useDrag.onTouchStart;
120
+
121
+ // Handlers that determine whether a user clicks on the node
146
122
  var mouseDownHandler = (0, _react.useCallback)(function (e, list, node) {
147
123
  startNodeRef.current = {
148
124
  list: list,
@@ -156,18 +132,21 @@ var DragAndDrop = function DragAndDrop(_ref) {
156
132
  node: node
157
133
  };
158
134
  onTouchStart(e);
159
- }, [onTouchStart]); // Prevent body scrolling when the node is dragging.
160
- // It's important to attach the event to the body (not to the document). Otherwise, it won't work in mobile chrome.
135
+ }, [onTouchStart]);
161
136
 
162
- (0, _usePreventDefaultEvent["default"])(document.body, 'touchmove', !!draggedNode); // Implement the drag animation
137
+ // Prevent body scrolling when the node is dragging.
138
+ // It's important to attach the event to the body (not to the document). Otherwise, it won't work in mobile chrome.
139
+ (0, _usePreventDefaultEvent["default"])(document.body, 'touchmove', !!draggedNode);
163
140
 
141
+ // Implement the drag animation
164
142
  (0, _useDragEffect["default"])({
165
143
  draggedNode: draggedNode,
166
144
  cursorPosition: cursorPosition,
167
145
  listStoreRef: listStoreRef,
168
146
  onDragEnd: onDragEnd
169
- }); // Auto scroll if the cursor position is located near the border
147
+ });
170
148
 
149
+ // Auto scroll if the cursor position is located near the border
171
150
  (0, _useAutoScroll["default"])({
172
151
  enabled: !!draggedNode,
173
152
  distPercent: autoScrollDistPercent,
@@ -198,7 +177,6 @@ var DragAndDrop = function DragAndDrop(_ref) {
198
177
  }
199
178
  })));
200
179
  };
201
-
202
180
  var _default = DragAndDrop;
203
181
  exports["default"] = _default;
204
182
  //# sourceMappingURL=DragAndDrop.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragAndDrop.js","names":["DragAndDrop","draggedNodeContainer","minMouseDistPx","longPressMs","autoScrollDistPercent","autoScrollMaxSpeedPx","transitionDelayMs","onDragEnd","children","listStoreRef","useRef","ListStore","generatedId","useGeneratedId","nodeClassName","useMemo","useState","draggedNode","setDraggedNode","startNodeRef","x","y","cursorPosition","setCursorPosition","registerList","useCallback","list","current","add","deregisterList","id","remove","useTransitionStyle","className","ms","enabled","onDragStart","pos","startPos","startNode","node","nodeRef","rect","getBoundingClientRect","position","onDragMove","dragEndHandler","useDrag","onMouseDown","onTouchStart","mouseDownHandler","e","touchStartHandler","usePreventDefaultEvent","document","body","useDragEffect","useAutoScroll","distPercent","maxSpeedPx","initRect","useInitRect","undefined","dragAndDropContext","useMemoObject","renderDraggedNode","index","style","left","top","width","initWidth","height","initHeight","zIndex"],"sources":["../../src/DragAndDrop.tsx"],"sourcesContent":["import React, {\n useCallback,\n useMemo,\n useRef,\n useState,\n MouseEvent,\n TouchEvent,\n} from 'react';\nimport usePreventDefaultEvent from '@os-design/use-prevent-default-event';\nimport useMemoObject from '@os-design/use-memo-object';\nimport useDrag, {\n Position,\n OnDragEnd,\n OnDragMove,\n OnDragStart,\n} from '@os-design/use-drag';\nimport Portal, { PortalProps } from '@os-design/portal';\nimport useAutoScroll from '@os-design/use-auto-scroll';\nimport { DragAndDropContext } from './utils/useDragAndDrop';\nimport ListStore from './utils/ListStore';\nimport NodeList, { ExistingNode } from './utils/NodeList';\nimport useDragEffect, {\n DragEndHandler,\n DraggedNode,\n} from './utils/useDragEffect';\nimport useGeneratedId from './utils/useGeneratedId';\nimport useTransitionStyle from './utils/useTransitionStyle';\nimport useInitRect from './utils/useInitRect';\n\nexport interface DragAndDropProps {\n /**\n * The container in which the dragged node will be rendered.\n * @default document.body\n */\n draggedNodeContainer?: PortalProps['container'];\n /**\n * The min distance required to start dragging a node (in px).\n * @default 10\n */\n minMouseDistPx?: number;\n /**\n * The delay of the long press event required to start dragging a node on the touch device (in ms).\n * @default 500\n */\n longPressMs?: number;\n /**\n * The distance to the bound at which the list starts to scroll automatically (in percent).\n * @default 20\n */\n autoScrollDistPercent?: number;\n /**\n * The max auto scroll speed (in px).\n * @default 100\n */\n autoScrollMaxSpeedPx?: number;\n /**\n * The animation duration (in ms).\n * @default 250\n */\n transitionDelayMs?: number;\n /**\n * The callback that is called when the drag is completed.\n * @default undefined\n */\n onDragEnd?: DragEndHandler;\n /**\n * The children.\n * @default undefined\n */\n children?: React.ReactNode;\n}\n\ninterface StartNode {\n list: NodeList;\n node: ExistingNode;\n}\n\n/**\n * The container containing one or more lists with draggable nodes.\n */\nconst DragAndDrop: React.FC<DragAndDropProps> = ({\n draggedNodeContainer,\n minMouseDistPx = 10,\n longPressMs = 500,\n autoScrollDistPercent = 20,\n autoScrollMaxSpeedPx = 100,\n transitionDelayMs = 250,\n onDragEnd = () => {},\n children,\n}) => {\n // The user can drag a node between the lists (the Droppable components).\n // To determine which list a node should be dropped in, we need to store refs to all the lists.\n const listStoreRef = useRef<ListStore>(new ListStore());\n\n // The class name for a node used to set the transition style\n const generatedId = useGeneratedId();\n const nodeClassName = useMemo(() => `n${generatedId}`, [generatedId]);\n\n // The node that is currently being dragged\n const [draggedNode, setDraggedNode] = useState<DraggedNode | null>(null);\n const startNodeRef = useRef<StartNode | null>(null);\n const [cursorPosition, setCursorPosition] = useState<Position>({\n x: 0,\n y: 0,\n });\n\n // Add a new list to the store\n const registerList = useCallback((list: NodeList) => {\n listStoreRef.current.add(list);\n }, []);\n\n // Remove the existing list from the store\n const deregisterList = useCallback((id: string) => {\n listStoreRef.current.remove(id);\n }, []);\n\n // Set the style to delay transitions when the node is dragging\n useTransitionStyle({\n className: nodeClassName,\n ms: transitionDelayMs,\n enabled: !!draggedNode,\n });\n\n const onDragStart = useCallback<OnDragStart>(\n (pos: Position, startPos: Position) => {\n const startNode = startNodeRef.current;\n if (!startNode) return;\n const [, , nodeRef] = startNode.node;\n if (!nodeRef.current) return;\n const rect = nodeRef.current.getBoundingClientRect();\n setCursorPosition(pos);\n setDraggedNode({\n list: startNode.list,\n node: startNode.node,\n position: {\n x: startPos.x - rect.x,\n y: startPos.y - rect.y,\n },\n });\n startNodeRef.current = null;\n },\n []\n );\n\n const onDragMove = useCallback<OnDragMove>((pos: Position) => {\n setCursorPosition(pos);\n }, []);\n\n const dragEndHandler = useCallback<OnDragEnd>(() => {\n setDraggedNode(null);\n }, []);\n\n const { onMouseDown, onTouchStart } = useDrag({\n onDragStart,\n onDragMove,\n onDragEnd: dragEndHandler,\n minMouseDistPx,\n longPressMs,\n });\n\n // Handlers that determine whether a user clicks on the node\n const mouseDownHandler = useCallback(\n (e: MouseEvent, list: NodeList, node: ExistingNode) => {\n startNodeRef.current = { list, node };\n onMouseDown(e);\n },\n [onMouseDown]\n );\n const touchStartHandler = useCallback(\n (e: TouchEvent, list: NodeList, node: ExistingNode) => {\n startNodeRef.current = { list, node };\n onTouchStart(e);\n },\n [onTouchStart]\n );\n\n // Prevent body scrolling when the node is dragging.\n // It's important to attach the event to the body (not to the document). Otherwise, it won't work in mobile chrome.\n usePreventDefaultEvent(document.body, 'touchmove', !!draggedNode);\n\n // Implement the drag animation\n useDragEffect({\n draggedNode,\n cursorPosition,\n listStoreRef,\n onDragEnd,\n });\n\n // Auto scroll if the cursor position is located near the border\n useAutoScroll({\n enabled: !!draggedNode,\n distPercent: autoScrollDistPercent,\n maxSpeedPx: autoScrollMaxSpeedPx,\n });\n\n const initRect = useInitRect(draggedNode ? draggedNode.node[2] : undefined);\n\n const dragAndDropContext = useMemoObject({\n registerList,\n deregisterList,\n onMouseDown: mouseDownHandler,\n onTouchStart: touchStartHandler,\n nodeClassName,\n });\n\n return (\n <DragAndDropContext.Provider value={dragAndDropContext}>\n {children}\n\n {draggedNode && (\n <Portal container={draggedNodeContainer}>\n {draggedNode.list.renderDraggedNode({\n index: draggedNode.node[4],\n id: draggedNode.node[5],\n style: {\n position: 'fixed',\n left: cursorPosition.x - draggedNode.position.x,\n top: cursorPosition.y - draggedNode.position.y,\n width: initRect ? initRect.initWidth : undefined,\n height: initRect ? initRect.initHeight : undefined,\n zIndex: 1001,\n },\n })}\n </Portal>\n )}\n </DragAndDropContext.Provider>\n );\n};\n\nexport type { DragEndHandler } from './utils/useDragEffect';\n\nexport default DragAndDrop;\n"],"mappings":";;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAkDA;AACA;AACA;AACA,IAAMA,WAAuC,GAAG,SAA1CA,WAA0C,OAS1C;EAAA,IARJC,oBAQI,QARJA,oBAQI;EAAA,+BAPJC,cAOI;EAAA,IAPJA,cAOI,oCAPa,EAOb;EAAA,4BANJC,WAMI;EAAA,IANJA,WAMI,iCANU,GAMV;EAAA,iCALJC,qBAKI;EAAA,IALJA,qBAKI,sCALoB,EAKpB;EAAA,iCAJJC,oBAII;EAAA,IAJJA,oBAII,sCAJmB,GAInB;EAAA,iCAHJC,iBAGI;EAAA,IAHJA,iBAGI,sCAHgB,GAGhB;EAAA,0BAFJC,SAEI;EAAA,IAFJA,SAEI,+BAFQ,YAAM,CAAE,CAEhB;EAAA,IADJC,QACI,QADJA,QACI;EACJ;EACA;EACA,IAAMC,YAAY,GAAG,IAAAC,aAAA,EAAkB,IAAIC,qBAAJ,EAAlB,CAArB,CAHI,CAKJ;;EACA,IAAMC,WAAW,GAAG,IAAAC,0BAAA,GAApB;EACA,IAAMC,aAAa,GAAG,IAAAC,cAAA,EAAQ;IAAA,kBAAUH,WAAV;EAAA,CAAR,EAAiC,CAACA,WAAD,CAAjC,CAAtB,CAPI,CASJ;;EACA,gBAAsC,IAAAI,eAAA,EAA6B,I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AAc,CAACF,CAAf,GAAmBH,WAAW,CAAC2B,QAAZ,CAAqBxB,CAFzC;MAGLiD,GAAG,EAAE/C,cAAc,CAACD,CAAf,GAAmBJ,WAAW,CAAC2B,QAAZ,CAAqBvB,CAHxC;MAILiD,KAAK,EAAEV,QAAQ,GAAGA,QAAQ,CAACW,SAAZ,GAAwBT,SAJlC;MAKLU,MAAM,EAAEZ,QAAQ,GAAGA,QAAQ,CAACa,UAAZ,GAAyBX,SALpC;MAMLY,MAAM,EAAE;IANH;EAH2B,CAAnC,CADH,CAJJ,CADF;AAsBD,CAnJD;;eAuJe1E,W"}
1
+ {"version":3,"file":"DragAndDrop.js","names":["DragAndDrop","draggedNodeContainer","minMouseDistPx","longPressMs","autoScrollDistPercent","autoScrollMaxSpeedPx","transitionDelayMs","onDragEnd","children","listStoreRef","useRef","ListStore","generatedId","useGeneratedId","nodeClassName","useMemo","useState","draggedNode","setDraggedNode","startNodeRef","x","y","cursorPosition","setCursorPosition","registerList","useCallback","list","current","add","deregisterList","id","remove","useTransitionStyle","className","ms","enabled","onDragStart","pos","startPos","startNode","node","nodeRef","rect","getBoundingClientRect","position","onDragMove","dragEndHandler","useDrag","onMouseDown","onTouchStart","mouseDownHandler","e","touchStartHandler","usePreventDefaultEvent","document","body","useDragEffect","useAutoScroll","distPercent","maxSpeedPx","initRect","useInitRect","undefined","dragAndDropContext","useMemoObject","renderDraggedNode","index","style","left","top","width","initWidth","height","initHeight","zIndex"],"sources":["../../src/DragAndDrop.tsx"],"sourcesContent":["import React, {\n useCallback,\n useMemo,\n useRef,\n useState,\n MouseEvent,\n TouchEvent,\n} from 'react';\nimport usePreventDefaultEvent from '@os-design/use-prevent-default-event';\nimport useMemoObject from '@os-design/use-memo-object';\nimport useDrag, {\n Position,\n OnDragEnd,\n OnDragMove,\n OnDragStart,\n} from '@os-design/use-drag';\nimport Portal, { PortalProps } from '@os-design/portal';\nimport useAutoScroll from '@os-design/use-auto-scroll';\nimport { DragAndDropContext } from './utils/useDragAndDrop';\nimport ListStore from './utils/ListStore';\nimport NodeList, { ExistingNode } from './utils/NodeList';\nimport useDragEffect, {\n DragEndHandler,\n DraggedNode,\n} from './utils/useDragEffect';\nimport useGeneratedId from './utils/useGeneratedId';\nimport useTransitionStyle from './utils/useTransitionStyle';\nimport useInitRect from './utils/useInitRect';\n\nexport interface DragAndDropProps {\n /**\n * The container in which the dragged node will be rendered.\n * @default document.body\n */\n draggedNodeContainer?: PortalProps['container'];\n /**\n * The min distance required to start dragging a node (in px).\n * @default 10\n */\n minMouseDistPx?: number;\n /**\n * The delay of the long press event required to start dragging a node on the touch device (in ms).\n * @default 500\n */\n longPressMs?: number;\n /**\n * The distance to the bound at which the list starts to scroll automatically (in percent).\n * @default 20\n */\n autoScrollDistPercent?: number;\n /**\n * The max auto scroll speed (in px).\n * @default 100\n */\n autoScrollMaxSpeedPx?: number;\n /**\n * The animation duration (in ms).\n * @default 250\n */\n transitionDelayMs?: number;\n /**\n * The callback that is called when the drag is completed.\n * @default undefined\n */\n onDragEnd?: DragEndHandler;\n /**\n * The children.\n * @default undefined\n */\n children?: React.ReactNode;\n}\n\ninterface StartNode {\n list: NodeList;\n node: ExistingNode;\n}\n\n/**\n * The container containing one or more lists with draggable nodes.\n */\nconst DragAndDrop: React.FC<DragAndDropProps> = ({\n draggedNodeContainer,\n minMouseDistPx = 10,\n longPressMs = 500,\n autoScrollDistPercent = 20,\n autoScrollMaxSpeedPx = 100,\n transitionDelayMs = 250,\n onDragEnd = () => {},\n children,\n}) => {\n // The user can drag a node between the lists (the Droppable components).\n // To determine which list a node should be dropped in, we need to store refs to all the lists.\n const listStoreRef = useRef<ListStore>(new ListStore());\n\n // The class name for a node used to set the transition style\n const generatedId = useGeneratedId();\n const nodeClassName = useMemo(() => `n${generatedId}`, [generatedId]);\n\n // The node that is currently being dragged\n const [draggedNode, setDraggedNode] = useState<DraggedNode | null>(null);\n const startNodeRef = useRef<StartNode | null>(null);\n const [cursorPosition, setCursorPosition] = useState<Position>({\n x: 0,\n y: 0,\n });\n\n // Add a new list to the store\n const registerList = useCallback((list: NodeList) => {\n listStoreRef.current.add(list);\n }, []);\n\n // Remove the existing list from the store\n const deregisterList = useCallback((id: string) => {\n listStoreRef.current.remove(id);\n }, []);\n\n // Set the style to delay transitions when the node is dragging\n useTransitionStyle({\n className: nodeClassName,\n ms: transitionDelayMs,\n enabled: !!draggedNode,\n });\n\n const onDragStart = useCallback<OnDragStart>(\n (pos: Position, startPos: Position) => {\n const startNode = startNodeRef.current;\n if (!startNode) return;\n const [, , nodeRef] = startNode.node;\n if (!nodeRef.current) return;\n const rect = nodeRef.current.getBoundingClientRect();\n setCursorPosition(pos);\n setDraggedNode({\n list: startNode.list,\n node: startNode.node,\n position: {\n x: startPos.x - rect.x,\n y: startPos.y - rect.y,\n },\n });\n startNodeRef.current = null;\n },\n []\n );\n\n const onDragMove = useCallback<OnDragMove>((pos: Position) => {\n setCursorPosition(pos);\n }, []);\n\n const dragEndHandler = useCallback<OnDragEnd>(() => {\n setDraggedNode(null);\n }, []);\n\n const { onMouseDown, onTouchStart } = useDrag({\n onDragStart,\n onDragMove,\n onDragEnd: dragEndHandler,\n minMouseDistPx,\n longPressMs,\n });\n\n // Handlers that determine whether a user clicks on the node\n const mouseDownHandler = useCallback(\n (e: MouseEvent, list: NodeList, node: ExistingNode) => {\n startNodeRef.current = { list, node };\n onMouseDown(e);\n },\n [onMouseDown]\n );\n const touchStartHandler = useCallback(\n (e: TouchEvent, list: NodeList, node: ExistingNode) => {\n startNodeRef.current = { list, node };\n onTouchStart(e);\n },\n [onTouchStart]\n );\n\n // Prevent body scrolling when the node is dragging.\n // It's important to attach the event to the body (not to the document). Otherwise, it won't work in mobile chrome.\n usePreventDefaultEvent(document.body, 'touchmove', !!draggedNode);\n\n // Implement the drag animation\n useDragEffect({\n draggedNode,\n cursorPosition,\n listStoreRef,\n onDragEnd,\n });\n\n // Auto scroll if the cursor position is located near the border\n useAutoScroll({\n enabled: !!draggedNode,\n distPercent: autoScrollDistPercent,\n maxSpeedPx: autoScrollMaxSpeedPx,\n });\n\n const initRect = useInitRect(draggedNode ? draggedNode.node[2] : undefined);\n\n const dragAndDropContext = useMemoObject({\n registerList,\n deregisterList,\n onMouseDown: mouseDownHandler,\n onTouchStart: touchStartHandler,\n nodeClassName,\n });\n\n return (\n <DragAndDropContext.Provider value={dragAndDropContext}>\n {children}\n\n {draggedNode && (\n <Portal container={draggedNodeContainer}>\n {draggedNode.list.renderDraggedNode({\n index: draggedNode.node[4],\n id: draggedNode.node[5],\n style: {\n position: 'fixed',\n left: cursorPosition.x - draggedNode.position.x,\n top: cursorPosition.y - draggedNode.position.y,\n width: initRect ? initRect.initWidth : undefined,\n height: initRect ? initRect.initHeight : undefined,\n zIndex: 1001,\n },\n })}\n </Portal>\n )}\n </DragAndDropContext.Provider>\n );\n};\n\nexport type { DragEndHandler } from './utils/useDragEffect';\n\nexport default DragAndDrop;\n"],"mappings":";;;;;;;AAAA;AAQA;AACA;AACA;AAMA;AACA;AACA;AACA;AAEA;AAIA;AACA;AACA;AAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkD9C;AACA;AACA;AACA,IAAMA,WAAuC,GAAG,SAA1CA,WAAuC,OASvC;EAAA,IARJC,oBAAoB,QAApBA,oBAAoB;IAAA,2BACpBC,cAAc;IAAdA,cAAc,oCAAG,EAAE;IAAA,wBACnBC,WAAW;IAAXA,WAAW,iCAAG,GAAG;IAAA,6BACjBC,qBAAqB;IAArBA,qBAAqB,sCAAG,EAAE;IAAA,6BAC1BC,oBAAoB;IAApBA,oBAAoB,sCAAG,GAAG;IAAA,6BAC1BC,iBAAiB;IAAjBA,iBAAiB,sCAAG,GAAG;IAAA,sBACvBC,SAAS;IAATA,SAAS,+BAAG,YAAM,CAAC,CAAC;IACpBC,QAAQ,QAARA,QAAQ;EAER;EACA;EACA,IAAMC,YAAY,GAAG,IAAAC,aAAM,EAAY,IAAIC,qBAAS,EAAE,CAAC;;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C,GAAGH,WAAW,CAAC2B,QAAQ,CAACxB,CAAC;MAC/CiD,GAAG,EAAE/C,cAAc,CAACD,CAAC,GAAGJ,WAAW,CAAC2B,QAAQ,CAACvB,CAAC;MAC9CiD,KAAK,EAAEV,QAAQ,GAAGA,QAAQ,CAACW,SAAS,GAAGT,SAAS;MAChDU,MAAM,EAAEZ,QAAQ,GAAGA,QAAQ,CAACa,UAAU,GAAGX,SAAS;MAClDY,MAAM,EAAE;IACV;EACF,CAAC,CAAC,CAEL,CAC2B;AAElC,CAAC;AAAC,eAIa1E,WAAW;AAAA"}
@@ -1,64 +1,46 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _useMemoObject = _interopRequireDefault(require("@os-design/use-memo-object"));
13
-
14
10
  var _useDroppable2 = _interopRequireDefault(require("./utils/useDroppable"));
15
-
16
11
  var _useDragAndDrop2 = _interopRequireDefault(require("./utils/useDragAndDrop"));
17
-
18
12
  var _useAppendClassName = _interopRequireDefault(require("./utils/useAppendClassName"));
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
-
22
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
-
28
17
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
29
-
30
18
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
31
-
32
19
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
33
-
34
20
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
35
-
36
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
-
38
22
  var Draggable = function Draggable(_ref) {
39
23
  var index = _ref.index,
40
- id = _ref.id,
41
- children = _ref.children;
24
+ id = _ref.id,
25
+ children = _ref.children;
42
26
  // The reference to the list item
43
- var ref = (0, _react.useRef)(null); // The reference to the node containing the refs to the prev and next nodes
44
-
45
- var nodeRef = (0, _react.useRef)(null); // Additional styles for moving the list item
46
-
27
+ var ref = (0, _react.useRef)(null);
28
+ // The reference to the node containing the refs to the prev and next nodes
29
+ var nodeRef = (0, _react.useRef)(null);
30
+ // Additional styles for moving the list item
47
31
  var _useState = (0, _react.useState)({}),
48
- _useState2 = _slicedToArray(_useState, 2),
49
- style = _useState2[0],
50
- setStyle = _useState2[1];
51
-
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ style = _useState2[0],
34
+ setStyle = _useState2[1];
52
35
  var _useDragAndDrop = (0, _useDragAndDrop2["default"])(),
53
- nodeClassName = _useDragAndDrop.nodeClassName;
54
-
36
+ nodeClassName = _useDragAndDrop.nodeClassName;
55
37
  var _useDroppable = (0, _useDroppable2["default"])(),
56
- registerNode = _useDroppable.registerNode,
57
- deregisterNode = _useDroppable.deregisterNode,
58
- onMouseDown = _useDroppable.onMouseDown,
59
- onTouchStart = _useDroppable.onTouchStart; // Register the node in the list
60
-
38
+ registerNode = _useDroppable.registerNode,
39
+ deregisterNode = _useDroppable.deregisterNode,
40
+ onMouseDown = _useDroppable.onMouseDown,
41
+ onTouchStart = _useDroppable.onTouchStart;
61
42
 
43
+ // Register the node in the list
62
44
  (0, _react.useEffect)(function () {
63
45
  nodeRef.current = registerNode({
64
46
  ref: ref,
@@ -71,10 +53,12 @@ var Draggable = function Draggable(_ref) {
71
53
  deregisterNode(nodeRef.current);
72
54
  nodeRef.current = null;
73
55
  };
74
- }, [deregisterNode, id, index, registerNode]); // Set the class name for the node to apply the transition style (see the DragAndDrop container)
56
+ }, [deregisterNode, id, index, registerNode]);
75
57
 
76
- (0, _useAppendClassName["default"])(ref, nodeClassName); // Handlers that determine whether a user clicks on the node
58
+ // Set the class name for the node to apply the transition style (see the DragAndDrop container)
59
+ (0, _useAppendClassName["default"])(ref, nodeClassName);
77
60
 
61
+ // Handlers that determine whether a user clicks on the node
78
62
  var mouseDownHandler = (0, _react.useCallback)(function (e) {
79
63
  if (!nodeRef.current) return;
80
64
  onMouseDown(e, nodeRef.current);
@@ -93,7 +77,6 @@ var Draggable = function Draggable(_ref) {
93
77
  handlers: handlers
94
78
  }));
95
79
  };
96
-
97
80
  var _default = Draggable;
98
81
  exports["default"] = _default;
99
82
  //# sourceMappingURL=Draggable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Draggable.js","names":["Draggable","index","id","children","ref","useRef","nodeRef","useState","style","setStyle","useDragAndDrop","nodeClassName","useDroppable","registerNode","deregisterNode","onMouseDown","onTouchStart","useEffect","current","useAppendClassName","mouseDownHandler","useCallback","e","touchStartHandler","handlers","useMemoObject"],"sources":["../../src/Draggable.tsx"],"sourcesContent":["import React, {\n CSSProperties,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState,\n MouseEvent,\n TouchEvent,\n} from 'react';\nimport useMemoObject from '@os-design/use-memo-object';\nimport { Node } from './utils/NodeList';\nimport useDroppable from './utils/useDroppable';\nimport useDragAndDrop from './utils/useDragAndDrop';\nimport useAppendClassName from './utils/useAppendClassName';\n\nexport interface DraggableHandlers {\n /**\n * The handler that should be called when the mouse down event occurs.\n */\n onMouseDown: (e: MouseEvent) => void;\n /**\n * The handler that should be called when the touch start event occurs.\n */\n onTouchStart: (e: TouchEvent) => void;\n}\n\nexport interface DraggableChildrenProps {\n /**\n * The reference to the draggable list item.\n */\n ref: RefObject<any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n /**\n * Additional styles for moving the list item.\n */\n style: CSSProperties;\n /**\n * The handlers to catch events when the user starts dragging the list item.\n */\n handlers: DraggableHandlers;\n}\n\nexport interface DraggableProps {\n /**\n * The index of the draggable node.\n */\n index: number;\n /**\n * The ID of the draggable node.\n */\n id: string;\n /**\n * The function that renders the draggable node.\n */\n children: (props: DraggableChildrenProps) => React.ReactNode;\n}\n\nconst Draggable: React.FC<DraggableProps> = ({ index, id, children }) => {\n // The reference to the list item\n const ref = useRef<HTMLDivElement | null>(null);\n // The reference to the node containing the refs to the prev and next nodes\n const nodeRef = useRef<Node>(null);\n // Additional styles for moving the list item\n const [style, setStyle] = useState<CSSProperties>({});\n\n const { nodeClassName } = useDragAndDrop();\n const { registerNode, deregisterNode, onMouseDown, onTouchStart } =\n useDroppable();\n\n // Register the node in the list\n useEffect(() => {\n nodeRef.current = registerNode({ ref, setStyle, index, id });\n return () => {\n if (!nodeRef.current) return;\n deregisterNode(nodeRef.current);\n nodeRef.current = null;\n };\n }, [deregisterNode, id, index, registerNode]);\n\n // Set the class name for the node to apply the transition style (see the DragAndDrop container)\n useAppendClassName(ref, nodeClassName);\n\n // Handlers that determine whether a user clicks on the node\n const mouseDownHandler = useCallback(\n (e: MouseEvent) => {\n if (!nodeRef.current) return;\n onMouseDown(e, nodeRef.current);\n },\n [onMouseDown]\n );\n const touchStartHandler = useCallback(\n (e: TouchEvent) => {\n if (!nodeRef.current) return;\n onTouchStart(e, nodeRef.current);\n },\n [onTouchStart]\n );\n\n const handlers = useMemoObject({\n onMouseDown: mouseDownHandler,\n onTouchStart: touchStartHandler,\n });\n\n return <>{children({ ref, style, handlers })}</>;\n};\n\nexport default Draggable;\n"],"mappings":";;;;;;;;;AAAA;;AAUA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AA2CA,IAAMA,SAAmC,GAAG,SAAtCA,SAAsC,OAA6B;EAAA,IAA1BC,KAA0B,QAA1BA,KAA0B;EAAA,IAAnBC,EAAmB,QAAnBA,EAAmB;EAAA,IAAfC,QAAe,QAAfA,QAAe;EACvE;EACA,IAAMC,GAAG,GAAG,IAAAC,aAAA,EAA8B,IAA9B,CAAZ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B,UAACC,CAAD,EAAmB;IACjB,IAAI,CAAChB,OAAO,CAACY,OAAb,EAAsB;IACtBF,YAAY,CAACM,CAAD,EAAIhB,OAAO,CAACY,OAAZ,CAAZ;EACD,CAJuB,EAKxB,CAACF,YAAD,CALwB,CAA1B;EAQA,IAAMQ,QAAQ,GAAG,IAAAC,yBAAA,EAAc;IAC7BV,WAAW,EAAEK,gBADgB;IAE7BJ,YAAY,EAAEO;EAFe,CAAd,CAAjB;EAKA,oBAAO,kEAAGpB,QAAQ,CAAC;IAAEC,GAAG,EAAHA,GAAF;IAAOI,KAAK,EAALA,KAAP;IAAcgB,QAAQ,EAARA;EAAd,CAAD,CAAX,CAAP;AACD,CA/CD;;eAiDexB,S"}
1
+ {"version":3,"file":"Draggable.js","names":["Draggable","index","id","children","ref","useRef","nodeRef","useState","style","setStyle","useDragAndDrop","nodeClassName","useDroppable","registerNode","deregisterNode","onMouseDown","onTouchStart","useEffect","current","useAppendClassName","mouseDownHandler","useCallback","e","touchStartHandler","handlers","useMemoObject"],"sources":["../../src/Draggable.tsx"],"sourcesContent":["import React, {\n CSSProperties,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState,\n MouseEvent,\n TouchEvent,\n} from 'react';\nimport useMemoObject from '@os-design/use-memo-object';\nimport { Node } from './utils/NodeList';\nimport useDroppable from './utils/useDroppable';\nimport useDragAndDrop from './utils/useDragAndDrop';\nimport useAppendClassName from './utils/useAppendClassName';\n\nexport interface DraggableHandlers {\n /**\n * The handler that should be called when the mouse down event occurs.\n */\n onMouseDown: (e: MouseEvent) => void;\n /**\n * The handler that should be called when the touch start event occurs.\n */\n onTouchStart: (e: TouchEvent) => void;\n}\n\nexport interface DraggableChildrenProps {\n /**\n * The reference to the draggable list item.\n */\n ref: RefObject<any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n /**\n * Additional styles for moving the list item.\n */\n style: CSSProperties;\n /**\n * The handlers to catch events when the user starts dragging the list item.\n */\n handlers: DraggableHandlers;\n}\n\nexport interface DraggableProps {\n /**\n * The index of the draggable node.\n */\n index: number;\n /**\n * The ID of the draggable node.\n */\n id: string;\n /**\n * The function that renders the draggable node.\n */\n children: (props: DraggableChildrenProps) => React.ReactNode;\n}\n\nconst Draggable: React.FC<DraggableProps> = ({ index, id, children }) => {\n // The reference to the list item\n const ref = useRef<HTMLDivElement | null>(null);\n // The reference to the node containing the refs to the prev and next nodes\n const nodeRef = useRef<Node>(null);\n // Additional styles for moving the list item\n const [style, setStyle] = useState<CSSProperties>({});\n\n const { nodeClassName } = useDragAndDrop();\n const { registerNode, deregisterNode, onMouseDown, onTouchStart } =\n useDroppable();\n\n // Register the node in the list\n useEffect(() => {\n nodeRef.current = registerNode({ ref, setStyle, index, id });\n return () => {\n if (!nodeRef.current) return;\n deregisterNode(nodeRef.current);\n nodeRef.current = null;\n };\n }, [deregisterNode, id, index, registerNode]);\n\n // Set the class name for the node to apply the transition style (see the DragAndDrop container)\n useAppendClassName(ref, nodeClassName);\n\n // Handlers that determine whether a user clicks on the node\n const mouseDownHandler = useCallback(\n (e: MouseEvent) => {\n if (!nodeRef.current) return;\n onMouseDown(e, nodeRef.current);\n },\n [onMouseDown]\n );\n const touchStartHandler = useCallback(\n (e: TouchEvent) => {\n if (!nodeRef.current) return;\n onTouchStart(e, nodeRef.current);\n },\n [onTouchStart]\n );\n\n const handlers = useMemoObject({\n onMouseDown: mouseDownHandler,\n onTouchStart: touchStartHandler,\n });\n\n return <>{children({ ref, style, handlers })}</>;\n};\n\nexport default Draggable;\n"],"mappings":";;;;;;;AAAA;AAUA;AAEA;AACA;AACA;AAA4D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2C5D,IAAMA,SAAmC,GAAG,SAAtCA,SAAmC,OAAgC;EAAA,IAA1BC,KAAK,QAALA,KAAK;IAAEC,EAAE,QAAFA,EAAE;IAAEC,QAAQ,QAARA,QAAQ;EAChE;EACA,IAAMC,GAAG,GAAG,IAAAC,aAAM,EAAwB,IAAI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AACY,OAAO,CAAC;EAClC,CAAC,EACD,CAACF,YAAY,CAAC,CACf;EAED,IAAMQ,QAAQ,GAAG,IAAAC,yBAAa,EAAC;IAC7BV,WAAW,EAAEK,gBAAgB;IAC7BJ,YAAY,EAAEO;EAChB,CAAC,CAAC;EAEF,oBAAO,kEAAGpB,QAAQ,CAAC;IAAEC,GAAG,EAAHA,GAAG;IAAEI,KAAK,EAALA,KAAK;IAAEgB,QAAQ,EAARA;EAAS,CAAC,CAAC,CAAI;AAClD,CAAC;AAAC,eAEaxB,SAAS;AAAA"}
@@ -1,74 +1,65 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _useMemoObject = _interopRequireDefault(require("@os-design/use-memo-object"));
13
-
14
10
  var _NodeList = _interopRequireDefault(require("./utils/NodeList"));
15
-
16
11
  var _useDragAndDrop2 = _interopRequireDefault(require("./utils/useDragAndDrop"));
17
-
18
12
  var _useDroppable = require("./utils/useDroppable");
19
-
20
13
  var _useGeneratedId = _interopRequireDefault(require("./utils/useGeneratedId"));
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
-
24
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
-
26
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
-
28
17
  var Droppable = function Droppable(_ref) {
29
18
  var renderDraggedNode = _ref.renderDraggedNode,
30
- id = _ref.id,
31
- _ref$horizontal = _ref.horizontal,
32
- horizontal = _ref$horizontal === void 0 ? false : _ref$horizontal,
33
- children = _ref.children;
19
+ id = _ref.id,
20
+ _ref$horizontal = _ref.horizontal,
21
+ horizontal = _ref$horizontal === void 0 ? false : _ref$horizontal,
22
+ children = _ref.children;
34
23
  // The reference to the list
35
- var ref = (0, _react.useRef)(null); // The reference to the container inside the virtual list
36
-
37
- var innerRef = (0, _react.useRef)(null); // The unique ID of the list. If no ID was specified, the generated one is used.
38
-
24
+ var ref = (0, _react.useRef)(null);
25
+ // The reference to the container inside the virtual list
26
+ var innerRef = (0, _react.useRef)(null);
27
+ // The unique ID of the list. If no ID was specified, the generated one is used.
39
28
  var generatedId = (0, _useGeneratedId["default"])();
40
29
  var droppableId = (0, _react.useMemo)(function () {
41
30
  return id || generatedId;
42
- }, [generatedId, id]); // The reference to the list of nodes
43
-
31
+ }, [generatedId, id]);
32
+ // The reference to the list of nodes
44
33
  var listRef = (0, _react.useRef)(new _NodeList["default"]({
45
34
  id: droppableId,
46
35
  ref: ref,
47
36
  innerRef: innerRef,
48
37
  horizontal: horizontal,
49
38
  renderDraggedNode: renderDraggedNode
50
- })); // Update the ID of the list if it changes
39
+ }));
51
40
 
41
+ // Update the ID of the list if it changes
52
42
  (0, _react.useEffect)(function () {
53
43
  listRef.current.id = droppableId;
54
- }, [droppableId]); // Update the list orientation if it changes.
55
- // There is no need to check the order of the nodes in the list because it will be the same.
44
+ }, [droppableId]);
56
45
 
46
+ // Update the list orientation if it changes.
47
+ // There is no need to check the order of the nodes in the list because it will be the same.
57
48
  (0, _react.useEffect)(function () {
58
49
  listRef.current.horizontal = horizontal;
59
- }, [horizontal]); // Update the callback that renders the dragged node if it changes
50
+ }, [horizontal]);
60
51
 
52
+ // Update the callback that renders the dragged node if it changes
61
53
  (0, _react.useEffect)(function () {
62
54
  listRef.current.renderDraggedNode = renderDraggedNode;
63
55
  }, [renderDraggedNode]);
64
-
65
56
  var _useDragAndDrop = (0, _useDragAndDrop2["default"])(),
66
- registerList = _useDragAndDrop.registerList,
67
- deregisterList = _useDragAndDrop.deregisterList,
68
- onMouseDown = _useDragAndDrop.onMouseDown,
69
- onTouchStart = _useDragAndDrop.onTouchStart; // Register the list in the store
70
-
57
+ registerList = _useDragAndDrop.registerList,
58
+ deregisterList = _useDragAndDrop.deregisterList,
59
+ onMouseDown = _useDragAndDrop.onMouseDown,
60
+ onTouchStart = _useDragAndDrop.onTouchStart;
71
61
 
62
+ // Register the list in the store
72
63
  (0, _react.useEffect)(function () {
73
64
  registerList(listRef.current);
74
65
  var listId = listRef.current.id;
@@ -81,8 +72,9 @@ var Droppable = function Droppable(_ref) {
81
72
  }, []);
82
73
  var deregisterNode = (0, _react.useCallback)(function (node) {
83
74
  listRef.current.remove(node);
84
- }, []); // Handlers that determine whether a user clicks on the node
75
+ }, []);
85
76
 
77
+ // Handlers that determine whether a user clicks on the node
86
78
  var mouseDownHandler = (0, _react.useCallback)(function (e, node) {
87
79
  onMouseDown(e, listRef.current, node);
88
80
  }, [onMouseDown]);
@@ -102,7 +94,6 @@ var Droppable = function Droppable(_ref) {
102
94
  innerRef: innerRef
103
95
  }));
104
96
  };
105
-
106
97
  var _default = Droppable;
107
98
  exports["default"] = _default;
108
99
  //# sourceMappingURL=Droppable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Droppable.js","names":["Droppable","renderDraggedNode","id","horizontal","children","ref","useRef","innerRef","generatedId","useGeneratedId","droppableId","useMemo","listRef","NodeList","useEffect","current","useDragAndDrop","registerList","deregisterList","onMouseDown","onTouchStart","listId","registerNode","useCallback","props","add","deregisterNode","node","remove","mouseDownHandler","e","touchStartHandler","droppableContext","useMemoObject"],"sources":["../../src/Droppable.tsx"],"sourcesContent":["import React, {\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n MouseEvent,\n TouchEvent,\n} from 'react';\nimport useMemoObject from '@os-design/use-memo-object';\nimport NodeList, {\n ExistingNode,\n NodeProps,\n RenderDraggedNode,\n} from './utils/NodeList';\nimport useDragAndDrop from './utils/useDragAndDrop';\nimport { DroppableContext } from './utils/useDroppable';\nimport useGeneratedId from './utils/useGeneratedId';\n\nexport interface DroppableChildrenProps {\n /**\n * The reference to the list.\n * If a virtual list is used, pass it to the outerRef prop.\n */\n ref: RefObject<HTMLDivElement>;\n /**\n * The reference to the container inside the virtual list.\n * Pass it to the innerRef prop.\n */\n innerRef: RefObject<HTMLDivElement>;\n}\n\nexport interface DroppableProps {\n /**\n * The function that renders the dragged node.\n */\n renderDraggedNode: RenderDraggedNode;\n /**\n * The ID of the list with draggable nodes.\n * Used to determine in which list the dragged node was dropped.\n * @default undefined\n */\n id?: string;\n /**\n * Whether the list is horizontal.\n * @default false\n */\n horizontal?: boolean;\n /**\n * The function that renders the list with draggable nodes.\n */\n children: (props: DroppableChildrenProps) => React.ReactNode;\n}\n\nconst Droppable: React.FC<DroppableProps> = ({\n renderDraggedNode,\n id,\n horizontal = false,\n children,\n}) => {\n // The reference to the list\n const ref = useRef<HTMLDivElement>(null);\n // The reference to the container inside the virtual list\n const innerRef = useRef<HTMLDivElement>(null);\n // The unique ID of the list. If no ID was specified, the generated one is used.\n const generatedId = useGeneratedId();\n const droppableId = useMemo(() => id || generatedId, [generatedId, id]);\n // The reference to the list of nodes\n const listRef = useRef(\n new NodeList({\n id: droppableId,\n ref,\n innerRef,\n horizontal,\n renderDraggedNode,\n })\n );\n\n // Update the ID of the list if it changes\n useEffect(() => {\n listRef.current.id = droppableId;\n }, [droppableId]);\n\n // Update the list orientation if it changes.\n // There is no need to check the order of the nodes in the list because it will be the same.\n useEffect(() => {\n listRef.current.horizontal = horizontal;\n }, [horizontal]);\n\n // Update the callback that renders the dragged node if it changes\n useEffect(() => {\n listRef.current.renderDraggedNode = renderDraggedNode;\n }, [renderDraggedNode]);\n\n const { registerList, deregisterList, onMouseDown, onTouchStart } =\n useDragAndDrop();\n\n // Register the list in the store\n useEffect(() => {\n registerList(listRef.current);\n const listId = listRef.current.id;\n return () => deregisterList(listId);\n }, [deregisterList, registerList]);\n\n const registerNode = useCallback(\n (props: NodeProps) => listRef.current.add(props),\n []\n );\n const deregisterNode = useCallback((node: ExistingNode) => {\n listRef.current.remove(node);\n }, []);\n\n // Handlers that determine whether a user clicks on the node\n const mouseDownHandler = useCallback(\n (e: MouseEvent, node: ExistingNode) => {\n onMouseDown(e, listRef.current, node);\n },\n [onMouseDown]\n );\n const touchStartHandler = useCallback(\n (e: TouchEvent, node: ExistingNode) => {\n onTouchStart(e, listRef.current, node);\n },\n [onTouchStart]\n );\n\n const droppableContext = useMemoObject({\n registerNode,\n deregisterNode,\n onMouseDown: mouseDownHandler,\n onTouchStart: touchStartHandler,\n });\n\n return (\n <DroppableContext.Provider value={droppableContext}>\n {(children as Function)({ ref, innerRef })}\n </DroppableContext.Provider>\n );\n};\n\nexport default Droppable;\n"],"mappings":";;;;;;;;;AAAA;;AASA;;AACA;;AAKA;;AACA;;AACA;;;;;;;;AAqCA,IAAMA,SAAmC,GAAG,SAAtCA,SAAsC,OAKtC;EAAA,IAJJC,iBAII,QAJJA,iBAII;EAAA,IAHJC,EAGI,QAHJA,EAGI;EAAA,2BAFJC,UAEI;EAAA,IAFJA,UAE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AAuB;IAAEC,GAAG,EAAHA,GAAF;IAAOE,QAAQ,EAARA;EAAP,CAAvB,CADH,CADF;AAKD,CApFD;;eAsFeP,S"}
1
+ {"version":3,"file":"Droppable.js","names":["Droppable","renderDraggedNode","id","horizontal","children","ref","useRef","innerRef","generatedId","useGeneratedId","droppableId","useMemo","listRef","NodeList","useEffect","current","useDragAndDrop","registerList","deregisterList","onMouseDown","onTouchStart","listId","registerNode","useCallback","props","add","deregisterNode","node","remove","mouseDownHandler","e","touchStartHandler","droppableContext","useMemoObject"],"sources":["../../src/Droppable.tsx"],"sourcesContent":["import React, {\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n MouseEvent,\n TouchEvent,\n} from 'react';\nimport useMemoObject from '@os-design/use-memo-object';\nimport NodeList, {\n ExistingNode,\n NodeProps,\n RenderDraggedNode,\n} from './utils/NodeList';\nimport useDragAndDrop from './utils/useDragAndDrop';\nimport { DroppableContext } from './utils/useDroppable';\nimport useGeneratedId from './utils/useGeneratedId';\n\nexport interface DroppableChildrenProps {\n /**\n * The reference to the list.\n * If a virtual list is used, pass it to the outerRef prop.\n */\n ref: RefObject<HTMLDivElement>;\n /**\n * The reference to the container inside the virtual list.\n * Pass it to the innerRef prop.\n */\n innerRef: RefObject<HTMLDivElement>;\n}\n\nexport interface DroppableProps {\n /**\n * The function that renders the dragged node.\n */\n renderDraggedNode: RenderDraggedNode;\n /**\n * The ID of the list with draggable nodes.\n * Used to determine in which list the dragged node was dropped.\n * @default undefined\n */\n id?: string;\n /**\n * Whether the list is horizontal.\n * @default false\n */\n horizontal?: boolean;\n /**\n * The function that renders the list with draggable nodes.\n */\n children: (props: DroppableChildrenProps) => React.ReactNode;\n}\n\nconst Droppable: React.FC<DroppableProps> = ({\n renderDraggedNode,\n id,\n horizontal = false,\n children,\n}) => {\n // The reference to the list\n const ref = useRef<HTMLDivElement>(null);\n // The reference to the container inside the virtual list\n const innerRef = useRef<HTMLDivElement>(null);\n // The unique ID of the list. If no ID was specified, the generated one is used.\n const generatedId = useGeneratedId();\n const droppableId = useMemo(() => id || generatedId, [generatedId, id]);\n // The reference to the list of nodes\n const listRef = useRef(\n new NodeList({\n id: droppableId,\n ref,\n innerRef,\n horizontal,\n renderDraggedNode,\n })\n );\n\n // Update the ID of the list if it changes\n useEffect(() => {\n listRef.current.id = droppableId;\n }, [droppableId]);\n\n // Update the list orientation if it changes.\n // There is no need to check the order of the nodes in the list because it will be the same.\n useEffect(() => {\n listRef.current.horizontal = horizontal;\n }, [horizontal]);\n\n // Update the callback that renders the dragged node if it changes\n useEffect(() => {\n listRef.current.renderDraggedNode = renderDraggedNode;\n }, [renderDraggedNode]);\n\n const { registerList, deregisterList, onMouseDown, onTouchStart } =\n useDragAndDrop();\n\n // Register the list in the store\n useEffect(() => {\n registerList(listRef.current);\n const listId = listRef.current.id;\n return () => deregisterList(listId);\n }, [deregisterList, registerList]);\n\n const registerNode = useCallback(\n (props: NodeProps) => listRef.current.add(props),\n []\n );\n const deregisterNode = useCallback((node: ExistingNode) => {\n listRef.current.remove(node);\n }, []);\n\n // Handlers that determine whether a user clicks on the node\n const mouseDownHandler = useCallback(\n (e: MouseEvent, node: ExistingNode) => {\n onMouseDown(e, listRef.current, node);\n },\n [onMouseDown]\n );\n const touchStartHandler = useCallback(\n (e: TouchEvent, node: ExistingNode) => {\n onTouchStart(e, listRef.current, node);\n },\n [onTouchStart]\n );\n\n const droppableContext = useMemoObject({\n registerNode,\n deregisterNode,\n onMouseDown: mouseDownHandler,\n onTouchStart: touchStartHandler,\n });\n\n return (\n <DroppableContext.Provider value={droppableContext}>\n {(children as Function)({ ref, innerRef })}\n </DroppableContext.Provider>\n );\n};\n\nexport default Droppable;\n"],"mappings":";;;;;;;AAAA;AASA;AACA;AAKA;AACA;AACA;AAAoD;AAAA;AAAA;AAqCpD,IAAMA,SAAmC,GAAG,SAAtCA,SAAmC,OAKnC;EAAA,IAJJC,iBAAiB,QAAjBA,iBAAiB;IACjBC,EAAE,QAAFA,EA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ED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -28,9 +27,7 @@ Object.defineProperty(exports, "Droppable", {
28
27
  return _Droppable["default"];
29
28
  }
30
29
  });
31
-
32
30
  var _DragAndDrop = _interopRequireWildcard(require("./DragAndDrop"));
33
-
34
31
  Object.keys(_DragAndDrop).forEach(function (key) {
35
32
  if (key === "default" || key === "__esModule") return;
36
33
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -42,9 +39,7 @@ Object.keys(_DragAndDrop).forEach(function (key) {
42
39
  }
43
40
  });
44
41
  });
45
-
46
42
  var _Droppable = _interopRequireWildcard(require("./Droppable"));
47
-
48
43
  Object.keys(_Droppable).forEach(function (key) {
49
44
  if (key === "default" || key === "__esModule") return;
50
45
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -56,9 +51,7 @@ Object.keys(_Droppable).forEach(function (key) {
56
51
  }
57
52
  });
58
53
  });
59
-
60
54
  var _Draggable = _interopRequireWildcard(require("./Draggable"));
61
-
62
55
  Object.keys(_Draggable).forEach(function (key) {
63
56
  if (key === "default" || key === "__esModule") return;
64
57
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -70,8 +63,6 @@ Object.keys(_Draggable).forEach(function (key) {
70
63
  }
71
64
  });
72
65
  });
73
-
74
66
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
75
-
76
67
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
77
68
  //# sourceMappingURL=index.js.map