intl-tel-input 23.7.4 → 23.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +1 -0
- package/build/js/intlTelInput.js +10 -2
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +10 -2
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/README.md +6 -2
- package/react/build/IntlTelInput.cjs +16 -2
- package/react/build/IntlTelInput.d.ts +3 -0
- package/react/build/IntlTelInput.js +16 -2
- package/react/build/IntlTelInputWithUtils.cjs +16 -2
- package/react/build/IntlTelInputWithUtils.js +16 -2
package/package.json
CHANGED
package/react/README.md
CHANGED
|
@@ -29,7 +29,7 @@ import "intl-tel-input/styles";
|
|
|
29
29
|
|
|
30
30
|
See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/react/demo/ValidationApp.tsx) for a more fleshed out example of how to handle validation.
|
|
31
31
|
|
|
32
|
-
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/reactWithUtils"` instead, to include the utils script. Alternatively, if you use the main `"intl-tel-input/react"` import, then you should couple this with the `utilsScript` 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 `utilsScript` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@23.
|
|
32
|
+
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/reactWithUtils"` instead, to include the utils script. Alternatively, if you use the main `"intl-tel-input/react"` import, then you should couple this with the `utilsScript` 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 `utilsScript` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@23.8.0/build/js/utils.js"`.
|
|
33
33
|
|
|
34
34
|
## Props
|
|
35
35
|
Here's a list of all of the current props you can pass to the IntlTelInput react component.
|
|
@@ -64,7 +64,11 @@ An object containing all of the [initialisation options](https://github.com/jack
|
|
|
64
64
|
|
|
65
65
|
**inputProps**
|
|
66
66
|
Type: `Object`
|
|
67
|
-
The props to pass to the input element e.g. `className`, `placeholder`, `required`, `
|
|
67
|
+
The props to pass to the input element e.g. `className`, `placeholder`, `required`, `onBlur` etc. _Note: we recommend using the separate `disabled` prop instead of `inputProps.disabled`._
|
|
68
|
+
|
|
69
|
+
**disabled**
|
|
70
|
+
Type: `Boolean`, Default: `false`
|
|
71
|
+
Sets the disabled attribute of both the telephone input and selected country button. _Note: we recommend using this instead of `inputProps.disabled`._
|
|
68
72
|
|
|
69
73
|
## Accessing Instance Methods
|
|
70
74
|
|
|
@@ -2770,6 +2770,14 @@ var Iti = class {
|
|
|
2770
2770
|
this.options.placeholderNumberType = type;
|
|
2771
2771
|
this._updatePlaceholder();
|
|
2772
2772
|
}
|
|
2773
|
+
setDisabled(disabled) {
|
|
2774
|
+
this.telInput.disabled = disabled;
|
|
2775
|
+
if (disabled) {
|
|
2776
|
+
this.selectedCountry.setAttribute("disabled", "true");
|
|
2777
|
+
} else {
|
|
2778
|
+
this.selectedCountry.removeAttribute("disabled");
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2773
2781
|
};
|
|
2774
2782
|
var loadUtils = (path) => {
|
|
2775
2783
|
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
|
|
@@ -2813,7 +2821,7 @@ var intlTelInput = Object.assign(
|
|
|
2813
2821
|
//* A map from instance ID to instance object.
|
|
2814
2822
|
instances: {},
|
|
2815
2823
|
loadUtils,
|
|
2816
|
-
version: "23.
|
|
2824
|
+
version: "23.8.0"
|
|
2817
2825
|
}
|
|
2818
2826
|
);
|
|
2819
2827
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -2832,7 +2840,8 @@ var IntlTelInput = (0, import_react.forwardRef)(function IntlTelInput2({
|
|
|
2832
2840
|
},
|
|
2833
2841
|
usePreciseValidation = false,
|
|
2834
2842
|
initOptions = {},
|
|
2835
|
-
inputProps = {}
|
|
2843
|
+
inputProps = {},
|
|
2844
|
+
disabled = void 0
|
|
2836
2845
|
}, ref) {
|
|
2837
2846
|
const inputRef = (0, import_react.useRef)(null);
|
|
2838
2847
|
const itiRef = (0, import_react.useRef)(null);
|
|
@@ -2877,6 +2886,11 @@ var IntlTelInput = (0, import_react.forwardRef)(function IntlTelInput2({
|
|
|
2877
2886
|
}
|
|
2878
2887
|
};
|
|
2879
2888
|
}, [update]);
|
|
2889
|
+
(0, import_react.useEffect)(() => {
|
|
2890
|
+
if (itiRef.current && disabled !== void 0) {
|
|
2891
|
+
itiRef.current.setDisabled(disabled);
|
|
2892
|
+
}
|
|
2893
|
+
}, [disabled]);
|
|
2880
2894
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
2881
2895
|
"input",
|
|
2882
2896
|
{
|
|
@@ -973,6 +973,7 @@ declare module "intl-tel-input" {
|
|
|
973
973
|
setCountry(iso2: string): void;
|
|
974
974
|
setNumber(number: string): void;
|
|
975
975
|
setPlaceholderNumberType(type: NumberType): void;
|
|
976
|
+
setDisabled(disabled: boolean): void;
|
|
976
977
|
}
|
|
977
978
|
const intlTelInput: IntlTelInputInterface;
|
|
978
979
|
export default intlTelInput;
|
|
@@ -991,6 +992,7 @@ declare module "intl-tel-input/react" {
|
|
|
991
992
|
usePreciseValidation?: boolean;
|
|
992
993
|
initOptions?: SomeOptions;
|
|
993
994
|
inputProps?: object;
|
|
995
|
+
disabled?: boolean | undefined;
|
|
994
996
|
};
|
|
995
997
|
export type IntlTelInputRef = {
|
|
996
998
|
getInstance: () => Iti | null;
|
|
@@ -1021,6 +1023,7 @@ declare module "intl-tel-input/reactWithUtils" {
|
|
|
1021
1023
|
usePreciseValidation?: boolean;
|
|
1022
1024
|
initOptions?: SomeOptions;
|
|
1023
1025
|
inputProps?: object;
|
|
1026
|
+
disabled?: boolean | undefined;
|
|
1024
1027
|
};
|
|
1025
1028
|
export type IntlTelInputRef = {
|
|
1026
1029
|
getInstance: () => Iti | null;
|
|
@@ -2734,6 +2734,14 @@ var Iti = class {
|
|
|
2734
2734
|
this.options.placeholderNumberType = type;
|
|
2735
2735
|
this._updatePlaceholder();
|
|
2736
2736
|
}
|
|
2737
|
+
setDisabled(disabled) {
|
|
2738
|
+
this.telInput.disabled = disabled;
|
|
2739
|
+
if (disabled) {
|
|
2740
|
+
this.selectedCountry.setAttribute("disabled", "true");
|
|
2741
|
+
} else {
|
|
2742
|
+
this.selectedCountry.removeAttribute("disabled");
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2737
2745
|
};
|
|
2738
2746
|
var loadUtils = (path) => {
|
|
2739
2747
|
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
|
|
@@ -2777,7 +2785,7 @@ var intlTelInput = Object.assign(
|
|
|
2777
2785
|
//* A map from instance ID to instance object.
|
|
2778
2786
|
instances: {},
|
|
2779
2787
|
loadUtils,
|
|
2780
|
-
version: "23.
|
|
2788
|
+
version: "23.8.0"
|
|
2781
2789
|
}
|
|
2782
2790
|
);
|
|
2783
2791
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -2796,7 +2804,8 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
|
2796
2804
|
},
|
|
2797
2805
|
usePreciseValidation = false,
|
|
2798
2806
|
initOptions = {},
|
|
2799
|
-
inputProps = {}
|
|
2807
|
+
inputProps = {},
|
|
2808
|
+
disabled = void 0
|
|
2800
2809
|
}, ref) {
|
|
2801
2810
|
const inputRef = useRef(null);
|
|
2802
2811
|
const itiRef = useRef(null);
|
|
@@ -2841,6 +2850,11 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
|
2841
2850
|
}
|
|
2842
2851
|
};
|
|
2843
2852
|
}, [update]);
|
|
2853
|
+
useEffect(() => {
|
|
2854
|
+
if (itiRef.current && disabled !== void 0) {
|
|
2855
|
+
itiRef.current.setDisabled(disabled);
|
|
2856
|
+
}
|
|
2857
|
+
}, [disabled]);
|
|
2844
2858
|
return /* @__PURE__ */ React.createElement(
|
|
2845
2859
|
"input",
|
|
2846
2860
|
{
|
|
@@ -2770,6 +2770,14 @@ var Iti = class {
|
|
|
2770
2770
|
this.options.placeholderNumberType = type;
|
|
2771
2771
|
this._updatePlaceholder();
|
|
2772
2772
|
}
|
|
2773
|
+
setDisabled(disabled) {
|
|
2774
|
+
this.telInput.disabled = disabled;
|
|
2775
|
+
if (disabled) {
|
|
2776
|
+
this.selectedCountry.setAttribute("disabled", "true");
|
|
2777
|
+
} else {
|
|
2778
|
+
this.selectedCountry.removeAttribute("disabled");
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2773
2781
|
};
|
|
2774
2782
|
var loadUtils = (path) => {
|
|
2775
2783
|
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
|
|
@@ -2813,7 +2821,7 @@ var intlTelInput = Object.assign(
|
|
|
2813
2821
|
//* A map from instance ID to instance object.
|
|
2814
2822
|
instances: {},
|
|
2815
2823
|
loadUtils,
|
|
2816
|
-
version: "23.
|
|
2824
|
+
version: "23.8.0"
|
|
2817
2825
|
}
|
|
2818
2826
|
);
|
|
2819
2827
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -9048,7 +9056,8 @@ var IntlTelInput = (0, import_react.forwardRef)(function IntlTelInput2({
|
|
|
9048
9056
|
},
|
|
9049
9057
|
usePreciseValidation = false,
|
|
9050
9058
|
initOptions = {},
|
|
9051
|
-
inputProps = {}
|
|
9059
|
+
inputProps = {},
|
|
9060
|
+
disabled = void 0
|
|
9052
9061
|
}, ref) {
|
|
9053
9062
|
const inputRef = (0, import_react.useRef)(null);
|
|
9054
9063
|
const itiRef = (0, import_react.useRef)(null);
|
|
@@ -9093,6 +9102,11 @@ var IntlTelInput = (0, import_react.forwardRef)(function IntlTelInput2({
|
|
|
9093
9102
|
}
|
|
9094
9103
|
};
|
|
9095
9104
|
}, [update]);
|
|
9105
|
+
(0, import_react.useEffect)(() => {
|
|
9106
|
+
if (itiRef.current && disabled !== void 0) {
|
|
9107
|
+
itiRef.current.setDisabled(disabled);
|
|
9108
|
+
}
|
|
9109
|
+
}, [disabled]);
|
|
9096
9110
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
9097
9111
|
"input",
|
|
9098
9112
|
{
|
|
@@ -2734,6 +2734,14 @@ var Iti = class {
|
|
|
2734
2734
|
this.options.placeholderNumberType = type;
|
|
2735
2735
|
this._updatePlaceholder();
|
|
2736
2736
|
}
|
|
2737
|
+
setDisabled(disabled) {
|
|
2738
|
+
this.telInput.disabled = disabled;
|
|
2739
|
+
if (disabled) {
|
|
2740
|
+
this.selectedCountry.setAttribute("disabled", "true");
|
|
2741
|
+
} else {
|
|
2742
|
+
this.selectedCountry.removeAttribute("disabled");
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2737
2745
|
};
|
|
2738
2746
|
var loadUtils = (path) => {
|
|
2739
2747
|
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
|
|
@@ -2777,7 +2785,7 @@ var intlTelInput = Object.assign(
|
|
|
2777
2785
|
//* A map from instance ID to instance object.
|
|
2778
2786
|
instances: {},
|
|
2779
2787
|
loadUtils,
|
|
2780
|
-
version: "23.
|
|
2788
|
+
version: "23.8.0"
|
|
2781
2789
|
}
|
|
2782
2790
|
);
|
|
2783
2791
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -9012,7 +9020,8 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
|
9012
9020
|
},
|
|
9013
9021
|
usePreciseValidation = false,
|
|
9014
9022
|
initOptions = {},
|
|
9015
|
-
inputProps = {}
|
|
9023
|
+
inputProps = {},
|
|
9024
|
+
disabled = void 0
|
|
9016
9025
|
}, ref) {
|
|
9017
9026
|
const inputRef = useRef(null);
|
|
9018
9027
|
const itiRef = useRef(null);
|
|
@@ -9057,6 +9066,11 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
|
9057
9066
|
}
|
|
9058
9067
|
};
|
|
9059
9068
|
}, [update]);
|
|
9069
|
+
useEffect(() => {
|
|
9070
|
+
if (itiRef.current && disabled !== void 0) {
|
|
9071
|
+
itiRef.current.setDisabled(disabled);
|
|
9072
|
+
}
|
|
9073
|
+
}, [disabled]);
|
|
9060
9074
|
return /* @__PURE__ */ React.createElement(
|
|
9061
9075
|
"input",
|
|
9062
9076
|
{
|