@aurodesignsystem-dev/auro-formkit 0.0.0-pr783.1 → 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 (40) 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 +69 -48
  7. package/components/combobox/demo/index.min.js +69 -48
  8. package/components/combobox/dist/auro-combobox.d.ts +5 -0
  9. package/components/combobox/dist/index.js +69 -48
  10. package/components/combobox/dist/registered.js +69 -48
  11. package/components/counter/demo/api.min.js +32 -39
  12. package/components/counter/demo/index.min.js +32 -39
  13. package/components/counter/dist/index.js +32 -39
  14. package/components/counter/dist/registered.js +32 -39
  15. package/components/datepicker/demo/api.md +2 -0
  16. package/components/datepicker/demo/api.min.js +69 -107
  17. package/components/datepicker/demo/index.min.js +69 -107
  18. package/components/datepicker/dist/auro-datepicker.d.ts +6 -19
  19. package/components/datepicker/dist/index.js +69 -107
  20. package/components/datepicker/dist/registered.js +69 -107
  21. package/components/dropdown/demo/api.min.js +16 -33
  22. package/components/dropdown/demo/index.min.js +16 -33
  23. package/components/dropdown/dist/auro-dropdown.d.ts +0 -6
  24. package/components/dropdown/dist/index.js +16 -33
  25. package/components/dropdown/dist/registered.js +16 -33
  26. package/components/input/demo/api.md +2 -1
  27. package/components/input/demo/api.min.js +25 -7
  28. package/components/input/demo/index.min.js +25 -7
  29. package/components/input/dist/base-input.d.ts +5 -1
  30. package/components/input/dist/index.js +25 -7
  31. package/components/input/dist/registered.js +25 -7
  32. package/components/radio/demo/api.min.js +16 -5
  33. package/components/radio/demo/index.min.js +16 -5
  34. package/components/radio/dist/index.js +16 -5
  35. package/components/radio/dist/registered.js +16 -5
  36. package/components/select/demo/api.min.js +32 -38
  37. package/components/select/demo/index.min.js +32 -38
  38. package/components/select/dist/index.js +32 -38
  39. package/components/select/dist/registered.js +32 -38
  40. package/package.json +2 -2
@@ -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';
@@ -2788,7 +2799,7 @@ class AuroFloatingUI {
2788
2799
  */
2789
2800
  mirrorSize() {
2790
2801
  // mirror the boxsize from bibSizer
2791
- if (this.element.bibSizer && this.element.matchWidth) {
2802
+ if (this.element.bibSizer) {
2792
2803
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
2793
2804
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
2794
2805
  if (sizerStyle.width !== '0px') {
@@ -3000,13 +3011,13 @@ class AuroFloatingUI {
3000
3011
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
3001
3012
  return;
3002
3013
  }
3003
-
3014
+
3004
3015
  // if fullscreen bib is in fullscreen mode, do not close
3005
3016
  if (this.element.bib.hasAttribute('isfullscreen')) {
3006
3017
  return;
3007
3018
  }
3008
3019
 
3009
- this.hideBib("keydown");
3020
+ this.hideBib();
3010
3021
  }
3011
3022
 
3012
3023
  setupHideHandlers() {
@@ -3031,7 +3042,7 @@ class AuroFloatingUI {
3031
3042
  document.expandedAuroFormkitDropdown = null;
3032
3043
  document.expandedAuroFloater = this;
3033
3044
  } else {
3034
- this.hideBib("click");
3045
+ this.hideBib();
3035
3046
  }
3036
3047
  }
3037
3048
  };
@@ -3044,7 +3055,7 @@ class AuroFloatingUI {
3044
3055
  // if something else is open, let it handle itself
3045
3056
  return;
3046
3057
  }
3047
- this.hideBib("keydown");
3058
+ this.hideBib();
3048
3059
  }
3049
3060
  };
3050
3061
 
@@ -3127,11 +3138,7 @@ class AuroFloatingUI {
3127
3138
  }
3128
3139
  }
3129
3140
 
