@aurodesignsystem-dev/auro-formkit 0.0.0-pr1505.0 → 0.0.0-pr1506.1

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 (56) 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 +138 -266
  7. package/components/combobox/demo/getting-started.min.js +138 -266
  8. package/components/combobox/demo/index.min.js +138 -266
  9. package/components/combobox/dist/auro-combobox.d.ts +9 -0
  10. package/components/combobox/dist/index.js +138 -266
  11. package/components/combobox/dist/registered.js +138 -266
  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/api.md +0 -2
  17. package/components/datepicker/demo/customize.md +33 -195
  18. package/components/datepicker/demo/customize.min.js +41 -164
  19. package/components/datepicker/demo/index.min.js +40 -156
  20. package/components/datepicker/dist/index.js +40 -156
  21. package/components/datepicker/dist/registered.js +40 -156
  22. package/components/datepicker/dist/src/auro-datepicker.d.ts +0 -2
  23. package/components/dropdown/demo/customize.min.js +1 -1
  24. package/components/dropdown/demo/getting-started.min.js +1 -1
  25. package/components/dropdown/demo/index.min.js +1 -1
  26. package/components/dropdown/dist/index.js +1 -1
  27. package/components/dropdown/dist/registered.js +1 -1
  28. package/components/form/demo/customize.min.js +351 -599
  29. package/components/form/demo/getting-started.min.js +351 -599
  30. package/components/form/demo/index.min.js +351 -599
  31. package/components/form/demo/registerDemoDeps.min.js +351 -599
  32. package/components/input/demo/customize.md +55 -56
  33. package/components/input/demo/customize.min.js +36 -147
  34. package/components/input/demo/getting-started.min.js +36 -147
  35. package/components/input/demo/index.md +2 -2
  36. package/components/input/demo/index.min.js +36 -147
  37. package/components/input/dist/base-input.d.ts +0 -48
  38. package/components/input/dist/index.js +36 -147
  39. package/components/input/dist/registered.js +36 -147
  40. package/components/radio/demo/customize.min.js +1 -1
  41. package/components/radio/demo/getting-started.min.js +1 -1
  42. package/components/radio/demo/index.min.js +1 -1
  43. package/components/radio/dist/index.js +1 -1
  44. package/components/radio/dist/registered.js +1 -1
  45. package/components/select/demo/api.md +1 -0
  46. package/components/select/demo/customize.md +71 -0
  47. package/components/select/demo/customize.min.js +133 -26
  48. package/components/select/demo/getting-started.min.js +133 -26
  49. package/components/select/demo/index.min.js +133 -26
  50. package/components/select/demo/keyboard-behavior.md +18 -0
  51. package/components/select/dist/auro-select.d.ts +38 -2
  52. package/components/select/dist/index.js +133 -26
  53. package/components/select/dist/registered.js +133 -26
  54. package/components/select/dist/selectUtils.d.ts +12 -0
  55. package/custom-elements.json +114 -274
  56. package/package.json +1 -1
@@ -767,6 +767,8 @@ function navigateArrow(component, direction, options = {}) {
767
767
  }
768
768
  }
769
769
 
770
+ /* eslint-disable no-underscore-dangle */
771
+
770
772
  /**
771
773
  * Returns the clear button element from the active input's shadow
772
774
  * DOM, if available.
@@ -802,11 +804,9 @@ function isClearBtnFocused(ctx, clearBtn = getClearBtn(ctx)) {
802
804
  * @param {Object} menu - The menu component.
803
805
  */
804
806
  function reconcileMenuIndex(menu) {
805
- // eslint-disable-next-line no-underscore-dangle
806
807
  if (menu._index < 0 && menu.optionActive && menu.items) {
807
808
  const idx = menu.items.indexOf(menu.optionActive);
808
809
  if (idx >= 0) {
809
- // eslint-disable-next-line no-underscore-dangle
810
810
  menu._index = idx;
811
811
  }
812
812
  }
@@ -4806,7 +4806,7 @@ let AuroHelpText$2 = class AuroHelpText extends LitElement {
4806
4806
  }
4807
4807
  };
4808
4808
 
4809
- var formkitVersion$2 = '202606171946';
4809
+ var formkitVersion$2 = '202606192004';
4810
4810
 
