svelte-tel-input 2.0.1 → 2.1.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# svelte-tel-input
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: US flag is now more representative ([#154](https://github.com/gyurielf/svelte-tel-input/pull/154))
|
|
8
|
+
|
|
9
|
+
## 2.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- feat: support event driven behavior ([#150](https://github.com/gyurielf/svelte-tel-input/pull/150))
|
|
14
|
+
|
|
3
15
|
## 2.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
Binary file
|
|
@@ -101,16 +101,32 @@ const initialize = () => {
|
|
|
101
101
|
onMount(() => {
|
|
102
102
|
initialize();
|
|
103
103
|
});
|
|
104
|
-
let
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
104
|
+
let countryWatchInitRun = true;
|
|
105
|
+
const countryChangeWatchFunction = () => {
|
|
106
|
+
if (!countryWatchInitRun) {
|
|
107
107
|
handleParsePhoneNumber(null, country);
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
countryWatchInitRun = false;
|
|
110
110
|
};
|
|
111
|
-
|
|
111
|
+
let resetValueWatchInitRun = true;
|
|
112
|
+
const resetValueWatchFunction = () => {
|
|
113
|
+
if (!resetValueWatchInitRun) {
|
|
114
|
+
inputValue = "";
|
|
115
|
+
updateCountry(null);
|
|
116
|
+
valid = true;
|
|
117
|
+
parsedTelInput = null;
|
|
118
|
+
dispatch("parseInput", parsedTelInput);
|
|
119
|
+
}
|
|
120
|
+
resetValueWatchInitRun = false;
|
|
121
|
+
};
|
|
122
|
+
const countryChangeWatch = watcher(null, countryChangeWatchFunction);
|
|
112
123
|
$:
|
|
113
124
|
$countryChangeWatch = country;
|
|
125
|
+
const resetValueWatch = watcher(null, resetValueWatchFunction);
|
|
126
|
+
$:
|
|
127
|
+
if (value === null && inputValue !== "") {
|
|
128
|
+
$resetValueWatch = value;
|
|
129
|
+
}
|
|
114
130
|
$:
|
|
115
131
|
getPlaceholder = combinedOptions.autoPlaceholder ? country ? generatePlaceholder(country) : null : placeholder;
|
|
116
132
|
</script>
|
|
@@ -22,9 +22,11 @@ declare const __propDef: {
|
|
|
22
22
|
keypress: KeyboardEvent;
|
|
23
23
|
keyup: KeyboardEvent;
|
|
24
24
|
paste: ClipboardEvent;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
parseInput: CustomEvent<
|
|
25
|
+
country: CustomEvent<CountryCode | null>;
|
|
26
|
+
parseError: CustomEvent<string>;
|
|
27
|
+
parseInput: CustomEvent<NormalizedTelNumber | Partial<NormalizedTelNumber> | null>;
|
|
28
|
+
valid: CustomEvent<boolean>;
|
|
29
|
+
value: CustomEvent<E164Number | null>;
|
|
28
30
|
} & {
|
|
29
31
|
[evt: string]: CustomEvent<any>;
|
|
30
32
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-tel-input",
|
|
3
3
|
"description": "svelte-tel-input",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/gyurielf/svelte-tel-input.git"
|
|
@@ -22,43 +22,43 @@
|
|
|
22
22
|
"pnpm": ">= 7"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"libphonenumber-js": "^1.10.
|
|
25
|
+
"libphonenumber-js": "^1.10.30",
|
|
26
26
|
"svelte": "^3.58.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@changesets/cli": "^2.26.1",
|
|
30
30
|
"@changesets/get-github-info": "^0.5.2",
|
|
31
31
|
"@changesets/types": "^5.2.1",
|
|
32
|
-
"@macfja/svelte-persistent-store": "^2.
|
|
33
|
-
"@playwright/test": "^1.
|
|
32
|
+
"@macfja/svelte-persistent-store": "^2.3.0",
|
|
33
|
+
"@playwright/test": "^1.33.0",
|
|
34
34
|
"@sveltejs/adapter-static": "^2.0.2",
|
|
35
|
-
"@sveltejs/kit": "^1.
|
|
35
|
+
"@sveltejs/kit": "^1.16.3",
|
|
36
36
|
"@sveltejs/package": "^1.0.2",
|
|
37
37
|
"@testing-library/svelte": "^3.2.2",
|
|
38
38
|
"@testing-library/user-event": "^14.4.3",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^5.59.
|
|
40
|
-
"@typescript-eslint/parser": "^5.59.
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
40
|
+
"@typescript-eslint/parser": "^5.59.5",
|
|
41
41
|
"autoprefixer": "^10.4.14",
|
|
42
|
-
"cssnano": "^6.0.
|
|
42
|
+
"cssnano": "^6.0.1",
|
|
43
43
|
"dotenv": "^16.0.3",
|
|
44
44
|
"edit-package-json": "^0.8.12",
|
|
45
|
-
"eslint": "^8.
|
|
45
|
+
"eslint": "^8.40.0",
|
|
46
46
|
"eslint-config-prettier": "^8.8.0",
|
|
47
47
|
"eslint-plugin-svelte3": "^4.0.0",
|
|
48
48
|
"husky": "^8.0.3",
|
|
49
|
-
"jsdom": "^
|
|
49
|
+
"jsdom": "^22.0.0",
|
|
50
50
|
"micromatch": "^4.0.5",
|
|
51
51
|
"postcss": "^8.4.23",
|
|
52
|
-
"prettier": "^2.8.
|
|
52
|
+
"prettier": "^2.8.8",
|
|
53
53
|
"prettier-plugin-svelte": "^2.10.0",
|
|
54
54
|
"schema-dts": "^1.1.2",
|
|
55
|
-
"svelte-check": "^3.
|
|
56
|
-
"svelte2tsx": "^0.6.
|
|
57
|
-
"tailwindcss": "^3.3.
|
|
55
|
+
"svelte-check": "^3.3.1",
|
|
56
|
+
"svelte2tsx": "^0.6.13",
|
|
57
|
+
"tailwindcss": "^3.3.2",
|
|
58
58
|
"tslib": "^2.5.0",
|
|
59
59
|
"typescript": "^5.0.4",
|
|
60
|
-
"vite": "^4.3.
|
|
61
|
-
"vitest": "^0.
|
|
60
|
+
"vite": "^4.3.5",
|
|
61
|
+
"vitest": "^0.31.0"
|
|
62
62
|
},
|
|
63
63
|
"type": "module",
|
|
64
64
|
"license": "MIT",
|
package/types/index.d.ts
CHANGED
|
@@ -67,14 +67,6 @@ export interface TelInputValidity {
|
|
|
67
67
|
errorMessage?: string;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export type TelInputDispatchEvents = {
|
|
71
|
-
country: CountryCode | null;
|
|
72
|
-
parseError: string;
|
|
73
|
-
parseInput: Partial<NormalizedTelNumber> | null;
|
|
74
|
-
valid: boolean;
|
|
75
|
-
value: E164Number | null;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
70
|
export interface TelInputOptions {
|
|
79
71
|
/**
|
|
80
72
|
* It generates a placeholder into your input for the selected country. E.g. if the country is `US`, the placeholder will be `201 555 0123` by default.
|