3130
- /**
3131
- * Hides the floating UI element.
3132
- * @param {String} eventType - The event type that triggered the hiding action.
3133
- */
3134
- hideBib(eventType = "unknown") {
3141
+ hideBib() {
3135
3142
  if (!this.element.disabled && !this.element.noToggle) {
3136
3143
  this.lockScroll(false);
3137
3144
  this.element.triggerChevron?.removeAttribute('data-expanded');
@@ -3142,7 +3149,7 @@ class AuroFloatingUI {
3142
3149
  if (this.showing) {
3143
3150
  this.cleanupHideHandlers();
3144
3151
  this.showing = false;
3145
- this.dispatchEventDropdownToggle(eventType);
3152
+ this.dispatchEventDropdownToggle();
3146
3153
  }
3147
3154
  }
3148
3155
  document.expandedAuroFloater = null;
@@ -3151,13 +3158,11 @@ class AuroFloatingUI {
3151
3158
  /**
3152
3159
  * @private
3153
3160
  * @returns {void} Dispatches event with an object showing the state of the dropdown.
3154
- * @param {String} eventType - The event type that triggered the toggle action.
3155
3161
  */
3156
- dispatchEventDropdownToggle(eventType) {
3162
+ dispatchEventDropdownToggle() {
3157
3163
  const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-toggled` : 'toggled', {
3158
3164
  detail: {
3159
3165
  expanded: this.showing,
3160
- eventType: eventType || "unknown",
3161
3166
  },
3162
3167
  composed: true
3163
3168
  });
@@ -3167,7 +3172,7 @@ class AuroFloatingUI {
3167
3172
 
3168
3173
  handleClick() {
3169
3174
  if (this.element.isPopoverVisible) {
3170
- this.hideBib("click");
3175
+ this.hideBib();
3171
3176
  } else {
3172
3177
  this.showBib();
3173
3178
  }
@@ -3194,7 +3199,7 @@ class AuroFloatingUI {
3194
3199
 
3195
3200
  event.preventDefault();
3196
3201
  this.handleClick();
3197
- }
3202
+ }
3198
3203
  break;
3199
3204
  case 'mouseenter':
3200
3205
  if (this.element.hoverToggle) {
@@ -3203,7 +3208,7 @@ class AuroFloatingUI {
3203
3208
  break;
3204
3209
  case 'mouseleave':
3205
3210
  if (this.element.hoverToggle) {
3206
- this.hideBib("mouseleave");
3211
+ this.hideBib();
3207
3212
  }
3208
3213
  break;
3209
3214
  case 'focus':
@@ -4591,9 +4596,6 @@ class AuroDropdown extends AuroElement$4 {
4591
4596
 
4592
4597
  this.parentBorder = false;
4593
4598
 
4594
- /** @private */
4595
- this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
4596
-
4597
4599
  this.privateDefaults();
4598
4600
  }
4599
4601
 
@@ -5027,19 +5029,12 @@ class AuroDropdown extends AuroElement$4 {
5027
5029
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
5028
5030
  this.handleTriggerContentSlotChange();
5029
5031
  }
5030
- }
5031
5032
 
5032
- /**
5033
- * Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
5034
- * @private
5035
- * @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
5036
- */
5037
- handleDropdownToggle(event) {
5038
- this.updateFocusTrap();
5039
- this.isPopoverVisible = event.detail.expanded;
5040
- const eventType = event.detail.eventType || "unknown";
5041
- if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
5042
- this.trigger.focus();
5033
+ if (changedProperties.has('isPopoverVisible')) {
5034
+ this.updateFocusTrap();
5035
+ if (!this.isPopoverVisible && this.hasFocus) {
5036
+ this.trigger.focus();
5037
+ }
5043
5038
  }
5044
5039
  }
5045
5040
 
@@ -5047,7 +5042,6 @@ class AuroDropdown extends AuroElement$4 {
5047
5042
 
5048
5043
  // Configure the floater to, this will generate the ID for the bib
5049
5044
  this.floater.configure(this, 'auroDropdown');
5050
- this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
5051
5045
 
5052
5046
  /**
5053
5047
  * @description Let subscribers know that the dropdown ID ha been generated and added.
@@ -10207,13 +10201,24 @@ class AuroFormValidation {
10207
10201
  this.getInputElements(elem);
10208
10202
  this.getAuroInputs(elem);
10209
10203
 
10210
- // Validate only if noValidate is not true and the input does not have focus
10204
+ // Check if validation should run
10211
10205
  let validationShouldRun =
10206
+
10207
+ // If the validation was forced
10212
10208
  force ||
10213
- (!elem.contains(document.activeElement) &&
10214
- (elem.touched ||
10215
- (!elem.touched && typeof elem.value !== "undefined"))) ||
10216
- 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
+ );
10217
10222
 
10218
10223
  if (elem.hasAttribute('error')) {
10219
10224
  elem.validity = 'customError';
@@ -11164,9 +11169,9 @@ class BaseInput extends AuroElement$2$1 {
11164
11169
  this.inputElement.value = "";
11165
11170
  this.value = "";
11166
11171
  this.labelElement.classList.remove('inputElement-label--sticky');
11172
+ this.notifyValueChanged();
11167
11173
  this.focus();
11168
11174
  this.validation.validate(this);
11169
- this.notifyValueChanged();
11170
11175
  }
11171
11176
 
11172
11177
  /**
@@ -11261,13 +11266,20 @@ class BaseInput extends AuroElement$2$1 {
11261
11266
  }
11262
11267
 
11263
11268
  /**
11264
- * Resets component to initial state.
11269
+ * Resets component to initial state, including resetting the touched state and validity.
11265
11270
  * @returns {void}
11266
11271
  */
11267
11272
  reset() {
11268
11273
  this.validation.reset(this);
11269
11274
  }
11270
11275
 
11276
+ /**
11277
+ * Clears the input value
11278
+ */
11279
+ clear() {
11280
+ this.value = undefined;
11281
+ }
11282
+
11271
11283
  /**
11272
11284
  * Sets configuration data used elsewhere based on the `type` attribute.
11273
11285
  * @private
@@ -16611,7 +16623,7 @@ class AuroCombobox extends AuroElement$1 {
16611
16623
  });
16612
16624
 
16613
16625
  this.menu.addEventListener('auroMenu-selectValueReset', () => {
16614
- this.reset();
16626
+ this.clear();
16615
16627
  });
16616
16628
  }
16617
16629
 
@@ -16631,7 +16643,7 @@ class AuroCombobox extends AuroElement$1 {
16631
16643
  });
16632
16644
 
16633
16645
  /**
16634
- * Validate every time we remove focus from the datepicker.
16646
+ * Validate every time we remove focus from the combo box.
16635
16647
  */
16636
16648
  this.addEventListener('focusout', () => {
16637
16649
  if (document.activeElement !== this) {
@@ -16836,7 +16848,16 @@ class AuroCombobox extends AuroElement$1 {
16836
16848
  */
16837
16849
  reset() {
16838
16850
  this.input.reset();
16851
+ this.menu.value = undefined;
16839
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();
16840
16861
  this.menu.value = undefined;
16841
16862
  }
16842
16863
 
@@ -16862,7 +16883,7 @@ class AuroCombobox extends AuroElement$1 {
16862
16883
  this.hideBib();
16863
16884
  }
16864
16885
  } else {
16865
- this.reset();
16886
+ this.clear();
16866
16887
  }
16867
16888
  }
16868
16889