4811
4811
  let AuroElement$2 = class AuroElement extends LitElement {
4812
4812
  static get properties() {
@@ -16520,6 +16520,7 @@ class AuroInputUtilities {
16520
16520
  const maskOptions = this.getMaskOptions('date', normalizedFormat);
16521
16521
 
16522
16522
  if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
16523
+ console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
16523
16524
  return undefined;
16524
16525
  }
16525
16526
 
@@ -16671,10 +16672,8 @@ class BaseInput extends AuroElement$1 {
16671
16672
  this.layout = 'classic';
16672
16673
  this.locale = 'en-US';
16673
16674
  this.max = undefined;
16674
- this._maxObject = undefined;
16675
16675
  this.maxLength = undefined;
16676
16676
  this.min = undefined;
16677
- this._minObject = undefined;
16678
16677
  this.minLength = undefined;
16679
16678
  this.required = false;
16680
16679
  this.onDark = false;
@@ -16682,7 +16681,6 @@ class BaseInput extends AuroElement$1 {
16682
16681
  this.size = 'lg';
16683
16682
  this.shape = 'classic';
16684
16683
  this.value = undefined;
16685
- this._valueObject = undefined;
16686
16684
 
16687
16685
  this._initializePrivateDefaults();
16688
16686
  }
@@ -17222,7 +17220,7 @@ class BaseInput extends AuroElement$1 {
17222
17220
  * @returns {Date|undefined}
17223
17221
  */
17224
17222
  get valueObject() {
17225
- return this._valueObject || this._computeDateObjectFallback(this.value);
17223
+ return this.value && dateFormatter.isValidDate(this.value) ? dateFormatter.stringToDateInstance(this.value) : undefined;
17226
17224
  }
17227
17225
 
17228
17226
  /**
@@ -17230,7 +17228,7 @@ class BaseInput extends AuroElement$1 {
17230
17228
  * @returns {Date|undefined}
17231
17229
  */
17232
17230
  get minObject() {
17233
- return this._minObject || this._computeDateObjectFallback(this.min);
17231
+ return this.min && dateFormatter.isValidDate(this.min) ? dateFormatter.stringToDateInstance(this.min) : undefined;
17234
17232
  }
17235
17233
 
17236
17234
  /**
@@ -17238,50 +17236,7 @@ class BaseInput extends AuroElement$1 {
17238
17236
  * @returns {Date|undefined}
17239
17237
  */
17240
17238
  get maxObject() {
17241
- return this._maxObject || this._computeDateObjectFallback(this.max);
17242
- }
17243
-
17244
- /**
17245
- * Parses a date string into a Date object when the corresponding `_*Object`
17246
- * field hasn't been synced yet by `updated()`. Returns undefined when the
17247
- * input type/format isn't a full date or the string is not a valid date.
17248
- *
17249
- * Why this exists: a parent (datepicker) can call `inputN.validate()` from
17250
- * inside its own `updated()` before this input's `updated()` has run
17251
- * `syncDateValues()` — so `_valueObject`/`_maxObject` are still `undefined`
17252
- * and range checks would otherwise silently no-op (flipping the result to
17253
- * `valid` or `patternMismatch`).
17254
- * @private
17255
- * @param {string|undefined} dateStr - ISO date string from `value`/`min`/`max`.
17256
- * @returns {Date|undefined}
17257
- */
17258
- _computeDateObjectFallback(dateStr) {
17259
- if (!dateStr || !this.util || !this.util.isFullDateFormat(this.type, this.format)) {
17260
- return undefined;
17261
- }
17262
- if (!dateFormatter.isValidDate(dateStr)) {
17263
- return undefined;
17264
- }
17265
- return dateFormatter.stringToDateInstance(dateStr);
17266
- }
17267
-
17268
- /**
17269
- * Internal setter for readonly date object properties.
17270
- * @private
17271
- * @param {'valueObject'|'minObject'|'maxObject'} propertyName - Public object property name.
17272
- * @param {Date|undefined} propertyValue - Value to assign.
17273
- * @returns {void}
17274
- */
17275
- setDateObjectProperty(propertyName, propertyValue) {
17276
- const internalPropertyName = `_${propertyName}`;
17277
- const previousValue = this[internalPropertyName];
17278
-
17279
- if (previousValue === propertyValue) {
17280
- return;
17281
- }
17282
-
17283
- this[internalPropertyName] = propertyValue;
17284
- this.requestUpdate(propertyName, previousValue);
17239
+ return this.max && dateFormatter.isValidDate(this.max) ? dateFormatter.stringToDateInstance(this.max) : undefined;
17285
17240
  }
17286
17241
 
17287
17242
  connectedCallback() {
@@ -17310,7 +17265,6 @@ class BaseInput extends AuroElement$1 {
17310
17265
  format: this.format
17311
17266
  });
17312
17267
  this.configureDataForType();
17313
- this.syncDateValues();
17314
17268
  }
17315
17269
 
17316
17270
  disconnectedCallback() {
@@ -17330,10 +17284,6 @@ class BaseInput extends AuroElement$1 {
17330
17284
  this.wrapperElement.addEventListener('click', this.handleClick);
17331
17285
  }
17332
17286
 
17333
- // add attribute for query selectors when auro-input is registered under a custom name
17334
- if (this.tagName.toLowerCase() !== 'auro-input' && !this.hasAttribute('auro-input')) {
17335
- this.setAttribute('auro-input', '');
17336
- }
17337
17287
  this.inputId = this.id ? `${this.id}-input` : window.crypto.randomUUID();
17338
17288
 
17339
17289
  // use validity message override if declared when initializing the component
@@ -17344,7 +17294,6 @@ class BaseInput extends AuroElement$1 {
17344
17294
  this.setCustomHelpTextMessage();
17345
17295
  this.configureAutoFormatting();
17346
17296
  this.configureDataForType();
17347
- this.syncDateValues();
17348
17297
  }
17349
17298
 
17350
17299
  /**
@@ -17481,8 +17430,6 @@ class BaseInput extends AuroElement$1 {
17481
17430
  this.configureDataForType();
17482
17431
  }
17483
17432
 
17484
- this.syncDateValues(changedProperties);
17485
-
17486
17433
  if (changedProperties.has('value')) {
17487
17434
  if (this.value && this.value.length > 0) {
17488
17435
  this.hasValue = true;
@@ -17504,14 +17451,14 @@ class BaseInput extends AuroElement$1 {
17504
17451
 
17505
17452
  if (formattedValue !== this.inputElement.value) {
17506
17453
  this.skipNextProgrammaticInputEvent = true;
17507
- if (this.maskInstance && this.type === 'credit-card') {
17454
+ if (this.maskInstance && this.type !== 'date') {
17508
17455
  // Route through the mask so its _value and el.value stay in lock-step
17509
17456
  // (set value calls updateControl which writes el.value = displayValue).
17510
17457
  // Writing el.value directly leaves the mask thinking displayValue is
17511
- // stale; _saveSelection on the next focus/click then warns. Scoped to
17512
- // credit-card so date's own formattedValue (raw ISO when calendar-invalid)
17513
- // isn't re-masked through the mm/dd/yyyy mask, which would truncate it
17514
- // and flip validity from patternMismatch to tooShort.
17458
+ // stale; _saveSelection on the next focus/click then warns. Date is
17459
+ // excluded because its formattedValue can be raw ISO when the calendar
17460
+ // is invalid, and re-masking through mm/dd/yyyy would truncate it and
17461
+ // flip validity from patternMismatch to tooShort.
17515
17462
  this.maskInstance.value = formattedValue || '';
17516
17463
  } else if (formattedValue) {
17517
17464
  this.inputElement.value = formattedValue;
@@ -17553,120 +17500,60 @@ class BaseInput extends AuroElement$1 {
17553
17500
  }));
17554
17501
  }
17555
17502
 
17556
-
17557
- /**
17558
- * Synchronizes the ISO string values and Date object representations for date-related properties.
17559
- * This keeps the model and display values aligned when either side changes.
17560
- *
17561
- * When a full date format is in use, this method updates `value`, `min`, and `max` from their corresponding
17562
- * Date objects or vice versa, based on which properties have changed. It only runs when the current configuration
17563
- * represents a full year/month/day date format.
17564
- *
17565
- * @param {Map<string, unknown>|undefined} [changedProperties=undefined] - Optional map of changed properties used to limit which values are synchronized.
17566
- * @returns {void}
17567
- * @private
17568
- */
17569
- syncDateValues(changedProperties = undefined) {
17570
- if (!this.util.isFullDateFormat(this.type, this.format)) {
17571
- return;
17572
- }
17573
-
17574
- this.syncSingleDateValue(changedProperties, 'valueObject', 'value');
17575
- this.syncSingleDateValue(changedProperties, 'minObject', 'min');
17576
- this.syncSingleDateValue(changedProperties, 'maxObject', 'max');
17577
- }
17578
-
17579
- /**
17580
- * Synchronizes one date object/string property pair.
17581
- * @private
17582
- * @param {Map<string, unknown>|undefined} changedProperties - Map of changed properties from Lit.
17583
- * @param {string} objectProperty - Date object property name.
17584
- * @param {string} valueProperty - ISO string property name.
17585
- * @returns {void}
17586
- */
17587
- syncSingleDateValue(changedProperties, objectProperty, valueProperty) {
17588
- const objectPropertyChanged = !changedProperties || changedProperties.has(objectProperty);
17589
-
17590
- // objectProperty wins over valueProperty when both changed
17591
- if (objectPropertyChanged && this[objectProperty]) {
17592
- this[valueProperty] = dateFormatter.toISOFormatString(this[objectProperty]);
17593
- return;
17594
- }
17595
-
17596
- const valuePropertyChanged = !changedProperties || changedProperties.has(valueProperty);
17597
- if (!valuePropertyChanged) {
17598
- return;
17599
- }
17600
-
17601
- // 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)
17602
- if (
17603
- changedProperties &&
17604
- valueProperty === 'value' &&
17605
- changedProperties.get('value') === undefined &&
17606
- this[objectProperty] instanceof Date &&
17607
- this[valueProperty] === dateFormatter.toISOFormatString(this[objectProperty])
17608
- ) {
17609
- return;
17610
- }
17611
-
17612
- if (dateFormatter.isValidDate(this[valueProperty])) {
17613
- this.setDateObjectProperty(objectProperty, dateFormatter.stringToDateInstance(this[valueProperty]));
17614
- } else {
17615
- this.setDateObjectProperty(objectProperty, undefined);
17616
- }
17617
- }
17618
-
17619
17503
  /**
17620
17504
  * Sets up IMasks and logic based on auto-formatting requirements.
17621
17505
  * @private
17622
17506
  * @returns {void}
17623
17507
  */
17624
17508
  configureAutoFormatting() {
17625
- // Re-entrancy guard. The patched-setter's synthetic input event (suppressed
17626
- // by _configuringMask above) could otherwise trigger handleInput
17627
- // processCreditCard configureAutoFormatting before the outer call's
17628
- // set value has finished its alignCursor pass.
17509
+ // _configuringMask gates two things: external re-entry into this method
17510
+ // while setup is mid-flight (from property changes that call back here),
17511
+ // and the accept/complete listeners below — both need to ignore the mask
17512
+ // events fired by our own value-restore step.
17629
17513
  if (this._configuringMask) return;
17630
17514
  this._configuringMask = true;
17631
17515
  try {
17516
+ // Destroy any prior mask so IMask can attach fresh under the new format.
17632
17517
  if (this.maskInstance) {
17633
17518
  this.maskInstance.destroy();
17634
17519
  }
17635
17520
 
17636
- // Pass new format to util
17637
17521
  this.util.updateFormat(this.format);
17638
17522
 
17639
17523
  const maskOptions = this.util.getMaskOptions(this.type, this.format);
17640
17524
 
17641
17525
  if (this.inputElement && maskOptions.mask) {
17642
-
17643
- // Stash and clear any existing value before IMask init.
17644
- // IMask's constructor processes the current input value which requires
17645
- // selection state clearing first avoids that scenario entirely.
17646
- // When the format changes (e.g. locale switch) and we have a valid ISO
17647
- // model value, compute the display string for the NEW format instead of
17648
- // re-using the old display string, which may be invalid in the new mask.
17526
+ // Capture the current display so it can be re-applied after IMask
17527
+ // attaches. The restore at the bottom goes through maskInstance.value
17528
+ // (not inputElement.value directly) so the mask's internal state and
17529
+ // the input's displayed text stay in lock-step.
17649
17530
  let existingValue = this.inputElement.value;
17531
+
17532
+ // Format-change case (e.g. locale switch): existingValue is the OLD
17533
+ // mask's display string and may not parse under the new mask. When
17534
+ // we have a valid date model, rebuild the display from valueObject
17535
+ // (the canonical source) using the new mask's format function.
17650
17536
  if (
17651
17537
  this.util.isFullDateFormat(this.type, this.format) &&
17652
17538
  this.value &&
17653
- dateFormatter.isValidDate(this.value) &&
17654
- this.valueObject instanceof Date &&
17655
- !Number.isNaN(this.valueObject.getTime()) &&
17539
+ this.valueObject &&
17656
17540
  typeof maskOptions.format === 'function'
17657
17541
  ) {
17658
17542
  existingValue = maskOptions.format(this.valueObject);
17659
17543
  }
17660
17544
 
17545
+ // Clear before IMask attaches so the constructor seeds an empty
17546
+ // internal value. Otherwise IMask reads the stale unmasked string
17547
+ // and emits a spurious 'accept' before the restore below runs.
17661
17548
  this.skipNextProgrammaticInputEvent = true;
17662
17549
  this.inputElement.value = '';
17663
17550
 
17664
17551
  this.maskInstance = IMask(this.inputElement, maskOptions);
17665
17552
 
17553
+ // Mask fires 'accept' on every value change, including the restore
17554
+ // step below. Skip events fired during configureAutoFormatting so
17555
+ // we don't overwrite a value the parent just pushed.
17666
17556
  this.maskInstance.on('accept', () => {
17667
- // Suppress propagation during configureAutoFormatting's own value-restoration
17668
- // (line below) — the mask emits 'accept' on every value-set, including ours,
17669
- // and we don't want to overwrite a value the parent just pushed.
17670
17557
  if (this._configuringMask) return;
17671
17558
  this.value = this.util.toModelValue(this.maskInstance.value, this.format);
17672
17559
  if (this.type === "date") {
@@ -17674,6 +17561,8 @@ class BaseInput extends AuroElement$1 {
17674
17561
  }
17675
17562
  });
17676
17563
 
17564
+ // Mask fires 'complete' on the restore step below for any value that
17565
+ // happens to be a complete match. Same setup-suppression as 'accept'.
17677
17566
  this.maskInstance.on('complete', () => {
17678
17567
  if (this._configuringMask) return;
17679
17568
  this.value = this.util.toModelValue(this.maskInstance.value, this.format);
@@ -17682,7 +17571,9 @@ class BaseInput extends AuroElement$1 {
17682
17571
  }
17683
17572
  });
17684
17573
 
17685
- // Restore the stashed value through IMask so it's properly masked
17574
+ // Write existingValue through the mask (not the input directly) so
17575
+ // the mask reformats it under the new rules and keeps its internal
17576
+ // _value aligned with the input's displayed text.
17686
17577
  if (existingValue) {
17687
17578
  this.maskInstance.value = existingValue;
17688
17579
  }
@@ -17850,7 +17741,6 @@ class BaseInput extends AuroElement$1 {
17850
17741
  */
17851
17742
  reset() {
17852
17743
  this.value = undefined;
17853
- this.setDateObjectProperty('valueObject', undefined);
17854
17744
  this.validation.reset(this);
17855
17745
  }
17856
17746
 
@@ -17859,7 +17749,6 @@ class BaseInput extends AuroElement$1 {
17859
17749
  */
17860
17750
  clear() {
17861
17751
  this.value = undefined;
17862
- this.setDateObjectProperty('valueObject', undefined);
17863
17752
  }
17864
17753
 
17865
17754
  /**
@@ -18388,7 +18277,7 @@ let AuroHelpText$1 = class AuroHelpText extends LitElement {
18388
18277
  }
18389
18278
  };
18390
18279
 
18391
- var formkitVersion$1 = '202606171946';
18280
+ var formkitVersion$1 = '202606192004';
18392
18281
 
18393
18282
  // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
18394
18283
  // See LICENSE in the project root for license information.
@@ -19509,7 +19398,7 @@ class AuroBibtemplate extends LitElement {
19509
19398
  }
19510
19399
  }
19511
19400
 
19512
- var formkitVersion = '202606171946';
19401
+ var formkitVersion = '202606192004';
19513
19402
 
19514
19403
  var styleCss$1 = css`.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}`;
19515
19404
 
@@ -20496,7 +20385,7 @@ class AuroCombobox extends AuroElement {
20496
20385
  if (this.menu) {
20497
20386
  this.menu.matchWord = normalizeFilterValue(this.input.value);
20498
20387
  }
20499
- const label = getOptionLabel(this.menu.optionSelected) || this.menu.currentLabel;
20388
+ const label = getOptionLabel(this.menu.optionSelected);
20500
20389
  this.updateTriggerTextDisplay(label || this.value);
20501
20390
  }
20502
20391
 
@@ -20510,40 +20399,9 @@ class AuroCombobox extends AuroElement {
20510
20399
  // in suggestion mode, do not override input value if no selection has been made and the input currently has focus
20511
20400
  const isInputFocusedWithNoSelection = !this.menu.value && (this.input.matches(':focus-within') || (this.inputInBib && this.inputInBib.matches(':focus-within')));
20512
20401
 
20513
- if (!this.persistInput && !(this.behavior === 'suggestion' && isInputFocusedWithNoSelection)) {
20514
- const nextValue = label || this.value;
20515
- // Only set the flag when there's an actual write to suppress —
20516
- // syncValuesAndStates re-enters here during typing when both inputs
20517
- // already match, and a no-op flag flip would make the bib branch's
20518
- // bail eat legitimate user-input events.
20519
- const triggerNeedsSync = this.input.value !== nextValue;
20520
- const bibNeedsSync = Boolean(this.inputInBib && this.inputInBib !== this.input && this.inputInBib.value !== nextValue);
20521
- if (triggerNeedsSync || bibNeedsSync) {
20522
- this._syncingDisplayValue = true;
20523
- if (triggerNeedsSync) {
20524
- this.input.value = nextValue;
20525
- }
20526
- if (bibNeedsSync) {
20527
- this.inputInBib.value = nextValue;
20528
- }
20529
- const pending = [];
20530
- if (triggerNeedsSync) {
20531
- pending.push(this.input.updateComplete);
20532
- }
20533
- if (bibNeedsSync) {
20534
- pending.push(this.inputInBib.updateComplete);
20535
- }
20536
- Promise.all(pending).then(() => {
20537
- // imask reasserts otherwise, and handleBlur reverts to its stale value.
20538
- if (triggerNeedsSync && this.input.maskInstance && typeof this.input.maskInstance.updateValue === 'function') {
20539
- this.input.maskInstance.updateValue();
20540
- }
20541
- if (bibNeedsSync && this.inputInBib && this.inputInBib.maskInstance && typeof this.inputInBib.maskInstance.updateValue === 'function') {
20542
- this.inputInBib.maskInstance.updateValue();
20543
- }
20544
- this._syncingDisplayValue = false;
20545
- });
20546
- }
20402
+ const suppressed = this.persistInput || (this.behavior === 'suggestion' && isInputFocusedWithNoSelection);
20403
+ if (!suppressed) {
20404
+ this.syncInputValuesAcrossTriggerAndBib(label || this.value);
20547
20405
  }
20548
20406
 
20549
20407
  // update the displayValue in the trigger if displayValue slot content is present
@@ -20571,6 +20429,52 @@ class AuroCombobox extends AuroElement {
20571
20429
  this.requestUpdate();
20572
20430
  }
20573
20431
 
20432
+ /**
20433
+ * Writes nextValue to the trigger input and the bib input when their current
20434
+ * value differs, then re-asserts imask after Lit's update flushes.
20435
+ * @param {string} nextValue - The value to write to both inputs.
20436
+ * @returns {Promise<void> | null} Promise that resolves after the inputs flush,
20437
+ * or null when no sync was needed (so callers can skip post-flush work).
20438
+ * @private
20439
+ */
20440
+ syncInputValuesAcrossTriggerAndBib(nextValue) {
20441
+ // Only set the flag when there's an actual write to suppress —
20442
+ // syncValuesAndStates re-enters here during typing when both inputs
20443
+ // already match, and a no-op flag flip would make the bib branch's
20444
+ // bail eat legitimate user-input events.
20445
+ const triggerNeedsSync = this.input.value !== nextValue;
20446
+ const bibNeedsSync = Boolean(this.inputInBib && this.inputInBib !== this.input && this.inputInBib.value !== nextValue);
20447
+ if (!triggerNeedsSync && !bibNeedsSync) {
20448
+ return null;
20449
+ }
20450
+
20451
+ this._syncingDisplayValue = true;
20452
+ if (triggerNeedsSync) {
20453
+ this.input.value = nextValue;
20454
+ }
20455
+ if (bibNeedsSync) {
20456
+ this.inputInBib.value = nextValue;
20457
+ }
20458
+
20459
+ const pending = [];
20460
+ if (triggerNeedsSync) {
20461
+ pending.push(this.input.updateComplete);
20462
+ }
20463
+ if (bibNeedsSync) {
20464
+ pending.push(this.inputInBib.updateComplete);
20465
+ }
20466
+ return Promise.all(pending).then(() => {
20467
+ // imask reasserts otherwise, and handleBlur reverts to its stale value.
20468
+ if (triggerNeedsSync && this.input.maskInstance && typeof this.input.maskInstance.updateValue === 'function') {
20469
+ this.input.maskInstance.updateValue();
20470
+ }
20471
+ if (bibNeedsSync && this.inputInBib && this.inputInBib.maskInstance && typeof this.inputInBib.maskInstance.updateValue === 'function') {
20472
+ this.inputInBib.maskInstance.updateValue();
20473
+ }
20474
+ this._syncingDisplayValue = false;
20475
+ });
20476
+ }
20477
+
20574
20478
  /**
20575
20479
  * Processes hidden state of all menu options and determines if there are any available options not hidden.
20576
20480
  * @private
@@ -20598,9 +20502,9 @@ class AuroCombobox extends AuroElement {
20598
20502
  this.syncValuesAndStates();
20599
20503
  }
20600
20504
 
20601
- // Re-activate when optionActive is no longer visible, or when _index has
20602
- // been reset (e.g. by clearSelection in an async update) so that
20603
- // makeSelection() can find the correct option.
20505
+ // Re-activate when optionActive is not in the current scrollable viewport,
20506
+ // or when _index has been reset (e.g. by clearSelection in an async update)
20507
+ // so that makeSelection() can find the correct option.
20604
20508
  if (!this.availableOptions.includes(this.menu.optionActive) || this.menu._index < 0) {
20605
20509
  this.activateFirstEnabledAvailableOption();
20606
20510
  }
@@ -20734,28 +20638,25 @@ class AuroCombobox extends AuroElement {
20734
20638
 
20735
20639
  guardTouchPassthrough(this.menu);
20736
20640
 
20737
- // The dialog's showModal() steals focus from the trigger.
20738
- // A single rAF is enough for the dialog DOM to be painted and
20739
- // focusable, then doubleRaf finalizes the transition.
20641
+ // showModal() takes focus away from the trigger. Early focus once
20642
+ // the dialog has painted; the shared doubleRaf below is the fallback
20643
+ // for when the dialog needs an extra frame and also clears the
20644
+ // validation guard.
20740
20645
  requestAnimationFrame(() => {
20741
20646
  this.setInputFocus();
20742
20647
  });
20743
-
20744
- doubleRaf(() => {
20745
- this.setInputFocus();
20746
- this._inFullscreenTransition = false;
20747
- });
20748
- } else {
20749
- // Desktop popover-open: restore the trigger caret to end-of-text.
20750
- // Clicking the trigger lands on auro-input's floating <label for="…">
20751
- // overlay; Chrome resets the native input's selection to [0, 0] on
20752
- // label-focus before any JS runs. setInputFocus()'s non-fullscreen
20753
- // branch parks the caret at end. doubleRaf lets the dropdown layout
20754
- // settle first, matching the fullscreen branch timing.
20755
- doubleRaf(() => {
20756
- this.setInputFocus();
20757
- });
20758
20648
  }
20649
+ // else (desktop popover-open): Chrome resets the trigger caret to
20650
+ // [0, 0] when its floating <label for="…"> overlay receives focus.
20651
+ // The shared doubleRaf below parks the caret back at end-of-text
20652
+ // after the dropdown layout settles.
20653
+
20654
+ doubleRaf(() => {
20655
+ this.setInputFocus();
20656
+ if (this._inFullscreenTransition) {
20657
+ this._inFullscreenTransition = false;
20658
+ }
20659
+ });
20759
20660
  }
20760
20661
  });
20761
20662
 
@@ -20862,9 +20763,9 @@ class AuroCombobox extends AuroElement {
20862
20763
  } else {
20863
20764
  // Safety net for the strategy-change setTimeout: a viewport-crossing
20864
20765
  // fullscreen→floating switch can close the dialog and leave focus on
20865
- // body. Every other Branch 2 callsite already has focus on the input
20866
- // via the focusin → this.focus() redirect (L1448-1452), so this is a
20867
- // no-op in the common case.
20766
+ // body. Every other call into this branch already has focus on the
20767
+ // input via the combobox-level focusin → this.focus() redirect, so
20768
+ // this is a no-op in the common case.
20868
20769
  if (!this.input.componentHasFocus) {
20869
20770
  this.input.focus();
20870
20771
  }
@@ -20983,7 +20884,7 @@ class AuroCombobox extends AuroElement {
20983
20884
  if (this.menu.optionSelected) {
20984
20885
  const selected = this.menu.optionSelected;
20985
20886
 
20986
- if (!this.optionSelected || this.optionSelected !== selected) {
20887
+ if (this.optionSelected !== selected) {
20987
20888
  this.optionSelected = selected;
20988
20889
  }
20989
20890
 
@@ -20996,7 +20897,7 @@ class AuroCombobox extends AuroElement {
20996
20897
  }
20997
20898
 
20998
20899
  // Update display
20999
- this.updateTriggerTextDisplay(getOptionLabel(this.optionSelected) || this.menu.value);
20900
+ this.updateTriggerTextDisplay(getOptionLabel(this.optionSelected));
21000
20901
 
21001
20902
  // Update match word for filtering
21002
20903
  const trimmedInput = normalizeFilterValue(this.input.value);
@@ -21014,11 +20915,15 @@ class AuroCombobox extends AuroElement {
21014
20915
 
21015
20916
  // Announce the selection after the dropdown closes so it isn't
21016
20917
  // overridden by VoiceOver's "collapsed" announcement from aria-expanded.
20918
+ // Skip when there's no selected value (e.g. menu.clearSelection() from
20919
+ // the unmatched-value path), otherwise VoiceOver reads "undefined".
21017
20920
  const selectedValue = this.menu.value;
21018
- const announcementDelay = 300;
21019
- setTimeout(() => {
21020
- announceToScreenReader(this._getAnnouncementRoot(), `${selectedValue}, selected`);
21021
- }, announcementDelay);
20921
+ if (selectedValue) {
20922
+ const announcementDelay = 300;
20923
+ setTimeout(() => {
20924
+ announceToScreenReader(this._getAnnouncementRoot(), `${selectedValue}, selected`);
20925
+ }, announcementDelay);
20926
+ }
21022
20927
  }
21023
20928
 
21024
20929
  // Programmatic value syncs leave availableOptions stale because
@@ -21378,15 +21283,7 @@ class AuroCombobox extends AuroElement {
21378
21283
  this.menu.value = undefined;
21379
21284
  this.validation.reset(this);
21380
21285
  this.touched = false;
21381
- // Force validity back to the cleared state. validation.reset() calls
21382
- // validate() at the end, and (post-credit-card-fix) the trigger input's
21383
- // residual validity may still be copied into the combobox by the
21384
- // auroInputElements loop. Explicitly clear here so reset() actually
21385
- // leaves the component in a "no validity" state.
21386
21286
  this.validity = undefined;
21387
- this.errorMessage = '';
21388
- this.input.validity = undefined;
21389
- this.input.errorMessage = '';
21390
21287
  }
21391
21288
 
21392
21289
  /**
@@ -21439,52 +21336,27 @@ class AuroCombobox extends AuroElement {
21439
21336
  this.input.value = this.value;
21440
21337
  }
21441
21338
 
21442
- // Sync menu.value only when an option actually matches; otherwise clear it.
21339
+ // Sync menu.value only when an option actually matches, or when filter
21340
+ // mode needs setMenuValue to dispatch auroMenu-selectValueFailure (the
21341
+ // listener at line 1206 clears combobox.value, mirroring select's
21342
+ // pattern). Otherwise sync the input display for freeform values.
21443
21343
  if (this.menu.options && this.menu.options.length > 0) {
21444
- if (this.menu.options.some((opt) => opt.value === this.value)) {
21445
- this.setMenuValue(this.value);
21446
- } else if (this.behavior === 'filter') {
21447
- // In filter mode, freeform values aren't allowed. Push the unmatched
21448
- // value through setMenuValue so menu dispatches auroMenu-selectValueFailure
21449
- // and the listener at line 1206 clears combobox.value (mirrors select's
21450
- // pattern). Bypassing setMenuValue here would skip the failure cascade.
21344
+ if (this.menu.options.some((opt) => opt.value === this.value) || this.behavior === 'filter') {
21451
21345
  this.setMenuValue(this.value);
21452
21346
  } else {
21453
- if (this.menu.value) {
21454
- this.menu.value = undefined;
21347
+ // Clear menu.value AND menu.optionSelected together. Clearing only
21348
+ // menu.value leaves the previously-selected option element pinned
21349
+ // as menu.optionSelected; a later auroMenu-selectedOption event
21350
+ // would then write its stale .value back into combobox.value.
21351
+ if (this.menu.value || this.menu.optionSelected) {
21352
+ this.menu.clearSelection();
21455
21353
  }
21456
- // Sync the display for programmatic freeform value changes (e.g. the
21457
- // swap-values pattern). Guard with _syncingDisplayValue so that the
21458
- // re-entrant input event from base-input.notifyValueChanged() is
21459
- // ignored by handleInputValueChange. Skip the sync when input already
21460
- // matches to avoid spurious events during the normal typing path.
21461
- const nextValue = this.value || '';
21462
- const triggerNeedsSync = this.input.value !== nextValue;
21463
- const bibNeedsSync = Boolean(this.inputInBib && this.inputInBib !== this.input && this.inputInBib.value !== nextValue);
21464
- if (triggerNeedsSync || bibNeedsSync) {
21465
- this._syncingDisplayValue = true;
21466
- if (triggerNeedsSync) {
21467
- this.input.value = nextValue;
21468
- }
21469
- if (bibNeedsSync) {
21470
- this.inputInBib.value = nextValue;
21471
- }
21472
- const pending = [];
21473
- if (triggerNeedsSync) {
21474
- pending.push(this.input.updateComplete);
21475
- }
21476
- if (bibNeedsSync) {
21477
- pending.push(this.inputInBib.updateComplete);
21478
- }
21479
- Promise.all(pending).then(() => {
21480
- if (triggerNeedsSync && this.input.maskInstance && typeof this.input.maskInstance.updateValue === 'function') {
21481
- this.input.maskInstance.updateValue();
21482
- }
21483
- if (bibNeedsSync && this.inputInBib && this.inputInBib.maskInstance && typeof this.inputInBib.maskInstance.updateValue === 'function') {
21484
- this.inputInBib.maskInstance.updateValue();
21485
- }
21486
- this._syncingDisplayValue = false;
21487
- // handleInputValueChange bailed on the flag — refresh the filter.
21354
+ // Suggestion-mode freeform value: sync the trigger + bib to show it,
21355
+ // then refresh the filter once the inputs flush (handleInputValueChange
21356
+ // bailed on _syncingDisplayValue).
21357
+ const syncPromise = this.syncInputValuesAcrossTriggerAndBib(this.value || '');
21358
+ if (syncPromise) {
21359
+ syncPromise.then(() => {
21488
21360
  this._programmaticFilterRefresh = true;
21489
21361
  this.handleMenuOptions();
21490
21362
  setTimeout(() => {