@rpcbase/ui 0.261.0 → 0.263.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.
Files changed (261) hide show
  1. package/dist/assets/sha256.worker-BEf4_Y9w.js.map +1 -0
  2. package/dist/components/FilesUploadField/index.d.ts +19 -6
  3. package/dist/components/FilesUploadField/index.d.ts.map +1 -1
  4. package/dist/components/FilesUploadField/sha256.d.ts +5 -0
  5. package/dist/components/FilesUploadField/sha256.d.ts.map +1 -0
  6. package/dist/components/FilesUploadField/sha256.worker.d.ts +4 -0
  7. package/dist/components/FilesUploadField/sha256.worker.d.ts.map +1 -0
  8. package/dist/components/ImagesField/index.d.ts +4 -2
  9. package/dist/components/ImagesField/index.d.ts.map +1 -1
  10. package/dist/index.js +10 -10
  11. package/dist/index298.js +11 -803
  12. package/dist/index298.js.map +1 -1
  13. package/dist/index299.js +865 -28
  14. package/dist/index299.js.map +1 -1
  15. package/dist/index300.js +26 -510
  16. package/dist/index300.js.map +1 -1
  17. package/dist/index301.js +481 -755
  18. package/dist/index301.js.map +1 -1
  19. package/dist/index302.js +786 -7428
  20. package/dist/index302.js.map +1 -1
  21. package/dist/index303.js +7429 -7
  22. package/dist/index303.js.map +1 -1
  23. package/dist/index304.js +6 -12
  24. package/dist/index304.js.map +1 -1
  25. package/dist/index305.js +12 -5
  26. package/dist/index305.js.map +1 -1
  27. package/dist/index306.js +3 -3
  28. package/dist/index306.js.map +1 -1
  29. package/dist/index307.js +5 -469
  30. package/dist/index307.js.map +1 -1
  31. package/dist/index308.js +464 -32
  32. package/dist/index308.js.map +1 -1
  33. package/dist/index309.js +36 -18
  34. package/dist/index309.js.map +1 -1
  35. package/dist/index310.js +17 -28
  36. package/dist/index310.js.map +1 -1
  37. package/dist/index311.js +30 -4
  38. package/dist/index311.js.map +1 -1
  39. package/dist/index312.js +4 -59
  40. package/dist/index312.js.map +1 -1
  41. package/dist/index313.js +59 -9
  42. package/dist/index313.js.map +1 -1
  43. package/dist/index314.js +9 -5
  44. package/dist/index314.js.map +1 -1
  45. package/dist/index315.js +5 -9
  46. package/dist/index315.js.map +1 -1
  47. package/dist/index316.js +9 -12
  48. package/dist/index316.js.map +1 -1
  49. package/dist/index317.js +13 -3
  50. package/dist/index317.js.map +1 -1
  51. package/dist/index318.js +3 -17
  52. package/dist/index318.js.map +1 -1
  53. package/dist/index319.js +14 -23
  54. package/dist/index319.js.map +1 -1
  55. package/dist/index320.js +23 -39
  56. package/dist/index320.js.map +1 -1
  57. package/dist/index321.js +41 -5
  58. package/dist/index321.js.map +1 -1
  59. package/dist/index322.js +5 -25
  60. package/dist/index322.js.map +1 -1
  61. package/dist/index323.js +24 -18
  62. package/dist/index323.js.map +1 -1
  63. package/dist/index324.js +17 -32
  64. package/dist/index324.js.map +1 -1
  65. package/dist/index325.js +34 -5
  66. package/dist/index325.js.map +1 -1
  67. package/dist/index326.js +5 -9
  68. package/dist/index326.js.map +1 -1
  69. package/dist/index327.js +8 -7
  70. package/dist/index327.js.map +1 -1
  71. package/dist/index328.js +8 -9
  72. package/dist/index328.js.map +1 -1
  73. package/dist/index329.js +9 -10
  74. package/dist/index329.js.map +1 -1
  75. package/dist/index330.js +10 -7
  76. package/dist/index330.js.map +1 -1
  77. package/dist/index331.js +7 -75
  78. package/dist/index331.js.map +1 -1
  79. package/dist/index332.js +66 -153
  80. package/dist/index332.js.map +1 -1
  81. package/dist/index333.js +147 -99
  82. package/dist/index333.js.map +1 -1
  83. package/dist/index334.js +113 -13
  84. package/dist/index334.js.map +1 -1
  85. package/dist/index335.js +12 -78
  86. package/dist/index335.js.map +1 -1
  87. package/dist/index336.js +57 -23
  88. package/dist/index336.js.map +1 -1
  89. package/dist/index337.js +45 -12
  90. package/dist/index337.js.map +1 -1
  91. package/dist/index338.js +13 -16
  92. package/dist/index338.js.map +1 -1
  93. package/dist/index339.js +15 -100
  94. package/dist/index339.js.map +1 -1
  95. package/dist/index340.js +95 -50
  96. package/dist/index340.js.map +1 -1
  97. package/dist/index341.js +5 -57
  98. package/dist/index341.js.map +1 -1
  99. package/dist/index342.js +78 -41
  100. package/dist/index342.js.map +1 -1
  101. package/dist/index343.js +58 -100
  102. package/dist/index343.js.map +1 -1
  103. package/dist/index344.js +104 -46
  104. package/dist/index344.js.map +1 -1
  105. package/dist/index345.js +51 -39
  106. package/dist/index345.js.map +1 -1
  107. package/dist/index346.js +42 -142
  108. package/dist/index346.js.map +1 -1
  109. package/dist/index347.js +123 -120
  110. package/dist/index347.js.map +1 -1
  111. package/dist/index348.js +108 -224
  112. package/dist/index348.js.map +1 -1
  113. package/dist/index349.js +174 -158
  114. package/dist/index349.js.map +1 -1
  115. package/dist/index350.js +144 -213
  116. package/dist/index350.js.map +1 -1
  117. package/dist/index351.js +309 -5
  118. package/dist/index351.js.map +1 -1
  119. package/dist/index352.js +5 -6
  120. package/dist/index352.js.map +1 -1
  121. package/dist/index353.js +6 -7
  122. package/dist/index353.js.map +1 -1
  123. package/dist/index354.js +5 -4
  124. package/dist/index354.js.map +1 -1
  125. package/dist/index355.js +4 -4
  126. package/dist/index355.js.map +1 -1
  127. package/dist/index356.js +6 -21
  128. package/dist/index356.js.map +1 -1
  129. package/dist/index357.js +21 -10
  130. package/dist/index357.js.map +1 -1
  131. package/dist/index358.js +10 -128
  132. package/dist/index358.js.map +1 -1
  133. package/dist/index359.js +122 -36
  134. package/dist/index359.js.map +1 -1
  135. package/dist/index360.js +38 -64
  136. package/dist/index360.js.map +1 -1
  137. package/dist/index361.js +66 -115
  138. package/dist/index361.js.map +1 -1
  139. package/dist/index362.js +112 -485
  140. package/dist/index362.js.map +1 -1
  141. package/dist/index363.js +490 -13
  142. package/dist/index363.js.map +1 -1
  143. package/dist/index364.js +13 -4
  144. package/dist/index364.js.map +1 -1
  145. package/dist/index365.js +4 -47
  146. package/dist/index365.js.map +1 -1
  147. package/dist/index366.js +44 -15
  148. package/dist/index366.js.map +1 -1
  149. package/dist/index367.js +19 -5
  150. package/dist/index367.js.map +1 -1
  151. package/dist/index368.js +5 -27
  152. package/dist/index368.js.map +1 -1
  153. package/dist/index369.js +27 -48
  154. package/dist/index369.js.map +1 -1
  155. package/dist/index370.js +46 -27
  156. package/dist/index370.js.map +1 -1
  157. package/dist/index371.js +27 -16
  158. package/dist/index371.js.map +1 -1
  159. package/dist/index372.js +16 -41
  160. package/dist/index372.js.map +1 -1
  161. package/dist/index373.js +42 -14
  162. package/dist/index373.js.map +1 -1
  163. package/dist/index374.js +14 -10
  164. package/dist/index374.js.map +1 -1
  165. package/dist/index375.js +9 -51
  166. package/dist/index375.js.map +1 -1
  167. package/dist/index376.js +53 -43
  168. package/dist/index376.js.map +1 -1
  169. package/dist/index377.js +43 -16
  170. package/dist/index377.js.map +1 -1
  171. package/dist/index378.js +15 -4
  172. package/dist/index378.js.map +1 -1
  173. package/dist/index379.js +4 -4
  174. package/dist/index379.js.map +1 -1
  175. package/dist/index380.js +4 -9
  176. package/dist/index380.js.map +1 -1
  177. package/dist/index381.js +9 -340
  178. package/dist/index381.js.map +1 -1
  179. package/dist/index382.js +339 -4
  180. package/dist/index382.js.map +1 -1
  181. package/dist/index383.js +5 -16
  182. package/dist/index383.js.map +1 -1
  183. package/dist/index384.js +16 -111
  184. package/dist/index384.js.map +1 -1
  185. package/dist/index385.js +109 -19
  186. package/dist/index385.js.map +1 -1
  187. package/dist/index386.js +18 -18
  188. package/dist/index386.js.map +1 -1
  189. package/dist/index387.js +21 -5
  190. package/dist/index387.js.map +1 -1
  191. package/dist/index388.js +5 -20
  192. package/dist/index388.js.map +1 -1
  193. package/dist/index389.js +19 -13
  194. package/dist/index389.js.map +1 -1
  195. package/dist/index390.js +13 -84
  196. package/dist/index390.js.map +1 -1
  197. package/dist/index391.js +84 -7
  198. package/dist/index391.js.map +1 -1
  199. package/dist/index392.js +9 -29
  200. package/dist/index392.js.map +1 -1
  201. package/dist/index393.js +28 -9
  202. package/dist/index393.js.map +1 -1
  203. package/dist/index394.js +9 -5
  204. package/dist/index394.js.map +1 -1
  205. package/dist/index395.js +6 -252
  206. package/dist/index395.js.map +1 -1
  207. package/dist/index396.js +250 -10
  208. package/dist/index396.js.map +1 -1
  209. package/dist/index397.js +11 -10
  210. package/dist/index397.js.map +1 -1
  211. package/dist/index398.js +10 -6
  212. package/dist/index398.js.map +1 -1
  213. package/dist/index399.js +6 -22
  214. package/dist/index399.js.map +1 -1
  215. package/dist/index400.js +21 -21
  216. package/dist/index400.js.map +1 -1
  217. package/dist/index401.js +21 -107
  218. package/dist/index401.js.map +1 -1
  219. package/dist/index402.js +109 -15
  220. package/dist/index402.js.map +1 -1
  221. package/dist/index403.js +15 -12
  222. package/dist/index403.js.map +1 -1
  223. package/dist/index404.js +10 -8
  224. package/dist/index404.js.map +1 -1
  225. package/dist/index405.js +8 -242
  226. package/dist/index405.js.map +1 -1
  227. package/dist/index406.js +238 -25
  228. package/dist/index406.js.map +1 -1
  229. package/dist/index407.js +29 -51
  230. package/dist/index407.js.map +1 -1
  231. package/dist/index408.js +51 -10
  232. package/dist/index408.js.map +1 -1
  233. package/dist/index409.js +11 -128
  234. package/dist/index409.js.map +1 -1
  235. package/dist/index410.js +124 -35
  236. package/dist/index410.js.map +1 -1
  237. package/dist/index411.js +36 -23
  238. package/dist/index411.js.map +1 -1
  239. package/dist/index412.js +26 -11
  240. package/dist/index412.js.map +1 -1
  241. package/dist/index413.js +11 -23
  242. package/dist/index413.js.map +1 -1
  243. package/dist/index414.js +19 -13
  244. package/dist/index414.js.map +1 -1
  245. package/dist/index415.js +14 -13
  246. package/dist/index415.js.map +1 -1
  247. package/dist/index416.js +14 -322
  248. package/dist/index416.js.map +1 -1
  249. package/dist/index417.js +323 -61
  250. package/dist/index417.js.map +1 -1
  251. package/dist/index418.js +63 -4
  252. package/dist/index418.js.map +1 -1
  253. package/dist/index419.js +4 -28
  254. package/dist/index419.js.map +1 -1
  255. package/dist/index420.js +25 -468
  256. package/dist/index420.js.map +1 -1
  257. package/dist/index421.js +452 -250
  258. package/dist/index421.js.map +1 -1
  259. package/dist/index422.js +272 -0
  260. package/dist/index422.js.map +1 -0
  261. package/package.json +2 -1
