@aurodesignsystem-dev/auro-formkit 0.0.0-pr1600.2 → 0.0.0-pr1602.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 (64) 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 +110 -4
  7. package/components/combobox/demo/getting-started.md +49 -0
  8. package/components/combobox/demo/getting-started.min.js +129 -4
  9. package/components/combobox/demo/index.min.js +110 -4
  10. package/components/combobox/dist/auro-combobox.d.ts +22 -0
  11. package/components/combobox/dist/index.js +94 -4
  12. package/components/combobox/dist/registered.js +94 -4
  13. package/components/counter/demo/api.md +2 -0
  14. package/components/counter/demo/customize.min.js +322 -92
  15. package/components/counter/demo/getting-started.html +3 -1
  16. package/components/counter/demo/getting-started.md +49 -0
  17. package/components/counter/demo/getting-started.min.js +8766 -0
  18. package/components/counter/demo/index.min.js +322 -92
  19. package/components/counter/dist/auro-counter-group.d.ts +6 -12
  20. package/components/counter/dist/auro-counter.d.ts +6 -0
  21. package/components/counter/dist/counterGroupKeyboardStrategy.d.ts +1 -0
  22. package/components/counter/dist/index.js +322 -92
  23. package/components/counter/dist/registered.js +322 -92
  24. package/components/datepicker/demo/customize.min.js +3 -3
  25. package/components/datepicker/demo/getting-started.html +3 -1
  26. package/components/datepicker/demo/getting-started.md +39 -0
  27. package/components/datepicker/demo/getting-started.min.js +37626 -0
  28. package/components/datepicker/demo/index.min.js +3 -3
  29. package/components/datepicker/dist/index.js +3 -3
  30. package/components/datepicker/dist/registered.js +3 -3
  31. package/components/dropdown/demo/customize.min.js +1 -1
  32. package/components/dropdown/demo/getting-started.min.js +2 -2
  33. package/components/dropdown/demo/index.min.js +1 -1
  34. package/components/dropdown/dist/index.js +1 -1
  35. package/components/dropdown/dist/registered.js +1 -1
  36. package/components/form/demo/customize.min.js +446 -105
  37. package/components/form/demo/getting-started.min.js +446 -105
  38. package/components/form/demo/index.min.js +446 -105
  39. package/components/form/demo/registerDemoDeps.min.js +440 -104
  40. package/components/form/dist/index.js +6 -1
  41. package/components/form/dist/registered.js +6 -1
  42. package/components/input/demo/customize.md +0 -37
  43. package/components/input/demo/customize.min.js +1 -10
  44. package/components/input/demo/getting-started.md +33 -0
  45. package/components/input/demo/getting-started.min.js +21 -1
  46. package/components/input/demo/index.min.js +1 -1
  47. package/components/input/dist/index.js +1 -1
  48. package/components/input/dist/registered.js +1 -1
  49. package/components/menu/demo/index.min.js +16 -0
  50. package/components/menu/dist/index.js +16 -0
  51. package/components/menu/dist/registered.js +16 -0
  52. package/components/radio/demo/customize.min.js +1 -1
  53. package/components/radio/demo/getting-started.min.js +1 -1
  54. package/components/radio/demo/index.min.js +1 -1
  55. package/components/radio/dist/index.js +1 -1
  56. package/components/radio/dist/registered.js +1 -1
  57. package/components/select/demo/customize.min.js +18 -2
  58. package/components/select/demo/getting-started.md +49 -0
  59. package/components/select/demo/getting-started.min.js +40 -3
  60. package/components/select/demo/index.min.js +18 -2
  61. package/components/select/dist/index.js +2 -2
  62. package/components/select/dist/registered.js +2 -2
  63. package/custom-elements.json +41 -26
  64. package/package.json +1 -1
@@ -1284,7 +1284,7 @@ class AuroHelpText extends i$2 {
1284
1284
  }
1285
1285
  }
