svelte-tel-input 0.3.1 → 0.5.0

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +17 -9
  4. package/assets/countries.d.ts +2 -0
  5. package/{src/lib/assets/countries.ts → assets/countries.js} +0 -2
  6. package/assets/regions.d.ts +2 -0
  7. package/{src/lib/assets/regions.ts → assets/regions.js} +0 -2
  8. package/components/Input/TelInput.svelte +23 -0
  9. package/components/Input/TelInput.svelte.d.ts +17 -0
  10. package/components/Select/TelCountrySelect/TelCountrySelect.svelte +15 -0
  11. package/components/Select/TelCountrySelect/TelCountrySelect.svelte.d.ts +19 -0
  12. package/components/Select/TelRegionSelect/TelRegionSelect.svelte +12 -0
  13. package/components/Select/TelRegionSelect/TelRegionSelect.svelte.d.ts +18 -0
  14. package/components/Select/TelRegionSelect/TelRegionSelectOption.svelte +4 -0
  15. package/components/Select/TelRegionSelect/TelRegionSelectOption.svelte.d.ts +18 -0
  16. package/components/Select/TelTypeSelect/TelTypeSelect.svelte +15 -0
  17. package/components/Select/TelTypeSelect/TelTypeSelect.svelte.d.ts +20 -0
  18. package/components/Select/TelTypeSelect/TelTypeSelectOption.svelte +4 -0
  19. package/components/Select/TelTypeSelect/TelTypeSelectOption.svelte.d.ts +18 -0
  20. package/index.d.ts +6 -0
  21. package/index.js +6 -0
  22. package/models/enums/PhoneType.enum.d.ts +4 -0
  23. package/models/enums/PhoneType.enum.js +5 -0
  24. package/{src/lib/models/enums/index.ts → models/enums/index.d.ts} +0 -0
  25. package/models/enums/index.js +1 -0
  26. package/{src/lib/models/index.ts → models/index.d.ts} +0 -0
  27. package/models/index.js +1 -0
  28. package/{src/lib/models/interfaces/Select.interface.ts → models/interfaces/Select.interface.d.ts} +0 -0
  29. package/models/interfaces/Select.interface.js +1 -0
  30. package/models/types/DynamicSvelteComponent.type.d.ts +8 -0
  31. package/{src/lib/models/types/DynamicSvelteComponent.type.ts → models/types/DynamicSvelteComponent.type.js} +1 -13
  32. package/{src/lib/models/types/Select.type.ts → models/types/Select.type.d.ts} +1 -2
  33. package/models/types/Select.type.js +1 -0
  34. package/package.json +163 -160
  35. package/stores/index.d.ts +17 -0
  36. package/{src/lib/stores/index.ts → stores/index.js} +12 -10
  37. package/utils/directives/clickOutsideAction.d.ts +3 -0
  38. package/utils/directives/clickOutsideAction.js +9 -0
  39. package/utils/helpers.d.ts +1 -0
  40. package/utils/helpers.js +3 -0
  41. package/utils/simulator.d.ts +1 -0
  42. package/utils/simulator.js +5 -0
  43. package/utils/typeCheck.d.ts +4 -0
  44. package/utils/typeCheck.js +11 -0
  45. package/.changeset/config.json +0 -9
  46. package/.editorconfig +0 -13
  47. package/.eslintignore +0 -10
  48. package/.eslintrc.cjs +0 -30
  49. package/.github/workflows/lint.yml +0 -12
  50. package/.github/workflows/release.yml +0 -47
  51. package/.husky/pre-commit +0 -4
  52. package/.prettierignore +0 -10
  53. package/.prettierrc.cjs +0 -6
  54. package/babel.config.cjs +0 -12
  55. package/docker-compose.yml +0 -16
  56. package/docs/_index.md +0 -1
  57. package/jest.config.cjs +0 -21
  58. package/postcss.config.cjs +0 -21
  59. package/scripts/changelog-github-custom.cjs +0 -104
  60. package/scripts/changelog-github-custom.test.ts +0 -136
  61. package/scripts/changelog-github-custom.ts +0 -127
  62. package/src/app.css +0 -4
  63. package/src/app.html +0 -13
  64. package/src/global.d.ts +0 -1
  65. package/src/hooks.ts +0 -9
  66. package/src/lib/components/Input/SvelteTelInput.svelte +0 -29
  67. package/src/lib/components/Select/CountrySelect.svelte +0 -15
  68. package/src/lib/components/Select/RegionSelect.svelte +0 -15
  69. package/src/lib/index.ts +0 -2
  70. package/src/lib/models/enums/PhoneType.enum.ts +0 -4
  71. package/src/lib/utils/directives/clickOutsideAction.ts +0 -13
  72. package/src/lib/utils/simulator.ts +0 -5
  73. package/src/lib/utils/typeCheck.ts +0 -17
  74. package/src/routes/__layout.svelte +0 -11
  75. package/src/routes/index.svelte +0 -22
  76. package/static/favicon.ico +0 -0
  77. package/static/robots.txt +0 -3
  78. package/svelte.config.js +0 -29
  79. package/tailwind.config.cjs +0 -10
  80. package/tsconfig.json +0 -32
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # svelte-tel-input
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: prepare github pages deployment ([#43](https://github.com/gyurielf/svelte-tel-input/pull/43))
8
+
9
+ * feat: implement selects and input ([#43](https://github.com/gyurielf/svelte-tel-input/pull/43))
10
+
11
+ - feat: basic stores created ([#43](https://github.com/gyurielf/svelte-tel-input/pull/43))
12
+
13
+ ## 0.4.2
14
+
15
+ ### Patch Changes
16
+
17
+ - fix: fix readme ([#41](https://github.com/gyurielf/svelte-tel-input/pull/41))
18
+
19
+ ## 0.4.1
20
+
21
+ ### Patch Changes
22
+
23
+ - fix: readme fix ([#39](https://github.com/gyurielf/svelte-tel-input/pull/39))
24
+
25
+ ## 0.4.0
26
+
27
+ ### Minor Changes
28
+
29
+ - fix: rework ci
30
+
31
+ ### Patch Changes
32
+
33
+ - fix: minor ci fix ([#34](https://github.com/gyurielf/svelte-tel-input/pull/34))
34
+
35
+ * fix: fix ci again ([#35](https://github.com/gyurielf/svelte-tel-input/pull/35))
36
+
37
+ - fix: last ci fix for today ([#36](https://github.com/gyurielf/svelte-tel-input/pull/36))
38
+
39
+ * fix: ci fixxx ([#33](https://github.com/gyurielf/svelte-tel-input/pull/33))
40
+
41
+ - something 1 ([#37](https://github.com/gyurielf/svelte-tel-input/pull/37))
42
+
43
+ * fix: ci extend 321 ([#32](https://github.com/gyurielf/svelte-tel-input/pull/32))
44
+
45
+ ## 0.3.2
46
+
47
+ ### Patch Changes
48
+
49
+ - feat: add MIT license ([#29](https://github.com/gyurielf/svelte-tel-input/pull/29))
50
+
51
+ * fix: fix readme deps ([#29](https://github.com/gyurielf/svelte-tel-input/pull/29))
52
+
3
53
  ## 0.3.1
4
54
 
5
55
  ### Patch Changes
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 - Present Gyorgy Kallai, Budapest, Hungary.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
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
- ## Requirements
6
-
7
- ```
8
- $ npm install --save 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
- $ yarn add svelte-tel-input
17
- # or
18
- $ npm install --save svelte-tel-input
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) |
@@ -0,0 +1,2 @@
1
+ declare const rawCountries: (string | number | string[])[][];
2
+ 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 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;
@@ -0,0 +1,2 @@
1
+ declare const rawTerritories: (string | number | string[])[][];
2
+ export default rawTerritories;
@@ -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,12 @@
1
+ <script >"use strict";
2
+ let selectedTelRegion;
3
+ </script>
4
+
5
+ <select
6
+ name="region_select"
7
+ class={$$props.class}
8
+ bind:value={selectedTelRegion}
9
+ on:change={() => console.log(selectedTelRegion)}
10
+ >
11
+ <slot name="options" />
12
+ </select>
@@ -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,4 @@
1
+ <script >export let regionOption;
2
+ </script>
3
+
4
+ <option class={$$props.class} value={regionOption.value}>{regionOption.label}</option>
@@ -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,4 @@
1
+ <script >export let typeOption;
2
+ </script>
3
+
4
+ <option class={$$props.class} value={typeOption.value}>{typeOption.label}</option>
@@ -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';
@@ -0,0 +1,4 @@
1
+ export declare enum PhoneType {
2
+ FIXED_LINE = "FIXED_LINE",
3
+ MOBILE = "MOBILE"
4
+ }
@@ -0,0 +1,5 @@
1
+ export var PhoneType;
2
+ (function (PhoneType) {
3
+ PhoneType["FIXED_LINE"] = "FIXED_LINE";
4
+ PhoneType["MOBILE"] = "MOBILE";
5
+ })(PhoneType || (PhoneType = {}));
@@ -0,0 +1 @@
1
+ export * from './PhoneType.enum';
File without changes
@@ -0,0 +1 @@
1
+ export * from './enums';
@@ -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>;
5
+ slot?: any;
6
+ click?: any;
7
+ input?: any;
8
+ };
@@ -1,14 +1,4 @@
1
- import type { SvelteComponentTyped } from 'svelte';
2
-
3
- // TEMPORARY DISABLED
4
- export type DynamicSvelteComponent = {
5
- component: typeof SvelteComponentTyped;
6
- props?: Record<string, any>;
7
- slot?: any;
8
- click?: any;
9
- input?: any;
10
- };
11
-
1
+ export {};
12
2
  // declare const __propDef: {
13
3
  // props: {};
14
4
  // slots: {};
@@ -16,11 +6,9 @@ export type DynamicSvelteComponent = {
16
6
  // [evt: string]: CustomEvent<any>;
17
7
  // };
18
8
  // };
19
-
20
9
  // export declare type DynamicSvelteComponentProps = typeof __propDef.props;
21
10
  // export declare type DynamicSvelteComponentEvents = typeof __propDef.events;
22
11
  // export declare type DynamicSvelteComponentSlots = typeof __propDef.slots;
23
-
24
12
  // export default class DynamicSvelteComponent extends SvelteComponentTyped<
25
13
  // DynamicSvelteComponentProps,
26
14
  // DynamicSvelteComponentEvents,
@@ -1,3 +1,2 @@
1
1
  import type { SelectObject } from '../interfaces/Select.interface';
2
-
3
- export type SelectType = SelectObject | (string | number);
2
+ export declare type SelectType = SelectObject | (string | number);
@@ -0,0 +1 @@
1
+ export {};