@everymatrix/general-input 1.44.0 → 1.45.2
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/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/checkbox-group-input_10.cjs.entry.js +3873 -1756
- package/dist/cjs/general-input.cjs.entry.js +65 -63
- package/dist/cjs/general-input.cjs.js +17 -11
- package/dist/cjs/index-8cb018cb.js +1316 -0
- package/dist/cjs/index.cjs.js +13 -13
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/cjs/locale.utils-76c75c40.js +147 -0
- package/dist/cjs/toggle-checkbox-input.cjs.entry.js +77 -78
- package/dist/collection/collection-manifest.json +14 -14
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +368 -353
- package/dist/collection/components/checkbox-input/checkbox-input.js +325 -315
- package/dist/collection/components/date-input/date-input.css +2 -2
- package/dist/collection/components/date-input/date-input.js +397 -376
- package/dist/collection/components/email-input/email-input.css +7 -11
- package/dist/collection/components/email-input/email-input.js +404 -385
- package/dist/collection/components/general-input/general-input.js +373 -368
- package/dist/collection/components/general-input/index.js +1 -0
- package/dist/collection/components/number-input/number-input.js +370 -352
- package/dist/collection/components/password-input/password-input.css +2 -4
- package/dist/collection/components/password-input/password-input.js +513 -540
- package/dist/collection/components/radio-input/radio-input.js +301 -286
- package/dist/collection/components/select-input/select-input.css +8 -9
- package/dist/collection/components/select-input/select-input.js +427 -414
- package/dist/collection/components/tel-input/tel-input.css +1 -1
- package/dist/collection/components/tel-input/tel-input.js +440 -422
- package/dist/collection/components/text-input/text-input.css +0 -1
- package/dist/collection/components/text-input/text-input.js +444 -429
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +327 -340
- package/dist/collection/index.js +13 -13
- package/dist/collection/utils/locale.utils.js +133 -133
- package/dist/collection/utils/utils.js +3 -3
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/checkbox-group-input_10.entry.js +3873 -1756
- package/dist/esm/general-input.entry.js +65 -63
- package/dist/esm/general-input.js +14 -11
- package/dist/esm/index-514fda47.js +1287 -0
- package/dist/esm/index.js +13 -13
- package/dist/esm/loader.js +7 -13
- package/dist/esm/locale.utils-ca41bf95.js +144 -0
- package/dist/esm/toggle-checkbox-input.entry.js +77 -78
- package/dist/general-input/general-input.esm.js +1 -1
- package/dist/general-input/p-03e81c11.js +2 -0
- package/dist/general-input/p-aec71434.js +1 -0
- package/dist/general-input/p-e1255160.js +1 -0
- package/dist/general-input/p-eb454344.entry.js +1 -0
- package/dist/general-input/p-ecdc294b.entry.js +5430 -0
- package/dist/general-input/p-f92ab852.entry.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-input/.stencil/packages/stencil/general-input/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-input/.stencil/packages/stencil/general-input/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +68 -68
- package/dist/types/components/checkbox-input/checkbox-input.d.ts +61 -62
- package/dist/types/components/date-input/date-input.d.ts +78 -78
- package/dist/types/components/email-input/email-input.d.ts +77 -77
- package/dist/types/components/general-input/general-input.d.ts +72 -72
- package/dist/types/components/general-input/index.d.ts +1 -0
- package/dist/types/components/number-input/number-input.d.ts +71 -71
- package/dist/types/components/password-input/password-input.d.ts +87 -92
- package/dist/types/components/radio-input/radio-input.d.ts +55 -55
- package/dist/types/components/select-input/select-input.d.ts +79 -79
- package/dist/types/components/tel-input/tel-input.d.ts +85 -85
- package/dist/types/components/text-input/text-input.d.ts +81 -81
- package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +63 -68
- package/dist/types/components.d.ts +201 -39
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/dist/types/utils/locale.utils.d.ts +8 -8
- package/dist/types/utils/types.d.ts +54 -54
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +8 -1
- package/dist/cjs/index-132a0774.js +0 -1327
- package/dist/cjs/locale.utils-2fa6f747.js +0 -147
- package/dist/components/active-mixin.js +0 -975
- package/dist/components/checkbox-group-input.d.ts +0 -11
- package/dist/components/checkbox-group-input.js +0 -6
- package/dist/components/checkbox-group-input2.js +0 -1078
- package/dist/components/checkbox-input.d.ts +0 -11
- package/dist/components/checkbox-input.js +0 -6
- package/dist/components/checkbox-input2.js +0 -132
- package/dist/components/date-input.d.ts +0 -11
- package/dist/components/date-input.js +0 -6
- package/dist/components/date-input2.js +0 -11556
- package/dist/components/email-input.d.ts +0 -11
- package/dist/components/email-input.js +0 -6
- package/dist/components/email-input2.js +0 -171
- package/dist/components/field-mixin.js +0 -12426
- package/dist/components/general-input.d.ts +0 -11
- package/dist/components/general-input.js +0 -6
- package/dist/components/general-input2.js +0 -350
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -18
- package/dist/components/input-field-shared-styles.js +0 -1211
- package/dist/components/number-input.d.ts +0 -11
- package/dist/components/number-input.js +0 -6
- package/dist/components/number-input2.js +0 -158
- package/dist/components/password-input.d.ts +0 -11
- package/dist/components/password-input.js +0 -6
- package/dist/components/password-input2.js +0 -1059
- package/dist/components/radio-input.d.ts +0 -11
- package/dist/components/radio-input.js +0 -6
- package/dist/components/radio-input2.js +0 -114
- package/dist/components/select-input.d.ts +0 -11
- package/dist/components/select-input.js +0 -6
- package/dist/components/select-input2.js +0 -183
- package/dist/components/tel-input.d.ts +0 -11
- package/dist/components/tel-input.js +0 -6
- package/dist/components/tel-input2.js +0 -197
- package/dist/components/text-input.d.ts +0 -11
- package/dist/components/text-input.js +0 -6
- package/dist/components/text-input2.js +0 -199
- package/dist/components/toggle-checkbox-input.d.ts +0 -11
- package/dist/components/toggle-checkbox-input.js +0 -6
- package/dist/components/tooltipIcon.js +0 -146
- package/dist/components/vaadin-button.js +0 -490
- package/dist/components/vaadin-combo-box.js +0 -4512
- package/dist/components/virtual-keyboard-controller.js +0 -2001
- package/dist/esm/index-db76d5b5.js +0 -1299
- package/dist/esm/locale.utils-30fb5289.js +0 -144
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/general-input/p-04d4b145.js +0 -1
- package/dist/general-input/p-a8221ce9.entry.js +0 -1
- package/dist/general-input/p-b408093e.js +0 -1
- package/dist/general-input/p-b64caafa.entry.js +0 -3646
- package/dist/general-input/p-c85c0e4d.entry.js +0 -1
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -2
- /package/dist/cjs/{tooltipIcon-092a795f.js → tooltipIcon-7e9ee226.js} +0 -0
- /package/dist/esm/{tooltipIcon-99c1c7b7.js → tooltipIcon-0a5a06a2.js} +0 -0
- /package/dist/general-input/{p-f4f4ccda.js → p-2dccd0bf.js} +0 -0
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface RadioInput extends Components.RadioInput, HTMLElement {}
|
|
4
|
-
export const RadioInput: {
|
|
5
|
-
prototype: RadioInput;
|
|
6
|
-
new (): RadioInput;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
|
-
|
|
4
|
-
const radioInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.radio__fieldset{border:none;position:relative}.radio__wrapper{display:flex;gap:5px}.radio__error-message{position:absolute;top:calc(100% + 5px);left:0;color:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.radio__tooltip-icon{position:absolute;right:0;bottom:10px}.radio__tooltip{position:absolute;bottom:35px;right:10px;background-color:var(--emfe-w-color-white, #FFFFFF);border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.radio__tooltip.visible{opacity:1}";
|
|
5
|
-
|
|
6
|
-
const RadioInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.__registerHost();
|
|
10
|
-
this.__attachShadow();
|
|
11
|
-
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
12
|
-
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
13
|
-
/**
|
|
14
|
-
* Client custom styling via inline style
|
|
15
|
-
*/
|
|
16
|
-
this.clientStyling = '';
|
|
17
|
-
this.limitStylingAppends = false;
|
|
18
|
-
this.showTooltip = false;
|
|
19
|
-
this.setClientStyling = () => {
|
|
20
|
-
let sheet = document.createElement('style');
|
|
21
|
-
sheet.innerHTML = this.clientStyling;
|
|
22
|
-
this.stylingContainer.prepend(sheet);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
validityChanged() {
|
|
26
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
27
|
-
if (this.emitValue == true) {
|
|
28
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
emitValueHandler(newValue) {
|
|
32
|
-
if (newValue == true && this.isValid) {
|
|
33
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
valueHandler(inputValueEvent) {
|
|
37
|
-
this.sendInputValue.emit(inputValueEvent);
|
|
38
|
-
}
|
|
39
|
-
validityStateHandler(inputStateEvent) {
|
|
40
|
-
this.sendValidityState.emit(inputStateEvent);
|
|
41
|
-
}
|
|
42
|
-
handleClickOutside(event) {
|
|
43
|
-
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
44
|
-
return;
|
|
45
|
-
if (event.composedPath()[0] !== this.tooltipReference)
|
|
46
|
-
this.showTooltip = false;
|
|
47
|
-
}
|
|
48
|
-
componentDidRender() {
|
|
49
|
-
// start custom styling area
|
|
50
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
51
|
-
if (this.clientStyling)
|
|
52
|
-
this.setClientStyling();
|
|
53
|
-
this.limitStylingAppends = true;
|
|
54
|
-
}
|
|
55
|
-
// end custom styling area
|
|
56
|
-
}
|
|
57
|
-
handleClick(event) {
|
|
58
|
-
this.value = event.target.value;
|
|
59
|
-
this.isValid = this.setValidity();
|
|
60
|
-
this.errorMessage = this.setErrorMessage();
|
|
61
|
-
this.emitValueHandler(true);
|
|
62
|
-
}
|
|
63
|
-
setValidity() {
|
|
64
|
-
return this.inputReference.validity.valid;
|
|
65
|
-
}
|
|
66
|
-
setErrorMessage() {
|
|
67
|
-
if (this.inputReference.validity.valueMissing) {
|
|
68
|
-
return translate('requiredError', this.language);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
renderTooltip() {
|
|
72
|
-
if (this.showTooltip) {
|
|
73
|
-
return (h("div", { class: `radio__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
render() {
|
|
78
|
-
return h("fieldset", { class: `radio__fieldset ${this.name}__input`, ref: el => this.stylingContainer = el }, h("legend", { class: 'radio__legend' }, this.displayName, ":"), this.optionsGroup.map(option => h("div", { class: 'radio__wrapper' }, h("input", { type: "radio", class: 'radio__input', id: `${option.label}__input`, ref: (el) => this.inputReference = el, value: option.value, name: this.name, required: this.validation.mandatory, onClick: (e) => this.handleClick(e) }), h("label", { htmlFor: `${option.label}__input` }, option.label))), h("small", { class: 'radio__error-message' }, this.errorMessage), this.tooltip &&
|
|
79
|
-
h("img", { class: 'radio__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
|
|
80
|
-
}
|
|
81
|
-
static get watchers() { return {
|
|
82
|
-
"isValid": ["validityChanged"],
|
|
83
|
-
"emitValue": ["emitValueHandler"]
|
|
84
|
-
}; }
|
|
85
|
-
static get style() { return radioInputCss; }
|
|
86
|
-
}, [1, "radio-input", {
|
|
87
|
-
"name": [513],
|
|
88
|
-
"displayName": [513, "display-name"],
|
|
89
|
-
"optionsGroup": [16],
|
|
90
|
-
"validation": [16],
|
|
91
|
-
"tooltip": [513],
|
|
92
|
-
"language": [513],
|
|
93
|
-
"emitValue": [516, "emit-value"],
|
|
94
|
-
"clientStyling": [513, "client-styling"],
|
|
95
|
-
"errorMessage": [32],
|
|
96
|
-
"isValid": [32],
|
|
97
|
-
"limitStylingAppends": [32],
|
|
98
|
-
"showTooltip": [32]
|
|
99
|
-
}, [[4, "click", "handleClickOutside"]]]);
|
|
100
|
-
function defineCustomElement() {
|
|
101
|
-
if (typeof customElements === "undefined") {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const components = ["radio-input"];
|
|
105
|
-
components.forEach(tagName => { switch (tagName) {
|
|
106
|
-
case "radio-input":
|
|
107
|
-
if (!customElements.get(tagName)) {
|
|
108
|
-
customElements.define(tagName, RadioInput);
|
|
109
|
-
}
|
|
110
|
-
break;
|
|
111
|
-
} });
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export { RadioInput as R, defineCustomElement as d };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface SelectInput extends Components.SelectInput, HTMLElement {}
|
|
4
|
-
export const SelectInput: {
|
|
5
|
-
prototype: SelectInput;
|
|
6
|
-
new (): SelectInput;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
|
-
import './input-field-shared-styles.js';
|
|
4
|
-
import './vaadin-combo-box.js';
|
|
5
|
-
|
|
6
|
-
const selectInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}:host{height:100%}vaadin-combo-box>input{background-color:var(--emfe-w-color-white, #FFFFFF);color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));font-weight:300;font-size:16px;-webkit-font-smoothing:initial;}.select{font-family:\"Roboto\";font-style:normal}.select__wrapper{position:relative;width:100%;display:flex;flex-direction:column;gap:5px;height:100%}.select__wrapper--autofilled{pointer-events:none}.select__wrapper--autofilled .select__label{color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.select__wrapper--autofilled .select__input::part(input-field){color:var(--emfe-w-color-black, #000000)}.select__wrapper--flex{display:flex;gap:5px}.select__wrapper--relative{position:relative}.select__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.select__label--required::after{content:\"*\";font-family:inherit;color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));margin-left:2px}.select__input{border:none;width:inherit;position:relative}.select__input[focused]::part(input-field){border:1px solid var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C))}.select__input[invalid]::part(input-field){border:1px solid var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.select__input vaadin-date-picker-overlay-content>vaadin-button{color:var(--emfe-w-color-black, #000000)}.select__input::part(input-field){font-family:inherit;width:100%;height:44px;border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);background-color:var(--emfe-w-color-white, #FFFFFF);color:var(--emfe-w-color-black, #000000);border-radius:5px;font-size:16px;font-weight:300;line-height:1.5}.select__input::part(toggle-button){position:relative;right:10px}.select__input>input{padding:5px 15px}.select__error-message{position:absolute;top:calc(100% + 5px);left:0;color:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.select__tooltip-icon{width:16px;height:auto}.select__tooltip{position:absolute;top:0;left:20px;background-color:var(--emfe-w-color-white, #FFFFFF);border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.select__tooltip.visible{opacity:1}";
|
|
7
|
-
|
|
8
|
-
const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this.__registerHost();
|
|
12
|
-
this.__attachShadow();
|
|
13
|
-
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
14
|
-
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
15
|
-
/**
|
|
16
|
-
* Default value for the input.
|
|
17
|
-
*/
|
|
18
|
-
this.defaultValue = '';
|
|
19
|
-
/**
|
|
20
|
-
* Options of the input.
|
|
21
|
-
*/
|
|
22
|
-
this.options = [];
|
|
23
|
-
/**
|
|
24
|
-
* Client custom styling via inline style
|
|
25
|
-
*/
|
|
26
|
-
this.clientStyling = '';
|
|
27
|
-
this.limitStylingAppends = false;
|
|
28
|
-
this.showTooltip = false;
|
|
29
|
-
this.touched = false;
|
|
30
|
-
this.handleChange = (event) => {
|
|
31
|
-
this.touched = true;
|
|
32
|
-
const selectedValue = event.target.value;
|
|
33
|
-
// Find the original option based on case-insensitive comparison
|
|
34
|
-
const originalOption = this.options.find(option => option.value.toLowerCase() === selectedValue.toLowerCase());
|
|
35
|
-
if (originalOption) {
|
|
36
|
-
this.value = originalOption.value;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.value = selectedValue;
|
|
40
|
-
}
|
|
41
|
-
this.isValid = this.setValidity();
|
|
42
|
-
this.errorMessage = this.setErrorMessage();
|
|
43
|
-
this.emitValueHandler(true);
|
|
44
|
-
};
|
|
45
|
-
this.setClientStyling = () => {
|
|
46
|
-
let sheet = document.createElement('style');
|
|
47
|
-
sheet.innerHTML = this.clientStyling;
|
|
48
|
-
this.stylingContainer.prepend(sheet);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
validityChanged() {
|
|
52
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
53
|
-
if (this.emitValue == true) {
|
|
54
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
validityStateHandler(inputStateEvent) {
|
|
58
|
-
this.sendValidityState.emit(inputStateEvent);
|
|
59
|
-
}
|
|
60
|
-
emitValueHandler(newValue) {
|
|
61
|
-
if (newValue == true && this.isValid) {
|
|
62
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
valueHandler(inputValueEvent) {
|
|
66
|
-
this.sendInputValue.emit(inputValueEvent);
|
|
67
|
-
}
|
|
68
|
-
handleClickOutside(event) {
|
|
69
|
-
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
70
|
-
return;
|
|
71
|
-
if (event.composedPath()[0] !== this.tooltipReference)
|
|
72
|
-
this.showTooltip = false;
|
|
73
|
-
}
|
|
74
|
-
connectedCallback() {
|
|
75
|
-
this.displayedOptions = this.options.map(option => ({
|
|
76
|
-
label: option.label,
|
|
77
|
-
value: option.value.toUpperCase()
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
componentWillLoad() {
|
|
81
|
-
if (this.action && !this.options.length) {
|
|
82
|
-
if (this.action.split(" ")[0] == 'GET') {
|
|
83
|
-
const endpoint = this.action.split(" ")[1];
|
|
84
|
-
return this.getOptions(endpoint).then((options) => {
|
|
85
|
-
const firstKey = Object.keys(options)[0];
|
|
86
|
-
this.displayedOptions = options[firstKey].map(option => {
|
|
87
|
-
return { label: option.Name, value: option.Alpha2Code };
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
componentDidRender() {
|
|
94
|
-
// start custom styling area
|
|
95
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
96
|
-
if (this.clientStyling)
|
|
97
|
-
this.setClientStyling();
|
|
98
|
-
this.limitStylingAppends = true;
|
|
99
|
-
}
|
|
100
|
-
// end custom styling area
|
|
101
|
-
}
|
|
102
|
-
componentDidLoad() {
|
|
103
|
-
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
104
|
-
this.isValid = this.setValidity();
|
|
105
|
-
if (this.defaultValue) {
|
|
106
|
-
this.value = this.defaultValue.toUpperCase();
|
|
107
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
getOptions(endpoint) {
|
|
111
|
-
const url = new URL(endpoint);
|
|
112
|
-
return new Promise((resolve, reject) => {
|
|
113
|
-
fetch(url.href)
|
|
114
|
-
.then((res) => res.json())
|
|
115
|
-
.then((options) => {
|
|
116
|
-
resolve(options);
|
|
117
|
-
}).catch((err) => {
|
|
118
|
-
console.error(err);
|
|
119
|
-
reject(err);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
setValidity() {
|
|
124
|
-
return this.inputReference.validity.valid;
|
|
125
|
-
}
|
|
126
|
-
setErrorMessage() {
|
|
127
|
-
if (this.inputReference.validity.valueMissing) {
|
|
128
|
-
return translate('requiredError', this.language);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
renderTooltip() {
|
|
132
|
-
if (this.showTooltip) {
|
|
133
|
-
return (h("div", { class: `select__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
134
|
-
}
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
render() {
|
|
138
|
-
let invalidClass = '';
|
|
139
|
-
if (this.touched) {
|
|
140
|
-
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'select__input--invalid';
|
|
141
|
-
}
|
|
142
|
-
return h("div", { class: `select__wrapper ${this.autofilled ? 'select__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'select__wrapper--flex' }, h("label", { class: `select__label ${this.validation.mandatory ? 'select__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'select__wrapper--relative' }, this.tooltip &&
|
|
143
|
-
h("img", { class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleChange }), h("small", { class: 'select__error-message' }, this.errorMessage));
|
|
144
|
-
}
|
|
145
|
-
get element() { return this; }
|
|
146
|
-
static get watchers() { return {
|
|
147
|
-
"isValid": ["validityChanged"],
|
|
148
|
-
"emitValue": ["emitValueHandler"]
|
|
149
|
-
}; }
|
|
150
|
-
static get style() { return selectInputCss; }
|
|
151
|
-
}, [1, "select-input", {
|
|
152
|
-
"name": [513],
|
|
153
|
-
"displayName": [513, "display-name"],
|
|
154
|
-
"placeholder": [513],
|
|
155
|
-
"action": [513],
|
|
156
|
-
"defaultValue": [513, "default-value"],
|
|
157
|
-
"autofilled": [516],
|
|
158
|
-
"tooltip": [513],
|
|
159
|
-
"options": [16],
|
|
160
|
-
"validation": [16],
|
|
161
|
-
"language": [513],
|
|
162
|
-
"emitValue": [516, "emit-value"],
|
|
163
|
-
"clientStyling": [513, "client-styling"],
|
|
164
|
-
"errorMessage": [32],
|
|
165
|
-
"isValid": [32],
|
|
166
|
-
"limitStylingAppends": [32],
|
|
167
|
-
"showTooltip": [32]
|
|
168
|
-
}, [[4, "click", "handleClickOutside"]]]);
|
|
169
|
-
function defineCustomElement() {
|
|
170
|
-
if (typeof customElements === "undefined") {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const components = ["select-input"];
|
|
174
|
-
components.forEach(tagName => { switch (tagName) {
|
|
175
|
-
case "select-input":
|
|
176
|
-
if (!customElements.get(tagName)) {
|
|
177
|
-
customElements.define(tagName, SelectInput);
|
|
178
|
-
}
|
|
179
|
-
break;
|
|
180
|
-
} });
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export { SelectInput as S, defineCustomElement as d };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface TelInput extends Components.TelInput, HTMLElement {}
|
|
4
|
-
export const TelInput: {
|
|
5
|
-
prototype: TelInput;
|
|
6
|
-
new (): TelInput;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
|
-
import './input-field-shared-styles.js';
|
|
4
|
-
import './vaadin-combo-box.js';
|
|
5
|
-
|
|
6
|
-
const telInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.tel{font-family:\"Roboto\";font-style:normal}.tel__wrapper{position:relative;width:100%;display:flex;flex-direction:column;gap:5px}.tel__wrapper--autofilled{pointer-events:none}.tel__wrapper--autofilled .tel__label{color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.tel__wrapper--autofilled .tel__input::part(input-field){color:var(--emfe-w-color-black, #000000)}.tel__wrapper--flex{width:inherit;display:flex;align-items:center;border-radius:4px;border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);background-color:var(--emfe-w-color-white, #FFFFFF);overflow:hidden}.tel__wrapper--flex:focus-within{border-color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C))}.tel__wrapper--flex--invalid{border:1px solid var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.tel__wrapper--flex-label{display:flex;gap:5px}.tel__wrapper--flex--relative{position:relative}.tel__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.tel__label--required::after{content:\"*\";font-family:inherit;color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));margin-left:2px}.tel__prefix{--vaadin-field-default-width:90px}.tel__prefix[focus]{outline:none}.tel__prefix::part(input-field){border-radius:0 5px 5px 0;background-color:var(--emfe-w-color-white, #FFFFFF);color:var(--emfe-w-color-black, #000000);font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:1.5;border:none;border-right:2px solid #DDE0EE;border-image-source:linear-gradient(to bottom, rgba(221, 224, 238, 0) 25%, #dde0ee 25%, #dde0ee 75%, rgba(221, 224, 238, 0) 75%);border-image-slice:1;border-image-repeat:round}.tel__prefix::part(input-field):hover{background-color:var(--emfe-w-color-white, #FFFFFF)}.tel__prefix::part(toggle-button){color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.tel__input{font-family:inherit;border-radius:5px;width:100%;color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));background-color:var(--emfe-w-color-white, #FFFFFF);border:none;width:inherit;position:relative;font-size:16px;font-weight:300;line-height:1.5;padding:5px 15px;height:42px;-moz-appearance:textfield;}.tel__input:focus{outline:none}.tel__input::-webkit-outer-spin-button,.tel__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.tel__input::placeholder{color:var(--emfe-w-color-gray-150, #979797)}.tel__error-message{position:absolute;top:calc(100% + 5px);left:0;color:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.tel__tooltip-icon{width:16px;height:auto}.tel__tooltip{position:absolute;top:0;left:20px;background-color:var(--emfe-w-color-white, #FFFFFF);border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.tel__tooltip.visible{opacity:1}";
|
|
7
|
-
|
|
8
|
-
const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this.__registerHost();
|
|
12
|
-
this.__attachShadow();
|
|
13
|
-
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
14
|
-
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
15
|
-
/**
|
|
16
|
-
* Client custom styling via inline style
|
|
17
|
-
*/
|
|
18
|
-
this.clientStyling = '';
|
|
19
|
-
this.limitStylingAppends = false;
|
|
20
|
-
this.showTooltip = false;
|
|
21
|
-
this.validationPattern = '';
|
|
22
|
-
this.touched = false;
|
|
23
|
-
this.handleInput = (event) => {
|
|
24
|
-
this.phoneValue = event.target.value;
|
|
25
|
-
this.value = { prefix: this.prefixValue, phone: this.phoneValue };
|
|
26
|
-
this.touched = true;
|
|
27
|
-
if (this.debounceTime) {
|
|
28
|
-
clearTimeout(this.debounceTime);
|
|
29
|
-
}
|
|
30
|
-
this.debounceTime = setTimeout(() => {
|
|
31
|
-
this.isValid = this.setValidity();
|
|
32
|
-
this.errorMessage = this.setErrorMessage();
|
|
33
|
-
this.emitValueHandler(true);
|
|
34
|
-
}, 500);
|
|
35
|
-
};
|
|
36
|
-
this.handleBlur = () => {
|
|
37
|
-
this.isValid = this.setValidity();
|
|
38
|
-
this.touched = true;
|
|
39
|
-
this.errorMessage = this.setErrorMessage();
|
|
40
|
-
};
|
|
41
|
-
this.setClientStyling = () => {
|
|
42
|
-
let sheet = document.createElement('style');
|
|
43
|
-
sheet.innerHTML = this.clientStyling;
|
|
44
|
-
this.stylingContainer.prepend(sheet);
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
validityChanged() {
|
|
48
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
49
|
-
if (this.emitValue == true) {
|
|
50
|
-
this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
validityStateHandler(inputStateEvent) {
|
|
54
|
-
this.sendValidityState.emit(inputStateEvent);
|
|
55
|
-
}
|
|
56
|
-
emitValueHandler(newValue) {
|
|
57
|
-
if (newValue == true && this.isValid) {
|
|
58
|
-
this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
valueHandler(inputValueEvent) {
|
|
62
|
-
this.sendInputValue.emit(inputValueEvent);
|
|
63
|
-
}
|
|
64
|
-
handleClickOutside(event) {
|
|
65
|
-
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
66
|
-
return;
|
|
67
|
-
if (event.composedPath()[0] !== this.tooltipReference)
|
|
68
|
-
this.showTooltip = false;
|
|
69
|
-
}
|
|
70
|
-
connectedCallback() {
|
|
71
|
-
this.validationPattern = this.setPattern();
|
|
72
|
-
if (this.defaultValue) {
|
|
73
|
-
this.prefixValue = this.defaultValue.prefix ? this.defaultValue.prefix : this.defaultValue;
|
|
74
|
-
this.phoneValue = this.defaultValue.phone || null;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
componentWillLoad() {
|
|
78
|
-
if (this.action) {
|
|
79
|
-
if (this.action.split(" ")[0] == 'GET') {
|
|
80
|
-
const endpoint = this.action.split(" ")[1];
|
|
81
|
-
return this.getPhoneCodes(endpoint).then((options) => {
|
|
82
|
-
this.phoneCodesOptions = options.phoneCodes.map(code => {
|
|
83
|
-
return { label: code.Prefix || code, value: code.Prefix || code };
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
componentDidRender() {
|
|
90
|
-
// start custom styling area
|
|
91
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
92
|
-
if (this.clientStyling)
|
|
93
|
-
this.setClientStyling();
|
|
94
|
-
this.limitStylingAppends = true;
|
|
95
|
-
}
|
|
96
|
-
// end custom styling area
|
|
97
|
-
}
|
|
98
|
-
componentDidLoad() {
|
|
99
|
-
this.isValid = this.setValidity();
|
|
100
|
-
if (this.defaultValue) {
|
|
101
|
-
this.value = this.defaultValue;
|
|
102
|
-
this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
getPhoneCodes(endpoint) {
|
|
106
|
-
const url = new URL(endpoint);
|
|
107
|
-
return new Promise((resolve, reject) => {
|
|
108
|
-
fetch(url.href)
|
|
109
|
-
.then((res) => res.json())
|
|
110
|
-
.then((options) => {
|
|
111
|
-
resolve(options);
|
|
112
|
-
}).catch((err) => {
|
|
113
|
-
console.error(err);
|
|
114
|
-
reject(err);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
handlePrefixInput(event) {
|
|
119
|
-
this.prefixValue = event.target.value;
|
|
120
|
-
this.value = { prefix: this.prefixValue, phone: this.phoneValue };
|
|
121
|
-
this.emitValueHandler(true);
|
|
122
|
-
}
|
|
123
|
-
setValidity() {
|
|
124
|
-
return this.inputReference.validity.valid;
|
|
125
|
-
}
|
|
126
|
-
setPattern() {
|
|
127
|
-
var _a, _b;
|
|
128
|
-
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
129
|
-
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
setErrorMessage() {
|
|
133
|
-
var _a, _b;
|
|
134
|
-
if (this.inputReference.validity.patternMismatch) {
|
|
135
|
-
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
136
|
-
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
137
|
-
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
138
|
-
}
|
|
139
|
-
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
140
|
-
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
141
|
-
}
|
|
142
|
-
if (this.inputReference.validity.valueMissing) {
|
|
143
|
-
return translate('requiredError', this.language);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
renderTooltip() {
|
|
147
|
-
if (this.showTooltip) {
|
|
148
|
-
return (h("div", { class: `tel__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
149
|
-
}
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
render() {
|
|
153
|
-
let invalidClass = '';
|
|
154
|
-
if (this.touched) {
|
|
155
|
-
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__wrapper--flex--invalid';
|
|
156
|
-
}
|
|
157
|
-
return h("div", { class: `tel__wrapper ${this.autofilled ? 'tel__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'tel__wrapper--flex-label' }, h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'tel__wrapper--relative' }, this.tooltip &&
|
|
158
|
-
h("img", { class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("div", { class: `tel__wrapper--flex ${invalidClass}` }, h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onChange: (e) => this.handlePrefixInput(e) }), h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: this.phoneValue, placeholder: `${this.placeholder || ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onInput: this.handleInput, onBlur: this.handleBlur })), h("small", { class: 'tel__error-message' }, this.errorMessage));
|
|
159
|
-
}
|
|
160
|
-
static get watchers() { return {
|
|
161
|
-
"isValid": ["validityChanged"],
|
|
162
|
-
"emitValue": ["emitValueHandler"]
|
|
163
|
-
}; }
|
|
164
|
-
static get style() { return telInputCss; }
|
|
165
|
-
}, [1, "tel-input", {
|
|
166
|
-
"name": [513],
|
|
167
|
-
"displayName": [513, "display-name"],
|
|
168
|
-
"placeholder": [513],
|
|
169
|
-
"showLabels": [516, "show-labels"],
|
|
170
|
-
"action": [513],
|
|
171
|
-
"validation": [16],
|
|
172
|
-
"defaultValue": [520, "default-value"],
|
|
173
|
-
"autofilled": [516],
|
|
174
|
-
"tooltip": [513],
|
|
175
|
-
"language": [513],
|
|
176
|
-
"emitValue": [516, "emit-value"],
|
|
177
|
-
"clientStyling": [513, "client-styling"],
|
|
178
|
-
"isValid": [32],
|
|
179
|
-
"errorMessage": [32],
|
|
180
|
-
"limitStylingAppends": [32],
|
|
181
|
-
"showTooltip": [32]
|
|
182
|
-
}, [[4, "click", "handleClickOutside"]]]);
|
|
183
|
-
function defineCustomElement() {
|
|
184
|
-
if (typeof customElements === "undefined") {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const components = ["tel-input"];
|
|
188
|
-
components.forEach(tagName => { switch (tagName) {
|
|
189
|
-
case "tel-input":
|
|
190
|
-
if (!customElements.get(tagName)) {
|
|
191
|
-
customElements.define(tagName, TelInput);
|
|
192
|
-
}
|
|
193
|
-
break;
|
|
194
|
-
} });
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export { TelInput as T, defineCustomElement as d };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface TextInput extends Components.TextInput, HTMLElement {}
|
|
4
|
-
export const TextInput: {
|
|
5
|
-
prototype: TextInput;
|
|
6
|
-
new (): TextInput;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|