@salla.sa/twilight-components 2.14.524 → 2.14.526

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 (354) hide show
  1. package/dist/cjs/{filepond-BVaAyFoF.js → filepond-dCwl_WGS.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-D_7P3fIq.js → filepond-plugin-file-poster-JE47euyP.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-wpUbEEJQ.js → filepond-plugin-file-validate-size-CFbzBG_a.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DnsofxYi.js → filepond-plugin-file-validate-type-B95BRuZd.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-BN8NNj8r.js → filepond-plugin-image-edit-QbQgAOte.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-Bh2lasm5.js → filepond-plugin-image-exif-orientation-C3KRxOCO.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-CEuvK6zb.js → filepond-plugin-image-preview-Bg5kON16.js} +1 -1
  8. package/dist/cjs/{functions-BsqbMNo6.js → functions-DI3Yp4Of.js} +1 -1
  9. package/dist/cjs/{index-B2m0lkUU.js → index-CL2v3rWe.js} +2 -2
  10. package/dist/cjs/intlTelInput-BhGMuXpz.js +4449 -0
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +24 -6
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-booking-field_7.cjs.entry.js +32 -16
  22. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +82 -7
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  47. package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
  48. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  49. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  50. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  55. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-map_2.cjs.entry.js +71 -15
  58. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  106. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  107. package/dist/cjs/{tracked-promise-DV7LEYsU.js → tracked-promise-BE9q9nKy.js} +1 -1
  108. package/dist/cjs/twilight.cjs.js +2 -2
  109. package/dist/cjs/utils-BD1un9WN.js +544 -0
  110. package/dist/cjs/{vanilla-picker-CXvH2EWT.js → vanilla-picker-DOFw7Ga1.js} +1 -1
  111. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +82 -6
  112. package/dist/collection/components/salla-map/salla-map.css +20 -1
  113. package/dist/collection/components/salla-map/salla-map.js +86 -13
  114. package/dist/collection/components/salla-product-options/salla-product-options.js +27 -5
  115. package/dist/collection/components/salla-tel-input/salla-tel-input.css +25 -17
  116. package/dist/collection/components/salla-tel-input/salla-tel-input.js +21 -5
  117. package/dist/components/index.js +2 -2
  118. package/dist/components/intlTelInput.js +4447 -0
  119. package/dist/components/salla-bullet-delivery.js +82 -6
  120. package/dist/components/salla-map2.js +71 -14
  121. package/dist/components/salla-product-options2.js +23 -5
  122. package/dist/components/salla-tel-input2.js +23 -7
  123. package/dist/components/utils.js +542 -0
  124. package/dist/esm/{filepond-DTzVnm2p.js → filepond-CTe79mlR.js} +1 -1
  125. package/dist/esm/{filepond-plugin-file-poster-Bgus9Ofh.js → filepond-plugin-file-poster-FpMbRCuf.js} +1 -1
  126. package/dist/esm/{filepond-plugin-file-validate-size-B8PRvgIP.js → filepond-plugin-file-validate-size-B_GPzKYu.js} +1 -1
  127. package/dist/esm/{filepond-plugin-file-validate-type-CAs60OfK.js → filepond-plugin-file-validate-type-CgBrFV7x.js} +1 -1
  128. package/dist/esm/{filepond-plugin-image-edit-5pQX-bqs.js → filepond-plugin-image-edit-DElBchkY.js} +1 -1
  129. package/dist/esm/{filepond-plugin-image-exif-orientation-CQmP0y_L.js → filepond-plugin-image-exif-orientation-BhZHvn_5.js} +1 -1
  130. package/dist/esm/{filepond-plugin-image-preview-DdIiCGg1.js → filepond-plugin-image-preview-D2oaWqOt.js} +1 -1
  131. package/dist/esm/{functions-DpljrYCU.js → functions-DzuTSHQl.js} +1 -1
  132. package/dist/esm/{index-Dm54yhRt.js → index-LKlIr4DH.js} +2 -2
  133. package/dist/esm/intlTelInput-Dv1YqwOl.js +4447 -0
  134. package/dist/esm/loader.js +3 -3
  135. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  136. package/dist/esm/salla-accordion_6.entry.js +1 -1
  137. package/dist/esm/salla-add-product-button_5.entry.js +24 -6
  138. package/dist/esm/salla-advertisement.entry.js +1 -1
  139. package/dist/esm/salla-alert_2.entry.js +1 -1
  140. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  141. package/dist/esm/salla-apps-icons.entry.js +1 -1
  142. package/dist/esm/salla-badge.entry.js +1 -1
  143. package/dist/esm/salla-basket-gap.entry.js +1 -1
  144. package/dist/esm/salla-booking-field_7.entry.js +32 -16
  145. package/dist/esm/salla-bullet-delivery_2.entry.js +82 -7
  146. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  147. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  148. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  149. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  150. package/dist/esm/salla-comment-factors.entry.js +1 -1
  151. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  152. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  153. package/dist/esm/salla-contacts.entry.js +1 -1
  154. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  155. package/dist/esm/salla-count-down_2.entry.js +1 -1
  156. package/dist/esm/salla-custom-fields.entry.js +1 -1
  157. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  158. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  159. package/dist/esm/salla-filters-widget.entry.js +1 -1
  160. package/dist/esm/salla-filters.entry.js +1 -1
  161. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  162. package/dist/esm/salla-gifting.entry.js +1 -1
  163. package/dist/esm/salla-hook.entry.js +1 -1
  164. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  165. package/dist/esm/salla-installment.entry.js +1 -1
  166. package/dist/esm/salla-list-tile.entry.js +1 -1
  167. package/dist/esm/salla-localization-modal.entry.js +1 -1
  168. package/dist/esm/salla-login-modal.entry.js +1 -1
  169. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  170. package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
  171. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  172. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  173. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  174. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  175. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  176. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  177. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  178. package/dist/esm/salla-loyalty.entry.js +1 -1
  179. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  180. package/dist/esm/salla-map_2.entry.js +71 -15
  181. package/dist/esm/salla-menu.entry.js +1 -1
  182. package/dist/esm/salla-metadata.entry.js +1 -1
  183. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  184. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  185. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  186. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  187. package/dist/esm/salla-notification-item.entry.js +1 -1
  188. package/dist/esm/salla-notifications.entry.js +1 -1
  189. package/dist/esm/salla-offer-modal.entry.js +1 -1
  190. package/dist/esm/salla-offer.entry.js +1 -1
  191. package/dist/esm/salla-order-branch.entry.js +1 -1
  192. package/dist/esm/salla-order-cancel.entry.js +1 -1
  193. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  194. package/dist/esm/salla-order-details-options.entry.js +1 -1
  195. package/dist/esm/salla-order-details.entry.js +1 -1
  196. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  197. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  198. package/dist/esm/salla-order-edit.entry.js +1 -1
  199. package/dist/esm/salla-order-shipments.entry.js +1 -1
  200. package/dist/esm/salla-order-summary.entry.js +1 -1
  201. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  202. package/dist/esm/salla-orders.entry.js +1 -1
  203. package/dist/esm/salla-payments.entry.js +1 -1
  204. package/dist/esm/salla-placeholder.entry.js +1 -1
  205. package/dist/esm/salla-price-range.entry.js +1 -1
  206. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  207. package/dist/esm/salla-product-card_2.entry.js +1 -1
  208. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  209. package/dist/esm/salla-products-list.entry.js +1 -1
  210. package/dist/esm/salla-quick-order.entry.js +1 -1
  211. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  212. package/dist/esm/salla-rating-modal.entry.js +1 -1
  213. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  214. package/dist/esm/salla-scopes.entry.js +1 -1
  215. package/dist/esm/salla-search.entry.js +1 -1
  216. package/dist/esm/salla-skeleton.entry.js +1 -1
  217. package/dist/esm/salla-slider.entry.js +1 -1
  218. package/dist/esm/salla-social-share.entry.js +1 -1
  219. package/dist/esm/salla-social.entry.js +1 -1
  220. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  221. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  222. package/dist/esm/salla-tooltip.entry.js +1 -1
  223. package/dist/esm/salla-trust-badges.entry.js +1 -1
  224. package/dist/esm/salla-user-menu.entry.js +1 -1
  225. package/dist/esm/salla-user-profile.entry.js +1 -1
  226. package/dist/esm/salla-user-settings.entry.js +1 -1
  227. package/dist/esm/salla-verify.entry.js +1 -1
  228. package/dist/esm/salla-wallet.entry.js +1 -1
  229. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  230. package/dist/esm/{tracked-promise-B8yCrzxY.js → tracked-promise-yYcxeJzZ.js} +1 -1
  231. package/dist/esm/twilight.js +3 -3
  232. package/dist/esm/utils-DxnArMXe.js +542 -0
  233. package/dist/esm/{vanilla-picker-DFISd8Ab.js → vanilla-picker-BAPOtEmC.js} +1 -1
  234. package/dist/twilight/{p-d6146737.entry.js → p-0559d448.entry.js} +1 -1
  235. package/dist/twilight/{p-34bb17c9.entry.js → p-067f052b.entry.js} +1 -1
  236. package/dist/twilight/{p-2e9f26cf.entry.js → p-06c4a0cd.entry.js} +1 -1
  237. package/dist/twilight/{p-4f5916dd.entry.js → p-10c3a012.entry.js} +1 -1
  238. package/dist/twilight/{p-cd0f27b8.entry.js → p-1227aa55.entry.js} +1 -1
  239. package/dist/twilight/{p-85ffcb0d.entry.js → p-146706fc.entry.js} +1 -1
  240. package/dist/twilight/{p-18dc5f4f.entry.js → p-166343b3.entry.js} +1 -1
  241. package/dist/twilight/{p-9f88fd32.entry.js → p-172a034d.entry.js} +1 -1
  242. package/dist/twilight/{p-6f20f79a.entry.js → p-1b5189f0.entry.js} +1 -1
  243. package/dist/twilight/{p-e4c40a79.entry.js → p-1e799c60.entry.js} +1 -1
  244. package/dist/twilight/{p-acfc17d6.entry.js → p-233039ec.entry.js} +1 -1
  245. package/dist/twilight/{p-0b74b865.entry.js → p-253afd49.entry.js} +1 -1
  246. package/dist/twilight/{p-bc633deb.entry.js → p-2766a17f.entry.js} +1 -1
  247. package/dist/twilight/{p-c55ed08e.entry.js → p-288e4fd6.entry.js} +1 -1
  248. package/dist/twilight/p-2c14546d.entry.js +4 -0
  249. package/dist/twilight/{p-a307c408.entry.js → p-2e9fcab1.entry.js} +1 -1
  250. package/dist/twilight/{p-eb1e775a.entry.js → p-2ea5c336.entry.js} +1 -1
  251. package/dist/twilight/{p-d5262ac3.entry.js → p-2f6e46b0.entry.js} +1 -1
  252. package/dist/twilight/{p-00d22240.entry.js → p-31a1bd9c.entry.js} +1 -1
  253. package/dist/twilight/{p-e6255c72.entry.js → p-326a584d.entry.js} +1 -1
  254. package/dist/twilight/{p-a5070e48.entry.js → p-385e1853.entry.js} +1 -1
  255. package/dist/twilight/{p-df1badad.entry.js → p-3a46d113.entry.js} +1 -1
  256. package/dist/twilight/{p-c38bfc00.entry.js → p-3a9c2e9d.entry.js} +1 -1
  257. package/dist/twilight/p-3f6fac09.entry.js +4 -0
  258. package/dist/twilight/{p-2798756b.entry.js → p-44bf6cdf.entry.js} +1 -1
  259. package/dist/twilight/{p-70e2d99d.entry.js → p-466fa362.entry.js} +1 -1
  260. package/dist/twilight/{p-4364da4b.entry.js → p-4c36ba4c.entry.js} +1 -1
  261. package/dist/twilight/{p-0e24390e.entry.js → p-4cc9583f.entry.js} +1 -1
  262. package/dist/twilight/{p-01277c1f.entry.js → p-4d46bd3d.entry.js} +1 -1
  263. package/dist/twilight/{p-1daa6531.entry.js → p-4e213aab.entry.js} +1 -1
  264. package/dist/twilight/{p-90929ee0.entry.js → p-500f0db8.entry.js} +1 -1
  265. package/dist/twilight/{p-b775c3a7.entry.js → p-50365a49.entry.js} +1 -1
  266. package/dist/twilight/{p-44ce2c67.entry.js → p-5555817c.entry.js} +1 -1
  267. package/dist/twilight/{p-d171016f.entry.js → p-584817e5.entry.js} +1 -1
  268. package/dist/twilight/{p-31d66e74.entry.js → p-59dbe5f1.entry.js} +1 -1
  269. package/dist/twilight/{p-2dbea343.entry.js → p-5c5f4f73.entry.js} +1 -1
  270. package/dist/twilight/{p-6c0de09b.entry.js → p-60a7b50b.entry.js} +1 -1
  271. package/dist/twilight/{p-764b05c3.entry.js → p-61cd30d3.entry.js} +1 -1
  272. package/dist/twilight/{p-6d989923.entry.js → p-6204462a.entry.js} +1 -1
  273. package/dist/twilight/{p-e8cc3acd.entry.js → p-630e769f.entry.js} +1 -1
  274. package/dist/twilight/{p-92cf1e0d.entry.js → p-65d86157.entry.js} +1 -1
  275. package/dist/twilight/{p-ce888cc2.entry.js → p-6bbc3c94.entry.js} +1 -1
  276. package/dist/twilight/{p-f9f3639d.entry.js → p-71344ddc.entry.js} +1 -1
  277. package/dist/twilight/{p-811d6f89.entry.js → p-72e4ef6a.entry.js} +1 -1
  278. package/dist/twilight/{p-fcfd176b.entry.js → p-761165fd.entry.js} +1 -1
  279. package/dist/twilight/{p-a26fb2b5.entry.js → p-797a7c1e.entry.js} +1 -1
  280. package/dist/twilight/{p-32f66a87.entry.js → p-7edb518f.entry.js} +1 -1
  281. package/dist/twilight/{p-82e55dfd.entry.js → p-85819cea.entry.js} +1 -1
  282. package/dist/twilight/{p-453ac18c.entry.js → p-879de784.entry.js} +1 -1
  283. package/dist/twilight/{p-8d2a1e57.entry.js → p-882128d2.entry.js} +1 -1
  284. package/dist/twilight/{p-bbad7f4d.entry.js → p-8993c586.entry.js} +1 -1
  285. package/dist/twilight/{p-e14dc1a9.entry.js → p-89ff463e.entry.js} +1 -1
  286. package/dist/twilight/{p-24901c56.entry.js → p-8a3cb52e.entry.js} +1 -1
  287. package/dist/twilight/{p-2b52c465.entry.js → p-8bb53ed2.entry.js} +2 -2
  288. package/dist/twilight/{p-f1639848.entry.js → p-8f7579e4.entry.js} +1 -1
  289. package/dist/twilight/{p-ff58cb8e.entry.js → p-9445f844.entry.js} +1 -1
  290. package/dist/twilight/{p-b53f24e0.entry.js → p-961941f2.entry.js} +1 -1
  291. package/dist/twilight/{p-6aa57467.entry.js → p-96fff354.entry.js} +1 -1
  292. package/dist/twilight/{p-2db47792.entry.js → p-97f12f7b.entry.js} +1 -1
  293. package/dist/twilight/{p-b9228f9e.entry.js → p-99228024.entry.js} +1 -1
  294. package/dist/twilight/{p-7622f77e.entry.js → p-9a9d4676.entry.js} +1 -1
  295. package/dist/twilight/{p-edae5524.entry.js → p-9bd015e5.entry.js} +1 -1
  296. package/dist/twilight/{p-DOQPe4jW.js → p-BGqFcZFD.js} +1 -1
  297. package/dist/twilight/{p-D6U543Hv.js → p-BJ2QKyWM.js} +1 -1
  298. package/dist/twilight/{p-CfrlyZxh.js → p-BOmRCp86.js} +1 -1
  299. package/dist/twilight/{p-CQ_QHwLy.js → p-BVtJp-gU.js} +1 -1
  300. package/dist/twilight/p-Bdz016Fy.js +4 -0
  301. package/dist/twilight/{p-CK_JEpA3.js → p-By36wPtc.js} +1 -1
  302. package/dist/twilight/{p-BdU8gNuL.js → p-CnIis-ob.js} +1 -1
  303. package/dist/twilight/{p-Bmtik9Kw.js → p-DkALFehO.js} +1 -1
  304. package/dist/twilight/{p-N0-g_Ku2.js → p-DmcP-9uS.js} +2 -2
  305. package/dist/twilight/p-DxnArMXe.js +4 -0
  306. package/dist/twilight/{p-3Tx29o41.js → p-HiDU1qAC.js} +1 -1
  307. package/dist/twilight/{p-Dm54yhRt.js → p-LKlIr4DH.js} +1 -1
  308. package/dist/twilight/{p-e775748f.entry.js → p-a435c54c.entry.js} +1 -1
  309. package/dist/twilight/{p-6417da90.entry.js → p-b063d0f3.entry.js} +1 -1
  310. package/dist/twilight/{p-d8d26e4b.entry.js → p-b1b11ebb.entry.js} +1 -1
  311. package/dist/twilight/{p-6fe98a4d.entry.js → p-b46bd39f.entry.js} +1 -1
  312. package/dist/twilight/{p-4467ceb0.entry.js → p-b5c106ac.entry.js} +1 -1
  313. package/dist/twilight/{p-f351fca5.entry.js → p-b6ce3117.entry.js} +1 -1
  314. package/dist/twilight/{p-8e05dbd7.entry.js → p-b76720e1.entry.js} +1 -1
  315. package/dist/twilight/{p-b089053b.entry.js → p-bb242f20.entry.js} +1 -1
  316. package/dist/twilight/{p-bd31410b.entry.js → p-beaf3f78.entry.js} +1 -1
  317. package/dist/twilight/{p-865393ae.entry.js → p-c06229a1.entry.js} +1 -1
  318. package/dist/twilight/{p-1ca4cb0a.entry.js → p-c06ab3be.entry.js} +1 -1
  319. package/dist/twilight/{p-083bc1c5.entry.js → p-c1036ebd.entry.js} +1 -1
  320. package/dist/twilight/{p-08c61694.entry.js → p-c19412a4.entry.js} +1 -1
  321. package/dist/twilight/{p-8493acd8.entry.js → p-c7c2dad0.entry.js} +1 -1
  322. package/dist/twilight/{p-d34ee17e.entry.js → p-cf3b863c.entry.js} +1 -1
  323. package/dist/twilight/{p-879904a5.entry.js → p-cf95b06d.entry.js} +1 -1
  324. package/dist/twilight/{p-042fe473.entry.js → p-cffe12a3.entry.js} +1 -1
  325. package/dist/twilight/{p-d8909798.entry.js → p-d477d0ab.entry.js} +1 -1
  326. package/dist/twilight/p-d81ee10d.entry.js +4 -0
  327. package/dist/twilight/{p-282d3b67.entry.js → p-de14bb3d.entry.js} +1 -1
  328. package/dist/twilight/{p-fcc76e96.entry.js → p-dfea079f.entry.js} +1 -1
  329. package/dist/twilight/{p-d9a53204.entry.js → p-e407d576.entry.js} +1 -1
  330. package/dist/twilight/{p-5acbcd72.entry.js → p-e6ae56e1.entry.js} +1 -1
  331. package/dist/twilight/{p-f6b097ee.entry.js → p-ebaa623e.entry.js} +1 -1
  332. package/dist/twilight/{p-074f8d80.entry.js → p-ec1730a3.entry.js} +1 -1
  333. package/dist/twilight/{p-066b78d8.entry.js → p-eea93ac7.entry.js} +1 -1
  334. package/dist/twilight/{p-71aeefcf.entry.js → p-eed700e7.entry.js} +1 -1
  335. package/dist/twilight/{p-2ca2dc2a.entry.js → p-ef4a0ae4.entry.js} +1 -1
  336. package/dist/twilight/{p-be71261f.entry.js → p-f418df90.entry.js} +1 -1
  337. package/dist/twilight/{p-4c3b7f11.entry.js → p-f4733e21.entry.js} +1 -1
  338. package/dist/twilight/{p-c88af64d.entry.js → p-f5154b22.entry.js} +1 -1
  339. package/dist/twilight/{p-d594a28c.entry.js → p-fd33515c.entry.js} +1 -1
  340. package/dist/twilight/{p-bf7b92c5.entry.js → p-fe40bb32.entry.js} +1 -1
  341. package/dist/twilight/{p-Bsy6Ioog.js → p-j2CozAo8.js} +1 -1
  342. package/dist/twilight/twilight.esm.js +1 -1
  343. package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +16 -0
  344. package/dist/types/components/salla-map/salla-map.d.ts +15 -0
  345. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +3 -0
  346. package/dist/types/components.d.ts +4 -0
  347. package/package.json +6 -6
  348. package/dist/cjs/index-D5DmfeX9.js +0 -1714
  349. package/dist/components/index3.js +0 -1712
  350. package/dist/esm/index-DPAGXd41.js +0 -1712
  351. package/dist/twilight/p-8a789d76.entry.js +0 -4
  352. package/dist/twilight/p-96d471a9.entry.js +0 -4
  353. package/dist/twilight/p-C_YmM4Ke.js +0 -4
  354. package/dist/twilight/p-a7643570.entry.js +0 -4
