@aurodesignsystem-dev/auro-formkit 0.0.0-pr783.0 → 0.0.0-pr784.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 (35) hide show
  1. package/components/checkbox/demo/api.min.js +16 -5
  2. package/components/checkbox/demo/index.min.js +16 -5
  3. package/components/checkbox/dist/index.js +16 -5
  4. package/components/checkbox/dist/registered.js +16 -5
  5. package/components/combobox/demo/api.md +1 -0
  6. package/components/combobox/demo/api.min.js +53 -15
  7. package/components/combobox/demo/index.min.js +53 -15
  8. package/components/combobox/dist/auro-combobox.d.ts +5 -0
  9. package/components/combobox/dist/index.js +53 -15
  10. package/components/combobox/dist/registered.js +53 -15
  11. package/components/counter/demo/api.min.js +16 -6
  12. package/components/counter/demo/index.min.js +16 -6
  13. package/components/counter/dist/index.js +16 -6
  14. package/components/counter/dist/registered.js +16 -6
  15. package/components/datepicker/demo/api.md +1 -0
  16. package/components/datepicker/demo/api.min.js +50 -14
  17. package/components/datepicker/demo/index.min.js +50 -14
  18. package/components/datepicker/dist/auro-datepicker.d.ts +5 -0
  19. package/components/datepicker/dist/index.js +50 -14
  20. package/components/datepicker/dist/registered.js +50 -14
  21. package/components/input/demo/api.md +2 -1
  22. package/components/input/demo/api.min.js +25 -7
  23. package/components/input/demo/index.min.js +25 -7
  24. package/components/input/dist/base-input.d.ts +5 -1
  25. package/components/input/dist/index.js +25 -7
  26. package/components/input/dist/registered.js +25 -7
  27. package/components/radio/demo/api.min.js +16 -5
  28. package/components/radio/demo/index.min.js +16 -5
  29. package/components/radio/dist/index.js +16 -5
  30. package/components/radio/dist/registered.js +16 -5
  31. package/components/select/demo/api.min.js +16 -5
  32. package/components/select/demo/index.min.js +16 -5
  33. package/components/select/dist/index.js +16 -5
  34. package/components/select/dist/registered.js +16 -5
  35. package/package.json +1 -1
