intl-tel-input 25.13.0 → 25.13.1

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.13.0",
3
+ "version": "25.13.1",
4
4
  "description": "A JavaScript plugin for entering and validating international telephone numbers",
5
5
  "keywords": [
6
6
  "international",
package/react/README.md CHANGED
@@ -30,7 +30,7 @@ import "intl-tel-input/styles";
30
30
  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.
31
31
 
32
32
  ## Utils Script
33
- 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 just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.0/build/js/utils.js"`.
33
+ 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 just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.1/build/js/utils.js"`.
34
34
 
35
35
  ## Props
36
36
  Here's a list of all of the current props you can pass to the IntlTelInput React component.
@@ -2743,11 +2743,11 @@ var translateCountryNames = (countries, options) => {
2743
2743
  }
2744
2744
  }
2745
2745
  };
2746
- var processDialCodes = (countries, options) => {
2746
+ var processDialCodes = (countries) => {
2747
2747
  const dialCodes = /* @__PURE__ */ new Set();
2748
2748
  let dialCodeMaxLen = 0;
2749
2749
  const dialCodeToIso2Map = {};
2750
- const _addToDialCodeMap = (iso2, dialCode, priority) => {
2750
+ const _addToDialCodeMap = (iso2, dialCode) => {
2751
2751
  if (!iso2 || !dialCode) {
2752
2752
  return;
2753
2753
  }
@@ -2761,10 +2761,10 @@ var processDialCodes = (countries, options) => {
2761
2761
  if (iso2List.includes(iso2)) {
2762
2762
  return;
2763
2763
  }
2764
- const index = priority !== void 0 ? priority : iso2List.length;
2765
- iso2List[index] = iso2;
2764
+ iso2List.push(iso2);
2766
2765
  };
2767
- for (const c of countries) {
2766
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
2767
+ for (const c of countriesSortedByPriority) {
2768
2768
  if (!dialCodes.has(c.dialCode)) {
2769
2769
  dialCodes.add(c.dialCode);
2770
2770
  }
@@ -2772,14 +2772,7 @@ var processDialCodes = (countries, options) => {
2772
2772
  const partialDialCode = c.dialCode.substring(0, k);
2773
2773
  _addToDialCodeMap(c.iso2, partialDialCode);
2774
2774
  }
2775
- _addToDialCodeMap(c.iso2, c.dialCode, c.priority);
2776
- }
2777
- if (options.onlyCountries.length || options.excludeCountries.length) {
2778
- dialCodes.forEach((dialCode) => {
2779
- dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
2780
- });
2781
- }
2782
- for (const c of countries) {
2775
+ _addToDialCodeMap(c.iso2, c.dialCode);
2783
2776
  if (c.areaCodes) {
2784
2777
  const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
2785
2778
  for (const areaCode of c.areaCodes) {
@@ -2914,8 +2907,7 @@ var Iti = class _Iti {
2914
2907
  this.promise = this._createInitPromises();
2915
2908
  this.countries = processAllCountries(this.options);
2916
2909
  const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(
2917
- this.countries,
2918
- this.options
2910
+ this.countries
2919
2911
  );
2920
2912
  this.dialCodes = dialCodes;
2921
2913
  this.dialCodeMaxLen = dialCodeMaxLen;
@@ -4096,7 +4088,7 @@ var intlTelInput = Object.assign(
4096
4088
  attachUtils,
4097
4089
  startedLoadingUtilsScript: false,
4098
4090
  startedLoadingAutoCountry: false,
4099
- version: "25.13.0"
4091
+ version: "25.13.1"
4100
4092
  }
4101
4093
  );
4102
4094
  var intl_tel_input_default = intlTelInput;
@@ -317,7 +317,7 @@ declare module "modules/data/country-data" {
317
317
  }
318
318
  export const processAllCountries: (options: AllOptions) => Country[];
319
319
  export const translateCountryNames: (countries: Country[], options: AllOptions) => void;
320
- export const processDialCodes: (countries: Country[], options: AllOptions) => DialCodeProcessingResult;
320
+ export const processDialCodes: (countries: Country[]) => DialCodeProcessingResult;
321
321
  export const sortCountries: (countries: Country[], options: AllOptions) => void;
322
322
  export const cacheSearchTokens: (countries: Country[]) => void;
323
323
  }
@@ -2707,11 +2707,11 @@ var translateCountryNames = (countries, options) => {
2707
2707
  }
2708
2708
  }
2709
2709
  };
2710
- var processDialCodes = (countries, options) => {
2710
+ var processDialCodes = (countries) => {
2711
2711
  const dialCodes = /* @__PURE__ */ new Set();
2712
2712
  let dialCodeMaxLen = 0;
2713
2713
  const dialCodeToIso2Map = {};
2714
- const _addToDialCodeMap = (iso2, dialCode, priority) => {
2714
+ const _addToDialCodeMap = (iso2, dialCode) => {
2715
2715
  if (!iso2 || !dialCode) {
2716
2716
  return;
2717
2717
  }
@@ -2725,10 +2725,10 @@ var processDialCodes = (countries, options) => {
2725
2725
  if (iso2List.includes(iso2)) {
2726
2726
  return;
2727
2727
  }
2728
- const index = priority !== void 0 ? priority : iso2List.length;
2729
- iso2List[index] = iso2;
2728
+ iso2List.push(iso2);
2730
2729
  };
2731
- for (const c of countries) {
2730
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
2731
+ for (const c of countriesSortedByPriority) {
2732
2732
  if (!dialCodes.has(c.dialCode)) {
2733
2733
  dialCodes.add(c.dialCode);
2734
2734
  }
@@ -2736,14 +2736,7 @@ var processDialCodes = (countries, options) => {
2736
2736
  const partialDialCode = c.dialCode.substring(0, k);
2737
2737
  _addToDialCodeMap(c.iso2, partialDialCode);
2738
2738
  }
2739
- _addToDialCodeMap(c.iso2, c.dialCode, c.priority);
2740
- }
2741
- if (options.onlyCountries.length || options.excludeCountries.length) {
2742
- dialCodes.forEach((dialCode) => {
2743
- dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
2744
- });
2745
- }
2746
- for (const c of countries) {
2739
+ _addToDialCodeMap(c.iso2, c.dialCode);
2747
2740
  if (c.areaCodes) {
2748
2741
  const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
2749
2742
  for (const areaCode of c.areaCodes) {
@@ -2878,8 +2871,7 @@ var Iti = class _Iti {
2878
2871
  this.promise = this._createInitPromises();
2879
2872
  this.countries = processAllCountries(this.options);
2880
2873
  const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(
2881
- this.countries,
2882
- this.options
2874
+ this.countries
2883
2875
  );
2884
2876
  this.dialCodes = dialCodes;
2885
2877
  this.dialCodeMaxLen = dialCodeMaxLen;
@@ -4060,7 +4052,7 @@ var intlTelInput = Object.assign(
4060
4052
  attachUtils,
4061
4053
  startedLoadingUtilsScript: false,
4062
4054
  startedLoadingAutoCountry: false,
4063
- version: "25.13.0"
4055
+ version: "25.13.1"
4064
4056
  }
4065
4057
  );
4066
4058
  var intl_tel_input_default = intlTelInput;
@@ -2743,11 +2743,11 @@ var translateCountryNames = (countries, options) => {
2743
2743
  }
2744
2744
  }
2745
2745
  };
2746
- var processDialCodes = (countries, options) => {
2746
+ var processDialCodes = (countries) => {
2747
2747
  const dialCodes = /* @__PURE__ */ new Set();
2748
2748
  let dialCodeMaxLen = 0;
2749
2749
  const dialCodeToIso2Map = {};
2750
- const _addToDialCodeMap = (iso2, dialCode, priority) => {
2750
+ const _addToDialCodeMap = (iso2, dialCode) => {
2751
2751
  if (!iso2 || !dialCode) {
2752
2752
  return;
2753
2753
  }
@@ -2761,10 +2761,10 @@ var processDialCodes = (countries, options) => {
2761
2761
  if (iso2List.includes(iso2)) {
2762
2762
  return;
2763
2763
  }
2764
- const index = priority !== void 0 ? priority : iso2List.length;
2765
- iso2List[index] = iso2;
2764
+ iso2List.push(iso2);
2766
2765
  };
2767
- for (const c of countries) {
2766
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
2767
+ for (const c of countriesSortedByPriority) {
2768
2768
  if (!dialCodes.has(c.dialCode)) {
2769
2769
  dialCodes.add(c.dialCode);
2770
2770
  }
@@ -2772,14 +2772,7 @@ var processDialCodes = (countries, options) => {
2772
2772
  const partialDialCode = c.dialCode.substring(0, k);
2773
2773
  _addToDialCodeMap(c.iso2, partialDialCode);
2774
2774
  }
2775
- _addToDialCodeMap(c.iso2, c.dialCode, c.priority);
2776
- }
2777
- if (options.onlyCountries.length || options.excludeCountries.length) {
2778
- dialCodes.forEach((dialCode) => {
2779
- dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
2780
- });
2781
- }
2782
- for (const c of countries) {
2775
+ _addToDialCodeMap(c.iso2, c.dialCode);
2783
2776
  if (c.areaCodes) {
2784
2777
  const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
2785
2778
  for (const areaCode of c.areaCodes) {
@@ -2914,8 +2907,7 @@ var Iti = class _Iti {
2914
2907
  this.promise = this._createInitPromises();
2915
2908
  this.countries = processAllCountries(this.options);
2916
2909
  const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(
2917
- this.countries,
2918
- this.options
2910
+ this.countries
2919
2911
  );
2920
2912
  this.dialCodes = dialCodes;
2921
2913
  this.dialCodeMaxLen = dialCodeMaxLen;
@@ -4096,7 +4088,7 @@ var intlTelInput = Object.assign(
4096
4088
  attachUtils,
4097
4089
  startedLoadingUtilsScript: false,
4098
4090
  startedLoadingAutoCountry: false,
4099
- version: "25.13.0"
4091
+ version: "25.13.1"
4100
4092
  }
4101
4093
  );
4102
4094
  var intl_tel_input_default = intlTelInput;
@@ -2707,11 +2707,11 @@ var translateCountryNames = (countries, options) => {
2707
2707
  }
2708
2708
  }
2709
2709
  };
2710
- var processDialCodes = (countries, options) => {
2710
+ var processDialCodes = (countries) => {
2711
2711
  const dialCodes = /* @__PURE__ */ new Set();
2712
2712
  let dialCodeMaxLen = 0;
2713
2713
  const dialCodeToIso2Map = {};
2714
- const _addToDialCodeMap = (iso2, dialCode, priority) => {
2714
+ const _addToDialCodeMap = (iso2, dialCode) => {
2715
2715
  if (!iso2 || !dialCode) {
2716
2716
  return;
2717
2717
  }
@@ -2725,10 +2725,10 @@ var processDialCodes = (countries, options) => {
2725
2725
  if (iso2List.includes(iso2)) {
2726
2726
  return;
2727
2727
  }
2728
- const index = priority !== void 0 ? priority : iso2List.length;
2729
- iso2List[index] = iso2;
2728
+ iso2List.push(iso2);
2730
2729
  };
2731
- for (const c of countries) {
2730
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
2731
+ for (const c of countriesSortedByPriority) {
2732
2732
  if (!dialCodes.has(c.dialCode)) {
2733
2733
  dialCodes.add(c.dialCode);
2734
2734
  }
@@ -2736,14 +2736,7 @@ var processDialCodes = (countries, options) => {
2736
2736
  const partialDialCode = c.dialCode.substring(0, k);
2737
2737
  _addToDialCodeMap(c.iso2, partialDialCode);
2738
2738
  }
2739
- _addToDialCodeMap(c.iso2, c.dialCode, c.priority);
2740
- }
2741
- if (options.onlyCountries.length || options.excludeCountries.length) {
2742
- dialCodes.forEach((dialCode) => {
2743
- dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
2744
- });
2745
- }
2746
- for (const c of countries) {
2739
+ _addToDialCodeMap(c.iso2, c.dialCode);
2747
2740
  if (c.areaCodes) {
2748
2741
  const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
2749
2742
  for (const areaCode of c.areaCodes) {
@@ -2878,8 +2871,7 @@ var Iti = class _Iti {
2878
2871
  this.promise = this._createInitPromises();
2879
2872
  this.countries = processAllCountries(this.options);
2880
2873
  const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(
2881
- this.countries,
2882
- this.options
2874
+ this.countries
2883
2875
  );
2884
2876
  this.dialCodes = dialCodes;
2885
2877
  this.dialCodeMaxLen = dialCodeMaxLen;
@@ -4060,7 +4052,7 @@ var intlTelInput = Object.assign(
4060
4052
  attachUtils,
4061
4053
  startedLoadingUtilsScript: false,
4062
4054
  startedLoadingAutoCountry: false,
4063
- version: "25.13.0"
4055
+ version: "25.13.1"
4064
4056
  }
4065
4057
  );
4066
4058
  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.13.0/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.13.1/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.