1286
1286
 
1287
- var formkitVersion = '202609010052';
1287
+ var formkitVersion = '202609021726';
1288
1288
 
1289
1289
  // Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
1290
1290
  // See LICENSE in the project root for license information.
@@ -1284,7 +1284,7 @@ class AuroHelpText extends i$2 {
1284
1284
  }
1285
1285
  }
1286
1286
 
1287
- var formkitVersion = '202609010052';
1287
+ var formkitVersion = '202609021726';
1288
1288
 
1289
1289
  // Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
1290
1290
  // See LICENSE in the project root for license information.
@@ -1284,7 +1284,7 @@ class AuroHelpText extends i$2 {
1284
1284
  }
1285
1285
  }
1286
1286
 
1287
- var formkitVersion = '202609010052';
1287
+ var formkitVersion = '202609021726';
1288
1288
 
1289
1289
  // Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
1290
1290
  // See LICENSE in the project root for license information.
@@ -1237,7 +1237,7 @@ class AuroHelpText extends LitElement {
1237
1237
  }
1238
1238
  }
1239
1239
 
1240
- var formkitVersion = '202609010052';
1240
+ var formkitVersion = '202609021726';
1241
1241
 
1242
1242
  // Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
1243
1243
  // See LICENSE in the project root for license information.
@@ -1237,7 +1237,7 @@ class AuroHelpText extends LitElement {
1237
1237
  }
1238
1238
  }
1239
1239
 
1240
- var formkitVersion = '202609010052';
1240
+ var formkitVersion = '202609021726';
1241
1241
 
1242
1242
  // Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
1243
1243
  // See LICENSE in the project root for license information.
@@ -5066,7 +5066,7 @@ let AuroHelpText$2 = class AuroHelpText extends i$3 {
5066
5066
  }
5067
5067
  };
5068
5068
 
5069
- var formkitVersion$2 = '202609010052';
5069
+ var formkitVersion$2 = '202609021726';
5070
5070
 