package/dist/index362.js CHANGED
@@ -1,494 +1,121 @@
1
1
  import { cn as e } from "./index12.js";
2
- import { getCountryCallingCode as t } from "./index355.js";
3
- import { resolveMessages as n } from "./index356.js";
4
- import { COMMON_IDD_PREFIXES as r, buildFallbackSelectedCountry as i, getCachedCountryOptions as a, getLocaleCacheKey as o, getValidCountry as s, normalizeSearchValue as ee, optionMatchIndex as c, parseLocaleCacheKey as l, toSelectedCountry as te } from "./index358.js";
5
- import { formatWithAsYouType as u, getLengthIssue as d, sanitizeDigits as f, stripPrefix as ne } from "./index359.js";
6
- import { captureSelectionSnapshot as p, resolveSelection as m, skipFormattingCharactersLeft as re, skipFormattingCharactersRight as ie } from "./index360.js";
7
- import { HiddenControl as ae, NullComponent as h, SuggestionContext as oe, SuggestionOption as se, formatCountryOption as ce, suggestionSelectStyles as le } from "./index361.js";
8
- import * as g from "react";
9
- import { jsx as _, jsxs as ue } from "react/jsx-runtime";
10
- import de from "react-select";
11
- //#region src/components/PhoneNumberInput/index.tsx
12
- var v = /[\u061C\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g;
13
- function y(e) {
14
- return e.replace(v, "");
15
- }
16
- function b(e) {
17
- for (let t of r) if (e.startsWith(t)) return e.slice(t.length);
18
- return e;
19
- }
20
- function fe(e) {
21
- let t = `+${e}`, { phoneNumber: n, detectedCountry: r } = u(t);
22
- return n?.isValid() && r ? t : null;
23
- }
24
- function pe(e) {
25
- let t = y(e).trim();
26
- if (!t) return null;
27
- if (t.startsWith("+")) {
28
- let e = f(t);
29
- if (!e) return "+";
30
- let n = b(e);
31
- return n ? `+${n}` : "+";
2
+ import { c as t } from "react/compiler-runtime";
3
+ import * as n from "react";
4
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ //#region src/components/PhoneNumberInput/suggestions.tsx
6
+ var o = n.createContext(null);
7
+ function s(e, t) {
8
+ if (typeof e == "function") {
9
+ e(t);
10
+ return;
32
11
  }
33
- let n = f(t);
34
- if (!n) return null;
35
- let r = b(n);
36
- return r === n ? null : r ? `+${r}` : "+";
37
- }
38
- function me(e) {
39
- let t = pe(e);
40
- if (t != null) return t;
41
- let n = f(y(e).trim());
42
- return n ? fe(n) : null;
43
- }
44
- function he(e, n) {
45
- return n || (e ? t(e) : null);
12
+ e && typeof e == "object" && Reflect.set(e, "current", t);
46
13
  }
47
- function ge(e, t, n) {
48
- let r = y(e).trim(), i = f(r);
49
- if (!i) return `+${t.dialCode}`;
50
- let a = n?.allowImplicitInternational === !1 ? pe(r) : me(r);
51
- if (a) {
52
- let e = f(a);
53
- if (e.startsWith(t.dialCode)) return a;
54
- let { phoneNumber: n } = u(a), r = n?.countryCallingCode, i = r && e.startsWith(r) ? e.slice(r.length) : n?.nationalNumber ?? e;
55
- return `+${t.dialCode}${i}`;
56
- }
57
- let { phoneNumber: o } = u(r, t.value);
58
- return `+${t.dialCode}${o?.nationalNumber ?? i}`;
59
- }
60
- function _e(e, t) {
61
- return {
14
+ var c = (r) => {
15
+ let a = t(30), c = n.useContext(o), l = c?.highlightedValue === r.data.value, u, d, f;
16
+ a[0] === r.innerProps ? (u = a[1], d = a[2], f = a[3]) : ({onMouseMove: u, className: d, ...f} = r.innerProps, a[0] = r.innerProps, a[1] = u, a[2] = d, a[3] = f);
17
+ let m;
18
+ a[4] === c?.renderOptionLabel ? m = a[5] : (m = c?.renderOptionLabel ?? p, a[4] = c?.renderOptionLabel, a[5] = m);
19
+ let h = m, g = n.useRef(null), { innerRef: _ } = r, v;
20
+ a[6] === _ ? v = a[7] : (v = (e) => {
21
+ g.current = e, s(_, e);
22
+ }, a[6] = _, a[7] = v);
23
+ let y = v, b;
24
+ a[8] !== c?.consumeScrollBehavior || a[9] !== l ? (b = () => {
25
+ if (!l) return;
26
+ let e = c?.consumeScrollBehavior, t = e ? e() : "smooth", n = g.current;
27
+ if (!n) return;
28
+ let r = n.parentElement;
29
+ if (!r) return;
30
+ let i = n.offsetTop, a = i + n.offsetHeight, o = r.scrollTop, s = o + r.clientHeight;
31
+ i >= o && a <= s || n.scrollIntoView({
32
+ block: "nearest",
33
+ behavior: t
34
+ });
35
+ }, a[8] = c?.consumeScrollBehavior, a[9] = l, a[10] = b) : b = a[10];
36
+ let x;
37
+ a[11] !== c || a[12] !== l ? (x = [c, l], a[11] = c, a[12] = l, a[13] = x) : x = a[13], n.useEffect(b, x);
38
+ let S;
39
+ a[14] !== c || a[15] !== u || a[16] !== r.data ? (S = (e) => {
40
+ u?.(e), c?.setHighlightedOption(r.data);
41
+ }, a[14] = c, a[15] = u, a[16] = r.data, a[17] = S) : S = a[17];
42
+ let C = S, w = l ? "bg-muted text-foreground" : "text-foreground hover:bg-muted", T;
43
+ a[18] !== d || a[19] !== w ? (T = e("flex cursor-pointer items-center justify-between gap-3 px-3 py-2 text-sm", d, w), a[18] = d, a[19] = w, a[20] = T) : T = a[20];
44
+ let E;
45
+ a[21] !== r.data || a[22] !== h ? (E = h(r.data), a[21] = r.data, a[22] = h, a[23] = E) : E = a[23];
46
+ let D;
47
+ return a[24] !== y || a[25] !== C || a[26] !== f || a[27] !== T || a[28] !== E ? (D = /* @__PURE__ */ i("div", {
48
+ ref: y,
49
+ ...f,
50
+ onMouseMove: C,
51
+ className: T,
52
+ children: E
53
+ }), a[24] = y, a[25] = C, a[26] = f, a[27] = T, a[28] = E, a[29] = D) : D = a[29], D;
54
+ }, l = {
55
+ control: () => ({ display: "none" }),
56
+ menu: (e) => ({
57
+ ...e,
58
+ marginTop: 4,
59
+ borderRadius: "var(--radius)",
60
+ boxShadow: "0 18px 36px rgba(15, 23, 42, 0.18)",
61
+ backgroundColor: "hsl(var(--popover))",
62
+ overflow: "hidden",
63
+ zIndex: 20
64
+ }),
65
+ menuList: (e) => ({
62
66
  ...e,
63
- country: t.value,
64
- countryCallingCode: t.dialCode,
65
- lengthIssue: d(e.rawInput, t.value)
66
- };
67
+ maxHeight: 240,
68
+ padding: 0
69
+ }),
70
+ option: (e, t) => ({
71
+ ...e,
72
+ fontSize: "0.875rem",
73
+ backgroundColor: t.isFocused ? "hsl(var(--muted))" : t.isSelected ? "hsl(var(--accent))" : "transparent",
74
+ color: t.isSelected ? "hsl(var(--accent-foreground))" : "hsl(var(--foreground))",
75
+ cursor: "pointer"
76
+ }),
77
+ noOptionsMessage: (e) => ({
78
+ ...e,
79
+ fontSize: "0.875rem",
80
+ color: "hsl(var(--muted-foreground))"
81
+ })
82
+ }, u = (e) => {
83
+ let n = t(5), { children: r, innerProps: a, innerRef: o } = e, s;
84
+ n[0] === Symbol.for("react.memo_cache_sentinel") ? (s = {
85
+ height: 0,
86
+ minHeight: 0,
87
+ opacity: 0,
88
+ overflow: "hidden",
89
+ pointerEvents: "none"
90
+ }, n[0] = s) : s = n[0];
91
+ let c;
92
+ return n[1] !== r || n[2] !== a || n[3] !== o ? (c = /* @__PURE__ */ i("div", {
93
+ ...a,
94
+ ref: o,
95
+ style: s,
96
+ children: r
97
+ }), n[1] = r, n[2] = a, n[3] = o, n[4] = c) : c = n[4], c;
98
+ }, d = () => null;
99
+ function f(e) {
100
+ return /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ a("span", {
101
+ className: "flex min-w-0 items-center gap-2",
102
+ children: [e.flag ? /* @__PURE__ */ i("span", {
103
+ "aria-hidden": "true",
104
+ className: "text-lg leading-none",
105
+ children: e.flag
106
+ }) : null, /* @__PURE__ */ i("span", {
107
+ className: "truncate",
108
+ children: e.name
109
+ })]
110
+ }), /* @__PURE__ */ a("span", {
111
+ className: "text-xs text-muted-foreground",
112
+ children: ["+", e.dialCode]
113
+ })] });
67
114
  }
68
- function x(e, n) {
69
- let r = y(e ?? "").trim();
70
- if (!r) {
71
- let e = n ?? null;
72
- return {
73
- displayValue: "",
74
- formattedInternational: "",
75
- formattedNational: "",
76
- e164: null,
77
- country: e,
78
- countryCallingCode: e ? t(e) : null,
79
- nationalNumber: "",
80
- rawInput: "",
81
- isValid: !1,
82
- lengthIssue: null
83
- };
84
- }
85
- let i = me(r);
86
- if (!(i != null || n != null)) return {
87
- displayValue: r,
88
- formattedInternational: r,
89
- formattedNational: r,
90
- e164: null,
91
- country: null,
92
- countryCallingCode: null,
93
- nationalNumber: f(r),
94
- rawInput: r,
95
- isValid: !1,
96
- lengthIssue: null
97
- };
98
- let a = i ?? r, { international: o, national: s, formatted: ee, phoneNumber: c, detectedCountry: l } = u(a, n), te = i != null, p = te ? l ?? n ?? null : n ?? l ?? null, m = he(p, c?.countryCallingCode), re = f(a), ie = c?.nationalNumber ?? (m && a.startsWith("+") ? ne(re, m) : f(r));
99
- return {
100
- displayValue: te ? o : ee,
101
- formattedInternational: c?.formatInternational() ?? o,
102
- formattedNational: c?.formatNational() ?? s,
103
- e164: c?.number ?? null,
104
- country: p,
105
- countryCallingCode: m,
106
- nationalNumber: ie,
107
- rawInput: a,
108
- isValid: c?.isValid() ?? !1,
109
- lengthIssue: p ? d(a, p) : null
110
- };
115
+ function p(e) {
116
+ return f(e);
111
117
  }
112
- var S = g.forwardRef(function(r, u) {
113
- let { value: d, defaultCountry: ne, country: v, locale: y, onChange: b, onCountryChange: fe, className: me, inputClassName: he, disabled: S, readOnly: C, selectProps: ve, autofillShimName: ye, messages: be, renderValidationMessage: xe, ...Se } = r, { onFocus: Ce, onBlur: we, onKeyDown: Te, name: Ee, autoComplete: De, ...Oe } = Se, w = typeof v == "string" ? v : null, T = o(y), E = g.useMemo(() => l(T), [T]), D = g.useMemo(() => n(E, be), [E, be]), O = g.useMemo(() => a(E, T), [T, E]), k = g.useCallback((e) => {
114
- let t = O.find((t) => t.value === e);
115
- return t ? te(t) : i(e);
116
- }, [O]), ke = g.useMemo(() => {
117
- let e = s(ne ?? v ?? "US");
118
- return O.some((t) => t.value === e) ? e : O[0]?.value ?? "US";
119
- }, [
120
- O,
121
- v,
122
- ne
123
- ]), Ae = g.useRef(null);
124
- Ae.current ||= x(d, w ?? void 0);
125
- let je = Ae.current, [A, Me] = g.useState(w ? null : je.country), [j, Ne] = g.useState(je.displayValue), [M, N] = g.useState(""), [P, F] = g.useState(!1), [I, L] = g.useState(-1), [Pe, Fe] = g.useState(!1), [Ie, Le] = g.useState(!1), [Re, R] = g.useState(je.lengthIssue), z = g.useRef(null), B = g.useRef(""), V = g.useRef(null), H = g.useRef("smooth"), U = g.useRef(null), ze = g.useRef(!1), Be = g.useRef(null), W = g.useRef(null), G = w ?? A, Ve = w ?? z.current ?? void 0;
126
- g.useImperativeHandle(u, () => W.current, []), g.useLayoutEffect(() => {
127
- Le(!0);
128
- }, []), g.useLayoutEffect(() => {
129
- let e = U.current;
130
- if (!e) return;
131
- let t = W.current;
132
- if (U.current = null, !t) return;
133
- let { start: n, end: r } = e;
134
- t.setSelectionRange(n, r);
135
- }, [j]);
136
- let He = ve ?? {}, Ue = g.useId(), { styles: We, components: Ge, classNamePrefix: Ke, formatOptionLabel: qe, menuPortalTarget: Je, menuPosition: Ye, ...Xe } = He, { instanceId: Ze, noOptionsMessage: Qe, ...$e } = Xe, et = Ze ?? Ue, [tt, nt] = g.useState(null), rt = "menuPortalTarget" in He, K = rt ? Je : tt, it = g.useMemo(() => {
137
- let e = We?.menuPortal;
138
- return {
139
- ...le,
140
- ...We ?? {},
141
- menuPortal: (t, n) => {
142
- let r = {
143
- ...t,
144
- zIndex: 1300
145
- }, i = e ? e(r, n) : r;
146
- if (typeof document > "u" || !K || K === document.body) return i;
147
- let a = K.getBoundingClientRect();
148
- return {
149
- ...i,
150
- left: typeof i.left == "number" ? i.left - a.left : i.left,
151
- top: typeof i.top == "number" ? i.top - a.top : i.top
152
- };
153
- }
154
- };
155
- }, [K, We]);
156
- g.useLayoutEffect(() => {
157
- if (rt || typeof document > "u") return;
158
- let e = W.current?.closest("[data-slot='dialog-content'], [data-slot='sheet-content'], [role='dialog']") ?? document.body;
159
- nt(e);
160
- }, [rt]);
161
- let at = g.useMemo(() => {
162
- let e = {
163
- Control: ae,
164
- IndicatorsContainer: h,
165
- DropdownIndicator: h,
166
- IndicatorSeparator: h,
167
- ValueContainer: h
168
- }, t = Ge ?? {};
169
- return t.Option ? {
170
- ...e,
171
- ...t
172
- } : {
173
- ...e,
174
- ...t,
175
- Option: se
176
- };
177
- }, [Ge]);
178
- g.useEffect(() => () => {
179
- V.current != null && typeof window < "u" && window.clearTimeout(V.current);
180
- }, []), g.useEffect(() => {
181
- if (d == null) return;
182
- let e = x(d, Ve);
183
- B.current = "", Ne(e.displayValue), F(!1), N(""), L(-1), R(e.lengthIssue), !w && e.country !== A && Me(e.country);
184
- }, [
185
- w,
186
- Ve,
187
- A,
188
- d
189
- ]), g.useEffect(() => {
190
- let e = G ?? null;
191
- !ze.current && e == null || ze.current && Be.current === e || (ze.current = !0, Be.current = e, fe?.(e, e ? k(e) : null));
192
- }, [
193
- G,
194
- fe,
195
- k
196
- ]);
197
- let q = g.useCallback((e) => {
198
- b?.({
199
- ...e,
200
- selectedCountry: e.country ? k(e.country) : null
201
- });
202
- }, [b, k]), J = g.useCallback(() => {
203
- typeof window > "u" || (V.current != null && window.clearTimeout(V.current), V.current = window.setTimeout(() => {
204
- B.current = "", V.current = null;
205
- }, 800));
206
- }, []), ot = g.useCallback((e, t) => {
207
- Ne(e.displayValue), F(!1), N(""), L(-1), R(e.lengthIssue), !w && e.country !== A && Me(e.country), t && (U.current = m(t, e.displayValue)), q({
208
- formattedInternational: e.formattedInternational,
209
- formattedNational: e.formattedNational,
210
- e164: e.e164,
211
- country: e.country,
212
- countryCallingCode: e.countryCallingCode,
213
- nationalNumber: e.nationalNumber,
214
- rawInput: e.rawInput,
215
- isValid: e.isValid
216
- });
217
- }, [
218
- w,
219
- q,
220
- A
221
- ]), st = g.useCallback((e) => {
222
- let n = e.target, r = p(n), i = n.value;
223
- B.current = "";
224
- let a = pe(i), o = z.current;
225
- if (a != null && o) {
226
- let e = t(o);
227
- f(a).startsWith(e) || (z.current = null);
228
- } else a != null && (z.current = null);
229
- let s = z.current, ee = f(i);
230
- if (!w && s && a == null && ee) {
231
- let e = {
232
- value: s,
233
- dialCode: t(s)
234
- }, n = _e(x(ge(i, {
235
- value: e.value,
236
- dialCode: e.dialCode
237
- }, { allowImplicitInternational: !1 }), s), e);
238
- ot(n, r);
239
- return;
240
- }
241
- let c = x(i, w ?? s ?? void 0);
242
- ot(c, r);
243
- }, [ot, w]), ct = g.useCallback((e) => {
244
- if (!e) return;
245
- z.current = e.value;
246
- let t = _e(x(ge(j, e), e.value), e);
247
- Ne(t.displayValue), U.current = {
248
- start: t.displayValue.length,
249
- end: t.displayValue.length
250
- }, F(!1), N(""), L(-1), R(t.lengthIssue), w || Me(e.value), q({
251
- formattedInternational: t.formattedInternational,
252
- formattedNational: t.formattedNational,
253
- e164: t.e164,
254
- country: t.country,
255
- countryCallingCode: t.countryCallingCode,
256
- nationalNumber: t.nationalNumber,
257
- rawInput: t.rawInput,
258
- isValid: t.isValid
259
- }), requestAnimationFrame(() => {
260
- W.current?.focus();
261
- });
262
- }, [
263
- w,
264
- q,
265
- j
266
- ]), Y = g.useMemo(() => {
267
- if (!P) return [];
268
- let e = [], t = (t) => {
269
- t && !e.some((e) => e.value === t.value) && e.push(t);
270
- }, n = O.find((e) => e.value === ke), r = G ? O.find((e) => e.value === G) : void 0, i = M.trim(), a = f(i), o = ee(i);
271
- return !a && !o ? (t(r), t(n), O.forEach(t), e) : (a && O.filter((e) => e.dialCode.startsWith(a)).sort((e, t) => {
272
- let n = e.dialCode === a, r = t.dialCode === a;
273
- return n && !r ? -1 : !n && r ? 1 : e.dialCode.length - t.dialCode.length;
274
- }).forEach(t), o && O.filter((e) => e.normalizedSearchableTokens.some((e) => e.includes(o))).sort((e, t) => {
275
- let n = c(e.normalizedSearchableTokens, o), r = c(t.normalizedSearchableTokens, o);
276
- return n === r ? e.name.localeCompare(t.name) : n - r;
277
- }).forEach(t), t(r), t(n), e.length === 0 && O.forEach(t), e);
278
- }, [
279
- G,
280
- O,
281
- M,
282
- ke,
283
- P
284
- ]), X = Pe && P && Y.length > 0;
285
- g.useEffect(() => {
286
- X || (H.current = "smooth");
287
- }, [X]), g.useEffect(() => {
288
- if (!X) {
289
- L(-1);
290
- return;
291
- }
292
- if (Y.length === 0) {
293
- L(-1);
294
- return;
295
- }
296
- L((e) => e < 0 || e >= Y.length ? 0 : e);
297
- }, [Y, X]);
298
- let Z = I >= 0 ? Y[I] ?? null : null;
299
- g.useEffect(() => {
300
- I < 0 && (H.current = "smooth");
301
- }, [I]);
302
- let lt = g.useCallback(() => {
303
- let e = H.current;
304
- return H.current = "smooth", e;
305
- }, []), ut = g.useCallback((e) => {
306
- let t = Y.findIndex((t) => t.value === e.value);
307
- t !== -1 && L(t);
308
- }, [Y]), dt = g.useCallback((e, t) => qe ? qe(e, t) : ce(e), [qe]), ft = g.useCallback((e) => dt(e, {
309
- context: "menu",
310
- inputValue: M,
311
- selectValue: []
312
- }), [M, dt]), pt = g.useMemo(() => ({
313
- highlightedValue: Z?.value ?? null,
314
- setHighlightedOption: ut,
315
- renderOptionLabel: ft,
316
- consumeScrollBehavior: lt
317
- }), [
318
- lt,
319
- Z,
320
- ft,
321
- ut
322
- ]), Q = G ? O.find((e) => e.value === G) : void 0, mt = Q?.flag ?? "", ht = G ? D.selectedCountryLabel(Q?.name ?? G) : D.selectCountryLabel, gt = !!(G && mt), $ = Re === "TOO_LONG" ? D.lengthTooLong(Q?.name ?? G ?? null) : null, _t = Q?.name ?? G ?? null, vt = null;
323
- if ($) {
324
- let e = xe?.({
325
- message: $,
326
- code: "TOO_LONG",
327
- countryName: _t
328
- });
329
- vt = e === void 0 ? /* @__PURE__ */ _("p", {
330
- className: "mt-1 text-xs text-destructive",
331
- children: /* @__PURE__ */ _("span", { children: $ })
332
- }) : e;
333
- }
334
- let yt = g.useCallback((e) => {
335
- B.current = `${B.current}${e}`.slice(-12), N(B.current), F(!0), J();
336
- }, [J]), bt = g.useCallback(() => {
337
- let e = B.current;
338
- e && (B.current = e.slice(0, -1), N(B.current), B.current && J());
339
- }, [J]), xt = g.useCallback((e) => {
340
- if (Te?.(e), e.defaultPrevented) return;
341
- let t = e.key;
342
- if (e.metaKey || e.ctrlKey || e.altKey) return;
343
- let n = e.currentTarget, r = n.value, i = n.selectionStart ?? 0, a = n.selectionEnd ?? i, o = i === a;
344
- if (t === "Backspace" && o) {
345
- let e = re(r, i);
346
- e !== i && n.setSelectionRange(e, e);
347
- } else if (t === "ArrowLeft" && o) {
348
- let t = re(r, i);
349
- if (t !== i) {
350
- e.preventDefault(), n.setSelectionRange(t, t);
351
- return;
352
- }
353
- } else if (t === "ArrowRight" && o) {
354
- let t = ie(r, a);
355
- if (t !== a) {
356
- e.preventDefault(), n.setSelectionRange(t, t);
357
- return;
358
- }
359
- }
360
- if (t === "ArrowDown") {
361
- if (H.current = e.repeat ? "auto" : "smooth", e.preventDefault(), !P) {
362
- F(!0), L(Y.length > 0 ? 0 : -1);
363
- return;
364
- }
365
- Y.length > 0 && L((e) => e < 0 ? 0 : (e + 1) % Y.length);
366
- return;
367
- }
368
- if (t === "ArrowUp") {
369
- if (H.current = e.repeat ? "auto" : "smooth", e.preventDefault(), !P) {
370
- F(!0), L(Y.length > 0 ? Y.length - 1 : -1);
371
- return;
372
- }
373
- Y.length > 0 && L((e) => e < 0 ? Y.length - 1 : (e - 1 + Y.length) % Y.length);
374
- return;
375
- }
376
- if (/^[a-z]$/i.test(t)) {
377
- e.preventDefault(), P || (F(!0), L(Y.length > 0 ? 0 : -1)), yt(t.toLowerCase());
378
- return;
379
- }
380
- if (X) {
381
- if (t === "Backspace" && B.current) {
382
- e.preventDefault(), bt();
383
- return;
384
- }
385
- if (t === "Escape") {
386
- e.preventDefault(), B.current = "", N(""), F(!1);
387
- return;
388
- }
389
- if (t === "Enter" && Y.length > 0) {
390
- e.preventDefault();
391
- let t = Z ?? Y[0];
392
- ct(t);
393
- return;
394
- }
395
- }
396
- }, [
397
- yt,
398
- Y,
399
- ct,
400
- Z,
401
- Te,
402
- bt,
403
- P,
404
- X
405
- ]), St = g.useCallback((e) => {
406
- Fe(!0), Ce?.(e);
407
- }, [Ce]), Ct = g.useCallback((e) => {
408
- Fe(!1), F(!1), B.current = "", N(""), we?.(e);
409
- }, [we]), wt = g.useCallback(() => {
410
- S || C || (B.current = "", N(""), F(!0), L((e) => e < 0 ? 0 : e), requestAnimationFrame(() => {
411
- W.current?.focus();
412
- }));
413
- }, [S, C]), Tt = ye ?? (Ee ? `${Ee}_shim` : void 0);
414
- return /* @__PURE__ */ ue("div", {
415
- className: e("relative flex flex-col", me),
416
- children: [
417
- /* @__PURE__ */ ue("div", {
418
- className: "relative",
419
- children: [/* @__PURE__ */ _("input", {
420
- ...Oe,
421
- ref: W,
422
- type: "tel",
423
- className: e("flex h-10 w-full rounded-md border border-input bg-background py-2 text-base ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "pl-11 pr-3", he),
424
- name: Ee,
425
- value: j,
426
- onChange: st,
427
- onFocus: St,
428
- onBlur: Ct,
429
- onKeyDown: xt,
430
- disabled: S,
431
- readOnly: C,
432
- autoComplete: De ?? "off"
433
- }), /* @__PURE__ */ _("button", {
434
- type: "button",
435
- className: e("absolute left-3 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded border text-lg leading-none transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", gt ? "border-transparent" : "border-dashed border-border text-muted-foreground", S ? "cursor-not-allowed opacity-50" : C ? "cursor-default" : "cursor-pointer hover:bg-muted"),
436
- "aria-label": ht,
437
- onMouseDown: (e) => e.preventDefault(),
438
- onClick: wt,
439
- tabIndex: -1,
440
- disabled: S,
441
- children: /* @__PURE__ */ _("span", {
442
- "aria-hidden": "true",
443
- children: gt ? mt : "?"
444
- })
445
- })]
446
- }),
447
- Tt ? /* @__PURE__ */ _("input", {
448
- tabIndex: -1,
449
- autoComplete: "tel",
450
- name: Tt,
451
- "aria-hidden": "true",
452
- className: "pointer-events-none absolute left-0 top-0 h-0 w-0 opacity-0"
453
- }) : null,
454
- /* @__PURE__ */ _("div", {
455
- className: "absolute left-0 top-full z-30 mt-1",
456
- style: {
457
- pointerEvents: X ? "auto" : "none",
458
- width: "min(260px, 100%)"
459
- },
460
- onMouseDown: (e) => e.preventDefault(),
461
- children: Ie ? /* @__PURE__ */ _(oe.Provider, {
462
- value: pt,
463
- children: /* @__PURE__ */ _(de, {
464
- ...$e,
465
- instanceId: et,
466
- menuIsOpen: X,
467
- options: Y,
468
- value: null,
469
- components: at,
470
- styles: it,
471
- isClearable: !1,
472
- isSearchable: !1,
473
- backspaceRemovesValue: !1,
474
- tabSelectsValue: !1,
475
- menuShouldScrollIntoView: !1,
476
- menuPortalTarget: K,
477
- menuPosition: Ye ?? (K ? "fixed" : "absolute"),
478
- onChange: ct,
479
- classNamePrefix: Ke ?? "phone-number-suggestions",
480
- placeholder: "",
481
- formatOptionLabel: dt,
482
- noOptionsMessage: Qe ?? (() => D.noMatches)
483
- })
484
- }) : null
485
- }),
486
- vt
487
- ]
488
- });
489
- });
490
- S.displayName = "PhoneNumberInput";
491
118
  //#endregion
492
- export { S as PhoneNumberInput };
119
+ export { u as HiddenControl, d as NullComponent, o as SuggestionContext, c as SuggestionOption, f as formatCountryOption, l as suggestionSelectStyles };
493
120
 
494
121
  //# sourceMappingURL=index362.js.map