@aurodesignsystem-dev/auro-formkit 0.0.0-pr624.30 → 0.0.0-pr624.32

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.
@@ -40,7 +40,7 @@
40
40
  | Method | Type | Description |
41
41
  |------------|----------------------------------------|--------------------------------------------------|
42
42
  | [focus](#focus) | `(): void` | Focuses the combobox trigger input. |
43
- | [isValid](#isValid) | `(): boolean` | |
43
+ | [isValid](#isValid) | `(): boolean` | Checks if the element is valid. |
44
44
  | [reset](#reset) | `(): void` | Resets component to initial state. |
45
45
  | [validate](#validate) | `(force?: boolean \| undefined): void` | Validates value.<br /><br />**force**: Whether to force validation. |
46
46
 
@@ -15984,7 +15984,6 @@ class AuroCombobox extends AuroElement$1 {
15984
15984
 
15985
15985
  /**
15986
15986
  * Value selected for the dropdown menu.
15987
- * @type {string}
15988
15987
  */
15989
15988
  value: {
15990
15989
  type: String
@@ -16034,6 +16033,10 @@ class AuroCombobox extends AuroElement$1 {
16034
16033
  ];
16035
16034
  }
16036
16035
 
16036
+ /**
16037
+ * Checks if the element is valid.
16038
+ * @returns {boolean} - Returns true if the element is valid, false otherwise.
16039
+ */
16037
16040
  isValid() {
16038
16041
  let valid = true;
16039
16042
 
@@ -16057,87 +16060,95 @@ class AuroCombobox extends AuroElement$1 {
16057
16060
  }
16058
16061
 
16059
16062
  /**
16060
- * Processes hidden state of all menu options and determines if there are any available options not hidden.
16063
+ * Updates the filter for the available options based on the input value.
16061
16064
  * @private
16062
- * @returns {void}
16063
16065
  */
16064
- handleMenuOptions() {
16065
- // Reset menu matchword UI
16066
- this.menu.updateItemsState(new Map([
16067
- [
16068
- 'matchWord',
16069
- true
16070
- ]
16071
- ]));
16066
+ updateFilter() {
16072
16067
 
16073
- this.generateOptionsArray();
16074
- this.availableOptions = [];
16068
+ // Reset available options if noFilter is set to false after being true.
16069
+ if (this.noFilter) {
16070
+ this.availableOptions = [...this.options];
16071
+ return;
16072
+ }
16075
16073
 
16076
- if (this.menu.optionSelected) {
16077
- // Get first option since combobox is single-select
16078
- const selected = this.menu.optionSelected;
16074
+ this.noMatchOption = undefined;
16079
16075
 
16080
- if (!this.optionSelected || this.optionSelected !== selected) {
16081
- this.optionSelected = selected;
16082
- }
16076
+ this.options.forEach((option) => {
16077
+ let matchString = option.textContent.toLowerCase();
16083
16078
 
16084
- if (!this.value || this.value !== selected.value) {
16085
- this.value = selected.value;
16079
+ if (option.hasAttribute('nomatch')) {
16080
+ this.noMatchOption = option;
16081
+ }
16086
16082
 
16087
- this.menu.value = this.value;
16083
+ if (option.hasAttribute('persistent')) {
16084
+ this.availableOptions.push(option);
16088
16085
  }
16089
16086
 
16090
- if (this.input.value !== selected.textContent) {
16091
- this.input.value = selected.textContent;
16087
+ if (option.hasAttribute('suggest')) {
16088
+ matchString = `${matchString} ${option.getAttribute('suggest')}`.toLowerCase();
16092
16089
  }
16093
16090
 
16094
- if (this.menu.matchWord !== this.input.value) {
16095
- this.menu.matchWord = this.input.value;
16091
+ // only count options that match the typed input value AND are not currently selected AND are not static
16092
+ if (this.input.value && matchString.includes(this.input.value.toLowerCase()) && !option.hasAttribute('static')) {
16093
+ option.removeAttribute('hidden');
16094
+ this.availableOptions.push(option);
16095
+ } else if (!option.hasAttribute('persistent')) {
16096
+ // Hide all other non-persistent options
16097
+ option.setAttribute('hidden', '');
16096
16098
  }
16099
+ });
16097
16100
 
16098
- this.classList.add('combobox-filled');
16101
+ if (this.availableOptions.length === 0) {
16102
+ if (this.noMatchOption) {
16103
+ this.noMatchOption.removeAttribute('hidden');
16104
+ } else {
16105
+ this.hideBib();
16106
+ }
16107
+ } else if (this.noMatchOption) {
16108
+ this.noMatchOption.setAttribute('hidden', '');
16099
16109
  }
16110
+ }
16100
16111
 
16101
- if (this.noFilter) {
16102
- this.availableOptions = [...this.options];
16103
- } else {
16104
- this.noMatchOption = undefined;
16105
-
16106
- this.options.forEach((option) => {
16107
- let matchString = option.textContent.toLowerCase();
16112
+ /**
16113
+ * Syncs the values and states of this component, the input, and the menu, including this.optionSelected and this.menu.optionSelected.
16114
+ * @private
16115
+ * @returns {void}
16116
+ */
16117
+ async syncValuesAndStates() {
16108
16118
 
16109
- if (option.hasAttribute('nomatch')) {
16110
- this.noMatchOption = option;
16111
- }
16119
+ // Sync values
16120
+ this.menu.value = this.value;
16121
+ this.menu.matchWord = this.value;
16122
+ this.input.value = this.value;
16112
16123
 
16113
- if (option.hasAttribute('persistent')) {
16114
- this.availableOptions.push(option);
16115
- }
16124
+ // Wait a lifecycle for child components to update
16125
+ await Promise.all([this.menu.updateComplete]);
16126
+ }
16116
16127
 
16117
- if (option.hasAttribute('suggest')) {
16118
- matchString = `${matchString} ${option.getAttribute('suggest')}`.toLowerCase();
16119
- }
16128
+ /**
16129
+ * Resets the menu matchWord to true.
16130
+ * @private
16131
+ */
16132
+ resetMenuMatchword() {
16133
+ this.menu.updateItemsState(new Map([
16134
+ [
16135
+ 'matchWord',
16136
+ true
16137
+ ]
16138
+ ]));
16139
+ };
16120
16140
 
16121
- // only count options that match the typed input value AND are not currently selected AND are not static
16122
- if (this.input.value && matchString.includes(this.input.value.toLowerCase()) && !option.hasAttribute('static')) {
16123
- option.removeAttribute('hidden');
16124
- this.availableOptions.push(option);
16125
- } else if (!option.hasAttribute('persistent')) {
16126
- // Hide all other non-persistent options
16127
- option.setAttribute('hidden', '');
16128
- }
16129
- });
16141
+ /**
16142
+ * Processes hidden state of all menu options and determines if there are any available options not hidden.
16143
+ * @private
16144
+ * @returns {void}
16145
+ */
16146
+ handleMenuOptions() {
16130
16147
 
16131
- if (this.availableOptions.length === 0) {
16132
- if (this.noMatchOption) {
16133
- this.noMatchOption.removeAttribute('hidden');
16134
- } else {
16135
- this.hideBib();
16136
- }
16137
- } else if (this.noMatchOption) {
16138
- this.noMatchOption.setAttribute('hidden', '');
16139
- }
16140
- }
16148
+ this.resetMenuMatchword();
16149
+ this.generateOptionsArray();
16150
+ this.availableOptions = [];
16151
+ this.updateFilter();
16141
16152
  }
16142
16153
 
16143
16154
  /**
@@ -16295,8 +16306,6 @@ class AuroCombobox extends AuroElement$1 {
16295
16306
  this.menu.matchWord = this.input.value;
16296
16307
  }
16297
16308
 
16298
- this.classList.add('combobox-filled');
16299
-
16300
16309
  // update the hidden state of options based on newly selected value
16301
16310
  this.handleMenuOptions();
16302
16311
 
@@ -16437,9 +16446,6 @@ class AuroCombobox extends AuroElement$1 {
16437
16446
  // Hide menu if value is empty, otherwise show if there are available suggestions
16438
16447
  if (this.input.value && this.input.value.length === 0) {
16439
16448
  this.hideBib();
16440
- this.classList.remove('combobox-filled');
16441
- } else if (!this.dropdown.isPopoverVisible && this.availableOptions) {
16442
- this.classList.add('combobox-filled');
16443
16449
  }
16444
16450
 
16445
16451
  // Force dropdown bib to hide if input value has no matching suggestions
@@ -16497,7 +16503,6 @@ class AuroCombobox extends AuroElement$1 {
16497
16503
  * @private
16498
16504
  * @returns {void}
16499
16505
  */
16500
-
16501
16506
  performUpdate() {
16502
16507
  super.performUpdate();
16503
16508
 
@@ -16556,30 +16561,18 @@ class AuroCombobox extends AuroElement$1 {
16556
16561
  this.validation.validate(this, force);
16557
16562
  }
16558
16563
 
16559
- updated(changedProperties) {
16564
+ async updated(changedProperties) {
16560
16565
  // After the component is ready, send direct value changes to auro-menu.
16561
- if (changedProperties.has('value')) {
16562
- if (this.value) {
16563
- if (this.optionSelected && this.optionSelected.value === this.value) {
16564
- // If value updates and the previously selected option already matches the new value
16565
- // just update the input value to use the textContent of the optionSelected
16566
- this.input.value = this.optionSelected.textContent;
16567
- } else {
16568
- // Otherwise just enter the value into the input
16569
- this.optionSelected = undefined;
16570
-
16571
- const inputValue = this.value;
16572
- this.input.value = inputValue;
16566
+ if (changedProperties.has('value') && this.value !== changedProperties.get('value')) {
16573
16567
 
16574
- // Update the menu value and matchWord
16575
- this.menu.matchWord = inputValue;
16576
- this.handleMenuOptions();
16568
+ // Sync the input, menu, and optionSelected states
16569
+ await this.syncValuesAndStates();
16577
16570
 
16578
- // If the value got set programmatically make sure we hide the bib
16579
- // when input is not taking the focus (input can be in dropdown.trigger or in bibtemplate)
16580
- if (!this.contains(document.activeElement) && !this.bibtemplate.contains(document.activeElement)) {
16581
- this.hideBib();
16582
- }
16571
+ if (this.value) {
16572
+ // If the value got set programmatically make sure we hide the bib
16573
+ // when input is not taking the focus (input can be in dropdown.trigger or in bibtemplate)
16574
+ if (!this.contains(document.activeElement) && !this.bibtemplate.contains(document.activeElement)) {
16575
+ this.hideBib();
16583
16576
  }
16584
16577
  } else {
16585
16578
  this.reset();
@@ -15842,7 +15842,6 @@ class AuroCombobox extends AuroElement$1 {
15842
15842
 
15843
15843
  /**
15844
15844
  * Value selected for the dropdown menu.
15845
- * @type {string}
15846
15845
  */
15847
15846
  value: {
15848
15847
  type: String
@@ -15892,6 +15891,10 @@ class AuroCombobox extends AuroElement$1 {
15892
15891
  ];
15893
15892
  }
15894
15893
 
15894
+ /**
15895
+ * Checks if the element is valid.
15896
+ * @returns {boolean} - Returns true if the element is valid, false otherwise.
15897
+ */
15895
15898
  isValid() {
15896
15899
  let valid = true;
15897
15900
 
@@ -15915,87 +15918,95 @@ class AuroCombobox extends AuroElement$1 {
15915
15918
  }
15916
15919
 
15917
15920
  /**
15918
- * Processes hidden state of all menu options and determines if there are any available options not hidden.
15921
+ * Updates the filter for the available options based on the input value.
15919
15922
  * @private
15920
- * @returns {void}
15921
15923
  */
15922
- handleMenuOptions() {
15923
- // Reset menu matchword UI
15924
- this.menu.updateItemsState(new Map([
15925
- [
15926
- 'matchWord',
15927
- true
15928
- ]
15929
- ]));
15924
+ updateFilter() {
15930
15925
 
15931
- this.generateOptionsArray();
15932
- this.availableOptions = [];
15926
+ // Reset available options if noFilter is set to false after being true.
15927
+ if (this.noFilter) {
15928
+ this.availableOptions = [...this.options];
15929
+ return;
15930
+ }
15933
15931
 
15934
- if (this.menu.optionSelected) {
15935
- // Get first option since combobox is single-select
15936
- const selected = this.menu.optionSelected;
15932
+ this.noMatchOption = undefined;
15937
15933
 
15938
- if (!this.optionSelected || this.optionSelected !== selected) {
15939
- this.optionSelected = selected;
15940
- }
15934
+ this.options.forEach((option) => {
15935
+ let matchString = option.textContent.toLowerCase();
15941
15936
 
15942
- if (!this.value || this.value !== selected.value) {
15943
- this.value = selected.value;
15937
+ if (option.hasAttribute('nomatch')) {
15938
+ this.noMatchOption = option;
15939
+ }
15944
15940
 
15945
- this.menu.value = this.value;
15941
+ if (option.hasAttribute('persistent')) {
15942
+ this.availableOptions.push(option);
15946
15943
  }
15947
15944
 
15948
- if (this.input.value !== selected.textContent) {
15949
- this.input.value = selected.textContent;
15945
+ if (option.hasAttribute('suggest')) {
15946
+ matchString = `${matchString} ${option.getAttribute('suggest')}`.toLowerCase();
15950
15947
  }
15951
15948
 
15952
- if (this.menu.matchWord !== this.input.value) {
15953
- this.menu.matchWord = this.input.value;
15949
+ // only count options that match the typed input value AND are not currently selected AND are not static
15950
+ if (this.input.value && matchString.includes(this.input.value.toLowerCase()) && !option.hasAttribute('static')) {
15951
+ option.removeAttribute('hidden');
15952
+ this.availableOptions.push(option);
15953
+ } else if (!option.hasAttribute('persistent')) {
15954
+ // Hide all other non-persistent options
15955
+ option.setAttribute('hidden', '');
15954
15956
  }
15957
+ });
15955
15958
 
15956
- this.classList.add('combobox-filled');
15959
+ if (this.availableOptions.length === 0) {
15960
+ if (this.noMatchOption) {
15961
+ this.noMatchOption.removeAttribute('hidden');
15962
+ } else {
15963
+ this.hideBib();
15964
+ }
15965
+ } else if (this.noMatchOption) {
15966
+ this.noMatchOption.setAttribute('hidden', '');
15957
15967
  }
15968
+ }
15958
15969
 
15959
- if (this.noFilter) {
15960
- this.availableOptions = [...this.options];
15961
- } else {
15962
- this.noMatchOption = undefined;
15963
-
15964
- this.options.forEach((option) => {
15965
- let matchString = option.textContent.toLowerCase();
15970
+ /**
15971
+ * Syncs the values and states of this component, the input, and the menu, including this.optionSelected and this.menu.optionSelected.
15972
+ * @private
15973
+ * @returns {void}
15974
+ */
15975
+ async syncValuesAndStates() {
15966
15976
 
15967
- if (option.hasAttribute('nomatch')) {
15968
- this.noMatchOption = option;
15969
- }
15977
+ // Sync values
15978
+ this.menu.value = this.value;
15979
+ this.menu.matchWord = this.value;
15980
+ this.input.value = this.value;
15970
15981
 
15971
- if (option.hasAttribute('persistent')) {
15972
- this.availableOptions.push(option);
15973
- }
15982
+ // Wait a lifecycle for child components to update
15983
+ await Promise.all([this.menu.updateComplete]);
15984
+ }
15974
15985
 
15975
- if (option.hasAttribute('suggest')) {
15976
- matchString = `${matchString} ${option.getAttribute('suggest')}`.toLowerCase();
15977
- }
15986
+ /**
15987
+ * Resets the menu matchWord to true.
15988
+ * @private
15989
+ */
15990
+ resetMenuMatchword() {
15991
+ this.menu.updateItemsState(new Map([
15992
+ [
15993
+ 'matchWord',
15994
+ true
15995
+ ]
15996
+ ]));
15997
+ };
15978
15998
 
15979
- // only count options that match the typed input value AND are not currently selected AND are not static
15980
- if (this.input.value && matchString.includes(this.input.value.toLowerCase()) && !option.hasAttribute('static')) {
15981
- option.removeAttribute('hidden');
15982
- this.availableOptions.push(option);
15983
- } else if (!option.hasAttribute('persistent')) {
15984
- // Hide all other non-persistent options
15985
- option.setAttribute('hidden', '');
15986
- }
15987
- });
15999
+ /**
16000
+ * Processes hidden state of all menu options and determines if there are any available options not hidden.
16001
+ * @private
16002
+ * @returns {void}
16003
+ */
16004
+ handleMenuOptions() {
15988
16005
 
15989
- if (this.availableOptions.length === 0) {
15990
- if (this.noMatchOption) {
15991
- this.noMatchOption.removeAttribute('hidden');
15992
- } else {
15993
- this.hideBib();
15994
- }
15995
- } else if (this.noMatchOption) {
15996
- this.noMatchOption.setAttribute('hidden', '');
15997
- }
15998
- }
16006
+ this.resetMenuMatchword();
16007
+ this.generateOptionsArray();
16008
+ this.availableOptions = [];
16009
+ this.updateFilter();
15999
16010
  }
16000
16011
 
16001
16012
  /**
@@ -16153,8 +16164,6 @@ class AuroCombobox extends AuroElement$1 {
16153
16164
  this.menu.matchWord = this.input.value;
16154
16165
  }
16155
16166
 
16156
- this.classList.add('combobox-filled');
16157
-
16158
16167
  // update the hidden state of options based on newly selected value
16159
16168
  this.handleMenuOptions();
16160
16169
 
@@ -16295,9 +16304,6 @@ class AuroCombobox extends AuroElement$1 {
16295
16304
  // Hide menu if value is empty, otherwise show if there are available suggestions
16296
16305
  if (this.input.value && this.input.value.length === 0) {
16297
16306
  this.hideBib();
16298
- this.classList.remove('combobox-filled');
16299
- } else if (!this.dropdown.isPopoverVisible && this.availableOptions) {
16300
- this.classList.add('combobox-filled');
16301
16307
  }
16302
16308
 
16303
16309
  // Force dropdown bib to hide if input value has no matching suggestions
@@ -16355,7 +16361,6 @@ class AuroCombobox extends AuroElement$1 {
16355
16361
  * @private
16356
16362
  * @returns {void}
16357
16363
  */
16358
-
16359
16364
  performUpdate() {
16360
16365
  super.performUpdate();
16361
16366
 
@@ -16414,30 +16419,18 @@ class AuroCombobox extends AuroElement$1 {
16414
16419
  this.validation.validate(this, force);
16415
16420
  }
16416
16421
 
16417
- updated(changedProperties) {
16422
+ async updated(changedProperties) {
16418
16423
  // After the component is ready, send direct value changes to auro-menu.
16419
- if (changedProperties.has('value')) {
16420
- if (this.value) {
16421
- if (this.optionSelected && this.optionSelected.value === this.value) {
16422
- // If value updates and the previously selected option already matches the new value
16423
- // just update the input value to use the textContent of the optionSelected
16424
- this.input.value = this.optionSelected.textContent;
16425
- } else {
16426
- // Otherwise just enter the value into the input
16427
- this.optionSelected = undefined;
16428
-
16429
- const inputValue = this.value;
16430
- this.input.value = inputValue;
16424
+ if (changedProperties.has('value') && this.value !== changedProperties.get('value')) {
16431
16425
 
16432
- // Update the menu value and matchWord
16433
- this.menu.matchWord = inputValue;
16434
- this.handleMenuOptions();
16426
+ // Sync the input, menu, and optionSelected states
16427
+ await this.syncValuesAndStates();
16435
16428
 
16436
- // If the value got set programmatically make sure we hide the bib
16437
- // when input is not taking the focus (input can be in dropdown.trigger or in bibtemplate)
16438
- if (!this.contains(document.activeElement) && !this.bibtemplate.contains(document.activeElement)) {
16439
- this.hideBib();
16440
- }
16429
+ if (this.value) {
16430
+ // If the value got set programmatically make sure we hide the bib
16431
+ // when input is not taking the focus (input can be in dropdown.trigger or in bibtemplate)
16432
+ if (!this.contains(document.activeElement) && !this.bibtemplate.contains(document.activeElement)) {
16433
+ this.hideBib();
16441
16434
  }
16442
16435
  } else {
16443
16436
  this.reset();
@@ -195,9 +195,10 @@ export class AuroCombobox extends AuroElement {
195
195
  };
196
196
  /**
197
197
  * Value selected for the dropdown menu.
198
- * @type {string}
199
198
  */
200
- value: string;
199
+ value: {
200
+ type: StringConstructor;
201
+ };
201
202
  /**
202
203
  * If declared, make bib.fullscreen.headline in HeadingDisplay.
203
204
  * Otherwise, Heading 600
@@ -275,14 +276,34 @@ export class AuroCombobox extends AuroElement {
275
276
  bibtemplateTag: any;
276
277
  inputTag: any;
277
278
  helpTextTag: any;
279
+ /**
280
+ * Checks if the element is valid.
281
+ * @returns {boolean} - Returns true if the element is valid, false otherwise.
282
+ */
278
283
  isValid(): boolean;
284
+ /**
285
+ * Updates the filter for the available options based on the input value.
286
+ * @private
287
+ */
288
+ private updateFilter;
289
+ noMatchOption: any;
290
+ /**
291
+ * Syncs the values and states of this component, the input, and the menu, including this.optionSelected and this.menu.optionSelected.
292
+ * @private
293
+ * @returns {void}
294
+ */
295
+ private syncValuesAndStates;
296
+ /**
297
+ * Resets the menu matchWord to true.
298
+ * @private
299
+ */
300
+ private resetMenuMatchword;
279
301
  /**
280
302
  * Processes hidden state of all menu options and determines if there are any available options not hidden.
281
303
  * @private
282
304
  * @returns {void}
283
305
  */
284
306
  private handleMenuOptions;
285
- noMatchOption: any;
286
307
  /**
287
308
  * Determines the element error state based on the `required` attribute and input value.
288
309
  * @private
@@ -374,7 +395,7 @@ export class AuroCombobox extends AuroElement {
374
395
  * @param {boolean} [force=false] - Whether to force validation.
375
396
  */
376
397
  validate(force?: boolean): void;
377
- updated(changedProperties: any): void;
398
+ updated(changedProperties: any): Promise<void>;
378
399
  /**
379
400
  * Applies slotted nodes to a target element with a new slot name.
380
401
  * @private