Socket
Socket
Sign inDemoInstall

react-custom-scrollbars

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-custom-scrollbars - npm Package Compare versions

Comparing version 4.0.0-beta.1 to 4.0.0-beta.2

lib/utils/isString.js

165

dist/react-custom-scrollbars.js

@@ -77,6 +77,6 @@ (function webpackUniversalModuleDefinition(root, factory) {

var prefix = __webpack_require__(11)
var toCamelCase = __webpack_require__(12)
var prefix = __webpack_require__(12)
var toCamelCase = __webpack_require__(13)
var cache = { 'float': 'cssFloat' }
var addPxToStyle = __webpack_require__(10)
var addPxToStyle = __webpack_require__(11)

@@ -241,3 +241,3 @@ function style (element, property, value) {

var _raf2 = __webpack_require__(15);
var _raf2 = __webpack_require__(16);

@@ -254,2 +254,6 @@ var _raf3 = _interopRequireDefault(_raf2);

var _isString = __webpack_require__(9);
var _isString2 = _interopRequireDefault(_isString);
var _getScrollbarWidth = __webpack_require__(8);

@@ -259,3 +263,3 @@

var _returnFalse = __webpack_require__(9);
var _returnFalse = __webpack_require__(10);

@@ -302,4 +306,4 @@ var _returnFalse2 = _interopRequireDefault(_returnFalse);

autoHeight: _react.PropTypes.bool,
autoHeightMin: _react.PropTypes.number,
autoHeightMax: _react.PropTypes.number,
autoHeightMin: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]),
autoHeightMax: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]),
universal: _react.PropTypes.bool,

@@ -768,52 +772,55 @@ style: _react.PropTypes.object,

this.raf(function () {
var _props4 = _this4.props;
var onUpdate = _props4.onUpdate;
var hideTracksWhenNotNeeded = _props4.hideTracksWhenNotNeeded;
return _this4._update(callback);
});
},
_update: function _update(callback) {
var _props4 = this.props;
var onUpdate = _props4.onUpdate;
var hideTracksWhenNotNeeded = _props4.hideTracksWhenNotNeeded;
var values = _this4.getValues();
if ((0, _getScrollbarWidth2["default"])()) {
var _refs11 = _this4.refs;
var thumbHorizontal = _refs11.thumbHorizontal;
var thumbVertical = _refs11.thumbVertical;
var trackHorizontal = _refs11.trackHorizontal;
var trackVertical = _refs11.trackVertical;
var scrollLeft = values.scrollLeft;
var clientWidth = values.clientWidth;
var scrollWidth = values.scrollWidth;
var values = this.getValues();
if ((0, _getScrollbarWidth2["default"])()) {
var _refs11 = this.refs;
var thumbHorizontal = _refs11.thumbHorizontal;
var thumbVertical = _refs11.thumbVertical;
var trackHorizontal = _refs11.trackHorizontal;
var trackVertical = _refs11.trackVertical;
var scrollLeft = values.scrollLeft;
var clientWidth = values.clientWidth;
var scrollWidth = values.scrollWidth;
var trackHorizontalWidth = (0, _getInnerWidth2["default"])(trackHorizontal);
var thumbHorizontalWidth = _this4.getThumbHorizontalWidth();
var thumbHorizontalX = scrollLeft / (scrollWidth - clientWidth) * (trackHorizontalWidth - thumbHorizontalWidth);
var thumbHorizontalStyle = {
width: thumbHorizontalWidth,
transform: 'translateX(' + thumbHorizontalX + 'px)'
};
var scrollTop = values.scrollTop;
var clientHeight = values.clientHeight;
var scrollHeight = values.scrollHeight;
var trackHorizontalWidth = (0, _getInnerWidth2["default"])(trackHorizontal);
var thumbHorizontalWidth = this.getThumbHorizontalWidth();
var thumbHorizontalX = scrollLeft / (scrollWidth - clientWidth) * (trackHorizontalWidth - thumbHorizontalWidth);
var thumbHorizontalStyle = {
width: thumbHorizontalWidth,
transform: 'translateX(' + thumbHorizontalX + 'px)'
};
var scrollTop = values.scrollTop;
var clientHeight = values.clientHeight;
var scrollHeight = values.scrollHeight;
var trackVerticalHeight = (0, _getInnerHeight2["default"])(trackVertical);
var thumbVerticalHeight = _this4.getThumbVerticalHeight();
var thumbVerticalY = scrollTop / (scrollHeight - clientHeight) * (trackVerticalHeight - thumbVerticalHeight);
var thumbVerticalStyle = {
height: thumbVerticalHeight,
transform: 'translateY(' + thumbVerticalY + 'px)'
var trackVerticalHeight = (0, _getInnerHeight2["default"])(trackVertical);
var thumbVerticalHeight = this.getThumbVerticalHeight();
var thumbVerticalY = scrollTop / (scrollHeight - clientHeight) * (trackVerticalHeight - thumbVerticalHeight);
var thumbVerticalStyle = {
height: thumbVerticalHeight,
transform: 'translateY(' + thumbVerticalY + 'px)'
};
if (hideTracksWhenNotNeeded) {
var trackHorizontalStyle = {
visibility: scrollWidth > clientWidth ? 'visible' : 'hidden'
};
if (hideTracksWhenNotNeeded) {
var trackHorizontalStyle = {
visibility: scrollWidth > clientWidth ? 'visible' : 'hidden'
};
var trackVerticalStyle = {
visibility: scrollHeight > clientHeight ? 'visible' : 'hidden'
};
(0, _domCss2["default"])(trackHorizontal, trackHorizontalStyle);
(0, _domCss2["default"])(trackVertical, trackVerticalStyle);
}
(0, _domCss2["default"])(thumbHorizontal, thumbHorizontalStyle);
(0, _domCss2["default"])(thumbVertical, thumbVerticalStyle);
var trackVerticalStyle = {
visibility: scrollHeight > clientHeight ? 'visible' : 'hidden'
};
(0, _domCss2["default"])(trackHorizontal, trackHorizontalStyle);
(0, _domCss2["default"])(trackVertical, trackVerticalStyle);
}
if (onUpdate) onUpdate(values);
if (typeof callback !== 'function') return;
callback(values);
});
(0, _domCss2["default"])(thumbHorizontal, thumbHorizontalStyle);
(0, _domCss2["default"])(thumbVertical, thumbVerticalStyle);
}
if (onUpdate) onUpdate(values);
if (typeof callback !== 'function') return;
callback(values);
},

