@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.
- package/components/checkbox/demo/api.min.js +16 -5
- package/components/checkbox/demo/index.min.js +16 -5
- package/components/checkbox/dist/index.js +16 -5
- package/components/checkbox/dist/registered.js +16 -5
- package/components/combobox/demo/api.md +1 -0
- package/components/combobox/demo/api.min.js +69 -48
- package/components/combobox/demo/index.min.js +69 -48
- package/components/combobox/dist/auro-combobox.d.ts +5 -0
- package/components/combobox/dist/index.js +69 -48
- package/components/combobox/dist/registered.js +69 -48
- package/components/counter/demo/api.min.js +32 -39
- package/components/counter/demo/index.min.js +32 -39
- package/components/counter/dist/index.js +32 -39
- package/components/counter/dist/registered.js +32 -39
- package/components/datepicker/demo/api.md +2 -0
- package/components/datepicker/demo/api.min.js +69 -107
- package/components/datepicker/demo/index.min.js +69 -107
- package/components/datepicker/dist/auro-datepicker.d.ts +6 -19
- package/components/datepicker/dist/index.js +69 -107
- package/components/datepicker/dist/registered.js +69 -107
- package/components/dropdown/demo/api.min.js +16 -33
- package/components/dropdown/demo/index.min.js +16 -33
- package/components/dropdown/dist/auro-dropdown.d.ts +0 -6
- package/components/dropdown/dist/index.js +16 -33
- package/components/dropdown/dist/registered.js +16 -33
- package/components/input/demo/api.md +2 -1
- package/components/input/demo/api.min.js +25 -7
- package/components/input/demo/index.min.js +25 -7
- package/components/input/dist/base-input.d.ts +5 -1
- package/components/input/dist/index.js +25 -7
- package/components/input/dist/registered.js +25 -7
- package/components/radio/demo/api.min.js +16 -5
- package/components/radio/demo/index.min.js +16 -5
- package/components/radio/dist/index.js +16 -5
- package/components/radio/dist/registered.js +16 -5
- package/components/select/demo/api.min.js +32 -38
- package/components/select/demo/index.min.js +32 -38
- package/components/select/dist/index.js +32 -38
- package/components/select/dist/registered.js +32 -38
- package/package.json +2 -2
|
@@ -220,12 +220,6 @@ export class AuroDropdown extends AuroElement {
|
|
|
220
220
|
shape: any;
|
|
221
221
|
size: any;
|
|
222
222
|
parentBorder: boolean;
|
|
223
|
-
/**
|
|
224
|
-
* Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
|
|
225
|
-
* @private
|
|
226
|
-
* @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
|
|
227
|
-
*/
|
|
228
|
-
private handleDropdownToggle;
|
|
229
223
|
/**
|
|
230
224
|
* @private
|
|
231
225
|
* @returns {object} Class definition for the wrapper element.
|
|
@@ -1689,7 +1689,7 @@ class AuroFloatingUI {
|
|
|
1689
1689
|
*/
|
|
1690
1690
|
mirrorSize() {
|
|
1691
1691
|
// mirror the boxsize from bibSizer
|
|
1692
|
-
if (this.element.bibSizer
|
|
1692
|
+
if (this.element.bibSizer) {
|
|
1693
1693
|
const sizerStyle = window.getComputedStyle(this.element.bibSizer);
|
|
1694
1694
|
const bibContent = this.element.bib.shadowRoot.querySelector(".container");
|
|
1695
1695
|
if (sizerStyle.width !== '0px') {
|
|
@@ -1901,13 +1901,13 @@ class AuroFloatingUI {
|
|
|
1901
1901
|
if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
|
|
1902
1902
|
return;
|
|
1903
1903
|
}
|
|
1904
|
-
|
|
1904
|
+
|
|
1905
1905
|
// if fullscreen bib is in fullscreen mode, do not close
|
|
1906
1906
|
if (this.element.bib.hasAttribute('isfullscreen')) {
|
|
1907
1907
|
return;
|
|
1908
1908
|
}
|
|
1909
1909
|
|
|
1910
|
-
this.hideBib(
|
|
1910
|
+
this.hideBib();
|
|
1911
1911
|
}
|
|
1912
1912
|
|
|
1913
1913
|
setupHideHandlers() {
|
|
@@ -1932,7 +1932,7 @@ class AuroFloatingUI {
|
|
|
1932
1932
|
document.expandedAuroFormkitDropdown = null;
|
|
1933
1933
|
document.expandedAuroFloater = this;
|
|
1934
1934
|
} else {
|
|
1935
|
-
this.hideBib(
|
|
1935
|
+
this.hideBib();
|
|
1936
1936
|
}
|
|
1937
1937
|
}
|
|
1938
1938
|
};
|
|
@@ -1945,7 +1945,7 @@ class AuroFloatingUI {
|
|
|
1945
1945
|
// if something else is open, let it handle itself
|
|
1946
1946
|
return;
|
|
1947
1947
|
}
|
|
1948
|
-
this.hideBib(
|
|
1948
|
+
this.hideBib();
|
|
1949
1949
|
}
|
|
1950
1950
|
};
|
|
1951
1951
|
|
|
@@ -2028,11 +2028,7 @@ class AuroFloatingUI {
|
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
2030
|
|
|
2031
|
-
|
|
2032
|
-
* Hides the floating UI element.
|
|
2033
|
-
* @param {String} eventType - The event type that triggered the hiding action.
|
|
2034
|
-
*/
|
|
2035
|
-
hideBib(eventType = "unknown") {
|
|
2031
|
+
hideBib() {
|
|
2036
2032
|
if (!this.element.disabled && !this.element.noToggle) {
|
|
2037
2033
|
this.lockScroll(false);
|
|
2038
2034
|
this.element.triggerChevron?.removeAttribute('data-expanded');
|
|
@@ -2043,7 +2039,7 @@ class AuroFloatingUI {
|
|
|
2043
2039
|
if (this.showing) {
|
|
2044
2040
|
this.cleanupHideHandlers();
|
|
2045
2041
|
this.showing = false;
|
|
2046
|
-
this.dispatchEventDropdownToggle(
|
|
2042
|
+
this.dispatchEventDropdownToggle();
|
|
2047
2043
|
}
|
|
2048
2044
|
}
|
|
2049
2045
|
document.expandedAuroFloater = null;
|
|
@@ -2052,13 +2048,11 @@ class AuroFloatingUI {
|
|
|
2052
2048
|
/**
|
|
2053
2049
|
* @private
|
|
2054
2050
|
* @returns {void} Dispatches event with an object showing the state of the dropdown.
|
|
2055
|
-
* @param {String} eventType - The event type that triggered the toggle action.
|
|
2056
2051
|
*/
|
|
2057
|
-
dispatchEventDropdownToggle(
|
|
2052
|
+
dispatchEventDropdownToggle() {
|
|
2058
2053
|
const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-toggled` : 'toggled', {
|
|
2059
2054
|
detail: {
|
|
2060
2055
|
expanded: this.showing,
|
|
2061
|
-
eventType: eventType || "unknown",
|
|
2062
2056
|
},
|
|
2063
2057
|
composed: true
|
|
2064
2058
|
});
|
|
@@ -2068,7 +2062,7 @@ class AuroFloatingUI {
|
|
|
2068
2062
|
|
|
2069
2063
|
handleClick() {
|
|
2070
2064
|
if (this.element.isPopoverVisible) {
|
|
2071
|
-
this.hideBib(
|
|
2065
|
+
this.hideBib();
|
|
2072
2066
|
} else {
|
|
2073
2067
|
this.showBib();
|
|
2074
2068
|
}
|
|
@@ -2095,7 +2089,7 @@ class AuroFloatingUI {
|
|
|
2095
2089
|
|
|
2096
2090
|
event.preventDefault();
|
|
2097
2091
|
this.handleClick();
|
|
2098
|
-
}
|
|
2092
|
+
}
|
|
2099
2093
|
break;
|
|
2100
2094
|
case 'mouseenter':
|
|
2101
2095
|
if (this.element.hoverToggle) {
|
|
@@ -2104,7 +2098,7 @@ class AuroFloatingUI {
|
|
|
2104
2098
|
break;
|
|
2105
2099
|
case 'mouseleave':
|
|
2106
2100
|
if (this.element.hoverToggle) {
|
|
2107
|
-
this.hideBib(
|
|
2101
|
+
this.hideBib();
|
|
2108
2102
|
}
|
|
2109
2103
|
break;
|
|
2110
2104
|
case 'focus':
|
|
@@ -3492,9 +3486,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3492
3486
|
|
|
3493
3487
|
this.parentBorder = false;
|
|
3494
3488
|
|
|
3495
|
-
/** @private */
|
|
3496
|
-
this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
|
|
3497
|
-
|
|
3498
3489
|
this.privateDefaults();
|
|
3499
3490
|
}
|
|
3500
3491
|
|
|
@@ -3928,19 +3919,12 @@ class AuroDropdown extends AuroElement {
|
|
|
3928
3919
|
if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
|
|
3929
3920
|
this.handleTriggerContentSlotChange();
|
|
3930
3921
|
}
|
|
3931
|
-
}
|
|
3932
3922
|
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
handleDropdownToggle(event) {
|
|
3939
|
-
this.updateFocusTrap();
|
|
3940
|
-
this.isPopoverVisible = event.detail.expanded;
|
|
3941
|
-
const eventType = event.detail.eventType || "unknown";
|
|
3942
|
-
if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
|
|
3943
|
-
this.trigger.focus();
|
|
3923
|
+
if (changedProperties.has('isPopoverVisible')) {
|
|
3924
|
+
this.updateFocusTrap();
|
|
3925
|
+
if (!this.isPopoverVisible && this.hasFocus) {
|
|
3926
|
+
this.trigger.focus();
|
|
3927
|
+
}
|
|
3944
3928
|
}
|
|
3945
3929
|
}
|
|
3946
3930
|
|
|
@@ -3948,7 +3932,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3948
3932
|
|
|
3949
3933
|
// Configure the floater to, this will generate the ID for the bib
|
|
3950
3934
|
this.floater.configure(this, 'auroDropdown');
|
|
3951
|
-
this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
|
|
3952
3935
|
|
|
3953
3936
|
/**
|
|
3954
3937
|
* @description Let subscribers know that the dropdown ID ha been generated and added.
|
|
@@ -1689,7 +1689,7 @@ class AuroFloatingUI {
|
|
|
1689
1689
|
*/
|
|
1690
1690
|
mirrorSize() {
|
|
1691
1691
|
// mirror the boxsize from bibSizer
|
|
1692
|
-
if (this.element.bibSizer
|
|
1692
|
+
if (this.element.bibSizer) {
|
|
1693
1693
|
const sizerStyle = window.getComputedStyle(this.element.bibSizer);
|
|
1694
1694
|
const bibContent = this.element.bib.shadowRoot.querySelector(".container");
|
|
1695
1695
|
if (sizerStyle.width !== '0px') {
|
|
@@ -1901,13 +1901,13 @@ class AuroFloatingUI {
|
|
|
1901
1901
|
if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
|
|
1902
1902
|
return;
|
|
1903
1903
|
}
|
|
1904
|
-
|
|
1904
|
+
|
|
1905
1905
|
// if fullscreen bib is in fullscreen mode, do not close
|
|
1906
1906
|
if (this.element.bib.hasAttribute('isfullscreen')) {
|
|
1907
1907
|
return;
|
|
1908
1908
|
}
|
|
1909
1909
|
|
|
1910
|
-
this.hideBib(
|
|
1910
|
+
this.hideBib();
|
|
1911
1911
|
}
|
|
1912
1912
|
|
|
1913
1913
|
setupHideHandlers() {
|
|
@@ -1932,7 +1932,7 @@ class AuroFloatingUI {
|
|
|
1932
1932
|
document.expandedAuroFormkitDropdown = null;
|
|
1933
1933
|
document.expandedAuroFloater = this;
|
|
1934
1934
|
} else {
|
|
1935
|
-
this.hideBib(
|
|
1935
|
+
this.hideBib();
|
|
1936
1936
|
}
|
|
1937
1937
|
}
|
|
1938
1938
|
};
|
|
@@ -1945,7 +1945,7 @@ class AuroFloatingUI {
|
|
|
1945
1945
|
// if something else is open, let it handle itself
|
|
1946
1946
|
return;
|
|
1947
1947
|
}
|
|
1948
|
-
this.hideBib(
|
|
1948
|
+
this.hideBib();
|
|
1949
1949
|
}
|
|
1950
1950
|
};
|
|
1951
1951
|
|
|
@@ -2028,11 +2028,7 @@ class AuroFloatingUI {
|
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
2030
|
|
|
2031
|
-
|
|
2032
|
-
* Hides the floating UI element.
|
|
2033
|
-
* @param {String} eventType - The event type that triggered the hiding action.
|
|
2034
|
-
*/
|
|
2035
|
-
hideBib(eventType = "unknown") {
|
|
2031
|
+
hideBib() {
|
|
2036
2032
|
if (!this.element.disabled && !this.element.noToggle) {
|
|
2037
2033
|
this.lockScroll(false);
|
|
2038
2034
|
this.element.triggerChevron?.removeAttribute('data-expanded');
|
|
@@ -2043,7 +2039,7 @@ class AuroFloatingUI {
|
|
|
2043
2039
|
if (this.showing) {
|
|
2044
2040
|
this.cleanupHideHandlers();
|
|
2045
2041
|
this.showing = false;
|
|
2046
|
-
this.dispatchEventDropdownToggle(
|
|
2042
|
+
this.dispatchEventDropdownToggle();
|
|
2047
2043
|
}
|
|
2048
2044
|
}
|
|
2049
2045
|
document.expandedAuroFloater = null;
|
|
@@ -2052,13 +2048,11 @@ class AuroFloatingUI {
|
|
|
2052
2048
|
/**
|
|
2053
2049
|
* @private
|
|
2054
2050
|
* @returns {void} Dispatches event with an object showing the state of the dropdown.
|
|
2055
|
-
* @param {String} eventType - The event type that triggered the toggle action.
|
|
2056
2051
|
*/
|
|
2057
|
-
dispatchEventDropdownToggle(
|
|
2052
|
+
dispatchEventDropdownToggle() {
|
|
2058
2053
|
const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-toggled` : 'toggled', {
|
|
2059
2054
|
detail: {
|
|
2060
2055
|
expanded: this.showing,
|
|
2061
|
-
eventType: eventType || "unknown",
|
|
2062
2056
|
},
|
|
2063
2057
|
composed: true
|
|
2064
2058
|
});
|
|
@@ -2068,7 +2062,7 @@ class AuroFloatingUI {
|
|
|
2068
2062
|
|
|
2069
2063
|
handleClick() {
|
|
2070
2064
|
if (this.element.isPopoverVisible) {
|
|
2071
|
-
this.hideBib(
|
|
2065
|
+
this.hideBib();
|
|
2072
2066
|
} else {
|
|
2073
2067
|
this.showBib();
|
|
2074
2068
|
}
|
|
@@ -2095,7 +2089,7 @@ class AuroFloatingUI {
|
|
|
2095
2089
|
|
|
2096
2090
|
event.preventDefault();
|
|
2097
2091
|
this.handleClick();
|
|
2098
|
-
}
|
|
2092
|
+
}
|
|
2099
2093
|
break;
|
|
2100
2094
|
case 'mouseenter':
|
|
2101
2095
|
if (this.element.hoverToggle) {
|
|
@@ -2104,7 +2098,7 @@ class AuroFloatingUI {
|
|
|
2104
2098
|
break;
|
|
2105
2099
|
case 'mouseleave':
|
|
2106
2100
|
if (this.element.hoverToggle) {
|
|
2107
|
-
this.hideBib(
|
|
2101
|
+
this.hideBib();
|
|
2108
2102
|
}
|
|
2109
2103
|
break;
|
|
2110
2104
|
case 'focus':
|
|
@@ -3492,9 +3486,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3492
3486
|
|
|
3493
3487
|
this.parentBorder = false;
|
|
3494
3488
|
|
|
3495
|
-
/** @private */
|
|
3496
|
-
this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
|
|
3497
|
-
|
|
3498
3489
|
this.privateDefaults();
|
|
3499
3490
|
}
|
|
3500
3491
|
|
|
@@ -3928,19 +3919,12 @@ class AuroDropdown extends AuroElement {
|
|
|
3928
3919
|
if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
|
|
3929
3920
|
this.handleTriggerContentSlotChange();
|
|
3930
3921
|
}
|
|
3931
|
-
}
|
|
3932
3922
|
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
handleDropdownToggle(event) {
|
|
3939
|
-
this.updateFocusTrap();
|
|
3940
|
-
this.isPopoverVisible = event.detail.expanded;
|
|
3941
|
-
const eventType = event.detail.eventType || "unknown";
|
|
3942
|
-
if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
|
|
3943
|
-
this.trigger.focus();
|
|
3923
|
+
if (changedProperties.has('isPopoverVisible')) {
|
|
3924
|
+
this.updateFocusTrap();
|
|
3925
|
+
if (!this.isPopoverVisible && this.hasFocus) {
|
|
3926
|
+
this.trigger.focus();
|
|
3927
|
+
}
|
|
3944
3928
|
}
|
|
3945
3929
|
}
|
|
3946
3930
|
|
|
@@ -3948,7 +3932,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3948
3932
|
|
|
3949
3933
|
// Configure the floater to, this will generate the ID for the bib
|
|
3950
3934
|
this.floater.configure(this, 'auroDropdown');
|
|
3951
|
-
this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
|
|
3952
3935
|
|
|
3953
3936
|
/**
|
|
3954
3937
|
* @description Let subscribers know that the dropdown ID ha been generated and added.
|
|
@@ -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
|
-
//
|
|
4850
|
+
// Check if validation should run
|
|
4851
4851
|
let validationShouldRun =
|
|
4852
|
+
|
|
4853
|
+
// If the validation was forced
|
|
4852
4854
|
force ||
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
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
|
-
//
|
|
4775
|
+
// Check if validation should run
|
|
4776
4776
|
let validationShouldRun =
|
|
4777
|
+
|
|
4778
|
+
// If the validation was forced
|
|
4777
4779
|
force ||
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
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
|
-
//
|
|
4699
|
+
// Check if validation should run
|
|
4700
4700
|
let validationShouldRun =
|
|
4701
|
+
|
|
4702
|
+
// If the validation was forced
|
|
4701
4703
|
force ||
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
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
|
-
//
|
|
4699
|
+
// Check if validation should run
|
|
4700
4700
|
let validationShouldRun =
|
|
4701
|
+
|
|
4702
|
+
// If the validation was forced
|
|
4701
4703
|
force ||
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
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
|
-
//
|
|
1085
|
+
// Check if validation should run
|
|
1086
1086
|
let validationShouldRun =
|
|
1087
|
+
|
|
1088
|
+
// If the validation was forced
|
|
1087
1089
|
force ||
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
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
|
-
//
|
|
1060
|
+
// Check if validation should run
|
|
1061
1061
|
let validationShouldRun =
|
|
1062
|
+
|
|
1063
|
+
// If the validation was forced
|
|
1062
1064
|
force ||
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
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
|
-
//
|
|
1013
|
+
// Check if validation should run
|
|
1014
1014
|
let validationShouldRun =
|
|
1015
|
+
|
|
1016
|
+
// If the validation was forced
|
|
1015
1017
|
force ||
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
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';
|