@luftborn/custom-elements 2.0.0 → 2.1.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.
- package/demo/index.js +87 -62
- package/demo/index.min.js +86 -61
- package/demo/index.min.js.map +1 -1
- package/dist/elements/InternationaPhoneNumber/Flags.d.ts +1 -0
- package/dist/elements/InternationaPhoneNumber/Flags.js +7 -0
- package/dist/elements/InternationaPhoneNumber/Flags.js.map +1 -0
- package/dist/elements/InternationaPhoneNumber/Flags2x.d.ts +1 -0
- package/dist/elements/InternationaPhoneNumber/Flags2x.js +7 -0
- package/dist/elements/InternationaPhoneNumber/Flags2x.js.map +1 -0
- package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js +11 -2
- package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/InternationaPhoneNumber/Flags.ts +3 -0
- package/src/elements/InternationaPhoneNumber/Flags2x.ts +3 -0
- package/src/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.ts +16 -0
|
@@ -4,6 +4,8 @@ import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
|
4
4
|
import * as intlTelInput from 'intl-tel-input';
|
|
5
5
|
import { Plugin } from 'intl-tel-input';
|
|
6
6
|
import MakeRequest from '../../framework/Utilities/MakeRequest';
|
|
7
|
+
import GetFlagsUrl from './Flags';
|
|
8
|
+
import GetFlags2XUrl from './Flags2x';
|
|
7
9
|
|
|
8
10
|
@CustomElement({
|
|
9
11
|
selector: 'int-phone-element',
|
|
@@ -30,6 +32,12 @@ import MakeRequest from '../../framework/Utilities/MakeRequest';
|
|
|
30
32
|
margin: 2px;
|
|
31
33
|
resize: none;
|
|
32
34
|
}
|
|
35
|
+
|
|
36
|
+
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
|
37
|
+
.iti__flag {
|
|
38
|
+
background-image: url('https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/16.0.0/img/flags@2x.png'), url(${GetFlags2XUrl()});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
33
41
|
`,
|
|
34
42
|
useShadow: true,
|
|
35
43
|
})
|
|
@@ -100,6 +108,14 @@ export class IntPhoneFieldElement extends CustomInputElement {
|
|
|
100
108
|
this.fullPhone = super.getChildInput('[name="fullphone"]');
|
|
101
109
|
}, 1000);
|
|
102
110
|
});
|
|
111
|
+
|
|
112
|
+
const isLocalFlagEnabled = this.getAttribute('data-local-flag')?.toLowerCase() === "true";
|
|
113
|
+
if (isLocalFlagEnabled) {
|
|
114
|
+
const flagWrapper: HTMLElement = this.shadowRoot.querySelector(".iti__flag");
|
|
115
|
+
if (flagWrapper) {
|
|
116
|
+
flagWrapper.style.backgroundImage = `url(${GetFlagsUrl()})`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
103
119
|
}
|
|
104
120
|
// events
|
|
105
121
|
public change($event): void {
|