@react-aria/selection 3.18.1 → 3.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/DOMLayoutDelegate.main.js +53 -0
  2. package/dist/DOMLayoutDelegate.main.js.map +1 -0
  3. package/dist/DOMLayoutDelegate.mjs +48 -0
  4. package/dist/DOMLayoutDelegate.module.js +48 -0
  5. package/dist/DOMLayoutDelegate.module.js.map +1 -0
  6. package/dist/ListKeyboardDelegate.main.js +28 -39
  7. package/dist/ListKeyboardDelegate.main.js.map +1 -1
  8. package/dist/ListKeyboardDelegate.mjs +28 -39
  9. package/dist/ListKeyboardDelegate.module.js +28 -39
  10. package/dist/ListKeyboardDelegate.module.js.map +1 -1
  11. package/dist/import.mjs +3 -1
  12. package/dist/main.js +3 -0
  13. package/dist/main.js.map +1 -1
  14. package/dist/module.js +3 -1
  15. package/dist/module.js.map +1 -1
  16. package/dist/types.d.ts +19 -7
  17. package/dist/types.d.ts.map +1 -1
  18. package/dist/useSelectableCollection.main.js +17 -15
  19. package/dist/useSelectableCollection.main.js.map +1 -1
  20. package/dist/useSelectableCollection.mjs +17 -15
  21. package/dist/useSelectableCollection.module.js +17 -15
  22. package/dist/useSelectableCollection.module.js.map +1 -1
  23. package/dist/useSelectableItem.main.js.map +1 -1
  24. package/dist/useSelectableItem.module.js.map +1 -1
  25. package/dist/useSelectableList.main.js +4 -2
  26. package/dist/useSelectableList.main.js.map +1 -1
  27. package/dist/useSelectableList.mjs +4 -2
  28. package/dist/useSelectableList.module.js +4 -2
  29. package/dist/useSelectableList.module.js.map +1 -1
  30. package/package.json +10 -10
  31. package/src/DOMLayoutDelegate.ts +57 -0
  32. package/src/ListKeyboardDelegate.ts +37 -49
  33. package/src/index.ts +1 -0
  34. package/src/useSelectableCollection.ts +26 -15
  35. package/src/useSelectableItem.ts +3 -3
  36. package/src/useSelectableList.ts +12 -4
