@everymatrix/general-registration 1.10.23 → 1.10.25
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-group-input_12.cjs.entry.js → checkbox-group-input_13.cjs.entry.js} +290 -108
- package/dist/cjs/general-registration.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/general-registration/general-registration.css +11 -23
- package/dist/collection/components/general-registration/general-registration.js +100 -57
- package/dist/components/checkbox-group-input2.js +3 -7
- package/dist/components/checkbox-input2.js +2 -2
- package/dist/components/date-input2.js +2 -2
- package/dist/components/email-input2.js +9 -5
- package/dist/components/field-mixin.js +2 -2
- package/dist/components/general-input2.js +214 -22
- package/dist/components/general-registration.js +127 -79
- package/dist/components/number-input2.js +6 -4
- package/dist/components/password-input2.js +37 -14
- package/dist/components/select-input2.js +8 -7
- package/dist/components/tel-input2.js +7 -5
- package/dist/components/text-input2.js +9 -5
- package/dist/components/toggle-checkbox-input.js +6 -0
- package/dist/components/tooltipIcon.js +17 -0
- package/dist/esm/{checkbox-group-input_12.entry.js → checkbox-group-input_13.entry.js} +290 -109
- package/dist/esm/general-registration.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/dist/general-registration/{p-482c4c1e.entry.js → p-01edd755.entry.js} +77 -77
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +1 -0
- package/dist/types/components/general-registration/general-registration.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,7 +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
3
|
|
|
4
|
-
const numberInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.number{font-family:\"Roboto\";font-style:normal}.number__wrapper{position:relative;width:100%}.number__wrapper--flex{display:flex;gap:5px}.number__wrapper--relative{position:relative}.number__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#
|
|
4
|
+
const numberInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.number{font-family:\"Roboto\";font-style:normal}.number__wrapper{position:relative;width:100%}.number__wrapper--flex{display:flex;gap:5px}.number__wrapper--relative{position:relative}.number__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#2A3841}.number__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.number__input{border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;padding:10px 20px;width:inherit;position:relative;border:2px solid #DEE1EE;-moz-appearance:textfield;}.number__input:focus{outline-color:#3E3E3E}.number__input::-webkit-outer-spin-button,.number__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.number__input--invalid{border:2px solid #cc0000b3}.number__input::placeholder{color:#979797}.number__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.number__tooltip-icon{width:16px;height:auto}.number__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}.number__tooltip.visible{opacity:1}";
|
|
5
5
|
|
|
6
6
|
const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -93,9 +93,11 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
setErrorMessage() {
|
|
96
|
-
var _a;
|
|
96
|
+
var _a, _b;
|
|
97
97
|
if (this.inputReference.validity.patternMismatch) {
|
|
98
|
-
|
|
98
|
+
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
99
|
+
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
100
|
+
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
99
101
|
}
|
|
100
102
|
if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
|
|
101
103
|
return translate('numberLengthError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
|
|
@@ -111,7 +113,7 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
111
113
|
return null;
|
|
112
114
|
}
|
|
113
115
|
render() {
|
|
114
|
-
let invalidClass;
|
|
116
|
+
let invalidClass = '';
|
|
115
117
|
if (this.touched) {
|
|
116
118
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
117
119
|
}
|
|
@@ -560,7 +560,8 @@ class PasswordField extends TextField {
|
|
|
560
560
|
super();
|
|
561
561
|
this._setType('password');
|
|
562
562
|
this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
|
|
563
|
-
this.
|
|
563
|
+
this.__boundRevealButtonMouseDown = this._onRevealButtonMouseDown.bind(this);
|
|
564
|
+
this.__lastChange = '';
|
|
564
565
|
}
|
|
565
566
|
|
|
566
567
|
/** @protected */
|
|
@@ -577,7 +578,7 @@ class PasswordField extends TextField {
|
|
|
577
578
|
btn.disabled = host.disabled;
|
|
578
579
|
|
|
579
580
|
btn.addEventListener('click', host.__boundRevealButtonClick);
|
|
580
|
-
btn.addEventListener('
|
|
581
|
+
btn.addEventListener('mousedown', host.__boundRevealButtonMouseDown);
|
|
581
582
|
},
|
|
582
583
|
);
|
|
583
584
|
this.addController(this._revealButtonController);
|
|
@@ -592,6 +593,19 @@ class PasswordField extends TextField {
|
|
|
592
593
|
}
|
|
593
594
|
}
|
|
594
595
|
|
|
596
|
+
/**
|
|
597
|
+
* Override an event listener inherited from `InputControlMixin`
|
|
598
|
+
* to store the value at the moment of the native `change` event.
|
|
599
|
+
* @param {Event} event
|
|
600
|
+
* @protected
|
|
601
|
+
* @override
|
|
602
|
+
*/
|
|
603
|
+
_onChange(event) {
|
|
604
|
+
super._onChange(event);
|
|
605
|
+
|
|
606
|
+
this.__lastChange = this.inputElement.value;
|
|
607
|
+
}
|
|
608
|
+
|
|
595
609
|
/**
|
|
596
610
|
* Override method inherited from `FocusMixin` to mark field as focused
|
|
597
611
|
* when focus moves to the reveal button using Shift Tab.
|
|
@@ -628,6 +642,12 @@ class PasswordField extends TextField {
|
|
|
628
642
|
|
|
629
643
|
if (!focused) {
|
|
630
644
|
this._setPasswordVisible(false);
|
|
645
|
+
|
|
646
|
+
// Detect if `focusout` was prevented and if so, dispatch `change` event manually.
|
|
647
|
+
if (this.__lastChange !== this.inputElement.value) {
|
|
648
|
+
this.__lastChange = this.inputElement.value;
|
|
649
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
|
|
650
|
+
}
|
|
631
651
|
} else {
|
|
632
652
|
const isButtonFocused = this.getRootNode().activeElement === this._revealNode;
|
|
633
653
|
// Remove focus-ring from the field when the reveal button gets focused
|
|
@@ -663,10 +683,10 @@ class PasswordField extends TextField {
|
|
|
663
683
|
}
|
|
664
684
|
|
|
665
685
|
/** @private */
|
|
666
|
-
|
|
667
|
-
// Cancel the following
|
|
686
|
+
_onRevealButtonMouseDown(e) {
|
|
687
|
+
// Cancel the following focusout event
|
|
668
688
|
e.preventDefault();
|
|
669
|
-
|
|
689
|
+
|
|
670
690
|
// Focus the input to avoid problem with password still visible
|
|
671
691
|
// when user clicks the reveal button and then clicks outside.
|
|
672
692
|
this.inputElement.focus();
|
|
@@ -719,7 +739,7 @@ class PasswordField extends TextField {
|
|
|
719
739
|
|
|
720
740
|
customElements.define(PasswordField.is, PasswordField);
|
|
721
741
|
|
|
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:#
|
|
742
|
+
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:#2A3841}.password__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;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__input>input:placeholder-shown{color:#979797}.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--hidden{display:none}.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}";
|
|
723
743
|
|
|
724
744
|
const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
725
745
|
constructor() {
|
|
@@ -863,9 +883,11 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
863
883
|
}
|
|
864
884
|
}
|
|
865
885
|
setErrorMessage() {
|
|
866
|
-
var _a;
|
|
886
|
+
var _a, _b, _c, _d;
|
|
867
887
|
if (this.inputReference.validity.patternMismatch) {
|
|
868
|
-
|
|
888
|
+
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
889
|
+
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
890
|
+
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
869
891
|
}
|
|
870
892
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
871
893
|
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
@@ -874,7 +896,9 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
874
896
|
return translate('requiredError', this.language);
|
|
875
897
|
}
|
|
876
898
|
if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
|
|
877
|
-
|
|
899
|
+
const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
|
|
900
|
+
const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
|
|
901
|
+
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
878
902
|
}
|
|
879
903
|
}
|
|
880
904
|
renderTooltip() {
|
|
@@ -888,14 +912,13 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
888
912
|
const passedRules = this.passwordComplexity.filter(complexity => complexity.passed).length;
|
|
889
913
|
const meterValue = passedRules / totalRules;
|
|
890
914
|
const allRulesPassed = this.passwordComplexity.every(complexity => complexity.passed);
|
|
891
|
-
if (this.showPopup === false)
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
return (h("div", { key: index }, h("input", { class: 'password__complexity--checkbox', type: "checkbox", checked: complexity.passed, disabled: true }), h("span", null, complexity.rule)));
|
|
915
|
+
// if (this.showPopup === false) return;
|
|
916
|
+
return (h("div", { class: `password__complexity ${!this.showPopup ? 'password__complexity--hidden' : ''}` }, 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) => {
|
|
917
|
+
return (h("div", { key: index }, h("input", { class: 'password__complexity--checkbox', type: "checkbox", checked: complexity.passed, disabled: true }), h("span", null, translate(`${complexity.rule}`, this.language) ? translate(`${complexity.rule}`, this.language) : complexity.rule)));
|
|
895
918
|
}))));
|
|
896
919
|
}
|
|
897
920
|
render() {
|
|
898
|
-
let invalidClass;
|
|
921
|
+
let invalidClass = '';
|
|
899
922
|
if (this.touched) {
|
|
900
923
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
901
924
|
}
|
|
@@ -3,7 +3,7 @@ import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
|
3
3
|
import './input-field-shared-styles.js';
|
|
4
4
|
import './vaadin-combo-box.js';
|
|
5
5
|
|
|
6
|
-
const selectInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.select{font-family:\"Roboto\";font-style:normal}.select__wrapper{position:relative;width:100%}.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:#
|
|
6
|
+
const selectInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.select{font-family:\"Roboto\";font-style:normal}.select__wrapper{position:relative;width:100%}.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:#2A3841}.select__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.select__input{border:none;width:inherit;position:relative}.select__input[focused]::part(input-field){border-color:#3E3E3E}.select__input[invalid]::part(input-field){border-color:#cc0000b3}.select__input vaadin-date-picker-overlay-content>vaadin-button{color:#1F1F1F}.select__input vaadin-month-calendar::part(selected date){background-color:red}.select__input::part(input-field){border-radius:4px;background-color:#FFFFFF;border:2px solid #DEE1EE;color:#2A2E3F;border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px}.select__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.select__tooltip-icon{width:16px;height:auto}.select__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}.select__tooltip.visible{opacity:1}";
|
|
7
7
|
|
|
8
8
|
const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
@@ -69,8 +69,10 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
69
69
|
componentWillLoad() {
|
|
70
70
|
if (this.action && !this.options.length) {
|
|
71
71
|
if (this.action.split(" ")[0] == 'GET') {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const endpoint = this.action.split(" ")[1];
|
|
73
|
+
return this.getOptions(endpoint).then((options) => {
|
|
74
|
+
const firstKey = Object.keys(options)[0];
|
|
75
|
+
this.displayedOptions = options[firstKey].map(option => {
|
|
74
76
|
return { label: option.Name, value: option.Alpha2Code };
|
|
75
77
|
});
|
|
76
78
|
});
|
|
@@ -94,9 +96,8 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
94
96
|
this.valueHandler({ name: this.name, value: this.value });
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
|
-
getOptions() {
|
|
98
|
-
|
|
99
|
-
const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/countries");
|
|
99
|
+
getOptions(endpoint) {
|
|
100
|
+
const url = new URL(endpoint);
|
|
100
101
|
return new Promise((resolve, reject) => {
|
|
101
102
|
fetch(url.href)
|
|
102
103
|
.then((res) => res.json())
|
|
@@ -123,7 +124,7 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
123
124
|
return null;
|
|
124
125
|
}
|
|
125
126
|
render() {
|
|
126
|
-
let invalidClass;
|
|
127
|
+
let invalidClass = '';
|
|
127
128
|
if (this.touched) {
|
|
128
129
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
129
130
|
}
|
|
@@ -3,7 +3,7 @@ import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
|
3
3
|
import './input-field-shared-styles.js';
|
|
4
4
|
import './vaadin-combo-box.js';
|
|
5
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%}.tel__wrapper--flex{width:inherit;display:flex;align-items:stretch;border-radius:4px;border:2px solid #DEE1EE}.tel__wrapper--flex:focus-within{border:2px solid #3E3E3E}.tel__wrapper--flex--invalid{border:2px solid #cc0000b3}.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:#
|
|
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%}.tel__wrapper--flex{width:inherit;display:flex;align-items:stretch;border-radius:4px;border:2px solid #DEE1EE}.tel__wrapper--flex:focus-within{border:2px solid #3E3E3E}.tel__wrapper--flex--invalid{border:2px solid #cc0000b3}.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:#2A3841}.tel__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.tel__prefix{width:120px}.tel__prefix[focus]{outline:none}.tel__prefix::part(input-field){border-radius:0 4px 4px 0;background-color:#DEE1EE;color:#1F1F1F;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px}.tel__input{border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;border:none;padding:10px 20px;width:inherit;position:relative;-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__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.tel__tooltip-icon{width:16px;height:auto}.tel__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}.tel__tooltip.visible{opacity:1}";
|
|
7
7
|
|
|
8
8
|
const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
@@ -99,7 +99,7 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
99
99
|
this.isValid = this.setValidity();
|
|
100
100
|
if (this.defaultValue) {
|
|
101
101
|
this.value = this.defaultValue;
|
|
102
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
102
|
+
this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
getPhoneCodes(endpoint) {
|
|
@@ -130,9 +130,11 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
setErrorMessage() {
|
|
133
|
-
var _a;
|
|
133
|
+
var _a, _b;
|
|
134
134
|
if (this.inputReference.validity.patternMismatch) {
|
|
135
|
-
|
|
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;
|
|
136
138
|
}
|
|
137
139
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
138
140
|
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
@@ -148,7 +150,7 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
148
150
|
return null;
|
|
149
151
|
}
|
|
150
152
|
render() {
|
|
151
|
-
let invalidClass;
|
|
153
|
+
let invalidClass = '';
|
|
152
154
|
if (this.touched) {
|
|
153
155
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
154
156
|
}
|
|
@@ -1,7 +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
3
|
|
|
4
|
-
const textInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.text{font-family:\"Roboto\";font-style:normal}.text__wrapper{position:relative;width:100%}.text__wrapper--flex{display:flex;gap:5px}.text__wrapper--relative{position:relative}.text__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#
|
|
4
|
+
const textInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.text{font-family:\"Roboto\";font-style:normal}.text__wrapper{position:relative;width:100%}.text__wrapper--flex{display:flex;gap:5px}.text__wrapper--relative{position:relative}.text__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#2A3841}.text__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.text__input{border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;padding:10px 20px;width:inherit;position:relative;border:2px solid #DEE1EE}.text__input:focus{outline-color:#3E3E3E}.text__input--invalid{border:2px solid #cc0000b3}.text__input::placeholder{color:#979797}.text__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.text__tooltip-icon{width:16px;height:auto}.text__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}.text__tooltip.visible{opacity:1}";
|
|
5
5
|
|
|
6
6
|
const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -127,9 +127,11 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
setErrorMessage() {
|
|
130
|
-
var _a;
|
|
130
|
+
var _a, _b, _c, _d;
|
|
131
131
|
if (this.inputReference.validity.patternMismatch) {
|
|
132
|
-
|
|
132
|
+
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
133
|
+
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
134
|
+
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
133
135
|
}
|
|
134
136
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
135
137
|
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
@@ -138,7 +140,9 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
138
140
|
return translate('requiredError', this.language);
|
|
139
141
|
}
|
|
140
142
|
if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
|
|
141
|
-
|
|
143
|
+
const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
|
|
144
|
+
const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
|
|
145
|
+
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
142
146
|
}
|
|
143
147
|
}
|
|
144
148
|
renderTooltip() {
|
|
@@ -148,7 +152,7 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
148
152
|
return null;
|
|
149
153
|
}
|
|
150
154
|
render() {
|
|
151
|
-
let invalidClass;
|
|
155
|
+
let invalidClass = '';
|
|
152
156
|
if (this.touched) {
|
|
153
157
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
154
158
|
}
|
|
@@ -8,12 +8,29 @@ const TRANSLATIONS = {
|
|
|
8
8
|
"passwordStrength": "Password strength",
|
|
9
9
|
"passwordStrengthWeak": "is not adequate",
|
|
10
10
|
"passwordStrengthStrong": "is adequate",
|
|
11
|
+
"SpecialCharactersNotAllowed": 'Should not contain special characters',
|
|
12
|
+
"InvalidEmailFormat": "Invalid email format.",
|
|
13
|
+
"EmailNotMatching": "Emails not matching!",
|
|
14
|
+
"PasswordNotMatching": "Passwords not matching",
|
|
15
|
+
"MustIncludeNumber": "include a number",
|
|
16
|
+
"MustContainCapital": "contain capital letters",
|
|
17
|
+
"MustIncludePunctation": "punctuation",
|
|
11
18
|
},
|
|
12
19
|
"hu": {
|
|
13
20
|
"dateError": 'A választott dátumnak {min} és {max} között kell lennie',
|
|
14
21
|
"numberLengthError": 'A számnak {min} és {max} között kell lennie',
|
|
15
22
|
"lengthError": `A hossznak {minLength} és {maxLength} között kell lennie`,
|
|
16
23
|
"requiredError": 'Ez a beviteli mező kötelező.',
|
|
24
|
+
"passwordStrength": "Jelszó erőssége",
|
|
25
|
+
"passwordStrengthWeak": "nem megfelelő",
|
|
26
|
+
"passwordStrengthStrong": "megfelelő",
|
|
27
|
+
"SpecialCharactersNotAllowed": 'Nem tartalmazhat speciális karaktereket',
|
|
28
|
+
"InvalidEmailFormat": "Érvénytelen e-mail formátum.",
|
|
29
|
+
"EmailNotMatching": "Az e-mailek nem egyeznek!",
|
|
30
|
+
"PasswordNotMatching": "A jelszavak nem egyeznek",
|
|
31
|
+
"MustIncludeNumber": "tartalmaznia kell egy számot",
|
|
32
|
+
"MustContainCapital": "nagybetűket kell tartalmaznia",
|
|
33
|
+
"MustIncludePunctation": "írásjelet"
|
|
17
34
|
}
|
|
18
35
|
};
|
|
19
36
|
const translate = (key, customLang, values) => {
|