@rpcbase/ui 0.177.0 → 0.178.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 (345) hide show
  1. package/dist/components/HourPickerField/index.d.ts.map +1 -1
  2. package/dist/components/PhoneNumberInput/suggestions.d.ts.map +1 -1
  3. package/dist/index10.js +1 -1
  4. package/dist/index100.js +3 -3
  5. package/dist/index100.js.map +1 -1
  6. package/dist/index101.js +4 -6
  7. package/dist/index101.js.map +1 -1
  8. package/dist/index102.js +6 -145
  9. package/dist/index102.js.map +1 -1
  10. package/dist/index103.js +144 -38
  11. package/dist/index103.js.map +1 -1
  12. package/dist/index104.js +39 -4
  13. package/dist/index104.js.map +1 -1
  14. package/dist/index105.js +4 -7
  15. package/dist/index105.js.map +1 -1
  16. package/dist/index106.js +6 -12
  17. package/dist/index106.js.map +1 -1
  18. package/dist/index107.js +13 -13
  19. package/dist/index107.js.map +1 -1
  20. package/dist/index108.js +13 -7
  21. package/dist/index108.js.map +1 -1
  22. package/dist/index109.js +6 -30
  23. package/dist/index109.js.map +1 -1
  24. package/dist/index11.js +269 -269
  25. package/dist/index11.js.map +1 -1
  26. package/dist/index110.js +31 -10
  27. package/dist/index110.js.map +1 -1
  28. package/dist/index111.js +10 -10
  29. package/dist/index111.js.map +1 -1
  30. package/dist/index112.js +10 -8
  31. package/dist/index112.js.map +1 -1
  32. package/dist/index113.js +8 -13
  33. package/dist/index113.js.map +1 -1
  34. package/dist/index114.js +13 -101
  35. package/dist/index114.js.map +1 -1
  36. package/dist/index115.js +102 -20
  37. package/dist/index115.js.map +1 -1
  38. package/dist/index116.js +20 -54
  39. package/dist/index116.js.map +1 -1
  40. package/dist/index117.js +51 -70
  41. package/dist/index117.js.map +1 -1
  42. package/dist/index118.js +72 -9
  43. package/dist/index118.js.map +1 -1
  44. package/dist/index119.js +9 -20
  45. package/dist/index119.js.map +1 -1
  46. package/dist/index12.js +1 -1
  47. package/dist/index120.js +20 -16
  48. package/dist/index120.js.map +1 -1
  49. package/dist/index121.js +16 -23
  50. package/dist/index121.js.map +1 -1
  51. package/dist/index122.js +23 -6
  52. package/dist/index122.js.map +1 -1
  53. package/dist/index123.js +6 -5
  54. package/dist/index123.js.map +1 -1
  55. package/dist/index124.js +5 -23
  56. package/dist/index124.js.map +1 -1
  57. package/dist/index125.js +24 -35
  58. package/dist/index125.js.map +1 -1
  59. package/dist/index126.js +35 -16
  60. package/dist/index126.js.map +1 -1
  61. package/dist/index127.js +16 -7
  62. package/dist/index127.js.map +1 -1
  63. package/dist/index128.js +6 -4
  64. package/dist/index128.js.map +1 -1
  65. package/dist/index129.js +4 -4
  66. package/dist/index129.js.map +1 -1
  67. package/dist/index13.js +2 -2
  68. package/dist/index130.js +4 -4
  69. package/dist/index130.js.map +1 -1
  70. package/dist/index131.js +4 -4
  71. package/dist/index131.js.map +1 -1
  72. package/dist/index132.js +4 -3
  73. package/dist/index132.js.map +1 -1
  74. package/dist/index133.js +3 -6
  75. package/dist/index133.js.map +1 -1
  76. package/dist/index134.js +7 -24
  77. package/dist/index134.js.map +1 -1
  78. package/dist/index135.js +24 -8
  79. package/dist/index135.js.map +1 -1
  80. package/dist/index136.js +7 -6
  81. package/dist/index136.js.map +1 -1
  82. package/dist/index137.js +6 -5
  83. package/dist/index137.js.map +1 -1
  84. package/dist/index138.js +5 -3
  85. package/dist/index138.js.map +1 -1
  86. package/dist/index139.js +3 -3
  87. package/dist/index139.js.map +1 -1
  88. package/dist/index14.js +4 -4
  89. package/dist/index140.js +3 -4
  90. package/dist/index140.js.map +1 -1
  91. package/dist/index141.js +4 -3
  92. package/dist/index141.js.map +1 -1
  93. package/dist/index142.js +3 -4
  94. package/dist/index142.js.map +1 -1
  95. package/dist/index143.js +4 -3
  96. package/dist/index143.js.map +1 -1
  97. package/dist/index144.js +3 -3
  98. package/dist/index144.js.map +1 -1
  99. package/dist/index145.js +3 -3
  100. package/dist/index145.js.map +1 -1
  101. package/dist/index146.js +3 -46
  102. package/dist/index146.js.map +1 -1
  103. package/dist/index147.js +44 -51
  104. package/dist/index147.js.map +1 -1
  105. package/dist/index148.js +2 -2
  106. package/dist/index15.js +1 -1
  107. package/dist/index150.js +2 -2
  108. package/dist/index153.js +5 -605
  109. package/dist/index153.js.map +1 -1
  110. package/dist/index154.js +68 -5
  111. package/dist/index154.js.map +1 -1
  112. package/dist/index155.js +2 -69
  113. package/dist/index155.js.map +1 -1
  114. package/dist/index156.js +364 -2
  115. package/dist/index156.js.map +1 -1
  116. package/dist/index157.js +201 -303
  117. package/dist/index157.js.map +1 -1
  118. package/dist/index158.js +46 -247
  119. package/dist/index158.js.map +1 -1
  120. package/dist/index159.js +42 -56
  121. package/dist/index159.js.map +1 -1
  122. package/dist/index16.js +1 -1
  123. package/dist/index160.js +169 -46
  124. package/dist/index160.js.map +1 -1
  125. package/dist/index161.js +96 -156
  126. package/dist/index161.js.map +1 -1
  127. package/dist/index162.js +24 -109
  128. package/dist/index162.js.map +1 -1
  129. package/dist/index163.js +8 -25
  130. package/dist/index163.js.map +1 -1
  131. package/dist/index164.js +5 -8
  132. package/dist/index164.js.map +1 -1
  133. package/dist/index165.js +5 -4
  134. package/dist/index165.js.map +1 -1
  135. package/dist/index166.js +4 -5
  136. package/dist/index166.js.map +1 -1
  137. package/dist/index167.js +466 -4
  138. package/dist/index167.js.map +1 -1
  139. package/dist/index168.js +139 -420
  140. package/dist/index168.js.map +1 -1
  141. package/dist/index169.js +71 -149
  142. package/dist/index169.js.map +1 -1
  143. package/dist/index17.js +1 -1
  144. package/dist/index170.js +229 -74
  145. package/dist/index170.js.map +1 -1
  146. package/dist/index171.js +9 -262
  147. package/dist/index171.js.map +1 -1
  148. package/dist/index172.js +42 -9
  149. package/dist/index172.js.map +1 -1
  150. package/dist/index173.js +4 -42
  151. package/dist/index173.js.map +1 -1
  152. package/dist/index174.js +605 -4
  153. package/dist/index174.js.map +1 -1
  154. package/dist/index179.js +1 -1
  155. package/dist/index18.js +314 -312
  156. package/dist/index18.js.map +1 -1
  157. package/dist/index19.js +7 -7
  158. package/dist/index20.js +6 -6
  159. package/dist/index20.js.map +1 -1
  160. package/dist/index21.js +1 -1
  161. package/dist/index22.js +1 -1
  162. package/dist/index226.js +1 -1
  163. package/dist/index227.js +1 -1
  164. package/dist/index229.js +1 -1
  165. package/dist/index23.js +2 -2
  166. package/dist/index231.js +1 -1
  167. package/dist/index232.js +1 -1
  168. package/dist/index233.js +4 -4
  169. package/dist/index234.js +2 -2
  170. package/dist/index238.js +12 -66
  171. package/dist/index238.js.map +1 -1
  172. package/dist/index239.js +150 -176
  173. package/dist/index239.js.map +1 -1
  174. package/dist/index24.js +1 -1
  175. package/dist/index240.js +27 -43
  176. package/dist/index240.js.map +1 -1
  177. package/dist/index241.js +9 -13
  178. package/dist/index241.js.map +1 -1
  179. package/dist/index242.js +40 -147
  180. package/dist/index242.js.map +1 -1
  181. package/dist/index243.js +10 -29
  182. package/dist/index243.js.map +1 -1
  183. package/dist/index244.js +44 -9
  184. package/dist/index244.js.map +1 -1
  185. package/dist/index245.js +88 -40
  186. package/dist/index245.js.map +1 -1
  187. package/dist/index246.js +85 -10
  188. package/dist/index246.js.map +1 -1
  189. package/dist/index247.js +102 -41
  190. package/dist/index247.js.map +1 -1
  191. package/dist/index248.js +45 -88
  192. package/dist/index248.js.map +1 -1
  193. package/dist/index249.js +10 -85
  194. package/dist/index249.js.map +1 -1
  195. package/dist/index250.js +28 -96
  196. package/dist/index250.js.map +1 -1
  197. package/dist/index251.js +8 -52
  198. package/dist/index251.js.map +1 -1
  199. package/dist/index252.js +115 -10
  200. package/dist/index252.js.map +1 -1
  201. package/dist/index253.js +16 -36
  202. package/dist/index253.js.map +1 -1
  203. package/dist/index254.js +15 -8
  204. package/dist/index254.js.map +1 -1
  205. package/dist/index255.js +3 -116
  206. package/dist/index255.js.map +1 -1
  207. package/dist/index256.js +35 -16
  208. package/dist/index256.js.map +1 -1
  209. package/dist/index257.js +19 -14
  210. package/dist/index257.js.map +1 -1
  211. package/dist/index258.js +9 -3
  212. package/dist/index258.js.map +1 -1
  213. package/dist/index259.js +8 -36
  214. package/dist/index259.js.map +1 -1
  215. package/dist/index260.js +67 -20
  216. package/dist/index260.js.map +1 -1
  217. package/dist/index261.js +180 -9
  218. package/dist/index261.js.map +1 -1
  219. package/dist/index262.js +46 -8
  220. package/dist/index262.js.map +1 -1
  221. package/dist/index263.js +4 -4
  222. package/dist/index265.js +2 -2
  223. package/dist/index27.js +37 -3
  224. package/dist/index27.js.map +1 -1
  225. package/dist/index277.js +1 -1
  226. package/dist/index28.js +3 -125
  227. package/dist/index28.js.map +1 -1
  228. package/dist/index29.js +120 -227
  229. package/dist/index29.js.map +1 -1
  230. package/dist/index30.js +229 -21
  231. package/dist/index30.js.map +1 -1
  232. package/dist/index31.js +23 -50
  233. package/dist/index31.js.map +1 -1
  234. package/dist/index32.js +50 -2640
  235. package/dist/index32.js.map +1 -1
  236. package/dist/index33.js +2598 -351
  237. package/dist/index33.js.map +1 -1
  238. package/dist/index34.js +375 -214
  239. package/dist/index34.js.map +1 -1
  240. package/dist/index35.js +230 -19
  241. package/dist/index35.js.map +1 -1
  242. package/dist/index36.js +18 -138
  243. package/dist/index36.js.map +1 -1
  244. package/dist/index37.js +125 -170
  245. package/dist/index37.js.map +1 -1
  246. package/dist/index38.js +174 -64
  247. package/dist/index38.js.map +1 -1
  248. package/dist/index39.js +74 -88
  249. package/dist/index39.js.map +1 -1
  250. package/dist/index4.js +8 -8
  251. package/dist/index4.js.map +1 -1
  252. package/dist/index40.js +98 -5
  253. package/dist/index40.js.map +1 -1
  254. package/dist/index41.js +5 -843
  255. package/dist/index41.js.map +1 -1
  256. package/dist/index42.js +832 -54
  257. package/dist/index42.js.map +1 -1
  258. package/dist/index43.js +66 -37
  259. package/dist/index43.js.map +1 -1
  260. package/dist/index46.js +1 -1
  261. package/dist/index47.js +1 -1
  262. package/dist/index48.js +7 -205
  263. package/dist/index48.js.map +1 -1
  264. package/dist/index49.js +33 -6
  265. package/dist/index49.js.map +1 -1
  266. package/dist/index5.js +1 -1
  267. package/dist/index50.js +26 -33
  268. package/dist/index50.js.map +1 -1
  269. package/dist/index51.js +7 -26
  270. package/dist/index51.js.map +1 -1
  271. package/dist/index52.js +11 -7
  272. package/dist/index52.js.map +1 -1
  273. package/dist/index53.js +205 -12
  274. package/dist/index53.js.map +1 -1
  275. package/dist/index55.js +2 -2
  276. package/dist/index56.js +1 -1
  277. package/dist/index57.js +1 -1
  278. package/dist/index59.js +4 -4
  279. package/dist/index61.js +4 -4
  280. package/dist/index62.js +2 -2
  281. package/dist/index63.js +2 -2
  282. package/dist/index67.js +2 -2
  283. package/dist/index70.js +6 -2
  284. package/dist/index70.js.map +1 -1
  285. package/dist/index71.js +8 -2
  286. package/dist/index71.js.map +1 -1
  287. package/dist/index72.js +5 -5
  288. package/dist/index72.js.map +1 -1
  289. package/dist/index73.js +53 -7
  290. package/dist/index73.js.map +1 -1
  291. package/dist/index74.js +2 -6
  292. package/dist/index74.js.map +1 -1
  293. package/dist/index75.js +2 -52
  294. package/dist/index75.js.map +1 -1
  295. package/dist/index76.js +52 -5
  296. package/dist/index76.js.map +1 -1
  297. package/dist/index77.js +4 -4
  298. package/dist/index77.js.map +1 -1
  299. package/dist/index78.js +4 -15
  300. package/dist/index78.js.map +1 -1
  301. package/dist/index79.js +15 -5
  302. package/dist/index79.js.map +1 -1
  303. package/dist/index8.js +1 -1
  304. package/dist/index80.js +5 -7
  305. package/dist/index80.js.map +1 -1
  306. package/dist/index81.js +6 -15
  307. package/dist/index81.js.map +1 -1
  308. package/dist/index82.js +16 -4
  309. package/dist/index82.js.map +1 -1
  310. package/dist/index83.js +1 -1
  311. package/dist/index83.js.map +1 -1
  312. package/dist/index84.js +4 -5
  313. package/dist/index84.js.map +1 -1
  314. package/dist/index85.js +4 -4
  315. package/dist/index85.js.map +1 -1
  316. package/dist/index86.js +5 -4
  317. package/dist/index86.js.map +1 -1
  318. package/dist/index87.js +2 -2
  319. package/dist/index87.js.map +1 -1
  320. package/dist/index88.js +3 -5
  321. package/dist/index88.js.map +1 -1
  322. package/dist/index89.js +6 -24
  323. package/dist/index89.js.map +1 -1
  324. package/dist/index9.js +1 -1
  325. package/dist/index90.js +24 -6
  326. package/dist/index90.js.map +1 -1
  327. package/dist/index91.js +6 -4
  328. package/dist/index91.js.map +1 -1
  329. package/dist/index92.js +3 -5
  330. package/dist/index92.js.map +1 -1
  331. package/dist/index93.js +6 -5
  332. package/dist/index93.js.map +1 -1
  333. package/dist/index94.js +5 -4
  334. package/dist/index94.js.map +1 -1
  335. package/dist/index95.js +3 -4
  336. package/dist/index95.js.map +1 -1
  337. package/dist/index96.js +5 -4
  338. package/dist/index96.js.map +1 -1
  339. package/dist/index97.js +4 -8
  340. package/dist/index97.js.map +1 -1
  341. package/dist/index98.js +8 -5
  342. package/dist/index98.js.map +1 -1
  343. package/dist/index99.js +5 -4
  344. package/dist/index99.js.map +1 -1
  345. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index38.js","sources":["../src/components/PhoneNumberInput/selection.ts"],"sourcesContent":["function isDigitCharacter(char: string) {\n if (!char) {\n return false\n }\n const code = char.charCodeAt(0)\n return code >= 48 && code <= 57\n}\n\nfunction countDigitsBefore(value: string, index: number) {\n let count = 0\n const limit = Math.min(index, value.length)\n for (let position = 0; position < limit; position += 1) {\n if (isDigitCharacter(value[position] ?? \"\")) {\n count += 1\n }\n }\n return count\n}\n\nfunction findIndexForDigitCount(value: string, digitCount: number) {\n if (digitCount <= 0) {\n return value.startsWith(\"+\") ? Math.min(1, value.length) : 0\n }\n\n let seen = 0\n for (let index = 0; index < value.length; index += 1) {\n if (isDigitCharacter(value[index] ?? \"\")) {\n seen += 1\n if (seen === digitCount) {\n return index + 1\n }\n }\n }\n\n return value.length\n}\n\nfunction isFormattingCharacter(char: string) {\n if (!char) {\n return false\n }\n if (isDigitCharacter(char)) {\n return false\n }\n return char !== \"+\"\n}\n\nexport function skipFormattingCharactersLeft(value: string, index: number) {\n let position = index\n while (position > 0) {\n const next = value[position - 1] ?? \"\"\n if (!isFormattingCharacter(next)) {\n break\n }\n position -= 1\n }\n return position\n}\n\nexport function skipFormattingCharactersRight(value: string, index: number) {\n let position = index\n while (position < value.length) {\n const next = value[position] ?? \"\"\n if (!isFormattingCharacter(next)) {\n break\n }\n position += 1\n }\n return position\n}\n\ntype SelectionSnapshot = {\n selectionStart: number\n selectionEnd: number\n startDigits: number\n endDigits: number\n preserveStartIndex: boolean\n preserveEndIndex: boolean\n wasAtStart: boolean\n wasAtEnd: boolean\n}\n\nexport function captureSelectionSnapshot(input: HTMLInputElement): SelectionSnapshot {\n const { value } = input\n const selectionStart = input.selectionStart ?? value.length\n const selectionEnd = input.selectionEnd ?? selectionStart\n const preserveStartIndex = selectionStart <= 1 && value.startsWith(\"+\")\n const preserveEndIndex = selectionEnd <= 1 && value.startsWith(\"+\")\n\n return {\n selectionStart,\n selectionEnd,\n startDigits: countDigitsBefore(value, selectionStart),\n endDigits: countDigitsBefore(value, selectionEnd),\n preserveStartIndex,\n preserveEndIndex,\n wasAtStart: selectionStart === 0,\n wasAtEnd: selectionEnd === value.length,\n }\n}\n\nexport function resolveSelection(snapshot: SelectionSnapshot, value: string) {\n if (snapshot.selectionStart === snapshot.selectionEnd) {\n if (snapshot.wasAtEnd) {\n const end = value.length\n return { start: end, end }\n }\n if (snapshot.wasAtStart) {\n return { start: 0, end: 0 }\n }\n }\n\n const start = snapshot.preserveStartIndex\n ? Math.min(snapshot.selectionStart, value.length)\n : findIndexForDigitCount(value, snapshot.startDigits)\n const end = snapshot.preserveEndIndex\n ? Math.min(snapshot.selectionEnd, value.length)\n : findIndexForDigitCount(value, snapshot.endDigits)\n\n let resolvedStart = start\n let resolvedEnd = end\n\n if (snapshot.wasAtStart) {\n resolvedStart = 0\n }\n\n if (snapshot.wasAtEnd) {\n resolvedEnd = value.length\n }\n\n if (snapshot.selectionStart === snapshot.selectionEnd) {\n resolvedStart = resolvedEnd\n }\n\n const clampedStart = Math.min(Math.max(resolvedStart, 0), value.length)\n const clampedEnd = Math.min(Math.max(resolvedEnd, 0), value.length)\n\n if (clampedStart > clampedEnd) {\n return { start: clampedEnd, end: clampedEnd }\n }\n\n return { start: clampedStart, end: clampedEnd }\n}\n\n"],"names":["isDigitCharacter","char","code","countDigitsBefore","value","index","count","limit","position","findIndexForDigitCount","digitCount","seen","isFormattingCharacter","skipFormattingCharactersLeft","next","skipFormattingCharactersRight","captureSelectionSnapshot","input","selectionStart","selectionEnd","preserveStartIndex","preserveEndIndex","resolveSelection","snapshot","end","start","resolvedStart","resolvedEnd","clampedStart","clampedEnd"],"mappings":"AAAA,SAASA,EAAiBC,GAAc;AACtC,MAAI,CAACA;AACH,WAAO;AAET,QAAMC,IAAOD,EAAK,WAAW,CAAC;AAC9B,SAAOC,KAAQ,MAAMA,KAAQ;AAC/B;AAEA,SAASC,EAAkBC,GAAeC,GAAe;AACvD,MAAIC,IAAQ;AACZ,QAAMC,IAAQ,KAAK,IAAIF,GAAOD,EAAM,MAAM;AAC1C,WAASI,IAAW,GAAGA,IAAWD,GAAOC,KAAY;AACnD,IAAIR,EAAiBI,EAAMI,CAAQ,KAAK,EAAE,MACxCF,KAAS;AAGb,SAAOA;AACT;AAEA,SAASG,EAAuBL,GAAeM,GAAoB;AACjE,MAAIA,KAAc;AAChB,WAAON,EAAM,WAAW,GAAG,IAAI,KAAK,IAAI,GAAGA,EAAM,MAAM,IAAI;AAG7D,MAAIO,IAAO;AACX,WAASN,IAAQ,GAAGA,IAAQD,EAAM,QAAQC,KAAS;AACjD,QAAIL,EAAiBI,EAAMC,CAAK,KAAK,EAAE,MACrCM,KAAQ,GACJA,MAASD;AACX,aAAOL,IAAQ;AAKrB,SAAOD,EAAM;AACf;AAEA,SAASQ,EAAsBX,GAAc;AAI3C,SAHI,CAACA,KAGDD,EAAiBC,CAAI,IAChB,KAEFA,MAAS;AAClB;AAEO,SAASY,EAA6BT,GAAeC,GAAe;AACzE,M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WAAW,GAChDC,IAAMD,EAAS,mBACjB,KAAK,IAAIA,EAAS,cAAcnB,EAAM,MAAM,IAC5CK,EAAuBL,GAAOmB,EAAS,SAAS;AAEpD,MAAIG,IAAgBD,GAChBE,IAAcH;AAElB,EAAID,EAAS,eACXG,IAAgB,IAGdH,EAAS,aACXI,IAAcvB,EAAM,SAGlBmB,EAAS,mBAAmBA,EAAS,iBACvCG,IAAgBC;AAGlB,QAAMC,IAAe,KAAK,IAAI,KAAK,IAAIF,GAAe,CAAC,GAAGtB,EAAM,MAAM,GAChEyB,IAAa,KAAK,IAAI,KAAK,IAAIF,GAAa,CAAC,GAAGvB,EAAM,MAAM;AAElE,SAAIwB,IAAeC,IACV,EAAE,OAAOA,GAAY,KAAKA,EAAA,IAG5B,EAAE,OAAOD,GAAc,KAAKC,EAAA;AACrC;"}
1
+ {"version":3,"file":"index38.js","sources":["../src/components/PhoneNumberInput/normalization.ts"],"sourcesContent":["import type { CountryCode } from \"libphonenumber-js\"\nimport { AsYouType, getCountryCallingCode, validatePhoneNumberLength } from \"libphonenumber-js\"\n\nimport {\n COMMON_IDD_PREFIXES,\n COUNTRY_DIAL_CODES,\n DEFAULT_COUNTRY,\n MAX_DIAL_CODE_LENGTH,\n} from \"./country-options\"\n\n\nexport type LengthIssue = \"TOO_LONG\"\n\nexport function sanitizeDigits(value: string) {\n return value.replace(/\\D/g, \"\")\n}\n\nfunction isDialCodeProgress(digits: string) {\n if (!digits) {\n return true\n }\n\n if (digits.length > MAX_DIAL_CODE_LENGTH) {\n return false\n }\n\n return COUNTRY_DIAL_CODES.some((dial) => dial.startsWith(digits))\n}\n\nconst INVISIBLE_FORMATTING_CHARACTERS =\n /[\\u061C\\u200B-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]/g\n\nfunction stripInvisibleFormatting(value: string) {\n return value.replace(INVISIBLE_FORMATTING_CHARACTERS, \"\")\n}\n\nexport function injectNationalPrefixDisplay(\n international: string,\n dialCode: string,\n options: { force?: boolean } = {}\n) {\n // Preserve a user-typed national trunk (e.g. the French \"0\") purely for display\n // so validation can continue to use the canonical E.164 representation internally.\n const { force = false } = options\n const prefix = `+${dialCode}`\n\n if (!international.startsWith(prefix)) {\n return international\n }\n\n if (!force) {\n return international\n }\n\n const remainder = international.slice(prefix.length).trimStart()\n const alreadyHasTrunk = remainder.startsWith(\"0\")\n\n if (alreadyHasTrunk) {\n return international\n }\n\n if (!remainder) {\n return `${prefix} 0`\n }\n\n const [firstGroup, ...restGroups] = remainder.split(\" \")\n const rebuiltFirstGroup = `0${firstGroup ?? \"\"}`\n const rebuiltRemainder = restGroups.length > 0 ? ` ${restGroups.join(\" \")}` : \"\"\n\n return `${prefix} ${rebuiltFirstGroup}${rebuiltRemainder}`.replace(/\\s\\s+/g, \" \").trimEnd()\n}\n\nconst DETECTED_COUNTRY_OVERRIDES: Partial<Record<CountryCode, CountryCode>> = {\n GG: \"GB\",\n JE: \"GB\",\n IM: \"GB\",\n}\n\nfunction canonicalizeDetectedCountry(candidate: CountryCode | undefined): CountryCode | undefined {\n if (!candidate) {\n return undefined\n }\n return DETECTED_COUNTRY_OVERRIDES[candidate] ?? candidate\n}\n\ntype AsYouTypeNumber = ReturnType<AsYouType[\"getNumber\"]>\n\nfunction inferCountryFromDialCode(\n phoneNumber: AsYouTypeNumber,\n baseCountry: CountryCode | undefined,\n normalizedDigits: string\n): CountryCode | undefined {\n if (!phoneNumber) {\n return undefined\n }\n\n if (!normalizedDigits) {\n return undefined\n }\n\n const nationalDigits = phoneNumber.nationalNumber ?? \"\"\n if (nationalDigits.length < 4) {\n return undefined\n }\n\n const dial = phoneNumber.countryCallingCode\n if (!dial) {\n return undefined\n }\n\n const metadataGetter = (phoneNumber as unknown as { getMetadata?: () => unknown }).getMetadata\n const metadata =\n typeof metadataGetter === \"function\"\n ? (metadataGetter() as {\n country_calling_codes?: Record<string, string[]>\n } | null)\n : null\n\n const candidates = metadata?.country_calling_codes?.[dial]\n if (!candidates || candidates.length === 0) {\n return undefined\n }\n\n const canonicalCandidates: CountryCode[] = []\n for (const candidate of candidates) {\n const canonical = canonicalizeDetectedCountry(candidate as CountryCode)\n if (canonical && !canonicalCandidates.includes(canonical)) {\n canonicalCandidates.push(canonical)\n }\n }\n\n if (canonicalCandidates.length === 0) {\n return undefined\n }\n\n if (baseCountry && canonicalCandidates.includes(baseCountry)) {\n return baseCountry\n }\n\n if (canonicalCandidates.includes(DEFAULT_COUNTRY)) {\n return DEFAULT_COUNTRY\n }\n\n return canonicalCandidates[0]\n}\n\nexport function detectNationalPrefixForDisplay(\n rawDigits: string,\n internationalDigits: string,\n dialCode: string,\n hasExplicitInternationalPrefix: boolean\n) {\n if (!rawDigits) {\n return false\n }\n\n if (!hasExplicitInternationalPrefix) {\n return rawDigits.startsWith(\"0\")\n }\n\n if (!dialCode) {\n return false\n }\n\n if (!rawDigits.startsWith(dialCode)) {\n return false\n }\n\n if (!rawDigits.slice(dialCode.length).startsWith(\"0\")) {\n return false\n }\n\n const rawAfterTrunk = rawDigits.slice(dialCode.length + 1)\n const internationalAfterDial = internationalDigits.startsWith(dialCode)\n ? internationalDigits.slice(dialCode.length)\n : internationalDigits\n\n return rawAfterTrunk === internationalAfterDial\n}\n\nfunction stripIddPrefix(digits: string) {\n for (const prefix of COMMON_IDD_PREFIXES) {\n if (digits.startsWith(prefix)) {\n return digits.slice(prefix.length)\n }\n }\n return digits\n}\n\nexport function normalizeInputValue(\n rawValue: string,\n country: CountryCode | undefined,\n options: {\n allowJustPlus?: boolean\n removeNationalPrefix?: boolean\n previousValue?: string\n } = {}\n) {\n const { allowJustPlus = false, removeNationalPrefix = true, previousValue } = options\n const cleaned = stripInvisibleFormatting(rawValue)\n const trimmed = cleaned.trim()\n\n if (!trimmed) {\n return \"\"\n }\n\n if (trimmed === \"+\") {\n return allowJustPlus ? \"+\" : \"\"\n }\n\n if (trimmed.startsWith(\"+\")) {\n const digits = sanitizeDigits(trimmed)\n if (!digits) {\n return allowJustPlus ? \"+\" : \"\"\n }\n const digitsWithoutIdd = stripIddPrefix(digits)\n if (digitsWithoutIdd !== digits) {\n return digitsWithoutIdd ? `+${digitsWithoutIdd}` : allowJustPlus ? \"+\" : \"\"\n }\n if (removeNationalPrefix && country) {\n const dial = getCountryCallingCode(country)\n if (digits.startsWith(dial) && digits.slice(dial.length).startsWith(\"0\")) {\n const withoutPrefix = digits.slice(dial.length + 1)\n return withoutPrefix ? `+${dial}${withoutPrefix}` : `+${dial}`\n }\n }\n return `+${digits}`\n }\n\n const digitsOnly = sanitizeDigits(trimmed)\n if (!digitsOnly) {\n return \"\"\n }\n\n const digitsWithoutIdd = stripIddPrefix(digitsOnly)\n if (digitsWithoutIdd !== digitsOnly) {\n return digitsWithoutIdd ? `+${digitsWithoutIdd}` : allowJustPlus ? \"+\" : \"\"\n }\n\n const previousNormalized = typeof previousValue === \"string\" ? previousValue : \"\"\n const previousDigits =\n previousNormalized && previousNormalized.startsWith(\"+\")\n ? sanitizeDigits(previousNormalized)\n : \"\"\n\n if (previousDigits && previousDigits.length > digitsOnly.length) {\n if (previousDigits.endsWith(digitsOnly)) {\n const removedPrefixLength = previousDigits.length - digitsOnly.length\n if (removedPrefixLength <= MAX_DIAL_CODE_LENGTH) {\n return `+${digitsOnly}`\n }\n }\n }\n\n if (digitsOnly === \"0\") {\n return \"0\"\n }\n\n if (\n removeNationalPrefix &&\n country &&\n digitsOnly.length > 1 &&\n digitsOnly.startsWith(\"0\") &&\n !digitsOnly.startsWith(\"00\")\n ) {\n const dial = getCountryCallingCode(country)\n const withoutPrefix = digitsOnly.slice(1)\n return withoutPrefix ? `+${dial}${withoutPrefix}` : `+${dial}`\n }\n\n if (!country) {\n return digitsOnly\n }\n\n if (digitsOnly.length <= 4) {\n return `+${digitsOnly}`\n }\n\n const dial = getCountryCallingCode(country)\n return `+${dial}${digitsOnly}`\n}\n\nexport function formatWithAsYouType(value: string, baseCountry?: CountryCode) {\n if (value === \"+\") {\n return {\n international: \"+\",\n national: \"\",\n formatted: \"+\",\n phoneNumber: null,\n detectedCountry: undefined,\n inferredCountry: undefined,\n hasExplicitInternationalPrefix: true,\n }\n }\n\n const hasExplicitInternationalPrefix = /^\\s*\\+/.test(value)\n const formatter = baseCountry ? new AsYouType(baseCountry) : new AsYouType()\n const formatted = formatter.input(value)\n const phoneNumber = formatter.getNumber()\n const digits = sanitizeDigits(value)\n const detectedCountry = canonicalizeDetectedCountry(\n (phoneNumber?.country ?? formatter.country ?? undefined) as CountryCode | undefined\n )\n const inferredCountry =\n detectedCountry ?? !phoneNumber\n ? undefined\n : canonicalizeDetectedCountry(\n inferCountryFromDialCode(phoneNumber, baseCountry, digits)\n )\n\n const international = phoneNumber?.formatInternational() ?? formatted\n const national = phoneNumber?.formatNational() ?? sanitizeDigits(international)\n\n return {\n international,\n national,\n formatted,\n phoneNumber,\n detectedCountry,\n inferredCountry,\n hasExplicitInternationalPrefix,\n }\n}\n\nexport function stripPrefix(value: string, prefix: string) {\n return value.startsWith(prefix) ? value.slice(prefix.length) : value\n}\n\nexport function getLengthIssue(value: string, country: CountryCode | undefined): LengthIssue | null {\n if (!country || !value) {\n return null\n }\n\n try {\n const result = validatePhoneNumberLength(value, country)\n return result === \"TOO_LONG\" ? \"TOO_LONG\" : null\n } catch {\n return null\n }\n}\n\ntype SuggestionState = {\n shouldSuggest: boolean\n query: string\n}\n\nexport function getSuggestionState(\n normalized: string,\n baseCountry: CountryCode | undefined,\n phoneNumber: ReturnType<AsYouType[\"getNumber\"]>,\n options: {\n hasRemovedNationalPrefix?: boolean\n detectedCountry?: CountryCode\n hasExplicitInternationalPrefix?: boolean\n } = {}\n): SuggestionState {\n const {\n hasRemovedNationalPrefix = false,\n detectedCountry,\n hasExplicitInternationalPrefix = false,\n } = options\n\n if (!normalized) {\n return { shouldSuggest: false, query: \"\" }\n }\n\n if (normalized === \"+\") {\n return { shouldSuggest: true, query: \"\" }\n }\n\n const digits = sanitizeDigits(normalized)\n if (!digits) {\n return { shouldSuggest: true, query: \"\" }\n }\n\n if (hasRemovedNationalPrefix) {\n return { shouldSuggest: false, query: \"\" }\n }\n\n if (hasExplicitInternationalPrefix && !detectedCountry) {\n if (!isDialCodeProgress(digits)) {\n return { shouldSuggest: false, query: \"\" }\n }\n return { shouldSuggest: true, query: digits }\n }\n\n let dial = phoneNumber?.countryCallingCode ?? null\n if (!dial) {\n if (baseCountry) {\n const baseDial = getCountryCallingCode(baseCountry)\n if (digits.startsWith(baseDial)) {\n dial = baseDial\n }\n } else if (!hasExplicitInternationalPrefix) {\n return { shouldSuggest: false, query: \"\" }\n }\n }\n\n if (!dial) {\n return { shouldSuggest: true, query: digits }\n }\n\n const nationalDigits = stripPrefix(digits, dial)\n if (nationalDigits.length === 0) {\n return { shouldSuggest: true, query: digits }\n }\n\n return { shouldSuggest: false, query: \"\" }\n}\n\nexport function shouldDisplayExplicitCountrySelection(\n suggestion: SuggestionState,\n options: { detectedCountry?: CountryCode; hasExplicitInternationalPrefix?: boolean }\n) {\n if (suggestion.shouldSuggest) {\n return false\n }\n\n const { hasExplicitInternationalPrefix = false, detectedCountry } = options\n\n if (!hasExplicitInternationalPrefix) {\n return true\n }\n\n return Boolean(detectedCountry)\n}\n"],"names":["sanitizeDigits","value","isDialCodeProgress","digits","MAX_DIAL_CODE_LENGTH","COUNTRY_DIAL_CODES","dial","INVISIBLE_FORMATTING_CHARACTERS","stripInvisibleFormatting","injectNationalPrefixDisplay","international","dialCode","options","force","prefix","remainder","firstGroup","restGroups","rebuiltFirstGroup","rebuiltRemainder","DETECTED_COUNTRY_OVERRIDES","canonicalizeDetectedCountry","candidate","inferCountryFromDialCode","phoneNumber","baseCountry","normalizedDigits","metadataGetter","candidates","canonicalCandidates","canonical","DEFAULT_COUNTRY","detectNationalPrefixForDisplay","rawDigits","internationalDigits","hasExplicitInternationalPrefix","rawAfterTrunk","internationalAfterDial","stripIddPrefix","COMMON_IDD_PREFIXES","normalizeInputValue","rawValue","country","allowJustPlus","removeNationalPrefix","previousValue","trimmed","digitsWithoutIdd","getCountryCallingCode","withoutPrefix","digitsOnly","previousNormalized","previousDigits","formatWithAsYouType","formatter","AsYouType","formatted","detectedCountry","inferredCountry","national","stripPrefix","getLengthIssue","validatePhoneNumberLength","getSuggestionState","normalized","hasRemovedNationalPrefix","baseDial","shouldDisplayExplicitCountrySelection","suggestion"],"mappings":";;;;AAaO,SAASA,EAAeC,GAAe;AAC5C,SAAOA,EAAM,QAAQ,OAAO,EAAE;AAChC;AAEA,SAASC,EAAmBC,GAAgB;AAC1C,SAAKA,IAIDA,EAAO,SAASC,IACX,KAGFC,EAAmB,KAAK,CAACC,MAASA,EAAK,WAAWH,CAAM,CAAC,IAPvD;AAQX;AAEA,MAAMI,IACJ;AAEF,SAASC,EAAyBP,GAAe;AAC/C,SAAOA,EAAM,QAAQM,GAAiC,EAAE;AAC1D;AAEO,SAASE,EACdC,GACAC,GACAC,IAA+B,CAAA,GAC/B;AAGA,QAAM,EAAE,OAAAC,IAAQ,GAAA,IAAUD,GACpBE,IAAS,IAAIH,CAAQ;AAM3B,MAJI,CAACD,EAAc,WAAWI,CAAM,KAIhC,CAACD;AACH,WAAOH;AAGT,QAAMK,IAAYL,EAAc,MAAMI,EAAO,MAAM,EAAE,UAAA;AAGrD,MAFwBC,EAAU,WAAW,GAAG;AAG9C,WAAOL;AAGT,MAAI,CAACK;AACH,WAAO,GAAGD,CAAM;AAGlB,QAAM,CAACE,GAAY,GAAGC,CAAU,IAAIF,EAAU,MAAM,GAAG,GACjDG,IAAoB,IAAIF,KAAc,EAAE,IACxCG,IAAmBF,EAAW,SAAS,IAAI,IAAIA,EAAW,KAAK,GAAG,CAAC,KAAK;AAE9E,SAAO,GAAGH,CAAM,IAAII,CAAiB,GAAGC,CAAgB,GAAG,QAAQ,UAAU,GAAG,EAAE,QAAA;AACpF;AAEA,MAAMC,IAAwE;AAAA,EAC5E,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,SAASC,EAA4BC,GAA6D;AAChG,MAAKA;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AE,eAAe,IAAO,OAAO,GAAA,IAR7B,EAAE,eAAe,IAAM,OAAOA,EAAA;AASzC;AAEO,SAASgE,EACdC,GACAxD,GACA;AACA,MAAIwD,EAAW;AACb,WAAO;AAGT,QAAM,EAAE,gCAAAjC,IAAiC,IAAO,iBAAAsB,EAAA,IAAoB7C;AAEpE,SAAKuB,IAIE,EAAQsB,IAHN;AAIX;"}
package/dist/index39.js CHANGED
@@ -1,94 +1,80 @@
1
- import { j as o } from "./index27.js";
2
- import * as a from "react";
3
- import { cn as C } from "./index2.js";
4
- const S = a.createContext(null), M = (e) => {
5
- const n = a.useContext(S), c = n?.highlightedValue === e.data.value, { onMouseMove: f, className: m, ...g } = e.innerProps, h = n?.renderOptionLabel ?? ((t) => y(t)), l = a.useRef(null), { innerRef: r } = e, p = a.useCallback(
6
- (t) => {
7
- l.current = t, typeof r == "function" ? r(t) : r && typeof r == "object" && (r.current = t);
8
- },
9
- [r]
10
- );
11
- a.useEffect(() => {
12
- if (!c)
13
- return;
14
- const t = n?.consumeScrollBehavior, v = t ? t() : "smooth", s = l.current;
15
- if (!s)
16
- return;
17
- const i = s.parentElement;
18
- if (!i)
19
- return;
20
- const u = s.offsetTop, b = u + s.offsetHeight, d = i.scrollTop, j = d + i.clientHeight;
21
- u >= d && b <= j || s.scrollIntoView({
22
- block: "nearest",
23
- behavior: v
24
- });
25
- }, [n, c]);
26
- const x = (t) => {
27
- f?.(t), n?.setHighlightedOption(e.data);
1
+ function c(t) {
2
+ if (!t)
3
+ return !1;
4
+ const e = t.charCodeAt(0);
5
+ return e >= 48 && e <= 57;
6
+ }
7
+ function l(t, e) {
8
+ let n = 0;
9
+ const r = Math.min(e, t.length);
10
+ for (let i = 0; i < r; i += 1)
11
+ c(t[i] ?? "") && (n += 1);
12
+ return n;
13
+ }
14
+ function a(t, e) {
15
+ if (e <= 0)
16
+ return t.startsWith("+") ? Math.min(1, t.length) : 0;
17
+ let n = 0;
18
+ for (let r = 0; r < t.length; r += 1)
19
+ if (c(t[r] ?? "") && (n += 1, n === e))
20
+ return r + 1;
21
+ return t.length;
22
+ }
23
+ function g(t) {
24
+ return !t || c(t) ? !1 : t !== "+";
25
+ }
26
+ function h(t, e) {
27
+ let n = e;
28
+ for (; n > 0; ) {
29
+ const r = t[n - 1] ?? "";
30
+ if (!g(r))
31
+ break;
32
+ n -= 1;
33
+ }
34
+ return n;
35
+ }
36
+ function S(t, e) {
37
+ let n = e;
38
+ for (; n < t.length; ) {
39
+ const r = t[n] ?? "";
40
+ if (!g(r))
41
+ break;
42
+ n += 1;
43
+ }
44
+ return n;
45
+ }
46
+ function m(t) {
47
+ const { value: e } = t, n = t.selectionStart ?? e.length, r = t.selectionEnd ?? n, i = n <= 1 && e.startsWith("+"), o = r <= 1 && e.startsWith("+");
48
+ return {
49
+ selectionStart: n,
50
+ selectionEnd: r,
51
+ startDigits: l(e, n),
52
+ endDigits: l(e, r),
53
+ preserveStartIndex: i,
54
+ preserveEndIndex: o,
55
+ wasAtStart: n === 0,
56
+ wasAtEnd: r === e.length
28
57
  };
29
- return /* @__PURE__ */ o.jsx(
30
- "div",
31
- {
32
- ref: p,
33
- ...g,
34
- onMouseMove: x,
35
- className: C(
36
- "flex cursor-pointer items-center justify-between gap-3 px-3 py-2 text-sm",
37
- m,
38
- c ? "bg-muted text-foreground" : "text-foreground hover:bg-muted"
39
- ),
40
- children: h(e.data)
58
+ }
59
+ function u(t, e) {
60
+ if (t.selectionStart === t.selectionEnd) {
61
+ if (t.wasAtEnd) {
62
+ const f = e.length;
63
+ return { start: f, end: f };
41
64
  }
42
- );
43
- }, R = {
44
- control: () => ({
45
- display: "none"
46
- }),
47
- menu: (e) => ({
48
- ...e,
49
- marginTop: 4,
50
- borderRadius: "var(--radius)",
51
- boxShadow: "0 18px 36px rgba(15, 23, 42, 0.18)",
52
- backgroundColor: "hsl(var(--popover))",
53
- overflow: "hidden",
54
- zIndex: 20
55
- }),
56
- menuList: (e) => ({
57
- ...e,
58
- maxHeight: 240,
59
- padding: 0
60
- }),
61
- option: (e, n) => ({
62
- ...e,
63
- fontSize: "0.875rem",
64
- backgroundColor: n.isFocused ? "hsl(var(--muted))" : n.isSelected ? "hsl(var(--accent))" : "transparent",
65
- color: n.isSelected ? "hsl(var(--accent-foreground))" : "hsl(var(--foreground))",
66
- cursor: "pointer"
67
- }),
68
- noOptionsMessage: (e) => ({
69
- ...e,
70
- fontSize: "0.875rem",
71
- color: "hsl(var(--muted-foreground))"
72
- })
73
- }, H = (e) => /* @__PURE__ */ o.jsx("div", { style: { display: "none" }, children: e.children }), O = () => null;
74
- function y(e) {
75
- return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
76
- /* @__PURE__ */ o.jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
77
- e.flag ? /* @__PURE__ */ o.jsx("span", { "aria-hidden": "true", className: "text-lg leading-none", children: e.flag }) : null,
78
- /* @__PURE__ */ o.jsx("span", { className: "truncate", children: e.name })
79
- ] }),
80
- /* @__PURE__ */ o.jsxs("span", { className: "text-xs text-muted-foreground", children: [
81
- "+",
82
- e.dialCode
83
- ] })
84
- ] });
65
+ if (t.wasAtStart)
66
+ return { start: 0, end: 0 };
67
+ }
68
+ const n = t.preserveStartIndex ? Math.min(t.selectionStart, e.length) : a(e, t.startDigits), r = t.preserveEndIndex ? Math.min(t.selectionEnd, e.length) : a(e, t.endDigits);
69
+ let i = n, o = r;
70
+ t.wasAtStart && (i = 0), t.wasAtEnd && (o = e.length), t.selectionStart === t.selectionEnd && (i = o);
71
+ const d = Math.min(Math.max(i, 0), e.length), s = Math.min(Math.max(o, 0), e.length);
72
+ return d > s ? { start: s, end: s } : { start: d, end: s };
85
73
  }