@@ -859,17 +866,17 @@ render: function render() {

}, autoHeight && _extends({}, _styles.viewStyleAutoHeight, {
minHeight: autoHeightMin + scrollbarWidth,
maxHeight: autoHeightMax + scrollbarWidth
// Add scrollbarWidth to autoHeight in order to compensate negative margins
minHeight: (0, _isString2["default"])(autoHeightMin) ? 'calc(' + autoHeightMin + ' + ' + scrollbarWidth + 'px)' : autoHeightMin + scrollbarWidth,
maxHeight: (0, _isString2["default"])(autoHeightMax) ? 'calc(' + autoHeightMax + ' + ' + scrollbarWidth + 'px)' : autoHeightMax + scrollbarWidth
}), universal && !didMountUniversal && _styles.viewStyleUniversalInitial);
var trackHorizontalStyle = _extends({}, _styles.trackHorizontalStyleDefault, autoHide && {
var trackAutoHeightStyle = {
transition: 'opacity ' + autoHideDuration + 'ms',
opacity: 0
}, (!scrollbarWidth || universal) && !didMountUniversal && {
};
var trackHorizontalStyle = _extends({}, _styles.trackHorizontalStyleDefault, autoHide && trackAutoHeightStyle, (!scrollbarWidth || universal && !didMountUniversal) && {
display: 'none'
});
var trackVerticalStyle = _extends({}, _styles.trackVerticalStyleDefault, autoHide && {
transition: 'opacity ' + autoHideDuration + 'ms',
opacity: 0
}, (!scrollbarWidth || universal) && !didMountUniversal && {
var trackVerticalStyle = _extends({}, _styles.trackVerticalStyleDefault, autoHide && trackAutoHeightStyle, (!scrollbarWidth || universal && !didMountUniversal) && {
display: 'none'

@@ -1051,2 +1058,16 @@ });

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = isString;
function isString(maybe) {
return typeof maybe === 'string';
}
/***/ },
/* 10 */
/***/ function(module, exports) {
"use strict";

@@ -1063,3 +1084,3 @@

/***/ },
/* 10 */
/* 11 */
/***/ function(module, exports) {

@@ -1110,3 +1131,3 @@

/***/ },
/* 11 */
/* 12 */
/***/ function(module, exports) {

@@ -1147,7 +1168,7 @@

/***/ },
/* 12 */
/* 13 */
/***/ function(module, exports, __webpack_require__) {
var toSpace = __webpack_require__(13);
var toSpace = __webpack_require__(14);

@@ -1177,7 +1198,7 @@

/***/ },
/* 13 */
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var clean = __webpack_require__(14);
var clean = __webpack_require__(15);

@@ -1207,3 +1228,3 @@

/***/ },
/* 14 */
/* 15 */
/***/ function(module, exports) {

@@ -1287,6 +1308,6 @@

/***/ },
/* 15 */
/* 16 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var now = __webpack_require__(16)
/* WEBPACK VAR INJECTION */(function(global) {var now = __webpack_require__(17)
, root = typeof window === 'undefined' ? global : window

@@ -1367,3 +1388,3 @@ , vendors = ['moz', 'webkit']

/***/ },
/* 16 */
/* 17 */
/***/ function(module, exports, __webpack_require__) {

@@ -1404,6 +1425,6 @@

/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18)))
/***/ },
/* 17 */
/* 18 */
/***/ function(module, exports) {

@@ -1410,0 +1431,0 @@

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactCustomScrollbars=t(require("react")):e.ReactCustomScrollbars=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Scrollbars=void 0;var o=r(4),i=n(o);t["default"]=i["default"],t.Scrollbars=i["default"]},function(e,t,r){function n(e,t,r){var n=u[t];if("undefined"==typeof n&&(n=i(t)),n){if(void 0===r)return e.style[n];e.style[n]=c(n,r)}}function o(e,t){for(var r in t)t.hasOwnProperty(r)&&n(e,r,t[r])}function i(e){var t=s(e),r=a(t);return u[t]=u[e]=u[r]=r,r}function l(){2===arguments.length?o(arguments[0],arguments[1]):n(arguments[0],arguments[1],arguments[2])}var a=r(11),s=r(12),u={"float":"cssFloat"},c=r(10);e.exports=l,e.exports.set=l,e.exports.get=function(e,t){return Array.isArray(t)?t.reduce(function(t,r){return t[r]=n(e,r||""),t},{}):n(e,t||"")}},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function i(e){return h["default"].createElement("div",e)}function l(e){var t=e.style,r=o(e,["style"]),n=c({},t,{right:2,bottom:2,left:2,borderRadius:3,cursor:"pointer"});return h["default"].createElement("div",c({style:n},r))}function a(e){var t=e.style,r=o(e,["style"]),n=c({},t,{right:2,bottom:2,top:2,borderRadius:3,cursor:"pointer"});return h["default"].createElement("div",c({style:n},r))}function s(e){var t=e.style,r=o(e,["style"]),n=c({},t,{cursor:"pointer",borderRadius:"inherit",backgroundColor:"rgba(0,0,0,.2)"});return h["default"].createElement("div",c({style:n},r))}function u(e){var t=e.style,r=o(e,["style"]),n=c({},t,{cursor:"pointer",borderRadius:"inherit",backgroundColor:"rgba(0,0,0,.2)"});return h["default"].createElement("div",c({style:n},r))}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.renderViewDefault=i,t.renderTrackHorizontalDefault=l,t.renderTrackVerticalDefault=a,t.renderThumbHorizontalDefault=s,t.renderThumbVerticalDefault=u;var d=r(2),h=n(d)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(15),a=n(l),s=r(1),u=n(s),c=r(2),d=n(c),h=r(8),f=n(h),p=r(9),v=n(p),m=r(7),g=n(m),T=r(6),y=n(T),b=r(5),w=r(3);t["default"]=(0,c.createClass)({displayName:"Scrollbars",propTypes:{onScroll:c.PropTypes.func,onScrollFrame:c.PropTypes.func,onScrollStart:c.PropTypes.func,onScrollStop:c.PropTypes.func,onUpdate:c.PropTypes.func,renderView:c.PropTypes.func,renderTrackHorizontal:c.PropTypes.func,renderTrackVertical:c.PropTypes.func,renderThumbHorizontal:c.PropTypes.func,renderThumbVertical:c.PropTypes.func,thumbSize:c.PropTypes.number,thumbMinSize:c.PropTypes.number,hideTracksWhenNotNeeded:c.PropTypes.bool,autoHide:c.PropTypes.bool,autoHideTimeout:c.PropTypes.number,autoHideDuration:c.PropTypes.number,autoHeight:c.PropTypes.bool,autoHeightMin:c.PropTypes.number,autoHeightMax:c.PropTypes.number,universal:c.PropTypes.bool,style:c.PropTypes.object,children:c.PropTypes.node},getDefaultProps:function(){return{renderView:w.renderViewDefault,renderTrackHorizontal:w.renderTrackHorizontalDefault,renderTrackVertical:w.renderTrackVerticalDefault,renderThumbHorizontal:w.renderThumbHorizontalDefault,renderThumbVertical:w.renderThumbVerticalDefault,thumbMinSize:30,hideTracksWhenNotNeeded:!1,autoHide:!1,autoHideTimeout:1e3,autoHideDuration:200,autoHeight:!1,autoHeightMin:0,autoHeightMax:200,universal:!1}},getInitialState:function(){return{didMountUniversal:!1}},componentDidMount:function(){this.addListeners(),this.update(),this.componentDidMountUniversal()},componentDidMountUniversal:function(){var e=this.props.universal;e&&this.setState({didMountUniversal:!0})},componentDidUpdate:function(){this.update()},componentWillUnmount:function(){this.removeListeners(),(0,l.cancel)(this.requestFrame),clearTimeout(this.hideTracksTimeout),clearInterval(this.detectScrollingInterval)},getScrollLeft:function(){var e=this.refs.view;return e.scrollLeft},getScrollTop:function(){var e=this.refs.view;return e.scrollTop},getScrollWidth:function(){var e=this.refs.view;return e.scrollWidth},getScrollHeight:function(){var e=this.refs.view;return e.scrollHeight},getClientWidth:function(){var e=this.refs.view;return e.clientWidth},getClientHeight:function(){var e=this.refs.view;return e.clientHeight},getValues:function(){var e=this.refs.view,t=e.scrollLeft,r=e.scrollTop,n=e.scrollWidth,o=e.scrollHeight,i=e.clientWidth,l=e.clientHeight;return{left:t/(n-i)||0,top:r/(o-l)||0,scrollLeft:t,scrollTop:r,scrollWidth:n,scrollHeight:o,clientWidth:i,clientHeight:l}},getThumbHorizontalWidth:function(){var e=this.props,t=e.thumbSize,r=e.thumbMinSize,n=this.refs,o=n.view,i=n.trackHorizontal,l=o.scrollWidth,a=o.clientWidth,s=(0,g["default"])(i),u=a/l*s;return s===u?0:t?t:Math.max(u,r)},getThumbVerticalHeight:function(){var e=this.props,t=e.thumbSize,r=e.thumbMinSize,n=this.refs,o=n.view,i=n.trackVertical,l=o.scrollHeight,a=o.clientHeight,s=(0,y["default"])(i),u=a/l*s;return s===u?0:t?t:Math.max(u,r)},getScrollLeftForOffset:function(e){var t=this.refs,r=t.view,n=t.trackHorizontal,o=r.scrollWidth,i=r.clientWidth,l=(0,g["default"])(n),a=this.getThumbHorizontalWidth();return e/(l-a)*(o-i)},getScrollTopForOffset:function(e){var t=this.refs,r=t.view,n=t.trackVertical,o=r.scrollHeight,i=r.clientHeight,l=(0,y["default"])(n),a=this.getThumbVerticalHeight();return e/(l-a)*(o-i)},scrollLeft:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=this.refs.view;t.scrollLeft=e},scrollTop:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=this.refs.view;t.scrollTop=e},scrollToLeft:function(){var e=this.refs.view;e.scrollLeft=0},scrollToTop:function(){var e=this.refs.view;e.scrollTop=0},scrollToRight:function(){var e=this.refs.view;e.scrollLeft=e.scrollWidth},scrollToBottom:function(){var e=this.refs.view;e.scrollTop=e.scrollHeight},addListeners:function(){if("undefined"!=typeof document){var e=this.refs,t=e.view,r=e.trackHorizontal,n=e.trackVertical,o=e.thumbHorizontal,i=e.thumbVertical;t.addEventListener("scroll",this.handleScroll),(0,f["default"])()&&(r.addEventListener("mouseenter",this.handleTrackMouseEnter),r.addEventListener("mouseleave",this.handleTrackMouseLeave),r.addEventListener("mousedown",this.handleHorizontalTrackMouseDown),n.addEventListener("mouseenter",this.handleTrackMouseEnter),n.addEventListener("mouseleave",this.handleTrackMouseLeave),n.addEventListener("mousedown",this.handleVerticalTrackMouseDown),o.addEventListener("mousedown",this.handleHorizontalThumbMouseDown),i.addEventListener("mousedown",this.handleVerticalThumbMouseDown),window.addEventListener("resize",this.handleWindowResize))}},removeListeners:function(){if("undefined"!=typeof document){var e=this.refs,t=e.view,r=e.trackHorizontal,n=e.trackVertical,o=e.thumbHorizontal,i=e.thumbVertical;t.removeEventListener("scroll",this.handleScroll),(0,f["default"])()&&(r.removeEventListener("mouseenter",this.handleTrackMouseEnter),r.removeEventListener("mouseleave",this.handleTrackMouseLeave),r.removeEventListener("mousedown",this.handleHorizontalTrackMouseDown),n.removeEventListener("mouseenter",this.handleTrackMouseEnter),n.removeEventListener("mouseleave",this.handleTrackMouseLeave),n.removeEventListener("mousedown",this.handleVerticalTrackMouseDown),o.removeEventListener("mousedown",this.handleHorizontalThumbMouseDown),i.removeEventListener("mousedown",this.handleVerticalThumbMouseDown),window.removeEventListener("resize",this.handleWindowResize),this.teardownDragging())}},handleScroll:function(e){var t=this,r=this.props,n=r.onScroll,o=r.onScrollFrame;n&&n(e),this.update(function(e){var r=e.scrollLeft,n=e.scrollTop;t.viewScrollLeft=r,t.viewScrollTop=n,o&&o(e)}),this.detectScrolling()},handleScrollStart:function(){var e=this.props.onScrollStart;e&&e(),this.handleScrollStartAutoHide()},handleScrollStartAutoHide:function(){var e=this.props.autoHide;e&&this.showTracks()},handleScrollStop:function(){var e=this.props.onScrollStop;e&&e(),this.handleScrollStopAutoHide()},handleScrollStopAutoHide:function(){var e=this.props.autoHide;e&&this.hideTracks()},handleWindowResize:function(){this.update()},handleHorizontalTrackMouseDown:function(){var e=this.refs.view,t=event,r=t.target,n=t.clientX,o=r.getBoundingClientRect(),i=o.left,l=this.getThumbHorizontalWidth(),a=Math.abs(i-n)-l/2;e.scrollLeft=this.getScrollLeftForOffset(a)},handleVerticalTrackMouseDown:function(e){var t=this.refs.view,r=e.target,n=e.clientY,o=r.getBoundingClientRect(),i=o.top,l=this.getThumbVerticalHeight(),a=Math.abs(i-n)-l/2;t.scrollTop=this.getScrollTopForOffset(a)},handleHorizontalThumbMouseDown:function(e){this.handleDragStart(e);var t=e.target,r=e.clientX,n=t.offsetWidth,o=t.getBoundingClientRect(),i=o.left;this.prevPageX=n-(r-i)},handleVerticalThumbMouseDown:function(e){this.handleDragStart(e);var t=e.target,r=e.clientY,n=t.offsetHeight,o=t.getBoundingClientRect(),i=o.top;this.prevPageY=n-(r-i)},setupDragging:function(){(0,u["default"])(document.body,b.disableSelectStyle),document.addEventListener("mousemove",this.handleDrag),document.addEventListener("mouseup",this.handleDragEnd),document.onselectstart=v["default"]},teardownDragging:function(){(0,u["default"])(document.body,b.disableSelectStyleReset),document.removeEventListener("mousemove",this.handleDrag),document.removeEventListener("mouseup",this.handleDragEnd),document.onselectstart=void 0},handleDragStart:function(e){this.dragging=!0,e.stopImmediatePropagation(),this.setupDragging()},handleDrag:function(e){if(this.prevPageX){var t=e.clientX,r=this.refs,n=r.view,o=r.trackHorizontal,i=o.getBoundingClientRect(),l=i.left,a=this.getThumbHorizontalWidth(),s=a-this.prevPageX,u=-l+t-s;n.scrollLeft=this.getScrollLeftForOffset(u)}if(this.prevPageY){var c=e.clientY,d=this.refs,h=d.view,f=d.trackVertical,p=f.getBoundingClientRect(),v=p.top,m=this.getThumbVerticalHeight(),g=m-this.prevPageY,T=-v+c-g;h.scrollTop=this.getScrollTopForOffset(T)}return!1},handleDragEnd:function(){this.dragging=!1,this.prevPageX=this.prevPageY=0,this.teardownDragging(),this.handleDragEndAutoHide()},handleDragEndAutoHide:function(){var e=this.props.autoHide;e&&this.hideTracks()},handleTrackMouseEnter:function(){this.trackMouseOver=!0,this.handleTrackMouseEnterAutoHide()},handleTrackMouseEnterAutoHide:function(){var e=this.props.autoHide;e&&this.showTracks()},handleTrackMouseLeave:function(){this.trackMouseOver=!1,this.handleTrackMouseLeaveAutoHide()},handleTrackMouseLeaveAutoHide:function(){var e=this.props.autoHide;e&&this.hideTracks()},showTracks:function(){var e=this.refs,t=e.trackHorizontal,r=e.trackVertical;clearTimeout(this.hideTracksTimeout),(0,u["default"])(t,{opacity:1}),(0,u["default"])(r,{opacity:1})},hideTracks:function(){if(!this.dragging&&!this.scrolling&&!this.trackMouseOver){var e=this.props.autoHideTimeout,t=this.refs,r=t.trackHorizontal,n=t.trackVertical;clearTimeout(this.hideTracksTimeout),this.hideTracksTimeout=setTimeout(function(){(0,u["default"])(r,{opacity:0}),(0,u["default"])(n,{opacity:0})},e)}},detectScrolling:function(){var e=this;this.scrolling||(this.scrolling=!0,this.handleScrollStart(),this.detectScrollingInterval=setInterval(function(){e.lastViewScrollLeft===e.viewScrollLeft&&e.lastViewScrollTop===e.viewScrollTop&&(clearInterval(e.detectScrollingInterval),e.scrolling=!1,e.handleScrollStop()),e.lastViewScrollLeft=e.viewScrollLeft,e.lastViewScrollTop=e.viewScrollTop},100))},raf:function(e){var t=this;this.requestFrame&&a["default"].cancel(this.requestFrame),this.requestFrame=(0,a["default"])(function(){t.requestFrame=void 0,e()})},update:function(e){var t=this;this.raf(function(){var r=t.props,n=r.onUpdate,o=r.hideTracksWhenNotNeeded,i=t.getValues();if((0,f["default"])()){var l=t.refs,a=l.thumbHorizontal,s=l.thumbVertical,c=l.trackHorizontal,d=l.trackVertical,h=i.scrollLeft,p=i.clientWidth,v=i.scrollWidth,m=(0,g["default"])(c),T=t.getThumbHorizontalWidth(),b=h/(v-p)*(m-T),w={width:T,transform:"translateX("+b+"px)"},S=i.scrollTop,H=i.clientHeight,k=i.scrollHeight,M=(0,y["default"])(d),D=t.getThumbVerticalHeight(),L=S/(k-H)*(M-D),z={height:D,transform:"translateY("+L+"px)"};if(o){var x={visibility:v>p?"visible":"hidden"},V={visibility:k>H?"visible":"hidden"};(0,u["default"])(c,x),(0,u["default"])(d,V)}(0,u["default"])(a,w),(0,u["default"])(s,z)}n&&n(i),"function"==typeof e&&e(i)})},render:function(){var e=(0,f["default"])(),t=this.props,r=(t.onScroll,t.onScrollFrame,t.onScrollStart,t.onScrollStop,t.renderView),n=t.renderTrackHorizontal,l=t.renderTrackVertical,a=t.renderThumbHorizontal,s=t.renderThumbVertical,u=t.autoHide,h=(t.autoHideTimeout,t.autoHideDuration),p=(t.thumbSize,t.thumbMinSize,t.universal),v=t.autoHeight,m=t.autoHeightMin,g=t.autoHeightMax,T=t.style,y=t.children,w=o(t,["onScroll","onScrollFrame","onScrollStart","onScrollStop","renderView","renderTrackHorizontal","renderTrackVertical","renderThumbHorizontal","renderThumbVertical","autoHide","autoHideTimeout","autoHideDuration","thumbSize","thumbMinSize","universal","autoHeight","autoHeightMin","autoHeightMax","style","children"]),S=this.state.didMountUniversal,H=i({},b.containerStyleDefault,v&&i({},b.containerStyleAutoHeight,{minHeight:m,maxHeight:g}),T),k=i({},b.viewStyleDefault,{marginRight:e?-e:0,marginBottom:e?-e:0},v&&i({},b.viewStyleAutoHeight,{minHeight:m+e,maxHeight:g+e}),p&&!S&&b.viewStyleUniversalInitial),M=i({},b.trackHorizontalStyleDefault,u&&{transition:"opacity "+h+"ms",opacity:0},(!e||p)&&!S&&{display:"none"}),D=i({},b.trackVerticalStyleDefault,u&&{transition:"opacity "+h+"ms",opacity:0},(!e||p)&&!S&&{display:"none"});return d["default"].createElement("div",i({},w,{style:H,ref:"container"}),(0,c.cloneElement)(r({style:k}),{ref:"view"},y),(0,c.cloneElement)(n({style:M}),{ref:"trackHorizontal"},(0,c.cloneElement)(a({style:b.thumbHorizontalStyleDefault}),{ref:"thumbHorizontal"})),(0,c.cloneElement)(l({style:D}),{ref:"trackVertical"},(0,c.cloneElement)(s({style:b.thumbVerticalStyleDefault}),{ref:"thumbVertical"})))}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.containerStyleDefault={position:"relative",overflow:"hidden",width:"100%",height:"100%"},t.containerStyleAutoHeight={height:"auto"},t.viewStyleDefault={position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"scroll",WebkitOverflowScrolling:"touch"},t.viewStyleAutoHeight={position:"relative",top:void 0,left:void 0,right:void 0,bottom:void 0},t.viewStyleUniversalInitial={overflow:"hidden",marginRight:0,marginBottom:0},t.trackHorizontalStyleDefault={position:"absolute",height:6},t.trackVerticalStyleDefault={position:"absolute",width:6},t.thumbHorizontalStyleDefault={position:"relative",display:"block",height:"100%"},t.thumbVerticalStyleDefault={position:"relative",display:"block",width:"100%"},t.disableSelectStyle={userSelect:"none"},t.disableSelectStyleReset={userSelect:""}},function(e,t){"use strict";function r(e){var t=e.clientHeight,r=getComputedStyle(e),n=r.paddingTop,o=r.paddingBottom;return t-parseFloat(n)-parseFloat(o)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(e){var t=e.clientWidth,r=getComputedStyle(e),n=r.paddingLeft,o=r.paddingRight;return t-parseFloat(n)-parseFloat(o)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(){if(a!==!1)return a;if("undefined"!=typeof document){var e=document.createElement("div");(0,l["default"])(e,{width:100,height:100,position:"absolute",top:-9999,overflow:"scroll",MsOverflowStyle:"scrollbar"}),document.body.appendChild(e),a=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}else a=0;return a}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),l=n(i),a=!1},function(e,t){"use strict";function r(){return!1}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){var r={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};e.exports=function(e,t){return"number"!=typeof t||r[e]?t:t+"px"}},function(e,t){var r=null,n=["Webkit","Moz","O","ms"];e.exports=function(e){r||(r=document.createElement("div"));var t=r.style;if(e in t)return e;for(var o=e.charAt(0).toUpperCase()+e.slice(1),i=n.length;i>=0;i--){var l=n[i]+o;if(l in t)return l}return!1}},function(e,t,r){function n(e){return o(e).replace(/\s(\w)/g,function(e,t){return t.toUpperCase()})}var o=r(13);e.exports=n},function(e,t,r){function n(e){return o(e).replace(/[\W_]+(.|$)/g,function(e,t){return t?" "+t:""})}var o=r(14);e.exports=n},function(e,t){function r(e){return i.test(e)?e.toLowerCase():(a.test(e)&&(e=n(e)),l.test(e)&&(e=o(e)),e.toLowerCase())}function n(e){return e.replace(s,function(e,t){return t?" "+t:""})}function o(e){return e.replace(u,function(e,t,r){return t+" "+r.toLowerCase().split("").join(" ")})}e.exports=r;var i=/\s/,l=/[a-z][A-Z]/,a=/[\W_]/,s=/[\W_]+(.|$)/g,u=/(.)([A-Z]+)/g},function(e,t,r){(function(t){for(var n=r(16),o="undefined"==typeof window?t:window,i=["moz","webkit"],l="AnimationFrame",a=o["request"+l],s=o["cancel"+l]||o["cancelRequest"+l],u=0;!a&&u<i.length;u++)a=o[i[u]+"Request"+l],s=o[i[u]+"Cancel"+l]||o[i[u]+"CancelRequest"+l];if(!a||!s){var c=0,d=0,h=[],f=1e3/60;a=function(e){if(0===h.length){var t=n(),r=Math.max(0,f-(t-c));c=r+t,setTimeout(function(){var e=h.slice(0);h.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(c)}catch(r){setTimeout(function(){throw r},0)}},Math.round(r))}return h.push({handle:++d,callback:e,cancelled:!1}),d},s=function(e){for(var t=0;t<h.length;t++)h[t].handle===e&&(h[t].cancelled=!0)}}e.exports=function(e){return a.call(o,e)},e.exports.cancel=function(){s.apply(o,arguments)},e.exports.polyfill=function(){o.requestAnimationFrame=a,o.cancelAnimationFrame=s}}).call(t,function(){return this}())},function(e,t,r){(function(t){(function(){var r,n,o;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(r()-o)/1e6},n=t.hrtime,r=function(){var e;return e=n(),1e9*e[0]+e[1]},o=r()):Date.now?(e.exports=function(){return Date.now()-o},o=Date.now()):(e.exports=function(){return(new Date).getTime()-o},o=(new Date).getTime())}).call(this)}).call(t,r(17))},function(e,t){function r(){u=!1,l.length?s=l.concat(s):c=-1,s.length&&n()}function n(){if(!u){var e=setTimeout(r);u=!0;for(var t=s.length;t;){for(l=s,s=[];++c<t;)l&&l[c].run();c=-1,t=s.length}l=null,u=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function i(){}var l,a=e.exports={},s=[],u=!1,c=-1;a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];s.push(new o(e,t)),1!==s.length||u||setTimeout(n,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=i,a.addListener=i,a.once=i,a.off=i,a.removeListener=i,a.removeAllListeners=i,a.emit=i,a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactCustomScrollbars=t(require("react")):e.ReactCustomScrollbars=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Scrollbars=void 0;var o=r(4),i=n(o);t["default"]=i["default"],t.Scrollbars=i["default"]},function(e,t,r){function n(e,t,r){var n=u[t];if("undefined"==typeof n&&(n=i(t)),n){if(void 0===r)return e.style[n];e.style[n]=c(n,r)}}function o(e,t){for(var r in t)t.hasOwnProperty(r)&&n(e,r,t[r])}function i(e){var t=s(e),r=a(t);return u[t]=u[e]=u[r]=r,r}function l(){2===arguments.length?o(arguments[0],arguments[1]):n(arguments[0],arguments[1],arguments[2])}var a=r(12),s=r(13),u={"float":"cssFloat"},c=r(11);e.exports=l,e.exports.set=l,e.exports.get=function(e,t){return Array.isArray(t)?t.reduce(function(t,r){return t[r]=n(e,r||""),t},{}):n(e,t||"")}},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function i(e){return h["default"].createElement("div",e)}function l(e){var t=e.style,r=o(e,["style"]),n=c({},t,{right:2,bottom:2,left:2,borderRadius:3,cursor:"pointer"});return h["default"].createElement("div",c({style:n},r))}function a(e){var t=e.style,r=o(e,["style"]),n=c({},t,{right:2,bottom:2,top:2,borderRadius:3,cursor:"pointer"});return h["default"].createElement("div",c({style:n},r))}function s(e){var t=e.style,r=o(e,["style"]),n=c({},t,{cursor:"pointer",borderRadius:"inherit",backgroundColor:"rgba(0,0,0,.2)"});return h["default"].createElement("div",c({style:n},r))}function u(e){var t=e.style,r=o(e,["style"]),n=c({},t,{cursor:"pointer",borderRadius:"inherit",backgroundColor:"rgba(0,0,0,.2)"});return h["default"].createElement("div",c({style:n},r))}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.renderViewDefault=i,t.renderTrackHorizontalDefault=l,t.renderTrackVerticalDefault=a,t.renderThumbHorizontalDefault=s,t.renderThumbVerticalDefault=u;var d=r(2),h=n(d)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(16),a=n(l),s=r(1),u=n(s),c=r(2),d=n(c),h=r(9),f=n(h),p=r(8),v=n(p),m=r(10),g=n(m),T=r(7),y=n(T),b=r(6),w=n(b),S=r(5),H=r(3);t["default"]=(0,c.createClass)({displayName:"Scrollbars",propTypes:{onScroll:c.PropTypes.func,onScrollFrame:c.PropTypes.func,onScrollStart:c.PropTypes.func,onScrollStop:c.PropTypes.func,onUpdate:c.PropTypes.func,renderView:c.PropTypes.func,renderTrackHorizontal:c.PropTypes.func,renderTrackVertical:c.PropTypes.func,renderThumbHorizontal:c.PropTypes.func,renderThumbVertical:c.PropTypes.func,thumbSize:c.PropTypes.number,thumbMinSize:c.PropTypes.number,hideTracksWhenNotNeeded:c.PropTypes.bool,autoHide:c.PropTypes.bool,autoHideTimeout:c.PropTypes.number,autoHideDuration:c.PropTypes.number,autoHeight:c.PropTypes.bool,autoHeightMin:c.PropTypes.oneOfType([c.PropTypes.number,c.PropTypes.string]),autoHeightMax:c.PropTypes.oneOfType([c.PropTypes.number,c.PropTypes.string]),universal:c.PropTypes.bool,style:c.PropTypes.object,children:c.PropTypes.node},getDefaultProps:function(){return{renderView:H.renderViewDefault,renderTrackHorizontal:H.renderTrackHorizontalDefault,renderTrackVertical:H.renderTrackVerticalDefault,renderThumbHorizontal:H.renderThumbHorizontalDefault,renderThumbVertical:H.renderThumbVerticalDefault,thumbMinSize:30,hideTracksWhenNotNeeded:!1,autoHide:!1,autoHideTimeout:1e3,autoHideDuration:200,autoHeight:!1,autoHeightMin:0,autoHeightMax:200,universal:!1}},getInitialState:function(){return{didMountUniversal:!1}},componentDidMount:function(){this.addListeners(),this.update(),this.componentDidMountUniversal()},componentDidMountUniversal:function(){var e=this.props.universal;e&&this.setState({didMountUniversal:!0})},componentDidUpdate:function(){this.update()},componentWillUnmount:function(){this.removeListeners(),(0,l.cancel)(this.requestFrame),clearTimeout(this.hideTracksTimeout),clearInterval(this.detectScrollingInterval)},getScrollLeft:function(){var e=this.refs.view;return e.scrollLeft},getScrollTop:function(){var e=this.refs.view;return e.scrollTop},getScrollWidth:function(){var e=this.refs.view;return e.scrollWidth},getScrollHeight:function(){var e=this.refs.view;return e.scrollHeight},getClientWidth:function(){var e=this.refs.view;return e.clientWidth},getClientHeight:function(){var e=this.refs.view;return e.clientHeight},getValues:function(){var e=this.refs.view,t=e.scrollLeft,r=e.scrollTop,n=e.scrollWidth,o=e.scrollHeight,i=e.clientWidth,l=e.clientHeight;return{left:t/(n-i)||0,top:r/(o-l)||0,scrollLeft:t,scrollTop:r,scrollWidth:n,scrollHeight:o,clientWidth:i,clientHeight:l}},getThumbHorizontalWidth:function(){var e=this.props,t=e.thumbSize,r=e.thumbMinSize,n=this.refs,o=n.view,i=n.trackHorizontal,l=o.scrollWidth,a=o.clientWidth,s=(0,y["default"])(i),u=a/l*s;return s===u?0:t?t:Math.max(u,r)},getThumbVerticalHeight:function(){var e=this.props,t=e.thumbSize,r=e.thumbMinSize,n=this.refs,o=n.view,i=n.trackVertical,l=o.scrollHeight,a=o.clientHeight,s=(0,w["default"])(i),u=a/l*s;return s===u?0:t?t:Math.max(u,r)},getScrollLeftForOffset:function(e){var t=this.refs,r=t.view,n=t.trackHorizontal,o=r.scrollWidth,i=r.clientWidth,l=(0,y["default"])(n),a=this.getThumbHorizontalWidth();return e/(l-a)*(o-i)},getScrollTopForOffset:function(e){var t=this.refs,r=t.view,n=t.trackVertical,o=r.scrollHeight,i=r.clientHeight,l=(0,w["default"])(n),a=this.getThumbVerticalHeight();return e/(l-a)*(o-i)},scrollLeft:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=this.refs.view;t.scrollLeft=e},scrollTop:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=this.refs.view;t.scrollTop=e},scrollToLeft:function(){var e=this.refs.view;e.scrollLeft=0},scrollToTop:function(){var e=this.refs.view;e.scrollTop=0},scrollToRight:function(){var e=this.refs.view;e.scrollLeft=e.scrollWidth},scrollToBottom:function(){var e=this.refs.view;e.scrollTop=e.scrollHeight},addListeners:function(){if("undefined"!=typeof document){var e=this.refs,t=e.view,r=e.trackHorizontal,n=e.trackVertical,o=e.thumbHorizontal,i=e.thumbVertical;t.addEventListener("scroll",this.handleScroll),(0,v["default"])()&&(r.addEventListener("mouseenter",this.handleTrackMouseEnter),r.addEventListener("mouseleave",this.handleTrackMouseLeave),r.addEventListener("mousedown",this.handleHorizontalTrackMouseDown),n.addEventListener("mouseenter",this.handleTrackMouseEnter),n.addEventListener("mouseleave",this.handleTrackMouseLeave),n.addEventListener("mousedown",this.handleVerticalTrackMouseDown),o.addEventListener("mousedown",this.handleHorizontalThumbMouseDown),i.addEventListener("mousedown",this.handleVerticalThumbMouseDown),window.addEventListener("resize",this.handleWindowResize))}},removeListeners:function(){if("undefined"!=typeof document){var e=this.refs,t=e.view,r=e.trackHorizontal,n=e.trackVertical,o=e.thumbHorizontal,i=e.thumbVertical;t.removeEventListener("scroll",this.handleScroll),(0,v["default"])()&&(r.removeEventListener("mouseenter",this.handleTrackMouseEnter),r.removeEventListener("mouseleave",this.handleTrackMouseLeave),r.removeEventListener("mousedown",this.handleHorizontalTrackMouseDown),n.removeEventListener("mouseenter",this.handleTrackMouseEnter),n.removeEventListener("mouseleave",this.handleTrackMouseLeave),n.removeEventListener("mousedown",this.handleVerticalTrackMouseDown),o.removeEventListener("mousedown",this.handleHorizontalThumbMouseDown),i.removeEventListener("mousedown",this.handleVerticalThumbMouseDown),window.removeEventListener("resize",this.handleWindowResize),this.teardownDragging())}},handleScroll:function(e){var t=this,r=this.props,n=r.onScroll,o=r.onScrollFrame;n&&n(e),this.update(function(e){var r=e.scrollLeft,n=e.scrollTop;t.viewScrollLeft=r,t.viewScrollTop=n,o&&o(e)}),this.detectScrolling()},handleScrollStart:function(){var e=this.props.onScrollStart;e&&e(),this.handleScrollStartAutoHide()},handleScrollStartAutoHide:function(){var e=this.props.autoHide;e&&this.showTracks()},handleScrollStop:function(){var e=this.props.onScrollStop;e&&e(),this.handleScrollStopAutoHide()},handleScrollStopAutoHide:function(){var e=this.props.autoHide;e&&this.hideTracks()},handleWindowResize:function(){this.update()},handleHorizontalTrackMouseDown:function(){var e=this.refs.view,t=event,r=t.target,n=t.clientX,o=r.getBoundingClientRect(),i=o.left,l=this.getThumbHorizontalWidth(),a=Math.abs(i-n)-l/2;e.scrollLeft=this.getScrollLeftForOffset(a)},handleVerticalTrackMouseDown:function(e){var t=this.refs.view,r=e.target,n=e.clientY,o=r.getBoundingClientRect(),i=o.top,l=this.getThumbVerticalHeight(),a=Math.abs(i-n)-l/2;t.scrollTop=this.getScrollTopForOffset(a)},handleHorizontalThumbMouseDown:function(e){this.handleDragStart(e);var t=e.target,r=e.clientX,n=t.offsetWidth,o=t.getBoundingClientRect(),i=o.left;this.prevPageX=n-(r-i)},handleVerticalThumbMouseDown:function(e){this.handleDragStart(e);var t=e.target,r=e.clientY,n=t.offsetHeight,o=t.getBoundingClientRect(),i=o.top;this.prevPageY=n-(r-i)},setupDragging:function(){(0,u["default"])(document.body,S.disableSelectStyle),document.addEventListener("mousemove",this.handleDrag),document.addEventListener("mouseup",this.handleDragEnd),document.onselectstart=g["default"]},teardownDragging:function(){(0,u["default"])(document.body,S.disableSelectStyleReset),document.removeEventListener("mousemove",this.handleDrag),document.removeEventListener("mouseup",this.handleDragEnd),document.onselectstart=void 0},handleDragStart:function(e){this.dragging=!0,e.stopImmediatePropagation(),this.setupDragging()},handleDrag:function(e){if(this.prevPageX){var t=e.clientX,r=this.refs,n=r.view,o=r.trackHorizontal,i=o.getBoundingClientRect(),l=i.left,a=this.getThumbHorizontalWidth(),s=a-this.prevPageX,u=-l+t-s;n.scrollLeft=this.getScrollLeftForOffset(u)}if(this.prevPageY){var c=e.clientY,d=this.refs,h=d.view,f=d.trackVertical,p=f.getBoundingClientRect(),v=p.top,m=this.getThumbVerticalHeight(),g=m-this.prevPageY,T=-v+c-g;h.scrollTop=this.getScrollTopForOffset(T)}return!1},handleDragEnd:function(){this.dragging=!1,this.prevPageX=this.prevPageY=0,this.teardownDragging(),this.handleDragEndAutoHide()},handleDragEndAutoHide:function(){var e=this.props.autoHide;e&&this.hideTracks()},handleTrackMouseEnter:function(){this.trackMouseOver=!0,this.handleTrackMouseEnterAutoHide()},handleTrackMouseEnterAutoHide:function(){var e=this.props.autoHide;e&&this.showTracks()},handleTrackMouseLeave:function(){this.trackMouseOver=!1,this.handleTrackMouseLeaveAutoHide()},handleTrackMouseLeaveAutoHide:function(){var e=this.props.autoHide;e&&this.hideTracks()},showTracks:function(){var e=this.refs,t=e.trackHorizontal,r=e.trackVertical;clearTimeout(this.hideTracksTimeout),(0,u["default"])(t,{opacity:1}),(0,u["default"])(r,{opacity:1})},hideTracks:function(){if(!this.dragging&&!this.scrolling&&!this.trackMouseOver){var e=this.props.autoHideTimeout,t=this.refs,r=t.trackHorizontal,n=t.trackVertical;clearTimeout(this.hideTracksTimeout),this.hideTracksTimeout=setTimeout(function(){(0,u["default"])(r,{opacity:0}),(0,u["default"])(n,{opacity:0})},e)}},detectScrolling:function(){var e=this;this.scrolling||(this.scrolling=!0,this.handleScrollStart(),this.detectScrollingInterval=setInterval(function(){e.lastViewScrollLeft===e.viewScrollLeft&&e.lastViewScrollTop===e.viewScrollTop&&(clearInterval(e.detectScrollingInterval),e.scrolling=!1,e.handleScrollStop()),e.lastViewScrollLeft=e.viewScrollLeft,e.lastViewScrollTop=e.viewScrollTop},100))},raf:function(e){var t=this;this.requestFrame&&a["default"].cancel(this.requestFrame),this.requestFrame=(0,a["default"])(function(){t.requestFrame=void 0,e()})},update:function(e){var t=this;this.raf(function(){return t._update(e)})},_update:function(e){var t=this.props,r=t.onUpdate,n=t.hideTracksWhenNotNeeded,o=this.getValues();if((0,v["default"])()){var i=this.refs,l=i.thumbHorizontal,a=i.thumbVertical,s=i.trackHorizontal,c=i.trackVertical,d=o.scrollLeft,h=o.clientWidth,f=o.scrollWidth,p=(0,y["default"])(s),m=this.getThumbHorizontalWidth(),g=d/(f-h)*(p-m),T={width:m,transform:"translateX("+g+"px)"},b=o.scrollTop,S=o.clientHeight,H=o.scrollHeight,k=(0,w["default"])(c),M=this.getThumbVerticalHeight(),D=b/(H-S)*(k-M),L={height:M,transform:"translateY("+D+"px)"};if(n){var z={visibility:f>h?"visible":"hidden"},x={visibility:H>S?"visible":"hidden"};(0,u["default"])(s,z),(0,u["default"])(c,x)}(0,u["default"])(l,T),(0,u["default"])(a,L)}r&&r(o),"function"==typeof e&&e(o)},render:function(){var e=(0,v["default"])(),t=this.props,r=(t.onScroll,t.onScrollFrame,t.onScrollStart,t.onScrollStop,t.renderView),n=t.renderTrackHorizontal,l=t.renderTrackVertical,a=t.renderThumbHorizontal,s=t.renderThumbVertical,u=t.autoHide,h=(t.autoHideTimeout,t.autoHideDuration),p=(t.thumbSize,t.thumbMinSize,t.universal),m=t.autoHeight,g=t.autoHeightMin,T=t.autoHeightMax,y=t.style,b=t.children,w=o(t,["onScroll","onScrollFrame","onScrollStart","onScrollStop","renderView","renderTrackHorizontal","renderTrackVertical","renderThumbHorizontal","renderThumbVertical","autoHide","autoHideTimeout","autoHideDuration","thumbSize","thumbMinSize","universal","autoHeight","autoHeightMin","autoHeightMax","style","children"]),H=this.state.didMountUniversal,k=i({},S.containerStyleDefault,m&&i({},S.containerStyleAutoHeight,{minHeight:g,maxHeight:T}),y),M=i({},S.viewStyleDefault,{marginRight:e?-e:0,marginBottom:e?-e:0},m&&i({},S.viewStyleAutoHeight,{minHeight:(0,f["default"])(g)?"calc("+g+" + "+e+"px)":g+e,maxHeight:(0,f["default"])(T)?"calc("+T+" + "+e+"px)":T+e}),p&&!H&&S.viewStyleUniversalInitial),D={transition:"opacity "+h+"ms",opacity:0},L=i({},S.trackHorizontalStyleDefault,u&&D,(!e||p&&!H)&&{display:"none"}),z=i({},S.trackVerticalStyleDefault,u&&D,(!e||p&&!H)&&{display:"none"});return d["default"].createElement("div",i({},w,{style:k,ref:"container"}),(0,c.cloneElement)(r({style:M}),{ref:"view"},b),(0,c.cloneElement)(n({style:L}),{ref:"trackHorizontal"},(0,c.cloneElement)(a({style:S.thumbHorizontalStyleDefault}),{ref:"thumbHorizontal"})),(0,c.cloneElement)(l({style:z}),{ref:"trackVertical"},(0,c.cloneElement)(s({style:S.thumbVerticalStyleDefault}),{ref:"thumbVertical"})))}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.containerStyleDefault={position:"relative",overflow:"hidden",width:"100%",height:"100%"},t.containerStyleAutoHeight={height:"auto"},t.viewStyleDefault={position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"scroll",WebkitOverflowScrolling:"touch"},t.viewStyleAutoHeight={position:"relative",top:void 0,left:void 0,right:void 0,bottom:void 0},t.viewStyleUniversalInitial={overflow:"hidden",marginRight:0,marginBottom:0},t.trackHorizontalStyleDefault={position:"absolute",height:6},t.trackVerticalStyleDefault={position:"absolute",width:6},t.thumbHorizontalStyleDefault={position:"relative",display:"block",height:"100%"},t.thumbVerticalStyleDefault={position:"relative",display:"block",width:"100%"},t.disableSelectStyle={userSelect:"none"},t.disableSelectStyleReset={userSelect:""}},function(e,t){"use strict";function r(e){var t=e.clientHeight,r=getComputedStyle(e),n=r.paddingTop,o=r.paddingBottom;return t-parseFloat(n)-parseFloat(o)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(e){var t=e.clientWidth,r=getComputedStyle(e),n=r.paddingLeft,o=r.paddingRight;return t-parseFloat(n)-parseFloat(o)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(){if(a!==!1)return a;if("undefined"!=typeof document){var e=document.createElement("div");(0,l["default"])(e,{width:100,height:100,position:"absolute",top:-9999,overflow:"scroll",MsOverflowStyle:"scrollbar"}),document.body.appendChild(e),a=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}else a=0;return a}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),l=n(i),a=!1},function(e,t){"use strict";function r(e){return"string"==typeof e}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){return!1}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){var r={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};e.exports=function(e,t){return"number"!=typeof t||r[e]?t:t+"px"}},function(e,t){var r=null,n=["Webkit","Moz","O","ms"];e.exports=function(e){r||(r=document.createElement("div"));var t=r.style;if(e in t)return e;for(var o=e.charAt(0).toUpperCase()+e.slice(1),i=n.length;i>=0;i--){var l=n[i]+o;if(l in t)return l}return!1}},function(e,t,r){function n(e){return o(e).replace(/\s(\w)/g,function(e,t){return t.toUpperCase()})}var o=r(14);e.exports=n},function(e,t,r){function n(e){return o(e).replace(/[\W_]+(.|$)/g,function(e,t){return t?" "+t:""})}var o=r(15);e.exports=n},function(e,t){function r(e){return i.test(e)?e.toLowerCase():(a.test(e)&&(e=n(e)),l.test(e)&&(e=o(e)),e.toLowerCase())}function n(e){return e.replace(s,function(e,t){return t?" "+t:""})}function o(e){return e.replace(u,function(e,t,r){return t+" "+r.toLowerCase().split("").join(" ")})}e.exports=r;var i=/\s/,l=/[a-z][A-Z]/,a=/[\W_]/,s=/[\W_]+(.|$)/g,u=/(.)([A-Z]+)/g},function(e,t,r){(function(t){for(var n=r(17),o="undefined"==typeof window?t:window,i=["moz","webkit"],l="AnimationFrame",a=o["request"+l],s=o["cancel"+l]||o["cancelRequest"+l],u=0;!a&&u<i.length;u++)a=o[i[u]+"Request"+l],s=o[i[u]+"Cancel"+l]||o[i[u]+"CancelRequest"+l];if(!a||!s){var c=0,d=0,h=[],f=1e3/60;a=function(e){if(0===h.length){var t=n(),r=Math.max(0,f-(t-c));c=r+t,setTimeout(function(){var e=h.slice(0);h.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(c)}catch(r){setTimeout(function(){throw r},0)}},Math.round(r))}return h.push({handle:++d,callback:e,cancelled:!1}),d},s=function(e){for(var t=0;t<h.length;t++)h[t].handle===e&&(h[t].cancelled=!0)}}e.exports=function(e){return a.call(o,e)},e.exports.cancel=function(){s.apply(o,arguments)},e.exports.polyfill=function(){o.requestAnimationFrame=a,o.cancelAnimationFrame=s}}).call(t,function(){return this}())},function(e,t,r){(function(t){(function(){var r,n,o;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(r()-o)/1e6},n=t.hrtime,r=function(){var e;return e=n(),1e9*e[0]+e[1]},o=r()):Date.now?(e.exports=function(){return Date.now()-o},o=Date.now()):(e.exports=function(){return(new Date).getTime()-o},o=(new Date).getTime())}).call(this)}).call(t,r(18))},function(e,t){function r(){u=!1,l.length?s=l.concat(s):c=-1,s.length&&n()}function n(){if(!u){var e=setTimeout(r);u=!0;for(var t=s.length;t;){for(l=s,s=[];++c<t;)l&&l[c].run();c=-1,t=s.length}l=null,u=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function i(){}var l,a=e.exports={},s=[],u=!1,c=-1;a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];s.push(new o(e,t)),1!==s.length||u||setTimeout(n,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=i,a.addListener=i,a.once=i,a.off=i,a.removeListener=i,a.removeAllListeners=i,a.emit=i,a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}}])});

