intl-tel-input 26.0.0-beta.1 → 26.0.2

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 (160) hide show
  1. package/README.md +29 -26
  2. package/angular/README.md +1 -1
  3. package/angular/build/IntlTelInput.js +16 -6
  4. package/angular/build/IntlTelInputWithUtils.js +140 -191
  5. package/angular/build/types/intl-tel-input/i18n/index.d.ts +1 -0
  6. package/angular/build/types/intl-tel-input/i18n/zh-hk/index.d.ts +3 -0
  7. package/build/js/data.js +1 -1
  8. package/build/js/data.min.js +1 -1
  9. package/build/js/i18n/ar/countries.js +245 -0
  10. package/build/js/i18n/ar/index.js +1 -0
  11. package/build/js/i18n/ar/interface.js +23 -0
  12. package/build/js/i18n/bg/countries.js +245 -0
  13. package/build/js/i18n/bg/index.js +1 -0
  14. package/build/js/i18n/bg/interface.js +13 -0
  15. package/build/js/i18n/bn/countries.js +245 -0
  16. package/build/js/i18n/bn/index.js +1 -0
  17. package/build/js/i18n/bn/interface.js +13 -0
  18. package/build/js/i18n/bs/countries.js +245 -0
  19. package/build/js/i18n/bs/index.js +1 -0
  20. package/build/js/i18n/bs/interface.js +20 -0
  21. package/build/js/i18n/ca/countries.js +245 -0
  22. package/build/js/i18n/ca/index.js +1 -0
  23. package/build/js/i18n/ca/interface.js +13 -0
  24. package/build/js/i18n/cs/countries.js +245 -0
  25. package/build/js/i18n/cs/index.js +1 -0
  26. package/build/js/i18n/cs/interface.js +20 -0
  27. package/build/js/i18n/da/countries.js +245 -0
  28. package/build/js/i18n/da/index.js +1 -0
  29. package/build/js/i18n/da/interface.js +13 -0
  30. package/build/js/i18n/de/countries.js +245 -0
  31. package/build/js/i18n/de/index.js +1 -0
  32. package/build/js/i18n/de/interface.js +13 -0
  33. package/build/js/i18n/ee/countries.js +245 -0
  34. package/build/js/i18n/ee/index.js +1 -0
  35. package/build/js/i18n/ee/interface.js +13 -0
  36. package/build/js/i18n/el/countries.js +245 -0
  37. package/build/js/i18n/el/index.js +1 -0
  38. package/build/js/i18n/el/interface.js +13 -0
  39. package/build/js/i18n/en/countries.js +245 -0
  40. package/build/js/i18n/en/interface.js +14 -0
  41. package/build/js/i18n/es/countries.js +245 -0
  42. package/build/js/i18n/es/index.js +1 -0
  43. package/build/js/i18n/es/interface.js +13 -0
  44. package/build/js/i18n/fa/countries.js +245 -0
  45. package/build/js/i18n/fa/index.js +1 -0
  46. package/build/js/i18n/fa/interface.js +13 -0
  47. package/build/js/i18n/fi/countries.js +245 -0
  48. package/build/js/i18n/fi/index.js +1 -0
  49. package/build/js/i18n/fi/interface.js +13 -0
  50. package/build/js/i18n/fr/countries.js +245 -0
  51. package/build/js/i18n/fr/index.js +1 -0
  52. package/build/js/i18n/fr/interface.js +13 -0
  53. package/build/js/i18n/hi/countries.js +245 -0
  54. package/build/js/i18n/hi/index.js +1 -0
  55. package/build/js/i18n/hi/interface.js +13 -0
  56. package/build/js/i18n/hr/countries.js +245 -0
  57. package/build/js/i18n/hr/index.js +1 -0
  58. package/build/js/i18n/hr/interface.js +20 -0
  59. package/build/js/i18n/hu/countries.js +245 -0
  60. package/build/js/i18n/hu/index.js +1 -0
  61. package/build/js/i18n/hu/interface.js +13 -0
  62. package/build/js/i18n/id/countries.js +245 -0
  63. package/build/js/i18n/id/index.js +1 -0
  64. package/build/js/i18n/id/interface.js +13 -0
  65. package/build/js/i18n/index.js +1 -0
  66. package/build/js/i18n/it/countries.js +245 -0
  67. package/build/js/i18n/it/index.js +1 -0
  68. package/build/js/i18n/it/interface.js +13 -0
  69. package/build/js/i18n/ja/countries.js +245 -0
  70. package/build/js/i18n/ja/index.js +1 -0
  71. package/build/js/i18n/ja/interface.js +13 -0
  72. package/build/js/i18n/ko/countries.js +245 -0
  73. package/build/js/i18n/ko/index.js +1 -0
  74. package/build/js/i18n/ko/interface.js +13 -0
  75. package/build/js/i18n/lt/countries.js +245 -0
  76. package/build/js/i18n/lt/interface.js +26 -0
  77. package/build/js/i18n/mr/countries.js +245 -0
  78. package/build/js/i18n/mr/index.js +1 -0
  79. package/build/js/i18n/mr/interface.js +13 -0
  80. package/build/js/i18n/nl/countries.js +245 -0
  81. package/build/js/i18n/nl/index.js +1 -0
  82. package/build/js/i18n/nl/interface.js +13 -0
  83. package/build/js/i18n/no/countries.js +245 -0
  84. package/build/js/i18n/no/index.js +1 -0
  85. package/build/js/i18n/no/interface.js +13 -0
  86. package/build/js/i18n/pl/countries.js +245 -0
  87. package/build/js/i18n/pl/index.js +1 -0
  88. package/build/js/i18n/pl/interface.js +19 -0
  89. package/build/js/i18n/pt/countries.js +245 -0
  90. package/build/js/i18n/pt/index.js +1 -0
  91. package/build/js/i18n/pt/interface.js +13 -0
  92. package/build/js/i18n/ro/countries.js +245 -0
  93. package/build/js/i18n/ro/index.js +1 -0
  94. package/build/js/i18n/ro/interface.js +18 -0
  95. package/build/js/i18n/ru/countries.js +245 -0
  96. package/build/js/i18n/ru/index.js +1 -0
  97. package/build/js/i18n/ru/interface.js +20 -0
  98. package/build/js/i18n/sk/countries.js +245 -0
  99. package/build/js/i18n/sk/index.js +1 -0
  100. package/build/js/i18n/sk/interface.js +20 -0
  101. package/build/js/i18n/sl/countries.js +245 -0
  102. package/build/js/i18n/sl/interface.js +25 -0
  103. package/build/js/i18n/sq/countries.js +245 -0
  104. package/build/js/i18n/sq/interface.js +14 -0
  105. package/build/js/i18n/sr/countries.js +245 -0
  106. package/build/js/i18n/sr/interface.js +21 -0
  107. package/build/js/i18n/sv/countries.js +245 -0
  108. package/build/js/i18n/sv/index.js +1 -0
  109. package/build/js/i18n/sv/interface.js +13 -0
  110. package/build/js/i18n/te/countries.js +245 -0
  111. package/build/js/i18n/te/index.js +1 -0
  112. package/build/js/i18n/te/interface.js +13 -0
  113. package/build/js/i18n/th/countries.js +245 -0
  114. package/build/js/i18n/th/index.js +1 -0
  115. package/build/js/i18n/th/interface.js +13 -0
  116. package/build/js/i18n/tr/countries.js +245 -0
  117. package/build/js/i18n/tr/index.js +1 -0
  118. package/build/js/i18n/tr/interface.js +13 -0
  119. package/build/js/i18n/uk/countries.js +245 -0
  120. package/build/js/i18n/uk/index.js +1 -0
  121. package/build/js/i18n/uk/interface.js +20 -0
  122. package/build/js/i18n/ur/countries.js +245 -0
  123. package/build/js/i18n/ur/index.js +1 -0
  124. package/build/js/i18n/ur/interface.js +13 -0
  125. package/build/js/i18n/uz/countries.js +245 -0
  126. package/build/js/i18n/uz/index.js +1 -0
  127. package/build/js/i18n/uz/interface.js +13 -0
  128. package/build/js/i18n/vi/countries.js +245 -0
  129. package/build/js/i18n/vi/index.js +1 -0
  130. package/build/js/i18n/vi/interface.js +13 -0
  131. package/build/js/i18n/zh/countries.js +245 -0
  132. package/build/js/i18n/zh/index.js +1 -0
  133. package/build/js/i18n/zh/interface.js +13 -0
  134. package/build/js/i18n/zh-hk/countries.js +245 -0
  135. package/build/js/i18n/zh-hk/index.js +18 -0
  136. package/build/js/i18n/zh-hk/interface.js +14 -0
  137. package/build/js/intlTelInput.d.ts +6 -0
  138. package/build/js/intlTelInput.js +17 -7
  139. package/build/js/intlTelInput.min.js +3 -3
  140. package/build/js/intlTelInputWithUtils.js +141 -192
  141. package/build/js/intlTelInputWithUtils.min.js +3 -3
  142. package/build/js/utils.js +53 -54
  143. package/package.json +2 -2
  144. package/react/README.md +4 -2
  145. package/react/build/IntlTelInput.cjs +16 -6
  146. package/react/build/IntlTelInput.d.ts +6 -0
  147. package/react/build/IntlTelInput.js +16 -6
  148. package/react/build/IntlTelInputWithUtils.cjs +140 -191
  149. package/react/build/IntlTelInputWithUtils.js +140 -191
  150. package/svelte/README.md +7 -9
  151. package/svelte/build/IntlTelInput.mjs +1446 -1440
  152. package/svelte/build/IntlTelInputWithUtils.mjs +1795 -1850
  153. package/vue/README.md +12 -10
  154. package/vue/build/IntlTelInput.vue.d.ts +2 -0
  155. package/vue/build/IntlTelInputWithUtils.vue.d.ts +2 -0
  156. package/vue/build/exports/IntlTelInput.mjs +17 -16
  157. package/vue/build/exports/IntlTelInputWithUtils.mjs +176 -236
  158. package/vue/build/intl-tel-input/i18n/index.d.ts +1 -0
  159. package/vue/build/intl-tel-input/i18n/zh-hk/index.d.ts +3 -0
  160. package/vue/build/{intl-tel-input-f0-6rrpA.mjs → intl-tel-input-DYFK-Vt4.mjs} +12 -6
package/vue/README.md CHANGED
@@ -10,7 +10,9 @@ A Vue component wrapper for the [intl-tel-input](https://github.com/jackocnr/int
10
10
  - [Accessing Static Methods](#accessing-static-methods)
11
11
 
12
12
  ## Demo
13
- Try it for yourself by downloading the project and running `npm install` and then `npm run vue:demo` and then copy the given URL into your browser.
13
+ There is a demo of the Vue component on the [demo site](https://intl-tel-input.com/examples/vue-component.html) with example code.
14
+
15
+ Alternatively, download and build the project yourself in 3 simple steps. You just need to initialise the submodules with `git submodule update --init --recursive`, then run `npm install`, and then `npm run build`. You can then run `npm run vue:demo` and copy the given URL into your browser. By default, this is setup to show the validation demo - you can change this by locating the `"vue:demo"` task in the scripts section of package.json, and updating the demo path accordingly. View a list of available demos [here](https://github.com/jackocnr/intl-tel-input/tree/master/vue/demo).
14
16
 
15
17
  ## Getting Started
16
18
  ```vue
@@ -28,13 +30,9 @@ Try it for yourself by downloading the project and running `npm install` and the
28
30
  </template>
29
31
  ```
30
32
 
31
- See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/vue/demo/validation/App.vue) for a more fleshed-out example of how to handle validation. Make sure to change the path in the `package.json` script to the correct demo if you're running it locally e.g.:
32
-
33
- ```
34
- "vue:demo": "vite --config vue/demo/[demo variant]/vite.config.js"
35
- ```
33
+ See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/vue/demo/validation/App.vue) for a more fleshed-out example of how to handle validation. See the instructions above for how to run this demo (and others) yourself.
36
34
 
37
- A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/vueWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/vue"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.15.0/build/js/utils.js"`.
35
+ A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize), then you can just import IntlTelInput from `"intl-tel-input/vueWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/vue"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN-hosted version, e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.2/build/js/utils.js"`.
38
36
 
39
37
  ## Props
40
38
  Here's a list of all of the current props you can pass to the IntlTelInput Vue component.
@@ -45,12 +43,16 @@ Sets the disabled attribute of both the telephone input and selected country but
45
43
 
46
44
  **inputProps**
47
45
  Type: `Object`
48
- The props to pass to the input element e.g. `id`, `class`, `placeholder`, `required`, `onBlur` etc. *Note: we recommend using the separate `disabled` prop instead of `inputProps.disabled`.*
46
+ The props to pass to the input element, e.g. `id`, `class`, `placeholder`, `required`, `onBlur`. *Note: we recommend using the separate `disabled` prop instead of `inputProps.disabled`.*
49
47
 
50
48
  **options**
51
49
  Type: `Object`
52
50
  An object containing the [initialisation options](https://github.com/jackocnr/intl-tel-input?tab=readme-ov-file#initialisation-options) to pass to the plugin. You can use these exactly the same way as with the main JavaScript plugin.
53
51
 
52
+ **usePreciseValidation**
53
+ Type: `Boolean`, Default: `false`
54
+ By default, the component uses the plugin's `isValidNumber` method for validation, but if you'd rather use `isValidNumberPrecise`, set this to `true`.
55
+
54
56
  **value**
55
57
  Type: `String`
56
58
  The initial value to put in the input. This will get auto-formatted on init (according to `formatOnDisplay` initialisation option). IntlTelInput is an uncontrolled input, and so will ignore any changes to this value.
@@ -60,7 +62,7 @@ Here's a list of all of the current events you can listen to on the IntlTelInput
60
62
 
61
63
  **changeCountry**
62
64
  Type: `Function`
63
- A handler to be called when the selected country changes. It will be passed the new country iso2 code e.g. "gb" for UK.
65
+ A handler to be called when the selected country changes. It will be passed the new country iso2 code, e.g. "gb" for the UK.
64
66
 
65
67
  **changeErrorCode**
66
68
  Type: `Function`
@@ -76,7 +78,7 @@ A handler to be called when the number validity changes e.g. to true/false. It w
76
78
 
77
79
  ## Accessing Instance Methods
78
80
 
79
- You can access all of the plugin's [instance methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#instance-methods) (`setNumber`, `setCountry`, `setPlaceholderNumberType` etc) by passing a ref into the IntlTelInput component (using the `ref` prop), and then calling `ref.intlTelInput.instance` e.g. `ref.intlTelInput.instance.setNumber(...);`. See the [Set Number demo](https://github.com/jackocnr/intl-tel-input/blob/master/vue/demo/set-number/App.vue) for a full example. You can also access the input DOM element in a similar way: `ref.intlTelInput.input`.
81
+ You can access all of the plugin's [instance methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#instance-methods) (`setNumber`, `setCountry`, `setPlaceholderNumberType` etc) by passing a ref into the IntlTelInput component (using the `ref` prop), and then accessing `ref.value.instance` e.g. `ref.value?.instance?.setNumber(...);`. See the [Set Number demo](https://github.com/jackocnr/intl-tel-input/blob/master/vue/demo/set-number/App.vue) for a full example. You can also access the input DOM element in a similar way: `ref.value?.input`.
80
82
 
81
83
  ## Accessing Static Methods
82
84
 
@@ -2,6 +2,7 @@ import { SomeOptions } from './modules/types/public-api';
2
2
  import { InputHTMLAttributes } from 'vue';
3
3
  interface Props {
4
4
  options?: SomeOptions;
5
+ usePreciseValidation?: boolean;
5
6
  disabled?: boolean;
6
7
  inputProps?: InputHTMLAttributes;
7
8
  }
@@ -27,6 +28,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
27
28
  }>, {
28
29
  disabled: boolean;
29
30
  options: SomeOptions;
31
+ usePreciseValidation: boolean;
30
32
  inputProps: InputHTMLAttributes;
31
33
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
32
34
  input: HTMLInputElement;
@@ -2,6 +2,7 @@ import { SomeOptions } from './modules/types/public-api';
2
2
  import { InputHTMLAttributes } from 'vue';
3
3
  interface Props {
4
4
  options?: SomeOptions;
5
+ usePreciseValidation?: boolean;
5
6
  disabled?: boolean;
6
7
  inputProps?: InputHTMLAttributes;
7
8
  }
@@ -27,6 +28,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
27
28
  }>, {
28
29
  disabled: boolean;
29
30
  options: SomeOptions;
31
+ usePreciseValidation: boolean;
30
32
  inputProps: InputHTMLAttributes;
31
33
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
32
34
  input: HTMLInputElement;
@@ -1,10 +1,11 @@
1
- import { defineComponent as g, mergeModels as m, useModel as b, ref as r, onMounted as h, watch as C, onUnmounted as M, withDirectives as N, createElementBlock as P, openBlock as D, mergeProps as E, vModelText as I } from "vue";
2
- import { i as k } from "../intl-tel-input-f0-6rrpA.mjs";
3
- const B = /* @__PURE__ */ g({
1
+ import { defineComponent as g, mergeModels as m, useModel as b, ref as r, onMounted as h, watch as C, onUnmounted as P, withDirectives as N, createElementBlock as M, openBlock as B, mergeProps as D, vModelText as E } from "vue";
2
+ import { i as I } from "../intl-tel-input-DYFK-Vt4.mjs";
3
+ const x = /* @__PURE__ */ g({
4
4
  inheritAttrs: !1,
5
5
  __name: "IntlTelInput",
6
6
  props: /* @__PURE__ */ m({
7
7
  options: { default: () => ({}) },
8
+ usePreciseValidation: { type: Boolean, default: !1 },
8
9
  disabled: { type: Boolean, default: !1 },
9
10
  inputProps: { default: () => ({}) }
10
11
  }, {
@@ -20,40 +21,40 @@ const B = /* @__PURE__ */ g({
20
21
  "changeErrorCode"
21
22
  ], ["update:modelValue"]),
22
23
  setup(s, { expose: v, emit: f }) {
23
- const u = b(s, "modelValue"), l = s, o = f, n = r(), t = r(), i = r(!1), d = () => t.value ? l.options.strictMode ? t.value.isValidNumberPrecise() : t.value.isValidNumber() : null, p = () => {
24
+ const u = b(s, "modelValue"), l = s, n = f, o = r(), t = r(), i = r(!1), d = () => t.value ? l.usePreciseValidation ? t.value.isValidNumberPrecise() : t.value.isValidNumber() : null, p = () => {
24
25
  let e = d();
25
- i.value !== e && (i.value = e, o("changeValidity", !!e), o(
26
+ i.value !== e && (i.value = e, n("changeValidity", !!e), n(
26
27
  "changeErrorCode",
27
28
  e ? null : t.value.getValidationError()
28
29
  ));
29
30
  }, c = () => {
30
31
  var e;
31
- o("changeNumber", ((e = t.value) == null ? void 0 : e.getNumber()) ?? ""), p();
32
- }, y = () => {
32
+ n("changeNumber", ((e = t.value) == null ? void 0 : e.getNumber()) ?? ""), p();
33
+ }, V = () => {
33
34
  var e;
34
- o("changeCountry", ((e = t.value) == null ? void 0 : e.getSelectedCountryData().iso2) ?? ""), c(), p();
35
+ n("changeCountry", ((e = t.value) == null ? void 0 : e.getSelectedCountryData().iso2) ?? ""), c(), p();
35
36
  };
36
37
  return h(() => {
37
- n.value && (t.value = k(n.value, l.options), u.value && t.value.setNumber(u.value), l.disabled && t.value.setDisabled(l.disabled), i.value = d());
38
+ o.value && (t.value = I(o.value, l.options), u.value && t.value.setNumber(u.value), l.disabled && t.value.setDisabled(l.disabled), i.value = d());
38
39
  }), C(
39
40
  () => l.disabled,
40
41
  (e) => {
41
42
  var a;
42
43
  return (a = t.value) == null ? void 0 : a.setDisabled(e);
43
44
  }
44
- ), M(() => {
45
+ ), P(() => {
45
46
  var e;
46
47
  return (e = t.value) == null ? void 0 : e.destroy();
47
- }), v({ instance: t, input: n }), (e, a) => N((D(), P("input", E({
48
+ }), v({ instance: t, input: o }), (e, a) => N((B(), M("input", D({
48
49
  ref_key: "input",
49
- ref: n,
50
- "onUpdate:modelValue": a[0] || (a[0] = (V) => u.value = V),
50
+ ref: o,
51
+ "onUpdate:modelValue": a[0] || (a[0] = (y) => u.value = y),
51
52
  type: "tel",
52
- onCountrychange: y,
53
+ onCountrychange: V,
53
54
  onInput: c
54
55
  }, e.inputProps), null, 16)), [
55
56
  [
56
- I,
57
+ E,
57
58
  u.value,
58
59
  void 0,
59
60
  { lazy: !0 }
@@ -62,5 +63,5 @@ const B = /* @__PURE__ */ g({
62
63
  }
63
64
  });
64
65
  export {
65
- B as default
66
+ x as default
66
67
  };