@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
@@ -810,8 +810,6 @@ function navigateArrow(component, direction, options = {}) {
810
810
  }
811
811
  }
812
812
 
813
- /* eslint-disable no-underscore-dangle */
814
-
815
813
  /**
816
814
  * Returns the clear button element from the active input's shadow
817
815
  * DOM, if available.
@@ -847,9 +845,11 @@ function isClearBtnFocused(ctx, clearBtn = getClearBtn(ctx)) {
847
845
  * @param {Object} menu - The menu component.
848
846
  */
849
847
  function reconcileMenuIndex(menu) {
848
+ // eslint-disable-next-line no-underscore-dangle
850
849
  if (menu._index < 0 && menu.optionActive && menu.items) {
851
850
  const idx = menu.items.indexOf(menu.optionActive);
852
851
  if (idx >= 0) {
852
+ // eslint-disable-next-line no-underscore-dangle
853
853
  menu._index = idx;
854
854
  }
855
855
  }
@@ -4873,7 +4873,7 @@ let AuroHelpText$2 = class AuroHelpText extends i$3 {
4873
4873
  }
4874
4874
  };
4875
4875
 
4876
- var formkitVersion$2 = '202606231948';
4876
+ var formkitVersion$2 = '202606232113';
4877
4877
 
4878
4878
  let AuroElement$2 = class AuroElement extends i$3 {
4879
4879
  static get properties() {
@@ -16602,7 +16602,6 @@ class AuroInputUtilities {
16602
16602
  const maskOptions = this.getMaskOptions('date', normalizedFormat);
16603
16603
 
16604
16604
  if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
16605
- console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
16606
16605
  return undefined;
16607
16606
  }
16608
16607
 
@@ -16754,8 +16753,10 @@ class BaseInput extends AuroElement$1 {
16754
16753
  this.layout = 'classic';
16755
16754
  this.locale = 'en-US';
16756
16755
  this.max = undefined;
16756
+ this._maxObject = undefined;
16757
16757
  this.maxLength = undefined;
16758
16758
  this.min = undefined;
16759
+ this._minObject = undefined;
16759
16760
  this.minLength = undefined;
16760
16761
  this.required = false;
16761
16762
  this.onDark = false;
@@ -16763,6 +16764,7 @@ class BaseInput extends AuroElement$1 {
16763
16764
  this.size = 'lg';
16764
16765
  this.shape = 'classic';
16765
16766
  this.value = undefined;
16767
+ this._valueObject = undefined;
16766
16768
 
16767
16769
  this._initializePrivateDefaults();
16768
16770
  }
@@ -17302,7 +17304,7 @@ class BaseInput extends AuroElement$1 {
17302
17304
  * @returns {Date|undefined}
17303
17305
  */
17304
17306
  get valueObject() {
17305
- return this.value && dateFormatter.isValidDate(this.value) ? dateFormatter.stringToDateInstance(this.value) : undefined;
17307
+ return this._valueObject || this._computeDateObjectFallback(this.value);
17306
17308
  }
17307
17309
 
17308
17310
  /**
@@ -17310,7 +17312,7 @@ class BaseInput extends AuroElement$1 {
17310
17312
  * @returns {Date|undefined}
17311
17313
  */
17312
17314
  get minObject() {
17313
- return this.min && dateFormatter.isValidDate(this.min) ? dateFormatter.stringToDateInstance(this.min) : undefined;
17315
+ return this._minObject || this._computeDateObjectFallback(this.min);
17314
17316
  }
17315
17317
 
17316
17318
  /**
@@ -17318,7 +17320,50 @@ class BaseInput extends AuroElement$1 {
17318
17320
  * @returns {Date|undefined}
17319
17321
  */
17320
17322
  get maxObject() {
17321
- return this.max && dateFormatter.isValidDate(this.max) ? dateFormatter.stringToDateInstance(this.max) : undefined;
17323
+ return this._maxObject || this._computeDateObjectFallback(this.max);
17324
+ }
17325
+
17326
+ /**
17327
+ * Parses a date string into a Date object when the corresponding `_*Object`
17328
+ * field hasn't been synced yet by `updated()`. Returns undefined when the
17329
+ * input type/format isn't a full date or the string is not a valid date.
17330
+ *
17331
+ * Why this exists: a parent (datepicker) can call `inputN.validate()` from
17332
+ * inside its own `updated()` before this input's `updated()` has run
17333
+ * `syncDateValues()` — so `_valueObject`/`_maxObject` are still `undefined`
17334
+ * and range checks would otherwise silently no-op (flipping the result to
17335
+ * `valid` or `patternMismatch`).
17336
+ * @private
17337
+ * @param {string|undefined} dateStr - ISO date string from `value`/`min`/`max`.
17338
+ * @returns {Date|undefined}
17339
+ */
17340
+ _computeDateObjectFallback(dateStr) {
17341
+ if (!dateStr || !this.util || !this.util.isFullDateFormat(this.type, this.format)) {
17342
+ return undefined;
17343
+ }
17344
+ if (!dateFormatter.isValidDate(dateStr)) {
17345
+ return undefined;
17346
+ }
17347
+ return dateFormatter.stringToDateInstance(dateStr);
17348
+ }
17349
+
17350
+ /**
17351
+ * Internal setter for readonly date object properties.
17352
+ * @private
17353
+ * @param {'valueObject'|'minObject'|'maxObject'} propertyName - Public object property name.
17354
+ * @param {Date|undefined} propertyValue - Value to assign.
17355
+ * @returns {void}
17356
+ */
17357
+ setDateObjectProperty(propertyName, propertyValue) {
17358
+ const internalPropertyName = `_${propertyName}`;
17359
+ const previousValue = this[internalPropertyName];
17360
+
17361
+ if (previousValue === propertyValue) {
17362
+ return;
17363
+ }
17364
+
17365
+ this[internalPropertyName] = propertyValue;
17366
+ this.requestUpdate(propertyName, previousValue);
17322
17367
  }
17323
17368
 
17324
17369
  connectedCallback() {
@@ -17347,6 +17392,7 @@ class BaseInput extends AuroElement$1 {
17347
17392
  format: this.format
17348
17393
  });
17349
17394
  this.configureDataForType();
17395
+ this.syncDateValues();
17350
17396
  }
17351
17397
 
17352
17398
  disconnectedCallback() {
@@ -17366,6 +17412,15 @@ class BaseInput extends AuroElement$1 {
17366
17412
  this.wrapperElement.addEventListener('click', this.handleClick);
17367
17413
  }
17368
17414
 
17415
+ // add attribute for query selectors when auro-input is registered under a custom name
17416
+ // COVERAGE: the body of this branch is unreachable in WTR — connectedCallback
17417
+ // performs the same `setAttribute('auro-input', '')` earlier (see L665-667),
17418
+ // so by the time firstUpdated runs the attribute is already present and the
17419
+ // `!hasAttribute('auro-input')` guard is false. Retained as a defensive
17420
+ // safety net in case connectedCallback is ever short-circuited.
17421
+ if (this.tagName.toLowerCase() !== 'auro-input' && !this.hasAttribute('auro-input')) {
17422
+ this.setAttribute('auro-input', '');
17423
+ }
17369
17424
  this.inputId = this.id ? `${this.id}-input` : window.crypto.randomUUID();
17370
17425
 
17371
17426
  // use validity message override if declared when initializing the component
@@ -17376,6 +17431,7 @@ class BaseInput extends AuroElement$1 {
17376
17431
  this.setCustomHelpTextMessage();
17377
17432
  this.configureAutoFormatting();
17378
17433
  this.configureDataForType();
17434
+ this.syncDateValues();
17379
17435
  }
17380
17436
 
17381
17437
  /**
@@ -17451,6 +17507,13 @@ class BaseInput extends AuroElement$1 {
17451
17507
 
17452
17508
  if (typeToI18n.includes(this.type)) {
17453
17509
  this.setCustomValidityForType = i18n(this.lang, this.type);
17510
+ // COVERAGE: this `else if` branch is unreachable in WTR. connectedCallback
17511
+ // (L682) calls configureDataForType, which at L1266-1268 assigns
17512
+ // `this.format = this.util.getDateMaskFromLocale().toLowerCase()` for any
17513
+ // type=date input whose `format` attribute is unset. That runs before
17514
+ // firstUpdated invokes setCustomHelpTextMessage, so `!this.format` is
17515
+ // always false here. Retained as a defensive fallback; the whole function
17516
+ // is @deprecated per AB#1557296 and slated for removal.
17454
17517
  } else if (!this.format && this.type === 'date') {
17455
17518
  this.setCustomValidityForType = i18n(this.lang, 'dateMMDDYYYY');
17456
17519
  } else if (this.dateFormatMap[this.format]) {
@@ -17512,6 +17575,8 @@ class BaseInput extends AuroElement$1 {
17512
17575
  this.configureDataForType();
17513
17576
  }
17514
17577
 
17578
+ this.syncDateValues(changedProperties);
17579
+
17515
17580
  if (changedProperties.has('value')) {
17516
17581
  if (this.value && this.value.length > 0) {
17517
17582
  this.hasValue = true;
@@ -17533,14 +17598,14 @@ class BaseInput extends AuroElement$1 {
17533
17598
 
17534
17599
  if (formattedValue !== this.inputElement.value) {
17535
17600
  this.skipNextProgrammaticInputEvent = true;
17536
- if (this.maskInstance && this.type !== 'date') {
17601
+ if (this.maskInstance && this.type === 'credit-card') {
17537
17602
  // Route through the mask so its _value and el.value stay in lock-step
17538
17603
  // (set value calls updateControl which writes el.value = displayValue).
17539
17604
  // Writing el.value directly leaves the mask thinking displayValue is
17540
- // stale; _saveSelection on the next focus/click then warns. Date is
17541
- // excluded because its formattedValue can be raw ISO when the calendar
17542
- // is invalid, and re-masking through mm/dd/yyyy would truncate it and
17543
- // flip validity from patternMismatch to tooShort.
17605
+ // stale; _saveSelection on the next focus/click then warns. Scoped to
17606
+ // credit-card so date's own formattedValue (raw ISO when calendar-invalid)
17607
+ // isn't re-masked through the mm/dd/yyyy mask, which would truncate it
17608
+ // and flip validity from patternMismatch to tooShort.
17544
17609
  this.maskInstance.value = formattedValue || '';
17545
17610
  } else if (formattedValue) {
17546
17611
  this.inputElement.value = formattedValue;
@@ -17582,65 +17647,120 @@ class BaseInput extends AuroElement$1 {
17582
17647
  }));
17583
17648
  }
17584
17649
 
17650
+
17651
+ /**
17652
+ * Synchronizes the ISO string values and Date object representations for date-related properties.
17653
+ * This keeps the model and display values aligned when either side changes.
17654
+ *
17655
+ * When a full date format is in use, this method updates `value`, `min`, and `max` from their corresponding
17656
+ * Date objects or vice versa, based on which properties have changed. It only runs when the current configuration
17657
+ * represents a full year/month/day date format.
17658
+ *
17659
+ * @param {Map<string, unknown>|undefined} [changedProperties=undefined] - Optional map of changed properties used to limit which values are synchronized.
17660
+ * @returns {void}
17661
+ * @private
17662
+ */
17663
+ syncDateValues(changedProperties = undefined) {
17664
+ if (!this.util.isFullDateFormat(this.type, this.format)) {
17665
+ return;
17666
+ }
17667
+
17668
+ this.syncSingleDateValue(changedProperties, 'valueObject', 'value');
17669
+ this.syncSingleDateValue(changedProperties, 'minObject', 'min');
17670
+ this.syncSingleDateValue(changedProperties, 'maxObject', 'max');
17671
+ }
17672
+
17673
+ /**
17674
+ * Synchronizes one date object/string property pair.
17675
+ * @private
17676
+ * @param {Map<string, unknown>|undefined} changedProperties - Map of changed properties from Lit.
17677
+ * @param {string} objectProperty - Date object property name.
17678
+ * @param {string} valueProperty - ISO string property name.
17679
+ * @returns {void}
17680
+ */
17681
+ syncSingleDateValue(changedProperties, objectProperty, valueProperty) {
17682
+ const objectPropertyChanged = !changedProperties || changedProperties.has(objectProperty);
17683
+
17684
+ // objectProperty wins over valueProperty when both changed
17685
+ if (objectPropertyChanged && this[objectProperty]) {
17686
+ this[valueProperty] = dateFormatter.toISOFormatString(this[objectProperty]);
17687
+ return;
17688
+ }
17689
+
17690
+ const valuePropertyChanged = !changedProperties || changedProperties.has(valueProperty);
17691
+ if (!valuePropertyChanged) {
17692
+ return;
17693
+ }
17694
+
17695
+ // 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)
17696
+ if (
17697
+ changedProperties &&
17698
+ valueProperty === 'value' &&
17699
+ changedProperties.get('value') === undefined &&
17700
+ this[objectProperty] instanceof Date &&
17701
+ this[valueProperty] === dateFormatter.toISOFormatString(this[objectProperty])
17702
+ ) {
17703
+ return;
17704
+ }
17705
+
17706
+ if (dateFormatter.isValidDate(this[valueProperty])) {
17707
+ this.setDateObjectProperty(objectProperty, dateFormatter.stringToDateInstance(this[valueProperty]));
17708
+ } else {
17709
+ this.setDateObjectProperty(objectProperty, undefined);
17710
+ }
17711
+ }
17712
+
17585
17713
  /**
17586
17714
  * Sets up IMasks and logic based on auto-formatting requirements.
17587
17715
  * @private
17588
17716
  * @returns {void}
17589
17717
  */
17590
17718
  configureAutoFormatting() {
17591
- // _configuringMask gates two things: external re-entry into this method
17592
- // while setup is mid-flight (from property changes that call back here),
17593
- // and the accept/complete listeners below both need to ignore the mask
17594
- // events fired by our own value-restore step.
17719
+ // Re-entrancy guard. The patched-setter's synthetic input event (suppressed
17720
+ // by _configuringMask above) could otherwise trigger handleInput
17721
+ // processCreditCard configureAutoFormatting before the outer call's
17722
+ // set value has finished its alignCursor pass.
17595
17723
  if (this._configuringMask) return;
17596
17724
  this._configuringMask = true;
17597
17725
  try {
17598
- // Destroy any prior mask so IMask can attach fresh under the new format.
17599
- // Null the reference too — if the new maskOptions.mask is falsy (e.g.
17600
- // type switched from credit-card to text) the IMask() reassignment
17601
- // below is skipped, and downstream writes at line ~823 would otherwise
17602
- // route through the destroyed instance.
17603
17726
  if (this.maskInstance) {
17604
17727
  this.maskInstance.destroy();
17605
- this.maskInstance = null;
17606
17728
  }
17607
17729
 
17730
+ // Pass new format to util
17608
17731
  this.util.updateFormat(this.format);
17609
17732
 
17610
17733
  const maskOptions = this.util.getMaskOptions(this.type, this.format);
17611
17734
 
17612
17735
  if (this.inputElement && maskOptions.mask) {
17613
- // Capture the current display so it can be re-applied after IMask
17614
- // attaches. The restore at the bottom goes through maskInstance.value
17615
- // (not inputElement.value directly) so the mask's internal state and
17616
- // the input's displayed text stay in lock-step.
17617
- let existingValue = this.inputElement.value;
17618
17736
 
17619
- // Format-change case (e.g. locale switch): existingValue is the OLD
17620
- // mask's display string and may not parse under the new mask. When
17621
- // we have a valid date model, rebuild the display from valueObject
17622
- // (the canonical source) using the new mask's format function.
17737
+ // Stash and clear any existing value before IMask init.
17738
+ // IMask's constructor processes the current input value which requires
17739
+ // selection state clearing first avoids that scenario entirely.
17740
+ // When the format changes (e.g. locale switch) and we have a valid ISO
17741
+ // model value, compute the display string for the NEW format instead of
17742
+ // re-using the old display string, which may be invalid in the new mask.
17743
+ let existingValue = this.inputElement.value;
17623
17744
  if (
17624
17745
  this.util.isFullDateFormat(this.type, this.format) &&
17625
17746
  this.value &&
17626
- this.valueObject &&
17747
+ dateFormatter.isValidDate(this.value) &&
17748
+ this.valueObject instanceof Date &&
17749
+ !Number.isNaN(this.valueObject.getTime()) &&
17627
17750
  typeof maskOptions.format === 'function'
17628
17751
  ) {
17629
17752
  existingValue = maskOptions.format(this.valueObject);
17630
17753
  }
17631
17754
 
17632
- // Clear before IMask attaches so the constructor seeds an empty
17633
- // internal value. Otherwise IMask reads the stale unmasked string
17634
- // and emits a spurious 'accept' before the restore below runs.
17635
17755
  this.skipNextProgrammaticInputEvent = true;
17636
17756
  this.inputElement.value = '';
17637
17757
 
17638
17758
  this.maskInstance = IMask(this.inputElement, maskOptions);
17639
17759
 
17640
- // Mask fires 'accept' on every value change, including the restore
17641
- // step below. Skip events fired during configureAutoFormatting so
17642
- // we don't overwrite a value the parent just pushed.
17643
17760
  this.maskInstance.on('accept', () => {
17761
+ // Suppress propagation during configureAutoFormatting's own value-restoration
17762
+ // (line below) — the mask emits 'accept' on every value-set, including ours,
17763
+ // and we don't want to overwrite a value the parent just pushed.
17644
17764
  if (this._configuringMask) return;
17645
17765
  this.value = this.util.toModelValue(this.maskInstance.value, this.format);
17646
17766
  if (this.type === "date") {
@@ -17648,8 +17768,6 @@ class BaseInput extends AuroElement$1 {
17648
17768
  }
17649
17769
  });
17650
17770
 
17651
- // Mask fires 'complete' on the restore step below for any value that
17652
- // happens to be a complete match. Same setup-suppression as 'accept'.
17653
17771
  this.maskInstance.on('complete', () => {
17654
17772
  if (this._configuringMask) return;
17655
17773
  this.value = this.util.toModelValue(this.maskInstance.value, this.format);
@@ -17658,9 +17776,7 @@ class BaseInput extends AuroElement$1 {
17658
17776
  }
17659
17777
  });
17660
17778
 
17661
- // Write existingValue through the mask (not the input directly) so
17662
- // the mask reformats it under the new rules and keeps its internal
17663
- // _value aligned with the input's displayed text.
17779
+ // Restore the stashed value through IMask so it's properly masked
17664
17780
  if (existingValue) {
17665
17781
  this.maskInstance.value = existingValue;
17666
17782
  }
@@ -17828,6 +17944,7 @@ class BaseInput extends AuroElement$1 {
17828
17944
  */
17829
17945
  reset() {
17830
17946
  this.value = undefined;
17947
+ this.setDateObjectProperty('valueObject', undefined);
17831
17948
  this.validation.reset(this);
17832
17949
  }
17833
17950
 
@@ -17836,6 +17953,7 @@ class BaseInput extends AuroElement$1 {
17836
17953
  */
17837
17954
  clear() {
17838
17955
  this.value = undefined;
17956
+ this.setDateObjectProperty('valueObject', undefined);
17839
17957
  }
17840
17958
 
17841
17959
  /**
@@ -17873,6 +17991,12 @@ class BaseInput extends AuroElement$1 {
17873
17991
  */
17874
17992
  get placeholderStr() {
17875
17993
  if (!this.placeholder && this.type === 'date') {
17994
+ // COVERAGE: the `'MM/DD/YYYY'` literal fallback is unreachable in WTR.
17995
+ // connectedCallback (L682) calls configureDataForType, which at L1266-1268
17996
+ // assigns `this.format = this.util.getDateMaskFromLocale().toLowerCase()`
17997
+ // when type=date and format is unset. That runs before the first render
17998
+ // reads this getter, so the ternary's truthy arm always wins. Retained
17999
+ // as a defensive fallback for direct getter calls before connection.
17876
18000
  return this.format ? this.format.toUpperCase() : 'MM/DD/YYYY';
17877
18001
  }
17878
18002
  return this.placeholder || "";
@@ -18364,7 +18488,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$3 {
18364
18488
  }
18365
18489
  };
18366
18490
 
18367
- var formkitVersion$1 = '202606231948';
18491
+ var formkitVersion$1 = '202606232113';
18368
18492
 
18369
18493
  // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
18370
18494
  // See LICENSE in the project root for license information.
@@ -19485,7 +19609,7 @@ class AuroBibtemplate extends i$3 {
19485
19609
  }
19486
19610
  }
19487
19611
 
19488
- var formkitVersion = '202606231948';
19612
+ var formkitVersion = '202606232113';
19489
19613
 
19490
19614
  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}`;
19491
19615
 
@@ -20472,7 +20596,7 @@ class AuroCombobox extends AuroElement {
20472
20596
  if (this.menu) {
20473
20597
  this.menu.matchWord = normalizeFilterValue(this.input.value);
20474
20598
  }
20475
- const label = getOptionLabel(this.menu.optionSelected);
20599
+ const label = getOptionLabel(this.menu.optionSelected) || this.menu.currentLabel;
20476
20600
  this.updateTriggerTextDisplay(label || this.value);
20477
20601
  }
20478
20602
 
@@ -20486,9 +20610,40 @@ class AuroCombobox extends AuroElement {
20486
20610
  // in suggestion mode, do not override input value if no selection has been made and the input currently has focus
20487
20611
  const isInputFocusedWithNoSelection = !this.menu.value && (this.input.matches(':focus-within') || (this.inputInBib && this.inputInBib.matches(':focus-within')));
20488
20612
 
20489
- const suppressed = this.persistInput || (this.behavior === 'suggestion' && isInputFocusedWithNoSelection);
20490
- if (!suppressed) {
20491
- this.syncInputValuesAcrossTriggerAndBib(label || this.value);
20613
+ if (!this.persistInput && !(this.behavior === 'suggestion' && isInputFocusedWithNoSelection)) {
20614
+ const nextValue = label || this.value;
20615
+ // Only set the flag when there's an actual write to suppress —
20616
+ // syncValuesAndStates re-enters here during typing when both inputs
20617
+ // already match, and a no-op flag flip would make the bib branch's
20618
+ // bail eat legitimate user-input events.
20619
+ const triggerNeedsSync = this.input.value !== nextValue;
20620
+ const bibNeedsSync = Boolean(this.inputInBib && this.inputInBib !== this.input && this.inputInBib.value !== nextValue);
20621
+ if (triggerNeedsSync || bibNeedsSync) {
20622
+ this._syncingDisplayValue = true;
20623
+ if (triggerNeedsSync) {
20624
+ this.input.value = nextValue;
20625
+ }
20626
+ if (bibNeedsSync) {
20627
+ this.inputInBib.value = nextValue;
20628
+ }
20629
+ const pending = [];
20630
+ if (triggerNeedsSync) {
20631
+ pending.push(this.input.updateComplete);
20632
+ }
20633
+ if (bibNeedsSync) {
20634
+ pending.push(this.inputInBib.updateComplete);
20635
+ }
20636
+ Promise.all(pending).then(() => {
20637
+ // imask reasserts otherwise, and handleBlur reverts to its stale value.
20638
+ if (triggerNeedsSync && this.input.maskInstance && typeof this.input.maskInstance.updateValue === 'function') {
20639
+ this.input.maskInstance.updateValue();
20640
+ }
20641
+ if (bibNeedsSync && this.inputInBib && this.inputInBib.maskInstance && typeof this.inputInBib.maskInstance.updateValue === 'function') {
20642
+ this.inputInBib.maskInstance.updateValue();
20643
+ }
20644
+ this._syncingDisplayValue = false;
20645
+ });
20646
+ }
20492
20647
  }
20493
20648
 
20494
20649
  // update the displayValue in the trigger if displayValue slot content is present
@@ -20516,48 +20671,6 @@ class AuroCombobox extends AuroElement {
20516
20671
  this.requestUpdate();
20517
20672
  }
20518
20673
 
20519
- /**
20520
- * Writes nextValue to the trigger input and the bib input when their current
20521
- * value differs, then re-asserts imask after Lit's update flushes.
20522
- * @param {string} nextValue - The value to write to both inputs.
20523
- * @returns {Promise<void> | null} Promise that resolves after the inputs flush,
20524
- * or null when no sync was needed (so callers can skip post-flush work).
20525
- * @private
20526
- */
20527
- syncInputValuesAcrossTriggerAndBib(nextValue) {
20528
- // Only set the flag when there's an actual write to suppress —
20529
- // syncValuesAndStates re-enters here during typing when both inputs
20530
- // already match, and a no-op flag flip would make the bib branch's
20531
- // bail eat legitimate user-input events.
20532
- const triggerNeedsSync = this.input.value !== nextValue;
20533
- const bibNeedsSync = this.inputInBib.value !== nextValue;
20534
- if (!triggerNeedsSync && !bibNeedsSync) {
20535
- return null;
20536
- }
20537
-
20538
- this._syncingDisplayValue = true;
20539
-
20540
- const pending = [];
20541
- if (triggerNeedsSync) {
20542
- this.input.value = nextValue;
20543
- pending.push(this.input.updateComplete);
20544
- }
20545
- if (bibNeedsSync) {
20546
- this.inputInBib.value = nextValue;
20547
- pending.push(this.inputInBib.updateComplete);
20548
- }
20549
- return Promise.all(pending).then(() => {
20550
- // imask reasserts otherwise, and handleBlur reverts to its stale value.
20551
- if (triggerNeedsSync && this.input.maskInstance && typeof this.input.maskInstance.updateValue === 'function') {
20552
- this.input.maskInstance.updateValue();
20553
- }
20554
- if (bibNeedsSync && this.inputInBib && this.inputInBib.maskInstance && typeof this.inputInBib.maskInstance.updateValue === 'function') {
20555
- this.inputInBib.maskInstance.updateValue();
20556
- }
20557
- this._syncingDisplayValue = false;
20558
- });
20559
- }
20560
-
20561
20674
  /**
20562
20675
  * Processes hidden state of all menu options and determines if there are any available options not hidden.
20563
20676
  * @private
@@ -20585,9 +20698,9 @@ class AuroCombobox extends AuroElement {
20585
20698
  this.syncValuesAndStates();
20586
20699
  }
20587
20700
 
20588
- // Re-activate when optionActive is not in the current scrollable viewport,
20589
- // or when _index has been reset (e.g. by clearSelection in an async update)
20590
- // so that makeSelection() can find the correct option.
20701
+ // Re-activate when optionActive is no longer visible, or when _index has
20702
+ // been reset (e.g. by clearSelection in an async update) so that
20703
+ // makeSelection() can find the correct option.
20591
20704
  if (!this.availableOptions.includes(this.menu.optionActive) || this.menu._index < 0) {
20592
20705
  this.activateFirstEnabledAvailableOption();
20593
20706
  }
@@ -20721,25 +20834,28 @@ class AuroCombobox extends AuroElement {
20721
20834
 
20722
20835
  guardTouchPassthrough(this.menu);
20723
20836
 
20724
- // showModal() takes focus away from the trigger. Early focus once
20725
- // the dialog has painted; the shared doubleRaf below is the fallback
20726
- // for when the dialog needs an extra frame and also clears the
20727
- // validation guard.
20837
+ // The dialog's showModal() steals focus from the trigger.
20838
+ // A single rAF is enough for the dialog DOM to be painted and
20839
+ // focusable, then doubleRaf finalizes the transition.
20728
20840
  requestAnimationFrame(() => {
20729
20841
  this.setInputFocus();
20730
20842
  });
20731
- }
20732
- // else (desktop popover-open): Chrome resets the trigger caret to
20733
- // [0, 0] when its floating <label for="…"> overlay receives focus.
20734
- // The shared doubleRaf below parks the caret back at end-of-text
20735
- // after the dropdown layout settles.
20736
-
20737
- doubleRaf(() => {
20738
- this.setInputFocus();
20739
- if (this._inFullscreenTransition) {
20843
+
20844
+ doubleRaf(() => {
20845
+ this.setInputFocus();
20740
20846
  this._inFullscreenTransition = false;
20741
- }
20742
- });
20847
+ });
20848
+ } else {
20849
+ // Desktop popover-open: restore the trigger caret to end-of-text.
20850
+ // Clicking the trigger lands on auro-input's floating <label for="…">
20851
+ // overlay; Chrome resets the native input's selection to [0, 0] on
20852
+ // label-focus before any JS runs. setInputFocus()'s non-fullscreen
20853
+ // branch parks the caret at end. doubleRaf lets the dropdown layout
20854
+ // settle first, matching the fullscreen branch timing.
20855
+ doubleRaf(() => {
20856
+ this.setInputFocus();
20857
+ });
20858
+ }
20743
20859
  }
20744
20860
  });
20745
20861
 
@@ -20950,7 +21066,7 @@ class AuroCombobox extends AuroElement {
20950
21066
  if (this.menu.optionSelected) {
20951
21067
  const selected = this.menu.optionSelected;
20952
21068
 
20953
- if (this.optionSelected !== selected) {
21069
+ if (!this.optionSelected || this.optionSelected !== selected) {
20954
21070
  this.optionSelected = selected;
20955
21071
  }
20956
21072
 
@@ -20963,7 +21079,7 @@ class AuroCombobox extends AuroElement {
20963
21079
  }
20964
21080
 
20965
21081
  // Update display
20966
- this.updateTriggerTextDisplay(getOptionLabel(this.optionSelected));
21082
+ this.updateTriggerTextDisplay(getOptionLabel(this.optionSelected) || this.menu.value);
20967
21083
 
20968
21084
  // Update match word for filtering
20969
21085
  const trimmedInput = normalizeFilterValue(this.input.value);
@@ -20979,22 +21095,13 @@ class AuroCombobox extends AuroElement {
20979
21095
  this.hideBib();
20980
21096
  }
20981
21097
 
20982
- // Move focus to the clear button when the user makes a selection.
20983
- if (!isEcho && this.menu.value !== undefined) {
20984
- this.setClearBtnFocus();
20985
- }
20986
-
20987
21098
  // Announce the selection after the dropdown closes so it isn't
20988
21099
  // overridden by VoiceOver's "collapsed" announcement from aria-expanded.
20989
- // Skip when there's no selected value (e.g. menu.clearSelection() from
20990
- // the unmatched-value path), otherwise VoiceOver reads "undefined".
20991
21100
  const selectedValue = this.menu.value;
20992
- if (selectedValue) {
20993
- const announcementDelay = 300;
20994
- setTimeout(() => {
20995
- announceToScreenReader(this._getAnnouncementRoot(), `${selectedValue}, selected`);
20996
- }, announcementDelay);
20997
- }
21101
+ const announcementDelay = 300;
21102
+ setTimeout(() => {
21103
+ announceToScreenReader(this._getAnnouncementRoot(), `${selectedValue}, selected`);
21104
+ }, announcementDelay);
20998
21105
  }
20999
21106
 
21000
21107
  // Programmatic value syncs leave availableOptions stale because
@@ -21008,6 +21115,18 @@ class AuroCombobox extends AuroElement {
21008
21115
  this._programmaticFilterRefresh = false;
21009
21116
  }, 0);
21010
21117
  }
21118
+
21119
+ // base-input skips auto-validate when focus is inside its own shadow,
21120
+ // which it is after setTriggerInputFocus — re-run so prior tooShort
21121
+ // clears. processCreditCard reasserts errorMessage on every render.
21122
+ if (!isEcho && this.menu.optionSelected && this.input.validate) {
21123
+ this.input.updateComplete.then(() => {
21124
+ this.input.validate(true);
21125
+ if (this.input.validity === 'valid') {
21126
+ this.input.errorMessage = '';
21127
+ }
21128
+ });
21129
+ }
21011
21130
  });
21012
21131
 
21013
21132
  this.menu.addEventListener('auroMenu-customEventFired', () => {
@@ -21342,7 +21461,15 @@ class AuroCombobox extends AuroElement {
21342
21461
  this.menu.value = undefined;
21343
21462
  this.validation.reset(this);
21344
21463
  this.touched = false;
21464
+ // Force validity back to the cleared state. validation.reset() calls
21465
+ // validate() at the end, and (post-credit-card-fix) the trigger input's
21466
+ // residual validity may still be copied into the combobox by the
21467
+ // auroInputElements loop. Explicitly clear here so reset() actually
21468
+ // leaves the component in a "no validity" state.
21345
21469
  this.validity = undefined;
21470
+ this.errorMessage = '';
21471
+ this.input.validity = undefined;
21472
+ this.input.errorMessage = '';
21346
21473
  }
21347
21474
 
21348
21475
  /**
@@ -21395,27 +21522,52 @@ class AuroCombobox extends AuroElement {
21395
21522
  this.input.value = this.value;
21396
21523
  }
21397
21524
 
21398
- // Sync menu.value only when an option actually matches, or when filter
21399
- // mode needs setMenuValue to dispatch auroMenu-selectValueFailure (the
21400
- // listener at line 1206 clears combobox.value, mirroring select's
21401
- // pattern). Otherwise sync the input display for freeform values.
21525
+ // Sync menu.value only when an option actually matches; otherwise clear it.
21402
21526
  if (this.menu.options && this.menu.options.length > 0) {
21403
- if (this.menu.options.some((opt) => opt.value === this.value) || this.behavior === 'filter') {
21527
+ if (this.menu.options.some((opt) => opt.value === this.value)) {
21528
+ this.setMenuValue(this.value);
21529
+ } else if (this.behavior === 'filter') {
21530
+ // In filter mode, freeform values aren't allowed. Push the unmatched
21531
+ // value through setMenuValue so menu dispatches auroMenu-selectValueFailure
21532
+ // and the listener at line 1206 clears combobox.value (mirrors select's
21533
+ // pattern). Bypassing setMenuValue here would skip the failure cascade.
21404
21534
  this.setMenuValue(this.value);
21405
21535
  } else {
21406
- // Clear menu.value AND menu.optionSelected together. Clearing only
21407
- // menu.value leaves the previously-selected option element pinned
21408
- // as menu.optionSelected; a later auroMenu-selectedOption event
21409
- // would then write its stale .value back into combobox.value.
21410
- if (this.menu.value || this.menu.optionSelected) {
21411
- this.menu.clearSelection();
21536
+ if (this.menu.value) {
21537
+ this.menu.value = undefined;
21412
21538
  }
21413
- // Suggestion-mode freeform value: sync the trigger + bib to show it,
21414
- // then refresh the filter once the inputs flush (handleInputValueChange
21415
- // bailed on _syncingDisplayValue).
21416
- const syncPromise = this.syncInputValuesAcrossTriggerAndBib(this.value || '');
21417
- if (syncPromise) {
21418
- syncPromise.then(() => {
21539
+ // Sync the display for programmatic freeform value changes (e.g. the
21540
+ // swap-values pattern). Guard with _syncingDisplayValue so that the
21541
+ // re-entrant input event from base-input.notifyValueChanged() is
21542
+ // ignored by handleInputValueChange. Skip the sync when input already
21543
+ // matches to avoid spurious events during the normal typing path.
21544
+ const nextValue = this.value || '';
21545
+ const triggerNeedsSync = this.input.value !== nextValue;
21546
+ const bibNeedsSync = Boolean(this.inputInBib && this.inputInBib !== this.input && this.inputInBib.value !== nextValue);
21547
+ if (triggerNeedsSync || bibNeedsSync) {
21548
+ this._syncingDisplayValue = true;
21549
+ if (triggerNeedsSync) {
21550
+ this.input.value = nextValue;
21551
+ }
21552
+ if (bibNeedsSync) {
21553
+ this.inputInBib.value = nextValue;
21554
+ }
21555
+ const pending = [];
21556
+ if (triggerNeedsSync) {
21557
+ pending.push(this.input.updateComplete);
21558
+ }
21559
+ if (bibNeedsSync) {
21560
+ pending.push(this.inputInBib.updateComplete);
21561
+ }
21562
+ Promise.all(pending).then(() => {
21563
+ if (triggerNeedsSync && this.input.maskInstance && typeof this.input.maskInstance.updateValue === 'function') {
21564
+ this.input.maskInstance.updateValue();
21565
+ }
21566
+ if (bibNeedsSync && this.inputInBib && this.inputInBib.maskInstance && typeof this.inputInBib.maskInstance.updateValue === 'function') {
21567
+ this.inputInBib.maskInstance.updateValue();
21568
+ }
21569
+ this._syncingDisplayValue = false;
21570
+ // handleInputValueChange bailed on the flag — refresh the filter.
21419
21571
  this._programmaticFilterRefresh = true;
21420
21572
  this.handleMenuOptions();
21421
21573
  setTimeout(() => {