Skip to content

Commit a23eab5

Browse files
authored
feature: rewrite to Composition API (#446)
1 parent 734646e commit a23eab5

11 files changed

+1106
-943
lines changed

docs/others/v3.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ Read more on `vue-form-generator`'s [instruction page](https://icebob.gitbooks.i
135135
| ----- | --------- | ----------- | ----- |
136136
| `input` | `String`, `Object` | Fires when the input changes with the argument is the object includes `{ number, isValid, country }` | `onInput` deprecated |
137137
| `validate` | `Object` | Fires when the correctness of the phone number changes (from `true` to `false` or vice-versa) and when the component is mounted `{ number, isValid, country }` | `onValidate` deprecated |
138-
| `blur` | | Fires on blur event | `onBlur` deprecated |
139-
| `focus` | | Fires on focus event | |
140-
| `space` | | Fires on keyup.space event | `onSpace` deprecated |
141-
| `enter` | | Fires on keyup.enter event | `onEnter` deprecated |
138+
| `blur` | `FocusEvent` | Fires on blur event | `onBlur` deprecated |
139+
| `focus` | `FocusEvent` | Fires on focus event | |
140+
| `space` | `KeyboardEvent` | Fires on keyup.space event | `onSpace` deprecated |
141+
| `enter` | `KeyboardEvent` | Fires on keyup.enter event | `onEnter` deprecated |
142142
| `open` | | Fires when the flags dropdown opens | |
143143
| `close` | | Fires when the flags dropdown closes | |
144144
| `country-changed` | `Object` | Fires when country changed (even for the first time) | Available from [v2.4.2](https://github.com/iamstevendao/vue-tel-input/releases/tag/v2.4.2) |

package-lock.json

+152-178
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"module": "./dist/vue-tel-input.js",
2222
"scripts": {
2323
"dev": "vitepress dev docs",
24+
"test": "vitest --ui",
2425
"build": "vue-tsc && vite build",
2526
"preview": "vite preview",
2627
"docs:dev": "vitepress dev docs",
@@ -29,17 +30,21 @@
2930
},
3031
"dependencies": {
3132
"libphonenumber-js": "^1.10.51",
32-
"vue": "^3.3.9"
33+
"vue": "^3.4.21"
3334
},
3435
"files": [
3536
"dist"
3637
],
3738
"devDependencies": {
38-
"@vitejs/plugin-vue": "^4.5.0",
39+
"@vitejs/plugin-vue": "^5.0.4",
40+
"@vitest/ui": "^1.4.0",
41+
"@vue/test-utils": "^2.4.5",
42+
"jsdom": "^24.0.0",
3943
"typescript": "^5.3.2",
4044
"vite": "^5.0.2",
4145
"vitepress": "^1.0.0-rc.31",
42-
"vue-tsc": "^1.8.22"
46+
"vitest": "^1.4.0",
47+
"vue-tsc": "^2.0.6"
4348
},
4449
"keywords": [
4550
"vue",

src/assets/all-countries.js renamed to src/assets/all-countries.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// A fork of https://github.com/jackocnr/intl-tel-input/blob/master/src/js/data.js
22

3+
import type { Country, CountryObject } from "../types";
4+
5+
36
// Array of country objects for the flag dropdown.
47

58
// Here is the criteria for the plugin to support a given country/territory
@@ -16,7 +19,8 @@
1619
// Order (if >1 country with same dial code),
1720
// Area codes
1821
// ]
19-
const allCountries = [
22+
23+
const allCountries: Country[] = [
2024
[
2125
'Afghanistan (‫افغانستان‬‎)',
2226
'af',
@@ -1330,4 +1334,4 @@ export default allCountries.map(([name, iso2, dialCode, priority = 0, areaCodes
13301334
dialCode,
13311335
priority,
13321336
areaCodes,
1333-
}));
1337+
})) as CountryObject[];

src/components/vue-tel-input.test.js

-261
This file was deleted.

0 commit comments

Comments
 (0)