@@ -21,2 +21,6 @@ 'use strict';

var _isString = require('../utils/isString');
var _isString2 = _interopRequireDefault(_isString);
var _getScrollbarWidth = require('../utils/getScrollbarWidth');

@@ -68,4 +72,4 @@

autoHeight: _react.PropTypes.bool,
autoHeightMin: _react.PropTypes.number,
autoHeightMax: _react.PropTypes.number,
autoHeightMin: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]),
autoHeightMax: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]),
universal: _react.PropTypes.bool,

@@ -534,52 +538,55 @@ style: _react.PropTypes.object,

this.raf(function () {
var _props4 = _this4.props;
var onUpdate = _props4.onUpdate;
var hideTracksWhenNotNeeded = _props4.hideTracksWhenNotNeeded;
return _this4._update(callback);
});
},
_update: function _update(callback) {
var _props4 = this.props;
var onUpdate = _props4.onUpdate;
var hideTracksWhenNotNeeded = _props4.hideTracksWhenNotNeeded;
var values = _this4.getValues();
if ((0, _getScrollbarWidth2["default"])()) {
var _refs11 = _this4.refs;
var thumbHorizontal = _refs11.thumbHorizontal;
var thumbVertical = _refs11.thumbVertical;
var trackHorizontal = _refs11.trackHorizontal;
var trackVertical = _refs11.trackVertical;
var scrollLeft = values.scrollLeft;
var clientWidth = values.clientWidth;
var scrollWidth = values.scrollWidth;
var values = this.getValues();
if ((0, _getScrollbarWidth2["default"])()) {
var _refs11 = this.refs;
var thumbHorizontal = _refs11.thumbHorizontal;
var thumbVertical = _refs11.thumbVertical;
var trackHorizontal = _refs11.trackHorizontal;
var trackVertical = _refs11.trackVertical;
var scrollLeft = values.scrollLeft;
var clientWidth = values.clientWidth;
var scrollWidth = values.scrollWidth;
var trackHorizontalWidth = (0, _getInnerWidth2["default"])(trackHorizontal);
var thumbHorizontalWidth = _this4.getThumbHorizontalWidth();
var thumbHorizontalX = scrollLeft / (scrollWidth - clientWidth) * (trackHorizontalWidth - thumbHorizontalWidth);
var thumbHorizontalStyle = {
width: thumbHorizontalWidth,
transform: 'translateX(' + thumbHorizontalX + 'px)'
};
var scrollTop = values.scrollTop;
var clientHeight = values.clientHeight;
var scrollHeight = values.scrollHeight;
var trackHorizontalWidth = (0, _getInnerWidth2["default"])(trackHorizontal);
var thumbHorizontalWidth = this.getThumbHorizontalWidth();
var thumbHorizontalX = scrollLeft / (scrollWidth - clientWidth) * (trackHorizontalWidth - thumbHorizontalWidth);
var thumbHorizontalStyle = {
width: thumbHorizontalWidth,
transform: 'translateX(' + thumbHorizontalX + 'px)'
};
var scrollTop = values.scrollTop;
var clientHeight = values.clientHeight;
var scrollHeight = values.scrollHeight;
var trackVerticalHeight = (0, _getInnerHeight2["default"])(trackVertical);
var thumbVerticalHeight = _this4.getThumbVerticalHeight();
var thumbVerticalY = scrollTop / (scrollHeight - clientHeight) * (trackVerticalHeight - thumbVerticalHeight);
var thumbVerticalStyle = {
height: thumbVerticalHeight,
transform: 'translateY(' + thumbVerticalY + 'px)'
var trackVerticalHeight = (0, _getInnerHeight2["default"])(trackVertical);
var thumbVerticalHeight = this.getThumbVerticalHeight();
var thumbVerticalY = scrollTop / (scrollHeight - clientHeight) * (trackVerticalHeight - thumbVerticalHeight);
var thumbVerticalStyle = {
height: thumbVerticalHeight,
transform: 'translateY(' + thumbVerticalY + 'px)'
};
if (hideTracksWhenNotNeeded) {
var trackHorizontalStyle = {
visibility: scrollWidth > clientWidth ? 'visible' : 'hidden'
};
if (hideTracksWhenNotNeeded) {
var trackHorizontalStyle = {
visibility: scrollWidth > clientWidth ? 'visible' : 'hidden'
};
var trackVerticalStyle = {
visibility: scrollHeight > clientHeight ? 'visible' : 'hidden'
};
(0, _domCss2["default"])(trackHorizontal, trackHorizontalStyle);
(0, _domCss2["default"])(trackVertical, trackVerticalStyle);
}
(0, _domCss2["default"])(thumbHorizontal, thumbHorizontalStyle);
(0, _domCss2["default"])(thumbVertical, thumbVerticalStyle);
var trackVerticalStyle = {
visibility: scrollHeight > clientHeight ? 'visible' : 'hidden'
};
(0, _domCss2["default"])(trackHorizontal, trackHorizontalStyle);
(0, _domCss2["default"])(trackVertical, trackVerticalStyle);
}
if (onUpdate) onUpdate(values);
if (typeof callback !== 'function') return;
callback(values);
});
(0, _domCss2["default"])(thumbHorizontal, thumbHorizontalStyle);
(0, _domCss2["default"])(thumbVertical, thumbVerticalStyle);
}
if (onUpdate) onUpdate(values);
if (typeof callback !== 'function') return;
callback(values);
},

