@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
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
| [error](#error) | `error` | | `string` | | When defined, sets persistent validity to `customError` and sets the validation message to the attribute value. |
|
|
17
17
|
| [format](#format) | `format` | | `string` | "mm/dd/yyyy" | Specifies the date format. The default is `mm/dd/yyyy`. |
|
|
18
18
|
| [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. |
|
|
19
|
+
| [inputmode](#inputmode) | `inputmode` | | `string` | | Exposes inputmode attribute for input. |
|
|
19
20
|
| [largeFullscreenHeadline](#largeFullscreenHeadline) | `largeFullscreenHeadline` | | `boolean` | false | If declared, make bib.fullscreen.headline in HeadingDisplay.<br />Otherwise, Heading 600. |
|
|
20
21
|
| [maxDate](#maxDate) | `maxDate` | | `string` | | Maximum date. All dates after will be disabled. |
|
|
21
22
|
| [minDate](#minDate) | `minDate` | | `string` | | Minimum date. All dates before will be disabled. |
|
|
@@ -222,6 +223,35 @@ export function errorExample() {
|
|
|
222
223
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
223
224
|
</auro-accordion>
|
|
224
225
|
|
|
226
|
+
#### Input Mode
|
|
227
|
+
|
|
228
|
+
You can manually set the input mode for the input.
|
|
229
|
+
|
|
230
|
+
<div class="exampleWrapper">
|
|
231
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/inputmode.html) -->
|
|
232
|
+
<!-- The below content is automatically added from ./../apiExamples/inputmode.html -->
|
|
233
|
+
<auro-datepicker inputmode="numeric">
|
|
234
|
+
<span slot="bib.fullscreen.headline">Datepicker Headline</span>
|
|
235
|
+
<span slot="fromLabel">Choose a date</span>
|
|
236
|
+
<span slot="bib.fullscreen.dateLabel">Choose a date</span>
|
|
237
|
+
</auro-datepicker>
|
|
238
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
239
|
+
</div>
|
|
240
|
+
<auro-accordion alignRight>
|
|
241
|
+
<span slot="trigger">See code</span>
|
|
242
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/inputmode.html) -->
|
|
243
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/inputmode.html -->
|
|
244
|
+
|
|
245
|
+
```html
|
|
246
|
+
<auro-datepicker inputmode="numeric">
|
|
247
|
+
<span slot="bib.fullscreen.headline">Datepicker Headline</span>
|
|
248
|
+
<span slot="fromLabel">Choose a date</span>
|
|
249
|
+
<span slot="bib.fullscreen.dateLabel">Choose a date</span>
|
|
250
|
+
</auro-datepicker>
|
|
251
|
+
```
|
|
252
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
253
|
+
</auro-accordion>
|
|
254
|
+
|
|
225
255
|
#### calendarStartDate & calendarEndDate
|
|
226
256
|
|
|
227
257
|
The `calendarStartDate` and `calendarEndDate` properties may be used to explicitly control which calendar months _may_ be rendered in the calendar.
|
|
@@ -787,6 +787,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
787
787
|
reset(elem) {
|
|
788
788
|
elem.validity = undefined;
|
|
789
789
|
elem.value = undefined;
|
|
790
|
+
elem.touched = false;
|
|
790
791
|
|
|
791
792
|
// Resets the second value of the datepicker in range state
|
|
792
793
|
if (elem.valueEnd) {
|
|
@@ -924,7 +925,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
924
925
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
925
926
|
|
|
926
927
|
// Guard Clause: if the value is too short
|
|
927
|
-
if (elem.value
|
|
928
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
928
929
|
|
|
929
930
|
elem.validity = 'tooShort';
|
|
930
931
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -994,11 +995,17 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
994
995
|
this.getAuroInputs(elem);
|
|
995
996
|
|
|
996
997
|
// Validate only if noValidate is not true and the input does not have focus
|
|
997
|
-
|
|
998
|
+
let validationShouldRun =
|
|
999
|
+
force ||
|
|
1000
|
+
(!elem.contains(document.activeElement) &&
|
|
1001
|
+
(elem.touched ||
|
|
1002
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1003
|
+
elem.validateOnInput;
|
|
998
1004
|
|
|
999
1005
|
if (elem.hasAttribute('error')) {
|
|
1000
1006
|
elem.validity = 'customError';
|
|
1001
1007
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1008
|
+
validationShouldRun = false;
|
|
1002
1009
|
} else if (validationShouldRun) {
|
|
1003
1010
|
elem.validity = 'valid';
|
|
1004
1011
|
elem.errorMessage = '';
|
|
@@ -1019,7 +1026,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
1019
1026
|
}
|
|
1020
1027
|
}
|
|
1021
1028
|
|
|
1022
|
-
if (!hasValue && elem.required) {
|
|
1029
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1023
1030
|
elem.validity = 'valueMissing';
|
|
1024
1031
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1025
1032
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1030,7 +1037,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
1030
1037
|
}
|
|
1031
1038
|
}
|
|
1032
1039
|
|
|
1033
|
-
if (this.auroInputElements?.length > 0) {
|
|
1040
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1034
1041
|
elem.validity = this.auroInputElements[0].validity;
|
|
1035
1042
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1036
1043
|
|
|
@@ -1109,7 +1116,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
1109
1116
|
}
|
|
1110
1117
|
}
|
|
1111
1118
|
} else {
|
|
1112
|
-
elem.errorMessage =
|
|
1119
|
+
elem.errorMessage = '';
|
|
1113
1120
|
}
|
|
1114
1121
|
}
|
|
1115
1122
|
};
|
|
@@ -20758,6 +20765,7 @@ class AuroFormValidation {
|
|
|
20758
20765
|
reset(elem) {
|
|
20759
20766
|
elem.validity = undefined;
|
|
20760
20767
|
elem.value = undefined;
|
|
20768
|
+
elem.touched = false;
|
|
20761
20769
|
|
|
20762
20770
|
// Resets the second value of the datepicker in range state
|
|
20763
20771
|
if (elem.valueEnd) {
|
|
@@ -20895,7 +20903,7 @@ class AuroFormValidation {
|
|
|
20895
20903
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
20896
20904
|
|
|
20897
20905
|
// Guard Clause: if the value is too short
|
|
20898
|
-
if (elem.value
|
|
20906
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
20899
20907
|
|
|
20900
20908
|
elem.validity = 'tooShort';
|
|
20901
20909
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -20965,11 +20973,17 @@ class AuroFormValidation {
|
|
|
20965
20973
|
this.getAuroInputs(elem);
|
|
20966
20974
|
|
|
20967
20975
|
// Validate only if noValidate is not true and the input does not have focus
|
|
20968
|
-
|
|
20976
|
+
let validationShouldRun =
|
|
20977
|
+
force ||
|
|
20978
|
+
(!elem.contains(document.activeElement) &&
|
|
20979
|
+
(elem.touched ||
|
|
20980
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
20981
|
+
elem.validateOnInput;
|
|
20969
20982
|
|
|
20970
20983
|
if (elem.hasAttribute('error')) {
|
|
20971
20984
|
elem.validity = 'customError';
|
|
20972
20985
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
20986
|
+
validationShouldRun = false;
|
|
20973
20987
|
} else if (validationShouldRun) {
|
|
20974
20988
|
elem.validity = 'valid';
|
|
20975
20989
|
elem.errorMessage = '';
|
|
@@ -20990,7 +21004,7 @@ class AuroFormValidation {
|
|
|
20990
21004
|
}
|
|
20991
21005
|
}
|
|
20992
21006
|
|
|
20993
|
-
if (!hasValue && elem.required) {
|
|
21007
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
20994
21008
|
elem.validity = 'valueMissing';
|
|
20995
21009
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
20996
21010
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -21001,7 +21015,7 @@ class AuroFormValidation {
|
|
|
21001
21015
|
}
|
|
21002
21016
|
}
|
|
21003
21017
|
|
|
21004
|
-
if (this.auroInputElements?.length > 0) {
|
|
21018
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
21005
21019
|
elem.validity = this.auroInputElements[0].validity;
|
|
21006
21020
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
21007
21021
|
|
|
@@ -21080,7 +21094,7 @@ class AuroFormValidation {
|
|
|
21080
21094
|
}
|
|
21081
21095
|
}
|
|
21082
21096
|
} else {
|
|
21083
|
-
elem.errorMessage =
|
|
21097
|
+
elem.errorMessage = '';
|
|
21084
21098
|
}
|
|
21085
21099
|
}
|
|
21086
21100
|
}
|
|
@@ -21131,6 +21145,7 @@ class BaseInput extends i$2 {
|
|
|
21131
21145
|
* @returns {void}
|
|
21132
21146
|
*/
|
|
21133
21147
|
privateDefaults() {
|
|
21148
|
+
this.touched = false;
|
|
21134
21149
|
this.util = new AuroInputUtilities();
|
|
21135
21150
|
this.validation = new AuroFormValidation();
|
|
21136
21151
|
this.inputIconName = undefined;
|
|
@@ -21291,6 +21306,13 @@ class BaseInput extends i$2 {
|
|
|
21291
21306
|
type: String
|
|
21292
21307
|
},
|
|
21293
21308
|
|
|
21309
|
+
/** Exposes inputmode attribute for input. */
|
|
21310
|
+
inputmode: {
|
|
21311
|
+
type: String,
|
|
21312
|
+
attribute: true,
|
|
21313
|
+
reflect: true
|
|
21314
|
+
},
|
|
21315
|
+
|
|
21294
21316
|
/**
|
|
21295
21317
|
* Defines the language of an element.
|
|
21296
21318
|
*/
|
|
@@ -21492,6 +21514,18 @@ class BaseInput extends i$2 {
|
|
|
21492
21514
|
validity: {
|
|
21493
21515
|
type: String,
|
|
21494
21516
|
reflect: true
|
|
21517
|
+
},
|
|
21518
|
+
|
|
21519
|
+
/**
|
|
21520
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
21521
|
+
* @type {boolean}
|
|
21522
|
+
* @default false
|
|
21523
|
+
* @private
|
|
21524
|
+
*/
|
|
21525
|
+
touched: {
|
|
21526
|
+
type: Boolean,
|
|
21527
|
+
reflect: true,
|
|
21528
|
+
attribute: false
|
|
21495
21529
|
}
|
|
21496
21530
|
};
|
|
21497
21531
|
}
|
|
@@ -21778,15 +21812,7 @@ class BaseInput extends i$2 {
|
|
|
21778
21812
|
*/
|
|
21779
21813
|
handleFocusin() {
|
|
21780
21814
|
|
|
21781
|
-
|
|
21782
|
-
* The input is considered to be in it's initial state based on
|
|
21783
|
-
* if this.value === undefined. The first time we interact with the
|
|
21784
|
-
* input manually, by applying focusin, we need to flag the
|
|
21785
|
-
* input as no longer in the initial state.
|
|
21786
|
-
*/
|
|
21787
|
-
if (this.value === undefined) {
|
|
21788
|
-
this.value = '';
|
|
21789
|
-
}
|
|
21815
|
+
this.touched = true;
|
|
21790
21816
|
}
|
|
21791
21817
|
|
|
21792
21818
|
/**
|
|
@@ -21852,9 +21878,9 @@ class BaseInput extends i$2 {
|
|
|
21852
21878
|
|
|
21853
21879
|
if (this.type in defaultLengths) {
|
|
21854
21880
|
this.lengthForType = this.format ? this.format.length : defaultLengths[this.type];
|
|
21855
|
-
this.
|
|
21881
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
21856
21882
|
} else if (this.type === 'number') {
|
|
21857
|
-
this.
|
|
21883
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
21858
21884
|
}
|
|
21859
21885
|
|
|
21860
21886
|
if (this.type === "date" && !this.format) {
|
|
@@ -23212,7 +23238,7 @@ class AuroInput extends BaseInput {
|
|
|
23212
23238
|
pattern="${o(this.definePattern())}"
|
|
23213
23239
|
maxlength="${o(this.maxLength ? this.maxLength : undefined)}"
|
|
23214
23240
|
minlength="${o(this.minLength ? this.minLength : undefined)}"
|
|
23215
|
-
inputMode="${o(this.
|
|
23241
|
+
inputMode="${o(this.inputmode ? this.inputmode : undefined)}"
|
|
23216
23242
|
?required="${this.required}"
|
|
23217
23243
|
?disabled="${this.disabled}"
|
|
23218
23244
|
aria-describedby="${this.uniqueId}"
|
|
@@ -23361,6 +23387,7 @@ class AuroDatePicker extends i$2 {
|
|
|
23361
23387
|
this.calendarRenderUtil.updateCentralDate(this, new Date());
|
|
23362
23388
|
}
|
|
23363
23389
|
|
|
23390
|
+
this.touched = false;
|
|
23364
23391
|
this.disabled = false;
|
|
23365
23392
|
this.required = false;
|
|
23366
23393
|
this.onDark = false;
|
|
@@ -23525,6 +23552,13 @@ class AuroDatePicker extends i$2 {
|
|
|
23525
23552
|
reflect: true
|
|
23526
23553
|
},
|
|
23527
23554
|
|
|
23555
|
+
/** Exposes inputmode attribute for input. */
|
|
23556
|
+
inputmode: {
|
|
23557
|
+
type: String,
|
|
23558
|
+
attribute: true,
|
|
23559
|
+
reflect: true
|
|
23560
|
+
},
|
|
23561
|
+
|
|
23528
23562
|
/**
|
|
23529
23563
|
* If declared, make bib.fullscreen.headline in HeadingDisplay.
|
|
23530
23564
|
* Otherwise, Heading 600.
|
|
@@ -23692,6 +23726,18 @@ class AuroDatePicker extends i$2 {
|
|
|
23692
23726
|
*/
|
|
23693
23727
|
valueEnd: {
|
|
23694
23728
|
type: String
|
|
23729
|
+
},
|
|
23730
|
+
|
|
23731
|
+
/**
|
|
23732
|
+
* Indicates whether the datepicker is in a dirty state (has been interacted with).
|
|
23733
|
+
* @type {boolean}
|
|
23734
|
+
* @default false
|
|
23735
|
+
* @private
|
|
23736
|
+
*/
|
|
23737
|
+
touched: {
|
|
23738
|
+
type: Boolean,
|
|
23739
|
+
reflect: true,
|
|
23740
|
+
attribute: false
|
|
23695
23741
|
}
|
|
23696
23742
|
};
|
|
23697
23743
|
}
|
|
@@ -23968,27 +24014,15 @@ class AuroDatePicker extends i$2 {
|
|
|
23968
24014
|
configureDatepicker() {
|
|
23969
24015
|
this.addEventListener('focusin', () => {
|
|
23970
24016
|
|
|
23971
|
-
|
|
23972
|
-
* The datepicker is considered to be in it's initial state based on
|
|
23973
|
-
* if this.value === undefined. The first time we interact with the
|
|
23974
|
-
* datepicker manually, by applying focusin, we need to flag the
|
|
23975
|
-
* datepicker as no longer in the initial state.
|
|
23976
|
-
*/
|
|
23977
|
-
if (this.value === undefined) {
|
|
23978
|
-
this.value = '';
|
|
23979
|
-
}
|
|
23980
|
-
|
|
23981
|
-
if (this.valueEnd === undefined) {
|
|
23982
|
-
this.valueEnd = '';
|
|
23983
|
-
}
|
|
24017
|
+
this.touched = true;
|
|
23984
24018
|
});
|
|
23985
24019
|
|
|
23986
24020
|
this.addEventListener('focusout', (evt) => {
|
|
23987
|
-
if (!this.noValidate && !evt.detail.expanded && this.
|
|
24021
|
+
if (!this.noValidate && !evt.detail.expanded && this.touched) {
|
|
23988
24022
|
if (!this.contains(document.activeElement)) {
|
|
23989
24023
|
this.validation.validate(this.inputList[0]);
|
|
23990
24024
|
|
|
23991
|
-
if (this.inputList[1] && this.inputList[1].
|
|
24025
|
+
if (this.inputList[1] && this.inputList[1].touched) {
|
|
23992
24026
|
this.validation.validate(this.inputList[1]);
|
|
23993
24027
|
}
|
|
23994
24028
|
}
|
|
@@ -24375,6 +24409,7 @@ class AuroDatePicker extends i$2 {
|
|
|
24375
24409
|
setCustomValidityRangeOverflow="${this.setCustomValidityRangeOverflow}"
|
|
24376
24410
|
setCustomValidityRangeUnderflow="${this.setCustomValidityRangeUnderflow}"
|
|
24377
24411
|
?disabled="${this.disabled}"
|
|
24412
|
+
inputmode="${o(this.inputmode)}"
|
|
24378
24413
|
part="input">
|
|
24379
24414
|
<span slot="label"><slot name="fromLabel"></slot></span>
|
|
24380
24415
|
</${this.inputTag}>
|
|
@@ -528,6 +528,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
528
528
|
reset(elem) {
|
|
529
529
|
elem.validity = undefined;
|
|
530
530
|
elem.value = undefined;
|
|
531
|
+
elem.touched = false;
|
|
531
532
|
|
|
532
533
|
// Resets the second value of the datepicker in range state
|
|
533
534
|
if (elem.valueEnd) {
|
|
@@ -665,7 +666,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
665
666
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
666
667
|
|
|
667
668
|
// Guard Clause: if the value is too short
|
|
668
|
-
if (elem.value
|
|
669
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
669
670
|
|
|
670
671
|
elem.validity = 'tooShort';
|
|
671
672
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -735,11 +736,17 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
735
736
|
this.getAuroInputs(elem);
|
|
736
737
|
|
|
737
738
|
// Validate only if noValidate is not true and the input does not have focus
|
|
738
|
-
|
|
739
|
+
let validationShouldRun =
|
|
740
|
+
force ||
|
|
741
|
+
(!elem.contains(document.activeElement) &&
|
|
742
|
+
(elem.touched ||
|
|
743
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
744
|
+
elem.validateOnInput;
|
|
739
745
|
|
|
740
746
|
if (elem.hasAttribute('error')) {
|
|
741
747
|
elem.validity = 'customError';
|
|
742
748
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
749
|
+
validationShouldRun = false;
|
|
743
750
|
} else if (validationShouldRun) {
|
|
744
751
|
elem.validity = 'valid';
|
|
745
752
|
elem.errorMessage = '';
|
|
@@ -760,7 +767,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
760
767
|
}
|
|
761
768
|
}
|
|
762
769
|
|
|
763
|
-
if (!hasValue && elem.required) {
|
|
770
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
764
771
|
elem.validity = 'valueMissing';
|
|
765
772
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
766
773
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -771,7 +778,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
771
778
|
}
|
|
772
779
|
}
|
|
773
780
|
|
|
774
|
-
if (this.auroInputElements?.length > 0) {
|
|
781
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
775
782
|
elem.validity = this.auroInputElements[0].validity;
|
|
776
783
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
777
784
|
|
|
@@ -850,7 +857,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
850
857
|
}
|
|
851
858
|
}
|
|
852
859
|
} else {
|
|
853
|
-
elem.errorMessage =
|
|
860
|
+
elem.errorMessage = '';
|
|
854
861
|
}
|
|
855
862
|
}
|
|
856
863
|
};
|
|
@@ -20499,6 +20506,7 @@ class AuroFormValidation {
|
|
|
20499
20506
|
reset(elem) {
|
|
20500
20507
|
elem.validity = undefined;
|
|
20501
20508
|
elem.value = undefined;
|
|
20509
|
+
elem.touched = false;
|
|
20502
20510
|
|
|
20503
20511
|
// Resets the second value of the datepicker in range state
|
|
20504
20512
|
if (elem.valueEnd) {
|
|
@@ -20636,7 +20644,7 @@ class AuroFormValidation {
|
|
|
20636
20644
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
20637
20645
|
|
|
20638
20646
|
// Guard Clause: if the value is too short
|
|
20639
|
-
if (elem.value
|
|
20647
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
20640
20648
|
|
|
20641
20649
|
elem.validity = 'tooShort';
|
|
20642
20650
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -20706,11 +20714,17 @@ class AuroFormValidation {
|
|
|
20706
20714
|
this.getAuroInputs(elem);
|
|
20707
20715
|
|
|
20708
20716
|
// Validate only if noValidate is not true and the input does not have focus
|
|
20709
|
-
|
|
20717
|
+
let validationShouldRun =
|
|
20718
|
+
force ||
|
|
20719
|
+
(!elem.contains(document.activeElement) &&
|
|
20720
|
+
(elem.touched ||
|
|
20721
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
20722
|
+
elem.validateOnInput;
|
|
20710
20723
|
|
|
20711
20724
|
if (elem.hasAttribute('error')) {
|
|
20712
20725
|
elem.validity = 'customError';
|
|
20713
20726
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
20727
|
+
validationShouldRun = false;
|
|
20714
20728
|
} else if (validationShouldRun) {
|
|
20715
20729
|
elem.validity = 'valid';
|
|
20716
20730
|
elem.errorMessage = '';
|
|
@@ -20731,7 +20745,7 @@ class AuroFormValidation {
|
|
|
20731
20745
|
}
|
|
20732
20746
|
}
|
|
20733
20747
|
|
|
20734
|
-
if (!hasValue && elem.required) {
|
|
20748
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
20735
20749
|
elem.validity = 'valueMissing';
|
|
20736
20750
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
20737
20751
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -20742,7 +20756,7 @@ class AuroFormValidation {
|
|
|
20742
20756
|
}
|
|
20743
20757
|
}
|
|
20744
20758
|
|
|
20745
|
-
if (this.auroInputElements?.length > 0) {
|
|
20759
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
20746
20760
|
elem.validity = this.auroInputElements[0].validity;
|
|
20747
20761
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
20748
20762
|
|
|
@@ -20821,7 +20835,7 @@ class AuroFormValidation {
|
|
|
20821
20835
|
}
|
|
20822
20836
|
}
|
|
20823
20837
|
} else {
|
|
20824
|
-
elem.errorMessage =
|
|
20838
|
+
elem.errorMessage = '';
|
|
20825
20839
|
}
|
|
20826
20840
|
}
|
|
20827
20841
|
}
|
|
@@ -20872,6 +20886,7 @@ class BaseInput extends i$2 {
|
|
|
20872
20886
|
* @returns {void}
|
|
20873
20887
|
*/
|
|
20874
20888
|
privateDefaults() {
|
|
20889
|
+
this.touched = false;
|
|
20875
20890
|
this.util = new AuroInputUtilities();
|
|
20876
20891
|
this.validation = new AuroFormValidation();
|
|
20877
20892
|
this.inputIconName = undefined;
|
|
@@ -21032,6 +21047,13 @@ class BaseInput extends i$2 {
|
|
|
21032
21047
|
type: String
|
|
21033
21048
|
},
|
|
21034
21049
|
|
|
21050
|
+
/** Exposes inputmode attribute for input. */
|
|
21051
|
+
inputmode: {
|
|
21052
|
+
type: String,
|
|
21053
|
+
attribute: true,
|
|
21054
|
+
reflect: true
|
|
21055
|
+
},
|
|
21056
|
+
|
|
21035
21057
|
/**
|
|
21036
21058
|
* Defines the language of an element.
|
|
21037
21059
|
*/
|
|
@@ -21233,6 +21255,18 @@ class BaseInput extends i$2 {
|
|
|
21233
21255
|
validity: {
|
|
21234
21256
|
type: String,
|
|
21235
21257
|
reflect: true
|
|
21258
|
+
},
|
|
21259
|
+
|
|
21260
|
+
/**
|
|
21261
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
21262
|
+
* @type {boolean}
|
|
21263
|
+
* @default false
|
|
21264
|
+
* @private
|
|
21265
|
+
*/
|
|
21266
|
+
touched: {
|
|
21267
|
+
type: Boolean,
|
|
21268
|
+
reflect: true,
|
|
21269
|
+
attribute: false
|
|
21236
21270
|
}
|
|
21237
21271
|
};
|
|
21238
21272
|
}
|
|
@@ -21519,15 +21553,7 @@ class BaseInput extends i$2 {
|
|
|
21519
21553
|
*/
|
|
21520
21554
|
handleFocusin() {
|
|
21521
21555
|
|
|
21522
|
-
|
|
21523
|
-
* The input is considered to be in it's initial state based on
|
|
21524
|
-
* if this.value === undefined. The first time we interact with the
|
|
21525
|
-
* input manually, by applying focusin, we need to flag the
|
|
21526
|
-
* input as no longer in the initial state.
|
|
21527
|
-
*/
|
|
21528
|
-
if (this.value === undefined) {
|
|
21529
|
-
this.value = '';
|
|
21530
|
-
}
|
|
21556
|
+
this.touched = true;
|
|
21531
21557
|
}
|
|
21532
21558
|
|
|
21533
21559
|
/**
|
|
@@ -21593,9 +21619,9 @@ class BaseInput extends i$2 {
|
|
|
21593
21619
|
|
|
21594
21620
|
if (this.type in defaultLengths) {
|
|
21595
21621
|
this.lengthForType = this.format ? this.format.length : defaultLengths[this.type];
|
|
21596
|
-
this.
|
|
21622
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
21597
21623
|
} else if (this.type === 'number') {
|
|
21598
|
-
this.
|
|
21624
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
21599
21625
|
}
|
|
21600
21626
|
|
|
21601
21627
|
if (this.type === "date" && !this.format) {
|
|
@@ -22953,7 +22979,7 @@ class AuroInput extends BaseInput {
|
|
|
22953
22979
|
pattern="${o(this.definePattern())}"
|
|
22954
22980
|
maxlength="${o(this.maxLength ? this.maxLength : undefined)}"
|
|
22955
22981
|
minlength="${o(this.minLength ? this.minLength : undefined)}"
|
|
22956
|
-
inputMode="${o(this.
|
|
22982
|
+
inputMode="${o(this.inputmode ? this.inputmode : undefined)}"
|
|
22957
22983
|
?required="${this.required}"
|
|
22958
22984
|
?disabled="${this.disabled}"
|
|
22959
22985
|
aria-describedby="${this.uniqueId}"
|
|
@@ -23102,6 +23128,7 @@ class AuroDatePicker extends i$2 {
|
|
|
23102
23128
|
this.calendarRenderUtil.updateCentralDate(this, new Date());
|
|
23103
23129
|
}
|
|
23104
23130
|
|
|
23131
|
+
this.touched = false;
|
|
23105
23132
|
this.disabled = false;
|
|
23106
23133
|
this.required = false;
|
|
23107
23134
|
this.onDark = false;
|
|
@@ -23266,6 +23293,13 @@ class AuroDatePicker extends i$2 {
|
|
|
23266
23293
|
reflect: true
|
|
23267
23294
|
},
|
|
23268
23295
|
|
|
23296
|
+
/** Exposes inputmode attribute for input. */
|
|
23297
|
+
inputmode: {
|
|
23298
|
+
type: String,
|
|
23299
|
+
attribute: true,
|
|
23300
|
+
reflect: true
|
|
23301
|
+
},
|
|
23302
|
+
|
|
23269
23303
|
/**
|
|
23270
23304
|
* If declared, make bib.fullscreen.headline in HeadingDisplay.
|
|
23271
23305
|
* Otherwise, Heading 600.
|
|
@@ -23433,6 +23467,18 @@ class AuroDatePicker extends i$2 {
|
|
|
23433
23467
|
*/
|
|
23434
23468
|
valueEnd: {
|
|
23435
23469
|
type: String
|
|
23470
|
+
},
|
|
23471
|
+
|
|
23472
|
+
/**
|
|
23473
|
+
* Indicates whether the datepicker is in a dirty state (has been interacted with).
|
|
23474
|
+
* @type {boolean}
|
|
23475
|
+
* @default false
|
|
23476
|
+
* @private
|
|
23477
|
+
*/
|
|
23478
|
+
touched: {
|
|
23479
|
+
type: Boolean,
|
|
23480
|
+
reflect: true,
|
|
23481
|
+
attribute: false
|
|
23436
23482
|
}
|
|
23437
23483
|
};
|
|
23438
23484
|
}
|
|
@@ -23709,27 +23755,15 @@ class AuroDatePicker extends i$2 {
|
|
|
23709
23755
|
configureDatepicker() {
|
|
23710
23756
|
this.addEventListener('focusin', () => {
|
|
23711
23757
|
|
|
23712
|
-
|
|
23713
|
-
* The datepicker is considered to be in it's initial state based on
|
|
23714
|
-
* if this.value === undefined. The first time we interact with the
|
|
23715
|
-
* datepicker manually, by applying focusin, we need to flag the
|
|
23716
|
-
* datepicker as no longer in the initial state.
|
|
23717
|
-
*/
|
|
23718
|
-
if (this.value === undefined) {
|
|
23719
|
-
this.value = '';
|
|
23720
|
-
}
|
|
23721
|
-
|
|
23722
|
-
if (this.valueEnd === undefined) {
|
|
23723
|
-
this.valueEnd = '';
|
|
23724
|
-
}
|
|
23758
|
+
this.touched = true;
|
|
23725
23759
|
});
|
|
23726
23760
|
|
|
23727
23761
|
this.addEventListener('focusout', (evt) => {
|
|
23728
|
-
if (!this.noValidate && !evt.detail.expanded && this.
|
|
23762
|
+
if (!this.noValidate && !evt.detail.expanded && this.touched) {
|
|
23729
23763
|
if (!this.contains(document.activeElement)) {
|
|
23730
23764
|
this.validation.validate(this.inputList[0]);
|
|
23731
23765
|
|
|
23732
|
-
if (this.inputList[1] && this.inputList[1].
|
|
23766
|
+
if (this.inputList[1] && this.inputList[1].touched) {
|
|
23733
23767
|
this.validation.validate(this.inputList[1]);
|
|
23734
23768
|
}
|
|
23735
23769
|
}
|
|
@@ -24116,6 +24150,7 @@ class AuroDatePicker extends i$2 {
|
|
|
24116
24150
|
setCustomValidityRangeOverflow="${this.setCustomValidityRangeOverflow}"
|
|
24117
24151
|
setCustomValidityRangeUnderflow="${this.setCustomValidityRangeUnderflow}"
|
|
24118
24152
|
?disabled="${this.disabled}"
|
|
24153
|
+
inputmode="${o(this.inputmode)}"
|
|
24119
24154
|
part="input">
|
|
24120
24155
|
<span slot="label"><slot name="fromLabel"></slot></span>
|
|
24121
24156
|
</${this.inputTag}>
|
|
@@ -104,7 +104,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
104
104
|
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.
|
|
105
105
|
|
|
106
106
|
```html
|
|
107
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.
|
|
107
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-datepicker/+esm"></script>
|
|
108
108
|
```
|
|
109
109
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
110
110
|
|
|
@@ -89,6 +89,12 @@ export class AuroDatePicker extends LitElement {
|
|
|
89
89
|
type: StringConstructor;
|
|
90
90
|
reflect: boolean;
|
|
91
91
|
};
|
|
92
|
+
/** Exposes inputmode attribute for input. */
|
|
93
|
+
inputmode: {
|
|
94
|
+
type: StringConstructor;
|
|
95
|
+
attribute: boolean;
|
|
96
|
+
reflect: boolean;
|
|
97
|
+
};
|
|
92
98
|
/**
|
|
93
99
|
* If declared, make bib.fullscreen.headline in HeadingDisplay.
|
|
94
100
|
* Otherwise, Heading 600.
|
|
@@ -237,6 +243,13 @@ export class AuroDatePicker extends LitElement {
|
|
|
237
243
|
valueEnd: {
|
|
238
244
|
type: StringConstructor;
|
|
239
245
|
};
|
|
246
|
+
/**
|
|
247
|
+
* Indicates whether the datepicker is in a dirty state (has been interacted with).
|
|
248
|
+
* @type {boolean}
|
|
249
|
+
* @default false
|
|
250
|
+
* @private
|
|
251
|
+
*/
|
|
252
|
+
touched: boolean;
|
|
240
253
|
};
|
|
241
254
|
static get styles(): import("lit").CSSResult[];
|
|
242
255
|
/**
|
|
@@ -257,6 +270,7 @@ export class AuroDatePicker extends LitElement {
|
|
|
257
270
|
*/
|
|
258
271
|
private calendarRenderUtil;
|
|
259
272
|
formattedStartDate: boolean;
|
|
273
|
+
touched: boolean;
|
|
260
274
|
disabled: boolean;
|
|
261
275
|
required: boolean;
|
|
262
276
|
onDark: boolean;
|