@rpcbase/ui 0.206.0 → 0.208.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 (232) hide show
  1. package/dist/index.js +7 -7
  2. package/dist/index19.js +1 -1
  3. package/dist/index19.js.map +1 -1
  4. package/dist/index200.js +56 -55
  5. package/dist/index200.js.map +1 -1
  6. package/dist/index201.js +60 -8
  7. package/dist/index201.js.map +1 -1
  8. package/dist/index202.js +7 -15
  9. package/dist/index202.js.map +1 -1
  10. package/dist/index203.js +15 -143
  11. package/dist/index203.js.map +1 -1
  12. package/dist/index204.js +145 -4
  13. package/dist/index204.js.map +1 -1
  14. package/dist/index205.js +4 -11
  15. package/dist/index205.js.map +1 -1
  16. package/dist/index206.js +10 -104
  17. package/dist/index206.js.map +1 -1
  18. package/dist/index207.js +94 -347
  19. package/dist/index207.js.map +1 -1
  20. package/dist/index208.js +349 -87
  21. package/dist/index208.js.map +1 -1
  22. package/dist/index209.js +73 -304
  23. package/dist/index209.js.map +1 -1
  24. package/dist/index210.js +309 -193
  25. package/dist/index210.js.map +1 -1
  26. package/dist/index211.js +211 -19
  27. package/dist/index211.js.map +1 -1
  28. package/dist/index212.js +18 -27
  29. package/dist/index212.js.map +1 -1
  30. package/dist/index213.js +27 -187
  31. package/dist/index213.js.map +1 -1
  32. package/dist/index214.js +186 -16
  33. package/dist/index214.js.map +1 -1
  34. package/dist/index215.js +18 -44
  35. package/dist/index215.js.map +1 -1
  36. package/dist/index216.js +60 -8
  37. package/dist/index216.js.map +1 -1
  38. package/dist/index217.js +42 -23
  39. package/dist/index217.js.map +1 -1
  40. package/dist/index218.js +9 -44
  41. package/dist/index218.js.map +1 -1
  42. package/dist/index219.js +25 -18
  43. package/dist/index219.js.map +1 -1
  44. package/dist/index220.js +45 -3
  45. package/dist/index220.js.map +1 -1
  46. package/dist/index221.js +17 -4
  47. package/dist/index221.js.map +1 -1
  48. package/dist/index222.js +3 -21
  49. package/dist/index222.js.map +1 -1
  50. package/dist/index223.js +4 -24
  51. package/dist/index223.js.map +1 -1
  52. package/dist/index224.js +17 -64
  53. package/dist/index224.js.map +1 -1
  54. package/dist/index225.js +23 -13
  55. package/dist/index225.js.map +1 -1
  56. package/dist/index226.js +68 -4
  57. package/dist/index226.js.map +1 -1
  58. package/dist/index227.js +14 -50
  59. package/dist/index227.js.map +1 -1
  60. package/dist/index228.js +4 -6
  61. package/dist/index228.js.map +1 -1
  62. package/dist/index229.js +50 -26
  63. package/dist/index229.js.map +1 -1
  64. package/dist/index230.js +5 -13
  65. package/dist/index230.js.map +1 -1
  66. package/dist/index231.js +25 -8
  67. package/dist/index231.js.map +1 -1
  68. package/dist/index232.js +17 -3
  69. package/dist/index232.js.map +1 -0
  70. package/dist/index233.js +8 -24
  71. package/dist/index233.js.map +1 -1
  72. package/dist/index234.js +2 -71
  73. package/dist/index235.js +29 -3
  74. package/dist/index235.js.map +1 -0
  75. package/dist/index236.js +69 -12
  76. package/dist/index236.js.map +1 -1
  77. package/dist/index237.js +3 -54
  78. package/dist/index238.js +11 -114
  79. package/dist/index238.js.map +1 -1
  80. package/dist/index239.js +51 -6
  81. package/dist/index239.js.map +1 -1
  82. package/dist/index240.js +115 -13
  83. package/dist/index240.js.map +1 -1
  84. package/dist/index241.js +6 -687
  85. package/dist/index241.js.map +1 -1
  86. package/dist/index242.js +13 -253
  87. package/dist/index242.js.map +1 -1
  88. package/dist/index243.js +662 -676
  89. package/dist/index243.js.map +1 -1
  90. package/dist/index244.js +252 -7430
  91. package/dist/index244.js.map +1 -1
  92. package/dist/index245.js +700 -6
  93. package/dist/index245.js.map +1 -1
  94. package/dist/index246.js +7429 -11
  95. package/dist/index246.js.map +1 -1
  96. package/dist/index247.js +5 -4
  97. package/dist/index247.js.map +1 -1
  98. package/dist/index248.js +11 -458
  99. package/dist/index248.js.map +1 -1
  100. package/dist/index249.js +5 -37
  101. package/dist/index249.js.map +1 -1
  102. package/dist/index250.js +458 -18
  103. package/dist/index250.js.map +1 -1
  104. package/dist/index251.js +34 -24
  105. package/dist/index251.js.map +1 -1
  106. package/dist/index252.js +19 -4
  107. package/dist/index252.js.map +1 -1
  108. package/dist/index253.js +23 -54
  109. package/dist/index253.js.map +1 -1
  110. package/dist/index254.js +4 -7
  111. package/dist/index254.js.map +1 -1
  112. package/dist/index255.js +57 -11
  113. package/dist/index255.js.map +1 -1
  114. package/dist/index256.js +8 -3
  115. package/dist/index256.js.map +1 -1
  116. package/dist/index257.js +12 -16
  117. package/dist/index257.js.map +1 -1
  118. package/dist/index258.js +3 -26
  119. package/dist/index258.js.map +1 -1
  120. package/dist/index259.js +15 -42
  121. package/dist/index259.js.map +1 -1
  122. package/dist/index260.js +25 -13
  123. package/dist/index260.js.map +1 -1
  124. package/dist/index261.js +40 -22
  125. package/dist/index261.js.map +1 -1
  126. package/dist/index262.js +13 -17
  127. package/dist/index262.js.map +1 -1
  128. package/dist/index263.js +24 -34
  129. package/dist/index263.js.map +1 -1
  130. package/dist/index264.js +17 -5
  131. package/dist/index264.js.map +1 -1
  132. package/dist/index265.js +35 -9
  133. package/dist/index265.js.map +1 -1
  134. package/dist/index266.js +5 -8
  135. package/dist/index266.js.map +1 -1
  136. package/dist/index267.js +9 -9
  137. package/dist/index267.js.map +1 -1
  138. package/dist/index268.js +8 -10
  139. package/dist/index268.js.map +1 -1
  140. package/dist/index269.js +9 -7
  141. package/dist/index269.js.map +1 -1
  142. package/dist/index270.js +9 -72
  143. package/dist/index270.js.map +1 -1
  144. package/dist/index271.js +7 -171
  145. package/dist/index271.js.map +1 -1
  146. package/dist/index272.js +63 -104
  147. package/dist/index272.js.map +1 -1
  148. package/dist/index273.js +169 -12
  149. package/dist/index273.js.map +1 -1
  150. package/dist/index274.js +109 -75
  151. package/dist/index274.js.map +1 -1
  152. package/dist/index275.js +12 -44
  153. package/dist/index275.js.map +1 -1
  154. package/dist/index276.js +79 -12
  155. package/dist/index276.js.map +1 -1
  156. package/dist/index277.js +45 -15
  157. package/dist/index277.js.map +1 -1
  158. package/dist/index278.js +12 -98
  159. package/dist/index278.js.map +1 -1
  160. package/dist/index279.js +15 -55
  161. package/dist/index279.js.map +1 -1
  162. package/dist/index280.js +89 -98
  163. package/dist/index280.js.map +1 -1
  164. package/dist/index281.js +27 -42
  165. package/dist/index281.js.map +1 -1
  166. package/dist/index282.js +92 -97
  167. package/dist/index282.js.map +1 -1
  168. package/dist/index283.js +62 -46
  169. package/dist/index283.js.map +1 -1
  170. package/dist/index284.js +108 -38
  171. package/dist/index284.js.map +1 -1
  172. package/dist/index285.js +48 -135
  173. package/dist/index285.js.map +1 -1
  174. package/dist/index286.js +43 -139
  175. package/dist/index286.js.map +1 -1
  176. package/dist/index287.js +105 -217
  177. package/dist/index287.js.map +1 -1
  178. package/dist/index288.js +109 -210
  179. package/dist/index288.js.map +1 -1
  180. package/dist/index289.js +168 -212
  181. package/dist/index289.js.map +1 -1
  182. package/dist/index290.js +240 -5
  183. package/dist/index290.js.map +1 -1
  184. package/dist/index291.js +298 -6
  185. package/dist/index291.js.map +1 -1
  186. package/dist/index292.js +5 -7
  187. package/dist/index292.js.map +1 -1
  188. package/dist/index293.js +4 -4
  189. package/dist/index293.js.map +1 -1
  190. package/dist/index294.js +7 -6
  191. package/dist/index294.js.map +1 -1
  192. package/dist/index295.js +6 -21
  193. package/dist/index295.js.map +1 -1
  194. package/dist/index296.js +6 -10
  195. package/dist/index296.js.map +1 -1
  196. package/dist/index297.js +18 -123
  197. package/dist/index297.js.map +1 -1
  198. package/dist/index298.js +10 -164
  199. package/dist/index298.js.map +1 -1
  200. package/dist/index299.js +116 -58
  201. package/dist/index299.js.map +1 -1
  202. package/dist/index300.js +161 -106
  203. package/dist/index300.js.map +1 -1
  204. package/dist/index301.js +66 -489
  205. package/dist/index301.js.map +1 -1
  206. package/dist/index302.js +106 -59
  207. package/dist/index302.js.map +1 -1
  208. package/dist/index303.js +492 -4
  209. package/dist/index303.js.map +1 -1
  210. package/dist/index304.js +62 -27
  211. package/dist/index304.js.map +1 -1
  212. package/dist/index305.js +4 -66
  213. package/dist/index305.js.map +1 -1
  214. package/dist/index306.js +27 -152
  215. package/dist/index306.js.map +1 -1
  216. package/dist/index307.js +59 -555
  217. package/dist/index307.js.map +1 -1
  218. package/dist/index308.js +143 -201
  219. package/dist/index308.js.map +1 -1
  220. package/dist/index309.js +56 -326
  221. package/dist/index309.js.map +1 -1
  222. package/dist/index310.js +553 -260
  223. package/dist/index310.js.map +1 -1
  224. package/dist/index311.js +214 -0
  225. package/dist/index311.js.map +1 -0
  226. package/dist/index312.js +335 -0
  227. package/dist/index312.js.map +1 -0
  228. package/dist/index313.js +272 -0
  229. package/dist/index313.js.map +1 -0
  230. package/package.json +2 -2
  231. package/dist/index234.js.map +0 -1
  232. package/dist/index237.js.map +0 -1
