@elliemae/ds-drag-and-drop 2.3.2 → 2.4.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-drag-and-drop",
3
- "version": "2.3.2",
3
+ "version": "2.4.0-rc.1",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Drag And Drop",
6
6
  "module": "./esm/index.js",
@@ -40,39 +40,40 @@ export declare type UseTreePreviewHandlersArgs = {
40
40
  setActiveId: React.Dispatch<React.SetStateAction<string>>;
41
41
  setDropIndicatorPosition: React.Dispatch<React.SetStateAction<DropIndicatorPosition>>;
42
42
  };
43
- export declare type UseTreeActionHandlersArgs<T = unknown> = UseTreePreviewHandlersReturn & {
43
+ declare type UseTreeActionHandlersArgs<T = unknown> = UseTreePreviewHandlersReturn & {
44
44
  dropIndicatorPosition: DropIndicatorPosition;
45
- flattenedItems: Item[];
45
+ flattenedItems: Item<T>[];
46
46
  projected: {
47
47
  depth: number;
48
- parentId: string;
48
+ parentId: string | null;
49
49
  } | null;
50
- onReorder: <S = T>(newData: Item<S>[], indexes: {
50
+ onReorder: (newData: Item<T>[], indexes: {
51
51
  targetIndex: number;
52
52
  fromIndex: number;
53
53
  }, considerExpanding: string) => void;
54
54
  isDropValid: boolean;
55
55
  };
56
- export declare type UseTreeActionHandlersReturn = {
56
+ declare type UseTreeActionHandlersReturn = {
57
57
  onDragStart: (e: DragStartEvent) => void;
58
58
  onDragMove: (e: DragMoveEvent) => void;
59
59
  onDragOver: (e: DragOverEvent) => void;
60
60
  onDragEnd: (e: DragEndEvent) => void;
61
61
  onDragCancel: (e: DragCancelEvent) => void;
62
62
  };
63
+ export declare type UseTreeActionHandlersType = <T = unknown>(args: UseTreeActionHandlersArgs<T>) => UseTreeActionHandlersReturn;
63
64
  export declare type UseTreeDndkitConfigArgs<T> = {
64
- flattenedItems: Item[];
65
- visibleItems: Item[];
65
+ flattenedItems: Item<T>[];
66
+ visibleItems: Item<T>[];
66
67
  isHorizontalDnD?: boolean;
67
68
  isExpandable: boolean;
68
- onReorder: <S = T>(newData: Item<S>[], indexes: {
69
+ onReorder: (newData: Item<T>[], indexes: {
69
70
  targetIndex: number;
70
71
  fromIndex: number;
71
72
  }, considerExpanding: string) => void;
72
- getIsDropValid: <S = T>(active: Item<S>, over: Item<S>, dropIndicatorPosition: 'none' | 'before' | 'after' | 'inside') => boolean;
73
+ getIsDropValid: (active: Item<T>, over: Item<T>, dropIndicatorPosition: 'none' | 'before' | 'after' | 'inside') => boolean;
73
74
  maxDragAndDropLevel: number;
74
75
  };
75
- export declare type UseTreeDndkitConfigReturn = {
76
+ export declare type UseTreeDndkitConfigReturn<T> = {
76
77
  dndContextProps: DndContextPropsType;
77
78
  sortableContextProps: SortableContextPropsType;
78
79
  activeId: string;
@@ -81,9 +82,9 @@ export declare type UseTreeDndkitConfigReturn = {
81
82
  depth: number;
82
83
  dropIndicatorPosition: DropIndicatorPosition;
83
84
  isDropValid: boolean;
84
- visibleItems: Item[];
85
+ visibleItems: Item<T>[];
85
86
  };
86
- export declare type UseTreeDndkitConfigType = <T = unknown>(args: UseTreeDndkitConfigArgs<T>) => UseTreeDndkitConfigReturn;
87
+ export declare type UseTreeDndkitConfigType = <T = unknown>(args: UseTreeDndkitConfigArgs<T>) => UseTreeDndkitConfigReturn<T>;
87
88
  export declare type GetKeyboardCoordinatesArgs = {
88
89
  items: Item[];
89
90
  active: Active;
@@ -100,3 +101,4 @@ export declare type SensorContext = MutableRefObject<{
100
101
  dropIndicatorPosition: DropIndicatorPosition;
101
102
  setDropIndicatorPosition: React.Dispatch<React.SetStateAction<DropIndicatorPosition>>;
102
103
  }>;
104
+ export {};
@@ -1,2 +1,2 @@
1
- import type { UseTreeActionHandlersReturn, UseTreeActionHandlersArgs } from './types';
2
- export declare const useTreeActionHandlers: ({ handlePreviewDragStart, handlePreviewDragMove, handlePreviewDragOver, handlePreviewDragEnd, handlePreviewDragCancel, onReorder, flattenedItems, projected, dropIndicatorPosition, isDropValid, }: UseTreeActionHandlersArgs) => UseTreeActionHandlersReturn;
1
+ import type { UseTreeActionHandlersType } from './types';
2
+ export declare const useTreeActionHandlers: UseTreeActionHandlersType;
@@ -2,6 +2,6 @@ import { DropIndicatorPosition } from './constants';
2
2
  import { Item } from './types';
3
3
  export declare const getProjection: (items: Item[], visibleItemsDictionary: Record<string, Item>, overId: string, dropIndicatorPosition: DropIndicatorPosition, isExpandable: boolean) => {
4
4
  depth: number;
5
- parentId: string;
5
+ parentId: string | null;
6
6
  };
7
- export declare const removeChildrenOf: (items: Item[], id: string) => Item[];
7
+ export declare const removeChildrenOf: <T>(items: Item<T>[], id: string) => Item<T>[];