lite-phone-input 0.2.0 → 0.4.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.
@@ -10,6 +10,8 @@ interface Country {
10
10
  minLength: number;
11
11
  maxLength: number;
12
12
  priority: number;
13
+ displayNationalPrefix: boolean;
14
+ exampleNumber: string | null;
13
15
  }
14
16
  interface ValidationResult {
15
17
  valid: boolean;
@@ -27,6 +29,7 @@ interface PhoneInputOptions {
27
29
  formatAsYouType?: boolean;
28
30
  strict?: boolean;
29
31
  separateDialCode?: boolean;
32
+ nationalMode?: boolean;
30
33
  placeholder?: string | 'auto';
31
34
  disabled?: boolean;
32
35
  locale?: string;
@@ -39,6 +42,7 @@ interface PhoneInputOptions {
39
42
  initialValue?: string;
40
43
  containerClass?: string;
41
44
  dropdownContainer?: HTMLElement;
45
+ geoIpLookup?: (callback: (countryCode: string | null) => void) => void;
42
46
  onChange?: (e164: string, country: Country, validation: ValidationResult) => void;
43
47
  onCountryChange?: (country: Country) => void;
44
48
  onValidationChange?: (validation: ValidationResult) => void;
@@ -53,6 +57,8 @@ declare class PhoneInput {
53
57
  private selectedCountry;
54
58
  private nationalDigits;
55
59
  private displayInternational;
60
+ private userHasInteracted;
61
+ private get isNationalInput();
56
62
  private lastValidation;
57
63
  private dropdown;
58
64
  private ac;
@@ -79,6 +85,7 @@ declare class PhoneInput {
79
85
  validate(): ValidationResult;
80
86
  setOptions(opts: Partial<PhoneInputOptions>): void;
81
87
  destroy(): void;
88
+ private invokeGeoIpLookup;
82
89
  private buildDOM;
83
90
  private buildTrigger;
84
91
  private rebuildTrigger;
@@ -94,6 +101,10 @@ declare class PhoneInput {
94
101
  private extractNationalFromFull;
95
102
  private stripNationalPrefix;
96
103
  private formatNationalValue;
104
+ /** Returns true if national prefix should be prepended to display in nationalMode */
105
+ private get shouldPrependPrefix();
106
+ private formatNationalDisplay;
107
+ private getNationalCursor;
97
108
  private formatFullValue;
98
109
  private updateFlag;
99
110
  private updateDialCodeDisplay;
@@ -10,6 +10,8 @@ interface Country {
10
10
  minLength: number;
11
11
  maxLength: number;
12
12
  priority: number;
13
+ displayNationalPrefix: boolean;
14
+ exampleNumber: string | null;
13
15
  }
14
16
  interface ValidationResult {
15
17
  valid: boolean;
@@ -27,6 +29,7 @@ interface PhoneInputOptions {
27
29
  formatAsYouType?: boolean;
28
30
  strict?: boolean;
29
31
  separateDialCode?: boolean;
32
+ nationalMode?: boolean;
30
33
  placeholder?: string | 'auto';
31
34
  disabled?: boolean;
32
35
  locale?: string;
@@ -39,6 +42,7 @@ interface PhoneInputOptions {
39
42
  initialValue?: string;
40
43
  containerClass?: string;
41
44
  dropdownContainer?: HTMLElement;
45
+ geoIpLookup?: (callback: (countryCode: string | null) => void) => void;
42
46
  onChange?: (e164: string, country: Country, validation: ValidationResult) => void;
43
47
  onCountryChange?: (country: Country) => void;
44
48
  onValidationChange?: (validation: ValidationResult) => void;
@@ -53,6 +57,8 @@ declare class PhoneInput {
53
57
  private selectedCountry;
54
58
  private nationalDigits;
55
59
  private displayInternational;
60
+ private userHasInteracted;
61
+ private get isNationalInput();
56
62
  private lastValidation;
57
63
  private dropdown;
58
64
  private ac;
@@ -79,6 +85,7 @@ declare class PhoneInput {
79
85
  validate(): ValidationResult;
80
86
  setOptions(opts: Partial<PhoneInputOptions>): void;
81
87
  destroy(): void;
88
+ private invokeGeoIpLookup;
82
89
  private buildDOM;
83
90
  private buildTrigger;
84
91
  private rebuildTrigger;
@@ -94,6 +101,10 @@ declare class PhoneInput {
94
101
  private extractNationalFromFull;
95
102
  private stripNationalPrefix;
96
103
  private formatNationalValue;
104
+ /** Returns true if national prefix should be prepended to display in nationalMode */
105
+ private get shouldPrependPrefix();
106
+ private formatNationalDisplay;
107
+ private getNationalCursor;
97
108
  private formatFullValue;
98
109
  private updateFlag;
99
110
  private updateDialCodeDisplay;