86
74
  export {
87
- H as HiddenControl,
88
- O as NullComponent,
89
- S as SuggestionContext,
90
- M as SuggestionOption,
91
- y as formatCountryOption,
92
- R as suggestionSelectStyles
75
+ m as captureSelectionSnapshot,
76
+ u as resolveSelection,
77
+ h as skipFormattingCharactersLeft,
78
+ S as skipFormattingCharactersRight
93
79
  };
94
80
  //# sourceMappingURL=index39.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index39.js","sources":["../src/components/PhoneNumberInput/suggestions.tsx"],"sourcesContent":["import * as React from \"react\"\nimport type { CountryCode } from \"libphonenumber-js\"\nimport type { ControlProps, OptionProps, StylesConfig } from \"react-select\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type { CountryOption } from \"./types\"\n\n\nexport type SuggestionContextValue = {\n highlightedValue: CountryCode | null\n setHighlightedOption: (option: CountryOption) => void\n renderOptionLabel: (option: CountryOption) => React.ReactNode\n consumeScrollBehavior: () => ScrollBehavior\n}\n\nexport const SuggestionContext = React.createContext<SuggestionContextValue | null>(null)\n\nexport const SuggestionOption = (props: OptionProps<CountryOption, false>) => {\n const context = React.useContext(SuggestionContext)\n const isActive = context?.highlightedValue === props.data.value\n const { onMouseMove, className: receivedClassName, ...restInnerProps } = props.innerProps\n const renderLabel =\n context?.renderOptionLabel ?? ((option: CountryOption) => formatCountryOption(option))\n const optionRef = React.useRef<HTMLDivElement | null>(null)\n const { innerRef } = props\n\n const assignRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n optionRef.current = node\n if (typeof innerRef === \"function\") {\n innerRef(node)\n } else if (innerRef && typeof innerRef === \"object\") {\n ;(innerRef as React.MutableRefObject<HTMLDivElement | null>).current = node\n }\n },\n [innerRef]\n )\n\n React.useEffect(() => {\n if (!isActive) {\n return\n }\n\n const consumeScrollBehavior = context?.consumeScrollBehavior\n const behavior = consumeScrollBehavior ? consumeScrollBehavior() : \"smooth\"\n\n const target = optionRef.current\n if (!target) {\n return\n }\n\n const parent = target.parentElement\n if (!parent) {\n return\n }\n\n const top = target.offsetTop\n const bottom = top + target.offsetHeight\n const viewTop = parent.scrollTop\n const viewBottom = viewTop + parent.clientHeight\n\n if (top >= viewTop && bottom <= viewBottom) {\n return\n }\n\n target.scrollIntoView({\n block: \"nearest\",\n behavior,\n })\n }, [context, isActive])\n\n const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseMove?.(event)\n context?.setHighlightedOption(props.data)\n }\n\n return (\n <div\n ref={assignRef}\n {...restInnerProps}\n onMouseMove={handleMouseMove}\n className={cn(\n \"flex cursor-pointer items-center justify-between gap-3 px-3 py-2 text-sm\",\n receivedClassName,\n isActive ? \"bg-muted text-foreground\" : \"text-foreground hover:bg-muted\"\n )}\n >\n {renderLabel(props.data)}\n </div>\n )\n}\n\nexport const suggestionSelectStyles: StylesConfig<CountryOption, false> = {\n control: () => ({\n display: \"none\",\n }),\n menu: (provided) => ({\n ...provided,\n marginTop: 4,\n borderRadius: \"var(--radius)\",\n boxShadow: \"0 18px 36px rgba(15, 23, 42, 0.18)\",\n backgroundColor: \"hsl(var(--popover))\",\n overflow: \"hidden\",\n zIndex: 20,\n }),\n menuList: (provided) => ({\n ...provided,\n maxHeight: 240,\n padding: 0,\n }),\n option: (provided, state) => ({\n ...provided,\n fontSize: \"0.875rem\",\n backgroundColor: state.isFocused\n ? \"hsl(var(--muted))\"\n : state.isSelected\n ? \"hsl(var(--accent))\"\n : \"transparent\",\n color: state.isSelected\n ? \"hsl(var(--accent-foreground))\"\n : \"hsl(var(--foreground))\",\n cursor: \"pointer\",\n }),\n noOptionsMessage: (provided) => ({\n ...provided,\n fontSize: \"0.875rem\",\n color: \"hsl(var(--muted-foreground))\",\n }),\n}\n\nexport const HiddenControl = (props: ControlProps<CountryOption, false>) => (\n <div style={{ display: \"none\" }}>{props.children}</div>\n)\n\nexport const NullComponent = () => null\n\nexport function formatCountryOption(option: CountryOption) {\n return (\n <>\n <span className=\"flex min-w-0 items-center gap-2\">\n {option.flag ? (\n <span aria-hidden=\"true\" className=\"text-lg leading-none\">\n {option.flag}\n </span>\n ) : null}\n <span className=\"truncate\">{option.name}</span>\n </span>\n <span className=\"text-xs text-muted-foreground\">+{option.dialCode}</span>\n </>\n )\n}\n\n"],"names":["SuggestionContext","React","SuggestionOption","props","context","isActive","onMouseMove","receivedClassName","restInnerProps","renderLabel","option","formatCountryOption","optionRef","innerRef","assignRef","node","consumeScrollBehavior","behavior","target","parent","top","bottom","viewTop","viewBottom","handleMouseMove","event","jsx","cn","suggestionSelectStyles","provided","state","HiddenControl","NullComponent","jsxs","Fragment"],"mappings":";;;AAgBO,MAAMA,IAAoBC,EAAM,cAA6C,IAAI,GAE3EC,IAAmB,CAACC,MAA6C;AAC5E,QAAMC,IAAUH,EAAM,WAAWD,CAAiB,GAC5CK,IAAWD,GAAS,qBAAqBD,EAAM,KAAK,OACpD,EAAE,aAAAG,GAAa,WAAWC,GAAmB,GAAGC,EAAA,IAAmBL,EAAM,YACzEM,IACJL,GAAS,sBAAsB,CAACM,MAA0BC,EAAoBD,CAAM,IAChFE,IAAYX,EAAM,OAA8B,IAAI,GACpD,EAAE,UAAAY,MAAaV,GAEfW,IAAYb,EAAM;AAAA,IACtB,CAACc,MAAgC;AAC/B,MAAAH,EAAU,UAAUG,GAChB,OAAOF,KAAa,aACtBA,EAASE,CAAI,IACJF,KAAY,OAAOA,KAAa,aACvCA,EAA2D,UAAUE;AAAA,IAE3E;AAAA,IACA,CAACF,CAAQ;AAAA,EAAA;AAGX,EAAAZ,EAAM,UAAU,MAAM;AACpB,QAAI,CAACI;AACH;AAGF,UAAMW,IAAwBZ,GAAS,uBACjCa,IAAWD,IAAwBA,EAAA,IAA0B,UAE7DE,IAASN,EAAU;AACzB,QAAI,CAACM;AACH;AAGF,UAAMC,IAASD,EAAO;AACtB,QAAI,CAACC;AACH;AAGF,UAAMC,IAAMF,EAAO,WACbG,IAASD,IAAMF,EAAO,cACtBI,IAAUH,EAAO,WACjBI,IAAaD,IAAUH,EAAO;AAEpC,IAAIC,KAAOE,KAAWD,KAAUE,KAIhCL,EAAO,eAAe;AAAA,MACpB,OAAO;AAAA,MACP,UAAAD;AAAA,IAAA,CACD;AAAA,EACH,GAAG,CAACb,GAASC,CAAQ,CAAC;AAEtB,QAAMmB,IAAkB,CAACC,MAA4C;AACnE,IAAAnB,IAAc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AAU,mCACb,UAAA;AAAA,MAAAvB,EAAO,6BACL,QAAA,EAAK,eAAY,QAAO,WAAU,wBAChC,UAAAA,EAAO,KAAA,CACV,IACE;AAAA,MACJgB,gBAAAA,EAAAA,IAAC,QAAA,EAAK,WAAU,YAAY,YAAO,KAAA,CAAK;AAAA,IAAA,GAC1C;AAAA,IACAO,gBAAAA,EAAAA,KAAC,QAAA,EAAK,WAAU,iCAAgC,UAAA;AAAA,MAAA;AAAA,MAAEvB,EAAO;AAAA,IAAA,EAAA,CAAS;AAAA,EAAA,GACpE;AAEJ;"}
