{"_id":"@aptuitiv/react-router-prompt","_rev":"1-b250256f0b5f00795afc21f3bf195cb3","name":"@aptuitiv/react-router-prompt","dist-tags":{"latest":"0.7.1"},"versions":{"0.7.0":{"version":"0.7.0","name":"@aptuitiv/react-router-prompt","description":"React Router Navigation Prompt for v6","type":"module","main":"./dist/react-router-prompt.umd.cjs","module":"./dist/react-router-prompt.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/react-router-prompt.js","require":"./dist/react-router-prompt.umd.cjs","types":"./dist/index.d.ts"}},"author":{"name":"Shyam Gupta","url":"shyamm@outlook.com"},"license":"MIT","private":false,"repository":{"type":"git","url":"git+https://github.com/aptuitiv/react-router-prompt.git"},"homepage":"https://github.com/aptuitiv/react-router-prompt#readme","keywords":["confirm","navigation","prompt","react","router"],"scripts":{"dev":"vite","build":"tsc && vite build","lint":"eslint src --ext .js,.jsx,.ts,.tsx","lint:fix":"eslint src --ext .js,.jsx,.ts,.tsx --fix","format":"prettier \"src/**/*.{js,jsx,ts,tsx,css,scss}\" --write","size":"size-limit","prepublishOnly":"yarn build","prepare":"husky install"},"husky":{"hooks":{"pre-commit":"pnpm lint"}},"devDependencies":{"@size-limit/preset-small-lib":"^11.0.2","@types/react":"^18.2.55","@types/react-dom":"^18.2.19","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^7.0.1","@vitejs/plugin-react-swc":"^3.6.0","eslint":"^8.56.0","eslint-config-airbnb":"^19.0.4","eslint-config-airbnb-typescript":"^17.1.0","eslint-config-prettier":"^9.1.0","eslint-plugin-import":"^2.29.1","eslint-plugin-jsx-a11y":"^6.8.0","eslint-plugin-prettier":"^5.1.3","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0","history":"^5.3.0","husky":"^9.0.11","path":"^0.12.7","prettier":"^3.2.5","react":"^18.2.0","react-dom":"^18.2.0","react-router-dom":"^6.22.1","size-limit":"^11.0.2","typescript":"^5.3.3","vite":"^5.1.3","vite-plugin-dts":"^3.7.2","vite-tsconfig-paths":"^4.3.1"},"peerDependencies":{"react":">=16.8","react-dom":">=16.8","react-router-dom":">=6.19"},"size-limit":[{"path":"dist/react-router-prompt.js","limit":"1.2 KB"},{"path":"dist/react-router-prompt.umd.cjs","limit":"1.2 KB"}],"gitHead":"360b9f65d35eef274346a8e76582e2c30e9a13b3","bugs":{"url":"https://github.com/aptuitiv/react-router-prompt/issues"},"_id":"@aptuitiv/react-router-prompt@0.7.0","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-Bs/U8pDyisrSojGRam9hsSGVUM++grQzHJErSmAq37UAcDRBIUiSO1fP8GpN41Rl9XFp/yMMm4ymSHyH8fS1eQ==","shasum":"79ccd693e81a770c90f708649ce0cabd58acbdfd","tarball":"https://registry.npmjs.org/@aptuitiv/react-router-prompt/-/react-router-prompt-0.7.0.tgz","fileCount":10,"unpackedSize":46970,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGrfKrJ5QWYsjcAfM4iWKVg7vs76bgI1ZWcIR/SW21w7AiEAnczD2ZqJL1RyMOr+r5nOwIDuncItzUJdyVbspEdUXIg="}]},"_npmUser":{"name":"erictompkins","email":"eric@aptuitiv.com"},"directories":{},"maintainers":[{"name":"erictompkins","email":"eric@aptuitiv.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-router-prompt_0.7.0_1708135193403_0.20698529312497738"},"_hasShrinkwrap":false},"0.7.1":{"version":"0.7.1","name":"@aptuitiv/react-router-prompt","description":"React Router Navigation Prompt for v6","type":"module","main":"./dist/react-router-prompt.umd.cjs","module":"./dist/react-router-prompt.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/react-router-prompt.js","require":"./dist/react-router-prompt.umd.cjs","types":"./dist/index.d.ts"}},"author":{"name":"Shyam Gupta","url":"shyamm@outlook.com"},"license":"MIT","private":false,"repository":{"type":"git","url":"git+https://github.com/aptuitiv/react-router-prompt.git"},"homepage":"https://github.com/aptuitiv/react-router-prompt#readme","keywords":["confirm","navigation","prompt","react","router"],"scripts":{"dev":"vite","build":"tsc && vite build","lint":"eslint src --ext .js,.jsx,.ts,.tsx","lint:fix":"eslint src --ext .js,.jsx,.ts,.tsx --fix","format":"prettier \"src/**/*.{js,jsx,ts,tsx,css,scss}\" --write","size":"size-limit","prepublishOnly":"yarn build","prepare":"husky install"},"husky":{"hooks":{"pre-commit":"pnpm lint"}},"devDependencies":{"@size-limit/preset-small-lib":"^11.0.2","@types/react":"^18.2.55","@types/react-dom":"^18.2.19","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^7.0.1","@vitejs/plugin-react-swc":"^3.6.0","eslint":"^8.56.0","eslint-config-airbnb":"^19.0.4","eslint-config-airbnb-typescript":"^17.1.0","eslint-config-prettier":"^9.1.0","eslint-plugin-import":"^2.29.1","eslint-plugin-jsx-a11y":"^6.8.0","eslint-plugin-prettier":"^5.1.3","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0","history":"^5.3.0","husky":"^9.0.11","path":"^0.12.7","prettier":"^3.2.5","react":"^18.2.0","react-dom":"^18.2.0","react-router-dom":"^6.22.1","size-limit":"^11.0.2","typescript":"^5.3.3","vite":"^5.1.3","vite-plugin-dts":"^3.7.2","vite-tsconfig-paths":"^4.3.1"},"peerDependencies":{"react":">=16.8","react-dom":">=16.8","react-router-dom":">=6.19"},"size-limit":[{"path":"dist/react-router-prompt.js","limit":"1.2 KB"},{"path":"dist/react-router-prompt.umd.cjs","limit":"1.2 KB"}],"gitHead":"22bfaa2ea42a68ada3ffdfd235045d6502c34e15","bugs":{"url":"https://github.com/aptuitiv/react-router-prompt/issues"},"_id":"@aptuitiv/react-router-prompt@0.7.1","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-3A2lw6Ik9gURrBUCkBq4U2GqxfX6aqVvxTtnBQ5vH3ox/tINKr3vDlAK22KOp292CIoHJfCgyB3NfisPr5YUYA==","shasum":"644dcf5f84be5b8399fa13f49aa62f42cdd569f6","tarball":"https://registry.npmjs.org/@aptuitiv/react-router-prompt/-/react-router-prompt-0.7.1.tgz","fileCount":10,"unpackedSize":47128,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNLrLZRUbm6sJxNPnQtDqwo3iJFuU0xpLqE7bT4Y0UngIgBHa7jyFZZsg4+ErwefKp52vHMfomOUDtIUPaUWFAgcQ="}]},"_npmUser":{"name":"erictompkins","email":"eric@aptuitiv.com"},"directories":{},"maintainers":[{"name":"erictompkins","email":"eric@aptuitiv.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-router-prompt_0.7.1_1708135356812_0.7189227034911589"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-17T01:59:53.333Z","0.7.0":"2024-02-17T01:59:53.562Z","modified":"2024-02-17T02:02:37.557Z","0.7.1":"2024-02-17T02:02:37.109Z"},"maintainers":[{"name":"erictompkins","email":"eric@aptuitiv.com"}],"description":"React Router Navigation Prompt for v6","homepage":"https://github.com/aptuitiv/react-router-prompt#readme","keywords":["confirm","navigation","prompt","react","router"],"repository":{"type":"git","url":"git+https://github.com/aptuitiv/react-router-prompt.git"},"author":{"name":"Shyam Gupta","url":"shyamm@outlook.com"},"bugs":{"url":"https://github.com/aptuitiv/react-router-prompt/issues"},"license":"MIT","readme":"# react-router-prompt 🚨\n\n> A component for the react-router 6 `Prompt`. Allows to create more flexible dialogs.\n\n**This is updated by Aptuitiv to not wrap the content in a `div` tag. The `div` tag was causing some issues with certain CSS that depends on grid layouts.**\n\n[![npm version](https://img.shields.io/npm/v/react-router-prompt.svg)](https://www.npmjs.com/package/react-router-prompt)\n\n[![npm downloads](https://img.shields.io/npm/dw/react-router-prompt.svg)](https://www.npmjs.com/package/react-router-prompt)\n\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-router-prompt)](https://www.npmjs.com/package/react-router-prompt)\n\n## ✨ [Demo](https://codesandbox.io/s/react-router-prompt-example-react-router-6-7-y9ug7z?file=/src/App.js)\n\n## 🏠 [Homepage](https://github.com/sshyam-gupta/react-router-prompt#readme)\n\n## Installation\n\n### Prerequisite\n\n**React-router-dom >= 6.19** and can be used only with [**data routers**](https://reactrouter.com/en/6.8.1/routers/picking-a-router#using-v64-data-apis)\n\n```bash\npnpm add react-router-prompt\n```\n\nor with other package manager like yarn\n\n```bash\nyarn add react-router-prompt\n```\n\n## Basic Usage\n\n```jsx\n<ReactRouterPrompt when={isDirty}>\n  {({ isActive, onConfirm, onCancel }) => (\n    <Modal show={isActive}>\n      <div>\n        <p>Do you really want to leave?</p>\n        <button onClick={onCancel}>Cancel</button>\n        <button onClick={onConfirm}>Ok</button>\n      </div>\n    </Modal>\n  )}\n</ReactRouterPrompt>\n```\n\n### Props\n\n1. `when`: `boolean` | `BlockerFunction`\n\n   ```ts\n   BlockerFunction = (args: {\n     currentLocation: Location\n     nextLocation: Location\n     historyAction: HistoryAction\n   }) => boolean\n   ```\n\n2. `beforeConfirm()` : `Promise<unknown>` _(Optional)_\n\n3. `beforeCancel()` : `Promise<unknown>` _(Optional)_\n\n### Return values\n\n1. `isActive`: `Boolean`\n2. `onConfirm()`: `void`\n3. `onCancel()`: `void`\n\n#### Note 🗒️\n\nThis version works with react-router-dom >=v6.19\nShould be used within [data routers](https://reactrouter.com/en/6.8.1/routers/picking-a-router#using-v64-data-apis)\n\nFor react-router support `(v6 - v6.2.x)` please install v0.3.0\n\nFor react-router support (v6.7.x - v6.18.x) please install v0.5.4\n\n_Skipped support in middle due to breaking changes on react-router apis_\n\n## Contributing\n\nContributions, issues and feature requests are always welcome!\nFeel free to check [issues page](https://github.com/sshyam-gupta/react-router-prompt/issues).\n\n## Acknowledgements\n\n- Inspiration from [react-router-navigation-prompt](https://www.npmjs.com/package/react-router-navigation-prompt)\n- Gist: [https://gist.github.com/rmorse/426ffcc579922a82749934826fa9f743](https://gist.github.com/rmorse/426ffcc579922a82749934826fa9f743)\n\n## Support\n\nGive a ⭐️ if this project helped you!\n\n## 📝 License\n\nCopyright © 2023 [Shyam Gupta (shyamm@outlook.com)](https://github.com/sshyam-gupta)\nThis project is [MIT](https://github.com/sshyam-gupta/react-router-prompt/blob/main/LICENSE) licensed.\n\n## About me\n\n- Website: [sshyam-gupta.space](https://sshyam-gupta.space/)\n- Twitter: [@shyamm06](https://twitter.com/shyamm06)\n- GitHub: [@sshyam-gupta](https://github.com/sshyam-gupta)\n- LinkedIn: [@shyam-gupta-66463a62](https://linkedin.com/in/https://www.linkedin.com/in/shyam-gupta-66463a62/)\n","readmeFilename":"README.md"}