Comparing version 1.1.1 to 1.2.0
@@ -75,3 +75,4 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var parent = container.parentElement; | ||
var parentCollisions = detectElementOverflow(parent, scrollContainer); | ||
var scrollContainerCollisions = detectElementOverflow(parent, scrollContainer); | ||
var documentCollisions = detectElementOverflow(parent, document.documentElement); | ||
var isX = axis === 'x'; | ||
@@ -88,6 +89,5 @@ var startProperty = isX ? 'left' : 'top'; | ||
var minSizeProperty = "min-".concat(sizeProperty); | ||
var scroll = scrollContainer[scrollProperty]; | ||
var scrollbarWidth = scrollContainer[offsetSizeProperty] - scrollContainer[clientSizeProperty]; | ||
var availableStartSpace = -parentCollisions[overflowStartProperty] - spacing + scroll; | ||
var availableEndSpace = -parentCollisions[overflowEndProperty] - spacing - scroll - scrollbarWidth; | ||
var availableStartSpace = -Math.max(scrollContainerCollisions[overflowStartProperty], documentCollisions[overflowStartProperty] + document.documentElement[scrollProperty]) - spacing; | ||
var availableEndSpace = -Math.max(scrollContainerCollisions[overflowEndProperty], documentCollisions[overflowEndProperty] - document.documentElement[scrollProperty]) - spacing - scrollbarWidth; | ||
@@ -313,3 +313,3 @@ if (secondary) { | ||
_this2.element = element; | ||
_this2.scrollContainer = element && findScrollContainer(element); | ||
_this2.scrollContainer = findScrollContainer(element); | ||
}, | ||
@@ -316,0 +316,0 @@ style: { |
@@ -91,3 +91,4 @@ "use strict"; | ||
var parent = container.parentElement; | ||
var parentCollisions = (0, _detectElementOverflow["default"])(parent, scrollContainer); | ||
var scrollContainerCollisions = (0, _detectElementOverflow["default"])(parent, scrollContainer); | ||
var documentCollisions = (0, _detectElementOverflow["default"])(parent, document.documentElement); | ||
var isX = axis === 'x'; | ||
@@ -104,6 +105,5 @@ var startProperty = isX ? 'left' : 'top'; | ||
var minSizeProperty = "min-".concat(sizeProperty); | ||
var scroll = scrollContainer[scrollProperty]; | ||
var scrollbarWidth = scrollContainer[offsetSizeProperty] - scrollContainer[clientSizeProperty]; | ||
var availableStartSpace = -parentCollisions[overflowStartProperty] - spacing + scroll; | ||
var availableEndSpace = -parentCollisions[overflowEndProperty] - spacing - scroll - scrollbarWidth; | ||
var availableStartSpace = -Math.max(scrollContainerCollisions[overflowStartProperty], documentCollisions[overflowStartProperty] + document.documentElement[scrollProperty]) - spacing; | ||
var availableEndSpace = -Math.max(scrollContainerCollisions[overflowEndProperty], documentCollisions[overflowEndProperty] - document.documentElement[scrollProperty]) - spacing - scrollbarWidth; | ||
@@ -330,3 +330,3 @@ if (secondary) { | ||
_this2.element = element; | ||
_this2.scrollContainer = element && findScrollContainer(element); | ||
_this2.scrollContainer = findScrollContainer(element); | ||
}, | ||
@@ -333,0 +333,0 @@ style: { |
{ | ||
"name": "react-fit", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Fit a popover element on the screen.", | ||
@@ -5,0 +5,0 @@ "main": "dist/umd/Fit.js", |
@@ -55,3 +55,4 @@ import React, { Component } from 'react'; | ||
const parent = container.parentElement; | ||
const parentCollisions = detectElementOverflow(parent, scrollContainer); | ||
const scrollContainerCollisions = detectElementOverflow(parent, scrollContainer); | ||
const documentCollisions = detectElementOverflow(parent, document.documentElement); | ||
@@ -70,14 +71,17 @@ const isX = axis === 'x'; | ||
const scroll = scrollContainer[scrollProperty]; | ||
const scrollbarWidth = scrollContainer[offsetSizeProperty] - scrollContainer[clientSizeProperty]; | ||
let availableStartSpace = ( | ||
-parentCollisions[overflowStartProperty] | ||
-Math.max( | ||
scrollContainerCollisions[overflowStartProperty], | ||
documentCollisions[overflowStartProperty] + document.documentElement[scrollProperty], | ||
) | ||
- spacing | ||
+ scroll | ||
); | ||
let availableEndSpace = ( | ||
-parentCollisions[overflowEndProperty] | ||
-Math.max( | ||
scrollContainerCollisions[overflowEndProperty], | ||
documentCollisions[overflowEndProperty] - document.documentElement[scrollProperty], | ||
) | ||
- spacing | ||
- scroll | ||
- scrollbarWidth | ||
@@ -285,3 +289,3 @@ ); | ||
this.scrollContainer = element && findScrollContainer(element); | ||
this.scrollContainer = findScrollContainer(element); | ||
}} | ||
@@ -288,0 +292,0 @@ style={{ display: 'contents' }} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45559
863