svelte-tel-input 0.4.0 → 0.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/CHANGELOG.md +32 -2
- package/README.md +17 -9
- package/assets/countries.d.ts +2 -0
- package/{src/lib/assets/countries.ts → assets/countries.js} +0 -2
- package/assets/regions.d.ts +2 -0
- package/{src/lib/assets/regions.ts → assets/regions.js} +0 -2
- package/components/Input/TelInput.svelte +23 -0
- package/components/Input/TelInput.svelte.d.ts +17 -0
- package/components/Select/TelCountrySelect/TelCountrySelect.svelte +15 -0
- package/components/Select/TelCountrySelect/TelCountrySelect.svelte.d.ts +19 -0
- package/components/Select/TelRegionSelect/TelRegionSelect.svelte +12 -0
- package/components/Select/TelRegionSelect/TelRegionSelect.svelte.d.ts +18 -0
- package/components/Select/TelRegionSelect/TelRegionSelectOption.svelte +4 -0
- package/components/Select/TelRegionSelect/TelRegionSelectOption.svelte.d.ts +18 -0
- package/components/Select/TelTypeSelect/TelTypeSelect.svelte +15 -0
- package/components/Select/TelTypeSelect/TelTypeSelect.svelte.d.ts +20 -0
- package/components/Select/TelTypeSelect/TelTypeSelectOption.svelte +4 -0
- package/components/Select/TelTypeSelect/TelTypeSelectOption.svelte.d.ts +18 -0
- package/index.d.ts +6 -0
- package/index.js +6 -0
- package/models/enums/PhoneType.enum.d.ts +4 -0
- package/models/enums/PhoneType.enum.js +5 -0
- package/{src/lib/models/enums/index.ts → models/enums/index.d.ts} +0 -0
- package/models/enums/index.js +1 -0
- package/{src/lib/models/index.ts → models/index.d.ts} +0 -0
- package/models/index.js +1 -0
- package/{src/lib/models/interfaces/Select.interface.ts → models/interfaces/Select.interface.d.ts} +0 -0
- package/models/interfaces/Select.interface.js +1 -0
- package/models/types/DynamicSvelteComponent.type.d.ts +8 -0
- package/models/types/DynamicSvelteComponent.type.js +1 -0
- package/{src/lib/models/types/Select.type.ts → models/types/Select.type.d.ts} +1 -2
- package/models/types/Select.type.js +1 -0
- package/package.json +160 -160
- package/stores/index.d.ts +17 -0
- package/{src/lib/stores/index.ts → stores/index.js} +12 -10
- package/utils/directives/clickOutsideAction.d.ts +3 -0
- package/utils/directives/clickOutsideAction.js +9 -0
- package/utils/helpers.d.ts +1 -0
- package/utils/helpers.js +3 -0
- package/utils/simulator.d.ts +1 -0
- package/utils/simulator.js +5 -0
- package/utils/typeCheck.d.ts +4 -0
- package/utils/typeCheck.js +11 -0
- package/.changeset/config.json +0 -9
- package/.editorconfig +0 -13
- package/.eslintignore +0 -10
- package/.eslintrc.cjs +0 -30
- package/.github/workflows/lint.yml +0 -12
- package/.github/workflows/release.yml +0 -56
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -10
- package/.prettierrc.cjs +0 -6
- package/babel.config.cjs +0 -12
- package/docker-compose.yml +0 -16
- package/docs/_index.md +0 -1
- package/jest.config.cjs +0 -21
- package/postcss.config.cjs +0 -21
- package/scripts/changelog-github-custom.cjs +0 -104
- package/scripts/changelog-github-custom.test.ts +0 -136
- package/scripts/changelog-github-custom.ts +0 -127
- package/src/app.css +0 -4
- package/src/app.html +0 -13
- package/src/global.d.ts +0 -1
- package/src/hooks.ts +0 -9
- package/src/lib/components/Input/SvelteTelInput.svelte +0 -29
- package/src/lib/components/Select/CountrySelect.svelte +0 -15
- package/src/lib/components/Select/RegionSelect.svelte +0 -15
- package/src/lib/index.ts +0 -2
- package/src/lib/models/enums/PhoneType.enum.ts +0 -4
- package/src/lib/models/types/DynamicSvelteComponent.type.ts +0 -28
- package/src/lib/utils/directives/clickOutsideAction.ts +0 -13
- package/src/lib/utils/simulator.ts +0 -5
- package/src/lib/utils/typeCheck.ts +0 -17
- package/src/routes/__layout.svelte +0 -11
- package/src/routes/index.svelte +0 -22
- package/static/favicon.ico +0 -0
- package/static/robots.txt +0 -3
- package/svelte.config.js +0 -28
- package/tailwind.config.cjs +0 -10
- package/tsconfig.json +0 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# svelte-tel-input
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- chore: update packages and resolve breaking changes ([#46](https://github.com/gyurielf/svelte-tel-input/pull/46))
|
|
8
|
+
|
|
9
|
+
## 0.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- feat: prepare github pages deployment ([#43](https://github.com/gyurielf/svelte-tel-input/pull/43))
|
|
14
|
+
|
|
15
|
+
* feat: implement selects and input ([#43](https://github.com/gyurielf/svelte-tel-input/pull/43))
|
|
16
|
+
|
|
17
|
+
- feat: basic stores created ([#43](https://github.com/gyurielf/svelte-tel-input/pull/43))
|
|
18
|
+
|
|
19
|
+
## 0.4.2
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- fix: fix readme ([#41](https://github.com/gyurielf/svelte-tel-input/pull/41))
|
|
24
|
+
|
|
25
|
+
## 0.4.1
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- fix: readme fix ([#39](https://github.com/gyurielf/svelte-tel-input/pull/39))
|
|
30
|
+
|
|
3
31
|
## 0.4.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
|
@@ -10,13 +38,15 @@
|
|
|
10
38
|
|
|
11
39
|
- fix: minor ci fix ([#34](https://github.com/gyurielf/svelte-tel-input/pull/34))
|
|
12
40
|
|
|
13
|
-
* fix: fix ci again
|
|
41
|
+
* fix: fix ci again ([#35](https://github.com/gyurielf/svelte-tel-input/pull/35))
|
|
14
42
|
|
|
15
43
|
- fix: last ci fix for today ([#36](https://github.com/gyurielf/svelte-tel-input/pull/36))
|
|
16
44
|
|
|
17
45
|
* fix: ci fixxx ([#33](https://github.com/gyurielf/svelte-tel-input/pull/33))
|
|
18
46
|
|
|
19
|
-
-
|
|
47
|
+
- something 1 ([#37](https://github.com/gyurielf/svelte-tel-input/pull/37))
|
|
48
|
+
|
|
49
|
+
* fix: ci extend 321 ([#32](https://github.com/gyurielf/svelte-tel-input/pull/32))
|
|
20
50
|
|
|
21
51
|
## 0.3.2
|
|
22
52
|
|
package/README.md
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
# Svelte Tel Input
|
|
2
2
|
|
|
3
|
-
Under development!
|
|
3
|
+
## Under heavy development!
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
$ [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js)
|
|
9
|
-
```
|
|
5
|
+
<ins>Do not use it before 1.0, it won't works properly!</ins>
|
|
10
6
|
|
|
11
7
|
## Installation
|
|
12
8
|
|
|
13
9
|
Svelte Tel Input is distributed via [npm](https://www.npmjs.com/package/svelte-tel-input).
|
|
14
10
|
|
|
15
11
|
```sh
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
yarn add svelte-tel-input
|
|
13
|
+
```
|
|
14
|
+
|
|
19
15
|
```
|
|
16
|
+
npm install --save svelte-tel-input
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Dependencies
|
|
20
|
+
|
|
21
|
+
[libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js)
|
|
22
|
+
|
|
23
|
+
## Changelog
|
|
24
|
+
|
|
25
|
+
| Package | Changelog |
|
|
26
|
+
| ------------------------------ | ------------------------- |
|
|
27
|
+
| [@gyurielf/svelte-tel-input]() | [Changelog](CHANGELOG.md) |
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// Sub-regions:
|
|
16
16
|
// ['north-america', 'south-america', 'central-america', 'carribean',
|
|
17
17
|
// 'eu-union', 'ex-ussr', 'ex-yugos', 'baltic', 'middle-east', 'north-africa']
|
|
18
|
-
|
|
19
18
|
const rawCountries = [
|
|
20
19
|
['Afghanistan', ['asia'], 'af', '93'],
|
|
21
20
|
['Albania', ['europe'], 'al', '355'],
|
|
@@ -601,5 +600,4 @@ const rawCountries = [
|
|
|
601
600
|
['Zambia', ['africa'], 'zm', '260'],
|
|
602
601
|
['Zimbabwe', ['africa'], 'zw', '263']
|
|
603
602
|
];
|
|
604
|
-
|
|
605
603
|
export default rawCountries;
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// Sub-regions:
|
|
16
16
|
// ['north-america', 'south-america', 'central-america', 'carribean',
|
|
17
17
|
// 'eu-union', 'ex-ussr', 'ex-yugos', 'baltic', 'middle-east', 'north-africa']
|
|
18
|
-
|
|
19
18
|
const rawTerritories = [
|
|
20
19
|
['American Samoa', ['oceania'], 'as', '1684'],
|
|
21
20
|
['Anguilla', ['america', 'carribean'], 'ai', '1264'],
|
|
@@ -42,5 +41,4 @@ const rawTerritories = [
|
|
|
42
41
|
['U.S. Virgin Islands', ['america', 'carribean'], 'vi', '1340'],
|
|
43
42
|
['Wallis and Futuna', ['oceania'], 'wf', '681']
|
|
44
43
|
];
|
|
45
|
-
|
|
46
44
|
export default rawTerritories;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script >import { enteredTelInputStore } from '../../stores';
|
|
2
|
+
import { parsePhoneNumberWithError, ParseError } from 'libphonenumber-js';
|
|
3
|
+
export let enteredTelInput;
|
|
4
|
+
const handleInput = (event) => {
|
|
5
|
+
const inputVal = event.target.value;
|
|
6
|
+
enteredTelInput = inputVal;
|
|
7
|
+
$enteredTelInputStore = inputVal;
|
|
8
|
+
try {
|
|
9
|
+
const phoneNumber = parsePhoneNumberWithError(inputVal);
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
if (error instanceof ParseError) {
|
|
13
|
+
// Not a phone number, non-existent country, etc.
|
|
14
|
+
console.log(error.message);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<input class={$$props.class} type="tel" on:input={handleInput} />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
enteredTelInput: string;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export declare type TelInputProps = typeof __propDef.props;
|
|
13
|
+
export declare type TelInputEvents = typeof __propDef.events;
|
|
14
|
+
export declare type TelInputSlots = typeof __propDef.slots;
|
|
15
|
+
export default class TelInput extends SvelteComponentTyped<TelInputProps, TelInputEvents, TelInputSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script >import { selectedCountryStore } from '../../../stores';
|
|
2
|
+
export let selectedCountry;
|
|
3
|
+
const setSelectedCountry = (value) => {
|
|
4
|
+
selectedCountry = value;
|
|
5
|
+
$selectedCountryStore = value;
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<select
|
|
10
|
+
name="country_select"
|
|
11
|
+
class="some-class {$$props.class}"
|
|
12
|
+
on:change={(e) => setSelectedCountry(e.currentTarget.value)}
|
|
13
|
+
>
|
|
14
|
+
<slot name="options" />
|
|
15
|
+
</select>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
selectedCountry: string;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
options: {};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare type TelCountrySelectProps = typeof __propDef.props;
|
|
15
|
+
export declare type TelCountrySelectEvents = typeof __propDef.events;
|
|
16
|
+
export declare type TelCountrySelectSlots = typeof __propDef.slots;
|
|
17
|
+
export default class TelCountrySelect extends SvelteComponentTyped<TelCountrySelectProps, TelCountrySelectEvents, TelCountrySelectSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {
|
|
10
|
+
options: {};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare type TelRegionSelectProps = typeof __propDef.props;
|
|
14
|
+
export declare type TelRegionSelectEvents = typeof __propDef.events;
|
|
15
|
+
export declare type TelRegionSelectSlots = typeof __propDef.slots;
|
|
16
|
+
export default class TelRegionSelect extends SvelteComponentTyped<TelRegionSelectProps, TelRegionSelectEvents, TelRegionSelectSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SelectObject } from '../../../models/interfaces/Select.interface';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
regionOption: SelectObject;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export declare type TelRegionSelectOptionProps = typeof __propDef.props;
|
|
14
|
+
export declare type TelRegionSelectOptionEvents = typeof __propDef.events;
|
|
15
|
+
export declare type TelRegionSelectOptionSlots = typeof __propDef.slots;
|
|
16
|
+
export default class TelRegionSelectOption extends SvelteComponentTyped<TelRegionSelectOptionProps, TelRegionSelectOptionEvents, TelRegionSelectOptionSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script >import { selectedTelTypeStore } from '../../../stores';
|
|
2
|
+
export let selectedTelType;
|
|
3
|
+
const setSelectedCountry = (value) => {
|
|
4
|
+
selectedTelType = value;
|
|
5
|
+
$selectedTelTypeStore = value;
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<select
|
|
10
|
+
name="type_select"
|
|
11
|
+
class={$$props.class}
|
|
12
|
+
on:change={(e) => setSelectedCountry(e.currentTarget.value)}
|
|
13
|
+
>
|
|
14
|
+
<slot name="options" />
|
|
15
|
+
</select>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SelectType } from '../../../models/types/Select.type';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
selectedTelType: SelectType;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
options: {};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare type TelTypeSelectProps = typeof __propDef.props;
|
|
16
|
+
export declare type TelTypeSelectEvents = typeof __propDef.events;
|
|
17
|
+
export declare type TelTypeSelectSlots = typeof __propDef.slots;
|
|
18
|
+
export default class TelTypeSelect extends SvelteComponentTyped<TelTypeSelectProps, TelTypeSelectEvents, TelTypeSelectSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SelectObject } from '../../../models/interfaces/Select.interface';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
typeOption: SelectObject;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export declare type TelTypeSelectOptionProps = typeof __propDef.props;
|
|
14
|
+
export declare type TelTypeSelectOptionEvents = typeof __propDef.events;
|
|
15
|
+
export declare type TelTypeSelectOptionSlots = typeof __propDef.slots;
|
|
16
|
+
export default class TelTypeSelectOption extends SvelteComponentTyped<TelTypeSelectOptionProps, TelTypeSelectOptionEvents, TelTypeSelectOptionSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as TelCountrySelect } from "./components/Select/TelCountrySelect/TelCountrySelect.svelte";
|
|
2
|
+
export { default as TelTypeSelect } from "./components/Select/TelTypeSelect/TelTypeSelect.svelte";
|
|
3
|
+
export { default as TelTypeSelectOption } from "./components/Select/TelTypeSelect/TelTypeSelectOption.svelte";
|
|
4
|
+
export { default as TelRegionSelect } from "./components/Select/TelRegionSelect/TelRegionSelect.svelte";
|
|
5
|
+
export { default as TelRegionSelectOption } from "./components/Select/TelRegionSelect/TelRegionSelectOption.svelte";
|
|
6
|
+
export { default as TelInput } from "./components/Input/TelInput.svelte";
|
package/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as TelCountrySelect } from './components/Select/TelCountrySelect/TelCountrySelect.svelte';
|
|
2
|
+
export { default as TelTypeSelect } from './components/Select/TelTypeSelect/TelTypeSelect.svelte';
|
|
3
|
+
export { default as TelTypeSelectOption } from './components/Select/TelTypeSelect/TelTypeSelectOption.svelte';
|
|
4
|
+
export { default as TelRegionSelect } from './components/Select/TelRegionSelect/TelRegionSelect.svelte';
|
|
5
|
+
export { default as TelRegionSelectOption } from './components/Select/TelRegionSelect/TelRegionSelectOption.svelte';
|
|
6
|
+
export { default as TelInput } from './components/Input/TelInput.svelte';
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PhoneType.enum';
|
|
File without changes
|
package/models/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
package/{src/lib/models/interfaces/Select.interface.ts → models/interfaces/Select.interface.d.ts}
RENAMED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SvelteComponentTyped } from 'svelte';
|
|
2
|
+
export declare type DynamicSvelteComponent = {
|
|
3
|
+
component: typeof SvelteComponentTyped;
|
|
4
|
+
props?: Record<string, any> | string | number | null;
|
|
5
|
+
slot?: SvelteComponentTyped;
|
|
6
|
+
click?: MouseEvent;
|
|
7
|
+
input?: InputEvent;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|