@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.
@@ -1241,12 +1241,14 @@ const proxyInputMixin = (superclass) =>
1241
1241
  }
1242
1242
 
1243
1243
  get inputElement() {
1244
+ if (this.#inputElement) return this.#inputElement
1245
+
1244
1246
  this.warnIfInputElementIsMissing();
1245
1247
 
1246
1248
  const inputSlot = this.baseElement.shadowRoot?.querySelector('slot[name="input"]');
1247
1249
  const textAreaSlot = this.baseElement.shadowRoot?.querySelector('slot[name="textarea"]');
1248
1250
 
1249
- this.#inputElement ??= getNestedInput(inputSlot) || getNestedInput(textAreaSlot);
1251
+ this.#inputElement = getNestedInput(inputSlot) || getNestedInput(textAreaSlot);
1250
1252
 
1251
1253
  return this.#inputElement;
1252
1254
  }
@@ -1273,49 +1275,54 @@ const proxyInputMixin = (superclass) =>
1273
1275
  init() {
1274
1276
  super.init?.();
1275
1277
 
1276
- this.inputElement.addEventListener('input', (e) => {
1277
- if (!this.inputElement.checkValidity()) {
1278
- this.inputElement.setCustomValidity('');
1279
- // after updating the input validity we want to trigger set validity on the wrapping element
1280
- // so we will get the updated validity
1281
- this.setCustomValidity('');
1282
-
1283
- // Vaadin is getting the input event before us,
1284
- // so in order to make sure they use the updated validity
1285
- // we calling their fn after updating the input validity
1286
- this.baseElement.__onInput(e);
1278
+ // on some cases the base element is not ready so the inputElement is empty
1279
+ // we are deferring this section to make sure the base element is ready
1280
+ setTimeout(() => {
1281
+ this.inputElement.addEventListener('input', (e) => {
1282
+ if (!this.inputElement.checkValidity()) {
1283
+ this.inputElement.setCustomValidity('');
1284
+ // after updating the input validity we want to trigger set validity on the wrapping element
1285
+ // so we will get the updated validity
1286
+ this.setCustomValidity('');
1287
+
1288
+ // Vaadin is getting the input event before us,
1289
+ // so in order to make sure they use the updated validity
1290
+ // we calling their fn after updating the input validity
1291
+ this.baseElement.__onInput(e);
1292
+
1293
+ this.#handleErrorMessage();
1294
+ }
1295
+ });
1287
1296
 
1288
- this.#handleErrorMessage();
1289
- }
1290
- });
1297
+ this.baseElement.addEventListener('change', () => {
1298
+ this.#dispatchChange();
1299
+ });
1291
1300
 
1292
- this.baseElement.addEventListener('change', () => {
1293
- this.#dispatchChange();
1294
- });
1301
+ this.#inputElement.addEventListener('blur', () => {
1302
+ if (!this.checkValidity()) {
1303
+ this.setAttribute('invalid', 'true');
1304
+ this.#handleErrorMessage();
1305
+ }
1306
+ });
1295
1307
 
1296
- this.#inputElement.addEventListener('blur', () => {
1297
- if (!this.checkValidity()) {
1298
- this.setAttribute('invalid', 'true');
1308
+ this.addEventListener('invalid', () => {
1309
+ if (!this.checkValidity()) {
1310
+ this.setAttribute('invalid', 'true');
1311
+ }
1299
1312
  this.#handleErrorMessage();
1300
- }
1301
- });
1302
-
1303
- this.addEventListener('invalid', () => {
1304
- if (!this.checkValidity()) {
1305
- this.setAttribute('invalid', 'true');
1306
- }
1307
- this.#handleErrorMessage();
1308
- });
1313
+ });
1309
1314
 
1310
- this.handleInternalInputErrorMessage();
1315
+ this.handleInternalInputErrorMessage();
1311
1316
 
1312
- // sync properties
1313
- propertyObserver(this, this.inputElement, 'value');
1314
- propertyObserver(this, this.inputElement, 'selectionStart');
1315
- this.setSelectionRange = this.inputElement.setSelectionRange?.bind(this.inputElement);
1317
+ // sync properties
1318
+ propertyObserver(this, this.inputElement, 'value');
1319
+ propertyObserver(this, this.inputElement, 'selectionStart');
1320
+ this.setSelectionRange = this.inputElement.setSelectionRange?.bind(this.inputElement);
1316
1321
 
1317
- forwardAttrs(this, this.inputElement, { includeAttrs: ['inputmode'] });
1322
+ forwardAttrs(this, this.inputElement, { includeAttrs: ['inputmode'] });
1323
+ });
1318
1324
  }
1325
+
1319
1326
  };
1320
1327
 
1321
1328
  const composedProxyInputMixin = compose(
@@ -3998,18 +4005,17 @@ const ComboBoxMixin = (superclass) =>
3998
4005
  // so we override it to open inside the shadow DOM
3999
4006
  #overrideOverlaySettings() {
4000
4007
  const overlay = this.baseElement.shadowRoot.querySelector('vaadin-combo-box-overlay');
4001
-
4002
4008
  overlay._attachOverlay = () => {
4003
- this.bringToFront();
4009
+ overlay.bringToFront();
4004
4010
  };
4005
- overlay._detachOverlay = () => {};
4006
- overlay._enterModalState = () => {};
4011
+ overlay._detachOverlay = () => { };
4012
+ overlay._enterModalState = () => { };
4007
4013
  }
4008
4014
 
4009
4015
  init() {
4010
4016
  super.init?.();
4011
4017
 
4012
- this.#overrideOverlaySettings.bind(this);
4018
+ this.#overrideOverlaySettings();
4013
4019
  observeChildren(this, this.#onChildrenChange.bind(this));
4014
4020
  }
4015
4021
  };