@@ -710,13 +710,24 @@ let AuroFormValidation$1 = class AuroFormValidation {
710
710
  this.getInputElements(elem);
711
711
  this.getAuroInputs(elem);
712
712
 
713
- // Validate only if noValidate is not true and the input does not have focus
713
+ // Check if validation should run
714
714
  let validationShouldRun =
715
+
716
+ // If the validation was forced
715
717
  force ||
716
- (!elem.contains(document.activeElement) &&
717
- (elem.touched ||
718
- (!elem.touched && typeof elem.value !== "undefined"))) ||
719
- elem.validateOnInput;
718
+
719
+ // If the validation should run on input
720
+ elem.validateOnInput ||
721
+
722
+ // State-based checks
723
+ (
724
+ // Element is not currently focused
725
+ !elem.contains(document.activeElement) && // native input is not focused directly
726
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
727
+
728
+ // And element has been touched or is untouched but has a value
729
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
730
+ );
720
731
 
721
732
  if (elem.hasAttribute('error')) {
722
733
  elem.validity = 'customError';
@@ -23184,13 +23195,24 @@ class AuroFormValidation {
23184
23195
  this.getInputElements(elem);
23185
23196
  this.getAuroInputs(elem);
23186
23197
 
23187
- // Validate only if noValidate is not true and the input does not have focus
23198
+ // Check if validation should run
23188
23199
  let validationShouldRun =
23200
+
23201
+ // If the validation was forced
23189
23202
  force ||
23190
- (!elem.contains(document.activeElement) &&
23191
- (elem.touched ||
23192
- (!elem.touched && typeof elem.value !== "undefined"))) ||
23193
- elem.validateOnInput;
23203
+
23204
+ // If the validation should run on input
23205
+ elem.validateOnInput ||
23206
+
23207
+ // State-based checks
23208
+ (
23209
+ // Element is not currently focused
23210
+ !elem.contains(document.activeElement) && // native input is not focused directly
23211
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
23212
+
23213
+ // And element has been touched or is untouched but has a value
23214
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
23215
+ );
23194
23216
 
23195
23217
  if (elem.hasAttribute('error')) {
23196
23218
  elem.validity = 'customError';
@@ -24141,9 +24163,9 @@ class BaseInput extends AuroElement$2 {
24141
24163
  this.inputElement.value = "";
24142
24164
  this.value = "";
24143
24165
  this.labelElement.classList.remove('inputElement-label--sticky');
24166
+ this.notifyValueChanged();
24144
24167
  this.focus();
24145
24168
  this.validation.validate(this);
24146
- this.notifyValueChanged();
24147
24169
  }
24148
24170
 
24149
24171
  /**
@@ -24238,13 +24260,20 @@ class BaseInput extends AuroElement$2 {
24238
24260
  }
24239
24261
 
24240
24262
  /**
24241
- * Resets component to initial state.
24263
+ * Resets component to initial state, including resetting the touched state and validity.
24242
24264
  * @returns {void}
24243
24265
  */
24244
24266
  reset() {
24245
24267
  this.validation.reset(this);
24246
24268
  }
24247
24269
 
24270
+ /**
24271
+ * Clears the input value
24272
+ */
24273
+ clear() {
24274
+ this.value = undefined;
24275
+ }
24276
+
24248
24277
  /**
24249
24278
  * Sets configuration data used elsewhere based on the `type` attribute.
24250
24279
  * @private
@@ -28359,7 +28388,7 @@ class AuroDatePicker extends AuroElement$1 {
28359
28388
  */
28360
28389
  resetValues() {
28361
28390
  this.inputList.forEach((input) => {
28362
- input.reset();
28391
+ input.clear();
28363
28392
  });
28364
28393
  }
28365
28394
 
@@ -28369,10 +28398,17 @@ class AuroDatePicker extends AuroElement$1 {
28369
28398
  */
28370
28399
  reset() {
28371
28400
  this.resetValues();
28372
-
28373
28401
  this.validation.reset(this);
28374
28402
  }
28375
28403
 
28404
+ /**
28405
+ * Clears the current value(s) of the datepicker.
28406
+ * @returns {void}
28407
+ */
28408
+ clear() {
28409
+ this.resetValues();
28410
+ }
28411
+
28376
28412
  /**
28377
28413
  * Validates value.
28378
28414
  * @param {boolean} [force=false] - Whether to force validation.
@@ -60,8 +60,9 @@ Generate unique names for dependency components.
60
60
 
61
61
  | Method | Type | Description |
62
62
  |------------|----------------------------------------|--------------------------------------------------|
63
+ | [clear](#clear) | `(): void` | Clears the input value |
63
64
  | [focus](#focus) | `(): void` | Function to set element focus. |
64
- | [reset](#reset) | `(): void` | Resets component to initial state. |
65
+ | [reset](#reset) | `(): void` | Resets component to initial state, including resetting the touched state and validity. |
65
66
  | [validate](#validate) | `(force?: boolean \| undefined): void` | Validates value.<br /><br />**force**: Whether to force validation. |
66
67
 
67
68
  ## Events
@@ -4847,13 +4847,24 @@ class AuroFormValidation {
4847
4847
  this.getInputElements(elem);
4848
4848
  this.getAuroInputs(elem);
4849
4849
 
4850
- // Validate only if noValidate is not true and the input does not have focus
4850
+ // Check if validation should run
4851
4851
  let validationShouldRun =
4852
+
4853
+ // If the validation was forced
4852
4854
  force ||
4853
- (!elem.contains(document.activeElement) &&
4854
- (elem.touched ||
4855
- (!elem.touched && typeof elem.value !== "undefined"))) ||
4856
- elem.validateOnInput;
4855
+
4856
+ // If the validation should run on input
4857
+ elem.validateOnInput ||
4858
+
4859
+ // State-based checks
4860
+ (
4861
+ // Element is not currently focused
4862
+ !elem.contains(document.activeElement) && // native input is not focused directly
4863
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
4864
+
4865
+ // And element has been touched or is untouched but has a value
4866
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
4867
+ );
4857
4868
 
4858
4869
  if (elem.hasAttribute('error')) {
4859
4870
  elem.validity = 'customError';
@@ -5804,9 +5815,9 @@ class BaseInput extends AuroElement$2 {
5804
5815
  this.inputElement.value = "";
5805
5816
  this.value = "";
5806
5817
  this.labelElement.classList.remove('inputElement-label--sticky');
5818
+ this.notifyValueChanged();
5807
5819
  this.focus();
5808
5820
  this.validation.validate(this);
5809
- this.notifyValueChanged();
5810
5821
  }
5811
5822
 
5812
5823
  /**
@@ -5901,13 +5912,20 @@ class BaseInput extends AuroElement$2 {
5901
5912
  }
5902
5913
 
5903
5914
  /**
5904
- * Resets component to initial state.
5915
+ * Resets component to initial state, including resetting the touched state and validity.
5905
5916
  * @returns {void}
5906
5917
  */
5907
5918
  reset() {
5908
5919
  this.validation.reset(this);
5909
5920
  }
5910
5921
 
5922
+ /**
5923
+ * Clears the input value
5924
+ */
5925
+ clear() {
5926
+ this.value = undefined;
5927
+ }
5928
+
5911
5929
  /**
5912
5930
  * Sets configuration data used elsewhere based on the `type` attribute.
5913
5931
  * @private
@@ -4772,13 +4772,24 @@ class AuroFormValidation {
4772
4772
  this.getInputElements(elem);
4773
4773
  this.getAuroInputs(elem);
4774
4774
 
4775
- // Validate only if noValidate is not true and the input does not have focus
4775
+ // Check if validation should run
4776
4776
  let validationShouldRun =
4777
+
4778
+ // If the validation was forced
4777
4779
  force ||
4778
- (!elem.contains(document.activeElement) &&
4779
- (elem.touched ||
4780
- (!elem.touched && typeof elem.value !== "undefined"))) ||
4781
- elem.validateOnInput;
4780
+
4781
+ // If the validation should run on input
4782
+ elem.validateOnInput ||
4783
+
4784
+ // State-based checks
4785
+ (
4786
+ // Element is not currently focused
4787
+ !elem.contains(document.activeElement) && // native input is not focused directly
4788
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
4789
+
4790
+ // And element has been touched or is untouched but has a value
4791
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
4792
+ );
4782
4793
 
4783
4794
  if (elem.hasAttribute('error')) {
4784
4795
  elem.validity = 'customError';
@@ -5729,9 +5740,9 @@ class BaseInput extends AuroElement$2 {
5729
5740
  this.inputElement.value = "";
5730
5741
  this.value = "";
5731
5742
  this.labelElement.classList.remove('inputElement-label--sticky');
5743
+ this.notifyValueChanged();
5732
5744
  this.focus();
5733
5745
  this.validation.validate(this);
5734
- this.notifyValueChanged();
5735
5746
  }
5736
5747
 
5737
5748
  /**
@@ -5826,13 +5837,20 @@ class BaseInput extends AuroElement$2 {
5826
5837
  }
5827
5838
 
5828
5839
  /**
5829
- * Resets component to initial state.
5840
+ * Resets component to initial state, including resetting the touched state and validity.
5830
5841
  * @returns {void}
5831
5842
  */
5832
5843
  reset() {
5833
5844
  this.validation.reset(this);
5834
5845
  }
5835
5846
 
5847
+ /**
5848
+ * Clears the input value
5849
+ */
5850
+ clear() {
5851
+ this.value = undefined;
5852
+ }
5853
+
5836
5854
  /**
5837
5855
  * Sets configuration data used elsewhere based on the `type` attribute.
5838
5856
  * @private
@@ -486,10 +486,14 @@ export default class BaseInput extends AuroElement {
486
486
  */
487
487
  validate(force?: boolean): void;
488
488
  /**
489
- * Resets component to initial state.
489
+ * Resets component to initial state, including resetting the touched state and validity.
490
490
  * @returns {void}
491
491
  */
492
492
  reset(): void;
493
+ /**
494
+ * Clears the input value
495
+ */
496
+ clear(): void;
493
497
  /**
494
498
  * Sets configuration data used elsewhere based on the `type` attribute.
495
499
  * @private
@@ -4696,13 +4696,24 @@ class AuroFormValidation {
4696
4696
  this.getInputElements(elem);
4697
4697
  this.getAuroInputs(elem);
4698
4698
 
4699
- // Validate only if noValidate is not true and the input does not have focus
4699
+ // Check if validation should run
4700
4700
  let validationShouldRun =
4701
+
4702
+ // If the validation was forced
4701
4703
  force ||
4702
- (!elem.contains(document.activeElement) &&
4703
- (elem.touched ||
4704
- (!elem.touched && typeof elem.value !== "undefined"))) ||
4705
- elem.validateOnInput;
4704
+
4705
+ // If the validation should run on input
4706
+ elem.validateOnInput ||
4707
+
4708
+ // State-based checks
4709
+ (
4710
+ // Element is not currently focused
4711
+ !elem.contains(document.activeElement) && // native input is not focused directly
4712
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
4713
+
4714
+ // And element has been touched or is untouched but has a value
4715
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
4716
+ );
4706
4717
 
4707
4718
  if (elem.hasAttribute('error')) {
4708
4719
  elem.validity = 'customError';
@@ -5653,9 +5664,9 @@ class BaseInput extends AuroElement$2 {
5653
5664
  this.inputElement.value = "";
5654
5665
  this.value = "";
5655
5666
  this.labelElement.classList.remove('inputElement-label--sticky');
5667
+ this.notifyValueChanged();
5656
5668
  this.focus();
5657
5669
  this.validation.validate(this);
5658
- this.notifyValueChanged();
5659
5670
  }
5660
5671
 
5661
5672
  /**
@@ -5750,13 +5761,20 @@ class BaseInput extends AuroElement$2 {
5750
5761
  }
5751
5762
 
5752
5763
  /**
5753
- * Resets component to initial state.
5764
+ * Resets component to initial state, including resetting the touched state and validity.
5754
5765
  * @returns {void}
5755
5766
  */
5756
5767
  reset() {
5757
5768
  this.validation.reset(this);
5758
5769
  }
5759
5770
 
5771
+ /**
5772
+ * Clears the input value
5773
+ */
5774
+ clear() {
5775
+ this.value = undefined;
5776
+ }
5777
+
5760
5778
  /**
5761
5779
  * Sets configuration data used elsewhere based on the `type` attribute.
5762
5780
  * @private
@@ -4696,13 +4696,24 @@ class AuroFormValidation {
4696
4696
  this.getInputElements(elem);
4697
4697
  this.getAuroInputs(elem);
4698
4698
 
4699
- // Validate only if noValidate is not true and the input does not have focus
4699
+ // Check if validation should run
4700
4700
  let validationShouldRun =
4701
+
4702
+ // If the validation was forced
4701
4703
  force ||
4702
- (!elem.contains(document.activeElement) &&
4703
- (elem.touched ||
4704
- (!elem.touched && typeof elem.value !== "undefined"))) ||
4705
- elem.validateOnInput;
4704
+
4705
+ // If the validation should run on input
4706
+ elem.validateOnInput ||
4707
+
4708
+ // State-based checks
4709
+ (
4710
+ // Element is not currently focused
4711
+ !elem.contains(document.activeElement) && // native input is not focused directly
4712
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
4713
+
4714
+ // And element has been touched or is untouched but has a value
4715
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
4716
+ );
4706
4717
 
4707
4718
  if (elem.hasAttribute('error')) {
4708
4719
  elem.validity = 'customError';
@@ -5653,9 +5664,9 @@ class BaseInput extends AuroElement$2 {
5653
5664
  this.inputElement.value = "";
5654
5665
  this.value = "";
5655
5666
  this.labelElement.classList.remove('inputElement-label--sticky');
5667
+ this.notifyValueChanged();
5656
5668
  this.focus();
5657
5669
  this.validation.validate(this);
5658
- this.notifyValueChanged();
5659
5670
  }
5660
5671
 
5661
5672
  /**
@@ -5750,13 +5761,20 @@ class BaseInput extends AuroElement$2 {
5750
5761
  }
5751
5762
 
5752
5763
  /**
5753
- * Resets component to initial state.
5764
+ * Resets component to initial state, including resetting the touched state and validity.
5754
5765
  * @returns {void}
5755
5766
  */
5756
5767
  reset() {
5757
5768
  this.validation.reset(this);
5758
5769
  }
5759
5770
 
5771
+ /**
5772
+ * Clears the input value
5773
+ */
5774
+ clear() {
5775
+ this.value = undefined;
5776
+ }
5777
+
5760
5778
  /**
5761
5779
  * Sets configuration data used elsewhere based on the `type` attribute.
5762
5780
  * @private
@@ -1082,13 +1082,24 @@ class AuroFormValidation {
1082
1082
  this.getInputElements(elem);
1083
1083
  this.getAuroInputs(elem);
1084
1084
 
1085
- // Validate only if noValidate is not true and the input does not have focus
1085
+ // Check if validation should run
1086
1086
  let validationShouldRun =
1087
+
1088
+ // If the validation was forced
1087
1089
  force ||
1088
- (!elem.contains(document.activeElement) &&
1089
- (elem.touched ||
1090
- (!elem.touched && typeof elem.value !== "undefined"))) ||
1091
- elem.validateOnInput;
1090
+
1091
+ // If the validation should run on input
1092
+ elem.validateOnInput ||
1093
+
1094
+ // State-based checks
1095
+ (
1096
+ // Element is not currently focused
1097
+ !elem.contains(document.activeElement) && // native input is not focused directly
1098
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
1099
+
1100
+ // And element has been touched or is untouched but has a value
1101
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
1102
+ );
1092
1103
 
1093
1104
  if (elem.hasAttribute('error')) {
1094
1105
  elem.validity = 'customError';
@@ -1057,13 +1057,24 @@ class AuroFormValidation {
1057
1057
  this.getInputElements(elem);
1058
1058
  this.getAuroInputs(elem);
1059
1059
 
1060
- // Validate only if noValidate is not true and the input does not have focus
1060
+ // Check if validation should run
1061
1061
  let validationShouldRun =
1062
+
1063
+ // If the validation was forced
1062
1064
  force ||
1063
- (!elem.contains(document.activeElement) &&
1064
- (elem.touched ||
1065
- (!elem.touched && typeof elem.value !== "undefined"))) ||
1066
- elem.validateOnInput;
1065
+
1066
+ // If the validation should run on input
1067
+ elem.validateOnInput ||
1068
+
1069
+ // State-based checks
1070
+ (
1071
+ // Element is not currently focused
1072
+ !elem.contains(document.activeElement) && // native input is not focused directly
1073
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
1074
+
1075
+ // And element has been touched or is untouched but has a value
1076
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
1077
+ );
1067
1078
 
1068
1079
  if (elem.hasAttribute('error')) {
1069
1080
  elem.validity = 'customError';
@@ -1010,13 +1010,24 @@ class AuroFormValidation {
1010
1010
  this.getInputElements(elem);
1011
1011
  this.getAuroInputs(elem);
1012
1012
 
1013
- // Validate only if noValidate is not true and the input does not have focus
1013
+ // Check if validation should run
1014
1014
  let validationShouldRun =
1015
+
1016
+ // If the validation was forced
1015
1017
  force ||
1016
- (!elem.contains(document.activeElement) &&
1017
- (elem.touched ||
1018
- (!elem.touched && typeof elem.value !== "undefined"))) ||
1019
- elem.validateOnInput;
1018
+
1019
+ // If the validation should run on input
1020
+ elem.validateOnInput ||
1021
+
1022
+ // State-based checks
1023
+ (
1024
+ // Element is not currently focused
1025
+ !elem.contains(document.activeElement) && // native input is not focused directly
1026
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
1027
+
1028
+ // And element has been touched or is untouched but has a value
1029
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
1030
+ );
1020
1031
 
1021
1032
  if (elem.hasAttribute('error')) {
1022
1033
  elem.validity = 'customError';
@@ -1010,13 +1010,24 @@ class AuroFormValidation {
1010
1010
  this.getInputElements(elem);
1011
1011
  this.getAuroInputs(elem);
1012
1012
 
1013
- // Validate only if noValidate is not true and the input does not have focus
1013
+ // Check if validation should run
1014
1014
  let validationShouldRun =
1015
+
1016
+ // If the validation was forced
1015
1017
  force ||
1016
- (!elem.contains(document.activeElement) &&
1017
- (elem.touched ||
1018
- (!elem.touched && typeof elem.value !== "undefined"))) ||
1019
- elem.validateOnInput;
1018
+
1019
+ // If the validation should run on input
1020
+ elem.validateOnInput ||
1021
+
1022
+ // State-based checks
1023
+ (
1024
+ // Element is not currently focused
1025
+ !elem.contains(document.activeElement) && // native input is not focused directly
1026
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
1027
+
1028
+ // And element has been touched or is untouched but has a value
1029
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
1030
+ );
1020
1031
 
1021
1032
  if (elem.hasAttribute('error')) {
1022
1033
  elem.validity = 'customError';
@@ -940,13 +940,24 @@ class AuroFormValidation {
940
940
  this.getInputElements(elem);
941
941
  this.getAuroInputs(elem);
942
942
 
943
- // Validate only if noValidate is not true and the input does not have focus
943
+ // Check if validation should run
944
944
  let validationShouldRun =
945
+
946
+ // If the validation was forced
945
947
  force ||
946
- (!elem.contains(document.activeElement) &&
947
- (elem.touched ||
948
- (!elem.touched && typeof elem.value !== "undefined"))) ||
949
- elem.validateOnInput;
948
+
949
+ // If the validation should run on input
950
+ elem.validateOnInput ||
951
+
952
+ // State-based checks
953
+ (
954
+ // Element is not currently focused
955
+ !elem.contains(document.activeElement) && // native input is not focused directly
956
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
957
+
958
+ // And element has been touched or is untouched but has a value
959
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
960
+ );
950
961
 
951
962
  if (elem.hasAttribute('error')) {
952
963
  elem.validity = 'customError';
@@ -848,13 +848,24 @@ class AuroFormValidation {
848
848
  this.getInputElements(elem);
849
849
  this.getAuroInputs(elem);
850
850
 
851
- // Validate only if noValidate is not true and the input does not have focus
851
+ // Check if validation should run
852
852
  let validationShouldRun =
853
+
854
+ // If the validation was forced
853
855
  force ||
854
- (!elem.contains(document.activeElement) &&
855
- (elem.touched ||
856
- (!elem.touched && typeof elem.value !== "undefined"))) ||
857
- elem.validateOnInput;
856
+
857
+ // If the validation should run on input
858
+ elem.validateOnInput ||
859
+
860
+ // State-based checks
861
+ (
862
+ // Element is not currently focused
863
+ !elem.contains(document.activeElement) && // native input is not focused directly
864
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
865
+
866
+ // And element has been touched or is untouched but has a value
867
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
868
+ );
858
869
 
859
870
  if (elem.hasAttribute('error')) {
860
871
  elem.validity = 'customError';
@@ -808,13 +808,24 @@ class AuroFormValidation {
808
808
  this.getInputElements(elem);
809
809
  this.getAuroInputs(elem);
810
810
 
811
- // Validate only if noValidate is not true and the input does not have focus
811
+ // Check if validation should run
812
812
  let validationShouldRun =
813
+
814
+ // If the validation was forced
813
815
  force ||
814
- (!elem.contains(document.activeElement) &&
815
- (elem.touched ||
816
- (!elem.touched && typeof elem.value !== "undefined"))) ||
817
- elem.validateOnInput;
816
+
817
+ // If the validation should run on input
818
+ elem.validateOnInput ||
819
+
820
+ // State-based checks
821
+ (
822
+ // Element is not currently focused
823
+ !elem.contains(document.activeElement) && // native input is not focused directly
824
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
825
+
826
+ // And element has been touched or is untouched but has a value
827
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
828
+ );
818
829
 
819
830
  if (elem.hasAttribute('error')) {
820
831
  elem.validity = 'customError';
@@ -808,13 +808,24 @@ class AuroFormValidation {
808
808
  this.getInputElements(elem);
809
809
  this.getAuroInputs(elem);
810
810
 
811
- // Validate only if noValidate is not true and the input does not have focus
811
+ // Check if validation should run
812
812
  let validationShouldRun =
813
+
814
+ // If the validation was forced
813
815
  force ||
814
- (!elem.contains(document.activeElement) &&
815
- (elem.touched ||
816
- (!elem.touched && typeof elem.value !== "undefined"))) ||
817
- elem.validateOnInput;
816
+
817
+ // If the validation should run on input
818
+ elem.validateOnInput ||
819
+
820
+ // State-based checks
821
+ (
822
+ // Element is not currently focused
823
+ !elem.contains(document.activeElement) && // native input is not focused directly
824
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
825
+
826
+ // And element has been touched or is untouched but has a value
827
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
828
+ );
818
829
 
819
830
  if (elem.hasAttribute('error')) {
820
831
  elem.validity = 'customError';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem-dev/auro-formkit",
3
- "version": "0.0.0-pr783.0",
3
+ "version": "0.0.0-pr784.0",
4
4
  "description": "A collection of web components used to build forms.",
5
5
  "homepage": "https://github.com/AlaskaAirlines/auro-formkit#readme",
6
6
  "bugs": {