@react-aria/interactions 3.8.1 → 3.8.4
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 +397 -300
- package/dist/main.js.map +1 -1
- package/dist/module.js +386 -289
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/useFocus.ts +21 -15
- package/src/useFocusWithin.ts +20 -21
- package/src/usePress.ts +6 -6
- package/src/utils.ts +117 -0
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
1
|
+
var $goTMa$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $goTMa$react = require("react");
|
|
3
3
|
|
|
4
4
|
function $parcel$exportWildcard(dest, source) {
|
|
5
5
|
Object.keys(source).forEach(function(key) {
|
|
@@ -23,93 +23,189 @@ function $parcel$interopDefault(a) {
|
|
|
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 $e1dbec26039c051d$exports = {};
|
|
27
27
|
|
|
28
|
-
$parcel$export($
|
|
28
|
+
$parcel$export($e1dbec26039c051d$exports, "Pressable", () => $e1dbec26039c051d$export$27c701ed9e449e99);
|
|
29
29
|
|
|
30
|
-
var $
|
|
30
|
+
var $0294ea432cd92340$exports = {};
|
|
31
31
|
|
|
32
|
-
$parcel$export($
|
|
32
|
+
$parcel$export($0294ea432cd92340$exports, "usePress", () => $0294ea432cd92340$export$45712eceda6fad21);
|
|
33
33
|
|
|
34
34
|
// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
|
|
35
35
|
// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
|
|
36
|
-
let $
|
|
37
|
-
let $
|
|
38
|
-
let $
|
|
39
|
-
function $
|
|
40
|
-
if ($
|
|
41
|
-
if ($
|
|
42
|
-
$
|
|
36
|
+
let $f7e14e656343df57$var$state = 'default';
|
|
37
|
+
let $f7e14e656343df57$var$savedUserSelect = '';
|
|
38
|
+
let $f7e14e656343df57$var$modifiedElementMap = new WeakMap();
|
|
39
|
+
function $f7e14e656343df57$export$16a4697467175487(target) {
|
|
40
|
+
if ($goTMa$reactariautils.isIOS()) {
|
|
41
|
+
if ($f7e14e656343df57$var$state === 'default') {
|
|
42
|
+
$f7e14e656343df57$var$savedUserSelect = document.documentElement.style.webkitUserSelect;
|
|
43
43
|
document.documentElement.style.webkitUserSelect = 'none';
|
|
44
44
|
}
|
|
45
|
-
$
|
|
45
|
+
$f7e14e656343df57$var$state = 'disabled';
|
|
46
46
|
} else if (target) {
|
|
47
47
|
// If not iOS, store the target's original user-select and change to user-select: none
|
|
48
48
|
// Ignore state since it doesn't apply for non iOS
|
|
49
|
-
$
|
|
49
|
+
$f7e14e656343df57$var$modifiedElementMap.set(target, target.style.userSelect);
|
|
50
50
|
target.style.userSelect = 'none';
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
function $
|
|
54
|
-
if ($
|
|
53
|
+
function $f7e14e656343df57$export$b0d6fa1ab32e3295(target) {
|
|
54
|
+
if ($goTMa$reactariautils.isIOS()) {
|
|
55
55
|
// If the state is already default, there's nothing to do.
|
|
56
56
|
// If it is restoring, then there's no need to queue a second restore.
|
|
57
|
-
if ($
|
|
58
|
-
$
|
|
57
|
+
if ($f7e14e656343df57$var$state !== 'disabled') return;
|
|
58
|
+
$f7e14e656343df57$var$state = 'restoring';
|
|
59
59
|
// There appears to be a delay on iOS where selection still might occur
|
|
60
60
|
// after pointer up, so wait a bit before removing user-select.
|
|
61
61
|
setTimeout(()=>{
|
|
62
62
|
// Wait for any CSS transitions to complete so we don't recompute style
|
|
63
63
|
// for the whole page in the middle of the animation and cause jank.
|
|
64
|
-
$
|
|
64
|
+
$goTMa$reactariautils.runAfterTransition(()=>{
|
|
65
65
|
// Avoid race conditions
|
|
66
|
-
if ($
|
|
67
|
-
if (document.documentElement.style.webkitUserSelect === 'none') document.documentElement.style.webkitUserSelect = $
|
|
68
|
-
$
|
|
69
|
-
$
|
|
66
|
+
if ($f7e14e656343df57$var$state === 'restoring') {
|
|
67
|
+
if (document.documentElement.style.webkitUserSelect === 'none') document.documentElement.style.webkitUserSelect = $f7e14e656343df57$var$savedUserSelect || '';
|
|
68
|
+
$f7e14e656343df57$var$savedUserSelect = '';
|
|
69
|
+
$f7e14e656343df57$var$state = 'default';
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}, 300);
|
|
73
73
|
} else // If not iOS, restore the target's original user-select if any
|
|
74
74
|
// Ignore state since it doesn't apply for non iOS
|
|
75
|
-
if (target && $
|
|
76
|
-
let targetOldUserSelect = $
|
|
75
|
+
if (target && $f7e14e656343df57$var$modifiedElementMap.has(target)) {
|
|
76
|
+
let targetOldUserSelect = $f7e14e656343df57$var$modifiedElementMap.get(target);
|
|
77
77
|
if (target.style.userSelect === 'none') target.style.userSelect = targetOldUserSelect;
|
|
78
78
|
if (target.getAttribute('style') === '') target.removeAttribute('style');
|
|
79
|
-
$
|
|
79
|
+
$f7e14e656343df57$var$modifiedElementMap.delete(target);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
function $625cf83917e112ad$export$60278871457622de(event) {
|
|
87
89
|
// JAWS/NVDA with Firefox.
|
|
88
90
|
if (event.mozInputSource === 0 && event.isTrusted) return true;
|
|
89
91
|
return event.detail === 0 && !event.pointerType;
|
|
90
92
|
}
|
|
93
|
+
class $625cf83917e112ad$export$905e7fc544a71f36 {
|
|
94
|
+
isDefaultPrevented() {
|
|
95
|
+
return this.nativeEvent.defaultPrevented;
|
|
96
|
+
}
|
|
97
|
+
preventDefault() {
|
|
98
|
+
this.defaultPrevented = true;
|
|
99
|
+
this.nativeEvent.preventDefault();
|
|
100
|
+
}
|
|
101
|
+
stopPropagation() {
|
|
102
|
+
this.nativeEvent.stopPropagation();
|
|
103
|
+
this.isPropagationStopped = ()=>true
|
|
104
|
+
;
|
|
105
|
+
}
|
|
106
|
+
isPropagationStopped() {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
persist() {
|
|
110
|
+
}
|
|
111
|
+
constructor(type, nativeEvent){
|
|
112
|
+
this.nativeEvent = nativeEvent;
|
|
113
|
+
this.target = nativeEvent.target;
|
|
114
|
+
this.currentTarget = nativeEvent.currentTarget;
|
|
115
|
+
this.relatedTarget = nativeEvent.relatedTarget;
|
|
116
|
+
this.bubbles = nativeEvent.bubbles;
|
|
117
|
+
this.cancelable = nativeEvent.cancelable;
|
|
118
|
+
this.defaultPrevented = nativeEvent.defaultPrevented;
|
|
119
|
+
this.eventPhase = nativeEvent.eventPhase;
|
|
120
|
+
this.isTrusted = nativeEvent.isTrusted;
|
|
121
|
+
this.timeStamp = nativeEvent.timeStamp;
|
|
122
|
+
this.type = type;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function $625cf83917e112ad$export$715c682d09d639cc(onBlur) {
|
|
126
|
+
let stateRef = $goTMa$react.useRef({
|
|
127
|
+
isFocused: false,
|
|
128
|
+
onBlur: onBlur,
|
|
129
|
+
observer: null
|
|
130
|
+
});
|
|
131
|
+
let state1 = stateRef.current;
|
|
132
|
+
state1.onBlur = onBlur;
|
|
133
|
+
// Clean up MutationObserver on unmount. See below.
|
|
134
|
+
// eslint-disable-next-line arrow-body-style
|
|
135
|
+
$goTMa$reactariautils.useLayoutEffect(()=>{
|
|
136
|
+
return ()=>{
|
|
137
|
+
if (state1.observer) {
|
|
138
|
+
state1.observer.disconnect();
|
|
139
|
+
state1.observer = null;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}, [
|
|
143
|
+
state1
|
|
144
|
+
]);
|
|
145
|
+
// This function is called during a React onFocus event.
|
|
146
|
+
return (e1)=>{
|
|
147
|
+
// React does not fire onBlur when an element is disabled. https://github.com/facebook/react/issues/9142
|
|
148
|
+
// Most browsers fire a native focusout event in this case, except for Firefox. In that case, we use a
|
|
149
|
+
// MutationObserver to watch for the disabled attribute, and dispatch these events ourselves.
|
|
150
|
+
// For browsers that do, focusout fires before the MutationObserver, so onBlur should not fire twice.
|
|
151
|
+
if (e1.target instanceof HTMLButtonElement || e1.target instanceof HTMLInputElement || e1.target instanceof HTMLTextAreaElement || e1.target instanceof HTMLSelectElement) {
|
|
152
|
+
state1.isFocused = true;
|
|
153
|
+
let target = e1.target;
|
|
154
|
+
let onBlurHandler = (e)=>{
|
|
155
|
+
var // For backward compatibility, dispatch a (fake) React synthetic event.
|
|
156
|
+
ref;
|
|
157
|
+
let state = stateRef.current;
|
|
158
|
+
state.isFocused = false;
|
|
159
|
+
if (target.disabled) (ref = state.onBlur) === null || ref === void 0 ? void 0 : ref.call(state, new $625cf83917e112ad$export$905e7fc544a71f36('blur', e));
|
|
160
|
+
// We no longer need the MutationObserver once the target is blurred.
|
|
161
|
+
if (state.observer) {
|
|
162
|
+
state.observer.disconnect();
|
|
163
|
+
state.observer = null;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
target.addEventListener('focusout', onBlurHandler, {
|
|
167
|
+
once: true
|
|
168
|
+
});
|
|
169
|
+
state1.observer = new MutationObserver(()=>{
|
|
170
|
+
if (state1.isFocused && target.disabled) {
|
|
171
|
+
state1.observer.disconnect();
|
|
172
|
+
target.dispatchEvent(new FocusEvent('blur'));
|
|
173
|
+
target.dispatchEvent(new FocusEvent('focusout', {
|
|
174
|
+
bubbles: true
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
state1.observer.observe(target, {
|
|
179
|
+
attributes: true,
|
|
180
|
+
attributeFilter: [
|
|
181
|
+
'disabled'
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
91
187
|
|
|
92
188
|
|
|
93
189
|
|
|
94
|
-
const $
|
|
95
|
-
$
|
|
190
|
+
const $01d3f539e91688c8$export$5165eccb35aaadb5 = ($parcel$interopDefault($goTMa$react)).createContext(null);
|
|
191
|
+
$01d3f539e91688c8$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
|
|
96
192
|
|
|
97
193
|
|
|
98
|
-
function $
|
|
194
|
+
function $0294ea432cd92340$var$usePressResponderContext(props) {
|
|
99
195
|
// Consume context from <PressResponder> and merge with props.
|
|
100
|
-
let context = $
|
|
196
|
+
let context = $goTMa$react.useContext($01d3f539e91688c8$export$5165eccb35aaadb5);
|
|
101
197
|
if (context) {
|
|
102
198
|
let { register: register , ...contextProps } = context;
|
|
103
|
-
props = $
|
|
199
|
+
props = $goTMa$reactariautils.mergeProps(contextProps, props);
|
|
104
200
|
register();
|
|
105
201
|
}
|
|
106
|
-
$
|
|
202
|
+
$goTMa$reactariautils.useSyncRef(context, props.ref);
|
|
107
203
|
return props;
|
|
108
204
|
}
|
|
109
|
-
function $
|
|
205
|
+
function $0294ea432cd92340$export$45712eceda6fad21(props) {
|
|
110
206
|
let { onPress: onPress1 , onPressChange: onPressChange1 , onPressStart: onPressStart1 , onPressEnd: onPressEnd1 , onPressUp: onPressUp1 , isDisabled: isDisabled1 , isPressed: isPressedProp , preventFocusOnPress: preventFocusOnPress , shouldCancelOnPointerExit: shouldCancelOnPointerExit , allowTextSelectionOnPress: allowTextSelectionOnPress , // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
111
|
-
ref: _ , ...domProps } = $
|
|
112
|
-
let propsRef = $
|
|
207
|
+
ref: _ , ...domProps } = $0294ea432cd92340$var$usePressResponderContext(props);
|
|
208
|
+
let propsRef = $goTMa$react.useRef(null);
|
|
113
209
|
propsRef.current = {
|
|
114
210
|
onPress: onPress1,
|
|
115
211
|
onPressChange: onPressChange1,
|
|
@@ -119,8 +215,8 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
119
215
|
isDisabled: isDisabled1,
|
|
120
216
|
shouldCancelOnPointerExit: shouldCancelOnPointerExit
|
|
121
217
|
};
|
|
122
|
-
let [isPressed, setPressed] = $
|
|
123
|
-
let ref = $
|
|
218
|
+
let [isPressed, setPressed] = $goTMa$react.useState(false);
|
|
219
|
+
let ref = $goTMa$react.useRef({
|
|
124
220
|
isPressed: false,
|
|
125
221
|
ignoreEmulatedMouseEvents: false,
|
|
126
222
|
ignoreClickAfterPress: false,
|
|
@@ -130,8 +226,8 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
130
226
|
isOverTarget: false,
|
|
131
227
|
pointerType: null
|
|
132
228
|
});
|
|
133
|
-
let { addGlobalListener: addGlobalListener , removeAllGlobalListeners: removeAllGlobalListeners } = $
|
|
134
|
-
let pressProps1 = $
|
|
229
|
+
let { addGlobalListener: addGlobalListener , removeAllGlobalListeners: removeAllGlobalListeners } = $goTMa$reactariautils.useGlobalListeners();
|
|
230
|
+
let pressProps1 = $goTMa$react.useMemo(()=>{
|
|
135
231
|
let state = ref.current;
|
|
136
232
|
let triggerPressStart = (originalEvent, pointerType)=>{
|
|
137
233
|
let { onPressStart: onPressStart , onPressChange: onPressChange , isDisabled: isDisabled } = propsRef.current;
|
|
@@ -190,19 +286,19 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
190
286
|
};
|
|
191
287
|
let cancel = (e)=>{
|
|
192
288
|
if (state.isPressed) {
|
|
193
|
-
if (state.isOverTarget) triggerPressEnd($
|
|
289
|
+
if (state.isOverTarget) triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType, false);
|
|
194
290
|
state.isPressed = false;
|
|
195
291
|
state.isOverTarget = false;
|
|
196
292
|
state.activePointerId = null;
|
|
197
293
|
state.pointerType = null;
|
|
198
294
|
removeAllGlobalListeners();
|
|
199
|
-
if (!allowTextSelectionOnPress) $
|
|
295
|
+
if (!allowTextSelectionOnPress) $f7e14e656343df57$export$b0d6fa1ab32e3295(state.target);
|
|
200
296
|
}
|
|
201
297
|
};
|
|
202
298
|
let pressProps = {
|
|
203
299
|
onKeyDown (e) {
|
|
204
|
-
if ($
|
|
205
|
-
if ($
|
|
300
|
+
if ($0294ea432cd92340$var$isValidKeyboardEvent(e.nativeEvent) && e.currentTarget.contains(e.target)) {
|
|
301
|
+
if ($0294ea432cd92340$var$shouldPreventDefaultKeyboard(e.target)) e.preventDefault();
|
|
206
302
|
e.stopPropagation();
|
|
207
303
|
// If the event is repeating, it may have started on a different element
|
|
208
304
|
// after which focus moved to the current element. Ignore these events and
|
|
@@ -218,7 +314,7 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
218
314
|
}
|
|
219
315
|
},
|
|
220
316
|
onKeyUp (e) {
|
|
221
|
-
if ($
|
|
317
|
+
if ($0294ea432cd92340$var$isValidKeyboardEvent(e.nativeEvent) && !e.repeat && e.currentTarget.contains(e.target)) triggerPressUp($0294ea432cd92340$var$createEvent(state.target, e), 'keyboard');
|
|
222
318
|
},
|
|
223
319
|
onClick (e) {
|
|
224
320
|
if (e && !e.currentTarget.contains(e.target)) return;
|
|
@@ -227,9 +323,9 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
227
323
|
if (isDisabled1) e.preventDefault();
|
|
228
324
|
// If triggered from a screen reader or by using element.click(),
|
|
229
325
|
// trigger as if it were a keyboard click.
|
|
230
|
-
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && (state.pointerType === 'virtual' || $
|
|
326
|
+
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && (state.pointerType === 'virtual' || $625cf83917e112ad$export$60278871457622de(e.nativeEvent))) {
|
|
231
327
|
// Ensure the element receives focus (VoiceOver on iOS does not do this)
|
|
232
|
-
if (!isDisabled1 && !preventFocusOnPress) $
|
|
328
|
+
if (!isDisabled1 && !preventFocusOnPress) $goTMa$reactariautils.focusWithoutScrolling(e.currentTarget);
|
|
233
329
|
triggerPressStart(e, 'virtual');
|
|
234
330
|
triggerPressUp(e, 'virtual');
|
|
235
331
|
triggerPressEnd(e, 'virtual');
|
|
@@ -240,16 +336,16 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
240
336
|
}
|
|
241
337
|
};
|
|
242
338
|
let onKeyUp = (e)=>{
|
|
243
|
-
if (state.isPressed && $
|
|
244
|
-
if ($
|
|
339
|
+
if (state.isPressed && $0294ea432cd92340$var$isValidKeyboardEvent(e)) {
|
|
340
|
+
if ($0294ea432cd92340$var$shouldPreventDefaultKeyboard(e.target)) e.preventDefault();
|
|
245
341
|
e.stopPropagation();
|
|
246
342
|
state.isPressed = false;
|
|
247
343
|
let target = e.target;
|
|
248
|
-
triggerPressEnd($
|
|
344
|
+
triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), 'keyboard', state.target.contains(target));
|
|
249
345
|
removeAllGlobalListeners();
|
|
250
346
|
// If the target is a link, trigger the click method to open the URL,
|
|
251
347
|
// but defer triggering pressEnd until onClick event handler.
|
|
252
|
-
if (state.target.contains(target) && $
|
|
348
|
+
if (state.target.contains(target) && $0294ea432cd92340$var$isHTMLAnchorLink(state.target) || state.target.getAttribute('role') === 'link') state.target.click();
|
|
253
349
|
}
|
|
254
350
|
};
|
|
255
351
|
if (typeof PointerEvent !== 'undefined') {
|
|
@@ -260,13 +356,13 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
260
356
|
// Ignore and let the onClick handler take care of it instead.
|
|
261
357
|
// https://bugs.webkit.org/show_bug.cgi?id=222627
|
|
262
358
|
// https://bugs.webkit.org/show_bug.cgi?id=223202
|
|
263
|
-
if ($
|
|
359
|
+
if ($0294ea432cd92340$var$isVirtualPointerEvent(e.nativeEvent)) {
|
|
264
360
|
state.pointerType = 'virtual';
|
|
265
361
|
return;
|
|
266
362
|
}
|
|
267
363
|
// Due to browser inconsistencies, especially on mobile browsers, we prevent
|
|
268
364
|
// default on pointer down and handle focusing the pressable element ourselves.
|
|
269
|
-
if ($
|
|
365
|
+
if ($0294ea432cd92340$var$shouldPreventDefault(e.currentTarget)) e.preventDefault();
|
|
270
366
|
state.pointerType = e.pointerType;
|
|
271
367
|
e.stopPropagation();
|
|
272
368
|
if (!state.isPressed) {
|
|
@@ -274,8 +370,8 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
274
370
|
state.isOverTarget = true;
|
|
275
371
|
state.activePointerId = e.pointerId;
|
|
276
372
|
state.target = e.currentTarget;
|
|
277
|
-
if (!isDisabled1 && !preventFocusOnPress) $
|
|
278
|
-
if (!allowTextSelectionOnPress) $
|
|
373
|
+
if (!isDisabled1 && !preventFocusOnPress) $goTMa$reactariautils.focusWithoutScrolling(e.currentTarget);
|
|
374
|
+
if (!allowTextSelectionOnPress) $f7e14e656343df57$export$16a4697467175487(state.target);
|
|
279
375
|
triggerPressStart(e, state.pointerType);
|
|
280
376
|
addGlobalListener(document, 'pointermove', onPointerMove, false);
|
|
281
377
|
addGlobalListener(document, 'pointerup', onPointerUp, false);
|
|
@@ -288,7 +384,7 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
288
384
|
// Chrome and Firefox on touch Windows devices require mouse down events
|
|
289
385
|
// to be canceled in addition to pointer events, or an extra asynchronous
|
|
290
386
|
// focus event will be fired.
|
|
291
|
-
if ($
|
|
387
|
+
if ($0294ea432cd92340$var$shouldPreventDefault(e.currentTarget)) e.preventDefault();
|
|
292
388
|
e.stopPropagation();
|
|
293
389
|
}
|
|
294
390
|
};
|
|
@@ -298,34 +394,34 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
298
394
|
// Only handle left clicks
|
|
299
395
|
// Safari on iOS sometimes fires pointerup events, even
|
|
300
396
|
// when the touch isn't over the target, so double check.
|
|
301
|
-
if (e.button === 0 && $
|
|
397
|
+
if (e.button === 0 && $0294ea432cd92340$var$isOverTarget(e, e.currentTarget)) triggerPressUp(e, state.pointerType || e.pointerType);
|
|
302
398
|
};
|
|
303
399
|
// Safari on iOS < 13.2 does not implement pointerenter/pointerleave events correctly.
|
|
304
400
|
// Use pointer move events instead to implement our own hit testing.
|
|
305
401
|
// See https://bugs.webkit.org/show_bug.cgi?id=199803
|
|
306
402
|
let onPointerMove = (e)=>{
|
|
307
403
|
if (e.pointerId !== state.activePointerId) return;
|
|
308
|
-
if ($
|
|
404
|
+
if ($0294ea432cd92340$var$isOverTarget(e, state.target)) {
|
|
309
405
|
if (!state.isOverTarget) {
|
|
310
406
|
state.isOverTarget = true;
|
|
311
|
-
triggerPressStart($
|
|
407
|
+
triggerPressStart($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType);
|
|
312
408
|
}
|
|
313
409
|
} else if (state.isOverTarget) {
|
|
314
410
|
state.isOverTarget = false;
|
|
315
|
-
triggerPressEnd($
|
|
411
|
+
triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType, false);
|
|
316
412
|
if (propsRef.current.shouldCancelOnPointerExit) cancel(e);
|
|
317
413
|
}
|
|
318
414
|
};
|
|
319
415
|
let onPointerUp = (e)=>{
|
|
320
416
|
if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0) {
|
|
321
|
-
if ($
|
|
322
|
-
else if (state.isOverTarget) triggerPressEnd($
|
|
417
|
+
if ($0294ea432cd92340$var$isOverTarget(e, state.target)) triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType);
|
|
418
|
+
else if (state.isOverTarget) triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType, false);
|
|
323
419
|
state.isPressed = false;
|
|
324
420
|
state.isOverTarget = false;
|
|
325
421
|
state.activePointerId = null;
|
|
326
422
|
state.pointerType = null;
|
|
327
423
|
removeAllGlobalListeners();
|
|
328
|
-
if (!allowTextSelectionOnPress) $
|
|
424
|
+
if (!allowTextSelectionOnPress) $f7e14e656343df57$export$b0d6fa1ab32e3295(state.target);
|
|
329
425
|
}
|
|
330
426
|
};
|
|
331
427
|
let onPointerCancel = (e)=>{
|
|
@@ -342,14 +438,14 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
342
438
|
if (e.button !== 0 || !e.currentTarget.contains(e.target)) return;
|
|
343
439
|
// Due to browser inconsistencies, especially on mobile browsers, we prevent
|
|
344
440
|
// default on mouse down and handle focusing the pressable element ourselves.
|
|
345
|
-
if ($
|
|
441
|
+
if ($0294ea432cd92340$var$shouldPreventDefault(e.currentTarget)) e.preventDefault();
|
|
346
442
|
e.stopPropagation();
|
|
347
443
|
if (state.ignoreEmulatedMouseEvents) return;
|
|
348
444
|
state.isPressed = true;
|
|
349
445
|
state.isOverTarget = true;
|
|
350
446
|
state.target = e.currentTarget;
|
|
351
|
-
state.pointerType = $
|
|
352
|
-
if (!isDisabled1 && !preventFocusOnPress) $
|
|
447
|
+
state.pointerType = $625cf83917e112ad$export$60278871457622de(e.nativeEvent) ? 'virtual' : 'mouse';
|
|
448
|
+
if (!isDisabled1 && !preventFocusOnPress) $goTMa$reactariautils.focusWithoutScrolling(e.currentTarget);
|
|
353
449
|
triggerPressStart(e, state.pointerType);
|
|
354
450
|
addGlobalListener(document, 'mouseup', onMouseUp, false);
|
|
355
451
|
};
|
|
@@ -383,14 +479,14 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
383
479
|
state.ignoreEmulatedMouseEvents = false;
|
|
384
480
|
return;
|
|
385
481
|
}
|
|
386
|
-
if ($
|
|
387
|
-
else if (state.isOverTarget) triggerPressEnd($
|
|
482
|
+
if ($0294ea432cd92340$var$isOverTarget(e, state.target)) triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType);
|
|
483
|
+
else if (state.isOverTarget) triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType, false);
|
|
388
484
|
state.isOverTarget = false;
|
|
389
485
|
};
|
|
390
486
|
pressProps.onTouchStart = (e)=>{
|
|
391
487
|
if (!e.currentTarget.contains(e.target)) return;
|
|
392
488
|
e.stopPropagation();
|
|
393
|
-
let touch = $
|
|
489
|
+
let touch = $0294ea432cd92340$var$getTouchFromEvent(e.nativeEvent);
|
|
394
490
|
if (!touch) return;
|
|
395
491
|
state.activePointerId = touch.identifier;
|
|
396
492
|
state.ignoreEmulatedMouseEvents = true;
|
|
@@ -400,8 +496,8 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
400
496
|
state.pointerType = 'touch';
|
|
401
497
|
// Due to browser inconsistencies, especially on mobile browsers, we prevent default
|
|
402
498
|
// on the emulated mouse event and handle focusing the pressable element ourselves.
|
|
403
|
-
if (!isDisabled1 && !preventFocusOnPress) $
|
|
404
|
-
if (!allowTextSelectionOnPress) $
|
|
499
|
+
if (!isDisabled1 && !preventFocusOnPress) $goTMa$reactariautils.focusWithoutScrolling(e.currentTarget);
|
|
500
|
+
if (!allowTextSelectionOnPress) $f7e14e656343df57$export$16a4697467175487(state.target);
|
|
405
501
|
triggerPressStart(e, state.pointerType);
|
|
406
502
|
addGlobalListener(window, 'scroll', onScroll, true);
|
|
407
503
|
};
|
|
@@ -409,8 +505,8 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
409
505
|
if (!e.currentTarget.contains(e.target)) return;
|
|
410
506
|
e.stopPropagation();
|
|
411
507
|
if (!state.isPressed) return;
|
|
412
|
-
let touch = $
|
|
413
|
-
if (touch && $
|
|
508
|
+
let touch = $0294ea432cd92340$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
509
|
+
if (touch && $0294ea432cd92340$var$isOverTarget(touch, e.currentTarget)) {
|
|
414
510
|
if (!state.isOverTarget) {
|
|
415
511
|
state.isOverTarget = true;
|
|
416
512
|
triggerPressStart(e, state.pointerType);
|
|
@@ -425,8 +521,8 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
425
521
|
if (!e.currentTarget.contains(e.target)) return;
|
|
426
522
|
e.stopPropagation();
|
|
427
523
|
if (!state.isPressed) return;
|
|
428
|
-
let touch = $
|
|
429
|
-
if (touch && $
|
|
524
|
+
let touch = $0294ea432cd92340$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
525
|
+
if (touch && $0294ea432cd92340$var$isOverTarget(touch, e.currentTarget)) {
|
|
430
526
|
triggerPressUp(e, state.pointerType);
|
|
431
527
|
triggerPressEnd(e, state.pointerType);
|
|
432
528
|
} else if (state.isOverTarget) triggerPressEnd(e, state.pointerType, false);
|
|
@@ -434,7 +530,7 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
434
530
|
state.activePointerId = null;
|
|
435
531
|
state.isOverTarget = false;
|
|
436
532
|
state.ignoreEmulatedMouseEvents = true;
|
|
437
|
-
if (!allowTextSelectionOnPress) $
|
|
533
|
+
if (!allowTextSelectionOnPress) $f7e14e656343df57$export$b0d6fa1ab32e3295(state.target);
|
|
438
534
|
removeAllGlobalListeners();
|
|
439
535
|
};
|
|
440
536
|
pressProps.onTouchCancel = (e)=>{
|
|
@@ -466,37 +562,37 @@ function $49794190ef05a7aa$export$45712eceda6fad21(props) {
|
|
|
466
562
|
]);
|
|
467
563
|
// Remove user-select: none in case component unmounts immediately after pressStart
|
|
468
564
|
// eslint-disable-next-line arrow-body-style
|
|
469
|
-
$
|
|
565
|
+
$goTMa$react.useEffect(()=>{
|
|
470
566
|
return ()=>{
|
|
471
|
-
if (!allowTextSelectionOnPress) $
|
|
567
|
+
if (!allowTextSelectionOnPress) $f7e14e656343df57$export$b0d6fa1ab32e3295(ref.current.target);
|
|
472
568
|
};
|
|
473
569
|
}, [
|
|
474
570
|
allowTextSelectionOnPress
|
|
475
571
|
]);
|
|
476
572
|
return {
|
|
477
573
|
isPressed: isPressedProp || isPressed,
|
|
478
|
-
pressProps: $
|
|
574
|
+
pressProps: $goTMa$reactariautils.mergeProps(domProps, pressProps1)
|
|
479
575
|
};
|
|
480
576
|
}
|
|
481
|
-
function $
|
|
577
|
+
function $0294ea432cd92340$var$isHTMLAnchorLink(target) {
|
|
482
578
|
return target.tagName === 'A' && target.hasAttribute('href');
|
|
483
579
|
}
|
|
484
|
-
function $
|
|
580
|
+
function $0294ea432cd92340$var$isValidKeyboardEvent(event) {
|
|
485
581
|
const { key: key , code: code , target: target } = event;
|
|
486
582
|
const element = target;
|
|
487
583
|
const { tagName: tagName , isContentEditable: isContentEditable } = element;
|
|
488
584
|
const role = element.getAttribute('role');
|
|
489
585
|
// Accessibility for keyboards. Space and Enter only.
|
|
490
586
|
// "Spacebar" is for IE 11
|
|
491
|
-
return (key === 'Enter' || key === ' ' || key === 'Spacebar' || code === 'Space') && tagName !== 'INPUT' && tagName !== 'TEXTAREA' && isContentEditable !== true && (!$
|
|
587
|
+
return (key === 'Enter' || key === ' ' || key === 'Spacebar' || code === 'Space') && tagName !== 'INPUT' && tagName !== 'TEXTAREA' && isContentEditable !== true && (!$0294ea432cd92340$var$isHTMLAnchorLink(element) || role === 'button' && key !== 'Enter') && // An element with role='link' should only trigger with Enter key
|
|
492
588
|
!(role === 'link' && key !== 'Enter');
|
|
493
589
|
}
|
|
494
|
-
function $
|
|
590
|
+
function $0294ea432cd92340$var$getTouchFromEvent(event) {
|
|
495
591
|
const { targetTouches: targetTouches } = event;
|
|
496
592
|
if (targetTouches.length > 0) return targetTouches[0];
|
|
497
593
|
return null;
|
|
498
594
|
}
|
|
499
|
-
function $
|
|
595
|
+
function $0294ea432cd92340$var$getTouchById(event, pointerId) {
|
|
500
596
|
const changedTouches = event.changedTouches;
|
|
501
597
|
for(let i = 0; i < changedTouches.length; i++){
|
|
502
598
|
const touch = changedTouches[i];
|
|
@@ -504,7 +600,7 @@ function $49794190ef05a7aa$var$getTouchById(event, pointerId) {
|
|
|
504
600
|
}
|
|
505
601
|
return null;
|
|
506
602
|
}
|
|
507
|
-
function $
|
|
603
|
+
function $0294ea432cd92340$var$createEvent(target, e) {
|
|
508
604
|
return {
|
|
509
605
|
currentTarget: target,
|
|
510
606
|
shiftKey: e.shiftKey,
|
|
@@ -513,7 +609,7 @@ function $49794190ef05a7aa$var$createEvent(target, e) {
|
|
|
513
609
|
altKey: e.altKey
|
|
514
610
|
};
|
|
515
611
|
}
|
|
516
|
-
function $
|
|
612
|
+
function $0294ea432cd92340$var$getPointClientRect(point) {
|
|
517
613
|
let offsetX = point.width / 2 || point.radiusX || 0;
|
|
518
614
|
let offsetY = point.height / 2 || point.radiusY || 0;
|
|
519
615
|
return {
|
|
@@ -523,26 +619,26 @@ function $49794190ef05a7aa$var$getPointClientRect(point) {
|
|
|
523
619
|
left: point.clientX - offsetX
|
|
524
620
|
};
|
|
525
621
|
}
|
|
526
|
-
function $
|
|
622
|
+
function $0294ea432cd92340$var$areRectanglesOverlapping(a, b) {
|
|
527
623
|
// check if they cannot overlap on x axis
|
|
528
624
|
if (a.left > b.right || b.left > a.right) return false;
|
|
529
625
|
// check if they cannot overlap on y axis
|
|
530
626
|
if (a.top > b.bottom || b.top > a.bottom) return false;
|
|
531
627
|
return true;
|
|
532
628
|
}
|
|
533
|
-
function $
|
|
629
|
+
function $0294ea432cd92340$var$isOverTarget(point, target) {
|
|
534
630
|
let rect = target.getBoundingClientRect();
|
|
535
|
-
let pointRect = $
|
|
536
|
-
return $
|
|
631
|
+
let pointRect = $0294ea432cd92340$var$getPointClientRect(point);
|
|
632
|
+
return $0294ea432cd92340$var$areRectanglesOverlapping(rect, pointRect);
|
|
537
633
|
}
|
|
538
|
-
function $
|
|
539
|
-
// We cannot prevent default if the target is
|
|
540
|
-
return !target.
|
|
634
|
+
function $0294ea432cd92340$var$shouldPreventDefault(target) {
|
|
635
|
+
// We cannot prevent default if the target is a draggable element.
|
|
636
|
+
return !target.draggable;
|
|
541
637
|
}
|
|
542
|
-
function $
|
|
638
|
+
function $0294ea432cd92340$var$shouldPreventDefaultKeyboard(target) {
|
|
543
639
|
return !((target.tagName === 'INPUT' || target.tagName === 'BUTTON') && target.type === 'submit');
|
|
544
640
|
}
|
|
545
|
-
function $
|
|
641
|
+
function $0294ea432cd92340$var$isVirtualPointerEvent(event) {
|
|
546
642
|
// If the pointer size is zero, then we assume it's from a screen reader.
|
|
547
643
|
// Android TalkBack double tap will sometimes return a event with width and height of 1
|
|
548
644
|
// and pointerType === 'mouse' so we need to check for a specific combination of event attributes.
|
|
@@ -553,32 +649,32 @@ function $49794190ef05a7aa$var$isVirtualPointerEvent(event) {
|
|
|
553
649
|
|
|
554
650
|
|
|
555
651
|
|
|
556
|
-
const $
|
|
557
|
-
let newRef = $
|
|
652
|
+
const $e1dbec26039c051d$export$27c701ed9e449e99 = /*#__PURE__*/ ($parcel$interopDefault($goTMa$react)).forwardRef(({ children: children , ...props }, ref)=>{
|
|
653
|
+
let newRef = $goTMa$react.useRef();
|
|
558
654
|
ref = ref !== null && ref !== void 0 ? ref : newRef;
|
|
559
|
-
let { pressProps: pressProps } = $
|
|
655
|
+
let { pressProps: pressProps } = $0294ea432cd92340$export$45712eceda6fad21({
|
|
560
656
|
...props,
|
|
561
657
|
ref: ref
|
|
562
658
|
});
|
|
563
|
-
let child = ($parcel$interopDefault($
|
|
564
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($
|
|
659
|
+
let child = ($parcel$interopDefault($goTMa$react)).Children.only(children);
|
|
660
|
+
return(/*#__PURE__*/ ($parcel$interopDefault($goTMa$react)).cloneElement(child, // @ts-ignore
|
|
565
661
|
{
|
|
566
662
|
ref: ref,
|
|
567
|
-
...$
|
|
663
|
+
...$goTMa$reactariautils.mergeProps(child.props, pressProps)
|
|
568
664
|
}));
|
|
569
665
|
});
|
|
570
666
|
|
|
571
667
|
|
|
572
|
-
var $
|
|
668
|
+
var $3596bae48579386f$exports = {};
|
|
573
669
|
|
|
574
|
-
$parcel$export($
|
|
670
|
+
$parcel$export($3596bae48579386f$exports, "PressResponder", () => $3596bae48579386f$export$3351871ee4b288b8);
|
|
575
671
|
|
|
576
672
|
|
|
577
673
|
|
|
578
|
-
const $
|
|
579
|
-
let isRegistered = $
|
|
580
|
-
let prevContext = $
|
|
581
|
-
let context = $
|
|
674
|
+
const $3596bae48579386f$export$3351871ee4b288b8 = /*#__PURE__*/ ($parcel$interopDefault($goTMa$react)).forwardRef(({ children: children , ...props }, ref)=>{
|
|
675
|
+
let isRegistered = $goTMa$react.useRef(false);
|
|
676
|
+
let prevContext = $goTMa$react.useContext($01d3f539e91688c8$export$5165eccb35aaadb5);
|
|
677
|
+
let context = $goTMa$reactariautils.mergeProps(prevContext || {
|
|
582
678
|
}, {
|
|
583
679
|
...props,
|
|
584
680
|
ref: ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref),
|
|
@@ -587,35 +683,37 @@ const $94a1d642bd05f094$export$3351871ee4b288b8 = /*#__PURE__*/ ($parcel$interop
|
|
|
587
683
|
if (prevContext) prevContext.register();
|
|
588
684
|
}
|
|
589
685
|
});
|
|
590
|
-
$
|
|
591
|
-
$
|
|
686
|
+
$goTMa$reactariautils.useSyncRef(prevContext, ref);
|
|
687
|
+
$goTMa$react.useEffect(()=>{
|
|
592
688
|
if (!isRegistered.current) console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
|
593
689
|
}, []);
|
|
594
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($
|
|
690
|
+
return(/*#__PURE__*/ ($parcel$interopDefault($goTMa$react)).createElement($01d3f539e91688c8$export$5165eccb35aaadb5.Provider, {
|
|
595
691
|
value: context
|
|
596
692
|
}, children));
|
|
597
693
|
});
|
|
598
694
|
|
|
599
695
|
|
|
600
|
-
var $
|
|
696
|
+
var $5cb73d0ce355b0dc$exports = {};
|
|
601
697
|
|
|
602
|
-
$parcel$export($
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
698
|
+
$parcel$export($5cb73d0ce355b0dc$exports, "useFocus", () => $5cb73d0ce355b0dc$export$f8168d8dd8fd66e6);
|
|
699
|
+
|
|
700
|
+
function $5cb73d0ce355b0dc$export$f8168d8dd8fd66e6(props) {
|
|
701
|
+
let onBlur;
|
|
702
|
+
if (!props.isDisabled && (props.onBlur || props.onFocusChange)) onBlur = (e)=>{
|
|
703
|
+
if (e.target === e.currentTarget) {
|
|
704
|
+
if (props.onBlur) props.onBlur(e);
|
|
705
|
+
if (props.onFocusChange) props.onFocusChange(false);
|
|
706
|
+
return true;
|
|
606
707
|
}
|
|
607
708
|
};
|
|
608
|
-
|
|
609
|
-
|
|
709
|
+
else onBlur = null;
|
|
710
|
+
let onSyntheticFocus = $625cf83917e112ad$export$715c682d09d639cc(onBlur);
|
|
711
|
+
let onFocus;
|
|
712
|
+
if (!props.isDisabled && (props.onFocus || props.onFocusChange || props.onBlur)) onFocus = (e)=>{
|
|
610
713
|
if (e.target === e.currentTarget) {
|
|
611
714
|
if (props.onFocus) props.onFocus(e);
|
|
612
715
|
if (props.onFocusChange) props.onFocusChange(true);
|
|
613
|
-
|
|
614
|
-
};
|
|
615
|
-
if (props.onBlur || props.onFocusChange) onBlur = (e)=>{
|
|
616
|
-
if (e.target === e.currentTarget) {
|
|
617
|
-
if (props.onBlur) props.onBlur(e);
|
|
618
|
-
if (props.onFocusChange) props.onFocusChange(false);
|
|
716
|
+
onSyntheticFocus(e);
|
|
619
717
|
}
|
|
620
718
|
};
|
|
621
719
|
return {
|
|
@@ -627,131 +725,131 @@ function $5848daf14fd6f7cb$export$f8168d8dd8fd66e6(props) {
|
|
|
627
725
|
}
|
|
628
726
|
|
|
629
727
|
|
|
630
|
-
var $
|
|
728
|
+
var $e77252a287ef94ab$exports = {};
|
|
631
729
|
|
|
632
|
-
$parcel$export($
|
|
633
|
-
$parcel$export($
|
|
634
|
-
$parcel$export($
|
|
635
|
-
$parcel$export($
|
|
636
|
-
$parcel$export($
|
|
637
|
-
$parcel$export($
|
|
730
|
+
$parcel$export($e77252a287ef94ab$exports, "isFocusVisible", () => $e77252a287ef94ab$export$b9b3dfddab17db27);
|
|
731
|
+
$parcel$export($e77252a287ef94ab$exports, "getInteractionModality", () => $e77252a287ef94ab$export$630ff653c5ada6a9);
|
|
732
|
+
$parcel$export($e77252a287ef94ab$exports, "setInteractionModality", () => $e77252a287ef94ab$export$8397ddfc504fdb9a);
|
|
733
|
+
$parcel$export($e77252a287ef94ab$exports, "useInteractionModality", () => $e77252a287ef94ab$export$98e20ec92f614cfe);
|
|
734
|
+
$parcel$export($e77252a287ef94ab$exports, "useFocusVisible", () => $e77252a287ef94ab$export$ffd9e5021c1fb2d6);
|
|
735
|
+
$parcel$export($e77252a287ef94ab$exports, "useFocusVisibleListener", () => $e77252a287ef94ab$export$ec71b4b83ac08ec3);
|
|
638
736
|
|
|
639
737
|
|
|
640
738
|
|
|
641
|
-
let $
|
|
642
|
-
let $
|
|
643
|
-
let $
|
|
644
|
-
let $
|
|
645
|
-
let $
|
|
739
|
+
let $e77252a287ef94ab$var$currentModality = null;
|
|
740
|
+
let $e77252a287ef94ab$var$changeHandlers = new Set();
|
|
741
|
+
let $e77252a287ef94ab$var$hasSetupGlobalListeners = false;
|
|
742
|
+
let $e77252a287ef94ab$var$hasEventBeforeFocus = false;
|
|
743
|
+
let $e77252a287ef94ab$var$hasBlurredWindowRecently = false;
|
|
646
744
|
// Only Tab or Esc keys will make focus visible on text input elements
|
|
647
|
-
const $
|
|
745
|
+
const $e77252a287ef94ab$var$FOCUS_VISIBLE_INPUT_KEYS = {
|
|
648
746
|
Tab: true,
|
|
649
747
|
Escape: true
|
|
650
748
|
};
|
|
651
|
-
function $
|
|
652
|
-
for (let handler of $
|
|
749
|
+
function $e77252a287ef94ab$var$triggerChangeHandlers(modality, e) {
|
|
750
|
+
for (let handler of $e77252a287ef94ab$var$changeHandlers)handler(modality, e);
|
|
653
751
|
}
|
|
654
752
|
/**
|
|
655
753
|
* Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
|
|
656
|
-
*/ function $
|
|
754
|
+
*/ function $e77252a287ef94ab$var$isValidKey(e) {
|
|
657
755
|
// Control and Shift keys trigger when navigating back to the tab with keyboard.
|
|
658
|
-
return !(e.metaKey || !$
|
|
756
|
+
return !(e.metaKey || !$goTMa$reactariautils.isMac() && e.altKey || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');
|
|
659
757
|
}
|
|
660
|
-
function $
|
|
661
|
-
$
|
|
662
|
-
if ($
|
|
663
|
-
$
|
|
664
|
-
$
|
|
758
|
+
function $e77252a287ef94ab$var$handleKeyboardEvent(e) {
|
|
759
|
+
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
|
760
|
+
if ($e77252a287ef94ab$var$isValidKey(e)) {
|
|
761
|
+
$e77252a287ef94ab$var$currentModality = 'keyboard';
|
|
762
|
+
$e77252a287ef94ab$var$triggerChangeHandlers('keyboard', e);
|
|
665
763
|
}
|
|
666
764
|
}
|
|
667
|
-
function $
|
|
668
|
-
$
|
|
765
|
+
function $e77252a287ef94ab$var$handlePointerEvent(e) {
|
|
766
|
+
$e77252a287ef94ab$var$currentModality = 'pointer';
|
|
669
767
|
if (e.type === 'mousedown' || e.type === 'pointerdown') {
|
|
670
|
-
$
|
|
671
|
-
$
|
|
768
|
+
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
|
769
|
+
$e77252a287ef94ab$var$triggerChangeHandlers('pointer', e);
|
|
672
770
|
}
|
|
673
771
|
}
|
|
674
|
-
function $
|
|
675
|
-
if ($
|
|
676
|
-
$
|
|
677
|
-
$
|
|
772
|
+
function $e77252a287ef94ab$var$handleClickEvent(e) {
|
|
773
|
+
if ($625cf83917e112ad$export$60278871457622de(e)) {
|
|
774
|
+
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
|
775
|
+
$e77252a287ef94ab$var$currentModality = 'virtual';
|
|
678
776
|
}
|
|
679
777
|
}
|
|
680
|
-
function $
|
|
778
|
+
function $e77252a287ef94ab$var$handleFocusEvent(e) {
|
|
681
779
|
// Firefox fires two extra focus events when the user first clicks into an iframe:
|
|
682
780
|
// first on the window, then on the document. We ignore these events so they don't
|
|
683
781
|
// cause keyboard focus rings to appear.
|
|
684
782
|
if (e.target === window || e.target === document) return;
|
|
685
783
|
// If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.
|
|
686
784
|
// This occurs, for example, when navigating a form with the next/previous buttons on iOS.
|
|
687
|
-
if (!$
|
|
688
|
-
$
|
|
689
|
-
$
|
|
785
|
+
if (!$e77252a287ef94ab$var$hasEventBeforeFocus && !$e77252a287ef94ab$var$hasBlurredWindowRecently) {
|
|
786
|
+
$e77252a287ef94ab$var$currentModality = 'virtual';
|
|
787
|
+
$e77252a287ef94ab$var$triggerChangeHandlers('virtual', e);
|
|
690
788
|
}
|
|
691
|
-
$
|
|
692
|
-
$
|
|
789
|
+
$e77252a287ef94ab$var$hasEventBeforeFocus = false;
|
|
790
|
+
$e77252a287ef94ab$var$hasBlurredWindowRecently = false;
|
|
693
791
|
}
|
|
694
|
-
function $
|
|
792
|
+
function $e77252a287ef94ab$var$handleWindowBlur() {
|
|
695
793
|
// When the window is blurred, reset state. This is necessary when tabbing out of the window,
|
|
696
794
|
// for example, since a subsequent focus event won't be fired.
|
|
697
|
-
$
|
|
698
|
-
$
|
|
795
|
+
$e77252a287ef94ab$var$hasEventBeforeFocus = false;
|
|
796
|
+
$e77252a287ef94ab$var$hasBlurredWindowRecently = true;
|
|
699
797
|
}
|
|
700
798
|
/**
|
|
701
799
|
* Setup global event listeners to control when keyboard focus style should be visible.
|
|
702
|
-
*/ function $
|
|
703
|
-
if (typeof window === 'undefined' || $
|
|
800
|
+
*/ function $e77252a287ef94ab$var$setupGlobalFocusEvents() {
|
|
801
|
+
if (typeof window === 'undefined' || $e77252a287ef94ab$var$hasSetupGlobalListeners) return;
|
|
704
802
|
// Programmatic focus() calls shouldn't affect the current input modality.
|
|
705
803
|
// However, we need to detect other cases when a focus event occurs without
|
|
706
804
|
// a preceding user event (e.g. screen reader focus). Overriding the focus
|
|
707
805
|
// method on HTMLElement.prototype is a bit hacky, but works.
|
|
708
806
|
let focus = HTMLElement.prototype.focus;
|
|
709
807
|
HTMLElement.prototype.focus = function() {
|
|
710
|
-
$
|
|
808
|
+
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
|
711
809
|
focus.apply(this, arguments);
|
|
712
810
|
};
|
|
713
|
-
document.addEventListener('keydown', $
|
|
714
|
-
document.addEventListener('keyup', $
|
|
715
|
-
document.addEventListener('click', $
|
|
811
|
+
document.addEventListener('keydown', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
|
812
|
+
document.addEventListener('keyup', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
|
813
|
+
document.addEventListener('click', $e77252a287ef94ab$var$handleClickEvent, true);
|
|
716
814
|
// Register focus events on the window so they are sure to happen
|
|
717
815
|
// before React's event listeners (registered on the document).
|
|
718
|
-
window.addEventListener('focus', $
|
|
719
|
-
window.addEventListener('blur', $
|
|
816
|
+
window.addEventListener('focus', $e77252a287ef94ab$var$handleFocusEvent, true);
|
|
817
|
+
window.addEventListener('blur', $e77252a287ef94ab$var$handleWindowBlur, false);
|
|
720
818
|
if (typeof PointerEvent !== 'undefined') {
|
|
721
|
-
document.addEventListener('pointerdown', $
|
|
722
|
-
document.addEventListener('pointermove', $
|
|
723
|
-
document.addEventListener('pointerup', $
|
|
819
|
+
document.addEventListener('pointerdown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
820
|
+
document.addEventListener('pointermove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
821
|
+
document.addEventListener('pointerup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
724
822
|
} else {
|
|
725
|
-
document.addEventListener('mousedown', $
|
|
726
|
-
document.addEventListener('mousemove', $
|
|
727
|
-
document.addEventListener('mouseup', $
|
|
823
|
+
document.addEventListener('mousedown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
824
|
+
document.addEventListener('mousemove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
825
|
+
document.addEventListener('mouseup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
728
826
|
}
|
|
729
|
-
$
|
|
827
|
+
$e77252a287ef94ab$var$hasSetupGlobalListeners = true;
|
|
730
828
|
}
|
|
731
829
|
if (typeof document !== 'undefined') {
|
|
732
|
-
if (document.readyState !== 'loading') $
|
|
733
|
-
else document.addEventListener('DOMContentLoaded', $
|
|
830
|
+
if (document.readyState !== 'loading') $e77252a287ef94ab$var$setupGlobalFocusEvents();
|
|
831
|
+
else document.addEventListener('DOMContentLoaded', $e77252a287ef94ab$var$setupGlobalFocusEvents);
|
|
734
832
|
}
|
|
735
|
-
function $
|
|
736
|
-
return $
|
|
833
|
+
function $e77252a287ef94ab$export$b9b3dfddab17db27() {
|
|
834
|
+
return $e77252a287ef94ab$var$currentModality !== 'pointer';
|
|
737
835
|
}
|
|
738
|
-
function $
|
|
739
|
-
return $
|
|
836
|
+
function $e77252a287ef94ab$export$630ff653c5ada6a9() {
|
|
837
|
+
return $e77252a287ef94ab$var$currentModality;
|
|
740
838
|
}
|
|
741
|
-
function $
|
|
742
|
-
$
|
|
743
|
-
$
|
|
839
|
+
function $e77252a287ef94ab$export$8397ddfc504fdb9a(modality) {
|
|
840
|
+
$e77252a287ef94ab$var$currentModality = modality;
|
|
841
|
+
$e77252a287ef94ab$var$triggerChangeHandlers(modality, null);
|
|
744
842
|
}
|
|
745
|
-
function $
|
|
746
|
-
$
|
|
747
|
-
let [modality, setModality] = $
|
|
748
|
-
$
|
|
843
|
+
function $e77252a287ef94ab$export$98e20ec92f614cfe() {
|
|
844
|
+
$e77252a287ef94ab$var$setupGlobalFocusEvents();
|
|
845
|
+
let [modality, setModality] = $goTMa$react.useState($e77252a287ef94ab$var$currentModality);
|
|
846
|
+
$goTMa$react.useEffect(()=>{
|
|
749
847
|
let handler = ()=>{
|
|
750
|
-
setModality($
|
|
848
|
+
setModality($e77252a287ef94ab$var$currentModality);
|
|
751
849
|
};
|
|
752
|
-
$
|
|
850
|
+
$e77252a287ef94ab$var$changeHandlers.add(handler);
|
|
753
851
|
return ()=>{
|
|
754
|
-
$
|
|
852
|
+
$e77252a287ef94ab$var$changeHandlers.delete(handler);
|
|
755
853
|
};
|
|
756
854
|
}, []);
|
|
757
855
|
return modality;
|
|
@@ -759,15 +857,15 @@ function $418794b2e2f608b3$export$98e20ec92f614cfe() {
|
|
|
759
857
|
/**
|
|
760
858
|
* If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
|
|
761
859
|
* focus visible style can be properly set.
|
|
762
|
-
*/ function $
|
|
763
|
-
return !(isTextInput && modality === 'keyboard' && e instanceof KeyboardEvent && !$
|
|
860
|
+
*/ function $e77252a287ef94ab$var$isKeyboardFocusEvent(isTextInput, modality, e) {
|
|
861
|
+
return !(isTextInput && modality === 'keyboard' && e instanceof KeyboardEvent && !$e77252a287ef94ab$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
|
|
764
862
|
}
|
|
765
|
-
function $
|
|
863
|
+
function $e77252a287ef94ab$export$ffd9e5021c1fb2d6(props = {
|
|
766
864
|
}) {
|
|
767
865
|
let { isTextInput: isTextInput , autoFocus: autoFocus } = props;
|
|
768
|
-
let [isFocusVisibleState, setFocusVisible] = $
|
|
769
|
-
$
|
|
770
|
-
setFocusVisible($
|
|
866
|
+
let [isFocusVisibleState, setFocusVisible] = $goTMa$react.useState(autoFocus || $e77252a287ef94ab$export$b9b3dfddab17db27());
|
|
867
|
+
$e77252a287ef94ab$export$ec71b4b83ac08ec3(($e77252a287ef94ab$export$b9b3dfddab17db27)=>{
|
|
868
|
+
setFocusVisible($e77252a287ef94ab$export$b9b3dfddab17db27);
|
|
771
869
|
}, [
|
|
772
870
|
isTextInput
|
|
773
871
|
], {
|
|
@@ -777,48 +875,47 @@ function $418794b2e2f608b3$export$ffd9e5021c1fb2d6(props = {
|
|
|
777
875
|
isFocusVisible: isFocusVisibleState
|
|
778
876
|
};
|
|
779
877
|
}
|
|
780
|
-
function $
|
|
781
|
-
$
|
|
782
|
-
$
|
|
878
|
+
function $e77252a287ef94ab$export$ec71b4b83ac08ec3(fn, deps, opts) {
|
|
879
|
+
$e77252a287ef94ab$var$setupGlobalFocusEvents();
|
|
880
|
+
$goTMa$react.useEffect(()=>{
|
|
783
881
|
let handler = (modality, e)=>{
|
|
784
|
-
if (!$
|
|
785
|
-
fn($
|
|
882
|
+
if (!$e77252a287ef94ab$var$isKeyboardFocusEvent(opts === null || opts === void 0 ? void 0 : opts.isTextInput, modality, e)) return;
|
|
883
|
+
fn($e77252a287ef94ab$export$b9b3dfddab17db27());
|
|
786
884
|
};
|
|
787
|
-
$
|
|
885
|
+
$e77252a287ef94ab$var$changeHandlers.add(handler);
|
|
788
886
|
return ()=>{
|
|
789
|
-
$
|
|
887
|
+
$e77252a287ef94ab$var$changeHandlers.delete(handler);
|
|
790
888
|
};
|
|
791
889
|
}, deps);
|
|
792
890
|
}
|
|
793
891
|
|
|
794
892
|
|
|
795
|
-
var $
|
|
893
|
+
var $d16842bbd0359d1b$exports = {};
|
|
796
894
|
|
|
797
|
-
$parcel$export($
|
|
895
|
+
$parcel$export($d16842bbd0359d1b$exports, "useFocusWithin", () => $d16842bbd0359d1b$export$420e68273165f4ec);
|
|
798
896
|
|
|
799
|
-
|
|
800
|
-
|
|
897
|
+
|
|
898
|
+
function $d16842bbd0359d1b$export$420e68273165f4ec(props) {
|
|
899
|
+
let state = $goTMa$react.useRef({
|
|
801
900
|
isFocusWithin: false
|
|
802
901
|
}).current;
|
|
803
|
-
|
|
804
|
-
focusWithinProps: {
|
|
805
|
-
}
|
|
806
|
-
};
|
|
807
|
-
let onFocus = (e)=>{
|
|
808
|
-
if (!state.isFocusWithin) {
|
|
809
|
-
if (props.onFocusWithin) props.onFocusWithin(e);
|
|
810
|
-
if (props.onFocusWithinChange) props.onFocusWithinChange(true);
|
|
811
|
-
state.isFocusWithin = true;
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
let onBlur = (e)=>{
|
|
902
|
+
let onBlur = props.isDisabled ? null : (e)=>{
|
|
815
903
|
// We don't want to trigger onBlurWithin and then immediately onFocusWithin again
|
|
816
904
|
// when moving focus inside the element. Only trigger if the currentTarget doesn't
|
|
817
905
|
// include the relatedTarget (where focus is moving).
|
|
818
906
|
if (state.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
|
|
907
|
+
state.isFocusWithin = false;
|
|
819
908
|
if (props.onBlurWithin) props.onBlurWithin(e);
|
|
820
909
|
if (props.onFocusWithinChange) props.onFocusWithinChange(false);
|
|
821
|
-
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
let onSyntheticFocus = $625cf83917e112ad$export$715c682d09d639cc(onBlur);
|
|
913
|
+
let onFocus = props.isDisabled ? null : (e)=>{
|
|
914
|
+
if (!state.isFocusWithin) {
|
|
915
|
+
if (props.onFocusWithin) props.onFocusWithin(e);
|
|
916
|
+
if (props.onFocusWithinChange) props.onFocusWithinChange(true);
|
|
917
|
+
state.isFocusWithin = true;
|
|
918
|
+
onSyntheticFocus(e);
|
|
822
919
|
}
|
|
823
920
|
};
|
|
824
921
|
return {
|
|
@@ -830,51 +927,51 @@ function $62b9c773b0fd3946$export$420e68273165f4ec(props) {
|
|
|
830
927
|
}
|
|
831
928
|
|
|
832
929
|
|
|
833
|
-
var $
|
|
930
|
+
var $ffbc150311c75f01$exports = {};
|
|
834
931
|
|
|
835
|
-
$parcel$export($
|
|
932
|
+
$parcel$export($ffbc150311c75f01$exports, "useHover", () => $ffbc150311c75f01$export$ae780daf29e6d456);
|
|
836
933
|
|
|
837
934
|
// iOS fires onPointerEnter twice: once with pointerType="touch" and again with pointerType="mouse".
|
|
838
935
|
// We want to ignore these emulated events so they do not trigger hover behavior.
|
|
839
936
|
// See https://bugs.webkit.org/show_bug.cgi?id=214609.
|
|
840
|
-
let $
|
|
841
|
-
let $
|
|
842
|
-
function $
|
|
843
|
-
$
|
|
937
|
+
let $ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents = false;
|
|
938
|
+
let $ffbc150311c75f01$var$hoverCount = 0;
|
|
939
|
+
function $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents() {
|
|
940
|
+
$ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents = true;
|
|
844
941
|
// Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter
|
|
845
942
|
// with pointerType="mouse" immediately after onPointerUp and before onFocus. On other
|
|
846
943
|
// devices that don't have this quirk, we don't want to ignore a mouse hover sometime in
|
|
847
944
|
// the distant future because a user previously touched the element.
|
|
848
945
|
setTimeout(()=>{
|
|
849
|
-
$
|
|
946
|
+
$ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents = false;
|
|
850
947
|
}, 50);
|
|
851
948
|
}
|
|
852
|
-
function $
|
|
853
|
-
if (e.pointerType === 'touch') $
|
|
949
|
+
function $ffbc150311c75f01$var$handleGlobalPointerEvent(e) {
|
|
950
|
+
if (e.pointerType === 'touch') $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents();
|
|
854
951
|
}
|
|
855
|
-
function $
|
|
952
|
+
function $ffbc150311c75f01$var$setupGlobalTouchEvents() {
|
|
856
953
|
if (typeof document === 'undefined') return;
|
|
857
|
-
if (typeof PointerEvent !== 'undefined') document.addEventListener('pointerup', $
|
|
858
|
-
else document.addEventListener('touchend', $
|
|
859
|
-
$
|
|
954
|
+
if (typeof PointerEvent !== 'undefined') document.addEventListener('pointerup', $ffbc150311c75f01$var$handleGlobalPointerEvent);
|
|
955
|
+
else document.addEventListener('touchend', $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents);
|
|
956
|
+
$ffbc150311c75f01$var$hoverCount++;
|
|
860
957
|
return ()=>{
|
|
861
|
-
$
|
|
862
|
-
if ($
|
|
863
|
-
if (typeof PointerEvent !== 'undefined') document.removeEventListener('pointerup', $
|
|
864
|
-
else document.removeEventListener('touchend', $
|
|
958
|
+
$ffbc150311c75f01$var$hoverCount--;
|
|
959
|
+
if ($ffbc150311c75f01$var$hoverCount > 0) return;
|
|
960
|
+
if (typeof PointerEvent !== 'undefined') document.removeEventListener('pointerup', $ffbc150311c75f01$var$handleGlobalPointerEvent);
|
|
961
|
+
else document.removeEventListener('touchend', $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents);
|
|
865
962
|
};
|
|
866
963
|
}
|
|
867
|
-
function $
|
|
964
|
+
function $ffbc150311c75f01$export$ae780daf29e6d456(props) {
|
|
868
965
|
let { onHoverStart: onHoverStart , onHoverChange: onHoverChange , onHoverEnd: onHoverEnd , isDisabled: isDisabled } = props;
|
|
869
|
-
let [isHovered, setHovered] = $
|
|
870
|
-
let state = $
|
|
966
|
+
let [isHovered, setHovered] = $goTMa$react.useState(false);
|
|
967
|
+
let state = $goTMa$react.useRef({
|
|
871
968
|
isHovered: false,
|
|
872
969
|
ignoreEmulatedMouseEvents: false,
|
|
873
970
|
pointerType: '',
|
|
874
971
|
target: null
|
|
875
972
|
}).current;
|
|
876
|
-
$
|
|
877
|
-
let { hoverProps: hoverProps1 , triggerHoverEnd: triggerHoverEnd1 } = $
|
|
973
|
+
$goTMa$react.useEffect($ffbc150311c75f01$var$setupGlobalTouchEvents, []);
|
|
974
|
+
let { hoverProps: hoverProps1 , triggerHoverEnd: triggerHoverEnd1 } = $goTMa$react.useMemo(()=>{
|
|
878
975
|
let triggerHoverStart = (event, pointerType)=>{
|
|
879
976
|
state.pointerType = pointerType;
|
|
880
977
|
if (isDisabled || pointerType === 'touch' || state.isHovered || !event.currentTarget.contains(event.target)) return;
|
|
@@ -907,7 +1004,7 @@ function $deea67f305dbdcff$export$ae780daf29e6d456(props) {
|
|
|
907
1004
|
};
|
|
908
1005
|
if (typeof PointerEvent !== 'undefined') {
|
|
909
1006
|
hoverProps.onPointerEnter = (e)=>{
|
|
910
|
-
if ($
|
|
1007
|
+
if ($ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents && e.pointerType === 'mouse') return;
|
|
911
1008
|
triggerHoverStart(e, e.pointerType);
|
|
912
1009
|
};
|
|
913
1010
|
hoverProps.onPointerLeave = (e)=>{
|
|
@@ -918,7 +1015,7 @@ function $deea67f305dbdcff$export$ae780daf29e6d456(props) {
|
|
|
918
1015
|
state.ignoreEmulatedMouseEvents = true;
|
|
919
1016
|
};
|
|
920
1017
|
hoverProps.onMouseEnter = (e)=>{
|
|
921
|
-
if (!state.ignoreEmulatedMouseEvents && !$
|
|
1018
|
+
if (!state.ignoreEmulatedMouseEvents && !$ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents) triggerHoverStart(e, 'mouse');
|
|
922
1019
|
state.ignoreEmulatedMouseEvents = false;
|
|
923
1020
|
};
|
|
924
1021
|
hoverProps.onMouseLeave = (e)=>{
|
|
@@ -936,7 +1033,7 @@ function $deea67f305dbdcff$export$ae780daf29e6d456(props) {
|
|
|
936
1033
|
isDisabled,
|
|
937
1034
|
state
|
|
938
1035
|
]);
|
|
939
|
-
$
|
|
1036
|
+
$goTMa$react.useEffect(()=>{
|
|
940
1037
|
// Call the triggerHoverEnd as soon as isDisabled changes to true
|
|
941
1038
|
// Safe to call triggerHoverEnd, it will early return if we aren't currently hovering
|
|
942
1039
|
if (isDisabled) triggerHoverEnd1({
|
|
@@ -952,13 +1049,13 @@ function $deea67f305dbdcff$export$ae780daf29e6d456(props) {
|
|
|
952
1049
|
}
|
|
953
1050
|
|
|
954
1051
|
|
|
955
|
-
var $
|
|
1052
|
+
var $edcfa848c42f94f4$exports = {};
|
|
956
1053
|
|
|
957
|
-
$parcel$export($
|
|
1054
|
+
$parcel$export($edcfa848c42f94f4$exports, "useInteractOutside", () => $edcfa848c42f94f4$export$872b660ac5a1ff98);
|
|
958
1055
|
|
|
959
|
-
function $
|
|
1056
|
+
function $edcfa848c42f94f4$export$872b660ac5a1ff98(props) {
|
|
960
1057
|
let { ref: ref , onInteractOutside: onInteractOutside , isDisabled: isDisabled , onInteractOutsideStart: onInteractOutsideStart } = props;
|
|
961
|
-
let stateRef = $
|
|
1058
|
+
let stateRef = $goTMa$react.useRef({
|
|
962
1059
|
isPointerDown: false,
|
|
963
1060
|
ignoreEmulatedMouseEvents: false,
|
|
964
1061
|
onInteractOutside: onInteractOutside,
|
|
@@ -967,10 +1064,10 @@ function $0c6336b20c83c923$export$872b660ac5a1ff98(props) {
|
|
|
967
1064
|
let state = stateRef.current;
|
|
968
1065
|
state.onInteractOutside = onInteractOutside;
|
|
969
1066
|
state.onInteractOutsideStart = onInteractOutsideStart;
|
|
970
|
-
$
|
|
1067
|
+
$goTMa$react.useEffect(()=>{
|
|
971
1068
|
if (isDisabled) return;
|
|
972
1069
|
let onPointerDown = (e)=>{
|
|
973
|
-
if ($
|
|
1070
|
+
if ($edcfa848c42f94f4$var$isValidEvent(e, ref) && state.onInteractOutside) {
|
|
974
1071
|
if (state.onInteractOutsideStart) state.onInteractOutsideStart(e);
|
|
975
1072
|
state.isPointerDown = true;
|
|
976
1073
|
}
|
|
@@ -978,7 +1075,7 @@ function $0c6336b20c83c923$export$872b660ac5a1ff98(props) {
|
|
|
978
1075
|
// Use pointer events if available. Otherwise, fall back to mouse and touch events.
|
|
979
1076
|
if (typeof PointerEvent !== 'undefined') {
|
|
980
1077
|
let onPointerUp = (e)=>{
|
|
981
|
-
if (state.isPointerDown && state.onInteractOutside && $
|
|
1078
|
+
if (state.isPointerDown && state.onInteractOutside && $edcfa848c42f94f4$var$isValidEvent(e, ref)) {
|
|
982
1079
|
state.isPointerDown = false;
|
|
983
1080
|
state.onInteractOutside(e);
|
|
984
1081
|
}
|
|
@@ -993,14 +1090,14 @@ function $0c6336b20c83c923$export$872b660ac5a1ff98(props) {
|
|
|
993
1090
|
} else {
|
|
994
1091
|
let onMouseUp = (e)=>{
|
|
995
1092
|
if (state.ignoreEmulatedMouseEvents) state.ignoreEmulatedMouseEvents = false;
|
|
996
|
-
else if (state.isPointerDown && state.onInteractOutside && $
|
|
1093
|
+
else if (state.isPointerDown && state.onInteractOutside && $edcfa848c42f94f4$var$isValidEvent(e, ref)) {
|
|
997
1094
|
state.isPointerDown = false;
|
|
998
1095
|
state.onInteractOutside(e);
|
|
999
1096
|
}
|
|
1000
1097
|
};
|
|
1001
1098
|
let onTouchEnd = (e)=>{
|
|
1002
1099
|
state.ignoreEmulatedMouseEvents = true;
|
|
1003
|
-
if (state.onInteractOutside && state.isPointerDown && $
|
|
1100
|
+
if (state.onInteractOutside && state.isPointerDown && $edcfa848c42f94f4$var$isValidEvent(e, ref)) {
|
|
1004
1101
|
state.isPointerDown = false;
|
|
1005
1102
|
state.onInteractOutside(e);
|
|
1006
1103
|
}
|
|
@@ -1022,7 +1119,7 @@ function $0c6336b20c83c923$export$872b660ac5a1ff98(props) {
|
|
|
1022
1119
|
isDisabled
|
|
1023
1120
|
]);
|
|
1024
1121
|
}
|
|
1025
|
-
function $
|
|
1122
|
+
function $edcfa848c42f94f4$var$isValidEvent(event, ref) {
|
|
1026
1123
|
if (event.button > 0) return false;
|
|
1027
1124
|
// if the event target is no longer in the document
|
|
1028
1125
|
if (event.target) {
|
|
@@ -1033,10 +1130,10 @@ function $0c6336b20c83c923$var$isValidEvent(event, ref) {
|
|
|
1033
1130
|
}
|
|
1034
1131
|
|
|
1035
1132
|
|
|
1036
|
-
var $
|
|
1133
|
+
var $892d64db2a3c53b0$exports = {};
|
|
1037
1134
|
|
|
1038
|
-
$parcel$export($
|
|
1039
|
-
function $
|
|
1135
|
+
$parcel$export($892d64db2a3c53b0$exports, "useKeyboard", () => $892d64db2a3c53b0$export$8f71654801c2f7cd);
|
|
1136
|
+
function $951fbcbbca8db6ce$export$48d1ea6320830260(handler) {
|
|
1040
1137
|
if (!handler) return;
|
|
1041
1138
|
let shouldStopPropagation = true;
|
|
1042
1139
|
return (e)=>{
|
|
@@ -1061,36 +1158,36 @@ function $e17e88c0ac871d70$export$48d1ea6320830260(handler) {
|
|
|
1061
1158
|
}
|
|
1062
1159
|
|
|
1063
1160
|
|
|
1064
|
-
function $
|
|
1161
|
+
function $892d64db2a3c53b0$export$8f71654801c2f7cd(props) {
|
|
1065
1162
|
return {
|
|
1066
1163
|
keyboardProps: props.isDisabled ? {
|
|
1067
1164
|
} : {
|
|
1068
|
-
onKeyDown: $
|
|
1069
|
-
onKeyUp: $
|
|
1165
|
+
onKeyDown: $951fbcbbca8db6ce$export$48d1ea6320830260(props.onKeyDown),
|
|
1166
|
+
onKeyUp: $951fbcbbca8db6ce$export$48d1ea6320830260(props.onKeyUp)
|
|
1070
1167
|
}
|
|
1071
1168
|
};
|
|
1072
1169
|
}
|
|
1073
1170
|
|
|
1074
1171
|
|
|
1075
|
-
var $
|
|
1172
|
+
var $c09386fc48fa427d$exports = {};
|
|
1076
1173
|
|
|
1077
|
-
$parcel$export($
|
|
1174
|
+
$parcel$export($c09386fc48fa427d$exports, "useMove", () => $c09386fc48fa427d$export$36da96379f79f245);
|
|
1078
1175
|
|
|
1079
1176
|
|
|
1080
1177
|
|
|
1081
|
-
function $
|
|
1178
|
+
function $c09386fc48fa427d$export$36da96379f79f245(props) {
|
|
1082
1179
|
let { onMoveStart: onMoveStart , onMove: onMove , onMoveEnd: onMoveEnd } = props;
|
|
1083
|
-
let state = $
|
|
1180
|
+
let state = $goTMa$react.useRef({
|
|
1084
1181
|
didMove: false,
|
|
1085
1182
|
lastPosition: null,
|
|
1086
1183
|
id: null
|
|
1087
1184
|
});
|
|
1088
|
-
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $
|
|
1089
|
-
let moveProps1 = $
|
|
1185
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $goTMa$reactariautils.useGlobalListeners();
|
|
1186
|
+
let moveProps1 = $goTMa$react.useMemo(()=>{
|
|
1090
1187
|
let moveProps = {
|
|
1091
1188
|
};
|
|
1092
1189
|
let start = ()=>{
|
|
1093
|
-
$
|
|
1190
|
+
$f7e14e656343df57$export$16a4697467175487();
|
|
1094
1191
|
state.current.didMove = false;
|
|
1095
1192
|
};
|
|
1096
1193
|
let move = (originalEvent, pointerType, deltaX, deltaY)=>{
|
|
@@ -1118,7 +1215,7 @@ function $4a391f140757b0c6$export$36da96379f79f245(props) {
|
|
|
1118
1215
|
});
|
|
1119
1216
|
};
|
|
1120
1217
|
let end = (originalEvent, pointerType)=>{
|
|
1121
|
-
$
|
|
1218
|
+
$f7e14e656343df57$export$b0d6fa1ab32e3295();
|
|
1122
1219
|
if (state.current.didMove) onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
|
|
1123
1220
|
type: 'moveend',
|
|
1124
1221
|
pointerType: pointerType,
|
|
@@ -1289,14 +1386,14 @@ function $4a391f140757b0c6$export$36da96379f79f245(props) {
|
|
|
1289
1386
|
|
|
1290
1387
|
|
|
1291
1388
|
|
|
1292
|
-
var $
|
|
1389
|
+
var $a3dbce0aed7087e2$exports = {};
|
|
1293
1390
|
|
|
1294
|
-
$parcel$export($
|
|
1391
|
+
$parcel$export($a3dbce0aed7087e2$exports, "useScrollWheel", () => $a3dbce0aed7087e2$export$2123ff2b87c81ca);
|
|
1295
1392
|
|
|
1296
1393
|
|
|
1297
|
-
function $
|
|
1394
|
+
function $a3dbce0aed7087e2$export$2123ff2b87c81ca(props, ref) {
|
|
1298
1395
|
let { onScroll: onScroll , isDisabled: isDisabled } = props;
|
|
1299
|
-
let onScrollHandler = $
|
|
1396
|
+
let onScrollHandler = $goTMa$react.useCallback((e)=>{
|
|
1300
1397
|
// If the ctrlKey is pressed, this is a zoom event, do nothing.
|
|
1301
1398
|
if (e.ctrlKey) return;
|
|
1302
1399
|
// stop scrolling the page
|
|
@@ -1309,22 +1406,22 @@ function $47bb792292b48f4a$export$2123ff2b87c81ca(props, ref) {
|
|
|
1309
1406
|
}, [
|
|
1310
1407
|
onScroll
|
|
1311
1408
|
]);
|
|
1312
|
-
$
|
|
1409
|
+
$goTMa$reactariautils.useEvent(ref, 'wheel', isDisabled ? null : onScrollHandler);
|
|
1313
1410
|
}
|
|
1314
1411
|
|
|
1315
1412
|
|
|
1316
|
-
var $
|
|
1413
|
+
var $3cd7b5d0eebf0ca9$exports = {};
|
|
1317
1414
|
|
|
1318
|
-
$parcel$export($
|
|
1415
|
+
$parcel$export($3cd7b5d0eebf0ca9$exports, "useLongPress", () => $3cd7b5d0eebf0ca9$export$c24ed0104d07eab9);
|
|
1319
1416
|
|
|
1320
1417
|
|
|
1321
1418
|
|
|
1322
|
-
const $
|
|
1323
|
-
function $
|
|
1324
|
-
let { isDisabled: isDisabled , onLongPressStart: onLongPressStart , onLongPressEnd: onLongPressEnd , onLongPress: onLongPress , threshold: threshold = $
|
|
1325
|
-
const timeRef = $
|
|
1326
|
-
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $
|
|
1327
|
-
let { pressProps: pressProps } = $
|
|
1419
|
+
const $3cd7b5d0eebf0ca9$var$DEFAULT_THRESHOLD = 500;
|
|
1420
|
+
function $3cd7b5d0eebf0ca9$export$c24ed0104d07eab9(props) {
|
|
1421
|
+
let { isDisabled: isDisabled , onLongPressStart: onLongPressStart , onLongPressEnd: onLongPressEnd , onLongPress: onLongPress , threshold: threshold = $3cd7b5d0eebf0ca9$var$DEFAULT_THRESHOLD , accessibilityDescription: accessibilityDescription } = props;
|
|
1422
|
+
const timeRef = $goTMa$react.useRef(null);
|
|
1423
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $goTMa$reactariautils.useGlobalListeners();
|
|
1424
|
+
let { pressProps: pressProps } = $0294ea432cd92340$export$45712eceda6fad21({
|
|
1328
1425
|
isDisabled: isDisabled,
|
|
1329
1426
|
onPressStart (e1) {
|
|
1330
1427
|
if (e1.pointerType === 'mouse' || e1.pointerType === 'touch') {
|
|
@@ -1371,25 +1468,25 @@ function $b777e6fb4c63da4c$export$c24ed0104d07eab9(props) {
|
|
|
1371
1468
|
});
|
|
1372
1469
|
}
|
|
1373
1470
|
});
|
|
1374
|
-
let descriptionProps = $
|
|
1471
|
+
let descriptionProps = $goTMa$reactariautils.useDescription(onLongPress && !isDisabled ? accessibilityDescription : null);
|
|
1375
1472
|
return {
|
|
1376
|
-
longPressProps: $
|
|
1473
|
+
longPressProps: $goTMa$reactariautils.mergeProps(pressProps, descriptionProps)
|
|
1377
1474
|
};
|
|
1378
1475
|
}
|
|
1379
1476
|
|
|
1380
1477
|
|
|
1381
|
-
$parcel$exportWildcard(module.exports, $
|
|
1382
|
-
$parcel$exportWildcard(module.exports, $
|
|
1383
|
-
$parcel$exportWildcard(module.exports, $
|
|
1384
|
-
$parcel$exportWildcard(module.exports, $
|
|
1385
|
-
$parcel$exportWildcard(module.exports, $
|
|
1386
|
-
$parcel$exportWildcard(module.exports, $
|
|
1387
|
-
$parcel$exportWildcard(module.exports, $
|
|
1388
|
-
$parcel$exportWildcard(module.exports, $
|
|
1389
|
-
$parcel$exportWildcard(module.exports, $
|
|
1390
|
-
$parcel$exportWildcard(module.exports, $
|
|
1391
|
-
$parcel$exportWildcard(module.exports, $
|
|
1392
|
-
$parcel$exportWildcard(module.exports, $
|
|
1478
|
+
$parcel$exportWildcard(module.exports, $e1dbec26039c051d$exports);
|
|
1479
|
+
$parcel$exportWildcard(module.exports, $3596bae48579386f$exports);
|
|
1480
|
+
$parcel$exportWildcard(module.exports, $5cb73d0ce355b0dc$exports);
|
|
1481
|
+
$parcel$exportWildcard(module.exports, $e77252a287ef94ab$exports);
|
|
1482
|
+
$parcel$exportWildcard(module.exports, $d16842bbd0359d1b$exports);
|
|
1483
|
+
$parcel$exportWildcard(module.exports, $ffbc150311c75f01$exports);
|
|
1484
|
+
$parcel$exportWildcard(module.exports, $edcfa848c42f94f4$exports);
|
|
1485
|
+
$parcel$exportWildcard(module.exports, $892d64db2a3c53b0$exports);
|
|
1486
|
+
$parcel$exportWildcard(module.exports, $c09386fc48fa427d$exports);
|
|
1487
|
+
$parcel$exportWildcard(module.exports, $0294ea432cd92340$exports);
|
|
1488
|
+
$parcel$exportWildcard(module.exports, $a3dbce0aed7087e2$exports);
|
|
1489
|
+
$parcel$exportWildcard(module.exports, $3cd7b5d0eebf0ca9$exports);
|
|
1393
1490
|
|
|
1394
1491
|
|
|
1395
1492
|
//# sourceMappingURL=main.js.map
|