1
+ {"version":3,"file":"index39.js","sources":["../src/components/PhoneNumberInput/selection.ts"],"sourcesContent":["function isDigitCharacter(char: string) {\n if (!char) {\n return false\n }\n const code = char.charCodeAt(0)\n return code >= 48 && code <= 57\n}\n\nfunction countDigitsBefore(value: string, index: number) {\n let count = 0\n const limit = Math.min(index, value.length)\n for (let position = 0; position < limit; position += 1) {\n if (isDigitCharacter(value[position] ?? \"\")) {\n count += 1\n }\n }\n return count\n}\n\nfunction findIndexForDigitCount(value: string, digitCount: number) {\n if (digitCount <= 0) {\n return value.startsWith(\"+\") ? Math.min(1, value.length) : 0\n }\n\n let seen = 0\n for (let index = 0; index < value.length; index += 1) {\n if (isDigitCharacter(value[index] ?? \"\")) {\n seen += 1\n if (seen === digitCount) {\n return index + 1\n }\n }\n }\n\n return value.length\n}\n\nfunction isFormattingCharacter(char: string) {\n if (!char) {\n return false\n }\n if (isDigitCharacter(char)) {\n return false\n }\n return char !== \"+\"\n}\n\nexport function skipFormattingCharactersLeft(value: string, index: number) {\n let position = index\n while (position > 0) {\n const next = value[position - 1] ?? \"\"\n if (!isFormattingCharacter(next)) {\n break\n }\n position -= 1\n }\n return position\n}\n\nexport function skipFormattingCharactersRight(value: string, index: number) {\n let position = index\n while (position < value.length) {\n const next = value[position] ?? \"\"\n if (!isFormattingCharacter(next)) {\n break\n }\n position += 1\n }\n return position\n}\n\ntype SelectionSnapshot = {\n selectionStart: number\n selectionEnd: number\n startDigits: number\n endDigits: number\n preserveStartIndex: boolean\n preserveEndIndex: boolean\n wasAtStart: boolean\n wasAtEnd: boolean\n}\n\nexport function captureSelectionSnapshot(input: HTMLInputElement): SelectionSnapshot {\n const { value } = input\n const selectionStart = input.selectionStart ?? value.length\n const selectionEnd = input.selectionEnd ?? selectionStart\n const preserveStartIndex = selectionStart <= 1 && value.startsWith(\"+\")\n const preserveEndIndex = selectionEnd <= 1 && value.startsWith(\"+\")\n\n return {\n selectionStart,\n selectionEnd,\n startDigits: countDigitsBefore(value, selectionStart),\n endDigits: countDigitsBefore(value, selectionEnd),\n preserveStartIndex,\n preserveEndIndex,\n wasAtStart: selectionStart === 0,\n wasAtEnd: selectionEnd === value.length,\n }\n}\n\nexport function resolveSelection(snapshot: SelectionSnapshot, value: string) {\n if (snapshot.selectionStart === snapshot.selectionEnd) {\n if (snapshot.wasAtEnd) {\n const end = value.length\n return { start: end, end }\n }\n if (snapshot.wasAtStart) {\n return { start: 0, end: 0 }\n }\n }\n\n const start = snapshot.preserveStartIndex\n ? Math.min(snapshot.selectionStart, value.length)\n : findIndexForDigitCount(value, snapshot.startDigits)\n const end = snapshot.preserveEndIndex\n ? Math.min(snapshot.selectionEnd, value.length)\n : findIndexForDigitCount(value, snapshot.endDigits)\n\n let resolvedStart = start\n let resolvedEnd = end\n\n if (snapshot.wasAtStart) {\n resolvedStart = 0\n }\n\n if (snapshot.wasAtEnd) {\n resolvedEnd = value.length\n }\n\n if (snapshot.selectionStart === snapshot.selectionEnd) {\n resolvedStart = resolvedEnd\n }\n\n const clampedStart = Math.min(Math.max(resolvedStart, 0), value.length)\n const clampedEnd = Math.min(Math.max(resolvedEnd, 0), value.length)\n\n if (clampedStart > clampedEnd) {\n return { start: clampedEnd, end: clampedEnd }\n }\n\n return { start: clampedStart, end: clampedEnd }\n}\n\n"],"names":["isDigitCharacter","char","code","countDigitsBefore","value","index","count","limit","position","findIndexForDigitCount","digitCount","seen","isFormattingCharacter","skipFormattingCharactersLeft","next","skipFormattingCharactersRight","captureSelectionSnapshot","input","selectionStart","selectionEnd","preserveStartIndex","preserveEndIndex","resolveSelection","snapshot","end","start","resolvedStart","resolvedEnd","clampedStart","clampedEnd"],"mappings":"AAAA,SAASA,EAAiBC,GAAc;AACtC,MAAI,CAACA;AACH,WAAO;AAET,QAAMC,IAAOD,EAAK,WAAW,CAAC;AAC9B,SAAOC,KAAQ,MAAMA,KAAQ;AAC/B;AAEA,SAASC,EAAkBC,GAAeC,GAAe;AACvD,MAAIC,IAAQ;AACZ,QAAMC,IAAQ,KAAK,IAAIF,GAAOD,EAAM,MAAM;AAC1C,WAASI,IAAW,GAAGA,IAAWD,GAAOC,KAAY;AACnD,IAAIR,EAAiBI,EAAMI,CAAQ,KAAK,EAAE,MACxCF,KAAS;AAGb,SAAOA;AACT;AAEA,SAASG,EAAuBL,GAAeM,GAAoB;AACjE,MAAIA,KAAc;AAChB,WAAON,EAAM,WAAW,GAAG,IAAI,KAAK,IAAI,GAAGA,EAAM,MAAM,IAAI;AAG7D,MAAIO,IAAO;AACX,WAASN,IAAQ,GAAGA,IAAQD,EAAM,QAAQC,KAAS;AACjD,QAAIL,EAAiBI,EAAMC,CAAK,KAAK,EAAE,MACrCM,KAAQ,GACJA,MAASD;AACX,aAAOL,IAAQ;AAKrB,SAAOD,EAAM;AACf;AAEA,SAASQ,EAAsBX,GAAc;AAI3C,SAHI,CAACA,KAGDD,EAAiBC,CAAI,IAChB,KAEFA,MAAS;AAClB;AAEO,SAASY,EAA6BT,GAAeC,GAAe;AACzE,MAAIG,IAAWH;AACf,SAAOG,IAAW,KAAG;AACnB,UAAMM,IAAOV,EAAMI,IAAW,CAAC,KAAK;AACpC,QAAI,CAACI,EAAsBE,CAAI;AAC7B;AAEF,IAAAN,KAAY;AAAA,EACd;AACA,SAAOA;AACT;AAEO,SAASO,EAA8BX,GAAeC,GAAe;AAC1E,MAAIG,IAAWH;AACf,SAAOG,IAAWJ,EAAM,UAAQ;AAC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AGlB,QAAMC,IAAe,KAAK,IAAI,KAAK,IAAIF,GAAe,CAAC,GAAGtB,EAAM,MAAM,GAChEyB,IAAa,KAAK,IAAI,KAAK,IAAIF,GAAa,CAAC,GAAGvB,EAAM,MAAM;AAElE,SAAIwB,IAAeC,IACV,EAAE,OAAOA,GAAY,KAAKA,EAAA,IAG5B,EAAE,OAAOD,GAAc,KAAKC,EAAA;AACrC;"}
package/dist/index4.js CHANGED
@@ -1,15 +1,15 @@
1
- import { useState as a, useEffect as f, useLayoutEffect as d } from "react";
2
- const h = "(pointer: coarse)";
1
+ import { useState as u, useEffect as d } from "react";
2
+ const f = "(pointer: coarse)";
3
3
  function v() {
4
- const [n, i] = a(!1);
5
- return (typeof window > "u" ? f : d)(() => {
4
+ const [o, i] = u(!1);
5
+ return d(() => {
6
6
  if (typeof window > "u")
7
7
  return;
8
- const e = typeof window.matchMedia == "function" ? window.matchMedia(h) : void 0, s = () => {
8
+ const e = typeof window.matchMedia == "function" ? window.matchMedia(f) : void 0, s = () => {
9
9
  if (typeof window > "u")
10
10
  return !1;
11
- const c = e?.matches ?? !1, o = typeof navigator < "u" ? navigator : void 0, u = o?.maxTouchPoints ?? 0, r = o?.msMaxTouchPoints ?? 0;
12
- return c || u > 0 || r > 0;
11
+ const c = e?.matches ?? !1, n = typeof navigator < "u" ? navigator : void 0, r = n?.maxTouchPoints ?? 0, a = n?.msMaxTouchPoints ?? 0;
12
+ return c || r > 0 || a > 0;
13
13
  }, t = () => {
14
14
  i(s());
15
15
  };
@@ -19,7 +19,7 @@ function v() {
19
19
  if (typeof e.addListener == "function")
20
20
  return e.addListener(t), () => e.removeListener(t);
21
21
  }
22
- }, []), n;
22
+ }, []), o;
23
23
  }
24
24
  export {
25
25
  v as useIsTouchDevice
@@ -1 +1 @@
1
- {"version":3,"file":"index4.js","sources":["../src/helpers/useIsTouchDevice.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useState } from \"react\"\n\n\nconst TOUCH_MEDIA_QUERY = \"(pointer: coarse)\"\n\nexport function useIsTouchDevice() {\n const [isTouchDevice, setIsTouchDevice] = useState(false)\n\n const useIsomorphicLayoutEffect = typeof window === \"undefined\" ? useEffect : useLayoutEffect\n\n useIsomorphicLayoutEffect(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n const mediaQuery =\n typeof window.matchMedia === \"function\" ? window.matchMedia(TOUCH_MEDIA_QUERY) : undefined\n\n const getHasTouchSupport = () => {\n if (typeof window === \"undefined\") {\n return false\n }\n\n const mqMatches = mediaQuery?.matches ?? false\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined\n const maxTouchPoints = nav?.maxTouchPoints ?? 0\n const msMaxTouchPoints = (nav as unknown as { msMaxTouchPoints?: number })?.msMaxTouchPoints ?? 0\n\n return mqMatches || maxTouchPoints > 0 || msMaxTouchPoints > 0\n }\n\n const updateIsTouchDevice = () => {\n setIsTouchDevice(getHasTouchSupport())\n }\n\n updateIsTouchDevice()\n\n if (!mediaQuery) {\n return\n }\n\n if (typeof mediaQuery.addEventListener === \"function\") {\n mediaQuery.addEventListener(\"change\", updateIsTouchDevice)\n return () => mediaQuery.removeEventListener(\"change\", updateIsTouchDevice)\n }\n\n if (typeof mediaQuery.addListener === \"function\") {\n mediaQuery.addListener(updateIsTouchDevice)\n return () => mediaQuery.removeListener(updateIsTouchDevice)\n }\n }, [])\n\n return isTouchDevice\n}\n\n"],"names":["TOUCH_MEDIA_QUERY","useIsTouchDevice","isTouchDevice","setIsTouchDevice","useState","useEffect","useLayoutEffect","mediaQuery","getHasTouchSupport","mqMatches","nav","maxTouchPoints","msMaxTouchPoints","updateIsTouchDevice"],"mappings":";AAGA,MAAMA,IAAoB;AAEnB,SAASC,IAAmB;AACjC,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK;AAIxD,UAFkC,OAAO,SAAW,MAAcC,IAAYC,GAEpD,MAAM;AAC9B,QAAI,OAAO,SAAW;AACpB;AAGF,UAAMC,IACJ,OAAO,OAAO,cAAe,aAAa,OAAO,WAAWP,CAAiB,IAAI,QAE7EQ,IAAqB,MAAM;AAC/B,UAAI,OAAO,SAAW;AACpB,eAAO;AAGT,YAAMC,IAAYF,GAAY,WAAW,IACnCG,IAAM,OAAO,YAAc,MAAc,YAAY,QACrDC,IAAiBD,GAAK,kBAAkB,GACxCE,IAAoBF,GAAkD,oBAAoB;AAEhG,aAAOD,KAAaE,IAAiB,KAAKC,IAAmB;AAAA,IAC/D,GAEMC,IAAsB,MAAM;AAChC,MAAAV,EAAiBK,GAAoB;AAAA,IACvC;AAIA,QAFAK,EAAA,GAEI,EAACN,GAIL;AAAA,UAAI,OAAOA,EAAW,oBAAqB;AACzC,eAAAA,EAAW,iBAAiB,UAAUM,CAAmB,GAClD,MAAMN,EAAW,oBAAoB,UAAUM,CAAmB;AAG3E,UAAI,OAAON,EAAW,eAAgB;AACpC,eAAAA,EAAW,YAAYM,CAAmB,GACnC,MAAMN,EAAW,eAAeM,CAAmB;AAAA;AAAA,EAE9D,GAAG,CAAA,CAAE,GAEEX;AACT;"}
1
+ {"version":3,"file":"index4.js","sources":["../src/helpers/useIsTouchDevice.ts"],"sourcesContent":["import { useEffect, useState } from \"react\"\n\n\nconst TOUCH_MEDIA_QUERY = \"(pointer: coarse)\"\n\nexport function useIsTouchDevice() {\n const [isTouchDevice, setIsTouchDevice] = useState(false)\n\n // React Compiler rejects hook aliasing (useIsomorphicLayoutEffect pattern), so we keep\n // a direct hook call and guard browser-only logic inside the effect.\n useEffect(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n const mediaQuery =\n typeof window.matchMedia === \"function\" ? window.matchMedia(TOUCH_MEDIA_QUERY) : undefined\n\n const getHasTouchSupport = () => {\n if (typeof window === \"undefined\") {\n return false\n }\n\n const mqMatches = mediaQuery?.matches ?? false\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined\n const maxTouchPoints = nav?.maxTouchPoints ?? 0\n const msMaxTouchPoints = (nav as unknown as { msMaxTouchPoints?: number })?.msMaxTouchPoints ?? 0\n\n return mqMatches || maxTouchPoints > 0 || msMaxTouchPoints > 0\n }\n\n const updateIsTouchDevice = () => {\n setIsTouchDevice(getHasTouchSupport())\n }\n\n updateIsTouchDevice()\n\n if (!mediaQuery) {\n return\n }\n\n if (typeof mediaQuery.addEventListener === \"function\") {\n mediaQuery.addEventListener(\"change\", updateIsTouchDevice)\n return () => mediaQuery.removeEventListener(\"change\", updateIsTouchDevice)\n }\n\n if (typeof mediaQuery.addListener === \"function\") {\n mediaQuery.addListener(updateIsTouchDevice)\n return () => mediaQuery.removeListener(updateIsTouchDevice)\n }\n }, [])\n\n return isTouchDevice\n}\n"],"names":["TOUCH_MEDIA_QUERY","useIsTouchDevice","isTouchDevice","setIsTouchDevice","useState","useEffect","mediaQuery","getHasTouchSupport","mqMatches","nav","maxTouchPoints","msMaxTouchPoints","updateIsTouchDevice"],"mappings":";AAGA,MAAMA,IAAoB;AAEnB,SAASC,IAAmB;AACjC,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK;AAIxD,SAAAC,EAAU,MAAM;AACd,QAAI,OAAO,SAAW;AACpB;AAGF,UAAMC,IACJ,OAAO,OAAO,cAAe,aAAa,OAAO,WAAWN,CAAiB,IAAI,QAE7EO,IAAqB,MAAM;AAC/B,UAAI,OAAO,SAAW;AACpB,eAAO;AAGT,YAAMC,IAAYF,GAAY,WAAW,IACnCG,IAAM,OAAO,YAAc,MAAc,YAAY,QACrDC,IAAiBD,GAAK,kBAAkB,GACxCE,IAAoBF,GAAkD,oBAAoB;AAEhG,aAAOD,KAAaE,IAAiB,KAAKC,IAAmB;AAAA,IAC/D,GAEMC,IAAsB,MAAM;AAChC,MAAAT,EAAiBI,GAAoB;AAAA,IACvC;AAIA,QAFAK,EAAA,GAEI,EAACN,GAIL;AAAA,UAAI,OAAOA,EAAW,oBAAqB;AACzC,eAAAA,EAAW,iBAAiB,UAAUM,CAAmB,GAClD,MAAMN,EAAW,oBAAoB,UAAUM,CAAmB;AAG3E,UAAI,OAAON,EAAW,eAAgB;AACpC,eAAAA,EAAW,YAAYM,CAAmB,GACnC,MAAMN,EAAW,eAAeM,CAAmB;AAAA;AAAA,EAE9D,GAAG,CAAA,CAAE,GAEEV;AACT;"}
package/dist/index40.js CHANGED
@@ -1,9 +1,102 @@
1
- import t from "./index154.js";
2
- import { getCountryCallingCode as o } from "./index168.js";
3
- function n() {
4
- return t(o, arguments);
1
+ import { j as o } from "./index28.js";
2
+ import * as s from "react";
3
+ import { cn as C } from "./index2.js";
4
+ const S = s.createContext(null);
5
+ function y(e, t) {
6
+ if (typeof e == "function") {
7
+ e(t);
8
+ return;
9
+ }
10
+ e && typeof e == "object" && Reflect.set(e, "current", t);
11
+ }
12
+ const M = (e) => {
13
+ const t = s.useContext(S), a = t?.highlightedValue === e.data.value, { onMouseMove: m, className: f, ...g } = e.innerProps, p = t?.renderOptionLabel ?? ((n) => R(n)), i = s.useRef(null), { innerRef: l } = e, h = s.useCallback(
14
+ (n) => {
15
+ i.current = n, y(l, n);
16
+ },
17
+ [l]
18
+ );
19
+ s.useEffect(() => {
20
+ if (!a)
21
+ return;
22
+ const n = t?.consumeScrollBehavior, v = n ? n() : "smooth", r = i.current;
23
+ if (!r)
24
+ return;
25
+ const c = r.parentElement;
26
+ if (!c)
27
+ return;
28
+ const u = r.offsetTop, b = u + r.offsetHeight, d = c.scrollTop, j = d + c.clientHeight;
29
+ u >= d && b <= j || r.scrollIntoView({
30
+ block: "nearest",
31
+ behavior: v
32
+ });
33
+ }, [t, a]);
34
+ const x = (n) => {
35
+ m?.(n), t?.setHighlightedOption(e.data);
36
+ };
37
+ return /* @__PURE__ */ o.jsx(
38
+ "div",
39
+ {
40
+ ref: h,
41
+ ...g,
42
+ onMouseMove: x,
43
+ className: C(
44
+ "flex cursor-pointer items-center justify-between gap-3 px-3 py-2 text-sm",
45
+ f,
46
+ a ? "bg-muted text-foreground" : "text-foreground hover:bg-muted"
47
+ ),
48
+ children: p(e.data)
49
+ }
50
+ );
51
+ }, O = {
52
+ control: () => ({
53
+ display: "none"
54
+ }),
55
+ menu: (e) => ({
56
+ ...e,
57
+ marginTop: 4,
58
+ borderRadius: "var(--radius)",
59
+ boxShadow: "0 18px 36px rgba(15, 23, 42, 0.18)",
60
+ backgroundColor: "hsl(var(--popover))",
61
+ overflow: "hidden",
62
+ zIndex: 20
63
+ }),
64
+ menuList: (e) => ({
65
+ ...e,
66
+ maxHeight: 240,
67
+ padding: 0
68
+ }),
69
+ option: (e, t) => ({
70
+ ...e,
71
+ fontSize: "0.875rem",
72
+ backgroundColor: t.isFocused ? "hsl(var(--muted))" : t.isSelected ? "hsl(var(--accent))" : "transparent",
73
+ color: t.isSelected ? "hsl(var(--accent-foreground))" : "hsl(var(--foreground))",
74
+ cursor: "pointer"
75
+ }),
76
+ noOptionsMessage: (e) => ({
77
+ ...e,
78
+ fontSize: "0.875rem",
79
+ color: "hsl(var(--muted-foreground))"
80
+ })
81
+ }, H = (e) => /* @__PURE__ */ o.jsx("div", { style: { display: "none" }, children: e.children }), k = () => null;
82
+ function R(e) {
83
+ return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
84
+ /* @__PURE__ */ o.jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
85
+ e.flag ? /* @__PURE__ */ o.jsx("span", { "aria-hidden": "true", className: "text-lg leading-none", children: e.flag }) : null,
86
+ /* @__PURE__ */ o.jsx("span", { className: "truncate", children: e.name })
87
+ ] }),
88
+ /* @__PURE__ */ o.jsxs("span", { className: "text-xs text-muted-foreground", children: [
89
+ "+",
90
+ e.dialCode
91
+ ] })
92
+ ] });
5
93
  }
