Socket
Socket
Sign inDemoInstall

react-scroll-into-view-if-needed

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-scroll-into-view-if-needed - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

3

coverage/coverage-final.json

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

{"/Users/jschrader/Documents/opensource/react-scroll-into-view-if-needed/src/index.js": {"path":"/Users/jschrader/Documents/opensource/react-scroll-into-view-if-needed/src/index.js","statementMap":{"0":{"start":{"line":7,"column":21},"end":{"line":44,"column":3}},"1":{"start":{"line":46,"column":24},"end":{"line":53,"column":3}},"2":{"start":{"line":56,"column":4},"end":{"line":56,"column":12}},"3":{"start":{"line":57,"column":4},"end":{"line":57,"column":28}},"4":{"start":{"line":61,"column":23},"end":{"line":61,"column":33}},"5":{"start":{"line":62,"column":4},"end":{"line":64,"column":5}},"6":{"start":{"line":63,"column":6},"end":{"line":63,"column":42}},"7":{"start":{"line":68,"column":36},"end":{"line":68,"column":46}},"8":{"start":{"line":69,"column":4},"end":{"line":71,"column":5}},"9":{"start":{"line":70,"column":6},"end":{"line":70,"column":42}},"10":{"start":{"line":74,"column":33},"end":{"line":78,"column":3}},"11":{"start":{"line":75,"column":24},"end":{"line":75,"column":34}},"12":{"start":{"line":76,"column":30},"end":{"line":76,"column":39}},"13":{"start":{"line":77,"column":4},"end":{"line":77,"column":42}},"14":{"start":{"line":87,"column":8},"end":{"line":87,"column":18}},"15":{"start":{"line":88,"column":4},"end":{"line":88,"column":85}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":55,"column":2},"end":{"line":55,"column":3}},"loc":{"start":{"line":55,"column":16},"end":{"line":58,"column":3}},"line":55},"1":{"name":"(anonymous_1)","decl":{"start":{"line":60,"column":2},"end":{"line":60,"column":3}},"loc":{"start":{"line":60,"column":22},"end":{"line":65,"column":3}},"line":60},"2":{"name":"(anonymous_2)","decl":{"start":{"line":67,"column":2},"end":{"line":67,"column":3}},"loc":{"start":{"line":67,"column":33},"end":{"line":72,"column":3}},"line":67},"3":{"name":"(anonymous_3)","decl":{"start":{"line":74,"column":33},"end":{"line":74,"column":34}},"loc":{"start":{"line":74,"column":39},"end":{"line":78,"column":3}},"line":74},"4":{"name":"(anonymous_4)","decl":{"start":{"line":80,"column":2},"end":{"line":80,"column":3}},"loc":{"start":{"line":80,"column":11},"end":{"line":89,"column":3}},"line":80}},"branchMap":{"0":{"loc":{"start":{"line":62,"column":4},"end":{"line":64,"column":5}},"type":"if","locations":[{"start":{"line":62,"column":4},"end":{"line":64,"column":5}},{"start":{"line":62,"column":4},"end":{"line":64,"column":5}}],"line":62},"1":{"loc":{"start":{"line":69,"column":4},"end":{"line":71,"column":5}},"type":"if","locations":[{"start":{"line":69,"column":4},"end":{"line":71,"column":5}},{"start":{"line":69,"column":4},"end":{"line":71,"column":5}}],"line":69},"2":{"loc":{"start":{"line":69,"column":8},"end":{"line":69,"column":30}},"type":"binary-expr","locations":[{"start":{"line":69,"column":8},"end":{"line":69,"column":15}},{"start":{"line":69,"column":19},"end":{"line":69,"column":30}}],"line":69}},"s":{"0":1,"1":1,"2":6,"3":6,"4":6,"5":6,"6":4,"7":2,"8":2,"9":1,"10":6,"11":5,"12":5,"13":5,"14":8,"15":8},"f":{"0":6,"1":6,"2":2,"3":5,"4":8},"b":{"0":[4,2],"1":[1,1],"2":[2,2]},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"1bb21424fcd7862e44337ed1a6662b9f06b4d3a6"}
}
{}
import { createRef, createElement, PureComponent } from 'react';
import PropTypes from 'prop-types';
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _classCallCheck(instance, Constructor) {

@@ -41,21 +79,2 @@ if (!(instance instanceof Constructor)) {

function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _inherits(subClass, superClass) {

@@ -92,2 +111,15 @@ if (typeof superClass !== "function" && superClass !== null) {

function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -145,177 +177,22 @@ if (source == null) return {};

function isElement(el) {
return el != null && typeof el === 'object' && el.nodeType === 1;
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
function canOverflow(overflow, skipOverflowHiddenElements) {
if (skipOverflowHiddenElements && overflow === 'hidden') {
return false;
}
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
return overflow !== 'visible' && overflow !== 'clip';
}
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
function isScrollable(el, skipOverflowHiddenElements) {
if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {
var style = getComputedStyle(el, null);
return canOverflow(style.overflowY, skipOverflowHiddenElements) || canOverflow(style.overflowX, skipOverflowHiddenElements);
}
return false;
}
function alignNearest(scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, scrollingBorderStart, scrollingBorderEnd, elementEdgeStart, elementEdgeEnd, elementSize) {
if (elementEdgeStart < scrollingEdgeStart && elementEdgeEnd > scrollingEdgeEnd || elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd) {
return 0;
}
if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {
return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;
}
if (elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize || elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize) {
return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd;
}
return 0;
}
var compute = (function (target, options) {
var scrollMode = options.scrollMode,
block = options.block,
inline = options.inline,
boundary = options.boundary,
skipOverflowHiddenElements = options.skipOverflowHiddenElements;
var checkBoundary = typeof boundary === 'function' ? boundary : function (node) {
return node !== boundary;
};
if (!isElement(target)) {
throw new TypeError('Invalid target');
}
var scrollingElement = document.scrollingElement || document.documentElement;
var frames = [];
var cursor = target;
while (isElement(cursor) && checkBoundary(cursor)) {
cursor = cursor.parentNode;
if (cursor === scrollingElement) {
frames.push(cursor);
break;
}
if (cursor === document.body && isScrollable(cursor) && !isScrollable(document.documentElement)) {
continue;
}
if (isScrollable(cursor, skipOverflowHiddenElements)) {
frames.push(cursor);
}
}
var viewportWidth = window.visualViewport ? visualViewport.width : innerWidth;
var viewportHeight = window.visualViewport ? visualViewport.height : innerHeight;
var viewportX = window.scrollX || pageXOffset;
var viewportY = window.scrollY || pageYOffset;
var _target$getBoundingCl = target.getBoundingClientRect(),
targetHeight = _target$getBoundingCl.height,
targetWidth = _target$getBoundingCl.width,
targetTop = _target$getBoundingCl.top,
targetRight = _target$getBoundingCl.right,
targetBottom = _target$getBoundingCl.bottom,
targetLeft = _target$getBoundingCl.left;
var targetBlock = block === 'start' || block === 'nearest' ? targetTop : block === 'end' ? targetBottom : targetTop + targetHeight / 2;
var targetInline = inline === 'center' ? targetLeft + targetWidth / 2 : inline === 'end' ? targetRight : targetLeft;
var computations = [];
for (var index = 0; index < frames.length; index++) {
var frame = frames[index];
var _frame$getBoundingCli = frame.getBoundingClientRect(),
_height = _frame$getBoundingCli.height,
_width = _frame$getBoundingCli.width,
_top = _frame$getBoundingCli.top,
right = _frame$getBoundingCli.right,
bottom = _frame$getBoundingCli.bottom,
_left = _frame$getBoundingCli.left;
if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= _top && targetBottom <= bottom && targetLeft >= _left && targetRight <= right) {
return computations;
}
var frameStyle = getComputedStyle(frame);
var borderLeft = parseInt(frameStyle.borderLeftWidth, 10);
var borderTop = parseInt(frameStyle.borderTopWidth, 10);
var borderRight = parseInt(frameStyle.borderRightWidth, 10);
var borderBottom = parseInt(frameStyle.borderBottomWidth, 10);
var blockScroll = 0;
var inlineScroll = 0;
var scrollbarWidth = 'offsetWidth' in frame ? frame.offsetWidth - frame.clientWidth - borderLeft - borderRight : 0;
var scrollbarHeight = 'offsetHeight' in frame ? frame.offsetHeight - frame.clientHeight - borderTop - borderBottom : 0;
if (scrollingElement === frame) {
if (block === 'start') {
blockScroll = targetBlock;
} else if (block === 'end') {
blockScroll = targetBlock - viewportHeight;
} else if (block === 'nearest') {
blockScroll = alignNearest(viewportY, viewportY + viewportHeight, viewportHeight, borderTop, borderBottom, viewportY + targetBlock, viewportY + targetBlock + targetHeight, targetHeight);
} else {
blockScroll = targetBlock - viewportHeight / 2;
}
if (inline === 'start') {
inlineScroll = targetInline;
} else if (inline === 'center') {
inlineScroll = targetInline - viewportWidth / 2;
} else if (inline === 'end') {
inlineScroll = targetInline - viewportWidth;
} else {
inlineScroll = alignNearest(viewportX, viewportX + viewportWidth, viewportWidth, borderLeft, borderRight, viewportX + targetInline, viewportX + targetInline + targetWidth, targetWidth);
}
blockScroll = Math.max(0, blockScroll + viewportY);
inlineScroll = Math.max(0, inlineScroll + viewportX);
result = Reflect.construct(Super, arguments, NewTarget);
} else {
if (block === 'start') {
blockScroll = targetBlock - _top - borderTop;
} else if (block === 'end') {
blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight;
} else if (block === 'nearest') {
blockScroll = alignNearest(_top, bottom, _height, borderTop, borderBottom + scrollbarHeight, targetBlock, targetBlock + targetHeight, targetHeight);
} else {
blockScroll = targetBlock - (_top + _height / 2) + scrollbarHeight / 2;
}
if (inline === 'start') {
inlineScroll = targetInline - _left - borderLeft;
} else if (inline === 'center') {
inlineScroll = targetInline - (_left + _width / 2) + scrollbarWidth / 2;
} else if (inline === 'end') {
inlineScroll = targetInline - right + borderRight + scrollbarWidth;
} else {
inlineScroll = alignNearest(_left, right, _width, borderLeft, borderRight + scrollbarWidth, targetInline, targetInline + targetWidth, targetWidth);
}
var scrollLeft = frame.scrollLeft,
scrollTop = frame.scrollTop;
blockScroll = Math.max(0, Math.min(scrollTop + blockScroll, frame.scrollHeight - _height + scrollbarHeight));
inlineScroll = Math.max(0, Math.min(scrollLeft + inlineScroll, frame.scrollWidth - _width + scrollbarWidth));
targetBlock += scrollTop - blockScroll;
targetInline += scrollLeft - inlineScroll;
result = Super.apply(this, arguments);
}
computations.push({
el: frame,
top: blockScroll,
left: inlineScroll
});
}
return _possibleConstructorReturn(this, result);
};
}
return computations;
});
function t(t){return "object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return (!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return !1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}function compute(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&n(p)&&!n(document.documentElement)||null!=p&&n(p,a)&&s.push(p);}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x="start"===d||"nearest"===d?y:"end"===d?M:y+b/2,I="center"===u?V+H/2:"end"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if("if-needed"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J="offsetWidth"in k?k.offsetWidth-k.clientWidth-j-z:0,K="offsetHeight"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F="start"===d?x:"end"===d?x-g:"nearest"===d?r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G="start"===u?I:"center"===u?I-m/2:"end"===u?I-m:r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else {F="start"===d?x-R-q:"end"===d?x-Y+A+K:"nearest"===d?r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G="start"===u?I-L-j:"center"===u?I-(L+O/2)+J/2:"end"===u?I-X+z+J:r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)));}C.push({el:k,top:F,left:G});}return C}

@@ -331,3 +208,3 @@ function isOptionsObject(options) {

var canSmoothScroll = 'scrollBehavior' in document.body.style;
var canSmoothScroll = ('scrollBehavior' in document.body.style);
actions.forEach(function (_ref) {

@@ -384,7 +261,7 @@ var el = _ref.el,

var ScrollIntoViewIfNeeded =
/*#__PURE__*/
function (_PureComponent) {
var ScrollIntoViewIfNeeded = /*#__PURE__*/function (_PureComponent) {
_inherits(ScrollIntoViewIfNeeded, _PureComponent);
var _super = _createSuper(ScrollIntoViewIfNeeded);
function ScrollIntoViewIfNeeded() {

@@ -395,3 +272,3 @@ var _this;

_this = _possibleConstructorReturn(this, _getPrototypeOf(ScrollIntoViewIfNeeded).call(this));
_this = _super.call(this);

@@ -404,3 +281,3 @@ _defineProperty(_assertThisInitialized(_this), "handleScrollIntoViewIfNeeded", function () {

_this.node = createRef();
_this.node = /*#__PURE__*/createRef();
return _this;

@@ -431,10 +308,10 @@ }

value: function render() {
var _this$props = this.props,
active = _this$props.active,
elementType = _this$props.elementType,
children = _this$props.children,
options = _this$props.options,
wrapperProps = _objectWithoutProperties(_this$props, ["active", "elementType", "children", "options"]);
var _this$props = this.props;
_this$props.active;
var elementType = _this$props.elementType,
children = _this$props.children;
_this$props.options;
var wrapperProps = _objectWithoutProperties(_this$props, ["active", "elementType", "children", "options"]);
return createElement(elementType, _objectSpread({
return /*#__PURE__*/createElement(elementType, _objectSpread2({
ref: this.node

@@ -457,4 +334,3 @@ }, wrapperProps), children);

scrollMode: PropTypes.oneOf(['always', 'if-needed']),
boundary: PropTypes.oneOfType([// eslint-disable-next-line no-undef
PropTypes.instanceOf(Element), PropTypes.func]),
boundary: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
skipOverflowHiddenElements: PropTypes.bool

@@ -461,0 +337,0 @@ })

@@ -5,2 +5,40 @@ import { createRef, createElement, PureComponent } from 'react';

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _classCallCheck(instance, Constructor) {

@@ -43,21 +81,2 @@ if (!(instance instanceof Constructor)) {

function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _inherits(subClass, superClass) {

@@ -94,2 +113,15 @@ if (typeof superClass !== "function" && superClass !== null) {

function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -147,7 +179,26 @@ if (source == null) return {};

var ScrollIntoViewIfNeeded =
/*#__PURE__*/
function (_PureComponent) {
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var ScrollIntoViewIfNeeded = /*#__PURE__*/function (_PureComponent) {
_inherits(ScrollIntoViewIfNeeded, _PureComponent);
var _super = _createSuper(ScrollIntoViewIfNeeded);
function ScrollIntoViewIfNeeded() {

@@ -158,3 +209,3 @@ var _this;

_this = _possibleConstructorReturn(this, _getPrototypeOf(ScrollIntoViewIfNeeded).call(this));
_this = _super.call(this);

@@ -167,3 +218,3 @@ _defineProperty(_assertThisInitialized(_this), "handleScrollIntoViewIfNeeded", function () {

_this.node = createRef();
_this.node = /*#__PURE__*/createRef();
return _this;

@@ -194,10 +245,10 @@ }

value: function render() {
var _this$props = this.props,
active = _this$props.active,
elementType = _this$props.elementType,
children = _this$props.children,
options = _this$props.options,
wrapperProps = _objectWithoutProperties(_this$props, ["active", "elementType", "children", "options"]);
var _this$props = this.props;
_this$props.active;
var elementType = _this$props.elementType,
children = _this$props.children;
_this$props.options;
var wrapperProps = _objectWithoutProperties(_this$props, ["active", "elementType", "children", "options"]);
return createElement(elementType, _objectSpread({
return /*#__PURE__*/createElement(elementType, _objectSpread2({
ref: this.node

@@ -220,4 +271,3 @@ }, wrapperProps), children);

scrollMode: PropTypes.oneOf(['always', 'if-needed']),
boundary: PropTypes.oneOfType([// eslint-disable-next-line no-undef
PropTypes.instanceOf(Element), PropTypes.func]),
boundary: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
skipOverflowHiddenElements: PropTypes.bool

@@ -224,0 +274,0 @@ })

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('prop-types')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', 'prop-types'], factory) :
(global = global || self, factory(global['react-scroll-into-view-if-needed'] = {}, global.React, global.PropTypes));
}(this, function (exports, react, PropTypes) { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['react-scroll-into-view-if-needed'] = {}, global.React, global.PropTypes));
}(this, (function (exports, react, PropTypes) { 'use strict';
PropTypes = PropTypes && PropTypes.hasOwnProperty('default') ? PropTypes['default'] : PropTypes;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _classCallCheck(instance, Constructor) {

@@ -46,21 +86,2 @@ if (!(instance instanceof Constructor)) {

function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _inherits(subClass, superClass) {

@@ -97,2 +118,15 @@ if (typeof superClass !== "function" && superClass !== null) {

function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -150,177 +184,22 @@ if (source == null) return {};

function isElement(el) {
return el != null && typeof el === 'object' && el.nodeType === 1;
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
function canOverflow(overflow, skipOverflowHiddenElements) {
if (skipOverflowHiddenElements && overflow === 'hidden') {
return false;
}
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
return overflow !== 'visible' && overflow !== 'clip';
}
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
function isScrollable(el, skipOverflowHiddenElements) {
if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {
var style = getComputedStyle(el, null);
return canOverflow(style.overflowY, skipOverflowHiddenElements) || canOverflow(style.overflowX, skipOverflowHiddenElements);
}
return false;
}
function alignNearest(scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, scrollingBorderStart, scrollingBorderEnd, elementEdgeStart, elementEdgeEnd, elementSize) {
if (elementEdgeStart < scrollingEdgeStart && elementEdgeEnd > scrollingEdgeEnd || elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd) {
return 0;
}
if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {
return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;
}
if (elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize || elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize) {
return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd;
}
return 0;
}
var compute = (function (target, options) {
var scrollMode = options.scrollMode,
block = options.block,
inline = options.inline,
boundary = options.boundary,
skipOverflowHiddenElements = options.skipOverflowHiddenElements;
var checkBoundary = typeof boundary === 'function' ? boundary : function (node) {
return node !== boundary;
};
if (!isElement(target)) {
throw new TypeError('Invalid target');
}
var scrollingElement = document.scrollingElement || document.documentElement;
var frames = [];
var cursor = target;
while (isElement(cursor) && checkBoundary(cursor)) {
cursor = cursor.parentNode;
if (cursor === scrollingElement) {
frames.push(cursor);
break;
}
if (cursor === document.body && isScrollable(cursor) && !isScrollable(document.documentElement)) {
continue;
}
if (isScrollable(cursor, skipOverflowHiddenElements)) {
frames.push(cursor);
}
}
var viewportWidth = window.visualViewport ? visualViewport.width : innerWidth;
var viewportHeight = window.visualViewport ? visualViewport.height : innerHeight;
var viewportX = window.scrollX || pageXOffset;
var viewportY = window.scrollY || pageYOffset;
var _target$getBoundingCl = target.getBoundingClientRect(),
targetHeight = _target$getBoundingCl.height,
targetWidth = _target$getBoundingCl.width,
targetTop = _target$getBoundingCl.top,
targetRight = _target$getBoundingCl.right,
targetBottom = _target$getBoundingCl.bottom,
targetLeft = _target$getBoundingCl.left;
var targetBlock = block === 'start' || block === 'nearest' ? targetTop : block === 'end' ? targetBottom : targetTop + targetHeight / 2;
var targetInline = inline === 'center' ? targetLeft + targetWidth / 2 : inline === 'end' ? targetRight : targetLeft;
var computations = [];
for (var index = 0; index < frames.length; index++) {
var frame = frames[index];
var _frame$getBoundingCli = frame.getBoundingClientRect(),
_height = _frame$getBoundingCli.height,
_width = _frame$getBoundingCli.width,
_top = _frame$getBoundingCli.top,
right = _frame$getBoundingCli.right,
bottom = _frame$getBoundingCli.bottom,
_left = _frame$getBoundingCli.left;
if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= _top && targetBottom <= bottom && targetLeft >= _left && targetRight <= right) {
return computations;
}
var frameStyle = getComputedStyle(frame);
var borderLeft = parseInt(frameStyle.borderLeftWidth, 10);
var borderTop = parseInt(frameStyle.borderTopWidth, 10);
var borderRight = parseInt(frameStyle.borderRightWidth, 10);
var borderBottom = parseInt(frameStyle.borderBottomWidth, 10);
var blockScroll = 0;
var inlineScroll = 0;
var scrollbarWidth = 'offsetWidth' in frame ? frame.offsetWidth - frame.clientWidth - borderLeft - borderRight : 0;
var scrollbarHeight = 'offsetHeight' in frame ? frame.offsetHeight - frame.clientHeight - borderTop - borderBottom : 0;
if (scrollingElement === frame) {
if (block === 'start') {
blockScroll = targetBlock;
} else if (block === 'end') {
blockScroll = targetBlock - viewportHeight;
} else if (block === 'nearest') {
blockScroll = alignNearest(viewportY, viewportY + viewportHeight, viewportHeight, borderTop, borderBottom, viewportY + targetBlock, viewportY + targetBlock + targetHeight, targetHeight);
} else {
blockScroll = targetBlock - viewportHeight / 2;
}
if (inline === 'start') {
inlineScroll = targetInline;
} else if (inline === 'center') {
inlineScroll = targetInline - viewportWidth / 2;
} else if (inline === 'end') {
inlineScroll = targetInline - viewportWidth;
} else {
inlineScroll = alignNearest(viewportX, viewportX + viewportWidth, viewportWidth, borderLeft, borderRight, viewportX + targetInline, viewportX + targetInline + targetWidth, targetWidth);
}
blockScroll = Math.max(0, blockScroll + viewportY);
inlineScroll = Math.max(0, inlineScroll + viewportX);
result = Reflect.construct(Super, arguments, NewTarget);
} else {
if (block === 'start') {
blockScroll = targetBlock - _top - borderTop;
} else if (block === 'end') {
blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight;
} else if (block === 'nearest') {
blockScroll = alignNearest(_top, bottom, _height, borderTop, borderBottom + scrollbarHeight, targetBlock, targetBlock + targetHeight, targetHeight);
} else {
blockScroll = targetBlock - (_top + _height / 2) + scrollbarHeight / 2;
}
if (inline === 'start') {
inlineScroll = targetInline - _left - borderLeft;
} else if (inline === 'center') {
inlineScroll = targetInline - (_left + _width / 2) + scrollbarWidth / 2;
} else if (inline === 'end') {
inlineScroll = targetInline - right + borderRight + scrollbarWidth;
} else {
inlineScroll = alignNearest(_left, right, _width, borderLeft, borderRight + scrollbarWidth, targetInline, targetInline + targetWidth, targetWidth);
}
var scrollLeft = frame.scrollLeft,
scrollTop = frame.scrollTop;
blockScroll = Math.max(0, Math.min(scrollTop + blockScroll, frame.scrollHeight - _height + scrollbarHeight));
inlineScroll = Math.max(0, Math.min(scrollLeft + inlineScroll, frame.scrollWidth - _width + scrollbarWidth));
targetBlock += scrollTop - blockScroll;
targetInline += scrollLeft - inlineScroll;
result = Super.apply(this, arguments);
}
computations.push({
el: frame,
top: blockScroll,
left: inlineScroll
});
}
return _possibleConstructorReturn(this, result);
};
}
return computations;
});
function t(t){return "object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return (!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return !1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}function compute(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&n(p)&&!n(document.documentElement)||null!=p&&n(p,a)&&s.push(p);}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x="start"===d||"nearest"===d?y:"end"===d?M:y+b/2,I="center"===u?V+H/2:"end"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if("if-needed"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J="offsetWidth"in k?k.offsetWidth-k.clientWidth-j-z:0,K="offsetHeight"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F="start"===d?x:"end"===d?x-g:"nearest"===d?r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G="start"===u?I:"center"===u?I-m/2:"end"===u?I-m:r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else {F="start"===d?x-R-q:"end"===d?x-Y+A+K:"nearest"===d?r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G="start"===u?I-L-j:"center"===u?I-(L+O/2)+J/2:"end"===u?I-X+z+J:r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)));}C.push({el:k,top:F,left:G});}return C}

@@ -336,3 +215,3 @@ function isOptionsObject(options) {

var canSmoothScroll = 'scrollBehavior' in document.body.style;
var canSmoothScroll = ('scrollBehavior' in document.body.style);
actions.forEach(function (_ref) {

@@ -389,7 +268,7 @@ var el = _ref.el,

var ScrollIntoViewIfNeeded =
/*#__PURE__*/
function (_PureComponent) {
var ScrollIntoViewIfNeeded = /*#__PURE__*/function (_PureComponent) {
_inherits(ScrollIntoViewIfNeeded, _PureComponent);
var _super = _createSuper(ScrollIntoViewIfNeeded);
function ScrollIntoViewIfNeeded() {

@@ -400,3 +279,3 @@ var _this;

_this = _possibleConstructorReturn(this, _getPrototypeOf(ScrollIntoViewIfNeeded).call(this));
_this = _super.call(this);

@@ -409,3 +288,3 @@ _defineProperty(_assertThisInitialized(_this), "handleScrollIntoViewIfNeeded", function () {

_this.node = react.createRef();
_this.node = /*#__PURE__*/react.createRef();
return _this;

@@ -436,10 +315,10 @@ }

value: function render() {
var _this$props = this.props,
active = _this$props.active,
elementType = _this$props.elementType,
children = _this$props.children,
options = _this$props.options,
wrapperProps = _objectWithoutProperties(_this$props, ["active", "elementType", "children", "options"]);
var _this$props = this.props;
_this$props.active;
var elementType = _this$props.elementType,
children = _this$props.children;
_this$props.options;
var wrapperProps = _objectWithoutProperties(_this$props, ["active", "elementType", "children", "options"]);
return react.createElement(elementType, _objectSpread({
return /*#__PURE__*/react.createElement(elementType, _objectSpread2({
ref: this.node

@@ -453,14 +332,13 @@ }, wrapperProps), children);

ScrollIntoViewIfNeeded.propTypes = {
active: PropTypes.bool,
children: PropTypes.node.isRequired,
elementType: PropTypes.string,
active: PropTypes__default['default'].bool,
children: PropTypes__default['default'].node.isRequired,
elementType: PropTypes__default['default'].string,
// this shape should mirror the scroll-into-view-if-needed options
options: PropTypes.shape({
behavior: PropTypes.oneOfType([PropTypes.oneOf(['auto', 'smooth', 'instant']), PropTypes.func]),
block: PropTypes.oneOf(['center', 'end', 'nearest', 'start']),
inline: PropTypes.oneOf(['center', 'end', 'nearest', 'start']),
scrollMode: PropTypes.oneOf(['always', 'if-needed']),
boundary: PropTypes.oneOfType([// eslint-disable-next-line no-undef
PropTypes.instanceOf(Element), PropTypes.func]),
skipOverflowHiddenElements: PropTypes.bool
options: PropTypes__default['default'].shape({
behavior: PropTypes__default['default'].oneOfType([PropTypes__default['default'].oneOf(['auto', 'smooth', 'instant']), PropTypes__default['default'].func]),
block: PropTypes__default['default'].oneOf(['center', 'end', 'nearest', 'start']),
inline: PropTypes__default['default'].oneOf(['center', 'end', 'nearest', 'start']),
scrollMode: PropTypes__default['default'].oneOf(['always', 'if-needed']),
boundary: PropTypes__default['default'].oneOfType([PropTypes__default['default'].element, PropTypes__default['default'].func]),
skipOverflowHiddenElements: PropTypes__default['default'].bool
})

@@ -481,3 +359,3 @@ };

}));
})));
//# sourceMappingURL=index.js.map
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('prop-types'), require('scroll-into-view-if-needed')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', 'prop-types', 'scroll-into-view-if-needed'], factory) :
(global = global || self, factory(global['react-scroll-into-view-if-needed'] = {}, global.React, global.PropTypes, global.scrollIntoViewIfNeeded));
}(this, function (exports, react, PropTypes, scrollIntoViewIfNeeded) { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['react-scroll-into-view-if-needed'] = {}, global.React, global.PropTypes, global.scrollIntoViewIfNeeded));
}(this, (function (exports, react, PropTypes, scrollIntoViewIfNeeded) { 'use strict';
PropTypes = PropTypes && PropTypes.hasOwnProperty('default') ? PropTypes['default'] : PropTypes;
scrollIntoViewIfNeeded = scrollIntoViewIfNeeded && scrollIntoViewIfNeeded.hasOwnProperty('default') ? scrollIntoViewIfNeeded['default'] : scrollIntoViewIfNeeded;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
var scrollIntoViewIfNeeded__default = /*#__PURE__*/_interopDefaultLegacy(scrollIntoViewIfNeeded);
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _classCallCheck(instance, Constructor) {

@@ -47,21 +87,2 @@ if (!(instance instanceof Constructor)) {

function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _inherits(subClass, superClass) {

@@ -98,2 +119,15 @@ if (typeof superClass !== "function" && superClass !== null) {

function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -151,7 +185,26 @@ if (source == null) return {};

var ScrollIntoViewIfNeeded =
/*#__PURE__*/
function (_PureComponent) {
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var ScrollIntoViewIfNeeded = /*#__PURE__*/function (_PureComponent) {
_inherits(ScrollIntoViewIfNeeded, _PureComponent);
var _super = _createSuper(ScrollIntoViewIfNeeded);
function ScrollIntoViewIfNeeded() {

@@ -162,3 +215,3 @@ var _this;

_this = _possibleConstructorReturn(this, _getPrototypeOf(ScrollIntoViewIfNeeded).call(this));
_this = _super.call(this);

@@ -168,6 +221,6 @@ _defineProperty(_assertThisInitialized(_this), "handleScrollIntoViewIfNeeded", function () {

var node = _this.node.current;
scrollIntoViewIfNeeded(node, options);
scrollIntoViewIfNeeded__default['default'](node, options);
});
_this.node = react.createRef();
_this.node = /*#__PURE__*/react.createRef();
return _this;

@@ -198,10 +251,10 @@ }

value: function render() {
var _this$props = this.props,
active = _this$props.active,
elementType = _this$props.elementType,
children = _this$props.children,
options = _this$props.options,
wrapperProps = _objectWithoutProperties(_this$props, ["active", "elementType", "children", "options"]);
var _this$props = this.props;
_this$props.active;
var elementType = _this$props.elementType,
children = _this$props.children;
_this$props.options;
var wrapperProps = _objectWithoutProperties(_this$props, ["active", "elementType", "children", "options"]);
return react.createElement(elementType, _objectSpread({
return /*#__PURE__*/react.createElement(elementType, _objectSpread2({
ref: this.node

@@ -215,14 +268,13 @@ }, wrapperProps), children);

ScrollIntoViewIfNeeded.propTypes = {
active: PropTypes.bool,
children: PropTypes.node.isRequired,
elementType: PropTypes.string,
active: PropTypes__default['default'].bool,
children: PropTypes__default['default'].node.isRequired,
elementType: PropTypes__default['default'].string,
// this shape should mirror the scroll-into-view-if-needed options
options: PropTypes.shape({
behavior: PropTypes.oneOfType([PropTypes.oneOf(['auto', 'smooth', 'instant']), PropTypes.func]),
block: PropTypes.oneOf(['center', 'end', 'nearest', 'start']),
inline: PropTypes.oneOf(['center', 'end', 'nearest', 'start']),
scrollMode: PropTypes.oneOf(['always', 'if-needed']),
boundary: PropTypes.oneOfType([// eslint-disable-next-line no-undef
PropTypes.instanceOf(Element), PropTypes.func]),
skipOverflowHiddenElements: PropTypes.bool
options: PropTypes__default['default'].shape({
behavior: PropTypes__default['default'].oneOfType([PropTypes__default['default'].oneOf(['auto', 'smooth', 'instant']), PropTypes__default['default'].func]),
block: PropTypes__default['default'].oneOf(['center', 'end', 'nearest', 'start']),
inline: PropTypes__default['default'].oneOf(['center', 'end', 'nearest', 'start']),
scrollMode: PropTypes__default['default'].oneOf(['always', 'if-needed']),
boundary: PropTypes__default['default'].oneOfType([PropTypes__default['default'].element, PropTypes__default['default'].func]),
skipOverflowHiddenElements: PropTypes__default['default'].bool
})

@@ -243,3 +295,3 @@ };

}));
})));
//# sourceMappingURL=standalone.js.map
{
"name": "react-scroll-into-view-if-needed",
"version": "3.0.0",
"version": "3.0.1",
"description": "A thin component wrapper around scroll-into-view-if-needed",

@@ -5,0 +5,0 @@ "main": "dist/umd/index.js",

@@ -74,4 +74,3 @@ import { createElement, createRef, PureComponent } from 'react';

boundary: PropTypes.oneOfType([
// eslint-disable-next-line no-undef
PropTypes.instanceOf(Element),
PropTypes.element,
PropTypes.func,

@@ -78,0 +77,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

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