@react-aria/dnd 3.9.2 → 3.10.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 (40) hide show
  1. package/dist/DragManager.main.js +79 -12
  2. package/dist/DragManager.main.js.map +1 -1
  3. package/dist/DragManager.mjs +79 -12
  4. package/dist/DragManager.module.js +79 -12
  5. package/dist/DragManager.module.js.map +1 -1
  6. package/dist/DropTargetKeyboardNavigation.main.js +201 -0
  7. package/dist/DropTargetKeyboardNavigation.main.js.map +1 -0
  8. package/dist/DropTargetKeyboardNavigation.mjs +196 -0
  9. package/dist/DropTargetKeyboardNavigation.module.js +196 -0
  10. package/dist/DropTargetKeyboardNavigation.module.js.map +1 -0
  11. package/dist/ListDropTargetDelegate.main.js.map +1 -1
  12. package/dist/ListDropTargetDelegate.module.js.map +1 -1
  13. package/dist/types.d.ts +7 -1
  14. package/dist/types.d.ts.map +1 -1
  15. package/dist/useDrop.main.js.map +1 -1
  16. package/dist/useDrop.module.js.map +1 -1
  17. package/dist/useDropIndicator.main.js +15 -7
  18. package/dist/useDropIndicator.main.js.map +1 -1
  19. package/dist/useDropIndicator.mjs +15 -7
  20. package/dist/useDropIndicator.module.js +15 -7
  21. package/dist/useDropIndicator.module.js.map +1 -1
  22. package/dist/useDroppableCollection.main.js +33 -103
  23. package/dist/useDroppableCollection.main.js.map +1 -1
  24. package/dist/useDroppableCollection.mjs +33 -103
  25. package/dist/useDroppableCollection.module.js +33 -103
  26. package/dist/useDroppableCollection.module.js.map +1 -1
  27. package/dist/useDroppableItem.main.js +4 -2
  28. package/dist/useDroppableItem.main.js.map +1 -1
  29. package/dist/useDroppableItem.mjs +4 -2
  30. package/dist/useDroppableItem.module.js +4 -2
  31. package/dist/useDroppableItem.module.js.map +1 -1
  32. package/package.json +17 -12
  33. package/src/.DS_Store +0 -0
  34. package/src/DragManager.ts +66 -17
  35. package/src/DropTargetKeyboardNavigation.ts +273 -0
  36. package/src/ListDropTargetDelegate.ts +1 -1
  37. package/src/useDrop.ts +0 -1
  38. package/src/useDropIndicator.ts +17 -11
  39. package/src/useDroppableCollection.ts +41 -134
  40. package/src/useDroppableItem.ts +7 -4
