@intl-tel-input/react 29.5.8 → 29.5.10

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.
@@ -4529,33 +4529,23 @@ var Iti = class _Iti {
4529
4529
  }
4530
4530
  //* Update the maximum valid number length for the currently selected country.
4531
4531
  #updateMaxCoreNumberLength() {
4532
- const { strictMode, placeholderNumberType, allowedNumberTypes } = this.#options;
4532
+ const { strictMode, allowedNumberTypes } = this.#options;
4533
4533
  if (!strictMode || !intlTelInput.utils) {
4534
4534
  return;
4535
4535
  }
4536
- const iso2 = this.#selectedCountry?.iso2;
4537
- if (!iso2) {
4536
+ if (!this.#selectedCountry) {
4538
4537
  this.#maxCoreNumberLength = null;
4539
4538
  return;
4540
4539
  }
4541
- let exampleNumber = intlTelInput.utils.getExampleNumber(
4542
- iso2,
4543
- placeholderNumberType,
4544
- NUMBER_FORMAT.E164
4545
- );
4546
- let validNumber = exampleNumber;
4547
- while (intlTelInput.utils.isValidNumber(
4548
- exampleNumber,
4549
- iso2,
4550
- allowedNumberTypes
4551
- )) {
4552
- validNumber = exampleNumber;
4553
- exampleNumber += "0";
4540
+ const { iso2, dialCode } = this.#selectedCountry;
4541
+ let number = `+${dialCode}${"9".repeat(E164_MAX_DIGITS)}`;
4542
+ while (number.length > dialCode.length + 1 && !intlTelInput.utils.isValidNumber(number, iso2, allowedNumberTypes)) {
4543
+ number = number.slice(0, -1);
4554
4544
  }
4555
- const coreNumber = intlTelInput.utils.getCoreNumber(validNumber, iso2);
4556
- this.#maxCoreNumberLength = coreNumber.length;
4557
- if (iso2 === "by") {
4558
- this.#maxCoreNumberLength = coreNumber.length + 1;
4545
+ const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
4546
+ this.#maxCoreNumberLength = coreNumber.length || null;
4547
+ if (iso2 === "by" && this.#maxCoreNumberLength) {
4548
+ this.#maxCoreNumberLength += 1;
4559
4549
  }
4560
4550
  }
4561
4551
  //* Update the input placeholder to an example number from the currently selected country.
@@ -5014,7 +5004,7 @@ var intlTelInput = Object.assign(
5014
5004
  attachUtils,
5015
5005
  startedLoadingUtils: false,
5016
5006
  startedLoadingAutoCountry: false,
5017
- version: "29.5.8",
5007
+ version: "29.5.10",
5018
5008
  NUMBER_FORMAT,
5019
5009
  NUMBER_TYPE,
5020
5010
  VALIDATION_ERROR,
@@ -4529,33 +4529,23 @@ var Iti = class _Iti {
4529
4529
  }
4530
4530
  //* Update the maximum valid number length for the currently selected country.
4531
4531
  #updateMaxCoreNumberLength() {
4532
- const { strictMode, placeholderNumberType, allowedNumberTypes } = this.#options;
4532
+ const { strictMode, allowedNumberTypes } = this.#options;
4533
4533
  if (!strictMode || !intlTelInput.utils) {
4534
4534
  return;
4535
4535
  }
4536
- const iso2 = this.#selectedCountry?.iso2;
4537
- if (!iso2) {
4536
+ if (!this.#selectedCountry) {
4538
4537
  this.#maxCoreNumberLength = null;
4539
4538
  return;
4540
4539
  }
4541
- let exampleNumber = intlTelInput.utils.getExampleNumber(
4542
- iso2,
4543
- placeholderNumberType,
4544
- NUMBER_FORMAT.E164
4545
- );
4546
- let validNumber = exampleNumber;
4547
- while (intlTelInput.utils.isValidNumber(
4548
- exampleNumber,
4549
- iso2,
4550
- allowedNumberTypes
4551
- )) {
4552
- validNumber = exampleNumber;
4553
- exampleNumber += "0";
4540
+ const { iso2, dialCode } = this.#selectedCountry;
4541
+ let number = `+${dialCode}${"9".repeat(E164_MAX_DIGITS)}`;
4542
+ while (number.length > dialCode.length + 1 && !intlTelInput.utils.isValidNumber(number, iso2, allowedNumberTypes)) {
4543
+ number = number.slice(0, -1);
4554
4544
  }
4555
- const coreNumber = intlTelInput.utils.getCoreNumber(validNumber, iso2);
4556
- this.#maxCoreNumberLength = coreNumber.length;
4557
- if (iso2 === "by") {
4558
- this.#maxCoreNumberLength = coreNumber.length + 1;
4545
+ const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
4546
+ this.#maxCoreNumberLength = coreNumber.length || null;
4547
+ if (iso2 === "by" && this.#maxCoreNumberLength) {
4548
+ this.#maxCoreNumberLength += 1;
4559
4549
  }
4560
4550
  }
4561
4551
  //* Update the input placeholder to an example number from the currently selected country.
@@ -5014,7 +5004,7 @@ var intlTelInput = Object.assign(
5014
5004
  attachUtils,
5015
5005
  startedLoadingUtils: false,
5016
5006
  startedLoadingAutoCountry: false,
5017
- version: "29.5.8",
5007
+ version: "29.5.10",
5018
5008
  NUMBER_FORMAT,
5019
5009
  NUMBER_TYPE,
5020
5010
  VALIDATION_ERROR,
@@ -11480,8 +11470,8 @@ var _scope = {};
11480
11470
  });
11481
11471
  m("utils.getCoreNumber", (a, b) => {
11482
11472
  try {
11483
- var c = X(J.g(), a, b);
11484
- return r(c, 2).toString();
11473
+ const c = J.g(), d = X(c, a, b);
11474
+ return P(d);
11485
11475
  } catch {
11486
11476
  return "";
11487
11477
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intl-tel-input/react",
3
- "version": "29.5.8",
3
+ "version": "29.5.10",
4
4
  "description": "A React component for intl-tel-input, for entering, formatting, and validating international telephone numbers",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "README.md"
35
35
  ],
36
36
  "dependencies": {
37
- "intl-tel-input": "^29.5.8"
37
+ "intl-tel-input": "^29.5.10"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": ">=18",