@elliemae/ds-drag-and-drop 3.16.0 → 3.16.1

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 (84) hide show
  1. package/dist/cjs/hierarchy/customCollisionDetection.js +4 -0
  2. package/dist/cjs/hierarchy/customCollisionDetection.js.map +2 -2
  3. package/dist/cjs/hierarchy/getHierarchyKeyboardCoordinates.js +4 -0
  4. package/dist/cjs/hierarchy/getHierarchyKeyboardCoordinates.js.map +2 -2
  5. package/dist/cjs/hierarchy/index.js +6 -2
  6. package/dist/cjs/hierarchy/index.js.map +2 -2
  7. package/dist/cjs/hierarchy/types.js +4 -0
  8. package/dist/cjs/hierarchy/types.js.map +1 -1
  9. package/dist/cjs/hierarchy/useHierarchyActionHandlers.js +4 -0
  10. package/dist/cjs/hierarchy/useHierarchyActionHandlers.js.map +2 -2
  11. package/dist/cjs/hierarchy/useHierarchyAnnouncements.js +4 -0
  12. package/dist/cjs/hierarchy/useHierarchyAnnouncements.js.map +2 -2
  13. package/dist/cjs/hierarchy/useHierarchyDndkitConfig.js +9 -5
  14. package/dist/cjs/hierarchy/useHierarchyDndkitConfig.js.map +2 -2
  15. package/dist/cjs/hierarchy/useHierarchyPreviewHandlers.js +4 -0
  16. package/dist/cjs/hierarchy/useHierarchyPreviewHandlers.js.map +2 -2
  17. package/dist/cjs/index.js +6 -2
  18. package/dist/cjs/index.js.map +2 -2
  19. package/dist/cjs/package.json +7 -0
  20. package/dist/cjs/tree/constants.js +4 -0
  21. package/dist/cjs/tree/constants.js.map +1 -1
  22. package/dist/cjs/tree/customCollisionDetection.js +5 -1
  23. package/dist/cjs/tree/customCollisionDetection.js.map +2 -2
  24. package/dist/cjs/tree/getTreeKeyboardCoordinates.js +5 -1
  25. package/dist/cjs/tree/getTreeKeyboardCoordinates.js.map +2 -2
  26. package/dist/cjs/tree/index.js +7 -3
  27. package/dist/cjs/tree/index.js.map +2 -2
  28. package/dist/cjs/tree/types.js +4 -0
  29. package/dist/cjs/tree/types.js.map +2 -2
  30. package/dist/cjs/tree/useTreeActionHandlers.js +5 -1
  31. package/dist/cjs/tree/useTreeActionHandlers.js.map +2 -2
  32. package/dist/cjs/tree/useTreeAnnouncements.js +5 -1
  33. package/dist/cjs/tree/useTreeAnnouncements.js.map +2 -2
  34. package/dist/cjs/tree/useTreeDndkitConfig.js +11 -7
  35. package/dist/cjs/tree/useTreeDndkitConfig.js.map +2 -2
  36. package/dist/cjs/tree/useTreePreviewHandlers.js +4 -0
  37. package/dist/cjs/tree/useTreePreviewHandlers.js.map +2 -2
  38. package/dist/cjs/tree/utilities.js +5 -1
  39. package/dist/cjs/tree/utilities.js.map +2 -2
  40. package/dist/esm/hierarchy/customCollisionDetection.js.map +2 -2
  41. package/dist/esm/hierarchy/getHierarchyKeyboardCoordinates.js.map +2 -2
  42. package/dist/esm/hierarchy/index.js +2 -2
  43. package/dist/esm/hierarchy/index.js.map +1 -1
  44. package/dist/esm/hierarchy/useHierarchyActionHandlers.js.map +2 -2
  45. package/dist/esm/hierarchy/useHierarchyAnnouncements.js.map +2 -2
  46. package/dist/esm/hierarchy/useHierarchyDndkitConfig.js +5 -5
  47. package/dist/esm/hierarchy/useHierarchyDndkitConfig.js.map +2 -2
  48. package/dist/esm/hierarchy/useHierarchyPreviewHandlers.js.map +1 -1
  49. package/dist/esm/index.js +2 -2
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/esm/package.json +7 -0
  52. package/dist/esm/tree/customCollisionDetection.js +1 -1
  53. package/dist/esm/tree/customCollisionDetection.js.map +2 -2
  54. package/dist/esm/tree/getTreeKeyboardCoordinates.js +1 -1
  55. package/dist/esm/tree/getTreeKeyboardCoordinates.js.map +2 -2
  56. package/dist/esm/tree/index.js +3 -3
  57. package/dist/esm/tree/index.js.map +1 -1
  58. package/dist/esm/tree/useTreeActionHandlers.js +1 -1
  59. package/dist/esm/tree/useTreeActionHandlers.js.map +2 -2
  60. package/dist/esm/tree/useTreeAnnouncements.js +1 -1
  61. package/dist/esm/tree/useTreeAnnouncements.js.map +2 -2
  62. package/dist/esm/tree/useTreeDndkitConfig.js +7 -7
  63. package/dist/esm/tree/useTreeDndkitConfig.js.map +2 -2
  64. package/dist/esm/tree/useTreePreviewHandlers.js.map +2 -2
  65. package/dist/esm/tree/utilities.js +1 -1
  66. package/dist/esm/tree/utilities.js.map +2 -2
  67. package/dist/types/hierarchy/customCollisionDetection.d.ts +1 -1
  68. package/dist/types/hierarchy/getHierarchyKeyboardCoordinates.d.ts +1 -1
  69. package/dist/types/hierarchy/index.d.ts +2 -2
  70. package/dist/types/hierarchy/useHierarchyActionHandlers.d.ts +1 -1
  71. package/dist/types/hierarchy/useHierarchyAnnouncements.d.ts +1 -1
  72. package/dist/types/hierarchy/useHierarchyDndkitConfig.d.ts +1 -1
  73. package/dist/types/hierarchy/useHierarchyPreviewHandlers.d.ts +1 -1
  74. package/dist/types/index.d.ts +2 -2
  75. package/dist/types/tree/customCollisionDetection.d.ts +1 -1
  76. package/dist/types/tree/getTreeKeyboardCoordinates.d.ts +1 -1
  77. package/dist/types/tree/index.d.ts +3 -3
  78. package/dist/types/tree/types.d.ts +1 -1
  79. package/dist/types/tree/useTreeActionHandlers.d.ts +1 -1
  80. package/dist/types/tree/useTreeAnnouncements.d.ts +2 -2
  81. package/dist/types/tree/useTreeDndkitConfig.d.ts +1 -1
  82. package/dist/types/tree/useTreePreviewHandlers.d.ts +1 -1
  83. package/dist/types/tree/utilities.d.ts +2 -2
  84. package/package.json +4 -3
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hierarchy/customCollisionDetection.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable indent, complexity */\nimport { type CollisionDetection, type DroppableContainer } from '@dnd-kit/core';\nimport type { DnDKitHierarchy } from './types';\n\nexport const customCollisionDetection =\n <T,>(sensorContext: DnDKitHierarchy.SensorContext<T>): CollisionDetection =>\n ({ droppableContainers, collisionRect }) => {\n const { flattenedItems, active, itemsDictionary } = sensorContext.current;\n\n if (!active) return [];\n\n const activeParent = itemsDictionary[active.id].parentId;\n\n const entriesWithSameParent = droppableContainers.filter(\n ({ id }) => flattenedItems.find((item) => item.uid === id)?.parentId === activeParent,\n );\n\n const originalContainer = entriesWithSameParent.find(({ id }) => id === active.id);\n const originalRect = originalContainer?.rect?.current;\n\n if (!originalRect) return [];\n\n if (originalRect.left <= collisionRect.left && collisionRect.left <= originalRect.left + originalRect.width) {\n return [{ id: originalContainer.id }];\n }\n\n const isLeft = collisionRect.left <= originalRect.left + 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.left + collisionRect.width / 2;\n entriesWithSameParent.forEach((entry) => {\n const rect = entry.rect.current;\n\n if (rect !== null) {\n const offsetRight = rect.left + 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.left) <= Math.abs(collisionPoint - match.rect.current.left)\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.left - 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 ? [] : [{ id: matchCastedForSomeReason.id }];\n };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIhB,MAAM,2BACX,CAAK,kBACL,CAAC,EAAE,qBAAqB,cAAc,MAAM;AAC1C,QAAM,EAAE,gBAAgB,QAAQ,gBAAgB,IAAI,cAAc;AAElE,MAAI,CAAC;AAAQ,WAAO,CAAC;AAErB,QAAM,eAAe,gBAAgB,OAAO,IAAI;AAEhD,QAAM,wBAAwB,oBAAoB;AAAA,IAChD,CAAC,EAAE,GAAG,MAAM,eAAe,KAAK,CAAC,SAAS,KAAK,QAAQ,EAAE,GAAG,aAAa;AAAA,EAC3E;AAEA,QAAM,oBAAoB,sBAAsB,KAAK,CAAC,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE;AACjF,QAAM,eAAe,mBAAmB,MAAM;AAE9C,MAAI,CAAC;AAAc,WAAO,CAAC;AAE3B,MAAI,aAAa,QAAQ,cAAc,QAAQ,cAAc,QAAQ,aAAa,OAAO,aAAa,OAAO;AAC3G,WAAO,CAAC,EAAE,IAAI,kBAAkB,GAAG,CAAC;AAAA,EACtC;AAEA,QAAM,SAAS,cAAc,QAAQ,aAAa,OAAO,cAAc,QAAQ,IAAI;AAEnF,MAAI,QAAmC;AAGvC,QAAM,iBAAiB,cAAc,OAAO,cAAc,QAAQ;AAClE,wBAAsB,QAAQ,CAAC,UAAU;AACvC,UAAM,OAAO,MAAM,KAAK;AAExB,QAAI,SAAS,MAAM;AACjB,YAAM,cAAc,KAAK,OAAO,KAAK;AAErC,UAAI,CAAC,OAAO;AACV,gBAAQ;AAAA,MACV,WACE,SACA,MAAM,KAAK,WACX,UACA,KAAK,IAAI,iBAAiB,KAAK,IAAI,KAAK,KAAK,IAAI,iBAAiB,MAAM,KAAK,QAAQ,IAAI,GACzF;AACA,gBAAQ;AAAA,MACV,WACE,SACA,MAAM,KAAK,WACX,CAAC,UACD,KAAK,IAAI,iBAAiB,WAAW,KACnC,KAAK,IAAI,iBAAiB,MAAM,KAAK,QAAQ,OAAO,MAAM,KAAK,QAAQ,KAAK,GAC9E;AACA,gBAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,2BAA2B;AACjC,SAAO,6BAA6B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,yBAAyB,GAAG,CAAC;AACtF;",
4
+ "sourcesContent": ["/* eslint-disable indent, complexity */\nimport { type CollisionDetection, type DroppableContainer } from '@dnd-kit/core';\nimport type { DnDKitHierarchy } from './types.js';\n\nexport const customCollisionDetection =\n <T,>(sensorContext: DnDKitHierarchy.SensorContext<T>): CollisionDetection =>\n ({ droppableContainers, collisionRect }) => {\n const { flattenedItems, active, itemsDictionary } = sensorContext.current;\n\n if (!active) return [];\n\n const activeParent = itemsDictionary[active.id].parentId;\n\n const entriesWithSameParent = droppableContainers.filter(\n ({ id }) => flattenedItems.find((item) => item.uid === id)?.parentId === activeParent,\n );\n\n const originalContainer = entriesWithSameParent.find(({ id }) => id === active.id);\n const originalRect = originalContainer?.rect?.current;\n\n if (!originalRect) return [];\n\n if (originalRect.left <= collisionRect.left && collisionRect.left <= originalRect.left + originalRect.width) {\n return [{ id: originalContainer.id }];\n }\n\n const isLeft = collisionRect.left <= originalRect.left + 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.left + collisionRect.width / 2;\n entriesWithSameParent.forEach((entry) => {\n const rect = entry.rect.current;\n\n if (rect !== null) {\n const offsetRight = rect.left + 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.left) <= Math.abs(collisionPoint - match.rect.current.left)\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.left - 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 ? [] : [{ id: matchCastedForSomeReason.id }];\n };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIhB,MAAM,2BACX,CAAK,kBACL,CAAC,EAAE,qBAAqB,cAAc,MAAM;AAC1C,QAAM,EAAE,gBAAgB,QAAQ,gBAAgB,IAAI,cAAc;AAElE,MAAI,CAAC;AAAQ,WAAO,CAAC;AAErB,QAAM,eAAe,gBAAgB,OAAO,EAAE,EAAE;AAEhD,QAAM,wBAAwB,oBAAoB;AAAA,IAChD,CAAC,EAAE,GAAG,MAAM,eAAe,KAAK,CAAC,SAAS,KAAK,QAAQ,EAAE,GAAG,aAAa;AAAA,EAC3E;AAEA,QAAM,oBAAoB,sBAAsB,KAAK,CAAC,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE;AACjF,QAAM,eAAe,mBAAmB,MAAM;AAE9C,MAAI,CAAC;AAAc,WAAO,CAAC;AAE3B,MAAI,aAAa,QAAQ,cAAc,QAAQ,cAAc,QAAQ,aAAa,OAAO,aAAa,OAAO;AAC3G,WAAO,CAAC,EAAE,IAAI,kBAAkB,GAAG,CAAC;AAAA,EACtC;AAEA,QAAM,SAAS,cAAc,QAAQ,aAAa,OAAO,cAAc,QAAQ,IAAI;AAEnF,MAAI,QAAmC;AAGvC,QAAM,iBAAiB,cAAc,OAAO,cAAc,QAAQ;AAClE,wBAAsB,QAAQ,CAAC,UAAU;AACvC,UAAM,OAAO,MAAM,KAAK;AAExB,QAAI,SAAS,MAAM;AACjB,YAAM,cAAc,KAAK,OAAO,KAAK;AAErC,UAAI,CAAC,OAAO;AACV,gBAAQ;AAAA,MACV,WACE,SACA,MAAM,KAAK,WACX,UACA,KAAK,IAAI,iBAAiB,KAAK,IAAI,KAAK,KAAK,IAAI,iBAAiB,MAAM,KAAK,QAAQ,IAAI,GACzF;AACA,gBAAQ;AAAA,MACV,WACE,SACA,MAAM,KAAK,WACX,CAAC,UACD,KAAK,IAAI,iBAAiB,WAAW,KACnC,KAAK,IAAI,iBAAiB,MAAM,KAAK,QAAQ,OAAO,MAAM,KAAK,QAAQ,KAAK,GAC9E;AACA,gBAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,2BAA2B;AACjC,SAAO,6BAA6B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,yBAAyB,GAAG,CAAC;AACtF;",
6
6
  "names": []
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hierarchy/getHierarchyKeyboardCoordinates.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type { KeyboardCoordinateGetter, DroppableContainer } from '@dnd-kit/core';\nimport { closestCorners, getClientRect, KeyboardCode } from '@dnd-kit/core';\nimport type { Coordinates } from '@dnd-kit/core/dist/types';\nimport type { DnDKitHierarchy } 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 = <T,>({\n flattenedItems,\n active,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n droppableRects,\n}: DnDKitHierarchy.GetKeyboardCoordinatesArgs<T>): Coordinates | undefined => {\n if (vertical.includes(event.code) || !active) return undefined;\n\n const activeItem = flattenedItems.find((item) => item.uid === active.id);\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) {\n return;\n }\n const node = container?.node.current;\n if (!node) {\n return;\n }\n const itemParent = flattenedItems.find((item) => item.uid === container.id)?.parentId;\n if (itemParent !== activeItem?.parentId) return;\n const rect = getClientRect(node);\n if (event.code === KeyboardCode.Left && collisionRect.left > rect.left + rect.width - 5) {\n layoutRects.push(container);\n } else if (event.code === KeyboardCode.Right && collisionRect.left < rect.left) {\n layoutRects.push(container);\n }\n });\n\n const sortedRects = closestCorners({\n droppableContainers: layoutRects,\n collisionRect,\n active,\n droppableRects,\n pointerCoordinates: null,\n });\n\n const closestId = sortedRects.length > 0 ? sortedRects[0].id : undefined;\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 = getClientRect(closestDroppableContainer);\n const activeRect = getClientRect(activeDroppableContainer);\n\n return {\n ...currentCoordinates,\n x: closestRect.left + (closestRect.width - collisionRect.width) / 2 + (closestRect.left < activeRect.left ? -2 : 2),\n };\n};\n\nexport const getHierarchyKeyboardCoordinates: <T>(\n context: DnDKitHierarchy.SensorContext<T>,\n) => KeyboardCoordinateGetter = (context) => {\n const func: KeyboardCoordinateGetter = (\n event,\n { currentCoordinates, context: { active, collisionRect, droppableContainers, droppableRects } },\n ) => {\n if (directions.includes(event.code)) {\n event.preventDefault();\n if (!collisionRect) {\n return undefined;\n }\n\n const { flattenedItems, isHorizontalDnD } = context.current;\n\n const args = {\n flattenedItems,\n active,\n event,\n currentCoordinates,\n droppableContainers,\n droppableRects,\n collisionRect,\n };\n\n if (isHorizontalDnD) return getHorizontalKeyboardCoordinates(args);\n return undefined;\n }\n return undefined;\n };\n return func;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,kBAA4D;AAI5D,MAAM,aAAuB,CAAC,yBAAa,MAAM,yBAAa,OAAO,yBAAa,IAAI,yBAAa,IAAI;AAEvG,MAAM,WAAqB,CAAC,yBAAa,IAAI,yBAAa,IAAI;AAE9D,MAAM,mCAAmC,CAAK;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA8E;AAC5E,MAAI,SAAS,SAAS,MAAM,IAAI,KAAK,CAAC;AAAQ,WAAO;AAErD,QAAM,aAAa,eAAe,KAAK,CAAC,SAAS,KAAK,QAAQ,OAAO,EAAE;AAEvE,QAAM,cAAoC,CAAC;AAG3C,sBAAoB,QAAQ,CAAC,cAAc;AACzC,QAAI,WAAW,UAAU;AACvB;AAAA,IACF;AACA,UAAM,OAAO,WAAW,KAAK;AAC7B,QAAI,CAAC,MAAM;AACT;AAAA,IACF;AACA,UAAM,aAAa,eAAe,KAAK,CAAC,SAAS,KAAK,QAAQ,UAAU,EAAE,GAAG;AAC7E,QAAI,eAAe,YAAY;AAAU;AACzC,UAAM,WAAO,2BAAc,IAAI;AAC/B,QAAI,MAAM,SAAS,yBAAa,QAAQ,cAAc,OAAO,KAAK,OAAO,KAAK,QAAQ,GAAG;AACvF,kBAAY,KAAK,SAAS;AAAA,IAC5B,WAAW,MAAM,SAAS,yBAAa,SAAS,cAAc,OAAO,KAAK,MAAM;AAC9E,kBAAY,KAAK,SAAS;AAAA,IAC5B;AAAA,EACF,CAAC;AAED,QAAM,kBAAc,4BAAe;AAAA,IACjC,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,EACtB,CAAC;AAED,QAAM,YAAY,YAAY,SAAS,IAAI,YAAY,GAAG,KAAK;AAE/D,MAAI,CAAC;AAAW,WAAO;AAEvB,QAAM,4BAA4B,oBAAoB,IAAI,SAAS,GAAG,MAAM;AAC5E,QAAM,2BAA2B,oBAAoB,IAAI,QAAQ,EAAE,GAAG,MAAM;AAE5E,MAAI,CAAC,6BAA6B,CAAC;AAA0B,WAAO;AAEpE,QAAM,kBAAc,2BAAc,yBAAyB;AAC3D,QAAM,iBAAa,2BAAc,wBAAwB;AAEzD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG,YAAY,QAAQ,YAAY,QAAQ,cAAc,SAAS,KAAK,YAAY,OAAO,WAAW,OAAO,KAAK;AAAA,EACnH;AACF;AAEO,MAAM,kCAEmB,CAAC,YAAY;AAC3C,QAAM,OAAiC,CACrC,OACA,EAAE,oBAAoB,SAAS,EAAE,QAAQ,eAAe,qBAAqB,eAAe,EAAE,MAC3F;AACH,QAAI,WAAW,SAAS,MAAM,IAAI,GAAG;AACnC,YAAM,eAAe;AACrB,UAAI,CAAC,eAAe;AAClB,eAAO;AAAA,MACT;AAEA,YAAM,EAAE,gBAAgB,gBAAgB,IAAI,QAAQ;AAEpD,YAAM,OAAO;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEA,UAAI;AAAiB,eAAO,iCAAiC,IAAI;AACjE,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import type { KeyboardCoordinateGetter, DroppableContainer } from '@dnd-kit/core';\nimport { closestCorners, getClientRect, KeyboardCode } from '@dnd-kit/core';\nimport type { Coordinates } from '@dnd-kit/core/dist/types';\nimport type { DnDKitHierarchy } from './types.js';\n\nconst directions: string[] = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];\n\nconst vertical: string[] = [KeyboardCode.Up, KeyboardCode.Down];\n\nconst getHorizontalKeyboardCoordinates = <T,>({\n flattenedItems,\n active,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n droppableRects,\n}: DnDKitHierarchy.GetKeyboardCoordinatesArgs<T>): Coordinates | undefined => {\n if (vertical.includes(event.code) || !active) return undefined;\n\n const activeItem = flattenedItems.find((item) => item.uid === active.id);\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) {\n return;\n }\n const node = container?.node.current;\n if (!node) {\n return;\n }\n const itemParent = flattenedItems.find((item) => item.uid === container.id)?.parentId;\n if (itemParent !== activeItem?.parentId) return;\n const rect = getClientRect(node);\n if (event.code === KeyboardCode.Left && collisionRect.left > rect.left + rect.width - 5) {\n layoutRects.push(container);\n } else if (event.code === KeyboardCode.Right && collisionRect.left < rect.left) {\n layoutRects.push(container);\n }\n });\n\n const sortedRects = closestCorners({\n droppableContainers: layoutRects,\n collisionRect,\n active,\n droppableRects,\n pointerCoordinates: null,\n });\n\n const closestId = sortedRects.length > 0 ? sortedRects[0].id : undefined;\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 = getClientRect(closestDroppableContainer);\n const activeRect = getClientRect(activeDroppableContainer);\n\n return {\n ...currentCoordinates,\n x: closestRect.left + (closestRect.width - collisionRect.width) / 2 + (closestRect.left < activeRect.left ? -2 : 2),\n };\n};\n\nexport const getHierarchyKeyboardCoordinates: <T>(\n context: DnDKitHierarchy.SensorContext<T>,\n) => KeyboardCoordinateGetter = (context) => {\n const func: KeyboardCoordinateGetter = (\n event,\n { currentCoordinates, context: { active, collisionRect, droppableContainers, droppableRects } },\n ) => {\n if (directions.includes(event.code)) {\n event.preventDefault();\n if (!collisionRect) {\n return undefined;\n }\n\n const { flattenedItems, isHorizontalDnD } = context.current;\n\n const args = {\n flattenedItems,\n active,\n event,\n currentCoordinates,\n droppableContainers,\n droppableRects,\n collisionRect,\n };\n\n if (isHorizontalDnD) return getHorizontalKeyboardCoordinates(args);\n return undefined;\n }\n return undefined;\n };\n return func;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,kBAA4D;AAI5D,MAAM,aAAuB,CAAC,yBAAa,MAAM,yBAAa,OAAO,yBAAa,IAAI,yBAAa,IAAI;AAEvG,MAAM,WAAqB,CAAC,yBAAa,IAAI,yBAAa,IAAI;AAE9D,MAAM,mCAAmC,CAAK;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA8E;AAC5E,MAAI,SAAS,SAAS,MAAM,IAAI,KAAK,CAAC;AAAQ,WAAO;AAErD,QAAM,aAAa,eAAe,KAAK,CAAC,SAAS,KAAK,QAAQ,OAAO,EAAE;AAEvE,QAAM,cAAoC,CAAC;AAG3C,sBAAoB,QAAQ,CAAC,cAAc;AACzC,QAAI,WAAW,UAAU;AACvB;AAAA,IACF;AACA,UAAM,OAAO,WAAW,KAAK;AAC7B,QAAI,CAAC,MAAM;AACT;AAAA,IACF;AACA,UAAM,aAAa,eAAe,KAAK,CAAC,SAAS,KAAK,QAAQ,UAAU,EAAE,GAAG;AAC7E,QAAI,eAAe,YAAY;AAAU;AACzC,UAAM,WAAO,2BAAc,IAAI;AAC/B,QAAI,MAAM,SAAS,yBAAa,QAAQ,cAAc,OAAO,KAAK,OAAO,KAAK,QAAQ,GAAG;AACvF,kBAAY,KAAK,SAAS;AAAA,IAC5B,WAAW,MAAM,SAAS,yBAAa,SAA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
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
17
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
18
22
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
19
23
  mod
20
24
  ));
