@aurodesignsystem/auro-formkit 3.3.0-beta.2 → 3.4.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 (61) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/components/checkbox/README.md +1 -1
  3. package/components/checkbox/demo/api.min.js +36 -5
  4. package/components/checkbox/demo/index.min.js +36 -5
  5. package/components/checkbox/demo/readme.md +1 -1
  6. package/components/checkbox/dist/auro-checkbox-group.d.ts +7 -0
  7. package/components/checkbox/dist/auro-checkbox.d.ts +7 -0
  8. package/components/checkbox/dist/index.js +36 -5
  9. package/components/checkbox/dist/registered.js +36 -5
  10. package/components/combobox/README.md +1 -1
  11. package/components/combobox/demo/api.md +44 -0
  12. package/components/combobox/demo/api.min.js +95 -60
  13. package/components/combobox/demo/index.min.js +95 -60
  14. package/components/combobox/demo/readme.md +1 -1
  15. package/components/combobox/dist/auro-combobox.d.ts +8 -10
  16. package/components/combobox/dist/index.js +95 -60
  17. package/components/combobox/dist/registered.js +95 -60
  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.md +30 -0
  26. package/components/datepicker/demo/api.min.js +72 -37
  27. package/components/datepicker/demo/index.min.js +72 -37
  28. package/components/datepicker/demo/readme.md +1 -1
  29. package/components/datepicker/dist/auro-datepicker.d.ts +14 -0
  30. package/components/datepicker/dist/index.js +72 -37
  31. package/components/datepicker/dist/registered.js +72 -37
  32. package/components/dropdown/README.md +1 -1
  33. package/components/dropdown/demo/readme.md +1 -1
  34. package/components/form/README.md +1 -1
  35. package/components/form/demo/readme.md +1 -1
  36. package/components/input/README.md +1 -1
  37. package/components/input/demo/api.md +24 -0
  38. package/components/input/demo/api.min.js +36 -17
  39. package/components/input/demo/index.min.js +36 -17
  40. package/components/input/demo/readme.md +1 -1
  41. package/components/input/dist/base-input.d.ts +15 -0
  42. package/components/input/dist/index.js +36 -17
  43. package/components/input/dist/registered.js +36 -17
  44. package/components/menu/README.md +1 -1
  45. package/components/menu/demo/readme.md +1 -1
  46. package/components/radio/README.md +1 -1
  47. package/components/radio/demo/api.min.js +39 -9
  48. package/components/radio/demo/index.min.js +39 -9
  49. package/components/radio/demo/readme.md +1 -1
  50. package/components/radio/dist/auro-radio-group.d.ts +8 -0
  51. package/components/radio/dist/auro-radio.d.ts +10 -0
  52. package/components/radio/dist/index.js +39 -9
  53. package/components/radio/dist/registered.js +39 -9
  54. package/components/select/README.md +1 -1
  55. package/components/select/demo/api.min.js +25 -15
  56. package/components/select/demo/index.min.js +25 -15
  57. package/components/select/demo/readme.md +1 -1
  58. package/components/select/dist/auro-select.d.ts +8 -0
  59. package/components/select/dist/index.js +25 -15
  60. package/components/select/dist/registered.js +25 -15
  61. package/package.json +1 -1