@@ -0,0 +1,53 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "DOMLayoutDelegate", () => $2ac4508142683dcb$export$8f5ed9ff9f511381);
7
+ /*
8
+ * Copyright 2024 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */ class $2ac4508142683dcb$export$8f5ed9ff9f511381 {
18
+ getItemRect(key) {
19
+ let container = this.ref.current;
20
+ let item = key != null ? container.querySelector(`[data-key="${CSS.escape(key.toString())}"]`) : null;
21
+ if (!item) return null;
22
+ let containerRect = container.getBoundingClientRect();
23
+ let itemRect = item.getBoundingClientRect();
24
+ return {
25
+ x: itemRect.left - containerRect.left + container.scrollLeft,
26
+ y: itemRect.top - containerRect.top + container.scrollTop,
27
+ width: itemRect.width,
28
+ height: itemRect.height
29
+ };
30
+ }
31
+ getContentSize() {
32
+ let container = this.ref.current;
33
+ return {
34
+ width: container.scrollWidth,
35
+ height: container.scrollHeight
36
+ };
37
+ }
38
+ getVisibleRect() {
39
+ let container = this.ref.current;
40
+ return {
41
+ x: container.scrollLeft,
42
+ y: container.scrollTop,
43
+ width: container.offsetWidth,
44
+ height: container.offsetHeight
45
+ };
46
+ }
47
+ constructor(ref){
48
+ this.ref = ref;
49
+ }
50
+ }
51
+
52
+
53
+ //# sourceMappingURL=DOMLayoutDelegate.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAOX,YAAY,GAAQ,EAAe;QACjC,IAAI,YAAY,IAAI,CAAC,GAAG,CAAC,OAAO;QAChC,IAAI,OAAO,OAAO,OAAO,UAAU,aAAa,CAAC,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,IAAI,QAAQ,IAAI,EAAE,CAAC,IAAI;QACjG,IAAI,CAAC,MACH,OAAO;QAGT,IAAI,gBAAgB,UAAU,qBAAqB;QACnD,IAAI,WAAW,KAAK,qBAAqB;QAEzC,OAAO;YACL,GAAG,SAAS,IAAI,GAAG,cAAc,IAAI,GAAG,UAAU,UAAU;YAC5D,GAAG,SAAS,GAAG,GAAG,cAAc,GAAG,GAAG,UAAU,SAAS;YACzD,OAAO,SAAS,KAAK;YACrB,QAAQ,SAAS,MAAM;QACzB;IACF;IAEA,iBAAuB;QACrB,IAAI,YAAY,IAAI,CAAC,GAAG,CAAC,OAAO;QAChC,OAAO;YACL,OAAO,UAAU,WAAW;YAC5B,QAAQ,UAAU,YAAY;QAChC;IACF;IAEA,iBAAuB;QACrB,IAAI,YAAY,IAAI,CAAC,GAAG,CAAC,OAAO;QAChC,OAAO;YACL,GAAG,UAAU,UAAU;YACvB,GAAG,UAAU,SAAS;YACtB,OAAO,UAAU,WAAW;YAC5B,QAAQ,UAAU,YAAY;QAChC;IACF;IAtCA,YAAY,GAA2B,CAAE;QACvC,IAAI,CAAC,GAAG,GAAG;IACb;AAqCF","sources":["packages/@react-aria/selection/src/DOMLayoutDelegate.ts"],"sourcesContent":["/*\n * Copyright 2024 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\nimport {Key, LayoutDelegate, Rect, RefObject, Size} from '@react-types/shared';\n\nexport class DOMLayoutDelegate implements LayoutDelegate {\n private ref: RefObject<HTMLElement>;\n\n constructor(ref: RefObject<HTMLElement>) {\n this.ref = ref;\n }\n\n getItemRect(key: Key): Rect | null {\n let container = this.ref.current;\n let item = key != null ? container.querySelector(`[data-key=\"${CSS.escape(key.toString())}\"]`) : null;\n if (!item) {\n return null;\n }\n\n let containerRect = container.getBoundingClientRect();\n let itemRect = item.getBoundingClientRect();\n\n return {\n x: itemRect.left - containerRect.left + container.scrollLeft,\n y: itemRect.top - containerRect.top + container.scrollTop,\n width: itemRect.width,\n height: itemRect.height\n };\n }\n\n getContentSize(): Size {\n let container = this.ref.current;\n return {\n width: container.scrollWidth,\n height: container.scrollHeight\n };\n }\n\n getVisibleRect(): Rect {\n let container = this.ref.current;\n return {\n x: container.scrollLeft,\n y: container.scrollTop,\n width: container.offsetWidth,\n height: container.offsetHeight\n };\n }\n}\n"],"names":[],"version":3,"file":"DOMLayoutDelegate.main.js.map"}
@@ -0,0 +1,48 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ class $657e4dc4a6e88df0$export$8f5ed9ff9f511381 {
12
+ getItemRect(key) {
13
+ let container = this.ref.current;
14
+ let item = key != null ? container.querySelector(`[data-key="${CSS.escape(key.toString())}"]`) : null;
15
+ if (!item) return null;
16
+ let containerRect = container.getBoundingClientRect();
17
+ let itemRect = item.getBoundingClientRect();
18
+ return {
19
+ x: itemRect.left - containerRect.left + container.scrollLeft,
20
+ y: itemRect.top - containerRect.top + container.scrollTop,
21
+ width: itemRect.width,
22
+ height: itemRect.height
23
+ };
24
+ }
25
+ getContentSize() {
26
+ let container = this.ref.current;
27
+ return {
28
+ width: container.scrollWidth,
29
+ height: container.scrollHeight
30
+ };
31
+ }
32
+ getVisibleRect() {
33
+ let container = this.ref.current;
34
+ return {
35
+ x: container.scrollLeft,
36
+ y: container.scrollTop,
37
+ width: container.offsetWidth,
38
+ height: container.offsetHeight
39
+ };
40
+ }
41
+ constructor(ref){
42
+ this.ref = ref;
43
+ }
44
+ }
45
+
46
+
47
+ export {$657e4dc4a6e88df0$export$8f5ed9ff9f511381 as DOMLayoutDelegate};
48
+ //# sourceMappingURL=DOMLayoutDelegate.module.js.map
@@ -0,0 +1,48 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ class $657e4dc4a6e88df0$export$8f5ed9ff9f511381 {
12
+ getItemRect(key) {
13
+ let container = this.ref.current;
14
+ let item = key != null ? container.querySelector(`[data-key="${CSS.escape(key.toString())}"]`) : null;
15
+ if (!item) return null;
16
+ let containerRect = container.getBoundingClientRect();
17
+ let itemRect = item.getBoundingClientRect();
18
+ return {
19
+ x: itemRect.left - containerRect.left + container.scrollLeft,
20
+ y: itemRect.top - containerRect.top + container.scrollTop,
21
+ width: itemRect.width,
22
+ height: itemRect.height
23
+ };
24
+ }
25
+ getContentSize() {
26
+ let container = this.ref.current;
27
+ return {
28
+ width: container.scrollWidth,
29
+ height: container.scrollHeight
30
+ };
31
+ }
32
+ getVisibleRect() {
33
+ let container = this.ref.current;
34
+ return {
35
+ x: container.scrollLeft,
36
+ y: container.scrollTop,
37
+ width: container.offsetWidth,
38
+ height: container.offsetHeight
39
+ };
40
+ }
41
+ constructor(ref){
42
+ this.ref = ref;
43
+ }
44
+ }
45
+
46
+
47
+ export {$657e4dc4a6e88df0$export$8f5ed9ff9f511381 as DOMLayoutDelegate};
48
+ //# sourceMappingURL=DOMLayoutDelegate.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAOX,YAAY,GAAQ,EAAe;QACjC,IAAI,YAAY,IAAI,CAAC,GAAG,CAAC,OAAO;QAChC,IAAI,OAAO,OAAO,OAAO,UAAU,aAAa,CAAC,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,IAAI,QAAQ,IAAI,EAAE,CAAC,IAAI;QACjG,IAAI,CAAC,MACH,OAAO;QAGT,IAAI,gBAAgB,UAAU,qBAAqB;QACnD,IAAI,WAAW,KAAK,qBAAqB;QAEzC,OAAO;YACL,GAAG,SAAS,IAAI,GAAG,cAAc,IAAI,GAAG,UAAU,UAAU;YAC5D,GAAG,SAAS,GAAG,GAAG,cAAc,GAAG,GAAG,UAAU,SAAS;YACzD,OAAO,SAAS,KAAK;YACrB,QAAQ,SAAS,MAAM;QACzB;IACF;IAEA,iBAAuB;QACrB,IAAI,YAAY,IAAI,CAAC,GAAG,CAAC,OAAO;QAChC,OAAO;YACL,OAAO,UAAU,WAAW;YAC5B,QAAQ,UAAU,YAAY;QAChC;IACF;IAEA,iBAAuB;QACrB,IAAI,YAAY,IAAI,CAAC,GAAG,CAAC,OAAO;QAChC,OAAO;YACL,GAAG,UAAU,UAAU;YACvB,GAAG,UAAU,SAAS;YACtB,OAAO,UAAU,WAAW;YAC5B,QAAQ,UAAU,YAAY;QAChC;IACF;IAtCA,YAAY,GAA2B,CAAE;QACvC,IAAI,CAAC,GAAG,GAAG;IACb;AAqCF","sources":["packages/@react-aria/selection/src/DOMLayoutDelegate.ts"],"sourcesContent":["/*\n * Copyright 2024 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\nimport {Key, LayoutDelegate, Rect, RefObject, Size} from '@react-types/shared';\n\nexport class DOMLayoutDelegate implements LayoutDelegate {\n private ref: RefObject<HTMLElement>;\n\n constructor(ref: RefObject<HTMLElement>) {\n this.ref = ref;\n }\n\n getItemRect(key: Key): Rect | null {\n let container = this.ref.current;\n let item = key != null ? container.querySelector(`[data-key=\"${CSS.escape(key.toString())}\"]`) : null;\n if (!item) {\n return null;\n }\n\n let containerRect = container.getBoundingClientRect();\n let itemRect = item.getBoundingClientRect();\n\n return {\n x: itemRect.left - containerRect.left + container.scrollLeft,\n y: itemRect.top - containerRect.top + container.scrollTop,\n width: itemRect.width,\n height: itemRect.height\n };\n }\n\n getContentSize(): Size {\n let container = this.ref.current;\n return {\n width: container.scrollWidth,\n height: container.scrollHeight\n };\n }\n\n getVisibleRect(): Rect {\n let container = this.ref.current;\n return {\n x: container.scrollLeft,\n y: container.scrollTop,\n width: container.offsetWidth,\n height: container.offsetHeight\n };\n }\n}\n"],"names":[],"version":3,"file":"DOMLayoutDelegate.module.js.map"}
@@ -1,3 +1,4 @@
1
+ var $2ac4508142683dcb$exports = require("./DOMLayoutDelegate.main.js");
1
2
  var $doKEG$reactariautils = require("@react-aria/utils");
