jobiqo-cl
Version:
[](https://circleci.com/gh/jobiqo/jobiqo-cl)
40 lines (37 loc) • 2.13 kB
JavaScript
import { __rest, __assign } from '../../../tslib/tslib.es6.js';
import { forwardRef, useRef, useState, createElement, Fragment, cloneElement, Children } from 'react';
import '../../../use-callback-ref/dist/es2015/assignRef.js';
import '../../../use-callback-ref/dist/es2015/useRef.js';
import { useMergeRefs } from '../../../use-callback-ref/dist/es2015/useMergeRef.js';
import { fullWidthClassName, zeroRightClassName } from '../../../react-remove-scroll-bar/dist/es2015/constants.js';
import { effectCar } from './medium.js';
var nothing = function () {
return;
};
var RemoveScroll = forwardRef(function (props, parentRef) {
var ref = useRef(null);
var _a = useState({
onScrollCapture: nothing,
onWheelCapture: nothing,
onTouchMoveCapture: nothing
}), 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, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom"]);
var SideCar = sideCar;
var containerProps = __assign({ ref: useMergeRefs([
ref,
parentRef
]) }, rest, callbacks);
return (createElement(Fragment, null,
enabled && (createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
forwardProps ? (cloneElement(Children.only(children), containerProps)) : (createElement("div", __assign({}, containerProps, { className: className }), children))));
});
RemoveScroll.defaultProps = {
enabled: true,
removeScrollBar: true,
inert: false
};
RemoveScroll.classNames = {
fullWidth: fullWidthClassName,
zeroRight: zeroRightClassName
};
export { RemoveScroll };