package/dist/index303.js CHANGED
@@ -1,7 +1,495 @@
1
- import { MenuPopover as e } from "./index302.js";
2
- //#region src/components/header/index.tsx
3
- var t = { MenuPopover: e };
1
+ import { cn as e } from "./index12.js";
2
+ import { getCountryCallingCode as t } from "./index296.js";
3
+ import { resolveMessages as n } from "./index297.js";
4
+ import { COMMON_IDD_PREFIXES as r, buildFallbackSelectedCountry as i, getCachedCountryOptions as a, getLocaleCacheKey as o, getValidCountry as s, normalizeSearchValue as c, optionMatchIndex as l, parseLocaleCacheKey as u, toSelectedCountry as d } from "./index299.js";
5
+ import { detectNationalPrefixForDisplay as f, formatWithAsYouType as ee, getLengthIssue as te, getSuggestionState as ne, injectNationalPrefixDisplay as re, normalizeInputValue as p, sanitizeDigits as m, shouldDisplayExplicitCountrySelection as ie, stripPrefix as h } from "./index300.js";
6
+ import { captureSelectionSnapshot as g, resolveSelection as _, skipFormattingCharactersLeft as v, skipFormattingCharactersRight as y } from "./index301.js";
7
+ import { HiddenControl as b, NullComponent as x, SuggestionContext as ae, SuggestionOption as oe, formatCountryOption as se, suggestionSelectStyles as ce } from "./index302.js";
8
+ import * as S from "react";
9
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
10
+ import T from "react-select";
11
+ //#region src/components/PhoneNumberInput/index.tsx
12
+ var le = S.forwardRef(function(le, ue) {
13
+ let { value: E, defaultCountry: D, country: O, locale: de, onChange: fe, onCountryChange: pe, className: me, inputClassName: he, disabled: ge, readOnly: _e, selectProps: ve, autofillShimName: ye, messages: be, renderValidationMessage: xe, ...Se } = le, { onFocus: Ce, onBlur: we, onKeyDown: Te, name: Ee, autoComplete: De, ...Oe } = Se, k = typeof D == "string" || typeof O == "string", ke = o(de), Ae = S.useMemo(() => u(ke), [ke]), je = S.useMemo(() => n(Ae, be), [Ae, be]), A = S.useMemo(() => a(Ae, ke), [ke, Ae]), Me = S.useCallback((e) => {
14
+ let t = A.find((t) => t.value === e);
15
+ return t ? d(t) : i(e);
16
+ }, [A]), j = S.useMemo(() => {
17
+ let e = s(D ?? O ?? "US");
18
+ return A.some((t) => t.value === e) ? e : A[0]?.value ?? "US";
19
+ }, [
20
+ A,
21
+ O,
22
+ D
23
+ ]), M = S.useRef(k), Ne = S.useRef(null), N = S.useRef("");
24
+ if (!Ne.current) if (!E) Ne.current = {
25
+ country: j,
26
+ inputValue: "",
27
+ normalizedValue: "",
28
+ hasExplicitCountrySelection: !1
29
+ }, N.current = "";
30
+ else {
31
+ let e = k ? j : void 0, n = p(E, e, { allowJustPlus: !0 });
32
+ if (!n) Ne.current = {
33
+ country: j,
34
+ inputValue: "",
35
+ normalizedValue: "",
36
+ hasExplicitCountrySelection: !1
37
+ }, N.current = "";
38
+ else {
39
+ let { international: r, phoneNumber: i, detectedCountry: a, inferredCountry: o, hasExplicitInternationalPrefix: s } = ee(n, e), c = a ?? void 0, l = c ?? j, u = m(E ?? ""), d = typeof E == "string" ? /^\s*\+/.test(E) : !1, te = m(r), p = f(u, te, t(l), d), h = ne(n, e, i ?? void 0, {
40
+ hasRemovedNationalPrefix: p,
41
+ detectedCountry: c,
42
+ hasExplicitInternationalPrefix: s
43
+ }), g = !h.shouldSuggest && !c ? o : void 0;
44
+ g && (l = g), (c || g) && (M.current = !0);
45
+ let _ = t(l), v = re(r, _, { force: g ? f(u, te, _, d) : p }), y = c ?? void 0, b = M.current;
46
+ Ne.current = {
47
+ country: l,
48
+ inputValue: v,
49
+ normalizedValue: n,
50
+ hasExplicitCountrySelection: b && ie(h, {
51
+ detectedCountry: y,
52
+ hasExplicitInternationalPrefix: s
53
+ })
54
+ }, N.current = n;
55
+ }
56
+ }
57
+ let Pe = Ne.current, [P, F] = S.useState(Pe.country), [Fe, I] = S.useState(Pe.inputValue), [Ie, L] = S.useState(""), [R, z] = S.useState(!1), [Le, B] = S.useState(-1), [Re, ze] = S.useState(!1), [Be, V] = S.useState(null), [Ve, H] = S.useState(Pe.hasExplicitCountrySelection), U = S.useRef(null), W = S.useRef(""), G = S.useRef(null), K = S.useRef("smooth"), q = S.useRef(null), He = S.useCallback(() => {
58
+ let e = K.current;
59
+ return K.current = "smooth", e;
60
+ }, []), J = typeof O == "string", Ue = J ? O : P, Y = Ue ?? j, We = S.useRef(null);
61
+ S.useImperativeHandle(ue, () => We.current, []), S.useLayoutEffect(() => {
62
+ let e = q.current;
63
+ if (!e) return;
64
+ let t = We.current;
65
+ if (q.current = null, !t) return;
66
+ let { start: n, end: r } = e;
67
+ t.setSelectionRange(n, r);
68
+ }, [Fe]);
69
+ let { styles: Ge, components: Ke, classNamePrefix: qe, formatOptionLabel: Je, ...Ye } = ve ?? {}, { noOptionsMessage: Xe, ...Ze } = Ye, Qe = S.useMemo(() => ({
70
+ ...ce,
71
+ ...Ge ?? {}
72
+ }), [Ge]), $e = S.useMemo(() => {
73
+ let e = {
74
+ Control: b,
75
+ IndicatorsContainer: x,
76
+ DropdownIndicator: x,
77
+ IndicatorSeparator: x,
78
+ ValueContainer: x
79
+ }, t = Ke ?? {};
80
+ return t.Option ? {
81
+ ...e,
82
+ ...t
83
+ } : {
84
+ ...e,
85
+ ...t,
86
+ Option: oe
87
+ };
88
+ }, [Ke]), et = S.useRef(!1), X = S.useCallback((e) => {
89
+ et.current = !0;
90
+ let t = Me(e);
91
+ return pe?.(e, t), t;
92
+ }, [pe, Me]);
93
+ S.useEffect(() => () => {
94
+ G.current != null && typeof window < "u" && window.clearTimeout(G.current);
95
+ }, []), S.useEffect(() => {
96
+ if (E == null) return;
97
+ let e = M.current ? Y : void 0, n = N.current, r = p(E, e, {
98
+ allowJustPlus: !0,
99
+ previousValue: n
100
+ });
101
+ if (N.current = r, W.current = "", !r) {
102
+ I(""), z(!1), L(""), V(null), U.current = null, H(!1);
103
+ let e = k ? j : Y;
104
+ !J && P !== e && (F(e), X(e));
105
+ return;
106
+ }
107
+ if (r === "0") {
108
+ I("0"), z(!1), L(""), V(null), U.current = null, H(!1);
109
+ return;
110
+ }
111
+ if (r === "+") {
112
+ I("+"), z(!0), L(""), V(null), U.current = null, H(!1);
113
+ let e = k ? j : Y;
114
+ !J && P !== e && (F(e), X(e));
115
+ return;
116
+ }
117
+ let { international: i, phoneNumber: a, detectedCountry: o, inferredCountry: s, hasExplicitInternationalPrefix: c } = ee(r, e), l = o ?? void 0, u = l ?? e ?? Y, d = m(E ?? ""), h = typeof E == "string" ? /^\s*\+/.test(E) : !1, g = m(i), _ = f(d, g, t(u), h), v = ne(r, e, a ?? void 0, {
118
+ hasRemovedNationalPrefix: _,
119
+ detectedCountry: l,
120
+ hasExplicitInternationalPrefix: c
121
+ }), y = !v.shouldSuggest && !l ? s : void 0, b = y ?? u;
122
+ (l || y) && (M.current = !0), !J && b !== P && (F(b), X(b)), u = b, U.current && U.current !== u && (U.current = null);
123
+ let x = t(u), ae = re(i, x, { force: y ? f(d, g, x, h) : _ }), oe = l ?? void 0, se = U.current != null || ie(v, {
124
+ detectedCountry: oe,
125
+ hasExplicitInternationalPrefix: c
126
+ });
127
+ I(ae), z(v.shouldSuggest), L(v.query), V(M.current ? te(r, u) : null), H(M.current && se);
128
+ }, [
129
+ E,
130
+ Y,
131
+ j,
132
+ k,
133
+ J,
134
+ X,
135
+ P
136
+ ]), S.useEffect(() => {
137
+ if (et.current || !M.current) return;
138
+ let e = Ue ?? j;
139
+ e && X(e);
140
+ }, [
141
+ j,
142
+ X,
143
+ Ue
144
+ ]), S.useEffect(() => {
145
+ J && O && O !== P && F(O);
146
+ }, [
147
+ O,
148
+ J,
149
+ P
150
+ ]);
151
+ let Z = S.useCallback((e) => {
152
+ let t = Me(e.country);
153
+ fe?.({
154
+ ...e,
155
+ selectedCountry: t
156
+ });
157
+ }, [fe, Me]), tt = S.useCallback(() => {
158
+ typeof window > "u" || (G.current != null && window.clearTimeout(G.current), G.current = window.setTimeout(() => {
159
+ W.current = "", G.current = null;
160
+ }, 800));
161
+ }, []), nt = S.useCallback((e) => {
162
+ let n = e.target, i = g(n), a = n.value;
163
+ W.current = "";
164
+ let o = M.current ? Y : void 0, s = o ? t(o) : "", c = m(a), l = a.trim().startsWith("+"), u = s ? c.startsWith(s) : !1, d = c.startsWith("0"), v = r.some((e) => c.startsWith(e)), y = !!o && !v && (u && c.slice(s.length).startsWith("0") || !l && d && c.length > 1 || l && d && c.length > 1 && !u), b = N.current, x = p(a, o, {
165
+ allowJustPlus: !0,
166
+ removeNationalPrefix: y,
167
+ previousValue: b
168
+ });
169
+ if (N.current = x, !x) {
170
+ I(""), z(!1), L(""), B(-1), V(null), U.current = null, H(!1), q.current = _(i, "");
171
+ let e = k ? j : Y;
172
+ !J && P !== e && (F(e), X(e)), Z({
173
+ formattedInternational: "",
174
+ formattedNational: "",
175
+ e164: null,
176
+ country: e,
177
+ countryCallingCode: t(e),
178
+ nationalNumber: "",
179
+ rawInput: "",
180
+ isValid: !1
181
+ });
182
+ return;
183
+ }
184
+ if (x === "0") {
185
+ I("0"), z(!1), L(""), B(-1), V(null), U.current = null, H(!1), q.current = _(i, "0");
186
+ let e = k ? j : Y;
187
+ !J && P !== e && (F(e), X(e)), Z({
188
+ formattedInternational: "0",
189
+ formattedNational: "0",
190
+ e164: null,
191
+ country: e,
192
+ countryCallingCode: t(e),
193
+ nationalNumber: "0",
194
+ rawInput: "0",
195
+ isValid: !1
196
+ });
197
+ return;
198
+ }
199
+ if (x === "+") {
200
+ I("+"), z(!0), L(""), B(0), V(null), U.current = null, H(!1), q.current = _(i, "+");
201
+ let e = k ? j : Y;
202
+ !J && P !== e && (F(e), X(e)), Z({
203
+ formattedInternational: "+",
204
+ formattedNational: "",
205
+ e164: null,
206
+ country: e,
207
+ countryCallingCode: t(e),
208
+ nationalNumber: "",
209
+ rawInput: "+",
210
+ isValid: !1
211
+ });
212
+ return;
213
+ }
214
+ let { international: ae, national: oe, phoneNumber: se, detectedCountry: ce, inferredCountry: S, hasExplicitInternationalPrefix: C } = ee(x, o), w = ce ?? void 0, T = w ?? o ?? Y, le = m(ae), ue = f(c, le, t(T), l), E = ne(x, o, se ?? void 0, {
215
+ hasRemovedNationalPrefix: ue,
216
+ detectedCountry: w,
217
+ hasExplicitInternationalPrefix: C
218
+ }), D = !E.shouldSuggest && !w ? S : void 0, O = D ?? T;
219
+ (w || D) && (M.current = !0), !J && O !== P && (F(O), X(O)), T = O, U.current && U.current !== T && (U.current = null);
220
+ let de = t(T), fe = h(m(x), de), pe = re(ae, de, { force: D ? f(c, le, de, l) : ue }), me = w ?? void 0;
221
+ q.current = _(i, pe), I(pe), z(E.shouldSuggest), L(E.query), B(E.shouldSuggest ? 0 : -1), V(M.current ? te(x, T) : null);
222
+ let he = U.current != null || ie(E, {
223
+ detectedCountry: me,
224
+ hasExplicitInternationalPrefix: C
225
+ });
226
+ H(M.current && he), Z({
227
+ formattedInternational: ae,
228
+ formattedNational: oe,
229
+ e164: se?.number ?? null,
230
+ country: T,
231
+ countryCallingCode: de,
232
+ nationalNumber: fe,
233
+ rawInput: x,
234
+ isValid: se?.isValid() ?? !1
235
+ });
236
+ }, [
237
+ Y,
238
+ Z,
239
+ j,
240
+ k,
241
+ J,
242
+ X,
243
+ P
244
+ ]), rt = S.useCallback((e) => {
245
+ if (!e) return;
246
+ let n = m(N.current || Fe), r = t(Y), i = n.startsWith(r) ? n.slice(r.length) : n;
247
+ i ? i.startsWith(e.dialCode) || (i = `${e.dialCode}${i}`) : i = e.dialCode;
248
+ let a = `+${i}`;
249
+ N.current = a;
250
+ let { international: o, national: s, phoneNumber: c } = ee(a, e.value), l = e.value;
251
+ U.current = l, M.current = !0, I(o), q.current = {
252
+ start: o.length,
253
+ end: o.length
254
+ }, z(!1), L(""), B(-1), V(te(a, l)), !J && l !== P && F(l), X(l);
255
+ let u = m(a), d = c?.countryCallingCode ?? e.dialCode, f = h(u, d);
256
+ H(!0), Z({
257
+ formattedInternational: o,
258
+ formattedNational: s,
259
+ e164: c?.number ?? null,
260
+ country: l,
261
+ countryCallingCode: d,
262
+ nationalNumber: f,
263
+ rawInput: a,
264
+ isValid: c?.isValid() ?? !1
265
+ }), requestAnimationFrame(() => {
266
+ We.current?.focus();
267
+ });
268
+ }, [
269
+ Y,
270
+ Z,
271
+ Fe,
272
+ J,
273
+ X,
274
+ P
275
+ ]), Q = S.useMemo(() => {
276
+ if (!R) return [];
277
+ let e = [], t = (t) => {
278
+ e.some((e) => e.value === t.value) || e.push(t);
279
+ }, n = A.find((e) => e.value === j), r = A.find((e) => e.value === Y), i = Ie.trim(), a = m(i), o = c(i);
280
+ return !a && !o ? (n && t(n), r && t(r), A.forEach(t), e) : (a && A.filter((e) => e.dialCode.startsWith(a)).sort((e, t) => {
281
+ let n = e.dialCode === a, r = t.dialCode === a;
282
+ return n && !r ? -1 : !n && r ? 1 : e.dialCode.length - t.dialCode.length;
283
+ }).forEach(t), o && A.filter((e) => e.normalizedSearchableTokens.some((e) => e.includes(o))).sort((e, t) => {
284
+ let n = l(e.normalizedSearchableTokens, o), r = l(t.normalizedSearchableTokens, o);
285
+ return n === r ? e.name.localeCompare(t.name) : n - r;
286
+ }).forEach(t), r && t(r), n && t(n), e.length === 0 && A.forEach(t), e);
287
+ }, [
288
+ Y,
289
+ A,
290
+ Ie,
291
+ j,
292
+ R
293
+ ]), $ = Re && R && Q.length > 0;
294
+ S.useEffect(() => {
295
+ $ || (K.current = "smooth");
296
+ }, [$]), S.useEffect(() => {
297
+ if (!$) {
298
+ B(-1);
299
+ return;
300
+ }
301
+ if (Q.length === 0) {
302
+ B(-1);
303
+ return;
304
+ }
305
+ B((e) => e < 0 || e >= Q.length ? 0 : e);
306
+ }, [Q, $]);
307
+ let it = Le >= 0 ? Q[Le] ?? null : null;
308
+ S.useEffect(() => {
309
+ Le < 0 && (K.current = "smooth");
310
+ }, [Le]);
311
+ let at = S.useCallback((e) => {
312
+ let t = Q.findIndex((t) => t.value === e.value);
313
+ t !== -1 && B(t);
314
+ }, [Q]), ot = S.useCallback((e, t) => Je ? Je(e, t) : se(e), [Je]), st = S.useCallback((e) => ot(e, {
315
+ context: "menu",
316
+ inputValue: Ie,
317
+ selectValue: []
318
+ }), [Ie, ot]), ct = S.useMemo(() => ({
319
+ highlightedValue: it?.value ?? null,
320
+ setHighlightedOption: at,
321
+ renderOptionLabel: st,
322
+ consumeScrollBehavior: He
323
+ }), [
324
+ He,
325
+ it,
326
+ st,
327
+ at
328
+ ]), lt = A.find((e) => e.value === Y), ut = lt?.flag ?? "", dt = Ve ? je.selectedCountryLabel(lt?.name ?? Y ?? null) : je.selectCountryLabel, ft = Ve && !!ut, pt = Be === "TOO_LONG" ? je.lengthTooLong(lt?.name ?? Y ?? null) : null, mt = lt?.name ?? Y ?? null, ht = null;
329
+ if (pt) {
330
+ let e = xe?.({
331
+ message: pt,
332
+ code: "TOO_LONG",
333
+ countryName: mt
334
+ });
335
+ ht = e === void 0 ? /* @__PURE__ */ C("p", {
336
+ className: "mt-1 text-xs text-destructive",
337
+ children: /* @__PURE__ */ C("span", { children: pt })
338
+ }) : e;
339
+ }
340
+ let gt = S.useCallback((e) => {
341
+ W.current = `${W.current}${e}`.slice(-12), L(W.current), z(!0), tt();
342
+ }, [tt]), _t = S.useCallback(() => {
343
+ let e = W.current;
344
+ e && (W.current = e.slice(0, -1), L(W.current), W.current && tt());
345
+ }, [tt]), vt = S.useCallback((e) => {
346
+ if (Te?.(e), e.defaultPrevented) return;
347
+ let t = e.key;
348
+ if (e.metaKey || e.ctrlKey || e.altKey) return;
349
+ let n = e.currentTarget, r = n.value, i = n.selectionStart ?? 0, a = n.selectionEnd ?? i, o = i === a;
350
+ if (t === "Backspace" && o) {
351
+ let e = v(r, i);
352
+ e !== i && n.setSelectionRange(e, e);
353
+ } else if (t === "ArrowLeft" && o) {
354
+ let t = v(r, i);
355
+ if (t !== i) {
356
+ e.preventDefault(), n.setSelectionRange(t, t);
357
+ return;
358
+ }
359
+ } else if (t === "ArrowRight" && o) {
360
+ let t = y(r, a);
361
+ if (t !== a) {
362
+ e.preventDefault(), n.setSelectionRange(t, t);
363
+ return;
364
+ }
365
+ }
366
+ if (t === "ArrowDown") {
367
+ if (K.current = e.repeat ? "auto" : "smooth", e.preventDefault(), !R) {
368
+ z(!0), B(Q.length > 0 ? 0 : -1);
369
+ return;
370
+ }
371
+ Q.length > 0 && B((e) => e < 0 ? 0 : (e + 1) % Q.length);
372
+ return;
373
+ }
374
+ if (t === "ArrowUp") {
375
+ if (K.current = e.repeat ? "auto" : "smooth", e.preventDefault(), !R) {
376
+ z(!0), B(Q.length > 0 ? Q.length - 1 : -1);
377
+ return;
378
+ }
379
+ Q.length > 0 && B((e) => e < 0 ? Q.length - 1 : (e - 1 + Q.length) % Q.length);
380
+ return;
381
+ }
382
+ if (/^[a-z]$/i.test(t)) {
383
+ e.preventDefault(), R || (z(!0), B(Q.length > 0 ? 0 : -1)), gt(t.toLowerCase());
384
+ return;
385
+ }
386
+ if ($) {
387
+ if (t === "Backspace" && W.current) {
388
+ e.preventDefault(), _t();
389
+ return;
390
+ }
391
+ if (t === "Escape") {
392
+ e.preventDefault(), W.current = "", L(""), z(!1);
393
+ return;
394
+ }
395
+ if (t === "Enter" && Q.length > 0) {
396
+ e.preventDefault(), rt(it ?? Q[0]);
397
+ return;
398
+ }
399
+ }
400
+ }, [
401
+ gt,
402
+ Q,
403
+ rt,
404
+ it,
405
+ Te,
406
+ _t,
407
+ R,
408
+ $
409
+ ]), yt = S.useCallback((e) => {
410
+ ze(!0), Ce?.(e);
411
+ }, [Ce]), bt = S.useCallback((e) => {
412
+ ze(!1), z(!1), W.current = "", L(""), we?.(e);
413
+ }, [we]), xt = S.useCallback(() => {
414
+ ge || _e || (W.current = "", L(""), z(!0), B((e) => e < 0 ? 0 : e), requestAnimationFrame(() => {
415
+ We.current?.focus();
416
+ }));
417
+ }, [ge, _e]), St = ye ?? (Ee ? `${Ee}_shim` : void 0);
418
+ return /* @__PURE__ */ w("div", {
419
+ className: e("relative flex flex-col", me),
420
+ children: [
421
+ /* @__PURE__ */ w("div", {
422
+ className: "relative",
423
+ children: [/* @__PURE__ */ C("input", {
424
+ ...Oe,
425
+ ref: We,
426
+ type: "tel",
427
+ 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),
428
+ name: Ee,
429
+ value: Fe,
430
+ onChange: nt,
431
+ onFocus: yt,
432
+ onBlur: bt,
433
+ onKeyDown: vt,
434
+ disabled: ge,
435
+ readOnly: _e,
436
+ autoComplete: De ?? "off"
437
+ }), /* @__PURE__ */ C("button", {
438
+ type: "button",
439
+ 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", ft ? "border-transparent" : "border-dashed border-border text-muted-foreground", ge ? "cursor-not-allowed opacity-50" : _e ? "cursor-default" : "cursor-pointer hover:bg-muted"),
440
+ "aria-label": dt,
441
+ onMouseDown: (e) => e.preventDefault(),
442
+ onClick: xt,
443
+ tabIndex: -1,
444
+ disabled: ge,
445
+ children: /* @__PURE__ */ C("span", {
446
+ "aria-hidden": "true",
447
+ children: ft ? ut : "?"
448
+ })
449
+ })]
450
+ }),
451
+ St ? /* @__PURE__ */ C("input", {
452
+ tabIndex: -1,
453
+ autoComplete: "tel",
454
+ name: St,
455
+ "aria-hidden": "true",
456
+ className: "pointer-events-none absolute left-0 top-0 h-0 w-0 opacity-0"
457
+ }) : null,
458
+ /* @__PURE__ */ C("div", {
459
+ className: "absolute left-0 top-full z-30 mt-1",
460
+ style: {
461
+ pointerEvents: $ ? "auto" : "none",
462
+ width: "min(260px, 100%)"
463
+ },
464
+ onMouseDown: (e) => e.preventDefault(),
465
+ children: /* @__PURE__ */ C(ae.Provider, {
466
+ value: ct,
467
+ children: /* @__PURE__ */ C(T, {
468
+ ...Ze,
469
+ menuIsOpen: $,
470
+ options: Q,
471
+ value: null,
472
+ components: $e,
473
+ styles: Qe,
474
+ isClearable: !1,
475
+ isSearchable: !1,
476
+ backspaceRemovesValue: !1,
477
+ tabSelectsValue: !1,
478
+ menuShouldScrollIntoView: !1,
479
+ onChange: rt,
480
+ classNamePrefix: qe ?? "phone-number-suggestions",
481
+ placeholder: "",
482
+ formatOptionLabel: ot,
483
+ noOptionsMessage: Xe ?? (() => je.noMatches)
484
+ })
485
+ })
486
+ }),
487
+ ht
488
+ ]
489
+ });
490
+ });
491
+ le.displayName = "PhoneNumberInput";
4
492
  //#endregion
