@elliemae/ds-drag-and-drop 2.2.0-alpha.1 → 2.2.0-alpha.2

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 (77) hide show
  1. package/cjs/hierarchy/customCollisionDetection.js +44 -50
  2. package/cjs/hierarchy/customCollisionDetection.js.map +7 -0
  3. package/cjs/hierarchy/getHierarchyKeyboardCoordinates.js +78 -91
  4. package/cjs/hierarchy/getHierarchyKeyboardCoordinates.js.map +7 -0
  5. package/cjs/hierarchy/index.js +28 -9
  6. package/cjs/hierarchy/index.js.map +7 -0
  7. package/cjs/hierarchy/types.js +27 -2
  8. package/cjs/hierarchy/types.js.map +7 -0
  9. package/cjs/hierarchy/useHierarchyActionHandlers.js +53 -35
  10. package/cjs/hierarchy/useHierarchyActionHandlers.js.map +7 -0
  11. package/cjs/hierarchy/useHierarchyAnnouncements.js +45 -26
  12. package/cjs/hierarchy/useHierarchyAnnouncements.js.map +7 -0
  13. package/cjs/hierarchy/useHierarchyDndkitConfig.js +77 -83
  14. package/cjs/hierarchy/useHierarchyDndkitConfig.js.map +7 -0
  15. package/cjs/hierarchy/useHierarchyPreviewHandlers.js +48 -27
  16. package/cjs/hierarchy/useHierarchyPreviewHandlers.js.map +7 -0
  17. package/cjs/index.js +29 -11
  18. package/cjs/index.js.map +7 -0
  19. package/cjs/tree/constants.js +41 -12
  20. package/cjs/tree/constants.js.map +7 -0
  21. package/cjs/tree/customCollisionDetection.js +64 -95
  22. package/cjs/tree/customCollisionDetection.js.map +7 -0
  23. package/cjs/tree/getTreeKeyboardCoordinates.js +87 -101
  24. package/cjs/tree/getTreeKeyboardCoordinates.js.map +7 -0
  25. package/cjs/tree/index.js +28 -9
  26. package/cjs/tree/index.js.map +7 -0
  27. package/cjs/tree/types.js +27 -2
  28. package/cjs/tree/types.js.map +7 -0
  29. package/cjs/tree/useTreeActionHandlers.js +66 -56
  30. package/cjs/tree/useTreeActionHandlers.js.map +7 -0
  31. package/cjs/tree/useTreeAnnouncements.js +53 -40
  32. package/cjs/tree/useTreeAnnouncements.js.map +7 -0
  33. package/cjs/tree/useTreeDndkitConfig.js +95 -91
  34. package/cjs/tree/useTreeDndkitConfig.js.map +7 -0
  35. package/cjs/tree/useTreePreviewHandlers.js +53 -37
  36. package/cjs/tree/useTreePreviewHandlers.js.map +7 -0
  37. package/cjs/tree/utilities.js +44 -30
  38. package/cjs/tree/utilities.js.map +7 -0
  39. package/esm/hierarchy/customCollisionDetection.js +15 -46
  40. package/esm/hierarchy/customCollisionDetection.js.map +7 -0
  41. package/esm/hierarchy/getHierarchyKeyboardCoordinates.js +42 -76
  42. package/esm/hierarchy/getHierarchyKeyboardCoordinates.js.map +7 -0
  43. package/esm/hierarchy/index.js +3 -1
  44. package/esm/hierarchy/index.js.map +7 -0
  45. package/esm/hierarchy/types.js +2 -1
  46. package/esm/hierarchy/types.js.map +7 -0
  47. package/esm/hierarchy/useHierarchyActionHandlers.js +24 -31
  48. package/esm/hierarchy/useHierarchyActionHandlers.js.map +7 -0
  49. package/esm/hierarchy/useHierarchyAnnouncements.js +14 -20
  50. package/esm/hierarchy/useHierarchyAnnouncements.js.map +7 -0
  51. package/esm/hierarchy/useHierarchyDndkitConfig.js +45 -66
  52. package/esm/hierarchy/useHierarchyDndkitConfig.js.map +7 -0
  53. package/esm/hierarchy/useHierarchyPreviewHandlers.js +15 -19
  54. package/esm/hierarchy/useHierarchyPreviewHandlers.js.map +7 -0
  55. package/esm/index.js +4 -2
  56. package/esm/index.js.map +7 -0
  57. package/esm/tree/constants.js +12 -10
  58. package/esm/tree/constants.js.map +7 -0
  59. package/esm/tree/customCollisionDetection.js +33 -89
  60. package/esm/tree/customCollisionDetection.js.map +7 -0
  61. package/esm/tree/getTreeKeyboardCoordinates.js +49 -84
  62. package/esm/tree/getTreeKeyboardCoordinates.js.map +7 -0
  63. package/esm/tree/index.js +3 -1
  64. package/esm/tree/index.js.map +7 -0
  65. package/esm/tree/types.js +2 -1
  66. package/esm/tree/types.js.map +7 -0
  67. package/esm/tree/useTreeActionHandlers.js +35 -50
  68. package/esm/tree/useTreeActionHandlers.js.map +7 -0
  69. package/esm/tree/useTreeAnnouncements.js +18 -30
  70. package/esm/tree/useTreeAnnouncements.js.map +7 -0
  71. package/esm/tree/useTreeDndkitConfig.js +59 -70
  72. package/esm/tree/useTreeDndkitConfig.js.map +7 -0
  73. package/esm/tree/useTreePreviewHandlers.js +19 -28
  74. package/esm/tree/useTreePreviewHandlers.js.map +7 -0
  75. package/esm/tree/utilities.js +13 -23
  76. package/esm/tree/utilities.js.map +7 -0
  77. package/package.json +1 -1
