New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-router-prompt

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-prompt - npm Package Compare versions

Comparing version 0.3.1-beta to 0.4.0

dist/hooks/use-prompt.d.ts

11

dist/hooks/use-confirm.d.ts

@@ -0,11 +1,8 @@

import { unstable_BlockerFunction as BlockerFunction } from "react-router-dom";
declare interface InitialStateType {
isActive: boolean;
proceed: (value: unknown) => void;
cancel: (value: unknown) => void;
onConfirm(): void;
resetConfirmation(): void;
}
declare interface ConfirmLeaveReturnType extends InitialStateType {
onConfirm: () => Promise<boolean>;
resetConfirmation: () => void;
}
declare const useConfirm: () => ConfirmLeaveReturnType;
declare const useConfirm: (when: boolean | BlockerFunction) => InitialStateType;
export default useConfirm;
import React from "react";
declare type ReactRouterPromptProps = {
when: boolean;
import { unstable_BlockerFunction as BlockerFunction } from "react-router-dom";
type ReactRouterPromptProps = {
when: boolean | BlockerFunction;
children: (data: {
isActive: boolean;
onCancel: (value: unknown) => void;
onConfirm: (value: unknown) => void;
onCancel(): void;
onConfirm(): void;
}) => React.ReactNode;
};
declare const Main: React.FC<ReactRouterPromptProps>;
export default Main;
/**
* A replacement component for the react-router `Prompt`.
* Allows for more flexible dialogs.
*
* @example
* <ReactRouterPrompt when={isDirty}>
* {({isActive, onConfirm, onCancel}) => (
* <Modal show={isActive}>
* <div>
* <p>Do you really want to leave?</p>
* <button onClick={onCancel}>Cancel</button>
* <button onClick={onConfirm}>Ok</button>
* </div>
* </Modal>
* )}
* </ReactRouterPrompt>
*/
declare function ReactRouterPrompt({ when, children }: ReactRouterPromptProps): JSX.Element | null;
export default ReactRouterPrompt;
{
"name": "react-router-prompt",
"version": "0.3.1-beta",
"version": "0.4.0",
"description": "React Router Navigation Prompt for v6",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"type": "module",
"files": [
"dist"
],
"main": "./dist/react-router-prompt.umd.cjs",
"module": "./dist/react-router-prompt.js",
"exports": {
".": {
"import": "./dist/react-router-prompt.js",
"require": "./dist/react-router-prompt.umd.cjs"
}
},
"author": "Shyam Gupta (shyamm@outlook.com)",

@@ -23,31 +33,56 @@ "license": "MIT",

"scripts": {
"clean": "rimraf dist",
"start": "tsdx watch",
"build": "yarn clean && tsdx build",
"test": "tsdx test",
"lint": "tsdx lint src",
"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",
"compile": "tsc",
"preview": "vite preview",
"test": "vitest",
"size": "size-limit",
"prepublishOnly": "yarn build"
"prepublishOnly": "yarn build",
"prepare": "husky install",
"coverage": "vitest run --coverage"
},
"husky": {
"hooks": {
"pre-commit": "tsdx lint src"
"pre-commit": "pnpm lint"
}
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@size-limit/preset-small-lib": "^8.1.0",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"esbuild": "^0.14.49",
"@size-limit/preset-small-lib": "^8.1.2",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"@vitejs/plugin-react-swc": "^3.1.0",
"@vitest/coverage-c8": "^0.28.4",
"eslint": "^8.34.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"happy-dom": "^8.2.6",
"history": "^5.3.0",
"husky": "^8.0.1",
"husky": "^8.0.3",
"path": "^0.12.7",
"prettier": "^2.8.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^3.1.4",
"react-router-dom": "^6.4.1",
"rimraf": "^3.0.2",
"size-limit": "^8.1.0",
"tsdx": "^0.14.1",
"tslib": "^2.4.0",
"typescript": "^4.7.4"
"react-router-dom": "^6.8.1",
"size-limit": "^8.1.2",
"tslib": "^2.5.0",
"typescript": "^4.9.5",
"vite": "^4.1.1",
"vite-plugin-dts": "^1.7.2",
"vite-tsconfig-paths": "^4.0.5",
"vitest": "^0.28.4"
},

@@ -57,14 +92,4 @@ "peerDependencies": {

"react-router": ">=6.x",
"react-router-dom": ">=6.x"
"react-router-dom": ">=6.7"
},
"files": [
"dist",
"src"
],
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": false,
"trailingComma": "es5"
},
"size-limit": [

@@ -79,4 +104,3 @@ {

}
],
"dependencies": {}
]
}

@@ -20,2 +20,6 @@ <h1 align="center">react-router-prompt 🚨</h1>

```sh
pnpm add react-router-prompt
```
```sh
yarn add react-router-prompt

@@ -40,2 +44,6 @@ ```

## Note:
This version works with react-router-dom >=v6.7
## 🤝 Contributing

@@ -42,0 +50,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc