@aurodesignsystem/auro-formkit 3.3.0-beta.2 → 3.3.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/CHANGELOG.md +23 -0
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.md +1 -0
- package/components/checkbox/demo/api.min.js +34 -5
- package/components/checkbox/demo/index.min.js +34 -5
- package/components/checkbox/demo/readme.md +1 -1
- package/components/checkbox/dist/auro-checkbox-group.d.ts +7 -0
- package/components/checkbox/dist/auro-checkbox.d.ts +6 -0
- package/components/checkbox/dist/index.js +34 -5
- package/components/checkbox/dist/registered.js +34 -5
- package/components/combobox/README.md +1 -1
- package/components/combobox/demo/api.min.js +77 -57
- package/components/combobox/demo/index.min.js +77 -57
- package/components/combobox/demo/readme.md +1 -1
- package/components/combobox/dist/auro-combobox.d.ts +2 -10
- package/components/combobox/dist/index.js +77 -57
- package/components/combobox/dist/registered.js +77 -57
- package/components/counter/README.md +1 -1
- package/components/counter/demo/api.min.js +12 -5
- package/components/counter/demo/index.min.js +12 -5
- package/components/counter/demo/readme.md +1 -1
- package/components/counter/dist/index.js +12 -5
- package/components/counter/dist/registered.js +12 -5
- package/components/datepicker/README.md +1 -1
- package/components/datepicker/demo/api.min.js +54 -34
- package/components/datepicker/demo/index.min.js +54 -34
- package/components/datepicker/demo/readme.md +1 -1
- package/components/datepicker/dist/auro-datepicker.d.ts +8 -0
- package/components/datepicker/dist/index.js +54 -34
- package/components/datepicker/dist/registered.js +54 -34
- package/components/dropdown/README.md +1 -1
- package/components/dropdown/demo/readme.md +1 -1
- package/components/form/README.md +1 -1
- package/components/form/demo/readme.md +1 -1
- package/components/input/README.md +1 -1
- package/components/input/demo/api.min.js +26 -14
- package/components/input/demo/index.min.js +26 -14
- package/components/input/demo/readme.md +1 -1
- package/components/input/dist/base-input.d.ts +8 -0
- package/components/input/dist/index.js +26 -14
- package/components/input/dist/registered.js +26 -14
- package/components/menu/README.md +1 -1
- package/components/menu/demo/readme.md +1 -1
- package/components/radio/README.md +1 -1
- package/components/radio/demo/api.md +1 -0
- package/components/radio/demo/api.min.js +33 -9
- package/components/radio/demo/index.min.js +33 -9
- package/components/radio/demo/readme.md +1 -1
- package/components/radio/dist/auro-radio-group.d.ts +8 -0
- package/components/radio/dist/auro-radio.d.ts +5 -0
- package/components/radio/dist/index.js +33 -9
- package/components/radio/dist/registered.js +33 -9
- package/components/select/README.md +1 -1
- package/components/select/demo/api.min.js +25 -15
- package/components/select/demo/index.min.js +25 -15
- package/components/select/demo/readme.md +1 -1
- package/components/select/dist/auro-select.d.ts +8 -0
- package/components/select/dist/index.js +25 -15
- package/components/select/dist/registered.js +25 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
# [3.3.0](https://github.com/AlaskaAirlines/auro-formkit/compare/v3.2.8...v3.3.0) (2025-05-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* improved touched state handling ([07ae52f](https://github.com/AlaskaAirlines/auro-formkit/commit/07ae52f6e2c9de4a99d3ed820dec9dc86fb6e091))
|
|
9
|
+
* match `typeof event` to duplicate to bubble up in combobox [#576](https://github.com/AlaskaAirlines/auro-formkit/issues/576) ([0b6231b](https://github.com/AlaskaAirlines/auro-formkit/commit/0b6231bd52346d91a04088198fe6e8921c7ac299))
|
|
10
|
+
* pr feedback Apr 28, 2025 ([2dcd705](https://github.com/AlaskaAirlines/auro-formkit/commit/2dcd70543c206229286a69364b7e503c6e12fb5f))
|
|
11
|
+
* properly transport input on `strategy-change` in combobox ([23e079d](https://github.com/AlaskaAirlines/auro-formkit/commit/23e079d3f4ba5f22aaa8bd28cc80dd096c74e9b0))
|
|
12
|
+
* render match word in bold in a combobox with dynamic menu [#551](https://github.com/AlaskaAirlines/auro-formkit/issues/551) ([63b8dac](https://github.com/AlaskaAirlines/auro-formkit/commit/63b8dac663377a4af4038ed2c5e09e34bf155409))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* implement touched state for radio and select components on user interaction ([2f4b8f6](https://github.com/AlaskaAirlines/auro-formkit/commit/2f4b8f66f097cfb932a07e5d37dd05fb6fbafaab))
|
|
18
|
+
* surface fullscreenBreakpoint with new `disabled` value ([4f00b48](https://github.com/AlaskaAirlines/auro-formkit/commit/4f00b4808254490419ca6ae387344e49834ca896))
|
|
19
|
+
* update form validation to be based on pristine/dirty instead of undefined and '' values ([fc0bade](https://github.com/AlaskaAirlines/auro-formkit/commit/fc0bade112a8b4e801b2851c27069592b0f024bc))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Performance Improvements
|
|
23
|
+
|
|
24
|
+
* remove unnecessary variables ([87f3f80](https://github.com/AlaskaAirlines/auro-formkit/commit/87f3f80e17d6884a69726893bc4fc066d6934a94))
|
|
25
|
+
|
|
3
26
|
# [3.3.0-beta.2](https://github.com/AlaskaAirlines/auro-formkit/compare/v3.3.0-beta.1...v3.3.0-beta.2) (2025-05-09)
|
|
4
27
|
|
|
5
28
|
|
|
@@ -106,7 +106,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
106
106
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
107
107
|
|
|
108
108
|
```html
|
|
109
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
109
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-checkbox/+esm"></script>
|
|
110
110
|
```
|
|
111
111
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
112
112
|
|
|
@@ -56,6 +56,7 @@ Custom element for the purpose of allowing users to select one or more options o
|
|
|
56
56
|
| [id](#id) | `id` | `string` | | Sets the individual `id` per element. |
|
|
57
57
|
| [name](#name) | `name` | `string` | | Accepts any string and is used to identify related checkboxes when submitting form data. |
|
|
58
58
|
| [onDark](#onDark) | `onDark` | `boolean` | false | Sets onDark styles for component. |
|
|
59
|
+
| [touched](#touched) | `touched` | `boolean` | false | Indicates whether the checkbox has been interacted with. |
|
|
59
60
|
| [value](#value) | `value` | `string` | | Sets the element's input value. Must be unique within an auro-checkbox-group element. |
|
|
60
61
|
|
|
61
62
|
## Methods
|
|
@@ -149,6 +149,7 @@ class AuroCheckbox extends i$2 {
|
|
|
149
149
|
this.disabled = false;
|
|
150
150
|
this.error = false;
|
|
151
151
|
this.onDark = false;
|
|
152
|
+
this.touched = false;
|
|
152
153
|
|
|
153
154
|
/**
|
|
154
155
|
* @private
|
|
@@ -225,6 +226,15 @@ class AuroCheckbox extends i$2 {
|
|
|
225
226
|
value: {
|
|
226
227
|
type: String,
|
|
227
228
|
reflect: true
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Indicates whether the checkbox has been interacted with.
|
|
233
|
+
* @type {boolean}
|
|
234
|
+
*/
|
|
235
|
+
touched: {
|
|
236
|
+
type: Boolean,
|
|
237
|
+
reflect: true
|
|
228
238
|
}
|
|
229
239
|
};
|
|
230
240
|
}
|
|
@@ -279,6 +289,7 @@ class AuroCheckbox extends i$2 {
|
|
|
279
289
|
* @returns {void}
|
|
280
290
|
*/
|
|
281
291
|
handleFocusin() {
|
|
292
|
+
this.touched = true;
|
|
282
293
|
this.dispatchEvent(new CustomEvent('auroCheckbox-focusin', {
|
|
283
294
|
bubbles: true,
|
|
284
295
|
cancelable: false,
|
|
@@ -307,6 +318,7 @@ class AuroCheckbox extends i$2 {
|
|
|
307
318
|
reset() {
|
|
308
319
|
this.checked = false;
|
|
309
320
|
this.error = false;
|
|
321
|
+
this.touched = false;
|
|
310
322
|
}
|
|
311
323
|
|
|
312
324
|
firstUpdated() {
|
|
@@ -796,6 +808,7 @@ class AuroFormValidation {
|
|
|
796
808
|
reset(elem) {
|
|
797
809
|
elem.validity = undefined;
|
|
798
810
|
elem.value = undefined;
|
|
811
|
+
elem.touched = false;
|
|
799
812
|
|
|
800
813
|
// Resets the second value of the datepicker in range state
|
|
801
814
|
if (elem.valueEnd) {
|
|
@@ -933,7 +946,7 @@ class AuroFormValidation {
|
|
|
933
946
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
934
947
|
|
|
935
948
|
// Guard Clause: if the value is too short
|
|
936
|
-
if (elem.value
|
|
949
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
937
950
|
|
|
938
951
|
elem.validity = 'tooShort';
|
|
939
952
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -1003,11 +1016,17 @@ class AuroFormValidation {
|
|
|
1003
1016
|
this.getAuroInputs(elem);
|
|
1004
1017
|
|
|
1005
1018
|
// Validate only if noValidate is not true and the input does not have focus
|
|
1006
|
-
|
|
1019
|
+
let validationShouldRun =
|
|
1020
|
+
force ||
|
|
1021
|
+
(!elem.contains(document.activeElement) &&
|
|
1022
|
+
(elem.touched ||
|
|
1023
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1024
|
+
elem.validateOnInput;
|
|
1007
1025
|
|
|
1008
1026
|
if (elem.hasAttribute('error')) {
|
|
1009
1027
|
elem.validity = 'customError';
|
|
1010
1028
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1029
|
+
validationShouldRun = false;
|
|
1011
1030
|
} else if (validationShouldRun) {
|
|
1012
1031
|
elem.validity = 'valid';
|
|
1013
1032
|
elem.errorMessage = '';
|
|
@@ -1028,7 +1047,7 @@ class AuroFormValidation {
|
|
|
1028
1047
|
}
|
|
1029
1048
|
}
|
|
1030
1049
|
|
|
1031
|
-
if (!hasValue && elem.required) {
|
|
1050
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1032
1051
|
elem.validity = 'valueMissing';
|
|
1033
1052
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1034
1053
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1039,7 +1058,7 @@ class AuroFormValidation {
|
|
|
1039
1058
|
}
|
|
1040
1059
|
}
|
|
1041
1060
|
|
|
1042
|
-
if (this.auroInputElements?.length > 0) {
|
|
1061
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1043
1062
|
elem.validity = this.auroInputElements[0].validity;
|
|
1044
1063
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1045
1064
|
|
|
@@ -1118,7 +1137,7 @@ class AuroFormValidation {
|
|
|
1118
1137
|
}
|
|
1119
1138
|
}
|
|
1120
1139
|
} else {
|
|
1121
|
-
elem.errorMessage =
|
|
1140
|
+
elem.errorMessage = '';
|
|
1122
1141
|
}
|
|
1123
1142
|
}
|
|
1124
1143
|
}
|
|
@@ -1398,6 +1417,14 @@ class AuroCheckboxGroup extends i$2 {
|
|
|
1398
1417
|
this.horizontal = false;
|
|
1399
1418
|
this.onDark = false;
|
|
1400
1419
|
|
|
1420
|
+
/**
|
|
1421
|
+
* Indicates whether the checkbox group is in a dirty state (has been interacted with).
|
|
1422
|
+
* @type {boolean}
|
|
1423
|
+
* @default false
|
|
1424
|
+
* @private
|
|
1425
|
+
*/
|
|
1426
|
+
this.touched = false;
|
|
1427
|
+
|
|
1401
1428
|
/**
|
|
1402
1429
|
* @private
|
|
1403
1430
|
*/
|
|
@@ -1587,6 +1614,8 @@ class AuroCheckboxGroup extends i$2 {
|
|
|
1587
1614
|
};
|
|
1588
1615
|
|
|
1589
1616
|
this.addEventListener('auroCheckbox-focusin', () => {
|
|
1617
|
+
this.touched = true;
|
|
1618
|
+
|
|
1590
1619
|
if (!this.value) {
|
|
1591
1620
|
this.value = [];
|
|
1592
1621
|
}
|
|
@@ -141,6 +141,7 @@ class AuroCheckbox extends i$2 {
|
|
|
141
141
|
this.disabled = false;
|
|
142
142
|
this.error = false;
|
|
143
143
|
this.onDark = false;
|
|
144
|
+
this.touched = false;
|
|
144
145
|
|
|
145
146
|
/**
|
|
146
147
|
* @private
|
|
@@ -217,6 +218,15 @@ class AuroCheckbox extends i$2 {
|
|
|
217
218
|
value: {
|
|
218
219
|
type: String,
|
|
219
220
|
reflect: true
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Indicates whether the checkbox has been interacted with.
|
|
225
|
+
* @type {boolean}
|
|
226
|
+
*/
|
|
227
|
+
touched: {
|
|
228
|
+
type: Boolean,
|
|
229
|
+
reflect: true
|
|
220
230
|
}
|
|
221
231
|
};
|
|
222
232
|
}
|
|
@@ -271,6 +281,7 @@ class AuroCheckbox extends i$2 {
|
|
|
271
281
|
* @returns {void}
|
|
272
282
|
*/
|
|
273
283
|
handleFocusin() {
|
|
284
|
+
this.touched = true;
|
|
274
285
|
this.dispatchEvent(new CustomEvent('auroCheckbox-focusin', {
|
|
275
286
|
bubbles: true,
|
|
276
287
|
cancelable: false,
|
|
@@ -299,6 +310,7 @@ class AuroCheckbox extends i$2 {
|
|
|
299
310
|
reset() {
|
|
300
311
|
this.checked = false;
|
|
301
312
|
this.error = false;
|
|
313
|
+
this.touched = false;
|
|
302
314
|
}
|
|
303
315
|
|
|
304
316
|
firstUpdated() {
|
|
@@ -788,6 +800,7 @@ class AuroFormValidation {
|
|
|
788
800
|
reset(elem) {
|
|
789
801
|
elem.validity = undefined;
|
|
790
802
|
elem.value = undefined;
|
|
803
|
+
elem.touched = false;
|
|
791
804
|
|
|
792
805
|
// Resets the second value of the datepicker in range state
|
|
793
806
|
if (elem.valueEnd) {
|
|
@@ -925,7 +938,7 @@ class AuroFormValidation {
|
|
|
925
938
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
926
939
|
|
|
927
940
|
// Guard Clause: if the value is too short
|
|
928
|
-
if (elem.value
|
|
941
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
929
942
|
|
|
930
943
|
elem.validity = 'tooShort';
|
|
931
944
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -995,11 +1008,17 @@ class AuroFormValidation {
|
|
|
995
1008
|
this.getAuroInputs(elem);
|
|
996
1009
|
|
|
997
1010
|
// Validate only if noValidate is not true and the input does not have focus
|
|
998
|
-
|
|
1011
|
+
let validationShouldRun =
|
|
1012
|
+
force ||
|
|
1013
|
+
(!elem.contains(document.activeElement) &&
|
|
1014
|
+
(elem.touched ||
|
|
1015
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1016
|
+
elem.validateOnInput;
|
|
999
1017
|
|
|
1000
1018
|
if (elem.hasAttribute('error')) {
|
|
1001
1019
|
elem.validity = 'customError';
|
|
1002
1020
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1021
|
+
validationShouldRun = false;
|
|
1003
1022
|
} else if (validationShouldRun) {
|
|
1004
1023
|
elem.validity = 'valid';
|
|
1005
1024
|
elem.errorMessage = '';
|
|
@@ -1020,7 +1039,7 @@ class AuroFormValidation {
|
|
|
1020
1039
|
}
|
|
1021
1040
|
}
|
|
1022
1041
|
|
|
1023
|
-
if (!hasValue && elem.required) {
|
|
1042
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1024
1043
|
elem.validity = 'valueMissing';
|
|
1025
1044
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1026
1045
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1031,7 +1050,7 @@ class AuroFormValidation {
|
|
|
1031
1050
|
}
|
|
1032
1051
|
}
|
|
1033
1052
|
|
|
1034
|
-
if (this.auroInputElements?.length > 0) {
|
|
1053
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1035
1054
|
elem.validity = this.auroInputElements[0].validity;
|
|
1036
1055
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1037
1056
|
|
|
@@ -1110,7 +1129,7 @@ class AuroFormValidation {
|
|
|
1110
1129
|
}
|
|
1111
1130
|
}
|
|
1112
1131
|
} else {
|
|
1113
|
-
elem.errorMessage =
|
|
1132
|
+
elem.errorMessage = '';
|
|
1114
1133
|
}
|
|
1115
1134
|
}
|
|
1116
1135
|
}
|
|
@@ -1390,6 +1409,14 @@ class AuroCheckboxGroup extends i$2 {
|
|
|
1390
1409
|
this.horizontal = false;
|
|
1391
1410
|
this.onDark = false;
|
|
1392
1411
|
|
|
1412
|
+
/**
|
|
1413
|
+
* Indicates whether the checkbox group is in a dirty state (has been interacted with).
|
|
1414
|
+
* @type {boolean}
|
|
1415
|
+
* @default false
|
|
1416
|
+
* @private
|
|
1417
|
+
*/
|
|
1418
|
+
this.touched = false;
|
|
1419
|
+
|
|
1393
1420
|
/**
|
|
1394
1421
|
* @private
|
|
1395
1422
|
*/
|
|
@@ -1579,6 +1606,8 @@ class AuroCheckboxGroup extends i$2 {
|
|
|
1579
1606
|
};
|
|
1580
1607
|
|
|
1581
1608
|
this.addEventListener('auroCheckbox-focusin', () => {
|
|
1609
|
+
this.touched = true;
|
|
1610
|
+
|
|
1582
1611
|
if (!this.value) {
|
|
1583
1612
|
this.value = [];
|
|
1584
1613
|
}
|
|
@@ -106,7 +106,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
106
106
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
107
107
|
|
|
108
108
|
```html
|
|
109
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
109
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-checkbox/+esm"></script>
|
|
110
110
|
```
|
|
111
111
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
112
112
|
|
|
@@ -91,6 +91,13 @@ export class AuroCheckboxGroup extends LitElement {
|
|
|
91
91
|
required: boolean;
|
|
92
92
|
horizontal: boolean;
|
|
93
93
|
onDark: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Indicates whether the checkbox group is in a dirty state (has been interacted with).
|
|
96
|
+
* @type {boolean}
|
|
97
|
+
* @default false
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
private touched;
|
|
94
101
|
/**
|
|
95
102
|
* @private
|
|
96
103
|
*/
|
|
@@ -55,6 +55,11 @@ export class AuroCheckbox extends LitElement {
|
|
|
55
55
|
type: StringConstructor;
|
|
56
56
|
reflect: boolean;
|
|
57
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Indicates whether the checkbox has been interacted with.
|
|
60
|
+
* @type {boolean}
|
|
61
|
+
*/
|
|
62
|
+
touched: boolean;
|
|
58
63
|
};
|
|
59
64
|
/**
|
|
60
65
|
* This will register this element with the browser.
|
|
@@ -69,6 +74,7 @@ export class AuroCheckbox extends LitElement {
|
|
|
69
74
|
disabled: boolean;
|
|
70
75
|
error: boolean;
|
|
71
76
|
onDark: boolean;
|
|
77
|
+
touched: boolean;
|
|
72
78
|
/**
|
|
73
79
|
* @private
|
|
74
80
|
*/
|
|
@@ -101,6 +101,7 @@ class AuroCheckbox extends LitElement {
|
|
|
101
101
|
this.disabled = false;
|
|
102
102
|
this.error = false;
|
|
103
103
|
this.onDark = false;
|
|
104
|
+
this.touched = false;
|
|
104
105
|
|
|
105
106
|
/**
|
|
106
107
|
* @private
|
|
@@ -177,6 +178,15 @@ class AuroCheckbox extends LitElement {
|
|
|
177
178
|
value: {
|
|
178
179
|
type: String,
|
|
179
180
|
reflect: true
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Indicates whether the checkbox has been interacted with.
|
|
185
|
+
* @type {boolean}
|
|
186
|
+
*/
|
|
187
|
+
touched: {
|
|
188
|
+
type: Boolean,
|
|
189
|
+
reflect: true
|
|
180
190
|
}
|
|
181
191
|
};
|
|
182
192
|
}
|
|
@@ -231,6 +241,7 @@ class AuroCheckbox extends LitElement {
|
|
|
231
241
|
* @returns {void}
|
|
232
242
|
*/
|
|
233
243
|
handleFocusin() {
|
|
244
|
+
this.touched = true;
|
|
234
245
|
this.dispatchEvent(new CustomEvent('auroCheckbox-focusin', {
|
|
235
246
|
bubbles: true,
|
|
236
247
|
cancelable: false,
|
|
@@ -259,6 +270,7 @@ class AuroCheckbox extends LitElement {
|
|
|
259
270
|
reset() {
|
|
260
271
|
this.checked = false;
|
|
261
272
|
this.error = false;
|
|
273
|
+
this.touched = false;
|
|
262
274
|
}
|
|
263
275
|
|
|
264
276
|
firstUpdated() {
|
|
@@ -741,6 +753,7 @@ class AuroFormValidation {
|
|
|
741
753
|
reset(elem) {
|
|
742
754
|
elem.validity = undefined;
|
|
743
755
|
elem.value = undefined;
|
|
756
|
+
elem.touched = false;
|
|
744
757
|
|
|
745
758
|
// Resets the second value of the datepicker in range state
|
|
746
759
|
if (elem.valueEnd) {
|
|
@@ -878,7 +891,7 @@ class AuroFormValidation {
|
|
|
878
891
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
879
892
|
|
|
880
893
|
// Guard Clause: if the value is too short
|
|
881
|
-
if (elem.value
|
|
894
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
882
895
|
|
|
883
896
|
elem.validity = 'tooShort';
|
|
884
897
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -948,11 +961,17 @@ class AuroFormValidation {
|
|
|
948
961
|
this.getAuroInputs(elem);
|
|
949
962
|
|
|
950
963
|
// Validate only if noValidate is not true and the input does not have focus
|
|
951
|
-
|
|
964
|
+
let validationShouldRun =
|
|
965
|
+
force ||
|
|
966
|
+
(!elem.contains(document.activeElement) &&
|
|
967
|
+
(elem.touched ||
|
|
968
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
969
|
+
elem.validateOnInput;
|
|
952
970
|
|
|
953
971
|
if (elem.hasAttribute('error')) {
|
|
954
972
|
elem.validity = 'customError';
|
|
955
973
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
974
|
+
validationShouldRun = false;
|
|
956
975
|
} else if (validationShouldRun) {
|
|
957
976
|
elem.validity = 'valid';
|
|
958
977
|
elem.errorMessage = '';
|
|
@@ -973,7 +992,7 @@ class AuroFormValidation {
|
|
|
973
992
|
}
|
|
974
993
|
}
|
|
975
994
|
|
|
976
|
-
if (!hasValue && elem.required) {
|
|
995
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
977
996
|
elem.validity = 'valueMissing';
|
|
978
997
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
979
998
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -984,7 +1003,7 @@ class AuroFormValidation {
|
|
|
984
1003
|
}
|
|
985
1004
|
}
|
|
986
1005
|
|
|
987
|
-
if (this.auroInputElements?.length > 0) {
|
|
1006
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
988
1007
|
elem.validity = this.auroInputElements[0].validity;
|
|
989
1008
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
990
1009
|
|
|
@@ -1063,7 +1082,7 @@ class AuroFormValidation {
|
|
|
1063
1082
|
}
|
|
1064
1083
|
}
|
|
1065
1084
|
} else {
|
|
1066
|
-
elem.errorMessage =
|
|
1085
|
+
elem.errorMessage = '';
|
|
1067
1086
|
}
|
|
1068
1087
|
}
|
|
1069
1088
|
}
|
|
@@ -1343,6 +1362,14 @@ class AuroCheckboxGroup extends LitElement {
|
|
|
1343
1362
|
this.horizontal = false;
|
|
1344
1363
|
this.onDark = false;
|
|
1345
1364
|
|
|
1365
|
+
/**
|
|
1366
|
+
* Indicates whether the checkbox group is in a dirty state (has been interacted with).
|
|
1367
|
+
* @type {boolean}
|
|
1368
|
+
* @default false
|
|
1369
|
+
* @private
|
|
1370
|
+
*/
|
|
1371
|
+
this.touched = false;
|
|
1372
|
+
|
|
1346
1373
|
/**
|
|
1347
1374
|
* @private
|
|
1348
1375
|
*/
|
|
@@ -1532,6 +1559,8 @@ class AuroCheckboxGroup extends LitElement {
|
|
|
1532
1559
|
};
|
|
1533
1560
|
|
|
1534
1561
|
this.addEventListener('auroCheckbox-focusin', () => {
|
|
1562
|
+
this.touched = true;
|
|
1563
|
+
|
|
1535
1564
|
if (!this.value) {
|
|
1536
1565
|
this.value = [];
|
|
1537
1566
|
}
|
|
@@ -101,6 +101,7 @@ class AuroCheckbox extends LitElement {
|
|
|
101
101
|
this.disabled = false;
|
|
102
102
|
this.error = false;
|
|
103
103
|
this.onDark = false;
|
|
104
|
+
this.touched = false;
|
|
104
105
|
|
|
105
106
|
/**
|
|
106
107
|
* @private
|
|
@@ -177,6 +178,15 @@ class AuroCheckbox extends LitElement {
|
|
|
177
178
|
value: {
|
|
178
179
|
type: String,
|
|
179
180
|
reflect: true
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Indicates whether the checkbox has been interacted with.
|
|
185
|
+
* @type {boolean}
|
|
186
|
+
*/
|
|
187
|
+
touched: {
|
|
188
|
+
type: Boolean,
|
|
189
|
+
reflect: true
|
|
180
190
|
}
|
|
181
191
|
};
|
|
182
192
|
}
|
|
@@ -231,6 +241,7 @@ class AuroCheckbox extends LitElement {
|
|
|
231
241
|
* @returns {void}
|
|
232
242
|
*/
|
|
233
243
|
handleFocusin() {
|
|
244
|
+
this.touched = true;
|
|
234
245
|
this.dispatchEvent(new CustomEvent('auroCheckbox-focusin', {
|
|
235
246
|
bubbles: true,
|
|
236
247
|
cancelable: false,
|
|
@@ -259,6 +270,7 @@ class AuroCheckbox extends LitElement {
|
|
|
259
270
|
reset() {
|
|
260
271
|
this.checked = false;
|
|
261
272
|
this.error = false;
|
|
273
|
+
this.touched = false;
|
|
262
274
|
}
|
|
263
275
|
|
|
264
276
|
firstUpdated() {
|
|
@@ -741,6 +753,7 @@ class AuroFormValidation {
|
|
|
741
753
|
reset(elem) {
|
|
742
754
|
elem.validity = undefined;
|
|
743
755
|
elem.value = undefined;
|
|
756
|
+
elem.touched = false;
|
|
744
757
|
|
|
745
758
|
// Resets the second value of the datepicker in range state
|
|
746
759
|
if (elem.valueEnd) {
|
|
@@ -878,7 +891,7 @@ class AuroFormValidation {
|
|
|
878
891
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
879
892
|
|
|
880
893
|
// Guard Clause: if the value is too short
|
|
881
|
-
if (elem.value
|
|
894
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
882
895
|
|
|
883
896
|
elem.validity = 'tooShort';
|
|
884
897
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -948,11 +961,17 @@ class AuroFormValidation {
|
|
|
948
961
|
this.getAuroInputs(elem);
|
|
949
962
|
|
|
950
963
|
// Validate only if noValidate is not true and the input does not have focus
|
|
951
|
-
|
|
964
|
+
let validationShouldRun =
|
|
965
|
+
force ||
|
|
966
|
+
(!elem.contains(document.activeElement) &&
|
|
967
|
+
(elem.touched ||
|
|
968
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
969
|
+
elem.validateOnInput;
|
|
952
970
|
|
|
953
971
|
if (elem.hasAttribute('error')) {
|
|
954
972
|
elem.validity = 'customError';
|
|
955
973
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
974
|
+
validationShouldRun = false;
|
|
956
975
|
} else if (validationShouldRun) {
|
|
957
976
|
elem.validity = 'valid';
|
|
958
977
|
elem.errorMessage = '';
|
|
@@ -973,7 +992,7 @@ class AuroFormValidation {
|
|
|
973
992
|
}
|
|
974
993
|
}
|
|
975
994
|
|
|
976
|
-
if (!hasValue && elem.required) {
|
|
995
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
977
996
|
elem.validity = 'valueMissing';
|
|
978
997
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
979
998
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -984,7 +1003,7 @@ class AuroFormValidation {
|
|
|
984
1003
|
}
|
|
985
1004
|
}
|
|
986
1005
|
|
|
987
|
-
if (this.auroInputElements?.length > 0) {
|
|
1006
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
988
1007
|
elem.validity = this.auroInputElements[0].validity;
|
|
989
1008
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
990
1009
|
|
|
@@ -1063,7 +1082,7 @@ class AuroFormValidation {
|
|
|
1063
1082
|
}
|
|
1064
1083
|
}
|
|
1065
1084
|
} else {
|
|
1066
|
-
elem.errorMessage =
|
|
1085
|
+
elem.errorMessage = '';
|
|
1067
1086
|
}
|
|
1068
1087
|
}
|
|
1069
1088
|
}
|
|
@@ -1343,6 +1362,14 @@ class AuroCheckboxGroup extends LitElement {
|
|
|
1343
1362
|
this.horizontal = false;
|
|
1344
1363
|
this.onDark = false;
|
|
1345
1364
|
|
|
1365
|
+
/**
|
|
1366
|
+
* Indicates whether the checkbox group is in a dirty state (has been interacted with).
|
|
1367
|
+
* @type {boolean}
|
|
1368
|
+
* @default false
|
|
1369
|
+
* @private
|
|
1370
|
+
*/
|
|
1371
|
+
this.touched = false;
|
|
1372
|
+
|
|
1346
1373
|
/**
|
|
1347
1374
|
* @private
|
|
1348
1375
|
*/
|
|
@@ -1532,6 +1559,8 @@ class AuroCheckboxGroup extends LitElement {
|
|
|
1532
1559
|
};
|
|
1533
1560
|
|
|
1534
1561
|
this.addEventListener('auroCheckbox-focusin', () => {
|
|
1562
|
+
this.touched = true;
|
|
1563
|
+
|
|
1535
1564
|
if (!this.value) {
|
|
1536
1565
|
this.value = [];
|
|
1537
1566
|
}
|
|
@@ -111,7 +111,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
111
111
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
112
112
|
|
|
113
113
|
```html
|
|
114
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
114
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-combobox/+esm"></script>
|
|
115
115
|
```
|
|
116
116
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
117
117
|
|