stone-kit 0.0.1031 → 0.0.1033

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.
Files changed (91) hide show
  1. package/dist/App.js +4 -4
  2. package/dist/Option-D-8xnCui.js +94 -0
  3. package/dist/Router.js +1 -1
  4. package/dist/chunk-4WY6JWTD-BeveLKf_.js +1582 -0
  5. package/dist/components/Button/ui/Button.js +1 -1
  6. package/dist/components/CheckBoxNew/CheckBoxNew.js +1 -1
  7. package/dist/components/CheckboxSelect/ui/CheckboxSelect.d.ts +4 -0
  8. package/dist/components/CheckboxSelect/ui/CheckboxSelect.js +20 -19
  9. package/dist/components/CommercialLotCard/CommercialLotCard.d.ts +1 -1
  10. package/dist/components/CommercialLotCard/CommercialLotCard.js +62 -41
  11. package/dist/components/CommercialLotCard/components/Price/Price.js +1 -1
  12. package/dist/components/CommercialLotCard/components/Snippets/Snippets.js +1 -1
  13. package/dist/components/CommercialLotCard/types/CommercialLotCard.types.d.ts +2 -0
  14. package/dist/components/DestinationTab/ui/DestinationTab.js +1 -1
  15. package/dist/components/FieldInput/ui/FieldInput.d.ts +1 -1
  16. package/dist/components/FieldInput/ui/FieldInput.js +21 -12
  17. package/dist/components/FieldInput/ui/FieldInput.types.d.ts +1 -0
  18. package/dist/components/FilterWithSave/hooks/useFilterWithSave.d.ts +1 -1
  19. package/dist/components/FilterWithSave/ui/FilterWithSave.js +2 -7
  20. package/dist/components/Flex/ui/Flex.js +1 -1
  21. package/dist/components/FormModal/ui/ModalForm.d.ts +10 -1
  22. package/dist/components/FormModal/ui/ModalForm.js +803 -719
  23. package/dist/components/GroupedInput/ui/GroupedInputs.js +1 -1
  24. package/dist/components/Input/ui/Input.js +1 -22
  25. package/dist/components/Logo/ui/Logo.js +1 -1
  26. package/dist/components/LotCard/hooks/useLotCard.js +2 -2
  27. package/dist/components/LotCard/ui/LotCard.d.ts +1 -1
  28. package/dist/components/LotCard/ui/LotCard.js +117 -97
  29. package/dist/components/LotCard/ui/LotCard.types.d.ts +2 -0
  30. package/dist/components/LotCardSkeleton/ui/LotCardSkeleton.js +1 -1
  31. package/dist/components/MetroLabel/ui/MetroLabel.js +1 -1
  32. package/dist/components/MetroTag/ui/MetroTag.js +1 -1
  33. package/dist/components/NewIcon/ui/NewIcon.js +119 -114
  34. package/dist/components/RoundButton/ui/RoundButton.js +1 -1
  35. package/dist/components/RoundButton/ui/RoundButton.types.d.ts +1 -0
  36. package/dist/components/Select/ui/Category.js +2 -2
  37. package/dist/components/Select/ui/Option.d.ts +2 -1
  38. package/dist/components/Select/ui/Option.js +2 -2
  39. package/dist/components/Select/ui/Select.d.ts +1 -1
  40. package/dist/components/Select/ui/Select.js +88 -82
  41. package/dist/components/Select/ui/Select.types.d.ts +5 -0
  42. package/dist/components/SliderNavigation/ui/SliderNavigation.js +1 -1
  43. package/dist/components/SortSelect/hooks/useSortSelect.js +2 -2
  44. package/dist/components/SortSelect/ui/SortSelect.js +2 -2
  45. package/dist/components/SummarySelect/ui/SummarySelect.d.ts +1 -0
  46. package/dist/components/SummarySelect/ui/SummarySelect.js +60 -57
  47. package/dist/components/Switcher/ui/Switcher.js +1 -1
  48. package/dist/components/TabSelect/ui/TabSelect.js +1 -1
  49. package/dist/components/TabSwitcher/ui/TabSwitcher.js +91 -90
  50. package/dist/components/TabSwitcher/ui/TabSwitcher.types.d.ts +1 -0
  51. package/dist/components/Tag/ui/Tag.js +1 -1
  52. package/dist/components/Text/ui/Text.js +1 -1
  53. package/dist/components/TextArea/TextArea.js +1 -1
  54. package/dist/components/mobileButton/ui/MobileButton.js +1 -1
  55. package/dist/{index-3E04UaC2.js → index-BJwl9stn.js} +785 -784
  56. package/dist/{index-B2JRaoNz.js → index-YnD2EP-S.js} +0 -5
  57. package/dist/layout/components/Header/Header.js +1 -1
  58. package/dist/layout/components/Menu.js +107 -4
  59. package/dist/pages/FormsPage/FormsPage.js +1 -0
  60. package/dist/pages/TabsPage/TabsPage.js +56 -42
  61. package/dist/stone-kit.css +1 -1
  62. package/dist/stories/entities/CommercialLotCard/CommercialLotCard.stories.js +1 -1
  63. package/dist/stories/shared/ui/Button/Button.stories.js +1 -1
  64. package/dist/stories/shared/ui/CheckBox/CheckBox.stories.js +1 -1
  65. package/dist/stories/shared/ui/CheckBox/CheckBoxNew.stories.js +1 -1
  66. package/dist/stories/shared/ui/CheckboxSelect/CheckboxSelect.stories.js +1 -1
  67. package/dist/stories/shared/ui/DestinationTab/DestinationTab.stories.js +1 -1
  68. package/dist/stories/shared/ui/FieldInput/FieldInput.stories.js +1 -1
  69. package/dist/stories/shared/ui/FilterWithSave/FilterWithSave.stories.js +1 -1
  70. package/dist/stories/shared/ui/FormModal/FormModal.stories.js +1 -1
  71. package/dist/stories/shared/ui/GroupedInput/GroupedInput.stories.js +1 -1
  72. package/dist/stories/shared/ui/Logo/Logo.stories.js +1 -1
  73. package/dist/stories/shared/ui/MobileButton/MobileButton.stories.js +1 -1
  74. package/dist/stories/shared/ui/Modal/Modal.stories.js +1 -1
  75. package/dist/stories/shared/ui/ModalSuccess/ModalSuccess.stories.js +1 -1
  76. package/dist/stories/shared/ui/RoundButton/RoundButton.stories.js +1 -1
  77. package/dist/stories/shared/ui/Select/Select.stories.js +1 -1
  78. package/dist/stories/shared/ui/SliderNavigation/SliderNavigation.stories.js +1 -1
  79. package/dist/stories/shared/ui/SortSelect/SortSelect.stories.js +1 -1
  80. package/dist/stories/shared/ui/SummarySelect/SummarySelect.stories.js +1 -1
  81. package/dist/stories/shared/ui/Switcher/Switcher.stories.js +1 -1
  82. package/dist/stories/shared/ui/TabSelect/TabSelect.stories.js +1 -1
  83. package/dist/stories/shared/ui/TabSwitcher/TabSwitcher.stories.js +1 -1
  84. package/dist/stories/shared/ui/ZoomControls/ZoomControls.stories.js +1 -1
  85. package/dist/useLotCard-I7_rgnqj.js +187 -0
  86. package/dist/{useSortSelect-B8HOGdOt.js → useSortSelect-IeonkD5d.js} +1 -1
  87. package/package.json +5 -5
  88. package/dist/Menu-CdJTzN7T.js +0 -494
  89. package/dist/Option-rFBMQAPk.js +0 -87
  90. package/dist/index-CBdtKu-u.js +0 -891
  91. package/dist/useLotCard-DG9doKCX.js +0 -186