@@ -1,1714 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- 'use strict';
5
-
6
- var index$2 = require('./index-B2m0lkUU.js');
7
-
8
- function _mergeNamespaces(n, m) {
9
- m.forEach(function (e) {
10
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
11
- if (k !== 'default' && !(k in n)) {
12
- var d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: function () { return e[k]; }
16
- });
17
- }
18
- });
19
- });
20
- return Object.freeze(n);
21
- }
22
-
23
- var intlTelInput$1 = {exports: {}};
24
-
25
- /*
26
- * International Telephone Input v18.5.3
27
- * https://github.com/jackocnr/intl-tel-input.git
28
- * Licensed under the MIT license
29
- */
30
-
31
- var hasRequiredIntlTelInput$1;
32
-
33
- function requireIntlTelInput$1 () {
34
- if (hasRequiredIntlTelInput$1) return intlTelInput$1.exports;
35
- hasRequiredIntlTelInput$1 = 1;
36
- (function (module) {
37
- // wrap in UMD
38
- (function(factory) {
39
- if (module.exports) module.exports = factory(); else window.intlTelInput = factory();
40
- })(function(undefined$1) {
41
- return function() {
42
- // Array of country objects for the flag dropdown.
43
- // Here is the criteria for the plugin to support a given country/territory
44
- // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
45
- // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes
46
- // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png
47
- // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml
48
- // Each country array has the following information:
49
- // [
50
- // Country name,
51
- // iso2 code,
52
- // International dial code,
53
- // Order (if >1 country with same dial code),
54
- // Area codes
55
- // ]
56
- var allCountries = [ [ "Afghanistan", "af", "93" ], [ "Albania", "al", "355" ], [ "Algeria", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua & Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria", "at", "43" ], [ "Azerbaijan", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain", "bh", "973" ], [ "Bangladesh", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus", "by", "375" ], [ "Belgium", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia & Herzegovina", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi", "bi", "257" ], [ "Cambodia", "kh", "855" ], [ "Cameroon", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic", "cf", "236" ], [ "Chad", "td", "235" ], [ "Chile", "cl", "56" ], [ "China", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros", "km", "269" ], [ "Congo - Brazzaville", "cg", "242" ], [ "Congo - Kinshasa", "cd", "243" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus", "cy", "357" ], [ "Czech Republic", "cz", "420" ], [ "Denmark", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands", "fk", "500" ], [ "Faroe Islands", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana", "gf", "594" ], [ "French Polynesia", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia", "ge", "995" ], [ "Germany", "de", "49" ], [ "Ghana", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece", "gr", "30" ], [ "Greenland", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea", "gn", "224" ], [ "Guinea-Bissau", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong", "hk", "852" ], [ "Hungary", "hu", "36" ], [ "Iceland", "is", "354" ], [ "India", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran", "ir", "98" ], [ "Iraq", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel", "il", "972" ], [ "Italy", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan", "jo", "962" ], [ "Kazakhstan", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait", "kw", "965" ], [ "Kyrgyzstan", "kg", "996" ], [ "Laos", "la", "856" ], [ "Latvia", "lv", "371" ], [ "Lebanon", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau", "mo", "853" ], [ "Madagascar", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania", "mr", "222" ], [ "Mauritius", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia", "mn", "976" ], [ "Montenegro", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco", "ma", "212", 0 ], [ "Mozambique", "mz", "258" ], [ "Myanmar (Burma)", "mm", "95" ], [ "Namibia", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal", "np", "977" ], [ "Netherlands", "nl", "31" ], [ "New Caledonia", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea", "kp", "850" ], [ "North Macedonia", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway", "no", "47", 0 ], [ "Oman", "om", "968" ], [ "Pakistan", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine", "ps", "970" ], [ "Panama", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar", "qa", "974" ], [ "Réunion", "re", "262", 0 ], [ "Romania", "ro", "40" ], [ "Russia", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé & Príncipe", "st", "239" ], [ "Saudi Arabia", "sa", "966" ], [ "Senegal", "sn", "221" ], [ "Serbia", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia", "sk", "421" ], [ "Slovenia", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea", "kr", "82" ], [ "South Sudan", "ss", "211" ], [ "Spain", "es", "34" ], [ "Sri Lanka", "lk", "94" ], [ "St Barthélemy", "bl", "590", 1 ], [ "St Helena", "sh", "290" ], [ "St Kitts & Nevis", "kn", "1", 18, [ "869" ] ], [ "St Lucia", "lc", "1", 19, [ "758" ] ], [ "St Martin", "mf", "590", 2 ], [ "St Pierre & Miquelon", "pm", "508" ], [ "St Vincent & Grenadines", "vc", "1", 20, [ "784" ] ], [ "Sudan", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard & Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden", "se", "46" ], [ "Switzerland", "ch", "41" ], [ "Syria", "sy", "963" ], [ "Taiwan", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad & Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia", "tn", "216" ], [ "Turkey", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks & Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "Uganda", "ug", "256" ], [ "Ukraine", "ua", "380" ], [ "United Arab Emirates", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "US Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uzbekistan", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam", "vn", "84" ], [ "Wallis & Futuna", "wf", "681" ], [ "Western Sahara", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ];
57
- // loop over all of the countries above, restructuring the data to be objects with named keys
58
- for (var i = 0; i < allCountries.length; i++) {
59
- var c = allCountries[i];
60
- allCountries[i] = {
61
- name: c[0],
62
- iso2: c[1],
63
- dialCode: c[2],
64
- priority: c[3] || 0,
65
- areaCodes: c[4] || null
66
- };
67
- }
68
- function _objectSpread(target) {
69
- for (var i = 1; i < arguments.length; i++) {
70
- var source = arguments[i] != null ? Object(arguments[i]) : {};
71
- var ownKeys = Object.keys(source);
72
- if (typeof Object.getOwnPropertySymbols === "function") {
73
- ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) {
74
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
75
- }));
76
- }
77
- ownKeys.forEach(function(key) {
78
- _defineProperty(target, key, source[key]);
79
- });
80
- }
81
- return target;
82
- }
83
- function _defineProperty(obj, key, value) {
84
- key = _toPropertyKey(key);
85
- if (key in obj) {
86
- Object.defineProperty(obj, key, {
87
- value: value,
88
- enumerable: true,
89
- configurable: true,
90
- writable: true
91
- });
92
- } else {
93
- obj[key] = value;
94
- }
95
- return obj;
96
- }
97
- function _classCallCheck(instance, Constructor) {
98
- if (!(instance instanceof Constructor)) {
99
- throw new TypeError("Cannot call a class as a function");
100
- }
101
- }
102
- function _defineProperties(target, props) {
103
- for (var i = 0; i < props.length; i++) {
104
- var descriptor = props[i];
105
- descriptor.enumerable = descriptor.enumerable || false;
106
- descriptor.configurable = true;
107
- if ("value" in descriptor) descriptor.writable = true;
108
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
109
- }
110
- }
111
- function _createClass(Constructor, protoProps, staticProps) {
112
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
113
- Object.defineProperty(Constructor, "prototype", {
114
- writable: false
115
- });
116
- return Constructor;
117
- }
118
- function _toPropertyKey(arg) {
119
- var key = _toPrimitive(arg, "string");
120
- return typeof key === "symbol" ? key : String(key);
121
- }
122
- function _toPrimitive(input, hint) {
123
- if (typeof input !== "object" || input === null) return input;
124
- var prim = input[Symbol.toPrimitive];
125
- if (prim !== undefined$1) {
126
- var res = prim.call(input, hint);
127
- if (typeof res !== "object") return res;
128
- throw new TypeError("@@toPrimitive must return a primitive value.");
129
- }
130
- return (String )(input);
131
- }
132
- var intlTelInputGlobals = {
133
- getInstance: function getInstance(input) {
134
- var id = input.getAttribute("data-intl-tel-input-id");
135
- return window.intlTelInputGlobals.instances[id];
136
- },
137
- instances: {},
138
- // using a global like this allows us to mock it in the tests
139
- documentReady: function documentReady() {
140
- return document.readyState === "complete";
141
- }
142
- };
143
- if (typeof window === "object") {
144
- window.intlTelInputGlobals = intlTelInputGlobals;
145
- }
146
- // these vars persist through all instances of the plugin
147
- var id = 0;
148
- var defaults = {
149
- // whether or not to allow the dropdown
150
- allowDropdown: true,
151
- // auto insert dial code (A) on init, (B) on user selecting a country, (C) on calling setCountry
152
- // also listen for blur/submit and auto remove dial code if that's all there is
153
- autoInsertDialCode: false,
154
- // add a placeholder in the input with an example number for the selected country
155
- autoPlaceholder: "polite",
156
- // add a country search input at the top of the dropdown
157
- countrySearch: false,
158
- // modify the parentClass
159
- customContainer: "",
160
- // modify the auto placeholder
161
- customPlaceholder: null,
162
- // append menu to specified element
163
- dropdownContainer: null,
164
- // don't display these countries
165
- excludeCountries: [],
166
- // fix the dropdown width to the input width (rather than being as wide as the longest country name)
167
- fixDropdownWidth: false,
168
- // format the input value during initialisation and on setNumber
169
- formatOnDisplay: true,
170
- // geoIp lookup function
171
- geoIpLookup: null,
172
- // inject a hidden input with this name, and on submit, populate it with the result of getNumber
173
- hiddenInput: "",
174
- // initial country
175
- initialCountry: "",
176
- // localized country names e.g. { 'de': 'Deutschland' }
177
- localizedCountries: null,
178
- // national vs international formatting for numbers e.g. placeholders and displaying existing numbers
179
- nationalMode: true,
180
- // display only these countries
181
- onlyCountries: [],
182
- // number type to use for placeholders
183
- placeholderNumberType: "MOBILE",
184
- // the countries at the top of the list. defaults to united states and united kingdom
185
- preferredCountries: [ "us", "gb" ],
186
- // display the country dial code next to the selected flag
187
- separateDialCode: false,
188
- // option to hide the flags - must be used with separateDialCode, or allowDropdown=false
189
- showFlags: true,
190
- // use full screen popup instead of dropdown for country list
191
- useFullscreenPopup: typeof navigator !== "undefined" && typeof window !== "undefined" ? // we cannot just test screen size as some smartphones/website meta tags will report desktop
192
- // resolutions
193
- // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'
194
- /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false,
195
- // specify the path to the libphonenumber script to enable validation/formatting
196
- utilsScript: ""
197
- };
198
- // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes
199
- var regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ];
200
- // utility function to iterate over an object. can't use Object.entries or native forEach because
201
- // of IE11
202
- var forEachProp = function forEachProp(obj, callback) {
203
- var keys = Object.keys(obj);
204
- for (var i = 0; i < keys.length; i++) {
205
- callback(keys[i], obj[keys[i]]);
206
- }
207
- };
208
- // run a method on each instance of the plugin
209
- var forEachInstance = function forEachInstance(method) {
210
- forEachProp(window.intlTelInputGlobals.instances, function(key) {
211
- window.intlTelInputGlobals.instances[key][method]();
212
- });
213
- };
214
- // this is our plugin class that we will create an instance of
215
- // eslint-disable-next-line no-unused-vars
216
- var Iti = /*#__PURE__*/ function() {
217
- function Iti(input, options) {
218
- var _this = this;
219
- _classCallCheck(this, Iti);
220
- this.id = id++;
221
- this.telInput = input;
222
- this.activeItem = null;
223
- this.highlightedItem = null;
224
- // process specified options / defaults
225
- // alternative to Object.assign, which isn't supported by IE11
226
- var customOptions = options || {};
227
- this.options = {};
228
- forEachProp(defaults, function(key, value) {
229
- _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value;
230
- });
231
- this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
232
- }
233
- _createClass(Iti, [ {
234
- key: "_init",
235
- value: function _init() {
236
- var _this2 = this;
237
- // if showing fullscreen popup, do not fix the width
238
- if (this.options.useFullscreenPopup) {
239
- this.options.fixDropdownWidth = false;
240
- }
241
- // when search enabled, we must fix the width else it would change with different results
242
- if (this.options.countrySearch && !this.options.useFullscreenPopup) {
243
- this.options.fixDropdownWidth = true;
244
- }
245
- // if in nationalMode, do not insert dial codes
246
- if (this.options.nationalMode) {
247
- this.options.autoInsertDialCode = false;
248
- }
249
- // if separateDialCode enabled, do not insert dial codes
250
- if (this.options.separateDialCode) {
251
- this.options.autoInsertDialCode = false;
252
- }
253
- // force showFlags=true if there's a dropdown and we're not displaying the dial code,
254
- // as otherwise you just have a down arrow on it's own which doesn't make sense
255
- var forceShowFlags = this.options.allowDropdown && !this.options.separateDialCode;
256
- if (!this.options.showFlags && forceShowFlags) {
257
- this.options.showFlags = true;
258
- }
259
- // on mobile, we want a full screen dropdown, so we must append it to the body
260
- if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
261
- this.options.dropdownContainer = document.body;
262
- }
263
- // check if input has one parent with RTL
264
- this.isRTL = !!this.telInput.closest("[dir=rtl]");
265
- // these promises get resolved when their individual requests complete
266
- // this way the dev can do something like iti.promise.then(...) to know when all requests are
267
- // complete
268
- if (typeof Promise !== "undefined") {
269
- var autoCountryPromise = new Promise(function(resolve, reject) {
270
- _this2.resolveAutoCountryPromise = resolve;
271
- _this2.rejectAutoCountryPromise = reject;
272
- });
273
- var utilsScriptPromise = new Promise(function(resolve, reject) {
274
- _this2.resolveUtilsScriptPromise = resolve;
275
- _this2.rejectUtilsScriptPromise = reject;
276
- });
277
- this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]);
278
- } else {
279
- // prevent errors when Promise doesn't exist
280
- this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {};
281
- this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {};
282
- }
283
- // in various situations there could be no country selected initially, but we need to be able
284
- // to assume this variable exists
285
- this.selectedCountryData = {};
286
- // process all the data: onlyCountries, excludeCountries, preferredCountries etc
287
- this._processCountryData();
288
- // generate the markup
289
- this._generateMarkup();
290
- // set the initial state of the input value and the selected flag
291
- this._setInitialState();
292
- // start all of the event listeners: autoInsertDialCode, input keydown, selectedFlag click
293
- this._initListeners();
294
- // utils script, and auto country
295
- this._initRequests();
296
- }
297
- }, {
298
- key: "_processCountryData",
299
- value: function _processCountryData() {
300
- // process onlyCountries or excludeCountries array if present
301
- this._processAllCountries();
302
- // process the countryCodes map
303
- this._processCountryCodes();
304
- // process the preferredCountries
305
- this._processPreferredCountries();
306
- // translate countries according to localizedCountries option
307
- if (this.options.localizedCountries) {
308
- this._translateCountriesByLocale();
309
- }
310
- // sort countries by name
311
- if (this.options.onlyCountries.length || this.options.localizedCountries) {
312
- this.countries.sort(this._countryNameSort);
313
- }
314
- }
315
- }, {
316
- key: "_addCountryCode",
317
- value: function _addCountryCode(iso2, countryCode, priority) {
318
- if (countryCode.length > this.countryCodeMaxLen) {
319
- this.countryCodeMaxLen = countryCode.length;
320
- }
321
- if (!this.countryCodes.hasOwnProperty(countryCode)) {
322
- this.countryCodes[countryCode] = [];
323
- }
324
- // bail if we already have this country for this countryCode
325
- for (var i = 0; i < this.countryCodes[countryCode].length; i++) {
326
- if (this.countryCodes[countryCode][i] === iso2) {
327
- return;
328
- }
329
- }
330
- // check for undefined as 0 is falsy
331
- var index = priority !== undefined$1 ? priority : this.countryCodes[countryCode].length;
332
- this.countryCodes[countryCode][index] = iso2;
333
- }
334
- }, {
335
- key: "_processAllCountries",
336
- value: function _processAllCountries() {
337
- if (this.options.onlyCountries.length) {
338
- var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) {
339
- return country.toLowerCase();
340
- });
341
- this.countries = allCountries.filter(function(country) {
342
- return lowerCaseOnlyCountries.indexOf(country.iso2) > -1;
343
- });
344
- } else if (this.options.excludeCountries.length) {
345
- var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) {
346
- return country.toLowerCase();
347
- });
348
- this.countries = allCountries.filter(function(country) {
349
- return lowerCaseExcludeCountries.indexOf(country.iso2) === -1;
350
- });
351
- } else {
352
- this.countries = allCountries;
353
- }
354
- }
355
- }, {
356
- key: "_translateCountriesByLocale",
357
- value: function _translateCountriesByLocale() {
358
- for (var i = 0; i < this.countries.length; i++) {
359
- var iso = this.countries[i].iso2.toLowerCase();
360
- if (this.options.localizedCountries.hasOwnProperty(iso)) {
361
- this.countries[i].name = this.options.localizedCountries[iso];
362
- }
363
- }
364
- }
365
- }, {
366
- key: "_countryNameSort",
367
- value: function _countryNameSort(a, b) {
368
- if (a.name < b.name) {
369
- return -1;
370
- }
371
- if (a.name > b.name) {
372
- return 1;
373
- }
374
- return 0;
375
- }
376
- }, {
377
- key: "_processCountryCodes",
378
- value: function _processCountryCodes() {
379
- this.countryCodeMaxLen = 0;
380
- // here we store just dial codes
381
- this.dialCodes = {};
382
- // here we store "country codes" (both dial codes and their area codes)
383
- this.countryCodes = {};
384
- // first: add dial codes
385
- for (var i = 0; i < this.countries.length; i++) {
386
- var c = this.countries[i];
387
- if (!this.dialCodes[c.dialCode]) {
388
- this.dialCodes[c.dialCode] = true;
389
- }
390
- this._addCountryCode(c.iso2, c.dialCode, c.priority);
391
- }
392
- // next: add area codes
393
- // this is a second loop over countries, to make sure we have all of the "root" countries
394
- // already in the map, so that we can access them, as each time we add an area code substring
395
- // to the map, we also need to include the "root" country's code, as that also matches
396
- for (var _i = 0; _i < this.countries.length; _i++) {
397
- var _c = this.countries[_i];
398
- // area codes
399
- if (_c.areaCodes) {
400
- var rootCountryCode = this.countryCodes[_c.dialCode][0];
401
- // for each area code
402
- for (var j = 0; j < _c.areaCodes.length; j++) {
403
- var areaCode = _c.areaCodes[j];
404
- // for each digit in the area code to add all partial matches as well
405
- for (var k = 1; k < areaCode.length; k++) {
406
- var partialDialCode = _c.dialCode + areaCode.substr(0, k);
407
- // start with the root country, as that also matches this dial code
408
- this._addCountryCode(rootCountryCode, partialDialCode);
409
- this._addCountryCode(_c.iso2, partialDialCode);
410
- }
411
- // add the full area code
412
- this._addCountryCode(_c.iso2, _c.dialCode + areaCode);
413
- }
414
- }
415
- }
416
- }
417
- }, {
418
- key: "_processPreferredCountries",
419
- value: function _processPreferredCountries() {
420
- this.preferredCountries = [];
421
- for (var i = 0; i < this.options.preferredCountries.length; i++) {
422
- var countryCode = this.options.preferredCountries[i].toLowerCase();
423
- var countryData = this._getCountryData(countryCode, false, true);
424
- if (countryData) {
425
- this.preferredCountries.push(countryData);
426
- }
427
- }
428
- }
429
- }, {
430
- key: "_createEl",
431
- value: function _createEl(name, attrs, container) {
432
- var el = document.createElement(name);
433
- if (attrs) {
434
- forEachProp(attrs, function(key, value) {
435
- return el.setAttribute(key, value);
436
- });
437
- }
438
- if (container) {
439
- container.appendChild(el);
440
- }
441
- return el;
442
- }
443
- }, {
444
- key: "_generateMarkup",
445
- value: function _generateMarkup() {
446
- this.telInput.classList.add("iti__tel-input");
447
- // if autocomplete does not exist on the element and its form, then
448
- // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can
449
- // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the
450
- // autocompleted number, which on submit could mean wrong number is saved
451
- if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
452
- this.telInput.setAttribute("autocomplete", "off");
453
- }
454
- var _this$options = this.options, allowDropdown = _this$options.allowDropdown, separateDialCode = _this$options.separateDialCode, showFlags = _this$options.showFlags, customContainer = _this$options.customContainer, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer, fixDropdownWidth = _this$options.fixDropdownWidth, useFullscreenPopup = _this$options.useFullscreenPopup, countrySearch = _this$options.countrySearch;
455
- // containers (mostly for positioning)
456
- var parentClass = "iti";
457
- if (allowDropdown) {
458
- parentClass += " iti--allow-dropdown";
459
- }
460
- if (separateDialCode) {
461
- parentClass += " iti--separate-dial-code";
462
- }
463
- if (showFlags) {
464
- parentClass += " iti--show-flags";
465
- }
466
- if (customContainer) {
467
- parentClass += " ".concat(customContainer);
468
- }
469
- var wrapper = this._createEl("div", {
470
- "class": parentClass
471
- });
472
- this.telInput.parentNode.insertBefore(wrapper, this.telInput);
473
- // only hide the flagsContainer if allowDropdown, showFlags and separateDialCode are all false
474
- var showFlagsContainer = allowDropdown || showFlags || separateDialCode;
475
- if (showFlagsContainer) {
476
- this.flagsContainer = this._createEl("div", {
477
- "class": "iti__flag-container"
478
- }, wrapper);
479
- }
480
- wrapper.appendChild(this.telInput);
481
- // selected flag (displayed to left of input)
482
- // using Aria tags for "Select-Only Combobox Example"
483
- // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
484
- if (showFlagsContainer) {
485
- this.selectedFlag = this._createEl("div", _objectSpread({
486
- "class": "iti__selected-flag"
487
- }, allowDropdown && {
488
- role: "combobox",
489
- "aria-haspopup": "listbox",
490
- "aria-controls": "iti-".concat(this.id, "__country-listbox"),
491
- "aria-expanded": "false",
492
- "aria-label": "Telephone country code"
493
- }), this.flagsContainer);
494
- }
495
- if (showFlags) {
496
- this.selectedFlagInner = this._createEl("div", {
497
- "class": "iti__flag"
498
- }, this.selectedFlag);
499
- }
500
- if (this.selectedFlag && this.telInput.disabled) {
501
- this.selectedFlag.setAttribute("aria-disabled", "true");
502
- }
503
- if (separateDialCode) {
504
- this.selectedDialCode = this._createEl("div", {
505
- "class": "iti__selected-dial-code"
506
- }, this.selectedFlag);
507
- }
508
- if (allowDropdown) {
509
- if (!this.telInput.disabled) {
510
- // make element focusable and tab navigable
511
- this.selectedFlag.setAttribute("tabindex", "0");
512
- }
513
- this.dropdownArrow = this._createEl("div", {
514
- "class": "iti__arrow"
515
- }, this.selectedFlag);
516
- var extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
517
- this.dropdownContent = this._createEl("div", {
518
- "class": "iti__dropdown-content iti__hide ".concat(extraClasses)
519
- });
520
- if (countrySearch) {
521
- this.searchInput = this._createEl("input", {
522
- type: "text",
523
- "class": "iti__search-input",
524
- placeholder: "Search"
525
- }, this.dropdownContent);
526
- }
527
- // country list: preferred countries, then divider, then all countries
528
- this.countryList = this._createEl("ul", {
529
- "class": "iti__country-list",
530
- id: "iti-".concat(this.id, "__country-listbox"),
531
- role: "listbox",
532
- "aria-label": "List of countries"
533
- }, this.dropdownContent);
534
- if (this.preferredCountries.length && !countrySearch) {
535
- this._appendListItems(this.preferredCountries, "iti__preferred", true);
536
- this._createEl("li", {
537
- "class": "iti__divider",
538
- "aria-hidden": "true"
539
- }, this.countryList);
540
- }
541
- this._appendListItems(this.countries, "iti__standard");
542
- // create dropdownContainer markup
543
- if (dropdownContainer) {
544
- var dropdownClasses = "iti iti--container";
545
- if (useFullscreenPopup) {
546
- dropdownClasses += " iti--fullscreen-popup";
547
- }
548
- if (countrySearch) {
549
- dropdownClasses += " iti--country-search";
550
- }
551
- this.dropdown = this._createEl("div", {
552
- "class": dropdownClasses
553
- });
554
- this.dropdown.appendChild(this.dropdownContent);
555
- } else {
556
- this.flagsContainer.appendChild(this.dropdownContent);
557
- }
558
- }
559
- if (hiddenInput) {
560
- var hiddenInputName = hiddenInput;
561
- var name = this.telInput.getAttribute("name");
562
- if (name) {
563
- var i = name.lastIndexOf("[");
564
- // if input name contains square brackets, then give the hidden input the same name,
565
- // replacing the contents of the last set of brackets with the given hiddenInput name
566
- if (i !== -1) {
567
- hiddenInputName = "".concat(name.substr(0, i), "[").concat(hiddenInputName, "]");
568
- }
569
- }
570
- this.hiddenInput = this._createEl("input", {
571
- type: "hidden",
572
- name: hiddenInputName
573
- });
574
- wrapper.appendChild(this.hiddenInput);
575
- }
576
- }
577
- }, {
578
- key: "_appendListItems",
579
- value: function _appendListItems(countries, className, preferred) {
580
- for (var i = 0; i < countries.length; i++) {
581
- var c = countries[i];
582
- var idSuffix = preferred ? "-preferred" : "";
583
- var listItem = this._createEl("li", {
584
- id: "iti-".concat(this.id, "__item-").concat(c.iso2).concat(idSuffix),
585
- "class": "iti__country ".concat(className),
586
- tabindex: "-1",
587
- role: "option",
588
- "data-dial-code": c.dialCode,
589
- "data-country-code": c.iso2,
590
- "aria-selected": "false"
591
- }, this.countryList);
592
- // store this for later use e.g. country search filtering
593
- c.node = listItem;
594
- var content = "";
595
- // add the flag
596
- if (this.options.showFlags) {
597
- content += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(c.iso2, "'></div></div>");
598
- }
599
- // and the country name and dial code
600
- content += "<span class='iti__country-name'>".concat(c.name, "</span>");
601
- content += "<span class='iti__dial-code'>+".concat(c.dialCode, "</span>");
602
- listItem.insertAdjacentHTML("beforeend", content);
603
- }
604
- }
605
- }, {
606
- key: "_setInitialState",
607
- value: function _setInitialState() {
608
- // fix firefox bug: when first load page (with input with value set to number with intl dial
609
- // code) and initialising plugin removes the dial code from the input, then refresh page,
610
- // and we try to init plugin again but this time on number without dial code so get grey flag
611
- var attributeValue = this.telInput.getAttribute("value");
612
- var inputValue = this.telInput.value;
613
- var useAttribute = attributeValue && attributeValue.charAt(0) === "+" && (!inputValue || inputValue.charAt(0) !== "+");
614
- var val = useAttribute ? attributeValue : inputValue;
615
- var dialCode = this._getDialCode(val);
616
- var isRegionlessNanp = this._isRegionlessNanp(val);
617
- var _this$options2 = this.options, initialCountry = _this$options2.initialCountry, autoInsertDialCode = _this$options2.autoInsertDialCode;
618
- // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the
619
- // flag, else fall back to the default country
620
- if (dialCode && !isRegionlessNanp) {
621
- this._updateFlagFromNumber(val);
622
- } else if (initialCountry !== "auto") {
623
- var isValidInitialCountry = initialCountry && this._getCountryData(initialCountry, false, true);
624
- // see if we should select a flag
625
- if (isValidInitialCountry) {
626
- this._setFlag(initialCountry.toLowerCase());
627
- } else {
628
- if (dialCode && isRegionlessNanp) {
629
- // has intl dial code, is regionless nanp, and no initialCountry, so default to US
630
- this._setFlag("us");
631
- } else {
632
- // no dial code and no initialCountry, so default to first in list
633
- this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2;
634
- if (!val) {
635
- this._setFlag(this.defaultCountry);
636
- }
637
- }
638
- }
639
- // if empty and autoInsertDialCode then insert the dial code
640
- if (!val && autoInsertDialCode) {
641
- this.telInput.value = "+".concat(this.selectedCountryData.dialCode);
642
- }
643
- }
644
- // NOTE: if initialCountry is set to auto, that will be handled separately
645
- // format - note this wont be run after _updateDialCode as that's only called if no val
646
- if (val) {
647
- this._updateValFromNumber(val);
648
- }
649
- }
650
- }, {
651
- key: "_initListeners",
652
- value: function _initListeners() {
653
- this._initKeyListeners();
654
- if (this.options.autoInsertDialCode) {
655
- this._initBlurListeners();
656
- }
657
- if (this.options.allowDropdown) {
658
- this._initDropdownListeners();
659
- }
660
- if (this.hiddenInput) {
661
- this._initHiddenInputListener();
662
- }
663
- }
664
- }, {
665
- key: "_initHiddenInputListener",
666
- value: function _initHiddenInputListener() {
667
- var _this3 = this;
668
- this._handleHiddenInputSubmit = function() {
669
- _this3.hiddenInput.value = _this3.getNumber();
670
- };
671
- if (this.telInput.form) {
672
- this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
673
- }
674
- }
675
- }, {
676
- key: "_getClosestLabel",
677
- value: function _getClosestLabel() {
678
- var el = this.telInput;
679
- while (el && el.tagName !== "LABEL") {
680
- el = el.parentNode;
681
- }
682
- return el;
683
- }
684
- }, {
685
- key: "_initDropdownListeners",
686
- value: function _initDropdownListeners() {
687
- var _this4 = this;
688
- // hack for input nested inside label (which is valid markup): clicking the selected-flag to
689
- // open the dropdown would then automatically trigger a 2nd click on the input which would
690
- // close it again
691
- this._handleLabelClick = function(e) {
692
- // if the dropdown is closed, then focus the input, else ignore the click
693
- if (_this4.dropdownContent.classList.contains("iti__hide")) {
694
- _this4.telInput.focus();
695
- } else {
696
- e.preventDefault();
697
- }
698
- };
699
- var label = this._getClosestLabel();
700
- if (label) {
701
- label.addEventListener("click", this._handleLabelClick);
702
- }
703
- // toggle country dropdown on click
704
- this._handleClickSelectedFlag = function() {
705
- // only intercept this event if we're opening the dropdown
706
- // else let it bubble up to the top ("click-off-to-close" listener)
707
- // we cannot just stopPropagation as it may be needed to close another instance
708
- if (_this4.dropdownContent.classList.contains("iti__hide") && !_this4.telInput.disabled && !_this4.telInput.readOnly) {
709
- _this4._showDropdown();
710
- }
711
- };
712
- this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag);
713
- // open dropdown if selected flag is focused and they press up/down/space/enter
714
- this._handleFlagsContainerKeydown = function(e) {
715
- var isDropdownHidden = _this4.dropdownContent.classList.contains("iti__hide");
716
- if (isDropdownHidden && [ "ArrowUp", "ArrowDown", " ", "Enter" ].includes(e.key)) {
717
- // prevent form from being submitted if "ENTER" was pressed
718
- e.preventDefault();
719
- // prevent event from being handled again by document
720
- e.stopPropagation();
721
- _this4._showDropdown();
722
- }
723
- // allow navigation from dropdown to input on TAB
724
- if (e.key === "Tab") {
725
- _this4._closeDropdown();
726
- }
727
- };
728
- this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
729
- }
730
- }, {
731
- key: "_initRequests",
732
- value: function _initRequests() {
733
- var _this5 = this;
734
- // if the user has specified the path to the utils script, fetch it on window.load, else resolve
735
- if (this.options.utilsScript && !window.intlTelInputUtils) {
736
- // if the plugin is being initialised after the window.load event has already been fired
737
- if (window.intlTelInputGlobals.documentReady()) {
738
- window.intlTelInputGlobals.loadUtils(this.options.utilsScript);
739
- } else {
740
- // wait until the load event so we don't block any other requests e.g. the flags image
741
- window.addEventListener("load", function() {
742
- window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript);
743
- });
744
- }
745
- } else {
746
- this.resolveUtilsScriptPromise();
747
- }
748
- if (this.options.initialCountry === "auto") {
749
- this._loadAutoCountry();
750
- } else {
751
- this.resolveAutoCountryPromise();
752
- }
753
- }
754
- }, {
755
- key: "_loadAutoCountry",
756
- value: function _loadAutoCountry() {
757
- // 3 options:
758
- // 1) already loaded (we're done)
759
- // 2) not already started loading (start)
760
- // 3) already started loading (do nothing - just wait for loading callback to fire)
761
- if (window.intlTelInputGlobals.autoCountry) {
762
- this.handleAutoCountry();
763
- } else if (!window.intlTelInputGlobals.startedLoadingAutoCountry) {
764
- // don't do this twice!
765
- window.intlTelInputGlobals.startedLoadingAutoCountry = true;
766
- if (typeof this.options.geoIpLookup === "function") {
767
- this.options.geoIpLookup(function(countryCode) {
768
- window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase();
769
- // tell all instances the auto country is ready
770
- // TODO: this should just be the current instances
771
- // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight
772
- // away (e.g. if they have already done the geo ip lookup somewhere else). Using
773
- // setTimeout means that the current thread of execution will finish before executing
774
- // this, which allows the plugin to finish initialising.
775
- setTimeout(function() {
776
- return forEachInstance("handleAutoCountry");
777
- });
778
- }, function() {
779
- return forEachInstance("rejectAutoCountryPromise");
780
- });
781
- }
782
- }
783
- }
784
- }, {
785
- key: "_initKeyListeners",
786
- value: function _initKeyListeners() {
787
- var _this6 = this;
788
- // update flag on keyup
789
- this._handleKeyupEvent = function() {
790
- if (_this6._updateFlagFromNumber(_this6.telInput.value)) {
791
- _this6._triggerCountryChange();
792
- }
793
- };
794
- this.telInput.addEventListener("keyup", this._handleKeyupEvent);
795
- // update flag on cut/paste events (now supported in all major browsers)
796
- this._handleClipboardEvent = function() {
797
- // hack because "paste" event is fired before input is updated
798
- setTimeout(_this6._handleKeyupEvent);
799
- };
800
- this.telInput.addEventListener("cut", this._handleClipboardEvent);
801
- this.telInput.addEventListener("paste", this._handleClipboardEvent);
802
- }
803
- }, {
804
- key: "_cap",
805
- value: function _cap(number) {
806
- var max = this.telInput.getAttribute("maxlength");
807
- return max && number.length > max ? number.substr(0, max) : number;
808
- }
809
- }, {
810
- key: "_initBlurListeners",
811
- value: function _initBlurListeners() {
812
- var _this7 = this;
813
- // on blur or form submit: if just a dial code then remove it
814
- this._handleSubmitOrBlurEvent = function() {
815
- _this7._removeEmptyDialCode();
816
- };
817
- if (this.telInput.form) {
818
- this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent);
819
- }
820
- this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
821
- }
822
- }, {
823
- key: "_removeEmptyDialCode",
824
- value: function _removeEmptyDialCode() {
825
- if (this.telInput.value.charAt(0) === "+") {
826
- var numeric = this._getNumeric(this.telInput.value);
827
- // if just a plus, or if just a dial code
828
- if (!numeric || this.selectedCountryData.dialCode === numeric) {
829
- this.telInput.value = "";
830
- }
831
- }
832
- }
833
- }, {
834
- key: "_getNumeric",
835
- value: function _getNumeric(s) {
836
- return s.replace(/\D/g, "");
837
- }
838
- }, {
839
- key: "_trigger",
840
- value: function _trigger(name) {
841
- // have to use old school document.createEvent as IE11 doesn't support `new Event()` syntax
842
- var e = document.createEvent("Event");
843
- e.initEvent(name, true, true);
844
- // can bubble, and is cancellable
845
- this.telInput.dispatchEvent(e);
846
- }
847
- }, {
848
- key: "_showDropdown",
849
- value: function _showDropdown() {
850
- if (this.options.fixDropdownWidth) {
851
- this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px");
852
- }
853
- this.dropdownContent.classList.remove("iti__hide");
854
- this.selectedFlag.setAttribute("aria-expanded", "true");
855
- this._setDropdownPosition();
856
- if (this.options.countrySearch) {
857
- // start by highlighting the first item in the list
858
- this._highlightListItem(this.countryList.firstElementChild, false);
859
- this.searchInput.focus();
860
- } else if (this.activeItem) {
861
- // update highlighting and scroll to active list item
862
- this._highlightListItem(this.activeItem, false);
863
- this._scrollTo(this.activeItem, true);
864
- }
865
- // bind all the dropdown-related listeners: mouseover, click, click-off, keydown
866
- this._bindDropdownListeners();
867
- // update the arrow
868
- this.dropdownArrow.classList.add("iti__arrow--up");
869
- this._trigger("open:countrydropdown");
870
- }
871
- }, {
872
- key: "_toggleClass",
873
- value: function _toggleClass(el, className, shouldHaveClass) {
874
- if (shouldHaveClass && !el.classList.contains(className)) {
875
- el.classList.add(className);
876
- } else if (!shouldHaveClass && el.classList.contains(className)) {
877
- el.classList.remove(className);
878
- }
879
- }
880
- }, {
881
- key: "_setDropdownPosition",
882
- value: function _setDropdownPosition() {
883
- var _this8 = this;
884
- if (this.options.dropdownContainer) {
885
- this.options.dropdownContainer.appendChild(this.dropdown);
886
- }
887
- if (!this.options.useFullscreenPopup) {
888
- var pos = this.telInput.getBoundingClientRect();
889
- // windowTop from https://stackoverflow.com/a/14384091/217866
890
- var windowTop = window.pageYOffset || document.documentElement.scrollTop;
891
- var inputTop = pos.top + windowTop;
892
- var dropdownHeight = this.dropdownContent.offsetHeight;
893
- // dropdownFitsBelow = (dropdownBottom < windowBottom)
894
- var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight;
895
- var dropdownFitsAbove = inputTop - dropdownHeight > windowTop;
896
- // dont allow positioning above when country search enabled as the search box jumps around as you filter countries
897
- var positionDropdownAboveInput = !this.options.countrySearch && !dropdownFitsBelow && dropdownFitsAbove;
898
- // by default, the dropdown will be below the input. If we want to position it above the
899
- // input, we add the dropup class.
900
- this._toggleClass(this.dropdownContent, "iti__dropdown-content--dropup", positionDropdownAboveInput);
901
- // if dropdownContainer is enabled, calculate postion
902
- if (this.options.dropdownContainer) {
903
- // by default the dropdown will be directly over the input because it's not in the flow.
904
- // If we want to position it below, we need to add some extra top value.
905
- var extraTop = positionDropdownAboveInput ? 0 : this.telInput.offsetHeight;
906
- // calculate placement
907
- this.dropdown.style.top = "".concat(inputTop + extraTop, "px");
908
- this.dropdown.style.left = "".concat(pos.left + document.body.scrollLeft, "px");
909
- // close menu on window scroll
910
- this._handleWindowScroll = function() {
911
- return _this8._closeDropdown();
912
- };
913
- window.addEventListener("scroll", this._handleWindowScroll);
914
- }
915
- }
916
- }
917
- }, {
918
- key: "_getClosestListItem",
919
- value: function _getClosestListItem(target) {
920
- var el = target;
921
- while (el && el !== this.countryList && !el.classList.contains("iti__country")) {
922
- el = el.parentNode;
923
- }
924
- // if we reached the countryList element, then return null
925
- return el === this.countryList ? null : el;
926
- }
927
- }, {
928
- key: "_bindDropdownListeners",
929
- value: function _bindDropdownListeners() {
930
- var _this9 = this;
931
- // when mouse over a list item, just highlight that one
932
- // we add the class "highlight", so if they hit "enter" we know which one to select
933
- this._handleMouseoverCountryList = function(e) {
934
- // handle event delegation, as we're listening for this event on the countryList
935
- var listItem = _this9._getClosestListItem(e.target);
936
- if (listItem) {
937
- _this9._highlightListItem(listItem, false);
938
- }
939
- };
940
- this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList);
941
- // listen for country selection
942
- this._handleClickCountryList = function(e) {
943
- var listItem = _this9._getClosestListItem(e.target);
944
- if (listItem) {
945
- _this9._selectListItem(listItem);
946
- }
947
- };
948
- this.countryList.addEventListener("click", this._handleClickCountryList);
949
- // click off to close
950
- // (except when this initial opening click is bubbling up)
951
- // we cannot just stopPropagation as it may be needed to close another instance
952
- var isOpening = true;
953
- this._handleClickOffToClose = function() {
954
- if (!isOpening) {
955
- _this9._closeDropdown();
956
- }
957
- isOpening = false;
958
- };
959
- document.documentElement.addEventListener("click", this._handleClickOffToClose);
960
- // listen for up/down scrolling, enter to select, or escape to close
961
- // use keydown as keypress doesn't fire for non-char keys and we want to catch if they
962
- // just hit down and hold it to scroll down (no keyup event).
963
- // listen on the document because that's where key events are triggered if no input has focus
964
- var query = "";
965
- var queryTimer = null;
966
- this._handleKeydownOnDropdown = function(e) {
967
- // prevent down key from scrolling the whole page,
968
- // and enter key from submitting a form etc
969
- if ([ "ArrowUp", "ArrowDown", "Enter", "Escape" ].includes(e.key)) {
970
- e.preventDefault();
971
- e.stopPropagation();
972
- // up and down to navigate
973
- if (e.key === "ArrowUp" || e.key === "ArrowDown") {
974
- _this9._handleUpDownKey(e.key);
975
- } else if (e.key === "Enter") {
976
- _this9._handleEnterKey();
977
- } else if (e.key === "Escape") {
978
- _this9._closeDropdown();
979
- }
980
- }
981
- // alpha chars to perform search
982
- // regex allows one latin alpha char or space, based on https://stackoverflow.com/a/26900132/217866)
983
- if (!_this9.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) {
984
- e.stopPropagation();
985
- // jump to countries that start with the query string
986
- if (queryTimer) {
987
- clearTimeout(queryTimer);
988
- }
989
- query += e.key.toLowerCase();
990
- _this9._searchForCountry(query);
991
- // if the timer hits 1 second, reset the query
992
- queryTimer = setTimeout(function() {
993
- query = "";
994
- }, 1e3);
995
- }
996
- };
997
- document.addEventListener("keydown", this._handleKeydownOnDropdown);
998
- if (this.options.countrySearch) {
999
- var doFilter = function doFilter() {
1000
- var inputQuery = _this9.searchInput.value.trim();
1001
- if (inputQuery) {
1002
- _this9._filterCountries(inputQuery.toLowerCase());
1003
- } else {
1004
- _this9._filterCountries(null, true);
1005
- }
1006
- };
1007
- var keyupTimer = null;
1008
- this._handleSearchChange = function() {
1009
- // filtering country nodes is expensive (lots of DOM manipulation), so rate limit it
1010
- if (keyupTimer) {
1011
- clearTimeout(keyupTimer);
1012
- }
1013
- keyupTimer = setTimeout(function() {
1014
- doFilter();
1015
- keyupTimer = null;
1016
- }, 100);
1017
- };
1018
- this.searchInput.addEventListener("input", this._handleSearchChange);
1019
- // stop propagation on search input click, so doesn't trigger click-off-to-close listener
1020
- this.searchInput.addEventListener("click", function(e) {
1021
- return e.stopPropagation();
1022
- });
1023
- }
1024
- }
1025
- }, {
1026
- key: "_filterCountries",
1027
- value: function _filterCountries(query) {
1028
- var isReset = arguments.length > 1 && arguments[1] !== undefined$1 ? arguments[1] : false;
1029
- var isFirst = true;
1030
- this.countryList.innerHTML = "";
1031
- for (var i = 0; i < this.countries.length; i++) {
1032
- var c = this.countries[i];
1033
- var nameLower = c.name.toLowerCase();
1034
- var fullDialCode = "+".concat(c.dialCode);
1035
- if (isReset || nameLower.includes(query) || fullDialCode.includes(query)) {
1036
- this.countryList.appendChild(c.node);
1037
- // highlight the first item
1038
- if (isFirst) {
1039
- this._highlightListItem(c.node, false);
1040
- isFirst = false;
1041
- }
1042
- }
1043
- }
1044
- }
1045
- }, {
1046
- key: "_handleUpDownKey",
1047
- value: function _handleUpDownKey(key) {
1048
- var next = key === "ArrowUp" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
1049
- if (next) {
1050
- // skip the divider
1051
- if (next.classList.contains("iti__divider")) {
1052
- next = key === "ArrowUp" ? next.previousElementSibling : next.nextElementSibling;
1053
- }
1054
- } else if (this.countryList.childElementCount > 1) {
1055
- // otherwise, we must be at the end, so loop round again
1056
- next = key === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild;
1057
- }
1058
- if (next) {
1059
- // if country search enabled, dont lose focus from the search input on up/down
1060
- var doFocus = !this.options.countrySearch;
1061
- this._highlightListItem(next, doFocus);
1062
- if (this.options.countrySearch) {
1063
- this._scrollTo(next, false);
1064
- }
1065
- }
1066
- }
1067
- }, {
1068
- key: "_handleEnterKey",
1069
- value: function _handleEnterKey() {
1070
- if (this.highlightedItem) {
1071
- this._selectListItem(this.highlightedItem);
1072
- }
1073
- }
1074
- }, {
1075
- key: "_searchForCountry",
1076
- value: function _searchForCountry(query) {
1077
- for (var i = 0; i < this.countries.length; i++) {
1078
- if (this._startsWith(this.countries[i].name, query)) {
1079
- var listItem = this.countries[i].node;
1080
- // update highlighting and scroll
1081
- this._highlightListItem(listItem, false);
1082
- this._scrollTo(listItem, true);
1083
- break;
1084
- }
1085
- }
1086
- }
1087
- }, {
1088
- key: "_startsWith",
1089
- value: function _startsWith(a, b) {
1090
- return a.substr(0, b.length).toLowerCase() === b;
1091
- }
1092
- }, {
1093
- key: "_updateValFromNumber",
1094
- value: function _updateValFromNumber(fullNumber) {
1095
- var number = fullNumber;
1096
- if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {
1097
- var useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.separateDialCode;
1098
- var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL;
1099
- var format = useNational ? NATIONAL : INTERNATIONAL;
1100
- number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format);
1101
- }
1102
- number = this._beforeSetNumber(number);
1103
- this.telInput.value = number;
1104
- }
1105
- }, {
1106
- key: "_updateFlagFromNumber",
1107
- value: function _updateFlagFromNumber(fullNumber) {
1108
- var plusIndex = fullNumber.indexOf("+");
1109
- // if it contains a plus, discard any chars before it e.g. accidental space char.
1110
- // this keeps the selected country auto-updating correctly, which we want as
1111
- // libphonenumber's validation/getNumber methods will ignore these chars anyway
1112
- var number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber;
1113
- // if we already have US/Canada selected, make sure the number starts
1114
- // with a +1 so _getDialCode will be able to extract the area code
1115
- // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag
1116
- // from the number), that means we're initialising the plugin with a number that already has a
1117
- // dial code, so fine to ignore this bit
1118
- var selectedDialCode = this.selectedCountryData.dialCode;
1119
- var isNanp = selectedDialCode === "1";
1120
- if (number && isNanp && number.charAt(0) !== "+") {
1121
- if (number.charAt(0) !== "1") {
1122
- number = "1".concat(number);
1123
- }
1124
- number = "+".concat(number);
1125
- }
1126
- // if separateDialCode enabled, then consider the selected dial code to be part of the number
1127
- if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== "+") {
1128
- number = "+".concat(selectedDialCode).concat(number);
1129
- }
1130
- // try and extract valid dial code from input
1131
- var dialCode = this._getDialCode(number, true);
1132
- var numeric = this._getNumeric(number);
1133
- var countryCode = null;
1134
- if (dialCode) {
1135
- var countryCodes = this.countryCodes[this._getNumeric(dialCode)];
1136
- // check if the right country is already selected. this should be false if the number is
1137
- // longer than the matched dial code because in this case we need to make sure that if
1138
- // there are multiple country matches, that the first one is selected (note: we could
1139
- // just check that here, but it requires the same loop that we already have later)
1140
- var alreadySelected = countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1;
1141
- var isRegionlessNanpNumber = selectedDialCode === "1" && this._isRegionlessNanp(numeric);
1142
- // only update the flag if:
1143
- // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp)
1144
- // AND
1145
- // B) the right country is not already selected
1146
- if (!isRegionlessNanpNumber && !alreadySelected) {
1147
- // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first
1148
- // non-empty index
1149
- for (var j = 0; j < countryCodes.length; j++) {
1150
- if (countryCodes[j]) {
1151
- countryCode = countryCodes[j];
1152
- break;
1153
- }
1154
- }
1155
- }
1156
- } else if (number.charAt(0) === "+" && numeric.length) {
1157
- // invalid dial code, so empty
1158
- // Note: use getNumeric here because the number has not been formatted yet, so could contain
1159
- // bad chars
1160
- countryCode = "";
1161
- } else if (!number || number === "+") {
1162
- // empty, or just a plus, so default
1163
- countryCode = this.defaultCountry;
1164
- }
1165
- if (countryCode !== null) {
1166
- return this._setFlag(countryCode);
1167
- }
1168
- return false;
1169
- }
1170
- }, {
1171
- key: "_isRegionlessNanp",
1172
- value: function _isRegionlessNanp(number) {
1173
- var numeric = this._getNumeric(number);
1174
- if (numeric.charAt(0) === "1") {
1175
- var areaCode = numeric.substr(1, 3);
1176
- return regionlessNanpNumbers.indexOf(areaCode) !== -1;
1177
- }
1178
- return false;
1179
- }
1180
- }, {
1181
- key: "_highlightListItem",
1182
- value: function _highlightListItem(listItem, shouldFocus) {
1183
- var prevItem = this.highlightedItem;
1184
- if (prevItem) {
1185
- prevItem.classList.remove("iti__highlight");
1186
- }
1187
- this.highlightedItem = listItem;
1188
- this.highlightedItem.classList.add("iti__highlight");
1189
- this.selectedFlag.setAttribute("aria-activedescendant", listItem.getAttribute("id"));
1190
- if (shouldFocus) {
1191
- this.highlightedItem.focus();
1192
- }
1193
- }
1194
- }, {
1195
- key: "_getCountryData",
1196
- value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) {
1197
- var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;
1198
- for (var i = 0; i < countryList.length; i++) {
1199
- if (countryList[i].iso2 === countryCode) {
1200
- return countryList[i];
1201
- }
1202
- }
1203
- if (allowFail) {
1204
- return null;
1205
- }
1206
- throw new Error("No country data for '".concat(countryCode, "'"));
1207
- }
1208
- }, {
1209
- key: "_setFlag",
1210
- value: function _setFlag(countryCode) {
1211
- var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, separateDialCode = _this$options3.separateDialCode, showFlags = _this$options3.showFlags;
1212
- var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
1213
- // do this first as it will throw an error and stop if countryCode is invalid
1214
- this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};
1215
- // update the defaultCountry - we only need the iso2 from now on, so just store that
1216
- if (this.selectedCountryData.iso2) {
1217
- this.defaultCountry = this.selectedCountryData.iso2;
1218
- }
1219
- if (showFlags) {
1220
- this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode));
1221
- }
1222
- this._setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode);
1223
- if (separateDialCode) {
1224
- var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
1225
- this.selectedDialCode.innerHTML = dialCode;
1226
- // offsetWidth is zero if input is in a hidden container during initialisation
1227
- var selectedFlagWidth = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
1228
- // add 6px of padding after the grey selected-dial-code box, as this is what we use in the css
1229
- if (this.isRTL) {
1230
- this.telInput.style.paddingRight = "".concat(selectedFlagWidth + 6, "px");
1231
- } else {
1232
- this.telInput.style.paddingLeft = "".concat(selectedFlagWidth + 6, "px");
1233
- }
1234
- }
1235
- // and the input's placeholder
1236
- this._updatePlaceholder();
1237
- // update the active list item
1238
- if (allowDropdown) {
1239
- var prevItem = this.activeItem;
1240
- if (prevItem) {
1241
- prevItem.classList.remove("iti__active");
1242
- prevItem.setAttribute("aria-selected", "false");
1243
- }
1244
- if (countryCode) {
1245
- // check if there is a preferred item first, else fall back to standard
1246
- var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode));
1247
- nextItem.setAttribute("aria-selected", "true");
1248
- nextItem.classList.add("iti__active");
1249
- this.activeItem = nextItem;
1250
- }
1251
- }
1252
- // return if the flag has changed or not
1253
- return prevCountry.iso2 !== countryCode;
1254
- }
1255
- }, {
1256
- key: "_setSelectedCountryFlagTitleAttribute",
1257
- value: function _setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode) {
1258
- if (!this.selectedFlag) {
1259
- return;
1260
- }
1261
- var title;
1262
- if (countryCode && !separateDialCode) {
1263
- title = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode);
1264
- } else if (countryCode) {
1265
- // For screen reader output, we don't want to include the dial code in the reader output twice
1266
- // so just use the selected country name here:
1267
- title = this.selectedCountryData.name;
1268
- } else {
1269
- title = "Unknown";
1270
- }
1271
- this.selectedFlag.setAttribute("title", title);
1272
- }
1273
- }, {
1274
- key: "_getHiddenSelectedFlagWidth",
1275
- value: function _getHiddenSelectedFlagWidth() {
1276
- // to get the right styling to apply, all we need is a shallow clone of the container,
1277
- // and then to inject a deep clone of the selectedFlag element
1278
- var containerClone = this.telInput.parentNode.cloneNode();
1279
- containerClone.style.visibility = "hidden";
1280
- document.body.appendChild(containerClone);
1281
- var flagsContainerClone = this.flagsContainer.cloneNode();
1282
- containerClone.appendChild(flagsContainerClone);
1283
- var selectedFlagClone = this.selectedFlag.cloneNode(true);
1284
- flagsContainerClone.appendChild(selectedFlagClone);
1285
- var width = selectedFlagClone.offsetWidth;
1286
- containerClone.parentNode.removeChild(containerClone);
1287
- return width;
1288
- }
1289
- }, {
1290
- key: "_updatePlaceholder",
1291
- value: function _updatePlaceholder() {
1292
- var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite";
1293
- if (window.intlTelInputUtils && shouldSetPlaceholder) {
1294
- var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType];
1295
- var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : "";
1296
- placeholder = this._beforeSetNumber(placeholder);
1297
- if (typeof this.options.customPlaceholder === "function") {
1298
- placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData);
1299
- }
1300
- this.telInput.setAttribute("placeholder", placeholder);
1301
- }
1302
- }
1303
- }, {
1304
- key: "_selectListItem",
1305
- value: function _selectListItem(listItem) {
1306
- // update selected flag and active list item
1307
- var flagChanged = this._setFlag(listItem.getAttribute("data-country-code"));
1308
- this._closeDropdown();
1309
- this._updateDialCode(listItem.getAttribute("data-dial-code"));
1310
- // focus the input
1311
- this.telInput.focus();
1312
- // put cursor at end - this fix is required for FF and IE11 (with auto inserting dial code),
1313
- // who try to put the cursor at the beginning the first time
1314
- var len = this.telInput.value.length;
1315
- this.telInput.setSelectionRange(len, len);
1316
- if (flagChanged) {
1317
- this._triggerCountryChange();
1318
- }
1319
- }
1320
- }, {
1321
- key: "_closeDropdown",
1322
- value: function _closeDropdown() {
1323
- this.dropdownContent.classList.add("iti__hide");
1324
- this.selectedFlag.setAttribute("aria-expanded", "false");
1325
- this.selectedFlag.removeAttribute("aria-activedescendant");
1326
- // update the arrow
1327
- this.dropdownArrow.classList.remove("iti__arrow--up");
1328
- // unbind key events
1329
- document.removeEventListener("keydown", this._handleKeydownOnDropdown);
1330
- if (this.options.countrySearch) {
1331
- this.searchInput.removeEventListener("input", this._handleSearchChange);
1332
- }
1333
- document.documentElement.removeEventListener("click", this._handleClickOffToClose);
1334
- this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList);
1335
- this.countryList.removeEventListener("click", this._handleClickCountryList);
1336
- // remove menu from container
1337
- if (this.options.dropdownContainer) {
1338
- if (!this.options.useFullscreenPopup) {
1339
- window.removeEventListener("scroll", this._handleWindowScroll);
1340
- }
1341
- if (this.dropdown.parentNode) {
1342
- this.dropdown.parentNode.removeChild(this.dropdown);
1343
- }
1344
- }
1345
- this._trigger("close:countrydropdown");
1346
- }
1347
- }, {
1348
- key: "_scrollTo",
1349
- value: function _scrollTo(element, middle) {
1350
- var container = this.dropdownContent;
1351
- // windowTop from https://stackoverflow.com/a/14384091/217866
1352
- var windowTop = window.pageYOffset || document.documentElement.scrollTop;
1353
- var containerHeight = container.offsetHeight;
1354
- var containerTop = container.getBoundingClientRect().top + windowTop;
1355
- var containerBottom = containerTop + containerHeight;
1356
- var elementHeight = element.offsetHeight;
1357
- var elementTop = element.getBoundingClientRect().top + windowTop;
1358
- var elementBottom = elementTop + elementHeight;
1359
- var newScrollTop = elementTop - containerTop + container.scrollTop;
1360
- var middleOffset = containerHeight / 2 - elementHeight / 2;
1361
- if (elementTop < containerTop) {
1362
- // scroll up
1363
- if (middle) {
1364
- newScrollTop -= middleOffset;
1365
- }
1366
- container.scrollTop = newScrollTop;
1367
- } else if (elementBottom > containerBottom) {
1368
- // scroll down
1369
- if (middle) {
1370
- newScrollTop += middleOffset;
1371
- }
1372
- var heightDifference = containerHeight - elementHeight;
1373
- container.scrollTop = newScrollTop - heightDifference;
1374
- }
1375
- }
1376
- }, {
1377
- key: "_updateDialCode",
1378
- value: function _updateDialCode(newDialCodeBare) {
1379
- var inputVal = this.telInput.value;
1380
- // save having to pass this every time
1381
- var newDialCode = "+".concat(newDialCodeBare);
1382
- var newNumber;
1383
- if (inputVal.charAt(0) === "+") {
1384
- // there's a plus so we're dealing with a replacement
1385
- var prevDialCode = this._getDialCode(inputVal);
1386
- if (prevDialCode) {
1387
- // current number contains a valid dial code, so replace it
1388
- newNumber = inputVal.replace(prevDialCode, newDialCode);
1389
- } else {
1390
- // current number contains an invalid dial code, so ditch it
1391
- // (no way to determine where the invalid dial code ends and the rest of the number begins)
1392
- newNumber = newDialCode;
1393
- }
1394
- this.telInput.value = newNumber;
1395
- } else if (this.options.autoInsertDialCode) {
1396
- if (inputVal) {
1397
- // there is an existing value with no dial code: prefix the new dial code
1398
- newNumber = newDialCode + inputVal;
1399
- } else {
1400
- newNumber = newDialCode;
1401
- }
1402
- this.telInput.value = newNumber;
1403
- }
1404
- }
1405
- }, {
1406
- key: "_getDialCode",
1407
- value: function _getDialCode(number, includeAreaCode) {
1408
- var dialCode = "";
1409
- // only interested in international numbers (starting with a plus)
1410
- if (number.charAt(0) === "+") {
1411
- var numericChars = "";
1412
- // iterate over chars
1413
- for (var i = 0; i < number.length; i++) {
1414
- var c = number.charAt(i);
1415
- // if char is number (https://stackoverflow.com/a/8935649/217866)
1416
- if (!isNaN(parseInt(c, 10))) {
1417
- numericChars += c;
1418
- // if current numericChars make a valid dial code
1419
- if (includeAreaCode) {
1420
- if (this.countryCodes[numericChars]) {
1421
- // store the actual raw string (useful for matching later)
1422
- dialCode = number.substr(0, i + 1);
1423
- }
1424
- } else {
1425
- if (this.dialCodes[numericChars]) {
1426
- dialCode = number.substr(0, i + 1);
1427
- // if we're just looking for a dial code, we can break as soon as we find one
1428
- break;
1429
- }
1430
- }
1431
- // stop searching as soon as we can - in this case when we hit max len
1432
- if (numericChars.length === this.countryCodeMaxLen) {
1433
- break;
1434
- }
1435
- }
1436
- }
1437
- }
1438
- return dialCode;
1439
- }
1440
- }, {
1441
- key: "_getFullNumber",
1442
- value: function _getFullNumber() {
1443
- var val = this.telInput.value.trim();
1444
- var dialCode = this.selectedCountryData.dialCode;
1445
- var prefix;
1446
- var numericVal = this._getNumeric(val);
1447
- if (this.options.separateDialCode && val.charAt(0) !== "+" && dialCode && numericVal) {
1448
- // when using separateDialCode, it is visible so is effectively part of the typed number
1449
- prefix = "+".concat(dialCode);
1450
- } else {
1451
- prefix = "";
1452
- }
1453
- return prefix + val;
1454
- }
1455
- }, {
1456
- key: "_beforeSetNumber",
1457
- value: function _beforeSetNumber(fullNumber) {
1458
- var number = fullNumber;
1459
- if (this.options.separateDialCode) {
1460
- var dialCode = this._getDialCode(number);
1461
- // if there is a valid dial code
1462
- if (dialCode) {
1463
- // in case _getDialCode returned an area code as well
1464
- dialCode = "+".concat(this.selectedCountryData.dialCode);
1465
- // a lot of numbers will have a space separating the dial code and the main number, and
1466
- // some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get
1467
- // rid of it
1468
- // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc
1469
- var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
1470
- number = number.substr(start);
1471
- }
1472
- }
1473
- return this._cap(number);
1474
- }
1475
- }, {
1476
- key: "_triggerCountryChange",
1477
- value: function _triggerCountryChange() {
1478
- this._trigger("countrychange");
1479
- }
1480
- }, {
1481
- key: "handleAutoCountry",
1482
- value: function handleAutoCountry() {
1483
- if (this.options.initialCountry === "auto") {
1484
- // we must set this even if there is an initial val in the input: in case the initial val is
1485
- // invalid and they delete it - they should see their auto country
1486
- this.defaultCountry = window.intlTelInputGlobals.autoCountry;
1487
- // if there's no initial value in the input, then update the flag
1488
- if (!this.telInput.value) {
1489
- this.setCountry(this.defaultCountry);
1490
- }
1491
- this.resolveAutoCountryPromise();
1492
- }
1493
- }
1494
- }, {
1495
- key: "handleUtils",
1496
- value: function handleUtils() {
1497
- // if the request was successful
1498
- if (window.intlTelInputUtils) {
1499
- // if there's an initial value in the input, then format it
1500
- if (this.telInput.value) {
1501
- this._updateValFromNumber(this.telInput.value);
1502
- }
1503
- this._updatePlaceholder();
1504
- }
1505
- this.resolveUtilsScriptPromise();
1506
- }
1507
- }, {
1508
- key: "destroy",
1509
- value: function destroy() {
1510
- var form = this.telInput.form;
1511
- if (this.options.allowDropdown) {
1512
- // make sure the dropdown is closed (and unbind listeners)
1513
- this._closeDropdown();
1514
- this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag);
1515
- this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
1516
- // label click hack
1517
- var label = this._getClosestLabel();
1518
- if (label) {
1519
- label.removeEventListener("click", this._handleLabelClick);
1520
- }
1521
- }
1522
- // unbind hiddenInput listeners
1523
- if (this.hiddenInput && form) {
1524
- form.removeEventListener("submit", this._handleHiddenInputSubmit);
1525
- }
1526
- // unbind autoInsertDialCode listeners
1527
- if (this.options.autoInsertDialCode) {
1528
- if (form) {
1529
- form.removeEventListener("submit", this._handleSubmitOrBlurEvent);
1530
- }
1531
- this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent);
1532
- }
1533
- // unbind key events, and cut/paste events
1534
- this.telInput.removeEventListener("keyup", this._handleKeyupEvent);
1535
- this.telInput.removeEventListener("cut", this._handleClipboardEvent);
1536
- this.telInput.removeEventListener("paste", this._handleClipboardEvent);
1537
- // remove attribute of id instance: data-intl-tel-input-id
1538
- this.telInput.removeAttribute("data-intl-tel-input-id");
1539
- // remove markup (but leave the original input)
1540
- var wrapper = this.telInput.parentNode;
1541
- wrapper.parentNode.insertBefore(this.telInput, wrapper);
1542
- wrapper.parentNode.removeChild(wrapper);
1543
- delete window.intlTelInputGlobals.instances[this.id];
1544
- }
1545
- }, {
1546
- key: "getExtension",
1547
- value: function getExtension() {
1548
- if (window.intlTelInputUtils) {
1549
- return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
1550
- }
1551
- return "";
1552
- }
1553
- }, {
1554
- key: "getNumber",
1555
- value: function getNumber(format) {
1556
- if (window.intlTelInputUtils) {
1557
- var iso2 = this.selectedCountryData.iso2;
1558
- return intlTelInputUtils.formatNumber(this._getFullNumber(), iso2, format);
1559
- }
1560
- return "";
1561
- }
1562
- }, {
1563
- key: "getNumberType",
1564
- value: function getNumberType() {
1565
- if (window.intlTelInputUtils) {
1566
- return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
1567
- }
1568
- return -99;
1569
- }
1570
- }, {
1571
- key: "getSelectedCountryData",
1572
- value: function getSelectedCountryData() {
1573
- return this.selectedCountryData;
1574
- }
1575
- }, {
1576
- key: "getValidationError",
1577
- value: function getValidationError() {
1578
- if (window.intlTelInputUtils) {
1579
- var iso2 = this.selectedCountryData.iso2;
1580
- return intlTelInputUtils.getValidationError(this._getFullNumber(), iso2);
1581
- }
1582
- return -99;
1583
- }
1584
- }, {
1585
- key: "isValidNumber",
1586
- value: function isValidNumber() {
1587
- var val = this._getFullNumber().trim();
1588
- return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null;
1589
- }
1590
- }, {
1591
- key: "isPossibleNumber",
1592
- value: function isPossibleNumber() {
1593
- var val = this._getFullNumber().trim();
1594
- return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2) : null;
1595
- }
1596
- }, {
1597
- key: "setCountry",
1598
- value: function setCountry(originalCountryCode) {
1599
- var countryCode = originalCountryCode.toLowerCase();
1600
- // check if already selected
1601
- if (this.selectedCountryData.iso2 !== countryCode) {
1602
- this._setFlag(countryCode);
1603
- this._updateDialCode(this.selectedCountryData.dialCode);
1604
- this._triggerCountryChange();
1605
- }
1606
- }
1607
- }, {
1608
- key: "setNumber",
1609
- value: function setNumber(number) {
1610
- // we must update the flag first, which updates this.selectedCountryData, which is used for
1611
- // formatting the number before displaying it
1612
- var flagChanged = this._updateFlagFromNumber(number);
1613
- this._updateValFromNumber(number);
1614
- if (flagChanged) {
1615
- this._triggerCountryChange();
1616
- }
1617
- }
1618
- }, {
1619
- key: "setPlaceholderNumberType",
1620
- value: function setPlaceholderNumberType(type) {
1621
- this.options.placeholderNumberType = type;
1622
- this._updatePlaceholder();
1623
- }
1624
- } ]);
1625
- return Iti;
1626
- }();
1627
- /********************
1628
- * STATIC METHODS
1629
- ********************/
1630
- // get the country data object
1631
- intlTelInputGlobals.getCountryData = function() {
1632
- return allCountries;
1633
- };
1634
- // inject a <script> element to load utils.js
1635
- var injectScript = function injectScript(path, handleSuccess, handleFailure) {
1636
- // inject a new script element into the page
1637
- var script = document.createElement("script");
1638
- script.onload = function() {
1639
- forEachInstance("handleUtils");
1640
- if (handleSuccess) {
1641
- handleSuccess();
1642
- }
1643
- };
1644
- script.onerror = function() {
1645
- forEachInstance("rejectUtilsScriptPromise");
1646
- if (handleFailure) {
1647
- handleFailure();
1648
- }
1649
- };
1650
- script.className = "iti-load-utils";
1651
- script.async = true;
1652
- script.src = path;
1653
- document.body.appendChild(script);
1654
- };
1655
- // load the utils script
1656
- intlTelInputGlobals.loadUtils = function(path) {
1657
- // 2 options:
1658
- // 1) not already started loading (start)
1659
- // 2) already started loading (do nothing - just wait for the onload callback to fire, which will
1660
- // trigger handleUtils on all instances, invoking their resolveUtilsScriptPromise functions)
1661
- if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
1662
- // only do this once
1663
- window.intlTelInputGlobals.startedLoadingUtilsScript = true;
1664
- // if we have promises, then return a promise
1665
- if (typeof Promise !== "undefined") {
1666
- return new Promise(function(resolve, reject) {
1667
- return injectScript(path, resolve, reject);
1668
- });
1669
- }
1670
- injectScript(path);
1671
- }
1672
- return null;
1673
- };
1674
- // default options
1675
- intlTelInputGlobals.defaults = defaults;
1676
- // version
1677
- intlTelInputGlobals.version = "18.5.3";
1678
- // convenience wrapper
1679
- return function(input, options) {
1680
- var iti = new Iti(input, options);
1681
- iti._init();
1682
- input.setAttribute("data-intl-tel-input-id", iti.id);
1683
- window.intlTelInputGlobals.instances[iti.id] = iti;
1684
- return iti;
1685
- };
1686
- }();
1687
- });
1688
- } (intlTelInput$1));
1689
- return intlTelInput$1.exports;
1690
- }
1691
-
1692
- /**
1693
- * Exposing intl-tel-input as a component
1694
- */
1695
-
1696
- var intlTelInput;
1697
- var hasRequiredIntlTelInput;
1698
-
1699
- function requireIntlTelInput () {
1700
- if (hasRequiredIntlTelInput) return intlTelInput;
1701
- hasRequiredIntlTelInput = 1;
1702
- intlTelInput = requireIntlTelInput$1();
1703
- return intlTelInput;
1704
- }
1705
-
1706
- var intlTelInputExports = requireIntlTelInput();
1707
- var index = /*@__PURE__*/index$2.getDefaultExportFromCjs(intlTelInputExports);
1708
-
1709
- var index$1 = /*#__PURE__*/_mergeNamespaces({
1710
- __proto__: null,
1711
- default: index
1712
- }, [intlTelInputExports]);
1713
-
1714
- exports.index = index$1;