svelte-tel-input 3.5.0 → 3.5.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.
|
@@ -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,
|
|
108
|
+
handleParsePhoneNumber(null, current);
|
|
110
109
|
}
|
|
111
110
|
countryWatchInitRun = false;
|
|
112
111
|
};
|
|
113
|
-
|
|
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
|
|
16
|
+
country?: CountryCode | null | undefined;
|
|
17
17
|
detailedValue?: Partial<DetailedValue> | null;
|
|
18
18
|
valid?: boolean;
|
|
19
19
|
options?: TelInputOptions;
|
package/package.json
CHANGED
package/dist/stores/index.d.ts
DELETED
|
@@ -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
|
-
};
|
package/dist/stores/index.js
DELETED
|
@@ -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
|
-
};
|