intl-tel-input 27.2.1 → 27.3.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/CHANGELOG.md +1 -1
- package/README.md +25 -14
- package/angular/dist/IntlTelInput.d.ts +3 -1
- package/angular/dist/IntlTelInput.js +44 -7
- package/angular/dist/IntlTelInputWithUtils.js +374 -314
- package/dist/css/intlTelInput-no-assets.css +1116 -1
- package/dist/css/intlTelInput-no-assets.min.css +1 -1
- package/dist/css/intlTelInput.css +1122 -1
- package/dist/css/intlTelInput.min.css +1 -1
- package/dist/js/data.js +1 -1
- package/dist/js/data.min.js +1 -1
- package/dist/js/intlTelInput.d.ts +1 -0
- package/dist/js/intlTelInput.js +35 -6
- package/dist/js/intlTelInput.min.js +3 -3
- package/dist/js/intlTelInput.mjs +34 -5
- package/dist/js/intlTelInputWithUtils.js +365 -313
- package/dist/js/intlTelInputWithUtils.min.js +3 -3
- package/dist/js/intlTelInputWithUtils.mjs +364 -312
- package/dist/js/utils.js +50 -51
- package/package.json +3 -7
- package/react/dist/IntlTelInput.js +38 -5
- package/react/dist/IntlTelInputWithUtils.js +368 -312
- package/svelte/src/IntlTelInput.svelte +9 -2
- package/vue/dist/{IntlTelInput-CzuiSLVt.js → IntlTelInput-jw1tkqdD.js} +194 -186
- package/vue/dist/IntlTelInput.js +1 -1
- package/vue/dist/IntlTelInputWithUtils.js +35 -14
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
// State
|
|
37
37
|
let inputElement: HTMLInputElement | undefined = $state();
|
|
38
38
|
let instance: Iti | undefined = $state();
|
|
39
|
+
// Classes the plugin adds directly to the input (e.g. iti__tel-input)
|
|
40
|
+
let pluginInputClasses = $state("");
|
|
39
41
|
let lastEmittedNumber: string | undefined = $state();
|
|
40
42
|
let lastEmittedCountry: string | undefined = $state();
|
|
41
43
|
let lastEmittedValidity: boolean | undefined = $state();
|
|
@@ -117,6 +119,7 @@
|
|
|
117
119
|
onMount(() => {
|
|
118
120
|
if (inputElement) {
|
|
119
121
|
instance = intlTelInput(inputElement, initOptions as SomeOptions);
|
|
122
|
+
pluginInputClasses = inputElement.className;
|
|
120
123
|
if (disabled) instance.setDisabled(disabled);
|
|
121
124
|
if (readonly) instance.setReadonly(readonly);
|
|
122
125
|
|
|
@@ -171,9 +174,11 @@
|
|
|
171
174
|
}
|
|
172
175
|
});
|
|
173
176
|
|
|
174
|
-
// Watch value prop changes (only after initialization)
|
|
177
|
+
// Watch value prop changes (only after initialization).
|
|
178
|
+
// If value is undefined, the component is uncontrolled — do not touch the input
|
|
179
|
+
// (otherwise we would clobber any initialValue with an empty string on mount).
|
|
175
180
|
$effect(() => {
|
|
176
|
-
if (!hasInitialized || !instance) {
|
|
181
|
+
if (!hasInitialized || !instance || value === undefined) {
|
|
177
182
|
return;
|
|
178
183
|
}
|
|
179
184
|
const next = value ?? "";
|
|
@@ -209,6 +214,8 @@
|
|
|
209
214
|
for (const [key, val] of Object.entries(props)) {
|
|
210
215
|
if (ignoredInputProps.has(key)) {
|
|
211
216
|
warnInputProp(key);
|
|
217
|
+
} else if (key === "class") {
|
|
218
|
+
rest[key] = `${pluginInputClasses} ${val}`;
|
|
212
219
|
} else {
|
|
213
220
|
rest[key] = val;
|
|
214
221
|
}
|