@luftborn/custom-elements 2.0.0 → 2.1.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 (36) hide show
  1. package/demo/index.js +315 -336
  2. package/demo/index.min.js +314 -335
  3. package/demo/index.min.js.map +1 -1
  4. package/dist/elements/InternationaPhoneNumber/Flags.d.ts +1 -0
  5. package/dist/elements/InternationaPhoneNumber/Flags.js +7 -0
  6. package/dist/elements/InternationaPhoneNumber/Flags.js.map +1 -0
  7. package/dist/elements/InternationaPhoneNumber/Flags2x.d.ts +1 -0
  8. package/dist/elements/InternationaPhoneNumber/Flags2x.js +7 -0
  9. package/dist/elements/InternationaPhoneNumber/Flags2x.js.map +1 -0
  10. package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js +11 -2
  11. package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js.map +1 -1
  12. package/node_modules/@webcomponents/webcomponentsjs/CHANGELOG.md +0 -15
  13. package/node_modules/@webcomponents/webcomponentsjs/README.md +0 -13
  14. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-ce.js +31 -31
  15. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-ce.js.map +1 -1
  16. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_dom.js +13 -15
  17. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_dom.js.map +1 -1
  18. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_js.js.map +1 -1
  19. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +223 -237
  20. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +1 -1
  21. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js +176 -188
  22. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +1 -1
  23. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd.js +144 -155
  24. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd.js.map +1 -1
  25. package/node_modules/@webcomponents/webcomponentsjs/package.json +8 -7
  26. package/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-pf_dom-index.js +0 -2
  27. package/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.d.ts +0 -1
  28. package/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js +225 -239
  29. package/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js.map +1 -1
  30. package/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js +3 -35
  31. package/package.json +2 -2
  32. package/src/elements/InternationaPhoneNumber/Flags.ts +3 -0
  33. package/src/elements/InternationaPhoneNumber/Flags2x.ts +3 -0
  34. package/src/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.ts +16 -0
  35. package/node_modules/@webcomponents/webcomponentsjs/src/platform/event-listener-options.js +0 -122
  36. package/node_modules/@webcomponents/webcomponentsjs/src/platform/toggle-attribute.js +0 -39
