@elliemae/ds-drag-and-drop 3.37.2 → 3.38.0-rc.0

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 (31) hide show
  1. package/dist/cjs/parts/DSDragAndDrop/DSDragAndDrop.js +13 -13
  2. package/dist/cjs/parts/DSDragAndDrop/DSDragAndDrop.js.map +2 -2
  3. package/dist/cjs/parts/DSSortableContainer/DSSortableContainer.js +22 -19
  4. package/dist/cjs/parts/DSSortableContainer/DSSortableContainer.js.map +2 -2
  5. package/dist/cjs/parts/DSSortableContainer/config/SortableContainerContext.js +44 -0
  6. package/dist/cjs/parts/DSSortableContainer/config/SortableContainerContext.js.map +7 -0
  7. package/dist/cjs/parts/DSSortableContainer/index.js +2 -1
  8. package/dist/cjs/parts/DSSortableContainer/index.js.map +2 -2
  9. package/dist/cjs/parts/DSSortableContainer/react-desc-prop-types.js.map +1 -1
  10. package/dist/cjs/parts/DSSortableItem/DSSortableItem.js +4 -4
  11. package/dist/cjs/parts/DSSortableItem/DSSortableItem.js.map +2 -2
  12. package/dist/cjs/tree/customCollisionDetection.js +5 -5
  13. package/dist/cjs/tree/customCollisionDetection.js.map +2 -2
  14. package/dist/esm/parts/DSDragAndDrop/DSDragAndDrop.js +10 -15
  15. package/dist/esm/parts/DSDragAndDrop/DSDragAndDrop.js.map +2 -2
  16. package/dist/esm/parts/DSSortableContainer/DSSortableContainer.js +20 -17
  17. package/dist/esm/parts/DSSortableContainer/DSSortableContainer.js.map +2 -2
  18. package/dist/esm/parts/DSSortableContainer/config/SortableContainerContext.js +14 -0
  19. package/dist/esm/parts/DSSortableContainer/config/SortableContainerContext.js.map +7 -0
  20. package/dist/esm/parts/DSSortableContainer/index.js +2 -1
  21. package/dist/esm/parts/DSSortableContainer/index.js.map +2 -2
  22. package/dist/esm/parts/DSSortableContainer/react-desc-prop-types.js.map +1 -1
  23. package/dist/esm/parts/DSSortableItem/DSSortableItem.js +2 -2
  24. package/dist/esm/parts/DSSortableItem/DSSortableItem.js.map +2 -2
  25. package/dist/esm/tree/customCollisionDetection.js +5 -5
  26. package/dist/esm/tree/customCollisionDetection.js.map +2 -2
  27. package/dist/types/parts/DSSortableContainer/DSSortableContainer.d.ts +0 -11
  28. package/dist/types/parts/DSSortableContainer/config/SortableContainerContext.d.ts +13 -0
  29. package/dist/types/parts/DSSortableContainer/index.d.ts +2 -1
  30. package/dist/types/parts/DSSortableContainer/react-desc-prop-types.d.ts +1 -1
  31. package/package.json +7 -7
@@ -36,9 +36,11 @@ var React = __toESM(require("react"));
36
36
  var import_jsx_runtime = require("react/jsx-runtime");
37
37
  var import_react = require("react");
38
38
  var import_react_dom = require("react-dom");
