intl-tel-input 27.3.1 → 28.0.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.
Files changed (37) hide show
  1. package/dist/css/intlTelInput-no-assets.css +2 -2
  2. package/dist/css/intlTelInput.css +3 -3
  3. package/dist/js/data.js +2 -2
  4. package/dist/js/data.min.js +1 -1
  5. package/dist/js/data.mjs +1 -1
  6. package/dist/js/i18n.d.ts +1 -1592
  7. package/dist/js/intlTelInput.d.ts +61 -45
  8. package/dist/js/intlTelInput.js +109 -104
  9. package/dist/js/intlTelInput.min.js +6 -6
  10. package/dist/js/intlTelInput.mjs +107 -102
  11. package/dist/js/intlTelInputWithUtils.js +510 -490
  12. package/dist/js/intlTelInputWithUtils.min.js +9 -9
  13. package/dist/js/intlTelInputWithUtils.mjs +508 -488
  14. package/dist/js/utils.js +56 -55
  15. package/package.json +14 -181
  16. package/CHANGELOG.md +0 -33
  17. package/angular/README.md +0 -13
  18. package/angular/dist/IntlTelInput.d.ts +0 -110
  19. package/angular/dist/IntlTelInput.js +0 -5130
  20. package/angular/dist/IntlTelInputWithUtils.d.ts +0 -3
  21. package/angular/dist/IntlTelInputWithUtils.js +0 -11469
  22. package/react/README.md +0 -13
  23. package/react/dist/IntlTelInput.d.ts +0 -25
  24. package/react/dist/IntlTelInput.js +0 -4822
  25. package/react/dist/IntlTelInputWithUtils.d.ts +0 -4
  26. package/react/dist/IntlTelInputWithUtils.js +0 -11161
  27. package/svelte/README.md +0 -14
  28. package/svelte/src/IntlTelInput.svelte +0 -233
  29. package/svelte/src/IntlTelInput.svelte.d.ts +0 -36
  30. package/svelte/src/IntlTelInputWithUtils.svelte +0 -24
  31. package/vue/README.md +0 -14
  32. package/vue/dist/IntlTelInput-DWpqqgvZ.js +0 -2684
  33. package/vue/dist/IntlTelInput.js +0 -5
  34. package/vue/dist/IntlTelInput.vue.d.ts +0 -43
  35. package/vue/dist/IntlTelInputWithUtils.js +0 -49403
  36. package/vue/dist/index.d.ts +0 -4
  37. package/vue/dist/indexWithUtils.d.ts +0 -3
@@ -1599,7 +1599,7 @@ export type Country = {
1599
1599
  areaCodes: readonly string[] | null;
1600
1600
  nationalPrefix: string | null;
1601
1601
  };
