Socket
Socket
Sign inDemoInstall

react-remove-scroll

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-remove-scroll - npm Package Compare versions

Comparing version 2.5.5 to 2.5.6

dist/index.js

3

dist/es2015/handleScroll.js

@@ -16,2 +16,3 @@ var alwaysContainsScroll = function (node) {

export var locationCouldBeScrolled = function (axis, node) {
var ownerDocument = node.ownerDocument;
var current = node;

@@ -31,3 +32,3 @@ do {

current = current.parentNode;
} while (current && current !== document.body);
} while (current && current !== ownerDocument.body);
return false;

@@ -34,0 +35,0 @@ };

@@ -23,3 +23,3 @@ import { __spreadArray } from "tslib";

var id = React.useState(idCounter++)[0];
var Style = React.useState(function () { return styleSingleton(); })[0];
var Style = React.useState(styleSingleton)[0];
var lastProps = React.useRef(props);

@@ -146,3 +146,3 @@ React.useEffect(function () {

inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,
removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: "margin" }) : null));
removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null));
}

@@ -6,2 +6,3 @@ import * as React from 'react';

export declare type Axis = 'v' | 'h';
export declare type GapMode = 'padding' | 'margin';
export interface RemoveScrollEffectCallbacks {

@@ -23,4 +24,5 @@ onScrollCapture(event: any): void;

/**
* if forwardProps is true - children should be single Element
* which would NOT with a div
* if forwardProps is true - everything will be forwarded to a single child node
* otherwise - a Container, controlled by `as` prop will be rendered in place
* @default false
* @see {@link IRemoveScrollSelfProps.as}

@@ -69,2 +71,7 @@ */

as?: string | React.ElementType;
/**
* controls the way "gap" is filled
* @default "margin"
*/
gapMode?: GapMode;
}

@@ -82,2 +89,3 @@ export declare type IRemoveScrollProps = IRemoveScrollSelfProps & (ChildrenForward | ChildrenNode);

lockRef: RefObject<HTMLElement>;
gapMode?: GapMode;
setCallbacks(cb: RemoveScrollEffectCallbacks): void;

@@ -84,0 +92,0 @@ }

@@ -19,3 +19,3 @@ import { __assign, __rest } from "tslib";

}), callbacks = _a[0], setCallbacks = _a[1];
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]);
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
var SideCar = sideCar;

@@ -25,3 +25,3 @@ var containerRef = useMergeRefs([ref, parentRef]);

return (React.createElement(React.Fragment, null,
enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode: gapMode })),
forwardProps ? (React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));

@@ -28,0 +28,0 @@ });

@@ -15,2 +15,3 @@ const alwaysContainsScroll = (node) =>

export const locationCouldBeScrolled = (axis, node) => {
const ownerDocument = node.ownerDocument;
let current = node;

@@ -30,3 +31,3 @@ do {

current = current.parentNode;
} while (current && current !== document.body);
} while (current && current !== ownerDocument.body);
return false;

@@ -33,0 +34,0 @@ };

@@ -21,3 +21,3 @@ import * as React from 'react';

const [id] = React.useState(idCounter++);
const [Style] = React.useState(() => styleSingleton());
const [Style] = React.useState(styleSingleton);
const lastProps = React.useRef(props);

@@ -144,3 +144,3 @@ React.useEffect(() => {

inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,
removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: "margin" }) : null));
removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null));
}

@@ -6,2 +6,3 @@ import * as React from 'react';

export declare type Axis = 'v' | 'h';
export declare type GapMode = 'padding' | 'margin';
export interface RemoveScrollEffectCallbacks {

@@ -23,4 +24,5 @@ onScrollCapture(event: any): void;

/**
* if forwardProps is true - children should be single Element
* which would NOT with a div
* if forwardProps is true - everything will be forwarded to a single child node
* otherwise - a Container, controlled by `as` prop will be rendered in place
* @default false
* @see {@link IRemoveScrollSelfProps.as}

@@ -69,2 +71,7 @@ */

as?: string | React.ElementType;
/**
* controls the way "gap" is filled
* @default "margin"
*/
gapMode?: GapMode;
}

@@ -82,2 +89,3 @@ export declare type IRemoveScrollProps = IRemoveScrollSelfProps & (ChildrenForward | ChildrenNode);

lockRef: RefObject<HTMLElement>;
gapMode?: GapMode;
setCallbacks(cb: RemoveScrollEffectCallbacks): void;