@@ -1,58 +1,53 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.filter.js');
6
- require('core-js/modules/esnext.iterator.constructor.js');
7
- require('core-js/modules/esnext.iterator.filter.js');
8
- require('core-js/modules/esnext.async-iterator.find.js');
9
- require('core-js/modules/esnext.iterator.find.js');
10
- require('core-js/modules/esnext.async-iterator.for-each.js');
11
- require('core-js/modules/esnext.iterator.for-each.js');
12
-
13
- const customCollisionDetection = (activeId, activeParent, dndItems) => _ref => {
14
- var _originalContainer$re;
15
-
16
- let {
17
- droppableContainers,
18
- collisionRect
19
- } = _ref;
20
- const entriesWithSameParent = droppableContainers.filter(_ref2 => {
21
- var _dndItems$find;
22
-
23
- let {
24
- id
25
- } = _ref2;
26
- return ((_dndItems$find = dndItems.find(item => item.id === id)) === null || _dndItems$find === void 0 ? void 0 : _dndItems$find.parentId) === activeParent;
27
- });
28
- const originalContainer = entriesWithSameParent.find(_ref3 => {
29
- let {
30
- id
31
- } = _ref3;
32
- return id === activeId;
33
- });
34
- const originalRect = originalContainer === null || originalContainer === void 0 ? void 0 : (_originalContainer$re = originalContainer.rect) === null || _originalContainer$re === void 0 ? void 0 : _originalContainer$re.current;
35
- if (!originalRect) return null;
36
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var customCollisionDetection_exports = {};
29
+ __export(customCollisionDetection_exports, {
30
+ customCollisionDetection: () => customCollisionDetection
31
+ });
32
+ var React = __toESM(require("react"));
33
+ const customCollisionDetection = (activeId, activeParent, dndItems) => ({ droppableContainers, collisionRect }) => {
34
+ const entriesWithSameParent = droppableContainers.filter(({ id }) => dndItems.find((item) => item.id === id)?.parentId === activeParent);
35
+ const originalContainer = entriesWithSameParent.find(({ id }) => id === activeId);
36
+ const originalRect = originalContainer?.rect?.current;
37
+ if (!originalRect)
38
+ return null;
37
39
  if (originalRect.offsetLeft <= collisionRect.offsetLeft && collisionRect.offsetLeft <= originalRect.offsetLeft + originalRect.width) {
38
40
  return originalContainer.id;
39
41
  }
40
-
41
42
  const isLeft = collisionRect.offsetLeft <= originalRect.offsetLeft + collisionRect.width / 2 + 5;
42
- let match = null; // If going to the left, search the closest offset left
43
- // Otherwise, get the closest offset right
44
-
43
+ let match = null;
45
44
  const collisionPoint = collisionRect.offsetLeft + collisionRect.width / 2;
46
- entriesWithSameParent.forEach(entry => {
45
+ entriesWithSameParent.forEach((entry) => {
47
46
  const {
48
- rect: {
49
- current: rect
50
- }
47
+ rect: { current: rect }
51
48
  } = entry;
52
-
53
49
  if (rect !== null) {
54
50
  const offsetRight = rect.offsetLeft + rect.width;
55
-
56
51
  if (!match) {
57
52
  match = entry;
58
53
  } else if (match && match.rect.current && isLeft && Math.abs(collisionPoint - rect.offsetLeft) <= Math.abs(collisionPoint - match.rect.current.offsetLeft)) {
@@ -61,10 +56,9 @@ const customCollisionDetection = (activeId, activeParent, dndItems) => _ref => {
61
56
  match = entry;
62
57
  }
63
58
  }
64
- }); // Typescript believes match is always null for some reason
65
-
59
+ });
66
60
  const matchCastedForSomeReason = match;
67
61
  return matchCastedForSomeReason === null ? null : matchCastedForSomeReason.id;
68
62
  };
69
-
70
- exports.customCollisionDetection = customCollisionDetection;
63
+ module.exports = __toCommonJS(customCollisionDetection_exports);
64
+ //# sourceMappingURL=customCollisionDetection.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hierarchy/customCollisionDetection.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { CollisionDetection, DroppableContainer } from '@dnd-kit/core';\nimport { Item } from './types';\n\nexport const customCollisionDetection =\n (activeId: string | null, activeParent: string | undefined, dndItems: Item[]): CollisionDetection =>\n ({ droppableContainers, collisionRect }) => {\n const entriesWithSameParent = droppableContainers.filter(\n ({ id }) => dndItems.find((item) => item.id === id)?.parentId === activeParent,\n );\n\n const originalContainer = entriesWithSameParent.find(({ id }) => id === activeId);\n const originalRect = originalContainer?.rect?.current;\n\n if (!originalRect) return null;\n\n if (\n originalRect.offsetLeft <= collisionRect.offsetLeft &&\n collisionRect.offsetLeft <= originalRect.offsetLeft + originalRect.width\n ) {\n return originalContainer.id;\n }\n\n const isLeft = collisionRect.offsetLeft <= originalRect.offsetLeft + collisionRect.width / 2 + 5;\n\n let match: DroppableContainer | null = null;\n // If going to the left, search the closest offset left\n // Otherwise, get the closest offset right\n const collisionPoint = collisionRect.offsetLeft + collisionRect.width / 2;\n entriesWithSameParent.forEach((entry) => {\n const {\n rect: { current: rect },\n } = entry;\n\n if (rect !== null) {\n const offsetRight = rect.offsetLeft + rect.width;\n\n if (!match) {\n match = entry;\n } else if (\n match &&\n match.rect.current &&\n isLeft &&\n Math.abs(collisionPoint - rect.offsetLeft) <= Math.abs(collisionPoint - match.rect.current.offsetLeft)\n ) {\n match = entry;\n } else if (\n match &&\n match.rect.current &&\n !isLeft &&\n Math.abs(collisionPoint - offsetRight) <=\n Math.abs(collisionPoint - match.rect.current.offsetLeft - match.rect.current.width)\n ) {\n match = entry;\n }\n }\n });\n // Typescript believes match is always null for some reason\n const matchCastedForSomeReason = match as DroppableContainer | null;\n return matchCastedForSomeReason === null ? null : matchCastedForSomeReason.id;\n };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGhB,MAAM,2BACX,CAAC,UAAyB,cAAkC,aAC5D,CAAC,EAAE,qBAAqB,oBAAoB;AAC1C,QAAM,wBAAwB,oBAAoB,OAChD,CAAC,EAAE,SAAS,SAAS,KAAK,CAAC,SAAS,KAAK,OAAO,KAAK,aAAa;AAGpE,QAAM,oBAAoB,sBAAsB,KAAK,CAAC,EAAE,SAAS,OAAO;AACxE,QAAM,eAAe,mBAAmB,MAAM;AAE9C,MAAI,CAAC;AAAc,WAAO;AAE1B,MACE,aAAa,cAAc,cAAc,cACzC,cAAc,cAAc,aAAa,aAAa,aAAa,OACnE;AACA,WAAO,kBAAkB;AAAA;AAG3B,QAAM,SAAS,cAAc,cAAc,aAAa,aAAa,cAAc,QAAQ,IAAI;AAE/F,MAAI,QAAmC;AAGvC,QAAM,iBAAiB,cAAc,aAAa,cAAc,QAAQ;AACxE,wBAAsB,QAAQ,CAAC,UAAU;AACvC,UAAM;AAAA,MACJ,MAAM,EAAE,SAAS;AAAA,QACf;AAEJ,QAAI,SAAS,MAAM;AACjB,YAAM,cAAc,KAAK,aAAa,KAAK;AAE3C,UAAI,CAAC,OAAO;AACV,gBAAQ;AAAA,iBAER,SACA,MAAM,KAAK,WACX,UACA,KAAK,IAAI,iBAAiB,KAAK,eAAe,KAAK,IAAI,iBAAiB,MAAM,KAAK,QAAQ,aAC3F;AACA,gBAAQ;AAAA,iBAER,SACA,MAAM,KAAK,WACX,CAAC,UACD,KAAK,IAAI,iBAAiB,gBACxB,KAAK,IAAI,iBAAiB,MAAM,KAAK,QAAQ,aAAa,MAAM,KAAK,QAAQ,QAC/E;AACA,gBAAQ;AAAA;AAAA;AAAA;AAKd,QAAM,2BAA2B;AACjC,SAAO,6BAA6B,OAAO,OAAO,yBAAyB;AAAA;",
6
+ "names": []
7
+ }
@@ -1,105 +1,92 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
- require('core-js/modules/esnext.async-iterator.find.js');
7
- require('core-js/modules/esnext.iterator.constructor.js');
8
- require('core-js/modules/esnext.iterator.find.js');
9
- require('core-js/modules/esnext.async-iterator.for-each.js');
10
- require('core-js/modules/esnext.iterator.for-each.js');
11
- require('core-js/modules/esnext.async-iterator.filter.js');
12
- require('core-js/modules/esnext.iterator.filter.js');
13
- var core = require('@dnd-kit/core');
14
-
15
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
-
17
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
18
-
19
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
-
21
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
22
- const directions = [core.KeyboardCode.Down, core.KeyboardCode.Right, core.KeyboardCode.Up, core.KeyboardCode.Left];
23
- const vertical = [core.KeyboardCode.Up, core.KeyboardCode.Down];
24
-
25
- const getHorizontalKeyboardCoordinates = _ref => {
26
- var _droppableContainers$, _droppableContainers$2, _droppableContainers$3, _droppableContainers$4;
27
-
28
- let {
29
- items,
30
- active,
31
- over,
32
- event,
33
- currentCoordinates,
34
- droppableContainers,
35
- collisionRect
36
- } = _ref;
37
- if (vertical.includes(event.code) || !active || !over) return undefined;
38
- const activeItem = items.find(item => item.id === active.id);
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var getHierarchyKeyboardCoordinates_exports = {};
29
+ __export(getHierarchyKeyboardCoordinates_exports, {
30
+ getHierarchyKeyboardCoordinates: () => getHierarchyKeyboardCoordinates
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_core = __toESM(require("@dnd-kit/core"));
34
+ const directions = [import_core.KeyboardCode.Down, import_core.KeyboardCode.Right, import_core.KeyboardCode.Up, import_core.KeyboardCode.Left];
35
+ const vertical = [import_core.KeyboardCode.Up, import_core.KeyboardCode.Down];
36
+ const getHorizontalKeyboardCoordinates = ({
37
+ items,
38
+ active,
39
+ over,
40
+ event,
41
+ currentCoordinates,
42
+ droppableContainers,
43
+ collisionRect
44
+ }) => {
45
+ if (vertical.includes(event.code) || !active || !over)
46
+ return void 0;
47
+ const activeItem = items.find((item) => item.id === active.id);
39
48
  const overRect = over.rect;
40
- const layoutRects = []; // Get the reacheable rects depending on the arrow key pressed
41
-
42
- droppableContainers.forEach(container => {
43
- var _items$find;
44
-
45
- if (container !== null && container !== void 0 && container.disabled || !overRect) {
49
+ const layoutRects = [];
50
+ droppableContainers.forEach((container) => {
51
+ if (container?.disabled || !overRect) {
46
52
  return;
47
53
  }
48
-
49
- const node = container === null || container === void 0 ? void 0 : container.node.current;
50
-
54
+ const node = container?.node.current;
51
55
  if (!node) {
52
56
  return;
53
57
  }
54
-
55
- const itemParent = (_items$find = items.find(item => item.id === container.id)) === null || _items$find === void 0 ? void 0 : _items$find.parentId;
56
- if (itemParent !== (activeItem === null || activeItem === void 0 ? void 0 : activeItem.parentId)) return;
57
- const rect = core.getViewRect(node);
58
-
59
- if (event.code === core.KeyboardCode.Left && collisionRect.left > rect.right - 10) {
58
+ const itemParent = items.find((item) => item.id === container.id)?.parentId;
59
+ if (itemParent !== activeItem?.parentId)
60
+ return;
61
+ const rect = (0, import_core.getViewRect)(node);
62
+ if (event.code === import_core.KeyboardCode.Left && collisionRect.left > rect.right - 10) {
60
63
  layoutRects.push(container);
61
- } else if (event.code === core.KeyboardCode.Right && collisionRect.left < rect.left) {
64
+ } else if (event.code === import_core.KeyboardCode.Right && collisionRect.left < rect.left) {
62
65
  layoutRects.push(container);
63
66
  }
64
67
  });
65
- const closestId = core.closestCorners({
66
- droppableContainers: layoutRects,
67
- collisionRect,
68
- active
69
- });
70
- if (!closestId) return undefined;
71
- const closestDroppableContainer = (_droppableContainers$ = droppableContainers.get(closestId)) === null || _droppableContainers$ === void 0 ? void 0 : (_droppableContainers$2 = _droppableContainers$.node) === null || _droppableContainers$2 === void 0 ? void 0 : _droppableContainers$2.current;
72
- const activeDroppableContainer = (_droppableContainers$3 = droppableContainers.get(active === null || active === void 0 ? void 0 : active.id)) === null || _droppableContainers$3 === void 0 ? void 0 : (_droppableContainers$4 = _droppableContainers$3.node) === null || _droppableContainers$4 === void 0 ? void 0 : _droppableContainers$4.current;
73
- if (!closestDroppableContainer || !activeDroppableContainer) return undefined;
74
- const closestRect = core.getViewRect(closestDroppableContainer);
75
- const activeRect = core.getViewRect(activeDroppableContainer);
76
- return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
68
+ const closestId = (0, import_core.closestCorners)({ droppableContainers: layoutRects, collisionRect, active });
69
+ if (!closestId)
70
+ return void 0;
71
+ const closestDroppableContainer = droppableContainers.get(closestId)?.node?.current;
72
+ const activeDroppableContainer = droppableContainers.get(active?.id)?.node?.current;
73
+ if (!closestDroppableContainer || !activeDroppableContainer)
74
+ return void 0;
75
+ const closestRect = (0, import_core.getViewRect)(closestDroppableContainer);
76
+ const activeRect = (0, import_core.getViewRect)(activeDroppableContainer);
77
+ return {
78
+ ...currentCoordinates,
77
79
  x: closestRect.left + (closestRect.width - collisionRect.width) / 2 + (closestRect.offsetLeft < activeRect.left ? -1 : 1)
78
- });
80
+ };
79
81
  };
80
-
81
- const getHierarchyKeyboardCoordinates = (context, dragOverlayDataTestid, isHorizontalDnD) => (event, _ref2) => {
82
- let {
83
- currentCoordinates,
84
- context: {
85
- active,
86
- over,
87
- collisionRect,
88
- droppableContainers
89
- }
90
- } = _ref2;
91
-
82
+ const getHierarchyKeyboardCoordinates = (context, dragOverlayDataTestid, isHorizontalDnD) => (event, { currentCoordinates, context: { active, over, collisionRect, droppableContainers } }) => {
92
83
  if (directions.includes(event.code)) {
93
84
  event.preventDefault();
94
-
95
85
  if (!collisionRect) {
96
- return undefined;
86
+ return void 0;
97
87
  }
98
-
99
88
  const {
100
- current: {
101
- items
102
- }
89
+ current: { items }
103
90
  } = context;
104
91
  const args = {
105
92
  dragOverlayDataTestid,
@@ -111,11 +98,11 @@ const getHierarchyKeyboardCoordinates = (context, dragOverlayDataTestid, isHoriz
111
98
  droppableContainers,
112
99
  collisionRect
113
100
  };
114
- if (isHorizontalDnD) return getHorizontalKeyboardCoordinates(args);
115
- return undefined;
101
+ if (isHorizontalDnD)
102
+ return getHorizontalKeyboardCoordinates(args);
103
+ return void 0;
116
104
  }
117
-
118
- return undefined;
105
+ return void 0;
119
106
  };
120
-
121
- exports.getHierarchyKeyboardCoordinates = getHierarchyKeyboardCoordinates;
107
+ module.exports = __toCommonJS(getHierarchyKeyboardCoordinates_exports);
108
+ //# sourceMappingURL=getHierarchyKeyboardCoordinates.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hierarchy/getHierarchyKeyboardCoordinates.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { closestCorners, getViewRect, KeyboardCode, KeyboardCoordinateGetter, DroppableContainer } from '@dnd-kit/core';\nimport { Coordinates } from '@dnd-kit/core/dist/types';\n\nimport { GetKeyboardCoordinatesArgs, SensorContext } from './types';\n\nconst directions: string[] = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];\n\nconst vertical: string[] = [KeyboardCode.Up, KeyboardCode.Down];\n\nconst getHorizontalKeyboardCoordinates = ({\n items,\n active,\n over,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n}: GetKeyboardCoordinatesArgs): Coordinates | undefined => {\n if (vertical.includes(event.code) || !active || !over) return undefined;\n\n const activeItem = items.find((item) => item.id === active.id);\n\n const overRect = over.rect;\n\n const layoutRects: DroppableContainer[] = [];\n\n // Get the reacheable rects depending on the arrow key pressed\n droppableContainers.forEach((container) => {\n if (container?.disabled || !overRect) {\n return;\n }\n const node = container?.node.current;\n if (!node) {\n return;\n }\n const itemParent = items.find((item) => item.id === container.id)?.parentId;\n if (itemParent !== activeItem?.parentId) return;\n const rect = getViewRect(node);\n if (event.code === KeyboardCode.Left && collisionRect.left > rect.right - 10) {\n layoutRects.push(container);\n } else if (event.code === KeyboardCode.Right && collisionRect.left < rect.left) {\n layoutRects.push(container);\n }\n });\n\n const closestId = closestCorners({ droppableContainers: layoutRects, collisionRect, active });\n\n if (!closestId) return undefined;\n\n const closestDroppableContainer = droppableContainers.get(closestId)?.node?.current;\n const activeDroppableContainer = droppableContainers.get(active?.id)?.node?.current;\n\n if (!closestDroppableContainer || !activeDroppableContainer) return undefined;\n\n const closestRect = getViewRect(closestDroppableContainer);\n const activeRect = getViewRect(activeDroppableContainer);\n return {\n ...currentCoordinates,\n x:\n closestRect.left +\n (closestRect.width - collisionRect.width) / 2 +\n (closestRect.offsetLeft < activeRect.left ? -1 : 1),\n };\n};\n\nexport const getHierarchyKeyboardCoordinates: (\n context: SensorContext,\n dragOverlayDataTestid: string,\n isHorizontalDnD: boolean,\n) => KeyboardCoordinateGetter =\n (context, dragOverlayDataTestid, isHorizontalDnD) =>\n (event, { currentCoordinates, context: { active, over, collisionRect, droppableContainers } }) => {\n if (directions.includes(event.code)) {\n event.preventDefault();\n if (!collisionRect) {\n return undefined;\n }\n\n const {\n current: { items },\n } = context;\n\n const args = {\n dragOverlayDataTestid,\n items,\n active,\n over,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n };\n\n if (isHorizontalDnD) return getHorizontalKeyboardCoordinates(args);\n return undefined;\n }\n return undefined;\n };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,kBAAwG;AAKxG,MAAM,aAAuB,CAAC,yBAAa,MAAM,yBAAa,OAAO,yBAAa,IAAI,yBAAa;AAEnG,MAAM,WAAqB,CAAC,yBAAa,IAAI,yBAAa;AAE1D,MAAM,mCAAmC,CAAC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACyD;AACzD,MAAI,SAAS,SAAS,MAAM,SAAS,CAAC,UAAU,CAAC;AAAM,WAAO;AAE9D,QAAM,aAAa,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,OAAO;AAE3D,QAAM,WAAW,KAAK;AAEtB,QAAM,cAAoC;AAG1C,sBAAoB,QAAQ,CAAC,cAAc;AACzC,QAAI,WAAW,YAAY,CAAC,UAAU;AACpC;AAAA;AAEF,UAAM,OAAO,WAAW,KAAK;AAC7B,QAAI,CAAC,MAAM;AACT;AAAA;AAEF,UAAM,aAAa,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,UAAU,KAAK;AACnE,QAAI,eAAe,YAAY;AAAU;AACzC,UAAM,OAAO,6BAAY;AACzB,QAAI,MAAM,SAAS,yBAAa,QAAQ,cAAc,OAAO,KAAK,QAAQ,IAAI;AAC5E,kBAAY,KAAK;AAAA,eACR,MAAM,SAAS,yBAAa,SAAS,cAAc,OAAO,KAAK,MAAM;AAC9E,kBAAY,KAAK;AAAA;AAAA;AAIrB,QAAM,YAAY,gCAAe,EAAE,qBAAqB,aAAa,eAAe;AAEpF,MAAI,CAAC;AAAW,WAAO;AAEvB,QAAM,4BAA4B,oBAAoB,IAAI,YAAY,MAAM;AAC5E,QAAM,2BAA2B,oBAAoB,IAAI,QAAQ,KAAK,MAAM;AAE5E,MAAI,CAAC,6BAA6B,CAAC;AAA0B,WAAO;AAEpE,QAAM,cAAc,6BAAY;AAChC,QAAM,aAAa,6BAAY;AAC/B,SAAO;AAAA,OACF;AAAA,IACH,GACE,YAAY,OACX,aAAY,QAAQ,cAAc,SAAS,IAC3C,aAAY,aAAa,WAAW,OAAO,KAAK;AAAA;AAAA;AAIhD,MAAM,kCAKX,CAAC,SAAS,uBAAuB,oBACjC,CAAC,OAAO,EAAE,oBAAoB,SAAS,EAAE,QAAQ,MAAM,eAAe,4BAA4B;AAChG,MAAI,WAAW,SAAS,MAAM,OAAO;AACnC,UAAM;AACN,QAAI,CAAC,eAAe;AAClB,aAAO;AAAA;AAGT,UAAM;AAAA,MACJ,SAAS,EAAE;AAAA,QACT;AAEJ,UAAM,OAAO;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAGF,QAAI;AAAiB,aAAO,iCAAiC;AAC7D,WAAO;AAAA;AAET,SAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -1,9 +1,28 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var useHierarchyDndkitConfig = require('./useHierarchyDndkitConfig.js');
6
-
7
-
8
-
9
- exports.useHierarchyDndkitConfig = useHierarchyDndkitConfig.useHierarchyDndkitConfig;
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __reExport = (target, module2, copyDefault, desc) => {
9
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
+ for (let key of __getOwnPropNames(module2))
11
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
12
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
13
+ }
14
+ return target;
15
+ };
16
+ var __toESM = (module2, isNodeMode) => {
17
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18
+ };
19
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
20
+ return (module2, temp) => {
21
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
22
+ };
23
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
24
+ var hierarchy_exports = {};
25
+ var React = __toESM(require("react"));
26
+ __reExport(hierarchy_exports, __toESM(require("./useHierarchyDndkitConfig")));
27
+ module.exports = __toCommonJS(hierarchy_exports);
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hierarchy/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export * from './useHierarchyDndkitConfig';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;ADAvB,8BAAc;",
6
+ "names": []
7
+ }
@@ -1,2 +1,27 @@
1
- 'use strict';
2
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __reExport = (target, module2, copyDefault, desc) => {
9
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
+ for (let key of __getOwnPropNames(module2))
11
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
12
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
13
+ }
14
+ return target;
15
+ };
16
+ var __toESM = (module2, isNodeMode) => {
17
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18
+ };
19
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
20
+ return (module2, temp) => {
21
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
22
+ };
23
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
24
+ var types_exports = {};
25
+ var React = __toESM(require("react"));
26
+ module.exports = __toCommonJS(types_exports);
27
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hierarchy/types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import type {\n Active,\n Announcements,\n CollisionDetection,\n DragEndEvent,\n DragMoveEvent,\n DragOverEvent,\n DragStartEvent,\n MeasuringConfiguration,\n Modifier,\n Over,\n SensorDescriptor,\n SensorOptions,\n} from '@dnd-kit/core';\nimport { DroppableContainers } from '@dnd-kit/core/dist/store';\nimport { Coordinates, DragCancelEvent, ViewRect } from '@dnd-kit/core/dist/types';\nimport { MutableRefObject } from 'react';\n\nexport type Item = {\n id: string;\n depth: number;\n parentId: string;\n index: number;\n};\n\nexport type DndContextPropsType = {\n announcements: Announcements;\n modifiers: Modifier[];\n sensors: SensorDescriptor<SensorOptions>[];\n measuring: Partial<MeasuringConfiguration>;\n collisionDetection: CollisionDetection;\n onDragStart: (e: DragStartEvent) => void;\n onDragMove: (e: DragMoveEvent) => void;\n onDragOver: (e: DragOverEvent) => void;\n onDragEnd: (e: DragEndEvent) => void;\n onDragCancel: (e: DragCancelEvent) => void;\n};\n\nexport type useHierarchyPreviewHandlersReturn = {\n handlePreviewDragStart: (e: DragStartEvent) => void;\n handlePreviewDragMove: (e: DragMoveEvent) => void;\n handlePreviewDragEnd: (e: DragEndEvent) => void;\n handlePreviewDragCancel: (e: DragCancelEvent) => void;\n};\n\nexport type useHierarchyPreviewHandlersArgs = {\n setActiveId: React.Dispatch<React.SetStateAction<string>>;\n onPreviewResetState: () => void;\n onPreviewDragStart: () => void;\n};\n\nexport type useHierarchyActionHandlersArgs = useHierarchyPreviewHandlersReturn & {\n dndItems: Item[];\n onReorder: (movedItem: Item, indexes: { targetIndex: number; fromIndex: number }) => void;\n};\n\nexport type useHierarchyActionHandlersReturn = {\n onDragStart: (e: DragStartEvent) => void;\n onDragMove: (e: DragMoveEvent) => void;\n onDragOver: (e: DragOverEvent) => void;\n onDragEnd: (e: DragEndEvent) => void;\n onDragCancel: (e: DragCancelEvent) => void;\n};\n\nexport type useHierarchyDndkitConfigArgs = {\n indentationWidth?: number;\n dragOverlayDataTestid: string;\n flattenedItems: [Item, unknown][];\n isHorizontalDnD?: boolean;\n onReorder: (movedItem: Item, indexes: { targetIndex: number; fromIndex: number }) => void;\n onPreviewResetState: () => void;\n onPreviewDragStart: () => void;\n};\n\nexport type useHierarchyDndkitConfigType = (args: useHierarchyDndkitConfigArgs) => useHierarchyDndkitConfigReturn;\n\nexport type useHierarchyDndkitConfigReturn = {\n dndContextProps: DndContextPropsType;\n activeId: string | null;\n overId: string | null;\n activeIndex: number | undefined;\n};\n\nexport type getKeyboardCoordinatesArgs = {\n items: Item[];\n active: Active | null;\n over: Over | null;\n event: KeyboardEvent;\n currentCoordinates: Coordinates;\n droppableContainers: DroppableContainers;\n collisionRect: ViewRect;\n dragOverlayDataTestid: string;\n};\n\nexport type SensorContext = MutableRefObject<{\n items: Item[];\n offset?: number;\n}>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
6
+ "names": []
7
+ }
@@ -1,50 +1,68 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var react = require('react');
6
-
7
- const useHierarchyActionHandlers = _ref => {
8
- let {
9
- handlePreviewDragStart,
10
- handlePreviewDragMove,
11
- handlePreviewDragEnd,
12
- handlePreviewDragCancel,
13
- onReorder,
14
- dndItems
15
- } = _ref;
16
- const onDragStart = react.useCallback(e => {
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var useHierarchyActionHandlers_exports = {};
29
+ __export(useHierarchyActionHandlers_exports, {
30
+ useHierarchyActionHandlers: () => useHierarchyActionHandlers
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_react = __toESM(require("react"));
34
+ const useHierarchyActionHandlers = ({
35
+ handlePreviewDragStart,
36
+ handlePreviewDragMove,
37
+ handlePreviewDragEnd,
38
+ handlePreviewDragCancel,
39
+ onReorder,
40
+ dndItems
41
+ }) => {
42
+ const onDragStart = (0, import_react.useCallback)((e) => {
17
43
  handlePreviewDragStart(e);
18
44
  }, [handlePreviewDragStart]);
19
- const onDragMove = react.useCallback(e => {
45
+ const onDragMove = (0, import_react.useCallback)((e) => {
20
46
  handlePreviewDragMove(e);
21
47
  }, [handlePreviewDragMove]);
22
- const onDragEnd = react.useCallback(e => {
48
+ const onDragEnd = (0, import_react.useCallback)((e) => {
23
49
  handlePreviewDragEnd(e);
24
- const {
25
- active,
26
- over
27
- } = e;
28
- if (!over) return;
29
-
50
+ const { active, over } = e;
51
+ if (!over)
52
+ return;
30
53
  if (active.id !== over.id) {
31
- const activeIndex = dndItems.findIndex(item => item.id === active.id);
32
- const overIndex = dndItems.findIndex(item => item.id === over.id);
54
+ const activeIndex = dndItems.findIndex((item) => item.id === active.id);
55
+ const overIndex = dndItems.findIndex((item) => item.id === over.id);
33
56
  onReorder(dndItems[activeIndex], {
34
57
  targetIndex: overIndex,
35
58
  fromIndex: activeIndex
36
59
  });
37
60
  }
38
61
  }, [handlePreviewDragEnd, dndItems, onReorder]);
39
- const onDragCancel = react.useCallback(e => {
62
+ const onDragCancel = (0, import_react.useCallback)((e) => {
40
63
  handlePreviewDragCancel(e);
41
64
  }, [handlePreviewDragCancel]);
42
- return {
43
- onDragStart,
44
- onDragMove,
45
- onDragEnd,
46
- onDragCancel
47
- };
65
+ return { onDragStart, onDragMove, onDragEnd, onDragCancel };
48
66
  };
49
-
50
- exports.useHierarchyActionHandlers = useHierarchyActionHandlers;
67
+ module.exports = __toCommonJS(useHierarchyActionHandlers_exports);
68
+ //# sourceMappingURL=useHierarchyActionHandlers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hierarchy/useHierarchyActionHandlers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { useCallback } from 'react';\nimport { DragStartEvent, DragMoveEvent, DragEndEvent, DragCancelEvent } from '@dnd-kit/core';\nimport { UseHierarchyActionHandlersReturn, UseHierarchyActionHandlersArgs } from './types';\n\nexport const useHierarchyActionHandlers = ({\n handlePreviewDragStart,\n handlePreviewDragMove,\n handlePreviewDragEnd,\n handlePreviewDragCancel,\n onReorder,\n dndItems,\n}: UseHierarchyActionHandlersArgs): UseHierarchyActionHandlersReturn => {\n const onDragStart = useCallback(\n (e: DragStartEvent) => {\n handlePreviewDragStart(e);\n },\n [handlePreviewDragStart],\n );\n\n const onDragMove = useCallback(\n (e: DragMoveEvent) => {\n handlePreviewDragMove(e);\n },\n [handlePreviewDragMove],\n );\n\n const onDragEnd = useCallback(\n (e: DragEndEvent) => {\n handlePreviewDragEnd(e);\n const { active, over } = e;\n\n if (!over) return;\n\n if (active.id !== over.id) {\n const activeIndex = dndItems.findIndex((item) => item.id === active.id);\n const overIndex = dndItems.findIndex((item) => item.id === over.id);\n\n onReorder(dndItems[activeIndex], {\n targetIndex: overIndex,\n fromIndex: activeIndex,\n });\n }\n },\n [handlePreviewDragEnd, dndItems, onReorder],\n );\n\n const onDragCancel = useCallback(\n (e: DragCancelEvent) => {\n handlePreviewDragCancel(e);\n },\n [handlePreviewDragCancel],\n );\n\n return { onDragStart, onDragMove, onDragEnd, onDragCancel };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4B;AAIrB,MAAM,6BAA6B,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACsE;AACtE,QAAM,cAAc,8BAClB,CAAC,MAAsB;AACrB,2BAAuB;AAAA,KAEzB,CAAC;AAGH,QAAM,aAAa,8BACjB,CAAC,MAAqB;AACpB,0BAAsB;AAAA,KAExB,CAAC;AAGH,QAAM,YAAY,8BAChB,CAAC,MAAoB;AACnB,yBAAqB;AACrB,UAAM,EAAE,QAAQ,SAAS;AAEzB,QAAI,CAAC;AAAM;AAEX,QAAI,OAAO,OAAO,KAAK,IAAI;AACzB,YAAM,cAAc,SAAS,UAAU,CAAC,SAAS,KAAK,OAAO,OAAO;AACpE,YAAM,YAAY,SAAS,UAAU,CAAC,SAAS,KAAK,OAAO,KAAK;AAEhE,gBAAU,SAAS,cAAc;AAAA,QAC/B,aAAa;AAAA,QACb,WAAW;AAAA;AAAA;AAAA,KAIjB,CAAC,sBAAsB,UAAU;AAGnC,QAAM,eAAe,8BACnB,CAAC,MAAuB;AACtB,4BAAwB;AAAA,KAE1B,CAAC;AAGH,SAAO,EAAE,aAAa,YAAY,WAAW;AAAA;",
6
+ "names": []
7
+ }