@aurodesignsystem-dev/auro-formkit 0.0.0-pr1508.0 → 0.0.0-pr1509.0

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.
Files changed (46) hide show
  1. package/components/checkbox/demo/customize.min.js +1 -1
  2. package/components/checkbox/demo/getting-started.min.js +1 -1
  3. package/components/checkbox/demo/index.min.js +1 -1
  4. package/components/checkbox/dist/index.js +1 -1
  5. package/components/checkbox/dist/registered.js +1 -1
  6. package/components/combobox/demo/customize.min.js +293 -141
  7. package/components/combobox/demo/getting-started.min.js +293 -141
  8. package/components/combobox/demo/index.min.js +293 -141
  9. package/components/combobox/dist/auro-combobox.d.ts +0 -9
  10. package/components/combobox/dist/index.js +293 -141
  11. package/components/combobox/dist/registered.js +293 -141
  12. package/components/counter/demo/customize.min.js +2 -2
  13. package/components/counter/demo/index.min.js +2 -2
  14. package/components/counter/dist/index.js +2 -2
  15. package/components/counter/dist/registered.js +2 -2
  16. package/components/datepicker/demo/customize.min.js +167 -44
  17. package/components/datepicker/demo/index.min.js +167 -44
  18. package/components/datepicker/dist/index.js +167 -44
  19. package/components/datepicker/dist/registered.js +167 -44
  20. package/components/dropdown/demo/customize.min.js +1 -1
  21. package/components/dropdown/demo/getting-started.min.js +1 -1
  22. package/components/dropdown/demo/index.min.js +1 -1
  23. package/components/dropdown/dist/index.js +1 -1
  24. package/components/dropdown/dist/registered.js +1 -1
  25. package/components/form/demo/customize.min.js +631 -232
  26. package/components/form/demo/getting-started.min.js +631 -232
  27. package/components/form/demo/index.min.js +631 -232
  28. package/components/form/demo/registerDemoDeps.min.js +631 -232
  29. package/components/input/demo/customize.min.js +165 -41
  30. package/components/input/demo/getting-started.min.js +165 -41
  31. package/components/input/demo/index.min.js +165 -41
  32. package/components/input/dist/base-input.d.ts +49 -1
  33. package/components/input/dist/index.js +165 -41
  34. package/components/input/dist/registered.js +165 -41
  35. package/components/radio/demo/customize.min.js +1 -1
  36. package/components/radio/demo/getting-started.min.js +1 -1
  37. package/components/radio/demo/index.min.js +1 -1
  38. package/components/radio/dist/index.js +1 -1
  39. package/components/radio/dist/registered.js +1 -1
  40. package/components/select/demo/customize.min.js +2 -2
  41. package/components/select/demo/getting-started.min.js +2 -2
  42. package/components/select/demo/index.min.js +2 -2
  43. package/components/select/dist/index.js +2 -2
  44. package/components/select/dist/registered.js +2 -2
  45. package/custom-elements.json +264 -20
  46. package/package.json +1 -1
@@ -825,8 +825,6 @@ function navigateArrow(component, direction, options = {}) {
825
825
  }
826
826
  }
827
827
 
828
- /* eslint-disable no-underscore-dangle */
829
-
830
828
  /**
831
829
  * Returns the clear button element from the active input's shadow
832
830
  * DOM, if available.
@@ -862,9 +860,11 @@ function isClearBtnFocused(ctx, clearBtn = getClearBtn(ctx)) {
862
860
  * @param {Object} menu - The menu component.
863
861
  */
864
862
  function reconcileMenuIndex(menu) {
863
+ // eslint-disable-next-line no-underscore-dangle
865
864
  if (menu._index < 0 && menu.optionActive && menu.items) {
866
865
  const idx = menu.items.indexOf(menu.optionActive);
867
866
  if (idx >= 0) {
867
+ // eslint-disable-next-line no-underscore-dangle
868
868
  menu._index = idx;
869
869
  }
870
870
  }
@@ -4888,7 +4888,7 @@ let AuroHelpText$2 = class AuroHelpText extends i$3 {
4888
4888
  }
4889
4889
  };
4890
4890
 
4891
- var formkitVersion$2 = '202606231948';
4891
+ var formkitVersion$2 = '202606232113';
4892
4892
 