@@ -22,6 +26,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
26
  var hierarchy_exports = {};
23
27
  module.exports = __toCommonJS(hierarchy_exports);
24
28
  var React = __toESM(require("react"));
25
- __reExport(hierarchy_exports, require("./useHierarchyDndkitConfig"), module.exports);
26
- __reExport(hierarchy_exports, require("./types"), module.exports);
29
+ __reExport(hierarchy_exports, require("./useHierarchyDndkitConfig.js"), module.exports);
30
+ __reExport(hierarchy_exports, require("./types.js"), module.exports);
27
31
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hierarchy/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export * from './useHierarchyDndkitConfig';\nexport * from './types';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAc,uCAAd;AACA,8BAAc,oBADd;",
4
+ "sourcesContent": ["export * from './useHierarchyDndkitConfig.js';\nexport * from './types.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAc,0CAAd;AACA,8BAAc,uBADd;",
6
6
  "names": []
7
7
  }
@@ -14,6 +14,10 @@ var __copyProps = (to, from, except, desc) => {
14
14
  return to;
15
15
  };
16
16
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
17
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
22
  mod
19
23
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hierarchy/types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["import type {\n Active,\n Announcements,\n CollisionDetection,\n DragEndEvent,\n DragMoveEvent,\n DragStartEvent,\n MeasuringConfiguration,\n Modifier,\n SensorDescriptor,\n SensorOptions,\n ClientRect,\n} from '@dnd-kit/core';\nimport type { DroppableContainers, RectMap } from '@dnd-kit/core/dist/store';\nimport type { Coordinates, DragCancelEvent, UniqueIdentifier } from '@dnd-kit/core/dist/types';\nimport type { MutableRefObject } from 'react';\n\nexport namespace DnDKitHierarchy {\n export type Item<T> = {\n uid: UniqueIdentifier;\n parentId: UniqueIdentifier | null;\n realIndex: number;\n original: T;\n };\n\n type OnDragStart = (e: DragStartEvent) => void;\n type OnDragMove = (e: DragMoveEvent) => void;\n type OnDragEnd = (e: DragEndEvent) => void;\n type OnDragCancel = (e: DragCancelEvent) => void;\n\n export type OnReorder<T> = (active: Item<T>, indexes: { targetIndex: number; fromIndex: number }) => void;\n\n // =============================================================================\n // PREVIEW HANDLERS HOOK ARGUMENTS AND RETURN TYPES\n // =============================================================================\n\n export type UseHierarchyPreviewHandlersArgs = {\n setActive: React.Dispatch<React.SetStateAction<Active | null>>;\n onPreviewResetState: () => void;\n onPreviewDragStart: () => void;\n };\n\n export type UseHierarchyPreviewHandlersReturn = {\n handlePreviewDragStart: OnDragStart;\n handlePreviewDragMove: OnDragMove;\n handlePreviewDragEnd: OnDragEnd;\n handlePreviewDragCancel: OnDragCancel;\n };\n\n // =============================================================================\n // ACTION HANDLERS HOOK ARGUMENTS AND RETURN TYPES\n // =============================================================================\n\n export type UseHierarchyActionHandlersArgs<T> = UseHierarchyPreviewHandlersReturn & {\n flattenedItems: Item<T>[];\n onReorder: OnReorder<T>;\n };\n\n export type UseHierarchyActionHandlersReturn = {\n onDragStart: OnDragStart;\n onDragMove: OnDragMove;\n onDragEnd: OnDragEnd;\n onDragCancel: OnDragCancel;\n };\n\n // =============================================================================\n // DND, SORTABLE AND SENSOR CONTEXT PROPS TYPES\n // =============================================================================\n\n export type DndContextPropsType = {\n accessibility: { announcements: Announcements; container: HTMLElement };\n modifiers: Modifier[];\n sensors: SensorDescriptor<SensorOptions>[];\n measuring: Partial<MeasuringConfiguration>;\n collisionDetection: CollisionDetection;\n onDragStart: OnDragStart;\n onDragMove: OnDragMove;\n onDragEnd: OnDragEnd;\n onDragCancel: OnDragCancel;\n };\n\n export type SensorContext<T> = MutableRefObject<{\n flattenedItems: Item<T>[];\n isHorizontalDnD: boolean;\n active: Active | null;\n itemsDictionary: Record<UniqueIdentifier, Item<T>>;\n }>;\n\n // =============================================================================\n // KEYBOARD GETTER TYPE\n // =============================================================================\n\n export type GetKeyboardCoordinatesArgs<T> = {\n flattenedItems: Item<T>[];\n active: Active | null;\n event: KeyboardEvent;\n currentCoordinates: Coordinates;\n droppableContainers: DroppableContainers;\n collisionRect: ClientRect;\n droppableRects: RectMap;\n };\n\n // =============================================================================\n // TREE DNDKIT HOOK ARGUMENTS AND RETURN TYPES\n // =============================================================================\n\n export type UseHierarchyDndkitConfigArgs<T> = {\n flattenedItems: Item<T>[];\n onReorder: OnReorder<T>;\n isHorizontalDnD?: boolean;\n onPreviewResetState?: () => void;\n onPreviewDragStart?: () => void;\n };\n\n export type UseHierarchyDndkitConfigReturn = {\n dndContextProps: DndContextPropsType;\n activeId: UniqueIdentifier | null;\n activeIndex: number | null;\n };\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
6
6
  "names": []
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hierarchy/useHierarchyActionHandlers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useCallback } from 'react';\nimport type { DragStartEvent, DragMoveEvent, DragEndEvent, DragCancelEvent } from '@dnd-kit/core';\nimport type { DnDKitHierarchy } from './types';\n\nexport const useHierarchyActionHandlers = <T,>({\n handlePreviewDragStart,\n handlePreviewDragMove,\n handlePreviewDragEnd,\n handlePreviewDragCancel,\n onReorder,\n flattenedItems,\n}: DnDKitHierarchy.UseHierarchyActionHandlersArgs<T>): DnDKitHierarchy.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 = flattenedItems.findIndex((item) => item.uid === active.id);\n const overIndex = flattenedItems.findIndex((item) => item.uid === over.id);\n\n onReorder(flattenedItems[activeIndex], {\n targetIndex: overIndex,\n fromIndex: activeIndex,\n });\n }\n },\n [handlePreviewDragEnd, flattenedItems, 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;AAAA;ACAA,YAAuB;ADAvB,mBAA4B;AAIrB,MAAM,6BAA6B,CAAK;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA2G;AACzG,QAAM,kBAAc;AAAA,IAClB,CAAC,MAAsB;AACrB,6BAAuB,CAAC;AAAA,IAC1B;AAAA,IACA,CAAC,sBAAsB;AAAA,EACzB;AAEA,QAAM,iBAAa;AAAA,IACjB,CAAC,MAAqB;AACpB,4BAAsB,CAAC;AAAA,IACzB;AAAA,IACA,CAAC,qBAAqB;AAAA,EACxB;AAEA,QAAM,gBAAY;AAAA,IAChB,CAAC,MAAoB;AACnB,2BAAqB,CAAC;AACtB,YAAM,EAAE,QAAQ,KAAK,IAAI;AAEzB,UAAI,CAAC;AAAM;AAEX,UAAI,OAAO,OAAO,KAAK,IAAI;AACzB,cAAM,cAAc,eAAe,UAAU,CAAC,SAAS,KAAK,QAAQ,OAAO,EAAE;AAC7E,cAAM,YAAY,eAAe,UAAU,CAAC,SAAS,KAAK,QAAQ,KAAK,EAAE;AAEzE,kBAAU,eAAe,cAAc;AAAA,UACrC,aAAa;AAAA,UACb,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,CAAC,sBAAsB,gBAAgB,SAAS;AAAA,EAClD;AAEA,QAAM,mBAAe;AAAA,IACnB,CAAC,MAAuB;AACtB,8BAAwB,CAAC;AAAA,IAC3B;AAAA,IACA,CAAC,uBAAuB;AAAA,EAC1B;AAEA,SAAO,EAAE,aAAa,YAAY,WAAW,aAAa;AAC5D;",
4
+ "sourcesContent": ["import { useCallback } from 'react';\nimport type { DragStartEvent, DragMoveEvent, DragEndEvent, DragCancelEvent } from '@dnd-kit/core';\nimport type { DnDKitHierarchy } from './types.js';\n\nexport const useHierarchyActionHandlers = <T,>({\n handlePreviewDragStart,\n handlePreviewDragMove,\n handlePreviewDragEnd,\n handlePreviewDragCancel,\n onReorder,\n flattenedItems,\n}: DnDKitHierarchy.UseHierarchyActionHandlersArgs<T>): DnDKitHierarchy.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 = flattenedItems.findIndex((item) => item.uid === active.id);\n const overIndex = flattenedItems.findIndex((item) => item.uid === over.id);\n\n onReorder(flattenedItems[activeIndex], {\n targetIndex: overIndex,\n fromIndex: activeIndex,\n });\n }\n },\n [handlePreviewDragEnd, flattenedItems, 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;AAAA;ACAA,YAAuB;ADAvB,mBAA4B;AAIrB,MAAM,6BAA6B,CAAK;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA2G;AACzG,QAAM,kBAAc;AAAA,IAClB,CAAC,MAAsB;AACrB,6BAAuB,CAAC;AAAA,IAC1B;AAAA,IACA,CAAC,sBAAsB;AAAA,EACzB;AAEA,QAAM,iBAAa;AAAA,IACjB,CAAC,MAAqB;AACpB,4BAAsB,CAAC;AAAA,IACzB;AAAA,IACA,CAAC,qBAAqB;AAAA,EACxB;AAEA,QAAM,gBAAY;AAAA,IAChB,CAAC,MAAoB;AACnB,2BAAqB,CAAC;AACtB,YAAM,EAAE,QAAQ,KAAK,IAAI;AAEzB,UAAI,CAAC;AAAM;AAEX,UAAI,OAAO,OAAO,KAAK,IAAI;AACzB,cAAM,cAAc,eAAe,UAAU,CAAC,SAAS,KAAK,QAAQ,OAAO,EAAE;AAC7E,cAAM,YAAY,eAAe,UAAU,CAAC,SAAS,KAAK,QAAQ,KAAK,EAAE;AAEzE,kBAAU,eAAe,WAAW,GAAG;AAAA,UACrC,aAAa;AAAA,UACb,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,CAAC,sBAAsB,gBAAgB,SAAS;AAAA,EAClD;AAEA,QAAM,mBAAe;AAAA,IACnB,CAAC,MAAuB;AACtB,8BAAwB,CAAC;AAAA,IAC3B;AAAA,IACA,CAAC,uBAAuB;AAAA,EAC1B;AAEA,SAAO,EAAE,aAAa,YAAY,WAAW,aAAa;AAC5D;",
6
6
  "names": []
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hierarchy/useHierarchyAnnouncements.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type { Announcements, UniqueIdentifier } from '@dnd-kit/core';\nimport { useCallback } from 'react';\nimport type { DnDKitHierarchy } from './types';\n\nexport const useHierarchyAnnouncements = <T,>(\n visibleItemsDictionary: Record<UniqueIdentifier, DnDKitHierarchy.Item<T>>,\n): Announcements => {\n const onDragStart: Announcements['onDragStart'] = useCallback(\n ({ active: { id } }) => `Picked up draggable item from position ${visibleItemsDictionary[id].realIndex + 1}.`,\n [visibleItemsDictionary],\n );\n\n const onDragMove: Announcements['onDragOver'] = useCallback(\n ({ over }) => {\n if (over) {\n const overIndex = visibleItemsDictionary[over.id].realIndex + 1;\n return `Draggable item was moved to position ${overIndex}.`;\n }\n\n return `Draggable item is no longer over a droppable area.`;\n },\n [visibleItemsDictionary],\n );\n\n const onDragOver: Announcements['onDragOver'] = onDragMove;\n\n const onDragEnd: Announcements['onDragEnd'] = useCallback(\n ({ over }) => {\n if (over) {\n const overIndex = visibleItemsDictionary[over.id].realIndex + 1;\n return `Draggable item was dropped over position ${overIndex}.`;\n }\n\n return `Draggable item was dropped at it's original position.`;\n },\n [visibleItemsDictionary],\n );\n\n const onDragCancel: Announcements['onDragCancel'] = useCallback(\n ({ active: { id } }) =>\n `Dragging was cancelled. Draggable item from position ${\n visibleItemsDictionary[id].realIndex + 1\n } was dropped at it's initial position.`,\n [visibleItemsDictionary],\n );\n\n return { onDragStart, onDragOver, onDragMove, onDragEnd, onDragCancel };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA4B;AAGrB,MAAM,4BAA4B,CACvC,2BACkB;AAClB,QAAM,kBAA4C;AAAA,IAChD,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,0CAA0C,uBAAuB,IAAI,YAAY;AAAA,IACzG,CAAC,sBAAsB;AAAA,EACzB;AAEA,QAAM,iBAA0C;AAAA,IAC9C,CAAC,EAAE,KAAK,MAAM;AACZ,UAAI,MAAM;AACR,cAAM,YAAY,uBAAuB,KAAK,IAAI,YAAY;AAC9D,eAAO,wCAAwC;AAAA,MACjD;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,sBAAsB;AAAA,EACzB;AAEA,QAAM,aAA0C;AAEhD,QAAM,gBAAwC;AAAA,IAC5C,CAAC,EAAE,KAAK,MAAM;AACZ,UAAI,MAAM;AACR,cAAM,YAAY,uBAAuB,KAAK,IAAI,YAAY;AAC9D,eAAO,4CAA4C;AAAA,MACrD;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,sBAAsB;AAAA,EACzB;AAEA,QAAM,mBAA8C;AAAA,IAClD,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAChB,wDACE,uBAAuB,IAAI,YAAY;AAAA,IAE3C,CAAC,sBAAsB;AAAA,EACzB;AAEA,SAAO,EAAE,aAAa,YAAY,YAAY,WAAW,aAAa;AACxE;",
4
+ "sourcesContent": ["import type { Announcements, UniqueIdentifier } from '@dnd-kit/core';\nimport { useCallback } from 'react';\nimport type { DnDKitHierarchy } from './types.js';\n\nexport const useHierarchyAnnouncements = <T,>(\n visibleItemsDictionary: Record<UniqueIdentifier, DnDKitHierarchy.Item<T>>,\n): Announcements => {\n const onDragStart: Announcements['onDragStart'] = useCallback(\n ({ active: { id } }) => `Picked up draggable item from position ${visibleItemsDictionary[id].realIndex + 1}.`,\n [visibleItemsDictionary],\n );\n\n const onDragMove: Announcements['onDragOver'] = useCallback(\n ({ over }) => {\n if (over) {\n const overIndex = visibleItemsDictionary[over.id].realIndex + 1;\n return `Draggable item was moved to position ${overIndex}.`;\n }\n\n return `Draggable item is no longer over a droppable area.`;\n },\n [visibleItemsDictionary],\n );\n\n const onDragOver: Announcements['onDragOver'] = onDragMove;\n\n const onDragEnd: Announcements['onDragEnd'] = useCallback(\n ({ over }) => {\n if (over) {\n const overIndex = visibleItemsDictionary[over.id].realIndex + 1;\n return `Draggable item was dropped over position ${overIndex}.`;\n }\n\n return `Draggable item was dropped at it's original position.`;\n },\n [visibleItemsDictionary],\n );\n\n const onDragCancel: Announcements['onDragCancel'] = useCallback(\n ({ active: { id } }) =>\n `Dragging was cancelled. Draggable item from position ${\n visibleItemsDictionary[id].realIndex + 1\n } was dropped at it's initial position.`,\n [visibleItemsDictionary],\n );\n\n return { onDragStart, onDragOver, onDragMove, onDragEnd, onDragCancel };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA4B;AAGrB,MAAM,4BAA4B,CACvC,2BACkB;AAClB,QAAM,kBAA4C;AAAA,IAChD,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,0CAA0C,uBAAuB,EAAE,EAAE,YAAY;AAAA,IACzG,CAAC,sBAAsB;AAAA,EACzB;AAEA,QAAM,iBAA0C;AAAA,IAC9C,CAAC,EAAE,KAAK,MAAM;AACZ,UAAI,MAAM;AACR,cAAM,YAAY,uBAAuB,KAAK,EAAE,EAAE,YAAY;AAC9D,eAAO,wCAAwC;AAAA,MACjD;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,sBAAsB;AAAA,EACzB;AAEA,QAAM,aAA0C;AAEhD,QAAM,gBAAwC;AAAA,IAC5C,CAAC,EAAE,KAAK,MAAM;AACZ,UAAI,MAAM;AACR,cAAM,YAAY,uBAAuB,KAAK,EAAE,EAAE,YAAY;AAC9D,eAAO,4CAA4C;AAAA,MACrD;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,sBAAsB;AAAA,EACzB;AAEA,QAAM,mBAA8C;AAAA,IAClD,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAChB,wDACE,uBAAuB,EAAE,EAAE,YAAY;AAAA,IAE3C,CAAC,sBAAsB;AAAA,EACzB;AAEA,SAAO,EAAE,aAAa,YAAY,YAAY,WAAW,aAAa;AACxE;",
6
6
  "names": []
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -30,11 +34,11 @@ module.exports = __toCommonJS(useHierarchyDndkitConfig_exports);
30
34
  var React = __toESM(require("react"));
31
35
  var import_react = require("react");
32
36
  var import_core = require("@dnd-kit/core");
33
- var import_useHierarchyActionHandlers = require("./useHierarchyActionHandlers");
34
- var import_useHierarchyPreviewHandlers = require("./useHierarchyPreviewHandlers");
35
- var import_getHierarchyKeyboardCoordinates = require("./getHierarchyKeyboardCoordinates");
36
- var import_customCollisionDetection = require("./customCollisionDetection");
37
- var import_useHierarchyAnnouncements = require("./useHierarchyAnnouncements");
37
+ var import_useHierarchyActionHandlers = require("./useHierarchyActionHandlers.js");
38
+ var import_useHierarchyPreviewHandlers = require("./useHierarchyPreviewHandlers.js");
39
+ var import_getHierarchyKeyboardCoordinates = require("./getHierarchyKeyboardCoordinates.js");
40
+ var import_customCollisionDetection = require("./customCollisionDetection.js");
41
+ var import_useHierarchyAnnouncements = require("./useHierarchyAnnouncements.js");
38
42
  const adjustTranslate = (isHorizontalDnD) => {
39
43
  const func = ({ transform }) => {
40
44
  const newTransform = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hierarchy/useHierarchyDndkitConfig.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-lines */\nimport { useState, useEffect, useMemo, useRef } from 'react';\nimport type { Active, MeasuringConfiguration, Modifier, UniqueIdentifier } from '@dnd-kit/core';\nimport { useSensor, useSensors, KeyboardSensor, PointerSensor, MeasuringStrategy } from '@dnd-kit/core';\nimport { useHierarchyActionHandlers } from './useHierarchyActionHandlers';\nimport { useHierarchyPreviewHandlers } from './useHierarchyPreviewHandlers';\nimport type { DnDKitHierarchy } from './types';\nimport { getHierarchyKeyboardCoordinates } from './getHierarchyKeyboardCoordinates';\nimport { customCollisionDetection } from './customCollisionDetection';\nimport { useHierarchyAnnouncements } from './useHierarchyAnnouncements';\n\n// we make space for the drop indicator\n// if second parameter is true, the space will be done on the horizontal axis\nconst adjustTranslate = (isHorizontalDnD: boolean): Modifier => {\n const func: Modifier = ({ transform }) => {\n const newTransform = {\n ...transform,\n };\n if (isHorizontalDnD) {\n newTransform.y = transform.y + 15;\n } else {\n newTransform.y = transform.y - 35;\n }\n return newTransform;\n };\n return func;\n};\n\nconst measuring: Partial<MeasuringConfiguration> = {\n droppable: {\n strategy: MeasuringStrategy.Always,\n },\n};\n\nconst noop = () => null;\n\nexport const useHierarchyDndkitConfig = <T,>({\n flattenedItems,\n onReorder,\n isHorizontalDnD = false,\n onPreviewResetState = noop,\n onPreviewDragStart = noop,\n}: DnDKitHierarchy.UseHierarchyDndkitConfigArgs<T>): DnDKitHierarchy.UseHierarchyDndkitConfigReturn => {\n const [active, setActive] = useState<Active | null>(null);\n\n const itemsDictionary = useMemo(() => {\n const dictionary: Record<UniqueIdentifier, DnDKitHierarchy.Item<T>> = {};\n flattenedItems.forEach((item) => {\n dictionary[item.uid] = item;\n });\n return dictionary;\n }, [flattenedItems]);\n\n const modifiers: Modifier[] = useMemo(() => [adjustTranslate(isHorizontalDnD)], [isHorizontalDnD]);\n\n const sensorContext: DnDKitHierarchy.SensorContext<T> = useRef({\n flattenedItems,\n isHorizontalDnD,\n active,\n itemsDictionary,\n });\n\n useEffect(() => {\n sensorContext.current = {\n flattenedItems,\n isHorizontalDnD,\n active,\n itemsDictionary,\n };\n }, [active, flattenedItems, isHorizontalDnD, itemsDictionary]);\n\n const coordinateGetter = useMemo(() => getHierarchyKeyboardCoordinates(sensorContext), []);\n\n const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, { coordinateGetter }));\n\n const dragPreviewHandlers = useHierarchyPreviewHandlers({\n setActive,\n onPreviewResetState,\n onPreviewDragStart,\n });\n\n const dragActionHandlers = useHierarchyActionHandlers({\n ...dragPreviewHandlers,\n flattenedItems,\n onReorder,\n });\n\n const announcements = useHierarchyAnnouncements(itemsDictionary);\n\n const collisionDetection = useMemo(() => customCollisionDetection(sensorContext), []);\n\n const dndContextProps = useMemo(\n () => ({\n accessibility: {\n announcements,\n container: document.body,\n },\n modifiers,\n sensors,\n measuring,\n collisionDetection,\n ...dragActionHandlers,\n }),\n [announcements, modifiers, sensors, collisionDetection, dragActionHandlers],\n );\n\n return {\n dndContextProps,\n activeId: active?.id ?? null,\n activeIndex: active ? itemsDictionary[active.id]?.realIndex : -1,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAqD;AAErD,kBAAwF;AACxF,wCAA2C;AAC3C,yCAA4C;AAE5C,6CAAgD;AAChD,sCAAyC;AACzC,uCAA0C;AAI1C,MAAM,kBAAkB,CAAC,oBAAuC;AAC9D,QAAM,OAAiB,CAAC,EAAE,UAAU,MAAM;AACxC,UAAM,eAAe;AAAA,MACnB,GAAG;AAAA,IACL;AACA,QAAI,iBAAiB;AACnB,mBAAa,IAAI,UAAU,IAAI;AAAA,IACjC,O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;AAE/D,QAAM,yBAAqB,sBAAQ,UAAM,0DAAyB,aAAa,GAAG,CAAC,CAAC;AAEpF,QAAM,sBAAkB;AAAA,IACtB,OAAO;AAAA,MACL,eAAe;AAAA,QACb;AAAA,QACA,WAAW,SAAS;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA,CAAC,eAAe,WAAW,SAAS,oBAAoB,kBAAkB;AAAA,EAC5E;AAEA,SAAO;AAAA,IACL;AAAA,IACA,UAAU,QAAQ,MAAM;AAAA,IACxB,aAAa,SAAS,gBAAgB,OAAO,KAAK,YAAY;AAAA,EAChE;AACF;",
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport { useState, useEffect, useMemo, useRef } from 'react';\nimport type { Active, MeasuringConfiguration, Modifier, UniqueIdentifier } from '@dnd-kit/core';\nimport { useSensor, useSensors, KeyboardSensor, PointerSensor, MeasuringStrategy } from '@dnd-kit/core';\nimport { useHierarchyActionHandlers } from './useHierarchyActionHandlers.js';\nimport { useHierarchyPreviewHandlers } from './useHierarchyPreviewHandlers.js';\nimport type { DnDKitHierarchy } from './types.js';\nimport { getHierarchyKeyboardCoordinates } from './getHierarchyKeyboardCoordinates.js';\nimport { customCollisionDetection } from './customCollisionDetection.js';\nimport { useHierarchyAnnouncements } from './useHierarchyAnnouncements.js';\n\n// we make space for the drop indicator\n// if second parameter is true, the space will be done on the horizontal axis\nconst adjustTranslate = (isHorizontalDnD: boolean): Modifier => {\n const func: Modifier = ({ transform }) => {\n const newTransform = {\n ...transform,\n };\n if (isHorizontalDnD) {\n newTransform.y = transform.y + 15;\n } else {\n newTransform.y = transform.y - 35;\n }\n return newTransform;\n };\n return func;\n};\n\nconst measuring: Partial<MeasuringConfiguration> = {\n droppable: {\n strategy: MeasuringStrategy.Always,\n },\n};\n\nconst noop = () => null;\n\nexport const useHierarchyDndkitConfig = <T,>({\n flattenedItems,\n onReorder,\n isHorizontalDnD = false,\n onPreviewResetState = noop,\n onPreviewDragStart = noop,\n}: DnDKitHierarchy.UseHierarchyDndkitConfigArgs<T>): DnDKitHierarchy.UseHierarchyDndkitConfigReturn => {\n const [active, setActive] = useState<Active | null>(null);\n\n const itemsDictionary = useMemo(() => {\n const dictionary: Record<UniqueIdentifier, DnDKitHierarchy.Item<T>> = {};\n flattenedItems.forEach((item) => {\n dictionary[item.uid] = item;\n });\n return dictionary;\n }, [flattenedItems]);\n\n const modifiers: Modifier[] = useMemo(() => [adjustTranslate(isHorizontalDnD)], [isHorizontalDnD]);\n\n const sensorContext: DnDKitHierarchy.SensorContext<T> = useRef({\n flattenedItems,\n isHorizontalDnD,\n active,\n itemsDictionary,\n });\n\n useEffect(() => {\n sensorContext.current = {\n flattenedItems,\n isHorizontalDnD,\n active,\n itemsDictionary,\n };\n }, [active, flattenedItems, isHorizontalDnD, itemsDictionary]);\n\n const coordinateGetter = useMemo(() => getHierarchyKeyboardCoordinates(sensorContext), []);\n\n const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, { coordinateGetter }));\n\n const dragPreviewHandlers = useHierarchyPreviewHandlers({\n setActive,\n onPreviewResetState,\n onPreviewDragStart,\n });\n\n const dragActionHandlers = useHierarchyActionHandlers({\n ...dragPreviewHandlers,\n flattenedItems,\n onReorder,\n });\n\n const announcements = useHierarchyAnnouncements(itemsDictionary);\n\n const collisionDetection = useMemo(() => customCollisionDetection(sensorContext), []);\n\n const dndContextProps = useMemo(\n () => ({\n accessibility: {\n announcements,\n container: document.body,\n },\n modifiers,\n sensors,\n measuring,\n collisionDetection,\n ...dragActionHandlers,\n }),\n [announcements, modifiers, sensors, collisionDetection, dragActionHandlers],\n );\n\n return {\n dndContextProps,\n activeId: active?.id ?? null,\n activeIndex: active ? itemsDictionary[active.id]?.realIndex : -1,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AA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UAAM,wEAAgC,aAAa,GAAG,CAAC,CAAC;AAEzF,QAAM,cAAU,4BAAW,uBAAU,yBAAa,OAAG,uBAAU,4BAAgB,EAAE,iBAAiB,CAAC,CAAC;AAEpG,QAAM,0BAAsB,gEAA4B;AAAA,IACtD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,yBAAqB,8DAA2B;AAAA,IACpD,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,oBAAgB,4DAA0B,eAAe;AAE/D,QAAM,yBAAqB,sBAAQ,UAAM,0DAAyB,aAAa,GAAG,CAAC,CAAC;AAEpF,QAAM,sBAAkB;AAAA,IACtB,OAAO;AAAA,MACL,eAAe;AAAA,QACb;AAAA,QACA,WAAW,SAAS;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA,CAAC,eAAe,WAAW,SAAS,oBAAoB,kBAAkB;AAAA,EAC5E;AAEA,SAAO;AAAA,IACL;AAAA,IACA,UAAU,QAAQ,MAAM;AAAA,IACxB,aAAa,SAAS,gBAAgB,OAAO,EAAE,GAAG,YAAY;AAAA,EAChE;AACF;",
6
6
  "names": []
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hierarchy/useHierarchyPreviewHandlers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useCallback } from 'react';\nimport type { DragStartEvent } from '@dnd-kit/core';\nimport type { DnDKitHierarchy } from './types';\n\nexport const useHierarchyPreviewHandlers = ({\n setActive,\n onPreviewResetState,\n onPreviewDragStart,\n}: DnDKitHierarchy.UseHierarchyPreviewHandlersArgs): DnDKitHierarchy.UseHierarchyPreviewHandlersReturn => {\n const resetState = useCallback(() => {\n setActive(null);\n onPreviewResetState();\n\n document.body.style.setProperty('cursor', '');\n }, [setActive, onPreviewResetState]);\n\n const handlePreviewDragStart = useCallback(\n ({ active }: DragStartEvent) => {\n setActive(active);\n document.body.style.setProperty('cursor', 'grabbing');\n onPreviewDragStart();\n },\n [setActive, onPreviewDragStart],\n );\n\n const handlePreviewDragMove = useCallback(() => null, []);\n\n const handlePreviewDragEnd = useCallback(() => {\n resetState();\n }, [resetState]);\n\n const handlePreviewDragCancel = useCallback(() => {\n resetState();\n }, [resetState]);\n\n return {\n handlePreviewDragStart,\n handlePreviewDragMove,\n handlePreviewDragEnd,\n handlePreviewDragCancel,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4B;AAIrB,MAAM,8BAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AACF,MAA0G;AACxG,QAAM,iBAAa,0BAAY,MAAM;AACnC,cAAU,IAAI;AACd,wBAAoB;AAEpB,aAAS,KAAK,MAAM,YAAY,UAAU,EAAE;AAAA,EAC9C,GAAG,CAAC,WAAW,mBAAmB,CAAC;AAEnC,QAAM,6BAAyB;AAAA,IAC7B,CAAC,EAAE,OAAO,MAAsB;AAC9B,gBAAU,MAAM;AAChB,eAAS,KAAK,MAAM,YAAY,UAAU,UAAU;AACpD,yBAAmB;AAAA,IACrB;AAAA,IACA,CAAC,WAAW,kBAAkB;AAAA,EAChC;AAEA,QAAM,4BAAwB,0BAAY,MAAM,MAAM,CAAC,CAAC;AAExD,QAAM,2BAAuB,0BAAY,MAAM;AAC7C,eAAW;AAAA,EACb,GAAG,CAAC,UAAU,CAAC;AAEf,QAAM,8BAA0B,0BAAY,MAAM;AAChD,eAAW;AAAA,EACb,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { useCallback } from 'react';\nimport type { DragStartEvent } from '@dnd-kit/core';\nimport type { DnDKitHierarchy } from './types.js';\n\nexport const useHierarchyPreviewHandlers = ({\n setActive,\n onPreviewResetState,\n onPreviewDragStart,\n}: DnDKitHierarchy.UseHierarchyPreviewHandlersArgs): DnDKitHierarchy.UseHierarchyPreviewHandlersReturn => {\n const resetState = useCallback(() => {\n setActive(null);\n onPreviewResetState();\n\n document.body.style.setProperty('cursor', '');\n }, [setActive, onPreviewResetState]);\n\n const handlePreviewDragStart = useCallback(\n ({ active }: DragStartEvent) => {\n setActive(active);\n document.body.style.setProperty('cursor', 'grabbing');\n onPreviewDragStart();\n },\n [setActive, onPreviewDragStart],\n );\n\n const handlePreviewDragMove = useCallback(() => null, []);\n\n const handlePreviewDragEnd = useCallback(() => {\n resetState();\n }, [resetState]);\n\n const handlePreviewDragCancel = useCallback(() => {\n resetState();\n }, [resetState]);\n\n return {\n handlePreviewDragStart,\n handlePreviewDragMove,\n handlePreviewDragEnd,\n handlePreviewDragCancel,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4B;AAIrB,MAAM,8BAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AACF,MAA0G;AACxG,QAAM,iBAAa,0BAAY,MAAM;AACnC,cAAU,IAAI;AACd,wBAAoB;AAEpB,aAAS,KAAK,MAAM,YAAY,UAAU,EAAE;AAAA,EAC9C,GAAG,CAAC,WAAW,mBAAmB,CAAC;AAEnC,QAAM,6BAAyB;AAAA,IAC7B,CAAC,EAAE,OAAO,MAAsB;AAC9B,gBAAU,MAAM;AAChB,eAAS,KAAK,MAAM,YAAY,UAAU,UAAU;AACpD,yBAAmB;AAAA,IACrB;AAAA,IACA,CAAC,WAAW,kBAAkB;AAAA,EAChC;AAEA,QAAM,4BAAwB,0BAAY,MAAM,MAAM,CAAC,CAAC;AAExD,QAAM,2BAAuB,0BAAY,MAAM;AAC7C,eAAW;AAAA,EACb,GAAG,CAAC,UAAU,CAAC;AAEf,QAAM,8BAA0B,0BAAY,MAAM;AAChD,eAAW;AAAA,EACb,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -15,6 +15,10 @@ var __copyProps = (to, from, except, desc) => {
15
15
  };
16
16
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
17
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
18
22
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
19
23
  mod
20
24
  ));
@@ -22,8 +26,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
26
  var src_exports = {};
23
27
  module.exports = __toCommonJS(src_exports);
24
28
  var React = __toESM(require("react"));
25
- __reExport(src_exports, require("./hierarchy"), module.exports);
26
- __reExport(src_exports, require("./tree"), module.exports);
29
+ __reExport(src_exports, require("./hierarchy/index.js"), module.exports);
30
+ __reExport(src_exports, require("./tree/index.js"), module.exports);
27
31
  __reExport(src_exports, require("@dnd-kit/core"), module.exports);
28
32
  __reExport(src_exports, require("@dnd-kit/sortable"), module.exports);
29
33
  __reExport(src_exports, require("@dnd-kit/modifiers"), module.exports);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export * from './hierarchy';\nexport * from './tree';\n\nexport * from '@dnd-kit/core';\nexport * from '@dnd-kit/sortable';\nexport * from '@dnd-kit/modifiers';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,wBAAd;AACA,wBAAc,mBADd;AAGA,wBAAc,0BAHd;AAIA,wBAAc,8BAJd;AAKA,wBAAc,+BALd;",
4
+ "sourcesContent": ["export * from './hierarchy/index.js';\nexport * from './tree/index.js';\n\nexport * from '@dnd-kit/core';\nexport * from '@dnd-kit/sortable';\nexport * from '@dnd-kit/modifiers';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,iCAAd;AACA,wBAAc,4BADd;AAGA,wBAAc,0BAHd;AAIA,wBAAc,8BAJd;AAKA,wBAAc,+BALd;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "commonjs",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ]
7
+ }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tree/constants.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["export enum DropIndicatorPosition {\n None = 0,\n Before = 1,\n After = 2,\n Inside = 3,\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,8CAAA,UAAO,KAAP;AACA,EAAAA,8CAAA,YAAS,KAAT;AACA,EAAAA,8CAAA,WAAQ,KAAR;AACA,EAAAA,8CAAA,YAAS,KAAT;AAJU,SAAAA;AAAA,GAAA;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,8CAAA,UAAO,KAAP;AACA,EAAAA,8CAAA,YAAS,KAAT;AACA,EAAAA,8CAAA,WAAQ,KAAR;AACA,EAAAA,8CAAA,YAAS,KAAT;AAJU,SAAAA;AAAA,GAAA;",
6
6
  "names": ["DropIndicatorPosition"]
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -28,7 +32,7 @@ __export(customCollisionDetection_exports, {
28
32
  });
29
33
  module.exports = __toCommonJS(customCollisionDetection_exports);
30
34
  var React = __toESM(require("react"));
31
- var import_constants = require("./constants");
35
+ var import_constants = require("./constants.js");
32
36
  const thresholdRatio = 0.75;
33
37
  const insideThreshold = 0.7;
34
38
  const customCollisionDetection = (sensorContext) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tree/customCollisionDetection.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { DropIndicatorPosition } from './constants';\nimport { type CollisionDetection, type DroppableContainer } from '@dnd-kit/core';\nimport type { DnDKitTree } from './types';\n\n// Percentage of height to take into consideration when looking for colliding rects\nconst thresholdRatio = 0.75;\n// Percentage to be inside\nconst insideThreshold = 0.7;\n\nexport const customCollisionDetection = <T,>(sensorContext: DnDKitTree.SensorContext<T>): CollisionDetection => {\n const func: CollisionDetection = ({ droppableContainers, collisionRect }) => {\n const { active, flattenedItemsDictionary, maxDragAndDropLevel, lastPositionRef } = sensorContext.current;\n\n if (!active) return [];\n\n const originalContainer = droppableContainers.find(({ id }) => id === active.id);\n const originalRect = originalContainer?.rect?.current;\n\n // We first check if the item was moved up or down\n // This modifies how to search the matching colliding rect\n let isUp = lastPositionRef.current === 'up';\n if (originalRect) {\n isUp = originalRect.top > collisionRect.top;\n }\n\n const threshold = collisionRect.height * thresholdRatio;\n\n const collidingContainer = droppableContainers.reduce((bestContainer, container) => {\n const rect = container.rect.current;\n if (!rect) return bestContainer;\n const bestContainerTop = bestContainer?.rect?.current?.top ?? 0;\n if (isUp && collisionRect.top + threshold > rect.top && (bestContainer === null || rect.top > bestContainerTop)) {\n return container;\n }\n if (\n !isUp &&\n collisionRect.bottom - threshold < rect.bottom &&\n (bestContainer === null || rect.top < bestContainerTop)\n ) {\n return container;\n }\n return bestContainer;\n }, null as DroppableContainer | null);\n\n // If we didn't find a match, return empty array\n if (collidingContainer === null) {\n return [];\n }\n\n const collidingRect = collidingContainer.rect.current;\n\n if (!collidingRect) return [];\n\n // Calculate the intersection interval\n const [top, bottom] = [\n Math.max(collisionRect.top, collidingRect.top),\n Math.min(collisionRect.top + collisionRect.height, collidingRect.top + collidingRect.height),\n ];\n\n // Calculate the percentage of intersection\n const intersectionPercentage = Math.abs(bottom - top) / Math.min(collisionRect.height, collidingRect.height);\n\n let dropIndicatorPosition = DropIndicatorPosition.None;\n\n if (\n intersectionPercentage > insideThreshold &&\n flattenedItemsDictionary[collidingContainer.id].depth + 1 <= maxDragAndDropLevel &&\n collidingContainer.id !== active.id\n ) {\n dropIndicatorPosition = DropIndicatorPosition.Inside;\n } else {\n dropIndicatorPosition = isUp ? DropIndicatorPosition.Before : DropIndicatorPosition.After;\n }\n\n lastPositionRef.current = isUp ? 'up' : 'down';\n\n // Return the id of the match rectangle\n return [{ id: collidingContainer.id, data: { dropIndicatorPosition } }];\n };\n return func;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,uBAAsC;AAKtC,MAAM,iBAAiB;AAEvB,MAAM,kBAAkB;AAEjB,MAAM,2BAA2B,CAAK,kBAAmE;AAC9G,QAAM,OAA2B,CAAC,EAAE,qBAAqB,cAAc,MAAM;AAC3E,UAAM,EAAE,QAAQ,0BAA0B,qBAAqB,gBAAgB,IAAI,cAAc;AAEjG,QAAI,CAAC;AAAQ,aAAO,CAAC;AAErB,UAAM,oBAAoB,oBAAoB,KAAK,CAAC,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE;AAC/E,UAAM,eAAe,mBAAmB,MAAM;AAI9C,QAAI,OAAO,gBAAgB,YAAY;AACvC,QAAI,cAAc;AAChB,aAAO,aA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sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { DropIndicatorPosition } from './constants.js';\nimport { type CollisionDetection, type DroppableContainer } from '@dnd-kit/core';\nimport type { DnDKitTree } from './types.js';\n\n// Percentage of height to take into consideration when looking for colliding rects\nconst thresholdRatio = 0.75;\n// Percentage to be inside\nconst insideThreshold = 0.7;\n\nexport const customCollisionDetection = <T,>(sensorContext: DnDKitTree.SensorContext<T>): CollisionDetection => {\n const func: CollisionDetection = ({ droppableContainers, collisionRect }) => {\n const { active, flattenedItemsDictionary, maxDragAndDropLevel, lastPositionRef } = sensorContext.current;\n\n if (!active) return [];\n\n const originalContainer = droppableContainers.find(({ id }) => id === active.id);\n const originalRect = originalContainer?.rect?.current;\n\n // We first check if the item was moved up or down\n // This modifies how to search the matching colliding rect\n let isUp = lastPositionRef.current === 'up';\n if (originalRect) {\n isUp = originalRect.top > collisionRect.top;\n }\n\n const threshold = collisionRect.height * thresholdRatio;\n\n const collidingContainer = droppableContainers.reduce((bestContainer, container) => {\n const rect = container.rect.current;\n if (!rect) return bestContainer;\n const bestContainerTop = bestContainer?.rect?.current?.top ?? 0;\n if (isUp && collisionRect.top + threshold > rect.top && (bestContainer === null || rect.top > bestContainerTop)) {\n return container;\n }\n if (\n !isUp &&\n collisionRect.bottom - threshold < rect.bottom &&\n (bestContainer === null || rect.top < bestContainerTop)\n ) {\n return container;\n }\n return bestContainer;\n }, null as DroppableContainer | null);\n\n // If we didn't find a match, return empty array\n if (collidingContainer === null) {\n return [];\n }\n\n const collidingRect = collidingContainer.rect.current;\n\n if (!collidingRect) return [];\n\n // Calculate the intersection interval\n const [top, bottom] = [\n Math.max(collisionRect.top, collidingRect.top),\n Math.min(collisionRect.top + collisionRect.height, collidingRect.top + collidingRect.height),\n ];\n\n // Calculate the percentage of intersection\n const intersectionPercentage = Math.abs(bottom - top) / Math.min(collisionRect.height, collidingRect.height);\n\n let dropIndicatorPosition = DropIndicatorPosition.None;\n\n if (\n intersectionPercentage > insideThreshold &&\n flattenedItemsDictionary[collidingContainer.id].depth + 1 <= maxDragAndDropLevel &&\n collidingContainer.id !== active.id\n ) {\n dropIndicatorPosition = DropIndicatorPosition.Inside;\n } else {\n dropIndicatorPosition = isUp ? DropIndicatorPosition.Before : DropIndicatorPosition.After;\n }\n\n lastPositionRef.current = isUp ? 'up' : 'down';\n\n // Return the id of the match rectangle\n return [{ id: collidingContainer.id, data: { dropIndicatorPosition } }];\n };\n return func;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,uBAAsC;AAKtC,MAAM,iBAAiB;AAEvB,MAAM,kBAAkB;AAEjB,MAAM,2BAA2B,CAAK,kBAAmE;AAC9G,QAAM,OAA2B,CAAC,EAAE,qBAAqB,cAAc,MAAM;AAC3E,UAAM,EAAE,QAAQ,0BAA0B,qBAAqB,gBAAgB,IAAI,cAAc;AAEjG,QAAI,CAAC;AAAQ,aAAO,CAAC;AAErB,UAAM,oBAAoB,oBAAoB,KAAK,CAAC,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE;AAC/E,UAAM,eAAe,mBAAmB,MAAM;AAI9C,QAAI,OAAO,gBAAgB,YAAY;AACvC,QAAI,cAAc;AAChB,aAAO,aAAa,MAAM,cAAc;AAAA,IAC1C;AAEA,UAAM,YAAY,cAAc,SAAS;AAEzC,UAAM,qBAAqB,oBAAoB,OAAO,CAAC,eAAe,cAAc;AAClF,YAAM,OAAO,UAAU,KAAK;AAC5B,UAAI,CAAC;AAAM,eAAO;AAClB,YAAM,mBAAmB,eAAe,MAAM,SAAS,OAAO;AAC9D,UAAI,QAAQ,cAAc,MAAM,YAAY,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,MAAM,mBAAmB;AAC/G,eAAO;AAAA,MACT;AACA,UACE,CAAC,QACD,cAAc,SAAS,YAAY,KAAK,WACvC,kBAAkB,QAAQ,KAAK,MAAM,mBACtC;AACA,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,GAAG,IAAiC;AAGpC,QAAI,uBAAuB,MAAM;AAC/B,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,gBAAgB,mBAAmB,KAAK;AAE9C,QAAI,CAAC;AAAe,aAAO,CAAC;AAG5B,UAAM,CAAC,KAAK,MAAM,IAAI;AAAA,MACpB,KAAK,IAAI,cAAc,KAAK,cAAc,GAAG;AAAA,MAC7C,KAAK,IAAI,cAAc,MAAM,cAAc,QAAQ,cAAc,MAAM,cAAc,MAAM;AAAA,IAC7F;AAGA,UAAM,yBAAyB,KAAK,IAAI,SAAS,GAAG,IAAI,KAAK,IAAI,cAAc,QAAQ,cAAc,MAAM;AAE3G,QAAI,wBAAwB,uCAAsB;AAElD,QACE,yBAAyB,mBACzB,yBAAyB,mBAAmB,EAAE,EAAE,QAAQ,KAAK,uBAC7D,mBAAmB,OAAO,OAAO,IACjC;AACA,8BAAwB,uCAAsB;AAAA,IAChD,OAAO;AACL,8BAAwB,OAAO,uCAAsB,SAAS,uCAAsB;AAAA,IACtF;AAEA,oBAAgB,UAAU,OAAO,OAAO;AAGxC,WAAO,CAAC,EAAE,IAAI,mBAAmB,IAAI,MAAM,EAAE,sBAAsB,EAAE,CAAC;AAAA,EACxE;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -29,7 +33,7 @@ __export(getTreeKeyboardCoordinates_exports, {
29
33
  module.exports = __toCommonJS(getTreeKeyboardCoordinates_exports);
30
34
  var React = __toESM(require("react"));
31
35
  var import_core = require("@dnd-kit/core");
32
- var import_constants = require("./constants");
36
+ var import_constants = require("./constants.js");
33
37
  const directions = [import_core.KeyboardCode.Down, import_core.KeyboardCode.Right, import_core.KeyboardCode.Up, import_core.KeyboardCode.Left];
34
38
  const horizontal = [import_core.KeyboardCode.Left, import_core.KeyboardCode.Right];
35
39
  const getVerticalKeyboardCoordinates = ({
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tree/getTreeKeyboardCoordinates.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable max-params */\n/* eslint-disable complexity */\nimport type { KeyboardCoordinateGetter, DroppableContainer } from '@dnd-kit/core';\nimport { closestCorners, getClientRect, KeyboardCode } from '@dnd-kit/core';\nimport type { Coordinates } from '@dnd-kit/core/dist/types';\nimport type { DnDKitTree } from './types';\nimport { DropIndicatorPosition } from './constants';\n\nconst directions: string[] = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];\n\nconst horizontal: string[] = [KeyboardCode.Left, KeyboardCode.Right];\n\nconst getVerticalKeyboardCoordinates = <T,>({\n flattenedItems,\n active,\n over,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n dropIndicatorPosition,\n maxDragAndDropLevel,\n droppableRects,\n}: DnDKitTree.GetKeyboardCoordinatesArgs<T>): Coordinates | undefined => {\n if (horizontal.includes(event.code)) return undefined;\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 rect = container.rect.current;\n\n // We add and substract 2 just for the sake of avoiding edge cases\n if (rect && event.code === KeyboardCode.Down && collisionRect.top - 2 <= rect.top) {\n layoutRects.push(container);\n } else if (rect && event.code === KeyboardCode.Up && collisionRect.top + 2 >= rect.top) {\n layoutRects.push(container);\n }\n });\n\n // Get the closest rect based on dnd-kit closest-corners algorithm\n const sortedRects = closestCorners({\n collisionRect,\n droppableContainers: layoutRects,\n droppableRects,\n active,\n pointerCoordinates: null,\n });\n\n const closestId = sortedRects.length > 0 ? sortedRects[0].id : undefined;\n\n const closestItem = flattenedItems.find((item) => item.uid === closestId);\n\n const closestElement = droppableContainers.get(closestId)?.node?.current;\n\n // If no rect is closest, do nothing\n if (!closestId || !closestItem || !closestElement) return undefined;\n\n const closestRect = getClientRect(closestElement);\n\n if (event.code === KeyboardCode.Up) {\n // If the drop indicator is inside (or over ourselves)\n // We are gonna go to the before position\n // Else we are gonna go inside the over rect\n if (\n dropIndicatorPosition === DropIndicatorPosition.Inside ||\n closestId === active.id ||\n closestItem.depth + 1 > maxDragAndDropLevel\n ) {\n return {\n ...currentCoordinates,\n y: closestRect.top - collisionRect.height / 2,\n };\n }\n return {\n ...currentCoordinates,\n y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2,\n };\n }\n\n // If the drop indicator is over ourselves and after\n // We need to go inside the next one\n if (closestId === active.id && dropIndicatorPosition === DropIndicatorPosition.After) {\n return {\n ...currentCoordinates,\n y: closestRect.top + collisionRect.height,\n };\n }\n // If the drop indicator is inside, or over ourselves\n // We are gonna go to the after position\n if (\n dropIndicatorPosition === DropIndicatorPosition.Inside ||\n closestId === active.id ||\n closestItem.depth + 1 > maxDragAndDropLevel\n ) {\n return {\n ...currentCoordinates,\n y: closestRect.top + closestRect.height / 2,\n };\n }\n return {\n ...currentCoordinates,\n y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2,\n };\n};\n\nexport const getTreeKeyboardCoordinates: <T>(context: DnDKitTree.SensorContext<T>) => KeyboardCoordinateGetter = (\n context,\n) => {\n const func: KeyboardCoordinateGetter = (\n event,\n { currentCoordinates, context: { over, droppableContainers, droppableRects, active, collisionRect } },\n ) => {\n if (directions.includes(event.code)) {\n if (!over || !active || !collisionRect) return undefined;\n\n const { items: flattenedItems, dropIndicatorPosition, maxDragAndDropLevel, isHorizontalDnD } = context.current;\n\n const args = {\n flattenedItems,\n active,\n over,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n dropIndicatorPosition,\n droppableRects,\n maxDragAndDropLevel,\n };\n\n if (isHorizontalDnD) return undefined;\n\n const newCoords = getVerticalKeyboardCoordinates(args);\n return newCoords;\n }\n return undefined;\n };\n return func;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,kBAA4D;AAG5D,uBAAsC;AAEtC,MAAM,aAAuB,CAAC,yBAAa,MAAM,yBAAa,OAAO,yBAAa,IAAI,yBAAa,IAAI;AAEvG,MAAM,aAAuB,CAAC,yBAAa,MAAM,yBAAa,KAAK;AAEnE,MAAM,iCAAiC,CAAK;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyE;AACvE,MAAI,WAAW,SAAS,MAAM,IAAI;AAAG,WAAO;AAE5C,QAAM,WAAW,KAAK;AAEtB,QAAM,cAAoC,CAAC;AAG3C,sBAAoB,QAAQ,CAAC,cAAc;AACzC,QAAI,WAAW,YAAY,CAAC,UAAU;AACpC;AAAA,IACF;AACA,UAAM,OAAO,UAAU,KAAK;AAG5B,QAAI,QAAQ,MAAM,SAAS,yBAAa,QAAQ,cAAc,MAAM,KAAK,KAAK,KAAK;AACjF,kBAAY,KAAK,SAAS;AAAA,IAC5B,WAAW,QAAQ,MAAM,SAAS,yBAAa,MAAM,cAAc,MAAM,KAAK,KAAK,KAAK;AACtF,kBAAY,KAAK,SAAS;AAAA,IAC5B;AAAA,EACF,CAAC;AAGD,QAAM,kBAAc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AQ,cAAc,EAAE,MACjG;AACH,QAAI,WAAW,SAAS,MAAM,IAAI,GAAG;AACnC,UAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;AAAe,eAAO;AAE/C,YAAM,EAAE,OAAO,gBAAgB,uBAAuB,qBAAqB,gBAAgB,IAAI,QAAQ;AAEvG,YAAM,OAAO;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEA,UAAI;AAAiB,eAAO;AAE5B,YAAM,YAAY,+BAA+B,IAAI;AACrD,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable max-params */\n/* eslint-disable complexity */\nimport type { KeyboardCoordinateGetter, DroppableContainer } from '@dnd-kit/core';\nimport { closestCorners, getClientRect, KeyboardCode } from '@dnd-kit/core';\nimport type { Coordinates } from '@dnd-kit/core/dist/types';\nimport type { DnDKitTree } from './types.js';\nimport { DropIndicatorPosition } from './constants.js';\n\nconst directions: string[] = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];\n\nconst horizontal: string[] = [KeyboardCode.Left, KeyboardCode.Right];\n\nconst getVerticalKeyboardCoordinates = <T,>({\n flattenedItems,\n active,\n over,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n dropIndicatorPosition,\n maxDragAndDropLevel,\n droppableRects,\n}: DnDKitTree.GetKeyboardCoordinatesArgs<T>): Coordinates | undefined => {\n if (horizontal.includes(event.code)) return undefined;\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 rect = container.rect.current;\n\n // We add and substract 2 just for the sake of avoiding edge cases\n if (rect && event.code === KeyboardCode.Down && collisionRect.top - 2 <= rect.top) {\n layoutRects.push(container);\n } else if (rect && event.code === KeyboardCode.Up && collisionRect.top + 2 >= rect.top) {\n layoutRects.push(container);\n }\n });\n\n // Get the closest rect based on dnd-kit closest-corners algorithm\n const sortedRects = closestCorners({\n collisionRect,\n droppableContainers: layoutRects,\n droppableRects,\n active,\n pointerCoordinates: null,\n });\n\n const closestId = sortedRects.length > 0 ? sortedRects[0].id : undefined;\n\n const closestItem = flattenedItems.find((item) => item.uid === closestId);\n\n const closestElement = droppableContainers.get(closestId)?.node?.current;\n\n // If no rect is closest, do nothing\n if (!closestId || !closestItem || !closestElement) return undefined;\n\n const closestRect = getClientRect(closestElement);\n\n if (event.code === KeyboardCode.Up) {\n // If the drop indicator is inside (or over ourselves)\n // We are gonna go to the before position\n // Else we are gonna go inside the over rect\n if (\n dropIndicatorPosition === DropIndicatorPosition.Inside ||\n closestId === active.id ||\n closestItem.depth + 1 > maxDragAndDropLevel\n ) {\n return {\n ...currentCoordinates,\n y: closestRect.top - collisionRect.height / 2,\n };\n }\n return {\n ...currentCoordinates,\n y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2,\n };\n }\n\n // If the drop indicator is over ourselves and after\n // We need to go inside the next one\n if (closestId === active.id && dropIndicatorPosition === DropIndicatorPosition.After) {\n return {\n ...currentCoordinates,\n y: closestRect.top + collisionRect.height,\n };\n }\n // If the drop indicator is inside, or over ourselves\n // We are gonna go to the after position\n if (\n dropIndicatorPosition === DropIndicatorPosition.Inside ||\n closestId === active.id ||\n closestItem.depth + 1 > maxDragAndDropLevel\n ) {\n return {\n ...currentCoordinates,\n y: closestRect.top + closestRect.height / 2,\n };\n }\n return {\n ...currentCoordinates,\n y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2,\n };\n};\n\nexport const getTreeKeyboardCoordinates: <T>(context: DnDKitTree.SensorContext<T>) => KeyboardCoordinateGetter = (\n context,\n) => {\n const func: KeyboardCoordinateGetter = (\n event,\n { currentCoordinates, context: { over, droppableContainers, droppableRects, active, collisionRect } },\n ) => {\n if (directions.includes(event.code)) {\n if (!over || !active || !collisionRect) return undefined;\n\n const { items: flattenedItems, dropIndicatorPosition, maxDragAndDropLevel, isHorizontalDnD } = context.current;\n\n const args = {\n flattenedItems,\n active,\n over,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n dropIndicatorPosition,\n droppableRects,\n maxDragAndDropLevel,\n };\n\n if (isHorizontalDnD) return undefined;\n\n const newCoords = getVerticalKeyboardCoordinates(args);\n return newCoords;\n }\n return undefined;\n };\n return func;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,kBAA4D;AAG5D,uBAAsC;AAEtC,MAAM,aAAuB,CAAC,yBAAa,MAAM,yBAAa,OAAO,yBAAa,IAAI,yBAAa,IAAI;AAEvG,MAAM,aAAuB,CAAC,yBAAa,MAAM,yBAAa,KAAK;AAEnE,MAAM,iCAAiC,CAAK;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyE;AACvE,MAAI,WAAW,SAAS,MAAM,IAAI;AAAG,WAAO;AAE5C,QAAM,WAAW,KAAK;AAEtB,QAAM,cAAoC,CAAC;AAG3C,sBAAoB,QAAQ,CAAC,cAAc;AACzC,QAAI,WAAW,YAAY,CAAC,UAAU;AACpC;AAAA,IACF;AACA,UAAM,OAAO,UAAU,KAAK;AAG5B,QAAI,QAAQ,MAAM,SAAS,yBAAa,QAAQ,cAAc,MAAM,KAAK,KAAK,KAAK;AACjF,kBAAY,KAAK,SAAS;AAAA,IAC5B,WAAW,QAAQ,MAAM,SAAS,yBAAa,MAAM,cAAc,MAAM,KAAK,KAAK,KAAK;AACtF,kBAAY,KAAK,SAAS;AAAA,IAC5B;AAAA,EACF,CAAC;AA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M,qBAAqB,gBAAgB,QAAQ,cAAc,EAAE,MACjG;AACH,QAAI,WAAW,SAAS,MAAM,IAAI,GAAG;AACnC,UAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;AAAe,eAAO;AAE/C,YAAM,EAAE,OAAO,gBAAgB,uBAAuB,qBAAqB,gBAAgB,IAAI,QAAQ;AAEvG,YAAM,OAAO;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEA,UAAI;AAAiB,eAAO;AAE5B,YAAM,YAAY,+BAA+B,IAAI;AACrD,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -19,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
19
19
  };
20
20
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
26
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
27
  mod
24
28
  ));
@@ -29,7 +33,7 @@ __export(tree_exports, {
29
33
  });
30
34
  module.exports = __toCommonJS(tree_exports);
31
35
  var React = __toESM(require("react"));
32
- __reExport(tree_exports, require("./useTreeDndkitConfig"), module.exports);
33
- __reExport(tree_exports, require("./types"), module.exports);
34
- var import_utilities = require("./utilities");
36
+ __reExport(tree_exports, require("./useTreeDndkitConfig.js"), module.exports);
37
+ __reExport(tree_exports, require("./types.js"), module.exports);
38
+ var import_utilities = require("./utilities.js");
35
39
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tree/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export * from './useTreeDndkitConfig';\nexport * from './types';\nexport { removeChildrenOf } from './utilities';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAc,kCAAd;AACA,yBAAc,oBADd;AAEA,uBAAiC;",
4
+ "sourcesContent": ["export * from './useTreeDndkitConfig.js';\nexport * from './types.js';\nexport { removeChildrenOf } from './utilities.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAc,qCAAd;AACA,yBAAc,uBADd;AAEA,uBAAiC;",
6
6
  "names": []
7
7
  }
@@ -14,6 +14,10 @@ var __copyProps = (to, from, except, desc) => {
14
14
  return to;
15
15
  };
16
16
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
17
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
22
  mod
19
23
  ));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tree/types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type {\n Active,\n Announcements,\n CollisionDetection,\n DragCancelEvent,\n DragEndEvent,\n DragMoveEvent,\n DragOverEvent,\n DragStartEvent,\n DroppableContainers,\n MeasuringConfiguration,\n Modifier,\n Over,\n ClientRect,\n UniqueIdentifier,\n SensorDescriptor,\n SensorOptions,\n} from '@dnd-kit/core';\nimport type { SortingStrategy } from '@dnd-kit/sortable';\nimport type { RectMap } from '@dnd-kit/core/dist/store';\nimport type { Coordinates } from '@dnd-kit/core/dist/types';\nimport type { Dispatch, SetStateAction, MutableRefObject } from 'react';\nimport type { DropIndicatorPosition } from './constants';\n\nexport namespace DnDKitTree {\n export type Item<T> = {\n uid: UniqueIdentifier;\n depth: number;\n parentId: UniqueIdentifier | null;\n realIndex: number;\n childrenCount: number;\n original: T;\n };\n\n export type DragEventData = {\n dropIndicatorPosition: DropIndicatorPosition;\n };\n\n type OnDragStart = (e: DragStartEvent) => void;\n type OnDragMove = (e: DragMoveEvent) => void;\n type OnDragOver = (e: DragOverEvent) => void;\n type OnDragEnd = (e: DragEndEvent) => void;\n type OnDragCancel = (e: DragCancelEvent) => void;\n\n export type GetIsDropValid<T> = (\n active: Item<T>,\n over: Item<T>,\n dropIndicatorPosition: 'none' | 'before' | 'after' | 'inside',\n ) => boolean;\n\n export type OnReorder<T> = (\n active: Item<T>,\n targetIndex: number,\n metadata: {\n over: Item<T>;\n fromIndex: number;\n considerExpanding: UniqueIdentifier | null;\n movedData: Item<T>[];\n flattenedItems: Item<T>[];\n },\n ) => void;\n\n // =============================================================================\n // PREVIEW HANDLERS HOOK ARGUMENTS AND RETURN TYPES\n // =============================================================================\n\n export type UseTreePreviewHandlersArgs = {\n setActive: Dispatch<SetStateAction<Active | null>>;\n setOver: Dispatch<SetStateAction<Over | null>>;\n setDropIndicatorPosition: Dispatch<SetStateAction<DropIndicatorPosition>>;\n };\n\n export type UseTreePreviewHandlersReturn = {\n handlePreviewDragStart: OnDragStart;\n handlePreviewDragMove: OnDragMove;\n handlePreviewDragOver: OnDragOver;\n handlePreviewDragEnd: OnDragEnd;\n handlePreviewDragCancel: OnDragCancel;\n };\n\n // =============================================================================\n // ACTION HANDLERS HOOK ARGUMENTS AND RETURN TYPES\n // =============================================================================\n\n export type UseTreeActionHandlersArgs<T> = UseTreePreviewHandlersReturn & {\n dropIndicatorPosition: DropIndicatorPosition;\n flattenedItems: Item<T>[];\n projected: {\n depth: number;\n parentId: UniqueIdentifier | null;\n } | null;\n onReorder: OnReorder<T>;\n isDropValid: boolean;\n };\n\n export type UseTreeActionHandlersReturn = {\n onDragStart: OnDragStart;\n onDragMove: OnDragMove;\n onDragOver: OnDragOver;\n onDragEnd: OnDragEnd;\n onDragCancel: OnDragCancel;\n };\n\n // =============================================================================\n // DND, SORTABLE AND SENSOR CONTEXT PROPS TYPES\n // =============================================================================\n\n export type DndContextPropsType = {\n accessibility: { announcements: Announcements; container: HTMLElement };\n modifiers: Modifier[];\n sensors: SensorDescriptor<SensorOptions>[];\n measuring: Partial<MeasuringConfiguration>;\n collisionDetection: CollisionDetection;\n } & UseTreeActionHandlersReturn;\n\n export type SortableContextPropsType = {\n items: UniqueIdentifier[];\n strategy: SortingStrategy;\n };\n\n export type SensorContext<T> = MutableRefObject<{\n items: Item<T>[];\n dropIndicatorPosition: DropIndicatorPosition;\n isHorizontalDnD: boolean;\n maxDragAndDropLevel: number;\n active: Active | null;\n flattenedItemsDictionary: Record<UniqueIdentifier, Item<T>>;\n lastPositionRef: MutableRefObject<string>;\n }>;\n\n // =============================================================================\n // KEYBOARD GETTER TYPE\n // =============================================================================\n\n export type GetKeyboardCoordinatesArgs<T> = {\n flattenedItems: Item<T>[];\n active: Active;\n over: Over;\n event: KeyboardEvent;\n currentCoordinates: Coordinates;\n droppableRects: RectMap;\n droppableContainers: DroppableContainers;\n collisionRect: ClientRect;\n dropIndicatorPosition: DropIndicatorPosition;\n maxDragAndDropLevel: number;\n };\n\n // =============================================================================\n // TREE DNDKIT HOOK ARGUMENTS AND RETURN TYPES\n // =============================================================================\n\n export type UseTreeConfigArgs<T> = {\n flattenedItems: Item<T>[];\n onReorder: OnReorder<T>;\n isHorizontalDnD?: boolean;\n isExpandable?: boolean;\n getIsDropValid?: GetIsDropValid<T>;\n maxDragAndDropLevel?: number;\n };\n\n export type UseTreeConfigReturn<T> = {\n dndContextProps: DndContextPropsType;\n sortableContextProps: SortableContextPropsType;\n active: Active | null;\n activeItem: DnDKitTree.Item<T> | null;\n over: Over | null;\n overItem: DnDKitTree.Item<T> | null;\n dropIndicatorPosition: DropIndicatorPosition;\n isDropValid: boolean;\n };\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
4
+ "sourcesContent": ["import type {\n Active,\n Announcements,\n CollisionDetection,\n DragCancelEvent,\n DragEndEvent,\n DragMoveEvent,\n DragOverEvent,\n DragStartEvent,\n DroppableContainers,\n MeasuringConfiguration,\n Modifier,\n Over,\n ClientRect,\n UniqueIdentifier,\n SensorDescriptor,\n SensorOptions,\n} from '@dnd-kit/core';\nimport type { SortingStrategy } from '@dnd-kit/sortable';\nimport type { RectMap } from '@dnd-kit/core/dist/store';\nimport type { Coordinates } from '@dnd-kit/core/dist/types';\nimport type { Dispatch, SetStateAction, MutableRefObject } from 'react';\nimport type { DropIndicatorPosition } from './constants.js';\n\nexport namespace DnDKitTree {\n export type Item<T> = {\n uid: UniqueIdentifier;\n depth: number;\n parentId: UniqueIdentifier | null;\n realIndex: number;\n childrenCount: number;\n original: T;\n };\n\n export type DragEventData = {\n dropIndicatorPosition: DropIndicatorPosition;\n };\n\n type OnDragStart = (e: DragStartEvent) => void;\n type OnDragMove = (e: DragMoveEvent) => void;\n type OnDragOver = (e: DragOverEvent) => void;\n type OnDragEnd = (e: DragEndEvent) => void;\n type OnDragCancel = (e: DragCancelEvent) => void;\n\n export type GetIsDropValid<T> = (\n active: Item<T>,\n over: Item<T>,\n dropIndicatorPosition: 'none' | 'before' | 'after' | 'inside',\n ) => boolean;\n\n export type OnReorder<T> = (\n active: Item<T>,\n targetIndex: number,\n metadata: {\n over: Item<T>;\n fromIndex: number;\n considerExpanding: UniqueIdentifier | null;\n movedData: Item<T>[];\n flattenedItems: Item<T>[];\n },\n ) => void;\n\n // =============================================================================\n // PREVIEW HANDLERS HOOK ARGUMENTS AND RETURN TYPES\n // =============================================================================\n\n export type UseTreePreviewHandlersArgs = {\n setActive: Dispatch<SetStateAction<Active | null>>;\n setOver: Dispatch<SetStateAction<Over | null>>;\n setDropIndicatorPosition: Dispatch<SetStateAction<DropIndicatorPosition>>;\n };\n\n export type UseTreePreviewHandlersReturn = {\n handlePreviewDragStart: OnDragStart;\n handlePreviewDragMove: OnDragMove;\n handlePreviewDragOver: OnDragOver;\n handlePreviewDragEnd: OnDragEnd;\n handlePreviewDragCancel: OnDragCancel;\n };\n\n // =============================================================================\n // ACTION HANDLERS HOOK ARGUMENTS AND RETURN TYPES\n // =============================================================================\n\n export type UseTreeActionHandlersArgs<T> = UseTreePreviewHandlersReturn & {\n dropIndicatorPosition: DropIndicatorPosition;\n flattenedItems: Item<T>[];\n projected: {\n depth: number;\n parentId: UniqueIdentifier | null;\n } | null;\n onReorder: OnReorder<T>;\n isDropValid: boolean;\n };\n\n export type UseTreeActionHandlersReturn = {\n onDragStart: OnDragStart;\n onDragMove: OnDragMove;\n onDragOver: OnDragOver;\n onDragEnd: OnDragEnd;\n onDragCancel: OnDragCancel;\n };\n\n // =============================================================================\n // DND, SORTABLE AND SENSOR CONTEXT PROPS TYPES\n // =============================================================================\n\n export type DndContextPropsType = {\n accessibility: { announcements: Announcements; container: HTMLElement };\n modifiers: Modifier[];\n sensors: SensorDescriptor<SensorOptions>[];\n measuring: Partial<MeasuringConfiguration>;\n collisionDetection: CollisionDetection;\n } & UseTreeActionHandlersReturn;\n\n export type SortableContextPropsType = {\n items: UniqueIdentifier[];\n strategy: SortingStrategy;\n };\n\n export type SensorContext<T> = MutableRefObject<{\n items: Item<T>[];\n dropIndicatorPosition: DropIndicatorPosition;\n isHorizontalDnD: boolean;\n maxDragAndDropLevel: number;\n active: Active | null;\n flattenedItemsDictionary: Record<UniqueIdentifier, Item<T>>;\n lastPositionRef: MutableRefObject<string>;\n }>;\n\n // =============================================================================\n // KEYBOARD GETTER TYPE\n // =============================================================================\n\n export type GetKeyboardCoordinatesArgs<T> = {\n flattenedItems: Item<T>[];\n active: Active;\n over: Over;\n event: KeyboardEvent;\n currentCoordinates: Coordinates;\n droppableRects: RectMap;\n droppableContainers: DroppableContainers;\n collisionRect: ClientRect;\n dropIndicatorPosition: DropIndicatorPosition;\n maxDragAndDropLevel: number;\n };\n\n // =============================================================================\n // TREE DNDKIT HOOK ARGUMENTS AND RETURN TYPES\n // =============================================================================\n\n export type UseTreeConfigArgs<T> = {\n flattenedItems: Item<T>[];\n onReorder: OnReorder<T>;\n isHorizontalDnD?: boolean;\n isExpandable?: boolean;\n getIsDropValid?: GetIsDropValid<T>;\n maxDragAndDropLevel?: number;\n };\n\n export type UseTreeConfigReturn<T> = {\n dndContextProps: DndContextPropsType;\n sortableContextProps: SortableContextPropsType;\n active: Active | null;\n activeItem: DnDKitTree.Item<T> | null;\n over: Over | null;\n overItem: DnDKitTree.Item<T> | null;\n dropIndicatorPosition: DropIndicatorPosition;\n isDropValid: boolean;\n };\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
6
6
  "names": []
7
7
  }