@konstructio/ui 0.0.2 → 0.0.4

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 (118) hide show
  1. package/README.md +53 -4
  2. package/dist/{AlertDialogTrigger-BIbxXexQ.js → AlertDialogTrigger-lenvKoGF.js} +4 -4
  3. package/dist/Modal-Bg9UG35z.js +909 -0
  4. package/dist/{chevron-up-Cmu1oXfj.js → chevron-up-CvquEaNg.js} +1 -1
  5. package/dist/clsx-OuTLNxxd.js +16 -0
  6. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  7. package/dist/components/AlertDialog/AlertDialog.variants.d.ts +1 -1
  8. package/dist/components/AlertDialog/AlertDialog.variants.js +4 -5
  9. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  10. package/dist/components/AlertDialog/components/index.js +1 -1
  11. package/dist/components/Autocomplete/Autocomplete.variants.d.ts +2 -2
  12. package/dist/components/Autocomplete/Autocomplete.variants.js +8 -8
  13. package/dist/components/Autocomplete/components/List.types.d.ts +3 -3
  14. package/dist/components/Autocomplete/components/List.variants.d.ts +4 -4
  15. package/dist/components/Autocomplete/components/List.variants.js +13 -13
  16. package/dist/components/Autocomplete/hooks/useAutocomplete.d.ts +4 -4
  17. package/dist/components/Autocomplete/hooks/useNavigationList.d.ts +4 -4
  18. package/dist/components/Breadcrumb/Breadcrumb.js +57 -412
  19. package/dist/components/Breadcrumb/Breadcrumb.variants.d.ts +3 -3
  20. package/dist/components/Breadcrumb/Breadcrumb.variants.js +12 -12
  21. package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
  22. package/dist/components/Button/Button.js +23 -21
  23. package/dist/components/Button/Button.variants.d.ts +2 -1
  24. package/dist/components/Button/Button.variants.js +122 -23
  25. package/dist/components/Checkbox/Checkbox.js +4 -4
  26. package/dist/components/Checkbox/Checkbox.variants.d.ts +2 -2
  27. package/dist/components/Checkbox/Checkbox.variants.js +7 -16
  28. package/dist/components/Dropdown/Dropdown.js +5 -5
  29. package/dist/components/Dropdown/Dropdown.types.d.ts +1 -0
  30. package/dist/components/Dropdown/Dropdown.variants.d.ts +1 -1
  31. package/dist/components/Dropdown/Dropdown.variants.js +5 -9
  32. package/dist/components/Dropdown/components/List/List.d.ts +2 -2
  33. package/dist/components/Dropdown/components/List/List.types.d.ts +3 -3
  34. package/dist/components/Dropdown/components/List/List.variants.d.ts +1 -1
  35. package/dist/components/Dropdown/components/List/List.variants.js +3 -3
  36. package/dist/components/Dropdown/components/ListItem/ListItem.variants.d.ts +1 -1
  37. package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +3 -3
  38. package/dist/components/Dropdown/components/Wrapper.d.ts +2 -2
  39. package/dist/components/Dropdown/components/Wrapper.js +1 -1
  40. package/dist/components/Dropdown/contexts/dropdown.provider.d.ts +4 -1
  41. package/dist/components/Dropdown/contexts/dropdown.provider.js +19 -8
  42. package/dist/components/Dropdown/hooks/useDropdown.d.ts +4 -4
  43. package/dist/components/Dropdown/hooks/useNavigationList.d.ts +4 -4
  44. package/dist/components/Input/Input.js +1 -1
  45. package/dist/components/Input/Input.variants.d.ts +1 -1
  46. package/dist/components/Input/Input.variants.js +3 -3
  47. package/dist/components/Modal/Modal.js +2 -2
  48. package/dist/components/Modal/components/Body/Body.js +1 -1
  49. package/dist/components/Modal/components/Footer/Footer.js +1 -1
  50. package/dist/components/Modal/components/Header/Header.js +1 -1
  51. package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -3
  52. package/dist/components/Modal/components/Wrapper/Wrapper.variants.d.ts +2 -2
  53. package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +10 -10
  54. package/dist/components/Modal/components/index.js +1 -1
  55. package/dist/components/Modal/hooks/useModal.d.ts +1 -1
  56. package/dist/components/NumberInput/NumberInput.js +96 -87
  57. package/dist/components/NumberInput/NumberInput.variants.d.ts +3 -3
  58. package/dist/components/NumberInput/NumberInput.variants.js +14 -21
  59. package/dist/components/ProgressBar/ProgressBar.variants.d.ts +2 -2
  60. package/dist/components/ProgressBar/ProgressBar.variants.js +7 -12
  61. package/dist/components/Radio/Radio.variants.d.ts +1 -1
  62. package/dist/components/Radio/Radio.variants.js +4 -7
  63. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  64. package/dist/components/Range/Range.js +1 -1
  65. package/dist/components/Range/Range.variants.d.ts +4 -4
  66. package/dist/components/Range/Range.variants.js +18 -18
  67. package/dist/components/Slider/Slider.js +1 -1
  68. package/dist/components/Slider/Slider.variants.d.ts +3 -3
  69. package/dist/components/Slider/Slider.variants.js +12 -12
  70. package/dist/components/Switch/Switch.js +2 -2
  71. package/dist/components/Switch/Switch.variants.d.ts +2 -2
  72. package/dist/components/Switch/Switch.variants.js +6 -6
  73. package/dist/components/Tag/Tag.variants.js +1 -1
  74. package/dist/components/TagSelect/TagSelect.js +1 -1
  75. package/dist/components/TagSelect/TagSelect.variants.d.ts +3 -3
  76. package/dist/components/TagSelect/TagSelect.variants.js +11 -14
  77. package/dist/components/TagSelect/hooks/useTagSelect.d.ts +1 -1
  78. package/dist/components/TextArea/TextArea.variants.d.ts +1 -1
  79. package/dist/components/TextArea/TextArea.variants.js +5 -5
  80. package/dist/components/Toast/Toast.js +104 -101
  81. package/dist/components/Toast/Toast.variants.d.ts +3 -3
  82. package/dist/components/Toast/Toast.variants.js +12 -12
  83. package/dist/components/Tooltip/Tooltip.js +1 -1
  84. package/dist/components/Tooltip/Tooltip.variants.d.ts +2 -2
  85. package/dist/components/Tooltip/Tooltip.variants.js +9 -9
  86. package/dist/components/Tooltip/hooks/useTooltip.d.ts +1 -1
  87. package/dist/components/index.js +1 -1
  88. package/dist/contexts/theme.context.d.ts +1 -1
  89. package/dist/contexts/theme.hook.js +3 -6
  90. package/dist/contexts/theme.provider.d.ts +2 -3
  91. package/dist/contexts/theme.provider.js +4 -1
  92. package/dist/index-BBjak_0p.js +47 -0
  93. package/dist/index-BNmRGtA6.js +34 -0
  94. package/dist/{index-DFbnnPzA.js → index-Ci9Yg4G1.js} +5 -5
  95. package/dist/{index-B_GWswUP.js → index-D4Q2rMby.js} +1 -1
  96. package/dist/{index-DQMInta3.js → index-D68N8v8R.js} +214 -209
  97. package/dist/index-DoOsnuB6.js +72 -0
  98. package/dist/{index-2K8qjK4R.js → index-O3j1K921.js} +36 -37
  99. package/dist/index-OOfdXoxx.js +423 -0
  100. package/dist/index-ffjBR8Av.js +32 -0
  101. package/dist/index.js +1 -1
  102. package/dist/package.json +42 -38
  103. package/dist/plugins/konstruct.js +61 -50
  104. package/dist/plugins/utils/colors.d.ts +127 -10
  105. package/dist/plugins/utils/colors.js +210 -510
  106. package/dist/styles.css +1 -1
  107. package/dist/useBreadcrumb-tyxjV-a1.js +1398 -0
  108. package/dist/utils/index.js +150 -162
  109. package/dist/x-CRBgmX1Q.js +62 -0
  110. package/package.json +42 -38
  111. package/dist/Modal-CO0_SnXD.js +0 -909
  112. package/dist/index-2hJuj4UN.js +0 -19069
  113. package/dist/index-4qm4jAkj.js +0 -92
  114. package/dist/index-BJ7FQg17.js +0 -35
  115. package/dist/index-BqM_XclQ.js +0 -94
  116. package/dist/index-BwYCDOHZ.js +0 -44
  117. package/dist/index-CCavb-1K.js +0 -57
  118. package/dist/useBreadcrumb-BSMnc4Fu.js +0 -341
