@aurodesignsystem/auro-formkit 2.0.0-beta.2 → 2.0.0-beta.3
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/.turbo/cache/013a48308b893dac-meta.json +1 -1
- package/.turbo/cache/02244170c798a2bd-meta.json +1 -0
- package/.turbo/cache/02244170c798a2bd.tar.zst +0 -0
- package/.turbo/cache/07ca42419b9f050c-meta.json +1 -1
- package/.turbo/cache/0cea4c1f34f3683b-meta.json +1 -1
- package/.turbo/cache/17259cf94d8f8925-meta.json +1 -1
- package/.turbo/cache/1ab37ce15d9be440-meta.json +1 -0
- package/.turbo/cache/1ab37ce15d9be440.tar.zst +0 -0
- package/.turbo/cache/1b9818717e4bdf9f-meta.json +1 -0
- package/.turbo/cache/1b9818717e4bdf9f.tar.zst +0 -0
- package/.turbo/cache/1c0f580d37370ba2-meta.json +1 -0
- package/.turbo/cache/1c0f580d37370ba2.tar.zst +0 -0
- package/.turbo/cache/1c99a949ec63ab35-meta.json +1 -1
- package/.turbo/cache/1de15d89eed2d760-meta.json +1 -1
- package/.turbo/cache/2110a4d14e0d11b2-meta.json +1 -0
- package/.turbo/cache/2110a4d14e0d11b2.tar.zst +0 -0
- package/.turbo/cache/257a7a26ea72dbc5-meta.json +1 -1
- package/.turbo/cache/2990aaa7ebc5b967-meta.json +1 -1
- package/.turbo/cache/2990aaa7ebc5b967.tar.zst +0 -0
- package/.turbo/cache/2fd056afdf4eb39d-meta.json +1 -0
- package/.turbo/cache/2fd056afdf4eb39d.tar.zst +0 -0
- package/.turbo/cache/3bf45120d0cc9bd8-meta.json +1 -1
- package/.turbo/cache/3e12285c614db539-meta.json +1 -0
- package/.turbo/cache/3e12285c614db539.tar.zst +0 -0
- package/.turbo/cache/45035bf5c4147ccd-meta.json +1 -1
- package/.turbo/cache/4f92cea2d8c63de2-meta.json +1 -1
- package/.turbo/cache/5bf2d3f7ba5891e0-meta.json +1 -0
- package/.turbo/cache/5bf2d3f7ba5891e0.tar.zst +0 -0
- package/.turbo/cache/5c16ce3cff5c9dff-meta.json +1 -1
- package/.turbo/cache/5f304c0f37ef25f3-meta.json +1 -1
- package/.turbo/cache/64de7a53e02db647-meta.json +1 -1
- package/.turbo/cache/691a74627ec57993-meta.json +1 -1
- package/.turbo/cache/69aae513b7ec6c7d-meta.json +1 -1
- package/.turbo/cache/6dd67d179191bda8-meta.json +1 -0
- package/.turbo/cache/6dd67d179191bda8.tar.zst +0 -0
- package/.turbo/cache/6dd7058e6703cb35-meta.json +1 -1
- package/.turbo/cache/73e9073a5274616d-meta.json +1 -1
- package/.turbo/cache/773edc0f83c8c5a5-meta.json +1 -1
- package/.turbo/cache/784c03fe9fd5ac05-meta.json +1 -1
- package/.turbo/cache/786a822763403879-meta.json +1 -1
- package/.turbo/cache/7e1043cffa69f327-meta.json +1 -0
- package/.turbo/cache/7e1043cffa69f327.tar.zst +0 -0
- package/.turbo/cache/80a13352066a9801-meta.json +1 -0
- package/.turbo/cache/80a13352066a9801.tar.zst +0 -0
- package/.turbo/cache/80b5d974184a01df-meta.json +1 -1
- package/.turbo/cache/87219c41a4ace9cd-meta.json +1 -1
- package/.turbo/cache/87219c41a4ace9cd.tar.zst +0 -0
- package/.turbo/cache/8954c6073396fadd-meta.json +1 -1
- package/.turbo/cache/8e79bd5c3a16a72e-meta.json +1 -0
- package/.turbo/cache/92daa6d7c389d548-meta.json +1 -1
- package/.turbo/cache/993dff2edb7b6766-meta.json +1 -1
- package/.turbo/cache/9a097d6576dadd64-meta.json +1 -1
- package/.turbo/cache/a63cbfecf0f78586-meta.json +1 -0
- package/.turbo/cache/{ce67b6522dd09e64.tar.zst → a63cbfecf0f78586.tar.zst} +0 -0
- package/.turbo/cache/a6a56bb802e1c20f-meta.json +1 -1
- package/.turbo/cache/a77bc920ea508bb8-meta.json +1 -1
- package/.turbo/cache/a77bc920ea508bb8.tar.zst +0 -0
- package/.turbo/cache/b2c66328fdd78093-meta.json +1 -0
- package/.turbo/cache/b2c66328fdd78093.tar.zst +0 -0
- package/.turbo/cache/b54fc4f664a7a5a0-meta.json +1 -1
- package/.turbo/cache/ba4418918621fbcd-meta.json +1 -1
- package/.turbo/cache/be7c23c37b8ec74b-meta.json +1 -1
- package/.turbo/cache/be7c23c37b8ec74b.tar.zst +0 -0
- package/.turbo/cache/bffc7582905c2a5e-meta.json +1 -0
- package/.turbo/cache/bffc7582905c2a5e.tar.zst +0 -0
- package/.turbo/cache/caa0b4ac8d2a04dd-meta.json +1 -1
- package/.turbo/cache/caa0b4ac8d2a04dd.tar.zst +0 -0
- package/.turbo/cache/cc81de9c0b452a7c-meta.json +1 -1
- package/.turbo/cache/d39e6ef95ebc4cc0-meta.json +1 -0
- package/.turbo/cache/d39e6ef95ebc4cc0.tar.zst +0 -0
- package/.turbo/cache/d572ebb3c833e8f4-meta.json +1 -0
- package/.turbo/cache/d572ebb3c833e8f4.tar.zst +0 -0
- package/.turbo/cache/d61543843c932504-meta.json +1 -0
- package/.turbo/cache/d61543843c932504.tar.zst +0 -0
- package/.turbo/cache/dad1301ac69bcb85-meta.json +1 -1
- package/.turbo/cache/dea5945f55c6aba5-meta.json +1 -0
- package/.turbo/cache/dea5945f55c6aba5.tar.zst +0 -0
- package/.turbo/cache/e992dab20aeefbaf-meta.json +1 -1
- package/.turbo/cache/e992dab20aeefbaf.tar.zst +0 -0
- package/.turbo/cache/f411e2deb0676959-meta.json +1 -0
- package/.turbo/cache/f411e2deb0676959.tar.zst +0 -0
- package/.turbo/cache/fa132b5b5f0e75f8-meta.json +1 -1
- package/.turbo/cache/fbbe2704bf9cb90b-meta.json +1 -1
- package/CHANGELOG.md +26 -0
- package/components/checkbox/.turbo/turbo-build.log +3 -3
- package/components/checkbox/.turbo/turbo-bundler.log +3 -3
- package/components/checkbox/demo/api.md +4 -2
- package/components/checkbox/demo/api.min.js +31 -36
- package/components/checkbox/demo/index.min.js +31 -36
- package/components/checkbox/dist/auro-checkbox-group.d.ts +1 -1
- package/components/checkbox/dist/index.js +31 -36
- package/components/checkbox/src/auro-checkbox-group.js +2 -2
- package/components/combobox/.turbo/turbo-build.log +3 -3
- package/components/combobox/demo/api.md +17 -15
- package/components/combobox/demo/api.min.js +104 -116
- package/components/combobox/demo/index.min.js +104 -116
- package/components/combobox/dist/auro-combobox.d.ts +11 -4
- package/components/combobox/dist/auro-combobox.d.ts.map +1 -1
- package/components/combobox/dist/index.js +103 -115
- package/components/combobox/src/auro-combobox.js +22 -20
- package/components/counter/.turbo/turbo-build.log +3 -3
- package/components/counter/.turbo/turbo-bundler.log +3 -3
- package/components/datepicker/.turbo/turbo-build.log +9 -8
- package/components/datepicker/demo/api.md +107 -87
- package/components/datepicker/demo/api.min.js +96 -130
- package/components/datepicker/demo/index.min.js +96 -130
- package/components/datepicker/dist/auro-datepicker.d.ts +6 -13
- package/components/datepicker/dist/auro-datepicker.d.ts.map +1 -1
- package/components/datepicker/dist/index.js +96 -130
- package/components/datepicker/src/auro-datepicker.js +15 -35
- package/components/dropdown/.turbo/turbo-build.log +3 -3
- package/components/dropdown/.turbo/turbo-bundler.log +2 -2
- package/components/form/.turbo/turbo-build.log +3 -3
- package/components/form/.turbo/turbo-bundler.log +3 -3
- package/components/input/.turbo/turbo-build$colon$sass.log +51 -1
- package/components/input/.turbo/turbo-build.log +56 -6
- package/components/input/.turbo/turbo-bundler.log +3 -3
- package/components/input/.turbo/turbo-sass$colon$render.log +6 -0
- package/components/input/demo/api.md +83 -83
- package/components/input/demo/api.min.js +52 -61
- package/components/input/demo/index.md +6 -6
- package/components/input/demo/index.min.js +52 -61
- package/components/input/dist/auro-input.d.ts.map +1 -1
- package/components/input/dist/base-input.d.ts +5 -12
- package/components/input/dist/base-input.d.ts.map +1 -1
- package/components/input/dist/index.js +52 -61
- package/components/input/dist/styles/mixins-css.d.ts +3 -0
- package/components/input/dist/styles/mixins-css.d.ts.map +1 -0
- package/components/input/src/auro-input.js +0 -1
- package/components/input/src/base-input.js +22 -25
- package/components/input/src/styles/borders.scss +3 -19
- package/components/input/src/styles/color.css +1 -2
- package/components/input/src/styles/color.scss +3 -10
- package/components/input/src/styles/input-css.js +1 -1
- package/components/input/src/styles/input.css +1 -1
- package/components/input/src/styles/input.scss +4 -1
- package/components/input/src/styles/label-css.js +1 -1
- package/components/input/src/styles/label.css +1 -1
- package/components/input/src/styles/label.scss +4 -7
- package/components/input/src/styles/mixins-css.js +2 -0
- package/components/input/src/styles/mixins.css +1 -0
- package/components/input/src/styles/mixins.scss +45 -0
- package/components/input/src/styles/notificationIcons-css.js +1 -1
- package/components/input/src/styles/notificationIcons.css +13 -12
- package/components/input/src/styles/notificationIcons.scss +17 -25
- package/components/input/src/styles/style-css.js +1 -1
- package/components/input/src/styles/style.css +15 -17
- package/components/input/src/styles/style.scss +0 -4
- package/components/menu/.turbo/turbo-build.log +3 -3
- package/components/menu/.turbo/turbo-bundler.log +3 -3
- package/components/menu/demo/api.min.js +1 -1
- package/components/menu/demo/index.min.js +1 -1
- package/components/menu/dist/auro-menu.d.ts +1 -1
- package/components/menu/dist/index.js +1 -1
- package/components/menu/src/auro-menu.js +1 -1
- package/components/radio/.turbo/turbo-build.log +3 -3
- package/components/radio/.turbo/turbo-bundler.log +3 -3
- package/components/radio/demo/api.md +3 -1
- package/components/radio/demo/api.min.js +30 -35
- package/components/radio/demo/index.min.js +30 -35
- package/components/radio/dist/index.js +30 -35
- package/components/radio/src/auro-radio-group.js +1 -1
- package/components/select/.turbo/turbo-build.log +3 -3
- package/components/select/demo/api.md +7 -11
- package/components/select/demo/api.min.js +33 -60
- package/components/select/demo/index.min.js +33 -56
- package/components/select/dist/auro-select.d.ts +2 -2
- package/components/select/dist/auro-select.d.ts.map +1 -1
- package/components/select/dist/index.js +32 -55
- package/components/select/src/auro-select.js +3 -21
- package/package.json +1 -1
- package/packages/form-validation/src/validation.js +29 -34
- package/.turbo/cache/0663fcbb1d711029-meta.json +0 -1
- package/.turbo/cache/0663fcbb1d711029.tar.zst +0 -0
- package/.turbo/cache/0a2b0a4df8a0443f-meta.json +0 -1
- package/.turbo/cache/120c8e207aa1ba35-meta.json +0 -1
- package/.turbo/cache/120c8e207aa1ba35.tar.zst +0 -0
- package/.turbo/cache/17dd4bdef6550a07-meta.json +0 -1
- package/.turbo/cache/17dd4bdef6550a07.tar.zst +0 -0
- package/.turbo/cache/32c0b9995fb5f8dd-meta.json +0 -1
- package/.turbo/cache/32c0b9995fb5f8dd.tar.zst +0 -0
- package/.turbo/cache/47ba2b5ebdb579e9-meta.json +0 -1
- package/.turbo/cache/47ba2b5ebdb579e9.tar.zst +0 -0
- package/.turbo/cache/56cb35d4c7473a23-meta.json +0 -1
- package/.turbo/cache/56cb35d4c7473a23.tar.zst +0 -0
- package/.turbo/cache/626afdc67e0cb540-meta.json +0 -1
- package/.turbo/cache/626afdc67e0cb540.tar.zst +0 -0
- package/.turbo/cache/6ef81cf9a66f982a-meta.json +0 -1
- package/.turbo/cache/6ef81cf9a66f982a.tar.zst +0 -0
- package/.turbo/cache/8b735250fa5a62bf-meta.json +0 -1
- package/.turbo/cache/8b735250fa5a62bf.tar.zst +0 -0
- package/.turbo/cache/9154e8fe6ab767ea-meta.json +0 -1
- package/.turbo/cache/9154e8fe6ab767ea.tar.zst +0 -0
- package/.turbo/cache/a49cc58242467fdc-meta.json +0 -1
- package/.turbo/cache/a49cc58242467fdc.tar.zst +0 -0
- package/.turbo/cache/af061e7a077a9ba5-meta.json +0 -1
- package/.turbo/cache/af061e7a077a9ba5.tar.zst +0 -0
- package/.turbo/cache/b50f1b283b4b81cd-meta.json +0 -1
- package/.turbo/cache/b50f1b283b4b81cd.tar.zst +0 -0
- package/.turbo/cache/bf85bc040b7e64db-meta.json +0 -1
- package/.turbo/cache/bf85bc040b7e64db.tar.zst +0 -0
- package/.turbo/cache/cd5f6987783fb56d-meta.json +0 -1
- package/.turbo/cache/cd5f6987783fb56d.tar.zst +0 -0
- package/.turbo/cache/ce67b6522dd09e64-meta.json +0 -1
- package/.turbo/cache/d716cb7a08152beb-meta.json +0 -1
- package/.turbo/cache/d716cb7a08152beb.tar.zst +0 -0
- package/.turbo/cache/d7a47b77deb3d9a4-meta.json +0 -1
- package/.turbo/cache/d7a47b77deb3d9a4.tar.zst +0 -0
- package/.turbo/cache/ff58f630c9d69af4-meta.json +0 -1
- package/.turbo/cache/ff58f630c9d69af4.tar.zst +0 -0
- /package/.turbo/cache/{0a2b0a4df8a0443f.tar.zst → 8e79bd5c3a16a72e.tar.zst} +0 -0
|
@@ -31,43 +31,41 @@ Generate unique names for dependency components.
|
|
|
31
31
|
|
|
32
32
|
## Properties
|
|
33
33
|
|
|
34
|
-
| Property
|
|
35
|
-
|
|
36
|
-
| [activeLabel](#activeLabel)
|
|
37
|
-
| [autocapitalize](#autocapitalize)
|
|
38
|
-
| [autocomplete](#autocomplete)
|
|
39
|
-
| [autocorrect](#autocorrect)
|
|
40
|
-
| [
|
|
41
|
-
| [
|
|
42
|
-
| [
|
|
43
|
-
| [
|
|
44
|
-
| [
|
|
45
|
-
| [
|
|
46
|
-
| [
|
|
47
|
-
| [
|
|
48
|
-
| [
|
|
49
|
-
| [
|
|
50
|
-
| [
|
|
51
|
-
| [
|
|
52
|
-
| [
|
|
53
|
-
| [
|
|
54
|
-
| [
|
|
55
|
-
| [
|
|
56
|
-
| [
|
|
57
|
-
| [
|
|
58
|
-
| [
|
|
59
|
-
| [
|
|
60
|
-
| [
|
|
61
|
-
| [
|
|
62
|
-
| [
|
|
63
|
-
| [
|
|
64
|
-
| [
|
|
65
|
-
| [
|
|
66
|
-
| [
|
|
67
|
-
| [
|
|
68
|
-
| [
|
|
69
|
-
| [validity](#validity) | `validity` | `String` | | Specifies the `validityState` this element is in. |
|
|
70
|
-
| [value](#value) | `value` | `String` | | Populates the `value` attribute on the input. Can also be read to retrieve the current value of the input. |
|
|
34
|
+
| Property | Attribute | Type | Default | Description |
|
|
35
|
+
|------------------------------------|------------------------------------|-----------|-------------|--------------------------------------------------|
|
|
36
|
+
| [activeLabel](#activeLabel) | `activeLabel` | `Boolean` | false | If set, the label will remain fixed in the active position. |
|
|
37
|
+
| [autocapitalize](#autocapitalize) | `autocapitalize` | `String` | | An enumerated attribute that controls whether and how text input is automatically capitalized as it is entered/edited by the user. [off/none, on/sentences, words, characters] |
|
|
38
|
+
| [autocomplete](#autocomplete) | `autocomplete` | `String` | | An enumerated attribute that defines what the user agent can suggest for autofill. At this time, only `autocomplete="off"` is supported. |
|
|
39
|
+
| [autocorrect](#autocorrect) | `autocorrect` | `String` | | When set to `off`, stops iOS from auto correcting words when typed into a text box. |
|
|
40
|
+
| [disabled](#disabled) | `disabled` | `Boolean` | false | If set, disables the input. |
|
|
41
|
+
| [error](#error) | `error` | `String` | | When defined, sets persistent validity to `customError` and sets the validation message to the attribute value. |
|
|
42
|
+
| [icon](#icon) | `icon` | `Boolean` | false | If set, will render an icon inside the input to the left of the value. Support is limited to auro-input instances with credit card format. |
|
|
43
|
+
| [id](#id) | `id` | `String` | | Sets the unique ID of the element. |
|
|
44
|
+
| [lang](#lang) | `lang` | `String` | | defines the language of an element. |
|
|
45
|
+
| [max](#max) | `max` | `String` | "undefined" | The maximum value allowed. This only applies for inputs with a type of `number` and all date formats. |
|
|
46
|
+
| [maxLength](#maxLength) | `maxLength` | `Number` | "undefined" | The maximum number of characters the user can enter into the text input. This must be an integer value `0` or higher. |
|
|
47
|
+
| [min](#min) | `min` | `String` | "undefined" | The minimum value allowed. This only applies for inputs with a type of `number` and all date formats. |
|
|
48
|
+
| [minLength](#minLength) | `minLength` | `Number` | "undefined" | The minimum number of characters the user can enter into the text input. This must be an non-negative integer value smaller than or equal to the value specified by `maxlength`. |
|
|
49
|
+
| [name](#name) | `name` | `String` | | Populates the `name` attribute on the input. |
|
|
50
|
+
| [noValidate](#noValidate) | `noValidate` | `Boolean` | false | If set, disables auto-validation on blur. |
|
|
51
|
+
| [pattern](#pattern) | `pattern` | `String` | | Specifies a regular expression the form control's value should match. |
|
|
52
|
+
| [placeholder](#placeholder) | `placeholder` | `String` | | Define custom placeholder text, only supported by date input formats. |
|
|
53
|
+
| [readonly](#readonly) | `readonly` | `Boolean` | | Makes the input read-only, but can be set programmatically. |
|
|
54
|
+
| [required](#required) | `required` | `Boolean` | false | Populates the `required` attribute on the input. Used for client-side validation. |
|
|
55
|
+
| [setCustomValidity](#setCustomValidity) | `setCustomValidity` | `String` | | Sets a custom help text message to display for all validity states. |
|
|
56
|
+
| [setCustomValidityCustomError](#setCustomValidityCustomError) | `setCustomValidityCustomError` | `String` | | Custom help text message to display when validity = `customError`. |
|
|
57
|
+
| [setCustomValidityForType](#setCustomValidityForType) | `setCustomValidityForType` | `String` | "undefined" | Custom help text message to display for the declared element `type` and type validity fails. |
|
|
58
|
+
| [setCustomValidityPatternMismatch](#setCustomValidityPatternMismatch) | `setCustomValidityPatternMismatch` | `String` | | Custom help text message to display when validity = `patternMismatch`. |
|
|
59
|
+
| [setCustomValidityRangeOverflow](#setCustomValidityRangeOverflow) | `setCustomValidityRangeOverflow` | `String` | | Custom help text message to display when validity = `rangeOverflow`. |
|
|
60
|
+
| [setCustomValidityRangeUnderflow](#setCustomValidityRangeUnderflow) | `setCustomValidityRangeUnderflow` | `String` | | Custom help text message to display when validity = `rangeUnderflow`. |
|
|
61
|
+
| [setCustomValidityTooLong](#setCustomValidityTooLong) | `setCustomValidityTooLong` | `String` | | Custom help text message to display when validity = `tooLong`. |
|
|
62
|
+
| [setCustomValidityTooShort](#setCustomValidityTooShort) | `setCustomValidityTooShort` | `String` | | Custom help text message to display when validity = `tooShort`. |
|
|
63
|
+
| [setCustomValidityValueMissing](#setCustomValidityValueMissing) | `setCustomValidityValueMissing` | `String` | | Custom help text message to display when validity = `valueMissing`. |
|
|
64
|
+
| [spellcheck](#spellcheck) | `spellcheck` | `String` | | An enumerated attribute defines whether the element may be checked for spelling errors. [true, false]. When set to `false` the attribute `autocorrect` is set to `off` and `autocapitalize` is set to `none`. |
|
|
65
|
+
| [type](#type) | `type` | `String` | | Populates the `type` attribute on the input. Allowed values are `password`, `email`, `credit-card`, `month-day-year`, `month-year`, `year-month-day` or `text`. If given value is not allowed or set, defaults to `text`. |
|
|
66
|
+
| [validateOnInput](#validateOnInput) | `validateOnInput` | `Boolean` | | Sets validation mode to re-eval with each input. |
|
|
67
|
+
| [validity](#validity) | `validity` | `String` | | Specifies the `validityState` this element is in. |
|
|
68
|
+
| [value](#value) | `value` | `String` | | Populates the `value` attribute on the input. Can also be read to retrieve the current value of the input. |
|
|
71
69
|
|
|
72
70
|
## Methods
|
|
73
71
|
|
|
@@ -329,42 +327,6 @@ The `setCustomValidityRangeOverflow` attribute may optionally be used in combina
|
|
|
329
327
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
330
328
|
</auro-accordion>
|
|
331
329
|
|
|
332
|
-
#### Max Length <a name="maxLength"></a>
|
|
333
|
-
Use the `maxlength` attribute to control the length of the input entered.
|
|
334
|
-
|
|
335
|
-
The `setCustomValidityTooLong` attribute may optionally be used in combination with the `maxLength` attribute to define custom help text used when the length of the input is too long.
|
|
336
|
-
|
|
337
|
-
<div class="exampleWrapper exampleWrapper--flex">
|
|
338
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/maxLength.html) -->
|
|
339
|
-
<!-- The below content is automatically added from ../apiExamples/maxLength.html -->
|
|
340
|
-
<auro-input required maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered.">
|
|
341
|
-
<slot slot="label">Voucher Code</slot>
|
|
342
|
-
<slot slot="helptext">Please enter your 12 character voucher code.</slot>
|
|
343
|
-
</auro-input>
|
|
344
|
-
<auro-input bordered required maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered.">
|
|
345
|
-
<slot slot="label">Voucher Code</slot>
|
|
346
|
-
<slot slot="helptext">Please enter your 12 character voucher code.</slot>
|
|
347
|
-
</auro-input>
|
|
348
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
349
|
-
</div>
|
|
350
|
-
<auro-accordion alignRight>
|
|
351
|
-
<span slot="trigger">See code</span>
|
|
352
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/maxLength.html) -->
|
|
353
|
-
<!-- The below code snippet is automatically added from ../apiExamples/maxLength.html -->
|
|
354
|
-
|
|
355
|
-
```html
|
|
356
|
-
<auro-input required maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered.">
|
|
357
|
-
<slot slot="label">Voucher Code</slot>
|
|
358
|
-
<slot slot="helptext">Please enter your 12 character voucher code.</slot>
|
|
359
|
-
</auro-input>
|
|
360
|
-
<auro-input bordered required maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered.">
|
|
361
|
-
<slot slot="label">Voucher Code</slot>
|
|
362
|
-
<slot slot="helptext">Please enter your 12 character voucher code.</slot>
|
|
363
|
-
</auro-input>
|
|
364
|
-
```
|
|
365
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
366
|
-
</auro-accordion>
|
|
367
|
-
|
|
368
330
|
### Min <a name="min"></a>
|
|
369
331
|
Use the `min` attribute to define a minimum value used during validation. The attribute will only apply when `<auro-input>` also has a `type` attribute for `number` or any date format.
|
|
370
332
|
|
|
@@ -416,6 +378,42 @@ The `setCustomValidityRangeUnderflow` attribute may optionally be used in combin
|
|
|
416
378
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
417
379
|
</auro-accordion>
|
|
418
380
|
|
|
381
|
+
### Max Length <a name="maxLength"></a>
|
|
382
|
+
Use the `maxlength` attribute to control the length of the input entered.
|
|
383
|
+
|
|
384
|
+
The `setCustomValidityTooLong` attribute may optionally be used in combination with the `maxLength` attribute to define custom help text used when the length of the input is too long.
|
|
385
|
+
|
|
386
|
+
<div class="exampleWrapper exampleWrapper--flex">
|
|
387
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/maxLength.html) -->
|
|
388
|
+
<!-- The below content is automatically added from ../apiExamples/maxLength.html -->
|
|
389
|
+
<auro-input required maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered.">
|
|
390
|
+
<slot slot="label">Voucher Code</slot>
|
|
391
|
+
<slot slot="helptext">Please enter your 12 character voucher code.</slot>
|
|
392
|
+
</auro-input>
|
|
393
|
+
<auro-input bordered required maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered.">
|
|
394
|
+
<slot slot="label">Voucher Code</slot>
|
|
395
|
+
<slot slot="helptext">Please enter your 12 character voucher code.</slot>
|
|
396
|
+
</auro-input>
|
|
397
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
398
|
+
</div>
|
|
399
|
+
<auro-accordion alignRight>
|
|
400
|
+
<span slot="trigger">See code</span>
|
|
401
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/maxLength.html) -->
|
|
402
|
+
<!-- The below code snippet is automatically added from ../apiExamples/maxLength.html -->
|
|
403
|
+
|
|
404
|
+
```html
|
|
405
|
+
<auro-input required maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered.">
|
|
406
|
+
<slot slot="label">Voucher Code</slot>
|
|
407
|
+
<slot slot="helptext">Please enter your 12 character voucher code.</slot>
|
|
408
|
+
</auro-input>
|
|
409
|
+
<auro-input bordered required maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered.">
|
|
410
|
+
<slot slot="label">Voucher Code</slot>
|
|
411
|
+
<slot slot="helptext">Please enter your 12 character voucher code.</slot>
|
|
412
|
+
</auro-input>
|
|
413
|
+
```
|
|
414
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
415
|
+
</auro-accordion>
|
|
416
|
+
|
|
419
417
|
### Min Length <a name="minLength"></a>
|
|
420
418
|
Use the `minlength` attribute to control the length of the input entered.
|
|
421
419
|
|
|
@@ -455,16 +453,16 @@ The `setCustomValidityTooShort` attribute may optionally be used in combination
|
|
|
455
453
|
### Pattern <a name="pattern"></a>
|
|
456
454
|
Use the `pattern` attribute to set custom input validation. This example also uses the `spellcheck` attribute set to `false` which in turn sets `autocorrect` to `off` and `autocapitalize` to `none`. Additionally the `maxlength` attribute sets the maximum length of characters that can be entered.
|
|
457
455
|
|
|
458
|
-
The `<auro-input>` component supports setting a custom validity message specific to the pattern validation by using the `
|
|
456
|
+
The `<auro-input>` component supports setting a custom validity message specific to the pattern validation by using the `setCustomValidityPatternMismatch` attribute.
|
|
459
457
|
|
|
460
458
|
<div class="exampleWrapper exampleWrapper--flex">
|
|
461
459
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/pattern.html) -->
|
|
462
460
|
<!-- The below content is automatically added from ../apiExamples/pattern.html -->
|
|
463
|
-
<auro-input pattern="[a-z]{1,15}" spellcheck="false"
|
|
461
|
+
<auro-input pattern="[a-z]{1,15}" spellcheck="false" setCustomValidityPatternMismatch="Only contain lowercase letters w/no spaces">
|
|
464
462
|
<span slot="label">Username</span>
|
|
465
463
|
<span slot="helptext">Please enter a username.</span>
|
|
466
464
|
</auro-input>
|
|
467
|
-
<auro-input bordered pattern="[a-z]{1,15}" spellcheck="false"
|
|
465
|
+
<auro-input bordered pattern="[a-z]{1,15}" spellcheck="false" setCustomValidityPatternMismatch="Only contain lowercase letters w/no spaces">
|
|
468
466
|
<span slot="label">Username</span>
|
|
469
467
|
<span slot="helptext">Please enter a username.</span>
|
|
470
468
|
</auro-input>
|
|
@@ -476,11 +474,11 @@ The `<auro-input>` component supports setting a custom validity message specific
|
|
|
476
474
|
<!-- The below code snippet is automatically added from ../apiExamples/pattern.html -->
|
|
477
475
|
|
|
478
476
|
```html
|
|
479
|
-
<auro-input pattern="[a-z]{1,15}" spellcheck="false"
|
|
477
|
+
<auro-input pattern="[a-z]{1,15}" spellcheck="false" setCustomValidityPatternMismatch="Only contain lowercase letters w/no spaces">
|
|
480
478
|
<span slot="label">Username</span>
|
|
481
479
|
<span slot="helptext">Please enter a username.</span>
|
|
482
480
|
</auro-input>
|
|
483
|
-
<auro-input bordered pattern="[a-z]{1,15}" spellcheck="false"
|
|
481
|
+
<auro-input bordered pattern="[a-z]{1,15}" spellcheck="false" setCustomValidityPatternMismatch="Only contain lowercase letters w/no spaces">
|
|
484
482
|
<span slot="label">Username</span>
|
|
485
483
|
<span slot="helptext">Please enter a username.</span>
|
|
486
484
|
</auro-input>
|
|
@@ -641,7 +639,7 @@ The `<auro-input>` component follows the HTML5 input `validity` and `validitySta
|
|
|
641
639
|
### Required <a name="required"></a>
|
|
642
640
|
When present, the `required` attribute specifies that an input field must be filled out before submitting the form.
|
|
643
641
|
|
|
644
|
-
When the validity check fails the validityState equals `valueMissing`. The error message for the `valueMissing` validityState can be changed to a custom string using the `setCustomValidityValueMissing`.
|
|
642
|
+
When the validity check fails, the validityState equals `valueMissing`. The error message for the `valueMissing` validityState can be changed to a custom string using the `setCustomValidityValueMissing`.
|
|
645
643
|
|
|
646
644
|
<div class="exampleWrapper exampleWrapper--flex">
|
|
647
645
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/required.html) -->
|
|
@@ -678,11 +676,11 @@ Use the `validateOnInput` attribute to enable live validation on the `input` eve
|
|
|
678
676
|
<div class="exampleWrapper exampleWrapper--flex">
|
|
679
677
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/validateOnInput.html) -->
|
|
680
678
|
<!-- The below content is automatically added from ../apiExamples/validateOnInput.html -->
|
|
681
|
-
<auro-input validateOnInput required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+"
|
|
679
|
+
<auro-input validateOnInput required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+" setCustomValidityPatternMismatch="Full name requires two or more names with at least one space.">
|
|
682
680
|
<span slot="label">Full Name</span>
|
|
683
681
|
<span slot="helptext">Please enter your full name as it appears on the card.</span>
|
|
684
682
|
</auro-input>
|
|
685
|
-
<auro-input validateOnInput bordered required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+"
|
|
683
|
+
<auro-input validateOnInput bordered required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+" setCustomValidityPatternMismatch="Full name requires two or more names with at least one space.">
|
|
686
684
|
<span slot="label">Full Name</span>
|
|
687
685
|
<span slot="helptext">Please enter your full name as it appears on the card.</span>
|
|
688
686
|
</auro-input>
|
|
@@ -694,11 +692,11 @@ Use the `validateOnInput` attribute to enable live validation on the `input` eve
|
|
|
694
692
|
<!-- The below code snippet is automatically added from ../apiExamples/validateOnInput.html -->
|
|
695
693
|
|
|
696
694
|
```html
|
|
697
|
-
<auro-input validateOnInput required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+"
|
|
695
|
+
<auro-input validateOnInput required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+" setCustomValidityPatternMismatch="Full name requires two or more names with at least one space.">
|
|
698
696
|
<span slot="label">Full Name</span>
|
|
699
697
|
<span slot="helptext">Please enter your full name as it appears on the card.</span>
|
|
700
698
|
</auro-input>
|
|
701
|
-
<auro-input validateOnInput bordered required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+"
|
|
699
|
+
<auro-input validateOnInput bordered required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+" setCustomValidityPatternMismatch="Full name requires two or more names with at least one space.">
|
|
702
700
|
<span slot="label">Full Name</span>
|
|
703
701
|
<span slot="helptext">Please enter your full name as it appears on the card.</span>
|
|
704
702
|
</auro-input>
|
|
@@ -745,6 +743,8 @@ The `setCustomValidity` attribute can be used to set a custom string for all val
|
|
|
745
743
|
### Error <a name="error"></a>
|
|
746
744
|
Use the `error` attribute to apply a persistent custom error that supersedes the HTML5 validation logic.
|
|
747
745
|
|
|
746
|
+
A custom error message can be set using the `error` attribute, or it can be used in conjuction with the `setCustomValidityCustomError` attribute.
|
|
747
|
+
|
|
748
748
|
<div class="exampleWrapper">
|
|
749
749
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/error.html) -->
|
|
750
750
|
<!-- The below content is automatically added from ../apiExamples/error.html -->
|
|
@@ -245,7 +245,7 @@ const t=globalThis,e$1=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShad
|
|
|
245
245
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
246
246
|
*/class r extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}}r._$litElement$=!0,r["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r});const i=globalThis.litElementPolyfillSupport;i?.({LitElement:r});(globalThis.litElementVersions??=[]).push("4.1.1");
|
|
247
247
|
|
|
248
|
-
var styleCss$3 = i$2`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}.typeIcon{display:flex;flex-direction:row;align-items:center}.typeIcon [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);height:var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-100, 0.5rem)}.notificationIcons{display:flex;flex-direction:row;padding-right:var(--ds-size-100, 0.5rem)}:host([bordered]) .typeIcon{padding-left:var(--ds-size-100, 0.5rem)}:host([bordered]) .notificationIcons{align-items:center}.notification:not(:first-of-type){margin-left:var(--ds-size-100, 0.5rem)}.alertNotification{width:calc(var(--ds-size-300, 1.5rem) + var(--ds-size-25, 0.125rem));height:calc(var(--ds-size-300, 1.5rem) + var(--ds-size-25, 0.125rem))}.
|
|
248
|
+
var styleCss$3 = i$2`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}.typeIcon{display:flex;flex-direction:row;align-items:center}.typeIcon [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);height:var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-100, 0.5rem)}.notificationIcons{display:flex;flex-direction:row;padding-right:var(--ds-size-100, 0.5rem)}:host([bordered]) .typeIcon{padding-left:var(--ds-size-100, 0.5rem)}:host([bordered]) .notificationIcons{align-items:center}.notification:not(:first-of-type){margin-left:var(--ds-size-100, 0.5rem)}.alertNotification{width:calc(var(--ds-size-300, 1.5rem) + var(--ds-size-25, 0.125rem));height:calc(var(--ds-size-300, 1.5rem) + var(--ds-size-25, 0.125rem))}.passwordBtn{width:calc(var(--ds-size-300, 1.5rem));height:calc(var(--ds-size-300, 1.5rem))}.notificationBtn{display:block;width:var(--ds-size-300, 1.5rem);height:var(--ds-size-300, 1.5rem);padding:0;border:0;background:unset;cursor:pointer}.notificationBtn [auro-icon]{display:block;height:var(--ds-size-300, 1.5rem);--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}.notificationBtn [auro-icon][hidden]{display:none}:host(:not([bordered])) .typeIcon,:host(:not([bordered])) .notificationIcons{align-items:flex-end;padding-bottom:var(--ds-size-50, 0.25rem)}.clearBtn{transition:all .3s cubic-bezier(0.215, 0.61, 0.355, 1);overflow:hidden;width:0;opacity:0}:host .wrapper:hover .clearBtn,:host .wrapper:focus-within .clearBtn{width:calc(var(--ds-size-200, 1rem) + var(--ds-size-25, 0.125rem));height:calc(var(--ds-size-200, 1rem) + var(--ds-size-25, 0.125rem));opacity:1}:host(:focus-within[type=password]) .notificationIcons[hasValue] .alertNotification{overflow:hidden;width:0;height:0;padding:0;margin:0;visibility:hidden}.inputElement-helpText{margin:var(--ds-size-50, 0.25rem) 0;font-size:var(--ds-text-body-size-xs, 0.75rem);line-height:var(--ds-size-200, 1rem)}input{border:unset}.wrapper{position:relative;overflow:hidden;border-style:solid}:host(:not([bordered],[borderless])) .wrapper{border-width:1px 0}:host([bordered]) .wrapper{border-width:1px;border-radius:var(--ds-border-radius, 0.375rem)}:host(:not([borderless])) .wrapper:focus-within:before{position:absolute;display:block;border-bottom-width:1px;border-bottom-style:solid;content:"";inset:0;pointer-events:none}:host([validity]:not([validity=valid])) .wrapper:before{border-bottom:0}label{transition:all .3s cubic-bezier(0.215, 0.61, 0.355, 1);position:absolute;overflow:hidden;pointer-events:none;text-overflow:ellipsis;white-space:nowrap}:host(:not([bordered])) label{top:calc(100% - var(--ds-size-25, 0.125rem));transform:translateY(-100%)}:host(:not([bordered])) label.withIcon{left:var(--ds-size-400, 2rem)}:host([bordered]) label{top:50%;transform:translateY(-50%)}:host([bordered]) label.withIcon{left:var(--ds-size-500, 2.5rem)}:host([bordered]) label:not(label.withIcon){left:var(--ds-size-100, 0.5rem)}:host .wrapper:focus-within label{top:var(--ds-size-100, 0.5rem);font-size:var(--ds-text-body-size-xs, 0.75rem);transform:unset}:host label.withValue{top:var(--ds-size-100, 0.5rem);font-size:var(--ds-text-body-size-xs, 0.75rem);transform:unset}:host([activeLabel]) .wrapper label{top:var(--ds-size-100, 0.5rem);font-size:var(--ds-text-body-size-xs, 0.75rem);transform:unset}:host{position:relative;display:block}.wrapper{display:flex;flex-direction:row}.main{display:flex;flex-direction:row;position:relative;flex:1}input{transition:all .3s cubic-bezier(0.215, 0.61, 0.355, 1);position:relative;overflow:hidden;min-height:calc(var(--ds-size-700, 3.5rem) + var(--ds-size-25, 0.125rem));max-height:calc(var(--ds-size-700, 3.5rem) + var(--ds-size-25, 0.125rem));flex:1;padding:var(--ds-size-400, 2rem) 0 var(--ds-size-50, 0.25rem);margin:0;font-family:var(--ds-font-family-default, "AS Circular", Helvetica Neue, Arial, sans-serif);font-size:var(--ds-size-200, 1rem);outline:none;text-overflow:ellipsis;white-space:nowrap}input::-ms-reveal,input::-ms-clear{display:none}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}input[type=number]{-moz-appearance:textfield;appearance:textfield}input:disabled{background:none;pointer-events:none}:host([bordered]) input{padding:var(--ds-size-400, 2rem) 0 var(--ds-size-100, 0.5rem)}`;
|
|
249
249
|
|
|
250
250
|
var colorCss$3 = i$2`.wrapper{border-color:transparent}.inputElement-helpText{color:var(--ds-auro-input-help-text-color)}input{background-color:transparent;caret-color:var(--ds-auro-input-caret-color);color:var(--ds-auro-input-text-color)}input::placeholder{color:transparent}input:focus::placeholder{color:var(--ds-auro-input-placeholder-text-color)}input:disabled{--ds-auro-input-input-text-color: var(--ds-color-text-ui-disabled-default, #adadad)}label{color:var(--ds-auro-input-label-text-color)}:host(:not([bordered],[borderless])) .wrapper{border-bottom-color:var(--ds-auro-input-border-color)}:host([bordered]) .wrapper{border-color:var(--ds-auro-input-border-color);background-color:var(--ds-auro-input-container-color)}:host([bordered]) .wrapper:focus-within{--ds-auro-input-border-color: var(--ds-color-border-ui-focus-default, #2c67b5);box-shadow:inset 0 0 0 1px var(--ds-auro-input-border-color)}:host(:not([borderless])) .wrapper:focus-within{--ds-auro-input-border-color: var(--ds-color-border-ui-focus-default, #2c67b5)}:host(:not([borderless])) .wrapper:focus-within:before{border-bottom-color:transparent}:host([validity]:not([validity=valid])){--ds-auro-input-border-color: var(--ds-color-border-error-default, #cc1816);--ds-auro-input-help-text-color: var(--ds-color-text-error-default, #cc1816)}:host([validity]:not([validity=valid])[bordered]) .wrapper{--ds-auro-input-border-color: var(--ds-color-border-error-default, #cc1816);box-shadow:inset 0 0 0 1px var(--ds-auro-input-border-color)}:host([disabled]){--ds-auro-input-border-color: var(--ds-color-border-ui-disabled-default, #adadad);--ds-auro-input-label-text-color: var(--ds-color-text-ui-disabled-default, #adadad)}`;
|
|
251
251
|
|
|
@@ -1922,20 +1922,20 @@ class AuroFormValidation {
|
|
|
1922
1922
|
const pattern = new RegExp(`^${elem.pattern}$`, 'u');
|
|
1923
1923
|
|
|
1924
1924
|
if (!pattern.test(elem.value)) {
|
|
1925
|
-
elem.validity = '
|
|
1926
|
-
elem.
|
|
1925
|
+
elem.validity = 'patternMismatch';
|
|
1926
|
+
elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || '';
|
|
1927
1927
|
}
|
|
1928
1928
|
}
|
|
1929
1929
|
|
|
1930
1930
|
// Length > 0 is required to prevent the error message from showing when the input is empty
|
|
1931
1931
|
if (elem.value?.length > 0 && elem.value?.length < elem.minLength) {
|
|
1932
1932
|
elem.validity = 'tooShort';
|
|
1933
|
-
elem.
|
|
1933
|
+
elem.errorMessage = elem.setCustomValidityTooShort || elem.setCustomValidity || '';
|
|
1934
1934
|
}
|
|
1935
1935
|
|
|
1936
1936
|
if (elem.value?.length > elem.maxLength) {
|
|
1937
1937
|
elem.validity = 'tooLong';
|
|
1938
|
-
elem.
|
|
1938
|
+
elem.errorMessage = elem.setCustomValidityTooLong || elem.setCustomValidity || '';
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
1941
|
|
|
@@ -1951,33 +1951,32 @@ class AuroFormValidation {
|
|
|
1951
1951
|
const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; // eslint-disable-line require-unicode-regexp
|
|
1952
1952
|
|
|
1953
1953
|
if (!elem.value.match(emailRegex)) {
|
|
1954
|
-
elem.validity = '
|
|
1955
|
-
elem.
|
|
1954
|
+
elem.validity = 'patternMismatch';
|
|
1955
|
+
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
1956
1956
|
}
|
|
1957
1957
|
} else if (elem.type === 'credit-card') {
|
|
1958
1958
|
if (elem.value.length > 0 && elem.value.length < elem.validationCCLength) {
|
|
1959
1959
|
elem.validity = 'tooShort';
|
|
1960
|
-
elem.
|
|
1960
|
+
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
1961
1961
|
}
|
|
1962
1962
|
} else if (elem.type === 'number') {
|
|
1963
1963
|
if (elem.max !== undefined && Number(elem.max) < Number(elem.value)) {
|
|
1964
1964
|
elem.validity = 'rangeOverflow';
|
|
1965
|
-
elem.
|
|
1965
|
+
elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
|
|
1966
1966
|
}
|
|
1967
1967
|
|
|
1968
|
-
if (elem.min !== undefined && Number(elem.min) > Number(elem.value)) {
|
|
1968
|
+
if (elem.min !== undefined && elem.value?.length > 0 && Number(elem.min) > Number(elem.value)) {
|
|
1969
1969
|
elem.validity = 'rangeUnderflow';
|
|
1970
|
-
elem.
|
|
1970
|
+
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
1971
1971
|
}
|
|
1972
|
-
|
|
1973
1972
|
} else if (elem.type === 'month-day-year' ||
|
|
1974
1973
|
elem.type === 'month-year' ||
|
|
1975
1974
|
elem.type === 'month-fullYear' ||
|
|
1976
1975
|
elem.type === 'year-month-day'
|
|
1977
1976
|
) {
|
|
1978
|
-
if (elem.value
|
|
1977
|
+
if (elem.value?.length > 0 && elem.value.length < elem.dateStrLength) {
|
|
1979
1978
|
elem.validity = 'tooShort';
|
|
1980
|
-
elem.
|
|
1979
|
+
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
1981
1980
|
} else {
|
|
1982
1981
|
const valueDate = new Date(elem.value);
|
|
1983
1982
|
|
|
@@ -1987,7 +1986,7 @@ class AuroFormValidation {
|
|
|
1987
1986
|
|
|
1988
1987
|
if (valueDate > maxDate) {
|
|
1989
1988
|
elem.validity = 'rangeOverflow';
|
|
1990
|
-
elem.
|
|
1989
|
+
elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
|
|
1991
1990
|
}
|
|
1992
1991
|
}
|
|
1993
1992
|
|
|
@@ -1997,7 +1996,7 @@ class AuroFormValidation {
|
|
|
1997
1996
|
|
|
1998
1997
|
if (valueDate < minDate) {
|
|
1999
1998
|
elem.validity = 'rangeUnderflow';
|
|
2000
|
-
elem.
|
|
1999
|
+
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
2001
2000
|
}
|
|
2002
2001
|
}
|
|
2003
2002
|
}
|
|
@@ -2020,10 +2019,10 @@ class AuroFormValidation {
|
|
|
2020
2019
|
|
|
2021
2020
|
if (elem.hasAttribute('error')) {
|
|
2022
2021
|
elem.validity = 'customError';
|
|
2023
|
-
elem.
|
|
2022
|
+
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
2024
2023
|
} else if (validationShouldRun) {
|
|
2025
2024
|
elem.validity = 'valid';
|
|
2026
|
-
elem.
|
|
2025
|
+
elem.errorMessage = '';
|
|
2027
2026
|
|
|
2028
2027
|
/**
|
|
2029
2028
|
* Only validate once we interact with the datepicker
|
|
@@ -2035,7 +2034,7 @@ class AuroFormValidation {
|
|
|
2035
2034
|
let hasValue = elem.value && elem.value.length > 0;
|
|
2036
2035
|
|
|
2037
2036
|
// If there is a second input in the elem and that value is undefined or an empty string set hasValue to false;
|
|
2038
|
-
if (this.auroInputElements
|
|
2037
|
+
if (this.auroInputElements?.length === 2) {
|
|
2039
2038
|
if (!this.auroInputElements[1].value || this.auroInputElements[1].length === 0) {
|
|
2040
2039
|
hasValue = false;
|
|
2041
2040
|
}
|
|
@@ -2043,31 +2042,27 @@ class AuroFormValidation {
|
|
|
2043
2042
|
|
|
2044
2043
|
if (!hasValue && elem.required) {
|
|
2045
2044
|
elem.validity = 'valueMissing';
|
|
2046
|
-
elem.
|
|
2045
|
+
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
2047
2046
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
2048
2047
|
this.validateType(elem);
|
|
2049
2048
|
this.validateAttributes(elem);
|
|
2050
2049
|
}
|
|
2051
2050
|
}
|
|
2052
2051
|
|
|
2053
|
-
if (this.auroInputElements
|
|
2052
|
+
if (this.auroInputElements?.length > 0) {
|
|
2054
2053
|
elem.validity = this.auroInputElements[0].validity;
|
|
2055
|
-
elem.
|
|
2054
|
+
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
2056
2055
|
|
|
2057
|
-
if (elem.validity === 'valid') {
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
elem.setCustomValidity = this.auroInputElements[1].setCustomValidity;
|
|
2061
|
-
}
|
|
2056
|
+
if (elem.validity === 'valid' && this.auroInputElements.length > 1) {
|
|
2057
|
+
elem.validity = this.auroInputElements[1].validity;
|
|
2058
|
+
elem.errorMessage = this.auroInputElements[1].errorMessage;
|
|
2062
2059
|
}
|
|
2063
2060
|
}
|
|
2064
2061
|
|
|
2065
2062
|
if (validationShouldRun || elem.hasAttribute('error')) {
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
elem.setCustomValidity = elem.ValidityMessageOverride;
|
|
2070
|
-
}
|
|
2063
|
+
// Use the validity message override if it is declared
|
|
2064
|
+
if (elem.validity && elem.validity !== 'valid' && elem.ValidityMessageOverride) {
|
|
2065
|
+
elem.errorMessage = elem.ValidityMessageOverride;
|
|
2071
2066
|
}
|
|
2072
2067
|
|
|
2073
2068
|
this.getErrorMessage(elem);
|
|
@@ -2113,18 +2108,18 @@ class AuroFormValidation {
|
|
|
2113
2108
|
if (elem.validity !== 'valid') {
|
|
2114
2109
|
if (elem.setCustomValidity) {
|
|
2115
2110
|
elem.errorMessage = elem.setCustomValidity;
|
|
2116
|
-
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
2111
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input') && elem.errorMessage === '') {
|
|
2117
2112
|
const input = elem.renderRoot.querySelector('input');
|
|
2118
2113
|
|
|
2119
2114
|
if (input.validationMessage.length > 0) {
|
|
2120
2115
|
elem.errorMessage = input.validationMessage;
|
|
2121
2116
|
}
|
|
2122
|
-
} else if (this.inputElements &&
|
|
2117
|
+
} else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
|
|
2123
2118
|
const firstInput = this.inputElements[0];
|
|
2124
2119
|
|
|
2125
2120
|
if (firstInput.validationMessage.length > 0) {
|
|
2126
2121
|
elem.errorMessage = firstInput.validationMessage;
|
|
2127
|
-
} else if (this.inputElements
|
|
2122
|
+
} else if (this.inputElements?.length === 2) {
|
|
2128
2123
|
const secondInput = this.inputElements[1];
|
|
2129
2124
|
|
|
2130
2125
|
if (secondInput.validationMessage.length > 0) {
|
|
@@ -2152,8 +2147,7 @@ class AuroFormValidation {
|
|
|
2152
2147
|
* @attr {Boolean} bordered - Applies bordered UI variant.
|
|
2153
2148
|
* @attr {Boolean} borderless - Applies borderless UI variant.
|
|
2154
2149
|
* @attr {Boolean} disabled - If set, disables the input.
|
|
2155
|
-
* @attr {String} error - When defined, sets persistent validity to `customError` and sets
|
|
2156
|
-
* @prop {String} errorMessage - Contains the help text message for the current validity error.
|
|
2150
|
+
* @attr {String} error - When defined, sets persistent validity to `customError` and sets the validation message to the attribute value.
|
|
2157
2151
|
* @attr {Boolean} icon - If set, will render an icon inside the input to the left of the value. Support is limited to auro-input instances with credit card format.
|
|
2158
2152
|
* @attr {String} id - Sets the unique ID of the element.
|
|
2159
2153
|
* @attr {String} lang - defines the language of an element.
|
|
@@ -2167,10 +2161,10 @@ class AuroFormValidation {
|
|
|
2167
2161
|
* @attr {Boolean} required - Populates the `required` attribute on the input. Used for client-side validation.
|
|
2168
2162
|
* @attr {String} pattern - Specifies a regular expression the form control's value should match.
|
|
2169
2163
|
* @attr {String} placeholder - Define custom placeholder text, only supported by date input formats.
|
|
2170
|
-
* @attr {String} setCustomValidity - Sets a custom help text message to display for all
|
|
2164
|
+
* @attr {String} setCustomValidity - Sets a custom help text message to display for all validity states.
|
|
2171
2165
|
* @attr {String} setCustomValidityCustomError - Custom help text message to display when validity = `customError`.
|
|
2172
2166
|
* @attr {String} setCustomValidityValueMissing - Custom help text message to display when validity = `valueMissing`.
|
|
2173
|
-
* @attr {String}
|
|
2167
|
+
* @attr {String} setCustomValidityPatternMismatch - Custom help text message to display when validity = `patternMismatch`.
|
|
2174
2168
|
* @attr {String} setCustomValidityTooShort - Custom help text message to display when validity = `tooShort`.
|
|
2175
2169
|
* @attr {String} setCustomValidityTooLong - Custom help text message to display when validity = `tooLong`.
|
|
2176
2170
|
* @attr {String} setCustomValidityForType - Custom help text message to display for the declared element `type` and type validity fails.
|
|
@@ -2316,20 +2310,18 @@ class BaseInput extends r {
|
|
|
2316
2310
|
type: String,
|
|
2317
2311
|
reflect: true
|
|
2318
2312
|
},
|
|
2319
|
-
errorMessage: { type: String },
|
|
2320
2313
|
validity: {
|
|
2321
2314
|
type: String,
|
|
2322
2315
|
reflect: true
|
|
2323
2316
|
},
|
|
2324
|
-
setCustomValidity:
|
|
2325
|
-
setCustomValidityCustomError:
|
|
2326
|
-
setCustomValidityValueMissing:
|
|
2327
|
-
|
|
2328
|
-
setCustomValidityTooShort:
|
|
2329
|
-
setCustomValidityTooLong:
|
|
2330
|
-
setCustomValidityRangeOverflow:
|
|
2331
|
-
setCustomValidityRangeUnderflow:
|
|
2332
|
-
customValidityTypeEmail: { type: String }
|
|
2317
|
+
setCustomValidity: { type: String },
|
|
2318
|
+
setCustomValidityCustomError: { type: String },
|
|
2319
|
+
setCustomValidityValueMissing: { type: String },
|
|
2320
|
+
setCustomValidityPatternMismatch: { type: String },
|
|
2321
|
+
setCustomValidityTooShort: { type: String },
|
|
2322
|
+
setCustomValidityTooLong: { type: String },
|
|
2323
|
+
setCustomValidityRangeOverflow: { type: String },
|
|
2324
|
+
setCustomValidityRangeUnderflow: { type: String }
|
|
2333
2325
|
};
|
|
2334
2326
|
}
|
|
2335
2327
|
|
|
@@ -2957,7 +2949,7 @@ class BaseInput extends r {
|
|
|
2957
2949
|
this.maxLength = card.formatLength;
|
|
2958
2950
|
this.minLength = card.formatMinLength;
|
|
2959
2951
|
|
|
2960
|
-
this.
|
|
2952
|
+
this.errorMessage = card.errorMessage;
|
|
2961
2953
|
|
|
2962
2954
|
if (this.icon) {
|
|
2963
2955
|
this.inputIconName = card.cardIcon;
|
|
@@ -2977,63 +2969,63 @@ class BaseInput extends r {
|
|
|
2977
2969
|
name: 'Airlines',
|
|
2978
2970
|
regex: /^(?<num>1|2)\d{0}/u,
|
|
2979
2971
|
formatMinLength: 17,
|
|
2980
|
-
|
|
2972
|
+
errorMessage: CreditCardValidationMessage,
|
|
2981
2973
|
cardIcon: 'credit-card'
|
|
2982
2974
|
},
|
|
2983
2975
|
{
|
|
2984
2976
|
name: 'Commercial',
|
|
2985
2977
|
regex: /^(?<num>2)\d{0}/u,
|
|
2986
2978
|
formatMinLength: 8,
|
|
2987
|
-
|
|
2979
|
+
errorMessage: CreditCardValidationMessage,
|
|
2988
2980
|
cardIcon: 'credit-card'
|
|
2989
2981
|
},
|
|
2990
2982
|
{
|
|
2991
2983
|
name: 'Alaska Commercial',
|
|
2992
2984
|
regex: /^(?<num>27)\d{0}/u,
|
|
2993
2985
|
formatMinLength: 8,
|
|
2994
|
-
|
|
2986
|
+
errorMessage: CreditCardValidationMessage,
|
|
2995
2987
|
cardIcon: 'cc-alaska'
|
|
2996
2988
|
},
|
|
2997
2989
|
{
|
|
2998
2990
|
name: 'American Express',
|
|
2999
2991
|
regex: /^(?<num>34|37)\d{0}/u,
|
|
3000
2992
|
formatLength: 17,
|
|
3001
|
-
|
|
2993
|
+
errorMessage: CreditCardValidationMessage,
|
|
3002
2994
|
cardIcon: 'cc-amex'
|
|
3003
2995
|
},
|
|
3004
2996
|
{
|
|
3005
2997
|
name: 'Diners club',
|
|
3006
2998
|
regex: /^(?<num>36|38)\d{0}/u,
|
|
3007
2999
|
formatLength: 16,
|
|
3008
|
-
|
|
3000
|
+
errorMessage: CreditCardValidationMessage,
|
|
3009
3001
|
cardIcon: 'credit-card'
|
|
3010
3002
|
},
|
|
3011
3003
|
{
|
|
3012
3004
|
name: 'Visa',
|
|
3013
3005
|
regex: /^(?<num>4)\d{0}/u,
|
|
3014
3006
|
formatLength: 19,
|
|
3015
|
-
|
|
3007
|
+
errorMessage: CreditCardValidationMessage,
|
|
3016
3008
|
cardIcon: 'cc-visa'
|
|
3017
3009
|
},
|
|
3018
3010
|
{
|
|
3019
3011
|
name: 'Alaska Airlines Visa',
|
|
3020
3012
|
regex: /^(?<num>4147\s34|4888\s93|4800\s11|4313\s51|4313\s07)\d{0}/u,
|
|
3021
3013
|
formatLength: 19,
|
|
3022
|
-
|
|
3014
|
+
errorMessage: CreditCardValidationMessage,
|
|
3023
3015
|
cardIcon: 'cc-alaska'
|
|
3024
3016
|
},
|
|
3025
3017
|
{
|
|
3026
3018
|
name: 'Master Card',
|
|
3027
3019
|
regex: /^(?<num>5)\d{0}/u,
|
|
3028
3020
|
formatLength: 19,
|
|
3029
|
-
|
|
3021
|
+
errorMessage: CreditCardValidationMessage,
|
|
3030
3022
|
cardIcon: 'cc-mastercard'
|
|
3031
3023
|
},
|
|
3032
3024
|
{
|
|
3033
3025
|
name: 'Discover Card',
|
|
3034
3026
|
regex: /^(?<num>6)\d{0}/u,
|
|
3035
3027
|
formatLength: 19,
|
|
3036
|
-
|
|
3028
|
+
errorMessage: CreditCardValidationMessage,
|
|
3037
3029
|
cardIcon: 'cc-discover'
|
|
3038
3030
|
}
|
|
3039
3031
|
];
|
|
@@ -3041,7 +3033,7 @@ class BaseInput extends r {
|
|
|
3041
3033
|
let type = {
|
|
3042
3034
|
name: 'Default Card',
|
|
3043
3035
|
formatLength: 19,
|
|
3044
|
-
|
|
3036
|
+
errorMessage: CreditCardValidationMessage,
|
|
3045
3037
|
cardIcon: 'credit-card'
|
|
3046
3038
|
};
|
|
3047
3039
|
|
|
@@ -4066,7 +4058,6 @@ class AuroInput extends BaseInput {
|
|
|
4066
4058
|
<p class="inputElement-helpText" id="${this.uniqueId}" role="alert" aria-live="assertive" part="helpText">
|
|
4067
4059
|
${this.errorMessage}
|
|
4068
4060
|
</p>`
|
|
4069
|
-
|
|
4070
4061
|
}
|
|
4071
4062
|
`;
|
|
4072
4063
|
}
|