@react-aria/interactions 3.21.2 → 3.21.3
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/PressResponder.mjs +1 -1
- package/dist/Pressable.mjs +1 -1
- package/dist/context.main.js +1 -1
- package/dist/context.mjs +2 -2
- package/dist/context.module.js +1 -1
- package/dist/createEventHandler.main.js +1 -1
- package/dist/createEventHandler.mjs +2 -2
- package/dist/createEventHandler.module.js +1 -1
- package/dist/textSelection.main.js +14 -14
- package/dist/textSelection.mjs +15 -15
- package/dist/textSelection.module.js +14 -14
- package/dist/useFocus.mjs +1 -1
- package/dist/useFocusVisible.main.js +54 -54
- package/dist/useFocusVisible.mjs +55 -55
- package/dist/useFocusVisible.module.js +54 -54
- package/dist/useFocusWithin.mjs +1 -1
- package/dist/useHover.main.js +16 -16
- package/dist/useHover.mjs +17 -17
- package/dist/useHover.module.js +16 -16
- package/dist/useInteractOutside.main.js +14 -14
- package/dist/useInteractOutside.mjs +15 -15
- package/dist/useInteractOutside.module.js +14 -14
- package/dist/useKeyboard.mjs +1 -1
- package/dist/useLongPress.main.js +10 -10
- package/dist/useLongPress.mjs +11 -11
- package/dist/useLongPress.module.js +10 -10
- package/dist/useMove.main.js +36 -36
- package/dist/useMove.mjs +37 -37
- package/dist/useMove.module.js +36 -36
- package/dist/usePress.main.js +44 -44
- package/dist/usePress.mjs +45 -45
- package/dist/usePress.module.js +44 -44
- package/dist/useScrollWheel.main.js +1 -1
- package/dist/useScrollWheel.mjs +2 -2
- package/dist/useScrollWheel.module.js +1 -1
- package/dist/utils.main.js +5 -5
- package/dist/utils.mjs +6 -6
- package/dist/utils.module.js +5 -5
- package/package.json +5 -5
package/dist/usePress.mjs
CHANGED
|
@@ -61,7 +61,7 @@ class $f6c31cce2adf654f$var$PressEvent {
|
|
|
61
61
|
this.altKey = originalEvent.altKey;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol(
|
|
64
|
+
const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol('linkClicked');
|
|
65
65
|
function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
66
66
|
let { onPress: onPress, onPressChange: onPressChange, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, isDisabled: isDisabled, isPressed: isPressedProp, preventFocusOnPress: preventFocusOnPress, shouldCancelOnPointerExit: shouldCancelOnPointerExit, allowTextSelectionOnPress: allowTextSelectionOnPress, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
67
67
|
ref: _, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext(props);
|
|
@@ -84,7 +84,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
84
84
|
let shouldStopPropagation = true;
|
|
85
85
|
state.isTriggeringEvent = true;
|
|
86
86
|
if (onPressStart) {
|
|
87
|
-
let event = new $f6c31cce2adf654f$var$PressEvent(
|
|
87
|
+
let event = new $f6c31cce2adf654f$var$PressEvent('pressstart', pointerType, originalEvent);
|
|
88
88
|
onPressStart(event);
|
|
89
89
|
shouldStopPropagation = event.shouldStopPropagation;
|
|
90
90
|
}
|
|
@@ -102,14 +102,14 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
102
102
|
state.isTriggeringEvent = true;
|
|
103
103
|
let shouldStopPropagation = true;
|
|
104
104
|
if (onPressEnd) {
|
|
105
|
-
let event = new $f6c31cce2adf654f$var$PressEvent(
|
|
105
|
+
let event = new $f6c31cce2adf654f$var$PressEvent('pressend', pointerType, originalEvent);
|
|
106
106
|
onPressEnd(event);
|
|
107
107
|
shouldStopPropagation = event.shouldStopPropagation;
|
|
108
108
|
}
|
|
109
109
|
if (onPressChange) onPressChange(false);
|
|
110
110
|
setPressed(false);
|
|
111
111
|
if (onPress && wasPressed && !isDisabled) {
|
|
112
|
-
let event = new $f6c31cce2adf654f$var$PressEvent(
|
|
112
|
+
let event = new $f6c31cce2adf654f$var$PressEvent('press', pointerType, originalEvent);
|
|
113
113
|
onPress(event);
|
|
114
114
|
shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
|
|
115
115
|
}
|
|
@@ -121,7 +121,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
121
121
|
if (isDisabled) return false;
|
|
122
122
|
if (onPressUp) {
|
|
123
123
|
state.isTriggeringEvent = true;
|
|
124
|
-
let event = new $f6c31cce2adf654f$var$PressEvent(
|
|
124
|
+
let event = new $f6c31cce2adf654f$var$PressEvent('pressup', pointerType, originalEvent);
|
|
125
125
|
onPressUp(event);
|
|
126
126
|
state.isTriggeringEvent = false;
|
|
127
127
|
return event.shouldStopPropagation;
|
|
@@ -157,15 +157,15 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
157
157
|
if (!state.isPressed && !e.repeat) {
|
|
158
158
|
state.target = e.currentTarget;
|
|
159
159
|
state.isPressed = true;
|
|
160
|
-
shouldStopPropagation = triggerPressStart(e,
|
|
160
|
+
shouldStopPropagation = triggerPressStart(e, 'keyboard');
|
|
161
161
|
// Focus may move before the key up event, so register the event on the document
|
|
162
162
|
// instead of the same element where the key down event occurred. Make it capturing so that it will trigger
|
|
163
163
|
// before stopPropagation from useKeyboard on a child element may happen and thus we can still call triggerPress for the parent element.
|
|
164
164
|
let originalTarget = e.currentTarget;
|
|
165
165
|
let pressUp = (e)=>{
|
|
166
|
-
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e, originalTarget) && !e.repeat && originalTarget.contains(e.target) && state.target) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e),
|
|
166
|
+
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e, originalTarget) && !e.repeat && originalTarget.contains(e.target) && state.target) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard');
|
|
167
167
|
};
|
|
168
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
168
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'keyup', (0, $7mdmh$chain)(pressUp, onKeyUp), true);
|
|
169
169
|
}
|
|
170
170
|
if (shouldStopPropagation) e.stopPropagation();
|
|
171
171
|
// Keep track of the keydown events that occur while the Meta (e.g. Command) key is held.
|
|
@@ -176,7 +176,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
176
176
|
// https://bugs.webkit.org/show_bug.cgi?id=55291
|
|
177
177
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1299553
|
|
178
178
|
if (e.metaKey && (0, $7mdmh$isMac)()) (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e.key, e.nativeEvent);
|
|
179
|
-
} else if (e.key ===
|
|
179
|
+
} else if (e.key === 'Meta') state.metaKeyEvents = new Map();
|
|
180
180
|
},
|
|
181
181
|
onClick (e) {
|
|
182
182
|
if (e && !e.currentTarget.contains(e.target)) return;
|
|
@@ -185,12 +185,12 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
185
185
|
if (isDisabled) e.preventDefault();
|
|
186
186
|
// If triggered from a screen reader or by using element.click(),
|
|
187
187
|
// trigger as if it were a keyboard click.
|
|
188
|
-
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType ===
|
|
188
|
+
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === 'virtual' || (0, $7mdmh$isVirtualClick)(e.nativeEvent))) {
|
|
189
189
|
// Ensure the element receives focus (VoiceOver on iOS does not do this)
|
|
190
190
|
if (!isDisabled && !preventFocusOnPress) (0, $7mdmh$focusWithoutScrolling)(e.currentTarget);
|
|
191
|
-
let stopPressStart = triggerPressStart(e,
|
|
192
|
-
let stopPressUp = triggerPressUp(e,
|
|
193
|
-
let stopPressEnd = triggerPressEnd(e,
|
|
191
|
+
let stopPressStart = triggerPressStart(e, 'virtual');
|
|
192
|
+
let stopPressUp = triggerPressUp(e, 'virtual');
|
|
193
|
+
let stopPressEnd = triggerPressEnd(e, 'virtual');
|
|
194
194
|
shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
|
|
195
195
|
}
|
|
196
196
|
state.ignoreEmulatedMouseEvents = false;
|
|
@@ -205,12 +205,12 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
205
205
|
var _state_metaKeyEvents1;
|
|
206
206
|
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key)) e.preventDefault();
|
|
207
207
|
let target = e.target;
|
|
208
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e),
|
|
208
|
+
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard', state.target.contains(target));
|
|
209
209
|
removeAllGlobalListeners();
|
|
210
210
|
// If a link was triggered with a key other than Enter, open the URL ourselves.
|
|
211
211
|
// This means the link has a role override, and the default browser behavior
|
|
212
212
|
// only applies when using the Enter key.
|
|
213
|
-
if (e.key !==
|
|
213
|
+
if (e.key !== 'Enter' && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) && state.target.contains(target) && !e[$f6c31cce2adf654f$var$LINK_CLICKED]) {
|
|
214
214
|
// Store a hidden property on the event so we only trigger link click once,
|
|
215
215
|
// even if there are multiple usePress instances attached to the element.
|
|
216
216
|
e[$f6c31cce2adf654f$var$LINK_CLICKED] = true;
|
|
@@ -218,17 +218,17 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
218
218
|
}
|
|
219
219
|
state.isPressed = false;
|
|
220
220
|
(_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e.key);
|
|
221
|
-
} else if (e.key ===
|
|
221
|
+
} else if (e.key === 'Meta' && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
|
|
222
222
|
var _state_target;
|
|
223
223
|
// If we recorded keydown events that occurred while the Meta key was pressed,
|
|
224
224
|
// and those haven't received keyup events already, fire keyup events ourselves.
|
|
225
225
|
// See comment above for more info about the macOS bug causing this.
|
|
226
226
|
let events = state.metaKeyEvents;
|
|
227
227
|
state.metaKeyEvents = undefined;
|
|
228
|
-
for (let event of events.values())(_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent(
|
|
228
|
+
for (let event of events.values())(_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent('keyup', event));
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
if (typeof PointerEvent !==
|
|
231
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
232
232
|
pressProps.onPointerDown = (e)=>{
|
|
233
233
|
// Only handle left clicks, and ignore events that bubbled through portals.
|
|
234
234
|
if (e.button !== 0 || !e.currentTarget.contains(e.target)) return;
|
|
@@ -237,7 +237,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
237
237
|
// https://bugs.webkit.org/show_bug.cgi?id=222627
|
|
238
238
|
// https://bugs.webkit.org/show_bug.cgi?id=223202
|
|
239
239
|
if ((0, $7mdmh$isVirtualPointerEvent)(e.nativeEvent)) {
|
|
240
|
-
state.pointerType =
|
|
240
|
+
state.pointerType = 'virtual';
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
// Due to browser inconsistencies, especially on mobile browsers, we prevent
|
|
@@ -253,9 +253,9 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
253
253
|
if (!isDisabled && !preventFocusOnPress) (0, $7mdmh$focusWithoutScrolling)(e.currentTarget);
|
|
254
254
|
if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$16a4697467175487)(state.target);
|
|
255
255
|
shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
256
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
257
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
258
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
256
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'pointermove', onPointerMove, false);
|
|
257
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'pointerup', onPointerUp, false);
|
|
258
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'pointercancel', onPointerCancel, false);
|
|
259
259
|
}
|
|
260
260
|
if (shouldStopPropagation) e.stopPropagation();
|
|
261
261
|
};
|
|
@@ -271,7 +271,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
271
271
|
};
|
|
272
272
|
pressProps.onPointerUp = (e)=>{
|
|
273
273
|
// iOS fires pointerup with zero width and height, so check the pointerType recorded during pointerdown.
|
|
274
|
-
if (!e.currentTarget.contains(e.target) || state.pointerType ===
|
|
274
|
+
if (!e.currentTarget.contains(e.target) || state.pointerType === 'virtual') return;
|
|
275
275
|
// Only handle left clicks
|
|
276
276
|
// Safari on iOS sometimes fires pointerup events, even
|
|
277
277
|
// when the touch isn't over the target, so double check.
|
|
@@ -327,11 +327,11 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
327
327
|
state.isPressed = true;
|
|
328
328
|
state.isOverTarget = true;
|
|
329
329
|
state.target = e.currentTarget;
|
|
330
|
-
state.pointerType = (0, $7mdmh$isVirtualClick)(e.nativeEvent) ?
|
|
330
|
+
state.pointerType = (0, $7mdmh$isVirtualClick)(e.nativeEvent) ? 'virtual' : 'mouse';
|
|
331
331
|
if (!isDisabled && !preventFocusOnPress) (0, $7mdmh$focusWithoutScrolling)(e.currentTarget);
|
|
332
332
|
let shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
333
333
|
if (shouldStopPropagation) e.stopPropagation();
|
|
334
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
334
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'mouseup', onMouseUp, false);
|
|
335
335
|
};
|
|
336
336
|
pressProps.onMouseEnter = (e)=>{
|
|
337
337
|
if (!e.currentTarget.contains(e.target)) return;
|
|
@@ -354,7 +354,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
354
354
|
};
|
|
355
355
|
pressProps.onMouseUp = (e)=>{
|
|
356
356
|
if (!e.currentTarget.contains(e.target)) return;
|
|
357
|
-
if (!state.ignoreEmulatedMouseEvents && e.button === 0) triggerPressUp(e, state.pointerType ||
|
|
357
|
+
if (!state.ignoreEmulatedMouseEvents && e.button === 0) triggerPressUp(e, state.pointerType || 'mouse');
|
|
358
358
|
};
|
|
359
359
|
let onMouseUp = (e)=>{
|
|
360
360
|
// Only handle left clicks
|
|
@@ -378,14 +378,14 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
378
378
|
state.isOverTarget = true;
|
|
379
379
|
state.isPressed = true;
|
|
380
380
|
state.target = e.currentTarget;
|
|
381
|
-
state.pointerType =
|
|
381
|
+
state.pointerType = 'touch';
|
|
382
382
|
// Due to browser inconsistencies, especially on mobile browsers, we prevent default
|
|
383
383
|
// on the emulated mouse event and handle focusing the pressable element ourselves.
|
|
384
384
|
if (!isDisabled && !preventFocusOnPress) (0, $7mdmh$focusWithoutScrolling)(e.currentTarget);
|
|
385
385
|
if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$16a4697467175487)(state.target);
|
|
386
386
|
let shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
387
387
|
if (shouldStopPropagation) e.stopPropagation();
|
|
388
|
-
addGlobalListener((0, $7mdmh$getOwnerWindow)(e.currentTarget),
|
|
388
|
+
addGlobalListener((0, $7mdmh$getOwnerWindow)(e.currentTarget), 'scroll', onScroll, true);
|
|
389
389
|
};
|
|
390
390
|
pressProps.onTouchMove = (e)=>{
|
|
391
391
|
if (!e.currentTarget.contains(e.target)) return;
|
|
@@ -476,16 +476,16 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
478
|
function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) {
|
|
479
|
-
return target.tagName ===
|
|
479
|
+
return target.tagName === 'A' && target.hasAttribute('href');
|
|
480
480
|
}
|
|
481
481
|
function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) {
|
|
482
482
|
const { key: key, code: code } = event;
|
|
483
483
|
const element = currentTarget;
|
|
484
|
-
const role = element.getAttribute(
|
|
484
|
+
const role = element.getAttribute('role');
|
|
485
485
|
// Accessibility for keyboards. Space and Enter only.
|
|
486
486
|
// "Spacebar" is for IE 11
|
|
487
|
-
return (key ===
|
|
488
|
-
!((role ===
|
|
487
|
+
return (key === 'Enter' || key === ' ' || key === 'Spacebar' || code === 'Space') && !(element instanceof (0, $7mdmh$getOwnerWindow)(element).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof (0, $7mdmh$getOwnerWindow)(element).HTMLTextAreaElement || element.isContentEditable) && // Links should only trigger with Enter key
|
|
488
|
+
!((role === 'link' || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink(element)) && key !== 'Enter');
|
|
489
489
|
}
|
|
490
490
|
function $f6c31cce2adf654f$var$getTouchFromEvent(event) {
|
|
491
491
|
const { targetTouches: targetTouches } = event;
|
|
@@ -537,30 +537,30 @@ function $f6c31cce2adf654f$var$isOverTarget(point, target) {
|
|
|
537
537
|
}
|
|
538
538
|
function $f6c31cce2adf654f$var$shouldPreventDefault(target) {
|
|
539
539
|
// We cannot prevent default if the target is a draggable element.
|
|
540
|
-
return !(target instanceof HTMLElement) || !target.hasAttribute(
|
|
540
|
+
return !(target instanceof HTMLElement) || !target.hasAttribute('draggable');
|
|
541
541
|
}
|
|
542
542
|
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) {
|
|
543
543
|
if (target instanceof HTMLInputElement) return !$f6c31cce2adf654f$var$isValidInputKey(target, key);
|
|
544
|
-
if (target instanceof HTMLButtonElement) return target.type !==
|
|
544
|
+
if (target instanceof HTMLButtonElement) return target.type !== 'submit' && target.type !== 'reset';
|
|
545
545
|
if ($f6c31cce2adf654f$var$isHTMLAnchorLink(target)) return false;
|
|
546
546
|
return true;
|
|
547
547
|
}
|
|
548
548
|
const $f6c31cce2adf654f$var$nonTextInputTypes = new Set([
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
549
|
+
'checkbox',
|
|
550
|
+
'radio',
|
|
551
|
+
'range',
|
|
552
|
+
'color',
|
|
553
|
+
'file',
|
|
554
|
+
'image',
|
|
555
|
+
'button',
|
|
556
|
+
'submit',
|
|
557
|
+
'reset'
|
|
558
558
|
]);
|
|
559
559
|
function $f6c31cce2adf654f$var$isValidInputKey(target, key) {
|
|
560
560
|
// Only space should toggle checkboxes and radios, not enter.
|
|
561
|
-
return target.type ===
|
|
561
|
+
return target.type === 'checkbox' || target.type === 'radio' ? key === ' ' : $f6c31cce2adf654f$var$nonTextInputTypes.has(target.type);
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
|
|
565
565
|
export {$f6c31cce2adf654f$export$45712eceda6fad21 as usePress};
|
|
566
|
-
//# sourceMappingURL=usePress.
|
|
566
|
+
//# sourceMappingURL=usePress.module.js.map
|
package/dist/usePress.module.js
CHANGED
|
@@ -61,7 +61,7 @@ class $f6c31cce2adf654f$var$PressEvent {
|
|
|
61
61
|
this.altKey = originalEvent.altKey;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol(
|
|
64
|
+
const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol('linkClicked');
|
|
65
65
|
function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
66
66
|
let { onPress: onPress, onPressChange: onPressChange, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, isDisabled: isDisabled, isPressed: isPressedProp, preventFocusOnPress: preventFocusOnPress, shouldCancelOnPointerExit: shouldCancelOnPointerExit, allowTextSelectionOnPress: allowTextSelectionOnPress, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
67
67
|
ref: _, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext(props);
|
|
@@ -84,7 +84,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
84
84
|
let shouldStopPropagation = true;
|
|
85
85
|
state.isTriggeringEvent = true;
|
|
86
86
|
if (onPressStart) {
|
|
87
|
-
let event = new $f6c31cce2adf654f$var$PressEvent(
|
|
87
|
+
let event = new $f6c31cce2adf654f$var$PressEvent('pressstart', pointerType, originalEvent);
|
|
88
88
|
onPressStart(event);
|
|
89
89
|
shouldStopPropagation = event.shouldStopPropagation;
|
|
90
90
|
}
|
|
@@ -102,14 +102,14 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
102
102
|
state.isTriggeringEvent = true;
|
|
103
103
|
let shouldStopPropagation = true;
|
|
104
104
|
if (onPressEnd) {
|
|
105
|
-
let event = new $f6c31cce2adf654f$var$PressEvent(
|
|
105
|
+
let event = new $f6c31cce2adf654f$var$PressEvent('pressend', pointerType, originalEvent);
|
|
106
106
|
onPressEnd(event);
|
|
107
107
|
shouldStopPropagation = event.shouldStopPropagation;
|
|
108
108
|
}
|
|
109
109
|
if (onPressChange) onPressChange(false);
|
|
110
110
|
setPressed(false);
|
|
111
111
|
if (onPress && wasPressed && !isDisabled) {
|
|
112
|
-
let event = new $f6c31cce2adf654f$var$PressEvent(
|
|
112
|
+
let event = new $f6c31cce2adf654f$var$PressEvent('press', pointerType, originalEvent);
|
|
113
113
|
onPress(event);
|
|
114
114
|
shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
|
|
115
115
|
}
|
|
@@ -121,7 +121,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
121
121
|
if (isDisabled) return false;
|
|
122
122
|
if (onPressUp) {
|
|
123
123
|
state.isTriggeringEvent = true;
|
|
124
|
-
let event = new $f6c31cce2adf654f$var$PressEvent(
|
|
124
|
+
let event = new $f6c31cce2adf654f$var$PressEvent('pressup', pointerType, originalEvent);
|
|
125
125
|
onPressUp(event);
|
|
126
126
|
state.isTriggeringEvent = false;
|
|
127
127
|
return event.shouldStopPropagation;
|
|
@@ -157,15 +157,15 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
157
157
|
if (!state.isPressed && !e.repeat) {
|
|
158
158
|
state.target = e.currentTarget;
|
|
159
159
|
state.isPressed = true;
|
|
160
|
-
shouldStopPropagation = triggerPressStart(e,
|
|
160
|
+
shouldStopPropagation = triggerPressStart(e, 'keyboard');
|
|
161
161
|
// Focus may move before the key up event, so register the event on the document
|
|
162
162
|
// instead of the same element where the key down event occurred. Make it capturing so that it will trigger
|
|
163
163
|
// before stopPropagation from useKeyboard on a child element may happen and thus we can still call triggerPress for the parent element.
|
|
164
164
|
let originalTarget = e.currentTarget;
|
|
165
165
|
let pressUp = (e)=>{
|
|
166
|
-
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e, originalTarget) && !e.repeat && originalTarget.contains(e.target) && state.target) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e),
|
|
166
|
+
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e, originalTarget) && !e.repeat && originalTarget.contains(e.target) && state.target) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard');
|
|
167
167
|
};
|
|
168
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
168
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'keyup', (0, $7mdmh$chain)(pressUp, onKeyUp), true);
|
|
169
169
|
}
|
|
170
170
|
if (shouldStopPropagation) e.stopPropagation();
|
|
171
171
|
// Keep track of the keydown events that occur while the Meta (e.g. Command) key is held.
|
|
@@ -176,7 +176,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
176
176
|
// https://bugs.webkit.org/show_bug.cgi?id=55291
|
|
177
177
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1299553
|
|
178
178
|
if (e.metaKey && (0, $7mdmh$isMac)()) (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e.key, e.nativeEvent);
|
|
179
|
-
} else if (e.key ===
|
|
179
|
+
} else if (e.key === 'Meta') state.metaKeyEvents = new Map();
|
|
180
180
|
},
|
|
181
181
|
onClick (e) {
|
|
182
182
|
if (e && !e.currentTarget.contains(e.target)) return;
|
|
@@ -185,12 +185,12 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
185
185
|
if (isDisabled) e.preventDefault();
|
|
186
186
|
// If triggered from a screen reader or by using element.click(),
|
|
187
187
|
// trigger as if it were a keyboard click.
|
|
188
|
-
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType ===
|
|
188
|
+
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === 'virtual' || (0, $7mdmh$isVirtualClick)(e.nativeEvent))) {
|
|
189
189
|
// Ensure the element receives focus (VoiceOver on iOS does not do this)
|
|
190
190
|
if (!isDisabled && !preventFocusOnPress) (0, $7mdmh$focusWithoutScrolling)(e.currentTarget);
|
|
191
|
-
let stopPressStart = triggerPressStart(e,
|
|
192
|
-
let stopPressUp = triggerPressUp(e,
|
|
193
|
-
let stopPressEnd = triggerPressEnd(e,
|
|
191
|
+
let stopPressStart = triggerPressStart(e, 'virtual');
|
|
192
|
+
let stopPressUp = triggerPressUp(e, 'virtual');
|
|
193
|
+
let stopPressEnd = triggerPressEnd(e, 'virtual');
|
|
194
194
|
shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
|
|
195
195
|
}
|
|
196
196
|
state.ignoreEmulatedMouseEvents = false;
|
|
@@ -205,12 +205,12 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
205
205
|
var _state_metaKeyEvents1;
|
|
206
206
|
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key)) e.preventDefault();
|
|
207
207
|
let target = e.target;
|
|
208
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e),
|
|
208
|
+
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard', state.target.contains(target));
|
|
209
209
|
removeAllGlobalListeners();
|
|
210
210
|
// If a link was triggered with a key other than Enter, open the URL ourselves.
|
|
211
211
|
// This means the link has a role override, and the default browser behavior
|
|
212
212
|
// only applies when using the Enter key.
|
|
213
|
-
if (e.key !==
|
|
213
|
+
if (e.key !== 'Enter' && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) && state.target.contains(target) && !e[$f6c31cce2adf654f$var$LINK_CLICKED]) {
|
|
214
214
|
// Store a hidden property on the event so we only trigger link click once,
|
|
215
215
|
// even if there are multiple usePress instances attached to the element.
|
|
216
216
|
e[$f6c31cce2adf654f$var$LINK_CLICKED] = true;
|
|
@@ -218,17 +218,17 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
218
218
|
}
|
|
219
219
|
state.isPressed = false;
|
|
220
220
|
(_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e.key);
|
|
221
|
-
} else if (e.key ===
|
|
221
|
+
} else if (e.key === 'Meta' && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
|
|
222
222
|
var _state_target;
|
|
223
223
|
// If we recorded keydown events that occurred while the Meta key was pressed,
|
|
224
224
|
// and those haven't received keyup events already, fire keyup events ourselves.
|
|
225
225
|
// See comment above for more info about the macOS bug causing this.
|
|
226
226
|
let events = state.metaKeyEvents;
|
|
227
227
|
state.metaKeyEvents = undefined;
|
|
228
|
-
for (let event of events.values())(_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent(
|
|
228
|
+
for (let event of events.values())(_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent('keyup', event));
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
if (typeof PointerEvent !==
|
|
231
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
232
232
|
pressProps.onPointerDown = (e)=>{
|
|
233
233
|
// Only handle left clicks, and ignore events that bubbled through portals.
|
|
234
234
|
if (e.button !== 0 || !e.currentTarget.contains(e.target)) return;
|
|
@@ -237,7 +237,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
237
237
|
// https://bugs.webkit.org/show_bug.cgi?id=222627
|
|
238
238
|
// https://bugs.webkit.org/show_bug.cgi?id=223202
|
|
239
239
|
if ((0, $7mdmh$isVirtualPointerEvent)(e.nativeEvent)) {
|
|
240
|
-
state.pointerType =
|
|
240
|
+
state.pointerType = 'virtual';
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
// Due to browser inconsistencies, especially on mobile browsers, we prevent
|
|
@@ -253,9 +253,9 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
253
253
|
if (!isDisabled && !preventFocusOnPress) (0, $7mdmh$focusWithoutScrolling)(e.currentTarget);
|
|
254
254
|
if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$16a4697467175487)(state.target);
|
|
255
255
|
shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
256
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
257
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
258
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
256
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'pointermove', onPointerMove, false);
|
|
257
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'pointerup', onPointerUp, false);
|
|
258
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'pointercancel', onPointerCancel, false);
|
|
259
259
|
}
|
|
260
260
|
if (shouldStopPropagation) e.stopPropagation();
|
|
261
261
|
};
|
|
@@ -271,7 +271,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
271
271
|
};
|
|
272
272
|
pressProps.onPointerUp = (e)=>{
|
|
273
273
|
// iOS fires pointerup with zero width and height, so check the pointerType recorded during pointerdown.
|
|
274
|
-
if (!e.currentTarget.contains(e.target) || state.pointerType ===
|
|
274
|
+
if (!e.currentTarget.contains(e.target) || state.pointerType === 'virtual') return;
|
|
275
275
|
// Only handle left clicks
|
|
276
276
|
// Safari on iOS sometimes fires pointerup events, even
|
|
277
277
|
// when the touch isn't over the target, so double check.
|
|
@@ -327,11 +327,11 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
327
327
|
state.isPressed = true;
|
|
328
328
|
state.isOverTarget = true;
|
|
329
329
|
state.target = e.currentTarget;
|
|
330
|
-
state.pointerType = (0, $7mdmh$isVirtualClick)(e.nativeEvent) ?
|
|
330
|
+
state.pointerType = (0, $7mdmh$isVirtualClick)(e.nativeEvent) ? 'virtual' : 'mouse';
|
|
331
331
|
if (!isDisabled && !preventFocusOnPress) (0, $7mdmh$focusWithoutScrolling)(e.currentTarget);
|
|
332
332
|
let shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
333
333
|
if (shouldStopPropagation) e.stopPropagation();
|
|
334
|
-
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget),
|
|
334
|
+
addGlobalListener((0, $7mdmh$getOwnerDocument)(e.currentTarget), 'mouseup', onMouseUp, false);
|
|
335
335
|
};
|
|
336
336
|
pressProps.onMouseEnter = (e)=>{
|
|
337
337
|
if (!e.currentTarget.contains(e.target)) return;
|
|
@@ -354,7 +354,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
354
354
|
};
|
|
355
355
|
pressProps.onMouseUp = (e)=>{
|
|
356
356
|
if (!e.currentTarget.contains(e.target)) return;
|
|
357
|
-
if (!state.ignoreEmulatedMouseEvents && e.button === 0) triggerPressUp(e, state.pointerType ||
|
|
357
|
+
if (!state.ignoreEmulatedMouseEvents && e.button === 0) triggerPressUp(e, state.pointerType || 'mouse');
|
|
358
358
|
};
|
|
359
359
|
let onMouseUp = (e)=>{
|
|
360
360
|
// Only handle left clicks
|
|
@@ -378,14 +378,14 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
378
378
|
state.isOverTarget = true;
|
|
379
379
|
state.isPressed = true;
|
|
380
380
|
state.target = e.currentTarget;
|
|
381
|
-
state.pointerType =
|
|
381
|
+
state.pointerType = 'touch';
|
|
382
382
|
// Due to browser inconsistencies, especially on mobile browsers, we prevent default
|
|
383
383
|
// on the emulated mouse event and handle focusing the pressable element ourselves.
|
|
384
384
|
if (!isDisabled && !preventFocusOnPress) (0, $7mdmh$focusWithoutScrolling)(e.currentTarget);
|
|
385
385
|
if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$16a4697467175487)(state.target);
|
|
386
386
|
let shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
387
387
|
if (shouldStopPropagation) e.stopPropagation();
|
|
388
|
-
addGlobalListener((0, $7mdmh$getOwnerWindow)(e.currentTarget),
|
|
388
|
+
addGlobalListener((0, $7mdmh$getOwnerWindow)(e.currentTarget), 'scroll', onScroll, true);
|
|
389
389
|
};
|
|
390
390
|
pressProps.onTouchMove = (e)=>{
|
|
391
391
|
if (!e.currentTarget.contains(e.target)) return;
|
|
@@ -476,16 +476,16 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
478
|
function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) {
|
|
479
|
-
return target.tagName ===
|
|
479
|
+
return target.tagName === 'A' && target.hasAttribute('href');
|
|
480
480
|
}
|
|
481
481
|
function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) {
|
|
482
482
|
const { key: key, code: code } = event;
|
|
483
483
|
const element = currentTarget;
|
|
484
|
-
const role = element.getAttribute(
|
|
484
|
+
const role = element.getAttribute('role');
|
|
485
485
|
// Accessibility for keyboards. Space and Enter only.
|
|
486
486
|
// "Spacebar" is for IE 11
|
|
487
|
-
return (key ===
|
|
488
|
-
!((role ===
|
|
487
|
+
return (key === 'Enter' || key === ' ' || key === 'Spacebar' || code === 'Space') && !(element instanceof (0, $7mdmh$getOwnerWindow)(element).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof (0, $7mdmh$getOwnerWindow)(element).HTMLTextAreaElement || element.isContentEditable) && // Links should only trigger with Enter key
|
|
488
|
+
!((role === 'link' || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink(element)) && key !== 'Enter');
|
|
489
489
|
}
|
|
490
490
|
function $f6c31cce2adf654f$var$getTouchFromEvent(event) {
|
|
491
491
|
const { targetTouches: targetTouches } = event;
|
|
@@ -537,28 +537,28 @@ function $f6c31cce2adf654f$var$isOverTarget(point, target) {
|
|
|
537
537
|
}
|
|
538
538
|
function $f6c31cce2adf654f$var$shouldPreventDefault(target) {
|
|
539
539
|
// We cannot prevent default if the target is a draggable element.
|
|
540
|
-
return !(target instanceof HTMLElement) || !target.hasAttribute(
|
|
540
|
+
return !(target instanceof HTMLElement) || !target.hasAttribute('draggable');
|
|
541
541
|
}
|
|
542
542
|
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) {
|
|
543
543
|
if (target instanceof HTMLInputElement) return !$f6c31cce2adf654f$var$isValidInputKey(target, key);
|
|
544
|
-
if (target instanceof HTMLButtonElement) return target.type !==
|
|
544
|
+
if (target instanceof HTMLButtonElement) return target.type !== 'submit' && target.type !== 'reset';
|
|
545
545
|
if ($f6c31cce2adf654f$var$isHTMLAnchorLink(target)) return false;
|
|
546
546
|
return true;
|
|
547
547
|
}
|
|
548
548
|
const $f6c31cce2adf654f$var$nonTextInputTypes = new Set([
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
549
|
+
'checkbox',
|
|
550
|
+
'radio',
|
|
551
|
+
'range',
|
|
552
|
+
'color',
|
|
553
|
+
'file',
|
|
554
|
+
'image',
|
|
555
|
+
'button',
|
|
556
|
+
'submit',
|
|
557
|
+
'reset'
|
|
558
558
|
]);
|
|
559
559
|
function $f6c31cce2adf654f$var$isValidInputKey(target, key) {
|
|
560
560
|
// Only space should toggle checkboxes and radios, not enter.
|
|
561
|
-
return target.type ===
|
|
561
|
+
return target.type === 'checkbox' || target.type === 'radio' ? key === ' ' : $f6c31cce2adf654f$var$nonTextInputTypes.has(target.type);
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
|
|
@@ -34,7 +34,7 @@ function $a3dbce0aed7087e2$export$2123ff2b87c81ca(props, ref) {
|
|
|
34
34
|
}, [
|
|
35
35
|
onScroll
|
|
36
36
|
]);
|
|
37
|
-
(0, $jo4fw$reactariautils.useEvent)(ref,
|
|
37
|
+
(0, $jo4fw$reactariautils.useEvent)(ref, 'wheel', isDisabled ? undefined : onScrollHandler);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
|
package/dist/useScrollWheel.mjs
CHANGED
|
@@ -28,9 +28,9 @@ function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
|
|
|
28
28
|
}, [
|
|
29
29
|
onScroll
|
|
30
30
|
]);
|
|
31
|
-
(0, $nrdL2$useEvent)(ref,
|
|
31
|
+
(0, $nrdL2$useEvent)(ref, 'wheel', isDisabled ? undefined : onScrollHandler);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
export {$7d0a636d7a4dcefd$export$2123ff2b87c81ca as useScrollWheel};
|
|
36
|
-
//# sourceMappingURL=useScrollWheel.
|
|
36
|
+
//# sourceMappingURL=useScrollWheel.module.js.map
|
|
@@ -28,7 +28,7 @@ function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
|
|
|
28
28
|
}, [
|
|
29
29
|
onScroll
|
|
30
30
|
]);
|
|
31
|
-
(0, $nrdL2$useEvent)(ref,
|
|
31
|
+
(0, $nrdL2$useEvent)(ref, 'wheel', isDisabled ? undefined : onScrollHandler);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
|
package/dist/utils.main.js
CHANGED
|
@@ -80,14 +80,14 @@ function $625cf83917e112ad$export$715c682d09d639cc(onBlur) {
|
|
|
80
80
|
let onBlurHandler = (e)=>{
|
|
81
81
|
stateRef.current.isFocused = false;
|
|
82
82
|
if (target.disabled) // For backward compatibility, dispatch a (fake) React synthetic event.
|
|
83
|
-
dispatchBlur(new $625cf83917e112ad$export$905e7fc544a71f36(
|
|
83
|
+
dispatchBlur(new $625cf83917e112ad$export$905e7fc544a71f36('blur', e));
|
|
84
84
|
// We no longer need the MutationObserver once the target is blurred.
|
|
85
85
|
if (stateRef.current.observer) {
|
|
86
86
|
stateRef.current.observer.disconnect();
|
|
87
87
|
stateRef.current.observer = null;
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
-
target.addEventListener(
|
|
90
|
+
target.addEventListener('focusout', onBlurHandler, {
|
|
91
91
|
once: true
|
|
92
92
|
});
|
|
93
93
|
stateRef.current.observer = new MutationObserver(()=>{
|
|
@@ -95,10 +95,10 @@ function $625cf83917e112ad$export$715c682d09d639cc(onBlur) {
|
|
|
95
95
|
var _stateRef_current_observer;
|
|
96
96
|
(_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
|
|
97
97
|
let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
|
|
98
|
-
target.dispatchEvent(new FocusEvent(
|
|
98
|
+
target.dispatchEvent(new FocusEvent('blur', {
|
|
99
99
|
relatedTarget: relatedTargetEl
|
|
100
100
|
}));
|
|
101
|
-
target.dispatchEvent(new FocusEvent(
|
|
101
|
+
target.dispatchEvent(new FocusEvent('focusout', {
|
|
102
102
|
bubbles: true,
|
|
103
103
|
relatedTarget: relatedTargetEl
|
|
104
104
|
}));
|
|
@@ -107,7 +107,7 @@ function $625cf83917e112ad$export$715c682d09d639cc(onBlur) {
|
|
|
107
107
|
stateRef.current.observer.observe(target, {
|
|
108
108
|
attributes: true,
|
|
109
109
|
attributeFilter: [
|
|
110
|
-
|
|
110
|
+
'disabled'
|
|
111
111
|
]
|
|
112
112
|
});
|
|
113
113
|
}
|