Skip to content

Commit ccd3436

Browse files
authored
Merge pull request #203 from gyurielf/initial-parse
Fix country update
2 parents e54ee96 + 3a352bd commit ccd3436

File tree

13 files changed

+315
-775
lines changed

13 files changed

+315
-775
lines changed

.changeset/dirty-carpets-rush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte-tel-input': patch
3+
---
4+
5+
fix: country parse happened too early

.changeset/loud-scissors-chew.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte-tel-input': patch
3+
---
4+
5+
chore: update deps

.prettierrc.cjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ module.exports = {
1919
tabWidth: 2
2020
}
2121
}
22-
],
23-
pluginSearchDirs: ['.']
22+
]
2423
};

apps/site/.prettierrc.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ module.exports = {
55
printWidth: 100,
66
tabWidth: 4,
77
plugins: ['prettier-plugin-svelte'],
8-
pluginSearchDirs: ['.'],
98
overrides: [{ files: '*.svelte', options: { parser: 'svelte' } }]
109
};

apps/site/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,25 @@
4545
"@macfja/svelte-persistent-store": "^2.4.0",
4646
"@playwright/test": "^1.37.1",
4747
"@sveltejs/adapter-static": "^2.0.3",
48-
"@sveltejs/kit": "^1.22.6",
48+
"@sveltejs/kit": "^1.23.0",
4949
"@types/micromatch": "^4.0.2",
50-
"@typescript-eslint/eslint-plugin": "^6.4.0",
51-
"@typescript-eslint/parser": "^6.4.0",
50+
"@typescript-eslint/eslint-plugin": "^6.5.0",
51+
"@typescript-eslint/parser": "^6.5.0",
5252
"autoprefixer": "^10.4.15",
5353
"cssnano": "^6.0.1",
5454
"dotenv": "^16.3.1",
55-
"eslint": "^8.47.0",
56-
"eslint-config-prettier": "^8.8.0",
57-
"eslint-plugin-svelte": "^2.32.4",
55+
"eslint": "^8.48.0",
56+
"eslint-config-prettier": "^9.0.0",
57+
"eslint-plugin-svelte": "^2.33.0",
5858
"postcss": "^8.4.28",
59-
"prettier": "^2.8.8",
60-
"prettier-plugin-svelte": "^2.10.1",
59+
"prettier": "^3.0.2",
60+
"prettier-plugin-svelte": "^3.0.3",
6161
"schema-dts": "^1.1.2",
62-
"svelte-check": "^3.5.0",
63-
"svelte2tsx": "^0.6.20",
62+
"svelte-check": "^3.5.1",
63+
"svelte2tsx": "^0.6.21",
6464
"tailwindcss": "^3.3.3",
6565
"tslib": "^2.6.2",
66-
"typescript": "^5.1.6",
66+
"typescript": "^5.2.2",
6767
"vite": "^4.4.9"
6868
},
6969
"type": "module",

apps/site/src/app.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@
4949
"@changesets/cli": "^2.26.2",
5050
"@changesets/get-github-info": "^0.5.2",
5151
"@changesets/types": "^5.2.1",
52-
"@typescript-eslint/eslint-plugin": "^6.2.1",
52+
"@typescript-eslint/eslint-plugin": "^6.5.0",
5353
"dotenv": "^16.3.1",
54-
"eslint": "^8.45.0",
55-
"eslint-plugin-svelte": "^2.32.4",
54+
"eslint": "^8.48.0",
55+
"eslint-plugin-svelte": "^2.33.0",
5656
"eslint-plugin-unicorn": "^48.0.1",
57-
"eslint-config-prettier": "^8.8.0",
57+
"eslint-config-prettier": "^9.0.0",
5858
"husky": "^8.0.3",
59-
"prettier": "^2.8.8",
60-
"prettier-plugin-svelte": "^2.10.1"
59+
"prettier": "^3.0.2",
60+
"prettier-plugin-svelte": "^3.0.3"
6161
},
6262
"type": "module",
6363
"license": "MIT",

