Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-overlays

Package Overview
Dependencies
Maintainers
2
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-overlays - npm Package Compare versions

Comparing version 4.1.0 to 4.1.1

467

cjs/popper.js

@@ -52,5 +52,40 @@ 'use strict';

/*:: import type { Window } from '../types'; */
/*:: declare function getWindow(node: Node | Window): Window; */
function getWindow(node) {
if (node.toString() !== '[object Window]') {
var ownerDocument = node.ownerDocument;
return ownerDocument ? ownerDocument.defaultView || window : window;
}
return node;
}
/*:: declare function isElement(node: mixed): boolean %checks(node instanceof
Element); */
function isElement(node) {
var OwnElement = getWindow(node).Element;
return node instanceof OwnElement || node instanceof Element;
}
/*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
HTMLElement); */
function isHTMLElement(node) {
var OwnElement = getWindow(node).HTMLElement;
return node instanceof OwnElement || node instanceof HTMLElement;
}
/*:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof
ShadowRoot); */
function isShadowRoot(node) {
var OwnElement = getWindow(node).ShadowRoot;
return node instanceof OwnElement || node instanceof ShadowRoot;
}
function contains(parent, child) {
// $FlowFixMe: hasOwnProperty doesn't seem to work in tests
var isShadow = Boolean(child.getRootNode && child.getRootNode().host); // First, attempt with faster native method
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method

@@ -60,3 +95,3 @@ if (parent.contains(child)) {

} // then fallback to custom implementation with Shadow DOM support
else if (isShadow) {
else if (isShadowRoot(rootNode)) {
var next = child;

@@ -78,14 +113,2 @@

/*:: import type { Window } from '../types'; */
/*:: declare function getWindow(node: Node | Window): Window; */
function getWindow(node) {
if (node.toString() !== '[object Window]') {
var ownerDocument = node.ownerDocument;
return ownerDocument ? ownerDocument.defaultView : window;
}
return node;
}
function getNodeName(element) {

@@ -99,20 +122,25 @@ return element ? (element.nodeName || '').toLowerCase() : null;

/*:: declare function isElement(node: mixed): boolean %checks(node instanceof
Element); */
function isTableElement(element) {
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
}
function isElement(node) {
var OwnElement = getWindow(node).Element;
return node instanceof OwnElement || node instanceof Element;
function getDocumentElement(element) {
// $FlowFixMe: assume body is always available
return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
}
/*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
HTMLElement); */
function getParentNode(element) {
if (getNodeName(element) === 'html') {
return element;
}
function isHTMLElement(node) {
var OwnElement = getWindow(node).HTMLElement;
return node instanceof OwnElement || node instanceof HTMLElement;
}
return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
element.parentNode || // DOM Element detected
// $FlowFixMe: need a better way to handle this...
element.host || // ShadowRoot detected
// $FlowFixMe: HTMLElement is a Node
getDocumentElement(element) // fallback
function isTableElement(element) {
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
);
}

@@ -126,10 +154,41 @@

return element.offsetParent;
}
var offsetParent = element.offsetParent;
if (offsetParent) {
var html = getDocumentElement(offsetParent);
if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
return html;
}
}
return offsetParent;
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
// return the containing block
function getContainingBlock(element) {
var currentNode = getParentNode(element);
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
// create a containing block.
if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
return currentNode;
} else {
currentNode = currentNode.parentNode;
}
}
return null;
} // Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
function getOffsetParent(element) {
var window = getWindow(element);
var offsetParent = getTrueOffsetParent(element); // Find the nearest non-table offsetParent
var offsetParent = getTrueOffsetParent(element);
while (offsetParent && isTableElement(offsetParent)) {
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
offsetParent = getTrueOffsetParent(offsetParent);

@@ -142,3 +201,3 @@ }

return offsetParent || window;
return offsetParent || getContainingBlock(element) || window;
}

@@ -164,3 +223,3 @@

function mergePaddingObject(paddingObject) {
return Object.assign({}, getFreshSideObject(), {}, paddingObject);
return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
}

@@ -264,7 +323,2 @@

function getDocumentElement(element) {
// $FlowFixMe: assume body is always available
return (isElement(element) ? element.ownerDocument : element.document).documentElement;
}
var unsetSides = {

@@ -341,6 +395,6 @@ top: 'auto',

return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
}
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
}

