@aurodesignsystem/auro-formkit 5.9.0 → 5.9.2
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 +13 -4
- package/README.md +4 -4
- package/components/bibtemplate/dist/iconVersion.d.ts +1 -1
- package/components/bibtemplate/dist/index.js +2 -2
- package/components/bibtemplate/dist/registered.js +2 -2
- package/components/checkbox/README.md +62 -62
- package/components/checkbox/demo/api.js +1 -1
- package/components/checkbox/demo/api.md +127 -84
- package/components/checkbox/demo/api.min.js +125 -42
- package/components/checkbox/demo/index.md +9 -281
- package/components/checkbox/demo/index.min.js +125 -42
- package/components/checkbox/demo/readme.html +3 -4
- package/components/checkbox/demo/readme.md +62 -62
- package/components/checkbox/dist/auro-checkbox-group.d.ts +7 -8
- package/components/checkbox/dist/auro-checkbox.d.ts +74 -20
- package/components/checkbox/dist/index.js +125 -42
- package/components/checkbox/dist/registered.js +125 -42
- package/components/combobox/README.md +76 -74
- package/components/combobox/demo/api.html +1 -0
- package/components/combobox/demo/api.js +11 -12
- package/components/combobox/demo/api.md +1302 -875
- package/components/combobox/demo/api.min.js +416 -492
- package/components/combobox/demo/index.html +1 -7
- package/components/combobox/demo/index.js +0 -19
- package/components/combobox/demo/index.md +43 -723
- package/components/combobox/demo/index.min.js +369 -302
- package/components/combobox/demo/readme.html +3 -4
- package/components/combobox/demo/readme.md +76 -74
- package/components/combobox/dist/auro-combobox.d.ts +42 -42
- package/components/combobox/dist/index.js +204 -210
- package/components/combobox/dist/registered.js +204 -210
- package/components/counter/README.md +81 -66
- package/components/counter/demo/api.html +1 -2
- package/components/counter/demo/api.js +2 -2
- package/components/counter/demo/api.md +777 -259
- package/components/counter/demo/api.min.js +119 -171
- package/components/counter/demo/index.html +0 -2
- package/components/counter/demo/index.md +20 -329
- package/components/counter/demo/index.min.js +117 -152
- package/components/counter/demo/readme.html +3 -4
- package/components/counter/demo/readme.md +81 -66
- package/components/counter/dist/auro-counter-group.d.ts +21 -36
- package/components/counter/dist/auro-counter-wrapper.d.ts +1 -6
- package/components/counter/dist/auro-counter.d.ts +5 -8
- package/components/counter/dist/index.js +117 -152
- package/components/counter/dist/registered.js +117 -152
- package/components/datepicker/README.md +57 -61
- package/components/datepicker/demo/api.js +8 -8
- package/components/datepicker/demo/api.md +720 -561
- package/components/datepicker/demo/api.min.js +678 -2769
- package/components/datepicker/demo/index.md +65 -117
- package/components/datepicker/demo/index.min.js +678 -2769
- package/components/datepicker/demo/readme.html +3 -4
- package/components/datepicker/demo/readme.md +57 -61
- package/components/datepicker/dist/auro-calendar.d.ts +60 -34
- package/components/datepicker/dist/auro-datepicker.d.ts +32 -32
- package/components/datepicker/dist/iconVersion.d.ts +1 -1
- package/components/datepicker/dist/index.js +505 -2596
- package/components/datepicker/dist/popoverVersion.d.ts +1 -1
- package/components/datepicker/dist/registered.js +505 -2596
- package/components/dropdown/README.md +78 -62
- package/components/dropdown/demo/api.js +4 -4
- package/components/dropdown/demo/api.md +520 -478
- package/components/dropdown/demo/api.min.js +80 -95
- package/components/dropdown/demo/index.md +65 -119
- package/components/dropdown/demo/index.min.js +70 -85
- package/components/dropdown/demo/readme.html +3 -4
- package/components/dropdown/demo/readme.md +78 -62
- package/components/dropdown/dist/auro-dropdown.d.ts +42 -33
- package/components/dropdown/dist/iconVersion.d.ts +1 -1
- package/components/dropdown/dist/index.js +70 -85
- package/components/dropdown/dist/registered.js +70 -85
- package/components/form/README.md +16 -58
- package/components/form/demo/api.md +16 -21
- package/components/form/demo/api.min.js +13 -8
- package/components/form/demo/index.md +38 -39
- package/components/form/demo/index.min.js +13 -8
- package/components/form/demo/readme.md +16 -58
- package/components/form/demo/working.html +1 -1
- package/components/form/dist/auro-form.d.ts +15 -3
- package/components/form/dist/index.js +13 -8
- package/components/form/dist/registered.js +13 -8
- package/components/input/README.md +55 -60
- package/components/input/demo/api.js +3 -5
- package/components/input/demo/api.md +558 -537
- package/components/input/demo/api.min.js +102 -115
- package/components/input/demo/index.js +0 -1
- package/components/input/demo/index.md +90 -203
- package/components/input/demo/index.min.js +87 -99
- package/components/input/demo/readme.html +3 -4
- package/components/input/demo/readme.md +55 -60
- package/components/input/dist/auro-input.d.ts +6 -5
- package/components/input/dist/base-input.d.ts +68 -69
- package/components/input/dist/iconVersion.d.ts +1 -1
- package/components/input/dist/index.js +87 -82
- package/components/input/dist/registered.js +87 -82
- package/components/menu/README.md +61 -61
- package/components/menu/demo/api.js +6 -8
- package/components/menu/demo/api.md +520 -577
- package/components/menu/demo/api.min.js +199 -97
- package/components/menu/demo/index.js +0 -5
- package/components/menu/demo/index.md +36 -119
- package/components/menu/demo/index.min.js +164 -101
- package/components/menu/demo/readme.html +3 -4
- package/components/menu/demo/readme.md +61 -61
- package/components/menu/dist/auro-menu.context.d.ts +5 -0
- package/components/menu/dist/auro-menu.d.ts +75 -37
- package/components/menu/dist/auro-menuoption.d.ts +38 -13
- package/components/menu/dist/index.js +164 -50
- package/components/menu/dist/registered.js +164 -50
- package/components/radio/README.md +61 -57
- package/components/radio/demo/api.js +2 -2
- package/components/radio/demo/api.md +241 -170
- package/components/radio/demo/api.min.js +154 -77
- package/components/radio/demo/index.md +22 -99
- package/components/radio/demo/index.min.js +145 -68
- package/components/radio/demo/readme.html +3 -4
- package/components/radio/demo/readme.md +61 -57
- package/components/radio/dist/auro-radio-group.d.ts +67 -35
- package/components/radio/dist/auro-radio.d.ts +56 -33
- package/components/radio/dist/index.js +145 -68
- package/components/radio/dist/registered.js +145 -68
- package/components/select/README.md +68 -65
- package/components/select/demo/api.html +1 -0
- package/components/select/demo/api.js +7 -7
- package/components/select/demo/api.md +1305 -625
- package/components/select/demo/api.min.js +357 -262
- package/components/select/demo/index.html +0 -2
- package/components/select/demo/index.md +25 -833
- package/components/select/demo/index.min.js +356 -230
- package/components/select/demo/readme.html +3 -4
- package/components/select/demo/readme.md +68 -65
- package/components/select/dist/auro-select.d.ts +99 -90
- package/components/select/dist/index.js +192 -180
- package/components/select/dist/registered.js +192 -180
- package/package.json +9 -4
|
@@ -1,60 +1,62 @@
|
|
|
1
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
2
|
-
<!-- The below content is automatically added from
|
|
1
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/api.md) -->
|
|
2
|
+
<!-- The below content is automatically added from ./../docs/api.md -->
|
|
3
3
|
|
|
4
4
|
# auro-input
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
The `auro-input` element provides users a way to enter data into a text field.
|
|
7
7
|
|
|
8
8
|
## Properties
|
|
9
9
|
|
|
10
|
-
| Property
|
|
11
|
-
|
|
12
|
-
| `a11yControls`
|
|
13
|
-
| `a11yExpanded`
|
|
14
|
-
| `a11yRole`
|
|
15
|
-
| [activeLabel](#activeLabel)
|
|
16
|
-
| [appearance](#appearance)
|
|
17
|
-
| [autocapitalize](#autocapitalize)
|
|
18
|
-
| [autocomplete](#autocomplete)
|
|
19
|
-
| [autocorrect](#autocorrect)
|
|
20
|
-
| [
|
|
21
|
-
| [
|
|
22
|
-
| [
|
|
23
|
-
| [
|
|
24
|
-
| [
|
|
25
|
-
| [
|
|
26
|
-
| [
|
|
27
|
-
| [
|
|
28
|
-
| [
|
|
29
|
-
| [
|
|
30
|
-
| [
|
|
31
|
-
| [
|
|
32
|
-
| [
|
|
33
|
-
| [
|
|
34
|
-
| [
|
|
35
|
-
| [
|
|
36
|
-
| [
|
|
37
|
-
| [
|
|
38
|
-
| [
|
|
39
|
-
| [
|
|
40
|
-
| [
|
|
41
|
-
| [
|
|
42
|
-
| [
|
|
43
|
-
| [
|
|
44
|
-
| [
|
|
45
|
-
| [
|
|
46
|
-
| [
|
|
47
|
-
| [
|
|
48
|
-
| [
|
|
49
|
-
| [
|
|
50
|
-
| [
|
|
51
|
-
| [
|
|
52
|
-
| [
|
|
53
|
-
| [
|
|
54
|
-
| [
|
|
55
|
-
| [
|
|
56
|
-
| [
|
|
57
|
-
| [
|
|
10
|
+
| Property | Attribute | Type | Default | Description |
|
|
11
|
+
|-----------------------------------|-----------------------------------|--------------------------------------------------|-------------|--------------------------------------------------|
|
|
12
|
+
| `a11yControls` | `a11yControls` | `string` | | The value for the aria-controls attribute. |
|
|
13
|
+
| `a11yExpanded` | `a11yExpanded` | `boolean` | | The value for the aria-expanded attribute. |
|
|
14
|
+
| `a11yRole` | `a11yRole` | `string` | | The value for the role attribute. |
|
|
15
|
+
| [activeLabel](#activeLabel) | `activeLabel` | `boolean` | | If set, the label will remain fixed in the active position. |
|
|
16
|
+
| [appearance](#appearance) | `appearance` | `'default' \| 'inverse'` | "'default'" | Defines whether the component will be on lighter or darker backgrounds. |
|
|
17
|
+
| [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]. |
|
|
18
|
+
| [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. |
|
|
19
|
+
| [autocorrect](#autocorrect) | `autocorrect` | `string` | | When set to `off`, stops iOS from auto-correcting words when typed into a text box. |
|
|
20
|
+
| [customValidityTypeEmail](#customValidityTypeEmail) | `customValidityTypeEmail` | `string` | | Custom help text message for email type validity. |
|
|
21
|
+
| [disabled](#disabled) | `disabled` | `boolean` | | If set, disables the input. |
|
|
22
|
+
| [dvInputOnly](#dvInputOnly) | `dvInputOnly` | `boolean` | | If defined, the display value slot content will only mask the HTML5 input element. The input's label will not be masked. |
|
|
23
|
+
| [error](#error) | `error` | `string` | | When defined, sets persistent validity to `customError` and sets `setCustomValidity` = attribute value. |
|
|
24
|
+
| [errorMessage](#errorMessage) | `errorMessage` | `string` | | Contains the help text message for the current validity error. |
|
|
25
|
+
| [format](#format) | `format` | `string` | | Specifies the input mask format. |
|
|
26
|
+
| [hasFocus](#hasFocus) | | `boolean` | | Flag to indicate if the input currently has focus. |
|
|
27
|
+
| [hasValue](#hasValue) | | `boolean` | | Flag to indicate if the input currently has value. |
|
|
28
|
+
| [icon](#icon) | `icon` | `boolean` | | 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. |
|
|
29
|
+
| [id](#id) | `id` | `string` | | The id global attribute defines an identifier (ID) which must be unique in the whole document. |
|
|
30
|
+
| [inputmode](#inputmode) | `inputmode` | `string` | | Exposes inputmode attribute for input. |
|
|
31
|
+
| [lang](#lang) | `lang` | `string` | | Defines the language of an element. |
|
|
32
|
+
| [layout](#layout) | | `string` | | |
|
|
33
|
+
| [max](#max) | `max` | `string` | | The maximum value allowed. This only applies for inputs with a type of `number` and all date formats. |
|
|
34
|
+
| [maxLength](#maxLength) | `maxLength` | `number` | | The maximum number of characters the user can enter into the text input. This must be an integer value `0` or higher. |
|
|
35
|
+
| [min](#min) | `min` | `string` | | The minimum value allowed. This only applies for inputs with a type of `number` and all date formats. |
|
|
36
|
+
| [minLength](#minLength) | `minLength` | `number` | | The minimum number of characters the user can enter into the text input. This must be a non-negative integer value smaller than or equal to the value specified by `maxlength`. |
|
|
37
|
+
| [name](#name) | `name` | `string` | | Populates the `name` attribute on the input. |
|
|
38
|
+
| [nested](#nested) | `nested` | `boolean` | | Sets styles for nested operation - removes borders, hides help + error text, and<br />hides accents. |
|
|
39
|
+
| [noValidate](#noValidate) | `noValidate` | `boolean` | | If set, disables auto-validation on blur. |
|
|
40
|
+
| [onDark](#onDark) | `onDark` | `boolean` | | DEPRECATED - use `appearance="inverse"` instead. |
|
|
41
|
+
| [pattern](#pattern) | `pattern` | `string` | | Specifies a regular expression the form control's value should match. |
|
|
42
|
+
| [placeholder](#placeholder) | `placeholder` | `string` | | Define custom placeholder text. |
|
|
43
|
+
| [readonly](#readonly) | `readonly` | `boolean` | | Makes the input read-only, but can be set programmatically. |
|
|
44
|
+
| [required](#required) | `required` | `boolean` | | Populates the `required` attribute on the input. Used for client-side validation. |
|
|
45
|
+
| [setCustomValidity](#setCustomValidity) | `setCustomValidity` | `string` | | Sets a custom help text message to display for all validityStates. |
|
|
46
|
+
| [setCustomValidityBadInput](#setCustomValidityBadInput) | `setCustomValidityBadInput` | `string` | | Custom help text message to display when validity = `badInput`. |
|
|
47
|
+
| [setCustomValidityCustomError](#setCustomValidityCustomError) | `setCustomValidityCustomError` | `string` | | Custom help text message to display when validity = `customError`. |
|
|
48
|
+
| [setCustomValidityForType](#setCustomValidityForType) | `setCustomValidityForType` | `string` | | Custom help text message to display for the declared element `type` and type validity fails. |
|
|
49
|
+
| [setCustomValidityRangeOverflow](#setCustomValidityRangeOverflow) | `setCustomValidityRangeOverflow` | `string` | | Custom help text message to display when validity = `rangeOverflow`. |
|
|
50
|
+
| [setCustomValidityRangeUnderflow](#setCustomValidityRangeUnderflow) | `setCustomValidityRangeUnderflow` | `string` | | Custom help text message to display when validity = `rangeUnderflow`. |
|
|
51
|
+
| [setCustomValidityTooLong](#setCustomValidityTooLong) | `setCustomValidityTooLong` | `string` | | Custom help text message to display when validity = `tooLong`. |
|
|
52
|
+
| [setCustomValidityTooShort](#setCustomValidityTooShort) | `setCustomValidityTooShort` | `string` | | Custom help text message to display when validity = `tooShort`. |
|
|
53
|
+
| [setCustomValidityValueMissing](#setCustomValidityValueMissing) | `setCustomValidityValueMissing` | `string` | | Custom help text message to display when validity = `valueMissing`. |
|
|
54
|
+
| [simple](#simple) | `simple` | `boolean` | | Simple makes the input render without a border. |
|
|
55
|
+
| [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`. |
|
|
56
|
+
| [type](#type) | `type` | `'text' \| 'password' \| 'email' \| 'credit-card' \| 'tel' \| 'number'` | "'text'" | Populates the `type` attribute on the input. |
|
|
57
|
+
| [validateOnInput](#validateOnInput) | `validateOnInput` | `boolean` | | Sets validation mode to re-eval with each input. |
|
|
58
|
+
| [validity](#validity) | `validity` | `string` | | Specifies the `validityState` this element is in. |
|
|
59
|
+
| [value](#value) | `value` | `string` | | Populates the `value` attribute on the input. Can also be read to retrieve the current value of the input. |
|
|
58
60
|
|
|
59
61
|
## Methods
|
|
60
62
|
|
|
@@ -99,22 +101,8 @@ Generate unique names for dependency components.
|
|
|
99
101
|
| [wrapper](#wrapper) | Use for customizing the style of the root element |
|
|
100
102
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
101
103
|
|
|
102
|
-
# API Examples
|
|
103
|
-
|
|
104
|
-
## Localization Support
|
|
105
|
-
|
|
106
|
-
The `auro-input` element supports the localization of all content managed within the scope of the element. This DOES NOT include any custom content placed in the `slot` element.
|
|
107
|
-
|
|
108
|
-
<auro-radio-group required horizontal>
|
|
109
|
-
<span slot="legend">Use the options here to toggle between languages</span>
|
|
110
|
-
<auro-radio id="enButton" name="langDemo" value="en" checked>English</auro-radio>
|
|
111
|
-
<auro-radio id="esButton" name="langDemo" value="es">Spanish</auro-radio>
|
|
112
|
-
</auro-radio-group>
|
|
113
|
-
|
|
114
104
|
## Basic
|
|
115
105
|
|
|
116
|
-
The default component supports the basic input `type="text"` structure. The `(optional)` label is provided to instruct the user that their input is not required. Use the `bordered` attribute for a bordered `<auro-input>`.
|
|
117
|
-
|
|
118
106
|
<div class="exampleWrapper">
|
|
119
107
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/basic.html) -->
|
|
120
108
|
<!-- The below content is automatically added from ./../apiExamples/basic.html -->
|
|
@@ -125,15 +113,6 @@ The default component supports the basic input `type="text"` structure. The `(op
|
|
|
125
113
|
</auro-input>
|
|
126
114
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
127
115
|
</div>
|
|
128
|
-
<div class="exampleWrapper--ondark" aria-hidden>
|
|
129
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/inverseAppearance.html) -->
|
|
130
|
-
<!-- The below content is automatically added from ./../apiExamples/inverseAppearance.html -->
|
|
131
|
-
<auro-input appearance="inverse">
|
|
132
|
-
<span slot="label">Label</span>
|
|
133
|
-
<span slot="helpText">Help Text</span>
|
|
134
|
-
</auro-input>
|
|
135
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
136
|
-
</div>
|
|
137
116
|
<auro-accordion alignRight>
|
|
138
117
|
<span slot="trigger">See code</span>
|
|
139
118
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/basic.html) -->
|
|
@@ -147,127 +126,124 @@ The default component supports the basic input `type="text"` structure. The `(op
|
|
|
147
126
|
</auro-input>
|
|
148
127
|
```
|
|
149
128
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
150
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/inverseAppearance.html) -->
|
|
151
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/inverseAppearance.html -->
|
|
152
|
-
|
|
153
|
-
```html
|
|
154
|
-
<auro-input appearance="inverse">
|
|
155
|
-
<span slot="label">Label</span>
|
|
156
|
-
<span slot="helpText">Help Text</span>
|
|
157
|
-
</auro-input>
|
|
158
|
-
```
|
|
159
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
160
129
|
</auro-accordion>
|
|
161
130
|
|
|
162
|
-
## Attribute Examples
|
|
131
|
+
## Property & Attribute Examples
|
|
163
132
|
|
|
164
|
-
###
|
|
165
|
-
|
|
133
|
+
### Active Label
|
|
134
|
+
|
|
135
|
+
Use the `activeLabel` attribute to make the label stay fixed in the active position.
|
|
166
136
|
|
|
167
137
|
<div class="exampleWrapper">
|
|
168
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
169
|
-
<!-- The below content is automatically added from
|
|
170
|
-
<auro-input
|
|
171
|
-
<span slot="label">
|
|
172
|
-
<span slot="helpText">
|
|
173
|
-
</auro-input>
|
|
174
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
175
|
-
</div>
|
|
176
|
-
<div class="exampleWrapper--ondark" aria-hidden>
|
|
177
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/inverseAppearanceDisabled.html) -->
|
|
178
|
-
<!-- The below content is automatically added from ./../apiExamples/inverseAppearanceDisabled.html -->
|
|
179
|
-
<auro-input appearance="inverse" disabled type="date">
|
|
180
|
-
<span slot="label">Arrival date</span>
|
|
181
|
-
<span slot="helpText">Help Text</span>
|
|
138
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/active-label.html) -->
|
|
139
|
+
<!-- The below content is automatically added from ../apiExamples/active-label.html -->
|
|
140
|
+
<auro-input activeLabel>
|
|
141
|
+
<span slot="label">Address</span>
|
|
142
|
+
<span slot="helpText">Please enter your home address.</span>
|
|
182
143
|
</auro-input>
|
|
183
144
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
184
145
|
</div>
|
|
185
146
|
<auro-accordion alignRight>
|
|
186
147
|
<span slot="trigger">See code</span>
|
|
187
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
188
|
-
<!-- The below code snippet is automatically added from
|
|
148
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/active-label.html) -->
|
|
149
|
+
<!-- The below code snippet is automatically added from ../apiExamples/active-label.html -->
|
|
189
150
|
|
|
190
151
|
```html
|
|
191
|
-
<auro-input
|
|
192
|
-
<span slot="label">
|
|
193
|
-
<span slot="helpText">
|
|
152
|
+
<auro-input activeLabel>
|
|
153
|
+
<span slot="label">Address</span>
|
|
154
|
+
<span slot="helpText">Please enter your home address.</span>
|
|
194
155
|
</auro-input>
|
|
195
156
|
```
|
|
196
157
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
197
|
-
|
|
198
|
-
|
|
158
|
+
</auro-accordion>
|
|
159
|
+
|
|
160
|
+
### Appearance on Dark Backgrounds
|
|
161
|
+
|
|
162
|
+
<div class="exampleWrapper--ondark">
|
|
163
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/appearance-inverse.html) -->
|
|
164
|
+
<!-- The below content is automatically added from ./../apiExamples/appearance-inverse.html -->
|
|
165
|
+
<auro-input appearance="inverse">
|
|
166
|
+
<span slot="label">Label</span>
|
|
167
|
+
<span slot="helpText">Help Text</span>
|
|
168
|
+
</auro-input>
|
|
169
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
170
|
+
</div>
|
|
171
|
+
<auro-accordion alignRight>
|
|
172
|
+
<span slot="trigger">See code</span>
|
|
173
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/appearance-inverse.html) -->
|
|
174
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/appearance-inverse.html -->
|
|
199
175
|
|
|
200
176
|
```html
|
|
201
|
-
<auro-input appearance="inverse"
|
|
202
|
-
<span slot="label">
|
|
177
|
+
<auro-input appearance="inverse">
|
|
178
|
+
<span slot="label">Label</span>
|
|
203
179
|
<span slot="helpText">Help Text</span>
|
|
204
180
|
</auro-input>
|
|
205
181
|
```
|
|
206
182
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
207
183
|
</auro-accordion>
|
|
208
184
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
Set the input mode for the input.
|
|
185
|
+
### Disabled
|
|
212
186
|
|
|
213
|
-
|
|
187
|
+
Use the `disable` attribute to prevent the user from interacting with the input.
|
|
214
188
|
|
|
215
189
|
<div class="exampleWrapper">
|
|
216
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/
|
|
217
|
-
<!-- The below content is automatically added from ./../apiExamples/
|
|
218
|
-
<auro-input
|
|
219
|
-
<span slot="label">
|
|
190
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/disabled.html) -->
|
|
191
|
+
<!-- The below content is automatically added from ./../apiExamples/disabled.html -->
|
|
192
|
+
<auro-input disabled type="date">
|
|
193
|
+
<span slot="label">Disabled</span>
|
|
220
194
|
<span slot="helpText">Help Text</span>
|
|
221
195
|
</auro-input>
|
|
222
196
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
223
197
|
</div>
|
|
224
198
|
<auro-accordion alignRight>
|
|
225
199
|
<span slot="trigger">See code</span>
|
|
226
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/
|
|
227
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/
|
|
200
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/disabled.html) -->
|
|
201
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/disabled.html -->
|
|
228
202
|
|
|
229
203
|
```html
|
|
230
|
-
<auro-input
|
|
231
|
-
<span slot="label">
|
|
204
|
+
<auro-input disabled type="date">
|
|
205
|
+
<span slot="label">Disabled</span>
|
|
232
206
|
<span slot="helpText">Help Text</span>
|
|
233
207
|
</auro-input>
|
|
234
208
|
```
|
|
235
209
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
236
210
|
</auro-accordion>
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
<!-- The below content is automatically added from ../apiExamples/placeholder.html -->
|
|
244
|
-
<auro-input placeholder="John Doe" required>
|
|
245
|
-
<span slot="label">Full name</span>
|
|
246
|
-
<span slot="helpText">Please enter your full name.</span>
|
|
211
|
+
<div class="exampleWrapper--ondark" aria-hidden>
|
|
212
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/appearance-inverse-disabled.html) -->
|
|
213
|
+
<!-- The below content is automatically added from ./../apiExamples/appearance-inverse-disabled.html -->
|
|
214
|
+
<auro-input appearance="inverse" disabled type="date">
|
|
215
|
+
<span slot="label">Arrival date</span>
|
|
216
|
+
<span slot="helpText">Help Text</span>
|
|
247
217
|
</auro-input>
|
|
248
218
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
249
219
|
</div>
|
|
250
220
|
<auro-accordion alignRight>
|
|
251
221
|
<span slot="trigger">See code</span>
|
|
252
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
253
|
-
<!-- The below code snippet is automatically added from
|
|
222
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/appearance-inverse-disabled.html) -->
|
|
223
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/appearance-inverse-disabled.html -->
|
|
254
224
|
|
|
255
225
|
```html
|
|
256
|
-
<auro-input
|
|
257
|
-
<span slot="label">
|
|
258
|
-
<span slot="helpText">
|
|
226
|
+
<auro-input appearance="inverse" disabled type="date">
|
|
227
|
+
<span slot="label">Arrival date</span>
|
|
228
|
+
<span slot="helpText">Help Text</span>
|
|
259
229
|
</auro-input>
|
|
260
230
|
```
|
|
261
231
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
262
232
|
</auro-accordion>
|
|
263
233
|
|
|
264
|
-
###
|
|
265
|
-
|
|
234
|
+
### Error
|
|
235
|
+
|
|
236
|
+
Use the `error` attribute to apply a persistent custom error that supersedes the HTML5 validation logic.
|
|
237
|
+
|
|
238
|
+
A custom error message can be set using the `error` attribute, or it can be used in conjuction with the `setCustomValidityCustomError` attribute.
|
|
266
239
|
|
|
267
240
|
<div class="exampleWrapper">
|
|
268
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
269
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
270
|
-
<auro-
|
|
241
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/error.html) -->
|
|
242
|
+
<!-- The below content is automatically added from ../apiExamples/error.html -->
|
|
243
|
+
<auro-button id="setCustomErrorBtn">Set Custom Error</auro-button>
|
|
244
|
+
<auro-button id="setCustomErrorClearBtn">Clear Custom Error</auro-button>
|
|
245
|
+
<br /><br />
|
|
246
|
+
<auro-input id="setCustomErrorExample" error="Initial error attribute value">
|
|
271
247
|
<span slot="label">Name</span>
|
|
272
248
|
<span slot="helpText">Please enter your full name.</span>
|
|
273
249
|
</auro-input>
|
|
@@ -275,31 +251,45 @@ Use the `value` attribute to programmatically set the value of the input.
|
|
|
275
251
|
</div>
|
|
276
252
|
<auro-accordion alignRight>
|
|
277
253
|
<span slot="trigger">See code</span>
|
|
278
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
279
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
254
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/error.html) -->
|
|
255
|
+
<!-- The below code snippet is automatically added from ../apiExamples/error.html -->
|
|
280
256
|
|
|
281
257
|
```html
|
|
282
|
-
<auro-
|
|
258
|
+
<auro-button id="setCustomErrorBtn">Set Custom Error</auro-button>
|
|
259
|
+
<auro-button id="setCustomErrorClearBtn">Clear Custom Error</auro-button>
|
|
260
|
+
<br /><br />
|
|
261
|
+
<auro-input id="setCustomErrorExample" error="Initial error attribute value">
|
|
283
262
|
<span slot="label">Name</span>
|
|
284
263
|
<span slot="helpText">Please enter your full name.</span>
|
|
285
264
|
</auro-input>
|
|
286
265
|
```
|
|
287
266
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
288
|
-
|
|
267
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/error.js) -->
|
|
268
|
+
<!-- The below code snippet is automatically added from ../apiExamples/error.js -->
|
|
289
269
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
270
|
+
```js
|
|
271
|
+
export function customError() {
|
|
272
|
+
const elem = document.querySelector('#setCustomErrorExample');
|
|
273
|
+
// set custom error
|
|
274
|
+
document.querySelector('#setCustomErrorBtn').addEventListener('click', () => {
|
|
275
|
+
elem.error = "Custom Error Message";
|
|
276
|
+
});
|
|
295
277
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
278
|
+
// remove custom error
|
|
279
|
+
document.querySelector('#setCustomErrorClearBtn').addEventListener('click', () => {
|
|
280
|
+
elem.removeAttribute('error');
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
285
|
+
</auro-accordion>
|
|
286
|
+
<div class="exampleWrapper--ondark" aria-hidden>
|
|
287
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/appearance-inverse-error.html) -->
|
|
288
|
+
<!-- The below content is automatically added from ../apiExamples/appearance-inverse-error.html -->
|
|
289
|
+
<auro-button appearance="inverse" id="setCustomErrorBtnOnDark">Set Custom Error</auro-button>
|
|
290
|
+
<auro-button appearance="inverse" id="setCustomErrorClearBtnOnDark">Clear Custom Error</auro-button>
|
|
301
291
|
<br /><br />
|
|
302
|
-
<auro-input id="
|
|
292
|
+
<auro-input appearance="inverse" id="setCustomErrorExampleOnDark" error="Initial error attribute value">
|
|
303
293
|
<span slot="label">Name</span>
|
|
304
294
|
<span slot="helpText">Please enter your full name.</span>
|
|
305
295
|
</auro-input>
|
|
@@ -307,106 +297,113 @@ Note: Setting the `value` to `undefined` will also reset the element.
|
|
|
307
297
|
</div>
|
|
308
298
|
<auro-accordion alignRight>
|
|
309
299
|
<span slot="trigger">See code</span>
|
|
310
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
311
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
300
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/appearance-inverse-error.html) -->
|
|
301
|
+
<!-- The below code snippet is automatically added from ../apiExamples/appearance-inverse-error.html -->
|
|
312
302
|
|
|
313
303
|
```html
|
|
314
|
-
<auro-button id="
|
|
315
|
-
<auro-button id="
|
|
304
|
+
<auro-button appearance="inverse" id="setCustomErrorBtnOnDark">Set Custom Error</auro-button>
|
|
305
|
+
<auro-button appearance="inverse" id="setCustomErrorClearBtnOnDark">Clear Custom Error</auro-button>
|
|
316
306
|
<br /><br />
|
|
317
|
-
<auro-input id="
|
|
307
|
+
<auro-input appearance="inverse" id="setCustomErrorExampleOnDark" error="Initial error attribute value">
|
|
318
308
|
<span slot="label">Name</span>
|
|
319
309
|
<span slot="helpText">Please enter your full name.</span>
|
|
320
310
|
</auro-input>
|
|
321
311
|
```
|
|
322
312
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
323
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
324
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
313
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/appearance-inverse-error.js) -->
|
|
314
|
+
<!-- The below code snippet is automatically added from ../apiExamples/appearance-inverse-error.js -->
|
|
325
315
|
|
|
326
316
|
```js
|
|
327
|
-
export function
|
|
328
|
-
const elem = document.querySelector('#
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
elem.value = "Alaska Airlines is the best";
|
|
317
|
+
export function customErrorOnDark() {
|
|
318
|
+
const elem = document.querySelector('#setCustomErrorExampleOnDark');
|
|
319
|
+
// set custom error
|
|
320
|
+
document.querySelector('#setCustomErrorBtnOnDark').addEventListener('click', () => {
|
|
321
|
+
elem.error = "Custom Error Message";
|
|
333
322
|
});
|
|
334
323
|
|
|
335
|
-
//
|
|
336
|
-
document.querySelector('#
|
|
337
|
-
elem.
|
|
324
|
+
// remove custom error
|
|
325
|
+
document.querySelector('#setCustomErrorClearBtnOnDark').addEventListener('click', () => {
|
|
326
|
+
elem.removeAttribute('error');
|
|
338
327
|
});
|
|
339
328
|
}
|
|
340
329
|
```
|
|
341
330
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
342
331
|
</auro-accordion>
|
|
343
332
|
|
|
344
|
-
###
|
|
345
|
-
Use the `
|
|
333
|
+
### Format <a name="format"></a>
|
|
334
|
+
Use the `format` attribute to set the format of the IMask.
|
|
346
335
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
336
|
+
Default masking definitions:
|
|
337
|
+
- 0 : number
|
|
338
|
+
- a : letter
|
|
339
|
+
- \* : any character
|
|
340
|
+
|
|
341
|
+
See [IMask](https://imask.js.org/) for more information on how to configure a mask.
|
|
350
342
|
|
|
351
343
|
<div class="exampleWrapper">
|
|
352
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
353
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
354
|
-
<auro-input
|
|
355
|
-
<span slot="label">
|
|
356
|
-
<span slot="helpText">
|
|
344
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/format.html) -->
|
|
345
|
+
<!-- The below content is automatically added from ../apiExamples/format.html -->
|
|
346
|
+
<auro-input format="47440000">
|
|
347
|
+
<span slot="label">Custom format</span>
|
|
348
|
+
<span slot="helpText">Format is: 47440000</span>
|
|
357
349
|
</auro-input>
|
|
358
350
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
359
351
|
</div>
|
|
360
352
|
<auro-accordion alignRight>
|
|
361
353
|
<span slot="trigger">See code</span>
|
|
362
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
363
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
354
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/format.html) -->
|
|
355
|
+
<!-- The below code snippet is automatically added from ../apiExamples/format.html -->
|
|
364
356
|
|
|
365
357
|
```html
|
|
366
|
-
<auro-input
|
|
367
|
-
<span slot="label">
|
|
368
|
-
<span slot="helpText">
|
|
358
|
+
<auro-input format="47440000">
|
|
359
|
+
<span slot="label">Custom format</span>
|
|
360
|
+
<span slot="helpText">Format is: 47440000</span>
|
|
369
361
|
</auro-input>
|
|
370
362
|
```
|
|
371
363
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
372
364
|
</auro-accordion>
|
|
373
365
|
|
|
374
|
-
####
|
|
366
|
+
#### Input Mode
|
|
367
|
+
|
|
368
|
+
Set the `inputmode` for the input.
|
|
369
|
+
|
|
370
|
+
**IMPORTANT**: If you are also passing a `type`, most browsers will use the `type` attribute to determine what keyboard to display on mobile devices and ignore the `inputmode` attribute.
|
|
375
371
|
|
|
376
372
|
<div class="exampleWrapper">
|
|
377
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
378
|
-
<!-- The below content is automatically added from
|
|
379
|
-
<auro-input
|
|
380
|
-
<span slot="label">
|
|
373
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/inputmode.html) -->
|
|
374
|
+
<!-- The below content is automatically added from ./../apiExamples/inputmode.html -->
|
|
375
|
+
<auro-input inputmode="tel">
|
|
376
|
+
<span slot="label">Telephone</span>
|
|
381
377
|
<span slot="helpText">Help Text</span>
|
|
382
378
|
</auro-input>
|
|
383
379
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
384
380
|
</div>
|
|
385
381
|
<auro-accordion alignRight>
|
|
386
382
|
<span slot="trigger">See code</span>
|
|
387
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
388
|
-
<!-- The below code snippet is automatically added from
|
|
383
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/inputmode.html) -->
|
|
384
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/inputmode.html -->
|
|
389
385
|
|
|
390
386
|
```html
|
|
391
|
-
<auro-input
|
|
392
|
-
<span slot="label">
|
|
387
|
+
<auro-input inputmode="tel">
|
|
388
|
+
<span slot="label">Telephone</span>
|
|
393
389
|
<span slot="helpText">Help Text</span>
|
|
394
390
|
</auro-input>
|
|
395
391
|
```
|
|
396
392
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
397
393
|
</auro-accordion>
|
|
398
394
|
|
|
399
|
-
###
|
|
400
|
-
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.
|
|
395
|
+
### Max
|
|
401
396
|
|
|
402
|
-
|
|
397
|
+
Use the `max` attribute to define a maximum value used during validation. The attribute will only apply when `<auro-input>` also has a `type` attribute for `number` or any date format.
|
|
398
|
+
|
|
399
|
+
The `setCustomValidityRangeOverflow` attribute may optionally be used in combination with the `max` attribute to define custom help text used when the input value is greater than the value of the `max` attribute.
|
|
403
400
|
|
|
404
401
|
#### Date Example
|
|
405
402
|
|
|
406
403
|
<div class="exampleWrapper">
|
|
407
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
408
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
409
|
-
<auro-input type="date"
|
|
404
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/max-date.html) -->
|
|
405
|
+
<!-- The below content is automatically added from ../apiExamples/max-date.html -->
|
|
406
|
+
<auro-input type="date" max="03/25/2023" setCustomValidityRangeOverflow="The selected date is past the defined maximum date.">
|
|
410
407
|
<span slot="label">Choose a date</span>
|
|
411
408
|
<span slot="helpText">Help Text</span>
|
|
412
409
|
</auro-input>
|
|
@@ -414,11 +411,11 @@ The `setCustomValidityRangeUnderflow` attribute may optionally be used in combin
|
|
|
414
411
|
</div>
|
|
415
412
|
<auro-accordion alignRight>
|
|
416
413
|
<span slot="trigger">See code</span>
|
|
417
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
418
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
414
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/max-date.html) -->
|
|
415
|
+
<!-- The below code snippet is automatically added from ../apiExamples/max-date.html -->
|
|
419
416
|
|
|
420
417
|
```html
|
|
421
|
-
<auro-input type="date"
|
|
418
|
+
<auro-input type="date" max="03/25/2023" setCustomValidityRangeOverflow="The selected date is past the defined maximum date.">
|
|
422
419
|
<span slot="label">Choose a date</span>
|
|
423
420
|
<span slot="helpText">Help Text</span>
|
|
424
421
|
</auro-input>
|
|
@@ -429,9 +426,9 @@ The `setCustomValidityRangeUnderflow` attribute may optionally be used in combin
|
|
|
429
426
|
#### Number Example
|
|
430
427
|
|
|
431
428
|
<div class="exampleWrapper">
|
|
432
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
433
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
434
|
-
<auro-input type="number"
|
|
429
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/max-number.html) -->
|
|
430
|
+
<!-- The below content is automatically added from ../apiExamples/max-number.html -->
|
|
431
|
+
<auro-input type="number" max="10" setCustomValidityRangeOverflow="The selected value is above the defined maximum.">
|
|
435
432
|
<span slot="label">Choose a number</span>
|
|
436
433
|
<span slot="helpText">Help Text</span>
|
|
437
434
|
</auro-input>
|
|
@@ -439,11 +436,11 @@ The `setCustomValidityRangeUnderflow` attribute may optionally be used in combin
|
|
|
439
436
|
</div>
|
|
440
437
|
<auro-accordion alignRight>
|
|
441
438
|
<span slot="trigger">See code</span>
|
|
442
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
443
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
439
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/max-number.html) -->
|
|
440
|
+
<!-- The below code snippet is automatically added from ../apiExamples/max-number.html -->
|
|
444
441
|
|
|
445
442
|
```html
|
|
446
|
-
<auro-input type="number"
|
|
443
|
+
<auro-input type="number" max="10" setCustomValidityRangeOverflow="The selected value is above the defined maximum.">
|
|
447
444
|
<span slot="label">Choose a number</span>
|
|
448
445
|
<span slot="helpText">Help Text</span>
|
|
449
446
|
</auro-input>
|
|
@@ -451,14 +448,15 @@ The `setCustomValidityRangeUnderflow` attribute may optionally be used in combin
|
|
|
451
448
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
452
449
|
</auro-accordion>
|
|
453
450
|
|
|
454
|
-
### Max Length
|
|
451
|
+
### Max Length
|
|
452
|
+
|
|
455
453
|
Use the `maxlength` attribute to control the length of the input entered.
|
|
456
454
|
|
|
457
455
|
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.
|
|
458
456
|
|
|
459
457
|
<div class="exampleWrapper">
|
|
460
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
461
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
458
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/max-length.html) -->
|
|
459
|
+
<!-- The below content is automatically added from ../apiExamples/max-length.html -->
|
|
462
460
|
<auro-input maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered." required>
|
|
463
461
|
<span slot="label">Voucher Code</span>
|
|
464
462
|
<span slot="helpText">Please enter your 12 character voucher code.</span>
|
|
@@ -467,8 +465,8 @@ The `setCustomValidityTooLong` attribute may optionally be used in combination w
|
|
|
467
465
|
</div>
|
|
468
466
|
<auro-accordion alignRight>
|
|
469
467
|
<span slot="trigger">See code</span>
|
|
470
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
471
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
468
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/max-length.html) -->
|
|
469
|
+
<!-- The below code snippet is automatically added from ../apiExamples/max-length.html -->
|
|
472
470
|
|
|
473
471
|
```html
|
|
474
472
|
<auro-input maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered." required>
|
|
@@ -479,146 +477,97 @@ The `setCustomValidityTooLong` attribute may optionally be used in combination w
|
|
|
479
477
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
480
478
|
</auro-accordion>
|
|
481
479
|
|
|
482
|
-
### Min
|
|
483
|
-
Use the `
|
|
484
|
-
|
|
485
|
-
The `setCustomValidityTooShort` attribute may optionally be used in combination with the `minLength` attribute to define custom help text used when the length of the input is not long enough.
|
|
480
|
+
### Min <a name="min"></a>
|
|
481
|
+
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.
|
|
486
482
|
|
|
487
|
-
|
|
488
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/minLength.html) -->
|
|
489
|
-
<!-- The below content is automatically added from ../apiExamples/minLength.html -->
|
|
490
|
-
<auro-input minlength="4" setCustomValidityTooShort="Please enter a full voucher code." required>
|
|
491
|
-
<span slot="label">Voucher Code</span>
|
|
492
|
-
<span slot="helpText">Please enter your 4 character voucher code.</span>
|
|
493
|
-
</auro-input>
|
|
494
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
495
|
-
</div>
|
|
496
|
-
<auro-accordion alignRight>
|
|
497
|
-
<span slot="trigger">See code</span>
|
|
498
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/minLength.html) -->
|
|
499
|
-
<!-- The below code snippet is automatically added from ../apiExamples/minLength.html -->
|
|
500
|
-
|
|
501
|
-
```html
|
|
502
|
-
<auro-input minlength="4" setCustomValidityTooShort="Please enter a full voucher code." required>
|
|
503
|
-
<span slot="label">Voucher Code</span>
|
|
504
|
-
<span slot="helpText">Please enter your 4 character voucher code.</span>
|
|
505
|
-
</auro-input>
|
|
506
|
-
```
|
|
507
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
508
|
-
</auro-accordion>
|
|
483
|
+
The `setCustomValidityRangeUnderflow` attribute may optionally be used in combination with the `min` attribute to define custom help text used when the input value is less than the value of the `min` attribute.
|
|
509
484
|
|
|
510
|
-
|
|
511
|
-
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.
|
|
512
|
-
|
|
513
|
-
The `<auro-input>` component supports setting a custom validity message specific to the pattern validation by using the `setCustomValidityPatternMismatch` attribute.
|
|
485
|
+
#### Date Example
|
|
514
486
|
|
|
515
487
|
<div class="exampleWrapper">
|
|
516
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
517
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
518
|
-
<auro-input
|
|
519
|
-
<span slot="label">
|
|
520
|
-
<span slot="helpText">
|
|
488
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/min-date.html) -->
|
|
489
|
+
<!-- The below content is automatically added from ../apiExamples/min-date.html -->
|
|
490
|
+
<auro-input type="date" min="03/25/2023" setCustomValidityRangeUnderflow="The selected date is before the defined minimum date.">
|
|
491
|
+
<span slot="label">Choose a date</span>
|
|
492
|
+
<span slot="helpText">Help Text</span>
|
|
521
493
|
</auro-input>
|
|
522
494
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
523
495
|
</div>
|
|
524
496
|
<auro-accordion alignRight>
|
|
525
497
|
<span slot="trigger">See code</span>
|
|
526
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
527
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
498
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/min-date.html) -->
|
|
499
|
+
<!-- The below code snippet is automatically added from ../apiExamples/min-date.html -->
|
|
528
500
|
|
|
529
501
|
```html
|
|
530
|
-
<auro-input
|
|
531
|
-
<span slot="label">
|
|
532
|
-
<span slot="helpText">
|
|
502
|
+
<auro-input type="date" min="03/25/2023" setCustomValidityRangeUnderflow="The selected date is before the defined minimum date.">
|
|
503
|
+
<span slot="label">Choose a date</span>
|
|
504
|
+
<span slot="helpText">Help Text</span>
|
|
533
505
|
</auro-input>
|
|
534
506
|
```
|
|
535
507
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
536
508
|
</auro-accordion>
|
|
537
509
|
|
|
538
|
-
|
|
539
|
-
Use the `readonly` attribute to prevent the user from editing the value of the input.
|
|
540
|
-
|
|
541
|
-
In this example, the user is able to programmatically change the value of the input by clicking the button or clear out the contents of the input.
|
|
510
|
+
#### Number Example
|
|
542
511
|
|
|
543
512
|
<div class="exampleWrapper">
|
|
544
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
545
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
546
|
-
<auro-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
<auro-input readonly id="readonlyExample">
|
|
550
|
-
<span slot="label">Name</span>
|
|
551
|
-
<span slot="helpText">Please enter your full name.</span>
|
|
513
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/min-number.html) -->
|
|
514
|
+
<!-- The below content is automatically added from ../apiExamples/min-number.html -->
|
|
515
|
+
<auro-input type="number" min="10" setCustomValidityRangeUnderflow="The selected value is below the defined minimum.">
|
|
516
|
+
<span slot="label">Choose a number</span>
|
|
517
|
+
<span slot="helpText">Help Text</span>
|
|
552
518
|
</auro-input>
|
|
553
519
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
554
520
|
</div>
|
|
555
521
|
<auro-accordion alignRight>
|
|
556
522
|
<span slot="trigger">See code</span>
|
|
557
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
558
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
523
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/min-number.html) -->
|
|
524
|
+
<!-- The below code snippet is automatically added from ../apiExamples/min-number.html -->
|
|
559
525
|
|
|
560
526
|
```html
|
|
561
|
-
<auro-
|
|
562
|
-
<
|
|
563
|
-
<
|
|
564
|
-
<auro-input readonly id="readonlyExample">
|
|
565
|
-
<span slot="label">Name</span>
|
|
566
|
-
<span slot="helpText">Please enter your full name.</span>
|
|
527
|
+
<auro-input type="number" min="10" setCustomValidityRangeUnderflow="The selected value is below the defined minimum.">
|
|
528
|
+
<span slot="label">Choose a number</span>
|
|
529
|
+
<span slot="helpText">Help Text</span>
|
|
567
530
|
</auro-input>
|
|
568
531
|
```
|
|
569
532
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
570
|
-
|
|
571
|
-
<!-- The below code snippet is automatically added from ../apiExamples/readonly.js -->
|
|
533
|
+
</auro-accordion>
|
|
572
534
|
|
|
573
|
-
|
|
574
|
-
export function setReadonlyValue() {
|
|
575
|
-
const elem = document.querySelector('#readonlyExample');
|
|
535
|
+
### Min Length
|
|
576
536
|
|
|
577
|
-
|
|
578
|
-
document.querySelector('#setReadonlyValueBtn').addEventListener('click', () => {
|
|
579
|
-
elem.value = "Auro Alaska";
|
|
580
|
-
});
|
|
537
|
+
Use the `minlength` attribute to control the length of the input entered.
|
|
581
538
|
|
|
582
|
-
|
|
583
|
-
elem.value = undefined;
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
```
|
|
587
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
588
|
-
</auro-accordion>
|
|
589
|
-
|
|
590
|
-
### Active Label <a name="activeLabel"></a>
|
|
591
|
-
Example use cases for auro-input support the `activeLabel` attribute. If set, the label will stay fixed in the active position.
|
|
539
|
+
The `setCustomValidityTooShort` attribute may optionally be used in combination with the `minLength` attribute to define custom help text used when the length of the input is not long enough.
|
|
592
540
|
|
|
593
541
|
<div class="exampleWrapper">
|
|
594
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
595
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
596
|
-
<auro-input
|
|
597
|
-
<span slot="label">
|
|
598
|
-
<span slot="helpText">Please enter your
|
|
542
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/min-length.html) -->
|
|
543
|
+
<!-- The below content is automatically added from ../apiExamples/min-length.html -->
|
|
544
|
+
<auro-input minlength="4" setCustomValidityTooShort="Please enter a full voucher code." required>
|
|
545
|
+
<span slot="label">Voucher Code</span>
|
|
546
|
+
<span slot="helpText">Please enter your 4 character voucher code.</span>
|
|
599
547
|
</auro-input>
|
|
600
548
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
601
549
|
</div>
|
|
602
550
|
<auro-accordion alignRight>
|
|
603
551
|
<span slot="trigger">See code</span>
|
|
604
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
605
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
552
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/min-length.html) -->
|
|
553
|
+
<!-- The below code snippet is automatically added from ../apiExamples/min-length.html -->
|
|
606
554
|
|
|
607
555
|
```html
|
|
608
|
-
<auro-input
|
|
609
|
-
<span slot="label">
|
|
610
|
-
<span slot="helpText">Please enter your
|
|
556
|
+
<auro-input minlength="4" setCustomValidityTooShort="Please enter a full voucher code." required>
|
|
557
|
+
<span slot="label">Voucher Code</span>
|
|
558
|
+
<span slot="helpText">Please enter your 4 character voucher code.</span>
|
|
611
559
|
</auro-input>
|
|
612
560
|
```
|
|
613
561
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
614
562
|
</auro-accordion>
|
|
615
563
|
|
|
616
|
-
###
|
|
564
|
+
### No Validate
|
|
565
|
+
|
|
617
566
|
For use cases where the field is `required`, but live validation is not wanted, use the `noValidate` attribute.
|
|
618
567
|
|
|
619
568
|
<div class="exampleWrapper">
|
|
620
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
621
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
569
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/no-validate.html) -->
|
|
570
|
+
<!-- The below content is automatically added from ../apiExamples/no-validate.html -->
|
|
622
571
|
<auro-input noValidate required>
|
|
623
572
|
<span slot="label">Address</span>
|
|
624
573
|
<span slot="helpText">Please enter your home address.</span>
|
|
@@ -627,8 +576,8 @@ For use cases where the field is `required`, but live validation is not wanted,
|
|
|
627
576
|
</div>
|
|
628
577
|
<auro-accordion alignRight>
|
|
629
578
|
<span slot="trigger">See code</span>
|
|
630
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
631
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
579
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/no-validate.html) -->
|
|
580
|
+
<!-- The below code snippet is automatically added from ../apiExamples/no-validate.html -->
|
|
632
581
|
|
|
633
582
|
```html
|
|
634
583
|
<auro-input noValidate required>
|
|
@@ -639,167 +588,74 @@ For use cases where the field is `required`, but live validation is not wanted,
|
|
|
639
588
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
640
589
|
</auro-accordion>
|
|
641
590
|
|
|
642
|
-
###
|
|
643
|
-
Use the `
|
|
644
|
-
|
|
645
|
-
Default masking definitions:
|
|
646
|
-
- 0 : number
|
|
647
|
-
- a : letter
|
|
648
|
-
- \* : any character
|
|
649
|
-
|
|
650
|
-
See [IMask](https://imask.js.org/) for more information on how to configure a mask.
|
|
651
|
-
|
|
652
|
-
<div class="exampleWrapper">
|
|
653
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/format.html) -->
|
|
654
|
-
<!-- The below content is automatically added from ../apiExamples/format.html -->
|
|
655
|
-
<auro-input format="47440000">
|
|
656
|
-
<span slot="label">Custom format</span>
|
|
657
|
-
<span slot="helpText">Format is: 47440000</span>
|
|
658
|
-
</auro-input>
|
|
659
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
660
|
-
</div>
|
|
661
|
-
<auro-accordion alignRight>
|
|
662
|
-
<span slot="trigger">See code</span>
|
|
663
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/format.html) -->
|
|
664
|
-
<!-- The below code snippet is automatically added from ../apiExamples/format.html -->
|
|
665
|
-
|
|
666
|
-
```html
|
|
667
|
-
<auro-input format="47440000">
|
|
668
|
-
<span slot="label">Custom format</span>
|
|
669
|
-
<span slot="helpText">Format is: 47440000</span>
|
|
670
|
-
</auro-input>
|
|
671
|
-
```
|
|
672
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
673
|
-
</auro-accordion>
|
|
674
|
-
|
|
675
|
-
## Error support and HTML5 Validity
|
|
676
|
-
|
|
677
|
-
The `<auro-input>` component follows the HTML5 input `validity` and `validityState` [specification](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#client-side_validation).
|
|
678
|
-
|
|
679
|
-
> if there is a form control that fails constraint validation, supporting browsers will display an error message on the first invalid form control; displaying a default message based on the error type, or a message set by you.
|
|
680
|
-
|
|
681
|
-
### Required <a name="required"></a>
|
|
682
|
-
When present, the `required` attribute specifies that an input field must be filled out before submitting the form.
|
|
683
|
-
|
|
684
|
-
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`.
|
|
591
|
+
### Pattern <a name="pattern"></a>
|
|
592
|
+
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.
|
|
685
593
|
|
|
686
|
-
|
|
687
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/required.html) -->
|
|
688
|
-
<!-- The below content is automatically added from ../apiExamples/required.html -->
|
|
689
|
-
<auro-input required placeholder="John Doe">
|
|
690
|
-
<span slot="label">Full name</span>
|
|
691
|
-
<span slot="helpText">Please enter your full name.</span>
|
|
692
|
-
</auro-input>
|
|
693
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
694
|
-
</div>
|
|
695
|
-
<auro-accordion alignRight>
|
|
696
|
-
<span slot="trigger">See code</span>
|
|
697
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/required.html) -->
|
|
698
|
-
<!-- The below code snippet is automatically added from ../apiExamples/required.html -->
|
|
699
|
-
|
|
700
|
-
```html
|
|
701
|
-
<auro-input required placeholder="John Doe">
|
|
702
|
-
<span slot="label">Full name</span>
|
|
703
|
-
<span slot="helpText">Please enter your full name.</span>
|
|
704
|
-
</auro-input>
|
|
705
|
-
```
|
|
706
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
707
|
-
</auro-accordion>
|
|
708
|
-
|
|
709
|
-
### Custom optional label <a name="optionalLabel"></a>
|
|
710
|
-
The `<auro-input>` supports an `optionalLabel` slot, where users can can override the default `(optional)` notification text.
|
|
594
|
+
The `<auro-input>` component supports setting a custom validity message specific to the pattern validation by using the `setCustomValidityPatternMismatch` attribute.
|
|
711
595
|
|
|
712
596
|
<div class="exampleWrapper">
|
|
713
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
714
|
-
<!-- The below content is automatically added from
|
|
715
|
-
<auro-input
|
|
716
|
-
<span slot="label">
|
|
717
|
-
<span slot="
|
|
718
|
-
<span slot="helpText">Please enter your full name.</span>
|
|
719
|
-
</auro-input>
|
|
720
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
721
|
-
</div>
|
|
722
|
-
<auro-accordion alignRight>
|
|
723
|
-
<span slot="trigger">See code</span>
|
|
724
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/optionalLabel.html) -->
|
|
725
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/optionalLabel.html -->
|
|
726
|
-
|
|
727
|
-
```html
|
|
728
|
-
<auro-input placeholder="John Doe" bordered>
|
|
729
|
-
<span slot="label">Full name</span>
|
|
730
|
-
<span slot="optionalLabel" style="color: grey; font-size: small"> - optional</span>
|
|
731
|
-
<span slot="helpText">Please enter your full name.</span>
|
|
732
|
-
</auro-input>
|
|
733
|
-
```
|
|
734
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
735
|
-
</auro-accordion>
|
|
736
|
-
|
|
737
|
-
### Validation on input <a name="validateOnInput"></a>
|
|
738
|
-
Use the `validateOnInput` attribute to enable live validation on the `input` event. Recommended use is with setting a custom `pattern` and validation is required prior to a `blur` event.
|
|
739
|
-
|
|
740
|
-
<div class="exampleWrapper">
|
|
741
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/validateOnInput.html) -->
|
|
742
|
-
<!-- The below content is automatically added from ../apiExamples/validateOnInput.html -->
|
|
743
|
-
<auro-input validateOnInput required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+" setCustomValidityPatternMismatch="Full name requires two or more names with at least one space.">
|
|
744
|
-
<span slot="label">Full Name</span>
|
|
745
|
-
<span slot="helpText">Please enter your full name as it appears on the card.</span>
|
|
597
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/pattern.html) -->
|
|
598
|
+
<!-- The below content is automatically added from ../apiExamples/pattern.html -->
|
|
599
|
+
<auro-input pattern="[a-z]{1,15}" spellcheck="false" setCustomValidityPatternMismatch="Only contain lowercase letters w/no spaces">
|
|
600
|
+
<span slot="label">Username</span>
|
|
601
|
+
<span slot="helpText">Please enter a username.</span>
|
|
746
602
|
</auro-input>
|
|
747
603
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
748
604
|
</div>
|
|
749
605
|
<auro-accordion alignRight>
|
|
750
606
|
<span slot="trigger">See code</span>
|
|
751
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
752
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
607
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/pattern.html) -->
|
|
608
|
+
<!-- The below code snippet is automatically added from ../apiExamples/pattern.html -->
|
|
753
609
|
|
|
754
610
|
```html
|
|
755
|
-
<auro-input
|
|
756
|
-
<span slot="label">
|
|
757
|
-
<span slot="helpText">Please enter
|
|
611
|
+
<auro-input pattern="[a-z]{1,15}" spellcheck="false" setCustomValidityPatternMismatch="Only contain lowercase letters w/no spaces">
|
|
612
|
+
<span slot="label">Username</span>
|
|
613
|
+
<span slot="helpText">Please enter a username.</span>
|
|
758
614
|
</auro-input>
|
|
759
615
|
```
|
|
760
616
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
761
617
|
</auro-accordion>
|
|
762
618
|
|
|
763
|
-
###
|
|
764
|
-
The `setCustomValidity` attribute can be used to set a custom string for all validityStates. When the component is first loaded, if this attribute is set on the element, all validityStates (except `valid`) will display the defined message.
|
|
619
|
+
### Placeholder
|
|
765
620
|
|
|
766
|
-
|
|
621
|
+
Use the `placeholder` attribute to add a custom placeholder message within the element.
|
|
767
622
|
|
|
768
623
|
<div class="exampleWrapper">
|
|
769
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
770
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
771
|
-
<auro-input
|
|
772
|
-
<span slot="label">Full
|
|
624
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/placeholder.html) -->
|
|
625
|
+
<!-- The below content is automatically added from ../apiExamples/placeholder.html -->
|
|
626
|
+
<auro-input placeholder="John Doe" required>
|
|
627
|
+
<span slot="label">Full name</span>
|
|
773
628
|
<span slot="helpText">Please enter your full name.</span>
|
|
774
629
|
</auro-input>
|
|
775
630
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
776
631
|
</div>
|
|
777
632
|
<auro-accordion alignRight>
|
|
778
633
|
<span slot="trigger">See code</span>
|
|
779
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
780
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
634
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/placeholder.html) -->
|
|
635
|
+
<!-- The below code snippet is automatically added from ../apiExamples/placeholder.html -->
|
|
781
636
|
|
|
782
637
|
```html
|
|
783
|
-
<auro-input
|
|
784
|
-
<span slot="label">Full
|
|
638
|
+
<auro-input placeholder="John Doe" required>
|
|
639
|
+
<span slot="label">Full name</span>
|
|
785
640
|
<span slot="helpText">Please enter your full name.</span>
|
|
786
641
|
</auro-input>
|
|
787
642
|
```
|
|
788
643
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
789
644
|
</auro-accordion>
|
|
790
645
|
|
|
791
|
-
###
|
|
792
|
-
Use the `error` attribute to apply a persistent custom error that supersedes the HTML5 validation logic.
|
|
646
|
+
### Readonly
|
|
793
647
|
|
|
794
|
-
|
|
648
|
+
Use the `readonly` attribute to prevent the user from editing the value of the input.
|
|
649
|
+
|
|
650
|
+
In this example, the user is able to programmatically change the value of the input by clicking the button or clear out the contents of the input.
|
|
795
651
|
|
|
796
652
|
<div class="exampleWrapper">
|
|
797
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
798
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
799
|
-
<auro-button id="
|
|
800
|
-
<auro-button id="
|
|
653
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/readonly.html) -->
|
|
654
|
+
<!-- The below content is automatically added from ../apiExamples/readonly.html -->
|
|
655
|
+
<auro-button id="setReadonlyValueBtn">Set Value to Auro Alaska</auro-button>
|
|
656
|
+
<auro-button id="resetReadonlyValueBtn">Reset</auro-button>
|
|
801
657
|
<br /><br />
|
|
802
|
-
<auro-input id="
|
|
658
|
+
<auro-input readonly id="readonlyExample">
|
|
803
659
|
<span slot="label">Name</span>
|
|
804
660
|
<span slot="helpText">Please enter your full name.</span>
|
|
805
661
|
</auro-input>
|
|
@@ -807,91 +663,100 @@ A custom error message can be set using the `error` attribute, or it can be used
|
|
|
807
663
|
</div>
|
|
808
664
|
<auro-accordion alignRight>
|
|
809
665
|
<span slot="trigger">See code</span>
|
|
810
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
811
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
666
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/readonly.html) -->
|
|
667
|
+
<!-- The below code snippet is automatically added from ../apiExamples/readonly.html -->
|
|
812
668
|
|
|
813
669
|
```html
|
|
814
|
-
<auro-button id="
|
|
815
|
-
<auro-button id="
|
|
670
|
+
<auro-button id="setReadonlyValueBtn">Set Value to Auro Alaska</auro-button>
|
|
671
|
+
<auro-button id="resetReadonlyValueBtn">Reset</auro-button>
|
|
816
672
|
<br /><br />
|
|
817
|
-
<auro-input id="
|
|
673
|
+
<auro-input readonly id="readonlyExample">
|
|
818
674
|
<span slot="label">Name</span>
|
|
819
675
|
<span slot="helpText">Please enter your full name.</span>
|
|
820
676
|
</auro-input>
|
|
821
677
|
```
|
|
822
678
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
823
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
824
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
679
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/readonly.js) -->
|
|
680
|
+
<!-- The below code snippet is automatically added from ../apiExamples/readonly.js -->
|
|
825
681
|
|
|
826
682
|
```js
|
|
827
|
-
export function
|
|
828
|
-
const elem = document.querySelector('#
|
|
829
|
-
// set custom error
|
|
830
|
-
document.querySelector('#setCustomErrorBtn').addEventListener('click', () => {
|
|
831
|
-
elem.error = "Custom Error Message";
|
|
832
|
-
});
|
|
683
|
+
export function setReadonlyValue() {
|
|
684
|
+
const elem = document.querySelector('#readonlyExample');
|
|
833
685
|
|
|
834
|
-
//
|
|
835
|
-
document.querySelector('#
|
|
836
|
-
|
|
686
|
+
// set value of auro-input element
|
|
687
|
+
document.querySelector('#setReadonlyValueBtn').addEventListener('click', () => {
|
|
688
|
+
elem.value = "Auro Alaska";
|
|
837
689
|
});
|
|
690
|
+
|
|
691
|
+
document.querySelector('#resetReadonlyValueBtn').addEventListener('click', () => {
|
|
692
|
+
elem.value = undefined;
|
|
693
|
+
});
|
|
838
694
|
}
|
|
839
695
|
```
|
|
840
696
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
841
697
|
</auro-accordion>
|
|
842
698
|
|
|
843
|
-
|
|
699
|
+
### Required
|
|
844
700
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
701
|
+
When present, the `required` attribute specifies that an input field must be filled out before submitting the form.
|
|
702
|
+
|
|
703
|
+
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`.
|
|
704
|
+
|
|
705
|
+
<div class="exampleWrapper">
|
|
706
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/required.html) -->
|
|
707
|
+
<!-- The below content is automatically added from ../apiExamples/required.html -->
|
|
708
|
+
<auro-input required placeholder="John Doe">
|
|
709
|
+
<span slot="label">Full name</span>
|
|
853
710
|
<span slot="helpText">Please enter your full name.</span>
|
|
854
711
|
</auro-input>
|
|
855
712
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
856
713
|
</div>
|
|
857
714
|
<auro-accordion alignRight>
|
|
858
715
|
<span slot="trigger">See code</span>
|
|
859
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
860
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
716
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/required.html) -->
|
|
717
|
+
<!-- The below code snippet is automatically added from ../apiExamples/required.html -->
|
|
861
718
|
|
|
862
719
|
```html
|
|
863
|
-
<auro-
|
|
864
|
-
<
|
|
865
|
-
<br /><br />
|
|
866
|
-
<auro-input appearance="inverse" id="setCustomErrorExampleOnDark" error="Initial error attribute value">
|
|
867
|
-
<span slot="label">Name</span>
|
|
720
|
+
<auro-input required placeholder="John Doe">
|
|
721
|
+
<span slot="label">Full name</span>
|
|
868
722
|
<span slot="helpText">Please enter your full name.</span>
|
|
869
723
|
</auro-input>
|
|
870
724
|
```
|
|
871
725
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
872
|
-
|
|
873
|
-
<!-- The below code snippet is automatically added from ../apiExamples/inverseAppearanceError.js -->
|
|
726
|
+
</auro-accordion>
|
|
874
727
|
|
|
875
|
-
|
|
876
|
-
export function customErrorOnDark() {
|
|
877
|
-
const elem = document.querySelector('#setCustomErrorExampleOnDark');
|
|
878
|
-
// set custom error
|
|
879
|
-
document.querySelector('#setCustomErrorBtnOnDark').addEventListener('click', () => {
|
|
880
|
-
elem.error = "Custom Error Message";
|
|
881
|
-
});
|
|
728
|
+
### Set Custom Validity
|
|
882
729
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
730
|
+
The `setCustomValidity` attribute can be used to set a custom string for all validityStates. When the component is first loaded, if this attribute is set on the element, all validityStates (except `valid`) will display the defined message.
|
|
731
|
+
|
|
732
|
+
**NOTE:** Custom strings are NOT localized. It is the responsibility of the element consumer to provide localized strings when using this element property.
|
|
733
|
+
|
|
734
|
+
<div class="exampleWrapper">
|
|
735
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/set-custom-validity.html) -->
|
|
736
|
+
<!-- The below content is automatically added from ../apiExamples/set-custom-validity.html -->
|
|
737
|
+
<auro-input required minlength="3" setCustomValidity="Sorry, please enter your first and last name (one space required).">
|
|
738
|
+
<span slot="label">Full Name</span>
|
|
739
|
+
<span slot="helpText">Please enter your full name.</span>
|
|
740
|
+
</auro-input>
|
|
741
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
742
|
+
</div>
|
|
743
|
+
<auro-accordion alignRight>
|
|
744
|
+
<span slot="trigger">See code</span>
|
|
745
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/set-custom-validity.html) -->
|
|
746
|
+
<!-- The below code snippet is automatically added from ../apiExamples/set-custom-validity.html -->
|
|
747
|
+
|
|
748
|
+
```html
|
|
749
|
+
<auro-input required minlength="3" setCustomValidity="Sorry, please enter your first and last name (one space required).">
|
|
750
|
+
<span slot="label">Full Name</span>
|
|
751
|
+
<span slot="helpText">Please enter your full name.</span>
|
|
752
|
+
</auro-input>
|
|
753
|
+
```
|
|
889
754
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
890
755
|
</auro-accordion>
|
|
891
756
|
|
|
892
|
-
|
|
757
|
+
### Type
|
|
893
758
|
|
|
894
|
-
|
|
759
|
+
#### Password
|
|
895
760
|
|
|
896
761
|
Use the `type="password"` attribute for a password style input. The hide/show password feature will automatically appear once a user begins to enter data.
|
|
897
762
|
|
|
@@ -909,9 +774,25 @@ Default help text will be added to the input `type="password"` if custom help te
|
|
|
909
774
|
</auro-input>
|
|
910
775
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
911
776
|
</div>
|
|
777
|
+
<auro-accordion alignRight>
|
|
778
|
+
<span slot="trigger">See code</span>
|
|
779
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/password.html) -->
|
|
780
|
+
<!-- The below code snippet is automatically added from ../apiExamples/password.html -->
|
|
781
|
+
|
|
782
|
+
```html
|
|
783
|
+
<auro-input type="password" required>
|
|
784
|
+
<span slot="ariaLabel.clear">Clear All</span>
|
|
785
|
+
<span slot="ariaLabel.password.show">Show</span>
|
|
786
|
+
<span slot="ariaLabel.password.hide">Hide</span>
|
|
787
|
+
<span slot="label">Password</span>
|
|
788
|
+
<span slot="helpText">Please enter a secure password.</span>
|
|
789
|
+
</auro-input>
|
|
790
|
+
```
|
|
791
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
792
|
+
</auro-accordion>
|
|
912
793
|
<div class="exampleWrapper--ondark" aria-hidden>
|
|
913
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
914
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
794
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/appearance-inverse-password.html) -->
|
|
795
|
+
<!-- The below content is automatically added from ../apiExamples/appearance-inverse-password.html -->
|
|
915
796
|
<auro-input appearance="inverse" type="password" required>
|
|
916
797
|
<span slot="label">Password</span>
|
|
917
798
|
<span slot="helpText">Please enter a secure password.</span>
|
|
@@ -920,8 +801,8 @@ Default help text will be added to the input `type="password"` if custom help te
|
|
|
920
801
|
</div>
|
|
921
802
|
<auro-accordion alignRight>
|
|
922
803
|
<span slot="trigger">See code</span>
|
|
923
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
924
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
804
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/appearance-inverse-password.html) -->
|
|
805
|
+
<!-- The below code snippet is automatically added from ../apiExamples/appearance-inverse-password.html -->
|
|
925
806
|
|
|
926
807
|
```html
|
|
927
808
|
<auro-input appearance="inverse" type="password" required>
|
|
@@ -932,7 +813,7 @@ Default help text will be added to the input `type="password"` if custom help te
|
|
|
932
813
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
933
814
|
</auro-accordion>
|
|
934
815
|
|
|
935
|
-
|
|
816
|
+
#### Email
|
|
936
817
|
|
|
937
818
|
Use the `type="email"` attribute for a email style input. These examples illustrate the default error messaging per that browser. Content may vary.
|
|
938
819
|
|
|
@@ -961,7 +842,7 @@ Default help text will be added to the input `type="email"` if custom help text
|
|
|
961
842
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
962
843
|
</auro-accordion>
|
|
963
844
|
|
|
964
|
-
|
|
845
|
+
#### Number
|
|
965
846
|
|
|
966
847
|
Use the `type="number"` attribute for a numeric style input and invoke a numeric virtual keyboard on handheld devices.
|
|
967
848
|
|
|
@@ -990,15 +871,15 @@ This `number` input type should only be used for incremental numeric values, mea
|
|
|
990
871
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
991
872
|
</auro-accordion>
|
|
992
873
|
|
|
993
|
-
|
|
874
|
+
#### Credit Card
|
|
994
875
|
|
|
995
876
|
Use the `type="credit-card"` attribute for a credit card formatted input.
|
|
996
877
|
|
|
997
878
|
Default help text will be added to the input `type="credit-card"` if custom help text is not provided. See the example below.
|
|
998
879
|
|
|
999
880
|
<div class="exampleWrapper">
|
|
1000
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
1001
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
881
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/credit-card.html) -->
|
|
882
|
+
<!-- The below content is automatically added from ../apiExamples/credit-card.html -->
|
|
1002
883
|
<auro-input type="credit-card" required>
|
|
1003
884
|
<span slot="label">Card number</span>
|
|
1004
885
|
<span slot="helpText">Valid credit card numbers must include 16 digits (15 for Amex).</span>
|
|
@@ -1007,8 +888,8 @@ Default help text will be added to the input `type="credit-card"` if custom help
|
|
|
1007
888
|
</div>
|
|
1008
889
|
<auro-accordion alignRight>
|
|
1009
890
|
<span slot="trigger">See code</span>
|
|
1010
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1011
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
891
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/credit-card.html) -->
|
|
892
|
+
<!-- The below code snippet is automatically added from ../apiExamples/credit-card.html -->
|
|
1012
893
|
|
|
1013
894
|
```html
|
|
1014
895
|
<auro-input type="credit-card" required>
|
|
@@ -1023,8 +904,8 @@ Use the `type="credit-card"` and `icon` attributes for a credit card formatted i
|
|
|
1023
904
|
**Dependency**: Please be sure to also install [auro-icon](https://auro.alaskaair.com/components/auro/icon/install) as a peer dependency.
|
|
1024
905
|
|
|
1025
906
|
<div class="exampleWrapper">
|
|
1026
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
1027
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
907
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/credit-card-icon.html) -->
|
|
908
|
+
<!-- The below content is automatically added from ../apiExamples/credit-card-icon.html -->
|
|
1028
909
|
<auro-input icon type="credit-card" required>
|
|
1029
910
|
<span slot="label">Card number</span>
|
|
1030
911
|
<span slot="helpText">Valid credit card numbers must include 16 digits (15 for Amex).</span>
|
|
@@ -1034,8 +915,8 @@ Use the `type="credit-card"` and `icon` attributes for a credit card formatted i
|
|
|
1034
915
|
<auro-accordion alignRight>
|
|
1035
916
|
<span slot="trigger">See code</span>
|
|
1036
917
|
// Use 4147 3411 1111 1111 to see the Alaska Airline's credit card!
|
|
1037
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1038
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
918
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/credit-card-icon.html) -->
|
|
919
|
+
<!-- The below code snippet is automatically added from ../apiExamples/credit-card-icon.html -->
|
|
1039
920
|
|
|
1040
921
|
```html
|
|
1041
922
|
<auro-input icon type="credit-card" required>
|
|
@@ -1046,7 +927,7 @@ Use the `type="credit-card"` and `icon` attributes for a credit card formatted i
|
|
|
1046
927
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1047
928
|
</auro-accordion>
|
|
1048
929
|
|
|
1049
|
-
|
|
930
|
+
#### Phone Number
|
|
1050
931
|
|
|
1051
932
|
Use the `type="tel"` attribute for a phone number formatted input. The default format is `+1 (000) 000-0000`.
|
|
1052
933
|
|
|
@@ -1073,13 +954,13 @@ Use the `type="tel"` attribute for a phone number formatted input. The default f
|
|
|
1073
954
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1074
955
|
</auro-accordion>
|
|
1075
956
|
|
|
1076
|
-
#### Formatting
|
|
957
|
+
#### Phone Number Formatting
|
|
1077
958
|
|
|
1078
959
|
Use the `format` attribute to set a custom phone number format.
|
|
1079
960
|
|
|
1080
961
|
<div class="exampleWrapper">
|
|
1081
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
1082
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
962
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/tel-format.html) -->
|
|
963
|
+
<!-- The below content is automatically added from ../apiExamples/tel-format.html -->
|
|
1083
964
|
<auro-input type="tel" format="+22 999 99 9999">
|
|
1084
965
|
<span slot="label">Telephone</span>
|
|
1085
966
|
<span slot="helpText">Help Text</span>
|
|
@@ -1088,8 +969,8 @@ Use the `format` attribute to set a custom phone number format.
|
|
|
1088
969
|
</div>
|
|
1089
970
|
<auro-accordion alignRight>
|
|
1090
971
|
<span slot="trigger">See code</span>
|
|
1091
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1092
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
972
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/tel-format.html) -->
|
|
973
|
+
<!-- The below code snippet is automatically added from ../apiExamples/tel-format.html -->
|
|
1093
974
|
|
|
1094
975
|
```html
|
|
1095
976
|
<auro-input type="tel" format="+22 999 99 9999">
|
|
@@ -1100,13 +981,13 @@ Use the `format` attribute to set a custom phone number format.
|
|
|
1100
981
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1101
982
|
</auro-accordion>
|
|
1102
983
|
|
|
1103
|
-
|
|
984
|
+
#### Date
|
|
1104
985
|
|
|
1105
986
|
Use the `type="date"` attribute for a date formatted input. The default date format is `mm/dd/yyyy`.
|
|
1106
987
|
|
|
1107
988
|
<div class="exampleWrapper">
|
|
1108
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
1109
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
989
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/month-day-year.html) -->
|
|
990
|
+
<!-- The below content is automatically added from ../apiExamples/month-day-year.html -->
|
|
1110
991
|
<auro-input type="date">
|
|
1111
992
|
<span slot="label">Arrival date</span>
|
|
1112
993
|
<span slot="helpText">Help Text</span>
|
|
@@ -1115,8 +996,8 @@ Use the `type="date"` attribute for a date formatted input. The default date for
|
|
|
1115
996
|
</div>
|
|
1116
997
|
<auro-accordion alignRight>
|
|
1117
998
|
<span slot="trigger">See code</span>
|
|
1118
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1119
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
999
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/month-day-year.html) -->
|
|
1000
|
+
<!-- The below code snippet is automatically added from ../apiExamples/month-day-year.html -->
|
|
1120
1001
|
|
|
1121
1002
|
```html
|
|
1122
1003
|
<auro-input type="date">
|
|
@@ -1127,13 +1008,13 @@ Use the `type="date"` attribute for a date formatted input. The default date for
|
|
|
1127
1008
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1128
1009
|
</auro-accordion>
|
|
1129
1010
|
|
|
1130
|
-
#### Formatting
|
|
1011
|
+
#### Date Formatting
|
|
1131
1012
|
|
|
1132
1013
|
Use the `format` attribute to put together any combination of `mm`, `dd`, & `yyyy` or `yy`.
|
|
1133
1014
|
|
|
1134
1015
|
<div class="exampleWrapper">
|
|
1135
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
1136
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
1016
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/year-month-day.html) -->
|
|
1017
|
+
<!-- The below content is automatically added from ../apiExamples/year-month-day.html -->
|
|
1137
1018
|
<auro-input type="date" format="yyyy/mm/dd">
|
|
1138
1019
|
<span slot="label">Arrival date</span>
|
|
1139
1020
|
<span slot="helpText">Help Text</span>
|
|
@@ -1142,8 +1023,8 @@ Use the `format` attribute to put together any combination of `mm`, `dd`, & `yyy
|
|
|
1142
1023
|
</div>
|
|
1143
1024
|
<auro-accordion alignRight>
|
|
1144
1025
|
<span slot="trigger">See code</span>
|
|
1145
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1146
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
1026
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/year-month-day.html) -->
|
|
1027
|
+
<!-- The below code snippet is automatically added from ../apiExamples/year-month-day.html -->
|
|
1147
1028
|
|
|
1148
1029
|
```html
|
|
1149
1030
|
<auro-input type="date" format="yyyy/mm/dd">
|
|
@@ -1154,8 +1035,8 @@ Use the `format` attribute to put together any combination of `mm`, `dd`, & `yyy
|
|
|
1154
1035
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1155
1036
|
</auro-accordion>
|
|
1156
1037
|
<div class="exampleWrapper">
|
|
1157
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
1158
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
1038
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/month-year.html) -->
|
|
1039
|
+
<!-- The below content is automatically added from ../apiExamples/month-year.html -->
|
|
1159
1040
|
<auro-input type="date" format="mm/yy">
|
|
1160
1041
|
<span slot="label">Expiration date</span>
|
|
1161
1042
|
<span slot="helpText">Help Text</span>
|
|
@@ -1164,8 +1045,8 @@ Use the `format` attribute to put together any combination of `mm`, `dd`, & `yyy
|
|
|
1164
1045
|
</div>
|
|
1165
1046
|
<auro-accordion alignRight>
|
|
1166
1047
|
<span slot="trigger">See code</span>
|
|
1167
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1168
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
1048
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/month-year.html) -->
|
|
1049
|
+
<!-- The below code snippet is automatically added from ../apiExamples/month-year.html -->
|
|
1169
1050
|
|
|
1170
1051
|
```html
|
|
1171
1052
|
<auro-input type="date" format="mm/yy">
|
|
@@ -1198,15 +1079,122 @@ Use the `format` attribute to put together any combination of `mm`, `dd`, & `yyy
|
|
|
1198
1079
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1199
1080
|
</auro-accordion>
|
|
1200
1081
|
|
|
1201
|
-
|
|
1082
|
+
### Validate on Input
|
|
1083
|
+
|
|
1084
|
+
Use the `validateOnInput` attribute to enable live validation on the `input` event. Recommended use is with setting a custom `pattern` and validation is required prior to a `blur` event.
|
|
1085
|
+
|
|
1086
|
+
<div class="exampleWrapper">
|
|
1087
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/validate-on-input.html) -->
|
|
1088
|
+
<!-- The below content is automatically added from ../apiExamples/validate-on-input.html -->
|
|
1089
|
+
<auro-input validateOnInput required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+" setCustomValidityPatternMismatch="Full name requires two or more names with at least one space.">
|
|
1090
|
+
<span slot="label">Full Name</span>
|
|
1091
|
+
<span slot="helpText">Please enter your full name as it appears on the card.</span>
|
|
1092
|
+
</auro-input>
|
|
1093
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1094
|
+
</div>
|
|
1095
|
+
<auro-accordion alignRight>
|
|
1096
|
+
<span slot="trigger">See code</span>
|
|
1097
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/validate-on-input.html) -->
|
|
1098
|
+
<!-- The below code snippet is automatically added from ../apiExamples/validate-on-input.html -->
|
|
1099
|
+
|
|
1100
|
+
```html
|
|
1101
|
+
<auro-input validateOnInput required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+" setCustomValidityPatternMismatch="Full name requires two or more names with at least one space.">
|
|
1102
|
+
<span slot="label">Full Name</span>
|
|
1103
|
+
<span slot="helpText">Please enter your full name as it appears on the card.</span>
|
|
1104
|
+
</auro-input>
|
|
1105
|
+
```
|
|
1106
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1107
|
+
</auro-accordion>
|
|
1108
|
+
|
|
1109
|
+
### Value <a name="value"></a>
|
|
1110
|
+
Use the `value` attribute to programmatically set the value of the input.
|
|
1111
|
+
|
|
1112
|
+
<div class="exampleWrapper">
|
|
1113
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/programmatic-value.html) -->
|
|
1114
|
+
<!-- The below content is automatically added from ../apiExamples/programmatic-value.html -->
|
|
1115
|
+
<auro-input value="Alaska Airlines is the best!">
|
|
1116
|
+
<span slot="label">Name</span>
|
|
1117
|
+
<span slot="helpText">Please enter your full name.</span>
|
|
1118
|
+
</auro-input>
|
|
1119
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1120
|
+
</div>
|
|
1121
|
+
<auro-accordion alignRight>
|
|
1122
|
+
<span slot="trigger">See code</span>
|
|
1123
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/programmatic-value.html) -->
|
|
1124
|
+
<!-- The below code snippet is automatically added from ../apiExamples/programmatic-value.html -->
|
|
1125
|
+
|
|
1126
|
+
```html
|
|
1127
|
+
<auro-input value="Alaska Airlines is the best!">
|
|
1128
|
+
<span slot="label">Name</span>
|
|
1129
|
+
<span slot="helpText">Please enter your full name.</span>
|
|
1130
|
+
</auro-input>
|
|
1131
|
+
```
|
|
1132
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1133
|
+
</auro-accordion>
|
|
1134
|
+
|
|
1135
|
+
#### Dynamically Set Value
|
|
1136
|
+
|
|
1137
|
+
Use the `value` and other components to dynamically set the value of the input.
|
|
1138
|
+
|
|
1139
|
+
Note: Setting the `value` to `undefined` will also reset the element.
|
|
1140
|
+
|
|
1141
|
+
<div class="exampleWrapper">
|
|
1142
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/value.html) -->
|
|
1143
|
+
<!-- The below content is automatically added from ../apiExamples/value.html -->
|
|
1144
|
+
<auro-button id="setValidValueBtn">Set Value to Alaska</auro-button>
|
|
1145
|
+
<auro-button id="setUndefinedValueBtn">Set Value to Undefined</auro-button>
|
|
1146
|
+
<br /><br />
|
|
1147
|
+
<auro-input id="setProgrammaticValueExample" value="Press one of the buttons above!">
|
|
1148
|
+
<span slot="label">Name</span>
|
|
1149
|
+
<span slot="helpText">Please enter your full name.</span>
|
|
1150
|
+
</auro-input>
|
|
1151
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1152
|
+
</div>
|
|
1153
|
+
<auro-accordion alignRight>
|
|
1154
|
+
<span slot="trigger">See code</span>
|
|
1155
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/value.html) -->
|
|
1156
|
+
<!-- The below code snippet is automatically added from ../apiExamples/value.html -->
|
|
1157
|
+
|
|
1158
|
+
```html
|
|
1159
|
+
<auro-button id="setValidValueBtn">Set Value to Alaska</auro-button>
|
|
1160
|
+
<auro-button id="setUndefinedValueBtn">Set Value to Undefined</auro-button>
|
|
1161
|
+
<br /><br />
|
|
1162
|
+
<auro-input id="setProgrammaticValueExample" value="Press one of the buttons above!">
|
|
1163
|
+
<span slot="label">Name</span>
|
|
1164
|
+
<span slot="helpText">Please enter your full name.</span>
|
|
1165
|
+
</auro-input>
|
|
1166
|
+
```
|
|
1167
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1168
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/value.js) -->
|
|
1169
|
+
<!-- The below code snippet is automatically added from ../apiExamples/value.js -->
|
|
1170
|
+
|
|
1171
|
+
```js
|
|
1172
|
+
export function programmaticallySetValue() {
|
|
1173
|
+
const elem = document.querySelector('#setProgrammaticValueExample');
|
|
1174
|
+
|
|
1175
|
+
// set value of auro-input element
|
|
1176
|
+
document.querySelector('#setValidValueBtn').addEventListener('click', () => {
|
|
1177
|
+
elem.value = "Alaska Airlines is the best";
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
// reset the value of auro-input element
|
|
1181
|
+
document.querySelector('#setUndefinedValueBtn').addEventListener('click', () => {
|
|
1182
|
+
elem.value = undefined;
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
```
|
|
1186
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1187
|
+
</auro-accordion>
|
|
1188
|
+
|
|
1189
|
+
## Method Examples
|
|
1202
1190
|
|
|
1203
1191
|
### Reset State
|
|
1204
1192
|
|
|
1205
1193
|
Use the `reset()` method to reset the `<auro-input>`'s `value` and `validity` state. Doing so will preserve all other attributes and properties.
|
|
1206
1194
|
|
|
1207
1195
|
<div class="exampleWrapper">
|
|
1208
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
1209
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
1196
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/reset-state.html) -->
|
|
1197
|
+
<!-- The below content is automatically added from ../apiExamples/reset-state.html -->
|
|
1210
1198
|
<auro-button id="resetStateBtn">Reset</auro-button>
|
|
1211
1199
|
<br /><br />
|
|
1212
1200
|
<auro-input id="resetStateExample" minlength="12" value="Auro Team" setCustomValidityTooShort="Please enter your full name!">
|
|
@@ -1217,8 +1205,8 @@ Use the `reset()` method to reset the `<auro-input>`'s `value` and `validity` st
|
|
|
1217
1205
|
</div>
|
|
1218
1206
|
<auro-accordion alignRight>
|
|
1219
1207
|
<span slot="trigger">See code</span>
|
|
1220
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1221
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
1208
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/reset-state.html) -->
|
|
1209
|
+
<!-- The below code snippet is automatically added from ../apiExamples/reset-state.html -->
|
|
1222
1210
|
|
|
1223
1211
|
```html
|
|
1224
1212
|
<auro-button id="resetStateBtn">Reset</auro-button>
|
|
@@ -1229,8 +1217,8 @@ Use the `reset()` method to reset the `<auro-input>`'s `value` and `validity` st
|
|
|
1229
1217
|
</auro-input>
|
|
1230
1218
|
```
|
|
1231
1219
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1232
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1233
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
1220
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/reset-state.js) -->
|
|
1221
|
+
<!-- The below code snippet is automatically added from ../apiExamples/reset-state.js -->
|
|
1234
1222
|
|
|
1235
1223
|
```js
|
|
1236
1224
|
export function resetStateExample() {
|
|
@@ -1244,13 +1232,46 @@ export function resetStateExample() {
|
|
|
1244
1232
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1245
1233
|
</auro-accordion>
|
|
1246
1234
|
|
|
1235
|
+
## Slot Examples
|
|
1236
|
+
|
|
1237
|
+
### Custom Optional Label
|
|
1238
|
+
|
|
1239
|
+
The `<auro-input>` supports an `optionalLabel` slot, where users can can override the default `(optional)` notification text.
|
|
1240
|
+
|
|
1241
|
+
<div class="exampleWrapper">
|
|
1242
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/optional-label.html) -->
|
|
1243
|
+
<!-- The below content is automatically added from ./../apiExamples/optional-label.html -->
|
|
1244
|
+
<auro-input placeholder="John Doe" bordered>
|
|
1245
|
+
<span slot="label">Full name</span>
|
|
1246
|
+
<span slot="optionalLabel" style="color: grey; font-size: small"> - optional</span>
|
|
1247
|
+
<span slot="helpText">Please enter your full name.</span>
|
|
1248
|
+
</auro-input>
|
|
1249
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1250
|
+
</div>
|
|
1251
|
+
<auro-accordion alignRight>
|
|
1252
|
+
<span slot="trigger">See code</span>
|
|
1253
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/optional-label.html) -->
|
|
1254
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/optional-label.html -->
|
|
1255
|
+
|
|
1256
|
+
```html
|
|
1257
|
+
<auro-input placeholder="John Doe" bordered>
|
|
1258
|
+
<span slot="label">Full name</span>
|
|
1259
|
+
<span slot="optionalLabel" style="color: grey; font-size: small"> - optional</span>
|
|
1260
|
+
<span slot="helpText">Please enter your full name.</span>
|
|
1261
|
+
</auro-input>
|
|
1262
|
+
```
|
|
1263
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1264
|
+
</auro-accordion>
|
|
1265
|
+
|
|
1266
|
+
## Common Usage Patterns & Functional Examples
|
|
1267
|
+
|
|
1247
1268
|
### Swapping Values Between Inputs
|
|
1248
1269
|
|
|
1249
1270
|
Example illustrates using a JavaScript function attached to an `auro-button` component `click` event to swap the values of two `auro-input` elements. An example of this use case would be swapping the departure and arrival airports in a flight search form.
|
|
1250
1271
|
|
|
1251
1272
|
<div class="exampleWrapper">
|
|
1252
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/
|
|
1253
|
-
<!-- The below content is automatically added from ../apiExamples/
|
|
1273
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/swap-value.html) -->
|
|
1274
|
+
<!-- The below content is automatically added from ../apiExamples/swap-value.html -->
|
|
1254
1275
|
<auro-input id="swapExampleLeft">
|
|
1255
1276
|
<span slot="label">Left Input</span>
|
|
1256
1277
|
<span slot="helpText">Help Text</span>
|
|
@@ -1279,8 +1300,8 @@ Example illustrates using a JavaScript function attached to an `auro-button` com
|
|
|
1279
1300
|
</div>
|
|
1280
1301
|
<auro-accordion alignRight>
|
|
1281
1302
|
<span slot="trigger">See code</span>
|
|
1282
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1283
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
1303
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/swap-value.html) -->
|
|
1304
|
+
<!-- The below code snippet is automatically added from ../apiExamples/swap-value.html -->
|
|
1284
1305
|
|
|
1285
1306
|
```html
|
|
1286
1307
|
<auro-input id="swapExampleLeft">
|
|
@@ -1309,8 +1330,8 @@ Example illustrates using a JavaScript function attached to an `auro-button` com
|
|
|
1309
1330
|
</style>
|
|
1310
1331
|
```
|
|
1311
1332
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1312
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/
|
|
1313
|
-
<!-- The below code snippet is automatically added from ../apiExamples/
|
|
1333
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/swap-value.js) -->
|
|
1334
|
+
<!-- The below code snippet is automatically added from ../apiExamples/swap-value.js -->
|
|
1314
1335
|
|
|
1315
1336
|
```js
|
|
1316
1337
|
export function swapInputValues() {
|
|
@@ -1330,12 +1351,12 @@ export function swapInputValues() {
|
|
|
1330
1351
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1331
1352
|
</auro-accordion>
|
|
1332
1353
|
|
|
1333
|
-
##
|
|
1354
|
+
## Restyle Component with CSS Variables
|
|
1334
1355
|
|
|
1335
|
-
The component may be restyled
|
|
1356
|
+
The component may be restyled by changing the values of the following token(s).
|
|
1336
1357
|
|
|
1337
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
1338
|
-
<!-- The below code snippet is automatically added from
|
|
1358
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../src/styles/tokens.scss) -->
|
|
1359
|
+
<!-- The below code snippet is automatically added from ./../src/styles/tokens.scss -->
|
|
1339
1360
|
|
|
1340
1361
|
```scss
|
|
1341
1362
|
/* stylelint-disable custom-property-empty-line-before */
|