5071
5071
  /**
5072
5072
  * AuroElement is the shared base class for layout-aware Auro form components.
@@ -18935,7 +18935,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$3 {
18935
18935
  }
18936
18936
  };
18937
18937
 
18938
- var formkitVersion$1 = '202609010052';
18938
+ var formkitVersion$1 = '202609021726';
18939
18939
 
18940
18940
  // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
18941
18941
  // See LICENSE in the project root for license information.
@@ -20127,7 +20127,7 @@ class AuroBibtemplate extends i$3 {
20127
20127
  }
20128
20128
  }
20129
20129
 
20130
- var formkitVersion = '202609010052';
20130
+ var formkitVersion = '202609021726';
20131
20131
 
20132
20132
  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}`;
20133
20133
 
@@ -20568,6 +20568,11 @@ class AuroCombobox extends AuroElement {
20568
20568
  this.behavior = "suggestion";
20569
20569
  this.clearBtnFocused = false;
20570
20570
 
20571
+ // One-shot: set when the input's clear button is activated so the
20572
+ // SPA-preselect guard in handleInputValueChange doesn't swallow the
20573
+ // genuine clear (AB#1634257).
20574
+ this._clearBtnActivated = false;
20575
+
20571
20576
  // Defaults that effect the overall layout of the combobox
20572
20577
  this.checkmark = false;
20573
20578
  this.dvInputOnly = false;
@@ -21525,6 +21530,13 @@ class AuroCombobox extends AuroElement {
21525
21530
  this.bibtemplate = this.dropdown.querySelector(this.bibtemplateTag._$litStatic$);
21526
21531
  this.inputInBib = this.bibtemplate.querySelector(this.inputTag._$litStatic$);
21527
21532
 
21533
+ // Mirror the trigger's clear-button tracking onto the fullscreen bib input
21534
+ // so clearing there also fully resets the combobox (AB#1634257). See
21535
+ // trackClearBtnActivation for why this must run in the capture phase.
21536
+ if (this.inputInBib && this.inputInBib !== this.input) {
21537
+ this.trackClearBtnActivation(this.inputInBib);
21538
+ }
21539
+
21528
21540
  // Pass label text to the dropdown bib for accessible dialog naming
21529
21541
  const labelElement = this.querySelector('[slot="label"]');
21530
21542
  if (labelElement) {
@@ -21910,6 +21922,52 @@ class AuroCombobox extends AuroElement {
21910
21922
  this.clearBtnFocused = false;
21911
21923
  }
21912
21924
  });
21925
+
21926
+ this.trackClearBtnActivation(this.input);
21927
+ }
21928
+
21929
+ /**
21930
+ * Flags genuine clear-button activations on an auro-input so the SPA-preselect
21931
+ * guard in handleInputValueChange doesn't swallow them.
21932
+ *
21933
+ * The auro-input clear button fires an `isProgrammatic` input event (via
21934
+ * notifyValueChanged) that is indistinguishable in shape from the
21935
+ * SPA-preselect echo that guard bails on (isProgrammatic + set value + empty
21936
+ * input). Without this one-shot flag, clicking clear would leave
21937
+ * this.value/optionSelected stale (AB#1634257).
21938
+ *
21939
+ * Delegated on the shadow root so it works regardless of when .clearBtn
21940
+ * renders (it only exists after a value is set), and covers both real clicks
21941
+ * and programmatic clearBtn.click() (which no focusin precedes). Registered in
21942
+ * the CAPTURE phase so the flag is set BEFORE the button's own @click
21943
+ * (handleClickClear) fires its synchronous input event — which is when
21944
+ * handleInputValueChange reads the flag.
21945
+ * @private
21946
+ * @param {Element} inputEl - The auro-input whose clear button to track.
21947
+ * @returns {void}
21948
+ */
21949
+ trackClearBtnActivation(inputEl) {
21950
+ if (!inputEl || !inputEl.shadowRoot) {
21951
+ return;
21952
+ }
21953
+ inputEl.shadowRoot.addEventListener('click', (event) => {
21954
+ if (event.target.closest('.clearBtn')) {
21955
+ this._clearBtnActivated = true;
21956
+
21957
+ // Bound the flag's lifetime to this synchronous clear -> input window.
21958
+ // auro-input's handleClickClear fires its input event synchronously
21959
+ // (before any macrotask runs), so handleInputValueChange consumes the
21960
+ // flag first and this reset is a harmless no-op. It only does real work
21961
+ // if that input event never arrives (e.g. auro-input throws mid-clear),
21962
+ // guaranteeing the flag can't survive to be misread as a genuine clear
21963
+ // by a later unrelated event such as an SPA-preselect echo (AB#1634257).
21964
+ // Scheduled via _scheduleTimer so disconnectedCallback cancels it if the
21965
+ // component tears down inside that window.
21966
+ this._scheduleTimer(() => {
21967
+ this._clearBtnActivated = false;
21968
+ }, 0);
21969
+ }
21970
+ }, true);
21913
21971
  }
21914
21972
 
21915
21973
  /**
@@ -21951,6 +22009,17 @@ class AuroCombobox extends AuroElement {
21951
22009
  * @returns {void}
21952
22010
  */
