{"name":"react-focus-on","version":"3.6.0","keywords":["react","modal","focus-management","scroll","isolation"],"author":{"name":"Anton Korzunov","email":"thekashey@gmail.com"},"license":"MIT","_id":"react-focus-on@3.6.0","homepage":"https://github.com/theKashey/react-focus-on#readme","bugs":{"url":"https://github.com/theKashey/react-focus-on/issues"},"dist":{"shasum":"159e13082dad4ea1f07abe11254f0e981d5a7b79","tarball":"http://registry-npm.ywwl.com/react-focus-on/download/react-focus-on-3.6.0.tgz","fileCount":44,"integrity":"sha512-onIRjpd9trAUenXNdDcvjc8KJUSklty4X/Gr7hAm/MzM7ekSF2pg9D8KBKL7ipige22IAPxLRRf/EmJji9KD6Q==","signatures":[{"sig":"MEUCIG5yIL9UigrkF6g/kokRJ1E6PyfmK5uk1QN0v1+yGxFVAiEA/pXCrp2W4Ryeaz8TjMcNAWPVcdX6DRCnePOhQF9z1WE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":40890,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiboNCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoszRAAme/wB9JfNTBuu+gYYccSSXVTzARcEjYx/GbhL5ZzJwV4+kI1\r\nedXGZVrUs/qsHLQexF459rT3IVl2NfY2uFRTC5VJ7LHJKk9TVNxABSe0ylqS\r\nPZ0cD3Mz7FPXFDr1GdXx437eTxbsXR7vBQ1xWX5du5xnNzwDiBp3izxB0dDw\r\nF97eeObkKpi97IArVM4tsGm3y5S5UWEPWVmRQj0O2K6wHl0LkaGL+0N2Q+pN\r\ns44ZsJE0UdKwJFgK1d6mJK6MuTjqq7yP0EdJoMwOrtIKDs85Uh1Mi6vOeuAb\r\nwtwcnWfdyWU6Stedr7zq6OcoXBH5B+HkbCy20kuMHDMS74/oN0m8j2wywp/b\r\n1r8ambsMzzfEW8mxR1FGTy3df7aUNWh6H4VvFhS3pp8oHe4P0ld340JY5CWD\r\nTEXOWfLIysWVnm90mv+MPwJCpLULzXP/4nfRr6ePHD74HGzqLYsM4nhI+TUq\r\nzzLiOf6BRjk4JvgKArGDpRX+tu3aNmvxo0EZJReIFmxOUY3g2xTy96PJEkLr\r\nFBxoh9XQSX59eotXmHgMebKg9twmvbVA/EZd2n28v6CnH3qDMOiHorX+uAdK\r\ndk39XEvXyzSrbrNj0KMNHFbeba0aafQSqocGYOEF4cs8cfnsbUQdyoFrn0By\r\nvfwmxlW/VGoL2Uz+3QJk97b9JqKI8B7dPCc=\r\n=gRvO\r\n-----END PGP SIGNATURE-----\r\n","size":9408,"noattachment":false,"key":"/react-focus-on/-/react-focus-on-3.6.0.tgz"},"main":"dist/es5/index.js","types":"dist/es5/index.d.ts","module":"dist/es2015/index.js","engines":{"node":">=8.5.0"},"gitHead":"a2f4fd83c887cf18ab605a5317088dec2fa4fbd9","scripts":{"dev":"ts-react-toolbox dev","lint":"ts-react-toolbox lint","size":"npx size-limit","test":"ts-react-toolbox test","build":"ts-react-toolbox build","format":"ts-react-toolbox format","static":"ts-react-toolbox publish","analyze":"ts-react-toolbox analyze","link:fl":"rsync -av ../focus-lock node_modules/ --exclude node_modules --exclude .git","link:rf":"rsync -av ../react-remove-scroll node_modules/ --exclude node_modules --exclude .git","link:sb":"rsync -av ../react-remove-scroll-bar node_modules/ --exclude node_modules --exclude .git","link:ss":"rsync -av ../react-remove-scroll-bar/node_modules/react-style-singleton node_modules/ --exclude node_modules --exclude .git","release":"ts-react-toolbox release","test:ci":"ts-react-toolbox test --runInBand --coverage","link:all":"yarn link:fl & yarn link:rfl & yarn link:ss & yarn link:rf & yarn link:sb","link:rfl":"rsync -av ../react-focus-lock node_modules/ --exclude node_modules --exclude .git","bootstrap":"ts-react-toolbox init","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","prepublish":"yarn build && yarn changelog"},"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"repository":{"url":"git+https://github.com/theKashey/react-focus-on.git","type":"git"},"_npmVersion":"6.14.15","description":"The final solution for WAI ARIA compatible modal dialogs or full-screen tasks.","directories":{},"jsnext:main":"dist/es2015/index.js","resolutions":{"typescript":"^3.8.0"},"sideEffects":["**/sidecar.js"],"_nodeVersion":"14.18.3","dependencies":{"tslib":"^2.3.1","aria-hidden":"^1.1.3","use-sidecar":"^1.1.2","react-focus-lock":"^2.9.0","use-callback-ref":"^1.3.0","react-remove-scroll":"^2.5.2","react-style-singleton":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"react":"^16.8.6","enzyme":"^3.10.0","react-dom":"^16.8.6","@types/react":"^18.0.8","react-powerplug":"^1.0.0","ts-react-toolbox":"^0.2.10","enzyme-adapter-react-16":"^1.14.0","conventional-changelog-cli":"^2.0.12"},"peerDependencies":{"react":"^16.8.0 || ^17.0.0 || ^18.0.0","@types/react":"^16.8.0 || ^17.0.0 || ^18.0.0"},"peerDependenciesMeta":{"@types/react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/react-focus-on_3.6.0_1651409730272_0.35015972333558065","host":"s3://npm-registry-packages"},"readme":"<div align=\"center\">\n  <h1>👁 React-Focus-On </h1>\n  <br/>\n   lock and loaded!\n  <br/>\n  \n  <a href=\"https://www.npmjs.com/package/react-focus-on\">\n    <img src=\"https://img.shields.io/npm/v/react-focus-on.svg?style=flat-square\" />\n  </a>\n    \n  <a href=\"https://travis-ci.org/theKashey/react-focus-on\">\n   <img src=\"https://img.shields.io/travis/theKashey/react-focus-on.svg?style=flat-square\" alt=\"Build status\">\n  </a> \n\n  <a href=\"https://www.npmjs.com/package/react-focus-on\">\n   <img src=\"https://img.shields.io/npm/dm/react-focus-on.svg\" alt=\"npm downloads\">\n  </a> \n\n  <a href=\"https://bundlephobia.com/result?p=react-focus-on\">\n   <img src=\"https://img.shields.io/bundlephobia/minzip/react-focus-on.svg\" alt=\"bundle size\">\n  </a>   \n  <br/>\n</div>\n\nThe final solution for WAI ARIA compatible Modal Dialogs or any full-screen tasks:\n- locks __focus__ inside using [react-focus-lock](https://github.com/theKashey/react-focus-lock)\n- disables page __scroll__ and user interactions using [react-remove-scroll](https://github.com/theKashey/react-remove-scroll)\n- hides rest of a page from screen-readers using [aria-hidden](https://github.com/theKashey/aria-hidden)\n\nNow you could __focus on__ a single task.\n\n> This is basically the `inert` \n\n_Minimal_ size - __no more than 2kb__, _maximal_ - no more that 6kb. See sidecar example for details.\n\n## Example\nCode sandbox example - https://codesandbox.io/s/p3vjp8mzw7\n```js\nimport {FocusOn} from 'react-focus-on';\n\n<FocusOn\n onClickOutside={callback}\n onEscapeKey={callback}\n shards={[externalRef]}\n>\n content you should be \"focused\" on\n</FocusOn>\n```\n\n# API\n### FocusOn\n`FocusOn` - the focus on component\n - `enabled` - controls behaviour\n - `[shards]` - a list of Refs to be considered as a part of the Lock. A way to properly handle portals or scattered lock.\n--- \n - `[autoFocus=true]` - enables or disables `auto focus` management (see [react-focus-lock documentation](https://github.com/theKashey/react-focus-lock))\n - `[returnFocus=true]` - enables or disables `return focus` on lock deactivation (see [react-focus-lock documentation](https://github.com/theKashey/react-focus-lock))\n - `[whiteList=fn]` - you could whitelist locations FocusLock should carry about. Everything outside it will ignore. For example - any modals (see [react-focus-lock documentation](https://github.com/theKashey/react-focus-lock))\n - `[crossFrame=true]` - enables or disables cross frame focus trapping. Setting this to false allows focus to move outside iframes (see [react-focus-lock issue](https://github.com/theKashey/react-focus-lock/issues/104))\n---\n - `[gapMode]` - the way removed ScrollBar would be _compensated_ - margin(default), or padding. See [scroll-locky documentation](https://github.com/theKashey/react-scroll-locky#gap-modes) to find the one you need.\n - `[noIsolation]` - disables aria-hidden isolation\n - `[inert]` - enables pointer-events isolation (☠️ dangerous, use to disable \"parent scrollbars\", refer to [react-remove-scroll](https://github.com/theKashey/react-remove-scroll) documentation)\n - `[allowPinchZoom]` - enables \"pinch-n-zoom\" behavior. By default it might be prevented, refer to [react-remove-scroll](https://github.com/theKashey/react-remove-scroll) documentation\n - `[preventScrollOnFocus]` - prevents a [side effect of a programatic page scroll](https://github.com/theKashey/react-focus-on/issues/62) caused by focusing elements. Especially useful to address modal animations.\n---\n - `[onActivation]` - on activation callback\n - `[onDeactivation]` - on deactivation callback\n---\n - `[onClickOutside]` - on click outside of \"focus\" area. (actually on any event \"outside\")\n - `[onEscapeKey]` - on Esc key down (and not defaultPrevented)\n \n## Additional API\n### Exposed from React-Focus-Lock\n - `AutoFocusInside` - to mark autofocusable element\n - `MoveFocusInside` - to move focus inside a component on mount\n - `InFocusGuard` - to \"guard\" a shard node (place an invisible node before and after)\n \nSee [react-focus-lock](https://github.com/theKashey/react-focus-lock) documentation for details.\n \n### Exposed from React-Remove-Scroll\n - `classNames.fullWidth` - \"100%\" width (will not change on scrollbar removal)\n - `classNames.zeroRight` - \"0\" right (will not change on scrollbar removal)\n  \nSee [react-remove-scroll](https://github.com/theKashey/react-remove-scroll) for details.\n\n> PS: Version 1 used React-scroll-locky which was replaced by remove-scroll.\n\n# Size\n- (🧩 full) 5.7kb after compression (excluding tslib).\n---\n- (👁 UI) __2kb__, visual elements only\n- (🚗 sidecar) 4kb, side effects  \n  \n### Import full\n```js\nimport {FocusOn} from 'react-focus-on';\n\n<FocusOn>\n {content}\n</FocusOn> \n```  \n\n### Import UI only\n```js\nimport {FocusOn} from 'react-focus-on/UI';\nimport {sidecar} from \"use-sidecar\";\n\nconst FocusOnSidecar = sidecar(  \n  () => import(/* webpackPrefetch: true */ \"react-focus-on/sidecar\")\n);\n\n<FocusOn\n    sideCar={FocusOnSidecar}\n>\n {content}\n</FocusOn> \n```\n\n# React versions\n- v1 and v2 might work with React 15/16\n- v3 require React 16.8+ (hooks)\n\n# Licence\n MIT\n  \n","publish_time":1651409730488,"maintainers":[{"name":"kashey","email":"thekashey@gmail.com"}],"_cnpm_publish_time":1651409730488,"dist-tags":{"beta":"3.1.1","latest":"3.10.2"}}