4893
4893
  let AuroElement$2 = class AuroElement extends i$3 {
4894
4894
  static get properties() {
@@ -16617,7 +16617,6 @@ class AuroInputUtilities {
16617
16617
  const maskOptions = this.getMaskOptions('date', normalizedFormat);
16618
16618
 
16619
16619
  if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
16620
- console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
16621
16620
  return undefined;
16622
16621
  }
16623
16622
 
@@ -16769,8 +16768,10 @@ class BaseInput extends AuroElement$1 {
16769
16768
  this.layout = 'classic';
16770
16769
  this.locale = 'en-US';
16771
16770
  this.max = undefined;
16771
+ this._maxObject = undefined;
16772
16772
  this.maxLength = undefined;
16773
16773
  this.min = undefined;
16774
+ this._minObject = undefined;
16774
16775
  this.minLength = undefined;
16775
16776
  this.required = false;
16776
16777
  this.onDark = false;
@@ -16778,6 +16779,7 @@ class BaseInput extends AuroElement$1 {
16778
16779
  this.size = 'lg';
16779
16780
  this.shape = 'classic';
16780
16781
  this.value = undefined;
16782
+ this._valueObject = undefined;
16781
16783
 
16782
16784
  this._initializePrivateDefaults();
16783
16785
  }
@@ -17317,7 +17319,7 @@ class BaseInput extends AuroElement$1 {
17317
17319
  * @returns {Date|undefined}
17318
17320
  */
17319
17321
  get valueObject() {
17320
- return this.value && dateFormatter.isValidDate(this.value) ? dateFormatter.stringToDateInstance(this.value) : undefined;
17322
+ return this._valueObject || this._computeDateObjectFallback(this.value);
17321
17323
  }
17322
17324
 
17323
17325
  /**
@@ -17325,7 +17327,7 @@ class BaseInput extends AuroElement$1 {
17325
17327
  * @returns {Date|undefined}
17326
17328
  */
17327
17329
  get minObject() {
17328
- return this.min && dateFormatter.isValidDate(this.min) ? dateFormatter.stringToDateInstance(this.min) : undefined;
17330
+ return this._minObject || this._computeDateObjectFallback(this.min);
17329
17331
  }
17330
17332
 
17331
17333
  /**
@@ -17333,7 +17335,50 @@ class BaseInput extends AuroElement$1 {
17333
17335
  * @returns {Date|undefined}
17334
17336
  */
17335
17337
  get maxObject() {
17336
- return this.max && dateFormatter.isValidDate(this.max) ? dateFormatter.stringToDateInstance(this.max) : undefined;
17338
+ return this._maxObject || this._computeDateObjectFallback(this.max);
17339
+ }
17340
+
17341
+ /**
17342
+ * Parses a date string into a Date object when the corresponding `_*Object`
17343
+ * field hasn't been synced yet by `updated()`. Returns undefined when the
17344
+ * input type/format isn't a full date or the string is not a valid date.
17345
+ *
17346
+ * Why this exists: a parent (datepicker) can call `inputN.validate()` from
17347
+ * inside its own `updated()` before this input's `updated()` has run
17348
+ * `syncDateValues()` — so `_valueObject`/`_maxObject` are still `undefined`
17349
+ * and range checks would otherwise silently no-op (flipping the result to
17350
+ * `valid` or `patternMismatch`).
17351
+ * @private
17352
+ * @param {string|undefined} dateStr - ISO date string from `value`/`min`/`max`.
17353
+ * @returns {Date|undefined}
17354
+ */
17355
+ _computeDateObjectFallback(dateStr) {
17356
+ if (!dateStr || !this.util || !this.util.isFullDateFormat(this.type, this.format)) {
17357
+ return undefined;
17358
+ }
17359
+ if (!dateFormatter.isValidDate(dateStr)) {
17360
+ return undefined;
17361
+ }
17362
+ return dateFormatter.stringToDateInstance(dateStr);
17363
+ }
17364
+
17365
+ /**
17366
+ * Internal setter for readonly date object properties.
17367
+ * @private
17368
+ * @param {'valueObject'|'minObject'|'maxObject'} propertyName - Public object property name.
17369
+ * @param {Date|undefined} propertyValue - Value to assign.
17370
+ * @returns {void}
17371
+ */
17372
+ setDateObjectProperty(propertyName, propertyValue) {
17373
+ const internalPropertyName = `_${propertyName}`;
17374
+ const previousValue = this[internalPropertyName];
17375
+
17376
+ if (previousValue === propertyValue) {
17377
+ return;
17378
+ }
17379
+
17380
+ this[internalPropertyName] = propertyValue;
17381
+ this.requestUpdate(propertyName, previousValue);
17337
17382
  }
17338
17383
 
17339
17384
  connectedCallback() {
@@ -17362,6 +17407,7 @@ class BaseInput extends AuroElement$1 {
17362
17407
  format: this.format
17363
17408
  });
17364
17409
  this.configureDataForType();
17410
+ this.syncDateValues();
17365
17411
  }
17366
17412
 
17367
17413
  disconnectedCallback() {
@@ -17381,6 +17427,15 @@ class BaseInput extends AuroElement$1 {
17381
17427
  this.wrapperElement.addEventListener('click', this.handleClick);
17382
17428
  }
17383
17429
 
17430
+ // add attribute for query selectors when auro-input is registered under a custom name
17431
+ // COVERAGE: the body of this branch is unreachable in WTR — connectedCallback
17432
+ // performs the same `setAttribute('auro-input', '')` earlier (see L665-667),
17433
+ // so by the time firstUpdated runs the attribute is already present and the
17434
+ // `!hasAttribute('auro-input')` guard is false. Retained as a defensive
17435
+ // safety net in case connectedCallback is ever short-circuited.
17436
+ if (this.tagName.toLowerCase() !== 'auro-input' && !this.hasAttribute('auro-input')) {
17437
+ this.setAttribute('auro-input', '');
17438
+ }
17384
17439
  this.inputId = this.id ? `${this.id}-input` : window.crypto.randomUUID();
17385
17440
 
17386
17441
  // use validity message override if declared when initializing the component
@@ -17391,6 +17446,7 @@ class BaseInput extends AuroElement$1 {
17391
17446
  this.setCustomHelpTextMessage();
17392
17447
  this.configureAutoFormatting();
17393
17448
  this.configureDataForType();
17449
+ this.syncDateValues();
17394
17450
  }
17395
17451
 
17396
17452
  /**
@@ -17466,6 +17522,13 @@ class BaseInput extends AuroElement$1 {
17466
17522
 
17467
17523
  if (typeToI18n.includes(this.type)) {
17468
17524
  this.setCustomValidityForType = i18n(this.lang, this.type);
17525
+ // COVERAGE: this `else if` branch is unreachable in WTR. connectedCallback
17526
+ // (L682) calls configureDataForType, which at L1266-1268 assigns
17527
+ // `this.format = this.util.getDateMaskFromLocale().toLowerCase()` for any
17528
+ // type=date input whose `format` attribute is unset. That runs before
17529
+ // firstUpdated invokes setCustomHelpTextMessage, so `!this.format` is
17530
+ // always false here. Retained as a defensive fallback; the whole function
17531
+ // is @deprecated per AB#1557296 and slated for removal.
17469
17532
  } else if (!this.format && this.type === 'date') {
17470
17533
  this.setCustomValidityForType = i18n(this.lang, 'dateMMDDYYYY');
17471
17534
  } else if (this.dateFormatMap[this.format]) {
@@ -17527,6 +17590,8 @@ class BaseInput extends AuroElement$1 {
17527
17590
  this.configureDataForType();
17528
17591
  }
17529
17592
 
17593
+ this.syncDateValues(changedProperties);
17594
+
17530
17595
  if (changedProperties.has('value')) {
17531
17596
  if (this.value && this.value.length > 0) {
17532
17597
  this.hasValue = true;
@@ -17548,14 +17613,14 @@ class BaseInput extends AuroElement$1 {
17548
17613
 
17549
17614
  if (formattedValue !== this.inputElement.value) {
17550
17615
  this.skipNextProgrammaticInputEvent = true;
17551
- if (this.maskInstance && this.type !== 'date') {
17616
+ if (this.maskInstance && this.type === 'credit-card') {
17552
17617
  // Route through the mask so its _value and el.value stay in lock-step
17553
17618
  // (set value calls updateControl which writes el.value = displayValue).
17554
17619
  // Writing el.value directly leaves the mask thinking displayValue is
17555
- // stale; _saveSelection on the next focus/click then warns. Date is
17556
- // excluded because its formattedValue can be raw ISO when the calendar
17557
- // is invalid, and re-masking through mm/dd/yyyy would truncate it and
17558
- // flip validity from patternMismatch to tooShort.
17620
+ // stale; _saveSelection on the next focus/click then warns. Scoped to
17621
+ // credit-card so date's own formattedValue (raw ISO when calendar-invalid)
17622
+ // isn't re-masked through the mm/dd/yyyy mask, which would truncate it
17623
+ // and flip validity from patternMismatch to tooShort.
17559
17624
  this.maskInstance.value = formattedValue || '';
17560
17625
  } else if (formattedValue) {
17561
17626
  this.inputElement.value = formattedValue;
@@ -17597,65 +17662,120 @@ class BaseInput extends AuroElement$1 {
17597
17662
  }));
17598
17663
  }
17599
17664
 
17665
+
17666
+ /**
17667
+ * Synchronizes the ISO string values and Date object representations for date-related properties.
17668
+ * This keeps the model and display values aligned when either side changes.
17669
+ *
17670
+ * When a full date format is in use, this method updates `value`, `min`, and `max` from their corresponding
17671
+ * Date objects or vice versa, based on which properties have changed. It only runs when the current configuration
17672
+ * represents a full year/month/day date format.
17673
+ *
17674
+ * @param {Map<string, unknown>|undefined} [changedProperties=undefined] - Optional map of changed properties used to limit which values are synchronized.
17675
+ * @returns {void}
17676
+ * @private
17677
+ */
17678
+ syncDateValues(changedProperties = undefined) {
17679
+ if (!this.util.isFullDateFormat(this.type, this.format)) {
17680
+ return;
17681
+ }
17682
+
17683
+ this.syncSingleDateValue(changedProperties, 'valueObject', 'value');
17684
+ this.syncSingleDateValue(changedProperties, 'minObject', 'min');
17685
+ this.syncSingleDateValue(changedProperties, 'maxObject', 'max');
17686
+ }
17687
+
17688
+ /**
17689
+ * Synchronizes one date object/string property pair.
17690
+ * @private
17691
+ * @param {Map<string, unknown>|undefined} changedProperties - Map of changed properties from Lit.
17692
+ * @param {string} objectProperty - Date object property name.
17693
+ * @param {string} valueProperty - ISO string property name.
17694
+ * @returns {void}
17695
+ */
17696
+ syncSingleDateValue(changedProperties, objectProperty, valueProperty) {
17697
+ const objectPropertyChanged = !changedProperties || changedProperties.has(objectProperty);
17698
+
17699
+ // objectProperty wins over valueProperty when both changed
17700
+ if (objectPropertyChanged && this[objectProperty]) {
17701
+ this[valueProperty] = dateFormatter.toISOFormatString(this[objectProperty]);
17702
+ return;
17703
+ }
17704
+
17705
+ const valuePropertyChanged = !changedProperties || changedProperties.has(valueProperty);
17706
+ if (!valuePropertyChanged) {
17707
+ return;
17708
+ }
17709
+
17710
+ // when value is newly set to the same ISO string that corresponds to the existing Date object, do not clear the Date object (avoid unnecessary updates)
17711
+ if (
17712
+ changedProperties &&
17713
+ valueProperty === 'value' &&
17714
+ changedProperties.get('value') === undefined &&
17715
+ this[objectProperty] instanceof Date &&
17716
+ this[valueProperty] === dateFormatter.toISOFormatString(this[objectProperty])
17717
+ ) {
17718
+ return;
17719
+ }
17720
+
17721
+ if (dateFormatter.isValidDate(this[valueProperty])) {
17722
+ this.setDateObjectProperty(objectProperty, dateFormatter.stringToDateInstance(this[valueProperty]));
17723
+ } else {
17724
+ this.setDateObjectProperty(objectProperty, undefined);
17725
+ }
17726
+ }
17727
+
17600
17728
  /**
17601
17729
  * Sets up IMasks and logic based on auto-formatting requirements.
17602
17730
  * @private
17603
17731
  * @returns {void}
17604
17732
  */
17605
17733
  configureAutoFormatting() {
17606
- // _configuringMask gates two things: external re-entry into this method
17607
- // while setup is mid-flight (from property changes that call back here),
17608
- // and the accept/complete listeners below both need to ignore the mask
17609
- // events fired by our own value-restore step.
17734
+ // Re-entrancy guard. The patched-setter's synthetic input event (suppressed
17735
+ // by _configuringMask above) could otherwise trigger handleInput
17736
+ // processCreditCard configureAutoFormatting before the outer call's
17737
+ // set value has finished its alignCursor pass.
17610
17738
  if (this._configuringMask) return;
17611
17739
  this._configuringMask = true;
17612
17740
  try {
17613
- // Destroy any prior mask so IMask can attach fresh under the new format.
17614
- // Null the reference too — if the new maskOptions.mask is falsy (e.g.
17615
- // type switched from credit-card to text) the IMask() reassignment
17616
- // below is skipped, and downstream writes at line ~823 would otherwise
17617
- // route through the destroyed instance.
17618
17741
  if (this.maskInstance) {
17619
17742
  this.maskInstance.destroy();
17620
- this.maskInstance = null;
17621
17743
  }
17622
17744
 
17745
+ // Pass new format to util
17623
17746
  this.util.updateFormat(this.format);
17624
17747
 
17625
17748
  const maskOptions = this.util.getMaskOptions(this.type, this.format);
17626
17749
 
17627
17750
  if (this.inputElement && maskOptions.mask) {
17628
- // Capture the current display so it can be re-applied after IMask
17629
- // attaches. The restore at the bottom goes through maskInstance.value
17630
- // (not inputElement.value directly) so the mask's internal state and
17631
- // the input's displayed text stay in lock-step.
17632
- let existingValue = this.inputElement.value;
17633
17751
 
17634
- // Format-change case (e.g. locale switch): existingValue is the OLD
17635
- // mask's display string and may not parse under the new mask. When
17636
- // we have a valid date model, rebuild the display from valueObject
17637
- // (the canonical source) using the new mask's format function.
17752
+ // Stash and clear any existing value before IMask init.
17753
+ // IMask's constructor processes the current input value which requires
17754
+ // selection state clearing first avoids that scenario entirely.
17755
+ // When the format changes (e.g. locale switch) and we have a valid ISO
17756
+ // model value, compute the display string for the NEW format instead of
17757
+ // re-using the old display string, which may be invalid in the new mask.
17758
+ let existingValue = this.inputElement.value;
17638
17759
  if (
17639
17760
  this.util.isFullDateFormat(this.type, this.format) &&
17640
17761
  this.value &&
17641
- this.valueObject &&
17762
+ dateFormatter.isValidDate(this.value) &&
17763
+ this.valueObject instanceof Date &&
17764
+ !Number.isNaN(this.valueObject.getTime()) &&
17642
17765
  typeof maskOptions.format === 'function'
17643
17766
  ) {
17644
17767
  existingValue = maskOptions.format(this.valueObject);
17645
17768
  }
17646
17769
 
17647
- // Clear before IMask attaches so the constructor seeds an empty
17648
- // internal value. Otherwise IMask reads the stale unmasked string
17649
- // and emits a spurious 'accept' before the restore below runs.
17650
17770
  this.skipNextProgrammaticInputEvent = true;
17651
17771
  this.inputElement.value = '';
17652
17772
 
17653
17773
  this.maskInstance = IMask(this.inputElement, maskOptions);
17654
17774
 
17655
- // Mask fires 'accept' on every value change, including the restore
17656
- // step below. Skip events fired during configureAutoFormatting so
17657
- // we don't overwrite a value the parent just pushed.
17658
17775
  this.maskInstance.on('accept', () => {
17776
+ // Suppress propagation during configureAutoFormatting's own value-restoration
17777
+ // (line below) — the mask emits 'accept' on every value-set, including ours,
17778
+ // and we don't want to overwrite a value the parent just pushed.
17659
17779
  if (this._configuringMask) return;
17660
17780
  this.value = this.util.toModelValue(this.maskInstance.value, this.format);
17661
17781
  if (this.type === "date") {
@@ -17663,8 +17783,6 @@ class BaseInput extends AuroElement$1 {
17663
17783
  }
17664
17784
  });
17665
17785
 
17666
- // Mask fires 'complete' on the restore step below for any value that
17667
- // happens to be a complete match. Same setup-suppression as 'accept'.
17668
17786
  this.maskInstance.on('complete', () => {
17669
17787
  if (this._configuringMask) return;
17670
17788
  this.value = this.util.toModelValue(this.maskInstance.value, this.format);
@@ -17673,9 +17791,7 @@ class BaseInput extends AuroElement$1 {
17673
17791
  }
17674
17792
  });
17675
17793
 
17676
- // Write existingValue through the mask (not the input directly) so
17677
- // the mask reformats it under the new rules and keeps its internal
17678
- // _value aligned with the input's displayed text.
17794
+ // Restore the stashed value through IMask so it's properly masked
17679
17795
  if (existingValue) {
17680
17796
  this.maskInstance.value = existingValue;
17681
17797
  }
@@ -17843,6 +17959,7 @@ class BaseInput extends AuroElement$1 {
17843
17959
  */
17844
17960
  reset() {
17845
17961
  this.value = undefined;
17962
+ this.setDateObjectProperty('valueObject', undefined);
17846
17963
  this.validation.reset(this);
17847
17964
  }
17848
17965
 
@@ -17851,6 +17968,7 @@ class BaseInput extends AuroElement$1 {
17851
17968
  */
17852
17969
  clear() {
17853
17970
  this.value = undefined;
17971
+ this.setDateObjectProperty('valueObject', undefined);
17854
17972
  }
17855
17973
 
17856
17974
  /**
@@ -17888,6 +18006,12 @@ class BaseInput extends AuroElement$1 {
17888
18006
  */
17889
18007
  get placeholderStr() {
17890
18008
  if (!this.placeholder && this.type === 'date') {
18009
+ // COVERAGE: the `'MM/DD/YYYY'` literal fallback is unreachable in WTR.
18010
+ // connectedCallback (L682) calls configureDataForType, which at L1266-1268
18011
+ // assigns `this.format = this.util.getDateMaskFromLocale().toLowerCase()`
18012
+ // when type=date and format is unset. That runs before the first render
18013
+ // reads this getter, so the ternary's truthy arm always wins. Retained
18014
+ // as a defensive fallback for direct getter calls before connection.
17891
18015
  return this.format ? this.format.toUpperCase() : 'MM/DD/YYYY';
17892
18016
  }
17893
18017
  return this.placeholder || "";
@@ -18379,7 +18503,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$3 {
18379
18503
  }
18380
18504
  };
18381
18505
 
18382
- var formkitVersion$1 = '202606231948';
18506
+ var formkitVersion$1 = '202606232113';
18383
18507
 
18384
18508
  // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
18385
18509
  // See LICENSE in the project root for license information.
@@ -19500,7 +19624,7 @@ class AuroBibtemplate extends i$3 {
19500
19624
  }
19501
19625
  }
19502
19626
 
19503
- var formkitVersion = '202606231948';
19627
+ var formkitVersion = '202606232113';
19504
19628
 
19505
19629
  var styleCss$3 = i$6`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;text-align:left}:host [auro-dropdown]{--ds-auro-dropdown-trigger-background-color: transparent}:host #inputInBib::part(wrapper){box-shadow:none}:host #inputInBib::part(accent-left){display:none}:host([layout*=classic]) [auro-input]{width:100%}:host([layout*=classic]) [auro-input]::part(helpText){display:none}:host([layout*=classic]) #slotHolder{display:none}`;
19506
19630
 
@@ -20487,7 +20611,7 @@ class AuroCombobox extends AuroElement {
20487
20611
  if (this.menu) {
20488
20612
  this.menu.matchWord = normalizeFilterValue(this.input.value);
20489
20613
  }
20490
- const label = getOptionLabel(this.menu.optionSelected);
20614
+ const label = getOptionLabel(this.menu.optionSelected) || this.menu.currentLabel;
20491
20615
  this.updateTriggerTextDisplay(label || this.value);
20492
20616
  }
20493
20617
 
@@ -20501,9 +20625,40 @@ class AuroCombobox extends AuroElement {
20501
20625
  // in suggestion mode, do not override input value if no selection has been made and the input currently has focus
20502
20626
  const isInputFocusedWithNoSelection = !this.menu.value && (this.input.matches(':focus-within') || (this.inputInBib && this.inputInBib.matches(':focus-within')));
20503
20627
 
20504
- const suppressed = this.persistInput || (this.behavior === 'suggestion' && isInputFocusedWithNoSelection);
20505
- if (!suppressed) {
20506
- this.syncInputValuesAcrossTriggerAndBib(label || this.value);
20628
+ if (!this.persistInput && !(this.behavior === 'suggestion' && isInputFocusedWithNoSelection)) {
20629
+ const nextValue = label || this.value;
20630
+ // Only set the flag when there's an actual write to suppress —
20631
+ // syncValuesAndStates re-enters here during typing when both inputs
20632
+ // already match, and a no-op flag flip would make the bib branch's
20633
+ // bail eat legitimate user-input events.
20634
+ const triggerNeedsSync = this.input.value !== nextValue;
20635
+ const bibNeedsSync = Boolean(this.inputInBib && this.inputInBib !== this.input && this.inputInBib.value !== nextValue);
20636
+ if (triggerNeedsSync || bibNeedsSync) {
20637
+ this._syncingDisplayValue = true;
20638
+ if (triggerNeedsSync) {
20639
+ this.input.value = nextValue;
20640
+ }
20641
+ if (bibNeedsSync) {
20642
+ this.inputInBib.value = nextValue;
20643
+ }
20644
+ const pending = [];
20645
+ if (triggerNeedsSync) {
20646
+ pending.push(this.input.updateComplete);
20647
+ }
20648
+ if (bibNeedsSync) {
20649
+ pending.push(this.inputInBib.updateComplete);
20650
+ }
20651
+ Promise.all(pending).then(() => {
20652
+ // imask reasserts otherwise, and handleBlur reverts to its stale value.
20653
+ if (triggerNeedsSync && this.input.maskInstance && typeof this.input.maskInstance.updateValue === 'function') {
20654
+ this.input.maskInstance.updateValue();
20655
+ }
20656
+ if (bibNeedsSync && this.inputInBib && this.inputInBib.maskInstance && typeof this.inputInBib.maskInstance.updateValue === 'function') {
20657
+ this.inputInBib.maskInstance.updateValue();
20658
+ }
20659
+ this._syncingDisplayValue = false;
20660
+ });
20661
+ }
20507
20662
  }
20508
20663
 
20509
20664
  // update the displayValue in the trigger if displayValue slot content is present
@@ -20531,48 +20686,6 @@ class AuroCombobox extends AuroElement {
20531
20686
  this.requestUpdate();
20532
20687
  }
20533
20688
 
20534
- /**
20535
- * Writes nextValue to the trigger input and the bib input when their current
20536
- * value differs, then re-asserts imask after Lit's update flushes.
20537
- * @param {string} nextValue - The value to write to both inputs.
20538
- * @returns {Promise<void> | null} Promise that resolves after the inputs flush,
20539
- * or null when no sync was needed (so callers can skip post-flush work).
20540
- * @private
20541
- */
20542
- syncInputValuesAcrossTriggerAndBib(nextValue) {
20543
- // Only set the flag when there's an actual write to suppress —
20544
- // syncValuesAndStates re-enters here during typing when both inputs
20545
- // already match, and a no-op flag flip would make the bib branch's
20546
- // bail eat legitimate user-input events.
20547
- const triggerNeedsSync = this.input.value !== nextValue;
20548
- const bibNeedsSync = this.inputInBib.value !== nextValue;
20549
- if (!triggerNeedsSync && !bibNeedsSync) {
20550
- return null;
20551
- }
20552
-
20553
- this._syncingDisplayValue = true;
20554
-
20555
- const pending = [];
20556
- if (triggerNeedsSync) {
20557
- this.input.value = nextValue;
20558
- pending.push(this.input.updateComplete);
20559
- }
20560
- if (bibNeedsSync) {
20561
- this.inputInBib.value = nextValue;
20562
- pending.push(this.inputInBib.updateComplete);
20563
- }
20564
- return Promise.all(pending).then(() => {
20565
- // imask reasserts otherwise, and handleBlur reverts to its stale value.
20566
- if (triggerNeedsSync && this.input.maskInstance && typeof this.input.maskInstance.updateValue === 'function') {
20567
- this.input.maskInstance.updateValue();
20568
- }
20569
- if (bibNeedsSync && this.inputInBib && this.inputInBib.maskInstance && typeof this.inputInBib.maskInstance.updateValue === 'function') {
20570
- this.inputInBib.maskInstance.updateValue();
20571
- }
20572
- this._syncingDisplayValue = false;
20573
- });
20574
- }
20575
-
20576
20689
  /**
20577
20690
  * Processes hidden state of all menu options and determines if there are any available options not hidden.
20578
20691
  * @private
@@ -20600,9 +20713,9 @@ class AuroCombobox extends AuroElement {
20600
20713
  this.syncValuesAndStates();
20601
20714
  }
20602
20715
 
20603
- // Re-activate when optionActive is not in the current scrollable viewport,
20604
- // or when _index has been reset (e.g. by clearSelection in an async update)
20605
- // so that makeSelection() can find the correct option.
20716
+ // Re-activate when optionActive is no longer visible, or when _index has
20717
+ // been reset (e.g. by clearSelection in an async update) so that
20718
+ // makeSelection() can find the correct option.
20606
20719
  if (!this.availableOptions.includes(this.menu.optionActive) || this.menu._index < 0) {
20607
20720
  this.activateFirstEnabledAvailableOption();
20608
20721
  }
@@ -20736,25 +20849,28 @@ class AuroCombobox extends AuroElement {
20736
20849
 
20737
20850
  guardTouchPassthrough(this.menu);
20738
20851
 
20739
- // showModal() takes focus away from the trigger. Early focus once
20740
- // the dialog has painted; the shared doubleRaf below is the fallback
20741
- // for when the dialog needs an extra frame and also clears the
20742
- // validation guard.
20852
+ // The dialog's showModal() steals focus from the trigger.
20853
+ // A single rAF is enough for the dialog DOM to be painted and
20854
+ // focusable, then doubleRaf finalizes the transition.
20743
20855
  requestAnimationFrame(() => {
20744
20856
  this.setInputFocus();
20745
20857
  });
20746
- }
20747
- // else (desktop popover-open): Chrome resets the trigger caret to
20748
- // [0, 0] when its floating <label for="…"> overlay receives focus.
20749
- // The shared doubleRaf below parks the caret back at end-of-text
20750
- // after the dropdown layout settles.
20751
-
20752
- doubleRaf(() => {
20753
- this.setInputFocus();
20754
- if (this._inFullscreenTransition) {
20858
+
20859
+ doubleRaf(() => {
20860
+ this.setInputFocus();
20755
20861
  this._inFullscreenTransition = false;
20756
- }
20757
- });
20862
+ });
20863
+ } else {
20864
+ // Desktop popover-open: restore the trigger caret to end-of-text.
20865
+ // Clicking the trigger lands on auro-input's floating <label for="…">
20866
+ // overlay; Chrome resets the native input's selection to [0, 0] on
20867
+ // label-focus before any JS runs. setInputFocus()'s non-fullscreen
20868
+ // branch parks the caret at end. doubleRaf lets the dropdown layout
20869
+ // settle first, matching the fullscreen branch timing.
20870
+ doubleRaf(() => {
20871
+ this.setInputFocus();
20872
+ });
20873
+ }
20758
20874
  }
20759
20875
  });
20760
20876
 
@@ -20965,7 +21081,7 @@ class AuroCombobox extends AuroElement {
20965
21081
  if (this.menu.optionSelected) {
20966
21082
  const selected = this.menu.optionSelected;
20967
21083
 
20968
- if (this.optionSelected !== selected) {
21084
+ if (!this.optionSelected || this.optionSelected !== selected) {
20969
21085
  this.optionSelected = selected;
20970
21086
  }
20971
21087
 
@@ -20978,7 +21094,7 @@ class AuroCombobox extends AuroElement {
20978
21094
  }
20979
21095
 
20980
21096
  // Update display
20981
- this.updateTriggerTextDisplay(getOptionLabel(this.optionSelected));
21097
+ this.updateTriggerTextDisplay(getOptionLabel(this.optionSelected) || this.menu.value);
20982
21098
 
20983
21099
  // Update match word for filtering
20984
21100
  const trimmedInput = normalizeFilterValue(this.input.value);
@@ -20994,22 +21110,13 @@ class AuroCombobox extends AuroElement {
20994
21110
  this.hideBib();
20995
21111
  }
20996
21112
 
20997
- // Move focus to the clear button when the user makes a selection.
20998
- if (!isEcho && this.menu.value !== undefined) {
20999
- this.setClearBtnFocus();
21000
- }
21001
-
21002
21113
  // Announce the selection after the dropdown closes so it isn't
21003
21114
  // overridden by VoiceOver's "collapsed" announcement from aria-expanded.
21004
- // Skip when there's no selected value (e.g. menu.clearSelection() from
21005
- // the unmatched-value path), otherwise VoiceOver reads "undefined".
21006
21115
  const selectedValue = this.menu.value;
21007
- if (selectedValue) {
21008
- const announcementDelay = 300;
21009
- setTimeout(() => {
21010
- announceToScreenReader(this._getAnnouncementRoot(), `${selectedValue}, selected`);
21011
- }, announcementDelay);
21012
- }
21116
+ const announcementDelay = 300;
21117
+ setTimeout(() => {
21118
+ announceToScreenReader(this._getAnnouncementRoot(), `${selectedValue}, selected`);
21119
+ }, announcementDelay);
21013
21120
  }
21014
21121
 
21015
21122
  // Programmatic value syncs leave availableOptions stale because
@@ -21023,6 +21130,18 @@ class AuroCombobox extends AuroElement {
21023
21130
  this._programmaticFilterRefresh = false;
21024
21131
  }, 0);
21025
21132
  }
21133
+
21134
+ // base-input skips auto-validate when focus is inside its own shadow,
21135
+ // which it is after setTriggerInputFocus — re-run so prior tooShort
21136
+ // clears. processCreditCard reasserts errorMessage on every render.
21137
+ if (!isEcho && this.menu.optionSelected && this.input.validate) {
21138
+ this.input.updateComplete.then(() => {
21139
+ this.input.validate(true);
21140
+ if (this.input.validity === 'valid') {
21141
+ this.input.errorMessage = '';
21142
+ }
21143
+ });
21144
+ }
21026
21145
  });
21027
21146
 
21028
21147
  this.menu.addEventListener('auroMenu-customEventFired', () => {
@@ -21357,7 +21476,15 @@ class AuroCombobox extends AuroElement {
21357
21476
  this.menu.value = undefined;
21358
21477
  this.validation.reset(this);
21359
21478
  this.touched = false;
21479
+ // Force validity back to the cleared state. validation.reset() calls
21480
+ // validate() at the end, and (post-credit-card-fix) the trigger input's
21481
+ // residual validity may still be copied into the combobox by the
21482
+ // auroInputElements loop. Explicitly clear here so reset() actually
21483
+ // leaves the component in a "no validity" state.
21360
21484
  this.validity = undefined;
21485
+ this.errorMessage = '';
21486
+ this.input.validity = undefined;
21487
+ this.input.errorMessage = '';
21361
21488
  }
21362
21489
 
21363
21490
  /**
@@ -21410,27 +21537,52 @@ class AuroCombobox extends AuroElement {
21410
21537
  this.input.value = this.value;
21411
21538
  }
21412
21539
 
21413
- // Sync menu.value only when an option actually matches, or when filter
21414
- // mode needs setMenuValue to dispatch auroMenu-selectValueFailure (the
21415
- // listener at line 1206 clears combobox.value, mirroring select's
21416
- // pattern). Otherwise sync the input display for freeform values.
21540
+ // Sync menu.value only when an option actually matches; otherwise clear it.
21417
21541
  if (this.menu.options && this.menu.options.length > 0) {
21418
- if (this.menu.options.some((opt) => opt.value === this.value) || this.behavior === 'filter') {
21542
+ if (this.menu.options.some((opt) => opt.value === this.value)) {
21543
+ this.setMenuValue(this.value);
21544
+ } else if (this.behavior === 'filter') {
21545
+ // In filter mode, freeform values aren't allowed. Push the unmatched
21546
+ // value through setMenuValue so menu dispatches auroMenu-selectValueFailure
21547
+ // and the listener at line 1206 clears combobox.value (mirrors select's
21548
+ // pattern). Bypassing setMenuValue here would skip the failure cascade.
21419
21549
  this.setMenuValue(this.value);
21420
21550
  } else {
21421
- // Clear menu.value AND menu.optionSelected together. Clearing only
21422
- // menu.value leaves the previously-selected option element pinned
21423
- // as menu.optionSelected; a later auroMenu-selectedOption event
21424
- // would then write its stale .value back into combobox.value.
21425
- if (this.menu.value || this.menu.optionSelected) {
21426
- this.menu.clearSelection();
21551
+ if (this.menu.value) {
21552
+ this.menu.value = undefined;
21427
21553
  }
21428
- // Suggestion-mode freeform value: sync the trigger + bib to show it,
21429
- // then refresh the filter once the inputs flush (handleInputValueChange
21430
- // bailed on _syncingDisplayValue).
21431
- const syncPromise = this.syncInputValuesAcrossTriggerAndBib(this.value || '');
21432
- if (syncPromise) {
21433
- syncPromise.then(() => {
21554
+ // Sync the display for programmatic freeform value changes (e.g. the
21555
+ // swap-values pattern). Guard with _syncingDisplayValue so that the
21556
+ // re-entrant input event from base-input.notifyValueChanged() is
21557
+ // ignored by handleInputValueChange. Skip the sync when input already
21558
+ // matches to avoid spurious events during the normal typing path.
21559
+ const nextValue = this.value || '';
21560
+ const triggerNeedsSync = this.input.value !== nextValue;
21561
+ const bibNeedsSync = Boolean(this.inputInBib && this.inputInBib !== this.input && this.inputInBib.value !== nextValue);
21562
+ if (triggerNeedsSync || bibNeedsSync) {
21563
+ this._syncingDisplayValue = true;
21564
+ if (triggerNeedsSync) {
21565
+ this.input.value = nextValue;
21566
+ }
21567
+ if (bibNeedsSync) {
21568
+ this.inputInBib.value = nextValue;
21569
+ }
21570
+ const pending = [];
21571
+ if (triggerNeedsSync) {
21572
+ pending.push(this.input.updateComplete);
21573
+ }
21574
+ if (bibNeedsSync) {
21575
+ pending.push(this.inputInBib.updateComplete);
21576
+ }
21577
+ Promise.all(pending).then(() => {
21578
+ if (triggerNeedsSync && this.input.maskInstance && typeof this.input.maskInstance.updateValue === 'function') {
21579
+ this.input.maskInstance.updateValue();
21580
+ }
21581
+ if (bibNeedsSync && this.inputInBib && this.inputInBib.maskInstance && typeof this.inputInBib.maskInstance.updateValue === 'function') {
21582
+ this.inputInBib.maskInstance.updateValue();
21583
+ }
21584
+ this._syncingDisplayValue = false;
21585
+ // handleInputValueChange bailed on the flag — refresh the filter.
21434
21586
  this._programmaticFilterRefresh = true;
21435
21587
  this.handleMenuOptions();
21436
21588
  setTimeout(() => {