21953
22011
  handleInputValueChange(event) {
22012
+ // Consume the one-shot clear-button flag on EVERY entry, before any branch
22013
+ // below can early-return. trackClearBtnActivation sets it in the capture
22014
+ // phase right before auro-input's clear button fires its synchronous input
22015
+ // event; reading and immediately clearing it here guarantees the flag never
22016
+ // survives a handleInputValueChange call to leak into a later event (e.g.
22017
+ // the bib branch bailing at _syncingDisplayValue, or an SPA-preselect echo)
22018
+ // where it would defeat the guard below. Held in a local so that guard can
22019
+ // still tell a genuine clear from the init-render echo (AB#1634257).
22020
+ const clearBtnActivated = this._clearBtnActivated;
22021
+ this._clearBtnActivated = false;
22022
+
21954
22023
  // When the event comes from the fullscreen bib input, sync the value to
21955
22024
  // the trigger input. Setting trigger.value triggers Lit's updated()
21956
22025
  // (async, microtask) which fires notifyValueChanged() → another 'input'
@@ -21998,7 +22067,12 @@ class AuroCombobox extends AuroElement {
21998
22067
  // to the exact shape of that echo (isProgrammatic + non-empty combobox
21999
22068
  // value + empty input.value) so it doesn't affect the swap/typed paths
22000
22069
  // where value/input already track each other through the sync helpers.
22001
- if (event && event.isProgrammatic && this.value && !this.input.value) {
22070
+ // The clear button's echo has the same shape (isProgrammatic + set value +
22071
+ // empty input) but is a genuine user clear that MUST reset this.value and
22072
+ // optionSelected below. clearBtnActivated (consumed at the top of this
22073
+ // method) is true only for that genuine clear, so only the real
22074
+ // SPA-preselect echo bails (AB#1634257).
22075
+ if (event && event.isProgrammatic && this.value && !this.input.value && !clearBtnActivated) {
22002
22076
  return;
22003
22077
  }
22004
22078
 
@@ -22143,6 +22217,14 @@ class AuroCombobox extends AuroElement {
22143
22217
  // retry would otherwise keep rescheduling itself indefinitely.
22144
22218
  this._pendingTimers.forEach((id) => clearTimeout(id));
22145
22219
  this._pendingTimers.clear();
22220
+
22221
+ // Cancelling the timers above drops the macrotask that would have reset
22222
+ // _clearBtnActivated, so reset it here too. Otherwise a disconnect inside
22223
+ // the clear-click -> macrotask window strands the flag `true`; instance
22224
+ // state survives reconnect, and the first matching input event (including
22225
+ // an SPA-preselect echo) would then bypass the guard in
22226
+ // handleInputValueChange and silently clear value/optionSelected (AB#1634257).
22227
+ this._clearBtnActivated = false;
22146
22228
  }
22147
22229
 
22148
22230
  firstUpdated() {
@@ -22241,6 +22323,14 @@ class AuroCombobox extends AuroElement {
22241
22323
  }
22242
22324
  if (this.menu.value || this.menu.optionSelected) {
22243
22325
  this.menu.reset();
22326
+ } else {
22327
+ // The menu's selection properties are already cleared, but option
22328
+ // elements can still carry a stale `selected` attribute (e.g. the menu
22329
+ // options were rebuilt after the value was set, orphaning the DOM from
22330
+ // the now-null optionSelected). reset() is skipped above in that case,
22331
+ // so re-sync the option DOM directly to guarantee no option renders as
22332
+ // selected once the field is cleared (AB#1634259).
22333
+ this.menu.clearSelection();
22244
22334
  }
22245
22335
  } finally {
22246
22336
  this._clearing = false;
@@ -23692,6 +23782,22 @@ class AuroMenu extends AuroElement {
23692
23782
  this.value = undefined;
23693
23783
  this._selectedKey = undefined;
23694
23784
  this._index = -1;
23785
+
23786
+ // Eagerly sync the option DOM to the now-empty selection. Nulling the
23787
+ // reactive properties above normally schedules updated() → updateItemsState,
23788
+ // but that only runs when a property actually changes. If an option still
23789
+ // carries a stale `selected`/`aria-selected` attribute while these
23790
+ // properties are already undefined (e.g. options were rebuilt after a value
23791
+ // was set), no re-render fires and the option keeps rendering as selected.
23792
+ // Strip that state now so no option looks selected after a clear (AB#1634259).
23793
+ // Intentionally leaves `active`/`optionActive` untouched so a highlighted
23794
+ // option remains keyboard-re-selectable after emptying the value (AB#1606433).
23795
+ this.updateItemsState(new Map([
23796
+ [
23797
+ 'optionSelected',
23798
+ true
23799
+ ]
23800
+ ]));
23695
23801
  }
23696
23802
 
23697
23803
  /**
@@ -394,6 +394,55 @@ Ensure your `tsconfig.json` uses `"moduleResolution": "bundler"` so TypeScript c
394
394
  <p>Programmatically moves focus to the combobox trigger input.</p>
395
395
  <auro-header level="3" id="reset">reset()</auro-header>
396
396
  <p>Resets the component to its initial state, clearing the value, input text, and validation state.</p>
397
+ <div class="exampleWrapper">
398
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/reset-state.html) -->
399
+ <!-- The below content is automatically added from ./../apiExamples/reset-state.html -->
400
+ <auro-button id="resetStateBtn">Reset</auro-button>
401
+ <br /><br />
402
+ <auro-combobox id="resetStateExample" required>
403
+ <span slot="bib.fullscreen.headline">Bib Header</span>
404
+ <span slot="label">Name</span>
405
+ <auro-menu>
406
+ <auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
407
+ <auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
408
+ <auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
409
+ <auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
410
+ <auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
411
+ <auro-menuoption static nomatch>No matching option</auro-menuoption>
412
+ </auro-menu>
413
+ </auro-combobox>
414
+ <!-- AURO-GENERATED-CONTENT:END -->
415
+ </div>
416
+ <auro-accordion alignRight>
417
+ <span slot="trigger">See code</span>
418
+ <!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/reset-state.html) -->
419
+ <!-- The below code snippet is automatically added from ./../apiExamples/reset-state.html -->
420
+ <pre class="language-html"><code class="language-html">&lt;auro-button id="resetStateBtn"&gt;Reset&lt;/auro-button&gt;
421
+ &lt;br /&gt;&lt;br /&gt;
422
+ &lt;auro-combobox id="resetStateExample" required&gt;
423
+ &lt;span slot="bib.fullscreen.headline"&gt;Bib Header&lt;/span&gt;
424
+ &lt;span slot="label"&gt;Name&lt;/span&gt;
425
+ &lt;auro-menu&gt;
426
+ &lt;auro-menuoption value="Apples" id="option-0"&gt;Apples&lt;/auro-menuoption&gt;
427
+ &lt;auro-menuoption value="Oranges" id="option-1"&gt;Oranges&lt;/auro-menuoption&gt;
428
+ &lt;auro-menuoption value="Peaches" id="option-2"&gt;Peaches&lt;/auro-menuoption&gt;
429
+ &lt;auro-menuoption value="Grapes" id="option-3"&gt;Grapes&lt;/auro-menuoption&gt;
430
+ &lt;auro-menuoption value="Cherries" id="option-4"&gt;Cherries&lt;/auro-menuoption&gt;
431
+ &lt;auro-menuoption static nomatch&gt;No matching option&lt;/auro-menuoption&gt;
432
+ &lt;/auro-menu&gt;
433
+ &lt;/auro-combobox&gt;</code></pre>
434
+ <!-- AURO-GENERATED-CONTENT:END -->
435
+ <!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/reset-state.js) -->
436
+ <!-- The below code snippet is automatically added from ./../apiExamples/reset-state.js -->
437
+ <pre class="language-js"><code class="language-js">export function resetStateExample() {
438
+ const elem = document.querySelector('#resetStateExample');
439
+ ​
440
+ document.querySelector('#resetStateBtn').addEventListener('click', () =&gt; {
441
+ elem.reset();
442
+ });
443
+ }</code></pre>
444
+ <!-- AURO-GENERATED-CONTENT:END -->
445
+ </auro-accordion>
397
446
  <auro-header level="3" id="validate">validate()</auro-header>
398
447
  <p>Triggers validation on the component. Pass <code>true</code> to force validation even when <code>noValidate</code> is set.</p>
399
448
  <auro-header level="3" id="hideBib">hideBib()</auro-header>
@@ -5066,7 +5066,7 @@ let AuroHelpText$2 = class AuroHelpText extends i$3 {
5066
5066
  }
5067
5067
  };
5068
5068
 
5069
- var formkitVersion$2 = '202609010052';
5069
+ var formkitVersion$2 = '202609021726';
5070
5070
 
5071
5071
  /**
5072
5072
  * AuroElement is the shared base class for layout-aware Auro form components.
@@ -18935,7 +18935,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$3 {
18935
18935
  }
18936
18936
  };
18937
18937
 
18938
- var formkitVersion$1 = '202609010052';
18938
+ var formkitVersion$1 = '202609021726';
18939
18939
 
18940
18940
  // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
18941
18941
  // See LICENSE in the project root for license information.
@@ -20127,7 +20127,7 @@ class AuroBibtemplate extends i$3 {
20127
20127
  }
20128
20128
  }
20129
20129
 
20130
- var formkitVersion = '202609010052';
20130
+ var formkitVersion = '202609021726';
20131
20131
 
20132
20132
  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}`;
20133
20133
 
@@ -20568,6 +20568,11 @@ class AuroCombobox extends AuroElement {
20568
20568
  this.behavior = "suggestion";
20569
20569
  this.clearBtnFocused = false;
20570
20570
 
20571
+ // One-shot: set when the input's clear button is activated so the
20572
+ // SPA-preselect guard in handleInputValueChange doesn't swallow the
20573
+ // genuine clear (AB#1634257).
20574
+ this._clearBtnActivated = false;
20575
+
20571
20576
  // Defaults that effect the overall layout of the combobox
20572
20577
  this.checkmark = false;
20573
20578
  this.dvInputOnly = false;
@@ -21525,6 +21530,13 @@ class AuroCombobox extends AuroElement {
21525
21530
  this.bibtemplate = this.dropdown.querySelector(this.bibtemplateTag._$litStatic$);
21526
21531
  this.inputInBib = this.bibtemplate.querySelector(this.inputTag._$litStatic$);
21527
21532
 
21533
+ // Mirror the trigger's clear-button tracking onto the fullscreen bib input
21534
+ // so clearing there also fully resets the combobox (AB#1634257). See
21535
+ // trackClearBtnActivation for why this must run in the capture phase.
21536
+ if (this.inputInBib && this.inputInBib !== this.input) {
21537
+ this.trackClearBtnActivation(this.inputInBib);
21538
+ }
21539
+
21528
21540
  // Pass label text to the dropdown bib for accessible dialog naming
21529
21541
  const labelElement = this.querySelector('[slot="label"]');
21530
21542
  if (labelElement) {
@@ -21910,6 +21922,52 @@ class AuroCombobox extends AuroElement {
21910
21922
  this.clearBtnFocused = false;
21911
21923
  }
21912
21924
  });
21925
+
21926
+ this.trackClearBtnActivation(this.input);
21927
+ }
21928
+
21929
+ /**
21930
+ * Flags genuine clear-button activations on an auro-input so the SPA-preselect
21931
+ * guard in handleInputValueChange doesn't swallow them.
21932
+ *
21933
+ * The auro-input clear button fires an `isProgrammatic` input event (via
21934
+ * notifyValueChanged) that is indistinguishable in shape from the
21935
+ * SPA-preselect echo that guard bails on (isProgrammatic + set value + empty
21936
+ * input). Without this one-shot flag, clicking clear would leave
21937
+ * this.value/optionSelected stale (AB#1634257).
21938
+ *
21939
+ * Delegated on the shadow root so it works regardless of when .clearBtn
21940
+ * renders (it only exists after a value is set), and covers both real clicks
21941
+ * and programmatic clearBtn.click() (which no focusin precedes). Registered in
21942
+ * the CAPTURE phase so the flag is set BEFORE the button's own @click
21943
+ * (handleClickClear) fires its synchronous input event — which is when
21944
+ * handleInputValueChange reads the flag.
21945
+ * @private
21946
+ * @param {Element} inputEl - The auro-input whose clear button to track.
21947
+ * @returns {void}
21948
+ */
21949
+ trackClearBtnActivation(inputEl) {
21950
+ if (!inputEl || !inputEl.shadowRoot) {
21951
+ return;
21952
+ }
21953
+ inputEl.shadowRoot.addEventListener('click', (event) => {
21954
+ if (event.target.closest('.clearBtn')) {
21955
+ this._clearBtnActivated = true;
21956
+
21957
+ // Bound the flag's lifetime to this synchronous clear -> input window.
21958
+ // auro-input's handleClickClear fires its input event synchronously
21959
+ // (before any macrotask runs), so handleInputValueChange consumes the
21960
+ // flag first and this reset is a harmless no-op. It only does real work
21961
+ // if that input event never arrives (e.g. auro-input throws mid-clear),
21962
+ // guaranteeing the flag can't survive to be misread as a genuine clear
21963
+ // by a later unrelated event such as an SPA-preselect echo (AB#1634257).
21964
+ // Scheduled via _scheduleTimer so disconnectedCallback cancels it if the
21965
+ // component tears down inside that window.
21966
+ this._scheduleTimer(() => {
21967
+ this._clearBtnActivated = false;
21968
+ }, 0);
21969
+ }
21970
+ }, true);
21913
21971
  }
21914
21972
 
21915
21973
  /**
@@ -21951,6 +22009,17 @@ class AuroCombobox extends AuroElement {
21951
22009
  * @returns {void}
21952
22010
  */
21953
22011
  handleInputValueChange(event) {
22012
+ // Consume the one-shot clear-button flag on EVERY entry, before any branch
22013
+ // below can early-return. trackClearBtnActivation sets it in the capture
22014
+ // phase right before auro-input's clear button fires its synchronous input
22015
+ // event; reading and immediately clearing it here guarantees the flag never
22016
+ // survives a handleInputValueChange call to leak into a later event (e.g.
22017
+ // the bib branch bailing at _syncingDisplayValue, or an SPA-preselect echo)
22018
+ // where it would defeat the guard below. Held in a local so that guard can
22019
+ // still tell a genuine clear from the init-render echo (AB#1634257).
22020
+ const clearBtnActivated = this._clearBtnActivated;
22021
+ this._clearBtnActivated = false;
22022
+
21954
22023
  // When the event comes from the fullscreen bib input, sync the value to
21955
22024
  // the trigger input. Setting trigger.value triggers Lit's updated()
21956
22025
  // (async, microtask) which fires notifyValueChanged() → another 'input'
@@ -21998,7 +22067,12 @@ class AuroCombobox extends AuroElement {
21998
22067
  // to the exact shape of that echo (isProgrammatic + non-empty combobox
21999
22068
  // value + empty input.value) so it doesn't affect the swap/typed paths
22000
22069
  // where value/input already track each other through the sync helpers.
22001
- if (event && event.isProgrammatic && this.value && !this.input.value) {
22070
+ // The clear button's echo has the same shape (isProgrammatic + set value +
22071
+ // empty input) but is a genuine user clear that MUST reset this.value and
22072
+ // optionSelected below. clearBtnActivated (consumed at the top of this
22073
+ // method) is true only for that genuine clear, so only the real
22074
+ // SPA-preselect echo bails (AB#1634257).
22075
+ if (event && event.isProgrammatic && this.value && !this.input.value && !clearBtnActivated) {
22002
22076
  return;
22003
22077
  }
22004
22078
 
@@ -22143,6 +22217,14 @@ class AuroCombobox extends AuroElement {
22143
22217
  // retry would otherwise keep rescheduling itself indefinitely.
22144
22218
  this._pendingTimers.forEach((id) => clearTimeout(id));
22145
22219
  this._pendingTimers.clear();
22220
+
22221
+ // Cancelling the timers above drops the macrotask that would have reset
22222
+ // _clearBtnActivated, so reset it here too. Otherwise a disconnect inside
22223
+ // the clear-click -> macrotask window strands the flag `true`; instance
22224
+ // state survives reconnect, and the first matching input event (including
22225
+ // an SPA-preselect echo) would then bypass the guard in
22226
+ // handleInputValueChange and silently clear value/optionSelected (AB#1634257).
22227
+ this._clearBtnActivated = false;
22146
22228
  }
22147
22229
 
22148
22230
  firstUpdated() {
@@ -22241,6 +22323,14 @@ class AuroCombobox extends AuroElement {
22241
22323
  }
22242
22324
  if (this.menu.value || this.menu.optionSelected) {
22243
22325
  this.menu.reset();
22326
+ } else {
22327
+ // The menu's selection properties are already cleared, but option
22328
+ // elements can still carry a stale `selected` attribute (e.g. the menu
22329
+ // options were rebuilt after the value was set, orphaning the DOM from
22330
+ // the now-null optionSelected). reset() is skipped above in that case,
22331
+ // so re-sync the option DOM directly to guarantee no option renders as
22332
+ // selected once the field is cleared (AB#1634259).
22333
+ this.menu.clearSelection();
22244
22334
  }
22245
22335
  } finally {
22246
22336
  this._clearing = false;
@@ -23692,6 +23782,22 @@ class AuroMenu extends AuroElement {
23692
23782
  this.value = undefined;
23693
23783
  this._selectedKey = undefined;
23694
23784
  this._index = -1;
23785
+
23786
+ // Eagerly sync the option DOM to the now-empty selection. Nulling the
23787
+ // reactive properties above normally schedules updated() → updateItemsState,
23788
+ // but that only runs when a property actually changes. If an option still
23789
+ // carries a stale `selected`/`aria-selected` attribute while these
23790
+ // properties are already undefined (e.g. options were rebuilt after a value
23791
+ // was set), no re-render fires and the option keeps rendering as selected.
23792
+ // Strip that state now so no option looks selected after a clear (AB#1634259).
23793
+ // Intentionally leaves `active`/`optionActive` untouched so a highlighted
23794
+ // option remains keyboard-re-selectable after emptying the value (AB#1606433).
23795
+ this.updateItemsState(new Map([
23796
+ [
23797
+ 'optionSelected',
23798
+ true
23799
+ ]
23800
+ ]));
23695
23801
  }
23696
23802
 
23697
23803
  /**
@@ -24487,6 +24593,14 @@ class AuroMenuOption extends AuroElement {
24487
24593
  AuroMenu.register();
24488
24594
  AuroMenuOption.register();
24489
24595
 
24596
+ function resetStateExample() {
24597
+ const elem = document.querySelector('#resetStateExample');
24598
+
24599
+ document.querySelector('#resetStateBtn').addEventListener('click', () => {
24600
+ elem.reset();
24601
+ });
24602
+ }
24603
+
24490
24604
  /* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */
24491
24605
 
24492
24606
 
@@ -24494,6 +24608,17 @@ AuroCombobox.register();
24494
24608
  AuroCombobox.register('custom-combobox');
24495
24609
 
24496
24610
  function initExamples(initCount) {
24611
+ initCount = initCount || 0;
24612
+
24613
+ try {
24614
+ resetStateExample();
24615
+ } catch (err) {
24616
+ if (initCount <= 20) {
24617
+ setTimeout(() => {
24618
+ initExamples(initCount + 1);
24619
+ }, 100);
24620
+ }
24621
+ }
24497
24622
  }
24498
24623
 
24499
24624
  export { initExamples };