6
94
  export {
7
- n as getCountryCallingCode
95
+ H as HiddenControl,
96
+ k as NullComponent,
97
+ S as SuggestionContext,
98
+ M as SuggestionOption,
99
+ R as formatCountryOption,
100
+ O as suggestionSelectStyles
8
101
  };
9
102
  //# sourceMappingURL=index40.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index40.js","sources":["../../../node_modules/libphonenumber-js/min/exports/getCountryCallingCode.js"],"sourcesContent":["import withMetadataArgument from './withMetadataArgument.js'\r\nimport { getCountryCallingCode as _getCountryCallingCode } from '../../core/index.js'\r\n\r\nexport function getCountryCallingCode() {\r\n\treturn withMetadataArgument(_getCountryCallingCode, arguments)\r\n}"],"names":["getCountryCallingCode","withMetadataArgument","_getCountryCallingCode"],"mappings":";;AAGO,SAASA,IAAwB;AACvC,SAAOC,EAAqBC,GAAwB,SAAS;AAC9D;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index40.js","sources":["../src/components/PhoneNumberInput/suggestions.tsx"],"sourcesContent":["import * as React from \"react\"\nimport type { CountryCode } from \"libphonenumber-js\"\nimport type { ControlProps, OptionProps, StylesConfig } from \"react-select\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type { CountryOption } from \"./types\"\n\n\nexport type SuggestionContextValue = {\n highlightedValue: CountryCode | null\n setHighlightedOption: (option: CountryOption) => void\n renderOptionLabel: (option: CountryOption) => React.ReactNode\n consumeScrollBehavior: () => ScrollBehavior\n}\n\nexport const SuggestionContext = React.createContext<SuggestionContextValue | null>(null)\n\nfunction assignOptionRef(ref: React.Ref<HTMLDivElement> | undefined, node: HTMLDivElement | null) {\n if (typeof ref === \"function\") {\n ref(node)\n return\n }\n if (ref && typeof ref === \"object\") {\n Reflect.set(ref, \"current\", node)\n }\n}\n\nexport const SuggestionOption = (props: OptionProps<CountryOption, false>) => {\n const context = React.useContext(SuggestionContext)\n const isActive = context?.highlightedValue === props.data.value\n const { onMouseMove, className: receivedClassName, ...restInnerProps } = props.innerProps\n const renderLabel =\n context?.renderOptionLabel ?? ((option: CountryOption) => formatCountryOption(option))\n const optionRef = React.useRef<HTMLDivElement | null>(null)\n const { innerRef } = props\n\n const assignRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n optionRef.current = node\n assignOptionRef(innerRef, node)\n },\n [innerRef]\n )\n\n React.useEffect(() => {\n if (!isActive) {\n return\n }\n\n const consumeScrollBehavior = context?.consumeScrollBehavior\n const behavior = consumeScrollBehavior ? consumeScrollBehavior() : \"smooth\"\n\n const target = optionRef.current\n if (!target) {\n return\n }\n\n const parent = target.parentElement\n if (!parent) {\n return\n }\n\n const top = target.offsetTop\n const bottom = top + target.offsetHeight\n const viewTop = parent.scrollTop\n const viewBottom = viewTop + parent.clientHeight\n\n if (top >= viewTop && bottom <= viewBottom) {\n return\n }\n\n target.scrollIntoView({\n block: \"nearest\",\n behavior,\n })\n }, [context, isActive])\n\n const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseMove?.(event)\n context?.setHighlightedOption(props.data)\n }\n\n return (\n <div\n ref={assignRef}\n {...restInnerProps}\n onMouseMove={handleMouseMove}\n className={cn(\n \"flex cursor-pointer items-center justify-between gap-3 px-3 py-2 text-sm\",\n receivedClassName,\n isActive ? \"bg-muted text-foreground\" : \"text-foreground hover:bg-muted\"\n )}\n >\n {renderLabel(props.data)}\n </div>\n )\n}\n\nexport const suggestionSelectStyles: StylesConfig<CountryOption, false> = {\n control: () => ({\n display: \"none\",\n }),\n menu: (provided) => ({\n ...provided,\n marginTop: 4,\n borderRadius: \"var(--radius)\",\n boxShadow: \"0 18px 36px rgba(15, 23, 42, 0.18)\",\n backgroundColor: \"hsl(var(--popover))\",\n overflow: \"hidden\",\n zIndex: 20,\n }),\n menuList: (provided) => ({\n ...provided,\n maxHeight: 240,\n padding: 0,\n }),\n option: (provided, state) => ({\n ...provided,\n fontSize: \"0.875rem\",\n backgroundColor: state.isFocused\n ? \"hsl(var(--muted))\"\n : state.isSelected\n ? \"hsl(var(--accent))\"\n : \"transparent\",\n color: state.isSelected\n ? \"hsl(var(--accent-foreground))\"\n : \"hsl(var(--foreground))\",\n cursor: \"pointer\",\n }),\n noOptionsMessage: (provided) => ({\n ...provided,\n fontSize: \"0.875rem\",\n color: \"hsl(var(--muted-foreground))\",\n }),\n}\n\nexport const HiddenControl = (props: ControlProps<CountryOption, false>) => (\n <div style={{ display: \"none\" }}>{props.children}</div>\n)\n\nexport const NullComponent = () => null\n\nexport function formatCountryOption(option: CountryOption) {\n return (\n <>\n <span className=\"flex min-w-0 items-center gap-2\">\n {option.flag ? (\n <span aria-hidden=\"true\" className=\"text-lg leading-none\">\n {option.flag}\n </span>\n ) : null}\n <span className=\"truncate\">{option.name}</span>\n </span>\n <span className=\"text-xs text-muted-foreground\">+{option.dialCode}</span>\n </>\n )\n}\n"],"names":["SuggestionContext","React","assignOptionRef","ref","node","SuggestionOption","props","context","isActive","onMouseMove","receivedClassName","restInnerProps","renderLabel","option","formatCountryOption","optionRef","innerRef","assignRef","consumeScrollBehavior","behavior","target","parent","top","bottom","viewTop","viewBottom","handleMouseMove","event","jsx","cn","suggestionSelectStyles","provided","state","HiddenControl","NullComponent","jsxs","Fragment"],"mappings":";;;AAgBO,MAAMA,IAAoBC,EAAM,cAA6C,IAAI;AAExF,SAASC,EAAgBC,GAA4CC,GAA6B;AAChG,MAAI,OAAOD,KAAQ,YAAY;AAC7B,IAAAA,EAAIC,CAAI;AACR;AAAA,EACF;AACA,EAAID,KAAO,OAAOA,KAAQ,YACxB,QAAQ,IAAIA,GAAK,WAAWC,CAAI;AAEpC;AAEO,MAAMC,IAAmB,CAACC,MAA6C;AAC5E,QAAMC,IAAUN,EAAM,WAAWD,CAAiB,GAC5CQ,IAAWD,GAAS,qBAAqBD,EAAM,KAAK,OACpD,EAAE,aAAAG,GAAa,WAAWC,GAAmB,GAAGC,EAAA,IAAmBL,EAAM,YACzEM,IACJL,GAAS,sBAAsB,CAACM,MAA0BC,EAAoBD,CAAM,IAChFE,IAAYd,EAAM,OAA8B,IAAI,GACpD,EAAE,UAAAe,MAAaV,GAEfW,IAAYhB,EAAM;AAAA,IACtB,CAACG,MAAgC;AAC/B,MAAAW,EAAU,UAAUX,GACpBF,EAAgBc,GAAUZ,CAAI;AAAA,IAChC;AAAA,IACA,CAACY,CAAQ;AAAA,EAAA;AAGX,EAAAf,EAAM,UAAU,MAAM;AACpB,QAAI,CAACO;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