@react-aria/selection 3.7.2 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +91 -80
- package/dist/main.js.map +1 -1
- package/dist/module.js +87 -76
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/useSelectableItem.ts +27 -7
package/dist/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
1
|
+
var $glPPV$react = require("react");
|
|
2
|
+
var $glPPV$reactariafocus = require("@react-aria/focus");
|
|
3
|
+
var $glPPV$reactariautils = require("@react-aria/utils");
|
|
4
|
+
var $glPPV$reactariai18n = require("@react-aria/i18n");
|
|
5
|
+
var $glPPV$reactariainteractions = require("@react-aria/interactions");
|
|
6
6
|
|
|
7
7
|
function $parcel$exportWildcard(dest, source) {
|
|
8
8
|
Object.keys(source).forEach(function(key) {
|
|
@@ -23,38 +23,38 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
23
23
|
function $parcel$export(e, n, v, s) {
|
|
24
24
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
25
25
|
}
|
|
26
|
-
var $
|
|
26
|
+
var $b6837c2f80a3c32f$exports = {};
|
|
27
27
|
|
|
28
|
-
$parcel$export($
|
|
28
|
+
$parcel$export($b6837c2f80a3c32f$exports, "useSelectableCollection", () => $b6837c2f80a3c32f$export$d6daf82dcd84e87c);
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
function $
|
|
34
|
+
function $ee0bdf4faa47f2a8$export$d3e3bd3e26688c04(e) {
|
|
35
35
|
// Ctrl + Arrow Up/Arrow Down has a system wide meaning on macOS, so use Alt instead.
|
|
36
36
|
// On Windows and Ubuntu, Alt + Space has a system wide meaning.
|
|
37
|
-
return $
|
|
37
|
+
return $glPPV$reactariautils.isAppleDevice() ? e.altKey : e.ctrlKey;
|
|
38
38
|
}
|
|
39
|
-
function $
|
|
40
|
-
if ($
|
|
39
|
+
function $ee0bdf4faa47f2a8$export$16792effe837dba3(e) {
|
|
40
|
+
if ($glPPV$reactariautils.isMac()) return e.metaKey;
|
|
41
41
|
return e.ctrlKey;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var $
|
|
46
|
+
var $a1189052f36475e8$exports = {};
|
|
47
47
|
|
|
48
|
-
$parcel$export($
|
|
48
|
+
$parcel$export($a1189052f36475e8$exports, "useTypeSelect", () => $a1189052f36475e8$export$e32c88dfddc6e1d8);
|
|
49
49
|
|
|
50
|
-
function $
|
|
50
|
+
function $a1189052f36475e8$export$e32c88dfddc6e1d8(options) {
|
|
51
51
|
let { keyboardDelegate: keyboardDelegate , selectionManager: selectionManager , onTypeSelect: onTypeSelect } = options;
|
|
52
|
-
let state = $
|
|
52
|
+
let state = $glPPV$react.useRef({
|
|
53
53
|
search: '',
|
|
54
54
|
timeout: null
|
|
55
55
|
}).current;
|
|
56
56
|
let onKeyDown = (e)=>{
|
|
57
|
-
let character = $
|
|
57
|
+
let character = $a1189052f36475e8$var$getStringForKey(e.key);
|
|
58
58
|
if (!character || e.ctrlKey || e.metaKey) return;
|
|
59
59
|
// Do not propagate the Spacebar event if it's meant to be part of the search.
|
|
60
60
|
// When we time out, the search term becomes empty, hence the check on length.
|
|
@@ -87,7 +87,7 @@ function $f7ddb42583332a58$export$e32c88dfddc6e1d8(options) {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
function $
|
|
90
|
+
function $a1189052f36475e8$var$getStringForKey(key) {
|
|
91
91
|
// If the key is of length 1, it is an ASCII value.
|
|
92
92
|
// Otherwise, if there are no ASCII characters in the key name,
|
|
93
93
|
// it is a Unicode character.
|
|
@@ -97,10 +97,10 @@ function $f7ddb42583332a58$var$getStringForKey(key) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
function $
|
|
100
|
+
function $b6837c2f80a3c32f$export$d6daf82dcd84e87c(options) {
|
|
101
101
|
let { selectionManager: manager , keyboardDelegate: delegate , ref: ref , autoFocus: autoFocus = false , shouldFocusWrap: shouldFocusWrap = false , disallowEmptySelection: disallowEmptySelection = false , disallowSelectAll: disallowSelectAll = false , selectOnFocus: selectOnFocus = manager.selectionBehavior === 'replace' , disallowTypeAhead: disallowTypeAhead = false , shouldUseVirtualFocus: shouldUseVirtualFocus , allowsTabNavigation: allowsTabNavigation = false , isVirtualized: isVirtualized , scrollRef: // If no scrollRef is provided, assume the collection ref is the scrollable region
|
|
102
102
|
scrollRef = ref } = options;
|
|
103
|
-
let { direction: direction } = $
|
|
103
|
+
let { direction: direction } = $glPPV$reactariai18n.useLocale();
|
|
104
104
|
let onKeyDown = (e)=>{
|
|
105
105
|
// Prevent option + tab from doing anything since it doesn't move focus to the cells, only buttons/checkboxes
|
|
106
106
|
if (e.altKey && e.key === 'Tab') e.preventDefault();
|
|
@@ -111,23 +111,25 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
111
111
|
if (key != null) {
|
|
112
112
|
manager.setFocusedKey(key, childFocus);
|
|
113
113
|
if (e.shiftKey && manager.selectionMode === 'multiple') manager.extendSelection(key);
|
|
114
|
-
else if (selectOnFocus && !$
|
|
114
|
+
else if (selectOnFocus && !$ee0bdf4faa47f2a8$export$d3e3bd3e26688c04(e)) manager.replaceSelection(key);
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
switch(e.key){
|
|
118
118
|
case 'ArrowDown':
|
|
119
119
|
if (delegate.getKeyBelow) {
|
|
120
|
+
var ref4, ref1;
|
|
120
121
|
e.preventDefault();
|
|
121
|
-
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : delegate.getFirstKey
|
|
122
|
-
if (nextKey == null && shouldFocusWrap) nextKey = delegate.getFirstKey
|
|
122
|
+
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : (ref4 = delegate.getFirstKey) === null || ref4 === void 0 ? void 0 : ref4.call(delegate);
|
|
123
|
+
if (nextKey == null && shouldFocusWrap) nextKey = (ref1 = delegate.getFirstKey) === null || ref1 === void 0 ? void 0 : ref1.call(delegate, manager.focusedKey);
|
|
123
124
|
navigateToKey(nextKey);
|
|
124
125
|
}
|
|
125
126
|
break;
|
|
126
127
|
case 'ArrowUp':
|
|
127
128
|
if (delegate.getKeyAbove) {
|
|
129
|
+
var ref2, ref3;
|
|
128
130
|
e.preventDefault();
|
|
129
|
-
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : delegate.getLastKey
|
|
130
|
-
if (nextKey == null && shouldFocusWrap) nextKey = delegate.getLastKey
|
|
131
|
+
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : (ref2 = delegate.getLastKey) === null || ref2 === void 0 ? void 0 : ref2.call(delegate);
|
|
132
|
+
if (nextKey == null && shouldFocusWrap) nextKey = (ref3 = delegate.getLastKey) === null || ref3 === void 0 ? void 0 : ref3.call(delegate, manager.focusedKey);
|
|
131
133
|
navigateToKey(nextKey);
|
|
132
134
|
}
|
|
133
135
|
break;
|
|
@@ -148,18 +150,18 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
148
150
|
case 'Home':
|
|
149
151
|
if (delegate.getFirstKey) {
|
|
150
152
|
e.preventDefault();
|
|
151
|
-
let firstKey = delegate.getFirstKey(manager.focusedKey, $
|
|
153
|
+
let firstKey = delegate.getFirstKey(manager.focusedKey, $ee0bdf4faa47f2a8$export$16792effe837dba3(e));
|
|
152
154
|
manager.setFocusedKey(firstKey);
|
|
153
|
-
if ($
|
|
155
|
+
if ($ee0bdf4faa47f2a8$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === 'multiple') manager.extendSelection(firstKey);
|
|
154
156
|
else if (selectOnFocus) manager.replaceSelection(firstKey);
|
|
155
157
|
}
|
|
156
158
|
break;
|
|
157
159
|
case 'End':
|
|
158
160
|
if (delegate.getLastKey) {
|
|
159
161
|
e.preventDefault();
|
|
160
|
-
let lastKey = delegate.getLastKey(manager.focusedKey, $
|
|
162
|
+
let lastKey = delegate.getLastKey(manager.focusedKey, $ee0bdf4faa47f2a8$export$16792effe837dba3(e));
|
|
161
163
|
manager.setFocusedKey(lastKey);
|
|
162
|
-
if ($
|
|
164
|
+
if ($ee0bdf4faa47f2a8$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === 'multiple') manager.extendSelection(lastKey);
|
|
163
165
|
else if (selectOnFocus) manager.replaceSelection(lastKey);
|
|
164
166
|
}
|
|
165
167
|
break;
|
|
@@ -178,7 +180,7 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
178
180
|
}
|
|
179
181
|
break;
|
|
180
182
|
case 'a':
|
|
181
|
-
if ($
|
|
183
|
+
if ($ee0bdf4faa47f2a8$export$16792effe837dba3(e) && manager.selectionMode === 'multiple' && disallowSelectAll !== true) {
|
|
182
184
|
e.preventDefault();
|
|
183
185
|
manager.selectAll();
|
|
184
186
|
}
|
|
@@ -197,7 +199,7 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
197
199
|
// rather than the currently focused one.
|
|
198
200
|
if (e.shiftKey) ref.current.focus();
|
|
199
201
|
else {
|
|
200
|
-
let walker = $
|
|
202
|
+
let walker = $glPPV$reactariafocus.getFocusableTreeWalker(ref.current, {
|
|
201
203
|
tabbable: true
|
|
202
204
|
});
|
|
203
205
|
let next;
|
|
@@ -206,18 +208,18 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
206
208
|
last = walker.lastChild();
|
|
207
209
|
if (last) next = last;
|
|
208
210
|
}while (last)
|
|
209
|
-
if (next && !next.contains(document.activeElement)) $
|
|
211
|
+
if (next && !next.contains(document.activeElement)) $glPPV$reactariautils.focusWithoutScrolling(next);
|
|
210
212
|
}
|
|
211
213
|
break;
|
|
212
214
|
}
|
|
213
215
|
}
|
|
214
216
|
};
|
|
215
217
|
// Store the scroll position so we can restore it later.
|
|
216
|
-
let scrollPos = $
|
|
218
|
+
let scrollPos = $glPPV$react.useRef({
|
|
217
219
|
top: 0,
|
|
218
220
|
left: 0
|
|
219
221
|
});
|
|
220
|
-
$
|
|
222
|
+
$glPPV$reactariautils.useEvent(scrollRef, 'scroll', isVirtualized ? null : ()=>{
|
|
221
223
|
scrollPos.current = {
|
|
222
224
|
top: scrollRef.current.scrollTop,
|
|
223
225
|
left: scrollRef.current.scrollLeft
|
|
@@ -243,8 +245,9 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
243
245
|
// Attempt to detect whether the user is tabbing forward or backward into the collection
|
|
244
246
|
// and either focus the first or last item accordingly.
|
|
245
247
|
let relatedTarget = e.relatedTarget;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
+
var _lastSelectedKey, _firstSelectedKey;
|
|
249
|
+
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) navigateToFirstKey((_lastSelectedKey = manager.lastSelectedKey) !== null && _lastSelectedKey !== void 0 ? _lastSelectedKey : delegate.getLastKey());
|
|
250
|
+
else navigateToFirstKey((_firstSelectedKey = manager.firstSelectedKey) !== null && _firstSelectedKey !== void 0 ? _firstSelectedKey : delegate.getFirstKey());
|
|
248
251
|
} else if (!isVirtualized) {
|
|
249
252
|
// Restore the scroll position to what it was before.
|
|
250
253
|
scrollRef.current.scrollTop = scrollPos.current.top;
|
|
@@ -253,8 +256,8 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
253
256
|
let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
|
|
254
257
|
if (element) {
|
|
255
258
|
// This prevents a flash of focus on the first/last element in the collection
|
|
256
|
-
$
|
|
257
|
-
$
|
|
259
|
+
$glPPV$reactariautils.focusWithoutScrolling(element);
|
|
260
|
+
$glPPV$reactariautils.scrollIntoView(scrollRef.current, element);
|
|
258
261
|
}
|
|
259
262
|
}
|
|
260
263
|
};
|
|
@@ -262,8 +265,8 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
262
265
|
// Don't set blurred and then focused again if moving focus within the collection.
|
|
263
266
|
if (!e.currentTarget.contains(e.relatedTarget)) manager.setFocused(false);
|
|
264
267
|
};
|
|
265
|
-
const autoFocusRef = $
|
|
266
|
-
$
|
|
268
|
+
const autoFocusRef = $glPPV$react.useRef(autoFocus);
|
|
269
|
+
$glPPV$react.useEffect(()=>{
|
|
267
270
|
if (autoFocusRef.current) {
|
|
268
271
|
let focusedKey = null;
|
|
269
272
|
// Check focus strategy to determine which item to focus
|
|
@@ -275,17 +278,17 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
275
278
|
manager.setFocused(true);
|
|
276
279
|
manager.setFocusedKey(focusedKey);
|
|
277
280
|
// If no default focus key is selected, focus the collection itself.
|
|
278
|
-
if (focusedKey == null && !shouldUseVirtualFocus) $
|
|
281
|
+
if (focusedKey == null && !shouldUseVirtualFocus) $glPPV$reactariafocus.focusSafely(ref.current);
|
|
279
282
|
}
|
|
280
283
|
autoFocusRef.current = false;
|
|
281
284
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
282
285
|
}, []);
|
|
283
286
|
// If not virtualized, scroll the focused element into view when the focusedKey changes.
|
|
284
287
|
// When virtualized, Virtualizer handles this internally.
|
|
285
|
-
$
|
|
286
|
-
if (!isVirtualized && manager.focusedKey && scrollRef
|
|
288
|
+
$glPPV$react.useEffect(()=>{
|
|
289
|
+
if (!isVirtualized && manager.focusedKey && (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
|
|
287
290
|
let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
|
|
288
|
-
if (element) $
|
|
291
|
+
if (element) $glPPV$reactariautils.scrollIntoView(scrollRef.current, element);
|
|
289
292
|
}
|
|
290
293
|
}, [
|
|
291
294
|
isVirtualized,
|
|
@@ -302,11 +305,11 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
302
305
|
e.preventDefault();
|
|
303
306
|
}
|
|
304
307
|
};
|
|
305
|
-
let { typeSelectProps: typeSelectProps } = $
|
|
308
|
+
let { typeSelectProps: typeSelectProps } = $a1189052f36475e8$export$e32c88dfddc6e1d8({
|
|
306
309
|
keyboardDelegate: delegate,
|
|
307
310
|
selectionManager: manager
|
|
308
311
|
});
|
|
309
|
-
if (!disallowTypeAhead) handlers = $
|
|
312
|
+
if (!disallowTypeAhead) handlers = $glPPV$reactariautils.mergeProps(typeSelectProps, handlers);
|
|
310
313
|
// If nothing is focused within the collection, make the collection itself tabbable.
|
|
311
314
|
// This will be marshalled to either the first or last item depending on where focus came from.
|
|
312
315
|
// If using virtual focus, don't set a tabIndex at all so that VoiceOver on iOS 14 doesn't try
|
|
@@ -322,35 +325,35 @@ function $e872cdf6539aaf0b$export$d6daf82dcd84e87c(options) {
|
|
|
322
325
|
}
|
|
323
326
|
|
|
324
327
|
|
|
325
|
-
var $
|
|
328
|
+
var $433b1145b0781e10$exports = {};
|
|
326
329
|
|
|
327
|
-
$parcel$export($
|
|
330
|
+
$parcel$export($433b1145b0781e10$exports, "useSelectableItem", () => $433b1145b0781e10$export$ecf600387e221c37);
|
|
328
331
|
|
|
329
332
|
|
|
330
333
|
|
|
331
334
|
|
|
332
335
|
|
|
333
|
-
function $
|
|
334
|
-
let { selectionManager: manager , key: key , ref: ref , shouldSelectOnPressUp: shouldSelectOnPressUp , isVirtualized: isVirtualized , shouldUseVirtualFocus: shouldUseVirtualFocus , focus: focus , isDisabled: isDisabled , onAction: onAction } = options;
|
|
336
|
+
function $433b1145b0781e10$export$ecf600387e221c37(options) {
|
|
337
|
+
let { selectionManager: manager , key: key , ref: ref , shouldSelectOnPressUp: shouldSelectOnPressUp , isVirtualized: isVirtualized , shouldUseVirtualFocus: shouldUseVirtualFocus , focus: focus , isDisabled: isDisabled , onAction: onAction , allowsDifferentPressOrigin: allowsDifferentPressOrigin } = options;
|
|
335
338
|
let onSelect = (e)=>{
|
|
336
|
-
if (e.pointerType === 'keyboard' && $
|
|
339
|
+
if (e.pointerType === 'keyboard' && $ee0bdf4faa47f2a8$export$d3e3bd3e26688c04(e)) manager.toggleSelection(key);
|
|
337
340
|
else {
|
|
338
341
|
if (manager.selectionMode === 'none') return;
|
|
339
342
|
if (manager.selectionMode === 'single') {
|
|
340
343
|
if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);
|
|
341
344
|
else manager.replaceSelection(key);
|
|
342
345
|
} else if (e && e.shiftKey) manager.extendSelection(key);
|
|
343
|
-
else if (manager.selectionBehavior === 'toggle' || e && ($
|
|
346
|
+
else if (manager.selectionBehavior === 'toggle' || e && ($ee0bdf4faa47f2a8$export$16792effe837dba3(e) || e.pointerType === 'touch' || e.pointerType === 'virtual')) // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys
|
|
344
347
|
manager.toggleSelection(key);
|
|
345
348
|
else manager.replaceSelection(key);
|
|
346
349
|
}
|
|
347
350
|
};
|
|
348
351
|
// Focus the associated DOM node when this item becomes the focusedKey
|
|
349
352
|
let isFocused = key === manager.focusedKey;
|
|
350
|
-
$
|
|
353
|
+
$glPPV$react.useEffect(()=>{
|
|
351
354
|
if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {
|
|
352
355
|
if (focus) focus();
|
|
353
|
-
else $
|
|
356
|
+
else $glPPV$reactariafocus.focusSafely(ref.current);
|
|
354
357
|
}
|
|
355
358
|
}, [
|
|
356
359
|
ref,
|
|
@@ -371,7 +374,7 @@ function $d4f3f6d764be397c$export$ecf600387e221c37(options) {
|
|
|
371
374
|
if (e.target === ref.current) manager.setFocusedKey(key);
|
|
372
375
|
}
|
|
373
376
|
};
|
|
374
|
-
let modality = $
|
|
377
|
+
let modality = $glPPV$react.useRef(null);
|
|
375
378
|
let hasPrimaryAction = onAction && manager.selectionMode === 'none';
|
|
376
379
|
let hasSecondaryAction = onAction && manager.selectionMode !== 'none' && manager.selectionBehavior === 'replace';
|
|
377
380
|
let allowsSelection = !isDisabled && manager.canSelectItem(key);
|
|
@@ -389,11 +392,19 @@ function $d4f3f6d764be397c$export$ecf600387e221c37(options) {
|
|
|
389
392
|
modality.current = e.pointerType;
|
|
390
393
|
if (e.pointerType === 'keyboard') onSelect(e);
|
|
391
394
|
};
|
|
392
|
-
|
|
395
|
+
// If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)
|
|
396
|
+
// Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)
|
|
397
|
+
if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e)=>{
|
|
393
398
|
if (e.pointerType !== 'keyboard') onSelect(e);
|
|
399
|
+
if (hasPrimaryAction) onAction();
|
|
394
400
|
};
|
|
395
|
-
|
|
396
|
-
|
|
401
|
+
else {
|
|
402
|
+
itemPressProps.onPressUp = (e)=>{
|
|
403
|
+
if (e.pointerType !== 'keyboard') onSelect(e);
|
|
404
|
+
};
|
|
405
|
+
itemPressProps.onPress = hasPrimaryAction ? ()=>onAction()
|
|
406
|
+
: null;
|
|
407
|
+
}
|
|
397
408
|
} else {
|
|
398
409
|
// On touch, it feels strange to select on touch down, so we special case this.
|
|
399
410
|
itemPressProps.onPressStart = (e)=>{
|
|
@@ -411,7 +422,7 @@ function $d4f3f6d764be397c$export$ecf600387e221c37(options) {
|
|
|
411
422
|
}
|
|
412
423
|
if (!isVirtualized) itemProps['data-key'] = key;
|
|
413
424
|
itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
|
|
414
|
-
let { pressProps: pressProps , isPressed: isPressed } = $
|
|
425
|
+
let { pressProps: pressProps , isPressed: isPressed } = $glPPV$reactariainteractions.usePress(itemPressProps);
|
|
415
426
|
// Double clicking with a mouse with selectionBehavior = 'replace' performs an action.
|
|
416
427
|
let onDoubleClick = hasSecondaryAction ? (e)=>{
|
|
417
428
|
if (modality.current === 'mouse') {
|
|
@@ -424,7 +435,7 @@ function $d4f3f6d764be397c$export$ecf600387e221c37(options) {
|
|
|
424
435
|
// to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to
|
|
425
436
|
// selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.
|
|
426
437
|
// TODO: what about when drag and drop is also enabled??
|
|
427
|
-
let { longPressProps: longPressProps } = $
|
|
438
|
+
let { longPressProps: longPressProps } = $glPPV$reactariainteractions.useLongPress({
|
|
428
439
|
isDisabled: !hasSecondaryAction,
|
|
429
440
|
onLongPress (e) {
|
|
430
441
|
if (e.pointerType === 'touch') {
|
|
@@ -438,7 +449,7 @@ function $d4f3f6d764be397c$export$ecf600387e221c37(options) {
|
|
|
438
449
|
if (e.key === 'Enter') onAction();
|
|
439
450
|
} : undefined;
|
|
440
451
|
return {
|
|
441
|
-
itemProps: $
|
|
452
|
+
itemProps: $glPPV$reactariautils.mergeProps(itemProps, allowsSelection || hasPrimaryAction ? pressProps : {
|
|
442
453
|
}, hasSecondaryAction ? longPressProps : {
|
|
443
454
|
}, {
|
|
444
455
|
onKeyUp: onKeyUp,
|
|
@@ -449,20 +460,14 @@ function $d4f3f6d764be397c$export$ecf600387e221c37(options) {
|
|
|
449
460
|
}
|
|
450
461
|
|
|
451
462
|
|
|
452
|
-
var $
|
|
463
|
+
var $bd230acee196f50c$exports = {};
|
|
453
464
|
|
|
454
|
-
$parcel$export($
|
|
465
|
+
$parcel$export($bd230acee196f50c$exports, "useSelectableList", () => $bd230acee196f50c$export$b95089534ab7c1fd);
|
|
455
466
|
|
|
456
|
-
var $
|
|
467
|
+
var $836f880b12dcae5c$exports = {};
|
|
457
468
|
|
|
458
|
-
$parcel$export($
|
|
459
|
-
class $
|
|
460
|
-
constructor(collection, disabledKeys, ref, collator){
|
|
461
|
-
this.collection = collection;
|
|
462
|
-
this.disabledKeys = disabledKeys;
|
|
463
|
-
this.ref = ref;
|
|
464
|
-
this.collator = collator;
|
|
465
|
-
}
|
|
469
|
+
$parcel$export($836f880b12dcae5c$exports, "ListKeyboardDelegate", () => $836f880b12dcae5c$export$a05409b8bb224a5a);
|
|
470
|
+
class $836f880b12dcae5c$export$a05409b8bb224a5a {
|
|
466
471
|
getKeyBelow(key) {
|
|
467
472
|
key = this.collection.getKeyAfter(key);
|
|
468
473
|
while(key != null){
|
|
@@ -532,20 +537,26 @@ class $4c5a6431f43e7e74$export$a05409b8bb224a5a {
|
|
|
532
537
|
}
|
|
533
538
|
return null;
|
|
534
539
|
}
|
|
540
|
+
constructor(collection, disabledKeys, ref, collator){
|
|
541
|
+
this.collection = collection;
|
|
542
|
+
this.disabledKeys = disabledKeys;
|
|
543
|
+
this.ref = ref;
|
|
544
|
+
this.collator = collator;
|
|
545
|
+
}
|
|
535
546
|
}
|
|
536
547
|
|
|
537
548
|
|
|
538
549
|
|
|
539
550
|
|
|
540
|
-
function $
|
|
551
|
+
function $bd230acee196f50c$export$b95089534ab7c1fd(props) {
|
|
541
552
|
let { selectionManager: selectionManager , collection: collection , disabledKeys: disabledKeys , ref: ref , keyboardDelegate: keyboardDelegate , autoFocus: autoFocus , shouldFocusWrap: shouldFocusWrap , isVirtualized: isVirtualized , disallowEmptySelection: disallowEmptySelection , selectOnFocus: selectOnFocus = false , disallowTypeAhead: disallowTypeAhead , shouldUseVirtualFocus: shouldUseVirtualFocus , allowsTabNavigation: allowsTabNavigation } = props;
|
|
542
553
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
543
554
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
544
|
-
let collator = $
|
|
555
|
+
let collator = $glPPV$reactariai18n.useCollator({
|
|
545
556
|
usage: 'search',
|
|
546
557
|
sensitivity: 'base'
|
|
547
558
|
});
|
|
548
|
-
let delegate = $
|
|
559
|
+
let delegate = $glPPV$react.useMemo(()=>keyboardDelegate || new $836f880b12dcae5c$export$a05409b8bb224a5a(collection, disabledKeys, ref, collator)
|
|
549
560
|
, [
|
|
550
561
|
keyboardDelegate,
|
|
551
562
|
collection,
|
|
@@ -553,7 +564,7 @@ function $1908cf9b6ab7b508$export$b95089534ab7c1fd(props) {
|
|
|
553
564
|
ref,
|
|
554
565
|
collator
|
|
555
566
|
]);
|
|
556
|
-
let { collectionProps: collectionProps } = $
|
|
567
|
+
let { collectionProps: collectionProps } = $b6837c2f80a3c32f$export$d6daf82dcd84e87c({
|
|
557
568
|
ref: ref,
|
|
558
569
|
selectionManager: selectionManager,
|
|
559
570
|
keyboardDelegate: delegate,
|
|
@@ -575,11 +586,11 @@ function $1908cf9b6ab7b508$export$b95089534ab7c1fd(props) {
|
|
|
575
586
|
|
|
576
587
|
|
|
577
588
|
|
|
578
|
-
$parcel$exportWildcard(module.exports, $
|
|
579
|
-
$parcel$exportWildcard(module.exports, $
|
|
580
|
-
$parcel$exportWildcard(module.exports, $
|
|
581
|
-
$parcel$exportWildcard(module.exports, $
|
|
582
|
-
$parcel$exportWildcard(module.exports, $
|
|
589
|
+
$parcel$exportWildcard(module.exports, $b6837c2f80a3c32f$exports);
|
|
590
|
+
$parcel$exportWildcard(module.exports, $433b1145b0781e10$exports);
|
|
591
|
+
$parcel$exportWildcard(module.exports, $bd230acee196f50c$exports);
|
|
592
|
+
$parcel$exportWildcard(module.exports, $836f880b12dcae5c$exports);
|
|
593
|
+
$parcel$exportWildcard(module.exports, $a1189052f36475e8$exports);
|
|
583
594
|
|
|
584
595
|
|
|
585
596
|
//# sourceMappingURL=main.js.map
|