svelte-tel-input 3.5.0 → 3.5.2

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 CHANGED
@@ -63,12 +63,12 @@ _Snippet would be too long_ - [Example](https://github.com/gyurielf/svelte-tel-i
63
63
  name="Country"
64
64
  bind:value={selectedCountry}
65
65
  >
66
- <option value={null} hidden={country !== null}>Please select</option>
66
+ <option value={null} hidden={selectedCountry !== null}>Please select</option>
67
67
  {#each normalizedCountries as currentCountry (currentCountry.id)}
68
68
  <option
69
69
  value={currentCountry.iso2}
70
- selected={currentCountry.iso2 === country}
71
- aria-selected={currentCountry.iso2 === country}
70
+ selected={currentCountry.iso2 === selectedCountry}
71
+ aria-selected={currentCountry.iso2 === selectedCountry}
72
72
  >
73
73
  {currentCountry.iso2} (+{currentCountry.dialCode})
74
74
  </option>
@@ -79,7 +79,7 @@ _Snippet would be too long_ - [Example](https://github.com/gyurielf/svelte-tel-i
79
79
  bind:value
80
80
  bind:valid
81
81
  bind:detailedValue
82
- class="basic-tel-input {!isValid ? 'invalid' : ''}"
82
+ class="basic-tel-input {!valid ? 'invalid' : ''}"
83
83
  />
84
84
  </div>
85
85
 
@@ -6,7 +6,6 @@ import {
6
6
  generatePlaceholder,
7
7
  telInputAction
8
8
  } from "../../utils/index.js";
9
- import { watcher } from "../../stores/index.js";
10
9
  const dispatch = createEventDispatcher();
11
10
  const defaultOptions = {
12
11
  autoPlaceholder: true,
@@ -25,7 +24,7 @@ export let readonly = null;
25
24
  export let required = null;
26
25
  export let size = null;
27
26
  export let value;
28
- export let country;
27
+ export let country = void 0;
29
28
  export let detailedValue = null;
30
29
  export let valid = true;
31
30
  export let options = defaultOptions;
@@ -104,14 +103,13 @@ const handleParsePhoneNumber = (rawInput, currCountry = null) => {
104
103
  }
105
104
  };
106
105
  let countryWatchInitRun = true;
107
- const countryChangeWatchFunction = () => {
106
+ const countryChangeWatchFunction = (current) => {
108
107
  if (!countryWatchInitRun) {
109
- handleParsePhoneNumber(null, country);
108
+ handleParsePhoneNumber(null, current);
110
109
  }
111
110
  countryWatchInitRun = false;
112
111
  };
113
- const countryChangeWatch = watcher(null, countryChangeWatchFunction);
114
- $: $countryChangeWatch = country;
112
+ $: countryChangeWatchFunction(country);
115
113
  $: getPlaceholder = combinedOptions.autoPlaceholder && country ? generatePlaceholder(country, {
116
114
  format: combinedOptions.format,
117
115
  spaces: combinedOptions.spaces
@@ -13,7 +13,7 @@ declare const __propDef: {
13
13
  required?: boolean | null;
14
14
  size?: number | null;
15
15
  value: E164Number | null;
16
- country: CountryCode | null;
16
+ country?: CountryCode | null | undefined;
17
17
  detailedValue?: Partial<DetailedValue> | null;
18
18
  valid?: boolean;
19
19
  options?: TelInputOptions;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svelte-tel-input",
3
3
  "description": "svelte-tel-input",
4
- "version": "3.5.0",
4
+ "version": "3.5.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/gyurielf/svelte-tel-input.git"
@@ -27,7 +27,7 @@
27
27
  "pnpm": ">= 8"
28
28
  },
29
29
  "peerDependencies": {
30
- "svelte": "^3.58.0 || ^4.0.0"
30
+ "svelte": "^3.58.0 || ^4.0.0 || ^5.0.0"
31
31
  },
32
32
  "dependencies": {
33
33
  "libphonenumber-js": "1.10.43"
@@ -1,4 +0,0 @@
1
- export declare const watcher: (initialValue: string | null, watchFunction: (oldVal: string | null, newVal: string | null) => void) => {
2
- subscribe: (this: void, run: import("svelte/store").Subscriber<string | null>, invalidate?: import("svelte/store").Invalidator<string | null> | undefined) => import("svelte/store").Unsubscriber;
3
- set: (value: string | null) => void;
4
- };
@@ -1,14 +0,0 @@
1
- import { writable } from 'svelte/store';
2
- // Watch variable changes.
3
- export const watcher = (initialValue, watchFunction) => {
4
- const { subscribe, update } = writable(initialValue);
5
- return {
6
- subscribe,
7
- set: (value) => {
8
- update((oldvalue) => {
9
- watchFunction(oldvalue, value);
10
- return value;
11
- });
12
- }
13
- };
14
- };