Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-router-prompt

Package Overview
Dependencies
Maintainers
0
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.7.1 to 0.7.2-beta-1

961

dist/react-router-prompt.js

@@ -1,9 +0,9 @@

import je, { useEffect as dr, useCallback as Z } from "react";
import { useBlocker as vr, useBeforeUnload as pr } from "react-router-dom";
var Q = { exports: {} }, W = {};
import je, { useEffect as Ae, useCallback as B } from "react";
import { useBlocker as we, useBeforeUnload as Oe } from "react-router-dom";
var O = { exports: {} }, j = {};
/**
* @license React
* react-jsx-runtime.production.min.js
* react-jsx-runtime.production.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -13,17 +13,25 @@ * This source code is licensed under the MIT license found in the

*/
var Oe;
function yr() {
if (Oe) return W;
Oe = 1;
var d = je, l = Symbol.for("react.element"), b = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, j = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, C = { key: !0, ref: !0, __self: !0, __source: !0 };
function T(_, c, k) {
var g, h = {}, O = null, Y = null;
k !== void 0 && (O = "" + k), c.key !== void 0 && (O = "" + c.key), c.ref !== void 0 && (Y = c.ref);
for (g in c) m.call(c, g) && !C.hasOwnProperty(g) && (h[g] = c[g]);
if (_ && _.defaultProps) for (g in c = _.defaultProps, c) h[g] === void 0 && (h[g] = c[g]);
return { $$typeof: l, type: _, key: O, ref: Y, props: h, _owner: j.current };
var fe;
function Se() {
if (fe) return j;
fe = 1;
var a = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
function c(d, f, v) {
var E = null;
if (v !== void 0 && (E = "" + v), f.key !== void 0 && (E = "" + f.key), "key" in f) {
v = {};
for (var g in f)
g !== "key" && (v[g] = f[g]);
} else v = f;
return f = v.ref, {
$$typeof: a,
type: d,
key: E,
ref: f !== void 0 ? f : null,
props: v
};
}
return W.Fragment = b, W.jsx = T, W.jsxs = T, W;
return j.Fragment = s, j.jsx = c, j.jsxs = c, j;
}
var $ = {};
var A = {};
/**

@@ -33,3 +41,3 @@ * @license React

*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -39,237 +47,207 @@ * This source code is licensed under the MIT license found in the

*/
var Se;
function gr() {
return Se || (Se = 1, process.env.NODE_ENV !== "production" && function() {
var d = je, l = Symbol.for("react.element"), b = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), j = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), T = Symbol.for("react.provider"), _ = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), k = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), Y = Symbol.for("react.offscreen"), ee = Symbol.iterator, ke = "@@iterator";
function we(e) {
if (e === null || typeof e != "object")
return null;
var r = ee && e[ee] || e[ke];
return typeof r == "function" ? r : null;
}
var w = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function v(e) {
{
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
t[n - 1] = arguments[n];
xe("error", e, t);
}
}
function xe(e, r, t) {
{
var n = w.ReactDebugCurrentFrame, i = n.getStackAddendum();
i !== "" && (r += "%s", t = t.concat([i]));
var u = t.map(function(o) {
return String(o);
});
u.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, u);
}
}
var Ae = !1, De = !1, Fe = !1, Ie = !1, We = !1, re;
re = Symbol.for("react.module.reference");
function $e(e) {
return !!(typeof e == "string" || typeof e == "function" || e === m || e === C || We || e === j || e === k || e === g || Ie || e === Y || Ae || De || Fe || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === h || e.$$typeof === T || e.$$typeof === _ || e.$$typeof === c || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
e.$$typeof === re || e.getModuleId !== void 0));
}
function Ye(e, r, t) {
var n = e.displayName;
if (n)
return n;
var i = r.displayName || r.name || "";
return i !== "" ? t + "(" + i + ")" : t;
}
function te(e) {
return e.displayName || "Context";
}
function E(e) {
if (e == null)
return null;
if (typeof e.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
return e.displayName || e.name || null;
if (typeof e == "string")
return e;
var ve;
function he() {
return ve || (ve = 1, process.env.NODE_ENV !== "production" && function() {
function a(e) {
if (e == null) return null;
if (typeof e == "function")
return e.$$typeof === xe ? null : e.displayName || e.name || null;
if (typeof e == "string") return e;
switch (e) {
case m:
case P:
return "Fragment";
case b:
case pe:
return "Portal";
case C:
case L:
return "Profiler";
case j:
case F:
return "StrictMode";
case k:
case M:
return "Suspense";
case g:
case $:
return "SuspenseList";
}
if (typeof e == "object")
switch (e.$$typeof) {
case _:
var r = e;
return te(r) + ".Consumer";
case T:
var t = e;
return te(t._context) + ".Provider";
case c:
return Ye(e, e.render, "ForwardRef");
case h:
var n = e.displayName || null;
return n !== null ? n : E(e.type) || "Memo";
case O: {
var i = e, u = i._payload, o = i._init;
switch (typeof e.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), e.$$typeof) {
case I:
return (e.displayName || "Context") + ".Provider";
case Z:
return (e._context.displayName || "Context") + ".Consumer";
case Y:
var r = e.render;
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
case W:
return r = e.displayName || null, r !== null ? r : a(e.type) || "Memo";
case U:
r = e._payload, e = e._init;
try {
return E(o(u));
return a(e(r));
} catch {
return null;
}
}
}
return null;
}
var S = Object.assign, D = 0, ne, ae, oe, ie, ue, se, fe;
function le() {
function s(e) {
return "" + e;
}
le.__reactDisabledLog = !0;
function Le() {
{
if (D === 0) {
ne = console.log, ae = console.info, oe = console.warn, ie = console.error, ue = console.group, se = console.groupCollapsed, fe = console.groupEnd;
var e = {
configurable: !0,
enumerable: !0,
value: le,
writable: !0
};
Object.defineProperties(console, {
info: e,
log: e,
warn: e,
error: e,
group: e,
groupCollapsed: e,
groupEnd: e
});
}
D++;
function c(e) {
try {
s(e);
var r = !1;
} catch {
r = !0;
}
if (r) {
r = console;
var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
return t.call(
r,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
n
), s(e);
}
}
function Ve() {
{
if (D--, D === 0) {
var e = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: S({}, e, {
value: ne
}),
info: S({}, e, {
value: ae
}),
warn: S({}, e, {
value: oe
}),
error: S({}, e, {
value: ie
}),
group: S({}, e, {
value: ue
}),
groupCollapsed: S({}, e, {
value: se
}),
groupEnd: S({}, e, {
value: fe
})
});
}
D < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
function d() {
}
function f() {
if (k === 0) {
D = console.log, ee = console.info, re = console.warn, te = console.error, oe = console.group, ne = console.groupCollapsed, ae = console.groupEnd;
var e = {
configurable: !0,
enumerable: !0,
value: d,
writable: !0
};
Object.defineProperties(console, {
info: e,
log: e,
warn: e,
error: e,
group: e,
groupCollapsed: e,
groupEnd: e
});
}
k++;
}
var N = w.ReactCurrentDispatcher, B;
function L(e, r, t) {
{
if (B === void 0)
try {
throw Error();
} catch (i) {
var n = i.stack.trim().match(/\n( *(at )?)/);
B = n && n[1] || "";
}
return `
` + B + e;
function v() {
if (k--, k === 0) {
var e = { configurable: !0, enumerable: !0, writable: !0 };
Object.defineProperties(console, {
log: y({}, e, { value: D }),
info: y({}, e, { value: ee }),
warn: y({}, e, { value: re }),
error: y({}, e, { value: te }),
group: y({}, e, { value: oe }),
groupCollapsed: y({}, e, { value: ne }),
groupEnd: y({}, e, { value: ae })
});
}
0 > k && console.error(
"disabledDepth fell below zero. This is a bug in React. Please file an issue."
);
}
var J = !1, V;
{
var Ue = typeof WeakMap == "function" ? WeakMap : Map;
V = new Ue();
function E(e) {
if (J === void 0)
try {
throw Error();
} catch (t) {
var r = t.stack.trim().match(/\n( *(at )?)/);
J = r && r[1] || "", ue = -1 < t.stack.indexOf(`
at`) ? " (<anonymous>)" : -1 < t.stack.indexOf("@") ? "@unknown:0:0" : "";
}
return `
` + J + e + ue;
}
function ce(e, r) {
if (!e || J)
return "";
{
var t = V.get(e);
if (t !== void 0)
return t;
}
var n;
J = !0;
var i = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var u;
u = N.current, N.current = null, Le();
function g(e, r) {
if (!e || V) return "";
var t = z.get(e);
if (t !== void 0) return t;
V = !0, t = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
var n = null;
n = T.H, T.H = null, f();
try {
if (r) {
var o = function() {
throw Error();
};
if (Object.defineProperty(o.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
var i = {
DetermineComponentFrameRoot: function() {
try {
Reflect.construct(o, []);
} catch (y) {
n = y;
if (r) {
var _ = function() {
throw Error();
};
if (Object.defineProperty(_.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(_, []);
} catch (m) {
var w = m;
}
Reflect.construct(e, [], _);
} else {
try {
_.call();
} catch (m) {
w = m;
}
e.call(_.prototype);
}
} else {
try {
throw Error();
} catch (m) {
w = m;
}
(_ = e()) && typeof _.catch == "function" && _.catch(function() {
});
}
} catch (m) {
if (m && w && typeof m.stack == "string")
return [m.stack, w.stack];
}
Reflect.construct(e, [], o);
} else {
try {
o.call();
} catch (y) {
n = y;
}
e.call(o.prototype);
return [null, null];
}
} else {
try {
throw Error();
} catch (y) {
n = y;
}
e();
}
} catch (y) {
if (y && n && typeof y.stack == "string") {
for (var a = y.stack.split(`
`), p = n.stack.split(`
`), s = a.length - 1, f = p.length - 1; s >= 1 && f >= 0 && a[s] !== p[f]; )
f--;
for (; s >= 1 && f >= 0; s--, f--)
if (a[s] !== p[f]) {
if (s !== 1 || f !== 1)
};
i.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
var u = Object.getOwnPropertyDescriptor(
i.DetermineComponentFrameRoot,
"name"
);
u && u.configurable && Object.defineProperty(
i.DetermineComponentFrameRoot,
"name",
{ value: "DetermineComponentFrameRoot" }
);
var o = i.DetermineComponentFrameRoot(), b = o[0], R = o[1];
if (b && R) {
var l = b.split(`
`), p = R.split(`
`);
for (o = u = 0; u < l.length && !l[u].includes(
"DetermineComponentFrameRoot"
); )
u++;
for (; o < p.length && !p[o].includes(
"DetermineComponentFrameRoot"
); )
o++;
if (u === l.length || o === p.length)
for (u = l.length - 1, o = p.length - 1; 1 <= u && 0 <= o && l[u] !== p[o]; )
o--;
for (; 1 <= u && 0 <= o; u--, o--)
if (l[u] !== p[o]) {
if (u !== 1 || o !== 1)
do
if (s--, f--, f < 0 || a[s] !== p[f]) {
var R = `
` + a[s].replace(" at new ", " at ");
return e.displayName && R.includes("<anonymous>") && (R = R.replace("<anonymous>", e.displayName)), typeof e == "function" && V.set(e, R), R;
if (u--, o--, 0 > o || l[u] !== p[o]) {
var C = `
` + l[u].replace(
" at new ",
" at "
);
return e.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", e.displayName)), typeof e == "function" && z.set(e, C), C;
}
while (s >= 1 && f >= 0);
while (1 <= u && 0 <= o);
break;

@@ -279,407 +257,240 @@ }

} finally {
J = !1, N.current = u, Ve(), Error.prepareStackTrace = i;
V = !1, T.H = n, v(), Error.prepareStackTrace = t;
}
var A = e ? e.displayName || e.name : "", P = A ? L(A) : "";
return typeof e == "function" && V.set(e, P), P;
return l = (l = e ? e.displayName || e.name : "") ? E(l) : "", typeof e == "function" && z.set(e, l), l;
}
function Me(e, r, t) {
return ce(e, !1);
}
function Ne(e) {
var r = e.prototype;
return !!(r && r.isReactComponent);
}
function U(e, r, t) {
if (e == null)
return "";
if (typeof e == "function")
return ce(e, Ne(e));
if (typeof e == "string")
return L(e);
function x(e) {
if (e == null) return "";
if (typeof e == "function") {
var r = e.prototype;
return g(
e,
!(!r || !r.isReactComponent)
);
}
if (typeof e == "string") return E(e);
switch (e) {
case k:
return L("Suspense");
case g:
return L("SuspenseList");
case M:
return E("Suspense");
case $:
return E("SuspenseList");
}
if (typeof e == "object")
switch (e.$$typeof) {
case c:
return Me(e.render);
case h:
return U(e.type, r, t);
case O: {
var n = e, i = n._payload, u = n._init;
case Y:
return e = g(e.render, !1), e;
case W:
return x(e.type);
case U:
r = e._payload, e = e._init;
try {
return U(u(i), r, t);
return x(e(r));
} catch {
}
}
}
return "";
}
var F = Object.prototype.hasOwnProperty, de = {}, ve = w.ReactDebugCurrentFrame;
function M(e) {
if (e) {
var r = e._owner, t = U(e.type, e._source, r ? r.type : null);
ve.setExtraStackFrame(t);
} else
ve.setExtraStackFrame(null);
function S() {
var e = T.A;
return e === null ? null : e.getOwner();
}
function Be(e, r, t, n, i) {
{
var u = Function.call.bind(F);
for (var o in e)
if (u(e, o)) {
var a = void 0;
try {
if (typeof e[o] != "function") {
var p = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw p.name = "Invariant Violation", p;
}
a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (s) {
a = s;
}
a && !(a instanceof Error) && (M(i), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), M(null)), a instanceof Error && !(a.message in de) && (de[a.message] = !0, M(i), v("Failed %s type: %s", t, a.message), M(null));
}
}
}
var Je = Array.isArray;
function q(e) {
return Je(e);
}
function qe(e) {
{
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
return t;
}
}
function Ke(e) {
try {
return pe(e), !1;
} catch {
return !0;
}
}
function pe(e) {
return "" + e;
}
function ye(e) {
if (Ke(e))
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", qe(e)), pe(e);
}
var I = w.ReactCurrentOwner, Ge = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, ge, be, K;
K = {};
function ze(e) {
if (F.call(e, "ref")) {
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
if (r && r.isReactWarning)
return !1;
}
return e.ref !== void 0;
}
function Xe(e) {
if (F.call(e, "key")) {
function be(e) {
if (K.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;
if (r && r.isReactWarning)
return !1;
if (r && r.isReactWarning) return !1;
}
return e.key !== void 0;
}
function He(e, r) {
if (typeof e.ref == "string" && I.current && r && I.current.stateNode !== r) {
var t = E(I.current.type);
K[t] || (v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', E(I.current.type), e.ref), K[t] = !0);
function me(e, r) {
function t() {
se || (se = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
r
));
}
t.isReactWarning = !0, Object.defineProperty(e, "key", {
get: t,
configurable: !0
});
}
function Ze(e, r) {
{
var t = function() {
ge || (ge = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
};
t.isReactWarning = !0, Object.defineProperty(e, "key", {
get: t,
configurable: !0
});
}
function ge() {
var e = a(this.type);
return ie[e] || (ie[e] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), e = this.props.ref, e !== void 0 ? e : null;
}
function Qe(e, r) {
{
var t = function() {
be || (be = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
};
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
get: t,
configurable: !0
});
}
}
var er = function(e, r, t, n, i, u, o) {
var a = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: l,
// Built-in properties that belong on the element
function _e(e, r, t, n, i, u) {
return t = u.ref, e = {
$$typeof: N,
type: e,
key: r,
ref: t,
props: o,
// Record the component responsible for creating this element.
_owner: u
};
return a._store = {}, Object.defineProperty(a._store, "validated", {
props: u,
_owner: i
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
enumerable: !1,
get: ge
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(a, "_self", {
value: 0
}), Object.defineProperty(e, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !1,
value: n
}), Object.defineProperty(a, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: i
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
};
function rr(e, r, t, n, i) {
{
var u, o = {}, a = null, p = null;
t !== void 0 && (ye(t), a = "" + t), Xe(r) && (ye(r.key), a = "" + r.key), ze(r) && (p = r.ref, He(r, i));
for (u in r)
F.call(r, u) && !Ge.hasOwnProperty(u) && (o[u] = r[u]);
if (e && e.defaultProps) {
var s = e.defaultProps;
for (u in s)
o[u] === void 0 && (o[u] = s[u]);
}
if (a || p) {
var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
a && Ze(o, f), p && Qe(o, f);
}
return er(e, a, p, i, n, I.current, o);
}
writable: !0,
value: null
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
}
var G = w.ReactCurrentOwner, me = w.ReactDebugCurrentFrame;
function x(e) {
if (e) {
var r = e._owner, t = U(e.type, e._source, r ? r.type : null);
me.setExtraStackFrame(t);
function G(e, r, t, n, i, u) {
if (typeof e == "string" || typeof e == "function" || e === P || e === L || e === F || e === M || e === $ || e === Re || typeof e == "object" && e !== null && (e.$$typeof === U || e.$$typeof === W || e.$$typeof === I || e.$$typeof === Z || e.$$typeof === Y || e.$$typeof === ke || e.getModuleId !== void 0)) {
var o = r.children;
if (o !== void 0)
if (n)
if (q(o)) {
for (n = 0; n < o.length; n++)
H(o[n], e);
Object.freeze && Object.freeze(o);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else H(o, e);
} else
me.setExtraStackFrame(null);
}
var z;
z = !1;
function X(e) {
return typeof e == "object" && e !== null && e.$$typeof === l;
}
function Re() {
{
if (G.current) {
var e = E(G.current.type);
if (e)
return `
Check the render method of \`` + e + "`.";
}
return "";
o = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? n = "null" : q(e) ? n = "array" : e !== void 0 && e.$$typeof === N ? (n = "<" + (a(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : n = typeof e, console.error(
"React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
n,
o
);
if (K.call(r, "key")) {
o = a(e);
var b = Object.keys(r).filter(function(l) {
return l !== "key";
});
n = 0 < b.length ? "{key: someKey, " + b.join(": ..., ") + ": ...}" : "{key: someKey}", le[o + n] || (b = 0 < b.length ? "{" + b.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
n,
o,
b,
o
), le[o + n] = !0);
}
if (o = null, t !== void 0 && (c(t), o = "" + t), be(r) && (c(r.key), o = "" + r.key), "key" in r) {
t = {};
for (var R in r)
R !== "key" && (t[R] = r[R]);
} else t = r;
return o && me(
t,
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
), _e(e, o, u, i, S(), t);
}
function tr(e) {
return "";
}
var Ee = {};
function nr(e) {
{
var r = Re();
if (!r) {
var t = typeof e == "string" ? e : e.displayName || e.name;
t && (r = `
Check the top-level render call using <` + t + ">.");
}
return r;
}
}
function _e(e, r) {
{
if (!e._store || e._store.validated || e.key != null)
return;
e._store.validated = !0;
var t = nr(r);
if (Ee[t])
return;
Ee[t] = !0;
var n = "";
e && e._owner && e._owner !== G.current && (n = " It was passed a child from " + E(e._owner.type) + "."), x(e), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), x(null);
}
}
function he(e, r) {
{
if (typeof e != "object")
return;
function H(e, r) {
if (typeof e == "object" && e && e.$$typeof !== Ce) {
if (q(e))
for (var t = 0; t < e.length; t++) {
var n = e[t];
X(n) && _e(n, r);
h(n) && X(n, r);
}
else if (X(e))
e._store && (e._store.validated = !0);
else if (e) {
var i = we(e);
if (typeof i == "function" && i !== e.entries)
for (var u = i.call(e), o; !(o = u.next()).done; )
X(o.value) && _e(o.value, r);
}
else if (h(e))
e._store && (e._store.validated = 1);
else if (e === null || typeof e != "object" ? t = null : (t = Q && e[Q] || e["@@iterator"], t = typeof t == "function" ? t : null), typeof t == "function" && t !== e.entries && (t = t.call(e), t !== e))
for (; !(e = t.next()).done; )
h(e.value) && X(e.value, r);
}
}
function ar(e) {
{
var r = e.type;
if (r == null || typeof r == "string")
return;
var t;
if (typeof r == "function")
t = r.propTypes;
else if (typeof r == "object" && (r.$$typeof === c || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
r.$$typeof === h))
t = r.propTypes;
else
return;
if (t) {
var n = E(r);
Be(t, e.props, "prop", n, e);
} else if (r.PropTypes !== void 0 && !z) {
z = !0;
var i = E(r);
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
}
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
function h(e) {
return typeof e == "object" && e !== null && e.$$typeof === N;
}
function or(e) {
{
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
var n = r[t];
if (n !== "children" && n !== "key") {
x(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), x(null);
break;
}
}
e.ref !== null && (x(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), x(null));
function X(e, r) {
if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, r = Te(r), !ce[r])) {
ce[r] = !0;
var t = "";
e && e._owner != null && e._owner !== S() && (t = null, typeof e._owner.tag == "number" ? t = a(e._owner.type) : typeof e._owner.name == "string" && (t = e._owner.name), t = " It was passed a child from " + t + ".");
var n = T.getCurrentStack;
T.getCurrentStack = function() {
var i = x(e.type);
return n && (i += n() || ""), i;
}, console.error(
'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
r,
t
), T.getCurrentStack = n;
}
}
var Te = {};
function Ce(e, r, t, n, i, u) {
{
var o = $e(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 = tr();
p ? a += p : a += Re();
var s;
e === null ? s = "null" : q(e) ? s = "array" : e !== void 0 && e.$$typeof === l ? (s = "<" + (E(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : s = typeof e, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", s, a);
}
var f = rr(e, r, t, i, u);
if (f == null)
return f;
if (o) {
var R = r.children;
if (R !== void 0)
if (n)
if (q(R)) {
for (var A = 0; A < R.length; A++)
he(R[A], e);
Object.freeze && Object.freeze(R);
} else
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
he(R, e);
}
if (F.call(r, "key")) {
var P = E(e), y = Object.keys(r).filter(function(cr) {
return cr !== "key";
}), H = y.length > 0 ? "{key: someKey, " + y.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!Te[P + H]) {
var lr = y.length > 0 ? "{" + y.join(": ..., ") + ": ...}" : "{}";
v(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, H, P, lr, P), Te[P + H] = !0;
}
}
return e === m ? or(f) : ar(f), f;
}
function Te(e) {
var r = "", t = S();
return t && (t = a(t.type)) && (r = `
Check the render method of \`` + t + "`."), r || (e = a(e)) && (r = `
Check the top-level render call using <` + e + ">."), r;
}
function ir(e, r, t) {
return Ce(e, r, t, !0);
}
function ur(e, r, t) {
return Ce(e, r, t, !1);
}
var sr = ur, fr = ir;
$.Fragment = m, $.jsx = sr, $.jsxs = fr;
}()), $;
var ye = je, N = Symbol.for("react.transitional.element"), pe = Symbol.for("react.portal"), P = Symbol.for("react.fragment"), F = Symbol.for("react.strict_mode"), L = Symbol.for("react.profiler"), Z = Symbol.for("react.consumer"), I = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), M = Symbol.for("react.suspense"), $ = Symbol.for("react.suspense_list"), W = Symbol.for("react.memo"), U = Symbol.for("react.lazy"), Re = Symbol.for("react.offscreen"), Q = Symbol.iterator, xe = Symbol.for("react.client.reference"), T = ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, y = Object.assign, ke = Symbol.for("react.client.reference"), q = Array.isArray, k = 0, D, ee, re, te, oe, ne, ae;
d.__reactDisabledLog = !0;
var J, ue, V = !1, z = new (typeof WeakMap == "function" ? WeakMap : Map)(), Ce = Symbol.for("react.client.reference"), se, ie = {}, le = {}, ce = {};
A.Fragment = P, A.jsx = function(e, r, t, n, i) {
return G(e, r, t, !1, n, i);
}, A.jsxs = function(e, r, t, n, i) {
return G(e, r, t, !0, n, i);
};
}()), A;
}
process.env.NODE_ENV === "production" ? Q.exports = yr() : Q.exports = gr();
var Pe = Q.exports;
function br(d) {
const l = vr(d);
return dr(() => {
l.state === "blocked" && !d && l.reset();
}, [l, d]), pr(
Z(
(b) => {
(typeof d == "boolean" && d === !0 || // @ts-ignore Reload case -- No location present
typeof d == "function" && d()) && (b.preventDefault(), b.returnValue = "Changes that you made may not be saved.");
var Ee;
function Ne() {
return Ee || (Ee = 1, process.env.NODE_ENV === "production" ? O.exports = Se() : O.exports = he()), O.exports;
}
var de = Ne();
function Pe(a) {
const s = we(a);
return Ae(() => {
s.state === "blocked" && !a && s.reset();
}, [s, a]), Oe(
B(
(c) => {
(typeof a == "boolean" && a === !0 || // @ts-ignore Reload case -- No location present
typeof a == "function" && a()) && (c.preventDefault(), c.returnValue = "Changes that you made may not be saved.");
},
[d]
[a]
),
{ capture: !0 }
), l;
), s;
}
const mr = (d) => {
const l = br(d), b = () => {
l.state === "blocked" && l.reset();
}, m = () => {
l.state === "blocked" && setTimeout(l.proceed, 0);
const Ye = (a) => {
const s = Pe(a), c = () => {
s.state === "blocked" && s.reset();
}, d = () => {
s.state === "blocked" && setTimeout(s.proceed, 0);
};
return {
isActive: l.state === "blocked",
onConfirm: m,
resetConfirmation: b
isActive: s.state === "blocked",
onConfirm: d,
resetConfirmation: c
};
};
function _r({
when: d,
children: l,
beforeCancel: b,
beforeConfirm: m
function We({
when: a,
children: s,
beforeCancel: c,
beforeConfirm: d
}) {
const { isActive: j, onConfirm: C, resetConfirmation: T } = mr(d), _ = Z(async () => {
m && await m(), C();
}, [m, C]), c = Z(async () => {
b && await b(), T();
}, [b, T]);
return j ? /* @__PURE__ */ Pe.jsx(Pe.Fragment, { children: l({
const { isActive: f, onConfirm: v, resetConfirmation: E } = Ye(a), g = B(async () => {
d && await d(), v();
}, [d, v]), x = B(async () => {
c && await c(), E();
}, [c, E]);
return f ? /* @__PURE__ */ de.jsx(de.Fragment, { children: s({
isActive: !0,
onConfirm: _,
onCancel: c
onConfirm: g,
onCancel: x
}) }) : null;
}
export {
_r as default,
mr as useConfirm,
br as usePrompt
We as default,
Ye as useConfirm,
Pe as usePrompt
};
{
"version": "0.7.1",
"version": "0.7.2-beta-1",
"name": "react-router-prompt",

@@ -40,29 +40,29 @@ "description": "React Router Navigation Prompt for v6",

"devDependencies": {
"@size-limit/preset-small-lib": "^11.0.2",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"eslint": "^8.56.0",
"@size-limit/preset-small-lib": "^11.1.6",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"@vitejs/plugin-react-swc": "^3.7.2",
"eslint": "^8.57.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^18.0.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",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.1.0",
"history": "^5.3.0",
"husky": "^9.0.11",
"husky": "^9.1.7",
"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": "^4.0.0",
"vite-tsconfig-paths": "^5.0.0"
"prettier": "^3.4.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router-dom": "^7.0.2",
"size-limit": "^11.1.6",
"typescript": "^5.7.2",
"vite": "^6.0.3",
"vite-plugin-dts": "^4.3.0",
"vite-tsconfig-paths": "^5.1.4"
},

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

Sorry, the diff of this file is not supported yet

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