@everymatrix/general-registration-otp-standalone 0.0.19 → 0.0.21

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.
@@ -14182,6 +14182,38 @@ const SelectInput = class {
14182
14182
  this.errorMessage = this.setErrorMessage();
14183
14183
  this.emitValueHandler(true);
14184
14184
  };
14185
+ this.handleComboInputFocusout = (event) => {
14186
+ var _a, _b;
14187
+ if (!this.isComboOpen() || event.relatedTarget)
14188
+ return;
14189
+ event.stopImmediatePropagation();
14190
+ // A full match is highlighted: closing commits it, like Enter does.
14191
+ if (this.getHighlightedIndex() > -1) {
14192
+ (_b = (_a = this.vaadinCombo).close) === null || _b === void 0 ? void 0 : _b.call(_a);
14193
+ }
14194
+ };
14195
+ this.handleComboInputKeydown = (event) => {
14196
+ var _a;
14197
+ if (event.key !== 'Enter' || event.isComposing || !this.isComboOpen())
14198
+ return;
14199
+ if (this.getHighlightedIndex() > -1)
14200
+ return;
14201
+ event.preventDefault();
14202
+ event.stopImmediatePropagation();
14203
+ (_a = this.blurGuardInput) === null || _a === void 0 ? void 0 : _a.blur();
14204
+ };
14205
+ this.handleComboOpenedChanged = (event) => {
14206
+ var _a;
14207
+ if (event.detail.value || document.activeElement === this.blurGuardInput)
14208
+ return;
14209
+ const combo = event.currentTarget;
14210
+ (_a = combo.validate) === null || _a === void 0 ? void 0 : _a.call(combo);
14211
+ this.touched = true;
14212
+ this.value = (combo === null || combo === void 0 ? void 0 : combo.value) || '';
14213
+ this.isValid = this.setValidity();
14214
+ this.errorMessage = this.setErrorMessage();
14215
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
14216
+ };
14185
14217
  this.handleBlur = (event) => {
14186
14218
  const field = event.currentTarget;
14187
14219
  if (field.opened)
@@ -14320,6 +14352,33 @@ const SelectInput = class {
14320
14352
  });
14321
14353
  });
14322
14354
  }
14355
+ isComboOpen() {
14356
+ var _a;
14357
+ return !!((_a = this.vaadinCombo) === null || _a === void 0 ? void 0 : _a.opened);
14358
+ }
14359
+ // _focusedIndex is vaadin's private highlighted-item index (-1 = none); it may change in future vaadin versions.
14360
+ getHighlightedIndex() {
14361
+ var _a, _b;
14362
+ return (_b = (_a = this.vaadinCombo) === null || _a === void 0 ? void 0 : _a._focusedIndex) !== null && _b !== void 0 ? _b : -1;
14363
+ }
14364
+ attachBlurGuard(el) {
14365
+ const input = el === null || el === void 0 ? void 0 : el.inputElement;
14366
+ if (!input || input === this.blurGuardInput)
14367
+ return;
14368
+ this.detachBlurGuard();
14369
+ input.addEventListener('focusout', this.handleComboInputFocusout);
14370
+ input.addEventListener('keydown', this.handleComboInputKeydown);
14371
+ this.blurGuardInput = input;
14372
+ }
14373
+ detachBlurGuard() {
14374
+ var _a, _b;
14375
+ (_a = this.blurGuardInput) === null || _a === void 0 ? void 0 : _a.removeEventListener('focusout', this.handleComboInputFocusout);
14376
+ (_b = this.blurGuardInput) === null || _b === void 0 ? void 0 : _b.removeEventListener('keydown', this.handleComboInputKeydown);
14377
+ this.blurGuardInput = undefined;
14378
+ }
14379
+ disconnectedCallback() {
14380
+ this.detachBlurGuard();
14381
+ }
14323
14382
  setValidity() {
14324
14383
  var _a;
14325
14384
  if ((_a = this.validation) === null || _a === void 0 ? void 0 : _a.mandatory) {
@@ -14345,10 +14404,10 @@ const SelectInput = class {
14345
14404
  if (this.touched) {
14346
14405
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
14347
14406
  }
14348
- return index.h("div", { key: 'eb6c9d7d85546159d44d06a0635f173263edd7d1', class: `select__wrapper ${this.autofilled ? 'select__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { key: '0fd71c528870966fdb23049b1806a267e9e6ca5c', class: 'select__wrapper--flex' }, index.h("label", { key: '44aeb4e50ab2f79df06741ff07ac03131c987447', class: 'select__label', htmlFor: `${this.name}__input` }, this.displayName, index.h("span", { key: '796a83aeadd480a571b6bae035a46138d7b10b24', class: this.validation.mandatory ? 'select__label--required' : '' })), index.h("div", { key: '6d7b2d785c6b0bdd05c7444f563b21cedf26ff7c', class: 'select__wrapper--relative' }, this.tooltip &&
14349
- index.h("img", { key: 'f33e43a9d42e8b8d1cf136374505eeaedcbede26', class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), this.isComboBox ? index.h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", ref: (el) => this.vaadinCombo = el, readOnly: this.autofilled, required: (_a = this.validation) === null || _a === void 0 ? void 0 : _a.mandatory, value: this.value, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleComboChange, onBlur: this.handleBlur })
14407
+ return index.h("div", { key: '5cfd3a0d2630a31ee8fccfe35672238086e17600', class: `select__wrapper ${this.autofilled ? 'select__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { key: '3dfae7aa91098a88fe6bd5ae88d7159dce4314b4', class: 'select__wrapper--flex' }, index.h("label", { key: '9255ee7c839659607dc100a61bc5f4d0041caaa2', class: 'select__label', htmlFor: `${this.name}__input` }, this.displayName, index.h("span", { key: '99f8b6de1b652bf8ac99ad8316797b92ac1c3d95', class: this.validation.mandatory ? 'select__label--required' : '' })), index.h("div", { key: '8f43647f1caace501b465d305d34be9393f1c7e3', class: 'select__wrapper--relative' }, this.tooltip &&
14408
+ index.h("img", { key: '8f504f912fcb52fd0aab8435dfe6461b08a33c99', class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), this.isComboBox ? index.h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", ref: (el) => this.vaadinCombo = el, onFocusin: () => this.attachBlurGuard(this.vaadinCombo), "onOpened-changed": this.handleComboOpenedChanged, readOnly: this.autofilled, required: (_a = this.validation) === null || _a === void 0 ? void 0 : _a.mandatory, value: this.value, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleComboChange, onBlur: this.handleBlur })
14350
14409
  :
14351
- index.h("vaadin-select", { name: this.name, popover: false, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", ref: (el) => this.vaadinCombo = el, readOnly: this.autofilled, required: (_b = this.validation) === null || _b === void 0 ? void 0 : _b.mandatory, value: this.value, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleSelectChange, "no-vertical-overlap": true, noVerticalOverlap: true }), index.h("small", { key: '261b3c4abc9b360e6b937d851f8bfc810280a8c6', class: 'select__error-message' }, this.errorMessage));
14410
+ index.h("vaadin-select", { name: this.name, popover: false, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", ref: (el) => this.vaadinCombo = el, readOnly: this.autofilled, required: (_b = this.validation) === null || _b === void 0 ? void 0 : _b.mandatory, value: this.value, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleSelectChange, "no-vertical-overlap": true, noVerticalOverlap: true }), index.h("small", { key: '90de512d3b2f59a4b9083ed7cb0c5c7278268f2e', class: 'select__error-message' }, this.errorMessage));
14352
14411
  }
14353
14412
  static get watchers() { return {
14354
14413
  "clientStyling": ["handleClientStylingChange"],
@@ -14179,6 +14179,38 @@ const SelectInput = class {
14179
14179
  this.errorMessage = this.setErrorMessage();
14180
14180
  this.emitValueHandler(true);
14181
14181
  };
14182
+ this.handleComboInputFocusout = (event) => {
14183
+ var _a, _b;
14184
+ if (!this.isComboOpen() || event.relatedTarget)
14185
+ return;
14186
+ event.stopImmediatePropagation();
14187
+ // A full match is highlighted: closing commits it, like Enter does.
14188
+ if (this.getHighlightedIndex() > -1) {
14189
+ (_b = (_a = this.vaadinCombo).close) === null || _b === void 0 ? void 0 : _b.call(_a);
14190
+ }
14191
+ };
14192
+ this.handleComboInputKeydown = (event) => {
14193
+ var _a;
14194
+ if (event.key !== 'Enter' || event.isComposing || !this.isComboOpen())
14195
+ return;
14196
+ if (this.getHighlightedIndex() > -1)
14197
+ return;
14198
+ event.preventDefault();
14199
+ event.stopImmediatePropagation();
14200
+ (_a = this.blurGuardInput) === null || _a === void 0 ? void 0 : _a.blur();
14201
+ };
14202
+ this.handleComboOpenedChanged = (event) => {
14203
+ var _a;
14204
+ if (event.detail.value || document.activeElement === this.blurGuardInput)
14205
+ return;
14206
+ const combo = event.currentTarget;
14207
+ (_a = combo.validate) === null || _a === void 0 ? void 0 : _a.call(combo);
14208
+ this.touched = true;
14209
+ this.value = (combo === null || combo === void 0 ? void 0 : combo.value) || '';
14210
+ this.isValid = this.setValidity();
14211
+ this.errorMessage = this.setErrorMessage();
14212
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
14213
+ };
14182
14214
  this.handleBlur = (event) => {
14183
14215
  const field = event.currentTarget;
14184
14216
  if (field.opened)
@@ -14317,6 +14349,33 @@ const SelectInput = class {
14317
14349
  });
14318
14350
  });
14319
14351
  }
14352
+ isComboOpen() {
14353
+ var _a;
14354
+ return !!((_a = this.vaadinCombo) === null || _a === void 0 ? void 0 : _a.opened);
14355
+ }
14356
+ // _focusedIndex is vaadin's private highlighted-item index (-1 = none); it may change in future vaadin versions.
14357
+ getHighlightedIndex() {
14358
+ var _a, _b;
14359
+ return (_b = (_a = this.vaadinCombo) === null || _a === void 0 ? void 0 : _a._focusedIndex) !== null && _b !== void 0 ? _b : -1;
14360
+ }
14361
+ attachBlurGuard(el) {
14362
+ const input = el === null || el === void 0 ? void 0 : el.inputElement;
14363
+ if (!input || input === this.blurGuardInput)
14364
+ return;
14365
+ this.detachBlurGuard();
14366
+ input.addEventListener('focusout', this.handleComboInputFocusout);
14367
+ input.addEventListener('keydown', this.handleComboInputKeydown);
14368
+ this.blurGuardInput = input;
14369
+ }
14370
+ detachBlurGuard() {
14371
+ var _a, _b;
14372
+ (_a = this.blurGuardInput) === null || _a === void 0 ? void 0 : _a.removeEventListener('focusout', this.handleComboInputFocusout);
14373
+ (_b = this.blurGuardInput) === null || _b === void 0 ? void 0 : _b.removeEventListener('keydown', this.handleComboInputKeydown);
14374
+ this.blurGuardInput = undefined;
14375
+ }
14376
+ disconnectedCallback() {
14377
+ this.detachBlurGuard();
14378
+ }
14320
14379
  setValidity() {
14321
14380
  var _a;
14322
14381
  if ((_a = this.validation) === null || _a === void 0 ? void 0 : _a.mandatory) {
@@ -14342,10 +14401,10 @@ const SelectInput = class {
14342
14401
  if (this.touched) {
14343
14402
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
14344
14403
  }
14345
- return h("div", { key: 'eb6c9d7d85546159d44d06a0635f173263edd7d1', class: `select__wrapper ${this.autofilled ? 'select__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { key: '0fd71c528870966fdb23049b1806a267e9e6ca5c', class: 'select__wrapper--flex' }, h("label", { key: '44aeb4e50ab2f79df06741ff07ac03131c987447', class: 'select__label', htmlFor: `${this.name}__input` }, this.displayName, h("span", { key: '796a83aeadd480a571b6bae035a46138d7b10b24', class: this.validation.mandatory ? 'select__label--required' : '' })), h("div", { key: '6d7b2d785c6b0bdd05c7444f563b21cedf26ff7c', class: 'select__wrapper--relative' }, this.tooltip &&
14346
- h("img", { key: 'f33e43a9d42e8b8d1cf136374505eeaedcbede26', class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), this.isComboBox ? h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", ref: (el) => this.vaadinCombo = el, readOnly: this.autofilled, required: (_a = this.validation) === null || _a === void 0 ? void 0 : _a.mandatory, value: this.value, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleComboChange, onBlur: this.handleBlur })
14404
+ return h("div", { key: '5cfd3a0d2630a31ee8fccfe35672238086e17600', class: `select__wrapper ${this.autofilled ? 'select__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { key: '3dfae7aa91098a88fe6bd5ae88d7159dce4314b4', class: 'select__wrapper--flex' }, h("label", { key: '9255ee7c839659607dc100a61bc5f4d0041caaa2', class: 'select__label', htmlFor: `${this.name}__input` }, this.displayName, h("span", { key: '99f8b6de1b652bf8ac99ad8316797b92ac1c3d95', class: this.validation.mandatory ? 'select__label--required' : '' })), h("div", { key: '8f43647f1caace501b465d305d34be9393f1c7e3', class: 'select__wrapper--relative' }, this.tooltip &&
14405
+ h("img", { key: '8f504f912fcb52fd0aab8435dfe6461b08a33c99', class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), this.isComboBox ? h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", ref: (el) => this.vaadinCombo = el, onFocusin: () => this.attachBlurGuard(this.vaadinCombo), "onOpened-changed": this.handleComboOpenedChanged, readOnly: this.autofilled, required: (_a = this.validation) === null || _a === void 0 ? void 0 : _a.mandatory, value: this.value, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleComboChange, onBlur: this.handleBlur })
14347
14406
  :
14348
- h("vaadin-select", { name: this.name, popover: false, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", ref: (el) => this.vaadinCombo = el, readOnly: this.autofilled, required: (_b = this.validation) === null || _b === void 0 ? void 0 : _b.mandatory, value: this.value, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleSelectChange, "no-vertical-overlap": true, noVerticalOverlap: true }), h("small", { key: '261b3c4abc9b360e6b937d851f8bfc810280a8c6', class: 'select__error-message' }, this.errorMessage));
14407
+ h("vaadin-select", { name: this.name, popover: false, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", ref: (el) => this.vaadinCombo = el, readOnly: this.autofilled, required: (_b = this.validation) === null || _b === void 0 ? void 0 : _b.mandatory, value: this.value, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleSelectChange, "no-vertical-overlap": true, noVerticalOverlap: true }), h("small", { key: '90de512d3b2f59a4b9083ed7cb0c5c7278268f2e', class: 'select__error-message' }, this.errorMessage));
14349
14408
  }
14350
14409
  static get watchers() { return {
14351
14410
  "clientStyling": ["handleClientStylingChange"],