vrembem 1.35.2 → 1.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dev/scripts.js CHANGED
@@ -61,6 +61,8 @@ var camelCase = function camelCase(str) {
61
61
  });
62
62
  };
63
63
 
64
+ var focusableSelectors = ['a[href]:not([tabindex^="-"])', 'area[href]:not([tabindex^="-"])', 'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])', 'input[type="radio"]:not([disabled]):not([tabindex^="-"])', 'select:not([disabled]):not([tabindex^="-"])', 'textarea:not([disabled]):not([tabindex^="-"])', 'button:not([disabled]):not([tabindex^="-"])', 'iframe:not([tabindex^="-"])', 'audio[controls]:not([tabindex^="-"])', 'video[controls]:not([tabindex^="-"])', '[contenteditable]:not([tabindex^="-"])', '[tabindex]:not([tabindex^="-"])'];
65
+
64
66
  var focusTarget = function focusTarget(target, settings) {
65
67
  var innerFocus = target.querySelector("[data-" + settings.dataFocus + "]");
66
68
 
@@ -113,6 +115,28 @@ var FocusTrap = /*#__PURE__*/function () {
113
115
  this.target = null;
114
116
  };
115
117
 
118
+ _proto.refresh = function refresh() {
119
+ // Check if a target has been set
120
+ if (!this.target) return; // Remove existing events
121
+
122
+ this.target.removeEventListener('keydown', this.__handlerFocusTrap);
123
+ this.target.removeEventListener('keydown', this.handlerFocusLock); // Get the focusable elements
124
+
125
+ this.focusable = this.getFocusable(); // Setup the focus handlers based on focusable length
126
+
127
+ if (this.focusable.length) {
128
+ // If there are focusable elements, setup focus trap
129
+ this.focusableFirst = this.focusable[0];
130
+ this.focusableLast = this.focusable[this.focusable.length - 1];
131
+ this.target.addEventListener('keydown', this.__handlerFocusTrap);
132
+ } else {
133
+ // If there are no focusable elements, setup focus lock
134
+ this.focusableFirst = null;
135
+ this.focusableLast = null;
136
+ this.target.addEventListener('keydown', this.handlerFocusLock);
137
+ }
138
+ };
139
+
116
140
  _proto.handlerFocusTrap = function handlerFocusTrap(event) {
117
141
  var isTab = event.key === 'Tab' || event.keyCode === 9;
118
142
  if (!isTab) return;
@@ -139,7 +163,7 @@ var FocusTrap = /*#__PURE__*/function () {
139
163
  var focusable = [];
140
164
  var initFocus = document.activeElement;
141
165
  var initScrollTop = this.inner ? this.inner.scrollTop : 0;
142
- this.target.querySelectorAll('a[href]:not([disabled]),button:not([disabled]),textarea:not([disabled]),input[type="text"]:not([disabled]),input[type="radio"]:not([disabled]),input[type="checkbox"]:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])').forEach(function (el) {
166
+ this.target.querySelectorAll(focusableSelectors.join(',')).forEach(function (el) {
143
167
  el.focus();
144
168
 
145
169
  if (el === document.activeElement) {
@@ -874,6 +898,7 @@ var Drawer = /*#__PURE__*/function () {
874
898
 
875
899
  focusTarget(drawer, _this4.settings);
876
900
  drawer.dispatchEvent(new CustomEvent(_this4.settings.customEventPrefix + 'opened', {
901
+ detail: _this4,
877
902
  bubbles: true
878
903
  }));
879
904
  _this4.working = false;
@@ -912,6 +937,7 @@ var Drawer = /*#__PURE__*/function () {
912
937
  _this6.focusTrap.destroy();
913
938
 
914
939
  drawer.dispatchEvent(new CustomEvent(_this6.settings.customEventPrefix + 'closed', {
940
+ detail: _this6,
915
941
  bubbles: true
916
942
  }));
917
943
  _this6.working = false;
@@ -958,10 +984,6 @@ var defaults$1 = {
958
984
 
959
985
  var handlerClick$1 = function handlerClick(event) {
960
986
  try {
961
- var _exit2;
962
-
963
- var _this2 = this;
964
-
965
987
  var _temp3 = function _temp3(_result) {
966
988
  if (_exit2) return _result;
967
989
 
@@ -980,6 +1002,10 @@ var handlerClick$1 = function handlerClick(event) {
980
1002
  }
981
1003
  };
982
1004
 
1005
+ var _exit2;
1006
+
1007
+ var _this2 = this;
1008
+
983
1009
  // Working catch
984
1010
  if (_this2.working) return Promise.resolve(); // Trigger click
985
1011
 
@@ -1146,6 +1172,7 @@ var Modal = /*#__PURE__*/function () {
1146
1172
  focusTarget(modal, _this2.settings);
1147
1173
  setInert(true, _this2.settings.selectorInert);
1148
1174
  modal.dispatchEvent(new CustomEvent(_this2.settings.customEventPrefix + 'opened', {
1175
+ detail: _this2,
1149
1176
  bubbles: true
1150
1177
  }));
1151
1178
  _this2.working = false;
@@ -1179,6 +1206,7 @@ var Modal = /*#__PURE__*/function () {
1179
1206
  _this4.focusTrap.destroy();
1180
1207
 
1181
1208
  modal.dispatchEvent(new CustomEvent(_this4.settings.customEventPrefix + 'closed', {
1209
+ detail: _this4,
1182
1210
  bubbles: true
1183
1211
  }));
1184
1212
  _this4.working = false;
@@ -1594,17 +1622,42 @@ function getBasePlacement(placement) {
1594
1622
  return placement.split('-')[0];
1595
1623
  }
1596
1624
 
1597
- function getBoundingClientRect(element) {
1625
+ var max = Math.max;
1626
+ var min = Math.min;
1627
+ var round = Math.round;
1628
+
1629
+ function getBoundingClientRect(element, includeScale) {
1630
+ if (includeScale === void 0) {
1631
+ includeScale = false;
1632
+ }
1633
+
1598
1634
  var rect = element.getBoundingClientRect();
1635
+ var scaleX = 1;
1636
+ var scaleY = 1;
1637
+
1638
+ if (isHTMLElement(element) && includeScale) {
1639
+ var offsetHeight = element.offsetHeight;
1640
+ var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
1641
+ // Fallback to 1 in case both values are `0`
1642
+
1643
+ if (offsetWidth > 0) {
1644
+ scaleX = round(rect.width) / offsetWidth || 1;
1645
+ }
1646
+
1647
+ if (offsetHeight > 0) {
1648
+ scaleY = round(rect.height) / offsetHeight || 1;
1649
+ }
1650
+ }
1651
+
1599
1652
  return {
1600
- width: rect.width,
1601
- height: rect.height,
1602
- top: rect.top,
1603
- right: rect.right,
1604
- bottom: rect.bottom,
1605
- left: rect.left,
1606
- x: rect.left,
1607
- y: rect.top
1653
+ width: rect.width / scaleX,
1654
+ height: rect.height / scaleY,
1655
+ top: rect.top / scaleY,
1656
+ right: rect.right / scaleX,
1657
+ bottom: rect.bottom / scaleY,
1658
+ left: rect.left / scaleX,
1659
+ x: rect.left / scaleX,
1660
+ y: rect.top / scaleY
1608
1661
  };
1609
1662
  }
1610
1663
 
@@ -1749,13 +1802,13 @@ function getMainAxisFromPlacement(placement) {
1749
1802
  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
1750
1803
  }
1751
1804
 
1752
- var max = Math.max;
1753
- var min = Math.min;
1754
- var round = Math.round;
1755
-
1756
1805
  function within(min$1, value, max$1) {
1757
1806
  return max(min$1, min(value, max$1));
1758
1807
  }
1808
+ function withinMaxClamp(min, value, max) {
1809
+ var v = within(min, value, max);
1810
+ return v > max ? max : v;
1811
+ }
1759
1812
 
1760
1813
  function getFreshSideObject() {
1761
1814
  return {
@@ -1859,6 +1912,10 @@ var arrow$1 = {
1859
1912
  requiresIfExists: ['preventOverflow']
1860
1913
  };
1861
1914
 
1915
+ function getVariation(placement) {
1916
+ return placement.split('-')[1];
1917
+ }
1918
+
1862
1919
  var unsetSides = {
1863
1920
  top: 'auto',
1864
1921
  right: 'auto',
@@ -1874,8 +1931,8 @@ function roundOffsetsByDPR(_ref) {
1874
1931
  var win = window;
1875
1932
  var dpr = win.devicePixelRatio || 1;
1876
1933
  return {
1877
- x: round(round(x * dpr) / dpr) || 0,
1878
- y: round(round(y * dpr) / dpr) || 0
1934
+ x: round(x * dpr) / dpr || 0,
1935
+ y: round(y * dpr) / dpr || 0
1879
1936
  };
1880
1937
  }
1881
1938
 
@@ -1885,18 +1942,28 @@ function mapToStyles(_ref2) {
1885
1942
  var popper = _ref2.popper,
1886
1943
  popperRect = _ref2.popperRect,
1887
1944
  placement = _ref2.placement,
1945
+ variation = _ref2.variation,
1888
1946
  offsets = _ref2.offsets,
1889
1947
  position = _ref2.position,
1890
1948
  gpuAcceleration = _ref2.gpuAcceleration,
1891
1949
  adaptive = _ref2.adaptive,
1892
- roundOffsets = _ref2.roundOffsets;
1893
-
1894
- var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
1895
- _ref3$x = _ref3.x,
1896
- x = _ref3$x === void 0 ? 0 : _ref3$x,
1897
- _ref3$y = _ref3.y,
1898
- y = _ref3$y === void 0 ? 0 : _ref3$y;
1950
+ roundOffsets = _ref2.roundOffsets,
1951
+ isFixed = _ref2.isFixed;
1952
+ var _offsets$x = offsets.x,
1953
+ x = _offsets$x === void 0 ? 0 : _offsets$x,
1954
+ _offsets$y = offsets.y,
1955
+ y = _offsets$y === void 0 ? 0 : _offsets$y;
1956
+
1957
+ var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
1958
+ x: x,
1959
+ y: y
1960
+ }) : {
1961
+ x: x,
1962
+ y: y
1963
+ };
1899
1964
 
1965
+ x = _ref3.x;
1966
+ y = _ref3.y;
1900
1967
  var hasX = offsets.hasOwnProperty('x');
1901
1968
  var hasY = offsets.hasOwnProperty('y');
1902
1969
  var sideX = left;
@@ -1911,7 +1978,7 @@ function mapToStyles(_ref2) {
1911
1978
  if (offsetParent === getWindow(popper)) {
1912
1979
  offsetParent = getDocumentElement(popper);
1913
1980
 
1914
- if (getComputedStyle$1(offsetParent).position !== 'static') {
1981
+ if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') {
1915
1982
  heightProp = 'scrollHeight';
1916
1983
  widthProp = 'scrollWidth';
1917
1984
  }
@@ -1920,17 +1987,19 @@ function mapToStyles(_ref2) {
1920
1987
 
1921
1988
  offsetParent = offsetParent;
1922
1989
 
1923
- if (placement === top) {
1924
- sideY = bottom; // $FlowFixMe[prop-missing]
1925
-
1926
- y -= offsetParent[heightProp] - popperRect.height;
1990
+ if (placement === top || (placement === left || placement === right) && variation === end) {
1991
+ sideY = bottom;
1992
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
1993
+ offsetParent[heightProp];
1994
+ y -= offsetY - popperRect.height;
1927
1995
  y *= gpuAcceleration ? 1 : -1;
1928
1996
  }
1929
1997
 
1930
- if (placement === left) {
1931
- sideX = right; // $FlowFixMe[prop-missing]
1932
-
1933
- x -= offsetParent[widthProp] - popperRect.width;
1998
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
1999
+ sideX = right;
2000
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
2001
+ offsetParent[widthProp];
2002
+ x -= offsetX - popperRect.width;
1934
2003
  x *= gpuAcceleration ? 1 : -1;
1935
2004
  }
1936
2005
  }
@@ -1939,18 +2008,29 @@ function mapToStyles(_ref2) {
1939
2008
  position: position
1940
2009
  }, adaptive && unsetSides);
1941
2010
 
2011
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
2012
+ x: x,
2013
+ y: y
2014
+ }) : {
2015
+ x: x,
2016
+ y: y
2017
+ };
2018
+
2019
+ x = _ref4.x;
2020
+ y = _ref4.y;
2021
+
1942
2022
  if (gpuAcceleration) {
1943
2023
  var _Object$assign;
1944
2024
 
1945
- 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));
2025
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
1946
2026
  }
1947
2027
 
1948
2028
  return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
1949
2029
  }
1950
2030
 
1951
- function computeStyles(_ref4) {
1952
- var state = _ref4.state,
1953
- options = _ref4.options;
2031
+ function computeStyles(_ref5) {
2032
+ var state = _ref5.state,
2033
+ options = _ref5.options;
1954
2034
  var _options$gpuAccelerat = options.gpuAcceleration,
1955
2035
  gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
1956
2036
  _options$adaptive = options.adaptive,
@@ -1960,9 +2040,11 @@ function computeStyles(_ref4) {
1960
2040
 
1961
2041
  var commonStyles = {
1962
2042
  placement: getBasePlacement(state.placement),
2043
+ variation: getVariation(state.placement),
1963
2044
  popper: state.elements.popper,
1964
2045
  popperRect: state.rects.popper,
1965
- gpuAcceleration: gpuAcceleration
2046
+ gpuAcceleration: gpuAcceleration,
2047
+ isFixed: state.options.strategy === 'fixed'
1966
2048
  };
1967
2049
 
1968
2050
  if (state.modifiersData.popperOffsets != null) {
@@ -2220,7 +2302,7 @@ function getInnerBoundingClientRect(element) {
2220
2302
  }
2221
2303
 
2222
2304
  function getClientRectFromMixedType(element, clippingParent) {
2223
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
2305
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
2224
2306
  } // A "clipping parent" is an overflowable container with the characteristic of
2225
2307
  // clipping (or hiding) overflowing elements with a position different from
2226
2308
  // `initial`
@@ -2262,10 +2344,6 @@ function getClippingRect(element, boundary, rootBoundary) {
2262
2344
  return clippingRect;
2263
2345
  }
2264
2346
 
2265
- function getVariation(placement) {
2266
- return placement.split('-')[1];
2267
- }
2268
-
2269
2347
  function computeOffsets(_ref) {
2270
2348
  var reference = _ref.reference,
2271
2349
  element = _ref.element,
@@ -2351,11 +2429,10 @@ function detectOverflow(state, options) {
2351
2429
  padding = _options$padding === void 0 ? 0 : _options$padding;
2352
2430
  var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
2353
2431
  var altContext = elementContext === popper ? reference : popper;
2354
- var referenceElement = state.elements.reference;
2355
2432
  var popperRect = state.rects.popper;
2356
2433
  var element = state.elements[altBoundary ? altContext : elementContext];
2357
2434
  var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
2358
- var referenceClientRect = getBoundingClientRect(referenceElement);
2435
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
2359
2436
  var popperOffsets = computeOffsets({
2360
2437
  reference: referenceClientRect,
2361
2438
  element: popperRect,
@@ -2738,6 +2815,14 @@ function preventOverflow(_ref) {
2738
2815
  var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
2739
2816
  placement: state.placement
2740
2817
  })) : tetherOffset;
2818
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
2819
+ mainAxis: tetherOffsetValue,
2820
+ altAxis: tetherOffsetValue
2821
+ } : Object.assign({
2822
+ mainAxis: 0,
2823
+ altAxis: 0
2824
+ }, tetherOffsetValue);
2825
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
2741
2826
  var data = {
2742
2827
  x: 0,
2743
2828
  y: 0
@@ -2747,13 +2832,15 @@ function preventOverflow(_ref) {
2747
2832
  return;
2748
2833
  }
2749
2834
 
2750
- if (checkMainAxis || checkAltAxis) {
2835
+ if (checkMainAxis) {
2836
+ var _offsetModifierState$;
2837
+
2751
2838
  var mainSide = mainAxis === 'y' ? top : left;
2752
2839
  var altSide = mainAxis === 'y' ? bottom : right;
2753
2840
  var len = mainAxis === 'y' ? 'height' : 'width';
2754
2841
  var offset = popperOffsets[mainAxis];
2755
- var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
2756
- var max$1 = popperOffsets[mainAxis] - overflow[altSide];
2842
+ var min$1 = offset + overflow[mainSide];
2843
+ var max$1 = offset - overflow[altSide];
2757
2844
  var additive = tether ? -popperRect[len] / 2 : 0;
2758
2845
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
2759
2846
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
@@ -2773,36 +2860,45 @@ function preventOverflow(_ref) {
2773
2860
  // width or height)
2774
2861
 
2775
2862
  var arrowLen = within(0, referenceRect[len], arrowRect[len]);
2776
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
2777
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
2863
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
2864
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
2778
2865
  var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
2779
2866
  var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
2780
- var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
2781
- var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
2782
- var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
2867
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
2868
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
2869
+ var tetherMax = offset + maxOffset - offsetModifierValue;
2870
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
2871
+ popperOffsets[mainAxis] = preventedOffset;
2872
+ data[mainAxis] = preventedOffset - offset;
2873
+ }
2783
2874
 
2784
- if (checkMainAxis) {
2785
- var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
2786
- popperOffsets[mainAxis] = preventedOffset;
2787
- data[mainAxis] = preventedOffset - offset;
2788
- }
2875
+ if (checkAltAxis) {
2876
+ var _offsetModifierState$2;
2789
2877
 
2790
- if (checkAltAxis) {
2791
- var _mainSide = mainAxis === 'x' ? top : left;
2878
+ var _mainSide = mainAxis === 'x' ? top : left;
2792
2879
 
2793
- var _altSide = mainAxis === 'x' ? bottom : right;
2880
+ var _altSide = mainAxis === 'x' ? bottom : right;
2794
2881
 
2795
- var _offset = popperOffsets[altAxis];
2882
+ var _offset = popperOffsets[altAxis];
2796
2883
 
2797
- var _min = _offset + overflow[_mainSide];
2884
+ var _len = altAxis === 'y' ? 'height' : 'width';
2798
2885
 
2799
- var _max = _offset - overflow[_altSide];
2886
+ var _min = _offset + overflow[_mainSide];
2800
2887
 
2801
- var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
2888
+ var _max = _offset - overflow[_altSide];
2802
2889
 
2803
- popperOffsets[altAxis] = _preventedOffset;
2804
- data[altAxis] = _preventedOffset - _offset;
2805
- }
2890
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
2891
+
2892
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
2893
+
2894
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
2895
+
2896
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
2897
+
2898
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
2899
+
2900
+ popperOffsets[altAxis] = _preventedOffset;
2901
+ data[altAxis] = _preventedOffset - _offset;
2806
2902
  }
2807
2903
 
2808
2904
  state.modifiersData[name] = data;
@@ -2832,16 +2928,24 @@ function getNodeScroll(node) {
2832
2928
  }
2833
2929
  }
2834
2930
 
2931
+ function isElementScaled(element) {
2932
+ var rect = element.getBoundingClientRect();
2933
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
2934
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
2935
+ return scaleX !== 1 || scaleY !== 1;
2936
+ } // Returns the composite rect of an element relative to its offsetParent.
2835
2937
  // Composite means it takes into account transforms as well as layout.
2836
2938
 
2939
+
2837
2940
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
2838
2941
  if (isFixed === void 0) {
2839
2942
  isFixed = false;
2840
2943
  }
2841
2944
 
2842
- var documentElement = getDocumentElement(offsetParent);
2843
- var rect = getBoundingClientRect(elementOrVirtualElement);
2844
2945
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
2946
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
2947
+ var documentElement = getDocumentElement(offsetParent);
2948
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
2845
2949
  var scroll = {
2846
2950
  scrollLeft: 0,
2847
2951
  scrollTop: 0
@@ -2858,7 +2962,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
2858
2962
  }
2859
2963
 
2860
2964
  if (isHTMLElement(offsetParent)) {
2861
- offsets = getBoundingClientRect(offsetParent);
2965
+ offsets = getBoundingClientRect(offsetParent, true);
2862
2966
  offsets.x += offsetParent.clientLeft;
2863
2967
  offsets.y += offsetParent.clientTop;
2864
2968
  } else if (documentElement) {
@@ -2995,7 +3099,8 @@ function popperGenerator(generatorOptions) {
2995
3099
  var isDestroyed = false;
2996
3100
  var instance = {
2997
3101
  state: state,
2998
- setOptions: function setOptions(options) {
3102
+ setOptions: function setOptions(setOptionsAction) {
3103
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
2999
3104
  cleanupModifierEffects();
3000
3105
  state.options = Object.assign({}, defaultOptions, state.options, options);
3001
3106
  state.scrollParents = {