@aurodesignsystem/auro-formkit 3.3.0-beta.2 → 3.3.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 (60) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/components/checkbox/README.md +1 -1
  3. package/components/checkbox/demo/api.md +1 -0
  4. package/components/checkbox/demo/api.min.js +34 -5
  5. package/components/checkbox/demo/index.min.js +34 -5
  6. package/components/checkbox/demo/readme.md +1 -1
  7. package/components/checkbox/dist/auro-checkbox-group.d.ts +7 -0
  8. package/components/checkbox/dist/auro-checkbox.d.ts +6 -0
  9. package/components/checkbox/dist/index.js +34 -5
  10. package/components/checkbox/dist/registered.js +34 -5
  11. package/components/combobox/README.md +1 -1
  12. package/components/combobox/demo/api.min.js +77 -57
  13. package/components/combobox/demo/index.min.js +77 -57
  14. package/components/combobox/demo/readme.md +1 -1
  15. package/components/combobox/dist/auro-combobox.d.ts +2 -10
  16. package/components/combobox/dist/index.js +77 -57
  17. package/components/combobox/dist/registered.js +77 -57
  18. package/components/counter/README.md +1 -1
  19. package/components/counter/demo/api.min.js +12 -5
  20. package/components/counter/demo/index.min.js +12 -5
  21. package/components/counter/demo/readme.md +1 -1
  22. package/components/counter/dist/index.js +12 -5
  23. package/components/counter/dist/registered.js +12 -5
  24. package/components/datepicker/README.md +1 -1
  25. package/components/datepicker/demo/api.min.js +54 -34
  26. package/components/datepicker/demo/index.min.js +54 -34
  27. package/components/datepicker/demo/readme.md +1 -1
  28. package/components/datepicker/dist/auro-datepicker.d.ts +8 -0
  29. package/components/datepicker/dist/index.js +54 -34
  30. package/components/datepicker/dist/registered.js +54 -34
  31. package/components/dropdown/README.md +1 -1
  32. package/components/dropdown/demo/readme.md +1 -1
  33. package/components/form/README.md +1 -1
  34. package/components/form/demo/readme.md +1 -1
  35. package/components/input/README.md +1 -1
  36. package/components/input/demo/api.min.js +26 -14
  37. package/components/input/demo/index.min.js +26 -14
  38. package/components/input/demo/readme.md +1 -1
  39. package/components/input/dist/base-input.d.ts +8 -0
  40. package/components/input/dist/index.js +26 -14
  41. package/components/input/dist/registered.js +26 -14
  42. package/components/menu/README.md +1 -1
  43. package/components/menu/demo/readme.md +1 -1
  44. package/components/radio/README.md +1 -1
  45. package/components/radio/demo/api.md +1 -0
  46. package/components/radio/demo/api.min.js +33 -9
  47. package/components/radio/demo/index.min.js +33 -9
  48. package/components/radio/demo/readme.md +1 -1
  49. package/components/radio/dist/auro-radio-group.d.ts +8 -0
  50. package/components/radio/dist/auro-radio.d.ts +5 -0
  51. package/components/radio/dist/index.js +33 -9
  52. package/components/radio/dist/registered.js +33 -9
  53. package/components/select/README.md +1 -1
  54. package/components/select/demo/api.min.js +25 -15
  55. package/components/select/demo/index.min.js +25 -15
  56. package/components/select/demo/readme.md +1 -1
  57. package/components/select/dist/auro-select.d.ts +8 -0
  58. package/components/select/dist/index.js +25 -15
  59. package/components/select/dist/registered.js +25 -15
  60. package/package.json +1 -1
