@digital-realty/ix-phone-input 2.0.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/LICENSE +21 -0
- package/README.md +61 -0
- package/demo/index.html +55 -0
- package/dist/src/IxPhoneInput.d.ts +18 -0
- package/dist/src/IxPhoneInput.js +84 -0
- package/dist/src/IxPhoneInput.js.map +1 -0
- package/dist/src/config.d.ts +5 -0
- package/dist/src/config.js +18 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ix-phone-input-styles.d.ts +1 -0
- package/dist/src/ix-phone-input-styles.js +1310 -0
- package/dist/src/ix-phone-input-styles.js.map +1 -0
- package/dist/src/ix-phone-input.d.ts +1 -0
- package/dist/src/ix-phone-input.js +3 -0
- package/dist/src/ix-phone-input.js.map +1 -0
- package/dist/test/ix-phone-input.test.d.ts +1 -0
- package/dist/test/ix-phone-input.test.js +36 -0
- package/dist/test/ix-phone-input.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +102 -0
- package/preserve-entry.js +1 -0
- package/preserve.rollup.config.js +15 -0
- package/rollup.config.js +24 -0
- package/src/IxPhoneInput.ts +80 -0
- package/src/config.ts +19 -0
- package/src/index.ts +1 -0
- package/src/ix-phone-input-styles.ts +1310 -0
- package/src/ix-phone-input.ts +3 -0
- package/test/ix-phone-input.test.ts +46 -0
- package/tsconfig.json +22 -0
- package/web-dev-server.config.mjs +47 -0
- package/web-test-runner.config.mjs +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 ix-phone-input
|
|
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
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# \<ix-phone-input>
|
|
2
|
+
|
|
3
|
+
This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @digital-realty/ix-phone-input
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<script type="module">
|
|
15
|
+
import '@digital-realty/ix-phone-input';
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<ix-phone-input></ix-phone-input>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Linting and formatting
|
|
22
|
+
|
|
23
|
+
To scan the project for linting and formatting errors, run
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm run lint
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
To automatically fix linting and formatting errors, run
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm run format
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Testing with Web Test Runner
|
|
36
|
+
|
|
37
|
+
To execute a single test run:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm run test
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To run the tests in interactive watch mode run:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm run test:watch
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Tooling configs
|
|
50
|
+
|
|
51
|
+
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
|
52
|
+
|
|
53
|
+
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
54
|
+
|
|
55
|
+
## Local Demo with `web-dev-server`
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm start
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
To run a local development server that serves the basic demo located in `demo/index.html`
|
package/demo/index.html
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en-GB">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
body {
|
|
7
|
+
background: #fafafa;
|
|
8
|
+
}
|
|
9
|
+
</style>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="demo"></div>
|
|
13
|
+
|
|
14
|
+
<script type="module">
|
|
15
|
+
import { html, render } from 'lit';
|
|
16
|
+
import '../dist/src/ix-phone-input.js';
|
|
17
|
+
|
|
18
|
+
const getGeolocation = () => window.navigator?.geolocation;
|
|
19
|
+
|
|
20
|
+
const geoFnLatLng = (callback) => {
|
|
21
|
+
const geo = getGeolocation();
|
|
22
|
+
if (!geo) {
|
|
23
|
+
callback('');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
geo.getCurrentPosition(response => {
|
|
28
|
+
const lat = response.coords.latitude;
|
|
29
|
+
const lng = response.coords.longitude;
|
|
30
|
+
console.log(lat,lng);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
fetch(`GET_COUNTRY_FROM_LAT_LNG_API?lat=${lat}&lng=${lng}`)
|
|
35
|
+
.then(res => res.json())
|
|
36
|
+
.then(data => callback(data.countryCode))
|
|
37
|
+
.catch(err => callback(""));
|
|
38
|
+
*/
|
|
39
|
+
// example return value
|
|
40
|
+
callback('DE');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const number = '777345635';
|
|
44
|
+
render(
|
|
45
|
+
html`
|
|
46
|
+
<ix-phone-input .geoFn=${geoFnLatLng}>
|
|
47
|
+
</ix-phone-input>
|
|
48
|
+
<ix-phone-input .value=${number}>
|
|
49
|
+
</ix-phone-input>
|
|
50
|
+
`,
|
|
51
|
+
document.querySelector('#demo')
|
|
52
|
+
);
|
|
53
|
+
</script>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
+
import { Plugin } from 'intl-tel-input';
|
|
4
|
+
export declare class IxPhoneInput extends LitElement {
|
|
5
|
+
static get styles(): import("lit").CSSResult[];
|
|
6
|
+
inputRef: Ref<HTMLInputElement>;
|
|
7
|
+
value: string;
|
|
8
|
+
region: string;
|
|
9
|
+
geoFn: (callback: Function) => void;
|
|
10
|
+
iti: Plugin | undefined;
|
|
11
|
+
_formatvalue(): void;
|
|
12
|
+
_keyboardEvent(e: KeyboardEvent): boolean;
|
|
13
|
+
_inputEvent(): void;
|
|
14
|
+
firstUpdated(): void;
|
|
15
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
16
|
+
disconnectedCallback(): void;
|
|
17
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, LitElement } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
import { createRef, ref } from 'lit/directives/ref.js';
|
|
5
|
+
import intlTelInput from 'intl-tel-input';
|
|
6
|
+
import { IxPhoneInputStyles } from './ix-phone-input-styles.js';
|
|
7
|
+
import { CONFIG } from './config.js';
|
|
8
|
+
export class IxPhoneInput extends LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.inputRef = createRef();
|
|
12
|
+
this.value = '';
|
|
13
|
+
this.region = '';
|
|
14
|
+
// get geo lookup fn from props, use default fn from config or use empty callback
|
|
15
|
+
this.geoFn = (CONFIG === null || CONFIG === void 0 ? void 0 : CONFIG.GEO_FN) || ((callback) => callback(''));
|
|
16
|
+
this.iti = undefined;
|
|
17
|
+
}
|
|
18
|
+
static get styles() {
|
|
19
|
+
return [CONFIG.FLAG_SPRITES, IxPhoneInputStyles];
|
|
20
|
+
}
|
|
21
|
+
_formatvalue() {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if ((_a = window.intlTelInputUtils) === null || _a === void 0 ? void 0 : _a.numberFormat) {
|
|
24
|
+
this.value =
|
|
25
|
+
((_b = this.iti) === null || _b === void 0 ? void 0 : _b.getNumber(window.intlTelInputUtils.numberFormat.E164)) || '';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
_keyboardEvent(e) {
|
|
29
|
+
if (/^[A-Z]$/i.test(e.key)) {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
this._formatvalue();
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
_inputEvent() {
|
|
37
|
+
this._formatvalue();
|
|
38
|
+
}
|
|
39
|
+
firstUpdated() {
|
|
40
|
+
const input = this.inputRef.value;
|
|
41
|
+
input.addEventListener('countrychange', () => {
|
|
42
|
+
this._formatvalue();
|
|
43
|
+
});
|
|
44
|
+
this.iti = intlTelInput(input, {
|
|
45
|
+
initialCountry: this.region !== '' ? this.region : 'auto',
|
|
46
|
+
nationalMode: true,
|
|
47
|
+
hiddenInput: 'full',
|
|
48
|
+
autoPlaceholder: 'off',
|
|
49
|
+
geoIpLookup: this.geoFn,
|
|
50
|
+
utilsScript: CONFIG.UTILS_SCRIPT,
|
|
51
|
+
});
|
|
52
|
+
this.iti.promise.then(() => {
|
|
53
|
+
// format on inititalisation
|
|
54
|
+
this._formatvalue();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
willUpdate(changedProperties) {
|
|
58
|
+
var _a;
|
|
59
|
+
if (changedProperties.has('region')) {
|
|
60
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.setCountry(this.region);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
disconnectedCallback() {
|
|
64
|
+
var _a;
|
|
65
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
return html `<input
|
|
69
|
+
${ref(this.inputRef)}
|
|
70
|
+
type="tel"
|
|
71
|
+
.value="${this.value}"
|
|
72
|
+
/>`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
__decorate([
|
|
76
|
+
property({ type: String })
|
|
77
|
+
], IxPhoneInput.prototype, "value", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
property({ type: String })
|
|
80
|
+
], IxPhoneInput.prototype, "region", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
property()
|
|
83
|
+
], IxPhoneInput.prototype, "geoFn", void 0);
|
|
84
|
+
//# sourceMappingURL=IxPhoneInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IxPhoneInput.js","sourceRoot":"","sources":["../../src/IxPhoneInput.ts"],"names":[],"mappings":";AAAA,O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AM,EAAE,CAAC;4CAAa;AAG5B;IAAX,QAAQ,EAAE;2CAAkE","sourcesContent":["import { html, LitElement, PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { createRef, Ref, ref } from 'lit/directives/ref.js';\nimport intlTelInput, { Plugin } from 'intl-tel-input';\nimport { IxPhoneInputStyles } from './ix-phone-input-styles.js';\nimport { CONFIG } from './config.js';\n\nexport class IxPhoneInput extends LitElement {\n static get styles() {\n return [CONFIG.FLAG_SPRITES, IxPhoneInputStyles];\n }\n\n inputRef: Ref<HTMLInputElement> = createRef();\n\n @property({ type: String }) value = '';\n\n @property({ type: String }) region = '';\n\n // get geo lookup fn from props, use default fn from config or use empty callback\n @property() geoFn = CONFIG?.GEO_FN || ((callback: Function) => callback(''));\n\n iti: Plugin | undefined = undefined;\n\n _formatvalue() {\n if (window.intlTelInputUtils?.numberFormat) {\n this.value =\n this.iti?.getNumber(window.intlTelInputUtils.numberFormat.E164) || '';\n }\n }\n\n _keyboardEvent(e: KeyboardEvent) {\n if (/^[A-Z]$/i.test(e.key)) {\n e.preventDefault();\n return false;\n }\n this._formatvalue();\n return true;\n }\n\n _inputEvent() {\n this._formatvalue();\n }\n\n firstUpdated() {\n const input = this.inputRef.value!;\n input.addEventListener('countrychange', () => {\n this._formatvalue();\n });\n this.iti = intlTelInput(input, {\n initialCountry: this.region !== '' ? this.region : 'auto',\n nationalMode: true,\n hiddenInput: 'full',\n autoPlaceholder: 'off',\n geoIpLookup: this.geoFn,\n utilsScript: CONFIG.UTILS_SCRIPT,\n });\n this.iti.promise.then(() => {\n // format on inititalisation\n this._formatvalue();\n });\n }\n\n protected willUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('region')) {\n this.iti?.setCountry(this.region);\n }\n }\n\n disconnectedCallback() {\n this.iti?.destroy();\n }\n\n render() {\n return html`<input\n ${ref(this.inputRef)}\n type=\"tel\"\n .value=\"${this.value}\"\n />`;\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
const DEFAULT_GEO_API = 'https://ipapi.co/json';
|
|
3
|
+
export const CONFIG = {
|
|
4
|
+
GEO_FN: (callback) => {
|
|
5
|
+
fetch(DEFAULT_GEO_API)
|
|
6
|
+
.then(res => res.json())
|
|
7
|
+
.then(data => callback(data.country_code))
|
|
8
|
+
.catch(() => callback(''));
|
|
9
|
+
},
|
|
10
|
+
UTILS_SCRIPT: `https://cdn.jsdelivr.net/npm/intl-tel-input@18.2.1/build/js/utils.js`,
|
|
11
|
+
FLAG_SPRITES: css `
|
|
12
|
+
:host {
|
|
13
|
+
--flag-url: url('https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/img/flags.png');
|
|
14
|
+
--flag-urlx2: url('https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/img/flags@2x.png');
|
|
15
|
+
}
|
|
16
|
+
`,
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEhD,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM,EAAE,CAAC,QAAkB,EAAE,EAAE;QAC7B,KAAK,CAAC,eAAe,CAAC;aACnB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACvB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aACzC,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,YAAY,EAAE,sEAAsE;IACpF,YAAY,EAAE,GAAG,CAAA;;;;;GAKhB;CACF,CAAC","sourcesContent":["import { css } from 'lit';\n\nconst DEFAULT_GEO_API = 'https://ipapi.co/json';\n\nexport const CONFIG = {\n GEO_FN: (callback: Function) => {\n fetch(DEFAULT_GEO_API)\n .then(res => res.json())\n .then(data => callback(data.country_code))\n .catch(() => callback(''));\n },\n UTILS_SCRIPT: `https://cdn.jsdelivr.net/npm/intl-tel-input@18.2.1/build/js/utils.js`,\n FLAG_SPRITES: css`\n :host {\n --flag-url: url('https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/img/flags.png');\n --flag-urlx2: url('https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/img/flags@2x.png');\n }\n `,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IxPhoneInput } from './IxPhoneInput.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { IxPhoneInput } from './IxPhoneInput.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IxPhoneInputStyles: import("lit").CSSResult;
|