@descope/web-components-ui 1.0.86 → 1.0.88

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
@@ -776,13 +776,24 @@ const proxyInputMixin = (superclass) =>
776
776
  this.#inputElement = super.inputElement;
777
777
  }
778
778
 
779
+ // the web-component does not loaded immediately, so we want to defer the warning
780
+ // and show it only if the input element was not found after the component is loaded
781
+ warnIfInputElementIsMissing() {
782
+ clearTimeout(this.inputElementTimerId);
783
+
784
+ this.inputElementTimerId = setTimeout(() => {
785
+ !this.#inputElement && console.warn('no input was found');
786
+ }, 0);
787
+ }
788
+
779
789
  get inputElement() {
790
+ this.warnIfInputElementIsMissing();
791
+
780
792
  const inputSlot = this.baseElement.shadowRoot?.querySelector('slot[name="input"]');
781
793
  const textAreaSlot = this.baseElement.shadowRoot?.querySelector('slot[name="textarea"]');
782
794
 
783
795
  this.#inputElement ??= getNestedInput(inputSlot) || getNestedInput(textAreaSlot);
784
796
 
785
- if (!this.#inputElement) throw Error('no input was found');
786
797
 
787
798
  return this.#inputElement
788
799
  }
@@ -792,7 +803,7 @@ const proxyInputMixin = (superclass) =>
792
803
  }
793
804
 
794
805
  getValidity() {
795
- return this.inputElement.validity
806
+ return this.inputElement?.validity || {}
796
807
  }
797
808
 
798
809
  handleInternalInputErrorMessage() {