@@ -84,0 +92,0 @@ }

@@ -18,3 +18,3 @@ import * as React from 'react';

});
const { forwardProps, children, className, removeScrollBar, enabled, shards, sideCar, noIsolation, inert, allowPinchZoom, as: Container = 'div', ...rest } = props;
const { forwardProps, children, className, removeScrollBar, enabled, shards, sideCar, noIsolation, inert, allowPinchZoom, as: Container = 'div', gapMode, ...rest } = props;
const SideCar = sideCar;

@@ -27,3 +27,3 @@ const containerRef = useMergeRefs([ref, parentRef]);

return (React.createElement(React.Fragment, null,
enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode: gapMode })),
forwardProps ? (React.cloneElement(React.Children.only(children), {

@@ -30,0 +30,0 @@ ...containerProps,

@@ -19,2 +19,3 @@ "use strict";

var locationCouldBeScrolled = function (axis, node) {
var ownerDocument = node.ownerDocument;
var current = node;

@@ -34,3 +35,3 @@ do {

current = current.parentNode;
} while (current && current !== document.body);
} while (current && current !== ownerDocument.body);
return false;

@@ -37,0 +38,0 @@ };

@@ -28,3 +28,3 @@ "use strict";

var id = React.useState(idCounter++)[0];
var Style = React.useState(function () { return (0, react_style_singleton_1.styleSingleton)(); })[0];
var Style = React.useState(react_style_singleton_1.styleSingleton)[0];
var lastProps = React.useRef(props);

@@ -151,4 +151,4 @@ React.useEffect(function () {

inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,
removeScrollBar ? React.createElement(react_remove_scroll_bar_1.RemoveScrollBar, { gapMode: "margin" }) : null));
removeScrollBar ? React.createElement(react_remove_scroll_bar_1.RemoveScrollBar, { gapMode: props.gapMode }) : null));
}
exports.RemoveScrollSideCar = RemoveScrollSideCar;

@@ -6,2 +6,3 @@ import * as React from 'react';

export declare type Axis = 'v' | 'h';
export declare type GapMode = 'padding' | 'margin';
export interface RemoveScrollEffectCallbacks {

@@ -23,4 +24,5 @@ onScrollCapture(event: any): void;

/**
* if forwardProps is true - children should be single Element
* which would NOT with a div
* if forwardProps is true - everything will be forwarded to a single child node
* otherwise - a Container, controlled by `as` prop will be rendered in place
* @default false
* @see {@link IRemoveScrollSelfProps.as}

@@ -69,2 +71,7 @@ */

as?: string | React.ElementType;
/**
* controls the way "gap" is filled
* @default "margin"
*/
gapMode?: GapMode;
}

@@ -82,2 +89,3 @@ export declare type IRemoveScrollProps = IRemoveScrollSelfProps & (ChildrenForward | ChildrenNode);

lockRef: RefObject<HTMLElement>;
gapMode?: GapMode;
setCallbacks(cb: RemoveScrollEffectCallbacks): void;

@@ -84,0 +92,0 @@ }

@@ -22,3 +22,3 @@ "use strict";

}), callbacks = _a[0], setCallbacks = _a[1];
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, rest = tslib_1.__rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]);
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, gapMode = props.gapMode, rest = tslib_1.__rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
var SideCar = sideCar;

@@ -28,3 +28,3 @@ var containerRef = (0, use_callback_ref_1.useMergeRefs)([ref, parentRef]);

return (React.createElement(React.Fragment, null,
enabled && (React.createElement(SideCar, { sideCar: medium_1.effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
enabled && (React.createElement(SideCar, { sideCar: medium_1.effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode: gapMode })),
forwardProps ? (React.cloneElement(React.Children.only(children), tslib_1.__assign(tslib_1.__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, tslib_1.__assign({}, containerProps, { className: className, ref: containerRef }), children))));

@@ -31,0 +31,0 @@ });

{
"name": "react-remove-scroll",
"version": "2.5.5",
"version": "2.5.6",
"description": "Disables scroll outside of `children` node.",

@@ -64,3 +64,3 @@ "main": "dist/es5/index.js",

"dependencies": {
"react-remove-scroll-bar": "^2.3.3",
"react-remove-scroll-bar": "^2.3.4",
"react-style-singleton": "^2.2.1",

@@ -96,3 +96,4 @@ "tslib": "^2.1.0",

"singleQuote": true
}
},
"packageManager": "yarn@1.22.19"
}
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