1602
- export type I18n = Partial<Record<Iso2, string>> & {
1602
+ export type I18n = {
1603
1603
  selectedCountryAriaLabel?: string;
1604
1604
  searchPlaceholder?: string;
1605
1605
  clearSearchAriaLabel?: string;
@@ -1613,6 +1613,12 @@ declare const PLACEHOLDER_MODES: {
1613
1613
  readonly POLITE: "polite";
1614
1614
  readonly OFF: "off";
1615
1615
  };
1616
+ declare const NUMBER_FORMATS: readonly [
1617
+ "E164",
1618
+ "INTERNATIONAL",
1619
+ "NATIONAL",
1620
+ "RFC3966"
1621
+ ];
1616
1622
  declare const NUMBER_TYPES: readonly [
1617
1623
  "FIXED_LINE",
1618
1624
  "MOBILE",
@@ -1627,54 +1633,60 @@ declare const NUMBER_TYPES: readonly [
1627
1633
  "VOICEMAIL",
1628
1634
  "UNKNOWN"
1629
1635
  ];
1630
- declare const NUMBER_TYPE_SET: ReadonlySet<(typeof NUMBER_TYPES)[number]> & {
1631
- has(value: string): boolean;
1632
- };
1636
+ declare const VALIDATION_ERRORS: readonly [
1637
+ "IS_POSSIBLE",
1638
+ "INVALID_COUNTRY_CODE",
1639
+ "TOO_SHORT",
1640
+ "TOO_LONG",
1641
+ "IS_POSSIBLE_LOCAL_ONLY",
1642
+ "INVALID_LENGTH"
1643
+ ];
1644
+ export declare const NUMBER_FORMAT: Readonly<{
1645
+ E164: "E164";
1646
+ INTERNATIONAL: "INTERNATIONAL";
1647
+ NATIONAL: "NATIONAL";
1648
+ RFC3966: "RFC3966";
1649
+ }>;
1650
+ export declare const NUMBER_TYPE: Readonly<{
1651
+ FIXED_LINE: "FIXED_LINE";
1652
+ MOBILE: "MOBILE";
1653
+ FIXED_LINE_OR_MOBILE: "FIXED_LINE_OR_MOBILE";
1654
+ TOLL_FREE: "TOLL_FREE";
1655
+ PREMIUM_RATE: "PREMIUM_RATE";
1656
+ SHARED_COST: "SHARED_COST";
1657
+ VOIP: "VOIP";
1658
+ PERSONAL_NUMBER: "PERSONAL_NUMBER";
1659
+ PAGER: "PAGER";
1660
+ UAN: "UAN";
1661
+ VOICEMAIL: "VOICEMAIL";
1662
+ UNKNOWN: "UNKNOWN";
1663
+ }>;
1664
+ export declare const VALIDATION_ERROR: Readonly<{
1665
+ IS_POSSIBLE: "IS_POSSIBLE";
1666
+ INVALID_COUNTRY_CODE: "INVALID_COUNTRY_CODE";
1667
+ TOO_SHORT: "TOO_SHORT";
1668
+ TOO_LONG: "TOO_LONG";
1669
+ IS_POSSIBLE_LOCAL_ONLY: "IS_POSSIBLE_LOCAL_ONLY";
1670
+ INVALID_LENGTH: "INVALID_LENGTH";
1671
+ }>;
1633
1672
  export type UtilsLoader = () => Promise<{
1634
1673
  default: ItiUtils;
1635
1674
  }>;
1636
1675
  export type ItiUtils = {
1637
- formatNumber(number: string, iso2: string | undefined, format?: number): string;
1676
+ formatNumber(number: string, iso2: string | undefined, format?: NumberFormat): string;
1638
1677
  formatNumberAsYouType(number: string, iso2: string | undefined): string;
1639
1678
  getCoreNumber(number: string, iso2: string | undefined): string;
1640
- getExampleNumber(iso2: string | undefined, nationalMode: boolean, numberType: number, useE164?: boolean): string;
1679
+ getExampleNumber(iso2: string | undefined, nationalMode: boolean, numberType: NumberType, useE164?: boolean): string;
1641
1680
  getExtension(number: string, iso2: string | undefined): string;
1642
- getNumberType(number: string, iso2: string | undefined): number;
1643
- getValidationError(number: string, iso2: string | undefined): number;
1681
+ getNumberType(number: string, iso2: string | undefined): NumberType | null;
1682
+ getValidationError(number: string, iso2: string | undefined): ValidationError | null;
1644
1683
  isPossibleNumber(number: string, iso2: string | undefined, numberType?: NumberType[] | null): boolean;
1645
1684
  isValidNumber(number: string, iso2: string | undefined, numberType?: NumberType[] | null): boolean;
1646
- numberFormat: {
1647
- NATIONAL: number;
1648
- INTERNATIONAL: number;
1649
- E164: number;
1650
- RFC3966: number;
1651
- };
1652
- numberType: {
1653
- [key: string]: number;
1654
- FIXED_LINE: number;
1655
- MOBILE: number;
1656
- FIXED_LINE_OR_MOBILE: number;
1657
- TOLL_FREE: number;
1658
- PREMIUM_RATE: number;
1659
- SHARED_COST: number;
1660
- VOIP: number;
1661
- PERSONAL_NUMBER: number;
1662
- PAGER: number;
1663
- UAN: number;
1664
- VOICEMAIL: number;
1665
- UNKNOWN: number;
1666
- };
1667
- validationError: {
1668
- IS_POSSIBLE: number;
1669
- INVALID_COUNTRY_CODE: number;
1670
- TOO_SHORT: number;
1671
- TOO_LONG: number;
1672
- IS_POSSIBLE_LOCAL_ONLY: number;
1673
- INVALID_LENGTH: number;
1674
- };
1675
1685
  };
1676
- export type SetValues<T> = T extends ReadonlySet<infer U> ? U : never;
1677
- export type NumberType = SetValues<typeof NUMBER_TYPE_SET>;
1686
+ export type ArrayValues<T extends readonly unknown[]> = T[number];
1687
+ export type NumberFormat = ArrayValues<typeof NUMBER_FORMATS>;
1688
+ export type NumberType = ArrayValues<typeof NUMBER_TYPES>;
1689
+ export type ValidationError = ArrayValues<typeof VALIDATION_ERRORS>;
1678
1690
  export type ValueOf<T> = T[keyof T];
1679
1691
  export interface AllOptions {
1680
1692
  allowDropdown: boolean;
@@ -1684,6 +1696,7 @@ export interface AllOptions {
1684
1696
  autoPlaceholder: ValueOf<typeof PLACEHOLDER_MODES>;
1685
1697
  containerClass: string;
1686
1698
  countryNameLocale: string;
1699
+ countryNameOverrides: Partial<Record<Iso2, string>>;
1687
1700
  countryOrder: Iso2[] | null;
1688
1701
  countrySearch: boolean;
1689
1702
  customPlaceholder: ((selectedCountryPlaceholder: string, selectedCountryData: SelectedCountryData) => string) | null;
@@ -1693,7 +1706,7 @@ export interface AllOptions {
1693
1706
  fixDropdownWidth: boolean;
1694
1707
  formatAsYouType: boolean;
1695
1708
  formatOnDisplay: boolean;
1696
- geoIpLookup: ((success: (iso2: Iso2) => void, failure: () => void) => void) | null;
1709
+ geoIpLookup: (() => Promise<Iso2>) | null;
1697
1710
  hiddenInput: ((telInputName: string) => {
1698
1711
  phone: string;
1699
1712
  country?: string;
@@ -1712,7 +1725,7 @@ export interface AllOptions {
1712
1725
  useFullscreenPopup: boolean;
1713
1726
  }
1714
1727
  export type SomeOptions = Partial<AllOptions>;
1715
- export type SelectedCountryData = Pick<Country, "iso2" | "dialCode" | "name"> | null;
1728
+ export type SelectedCountryData = Country | null;
1716
1729
  export type ForEachInstanceArgsMap = {
1717
1730
  handleUtilsLoaded: [
1718
1731
  ];
@@ -1732,10 +1745,10 @@ export declare class Iti {
1732
1745
  destroy(): void;
1733
1746
  isActive(): boolean;
1734
1747
  getExtension(): string;
1735
- getNumber(format?: number): string;
1736
- getNumberType(): number;
1748
+ getNumber(format?: NumberFormat): string;
1749
+ getNumberType(): NumberType | null;
1737
1750
  getSelectedCountryData(): SelectedCountryData;
1738
- getValidationError(): number;
1751
+ getValidationError(): ValidationError | null;
1739
1752
  isValidNumber(): boolean | null;
1740
1753
  isValidNumberPrecise(): boolean | null;
1741
1754
  setCountry(iso2: Iso2): void;
@@ -1753,11 +1766,14 @@ export interface IntlTelInputInterface {
1753
1766
  getCountryData: () => Country[];
1754
1767
  getInstance: (input: HTMLInputElement) => Iti | null;
1755
1768
  instances: Map<string, Iti>;
1756
- attachUtils: (source: UtilsLoader) => Promise<unknown> | null;
1769
+ attachUtils: (source: UtilsLoader) => Promise<boolean | null>;
1757
1770
  startedLoadingAutoCountry: boolean;
1758
1771
  startedLoadingUtils: boolean;
1759
1772
  version: string | undefined;
1760
1773
  utils?: ItiUtils;
1774
+ NUMBER_FORMAT: typeof NUMBER_FORMAT;
1775
+ NUMBER_TYPE: typeof NUMBER_TYPE;
1776
+ VALIDATION_ERROR: typeof VALIDATION_ERROR;
1761
1777
  }
1762
1778
  declare const intlTelInput: IntlTelInputInterface;
1763
1779