react-router-prompt
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { 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 { Blocker, BlockerFunction } from "react-router-dom"; | ||
import { Blocker, BlockerFunction } from 'react-router-dom'; | ||
declare function usePrompt(when: boolean | BlockerFunction): Blocker; | ||
export default usePrompt; |
@@ -1,5 +0,5 @@ | ||
import React from "react"; | ||
import { BlockerFunction } from "react-router-dom"; | ||
import useConfirm from "./hooks/use-confirm"; | ||
import usePrompt from "./hooks/use-prompt"; | ||
import { default as React } from 'react'; | ||
import { BlockerFunction } from 'react-router-dom'; | ||
import { default as useConfirm } from './hooks/use-confirm'; | ||
import { default as usePrompt } from './hooks/use-prompt'; | ||
type ReactRouterPromptProps = { | ||
@@ -6,0 +6,0 @@ when: boolean | BlockerFunction; |
@@ -1,6 +0,30 @@ | ||
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 = {}; | ||
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 = {}; | ||
/** | ||
* @license React | ||
* react-jsx-runtime.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
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 }; | ||
} | ||
return W.Fragment = b, W.jsx = T, W.jsxs = T, W; | ||
} | ||
var $ = {}; | ||
/** | ||
* @license React | ||
* react-jsx-runtime.development.js | ||
@@ -13,13 +37,13 @@ * | ||
*/ | ||
var Te; | ||
function cr() { | ||
return Te || (Te = 1, process.env.NODE_ENV !== "production" && function() { | ||
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"; | ||
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 = Z && e[Z] || e[Se]; | ||
var r = ee && e[ee] || e[ke]; | ||
return typeof r == "function" ? r : null; | ||
} | ||
var x = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
var w = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function v(e) { | ||
@@ -34,3 +58,3 @@ { | ||
{ | ||
var n = x.ReactDebugCurrentFrame, i = n.getStackAddendum(); | ||
var n = w.ReactDebugCurrentFrame, i = n.getStackAddendum(); | ||
i !== "" && (r += "%s", t = t.concat([i])); | ||
@@ -43,12 +67,12 @@ var u = t.map(function(o) { | ||
} | ||
var je = !1, ke = !1, Ae = !1, De = !1, Fe = !1, Q; | ||
Q = Symbol.for("react.module.reference"); | ||
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 | ||
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 === Q || e.getModuleId !== void 0)); | ||
e.$$typeof === re || e.getModuleId !== void 0)); | ||
} | ||
function $e(e, r, t) { | ||
function Ye(e, r, t) { | ||
var n = e.displayName; | ||
@@ -60,6 +84,6 @@ if (n) | ||
} | ||
function ee(e) { | ||
function te(e) { | ||
return e.displayName || "Context"; | ||
} | ||
function _(e) { | ||
function E(e) { | ||
if (e == null) | ||
@@ -72,3 +96,3 @@ return null; | ||
switch (e) { | ||
case g: | ||
case m: | ||
return "Fragment"; | ||
@@ -79,7 +103,7 @@ case b: | ||
return "Profiler"; | ||
case S: | ||
case j: | ||
return "StrictMode"; | ||
case w: | ||
case k: | ||
return "Suspense"; | ||
case m: | ||
case g: | ||
return "SuspenseList"; | ||
@@ -89,17 +113,17 @@ } | ||
switch (e.$$typeof) { | ||
case E: | ||
case _: | ||
var r = e; | ||
return ee(r) + ".Consumer"; | ||
return te(r) + ".Consumer"; | ||
case T: | ||
var t = e; | ||
return ee(t._context) + ".Provider"; | ||
return te(t._context) + ".Provider"; | ||
case c: | ||
return $e(e, e.render, "ForwardRef"); | ||
case R: | ||
return Ye(e, e.render, "ForwardRef"); | ||
case h: | ||
var n = e.displayName || null; | ||
return n !== null ? n : _(e.type) || "Memo"; | ||
return n !== null ? n : E(e.type) || "Memo"; | ||
case O: { | ||
var i = e, u = i._payload, o = i._init; | ||
try { | ||
return _(o(u)); | ||
return E(o(u)); | ||
} catch { | ||
@@ -112,14 +136,14 @@ return null; | ||
} | ||
var P = Object.assign, A = 0, re, te, ne, ae, oe, ie, ue; | ||
function se() { | ||
var S = Object.assign, D = 0, ne, ae, oe, ie, ue, se, fe; | ||
function le() { | ||
} | ||
se.__reactDisabledLog = !0; | ||
function We() { | ||
le.__reactDisabledLog = !0; | ||
function Le() { | ||
{ | ||
if (A === 0) { | ||
re = console.log, te = console.info, ne = console.warn, ae = console.error, oe = console.group, ie = console.groupCollapsed, ue = console.groupEnd; | ||
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: se, | ||
value: le, | ||
writable: !0 | ||
@@ -137,8 +161,8 @@ }; | ||
} | ||
A++; | ||
D++; | ||
} | ||
} | ||
function Ye() { | ||
function Ve() { | ||
{ | ||
if (A--, A === 0) { | ||
if (D--, D === 0) { | ||
var e = { | ||
@@ -150,32 +174,32 @@ configurable: !0, | ||
Object.defineProperties(console, { | ||
log: P({}, e, { | ||
value: re | ||
}), | ||
info: P({}, e, { | ||
value: te | ||
}), | ||
warn: P({}, e, { | ||
log: S({}, e, { | ||
value: ne | ||
}), | ||
error: P({}, e, { | ||
info: S({}, e, { | ||
value: ae | ||
}), | ||
group: P({}, e, { | ||
warn: S({}, e, { | ||
value: oe | ||
}), | ||
groupCollapsed: P({}, e, { | ||
error: S({}, e, { | ||
value: ie | ||
}), | ||
groupEnd: P({}, e, { | ||
group: S({}, e, { | ||
value: ue | ||
}), | ||
groupCollapsed: S({}, e, { | ||
value: se | ||
}), | ||
groupEnd: S({}, e, { | ||
value: fe | ||
}) | ||
}); | ||
} | ||
A < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
D < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
} | ||
} | ||
var U = x.ReactCurrentDispatcher, M; | ||
function W(e, r, t) { | ||
var N = w.ReactCurrentDispatcher, B; | ||
function L(e, r, t) { | ||
{ | ||
if (M === void 0) | ||
if (B === void 0) | ||
try { | ||
@@ -185,18 +209,18 @@ throw Error(); | ||
var n = i.stack.trim().match(/\n( *(at )?)/); | ||
M = n && n[1] || ""; | ||
B = n && n[1] || ""; | ||
} | ||
return ` | ||
` + M + e; | ||
` + B + e; | ||
} | ||
} | ||
var B = !1, Y; | ||
var J = !1, V; | ||
{ | ||
var Le = typeof WeakMap == "function" ? WeakMap : Map; | ||
Y = new Le(); | ||
var Ue = typeof WeakMap == "function" ? WeakMap : Map; | ||
V = new Ue(); | ||
} | ||
function fe(e, r) { | ||
if (!e || B) | ||
function ce(e, r) { | ||
if (!e || J) | ||
return ""; | ||
{ | ||
var t = Y.get(e); | ||
var t = V.get(e); | ||
if (t !== void 0) | ||
@@ -206,7 +230,7 @@ return t; | ||
var n; | ||
B = !0; | ||
J = !0; | ||
var i = Error.prepareStackTrace; | ||
Error.prepareStackTrace = void 0; | ||
var u; | ||
u = U.current, U.current = null, We(); | ||
u = N.current, N.current = null, Le(); | ||
try { | ||
@@ -224,4 +248,4 @@ if (r) { | ||
Reflect.construct(o, []); | ||
} catch (h) { | ||
n = h; | ||
} catch (y) { | ||
n = y; | ||
} | ||
@@ -232,4 +256,4 @@ Reflect.construct(e, [], o); | ||
o.call(); | ||
} catch (h) { | ||
n = h; | ||
} catch (y) { | ||
n = y; | ||
} | ||
@@ -241,10 +265,10 @@ e.call(o.prototype); | ||
throw Error(); | ||
} catch (h) { | ||
n = h; | ||
} catch (y) { | ||
n = y; | ||
} | ||
e(); | ||
} | ||
} catch (h) { | ||
if (h && n && typeof h.stack == "string") { | ||
for (var a = h.stack.split(` | ||
} catch (y) { | ||
if (y && n && typeof y.stack == "string") { | ||
for (var a = y.stack.split(` | ||
`), p = n.stack.split(` | ||
@@ -258,5 +282,5 @@ `), s = a.length - 1, f = p.length - 1; s >= 1 && f >= 0 && a[s] !== p[f]; ) | ||
if (s--, f--, f < 0 || a[s] !== p[f]) { | ||
var y = ` | ||
var R = ` | ||
` + a[s].replace(" at new ", " at "); | ||
return e.displayName && y.includes("<anonymous>") && (y = y.replace("<anonymous>", e.displayName)), typeof e == "function" && Y.set(e, y), y; | ||
return e.displayName && R.includes("<anonymous>") && (R = R.replace("<anonymous>", e.displayName)), typeof e == "function" && V.set(e, R), R; | ||
} | ||
@@ -268,26 +292,26 @@ while (s >= 1 && f >= 0); | ||
} finally { | ||
B = !1, U.current = u, Ye(), Error.prepareStackTrace = i; | ||
J = !1, N.current = u, Ve(), Error.prepareStackTrace = i; | ||
} | ||
var k = e ? e.displayName || e.name : "", he = k ? W(k) : ""; | ||
return typeof e == "function" && Y.set(e, he), he; | ||
var A = e ? e.displayName || e.name : "", P = A ? L(A) : ""; | ||
return typeof e == "function" && V.set(e, P), P; | ||
} | ||
function Ne(e, r, t) { | ||
return fe(e, !1); | ||
function Me(e, r, t) { | ||
return ce(e, !1); | ||
} | ||
function Ve(e) { | ||
function Ne(e) { | ||
var r = e.prototype; | ||
return !!(r && r.isReactComponent); | ||
} | ||
function L(e, r, t) { | ||
function U(e, r, t) { | ||
if (e == null) | ||
return ""; | ||
if (typeof e == "function") | ||
return fe(e, Ve(e)); | ||
return ce(e, Ne(e)); | ||
if (typeof e == "string") | ||
return W(e); | ||
return L(e); | ||
switch (e) { | ||
case w: | ||
return W("Suspense"); | ||
case m: | ||
return W("SuspenseList"); | ||
case k: | ||
return L("Suspense"); | ||
case g: | ||
return L("SuspenseList"); | ||
} | ||
@@ -297,9 +321,9 @@ if (typeof e == "object") | ||
case c: | ||
return Ne(e.render); | ||
case R: | ||
return L(e.type, r, t); | ||
return Me(e.render); | ||
case h: | ||
return U(e.type, r, t); | ||
case O: { | ||
var n = e, i = n._payload, u = n._init; | ||
try { | ||
return L(u(i), r, t); | ||
return U(u(i), r, t); | ||
} catch { | ||
@@ -311,13 +335,13 @@ } | ||
} | ||
var N = Object.prototype.hasOwnProperty, le = {}, ce = x.ReactDebugCurrentFrame; | ||
function V(e) { | ||
var F = Object.prototype.hasOwnProperty, de = {}, ve = w.ReactDebugCurrentFrame; | ||
function M(e) { | ||
if (e) { | ||
var r = e._owner, t = L(e.type, e._source, r ? r.type : null); | ||
ce.setExtraStackFrame(t); | ||
var r = e._owner, t = U(e.type, e._source, r ? r.type : null); | ||
ve.setExtraStackFrame(t); | ||
} else | ||
ce.setExtraStackFrame(null); | ||
ve.setExtraStackFrame(null); | ||
} | ||
function Ue(e, r, t, n, i) { | ||
function Be(e, r, t, n, i) { | ||
{ | ||
var u = Function.call.bind(N); | ||
var u = Function.call.bind(F); | ||
for (var o in e) | ||
@@ -335,11 +359,11 @@ if (u(e, o)) { | ||
} | ||
a && !(a instanceof Error) && (V(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), V(null)), a instanceof Error && !(a.message in le) && (le[a.message] = !0, V(i), v("Failed %s type: %s", t, a.message), V(null)); | ||
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 Me = Array.isArray; | ||
var Je = Array.isArray; | ||
function q(e) { | ||
return Me(e); | ||
return Je(e); | ||
} | ||
function Be(e) { | ||
function qe(e) { | ||
{ | ||
@@ -350,5 +374,5 @@ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object"; | ||
} | ||
function qe(e) { | ||
function Ke(e) { | ||
try { | ||
return de(e), !1; | ||
return pe(e), !1; | ||
} catch { | ||
@@ -358,10 +382,10 @@ return !0; | ||
} | ||
function de(e) { | ||
function pe(e) { | ||
return "" + e; | ||
} | ||
function ve(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); | ||
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 D = x.ReactCurrentOwner, Je = { | ||
var I = w.ReactCurrentOwner, Ge = { | ||
key: !0, | ||
@@ -371,6 +395,6 @@ ref: !0, | ||
__source: !0 | ||
}, pe, me, J; | ||
J = {}; | ||
function Ge(e) { | ||
if (N.call(e, "ref")) { | ||
}, ge, be, K; | ||
K = {}; | ||
function ze(e) { | ||
if (F.call(e, "ref")) { | ||
var r = Object.getOwnPropertyDescriptor(e, "ref").get; | ||
@@ -382,4 +406,4 @@ if (r && r.isReactWarning) | ||
} | ||
function ze(e) { | ||
if (N.call(e, "key")) { | ||
function Xe(e) { | ||
if (F.call(e, "key")) { | ||
var r = Object.getOwnPropertyDescriptor(e, "key").get; | ||
@@ -391,12 +415,12 @@ if (r && r.isReactWarning) | ||
} | ||
function Ke(e, r) { | ||
if (typeof e.ref == "string" && D.current && r && D.current.stateNode !== r) { | ||
var t = _(D.current.type); | ||
J[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', _(D.current.type), e.ref), J[t] = !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 He(e, r) { | ||
function Ze(e, r) { | ||
{ | ||
var t = function() { | ||
pe || (pe = !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)); | ||
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)); | ||
}; | ||
@@ -409,6 +433,6 @@ t.isReactWarning = !0, Object.defineProperty(e, "key", { | ||
} | ||
function Xe(e, r) { | ||
function Qe(e, r) { | ||
{ | ||
var t = function() { | ||
me || (me = !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)); | ||
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)); | ||
}; | ||
@@ -421,3 +445,3 @@ t.isReactWarning = !0, Object.defineProperty(e, "ref", { | ||
} | ||
var Ze = function(e, r, t, n, i, u, o) { | ||
var er = function(e, r, t, n, i, u, o) { | ||
var a = { | ||
@@ -451,8 +475,8 @@ // This tag allows us to uniquely identify this as a React Element | ||
}; | ||
function Qe(e, r, t, n, i) { | ||
function rr(e, r, t, n, i) { | ||
{ | ||
var u, o = {}, a = null, p = null; | ||
t !== void 0 && (ve(t), a = "" + t), ze(r) && (ve(r.key), a = "" + r.key), Ge(r) && (p = r.ref, Ke(r, i)); | ||
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) | ||
N.call(r, u) && !Je.hasOwnProperty(u) && (o[u] = r[u]); | ||
F.call(r, u) && !Ge.hasOwnProperty(u) && (o[u] = r[u]); | ||
if (e && e.defaultProps) { | ||
@@ -465,24 +489,24 @@ var s = e.defaultProps; | ||
var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; | ||
a && He(o, f), p && Xe(o, f); | ||
a && Ze(o, f), p && Qe(o, f); | ||
} | ||
return Ze(e, a, p, i, n, D.current, o); | ||
return er(e, a, p, i, n, I.current, o); | ||
} | ||
} | ||
var G = x.ReactCurrentOwner, be = x.ReactDebugCurrentFrame; | ||
function j(e) { | ||
var G = w.ReactCurrentOwner, me = w.ReactDebugCurrentFrame; | ||
function x(e) { | ||
if (e) { | ||
var r = e._owner, t = L(e.type, e._source, r ? r.type : null); | ||
be.setExtraStackFrame(t); | ||
var r = e._owner, t = U(e.type, e._source, r ? r.type : null); | ||
me.setExtraStackFrame(t); | ||
} else | ||
be.setExtraStackFrame(null); | ||
me.setExtraStackFrame(null); | ||
} | ||
var z; | ||
z = !1; | ||
function K(e) { | ||
function X(e) { | ||
return typeof e == "object" && e !== null && e.$$typeof === l; | ||
} | ||
function ge() { | ||
function Re() { | ||
{ | ||
if (G.current) { | ||
var e = _(G.current.type); | ||
var e = E(G.current.type); | ||
if (e) | ||
@@ -496,17 +520,9 @@ return ` | ||
} | ||
function er(e) { | ||
{ | ||
if (e !== void 0) { | ||
var r = e.fileName.replace(/^.*[\\\/]/, ""), t = e.lineNumber; | ||
return ` | ||
Check your code at ` + r + ":" + t + "."; | ||
} | ||
return ""; | ||
} | ||
function tr(e) { | ||
return ""; | ||
} | ||
var ye = {}; | ||
function rr(e) { | ||
var Ee = {}; | ||
function nr(e) { | ||
{ | ||
var r = ge(); | ||
var r = Re(); | ||
if (!r) { | ||
@@ -521,3 +537,3 @@ var t = typeof e == "string" ? e : e.displayName || e.name; | ||
} | ||
function Ee(e, r) { | ||
function _e(e, r) { | ||
{ | ||
@@ -527,11 +543,11 @@ if (!e._store || e._store.validated || e.key != null) | ||
e._store.validated = !0; | ||
var t = rr(r); | ||
if (ye[t]) | ||
var t = nr(r); | ||
if (Ee[t]) | ||
return; | ||
ye[t] = !0; | ||
Ee[t] = !0; | ||
var n = ""; | ||
e && e._owner && e._owner !== G.current && (n = " It was passed a child from " + _(e._owner.type) + "."), j(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), j(null); | ||
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 Re(e, r) { | ||
function he(e, r) { | ||
{ | ||
@@ -543,5 +559,5 @@ if (typeof e != "object") | ||
var n = e[t]; | ||
K(n) && Ee(n, r); | ||
X(n) && _e(n, r); | ||
} | ||
else if (K(e)) | ||
else if (X(e)) | ||
e._store && (e._store.validated = !0); | ||
@@ -552,7 +568,7 @@ else if (e) { | ||
for (var u = i.call(e), o; !(o = u.next()).done; ) | ||
K(o.value) && Ee(o.value, r); | ||
X(o.value) && _e(o.value, r); | ||
} | ||
} | ||
} | ||
function tr(e) { | ||
function ar(e) { | ||
{ | ||
@@ -567,3 +583,3 @@ var r = e.type; | ||
// Inner props are checked in the reconciler. | ||
r.$$typeof === R)) | ||
r.$$typeof === h)) | ||
t = r.propTypes; | ||
@@ -573,7 +589,7 @@ else | ||
if (t) { | ||
var n = _(r); | ||
Ue(t, e.props, "prop", n, e); | ||
var n = E(r); | ||
Be(t, e.props, "prop", n, e); | ||
} else if (r.PropTypes !== void 0 && !z) { | ||
z = !0; | ||
var i = _(r); | ||
var i = E(r); | ||
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown"); | ||
@@ -584,3 +600,3 @@ } | ||
} | ||
function nr(e) { | ||
function or(e) { | ||
{ | ||
@@ -590,85 +606,72 @@ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) { | ||
if (n !== "children" && n !== "key") { | ||
j(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), j(null); | ||
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 && (j(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), j(null)); | ||
e.ref !== null && (x(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), x(null)); | ||
} | ||
} | ||
function _e(e, r, t, n, i, u) { | ||
var Te = {}; | ||
function Ce(e, r, t, n, i, u) { | ||
{ | ||
var o = Ie(e); | ||
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 = er(i); | ||
p ? a += p : a += ge(); | ||
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.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); | ||
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 = Qe(e, r, t, i, u); | ||
var f = rr(e, r, t, i, u); | ||
if (f == null) | ||
return f; | ||
if (o) { | ||
var y = r.children; | ||
if (y !== void 0) | ||
var R = r.children; | ||
if (R !== void 0) | ||
if (n) | ||
if (q(y)) { | ||
for (var k = 0; k < y.length; k++) | ||
Re(y[k], e); | ||
Object.freeze && Object.freeze(y); | ||
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 | ||
Re(y, e); | ||
he(R, e); | ||
} | ||
return e === g ? nr(f) : tr(f), f; | ||
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 ar(e, r, t) { | ||
return _e(e, r, t, !0); | ||
function ir(e, r, t) { | ||
return Ce(e, r, t, !0); | ||
} | ||
function or(e, r, t) { | ||
return _e(e, r, t, !1); | ||
function ur(e, r, t) { | ||
return Ce(e, r, t, !1); | ||
} | ||
var ir = or, ur = ar; | ||
F.Fragment = g, F.jsx = ir, F.jsxs = ur; | ||
}()), F; | ||
var sr = ur, fr = ir; | ||
$.Fragment = m, $.jsx = sr, $.jsxs = fr; | ||
}()), $; | ||
} | ||
var I = {}; | ||
/** | ||
* @license React | ||
* react-jsx-runtime.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var Ce; | ||
function dr() { | ||
if (Ce) | ||
return I; | ||
Ce = 1; | ||
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) { | ||
var m, R = {}, O = null, $ = null; | ||
w !== void 0 && (O = "" + w), c.key !== void 0 && (O = "" + c.key), c.ref !== void 0 && ($ = c.ref); | ||
for (m in c) | ||
g.call(c, m) && !C.hasOwnProperty(m) && (R[m] = c[m]); | ||
if (E && E.defaultProps) | ||
for (m in c = E.defaultProps, c) | ||
R[m] === void 0 && (R[m] = c[m]); | ||
return { $$typeof: l, type: E, key: O, ref: $, props: R, _owner: S.current }; | ||
} | ||
return I.Fragment = b, I.jsx = T, I.jsxs = T, I; | ||
} | ||
process.env.NODE_ENV === "production" ? X.exports = dr() : X.exports = cr(); | ||
var Oe = X.exports; | ||
function vr(d) { | ||
const l = fr(d); | ||
return sr(() => { | ||
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]), lr( | ||
H( | ||
}, [l, d]), pr( | ||
Z( | ||
(b) => { | ||
@@ -683,6 +686,6 @@ (typeof d == "boolean" && d === !0 || // @ts-ignore Reload case -- No location present | ||
} | ||
const pr = (d) => { | ||
const l = vr(d), b = () => { | ||
const mr = (d) => { | ||
const l = br(d), b = () => { | ||
l.state === "blocked" && l.reset(); | ||
}, g = () => { | ||
}, m = () => { | ||
l.state === "blocked" && setTimeout(l.proceed, 0); | ||
@@ -692,20 +695,20 @@ }; | ||
isActive: l.state === "blocked", | ||
onConfirm: g, | ||
onConfirm: m, | ||
resetConfirmation: b | ||
}; | ||
}; | ||
function gr({ | ||
function _r({ | ||
when: d, | ||
children: l, | ||
beforeCancel: b, | ||
beforeConfirm: g | ||
beforeConfirm: m | ||
}) { | ||
const { isActive: S, onConfirm: C, resetConfirmation: T } = pr(d), E = H(async () => { | ||
g && await g(), C(); | ||
}, [g, C]), c = H(async () => { | ||
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 S ? /* @__PURE__ */ Oe.jsx(Oe.Fragment, { children: l({ | ||
return j ? /* @__PURE__ */ Pe.jsx(Pe.Fragment, { children: l({ | ||
isActive: !0, | ||
onConfirm: E, | ||
onConfirm: _, | ||
onCancel: c | ||
@@ -715,5 +718,5 @@ }) }) : null; | ||
export { | ||
gr as default, | ||
pr as useConfirm, | ||
vr as usePrompt | ||
_r as default, | ||
mr as useConfirm, | ||
br as usePrompt | ||
}; |
{ | ||
"version": "0.7.0", | ||
"version": "0.7.1-beta-1", | ||
"name": "react-router-prompt", | ||
@@ -43,8 +43,8 @@ "description": "React Router Navigation Prompt for v6", | ||
"@types/react-dom": "^18.2.19", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^7.0.1", | ||
"@typescript-eslint/eslint-plugin": "^8.0.0", | ||
"@typescript-eslint/parser": "^8.0.0", | ||
"@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-airbnb-typescript": "^18.0.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
@@ -66,4 +66,4 @@ "eslint-plugin-import": "^2.29.1", | ||
"vite": "^5.1.3", | ||
"vite-plugin-dts": "^3.7.2", | ||
"vite-tsconfig-paths": "^4.3.1" | ||
"vite-plugin-dts": "^4.0.0", | ||
"vite-tsconfig-paths": "^5.0.0" | ||
}, | ||
@@ -70,0 +70,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
47717
1.83%807
1%