@react-aria/selection 3.18.0 → 3.18.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/ListKeyboardDelegate.main.js +23 -23
- package/dist/ListKeyboardDelegate.mjs +24 -24
- package/dist/ListKeyboardDelegate.module.js +23 -23
- package/dist/useSelectableCollection.main.js +30 -30
- package/dist/useSelectableCollection.mjs +31 -31
- package/dist/useSelectableCollection.module.js +30 -30
- package/dist/useSelectableItem.main.js +25 -25
- package/dist/useSelectableItem.mjs +26 -26
- package/dist/useSelectableItem.module.js +25 -25
- package/dist/useSelectableList.main.js +2 -2
- package/dist/useSelectableList.mjs +3 -3
- package/dist/useSelectableList.module.js +2 -2
- package/dist/useTypeSelect.main.js +5 -5
- package/dist/useTypeSelect.mjs +6 -6
- package/dist/useTypeSelect.module.js +5 -5
- package/dist/utils.mjs +1 -1
- package/package.json +8 -8
|
@@ -20,26 +20,26 @@ import {useEffect as $581M0$useEffect, useRef as $581M0$useRef} from "react";
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
23
|
-
let { selectionManager: manager, key: key, ref: ref, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldUseVirtualFocus: shouldUseVirtualFocus, focus: focus, isDisabled: isDisabled, onAction: onAction, allowsDifferentPressOrigin: allowsDifferentPressOrigin, linkBehavior: linkBehavior =
|
|
23
|
+
let { selectionManager: manager, key: key, ref: ref, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldUseVirtualFocus: shouldUseVirtualFocus, focus: focus, isDisabled: isDisabled, onAction: onAction, allowsDifferentPressOrigin: allowsDifferentPressOrigin, linkBehavior: linkBehavior = 'action' } = options;
|
|
24
24
|
let router = (0, $581M0$useRouter)();
|
|
25
25
|
let onSelect = (e)=>{
|
|
26
|
-
if (e.pointerType ===
|
|
26
|
+
if (e.pointerType === 'keyboard' && (0, $feb5ffebff200149$export$d3e3bd3e26688c04)(e)) manager.toggleSelection(key);
|
|
27
27
|
else {
|
|
28
|
-
if (manager.selectionMode ===
|
|
28
|
+
if (manager.selectionMode === 'none') return;
|
|
29
29
|
if (manager.isLink(key)) {
|
|
30
|
-
if (linkBehavior ===
|
|
30
|
+
if (linkBehavior === 'selection') {
|
|
31
31
|
let itemProps = manager.getItemProps(key);
|
|
32
32
|
router.open(ref.current, e, itemProps.href, itemProps.routerOptions);
|
|
33
33
|
// Always set selected keys back to what they were so that select and combobox close.
|
|
34
34
|
manager.setSelectedKeys(manager.selectedKeys);
|
|
35
35
|
return;
|
|
36
|
-
} else if (linkBehavior ===
|
|
36
|
+
} else if (linkBehavior === 'override' || linkBehavior === 'none') return;
|
|
37
37
|
}
|
|
38
|
-
if (manager.selectionMode ===
|
|
38
|
+
if (manager.selectionMode === 'single') {
|
|
39
39
|
if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);
|
|
40
40
|
else manager.replaceSelection(key);
|
|
41
41
|
} else if (e && e.shiftKey) manager.extendSelection(key);
|
|
42
|
-
else if (manager.selectionBehavior ===
|
|
42
|
+
else if (manager.selectionBehavior === 'toggle' || e && ((0, $feb5ffebff200149$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
|
|
43
43
|
manager.toggleSelection(key);
|
|
44
44
|
else manager.replaceSelection(key);
|
|
45
45
|
}
|
|
@@ -79,12 +79,12 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
79
79
|
// Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.
|
|
80
80
|
// With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.
|
|
81
81
|
// With touch, onAction occurs on single tap, and long press enters selection mode.
|
|
82
|
-
let isLinkOverride = manager.isLink(key) && linkBehavior ===
|
|
83
|
-
let hasLinkAction = manager.isLink(key) && linkBehavior !==
|
|
82
|
+
let isLinkOverride = manager.isLink(key) && linkBehavior === 'override';
|
|
83
|
+
let hasLinkAction = manager.isLink(key) && linkBehavior !== 'selection' && linkBehavior !== 'none';
|
|
84
84
|
let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride;
|
|
85
85
|
let allowsActions = (onAction || hasLinkAction) && !isDisabled;
|
|
86
|
-
let hasPrimaryAction = allowsActions && (manager.selectionBehavior ===
|
|
87
|
-
let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior ===
|
|
86
|
+
let hasPrimaryAction = allowsActions && (manager.selectionBehavior === 'replace' ? !allowsSelection : !allowsSelection || manager.isEmpty);
|
|
87
|
+
let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';
|
|
88
88
|
let hasAction = hasPrimaryAction || hasSecondaryAction;
|
|
89
89
|
let modality = (0, $581M0$useRef)(null);
|
|
90
90
|
let longPressEnabled = hasAction && allowsSelection;
|
|
@@ -109,19 +109,19 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
109
109
|
itemPressProps.onPressStart = (e)=>{
|
|
110
110
|
modality.current = e.pointerType;
|
|
111
111
|
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
112
|
-
if (e.pointerType ===
|
|
112
|
+
if (e.pointerType === 'keyboard' && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey())) onSelect(e);
|
|
113
113
|
};
|
|
114
114
|
// If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)
|
|
115
115
|
// Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)
|
|
116
116
|
if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e)=>{
|
|
117
|
-
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !==
|
|
118
|
-
if (e.pointerType ===
|
|
117
|
+
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== 'mouse') {
|
|
118
|
+
if (e.pointerType === 'keyboard' && !$880e95eb8b93ba9a$var$isActionKey()) return;
|
|
119
119
|
performAction(e);
|
|
120
|
-
} else if (e.pointerType !==
|
|
120
|
+
} else if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);
|
|
121
121
|
};
|
|
122
122
|
else {
|
|
123
123
|
itemPressProps.onPressUp = hasPrimaryAction ? null : (e)=>{
|
|
124
|
-
if (e.pointerType !==
|
|
124
|
+
if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);
|
|
125
125
|
};
|
|
126
126
|
itemPressProps.onPress = hasPrimaryAction ? performAction : null;
|
|
127
127
|
}
|
|
@@ -133,24 +133,24 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
133
133
|
// Select on mouse down unless there is a primary action which will occur on mouse up.
|
|
134
134
|
// For keyboard, select on key down. If there is an action, the Space key selects on key down,
|
|
135
135
|
// and the Enter key performs onAction on key up.
|
|
136
|
-
if (allowsSelection && (e.pointerType ===
|
|
136
|
+
if (allowsSelection && (e.pointerType === 'mouse' && !hasPrimaryAction || e.pointerType === 'keyboard' && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey()))) onSelect(e);
|
|
137
137
|
};
|
|
138
138
|
itemPressProps.onPress = (e)=>{
|
|
139
139
|
// Selection occurs on touch up. Primary actions always occur on pointer up.
|
|
140
140
|
// Both primary and secondary actions occur on Enter key up. The only exception
|
|
141
141
|
// is secondary actions, which occur on double click with a mouse.
|
|
142
|
-
if (e.pointerType ===
|
|
142
|
+
if (e.pointerType === 'touch' || e.pointerType === 'pen' || e.pointerType === 'virtual' || e.pointerType === 'keyboard' && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current) {
|
|
143
143
|
if (hasAction) performAction(e);
|
|
144
144
|
else if (allowsSelection) onSelect(e);
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
itemProps[
|
|
148
|
+
itemProps['data-key'] = key;
|
|
149
149
|
itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
|
|
150
150
|
let { pressProps: pressProps, isPressed: isPressed } = (0, $581M0$usePress)(itemPressProps);
|
|
151
151
|
// Double clicking with a mouse with selectionBehavior = 'replace' performs an action.
|
|
152
152
|
let onDoubleClick = hasSecondaryAction ? (e)=>{
|
|
153
|
-
if (modality.current ===
|
|
153
|
+
if (modality.current === 'mouse') {
|
|
154
154
|
e.stopPropagation();
|
|
155
155
|
e.preventDefault();
|
|
156
156
|
performAction(e);
|
|
@@ -162,9 +162,9 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
162
162
|
let { longPressProps: longPressProps } = (0, $581M0$useLongPress)({
|
|
163
163
|
isDisabled: !longPressEnabled,
|
|
164
164
|
onLongPress (e) {
|
|
165
|
-
if (e.pointerType ===
|
|
165
|
+
if (e.pointerType === 'touch') {
|
|
166
166
|
onSelect(e);
|
|
167
|
-
manager.setSelectionBehavior(
|
|
167
|
+
manager.setSelectionBehavior('toggle');
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
});
|
|
@@ -173,7 +173,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
173
173
|
// Use a capturing listener to ensure this runs before useDrag, regardless of
|
|
174
174
|
// the order the props get merged.
|
|
175
175
|
let onDragStartCapture = (e)=>{
|
|
176
|
-
if (modality.current ===
|
|
176
|
+
if (modality.current === 'touch' && longPressEnabledOnPressStart.current) e.preventDefault();
|
|
177
177
|
};
|
|
178
178
|
// Prevent default on link clicks so that we control exactly
|
|
179
179
|
// when they open (to match selection behavior).
|
|
@@ -196,13 +196,13 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
196
196
|
}
|
|
197
197
|
function $880e95eb8b93ba9a$var$isActionKey() {
|
|
198
198
|
let event = window.event;
|
|
199
|
-
return (event === null || event === void 0 ? void 0 : event.key) ===
|
|
199
|
+
return (event === null || event === void 0 ? void 0 : event.key) === 'Enter';
|
|
200
200
|
}
|
|
201
201
|
function $880e95eb8b93ba9a$var$isSelectionKey() {
|
|
202
202
|
let event = window.event;
|
|
203
|
-
return (event === null || event === void 0 ? void 0 : event.key) ===
|
|
203
|
+
return (event === null || event === void 0 ? void 0 : event.key) === ' ' || (event === null || event === void 0 ? void 0 : event.code) === 'Space';
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
|
|
207
207
|
export {$880e95eb8b93ba9a$export$ecf600387e221c37 as useSelectableItem};
|
|
208
|
-
//# sourceMappingURL=useSelectableItem.
|
|
208
|
+
//# sourceMappingURL=useSelectableItem.module.js.map
|
|
@@ -20,26 +20,26 @@ import {useEffect as $581M0$useEffect, useRef as $581M0$useRef} from "react";
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
23
|
-
let { selectionManager: manager, key: key, ref: ref, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldUseVirtualFocus: shouldUseVirtualFocus, focus: focus, isDisabled: isDisabled, onAction: onAction, allowsDifferentPressOrigin: allowsDifferentPressOrigin, linkBehavior: linkBehavior =
|
|
23
|
+
let { selectionManager: manager, key: key, ref: ref, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldUseVirtualFocus: shouldUseVirtualFocus, focus: focus, isDisabled: isDisabled, onAction: onAction, allowsDifferentPressOrigin: allowsDifferentPressOrigin, linkBehavior: linkBehavior = 'action' } = options;
|
|
24
24
|
let router = (0, $581M0$useRouter)();
|
|
25
25
|
let onSelect = (e)=>{
|
|
26
|
-
if (e.pointerType ===
|
|
26
|
+
if (e.pointerType === 'keyboard' && (0, $feb5ffebff200149$export$d3e3bd3e26688c04)(e)) manager.toggleSelection(key);
|
|
27
27
|
else {
|
|
28
|
-
if (manager.selectionMode ===
|
|
28
|
+
if (manager.selectionMode === 'none') return;
|
|
29
29
|
if (manager.isLink(key)) {
|
|
30
|
-
if (linkBehavior ===
|
|
30
|
+
if (linkBehavior === 'selection') {
|
|
31
31
|
let itemProps = manager.getItemProps(key);
|
|
32
32
|
router.open(ref.current, e, itemProps.href, itemProps.routerOptions);
|
|
33
33
|
// Always set selected keys back to what they were so that select and combobox close.
|
|
34
34
|
manager.setSelectedKeys(manager.selectedKeys);
|
|
35
35
|
return;
|
|
36
|
-
} else if (linkBehavior ===
|
|
36
|
+
} else if (linkBehavior === 'override' || linkBehavior === 'none') return;
|
|
37
37
|
}
|
|
38
|
-
if (manager.selectionMode ===
|
|
38
|
+
if (manager.selectionMode === 'single') {
|
|
39
39
|
if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);
|
|
40
40
|
else manager.replaceSelection(key);
|
|
41
41
|
} else if (e && e.shiftKey) manager.extendSelection(key);
|
|
42
|
-
else if (manager.selectionBehavior ===
|
|
42
|
+
else if (manager.selectionBehavior === 'toggle' || e && ((0, $feb5ffebff200149$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
|
|
43
43
|
manager.toggleSelection(key);
|
|
44
44
|
else manager.replaceSelection(key);
|
|
45
45
|
}
|
|
@@ -79,12 +79,12 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
79
79
|
// Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.
|
|
80
80
|
// With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.
|
|
81
81
|
// With touch, onAction occurs on single tap, and long press enters selection mode.
|
|
82
|
-
let isLinkOverride = manager.isLink(key) && linkBehavior ===
|
|
83
|
-
let hasLinkAction = manager.isLink(key) && linkBehavior !==
|
|
82
|
+
let isLinkOverride = manager.isLink(key) && linkBehavior === 'override';
|
|
83
|
+
let hasLinkAction = manager.isLink(key) && linkBehavior !== 'selection' && linkBehavior !== 'none';
|
|
84
84
|
let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride;
|
|
85
85
|
let allowsActions = (onAction || hasLinkAction) && !isDisabled;
|
|
86
|
-
let hasPrimaryAction = allowsActions && (manager.selectionBehavior ===
|
|
87
|
-
let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior ===
|
|
86
|
+
let hasPrimaryAction = allowsActions && (manager.selectionBehavior === 'replace' ? !allowsSelection : !allowsSelection || manager.isEmpty);
|
|
87
|
+
let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';
|
|
88
88
|
let hasAction = hasPrimaryAction || hasSecondaryAction;
|
|
89
89
|
let modality = (0, $581M0$useRef)(null);
|
|
90
90
|
let longPressEnabled = hasAction && allowsSelection;
|
|
@@ -109,19 +109,19 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
109
109
|
itemPressProps.onPressStart = (e)=>{
|
|
110
110
|
modality.current = e.pointerType;
|
|
111
111
|
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
112
|
-
if (e.pointerType ===
|
|
112
|
+
if (e.pointerType === 'keyboard' && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey())) onSelect(e);
|
|
113
113
|
};
|
|
114
114
|
// If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)
|
|
115
115
|
// Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)
|
|
116
116
|
if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e)=>{
|
|
117
|
-
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !==
|
|
118
|
-
if (e.pointerType ===
|
|
117
|
+
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== 'mouse') {
|
|
118
|
+
if (e.pointerType === 'keyboard' && !$880e95eb8b93ba9a$var$isActionKey()) return;
|
|
119
119
|
performAction(e);
|
|
120
|
-
} else if (e.pointerType !==
|
|
120
|
+
} else if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);
|
|
121
121
|
};
|
|
122
122
|
else {
|
|
123
123
|
itemPressProps.onPressUp = hasPrimaryAction ? null : (e)=>{
|
|
124
|
-
if (e.pointerType !==
|
|
124
|
+
if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);
|
|
125
125
|
};
|
|
126
126
|
itemPressProps.onPress = hasPrimaryAction ? performAction : null;
|
|
127
127
|
}
|
|
@@ -133,24 +133,24 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
133
133
|
// Select on mouse down unless there is a primary action which will occur on mouse up.
|
|
134
134
|
// For keyboard, select on key down. If there is an action, the Space key selects on key down,
|
|
135
135
|
// and the Enter key performs onAction on key up.
|
|
136
|
-
if (allowsSelection && (e.pointerType ===
|
|
136
|
+
if (allowsSelection && (e.pointerType === 'mouse' && !hasPrimaryAction || e.pointerType === 'keyboard' && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey()))) onSelect(e);
|
|
137
137
|
};
|
|
138
138
|
itemPressProps.onPress = (e)=>{
|
|
139
139
|
// Selection occurs on touch up. Primary actions always occur on pointer up.
|
|
140
140
|
// Both primary and secondary actions occur on Enter key up. The only exception
|
|
141
141
|
// is secondary actions, which occur on double click with a mouse.
|
|
142
|
-
if (e.pointerType ===
|
|
142
|
+
if (e.pointerType === 'touch' || e.pointerType === 'pen' || e.pointerType === 'virtual' || e.pointerType === 'keyboard' && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current) {
|
|
143
143
|
if (hasAction) performAction(e);
|
|
144
144
|
else if (allowsSelection) onSelect(e);
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
itemProps[
|
|
148
|
+
itemProps['data-key'] = key;
|
|
149
149
|
itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
|
|
150
150
|
let { pressProps: pressProps, isPressed: isPressed } = (0, $581M0$usePress)(itemPressProps);
|
|
151
151
|
// Double clicking with a mouse with selectionBehavior = 'replace' performs an action.
|
|
152
152
|
let onDoubleClick = hasSecondaryAction ? (e)=>{
|
|
153
|
-
if (modality.current ===
|
|
153
|
+
if (modality.current === 'mouse') {
|
|
154
154
|
e.stopPropagation();
|
|
155
155
|
e.preventDefault();
|
|
156
156
|
performAction(e);
|
|
@@ -162,9 +162,9 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
162
162
|
let { longPressProps: longPressProps } = (0, $581M0$useLongPress)({
|
|
163
163
|
isDisabled: !longPressEnabled,
|
|
164
164
|
onLongPress (e) {
|
|
165
|
-
if (e.pointerType ===
|
|
165
|
+
if (e.pointerType === 'touch') {
|
|
166
166
|
onSelect(e);
|
|
167
|
-
manager.setSelectionBehavior(
|
|
167
|
+
manager.setSelectionBehavior('toggle');
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
});
|
|
@@ -173,7 +173,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
173
173
|
// Use a capturing listener to ensure this runs before useDrag, regardless of
|
|
174
174
|
// the order the props get merged.
|
|
175
175
|
let onDragStartCapture = (e)=>{
|
|
176
|
-
if (modality.current ===
|
|
176
|
+
if (modality.current === 'touch' && longPressEnabledOnPressStart.current) e.preventDefault();
|
|
177
177
|
};
|
|
178
178
|
// Prevent default on link clicks so that we control exactly
|
|
179
179
|
// when they open (to match selection behavior).
|
|
@@ -196,11 +196,11 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
196
196
|
}
|
|
197
197
|
function $880e95eb8b93ba9a$var$isActionKey() {
|
|
198
198
|
let event = window.event;
|
|
199
|
-
return (event === null || event === void 0 ? void 0 : event.key) ===
|
|
199
|
+
return (event === null || event === void 0 ? void 0 : event.key) === 'Enter';
|
|
200
200
|
}
|
|
201
201
|
function $880e95eb8b93ba9a$var$isSelectionKey() {
|
|
202
202
|
let event = window.event;
|
|
203
|
-
return (event === null || event === void 0 ? void 0 : event.key) ===
|
|
203
|
+
return (event === null || event === void 0 ? void 0 : event.key) === ' ' || (event === null || event === void 0 ? void 0 : event.code) === 'Space';
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
|
|
@@ -28,8 +28,8 @@ function $bd230acee196f50c$export$b95089534ab7c1fd(props) {
|
|
|
28
28
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
29
29
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
30
30
|
let collator = (0, $lm2JY$reactariai18n.useCollator)({
|
|
31
|
-
usage:
|
|
32
|
-
sensitivity:
|
|
31
|
+
usage: 'search',
|
|
32
|
+
sensitivity: 'base'
|
|
33
33
|
});
|
|
34
34
|
let disabledBehavior = selectionManager.disabledBehavior;
|
|
35
35
|
let delegate = (0, $lm2JY$react.useMemo)(()=>keyboardDelegate || new (0, $836f880b12dcae5c$exports.ListKeyboardDelegate)({
|
|
@@ -22,8 +22,8 @@ function $982254629710d113$export$b95089534ab7c1fd(props) {
|
|
|
22
22
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
23
23
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
24
24
|
let collator = (0, $1aJk5$useCollator)({
|
|
25
|
-
usage:
|
|
26
|
-
sensitivity:
|
|
25
|
+
usage: 'search',
|
|
26
|
+
sensitivity: 'base'
|
|
27
27
|
});
|
|
28
28
|
let disabledBehavior = selectionManager.disabledBehavior;
|
|
29
29
|
let delegate = (0, $1aJk5$useMemo)(()=>keyboardDelegate || new (0, $2a25aae57d74318e$export$a05409b8bb224a5a)({
|
|
@@ -53,4 +53,4 @@ function $982254629710d113$export$b95089534ab7c1fd(props) {
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
export {$982254629710d113$export$b95089534ab7c1fd as useSelectableList};
|
|
56
|
-
//# sourceMappingURL=useSelectableList.
|
|
56
|
+
//# sourceMappingURL=useSelectableList.module.js.map
|
|
@@ -22,8 +22,8 @@ function $982254629710d113$export$b95089534ab7c1fd(props) {
|
|
|
22
22
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
23
23
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
24
24
|
let collator = (0, $1aJk5$useCollator)({
|
|
25
|
-
usage:
|
|
26
|
-
sensitivity:
|
|
25
|
+
usage: 'search',
|
|
26
|
+
sensitivity: 'base'
|
|
27
27
|
});
|
|
28
28
|
let disabledBehavior = selectionManager.disabledBehavior;
|
|
29
29
|
let delegate = (0, $1aJk5$useMemo)(()=>keyboardDelegate || new (0, $2a25aae57d74318e$export$a05409b8bb224a5a)({
|
|
@@ -23,7 +23,7 @@ $parcel$export(module.exports, "useTypeSelect", () => $a1189052f36475e8$export$e
|
|
|
23
23
|
function $a1189052f36475e8$export$e32c88dfddc6e1d8(options) {
|
|
24
24
|
let { keyboardDelegate: keyboardDelegate, selectionManager: selectionManager, onTypeSelect: onTypeSelect } = options;
|
|
25
25
|
let state = (0, $3XJlT$react.useRef)({
|
|
26
|
-
search:
|
|
26
|
+
search: '',
|
|
27
27
|
timeout: null
|
|
28
28
|
}).current;
|
|
29
29
|
let onKeyDown = (e)=>{
|
|
@@ -33,9 +33,9 @@ function $a1189052f36475e8$export$e32c88dfddc6e1d8(options) {
|
|
|
33
33
|
// When we time out, the search term becomes empty, hence the check on length.
|
|
34
34
|
// Trimming is to account for the case of pressing the Spacebar more than once,
|
|
35
35
|
// which should cycle through the selection/deselection of the focused item.
|
|
36
|
-
if (character ===
|
|
36
|
+
if (character === ' ' && state.search.trim().length > 0) {
|
|
37
37
|
e.preventDefault();
|
|
38
|
-
if (!(
|
|
38
|
+
if (!('continuePropagation' in e)) e.stopPropagation();
|
|
39
39
|
}
|
|
40
40
|
state.search += character;
|
|
41
41
|
// Use the delegate to find a key to focus.
|
|
@@ -49,7 +49,7 @@ function $a1189052f36475e8$export$e32c88dfddc6e1d8(options) {
|
|
|
49
49
|
}
|
|
50
50
|
clearTimeout(state.timeout);
|
|
51
51
|
state.timeout = setTimeout(()=>{
|
|
52
|
-
state.search =
|
|
52
|
+
state.search = '';
|
|
53
53
|
}, $a1189052f36475e8$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
|
|
54
54
|
};
|
|
55
55
|
return {
|
|
@@ -66,7 +66,7 @@ function $a1189052f36475e8$var$getStringForKey(key) {
|
|
|
66
66
|
// it is a Unicode character.
|
|
67
67
|
// See https://www.w3.org/TR/uievents-key/
|
|
68
68
|
if (key.length === 1 || !/^[A-Z]/i.test(key)) return key;
|
|
69
|
-
return
|
|
69
|
+
return '';
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
|
package/dist/useTypeSelect.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {useRef as $dAE4Y$useRef} from "react";
|
|
|
17
17
|
function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
18
18
|
let { keyboardDelegate: keyboardDelegate, selectionManager: selectionManager, onTypeSelect: onTypeSelect } = options;
|
|
19
19
|
let state = (0, $dAE4Y$useRef)({
|
|
20
|
-
search:
|
|
20
|
+
search: '',
|
|
21
21
|
timeout: null
|
|
22
22
|
}).current;
|
|
23
23
|
let onKeyDown = (e)=>{
|
|
@@ -27,9 +27,9 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
27
27
|
// When we time out, the search term becomes empty, hence the check on length.
|
|
28
28
|
// Trimming is to account for the case of pressing the Spacebar more than once,
|
|
29
29
|
// which should cycle through the selection/deselection of the focused item.
|
|
30
|
-
if (character ===
|
|
30
|
+
if (character === ' ' && state.search.trim().length > 0) {
|
|
31
31
|
e.preventDefault();
|
|
32
|
-
if (!(
|
|
32
|
+
if (!('continuePropagation' in e)) e.stopPropagation();
|
|
33
33
|
}
|
|
34
34
|
state.search += character;
|
|
35
35
|
// Use the delegate to find a key to focus.
|
|
@@ -43,7 +43,7 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
43
43
|
}
|
|
44
44
|
clearTimeout(state.timeout);
|
|
45
45
|
state.timeout = setTimeout(()=>{
|
|
46
|
-
state.search =
|
|
46
|
+
state.search = '';
|
|
47
47
|
}, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
|
|
48
48
|
};
|
|
49
49
|
return {
|
|
@@ -60,9 +60,9 @@ function $fb3050f43d946246$var$getStringForKey(key) {
|
|
|
60
60
|
// it is a Unicode character.
|
|
61
61
|
// See https://www.w3.org/TR/uievents-key/
|
|
62
62
|
if (key.length === 1 || !/^[A-Z]/i.test(key)) return key;
|
|
63
|
-
return
|
|
63
|
+
return '';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
export {$fb3050f43d946246$export$e32c88dfddc6e1d8 as useTypeSelect};
|
|
68
|
-
//# sourceMappingURL=useTypeSelect.
|
|
68
|
+
//# sourceMappingURL=useTypeSelect.module.js.map
|
|
@@ -17,7 +17,7 @@ import {useRef as $dAE4Y$useRef} from "react";
|
|
|
17
17
|
function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
18
18
|
let { keyboardDelegate: keyboardDelegate, selectionManager: selectionManager, onTypeSelect: onTypeSelect } = options;
|
|
19
19
|
let state = (0, $dAE4Y$useRef)({
|
|
20
|
-
search:
|
|
20
|
+
search: '',
|
|
21
21
|
timeout: null
|
|
22
22
|
}).current;
|
|
23
23
|
let onKeyDown = (e)=>{
|
|
@@ -27,9 +27,9 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
27
27
|
// When we time out, the search term becomes empty, hence the check on length.
|
|
28
28
|
// Trimming is to account for the case of pressing the Spacebar more than once,
|
|
29
29
|
// which should cycle through the selection/deselection of the focused item.
|
|
30
|
-
if (character ===
|
|
30
|
+
if (character === ' ' && state.search.trim().length > 0) {
|
|
31
31
|
e.preventDefault();
|
|
32
|
-
if (!(
|
|
32
|
+
if (!('continuePropagation' in e)) e.stopPropagation();
|
|
33
33
|
}
|
|
34
34
|
state.search += character;
|
|
35
35
|
// Use the delegate to find a key to focus.
|
|
@@ -43,7 +43,7 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
43
43
|
}
|
|
44
44
|
clearTimeout(state.timeout);
|
|
45
45
|
state.timeout = setTimeout(()=>{
|
|
46
|
-
state.search =
|
|
46
|
+
state.search = '';
|
|
47
47
|
}, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
|
|
48
48
|
};
|
|
49
49
|
return {
|
|
@@ -60,7 +60,7 @@ function $fb3050f43d946246$var$getStringForKey(key) {
|
|
|
60
60
|
// it is a Unicode character.
|
|
61
61
|
// See https://www.w3.org/TR/uievents-key/
|
|
62
62
|
if (key.length === 1 || !/^[A-Z]/i.test(key)) return key;
|
|
63
|
-
return
|
|
63
|
+
return '';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
|
package/dist/utils.mjs
CHANGED
|
@@ -23,4 +23,4 @@ function $feb5ffebff200149$export$16792effe837dba3(e) {
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
export {$feb5ffebff200149$export$d3e3bd3e26688c04 as isNonContiguousSelectionModifier, $feb5ffebff200149$export$16792effe837dba3 as isCtrlKeyPressed};
|
|
26
|
-
//# sourceMappingURL=utils.
|
|
26
|
+
//# sourceMappingURL=utils.module.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/selection",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.1",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "^3.17.
|
|
26
|
-
"@react-aria/i18n": "^3.11.
|
|
27
|
-
"@react-aria/interactions": "^3.21.
|
|
28
|
-
"@react-aria/utils": "^3.24.
|
|
29
|
-
"@react-stately/selection": "^3.15.
|
|
30
|
-
"@react-types/shared": "^3.23.
|
|
25
|
+
"@react-aria/focus": "^3.17.1",
|
|
26
|
+
"@react-aria/i18n": "^3.11.1",
|
|
27
|
+
"@react-aria/interactions": "^3.21.3",
|
|
28
|
+
"@react-aria/utils": "^3.24.1",
|
|
29
|
+
"@react-stately/selection": "^3.15.1",
|
|
30
|
+
"@react-types/shared": "^3.23.1",
|
|
31
31
|
"@swc/helpers": "^0.5.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
|
|
41
41
|
}
|