@@ -625,17 +632,17 @@ render: function render() {

}, autoHeight && _extends({}, _styles.viewStyleAutoHeight, {
minHeight: autoHeightMin + scrollbarWidth,
maxHeight: autoHeightMax + scrollbarWidth
// Add scrollbarWidth to autoHeight in order to compensate negative margins
minHeight: (0, _isString2["default"])(autoHeightMin) ? 'calc(' + autoHeightMin + ' + ' + scrollbarWidth + 'px)' : autoHeightMin + scrollbarWidth,
maxHeight: (0, _isString2["default"])(autoHeightMax) ? 'calc(' + autoHeightMax + ' + ' + scrollbarWidth + 'px)' : autoHeightMax + scrollbarWidth
}), universal && !didMountUniversal && _styles.viewStyleUniversalInitial);
var trackHorizontalStyle = _extends({}, _styles.trackHorizontalStyleDefault, autoHide && {
var trackAutoHeightStyle = {
transition: 'opacity ' + autoHideDuration + 'ms',
opacity: 0
}, (!scrollbarWidth || universal) && !didMountUniversal && {
};
var trackHorizontalStyle = _extends({}, _styles.trackHorizontalStyleDefault, autoHide && trackAutoHeightStyle, (!scrollbarWidth || universal && !didMountUniversal) && {
display: 'none'
});
var trackVerticalStyle = _extends({}, _styles.trackVerticalStyleDefault, autoHide && {
transition: 'opacity ' + autoHideDuration + 'ms',
opacity: 0
}, (!scrollbarWidth || universal) && !didMountUniversal && {
var trackVerticalStyle = _extends({}, _styles.trackVerticalStyleDefault, autoHide && trackAutoHeightStyle, (!scrollbarWidth || universal && !didMountUniversal) && {
display: 'none'

@@ -642,0 +649,0 @@ });

{
"name": "react-custom-scrollbars",
"version": "4.0.0-beta.1",
"version": "4.0.0-beta.2",
"description": "React scrollbars component",

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

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