@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
@@ -1042,13 +1042,24 @@ class AuroFormValidation {
1042
1042
  this.getInputElements(elem);
1043
1043
  this.getAuroInputs(elem);
1044
1044
 
1045
- // Validate only if noValidate is not true and the input does not have focus
1045
+ // Check if validation should run
1046
1046
  let validationShouldRun =
1047
+
1048
+ // If the validation was forced
1047
1049
  force ||
1048
- (!elem.contains(document.activeElement) &&
1049
- (elem.touched ||
1050
- (!elem.touched && typeof elem.value !== "undefined"))) ||
1051
- elem.validateOnInput;
1050
+
1051
+ // If the validation should run on input
1052
+ elem.validateOnInput ||
1053
+
1054
+ // State-based checks
1055
+ (
1056
+ // Element is not currently focused
1057
+ !elem.contains(document.activeElement) && // native input is not focused directly
1058
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
1059
+
1060
+ // And element has been touched or is untouched but has a value
1061
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
1062
+ );
1052
1063
 
1053
1064
  if (elem.hasAttribute('error')) {
1054
1065
  elem.validity = 'customError';
@@ -1034,13 +1034,24 @@ class AuroFormValidation {
1034
1034
  this.getInputElements(elem);
1035
1035
  this.getAuroInputs(elem);
1036
1036
 
1037
- // Validate only if noValidate is not true and the input does not have focus
1037
+ // Check if validation should run
1038
1038
  let validationShouldRun =
1039
+
1040
+ // If the validation was forced
1039
1041
  force ||
1040
- (!elem.contains(document.activeElement) &&
1041
- (elem.touched ||
1042
- (!elem.touched && typeof elem.value !== "undefined"))) ||
1043
- elem.validateOnInput;
1042
+
1043
+ // If the validation should run on input
1044
+ elem.validateOnInput ||
1045
+
1046
+ // State-based checks
1047
+ (
1048
+ // Element is not currently focused
1049
+ !elem.contains(document.activeElement) && // native input is not focused directly
1050
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
1051
+
1052
+ // And element has been touched or is untouched but has a value
1053
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
1054
+ );
1044
1055
 
1045
1056
  if (elem.hasAttribute('error')) {
1046
1057
  elem.validity = 'customError';
@@ -987,13 +987,24 @@ class AuroFormValidation {
987
987
  this.getInputElements(elem);
988
988
  this.getAuroInputs(elem);
989
989
 
990
- // Validate only if noValidate is not true and the input does not have focus
990
+ // Check if validation should run
991
991
  let validationShouldRun =
992
+
993
+ // If the validation was forced
992
994
  force ||
993
- (!elem.contains(document.activeElement) &&
994
- (elem.touched ||
995
- (!elem.touched && typeof elem.value !== "undefined"))) ||
996
- elem.validateOnInput;
995
+
996
+ // If the validation should run on input
997
+ elem.validateOnInput ||
998
+
999
+ // State-based checks
1000
+ (
1001
+ // Element is not currently focused
1002
+ !elem.contains(document.activeElement) && // native input is not focused directly
1003
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
1004
+
1005
+ // And element has been touched or is untouched but has a value
1006
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
1007
+ );
997
1008
 
998
1009
  if (elem.hasAttribute('error')) {
999
1010
  elem.validity = 'customError';
@@ -987,13 +987,24 @@ class AuroFormValidation {
987
987
  this.getInputElements(elem);
988
988
  this.getAuroInputs(elem);
989
989
 
990
- // Validate only if noValidate is not true and the input does not have focus
990
+ // Check if validation should run
991
991
  let validationShouldRun =
992
+
993
+ // If the validation was forced
992
994
  force ||
993
- (!elem.contains(document.activeElement) &&
994
- (elem.touched ||
995
- (!elem.touched && typeof elem.value !== "undefined"))) ||
996
- elem.validateOnInput;
995
+
996
+ // If the validation should run on input
997
+ elem.validateOnInput ||
998
+
999
+ // State-based checks
1000
+ (
1001
+ // Element is not currently focused
1002
+ !elem.contains(document.activeElement) && // native input is not focused directly
1003
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
1004
+
1005
+ // And element has been touched or is untouched but has a value
1006
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
1007
+ );
997
1008
 
998
1009
  if (elem.hasAttribute('error')) {
999
1010
  elem.validity = 'customError';
@@ -39,6 +39,7 @@
39
39
 
40
40
  | Method | Type | Description |
41
41
  |------------|----------------------------------------|--------------------------------------------------|
42
+ | [clear](#clear) | `(): void` | Clears the current value of the combobox. |
42
43
  | [focus](#focus) | `(): void` | Focuses the combobox trigger input. |
43
44
  | [isValid](#isValid) | `(): boolean` | Checks if the element is valid. |
44
45
  | [reset](#reset) | `(): void` | Resets component to initial state. |
@@ -954,13 +954,24 @@ let AuroFormValidation$1 = class AuroFormValidation {
954
954
  this.getInputElements(elem);
955
955
  this.getAuroInputs(elem);
956
956
 
957
- // Validate only if noValidate is not true and the input does not have focus
957
+ // Check if validation should run
958
958
  let validationShouldRun =
959
+
960
+ // If the validation was forced
959
961
  force ||
960
- (!elem.contains(document.activeElement) &&
961
- (elem.touched ||
962
- (!elem.touched && typeof elem.value !== "undefined"))) ||
963
- elem.validateOnInput;
962
+
963
+ // If the validation should run on input
964
+ elem.validateOnInput ||
965
+
966
+ // State-based checks
967
+ (
968
+ // Element is not currently focused
969
+ !elem.contains(document.activeElement) && // native input is not focused directly
970
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
971
+
972
+ // And element has been touched or is untouched but has a value
973
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
974
+ );
964
975
 
965
976
  if (elem.hasAttribute('error')) {
966
977
  elem.validity = 'customError';
@@ -10190,13 +10201,24 @@ class AuroFormValidation {
10190
10201
  this.getInputElements(elem);
10191
10202
  this.getAuroInputs(elem);
10192
10203
 
10193
- // Validate only if noValidate is not true and the input does not have focus
10204
+ // Check if validation should run
10194
10205
  let validationShouldRun =
10206
+
10207
+ // If the validation was forced
10195
10208
  force ||
10196
- (!elem.contains(document.activeElement) &&
10197
- (elem.touched ||
10198
- (!elem.touched && typeof elem.value !== "undefined"))) ||
10199
- elem.validateOnInput;
10209
+
10210
+ // If the validation should run on input
10211
+ elem.validateOnInput ||
10212
+
10213
+ // State-based checks
10214
+ (
10215
+ // Element is not currently focused
10216
+ !elem.contains(document.activeElement) && // native input is not focused directly
10217
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
10218
+
10219
+ // And element has been touched or is untouched but has a value
10220
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
10221
+ );
10200
10222
 
10201
10223
  if (elem.hasAttribute('error')) {
10202
10224
  elem.validity = 'customError';
@@ -11147,9 +11169,9 @@ class BaseInput extends AuroElement$2$1 {
11147
11169
  this.inputElement.value = "";
11148
11170
  this.value = "";
11149
11171
  this.labelElement.classList.remove('inputElement-label--sticky');
11172
+ this.notifyValueChanged();
11150
11173
  this.focus();
11151
11174
  this.validation.validate(this);
11152
- this.notifyValueChanged();
11153
11175
  }
11154
11176
 
11155
11177
  /**
@@ -11244,13 +11266,20 @@ class BaseInput extends AuroElement$2$1 {
11244
11266
  }
11245
11267
 
11246
11268
  /**
11247
- * Resets component to initial state.
11269
+ * Resets component to initial state, including resetting the touched state and validity.
11248
11270
  * @returns {void}
11249
11271
  */
11250
11272
  reset() {
11251
11273
  this.validation.reset(this);
11252
11274
  }
11253
11275
 
11276
+ /**
11277
+ * Clears the input value
11278
+ */
11279
+ clear() {
11280
+ this.value = undefined;
11281
+ }
11282
+
11254
11283
  /**
11255
11284
  * Sets configuration data used elsewhere based on the `type` attribute.
11256
11285
  * @private
@@ -16594,7 +16623,7 @@ class AuroCombobox extends AuroElement$1 {
16594
16623
  });
16595
16624
 
16596
16625
  this.menu.addEventListener('auroMenu-selectValueReset', () => {
16597
- this.reset();
16626
+ this.clear();
16598
16627
  });
16599
16628
  }
16600
16629
 
@@ -16614,7 +16643,7 @@ class AuroCombobox extends AuroElement$1 {
16614
16643
  });
16615
16644
 
16616
16645
  /**
16617
- * Validate every time we remove focus from the datepicker.
16646
+ * Validate every time we remove focus from the combo box.
16618
16647
  */
16619
16648
  this.addEventListener('focusout', () => {
16620
16649
  if (document.activeElement !== this) {
@@ -16819,7 +16848,16 @@ class AuroCombobox extends AuroElement$1 {
16819
16848
  */
16820
16849
  reset() {
16821
16850
  this.input.reset();
16851
+ this.menu.value = undefined;
16822
16852
  this.validation.reset(this);
16853
+ }
16854
+
16855
+ /**
16856
+ * Clears the current value of the combobox.
16857
+ * @returns {void}
16858
+ */
16859
+ clear() {
16860
+ this.input.clear();
16823
16861
  this.menu.value = undefined;
16824
16862
  }
16825
16863
 
@@ -16845,7 +16883,7 @@ class AuroCombobox extends AuroElement$1 {
16845
16883
  this.hideBib();
16846
16884
  }
16847
16885
  } else {
16848
- this.reset();
16886
+ this.clear();
16849
16887
  }
16850
16888
  }
16851
16889
 
@@ -812,13 +812,24 @@ let AuroFormValidation$1 = class AuroFormValidation {
812
812
  this.getInputElements(elem);
813
813
  this.getAuroInputs(elem);
814
814
 
815
- // Validate only if noValidate is not true and the input does not have focus
815
+ // Check if validation should run
816
816
  let validationShouldRun =
817
+
818
+ // If the validation was forced
817
819
  force ||
818
- (!elem.contains(document.activeElement) &&
819
- (elem.touched ||
820
- (!elem.touched && typeof elem.value !== "undefined"))) ||
821
- elem.validateOnInput;
820
+
821
+ // If the validation should run on input
822
+ elem.validateOnInput ||
823
+
824
+ // State-based checks
825
+ (
826
+ // Element is not currently focused
827
+ !elem.contains(document.activeElement) && // native input is not focused directly
828
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
829
+
830
+ // And element has been touched or is untouched but has a value
831
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
832
+ );
822
833
 
823
834
  if (elem.hasAttribute('error')) {
824
835
  elem.validity = 'customError';
@@ -10048,13 +10059,24 @@ class AuroFormValidation {
10048
10059
  this.getInputElements(elem);
10049
10060
  this.getAuroInputs(elem);
10050
10061
 
10051
- // Validate only if noValidate is not true and the input does not have focus
10062
+ // Check if validation should run
10052
10063
  let validationShouldRun =
10064
+
10065
+ // If the validation was forced
10053
10066
  force ||
10054
- (!elem.contains(document.activeElement) &&
10055
- (elem.touched ||
10056
- (!elem.touched && typeof elem.value !== "undefined"))) ||
10057
- elem.validateOnInput;
10067
+
10068
+ // If the validation should run on input
10069
+ elem.validateOnInput ||
10070
+
10071
+ // State-based checks
10072
+ (
10073
+ // Element is not currently focused
10074
+ !elem.contains(document.activeElement) && // native input is not focused directly
10075
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
10076
+
10077
+ // And element has been touched or is untouched but has a value
10078
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
10079
+ );
10058
10080
 
10059
10081
  if (elem.hasAttribute('error')) {
10060
10082
  elem.validity = 'customError';
@@ -11005,9 +11027,9 @@ class BaseInput extends AuroElement$2$1 {
11005
11027
  this.inputElement.value = "";
11006
11028
  this.value = "";
11007
11029
  this.labelElement.classList.remove('inputElement-label--sticky');
11030
+ this.notifyValueChanged();
11008
11031
  this.focus();
11009
11032
  this.validation.validate(this);
11010
- this.notifyValueChanged();
11011
11033
  }
11012
11034
 
11013
11035
  /**
@@ -11102,13 +11124,20 @@ class BaseInput extends AuroElement$2$1 {
11102
11124
  }
11103
11125
 
11104
11126
  /**
11105
- * Resets component to initial state.
11127
+ * Resets component to initial state, including resetting the touched state and validity.
11106
11128
  * @returns {void}
11107
11129
  */
11108
11130
  reset() {
11109
11131
  this.validation.reset(this);
11110
11132
  }
11111
11133
 
11134
+ /**
11135
+ * Clears the input value
11136
+ */
11137
+ clear() {
11138
+ this.value = undefined;
11139
+ }
11140
+
11112
11141
  /**
11113
11142
  * Sets configuration data used elsewhere based on the `type` attribute.
11114
11143
  * @private
@@ -16452,7 +16481,7 @@ class AuroCombobox extends AuroElement$1 {
16452
16481
  });
16453
16482
 
16454
16483
  this.menu.addEventListener('auroMenu-selectValueReset', () => {
16455
- this.reset();
16484
+ this.clear();
16456
16485
  });
16457
16486
  }
16458
16487
 
@@ -16472,7 +16501,7 @@ class AuroCombobox extends AuroElement$1 {
16472
16501
  });
16473
16502
 
16474
16503
  /**
16475
- * Validate every time we remove focus from the datepicker.
16504
+ * Validate every time we remove focus from the combo box.
16476
16505
  */
16477
16506
  this.addEventListener('focusout', () => {
16478
16507
  if (document.activeElement !== this) {
@@ -16677,7 +16706,16 @@ class AuroCombobox extends AuroElement$1 {
16677
16706
  */
16678
16707
  reset() {
16679
16708
  this.input.reset();
16709
+ this.menu.value = undefined;
16680
16710
  this.validation.reset(this);
16711
+ }
16712
+
16713
+ /**
16714
+ * Clears the current value of the combobox.
16715
+ * @returns {void}
16716
+ */
16717
+ clear() {
16718
+ this.input.clear();
16681
16719
  this.menu.value = undefined;
16682
16720
  }
16683
16721
 
@@ -16703,7 +16741,7 @@ class AuroCombobox extends AuroElement$1 {
16703
16741
  this.hideBib();
16704
16742
  }
16705
16743
  } else {
16706
- this.reset();
16744
+ this.clear();
16707
16745
  }
16708
16746
  }
16709
16747
 
@@ -390,6 +390,11 @@ export class AuroCombobox extends AuroElement {
390
390
  * @returns {void}
391
391
  */
392
392
  reset(): void;
393
+ /**
394
+ * Clears the current value of the combobox.
395
+ * @returns {void}
396
+ */
397
+ clear(): void;
393
398
  /**
394
399
  * Validates value.
395
400
  * @param {boolean} [force=false] - Whether to force validation.
@@ -749,13 +749,24 @@ let AuroFormValidation$1 = class AuroFormValidation {
749
749
  this.getInputElements(elem);
750
750
  this.getAuroInputs(elem);
751
751
 
752
- // Validate only if noValidate is not true and the input does not have focus
752
+ // Check if validation should run
753
753
  let validationShouldRun =
754
+
755
+ // If the validation was forced
754
756
  force ||
755
- (!elem.contains(document.activeElement) &&
756
- (elem.touched ||
757
- (!elem.touched && typeof elem.value !== "undefined"))) ||
758
- elem.validateOnInput;
757
+
758
+ // If the validation should run on input
759
+ elem.validateOnInput ||
760
+
761
+ // State-based checks
762
+ (
763
+ // Element is not currently focused
764
+ !elem.contains(document.activeElement) && // native input is not focused directly
765
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
766
+
767
+ // And element has been touched or is untouched but has a value
768
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
769
+ );
759
770
 
760
771
  if (elem.hasAttribute('error')) {
761
772
  elem.validity = 'customError';
@@ -9966,13 +9977,24 @@ class AuroFormValidation {
9966
9977
  this.getInputElements(elem);
9967
9978
  this.getAuroInputs(elem);
9968
9979
 
9969
- // Validate only if noValidate is not true and the input does not have focus
9980
+ // Check if validation should run
9970
9981
  let validationShouldRun =
9982
+
9983
+ // If the validation was forced
9971
9984
  force ||
9972
- (!elem.contains(document.activeElement) &&
9973
- (elem.touched ||
9974
- (!elem.touched && typeof elem.value !== "undefined"))) ||
9975
- elem.validateOnInput;
9985
+
9986
+ // If the validation should run on input
9987
+ elem.validateOnInput ||
9988
+
9989
+ // State-based checks
9990
+ (
9991
+ // Element is not currently focused
9992
+ !elem.contains(document.activeElement) && // native input is not focused directly
9993
+ !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
9994
+
9995
+ // And element has been touched or is untouched but has a value
9996
+ ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
9997
+ );
9976
9998
 
9977
9999
  if (elem.hasAttribute('error')) {
9978
10000
  elem.validity = 'customError';
@@ -10923,9 +10945,9 @@ class BaseInput extends AuroElement$2$1 {
10923
10945
  this.inputElement.value = "";
10924
10946
  this.value = "";
10925
10947
  this.labelElement.classList.remove('inputElement-label--sticky');
10948
+ this.notifyValueChanged();
10926
10949
  this.focus();
10927
10950
  this.validation.validate(this);
10928
- this.notifyValueChanged();
10929
10951
  }
10930
10952
 
10931
10953
  /**
@@ -11020,13 +11042,20 @@ class BaseInput extends AuroElement$2$1 {
11020
11042
  }
11021
11043
 
11022
11044
  /**
11023
- * Resets component to initial state.
11045
+ * Resets component to initial state, including resetting the touched state and validity.
11024
11046
  * @returns {void}
11025
11047
  */
11026
11048
  reset() {
11027
11049
  this.validation.reset(this);
11028
11050
  }
11029
11051
 
11052
+ /**
11053
+ * Clears the input value
11054
+ */
11055
+ clear() {
11056
+ this.value = undefined;
11057
+ }
11058
+
11030
11059
  /**
11031
11060
  * Sets configuration data used elsewhere based on the `type` attribute.
11032
11061
  * @private
@@ -16370,7 +16399,7 @@ class AuroCombobox extends AuroElement {
16370
16399
  });
16371
16400
 
16372
16401
  this.menu.addEventListener('auroMenu-selectValueReset', () => {
16373
- this.reset();
16402
+ this.clear();
16374
16403
  });
16375
16404
  }
16376
16405
 
@@ -16390,7 +16419,7 @@ class AuroCombobox extends AuroElement {
16390
16419
  });
16391
16420
 
16392
16421
  /**
16393
- * Validate every time we remove focus from the datepicker.
16422
+ * Validate every time we remove focus from the combo box.
16394
16423
  */
16395
16424
  this.addEventListener('focusout', () => {
16396
16425
  if (document.activeElement !== this) {
@@ -16595,7 +16624,16 @@ class AuroCombobox extends AuroElement {
16595
16624
  */
16596
16625
  reset() {
16597
16626
  this.input.reset();
16627
+ this.menu.value = undefined;
16598
16628
  this.validation.reset(this);
16629
+ }
16630
+
16631
+ /**
16632
+ * Clears the current value of the combobox.
16633
+ * @returns {void}
16634
+ */
16635
+ clear() {
16636
+ this.input.clear();
16599
16637
  this.menu.value = undefined;
16600
16638
  }
16601
16639
 
@@ -16621,7 +16659,7 @@ class AuroCombobox extends AuroElement {
16621
16659
  this.hideBib();
16622
16660
  }
16623
16661
  } else {
16624
- this.reset();
16662
+ this.clear();
16625
16663
  }
16626
16664
  }
16627
16665