39
- var import__ = require("../../index.js");
40
- var import_DSSortableContainer = require("../DSSortableContainer/index.js");
39
+ var import_modifiers = require("@dnd-kit/modifiers");
41
40
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
41
+ var import_core = require("@dnd-kit/core");
42
+ var import_tree = require("../../tree/index.js");
43
+ var import_SortableContainerContext = require("../DSSortableContainer/config/SortableContainerContext.js");
42
44
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
43
45
  const flatten = (items, parentId = null, depth = 0, container = "root", iteration = { count: 0 }) => items.reduce((acc, item, index) => {
44
46
  acc.push({
@@ -46,7 +48,7 @@ const flatten = (items, parentId = null, depth = 0, container = "root", iteratio
46
48
  uid: item.dsId,
47
49
  childrenCount: item?.subitems?.length || 0,
48
50
  original: item,
49
- realIndex: iteration.count++,
51
+ realIndex: iteration.count + 1,
50
52
  parentId,
51
53
  depth,
52
54
  index,
@@ -76,7 +78,7 @@ const DSDragAndDrop = ({
76
78
  ),
77
79
  [items]
78
80
  );
79
- const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } = (0, import__.useMultiTreeDndkitConfig)({
81
+ const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } = (0, import_tree.useMultiTreeDndkitConfig)({
80
82
  flattenedItems: itemsFlattened,
81
83
  isHorizontalDnD: false,
82
84
  isExpandable: true,
@@ -85,16 +87,14 @@ const DSDragAndDrop = ({
85
87
  getIsDropValid: () => true,
86
88
  ...rest
87
89
  });
88
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.DndContext, { ...dndContextProps, children: [
89
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
90
- import_DSSortableContainer.ContainersContext.Provider,
91
- {
92
- value: { sortableContextProps, dropIndicatorPosition, isDropValid, items: itemsFlattened, onCollapse },
93
- children
94
- }
95
- ),
90
+ const ctx = (0, import_react.useMemo)(
91
+ () => ({ sortableContextProps, dropIndicatorPosition, isDropValid, items: itemsFlattened, onCollapse }),
92
+ [dropIndicatorPosition, isDropValid, itemsFlattened, onCollapse, sortableContextProps]
93
+ );
94
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.DndContext, { ...dndContextProps, children: [
95
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SortableContainerContext.ContainersContext.Provider, { value: ctx, children }),
96
96
  (0, import_react_dom.createPortal)(
97
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DragOverlay, { style: { width: "auto", zIndex: 1001 }, modifiers: [import__.restrictToWindowEdges], children: active ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DragOverlayRenderer, { activeItem: active }) : null }),
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.DragOverlay, { style: { width: "auto", zIndex: 1001 }, modifiers: [import_modifiers.restrictToWindowEdges], children: active ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DragOverlayRenderer, { activeItem: active }) : null }),
98
98
  document.body
99
99
  )
100
100
  ] });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSDragAndDrop/DSDragAndDrop.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-params */\nimport React, { useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n DndContext,\n DragOverlay,\n restrictToWindowEdges,\n useMultiTreeDndkitConfig,\n type UniqueIdentifier,\n} from '../../index.js';\nimport { ContainersContext } from '../DSSortableContainer/index.js';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport type { DSDragAndDropT, Item } from './react-desc-prop-types.js';\nimport { DSDragAndDropPropTypes } from './react-desc-prop-types.js';\n\nconst flatten = <T,>(\n items: Item<T>[],\n parentId: UniqueIdentifier | null = null,\n depth = 0,\n container = 'root',\n iteration = { count: 0 },\n) =>\n items.reduce((acc, item, index) => {\n acc.push({\n ...item,\n uid: item.dsId,\n childrenCount: item?.subitems?.length || 0,\n original: item,\n realIndex: iteration.count++,\n parentId,\n depth,\n index,\n container,\n });\n if (item.subitems?.length > 0 && item.collapsed === false) {\n acc.push(...flatten(item.subitems, item.dsId, depth + 1, container, iteration));\n }\n return acc;\n }, [] as Item<T>[]);\n\nexport const DSDragAndDrop = <T,>({\n items,\n children,\n onReorder,\n onCollapse,\n DragOverlayRenderer,\n maxDragAndDropLevel = 0,\n ...rest\n}: DSDragAndDropT.Props<T>) => {\n const itemsFlattened = useMemo(\n () =>\n Object.keys(items).reduce(\n (acc, container) => {\n acc[container] = flatten(items[container] as Item<T>[], null, 0, container);\n return acc;\n },\n {} as Record<string, Item<T>[]>,\n ),\n [items],\n );\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } =\n useMultiTreeDndkitConfig({\n flattenedItems: itemsFlattened,\n isHorizontalDnD: false,\n isExpandable: true,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid: () => true,\n ...rest,\n });\n\n return (\n <DndContext {...dndContextProps}>\n <ContainersContext.Provider\n value={{ sortableContextProps, dropIndicatorPosition, isDropValid, items: itemsFlattened, onCollapse }}\n >\n {children}\n </ContainersContext.Provider>\n {createPortal(\n <DragOverlay style={{ width: 'auto', zIndex: 1001 }} modifiers={[restrictToWindowEdges]}>\n {active ? <DragOverlayRenderer activeItem={active} /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n};\n\nconst DSDragAndDropWithSchema = describe(DSDragAndDrop);\n\nDSDragAndDropWithSchema.propTypes = DSDragAndDropPropTypes;\n\nexport { DSDragAndDropWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwEnB;AAvEJ,mBAA+B;AAC/B,uBAA6B;AAC7B,eAMO;AACP,iCAAkC;AAClC,8BAAyB;AAEzB,mCAAuC;AAEvC,MAAM,UAAU,CACd,OACA,WAAoC,MACpC,QAAQ,GACR,YAAY,QACZ,YAAY,EAAE,OAAO,EAAE,MAEvB,MAAM,OAAO,CAAC,KAAK,MAAM,UAAU;AACjC,MAAI,KAAK;AAAA,IACP,GAAG;AAAA,IACH,KAAK,KAAK;AAAA,IACV,eAAe,MAAM,UAAU,UAAU;AAAA,IACzC,UAAU;AAAA,IACV,WAAW,UAAU;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,MAAI,KAAK,UAAU,SAAS,KAAK,KAAK,cAAc,OAAO;AACzD,QAAI,KAAK,GAAG,QAAQ,KAAK,UAAU,KAAK,MAAM,QAAQ,GAAG,WAAW,SAAS,CAAC;AAAA,EAChF;AACA,SAAO;AACT,GAAG,CAAC,CAAc;AAEb,MAAM,gBAAgB,CAAK;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB,GAAG;AACL,MAA+B;AAC7B,QAAM,qBAAiB;AAAA,IACrB,MACE,OAAO,KAAK,KAAK,EAAE;AAAA,MACjB,CAAC,KAAK,cAAc;AAClB,YAAI,SAAS,IAAI,QAAQ,MAAM,SAAS,GAAgB,MAAM,GAAG,SAAS;AAC1E,eAAO;AAAA,MACT;AAAA,MACA,CAAC;AAAA,IACH;AAAA,IACF,CAAC,KAAK;AAAA,EACR;AACA,QAAM,EAAE,iBAAiB,sBAAsB,QAAQ,uBAAuB,YAAY,QACxF,mCAAyB;AAAA,IACvB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,gBAAgB,MAAM;AAAA,IACtB,GAAG;AAAA,EACL,CAAC;AAEH,SACE,6CAAC,uBAAY,GAAG,iBACd;AAAA;AAAA,MAAC,6CAAkB;AAAA,MAAlB;AAAA,QACC,OAAO,EAAE,sBAAsB,uBAAuB,aAAa,OAAO,gBAAgB,WAAW;AAAA,QAEpG;AAAA;AAAA,IACH;AAAA,QACC;AAAA,MACC,4CAAC,wBAAY,OAAO,EAAE,OAAO,QAAQ,QAAQ,KAAK,GAAG,WAAW,CAAC,8BAAqB,GACnF,mBAAS,4CAAC,uBAAoB,YAAY,QAAQ,IAAK,MAC1D;AAAA,MACA,SAAS;AAAA,IACX;AAAA,KACF;AAEJ;AAEA,MAAM,8BAA0B,kCAAS,aAAa;AAEtD,wBAAwB,YAAY;",
4
+ "sourcesContent": ["/* eslint-disable max-params */\nimport React, { useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { type UniqueIdentifier } from '@dnd-kit/core/dist/types';\nimport { restrictToWindowEdges } from '@dnd-kit/modifiers';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DragOverlay, DndContext } from '@dnd-kit/core';\nimport { useMultiTreeDndkitConfig } from '../../tree/index.js';\nimport { ContainersContext } from '../DSSortableContainer/config/SortableContainerContext.js';\nimport type { DSDragAndDropT, Item } from './react-desc-prop-types.js';\nimport { DSDragAndDropPropTypes } from './react-desc-prop-types.js';\n\nconst flatten = <T,>(\n items: Item<T>[],\n parentId: UniqueIdentifier | null = null,\n depth = 0,\n container = 'root',\n iteration = { count: 0 },\n) =>\n items.reduce((acc, item, index) => {\n acc.push({\n ...item,\n uid: item.dsId,\n childrenCount: item?.subitems?.length || 0,\n original: item,\n realIndex: iteration.count + 1,\n parentId,\n depth,\n index,\n container,\n });\n if (item.subitems?.length > 0 && item.collapsed === false) {\n acc.push(...flatten(item.subitems, item.dsId, depth + 1, container, iteration));\n }\n return acc;\n }, [] as Item<T>[]);\n\nexport const DSDragAndDrop = <T,>({\n items,\n children,\n onReorder,\n onCollapse,\n DragOverlayRenderer,\n maxDragAndDropLevel = 0,\n ...rest\n}: DSDragAndDropT.Props<T>) => {\n const itemsFlattened = useMemo(\n () =>\n Object.keys(items).reduce(\n (acc, container) => {\n acc[container] = flatten(items[container] as Item<T>[], null, 0, container);\n return acc;\n },\n {} as Record<string, Item<T>[]>,\n ),\n [items],\n );\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } =\n useMultiTreeDndkitConfig({\n flattenedItems: itemsFlattened,\n isHorizontalDnD: false,\n isExpandable: true,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid: () => true,\n ...rest,\n });\n\n const ctx = useMemo(\n () => ({ sortableContextProps, dropIndicatorPosition, isDropValid, items: itemsFlattened, onCollapse }),\n [dropIndicatorPosition, isDropValid, itemsFlattened, onCollapse, sortableContextProps],\n );\n\n return (\n <DndContext {...dndContextProps}>\n <ContainersContext.Provider value={ctx}>{children}</ContainersContext.Provider>\n {createPortal(\n <DragOverlay style={{ width: 'auto', zIndex: 1001 }} modifiers={[restrictToWindowEdges]}>\n {active ? <DragOverlayRenderer activeItem={active} /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n};\n\nconst DSDragAndDropWithSchema = describe(DSDragAndDrop);\n\nDSDragAndDropWithSchema.propTypes = DSDragAndDropPropTypes;\n\nexport { DSDragAndDropWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0EnB;AAzEJ,mBAA+B;AAC/B,uBAA6B;AAE7B,uBAAsC;AAC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AAuB,aAAa,OAAO,gBAAgB,WAAW;AAAA,IACrG,CAAC,uBAAuB,aAAa,gBAAgB,YAAY,oBAAoB;AAAA,EACvF;AAEA,SACE,6CAAC,0BAAY,GAAG,iBACd;AAAA,gDAAC,kDAAkB,UAAlB,EAA2B,OAAO,KAAM,UAAS;AAAA,QACjD;AAAA,MACC,4CAAC,2BAAY,OAAO,EAAE,OAAO,QAAQ,QAAQ,KAAK,GAAG,WAAW,CAAC,sCAAqB,GACnF,mBAAS,4CAAC,uBAAoB,YAAY,QAAQ,IAAK,MAC1D;AAAA,MACA,SAAS;AAAA,IACX;AAAA,KACF;AAEJ;AAEA,MAAM,8BAA0B,kCAAS,aAAa;AAEtD,wBAAwB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -28,10 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var DSSortableContainer_exports = {};
30
30
  __export(DSSortableContainer_exports, {
31
- ContainersContext: () => ContainersContext,
32
31
  DSSortableContainer: () => DSSortableContainer,
33
- DSSortableContainerSchema: () => DSSortableContainerSchema,
34
- createContainerContext: () => createContainerContext
32
+ DSSortableContainerSchema: () => DSSortableContainerSchema
35
33
  });
36
34
  module.exports = __toCommonJS(DSSortableContainer_exports);
37
35
  var React = __toESM(require("react"));
@@ -39,30 +37,35 @@ var import_jsx_runtime = require("react/jsx-runtime");
39
37
  var import_react = __toESM(require("react"));
40
38
  var import_ds_fast_list = require("@elliemae/ds-fast-list");
41
39
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
42
- var import__ = require("../../index.js");
40
+ var import_core = require("@dnd-kit/core");
41
+ var import_sortable = require("@dnd-kit/sortable");
42
+ var import_DSSortableItem = require("../DSSortableItem/index.js");
43
43
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
44
- function createContainerContext() {
45
- return (0, import_react.createContext)({
46
- sortableContextProps: {},
47
- items: {}
48
- });
49
- }
50
- const ContainersContext = createContainerContext();
44
+ var import_SortableContainerContext = require("./config/SortableContainerContext.js");
51
45
  const ContainerItemRenderer = (props) => {
52
- const {
53
- index,
54
- extraItemProps: { items, ItemRenderer, extraItemProps, ...rest }
55
- } = props;
46
+ const { index, extraItemProps } = props;
47
+ if (!extraItemProps) {
48
+ return null;
49
+ }
50
+ const { items, ItemRenderer, ...rest } = extraItemProps;
56
51
  const item = items[index];
57
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSSortableItem, { item, ItemRenderer, extraItemProps, ...rest });
52
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
53
+ import_DSSortableItem.DSSortableItem,
54
+ {
55
+ item,
56
+ ItemRenderer,
57
+ ...rest,
58
+ extraItemProps
59
+ }
60
+ );
58
61
  };
59
62
  const ContainerItemRendererMemoized = import_react.default.memo(ContainerItemRenderer);
60
63
  const DSSortableContainer = (props) => {
61
64
  const { containerId, ItemRenderer, Component, extraItemProps, children } = props;
62
- const { setNodeRef, isOver } = (0, import__.useDroppable)({
65
+ const { setNodeRef, isOver } = (0, import_core.useDroppable)({
63
66
  id: containerId
64
67
  });
65
- const ctx = (0, import_react.useContext)(ContainersContext);
68
+ const ctx = (0, import_react.useContext)(import_SortableContainerContext.ContainersContext);
66
69
  const { sortableContextProps, items } = ctx;
67
70
  const containerSortableContextProps = sortableContextProps[containerId];
68
71
  const render = (0, import_react.useMemo)(() => {
@@ -86,7 +89,7 @@ const DSSortableContainer = (props) => {
86
89
  }
87
90
  return null;
88
91
  }, [ItemRenderer, children, containerId, extraItemProps, items]);
89
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.SortableContext, { ...containerSortableContextProps, id: "container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { innerRef: setNodeRef, isOver, children: render }) });
92
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sortable.SortableContext, { ...containerSortableContextProps, id: "container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { innerRef: setNodeRef, isOver, children: render }) });
90
93
  };
91
94
  const DSSortableContainerSchema = (0, import_ds_props_helpers.describe)(DSSortableContainer);
92
95
  DSSortableContainerSchema.propTypes = import_react_desc_prop_types.DSSortalContainerPropTypes;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSSortableContainer/DSSortableContainer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useContext, createContext, useMemo } from 'react';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { SortableContext, useDroppable, DSSortableItem } from '../../index.js';\nimport type { DSSortableContainerT } from './react-desc-prop-types.js';\nimport { DSSortalContainerPropTypes } from './react-desc-prop-types.js';\nimport type { DnDKitTree } from '../../tree/types.js';\nimport type { ItemRendererPropsT } from '../DSSortableItem/index.js';\n\ninterface ContainerContextT<T> {\n isDropValid?: boolean;\n dropIndicatorPosition?: string;\n sortableContextProps: Record<string, DnDKitTree.SortableContextPropsType>;\n items: Record<string, DSSortableContainerT.Item<T>[]>;\n onCollapse?: (nodeId: string) => void;\n}\n\nexport function createContainerContext<T>() {\n return createContext<ContainerContextT<T>>({\n sortableContextProps: {},\n items: {},\n });\n}\nexport const ContainersContext = createContainerContext();\n\nconst ContainerItemRenderer = <T, K>(props: DSSortableContainerT.ContainerItemRendererT<T, K>) => {\n const {\n index,\n extraItemProps: { items, ItemRenderer, extraItemProps, ...rest },\n } = props;\n const item = items[index];\n return <DSSortableItem item={item} ItemRenderer={ItemRenderer} extraItemProps={extraItemProps} {...rest} />;\n};\n\nconst ContainerItemRendererMemoized = React.memo(ContainerItemRenderer);\n\nexport const DSSortableContainer = <T, K>(props: DSSortableContainerT.Props<T, K>) => {\n const { containerId, ItemRenderer, Component, extraItemProps, children } = props;\n const { setNodeRef, isOver } = useDroppable({\n id: containerId,\n });\n const ctx = useContext(ContainersContext);\n const { sortableContextProps, items } = ctx;\n const containerSortableContextProps = sortableContextProps[containerId];\n\n const render = useMemo(() => {\n if (children) {\n return children;\n }\n if (ItemRenderer) {\n return (\n <DSFastList\n count={items[containerId].length}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n ItemRenderer={ContainerItemRendererMemoized as any}\n extraItemProps={{\n items: items[containerId],\n ItemRenderer: ItemRenderer as React.ComponentType<ItemRendererPropsT<unknown, unknown>>,\n extraItemProps,\n }}\n getId={(index: number | string) => items[containerId][index as number].dsId}\n />\n );\n }\n return null;\n }, [ItemRenderer, children, containerId, extraItemProps, items]);\n\n return (\n <SortableContext {...containerSortableContextProps} id=\"container\">\n <Component innerRef={setNodeRef} isOver={isOver}>\n {render}\n </Component>\n </SortableContext>\n );\n};\n\nconst DSSortableContainerSchema = describe(DSSortableContainer);\nDSSortableContainerSchema.propTypes = DSSortalContainerPropTypes;\n\nexport { DSSortableContainerSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+Bd;AA/BT,mBAA0D;AAC1D,0BAA2B;AAC3B,8BAAyB;AACzB,eAA8D;AAE9D,mCAA2C;AAYpC,SAAS,yBAA4B;AAC1C,aAAO,4BAAoC;AAAA,IACzC,sBAAsB,CAAC;AAAA,IACvB,OAAO,CAAC;AAAA,EACV,CAAC;AACH;AACO,MAAM,oBAAoB,uBAAuB;AAExD,MAAM,wBAAwB,CAAO,UAA6D;AAChG,QAAM;AAAA,IACJ;AAAA,IACA,gBAAgB,EAAE,OAAO,cAAc,gBAAgB,GAAG,KAAK;AAAA,EACjE,IAAI;AACJ,QAAM,OAAO,MAAM,KAAK;AACxB,SAAO,4CAAC,2BAAe,MAAY,cAA4B,gBAAiC,GAAG,MAAM;AAC3G;AAEA,MAAM,gCAAgC,aAAAA,QAAM,KAAK,qBAAqB;AAE/D,MAAM,sBAAsB,CAAO,UAA4C;AACpF,QAAM,EAAE,aAAa,cAAc,WAAW,gBAAgB,SAAS,IAAI;AAC3E,QAAM,EAAE,YAAY,OAAO,QAAI,uBAAa;AAAA,IAC1C,IAAI;AAAA,EACN,CAAC;AACD,QAAM,UAAM,yBAAW,iBAAiB;AACxC,QAAM,EAAE,sBAAsB,MAAM,IAAI;AACxC,QAAM,gCAAgC,qBAAqB,WAAW;AAEtE,QAAM,aAAS,sBAAQ,MAAM;AAC3B,QAAI,UAAU;AACZ,aAAO;AAAA,IACT;AACA,QAAI,cAAc;AAChB,aACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,MAAM,WAAW,EAAE;AAAA,UAE1B,cAAc;AAAA,UACd,gBAAgB;AAAA,YACd,OAAO,MAAM,WAAW;AAAA,YACxB;AAAA,YACA;AAAA,UACF;AAAA,UACA,OAAO,CAAC,UAA2B,MAAM,WAAW,EAAE,KAAe,EAAE;AAAA;AAAA,MACzE;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,GAAG,CAAC,cAAc,UAAU,aAAa,gBAAgB,KAAK,CAAC;AAE/D,SACE,4CAAC,4BAAiB,GAAG,+BAA+B,IAAG,aACrD,sDAAC,aAAU,UAAU,YAAY,QAC9B,kBACH,GACF;AAEJ;AAEA,MAAM,gCAA4B,kCAAS,mBAAmB;AAC9D,0BAA0B,YAAY;",
4
+ "sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useDroppable } from '@dnd-kit/core';\nimport { SortableContext } from '@dnd-kit/sortable';\nimport { DSSortableItem } from '../DSSortableItem/index.js';\nimport type { DSSortableContainerT } from './react-desc-prop-types.js';\nimport { DSSortalContainerPropTypes } from './react-desc-prop-types.js';\nimport type { ItemRendererPropsT } from '../DSSortableItem/index.js';\nimport { ContainersContext } from './config/SortableContainerContext.js';\nimport type { Item } from '../DSDragAndDrop/index.js';\nconst ContainerItemRenderer = <T, K>(props: DSSortableContainerT.ContainerItemRendererT<T, K>) => {\n const { index, extraItemProps } = props;\n if (!extraItemProps) {\n return null;\n }\n const { items, ItemRenderer, ...rest } = extraItemProps;\n const item = items[index];\n return (\n <DSSortableItem\n item={item}\n ItemRenderer={\n ItemRenderer as React.ComponentType<\n ItemRendererPropsT<\n T,\n { items: Item<T>[]; extraItemProps: K; ItemRenderer: React.ComponentType<ItemRendererPropsT<T, K>> }\n >\n >\n }\n {...rest}\n extraItemProps={extraItemProps}\n />\n );\n};\n\nconst ContainerItemRendererMemoized = React.memo(ContainerItemRenderer);\n\nexport const DSSortableContainer = <T, K>(props: DSSortableContainerT.Props<T, K>) => {\n const { containerId, ItemRenderer, Component, extraItemProps, children } = props;\n const { setNodeRef, isOver } = useDroppable({\n id: containerId,\n });\n const ctx = useContext(ContainersContext);\n const { sortableContextProps, items } = ctx;\n const containerSortableContextProps = sortableContextProps[containerId];\n\n const render = useMemo(() => {\n if (children) {\n return children;\n }\n if (ItemRenderer) {\n return (\n <DSFastList\n count={items[containerId].length}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n ItemRenderer={ContainerItemRendererMemoized as any}\n extraItemProps={{\n items: items[containerId],\n ItemRenderer: ItemRenderer as React.ComponentType<ItemRendererPropsT<unknown, unknown>>,\n extraItemProps,\n }}\n getId={(index: number | string) => items[containerId][index as number].dsId}\n />\n );\n }\n return null;\n }, [ItemRenderer, children, containerId, extraItemProps, items]);\n\n return (\n <SortableContext {...containerSortableContextProps} id=\"container\">\n <Component innerRef={setNodeRef} isOver={isOver}>\n {render}\n </Component>\n </SortableContext>\n );\n};\n\nconst DSSortableContainerSchema = describe(DSSortableContainer);\nDSSortableContainerSchema.propTypes = DSSortalContainerPropTypes;\n\nexport { DSSortableContainerSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;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KAAK,CAAC;AAE/D,SACE,4CAAC,mCAAiB,GAAG,+BAA+B,IAAG,aACrD,sDAAC,aAAU,UAAU,YAAY,QAC9B,kBACH,GACF;AAEJ;AAEA,MAAM,gCAA4B,kCAAS,mBAAmB;AAC9D,0BAA0B,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
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.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var SortableContainerContext_exports = {};
30
+ __export(SortableContainerContext_exports, {
31
+ ContainersContext: () => ContainersContext,
32
+ createContainerContext: () => createContainerContext
33
+ });
34
+ module.exports = __toCommonJS(SortableContainerContext_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_react = require("react");
37
+ function createContainerContext() {
38
+ return (0, import_react.createContext)({
39
+ sortableContextProps: {},
40
+ items: {}
41
+ });
42
+ }
43
+ const ContainersContext = createContainerContext();
44
+ //# sourceMappingURL=SortableContainerContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/parts/DSSortableContainer/config/SortableContainerContext.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { createContext } from 'react';\nimport type { DnDKitTree } from '../../../tree/types.js';\nimport type { DSSortableContainerT } from '../react-desc-prop-types.js';\n\ninterface ContainerContextT<T> {\n isDropValid?: boolean;\n dropIndicatorPosition?: string;\n sortableContextProps: Record<string, DnDKitTree.SortableContextPropsType>;\n items: Record<string, DSSortableContainerT.Item<T>[]>;\n onCollapse?: (nodeId: string) => void;\n}\n\nexport function createContainerContext<T>() {\n return createContext<ContainerContextT<T>>({\n sortableContextProps: {},\n items: {},\n });\n}\n\nexport const ContainersContext = createContainerContext();\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAYvB,SAAS,yBAA4B;AAC1C,aAAO,4BAAoC;AAAA,IACzC,sBAAsB,CAAC;AAAA,IACvB,OAAO,CAAC;AAAA,EACV,CAAC;AACH;AAEO,MAAM,oBAAoB,uBAAuB;",
6
+ "names": []
7
+ }
@@ -28,11 +28,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var DSSortableContainer_exports = {};
30
30
  __export(DSSortableContainer_exports, {
31
- ContainersContext: () => import_DSSortableContainer.ContainersContext,
31
+ ContainersContext: () => import_SortableContainerContext.ContainersContext,
32
32
  DSSortableContainer: () => import_DSSortableContainer.DSSortableContainer,
33
33
  DSSortableContainerSchema: () => import_DSSortableContainer.DSSortableContainerSchema
34
34
  });
35
35
  module.exports = __toCommonJS(DSSortableContainer_exports);
36
36
  var React = __toESM(require("react"));
37
37
  var import_DSSortableContainer = require("./DSSortableContainer.js");
38
+ var import_SortableContainerContext = require("./config/SortableContainerContext.js");
38
39
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSSortableContainer/index.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export { DSSortableContainer, DSSortableContainerSchema, ContainersContext } from './DSSortableContainer.js';\nexport type { DSSortableContainerT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAAkF;",
4
+ "sourcesContent": ["export { DSSortableContainer, DSSortableContainerSchema } from './DSSortableContainer.js';\nexport { ContainersContext } from './config/SortableContainerContext.js';\nexport type { DSSortableContainerT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAA+D;AAC/D,sCAAkC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSSortableContainer/react-desc-prop-types.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\n/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport type { UniqueIdentifier } from '@dnd-kit/core/dist/types';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport type { DnDKitTree } from '../../tree/types.js';\nimport type { ItemRendererPropsT } from '../DSSortableItem/index.js';\nexport declare namespace DSSortableContainerT {\n export interface WrapperComponentProps {\n innerRef: React.MutableRefObject<HTMLDivElement | null> | ((ref: HTMLDivElement | null) => void);\n isOver: boolean;\n children: React.ReactNode;\n }\n export interface RequiredProps {\n containerId: UniqueIdentifier;\n Component: React.ComponentType<WrapperComponentProps>;\n }\n\n export interface ContainerItemRendererT<T, K> {\n extraItemProps: {\n items: Item<T>[];\n extraItemProps: K;\n ItemRenderer: React.ComponentType<ItemRendererPropsT<T, K>>;\n };\n index: number;\n }\n\n export type ItemProp<T> = {\n dsId: number | string;\n subitems: ItemProp<T>[];\n } & T;\n\n // opinionated item type\n export type Item<T> = DnDKitTree.Item<T> & {\n dsId: number | string;\n subitems: Item<T>[];\n } & T;\n\n export interface DefaultProps {}\n\n export interface OptionalProps<T, K> {\n items?: Record<string, Item<T>[]>;\n extraItemProps?: K;\n ItemRenderer?: React.ComponentType<ItemRendererPropsT<T, K>>;\n children?: React.ReactNode;\n }\n\n export interface Props<T, K> extends Partial<DefaultProps>, OptionalProps<T, K>, XstyledProps, RequiredProps {}\n\n export interface InternalProps<T, K> extends DefaultProps, OptionalProps<T, K>, XstyledProps, RequiredProps {}\n}\n\nexport const DSSortalContainerPropTypes = {\n containerId: PropTypes.string.description('The id of the container').isRequired,\n Component: PropTypes.node.description('The component to be rendered as the container').isRequired,\n children: PropTypes.node.description('The children to be rendered in the container'),\n items: PropTypes.object.description('The items to be rendered in the container'),\n extraItemProps: PropTypes.object.description('The extra item props to be passed to the item renderer'),\n ItemRenderer: PropTypes.node.description('The item renderer to be used'),\n} as React.WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\n/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport type { UniqueIdentifier } from '@dnd-kit/core/dist/types';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport type { DnDKitTree } from '../../tree/types.js';\nimport type { ItemRendererPropsT } from '../DSSortableItem/index.js';\nexport declare namespace DSSortableContainerT {\n export interface WrapperComponentProps {\n innerRef: React.MutableRefObject<HTMLDivElement | null> | ((ref: HTMLDivElement | null) => void);\n isOver: boolean;\n children: React.ReactNode;\n }\n export interface RequiredProps {\n containerId: UniqueIdentifier;\n Component: React.ComponentType<WrapperComponentProps>;\n }\n\n export interface ContainerItemRendererT<T, K> {\n extraItemProps?: {\n items: Item<T>[];\n extraItemProps: K;\n ItemRenderer: React.ComponentType<ItemRendererPropsT<T, K>>;\n };\n index: number;\n }\n\n export type ItemProp<T> = {\n dsId: number | string;\n subitems: ItemProp<T>[];\n } & T;\n\n // opinionated item type\n export type Item<T> = DnDKitTree.Item<T> & {\n dsId: number | string;\n subitems: Item<T>[];\n } & T;\n\n export interface DefaultProps {}\n\n export interface OptionalProps<T, K> {\n items?: Record<string, Item<T>[]>;\n extraItemProps?: K;\n ItemRenderer?: React.ComponentType<ItemRendererPropsT<T, K>>;\n children?: React.ReactNode;\n }\n\n export interface Props<T, K> extends Partial<DefaultProps>, OptionalProps<T, K>, XstyledProps, RequiredProps {}\n\n export interface InternalProps<T, K> extends DefaultProps, OptionalProps<T, K>, XstyledProps, RequiredProps {}\n}\n\nexport const DSSortalContainerPropTypes = {\n containerId: PropTypes.string.description('The id of the container').isRequired,\n Component: PropTypes.node.description('The component to be rendered as the container').isRequired,\n children: PropTypes.node.description('The children to be rendered in the container'),\n items: PropTypes.object.description('The items to be rendered in the container'),\n extraItemProps: PropTypes.object.description('The extra item props to be passed to the item renderer'),\n ItemRenderer: PropTypes.node.description('The item renderer to be used'),\n} as React.WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,8BAA0B;AAgDnB,MAAM,6BAA6B;AAAA,EACxC,aAAa,kCAAU,OAAO,YAAY,yBAAyB,EAAE;AAAA,EACrE,WAAW,kCAAU,KAAK,YAAY,+CAA+C,EAAE;AAAA,EACvF,UAAU,kCAAU,KAAK,YAAY,8CAA8C;AAAA,EACnF,OAAO,kCAAU,OAAO,YAAY,2CAA2C;AAAA,EAC/E,gBAAgB,kCAAU,OAAO,YAAY,wDAAwD;AAAA,EACrG,cAAc,kCAAU,KAAK,YAAY,8BAA8B;AACzE;",
6
6
  "names": []
7
7
  }
@@ -36,12 +36,12 @@ var React = __toESM(require("react"));
36
36
  var import_jsx_runtime = require("react/jsx-runtime");
37
37
  var import_react = require("react");
38
38
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
39
- var import__ = require("../../index.js");
40
- var import_DSSortableContainer = require("../DSSortableContainer/index.js");
39
+ var import_sortable = require("@dnd-kit/sortable");
40
+ var import_SortableContainerContext = require("../DSSortableContainer/config/SortableContainerContext.js");
41
41
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
42
42
  const DSSortableItem = (props) => {
43
43
  const { item, index: userIndex, containerId, ItemRenderer, extraItemProps } = props;
44
- const ctx = (0, import_react.useContext)(import_DSSortableContainer.ContainersContext);
44
+ const ctx = (0, import_react.useContext)(import_SortableContainerContext.ContainersContext);
45
45
  const currentItem = item || (userIndex !== void 0 ? ctx.items[containerId || "root"][userIndex] : void 0);
46
46
  const { isDropValid, dropIndicatorPosition, onCollapse } = ctx;
47
47
  const draggableOptions = (0, import_react.useMemo)(
@@ -50,7 +50,7 @@ const DSSortableItem = (props) => {
50
50
  }),
51
51
  [currentItem]
52
52
  );
53
- const useSortableHelpers = (0, import__.useSortable)(draggableOptions);
53
+ const useSortableHelpers = (0, import_sortable.useSortable)(draggableOptions);
54
54
  const draggableProps = (0, import_react.useMemo)(() => {
55
55
  const { index, overIndex } = useSortableHelpers;
56
56
  return {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSSortableItem/DSSortableItem.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useMemo, useContext } from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\n\nimport { useSortable } from '../../index.js';\nimport { ContainersContext } from '../DSSortableContainer/index.js';\nimport type { DSSortableItemT, DraggablePropsT } from './react-desc-prop-types.js';\nimport { DSSortalItemPropTypes } from './react-desc-prop-types.js';\n\nimport type { Item } from '../DSDragAndDrop/index.js';\nexport const DSSortableItem = <T, K>(props: DSSortableItemT.Props<T, K>) => {\n const { item, index: userIndex, containerId, ItemRenderer, extraItemProps } = props;\n const ctx = useContext(ContainersContext);\n\n const currentItem = item || (userIndex !== undefined ? ctx.items[containerId || 'root'][userIndex] : undefined);\n\n const { isDropValid, dropIndicatorPosition, onCollapse } = ctx;\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: currentItem?.dsId || '',\n }),\n [currentItem],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n const draggableProps: DraggablePropsT = useMemo(() => {\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition: dropIndicatorPosition || 'none',\n isDropValid: isDropValid || false,\n };\n }, [dropIndicatorPosition, isDropValid, useSortableHelpers]);\n\n if (!currentItem) {\n return null;\n }\n return (\n <div ref={draggableProps.setNodeRef} style={{ position: 'relative' }}>\n <ItemRenderer\n item={currentItem as Item<T>}\n draggableProps={draggableProps}\n onCollapse={onCollapse}\n extraItemProps={extraItemProps as K}\n />\n </div>\n );\n};\n\nconst DSSortableItemSchema = describe(DSSortableItem);\n\nDSSortableItemSchema.propTypes = DSSortalItemPropTypes;\n\nexport { DSSortableItemSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2CjB;AA3CN,mBAA2C;AAC3C,8BAAyB;AAEzB,eAA4B;AAC5B,iCAAkC;AAElC,mCAAsC;AAG/B,MAAM,iBAAiB,CAAO,UAAuC;AAC1E,QAAM,EAAE,MAAM,OAAO,WAAW,aAAa,cAAc,eAAe,IAAI;AAC9E,QAAM,UAAM,yBAAW,4CAAiB;AAExC,QAAM,cAAc,SAAS,cAAc,SAAY,IAAI,MAAM,eAAe,MAAM,EAAE,SAAS,IAAI;AAErG,QAAM,EAAE,aAAa,uBAAuB,WAAW,IAAI;AAG3D,QAAM,uBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,aAAa,QAAQ;AAAA,IAC3B;AAAA,IACA,CAAC,WAAW;AAAA,EACd;AAEA,QAAM,yBAAqB,sBAAY,gBAAgB;AAEvD,QAAM,qBAAkC,sBAAQ,MAAM;AACpD,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C,uBAAuB,yBAAyB;AAAA,MAChD,aAAa,eAAe;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,uBAAuB,aAAa,kBAAkB,CAAC;AAE3D,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,EACT;AACA,SACE,4CAAC,SAAI,KAAK,eAAe,YAAY,OAAO,EAAE,UAAU,WAAW,GACjE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF,GACF;AAEJ;AAEA,MAAM,2BAAuB,kCAAS,cAAc;AAEpD,qBAAqB,YAAY;",
4
+ "sourcesContent": ["import React, { useMemo, useContext } from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { ContainersContext } from '../DSSortableContainer/config/SortableContainerContext.js';\nimport type { DSSortableItemT, DraggablePropsT } from './react-desc-prop-types.js';\nimport { DSSortalItemPropTypes } from './react-desc-prop-types.js';\n\nimport type { Item } from '../DSDragAndDrop/index.js';\nexport const DSSortableItem = <T, K>(props: DSSortableItemT.Props<T, K>) => {\n const { item, index: userIndex, containerId, ItemRenderer, extraItemProps } = props;\n const ctx = useContext(ContainersContext);\n\n const currentItem = item || (userIndex !== undefined ? ctx.items[containerId || 'root'][userIndex] : undefined);\n\n const { isDropValid, dropIndicatorPosition, onCollapse } = ctx;\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: currentItem?.dsId || '',\n }),\n [currentItem],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n const draggableProps: DraggablePropsT = useMemo(() => {\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition: dropIndicatorPosition || 'none',\n isDropValid: isDropValid || false,\n };\n }, [dropIndicatorPosition, isDropValid, useSortableHelpers]);\n\n if (!currentItem) {\n return null;\n }\n return (\n <div ref={draggableProps.setNodeRef} style={{ position: 'relative' }}>\n <ItemRenderer\n item={currentItem as Item<T>}\n draggableProps={draggableProps}\n onCollapse={onCollapse}\n extraItemProps={extraItemProps as K}\n />\n </div>\n );\n};\n\nconst DSSortableItemSchema = describe(DSSortableItem);\n\nDSSortableItemSchema.propTypes = DSSortalItemPropTypes;\n\nexport { DSSortableItemSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0CjB;AA1CN,mBAA2C;AAC3C,8BAAyB;AACzB,sBAA4B;AAC5B,sCAAkC;AAElC,mCAAsC;AAG/B,MAAM,iBAAiB,CAAO,UAAuC;AAC1E,QAAM,EAAE,MAAM,OAAO,WAAW,aAAa,cAAc,eAAe,IAAI;AAC9E,QAAM,UAAM,yBAAW,iDAAiB;AAExC,QAAM,cAAc,SAAS,cAAc,SAAY,IAAI,MAAM,eAAe,MAAM,EAAE,SAAS,IAAI;AAErG,QAAM,EAAE,aAAa,uBAAuB,WAAW,IAAI;AAG3D,QAAM,uBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,aAAa,QAAQ;AAAA,IAC3B;AAAA,IACA,CAAC,WAAW;AAAA,EACd;AAEA,QAAM,yBAAqB,6BAAY,gBAAgB;AAEvD,QAAM,qBAAkC,sBAAQ,MAAM;AACpD,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C,uBAAuB,yBAAyB;AAAA,MAChD,aAAa,eAAe;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,uBAAuB,aAAa,kBAAkB,CAAC;AAE3D,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,EACT;AACA,SACE,4CAAC,SAAI,KAAK,eAAe,YAAY,OAAO,EAAE,UAAU,WAAW,GACjE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF,GACF;AAEJ;AAEA,MAAM,2BAAuB,kCAAS,cAAc;AAEpD,qBAAqB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -32,8 +32,8 @@ __export(customCollisionDetection_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(customCollisionDetection_exports);
34
34
  var React = __toESM(require("react"));
35
- var import_constants = require("./constants.js");
36
35
  var import_core = require("@dnd-kit/core");
36
+ var import_constants = require("./constants.js");
37
37
  const insideThreshold = 0.7;
38
38
  const customCollisionDetection = (sensorContext) => {
39
39
  const func = ({ droppableContainers, collisionRect, droppableRects, ...args }) => {
@@ -47,7 +47,7 @@ const customCollisionDetection = (sensorContext) => {
47
47
  });
48
48
  const { id: closestContainerOfContainersId } = rectIntersectionCollisions[0] ?? {};
49
49
  const possibleCollidingContainers = droppableContainers.filter(
50
- (container) => !containersRef.current.includes(container.id) && flattenedItemsDictionary[container.id].container === closestContainerOfContainersId
50
+ (container) => !containersRef.current.includes(container?.id) && flattenedItemsDictionary[container?.id].container === closestContainerOfContainersId
51
51
  );
52
52
  const [collidingContainer, nearesCollidingContainer] = (0, import_core.closestCorners)({
53
53
  ...args,
@@ -68,10 +68,10 @@ const customCollisionDetection = (sensorContext) => {
68
68
  ];
69
69
  const intersectionPercentage = Math.abs(bottom - top) / Math.min(collisionRect.height, collidingRect.height);
70
70
  const isBefore = collisionRect.top + collisionRect.height / 2 < collidingRect.top + collidingRect.height / 2;
71
- if (intersectionPercentage > insideThreshold && flattenedItemsDictionary[collidingContainer.id].depth + 1 <= maxDragAndDropLevel && collidingContainer.id !== active.id) {
71
+ if (intersectionPercentage > insideThreshold && flattenedItemsDictionary[collidingContainer?.id].depth + 1 <= maxDragAndDropLevel && collidingContainer?.id !== active.id) {
72
72
  dropIndicatorPosition = import_constants.DropIndicatorPosition.Inside;
73
73
  } else {
74
- const isFirstElement = flattenedItemsDictionary[collidingContainer.id].realIndex === 0;
74
+ const isFirstElement = flattenedItemsDictionary[collidingContainer?.id].realIndex === 0;
75
75
  if (isFirstElement) {
76
76
  dropIndicatorPosition = isBefore ? import_constants.DropIndicatorPosition.Before : import_constants.DropIndicatorPosition.After;
77
77
  } else {
@@ -80,7 +80,7 @@ const customCollisionDetection = (sensorContext) => {
80
80
  }
81
81
  return [
82
82
  {
83
- id: isBefore && dropIndicatorPosition === import_constants.DropIndicatorPosition.After ? nearesCollidingContainer.id : collidingContainer.id,
83
+ id: isBefore && dropIndicatorPosition === import_constants.DropIndicatorPosition.After ? nearesCollidingContainer?.id : collidingContainer?.id,
84
84
  data: { dropIndicatorPosition }
85
85
  }
86
86
  ];
@@ -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.js';\nimport { type CollisionDetection, rectIntersection, closestCorners } from '@dnd-kit/core';\nimport type { DnDKitTree } from './types.js';\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, droppableRects, ...args }) => {\n const { active, flattenedItemsDictionary, maxDragAndDropLevel, containersRef } = sensorContext.current;\n\n if (!active) return [];\n\n const rectIntersectionCollisions = rectIntersection({\n ...args,\n droppableRects,\n collisionRect,\n droppableContainers: droppableContainers.filter(({ id }) => containersRef.current.includes(id)),\n });\n\n const { id: closestContainerOfContainersId } = rectIntersectionCollisions[0] ?? {};\n\n const possibleCollidingContainers = droppableContainers.filter(\n (container) =>\n !containersRef.current.includes(container.id) &&\n flattenedItemsDictionary[container.id].container === closestContainerOfContainersId,\n );\n\n const [collidingContainer, nearesCollidingContainer] = closestCorners({\n ...args,\n droppableRects,\n collisionRect,\n droppableContainers: possibleCollidingContainers,\n });\n\n let dropIndicatorPosition: DnDKitTree.DropIndicatorPositionValues = DropIndicatorPosition.None;\n\n // If we didn't find a match, return empty array\n if (!collidingContainer) {\n dropIndicatorPosition = DropIndicatorPosition.Inside;\n return [{ id: closestContainerOfContainersId, data: { dropIndicatorPosition } }];\n }\n\n const collidingRect = possibleCollidingContainers.find((container) => container.id === collidingContainer.id)?.rect\n ?.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 const isBefore = collisionRect.top + collisionRect.height / 2 < collidingRect.top + collidingRect.height / 2;\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 const isFirstElement = flattenedItemsDictionary[collidingContainer.id].realIndex === 0;\n if (isFirstElement) {\n dropIndicatorPosition = isBefore ? DropIndicatorPosition.Before : DropIndicatorPosition.After;\n } else {\n dropIndicatorPosition = DropIndicatorPosition.After;\n }\n }\n\n // Return the id of the match rectangle\n return [\n {\n id:\n isBefore && dropIndicatorPosition === DropIndicatorPosition.After\n ? nearesCollidingContainer.id\n : collidingContainer.id,\n data: { dropIndicatorPosition },\n },\n ];\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;AACtC,kBAA0E;AAG1E,MAAM,kBAAkB;AAEjB,MAAM,2BAA2B,CAAK,kBAAmE;AAC9G,QAAM,OAA2B,CAAC,EAAE,qBAAqB,eAAe,gBAAgB,GAAG,KAAK,MAAM;AACpG,UAAM,EAAE,QAAQ,0BAA0B,qBAAqB,cAAc,IAAI,cAAc;AAE/F,QAAI,CAAC,OAAQ,QAAO,CAAC;AAErB,UAAM,iCAA6B,8BAAiB;AAAA,MAClD,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,qBAAqB,oBAAoB,OAAO,CAAC,EAAE,GAAG,MAAM,cAAc,QAAQ,SAAS,EAAE,CAAC;AAAA,IAChG,CAAC;AAED,UAAM,EAAE,IAAI,+BAA+B,IAAI,2BAA2B,CAAC,KAAK,CAAC;AAEjF,UAAM,8BAA8B,oBAAoB;AAAA,MACtD,CAAC,cACC,CAAC,cAAc,QAAQ,SAAS,UAAU,EAAE,KAC5C,yBAAyB,UAAU,EAAE,EAAE,cAAc;AAAA,IACzD;AAEA,UAAM,CAAC,oBAAoB,wBAAwB,QAAI,4BAAe;AAAA,MACpE,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,IACvB,CAAC;AAED,QAAI,wBAAgE,uCAAsB;AAG1F,QAAI,CAAC,oBAAoB;AACvB,8BAAwB,uCAAsB;AAC9C,aAAO,CAAC,EAAE,IAAI,gCAAgC,MAAM,EAAE,sBAAsB,EAAE,CAAC;AAAA,IACjF;AAEA,UAAM,gBAAgB,4BAA4B,KAAK,CAAC,cAAc,UAAU,OAAO,mBAAmB,EAAE,GAAG,MAC3G;AAEJ,QAAI,CAAC,cAAe,QAAO,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;AAC3G,UAAM,WAAW,cAAc,MAAM,cAAc,SAAS,IAAI,cAAc,MAAM,cAAc,SAAS;AAC3G,QACE,yBAAyB,mBACzB,yBAAyB,mBAAmB,EAAE,EAAE,QAAQ,KAAK,uBAC7D,mBAAmB,OAAO,OAAO,IACjC;AACA,8BAAwB,uCAAsB;AAAA,IAChD,OAAO;AACL,YAAM,iBAAiB,yBAAyB,mBAAmB,EAAE,EAAE,cAAc;AACrF,UAAI,gBAAgB;AAClB,gCAAwB,WAAW,uCAAsB,SAAS,uCAAsB;AAAA,MAC1F,OAAO;AACL,gCAAwB,uCAAsB;AAAA,MAChD;AAAA,IACF;AAGA,WAAO;AAAA,MACL;AAAA,QACE,IACE,YAAY,0BAA0B,uCAAsB,QACxD,yBAAyB,KACzB,mBAAmB;AAAA,QACzB,MAAM,EAAE,sBAAsB;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { type CollisionDetection, rectIntersection, closestCorners } from '@dnd-kit/core';\nimport { DropIndicatorPosition } from './constants.js';\nimport type { DnDKitTree } from './types.js';\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, droppableRects, ...args }) => {\n const { active, flattenedItemsDictionary, maxDragAndDropLevel, containersRef } = sensorContext.current;\n\n if (!active) return [];\n\n const rectIntersectionCollisions = rectIntersection({\n ...args,\n droppableRects,\n collisionRect,\n droppableContainers: droppableContainers.filter(({ id }) => containersRef.current.includes(id)),\n });\n\n const { id: closestContainerOfContainersId } = rectIntersectionCollisions[0] ?? {};\n\n const possibleCollidingContainers = droppableContainers.filter(\n (container) =>\n !containersRef.current.includes(container?.id) &&\n flattenedItemsDictionary[container?.id].container === closestContainerOfContainersId,\n );\n\n const [collidingContainer, nearesCollidingContainer] = closestCorners({\n ...args,\n droppableRects,\n collisionRect,\n droppableContainers: possibleCollidingContainers,\n });\n\n let dropIndicatorPosition: DnDKitTree.DropIndicatorPositionValues = DropIndicatorPosition.None;\n\n // If we didn't find a match, return empty array\n if (!collidingContainer) {\n dropIndicatorPosition = DropIndicatorPosition.Inside;\n return [{ id: closestContainerOfContainersId, data: { dropIndicatorPosition } }];\n }\n\n const collidingRect = possibleCollidingContainers.find((container) => container.id === collidingContainer.id)?.rect\n ?.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 const isBefore = collisionRect.top + collisionRect.height / 2 < collidingRect.top + collidingRect.height / 2;\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 const isFirstElement = flattenedItemsDictionary[collidingContainer?.id].realIndex === 0;\n if (isFirstElement) {\n dropIndicatorPosition = isBefore ? DropIndicatorPosition.Before : DropIndicatorPosition.After;\n } else {\n dropIndicatorPosition = DropIndicatorPosition.After;\n }\n }\n\n // Return the id of the match rectangle\n return [\n {\n id:\n isBefore && dropIndicatorPosition === DropIndicatorPosition.After\n ? nearesCollidingContainer?.id\n : collidingContainer?.id,\n data: { dropIndicatorPosition },\n },\n ];\n };\n return func;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,kBAA0E;AAC1E,uBAAsC;AAGtC,MAAM,kBAAkB;AAEjB,MAAM,2BAA2B,CAAK,kBAAmE;AAC9G,QAAM,OAA2B,CAAC,EAAE,qBAAqB,eAAe,gBAAgB,GAAG,KAAK,MAAM;AACpG,UAAM,EAAE,QAAQ,0BAA0B,qBAAqB,cAAc,IAAI,cAAc;AAE/F,QAAI,CAAC,OAAQ,QAAO,CAAC;AAErB,UAAM,iCAA6B,8BAAiB;AAAA,MAClD,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,qBAAqB,oBAAoB,OAAO,CAAC,EAAE,GAAG,MAAM,cAAc,QAAQ,SAAS,EAAE,CAAC;AAAA,IAChG,CAAC;AAED,UAAM,EAAE,IAAI,+BAA+B,IAAI,2BAA2B,CAAC,KAAK,CAAC;AAEjF,UAAM,8BAA8B,oBAAoB;AAAA,MACtD,CAAC,cACC,CAAC,cAAc,QAAQ,SAAS,WAAW,EAAE,KAC7C,yBAAyB,WAAW,EAAE,EAAE,cAAc;AAAA,IAC1D;AAEA,UAAM,CAAC,oBAAoB,wBAAwB,QAAI,4BAAe;AAAA,MACpE,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,IACvB,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react";
4
4
  import { createPortal } from "react-dom";
5
- import {
6
- DndContext,
7
- DragOverlay,
8
- restrictToWindowEdges,
9
- useMultiTreeDndkitConfig
10
- } from "../../index.js";
11
- import { ContainersContext } from "../DSSortableContainer/index.js";
5
+ import { restrictToWindowEdges } from "@dnd-kit/modifiers";
12
6
  import { describe } from "@elliemae/ds-props-helpers";
7
+ import { DragOverlay, DndContext } from "@dnd-kit/core";
8
+ import { useMultiTreeDndkitConfig } from "../../tree/index.js";
9
+ import { ContainersContext } from "../DSSortableContainer/config/SortableContainerContext.js";
13
10
  import { DSDragAndDropPropTypes } from "./react-desc-prop-types.js";
14
11
  const flatten = (items, parentId = null, depth = 0, container = "root", iteration = { count: 0 }) => items.reduce((acc, item, index) => {
15
12
  acc.push({
@@ -17,7 +14,7 @@ const flatten = (items, parentId = null, depth = 0, container = "root", iteratio
17
14
  uid: item.dsId,
18
15
  childrenCount: item?.subitems?.length || 0,
19
16
  original: item,
20
- realIndex: iteration.count++,
17
+ realIndex: iteration.count + 1,
21
18
  parentId,
22
19
  depth,
23
20
  index,
@@ -56,14 +53,12 @@ const DSDragAndDrop = ({
56
53
  getIsDropValid: () => true,
57
54
  ...rest
58
55
  });
56
+ const ctx = useMemo(
57
+ () => ({ sortableContextProps, dropIndicatorPosition, isDropValid, items: itemsFlattened, onCollapse }),
58
+ [dropIndicatorPosition, isDropValid, itemsFlattened, onCollapse, sortableContextProps]
59
+ );
59
60
  return /* @__PURE__ */ jsxs(DndContext, { ...dndContextProps, children: [
60
- /* @__PURE__ */ jsx(
61
- ContainersContext.Provider,
62
- {
63
- value: { sortableContextProps, dropIndicatorPosition, isDropValid, items: itemsFlattened, onCollapse },
64
- children
65
- }
66
- ),
61
+ /* @__PURE__ */ jsx(ContainersContext.Provider, { value: ctx, children }),
67
62
  createPortal(
68
63
  /* @__PURE__ */ jsx(DragOverlay, { style: { width: "auto", zIndex: 1001 }, modifiers: [restrictToWindowEdges], children: active ? /* @__PURE__ */ jsx(DragOverlayRenderer, { activeItem: active }) : null }),
69
64
  document.body
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSDragAndDrop/DSDragAndDrop.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\nimport React, { useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n DndContext,\n DragOverlay,\n restrictToWindowEdges,\n useMultiTreeDndkitConfig,\n type UniqueIdentifier,\n} from '../../index.js';\nimport { ContainersContext } from '../DSSortableContainer/index.js';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport type { DSDragAndDropT, Item } from './react-desc-prop-types.js';\nimport { DSDragAndDropPropTypes } from './react-desc-prop-types.js';\n\nconst flatten = <T,>(\n items: Item<T>[],\n parentId: UniqueIdentifier | null = null,\n depth = 0,\n container = 'root',\n iteration = { count: 0 },\n) =>\n items.reduce((acc, item, index) => {\n acc.push({\n ...item,\n uid: item.dsId,\n childrenCount: item?.subitems?.length || 0,\n original: item,\n realIndex: iteration.count++,\n parentId,\n depth,\n index,\n container,\n });\n if (item.subitems?.length > 0 && item.collapsed === false) {\n acc.push(...flatten(item.subitems, item.dsId, depth + 1, container, iteration));\n }\n return acc;\n }, [] as Item<T>[]);\n\nexport const DSDragAndDrop = <T,>({\n items,\n children,\n onReorder,\n onCollapse,\n DragOverlayRenderer,\n maxDragAndDropLevel = 0,\n ...rest\n}: DSDragAndDropT.Props<T>) => {\n const itemsFlattened = useMemo(\n () =>\n Object.keys(items).reduce(\n (acc, container) => {\n acc[container] = flatten(items[container] as Item<T>[], null, 0, container);\n return acc;\n },\n {} as Record<string, Item<T>[]>,\n ),\n [items],\n );\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } =\n useMultiTreeDndkitConfig({\n flattenedItems: itemsFlattened,\n isHorizontalDnD: false,\n isExpandable: true,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid: () => true,\n ...rest,\n });\n\n return (\n <DndContext {...dndContextProps}>\n <ContainersContext.Provider\n value={{ sortableContextProps, dropIndicatorPosition, isDropValid, items: itemsFlattened, onCollapse }}\n >\n {children}\n </ContainersContext.Provider>\n {createPortal(\n <DragOverlay style={{ width: 'auto', zIndex: 1001 }} modifiers={[restrictToWindowEdges]}>\n {active ? <DragOverlayRenderer activeItem={active} /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n};\n\nconst DSDragAndDropWithSchema = describe(DSDragAndDrop);\n\nDSDragAndDropWithSchema.propTypes = DSDragAndDropPropTypes;\n\nexport { DSDragAndDropWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACwEnB,SACE,KADF;AAvEJ,SAAgB,eAAe;AAC/B,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AAEzB,SAAS,8BAA8B;AAEvC,MAAM,UAAU,CACd,OACA,WAAoC,MACpC,QAAQ,GACR,YAAY,QACZ,YAAY,EAAE,OAAO,EAAE,MAEvB,MAAM,OAAO,CAAC,KAAK,MAAM,UAAU;AACjC,MAAI,KAAK;AAAA,IACP,GAAG;AAAA,IACH,KAAK,KAAK;AAAA,IACV,eAAe,MAAM,UAAU,UAAU;AAAA,IACzC,UAAU;AAAA,IACV,WAAW,UAAU;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,MAAI,KAAK,UAAU,SAAS,KAAK,KAAK,cAAc,OAAO;AACzD,QAAI,KAAK,GAAG,QAAQ,KAAK,UAAU,KAAK,MAAM,QAAQ,GAAG,WAAW,SAAS,CAAC;AAAA,EAChF;AACA,SAAO;AACT,GAAG,CAAC,CAAc;AAEb,MAAM,gBAAgB,CAAK;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB,GAAG;AACL,MAA+B;AAC7B,QAAM,iBAAiB;AAAA,IACrB,MACE,OAAO,KAAK,KAAK,EAAE;AAAA,MACjB,CAAC,KAAK,cAAc;AAClB,YAAI,SAAS,IAAI,QAAQ,MAAM,SAAS,GAAgB,MAAM,GAAG,SAAS;AAC1E,eAAO;AAAA,MACT;AAAA,MACA,CAAC;AAAA,IACH;AAAA,IACF,CAAC,KAAK;AAAA,EACR;AACA,QAAM,EAAE,iBAAiB,sBAAsB,QAAQ,uBAAuB,YAAY,IACxF,yBAAyB;AAAA,IACvB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,gBAAgB,MAAM;AAAA,IACtB,GAAG;AAAA,EACL,CAAC;AAEH,SACE,qBAAC,cAAY,GAAG,iBACd;AAAA;AAAA,MAAC,kBAAkB;AAAA,MAAlB;AAAA,QACC,OAAO,EAAE,sBAAsB,uBAAuB,aAAa,OAAO,gBAAgB,WAAW;AAAA,QAEpG;AAAA;AAAA,IACH;AAAA,IACC;AAAA,MACC,oBAAC,eAAY,OAAO,EAAE,OAAO,QAAQ,QAAQ,KAAK,GAAG,WAAW,CAAC,qBAAqB,GACnF,mBAAS,oBAAC,uBAAoB,YAAY,QAAQ,IAAK,MAC1D;AAAA,MACA,SAAS;AAAA,IACX;AAAA,KACF;AAEJ;AAEA,MAAM,0BAA0B,SAAS,aAAa;AAEtD,wBAAwB,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\nimport React, { useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { type UniqueIdentifier } from '@dnd-kit/core/dist/types';\nimport { restrictToWindowEdges } from '@dnd-kit/modifiers';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DragOverlay, DndContext } from '@dnd-kit/core';\nimport { useMultiTreeDndkitConfig } from '../../tree/index.js';\nimport { ContainersContext } from '../DSSortableContainer/config/SortableContainerContext.js';\nimport type { DSDragAndDropT, Item } from './react-desc-prop-types.js';\nimport { DSDragAndDropPropTypes } from './react-desc-prop-types.js';\n\nconst flatten = <T,>(\n items: Item<T>[],\n parentId: UniqueIdentifier | null = null,\n depth = 0,\n container = 'root',\n iteration = { count: 0 },\n) =>\n items.reduce((acc, item, index) => {\n acc.push({\n ...item,\n uid: item.dsId,\n childrenCount: item?.subitems?.length || 0,\n original: item,\n realIndex: iteration.count + 1,\n parentId,\n depth,\n index,\n container,\n });\n if (item.subitems?.length > 0 && item.collapsed === false) {\n acc.push(...flatten(item.subitems, item.dsId, depth + 1, container, iteration));\n }\n return acc;\n }, [] as Item<T>[]);\n\nexport const DSDragAndDrop = <T,>({\n items,\n children,\n onReorder,\n onCollapse,\n DragOverlayRenderer,\n maxDragAndDropLevel = 0,\n ...rest\n}: DSDragAndDropT.Props<T>) => {\n const itemsFlattened = useMemo(\n () =>\n Object.keys(items).reduce(\n (acc, container) => {\n acc[container] = flatten(items[container] as Item<T>[], null, 0, container);\n return acc;\n },\n {} as Record<string, Item<T>[]>,\n ),\n [items],\n );\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } =\n useMultiTreeDndkitConfig({\n flattenedItems: itemsFlattened,\n isHorizontalDnD: false,\n isExpandable: true,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid: () => true,\n ...rest,\n });\n\n const ctx = useMemo(\n () => ({ sortableContextProps, dropIndicatorPosition, isDropValid, items: itemsFlattened, onCollapse }),\n [dropIndicatorPosition, isDropValid, itemsFlattened, onCollapse, sortableContextProps],\n );\n\n return (\n <DndContext {...dndContextProps}>\n <ContainersContext.Provider value={ctx}>{children}</ContainersContext.Provider>\n {createPortal(\n <DragOverlay style={{ width: 'auto', zIndex: 1001 }} modifiers={[restrictToWindowEdges]}>\n {active ? <DragOverlayRenderer activeItem={active} /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n};\n\nconst DSDragAndDropWithSchema = describe(DSDrag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AAsB,QAAQ,uBAAuB,YAAY,IACxF,yBAAyB;AAAA,IACvB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,gBAAgB,MAAM;AAAA,IACtB,GAAG;AAAA,EACL,CAAC;AAEH,QAAM,MAAM;AAAA,IACV,OAAO,EAAE,sBAAsB,uBAAuB,aAAa,OAAO,gBAAgB,WAAW;AAAA,IACrG,CAAC,uBAAuB,aAAa,gBAAgB,YAAY,oBAAoB;AAAA,EACvF;AAEA,SACE,qBAAC,cAAY,GAAG,iBACd;AAAA,wBAAC,kBAAkB,UAAlB,EAA2B,OAAO,KAAM,UAAS;AAAA,IACjD;AAAA,MACC,oBAAC,eAAY,OAAO,EAAE,OAAO,QAAQ,QAAQ,KAAK,GAAG,WAAW,CAAC,qBAAqB,GACnF,mBAAS,oBAAC,uBAAoB,YAAY,QAAQ,IAAK,MAC1D;AAAA,MACA,SAAS;AAAA,IACX;AAAA,KACF;AAEJ;AAEA,MAAM,0BAA0B,SAAS,aAAa;AAEtD,wBAAwB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -1,24 +1,29 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import React2, { useContext, createContext, useMemo } from "react";
3
+ import React2, { useContext, useMemo } from "react";
4
4
  import { DSFastList } from "@elliemae/ds-fast-list";
5
5
  import { describe } from "@elliemae/ds-props-helpers";
6
- import { SortableContext, useDroppable, DSSortableItem } from "../../index.js";
6
+ import { useDroppable } from "@dnd-kit/core";
7
+ import { SortableContext } from "@dnd-kit/sortable";
8
+ import { DSSortableItem } from "../DSSortableItem/index.js";
7
9
  import { DSSortalContainerPropTypes } from "./react-desc-prop-types.js";
8
- function createContainerContext() {
9
- return createContext({
10
- sortableContextProps: {},
11
- items: {}
12
- });
13
- }
14
- const ContainersContext = createContainerContext();
10
+ import { ContainersContext } from "./config/SortableContainerContext.js";
15
11
  const ContainerItemRenderer = (props) => {
16
- const {
17
- index,
18
- extraItemProps: { items, ItemRenderer, extraItemProps, ...rest }
19
- } = props;
12
+ const { index, extraItemProps } = props;
13
+ if (!extraItemProps) {
14
+ return null;
15
+ }
16
+ const { items, ItemRenderer, ...rest } = extraItemProps;
20
17
  const item = items[index];
21
- return /* @__PURE__ */ jsx(DSSortableItem, { item, ItemRenderer, extraItemProps, ...rest });
18
+ return /* @__PURE__ */ jsx(
19
+ DSSortableItem,
20
+ {
21
+ item,
22
+ ItemRenderer,
23
+ ...rest,
24
+ extraItemProps
25
+ }
26
+ );
22
27
  };
23
28
  const ContainerItemRendererMemoized = React2.memo(ContainerItemRenderer);
24
29
  const DSSortableContainer = (props) => {
@@ -55,9 +60,7 @@ const DSSortableContainer = (props) => {
55
60
  const DSSortableContainerSchema = describe(DSSortableContainer);
56
61
  DSSortableContainerSchema.propTypes = DSSortalContainerPropTypes;
57
62
  export {
58
- ContainersContext,
59
63
  DSSortableContainer,
60
- DSSortableContainerSchema,
61
- createContainerContext
64
+ DSSortableContainerSchema
62
65
  };
63
66
  //# sourceMappingURL=DSSortableContainer.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSSortableContainer/DSSortableContainer.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, createContext, useMemo } from 'react';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { SortableContext, useDroppable, DSSortableItem } from '../../index.js';\nimport type { DSSortableContainerT } from './react-desc-prop-types.js';\nimport { DSSortalContainerPropTypes } from './react-desc-prop-types.js';\nimport type { DnDKitTree } from '../../tree/types.js';\nimport type { ItemRendererPropsT } from '../DSSortableItem/index.js';\n\ninterface ContainerContextT<T> {\n isDropValid?: boolean;\n dropIndicatorPosition?: string;\n sortableContextProps: Record<string, DnDKitTree.SortableContextPropsType>;\n items: Record<string, DSSortableContainerT.Item<T>[]>;\n onCollapse?: (nodeId: string) => void;\n}\n\nexport function createContainerContext<T>() {\n return createContext<ContainerContextT<T>>({\n sortableContextProps: {},\n items: {},\n });\n}\nexport const ContainersContext = createContainerContext();\n\nconst ContainerItemRenderer = <T, K>(props: DSSortableContainerT.ContainerItemRendererT<T, K>) => {\n const {\n index,\n extraItemProps: { items, ItemRenderer, extraItemProps, ...rest },\n } = props;\n const item = items[index];\n return <DSSortableItem item={item} ItemRenderer={ItemRenderer} extraItemProps={extraItemProps} {...rest} />;\n};\n\nconst ContainerItemRendererMemoized = React.memo(ContainerItemRenderer);\n\nexport const DSSortableContainer = <T, K>(props: DSSortableContainerT.Props<T, K>) => {\n const { containerId, ItemRenderer, Component, extraItemProps, children } = props;\n const { setNodeRef, isOver } = useDroppable({\n id: containerId,\n });\n const ctx = useContext(ContainersContext);\n const { sortableContextProps, items } = ctx;\n const containerSortableContextProps = sortableContextProps[containerId];\n\n const render = useMemo(() => {\n if (children) {\n return children;\n }\n if (ItemRenderer) {\n return (\n <DSFastList\n count={items[containerId].length}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n ItemRenderer={ContainerItemRendererMemoized as any}\n extraItemProps={{\n items: items[containerId],\n ItemRenderer: ItemRenderer as React.ComponentType<ItemRendererPropsT<unknown, unknown>>,\n extraItemProps,\n }}\n getId={(index: number | string) => items[containerId][index as number].dsId}\n />\n );\n }\n return null;\n }, [ItemRenderer, children, containerId, extraItemProps, items]);\n\n return (\n <SortableContext {...containerSortableContextProps} id=\"container\">\n <Component innerRef={setNodeRef} isOver={isOver}>\n {render}\n </Component>\n </SortableContext>\n );\n};\n\nconst DSSortableContainerSchema = describe(DSSortableContainer);\nDSSortableContainerSchema.propTypes = DSSortalContainerPropTypes;\n\nexport { DSSortableContainerSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC+Bd;AA/BT,OAAOA,UAAS,YAAY,eAAe,eAAe;AAC1D,S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AG,+BAA+B,IAAG,aACrD,8BAAC,aAAU,UAAU,YAAY,QAC9B,kBACH,GACF;AAEJ;AAEA,MAAM,4BAA4B,SAAS,mBAAmB;AAC9D,0BAA0B,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useDroppable } from '@dnd-kit/core';\nimport { SortableContext } from '@dnd-kit/sortable';\nimport { DSSortableItem } from '../DSSortableItem/index.js';\nimport type { DSSortableContainerT } from './react-desc-prop-types.js';\nimport { DSSortalContainerPropTypes } from './react-desc-prop-types.js';\nimport type { ItemRendererPropsT } from '../DSSortableItem/index.js';\nimport { ContainersContext } from './config/SortableContainerContext.js';\nimport type { Item } from '../DSDragAndDrop/index.js';\nconst ContainerItemRenderer = <T, K>(props: DSSortableContainerT.ContainerItemRendererT<T, K>) => {\n const { index, extraItemProps } = props;\n if (!extraItemProps) {\n return null;\n }\n const { items, ItemRenderer, ...rest } = extraItemProps;\n const item = items[index];\n return (\n <DSSortableItem\n item={item}\n ItemRenderer={\n ItemRenderer as React.ComponentType<\n ItemRendererPropsT<\n T,\n { items: Item<T>[]; extraItemProps: K; ItemRenderer: React.ComponentType<ItemRendererPropsT<T, K>> }\n >\n >\n }\n {...rest}\n extraItemProps={extraItemProps}\n />\n );\n};\n\nconst ContainerItemRendererMemoized = React.memo(ContainerItemRenderer);\n\nexport const DSSortableContainer = <T, K>(props: DSSortableContainerT.Props<T, K>) => {\n const { containerId, ItemRenderer, Component, extraItemProps, children } = props;\n const { setNodeRef, isOver } = useDroppable({\n id: containerId,\n });\n const ctx = useContext(ContainersContext);\n const { sortableContextProps, items } = ctx;\n const containerSortableContextProps = sortableContextProps[containerId];\n\n const render = useMemo(() => {\n if (children) {\n return children;\n }\n if (ItemRenderer) {\n return (\n <DSFastList\n count={items[containerId].length}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n ItemRenderer={ContainerItemRendererMemoized as any}\n extraItemProps={{\n items: items[containerId],\n ItemRenderer: ItemRenderer as React.ComponentType<ItemRendererPropsT<unknown, unknown>>,\n extraItemProps,\n }}\n getId={(index: number | string) => items[containerId][index as number].dsId}\n />\n );\n }\n return null;\n }, [ItemRenderer, children, containerId, extraItemProps, items]);\n\n return (\n <SortableContext {...containerSortableContextProps} id=\"container\">\n <Component innerRef={setNodeRef} isOver={isOver}>\n {render}\n </Component>\n </SortableContext>\n );\n};\n\nconst DSSortableContainerSchema = describe(DSSortableContainer);\nDSSortableContainerSchema.propTypes = DSSortalContainerPropTypes;\n\nexport { DSSortableContainerSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACmBnB;AAnBJ,OAAOA,UAAS,YAAY,eAAe;AAC3C,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAE/B,SAAS,kCAAkC;AAE3C,SAAS,yBAAyB;AAElC,MAAM,wBAAwB,CAAO,UAA6D;AAChG,QAAM,EAAE,OAAO,eAAe,IAAI;AAClC,MAAI,CAAC,gBAAgB;AACnB,WAAO;AAAA,EACT;AACA,QAAM,EAAE,OAAO,cAAc,GAAG,KAAK,IAAI;AACzC,QAAM,OAAO,MAAM,KAAK;AACxB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MAQC,GAAG;AAAA,MACJ;AAAA;AAAA,EACF;AAEJ;AAEA,MAAM,gCAAgCA,OAAM,KAAK,qBAAqB;AAE/D,MAAM,sBAAsB,CAAO,UAA4C;AACpF,QAAM,EAAE,aAAa,cAAc,WAAW,gBAAgB,SAAS,IAAI;AAC3E,QAAM,EAAE,YAAY,OAAO,IAAI,aAAa;AAAA,IAC1C,IAAI;AAAA,EACN,CAAC;AACD,QAAM,MAAM,WAAW,iBAAiB;AACxC,QAAM,EAAE,sBAAsB,MAAM,IAAI;AACxC,QAAM,gCAAgC,qBAAqB,WAAW;AAEtE,QAAM,SAAS,QAAQ,MAAM;AAC3B,QAAI,UAAU;AACZ,aAAO;AAAA,IACT;AACA,QAAI,cAAc;AAChB,aACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,MAAM,WAAW,EAAE;AAAA,UAE1B,cAAc;AAAA,UACd,gBAAgB;AAAA,YACd,OAAO,MAAM,WAAW;AAAA,YACxB;AAAA,YACA;AAAA,UACF;AAAA,UACA,OAAO,CAAC,UAA2B,MAAM,WAAW,EAAE,KAAe,EAAE;AAAA;AAAA,MACzE;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,GAAG,CAAC,cAAc,UAAU,aAAa,gBAAgB,KAAK,CAAC;AAE/D,SACE,oBAAC,mBAAiB,GAAG,+BAA+B,IAAG,aACrD,8BAAC,aAAU,UAAU,YAAY,QAC9B,kBACH,GACF;AAEJ;AAEA,MAAM,4BAA4B,SAAS,mBAAmB;AAC9D,0BAA0B,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { createContext } from "react";
3
+ function createContainerContext() {
4
+ return createContext({
5
+ sortableContextProps: {},
6
+ items: {}
7
+ });
8
+ }
9
+ const ContainersContext = createContainerContext();
10
+ export {
11
+ ContainersContext,
12
+ createContainerContext
13
+ };
14
+ //# sourceMappingURL=SortableContainerContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSSortableContainer/config/SortableContainerContext.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport type { DnDKitTree } from '../../../tree/types.js';\nimport type { DSSortableContainerT } from '../react-desc-prop-types.js';\n\ninterface ContainerContextT<T> {\n isDropValid?: boolean;\n dropIndicatorPosition?: string;\n sortableContextProps: Record<string, DnDKitTree.SortableContextPropsType>;\n items: Record<string, DSSortableContainerT.Item<T>[]>;\n onCollapse?: (nodeId: string) => void;\n}\n\nexport function createContainerContext<T>() {\n return createContext<ContainerContextT<T>>({\n sortableContextProps: {},\n items: {},\n });\n}\n\nexport const ContainersContext = createContainerContext();\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB;AAYvB,SAAS,yBAA4B;AAC1C,SAAO,cAAoC;AAAA,IACzC,sBAAsB,CAAC;AAAA,IACvB,OAAO,CAAC;AAAA,EACV,CAAC;AACH;AAEO,MAAM,oBAAoB,uBAAuB;",
6
+ "names": []
7
+ }
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
- import { DSSortableContainer, DSSortableContainerSchema, ContainersContext } from "./DSSortableContainer.js";
2
+ import { DSSortableContainer, DSSortableContainerSchema } from "./DSSortableContainer.js";
3
+ import { ContainersContext } from "./config/SortableContainerContext.js";
3
4
  export {
4
5
  ContainersContext,
5
6
  DSSortableContainer,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSSortableContainer/index.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSSortableContainer, DSSortableContainerSchema, ContainersContext } from './DSSortableContainer.js';\nexport type { DSSortableContainerT } from './react-desc-prop-types.js';\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB,2BAA2B,yBAAyB;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSSortableContainer, DSSortableContainerSchema } from './DSSortableContainer.js';\nexport { ContainersContext } from './config/SortableContainerContext.js';\nexport type { DSSortableContainerT } from './react-desc-prop-types.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB,iCAAiC;AAC/D,SAAS,yBAAyB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSSortableContainer/react-desc-prop-types.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\n/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport type { UniqueIdentifier } from '@dnd-kit/core/dist/types';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport type { DnDKitTree } from '../../tree/types.js';\nimport type { ItemRendererPropsT } from '../DSSortableItem/index.js';\nexport declare namespace DSSortableContainerT {\n export interface WrapperComponentProps {\n innerRef: React.MutableRefObject<HTMLDivElement | null> | ((ref: HTMLDivElement | null) => void);\n isOver: boolean;\n children: React.ReactNode;\n }\n export interface RequiredProps {\n containerId: UniqueIdentifier;\n Component: React.ComponentType<WrapperComponentProps>;\n }\n\n export interface ContainerItemRendererT<T, K> {\n extraItemProps: {\n items: Item<T>[];\n extraItemProps: K;\n ItemRenderer: React.ComponentType<ItemRendererPropsT<T, K>>;\n };\n index: number;\n }\n\n export type ItemProp<T> = {\n dsId: number | string;\n subitems: ItemProp<T>[];\n } & T;\n\n // opinionated item type\n export type Item<T> = DnDKitTree.Item<T> & {\n dsId: number | string;\n subitems: Item<T>[];\n } & T;\n\n export interface DefaultProps {}\n\n export interface OptionalProps<T, K> {\n items?: Record<string, Item<T>[]>;\n extraItemProps?: K;\n ItemRenderer?: React.ComponentType<ItemRendererPropsT<T, K>>;\n children?: React.ReactNode;\n }\n\n export interface Props<T, K> extends Partial<DefaultProps>, OptionalProps<T, K>, XstyledProps, RequiredProps {}\n\n export interface InternalProps<T, K> extends DefaultProps, OptionalProps<T, K>, XstyledProps, RequiredProps {}\n}\n\nexport const DSSortalContainerPropTypes = {\n containerId: PropTypes.string.description('The id of the container').isRequired,\n Component: PropTypes.node.description('The component to be rendered as the container').isRequired,\n children: PropTypes.node.description('The children to be rendered in the container'),\n items: PropTypes.object.description('The items to be rendered in the container'),\n extraItemProps: PropTypes.object.description('The extra item props to be passed to the item renderer'),\n ItemRenderer: PropTypes.node.description('The item renderer to be used'),\n} as React.WeakValidationMap<unknown>;\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\n/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport type { UniqueIdentifier } from '@dnd-kit/core/dist/types';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport type { DnDKitTree } from '../../tree/types.js';\nimport type { ItemRendererPropsT } from '../DSSortableItem/index.js';\nexport declare namespace DSSortableContainerT {\n export interface WrapperComponentProps {\n innerRef: React.MutableRefObject<HTMLDivElement | null> | ((ref: HTMLDivElement | null) => void);\n isOver: boolean;\n children: React.ReactNode;\n }\n export interface RequiredProps {\n containerId: UniqueIdentifier;\n Component: React.ComponentType<WrapperComponentProps>;\n }\n\n export interface ContainerItemRendererT<T, K> {\n extraItemProps?: {\n items: Item<T>[];\n extraItemProps: K;\n ItemRenderer: React.ComponentType<ItemRendererPropsT<T, K>>;\n };\n index: number;\n }\n\n export type ItemProp<T> = {\n dsId: number | string;\n subitems: ItemProp<T>[];\n } & T;\n\n // opinionated item type\n export type Item<T> = DnDKitTree.Item<T> & {\n dsId: number | string;\n subitems: Item<T>[];\n } & T;\n\n export interface DefaultProps {}\n\n export interface OptionalProps<T, K> {\n items?: Record<string, Item<T>[]>;\n extraItemProps?: K;\n ItemRenderer?: React.ComponentType<ItemRendererPropsT<T, K>>;\n children?: React.ReactNode;\n }\n\n export interface Props<T, K> extends Partial<DefaultProps>, OptionalProps<T, K>, XstyledProps, RequiredProps {}\n\n export interface InternalProps<T, K> extends DefaultProps, OptionalProps<T, K>, XstyledProps, RequiredProps {}\n}\n\nexport const DSSortalContainerPropTypes = {\n containerId: PropTypes.string.description('The id of the container').isRequired,\n Component: PropTypes.node.description('The component to be rendered as the container').isRequired,\n children: PropTypes.node.description('The children to be rendered in the container'),\n items: PropTypes.object.description('The items to be rendered in the container'),\n extraItemProps: PropTypes.object.description('The extra item props to be passed to the item renderer'),\n ItemRenderer: PropTypes.node.description('The item renderer to be used'),\n} as React.WeakValidationMap<unknown>;\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,iBAAiB;AAgDnB,MAAM,6BAA6B;AAAA,EACxC,aAAa,UAAU,OAAO,YAAY,yBAAyB,EAAE;AAAA,EACrE,WAAW,UAAU,KAAK,YAAY,+CAA+C,EAAE;AAAA,EACvF,UAAU,UAAU,KAAK,YAAY,8CAA8C;AAAA,EACnF,OAAO,UAAU,OAAO,YAAY,2CAA2C;AAAA,EAC/E,gBAAgB,UAAU,OAAO,YAAY,wDAAwD;AAAA,EACrG,cAAc,UAAU,KAAK,YAAY,8BAA8B;AACzE;",
6
6
  "names": []
7
7
  }
@@ -2,8 +2,8 @@ import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { useMemo, useContext } from "react";
4
4
  import { describe } from "@elliemae/ds-props-helpers";
5
- import { useSortable } from "../../index.js";
6
- import { ContainersContext } from "../DSSortableContainer/index.js";
5
+ import { useSortable } from "@dnd-kit/sortable";
6
+ import { ContainersContext } from "../DSSortableContainer/config/SortableContainerContext.js";
7
7
  import { DSSortalItemPropTypes } from "./react-desc-prop-types.js";
8
8
  const DSSortableItem = (props) => {
9
9
  const { item, index: userIndex, containerId, ItemRenderer, extraItemProps } = props;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSSortableItem/DSSortableItem.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useContext } from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\n\nimport { useSortable } from '../../index.js';\nimport { ContainersContext } from '../DSSortableContainer/index.js';\nimport type { DSSortableItemT, DraggablePropsT } from './react-desc-prop-types.js';\nimport { DSSortalItemPropTypes } from './react-desc-prop-types.js';\n\nimport type { Item } from '../DSDragAndDrop/index.js';\nexport const DSSortableItem = <T, K>(props: DSSortableItemT.Props<T, K>) => {\n const { item, index: userIndex, containerId, ItemRenderer, extraItemProps } = props;\n const ctx = useContext(ContainersContext);\n\n const currentItem = item || (userIndex !== undefined ? ctx.items[containerId || 'root'][userIndex] : undefined);\n\n const { isDropValid, dropIndicatorPosition, onCollapse } = ctx;\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: currentItem?.dsId || '',\n }),\n [currentItem],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n const draggableProps: DraggablePropsT = useMemo(() => {\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition: dropIndicatorPosition || 'none',\n isDropValid: isDropValid || false,\n };\n }, [dropIndicatorPosition, isDropValid, useSortableHelpers]);\n\n if (!currentItem) {\n return null;\n }\n return (\n <div ref={draggableProps.setNodeRef} style={{ position: 'relative' }}>\n <ItemRenderer\n item={currentItem as Item<T>}\n draggableProps={draggableProps}\n onCollapse={onCollapse}\n extraItemProps={extraItemProps as K}\n />\n </div>\n );\n};\n\nconst DSSortableItemSchema = describe(DSSortableItem);\n\nDSSortableItemSchema.propTypes = DSSortalItemPropTypes;\n\nexport { DSSortableItemSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC2CjB;AA3CN,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,gBAAgB;AAEzB,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAElC,SAAS,6BAA6B;AAG/B,MAAM,iBAAiB,CAAO,UAAuC;AAC1E,QAAM,EAAE,MAAM,OAAO,WAAW,aAAa,cAAc,eAAe,IAAI;AAC9E,QAAM,MAAM,WAAW,iBAAiB;AAExC,QAAM,cAAc,SAAS,cAAc,SAAY,IAAI,MAAM,eAAe,MAAM,EAAE,SAAS,IAAI;AAErG,QAAM,EAAE,aAAa,uBAAuB,WAAW,IAAI;AAG3D,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,aAAa,QAAQ;AAAA,IAC3B;AAAA,IACA,CAAC,WAAW;AAAA,EACd;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAEvD,QAAM,iBAAkC,QAAQ,MAAM;AACpD,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C,uBAAuB,yBAAyB;AAAA,MAChD,aAAa,eAAe;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,uBAAuB,aAAa,kBAAkB,CAAC;AAE3D,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,EACT;AACA,SACE,oBAAC,SAAI,KAAK,eAAe,YAAY,OAAO,EAAE,UAAU,WAAW,GACjE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF,GACF;AAEJ;AAEA,MAAM,uBAAuB,SAAS,cAAc;AAEpD,qBAAqB,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useContext } from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { ContainersContext } from '../DSSortableContainer/config/SortableContainerContext.js';\nimport type { DSSortableItemT, DraggablePropsT } from './react-desc-prop-types.js';\nimport { DSSortalItemPropTypes } from './react-desc-prop-types.js';\n\nimport type { Item } from '../DSDragAndDrop/index.js';\nexport const DSSortableItem = <T, K>(props: DSSortableItemT.Props<T, K>) => {\n const { item, index: userIndex, containerId, ItemRenderer, extraItemProps } = props;\n const ctx = useContext(ContainersContext);\n\n const currentItem = item || (userIndex !== undefined ? ctx.items[containerId || 'root'][userIndex] : undefined);\n\n const { isDropValid, dropIndicatorPosition, onCollapse } = ctx;\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: currentItem?.dsId || '',\n }),\n [currentItem],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n const draggableProps: DraggablePropsT = useMemo(() => {\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition: dropIndicatorPosition || 'none',\n isDropValid: isDropValid || false,\n };\n }, [dropIndicatorPosition, isDropValid, useSortableHelpers]);\n\n if (!currentItem) {\n return null;\n }\n return (\n <div ref={draggableProps.setNodeRef} style={{ position: 'relative' }}>\n <ItemRenderer\n item={currentItem as Item<T>}\n draggableProps={draggableProps}\n onCollapse={onCollapse}\n extraItemProps={extraItemProps as K}\n />\n </div>\n );\n};\n\nconst DSSortableItemSchema = describe(DSSortableItem);\n\nDSSortableItemSchema.propTypes = DSSortalItemPropTypes;\n\nexport { DSSortableItemSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC0CjB;AA1CN,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAElC,SAAS,6BAA6B;AAG/B,MAAM,iBAAiB,CAAO,UAAuC;AAC1E,QAAM,EAAE,MAAM,OAAO,WAAW,aAAa,cAAc,eAAe,IAAI;AAC9E,QAAM,MAAM,WAAW,iBAAiB;AAExC,QAAM,cAAc,SAAS,cAAc,SAAY,IAAI,MAAM,eAAe,MAAM,EAAE,SAAS,IAAI;AAErG,QAAM,EAAE,aAAa,uBAAuB,WAAW,IAAI;AAG3D,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,aAAa,QAAQ;AAAA,IAC3B;AAAA,IACA,CAAC,WAAW;AAAA,EACd;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAEvD,QAAM,iBAAkC,QAAQ,MAAM;AACpD,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C,uBAAuB,yBAAyB;AAAA,MAChD,aAAa,eAAe;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,uBAAuB,aAAa,kBAAkB,CAAC;AAE3D,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,EACT;AACA,SACE,oBAAC,SAAI,KAAK,eAAe,YAAY,OAAO,EAAE,UAAU,WAAW,GACjE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF,GACF;AAEJ;AAEA,MAAM,uBAAuB,SAAS,cAAc;AAEpD,qBAAqB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
- import { DropIndicatorPosition } from "./constants.js";
3
2
  import { rectIntersection, closestCorners } from "@dnd-kit/core";
3
+ import { DropIndicatorPosition } from "./constants.js";
4
4
  const insideThreshold = 0.7;
5
5
  const customCollisionDetection = (sensorContext) => {
6
6
  const func = ({ droppableContainers, collisionRect, droppableRects, ...args }) => {
@@ -14,7 +14,7 @@ const customCollisionDetection = (sensorContext) => {
14
14
  });
15
15
  const { id: closestContainerOfContainersId } = rectIntersectionCollisions[0] ?? {};
16
16
  const possibleCollidingContainers = droppableContainers.filter(
17
- (container) => !containersRef.current.includes(container.id) && flattenedItemsDictionary[container.id].container === closestContainerOfContainersId
17
+ (container) => !containersRef.current.includes(container?.id) && flattenedItemsDictionary[container?.id].container === closestContainerOfContainersId
18
18
  );
19
19
  const [collidingContainer, nearesCollidingContainer] = closestCorners({
20
20
  ...args,
@@ -35,10 +35,10 @@ const customCollisionDetection = (sensorContext) => {
35
35
  ];
36
36
  const intersectionPercentage = Math.abs(bottom - top) / Math.min(collisionRect.height, collidingRect.height);
37
37
  const isBefore = collisionRect.top + collisionRect.height / 2 < collidingRect.top + collidingRect.height / 2;
38
- if (intersectionPercentage > insideThreshold && flattenedItemsDictionary[collidingContainer.id].depth + 1 <= maxDragAndDropLevel && collidingContainer.id !== active.id) {
38
+ if (intersectionPercentage > insideThreshold && flattenedItemsDictionary[collidingContainer?.id].depth + 1 <= maxDragAndDropLevel && collidingContainer?.id !== active.id) {
39
39
  dropIndicatorPosition = DropIndicatorPosition.Inside;
40
40
  } else {
41
- const isFirstElement = flattenedItemsDictionary[collidingContainer.id].realIndex === 0;
41
+ const isFirstElement = flattenedItemsDictionary[collidingContainer?.id].realIndex === 0;
42
42
  if (isFirstElement) {
43
43
  dropIndicatorPosition = isBefore ? DropIndicatorPosition.Before : DropIndicatorPosition.After;
44
44
  } else {
@@ -47,7 +47,7 @@ const customCollisionDetection = (sensorContext) => {
47
47
  }
48
48
  return [
49
49
  {
50
- id: isBefore && dropIndicatorPosition === DropIndicatorPosition.After ? nearesCollidingContainer.id : collidingContainer.id,
50
+ id: isBefore && dropIndicatorPosition === DropIndicatorPosition.After ? nearesCollidingContainer?.id : collidingContainer?.id,
51
51
  data: { dropIndicatorPosition }
52
52
  }
53
53
  ];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/tree/customCollisionDetection.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { DropIndicatorPosition } from './constants.js';\nimport { type CollisionDetection, rectIntersection, closestCorners } from '@dnd-kit/core';\nimport type { DnDKitTree } from './types.js';\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, droppableRects, ...args }) => {\n const { active, flattenedItemsDictionary, maxDragAndDropLevel, containersRef } = sensorContext.current;\n\n if (!active) return [];\n\n const rectIntersectionCollisions = rectIntersection({\n ...args,\n droppableRects,\n collisionRect,\n droppableContainers: droppableContainers.filter(({ id }) => containersRef.current.includes(id)),\n });\n\n const { id: closestContainerOfContainersId } = rectIntersectionCollisions[0] ?? {};\n\n const possibleCollidingContainers = droppableContainers.filter(\n (container) =>\n !containersRef.current.includes(container.id) &&\n flattenedItemsDictionary[container.id].container === closestContainerOfContainersId,\n );\n\n const [collidingContainer, nearesCollidingContainer] = closestCorners({\n ...args,\n droppableRects,\n collisionRect,\n droppableContainers: possibleCollidingContainers,\n });\n\n let dropIndicatorPosition: DnDKitTree.DropIndicatorPositionValues = DropIndicatorPosition.None;\n\n // If we didn't find a match, return empty array\n if (!collidingContainer) {\n dropIndicatorPosition = DropIndicatorPosition.Inside;\n return [{ id: closestContainerOfContainersId, data: { dropIndicatorPosition } }];\n }\n\n const collidingRect = possibleCollidingContainers.find((container) => container.id === collidingContainer.id)?.rect\n ?.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 const isBefore = collisionRect.top + collisionRect.height / 2 < collidingRect.top + collidingRect.height / 2;\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 const isFirstElement = flattenedItemsDictionary[collidingContainer.id].realIndex === 0;\n if (isFirstElement) {\n dropIndicatorPosition = isBefore ? DropIndicatorPosition.Before : DropIndicatorPosition.After;\n } else {\n dropIndicatorPosition = DropIndicatorPosition.After;\n }\n }\n\n // Return the id of the match rectangle\n return [\n {\n id:\n isBefore && dropIndicatorPosition === DropIndicatorPosition.After\n ? nearesCollidingContainer.id\n : collidingContainer.id,\n data: { dropIndicatorPosition },\n },\n ];\n };\n return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AAM,cAAc,QAAQ,cAAc,MAAM,cAAc,MAAM;AAAA,IAC7F;AAGA,UAAM,yBAAyB,KAAK,IAAI,SAAS,GAAG,IAAI,KAAK,IAAI,cAAc,QAAQ,cAAc,MAAM;AAC3G,UAAM,WAAW,cAAc,MAAM,cAAc,SAAS,IAAI,cAAc,MAAM,cAAc,SAAS;AAC3G,QACE,yBAAyB,mBACzB,yBAAyB,mBAAmB,EAAE,EAAE,QAAQ,KAAK,uBAC7D,mBAAmB,OAAO,OAAO,IACjC;AACA,8BAAwB,sBAAsB;AAAA,IAChD,OAAO;AACL,YAAM,iBAAiB,yBAAyB,mBAAmB,EAAE,EAAE,cAAc;AACrF,UAAI,gBAAgB;AAClB,gCAAwB,WAAW,sBAAsB,SAAS,sBAAsB;AAAA,MAC1F,OAAO;AACL,gCAAwB,sBAAsB;AAAA,MAChD;AAAA,IACF;AAGA,WAAO;AAAA,MACL;AAAA,QACE,IACE,YAAY,0BAA0B,sBAAsB,QACxD,yBAAyB,KACzB,mBAAmB;AAAA,QACzB,MAAM,EAAE,sBAAsB;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { type CollisionDetection, rectIntersection, closestCorners } from '@dnd-kit/core';\nimport { DropIndicatorPosition } from './constants.js';\nimport type { DnDKitTree } from './types.js';\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, droppableRects, ...args }) => {\n const { active, flattenedItemsDictionary, maxDragAndDropLevel, containersRef } = sensorContext.current;\n\n if (!active) return [];\n\n const rectIntersectionCollisions = rectIntersection({\n ...args,\n droppableRects,\n collisionRect,\n droppableContainers: droppableContainers.filter(({ id }) => containersRef.current.includes(id)),\n });\n\n const { id: closestContainerOfContainersId } = rectIntersectionCollisions[0] ?? {};\n\n const possibleCollidingContainers = droppableContainers.filter(\n (container) =>\n !containersRef.current.includes(container?.id) &&\n flattenedItemsDictionary[container?.id].container === closestContainerOfContainersId,\n );\n\n const [collidingContainer, nearesCollidingContainer] = closestCorners({\n ...args,\n droppableRects,\n collisionRect,\n droppableContainers: possibleCollidingContainers,\n });\n\n let dropIndicatorPosition: DnDKitTree.DropIndicatorPositionValues = DropIndicatorPosition.None;\n\n // If we didn't find a match, return empty array\n if (!collidingContainer) {\n dropIndicatorPosition = DropIndicatorPosition.Inside;\n return [{ id: closestContainerOfContainersId, data: { dropIndicatorPosition } }];\n }\n\n const collidingRect = possibleCollidingContainers.find((container) => container.id === collidingContainer.id)?.rect\n ?.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 const isBefore = collisionRect.top + collisionRect.height / 2 < collidingRect.top + collidingRect.height / 2;\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 const isFirstElement = flattenedItemsDictionary[collidingContainer?.id].realIndex === 0;\n if (isFirstElement) {\n dropIndicatorPosition = isBefore ? DropIndicatorPosition.Before : DropIndicatorPosition.After;\n } else {\n dropIndicatorPosition = DropIndicatorPosition.After;\n }\n }\n\n // Return the id of the match rectangle\n return [\n {\n id:\n isBefore && dropIndicatorPosition === DropIndicatorPosition.After\n ? nearesCollidingContainer?.id\n : collidingContainer?.id,\n data: { dropIndicatorPosition },\n },\n ];\n };\n return func;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAkC,k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;AAGA,UAAM,yBAAyB,KAAK,IAAI,SAAS,GAAG,IAAI,KAAK,IAAI,cAAc,QAAQ,cAAc,MAAM;AAC3G,UAAM,WAAW,cAAc,MAAM,cAAc,SAAS,IAAI,cAAc,MAAM,cAAc,SAAS;AAC3G,QACE,yBAAyB,mBACzB,yBAAyB,oBAAoB,EAAE,EAAE,QAAQ,KAAK,uBAC9D,oBAAoB,OAAO,OAAO,IAClC;AACA,8BAAwB,sBAAsB;AAAA,IAChD,OAAO;AACL,YAAM,iBAAiB,yBAAyB,oBAAoB,EAAE,EAAE,cAAc;AACtF,UAAI,gBAAgB;AAClB,gCAAwB,WAAW,sBAAsB,SAAS,sBAAsB;AAAA,MAC1F,OAAO;AACL,gCAAwB,sBAAsB;AAAA,MAChD;AAAA,IACF;AAGA,WAAO;AAAA,MACL;AAAA,QACE,IACE,YAAY,0BAA0B,sBAAsB,QACxD,0BAA0B,KAC1B,oBAAoB;AAAA,QAC1B,MAAM,EAAE,sBAAsB;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,15 +1,4 @@
1
- import React from 'react';
2
1
  import type { DSSortableContainerT } from './react-desc-prop-types.js';
3
- import type { DnDKitTree } from '../../tree/types.js';
4
- interface ContainerContextT<T> {
5
- isDropValid?: boolean;
6
- dropIndicatorPosition?: string;
7
- sortableContextProps: Record<string, DnDKitTree.SortableContextPropsType>;
8
- items: Record<string, DSSortableContainerT.Item<T>[]>;
9
- onCollapse?: (nodeId: string) => void;
10
- }
11
- export declare function createContainerContext<T>(): React.Context<ContainerContextT<T>>;
12
- export declare const ContainersContext: React.Context<ContainerContextT<unknown>>;
13
2
  export declare const DSSortableContainer: <T, K>(props: DSSortableContainerT.Props<T, K>) => import("react/jsx-runtime.js").JSX.Element;
14
3
  declare const DSSortableContainerSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSSortableContainerT.Props<unknown, unknown>>;
15
4
  export { DSSortableContainerSchema };
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import type { DnDKitTree } from '../../../tree/types.js';
3
+ import type { DSSortableContainerT } from '../react-desc-prop-types.js';
4
+ interface ContainerContextT<T> {
5
+ isDropValid?: boolean;
6
+ dropIndicatorPosition?: string;
7
+ sortableContextProps: Record<string, DnDKitTree.SortableContextPropsType>;
8
+ items: Record<string, DSSortableContainerT.Item<T>[]>;
9
+ onCollapse?: (nodeId: string) => void;
10
+ }
11
+ export declare function createContainerContext<T>(): import("react").Context<ContainerContextT<T>>;
12
+ export declare const ContainersContext: import("react").Context<ContainerContextT<unknown>>;
13
+ export {};
@@ -1,2 +1,3 @@
1
- export { DSSortableContainer, DSSortableContainerSchema, ContainersContext } from './DSSortableContainer.js';
1
+ export { DSSortableContainer, DSSortableContainerSchema } from './DSSortableContainer.js';
2
+ export { ContainersContext } from './config/SortableContainerContext.js';
2
3
  export type { DSSortableContainerT } from './react-desc-prop-types.js';
@@ -14,7 +14,7 @@ export declare namespace DSSortableContainerT {
14
14
  Component: React.ComponentType<WrapperComponentProps>;
15
15
  }
16
16
  interface ContainerItemRendererT<T, K> {
17
- extraItemProps: {
17
+ extraItemProps?: {
18
18
  items: Item<T>[];
19
19
  extraItemProps: K;
20
20
  ItemRenderer: React.ComponentType<ItemRendererPropsT<T, K>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-drag-and-drop",
3
- "version": "3.37.2",
3
+ "version": "3.38.0-rc.0",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Drag And Drop",
6
6
  "files": [
@@ -111,16 +111,16 @@
111
111
  "@dnd-kit/core": "~6.0.8",
112
112
  "@dnd-kit/modifiers": "~6.0.1",
113
113
  "@dnd-kit/sortable": "~7.0.2",
114
- "@elliemae/ds-fast-list": "3.37.2",
115
- "@elliemae/ds-system": "3.37.2",
116
- "@elliemae/ds-typescript-helpers": "3.37.2",
117
- "@elliemae/ds-props-helpers": "3.37.2",
118
- "@elliemae/ds-tree-model": "3.37.2"
114
+ "@elliemae/ds-fast-list": "3.38.0-rc.0",
115
+ "@elliemae/ds-system": "3.38.0-rc.0",
116
+ "@elliemae/ds-props-helpers": "3.38.0-rc.0",
117
+ "@elliemae/ds-typescript-helpers": "3.38.0-rc.0",
118
+ "@elliemae/ds-tree-model": "3.38.0-rc.0"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@elliemae/pui-cli": "9.0.0-next.50",
122
122
  "styled-components": "~5.3.9",
123
- "@elliemae/ds-monorepo-devops": "3.37.2"
123
+ "@elliemae/ds-monorepo-devops": "3.38.0-rc.0"
124
124
  },
125
125
  "peerDependencies": {
126
126
  "lodash": "^4.17.21",