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

@popperjs/core

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@popperjs/core - npm Package Compare versions

Comparing version 2.0.0-next.7 to 2.0.0-next.8

dist/cjs/utils/expandToHashMap.js.flow

241

dist/cjs/popper.js

@@ -207,3 +207,3 @@ 'use strict';

var inherited = function inherited(i) {
return mapped[i].requires ? mapped[i].requires.reduce(function (mem, i) {
return mapped[i] && mapped[i].requires ? mapped[i].requires.reduce(function (mem, i) {
return [].concat(mem, [i], inherited(i));

@@ -236,16 +236,8 @@ }, []) : [];

// Expands the eventListeners value to an object containing the
// `scroll` and `resize` booleans
//
// true => true, true
// false => false, false
// true, false => true, false
// false, false => false, false
var expandEventListeners = (function (eventListeners) {
var fallbackValue = typeof eventListeners === 'boolean' ? eventListeners : false;
return {
scroll: typeof eventListeners.scroll === 'boolean' ? eventListeners.scroll : fallbackValue,
resize: typeof eventListeners.resize === 'boolean' ? eventListeners.resize : fallbackValue
};
});
function expandToHashMap(value, keys) {
return keys.reduce(function (hashMap, key) {
hashMap[key] = value;
return hashMap;
}, {});
}

@@ -264,6 +256,2 @@ var getBasePlacement = (function (placement) {

var getAltAxis = (function (axis) {
return axis === 'x' ? 'y' : 'x';
});
var top = 'top';

@@ -334,15 +322,14 @@ var bottom = 'bottom';

var mainAxis = placement ? getMainAxisFromPlacement(placement) : null;
var altAxis = mainAxis ? getAltAxis(mainAxis) : null;
var len = altAxis === 'x' ? 'width' : 'height';
var axis = [right, left].includes(basePlacement) ? mainAxis : altAxis;
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
if (axis != null) {
if (mainAxis != null) {
var len = mainAxis === 'y' ? 'height' : 'width';
switch (variationPlacement) {
case start:
offsets[axis] -= element[len] / 2;
offsets[mainAxis] -= reference[len] / 2 - element[len] / 2;
break;
case end:
offsets[axis] += element[len] / 2;
offsets[mainAxis] += reference[len] / 2 - element[len] / 2;
break;

@@ -384,3 +371,3 @@

var ERROR_MESSAGE = 'PopperJS: modifier "%s" provided an invalid %s property, expected %s but got %s';
var ERROR_MESSAGE = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'onLoad', 'requires', 'options'];

@@ -449,7 +436,7 @@ var validateModifiers = (function (modifiers) {

function getClippingParent(element) {
function getClippingParent(element, offsetElement) {
var scrollParent = getScrollParent(element);
var offsetParent = getOffsetParent(element);
var offsetParent = offsetElement || getOffsetParent(element);
var win = getWindow(element);
return offsetParent === win ? element.ownerDocument.documentElement : scrollParent.contains(offsetParent) ? scrollParent : getClippingParent(getScrollParent(getParentNode(scrollParent)));
return offsetParent === win ? element.ownerDocument.documentElement : scrollParent.contains(offsetParent) ? scrollParent : getClippingParent(getScrollParent(getParentNode(scrollParent)), offsetParent);
}

@@ -487,3 +474,3 @@

if (!options.boundaryElement.contains(popperElement)) {
console.error('PopperJS: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.');
console.error('Popper: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.');
return state;

@@ -498,3 +485,3 @@ }

strategy: 'absolute',
placement: state.options.placement,
placement: state.placement,
scroll: {

@@ -522,3 +509,3 @@ scrollTop: 0,

// This modifier takes the Popper.js state and prepares some StyleSheet properties
// This modifier takes the Popper state and prepares some StyleSheet properties
// that can be applied to the popper element to make it render in the expected position.

@@ -574,3 +561,9 @@ var mapStrategyToPosition = function mapStrategyToPosition(strategy) {

function computeStyles(state, options) {
var gpuAcceleration = options && options.gpuAcceleration != null ? options.gpuAcceleration : true;
if (options === void 0) {
options = {};
}
var _options = options,
_options$gpuAccelerat = _options.gpuAcceleration,
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat;
state.styles = {}; // popper offsets are always available

@@ -682,17 +675,51 @@

var mergePaddingObject = (function (paddingObject) {
return _extends({
top: 0,
bottom: 0,
left: 0,
right: 0
}, paddingObject);
});
function flip(state, options) {
if (options === void 0) {
options = {};
}
var placement = state.placement;
var behavior = options && options.behavior ? options.behavior : [state.options.placement, getOppositePlacement(placement)];
var defaultBehavior = [state.options.placement, getOppositePlacement(state.options.placement)];
var _options = options,
_options$behavior = _options.behavior,
behavior = _options$behavior === void 0 ? defaultBehavior : _options$behavior,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var overflow = state.modifiersData.detectOverflow;
var flippedPlacement = behavior.find(function (newPlacement) {
return overflow[getBasePlacement(newPlacement)] <= 0;
});
var flipIndex = state.modifiersData.flip.index;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
var flippedPlacement = behavior[flipIndex];
if (flippedPlacement && flippedPlacement !== placement) {
state = _extends({}, state, {
placement: flippedPlacement,
reset: true
});
if (!flippedPlacement && placement !== state.options.placement) {
state.placement = state.options.placement;
state.reset = true;
return state;
}
if (!flippedPlacement && placement === state.options.placement) {
return state;
}
var basePlacement = getBasePlacement(flippedPlacement);
var fits = overflow[basePlacement] + paddingObject[basePlacement] <= 0;
if (!fits) {
state.modifiersData.flip.index += 1;
state.reset = true;
return state;
} else if (fits && state.placement !== flippedPlacement) {
state.placement = flippedPlacement;
state.reset = true;
return state;
}
return state;

@@ -704,5 +731,17 @@ }

phase: 'main',
fn: flip
fn: flip,
requires: ['detectOverflow'],
data: {
index: 0
}
};
var getAltAxis = (function (axis) {
return axis === 'x' ? 'y' : 'x';
});
var within = (function (min, value, max) {
return Math.max(min, Math.min(value, max));
});
function preventOverflow(state, options) {

@@ -717,3 +756,7 @@ if (options === void 0) {

_options$altAxis = _options.altAxis,
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis;
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
_options$tether = _options.tether,
tether = _options$tether === void 0 ? true : _options$tether,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var overflow = state.modifiersData.detectOverflow;

@@ -724,2 +767,5 @@ var basePlacement = getBasePlacement(state.placement);

var popperOffsets = state.offsets.popper;
var referenceRect = state.measures.reference;
var popperRect = state.measures.popper;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));

@@ -729,3 +775,9 @@ if (checkMainAxis) {

var altSide = mainAxis === 'y' ? bottom : right;
state.offsets.popper[mainAxis] = Math.max(Math.min(popperOffsets[mainAxis], popperOffsets[mainAxis] - overflow[altSide]), popperOffsets[mainAxis] + overflow[mainSide]);
var len = mainAxis === 'y' ? 'height' : 'width';
var offset = popperOffsets[mainAxis];
var min = popperOffsets[mainAxis] + overflow[mainSide] + paddingObject[mainSide];
var max = popperOffsets[mainAxis] - overflow[altSide] - paddingObject[altSide];
var tetherMin = state.offsets.popper[mainAxis] - referenceRect[len] / 2 + popperRect[len] / 2;
var tetherMax = state.offsets.popper[mainAxis] + referenceRect[len] / 2 - popperRect[len] / 2;
state.offsets.popper[mainAxis] = within(tether ? Math.min(tetherMin, min) : min, offset, tether ? Math.max(tetherMax, max) : max);
}

@@ -738,4 +790,3 @@

console.log(altAxis, _mainSide, overflow[_altSide]);
state.offsets.popper[altAxis] = Math.max(Math.min(popperOffsets[altAxis], popperOffsets[altAxis] - overflow[_altSide]), popperOffsets[altAxis] + overflow[_mainSide]);
state.offsets.popper[altAxis] = within(popperOffsets[altAxis] + overflow[_mainSide] + paddingObject[_mainSide], popperOffsets[altAxis], popperOffsets[altAxis] - overflow[_altSide] - paddingObject[_altSide]);
}

@@ -746,6 +797,7 @@

var preventOverflow$1 = {
name: 'flip',
name: 'preventOverflow',
enabled: true,
phase: 'main',
fn: preventOverflow
fn: preventOverflow,
requires: ['detectOverflow']
};

@@ -765,2 +817,3 @@

var defaultModifiers = Object.values(modifiers);
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';

@@ -816,7 +869,4 @@ var areValidElements = function areValidElements(a, b) {

this.state.options = _extends({}, defaultOptions, {}, options); // Cache the placement in cache to make it available to the modifiers
// modifiers will modify this one (rather than the one in options)
this.state.options = _extends({}, defaultOptions, {}, options); // Don't proceed if `reference` or `popper` are invalid elements
this.state.placement = this.state.options.placement; // Don't proceed if `reference` or `popper` are invalid elements
if (!areValidElements(referenceElement, popperElement)) {

@@ -869,2 +919,4 @@ return;

_proto.forceUpdate = function forceUpdate() {
var _this2 = this;
var _this$state$elements2 = this.state.elements,

@@ -890,32 +942,51 @@ referenceElement = _this$state$elements2.reference,

var offsetParentScroll = getElementScroll(getOffsetParent(popperElement)); // Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
this.state.offsets = {
popper: computeOffsets({
reference: this.state.measures.reference,
element: this.state.measures.popper,
strategy: 'absolute',
placement: this.state.placement,
scroll: getCommonTotalScroll(referenceElement, this.state.scrollParents.reference, this.state.scrollParents.popper)
})
}; // Modifiers have the ability to read the current Popper.js state, included
var offsetParentScroll = getElementScroll(getOffsetParent(popperElement)); // Modifiers have the ability to read the current Popper state, included
// the popper offsets, and modify it to address specifc cases
this.state.reset = false;
this.state.reset = false; // Cache the placement in cache to make it available to the modifiers
// modifiers will modify this one (rather than the one in options)
this.state.placement = this.state.options.placement;
this.state.orderedModifiers.forEach(function (modifier) {
return _this2.state.modifiersData[modifier.name] = _extends({}, modifier.data);
});
var __debug_loops__ = 0;
for (var index = 0; index < this.state.orderedModifiers.length; index++) {
var _this$state$orderedMo = this.state.orderedModifiers[index],
fn = _this$state$orderedMo.fn,
enabled = _this$state$orderedMo.enabled,
options = _this$state$orderedMo.options;
if (process.env.NODE_ENV !== "production") {
__debug_loops__ += 1;
if (__debug_loops__ > 100) {
console.error(INFINITE_LOOP_ERROR);
break;
}
}
if (index === 0) {
// Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
this.state.offsets = {
popper: computeOffsets({
reference: this.state.measures.reference,
element: this.state.measures.popper,
strategy: 'absolute',
placement: this.state.placement,
scroll: getCommonTotalScroll(referenceElement, this.state.scrollParents.reference, this.state.scrollParents.popper)
})
};
}
if (this.state.reset === true) {
this.state.reset = false;
index = 0;
index = -1;
continue;
}
var _this$state$orderedMo = this.state.orderedModifiers[index],
fn = _this$state$orderedMo.fn,
enabled = _this$state$orderedMo.enabled,
options = _this$state$orderedMo.options;
if (enabled && typeof fn === 'function') {

@@ -928,3 +999,3 @@ this.state = fn(this.state, options);

_proto.enableEventListeners = function enableEventListeners(eventListeners) {
var _this2 = this;
var _this3 = this;

@@ -935,5 +1006,5 @@ var _this$state$elements3 = this.state.elements,

var _expandEventListeners = expandEventListeners(eventListeners),
scroll = _expandEventListeners.scroll,
resize = _expandEventListeners.resize;
var _ref3 = typeof eventListeners === 'boolean' ? expandToHashMap(eventListeners, ['scroll', 'resize']) : eventListeners,
scroll = _ref3.scroll,
resize = _ref3.resize;

@@ -943,3 +1014,3 @@ if (scroll) {

scrollParents.forEach(function (scrollParent) {
return scrollParent.addEventListener('scroll', _this2.update, {
return scrollParent.addEventListener('scroll', _this3.update, {
passive: true

@@ -959,3 +1030,3 @@ });

_proto.destroy = function destroy() {
var _this3 = this;
var _this4 = this;

@@ -965,3 +1036,3 @@ // Remove scroll event listeners

scrollParents.forEach(function (scrollParent) {
return scrollParent.removeEventListener('scroll', _this3.update);
return scrollParent.removeEventListener('scroll', _this4.update);
}); // Remove resize event listeners

@@ -972,6 +1043,6 @@

this.state.orderedModifiers.forEach(function (_ref3) {
var onDestroy = _ref3.onDestroy,
enabled = _ref3.enabled;
return enabled && onDestroy && onDestroy(_this3.state);
this.state.orderedModifiers.forEach(function (_ref4) {
var onDestroy = _ref4.onDestroy,
enabled = _ref4.enabled;
return enabled && onDestroy && onDestroy(_this4.state);
});

@@ -978,0 +1049,0 @@ };

@@ -205,3 +205,3 @@ function _defineProperty(obj, key, value) {

var inherited = function inherited(i) {
return mapped[i].requires ? mapped[i].requires.reduce(function (mem, i) {
return mapped[i] && mapped[i].requires ? mapped[i].requires.reduce(function (mem, i) {
return [].concat(mem, [i], inherited(i));

@@ -234,16 +234,8 @@ }, []) : [];

// Expands the eventListeners value to an object containing the
// `scroll` and `resize` booleans
//
// true => true, true
// false => false, false
// true, false => true, false
// false, false => false, false
var expandEventListeners = (function (eventListeners) {
var fallbackValue = typeof eventListeners === 'boolean' ? eventListeners : false;
return {
scroll: typeof eventListeners.scroll === 'boolean' ? eventListeners.scroll : fallbackValue,
resize: typeof eventListeners.resize === 'boolean' ? eventListeners.resize : fallbackValue
};
});
function expandToHashMap(value, keys) {
return keys.reduce(function (hashMap, key) {
hashMap[key] = value;
return hashMap;
}, {});
}

@@ -262,6 +254,2 @@ var getBasePlacement = (function (placement) {

var getAltAxis = (function (axis) {
return axis === 'x' ? 'y' : 'x';
});
var top = 'top';

@@ -332,15 +320,14 @@ var bottom = 'bottom';

var mainAxis = placement ? getMainAxisFromPlacement(placement) : null;
var altAxis = mainAxis ? getAltAxis(mainAxis) : null;
var len = altAxis === 'x' ? 'width' : 'height';
var axis = [right, left].includes(basePlacement) ? mainAxis : altAxis;
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
if (axis != null) {
if (mainAxis != null) {
var len = mainAxis === 'y' ? 'height' : 'width';
switch (variationPlacement) {
case start:
offsets[axis] -= element[len] / 2;
offsets[mainAxis] -= reference[len] / 2 - element[len] / 2;
break;
case end:
offsets[axis] += element[len] / 2;
offsets[mainAxis] += reference[len] / 2 - element[len] / 2;
break;

@@ -382,3 +369,3 @@

var ERROR_MESSAGE = 'PopperJS: modifier "%s" provided an invalid %s property, expected %s but got %s';
var ERROR_MESSAGE = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'onLoad', 'requires', 'options'];

@@ -447,7 +434,7 @@ var validateModifiers = (function (modifiers) {

function getClippingParent(element) {
function getClippingParent(element, offsetElement) {
var scrollParent = getScrollParent(element);
var offsetParent = getOffsetParent(element);
var offsetParent = offsetElement || getOffsetParent(element);
var win = getWindow(element);
return offsetParent === win ? element.ownerDocument.documentElement : scrollParent.contains(offsetParent) ? scrollParent : getClippingParent(getScrollParent(getParentNode(scrollParent)));
return offsetParent === win ? element.ownerDocument.documentElement : scrollParent.contains(offsetParent) ? scrollParent : getClippingParent(getScrollParent(getParentNode(scrollParent)), offsetParent);
}

@@ -485,3 +472,3 @@

if (!options.boundaryElement.contains(popperElement)) {
console.error('PopperJS: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.');
console.error('Popper: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.');
return state;

@@ -496,3 +483,3 @@ }

strategy: 'absolute',
placement: state.options.placement,
placement: state.placement,
scroll: {

@@ -520,3 +507,3 @@ scrollTop: 0,

// This modifier takes the Popper.js state and prepares some StyleSheet properties
// This modifier takes the Popper state and prepares some StyleSheet properties
// that can be applied to the popper element to make it render in the expected position.

@@ -572,3 +559,9 @@ var mapStrategyToPosition = function mapStrategyToPosition(strategy) {

function computeStyles(state, options) {
var gpuAcceleration = options && options.gpuAcceleration != null ? options.gpuAcceleration : true;
if (options === void 0) {
options = {};
}
var _options = options,
_options$gpuAccelerat = _options.gpuAcceleration,
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat;
state.styles = {}; // popper offsets are always available

@@ -680,17 +673,51 @@

var mergePaddingObject = (function (paddingObject) {
return _extends({
top: 0,
bottom: 0,
left: 0,
right: 0
}, paddingObject);
});
function flip(state, options) {
if (options === void 0) {
options = {};
}
var placement = state.placement;
var behavior = options && options.behavior ? options.behavior : [state.options.placement, getOppositePlacement(placement)];
var defaultBehavior = [state.options.placement, getOppositePlacement(state.options.placement)];
var _options = options,
_options$behavior = _options.behavior,
behavior = _options$behavior === void 0 ? defaultBehavior : _options$behavior,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var overflow = state.modifiersData.detectOverflow;
var flippedPlacement = behavior.find(function (newPlacement) {
return overflow[getBasePlacement(newPlacement)] <= 0;
});
var flipIndex = state.modifiersData.flip.index;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
var flippedPlacement = behavior[flipIndex];
if (flippedPlacement && flippedPlacement !== placement) {
state = _extends({}, state, {
placement: flippedPlacement,
reset: true
});
if (!flippedPlacement && placement !== state.options.placement) {
state.placement = state.options.placement;
state.reset = true;
return state;
}
if (!flippedPlacement && placement === state.options.placement) {
return state;
}
var basePlacement = getBasePlacement(flippedPlacement);
var fits = overflow[basePlacement] + paddingObject[basePlacement] <= 0;
if (!fits) {
state.modifiersData.flip.index += 1;
state.reset = true;
return state;
} else if (fits && state.placement !== flippedPlacement) {
state.placement = flippedPlacement;
state.reset = true;
return state;
}
return state;

@@ -702,5 +729,17 @@ }

phase: 'main',
fn: flip
fn: flip,
requires: ['detectOverflow'],
data: {
index: 0
}
};
var getAltAxis = (function (axis) {
return axis === 'x' ? 'y' : 'x';
});
var within = (function (min, value, max) {
return Math.max(min, Math.min(value, max));
});
function preventOverflow(state, options) {

@@ -715,3 +754,7 @@ if (options === void 0) {

_options$altAxis = _options.altAxis,
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis;
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
_options$tether = _options.tether,
tether = _options$tether === void 0 ? true : _options$tether,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var overflow = state.modifiersData.detectOverflow;

@@ -722,2 +765,5 @@ var basePlacement = getBasePlacement(state.placement);

var popperOffsets = state.offsets.popper;
var referenceRect = state.measures.reference;
var popperRect = state.measures.popper;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));

@@ -727,3 +773,9 @@ if (checkMainAxis) {

var altSide = mainAxis === 'y' ? bottom : right;
state.offsets.popper[mainAxis] = Math.max(Math.min(popperOffsets[mainAxis], popperOffsets[mainAxis] - overflow[altSide]), popperOffsets[mainAxis] + overflow[mainSide]);
var len = mainAxis === 'y' ? 'height' : 'width';
var offset = popperOffsets[mainAxis];
var min = popperOffsets[mainAxis] + overflow[mainSide] + paddingObject[mainSide];
var max = popperOffsets[mainAxis] - overflow[altSide] - paddingObject[altSide];
var tetherMin = state.offsets.popper[mainAxis] - referenceRect[len] / 2 + popperRect[len] / 2;
var tetherMax = state.offsets.popper[mainAxis] + referenceRect[len] / 2 - popperRect[len] / 2;
state.offsets.popper[mainAxis] = within(tether ? Math.min(tetherMin, min) : min, offset, tether ? Math.max(tetherMax, max) : max);
}

@@ -736,4 +788,3 @@

console.log(altAxis, _mainSide, overflow[_altSide]);
state.offsets.popper[altAxis] = Math.max(Math.min(popperOffsets[altAxis], popperOffsets[altAxis] - overflow[_altSide]), popperOffsets[altAxis] + overflow[_mainSide]);
state.offsets.popper[altAxis] = within(popperOffsets[altAxis] + overflow[_mainSide] + paddingObject[_mainSide], popperOffsets[altAxis], popperOffsets[altAxis] - overflow[_altSide] - paddingObject[_altSide]);
}

@@ -744,6 +795,7 @@

var preventOverflow$1 = {
name: 'flip',
name: 'preventOverflow',
enabled: true,
phase: 'main',
fn: preventOverflow
fn: preventOverflow,
requires: ['detectOverflow']
};

@@ -763,2 +815,3 @@

var defaultModifiers = Object.values(modifiers);
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';

@@ -814,7 +867,4 @@ var areValidElements = function areValidElements(a, b) {

this.state.options = _extends({}, defaultOptions, {}, options); // Cache the placement in cache to make it available to the modifiers
// modifiers will modify this one (rather than the one in options)
this.state.options = _extends({}, defaultOptions, {}, options); // Don't proceed if `reference` or `popper` are invalid elements
this.state.placement = this.state.options.placement; // Don't proceed if `reference` or `popper` are invalid elements
if (!areValidElements(referenceElement, popperElement)) {

@@ -867,2 +917,4 @@ return;

_proto.forceUpdate = function forceUpdate() {
var _this2 = this;
var _this$state$elements2 = this.state.elements,

@@ -888,32 +940,51 @@ referenceElement = _this$state$elements2.reference,

var offsetParentScroll = getElementScroll(getOffsetParent(popperElement)); // Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
this.state.offsets = {
popper: computeOffsets({
reference: this.state.measures.reference,
element: this.state.measures.popper,
strategy: 'absolute',
placement: this.state.placement,
scroll: getCommonTotalScroll(referenceElement, this.state.scrollParents.reference, this.state.scrollParents.popper)
})
}; // Modifiers have the ability to read the current Popper.js state, included
var offsetParentScroll = getElementScroll(getOffsetParent(popperElement)); // Modifiers have the ability to read the current Popper state, included
// the popper offsets, and modify it to address specifc cases
this.state.reset = false;
this.state.reset = false; // Cache the placement in cache to make it available to the modifiers
// modifiers will modify this one (rather than the one in options)
this.state.placement = this.state.options.placement;
this.state.orderedModifiers.forEach(function (modifier) {
return _this2.state.modifiersData[modifier.name] = _extends({}, modifier.data);
});
var __debug_loops__ = 0;
for (var index = 0; index < this.state.orderedModifiers.length; index++) {
var _this$state$orderedMo = this.state.orderedModifiers[index],
fn = _this$state$orderedMo.fn,
enabled = _this$state$orderedMo.enabled,
options = _this$state$orderedMo.options;
if (process.env.NODE_ENV !== "production") {
__debug_loops__ += 1;
if (__debug_loops__ > 100) {
console.error(INFINITE_LOOP_ERROR);
break;
}
}
if (index === 0) {
// Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
this.state.offsets = {
popper: computeOffsets({
reference: this.state.measures.reference,
element: this.state.measures.popper,
strategy: 'absolute',
placement: this.state.placement,
scroll: getCommonTotalScroll(referenceElement, this.state.scrollParents.reference, this.state.scrollParents.popper)
})
};
}
if (this.state.reset === true) {
this.state.reset = false;
index = 0;
index = -1;
continue;
}
var _this$state$orderedMo = this.state.orderedModifiers[index],
fn = _this$state$orderedMo.fn,
enabled = _this$state$orderedMo.enabled,
options = _this$state$orderedMo.options;
if (enabled && typeof fn === 'function') {

@@ -926,3 +997,3 @@ this.state = fn(this.state, options);

_proto.enableEventListeners = function enableEventListeners(eventListeners) {
var _this2 = this;
var _this3 = this;

@@ -933,5 +1004,5 @@ var _this$state$elements3 = this.state.elements,

var _expandEventListeners = expandEventListeners(eventListeners),
scroll = _expandEventListeners.scroll,
resize = _expandEventListeners.resize;
var _ref3 = typeof eventListeners === 'boolean' ? expandToHashMap(eventListeners, ['scroll', 'resize']) : eventListeners,
scroll = _ref3.scroll,
resize = _ref3.resize;

@@ -941,3 +1012,3 @@ if (scroll) {

scrollParents.forEach(function (scrollParent) {
return scrollParent.addEventListener('scroll', _this2.update, {
return scrollParent.addEventListener('scroll', _this3.update, {
passive: true

@@ -957,3 +1028,3 @@ });

_proto.destroy = function destroy() {
var _this3 = this;
var _this4 = this;

@@ -963,3 +1034,3 @@ // Remove scroll event listeners

scrollParents.forEach(function (scrollParent) {
return scrollParent.removeEventListener('scroll', _this3.update);
return scrollParent.removeEventListener('scroll', _this4.update);
}); // Remove resize event listeners

@@ -970,6 +1041,6 @@

this.state.orderedModifiers.forEach(function (_ref3) {
var onDestroy = _ref3.onDestroy,
enabled = _ref3.enabled;
return enabled && onDestroy && onDestroy(_this3.state);
this.state.orderedModifiers.forEach(function (_ref4) {
var onDestroy = _ref4.onDestroy,
enabled = _ref4.enabled;
return enabled && onDestroy && onDestroy(_this4.state);
});

@@ -976,0 +1047,0 @@ };

@@ -211,3 +211,3 @@ (function (global, factory) {

var inherited = function inherited(i) {
return mapped[i].requires ? mapped[i].requires.reduce(function (mem, i) {
return mapped[i] && mapped[i].requires ? mapped[i].requires.reduce(function (mem, i) {
return [].concat(mem, [i], inherited(i));

@@ -240,16 +240,8 @@ }, []) : [];

// Expands the eventListeners value to an object containing the
// `scroll` and `resize` booleans
//
// true => true, true
// false => false, false
// true, false => true, false
// false, false => false, false
var expandEventListeners = (function (eventListeners) {
var fallbackValue = typeof eventListeners === 'boolean' ? eventListeners : false;
return {
scroll: typeof eventListeners.scroll === 'boolean' ? eventListeners.scroll : fallbackValue,
resize: typeof eventListeners.resize === 'boolean' ? eventListeners.resize : fallbackValue
};
});
function expandToHashMap(value, keys) {
return keys.reduce(function (hashMap, key) {
hashMap[key] = value;
return hashMap;
}, {});
}

@@ -268,6 +260,2 @@ var getBasePlacement = (function (placement) {

var getAltAxis = (function (axis) {
return axis === 'x' ? 'y' : 'x';
});
var top = 'top';

@@ -338,15 +326,14 @@ var bottom = 'bottom';

var mainAxis = placement ? getMainAxisFromPlacement(placement) : null;
var altAxis = mainAxis ? getAltAxis(mainAxis) : null;
var len = altAxis === 'x' ? 'width' : 'height';
var axis = [right, left].includes(basePlacement) ? mainAxis : altAxis;
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
if (axis != null) {
if (mainAxis != null) {
var len = mainAxis === 'y' ? 'height' : 'width';
switch (variationPlacement) {
case start:
offsets[axis] -= element[len] / 2;
offsets[mainAxis] -= reference[len] / 2 - element[len] / 2;
break;
case end:
offsets[axis] += element[len] / 2;
offsets[mainAxis] += reference[len] / 2 - element[len] / 2;
break;

@@ -388,3 +375,3 @@

var ERROR_MESSAGE = 'PopperJS: modifier "%s" provided an invalid %s property, expected %s but got %s';
var ERROR_MESSAGE = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'onLoad', 'requires', 'options'];

@@ -453,7 +440,7 @@ var validateModifiers = (function (modifiers) {

function getClippingParent(element) {
function getClippingParent(element, offsetElement) {
var scrollParent = getScrollParent(element);
var offsetParent = getOffsetParent(element);
var offsetParent = offsetElement || getOffsetParent(element);
var win = getWindow(element);
return offsetParent === win ? element.ownerDocument.documentElement : scrollParent.contains(offsetParent) ? scrollParent : getClippingParent(getScrollParent(getParentNode(scrollParent)));
return offsetParent === win ? element.ownerDocument.documentElement : scrollParent.contains(offsetParent) ? scrollParent : getClippingParent(getScrollParent(getParentNode(scrollParent)), offsetParent);
}

@@ -491,3 +478,3 @@

if (!options.boundaryElement.contains(popperElement)) {
console.error('PopperJS: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.');
console.error('Popper: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.');
return state;

@@ -502,3 +489,3 @@ }

strategy: 'absolute',
placement: state.options.placement,
placement: state.placement,
scroll: {

@@ -526,3 +513,3 @@ scrollTop: 0,

// This modifier takes the Popper.js state and prepares some StyleSheet properties
// This modifier takes the Popper state and prepares some StyleSheet properties
// that can be applied to the popper element to make it render in the expected position.

@@ -578,3 +565,9 @@ var mapStrategyToPosition = function mapStrategyToPosition(strategy) {

function computeStyles(state, options) {
var gpuAcceleration = options && options.gpuAcceleration != null ? options.gpuAcceleration : true;
if (options === void 0) {
options = {};
}
var _options = options,
_options$gpuAccelerat = _options.gpuAcceleration,
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat;
state.styles = {}; // popper offsets are always available

@@ -686,17 +679,51 @@

var mergePaddingObject = (function (paddingObject) {
return _extends({
top: 0,
bottom: 0,
left: 0,
right: 0
}, paddingObject);
});
function flip(state, options) {
if (options === void 0) {
options = {};
}
var placement = state.placement;
var behavior = options && options.behavior ? options.behavior : [state.options.placement, getOppositePlacement(placement)];
var defaultBehavior = [state.options.placement, getOppositePlacement(state.options.placement)];
var _options = options,
_options$behavior = _options.behavior,
behavior = _options$behavior === void 0 ? defaultBehavior : _options$behavior,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var overflow = state.modifiersData.detectOverflow;
var flippedPlacement = behavior.find(function (newPlacement) {
return overflow[getBasePlacement(newPlacement)] <= 0;
});
var flipIndex = state.modifiersData.flip.index;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
var flippedPlacement = behavior[flipIndex];
if (flippedPlacement && flippedPlacement !== placement) {
state = _extends({}, state, {
placement: flippedPlacement,
reset: true
});
if (!flippedPlacement && placement !== state.options.placement) {
state.placement = state.options.placement;
state.reset = true;
return state;
}
if (!flippedPlacement && placement === state.options.placement) {
return state;
}
var basePlacement = getBasePlacement(flippedPlacement);
var fits = overflow[basePlacement] + paddingObject[basePlacement] <= 0;
if (!fits) {
state.modifiersData.flip.index += 1;
state.reset = true;
return state;
} else if (fits && state.placement !== flippedPlacement) {
state.placement = flippedPlacement;
state.reset = true;
return state;
}
return state;

@@ -708,5 +735,17 @@ }

phase: 'main',
fn: flip
fn: flip,
requires: ['detectOverflow'],
data: {
index: 0
}
};
var getAltAxis = (function (axis) {
return axis === 'x' ? 'y' : 'x';
});
var within = (function (min, value, max) {
return Math.max(min, Math.min(value, max));
});
function preventOverflow(state, options) {

@@ -721,3 +760,7 @@ if (options === void 0) {

_options$altAxis = _options.altAxis,
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis;
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
_options$tether = _options.tether,
tether = _options$tether === void 0 ? true : _options$tether,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var overflow = state.modifiersData.detectOverflow;

@@ -728,2 +771,5 @@ var basePlacement = getBasePlacement(state.placement);

var popperOffsets = state.offsets.popper;
var referenceRect = state.measures.reference;
var popperRect = state.measures.popper;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));

@@ -733,3 +779,9 @@ if (checkMainAxis) {

var altSide = mainAxis === 'y' ? bottom : right;
state.offsets.popper[mainAxis] = Math.max(Math.min(popperOffsets[mainAxis], popperOffsets[mainAxis] - overflow[altSide]), popperOffsets[mainAxis] + overflow[mainSide]);
var len = mainAxis === 'y' ? 'height' : 'width';
var offset = popperOffsets[mainAxis];
var min = popperOffsets[mainAxis] + overflow[mainSide] + paddingObject[mainSide];
var max = popperOffsets[mainAxis] - overflow[altSide] - paddingObject[altSide];
var tetherMin = state.offsets.popper[mainAxis] - referenceRect[len] / 2 + popperRect[len] / 2;
var tetherMax = state.offsets.popper[mainAxis] + referenceRect[len] / 2 - popperRect[len] / 2;
state.offsets.popper[mainAxis] = within(tether ? Math.min(tetherMin, min) : min, offset, tether ? Math.max(tetherMax, max) : max);
}

@@ -742,4 +794,3 @@

console.log(altAxis, _mainSide, overflow[_altSide]);
state.offsets.popper[altAxis] = Math.max(Math.min(popperOffsets[altAxis], popperOffsets[altAxis] - overflow[_altSide]), popperOffsets[altAxis] + overflow[_mainSide]);
state.offsets.popper[altAxis] = within(popperOffsets[altAxis] + overflow[_mainSide] + paddingObject[_mainSide], popperOffsets[altAxis], popperOffsets[altAxis] - overflow[_altSide] - paddingObject[_altSide]);
}

@@ -750,6 +801,7 @@

var preventOverflow$1 = {
name: 'flip',
name: 'preventOverflow',
enabled: true,
phase: 'main',
fn: preventOverflow
fn: preventOverflow,
requires: ['detectOverflow']
};

@@ -769,2 +821,3 @@

var defaultModifiers = Object.values(modifiers);
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';

@@ -820,7 +873,4 @@ var areValidElements = function areValidElements(a, b) {

this.state.options = _extends({}, defaultOptions, {}, options); // Cache the placement in cache to make it available to the modifiers
// modifiers will modify this one (rather than the one in options)
this.state.options = _extends({}, defaultOptions, {}, options); // Don't proceed if `reference` or `popper` are invalid elements
this.state.placement = this.state.options.placement; // Don't proceed if `reference` or `popper` are invalid elements
if (!areValidElements(referenceElement, popperElement)) {

@@ -873,2 +923,4 @@ return;

_proto.forceUpdate = function forceUpdate() {
var _this2 = this;
var _this$state$elements2 = this.state.elements,

@@ -894,32 +946,51 @@ referenceElement = _this$state$elements2.reference,

var offsetParentScroll = getElementScroll(getOffsetParent(popperElement)); // Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
this.state.offsets = {
popper: computeOffsets({
reference: this.state.measures.reference,
element: this.state.measures.popper,
strategy: 'absolute',
placement: this.state.placement,
scroll: getCommonTotalScroll(referenceElement, this.state.scrollParents.reference, this.state.scrollParents.popper)
})
}; // Modifiers have the ability to read the current Popper.js state, included
var offsetParentScroll = getElementScroll(getOffsetParent(popperElement)); // Modifiers have the ability to read the current Popper state, included
// the popper offsets, and modify it to address specifc cases
this.state.reset = false;
this.state.reset = false; // Cache the placement in cache to make it available to the modifiers
// modifiers will modify this one (rather than the one in options)
this.state.placement = this.state.options.placement;
this.state.orderedModifiers.forEach(function (modifier) {
return _this2.state.modifiersData[modifier.name] = _extends({}, modifier.data);
});
var __debug_loops__ = 0;
for (var index = 0; index < this.state.orderedModifiers.length; index++) {
var _this$state$orderedMo = this.state.orderedModifiers[index],
fn = _this$state$orderedMo.fn,
enabled = _this$state$orderedMo.enabled,
options = _this$state$orderedMo.options;
{
__debug_loops__ += 1;
if (__debug_loops__ > 100) {
console.error(INFINITE_LOOP_ERROR);
break;
}
}
if (index === 0) {
// Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
this.state.offsets = {
popper: computeOffsets({
reference: this.state.measures.reference,
element: this.state.measures.popper,
strategy: 'absolute',
placement: this.state.placement,
scroll: getCommonTotalScroll(referenceElement, this.state.scrollParents.reference, this.state.scrollParents.popper)
})
};
}
if (this.state.reset === true) {
this.state.reset = false;
index = 0;
index = -1;
continue;
}
var _this$state$orderedMo = this.state.orderedModifiers[index],
fn = _this$state$orderedMo.fn,
enabled = _this$state$orderedMo.enabled,
options = _this$state$orderedMo.options;
if (enabled && typeof fn === 'function') {

@@ -932,3 +1003,3 @@ this.state = fn(this.state, options);

_proto.enableEventListeners = function enableEventListeners(eventListeners) {
var _this2 = this;
var _this3 = this;

@@ -939,5 +1010,5 @@ var _this$state$elements3 = this.state.elements,

var _expandEventListeners = expandEventListeners(eventListeners),
scroll = _expandEventListeners.scroll,
resize = _expandEventListeners.resize;
var _ref3 = typeof eventListeners === 'boolean' ? expandToHashMap(eventListeners, ['scroll', 'resize']) : eventListeners,
scroll = _ref3.scroll,
resize = _ref3.resize;

@@ -947,3 +1018,3 @@ if (scroll) {

scrollParents.forEach(function (scrollParent) {
return scrollParent.addEventListener('scroll', _this2.update, {
return scrollParent.addEventListener('scroll', _this3.update, {
passive: true

@@ -963,3 +1034,3 @@ });

_proto.destroy = function destroy() {
var _this3 = this;
var _this4 = this;

@@ -969,3 +1040,3 @@ // Remove scroll event listeners

scrollParents.forEach(function (scrollParent) {
return scrollParent.removeEventListener('scroll', _this3.update);
return scrollParent.removeEventListener('scroll', _this4.update);
}); // Remove resize event listeners

@@ -976,6 +1047,6 @@

this.state.orderedModifiers.forEach(function (_ref3) {
var onDestroy = _ref3.onDestroy,
enabled = _ref3.enabled;
return enabled && onDestroy && onDestroy(_this3.state);
this.state.orderedModifiers.forEach(function (_ref4) {
var onDestroy = _ref4.onDestroy,
enabled = _ref4.enabled;
return enabled && onDestroy && onDestroy(_this4.state);
});

@@ -982,0 +1053,0 @@ };

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Popper=t()}(this,function(){"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function n(e){var t=e.ownerDocument;return t?t.defaultView:window}function r(e){return n(e).getComputedStyle(e)}var o=function(e){var t=e.offsetWidth,n=e.offsetHeight,o=e.offsetTop,s=e.offsetLeft,i=function(e){var t=r(e);return{top:parseFloat(t.marginTop)||0,right:parseFloat(t.marginRight)||0,bottom:parseFloat(t.marginBottom)||0,left:parseFloat(t.marginLeft)||0}}(e);return{width:t+i.left+i.right,height:n+i.top+i.bottom,y:o-i.top,x:s-i.left}},s=function(e){return e?e.nodeName.toUpperCase():null},i=function(e){return"HTML"===s(e)?e:e.parentNode||e.host||document.ownerDocument||document.documentElement};function a(e){if(!e)return document.body;if(["HTML","BODY","#document"].includes(e.nodeName.toUpperCase()))return e.ownerDocument.body;if(e instanceof HTMLElement){var t=r(e),n=t.overflow,o=t.overflowX,s=t.overflowY;if(/(auto|scroll|overlay)/.test(n+s+o))return e}return a(i(e))}function f(e,t){void 0===t&&(t=[]);var n=a(e),r="BODY"===s(n),o=r?n.ownerDocument.defaultView:n,c=t.concat(o);return r?c:c.concat(f(i(o)))}function c(e){return e!==n(e)&&e instanceof HTMLElement?{scrollLeft:(t=e).scrollLeft,scrollTop:t.scrollTop}:function(e){var t=n(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}(e);var t}function l(e){var t=e instanceof HTMLElement?e.offsetParent:null,r=n(e);return"BODY"===s(t)?r:t||r}var u=function(e){return e.reduce(function(e,t){var n=c(t);return e.scrollTop+=n.scrollTop,e.scrollLeft+=n.scrollLeft,e},{scrollTop:0,scrollLeft:0})};function p(e,t,n,r){t.filter(function(e){return!n.includes(e)});var o=l(e),s=t.findIndex(function(e){return e===(r||o)}),i=t.slice(0,-1===s?void 0:s);return u(i)}var d=function(e){return e&&e.jquery?e[0]:e},m=function(e){var t=e.reduce(function(e,t){return e[t.name]=t,e},{});return e.sort(function(e,n){return~function e(n){return t[n].requires?t[n].requires.reduce(function(t,n){return[].concat(t,[n],e(n))},[]):[]}(n.name).indexOf(e.name)?-1:1})},h=function(e){return[].concat(m(e.filter(function(e){return"read"===e.phase})),m(e.filter(function(e){return"main"===e.phase})),m(e.filter(function(e){return"afterMain"===e.phase})),m(e.filter(function(e){return"write"===e.phase})))},v=function(e){return e.split("-")[0]},y=function(e){return["top","bottom"].includes(e)?"x":"y"},b=function(e){return"x"===e?"y":"x"},g="top",w="bottom",x="right",O="left",E=([g,w,x,O].reduce(function(e,t){return e.concat([t,t+"-start",t+"-end"])},[]),function(e){var t,n=e.reference,r=e.element,o=(e.strategy,e.placement),s=e.scroll,i=o?v(o):null,a=o?function(e){return e.split("-")[1]}(o):null,f=s.scrollTop,c=s.scrollLeft;switch(i){case g:t={x:n.x+n.width/2-r.width/2-c,y:n.y-r.height-f};break;case w:t={x:n.x+n.width/2-r.width/2-c,y:n.y+n.height-f};break;case x:t={x:n.x+n.width-c,y:n.y+n.height/2-r.height/2-f};break;case O:t={x:n.x-r.width-c,y:n.y+n.height/2-r.height/2-f};break;default:t={x:n.x-c,y:n.y-f}}var l=o?y(o):null,u=l?b(l):null,p="x"===u?"width":"height",d=[x,O].includes(i)?l:u;if(null!=d)switch(a){case"start":t[d]-=r[p]/2;break;case"end":t[d]+=r[p]/2}return t});var L=function(e){return JSON.parse(JSON.stringify(e.getBoundingClientRect()))};function M(e){var t=a(e),r=l(e);return r===n(e)?e.ownerDocument.documentElement:t.contains(r)?t:M(a(i(t)))}var P=function(e){var t=n(e),r=o(e.ownerDocument.documentElement);return r.height=Math.max(r.height,t.innerHeight),r.width=Math.max(r.width,t.innerWidth),r},D=function(e){return t({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})};var T={name:"detectOverflow",enabled:!0,phase:"read",fn:function(e,n){void 0===n&&(n={boundaryElement:M(e.elements.popper)});var r=e.elements.popper,o=e.elements.reference,s=e.measures.popper,i=n.boundaryElement.ownerDocument.documentElement;if(!n.boundaryElement.contains(r))return console.error('PopperJS: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.'),e;var a=i===n.boundaryElement?D(P(i)):L(n.boundaryElement),f=L(o),c=E({reference:f,element:s,strategy:"absolute",placement:e.options.placement,scroll:{scrollTop:0,scrollLeft:0}}),l=D(t({},s,{},c));return e.modifiersData.detectOverflow={top:a.top-l.top,bottom:l.bottom-a.bottom,left:a.left-l.left,right:l.right-a.right},e},data:{}},j=function(e){switch(e){case"fixed":return"fixed";case"absolute":default:return"absolute"}},S=function(e){var t=e.offsets,n=e.strategy;return!1===e.gpuAcceleration?{top:t.y+"px",left:t.x+"px",position:j(n)}:{top:"0px",left:"0px",transform:"translate3d("+t.x+"px, "+t.y+"px, 0)",position:j(n)}},k=function(e){var t=e.offsets;return e.gpuAcceleration?{top:t.y+"px",left:t.x+"px",position:"absolute"}:{transform:"translate3d("+t.x+"px, "+t.y+"px, 0)",position:"absolute"}};var z={name:"computeStyles",enabled:!0,phase:"afterMain",fn:function(e,t){var n=!t||null==t.gpuAcceleration||t.gpuAcceleration;return e.styles={},e.styles.popper=S({offsets:e.offsets.popper,strategy:e.options.strategy,gpuAcceleration:n}),null!=e.offsets.arrow&&(e.styles.arrow=k({offsets:e.offsets.arrow,gpuAcceleration:n})),e}};var A={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){return Object.keys(e.elements).forEach(function(t){var n=e.styles.hasOwnProperty(t)?e.styles[t]:{};Object.assign(e.elements[t].style,n)}),e},onDestroy:function(e){Object.keys(e.elements).forEach(function(n){var r=Object.keys(e.styles.hasOwnProperty(n)?t({},e.styles[n]):{}).reduce(function(e,n){var r;return t({},e,((r={})[String(n)]="",r))},{});Object.assign(e.elements[n].style,r)})},requires:["computeStyles"]};var H={name:"offset",enabled:!0,phase:"main",fn:function(e,n){if(n&&"function"==typeof n.offset){var r=(i=e.placement,a=e.measures,f=n.offset,c=v(i),l=["left","top"].includes(c)?-1:1,u=["top","bottom"].includes(c)?-1:1,p=f(t({},a,{placement:i})),d=p[0],m=p[1],m=((d=(d||0)*l)||0)*u,["left","right"].includes(c)?[d,m]:[m,d]),o=r[0],s=r[1];e.offsets.popper.x+=o,e.offsets.popper.y+=s}var i,a,f,c,l,u,p,d,m;return e}},B={left:"right",right:"left",bottom:"top",top:"bottom"},N=function(e){return e.replace(/left|right|bottom|top/g,function(e){return B[e]})};var Y={name:"flip",enabled:!0,phase:"main",fn:function(e,n){var r=e.placement,o=n&&n.behavior?n.behavior:[e.options.placement,N(r)],s=e.modifiersData.detectOverflow,i=o.find(function(e){return s[v(e)]<=0});return i&&i!==r&&(e=t({},e,{placement:i,reset:!0})),e}};var q={name:"flip",enabled:!0,phase:"main",fn:function(e,t){void 0===t&&(t={});var n=t,r=n.mainAxis,o=void 0===r||r,s=n.altAxis,i=void 0!==s&&s,a=e.modifiersData.detectOverflow,f=v(e.placement),c=y(f),l=b(c),u=e.offsets.popper;if(o){var p="y"===c?g:O,d="y"===c?w:x;e.offsets.popper[c]=Math.max(Math.min(u[c],u[c]-a[d]),u[c]+a[p])}if(i){var m="x"===c?g:O,h="x"===c?w:x;console.log(l,m,a[h]),e.offsets.popper[l]=Math.max(Math.min(u[l],u[l]-a[h]),u[l]+a[m])}return e}},C=Object.freeze({detectOverflow:T,computeStyles:z,applyStyles:A,offset:H,flip:Y,preventOverflow:q}),F=Object.values(C),U=function(e,t){return e instanceof Element&&t instanceof Element},J={placement:"bottom",eventListeners:{scroll:!0,resize:!0},modifiers:[],strategy:"absolute"};return function(){function r(n,r,o){var s,i,a=this;void 0===o&&(o=J),e(this,"state",{placement:"bottom",orderedModifiers:[],options:J,modifiersData:{}}),e(this,"update",(s=function(){return new Promise(function(e,t){a.forceUpdate(),e(a.state)})},i=!1,function(){return new Promise(function(e){if(i)return e();i=!0,Promise.resolve().then(function(){i=!1,e(s())})})})),this.state.elements={reference:d(n),popper:d(r)};var c=this.state.elements,l=c.reference,u=c.popper;this.state.options=t({},J,{},o),this.state.placement=this.state.options.placement,U(l,u)&&(this.state.scrollParents={reference:f(l),popper:f(u)},this.state.orderedModifiers=h([].concat(F,this.state.options.modifiers)).map(function(e){return t({},e,{},a.state.options.modifiers.find(function(t){return t.name===e.name}))}),this.state.orderedModifiers.forEach(function(e){var t=e.onLoad;return e.enabled&&t&&t(a.state)}),this.update().then(function(){a.enableEventListeners(a.state.options.eventListeners)}))}var s=r.prototype;return s.forceUpdate=function(){var e=this.state.elements,t=e.reference,n=e.popper;if(U(t,n)){this.state.measures={reference:o(t),popper:o(n)};c(l(n));this.state.offsets={popper:E({reference:this.state.measures.reference,element:this.state.measures.popper,strategy:"absolute",placement:this.state.placement,scroll:p(t,this.state.scrollParents.reference,this.state.scrollParents.popper)})},this.state.reset=!1;for(var r=0;r<this.state.orderedModifiers.length;r++){var s=this.state.orderedModifiers[r],i=s.fn,a=s.enabled,f=s.options;!0!==this.state.reset?a&&"function"==typeof i&&(this.state=i(this.state,f)):(this.state.reset=!1,r=0)}}},s.enableEventListeners=function(e){var t=this,r=this.state.elements,o=(r.reference,r.popper,function(e){var t="boolean"==typeof e&&e;return{scroll:"boolean"==typeof e.scroll?e.scroll:t,resize:"boolean"==typeof e.resize?e.resize:t}}(e)),s=o.scroll,i=o.resize;s&&[].concat(this.state.scrollParents.reference,this.state.scrollParents.popper).forEach(function(e){return e.addEventListener("scroll",t.update,{passive:!0})});i&&n(this.state.elements.popper).addEventListener("resize",this.update,{passive:!0})},s.destroy=function(){var e=this;[].concat(this.state.scrollParents.reference,this.state.scrollParents.popper).forEach(function(t){return t.removeEventListener("scroll",e.update)}),n(this.state.elements.popper).removeEventListener("resize",this.update),this.state.orderedModifiers.forEach(function(t){var n=t.onDestroy;return t.enabled&&n&&n(e.state)})},r}()});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Popper=t()}(this,function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function r(e){var t=e.ownerDocument;return t?t.defaultView:window}function n(e){return r(e).getComputedStyle(e)}var o=function(e){var t=e.offsetWidth,r=e.offsetHeight,o=e.offsetTop,s=e.offsetLeft,i=function(e){var t=n(e);return{top:parseFloat(t.marginTop)||0,right:parseFloat(t.marginRight)||0,bottom:parseFloat(t.marginBottom)||0,left:parseFloat(t.marginLeft)||0}}(e);return{width:t+i.left+i.right,height:r+i.top+i.bottom,y:o-i.top,x:s-i.left}},s=function(e){return e?e.nodeName.toUpperCase():null},i=function(e){return"HTML"===s(e)?e:e.parentNode||e.host||document.ownerDocument||document.documentElement};function a(e){if(!e)return document.body;if(["HTML","BODY","#document"].includes(e.nodeName.toUpperCase()))return e.ownerDocument.body;if(e instanceof HTMLElement){var t=n(e),r=t.overflow,o=t.overflowX,s=t.overflowY;if(/(auto|scroll|overlay)/.test(r+s+o))return e}return a(i(e))}function f(e,t){void 0===t&&(t=[]);var r=a(e),n="BODY"===s(r),o=n?r.ownerDocument.defaultView:r,c=t.concat(o);return n?c:c.concat(f(i(o)))}function c(e){return e!==r(e)&&e instanceof HTMLElement?{scrollLeft:(t=e).scrollLeft,scrollTop:t.scrollTop}:function(e){var t=r(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}(e);var t}function u(e){var t=e instanceof HTMLElement?e.offsetParent:null,n=r(e);return"BODY"===s(t)?n:t||n}var l=function(e){return e.reduce(function(e,t){var r=c(t);return e.scrollTop+=r.scrollTop,e.scrollLeft+=r.scrollLeft,e},{scrollTop:0,scrollLeft:0})};function p(e,t,r,n){t.filter(function(e){return!r.includes(e)});var o=u(e),s=t.findIndex(function(e){return e===(n||o)}),i=t.slice(0,-1===s?void 0:s);return l(i)}var d=function(e){return e&&e.jquery?e[0]:e},m=function(e){var t=e.reduce(function(e,t){return e[t.name]=t,e},{});return e.sort(function(e,r){return~function e(r){return t[r]&&t[r].requires?t[r].requires.reduce(function(t,r){return[].concat(t,[r],e(r))},[]):[]}(r.name).indexOf(e.name)?-1:1})},h=function(e){return[].concat(m(e.filter(function(e){return"read"===e.phase})),m(e.filter(function(e){return"main"===e.phase})),m(e.filter(function(e){return"afterMain"===e.phase})),m(e.filter(function(e){return"write"===e.phase})))};function v(e,t){return t.reduce(function(t,r){return t[r]=e,t},{})}var y=function(e){return e.split("-")[0]},b=function(e){return["top","bottom"].includes(e)?"x":"y"},g="top",w="bottom",x="right",O="left",E=[g,w,x,O],L=(E.reduce(function(e,t){return e.concat([t,t+"-start",t+"-end"])},[]),function(e){var t,r=e.reference,n=e.element,o=(e.strategy,e.placement),s=e.scroll,i=o?y(o):null,a=o?function(e){return e.split("-")[1]}(o):null,f=s.scrollTop,c=s.scrollLeft;switch(i){case g:t={x:r.x+r.width/2-n.width/2-c,y:r.y-n.height-f};break;case w:t={x:r.x+r.width/2-n.width/2-c,y:r.y+r.height-f};break;case x:t={x:r.x+r.width-c,y:r.y+r.height/2-n.height/2-f};break;case O:t={x:r.x-n.width-c,y:r.y+r.height/2-n.height/2-f};break;default:t={x:r.x-c,y:r.y-f}}var u=i?b(i):null;if(null!=u){var l="y"===u?"height":"width";switch(a){case"start":t[u]-=r[l]/2-n[l]/2;break;case"end":t[u]+=r[l]/2-n[l]/2}}return t});var M=function(e){return JSON.parse(JSON.stringify(e.getBoundingClientRect()))};function D(e,t){var n=a(e),o=t||u(e);return o===r(e)?e.ownerDocument.documentElement:n.contains(o)?n:D(a(i(n)),o)}var P=function(e){var t=r(e),n=o(e.ownerDocument.documentElement);return n.height=Math.max(n.height,t.innerHeight),n.width=Math.max(n.width,t.innerWidth),n},T=function(e){return t({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})};var j={name:"detectOverflow",enabled:!0,phase:"read",fn:function(e,r){void 0===r&&(r={boundaryElement:D(e.elements.popper)});var n=e.elements.popper,o=e.elements.reference,s=e.measures.popper,i=r.boundaryElement.ownerDocument.documentElement;if(!r.boundaryElement.contains(n))return console.error('Popper: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.'),e;var a=i===r.boundaryElement?T(P(i)):M(r.boundaryElement),f=M(o),c=L({reference:f,element:s,strategy:"absolute",placement:e.placement,scroll:{scrollTop:0,scrollLeft:0}}),u=T(t({},s,{},c));return e.modifiersData.detectOverflow={top:a.top-u.top,bottom:u.bottom-a.bottom,left:a.left-u.left,right:u.right-a.right},e},data:{}},S=function(e){switch(e){case"fixed":return"fixed";case"absolute":default:return"absolute"}},k=function(e){var t=e.offsets,r=e.strategy;return!1===e.gpuAcceleration?{top:t.y+"px",left:t.x+"px",position:S(r)}:{top:"0px",left:"0px",transform:"translate3d("+t.x+"px, "+t.y+"px, 0)",position:S(r)}},A=function(e){var t=e.offsets;return e.gpuAcceleration?{top:t.y+"px",left:t.x+"px",position:"absolute"}:{transform:"translate3d("+t.x+"px, "+t.y+"px, 0)",position:"absolute"}};var H={name:"computeStyles",enabled:!0,phase:"afterMain",fn:function(e,t){void 0===t&&(t={});var r=t.gpuAcceleration,n=void 0===r||r;return e.styles={},e.styles.popper=k({offsets:e.offsets.popper,strategy:e.options.strategy,gpuAcceleration:n}),null!=e.offsets.arrow&&(e.styles.arrow=A({offsets:e.offsets.arrow,gpuAcceleration:n})),e}};var q={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){return Object.keys(e.elements).forEach(function(t){var r=e.styles.hasOwnProperty(t)?e.styles[t]:{};Object.assign(e.elements[t].style,r)}),e},onDestroy:function(e){Object.keys(e.elements).forEach(function(r){var n=Object.keys(e.styles.hasOwnProperty(r)?t({},e.styles[r]):{}).reduce(function(e,r){var n;return t({},e,((n={})[String(r)]="",n))},{});Object.assign(e.elements[r].style,n)})},requires:["computeStyles"]};var z={name:"offset",enabled:!0,phase:"main",fn:function(e,r){if(r&&"function"==typeof r.offset){var n=(i=e.placement,a=e.measures,f=r.offset,c=y(i),u=["left","top"].includes(c)?-1:1,l=["top","bottom"].includes(c)?-1:1,p=f(t({},a,{placement:i})),d=p[0],m=p[1],m=((d=(d||0)*u)||0)*l,["left","right"].includes(c)?[d,m]:[m,d]),o=n[0],s=n[1];e.offsets.popper.x+=o,e.offsets.popper.y+=s}var i,a,f,c,u,l,p,d,m;return e}},B={left:"right",right:"left",bottom:"top",top:"bottom"},N=function(e){return e.replace(/left|right|bottom|top/g,function(e){return B[e]})},Y=function(e){return t({top:0,bottom:0,left:0,right:0},e)};var C={name:"flip",enabled:!0,phase:"main",fn:function(e,t){void 0===t&&(t={});var r=e.placement,n=[e.options.placement,N(e.options.placement)],o=t,s=o.behavior,i=void 0===s?n:s,a=o.padding,f=void 0===a?0:a,c=e.modifiersData.detectOverflow,u=e.modifiersData.flip.index,l=Y("number"!=typeof f?f:v(f,E)),p=i[u];if(!p&&r!==e.options.placement)return e.placement=e.options.placement,e.reset=!0,e;if(!p&&r===e.options.placement)return e;var d=y(p),m=c[d]+l[d]<=0;return m?m&&e.placement!==p?(e.placement=p,e.reset=!0,e):e:(e.modifiersData.flip.index+=1,e.reset=!0,e)},requires:["detectOverflow"],data:{index:0}},F=function(e){return"x"===e?"y":"x"},U=function(e,t,r){return Math.max(e,Math.min(t,r))};var J={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e,t){void 0===t&&(t={});var r=t,n=r.mainAxis,o=void 0===n||n,s=r.altAxis,i=void 0!==s&&s,a=r.tether,f=void 0===a||a,c=r.padding,u=void 0===c?0:c,l=e.modifiersData.detectOverflow,p=y(e.placement),d=b(p),m=F(d),h=e.offsets.popper,L=e.measures.reference,M=e.measures.popper,D=Y("number"!=typeof u?u:v(u,E));if(o){var P="y"===d?g:O,T="y"===d?w:x,j="y"===d?"height":"width",S=h[d],k=h[d]+l[P]+D[P],A=h[d]-l[T]-D[T],H=e.offsets.popper[d]-L[j]/2+M[j]/2,q=e.offsets.popper[d]+L[j]/2-M[j]/2;e.offsets.popper[d]=U(f?Math.min(H,k):k,S,f?Math.max(q,A):A)}if(i){var z="x"===d?g:O,B="x"===d?w:x;e.offsets.popper[m]=U(h[m]+l[z]+D[z],h[m],h[m]-l[B]-D[B])}return e},requires:["detectOverflow"]},R=Object.freeze({detectOverflow:j,computeStyles:H,applyStyles:q,offset:z,flip:C,preventOverflow:J}),V=Object.values(R),W=function(e,t){return e instanceof Element&&t instanceof Element},X={placement:"bottom",eventListeners:{scroll:!0,resize:!0},modifiers:[],strategy:"absolute"};return function(){function n(r,n,o){var s,i,a=this;void 0===o&&(o=X),e(this,"state",{placement:"bottom",orderedModifiers:[],options:X,modifiersData:{}}),e(this,"update",(s=function(){return new Promise(function(e,t){a.forceUpdate(),e(a.state)})},i=!1,function(){return new Promise(function(e){if(i)return e();i=!0,Promise.resolve().then(function(){i=!1,e(s())})})})),this.state.elements={reference:d(r),popper:d(n)};var c=this.state.elements,u=c.reference,l=c.popper;this.state.options=t({},X,{},o),W(u,l)&&(this.state.scrollParents={reference:f(u),popper:f(l)},this.state.orderedModifiers=h([].concat(V,this.state.options.modifiers)).map(function(e){return t({},e,{},a.state.options.modifiers.find(function(t){return t.name===e.name}))}),this.state.orderedModifiers.forEach(function(e){var t=e.onLoad;return e.enabled&&t&&t(a.state)}),this.update().then(function(){a.enableEventListeners(a.state.options.eventListeners)}))}var s=n.prototype;return s.forceUpdate=function(){var e=this,r=this.state.elements,n=r.reference,s=r.popper;if(W(n,s)){this.state.measures={reference:o(n),popper:o(s)};c(u(s));this.state.reset=!1,this.state.placement=this.state.options.placement,this.state.orderedModifiers.forEach(function(r){return e.state.modifiersData[r.name]=t({},r.data)});for(var i=0;i<this.state.orderedModifiers.length;i++)if(0===i&&(this.state.offsets={popper:L({reference:this.state.measures.reference,element:this.state.measures.popper,strategy:"absolute",placement:this.state.placement,scroll:p(n,this.state.scrollParents.reference,this.state.scrollParents.popper)})}),!0!==this.state.reset){var a=this.state.orderedModifiers[i],f=a.fn,l=a.enabled,d=a.options;l&&"function"==typeof f&&(this.state=f(this.state,d))}else this.state.reset=!1,i=-1}},s.enableEventListeners=function(e){var t=this,n=this.state.elements,o=(n.reference,n.popper,"boolean"==typeof e?v(e,["scroll","resize"]):e),s=o.scroll,i=o.resize;s&&[].concat(this.state.scrollParents.reference,this.state.scrollParents.popper).forEach(function(e){return e.addEventListener("scroll",t.update,{passive:!0})});i&&r(this.state.elements.popper).addEventListener("resize",this.update,{passive:!0})},s.destroy=function(){var e=this;[].concat(this.state.scrollParents.reference,this.state.scrollParents.popper).forEach(function(t){return t.removeEventListener("scroll",e.update)}),r(this.state.elements.popper).removeEventListener("resize",this.update),this.state.orderedModifiers.forEach(function(t){var r=t.onDestroy;return t.enabled&&r&&r(e.state)})},n}()});
//# sourceMappingURL=popper.min.js.map

@@ -7,7 +7,7 @@ import getScrollParent from './getScrollParent';

export default function getClippingParent(element) {
export default function getClippingParent(element, offsetElement) {
var scrollParent = getScrollParent(element);
var offsetParent = getOffsetParent(element);
var offsetParent = offsetElement || getOffsetParent(element);
var win = getWindow(element);
return offsetParent === win ? element.ownerDocument.documentElement : scrollParent.contains(offsetParent) ? scrollParent : getClippingParent(getScrollParent(getParentNode(scrollParent)));
return offsetParent === win ? element.ownerDocument.documentElement : scrollParent.contains(offsetParent) ? scrollParent : getClippingParent(getScrollParent(getParentNode(scrollParent)), offsetParent);
}

@@ -15,3 +15,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import orderModifiers from './utils/orderModifiers';
import expandEventListeners from './utils/expandEventListeners';
import expandToHashMap from './utils/expandToHashMap';
import computeOffsets from './utils/computeOffsets';

@@ -24,3 +24,4 @@ import format from './utils/format';

var defaultModifiers = Object.values(modifiers);
var INVALID_ELEMENT_ERROR = 'Invalid `%s` argument provided to Popper.js, it must be either a valid DOM element or a jQuery-wrapped DOM element, you provided `%s`';
var INVALID_ELEMENT_ERROR = 'Popper: Invalid `%s` argument provided to Popper, it must be either a valid DOM element or a jQuery-wrapped DOM element, you provided `%s`';
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';

@@ -76,7 +77,4 @@ var areValidElements = function areValidElements(a, b) {

this.state.options = _extends({}, defaultOptions, {}, options); // Cache the placement in cache to make it available to the modifiers
// modifiers will modify this one (rather than the one in options)
this.state.options = _extends({}, defaultOptions, {}, options); // Don't proceed if `reference` or `popper` are invalid elements
this.state.placement = this.state.options.placement; // Don't proceed if `reference` or `popper` are invalid elements
if (!areValidElements(referenceElement, popperElement)) {

@@ -129,2 +127,4 @@ return;

_proto.forceUpdate = function forceUpdate() {
var _this2 = this;
var _this$state$elements2 = this.state.elements,

@@ -150,32 +150,51 @@ referenceElement = _this$state$elements2.reference,

var offsetParentScroll = getNodeScroll(getOffsetParent(popperElement)); // Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
this.state.offsets = {
popper: computeOffsets({
reference: this.state.measures.reference,
element: this.state.measures.popper,
strategy: 'absolute',
placement: this.state.placement,
scroll: getCommonTotalScroll(referenceElement, this.state.scrollParents.reference, this.state.scrollParents.popper)
})
}; // Modifiers have the ability to read the current Popper.js state, included
var offsetParentScroll = getNodeScroll(getOffsetParent(popperElement)); // Modifiers have the ability to read the current Popper state, included
// the popper offsets, and modify it to address specifc cases
this.state.reset = false;
this.state.reset = false; // Cache the placement in cache to make it available to the modifiers
// modifiers will modify this one (rather than the one in options)
this.state.placement = this.state.options.placement;
this.state.orderedModifiers.forEach(function (modifier) {
return _this2.state.modifiersData[modifier.name] = _extends({}, modifier.data);
});
var __debug_loops__ = 0;
for (var index = 0; index < this.state.orderedModifiers.length; index++) {
var _this$state$orderedMo = this.state.orderedModifiers[index],
fn = _this$state$orderedMo.fn,
enabled = _this$state$orderedMo.enabled,
options = _this$state$orderedMo.options;
if (process.env.NODE_ENV !== "production") {
__debug_loops__ += 1;
if (__debug_loops__ > 100) {
console.error(INFINITE_LOOP_ERROR);
break;
}
}
if (index === 0) {
// Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
this.state.offsets = {
popper: computeOffsets({
reference: this.state.measures.reference,
element: this.state.measures.popper,
strategy: 'absolute',
placement: this.state.placement,
scroll: getCommonTotalScroll(referenceElement, this.state.scrollParents.reference, this.state.scrollParents.popper)
})
};
}
if (this.state.reset === true) {
this.state.reset = false;
index = 0;
index = -1;
continue;
}
var _this$state$orderedMo = this.state.orderedModifiers[index],
fn = _this$state$orderedMo.fn,
enabled = _this$state$orderedMo.enabled,
options = _this$state$orderedMo.options;
if (enabled && typeof fn === 'function') {

@@ -188,3 +207,3 @@ this.state = fn(this.state, options);

_proto.enableEventListeners = function enableEventListeners(eventListeners) {
var _this2 = this;
var _this3 = this;

@@ -195,5 +214,5 @@ var _this$state$elements3 = this.state.elements,

var _expandEventListeners = expandEventListeners(eventListeners),
scroll = _expandEventListeners.scroll,
resize = _expandEventListeners.resize;
var _ref3 = typeof eventListeners === 'boolean' ? expandToHashMap(eventListeners, ['scroll', 'resize']) : eventListeners,
scroll = _ref3.scroll,
resize = _ref3.resize;

@@ -203,3 +222,3 @@ if (scroll) {

scrollParents.forEach(function (scrollParent) {
return scrollParent.addEventListener('scroll', _this2.update, {
return scrollParent.addEventListener('scroll', _this3.update, {
passive: true

@@ -219,3 +238,3 @@ });

_proto.destroy = function destroy() {
var _this3 = this;
var _this4 = this;

@@ -225,3 +244,3 @@ // Remove scroll event listeners

scrollParents.forEach(function (scrollParent) {
return scrollParent.removeEventListener('scroll', _this3.update);
return scrollParent.removeEventListener('scroll', _this4.update);
}); // Remove resize event listeners

@@ -232,6 +251,6 @@

this.state.orderedModifiers.forEach(function (_ref3) {
var onDestroy = _ref3.onDestroy,
enabled = _ref3.enabled;
return enabled && onDestroy && onDestroy(_this3.state);
this.state.orderedModifiers.forEach(function (_ref4) {
var onDestroy = _ref4.onDestroy,
enabled = _ref4.enabled;
return enabled && onDestroy && onDestroy(_this4.state);
});

@@ -238,0 +257,0 @@ };

@@ -1,2 +0,2 @@

// This modifier takes the Popper.js state and prepares some StyleSheet properties
// This modifier takes the Popper state and prepares some StyleSheet properties
// that can be applied to the popper element to make it render in the expected position.

@@ -52,3 +52,9 @@ export var mapStrategyToPosition = function mapStrategyToPosition(strategy) {

export function computeStyles(state, options) {
var gpuAcceleration = options && options.gpuAcceleration != null ? options.gpuAcceleration : true;
if (options === void 0) {
options = {};
}
var _options = options,
_options$gpuAccelerat = _options.gpuAcceleration,
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat;
state.styles = {}; // popper offsets are always available

@@ -55,0 +61,0 @@

@@ -21,3 +21,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

if (!options.boundaryElement.contains(popperElement)) {
console.error('PopperJS: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.');
console.error('Popper: "detectOverflow" can accept as `boundaryElement` only a parent node of the provided popper.');
return state;

@@ -32,3 +32,3 @@ }

strategy: 'absolute',
placement: state.options.placement,
placement: state.placement,
scroll: {

@@ -35,0 +35,0 @@ scrollTop: 0,

@@ -1,20 +0,46 @@

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import getOppositePlacement from '../utils/getOppositePlacement';
import getBasePlacement from '../utils/getBasePlacement';
import mergePaddingObject from '../utils/mergePaddingObject';
import expandToHashMap from '../utils/expandToHashMap';
import { basePlacements } from '../enums';
export function flip(state, options) {
if (options === void 0) {
options = {};
}
var placement = state.placement;
var behavior = options && options.behavior ? options.behavior : [state.options.placement, getOppositePlacement(placement)];
var defaultBehavior = [state.options.placement, getOppositePlacement(state.options.placement)];
var _options = options,
_options$behavior = _options.behavior,
behavior = _options$behavior === void 0 ? defaultBehavior : _options$behavior,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var overflow = state.modifiersData.detectOverflow;
var flippedPlacement = behavior.find(function (newPlacement) {
return overflow[getBasePlacement(newPlacement)] <= 0;
});
var flipIndex = state.modifiersData.flip.index;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
var flippedPlacement = behavior[flipIndex];
if (flippedPlacement && flippedPlacement !== placement) {
state = _extends({}, state, {
placement: flippedPlacement,
reset: true
});
if (!flippedPlacement && placement !== state.options.placement) {
state.placement = state.options.placement;
state.reset = true;
return state;
}
if (!flippedPlacement && placement === state.options.placement) {
return state;
}
var basePlacement = getBasePlacement(flippedPlacement);
var fits = overflow[basePlacement] + paddingObject[basePlacement] <= 0;
if (!fits) {
state.modifiersData.flip.index += 1;
state.reset = true;
return state;
} else if (fits && state.placement !== flippedPlacement) {
state.placement = flippedPlacement;
state.reset = true;
return state;
}
return state;

@@ -26,3 +52,7 @@ }

phase: 'main',
fn: flip
fn: flip,
requires: ['detectOverflow'],
data: {
index: 0
}
};

@@ -1,5 +0,8 @@

import { top, left, right, bottom } from '../enums';
import { basePlacements, top, left, right, bottom } from '../enums';
import getBasePlacement from '../utils/getBasePlacement';
import getMainAxisFromPlacement from '../utils/getMainAxisFromPlacement';
import getAltAxis from '../utils/getAltAxis';
import mergePaddingObject from '../utils/mergePaddingObject';
import expandToHashMap from '../utils/expandToHashMap';
import within from '../utils/within';
export function preventOverflow(state, options) {

@@ -14,3 +17,7 @@ if (options === void 0) {

_options$altAxis = _options.altAxis,
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis;
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
_options$tether = _options.tether,
tether = _options$tether === void 0 ? true : _options$tether,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var overflow = state.modifiersData.detectOverflow;

@@ -21,2 +28,5 @@ var basePlacement = getBasePlacement(state.placement);

var popperOffsets = state.offsets.popper;
var referenceRect = state.measures.reference;
var popperRect = state.measures.popper;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));

@@ -26,3 +36,9 @@ if (checkMainAxis) {

var altSide = mainAxis === 'y' ? bottom : right;
state.offsets.popper[mainAxis] = Math.max(Math.min(popperOffsets[mainAxis], popperOffsets[mainAxis] - overflow[altSide]), popperOffsets[mainAxis] + overflow[mainSide]);
var len = mainAxis === 'y' ? 'height' : 'width';
var offset = popperOffsets[mainAxis];
var min = popperOffsets[mainAxis] + overflow[mainSide] + paddingObject[mainSide];
var max = popperOffsets[mainAxis] - overflow[altSide] - paddingObject[altSide];
var tetherMin = state.offsets.popper[mainAxis] - referenceRect[len] / 2 + popperRect[len] / 2;
var tetherMax = state.offsets.popper[mainAxis] + referenceRect[len] / 2 - popperRect[len] / 2;
state.offsets.popper[mainAxis] = within(tether ? Math.min(tetherMin, min) : min, offset, tether ? Math.max(tetherMax, max) : max);
}

@@ -35,4 +51,3 @@

console.log(altAxis, _mainSide, overflow[_altSide]);
state.offsets.popper[altAxis] = Math.max(Math.min(popperOffsets[altAxis], popperOffsets[altAxis] - overflow[_altSide]), popperOffsets[altAxis] + overflow[_mainSide]);
state.offsets.popper[altAxis] = within(popperOffsets[altAxis] + overflow[_mainSide] + paddingObject[_mainSide], popperOffsets[altAxis], popperOffsets[altAxis] - overflow[_altSide] - paddingObject[_altSide]);
}

@@ -43,6 +58,7 @@

export default {
name: 'flip',
name: 'preventOverflow',
enabled: true,
phase: 'main',
fn: preventOverflow
fn: preventOverflow,
requires: ['detectOverflow']
};
import getBasePlacement from './getBasePlacement';
import getVariationPlacement from './getVariationPlacement';
import getMainAxisFromPlacement from './getMainAxisFromPlacement';
import getAltAxis from './getAltAxis';
import getAltLen from './getAltLen';
import { top, right, bottom, left, start, end } from '../enums';

@@ -55,15 +53,14 @@ export default (function (_ref) {

var mainAxis = placement ? getMainAxisFromPlacement(placement) : null;
var altAxis = mainAxis ? getAltAxis(mainAxis) : null;
var len = altAxis === 'x' ? 'width' : 'height';
var axis = [right, left].includes(basePlacement) ? mainAxis : altAxis;
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
if (axis != null) {
if (mainAxis != null) {
var len = mainAxis === 'y' ? 'height' : 'width';
switch (variationPlacement) {
case start:
offsets[axis] -= element[len] / 2;
offsets[mainAxis] -= reference[len] / 2 - element[len] / 2;
break;
case end:
offsets[axis] += element[len] / 2;
offsets[mainAxis] += reference[len] / 2 - element[len] / 2;
break;

@@ -70,0 +67,0 @@

@@ -10,3 +10,3 @@ // source: https://stackoverflow.com/questions/49875255

var inherited = function inherited(i) {
return mapped[i].requires ? mapped[i].requires.reduce(function (mem, i) {
return mapped[i] && mapped[i].requires ? mapped[i].requires.reduce(function (mem, i) {
return [].concat(mem, [i], inherited(i));

@@ -13,0 +13,0 @@ }, []) : [];

import format from './format';
import { read, main, write } from '../enums';
var ERROR_MESSAGE = 'PopperJS: modifier "%s" provided an invalid %s property, expected %s but got %s';
var ERROR_MESSAGE = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'onLoad', 'requires', 'options'];

@@ -5,0 +5,0 @@ export default (function (modifiers) {

{
"name": "@popperjs/core",
"version": "2.0.0-next.7",
"version": "2.0.0-next.8",
"description": "A kickass library used to manage poppers in web applications",

@@ -21,4 +21,3 @@ "main": "dist/cjs/popper.js",

"build:bundles": "rollup -c rollup.config.js",
"build:flow": "flow-copy-source src dist/cjs --ignore '{__mocks__/*,*.test}.js'",
"precommit": "pretty-quick --staged"
"build:flow": "flow-copy-source src dist/cjs --ignore '{__mocks__/*,*.test}.js'"
},

@@ -87,3 +86,8 @@ "files": [

"serve": "^10.0.2"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
}
}

@@ -1,14 +0,14 @@

# PopperJS
<p align="center">
<img src="./docs/src/images/popper-logo.png" alt="Popper" height="300px"/>
</p>
Positioning tooltips (_but also dropdowns, popovers, and more_) has always been particularly painful.
Positioning tooltips (_but also dropdowns, popovers, and more_) has always been particularly painful. **Popper** is here to help.
**PopperJS** is here to help.
Give it a reference element (such as a button) and a popper element (your tooltip) and it will automatically put your tooltip in the right place.
PopperJS is a ~3 kB library that aims to provide a reliable and extensible positioning engine you can use to build your awesome UI. Why waste your time writing your own logic every time you are programming a tooltip?
Popper is a ~3 kB library that aims to provide a reliable and extensible positioning engine you can use to build your awesome UI. Why waste your time writing your own logic every time you are programming a tooltip?
This library can position any pair of elements in your document without needing to alter the DOM in any way. It doesn't care if your elements are not close to each other or are in two different scrolling containers, they will always end up in the right position.
But wait, it's not 1993 anymore, nowadays we write UIs using powerful abstraction libraries such as React or Angular. You'll be glad to know PopperJS can fully integrate with them and be a good citizen together with your other components. Check out [`react-popper`](https://github.com/FezVrasta/react-popper) for the official PopperJS wrapper for React.
But wait, it's not 1993 anymore, nowadays we write UIs using powerful abstraction libraries such as React or Angular. You'll be glad to know Popper can fully integrate with them and be a good citizen together with your other components. Check out [`react-popper`](https://github.com/FezVrasta/react-popper) for the official Popper wrapper for React.

@@ -18,6 +18,6 @@ ## Installation:

```bash
# With Yarn package mnager
yarn add @popper/core@next
# or
# With npm
npm install @popper/core@next

@@ -33,3 +33,3 @@ ```

// Let PopperJS do the magic!
// Let Popper do the magic!
new Popper(element, popper, { placement: 'right' });

@@ -36,0 +36,0 @@ ```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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