{"name":"overlayscrollbars-react","version":"0.3.0","description":"OverlayScrollbars wrapper for React.","keywords":["overlayscrollbars","react"],"homepage":"https://kingsora.github.io/OverlayScrollbars","repository":{"type":"git","url":"git+https://github.com/KingSora/OverlayScrollbars.git"},"bugs":{"url":"https://github.com/KingSora/OverlayScrollbars/issues"},"main":"./dist/overlayscrollbars-react.js","module":"./dist/overlayscrollbars-react.esm.js","typings":"./dist/types/index.d.ts","author":{"name":"KingSora | Rene Haas"},"license":"MIT","devDependencies":{"@types/overlayscrollbars":"^1.9.0","@types/react":"^18.0.0","chalk":"^2.4.2","gulp":"^4.0.2","gulp-json-editor":"^2.5.4","overlayscrollbars":"^1.11.0","react":"^18.0.0","rollup":"^1.32.1","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-typescript2":"^0.22.0","shelljs":"^0.8.3","typescript":"^3.8.3"},"peerDependencies":{"react":"^16.4.0 || ^17.0.0 || ^18.0.0","overlayscrollbars":"^1.10.0"},"scripts":{"setup":"npm i && cd example && npm i && cd ..","build":"node build.js","example":"cd example && npm start","build-example":"cd example && npm run build","test":"echo \"Error: no test specified\" && exit 1"},"_id":"overlayscrollbars-react@0.3.0","_nodeVersion":"16.3.0","_npmVersion":"7.15.1","dist":{"integrity":"sha512-dV74p9VL/aImqJpeYz0vmpScZYu6UiNTmRKfyI4CS0OYUpYCUiTd723adY38Grz2W57hoNCECWDzkOJRFDQeZg==","shasum":"6d18e741897131643aa8afbc7fed735fbd106c9c","tarball":"http://registry-npm.ywwl.com/overlayscrollbars-react/download/overlayscrollbars-react-0.3.0.tgz","fileCount":11,"unpackedSize":35111,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDr4HYVWIQY9GyailL/vVBJa2xgbQQfF/j68b3gBitBZwIgKwHP8L0hSVNmmPkPBn7hbgTttdLLoGFDKYeRgfRbMAg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJil2THACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpGNBAAl1Onhy1/iM9jiohLvzKSc06HR2WlzYcv8ayv2xqstAvKJm18\r\n0G48GMwU8W7pVTaZgFUOGhVECw8u2RWl2pfmTSdL6oHT92S0fin1+/ujCc9l\r\nFr8yvNLDjUWpaSgh0Ut/B5nO5B0rD5x3Oj3i3D1lnFi6W1HotNIslkDljl3Z\r\nJPApNTHR0wI30Qv6khebtnPHM4vbWX5EVRquv3g5OxgZaBQ7ksaNQRpDK/Xb\r\no5XeXBJ76ryl9A0QNVwnlFL2Rc37onk0jyIlQm/anFSkUPTEvyLWZXovJq/r\r\nUcR7NRmoE2wlVfdUAQZJkVpHEBtioNAeBBpcyEAPyEVQWLKBzk+Wzpx6MIqG\r\nhT78q/kifcIMT36bfZTdM97JV+ykps5SORHIau1ympAUswDlIcCIyWCEWHMh\r\ni61cDGzQ1TubM6nngl3xp1epxomo+jhJblCRn7Kw/CTu+Pe7ZtBpfueBrNzN\r\n4s2WzPXxjmgTQCuVWub9UvmKXy+w+E9Ur/H3BEdJCsE9xuHvaWjqq2sjGdqB\r\nA4RCdBD5YhMcsU2sm9AmeVxh3mK1fVdlP+4qi95qtvTXQKLyUlNhwdQ/gDkp\r\nWLIn4lFPqdmUPPULA1ZrA6lJ37cAG5ZkSWxDGVcNX2oX1JQRMo8tZ56nKSNg\r\n1Ow4n5IR1/HVyjHZ6/KqoopJ+kjWzwnTWog=\r\n=YfN1\r\n-----END PGP SIGNATURE-----\r\n","size":7449,"noattachment":false,"key":"/overlayscrollbars-react/-/overlayscrollbars-react-0.3.0.tgz"},"_npmUser":{"name":"kingsora","email":"king-sora@hotmail.de"},"directories":{},"maintainers":[{"name":"kingsora","email":"king-sora@hotmail.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/overlayscrollbars-react_0.3.0_1654088903684_0.6941747301709336"},"_hasShrinkwrap":false,"readme":"<div align=\"center\">\n  <a href=\"https://kingsora.github.io/OverlayScrollbars\"><img src=\"https://raw.githubusercontent.com/KingSora/OverlayScrollbars/master/logo/logo.png\" width=\"160\" height=\"160\" alt=\"OverlayScrollbars\"></a>\n  <a href=\"https://reactjs.org\"><img src=\"https://raw.githubusercontent.com/KingSora/OverlayScrollbars/master/packages/overlayscrollbars-react/logo.svg\" width=\"160\" height=\"160\" alt=\"React\"></a>\n</div>\n<br />\n<div align=\"center\">\n\n  [![OverlayScrollbars](https://img.shields.io/badge/OverlayScrollbars-%5E2.0.0-338EFF?style=flat-square)](https://github.com/KingSora/OverlayScrollbars)\n  [![React](https://img.shields.io/badge/React-%3E=16.8.0-61DAFB?style=flat-square&logo=React)](https://github.com/facebook/react/)\n  [![Downloads](https://img.shields.io/npm/dt/overlayscrollbars-react.svg?style=flat-square)](https://www.npmjs.com/package/overlayscrollbars-react)\n  [![Version](https://img.shields.io/npm/v/overlayscrollbars-react.svg?style=flat-square)](https://www.npmjs.com/package/overlayscrollbars-react)\n  [![License](https://img.shields.io/github/license/kingsora/overlayscrollbars.svg?style=flat-square)](#)\n\n</div>\n<h3 align=\"center\">\n  <a href=\"https://kingsora.github.io/OverlayScrollbars\">Website</a>\n  &nbsp;&nbsp;&bull;&nbsp;&nbsp;\n  <a href=\"https://kingsora.github.io/OverlayScrollbars/examples\">Examples</a>\n</h3>\n\n# OverlayScrollbars for React\n\nThis is the official OverlayScrollbars React wrapper.\n\n## Installation\n\n```sh\nnpm install overlayscrollbars-react\n```\n\n## Peer Dependencies\n\nOverlayScrollbars for React has the following **peer dependencies**:\n\n- The vanilla JavaScript library: [overlayscrollbars](https://www.npmjs.com/package/overlayscrollbars)\n\n```\nnpm install overlayscrollbars\n```\n\n- The React framework: [react](https://www.npmjs.com/package/react)\n\n```\nnpm install react\n```\n\n## Usage\n\nThe first step is to import the CSS file into your app:\n```ts\nimport 'overlayscrollbars/overlayscrollbars.css';\n```\n\n> __Note__: If the path `'overlayscrollbars/overlayscrollbars.css'` is not working use `'overlayscrollbars/styles/overlayscrollbars.css'` as the import path for the CSS file.\n\n## Component\n\nThe main entry point is the `OverlayScrollbarsComponent` which can be used in your application as a component:\n\n```jsx\nimport { OverlayScrollbarsComponent } from \"overlayscrollbars-react\";\n\n// ...\n\n<OverlayScrollbarsComponent defer>\n  example content\n</OverlayScrollbarsComponent>\n```\n\n### Properties\n\nThe component accepts all properties of regular elements such as `div` and `span`.  \nAdditionally it has custom optional properties:\n\n- `element`: accepts a `string` which represents the tag of the root element.\n- `options`: accepts an `object` which represents the OverlayScrollbars options.\n- `events`: accepts an `object` which represents the OverlayScrollbars events.\n- `defer`: accepts an `boolean` or `object`. Defers the initialization to a point in time when the browser is idle.\n\n> __Note__: None of the properties has to be memoized.\n\n> __Note__: Its **highly recommended** to use the `defer` option whenever possible to defer the initialization to a browser's idle period.\n\n```jsx\n// example usage\n<OverlayScrollbarsComponent\n  element=\"span\"\n  options={{ scrollbars: { autoHide: 'scroll' } }}\n  events={{ scroll: () => { /* ... */ } }}\n  defer\n/>\n```\n\n### Ref\n\nThe `ref` of the `OverlayScrollbarsComponent` will give you an object with which you can access the OverlayScrollbars `instance` and the root `element` of the component.  \nThe ref object has two properties:\n\n- `osInstance`: a function which returns the OverlayScrollbars instance.\n- `getElement`: a function which returns the root element.\n\n## Hook\n\nIn case the `OverlayScrollbarsComponent` is not enough, you can also use the `useOverlayScrollbars` hook:\n\n```jsx\nimport { useOverlayScrollbars } from \"overlayscrollbars-react\";\n\n// example usage\nconst Component = () => {\n  const ref = useRef();\n  const [initialize, instance] = useOverlayScrollbars({ options, events, defer });\n  \n  useEffect(() => {\n    initialize(ref.current);\n  }, [initialize]);\n  \n  return <div ref={ref} />\n}\n```\n\nThe hook is for advanced usage and lets you control the whole initialization process. This is useful if you want to integrate it with other plugins such as `react-window` or `react-virtualized`.\n\nThe hook will destroy the instance automatically if the component unmounts.\n\n### Parameters\n\nParameters are optional and similar to the `OverlayScrollbarsComponent`.\nIts an `object` with optional properties:\n\n- `options`: accepts an `object` which represents the OverlayScrollbars options.\n- `events`: accepts an `object` which represents the OverlayScrollbars events.\n- `defer`: accepts an `boolean` or `object`. Defers the initialization to a point in time when the browser is idle.\n\n### Return\n\nThe `useOverlayScrollbars` hook returns a `tuple` with two values:\n\n- The first value is the `initialization` function, it takes one argument which is the `InitializationTarget`.\n- The second value is a function which returns the current OverlayScrollbars instance or `null` if not initialized.\n\n> __Note__: The identity of both functions is stable and won't change, thus they can safely be used in any dependency array.\n\n## License\n\nMIT\n","publish_time":1654088903877,"_cnpm_publish_time":1654088903877,"dist-tags":{"latest":"0.5.7"}}