@everymatrix/general-registration 1.87.23 → 1.87.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.
@@ -16282,17 +16282,15 @@ const TelInput = class {
16282
16282
  clearTimeout(this.debounceTime);
16283
16283
  }
16284
16284
  this.debounceTime = setTimeout(() => {
16285
- this.isValid = this.setValidity();
16285
+ this.isValid = this.isValidValue();
16286
16286
  this.errorMessage = this.setErrorMessage();
16287
16287
  this.emitValueHandler(true);
16288
16288
  }, 500);
16289
16289
  };
16290
16290
  this.handleBlur = () => {
16291
- if (!this.touched) {
16292
- this.isValid = this.setValidity();
16293
- this.errorMessage = this.setErrorMessage();
16294
- this.touched = true;
16295
- }
16291
+ this.touched = true;
16292
+ this.isValid = this.isValidValue();
16293
+ this.errorMessage = this.setErrorMessage();
16296
16294
  };
16297
16295
  this.setClientStyling = () => {
16298
16296
  let sheet = document.createElement('style');
@@ -16388,7 +16386,7 @@ const TelInput = class {
16388
16386
  // end custom styling area
16389
16387
  }
16390
16388
  componentDidLoad() {
16391
- this.isValid = this.setValidity();
16389
+ this.isValid = this.isValidValue();
16392
16390
  if (this.defaultValue) {
16393
16391
  this.value = this.defaultValue;
16394
16392
  this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
@@ -16412,8 +16410,29 @@ const TelInput = class {
16412
16410
  this.value = { prefix: this.prefixValue, phone: this.phoneValue };
16413
16411
  this.emitValueHandler(true);
16414
16412
  }
16415
- setValidity() {
16416
- return this.inputReference.validity.valid;
16413
+ isValidValue() {
16414
+ if (!this.inputReference) {
16415
+ return false;
16416
+ }
16417
+ if (this.validation.mandatory && (!this.phoneValue || this.phoneValue.trim() === '')) {
16418
+ return false;
16419
+ }
16420
+ if (!this.phoneValue || this.phoneValue.trim() === '') {
16421
+ return !this.validation.mandatory;
16422
+ }
16423
+ if (this.validation.minLength && this.phoneValue.length < this.validation.minLength) {
16424
+ return false;
16425
+ }
16426
+ if (this.validation.maxLength && this.phoneValue.length > this.validation.maxLength) {
16427
+ return false;
16428
+ }
16429
+ if (this.validationPattern) {
16430
+ const patternRegex = new RegExp(this.validationPattern);
16431
+ if (!patternRegex.test(this.phoneValue)) {
16432
+ return false;
16433
+ }
16434
+ }
16435
+ return true;
16417
16436
  }
16418
16437
  setPattern() {
16419
16438
  var _a, _b;
@@ -16428,7 +16447,10 @@ const TelInput = class {
16428
16447
  const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
16429
16448
  return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
16430
16449
  }
16431
- if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
16450
+ if (this.inputReference.validity.tooShort
16451
+ || this.inputReference.validity.tooLong
16452
+ || (this.validation.minLength && this.phoneValue && this.phoneValue.length < this.validation.minLength)
16453
+ || (this.validation.maxLength && this.phoneValue && this.phoneValue.length > this.validation.maxLength)) {
16432
16454
  return translate$1('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
16433
16455
  }
16434
16456
  if (this.inputReference.validity.valueMissing) {
@@ -16447,8 +16469,8 @@ const TelInput = class {
16447
16469
  if (this.touched) {
16448
16470
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
16449
16471
  }
16450
- return index.h("div", { key: '7296f134bff80795ab52a1a27eb059ab2f3c0c87', class: `tel__wrapper ${this.autofilled ? 'tel__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { key: 'c9b1fdf501299398bcda1e59e65bb0a7d6b7de43', class: 'tel__wrapper--flex-label' }, index.h("label", { key: 'e7e6858fc61e2b6ea8974f8b4dc8d67a5fcb07b4', class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { key: '6c9cc9a3c74e8cd06224e2663d4c363e5d8fb3c0', class: 'tel__wrapper--relative' }, this.tooltip &&
16451
- index.h("img", { key: '17e85d6050d4796bf5b057c901631a87b25d3b40', class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("div", { key: 'cb2e8b93e5663c92a2fd114d1fe1c9d9e09ebc83', class: `tel__wrapper--flex ${invalidClass}` }, index.h("vaadin-combo-box", { key: 'fb1c3ab06d19e9ed7bbdf7effe8f25a1f7d9fe15', class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.disablePhonePrefix, onChange: (e) => this.handlePrefixInput(e) }), index.h("input", { key: 'd2701f0bdca4122c18fd43d311ea8c5e2536b1f5', type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: (_a = this.phoneValue) !== null && _a !== void 0 ? _a : '', placeholder: `${this.placeholder}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onInput: this.handleInput, onBlur: this.handleBlur })), index.h("small", { key: 'a685ceea5c99f29d992fd5291f67934a22d6997c', class: 'tel__error-message' }, this.errorMessage));
16472
+ return index.h("div", { key: 'f534de21d5597a3e90912eb87fff893511d09920', class: `tel__wrapper ${this.autofilled ? 'tel__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { key: '431fb8cbaea0d2244847823ea4d04d8c73a5341c', class: 'tel__wrapper--flex-label' }, index.h("label", { key: '2eb210b2f0c2e0e632997f59fe7aa667578f72fd', class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { key: '2d912b828f7d9475a1bbb5bac13495779f31198e', class: 'tel__wrapper--relative' }, this.tooltip &&
16473
+ index.h("img", { key: 'ce4433263d27dc9d3fb2caf45069d7a92e9ae3a7', class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("div", { key: '480cd17eafb4f2ff1e396531429177cb3130eb95', class: `tel__wrapper--flex ${invalidClass}` }, index.h("vaadin-combo-box", { key: '5f2292c8509e5f68786d0f462c689102b1c75dc3', class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.disablePhonePrefix, onChange: (e) => this.handlePrefixInput(e) }), index.h("input", { key: '77232e119eed4960f5e1d809507b8585dd112256', type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: (_a = this.phoneValue) !== null && _a !== void 0 ? _a : '', placeholder: `${this.placeholder}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onInput: this.handleInput, onBlur: this.handleBlur })), index.h("small", { key: '0d925cee41881c8c822073790e26ca7dc4a81049', class: 'tel__error-message' }, this.errorMessage));
16452
16474
  }
16453
16475
  static get watchers() { return {
16454
16476
  "clientStyling": ["handleStylingChange"],
@@ -16278,17 +16278,15 @@ const TelInput = class {
16278
16278
  clearTimeout(this.debounceTime);
16279
16279
  }
16280
16280
  this.debounceTime = setTimeout(() => {
16281
- this.isValid = this.setValidity();
16281
+ this.isValid = this.isValidValue();
16282
16282
  this.errorMessage = this.setErrorMessage();
16283
16283
  this.emitValueHandler(true);
16284
16284
  }, 500);
16285
16285
  };
16286
16286
  this.handleBlur = () => {
16287
- if (!this.touched) {
16288
- this.isValid = this.setValidity();
16289
- this.errorMessage = this.setErrorMessage();
16290
- this.touched = true;
16291
- }
16287
+ this.touched = true;
16288
+ this.isValid = this.isValidValue();
16289
+ this.errorMessage = this.setErrorMessage();
16292
16290
  };
16293
16291
  this.setClientStyling = () => {
16294
16292
  let sheet = document.createElement('style');
@@ -16384,7 +16382,7 @@ const TelInput = class {
16384
16382
  // end custom styling area
16385
16383
  }
16386
16384
  componentDidLoad() {
16387
- this.isValid = this.setValidity();
16385
+ this.isValid = this.isValidValue();
16388
16386
  if (this.defaultValue) {
16389
16387
  this.value = this.defaultValue;
16390
16388
  this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
@@ -16408,8 +16406,29 @@ const TelInput = class {
16408
16406
  this.value = { prefix: this.prefixValue, phone: this.phoneValue };
16409
16407
  this.emitValueHandler(true);
16410
16408
  }
16411
- setValidity() {
16412
- return this.inputReference.validity.valid;
16409
+ isValidValue() {
16410
+ if (!this.inputReference) {
16411
+ return false;
16412
+ }
16413
+ if (this.validation.mandatory && (!this.phoneValue || this.phoneValue.trim() === '')) {
16414
+ return false;
16415
+ }
16416
+ if (!this.phoneValue || this.phoneValue.trim() === '') {
16417
+ return !this.validation.mandatory;
16418
+ }
16419
+ if (this.validation.minLength && this.phoneValue.length < this.validation.minLength) {
16420
+ return false;
16421
+ }
16422
+ if (this.validation.maxLength && this.phoneValue.length > this.validation.maxLength) {
16423
+ return false;
16424
+ }
16425
+ if (this.validationPattern) {
16426
+ const patternRegex = new RegExp(this.validationPattern);
16427
+ if (!patternRegex.test(this.phoneValue)) {
16428
+ return false;
16429
+ }
16430
+ }
16431
+ return true;
16413
16432
  }
16414
16433
  setPattern() {
16415
16434
  var _a, _b;
@@ -16424,7 +16443,10 @@ const TelInput = class {
16424
16443
  const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
16425
16444
  return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
16426
16445
  }
16427
- if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
16446
+ if (this.inputReference.validity.tooShort
16447
+ || this.inputReference.validity.tooLong
16448
+ || (this.validation.minLength && this.phoneValue && this.phoneValue.length < this.validation.minLength)
16449
+ || (this.validation.maxLength && this.phoneValue && this.phoneValue.length > this.validation.maxLength)) {
16428
16450
  return translate$1('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
16429
16451
  }
16430
16452
  if (this.inputReference.validity.valueMissing) {
@@ -16443,8 +16465,8 @@ const TelInput = class {
16443
16465
  if (this.touched) {
16444
16466
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
16445
16467
  }
16446
- return h$1("div", { key: '7296f134bff80795ab52a1a27eb059ab2f3c0c87', class: `tel__wrapper ${this.autofilled ? 'tel__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h$1("div", { key: 'c9b1fdf501299398bcda1e59e65bb0a7d6b7de43', class: 'tel__wrapper--flex-label' }, h$1("label", { key: 'e7e6858fc61e2b6ea8974f8b4dc8d67a5fcb07b4', class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h$1("div", { key: '6c9cc9a3c74e8cd06224e2663d4c363e5d8fb3c0', class: 'tel__wrapper--relative' }, this.tooltip &&
16447
- h$1("img", { key: '17e85d6050d4796bf5b057c901631a87b25d3b40', class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h$1("div", { key: 'cb2e8b93e5663c92a2fd114d1fe1c9d9e09ebc83', class: `tel__wrapper--flex ${invalidClass}` }, h$1("vaadin-combo-box", { key: 'fb1c3ab06d19e9ed7bbdf7effe8f25a1f7d9fe15', class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.disablePhonePrefix, onChange: (e) => this.handlePrefixInput(e) }), h$1("input", { key: 'd2701f0bdca4122c18fd43d311ea8c5e2536b1f5', type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: (_a = this.phoneValue) !== null && _a !== void 0 ? _a : '', 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$1("small", { key: 'a685ceea5c99f29d992fd5291f67934a22d6997c', class: 'tel__error-message' }, this.errorMessage));
16468
+ return h$1("div", { key: 'f534de21d5597a3e90912eb87fff893511d09920', class: `tel__wrapper ${this.autofilled ? 'tel__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h$1("div", { key: '431fb8cbaea0d2244847823ea4d04d8c73a5341c', class: 'tel__wrapper--flex-label' }, h$1("label", { key: '2eb210b2f0c2e0e632997f59fe7aa667578f72fd', class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h$1("div", { key: '2d912b828f7d9475a1bbb5bac13495779f31198e', class: 'tel__wrapper--relative' }, this.tooltip &&
16469
+ h$1("img", { key: 'ce4433263d27dc9d3fb2caf45069d7a92e9ae3a7', class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h$1("div", { key: '480cd17eafb4f2ff1e396531429177cb3130eb95', class: `tel__wrapper--flex ${invalidClass}` }, h$1("vaadin-combo-box", { key: '5f2292c8509e5f68786d0f462c689102b1c75dc3', class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.disablePhonePrefix, onChange: (e) => this.handlePrefixInput(e) }), h$1("input", { key: '77232e119eed4960f5e1d809507b8585dd112256', type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: (_a = this.phoneValue) !== null && _a !== void 0 ? _a : '', 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$1("small", { key: '0d925cee41881c8c822073790e26ca7dc4a81049', class: 'tel__error-message' }, this.errorMessage));
16448
16470
  }
16449
16471
  static get watchers() { return {
16450
16472
  "clientStyling": ["handleStylingChange"],