svelte-tel-input 3.4.1 → 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.
package/README.md
CHANGED
|
@@ -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,10 +24,11 @@ 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;
|
|
31
|
+
export let el = void 0;
|
|
32
32
|
let inputValue = value;
|
|
33
33
|
let prevCountry = country;
|
|
34
34
|
const combinedOptions = {
|
|
@@ -103,14 +103,13 @@ const handleParsePhoneNumber = (rawInput, currCountry = null) => {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
let countryWatchInitRun = true;
|
|
106
|
-
const countryChangeWatchFunction = () => {
|
|
106
|
+
const countryChangeWatchFunction = (current) => {
|
|
107
107
|
if (!countryWatchInitRun) {
|
|
108
|
-
handleParsePhoneNumber(null,
|
|
108
|
+
handleParsePhoneNumber(null, current);
|
|
109
109
|
}
|
|
110
110
|
countryWatchInitRun = false;
|
|
111
111
|
};
|
|
112
|
-
|
|
113
|
-
$: $countryChangeWatch = country;
|
|
112
|
+
$: countryChangeWatchFunction(country);
|
|
114
113
|
$: getPlaceholder = combinedOptions.autoPlaceholder && country ? generatePlaceholder(country, {
|
|
115
114
|
format: combinedOptions.format,
|
|
116
115
|
spaces: combinedOptions.spaces
|
|
@@ -137,6 +136,8 @@ onMount(() => {
|
|
|
137
136
|
</script>
|
|
138
137
|
|
|
139
138
|
<input
|
|
139
|
+
{...$$restProps}
|
|
140
|
+
bind:this={el}
|
|
140
141
|
{autocomplete}
|
|
141
142
|
class={classes}
|
|
142
143
|
{disabled}
|
|
@@ -2,20 +2,22 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
import type { DetailedValue, CountryCode, E164Number, TelInputOptions } from '../../types';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
+
[x: string]: any;
|
|
5
6
|
autocomplete?: string | null;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
class?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string | null;
|
|
11
|
+
placeholder?: string | null;
|
|
12
|
+
readonly?: boolean | null;
|
|
13
|
+
required?: boolean | null;
|
|
14
|
+
size?: number | null;
|
|
15
|
+
value: E164Number | null;
|
|
16
|
+
country?: CountryCode | null | undefined;
|
|
17
|
+
detailedValue?: Partial<DetailedValue> | null;
|
|
18
|
+
valid?: boolean;
|
|
19
|
+
options?: TelInputOptions;
|
|
20
|
+
el?: HTMLInputElement | undefined;
|
|
19
21
|
updateValue?: (newValue: string | E164Number | null, newCountry?: CountryCode | null) => void;
|
|
20
22
|
};
|
|
21
23
|
events: {
|
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
|
-
};
|