@@ -1,891 +0,0 @@
1
- import * as s from "react";
2
- /**
3
- * @remix-run/router v1.23.0
4
- *
5
- * Copyright (c) Remix Software Inc.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE.md file in the root directory of this source tree.
9
- *
10
- * @license MIT
11
- */
12
- function D() {
13
- return D = Object.assign ? Object.assign.bind() : function(e) {
14
- for (var t = 1; t < arguments.length; t++) {
15
- var n = arguments[t];
16
- for (var r in n)
17
- Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
18
- }
19
- return e;
20
- }, D.apply(this, arguments);
21
- }
22
- var R;
23
- (function(e) {
24
- e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE";
25
- })(R || (R = {}));
26
- const A = "popstate";
27
- function Ke(e) {
28
- e === void 0 && (e = {});
29
- function t(r, a) {
30
- let {
31
- pathname: o,
32
- search: i,
33
- hash: u
34
- } = r.location;
35
- return j(
36
- "",
37
- {
38
- pathname: o,
39
- search: i,
40
- hash: u
41
- },
42
- // state defaults to `null` because `window.history.state` does
43
- a.state && a.state.usr || null,
44
- a.state && a.state.key || "default"
45
- );
46
- }
47
- function n(r, a) {
48
- return typeof a == "string" ? a : K(a);
49
- }
50
- return ue(t, n, null, e);
51
- }
52
- function f(e, t) {
53
- if (e === !1 || e === null || typeof e > "u")
54
- throw new Error(t);
55
- }
56
- function b(e, t) {
57
- if (!e) {
58
- typeof console < "u" && console.warn(t);
59
- try {
60
- throw new Error(t);
61
- } catch {
62
- }
63
- }
64
- }
65
- function se() {
66
- return Math.random().toString(36).substr(2, 8);
67
- }
68
- function z(e, t) {
69
- return {
70
- usr: e.state,
71
- key: e.key,
72
- idx: t
73
- };
74
- }
75
- function j(e, t, n, r) {
76
- return n === void 0 && (n = null), D({
77
- pathname: typeof e == "string" ? e : e.pathname,
78
- search: "",
79
- hash: ""
80
- }, typeof t == "string" ? O(t) : t, {
81
- state: n,
82
- // TODO: This could be cleaned up. push/replace should probably just take
83
- // full Locations now and avoid the need to run through this flow at all
84
- // But that's a pretty big refactor to the current test suite so going to
85
- // keep as is for the time being and just let any incoming keys take precedence
86
- key: t && t.key || r || se()
87
- });
88
- }
89
- function K(e) {
90
- let {
91
- pathname: t = "/",
92
- search: n = "",
93
- hash: r = ""
94
- } = e;
95
- return n && n !== "?" && (t += n.charAt(0) === "?" ? n : "?" + n), r && r !== "#" && (t += r.charAt(0) === "#" ? r : "#" + r), t;
96
- }
97
- function O(e) {
98
- let t = {};
99
- if (e) {
100
- let n = e.indexOf("#");
101
- n >= 0 && (t.hash = e.substr(n), e = e.substr(0, n));
102
- let r = e.indexOf("?");
103
- r >= 0 && (t.search = e.substr(r), e = e.substr(0, r)), e && (t.pathname = e);
104
- }
105
- return t;
106
- }
107
- function ue(e, t, n, r) {
108
- r === void 0 && (r = {});
109
- let {
110
- window: a = document.defaultView,
111
- v5Compat: o = !1
112
- } = r, i = a.history, u = R.Pop, l = null, d = h();
113
- d == null && (d = 0, i.replaceState(D({}, i.state, {
114
- idx: d
115
- }), ""));
116
- function h() {
117
- return (i.state || {
118
- idx: null
119
- }).idx;
120
- }
121
- function c() {
122
- u = R.Pop;
123
- let p = h(), E = p == null ? null : p - d;
124
- d = p, l && l({
125
- action: u,
126
- location: g.location,
127
- delta: E
128
- });
129
- }
130
- function m(p, E) {
131
- u = R.Push;
132
- let v = j(g.location, p, E);
133
- d = h() + 1;
134
- let x = z(v, d), L = g.createHref(v);
135
- try {
136
- i.pushState(x, "", L);
137
- } catch (I) {
138
- if (I instanceof DOMException && I.name === "DataCloneError")
139
- throw I;
140
- a.location.assign(L);
141
- }
142
- o && l && l({
143
- action: u,
144
- location: g.location,
145
- delta: 1
146
- });
147
- }
148
- function N(p, E) {
149
- u = R.Replace;
150
- let v = j(g.location, p, E);
151
- d = h();
152
- let x = z(v, d), L = g.createHref(v);
153
- i.replaceState(x, "", L), o && l && l({
154
- action: u,
155
- location: g.location,
156
- delta: 0
157
- });
158
- }
159
- function y(p) {
160
- let E = a.location.origin !== "null" ? a.location.origin : a.location.href, v = typeof p == "string" ? p : K(p);
161
- return v = v.replace(/ $/, "%20"), f(E, "No window.location.(origin|href) available to create URL for href: " + v), new URL(v, E);
162
- }
163
- let g = {
164
- get action() {
165
- return u;
166
- },
167
- get location() {
168
- return e(a, i);
169
- },
170
- listen(p) {
171
- if (l)
172
- throw new Error("A history only accepts one active listener");
173
- return a.addEventListener(A, c), l = p, () => {
174
- a.removeEventListener(A, c), l = null;
175
- };
176
- },
177
- createHref(p) {
178
- return t(a, p);
179
- },
180
- createURL: y,
181
- encodeLocation(p) {
182
- let E = y(p);
183
- return {
184
- pathname: E.pathname,
185
- search: E.search,
186
- hash: E.hash
187
- };
188
- },
189
- push: m,
190
- replace: N,
191
- go(p) {
192
- return i.go(p);
193
- }
194
- };
195
- return g;
196
- }
197
- var J;
198
- (function(e) {
199
- e.data = "data", e.deferred = "deferred", e.redirect = "redirect", e.error = "error";
200
- })(J || (J = {}));
201
- function ce(e, t, n) {
202
- return n === void 0 && (n = "/"), de(e, t, n);
203
- }
204
- function de(e, t, n, r) {
205
- let a = typeof t == "string" ? O(t) : t, o = Z(a.pathname || "/", n);
206
- if (o == null)
207
- return null;
208
- let i = X(e);
209
- he(i);
210
- let u = null;
211
- for (let l = 0; u == null && l < i.length; ++l) {
212
- let d = be(o);
213
- u = xe(i[l], d);
214
- }
215
- return u;
216
- }
217
- function X(e, t, n, r) {
218
- t === void 0 && (t = []), n === void 0 && (n = []), r === void 0 && (r = "");
219
- let a = (o, i, u) => {
220
- let l = {
221
- relativePath: u === void 0 ? o.path || "" : u,
222
- caseSensitive: o.caseSensitive === !0,
223
- childrenIndex: i,
224
- route: o
225
- };
226
- l.relativePath.startsWith("/") && (f(l.relativePath.startsWith(r), 'Absolute route path "' + l.relativePath + '" nested under path ' + ('"' + r + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes."), l.relativePath = l.relativePath.slice(r.length));
227
- let d = C([r, l.relativePath]), h = n.concat(l);
228
- o.children && o.children.length > 0 && (f(
229
- // Our types know better, but runtime JS may not!
230
- // @ts-expect-error
231
- o.index !== !0,
232
- "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + d + '".')
233
- ), X(o.children, t, h, d)), !(o.path == null && !o.index) && t.push({
234
- path: d,
235
- score: ye(d, o.index),
236
- routesMeta: h
237
- });
238
- };
239
- return e.forEach((o, i) => {
240
- var u;
241
- if (o.path === "" || !((u = o.path) != null && u.includes("?")))
242
- a(o, i);
243
- else
244
- for (let l of Q(o.path))
245
- a(o, i, l);
246
- }), t;
247
- }
248
- function Q(e) {
249
- let t = e.split("/");
250
- if (t.length === 0) return [];
251
- let [n, ...r] = t, a = n.endsWith("?"), o = n.replace(/\?$/, "");
252
- if (r.length === 0)
253
- return a ? [o, ""] : [o];
254
- let i = Q(r.join("/")), u = [];
255
- return u.push(...i.map((l) => l === "" ? o : [o, l].join("/"))), a && u.push(...i), u.map((l) => e.startsWith("/") && l === "" ? "/" : l);
256
- }
257
- function he(e) {
258
- e.sort((t, n) => t.score !== n.score ? n.score - t.score : Ne(t.routesMeta.map((r) => r.childrenIndex), n.routesMeta.map((r) => r.childrenIndex)));
259
- }
260
- const pe = /^:[\w-]+$/, fe = 3, me = 2, ve = 1, ge = 10, Ee = -2, Y = (e) => e === "*";
261
- function ye(e, t) {
262
- let n = e.split("/"), r = n.length;
263
- return n.some(Y) && (r += Ee), t && (r += me), n.filter((a) => !Y(a)).reduce((a, o) => a + (pe.test(o) ? fe : o === "" ? ve : ge), r);
264
- }
265
- function Ne(e, t) {
266
- return e.length === t.length && e.slice(0, -1).every((r, a) => r === t[a]) ? (
267
- // If two routes are siblings, we should try to match the earlier sibling
268
- // first. This allows people to have fine-grained control over the matching
269
- // behavior by simply putting routes with identical paths in the order they
270
- // want them tried.
271
- e[e.length - 1] - t[t.length - 1]
272
- ) : (
273
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
274
- // so they sort equally.
275
- 0
276
- );
277
- }
278
- function xe(e, t, n) {
279
- let {
280
- routesMeta: r
281
- } = e, a = {}, o = "/", i = [];
282
- for (let u = 0; u < r.length; ++u) {
283
- let l = r[u], d = u === r.length - 1, h = o === "/" ? t : t.slice(o.length) || "/", c = Re({
284
- path: l.relativePath,
285
- caseSensitive: l.caseSensitive,
286
- end: d
287
- }, h), m = l.route;
288
- if (!c)
289
- return null;
290
- Object.assign(a, c.params), i.push({
291
- // TODO: Can this as be avoided?
292
- params: a,
293
- pathname: C([o, c.pathname]),
294
- pathnameBase: De(C([o, c.pathnameBase])),
295
- route: m
296
- }), c.pathnameBase !== "/" && (o = C([o, c.pathnameBase]));
297
- }
298
- return i;
299
- }
300
- function Re(e, t) {
301
- typeof e == "string" && (e = {
302
- path: e,
303
- caseSensitive: !1,
304
- end: !0
305
- });
306
- let [n, r] = Ce(e.path, e.caseSensitive, e.end), a = t.match(n);
307
- if (!a) return null;
308
- let o = a[0], i = o.replace(/(.)\/+$/, "$1"), u = a.slice(1);
309
- return {
310
- params: r.reduce((d, h, c) => {
311
- let {
312
- paramName: m,
313
- isOptional: N
314
- } = h;
315
- if (m === "*") {
316
- let g = u[c] || "";
317
- i = o.slice(0, o.length - g.length).replace(/(.)\/+$/, "$1");
318
- }
319
- const y = u[c];
320
- return N && !y ? d[m] = void 0 : d[m] = (y || "").replace(/%2F/g, "/"), d;
321
- }, {}),
322
- pathname: o,
323
- pathnameBase: i,
324
- pattern: e
325
- };
326
- }
327
- function Ce(e, t, n) {
328
- t === void 0 && (t = !1), n === void 0 && (n = !0), b(e === "*" || !e.endsWith("*") || e.endsWith("/*"), 'Route path "' + e + '" will be treated as if it were ' + ('"' + e.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + e.replace(/\*$/, "/*") + '".'));
329
- let r = [], a = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (i, u, l) => (r.push({
330
- paramName: u,
331
- isOptional: l != null
332
- }), l ? "/?([^\\/]+)?" : "/([^\\/]+)"));
333
- return e.endsWith("*") ? (r.push({
334
- paramName: "*"
335
- }), a += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : n ? a += "\\/*$" : e !== "" && e !== "/" && (a += "(?:(?=\\/|$))"), [new RegExp(a, t ? void 0 : "i"), r];
336
- }
337
- function be(e) {
338
- try {
339
- return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
340
- } catch (t) {
341
- return b(!1, 'The URL path "' + e + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + t + ").")), e;
342
- }
343
- }
344
- function Z(e, t) {
345
- if (t === "/") return e;
346
- if (!e.toLowerCase().startsWith(t.toLowerCase()))
347
- return null;
348
- let n = t.endsWith("/") ? t.length - 1 : t.length, r = e.charAt(n);
349
- return r && r !== "/" ? null : e.slice(n) || "/";
350
- }
351
- function we(e, t) {
352
- t === void 0 && (t = "/");
353
- let {
354
- pathname: n,
355
- search: r = "",
356
- hash: a = ""
357
- } = typeof e == "string" ? O(e) : e;
358
- return {
359
- pathname: n ? n.startsWith("/") ? n : Pe(n, t) : t,
360
- search: _e(r),
361
- hash: Ve(a)
362
- };
363
- }
364
- function Pe(e, t) {
365
- let n = t.replace(/\/+$/, "").split("/");
366
- return e.split("/").forEach((a) => {
367
- a === ".." ? n.length > 1 && n.pop() : a !== "." && n.push(a);
368
- }), n.length > 1 ? n.join("/") : "/";
369
- }
370
- function W(e, t, n, r) {
371
- return "Cannot include a '" + e + "' character in a manually specified " + ("`to." + t + "` field [" + JSON.stringify(r) + "]. Please separate it out to the ") + ("`to." + n + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
372
- }
373
- function Oe(e) {
374
- return e.filter((t, n) => n === 0 || t.route.path && t.route.path.length > 0);
375
- }
376
- function ee(e, t) {
377
- let n = Oe(e);
378
- return t ? n.map((r, a) => a === n.length - 1 ? r.pathname : r.pathnameBase) : n.map((r) => r.pathnameBase);
379
- }
380
- function te(e, t, n, r) {
381
- r === void 0 && (r = !1);
382
- let a;
383
- typeof e == "string" ? a = O(e) : (a = D({}, e), f(!a.pathname || !a.pathname.includes("?"), W("?", "pathname", "search", a)), f(!a.pathname || !a.pathname.includes("#"), W("#", "pathname", "hash", a)), f(!a.search || !a.search.includes("#"), W("#", "search", "hash", a)));
384
- let o = e === "" || a.pathname === "", i = o ? "/" : a.pathname, u;
385
- if (i == null)
386
- u = n;
387
- else {
388
- let c = t.length - 1;
389
- if (!r && i.startsWith("..")) {
390
- let m = i.split("/");
391
- for (; m[0] === ".."; )
392
- m.shift(), c -= 1;
393
- a.pathname = m.join("/");
394
- }
395
- u = c >= 0 ? t[c] : "/";
396
- }
397
- let l = we(a, u), d = i && i !== "/" && i.endsWith("/"), h = (o || i === ".") && n.endsWith("/");
398
- return !l.pathname.endsWith("/") && (d || h) && (l.pathname += "/"), l;
399
- }
400
- const C = (e) => e.join("/").replace(/\/\/+/g, "/"), De = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), _e = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, Ve = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e;
401
- function Se(e) {
402
- return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
403
- }
404
- const ne = ["post", "put", "patch", "delete"];
405
- new Set(ne);
406
- const Be = ["get", ...ne];
407
- new Set(Be);
408
- /**
409
- * React Router v6.30.1
410
- *
411
- * Copyright (c) Remix Software Inc.
412
- *
413
- * This source code is licensed under the MIT license found in the
414
- * LICENSE.md file in the root directory of this source tree.
415
- *
416
- * @license MIT
417
- */
418
- function _() {
419
- return _ = Object.assign ? Object.assign.bind() : function(e) {
420
- for (var t = 1; t < arguments.length; t++) {
421
- var n = arguments[t];
422
- for (var r in n)
423
- Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
424
- }
425
- return e;
426
- }, _.apply(this, arguments);
427
- }
428
- const U = /* @__PURE__ */ s.createContext(null);
429
- process.env.NODE_ENV !== "production" && (U.displayName = "DataRouter");
430
- const re = /* @__PURE__ */ s.createContext(null);
431
- process.env.NODE_ENV !== "production" && (re.displayName = "DataRouterState");
432
- const Le = /* @__PURE__ */ s.createContext(null);
433
- process.env.NODE_ENV !== "production" && (Le.displayName = "Await");
434
- const P = /* @__PURE__ */ s.createContext(null);
435
- process.env.NODE_ENV !== "production" && (P.displayName = "Navigation");
436
- const S = /* @__PURE__ */ s.createContext(null);
437
- process.env.NODE_ENV !== "production" && (S.displayName = "Location");
438
- const w = /* @__PURE__ */ s.createContext({
439
- outlet: null,
440
- matches: [],
441
- isDataRoute: !1
442
- });
443
- process.env.NODE_ENV !== "production" && (w.displayName = "Route");
444
- const $ = /* @__PURE__ */ s.createContext(null);
445
- process.env.NODE_ENV !== "production" && ($.displayName = "RouteError");
446
- function Xe(e, t) {
447
- let {
448
- relative: n
449
- } = t === void 0 ? {} : t;
450
- B() || (process.env.NODE_ENV !== "production" ? f(
451
- !1,
452
- // TODO: This error is probably because they somehow have 2 versions of the
453
- // router loaded. We can help them understand how to avoid that.
454
- "useHref() may be used only in the context of a <Router> component."
455
- ) : f(!1));
456
- let {
457
- basename: r,
458
- navigator: a
459
- } = s.useContext(P), {
460
- hash: o,
461
- pathname: i,
462
- search: u
463
- } = Ie(e, {
464
- relative: n
465
- }), l = i;
466
- return r !== "/" && (l = i === "/" ? r : C([r, i])), a.createHref({
467
- pathname: l,
468
- search: u,
469
- hash: o
470
- });
471
- }
472
- function B() {
473
- return s.useContext(S) != null;
474
- }
475
- function M() {
476
- return B() || (process.env.NODE_ENV !== "production" ? f(
477
- !1,
478
- // TODO: This error is probably because they somehow have 2 versions of the
479
- // router loaded. We can help them understand how to avoid that.
480
- "useLocation() may be used only in the context of a <Router> component."
481
- ) : f(!1)), s.useContext(S).location;
482
- }
483
- const ae = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
484
- function oe(e) {
485
- s.useContext(P).static || s.useLayoutEffect(e);
486
- }
487
- function Qe() {
488
- let {
489
- isDataRoute: e
490
- } = s.useContext(w);
491
- return e ? He() : Ue();
492
- }
493
- function Ue() {
494
- B() || (process.env.NODE_ENV !== "production" ? f(
495
- !1,
496
- // TODO: This error is probably because they somehow have 2 versions of the
497
- // router loaded. We can help them understand how to avoid that.
498
- "useNavigate() may be used only in the context of a <Router> component."
499
- ) : f(!1));
500
- let e = s.useContext(U), {
501
- basename: t,
502
- future: n,
503
- navigator: r
504
- } = s.useContext(P), {
505
- matches: a
506
- } = s.useContext(w), {
507
- pathname: o
508
- } = M(), i = JSON.stringify(ee(a, n.v7_relativeSplatPath)), u = s.useRef(!1);
509
- return oe(() => {
510
- u.current = !0;
511
- }), s.useCallback(function(d, h) {
512
- if (h === void 0 && (h = {}), process.env.NODE_ENV !== "production" && b(u.current, ae), !u.current) return;
513
- if (typeof d == "number") {
514
- r.go(d);
515
- return;
516
- }
517
- let c = te(d, JSON.parse(i), o, h.relative === "path");
518
- e == null && t !== "/" && (c.pathname = c.pathname === "/" ? t : C([t, c.pathname])), (h.replace ? r.replace : r.push)(c, h.state, h);
519
- }, [t, r, i, o, e]);
520
- }
521
- function Ie(e, t) {
522
- let {
523
- relative: n
524
- } = t === void 0 ? {} : t, {
525
- future: r
526
- } = s.useContext(P), {
527
- matches: a
528
- } = s.useContext(w), {
529
- pathname: o
530
- } = M(), i = JSON.stringify(ee(a, r.v7_relativeSplatPath));
531
- return s.useMemo(() => te(e, JSON.parse(i), o, n === "path"), [e, i, o, n]);
532
- }
533
- function We(e, t) {
534
- return je(e, t);
535
- }
536
- function je(e, t, n, r) {
537
- B() || (process.env.NODE_ENV !== "production" ? f(
538
- !1,
539
- // TODO: This error is probably because they somehow have 2 versions of the
540
- // router loaded. We can help them understand how to avoid that.
541
- "useRoutes() may be used only in the context of a <Router> component."
542
- ) : f(!1));
543
- let {
544
- navigator: a
545
- } = s.useContext(P), {
546
- matches: o
547
- } = s.useContext(w), i = o[o.length - 1], u = i ? i.params : {}, l = i ? i.pathname : "/", d = i ? i.pathnameBase : "/", h = i && i.route;
548
- if (process.env.NODE_ENV !== "production") {
549
- let v = h && h.path || "";
550
- le(l, !h || v.endsWith("*"), "You rendered descendant <Routes> (or called `useRoutes()`) at " + ('"' + l + '" (under <Route path="' + v + '">) but the ') + `parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
551
-
552
- ` + ('Please change the parent <Route path="' + v + '"> to <Route ') + ('path="' + (v === "/" ? "*" : v + "/*") + '">.'));
553
- }
554
- let c = M(), m;
555
- if (t) {
556
- var N;
557
- let v = typeof t == "string" ? O(t) : t;
558
- d === "/" || (N = v.pathname) != null && N.startsWith(d) || (process.env.NODE_ENV !== "production" ? f(!1, "When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, the location pathname must begin with the portion of the URL pathname that was " + ('matched by all parent routes. The current pathname base is "' + d + '" ') + ('but pathname "' + v.pathname + '" was given in the `location` prop.')) : f(!1)), m = v;
559
- } else
560
- m = c;
561
- let y = m.pathname || "/", g = y;
562
- if (d !== "/") {
563
- let v = d.replace(/^\//, "").split("/");
564
- g = "/" + y.replace(/^\//, "").split("/").slice(v.length).join("/");
565
- }
566
- let p = ce(e, {
567
- pathname: g
568
- });
569
- process.env.NODE_ENV !== "production" && (process.env.NODE_ENV !== "production" && b(h || p != null, 'No routes matched location "' + m.pathname + m.search + m.hash + '" '), process.env.NODE_ENV !== "production" && b(p == null || p[p.length - 1].route.element !== void 0 || p[p.length - 1].route.Component !== void 0 || p[p.length - 1].route.lazy !== void 0, 'Matched leaf route at location "' + m.pathname + m.search + m.hash + '" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.'));
570
- let E = ke(p && p.map((v) => Object.assign({}, v, {
571
- params: Object.assign({}, u, v.params),
572
- pathname: C([
573
- d,
574
- // Re-encode pathnames that were decoded inside matchRoutes
575
- a.encodeLocation ? a.encodeLocation(v.pathname).pathname : v.pathname
576
- ]),
577
- pathnameBase: v.pathnameBase === "/" ? d : C([
578
- d,
579
- // Re-encode pathnames that were decoded inside matchRoutes
580
- a.encodeLocation ? a.encodeLocation(v.pathnameBase).pathname : v.pathnameBase
581
- ])
582
- })), o, n, r);
583
- return t && E ? /* @__PURE__ */ s.createElement(S.Provider, {
584
- value: {
585
- location: _({
586
- pathname: "/",
587
- search: "",
588
- hash: "",
589
- state: null,
590
- key: "default"
591
- }, m),
592
- navigationType: R.Pop
593
- }
594
- }, E) : E;
595
- }
596
- function Fe() {
597
- let e = Ye(), t = Se(e) ? e.status + " " + e.statusText : e instanceof Error ? e.message : JSON.stringify(e), n = e instanceof Error ? e.stack : null, r = "rgba(200,200,200, 0.5)", a = {
598
- padding: "0.5rem",
599
- backgroundColor: r
600
- }, o = {
601
- padding: "2px 4px",
602
- backgroundColor: r
603
- }, i = null;
604
- return process.env.NODE_ENV !== "production" && (console.error("Error handled by React Router default ErrorBoundary:", e), i = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ s.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ s.createElement("code", {
605
- style: o
606
- }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ s.createElement("code", {
607
- style: o
608
- }, "errorElement"), " prop on your route."))), /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ s.createElement("h3", {
609
- style: {
610
- fontStyle: "italic"
611
- }
612
- }, t), n ? /* @__PURE__ */ s.createElement("pre", {
613
- style: a
614
- }, n) : null, i);
615
- }
616
- const $e = /* @__PURE__ */ s.createElement(Fe, null);
617
- class Me extends s.Component {
618
- constructor(t) {
619
- super(t), this.state = {
620
- location: t.location,
621
- revalidation: t.revalidation,
622
- error: t.error
623
- };
624
- }
625
- static getDerivedStateFromError(t) {
626
- return {
627
- error: t
628
- };
629
- }
630
- static getDerivedStateFromProps(t, n) {
631
- return n.location !== t.location || n.revalidation !== "idle" && t.revalidation === "idle" ? {
632
- error: t.error,
633
- location: t.location,
634
- revalidation: t.revalidation
635
- } : {
636
- error: t.error !== void 0 ? t.error : n.error,
637
- location: n.location,
638
- revalidation: t.revalidation || n.revalidation
639
- };
640
- }
641
- componentDidCatch(t, n) {
642
- console.error("React Router caught the following error during render", t, n);
643
- }
644
- render() {
645
- return this.state.error !== void 0 ? /* @__PURE__ */ s.createElement(w.Provider, {
646
- value: this.props.routeContext
647
- }, /* @__PURE__ */ s.createElement($.Provider, {
648
- value: this.state.error,
649
- children: this.props.component
650
- })) : this.props.children;
651
- }
652
- }
653
- function Te(e) {
654
- let {
655
- routeContext: t,
656
- match: n,
657
- children: r
658
- } = e, a = s.useContext(U);
659
- return a && a.static && a.staticContext && (n.route.errorElement || n.route.ErrorBoundary) && (a.staticContext._deepestRenderedBoundaryId = n.route.id), /* @__PURE__ */ s.createElement(w.Provider, {
660
- value: t
661
- }, r);
662
- }
663
- function ke(e, t, n, r) {
664
- var a;
665
- if (t === void 0 && (t = []), n === void 0 && (n = null), r === void 0 && (r = null), e == null) {
666
- var o;
667
- if (!n)
668
- return null;
669
- if (n.errors)
670
- e = n.matches;
671
- else if ((o = r) != null && o.v7_partialHydration && t.length === 0 && !n.initialized && n.matches.length > 0)
672
- e = n.matches;
673
- else
674
- return null;
675
- }
676
- let i = e, u = (a = n) == null ? void 0 : a.errors;
677
- if (u != null) {
678
- let h = i.findIndex((c) => c.route.id && u?.[c.route.id] !== void 0);
679
- h >= 0 || (process.env.NODE_ENV !== "production" ? f(!1, "Could not find a matching route for errors on route IDs: " + Object.keys(u).join(",")) : f(!1)), i = i.slice(0, Math.min(i.length, h + 1));
680
- }
681
- let l = !1, d = -1;
682
- if (n && r && r.v7_partialHydration)
683
- for (let h = 0; h < i.length; h++) {
684
- let c = i[h];
685
- if ((c.route.HydrateFallback || c.route.hydrateFallbackElement) && (d = h), c.route.id) {
686
- let {
687
- loaderData: m,
688
- errors: N
689
- } = n, y = c.route.loader && m[c.route.id] === void 0 && (!N || N[c.route.id] === void 0);
690
- if (c.route.lazy || y) {
691
- l = !0, d >= 0 ? i = i.slice(0, d + 1) : i = [i[0]];
692
- break;
693
- }
694
- }
695
- }
696
- return i.reduceRight((h, c, m) => {
697
- let N, y = !1, g = null, p = null;
698
- n && (N = u && c.route.id ? u[c.route.id] : void 0, g = c.route.errorElement || $e, l && (d < 0 && m === 0 ? (le("route-fallback", !1, "No `HydrateFallback` element provided to render during initial hydration"), y = !0, p = null) : d === m && (y = !0, p = c.route.hydrateFallbackElement || null)));
699
- let E = t.concat(i.slice(0, m + 1)), v = () => {
700
- let x;
701
- return N ? x = g : y ? x = p : c.route.Component ? x = /* @__PURE__ */ s.createElement(c.route.Component, null) : c.route.element ? x = c.route.element : x = h, /* @__PURE__ */ s.createElement(Te, {
702
- match: c,
703
- routeContext: {
704
- outlet: h,
705
- matches: E,
706
- isDataRoute: n != null
707
- },
708
- children: x
709
- });
710
- };
711
- return n && (c.route.ErrorBoundary || c.route.errorElement || m === 0) ? /* @__PURE__ */ s.createElement(Me, {
712
- location: n.location,
713
- revalidation: n.revalidation,
714
- component: g,
715
- error: N,
716
- children: v(),
717
- routeContext: {
718
- outlet: null,
719
- matches: E,
720
- isDataRoute: !0
721
- }
722
- }) : v();
723
- }, null);
724
- }
725
- var ie = /* @__PURE__ */ (function(e) {
726
- return e.UseBlocker = "useBlocker", e.UseRevalidator = "useRevalidator", e.UseNavigateStable = "useNavigate", e;
727
- })(ie || {}), V = /* @__PURE__ */ (function(e) {
728
- return e.UseBlocker = "useBlocker", e.UseLoaderData = "useLoaderData", e.UseActionData = "useActionData", e.UseRouteError = "useRouteError", e.UseNavigation = "useNavigation", e.UseRouteLoaderData = "useRouteLoaderData", e.UseMatches = "useMatches", e.UseRevalidator = "useRevalidator", e.UseNavigateStable = "useNavigate", e.UseRouteId = "useRouteId", e;
729
- })(V || {});
730
- function T(e) {
731
- return e + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
732
- }
733
- function Ae(e) {
734
- let t = s.useContext(U);
735
- return t || (process.env.NODE_ENV !== "production" ? f(!1, T(e)) : f(!1)), t;
736
- }
737
- function ze(e) {
738
- let t = s.useContext(re);
739
- return t || (process.env.NODE_ENV !== "production" ? f(!1, T(e)) : f(!1)), t;
740
- }
741
- function Je(e) {
742
- let t = s.useContext(w);
743
- return t || (process.env.NODE_ENV !== "production" ? f(!1, T(e)) : f(!1)), t;
744
- }
745
- function k(e) {
746
- let t = Je(e), n = t.matches[t.matches.length - 1];
747
- return n.route.id || (process.env.NODE_ENV !== "production" ? f(!1, e + ' can only be used on routes that contain a unique "id"') : f(!1)), n.route.id;
748
- }
749
- function Ze() {
750
- return k(V.UseRouteId);
751
- }
752
- function Ye() {
753
- var e;
754
- let t = s.useContext($), n = ze(V.UseRouteError), r = k(V.UseRouteError);
755
- return t !== void 0 ? t : (e = n.errors) == null ? void 0 : e[r];
756
- }
757
- function He() {
758
- let {
759
- router: e
760
- } = Ae(ie.UseNavigateStable), t = k(V.UseNavigateStable), n = s.useRef(!1);
761
- return oe(() => {
762
- n.current = !0;
763
- }), s.useCallback(function(a, o) {
764
- o === void 0 && (o = {}), process.env.NODE_ENV !== "production" && b(n.current, ae), n.current && (typeof a == "number" ? e.navigate(a) : e.navigate(a, _({
765
- fromRouteId: t
766
- }, o)));
767
- }, [e, t]);
768
- }
769
- const H = {};
770
- function le(e, t, n) {
771
- !t && !H[e] && (H[e] = !0, process.env.NODE_ENV !== "production" && b(!1, n));
772
- }
773
- const q = {};
774
- function qe(e, t) {
775
- process.env.NODE_ENV !== "production" && !q[t] && (q[t] = !0, console.warn(t));
776
- }
777
- const G = (e, t, n) => qe(e, "⚠️ React Router Future Flag Warning: " + t + ". " + ("You can use the `" + e + "` future flag to opt-in early. ") + ("For more information, see " + n + "."));
778
- function et(e, t) {
779
- e?.v7_startTransition === void 0 && G("v7_startTransition", "React Router will begin wrapping state updates in `React.startTransition` in v7", "https://reactrouter.com/v6/upgrading/future#v7_starttransition"), e?.v7_relativeSplatPath === void 0 && G("v7_relativeSplatPath", "Relative route resolution within Splat routes is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath");
780
- }
781
- function Ge(e) {
782
- process.env.NODE_ENV !== "production" ? f(!1, "A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.") : f(!1);
783
- }
784
- function tt(e) {
785
- let {
786
- basename: t = "/",
787
- children: n = null,
788
- location: r,
789
- navigationType: a = R.Pop,
790
- navigator: o,
791
- static: i = !1,
792
- future: u
793
- } = e;
794
- B() && (process.env.NODE_ENV !== "production" ? f(!1, "You cannot render a <Router> inside another <Router>. You should never have more than one in your app.") : f(!1));
795
- let l = t.replace(/^\/*/, "/"), d = s.useMemo(() => ({
796
- basename: l,
797
- navigator: o,
798
- static: i,
799
- future: _({
800
- v7_relativeSplatPath: !1
801
- }, u)
802
- }), [l, u, o, i]);
803
- typeof r == "string" && (r = O(r));
804
- let {
805
- pathname: h = "/",
806
- search: c = "",
807
- hash: m = "",
808
- state: N = null,
809
- key: y = "default"
810
- } = r, g = s.useMemo(() => {
811
- let p = Z(h, l);
812
- return p == null ? null : {
813
- location: {
814
- pathname: p,
815
- search: c,
816
- hash: m,
817
- state: N,
818
- key: y
819
- },
820
- navigationType: a
821
- };
822
- }, [l, h, c, m, N, y, a]);
823
- return process.env.NODE_ENV !== "production" && b(g != null, '<Router basename="' + l + '"> is not able to match the URL ' + ('"' + h + c + m + '" because it does not start with the ') + "basename, so the <Router> won't render anything."), g == null ? null : /* @__PURE__ */ s.createElement(P.Provider, {
824
- value: d
825
- }, /* @__PURE__ */ s.createElement(S.Provider, {
826
- children: n,
827
- value: g
828
- }));
829
- }
830
- function nt(e) {
831
- let {
832
- children: t,
833
- location: n
834
- } = e;
835
- return We(F(t), n);
836
- }
837
- new Promise(() => {
838
- });
839
- function F(e, t) {
840
- t === void 0 && (t = []);
841
- let n = [];
842
- return s.Children.forEach(e, (r, a) => {
843
- if (!/* @__PURE__ */ s.isValidElement(r))
844
- return;
845
- let o = [...t, a];
846
- if (r.type === s.Fragment) {
847
- n.push.apply(n, F(r.props.children, o));
848
- return;
849
- }
850
- r.type !== Ge && (process.env.NODE_ENV !== "production" ? f(!1, "[" + (typeof r.type == "string" ? r.type : r.type.name) + "] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>") : f(!1)), !r.props.index || !r.props.children || (process.env.NODE_ENV !== "production" ? f(!1, "An index route cannot have child routes.") : f(!1));
851
- let i = {
852
- id: r.props.id || o.join("-"),
853
- caseSensitive: r.props.caseSensitive,
854
- element: r.props.element,
855
- Component: r.props.Component,
856
- index: r.props.index,
857
- path: r.props.path,
858
- loader: r.props.loader,
859
- action: r.props.action,
860
- errorElement: r.props.errorElement,
861
- ErrorBoundary: r.props.ErrorBoundary,
862
- hasErrorBoundary: r.props.ErrorBoundary != null || r.props.errorElement != null,
863
- shouldRevalidate: r.props.shouldRevalidate,
864
- handle: r.props.handle,
865
- lazy: r.props.lazy
866
- };
867
- r.props.children && (i.children = F(r.props.children, o)), n.push(i);
868
- }), n;
869
- }
870
- export {
871
- re as D,
872
- P as N,
873
- nt as R,
874
- Ge as a,
875
- tt as b,
876
- Ke as c,
877
- Qe as d,
878
- M as e,
879
- Ie as f,
880
- K as g,
881
- Ze as h,
882
- f as i,
883
- w as j,
884
- C as k,
885
- et as l,
886
- Re as m,
887
- U as n,
888
- Z as s,
889
- Xe as u,
890
- b as w
891
- };