@@ -374,3 +428,3 @@

if (state.modifiersData.popperOffsets != null) {
state.styles.popper = Object.assign({}, state.styles.popper, {}, mapToStyles(Object.assign({}, commonStyles, {
state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
offsets: state.modifiersData.popperOffsets,

@@ -383,3 +437,3 @@ position: state.options.strategy,

if (state.modifiersData.arrow != null) {
state.styles.arrow = Object.assign({}, state.styles.arrow, {}, mapToStyles(Object.assign({}, commonStyles, {
state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
offsets: state.modifiersData.arrow,

@@ -391,3 +445,3 @@ position: 'absolute',

state.attributes.popper = Object.assign({}, state.attributes.popper, {
state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
'data-popper-placement': state.placement

@@ -490,23 +544,2 @@ });

function getViewportRect(element) {
var win = getWindow(element);
var visualViewport = win.visualViewport;
var width = win.innerWidth;
var height = win.innerHeight; // We don't know which browsers have buggy or odd implementations of this, so
// for now we're only applying it to iOS to fix the keyboard issue.
// Investigation required
if (visualViewport && /iPhone|iPod|iPad/.test(navigator.platform)) {
width = visualViewport.width;
height = visualViewport.height;
}
return {
width: width,
height: height,
x: 0,
y: 0
};
}
function getWindowScroll(node) {

@@ -522,17 +555,2 @@ var win = getWindow(node);

function getHTMLElementScroll(element) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
function getNodeScroll(node) {
if (node === getWindow(node) || !isHTMLElement(node)) {
return getWindowScroll(node);
} else {
return getHTMLElementScroll(node);
}
}
function getWindowScrollBarX(element) {

@@ -549,78 +567,71 @@ // If <html> has a CSS width greater than the viewport, then this will be

function isScrollParent(element) {
// Firefox wants us to check `-x` and `-y` variations as well
var _getComputedStyle = getComputedStyle(element),
overflow = _getComputedStyle.overflow,
overflowX = _getComputedStyle.overflowX,
overflowY = _getComputedStyle.overflowY;
function getViewportRect(element) {
var win = getWindow(element);
var html = getDocumentElement(element);
var visualViewport = win.visualViewport;
var width = html.clientWidth;
var height = html.clientHeight;
var x = 0;
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
// can be obscured underneath it.
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
// if it isn't open, so if this isn't available, the popper will be detected
// to overflow the bottom of the screen too early.
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
// errors due to floating point numbers, so we need to check precision.
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
// Feature detection fails in mobile emulation mode in Chrome.
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
// 0.001
// Fallback here: "Not Safari" userAgent
// Composite means it takes into account transforms as well as layout.
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
if (isFixed === void 0) {
isFixed = false;
}
var documentElement = getDocumentElement(offsetParent);
var rect = getBoundingClientRect(elementOrVirtualElement);
var scroll = {
scrollLeft: 0,
scrollTop: 0
};
var offsets = {
x: 0,
y: 0
};
if (!isFixed) {
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
x = visualViewport.offsetLeft;
y = visualViewport.offsetTop;
}
if (isHTMLElement(offsetParent)) {
offsets = getBoundingClientRect(offsetParent);
offsets.x += offsetParent.clientLeft;
offsets.y += offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
return {
x: rect.left + scroll.scrollLeft - offsets.x,
y: rect.top + scroll.scrollTop - offsets.y,
width: rect.width,
height: rect.height
width: width,
height: height,
x: x + getWindowScrollBarX(element),
y: y
};
}
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
function getDocumentRect(element) {
var win = getWindow(element);
var html = getDocumentElement(element);
var winScroll = getWindowScroll(element);
var documentRect = getCompositeRect(getDocumentElement(element), win);
documentRect.height = Math.max(documentRect.height, win.innerHeight);
documentRect.width = Math.max(documentRect.width, win.innerWidth);
documentRect.x = -winScroll.scrollLeft;
documentRect.y = -winScroll.scrollTop;
return documentRect;
}
var body = element.ownerDocument.body;
var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
var y = -winScroll.scrollTop;
function getParentNode(element) {
if (getNodeName(element) === 'html') {
return element;
if (getComputedStyle(body || html).direction === 'rtl') {
x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
}
return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
element.parentNode || // DOM Element detected
// $FlowFixMe: need a better way to handle this...
element.host || // ShadowRoot detected
// $FlowFixMe: HTMLElement is a Node
getDocumentElement(element) // fallback
return {
width: width,
height: height,
x: x,
y: y
};
}
);
function isScrollParent(element) {
// Firefox wants us to check `-x` and `-y` variations as well
var _getComputedStyle = getComputedStyle(element),
overflow = _getComputedStyle.overflow,
overflowX = _getComputedStyle.overflowX,
overflowY = _getComputedStyle.overflowY;
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}

@@ -641,2 +652,9 @@

/*
given a DOM element, return the list of all scroll parents, up the list of ancesors
until we get to the top window object. This list is what we attach scroll listeners
to, because if any of these parent elements scroll, we'll need to re-calculate the
reference element's position.
*/
function listScrollParents(element, list) {

@@ -656,47 +674,4 @@ if (list === void 0) {

function toNumber(cssValue) {
return parseFloat(cssValue) || 0;
}
function getBorders(element) {
var computedStyle = isHTMLElement(element) ? getComputedStyle(element) : {};
return {
top: toNumber(computedStyle.borderTopWidth),
right: toNumber(computedStyle.borderRightWidth),
bottom: toNumber(computedStyle.borderBottomWidth),
left: toNumber(computedStyle.borderLeftWidth)
};
}
function getDecorations(element) {
var win = getWindow(element);
var borders = getBorders(element);
var isHTML = getNodeName(element) === 'html';
var winScrollBarX = getWindowScrollBarX(element);
var x = element.clientWidth + borders.right;
var y = element.clientHeight + borders.bottom; // HACK:
// document.documentElement.clientHeight on iOS reports the height of the
// viewport including the bottom bar, even if the bottom bar isn't visible.
// If the difference between window innerHeight and html clientHeight is more
// than 50, we assume it's a mobile bottom bar and ignore scrollbars.
// * A 50px thick scrollbar is likely non-existent (macOS is 15px and Windows
// is about 17px)
// * The mobile bar is 114px tall
if (isHTML && win.innerHeight - element.clientHeight > 50) {
y = win.innerHeight - borders.bottom;
}
return {
top: isHTML ? 0 : element.clientTop,
right: // RTL scrollbar (scrolling containers only)
element.clientLeft > borders.left ? borders.right : // LTR scrollbar
isHTML ? win.innerWidth - x - winScrollBarX : element.offsetWidth - x,
bottom: isHTML ? win.innerHeight - y : element.offsetHeight - y,
left: isHTML ? winScrollBarX : element.clientLeft
};
}
function rectToClientRect(rect) {
return Object.assign({}, rect, {
return Object.assign(Object.assign({}, rect), {}, {
left: rect.x,

@@ -709,4 +684,17 @@ top: rect.y,

function getInnerBoundingClientRect(element) {
var rect = getBoundingClientRect(element);
rect.top = rect.top + element.clientTop;
rect.left = rect.left + element.clientLeft;
rect.bottom = rect.top + element.clientHeight;
rect.right = rect.left + element.clientWidth;
rect.width = element.clientWidth;
rect.height = element.clientHeight;
rect.x = rect.left;
rect.y = rect.top;
return rect;
}
function getClientRectFromMixedType(element, clippingParent) {
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
} // A "clipping parent" is an overflowable container with the characteristic of

@@ -718,3 +706,3 @@ // clipping (or hiding) overflowing elements with a position different from

function getClippingParents(element) {
var clippingParents = listScrollParents(element);
var clippingParents = listScrollParents(getParentNode(element));
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;

@@ -729,3 +717,3 @@ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;

return clippingParents.filter(function (clippingParent) {
return isElement(clippingParent) && contains(clippingParent, clipperElement);
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
});

@@ -742,7 +730,6 @@ } // Gets the maximum area that the element is visible in due to any number of

var rect = getClientRectFromMixedType(element, clippingParent);
var decorations = getDecorations(isHTMLElement(clippingParent) ? clippingParent : getDocumentElement(element));
accRect.top = Math.max(rect.top + decorations.top, accRect.top);
accRect.right = Math.min(rect.right - decorations.right, accRect.right);
accRect.bottom = Math.min(rect.bottom - decorations.bottom, accRect.bottom);
accRect.left = Math.max(rect.left + decorations.left, accRect.left);
accRect.top = Math.max(rect.top, accRect.top);
accRect.right = Math.min(rect.right, accRect.right);
accRect.bottom = Math.min(rect.bottom, accRect.bottom);
accRect.left = Math.max(rect.left, accRect.left);
return accRect;

@@ -857,3 +844,3 @@ }, getClientRectFromMixedType(element, firstClippingParent));

});
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, {}, popperOffsets));
var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect

@@ -899,9 +886,20 @@ // 0 or negative = within the clipping rect

var variation = getVariation(placement);
var placements$1 = (variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
return getVariation(placement) === variation;
}) : basePlacements).filter(function (placement) {
}) : basePlacements; // $FlowFixMe
var allowedPlacements = placements$1.filter(function (placement) {
return allowedAutoPlacements.indexOf(placement) >= 0;
}); // $FlowFixMe: Flow seems to have problems with two array unions...
});
var overflows = placements$1.reduce(function (acc, placement) {
if (allowedPlacements.length === 0) {
allowedPlacements = placements$1;
if (process.env.NODE_ENV !== "production") {
console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
}
} // $FlowFixMe: Flow seems to have problems with two array unions...
var overflows = allowedPlacements.reduce(function (acc, placement) {
acc[placement] = detectOverflow(state, {

@@ -1104,3 +1102,3 @@ placement: placement,

};
state.attributes.popper = Object.assign({}, state.attributes.popper, {
state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
'data-popper-reference-hidden': isReferenceHidden,

@@ -1124,3 +1122,3 @@ 'data-popper-escaped': hasPopperEscaped

var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
placement: placement

@@ -1231,3 +1229,3 @@ })) : offset,

var popperRect = state.rects.popper;
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
placement: state.placement

@@ -1311,2 +1309,59 @@ })) : tetherOffset;

function getHTMLElementScroll(element) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
function getNodeScroll(node) {
if (node === getWindow(node) || !isHTMLElement(node)) {
return getWindowScroll(node);
} else {
return getHTMLElementScroll(node);
}
}
// Composite means it takes into account transforms as well as layout.
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
if (isFixed === void 0) {
isFixed = false;
}
var documentElement = getDocumentElement(offsetParent);
var rect = getBoundingClientRect(elementOrVirtualElement);
var isOffsetParentAnElement = isHTMLElement(offsetParent);
var scroll = {
scrollLeft: 0,
scrollTop: 0
};
var offsets = {
x: 0,
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
offsets = getBoundingClientRect(offsetParent);
offsets.x += offsetParent.clientLeft;
offsets.y += offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
return {
x: rect.left + scroll.scrollLeft - offsets.x,
y: rect.top + scroll.scrollTop - offsets.y,
width: rect.width,
height: rect.height
};
}
function order(modifiers) {

@@ -1471,5 +1526,5 @@ var map = new Map();

var existing = merged[current.name];
merged[current.name] = existing ? Object.assign({}, existing, {}, current, {
options: Object.assign({}, existing.options, {}, current.options),
data: Object.assign({}, existing.data, {}, current.data)
merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
options: Object.assign(Object.assign({}, existing.options), current.options),
data: Object.assign(Object.assign({}, existing.data), current.data)
}) : current;

@@ -1520,3 +1575,3 @@ return merged;

orderedModifiers: [],
options: Object.assign({}, DEFAULT_OPTIONS, {}, defaultOptions),
options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
modifiersData: {},

@@ -1536,3 +1591,3 @@ elements: {

cleanupModifierEffects();
state.options = Object.assign({}, defaultOptions, {}, state.options, {}, options);
state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
state.scrollParents = {

@@ -1539,0 +1594,0 @@ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],

@@ -63,2 +63,7 @@ "use strict";

var ids = reference.getAttribute('aria-describedby');
if (ids && ids.split(',').indexOf(popper.id) !== -1) {
return;
}
reference.setAttribute('aria-describedby', ids ? ids + "," + popper.id : popper.id);

@@ -65,0 +70,0 @@ }

@@ -72,3 +72,6 @@ "use strict";

(0, _react.useEffect)(function () {
if (disabled || ref == null) return undefined;
if (disabled || ref == null) return undefined; // Store the current event to avoid triggering handlers immediately
// https://github.com/facebook/react/issues/20074
var currentEvent = window.event;
var doc = (0, _ownerDocument["default"])(getRefTarget(ref)); // Use capture for this listener so it fires before React's listener, to

@@ -79,4 +82,20 @@ // avoid false positives in the contains() check below if the target DOM

var removeMouseCaptureListener = (0, _listen["default"])(doc, clickTrigger, handleMouseCapture, true);
var removeMouseListener = (0, _listen["default"])(doc, clickTrigger, handleMouse);
var removeKeyupListener = (0, _listen["default"])(doc, 'keyup', handleKeyUp);
var removeMouseListener = (0, _listen["default"])(doc, clickTrigger, function (e) {
// skip if this event is the same as the one running when we added the handlers
if (e === currentEvent) {
currentEvent = undefined;
return;
}
handleMouse(e);
});
var removeKeyupListener = (0, _listen["default"])(doc, 'keyup', function (e) {
// skip if this event is the same as the one running when we added the handlers
if (e === currentEvent) {
currentEvent = undefined;
return;
}
handleKeyUp(e);
});
var mobileSafariHackListeners = [];

@@ -83,0 +102,0 @@

@@ -52,2 +52,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";

var ids = reference.getAttribute('aria-describedby');
if (ids && ids.split(',').indexOf(popper.id) !== -1) {
return;
}
reference.setAttribute('aria-describedby', ids ? ids + "," + popper.id : popper.id);

@@ -54,0 +59,0 @@ }

@@ -59,3 +59,6 @@ import contains from 'dom-helpers/contains';

useEffect(function () {
if (disabled || ref == null) return undefined;
if (disabled || ref == null) return undefined; // Store the current event to avoid triggering handlers immediately
// https://github.com/facebook/react/issues/20074
var currentEvent = window.event;
var doc = ownerDocument(getRefTarget(ref)); // Use capture for this listener so it fires before React's listener, to

@@ -66,4 +69,20 @@ // avoid false positives in the contains() check below if the target DOM

var removeMouseCaptureListener = listen(doc, clickTrigger, handleMouseCapture, true);
var removeMouseListener = listen(doc, clickTrigger, handleMouse);
var removeKeyupListener = listen(doc, 'keyup', handleKeyUp);
var removeMouseListener = listen(doc, clickTrigger, function (e) {
// skip if this event is the same as the one running when we added the handlers
if (e === currentEvent) {
currentEvent = undefined;
return;
}
handleMouse(e);
});
var removeKeyupListener = listen(doc, 'keyup', function (e) {
// skip if this event is the same as the one running when we added the handlers
if (e === currentEvent) {
currentEvent = undefined;
return;
}
handleKeyUp(e);
});
var mobileSafariHackListeners = [];

@@ -70,0 +89,0 @@

{
"name": "react-overlays",
"version": "4.1.0",
"version": "4.1.1",
"description": "Utilities for creating robust overlay components",

@@ -16,2 +16,3 @@ "author": {

"module": "esm/index.js",
"sideEffects": false,
"keywords": [

@@ -47,7 +48,7 @@ "react-overlays",

"dependencies": {
"@babel/runtime": "^7.4.5",
"@popperjs/core": "^2.0.0",
"@restart/hooks": "^0.3.12",
"@babel/runtime": "^7.12.1",
"@popperjs/core": "^2.5.3",
"@restart/hooks": "^0.3.25",
"@types/warning": "^3.0.0",
"dom-helpers": "^5.1.0",
"dom-helpers": "^5.2.0",
"prop-types": "^15.7.2",

@@ -54,0 +55,0 @@ "uncontrollable": "^7.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc