@descope/web-components-ui 1.0.162 → 1.0.163

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.
package/dist/index.esm.js CHANGED
@@ -919,7 +919,7 @@ const proxyInputMixin = (superclass) =>
919
919
  }
920
920
 
921
921
  get inputElement() {
922
- if (this.#inputElement) return this.#inputElement
922
+ if (this.#inputElement) return this.#inputElement;
923
923
 
924
924
  this.warnIfInputElementIsMissing();
925
925
 
@@ -956,7 +956,7 @@ const proxyInputMixin = (superclass) =>
956
956
  // on some cases the base element is not ready so the inputElement is empty
957
957
  // we are deferring this section to make sure the base element is ready
958
958
  setTimeout(() => {
959
- this.inputElement.addEventListener('input', (e) => {
959
+ this.inputElement?.addEventListener('input', (e) => {
960
960
  if (!this.inputElement.checkValidity()) {
961
961
  this.inputElement.setCustomValidity('');
962
962
  // after updating the input validity we want to trigger set validity on the wrapping element
@@ -1000,7 +1000,6 @@ const proxyInputMixin = (superclass) =>
1000
1000
  forwardAttrs(this, this.inputElement, { includeAttrs: ['inputmode'] });
1001
1001
  });
1002
1002
  }
1003
-
1004
1003
  };
1005
1004
 
1006
1005
  const composedProxyInputMixin = compose(
@@ -2538,7 +2537,14 @@ class PasscodeInternal extends BaseInputClass$3 {
2538
2537
  input.onkeydown = ({ key }) => {
2539
2538
  // when user deletes a digit, we want to focus the previous digit
2540
2539
  if (key === 'Backspace') {
2541
- input.setSelectionRange(1, 1);
2540
+ // if value is empty then the input element does not fire `input` event
2541
+ // if this is the case, we focus the element here.
2542
+ // otherwise, the focusElement occurs as part of the `input` event listener
2543
+ if (!input.value) {
2544
+ setTimeout(() => focusElement(this.getPrevInput(input)), 0);
2545
+ } else {
2546
+ input.setSelectionRange(1, 1);
2547
+ }
2542
2548
  } else if (key.length === 1) {
2543
2549
  // we want only characters and not command keys
2544
2550
  input.value = ''; // we are clearing the previous value so we can override it with the new value