@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
|
@@ -502,6 +502,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
502
502
|
reset(elem) {
|
|
503
503
|
elem.validity = undefined;
|
|
504
504
|
elem.value = undefined;
|
|
505
|
+
elem.touched = false;
|
|
505
506
|
|
|
506
507
|
// Resets the second value of the datepicker in range state
|
|
507
508
|
if (elem.valueEnd) {
|
|
@@ -639,7 +640,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
639
640
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
640
641
|
|
|
641
642
|
// Guard Clause: if the value is too short
|
|
642
|
-
if (elem.value
|
|
643
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
643
644
|
|
|
644
645
|
elem.validity = 'tooShort';
|
|
645
646
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -709,11 +710,17 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
709
710
|
this.getAuroInputs(elem);
|
|
710
711
|
|
|
711
712
|
// Validate only if noValidate is not true and the input does not have focus
|
|
712
|
-
|
|
713
|
+
let validationShouldRun =
|
|
714
|
+
force ||
|
|
715
|
+
(!elem.contains(document.activeElement) &&
|
|
716
|
+
(elem.touched ||
|
|
717
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
718
|
+
elem.validateOnInput;
|
|
713
719
|
|
|
714
720
|
if (elem.hasAttribute('error')) {
|
|
715
721
|
elem.validity = 'customError';
|
|
716
722
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
723
|
+
validationShouldRun = false;
|
|
717
724
|
} else if (validationShouldRun) {
|
|
718
725
|
elem.validity = 'valid';
|
|
719
726
|
elem.errorMessage = '';
|
|
@@ -734,7 +741,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
734
741
|
}
|
|
735
742
|
}
|
|
736
743
|
|
|
737
|
-
if (!hasValue && elem.required) {
|
|
744
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
738
745
|
elem.validity = 'valueMissing';
|
|
739
746
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
740
747
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -745,7 +752,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
745
752
|
}
|
|
746
753
|
}
|
|
747
754
|
|
|
748
|
-
if (this.auroInputElements?.length > 0) {
|
|
755
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
749
756
|
elem.validity = this.auroInputElements[0].validity;
|
|
750
757
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
751
758
|
|
|
@@ -824,7 +831,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
824
831
|
}
|
|
825
832
|
}
|
|
826
833
|
} else {
|
|
827
|
-
elem.errorMessage =
|
|
834
|
+
elem.errorMessage = '';
|
|
828
835
|
}
|
|
829
836
|
}
|
|
830
837
|
};
|
|
@@ -20435,6 +20442,7 @@ class AuroFormValidation {
|
|
|
20435
20442
|
reset(elem) {
|
|
20436
20443
|
elem.validity = undefined;
|
|
20437
20444
|
elem.value = undefined;
|
|
20445
|
+
elem.touched = false;
|
|
20438
20446
|
|
|
20439
20447
|
// Resets the second value of the datepicker in range state
|
|
20440
20448
|
if (elem.valueEnd) {
|
|
@@ -20572,7 +20580,7 @@ class AuroFormValidation {
|
|
|
20572
20580
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
20573
20581
|
|
|
20574
20582
|
// Guard Clause: if the value is too short
|
|
20575
|
-
if (elem.value
|
|
20583
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
20576
20584
|
|
|
20577
20585
|
elem.validity = 'tooShort';
|
|
20578
20586
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -20642,11 +20650,17 @@ class AuroFormValidation {
|
|
|
20642
20650
|
this.getAuroInputs(elem);
|
|
20643
20651
|
|
|
20644
20652
|
// Validate only if noValidate is not true and the input does not have focus
|
|
20645
|
-
|
|
20653
|
+
let validationShouldRun =
|
|
20654
|
+
force ||
|
|
20655
|
+
(!elem.contains(document.activeElement) &&
|
|
20656
|
+
(elem.touched ||
|
|
20657
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
20658
|
+
elem.validateOnInput;
|
|
20646
20659
|
|
|
20647
20660
|
if (elem.hasAttribute('error')) {
|
|
20648
20661
|
elem.validity = 'customError';
|
|
20649
20662
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
20663
|
+
validationShouldRun = false;
|
|
20650
20664
|
} else if (validationShouldRun) {
|
|
20651
20665
|
elem.validity = 'valid';
|
|
20652
20666
|
elem.errorMessage = '';
|
|
@@ -20667,7 +20681,7 @@ class AuroFormValidation {
|
|
|
20667
20681
|
}
|
|
20668
20682
|
}
|
|
20669
20683
|
|
|
20670
|
-
if (!hasValue && elem.required) {
|
|
20684
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
20671
20685
|
elem.validity = 'valueMissing';
|
|
20672
20686
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
20673
20687
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -20678,7 +20692,7 @@ class AuroFormValidation {
|
|
|
20678
20692
|
}
|
|
20679
20693
|
}
|
|
20680
20694
|
|
|
20681
|
-
if (this.auroInputElements?.length > 0) {
|
|
20695
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
20682
20696
|
elem.validity = this.auroInputElements[0].validity;
|
|
20683
20697
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
20684
20698
|
|
|
@@ -20757,7 +20771,7 @@ class AuroFormValidation {
|
|
|
20757
20771
|
}
|
|
20758
20772
|
}
|
|
20759
20773
|
} else {
|
|
20760
|
-
elem.errorMessage =
|
|
20774
|
+
elem.errorMessage = '';
|
|
20761
20775
|
}
|
|
20762
20776
|
}
|
|
20763
20777
|
}
|
|
@@ -20808,6 +20822,7 @@ class BaseInput extends LitElement {
|
|
|
20808
20822
|
* @returns {void}
|
|
20809
20823
|
*/
|
|
20810
20824
|
privateDefaults() {
|
|
20825
|
+
this.touched = false;
|
|
20811
20826
|
this.util = new AuroInputUtilities();
|
|
20812
20827
|
this.validation = new AuroFormValidation();
|
|
20813
20828
|
this.inputIconName = undefined;
|
|
@@ -21169,6 +21184,18 @@ class BaseInput extends LitElement {
|
|
|
21169
21184
|
validity: {
|
|
21170
21185
|
type: String,
|
|
21171
21186
|
reflect: true
|
|
21187
|
+
},
|
|
21188
|
+
|
|
21189
|
+
/**
|
|
21190
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
21191
|
+
* @type {boolean}
|
|
21192
|
+
* @default false
|
|
21193
|
+
* @private
|
|
21194
|
+
*/
|
|
21195
|
+
touched: {
|
|
21196
|
+
type: Boolean,
|
|
21197
|
+
reflect: true,
|
|
21198
|
+
attribute: false
|
|
21172
21199
|
}
|
|
21173
21200
|
};
|
|
21174
21201
|
}
|
|
@@ -21455,15 +21482,7 @@ class BaseInput extends LitElement {
|
|
|
21455
21482
|
*/
|
|
21456
21483
|
handleFocusin() {
|
|
21457
21484
|
|
|
21458
|
-
|
|
21459
|
-
* The input is considered to be in it's initial state based on
|
|
21460
|
-
* if this.value === undefined. The first time we interact with the
|
|
21461
|
-
* input manually, by applying focusin, we need to flag the
|
|
21462
|
-
* input as no longer in the initial state.
|
|
21463
|
-
*/
|
|
21464
|
-
if (this.value === undefined) {
|
|
21465
|
-
this.value = '';
|
|
21466
|
-
}
|
|
21485
|
+
this.touched = true;
|
|
21467
21486
|
}
|
|
21468
21487
|
|
|
21469
21488
|
/**
|
|
@@ -23038,6 +23057,7 @@ class AuroDatePicker extends LitElement {
|
|
|
23038
23057
|
this.calendarRenderUtil.updateCentralDate(this, new Date());
|
|
23039
23058
|
}
|
|
23040
23059
|
|
|
23060
|
+
this.touched = false;
|
|
23041
23061
|
this.disabled = false;
|
|
23042
23062
|
this.required = false;
|
|
23043
23063
|
this.onDark = false;
|
|
@@ -23369,6 +23389,18 @@ class AuroDatePicker extends LitElement {
|
|
|
23369
23389
|
*/
|
|
23370
23390
|
valueEnd: {
|
|
23371
23391
|
type: String
|
|
23392
|
+
},
|
|
23393
|
+
|
|
23394
|
+
/**
|
|
23395
|
+
* Indicates whether the datepicker is in a dirty state (has been interacted with).
|
|
23396
|
+
* @type {boolean}
|
|
23397
|
+
* @default false
|
|
23398
|
+
* @private
|
|
23399
|
+
*/
|
|
23400
|
+
touched: {
|
|
23401
|
+
type: Boolean,
|
|
23402
|
+
reflect: true,
|
|
23403
|
+
attribute: false
|
|
23372
23404
|
}
|
|
23373
23405
|
};
|
|
23374
23406
|
}
|
|
@@ -23645,27 +23677,15 @@ class AuroDatePicker extends LitElement {
|
|
|
23645
23677
|
configureDatepicker() {
|
|
23646
23678
|
this.addEventListener('focusin', () => {
|
|
23647
23679
|
|
|
23648
|
-
|
|
23649
|
-
* The datepicker is considered to be in it's initial state based on
|
|
23650
|
-
* if this.value === undefined. The first time we interact with the
|
|
23651
|
-
* datepicker manually, by applying focusin, we need to flag the
|
|
23652
|
-
* datepicker as no longer in the initial state.
|
|
23653
|
-
*/
|
|
23654
|
-
if (this.value === undefined) {
|
|
23655
|
-
this.value = '';
|
|
23656
|
-
}
|
|
23657
|
-
|
|
23658
|
-
if (this.valueEnd === undefined) {
|
|
23659
|
-
this.valueEnd = '';
|
|
23660
|
-
}
|
|
23680
|
+
this.touched = true;
|
|
23661
23681
|
});
|
|
23662
23682
|
|
|
23663
23683
|
this.addEventListener('focusout', (evt) => {
|
|
23664
|
-
if (!this.noValidate && !evt.detail.expanded && this.
|
|
23684
|
+
if (!this.noValidate && !evt.detail.expanded && this.touched) {
|
|
23665
23685
|
if (!this.contains(document.activeElement)) {
|
|
23666
23686
|
this.validation.validate(this.inputList[0]);
|
|
23667
23687
|
|
|
23668
|
-
if (this.inputList[1] && this.inputList[1].
|
|
23688
|
+
if (this.inputList[1] && this.inputList[1].touched) {
|
|
23669
23689
|
this.validation.validate(this.inputList[1]);
|
|
23670
23690
|
}
|
|
23671
23691
|
}
|
|
@@ -107,7 +107,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
107
107
|
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.
|
|
108
108
|
|
|
109
109
|
```html
|
|
110
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
110
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-dropdown/+esm"></script>
|
|
111
111
|
```
|
|
112
112
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
113
113
|
|
|
@@ -107,7 +107,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
107
107
|
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.
|
|
108
108
|
|
|
109
109
|
```html
|
|
110
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
110
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-dropdown/+esm"></script>
|
|
111
111
|
```
|
|
112
112
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
113
113
|
|
|
@@ -109,7 +109,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
109
109
|
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.
|
|
110
110
|
|
|
111
111
|
```html
|
|
112
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
112
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-form/+esm"></script>
|
|
113
113
|
```
|
|
114
114
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
115
115
|
|
|
@@ -109,7 +109,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
109
109
|
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.
|
|
110
110
|
|
|
111
111
|
```html
|
|
112
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
112
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-form/+esm"></script>
|
|
113
113
|
```
|
|
114
114
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
115
115
|
|
|
@@ -99,7 +99,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
99
99
|
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.
|
|
100
100
|
|
|
101
101
|
```html
|
|
102
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
102
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-input/+esm"></script>
|
|
103
103
|
```
|
|
104
104
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
105
105
|
|
|
@@ -4621,6 +4621,7 @@ class AuroFormValidation {
|
|
|
4621
4621
|
reset(elem) {
|
|
4622
4622
|
elem.validity = undefined;
|
|
4623
4623
|
elem.value = undefined;
|
|
4624
|
+
elem.touched = false;
|
|
4624
4625
|
|
|
4625
4626
|
// Resets the second value of the datepicker in range state
|
|
4626
4627
|
if (elem.valueEnd) {
|
|
@@ -4758,7 +4759,7 @@ class AuroFormValidation {
|
|
|
4758
4759
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
4759
4760
|
|
|
4760
4761
|
// Guard Clause: if the value is too short
|
|
4761
|
-
if (elem.value
|
|
4762
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
4762
4763
|
|
|
4763
4764
|
elem.validity = 'tooShort';
|
|
4764
4765
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -4828,11 +4829,17 @@ class AuroFormValidation {
|
|
|
4828
4829
|
this.getAuroInputs(elem);
|
|
4829
4830
|
|
|
4830
4831
|
// Validate only if noValidate is not true and the input does not have focus
|
|
4831
|
-
|
|
4832
|
+
let validationShouldRun =
|
|
4833
|
+
force ||
|
|
4834
|
+
(!elem.contains(document.activeElement) &&
|
|
4835
|
+
(elem.touched ||
|
|
4836
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
4837
|
+
elem.validateOnInput;
|
|
4832
4838
|
|
|
4833
4839
|
if (elem.hasAttribute('error')) {
|
|
4834
4840
|
elem.validity = 'customError';
|
|
4835
4841
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
4842
|
+
validationShouldRun = false;
|
|
4836
4843
|
} else if (validationShouldRun) {
|
|
4837
4844
|
elem.validity = 'valid';
|
|
4838
4845
|
elem.errorMessage = '';
|
|
@@ -4853,7 +4860,7 @@ class AuroFormValidation {
|
|
|
4853
4860
|
}
|
|
4854
4861
|
}
|
|
4855
4862
|
|
|
4856
|
-
if (!hasValue && elem.required) {
|
|
4863
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
4857
4864
|
elem.validity = 'valueMissing';
|
|
4858
4865
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
4859
4866
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -4864,7 +4871,7 @@ class AuroFormValidation {
|
|
|
4864
4871
|
}
|
|
4865
4872
|
}
|
|
4866
4873
|
|
|
4867
|
-
if (this.auroInputElements?.length > 0) {
|
|
4874
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
4868
4875
|
elem.validity = this.auroInputElements[0].validity;
|
|
4869
4876
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
4870
4877
|
|
|
@@ -4943,7 +4950,7 @@ class AuroFormValidation {
|
|
|
4943
4950
|
}
|
|
4944
4951
|
}
|
|
4945
4952
|
} else {
|
|
4946
|
-
elem.errorMessage =
|
|
4953
|
+
elem.errorMessage = '';
|
|
4947
4954
|
}
|
|
4948
4955
|
}
|
|
4949
4956
|
}
|
|
@@ -4994,6 +5001,7 @@ class BaseInput extends i {
|
|
|
4994
5001
|
* @returns {void}
|
|
4995
5002
|
*/
|
|
4996
5003
|
privateDefaults() {
|
|
5004
|
+
this.touched = false;
|
|
4997
5005
|
this.util = new AuroInputUtilities();
|
|
4998
5006
|
this.validation = new AuroFormValidation();
|
|
4999
5007
|
this.inputIconName = undefined;
|
|
@@ -5355,6 +5363,18 @@ class BaseInput extends i {
|
|
|
5355
5363
|
validity: {
|
|
5356
5364
|
type: String,
|
|
5357
5365
|
reflect: true
|
|
5366
|
+
},
|
|
5367
|
+
|
|
5368
|
+
/**
|
|
5369
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
5370
|
+
* @type {boolean}
|
|
5371
|
+
* @default false
|
|
5372
|
+
* @private
|
|
5373
|
+
*/
|
|
5374
|
+
touched: {
|
|
5375
|
+
type: Boolean,
|
|
5376
|
+
reflect: true,
|
|
5377
|
+
attribute: false
|
|
5358
5378
|
}
|
|
5359
5379
|
};
|
|
5360
5380
|
}
|
|
@@ -5641,15 +5661,7 @@ class BaseInput extends i {
|
|
|
5641
5661
|
*/
|
|
5642
5662
|
handleFocusin() {
|
|
5643
5663
|
|
|
5644
|
-
|
|
5645
|
-
* The input is considered to be in it's initial state based on
|
|
5646
|
-
* if this.value === undefined. The first time we interact with the
|
|
5647
|
-
* input manually, by applying focusin, we need to flag the
|
|
5648
|
-
* input as no longer in the initial state.
|
|
5649
|
-
*/
|
|
5650
|
-
if (this.value === undefined) {
|
|
5651
|
-
this.value = '';
|
|
5652
|
-
}
|
|
5664
|
+
this.touched = true;
|
|
5653
5665
|
}
|
|
5654
5666
|
|
|
5655
5667
|
/**
|
|
@@ -4546,6 +4546,7 @@ class AuroFormValidation {
|
|
|
4546
4546
|
reset(elem) {
|
|
4547
4547
|
elem.validity = undefined;
|
|
4548
4548
|
elem.value = undefined;
|
|
4549
|
+
elem.touched = false;
|
|
4549
4550
|
|
|
4550
4551
|
// Resets the second value of the datepicker in range state
|
|
4551
4552
|
if (elem.valueEnd) {
|
|
@@ -4683,7 +4684,7 @@ class AuroFormValidation {
|
|
|
4683
4684
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
4684
4685
|
|
|
4685
4686
|
// Guard Clause: if the value is too short
|
|
4686
|
-
if (elem.value
|
|
4687
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
4687
4688
|
|
|
4688
4689
|
elem.validity = 'tooShort';
|
|
4689
4690
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -4753,11 +4754,17 @@ class AuroFormValidation {
|
|
|
4753
4754
|
this.getAuroInputs(elem);
|
|
4754
4755
|
|
|
4755
4756
|
// Validate only if noValidate is not true and the input does not have focus
|
|
4756
|
-
|
|
4757
|
+
let validationShouldRun =
|
|
4758
|
+
force ||
|
|
4759
|
+
(!elem.contains(document.activeElement) &&
|
|
4760
|
+
(elem.touched ||
|
|
4761
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
4762
|
+
elem.validateOnInput;
|
|
4757
4763
|
|
|
4758
4764
|
if (elem.hasAttribute('error')) {
|
|
4759
4765
|
elem.validity = 'customError';
|
|
4760
4766
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
4767
|
+
validationShouldRun = false;
|
|
4761
4768
|
} else if (validationShouldRun) {
|
|
4762
4769
|
elem.validity = 'valid';
|
|
4763
4770
|
elem.errorMessage = '';
|
|
@@ -4778,7 +4785,7 @@ class AuroFormValidation {
|
|
|
4778
4785
|
}
|
|
4779
4786
|
}
|
|
4780
4787
|
|
|
4781
|
-
if (!hasValue && elem.required) {
|
|
4788
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
4782
4789
|
elem.validity = 'valueMissing';
|
|
4783
4790
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
4784
4791
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -4789,7 +4796,7 @@ class AuroFormValidation {
|
|
|
4789
4796
|
}
|
|
4790
4797
|
}
|
|
4791
4798
|
|
|
4792
|
-
if (this.auroInputElements?.length > 0) {
|
|
4799
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
4793
4800
|
elem.validity = this.auroInputElements[0].validity;
|
|
4794
4801
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
4795
4802
|
|
|
@@ -4868,7 +4875,7 @@ class AuroFormValidation {
|
|
|
4868
4875
|
}
|
|
4869
4876
|
}
|
|
4870
4877
|
} else {
|
|
4871
|
-
elem.errorMessage =
|
|
4878
|
+
elem.errorMessage = '';
|
|
4872
4879
|
}
|
|
4873
4880
|
}
|
|
4874
4881
|
}
|
|
@@ -4919,6 +4926,7 @@ class BaseInput extends i {
|
|
|
4919
4926
|
* @returns {void}
|
|
4920
4927
|
*/
|
|
4921
4928
|
privateDefaults() {
|
|
4929
|
+
this.touched = false;
|
|
4922
4930
|
this.util = new AuroInputUtilities();
|
|
4923
4931
|
this.validation = new AuroFormValidation();
|
|
4924
4932
|
this.inputIconName = undefined;
|
|
@@ -5280,6 +5288,18 @@ class BaseInput extends i {
|
|
|
5280
5288
|
validity: {
|
|
5281
5289
|
type: String,
|
|
5282
5290
|
reflect: true
|
|
5291
|
+
},
|
|
5292
|
+
|
|
5293
|
+
/**
|
|
5294
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
5295
|
+
* @type {boolean}
|
|
5296
|
+
* @default false
|
|
5297
|
+
* @private
|
|
5298
|
+
*/
|
|
5299
|
+
touched: {
|
|
5300
|
+
type: Boolean,
|
|
5301
|
+
reflect: true,
|
|
5302
|
+
attribute: false
|
|
5283
5303
|
}
|
|
5284
5304
|
};
|
|
5285
5305
|
}
|
|
@@ -5566,15 +5586,7 @@ class BaseInput extends i {
|
|
|
5566
5586
|
*/
|
|
5567
5587
|
handleFocusin() {
|
|
5568
5588
|
|
|
5569
|
-
|
|
5570
|
-
* The input is considered to be in it's initial state based on
|
|
5571
|
-
* if this.value === undefined. The first time we interact with the
|
|
5572
|
-
* input manually, by applying focusin, we need to flag the
|
|
5573
|
-
* input as no longer in the initial state.
|
|
5574
|
-
*/
|
|
5575
|
-
if (this.value === undefined) {
|
|
5576
|
-
this.value = '';
|
|
5577
|
-
}
|
|
5589
|
+
this.touched = true;
|
|
5578
5590
|
}
|
|
5579
5591
|
|
|
5580
5592
|
/**
|
|
@@ -99,7 +99,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
99
99
|
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.
|
|
100
100
|
|
|
101
101
|
```html
|
|
102
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
102
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-input/+esm"></script>
|
|
103
103
|
```
|
|
104
104
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
105
105
|
|
|
@@ -282,6 +282,13 @@ export default class BaseInput extends LitElement {
|
|
|
282
282
|
type: StringConstructor;
|
|
283
283
|
reflect: boolean;
|
|
284
284
|
};
|
|
285
|
+
/**
|
|
286
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
287
|
+
* @type {boolean}
|
|
288
|
+
* @default false
|
|
289
|
+
* @private
|
|
290
|
+
*/
|
|
291
|
+
touched: boolean;
|
|
285
292
|
};
|
|
286
293
|
static get styles(): import("lit").CSSResult[];
|
|
287
294
|
icon: boolean;
|
|
@@ -301,6 +308,7 @@ export default class BaseInput extends LitElement {
|
|
|
301
308
|
* @returns {void}
|
|
302
309
|
*/
|
|
303
310
|
private privateDefaults;
|
|
311
|
+
touched: boolean;
|
|
304
312
|
util: AuroInputUtilities;
|
|
305
313
|
validation: AuroFormValidation;
|
|
306
314
|
inputIconName: any;
|
|
@@ -4470,6 +4470,7 @@ class AuroFormValidation {
|
|
|
4470
4470
|
reset(elem) {
|
|
4471
4471
|
elem.validity = undefined;
|
|
4472
4472
|
elem.value = undefined;
|
|
4473
|
+
elem.touched = false;
|
|
4473
4474
|
|
|
4474
4475
|
// Resets the second value of the datepicker in range state
|
|
4475
4476
|
if (elem.valueEnd) {
|
|
@@ -4607,7 +4608,7 @@ class AuroFormValidation {
|
|
|
4607
4608
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
4608
4609
|
|
|
4609
4610
|
// Guard Clause: if the value is too short
|
|
4610
|
-
if (elem.value
|
|
4611
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
4611
4612
|
|
|
4612
4613
|
elem.validity = 'tooShort';
|
|
4613
4614
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -4677,11 +4678,17 @@ class AuroFormValidation {
|
|
|
4677
4678
|
this.getAuroInputs(elem);
|
|
4678
4679
|
|
|
4679
4680
|
// Validate only if noValidate is not true and the input does not have focus
|
|
4680
|
-
|
|
4681
|
+
let validationShouldRun =
|
|
4682
|
+
force ||
|
|
4683
|
+
(!elem.contains(document.activeElement) &&
|
|
4684
|
+
(elem.touched ||
|
|
4685
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
4686
|
+
elem.validateOnInput;
|
|
4681
4687
|
|
|
4682
4688
|
if (elem.hasAttribute('error')) {
|
|
4683
4689
|
elem.validity = 'customError';
|
|
4684
4690
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
4691
|
+
validationShouldRun = false;
|
|
4685
4692
|
} else if (validationShouldRun) {
|
|
4686
4693
|
elem.validity = 'valid';
|
|
4687
4694
|
elem.errorMessage = '';
|
|
@@ -4702,7 +4709,7 @@ class AuroFormValidation {
|
|
|
4702
4709
|
}
|
|
4703
4710
|
}
|
|
4704
4711
|
|
|
4705
|
-
if (!hasValue && elem.required) {
|
|
4712
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
4706
4713
|
elem.validity = 'valueMissing';
|
|
4707
4714
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
4708
4715
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -4713,7 +4720,7 @@ class AuroFormValidation {
|
|
|
4713
4720
|
}
|
|
4714
4721
|
}
|
|
4715
4722
|
|
|
4716
|
-
if (this.auroInputElements?.length > 0) {
|
|
4723
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
4717
4724
|
elem.validity = this.auroInputElements[0].validity;
|
|
4718
4725
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
4719
4726
|
|
|
@@ -4792,7 +4799,7 @@ class AuroFormValidation {
|
|
|
4792
4799
|
}
|
|
4793
4800
|
}
|
|
4794
4801
|
} else {
|
|
4795
|
-
elem.errorMessage =
|
|
4802
|
+
elem.errorMessage = '';
|
|
4796
4803
|
}
|
|
4797
4804
|
}
|
|
4798
4805
|
}
|
|
@@ -4843,6 +4850,7 @@ class BaseInput extends LitElement {
|
|
|
4843
4850
|
* @returns {void}
|
|
4844
4851
|
*/
|
|
4845
4852
|
privateDefaults() {
|
|
4853
|
+
this.touched = false;
|
|
4846
4854
|
this.util = new AuroInputUtilities();
|
|
4847
4855
|
this.validation = new AuroFormValidation();
|
|
4848
4856
|
this.inputIconName = undefined;
|
|
@@ -5204,6 +5212,18 @@ class BaseInput extends LitElement {
|
|
|
5204
5212
|
validity: {
|
|
5205
5213
|
type: String,
|
|
5206
5214
|
reflect: true
|
|
5215
|
+
},
|
|
5216
|
+
|
|
5217
|
+
/**
|
|
5218
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
5219
|
+
* @type {boolean}
|
|
5220
|
+
* @default false
|
|
5221
|
+
* @private
|
|
5222
|
+
*/
|
|
5223
|
+
touched: {
|
|
5224
|
+
type: Boolean,
|
|
5225
|
+
reflect: true,
|
|
5226
|
+
attribute: false
|
|
5207
5227
|
}
|
|
5208
5228
|
};
|
|
5209
5229
|
}
|
|
@@ -5490,15 +5510,7 @@ class BaseInput extends LitElement {
|
|
|
5490
5510
|
*/
|
|
5491
5511
|
handleFocusin() {
|
|
5492
5512
|
|
|
5493
|
-
|
|
5494
|
-
* The input is considered to be in it's initial state based on
|
|
5495
|
-
* if this.value === undefined. The first time we interact with the
|
|
5496
|
-
* input manually, by applying focusin, we need to flag the
|
|
5497
|
-
* input as no longer in the initial state.
|
|
5498
|
-
*/
|
|
5499
|
-
if (this.value === undefined) {
|
|
5500
|
-
this.value = '';
|
|
5501
|
-
}
|
|
5513
|
+
this.touched = true;
|
|
5502
5514
|
}
|
|
5503
5515
|
|
|
5504
5516
|
/**
|