@descope/web-components-ui 1.0.159 → 1.0.161

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,12 +919,14 @@ const proxyInputMixin = (superclass) =>
919
919
  }
920
920
 
921
921
  get inputElement() {
922
+ if (this.#inputElement) return this.#inputElement
923
+
922
924
  this.warnIfInputElementIsMissing();
923
925
 
924
926
  const inputSlot = this.baseElement.shadowRoot?.querySelector('slot[name="input"]');
925
927
  const textAreaSlot = this.baseElement.shadowRoot?.querySelector('slot[name="textarea"]');
926
928
 
927
- this.#inputElement ??= getNestedInput(inputSlot) || getNestedInput(textAreaSlot);
929
+ this.#inputElement = getNestedInput(inputSlot) || getNestedInput(textAreaSlot);
928
930
 
929
931
  return this.#inputElement;
930
932
  }
@@ -951,49 +953,54 @@ const proxyInputMixin = (superclass) =>
951
953
  init() {
952
954
  super.init?.();
953
955
 
954
- this.inputElement.addEventListener('input', (e) => {
955
- if (!this.inputElement.checkValidity()) {
956
- this.inputElement.setCustomValidity('');
957
- // after updating the input validity we want to trigger set validity on the wrapping element
958
- // so we will get the updated validity
959
- this.setCustomValidity('');
960
-
961
- // Vaadin is getting the input event before us,
962
- // so in order to make sure they use the updated validity
963
- // we calling their fn after updating the input validity
964
- this.baseElement.__onInput(e);
956
+ // on some cases the base element is not ready so the inputElement is empty
957
+ // we are deferring this section to make sure the base element is ready
958
+ setTimeout(() => {
959
+ this.inputElement.addEventListener('input', (e) => {
960
+ if (!this.inputElement.checkValidity()) {
961
+ this.inputElement.setCustomValidity('');
962
+ // after updating the input validity we want to trigger set validity on the wrapping element
963
+ // so we will get the updated validity
964
+ this.setCustomValidity('');
965
+
966
+ // Vaadin is getting the input event before us,
967
+ // so in order to make sure they use the updated validity
968
+ // we calling their fn after updating the input validity
969
+ this.baseElement.__onInput(e);
970
+
971
+ this.#handleErrorMessage();
972
+ }
973
+ });
965
974
 
966
- this.#handleErrorMessage();
967
- }
968
- });
975
+ this.baseElement.addEventListener('change', () => {
976
+ this.#dispatchChange();
977
+ });
969
978
 
970
- this.baseElement.addEventListener('change', () => {
971
- this.#dispatchChange();
972
- });
979
+ this.#inputElement.addEventListener('blur', () => {
980
+ if (!this.checkValidity()) {
981
+ this.setAttribute('invalid', 'true');
982
+ this.#handleErrorMessage();
983
+ }
984
+ });
973
985
 
974
- this.#inputElement.addEventListener('blur', () => {
975
- if (!this.checkValidity()) {
976
- this.setAttribute('invalid', 'true');
986
+ this.addEventListener('invalid', () => {
987
+ if (!this.checkValidity()) {
988
+ this.setAttribute('invalid', 'true');
989
+ }
977
990
  this.#handleErrorMessage();
978
- }
979
- });
980
-
981
- this.addEventListener('invalid', () => {
982
- if (!this.checkValidity()) {
983
- this.setAttribute('invalid', 'true');
984
- }
985
- this.#handleErrorMessage();
986
- });
991
+ });
987
992
 
988
- this.handleInternalInputErrorMessage();
993
+ this.handleInternalInputErrorMessage();
989
994
 
990
- // sync properties
991
- propertyObserver(this, this.inputElement, 'value');
992
- propertyObserver(this, this.inputElement, 'selectionStart');
993
- this.setSelectionRange = this.inputElement.setSelectionRange?.bind(this.inputElement);
995
+ // sync properties
996
+ propertyObserver(this, this.inputElement, 'value');
997
+ propertyObserver(this, this.inputElement, 'selectionStart');
998
+ this.setSelectionRange = this.inputElement.setSelectionRange?.bind(this.inputElement);
994
999
 
995
- forwardAttrs(this, this.inputElement, { includeAttrs: ['inputmode'] });
1000
+ forwardAttrs(this, this.inputElement, { includeAttrs: ['inputmode'] });
1001
+ });
996
1002
  }
1003
+
997
1004
  };
998
1005
 
999
1006
  const composedProxyInputMixin = compose(
@@ -3120,18 +3127,17 @@ const ComboBoxMixin = (superclass) =>
3120
3127
  // so we override it to open inside the shadow DOM
3121
3128
  #overrideOverlaySettings() {
3122
3129
  const overlay = this.baseElement.shadowRoot.querySelector('vaadin-combo-box-overlay');
3123
-
3124
3130
  overlay._attachOverlay = () => {
3125
- this.bringToFront();
3131
+ overlay.bringToFront();
3126
3132
  };
3127
- overlay._detachOverlay = () => {};
3128
- overlay._enterModalState = () => {};
3133
+ overlay._detachOverlay = () => { };
3134
+ overlay._enterModalState = () => { };
3129
3135
  }
3130
3136
 
3131
3137
  init() {
3132
3138
  super.init?.();
3133
3139
 
3134
- this.#overrideOverlaySettings.bind(this);
3140
+ this.#overrideOverlaySettings();
3135
3141
  observeChildren(this, this.#onChildrenChange.bind(this));
3136
3142
  }
3137
3143
  };
@@ -4582,7 +4588,7 @@ class PhoneFieldInternal extends BaseInputClass$2 {
4582
4588
  const hasPhone = this.phoneNumberInput.value;
4583
4589
  const emptyValue = !hasCode || !hasPhone;
4584
4590
  const hasMinPhoneLength =
4585
- this.phoneNumberInput.value.length && this.phoneNumberInput.value.length < this.minLength;
4591
+ this.phoneNumberInput.value?.length && this.phoneNumberInput.value.length < this.minLength;
4586
4592
 
4587
4593
  if (this.isRequired && emptyValue) {
4588
4594
  return { valueMissing: true };