@qubhq/react-router-prompt 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -8
- package/dist/hooks/use-confirm.d.ts +3 -2
- package/dist/hooks/use-prompt.d.ts +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/react-router-prompt.js +50 -671
- package/dist/react-router-prompt.umd.cjs +1 -30
- package/package.json +15 -23
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# react-router-prompt 🚨
|
|
2
2
|
|
|
3
|
-
> A component for the react-router 6 `Prompt`. Allows to create more flexible dialogs.
|
|
3
|
+
> A component for the react-router-dom 6 / react-router 7 `Prompt`. Allows to create more flexible dialogs.
|
|
4
|
+
|
|
5
|
+
Please follow [Note section](https://github.com/sshyam-gupta/react-router-prompt#note) for more details on react-router support
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/react-router-prompt)
|
|
6
8
|
|
|
@@ -16,7 +18,7 @@
|
|
|
16
18
|
|
|
17
19
|
### Prerequisite
|
|
18
20
|
|
|
19
|
-
**React-router-dom >=
|
|
21
|
+
**React-router-dom >= 7** and shall be ideally used with [**data routers**](https://reactrouter.com/6.28.1/routers/picking-a-router#using-v64-data-apis)
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
24
|
pnpm add react-router-prompt
|
|
@@ -56,24 +58,28 @@ yarn add react-router-prompt
|
|
|
56
58
|
}) => boolean
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
2. `beforeConfirm()` : `Promise<unknown>` _(Optional)_
|
|
61
|
+
2. `beforeConfirm(nextLocation?: Location)` : `Promise<unknown>` _(Optional)_
|
|
60
62
|
|
|
61
63
|
3. `beforeCancel()` : `Promise<unknown>` _(Optional)_
|
|
62
64
|
|
|
63
65
|
### Return values
|
|
64
66
|
|
|
65
67
|
1. `isActive`: `Boolean`
|
|
66
|
-
2. `onConfirm()`: `void`
|
|
68
|
+
2. `onConfirm(nextLocation?: Location)`: `void`
|
|
67
69
|
3. `onCancel()`: `void`
|
|
70
|
+
4. `nextLocation`: `Location | undefined`
|
|
68
71
|
|
|
69
72
|
#### Note 🗒️
|
|
70
73
|
|
|
71
|
-
This version works with react-router-dom >=
|
|
72
|
-
|
|
74
|
+
This version works with react-router-dom >=v7 or react-router >=v7 and shall be ideally used with [**data routers**](https://reactrouter.com/6.28.1/routers/picking-a-router#using-v64-data-apis)
|
|
75
|
+
|
|
76
|
+
- For react-router support `(v7)` please install `v0.8.x`
|
|
77
|
+
|
|
78
|
+
- For react-router-dom support `(v6.19.x - v6.28.1)` please install `v0.7.x`
|
|
73
79
|
|
|
74
|
-
For react-router support `(v6 - v6.
|
|
80
|
+
- For react-router-dom support `(v6.7.x - v6.18.x)` please install `v0.5.4`
|
|
75
81
|
|
|
76
|
-
For react-router support (v6
|
|
82
|
+
- For react-router-dom support `(v6 - v6.2.x)` please install `v0.3.0`
|
|
77
83
|
|
|
78
84
|
_Skipped support in middle due to breaking changes on react-router apis_
|
|
79
85
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BlockerFunction } from 'react-router
|
|
1
|
+
import { BlockerFunction, Location } from 'react-router';
|
|
2
2
|
import { DefaultBehaviour } from '../types';
|
|
3
3
|
declare interface InitialStateType {
|
|
4
4
|
isActive: boolean;
|
|
5
5
|
onConfirm(): void;
|
|
6
6
|
resetConfirmation(): void;
|
|
7
|
+
nextLocation?: Location;
|
|
7
8
|
}
|
|
8
|
-
declare const useConfirm: (when: boolean | BlockerFunction, defaultBehaviour
|
|
9
|
+
declare const useConfirm: (when: boolean | BlockerFunction, defaultBehaviour?: DefaultBehaviour) => InitialStateType;
|
|
9
10
|
export default useConfirm;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Blocker, BlockerFunction } from 'react-router
|
|
1
|
+
import { Blocker, BlockerFunction, Location } from 'react-router';
|
|
2
2
|
import { DefaultBehaviour } from '../types';
|
|
3
|
-
declare function usePrompt(when: boolean | BlockerFunction,
|
|
3
|
+
declare function usePrompt(when: boolean | BlockerFunction, onNavigate?: (nextLocation: Location) => void, defaultBehaviour?: DefaultBehaviour): Blocker;
|
|
4
4
|
export default usePrompt;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { BlockerFunction } from 'react-router
|
|
2
|
+
import { BlockerFunction, Location } from 'react-router';
|
|
3
3
|
import { default as useConfirm } from './hooks/use-confirm';
|
|
4
4
|
import { default as usePrompt } from './hooks/use-prompt';
|
|
5
5
|
import { DefaultBehaviour } from './types';
|
|
@@ -9,9 +9,10 @@ type ReactRouterPromptProps = {
|
|
|
9
9
|
isActive: boolean;
|
|
10
10
|
onCancel: () => void;
|
|
11
11
|
onConfirm: () => void;
|
|
12
|
+
nextLocation?: Location;
|
|
12
13
|
}) => React.ReactNode;
|
|
13
14
|
beforeCancel?: () => Promise<unknown>;
|
|
14
|
-
beforeConfirm?: () => Promise<unknown>;
|
|
15
|
+
beforeConfirm?: (nextLocation?: Location) => Promise<unknown>;
|
|
15
16
|
defaultBehaviour?: DefaultBehaviour;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
@@ -32,5 +33,5 @@ type ReactRouterPromptProps = {
|
|
|
32
33
|
* </ReactRouterPrompt>
|
|
33
34
|
*/
|
|
34
35
|
declare function ReactRouterPrompt({ when, children, beforeCancel, beforeConfirm, defaultBehaviour, }: ReactRouterPromptProps): import("react/jsx-runtime").JSX.Element | null;
|
|
35
|
-
export default ReactRouterPrompt;
|
|
36
36
|
export { useConfirm, usePrompt };
|
|
37
|
+
export default ReactRouterPrompt;
|
|
@@ -1,685 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var Oe;
|
|
14
|
-
function yr() {
|
|
15
|
-
if (Oe) return W;
|
|
16
|
-
Oe = 1;
|
|
17
|
-
var d = je, m = Symbol.for("react.element"), l = Symbol.for("react.fragment"), p = Object.prototype.hasOwnProperty, T = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, k = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
18
|
-
function C(E, c, O) {
|
|
19
|
-
var b, h = {}, S = null, Y = null;
|
|
20
|
-
O !== void 0 && (S = "" + O), c.key !== void 0 && (S = "" + c.key), c.ref !== void 0 && (Y = c.ref);
|
|
21
|
-
for (b in c) p.call(c, b) && !k.hasOwnProperty(b) && (h[b] = c[b]);
|
|
22
|
-
if (E && E.defaultProps) for (b in c = E.defaultProps, c) h[b] === void 0 && (h[b] = c[b]);
|
|
23
|
-
return { $$typeof: m, type: E, key: S, ref: Y, props: h, _owner: T.current };
|
|
24
|
-
}
|
|
25
|
-
return W.Fragment = l, W.jsx = C, W.jsxs = C, W;
|
|
26
|
-
}
|
|
27
|
-
var $ = {};
|
|
28
|
-
/**
|
|
29
|
-
* @license React
|
|
30
|
-
* react-jsx-runtime.development.js
|
|
31
|
-
*
|
|
32
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the MIT license found in the
|
|
35
|
-
* LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/
|
|
37
|
-
var Se;
|
|
38
|
-
function gr() {
|
|
39
|
-
return Se || (Se = 1, process.env.NODE_ENV !== "production" && function() {
|
|
40
|
-
var d = je, m = Symbol.for("react.element"), l = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), k = Symbol.for("react.profiler"), C = Symbol.for("react.provider"), E = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), Y = Symbol.for("react.offscreen"), ee = Symbol.iterator, ke = "@@iterator";
|
|
41
|
-
function we(e) {
|
|
42
|
-
if (e === null || typeof e != "object")
|
|
43
|
-
return null;
|
|
44
|
-
var r = ee && e[ee] || e[ke];
|
|
45
|
-
return typeof r == "function" ? r : null;
|
|
46
|
-
}
|
|
47
|
-
var w = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
48
|
-
function v(e) {
|
|
49
|
-
{
|
|
50
|
-
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
51
|
-
t[n - 1] = arguments[n];
|
|
52
|
-
xe("error", e, t);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function xe(e, r, t) {
|
|
56
|
-
{
|
|
57
|
-
var n = w.ReactDebugCurrentFrame, i = n.getStackAddendum();
|
|
58
|
-
i !== "" && (r += "%s", t = t.concat([i]));
|
|
59
|
-
var u = t.map(function(o) {
|
|
60
|
-
return String(o);
|
|
61
|
-
});
|
|
62
|
-
u.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, u);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
var Ae = !1, De = !1, Fe = !1, Ie = !1, We = !1, re;
|
|
66
|
-
re = Symbol.for("react.module.reference");
|
|
67
|
-
function $e(e) {
|
|
68
|
-
return !!(typeof e == "string" || typeof e == "function" || e === p || e === k || We || e === T || e === O || e === b || Ie || e === Y || Ae || De || Fe || typeof e == "object" && e !== null && (e.$$typeof === S || e.$$typeof === h || e.$$typeof === C || e.$$typeof === E || e.$$typeof === c || // This needs to include all possible module reference object
|
|
69
|
-
// types supported by any Flight configuration anywhere since
|
|
70
|
-
// we don't know which Flight build this will end up being used
|
|
71
|
-
// with.
|
|
72
|
-
e.$$typeof === re || e.getModuleId !== void 0));
|
|
73
|
-
}
|
|
74
|
-
function Ye(e, r, t) {
|
|
75
|
-
var n = e.displayName;
|
|
76
|
-
if (n)
|
|
77
|
-
return n;
|
|
78
|
-
var i = r.displayName || r.name || "";
|
|
79
|
-
return i !== "" ? t + "(" + i + ")" : t;
|
|
80
|
-
}
|
|
81
|
-
function te(e) {
|
|
82
|
-
return e.displayName || "Context";
|
|
83
|
-
}
|
|
84
|
-
function _(e) {
|
|
85
|
-
if (e == null)
|
|
86
|
-
return null;
|
|
87
|
-
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")
|
|
88
|
-
return e.displayName || e.name || null;
|
|
89
|
-
if (typeof e == "string")
|
|
90
|
-
return e;
|
|
91
|
-
switch (e) {
|
|
92
|
-
case p:
|
|
93
|
-
return "Fragment";
|
|
94
|
-
case l:
|
|
95
|
-
return "Portal";
|
|
96
|
-
case k:
|
|
97
|
-
return "Profiler";
|
|
98
|
-
case T:
|
|
99
|
-
return "StrictMode";
|
|
100
|
-
case O:
|
|
101
|
-
return "Suspense";
|
|
102
|
-
case b:
|
|
103
|
-
return "SuspenseList";
|
|
104
|
-
}
|
|
105
|
-
if (typeof e == "object")
|
|
106
|
-
switch (e.$$typeof) {
|
|
107
|
-
case E:
|
|
108
|
-
var r = e;
|
|
109
|
-
return te(r) + ".Consumer";
|
|
110
|
-
case C:
|
|
111
|
-
var t = e;
|
|
112
|
-
return te(t._context) + ".Provider";
|
|
113
|
-
case c:
|
|
114
|
-
return Ye(e, e.render, "ForwardRef");
|
|
115
|
-
case h:
|
|
116
|
-
var n = e.displayName || null;
|
|
117
|
-
return n !== null ? n : _(e.type) || "Memo";
|
|
118
|
-
case S: {
|
|
119
|
-
var i = e, u = i._payload, o = i._init;
|
|
120
|
-
try {
|
|
121
|
-
return _(o(u));
|
|
122
|
-
} catch {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
var P = Object.assign, D = 0, ne, ae, oe, ie, ue, se, fe;
|
|
130
|
-
function le() {
|
|
131
|
-
}
|
|
132
|
-
le.__reactDisabledLog = !0;
|
|
133
|
-
function Le() {
|
|
134
|
-
{
|
|
135
|
-
if (D === 0) {
|
|
136
|
-
ne = console.log, ae = console.info, oe = console.warn, ie = console.error, ue = console.group, se = console.groupCollapsed, fe = console.groupEnd;
|
|
137
|
-
var e = {
|
|
138
|
-
configurable: !0,
|
|
139
|
-
enumerable: !0,
|
|
140
|
-
value: le,
|
|
141
|
-
writable: !0
|
|
142
|
-
};
|
|
143
|
-
Object.defineProperties(console, {
|
|
144
|
-
info: e,
|
|
145
|
-
log: e,
|
|
146
|
-
warn: e,
|
|
147
|
-
error: e,
|
|
148
|
-
group: e,
|
|
149
|
-
groupCollapsed: e,
|
|
150
|
-
groupEnd: e
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
D++;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
function Ve() {
|
|
157
|
-
{
|
|
158
|
-
if (D--, D === 0) {
|
|
159
|
-
var e = {
|
|
160
|
-
configurable: !0,
|
|
161
|
-
enumerable: !0,
|
|
162
|
-
writable: !0
|
|
163
|
-
};
|
|
164
|
-
Object.defineProperties(console, {
|
|
165
|
-
log: P({}, e, {
|
|
166
|
-
value: ne
|
|
167
|
-
}),
|
|
168
|
-
info: P({}, e, {
|
|
169
|
-
value: ae
|
|
170
|
-
}),
|
|
171
|
-
warn: P({}, e, {
|
|
172
|
-
value: oe
|
|
173
|
-
}),
|
|
174
|
-
error: P({}, e, {
|
|
175
|
-
value: ie
|
|
176
|
-
}),
|
|
177
|
-
group: P({}, e, {
|
|
178
|
-
value: ue
|
|
179
|
-
}),
|
|
180
|
-
groupCollapsed: P({}, e, {
|
|
181
|
-
value: se
|
|
182
|
-
}),
|
|
183
|
-
groupEnd: P({}, e, {
|
|
184
|
-
value: fe
|
|
185
|
-
})
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
D < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
var N = w.ReactCurrentDispatcher, B;
|
|
192
|
-
function L(e, r, t) {
|
|
193
|
-
{
|
|
194
|
-
if (B === void 0)
|
|
195
|
-
try {
|
|
196
|
-
throw Error();
|
|
197
|
-
} catch (i) {
|
|
198
|
-
var n = i.stack.trim().match(/\n( *(at )?)/);
|
|
199
|
-
B = n && n[1] || "";
|
|
200
|
-
}
|
|
201
|
-
return `
|
|
202
|
-
` + B + e;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
var J = !1, V;
|
|
206
|
-
{
|
|
207
|
-
var Ue = typeof WeakMap == "function" ? WeakMap : Map;
|
|
208
|
-
V = new Ue();
|
|
209
|
-
}
|
|
210
|
-
function ce(e, r) {
|
|
211
|
-
if (!e || J)
|
|
212
|
-
return "";
|
|
213
|
-
{
|
|
214
|
-
var t = V.get(e);
|
|
215
|
-
if (t !== void 0)
|
|
216
|
-
return t;
|
|
217
|
-
}
|
|
218
|
-
var n;
|
|
219
|
-
J = !0;
|
|
220
|
-
var i = Error.prepareStackTrace;
|
|
221
|
-
Error.prepareStackTrace = void 0;
|
|
222
|
-
var u;
|
|
223
|
-
u = N.current, N.current = null, Le();
|
|
224
|
-
try {
|
|
225
|
-
if (r) {
|
|
226
|
-
var o = function() {
|
|
227
|
-
throw Error();
|
|
228
|
-
};
|
|
229
|
-
if (Object.defineProperty(o.prototype, "props", {
|
|
230
|
-
set: function() {
|
|
231
|
-
throw Error();
|
|
232
|
-
}
|
|
233
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
234
|
-
try {
|
|
235
|
-
Reflect.construct(o, []);
|
|
236
|
-
} catch (g) {
|
|
237
|
-
n = g;
|
|
238
|
-
}
|
|
239
|
-
Reflect.construct(e, [], o);
|
|
240
|
-
} else {
|
|
241
|
-
try {
|
|
242
|
-
o.call();
|
|
243
|
-
} catch (g) {
|
|
244
|
-
n = g;
|
|
245
|
-
}
|
|
246
|
-
e.call(o.prototype);
|
|
247
|
-
}
|
|
248
|
-
} else {
|
|
249
|
-
try {
|
|
250
|
-
throw Error();
|
|
251
|
-
} catch (g) {
|
|
252
|
-
n = g;
|
|
253
|
-
}
|
|
254
|
-
e();
|
|
255
|
-
}
|
|
256
|
-
} catch (g) {
|
|
257
|
-
if (g && n && typeof g.stack == "string") {
|
|
258
|
-
for (var a = g.stack.split(`
|
|
259
|
-
`), y = n.stack.split(`
|
|
260
|
-
`), s = a.length - 1, f = y.length - 1; s >= 1 && f >= 0 && a[s] !== y[f]; )
|
|
261
|
-
f--;
|
|
262
|
-
for (; s >= 1 && f >= 0; s--, f--)
|
|
263
|
-
if (a[s] !== y[f]) {
|
|
264
|
-
if (s !== 1 || f !== 1)
|
|
265
|
-
do
|
|
266
|
-
if (s--, f--, f < 0 || a[s] !== y[f]) {
|
|
267
|
-
var R = `
|
|
268
|
-
` + a[s].replace(" at new ", " at ");
|
|
269
|
-
return e.displayName && R.includes("<anonymous>") && (R = R.replace("<anonymous>", e.displayName)), typeof e == "function" && V.set(e, R), R;
|
|
270
|
-
}
|
|
271
|
-
while (s >= 1 && f >= 0);
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
} finally {
|
|
276
|
-
J = !1, N.current = u, Ve(), Error.prepareStackTrace = i;
|
|
277
|
-
}
|
|
278
|
-
var A = e ? e.displayName || e.name : "", j = A ? L(A) : "";
|
|
279
|
-
return typeof e == "function" && V.set(e, j), j;
|
|
280
|
-
}
|
|
281
|
-
function Me(e, r, t) {
|
|
282
|
-
return ce(e, !1);
|
|
283
|
-
}
|
|
284
|
-
function Ne(e) {
|
|
285
|
-
var r = e.prototype;
|
|
286
|
-
return !!(r && r.isReactComponent);
|
|
287
|
-
}
|
|
288
|
-
function U(e, r, t) {
|
|
289
|
-
if (e == null)
|
|
290
|
-
return "";
|
|
291
|
-
if (typeof e == "function")
|
|
292
|
-
return ce(e, Ne(e));
|
|
293
|
-
if (typeof e == "string")
|
|
294
|
-
return L(e);
|
|
295
|
-
switch (e) {
|
|
296
|
-
case O:
|
|
297
|
-
return L("Suspense");
|
|
298
|
-
case b:
|
|
299
|
-
return L("SuspenseList");
|
|
300
|
-
}
|
|
301
|
-
if (typeof e == "object")
|
|
302
|
-
switch (e.$$typeof) {
|
|
303
|
-
case c:
|
|
304
|
-
return Me(e.render);
|
|
305
|
-
case h:
|
|
306
|
-
return U(e.type, r, t);
|
|
307
|
-
case S: {
|
|
308
|
-
var n = e, i = n._payload, u = n._init;
|
|
309
|
-
try {
|
|
310
|
-
return U(u(i), r, t);
|
|
311
|
-
} catch {
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return "";
|
|
316
|
-
}
|
|
317
|
-
var F = Object.prototype.hasOwnProperty, de = {}, ve = w.ReactDebugCurrentFrame;
|
|
318
|
-
function M(e) {
|
|
319
|
-
if (e) {
|
|
320
|
-
var r = e._owner, t = U(e.type, e._source, r ? r.type : null);
|
|
321
|
-
ve.setExtraStackFrame(t);
|
|
322
|
-
} else
|
|
323
|
-
ve.setExtraStackFrame(null);
|
|
324
|
-
}
|
|
325
|
-
function Be(e, r, t, n, i) {
|
|
326
|
-
{
|
|
327
|
-
var u = Function.call.bind(F);
|
|
328
|
-
for (var o in e)
|
|
329
|
-
if (u(e, o)) {
|
|
330
|
-
var a = void 0;
|
|
331
|
-
try {
|
|
332
|
-
if (typeof e[o] != "function") {
|
|
333
|
-
var y = 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`.");
|
|
334
|
-
throw y.name = "Invariant Violation", y;
|
|
335
|
-
}
|
|
336
|
-
a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
337
|
-
} catch (s) {
|
|
338
|
-
a = s;
|
|
339
|
-
}
|
|
340
|
-
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));
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
var Je = Array.isArray;
|
|
345
|
-
function q(e) {
|
|
346
|
-
return Je(e);
|
|
347
|
-
}
|
|
348
|
-
function qe(e) {
|
|
349
|
-
{
|
|
350
|
-
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
351
|
-
return t;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
function Ke(e) {
|
|
355
|
-
try {
|
|
356
|
-
return pe(e), !1;
|
|
357
|
-
} catch {
|
|
358
|
-
return !0;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
function pe(e) {
|
|
362
|
-
return "" + e;
|
|
363
|
-
}
|
|
364
|
-
function ye(e) {
|
|
365
|
-
if (Ke(e))
|
|
366
|
-
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);
|
|
367
|
-
}
|
|
368
|
-
var I = w.ReactCurrentOwner, Ge = {
|
|
369
|
-
key: !0,
|
|
370
|
-
ref: !0,
|
|
371
|
-
__self: !0,
|
|
372
|
-
__source: !0
|
|
373
|
-
}, ge, be, K;
|
|
374
|
-
K = {};
|
|
375
|
-
function ze(e) {
|
|
376
|
-
if (F.call(e, "ref")) {
|
|
377
|
-
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
378
|
-
if (r && r.isReactWarning)
|
|
379
|
-
return !1;
|
|
380
|
-
}
|
|
381
|
-
return e.ref !== void 0;
|
|
382
|
-
}
|
|
383
|
-
function Xe(e) {
|
|
384
|
-
if (F.call(e, "key")) {
|
|
385
|
-
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
386
|
-
if (r && r.isReactWarning)
|
|
387
|
-
return !1;
|
|
388
|
-
}
|
|
389
|
-
return e.key !== void 0;
|
|
390
|
-
}
|
|
391
|
-
function He(e, r) {
|
|
392
|
-
if (typeof e.ref == "string" && I.current && r && I.current.stateNode !== r) {
|
|
393
|
-
var t = _(I.current.type);
|
|
394
|
-
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', _(I.current.type), e.ref), K[t] = !0);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
function Ze(e, r) {
|
|
398
|
-
{
|
|
399
|
-
var t = function() {
|
|
400
|
-
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));
|
|
401
|
-
};
|
|
402
|
-
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
403
|
-
get: t,
|
|
404
|
-
configurable: !0
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
function Qe(e, r) {
|
|
409
|
-
{
|
|
410
|
-
var t = function() {
|
|
411
|
-
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));
|
|
412
|
-
};
|
|
413
|
-
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
414
|
-
get: t,
|
|
415
|
-
configurable: !0
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
var er = function(e, r, t, n, i, u, o) {
|
|
420
|
-
var a = {
|
|
421
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
422
|
-
$$typeof: m,
|
|
423
|
-
// Built-in properties that belong on the element
|
|
424
|
-
type: e,
|
|
425
|
-
key: r,
|
|
426
|
-
ref: t,
|
|
427
|
-
props: o,
|
|
428
|
-
// Record the component responsible for creating this element.
|
|
429
|
-
_owner: u
|
|
430
|
-
};
|
|
431
|
-
return a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
432
|
-
configurable: !1,
|
|
433
|
-
enumerable: !1,
|
|
434
|
-
writable: !0,
|
|
435
|
-
value: !1
|
|
436
|
-
}), Object.defineProperty(a, "_self", {
|
|
437
|
-
configurable: !1,
|
|
438
|
-
enumerable: !1,
|
|
439
|
-
writable: !1,
|
|
440
|
-
value: n
|
|
441
|
-
}), Object.defineProperty(a, "_source", {
|
|
442
|
-
configurable: !1,
|
|
443
|
-
enumerable: !1,
|
|
444
|
-
writable: !1,
|
|
445
|
-
value: i
|
|
446
|
-
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
447
|
-
};
|
|
448
|
-
function rr(e, r, t, n, i) {
|
|
449
|
-
{
|
|
450
|
-
var u, o = {}, a = null, y = null;
|
|
451
|
-
t !== void 0 && (ye(t), a = "" + t), Xe(r) && (ye(r.key), a = "" + r.key), ze(r) && (y = r.ref, He(r, i));
|
|
452
|
-
for (u in r)
|
|
453
|
-
F.call(r, u) && !Ge.hasOwnProperty(u) && (o[u] = r[u]);
|
|
454
|
-
if (e && e.defaultProps) {
|
|
455
|
-
var s = e.defaultProps;
|
|
456
|
-
for (u in s)
|
|
457
|
-
o[u] === void 0 && (o[u] = s[u]);
|
|
458
|
-
}
|
|
459
|
-
if (a || y) {
|
|
460
|
-
var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
461
|
-
a && Ze(o, f), y && Qe(o, f);
|
|
462
|
-
}
|
|
463
|
-
return er(e, a, y, i, n, I.current, o);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
var G = w.ReactCurrentOwner, me = w.ReactDebugCurrentFrame;
|
|
467
|
-
function x(e) {
|
|
468
|
-
if (e) {
|
|
469
|
-
var r = e._owner, t = U(e.type, e._source, r ? r.type : null);
|
|
470
|
-
me.setExtraStackFrame(t);
|
|
471
|
-
} else
|
|
472
|
-
me.setExtraStackFrame(null);
|
|
473
|
-
}
|
|
474
|
-
var z;
|
|
475
|
-
z = !1;
|
|
476
|
-
function X(e) {
|
|
477
|
-
return typeof e == "object" && e !== null && e.$$typeof === m;
|
|
478
|
-
}
|
|
479
|
-
function Re() {
|
|
480
|
-
{
|
|
481
|
-
if (G.current) {
|
|
482
|
-
var e = _(G.current.type);
|
|
483
|
-
if (e)
|
|
484
|
-
return `
|
|
485
|
-
|
|
486
|
-
Check the render method of \`` + e + "`.";
|
|
487
|
-
}
|
|
488
|
-
return "";
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
function tr(e) {
|
|
492
|
-
return "";
|
|
493
|
-
}
|
|
494
|
-
var Ee = {};
|
|
495
|
-
function nr(e) {
|
|
496
|
-
{
|
|
497
|
-
var r = Re();
|
|
498
|
-
if (!r) {
|
|
499
|
-
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
500
|
-
t && (r = `
|
|
501
|
-
|
|
502
|
-
Check the top-level render call using <` + t + ">.");
|
|
503
|
-
}
|
|
504
|
-
return r;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
function _e(e, r) {
|
|
508
|
-
{
|
|
509
|
-
if (!e._store || e._store.validated || e.key != null)
|
|
510
|
-
return;
|
|
511
|
-
e._store.validated = !0;
|
|
512
|
-
var t = nr(r);
|
|
513
|
-
if (Ee[t])
|
|
514
|
-
return;
|
|
515
|
-
Ee[t] = !0;
|
|
516
|
-
var n = "";
|
|
517
|
-
e && e._owner && e._owner !== G.current && (n = " It was passed a child from " + _(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);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
function he(e, r) {
|
|
521
|
-
{
|
|
522
|
-
if (typeof e != "object")
|
|
523
|
-
return;
|
|
524
|
-
if (q(e))
|
|
525
|
-
for (var t = 0; t < e.length; t++) {
|
|
526
|
-
var n = e[t];
|
|
527
|
-
X(n) && _e(n, r);
|
|
528
|
-
}
|
|
529
|
-
else if (X(e))
|
|
530
|
-
e._store && (e._store.validated = !0);
|
|
531
|
-
else if (e) {
|
|
532
|
-
var i = we(e);
|
|
533
|
-
if (typeof i == "function" && i !== e.entries)
|
|
534
|
-
for (var u = i.call(e), o; !(o = u.next()).done; )
|
|
535
|
-
X(o.value) && _e(o.value, r);
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
function ar(e) {
|
|
540
|
-
{
|
|
541
|
-
var r = e.type;
|
|
542
|
-
if (r == null || typeof r == "string")
|
|
543
|
-
return;
|
|
544
|
-
var t;
|
|
545
|
-
if (typeof r == "function")
|
|
546
|
-
t = r.propTypes;
|
|
547
|
-
else if (typeof r == "object" && (r.$$typeof === c || // Note: Memo only checks outer props here.
|
|
548
|
-
// Inner props are checked in the reconciler.
|
|
549
|
-
r.$$typeof === h))
|
|
550
|
-
t = r.propTypes;
|
|
551
|
-
else
|
|
552
|
-
return;
|
|
553
|
-
if (t) {
|
|
554
|
-
var n = _(r);
|
|
555
|
-
Be(t, e.props, "prop", n, e);
|
|
556
|
-
} else if (r.PropTypes !== void 0 && !z) {
|
|
557
|
-
z = !0;
|
|
558
|
-
var i = _(r);
|
|
559
|
-
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
|
|
560
|
-
}
|
|
561
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
function or(e) {
|
|
565
|
-
{
|
|
566
|
-
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
567
|
-
var n = r[t];
|
|
568
|
-
if (n !== "children" && n !== "key") {
|
|
569
|
-
x(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), x(null);
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
e.ref !== null && (x(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), x(null));
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
var Te = {};
|
|
577
|
-
function Ce(e, r, t, n, i, u) {
|
|
578
|
-
{
|
|
579
|
-
var o = $e(e);
|
|
580
|
-
if (!o) {
|
|
581
|
-
var a = "";
|
|
582
|
-
(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.");
|
|
583
|
-
var y = tr();
|
|
584
|
-
y ? a += y : a += Re();
|
|
585
|
-
var s;
|
|
586
|
-
e === null ? s = "null" : q(e) ? s = "array" : e !== void 0 && e.$$typeof === m ? (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);
|
|
587
|
-
}
|
|
588
|
-
var f = rr(e, r, t, i, u);
|
|
589
|
-
if (f == null)
|
|
590
|
-
return f;
|
|
591
|
-
if (o) {
|
|
592
|
-
var R = r.children;
|
|
593
|
-
if (R !== void 0)
|
|
594
|
-
if (n)
|
|
595
|
-
if (q(R)) {
|
|
596
|
-
for (var A = 0; A < R.length; A++)
|
|
597
|
-
he(R[A], e);
|
|
598
|
-
Object.freeze && Object.freeze(R);
|
|
599
|
-
} else
|
|
600
|
-
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.");
|
|
601
|
-
else
|
|
602
|
-
he(R, e);
|
|
603
|
-
}
|
|
604
|
-
if (F.call(r, "key")) {
|
|
605
|
-
var j = _(e), g = Object.keys(r).filter(function(cr) {
|
|
606
|
-
return cr !== "key";
|
|
607
|
-
}), H = g.length > 0 ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
608
|
-
if (!Te[j + H]) {
|
|
609
|
-
var lr = g.length > 0 ? "{" + g.join(": ..., ") + ": ...}" : "{}";
|
|
610
|
-
v(`A props object containing a "key" prop is being spread into JSX:
|
|
611
|
-
let props = %s;
|
|
612
|
-
<%s {...props} />
|
|
613
|
-
React keys must be passed directly to JSX without using spread:
|
|
614
|
-
let props = %s;
|
|
615
|
-
<%s key={someKey} {...props} />`, H, j, lr, j), Te[j + H] = !0;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
return e === p ? or(f) : ar(f), f;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
function ir(e, r, t) {
|
|
622
|
-
return Ce(e, r, t, !0);
|
|
623
|
-
}
|
|
624
|
-
function ur(e, r, t) {
|
|
625
|
-
return Ce(e, r, t, !1);
|
|
626
|
-
}
|
|
627
|
-
var sr = ur, fr = ir;
|
|
628
|
-
$.Fragment = p, $.jsx = sr, $.jsxs = fr;
|
|
629
|
-
}()), $;
|
|
630
|
-
}
|
|
631
|
-
process.env.NODE_ENV === "production" ? Q.exports = yr() : Q.exports = gr();
|
|
632
|
-
var Pe = Q.exports;
|
|
633
|
-
function br(d, m) {
|
|
634
|
-
const l = vr(d);
|
|
635
|
-
return dr(() => {
|
|
636
|
-
l.state === "blocked" && !d && (m === "proceed" ? l.proceed() : l.reset());
|
|
637
|
-
}, [l, m, d]), pr(
|
|
638
|
-
Z(
|
|
639
|
-
(p) => {
|
|
640
|
-
(typeof d == "boolean" && d === !0 || // @ts-ignore Reload case -- No location present
|
|
641
|
-
typeof d == "function" && d()) && (p.preventDefault(), p.returnValue = "Changes that you made may not be saved.");
|
|
1
|
+
import { jsx as m, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as p, useCallback as a, useState as k } from "react";
|
|
3
|
+
import { useBlocker as x, useBeforeUnload as b } from "react-router";
|
|
4
|
+
function y(o, c, n) {
|
|
5
|
+
const t = x(o);
|
|
6
|
+
return p(() => {
|
|
7
|
+
t.state === "blocked" && t.location && c && c(t.location), t.state === "blocked" && !o && (n === "proceed" ? t.proceed() : t.reset());
|
|
8
|
+
}, [t, n, o, c]), b(
|
|
9
|
+
a(
|
|
10
|
+
(e) => {
|
|
11
|
+
(typeof o == "boolean" && o === !0 || // @ts-expect-error Reload case -- No location present
|
|
12
|
+
typeof o == "function" && o()) && (e.preventDefault(), e.returnValue = "Changes that you made may not be saved.");
|
|
642
13
|
},
|
|
643
|
-
[
|
|
14
|
+
[o]
|
|
644
15
|
),
|
|
645
16
|
{ capture: !0 }
|
|
646
|
-
),
|
|
17
|
+
), t;
|
|
647
18
|
}
|
|
648
|
-
const
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
19
|
+
const C = (o, c) => {
|
|
20
|
+
const [n, t] = k(null), e = y(
|
|
21
|
+
o,
|
|
22
|
+
(r) => {
|
|
23
|
+
t(r);
|
|
24
|
+
},
|
|
25
|
+
c
|
|
26
|
+
), s = () => {
|
|
27
|
+
e.state === "blocked" && e.reset();
|
|
28
|
+
}, i = () => {
|
|
29
|
+
e.state === "blocked" && setTimeout(e.proceed, 0);
|
|
653
30
|
};
|
|
654
31
|
return {
|
|
655
|
-
isActive:
|
|
656
|
-
onConfirm:
|
|
657
|
-
resetConfirmation:
|
|
32
|
+
isActive: e.state === "blocked",
|
|
33
|
+
onConfirm: i,
|
|
34
|
+
resetConfirmation: s,
|
|
35
|
+
nextLocation: n || void 0
|
|
658
36
|
};
|
|
659
37
|
};
|
|
660
|
-
function
|
|
661
|
-
when:
|
|
662
|
-
children:
|
|
663
|
-
beforeCancel:
|
|
664
|
-
beforeConfirm:
|
|
665
|
-
defaultBehaviour:
|
|
38
|
+
function R({
|
|
39
|
+
when: o,
|
|
40
|
+
children: c,
|
|
41
|
+
beforeCancel: n,
|
|
42
|
+
beforeConfirm: t,
|
|
43
|
+
defaultBehaviour: e = "reset"
|
|
666
44
|
}) {
|
|
667
|
-
const { isActive:
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
),
|
|
671
|
-
|
|
672
|
-
}, [
|
|
673
|
-
|
|
674
|
-
}, [
|
|
675
|
-
return
|
|
45
|
+
const { isActive: s, onConfirm: i, resetConfirmation: r, nextLocation: u } = C(
|
|
46
|
+
o,
|
|
47
|
+
e
|
|
48
|
+
), f = a(async () => {
|
|
49
|
+
t && await t(), i();
|
|
50
|
+
}, [t, i]), l = a(async () => {
|
|
51
|
+
n && await n(), r();
|
|
52
|
+
}, [n, r]);
|
|
53
|
+
return s ? /* @__PURE__ */ m(d, { children: c({
|
|
676
54
|
isActive: !0,
|
|
677
|
-
onConfirm:
|
|
678
|
-
onCancel:
|
|
55
|
+
onConfirm: f,
|
|
56
|
+
onCancel: l,
|
|
57
|
+
nextLocation: u || void 0
|
|
679
58
|
}) }) : null;
|
|
680
59
|
}
|
|
681
60
|
export {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
61
|
+
R as default,
|
|
62
|
+
C as useConfirm,
|
|
63
|
+
y as usePrompt
|
|
685
64
|
};
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var te;function Ae(){if(te)return I;te=1;var d=_,m=Symbol.for("react.element"),c=Symbol.for("react.fragment"),p=Object.prototype.hasOwnProperty,O=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,x={key:!0,ref:!0,__self:!0,__source:!0};function P(h,l,S){var g,C={},j=null,V=null;S!==void 0&&(j=""+S),l.key!==void 0&&(j=""+l.key),l.ref!==void 0&&(V=l.ref);for(g in l)p.call(l,g)&&!x.hasOwnProperty(g)&&(C[g]=l[g]);if(h&&h.defaultProps)for(g in l=h.defaultProps,l)C[g]===void 0&&(C[g]=l[g]);return{$$typeof:m,type:h,key:j,ref:V,props:C,_owner:O.current}}return I.Fragment=c,I.jsx=P,I.jsxs=P,I}var W={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ne;function De(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&function(){var d=_,m=Symbol.for("react.element"),c=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),h=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),ue=Symbol.iterator,Ie="@@iterator";function We(e){if(e===null||typeof e!="object")return null;var r=ue&&e[ue]||e[Ie];return typeof r=="function"?r:null}var A=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];Ye("error",e,t)}}function Ye(e,r,t){{var n=A.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 Le=!1,Me=!1,Ve=!1,Ue=!1,$e=!1,se;se=Symbol.for("react.module.reference");function Ne(e){return!!(typeof e=="string"||typeof e=="function"||e===p||e===x||$e||e===O||e===S||e===g||Ue||e===V||Le||Me||Ve||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===C||e.$$typeof===P||e.$$typeof===h||e.$$typeof===l||e.$$typeof===se||e.getModuleId!==void 0))}function Be(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function fe(e){return e.displayName||"Context"}function T(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;switch(e){case p:return"Fragment";case c:return"Portal";case x:return"Profiler";case O:return"StrictMode";case S:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case h:var r=e;return fe(r)+".Consumer";case P:var t=e;return fe(t._context)+".Provider";case l:return Be(e,e.render,"ForwardRef");case C:var n=e.displayName||null;return n!==null?n:T(e.type)||"Memo";case j:{var i=e,u=i._payload,o=i._init;try{return T(o(u))}catch{return null}}}return null}var k=Object.assign,Y=0,ce,le,de,ve,pe,ye,be;function ge(){}ge.__reactDisabledLog=!0;function Je(){{if(Y===0){ce=console.log,le=console.info,de=console.warn,ve=console.error,pe=console.group,ye=console.groupCollapsed,be=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ge,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Y++}}function Ke(){{if(Y--,Y===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},e,{value:ce}),info:k({},e,{value:le}),warn:k({},e,{value:de}),error:k({},e,{value:ve}),group:k({},e,{value:pe}),groupCollapsed:k({},e,{value:ye}),groupEnd:k({},e,{value:be})})}Y<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=A.ReactCurrentDispatcher,G;function U(e,r,t){{if(G===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);G=n&&n[1]||""}return`
|
|
18
|
-
`+G+e}}var q=!1,$;{var Ge=typeof WeakMap=="function"?WeakMap:Map;$=new Ge}function me(e,r){if(!e||q)return"";{var t=$.get(e);if(t!==void 0)return t}var n;q=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=K.current,K.current=null,Je();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(b){n=b}Reflect.construct(e,[],o)}else{try{o.call()}catch(b){n=b}e.call(o.prototype)}}else{try{throw Error()}catch(b){n=b}e()}}catch(b){if(b&&n&&typeof b.stack=="string"){for(var a=b.stack.split(`
|
|
19
|
-
`),y=n.stack.split(`
|
|
20
|
-
`),s=a.length-1,f=y.length-1;s>=1&&f>=0&&a[s]!==y[f];)f--;for(;s>=1&&f>=0;s--,f--)if(a[s]!==y[f]){if(s!==1||f!==1)do if(s--,f--,f<0||a[s]!==y[f]){var R=`
|
|
21
|
-
`+a[s].replace(" at new "," at ");return e.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",e.displayName)),typeof e=="function"&&$.set(e,R),R}while(s>=1&&f>=0);break}}}finally{q=!1,K.current=u,Ke(),Error.prepareStackTrace=i}var F=e?e.displayName||e.name:"",w=F?U(F):"";return typeof e=="function"&&$.set(e,w),w}function qe(e,r,t){return me(e,!1)}function ze(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function N(e,r,t){if(e==null)return"";if(typeof e=="function")return me(e,ze(e));if(typeof e=="string")return U(e);switch(e){case S:return U("Suspense");case g:return U("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return qe(e.render);case C:return N(e.type,r,t);case j:{var n=e,i=n._payload,u=n._init;try{return N(u(i),r,t)}catch{}}}return""}var L=Object.prototype.hasOwnProperty,Re={},Ee=A.ReactDebugCurrentFrame;function B(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);Ee.setExtraStackFrame(t)}else Ee.setExtraStackFrame(null)}function Xe(e,r,t,n,i){{var u=Function.call.bind(L);for(var o in e)if(u(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var y=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 y.name="Invariant Violation",y}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)&&(B(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),B(null)),a instanceof Error&&!(a.message in Re)&&(Re[a.message]=!0,B(i),v("Failed %s type: %s",t,a.message),B(null))}}}var He=Array.isArray;function z(e){return He(e)}function Ze(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Qe(e){try{return _e(e),!1}catch{return!0}}function _e(e){return""+e}function he(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.",Ze(e)),_e(e)}var M=A.ReactCurrentOwner,er={key:!0,ref:!0,__self:!0,__source:!0},Te,Ce,X;X={};function rr(e){if(L.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function tr(e){if(L.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function nr(e,r){if(typeof e.ref=="string"&&M.current&&r&&M.current.stateNode!==r){var t=T(M.current.type);X[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',T(M.current.type),e.ref),X[t]=!0)}}function ar(e,r){{var t=function(){Te||(Te=!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 or(e,r){{var t=function(){Ce||(Ce=!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 ir=function(e,r,t,n,i,u,o){var a={$$typeof:m,type:e,key:r,ref:t,props:o,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{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 ur(e,r,t,n,i){{var u,o={},a=null,y=null;t!==void 0&&(he(t),a=""+t),tr(r)&&(he(r.key),a=""+r.key),rr(r)&&(y=r.ref,nr(r,i));for(u in r)L.call(r,u)&&!er.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||y){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ar(o,f),y&&or(o,f)}return ir(e,a,y,i,n,M.current,o)}}var H=A.ReactCurrentOwner,Oe=A.ReactDebugCurrentFrame;function D(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}var Z;Z=!1;function Q(e){return typeof e=="object"&&e!==null&&e.$$typeof===m}function Pe(){{if(H.current){var e=T(H.current.type);if(e)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function sr(e){return""}var Se={};function fr(e){{var r=Pe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
|
-
|
|
25
|
-
Check the top-level render call using <`+t+">.")}return r}}function je(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=fr(r);if(Se[t])return;Se[t]=!0;var n="";e&&e._owner&&e._owner!==H.current&&(n=" It was passed a child from "+T(e._owner.type)+"."),D(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),D(null)}}function ke(e,r){{if(typeof e!="object")return;if(z(e))for(var t=0;t<e.length;t++){var n=e[t];Q(n)&&je(n,r)}else if(Q(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;)Q(o.value)&&je(o.value,r)}}}function cr(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===l||r.$$typeof===C))t=r.propTypes;else return;if(t){var n=T(r);Xe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!Z){Z=!0;var i=T(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 lr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){D(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),D(null);break}}e.ref!==null&&(D(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}var we={};function xe(e,r,t,n,i,u){{var o=Ne(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 y=sr();y?a+=y:a+=Pe();var s;e===null?s="null":z(e)?s="array":e!==void 0&&e.$$typeof===m?(s="<"+(T(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=ur(e,r,t,i,u);if(f==null)return f;if(o){var R=r.children;if(R!==void 0)if(n)if(z(R)){for(var F=0;F<R.length;F++)ke(R[F],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 ke(R,e)}if(L.call(r,"key")){var w=T(e),b=Object.keys(r).filter(function(gr){return gr!=="key"}),ee=b.length>0?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}";if(!we[w+ee]){var br=b.length>0?"{"+b.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
-
let props = %s;
|
|
27
|
-
<%s {...props} />
|
|
28
|
-
React keys must be passed directly to JSX without using spread:
|
|
29
|
-
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,ee,w,br,w),we[w+ee]=!0}}return e===p?lr(f):cr(f),f}}function dr(e,r,t){return xe(e,r,t,!0)}function vr(e,r,t){return xe(e,r,t,!1)}var pr=vr,yr=dr;W.Fragment=p,W.jsx=pr,W.jsxs=yr}()),W}process.env.NODE_ENV==="production"?J.exports=Ae():J.exports=De();var ae=J.exports;function oe(d,m){const c=re.useBlocker(d);return _.useEffect(()=>{c.state==="blocked"&&!d&&(m==="proceed"?c.proceed():c.reset())},[c,m,d]),re.useBeforeUnload(_.useCallback(p=>{(typeof d=="boolean"&&d===!0||typeof d=="function"&&d())&&(p.preventDefault(),p.returnValue="Changes that you made may not be saved.")},[d]),{capture:!0}),c}const ie=(d,m)=>{const c=oe(d,m),p=()=>{c.state==="blocked"&&c.reset()},O=()=>{c.state==="blocked"&&setTimeout(c.proceed,0)};return{isActive:c.state==="blocked",onConfirm:O,resetConfirmation:p}};function Fe({when:d,children:m,beforeCancel:c,beforeConfirm:p,defaultBehaviour:O="reset"}){const{isActive:x,onConfirm:P,resetConfirmation:h}=ie(d,O),l=_.useCallback(async()=>{p&&await p(),P()},[p,P]),S=_.useCallback(async()=>{c&&await c(),h()},[c,h]);return x?ae.jsx(ae.Fragment,{children:m({isActive:!0,onConfirm:l,onCancel:S})}):null}E.default=Fe,E.useConfirm=ie,E.usePrompt=oe,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(o,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react/jsx-runtime"),require("react"),require("react-router")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-router"],c):(o=typeof globalThis<"u"?globalThis:o||self,c(o.ReactRouterPrompt={},o["react/jsx-runtime"],o.react,o.reactRouter))})(this,function(o,c,s,d){"use strict";function l(t,r,i){const e=d.useBlocker(t);return s.useEffect(()=>{e.state==="blocked"&&e.location&&r&&r(e.location),e.state==="blocked"&&!t&&(i==="proceed"?e.proceed():e.reset())},[e,i,t,r]),d.useBeforeUnload(s.useCallback(n=>{(typeof t=="boolean"&&t===!0||typeof t=="function"&&t())&&(n.preventDefault(),n.returnValue="Changes that you made may not be saved.")},[t]),{capture:!0}),e}const m=(t,r)=>{const[i,e]=s.useState(null),n=l(t,a=>{e(a)},r),f=()=>{n.state==="blocked"&&n.reset()},u=()=>{n.state==="blocked"&&setTimeout(n.proceed,0)};return{isActive:n.state==="blocked",onConfirm:u,resetConfirmation:f,nextLocation:i||void 0}};function p({when:t,children:r,beforeCancel:i,beforeConfirm:e,defaultBehaviour:n="reset"}){const{isActive:f,onConfirm:u,resetConfirmation:a,nextLocation:k}=m(t,n),y=s.useCallback(async()=>{e&&await e(),u()},[e,u]),C=s.useCallback(async()=>{i&&await i(),a()},[i,a]);return f?c.jsx(c.Fragment,{children:r({isActive:!0,onConfirm:y,onCancel:C,nextLocation:k||void 0})}):null}o.default=p,o.useConfirm=m,o.usePrompt=l,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.8.0",
|
|
3
3
|
"name": "@qubhq/react-router-prompt",
|
|
4
4
|
"description": "React Router Navigation Prompt for v6",
|
|
5
5
|
"type": "module",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
14
|
"import": "./dist/react-router-prompt.js",
|
|
15
|
-
"require": "./dist/react-router-prompt.umd.cjs"
|
|
16
|
-
"types": "./dist/index.d.ts"
|
|
15
|
+
"require": "./dist/react-router-prompt.umd.cjs"
|
|
17
16
|
}
|
|
18
17
|
},
|
|
19
18
|
"author": "Shyam Gupta (shyamm@outlook.com)",
|
|
@@ -30,21 +29,14 @@
|
|
|
30
29
|
"react",
|
|
31
30
|
"router"
|
|
32
31
|
],
|
|
33
|
-
"husky": {
|
|
34
|
-
"hooks": {
|
|
35
|
-
"pre-commit": "pnpm lint"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
32
|
"devDependencies": {
|
|
39
33
|
"@size-limit/preset-small-lib": "^11.0.2",
|
|
40
|
-
"@types/react": "^
|
|
41
|
-
"@types/react-dom": "^
|
|
34
|
+
"@types/react": "^19.0.2",
|
|
35
|
+
"@types/react-dom": "^19.0.2",
|
|
42
36
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
43
37
|
"@typescript-eslint/parser": "^8.0.0",
|
|
44
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
38
|
+
"@vitejs/plugin-react-swc": "^3.7.2",
|
|
45
39
|
"eslint": "^8.56.0",
|
|
46
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
47
|
-
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
48
40
|
"eslint-config-prettier": "^9.1.0",
|
|
49
41
|
"eslint-plugin-import": "^2.29.1",
|
|
50
42
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
@@ -54,29 +46,29 @@
|
|
|
54
46
|
"history": "^5.3.0",
|
|
55
47
|
"husky": "^9.0.11",
|
|
56
48
|
"path": "^0.12.7",
|
|
57
|
-
"prettier": "^3.2
|
|
58
|
-
"react": "^
|
|
59
|
-
"react-dom": "^
|
|
60
|
-
"react-router
|
|
49
|
+
"prettier": "^3.4.2",
|
|
50
|
+
"react": "^19.0.0",
|
|
51
|
+
"react-dom": "^19.0.0",
|
|
52
|
+
"react-router": "^7.1.1",
|
|
61
53
|
"size-limit": "^11.0.2",
|
|
62
54
|
"typescript": "^5.3.3",
|
|
63
|
-
"vite": "^
|
|
64
|
-
"vite-plugin-dts": "^4.
|
|
65
|
-
"vite-tsconfig-paths": "^5.
|
|
55
|
+
"vite": "^6.0.5",
|
|
56
|
+
"vite-plugin-dts": "^4.4.0",
|
|
57
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
66
58
|
},
|
|
67
59
|
"peerDependencies": {
|
|
68
60
|
"react": ">=16.8",
|
|
69
61
|
"react-dom": ">=16.8",
|
|
70
|
-
"react-router
|
|
62
|
+
"react-router": ">=7"
|
|
71
63
|
},
|
|
72
64
|
"size-limit": [
|
|
73
65
|
{
|
|
74
66
|
"path": "dist/react-router-prompt.js",
|
|
75
|
-
"limit": "
|
|
67
|
+
"limit": "600 B"
|
|
76
68
|
},
|
|
77
69
|
{
|
|
78
70
|
"path": "dist/react-router-prompt.umd.cjs",
|
|
79
|
-
"limit": "
|
|
71
|
+
"limit": "800 B"
|
|
80
72
|
}
|
|
81
73
|
],
|
|
82
74
|
"scripts": {
|