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.
- package/README.md +30 -0
- package/data/phone-countries.json +595 -245
- package/dist/core/index.cjs +598 -246
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +8 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.js +598 -246
- package/dist/core/index.js.map +1 -1
- package/dist/preact/index.cjs +678 -265
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.d.cts +4 -0
- package/dist/preact/index.d.ts +4 -0
- package/dist/preact/index.js +678 -265
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +678 -265
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +4 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.js +678 -265
- package/dist/react/index.js.map +1 -1
- package/dist/vanilla/index.cjs +673 -265
- package/dist/vanilla/index.cjs.map +1 -1
- package/dist/vanilla/index.d.cts +11 -0
- package/dist/vanilla/index.d.ts +11 -0
- package/dist/vanilla/index.global.js +673 -265
- package/dist/vanilla/index.global.js.map +1 -1
- package/dist/vanilla/index.js +673 -265
- package/dist/vanilla/index.js.map +1 -1
- package/package.json +1 -1
package/dist/vanilla/index.d.cts
CHANGED
|
@@ -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;
|
package/dist/vanilla/index.d.ts
CHANGED
|
@@ -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;
|