@aurodesignsystem/auro-formkit 3.3.0-beta.2 → 3.4.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 +30 -0
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.min.js +36 -5
- package/components/checkbox/demo/index.min.js +36 -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 +7 -0
- package/components/checkbox/dist/index.js +36 -5
- package/components/checkbox/dist/registered.js +36 -5
- package/components/combobox/README.md +1 -1
- package/components/combobox/demo/api.md +44 -0
- package/components/combobox/demo/api.min.js +95 -60
- package/components/combobox/demo/index.min.js +95 -60
- package/components/combobox/demo/readme.md +1 -1
- package/components/combobox/dist/auro-combobox.d.ts +8 -10
- package/components/combobox/dist/index.js +95 -60
- package/components/combobox/dist/registered.js +95 -60
- 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.md +30 -0
- package/components/datepicker/demo/api.min.js +72 -37
- package/components/datepicker/demo/index.min.js +72 -37
- package/components/datepicker/demo/readme.md +1 -1
- package/components/datepicker/dist/auro-datepicker.d.ts +14 -0
- package/components/datepicker/dist/index.js +72 -37
- package/components/datepicker/dist/registered.js +72 -37
- 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.md +24 -0
- package/components/input/demo/api.min.js +36 -17
- package/components/input/demo/index.min.js +36 -17
- package/components/input/demo/readme.md +1 -1
- package/components/input/dist/base-input.d.ts +15 -0
- package/components/input/dist/index.js +36 -17
- package/components/input/dist/registered.js +36 -17
- 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.min.js +39 -9
- package/components/radio/demo/index.min.js +39 -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 +10 -0
- package/components/radio/dist/index.js +39 -9
- package/components/radio/dist/registered.js +39 -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,35 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
# [3.4.0](https://github.com/AlaskaAirlines/auro-formkit/compare/v3.3.0...v3.4.0) (2025-05-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* expose inputmode attribute for auro-input ([2066d3a](https://github.com/AlaskaAirlines/auro-formkit/commit/2066d3a174a2e37c2ad5e33f867710c8da5ed0ca))
|
|
9
|
+
|
|
10
|
+
# [3.3.0](https://github.com/AlaskaAirlines/auro-formkit/compare/v3.2.8...v3.3.0) (2025-05-12)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* improved touched state handling ([07ae52f](https://github.com/AlaskaAirlines/auro-formkit/commit/07ae52f6e2c9de4a99d3ed820dec9dc86fb6e091))
|
|
16
|
+
* 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))
|
|
17
|
+
* pr feedback Apr 28, 2025 ([2dcd705](https://github.com/AlaskaAirlines/auro-formkit/commit/2dcd70543c206229286a69364b7e503c6e12fb5f))
|
|
18
|
+
* properly transport input on `strategy-change` in combobox ([23e079d](https://github.com/AlaskaAirlines/auro-formkit/commit/23e079d3f4ba5f22aaa8bd28cc80dd096c74e9b0))
|
|
19
|
+
* 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))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* implement touched state for radio and select components on user interaction ([2f4b8f6](https://github.com/AlaskaAirlines/auro-formkit/commit/2f4b8f66f097cfb932a07e5d37dd05fb6fbafaab))
|
|
25
|
+
* surface fullscreenBreakpoint with new `disabled` value ([4f00b48](https://github.com/AlaskaAirlines/auro-formkit/commit/4f00b4808254490419ca6ae387344e49834ca896))
|
|
26
|
+
* update form validation to be based on pristine/dirty instead of undefined and '' values ([fc0bade](https://github.com/AlaskaAirlines/auro-formkit/commit/fc0bade112a8b4e801b2851c27069592b0f024bc))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Performance Improvements
|
|
30
|
+
|
|
31
|
+
* remove unnecessary variables ([87f3f80](https://github.com/AlaskaAirlines/auro-formkit/commit/87f3f80e17d6884a69726893bc4fc066d6934a94))
|
|
32
|
+
|
|
3
33
|
# [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
34
|
|
|
5
35
|
|
|
@@ -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.
|
|
109
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-checkbox/+esm"></script>
|
|
110
110
|
```
|
|
111
111
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
112
112
|
|
|
@@ -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,17 @@ 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
|
+
* @private
|
|
235
|
+
*/
|
|
236
|
+
touched: {
|
|
237
|
+
type: Boolean,
|
|
238
|
+
reflect: true,
|
|
239
|
+
attribute: false
|
|
228
240
|
}
|
|
229
241
|
};
|
|
230
242
|
}
|
|
@@ -279,6 +291,7 @@ class AuroCheckbox extends i$2 {
|
|
|
279
291
|
* @returns {void}
|
|
280
292
|
*/
|
|
281
293
|
handleFocusin() {
|
|
294
|
+
this.touched = true;
|
|
282
295
|
this.dispatchEvent(new CustomEvent('auroCheckbox-focusin', {
|
|
283
296
|
bubbles: true,
|
|
284
297
|
cancelable: false,
|
|
@@ -307,6 +320,7 @@ class AuroCheckbox extends i$2 {
|
|
|
307
320
|
reset() {
|
|
308
321
|
this.checked = false;
|
|
309
322
|
this.error = false;
|
|
323
|
+
this.touched = false;
|
|
310
324
|
}
|
|
311
325
|
|
|
312
326
|
firstUpdated() {
|
|
@@ -796,6 +810,7 @@ class AuroFormValidation {
|
|
|
796
810
|
reset(elem) {
|
|
797
811
|
elem.validity = undefined;
|
|
798
812
|
elem.value = undefined;
|
|
813
|
+
elem.touched = false;
|
|
799
814
|
|
|
800
815
|
// Resets the second value of the datepicker in range state
|
|
801
816
|
if (elem.valueEnd) {
|
|
@@ -933,7 +948,7 @@ class AuroFormValidation {
|
|
|
933
948
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
934
949
|
|
|
935
950
|
// Guard Clause: if the value is too short
|
|
936
|
-
if (elem.value
|
|
951
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
937
952
|
|
|
938
953
|
elem.validity = 'tooShort';
|
|
939
954
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -1003,11 +1018,17 @@ class AuroFormValidation {
|
|
|
1003
1018
|
this.getAuroInputs(elem);
|
|
1004
1019
|
|
|
1005
1020
|
// Validate only if noValidate is not true and the input does not have focus
|
|
1006
|
-
|
|
1021
|
+
let validationShouldRun =
|
|
1022
|
+
force ||
|
|
1023
|
+
(!elem.contains(document.activeElement) &&
|
|
1024
|
+
(elem.touched ||
|
|
1025
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1026
|
+
elem.validateOnInput;
|
|
1007
1027
|
|
|
1008
1028
|
if (elem.hasAttribute('error')) {
|
|
1009
1029
|
elem.validity = 'customError';
|
|
1010
1030
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1031
|
+
validationShouldRun = false;
|
|
1011
1032
|
} else if (validationShouldRun) {
|
|
1012
1033
|
elem.validity = 'valid';
|
|
1013
1034
|
elem.errorMessage = '';
|
|
@@ -1028,7 +1049,7 @@ class AuroFormValidation {
|
|
|
1028
1049
|
}
|
|
1029
1050
|
}
|
|
1030
1051
|
|
|
1031
|
-
if (!hasValue && elem.required) {
|
|
1052
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1032
1053
|
elem.validity = 'valueMissing';
|
|
1033
1054
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1034
1055
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1039,7 +1060,7 @@ class AuroFormValidation {
|
|
|
1039
1060
|
}
|
|
1040
1061
|
}
|
|
1041
1062
|
|
|
1042
|
-
if (this.auroInputElements?.length > 0) {
|
|
1063
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1043
1064
|
elem.validity = this.auroInputElements[0].validity;
|
|
1044
1065
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1045
1066
|
|
|
@@ -1118,7 +1139,7 @@ class AuroFormValidation {
|
|
|
1118
1139
|
}
|
|
1119
1140
|
}
|
|
1120
1141
|
} else {
|
|
1121
|
-
elem.errorMessage =
|
|
1142
|
+
elem.errorMessage = '';
|
|
1122
1143
|
}
|
|
1123
1144
|
}
|
|
1124
1145
|
}
|
|
@@ -1398,6 +1419,14 @@ class AuroCheckboxGroup extends i$2 {
|
|
|
1398
1419
|
this.horizontal = false;
|
|
1399
1420
|
this.onDark = false;
|
|
1400
1421
|
|
|
1422
|
+
/**
|
|
1423
|
+
* Indicates whether the checkbox group is in a dirty state (has been interacted with).
|
|
1424
|
+
* @type {boolean}
|
|
1425
|
+
* @default false
|
|
1426
|
+
* @private
|
|
1427
|
+
*/
|
|
1428
|
+
this.touched = false;
|
|
1429
|
+
|
|
1401
1430
|
/**
|
|
1402
1431
|
* @private
|
|
1403
1432
|
*/
|
|
@@ -1587,6 +1616,8 @@ class AuroCheckboxGroup extends i$2 {
|
|
|
1587
1616
|
};
|
|
1588
1617
|
|
|
1589
1618
|
this.addEventListener('auroCheckbox-focusin', () => {
|
|
1619
|
+
this.touched = true;
|
|
1620
|
+
|
|
1590
1621
|
if (!this.value) {
|
|
1591
1622
|
this.value = [];
|
|
1592
1623
|
}
|
|
@@ -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,17 @@ 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
|
+
* @private
|
|
227
|
+
*/
|
|
228
|
+
touched: {
|
|
229
|
+
type: Boolean,
|
|
230
|
+
reflect: true,
|
|
231
|
+
attribute: false
|
|
220
232
|
}
|
|
221
233
|
};
|
|
222
234
|
}
|
|
@@ -271,6 +283,7 @@ class AuroCheckbox extends i$2 {
|
|
|
271
283
|
* @returns {void}
|
|
272
284
|
*/
|
|
273
285
|
handleFocusin() {
|
|
286
|
+
this.touched = true;
|
|
274
287
|
this.dispatchEvent(new CustomEvent('auroCheckbox-focusin', {
|
|
275
288
|
bubbles: true,
|
|
276
289
|
cancelable: false,
|
|
@@ -299,6 +312,7 @@ class AuroCheckbox extends i$2 {
|
|
|
299
312
|
reset() {
|
|
300
313
|
this.checked = false;
|
|
301
314
|
this.error = false;
|
|
315
|
+
this.touched = false;
|
|
302
316
|
}
|
|
303
317
|
|
|
304
318
|
firstUpdated() {
|
|
@@ -788,6 +802,7 @@ class AuroFormValidation {
|
|
|
788
802
|
reset(elem) {
|
|
789
803
|
elem.validity = undefined;
|
|
790
804
|
elem.value = undefined;
|
|
805
|
+
elem.touched = false;
|
|
791
806
|
|
|
792
807
|
// Resets the second value of the datepicker in range state
|
|
793
808
|
if (elem.valueEnd) {
|
|
@@ -925,7 +940,7 @@ class AuroFormValidation {
|
|
|
925
940
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
926
941
|
|
|
927
942
|
// Guard Clause: if the value is too short
|
|
928
|
-
if (elem.value
|
|
943
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
929
944
|
|
|
930
945
|
elem.validity = 'tooShort';
|
|
931
946
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -995,11 +1010,17 @@ class AuroFormValidation {
|
|
|
995
1010
|
this.getAuroInputs(elem);
|
|
996
1011
|
|
|
997
1012
|
// Validate only if noValidate is not true and the input does not have focus
|
|
998
|
-
|
|
1013
|
+
let validationShouldRun =
|
|
1014
|
+
force ||
|
|
1015
|
+
(!elem.contains(document.activeElement) &&
|
|
1016
|
+
(elem.touched ||
|
|
1017
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1018
|
+
elem.validateOnInput;
|
|
999
1019
|
|
|
1000
1020
|
if (elem.hasAttribute('error')) {
|
|
1001
1021
|
elem.validity = 'customError';
|
|
1002
1022
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1023
|
+
validationShouldRun = false;
|
|
1003
1024
|
} else if (validationShouldRun) {
|
|
1004
1025
|
elem.validity = 'valid';
|
|
1005
1026
|
elem.errorMessage = '';
|
|
@@ -1020,7 +1041,7 @@ class AuroFormValidation {
|
|
|
1020
1041
|
}
|
|
1021
1042
|
}
|
|
1022
1043
|
|
|
1023
|
-
if (!hasValue && elem.required) {
|
|
1044
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1024
1045
|
elem.validity = 'valueMissing';
|
|
1025
1046
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1026
1047
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1031,7 +1052,7 @@ class AuroFormValidation {
|
|
|
1031
1052
|
}
|
|
1032
1053
|
}
|
|
1033
1054
|
|
|
1034
|
-
if (this.auroInputElements?.length > 0) {
|
|
1055
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1035
1056
|
elem.validity = this.auroInputElements[0].validity;
|
|
1036
1057
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1037
1058
|
|
|
@@ -1110,7 +1131,7 @@ class AuroFormValidation {
|
|
|
1110
1131
|
}
|
|
1111
1132
|
}
|
|
1112
1133
|
} else {
|
|
1113
|
-
elem.errorMessage =
|
|
1134
|
+
elem.errorMessage = '';
|
|
1114
1135
|
}
|
|
1115
1136
|
}
|
|
1116
1137
|
}
|
|
@@ -1390,6 +1411,14 @@ class AuroCheckboxGroup extends i$2 {
|
|
|
1390
1411
|
this.horizontal = false;
|
|
1391
1412
|
this.onDark = false;
|
|
1392
1413
|
|
|
1414
|
+
/**
|
|
1415
|
+
* Indicates whether the checkbox group is in a dirty state (has been interacted with).
|
|
1416
|
+
* @type {boolean}
|
|
1417
|
+
* @default false
|
|
1418
|
+
* @private
|
|
1419
|
+
*/
|
|
1420
|
+
this.touched = false;
|
|
1421
|
+
|
|
1393
1422
|
/**
|
|
1394
1423
|
* @private
|
|
1395
1424
|
*/
|
|
@@ -1579,6 +1608,8 @@ class AuroCheckboxGroup extends i$2 {
|
|
|
1579
1608
|
};
|
|
1580
1609
|
|
|
1581
1610
|
this.addEventListener('auroCheckbox-focusin', () => {
|
|
1611
|
+
this.touched = true;
|
|
1612
|
+
|
|
1582
1613
|
if (!this.value) {
|
|
1583
1614
|
this.value = [];
|
|
1584
1615
|
}
|
|
@@ -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.
|
|
109
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/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,12 @@ 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
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
touched: boolean;
|
|
58
64
|
};
|
|
59
65
|
/**
|
|
60
66
|
* This will register this element with the browser.
|
|
@@ -69,6 +75,7 @@ export class AuroCheckbox extends LitElement {
|
|
|
69
75
|
disabled: boolean;
|
|
70
76
|
error: boolean;
|
|
71
77
|
onDark: boolean;
|
|
78
|
+
touched: boolean;
|
|
72
79
|
/**
|
|
73
80
|
* @private
|
|
74
81
|
*/
|
|
@@ -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,17 @@ 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
|
+
* @private
|
|
187
|
+
*/
|
|
188
|
+
touched: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
reflect: true,
|
|
191
|
+
attribute: false
|
|
180
192
|
}
|
|
181
193
|
};
|
|
182
194
|
}
|
|
@@ -231,6 +243,7 @@ class AuroCheckbox extends LitElement {
|
|
|
231
243
|
* @returns {void}
|
|
232
244
|
*/
|
|
233
245
|
handleFocusin() {
|
|
246
|
+
this.touched = true;
|
|
234
247
|
this.dispatchEvent(new CustomEvent('auroCheckbox-focusin', {
|
|
235
248
|
bubbles: true,
|
|
236
249
|
cancelable: false,
|
|
@@ -259,6 +272,7 @@ class AuroCheckbox extends LitElement {
|
|
|
259
272
|
reset() {
|
|
260
273
|
this.checked = false;
|
|
261
274
|
this.error = false;
|
|
275
|
+
this.touched = false;
|
|
262
276
|
}
|
|
263
277
|
|
|
264
278
|
firstUpdated() {
|
|
@@ -741,6 +755,7 @@ class AuroFormValidation {
|
|
|
741
755
|
reset(elem) {
|
|
742
756
|
elem.validity = undefined;
|
|
743
757
|
elem.value = undefined;
|
|
758
|
+
elem.touched = false;
|
|
744
759
|
|
|
745
760
|
// Resets the second value of the datepicker in range state
|
|
746
761
|
if (elem.valueEnd) {
|
|
@@ -878,7 +893,7 @@ class AuroFormValidation {
|
|
|
878
893
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
879
894
|
|
|
880
895
|
// Guard Clause: if the value is too short
|
|
881
|
-
if (elem.value
|
|
896
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
882
897
|
|
|
883
898
|
elem.validity = 'tooShort';
|
|
884
899
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -948,11 +963,17 @@ class AuroFormValidation {
|
|
|
948
963
|
this.getAuroInputs(elem);
|
|
949
964
|
|
|
950
965
|
// Validate only if noValidate is not true and the input does not have focus
|
|
951
|
-
|
|
966
|
+
let validationShouldRun =
|
|
967
|
+
force ||
|
|
968
|
+
(!elem.contains(document.activeElement) &&
|
|
969
|
+
(elem.touched ||
|
|
970
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
971
|
+
elem.validateOnInput;
|
|
952
972
|
|
|
953
973
|
if (elem.hasAttribute('error')) {
|
|
954
974
|
elem.validity = 'customError';
|
|
955
975
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
976
|
+
validationShouldRun = false;
|
|
956
977
|
} else if (validationShouldRun) {
|
|
957
978
|
elem.validity = 'valid';
|
|
958
979
|
elem.errorMessage = '';
|
|
@@ -973,7 +994,7 @@ class AuroFormValidation {
|
|
|
973
994
|
}
|
|
974
995
|
}
|
|
975
996
|
|
|
976
|
-
if (!hasValue && elem.required) {
|
|
997
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
977
998
|
elem.validity = 'valueMissing';
|
|
978
999
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
979
1000
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -984,7 +1005,7 @@ class AuroFormValidation {
|
|
|
984
1005
|
}
|
|
985
1006
|
}
|
|
986
1007
|
|
|
987
|
-
if (this.auroInputElements?.length > 0) {
|
|
1008
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
988
1009
|
elem.validity = this.auroInputElements[0].validity;
|
|
989
1010
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
990
1011
|
|
|
@@ -1063,7 +1084,7 @@ class AuroFormValidation {
|
|
|
1063
1084
|
}
|
|
1064
1085
|
}
|
|
1065
1086
|
} else {
|
|
1066
|
-
elem.errorMessage =
|
|
1087
|
+
elem.errorMessage = '';
|
|
1067
1088
|
}
|
|
1068
1089
|
}
|
|
1069
1090
|
}
|
|
@@ -1343,6 +1364,14 @@ class AuroCheckboxGroup extends LitElement {
|
|
|
1343
1364
|
this.horizontal = false;
|
|
1344
1365
|
this.onDark = false;
|
|
1345
1366
|
|
|
1367
|
+
/**
|
|
1368
|
+
* Indicates whether the checkbox group is in a dirty state (has been interacted with).
|
|
1369
|
+
* @type {boolean}
|
|
1370
|
+
* @default false
|
|
1371
|
+
* @private
|
|
1372
|
+
*/
|
|
1373
|
+
this.touched = false;
|
|
1374
|
+
|
|
1346
1375
|
/**
|
|
1347
1376
|
* @private
|
|
1348
1377
|
*/
|
|
@@ -1532,6 +1561,8 @@ class AuroCheckboxGroup extends LitElement {
|
|
|
1532
1561
|
};
|
|
1533
1562
|
|
|
1534
1563
|
this.addEventListener('auroCheckbox-focusin', () => {
|
|
1564
|
+
this.touched = true;
|
|
1565
|
+
|
|
1535
1566
|
if (!this.value) {
|
|
1536
1567
|
this.value = [];
|
|
1537
1568
|
}
|
|
@@ -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,17 @@ 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
|
+
* @private
|
|
187
|
+
*/
|
|
188
|
+
touched: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
reflect: true,
|
|
191
|
+
attribute: false
|
|
180
192
|
}
|
|
181
193
|
};
|
|
182
194
|
}
|
|
@@ -231,6 +243,7 @@ class AuroCheckbox extends LitElement {
|
|
|
231
243
|
* @returns {void}
|
|
232
244
|
*/
|
|
233
245
|
handleFocusin() {
|
|
246
|
+
this.touched = true;
|
|
234
247
|
this.dispatchEvent(new CustomEvent('auroCheckbox-focusin', {
|
|
235
248
|
bubbles: true,
|
|
236
249
|
cancelable: false,
|
|
@@ -259,6 +272,7 @@ class AuroCheckbox extends LitElement {
|
|
|
259
272
|
reset() {
|
|
260
273
|
this.checked = false;
|
|
261
274
|
this.error = false;
|
|
275
|
+
this.touched = false;
|
|
262
276
|
}
|
|
263
277
|
|
|
264
278
|
firstUpdated() {
|
|
@@ -741,6 +755,7 @@ class AuroFormValidation {
|
|
|
741
755
|
reset(elem) {
|
|
742
756
|
elem.validity = undefined;
|
|
743
757
|
elem.value = undefined;
|
|
758
|
+
elem.touched = false;
|
|
744
759
|
|
|
745
760
|
// Resets the second value of the datepicker in range state
|
|
746
761
|
if (elem.valueEnd) {
|
|
@@ -878,7 +893,7 @@ class AuroFormValidation {
|
|
|
878
893
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
879
894
|
|
|
880
895
|
// Guard Clause: if the value is too short
|
|
881
|
-
if (elem.value
|
|
896
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
882
897
|
|
|
883
898
|
elem.validity = 'tooShort';
|
|
884
899
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -948,11 +963,17 @@ class AuroFormValidation {
|
|
|
948
963
|
this.getAuroInputs(elem);
|
|
949
964
|
|
|
950
965
|
// Validate only if noValidate is not true and the input does not have focus
|
|
951
|
-
|
|
966
|
+
let validationShouldRun =
|
|
967
|
+
force ||
|
|
968
|
+
(!elem.contains(document.activeElement) &&
|
|
969
|
+
(elem.touched ||
|
|
970
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
971
|
+
elem.validateOnInput;
|
|
952
972
|
|
|
953
973
|
if (elem.hasAttribute('error')) {
|
|
954
974
|
elem.validity = 'customError';
|
|
955
975
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
976
|
+
validationShouldRun = false;
|
|
956
977
|
} else if (validationShouldRun) {
|
|
957
978
|
elem.validity = 'valid';
|
|
958
979
|
elem.errorMessage = '';
|
|
@@ -973,7 +994,7 @@ class AuroFormValidation {
|
|
|
973
994
|
}
|
|
974
995
|
}
|
|
975
996
|
|
|
976
|
-
if (!hasValue && elem.required) {
|
|
997
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
977
998
|
elem.validity = 'valueMissing';
|
|
978
999
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
979
1000
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -984,7 +1005,7 @@ class AuroFormValidation {
|
|
|
984
1005
|
}
|
|
985
1006
|
}
|
|
986
1007
|
|
|
987
|
-
if (this.auroInputElements?.length > 0) {
|
|
1008
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
988
1009
|
elem.validity = this.auroInputElements[0].validity;
|
|
989
1010
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
990
1011
|
|
|
@@ -1063,7 +1084,7 @@ class AuroFormValidation {
|
|
|
1063
1084
|
}
|
|
1064
1085
|
}
|
|
1065
1086
|
} else {
|
|
1066
|
-
elem.errorMessage =
|
|
1087
|
+
elem.errorMessage = '';
|
|
1067
1088
|
}
|
|
1068
1089
|
}
|
|
1069
1090
|
}
|
|
@@ -1343,6 +1364,14 @@ class AuroCheckboxGroup extends LitElement {
|
|
|
1343
1364
|
this.horizontal = false;
|
|
1344
1365
|
this.onDark = false;
|
|
1345
1366
|
|
|
1367
|
+
/**
|
|
1368
|
+
* Indicates whether the checkbox group is in a dirty state (has been interacted with).
|
|
1369
|
+
* @type {boolean}
|
|
1370
|
+
* @default false
|
|
1371
|
+
* @private
|
|
1372
|
+
*/
|
|
1373
|
+
this.touched = false;
|
|
1374
|
+
|
|
1346
1375
|
/**
|
|
1347
1376
|
* @private
|
|
1348
1377
|
*/
|
|
@@ -1532,6 +1561,8 @@ class AuroCheckboxGroup extends LitElement {
|
|
|
1532
1561
|
};
|
|
1533
1562
|
|
|
1534
1563
|
this.addEventListener('auroCheckbox-focusin', () => {
|
|
1564
|
+
this.touched = true;
|
|
1565
|
+
|
|
1535
1566
|
if (!this.value) {
|
|
1536
1567
|
this.value = [];
|
|
1537
1568
|
}
|
|
@@ -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.
|
|
114
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-combobox/+esm"></script>
|
|
115
115
|
```
|
|
116
116
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
117
117
|
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
| [disabled](#disabled) | `disabled` | `boolean` | | If set, disables the combobox. |
|
|
14
14
|
| [error](#error) | `error` | `string` | | When defined, sets persistent validity to `customError` and sets the validation message to the attribute value. |
|
|
15
15
|
| [fullscreenBreakpoint](#fullscreenBreakpoint) | `fullscreenBreakpoint` | `string` | "sm" | Defines the screen size breakpoint (`xs`, `sm`, `md`, `lg`, `xl`, `disabled`)<br />at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.<br /><br />When expanded, the dropdown will automatically display in fullscreen mode<br />if the screen size is equal to or smaller than the selected breakpoint. |
|
|
16
|
+
| [inputmode](#inputmode) | `inputmode` | `string` | | Exposes inputmode attribute for input. |
|
|
16
17
|
| [largeFullscreenHeadline](#largeFullscreenHeadline) | `largeFullscreenHeadline` | `boolean` | | If declared, make bib.fullscreen.headline in HeadingDisplay.<br />Otherwise, Heading 600 |
|
|
17
18
|
| [noFilter](#noFilter) | `noFilter` | `boolean` | | If set, combobox will not filter menuoptions based in input. |
|
|
18
19
|
| [noFlip](#noFlip) | `noFlip` | `boolean` | "false" | If declared, the bib will NOT flip to an alternate position<br />when there isn't enough space in the specified `placement`. |
|
|
@@ -317,6 +318,49 @@ If set, disables the combobox.
|
|
|
317
318
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
318
319
|
</auro-accordion>
|
|
319
320
|
|
|
321
|
+
#### Input Mode
|
|
322
|
+
|
|
323
|
+
You can manually set the input mode for the input.
|
|
324
|
+
|
|
325
|
+
<div class="exampleWrapper">
|
|
326
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/inputmode.html) -->
|
|
327
|
+
<!-- The below content is automatically added from ./../apiExamples/inputmode.html -->
|
|
328
|
+
<auro-combobox inputmode="numeric">
|
|
329
|
+
<span slot="bib.fullscreen.headline">Bib Header</span>
|
|
330
|
+
<span slot="label">Name</span>
|
|
331
|
+
<auro-menu>
|
|
332
|
+
<auro-menuoption value="1" id="option-0">1</auro-menuoption>
|
|
333
|
+
<auro-menuoption value="2" id="option-1">2</auro-menuoption>
|
|
334
|
+
<auro-menuoption value="3" id="option-2">3</auro-menuoption>
|
|
335
|
+
<auro-menuoption value="4" id="option-3">4</auro-menuoption>
|
|
336
|
+
<auro-menuoption value="5" id="option-4">5</auro-menuoption>
|
|
337
|
+
<auro-menuoption static nomatch>No matching option</auro-menuoption>
|
|
338
|
+
</auro-menu>
|
|
339
|
+
</auro-combobox>
|
|
340
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
341
|
+
</div>
|
|
342
|
+
<auro-accordion alignRight>
|
|
343
|
+
<span slot="trigger">See code</span>
|
|
344
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/inputmode.html) -->
|
|
345
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/inputmode.html -->
|
|
346
|
+
|
|
347
|
+
```html
|
|
348
|
+
<auro-combobox inputmode="numeric">
|
|
349
|
+
<span slot="bib.fullscreen.headline">Bib Header</span>
|
|
350
|
+
<span slot="label">Name</span>
|
|
351
|
+
<auro-menu>
|
|
352
|
+
<auro-menuoption value="1" id="option-0">1</auro-menuoption>
|
|
353
|
+
<auro-menuoption value="2" id="option-1">2</auro-menuoption>
|
|
354
|
+
<auro-menuoption value="3" id="option-2">3</auro-menuoption>
|
|
355
|
+
<auro-menuoption value="4" id="option-3">4</auro-menuoption>
|
|
356
|
+
<auro-menuoption value="5" id="option-4">5</auro-menuoption>
|
|
357
|
+
<auro-menuoption static nomatch>No matching option</auro-menuoption>
|
|
358
|
+
</auro-menu>
|
|
359
|
+
</auro-combobox>
|
|
360
|
+
```
|
|
361
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
362
|
+
</auro-accordion>
|
|
363
|
+
|
|
320
364
|
#### noFilter
|
|
321
365
|
|
|
322
366
|
If set, combobox will not do suggestion filtering of the menuoptions. This option is useful when the `<auro-menuoption>` elements are being pre-filtered externally to combobox (e.g. using the citysearch API).
|