2
3
 
3
4
 
@@ -17,6 +18,7 @@ $parcel$export(module.exports, "ListKeyboardDelegate", () => $836f880b12dcae5c$e
17
18
  * OF ANY KIND, either express or implied. See the License for the specific language
18
19
  * governing permissions and limitations under the License.
19
20
  */
21
+
20
22
  class $836f880b12dcae5c$export$a05409b8bb224a5a {
21
23
  isDisabled(item) {
22
24
  var _item_props;
@@ -41,21 +43,21 @@ class $836f880b12dcae5c$export$a05409b8bb224a5a {
41
43
  return null;
42
44
  }
43
45
  findKey(key, nextKey, shouldSkip) {
44
- let item = this.getItem(key);
45
- if (!item) return null;
46
+ let itemRect = this.layoutDelegate.getItemRect(key);
47
+ if (!itemRect) return null;
46
48
  // Find the item above or below in the same column.
47
- let prevRect = item.getBoundingClientRect();
49
+ let prevRect = itemRect;
48
50
  do {
49
51
  key = nextKey(key);
50
- item = this.getItem(key);
51
- }while (item && shouldSkip(prevRect, item.getBoundingClientRect()));
52
+ itemRect = this.layoutDelegate.getItemRect(key);
53
+ }while (itemRect && shouldSkip(prevRect, itemRect));
52
54
  return key;
53
55
  }
54
56
  isSameRow(prevRect, itemRect) {
55
- return prevRect.top === itemRect.top || prevRect.left !== itemRect.left;
57
+ return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
56
58
  }
57
59
  isSameColumn(prevRect, itemRect) {
58
- return prevRect.left === itemRect.left || prevRect.top !== itemRect.top;
60
+ return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;
59
61
  }
60
62
  getKeyBelow(key) {
61
63
  if (this.layout === 'grid' && this.orientation === 'vertical') return this.findKey(key, (key)=>this.getNextKey(key), this.isSameRow);
@@ -100,57 +102,42 @@ class $836f880b12dcae5c$export$a05409b8bb224a5a {
100
102
  }
101
103
  return null;
102
104
  }
103
- getItem(key) {
104
- return key !== null ? this.ref.current.querySelector(`[data-key="${CSS.escape(key.toString())}"]`) : null;
105
- }
106
105
  getKeyPageAbove(key) {
107
106
  let menu = this.ref.current;
108
- let item = this.getItem(key);
109
- if (!item) return null;
107
+ let itemRect = this.layoutDelegate.getItemRect(key);
108
+ if (!itemRect) return null;
110
109
  if (!(0, $doKEG$reactariautils.isScrollable)(menu)) return this.getFirstKey();
111
- let containerRect = menu.getBoundingClientRect();
112
- let itemRect = item.getBoundingClientRect();
113
110
  if (this.orientation === 'horizontal') {
114
- let containerX = containerRect.x - menu.scrollLeft;
115
- let pageX = Math.max(0, itemRect.x - containerX + itemRect.width - containerRect.width);
116
- while(item && itemRect.x - containerX > pageX){
111
+ let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);
112
+ while(itemRect && itemRect.x > pageX){
117
113
  key = this.getKeyAbove(key);
118
- item = key == null ? null : this.getItem(key);
119
- itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
114
+ itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);
120
115
  }
121
116
  } else {
122
- let containerY = containerRect.y - menu.scrollTop;
123
- let pageY = Math.max(0, itemRect.y - containerY + itemRect.height - containerRect.height);
124
- while(item && itemRect.y - containerY > pageY){
117
+ let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
118
+ while(itemRect && itemRect.y > pageY){
125
119
  key = this.getKeyAbove(key);
126
- item = key == null ? null : this.getItem(key);
127
- itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
120
+ itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);
128
121
  }
129
122
  }
130
123
  return key !== null && key !== void 0 ? key : this.getFirstKey();
131
124
  }
132
125
  getKeyPageBelow(key) {
133
126
  let menu = this.ref.current;
134
- let item = this.getItem(key);
135
- if (!item) return null;
127
+ let itemRect = this.layoutDelegate.getItemRect(key);
128
+ if (!itemRect) return null;
136
129
  if (!(0, $doKEG$reactariautils.isScrollable)(menu)) return this.getLastKey();
137
- let containerRect = menu.getBoundingClientRect();
138
- let itemRect = item.getBoundingClientRect();
139
130
  if (this.orientation === 'horizontal') {
140
- let containerX = containerRect.x - menu.scrollLeft;
141
- let pageX = Math.min(menu.scrollWidth, itemRect.x - containerX - itemRect.width + containerRect.width);
142
- while(item && itemRect.x - containerX < pageX){
131
+ let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);
132
+ while(itemRect && itemRect.x < pageX){
143
133
  key = this.getKeyBelow(key);
144
- item = key == null ? null : this.getItem(key);
145
- itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
134
+ itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);
146
135
  }
147
136
  } else {
148
- let containerY = containerRect.y - menu.scrollTop;
149
- let pageY = Math.min(menu.scrollHeight, itemRect.y - containerY - itemRect.height + containerRect.height);
150
- while(item && itemRect.y - containerY < pageY){
137
+ let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);
138
+ while(itemRect && itemRect.y < pageY){
151
139
  key = this.getKeyBelow(key);
152
- item = key == null ? null : this.getItem(key);
153
- itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
140
+ itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);
154
141
  }
155
142
  }