5
- export { t as Header };
493
+ export { le as PhoneNumberInput };
6
494
 
7
495
  //# sourceMappingURL=index303.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index303.js","names":["MenuPopover","Header"],"sources":["../src/components/header/index.tsx"],"sourcesContent":["import { MenuPopover } from \"./MenuPopover\"\n\n\nexport const Header = {\n MenuPopover\n}\n"],"mappings":";;AAGA,IAAaC,IAAS,EACpBD,gBACD"}
1
+ {"version":3,"file":"index303.js","names":["React","CountryCode","getCountryCallingCode","Select","Props","SelectProps","SingleValue","StylesConfig","cn","CountryOption","PhoneNumberChangeDetails","PhoneNumberInputProps","PhoneNumberSelectedCountry","resolveMessages","DEFAULT_COUNTRY","COMMON_IDD_PREFIXES","buildFallbackSelectedCountry","getCachedCountryOptions","getLocaleCacheKey","getValidCountry","normalizeSearchValue","optionMatchIndex","parseLocaleCacheKey","toSelectedCountry","detectNationalPrefixForDisplay","formatWithAsYouType","getLengthIssue","getSuggestionState","injectNationalPrefixDisplay","normalizeInputValue","sanitizeDigits","shouldDisplayExplicitCountrySelection","stripPrefix","LengthIssue","captureSelectionSnapshot","resolveSelection","skipFormattingCharactersLeft","skipFormattingCharactersRight","HiddenControl","NullComponent","SuggestionContext","SuggestionOption","formatCountryOption","suggestionSelectStyles","SuggestionContextValue","PhoneNumberInputMessages","PhoneNumberInputValidationCode","PhoneNumberInput","forwardRef","HTMLInputElement","props","forwardedRef","value","defaultCountry","country","countryProp","locale","onChange","onCountryChange","className","inputClassName","disabled","readOnly","selectProps","autofillShimName","messages","messagesProp","renderValidationMessage","restProps","onFocus","onInputFocus","onBlur","onInputBlur","onKeyDown","onInputKeyDown","name","inputName","autoComplete","inputAutoComplete","restInputProps","hasConfiguredCountry","localeCacheKey","localeForBuild","useMemo","resolvedMessages","countryOptions","resolveSelectedCountry","useCallback","match","find","candidate","fallbackCountry","some","option","hasResolvedCountryRef","useRef","initialStateRef","inputValue","normalizedValue","hasExplicitCountrySelection","lastNormalizedRef","current","baseCountryForInit","undefined","normalized","allowJustPlus","international","phoneNumber","detectedCountry","inferredCountry","hasExplicitInternationalPrefix","canonicalDetectedCountry","resolvedCountry","rawDigits","hasExplicitPlus","test","internationalDigits","initialDialCode","initialHasPrefix","suggestion","hasRemovedNationalPrefix","inferredCountryToApply","shouldSuggest","resolvedFromValue","Boolean","nextDialCode","finalHasPrefix","displayValue","force","displayDetectedCountry","allowInlineFlag","initialState","uncontrolledCountry","setUncontrolledCountry","useState","inputValueState","setInputValueState","countryQuery","setCountryQuery","showSuggestions","setShowSuggestions","highlightedIndex","setHighlightedIndex","isFocused","setIsFocused","lengthIssue","setLengthIssue","setHasExplicitCountrySelection","manualSelectionCountryRef","keyboardBufferRef","bufferTimeoutRef","scrollBehaviorRef","ScrollBehavior","pendingSelectionRef","start","end","consumeScrollBehavior","behavior","isCountryControlled","selectedCountry","activeCountry","inputRef","useImperativeHandle","useLayoutEffect","selection","input","setSelectionRange","selectOverrides","styles","userSelectStyles","components","userSelectComponents","classNamePrefix","userClassNamePrefix","formatOptionLabel","userFormatOptionLabel","forwardedSelectProps","noOptionsMessage","restForwardedSelectProps","mergedSelectStyles","mergedSelectComponents","baseComponents","Control","IndicatorsContainer","DropdownIndicator","IndicatorSeparator","ValueContainer","overrides","Option","hasAnnouncedCountryRef","notifyCountryChange","useEffect","window","clearTimeout","baseCountryForSync","previousNormalized","previousValue","nextCountry","initialHasTypedTrunk","finalCountry","hasTypedTrunk","manualSelectionActive","shouldShowInlineFlag","query","emitChange","details","Omit","scheduleBufferReset","setTimeout","handleInputChange","event","ChangeEvent","target","snapshot","raw","baseCountryForInput","dialCode","typedDigits","trim","startsWith","startsWithDialCode","hasLeadingZero","isIddPrefix","prefix","shouldRemoveNationalPrefix","slice","length","removeNationalPrefix","formattedInternational","formattedNational","e164","countryCallingCode","nationalNumber","rawInput","isValid","national","resolvedFromInput","normalizedDigits","nationalDigits","number","handleCountrySelect","previousDigits","currentDial","digitsWithoutCurrentDial","rebasedDigits","requestAnimationFrame","focus","filteredOptions","results","pushUnique","existing","push","fallbackOption","currentOption","digitQuery","normalizedQuery","forEach","dialMatches","filter","sort","a","b","aExact","bExact","nameMatches","normalizedSearchableTokens","token","includes","aIndex","bIndex","localeCompare","suggestionMenuIsOpen","highlightedOption","updateHighlightedOption","index","findIndex","selectFormatOptionLabel","NonNullable","meta","optionLabelRenderer","context","selectValue","highlightContextValue","highlightedValue","setHighlightedOption","renderOptionLabel","activeOption","activeFlag","flag","inlineFlagLabel","selectedCountryLabel","selectCountryLabel","hasInlineFlag","lengthHint","lengthTooLong","countryName","validationNode","ReactNode","rendered","message","code","appendToBuffer","char","popBuffer","handleKeyDown","KeyboardEvent","defaultPrevented","key","metaKey","ctrlKey","altKey","currentTarget","selectionStart","selectionEnd","isCollapsedSelection","nextStart","preventDefault","repeat","next","toLowerCase","handleFocus","FocusEvent","handleBlur","openCountryMenu","shimName","pointerEvents","width","noMatches","displayName"],"sources":["../src/components/PhoneNumberInput/index.tsx"],"sourcesContent":["import * as React from \"react\"\nimport type { CountryCode } from \"libphonenumber-js\"\nimport { getCountryCallingCode } from \"libphonenumber-js\"\nimport Select, {\n type Props as SelectProps,\n type SingleValue,\n type StylesConfig,\n} from \"react-select\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type {\n CountryOption,\n PhoneNumberChangeDetails,\n PhoneNumberInputProps,\n PhoneNumberSelectedCountry,\n} from \"./types\"\nimport { resolveMessages } from \"./messages\"\nimport {\n DEFAULT_COUNTRY,\n COMMON_IDD_PREFIXES,\n buildFallbackSelectedCountry,\n getCachedCountryOptions,\n getLocaleCacheKey,\n getValidCountry,\n normalizeSearchValue,\n optionMatchIndex,\n parseLocaleCacheKey,\n toSelectedCountry,\n} from \"./country-options\"\nimport {\n detectNationalPrefixForDisplay,\n formatWithAsYouType,\n getLengthIssue,\n getSuggestionState,\n injectNationalPrefixDisplay,\n normalizeInputValue,\n sanitizeDigits,\n shouldDisplayExplicitCountrySelection,\n stripPrefix,\n type LengthIssue,\n} from \"./normalization\"\nimport {\n captureSelectionSnapshot,\n resolveSelection,\n skipFormattingCharactersLeft,\n skipFormattingCharactersRight,\n} from \"./selection\"\nimport {\n HiddenControl,\n NullComponent,\n SuggestionContext,\n SuggestionOption,\n formatCountryOption,\n suggestionSelectStyles,\n type SuggestionContextValue,\n} from \"./suggestions\"\n\n\nexport type {\n CountryOption,\n PhoneNumberChangeDetails,\n PhoneNumberInputMessages,\n PhoneNumberInputProps,\n PhoneNumberInputValidationCode,\n PhoneNumberSelectedCountry,\n} from \"./types\"\n\nexport const PhoneNumberInput = React.forwardRef<HTMLInputElement, PhoneNumberInputProps>(\n function PhoneNumberInput(props, forwardedRef) {\n const {\n value,\n defaultCountry,\n country: countryProp,\n locale,\n onChange,\n onCountryChange,\n className,\n inputClassName,\n disabled,\n readOnly,\n selectProps,\n autofillShimName,\n messages: messagesProp,\n renderValidationMessage,\n ...restProps\n } = props\n\n const {\n onFocus: onInputFocus,\n onBlur: onInputBlur,\n onKeyDown: onInputKeyDown,\n name: inputName,\n autoComplete: inputAutoComplete,\n ...restInputProps\n } = restProps\n\n const hasConfiguredCountry =\n typeof defaultCountry === \"string\" || typeof countryProp === \"string\"\n\n const localeCacheKey = getLocaleCacheKey(locale)\n const localeForBuild = React.useMemo(\n () => parseLocaleCacheKey(localeCacheKey),\n [localeCacheKey]\n )\n const resolvedMessages = React.useMemo(\n () => resolveMessages(localeForBuild, messagesProp),\n [localeForBuild, messagesProp]\n )\n const countryOptions = React.useMemo(\n () => getCachedCountryOptions(localeForBuild, localeCacheKey),\n [localeCacheKey, localeForBuild]\n )\n const resolveSelectedCountry = React.useCallback(\n (country: CountryCode): PhoneNumberSelectedCountry => {\n const match = countryOptions.find((candidate) => candidate.value === country)\n if (match) {\n return toSelectedCountry(match)\n }\n return buildFallbackSelectedCountry(country)\n },\n [countryOptions]\n )\n const fallbackCountry = React.useMemo(() => {\n const candidate = getValidCountry(defaultCountry ?? countryProp ?? DEFAULT_COUNTRY)\n if (countryOptions.some((option) => option.value === candidate)) {\n return candidate\n }\n return countryOptions[0]?.value ?? DEFAULT_COUNTRY\n }, [countryOptions, countryProp, defaultCountry])\n\n const hasResolvedCountryRef = React.useRef<boolean>(hasConfiguredCountry)\n\n const initialStateRef = React.useRef<{\n country: CountryCode\n inputValue: string\n normalizedValue: string\n hasExplicitCountrySelection: boolean\n } | null>(null)\n const lastNormalizedRef = React.useRef<string>(\"\")\n\n if (!initialStateRef.current) {\n if (!value) {\n initialStateRef.current = {\n country: fallbackCountry,\n inputValue: \"\",\n normalizedValue: \"\",\n hasExplicitCountrySelection: false,\n }\n lastNormalizedRef.current = \"\"\n } else {\n const baseCountryForInit = hasConfiguredCountry ? fallbackCountry : undefined\n const normalized = normalizeInputValue(value, baseCountryForInit, { allowJustPlus: true })\n if (!normalized) {\n initialStateRef.current = {\n country: fallbackCountry,\n inputValue: \"\",\n normalizedValue: \"\",\n hasExplicitCountrySelection: false,\n }\n lastNormalizedRef.current = \"\"\n } else {\n const {\n international,\n phoneNumber,\n detectedCountry,\n inferredCountry,\n hasExplicitInternationalPrefix,\n } = formatWithAsYouType(normalized, baseCountryForInit)\n const canonicalDetectedCountry = detectedCountry ?? undefined\n let resolvedCountry = canonicalDetectedCountry ?? fallbackCountry\n const rawDigits = sanitizeDigits(value ?? \"\")\n const hasExplicitPlus = typeof value === \"string\" ? /^\\s*\\+/.test(value) : false\n const internationalDigits = sanitizeDigits(international)\n const initialDialCode = getCountryCallingCode(resolvedCountry)\n const initialHasPrefix = detectNationalPrefixForDisplay(\n rawDigits,\n internationalDigits,\n initialDialCode,\n hasExplicitPlus\n )\n\n const suggestion = getSuggestionState(\n normalized,\n baseCountryForInit,\n phoneNumber ?? undefined,\n {\n hasRemovedNationalPrefix: initialHasPrefix,\n detectedCountry: canonicalDetectedCountry,\n hasExplicitInternationalPrefix,\n }\n )\n\n const inferredCountryToApply =\n !suggestion.shouldSuggest && !canonicalDetectedCountry ? inferredCountry : undefined\n\n\n if (inferredCountryToApply) {\n resolvedCountry = inferredCountryToApply\n }\n\n const resolvedFromValue =\n Boolean(canonicalDetectedCountry) || Boolean(inferredCountryToApply)\n if (resolvedFromValue) {\n hasResolvedCountryRef.current = true\n }\n\n const nextDialCode = getCountryCallingCode(resolvedCountry)\n const finalHasPrefix = inferredCountryToApply\n ? detectNationalPrefixForDisplay(\n rawDigits,\n internationalDigits,\n nextDialCode,\n hasExplicitPlus\n )\n : initialHasPrefix\n\n const displayValue = injectNationalPrefixDisplay(international, nextDialCode, {\n force: finalHasPrefix,\n })\n\n const displayDetectedCountry = canonicalDetectedCountry ?? undefined\n const allowInlineFlag = hasResolvedCountryRef.current\n initialStateRef.current = {\n country: resolvedCountry,\n inputValue: displayValue,\n normalizedValue: normalized,\n hasExplicitCountrySelection:\n allowInlineFlag &&\n shouldDisplayExplicitCountrySelection(suggestion, {\n detectedCountry: displayDetectedCountry,\n hasExplicitInternationalPrefix,\n }),\n }\n lastNormalizedRef.current = normalized\n }\n }\n }\n\n const initialState = initialStateRef.current\n\n const [uncontrolledCountry, setUncontrolledCountry] = React.useState(initialState.country)\n const [inputValueState, setInputValueState] = React.useState(initialState.inputValue)\n const [countryQuery, setCountryQuery] = React.useState(\"\")\n const [showSuggestions, setShowSuggestions] = React.useState(false)\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1)\n const [isFocused, setIsFocused] = React.useState(false)\n const [lengthIssue, setLengthIssue] = React.useState<LengthIssue | null>(null)\n const [hasExplicitCountrySelection, setHasExplicitCountrySelection] = React.useState(\n initialState.hasExplicitCountrySelection\n )\n const manualSelectionCountryRef = React.useRef<CountryCode | null>(null)\n\n const keyboardBufferRef = React.useRef(\"\")\n const bufferTimeoutRef = React.useRef<number | null>(null)\n const scrollBehaviorRef = React.useRef<ScrollBehavior>(\"smooth\")\n const pendingSelectionRef = React.useRef<{ start: number; end: number } | null>(null)\n const consumeScrollBehavior = React.useCallback(() => {\n const behavior = scrollBehaviorRef.current\n scrollBehaviorRef.current = \"smooth\"\n return behavior\n }, [])\n\n const isCountryControlled = typeof countryProp === \"string\"\n const selectedCountry = isCountryControlled ? countryProp : uncontrolledCountry\n const activeCountry = selectedCountry ?? fallbackCountry\n\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n\n React.useImperativeHandle(forwardedRef, () => inputRef.current as HTMLInputElement, [])\n\n React.useLayoutEffect(() => {\n const selection = pendingSelectionRef.current\n if (!selection) {\n return\n }\n\n const input = inputRef.current\n pendingSelectionRef.current = null\n if (!input) {\n return\n }\n\n const { start, end } = selection\n input.setSelectionRange(start, end)\n }, [inputValueState])\n\n const selectOverrides = selectProps ?? {}\n const {\n styles: userSelectStyles,\n components: userSelectComponents,\n classNamePrefix: userClassNamePrefix,\n formatOptionLabel: userFormatOptionLabel,\n ...forwardedSelectProps\n } = selectOverrides\n const { noOptionsMessage, ...restForwardedSelectProps } = forwardedSelectProps\n\n const mergedSelectStyles = React.useMemo<StylesConfig<CountryOption, false>>(\n () => ({\n ...suggestionSelectStyles,\n ...(userSelectStyles ?? {}),\n }),\n [userSelectStyles]\n )\n\n const mergedSelectComponents = React.useMemo(() => {\n const baseComponents = {\n Control: HiddenControl,\n IndicatorsContainer: NullComponent,\n DropdownIndicator: NullComponent,\n IndicatorSeparator: NullComponent,\n ValueContainer: NullComponent,\n }\n\n const overrides = userSelectComponents ?? {}\n\n if (!overrides.Option) {\n return {\n ...baseComponents,\n ...overrides,\n Option: SuggestionOption,\n }\n }\n\n return {\n ...baseComponents,\n ...overrides,\n }\n }, [userSelectComponents])\n\n const hasAnnouncedCountryRef = React.useRef(false)\n\n const notifyCountryChange = React.useCallback(\n (country: CountryCode) => {\n hasAnnouncedCountryRef.current = true\n const selection = resolveSelectedCountry(country)\n onCountryChange?.(country, selection)\n return selection\n },\n [onCountryChange, resolveSelectedCountry]\n )\n\n React.useEffect(() => () => {\n if (bufferTimeoutRef.current != null && typeof window !== \"undefined\") {\n window.clearTimeout(bufferTimeoutRef.current)\n }\n }, [])\n\n React.useEffect(() => {\n if (value == null) {\n return\n }\n\n const baseCountryForSync = hasResolvedCountryRef.current ? activeCountry : undefined\n const previousNormalized = lastNormalizedRef.current\n const normalized = normalizeInputValue(value, baseCountryForSync, {\n allowJustPlus: true,\n previousValue: previousNormalized,\n })\n lastNormalizedRef.current = normalized\n keyboardBufferRef.current = \"\"\n\n if (!normalized) {\n setInputValueState(\"\")\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n return\n }\n\n if (normalized === \"0\") {\n setInputValueState(\"0\")\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n return\n }\n\n if (normalized === \"+\") {\n setInputValueState(\"+\")\n setShowSuggestions(true)\n setCountryQuery(\"\")\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n return\n }\n\n const {\n international,\n phoneNumber,\n detectedCountry,\n inferredCountry,\n hasExplicitInternationalPrefix,\n } = formatWithAsYouType(normalized, baseCountryForSync)\n const canonicalDetectedCountry = detectedCountry ?? undefined\n let nextCountry = canonicalDetectedCountry ?? baseCountryForSync ?? activeCountry\n const rawDigits = sanitizeDigits(value ?? \"\")\n const hasExplicitPlus = typeof value === \"string\" ? /^\\s*\\+/.test(value) : false\n const internationalDigits = sanitizeDigits(international)\n const initialDialCode = getCountryCallingCode(nextCountry)\n const initialHasTypedTrunk = detectNationalPrefixForDisplay(\n rawDigits,\n internationalDigits,\n initialDialCode,\n hasExplicitPlus\n )\n\n const suggestion = getSuggestionState(\n normalized,\n baseCountryForSync,\n phoneNumber ?? undefined,\n {\n hasRemovedNationalPrefix: initialHasTypedTrunk,\n detectedCountry: canonicalDetectedCountry,\n hasExplicitInternationalPrefix,\n }\n )\n\n const inferredCountryToApply =\n !suggestion.shouldSuggest && !canonicalDetectedCountry ? inferredCountry : undefined\n const finalCountry = inferredCountryToApply ?? nextCountry\n\n const resolvedFromValue =\n Boolean(canonicalDetectedCountry) || Boolean(inferredCountryToApply)\n if (resolvedFromValue) {\n hasResolvedCountryRef.current = true\n }\n\n if (!isCountryControlled && finalCountry !== uncontrolledCountry) {\n setUncontrolledCountry(finalCountry)\n notifyCountryChange(finalCountry)\n }\n\n nextCountry = finalCountry\n\n if (\n manualSelectionCountryRef.current &&\n manualSelectionCountryRef.current !== nextCountry\n ) {\n manualSelectionCountryRef.current = null\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n const hasTypedTrunk = inferredCountryToApply\n ? detectNationalPrefixForDisplay(\n rawDigits,\n internationalDigits,\n nextDialCode,\n hasExplicitPlus\n )\n : initialHasTypedTrunk\n\n const displayValue = injectNationalPrefixDisplay(international, nextDialCode, {\n force: hasTypedTrunk,\n })\n const displayDetectedCountry = canonicalDetectedCountry ?? undefined\n const manualSelectionActive = manualSelectionCountryRef.current != null\n const shouldShowInlineFlag =\n manualSelectionActive ||\n shouldDisplayExplicitCountrySelection(suggestion, {\n detectedCountry: displayDetectedCountry,\n hasExplicitInternationalPrefix,\n })\n\n setInputValueState(displayValue)\n setShowSuggestions(suggestion.shouldSuggest)\n setCountryQuery(suggestion.query)\n setLengthIssue(hasResolvedCountryRef.current ? getLengthIssue(normalized, nextCountry) : null)\n setHasExplicitCountrySelection(hasResolvedCountryRef.current && shouldShowInlineFlag)\n }, [\n value,\n activeCountry,\n fallbackCountry,\n hasConfiguredCountry,\n isCountryControlled,\n notifyCountryChange,\n uncontrolledCountry,\n ])\n\n React.useEffect(() => {\n if (hasAnnouncedCountryRef.current) {\n return\n }\n if (!hasResolvedCountryRef.current) {\n return\n }\n const current = selectedCountry ?? fallbackCountry\n if (!current) {\n return\n }\n notifyCountryChange(current)\n }, [fallbackCountry, notifyCountryChange, selectedCountry])\n\n React.useEffect(() => {\n if (isCountryControlled && countryProp && countryProp !== uncontrolledCountry) {\n setUncontrolledCountry(countryProp)\n }\n }, [countryProp, isCountryControlled, uncontrolledCountry])\n\n const emitChange = React.useCallback(\n (details: Omit<PhoneNumberChangeDetails, \"selectedCountry\">) => {\n const selection = resolveSelectedCountry(details.country)\n onChange?.({\n ...details,\n selectedCountry: selection,\n })\n },\n [onChange, resolveSelectedCountry]\n )\n\n const scheduleBufferReset = React.useCallback(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n if (bufferTimeoutRef.current != null) {\n window.clearTimeout(bufferTimeoutRef.current)\n }\n\n bufferTimeoutRef.current = window.setTimeout(() => {\n keyboardBufferRef.current = \"\"\n bufferTimeoutRef.current = null\n }, 800)\n }, [])\n\n const handleInputChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const target = event.target\n const snapshot = captureSelectionSnapshot(target)\n const raw = target.value\n keyboardBufferRef.current = \"\"\n\n const baseCountryForInput = hasResolvedCountryRef.current ? activeCountry : undefined\n const dialCode = baseCountryForInput ? getCountryCallingCode(baseCountryForInput) : \"\"\n const typedDigits = sanitizeDigits(raw)\n const hasExplicitPlus = raw.trim().startsWith(\"+\")\n const startsWithDialCode = dialCode ? typedDigits.startsWith(dialCode) : false\n const hasLeadingZero = typedDigits.startsWith(\"0\")\n const isIddPrefix = COMMON_IDD_PREFIXES.some((prefix) => typedDigits.startsWith(prefix))\n\n const shouldRemoveNationalPrefix =\n Boolean(baseCountryForInput) &&\n !isIddPrefix &&\n ((startsWithDialCode && typedDigits.slice(dialCode.length).startsWith(\"0\")) ||\n (!hasExplicitPlus && hasLeadingZero && typedDigits.length > 1) ||\n (hasExplicitPlus && hasLeadingZero && typedDigits.length > 1 && !startsWithDialCode))\n\n const previousNormalized = lastNormalizedRef.current\n const normalized = normalizeInputValue(raw, baseCountryForInput, {\n allowJustPlus: true,\n removeNationalPrefix: shouldRemoveNationalPrefix,\n previousValue: previousNormalized,\n })\n lastNormalizedRef.current = normalized\n\n if (!normalized) {\n setInputValueState(\"\")\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n pendingSelectionRef.current = resolveSelection(snapshot, \"\")\n\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n emitChange({\n formattedInternational: \"\",\n formattedNational: \"\",\n e164: null,\n country: nextCountry,\n countryCallingCode: nextDialCode,\n nationalNumber: \"\",\n rawInput: \"\",\n isValid: false,\n })\n return\n }\n\n if (normalized === \"0\") {\n setInputValueState(\"0\")\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n pendingSelectionRef.current = resolveSelection(snapshot, \"0\")\n\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n emitChange({\n formattedInternational: \"0\",\n formattedNational: \"0\",\n e164: null,\n country: nextCountry,\n countryCallingCode: nextDialCode,\n nationalNumber: \"0\",\n rawInput: \"0\",\n isValid: false,\n })\n return\n }\n\n if (normalized === \"+\") {\n setInputValueState(\"+\")\n setShowSuggestions(true)\n setCountryQuery(\"\")\n setHighlightedIndex(0)\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n pendingSelectionRef.current = resolveSelection(snapshot, \"+\")\n\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n emitChange({\n formattedInternational: \"+\",\n formattedNational: \"\",\n e164: null,\n country: nextCountry,\n countryCallingCode: nextDialCode,\n nationalNumber: \"\",\n rawInput: \"+\",\n isValid: false,\n })\n return\n }\n\n const {\n international,\n national,\n phoneNumber,\n detectedCountry,\n inferredCountry,\n hasExplicitInternationalPrefix,\n } = formatWithAsYouType(normalized, baseCountryForInput)\n const canonicalDetectedCountry = detectedCountry ?? undefined\n let nextCountry = canonicalDetectedCountry ?? baseCountryForInput ?? activeCountry\n\n const internationalDigits = sanitizeDigits(international)\n const initialDialCode = getCountryCallingCode(nextCountry)\n const initialHasTypedTrunk = detectNationalPrefixForDisplay(\n typedDigits,\n internationalDigits,\n initialDialCode,\n hasExplicitPlus\n )\n\n const suggestion = getSuggestionState(\n normalized,\n baseCountryForInput,\n phoneNumber ?? undefined,\n {\n hasRemovedNationalPrefix: initialHasTypedTrunk,\n detectedCountry: canonicalDetectedCountry,\n hasExplicitInternationalPrefix,\n }\n )\n\n const inferredCountryToApply =\n !suggestion.shouldSuggest && !canonicalDetectedCountry ? inferredCountry : undefined\n const finalCountry = inferredCountryToApply ?? nextCountry\n\n const resolvedFromInput =\n Boolean(canonicalDetectedCountry) || Boolean(inferredCountryToApply)\n if (resolvedFromInput) {\n hasResolvedCountryRef.current = true\n }\n\n if (!isCountryControlled && finalCountry !== uncontrolledCountry) {\n setUncontrolledCountry(finalCountry)\n notifyCountryChange(finalCountry)\n }\n\n nextCountry = finalCountry\n\n if (\n manualSelectionCountryRef.current &&\n manualSelectionCountryRef.current !== nextCountry\n ) {\n manualSelectionCountryRef.current = null\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n const normalizedDigits = sanitizeDigits(normalized)\n const nationalDigits = stripPrefix(normalizedDigits, nextDialCode)\n const hasTypedTrunk = inferredCountryToApply\n ? detectNationalPrefixForDisplay(\n typedDigits,\n internationalDigits,\n nextDialCode,\n hasExplicitPlus\n )\n : initialHasTypedTrunk\n\n const displayValue = injectNationalPrefixDisplay(international, nextDialCode, {\n force: hasTypedTrunk,\n })\n\n const displayDetectedCountry = canonicalDetectedCountry ?? undefined\n\n pendingSelectionRef.current = resolveSelection(snapshot, displayValue)\n setInputValueState(displayValue)\n setShowSuggestions(suggestion.shouldSuggest)\n setCountryQuery(suggestion.query)\n setHighlightedIndex(suggestion.shouldSuggest ? 0 : -1)\n setLengthIssue(hasResolvedCountryRef.current ? getLengthIssue(normalized, nextCountry) : null)\n const manualSelectionActive = manualSelectionCountryRef.current != null\n const shouldShowInlineFlag =\n manualSelectionActive ||\n shouldDisplayExplicitCountrySelection(suggestion, {\n detectedCountry: displayDetectedCountry,\n hasExplicitInternationalPrefix,\n })\n setHasExplicitCountrySelection(hasResolvedCountryRef.current && shouldShowInlineFlag)\n emitChange({\n formattedInternational: international,\n formattedNational: national,\n e164: phoneNumber?.number ?? null,\n country: nextCountry,\n countryCallingCode: nextDialCode,\n nationalNumber: nationalDigits,\n rawInput: normalized,\n isValid: phoneNumber?.isValid() ?? false,\n })\n },\n [\n activeCountry,\n emitChange,\n fallbackCountry,\n hasConfiguredCountry,\n isCountryControlled,\n notifyCountryChange,\n uncontrolledCountry,\n ]\n )\n\n const handleCountrySelect = React.useCallback(\n (option: SingleValue<CountryOption>) => {\n if (!option) {\n return\n }\n\n const previousDigits = sanitizeDigits(lastNormalizedRef.current || inputValueState)\n const currentDial = getCountryCallingCode(activeCountry)\n const digitsWithoutCurrentDial = previousDigits.startsWith(currentDial)\n ? previousDigits.slice(currentDial.length)\n : previousDigits\n let rebasedDigits = digitsWithoutCurrentDial\n if (!rebasedDigits) {\n rebasedDigits = option.dialCode\n } else if (!rebasedDigits.startsWith(option.dialCode)) {\n rebasedDigits = `${option.dialCode}${rebasedDigits}`\n }\n const normalized = `+${rebasedDigits}`\n lastNormalizedRef.current = normalized\n const { international, national, phoneNumber } = formatWithAsYouType(\n normalized,\n option.value\n )\n const nextCountry = option.value\n manualSelectionCountryRef.current = nextCountry\n hasResolvedCountryRef.current = true\n\n setInputValueState(international)\n pendingSelectionRef.current = {\n start: international.length,\n end: international.length,\n }\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(getLengthIssue(normalized, nextCountry))\n\n if (!isCountryControlled && nextCountry !== uncontrolledCountry) {\n setUncontrolledCountry(nextCountry)\n }\n\n notifyCountryChange(nextCountry)\n\n const normalizedDigits = sanitizeDigits(normalized)\n const dialCode = phoneNumber?.countryCallingCode ?? option.dialCode\n const nationalDigits = stripPrefix(normalizedDigits, dialCode)\n setHasExplicitCountrySelection(true)\n emitChange({\n formattedInternational: international,\n formattedNational: national,\n e164: phoneNumber?.number ?? null,\n country: nextCountry,\n countryCallingCode: dialCode,\n nationalNumber: nationalDigits,\n rawInput: normalized,\n isValid: phoneNumber?.isValid() ?? false,\n })\n\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n },\n [activeCountry, emitChange, inputValueState, isCountryControlled, notifyCountryChange, uncontrolledCountry]\n )\n\n const filteredOptions = React.useMemo(() => {\n if (!showSuggestions) {\n return [] as CountryOption[]\n }\n\n const results: CountryOption[] = []\n\n const pushUnique = (option: CountryOption) => {\n if (!results.some((existing) => existing.value === option.value)) {\n results.push(option)\n }\n }\n\n const fallbackOption = countryOptions.find((option) => option.value === fallbackCountry)\n const currentOption = countryOptions.find((option) => option.value === activeCountry)\n const query = countryQuery.trim()\n const digitQuery = sanitizeDigits(query)\n const normalizedQuery = normalizeSearchValue(query)\n\n if (!digitQuery && !normalizedQuery) {\n if (fallbackOption) {\n pushUnique(fallbackOption)\n }\n if (currentOption) {\n pushUnique(currentOption)\n }\n countryOptions.forEach(pushUnique)\n return results\n }\n\n if (digitQuery) {\n const dialMatches = countryOptions\n .filter((option) => option.dialCode.startsWith(digitQuery))\n .sort((a, b) => {\n const aExact = a.dialCode === digitQuery\n const bExact = b.dialCode === digitQuery\n if (aExact && !bExact) {\n return -1\n }\n if (!aExact && bExact) {\n return 1\n }\n return a.dialCode.length - b.dialCode.length\n })\n dialMatches.forEach(pushUnique)\n }\n\n if (normalizedQuery) {\n const nameMatches = countryOptions\n .filter((option) =>\n option.normalizedSearchableTokens.some((token) => token.includes(normalizedQuery))\n )\n .sort((a, b) => {\n const aIndex = optionMatchIndex(a.normalizedSearchableTokens, normalizedQuery)\n const bIndex = optionMatchIndex(b.normalizedSearchableTokens, normalizedQuery)\n if (aIndex !== bIndex) {\n return aIndex - bIndex\n }\n return a.name.localeCompare(b.name)\n })\n nameMatches.forEach(pushUnique)\n }\n\n if (currentOption) {\n pushUnique(currentOption)\n }\n if (fallbackOption) {\n pushUnique(fallbackOption)\n }\n if (results.length === 0) {\n countryOptions.forEach(pushUnique)\n }\n\n return results\n }, [activeCountry, countryOptions, countryQuery, fallbackCountry, showSuggestions])\n\n const suggestionMenuIsOpen = isFocused && showSuggestions && filteredOptions.length > 0\n\n React.useEffect(() => {\n if (!suggestionMenuIsOpen) {\n scrollBehaviorRef.current = \"smooth\"\n }\n }, [suggestionMenuIsOpen])\n\n React.useEffect(() => {\n if (!suggestionMenuIsOpen) {\n setHighlightedIndex(-1)\n return\n }\n\n if (filteredOptions.length === 0) {\n setHighlightedIndex(-1)\n return\n }\n\n setHighlightedIndex((current) => {\n if (current < 0 || current >= filteredOptions.length) {\n return 0\n }\n return current\n })\n }, [filteredOptions, suggestionMenuIsOpen])\n\n const highlightedOption =\n highlightedIndex >= 0 ? filteredOptions[highlightedIndex] ?? null : null\n React.useEffect(() => {\n if (highlightedIndex < 0) {\n scrollBehaviorRef.current = \"smooth\"\n }\n }, [highlightedIndex])\n\n const updateHighlightedOption = React.useCallback(\n (option: CountryOption) => {\n const index = filteredOptions.findIndex((candidate) => candidate.value === option.value)\n if (index !== -1) {\n setHighlightedIndex(index)\n }\n },\n [filteredOptions]\n )\n\n const selectFormatOptionLabel = React.useCallback<\n NonNullable<SelectProps<CountryOption, false>[\"formatOptionLabel\"]>\n >(\n (option, meta) => {\n if (userFormatOptionLabel) {\n return userFormatOptionLabel(option, meta)\n }\n return formatCountryOption(option)\n },\n [userFormatOptionLabel]\n )\n\n const optionLabelRenderer = React.useCallback(\n (option: CountryOption) =>\n selectFormatOptionLabel(option, {\n context: \"menu\",\n inputValue: countryQuery,\n selectValue: [],\n }),\n [countryQuery, selectFormatOptionLabel]\n )\n\n const highlightContextValue = React.useMemo<SuggestionContextValue>(\n () => ({\n highlightedValue: highlightedOption?.value ?? null,\n setHighlightedOption: updateHighlightedOption,\n renderOptionLabel: optionLabelRenderer,\n consumeScrollBehavior,\n }),\n [consumeScrollBehavior, highlightedOption, optionLabelRenderer, updateHighlightedOption]\n )\n\n const activeOption = countryOptions.find((option) => option.value === activeCountry)\n const activeFlag = activeOption?.flag ?? \"\"\n const inlineFlagLabel = hasExplicitCountrySelection\n ? resolvedMessages.selectedCountryLabel(activeOption?.name ?? activeCountry ?? null)\n : resolvedMessages.selectCountryLabel\n const hasInlineFlag = hasExplicitCountrySelection && Boolean(activeFlag)\n const lengthHint =\n lengthIssue === \"TOO_LONG\"\n ? resolvedMessages.lengthTooLong(activeOption?.name ?? activeCountry ?? null)\n : null\n const countryName = activeOption?.name ?? activeCountry ?? null\n\n let validationNode: React.ReactNode = null\n if (lengthHint) {\n const rendered = renderValidationMessage?.({\n message: lengthHint,\n code: \"TOO_LONG\",\n countryName,\n })\n validationNode =\n rendered === undefined ? (\n <p className=\"mt-1 text-xs text-destructive\">\n <span>{lengthHint}</span>\n </p>\n ) : (\n rendered\n )\n }\n\n const appendToBuffer = React.useCallback(\n (char: string) => {\n keyboardBufferRef.current = `${keyboardBufferRef.current}${char}`.slice(-12)\n setCountryQuery(keyboardBufferRef.current)\n setShowSuggestions(true)\n scheduleBufferReset()\n },\n [scheduleBufferReset]\n )\n\n const popBuffer = React.useCallback(() => {\n const current = keyboardBufferRef.current\n if (!current) {\n return\n }\n keyboardBufferRef.current = current.slice(0, -1)\n setCountryQuery(keyboardBufferRef.current)\n if (keyboardBufferRef.current) {\n scheduleBufferReset()\n }\n }, [scheduleBufferReset])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n onInputKeyDown?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n const key = event.key\n\n if (event.metaKey || event.ctrlKey || event.altKey) {\n return\n }\n\n const target = event.currentTarget\n const value = target.value\n const selectionStart = target.selectionStart ?? 0\n const selectionEnd = target.selectionEnd ?? selectionStart\n const isCollapsedSelection = selectionStart === selectionEnd\n\n if (key === \"Backspace\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersLeft(value, selectionStart)\n if (nextStart !== selectionStart) {\n target.setSelectionRange(nextStart, nextStart)\n }\n } else if (key === \"ArrowLeft\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersLeft(value, selectionStart)\n if (nextStart !== selectionStart) {\n event.preventDefault()\n target.setSelectionRange(nextStart, nextStart)\n return\n }\n } else if (key === \"ArrowRight\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersRight(value, selectionEnd)\n if (nextStart !== selectionEnd) {\n event.preventDefault()\n target.setSelectionRange(nextStart, nextStart)\n return\n }\n }\n\n if (key === \"ArrowDown\") {\n scrollBehaviorRef.current = event.repeat ? \"auto\" : \"smooth\"\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? 0 : -1)\n return\n }\n\n if (filteredOptions.length > 0) {\n setHighlightedIndex((current) => {\n const next = current < 0 ? 0 : (current + 1) % filteredOptions.length\n return next\n })\n }\n return\n }\n\n if (key === \"ArrowUp\") {\n scrollBehaviorRef.current = event.repeat ? \"auto\" : \"smooth\"\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? filteredOptions.length - 1 : -1)\n return\n }\n\n if (filteredOptions.length > 0) {\n setHighlightedIndex((current) => {\n if (current < 0) {\n return filteredOptions.length - 1\n }\n return (current - 1 + filteredOptions.length) % filteredOptions.length\n })\n }\n return\n }\n\n if (/^[a-z]$/i.test(key)) {\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? 0 : -1)\n }\n appendToBuffer(key.toLowerCase())\n return\n }\n\n if (suggestionMenuIsOpen) {\n if (key === \"Backspace\" && keyboardBufferRef.current) {\n event.preventDefault()\n popBuffer()\n return\n }\n\n if (key === \"Escape\") {\n event.preventDefault()\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n setShowSuggestions(false)\n return\n }\n\n if (key === \"Enter\" && filteredOptions.length > 0) {\n event.preventDefault()\n const target = highlightedOption ?? filteredOptions[0]\n handleCountrySelect(target)\n return\n }\n }\n },\n [\n appendToBuffer,\n filteredOptions,\n handleCountrySelect,\n highlightedOption,\n onInputKeyDown,\n popBuffer,\n showSuggestions,\n suggestionMenuIsOpen,\n ]\n )\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true)\n onInputFocus?.(event)\n },\n [onInputFocus]\n )\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false)\n setShowSuggestions(false)\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n onInputBlur?.(event)\n },\n [onInputBlur]\n )\n\n const openCountryMenu = React.useCallback(() => {\n if (disabled || readOnly) {\n return\n }\n\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n setShowSuggestions(true)\n setHighlightedIndex((current) => (current < 0 ? 0 : current))\n\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n }, [disabled, readOnly])\n\n const shimName = autofillShimName ?? (inputName ? `${inputName}_shim` : undefined)\n\n return (\n <div className={cn(\"relative flex flex-col\", className)}>\n <div className=\"relative\">\n <input\n {...restInputProps}\n ref={inputRef}\n type=\"tel\"\n className={cn(\n \"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\",\n \"pl-11 pr-3\",\n inputClassName\n )}\n name={inputName}\n value={inputValueState}\n onChange={handleInputChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n disabled={disabled}\n readOnly={readOnly}\n autoComplete={inputAutoComplete ?? \"off\"}\n />\n <button\n type=\"button\"\n className={cn(\n \"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\",\n hasInlineFlag\n ? \"border-transparent\"\n : \"border-dashed border-border text-muted-foreground\",\n disabled\n ? \"cursor-not-allowed opacity-50\"\n : readOnly\n ? \"cursor-default\"\n : \"cursor-pointer hover:bg-muted\"\n )}\n aria-label={inlineFlagLabel}\n onMouseDown={(event) => event.preventDefault()}\n onClick={openCountryMenu}\n tabIndex={-1}\n disabled={disabled}\n >\n <span aria-hidden=\"true\">\n {hasInlineFlag ? activeFlag : \"?\"}\n </span>\n </button>\n </div>\n\n {shimName ? (\n <input\n tabIndex={-1}\n autoComplete=\"tel\"\n name={shimName}\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-0 top-0 h-0 w-0 opacity-0\"\n />\n ) : null}\n\n <div\n className=\"absolute left-0 top-full z-30 mt-1\"\n style={{\n pointerEvents: suggestionMenuIsOpen ? \"auto\" : \"none\",\n width: \"min(260px, 100%)\",\n }}\n onMouseDown={(event) => event.preventDefault()}\n >\n <SuggestionContext.Provider value={highlightContextValue}>\n <Select<CountryOption, false>\n {...restForwardedSelectProps}\n menuIsOpen={suggestionMenuIsOpen}\n options={filteredOptions}\n value={null}\n components={mergedSelectComponents}\n styles={mergedSelectStyles}\n isClearable={false}\n isSearchable={false}\n backspaceRemovesValue={false}\n tabSelectsValue={false}\n menuShouldScrollIntoView={false}\n onChange={handleCountrySelect}\n classNamePrefix={userClassNamePrefix ?? \"phone-number-suggestions\"}\n placeholder=\"\"\n formatOptionLabel={selectFormatOptionLabel}\n noOptionsMessage={\n noOptionsMessage ?? (() => resolvedMessages.noMatches)\n }\n />\n </SuggestionContext.Provider>\n </div>\n\n {validationNode}\n </div>\n )\n }\n)\n\nPhoneNumberInput.displayName = \"PhoneNumberInput\"\n"],"mappings":";;;;;;;;;;;AAoEA,IAAa+C,KAAm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