@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
|
@@ -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;
|
|
@@ -5154,6 +5162,13 @@ class BaseInput extends i {
|
|
|
5154
5162
|
type: String
|
|
5155
5163
|
},
|
|
5156
5164
|
|
|
5165
|
+
/** Exposes inputmode attribute for input. */
|
|
5166
|
+
inputmode: {
|
|
5167
|
+
type: String,
|
|
5168
|
+
attribute: true,
|
|
5169
|
+
reflect: true
|
|
5170
|
+
},
|
|
5171
|
+
|
|
5157
5172
|
/**
|
|
5158
5173
|
* Defines the language of an element.
|
|
5159
5174
|
*/
|
|
@@ -5355,6 +5370,18 @@ class BaseInput extends i {
|
|
|
5355
5370
|
validity: {
|
|
5356
5371
|
type: String,
|
|
5357
5372
|
reflect: true
|
|
5373
|
+
},
|
|
5374
|
+
|
|
5375
|
+
/**
|
|
5376
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
5377
|
+
* @type {boolean}
|
|
5378
|
+
* @default false
|
|
5379
|
+
* @private
|
|
5380
|
+
*/
|
|
5381
|
+
touched: {
|
|
5382
|
+
type: Boolean,
|
|
5383
|
+
reflect: true,
|
|
5384
|
+
attribute: false
|
|
5358
5385
|
}
|
|
5359
5386
|
};
|
|
5360
5387
|
}
|
|
@@ -5641,15 +5668,7 @@ class BaseInput extends i {
|
|
|
5641
5668
|
*/
|
|
5642
5669
|
handleFocusin() {
|
|
5643
5670
|
|
|
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
|
-
}
|
|
5671
|
+
this.touched = true;
|
|
5653
5672
|
}
|
|
5654
5673
|
|
|
5655
5674
|
/**
|
|
@@ -5715,9 +5734,9 @@ class BaseInput extends i {
|
|
|
5715
5734
|
|
|
5716
5735
|
if (this.type in defaultLengths) {
|
|
5717
5736
|
this.lengthForType = this.format ? this.format.length : defaultLengths[this.type];
|
|
5718
|
-
this.
|
|
5737
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
5719
5738
|
} else if (this.type === 'number') {
|
|
5720
|
-
this.
|
|
5739
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
5721
5740
|
}
|
|
5722
5741
|
|
|
5723
5742
|
if (this.type === "date" && !this.format) {
|
|
@@ -7075,7 +7094,7 @@ class AuroInput extends BaseInput {
|
|
|
7075
7094
|
pattern="${o$3(this.definePattern())}"
|
|
7076
7095
|
maxlength="${o$3(this.maxLength ? this.maxLength : undefined)}"
|
|
7077
7096
|
minlength="${o$3(this.minLength ? this.minLength : undefined)}"
|
|
7078
|
-
inputMode="${o$3(this.
|
|
7097
|
+
inputMode="${o$3(this.inputmode ? this.inputmode : undefined)}"
|
|
7079
7098
|
?required="${this.required}"
|
|
7080
7099
|
?disabled="${this.disabled}"
|
|
7081
7100
|
aria-describedby="${this.uniqueId}"
|
|
@@ -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;
|
|
@@ -5079,6 +5087,13 @@ class BaseInput extends i {
|
|
|
5079
5087
|
type: String
|
|
5080
5088
|
},
|
|
5081
5089
|
|
|
5090
|
+
/** Exposes inputmode attribute for input. */
|
|
5091
|
+
inputmode: {
|
|
5092
|
+
type: String,
|
|
5093
|
+
attribute: true,
|
|
5094
|
+
reflect: true
|
|
5095
|
+
},
|
|
5096
|
+
|
|
5082
5097
|
/**
|
|
5083
5098
|
* Defines the language of an element.
|
|
5084
5099
|
*/
|
|
@@ -5280,6 +5295,18 @@ class BaseInput extends i {
|
|
|
5280
5295
|
validity: {
|
|
5281
5296
|
type: String,
|
|
5282
5297
|
reflect: true
|
|
5298
|
+
},
|
|
5299
|
+
|
|
5300
|
+
/**
|
|
5301
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
5302
|
+
* @type {boolean}
|
|
5303
|
+
* @default false
|
|
5304
|
+
* @private
|
|
5305
|
+
*/
|
|
5306
|
+
touched: {
|
|
5307
|
+
type: Boolean,
|
|
5308
|
+
reflect: true,
|
|
5309
|
+
attribute: false
|
|
5283
5310
|
}
|
|
5284
5311
|
};
|
|
5285
5312
|
}
|
|
@@ -5566,15 +5593,7 @@ class BaseInput extends i {
|
|
|
5566
5593
|
*/
|
|
5567
5594
|
handleFocusin() {
|
|
5568
5595
|
|
|
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
|
-
}
|
|
5596
|
+
this.touched = true;
|
|
5578
5597
|
}
|
|
5579
5598
|
|
|
5580
5599
|
/**
|
|
@@ -5640,9 +5659,9 @@ class BaseInput extends i {
|
|
|
5640
5659
|
|
|
5641
5660
|
if (this.type in defaultLengths) {
|
|
5642
5661
|
this.lengthForType = this.format ? this.format.length : defaultLengths[this.type];
|
|
5643
|
-
this.
|
|
5662
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
5644
5663
|
} else if (this.type === 'number') {
|
|
5645
|
-
this.
|
|
5664
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
5646
5665
|
}
|
|
5647
5666
|
|
|
5648
5667
|
if (this.type === "date" && !this.format) {
|
|
@@ -7000,7 +7019,7 @@ class AuroInput extends BaseInput {
|
|
|
7000
7019
|
pattern="${o$3(this.definePattern())}"
|
|
7001
7020
|
maxlength="${o$3(this.maxLength ? this.maxLength : undefined)}"
|
|
7002
7021
|
minlength="${o$3(this.minLength ? this.minLength : undefined)}"
|
|
7003
|
-
inputMode="${o$3(this.
|
|
7022
|
+
inputMode="${o$3(this.inputmode ? this.inputmode : undefined)}"
|
|
7004
7023
|
?required="${this.required}"
|
|
7005
7024
|
?disabled="${this.disabled}"
|
|
7006
7025
|
aria-describedby="${this.uniqueId}"
|
|
@@ -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.
|
|
102
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-input/+esm"></script>
|
|
103
103
|
```
|
|
104
104
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
105
105
|
|
|
@@ -107,6 +107,12 @@ export default class BaseInput extends LitElement {
|
|
|
107
107
|
id: {
|
|
108
108
|
type: StringConstructor;
|
|
109
109
|
};
|
|
110
|
+
/** Exposes inputmode attribute for input. */
|
|
111
|
+
inputmode: {
|
|
112
|
+
type: StringConstructor;
|
|
113
|
+
attribute: boolean;
|
|
114
|
+
reflect: boolean;
|
|
115
|
+
};
|
|
110
116
|
/**
|
|
111
117
|
* Defines the language of an element.
|
|
112
118
|
*/
|
|
@@ -282,6 +288,13 @@ export default class BaseInput extends LitElement {
|
|
|
282
288
|
type: StringConstructor;
|
|
283
289
|
reflect: boolean;
|
|
284
290
|
};
|
|
291
|
+
/**
|
|
292
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
293
|
+
* @type {boolean}
|
|
294
|
+
* @default false
|
|
295
|
+
* @private
|
|
296
|
+
*/
|
|
297
|
+
touched: boolean;
|
|
285
298
|
};
|
|
286
299
|
static get styles(): import("lit").CSSResult[];
|
|
287
300
|
icon: boolean;
|
|
@@ -301,6 +314,7 @@ export default class BaseInput extends LitElement {
|
|
|
301
314
|
* @returns {void}
|
|
302
315
|
*/
|
|
303
316
|
private privateDefaults;
|
|
317
|
+
touched: boolean;
|
|
304
318
|
util: AuroInputUtilities;
|
|
305
319
|
validation: AuroFormValidation;
|
|
306
320
|
inputIconName: any;
|
|
@@ -434,6 +448,7 @@ export default class BaseInput extends LitElement {
|
|
|
434
448
|
*/
|
|
435
449
|
private configureDataForType;
|
|
436
450
|
lengthForType: any;
|
|
451
|
+
inputmode: any;
|
|
437
452
|
/**
|
|
438
453
|
* Validates against list of supported this.allowedInputTypes; return type=text if invalid request.
|
|
439
454
|
* @private
|
|
@@ -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;
|
|
@@ -5003,6 +5011,13 @@ class BaseInput extends LitElement {
|
|
|
5003
5011
|
type: String
|
|
5004
5012
|
},
|
|
5005
5013
|
|
|
5014
|
+
/** Exposes inputmode attribute for input. */
|
|
5015
|
+
inputmode: {
|
|
5016
|
+
type: String,
|
|
5017
|
+
attribute: true,
|
|
5018
|
+
reflect: true
|
|
5019
|
+
},
|
|
5020
|
+
|
|
5006
5021
|
/**
|
|
5007
5022
|
* Defines the language of an element.
|
|
5008
5023
|
*/
|
|
@@ -5204,6 +5219,18 @@ class BaseInput extends LitElement {
|
|
|
5204
5219
|
validity: {
|
|
5205
5220
|
type: String,
|
|
5206
5221
|
reflect: true
|
|
5222
|
+
},
|
|
5223
|
+
|
|
5224
|
+
/**
|
|
5225
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
5226
|
+
* @type {boolean}
|
|
5227
|
+
* @default false
|
|
5228
|
+
* @private
|
|
5229
|
+
*/
|
|
5230
|
+
touched: {
|
|
5231
|
+
type: Boolean,
|
|
5232
|
+
reflect: true,
|
|
5233
|
+
attribute: false
|
|
5207
5234
|
}
|
|
5208
5235
|
};
|
|
5209
5236
|
}
|
|
@@ -5490,15 +5517,7 @@ class BaseInput extends LitElement {
|
|
|
5490
5517
|
*/
|
|
5491
5518
|
handleFocusin() {
|
|
5492
5519
|
|
|
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
|
-
}
|
|
5520
|
+
this.touched = true;
|
|
5502
5521
|
}
|
|
5503
5522
|
|
|
5504
5523
|
/**
|
|
@@ -5564,9 +5583,9 @@ class BaseInput extends LitElement {
|
|
|
5564
5583
|
|
|
5565
5584
|
if (this.type in defaultLengths) {
|
|
5566
5585
|
this.lengthForType = this.format ? this.format.length : defaultLengths[this.type];
|
|
5567
|
-
this.
|
|
5586
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
5568
5587
|
} else if (this.type === 'number') {
|
|
5569
|
-
this.
|
|
5588
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
5570
5589
|
}
|
|
5571
5590
|
|
|
5572
5591
|
if (this.type === "date" && !this.format) {
|
|
@@ -6924,7 +6943,7 @@ class AuroInput extends BaseInput {
|
|
|
6924
6943
|
pattern="${ifDefined(this.definePattern())}"
|
|
6925
6944
|
maxlength="${ifDefined(this.maxLength ? this.maxLength : undefined)}"
|
|
6926
6945
|
minlength="${ifDefined(this.minLength ? this.minLength : undefined)}"
|
|
6927
|
-
inputMode="${ifDefined(this.
|
|
6946
|
+
inputMode="${ifDefined(this.inputmode ? this.inputmode : undefined)}"
|
|
6928
6947
|
?required="${this.required}"
|
|
6929
6948
|
?disabled="${this.disabled}"
|
|
6930
6949
|
aria-describedby="${this.uniqueId}"
|
|
@@ -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;
|
|
@@ -5003,6 +5011,13 @@ class BaseInput extends LitElement {
|
|
|
5003
5011
|
type: String
|
|
5004
5012
|
},
|
|
5005
5013
|
|
|
5014
|
+
/** Exposes inputmode attribute for input. */
|
|
5015
|
+
inputmode: {
|
|
5016
|
+
type: String,
|
|
5017
|
+
attribute: true,
|
|
5018
|
+
reflect: true
|
|
5019
|
+
},
|
|
5020
|
+
|
|
5006
5021
|
/**
|
|
5007
5022
|
* Defines the language of an element.
|
|
5008
5023
|
*/
|
|
@@ -5204,6 +5219,18 @@ class BaseInput extends LitElement {
|
|
|
5204
5219
|
validity: {
|
|
5205
5220
|
type: String,
|
|
5206
5221
|
reflect: true
|
|
5222
|
+
},
|
|
5223
|
+
|
|
5224
|
+
/**
|
|
5225
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
5226
|
+
* @type {boolean}
|
|
5227
|
+
* @default false
|
|
5228
|
+
* @private
|
|
5229
|
+
*/
|
|
5230
|
+
touched: {
|
|
5231
|
+
type: Boolean,
|
|
5232
|
+
reflect: true,
|
|
5233
|
+
attribute: false
|
|
5207
5234
|
}
|
|
5208
5235
|
};
|
|
5209
5236
|
}
|
|
@@ -5490,15 +5517,7 @@ class BaseInput extends LitElement {
|
|
|
5490
5517
|
*/
|
|
5491
5518
|
handleFocusin() {
|
|
5492
5519
|
|
|
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
|
-
}
|
|
5520
|
+
this.touched = true;
|
|
5502
5521
|
}
|
|
5503
5522
|
|
|
5504
5523
|
/**
|
|
@@ -5564,9 +5583,9 @@ class BaseInput extends LitElement {
|
|
|
5564
5583
|
|
|
5565
5584
|
if (this.type in defaultLengths) {
|
|
5566
5585
|
this.lengthForType = this.format ? this.format.length : defaultLengths[this.type];
|
|
5567
|
-
this.
|
|
5586
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
5568
5587
|
} else if (this.type === 'number') {
|
|
5569
|
-
this.
|
|
5588
|
+
this.inputmode = this.inputmode || 'numeric';
|
|
5570
5589
|
}
|
|
5571
5590
|
|
|
5572
5591
|
if (this.type === "date" && !this.format) {
|
|
@@ -6924,7 +6943,7 @@ class AuroInput extends BaseInput {
|
|
|
6924
6943
|
pattern="${ifDefined(this.definePattern())}"
|
|
6925
6944
|
maxlength="${ifDefined(this.maxLength ? this.maxLength : undefined)}"
|
|
6926
6945
|
minlength="${ifDefined(this.minLength ? this.minLength : undefined)}"
|
|
6927
|
-
inputMode="${ifDefined(this.
|
|
6946
|
+
inputMode="${ifDefined(this.inputmode ? this.inputmode : undefined)}"
|
|
6928
6947
|
?required="${this.required}"
|
|
6929
6948
|
?disabled="${this.disabled}"
|
|
6930
6949
|
aria-describedby="${this.uniqueId}"
|
|
@@ -110,7 +110,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
110
110
|
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.
|
|
111
111
|
|
|
112
112
|
```html
|
|
113
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.
|
|
113
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-menu/+esm"></script>
|
|
114
114
|
```
|
|
115
115
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
116
116
|
|
|
@@ -110,7 +110,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
110
110
|
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.
|
|
111
111
|
|
|
112
112
|
```html
|
|
113
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.
|
|
113
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-menu/+esm"></script>
|
|
114
114
|
```
|
|
115
115
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
116
116
|
|
|
@@ -100,7 +100,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
100
100
|
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.
|
|
101
101
|
|
|
102
102
|
```html
|
|
103
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.
|
|
103
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0/auro-radio/+esm"></script>
|
|
104
104
|
```
|
|
105
105
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
106
106
|
|