@@ -1,92 +0,0 @@
1
- import * as c from "react";
2
- import l, { forwardRef as d } from "react";
3
- import { P as a } from "./index-DQMInta3.js";
4
- import { P as u } from "./index-BJ7FQg17.js";
5
- import { jsx as y } from "react/jsx-runtime";
6
- function s() {
7
- return s = Object.assign || function(r) {
8
- for (var t = 1; t < arguments.length; t++) {
9
- var o = arguments[t];
10
- for (var e in o)
11
- Object.prototype.hasOwnProperty.call(o, e) && (r[e] = o[e]);
12
- }
13
- return r;
14
- }, s.apply(this, arguments);
15
- }
16
- function v(r, t) {
17
- if (r == null) return {};
18
- var o = g(r, t), e, n;
19
- if (Object.getOwnPropertySymbols) {
20
- var i = Object.getOwnPropertySymbols(r);
21
- for (n = 0; n < i.length; n++)
22
- e = i[n], !(t.indexOf(e) >= 0) && Object.prototype.propertyIsEnumerable.call(r, e) && (o[e] = r[e]);
23
- }
24
- return o;
25
- }
26
- function g(r, t) {
27
- if (r == null) return {};
28
- var o = {}, e = Object.keys(r), n, i;
29
- for (i = 0; i < e.length; i++)
30
- n = e[i], !(t.indexOf(n) >= 0) && (o[n] = r[n]);
31
- return o;
32
- }
33
- var p = d(function(r, t) {
34
- var o = r.color, e = o === void 0 ? "currentColor" : o, n = r.size, i = n === void 0 ? 24 : n, m = v(r, ["color", "size"]);
35
- return /* @__PURE__ */ l.createElement("svg", s({
36
- ref: t,
37
- xmlns: "http://www.w3.org/2000/svg",
38
- width: i,
39
- height: i,
40
- viewBox: "0 0 24 24",
41
- fill: "none",
42
- stroke: e,
43
- strokeWidth: "2",
44
- strokeLinecap: "round",
45
- strokeLinejoin: "round"
46
- }, m), /* @__PURE__ */ l.createElement("line", {
47
- x1: "18",
48
- y1: "6",
49
- x2: "6",
50
- y2: "18"
51
- }), /* @__PURE__ */ l.createElement("line", {
52
- x1: "6",
53
- y1: "6",
54
- x2: "18",
55
- y2: "18"
56
- }));
57
- });
58
- p.propTypes = {
59
- color: a.string,
60
- size: a.oneOfType([a.string, a.number])
61
- };
62
- p.displayName = "X";
63
- var h = "VisuallyHidden", f = c.forwardRef(
64
- (r, t) => /* @__PURE__ */ y(
65
- u.span,
66
- {
67
- ...r,
68
- ref: t,
69
- style: {
70
- // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
71
- position: "absolute",
72
- border: 0,
73
- width: 1,
74
- height: 1,
75
- padding: 0,
76
- margin: -1,
77
- overflow: "hidden",
78
- clip: "rect(0, 0, 0, 0)",
79
- whiteSpace: "nowrap",
80
- wordWrap: "normal",
81
- ...r.style
82
- }
83
- }
84
- )
85
- );
86
- f.displayName = h;
87
- var x = f;
88
- export {
89
- x as R,
90
- f as V,
91
- p as X
92
- };
@@ -1,35 +0,0 @@
1
- import * as n from "react";
2
- import { r as p } from "./index-2hJuj4UN.js";
3
- import { S as f } from "./index-CCavb-1K.js";
4
- import { jsx as d } from "react/jsx-runtime";
5
- var u = [
6
- "a",
7
- "button",
8
- "div",
9
- "form",
10
- "h2",
11
- "h3",
12
- "img",
13
- "input",
14
- "label",
15
- "li",
16
- "nav",
17
- "ol",
18
- "p",
19
- "span",
20
- "svg",
21
- "ul"
22
- ], h = u.reduce((r, i) => {
23
- const o = n.forwardRef((t, e) => {
24
- const { asChild: s, ...a } = t, m = s ? f : i;
25
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ d(m, { ...a, ref: e });
26
- });
27
- return o.displayName = `Primitive.${i}`, { ...r, [i]: o };
28
- }, {});
29
- function w(r, i) {
30
- r && p.flushSync(() => r.dispatchEvent(i));
31
- }
32
- export {
33
- h as P,
34
- w as d
35
- };
@@ -1,94 +0,0 @@
1
- import * as R from "react";
2
- import S from "react";
3
- import { jsx as I } from "react/jsx-runtime";
4
- import { u as P, S as A } from "./index-CCavb-1K.js";
5
- function h(t, i = []) {
6
- let u = [];
7
- function M(c, o) {
8
- const n = R.createContext(o), s = u.length;
9
- u = [...u, o];
10
- function C(m) {
11
- const { scope: a, children: r, ...e } = m, d = (a == null ? void 0 : a[t][s]) || n, l = R.useMemo(() => e, Object.values(e));
12
- return /* @__PURE__ */ I(d.Provider, { value: l, children: r });
13
- }
14
- function _(m, a) {
15
- const r = (a == null ? void 0 : a[t][s]) || n, e = R.useContext(r);
16
- if (e) return e;
17
- if (o !== void 0) return o;
18
- throw new Error(`\`${m}\` must be used within \`${c}\``);
19
- }
20
- return C.displayName = c + "Provider", [C, _];
21
- }
22
- const f = () => {
23
- const c = u.map((o) => R.createContext(o));
24
- return function(n) {
25
- const s = (n == null ? void 0 : n[t]) || c;
26
- return R.useMemo(
27
- () => ({ [`__scope${t}`]: { ...n, [t]: s } }),
28
- [n, s]
29
- );
30
- };
31
- };
32
- return f.scopeName = t, [M, O(f, ...i)];
33
- }
34
- function O(...t) {
35
- const i = t[0];
36
- if (t.length === 1) return i;
37
- const u = () => {
38
- const M = t.map((f) => ({
39
- useScope: f(),
40
- scopeName: f.scopeName
41
- }));
42
- return function(c) {
43
- const o = M.reduce((n, { useScope: s, scopeName: C }) => {
44
- const m = s(c)[`__scope${C}`];
45
- return { ...n, ...m };
46
- }, {});
47
- return R.useMemo(() => ({ [`__scope${i.scopeName}`]: o }), [o]);
48
- };
49
- };
50
- return u.scopeName = i.scopeName, u;
51
- }
52
- function $(t) {
53
- const i = t + "CollectionProvider", [u, M] = h(i), [f, c] = u(
54
- i,
55
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
56
- ), o = (r) => {
57
- const { scope: e, children: d } = r, l = S.useRef(null), p = S.useRef(/* @__PURE__ */ new Map()).current;
58
- return /* @__PURE__ */ I(f, { scope: e, itemMap: p, collectionRef: l, children: d });
59
- };
60
- o.displayName = i;
61
- const n = t + "CollectionSlot", s = S.forwardRef(
62
- (r, e) => {
63
- const { scope: d, children: l } = r, p = c(n, d), x = P(e, p.collectionRef);
64
- return /* @__PURE__ */ I(A, { ref: x, children: l });
65
- }
66
- );
67
- s.displayName = n;
68
- const C = t + "CollectionItemSlot", _ = "data-radix-collection-item", m = S.forwardRef(
69
- (r, e) => {
70
- const { scope: d, children: l, ...p } = r, x = S.useRef(null), N = P(e, x), v = c(C, d);
71
- return S.useEffect(() => (v.itemMap.set(x, { ref: x, ...p }), () => void v.itemMap.delete(x))), /* @__PURE__ */ I(A, { [_]: "", ref: N, children: l });
72
- }
73
- );
74
- m.displayName = C;
75
- function a(r) {
76
- const e = c(t + "CollectionConsumer", r);
77
- return S.useCallback(() => {
78
- const l = e.collectionRef.current;
79
- if (!l) return [];
80
- const p = Array.from(l.querySelectorAll(`[${_}]`));
81
- return Array.from(e.itemMap.values()).sort(
82
- (v, E) => p.indexOf(v.ref.current) - p.indexOf(E.ref.current)
83
- );
84
- }, [e.collectionRef, e.itemMap]);
85
- }
86
- return [
87
- { Provider: o, Slot: s, ItemSlot: m },
88
- a,
89
- M
90
- ];
91
- }
92
- export {
93
- $ as c
94
- };
@@ -1,44 +0,0 @@
1
- function m(n) {
2
- var e, t, l = "";
3
- if (typeof n == "string" || typeof n == "number") l += n;
4
- else if (typeof n == "object") if (Array.isArray(n)) for (e = 0; e < n.length; e++) n[e] && (t = m(n[e])) && (l && (l += " "), l += t);
5
- else for (e in n) n[e] && (l && (l += " "), l += e);
6
- return l;
7
- }
8
- function j() {
9
- for (var n, e, t = 0, l = ""; t < arguments.length; ) (n = arguments[t++]) && (e = m(n)) && (l && (l += " "), l += e);
10
- return l;
11
- }
12
- const f = (n) => typeof n == "boolean" ? "".concat(n) : n === 0 ? "0" : n, y = j, A = (n, e) => (t) => {
13
- var l;
14
- if ((e == null ? void 0 : e.variants) == null) return y(n, t == null ? void 0 : t.class, t == null ? void 0 : t.className);
15
- const { variants: d, defaultVariants: u } = e, N = Object.keys(d).map((a) => {
16
- const r = t == null ? void 0 : t[a], s = u == null ? void 0 : u[a];
17
- if (r === null) return null;
18
- const i = f(r) || f(s);
19
- return d[a][i];
20
- }), v = t && Object.entries(t).reduce((a, r) => {
21
- let [s, i] = r;
22
- return i === void 0 || (a[s] = i), a;
23
- }, {}), V = e == null || (l = e.compoundVariants) === null || l === void 0 ? void 0 : l.reduce((a, r) => {
24
- let { class: s, className: i, ...b } = r;
25
- return Object.entries(b).every((C) => {
26
- let [c, o] = C;
27
- return Array.isArray(o) ? o.includes({
28
- ...u,
29
- ...v
30
- }[c]) : {
31
- ...u,
32
- ...v
33
- }[c] === o;
34
- }) ? [
35
- ...a,
36
- s,
37
- i
38
- ] : a;
39
- }, []);
40
- return y(n, N, V, t == null ? void 0 : t.class, t == null ? void 0 : t.className);
41
- };
42
- export {
43
- A as c
44
- };
@@ -1,57 +0,0 @@
1
- import * as l from "react";
2
- import { jsx as c, Fragment as d } from "react/jsx-runtime";
3
- function m(e, n) {
4
- typeof e == "function" ? e(n) : e != null && (e.current = n);
5
- }
6
- function p(...e) {
7
- return (n) => e.forEach((r) => m(r, n));
8
- }
9
- function S(...e) {
10
- return l.useCallback(p(...e), e);
11
- }
12
- var y = l.forwardRef((e, n) => {
13
- const { children: r, ...t } = e, o = l.Children.toArray(r), i = o.find(h);
14
- if (i) {
15
- const s = i.props.children, a = o.map((u) => u === i ? l.Children.count(s) > 1 ? l.Children.only(null) : l.isValidElement(s) ? s.props.children : null : u);
16
- return /* @__PURE__ */ c(f, { ...t, ref: n, children: l.isValidElement(s) ? l.cloneElement(s, void 0, a) : null });
17
- }
18
- return /* @__PURE__ */ c(f, { ...t, ref: n, children: r });
19
- });
20
- y.displayName = "Slot";
21
- var f = l.forwardRef((e, n) => {
22
- const { children: r, ...t } = e;
23
- if (l.isValidElement(r)) {
24
- const o = R(r);
25
- return l.cloneElement(r, {
26
- ...C(t, r.props),
27
- // @ts-ignore
28
- ref: n ? p(n, o) : o
29
- });
30
- }
31
- return l.Children.count(r) > 1 ? l.Children.only(null) : null;
32
- });
33
- f.displayName = "SlotClone";
34
- var g = ({ children: e }) => /* @__PURE__ */ c(d, { children: e });
35
- function h(e) {
36
- return l.isValidElement(e) && e.type === g;
37
- }
38
- function C(e, n) {
39
- const r = { ...n };
40
- for (const t in n) {
41
- const o = e[t], i = n[t];
42
- /^on[A-Z]/.test(t) ? o && i ? r[t] = (...a) => {
43
- i(...a), o(...a);
44
- } : o && (r[t] = o) : t === "style" ? r[t] = { ...o, ...i } : t === "className" && (r[t] = [o, i].filter(Boolean).join(" "));
45
- }
46
- return { ...e, ...r };
47
- }
48
- function R(e) {
49
- var t, o;
50
- let n = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get, r = n && "isReactWarning" in n && n.isReactWarning;
51
- return r ? e.ref : (n = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, r = n && "isReactWarning" in n && n.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
52
- }
53
- export {
54
- y as S,
55
- g as a,
56
- S as u
57
- };
@@ -1,341 +0,0 @@
1
- import * as s from "react";
2
- import { useContext as J } from "react";
3
- /**
4
- * @remix-run/router v1.21.0
5
- *
6
- * Copyright (c) Remix Software Inc.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE.md file in the root directory of this source tree.
10
- *
11
- * @license MIT
12
- */
13
- function N() {
14
- return N = Object.assign ? Object.assign.bind() : function(e) {
15
- for (var t = 1; t < arguments.length; t++) {
16
- var n = arguments[t];
17
- for (var a in n)
18
- Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
19
- }
20
- return e;
21
- }, N.apply(this, arguments);
22
- }
23
- var w;
24
- (function(e) {
25
- e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE";
26
- })(w || (w = {}));
27
- function u(e, t) {
28
- if (e === !1 || e === null || typeof e > "u")
29
- throw new Error(t);
30
- }
31
- function E(e, t) {
32
- if (!e) {
33
- typeof console < "u" && console.warn(t);
34
- try {
35
- throw new Error(t);
36
- } catch {
37
- }
38
- }
39
- }
40
- function re(e) {
41
- let {
42
- pathname: t = "/",
43
- search: n = "",
44
- hash: a = ""
45
- } = e;
46
- return n && n !== "?" && (t += n.charAt(0) === "?" ? n : "?" + n), a && a !== "#" && (t += a.charAt(0) === "#" ? a : "#" + a), t;
47
- }
48
- function D(e) {
49
- let t = {};
50
- if (e) {
51
- let n = e.indexOf("#");
52
- n >= 0 && (t.hash = e.substr(n), e = e.substr(0, n));
53
- let a = e.indexOf("?");
54
- a >= 0 && (t.search = e.substr(a), e = e.substr(0, a)), e && (t.pathname = e);
55
- }
56
- return t;
57
- }
58
- var P;
59
- (function(e) {
60
- e.data = "data", e.deferred = "deferred", e.redirect = "redirect", e.error = "error";
61
- })(P || (P = {}));
62
- function se(e, t) {
63
- typeof e == "string" && (e = {
64
- path: e,
65
- caseSensitive: !1,
66
- end: !0
67
- });
68
- let [n, a] = T(e.path, e.caseSensitive, e.end), r = t.match(n);
69
- if (!r) return null;
70
- let i = r[0], o = i.replace(/(.)\/+$/, "$1"), l = r.slice(1);
71
- return {
72
- params: a.reduce((d, h, f) => {
73
- let {
74
- paramName: p,
75
- isOptional: M
76
- } = h;
77
- if (p === "*") {
78
- let A = l[f] || "";
79
- o = i.slice(0, i.length - A.length).replace(/(.)\/+$/, "$1");
80
- }
81
- const b = l[f];
82
- return M && !b ? d[p] = void 0 : d[p] = (b || "").replace(/%2F/g, "/"), d;
83
- }, {}),
84
- pathname: i,
85
- pathnameBase: o,
86
- pattern: e
87
- };
88
- }
89
- function T(e, t, n) {
90
- t === void 0 && (t = !1), n === void 0 && (n = !0), E(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(/\*$/, "/*") + '".'));
91
- let a = [], r = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (o, l, c) => (a.push({
92
- paramName: l,
93
- isOptional: c != null
94
- }), c ? "/?([^\\/]+)?" : "/([^\\/]+)"));
95
- return e.endsWith("*") ? (a.push({
96
- paramName: "*"
97
- }), r += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : n ? r += "\\/*$" : e !== "" && e !== "/" && (r += "(?:(?=\\/|$))"), [new RegExp(r, t ? void 0 : "i"), a];
98
- }
99
- function ie(e, t) {
100
- if (t === "/") return e;
101
- if (!e.toLowerCase().startsWith(t.toLowerCase()))
102
- return null;
103
- let n = t.endsWith("/") ? t.length - 1 : t.length, a = e.charAt(n);
104
- return a && a !== "/" ? null : e.slice(n) || "/";
105
- }
106
- function q(e, t) {
107
- t === void 0 && (t = "/");
108
- let {
109
- pathname: n,
110
- search: a = "",
111
- hash: r = ""
112
- } = typeof e == "string" ? D(e) : e;
113
- return {
114
- pathname: n ? n.startsWith("/") ? n : z(n, t) : t,
115
- search: G(a),
116
- hash: Y(r)
117
- };
118
- }
119
- function z(e, t) {
120
- let n = t.replace(/\/+$/, "").split("/");
121
- return e.split("/").forEach((r) => {
122
- r === ".." ? n.length > 1 && n.pop() : r !== "." && n.push(r);
123
- }), n.length > 1 ? n.join("/") : "/";
124
- }
125
- function g(e, t, n, a) {
126
- return "Cannot include a '" + e + "' character in a manually specified " + ("`to." + t + "` field [" + JSON.stringify(a) + "]. 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.';
127
- }
128
- function F(e) {
129
- return e.filter((t, n) => n === 0 || t.route.path && t.route.path.length > 0);
130
- }
131
- function S(e, t) {
132
- let n = F(e);
133
- return t ? n.map((a, r) => r === n.length - 1 ? a.pathname : a.pathnameBase) : n.map((a) => a.pathnameBase);
134
- }
135
- function U(e, t, n, a) {
136
- a === void 0 && (a = !1);
137
- let r;
138
- typeof e == "string" ? r = D(e) : (r = N({}, e), u(!r.pathname || !r.pathname.includes("?"), g("?", "pathname", "search", r)), u(!r.pathname || !r.pathname.includes("#"), g("#", "pathname", "hash", r)), u(!r.search || !r.search.includes("#"), g("#", "search", "hash", r)));
139
- let i = e === "" || r.pathname === "", o = i ? "/" : r.pathname, l;
140
- if (o == null)
141
- l = n;
142
- else {
143
- let f = t.length - 1;
144
- if (!a && o.startsWith("..")) {
145
- let p = o.split("/");
146
- for (; p[0] === ".."; )
147
- p.shift(), f -= 1;
148
- r.pathname = p.join("/");
149
- }
150
- l = f >= 0 ? t[f] : "/";
151
- }
152
- let c = q(r, l), d = o && o !== "/" && o.endsWith("/"), h = (i || o === ".") && n.endsWith("/");
153
- return !c.pathname.endsWith("/") && (d || h) && (c.pathname += "/"), c;
154
- }
155
- const _ = (e) => e.join("/").replace(/\/\/+/g, "/"), G = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, Y = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, V = ["post", "put", "patch", "delete"];
156
- new Set(V);
157
- const K = ["get", ...V];
158
- new Set(K);
159
- /**
160
- * React Router v6.28.0
161
- *
162
- * Copyright (c) Remix Software Inc.
163
- *
164
- * This source code is licensed under the MIT license found in the
165
- * LICENSE.md file in the root directory of this source tree.
166
- *
167
- * @license MIT
168
- */
169
- function x() {
170
- return x = Object.assign ? Object.assign.bind() : function(e) {
171
- for (var t = 1; t < arguments.length; t++) {
172
- var n = arguments[t];
173
- for (var a in n)
174
- Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
175
- }
176
- return e;
177
- }, x.apply(this, arguments);
178
- }
179
- const C = /* @__PURE__ */ s.createContext(null);
180
- process.env.NODE_ENV !== "production" && (C.displayName = "DataRouter");
181
- const Q = /* @__PURE__ */ s.createContext(null);
182
- process.env.NODE_ENV !== "production" && (Q.displayName = "DataRouterState");
183
- const X = /* @__PURE__ */ s.createContext(null);
184
- process.env.NODE_ENV !== "production" && (X.displayName = "Await");
185
- const m = /* @__PURE__ */ s.createContext(null);
186
- process.env.NODE_ENV !== "production" && (m.displayName = "Navigation");
187
- const y = /* @__PURE__ */ s.createContext(null);
188
- process.env.NODE_ENV !== "production" && (y.displayName = "Location");
189
- const v = /* @__PURE__ */ s.createContext({
190
- outlet: null,
191
- matches: [],
192
- isDataRoute: !1
193
- });
194
- process.env.NODE_ENV !== "production" && (v.displayName = "Route");
195
- const Z = /* @__PURE__ */ s.createContext(null);
196
- process.env.NODE_ENV !== "production" && (Z.displayName = "RouteError");
197
- function oe(e, t) {
198
- let {
199
- relative: n
200
- } = t === void 0 ? {} : t;
201
- R() || (process.env.NODE_ENV !== "production" ? u(
202
- !1,
203
- // TODO: This error is probably because they somehow have 2 versions of the
204
- // router loaded. We can help them understand how to avoid that.
205
- "useHref() may be used only in the context of a <Router> component."
206
- ) : u(!1));
207
- let {
208
- basename: a,
209
- navigator: r
210
- } = s.useContext(m), {
211
- hash: i,
212
- pathname: o,
213
- search: l
214
- } = k(e, {
215
- relative: n
216
- }), c = o;
217
- return a !== "/" && (c = o === "/" ? a : _([a, o])), r.createHref({
218
- pathname: c,
219
- search: l,
220
- hash: i
221
- });
222
- }
223
- function R() {
224
- return s.useContext(y) != null;
225
- }
226
- function $() {
227
- return R() || (process.env.NODE_ENV !== "production" ? u(
228
- !1,
229
- // TODO: This error is probably because they somehow have 2 versions of the
230
- // router loaded. We can help them understand how to avoid that.
231
- "useLocation() may be used only in the context of a <Router> component."
232
- ) : u(!1)), s.useContext(y).location;
233
- }
234
- const I = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
235
- function L(e) {
236
- s.useContext(m).static || s.useLayoutEffect(e);
237
- }
238
- function ue() {
239
- let {
240
- isDataRoute: e
241
- } = s.useContext(v);
242
- return e ? ne() : H();
243
- }
244
- function H() {
245
- R() || (process.env.NODE_ENV !== "production" ? u(
246
- !1,
247
- // TODO: This error is probably because they somehow have 2 versions of the
248
- // router loaded. We can help them understand how to avoid that.
249
- "useNavigate() may be used only in the context of a <Router> component."
250
- ) : u(!1));
251
- let e = s.useContext(C), {
252
- basename: t,
253
- future: n,
254
- navigator: a
255
- } = s.useContext(m), {
256
- matches: r
257
- } = s.useContext(v), {
258
- pathname: i
259
- } = $(), o = JSON.stringify(S(r, n.v7_relativeSplatPath)), l = s.useRef(!1);
260
- return L(() => {
261
- l.current = !0;
262
- }), s.useCallback(function(d, h) {
263
- if (h === void 0 && (h = {}), process.env.NODE_ENV !== "production" && E(l.current, I), !l.current) return;
264
- if (typeof d == "number") {
265
- a.go(d);
266
- return;
267
- }
268
- let f = U(d, JSON.parse(o), i, h.relative === "path");
269
- e == null && t !== "/" && (f.pathname = f.pathname === "/" ? t : _([t, f.pathname])), (h.replace ? a.replace : a.push)(f, h.state, h);
270
- }, [t, a, o, i, e]);
271
- }
272
- function k(e, t) {
273
- let {
274
- relative: n
275
- } = t === void 0 ? {} : t, {
276
- future: a
277
- } = s.useContext(m), {
278
- matches: r
279
- } = s.useContext(v), {
280
- pathname: i
281
- } = $(), o = JSON.stringify(S(r, a.v7_relativeSplatPath));
282
- return s.useMemo(() => U(e, JSON.parse(o), i, n === "path"), [e, o, i, n]);
283
- }
284
- var W = /* @__PURE__ */ function(e) {
285
- return e.UseBlocker = "useBlocker", e.UseRevalidator = "useRevalidator", e.UseNavigateStable = "useNavigate", e;
286
- }(W || {}), O = /* @__PURE__ */ function(e) {
287
- 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;
288
- }(O || {});
289
- function j(e) {
290
- return e + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
291
- }
292
- function ee(e) {
293
- let t = s.useContext(C);
294
- return t || (process.env.NODE_ENV !== "production" ? u(!1, j(e)) : u(!1)), t;
295
- }
296
- function te(e) {
297
- let t = s.useContext(v);
298
- return t || (process.env.NODE_ENV !== "production" ? u(!1, j(e)) : u(!1)), t;
299
- }
300
- function B(e) {
301
- let t = te(e), n = t.matches[t.matches.length - 1];
302
- return n.route.id || (process.env.NODE_ENV !== "production" ? u(!1, e + ' can only be used on routes that contain a unique "id"') : u(!1)), n.route.id;
303
- }
304
- function le() {
305
- return B(O.UseRouteId);
306
- }
307
- function ne() {
308
- let {
309
- router: e
310
- } = ee(W.UseNavigateStable), t = B(O.UseNavigateStable), n = s.useRef(!1);
311
- return L(() => {
312
- n.current = !0;
313
- }), s.useCallback(function(r, i) {
314
- i === void 0 && (i = {}), process.env.NODE_ENV !== "production" && E(n.current, I), n.current && (typeof r == "number" ? e.navigate(r) : e.navigate(r, x({
315
- fromRouteId: t
316
- }, i)));
317
- }, [e, t]);
318
- }
319
- new Promise(() => {
320
- });
321
- const ce = () => ({
322
- isInsideRouter: J(v).outlet !== null
323
- });
324
- export {
325
- Q as D,
326
- m as N,
327
- v as R,
328
- ue as a,
329
- $ as b,
330
- k as c,
331
- re as d,
332
- le as e,
333
- C as f,
334
- ce as g,
335
- u as i,
336
- _ as j,
337
- se as m,
338
- ie as s,
339
- oe as u,
340
- E as w
341
- };