@everymatrix/general-registration 1.10.21 → 1.10.22

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.
@@ -14723,6 +14723,7 @@ const CheckboxGroupInput = class {
14723
14723
  };
14724
14724
  }
14725
14725
  validityChanged() {
14726
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
14726
14727
  if (this.emitValue == true) {
14727
14728
  this.valueHandler({ name: this.name, value: this.value, type: 'checkboxgroup' });
14728
14729
  }
@@ -14765,9 +14766,10 @@ const CheckboxGroupInput = class {
14765
14766
  // For now this input has no validation. Send isValid as true immediately.
14766
14767
  //@TODO: add validation logic to it, if business reason arises.
14767
14768
  this.isValid = this.setValidity();
14768
- this.validityStateHandler({ valid: this.isValid, name: this.name });
14769
14769
  if (this.defaultValue) {
14770
14770
  this.selectedValues = this.options.map((checkbox) => checkbox.name);
14771
+ this.value = this.defaultValue;
14772
+ this.valueHandler({ name: this.name, value: this.value });
14771
14773
  }
14772
14774
  }
14773
14775
  setValidity() {
@@ -14791,7 +14793,7 @@ const CheckboxGroupInput = class {
14791
14793
  : [];
14792
14794
  }
14793
14795
  render() {
14794
- return index.h("div", { class: 'checkboxgroup__wrapper', ref: el => this.stylingContainer = el }, index.h("div", { class: 'checkboxgroup__wrapper--flex' }, index.h("vaadin-checkbox", { label: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, checked: this.selectedValues.length === this.options.length || this.defaultValue === 'true', indeterminate: this.selectedValues.length > 0 && this.selectedValues.length < this.options.length, onChange: (e) => this.handleParentCheckbox(e) }), this.tooltip &&
14796
+ return index.h("div", { class: `checkboxgroup__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'checkboxgroup__wrapper--flex' }, index.h("vaadin-checkbox", { label: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, checked: this.selectedValues.length === this.options.length || this.defaultValue === 'true', indeterminate: this.selectedValues.length > 0 && this.selectedValues.length < this.options.length, onChange: (e) => this.handleParentCheckbox(e) }), this.tooltip &&
14795
14797
  index.h("img", { class: 'checkboxgroup__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()), index.h("small", { class: 'checkboxgroup__error-message' }, this.errorMessage), index.h("vaadin-checkbox-group", { theme: "vertical", value: this.selectedValues, "on-value-changed": (event) => {
14796
14798
  this.selectedValues = event.detail.value;
14797
14799
  } }, this.options.map((checkbox) => index.h("vaadin-checkbox", { name: checkbox.name, value: checkbox.name, label: checkbox.displayName }))));
@@ -14830,6 +14832,7 @@ const CheckboxInput = class {
14830
14832
  };
14831
14833
  }
14832
14834
  validityChanged() {
14835
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
14833
14836
  if (this.emitValue == true) {
14834
14837
  this.valueHandler({ name: this.name, value: this.value });
14835
14838
  }
@@ -14859,6 +14862,8 @@ const CheckboxInput = class {
14859
14862
  this.limitStylingAppends = true;
14860
14863
  }
14861
14864
  // end custom styling area
14865
+ }
14866
+ componentDidLoad() {
14862
14867
  if (this.defaultValue) {
14863
14868
  this.value = this.defaultValue;
14864
14869
  this.valueHandler({ name: this.name, value: this.value });
@@ -14868,7 +14873,6 @@ const CheckboxInput = class {
14868
14873
  this.value = this.inputReference.checked.toString();
14869
14874
  this.errorMessage = this.setErrorMessage();
14870
14875
  this.isValid = this.setValidity();
14871
- this.validityStateHandler({ valid: this.isValid, name: this.name });
14872
14876
  this.emitValueHandler(true);
14873
14877
  }
14874
14878
  setValidity() {
@@ -14889,7 +14893,7 @@ const CheckboxInput = class {
14889
14893
  return null;
14890
14894
  }
14891
14895
  render() {
14892
- return index.h("div", { class: 'checkbox__wrapper', ref: el => this.stylingContainer = el }, index.h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, checked: this.defaultValue === "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), this.renderLabel(), index.h("small", { class: 'checkbox__error-message' }, this.errorMessage), index.h("div", { class: 'checkbox__wrapper--relative' }, this.tooltip &&
14896
+ return index.h("div", { class: `checkbox__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, checked: this.defaultValue === "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), this.renderLabel(), index.h("small", { class: 'checkbox__error-message' }, this.errorMessage), index.h("div", { class: 'checkbox__wrapper--relative' }, this.tooltip &&
14893
14897
  index.h("img", { class: 'checkbox__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()));
14894
14898
  }
14895
14899
  static get watchers() { return {
@@ -29227,6 +29231,7 @@ const DateInput = class {
29227
29231
  this.clientStyling = '';
29228
29232
  this.limitStylingAppends = false;
29229
29233
  this.showTooltip = false;
29234
+ this.touched = false;
29230
29235
  this.formatDate = (dateParts) => {
29231
29236
  const { year, month, day } = dateParts;
29232
29237
  const date = new Date(year, month, day);
@@ -29236,6 +29241,11 @@ const DateInput = class {
29236
29241
  const date = parse(inputValue, this.dateFormat || 'yyyy-MM-dd', new Date());
29237
29242
  return { year: date.getFullYear(), month: date.getMonth(), day: date.getDate() };
29238
29243
  };
29244
+ this.handleBlur = () => {
29245
+ this.isValid = this.setValidity();
29246
+ this.errorMessage = this.setErrorMessage();
29247
+ this.touched = true;
29248
+ };
29239
29249
  this.setClientStyling = () => {
29240
29250
  let sheet = document.createElement('style');
29241
29251
  sheet.innerHTML = this.clientStyling;
@@ -29273,21 +29283,22 @@ const DateInput = class {
29273
29283
  this.limitStylingAppends = true;
29274
29284
  }
29275
29285
  // end custom styling area
29276
- if (this.defaultValue) {
29277
- this.value = this.defaultValue;
29278
- this.valueHandler({ name: this.name, value: this.value });
29279
- }
29280
29286
  }
29281
29287
  componentDidLoad() {
29282
29288
  this.datePicker = this.element.shadowRoot.querySelector('vaadin-date-picker');
29283
29289
  this.inputReference = this.element.shadowRoot.querySelector('input');
29284
29290
  this.datePicker.i18n = Object.assign(Object.assign({}, this.datePicker.i18n), { formatDate: this.formatDate, parseDate: this.parseDate });
29291
+ this.isValid = this.setValidity();
29292
+ if (this.defaultValue) {
29293
+ this.value = this.defaultValue;
29294
+ this.valueHandler({ name: this.name, value: this.value });
29295
+ }
29285
29296
  }
29286
29297
  handleInput(event) {
29287
29298
  this.value = event.target.value;
29299
+ this.touched = true;
29288
29300
  this.errorMessage = this.setErrorMessage();
29289
29301
  this.isValid = this.setValidity();
29290
- this.validityStateHandler({ valid: this.isValid, name: this.name });
29291
29302
  this.emitValueHandler(true);
29292
29303
  }
29293
29304
  setValidity() {
@@ -29308,8 +29319,11 @@ const DateInput = class {
29308
29319
  return null;
29309
29320
  }
29310
29321
  render() {
29311
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'date__input--invalid';
29312
- return index.h("div", { class: 'date__wrapper', ref: el => this.stylingContainer = el }, index.h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.h("vaadin-date-picker", { id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onChange: (e) => this.handleInput(e) }), index.h("small", { class: 'date__error-message' }, this.errorMessage), this.tooltip &&
29322
+ let invalidClass;
29323
+ if (this.touched) {
29324
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
29325
+ }
29326
+ return index.h("div", { class: `date__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.h("vaadin-date-picker", { id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onChange: (e) => this.handleInput(e), onBlur: this.handleBlur }), index.h("small", { class: 'date__error-message' }, this.errorMessage), this.tooltip &&
29313
29327
  index.h("img", { class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
29314
29328
  }
29315
29329
  get element() { return index.getElement(this); }
@@ -29334,6 +29348,24 @@ const EmailInput = class {
29334
29348
  this.limitStylingAppends = false;
29335
29349
  this.showTooltip = false;
29336
29350
  this.validationPattern = '';
29351
+ this.touched = false;
29352
+ this.handleInput = (event) => {
29353
+ this.value = event.target.value;
29354
+ this.touched = true;
29355
+ if (this.debounceTime) {
29356
+ clearTimeout(this.debounceTime);
29357
+ }
29358
+ this.debounceTime = setTimeout(() => {
29359
+ this.isValid = this.setValidity();
29360
+ this.errorMessage = this.setErrorMessage();
29361
+ this.emitValueHandler(true);
29362
+ }, 500);
29363
+ };
29364
+ this.handleBlur = () => {
29365
+ this.isValid = this.setValidity();
29366
+ this.errorMessage = this.setErrorMessage();
29367
+ this.touched = true;
29368
+ };
29337
29369
  this.setClientStyling = () => {
29338
29370
  let sheet = document.createElement('style');
29339
29371
  sheet.innerHTML = this.clientStyling;
@@ -29381,18 +29413,14 @@ const EmailInput = class {
29381
29413
  this.limitStylingAppends = true;
29382
29414
  }
29383
29415
  // end custom styling area
29416
+ }
29417
+ componentDidLoad() {
29418
+ this.isValid = this.setValidity();
29384
29419
  if (this.defaultValue) {
29385
29420
  this.value = this.defaultValue;
29386
29421
  this.valueHandler({ name: this.name, value: this.value });
29387
29422
  }
29388
29423
  }
29389
- handleInput(event) {
29390
- this.value = event.target.value;
29391
- this.errorMessage = this.setErrorMessage();
29392
- this.isValid = this.setValidity();
29393
- this.validityStateHandler({ valid: this.isValid, name: this.name });
29394
- this.emitValueHandler(true);
29395
- }
29396
29424
  setValidity() {
29397
29425
  return this.inputReference.validity.valid;
29398
29426
  }
@@ -29424,9 +29452,12 @@ const EmailInput = class {
29424
29452
  return null;
29425
29453
  }
29426
29454
  render() {
29427
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'email__input--invalid';
29428
- return index.h("div", { class: 'email__wrapper', ref: el => this.stylingContainer = el }, index.h("div", { class: 'email__wrapper--flex' }, index.h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'email__wrapper--relative' }, this.tooltip &&
29429
- index.h("img", { class: 'email__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("input", { id: `${this.name}__input`, type: 'email', class: `email__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onBlur: (e) => this.handleInput(e) }), index.h("small", { class: 'email__error-message' }, this.errorMessage));
29455
+ let invalidClass;
29456
+ if (this.touched) {
29457
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
29458
+ }
29459
+ return index.h("div", { class: `email__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'email__wrapper--flex' }, index.h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'email__wrapper--relative' }, this.tooltip &&
29460
+ index.h("img", { class: 'email__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("input", { id: `${this.name}__input`, type: 'email', class: `email__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), index.h("small", { class: 'email__error-message' }, this.errorMessage));
29430
29461
  }
29431
29462
  static get watchers() { return {
29432
29463
  "isValid": ["validityChanged"],
@@ -29559,9 +29590,9 @@ const GeneralRegistration = class {
29559
29590
  this.listOfInputValues = [];
29560
29591
  this.listOfInputValidity = [];
29561
29592
  this.listOfActions = [];
29562
- this.listOfSteps = [];
29563
29593
  this.listOfInputs = [];
29564
29594
  this.emitValue = false;
29595
+ this.backButtonPressed = false;
29565
29596
  this.registrationStepsState = {
29566
29597
  regId: null
29567
29598
  };
@@ -29588,7 +29619,9 @@ const GeneralRegistration = class {
29588
29619
  }
29589
29620
  setFormValidity() {
29590
29621
  this.errorMessage = '';
29591
- this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
29622
+ if (this.listOfInputValidity) {
29623
+ this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
29624
+ }
29592
29625
  }
29593
29626
  checkInputsValidityHandler(event) {
29594
29627
  // Set isValid state of the input in the list.
@@ -29653,7 +29686,6 @@ const GeneralRegistration = class {
29653
29686
  }
29654
29687
  backHandler(e) {
29655
29688
  e.preventDefault();
29656
- this.isLastStep = false;
29657
29689
  this.registrationStep = this.stepChange('decrement');
29658
29690
  this.stepsStateMachine({ event: 'get', type: 'inputs' });
29659
29691
  this.stepsStateMachine({ event: 'get', type: 'values' });
@@ -29877,11 +29909,13 @@ const GeneralRegistration = class {
29877
29909
  });
29878
29910
  // Set the list of actions
29879
29911
  this.listOfActions = config.content.actions.map(action => action);
29880
- this.isLastStep = this.listOfActions.some(action => action == '/register');
29881
29912
  this.registrationID = config.content.registrationID;
29882
29913
  this.registrationStep = config.content.step;
29883
- this.listOfSteps.push(this.registrationStep);
29884
- this.forms.push({ [this.registrationStep]: this.listOfInputs });
29914
+ if (this.listOfActions.some(action => action == '/register')) {
29915
+ this.lastStep = this.registrationStep;
29916
+ }
29917
+ // this.forms.push({ [this.registrationStep] : this.listOfInputs});
29918
+ this.forms = [...this.forms, { [this.registrationStep]: this.listOfInputs }];
29885
29919
  // Add the step to the registrationStepsData
29886
29920
  this.registrationStepsState.regId = this.registrationID;
29887
29921
  if (!this.registrationStepsState[this.registrationStep]) {
@@ -29919,18 +29953,18 @@ const GeneralRegistration = class {
29919
29953
  }
29920
29954
  renderForm() {
29921
29955
  return this.forms.map((form, index$1) => {
29922
- return index.h("form", { action: '.', id: `RegistrationForm${this.registrationStep}`, class: `registration__form ${this.registrationStep !== `Step${index$1 + 1}` ? 'hidden' : ''}`, ref: el => this.form = el }, form[this.registrationStep] && form[this.registrationStep].map(input => index.h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data ? input.inputType.toLowerCase() == 'checkboxgroup' ? input.data.subFields : input.data.values : [], defaultValue: input.defaultValue, autofilled: input.autofill, emitValue: this.emitValue, language: this.language, isDuplicateInput: input.isDuplicateInput, "client-styling": this.clientStyling, tooltip: input.tooltip, placeholder: input.placeholder == null ? '' : input.placeholder, dateFormat: this.dateFormat })));
29956
+ return index.h("form", { action: '.', id: `RegistrationForm${this.registrationStep}`, class: `registration__form ${this.registrationStep !== `Step${index$1 + 1}` ? 'hidden' : ''}`, ref: el => this.form = el }, form[this.registrationStep] && form[this.registrationStep].map(input => index.h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data ? input.inputType.toLowerCase() == 'checkboxgroup' ? input.data.subFields : input.data.values : [], defaultValue: input.defaultValue, autofilled: input.autofill, emitValue: this.emitValue, language: this.language, isDuplicateInput: input.isDuplicateInput, "client-styling": this.clientStyling, tooltip: input.tooltip, placeholder: input.placeholder == null ? '' : input.placeholder, dateFormat: this.dateFormat })), this.buttonInsideForm && this.renderButtons());
29923
29957
  });
29924
29958
  }
29925
29959
  ;
29926
29960
  renderButtons() {
29927
- return (index.h("div", { class: 'registration__buttons-wrapper' }, index.h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.isLastStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), index.h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language))));
29961
+ return (index.h("div", { class: 'registration__buttons-wrapper' }, index.h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), index.h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language))));
29928
29962
  }
29929
29963
  render() {
29930
29964
  if (this.isLoading) {
29931
29965
  return index.h("p", null, "Please wait, loading ...");
29932
29966
  }
29933
- return (index.h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el }, this.renderForm(), index.h("p", { class: 'registration__error-message' }, this.errorMessage), this.renderButtons()));
29967
+ return (index.h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el }, this.renderForm(), index.h("p", { class: 'registration__error-message' }, this.errorMessage), !this.buttonInsideForm && this.renderButtons()));
29934
29968
  }
29935
29969
  static get watchers() { return {
29936
29970
  "registrationStep": ["sendStep"],
@@ -29953,6 +29987,24 @@ const NumberInput = class {
29953
29987
  this.limitStylingAppends = false;
29954
29988
  this.showTooltip = false;
29955
29989
  this.validationPattern = '';
29990
+ this.touched = false;
29991
+ this.handleInput = (event) => {
29992
+ this.value = event.target.value;
29993
+ this.touched = true;
29994
+ if (this.debounceTime) {
29995
+ clearTimeout(this.debounceTime);
29996
+ }
29997
+ this.debounceTime = setTimeout(() => {
29998
+ this.isValid = this.setValidity();
29999
+ this.errorMessage = this.setErrorMessage();
30000
+ this.emitValueHandler(true);
30001
+ }, 500);
30002
+ };
30003
+ this.handleBlur = () => {
30004
+ this.isValid = this.setValidity();
30005
+ this.errorMessage = this.setErrorMessage();
30006
+ this.touched = true;
30007
+ };
29956
30008
  this.setClientStyling = () => {
29957
30009
  let sheet = document.createElement('style');
29958
30010
  sheet.innerHTML = this.clientStyling;
@@ -29993,18 +30045,14 @@ const NumberInput = class {
29993
30045
  this.limitStylingAppends = true;
29994
30046
  }
29995
30047
  // end custom styling area
30048
+ }
30049
+ componentDidLoad() {
30050
+ this.isValid = this.setValidity();
29996
30051
  if (this.defaultValue) {
29997
30052
  this.value = this.defaultValue;
29998
30053
  this.valueHandler({ name: this.name, value: this.value });
29999
30054
  }
30000
30055
  }
30001
- handleInput(event) {
30002
- this.value = event.target.value;
30003
- this.errorMessage = this.setErrorMessage();
30004
- this.isValid = this.setValidity();
30005
- this.validityStateHandler({ valid: this.isValid, name: this.name });
30006
- this.emitValueHandler(true);
30007
- }
30008
30056
  setValidity() {
30009
30057
  return this.inputReference.validity.valid;
30010
30058
  }
@@ -30033,9 +30081,12 @@ const NumberInput = class {
30033
30081
  return null;
30034
30082
  }
30035
30083
  render() {
30036
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'number__input--invalid';
30037
- return index.h("div", { class: 'number__wrapper', ref: el => this.stylingContainer = el }, index.h("div", { class: 'number__wrapper--flex' }, index.h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'number__wrapper--relative' }, this.tooltip &&
30038
- index.h("img", { class: 'number__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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) }), index.h("small", { class: 'number__error-message' }, this.errorMessage));
30084
+ let invalidClass;
30085
+ if (this.touched) {
30086
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
30087
+ }
30088
+ return index.h("div", { class: `number__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'number__wrapper--flex' }, index.h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'number__wrapper--relative' }, this.tooltip &&
30089
+ index.h("img", { class: 'number__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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, onInput: this.handleInput, onBlur: this.handleBlur }), index.h("small", { class: 'number__error-message' }, this.errorMessage));
30039
30090
  }
30040
30091
  static get watchers() { return {
30041
30092
  "isValid": ["validityChanged"],
@@ -30861,6 +30912,27 @@ const PasswordInput = class {
30861
30912
  this.value = '';
30862
30913
  this.validationPattern = '';
30863
30914
  this.duplicateInputValue = null;
30915
+ this.handleInput = (event) => {
30916
+ this.value = event.target.value;
30917
+ this.calculateComplexity(this.value);
30918
+ this.showPopup = true;
30919
+ this.touched = true;
30920
+ if (this.debounceTime) {
30921
+ clearTimeout(this.debounceTime);
30922
+ }
30923
+ this.debounceTime = setTimeout(() => {
30924
+ this.isValid = this.setValidity();
30925
+ this.errorMessage = this.setErrorMessage();
30926
+ this.emitValueHandler(true);
30927
+ }, 500);
30928
+ };
30929
+ this.handleBlur = (event) => {
30930
+ this.value = event.target.value;
30931
+ this.showPopup = false;
30932
+ this.touched = true;
30933
+ this.isValid = this.setValidity();
30934
+ this.errorMessage = this.setErrorMessage();
30935
+ };
30864
30936
  this.setClientStyling = () => {
30865
30937
  let sheet = document.createElement('style');
30866
30938
  sheet.innerHTML = this.clientStyling;
@@ -30875,7 +30947,7 @@ const PasswordInput = class {
30875
30947
  }
30876
30948
  emitValueHandler(newValue) {
30877
30949
  if (newValue == true && this.isValid) {
30878
- this.valueHandler({ name: this.name, value: this.value });
30950
+ this.valueHandler({ name: this.name, value: this.value, type: 'duplicate' });
30879
30951
  }
30880
30952
  }
30881
30953
  validityStateHandler(inputStateEvent) {
@@ -30885,12 +30957,16 @@ const PasswordInput = class {
30885
30957
  this.sendInputValue.emit(inputValueEvent);
30886
30958
  }
30887
30959
  valueChangedHandler(event) {
30888
- if (this.isDuplicateInput) {
30889
- if (this.name === event.detail.name + 'Duplicate') {
30890
- this.duplicateInputValue = event.detail.value;
30960
+ if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
30961
+ this.duplicateInputValue = event.detail.value;
30962
+ if (this.touched) {
30963
+ this.isValid = this.setValidity();
30964
+ this.errorMessage = this.setErrorMessage();
30891
30965
  }
30892
30966
  }
30893
- if (this.name === event.detail.name + 'Duplicate' && this.name.replace('Duplicate', '') === event.detail.name && this.touched === true) {
30967
+ if (this.name === event.detail.name + 'Duplicate'
30968
+ && this.name.replace('Duplicate', '') === event.detail.name
30969
+ && this.touched === true) {
30894
30970
  this.isValid = this.setValidity();
30895
30971
  this.errorMessage = this.setErrorMessage();
30896
30972
  }
@@ -30917,27 +30993,17 @@ const PasswordInput = class {
30917
30993
  this.inputReference = this.element.shadowRoot.querySelector('input');
30918
30994
  this.passwordButton = this.element.shadowRoot.querySelector('vaadin-password-field-button');
30919
30995
  this.passwordButton.tabIndex = -1;
30996
+ this.isValid = this.setValidity();
30920
30997
  if (this.defaultValue) {
30921
30998
  this.value = this.defaultValue;
30922
30999
  this.calculateComplexity(this.value);
30923
31000
  this.valueHandler({ name: this.name, value: this.value });
31001
+ if (this.isDuplicateInput) {
31002
+ this.duplicateInputValue = this.defaultValue;
31003
+ this.touched = true;
31004
+ }
30924
31005
  }
30925
31006
  }
30926
- handleInput(event) {
30927
- this.value = event.target.value;
30928
- this.calculateComplexity(this.value);
30929
- this.showPopup = true;
30930
- this.errorMessage = this.setErrorMessage();
30931
- this.isValid = this.setValidity();
30932
- this.validityStateHandler({ valid: this.isValid, name: this.name });
30933
- this.emitValueHandler(true);
30934
- this.touched = true;
30935
- }
30936
- handleBlur() {
30937
- this.errorMessage = this.setErrorMessage();
30938
- this.isValid = this.setValidity();
30939
- this.showPopup = false;
30940
- }
30941
31007
  calculateComplexity(password) {
30942
31008
  this.passwordComplexity = this.validation.custom
30943
31009
  .filter(rule => rule.rule === 'regex')
@@ -30948,14 +31014,15 @@ const PasswordInput = class {
30948
31014
  });
30949
31015
  }
30950
31016
  setValidity() {
31017
+ var _a, _b;
30951
31018
  if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
30952
31019
  return false;
30953
31020
  }
30954
- else if (!this.passwordComplexity.every(complexity => complexity.passed)) {
31021
+ else if (!((_a = this.passwordComplexity) === null || _a === void 0 ? void 0 : _a.every(complexity => complexity.passed))) {
30955
31022
  return false;
30956
31023
  }
30957
31024
  else {
30958
- return this.inputReference.validity.valid;
31025
+ return (_b = this.inputReference) === null || _b === void 0 ? void 0 : _b.validity.valid;
30959
31026
  }
30960
31027
  }
30961
31028
  setPattern() {
@@ -30997,9 +31064,12 @@ const PasswordInput = class {
30997
31064
  }))));
30998
31065
  }
30999
31066
  render() {
31000
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'password__input--invalid';
31001
- return index.h("div", { class: 'password__wrapper', ref: el => this.stylingContainer = el }, index.h("div", { class: 'password__wrapper--flex' }, index.h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'password__wrapper--relative' }, this.tooltip &&
31002
- index.h("img", { class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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.handleBlur(), onFocus: () => this.showPopup = true }), index.h("small", { class: 'password__error-message' }, this.errorMessage), this.passwordComplexity && !this.isDuplicateInput && this.renderComplexityPopup());
31067
+ let invalidClass;
31068
+ if (this.touched) {
31069
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
31070
+ }
31071
+ return index.h("div", { class: `password__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'password__wrapper--flex' }, index.h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'password__wrapper--relative' }, this.tooltip &&
31072
+ index.h("img", { class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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: this.handleInput, onBlur: this.handleBlur, onFocus: () => this.showPopup = true }), index.h("small", { class: 'password__error-message' }, this.errorMessage), this.passwordComplexity && !this.isDuplicateInput && this.renderComplexityPopup());
31003
31073
  }
31004
31074
  get element() { return index.getElement(this); }
31005
31075
  static get watchers() { return {
@@ -31064,7 +31134,6 @@ const RadioInput = class {
31064
31134
  this.value = event.target.value;
31065
31135
  this.isValid = this.setValidity();
31066
31136
  this.errorMessage = this.setErrorMessage();
31067
- this.validityStateHandler({ valid: this.isValid, name: this.name });
31068
31137
  this.emitValueHandler(true);
31069
31138
  }
31070
31139
  setValidity() {
@@ -31082,7 +31151,7 @@ const RadioInput = class {
31082
31151
  return null;
31083
31152
  }
31084
31153
  render() {
31085
- return index.h("fieldset", { class: 'radio__fieldset', ref: el => this.stylingContainer = el }, index.h("legend", { class: 'radio__legend' }, this.displayName, ":"), this.optionsGroup.map(option => index.h("div", { class: 'radio__wrapper' }, index.h("input", { type: "radio", class: 'radio__input', id: `${option.label}__input`, ref: (el) => this.inputReference = el, value: option.value, name: this.name, required: this.validation.mandatory, onClick: (e) => this.handleClick(e) }), index.h("label", { htmlFor: `${option.label}__input` }, option.label))), index.h("small", { class: 'radio__error-message' }, this.errorMessage), this.tooltip &&
31154
+ return index.h("fieldset", { class: `radio__fieldset ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("legend", { class: 'radio__legend' }, this.displayName, ":"), this.optionsGroup.map(option => index.h("div", { class: 'radio__wrapper' }, index.h("input", { type: "radio", class: 'radio__input', id: `${option.label}__input`, ref: (el) => this.inputReference = el, value: option.value, name: this.name, required: this.validation.mandatory, onClick: (e) => this.handleClick(e) }), index.h("label", { htmlFor: `${option.label}__input` }, option.label))), index.h("small", { class: 'radio__error-message' }, this.errorMessage), this.tooltip &&
31086
31155
  index.h("img", { class: 'radio__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
31087
31156
  }
31088
31157
  static get watchers() { return {
@@ -35438,6 +35507,14 @@ const SelectInput = class {
35438
35507
  this.clientStyling = '';
35439
35508
  this.limitStylingAppends = false;
35440
35509
  this.showTooltip = false;
35510
+ this.touched = false;
35511
+ this.handleChange = (event) => {
35512
+ this.touched = true;
35513
+ this.value = event.target.value;
35514
+ this.isValid = this.setValidity();
35515
+ this.errorMessage = this.setErrorMessage();
35516
+ this.emitValueHandler(true);
35517
+ };
35441
35518
  this.setClientStyling = () => {
35442
35519
  let sheet = document.createElement('style');
35443
35520
  sheet.innerHTML = this.clientStyling;
@@ -35492,6 +35569,7 @@ const SelectInput = class {
35492
35569
  }
35493
35570
  componentDidLoad() {
35494
35571
  this.inputReference = this.element.shadowRoot.querySelector('input');
35572
+ this.isValid = this.setValidity();
35495
35573
  if (this.defaultValue) {
35496
35574
  this.value = this.defaultValue;
35497
35575
  this.valueHandler({ name: this.name, value: this.value });
@@ -35511,13 +35589,6 @@ const SelectInput = class {
35511
35589
  });
35512
35590
  });
35513
35591
  }
35514
- handleChange(event) {
35515
- this.value = event.target.value;
35516
- this.errorMessage = this.setErrorMessage();
35517
- this.isValid = this.setValidity();
35518
- this.validityStateHandler({ valid: this.isValid, name: this.name });
35519
- this.emitValueHandler(true);
35520
- }
35521
35592
  setValidity() {
35522
35593
  return this.inputReference.validity.valid;
35523
35594
  }
@@ -35533,9 +35604,12 @@ const SelectInput = class {
35533
35604
  return null;
35534
35605
  }
35535
35606
  render() {
35536
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'select__input--invalid';
35537
- return index.h("div", { class: 'select__wrapper', ref: el => this.stylingContainer = el }, index.h("div", { class: 'select__wrapper--flex' }, index.h("label", { class: 'select__label', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), index.h("div", { class: 'select__wrapper--relative' }, this.tooltip &&
35538
- index.h("img", { class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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) }), index.h("small", { class: 'select__error-message' }, this.errorMessage));
35607
+ let invalidClass;
35608
+ if (this.touched) {
35609
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
35610
+ }
35611
+ return index.h("div", { class: `select__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'select__wrapper--flex' }, index.h("label", { class: 'select__label', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), index.h("div", { class: 'select__wrapper--relative' }, this.tooltip &&
35612
+ index.h("img", { class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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: this.handleChange }), index.h("small", { class: 'select__error-message' }, this.errorMessage));
35539
35613
  }
35540
35614
  get element() { return index.getElement(this); }
35541
35615
  static get watchers() { return {
@@ -35559,6 +35633,25 @@ const TelInput = class {
35559
35633
  this.limitStylingAppends = false;
35560
35634
  this.showTooltip = false;
35561
35635
  this.validationPattern = '';
35636
+ this.touched = false;
35637
+ this.handleInput = (event) => {
35638
+ this.phoneValue = event.target.value;
35639
+ this.value = { prefix: this.prefixValue, phone: this.phoneValue };
35640
+ this.touched = true;
35641
+ if (this.debounceTime) {
35642
+ clearTimeout(this.debounceTime);
35643
+ }
35644
+ this.debounceTime = setTimeout(() => {
35645
+ this.isValid = this.setValidity();
35646
+ this.errorMessage = this.setErrorMessage();
35647
+ this.emitValueHandler(true);
35648
+ }, 500);
35649
+ };
35650
+ this.handleBlur = () => {
35651
+ this.isValid = this.setValidity();
35652
+ this.touched = true;
35653
+ this.errorMessage = this.setErrorMessage();
35654
+ };
35562
35655
  this.setClientStyling = () => {
35563
35656
  let sheet = document.createElement('style');
35564
35657
  sheet.innerHTML = this.clientStyling;
@@ -35598,7 +35691,8 @@ const TelInput = class {
35598
35691
  componentWillLoad() {
35599
35692
  if (this.action) {
35600
35693
  if (this.action.split(" ")[0] == 'GET') {
35601
- return this.getPhoneCodes().then((options) => {
35694
+ const endpoint = this.action.split(" ")[1];
35695
+ return this.getPhoneCodes(endpoint).then((options) => {
35602
35696
  this.phoneCodesOptions = options.phoneCodes.map(code => {
35603
35697
  return { label: code.Prefix, value: code.Prefix };
35604
35698
  });
@@ -35614,14 +35708,16 @@ const TelInput = class {
35614
35708
  this.limitStylingAppends = true;
35615
35709
  }
35616
35710
  // end custom styling area
35711
+ }
35712
+ componentDidLoad() {
35713
+ this.isValid = this.setValidity();
35617
35714
  if (this.defaultValue) {
35618
- this.value = { prefix: this.prefixValue, phone: this.phoneValue };
35619
- this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
35715
+ this.value = this.defaultValue;
35716
+ this.valueHandler({ name: this.name, value: this.value });
35620
35717
  }
35621
35718
  }
35622
- getPhoneCodes() {
35623
- // TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
35624
- const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes");
35719
+ getPhoneCodes(endpoint) {
35720
+ const url = new URL(endpoint);
35625
35721
  return new Promise((resolve, reject) => {
35626
35722
  fetch(url.href)
35627
35723
  .then((res) => res.json())
@@ -35633,14 +35729,6 @@ const TelInput = class {
35633
35729
  });
35634
35730
  });
35635
35731
  }
35636
- handleInput(event) {
35637
- this.phoneValue = event.target.value;
35638
- this.value = { prefix: this.prefixValue, phone: this.phoneValue };
35639
- this.errorMessage = this.setErrorMessage();
35640
- this.isValid = this.setValidity();
35641
- this.validityStateHandler({ valid: this.isValid, name: this.name });
35642
- this.emitValueHandler(true);
35643
- }
35644
35732
  handlePrefixInput(event) {
35645
35733
  this.prefixValue = event.target.value;
35646
35734
  this.value = { prefix: this.prefixValue, phone: this.phoneValue };
@@ -35674,9 +35762,12 @@ const TelInput = class {
35674
35762
  return null;
35675
35763
  }
35676
35764
  render() {
35677
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__wrapper--flex--invalid';
35678
- return index.h("div", { class: 'tel__wrapper', ref: el => this.stylingContainer = el }, index.h("div", { class: 'tel__wrapper--flex-label' }, index.h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'tel__wrapper--relative' }, this.tooltip &&
35679
- index.h("img", { class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("div", { class: `tel__wrapper--flex ${invalidClass}` }, index.h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onChange: (e) => this.handlePrefixInput(e) }), index.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) })), index.h("small", { class: 'tel__error-message' }, this.errorMessage));
35765
+ let invalidClass;
35766
+ if (this.touched) {
35767
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
35768
+ }
35769
+ return index.h("div", { class: `tel__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'tel__wrapper--flex-label' }, index.h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'tel__wrapper--relative' }, this.tooltip &&
35770
+ index.h("img", { class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("div", { class: `tel__wrapper--flex ${invalidClass}` }, index.h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onChange: (e) => this.handlePrefixInput(e) }), index.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, onInput: this.handleInput, onBlur: this.handleBlur })), index.h("small", { class: 'tel__error-message' }, this.errorMessage));
35680
35771
  }
35681
35772
  static get watchers() { return {
35682
35773
  "isValid": ["validityChanged"],
@@ -35707,6 +35798,26 @@ const TextInput = class {
35707
35798
  this.validationPattern = '';
35708
35799
  this.duplicateInputValue = null;
35709
35800
  this.touched = false;
35801
+ this.handleInput = (event) => {
35802
+ this.value = event.target.value;
35803
+ this.touched = true;
35804
+ if (this.debounceTime) {
35805
+ clearTimeout(this.debounceTime);
35806
+ }
35807
+ this.debounceTime = setTimeout(() => {
35808
+ this.isValid = this.setValidity();
35809
+ this.errorMessage = this.setErrorMessage();
35810
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
35811
+ this.emitValueHandler(true);
35812
+ }, 500);
35813
+ };
35814
+ this.handleBlur = (event) => {
35815
+ this.value = event.target.value;
35816
+ this.touched = true;
35817
+ this.isValid = this.setValidity();
35818
+ this.errorMessage = this.setErrorMessage();
35819
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
35820
+ };
35710
35821
  this.setClientStyling = () => {
35711
35822
  let sheet = document.createElement('style');
35712
35823
  sheet.innerHTML = this.clientStyling;
@@ -35714,6 +35825,7 @@ const TextInput = class {
35714
35825
  };
35715
35826
  }
35716
35827
  validityChanged() {
35828
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
35717
35829
  if (this.emitValue == true) {
35718
35830
  this.valueHandler({ name: this.name, value: this.value });
35719
35831
  }
@@ -35736,12 +35848,16 @@ const TextInput = class {
35736
35848
  this.showTooltip = false;
35737
35849
  }
35738
35850
  valueChangedHandler(event) {
35739
- if (this.isDuplicateInput) {
35740
- if (this.name === event.detail.name + 'Duplicate') {
35741
- this.duplicateInputValue = event.detail.value;
35851
+ if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
35852
+ this.duplicateInputValue = event.detail.value;
35853
+ if (this.touched) {
35854
+ this.isValid = this.setValidity();
35855
+ this.errorMessage = this.setErrorMessage();
35742
35856
  }
35743
35857
  }
35744
- if (this.name === event.detail.name + 'Duplicate' && this.name.replace('Duplicate', '') === event.detail.name && this.touched === true) {
35858
+ if (this.name === event.detail.name + 'Duplicate'
35859
+ && this.name.replace('Duplicate', '') === event.detail.name
35860
+ && this.touched === true) {
35745
35861
  this.isValid = this.setValidity();
35746
35862
  this.errorMessage = this.setErrorMessage();
35747
35863
  }
@@ -35757,25 +35873,24 @@ const TextInput = class {
35757
35873
  this.limitStylingAppends = true;
35758
35874
  }
35759
35875
  // end custom styling area
35876
+ }
35877
+ componentDidLoad() {
35878
+ this.isValid = this.setValidity();
35760
35879
  if (this.defaultValue) {
35761
35880
  this.value = this.defaultValue;
35762
35881
  this.valueHandler({ name: this.name, value: this.value });
35882
+ if (this.isDuplicateInput) {
35883
+ this.touched = true;
35884
+ }
35763
35885
  }
35764
35886
  }
35765
- handleInput(event) {
35766
- this.value = event.target.value;
35767
- this.isValid = this.setValidity();
35768
- this.errorMessage = this.setErrorMessage();
35769
- this.validityStateHandler({ valid: this.isValid, name: this.name });
35770
- this.emitValueHandler(true);
35771
- this.touched = true;
35772
- }
35773
35887
  setValidity() {
35888
+ var _a;
35774
35889
  if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
35775
35890
  return false;
35776
35891
  }
35777
35892
  else {
35778
- return this.inputReference.validity.valid;
35893
+ return (_a = this.inputReference) === null || _a === void 0 ? void 0 : _a.validity.valid;
35779
35894
  }
35780
35895
  }
35781
35896
  setPattern() {
@@ -35806,9 +35921,12 @@ const TextInput = class {
35806
35921
  return null;
35807
35922
  }
35808
35923
  render() {
35809
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
35810
- return index.h("div", { class: 'text__wrapper', ref: el => this.stylingContainer = el }, index.h("div", { class: 'text__wrapper--flex' }, index.h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'text__wrapper--relative' }, this.tooltip &&
35811
- index.h("img", { class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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); } }), index.h("small", { class: 'text__error-message' }, this.errorMessage));
35924
+ let invalidClass;
35925
+ if (this.touched) {
35926
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
35927
+ }
35928
+ return index.h("div", { class: `text__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'text__wrapper--flex' }, index.h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'text__wrapper--relative' }, this.tooltip &&
35929
+ index.h("img", { class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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, onInput: this.handleInput, onBlur: this.handleBlur }), index.h("small", { class: 'text__error-message' }, this.errorMessage));
35812
35930
  }
35813
35931
  static get watchers() { return {
35814
35932
  "isValid": ["validityChanged"],