Socket
Socket
Sign inDemoInstall

@s-yh/react-scroll-bar

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.6 to 1.0.7

2

dist/index.js

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

module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e){t.exports=require("react")},function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),a=o(r(0));r(2);e.default=function(t){var e=t.height,r=t.width,o=t.style,s=t.children,c=0,u=!1,l=i.useRef(null),f=i.useRef(null),d=i.useRef(null),p=i.useRef(null),h=r.includes("%")?"100%":r,v=i.useState(0),b=v[0],m=v[1],g=i.useState(0),y=g[0],w=g[1];function x(t){if(!1!==u){var e=c;if(e){var r=100*(-1*(d.current.getBoundingClientRect().top-t.clientY)-(p.current.offsetHeight-e))/d.current.offsetHeight;f.current.scrollTop=r*f.current.scrollHeight/100,d.current.style.opacity="1"}}}function j(t){u=!1,c=0,document.removeEventListener("mousemove",x),document.onselectstart=null,d.current.style.opacity="0"}return i.useEffect((function(){var t;t=100*f.current.clientHeight/l.current.scrollHeight,m(t=t>100?100:t)})),a.default.createElement("div",{className:"scrollbar",style:n({height:e,width:r},o)},a.default.createElement("div",{className:"scrollbar-content",ref:f,style:{width:"calc("+h+" + "+function(){var t=document.createElement("div");t.style.width="100px",t.style.visibility="hidden",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);var e=t.offsetWidth;t.style.overflow="scroll";var r=document.createElement("div");r.style.width="100%",t.appendChild(r);var n=r.offsetWidth;return t.parentNode.removeChild(t),e-n}()+"px)"},onScroll:function(){w(100*f.current.scrollTop/f.current.clientHeight)}},a.default.createElement("div",{ref:l},s)),b<100&&a.default.createElement("div",{className:"scrollbar-bar",ref:d,onClick:function(t){var e=100*(Math.abs(t.target.getBoundingClientRect().top-t.clientY)-p.current.offsetHeight/2)/f.current.offsetHeight;f.current.scrollTop=e*f.current.scrollHeight/100}},a.default.createElement("div",{className:"scrollbar-thumb",ref:p,style:{height:b+"%",transform:"translateY("+y+"%)"},onMouseDown:function(t){!function(t){t.nativeEvent.stopImmediatePropagation(),t.stopPropagation(),u=!0,document.addEventListener("mousemove",x),document.addEventListener("mouseup",j),document.onselectstart=null}(t),c=t.currentTarget.offsetHeight-(t.clientY-t.currentTarget.getBoundingClientRect().top)}})))}},function(t,e,r){var n=r(3);"string"==typeof n&&(n=[[t.i,n,""]]);var o={insert:"head",singleton:!1};r(5)(n,o);n.locals&&(t.exports=n.locals)},function(t,e,r){(t.exports=r(4)(!1)).push([t.i,"* {\r\n margin: 0;\r\n padding: 0;\r\n}\r\n.scrollbar { \r\n position: relative;\r\n overflow: hidden;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n.scrollbar-content {\r\n overflow: auto;\r\n height: 100%;\r\n}\r\n.scrollbar-bar {\r\n position: absolute;\r\n right: 0;\r\n bottom: 0;\r\n z-index: 1;\r\n opacity: 0;\r\n width: 6px;\r\n height: 100%;\r\n border-radius: 4px;\r\n background-color: rgba(0, 0, 0, .1);\r\n transition: opacity 120ms ease-out;\r\n}\r\n.scrollbar-thumb {\r\n position: relative;\r\n display: block;\r\n width: 100%;\r\n height: 0;\r\n border-radius: inherit;\r\n background-color: rgba(135, 141, 153, .3);\r\n transition: background-color .3s, transform .15s;\r\n cursor: pointer;\r\n}\r\n.scrollbar-thumb:hover {\r\n background-color: rgba(54, 59, 70, 0.3);\r\n}\r\n\r\n.scrollbar:hover .scrollbar-bar {\r\n opacity: 1 !important;\r\n transition: opacity 340ms ease-out;\r\n}",""])},function(t,e,r){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r=function(t,e){var r=t[1]||"",n=t[3];if(!n)return r;if(e&&"function"==typeof btoa){var o=(a=n,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(c," */")),i=n.sources.map((function(t){return"/*# sourceURL=".concat(n.sourceRoot).concat(t," */")}));return[r].concat(i).concat([o]).join("\n")}var a,s,c;return[r].join("\n")}(e,t);return e[2]?"@media ".concat(e[2],"{").concat(r,"}"):r})).join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},o=0;o<this.length;o++){var i=this[o][0];null!=i&&(n[i]=!0)}for(var a=0;a<t.length;a++){var s=t[a];null!=s[0]&&n[s[0]]||(r&&!s[2]?s[2]=r:r&&(s[2]="(".concat(s[2],") and (").concat(r,")")),e.push(s))}},e}},function(t,e,r){"use strict";var n,o={},i=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var t={};return function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}t[e]=r}return t[e]}}();function s(t,e){for(var r=[],n={},o=0;o<t.length;o++){var i=t[o],a=e.base?i[0]+e.base:i[0],s={css:i[1],media:i[2],sourceMap:i[3]};n[a]?n[a].parts.push(s):r.push(n[a]={id:a,parts:[s]})}return r}function c(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=o[n.id],a=0;if(i){for(i.refs++;a<i.parts.length;a++)i.parts[a](n.parts[a]);for(;a<n.parts.length;a++)i.parts.push(b(n.parts[a],e))}else{for(var s=[];a<n.parts.length;a++)s.push(b(n.parts[a],e));o[n.id]={id:n.id,refs:1,parts:s}}}}function u(t){var e=document.createElement("style");if(void 0===t.attributes.nonce){var n=r.nc;n&&(t.attributes.nonce=n)}if(Object.keys(t.attributes).forEach((function(r){e.setAttribute(r,t.attributes[r])})),"function"==typeof t.insert)t.insert(e);else{var o=a(t.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(e)}return e}var l,f=(l=[],function(t,e){return l[t]=e,l.filter(Boolean).join("\n")});function d(t,e,r,n){var o=r?"":n.css;if(t.styleSheet)t.styleSheet.cssText=f(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function p(t,e,r){var n=r.css,o=r.media,i=r.sourceMap;if(o&&t.setAttribute("media",o),i&&btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var h=null,v=0;function b(t,e){var r,n,o;if(e.singleton){var i=v++;r=h||(h=u(e)),n=d.bind(null,r,i,!1),o=d.bind(null,r,i,!0)}else r=u(e),n=p.bind(null,r,e),o=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(r)};return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else o()}}t.exports=function(t,e){(e=e||{}).attributes="object"==typeof e.attributes?e.attributes:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=i());var r=s(t,e);return c(r,e),function(t){for(var n=[],i=0;i<r.length;i++){var a=r[i],u=o[a.id];u&&(u.refs--,n.push(u))}t&&c(s(t,e),e);for(var l=0;l<n.length;l++){var f=n[l];if(0===f.refs){for(var d=0;d<f.parts.length;d++)f.parts[d]();delete o[f.id]}}}}}]);
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e){t.exports=require("react")},function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),a=o(r(0));r(2);e.default=function(t){var e=t.height,r=t.width,o=t.style,s=t.children,c=0,u=!1,l=i.useRef(null),f=i.useRef(null),d=i.useRef(null),p=i.useRef(null),h=r.includes("%")?"100%":r,v=i.useState(0),b=v[0],g=v[1],m=i.useState(0),y=m[0],w=m[1];function x(){var t=document.createElement("div");t.style.width="100px",t.style.visibility="hidden",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);var e=t.offsetWidth;t.style.overflow="scroll";var r=document.createElement("div");r.style.width="100%",t.appendChild(r);var n=r.offsetWidth;return t.parentNode.removeChild(t),e-n}function j(t){if(!1!==u){var e=c;if(e){var r=100*(-1*(d.current.getBoundingClientRect().top-t.clientY)-(p.current.offsetHeight-e))/d.current.offsetHeight;f.current.scrollTop=r*f.current.scrollHeight/100,d.current.style.opacity="1"}}}function C(t){u=!1,c=0,document.removeEventListener("mousemove",j),document.onselectstart=null,d.current.style.opacity="0"}return i.useEffect((function(){var t;t=100*f.current.clientHeight/l.current.scrollHeight,g(t=t>100?100:t)})),a.default.createElement("div",{className:"scrollbar",style:n({height:e,width:r},o)},a.default.createElement("div",{className:"scrollbar-content",ref:f,style:{width:"calc("+h+" + "+x()+"px)"},onScroll:function(){w(100*f.current.scrollTop/f.current.clientHeight)}},a.default.createElement("div",{ref:l,style:{paddingRight:x()+"px"}},s)),b<100&&a.default.createElement("div",{className:"scrollbar-bar",ref:d,onClick:function(t){var e=100*(Math.abs(t.target.getBoundingClientRect().top-t.clientY)-p.current.offsetHeight/2)/f.current.offsetHeight;f.current.scrollTop=e*f.current.scrollHeight/100}},a.default.createElement("div",{className:"scrollbar-thumb",ref:p,style:{height:b+"%",transform:"translateY("+y+"%)"},onMouseDown:function(t){!function(t){t.nativeEvent.stopImmediatePropagation(),t.stopPropagation(),u=!0,document.addEventListener("mousemove",j),document.addEventListener("mouseup",C),document.onselectstart=null}(t),c=t.currentTarget.offsetHeight-(t.clientY-t.currentTarget.getBoundingClientRect().top)}})))}},function(t,e,r){var n=r(3);"string"==typeof n&&(n=[[t.i,n,""]]);var o={insert:"head",singleton:!1};r(5)(n,o);n.locals&&(t.exports=n.locals)},function(t,e,r){(t.exports=r(4)(!1)).push([t.i,"* {\r\n margin: 0;\r\n padding: 0;\r\n}\r\n.scrollbar { \r\n position: relative;\r\n overflow: hidden;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n.scrollbar-content {\r\n overflow: auto;\r\n height: 100%;\r\n}\r\n.scrollbar-bar {\r\n position: absolute;\r\n right: 0;\r\n bottom: 0;\r\n z-index: 1;\r\n opacity: 0;\r\n width: 6px;\r\n height: 100%;\r\n border-radius: 4px;\r\n background-color: rgba(0, 0, 0, .1);\r\n transition: opacity 120ms ease-out;\r\n}\r\n.scrollbar-thumb {\r\n position: relative;\r\n display: block;\r\n width: 100%;\r\n height: 0;\r\n border-radius: inherit;\r\n background-color: rgba(135, 141, 153, .3);\r\n transition: background-color .3s, transform .15s;\r\n cursor: pointer;\r\n}\r\n.scrollbar-thumb:hover {\r\n background-color: rgba(54, 59, 70, 0.3);\r\n}\r\n\r\n.scrollbar:hover .scrollbar-bar {\r\n opacity: 1 !important;\r\n transition: opacity 340ms ease-out;\r\n}",""])},function(t,e,r){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r=function(t,e){var r=t[1]||"",n=t[3];if(!n)return r;if(e&&"function"==typeof btoa){var o=(a=n,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(c," */")),i=n.sources.map((function(t){return"/*# sourceURL=".concat(n.sourceRoot).concat(t," */")}));return[r].concat(i).concat([o]).join("\n")}var a,s,c;return[r].join("\n")}(e,t);return e[2]?"@media ".concat(e[2],"{").concat(r,"}"):r})).join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},o=0;o<this.length;o++){var i=this[o][0];null!=i&&(n[i]=!0)}for(var a=0;a<t.length;a++){var s=t[a];null!=s[0]&&n[s[0]]||(r&&!s[2]?s[2]=r:r&&(s[2]="(".concat(s[2],") and (").concat(r,")")),e.push(s))}},e}},function(t,e,r){"use strict";var n,o={},i=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var t={};return function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}t[e]=r}return t[e]}}();function s(t,e){for(var r=[],n={},o=0;o<t.length;o++){var i=t[o],a=e.base?i[0]+e.base:i[0],s={css:i[1],media:i[2],sourceMap:i[3]};n[a]?n[a].parts.push(s):r.push(n[a]={id:a,parts:[s]})}return r}function c(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=o[n.id],a=0;if(i){for(i.refs++;a<i.parts.length;a++)i.parts[a](n.parts[a]);for(;a<n.parts.length;a++)i.parts.push(b(n.parts[a],e))}else{for(var s=[];a<n.parts.length;a++)s.push(b(n.parts[a],e));o[n.id]={id:n.id,refs:1,parts:s}}}}function u(t){var e=document.createElement("style");if(void 0===t.attributes.nonce){var n=r.nc;n&&(t.attributes.nonce=n)}if(Object.keys(t.attributes).forEach((function(r){e.setAttribute(r,t.attributes[r])})),"function"==typeof t.insert)t.insert(e);else{var o=a(t.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(e)}return e}var l,f=(l=[],function(t,e){return l[t]=e,l.filter(Boolean).join("\n")});function d(t,e,r,n){var o=r?"":n.css;if(t.styleSheet)t.styleSheet.cssText=f(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function p(t,e,r){var n=r.css,o=r.media,i=r.sourceMap;if(o&&t.setAttribute("media",o),i&&btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var h=null,v=0;function b(t,e){var r,n,o;if(e.singleton){var i=v++;r=h||(h=u(e)),n=d.bind(null,r,i,!1),o=d.bind(null,r,i,!0)}else r=u(e),n=p.bind(null,r,e),o=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(r)};return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else o()}}t.exports=function(t,e){(e=e||{}).attributes="object"==typeof e.attributes?e.attributes:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=i());var r=s(t,e);return c(r,e),function(t){for(var n=[],i=0;i<r.length;i++){var a=r[i],u=o[a.id];u&&(u.refs--,n.push(u))}t&&c(s(t,e),e);for(var l=0;l<n.length;l++){var f=n[l];if(0===f.refs){for(var d=0;d<f.parts.length;d++)f.parts[d]();delete o[f.id]}}}}}]);
{
"name": "@s-yh/react-scroll-bar",
"version": "1.0.6",
"version": "1.0.7",
"description": "A scrollbar for react",

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

"build": "webpack --progress",
"pub": "npm publish --access=public"
"pub": "webpack --progress & npm publish --access=public"
},

@@ -11,0 +11,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc