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.
- package/README.md +29 -26
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +16 -6
- package/angular/build/IntlTelInputWithUtils.js +140 -191
- package/angular/build/types/intl-tel-input/i18n/index.d.ts +1 -0
- package/angular/build/types/intl-tel-input/i18n/zh-hk/index.d.ts +3 -0
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/i18n/ar/countries.js +245 -0
- package/build/js/i18n/ar/index.js +1 -0
- package/build/js/i18n/ar/interface.js +23 -0
- package/build/js/i18n/bg/countries.js +245 -0
- package/build/js/i18n/bg/index.js +1 -0
- package/build/js/i18n/bg/interface.js +13 -0
- package/build/js/i18n/bn/countries.js +245 -0
- package/build/js/i18n/bn/index.js +1 -0
- package/build/js/i18n/bn/interface.js +13 -0
- package/build/js/i18n/bs/countries.js +245 -0
- package/build/js/i18n/bs/index.js +1 -0
- package/build/js/i18n/bs/interface.js +20 -0
- package/build/js/i18n/ca/countries.js +245 -0
- package/build/js/i18n/ca/index.js +1 -0
- package/build/js/i18n/ca/interface.js +13 -0
- package/build/js/i18n/cs/countries.js +245 -0
- package/build/js/i18n/cs/index.js +1 -0
- package/build/js/i18n/cs/interface.js +20 -0
- package/build/js/i18n/da/countries.js +245 -0
- package/build/js/i18n/da/index.js +1 -0
- package/build/js/i18n/da/interface.js +13 -0
- package/build/js/i18n/de/countries.js +245 -0
- package/build/js/i18n/de/index.js +1 -0
- package/build/js/i18n/de/interface.js +13 -0
- package/build/js/i18n/ee/countries.js +245 -0
- package/build/js/i18n/ee/index.js +1 -0
- package/build/js/i18n/ee/interface.js +13 -0
- package/build/js/i18n/el/countries.js +245 -0
- package/build/js/i18n/el/index.js +1 -0
- package/build/js/i18n/el/interface.js +13 -0
- package/build/js/i18n/en/countries.js +245 -0
- package/build/js/i18n/en/interface.js +14 -0
- package/build/js/i18n/es/countries.js +245 -0
- package/build/js/i18n/es/index.js +1 -0
- package/build/js/i18n/es/interface.js +13 -0
- package/build/js/i18n/fa/countries.js +245 -0
- package/build/js/i18n/fa/index.js +1 -0
- package/build/js/i18n/fa/interface.js +13 -0
- package/build/js/i18n/fi/countries.js +245 -0
- package/build/js/i18n/fi/index.js +1 -0
- package/build/js/i18n/fi/interface.js +13 -0
- package/build/js/i18n/fr/countries.js +245 -0
- package/build/js/i18n/fr/index.js +1 -0
- package/build/js/i18n/fr/interface.js +13 -0
- package/build/js/i18n/hi/countries.js +245 -0
- package/build/js/i18n/hi/index.js +1 -0
- package/build/js/i18n/hi/interface.js +13 -0
- package/build/js/i18n/hr/countries.js +245 -0
- package/build/js/i18n/hr/index.js +1 -0
- package/build/js/i18n/hr/interface.js +20 -0
- package/build/js/i18n/hu/countries.js +245 -0
- package/build/js/i18n/hu/index.js +1 -0
- package/build/js/i18n/hu/interface.js +13 -0
- package/build/js/i18n/id/countries.js +245 -0
- package/build/js/i18n/id/index.js +1 -0
- package/build/js/i18n/id/interface.js +13 -0
- package/build/js/i18n/index.js +1 -0
- package/build/js/i18n/it/countries.js +245 -0
- package/build/js/i18n/it/index.js +1 -0
- package/build/js/i18n/it/interface.js +13 -0
- package/build/js/i18n/ja/countries.js +245 -0
- package/build/js/i18n/ja/index.js +1 -0
- package/build/js/i18n/ja/interface.js +13 -0
- package/build/js/i18n/ko/countries.js +245 -0
- package/build/js/i18n/ko/index.js +1 -0
- package/build/js/i18n/ko/interface.js +13 -0
- package/build/js/i18n/lt/countries.js +245 -0
- package/build/js/i18n/lt/interface.js +26 -0
- package/build/js/i18n/mr/countries.js +245 -0
- package/build/js/i18n/mr/index.js +1 -0
- package/build/js/i18n/mr/interface.js +13 -0
- package/build/js/i18n/nl/countries.js +245 -0
- package/build/js/i18n/nl/index.js +1 -0
- package/build/js/i18n/nl/interface.js +13 -0
- package/build/js/i18n/no/countries.js +245 -0
- package/build/js/i18n/no/index.js +1 -0
- package/build/js/i18n/no/interface.js +13 -0
- package/build/js/i18n/pl/countries.js +245 -0
- package/build/js/i18n/pl/index.js +1 -0
- package/build/js/i18n/pl/interface.js +19 -0
- package/build/js/i18n/pt/countries.js +245 -0
- package/build/js/i18n/pt/index.js +1 -0
- package/build/js/i18n/pt/interface.js +13 -0
- package/build/js/i18n/ro/countries.js +245 -0
- package/build/js/i18n/ro/index.js +1 -0
- package/build/js/i18n/ro/interface.js +18 -0
- package/build/js/i18n/ru/countries.js +245 -0
- package/build/js/i18n/ru/index.js +1 -0
- package/build/js/i18n/ru/interface.js +20 -0
- package/build/js/i18n/sk/countries.js +245 -0
- package/build/js/i18n/sk/index.js +1 -0
- package/build/js/i18n/sk/interface.js +20 -0
- package/build/js/i18n/sl/countries.js +245 -0
- package/build/js/i18n/sl/interface.js +25 -0
- package/build/js/i18n/sq/countries.js +245 -0
- package/build/js/i18n/sq/interface.js +14 -0
- package/build/js/i18n/sr/countries.js +245 -0
- package/build/js/i18n/sr/interface.js +21 -0
- package/build/js/i18n/sv/countries.js +245 -0
- package/build/js/i18n/sv/index.js +1 -0
- package/build/js/i18n/sv/interface.js +13 -0
- package/build/js/i18n/te/countries.js +245 -0
- package/build/js/i18n/te/index.js +1 -0
- package/build/js/i18n/te/interface.js +13 -0
- package/build/js/i18n/th/countries.js +245 -0
- package/build/js/i18n/th/index.js +1 -0
- package/build/js/i18n/th/interface.js +13 -0
- package/build/js/i18n/tr/countries.js +245 -0
- package/build/js/i18n/tr/index.js +1 -0
- package/build/js/i18n/tr/interface.js +13 -0
- package/build/js/i18n/uk/countries.js +245 -0
- package/build/js/i18n/uk/index.js +1 -0
- package/build/js/i18n/uk/interface.js +20 -0
- package/build/js/i18n/ur/countries.js +245 -0
- package/build/js/i18n/ur/index.js +1 -0
- package/build/js/i18n/ur/interface.js +13 -0
- package/build/js/i18n/uz/countries.js +245 -0
- package/build/js/i18n/uz/index.js +1 -0
- package/build/js/i18n/uz/interface.js +13 -0
- package/build/js/i18n/vi/countries.js +245 -0
- package/build/js/i18n/vi/index.js +1 -0
- package/build/js/i18n/vi/interface.js +13 -0
- package/build/js/i18n/zh/countries.js +245 -0
- package/build/js/i18n/zh/index.js +1 -0
- package/build/js/i18n/zh/interface.js +13 -0
- package/build/js/i18n/zh-hk/countries.js +245 -0
- package/build/js/i18n/zh-hk/index.js +18 -0
- package/build/js/i18n/zh-hk/interface.js +14 -0
- package/build/js/intlTelInput.d.ts +6 -0
- package/build/js/intlTelInput.js +17 -7
- package/build/js/intlTelInput.min.js +3 -3
- package/build/js/intlTelInputWithUtils.js +141 -192
- package/build/js/intlTelInputWithUtils.min.js +3 -3
- package/build/js/utils.js +53 -54
- package/package.json +2 -2
- package/react/README.md +4 -2
- package/react/build/IntlTelInput.cjs +16 -6
- package/react/build/IntlTelInput.d.ts +6 -0
- package/react/build/IntlTelInput.js +16 -6
- package/react/build/IntlTelInputWithUtils.cjs +140 -191
- package/react/build/IntlTelInputWithUtils.js +140 -191
- package/svelte/README.md +7 -9
- package/svelte/build/IntlTelInput.mjs +1446 -1440
- package/svelte/build/IntlTelInputWithUtils.mjs +1795 -1850
- package/vue/README.md +12 -10
- package/vue/build/IntlTelInput.vue.d.ts +2 -0
- package/vue/build/IntlTelInputWithUtils.vue.d.ts +2 -0
- package/vue/build/exports/IntlTelInput.mjs +17 -16
- package/vue/build/exports/IntlTelInputWithUtils.mjs +176 -236
- package/vue/build/intl-tel-input/i18n/index.d.ts +1 -0
- package/vue/build/intl-tel-input/i18n/zh-hk/index.d.ts +3 -0
- 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
|
-
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2
|
-
import { i as
|
|
3
|
-
const
|
|
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,
|
|
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,
|
|
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
|
-
|
|
32
|
-
},
|
|
32
|
+
n("changeNumber", ((e = t.value) == null ? void 0 : e.getNumber()) ?? ""), p();
|
|
33
|
+
}, V = () => {
|
|
33
34
|
var e;
|
|
34
|
-
|
|
35
|
+
n("changeCountry", ((e = t.value) == null ? void 0 : e.getSelectedCountryData().iso2) ?? ""), c(), p();
|
|
35
36
|
};
|
|
36
37
|
return h(() => {
|
|
37
|
-
|
|
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
|
-
),
|
|
45
|
+
), P(() => {
|
|
45
46
|
var e;
|
|
46
47
|
return (e = t.value) == null ? void 0 : e.destroy();
|
|
47
|
-
}), v({ instance: t, input:
|
|
48
|
+
}), v({ instance: t, input: o }), (e, a) => N((B(), M("input", D({
|
|
48
49
|
ref_key: "input",
|
|
49
|
-
ref:
|
|
50
|
-
"onUpdate:modelValue": a[0] || (a[0] = (
|
|
50
|
+
ref: o,
|
|
51
|
+
"onUpdate:modelValue": a[0] || (a[0] = (y) => u.value = y),
|
|
51
52
|
type: "tel",
|
|
52
|
-
onCountrychange:
|
|
53
|
+
onCountrychange: V,
|
|
53
54
|
onInput: c
|
|
54
55
|
}, e.inputProps), null, 16)), [
|
|
55
56
|
[
|
|
56
|
-
|
|
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
|
-
|
|
66
|
+
x as default
|
|
66
67
|
};
|