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
40
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

to
0.7.0-beta-1

2

dist/hooks/use-confirm.d.ts

@@ -1,2 +0,2 @@

import { unstable_BlockerFunction as BlockerFunction } from "react-router-dom";
import { BlockerFunction } from "react-router-dom";
declare interface InitialStateType {

@@ -3,0 +3,0 @@ isActive: boolean;

@@ -1,3 +0,3 @@

import { unstable_Blocker as Blocker, unstable_BlockerFunction as BlockerFunction } from "react-router-dom";
import { Blocker, BlockerFunction } from "react-router-dom";
declare function usePrompt(when: boolean | BlockerFunction): Blocker;
export default usePrompt;
import React from "react";
import { unstable_BlockerFunction as BlockerFunction } from "react-router-dom";
import { BlockerFunction } from "react-router-dom";
import useConfirm from "./hooks/use-confirm";

@@ -32,4 +32,4 @@ import usePrompt from "./hooks/use-prompt";

*/
declare function ReactRouterPrompt({ when, children, beforeCancel, beforeConfirm, }: ReactRouterPromptProps): JSX.Element | null;
declare function ReactRouterPrompt({ when, children, beforeCancel, beforeConfirm, }: ReactRouterPromptProps): import("react/jsx-runtime").JSX.Element | null;
export default ReactRouterPrompt;
export { useConfirm, usePrompt };

@@ -1,3 +0,3 @@

import Oe, { useEffect as ur, useCallback as H } from "react";
import { useBlocker as sr, useBeforeUnload as fr } from "react-router-dom";
import Pe, { useEffect as sr, useCallback as H } from "react";
import { useBlocker as fr, useBeforeUnload as lr } from "react-router-dom";
var X = { exports: {} }, F = {};

@@ -14,9 +14,9 @@ /**

var Te;
function lr() {
function cr() {
return Te || (Te = 1, process.env.NODE_ENV !== "production" && function() {
var d = Oe, l = Symbol.for("react.element"), b = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), S = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), T = Symbol.for("react.provider"), E = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), $ = Symbol.for("react.offscreen"), Z = Symbol.iterator, Pe = "@@iterator";
function Se(e) {
var d = Pe, l = Symbol.for("react.element"), b = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), S = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), T = Symbol.for("react.provider"), E = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), $ = Symbol.for("react.offscreen"), Z = Symbol.iterator, Se = "@@iterator";
function we(e) {
if (e === null || typeof e != "object")
return null;
var r = Z && e[Z] || e[Pe];
var r = Z && e[Z] || e[Se];
return typeof r == "function" ? r : null;

@@ -29,6 +29,6 @@ }

t[n - 1] = arguments[n];
we("error", e, t);
xe("error", e, t);
}
}
function we(e, r, t) {
function xe(e, r, t) {
{

@@ -43,6 +43,6 @@ var n = x.ReactDebugCurrentFrame, i = n.getStackAddendum();

}
var xe = !1, je = !1, ke = !1, Ae = !1, De = !1, Q;
var je = !1, ke = !1, Ae = !1, De = !1, Fe = !1, Q;
Q = Symbol.for("react.module.reference");
function Fe(e) {
return !!(typeof e == "string" || typeof e == "function" || e === g || e === C || De || e === S || e === w || e === m || Ae || e === $ || xe || je || ke || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === R || e.$$typeof === T || e.$$typeof === E || e.$$typeof === c || // This needs to include all possible module reference object
function Ie(e) {
return !!(typeof e == "string" || typeof e == "function" || e === g || e === C || Fe || e === S || e === w || e === m || De || e === $ || je || ke || Ae || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === R || e.$$typeof === T || e.$$typeof === E || e.$$typeof === c || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since

@@ -53,3 +53,3 @@ // we don't know which Flight build this will end up being used

}
function Ie(e, r, t) {
function $e(e, r, t) {
var n = e.displayName;

@@ -94,3 +94,3 @@ if (n)

case c:
return Ie(e, e.render, "ForwardRef");
return $e(e, e.render, "ForwardRef");
case R:

@@ -114,3 +114,3 @@ var n = e.displayName || null;

se.__reactDisabledLog = !0;
function $e() {
function We() {
{

@@ -138,3 +138,3 @@ if (A === 0) {

}
function We() {
function Ye() {
{

@@ -190,4 +190,4 @@ if (A--, A === 0) {

{
var Ye = typeof WeakMap == "function" ? WeakMap : Map;
Y = new Ye();
var Le = typeof WeakMap == "function" ? WeakMap : Map;
Y = new Le();
}

@@ -207,3 +207,3 @@ function fe(e, r) {

var u;
u = U.current, U.current = null, $e();
u = U.current, U.current = null, We();
try {

@@ -261,3 +261,3 @@ if (r) {

} finally {
B = !1, U.current = u, We(), Error.prepareStackTrace = i;
B = !1, U.current = u, Ye(), Error.prepareStackTrace = i;
}

@@ -267,6 +267,6 @@ var k = e ? e.displayName || e.name : "", he = k ? W(k) : "";

}
function Le(e, r, t) {
function Ne(e, r, t) {
return fe(e, !1);
}
function Ne(e) {
function Ve(e) {
var r = e.prototype;

@@ -279,3 +279,3 @@ return !!(r && r.isReactComponent);

if (typeof e == "function")
return fe(e, Ne(e));
return fe(e, Ve(e));
if (typeof e == "string")

@@ -292,3 +292,3 @@ return W(e);

case c:
return Le(e.render);
return Ne(e.render);
case R:

@@ -314,3 +314,3 @@ return L(e.type, r, t);

}
function Ve(e, r, t, n, i) {
function Ue(e, r, t, n, i) {
{

@@ -334,7 +334,7 @@ var u = Function.call.bind(N);

}
var Ue = Array.isArray;
var Me = Array.isArray;
function q(e) {
return Ue(e);
return Me(e);
}
function Me(e) {
function Be(e) {
{

@@ -345,3 +345,3 @@ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";

}
function Be(e) {
function qe(e) {
try {

@@ -357,6 +357,6 @@ return de(e), !1;

function ve(e) {
if (Be(e))
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Me(e)), de(e);
if (qe(e))
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Be(e)), de(e);
}
var D = x.ReactCurrentOwner, qe = {
var D = x.ReactCurrentOwner, Je = {
key: !0,

@@ -368,3 +368,3 @@ ref: !0,

J = {};
function Je(e) {
function Ge(e) {
if (N.call(e, "ref")) {

@@ -377,3 +377,3 @@ var r = Object.getOwnPropertyDescriptor(e, "ref").get;

}
function Ge(e) {
function ze(e) {
if (N.call(e, "key")) {

@@ -386,3 +386,3 @@ var r = Object.getOwnPropertyDescriptor(e, "key").get;

}
function ze(e, r) {
function Ke(e, r) {
if (typeof e.ref == "string" && D.current && r && D.current.stateNode !== r) {

@@ -393,3 +393,3 @@ var t = _(D.current.type);

}
function Ke(e, r) {
function He(e, r) {
{

@@ -405,3 +405,3 @@ var t = function() {

}
function He(e, r) {
function Xe(e, r) {
{

@@ -417,3 +417,3 @@ var t = function() {

}
var Xe = function(e, r, t, n, i, u, o) {
var Ze = function(e, r, t, n, i, u, o) {
var a = {

@@ -447,8 +447,8 @@ // This tag allows us to uniquely identify this as a React Element

};
function Ze(e, r, t, n, i) {
function Qe(e, r, t, n, i) {
{
var u, o = {}, a = null, p = null;
t !== void 0 && (ve(t), a = "" + t), Ge(r) && (ve(r.key), a = "" + r.key), Je(r) && (p = r.ref, ze(r, i));
t !== void 0 && (ve(t), a = "" + t), ze(r) && (ve(r.key), a = "" + r.key), Ge(r) && (p = r.ref, Ke(r, i));
for (u in r)
N.call(r, u) && !qe.hasOwnProperty(u) && (o[u] = r[u]);
N.call(r, u) && !Je.hasOwnProperty(u) && (o[u] = r[u]);
if (e && e.defaultProps) {

@@ -461,5 +461,5 @@ var s = e.defaultProps;

var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
a && Ke(o, f), p && He(o, f);
a && He(o, f), p && Xe(o, f);
}
return Xe(e, a, p, i, n, D.current, o);
return Ze(e, a, p, i, n, D.current, o);
}

@@ -492,3 +492,3 @@ }

}
function Qe(e) {
function er(e) {
{

@@ -505,3 +505,3 @@ if (e !== void 0) {

var ye = {};
function er(e) {
function rr(e) {
{

@@ -523,3 +523,3 @@ var r = ge();

e._store.validated = !0;
var t = er(r);
var t = rr(r);
if (ye[t])

@@ -544,3 +544,3 @@ return;

else if (e) {
var i = Se(e);
var i = we(e);
if (typeof i == "function" && i !== e.entries)

@@ -552,3 +552,3 @@ for (var u = i.call(e), o; !(o = u.next()).done; )

}
function rr(e) {
function tr(e) {
{

@@ -569,3 +569,3 @@ var r = e.type;

var n = _(r);
Ve(t, e.props, "prop", n, e);
Ue(t, e.props, "prop", n, e);
} else if (r.PropTypes !== void 0 && !z) {

@@ -579,3 +579,3 @@ z = !0;

}
function tr(e) {
function nr(e) {
{

@@ -594,7 +594,7 @@ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {

{
var o = Fe(e);
var o = Ie(e);
if (!o) {
var a = "";
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var p = Qe(i);
var p = er(i);
p ? a += p : a += ge();

@@ -604,3 +604,3 @@ var s;

}
var f = Ze(e, r, t, i, u);
var f = Qe(e, r, t, i, u);
if (f == null)

@@ -621,13 +621,13 @@ return f;

}
return e === g ? tr(f) : rr(f), f;
return e === g ? nr(f) : tr(f), f;
}
}
function nr(e, r, t) {
function ar(e, r, t) {
return _e(e, r, t, !0);
}
function ar(e, r, t) {
function or(e, r, t) {
return _e(e, r, t, !1);
}
var or = ar, ir = nr;
F.Fragment = g, F.jsx = or, F.jsxs = ir;
var ir = or, ur = ar;
F.Fragment = g, F.jsx = ir, F.jsxs = ur;
}()), F;

@@ -646,7 +646,7 @@ }

var Ce;
function cr() {
function dr() {
if (Ce)
return I;
Ce = 1;
var d = Oe, l = Symbol.for("react.element"), b = Symbol.for("react.fragment"), g = Object.prototype.hasOwnProperty, S = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, C = { key: !0, ref: !0, __self: !0, __source: !0 };
var d = Pe, l = Symbol.for("react.element"), b = Symbol.for("react.fragment"), g = Object.prototype.hasOwnProperty, S = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, C = { key: !0, ref: !0, __self: !0, __source: !0 };
function T(E, c, w) {

@@ -664,9 +664,9 @@ var m, R = {}, O = null, $ = null;

}
process.env.NODE_ENV === "production" ? X.exports = cr() : X.exports = lr();
var dr = X.exports;
process.env.NODE_ENV === "production" ? X.exports = dr() : X.exports = cr();
var Oe = X.exports;
function vr(d) {
const l = sr(d);
return ur(() => {
const l = fr(d);
return sr(() => {
l.state === "blocked" && !d && l.reset();
}, [l, d]), fr(
}, [l, d]), lr(
H(

@@ -705,3 +705,3 @@ (b) => {

}, [b, T]);
return S ? /* @__PURE__ */ dr.jsx("div", { children: l({
return S ? /* @__PURE__ */ Oe.jsx(Oe.Fragment, { children: l({
isActive: !0,

@@ -708,0 +708,0 @@ onConfirm: E,

{
"version": "0.7.0-beta-1",
"name": "react-router-prompt",
"version": "0.6.1",
"description": "React Router Navigation Prompt for v6",

@@ -40,29 +40,29 @@ "type": "module",

"devDependencies": {
"@size-limit/preset-small-lib": "^11.0.0",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.10",
"@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": "^6.0.0",
"@vitejs/plugin-react-swc": "^3.1.0",
"eslint": "^8.34.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.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.32.2",
"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": "^8.0.3",
"husky": "^9.0.11",
"path": "^0.12.7",
"prettier": "^3.0.0",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.19.0",
"size-limit": "^11.0.0",
"typescript": "^5.0.0",
"vite": "^5.0.0",
"vite-plugin-dts": "^3.0.0",
"vite-tsconfig-paths": "^4.0.5"
"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"
},

@@ -69,0 +69,0 @@ "peerDependencies": {

@@ -1,2 +0,1 @@

# react-router-prompt 🚨

@@ -50,21 +49,21 @@

1. `when`: `boolean` | `BlockerFunction`
1. `when`: `boolean` | `BlockerFunction`
```ts
BlockerFunction = (args: {
currentLocation: Location;
nextLocation: Location;
historyAction: HistoryAction;
}) => boolean;
```
```ts
BlockerFunction = (args: {
currentLocation: Location
nextLocation: Location
historyAction: HistoryAction
}) => boolean
```
2. `beforeConfirm()` : `Promise<unknown>` _(Optional)_
2. `beforeConfirm()` : `Promise<unknown>` _(Optional)_
3. `beforeCancel()` : `Promise<unknown>` _(Optional)_
3. `beforeCancel()` : `Promise<unknown>` _(Optional)_
### Return values
1. `isActive`: `Boolean`
2. `onConfirm()`: `void`
3. `onCancel()`: `void`
1. `isActive`: `Boolean`
2. `onConfirm()`: `void`
3. `onCancel()`: `void`

@@ -80,3 +79,2 @@ #### Note 🗒️

_Skipped support in middle due to breaking changes on react-router apis_

@@ -83,0 +81,0 @@

Sorry, the diff of this file is not supported yet