@everymatrix/bonus-elevate-powerups-lobby 0.5.1 → 0.5.3
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.
|
@@ -20067,7 +20067,6 @@ const PasswordInput = class {
|
|
|
20067
20067
|
}
|
|
20068
20068
|
componentDidLoad() {
|
|
20069
20069
|
this.handleClientStyling();
|
|
20070
|
-
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
20071
20070
|
this.passwordButton = this.element.shadowRoot.querySelector('vaadin-password-field-button');
|
|
20072
20071
|
this.passwordButton.tabIndex = -1;
|
|
20073
20072
|
this.passwordButton.addEventListener('click', (e) => {
|
|
@@ -20103,8 +20102,23 @@ const PasswordInput = class {
|
|
|
20103
20102
|
return { rule: rule.displayName, ruleKey: rule.errorKey, passed };
|
|
20104
20103
|
});
|
|
20105
20104
|
}
|
|
20105
|
+
/**
|
|
20106
|
+
* Same checks as the native `input.validity` flags, but computed from `this.value`.
|
|
20107
|
+
* 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`.
|
|
20108
|
+
*/
|
|
20109
|
+
getValueValidity() {
|
|
20110
|
+
var _a;
|
|
20111
|
+
const value = (_a = this.value) !== null && _a !== void 0 ? _a : '';
|
|
20112
|
+
const { mandatory, minLength, maxLength } = this.validation;
|
|
20113
|
+
return {
|
|
20114
|
+
valueMissing: !!mandatory && value === '',
|
|
20115
|
+
tooShort: value !== '' && !!minLength && value.length < minLength,
|
|
20116
|
+
tooLong: value !== '' && !!maxLength && value.length > maxLength,
|
|
20117
|
+
patternMismatch: value !== '' && !!this.validationPattern && !new RegExp(`^(?:${this.validationPattern})$`).test(value),
|
|
20118
|
+
};
|
|
20119
|
+
}
|
|
20106
20120
|
setValidity() {
|
|
20107
|
-
var _a
|
|
20121
|
+
var _a;
|
|
20108
20122
|
if (this.noValidation) {
|
|
20109
20123
|
return true;
|
|
20110
20124
|
}
|
|
@@ -20115,7 +20129,8 @@ const PasswordInput = class {
|
|
|
20115
20129
|
return false;
|
|
20116
20130
|
}
|
|
20117
20131
|
else {
|
|
20118
|
-
|
|
20132
|
+
const { valueMissing, tooShort, tooLong, patternMismatch } = this.getValueValidity();
|
|
20133
|
+
return !valueMissing && !tooShort && !tooLong && !patternMismatch;
|
|
20119
20134
|
}
|
|
20120
20135
|
}
|
|
20121
20136
|
setPattern() {
|
|
@@ -20126,16 +20141,17 @@ const PasswordInput = class {
|
|
|
20126
20141
|
}
|
|
20127
20142
|
setErrorMessage() {
|
|
20128
20143
|
var _a, _b, _c, _d, _e;
|
|
20129
|
-
|
|
20144
|
+
const { valueMissing, tooShort, tooLong, patternMismatch } = this.getValueValidity();
|
|
20145
|
+
if (tooShort || tooLong) {
|
|
20130
20146
|
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
20131
20147
|
}
|
|
20132
|
-
if (
|
|
20148
|
+
if (valueMissing) {
|
|
20133
20149
|
return translate('requiredError', this.language);
|
|
20134
20150
|
}
|
|
20135
20151
|
if (this.isDuplicateInput && !this.originalValid) {
|
|
20136
20152
|
return translate('invalidOriginalPasswordError', this.language);
|
|
20137
20153
|
}
|
|
20138
|
-
if (
|
|
20154
|
+
if (patternMismatch) {
|
|
20139
20155
|
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
20140
20156
|
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
20141
20157
|
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
@@ -20145,10 +20161,17 @@ const PasswordInput = class {
|
|
|
20145
20161
|
const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
|
|
20146
20162
|
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
20147
20163
|
}
|
|
20148
|
-
if (!((_e = this.passwordComplexity) === null || _e === void 0 ? void 0 : _e.every(complexity => complexity.passed))
|
|
20164
|
+
if (!((_e = this.passwordComplexity) === null || _e === void 0 ? void 0 : _e.every(complexity => complexity.passed))) {
|
|
20149
20165
|
return translate('invalidPassword', this.language);
|
|
20150
20166
|
}
|
|
20151
20167
|
}
|
|
20168
|
+
// Mirrors the condition used in `render()` for the complexity popup.
|
|
20169
|
+
isComplexityPopupVisible() {
|
|
20170
|
+
return !!this.passwordComplexity
|
|
20171
|
+
&& this.showPopup
|
|
20172
|
+
&& !this.hidePasswordComplexity
|
|
20173
|
+
&& !this.isDuplicateInput;
|
|
20174
|
+
}
|
|
20152
20175
|
renderTooltip() {
|
|
20153
20176
|
if (this.showTooltip) {
|
|
20154
20177
|
return (index.h("div", { class: `password__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
@@ -20173,11 +20196,9 @@ const PasswordInput = class {
|
|
|
20173
20196
|
if (this.touched) {
|
|
20174
20197
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
20175
20198
|
}
|
|
20176
|
-
return index.h("div", { key: '
|
|
20177
|
-
index.h("img", { key: '
|
|
20178
|
-
this.
|
|
20179
|
-
!this.hidePasswordComplexity &&
|
|
20180
|
-
!this.isDuplicateInput &&
|
|
20199
|
+
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 &&
|
|
20200
|
+
index.h("img", { key: '5a176a28a7efde57506a1db7690d57a86379a527', class: 'password__tooltip-icon', src: tooltipIcon, 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() &&
|
|
20201
|
+
index.h("small", { key: 'd39c8e2c585e574bc31725e6935254d4bf634d0e', class: 'password__error-message' }, this.errorMessage), this.isComplexityPopupVisible() &&
|
|
20181
20202
|
(this.enableSouthAfricanMode
|
|
20182
20203
|
? this.renderCustomComplexityPopup()
|
|
20183
20204
|
: this.renderComplexityPopup()));
|
|
@@ -20064,7 +20064,6 @@ const PasswordInput = class {
|
|
|
20064
20064
|
}
|
|
20065
20065
|
componentDidLoad() {
|
|
20066
20066
|
this.handleClientStyling();
|
|
20067
|
-
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
20068
20067
|
this.passwordButton = this.element.shadowRoot.querySelector('vaadin-password-field-button');
|
|
20069
20068
|
this.passwordButton.tabIndex = -1;
|
|
20070
20069
|
this.passwordButton.addEventListener('click', (e) => {
|
|
@@ -20100,8 +20099,23 @@ const PasswordInput = class {
|
|
|
20100
20099
|
return { rule: rule.displayName, ruleKey: rule.errorKey, passed };
|
|
20101
20100
|
});
|
|
20102
20101
|
}
|
|
20102
|
+
/**
|
|
20103
|
+
* Same checks as the native `input.validity` flags, but computed from `this.value`.
|
|
20104
|
+
* 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`.
|
|
20105
|
+
*/
|
|
20106
|
+
getValueValidity() {
|
|
20107
|
+
var _a;
|
|
20108
|
+
const value = (_a = this.value) !== null && _a !== void 0 ? _a : '';
|
|
20109
|
+
const { mandatory, minLength, maxLength } = this.validation;
|
|
20110
|
+
return {
|
|
20111
|
+
valueMissing: !!mandatory && value === '',
|
|
20112
|
+
tooShort: value !== '' && !!minLength && value.length < minLength,
|
|
20113
|
+
tooLong: value !== '' && !!maxLength && value.length > maxLength,
|
|
20114
|
+
patternMismatch: value !== '' && !!this.validationPattern && !new RegExp(`^(?:${this.validationPattern})$`).test(value),
|
|
20115
|
+
};
|
|
20116
|
+
}
|
|
20103
20117
|
setValidity() {
|
|
20104
|
-
var _a
|
|
20118
|
+
var _a;
|
|
20105
20119
|
if (this.noValidation) {
|
|
20106
20120
|
return true;
|
|
20107
20121
|
}
|
|
@@ -20112,7 +20126,8 @@ const PasswordInput = class {
|
|
|
20112
20126
|
return false;
|
|
20113
20127
|
}
|
|
20114
20128
|
else {
|
|
20115
|
-
|
|
20129
|
+
const { valueMissing, tooShort, tooLong, patternMismatch } = this.getValueValidity();
|
|
20130
|
+
return !valueMissing && !tooShort && !tooLong && !patternMismatch;
|
|
20116
20131
|
}
|
|
20117
20132
|
}
|
|
20118
20133
|
setPattern() {
|
|
@@ -20123,16 +20138,17 @@ const PasswordInput = class {
|
|
|
20123
20138
|
}
|
|
20124
20139
|
setErrorMessage() {
|
|
20125
20140
|
var _a, _b, _c, _d, _e;
|
|
20126
|
-
|
|
20141
|
+
const { valueMissing, tooShort, tooLong, patternMismatch } = this.getValueValidity();
|
|
20142
|
+
if (tooShort || tooLong) {
|
|
20127
20143
|
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
20128
20144
|
}
|
|
20129
|
-
if (
|
|
20145
|
+
if (valueMissing) {
|
|
20130
20146
|
return translate('requiredError', this.language);
|
|
20131
20147
|
}
|
|
20132
20148
|
if (this.isDuplicateInput && !this.originalValid) {
|
|
20133
20149
|
return translate('invalidOriginalPasswordError', this.language);
|
|
20134
20150
|
}
|
|
20135
|
-
if (
|
|
20151
|
+
if (patternMismatch) {
|
|
20136
20152
|
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
20137
20153
|
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
20138
20154
|
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
@@ -20142,10 +20158,17 @@ const PasswordInput = class {
|
|
|
20142
20158
|
const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
|
|
20143
20159
|
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
20144
20160
|
}
|
|
20145
|
-
if (!((_e = this.passwordComplexity) === null || _e === void 0 ? void 0 : _e.every(complexity => complexity.passed))
|
|
20161
|
+
if (!((_e = this.passwordComplexity) === null || _e === void 0 ? void 0 : _e.every(complexity => complexity.passed))) {
|
|
20146
20162
|
return translate('invalidPassword', this.language);
|
|
20147
20163
|
}
|
|
20148
20164
|
}
|
|
20165
|
+
// Mirrors the condition used in `render()` for the complexity popup.
|
|
20166
|
+
isComplexityPopupVisible() {
|
|
20167
|
+
return !!this.passwordComplexity
|
|
20168
|
+
&& this.showPopup
|
|
20169
|
+
&& !this.hidePasswordComplexity
|
|
20170
|
+
&& !this.isDuplicateInput;
|
|
20171
|
+
}
|
|
20149
20172
|
renderTooltip() {
|
|
20150
20173
|
if (this.showTooltip) {
|
|
20151
20174
|
return (h("div", { class: `password__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
@@ -20170,11 +20193,9 @@ const PasswordInput = class {
|
|
|
20170
20193
|
if (this.touched) {
|
|
20171
20194
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
20172
20195
|
}
|
|
20173
|
-
return h("div", { key: '
|
|
20174
|
-
h("img", { key: '
|
|
20175
|
-
this.
|
|
20176
|
-
!this.hidePasswordComplexity &&
|
|
20177
|
-
!this.isDuplicateInput &&
|
|
20196
|
+
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 &&
|
|
20197
|
+
h("img", { key: '5a176a28a7efde57506a1db7690d57a86379a527', class: 'password__tooltip-icon', src: tooltipIcon, 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() &&
|
|
20198
|
+
h("small", { key: 'd39c8e2c585e574bc31725e6935254d4bf634d0e', class: 'password__error-message' }, this.errorMessage), this.isComplexityPopupVisible() &&
|
|
20178
20199
|
(this.enableSouthAfricanMode
|
|
20179
20200
|
? this.renderCustomComplexityPopup()
|
|
20180
20201
|
: this.renderComplexityPopup()));
|