@@ -733,6 +733,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
733
733
  reset(elem) {
734
734
  elem.validity = undefined;
735
735
  elem.value = undefined;
736
+ elem.touched = false;
736
737
 
737
738
  // Resets the second value of the datepicker in range state
738
739
  if (elem.valueEnd) {
@@ -870,7 +871,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
870
871
  } else if (elem.type === 'date' && elem.value?.length > 0) {
871
872
 
872
873
  // Guard Clause: if the value is too short
873
- if (elem.value.length < elem.lengthForType) {
874
+ if (elem.value?.length < elem.lengthForType) {
874
875
 
875
876
  elem.validity = 'tooShort';
876
877
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -940,11 +941,17 @@ let AuroFormValidation$1 = class AuroFormValidation {
940
941
  this.getAuroInputs(elem);
941
942
 
942
943
  // Validate only if noValidate is not true and the input does not have focus
943
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
944
+ let validationShouldRun =
945
+ force ||
946
+ (!elem.contains(document.activeElement) &&
947
+ (elem.touched ||
948
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
949
+ elem.validateOnInput;
944
950
 
945
951
  if (elem.hasAttribute('error')) {
946
952
  elem.validity = 'customError';
947
953
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
954
+ validationShouldRun = false;
948
955
  } else if (validationShouldRun) {
949
956
  elem.validity = 'valid';
950
957
  elem.errorMessage = '';
@@ -965,7 +972,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
965
972
  }
966
973
  }
967
974
 
968
- if (!hasValue && elem.required) {
975
+ if (!hasValue && elem.required && elem.touched) {
969
976
  elem.validity = 'valueMissing';
970
977
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
971
978
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -976,7 +983,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
976
983
  }
977
984
  }
978
985
 
979
- if (this.auroInputElements?.length > 0) {
986
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
980
987
  elem.validity = this.auroInputElements[0].validity;
981
988
  elem.errorMessage = this.auroInputElements[0].errorMessage;
982
989
 
@@ -1055,7 +1062,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
1055
1062
  }
1056
1063
  }
1057
1064
  } else {
1058
- elem.errorMessage = undefined;
1065
+ elem.errorMessage = '';
1059
1066
  }
1060
1067
  }
1061
1068
  };
@@ -9288,6 +9295,7 @@ class AuroFormValidation {
9288
9295
  reset(elem) {
9289
9296
  elem.validity = undefined;
9290
9297
  elem.value = undefined;
9298
+ elem.touched = false;
9291
9299
 
9292
9300
  // Resets the second value of the datepicker in range state
9293
9301
  if (elem.valueEnd) {
@@ -9425,7 +9433,7 @@ class AuroFormValidation {
9425
9433
  } else if (elem.type === 'date' && elem.value?.length > 0) {
9426
9434
 
9427
9435
  // Guard Clause: if the value is too short
9428
- if (elem.value.length < elem.lengthForType) {
9436
+ if (elem.value?.length < elem.lengthForType) {
9429
9437
 
9430
9438
  elem.validity = 'tooShort';
9431
9439
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -9495,11 +9503,17 @@ class AuroFormValidation {
9495
9503
  this.getAuroInputs(elem);
9496
9504
 
9497
9505
  // Validate only if noValidate is not true and the input does not have focus
9498
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
9506
+ let validationShouldRun =
9507
+ force ||
9508
+ (!elem.contains(document.activeElement) &&
9509
+ (elem.touched ||
9510
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
9511
+ elem.validateOnInput;
9499
9512
 
9500
9513
  if (elem.hasAttribute('error')) {
9501
9514
  elem.validity = 'customError';
9502
9515
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
9516
+ validationShouldRun = false;
9503
9517
  } else if (validationShouldRun) {
9504
9518
  elem.validity = 'valid';
9505
9519
  elem.errorMessage = '';
@@ -9520,7 +9534,7 @@ class AuroFormValidation {
9520
9534
  }
9521
9535
  }
9522
9536
 
9523
- if (!hasValue && elem.required) {
9537
+ if (!hasValue && elem.required && elem.touched) {
9524
9538
  elem.validity = 'valueMissing';
9525
9539
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
9526
9540
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -9531,7 +9545,7 @@ class AuroFormValidation {
9531
9545
  }
9532
9546
  }
9533
9547
 
9534
- if (this.auroInputElements?.length > 0) {
9548
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
9535
9549
  elem.validity = this.auroInputElements[0].validity;
9536
9550
  elem.errorMessage = this.auroInputElements[0].errorMessage;
9537
9551
 
@@ -9610,7 +9624,7 @@ class AuroFormValidation {
9610
9624
  }
9611
9625
  }
9612
9626
  } else {
9613
- elem.errorMessage = undefined;
9627
+ elem.errorMessage = '';
9614
9628
  }
9615
9629
  }
9616
9630
  }
@@ -9661,6 +9675,7 @@ class BaseInput extends i$2 {
9661
9675
  * @returns {void}
9662
9676
  */
9663
9677
  privateDefaults() {
9678
+ this.touched = false;
9664
9679
  this.util = new AuroInputUtilities();
9665
9680
  this.validation = new AuroFormValidation();
9666
9681
  this.inputIconName = undefined;
@@ -10022,6 +10037,18 @@ class BaseInput extends i$2 {
10022
10037
  validity: {
10023
10038
  type: String,
10024
10039
  reflect: true
10040
+ },
10041
+
10042
+ /**
10043
+ * Indicates whether the input is in a dirty state (has been interacted with).
10044
+ * @type {boolean}
10045
+ * @default false
10046
+ * @private
10047
+ */
10048
+ touched: {
10049
+ type: Boolean,
10050
+ reflect: true,
10051
+ attribute: false
10025
10052
  }
10026
10053
  };
10027
10054
  }
@@ -10308,15 +10335,7 @@ class BaseInput extends i$2 {
10308
10335
  */
10309
10336
  handleFocusin() {
10310
10337
 
10311
- /**
10312
- * The input is considered to be in it's initial state based on
10313
- * if this.value === undefined. The first time we interact with the
10314
- * input manually, by applying focusin, we need to flag the
10315
- * input as no longer in the initial state.
10316
- */
10317
- if (this.value === undefined) {
10318
- this.value = '';
10319
- }
10338
+ this.touched = true;
10320
10339
  }
10321
10340
 
10322
10341
  /**
@@ -12950,14 +12969,6 @@ class AuroCombobox extends i$2 {
12950
12969
  reflect: true
12951
12970
  },
12952
12971
 
12953
- /**
12954
- * @private
12955
- */
12956
- isDropdownFullscreen: {
12957
- type: Boolean,
12958
- reflect: false
12959
- },
12960
-
12961
12972
  /**
12962
12973
  * @private
12963
12974
  * specifies the currently active option
@@ -12992,6 +13003,14 @@ class AuroCombobox extends i$2 {
12992
13003
  * @returns {void}
12993
13004
  */
12994
13005
  handleMenuOptions() {
13006
+ // Reset menu matchword UI
13007
+ this.menu.updateItemsState(new Map([
13008
+ [
13009
+ 'matchWord',
13010
+ true
13011
+ ]
13012
+ ]));
13013
+
12995
13014
  this.generateOptionsArray();
12996
13015
  this.availableOptions = [];
12997
13016
 
@@ -13099,8 +13118,6 @@ class AuroCombobox extends i$2 {
13099
13118
  return;
13100
13119
  }
13101
13120
 
13102
- this.isDropdownFullscreen = this.dropdown.isBibFullscreen;
13103
-
13104
13121
  if (!this.dropdown.isPopoverVisible && this.input.value && this.input.value.length > 0) {
13105
13122
  if (this.menu.getAttribute('loading') || (this.availableOptions && this.availableOptions.length > 0) || this.noMatchOption !== undefined) { // eslint-disable-line no-extra-parens
13106
13123
  if (this.menu.hasAttribute('loading') && !this.menu.hasLoadingPlaceholder) {
@@ -13127,6 +13144,13 @@ class AuroCombobox extends i$2 {
13127
13144
  // Listen for the dropdown to be shown or hidden
13128
13145
  this.dropdown.addEventListener("auroDropdown-toggled", (ev) => {
13129
13146
  this.dropdownOpen = ev.detail.expanded;
13147
+
13148
+ // wait a frame in case the bib gets hide immediately after showing because there is no value
13149
+ setTimeout(this.transportInput);
13150
+ });
13151
+
13152
+ this.dropdown.addEventListener('auroDropdown-triggerClick', () => {
13153
+ this.showBib();
13130
13154
  });
13131
13155
 
13132
13156
  // this.dropdown.addEventListener('auroDropdown-show', () => {
@@ -13145,19 +13169,10 @@ class AuroCombobox extends i$2 {
13145
13169
  this.hideBib = this.hideBib.bind(this);
13146
13170
  this.bibtemplate.addEventListener('close-click', this.hideBib);
13147
13171
 
13148
- this.dropdown.addEventListener('auroDropdown-triggerClick', () => {
13149
- this.showBib();
13150
- });
13151
-
13152
13172
  this.transportInput = this.transportInput.bind(this);
13153
- this.dropdown.addEventListener('auroDropdown-toggled', () => {
13154
- // wait a frame in case the bib gets hide immediately after showing because there is no value
13155
- setTimeout(this.transportInput);
13156
- });
13157
13173
 
13158
- this.dropdown.addEventListener('auroDropdown-strategy-change', (event) => {
13174
+ this.dropdown.addEventListener('auroDropdown-strategy-change', () => {
13159
13175
  // event when the strategy(bib mode) is changed between fullscreen and floating
13160
- this.isDropdownFullscreen = event.detail.strategy === 'fullscreen';
13161
13176
  setTimeout(this.transportInput);
13162
13177
  });
13163
13178
  }
@@ -13253,20 +13268,17 @@ class AuroCombobox extends i$2 {
13253
13268
  * @private
13254
13269
  * Dispatches input's keyboard events from host
13255
13270
  * This allows key events from the input to be handled by the parent.
13256
- * @param {KeyboardEvent} event - The keyboard event.
13271
+ * @param {Event} event - The keyboard event.
13257
13272
  */
13258
- bubbleUpInputKeyEvent(event) {
13273
+ bubbleUpInputEvent(event) {
13274
+ // Do not need to bubble events if the input is not in bib.
13259
13275
  if (event.currentTarget.parentNode !== this.dropdown) {
13276
+ // prevents browsers to move cursor in input element.
13260
13277
  if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
13261
13278
  event.preventDefault();
13262
13279
  }
13263
-
13264
- const ke = new KeyboardEvent(event.type, {
13265
- key: event.key,
13266
- code: event.code,
13267
- repeat: event.repeat,
13268
- });
13269
- this.dispatchEvent(ke);
13280
+ const dupEvent = new event.constructor(event.type, event);
13281
+ this.dispatchEvent(dupEvent);
13270
13282
  }
13271
13283
  }
13272
13284
 
@@ -13277,14 +13289,22 @@ class AuroCombobox extends i$2 {
13277
13289
  */
13278
13290
  configureInput() {
13279
13291
  // When input is in bibtemplate, make the event to be fired at combobox element
13280
- this.bubbleUpInputKeyEvent = this.bubbleUpInputKeyEvent.bind(this);
13281
- this.input.addEventListener('keydown', this.bubbleUpInputKeyEvent);
13282
- this.input.addEventListener('keyup', this.bubbleUpInputKeyEvent);
13283
- this.input.addEventListener('input', this.bubbleUpInputKeyEvent);
13292
+ this.bubbleUpInputEvent = this.bubbleUpInputEvent.bind(this);
13293
+
13294
+ const events = [
13295
+ 'input',
13296
+ 'keydown',
13297
+ 'keyup'
13298
+ ];
13299
+ events.forEach((eventType) => {
13300
+ this.input.addEventListener(eventType, this.bubbleUpInputEvent);
13301
+ });
13284
13302
 
13285
13303
  this.addEventListener('keyup', (evt) => {
13286
13304
  if (evt.key.length === 1 || evt.key === 'Backspace' || evt.key === 'Delete') {
13287
- this.showBib();
13305
+ if (!this.dropdown.isPopoverVisible) {
13306
+ this.showBib();
13307
+ }
13288
13308
  }
13289
13309
  });
13290
13310
 
@@ -13345,8 +13365,8 @@ class AuroCombobox extends i$2 {
13345
13365
  const inputHelpText = this.input.shadowRoot.querySelector('auro-helptext, [auro-helptext');
13346
13366
  const inputAlertIcon = this.input.shadowRoot.querySelector(".alertNotification");
13347
13367
 
13348
- if (this.dropdown.isPopoverVisible && this.isDropdownFullscreen) {
13349
- if (this.input.parentNode !== this.bibtemplate) {
13368
+ if (this.dropdown.isPopoverVisible && this.dropdown.isBibFullscreen) {
13369
+ if (this.input.parentNode === this.dropdown) {
13350
13370
  // keep the trigger size the same even after input gets removed
13351
13371
  const parentSize = window.getComputedStyle(this.dropdown.trigger);
13352
13372
  this.dropdown.trigger.style.height = parentSize.height;
@@ -13432,7 +13452,7 @@ class AuroCombobox extends i$2 {
13432
13452
  }
13433
13453
 
13434
13454
  // Force dropdown bib to hide if input value has no matching suggestions
13435
- if ((!this.availableOptions || this.availableOptions.length === 0) && !this.isDropdownFullscreen) {
13455
+ if ((!this.availableOptions || this.availableOptions.length === 0) && !this.dropdown.isBibFullscreen) {
13436
13456
  this.hideBib();
13437
13457
  }
13438
13458
  }
@@ -13455,7 +13475,7 @@ class AuroCombobox extends i$2 {
13455
13475
  if (evt.key === 'Tab') {
13456
13476
  this.hideBib();
13457
13477
 
13458
- if (this.dropdown.isPopoverVisible && this.isDropdownFullscreen) {
13478
+ if (this.dropdown.isPopoverVisible && this.dropdown.isBibFullscreen) {
13459
13479
  // if bib is open in fullscreen, just close the bib and do not move the focus to the next focasable element
13460
13480
  evt.preventDefault();
13461
13481
  }
@@ -591,6 +591,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
591
591
  reset(elem) {
592
592
  elem.validity = undefined;
593
593
  elem.value = undefined;
594
+ elem.touched = false;
594
595
 
595
596
  // Resets the second value of the datepicker in range state
596
597
  if (elem.valueEnd) {
@@ -728,7 +729,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
728
729
  } else if (elem.type === 'date' && elem.value?.length > 0) {
729
730
 
730
731
  // Guard Clause: if the value is too short
731
- if (elem.value.length < elem.lengthForType) {
732
+ if (elem.value?.length < elem.lengthForType) {
732
733
 
733
734
  elem.validity = 'tooShort';
734
735
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -798,11 +799,17 @@ let AuroFormValidation$1 = class AuroFormValidation {
798
799
  this.getAuroInputs(elem);
799
800
 
800
801
  // Validate only if noValidate is not true and the input does not have focus
801
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
802
+ let validationShouldRun =
803
+ force ||
804
+ (!elem.contains(document.activeElement) &&
805
+ (elem.touched ||
806
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
807
+ elem.validateOnInput;
802
808
 
803
809
  if (elem.hasAttribute('error')) {
804
810
  elem.validity = 'customError';
805
811
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
812
+ validationShouldRun = false;
806
813
  } else if (validationShouldRun) {
807
814
  elem.validity = 'valid';
808
815
  elem.errorMessage = '';
@@ -823,7 +830,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
823
830
  }
824
831
  }
825
832
 
826
- if (!hasValue && elem.required) {
833
+ if (!hasValue && elem.required && elem.touched) {
827
834
  elem.validity = 'valueMissing';
828
835
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
829
836
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -834,7 +841,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
834
841
  }
835
842
  }
836
843
 
837
- if (this.auroInputElements?.length > 0) {
844
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
838
845
  elem.validity = this.auroInputElements[0].validity;
839
846
  elem.errorMessage = this.auroInputElements[0].errorMessage;
840
847
 
@@ -913,7 +920,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
913
920
  }
914
921
  }
915
922
  } else {
916
- elem.errorMessage = undefined;
923
+ elem.errorMessage = '';
917
924
  }
918
925
  }
919
926
  };
@@ -9146,6 +9153,7 @@ class AuroFormValidation {
9146
9153
  reset(elem) {
9147
9154
  elem.validity = undefined;
9148
9155
  elem.value = undefined;
9156
+ elem.touched = false;
9149
9157
 
9150
9158
  // Resets the second value of the datepicker in range state
9151
9159
  if (elem.valueEnd) {
@@ -9283,7 +9291,7 @@ class AuroFormValidation {
9283
9291
  } else if (elem.type === 'date' && elem.value?.length > 0) {
9284
9292
 
9285
9293
  // Guard Clause: if the value is too short
9286
- if (elem.value.length < elem.lengthForType) {
9294
+ if (elem.value?.length < elem.lengthForType) {
9287
9295
 
9288
9296
  elem.validity = 'tooShort';
9289
9297
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -9353,11 +9361,17 @@ class AuroFormValidation {
9353
9361
  this.getAuroInputs(elem);
9354
9362
 
9355
9363
  // Validate only if noValidate is not true and the input does not have focus
9356
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
9364
+ let validationShouldRun =
9365
+ force ||
9366
+ (!elem.contains(document.activeElement) &&
9367
+ (elem.touched ||
9368
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
9369
+ elem.validateOnInput;
9357
9370
 
9358
9371
  if (elem.hasAttribute('error')) {
9359
9372
  elem.validity = 'customError';
9360
9373
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
9374
+ validationShouldRun = false;
9361
9375
  } else if (validationShouldRun) {
9362
9376
  elem.validity = 'valid';
9363
9377
  elem.errorMessage = '';
@@ -9378,7 +9392,7 @@ class AuroFormValidation {
9378
9392
  }
9379
9393
  }
9380
9394
 
9381
- if (!hasValue && elem.required) {
9395
+ if (!hasValue && elem.required && elem.touched) {
9382
9396
  elem.validity = 'valueMissing';
9383
9397
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
9384
9398
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -9389,7 +9403,7 @@ class AuroFormValidation {
9389
9403
  }
9390
9404
  }
9391
9405
 
9392
- if (this.auroInputElements?.length > 0) {
9406
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
9393
9407
  elem.validity = this.auroInputElements[0].validity;
9394
9408
  elem.errorMessage = this.auroInputElements[0].errorMessage;
9395
9409
 
@@ -9468,7 +9482,7 @@ class AuroFormValidation {
9468
9482
  }
9469
9483
  }
9470
9484
  } else {
9471
- elem.errorMessage = undefined;
9485
+ elem.errorMessage = '';
9472
9486
  }
9473
9487
  }
9474
9488
  }
@@ -9519,6 +9533,7 @@ class BaseInput extends i$2 {
9519
9533
  * @returns {void}
9520
9534
  */
9521
9535
  privateDefaults() {
9536
+ this.touched = false;
9522
9537
  this.util = new AuroInputUtilities();
9523
9538
  this.validation = new AuroFormValidation();
9524
9539
  this.inputIconName = undefined;
@@ -9880,6 +9895,18 @@ class BaseInput extends i$2 {
9880
9895
  validity: {
9881
9896
  type: String,
9882
9897
  reflect: true
9898
+ },
9899
+
9900
+ /**
9901
+ * Indicates whether the input is in a dirty state (has been interacted with).
9902
+ * @type {boolean}
9903
+ * @default false
9904
+ * @private
9905
+ */
9906
+ touched: {
9907
+ type: Boolean,
9908
+ reflect: true,
9909
+ attribute: false
9883
9910
  }
9884
9911
  };
9885
9912
  }
@@ -10166,15 +10193,7 @@ class BaseInput extends i$2 {
10166
10193
  */
10167
10194
  handleFocusin() {
10168
10195
 
10169
- /**
10170
- * The input is considered to be in it's initial state based on
10171
- * if this.value === undefined. The first time we interact with the
10172
- * input manually, by applying focusin, we need to flag the
10173
- * input as no longer in the initial state.
10174
- */
10175
- if (this.value === undefined) {
10176
- this.value = '';
10177
- }
10196
+ this.touched = true;
10178
10197
  }
10179
10198
 
10180
10199
  /**
@@ -12808,14 +12827,6 @@ class AuroCombobox extends i$2 {
12808
12827
  reflect: true
12809
12828
  },
12810
12829
 
12811
- /**
12812
- * @private
12813
- */
12814
- isDropdownFullscreen: {
12815
- type: Boolean,
12816
- reflect: false
12817
- },
12818
-
12819
12830
  /**
12820
12831
  * @private
12821
12832
  * specifies the currently active option
@@ -12850,6 +12861,14 @@ class AuroCombobox extends i$2 {
12850
12861
  * @returns {void}
12851
12862
  */
12852
12863
  handleMenuOptions() {
12864
+ // Reset menu matchword UI
12865
+ this.menu.updateItemsState(new Map([
12866
+ [
12867
+ 'matchWord',
12868
+ true
12869
+ ]
12870
+ ]));
12871
+
12853
12872
  this.generateOptionsArray();
12854
12873
  this.availableOptions = [];
12855
12874
 
@@ -12957,8 +12976,6 @@ class AuroCombobox extends i$2 {
12957
12976
  return;
12958
12977
  }
12959
12978
 
12960
- this.isDropdownFullscreen = this.dropdown.isBibFullscreen;
12961
-
12962
12979
  if (!this.dropdown.isPopoverVisible && this.input.value && this.input.value.length > 0) {
12963
12980
  if (this.menu.getAttribute('loading') || (this.availableOptions && this.availableOptions.length > 0) || this.noMatchOption !== undefined) { // eslint-disable-line no-extra-parens
12964
12981
  if (this.menu.hasAttribute('loading') && !this.menu.hasLoadingPlaceholder) {
@@ -12985,6 +13002,13 @@ class AuroCombobox extends i$2 {
12985
13002
  // Listen for the dropdown to be shown or hidden
12986
13003
  this.dropdown.addEventListener("auroDropdown-toggled", (ev) => {
12987
13004
  this.dropdownOpen = ev.detail.expanded;
13005
+
13006
+ // wait a frame in case the bib gets hide immediately after showing because there is no value
13007
+ setTimeout(this.transportInput);
13008
+ });
13009
+
13010
+ this.dropdown.addEventListener('auroDropdown-triggerClick', () => {
13011
+ this.showBib();
12988
13012
  });
12989
13013
 
12990
13014
  // this.dropdown.addEventListener('auroDropdown-show', () => {
@@ -13003,19 +13027,10 @@ class AuroCombobox extends i$2 {
13003
13027
  this.hideBib = this.hideBib.bind(this);
13004
13028
  this.bibtemplate.addEventListener('close-click', this.hideBib);
13005
13029
 
13006
- this.dropdown.addEventListener('auroDropdown-triggerClick', () => {
13007
- this.showBib();
13008
- });
13009
-
13010
13030
  this.transportInput = this.transportInput.bind(this);
13011
- this.dropdown.addEventListener('auroDropdown-toggled', () => {
13012
- // wait a frame in case the bib gets hide immediately after showing because there is no value
13013
- setTimeout(this.transportInput);
13014
- });
13015
13031
 
13016
- this.dropdown.addEventListener('auroDropdown-strategy-change', (event) => {
13032
+ this.dropdown.addEventListener('auroDropdown-strategy-change', () => {
13017
13033
  // event when the strategy(bib mode) is changed between fullscreen and floating
13018
- this.isDropdownFullscreen = event.detail.strategy === 'fullscreen';
13019
13034
  setTimeout(this.transportInput);
13020
13035
  });
13021
13036
  }
@@ -13111,20 +13126,17 @@ class AuroCombobox extends i$2 {
13111
13126
  * @private
13112
13127
  * Dispatches input's keyboard events from host
13113
13128
  * This allows key events from the input to be handled by the parent.
13114
- * @param {KeyboardEvent} event - The keyboard event.
13129
+ * @param {Event} event - The keyboard event.
13115
13130
  */
13116
- bubbleUpInputKeyEvent(event) {
13131
+ bubbleUpInputEvent(event) {
13132
+ // Do not need to bubble events if the input is not in bib.
13117
13133
  if (event.currentTarget.parentNode !== this.dropdown) {
13134
+ // prevents browsers to move cursor in input element.
13118
13135
  if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
13119
13136
  event.preventDefault();
13120
13137
  }
13121
-
13122
- const ke = new KeyboardEvent(event.type, {
13123
- key: event.key,
13124
- code: event.code,
13125
- repeat: event.repeat,
13126
- });
13127
- this.dispatchEvent(ke);
13138
+ const dupEvent = new event.constructor(event.type, event);
13139
+ this.dispatchEvent(dupEvent);
13128
13140
  }
13129
13141
  }
13130
13142
 
@@ -13135,14 +13147,22 @@ class AuroCombobox extends i$2 {
13135
13147
  */
13136
13148
  configureInput() {
13137
13149
  // When input is in bibtemplate, make the event to be fired at combobox element
13138
- this.bubbleUpInputKeyEvent = this.bubbleUpInputKeyEvent.bind(this);
13139
- this.input.addEventListener('keydown', this.bubbleUpInputKeyEvent);
13140
- this.input.addEventListener('keyup', this.bubbleUpInputKeyEvent);
13141
- this.input.addEventListener('input', this.bubbleUpInputKeyEvent);
13150
+ this.bubbleUpInputEvent = this.bubbleUpInputEvent.bind(this);
13151
+
13152
+ const events = [
13153
+ 'input',
13154
+ 'keydown',
13155
+ 'keyup'
13156
+ ];
13157
+ events.forEach((eventType) => {
13158
+ this.input.addEventListener(eventType, this.bubbleUpInputEvent);
13159
+ });
13142
13160
 
13143
13161
  this.addEventListener('keyup', (evt) => {
13144
13162
  if (evt.key.length === 1 || evt.key === 'Backspace' || evt.key === 'Delete') {
13145
- this.showBib();
13163
+ if (!this.dropdown.isPopoverVisible) {
13164
+ this.showBib();
13165
+ }
13146
13166
  }
13147
13167
  });
13148
13168
 
@@ -13203,8 +13223,8 @@ class AuroCombobox extends i$2 {
13203
13223
  const inputHelpText = this.input.shadowRoot.querySelector('auro-helptext, [auro-helptext');
13204
13224
  const inputAlertIcon = this.input.shadowRoot.querySelector(".alertNotification");
13205
13225
 
13206
- if (this.dropdown.isPopoverVisible && this.isDropdownFullscreen) {
13207
- if (this.input.parentNode !== this.bibtemplate) {
13226
+ if (this.dropdown.isPopoverVisible && this.dropdown.isBibFullscreen) {
13227
+ if (this.input.parentNode === this.dropdown) {
13208
13228
  // keep the trigger size the same even after input gets removed
13209
13229
  const parentSize = window.getComputedStyle(this.dropdown.trigger);
13210
13230
  this.dropdown.trigger.style.height = parentSize.height;
@@ -13290,7 +13310,7 @@ class AuroCombobox extends i$2 {
13290
13310
  }
13291
13311
 
13292
13312
  // Force dropdown bib to hide if input value has no matching suggestions
13293
- if ((!this.availableOptions || this.availableOptions.length === 0) && !this.isDropdownFullscreen) {
13313
+ if ((!this.availableOptions || this.availableOptions.length === 0) && !this.dropdown.isBibFullscreen) {
13294
13314
  this.hideBib();
13295
13315
  }
13296
13316
  }
@@ -13313,7 +13333,7 @@ class AuroCombobox extends i$2 {
13313
13333
  if (evt.key === 'Tab') {
13314
13334
  this.hideBib();
13315
13335
 
13316
- if (this.dropdown.isPopoverVisible && this.isDropdownFullscreen) {
13336
+ if (this.dropdown.isPopoverVisible && this.dropdown.isBibFullscreen) {
13317
13337
  // if bib is open in fullscreen, just close the bib and do not move the focus to the next focasable element
13318
13338
  evt.preventDefault();
13319
13339
  }
@@ -111,7 +111,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
111
111
  In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
112
112
 
113
113
  ```html
114
- <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2.8/auro-combobox/+esm"></script>
114
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-combobox/+esm"></script>
115
115
  ```
116
116
  <!-- AURO-GENERATED-CONTENT:END -->
117
117
 
@@ -194,13 +194,6 @@ export class AuroCombobox extends LitElement {
194
194
  type: StringConstructor;
195
195
  reflect: boolean;
196
196
  };
197
- /**
198
- * @private
199
- */
200
- isDropdownFullscreen: {
201
- type: BooleanConstructor;
202
- reflect: boolean;
203
- };
204
197
  /**
205
198
  * @private
206
199
  * specifies the currently active option
@@ -279,7 +272,6 @@ export class AuroCombobox extends LitElement {
279
272
  * @returns {void}
280
273
  */
281
274
  private showBib;
282
- isDropdownFullscreen: any;
283
275
  /**
284
276
  * Binds all behavior needed to the dropdown after rendering.
285
277
  * @private
@@ -307,9 +299,9 @@ export class AuroCombobox extends LitElement {
307
299
  * @private
308
300
  * Dispatches input's keyboard events from host
309
301
  * This allows key events from the input to be handled by the parent.
310
- * @param {KeyboardEvent} event - The keyboard event.
302
+ * @param {Event} event - The keyboard event.
311
303
  */
312
- private bubbleUpInputKeyEvent;
304
+ private bubbleUpInputEvent;
313
305
  /**
314
306
  * Binds all behavior needed to the input after rendering.
315
307
  * @private