@@ -541,6 +541,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
541
541
  reset(elem) {
542
542
  elem.validity = undefined;
543
543
  elem.value = undefined;
544
+ elem.touched = false;
544
545
 
545
546
  // Resets the second value of the datepicker in range state
546
547
  if (elem.valueEnd) {
@@ -678,7 +679,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
678
679
  } else if (elem.type === 'date' && elem.value?.length > 0) {
679
680
 
680
681
  // Guard Clause: if the value is too short
681
- if (elem.value.length < elem.lengthForType) {
682
+ if (elem.value?.length < elem.lengthForType) {
682
683
 
683
684
  elem.validity = 'tooShort';
684
685
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -748,11 +749,17 @@ let AuroFormValidation$1 = class AuroFormValidation {
748
749
  this.getAuroInputs(elem);
749
750
 
750
751
  // Validate only if noValidate is not true and the input does not have focus
751
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
752
+ let validationShouldRun =
753
+ force ||
754
+ (!elem.contains(document.activeElement) &&
755
+ (elem.touched ||
756
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
757
+ elem.validateOnInput;
752
758
 
753
759
  if (elem.hasAttribute('error')) {
754
760
  elem.validity = 'customError';
755
761
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
762
+ validationShouldRun = false;
756
763
  } else if (validationShouldRun) {
757
764
  elem.validity = 'valid';
758
765
  elem.errorMessage = '';
@@ -773,7 +780,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
773
780
  }
774
781
  }
775
782
 
776
- if (!hasValue && elem.required) {
783
+ if (!hasValue && elem.required && elem.touched) {
777
784
  elem.validity = 'valueMissing';
778
785
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
779
786
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -784,7 +791,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
784
791
  }
785
792
  }
786
793
 
787
- if (this.auroInputElements?.length > 0) {
794
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
788
795
  elem.validity = this.auroInputElements[0].validity;
789
796
  elem.errorMessage = this.auroInputElements[0].errorMessage;
790
797
 
@@ -863,7 +870,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
863
870
  }
864
871
  }
865
872
  } else {
866
- elem.errorMessage = undefined;
873
+ elem.errorMessage = '';
867
874
  }
868
875
  }
869
876
  };
@@ -9064,6 +9071,7 @@ class AuroFormValidation {
9064
9071
  reset(elem) {
9065
9072
  elem.validity = undefined;
9066
9073
  elem.value = undefined;
9074
+ elem.touched = false;
9067
9075
 
9068
9076
  // Resets the second value of the datepicker in range state
9069
9077
  if (elem.valueEnd) {
@@ -9201,7 +9209,7 @@ class AuroFormValidation {
9201
9209
  } else if (elem.type === 'date' && elem.value?.length > 0) {
9202
9210
 
9203
9211
  // Guard Clause: if the value is too short
9204
- if (elem.value.length < elem.lengthForType) {
9212
+ if (elem.value?.length < elem.lengthForType) {
9205
9213
 
9206
9214
  elem.validity = 'tooShort';
9207
9215
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -9271,11 +9279,17 @@ class AuroFormValidation {
9271
9279
  this.getAuroInputs(elem);
9272
9280
 
9273
9281
  // Validate only if noValidate is not true and the input does not have focus
9274
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
9282
+ let validationShouldRun =
9283
+ force ||
9284
+ (!elem.contains(document.activeElement) &&
9285
+ (elem.touched ||
9286
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
9287
+ elem.validateOnInput;
9275
9288
 
9276
9289
  if (elem.hasAttribute('error')) {
9277
9290
  elem.validity = 'customError';
9278
9291
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
9292
+ validationShouldRun = false;
9279
9293
  } else if (validationShouldRun) {
9280
9294
  elem.validity = 'valid';
9281
9295
  elem.errorMessage = '';
@@ -9296,7 +9310,7 @@ class AuroFormValidation {
9296
9310
  }
9297
9311
  }
9298
9312
 
9299
- if (!hasValue && elem.required) {
9313
+ if (!hasValue && elem.required && elem.touched) {
9300
9314
  elem.validity = 'valueMissing';
9301
9315
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
9302
9316
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -9307,7 +9321,7 @@ class AuroFormValidation {
9307
9321
  }
9308
9322
  }
9309
9323
 
9310
- if (this.auroInputElements?.length > 0) {
9324
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
9311
9325
  elem.validity = this.auroInputElements[0].validity;
9312
9326
  elem.errorMessage = this.auroInputElements[0].errorMessage;
9313
9327
 
@@ -9386,7 +9400,7 @@ class AuroFormValidation {
9386
9400
  }
9387
9401
  }
9388
9402
  } else {
9389
- elem.errorMessage = undefined;
9403
+ elem.errorMessage = '';
9390
9404
  }
9391
9405
  }
9392
9406
  }
@@ -9437,6 +9451,7 @@ class BaseInput extends LitElement {
9437
9451
  * @returns {void}
9438
9452
  */
9439
9453
  privateDefaults() {
9454
+ this.touched = false;
9440
9455
  this.util = new AuroInputUtilities();
9441
9456
  this.validation = new AuroFormValidation();
9442
9457
  this.inputIconName = undefined;
@@ -9597,6 +9612,13 @@ class BaseInput extends LitElement {
9597
9612
  type: String
9598
9613
  },
9599
9614
 
9615
+ /** Exposes inputmode attribute for input. */
9616
+ inputmode: {
9617
+ type: String,
9618
+ attribute: true,
9619
+ reflect: true
9620
+ },
9621
+
9600
9622
  /**
9601
9623
  * Defines the language of an element.
9602
9624
  */
@@ -9798,6 +9820,18 @@ class BaseInput extends LitElement {
9798
9820
  validity: {
9799
9821
  type: String,
9800
9822
  reflect: true
9823
+ },
9824
+
9825
+ /**
9826
+ * Indicates whether the input is in a dirty state (has been interacted with).
9827
+ * @type {boolean}
9828
+ * @default false
9829
+ * @private
9830
+ */
9831
+ touched: {
9832
+ type: Boolean,
9833
+ reflect: true,
9834
+ attribute: false
9801
9835
  }
9802
9836
  };
9803
9837
  }
@@ -10084,15 +10118,7 @@ class BaseInput extends LitElement {
10084
10118
  */
10085
10119
  handleFocusin() {
10086
10120
 
10087
- /**
10088
- * The input is considered to be in it's initial state based on
10089
- * if this.value === undefined. The first time we interact with the
10090
- * input manually, by applying focusin, we need to flag the
10091
- * input as no longer in the initial state.
10092
- */
10093
- if (this.value === undefined) {
10094
- this.value = '';
10095
- }
10121
+ this.touched = true;
10096
10122
  }
10097
10123
 
10098
10124
  /**
@@ -10158,9 +10184,9 @@ class BaseInput extends LitElement {
10158
10184
 
10159
10185
  if (this.type in defaultLengths) {
10160
10186
  this.lengthForType = this.format ? this.format.length : defaultLengths[this.type];
10161
- this.inputMode = 'numeric';
10187
+ this.inputmode = this.inputmode || 'numeric';
10162
10188
  } else if (this.type === 'number') {
10163
- this.inputMode = 'numeric';
10189
+ this.inputmode = this.inputmode || 'numeric';
10164
10190
  }
10165
10191
 
10166
10192
  if (this.type === "date" && !this.format) {
@@ -11518,7 +11544,7 @@ class AuroInput extends BaseInput {
11518
11544
  pattern="${ifDefined(this.definePattern())}"
11519
11545
  maxlength="${ifDefined(this.maxLength ? this.maxLength : undefined)}"
11520
11546
  minlength="${ifDefined(this.minLength ? this.minLength : undefined)}"
11521
- inputMode="${ifDefined(this.inputMode ? this.inputMode : undefined)}"
11547
+ inputMode="${ifDefined(this.inputmode ? this.inputmode : undefined)}"
11522
11548
  ?required="${this.required}"
11523
11549
  ?disabled="${this.disabled}"
11524
11550
  aria-describedby="${this.uniqueId}"
@@ -12577,6 +12603,13 @@ class AuroCombobox extends LitElement {
12577
12603
  reflect: true
12578
12604
  },
12579
12605
 
12606
+ /** Exposes inputmode attribute for input. */
12607
+ inputmode: {
12608
+ type: String,
12609
+ attribute: true,
12610
+ reflect: true
12611
+ },
12612
+
12580
12613
  /**
12581
12614
  * If set, combobox will not filter menuoptions based in input.
12582
12615
  */
@@ -12726,14 +12759,6 @@ class AuroCombobox extends LitElement {
12726
12759
  reflect: true
12727
12760
  },
12728
12761
 
12729
- /**
12730
- * @private
12731
- */
12732
- isDropdownFullscreen: {
12733
- type: Boolean,
12734
- reflect: false
12735
- },
12736
-
12737
12762
  /**
12738
12763
  * @private
12739
12764
  * specifies the currently active option
@@ -12768,6 +12793,14 @@ class AuroCombobox extends LitElement {
12768
12793
  * @returns {void}
12769
12794
  */
12770
12795
  handleMenuOptions() {
12796
+ // Reset menu matchword UI
12797
+ this.menu.updateItemsState(new Map([
12798
+ [
12799
+ 'matchWord',
12800
+ true
12801
+ ]
12802
+ ]));
12803
+
12771
12804
  this.generateOptionsArray();
12772
12805
  this.availableOptions = [];
12773
12806
 
@@ -12875,8 +12908,6 @@ class AuroCombobox extends LitElement {
12875
12908
  return;
12876
12909
  }
12877
12910
 
12878
- this.isDropdownFullscreen = this.dropdown.isBibFullscreen;
12879
-
12880
12911
  if (!this.dropdown.isPopoverVisible && this.input.value && this.input.value.length > 0) {
12881
12912
  if (this.menu.getAttribute('loading') || (this.availableOptions && this.availableOptions.length > 0) || this.noMatchOption !== undefined) { // eslint-disable-line no-extra-parens
12882
12913
  if (this.menu.hasAttribute('loading') && !this.menu.hasLoadingPlaceholder) {
@@ -12903,6 +12934,13 @@ class AuroCombobox extends LitElement {
12903
12934
  // Listen for the dropdown to be shown or hidden
12904
12935
  this.dropdown.addEventListener("auroDropdown-toggled", (ev) => {
12905
12936
  this.dropdownOpen = ev.detail.expanded;
12937
+
12938
+ // wait a frame in case the bib gets hide immediately after showing because there is no value
12939
+ setTimeout(this.transportInput);
12940
+ });
12941
+
12942
+ this.dropdown.addEventListener('auroDropdown-triggerClick', () => {
12943
+ this.showBib();
12906
12944
  });
12907
12945
 
12908
12946
  // this.dropdown.addEventListener('auroDropdown-show', () => {
@@ -12921,19 +12959,10 @@ class AuroCombobox extends LitElement {
12921
12959
  this.hideBib = this.hideBib.bind(this);
12922
12960
  this.bibtemplate.addEventListener('close-click', this.hideBib);
12923
12961
 
12924
- this.dropdown.addEventListener('auroDropdown-triggerClick', () => {
12925
- this.showBib();
12926
- });
12927
-
12928
12962
  this.transportInput = this.transportInput.bind(this);
12929
- this.dropdown.addEventListener('auroDropdown-toggled', () => {
12930
- // wait a frame in case the bib gets hide immediately after showing because there is no value
12931
- setTimeout(this.transportInput);
12932
- });
12933
12963
 
12934
- this.dropdown.addEventListener('auroDropdown-strategy-change', (event) => {
12964
+ this.dropdown.addEventListener('auroDropdown-strategy-change', () => {
12935
12965
  // event when the strategy(bib mode) is changed between fullscreen and floating
12936
- this.isDropdownFullscreen = event.detail.strategy === 'fullscreen';
12937
12966
  setTimeout(this.transportInput);
12938
12967
  });
12939
12968
  }
@@ -13029,20 +13058,17 @@ class AuroCombobox extends LitElement {
13029
13058
  * @private
13030
13059
  * Dispatches input's keyboard events from host
13031
13060
  * This allows key events from the input to be handled by the parent.
13032
- * @param {KeyboardEvent} event - The keyboard event.
13061
+ * @param {Event} event - The keyboard event.
13033
13062
  */
13034
- bubbleUpInputKeyEvent(event) {
13063
+ bubbleUpInputEvent(event) {
13064
+ // Do not need to bubble events if the input is not in bib.
13035
13065
  if (event.currentTarget.parentNode !== this.dropdown) {
13066
+ // prevents browsers to move cursor in input element.
13036
13067
  if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
13037
13068
  event.preventDefault();
13038
13069
  }
13039
-
13040
- const ke = new KeyboardEvent(event.type, {
13041
- key: event.key,
13042
- code: event.code,
13043
- repeat: event.repeat,
13044
- });
13045
- this.dispatchEvent(ke);
13070
+ const dupEvent = new event.constructor(event.type, event);
13071
+ this.dispatchEvent(dupEvent);
13046
13072
  }
13047
13073
  }
13048
13074
 
@@ -13053,14 +13079,22 @@ class AuroCombobox extends LitElement {
13053
13079
  */
13054
13080
  configureInput() {
13055
13081
  // When input is in bibtemplate, make the event to be fired at combobox element
13056
- this.bubbleUpInputKeyEvent = this.bubbleUpInputKeyEvent.bind(this);
13057
- this.input.addEventListener('keydown', this.bubbleUpInputKeyEvent);
13058
- this.input.addEventListener('keyup', this.bubbleUpInputKeyEvent);
13059
- this.input.addEventListener('input', this.bubbleUpInputKeyEvent);
13082
+ this.bubbleUpInputEvent = this.bubbleUpInputEvent.bind(this);
13083
+
13084
+ const events = [
13085
+ 'input',
13086
+ 'keydown',
13087
+ 'keyup'
13088
+ ];
13089
+ events.forEach((eventType) => {
13090
+ this.input.addEventListener(eventType, this.bubbleUpInputEvent);
13091
+ });
13060
13092
 
13061
13093
  this.addEventListener('keyup', (evt) => {
13062
13094
  if (evt.key.length === 1 || evt.key === 'Backspace' || evt.key === 'Delete') {
13063
- this.showBib();
13095
+ if (!this.dropdown.isPopoverVisible) {
13096
+ this.showBib();
13097
+ }
13064
13098
  }
13065
13099
  });
13066
13100
 
@@ -13121,8 +13155,8 @@ class AuroCombobox extends LitElement {
13121
13155
  const inputHelpText = this.input.shadowRoot.querySelector('auro-helptext, [auro-helptext');
13122
13156
  const inputAlertIcon = this.input.shadowRoot.querySelector(".alertNotification");
13123
13157
 
13124
- if (this.dropdown.isPopoverVisible && this.isDropdownFullscreen) {
13125
- if (this.input.parentNode !== this.bibtemplate) {
13158
+ if (this.dropdown.isPopoverVisible && this.dropdown.isBibFullscreen) {
13159
+ if (this.input.parentNode === this.dropdown) {
13126
13160
  // keep the trigger size the same even after input gets removed
13127
13161
  const parentSize = window.getComputedStyle(this.dropdown.trigger);
13128
13162
  this.dropdown.trigger.style.height = parentSize.height;
@@ -13208,7 +13242,7 @@ class AuroCombobox extends LitElement {
13208
13242
  }
13209
13243
 
13210
13244
  // Force dropdown bib to hide if input value has no matching suggestions
13211
- if ((!this.availableOptions || this.availableOptions.length === 0) && !this.isDropdownFullscreen) {
13245
+ if ((!this.availableOptions || this.availableOptions.length === 0) && !this.dropdown.isBibFullscreen) {
13212
13246
  this.hideBib();
13213
13247
  }
13214
13248
  }
@@ -13231,7 +13265,7 @@ class AuroCombobox extends LitElement {
13231
13265
  if (evt.key === 'Tab') {
13232
13266
  this.hideBib();
13233
13267
 
13234
- if (this.dropdown.isPopoverVisible && this.isDropdownFullscreen) {
13268
+ if (this.dropdown.isPopoverVisible && this.dropdown.isBibFullscreen) {
13235
13269
  // if bib is open in fullscreen, just close the bib and do not move the focus to the next focasable element
13236
13270
  evt.preventDefault();
13237
13271
  }
@@ -13456,6 +13490,7 @@ class AuroCombobox extends LitElement {
13456
13490
  setCustomValidityCustomError="${this.setCustomValidityCustomError}"
13457
13491
  .autocomplete="${this.autocomplete}"
13458
13492
  .type="${this.type}"
13493
+ inputmode="${ifDefined(this.inputmode)}"
13459
13494
  @input="${this.handleInputValueChange}">
13460
13495
  </${this.inputTag}>
13461
13496
 
@@ -110,7 +110,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
110
110
  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.
111
111
 
112
112
  ```html
113
- <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2.8/auro-counter/+esm"></script>
113
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-counter/+esm"></script>
114
114
  ```
115
115
  <!-- AURO-GENERATED-CONTENT:END -->
116
116
 
@@ -1389,6 +1389,7 @@ class AuroFormValidation {
1389
1389
  reset(elem) {
1390
1390
  elem.validity = undefined;
1391
1391
  elem.value = undefined;
1392
+ elem.touched = false;
1392
1393
 
1393
1394
  // Resets the second value of the datepicker in range state
1394
1395
  if (elem.valueEnd) {
@@ -1526,7 +1527,7 @@ class AuroFormValidation {
1526
1527
  } else if (elem.type === 'date' && elem.value?.length > 0) {
1527
1528
 
1528
1529
  // Guard Clause: if the value is too short
1529
- if (elem.value.length < elem.lengthForType) {
1530
+ if (elem.value?.length < elem.lengthForType) {
1530
1531
 
1531
1532
  elem.validity = 'tooShort';
1532
1533
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -1596,11 +1597,17 @@ class AuroFormValidation {
1596
1597
  this.getAuroInputs(elem);
1597
1598
 
1598
1599
  // Validate only if noValidate is not true and the input does not have focus
1599
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
1600
+ let validationShouldRun =
1601
+ force ||
1602
+ (!elem.contains(document.activeElement) &&
1603
+ (elem.touched ||
1604
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
1605
+ elem.validateOnInput;
1600
1606
 
1601
1607
  if (elem.hasAttribute('error')) {
1602
1608
  elem.validity = 'customError';
1603
1609
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
1610
+ validationShouldRun = false;
1604
1611
  } else if (validationShouldRun) {
1605
1612
  elem.validity = 'valid';
1606
1613
  elem.errorMessage = '';
@@ -1621,7 +1628,7 @@ class AuroFormValidation {
1621
1628
  }
1622
1629
  }
1623
1630
 
1624
- if (!hasValue && elem.required) {
1631
+ if (!hasValue && elem.required && elem.touched) {
1625
1632
  elem.validity = 'valueMissing';
1626
1633
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
1627
1634
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -1632,7 +1639,7 @@ class AuroFormValidation {
1632
1639
  }
1633
1640
  }
1634
1641
 
1635
- if (this.auroInputElements?.length > 0) {
1642
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
1636
1643
  elem.validity = this.auroInputElements[0].validity;
1637
1644
  elem.errorMessage = this.auroInputElements[0].errorMessage;
1638
1645
 
@@ -1711,7 +1718,7 @@ class AuroFormValidation {
1711
1718
  }
1712
1719
  }
1713
1720
  } else {
1714
- elem.errorMessage = undefined;
1721
+ elem.errorMessage = '';
1715
1722
  }
1716
1723
  }
1717
1724
  }
@@ -1389,6 +1389,7 @@ class AuroFormValidation {
1389
1389
  reset(elem) {
1390
1390
  elem.validity = undefined;
1391
1391
  elem.value = undefined;
1392
+ elem.touched = false;
1392
1393
 
1393
1394
  // Resets the second value of the datepicker in range state
1394
1395
  if (elem.valueEnd) {
@@ -1526,7 +1527,7 @@ class AuroFormValidation {
1526
1527
  } else if (elem.type === 'date' && elem.value?.length > 0) {
1527
1528
 
1528
1529
  // Guard Clause: if the value is too short
1529
- if (elem.value.length < elem.lengthForType) {
1530
+ if (elem.value?.length < elem.lengthForType) {
1530
1531
 
1531
1532
  elem.validity = 'tooShort';
1532
1533
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -1596,11 +1597,17 @@ class AuroFormValidation {
1596
1597
  this.getAuroInputs(elem);
1597
1598
 
1598
1599
  // Validate only if noValidate is not true and the input does not have focus
1599
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
1600
+ let validationShouldRun =
1601
+ force ||
1602
+ (!elem.contains(document.activeElement) &&
1603
+ (elem.touched ||
1604
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
1605
+ elem.validateOnInput;
1600
1606
 
1601
1607
  if (elem.hasAttribute('error')) {
1602
1608
  elem.validity = 'customError';
1603
1609
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
1610
+ validationShouldRun = false;
1604
1611
  } else if (validationShouldRun) {
1605
1612
  elem.validity = 'valid';
1606
1613
  elem.errorMessage = '';
@@ -1621,7 +1628,7 @@ class AuroFormValidation {
1621
1628
  }
1622
1629
  }
1623
1630
 
1624
- if (!hasValue && elem.required) {
1631
+ if (!hasValue && elem.required && elem.touched) {
1625
1632
  elem.validity = 'valueMissing';
1626
1633
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
1627
1634
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -1632,7 +1639,7 @@ class AuroFormValidation {
1632
1639
  }
1633
1640
  }
1634
1641
 
1635
- if (this.auroInputElements?.length > 0) {
1642
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
1636
1643
  elem.validity = this.auroInputElements[0].validity;
1637
1644
  elem.errorMessage = this.auroInputElements[0].errorMessage;
1638
1645
 
@@ -1711,7 +1718,7 @@ class AuroFormValidation {
1711
1718
  }
1712
1719
  }
1713
1720
  } else {
1714
- elem.errorMessage = undefined;
1721
+ elem.errorMessage = '';
1715
1722
  }
1716
1723
  }
1717
1724
  }
@@ -110,7 +110,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
110
110
  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.
111
111
 
112
112
  ```html
113
- <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2.8/auro-counter/+esm"></script>
113
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-counter/+esm"></script>
114
114
  ```
115
115
  <!-- AURO-GENERATED-CONTENT:END -->
116
116
 
@@ -1342,6 +1342,7 @@ class AuroFormValidation {
1342
1342
  reset(elem) {
1343
1343
  elem.validity = undefined;
1344
1344
  elem.value = undefined;
1345
+ elem.touched = false;
1345
1346
 
1346
1347
  // Resets the second value of the datepicker in range state
1347
1348
  if (elem.valueEnd) {
@@ -1479,7 +1480,7 @@ class AuroFormValidation {
1479
1480
  } else if (elem.type === 'date' && elem.value?.length > 0) {
1480
1481
 
1481
1482
  // Guard Clause: if the value is too short
1482
- if (elem.value.length < elem.lengthForType) {
1483
+ if (elem.value?.length < elem.lengthForType) {
1483
1484
 
1484
1485
  elem.validity = 'tooShort';
1485
1486
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -1549,11 +1550,17 @@ class AuroFormValidation {
1549
1550
  this.getAuroInputs(elem);
1550
1551
 
1551
1552
  // Validate only if noValidate is not true and the input does not have focus
1552
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
1553
+ let validationShouldRun =
1554
+ force ||
1555
+ (!elem.contains(document.activeElement) &&
1556
+ (elem.touched ||
1557
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
1558
+ elem.validateOnInput;
1553
1559
 
1554
1560
  if (elem.hasAttribute('error')) {
1555
1561
  elem.validity = 'customError';
1556
1562
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
1563
+ validationShouldRun = false;
1557
1564
  } else if (validationShouldRun) {
1558
1565
  elem.validity = 'valid';
1559
1566
  elem.errorMessage = '';
@@ -1574,7 +1581,7 @@ class AuroFormValidation {
1574
1581
  }
1575
1582
  }
1576
1583
 
1577
- if (!hasValue && elem.required) {
1584
+ if (!hasValue && elem.required && elem.touched) {
1578
1585
  elem.validity = 'valueMissing';
1579
1586
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
1580
1587
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -1585,7 +1592,7 @@ class AuroFormValidation {
1585
1592
  }
1586
1593
  }
1587
1594
 
1588
- if (this.auroInputElements?.length > 0) {
1595
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
1589
1596
  elem.validity = this.auroInputElements[0].validity;
1590
1597
  elem.errorMessage = this.auroInputElements[0].errorMessage;
1591
1598
 
@@ -1664,7 +1671,7 @@ class AuroFormValidation {
1664
1671
  }
1665
1672
  }
1666
1673
  } else {
1667
- elem.errorMessage = undefined;
1674
+ elem.errorMessage = '';
1668
1675
  }
1669
1676
  }
1670
1677
  }
@@ -1342,6 +1342,7 @@ class AuroFormValidation {
1342
1342
  reset(elem) {
1343
1343
  elem.validity = undefined;
1344
1344
  elem.value = undefined;
1345
+ elem.touched = false;
1345
1346
 
1346
1347
  // Resets the second value of the datepicker in range state
1347
1348
  if (elem.valueEnd) {
@@ -1479,7 +1480,7 @@ class AuroFormValidation {
1479
1480
  } else if (elem.type === 'date' && elem.value?.length > 0) {
1480
1481
 
1481
1482
  // Guard Clause: if the value is too short
1482
- if (elem.value.length < elem.lengthForType) {
1483
+ if (elem.value?.length < elem.lengthForType) {
1483
1484
 
1484
1485
  elem.validity = 'tooShort';
1485
1486
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
@@ -1549,11 +1550,17 @@ class AuroFormValidation {
1549
1550
  this.getAuroInputs(elem);
1550
1551
 
1551
1552
  // Validate only if noValidate is not true and the input does not have focus
1552
- const validationShouldRun = force || (!elem.contains(document.activeElement) && elem.value !== undefined) || elem.validateOnInput;
1553
+ let validationShouldRun =
1554
+ force ||
1555
+ (!elem.contains(document.activeElement) &&
1556
+ (elem.touched ||
1557
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
1558
+ elem.validateOnInput;
1553
1559
 
1554
1560
  if (elem.hasAttribute('error')) {
1555
1561
  elem.validity = 'customError';
1556
1562
  elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
1563
+ validationShouldRun = false;
1557
1564
  } else if (validationShouldRun) {
1558
1565
  elem.validity = 'valid';
1559
1566
  elem.errorMessage = '';
@@ -1574,7 +1581,7 @@ class AuroFormValidation {
1574
1581
  }
1575
1582
  }
1576
1583
 
1577
- if (!hasValue && elem.required) {
1584
+ if (!hasValue && elem.required && elem.touched) {
1578
1585
  elem.validity = 'valueMissing';
1579
1586
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
1580
1587
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
@@ -1585,7 +1592,7 @@ class AuroFormValidation {
1585
1592
  }
1586
1593
  }
1587
1594
 
1588
- if (this.auroInputElements?.length > 0) {
1595
+ if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
1589
1596
  elem.validity = this.auroInputElements[0].validity;
1590
1597
  elem.errorMessage = this.auroInputElements[0].errorMessage;
1591
1598
 
@@ -1664,7 +1671,7 @@ class AuroFormValidation {
1664
1671
  }
1665
1672
  }
1666
1673
  } else {
1667
- elem.errorMessage = undefined;
1674
+ elem.errorMessage = '';
1668
1675
  }
1669
1676
  }
1670
1677
  }
@@ -104,7 +104,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
104
104
  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.
105
105
 
106
106
  ```html
107
- <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2.8/auro-datepicker/+esm"></script>
107
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-datepicker/+esm"></script>
108
108
  ```
109
109
  <!-- AURO-GENERATED-CONTENT:END -->
110
110