@everymatrix/general-registration 1.10.19 → 1.10.20
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/{checkbox-input_11.cjs.entry.js → checkbox-group-input_12.cjs.entry.js} +18994 -12733
- package/dist/cjs/general-registration.cjs.js +2 -2
- package/dist/cjs/{index-5b4544e8.js → index-dfef7446.js} +41 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/general-registration/general-registration.js +85 -26
- package/dist/collection/utils/locale.utils.js +13 -3
- package/dist/components/active-mixin.js +975 -0
- package/dist/components/checkbox-group-input.js +6 -0
- package/dist/components/checkbox-group-input2.js +1121 -0
- package/dist/components/date-input2.js +5064 -4
- package/dist/components/email-input2.js +2 -1
- package/dist/components/field-mixin.js +12712 -0
- package/dist/components/general-input2.js +20 -11
- package/dist/components/general-registration.js +101 -27
- package/dist/components/input-field-shared-styles.js +403 -13065
- package/dist/components/number-input2.js +2 -1
- package/dist/components/password-input2.js +51 -11
- package/dist/components/pattern-mixin.js +2 -1
- package/dist/components/select-input2.js +5 -4
- package/dist/components/tel-input2.js +7 -1
- package/dist/components/text-input2.js +15 -3
- package/dist/components/tooltipIcon.js +9 -5
- package/dist/components/vaadin-button.js +3 -974
- package/dist/components/vaadin-combo-box.js +12 -27
- package/dist/components/virtual-keyboard-controller.js +3 -38
- package/dist/esm/{checkbox-input_11.entry.js → checkbox-group-input_12.entry.js} +18994 -12734
- package/dist/esm/general-registration.js +2 -2
- package/dist/esm/{index-5b8d16cc.js → index-fdb6785f.js} +41 -1
- package/dist/esm/loader.js +2 -2
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/dist/general-registration/p-64b59a7b.js +1 -0
- package/dist/general-registration/p-cb8af7e3.entry.js +3582 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +22 -5
- package/dist/types/components/general-registration/general-registration.d.ts +7 -3
- package/dist/types/components.d.ts +10 -2
- package/dist/types/utils/locale.utils.d.ts +8 -0
- package/package.json +4 -2
- package/dist/general-registration/p-0f29dba0.entry.js +0 -3274
- package/dist/general-registration/p-cba9c0b1.js +0 -1
|
@@ -99,7 +99,7 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
99
99
|
render() {
|
|
100
100
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'number__input--invalid';
|
|
101
101
|
return h("div", { class: 'number__wrapper', ref: el => this.stylingContainer = el }, h("div", { class: 'number__wrapper--flex' }, h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'number__wrapper--relative' }, this.tooltip &&
|
|
102
|
-
h("img", { class: 'number__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, readOnly: this.autofilled, id: `${this.name}__input`, class: `number__input ${invalidClass}`, pattern: this.validationPattern, placeholder: `${this.
|
|
102
|
+
h("img", { class: 'number__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, readOnly: this.autofilled, id: `${this.name}__input`, class: `number__input ${invalidClass}`, pattern: this.validationPattern, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onBlur: (e) => this.handleInput(e) }), h("small", { class: 'number__error-message' }, this.errorMessage));
|
|
103
103
|
}
|
|
104
104
|
static get watchers() { return {
|
|
105
105
|
"isValid": ["validityChanged"],
|
|
@@ -109,6 +109,7 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
109
109
|
}, [1, "number-input", {
|
|
110
110
|
"name": [513],
|
|
111
111
|
"displayName": [513, "display-name"],
|
|
112
|
+
"placeholder": [513],
|
|
112
113
|
"validation": [16],
|
|
113
114
|
"defaultValue": [513, "default-value"],
|
|
114
115
|
"autofilled": [516],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
|
-
import {
|
|
3
|
+
import { i as inputFieldShared, c as InputControlMixin, d as inputFieldShared$1 } from './input-field-shared-styles.js';
|
|
4
|
+
import { r as registerStyles, h as html, e as InputController, f as LabelledInputController, g as TooltipController, T as ThemableMixin, E as ElementMixin, P as PolymerElement, i, S as SlotController } from './field-mixin.js';
|
|
4
5
|
import { P as PatternMixin } from './pattern-mixin.js';
|
|
5
6
|
import { b as button, B as Button } from './vaadin-button.js';
|
|
6
7
|
|
|
@@ -718,7 +719,7 @@ class PasswordField extends TextField {
|
|
|
718
719
|
|
|
719
720
|
customElements.define(PasswordField.is, PasswordField);
|
|
720
721
|
|
|
721
|
-
const passwordInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password{font-family:\"Roboto\";font-style:normal}.password__wrapper{
|
|
722
|
+
const passwordInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password{font-family:\"Roboto\";font-style:normal}.password__wrapper{width:100%}.password__wrapper--flex{display:flex;gap:5px}.password__wrapper--relative{position:relative}.password__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F}.password__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;margin-left:2px}.password__input{width:inherit;border:none;margin-bottom:5px}.password__input[focused]::part(input-field){border-color:#3E3E3E}.password__input[invalid]::part(input-field){border-color:#cc0000b3}.password__input::part(input-field){border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;width:100%;position:relative;border:2px solid #DEE1EE}.password__error-message{color:#cc0000b3}.password__complexity{position:relative;padding:10px;display:flex;flex-direction:column;gap:20px;justify-content:center;margin-top:20px;font-weight:300;background:#FFFFFF;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;height:150px;border:1px solid #B0B0B0}.password__complexity--strength{display:flex;justify-content:space-evenly}.password__complexity--strength meter::-webkit-meter-optimum-value{background:#1F1F1F}.password__complexity--strength meter::-moz-meter-bar{background:#B0B0B0}.password__complexity--text-bold{font-weight:500}.password__complexity--checkbox{margin-right:5px}.password__complexity:after{content:\"\";position:absolute;width:25px;height:25px;border-top:1px solid #B0B0B0;border-right:0 solid #B0B0B0;border-left:1px solid #B0B0B0;border-bottom:0 solid #B0B0B0;bottom:92%;left:50%;margin-left:-25px;transform:rotate(45deg);margin-top:-25px;background-color:#FFFFFF}.password__tooltip-icon{width:16px;height:auto}.password__tooltip{position:absolute;top:0;left:20px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.password__tooltip.visible{opacity:1}";
|
|
722
723
|
|
|
723
724
|
const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
724
725
|
constructor() {
|
|
@@ -737,8 +738,11 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
737
738
|
this.clientStyling = '';
|
|
738
739
|
this.limitStylingAppends = false;
|
|
739
740
|
this.showTooltip = false;
|
|
741
|
+
this.showPopup = true;
|
|
742
|
+
this.touched = false;
|
|
740
743
|
this.value = '';
|
|
741
744
|
this.validationPattern = '';
|
|
745
|
+
this.duplicateInputValue = null;
|
|
742
746
|
this.setClientStyling = () => {
|
|
743
747
|
let sheet = document.createElement('style');
|
|
744
748
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -768,6 +772,10 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
768
772
|
this.duplicateInputValue = event.detail.value;
|
|
769
773
|
}
|
|
770
774
|
}
|
|
775
|
+
if (this.name === event.detail.name + 'Duplicate' && this.name.replace('Duplicate', '') === event.detail.name && this.touched === true) {
|
|
776
|
+
this.isValid = this.setValidity();
|
|
777
|
+
this.errorMessage = this.setErrorMessage();
|
|
778
|
+
}
|
|
771
779
|
}
|
|
772
780
|
handleClickOutside(event) {
|
|
773
781
|
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
@@ -776,7 +784,7 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
776
784
|
this.showTooltip = false;
|
|
777
785
|
}
|
|
778
786
|
connectedCallback() {
|
|
779
|
-
this.validationPattern = this.setPattern();
|
|
787
|
+
// this.validationPattern = this.setPattern();
|
|
780
788
|
}
|
|
781
789
|
componentDidRender() {
|
|
782
790
|
// start custom styling area
|
|
@@ -786,23 +794,43 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
786
794
|
this.limitStylingAppends = true;
|
|
787
795
|
}
|
|
788
796
|
// end custom styling area
|
|
797
|
+
}
|
|
798
|
+
componentDidLoad() {
|
|
799
|
+
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
800
|
+
this.passwordButton = this.element.shadowRoot.querySelector('vaadin-password-field-button');
|
|
801
|
+
this.passwordButton.tabIndex = -1;
|
|
789
802
|
if (this.defaultValue) {
|
|
790
803
|
this.value = this.defaultValue;
|
|
804
|
+
this.calculateComplexity(this.value);
|
|
791
805
|
this.valueHandler({ name: this.name, value: this.value });
|
|
792
806
|
}
|
|
793
807
|
}
|
|
794
|
-
componentDidLoad() {
|
|
795
|
-
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
796
|
-
}
|
|
797
808
|
handleInput(event) {
|
|
798
809
|
this.value = event.target.value;
|
|
810
|
+
this.calculateComplexity(this.value);
|
|
811
|
+
this.showPopup = true;
|
|
799
812
|
this.errorMessage = this.setErrorMessage();
|
|
800
813
|
this.isValid = this.setValidity();
|
|
801
814
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
802
815
|
this.emitValueHandler(true);
|
|
816
|
+
this.touched = true;
|
|
817
|
+
}
|
|
818
|
+
calculateComplexity(password) {
|
|
819
|
+
this.passwordComplexity = this.validation.custom
|
|
820
|
+
.filter(rule => rule.rule === 'regex')
|
|
821
|
+
.map(rule => {
|
|
822
|
+
const ruleRegex = new RegExp(rule.pattern);
|
|
823
|
+
const passed = ruleRegex.test(password);
|
|
824
|
+
return { rule: rule.displayName, passed };
|
|
825
|
+
});
|
|
803
826
|
}
|
|
804
827
|
setValidity() {
|
|
805
|
-
|
|
828
|
+
if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
|
|
829
|
+
return false;
|
|
830
|
+
}
|
|
831
|
+
else {
|
|
832
|
+
return this.inputReference.validity.valid;
|
|
833
|
+
}
|
|
806
834
|
}
|
|
807
835
|
setPattern() {
|
|
808
836
|
var _a, _b;
|
|
@@ -831,12 +859,21 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
831
859
|
}
|
|
832
860
|
return null;
|
|
833
861
|
}
|
|
862
|
+
renderComplexityPopup() {
|
|
863
|
+
const totalRules = this.passwordComplexity.length;
|
|
864
|
+
const passedRules = this.passwordComplexity.filter(complexity => complexity.passed).length;
|
|
865
|
+
const meterValue = passedRules / totalRules;
|
|
866
|
+
const allRulesPassed = this.passwordComplexity.every(complexity => complexity.passed);
|
|
867
|
+
if (this.showPopup === false)
|
|
868
|
+
return;
|
|
869
|
+
return (h("div", { class: `password__complexity` }, h("div", { class: 'password__complexity--strength' }, h("p", { class: 'password__complexity--text' }, translate('passwordStrength', this.language), "\u00A0", h("span", { class: 'password__complexity--text-bold' }, translate(`${allRulesPassed ? 'passwordStrengthStrong' : 'passwordStrengthWeak'}`, this.language))), h("meter", { value: meterValue, min: "0", max: "1" })), h("div", null, this.passwordComplexity.map((complexity, index) => {
|
|
870
|
+
return (h("div", { key: index }, h("input", { class: 'password__complexity--checkbox', type: "checkbox", checked: complexity.passed, disabled: true }), h("span", null, complexity.rule)));
|
|
871
|
+
}))));
|
|
872
|
+
}
|
|
834
873
|
render() {
|
|
835
874
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'password__input--invalid';
|
|
836
875
|
return h("div", { class: 'password__wrapper', ref: el => this.stylingContainer = el }, h("div", { class: 'password__wrapper--flex' }, h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'password__wrapper--relative' }, this.tooltip &&
|
|
837
|
-
h("img", { class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-password-field", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue,
|
|
838
|
-
// ref={(el) => this.inputReference = el as HTMLInputElement}
|
|
839
|
-
required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, onBlur: (e) => this.handleInput(e) }), h("small", { class: 'password__error-message' }, this.errorMessage));
|
|
876
|
+
h("img", { class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-password-field", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue, required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, onInput: (e) => this.handleInput(e), onBlur: () => this.showPopup = false, onFocus: () => this.showPopup = true }), h("small", { class: 'password__error-message' }, this.errorMessage), this.passwordComplexity && !this.isDuplicateInput && this.renderComplexityPopup());
|
|
840
877
|
}
|
|
841
878
|
get element() { return this; }
|
|
842
879
|
static get watchers() { return {
|
|
@@ -847,6 +884,7 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
847
884
|
}, [1, "password-input", {
|
|
848
885
|
"name": [513],
|
|
849
886
|
"displayName": [513, "display-name"],
|
|
887
|
+
"placeholder": [513],
|
|
850
888
|
"defaultValue": [513, "default-value"],
|
|
851
889
|
"autofilled": [516],
|
|
852
890
|
"tooltip": [513],
|
|
@@ -858,7 +896,9 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
858
896
|
"isValid": [32],
|
|
859
897
|
"errorMessage": [32],
|
|
860
898
|
"limitStylingAppends": [32],
|
|
861
|
-
"showTooltip": [32]
|
|
899
|
+
"showTooltip": [32],
|
|
900
|
+
"passwordComplexity": [32],
|
|
901
|
+
"showPopup": [32]
|
|
862
902
|
}, [[16, "sendInputValue", "valueChangedHandler"], [4, "click", "handleClickOutside"]]]);
|
|
863
903
|
function defineCustomElement() {
|
|
864
904
|
if (typeof customElements === "undefined") {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as Debouncer, z as timeOut } from './field-mixin.js';
|
|
2
|
+
import { I as InputConstraintsMixin } from './input-field-shared-styles.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @license
|
|
@@ -77,14 +77,14 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
77
77
|
this.limitStylingAppends = true;
|
|
78
78
|
}
|
|
79
79
|
// end custom styling area
|
|
80
|
+
}
|
|
81
|
+
componentDidLoad() {
|
|
82
|
+
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
80
83
|
if (this.defaultValue) {
|
|
81
84
|
this.value = this.defaultValue;
|
|
82
85
|
this.valueHandler({ name: this.name, value: this.value });
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
|
-
componentDidLoad() {
|
|
86
|
-
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
87
|
-
}
|
|
88
88
|
getOptions() {
|
|
89
89
|
// TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
|
|
90
90
|
const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/countries");
|
|
@@ -123,7 +123,7 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
123
123
|
render() {
|
|
124
124
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'select__input--invalid';
|
|
125
125
|
return h("div", { class: 'select__wrapper', ref: el => this.stylingContainer = el }, h("div", { class: 'select__wrapper--flex' }, h("label", { class: 'select__label', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), h("div", { class: 'select__wrapper--relative' }, this.tooltip &&
|
|
126
|
-
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}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.
|
|
126
|
+
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}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, items: this.displayedOptions, onChange: (e) => this.handleChange(e) }), h("small", { class: 'select__error-message' }, this.errorMessage));
|
|
127
127
|
}
|
|
128
128
|
get element() { return this; }
|
|
129
129
|
static get watchers() { return {
|
|
@@ -134,6 +134,7 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
134
134
|
}, [1, "select-input", {
|
|
135
135
|
"name": [513],
|
|
136
136
|
"displayName": [513, "display-name"],
|
|
137
|
+
"placeholder": [513],
|
|
137
138
|
"action": [513],
|
|
138
139
|
"defaultValue": [513, "default-value"],
|
|
139
140
|
"autofilled": [516],
|
|
@@ -101,6 +101,11 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
101
101
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
102
102
|
this.emitValueHandler(true);
|
|
103
103
|
}
|
|
104
|
+
handlePrefixInput(event) {
|
|
105
|
+
this.prefixValue = event.target.value;
|
|
106
|
+
this.value = `${this.prefixValue}|${this.phoneValue}`;
|
|
107
|
+
this.emitValueHandler(true);
|
|
108
|
+
}
|
|
104
109
|
setValidity() {
|
|
105
110
|
return this.inputReference.validity.valid;
|
|
106
111
|
}
|
|
@@ -131,7 +136,7 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
131
136
|
render() {
|
|
132
137
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__wrapper--flex--invalid';
|
|
133
138
|
return h("div", { class: 'tel__wrapper', 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 &&
|
|
134
|
-
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.
|
|
139
|
+
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} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onBlur: (e) => this.handleInput(e) })), h("small", { class: 'tel__error-message' }, this.errorMessage));
|
|
135
140
|
}
|
|
136
141
|
static get watchers() { return {
|
|
137
142
|
"isValid": ["validityChanged"],
|
|
@@ -141,6 +146,7 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
141
146
|
}, [1, "tel-input", {
|
|
142
147
|
"name": [513],
|
|
143
148
|
"displayName": [513, "display-name"],
|
|
149
|
+
"placeholder": [513],
|
|
144
150
|
"showLabels": [516, "show-labels"],
|
|
145
151
|
"action": [513],
|
|
146
152
|
"validation": [16],
|
|
@@ -22,8 +22,9 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
22
22
|
this.limitStylingAppends = false;
|
|
23
23
|
this.showTooltip = false;
|
|
24
24
|
this.value = '';
|
|
25
|
-
this.customRules = [];
|
|
26
25
|
this.validationPattern = '';
|
|
26
|
+
this.duplicateInputValue = null;
|
|
27
|
+
this.touched = false;
|
|
27
28
|
this.setClientStyling = () => {
|
|
28
29
|
let sheet = document.createElement('style');
|
|
29
30
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -58,6 +59,10 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
58
59
|
this.duplicateInputValue = event.detail.value;
|
|
59
60
|
}
|
|
60
61
|
}
|
|
62
|
+
if (this.name === event.detail.name + 'Duplicate' && this.name.replace('Duplicate', '') === event.detail.name && this.touched === true) {
|
|
63
|
+
this.isValid = this.setValidity();
|
|
64
|
+
this.errorMessage = this.setErrorMessage();
|
|
65
|
+
}
|
|
61
66
|
}
|
|
62
67
|
connectedCallback() {
|
|
63
68
|
this.validationPattern = this.setPattern();
|
|
@@ -81,9 +86,15 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
81
86
|
this.errorMessage = this.setErrorMessage();
|
|
82
87
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
83
88
|
this.emitValueHandler(true);
|
|
89
|
+
this.touched = true;
|
|
84
90
|
}
|
|
85
91
|
setValidity() {
|
|
86
|
-
|
|
92
|
+
if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return this.inputReference.validity.valid;
|
|
97
|
+
}
|
|
87
98
|
}
|
|
88
99
|
setPattern() {
|
|
89
100
|
var _a, _b;
|
|
@@ -115,7 +126,7 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
115
126
|
render() {
|
|
116
127
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
117
128
|
return h("div", { class: 'text__wrapper', ref: el => this.stylingContainer = el }, h("div", { class: 'text__wrapper--flex' }, h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'text__wrapper--relative' }, this.tooltip &&
|
|
118
|
-
h("img", { class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { name: this.name, id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.
|
|
129
|
+
h("img", { class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { name: this.name, id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onBlur: (e) => { this.handleInput(e); } }), h("small", { class: 'text__error-message' }, this.errorMessage));
|
|
119
130
|
}
|
|
120
131
|
static get watchers() { return {
|
|
121
132
|
"isValid": ["validityChanged"],
|
|
@@ -125,6 +136,7 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
125
136
|
}, [1, "text-input", {
|
|
126
137
|
"name": [513],
|
|
127
138
|
"displayName": [513, "display-name"],
|
|
139
|
+
"placeholder": [513],
|
|
128
140
|
"validation": [16],
|
|
129
141
|
"defaultValue": [513, "default-value"],
|
|
130
142
|
"autofilled": [516],
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
3
2
|
const TRANSLATIONS = {
|
|
4
3
|
"en": {
|
|
5
4
|
"dateError": 'The selected date should be between {min} and {max}',
|
|
6
5
|
"numberLengthError": 'The number should be between {min} and {max}',
|
|
7
6
|
"lengthError": `The length should be between {minLength} and {maxLength}`,
|
|
8
7
|
"requiredError": 'This input is required.',
|
|
8
|
+
"passwordStrength": "Password strength",
|
|
9
|
+
"passwordStrengthWeak": "is not adequate",
|
|
10
|
+
"passwordStrengthStrong": "is adequate",
|
|
9
11
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
12
|
+
"hu": {
|
|
13
|
+
"dateError": 'A választott dátumnak {min} és {max} között kell lennie',
|
|
14
|
+
"numberLengthError": 'A számnak {min} és {max} között kell lennie',
|
|
15
|
+
"lengthError": `A hossznak {minLength} és {maxLength} között kell lennie`,
|
|
16
|
+
"requiredError": 'Ez a beviteli mező kötelező.',
|
|
13
17
|
}
|
|
14
18
|
};
|
|
15
19
|
const translate = (key, customLang, values) => {
|
|
16
20
|
const lang = customLang;
|
|
17
|
-
let translation = TRANSLATIONS[lang !== undefined
|
|
21
|
+
let translation = TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
|
|
18
22
|
if (values !== undefined) {
|
|
19
23
|
for (const [key, value] of Object.entries(values.values)) {
|
|
20
24
|
const regex = new RegExp(`{${key}}`, 'g');
|