156
143
  return key !== null && key !== void 0 ? key : this.getLastKey();
@@ -175,9 +162,10 @@ class $836f880b12dcae5c$export$a05409b8bb224a5a {
175
162
  this.collator = opts.collator;
176
163
  this.disabledKeys = opts.disabledKeys || new Set();
177
164
  this.disabledBehavior = opts.disabledBehavior || 'all';
178
- this.orientation = opts.orientation;
165
+ this.orientation = opts.orientation || 'vertical';
179
166
  this.direction = opts.direction;
180
167
  this.layout = opts.layout || 'stack';
168
+ this.layoutDelegate = opts.layoutDelegate || new (0, $2ac4508142683dcb$exports.DOMLayoutDelegate)(opts.ref);
181
169
  } else {
182
170
  this.collection = args[0];
183
171
  this.disabledKeys = args[1];
@@ -186,6 +174,7 @@ class $836f880b12dcae5c$export$a05409b8bb224a5a {
186
174
  this.layout = 'stack';
187
175
  this.orientation = 'vertical';
188
176
  this.disabledBehavior = 'all';
177
+ this.layoutDelegate = new (0, $2ac4508142683dcb$exports.DOMLayoutDelegate)(this.ref);
189
178
  }
190
179
  // If this is a vertical stack, remove the left/right methods completely
191
180
  // so they aren't called by useDroppableCollection.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAiBM,MAAM;IAy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AAC,QAAQ,CAAC,OAAO,CAAC,WAAW,YAAY,GACjE,OAAO;YAGT,MAAM,IAAI,CAAC,WAAW,CAAC;QACzB;QAEA,OAAO;IACT;IAnQA,YAAY,GAAG,IAAW,CAAE;QAC1B,IAAI,KAAK,MAAM,KAAK,GAAG;YACrB,IAAI,OAAO,IAAI,CAAC,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,KAAK,UAAU;YACjC,IAAI,CAAC,GAAG,GAAG,KAAK,GAAG;YACnB,IAAI,CAAC,QAAQ,GAAG,KAAK,QAAQ;YAC7B,IAAI,CAAC,YAAY,GAAG,KAAK,YAAY,IAAI,IAAI;YAC7C,IAAI,CAAC,gBAAgB,GAAG,KAAK,gBAAgB,IAAI;YACjD,IAAI,CAAC,WAAW,GAAG,KAAK,WAAW;YACnC,IAAI,CAAC,SAAS,GAAG,KAAK,SAAS;YAC/B,IAAI,CAAC,MAAM,GAAG,KAAK,MAAM,IAAI;QAC/B,OAAO;YACL,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE;YACzB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE;YAC3B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,MAAM,GAAG;YACd,IAAI,CAAC,WAAW,GAAG;YACnB,IAAI,CAAC,gBAAgB,GAAG;QAC1B;QAEA,wEAAwE;QACxE,mDAAmD;QACnD,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,WAAW,KAAK,YAAY;YAC9D,IAAI,CAAC,YAAY,GAAG;YACpB,IAAI,CAAC,aAAa,GAAG;QACvB;IACF;AAyOF","sources":["packages/@react-aria/selection/src/ListKeyboardDelegate.ts"],"sourcesContent":["/*\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\nimport {Collection, Direction, DisabledBehavior, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';\nimport {isScrollable} from '@react-aria/utils';\nimport {RefObject} from 'react';\n\ninterface ListKeyboardDelegateOptions<T> {\n collection: Collection<Node<T>>,\n ref: RefObject<HTMLElement>,\n collator?: Intl.Collator,\n layout?: 'stack' | 'grid',\n orientation?: Orientation,\n direction?: Direction,\n disabledKeys?: Set<Key>,\n disabledBehavior?: DisabledBehavior\n}\n\nexport class ListKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private disabledKeys: Set<Key>;\n private disabledBehavior: DisabledBehavior;\n private ref: RefObject<HTMLElement>;\n private collator: Intl.Collator | undefined;\n private layout: 'stack' | 'grid';\n private orientation?: Orientation;\n private direction?: Direction;\n\n constructor(collection: Collection<Node<T>>, disabledKeys: Set<Key>, ref: RefObject<HTMLElement>, collator?: Intl.Collator);\n constructor(options: ListKeyboardDelegateOptions<T>);\n constructor(...args: any[]) {\n if (args.length === 1) {\n let opts = args[0] as ListKeyboardDelegateOptions<T>;\n this.collection = opts.collection;\n this.ref = opts.ref;\n this.collator = opts.collator;\n this.disabledKeys = opts.disabledKeys || new Set();\n this.disabledBehavior = opts.disabledBehavior || 'all';\n this.orientation = opts.orientation;\n this.direction = opts.direction;\n this.layout = opts.layout || 'stack';\n } else {\n this.collection = args[0];\n this.disabledKeys = args[1];\n this.ref = args[2];\n this.collator = args[3];\n this.layout = 'stack';\n this.orientation = 'vertical';\n this.disabledBehavior = 'all';\n }\n\n // If this is a vertical stack, remove the left/right methods completely\n // so they aren't called by useDroppableCollection.\n if (this.layout === 'stack' && this.orientation === 'vertical') {\n this.getKeyLeftOf = undefined;\n this.getKeyRightOf = undefined;\n }\n }\n\n private isDisabled(item: Node<unknown>) {\n return this.disabledBehavior === 'all' && (item.props?.isDisabled || this.disabledKeys.has(item.key));\n }\n\n getNextKey(key: Key) {\n key = this.collection.getKeyAfter(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.isDisabled(item)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return null;\n }\n\n getPreviousKey(key: Key) {\n key = this.collection.getKeyBefore(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.isDisabled(item)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n\n return null;\n }\n\n private findKey(\n key: Key,\n nextKey: (key: Key) => Key,\n shouldSkip: (prevRect: DOMRect, itemRect: DOMRect) => boolean\n ) {\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n // Find the item above or below in the same column.\n let prevRect = item.getBoundingClientRect();\n do {\n key = nextKey(key);\n item = this.getItem(key);\n } while (item && shouldSkip(prevRect, item.getBoundingClientRect()));\n\n return key;\n }\n\n private isSameRow(prevRect: DOMRect, itemRect: DOMRect) {\n return prevRect.top === itemRect.top || prevRect.left !== itemRect.left;\n }\n\n private isSameColumn(prevRect: DOMRect, itemRect: DOMRect) {\n return prevRect.left === itemRect.left || prevRect.top !== itemRect.top;\n }\n\n getKeyBelow(key: Key) {\n if (this.layout === 'grid' && this.orientation === 'vertical') {\n return this.findKey(key, (key) => this.getNextKey(key), this.isSameRow);\n } else {\n return this.getNextKey(key);\n }\n }\n\n getKeyAbove(key: Key) {\n if (this.layout === 'grid' && this.orientation === 'vertical') {\n return this.findKey(key, (key) => this.getPreviousKey(key), this.isSameRow);\n } else {\n return this.getPreviousKey(key);\n }\n }\n\n private getNextColumn(key: Key, right: boolean) {\n return right ? this.getPreviousKey(key) : this.getNextKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.layout === 'grid') {\n if (this.orientation === 'vertical') {\n return this.getNextColumn(key, this.direction === 'rtl');\n } else {\n return this.findKey(key, (key) => this.getNextColumn(key, this.direction === 'rtl'), this.isSameColumn);\n }\n } else if (this.orientation === 'horizontal') {\n return this.getNextColumn(key, this.direction === 'rtl');\n }\n\n return null;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.layout === 'grid') {\n if (this.orientation === 'vertical') {\n return this.getNextColumn(key, this.direction === 'ltr');\n } else {\n return this.findKey(key, (key) => this.getNextColumn(key, this.direction === 'ltr'), this.isSameColumn);\n }\n } else if (this.orientation === 'horizontal') {\n return this.getNextColumn(key, this.direction === 'ltr');\n }\n\n return null;\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item?.type === 'item' && !this.isDisabled(item)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return null;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.isDisabled(item)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n\n return null;\n }\n\n private getItem(key: Key): HTMLElement {\n return key !== null ? this.ref.current.querySelector(`[data-key=\"${CSS.escape(key.toString())}\"]`) : null;\n }\n\n getKeyPageAbove(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n if (!isScrollable(menu)) {\n return this.getFirstKey();\n }\n\n let containerRect = menu.getBoundingClientRect();\n let itemRect = item.getBoundingClientRect();\n if (this.orientation === 'horizontal') {\n let containerX = containerRect.x - menu.scrollLeft;\n let pageX = Math.max(0, (itemRect.x - containerX) + itemRect.width - containerRect.width);\n\n while (item && (itemRect.x - containerX) > pageX) {\n key = this.getKeyAbove(key);\n item = key == null ? null : this.getItem(key);\n itemRect = item?.getBoundingClientRect();\n }\n } else {\n let containerY = containerRect.y - menu.scrollTop;\n let pageY = Math.max(0, (itemRect.y - containerY) + itemRect.height - containerRect.height);\n\n while (item && (itemRect.y - containerY) > pageY) {\n key = this.getKeyAbove(key);\n item = key == null ? null : this.getItem(key);\n itemRect = item?.getBoundingClientRect();\n }\n }\n\n return key ?? this.getFirstKey();\n }\n\n getKeyPageBelow(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n if (!isScrollable(menu)) {\n return this.getLastKey();\n }\n\n let containerRect = menu.getBoundingClientRect();\n let itemRect = item.getBoundingClientRect();\n if (this.orientation === 'horizontal') {\n let containerX = containerRect.x - menu.scrollLeft;\n let pageX = Math.min(menu.scrollWidth, (itemRect.x - containerX) - itemRect.width + containerRect.width);\n\n while (item && (itemRect.x - containerX) < pageX) {\n key = this.getKeyBelow(key);\n item = key == null ? null : this.getItem(key);\n itemRect = item?.getBoundingClientRect();\n }\n } else {\n let containerY = containerRect.y - menu.scrollTop;\n let pageY = Math.min(menu.scrollHeight, (itemRect.y - containerY) - itemRect.height + containerRect.height);\n\n while (item && (itemRect.y - containerY) < pageY) {\n key = this.getKeyBelow(key);\n item = key == null ? null : this.getItem(key);\n itemRect = item?.getBoundingClientRect();\n }\n }\n\n return key ?? this.getLastKey();\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let key = fromKey || this.getFirstKey();\n while (key != null) {\n let item = collection.getItem(key);\n let substring = item.textValue.slice(0, search.length);\n if (item.textValue && this.collator.compare(substring, search) === 0) {\n return key;\n }\n\n key = this.getKeyBelow(key);\n }\n\n return null;\n }\n}\n"],"names":[],"version":3,"file":"ListKeyboardDelegate.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAkBM,MAAM;IA4CH,WAAW,IAAmB,EAAE;YACK;QAA3C,OAAO,IAAI,CAAC,gBAAgB,KAAK,SAAU,CAAA,EAAA,cAAA,KAAK,KAAK,cAAV,kCAAA,YAAY,UAAU,KAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,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I,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE;YACzB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE;YAC3B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,MAAM,GAAG;YACd,IAAI,CAAC,WAAW,GAAG;YACnB,IAAI,CAAC,gBAAgB,GAAG;YACxB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA,GAAA,2CAAgB,EAAE,IAAI,CAAC,GAAG;QACtD;QAEA,wEAAwE;QACxE,mDAAmD;QACnD,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,WAAW,KAAK,YAAY;YAC9D,IAAI,CAAC,YAAY,GAAG;YACpB,IAAI,CAAC,aAAa,GAAG;QACvB;IACF;AAyNF","sources":["packages/@react-aria/selection/src/ListKeyboardDelegate.ts"],"sourcesContent":["/*\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\nimport {Collection, Direction, DisabledBehavior, Key, KeyboardDelegate, LayoutDelegate, Node, Orientation, Rect, RefObject} from '@react-types/shared';\nimport {DOMLayoutDelegate} from './DOMLayoutDelegate';\nimport {isScrollable} from '@react-aria/utils';\n\ninterface ListKeyboardDelegateOptions<T> {\n collection: Collection<Node<T>>,\n ref: RefObject<HTMLElement | null>,\n collator?: Intl.Collator,\n layout?: 'stack' | 'grid',\n orientation?: Orientation,\n direction?: Direction,\n disabledKeys?: Set<Key>,\n disabledBehavior?: DisabledBehavior,\n layoutDelegate?: LayoutDelegate\n}\n\nexport class ListKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private disabledKeys: Set<Key>;\n private disabledBehavior: DisabledBehavior;\n private ref: RefObject<HTMLElement | null>;\n private collator: Intl.Collator | undefined;\n private layout: 'stack' | 'grid';\n private orientation?: Orientation;\n private direction?: Direction;\n private layoutDelegate: LayoutDelegate;\n\n constructor(collection: Collection<Node<T>>, disabledKeys: Set<Key>, ref: RefObject<HTMLElement | null>, collator?: Intl.Collator);\n constructor(options: ListKeyboardDelegateOptions<T>);\n constructor(...args: any[]) {\n if (args.length === 1) {\n let opts = args[0] as ListKeyboardDelegateOptions<T>;\n this.collection = opts.collection;\n this.ref = opts.ref;\n this.collator = opts.collator;\n this.disabledKeys = opts.disabledKeys || new Set();\n this.disabledBehavior = opts.disabledBehavior || 'all';\n this.orientation = opts.orientation || 'vertical';\n this.direction = opts.direction;\n this.layout = opts.layout || 'stack';\n this.layoutDelegate = opts.layoutDelegate || new DOMLayoutDelegate(opts.ref);\n } else {\n this.collection = args[0];\n this.disabledKeys = args[1];\n this.ref = args[2];\n this.collator = args[3];\n this.layout = 'stack';\n this.orientation = 'vertical';\n this.disabledBehavior = 'all';\n this.layoutDelegate = new DOMLayoutDelegate(this.ref);\n }\n\n // If this is a vertical stack, remove the left/right methods completely\n // so they aren't called by useDroppableCollection.\n if (this.layout === 'stack' && this.orientation === 'vertical') {\n this.getKeyLeftOf = undefined;\n this.getKeyRightOf = undefined;\n }\n }\n\n private isDisabled(item: Node<unknown>) {\n return this.disabledBehavior === 'all' && (item.props?.isDisabled || this.disabledKeys.has(item.key));\n }\n\n getNextKey(key: Key) {\n key = this.collection.getKeyAfter(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.isDisabled(item)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return null;\n }\n\n getPreviousKey(key: Key) {\n key = this.collection.getKeyBefore(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.isDisabled(item)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n\n return null;\n }\n\n private findKey(\n key: Key,\n nextKey: (key: Key) => Key,\n shouldSkip: (prevRect: Rect, itemRect: Rect) => boolean\n ) {\n let itemRect = this.layoutDelegate.getItemRect(key);\n if (!itemRect) {\n return null;\n }\n\n // Find the item above or below in the same column.\n let prevRect = itemRect;\n do {\n key = nextKey(key);\n itemRect = this.layoutDelegate.getItemRect(key);\n } while (itemRect && shouldSkip(prevRect, itemRect));\n\n return key;\n }\n\n private isSameRow(prevRect: Rect, itemRect: Rect) {\n return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;\n }\n\n private isSameColumn(prevRect: Rect, itemRect: Rect) {\n return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;\n }\n\n getKeyBelow(key: Key) {\n if (this.layout === 'grid' && this.orientation === 'vertical') {\n return this.findKey(key, (key) => this.getNextKey(key), this.isSameRow);\n } else {\n return this.getNextKey(key);\n }\n }\n\n getKeyAbove(key: Key) {\n if (this.layout === 'grid' && this.orientation === 'vertical') {\n return this.findKey(key, (key) => this.getPreviousKey(key), this.isSameRow);\n } else {\n return this.getPreviousKey(key);\n }\n }\n\n private getNextColumn(key: Key, right: boolean) {\n return right ? this.getPreviousKey(key) : this.getNextKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.layout === 'grid') {\n if (this.orientation === 'vertical') {\n return this.getNextColumn(key, this.direction === 'rtl');\n } else {\n return this.findKey(key, (key) => this.getNextColumn(key, this.direction === 'rtl'), this.isSameColumn);\n }\n } else if (this.orientation === 'horizontal') {\n return this.getNextColumn(key, this.direction === 'rtl');\n }\n\n return null;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.layout === 'grid') {\n if (this.orientation === 'vertical') {\n return this.getNextColumn(key, this.direction === 'ltr');\n } else {\n return this.findKey(key, (key) => this.getNextColumn(key, this.direction === 'ltr'), this.isSameColumn);\n }\n } else if (this.orientation === 'horizontal') {\n return this.getNextColumn(key, this.direction === 'ltr');\n }\n\n return null;\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item?.type === 'item' && !this.isDisabled(item)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return null;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.isDisabled(item)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n\n return null;\n }\n\n getKeyPageAbove(key: Key) {\n let menu = this.ref.current;\n let itemRect = this.layoutDelegate.getItemRect(key);\n if (!itemRect) {\n return null;\n }\n\n if (!isScrollable(menu)) {\n return this.getFirstKey();\n }\n\n if (this.orientation === 'horizontal') {\n let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);\n\n while (itemRect && itemRect.x > pageX) {\n key = this.getKeyAbove(key);\n itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);\n }\n } else {\n let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);\n\n while (itemRect && itemRect.y > pageY) {\n key = this.getKeyAbove(key);\n itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);\n }\n }\n\n return key ?? this.getFirstKey();\n }\n\n getKeyPageBelow(key: Key) {\n let menu = this.ref.current;\n let itemRect = this.layoutDelegate.getItemRect(key);\n if (!itemRect) {\n return null;\n }\n\n if (!isScrollable(menu)) {\n return this.getLastKey();\n }\n\n if (this.orientation === 'horizontal') {\n let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);\n\n while (itemRect && itemRect.x < pageX) {\n key = this.getKeyBelow(key);\n itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);\n }\n } else {\n let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);\n\n while (itemRect && itemRect.y < pageY) {\n key = this.getKeyBelow(key);\n itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);\n }\n }\n\n return key ?? this.getLastKey();\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let key = fromKey || this.getFirstKey();\n while (key != null) {\n let item = collection.getItem(key);\n let substring = item.textValue.slice(0, search.length);\n if (item.textValue && this.collator.compare(substring, search) === 0) {\n return key;\n }\n\n key = this.getKeyBelow(key);\n }\n\n return null;\n }\n}\n"],"names":[],"version":3,"file":"ListKeyboardDelegate.main.js.map"}
@@ -1,3 +1,4 @@
1
+ import {DOMLayoutDelegate as $657e4dc4a6e88df0$export$8f5ed9ff9f511381} from "./DOMLayoutDelegate.mjs";
1
2
  import {isScrollable as $eak97$isScrollable} from "@react-aria/utils";
2
3
 
3
4
  /*
@@ -11,6 +12,7 @@ import {isScrollable as $eak97$isScrollable} from "@react-aria/utils";
11
12
  * OF ANY KIND, either express or implied. See the License for the specific language
12
13
  * governing permissions and limitations under the License.
13
14
  */
15
+
14
16
  class $2a25aae57d74318e$export$a05409b8bb224a5a {
15
17
  isDisabled(item) {
16
18
  var _item_props;
@@ -35,21 +37,21 @@ class $2a25aae57d74318e$export$a05409b8bb224a5a {
35
37
  return null;
36
38
  }
37
39
  findKey(key, nextKey, shouldSkip) {
38
- let item = this.getItem(key);
39
- if (!item) return null;
40
+ let itemRect = this.layoutDelegate.getItemRect(key);
41
+ if (!itemRect) return null;
40
42
  // Find the item above or below in the same column.
41
- let prevRect = item.getBoundingClientRect();
43
+ let prevRect = itemRect;
42
44
  do {
43
45
  key = nextKey(key);
44
- item = this.getItem(key);
45
- }while (item && shouldSkip(prevRect, item.getBoundingClientRect()));
46
+ itemRect = this.layoutDelegate.getItemRect(key);
47
+ }while (itemRect && shouldSkip(prevRect, itemRect));
46
48
  return key;
47
49
  }
48
50
  isSameRow(prevRect, itemRect) {
49
- return prevRect.top === itemRect.top || prevRect.left !== itemRect.left;
51
+ return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
50
52
  }
51
53
  isSameColumn(prevRect, itemRect) {
52
- return prevRect.left === itemRect.left || prevRect.top !== itemRect.top;
54
+ return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;
53
55
  }
54
56
  getKeyBelow(key) {
55
57
  if (this.layout === 'grid' && this.orientation === 'vertical') return this.findKey(key, (key)=>this.getNextKey(key), this.isSameRow);
@@ -94,57 +96,42 @@ class $2a25aae57d74318e$export$a05409b8bb224a5a {
94
96
  }
95
97
  return null;
96
98
  }
97
- getItem(key) {
98
- return key !== null ? this.ref.current.querySelector(`[data-key="${CSS.escape(key.toString())}"]`) : null;
99
- }
100
99
  getKeyPageAbove(key) {
101
100
  let menu = this.ref.current;
102
- let item = this.getItem(key);
103
- if (!item) return null;
101
+ let itemRect = this.layoutDelegate.getItemRect(key);
102
+ if (!itemRect) return null;
104
103
  if (!(0, $eak97$isScrollable)(menu)) return this.getFirstKey();
105
- let containerRect = menu.getBoundingClientRect();
106
- let itemRect = item.getBoundingClientRect();
107
104
  if (this.orientation === 'horizontal') {
108
- let containerX = containerRect.x - menu.scrollLeft;
109
- let pageX = Math.max(0, itemRect.x - containerX + itemRect.width - containerRect.width);
110
- while(item && itemRect.x - containerX > pageX){
105
+ let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);
106
+ while(itemRect && itemRect.x > pageX){
111
107
  key = this.getKeyAbove(key);
112
- item = key == null ? null : this.getItem(key);
113
- itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
108
+ itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);
114
109
  }
115
110
  } else {
116
- let containerY = containerRect.y - menu.scrollTop;
117
- let pageY = Math.max(0, itemRect.y - containerY + itemRect.height - containerRect.height);
118
- while(item && itemRect.y - containerY > pageY){
111
+ let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
112
+ while(itemRect && itemRect.y > pageY){
119
113
  key = this.getKeyAbove(key);
120
- item = key == null ? null : this.getItem(key);
121
- itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
114
+ itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);
122
115
  }
123
116
  }
124
117
  return key !== null && key !== void 0 ? key : this.getFirstKey();
125
118
  }
126
119
  getKeyPageBelow(key) {
127
120
  let menu = this.ref.current;
128
- let item = this.getItem(key);
129
- if (!item) return null;
121
+ let itemRect = this.layoutDelegate.getItemRect(key);
122
+ if (!itemRect) return null;
130
123
  if (!(0, $eak97$isScrollable)(menu)) return this.getLastKey();
131
- let containerRect = menu.getBoundingClientRect();
132
- let itemRect = item.getBoundingClientRect();
133
124
  if (this.orientation === 'horizontal') {
134
- let containerX = containerRect.x - menu.scrollLeft;
135
- let pageX = Math.min(menu.scrollWidth, itemRect.x - containerX - itemRect.width + containerRect.width);
136
- while(item && itemRect.x - containerX < pageX){
125
+ let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);
126
+ while(itemRect && itemRect.x < pageX){
137
127
  key = this.getKeyBelow(key);
138
- item = key == null ? null : this.getItem(key);
139
- itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
128
+ itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);
140
129
  }
141
130
  } else {
142
- let containerY = containerRect.y - menu.scrollTop;
143
- let pageY = Math.min(menu.scrollHeight, itemRect.y - containerY - itemRect.height + containerRect.height);
144
- while(item && itemRect.y - containerY < pageY){
131
+ let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);
132
+ while(itemRect && itemRect.y < pageY){
145
133
  key = this.getKeyBelow(key);
146
- item = key == null ? null : this.getItem(key);
147
- itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
134
+ itemRect = key == null ? null : this.layoutDelegate.getItemRect(key);
148
135
  }
149
136
  }
150
137
  return key !== null && key !== void 0 ? key : this.getLastKey();
@@ -169,9 +156,10 @@ class $2a25aae57d74318e$export$a05409b8bb224a5a {
169
156
  this.collator = opts.collator;
170
157
  this.disabledKeys = opts.disabledKeys || new Set();
171
158
  this.disabledBehavior = opts.disabledBehavior || 'all';
172
- this.orientation = opts.orientation;
159
+ this.orientation = opts.orientation || 'vertical';
173
160
  this.direction = opts.direction;
174
161
  this.layout = opts.layout || 'stack';
162
+ this.layoutDelegate = opts.layoutDelegate || new (0, $657e4dc4a6e88df0$export$8f5ed9ff9f511381)(opts.ref);
175
163
  } else {
176
164
  this.collection = args[0];
177
165
  this.disabledKeys = args[1];
@@ -180,6 +168,7 @@ class $2a25aae57d74318e$export$a05409b8bb224a5a {
180
168
  this.layout = 'stack';
181
169
  this.orientation = 'vertical';
182
170
  this.disabledBehavior = 'all';
171
+ this.layoutDelegate = new (0, $657e4dc4a6e88df0$export$8f5ed9ff9f511381)(this.ref);
183
172
  }
184
173
  // If this is a vertical stack, remove the left/right methods completely
185
174
  // so they aren't called by useDroppableCollection.