@everymatrix/general-registration-multistep 1.99.0 → 1.99.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.
|
@@ -16044,7 +16044,6 @@ const PasswordInput = class {
|
|
|
16044
16044
|
}
|
|
16045
16045
|
componentDidLoad() {
|
|
16046
16046
|
this.handleClientStyling();
|
|
16047
|
-
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
16048
16047
|
this.passwordButton = this.element.shadowRoot.querySelector('vaadin-password-field-button');
|
|
16049
16048
|
this.passwordButton.tabIndex = -1;
|
|
16050
16049
|
this.passwordButton.addEventListener('click', (e) => {
|
|
@@ -16080,8 +16079,23 @@ const PasswordInput = class {
|
|
|
16080
16079
|
return { rule: rule.displayName, ruleKey: rule.errorKey, passed };
|
|
16081
16080
|
});
|
|
16082
16081
|
}
|
|
16082
|
+
/**
|
|
16083
|
+
* Same checks as the native `input.validity` flags, but computed from `this.value`.
|
|
16084
|
+
* We can't trust the native flags here: per the HTML spec `tooShort`/`tooLong` only apply while the value was "last changed by the user". When the reveal (eye) button toggles the input `type` between `password` and `text`, WebKit (Safari / iOS) resets that flag, so a too-short password is suddenly reported as `valid`.
|
|
16085
|
+
*/
|
|
16086
|
+
getValueValidity() {
|
|
16087
|
+
var _a;
|
|
16088
|
+
const value = (_a = this.value) !== null && _a !== void 0 ? _a : '';
|
|
16089
|
+
const { mandatory, minLength, maxLength } = this.validation;
|
|
16090
|
+
return {
|
|
16091
|
+
valueMissing: !!mandatory && value === '',
|
|
16092
|
+
tooShort: value !== '' && !!minLength && value.length < minLength,
|
|
16093
|
+
tooLong: value !== '' && !!maxLength && value.length > maxLength,
|
|
16094
|
+
patternMismatch: value !== '' && !!this.validationPattern && !new RegExp(`^(?:${this.validationPattern})$`).test(value),
|
|
16095
|
+
};
|
|
16096
|
+
}
|
|
16083
16097
|
setValidity() {
|
|
16084
|
-
var _a
|
|
16098
|
+
var _a;
|
|
16085
16099
|
if (this.noValidation) {
|
|
16086
16100
|
return true;
|
|
16087
16101
|
}
|
|
@@ -16092,7 +16106,8 @@ const PasswordInput = class {
|
|
|
16092
16106
|
return false;
|
|
16093
16107
|
}
|
|
16094
16108
|
else {
|
|
16095
|
-
|
|
16109
|
+
const { valueMissing, tooShort, tooLong, patternMismatch } = this.getValueValidity();
|
|
16110
|
+
return !valueMissing && !tooShort && !tooLong && !patternMismatch;
|
|
16096
16111
|
}
|
|
16097
16112
|
}
|
|
16098
16113
|
setPattern() {
|
|
@@ -16103,16 +16118,17 @@ const PasswordInput = class {
|
|
|
16103
16118
|
}
|
|
16104
16119
|
setErrorMessage() {
|
|
16105
16120
|
var _a, _b, _c, _d, _e;
|
|
16106
|
-
|
|
16121
|
+
const { valueMissing, tooShort, tooLong, patternMismatch } = this.getValueValidity();
|
|
16122
|
+
if (tooShort || tooLong) {
|
|
16107
16123
|
return translate$1('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
16108
16124
|
}
|
|
16109
|
-
if (
|
|
16125
|
+
if (valueMissing) {
|
|
16110
16126
|
return translate$1('requiredError', this.language);
|
|
16111
16127
|
}
|
|
16112
16128
|
if (this.isDuplicateInput && !this.originalValid) {
|
|
16113
16129
|
return translate$1('invalidOriginalPasswordError', this.language);
|
|
16114
16130
|
}
|
|
16115
|
-
if (
|
|
16131
|
+
if (patternMismatch) {
|
|
16116
16132
|
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
16117
16133
|
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
16118
16134
|
return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
|
|
@@ -16122,10 +16138,17 @@ const PasswordInput = class {
|
|
|
16122
16138
|
const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
|
|
16123
16139
|
return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
|
|
16124
16140
|
}
|
|
16125
|
-
if (!((_e = this.passwordComplexity) === null || _e === void 0 ? void 0 : _e.every(complexity => complexity.passed))
|
|
16141
|
+
if (!((_e = this.passwordComplexity) === null || _e === void 0 ? void 0 : _e.every(complexity => complexity.passed))) {
|
|
16126
16142
|
return translate$1('invalidPassword', this.language);
|
|
16127
16143
|
}
|
|
16128
16144
|
}
|
|
16145
|
+
// Mirrors the condition used in `render()` for the complexity popup.
|
|
16146
|
+
isComplexityPopupVisible() {
|
|
16147
|
+
return !!this.passwordComplexity
|
|
16148
|
+
&& this.showPopup
|
|
16149
|
+
&& !this.hidePasswordComplexity
|
|
16150
|
+
&& !this.isDuplicateInput;
|
|
16151
|
+
}
|
|
16129
16152
|
renderTooltip() {
|
|
16130
16153
|
if (this.showTooltip) {
|
|
16131
16154
|
return (index.h("div", { class: `password__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
@@ -16150,11 +16173,9 @@ const PasswordInput = class {
|
|
|
16150
16173
|
if (this.touched) {
|
|
16151
16174
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
16152
16175
|
}
|
|
16153
|
-
return index.h("div", { key: '
|
|
16154
|
-
index.h("img", { key: '
|
|
16155
|
-
this.
|
|
16156
|
-
!this.hidePasswordComplexity &&
|
|
16157
|
-
!this.isDuplicateInput &&
|
|
16176
|
+
return index.h("div", { key: 'b4f26f39d749b45a85e4d3a05419ff74026b9c73', class: `password__wrapper ${this.autofilled ? 'password__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { key: '25ab8386ec960e36ec411a3142452bb1a7ffbe05', class: 'password__wrapper--flex' }, index.h("label", { key: '0ee895de1059e39fbde8723b1606f9f2a0f89d97', class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { key: 'd5d84181edfdfc638c6d35f91c555dd91c97b69a', class: 'password__wrapper--relative' }, this.tooltip &&
|
|
16177
|
+
index.h("img", { key: '5a176a28a7efde57506a1db7690d57a86379a527', class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("vaadin-password-field", { key: '70710167fc3a008c555e447e372e735e3c8af497', 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}`, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus }), !this.noValidation && !this.isComplexityPopupVisible() &&
|
|
16178
|
+
index.h("small", { key: 'd39c8e2c585e574bc31725e6935254d4bf634d0e', class: 'password__error-message' }, this.errorMessage), this.isComplexityPopupVisible() &&
|
|
16158
16179
|
(this.enableSouthAfricanMode
|
|
16159
16180
|
? this.renderCustomComplexityPopup()
|
|
16160
16181
|
: this.renderComplexityPopup()));
|
|
@@ -16040,7 +16040,6 @@ const PasswordInput = class {
|
|
|
16040
16040
|
}
|
|
16041
16041
|
componentDidLoad() {
|
|
16042
16042
|
this.handleClientStyling();
|
|
16043
|
-
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
16044
16043
|
this.passwordButton = this.element.shadowRoot.querySelector('vaadin-password-field-button');
|
|
16045
16044
|
this.passwordButton.tabIndex = -1;
|
|
16046
16045
|
this.passwordButton.addEventListener('click', (e) => {
|
|
@@ -16076,8 +16075,23 @@ const PasswordInput = class {
|
|
|
16076
16075
|
return { rule: rule.displayName, ruleKey: rule.errorKey, passed };
|
|
16077
16076
|
});
|
|
16078
16077
|
}
|
|
16078
|
+
/**
|
|
16079
|
+
* Same checks as the native `input.validity` flags, but computed from `this.value`.
|
|
16080
|
+
* We can't trust the native flags here: per the HTML spec `tooShort`/`tooLong` only apply while the value was "last changed by the user". When the reveal (eye) button toggles the input `type` between `password` and `text`, WebKit (Safari / iOS) resets that flag, so a too-short password is suddenly reported as `valid`.
|
|
16081
|
+
*/
|
|
16082
|
+
getValueValidity() {
|
|
16083
|
+
var _a;
|
|
16084
|
+
const value = (_a = this.value) !== null && _a !== void 0 ? _a : '';
|
|
16085
|
+
const { mandatory, minLength, maxLength } = this.validation;
|
|
16086
|
+
return {
|
|
16087
|
+
valueMissing: !!mandatory && value === '',
|
|
16088
|
+
tooShort: value !== '' && !!minLength && value.length < minLength,
|
|
16089
|
+
tooLong: value !== '' && !!maxLength && value.length > maxLength,
|
|
16090
|
+
patternMismatch: value !== '' && !!this.validationPattern && !new RegExp(`^(?:${this.validationPattern})$`).test(value),
|
|
16091
|
+
};
|
|
16092
|
+
}
|
|
16079
16093
|
setValidity() {
|
|
16080
|
-
var _a
|
|
16094
|
+
var _a;
|
|
16081
16095
|
if (this.noValidation) {
|
|
16082
16096
|
return true;
|
|
16083
16097
|
}
|
|
@@ -16088,7 +16102,8 @@ const PasswordInput = class {
|
|
|
16088
16102
|
return false;
|
|
16089
16103
|
}
|
|
16090
16104
|
else {
|
|
16091
|
-
|
|
16105
|
+
const { valueMissing, tooShort, tooLong, patternMismatch } = this.getValueValidity();
|
|
16106
|
+
return !valueMissing && !tooShort && !tooLong && !patternMismatch;
|
|
16092
16107
|
}
|
|
16093
16108
|
}
|
|
16094
16109
|
setPattern() {
|
|
@@ -16099,16 +16114,17 @@ const PasswordInput = class {
|
|
|
16099
16114
|
}
|
|
16100
16115
|
setErrorMessage() {
|
|
16101
16116
|
var _a, _b, _c, _d, _e;
|
|
16102
|
-
|
|
16117
|
+
const { valueMissing, tooShort, tooLong, patternMismatch } = this.getValueValidity();
|
|
16118
|
+
if (tooShort || tooLong) {
|
|
16103
16119
|
return translate$1('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
16104
16120
|
}
|
|
16105
|
-
if (
|
|
16121
|
+
if (valueMissing) {
|
|
16106
16122
|
return translate$1('requiredError', this.language);
|
|
16107
16123
|
}
|
|
16108
16124
|
if (this.isDuplicateInput && !this.originalValid) {
|
|
16109
16125
|
return translate$1('invalidOriginalPasswordError', this.language);
|
|
16110
16126
|
}
|
|
16111
|
-
if (
|
|
16127
|
+
if (patternMismatch) {
|
|
16112
16128
|
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
16113
16129
|
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
16114
16130
|
return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
|
|
@@ -16118,10 +16134,17 @@ const PasswordInput = class {
|
|
|
16118
16134
|
const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
|
|
16119
16135
|
return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
|
|
16120
16136
|
}
|
|
16121
|
-
if (!((_e = this.passwordComplexity) === null || _e === void 0 ? void 0 : _e.every(complexity => complexity.passed))
|
|
16137
|
+
if (!((_e = this.passwordComplexity) === null || _e === void 0 ? void 0 : _e.every(complexity => complexity.passed))) {
|
|
16122
16138
|
return translate$1('invalidPassword', this.language);
|
|
16123
16139
|
}
|
|
16124
16140
|
}
|
|
16141
|
+
// Mirrors the condition used in `render()` for the complexity popup.
|
|
16142
|
+
isComplexityPopupVisible() {
|
|
16143
|
+
return !!this.passwordComplexity
|
|
16144
|
+
&& this.showPopup
|
|
16145
|
+
&& !this.hidePasswordComplexity
|
|
16146
|
+
&& !this.isDuplicateInput;
|
|
16147
|
+
}
|
|
16125
16148
|
renderTooltip() {
|
|
16126
16149
|
if (this.showTooltip) {
|
|
16127
16150
|
return (h("div", { class: `password__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
@@ -16146,11 +16169,9 @@ const PasswordInput = class {
|
|
|
16146
16169
|
if (this.touched) {
|
|
16147
16170
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
16148
16171
|
}
|
|
16149
|
-
return h("div", { key: '
|
|
16150
|
-
h("img", { key: '
|
|
16151
|
-
this.
|
|
16152
|
-
!this.hidePasswordComplexity &&
|
|
16153
|
-
!this.isDuplicateInput &&
|
|
16172
|
+
return h("div", { key: 'b4f26f39d749b45a85e4d3a05419ff74026b9c73', class: `password__wrapper ${this.autofilled ? 'password__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { key: '25ab8386ec960e36ec411a3142452bb1a7ffbe05', class: 'password__wrapper--flex' }, h("label", { key: '0ee895de1059e39fbde8723b1606f9f2a0f89d97', class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { key: 'd5d84181edfdfc638c6d35f91c555dd91c97b69a', class: 'password__wrapper--relative' }, this.tooltip &&
|
|
16173
|
+
h("img", { key: '5a176a28a7efde57506a1db7690d57a86379a527', class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-password-field", { key: '70710167fc3a008c555e447e372e735e3c8af497', 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}`, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus }), !this.noValidation && !this.isComplexityPopupVisible() &&
|
|
16174
|
+
h("small", { key: 'd39c8e2c585e574bc31725e6935254d4bf634d0e', class: 'password__error-message' }, this.errorMessage), this.isComplexityPopupVisible() &&
|
|
16154
16175
|
(this.enableSouthAfricanMode
|
|
16155
16176
|
? this.renderCustomComplexityPopup()
|
|
16156
16177
|
: this.renderComplexityPopup()));
|