intl-tel-input 25.8.3 → 25.8.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intl-tel-input",
3
- "version": "25.8.3",
3
+ "version": "25.8.4",
4
4
  "description": "A JavaScript plugin for entering and validating international telephone numbers",
5
5
  "keywords": [
6
6
  "international",
package/react/README.md CHANGED
@@ -28,7 +28,7 @@ import "intl-tel-input/styles";
28
28
 
29
29
  See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/react/demo/validation/ValidationApp.tsx) for a more fleshed-out example of how to handle validation.
30
30
 
31
- 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"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/react"` 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.8.3/build/js/utils.js"`.
31
+ 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"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/react"` 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.8.4/build/js/utils.js"`.
32
32
 
33
33
  ## Props
34
34
  Here's a list of all of the current props you can pass to the IntlTelInput React component.
@@ -2348,7 +2348,7 @@ var Iti = class _Iti {
2348
2348
  }
2349
2349
  //* Initialize the tel input listeners.
2350
2350
  _initTelInputListeners() {
2351
- const { strictMode, formatAsYouType, separateDialCode, formatOnDisplay, allowDropdown, countrySearch } = this.options;
2351
+ const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
2352
2352
  let userOverrideFormatting = false;
2353
2353
  if (/\p{L}/u.test(this.telInput.value)) {
2354
2354
  userOverrideFormatting = true;
@@ -2372,8 +2372,8 @@ var Iti = class _Iti {
2372
2372
  } else if (!/[^+0-9]/.test(this.telInput.value)) {
2373
2373
  userOverrideFormatting = false;
2374
2374
  }
2375
- const disableFormatOnSetNumber = e?.detail && e.detail["isSetNumber"] && !formatOnDisplay;
2376
- if (formatAsYouType && !userOverrideFormatting && !disableFormatOnSetNumber) {
2375
+ const isSetNumber = e?.detail && e.detail["isSetNumber"];
2376
+ if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
2377
2377
  const currentCaretPos = this.telInput.selectionStart || 0;
2378
2378
  const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
2379
2379
  const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
@@ -2885,6 +2885,9 @@ var Iti = class _Iti {
2885
2885
  );
2886
2886
  this._closeDropdown();
2887
2887
  this._updateDialCode(listItem.getAttribute("data-dial-code"));
2888
+ if (this.options.formatOnDisplay) {
2889
+ this._updateValFromNumber(this.telInput.value);
2890
+ }
2888
2891
  this.telInput.focus();
2889
2892
  if (countryChanged) {
2890
2893
  this._triggerCountryChange();
@@ -3182,6 +3185,9 @@ var Iti = class _Iti {
3182
3185
  if (isCountryChange) {
3183
3186
  this._setCountry(iso2Lower);
3184
3187
  this._updateDialCode(this.selectedCountryData.dialCode);
3188
+ if (this.options.formatOnDisplay) {
3189
+ this._updateValFromNumber(this.telInput.value);
3190
+ }
3185
3191
  this._triggerCountryChange();
3186
3192
  }
3187
3193
  }
@@ -3261,7 +3267,7 @@ var intlTelInput = Object.assign(
3261
3267
  attachUtils,
3262
3268
  startedLoadingUtilsScript: false,
3263
3269
  startedLoadingAutoCountry: false,
3264
- version: "25.8.3"
3270
+ version: "25.8.4"
3265
3271
  }
3266
3272
  );
3267
3273
  var intl_tel_input_default = intlTelInput;
@@ -2312,7 +2312,7 @@ var Iti = class _Iti {
2312
2312
  }
2313
2313
  //* Initialize the tel input listeners.
2314
2314
  _initTelInputListeners() {
2315
- const { strictMode, formatAsYouType, separateDialCode, formatOnDisplay, allowDropdown, countrySearch } = this.options;
2315
+ const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
2316
2316
  let userOverrideFormatting = false;
2317
2317
  if (/\p{L}/u.test(this.telInput.value)) {
2318
2318
  userOverrideFormatting = true;
@@ -2336,8 +2336,8 @@ var Iti = class _Iti {
2336
2336
  } else if (!/[^+0-9]/.test(this.telInput.value)) {
2337
2337
  userOverrideFormatting = false;
2338
2338
  }
2339
- const disableFormatOnSetNumber = e?.detail && e.detail["isSetNumber"] && !formatOnDisplay;
2340
- if (formatAsYouType && !userOverrideFormatting && !disableFormatOnSetNumber) {
2339
+ const isSetNumber = e?.detail && e.detail["isSetNumber"];
2340
+ if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
2341
2341
  const currentCaretPos = this.telInput.selectionStart || 0;
2342
2342
  const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
2343
2343
  const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
@@ -2849,6 +2849,9 @@ var Iti = class _Iti {
2849
2849
  );
2850
2850
  this._closeDropdown();
2851
2851
  this._updateDialCode(listItem.getAttribute("data-dial-code"));
2852
+ if (this.options.formatOnDisplay) {
2853
+ this._updateValFromNumber(this.telInput.value);
2854
+ }
2852
2855
  this.telInput.focus();
2853
2856
  if (countryChanged) {
2854
2857
  this._triggerCountryChange();
@@ -3146,6 +3149,9 @@ var Iti = class _Iti {
3146
3149
  if (isCountryChange) {
3147
3150
  this._setCountry(iso2Lower);
3148
3151
  this._updateDialCode(this.selectedCountryData.dialCode);
3152
+ if (this.options.formatOnDisplay) {
3153
+ this._updateValFromNumber(this.telInput.value);
3154
+ }
3149
3155
  this._triggerCountryChange();
3150
3156
  }
3151
3157
  }
@@ -3225,7 +3231,7 @@ var intlTelInput = Object.assign(
3225
3231
  attachUtils,
3226
3232
  startedLoadingUtilsScript: false,
3227
3233
  startedLoadingAutoCountry: false,
3228
- version: "25.8.3"
3234
+ version: "25.8.4"
3229
3235
  }
3230
3236
  );
3231
3237
  var intl_tel_input_default = intlTelInput;
@@ -2348,7 +2348,7 @@ var Iti = class _Iti {
2348
2348
  }
2349
2349
  //* Initialize the tel input listeners.
2350
2350
  _initTelInputListeners() {
2351
- const { strictMode, formatAsYouType, separateDialCode, formatOnDisplay, allowDropdown, countrySearch } = this.options;
2351
+ const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
2352
2352
  let userOverrideFormatting = false;
2353
2353
  if (/\p{L}/u.test(this.telInput.value)) {
2354
2354
  userOverrideFormatting = true;
@@ -2372,8 +2372,8 @@ var Iti = class _Iti {
2372
2372
  } else if (!/[^+0-9]/.test(this.telInput.value)) {
2373
2373
  userOverrideFormatting = false;
2374
2374
  }
2375
- const disableFormatOnSetNumber = e?.detail && e.detail["isSetNumber"] && !formatOnDisplay;
2376
- if (formatAsYouType && !userOverrideFormatting && !disableFormatOnSetNumber) {
2375
+ const isSetNumber = e?.detail && e.detail["isSetNumber"];
2376
+ if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
2377
2377
  const currentCaretPos = this.telInput.selectionStart || 0;
2378
2378
  const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
2379
2379
  const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
@@ -2885,6 +2885,9 @@ var Iti = class _Iti {
2885
2885
  );
2886
2886
  this._closeDropdown();
2887
2887
  this._updateDialCode(listItem.getAttribute("data-dial-code"));
2888
+ if (this.options.formatOnDisplay) {
2889
+ this._updateValFromNumber(this.telInput.value);
2890
+ }
2888
2891
  this.telInput.focus();
2889
2892
  if (countryChanged) {
2890
2893
  this._triggerCountryChange();
@@ -3182,6 +3185,9 @@ var Iti = class _Iti {
3182
3185
  if (isCountryChange) {
3183
3186
  this._setCountry(iso2Lower);
3184
3187
  this._updateDialCode(this.selectedCountryData.dialCode);
3188
+ if (this.options.formatOnDisplay) {
3189
+ this._updateValFromNumber(this.telInput.value);
3190
+ }
3185
3191
  this._triggerCountryChange();
3186
3192
  }
3187
3193
  }
@@ -3261,7 +3267,7 @@ var intlTelInput = Object.assign(
3261
3267
  attachUtils,
3262
3268
  startedLoadingUtilsScript: false,
3263
3269
  startedLoadingAutoCountry: false,
3264
- version: "25.8.3"
3270
+ version: "25.8.4"
3265
3271
  }
3266
3272
  );
3267
3273
  var intl_tel_input_default = intlTelInput;
@@ -2312,7 +2312,7 @@ var Iti = class _Iti {
2312
2312
  }
2313
2313
  //* Initialize the tel input listeners.
2314
2314
  _initTelInputListeners() {
2315
- const { strictMode, formatAsYouType, separateDialCode, formatOnDisplay, allowDropdown, countrySearch } = this.options;
2315
+ const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
2316
2316
  let userOverrideFormatting = false;
2317
2317
  if (/\p{L}/u.test(this.telInput.value)) {
2318
2318
  userOverrideFormatting = true;
@@ -2336,8 +2336,8 @@ var Iti = class _Iti {
2336
2336
  } else if (!/[^+0-9]/.test(this.telInput.value)) {
2337
2337
  userOverrideFormatting = false;
2338
2338
  }
2339
- const disableFormatOnSetNumber = e?.detail && e.detail["isSetNumber"] && !formatOnDisplay;
2340
- if (formatAsYouType && !userOverrideFormatting && !disableFormatOnSetNumber) {
2339
+ const isSetNumber = e?.detail && e.detail["isSetNumber"];
2340
+ if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
2341
2341
  const currentCaretPos = this.telInput.selectionStart || 0;
2342
2342
  const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
2343
2343
  const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
@@ -2849,6 +2849,9 @@ var Iti = class _Iti {
2849
2849
  );
2850
2850
  this._closeDropdown();
2851
2851
  this._updateDialCode(listItem.getAttribute("data-dial-code"));
2852
+ if (this.options.formatOnDisplay) {
2853
+ this._updateValFromNumber(this.telInput.value);
2854
+ }
2852
2855
  this.telInput.focus();
2853
2856
  if (countryChanged) {
2854
2857
  this._triggerCountryChange();
@@ -3146,6 +3149,9 @@ var Iti = class _Iti {
3146
3149
  if (isCountryChange) {
3147
3150
  this._setCountry(iso2Lower);
3148
3151
  this._updateDialCode(this.selectedCountryData.dialCode);
3152
+ if (this.options.formatOnDisplay) {
3153
+ this._updateValFromNumber(this.telInput.value);
3154
+ }
3149
3155
  this._triggerCountryChange();
3150
3156
  }
3151
3157
  }
@@ -3225,7 +3231,7 @@ var intlTelInput = Object.assign(
3225
3231
  attachUtils,
3226
3232
  startedLoadingUtilsScript: false,
3227
3233
  startedLoadingAutoCountry: false,
3228
- version: "25.8.3"
3234
+ version: "25.8.4"
3229
3235
  }
3230
3236
  );
3231
3237
  var intl_tel_input_default = intlTelInput;
package/vue/README.md CHANGED
@@ -34,7 +34,7 @@ See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master
34
34
  "vue:demo": "vite --config vue/demo/[demo variant]/vite.config.js"
35
35
  ```
36
36
 
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.8.3/build/js/utils.js"`.
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.8.4/build/js/utils.js"`.
38
38
 
39
39
  ## Props
40
40
  Here's a list of all of the current props you can pass to the IntlTelInput Vue component.