@@ -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 {
@@ -1,122 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
4
- * This code may only be used under the BSD style license found at
5
- * http://polymer.github.io/LICENSE.txt The complete set of authors may be found
6
- * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may
7
- * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by
8
- * Google as part of the polymer project is also subject to an additional IP
9
- * rights grant found at http://polymer.github.io/PATENTS.txt
10
- */
11
- var _a;
12
- // Older browsers like IE do not support an object as the options parameter
13
- // to add/removeEventListener.
14
- // https://connect.microsoft.com/IE/feedback/details/790389/event-defaultprevented-returns-false-after-preventdefault-was-called
15
- const supportsEventOptions = (() => {
16
- let supported = false;
17
- let onceSupported = false;
18
- const eventOptions = {
19
- get capture() {
20
- supported = true;
21
- return true;
22
- },
23
- get once() {
24
- onceSupported = true;
25
- return true;
26
- },
27
- };
28
- let callCount = 0;
29
- const listener = () => {
30
- callCount++;
31
- };
32
- const d = document.createElement('div');
33
- // NOTE: These will be unpatched at this point.
34
- d.addEventListener('click', listener, eventOptions);
35
- let fullySupported = supported && onceSupported;
36
- // Once + capture broken on Edge >= 17 < 79.
37
- if (fullySupported) {
38
- d.dispatchEvent(new Event('click'));
39
- d.dispatchEvent(new Event('click'));
40
- fullySupported = callCount == 1;
41
- }
42
- d.removeEventListener('click', listener, eventOptions);
43
- return fullySupported;
44
- })();
45
- const nativeEventTarget = (_a = window.EventTarget) !== null && _a !== void 0 ? _a : window.Node;
46
- if (!supportsEventOptions &&
47
- 'addEventListener' in nativeEventTarget.prototype) {
48
- const parseEventOptions = (optionsOrCapture) => {
49
- let capture, once;
50
- if (optionsOrCapture &&
51
- (typeof optionsOrCapture === 'object' ||
52
- typeof optionsOrCapture === 'function')) {
53
- capture = Boolean(optionsOrCapture.capture);
54
- once = Boolean(optionsOrCapture.once);
55
- }
56
- else {
57
- capture = Boolean(optionsOrCapture);
58
- once = false;
59
- }
60
- return {
61
- capture,
62
- once,
63
- };
64
- };
65
- const origAddEventListener = nativeEventTarget.prototype.addEventListener;
66
- const origRemoveEventListener = nativeEventTarget.prototype.removeEventListener;
67
- const captureListenerMap = new WeakMap();
68
- const listenerMap = new WeakMap();
69
- const getListenerMap = (target, type, capture) => {
70
- const elMap = capture ? captureListenerMap : listenerMap;
71
- let typeMap = elMap.get(target);
72
- if (typeMap === undefined) {
73
- elMap.set(target, (typeMap = new Map()));
74
- }
75
- let listeners = typeMap.get(type);
76
- if (listeners === undefined) {
77
- typeMap.set(type, (listeners = new WeakMap()));
78
- }
79
- return listeners;
80
- };
81
- nativeEventTarget.prototype.addEventListener = function (type, listener, options) {
82
- if (listener == null) {
83
- return;
84
- }
85
- const { capture, once } = parseEventOptions(options);
86
- const map = getListenerMap(this, type, capture);
87
- if (!map.has(listener)) {
88
- const cachedListener = once
89
- ? (e) => {
90
- map.delete(listener);
91
- origRemoveEventListener.call(this, type, cachedListener, capture);
92
- if (typeof listener === 'function') {
93
- return listener.call(this, e);
94
- }
95
- if (typeof (listener === null || listener === void 0 ? void 0 : listener.handleEvent) === 'function') {
96
- return listener.handleEvent(e);
97
- }
98
- }
99
- : null;
100
- map.set(listener, cachedListener);
101
- // Note, the cached listener is null if no wrapper is used to avoid
102
- // a strong ref to it;
103
- origAddEventListener.call(this, type, cachedListener !== null && cachedListener !== void 0 ? cachedListener : listener, capture);
104
- }
105
- };
106
- nativeEventTarget.prototype.removeEventListener = function (type, listener, options) {
107
- if (listener == null) {
108
- return;
109
- }
110
- const { capture } = parseEventOptions(options);
111
- const map = getListenerMap(this, type, capture);
112
- const cachedListener = map.get(listener);
113
- if (cachedListener !== undefined) {
114
- map.delete(listener);
115
- // Note, the cached listener is null if no wrapper was used so that a
116
- // strong ref to it is not kept.
117
- origRemoveEventListener.call(this, type, cachedListener !== null && cachedListener !== void 0 ? cachedListener : listener, capture);
118
- }
119
- };
120
- }
121
- export {};
122
- //# sourceMappingURL=event-listener-options.js.map
@@ -1,39 +0,0 @@
1
- /**
2
- @license
3
- Copyright (c) 2020 The Polymer Project Authors. All rights reserved.
4
- This code may only be used under the BSD style license found at
5
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
6
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
7
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
8
- part of the polymer project is also subject to an additional IP rights grant
9
- found at http://polymer.github.io/PATENTS.txt
10
- */
11
- const Element_prototype = Element.prototype;
12
- const nativeHasAttribute = Element.prototype.hasAttribute;
13
- const nativeSetAttribute = Element.prototype.setAttribute;
14
- const nativeRemoveAttribute = Element.prototype.removeAttribute;
15
- if (!Element_prototype.hasOwnProperty('toggleAttribute')) {
16
- Element_prototype.toggleAttribute = function toggleAttribute(name, force) {
17
- if (force === undefined) {
18
- if (nativeHasAttribute.call(this, name)) {
19
- nativeRemoveAttribute.call(this, name);
20
- return false;
21
- }
22
- else {
23
- nativeSetAttribute.call(this, name, '');
24
- return true;
25
- }
26
- }
27
- if (force) {
28
- if (!nativeHasAttribute.call(this, name)) {
29
- nativeSetAttribute.call(this, name, '');
30
- }
31
- return true;
32
- }
33
- // force is falsey
34
- nativeRemoveAttribute.call(this, name);
35
- return false;
36
- };
37
- }
38
- export {};
39
- //# sourceMappingURL=toggle-attribute.js.map