@@ -0,0 +1,196 @@
1
+ import {getChildNodes as $9nGAq$getChildNodes} from "@react-stately/collections";
2
+
3
+
4
+ function $e154566cef11553b$export$ff7962acd6052c28(keyboardDelegate, collection, target, direction, rtl = false, wrap = false) {
5
+ switch(direction){
6
+ case 'left':
7
+ return rtl ? $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap, 'left') : $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap, 'left');
8
+ case 'right':
9
+ return rtl ? $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap, 'right') : $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap, 'right');
10
+ case 'up':
11
+ return $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap);
12
+ case 'down':
13
+ return $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap);
14
+ }
15
+ }
16
+ function $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap = false, horizontal = null) {
17
+ if (!target) return {
18
+ type: 'root'
19
+ };
20
+ if (target.type === 'root') {
21
+ var _keyboardDelegate_getFirstKey;
22
+ var _keyboardDelegate_getFirstKey1;
23
+ let nextKey = (_keyboardDelegate_getFirstKey1 = (_keyboardDelegate_getFirstKey = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey === void 0 ? void 0 : _keyboardDelegate_getFirstKey.call(keyboardDelegate)) !== null && _keyboardDelegate_getFirstKey1 !== void 0 ? _keyboardDelegate_getFirstKey1 : null;
24
+ if (nextKey != null) return {
25
+ type: 'item',
26
+ key: nextKey,
27
+ dropPosition: 'before'
28
+ };
29
+ return null;
30
+ }
31
+ if (target.type === 'item') {
32
+ var _keyboardDelegate_getKeyRightOf, _keyboardDelegate_getKeyLeftOf, _keyboardDelegate_getKeyBelow;
33
+ let nextKey = null;
34
+ if (horizontal) nextKey = horizontal === 'right' ? (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key);
35
+ else nextKey = (_keyboardDelegate_getKeyBelow = keyboardDelegate.getKeyBelow) === null || _keyboardDelegate_getKeyBelow === void 0 ? void 0 : _keyboardDelegate_getKeyBelow.call(keyboardDelegate, target.key);
36
+ let nextCollectionKey = collection.getKeyAfter(target.key);
37
+ // If the keyboard delegate did not move to the next key in the collection,
38
+ // jump to that key with the same drop position. Otherwise, try the other
39
+ // drop positions on the current key first.
40
+ if (nextKey != null && nextKey !== nextCollectionKey) return {
41
+ type: 'item',
42
+ key: nextKey,
43
+ dropPosition: target.dropPosition
44
+ };
45
+ switch(target.dropPosition){
46
+ case 'before':
47
+ return {
48
+ type: 'item',
49
+ key: target.key,
50
+ dropPosition: 'on'
51
+ };
52
+ case 'on':
53
+ {
54
+ // If there are nested items, traverse to them prior to the "after" position of this target.
55
+ // If the next key is on the same level, then its "before" position is equivalent to this item's "after" position.
56
+ let targetNode = collection.getItem(target.key);
57
+ let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
58
+ if (targetNode && nextNode && nextNode.level >= targetNode.level) return {
59
+ type: 'item',
60
+ key: nextNode.key,
61
+ dropPosition: 'before'
62
+ };
63
+ return {
64
+ type: 'item',
65
+ key: target.key,
66
+ dropPosition: 'after'
67
+ };
68
+ }
69
+ case 'after':
70
+ {
71
+ // If this is the last sibling in a level, traverse to the parent.
72
+ let targetNode = collection.getItem(target.key);
73
+ if (targetNode && targetNode.nextKey == null && targetNode.parentKey != null) {
74
+ // If the parent item has an item after it, use the "before" position.
75
+ let parentNode = collection.getItem(targetNode.parentKey);
76
+ if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.nextKey) != null) return {
77
+ type: 'item',
78
+ key: parentNode.nextKey,
79
+ dropPosition: 'before'
80
+ };
81
+ if (parentNode) return {
82
+ type: 'item',
83
+ key: parentNode.key,
84
+ dropPosition: 'after'
85
+ };
86
+ }
87
+ if ((targetNode === null || targetNode === void 0 ? void 0 : targetNode.nextKey) != null) return {
88
+ type: 'item',
89
+ key: targetNode.nextKey,
90
+ dropPosition: 'on'
91
+ };
92
+ }
93
+ }
94
+ }
95
+ if (wrap) return {
96
+ type: 'root'
97
+ };
98
+ return null;
99
+ }
100
+ function $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap = false, horizontal = null) {
101
+ // Start after the last root-level item.
102
+ if (!target || wrap && target.type === 'root') {
103
+ var _keyboardDelegate_getLastKey;
104
+ // Keyboard delegate gets the deepest item but we want the shallowest.
105
+ let prevKey = null;
106
+ let lastKey = (_keyboardDelegate_getLastKey = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey === void 0 ? void 0 : _keyboardDelegate_getLastKey.call(keyboardDelegate);
107
+ while(lastKey != null){
108
+ prevKey = lastKey;
109
+ let node = collection.getItem(lastKey);
110
+ lastKey = node === null || node === void 0 ? void 0 : node.parentKey;
111
+ }
112
+ if (prevKey != null) return {
113
+ type: 'item',
114
+ key: prevKey,
115
+ dropPosition: 'after'
116
+ };
117
+ return null;
118
+ }
119
+ if (target.type === 'item') {
120
+ var _keyboardDelegate_getKeyLeftOf, _keyboardDelegate_getKeyRightOf, _keyboardDelegate_getKeyAbove;
121
+ let prevKey = null;
122
+ if (horizontal) prevKey = horizontal === 'left' ? (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key);
123
+ else prevKey = (_keyboardDelegate_getKeyAbove = keyboardDelegate.getKeyAbove) === null || _keyboardDelegate_getKeyAbove === void 0 ? void 0 : _keyboardDelegate_getKeyAbove.call(keyboardDelegate, target.key);
124
+ let prevCollectionKey = collection.getKeyBefore(target.key);
125
+ // If the keyboard delegate did not move to the next key in the collection,
126
+ // jump to that key with the same drop position. Otherwise, try the other
127
+ // drop positions on the current key first.
128
+ if (prevKey != null && prevKey !== prevCollectionKey) return {
129
+ type: 'item',
130
+ key: prevKey,
131
+ dropPosition: target.dropPosition
132
+ };
133
+ switch(target.dropPosition){
134
+ case 'before':
135
+ {
136
+ // Move after the last child of the previous item.
137
+ let targetNode = collection.getItem(target.key);
138
+ if (targetNode && targetNode.prevKey != null) {
139
+ let lastChild = $e154566cef11553b$var$getLastChild(collection, targetNode.prevKey);
140
+ if (lastChild) return lastChild;
141
+ }
142
+ if (prevKey != null) return {
143
+ type: 'item',
144
+ key: prevKey,
145
+ dropPosition: 'on'
146
+ };
147
+ return {
148
+ type: 'root'
149
+ };
150
+ }
151
+ case 'on':
152
+ return {
153
+ type: 'item',
154
+ key: target.key,
155
+ dropPosition: 'before'
156
+ };
157
+ case 'after':
158
+ {
159
+ // Move after the last child of this item.
160
+ let lastChild = $e154566cef11553b$var$getLastChild(collection, target.key);
161
+ if (lastChild) return lastChild;
162
+ return {
163
+ type: 'item',
164
+ key: target.key,
165
+ dropPosition: 'on'
166
+ };
167
+ }
168
+ }
169
+ }
170
+ if (target.type !== 'root') return {
171
+ type: 'root'
172
+ };
173
+ return null;
174
+ }
175
+ function $e154566cef11553b$var$getLastChild(collection, key) {
176
+ // getChildNodes still returns child tree items even when the item is collapsed.
177
+ // Checking if the next item has a greater level is a silly way to determine if the item is expanded.
178
+ let targetNode = collection.getItem(key);
179
+ let nextKey = collection.getKeyAfter(key);
180
+ let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
181
+ if (targetNode && nextNode && nextNode.level > targetNode.level) {
182
+ let children = (0, $9nGAq$getChildNodes)(targetNode, collection);
183
+ let lastChild = null;
184
+ for (let child of children)if (child.type === 'item') lastChild = child;
185
+ if (lastChild) return {
186
+ type: 'item',
187
+ key: lastChild.key,
188
+ dropPosition: 'after'
189
+ };
190
+ }
191
+ return null;
192
+ }
193
+
194
+
195
+ export {$e154566cef11553b$export$ff7962acd6052c28 as navigate};
196
+ //# sourceMappingURL=DropTargetKeyboardNavigation.module.js.map
@@ -0,0 +1,196 @@
1
+ import {getChildNodes as $9nGAq$getChildNodes} from "@react-stately/collections";
2
+
3
+
4
+ function $e154566cef11553b$export$ff7962acd6052c28(keyboardDelegate, collection, target, direction, rtl = false, wrap = false) {
5
+ switch(direction){
6
+ case 'left':
7
+ return rtl ? $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap, 'left') : $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap, 'left');
8
+ case 'right':
9
+ return rtl ? $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap, 'right') : $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap, 'right');
10
+ case 'up':
11
+ return $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap);
12
+ case 'down':
13
+ return $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap);
14
+ }
15
+ }
16
+ function $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap = false, horizontal = null) {
17
+ if (!target) return {
18
+ type: 'root'
19
+ };
20
+ if (target.type === 'root') {
21
+ var _keyboardDelegate_getFirstKey;
22
+ var _keyboardDelegate_getFirstKey1;
23
+ let nextKey = (_keyboardDelegate_getFirstKey1 = (_keyboardDelegate_getFirstKey = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey === void 0 ? void 0 : _keyboardDelegate_getFirstKey.call(keyboardDelegate)) !== null && _keyboardDelegate_getFirstKey1 !== void 0 ? _keyboardDelegate_getFirstKey1 : null;
24
+ if (nextKey != null) return {
25
+ type: 'item',
26
+ key: nextKey,
27
+ dropPosition: 'before'
28
+ };
29
+ return null;
30
+ }
31
+ if (target.type === 'item') {
32
+ var _keyboardDelegate_getKeyRightOf, _keyboardDelegate_getKeyLeftOf, _keyboardDelegate_getKeyBelow;
33
+ let nextKey = null;
34
+ if (horizontal) nextKey = horizontal === 'right' ? (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key);
35
+ else nextKey = (_keyboardDelegate_getKeyBelow = keyboardDelegate.getKeyBelow) === null || _keyboardDelegate_getKeyBelow === void 0 ? void 0 : _keyboardDelegate_getKeyBelow.call(keyboardDelegate, target.key);
36
+ let nextCollectionKey = collection.getKeyAfter(target.key);
37
+ // If the keyboard delegate did not move to the next key in the collection,
38
+ // jump to that key with the same drop position. Otherwise, try the other
39
+ // drop positions on the current key first.
40
+ if (nextKey != null && nextKey !== nextCollectionKey) return {
41
+ type: 'item',
42
+ key: nextKey,
43
+ dropPosition: target.dropPosition
44
+ };
45
+ switch(target.dropPosition){
46
+ case 'before':
47
+ return {
48
+ type: 'item',
49
+ key: target.key,
50
+ dropPosition: 'on'
51
+ };
52
+ case 'on':
53
+ {
54
+ // If there are nested items, traverse to them prior to the "after" position of this target.
55
+ // If the next key is on the same level, then its "before" position is equivalent to this item's "after" position.
56
+ let targetNode = collection.getItem(target.key);
57
+ let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
58
+ if (targetNode && nextNode && nextNode.level >= targetNode.level) return {
59
+ type: 'item',
60
+ key: nextNode.key,
61
+ dropPosition: 'before'
62
+ };
63
+ return {
64
+ type: 'item',
65
+ key: target.key,
66
+ dropPosition: 'after'
67
+ };
68
+ }
69
+ case 'after':
70
+ {
71
+ // If this is the last sibling in a level, traverse to the parent.
72
+ let targetNode = collection.getItem(target.key);
73
+ if (targetNode && targetNode.nextKey == null && targetNode.parentKey != null) {
74
+ // If the parent item has an item after it, use the "before" position.
75
+ let parentNode = collection.getItem(targetNode.parentKey);
76
+ if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.nextKey) != null) return {
77
+ type: 'item',
78
+ key: parentNode.nextKey,
79
+ dropPosition: 'before'
80
+ };
81
+ if (parentNode) return {
82
+ type: 'item',
83
+ key: parentNode.key,
84
+ dropPosition: 'after'
85
+ };
86
+ }
87
+ if ((targetNode === null || targetNode === void 0 ? void 0 : targetNode.nextKey) != null) return {
88
+ type: 'item',
89
+ key: targetNode.nextKey,
90
+ dropPosition: 'on'
91
+ };
92
+ }
93
+ }
94
+ }
95
+ if (wrap) return {
96
+ type: 'root'
97
+ };
98
+ return null;
99
+ }
100
+ function $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap = false, horizontal = null) {
101
+ // Start after the last root-level item.
102
+ if (!target || wrap && target.type === 'root') {
103
+ var _keyboardDelegate_getLastKey;
104
+ // Keyboard delegate gets the deepest item but we want the shallowest.
105
+ let prevKey = null;
106
+ let lastKey = (_keyboardDelegate_getLastKey = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey === void 0 ? void 0 : _keyboardDelegate_getLastKey.call(keyboardDelegate);
107
+ while(lastKey != null){
108
+ prevKey = lastKey;
109
+ let node = collection.getItem(lastKey);
110
+ lastKey = node === null || node === void 0 ? void 0 : node.parentKey;
111
+ }
112
+ if (prevKey != null) return {
113
+ type: 'item',
114
+ key: prevKey,
115
+ dropPosition: 'after'
116
+ };
117
+ return null;
118
+ }
119
+ if (target.type === 'item') {
120
+ var _keyboardDelegate_getKeyLeftOf, _keyboardDelegate_getKeyRightOf, _keyboardDelegate_getKeyAbove;
121
+ let prevKey = null;
122
+ if (horizontal) prevKey = horizontal === 'left' ? (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key);
123
+ else prevKey = (_keyboardDelegate_getKeyAbove = keyboardDelegate.getKeyAbove) === null || _keyboardDelegate_getKeyAbove === void 0 ? void 0 : _keyboardDelegate_getKeyAbove.call(keyboardDelegate, target.key);
124
+ let prevCollectionKey = collection.getKeyBefore(target.key);
125
+ // If the keyboard delegate did not move to the next key in the collection,
126
+ // jump to that key with the same drop position. Otherwise, try the other
127
+ // drop positions on the current key first.
128
+ if (prevKey != null && prevKey !== prevCollectionKey) return {
129
+ type: 'item',
130
+ key: prevKey,
131
+ dropPosition: target.dropPosition
132
+ };
133
+ switch(target.dropPosition){
134
+ case 'before':
135
+ {
136
+ // Move after the last child of the previous item.
137
+ let targetNode = collection.getItem(target.key);
138
+ if (targetNode && targetNode.prevKey != null) {
139
+ let lastChild = $e154566cef11553b$var$getLastChild(collection, targetNode.prevKey);
140
+ if (lastChild) return lastChild;
141
+ }
142
+ if (prevKey != null) return {
143
+ type: 'item',
144
+ key: prevKey,
145
+ dropPosition: 'on'
146
+ };
147
+ return {
148
+ type: 'root'
149
+ };
150
+ }
151
+ case 'on':
152
+ return {
153
+ type: 'item',
154
+ key: target.key,
155
+ dropPosition: 'before'
156
+ };
157
+ case 'after':
158
+ {
159
+ // Move after the last child of this item.
160
+ let lastChild = $e154566cef11553b$var$getLastChild(collection, target.key);
161
+ if (lastChild) return lastChild;
162
+ return {
163
+ type: 'item',
164
+ key: target.key,
165
+ dropPosition: 'on'
166
+ };
167
+ }
168
+ }
169
+ }
170
+ if (target.type !== 'root') return {
171
+ type: 'root'
172
+ };
173
+ return null;
174
+ }
175
+ function $e154566cef11553b$var$getLastChild(collection, key) {
176
+ // getChildNodes still returns child tree items even when the item is collapsed.
177
+ // Checking if the next item has a greater level is a silly way to determine if the item is expanded.
178
+ let targetNode = collection.getItem(key);
179
+ let nextKey = collection.getKeyAfter(key);
180
+ let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
181
+ if (targetNode && nextNode && nextNode.level > targetNode.level) {
182
+ let children = (0, $9nGAq$getChildNodes)(targetNode, collection);
183
+ let lastChild = null;
184
+ for (let child of children)if (child.type === 'item') lastChild = child;
185
+ if (lastChild) return {
186
+ type: 'item',
187
+ key: lastChild.key,
188
+ dropPosition: 'after'
189
+ };
190
+ }
191
+ return null;
192
+ }
193
+
194
+
195
+ export {$e154566cef11553b$export$ff7962acd6052c28 as navigate};
196
+ //# sourceMappingURL=DropTargetKeyboardNavigation.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAGO,SAAS,0CACd,gBAAkC,EAClC,UAAqC,EACrC,MAAqC,EACrC,SAA2C,EAC3C,MAAM,KAAK,EACX,OAAO,KAAK;IAEZ,OAAQ;QACN,KAAK;YACH,OAAO,MACH,qCAAe,kBAAkB,YAAY,QAAQ,MAAM,UAC3D,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM;QACrE,KAAK;YACH,OAAO,MACH,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM,WAC/D,qCAAe,kBAAkB,YAAY,QAAQ,MAAM;QACjE,KAAK;YACH,OAAO,yCAAmB,kBAAkB,YAAY,QAAQ;QAClE,KAAK;YACH,OAAO,qCAAe,kBAAkB,YAAY,QAAQ;IAChE;AACF;AAEA,SAAS,qCACP,gBAAkC,EAClC,UAAqC,EACrC,MAAqC,EACrC,OAAO,KAAK,EACZ,aAAsC,IAAI;IAE1C,IAAI,CAAC,QACH,OAAO;QACL,M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C,WAAW;IAC/D,IAAI,cAAc,YAAY,SAAS,KAAK,GAAG,WAAW,KAAK,EAAE;QAC/D,IAAI,WAAW,CAAA,GAAA,oBAAY,EAAE,YAAY;QACzC,IAAI,YAAkC;QACtC,KAAK,IAAI,SAAS,SAChB,IAAI,MAAM,IAAI,KAAK,QACjB,YAAY;QAIhB,IAAI,WACF,OAAO;YACL,MAAM;YACN,KAAK,UAAU,GAAG;YAClB,cAAc;QAChB;IAEJ;IAEA,OAAO;AACT","sources":["packages/@react-aria/dnd/src/DropTargetKeyboardNavigation.ts"],"sourcesContent":["import {Collection, DropTarget, Key, KeyboardDelegate, Node} from '@react-types/shared';\nimport {getChildNodes} from '@react-stately/collections';\n\nexport function navigate(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n direction: 'left' | 'right' | 'up' | 'down',\n rtl = false,\n wrap = false\n): DropTarget | null {\n switch (direction) {\n case 'left':\n return rtl \n ? nextDropTarget(keyboardDelegate, collection, target, wrap, 'left')\n : previousDropTarget(keyboardDelegate, collection, target, wrap, 'left');\n case 'right':\n return rtl \n ? previousDropTarget(keyboardDelegate, collection, target, wrap, 'right')\n : nextDropTarget(keyboardDelegate, collection, target, wrap, 'right');\n case 'up':\n return previousDropTarget(keyboardDelegate, collection, target, wrap);\n case 'down':\n return nextDropTarget(keyboardDelegate, collection, target, wrap);\n }\n}\n\nfunction nextDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n if (!target) {\n return {\n type: 'root'\n };\n }\n\n if (target.type === 'root') {\n let nextKey = keyboardDelegate.getFirstKey?.() ?? null;\n if (nextKey != null) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: 'before'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let nextKey: Key | null | undefined = null;\n if (horizontal) {\n nextKey = horizontal === 'right' ? keyboardDelegate.getKeyRightOf?.(target.key) : keyboardDelegate.getKeyLeftOf?.(target.key);\n } else {\n nextKey = keyboardDelegate.getKeyBelow?.(target.key);\n }\n let nextCollectionKey = collection.getKeyAfter(target.key);\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (nextKey != null && nextKey !== nextCollectionKey) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: target.dropPosition\n };\n }\n \n switch (target.dropPosition) {\n case 'before': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n case 'on': {\n // If there are nested items, traverse to them prior to the \"after\" position of this target.\n // If the next key is on the same level, then its \"before\" position is equivalent to this item's \"after\" position.\n let targetNode = collection.getItem(target.key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level >= targetNode.level) {\n return {\n type: 'item',\n key: nextNode.key,\n dropPosition: 'before'\n };\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'after'\n };\n }\n case 'after': {\n // If this is the last sibling in a level, traverse to the parent.\n let targetNode = collection.getItem(target.key); \n if (targetNode && targetNode.nextKey == null && targetNode.parentKey != null) {\n // If the parent item has an item after it, use the \"before\" position.\n let parentNode = collection.getItem(targetNode.parentKey);\n if (parentNode?.nextKey != null) {\n return {\n type: 'item',\n key: parentNode.nextKey,\n dropPosition: 'before'\n };\n }\n\n if (parentNode) {\n return {\n type: 'item',\n key: parentNode.key,\n dropPosition: 'after'\n };\n }\n }\n\n if (targetNode?.nextKey != null) {\n return {\n type: 'item',\n key: targetNode.nextKey,\n dropPosition: 'on'\n };\n }\n }\n }\n }\n\n if (wrap) {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction previousDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n // Start after the last root-level item.\n if (!target || (wrap && target.type === 'root')) {\n // Keyboard delegate gets the deepest item but we want the shallowest.\n let prevKey: Key | null = null;\n let lastKey = keyboardDelegate.getLastKey?.();\n while (lastKey != null) {\n prevKey = lastKey;\n let node = collection.getItem(lastKey);\n lastKey = node?.parentKey;\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'after'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let prevKey: Key | null | undefined = null;\n if (horizontal) {\n prevKey = horizontal === 'left' ? keyboardDelegate.getKeyLeftOf?.(target.key) : keyboardDelegate.getKeyRightOf?.(target.key);\n } else {\n prevKey = keyboardDelegate.getKeyAbove?.(target.key);\n }\n let prevCollectionKey = collection.getKeyBefore(target.key);\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (prevKey != null && prevKey !== prevCollectionKey) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: target.dropPosition\n };\n }\n\n switch (target.dropPosition) {\n case 'before': {\n // Move after the last child of the previous item.\n let targetNode = collection.getItem(target.key);\n if (targetNode && targetNode.prevKey != null) {\n let lastChild = getLastChild(collection, targetNode.prevKey);\n if (lastChild) {\n return lastChild;\n }\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'on'\n };\n }\n\n return {\n type: 'root'\n };\n }\n case 'on': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'before'\n };\n }\n case 'after': {\n // Move after the last child of this item.\n let lastChild = getLastChild(collection, target.key);\n if (lastChild) {\n return lastChild;\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n }\n }\n\n if (target.type !== 'root') {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction getLastChild(collection: Collection<Node<unknown>>, key: Key): DropTarget | null {\n // getChildNodes still returns child tree items even when the item is collapsed.\n // Checking if the next item has a greater level is a silly way to determine if the item is expanded.\n let targetNode = collection.getItem(key);\n let nextKey = collection.getKeyAfter(key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level > targetNode.level) {\n let children = getChildNodes(targetNode, collection);\n let lastChild: Node<unknown> | null = null;\n for (let child of children) {\n if (child.type === 'item') {\n lastChild = child;\n }\n }\n\n if (lastChild) {\n return {\n type: 'item',\n key: lastChild.key,\n dropPosition: 'after'\n };\n }\n }\n\n return null;\n}\n"],"names":[],"version":3,"file":"DropTargetKeyboardNavigation.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,GAAG,KAAK,IAAI;IACjE;IAEQ,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,MAAM,GAAG,KAAK,KAAK;IACrE;IAEQ,aAAa,IAAa,EAAE;QAClC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,eAAe,CAAC,QAAQ,IAAI,CAAC,iBAAiB,CAAC;IACvF;IAEQ,WAAW,IAAa,EAAE;QAChC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,eAAe,CAAC;IACnF;IAEQ,YAAY,IAAa,EAAE;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,IAAI,CAAC,YAAY,CAAC;IACnD;IAEA,uBAAuB,CAAS,EAAE,CAAS,EAAE,iBAAkD,EAAc;YAgB1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ACrE,OAAO,YAAY,GAAG,YAAY,UAAU;yBACvC,IAAI,QAAQ,OAAO,kBAAkB;wBAAC,GAAG,MAAM;wBAAE,cAAc;oBAAO,IAC3E,OAAO,YAAY,GAAG,YAAY,WAAW;gBAEjD;gBAEA,OAAO;YACT;QACF;QAEA,IAAI,OAAO,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,MAAM,MAAM,GAAG,GAAG;QACjD,IAAI,UAAU,WAAW,GAAG,CAAC,OAAO,KAAK,GAAG;QAC5C,OAAO,oBAAA,8BAAA,QAAS,qBAAqB;QAErC,IAAI,QAAS,CAAA,UAAU,IAAI,CAAC,eAAe,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAK,GACnI,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,UAAU;QACtC;QAGF,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,WAAW;QACvC;IACF;IA1IA,YAAY,UAAmC,EAAE,GAAkC,EAAE,OAAuC,CAAE;QAC5H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AAqIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done || !this.ref.current) {\n return {type: 'root'};\n }\n\n let rect: DOMRect | undefined = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let collection = this.ref.current?.dataset.collection;\n let elements = this.ref.current.querySelectorAll(collection ? `[data-collection=\"${CSS.escape(collection)}\"]` : '[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement && item.dataset.key != null) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n if (!element) {\n break;\n }\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element?.getBoundingClientRect();\n\n if (rect && (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.main.js.map"}
1
+ {"mappings":";;;;;;AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,G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Y,UAAmC,EAAE,GAAkC,EAAE,OAAuC,CAAE;QAC5H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AAqIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n protected direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done || !this.ref.current) {\n return {type: 'root'};\n }\n\n let rect: DOMRect | undefined = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let collection = this.ref.current?.dataset.collection;\n let elements = this.ref.current.querySelectorAll(collection ? `[data-collection=\"${CSS.escape(collection)}\"]` : '[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement && item.dataset.key != null) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n if (!element) {\n break;\n }\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element?.getBoundingClientRect();\n\n if (rect && (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":"AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,GAAG,KAAK,IAAI;IACjE;IAEQ,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,MAAM,GAAG,KAAK,KAAK;IACrE;IAEQ,aAAa,IAAa,EAAE;QAClC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,eAAe,CAAC,QAAQ,IAAI,CAAC,iBAAiB,CAAC;IACvF;IAEQ,WAAW,IAAa,EAAE;QAChC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,eAAe,CAAC;IACnF;IAEQ,YAAY,IAAa,EAAE;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,IAAI,CAAC,YAAY,CAAC;IACnD;IAEA,uBAAuB,CAAS,EAAE,CAAS,EAAE,iBAAkD,EAAc;YAgB1F;QAfjB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,GAAG,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EACrE,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AG,YAAY,WAAW;gBAEjD;gBAEA,OAAO;YACT;QACF;QAEA,IAAI,OAAO,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,MAAM,MAAM,GAAG,GAAG;QACjD,IAAI,UAAU,WAAW,GAAG,CAAC,OAAO,KAAK,GAAG;QAC5C,OAAO,oBAAA,8BAAA,QAAS,qBAAqB;QAErC,IAAI,QAAS,CAAA,UAAU,IAAI,CAAC,eAAe,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAK,GACnI,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,UAAU;QACtC;QAGF,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,WAAW;QACvC;IACF;IA1IA,YAAY,UAAmC,EAAE,GAAkC,EAAE,OAAuC,CAAE;QAC5H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AAqIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done || !this.ref.current) {\n return {type: 'root'};\n }\n\n let rect: DOMRect | undefined = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let collection = this.ref.current?.dataset.collection;\n let elements = this.ref.current.querySelectorAll(collection ? `[data-collection=\"${CSS.escape(collection)}\"]` : '[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement && item.dataset.key != null) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n if (!element) {\n break;\n }\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element?.getBoundingClientRect();\n\n if (rect && (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.module.js.map"}
1
+ {"mappings":"AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,GAAG,KAAK,IAAI;IACjE;IAEQ,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,MAAM,GAAG,KAAK,KAAK;IACrE;IAEQ,a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,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AAqIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n protected direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done || !this.ref.current) {\n return {type: 'root'};\n }\n\n let rect: DOMRect | undefined = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let collection = this.ref.current?.dataset.collection;\n let elements = this.ref.current.querySelectorAll(collection ? `[data-collection=\"${CSS.escape(collection)}\"]` : '[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement && item.dataset.key != null) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n if (!element) {\n break;\n }\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element?.getBoundingClientRect();\n\n if (rect && (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.module.js.map"}
package/dist/types.d.ts CHANGED
@@ -28,7 +28,6 @@ export interface DropOptions {
28
28
  /**
29
29
  * Handler that is called after a valid drag is held over the drop target for a period of time.
30
30
  * This typically opens the item so that the user can drop within it.
31
- * @private
32
31
  */
33
32
  onDropActivate?: (e: DropActivateEvent) => void;
34
33
  /** Handler that is called when a valid drag exits the drop target. */
@@ -63,6 +62,8 @@ export interface DroppableCollectionOptions extends DroppableCollectionProps {
63
62
  keyboardDelegate: KeyboardDelegate;
64
63
  /** A delegate object that provides drop targets for pointer coordinates within the collection. */
65
64
  dropTargetDelegate: DropTargetDelegate;
65
+ /** A custom keyboard event handler for drop targets. */
66
+ onKeyDown?: (e: KeyboardEvent) => void;
66
67
  }
67
68
  export interface DroppableCollectionResult {
68
69
  /** Props for the collection element. */
@@ -76,6 +77,8 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state:
76
77
  export interface DroppableItemOptions {
77
78
  /** The drop target represented by the item. */
78
79
  target: DropTarget;
80
+ /** The ref to the activate button. */
81
+ activateButtonRef?: RefObject<FocusableElement | null>;
79
82
  }
80
83
  export interface DroppableItemResult {
81
84
  /** Props for the droppable element. */
@@ -90,6 +93,8 @@ export function useDroppableItem(options: DroppableItemOptions, state: Droppable
90
93
  export interface DropIndicatorProps {
91
94
  /** The drop target that the drop indicator represents. */
92
95
  target: DropTarget;
96
+ /** The ref to the activate button. */
97
+ activateButtonRef?: RefObject<FocusableElement | null>;
93
98
  }
94
99
  export interface DropIndicatorAria {
95
100
  /** Props for the drop indicator element. */
@@ -221,6 +226,7 @@ interface ListDropTargetDelegateOptions {
221
226
  direction?: Direction;
222
227
  }
223
228
  export class ListDropTargetDelegate implements DropTargetDelegate {
229
+ protected direction: Direction;
224
230
  constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions);
225
231
  getDrop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AE,UAAU,KAAK,OAAO,GAAG,UAAU;CAuG7G;AC3JD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,cAAc,EACd,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/constants.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/utils.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragManager.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useAutoScroll.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useVirtualDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDropIndicator.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrag.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragPreview.tsx","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useClipboard.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/ListDropTargetDelegate.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/index.ts","packages/@react-aria/dnd/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {DroppableCollectionOptions, DroppableCollectionResult} from './useDroppableCollection';\nexport type {DroppableItemOptions, DroppableItemResult} from './useDroppableItem';\nexport type {DropIndicatorProps, DropIndicatorAria} from './useDropIndicator';\nexport type {DraggableItemProps, DraggableItemResult} from './useDraggableItem';\nexport type {DraggableCollectionOptions} from './useDraggableCollection';\nexport type {DragPreviewProps} from './DragPreview';\nexport type {DragOptions, DragResult} from './useDrag';\nexport type {DropOptions, DropResult} from './useDrop';\nexport type {ClipboardProps, ClipboardResult} from './useClipboard';\nexport type {\n DirectoryDropItem,\n DragEndEvent,\n DraggableCollectionEndEvent,\n DraggableCollectionMoveEvent,\n DraggableCollectionStartEvent,\n DragItem,\n DragMoveEvent,\n DragPreviewRenderer,\n DragStartEvent,\n DragTypes,\n DropEnterEvent,\n DropEvent,\n DropExitEvent,\n DropItem,\n DropMoveEvent,\n DropOperation,\n DroppableCollectionDropEvent,\n DroppableCollectionEnterEvent,\n DroppableCollectionExitEvent,\n DroppableCollectionInsertDropEvent,\n DroppableCollectionMoveEvent,\n DroppableCollectionOnItemDropEvent,\n DroppableCollectionReorderEvent,\n DroppableCollectionRootDropEvent,\n DropPosition,\n DropTarget,\n DropTargetDelegate,\n FileDropItem,\n ItemDropTarget,\n RootDropTarget,\n TextDropItem\n} from '@react-types/shared';\n\nexport {DIRECTORY_DRAG_TYPE} from './utils';\nexport {useDrag} from './useDrag';\nexport {useDrop} from './useDrop';\nexport {useDroppableCollection} from './useDroppableCollection';\nexport {useDroppableItem} from './useDroppableItem';\nexport {useDropIndicator} from './useDropIndicator';\nexport {useDraggableItem} from './useDraggableItem';\nexport {useDraggableCollection} from './useDraggableCollection';\nexport {useClipboard} from './useClipboard';\nexport {DragPreview} from './DragPreview';\nexport {ListDropTargetDelegate} from './ListDropTargetDelegate';\nexport {isVirtualDragging} from './DragManager';\nexport {isDirectoryDropItem, isFileDropItem, isTextDropItem} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;ACuBA,OAAO,MAAM,kCAA8B,CAAC;AA0S5C,sDAAsD;AACtD,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,6CAA6C;AAC7C,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,kDAAkD;AAClD,oCAAoC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,iBAAiB,CAErF;ACxOD,eAAe;AACf,qCAAqC,OAAO,CAE3C;AIpFD;IACE,uCAAuC;IACvC,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACxC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,aAAa,CAAC;IAC5F,yFAAyF;IACzF,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;IAC1H,uEAAuE;IACvE,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C,gFAAgF;IAChF,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC;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AAa,CAAA;CAC9B;AA6BD;;;GAGG;AACH,6BAA6B,OAAO,EAAE,cAAc,GAAG,eAAe,CAmFrE;ACpJD;IACE;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAWD,mCAAoC,YAAW,kBAAkB;IAK/D,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;gBAEnB,UAAU,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,6BAA6B;IAoC5H,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,UAAU;CAuG7G;AC3JD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,cAAc,EACd,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/constants.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/utils.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragManager.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DropTargetKeyboardNavigation.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useAutoScroll.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useVirtualDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDropIndicator.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrag.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragPreview.tsx","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useClipboard.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/ListDropTargetDelegate.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/index.ts","packages/@react-aria/dnd/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {DroppableCollectionOptions, DroppableCollectionResult} from './useDroppableCollection';\nexport type {DroppableItemOptions, DroppableItemResult} from './useDroppableItem';\nexport type {DropIndicatorProps, DropIndicatorAria} from './useDropIndicator';\nexport type {DraggableItemProps, DraggableItemResult} from './useDraggableItem';\nexport type {DraggableCollectionOptions} from './useDraggableCollection';\nexport type {DragPreviewProps} from './DragPreview';\nexport type {DragOptions, DragResult} from './useDrag';\nexport type {DropOptions, DropResult} from './useDrop';\nexport type {ClipboardProps, ClipboardResult} from './useClipboard';\nexport type {\n DirectoryDropItem,\n DragEndEvent,\n DraggableCollectionEndEvent,\n DraggableCollectionMoveEvent,\n DraggableCollectionStartEvent,\n DragItem,\n DragMoveEvent,\n DragPreviewRenderer,\n DragStartEvent,\n DragTypes,\n DropEnterEvent,\n DropEvent,\n DropExitEvent,\n DropItem,\n DropMoveEvent,\n DropOperation,\n DroppableCollectionDropEvent,\n DroppableCollectionEnterEvent,\n DroppableCollectionExitEvent,\n DroppableCollectionInsertDropEvent,\n DroppableCollectionMoveEvent,\n DroppableCollectionOnItemDropEvent,\n DroppableCollectionReorderEvent,\n DroppableCollectionRootDropEvent,\n DropPosition,\n DropTarget,\n DropTargetDelegate,\n FileDropItem,\n ItemDropTarget,\n RootDropTarget,\n TextDropItem\n} from '@react-types/shared';\n\nexport {DIRECTORY_DRAG_TYPE} from './utils';\nexport {useDrag} from './useDrag';\nexport {useDrop} from './useDrop';\nexport {useDroppableCollection} from './useDroppableCollection';\nexport {useDroppableItem} from './useDroppableItem';\nexport {useDropIndicator} from './useDropIndicator';\nexport {useDraggableItem} from './useDraggableItem';\nexport {useDraggableCollection} from './useDraggableCollection';\nexport {useClipboard} from './useClipboard';\nexport {DragPreview} from './DragPreview';\nexport {ListDropTargetDelegate} from './ListDropTargetDelegate';\nexport {isVirtualDragging} from './DragManager';\nexport {isDirectoryDropItem, isFileDropItem, isTextDropItem} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}