@intl-tel-input/svelte 28.0.2 → 28.0.3
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 +14 -2
- package/package.json +3 -3
- package/src/IntlTelInput.svelte +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Svelte component for intl-tel-input
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
For entering, formatting, and validating international telephone numbers.
|
|
4
4
|
|
|
5
5
|
[Explore docs »](https://intl-tel-input.com/docs/svelte-component)
|
|
6
6
|
|
|
@@ -10,6 +10,10 @@ A Svelte 5 component for the [intl-tel-input](https://github.com/jackocnr/intl-t
|
|
|
10
10
|
<img width="271" height="279" alt="intl-tel-input screenshot showing country dropdown open" src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/iti-github-light.png">
|
|
11
11
|
</picture>
|
|
12
12
|
|
|
13
|
+
## Resources
|
|
14
|
+
|
|
15
|
+
Check out the [website](https://intl-tel-input.com), where you can find [a full set of docs](https://intl-tel-input.com/docs/svelte-component), a [live playground](https://intl-tel-input.com/playground/) where you can try out all of the options, as well as plenty of [examples](https://intl-tel-input.com/examples/svelte-component/validation) of different setups.
|
|
16
|
+
|
|
13
17
|
## Running the demos locally
|
|
14
18
|
|
|
15
19
|
1. Initialise the submodules: `git submodule update --init --recursive`
|
|
@@ -18,3 +22,11 @@ A Svelte 5 component for the [intl-tel-input](https://github.com/jackocnr/intl-t
|
|
|
18
22
|
4. Run a demo: `npm run svelte:demo` and copy the given URL into your browser.
|
|
19
23
|
|
|
20
24
|
This defaults to the validation demo — to run a different one, set the `DEMO` env var, e.g. `DEMO=simple npm run svelte:demo`. View the full list of [available demos](https://github.com/jackocnr/intl-tel-input/tree/master/packages/svelte/demo).
|
|
25
|
+
|
|
26
|
+
## Issues and contributing
|
|
27
|
+
|
|
28
|
+
Please report issues and open pull requests on the [main repository](https://github.com/jackocnr/intl-tel-input).
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intl-tel-input/svelte",
|
|
3
|
-
"version": "28.0.
|
|
4
|
-
"description": "A Svelte component for
|
|
3
|
+
"version": "28.0.3",
|
|
4
|
+
"description": "A Svelte component for intl-tel-input, for entering, formatting, and validating international telephone numbers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Jack O'Connor (http://jackocnr.com)",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"intl-tel-input": "^28.0.
|
|
28
|
+
"intl-tel-input": "^28.0.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"svelte": "^5.0.0"
|
package/src/IntlTelInput.svelte
CHANGED
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
// State
|
|
37
37
|
let inputElement: HTMLInputElement | undefined = $state();
|
|
38
38
|
let instance: Iti | undefined = $state();
|
|
39
|
-
// Classes the
|
|
40
|
-
let
|
|
39
|
+
// Classes the library adds directly to the input (e.g. iti__tel-input)
|
|
40
|
+
let libraryInputClasses = $state("");
|
|
41
41
|
let lastEmittedNumber: string | undefined = $state();
|
|
42
42
|
let lastEmittedCountry: string | undefined = $state();
|
|
43
43
|
let lastEmittedValidity: boolean | undefined = $state();
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
onMount(() => {
|
|
120
120
|
if (inputElement) {
|
|
121
121
|
instance = intlTelInput(inputElement, initOptions as SomeOptions);
|
|
122
|
-
|
|
122
|
+
libraryInputClasses = inputElement.className;
|
|
123
123
|
if (disabled) instance.setDisabled(disabled);
|
|
124
124
|
if (readonly) instance.setReadonly(readonly);
|
|
125
125
|
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
if (ignoredInputProps.has(key)) {
|
|
216
216
|
warnInputProp(key);
|
|
217
217
|
} else if (key === "class") {
|
|
218
|
-
rest[key] = `${
|
|
218
|
+
rest[key] = `${libraryInputClasses} ${val}`;
|
|
219
219
|
} else {
|
|
220
220
|
rest[key] = val;
|
|
221
221
|
}
|