{"name":"overlayscrollbars-react","version":"0.4.0","description":"OverlayScrollbars for React.","author":{"name":"Rene Haas | KingSora"},"license":"MIT","homepage":"https://kingsora.github.io/OverlayScrollbars","bugs":{"url":"https://github.com/KingSora/OverlayScrollbars/issues"},"repository":{"type":"git","url":"git+https://github.com/KingSora/OverlayScrollbars.git","directory":"packages/overlayscrollbars-react"},"keywords":["overlayscrollbars","react","component","hook","hooks","styleable","scrollbar","scrollbars","scroll"],"main":"overlayscrollbars-react.umd.js","module":"overlayscrollbars-react.es.js","types":"types/overlayscrollbars-react.d.ts","peerDependencies":{"react":">=16.8.0","overlayscrollbars":"^2.0.0"},"sideEffects":false,"gitHead":"712785c6a5d062106d26c4d8fe9016702008e364","_id":"overlayscrollbars-react@0.4.0","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-8NHROGn8RrLYaOHJQWMBC1W/jVIlZzxhDbuNK16CExbut0n+qy30MAMqfNu6+SDLeCX7AFEiOapqj/2tHHYxmQ==","shasum":"2e738f97e30194e22dba007abf4d7ec10ff20713","tarball":"http://registry-npm.ywwl.com/overlayscrollbars-react/download/overlayscrollbars-react-0.4.0.tgz","fileCount":10,"unpackedSize":30135,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDeznMHBtUwl66S+YOOwK9Lefv1uc0oYVxM6EgGLCFx6AIhAOGf+4e4JvCI6o4ShSLeBy1vP5f3FyzmjK7AGfsds86t"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjb4XjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqoKg/+PNt8OyBl8z7UwKecjBt2uFjxc1ZUTGWiKje65SbR3WQfEPfH\r\nyFnxjM/yilsm7k7mKcZWg1Orvc0En6dU/qz+HRdgbE+e6YkOis67t8c0Hq3I\r\nS3l6IQgy1q9ln/vOAfZ1cp7DMh51sfszD3AO8/S6fxapX1x70jsDOrHNFQOT\r\nwfCKPV6hnpc8TCE5wLR4yQLUYo92K8fdwfkJ/29CsWgcWe/WUzrMZ2UCrp+T\r\nexOT9sXRNJPrw/59U6LGxFFH4bKT60E00QHLm++aH4/pFHYBzgPF18N0+pNK\r\nVB0R2zVoK0tidHrvTlSmQyh3ALHVfGyBgKbYWrjz/76iX+nNmZG0n0kaT5Ix\r\n3HWreoQDP3uY+82CDag6y82C47Nn6M3tH2l2UhCY/4Cvt11Xrc+iH422yTUk\r\npu4gCmvoIw8Xh+xCOzCSuvhFRrEfFRWFFhXLAO50YY+hGT0EnLGzoro1FPtT\r\nJsLO5pB168zv6aWTcKJ49/1ARjx1KM9HPdt3UDOKJpMM7Kiw8yeZjEQwk62B\r\nyLmqgFrsrCUZdatPcVS1QjxrTH3x0UsjXfYi1O09Psm1veSCQFZv+Lyh6myZ\r\noOeIupSTNxLqvcnfjkGC2hAYt6wilbvbHHamC9BZrKOZiIQoiMZnKBRHHo8J\r\nHlc2JVt9FmBswb3LuPuEz5P9rlvwJsr/PQ8=\r\n=3y6i\r\n-----END PGP SIGNATURE-----\r\n","size":6969,"noattachment":false,"key":"/overlayscrollbars-react/-/overlayscrollbars-react-0.4.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.4.0_1668253155395_0.5400566928683501"},"_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":1668253155574,"_cnpm_publish_time":1668253155574,"dist-tags":{"latest":"0.5.7"}}