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.
Files changed (80) hide show
  1. package/CHANGELOG.md +32 -2
  2. package/README.md +17 -9
  3. package/assets/countries.d.ts +2 -0
  4. package/{src/lib/assets/countries.ts → assets/countries.js} +0 -2
  5. package/assets/regions.d.ts +2 -0
  6. package/{src/lib/assets/regions.ts → assets/regions.js} +0 -2
  7. package/components/Input/TelInput.svelte +23 -0
  8. package/components/Input/TelInput.svelte.d.ts +17 -0
  9. package/components/Select/TelCountrySelect/TelCountrySelect.svelte +15 -0
  10. package/components/Select/TelCountrySelect/TelCountrySelect.svelte.d.ts +19 -0
  11. package/components/Select/TelRegionSelect/TelRegionSelect.svelte +12 -0
  12. package/components/Select/TelRegionSelect/TelRegionSelect.svelte.d.ts +18 -0
  13. package/components/Select/TelRegionSelect/TelRegionSelectOption.svelte +4 -0
  14. package/components/Select/TelRegionSelect/TelRegionSelectOption.svelte.d.ts +18 -0
  15. package/components/Select/TelTypeSelect/TelTypeSelect.svelte +15 -0
  16. package/components/Select/TelTypeSelect/TelTypeSelect.svelte.d.ts +20 -0
  17. package/components/Select/TelTypeSelect/TelTypeSelectOption.svelte +4 -0
  18. package/components/Select/TelTypeSelect/TelTypeSelectOption.svelte.d.ts +18 -0
  19. package/index.d.ts +6 -0
  20. package/index.js +6 -0
  21. package/models/enums/PhoneType.enum.d.ts +4 -0
  22. package/models/enums/PhoneType.enum.js +5 -0
  23. package/{src/lib/models/enums/index.ts → models/enums/index.d.ts} +0 -0
  24. package/models/enums/index.js +1 -0
  25. package/{src/lib/models/index.ts → models/index.d.ts} +0 -0
  26. package/models/index.js +1 -0
  27. package/{src/lib/models/interfaces/Select.interface.ts → models/interfaces/Select.interface.d.ts} +0 -0
  28. package/models/interfaces/Select.interface.js +1 -0
  29. package/models/types/DynamicSvelteComponent.type.d.ts +8 -0
  30. package/models/types/DynamicSvelteComponent.type.js +1 -0
  31. package/{src/lib/models/types/Select.type.ts → models/types/Select.type.d.ts} +1 -2
  32. package/models/types/Select.type.js +1 -0
  33. package/package.json +160 -160
  34. package/stores/index.d.ts +17 -0
  35. package/{src/lib/stores/index.ts → stores/index.js} +12 -10
  36. package/utils/directives/clickOutsideAction.d.ts +3 -0
  37. package/utils/directives/clickOutsideAction.js +9 -0
  38. package/utils/helpers.d.ts +1 -0
  39. package/utils/helpers.js +3 -0
  40. package/utils/simulator.d.ts +1 -0
  41. package/utils/simulator.js +5 -0
  42. package/utils/typeCheck.d.ts +4 -0
  43. package/utils/typeCheck.js +11 -0
  44. package/.changeset/config.json +0 -9
  45. package/.editorconfig +0 -13
  46. package/.eslintignore +0 -10
  47. package/.eslintrc.cjs +0 -30
  48. package/.github/workflows/lint.yml +0 -12
  49. package/.github/workflows/release.yml +0 -56
  50. package/.husky/pre-commit +0 -4
  51. package/.prettierignore +0 -10
  52. package/.prettierrc.cjs +0 -6
  53. package/babel.config.cjs +0 -12
  54. package/docker-compose.yml +0 -16
  55. package/docs/_index.md +0 -1
  56. package/jest.config.cjs +0 -21
  57. package/postcss.config.cjs +0 -21
  58. package/scripts/changelog-github-custom.cjs +0 -104
  59. package/scripts/changelog-github-custom.test.ts +0 -136
  60. package/scripts/changelog-github-custom.ts +0 -127
  61. package/src/app.css +0 -4
  62. package/src/app.html +0 -13
  63. package/src/global.d.ts +0 -1
  64. package/src/hooks.ts +0 -9
  65. package/src/lib/components/Input/SvelteTelInput.svelte +0 -29
  66. package/src/lib/components/Select/CountrySelect.svelte +0 -15
  67. package/src/lib/components/Select/RegionSelect.svelte +0 -15
  68. package/src/lib/index.ts +0 -2
  69. package/src/lib/models/enums/PhoneType.enum.ts +0 -4
  70. package/src/lib/models/types/DynamicSvelteComponent.type.ts +0 -28
  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 -28
  79. package/tailwind.config.cjs +0 -10
  80. 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
- - fix: ci extend 321 ([#32](https://github.com/gyurielf/svelte-tel-input/pull/32))
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
- ## Dependencies
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
- $ 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> | string | number | null;
5
+ slot?: SvelteComponentTyped;
6
+ click?: MouseEvent;
7
+ input?: InputEvent;
8
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -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 {};