packages/svelte-tel-input/.prettierrc.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = {
44
printWidth: 100,
55
tabWidth: 4,
66
plugins: ['prettier-plugin-svelte'],
7-
pluginSearchDirs: ['.'],
87
overrides: [
98
{ files: ['*.svelte'], options: { parser: 'svelte', bracketSameLine: false } },
109
{

packages/svelte-tel-input/README.md

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -40,60 +40,72 @@ _Snippet would be too long_ - [Example](https://github.com/gyurielf/svelte-tel-i
4040

4141
```html
4242
<script lang="ts">
43-
import { TelInput, normalizedCountries } from 'svelte-tel-input';
44-
import type { DetailedValue, CountryCode, E164Number } from 'svelte-tel-input/types';
43+
import { TelInput, normalizedCountries } from 'svelte-tel-input';
44+
import type { DetailedValue, CountryCode, E164Number } from 'svelte-tel-input/types';
4545
46-
// Any Country Code Alpha-2 (ISO 3166)
47-
let selectedCountry: CountryCode | null = 'HU';
46+
// Any Country Code Alpha-2 (ISO 3166)
47+
let selectedCountry: CountryCode | null = 'HU';
4848
49-
// You must use E164 number format. It's guarantee the parsing and storing consistency.
50-
let value: E164Number | null = '+36301234567';
49+
// You must use E164 number format. It's guarantee the parsing and storing consistency.
50+
let value: E164Number | null = '+36301234567';
5151
52-
// Validity
53-
let valid = true;
52+
// Validity
53+
let valid = true;
5454
55-
// Optional - Extended details about the parsed phone number
56-
let detailedValue: DetailedValue | null = null;
55+
// Optional - Extended details about the parsed phone number
56+
let detailedValue: DetailedValue | null = null;
5757
</script>
5858

5959
<div class="wrapper">
60-
<select
61-
class="country-select {!valid && 'invalid'}"
62-
aria-label="Default select example"
63-
name="Country"
64-
bind:value={selectedCountry}
65-
>
66-
<option value={null} hidden={selectedCountry !== null}>Please select</option>
67-
{#each normalizedCountries as country (country.id)}
68-
<option
69-
value={country.iso2}
70-
selected={country.iso2 === selectedCountry}
71-
aria-selected={country.iso2 === selectedCountry}
72-
>
73-
{country.iso2} (+{country.dialCode})
74-
</option>
75-
{/each}
76-
</select>
77-
<TelInput bind:country={selectedCountry} bind:value bind:valid bind:detailedValue class="basic-tel-input {!isValid && 'invalid'}" />
60+
<select
61+
class="country-select {!valid && 'invalid'}"
62+
aria-label="Default select example"
63+
name="Country"
64+
bind:value="{selectedCountry}"
65+
>
66+
<option value="{null}" hidden="{selectedCountry" !="" ="null}">Please select</option>
67+
{#each normalizedCountries as country (country.id)}
68+
<option
69+
value="{country.iso2}"
70+
selected="{country.iso2"
71+
=""
72+
=""
73+
="selectedCountry}"
74+
aria-selected="{country.iso2"
75+
=""
76+
=""
77+
="selectedCountry}"
78+
>
79+
{country.iso2} (+{country.dialCode})
80+
</option>
81+
{/each}
82+
</select>
83+
<TelInput
84+
bind:country="{selectedCountry}"
85+
bind:value
86+
bind:valid
87+
bind:detailedValue
88+
class="basic-tel-input {!isValid && 'invalid'}"
89+
/>
7890
</div>
7991

8092
<style>
8193
.wrapper :global(.basic-tel-input) {
82-
height: 32px;
83-
padding-left: 12px;
84-
padding-right: 12px;
85-
border-radius: 6px;
86-
border: 1px solid;
87-
outline: none;
94+
height: 32px;
95+
padding-left: 12px;
96+
padding-right: 12px;
97+
border-radius: 6px;
98+
border: 1px solid;
99+
outline: none;
88100
}
89101
90102
.wrapper :global(.country-select) {
91-
height: 36px;
92-
padding-left: 12px;
93-
padding-right: 12px;
94-
border-radius: 6px;
95-
border: 1px solid;
96-
outline: none;
103+
height: 36px;
104+
padding-left: 12px;
105+
padding-right: 12px;
106+
border-radius: 6px;
107+
border: 1px solid;
108+
outline: none;
97109
}
98110
99111
.wrapper :global(.invalid) {

packages/svelte-tel-input/package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,38 @@
4646
"svelte": "^3.58.0 || ^4.0.0"
4747
},
4848
"dependencies": {
49-
"libphonenumber-js": "^1.10.41"
49+
"libphonenumber-js": "^1.10.43"
5050
},
5151
"devDependencies": {
5252
"@sveltejs/adapter-auto": "2.1.0",
53-
"@sveltejs/kit": "^1.22.6",
54-
"@sveltejs/package": "^2.2.1",
53+
"@sveltejs/kit": "^1.23.0",
54+
"@sveltejs/package": "^2.2.2",
5555
"@testing-library/svelte": "^4.0.3",
5656
"@testing-library/user-event": "^14.4.3",
5757
"@types/micromatch": "^4.0.2",
58-
"@typescript-eslint/eslint-plugin": "^6.4.0",
59-
"@typescript-eslint/parser": "^6.4.0",
58+
"@typescript-eslint/eslint-plugin": "^6.5.0",
59+
"@typescript-eslint/parser": "^6.5.0",
6060
"autoprefixer": "^10.4.15",
6161
"cssnano": "^6.0.1",
6262
"dotenv": "^16.3.1",
63-
"eslint": "^8.47.0",
64-
"eslint-config-prettier": "^8.8.0",
63+
"eslint": "^8.48.0",
64+
"eslint-config-prettier": "^9.0.0",
6565
"eslint-plugin-import": "^2.28.1",
66-
"eslint-plugin-svelte": "^2.32.4",
66+
"eslint-plugin-svelte": "^2.33.0",
6767
"jsdom": "^22.1.0",
6868
"micromatch": "^4.0.5",
6969
"postcss": "^8.4.28",
70-
"prettier": "^2.8.8",
71-
"prettier-plugin-svelte": "^2.10.1",
70+
"prettier": "^3.0.2",
71+
"prettier-plugin-svelte": "^3.0.3",
7272
"publint": "^0.2.2",
73-
"svelte": "^3.58.0",
74-
"svelte-check": "^3.5.0",
75-
"svelte2tsx": "^0.6.20",
73+
"svelte": "^4.2.0",
74+
"svelte-check": "^3.5.1",
75+
"svelte2tsx": "^0.6.21",
7676
"tailwindcss": "^3.3.3",
7777
"tslib": "^2.6.2",
78-
"typescript": "^5.1.6",
78+
"typescript": "^5.2.2",
7979
"vite": "^4.4.9",
80-
"vitest": "^0.34.2"
80+
"vitest": "^0.34.3"
8181
},
8282
"type": "module",
8383
"license": "MIT",

0 commit comments

Comments
 (0)