@aurodesignsystem-dev/auro-formkit 0.0.0-pr593.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README.md +314 -0
- package/components/bibtemplate/dist/auro-bibtemplate.d.ts +39 -0
- package/components/bibtemplate/dist/headerVersion.d.ts +2 -0
- package/components/bibtemplate/dist/iconVersion.d.ts +2 -0
- package/components/bibtemplate/dist/index.d.ts +2 -0
- package/components/bibtemplate/dist/index.js +709 -0
- package/components/bibtemplate/dist/registered.js +709 -0
- package/components/bibtemplate/dist/styles/color-css.d.ts +2 -0
- package/components/bibtemplate/dist/styles/style-css.d.ts +2 -0
- package/components/bibtemplate/dist/styles/tokens-css.d.ts +2 -0
- package/components/checkbox/README.md +142 -0
- package/components/checkbox/demo/api.html +55 -0
- package/components/checkbox/demo/api.js +17 -0
- package/components/checkbox/demo/api.md +401 -0
- package/components/checkbox/demo/api.min.js +1833 -0
- package/components/checkbox/demo/index.html +51 -0
- package/components/checkbox/demo/index.js +8 -0
- package/components/checkbox/demo/index.md +327 -0
- package/components/checkbox/demo/index.min.js +1808 -0
- package/components/checkbox/demo/readme.html +50 -0
- package/components/checkbox/demo/readme.md +142 -0
- package/components/checkbox/dist/auro-checkbox-group.d.ts +166 -0
- package/components/checkbox/dist/auro-checkbox.d.ts +129 -0
- package/components/checkbox/dist/helptextVersion.d.ts +2 -0
- package/components/checkbox/dist/index.d.ts +3 -0
- package/components/checkbox/dist/index.js +1757 -0
- package/components/checkbox/dist/registered.js +1758 -0
- package/components/checkbox/dist/styles/auro-checkbox-css.d.ts +2 -0
- package/components/checkbox/dist/styles/auro-checkbox-group-css.d.ts +2 -0
- package/components/checkbox/dist/styles/color-css.d.ts +2 -0
- package/components/checkbox/dist/styles/colorGroup-css.d.ts +2 -0
- package/components/checkbox/dist/styles/tokens-css.d.ts +2 -0
- package/components/combobox/README.md +152 -0
- package/components/combobox/demo/api.html +57 -0
- package/components/combobox/demo/api.js +36 -0
- package/components/combobox/demo/api.md +1209 -0
- package/components/combobox/demo/api.min.js +15117 -0
- package/components/combobox/demo/index.html +56 -0
- package/components/combobox/demo/index.js +26 -0
- package/components/combobox/demo/index.md +621 -0
- package/components/combobox/demo/index.min.js +14971 -0
- package/components/combobox/demo/readme.html +50 -0
- package/components/combobox/demo/readme.md +152 -0
- package/components/combobox/dist/auro-combobox.d.ts +384 -0
- package/components/combobox/dist/bibtemplateVersion.d.ts +2 -0
- package/components/combobox/dist/dropdownVersion.d.ts +2 -0
- package/components/combobox/dist/index.d.ts +2 -0
- package/components/combobox/dist/index.js +13554 -0
- package/components/combobox/dist/inputVersion.d.ts +2 -0
- package/components/combobox/dist/registered.js +13556 -0
- package/components/combobox/dist/styles/style-css.d.ts +2 -0
- package/components/counter/README.md +146 -0
- package/components/counter/demo/api.html +54 -0
- package/components/counter/demo/api.js +20 -0
- package/components/counter/demo/api.md +584 -0
- package/components/counter/demo/api.min.js +7111 -0
- package/components/counter/demo/index.html +54 -0
- package/components/counter/demo/index.js +21 -0
- package/components/counter/demo/index.md +244 -0
- package/components/counter/demo/index.min.js +7075 -0
- package/components/counter/demo/readme.html +50 -0
- package/components/counter/demo/readme.md +146 -0
- package/components/counter/dist/auro-counter-button.d.ts +12 -0
- package/components/counter/dist/auro-counter-group.d.ts +235 -0
- package/components/counter/dist/auro-counter-wrapper.d.ts +22 -0
- package/components/counter/dist/auro-counter.d.ts +97 -0
- package/components/counter/dist/bibtemplateVersion.d.ts +2 -0
- package/components/counter/dist/dropdownVersion.d.ts +2 -0
- package/components/counter/dist/iconVersion.d.ts +2 -0
- package/components/counter/dist/index.d.ts +3 -0
- package/components/counter/dist/index.js +7018 -0
- package/components/counter/dist/registered.js +7019 -0
- package/components/counter/dist/styles/color-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-button-color-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-button-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-group-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-wrapper-color-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-wrapper-css.d.ts +2 -0
- package/components/counter/dist/styles/style-css.d.ts +2 -0
- package/components/counter/dist/styles/tokens-css.d.ts +2 -0
- package/components/datepicker/README.md +140 -0
- package/components/datepicker/demo/api.html +57 -0
- package/components/datepicker/demo/api.js +35 -0
- package/components/datepicker/demo/api.md +1479 -0
- package/components/datepicker/demo/api.min.js +24534 -0
- package/components/datepicker/demo/index.html +56 -0
- package/components/datepicker/demo/index.js +19 -0
- package/components/datepicker/demo/index.md +112 -0
- package/components/datepicker/demo/index.min.js +24255 -0
- package/components/datepicker/demo/readme.html +50 -0
- package/components/datepicker/demo/readme.md +140 -0
- package/components/datepicker/dist/auro-calendar-cell.d.ts +163 -0
- package/components/datepicker/dist/auro-calendar-month.d.ts +20 -0
- package/components/datepicker/dist/auro-calendar.d.ts +133 -0
- package/components/datepicker/dist/auro-datepicker.d.ts +466 -0
- package/components/datepicker/dist/bibtemplateVersion.d.ts +2 -0
- package/components/datepicker/dist/buttonVersion.d.ts +2 -0
- package/components/datepicker/dist/dropdownVersion.d.ts +2 -0
- package/components/datepicker/dist/index.d.ts +2 -0
- package/components/datepicker/dist/index.js +24185 -0
- package/components/datepicker/dist/inputVersion.d.ts +2 -0
- package/components/datepicker/dist/popoverVersion.d.ts +2 -0
- package/components/datepicker/dist/registered.js +24185 -0
- package/components/datepicker/dist/styles/color-calendar-css.d.ts +2 -0
- package/components/datepicker/dist/styles/color-cell-css.d.ts +2 -0
- package/components/datepicker/dist/styles/color-css.d.ts +2 -0
- package/components/datepicker/dist/styles/color-month-css.d.ts +2 -0
- package/components/datepicker/dist/styles/style-auro-calendar-cell-css.d.ts +2 -0
- package/components/datepicker/dist/styles/style-auro-calendar-css.d.ts +2 -0
- package/components/datepicker/dist/styles/style-auro-calendar-month-css.d.ts +2 -0
- package/components/datepicker/dist/styles/style-css.d.ts +2 -0
- package/components/datepicker/dist/styles/tokens-css.d.ts +2 -0
- package/components/datepicker/dist/utilities.d.ts +78 -0
- package/components/datepicker/dist/utilitiesCalendar.d.ts +38 -0
- package/components/datepicker/dist/utilitiesCalendarRender.d.ts +50 -0
- package/components/datepicker/dist/vendor/wc-range-datepicker/day.d.ts +5 -0
- package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-calendar.d.ts +60 -0
- package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-cell.d.ts +1 -0
- package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker.d.ts +57 -0
- package/components/dropdown/README.md +144 -0
- package/components/dropdown/demo/api.html +57 -0
- package/components/dropdown/demo/api.js +21 -0
- package/components/dropdown/demo/api.md +1434 -0
- package/components/dropdown/demo/api.min.js +3826 -0
- package/components/dropdown/demo/index.html +55 -0
- package/components/dropdown/demo/index.js +19 -0
- package/components/dropdown/demo/index.md +510 -0
- package/components/dropdown/demo/index.min.js +3789 -0
- package/components/dropdown/demo/readme.html +50 -0
- package/components/dropdown/demo/readme.md +144 -0
- package/components/dropdown/dist/auro-dropdown.d.ts +406 -0
- package/components/dropdown/dist/auro-dropdownBib.d.ts +46 -0
- package/components/dropdown/dist/dropdownVersion.d.ts +2 -0
- package/components/dropdown/dist/helptextVersion.d.ts +2 -0
- package/components/dropdown/dist/iconVersion.d.ts +2 -0
- package/components/dropdown/dist/index.d.ts +2 -0
- package/components/dropdown/dist/index.js +3734 -0
- package/components/dropdown/dist/registered.js +3734 -0
- package/components/dropdown/dist/styles/bibColors-css.d.ts +2 -0
- package/components/dropdown/dist/styles/bibStyles-css.d.ts +2 -0
- package/components/dropdown/dist/styles/color-css.d.ts +2 -0
- package/components/dropdown/dist/styles/style-css.d.ts +2 -0
- package/components/dropdown/dist/styles/tokens-css.d.ts +2 -0
- package/components/form/README.md +142 -0
- package/components/form/demo/api.html +49 -0
- package/components/form/demo/api.js +3 -0
- package/components/form/demo/api.md +51 -0
- package/components/form/demo/api.min.js +638 -0
- package/components/form/demo/autocomplete.html +15 -0
- package/components/form/demo/index.html +50 -0
- package/components/form/demo/index.js +4 -0
- package/components/form/demo/index.md +403 -0
- package/components/form/demo/index.min.js +639 -0
- package/components/form/demo/readme.html +50 -0
- package/components/form/demo/readme.md +142 -0
- package/components/form/demo/registerDemoDeps.js +23 -0
- package/components/form/demo/working.html +118 -0
- package/components/form/dist/auro-form.d.ts +223 -0
- package/components/form/dist/index.d.ts +2 -0
- package/components/form/dist/index.js +614 -0
- package/components/form/dist/registered.d.ts +1 -0
- package/components/form/dist/registered.js +614 -0
- package/components/form/dist/styles/style-css.d.ts +2 -0
- package/components/helptext/dist/auro-helptext.d.ts +61 -0
- package/components/helptext/dist/index.d.ts +2 -0
- package/components/helptext/dist/index.js +209 -0
- package/components/helptext/dist/registered.js +209 -0
- package/components/helptext/dist/styles/color-css.d.ts +2 -0
- package/components/helptext/dist/styles/style-css.d.ts +2 -0
- package/components/helptext/dist/styles/tokens-css.d.ts +2 -0
- package/components/input/README.md +135 -0
- package/components/input/demo/api.html +42 -0
- package/components/input/demo/api.js +29 -0
- package/components/input/demo/api.md +1252 -0
- package/components/input/demo/api.min.js +7238 -0
- package/components/input/demo/index.html +43 -0
- package/components/input/demo/index.js +20 -0
- package/components/input/demo/index.md +202 -0
- package/components/input/demo/index.min.js +7157 -0
- package/components/input/demo/readme.html +50 -0
- package/components/input/demo/readme.md +135 -0
- package/components/input/dist/auro-input.d.ts +31 -0
- package/components/input/dist/base-input.d.ts +512 -0
- package/components/input/dist/buttonVersion.d.ts +2 -0
- package/components/input/dist/helptextVersion.d.ts +2 -0
- package/components/input/dist/i18n.d.ts +18 -0
- package/components/input/dist/iconVersion.d.ts +2 -0
- package/components/input/dist/index.d.ts +2 -0
- package/components/input/dist/index.js +7063 -0
- package/components/input/dist/registered.js +7063 -0
- package/components/input/dist/styles/borders-css.d.ts +2 -0
- package/components/input/dist/styles/color-css.d.ts +2 -0
- package/components/input/dist/styles/input-css.d.ts +2 -0
- package/components/input/dist/styles/label-css.d.ts +2 -0
- package/components/input/dist/styles/mixins-css.d.ts +2 -0
- package/components/input/dist/styles/notificationIcons-css.d.ts +2 -0
- package/components/input/dist/styles/style-css.d.ts +2 -0
- package/components/input/dist/styles/tokens-css.d.ts +2 -0
- package/components/input/dist/utilities.d.ts +25 -0
- package/components/menu/README.md +145 -0
- package/components/menu/demo/api.html +55 -0
- package/components/menu/demo/api.js +27 -0
- package/components/menu/demo/api.md +954 -0
- package/components/menu/demo/api.min.js +1538 -0
- package/components/menu/demo/index.html +52 -0
- package/components/menu/demo/index.js +28 -0
- package/components/menu/demo/index.md +61 -0
- package/components/menu/demo/index.min.js +1484 -0
- package/components/menu/demo/readme.html +50 -0
- package/components/menu/demo/readme.md +145 -0
- package/components/menu/dist/auro-menu-utils.d.ts +42 -0
- package/components/menu/dist/auro-menu.d.ts +205 -0
- package/components/menu/dist/auro-menuoption.d.ts +63 -0
- package/components/menu/dist/dropdownVersion.d.ts +2 -0
- package/components/menu/dist/iconVersion.d.ts +2 -0
- package/components/menu/dist/index.d.ts +4 -0
- package/components/menu/dist/index.js +1426 -0
- package/components/menu/dist/registered.js +1427 -0
- package/components/menu/dist/styles/color-menu-css.d.ts +2 -0
- package/components/menu/dist/styles/color-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/style-menu-css.d.ts +2 -0
- package/components/menu/dist/styles/style-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/tokens-css.d.ts +2 -0
- package/components/radio/README.md +137 -0
- package/components/radio/demo/api.html +53 -0
- package/components/radio/demo/api.js +19 -0
- package/components/radio/demo/api.md +562 -0
- package/components/radio/demo/api.min.js +1944 -0
- package/components/radio/demo/index.html +50 -0
- package/components/radio/demo/index.js +8 -0
- package/components/radio/demo/index.md +150 -0
- package/components/radio/demo/index.min.js +1901 -0
- package/components/radio/demo/readme.html +50 -0
- package/components/radio/demo/readme.md +137 -0
- package/components/radio/dist/auro-radio-group.d.ts +194 -0
- package/components/radio/dist/auro-radio.d.ts +144 -0
- package/components/radio/dist/helptextVersion.d.ts +2 -0
- package/components/radio/dist/index.d.ts +3 -0
- package/components/radio/dist/index.js +1850 -0
- package/components/radio/dist/registered.js +1851 -0
- package/components/radio/dist/styles/auro-radio-group-css.d.ts +2 -0
- package/components/radio/dist/styles/color-css.d.ts +2 -0
- package/components/radio/dist/styles/groupColor-css.d.ts +2 -0
- package/components/radio/dist/styles/style-css.d.ts +2 -0
- package/components/radio/dist/styles/tokens-css.d.ts +2 -0
- package/components/select/README.md +144 -0
- package/components/select/demo/api.html +71 -0
- package/components/select/demo/api.js +35 -0
- package/components/select/demo/api.md +1313 -0
- package/components/select/demo/api.min.js +7763 -0
- package/components/select/demo/index.html +66 -0
- package/components/select/demo/index.js +9 -0
- package/components/select/demo/index.md +815 -0
- package/components/select/demo/index.min.js +7651 -0
- package/components/select/demo/readme.html +50 -0
- package/components/select/demo/readme.md +144 -0
- package/components/select/dist/auro-select.d.ts +359 -0
- package/components/select/dist/bibtemplateVersion.d.ts +2 -0
- package/components/select/dist/dropdownVersion.d.ts +2 -0
- package/components/select/dist/index.d.ts +2 -0
- package/components/select/dist/index.js +6300 -0
- package/components/select/dist/registered.js +6300 -0
- package/components/select/dist/styles/style-css.d.ts +2 -0
- package/package.json +217 -0
- package/packages/build-tools/src/postinstall.mjs +12 -0
|
@@ -0,0 +1,1252 @@
|
|
|
1
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../docs/api.md) -->
|
|
2
|
+
<!-- The below content is automatically added from ../docs/api.md -->
|
|
3
|
+
|
|
4
|
+
# auro-input
|
|
5
|
+
|
|
6
|
+
Generate unique names for dependency components.
|
|
7
|
+
|
|
8
|
+
## Attributes
|
|
9
|
+
|
|
10
|
+
| Attribute | Type | Description |
|
|
11
|
+
|--------------|-----------|--------------------------------|
|
|
12
|
+
| [bordered](#bordered) | `Boolean` | Applies bordered UI variant. |
|
|
13
|
+
| [borderless](#borderless) | `Boolean` | Applies borderless UI variant. |
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
| Property | Attribute | Type | Default | Description |
|
|
18
|
+
|-----------------------------------|-----------------------------------|-----------|-------------|--------------------------------------------------|
|
|
19
|
+
| `a11yControls` | `a11yControls` | `string` | | The value for the aria-controls attribute. |
|
|
20
|
+
| `a11yExpanded` | `a11yExpanded` | `boolean` | | The value for the aria-expanded attribute. |
|
|
21
|
+
| `a11yRole` | `a11yRole` | `string` | | The value for the role attribute. |
|
|
22
|
+
| [activeLabel](#activeLabel) | `activeLabel` | `boolean` | false | If set, the label will remain fixed in the active position. |
|
|
23
|
+
| [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]. |
|
|
24
|
+
| [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. |
|
|
25
|
+
| [autocorrect](#autocorrect) | `autocorrect` | `string` | | When set to `off`, stops iOS from auto-correcting words when typed into a text box. |
|
|
26
|
+
| [customValidityTypeEmail](#customValidityTypeEmail) | `customValidityTypeEmail` | `string` | | Custom help text message for email type validity. |
|
|
27
|
+
| [disabled](#disabled) | `disabled` | `boolean` | false | If set, disables the input. |
|
|
28
|
+
| [error](#error) | `error` | `string` | | When defined, sets persistent validity to `customError` and sets `setCustomValidity` = attribute value. |
|
|
29
|
+
| [errorMessage](#errorMessage) | `errorMessage` | `string` | | Contains the help text message for the current validity error. |
|
|
30
|
+
| [format](#format) | `format` | `string` | | Specifies the input mask format. |
|
|
31
|
+
| [icon](#icon) | `icon` | `boolean` | false | If set, will render an icon inside the input to the left of the value. Support is limited to auro-input instances with credit card format. |
|
|
32
|
+
| [id](#id) | `id` | `string` | | The id global attribute defines an identifier (ID) which must be unique in the whole document. |
|
|
33
|
+
| [inputmode](#inputmode) | `inputmode` | `string` | | Exposes inputmode attribute for input. |
|
|
34
|
+
| [lang](#lang) | `lang` | `string` | | Defines the language of an element. |
|
|
35
|
+
| [max](#max) | `max` | `string` | "undefined" | The maximum value allowed. This only applies for inputs with a type of `number` and all date formats. |
|
|
36
|
+
| [maxLength](#maxLength) | `maxLength` | `number` | "undefined" | The maximum number of characters the user can enter into the text input. This must be an integer value `0` or higher. |
|
|
37
|
+
| [min](#min) | `min` | `string` | "undefined" | The minimum value allowed. This only applies for inputs with a type of `number` and all date formats. |
|
|
38
|
+
| [minLength](#minLength) | `minLength` | `number` | "undefined" | 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`. |
|
|
39
|
+
| [name](#name) | `name` | `string` | | Populates the `name` attribute on the input. |
|
|
40
|
+
| [noValidate](#noValidate) | `noValidate` | `boolean` | false | If set, disables auto-validation on blur. |
|
|
41
|
+
| [onDark](#onDark) | `onDark` | `boolean` | false | Sets onDark styles on input. |
|
|
42
|
+
| [pattern](#pattern) | `pattern` | `string` | | Specifies a regular expression the form control's value should match. |
|
|
43
|
+
| [placeholder](#placeholder) | `placeholder` | `string` | | Define custom placeholder text, only supported by date input formats. |
|
|
44
|
+
| [readonly](#readonly) | `readonly` | `boolean` | | Makes the input read-only, but can be set programmatically. |
|
|
45
|
+
| [required](#required) | `required` | `boolean` | false | Populates the `required` attribute on the input. Used for client-side validation. |
|
|
46
|
+
| [setCustomValidity](#setCustomValidity) | `setCustomValidity` | `string` | | Sets a custom help text message to display for all validityStates. |
|
|
47
|
+
| [setCustomValidityBadInput](#setCustomValidityBadInput) | `setCustomValidityBadInput` | `string` | | Custom help text message to display when validity = `badInput`. |
|
|
48
|
+
| [setCustomValidityCustomError](#setCustomValidityCustomError) | `setCustomValidityCustomError` | `string` | | Custom help text message to display when validity = `customError`. |
|
|
49
|
+
| [setCustomValidityForType](#setCustomValidityForType) | `setCustomValidityForType` | `string` | "undefined" | Custom help text message to display for the declared element `type` and type validity fails. |
|
|
50
|
+
| [setCustomValidityRangeOverflow](#setCustomValidityRangeOverflow) | `setCustomValidityRangeOverflow` | `string` | | Custom help text message to display when validity = `rangeOverflow`. |
|
|
51
|
+
| [setCustomValidityRangeUnderflow](#setCustomValidityRangeUnderflow) | `setCustomValidityRangeUnderflow` | `string` | | Custom help text message to display when validity = `rangeUnderflow`. |
|
|
52
|
+
| [setCustomValidityTooLong](#setCustomValidityTooLong) | `setCustomValidityTooLong` | `string` | | Custom help text message to display when validity = `tooLong`. |
|
|
53
|
+
| [setCustomValidityTooShort](#setCustomValidityTooShort) | `setCustomValidityTooShort` | `string` | | Custom help text message to display when validity = `tooShort`. |
|
|
54
|
+
| [setCustomValidityValueMissing](#setCustomValidityValueMissing) | `setCustomValidityValueMissing` | `string` | | Custom help text message to display when validity = `valueMissing`. |
|
|
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` | `string` | | Populates the `type` attribute on the input. Allowed values are `password`, `email`, `credit-card`, `date`, `tel` or `text`. If given value is not allowed or set, defaults to `text`. |
|
|
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. |
|
|
60
|
+
|
|
61
|
+
## Methods
|
|
62
|
+
|
|
63
|
+
| Method | Type | Description |
|
|
64
|
+
|------------|----------------------------------------|--------------------------------------------------|
|
|
65
|
+
| [reset](#reset) | `(): void` | Resets component to initial state. |
|
|
66
|
+
| [validate](#validate) | `(force?: boolean \| undefined): void` | Validates value.<br /><br />**force**: Whether to force validation. |
|
|
67
|
+
|
|
68
|
+
## Events
|
|
69
|
+
|
|
70
|
+
| Event | Type | Description |
|
|
71
|
+
|-----------------------------|--------------------|--------------------------------------------------|
|
|
72
|
+
| `auroFormElement-validated` | | Notifies that the `validity` and `errorMessage` value has changed. |
|
|
73
|
+
| `auroInput-validityChange` | `CustomEvent<any>` | |
|
|
74
|
+
| [input](#input) | | Event fires when the value of an `auro-input` has been changed. |
|
|
75
|
+
|
|
76
|
+
## Slots
|
|
77
|
+
|
|
78
|
+
| Name | Description |
|
|
79
|
+
|------------|-----------------------------------------------|
|
|
80
|
+
| [helptext](#helptext) | Sets the help text displayed below the input. |
|
|
81
|
+
| [label](#label) | Sets the label text for the input. |
|
|
82
|
+
|
|
83
|
+
## CSS Shadow Parts
|
|
84
|
+
|
|
85
|
+
| Part | Description |
|
|
86
|
+
|-----------------|--------------------------------------------------|
|
|
87
|
+
| [accentIcon](#accentIcon) | Use for customizing the style of the accentIcon element (e.g. credit card icon, calendar icon) |
|
|
88
|
+
| [helpText](#helpText) | Use for customizing the style of the helpText element |
|
|
89
|
+
| [iconContainer](#iconContainer) | Use for customizing the style of the iconContainer (e.g. X icon for clearing input value) |
|
|
90
|
+
| [label](#label) | Use for customizing the style of the label element |
|
|
91
|
+
| [wrapper](#wrapper) | Use for customizing the style of the root element |
|
|
92
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
93
|
+
|
|
94
|
+
# API Examples
|
|
95
|
+
|
|
96
|
+
## Localization Support
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
<auro-radio-group required horizontal>
|
|
101
|
+
<span slot="legend">Use the options here to toggle between languages</span>
|
|
102
|
+
<auro-radio id="enButton" name="langDemo" value="en" checked>English</auro-radio>
|
|
103
|
+
<auro-radio id="esButton" name="langDemo" value="es">Spanish</auro-radio>
|
|
104
|
+
</auro-radio-group>
|
|
105
|
+
|
|
106
|
+
## Basic
|
|
107
|
+
|
|
108
|
+
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>`.
|
|
109
|
+
|
|
110
|
+
<div class="exampleWrapper">
|
|
111
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/basic.html) -->
|
|
112
|
+
<!-- The below content is automatically added from ./../apiExamples/basic.html -->
|
|
113
|
+
<auro-input bordered></auro-input>
|
|
114
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
115
|
+
</div>
|
|
116
|
+
<div class="exampleWrapper--ondark" aria-hidden>
|
|
117
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/onDark.html) -->
|
|
118
|
+
<!-- The below content is automatically added from ./../apiExamples/onDark.html -->
|
|
119
|
+
<auro-input onDark bordered></auro-input>
|
|
120
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
121
|
+
</div>
|
|
122
|
+
<auro-accordion alignRight>
|
|
123
|
+
<span slot="trigger">See code</span>
|
|
124
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/basic.html) -->
|
|
125
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/basic.html -->
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<auro-input bordered></auro-input>
|
|
129
|
+
```
|
|
130
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
131
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/onDark.html) -->
|
|
132
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/onDark.html -->
|
|
133
|
+
|
|
134
|
+
```html
|
|
135
|
+
<auro-input onDark bordered></auro-input>
|
|
136
|
+
```
|
|
137
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
138
|
+
</auro-accordion>
|
|
139
|
+
|
|
140
|
+
## Attribute Examples
|
|
141
|
+
|
|
142
|
+
### Disabled <a name="disabled"></a>
|
|
143
|
+
Use the `disable` attribute to prevent the user from interacting with the input.
|
|
144
|
+
|
|
145
|
+
<div class="exampleWrapper">
|
|
146
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/disabled.html) -->
|
|
147
|
+
<!-- The below content is automatically added from ./../apiExamples/disabled.html -->
|
|
148
|
+
<auro-input disabled bordered type="date">
|
|
149
|
+
<span slot="label">Arrival date</span>
|
|
150
|
+
</auro-input>
|
|
151
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
152
|
+
</div>
|
|
153
|
+
<div class="exampleWrapper--ondark" aria-hidden>
|
|
154
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/onDarkDisabled.html) -->
|
|
155
|
+
<!-- The below content is automatically added from ./../apiExamples/onDarkDisabled.html -->
|
|
156
|
+
<auro-input onDark disabled bordered type="date">
|
|
157
|
+
<span slot="label">Arrival date</span>
|
|
158
|
+
</auro-input>
|
|
159
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
160
|
+
</div>
|
|
161
|
+
<auro-accordion alignRight>
|
|
162
|
+
<span slot="trigger">See code</span>
|
|
163
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/disabled.html) -->
|
|
164
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/disabled.html -->
|
|
165
|
+
|
|
166
|
+
```html
|
|
167
|
+
<auro-input disabled bordered type="date">
|
|
168
|
+
<span slot="label">Arrival date</span>
|
|
169
|
+
</auro-input>
|
|
170
|
+
```
|
|
171
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
172
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/onDarkDisabled.html) -->
|
|
173
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/onDarkDisabled.html -->
|
|
174
|
+
|
|
175
|
+
```html
|
|
176
|
+
<auro-input onDark disabled bordered type="date">
|
|
177
|
+
<span slot="label">Arrival date</span>
|
|
178
|
+
</auro-input>
|
|
179
|
+
```
|
|
180
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
181
|
+
</auro-accordion>
|
|
182
|
+
|
|
183
|
+
#### Input Mode
|
|
184
|
+
|
|
185
|
+
Set the input mode for the input.
|
|
186
|
+
|
|
187
|
+
*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.
|
|
188
|
+
|
|
189
|
+
<div class="exampleWrapper">
|
|
190
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/inputmode.html) -->
|
|
191
|
+
<!-- The below content is automatically added from ./../apiExamples/inputmode.html -->
|
|
192
|
+
<auro-input bordered inputmode="tel" />
|
|
193
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
194
|
+
</div>
|
|
195
|
+
<auro-accordion alignRight>
|
|
196
|
+
<span slot="trigger">See code</span>
|
|
197
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/inputmode.html) -->
|
|
198
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/inputmode.html -->
|
|
199
|
+
|
|
200
|
+
```html
|
|
201
|
+
<auro-input bordered inputmode="tel" />
|
|
202
|
+
```
|
|
203
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
204
|
+
</auro-accordion>
|
|
205
|
+
|
|
206
|
+
### Placeholder <a name="placeholder"></a>
|
|
207
|
+
Use the `placeholder` attribute to add a custom placeholder message within the element.
|
|
208
|
+
|
|
209
|
+
<div class="exampleWrapper">
|
|
210
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/placeholder.html) -->
|
|
211
|
+
<!-- The below content is automatically added from ../apiExamples/placeholder.html -->
|
|
212
|
+
<auro-input placeholder="John Doe" bordered required>
|
|
213
|
+
<span slot="label">Full name</span>
|
|
214
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
215
|
+
</auro-input>
|
|
216
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
217
|
+
</div>
|
|
218
|
+
<auro-accordion alignRight>
|
|
219
|
+
<span slot="trigger">See code</span>
|
|
220
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/placeholder.html) -->
|
|
221
|
+
<!-- The below code snippet is automatically added from ../apiExamples/placeholder.html -->
|
|
222
|
+
|
|
223
|
+
```html
|
|
224
|
+
<auro-input placeholder="John Doe" bordered required>
|
|
225
|
+
<span slot="label">Full name</span>
|
|
226
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
227
|
+
</auro-input>
|
|
228
|
+
```
|
|
229
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
230
|
+
</auro-accordion>
|
|
231
|
+
|
|
232
|
+
### Value <a name="value"></a>
|
|
233
|
+
Use the `value` attribute to programmatically set the value of the input.
|
|
234
|
+
|
|
235
|
+
<div class="exampleWrapper">
|
|
236
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/programmaticValue.html) -->
|
|
237
|
+
<!-- The below content is automatically added from ../apiExamples/programmaticValue.html -->
|
|
238
|
+
<auro-input value="Alaska Airlines is the best!" bordered>
|
|
239
|
+
<span slot="label">Name</span>
|
|
240
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
241
|
+
</auro-input>
|
|
242
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
243
|
+
</div>
|
|
244
|
+
<auro-accordion alignRight>
|
|
245
|
+
<span slot="trigger">See code</span>
|
|
246
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/programmaticValue.html) -->
|
|
247
|
+
<!-- The below code snippet is automatically added from ../apiExamples/programmaticValue.html -->
|
|
248
|
+
|
|
249
|
+
```html
|
|
250
|
+
<auro-input value="Alaska Airlines is the best!" bordered>
|
|
251
|
+
<span slot="label">Name</span>
|
|
252
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
253
|
+
</auro-input>
|
|
254
|
+
```
|
|
255
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
256
|
+
</auro-accordion>
|
|
257
|
+
|
|
258
|
+
#### Dynamically Set Value
|
|
259
|
+
|
|
260
|
+
Use the `value` and other components to dynamically set the value of the input.
|
|
261
|
+
|
|
262
|
+
Note: Setting the `value` to `undefined` will also reset the element.
|
|
263
|
+
|
|
264
|
+
<div class="exampleWrapper">
|
|
265
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/value.html) -->
|
|
266
|
+
<!-- The below content is automatically added from ../apiExamples/value.html -->
|
|
267
|
+
<auro-button id="setValidValueBtn">Set Value to Alaska</auro-button>
|
|
268
|
+
<auro-button id="setUndefinedValueBtn">Set Value to Undefined</auro-button>
|
|
269
|
+
<br /><br />
|
|
270
|
+
<auro-input id="setProgrammaticValueExample" value="Press one of the buttons above!" bordered>
|
|
271
|
+
<span slot="label">Name</span>
|
|
272
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
273
|
+
</auro-input>
|
|
274
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
275
|
+
</div>
|
|
276
|
+
<auro-accordion alignRight>
|
|
277
|
+
<span slot="trigger">See code</span>
|
|
278
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/value.html) -->
|
|
279
|
+
<!-- The below code snippet is automatically added from ../apiExamples/value.html -->
|
|
280
|
+
|
|
281
|
+
```html
|
|
282
|
+
<auro-button id="setValidValueBtn">Set Value to Alaska</auro-button>
|
|
283
|
+
<auro-button id="setUndefinedValueBtn">Set Value to Undefined</auro-button>
|
|
284
|
+
<br /><br />
|
|
285
|
+
<auro-input id="setProgrammaticValueExample" value="Press one of the buttons above!" bordered>
|
|
286
|
+
<span slot="label">Name</span>
|
|
287
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
288
|
+
</auro-input>
|
|
289
|
+
```
|
|
290
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
291
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/value.js) -->
|
|
292
|
+
<!-- The below code snippet is automatically added from ../apiExamples/value.js -->
|
|
293
|
+
|
|
294
|
+
```js
|
|
295
|
+
export function programmaticallySetValue() {
|
|
296
|
+
const elem = document.querySelector('#setProgrammaticValueExample');
|
|
297
|
+
|
|
298
|
+
// set value of auro-input element
|
|
299
|
+
document.querySelector('#setValidValueBtn').addEventListener('click', () => {
|
|
300
|
+
elem.value = "Alaska Airlines is the best";
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// reset the value of auro-input element
|
|
304
|
+
document.querySelector('#setUndefinedValueBtn').addEventListener('click', () => {
|
|
305
|
+
elem.value = undefined;
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
310
|
+
</auro-accordion>
|
|
311
|
+
|
|
312
|
+
### Max <a name="max"></a>
|
|
313
|
+
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.
|
|
314
|
+
|
|
315
|
+
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.
|
|
316
|
+
|
|
317
|
+
#### Date Example
|
|
318
|
+
|
|
319
|
+
<div class="exampleWrapper">
|
|
320
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/maxDate.html) -->
|
|
321
|
+
<!-- The below content is automatically added from ../apiExamples/maxDate.html -->
|
|
322
|
+
<auro-input type="date" max="03/25/2023" setCustomValidityRangeOverflow="The selected date is past the defined maximum date." bordered>
|
|
323
|
+
<span slot="label">Choose a date</span>
|
|
324
|
+
</auro-input>
|
|
325
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
326
|
+
</div>
|
|
327
|
+
<auro-accordion alignRight>
|
|
328
|
+
<span slot="trigger">See code</span>
|
|
329
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/maxDate.html) -->
|
|
330
|
+
<!-- The below code snippet is automatically added from ../apiExamples/maxDate.html -->
|
|
331
|
+
|
|
332
|
+
```html
|
|
333
|
+
<auro-input type="date" max="03/25/2023" setCustomValidityRangeOverflow="The selected date is past the defined maximum date." bordered>
|
|
334
|
+
<span slot="label">Choose a date</span>
|
|
335
|
+
</auro-input>
|
|
336
|
+
```
|
|
337
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
338
|
+
</auro-accordion>
|
|
339
|
+
|
|
340
|
+
#### Number Example
|
|
341
|
+
|
|
342
|
+
<div class="exampleWrapper">
|
|
343
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/maxNumber.html) -->
|
|
344
|
+
<!-- The below content is automatically added from ../apiExamples/maxNumber.html -->
|
|
345
|
+
<auro-input type="number" max="10" setCustomValidityRangeOverflow="The selected value is above the defined maximum." bordered>
|
|
346
|
+
<span slot="label">Choose a number</span>
|
|
347
|
+
</auro-input>
|
|
348
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
349
|
+
</div>
|
|
350
|
+
<auro-accordion alignRight>
|
|
351
|
+
<span slot="trigger">See code</span>
|
|
352
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/maxNumber.html) -->
|
|
353
|
+
<!-- The below code snippet is automatically added from ../apiExamples/maxNumber.html -->
|
|
354
|
+
|
|
355
|
+
```html
|
|
356
|
+
<auro-input type="number" max="10" setCustomValidityRangeOverflow="The selected value is above the defined maximum." bordered>
|
|
357
|
+
<span slot="label">Choose a number</span>
|
|
358
|
+
</auro-input>
|
|
359
|
+
```
|
|
360
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
361
|
+
</auro-accordion>
|
|
362
|
+
|
|
363
|
+
### Min <a name="min"></a>
|
|
364
|
+
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.
|
|
365
|
+
|
|
366
|
+
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.
|
|
367
|
+
|
|
368
|
+
#### Date Example
|
|
369
|
+
|
|
370
|
+
<div class="exampleWrapper">
|
|
371
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/minDate.html) -->
|
|
372
|
+
<!-- The below content is automatically added from ../apiExamples/minDate.html -->
|
|
373
|
+
<auro-input type="date" min="03/25/2023" setCustomValidityRangeUnderflow="The selected date is before the defined minimum date." bordered>
|
|
374
|
+
<span slot="label">Choose a date</span>
|
|
375
|
+
</auro-input>
|
|
376
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
377
|
+
</div>
|
|
378
|
+
<auro-accordion alignRight>
|
|
379
|
+
<span slot="trigger">See code</span>
|
|
380
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/minDate.html) -->
|
|
381
|
+
<!-- The below code snippet is automatically added from ../apiExamples/minDate.html -->
|
|
382
|
+
|
|
383
|
+
```html
|
|
384
|
+
<auro-input type="date" min="03/25/2023" setCustomValidityRangeUnderflow="The selected date is before the defined minimum date." bordered>
|
|
385
|
+
<span slot="label">Choose a date</span>
|
|
386
|
+
</auro-input>
|
|
387
|
+
```
|
|
388
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
389
|
+
</auro-accordion>
|
|
390
|
+
|
|
391
|
+
#### Number Example
|
|
392
|
+
|
|
393
|
+
<div class="exampleWrapper">
|
|
394
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/minNumber.html) -->
|
|
395
|
+
<!-- The below content is automatically added from ../apiExamples/minNumber.html -->
|
|
396
|
+
<auro-input type="number" min="10" setCustomValidityRangeUnderflow="The selected value is below the defined minimum." bordered>
|
|
397
|
+
<span slot="label">Choose a number</span>
|
|
398
|
+
</auro-input>
|
|
399
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
400
|
+
</div>
|
|
401
|
+
<auro-accordion alignRight>
|
|
402
|
+
<span slot="trigger">See code</span>
|
|
403
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/minNumber.html) -->
|
|
404
|
+
<!-- The below code snippet is automatically added from ../apiExamples/minNumber.html -->
|
|
405
|
+
|
|
406
|
+
```html
|
|
407
|
+
<auro-input type="number" min="10" setCustomValidityRangeUnderflow="The selected value is below the defined minimum." bordered>
|
|
408
|
+
<span slot="label">Choose a number</span>
|
|
409
|
+
</auro-input>
|
|
410
|
+
```
|
|
411
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
412
|
+
</auro-accordion>
|
|
413
|
+
|
|
414
|
+
### Max Length <a name="maxLength"></a>
|
|
415
|
+
Use the `maxlength` attribute to control the length of the input entered.
|
|
416
|
+
|
|
417
|
+
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.
|
|
418
|
+
|
|
419
|
+
<div class="exampleWrapper">
|
|
420
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/maxLength.html) -->
|
|
421
|
+
<!-- The below content is automatically added from ../apiExamples/maxLength.html -->
|
|
422
|
+
<auro-input maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered." bordered required>
|
|
423
|
+
<span slot="label">Voucher Code</span>
|
|
424
|
+
<span slot="helptext">Please enter your 12 character voucher code.</span>
|
|
425
|
+
</auro-input>
|
|
426
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
427
|
+
</div>
|
|
428
|
+
<auro-accordion alignRight>
|
|
429
|
+
<span slot="trigger">See code</span>
|
|
430
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/maxLength.html) -->
|
|
431
|
+
<!-- The below code snippet is automatically added from ../apiExamples/maxLength.html -->
|
|
432
|
+
|
|
433
|
+
```html
|
|
434
|
+
<auro-input maxlength="12" setCustomValidityTooLong="Oops! There were too many characters entered." bordered required>
|
|
435
|
+
<span slot="label">Voucher Code</span>
|
|
436
|
+
<span slot="helptext">Please enter your 12 character voucher code.</span>
|
|
437
|
+
</auro-input>
|
|
438
|
+
```
|
|
439
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
440
|
+
</auro-accordion>
|
|
441
|
+
|
|
442
|
+
### Min Length <a name="minLength"></a>
|
|
443
|
+
Use the `minlength` attribute to control the length of the input entered.
|
|
444
|
+
|
|
445
|
+
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.
|
|
446
|
+
|
|
447
|
+
<div class="exampleWrapper">
|
|
448
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/minLength.html) -->
|
|
449
|
+
<!-- The below content is automatically added from ../apiExamples/minLength.html -->
|
|
450
|
+
<auro-input minlength="4" setCustomValidityTooShort="Please enter a full voucher code." bordered required>
|
|
451
|
+
<span slot="label">Voucher Code</span>
|
|
452
|
+
<span slot="helptext">Please enter your 4 character voucher code.</span>
|
|
453
|
+
</auro-input>
|
|
454
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
455
|
+
</div>
|
|
456
|
+
<auro-accordion alignRight>
|
|
457
|
+
<span slot="trigger">See code</span>
|
|
458
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/minLength.html) -->
|
|
459
|
+
<!-- The below code snippet is automatically added from ../apiExamples/minLength.html -->
|
|
460
|
+
|
|
461
|
+
```html
|
|
462
|
+
<auro-input minlength="4" setCustomValidityTooShort="Please enter a full voucher code." bordered required>
|
|
463
|
+
<span slot="label">Voucher Code</span>
|
|
464
|
+
<span slot="helptext">Please enter your 4 character voucher code.</span>
|
|
465
|
+
</auro-input>
|
|
466
|
+
```
|
|
467
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
468
|
+
</auro-accordion>
|
|
469
|
+
|
|
470
|
+
### Pattern <a name="pattern"></a>
|
|
471
|
+
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.
|
|
472
|
+
|
|
473
|
+
The `<auro-input>` component supports setting a custom validity message specific to the pattern validation by using the `setCustomValidityPatternMismatch` attribute.
|
|
474
|
+
|
|
475
|
+
<div class="exampleWrapper">
|
|
476
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/pattern.html) -->
|
|
477
|
+
<!-- The below content is automatically added from ../apiExamples/pattern.html -->
|
|
478
|
+
<auro-input pattern="[a-z]{1,15}" spellcheck="false" setCustomValidityPatternMismatch="Only contain lowercase letters w/no spaces" bordered>
|
|
479
|
+
<span slot="label">Username</span>
|
|
480
|
+
<span slot="helptext">Please enter a username.</span>
|
|
481
|
+
</auro-input>
|
|
482
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
483
|
+
</div>
|
|
484
|
+
<auro-accordion alignRight>
|
|
485
|
+
<span slot="trigger">See code</span>
|
|
486
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/pattern.html) -->
|
|
487
|
+
<!-- The below code snippet is automatically added from ../apiExamples/pattern.html -->
|
|
488
|
+
|
|
489
|
+
```html
|
|
490
|
+
<auro-input pattern="[a-z]{1,15}" spellcheck="false" setCustomValidityPatternMismatch="Only contain lowercase letters w/no spaces" bordered>
|
|
491
|
+
<span slot="label">Username</span>
|
|
492
|
+
<span slot="helptext">Please enter a username.</span>
|
|
493
|
+
</auro-input>
|
|
494
|
+
```
|
|
495
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
496
|
+
</auro-accordion>
|
|
497
|
+
|
|
498
|
+
### Readonly <a name="readonly"></a>
|
|
499
|
+
Use the `readonly` attribute to prevent the user from editing the value of the input.
|
|
500
|
+
|
|
501
|
+
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.
|
|
502
|
+
|
|
503
|
+
<div class="exampleWrapper">
|
|
504
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/readonly.html) -->
|
|
505
|
+
<!-- The below content is automatically added from ../apiExamples/readonly.html -->
|
|
506
|
+
<auro-button id="setReadonlyValueBtn">Set Value to Auro Alaska</auro-button>
|
|
507
|
+
<auro-button id="resetReadonlyValueBtn">Reset</auro-button>
|
|
508
|
+
<br /><br />
|
|
509
|
+
<auro-input readonly bordered id="readonlyExample">
|
|
510
|
+
<span slot="label">Name</span>
|
|
511
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
512
|
+
</auro-input>
|
|
513
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
514
|
+
</div>
|
|
515
|
+
<auro-accordion alignRight>
|
|
516
|
+
<span slot="trigger">See code</span>
|
|
517
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/readonly.html) -->
|
|
518
|
+
<!-- The below code snippet is automatically added from ../apiExamples/readonly.html -->
|
|
519
|
+
|
|
520
|
+
```html
|
|
521
|
+
<auro-button id="setReadonlyValueBtn">Set Value to Auro Alaska</auro-button>
|
|
522
|
+
<auro-button id="resetReadonlyValueBtn">Reset</auro-button>
|
|
523
|
+
<br /><br />
|
|
524
|
+
<auro-input readonly bordered id="readonlyExample">
|
|
525
|
+
<span slot="label">Name</span>
|
|
526
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
527
|
+
</auro-input>
|
|
528
|
+
```
|
|
529
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
530
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/readonly.js) -->
|
|
531
|
+
<!-- The below code snippet is automatically added from ../apiExamples/readonly.js -->
|
|
532
|
+
|
|
533
|
+
```js
|
|
534
|
+
export function setReadonlyValue() {
|
|
535
|
+
const elem = document.querySelector('#readonlyExample');
|
|
536
|
+
|
|
537
|
+
// set value of auro-input element
|
|
538
|
+
document.querySelector('#setReadonlyValueBtn').addEventListener('click', () => {
|
|
539
|
+
elem.value = "Auro Alaska";
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
document.querySelector('#resetReadonlyValueBtn').addEventListener('click', () => {
|
|
543
|
+
elem.value = undefined;
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
```
|
|
547
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
548
|
+
</auro-accordion>
|
|
549
|
+
|
|
550
|
+
### Active Label <a name="activeLabel"></a>
|
|
551
|
+
Example use cases for auro-input support the `activeLabel` attribute. If set, the label will stay fixed in the active position.
|
|
552
|
+
|
|
553
|
+
<div class="exampleWrapper">
|
|
554
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/activeLabel.html) -->
|
|
555
|
+
<!-- The below content is automatically added from ../apiExamples/activeLabel.html -->
|
|
556
|
+
<auro-input activeLabel bordered>
|
|
557
|
+
<span slot="label">Address</span>
|
|
558
|
+
<span slot="helptext">Please enter your home address.</span>
|
|
559
|
+
</auro-input>
|
|
560
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
561
|
+
</div>
|
|
562
|
+
<auro-accordion alignRight>
|
|
563
|
+
<span slot="trigger">See code</span>
|
|
564
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/activeLabel.html) -->
|
|
565
|
+
<!-- The below code snippet is automatically added from ../apiExamples/activeLabel.html -->
|
|
566
|
+
|
|
567
|
+
```html
|
|
568
|
+
<auro-input activeLabel bordered>
|
|
569
|
+
<span slot="label">Address</span>
|
|
570
|
+
<span slot="helptext">Please enter your home address.</span>
|
|
571
|
+
</auro-input>
|
|
572
|
+
```
|
|
573
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
574
|
+
</auro-accordion>
|
|
575
|
+
|
|
576
|
+
### Disable auto-validation <a name="noValidate"></a>
|
|
577
|
+
For use cases where the field is `required`, but live validation is not wanted, use the `noValidate` attribute.
|
|
578
|
+
|
|
579
|
+
<div class="exampleWrapper">
|
|
580
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/noValidate.html) -->
|
|
581
|
+
<!-- The below content is automatically added from ../apiExamples/noValidate.html -->
|
|
582
|
+
<auro-input noValidate required bordered>
|
|
583
|
+
<span slot="label">Address</span>
|
|
584
|
+
<span slot="helptext">Please enter your home address.</span>
|
|
585
|
+
</auro-input>
|
|
586
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
587
|
+
</div>
|
|
588
|
+
<auro-accordion alignRight>
|
|
589
|
+
<span slot="trigger">See code</span>
|
|
590
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/noValidate.html) -->
|
|
591
|
+
<!-- The below code snippet is automatically added from ../apiExamples/noValidate.html -->
|
|
592
|
+
|
|
593
|
+
```html
|
|
594
|
+
<auro-input noValidate required bordered>
|
|
595
|
+
<span slot="label">Address</span>
|
|
596
|
+
<span slot="helptext">Please enter your home address.</span>
|
|
597
|
+
</auro-input>
|
|
598
|
+
```
|
|
599
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
600
|
+
</auro-accordion>
|
|
601
|
+
|
|
602
|
+
### Format <a name="format"></a>
|
|
603
|
+
Use the `format` attribute to set the format of the IMask.
|
|
604
|
+
|
|
605
|
+
Default masking definitions:
|
|
606
|
+
- 0 : number
|
|
607
|
+
- a : letter
|
|
608
|
+
- \* : any character
|
|
609
|
+
|
|
610
|
+
See [IMask](https://imask.js.org/) for more information on how to configure a mask.
|
|
611
|
+
|
|
612
|
+
<div class="exampleWrapper">
|
|
613
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/format.html) -->
|
|
614
|
+
<!-- The below content is automatically added from ../apiExamples/format.html -->
|
|
615
|
+
<auro-input bordered format="47440000"></auro-input>
|
|
616
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
617
|
+
</div>
|
|
618
|
+
<auro-accordion alignRight>
|
|
619
|
+
<span slot="trigger">See code</span>
|
|
620
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/format.html) -->
|
|
621
|
+
<!-- The below code snippet is automatically added from ../apiExamples/format.html -->
|
|
622
|
+
|
|
623
|
+
```html
|
|
624
|
+
<auro-input bordered format="47440000"></auro-input>
|
|
625
|
+
```
|
|
626
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
627
|
+
</auro-accordion>
|
|
628
|
+
|
|
629
|
+
## Error support and HTML5 Validity
|
|
630
|
+
|
|
631
|
+
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).
|
|
632
|
+
|
|
633
|
+
> 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.
|
|
634
|
+
|
|
635
|
+
### Required <a name="required"></a>
|
|
636
|
+
When present, the `required` attribute specifies that an input field must be filled out before submitting the form.
|
|
637
|
+
|
|
638
|
+
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`.
|
|
639
|
+
|
|
640
|
+
<div class="exampleWrapper">
|
|
641
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/required.html) -->
|
|
642
|
+
<!-- The below content is automatically added from ../apiExamples/required.html -->
|
|
643
|
+
<auro-input required bordered placeholder="John Doe">
|
|
644
|
+
<span slot="label">Full name</span>
|
|
645
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
646
|
+
</auro-input>
|
|
647
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
648
|
+
</div>
|
|
649
|
+
<auro-accordion alignRight>
|
|
650
|
+
<span slot="trigger">See code</span>
|
|
651
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/required.html) -->
|
|
652
|
+
<!-- The below code snippet is automatically added from ../apiExamples/required.html -->
|
|
653
|
+
|
|
654
|
+
```html
|
|
655
|
+
<auro-input required bordered placeholder="John Doe">
|
|
656
|
+
<span slot="label">Full name</span>
|
|
657
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
658
|
+
</auro-input>
|
|
659
|
+
```
|
|
660
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
661
|
+
</auro-accordion>
|
|
662
|
+
|
|
663
|
+
### Validation on input <a name="validateOnInput"></a>
|
|
664
|
+
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.
|
|
665
|
+
|
|
666
|
+
<div class="exampleWrapper">
|
|
667
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/validateOnInput.html) -->
|
|
668
|
+
<!-- The below content is automatically added from ../apiExamples/validateOnInput.html -->
|
|
669
|
+
<auro-input validateOnInput bordered required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+" setCustomValidityPatternMismatch="Full name requires two or more names with at least one space.">
|
|
670
|
+
<span slot="label">Full Name</span>
|
|
671
|
+
<span slot="helptext">Please enter your full name as it appears on the card.</span>
|
|
672
|
+
</auro-input>
|
|
673
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
674
|
+
</div>
|
|
675
|
+
<auro-accordion alignRight>
|
|
676
|
+
<span slot="trigger">See code</span>
|
|
677
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/validateOnInput.html) -->
|
|
678
|
+
<!-- The below code snippet is automatically added from ../apiExamples/validateOnInput.html -->
|
|
679
|
+
|
|
680
|
+
```html
|
|
681
|
+
<auro-input validateOnInput bordered required pattern="[a-zA-Z-.']+( +[a-zA-Z-.']+)+" setCustomValidityPatternMismatch="Full name requires two or more names with at least one space.">
|
|
682
|
+
<span slot="label">Full Name</span>
|
|
683
|
+
<span slot="helptext">Please enter your full name as it appears on the card.</span>
|
|
684
|
+
</auro-input>
|
|
685
|
+
```
|
|
686
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
687
|
+
</auro-accordion>
|
|
688
|
+
|
|
689
|
+
### setCustomValidity <a name="setCustomValidity"></a>
|
|
690
|
+
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.
|
|
691
|
+
|
|
692
|
+
**NOTE:** Custom strings are NOT localized. It is the responsibility of the element consumer to provide localized strings when using this element property.
|
|
693
|
+
|
|
694
|
+
<div class="exampleWrapper">
|
|
695
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/setCustomValidity.html) -->
|
|
696
|
+
<!-- The below content is automatically added from ../apiExamples/setCustomValidity.html -->
|
|
697
|
+
<auro-input bordered required minlength="3" setCustomValidity="Sorry, please enter your first and last name (one space required).">
|
|
698
|
+
<span slot="label">Full Name</span>
|
|
699
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
700
|
+
</auro-input>
|
|
701
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
702
|
+
</div>
|
|
703
|
+
<auro-accordion alignRight>
|
|
704
|
+
<span slot="trigger">See code</span>
|
|
705
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/setCustomValidity.html) -->
|
|
706
|
+
<!-- The below code snippet is automatically added from ../apiExamples/setCustomValidity.html -->
|
|
707
|
+
|
|
708
|
+
```html
|
|
709
|
+
<auro-input bordered required minlength="3" setCustomValidity="Sorry, please enter your first and last name (one space required).">
|
|
710
|
+
<span slot="label">Full Name</span>
|
|
711
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
712
|
+
</auro-input>
|
|
713
|
+
```
|
|
714
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
715
|
+
</auro-accordion>
|
|
716
|
+
|
|
717
|
+
### Error <a name="error"></a>
|
|
718
|
+
Use the `error` attribute to apply a persistent custom error that supersedes the HTML5 validation logic.
|
|
719
|
+
|
|
720
|
+
A custom error message can be set using the `error` attribute, or it can be used in conjuction with the `setCustomValidityCustomError` attribute.
|
|
721
|
+
|
|
722
|
+
<div class="exampleWrapper">
|
|
723
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/error.html) -->
|
|
724
|
+
<!-- The below content is automatically added from ../apiExamples/error.html -->
|
|
725
|
+
<auro-button id="setCustomErrorBtn">Set Custom Error</auro-button>
|
|
726
|
+
<auro-button id="setCustomErrorClearBtn">Clear Custom Error</auro-button>
|
|
727
|
+
<br /><br />
|
|
728
|
+
<auro-input id="setCustomErrorExample" error="Initial error attribute value" bordered>
|
|
729
|
+
<span slot="label">Name</span>
|
|
730
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
731
|
+
</auro-input>
|
|
732
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
733
|
+
</div>
|
|
734
|
+
<auro-accordion alignRight>
|
|
735
|
+
<span slot="trigger">See code</span>
|
|
736
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/error.html) -->
|
|
737
|
+
<!-- The below code snippet is automatically added from ../apiExamples/error.html -->
|
|
738
|
+
|
|
739
|
+
```html
|
|
740
|
+
<auro-button id="setCustomErrorBtn">Set Custom Error</auro-button>
|
|
741
|
+
<auro-button id="setCustomErrorClearBtn">Clear Custom Error</auro-button>
|
|
742
|
+
<br /><br />
|
|
743
|
+
<auro-input id="setCustomErrorExample" error="Initial error attribute value" bordered>
|
|
744
|
+
<span slot="label">Name</span>
|
|
745
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
746
|
+
</auro-input>
|
|
747
|
+
```
|
|
748
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
749
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/error.js) -->
|
|
750
|
+
<!-- The below code snippet is automatically added from ../apiExamples/error.js -->
|
|
751
|
+
|
|
752
|
+
```js
|
|
753
|
+
export function customError() {
|
|
754
|
+
const elem = document.querySelector('#setCustomErrorExample');
|
|
755
|
+
// set custom error
|
|
756
|
+
document.querySelector('#setCustomErrorBtn').addEventListener('click', () => {
|
|
757
|
+
elem.error = "Custom Error Message";
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
// remove custom error
|
|
761
|
+
document.querySelector('#setCustomErrorClearBtn').addEventListener('click', () => {
|
|
762
|
+
elem.removeAttribute('error');
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
```
|
|
766
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
767
|
+
</auro-accordion>
|
|
768
|
+
|
|
769
|
+
#### onDark Variation
|
|
770
|
+
|
|
771
|
+
<div class="exampleWrapper--ondark" aria-hidden>
|
|
772
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/onDarkError.html) -->
|
|
773
|
+
<!-- The below content is automatically added from ../apiExamples/onDarkError.html -->
|
|
774
|
+
<auro-button onDark id="setCustomErrorBtnOnDark">Set Custom Error</auro-button>
|
|
775
|
+
<auro-button onDark id="setCustomErrorClearBtnOnDark">Clear Custom Error</auro-button>
|
|
776
|
+
<br /><br />
|
|
777
|
+
<auro-input onDark id="setCustomErrorExampleOnDark" error="Initial error attribute value" bordered>
|
|
778
|
+
<span slot="label">Name</span>
|
|
779
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
780
|
+
</auro-input>
|
|
781
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
782
|
+
</div>
|
|
783
|
+
<auro-accordion alignRight>
|
|
784
|
+
<span slot="trigger">See code</span>
|
|
785
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/onDarkError.html) -->
|
|
786
|
+
<!-- The below code snippet is automatically added from ../apiExamples/onDarkError.html -->
|
|
787
|
+
|
|
788
|
+
```html
|
|
789
|
+
<auro-button onDark id="setCustomErrorBtnOnDark">Set Custom Error</auro-button>
|
|
790
|
+
<auro-button onDark id="setCustomErrorClearBtnOnDark">Clear Custom Error</auro-button>
|
|
791
|
+
<br /><br />
|
|
792
|
+
<auro-input onDark id="setCustomErrorExampleOnDark" error="Initial error attribute value" bordered>
|
|
793
|
+
<span slot="label">Name</span>
|
|
794
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
795
|
+
</auro-input>
|
|
796
|
+
```
|
|
797
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
798
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/onDarkError.js) -->
|
|
799
|
+
<!-- The below code snippet is automatically added from ../apiExamples/onDarkError.js -->
|
|
800
|
+
|
|
801
|
+
```js
|
|
802
|
+
export function customErrorOnDark() {
|
|
803
|
+
const elem = document.querySelector('#setCustomErrorExampleOnDark');
|
|
804
|
+
// set custom error
|
|
805
|
+
document.querySelector('#setCustomErrorBtnOnDark').addEventListener('click', () => {
|
|
806
|
+
elem.error = "Custom Error Message";
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
// remove custom error
|
|
810
|
+
document.querySelector('#setCustomErrorClearBtnOnDark').addEventListener('click', () => {
|
|
811
|
+
elem.removeAttribute('error');
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
```
|
|
815
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
816
|
+
</auro-accordion>
|
|
817
|
+
|
|
818
|
+
## Types
|
|
819
|
+
|
|
820
|
+
### Password
|
|
821
|
+
|
|
822
|
+
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.
|
|
823
|
+
|
|
824
|
+
Default help text will be added to the input `type="password"` if custom help text is not provided. See the example below.
|
|
825
|
+
|
|
826
|
+
<div class="exampleWrapper">
|
|
827
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/password.html) -->
|
|
828
|
+
<!-- The below content is automatically added from ../apiExamples/password.html -->
|
|
829
|
+
<auro-input type="password" required bordered>
|
|
830
|
+
<span slot="label">Password</span>
|
|
831
|
+
<span slot="helptext">Please enter a secure password.</span>
|
|
832
|
+
</auro-input>
|
|
833
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
834
|
+
</div>
|
|
835
|
+
<div class="exampleWrapper--ondark" aria-hidden>
|
|
836
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/onDarkPassword.html) -->
|
|
837
|
+
<!-- The below content is automatically added from ../apiExamples/onDarkPassword.html -->
|
|
838
|
+
<auro-input onDark type="password" required bordered>
|
|
839
|
+
<span slot="label">Password</span>
|
|
840
|
+
<span slot="helptext">Please enter a secure password.</span>
|
|
841
|
+
</auro-input>
|
|
842
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
843
|
+
</div>
|
|
844
|
+
<auro-accordion alignRight>
|
|
845
|
+
<span slot="trigger">See code</span>
|
|
846
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/onDarkPassword.html) -->
|
|
847
|
+
<!-- The below code snippet is automatically added from ../apiExamples/onDarkPassword.html -->
|
|
848
|
+
|
|
849
|
+
```html
|
|
850
|
+
<auro-input onDark type="password" required bordered>
|
|
851
|
+
<span slot="label">Password</span>
|
|
852
|
+
<span slot="helptext">Please enter a secure password.</span>
|
|
853
|
+
</auro-input>
|
|
854
|
+
```
|
|
855
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
856
|
+
</auro-accordion>
|
|
857
|
+
|
|
858
|
+
### Email
|
|
859
|
+
|
|
860
|
+
Use the `type="email"` attribute for a email style input. These examples illustrate the default error messaging per that browser. Content may vary.
|
|
861
|
+
|
|
862
|
+
Default help text will be added to the input `type="email"` if custom help text is not provided. See the example below.
|
|
863
|
+
|
|
864
|
+
<div class="exampleWrapper">
|
|
865
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/email.html) -->
|
|
866
|
+
<!-- The below content is automatically added from ../apiExamples/email.html -->
|
|
867
|
+
<auro-input type="email" bordered required>
|
|
868
|
+
<span slot="label">Email address</span>
|
|
869
|
+
<span slot="helptext">Please enter your email address.</span>
|
|
870
|
+
</auro-input>
|
|
871
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
872
|
+
</div>
|
|
873
|
+
<auro-accordion alignRight>
|
|
874
|
+
<span slot="trigger">See code</span>
|
|
875
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/email.html) -->
|
|
876
|
+
<!-- The below code snippet is automatically added from ../apiExamples/email.html -->
|
|
877
|
+
|
|
878
|
+
```html
|
|
879
|
+
<auro-input type="email" bordered required>
|
|
880
|
+
<span slot="label">Email address</span>
|
|
881
|
+
<span slot="helptext">Please enter your email address.</span>
|
|
882
|
+
</auro-input>
|
|
883
|
+
```
|
|
884
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
885
|
+
</auro-accordion>
|
|
886
|
+
|
|
887
|
+
### Number
|
|
888
|
+
|
|
889
|
+
Use the `type="number"` attribute for a numeric style input and invoke a numeric virtual keyboard on handheld devices.
|
|
890
|
+
|
|
891
|
+
This `number` input type should only be used for incremental numeric values, meaning values with decimals will be considered invalid. The `number` input type is not appropriate for values that happen to only consist of but aren't strictly speaking a number, such as postal codes in many countries or credit card numbers. See [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number) for more information.
|
|
892
|
+
|
|
893
|
+
<div class="exampleWrapper">
|
|
894
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/number.html) -->
|
|
895
|
+
<!-- The below content is automatically added from ../apiExamples/number.html -->
|
|
896
|
+
<auro-input type="number" bordered required>
|
|
897
|
+
<span slot="label">Number of Passengers</span>
|
|
898
|
+
<span slot="helptext">Please enter the number of passengers.</span>
|
|
899
|
+
</auro-input>
|
|
900
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
901
|
+
</div>
|
|
902
|
+
<auro-accordion alignRight>
|
|
903
|
+
<span slot="trigger">See code</span>
|
|
904
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/number.html) -->
|
|
905
|
+
<!-- The below code snippet is automatically added from ../apiExamples/number.html -->
|
|
906
|
+
|
|
907
|
+
```html
|
|
908
|
+
<auro-input type="number" bordered required>
|
|
909
|
+
<span slot="label">Number of Passengers</span>
|
|
910
|
+
<span slot="helptext">Please enter the number of passengers.</span>
|
|
911
|
+
</auro-input>
|
|
912
|
+
```
|
|
913
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
914
|
+
</auro-accordion>
|
|
915
|
+
|
|
916
|
+
### Credit Card
|
|
917
|
+
|
|
918
|
+
Use the `type="credit-card"` attribute for a credit card formatted input.
|
|
919
|
+
|
|
920
|
+
Default help text will be added to the input `type="credit-card"` if custom help text is not provided. See the example below.
|
|
921
|
+
|
|
922
|
+
<div class="exampleWrapper">
|
|
923
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/creditCard.html) -->
|
|
924
|
+
<!-- The below content is automatically added from ../apiExamples/creditCard.html -->
|
|
925
|
+
<auro-input type="credit-card" bordered required>
|
|
926
|
+
<span slot="label">Card number</span>
|
|
927
|
+
<span slot="helptext">Valid credit card numbers must include 16 digits (15 for Amex).</span>
|
|
928
|
+
</auro-input>
|
|
929
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
930
|
+
</div>
|
|
931
|
+
<auro-accordion alignRight>
|
|
932
|
+
<span slot="trigger">See code</span>
|
|
933
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/creditCard.html) -->
|
|
934
|
+
<!-- The below code snippet is automatically added from ../apiExamples/creditCard.html -->
|
|
935
|
+
|
|
936
|
+
```html
|
|
937
|
+
<auro-input type="credit-card" bordered required>
|
|
938
|
+
<span slot="label">Card number</span>
|
|
939
|
+
<span slot="helptext">Valid credit card numbers must include 16 digits (15 for Amex).</span>
|
|
940
|
+
</auro-input>
|
|
941
|
+
```
|
|
942
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
943
|
+
</auro-accordion>
|
|
944
|
+
Use the `type="credit-card"` and `icon` attributes for a credit card formatted input with credit card icon support.
|
|
945
|
+
|
|
946
|
+
**Dependency**: Please be sure to also install [auro-icon](https://auro.alaskaair.com/components/auro/icon/install) as a peer dependency.
|
|
947
|
+
|
|
948
|
+
<div class="exampleWrapper">
|
|
949
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/creditCardIcon.html) -->
|
|
950
|
+
<!-- The below content is automatically added from ../apiExamples/creditCardIcon.html -->
|
|
951
|
+
<auro-input icon type="credit-card" bordered required>
|
|
952
|
+
<span slot="label">Card number</span>
|
|
953
|
+
<span slot="helptext">Valid credit card numbers must include 16 digits (15 for Amex).</span>
|
|
954
|
+
</auro-input>
|
|
955
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
956
|
+
</div>
|
|
957
|
+
<auro-accordion alignRight>
|
|
958
|
+
<span slot="trigger">See code</span>
|
|
959
|
+
// Use 4147 3411 1111 1111 to see the Alaska Airline's credit card!
|
|
960
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/creditCardIcon.html) -->
|
|
961
|
+
<!-- The below code snippet is automatically added from ../apiExamples/creditCardIcon.html -->
|
|
962
|
+
|
|
963
|
+
```html
|
|
964
|
+
<auro-input icon type="credit-card" bordered required>
|
|
965
|
+
<span slot="label">Card number</span>
|
|
966
|
+
<span slot="helptext">Valid credit card numbers must include 16 digits (15 for Amex).</span>
|
|
967
|
+
</auro-input>
|
|
968
|
+
```
|
|
969
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
970
|
+
</auro-accordion>
|
|
971
|
+
|
|
972
|
+
### Phone Number
|
|
973
|
+
|
|
974
|
+
Use the `type="tel"` attribute for a phone number formatted input. The default format is `+1 (000) 000-0000`.
|
|
975
|
+
|
|
976
|
+
<div class="exampleWrapper">
|
|
977
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/tel.html) -->
|
|
978
|
+
<!-- The below content is automatically added from ../apiExamples/tel.html -->
|
|
979
|
+
<auro-input type="tel" bordered></auro-input>
|
|
980
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
981
|
+
</div>
|
|
982
|
+
<auro-accordion alignRight>
|
|
983
|
+
<span slot="trigger">See code</span>
|
|
984
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/tel.html) -->
|
|
985
|
+
<!-- The below code snippet is automatically added from ../apiExamples/tel.html -->
|
|
986
|
+
|
|
987
|
+
```html
|
|
988
|
+
<auro-input type="tel" bordered></auro-input>
|
|
989
|
+
```
|
|
990
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
991
|
+
</auro-accordion>
|
|
992
|
+
|
|
993
|
+
#### Formatting
|
|
994
|
+
|
|
995
|
+
Use the `format` attribute to set a custom phone number format.
|
|
996
|
+
|
|
997
|
+
<div class="exampleWrapper">
|
|
998
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/telFormat.html) -->
|
|
999
|
+
<!-- The below content is automatically added from ../apiExamples/telFormat.html -->
|
|
1000
|
+
<auro-input type="tel" format="+22 999 99 9999" bordered></auro-input>
|
|
1001
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1002
|
+
</div>
|
|
1003
|
+
<auro-accordion alignRight>
|
|
1004
|
+
<span slot="trigger">See code</span>
|
|
1005
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/telFormat.html) -->
|
|
1006
|
+
<!-- The below code snippet is automatically added from ../apiExamples/telFormat.html -->
|
|
1007
|
+
|
|
1008
|
+
```html
|
|
1009
|
+
<auro-input type="tel" format="+22 999 99 9999" bordered></auro-input>
|
|
1010
|
+
```
|
|
1011
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1012
|
+
</auro-accordion>
|
|
1013
|
+
|
|
1014
|
+
### Date
|
|
1015
|
+
|
|
1016
|
+
Use the `type="date"` attribute for a date formatted input. The default date format is `mm/dd/yyyy`.
|
|
1017
|
+
|
|
1018
|
+
<div class="exampleWrapper">
|
|
1019
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/monthDayYear.html) -->
|
|
1020
|
+
<!-- The below content is automatically added from ../apiExamples/monthDayYear.html -->
|
|
1021
|
+
<auro-input type="date" bordered>
|
|
1022
|
+
<span slot="label">Arrival date</span>
|
|
1023
|
+
</auro-input>
|
|
1024
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1025
|
+
</div>
|
|
1026
|
+
<auro-accordion alignRight>
|
|
1027
|
+
<span slot="trigger">See code</span>
|
|
1028
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/monthDayYear.html) -->
|
|
1029
|
+
<!-- The below code snippet is automatically added from ../apiExamples/monthDayYear.html -->
|
|
1030
|
+
|
|
1031
|
+
```html
|
|
1032
|
+
<auro-input type="date" bordered>
|
|
1033
|
+
<span slot="label">Arrival date</span>
|
|
1034
|
+
</auro-input>
|
|
1035
|
+
```
|
|
1036
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1037
|
+
</auro-accordion>
|
|
1038
|
+
|
|
1039
|
+
#### Formatting
|
|
1040
|
+
|
|
1041
|
+
Use the `format` attribute to put together any combination of `mm`, `dd`, & `yyyy` or `yy`.
|
|
1042
|
+
|
|
1043
|
+
<div class="exampleWrapper">
|
|
1044
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/yearMonthDay.html) -->
|
|
1045
|
+
<!-- The below content is automatically added from ../apiExamples/yearMonthDay.html -->
|
|
1046
|
+
<auro-input type="date" format="yyyy/mm/dd" bordered>
|
|
1047
|
+
<span slot="label">Arrival date</span>
|
|
1048
|
+
</auro-input>
|
|
1049
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1050
|
+
</div>
|
|
1051
|
+
<auro-accordion alignRight>
|
|
1052
|
+
<span slot="trigger">See code</span>
|
|
1053
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/yearMonthDay.html) -->
|
|
1054
|
+
<!-- The below code snippet is automatically added from ../apiExamples/yearMonthDay.html -->
|
|
1055
|
+
|
|
1056
|
+
```html
|
|
1057
|
+
<auro-input type="date" format="yyyy/mm/dd" bordered>
|
|
1058
|
+
<span slot="label">Arrival date</span>
|
|
1059
|
+
</auro-input>
|
|
1060
|
+
```
|
|
1061
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1062
|
+
</auro-accordion>
|
|
1063
|
+
<div class="exampleWrapper">
|
|
1064
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/monthYear.html) -->
|
|
1065
|
+
<!-- The below content is automatically added from ../apiExamples/monthYear.html -->
|
|
1066
|
+
<auro-input type="date" format="mm/yy" bordered>
|
|
1067
|
+
<span slot="label">Expiration date</span>
|
|
1068
|
+
</auro-input>
|
|
1069
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1070
|
+
</div>
|
|
1071
|
+
<auro-accordion alignRight>
|
|
1072
|
+
<span slot="trigger">See code</span>
|
|
1073
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/monthYear.html) -->
|
|
1074
|
+
<!-- The below code snippet is automatically added from ../apiExamples/monthYear.html -->
|
|
1075
|
+
|
|
1076
|
+
```html
|
|
1077
|
+
<auro-input type="date" format="mm/yy" bordered>
|
|
1078
|
+
<span slot="label">Expiration date</span>
|
|
1079
|
+
</auro-input>
|
|
1080
|
+
```
|
|
1081
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1082
|
+
</auro-accordion>
|
|
1083
|
+
<div class="exampleWrapper">
|
|
1084
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/day.html) -->
|
|
1085
|
+
<!-- The below content is automatically added from ../apiExamples/day.html -->
|
|
1086
|
+
<auro-input type="date" format="dd" bordered>
|
|
1087
|
+
<span slot="label">Day</span>
|
|
1088
|
+
</auro-input>
|
|
1089
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1090
|
+
</div>
|
|
1091
|
+
<auro-accordion alignRight>
|
|
1092
|
+
<span slot="trigger">See code</span>
|
|
1093
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/day.html) -->
|
|
1094
|
+
<!-- The below code snippet is automatically added from ../apiExamples/day.html -->
|
|
1095
|
+
|
|
1096
|
+
```html
|
|
1097
|
+
<auro-input type="date" format="dd" bordered>
|
|
1098
|
+
<span slot="label">Day</span>
|
|
1099
|
+
</auro-input>
|
|
1100
|
+
```
|
|
1101
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1102
|
+
</auro-accordion>
|
|
1103
|
+
|
|
1104
|
+
## Additional Use Cases
|
|
1105
|
+
|
|
1106
|
+
### Reset State
|
|
1107
|
+
|
|
1108
|
+
Use the `reset()` method to reset the `<auro-input>`'s `value` and `validity` state. Doing so will preserve all other attributes and properties.
|
|
1109
|
+
|
|
1110
|
+
<div class="exampleWrapper">
|
|
1111
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/resetState.html) -->
|
|
1112
|
+
<!-- The below content is automatically added from ../apiExamples/resetState.html -->
|
|
1113
|
+
<auro-button id="resetStateBtn">Reset</auro-button>
|
|
1114
|
+
<br /><br />
|
|
1115
|
+
<auro-input id="resetStateExample" bordered minlength="12" value="Auro Team" setCustomValidityTooShort="Please enter your full name!">
|
|
1116
|
+
<span slot="label">Full 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/resetState.html) -->
|
|
1124
|
+
<!-- The below code snippet is automatically added from ../apiExamples/resetState.html -->
|
|
1125
|
+
|
|
1126
|
+
```html
|
|
1127
|
+
<auro-button id="resetStateBtn">Reset</auro-button>
|
|
1128
|
+
<br /><br />
|
|
1129
|
+
<auro-input id="resetStateExample" bordered minlength="12" value="Auro Team" setCustomValidityTooShort="Please enter your full name!">
|
|
1130
|
+
<span slot="label">Full Name</span>
|
|
1131
|
+
<span slot="helptext">Please enter your full name.</span>
|
|
1132
|
+
</auro-input>
|
|
1133
|
+
```
|
|
1134
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1135
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/resetState.js) -->
|
|
1136
|
+
<!-- The below code snippet is automatically added from ../apiExamples/resetState.js -->
|
|
1137
|
+
|
|
1138
|
+
```js
|
|
1139
|
+
export function resetStateExample() {
|
|
1140
|
+
const elem = document.querySelector('#resetStateExample');
|
|
1141
|
+
|
|
1142
|
+
document.querySelector('#resetStateBtn').addEventListener('click', () => {
|
|
1143
|
+
elem.reset();
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
```
|
|
1147
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1148
|
+
</auro-accordion>
|
|
1149
|
+
|
|
1150
|
+
### Swapping Values Between Inputs
|
|
1151
|
+
|
|
1152
|
+
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.
|
|
1153
|
+
|
|
1154
|
+
<div class="exampleWrapper">
|
|
1155
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/swapValue.html) -->
|
|
1156
|
+
<!-- The below content is automatically added from ../apiExamples/swapValue.html -->
|
|
1157
|
+
<auro-input id="swapExampleLeft" bordered>
|
|
1158
|
+
<span slot="label">Left Input</span>
|
|
1159
|
+
</auro-input>
|
|
1160
|
+
<auro-button id="swapExampleBtn">Swap Values</auro-button>
|
|
1161
|
+
<auro-input id="swapExampleRight" bordered>
|
|
1162
|
+
<span slot="label">Right Input</span>
|
|
1163
|
+
</auro-input>
|
|
1164
|
+
<style>
|
|
1165
|
+
#swapExampleWrapper {
|
|
1166
|
+
align-items: center;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
#swapExampleLeft,
|
|
1170
|
+
#swapExampleRight {
|
|
1171
|
+
flex: 1;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
#swapExampleBtn {
|
|
1175
|
+
width: unset;
|
|
1176
|
+
margin: 0 var(--auro-size-xs);
|
|
1177
|
+
}
|
|
1178
|
+
</style>
|
|
1179
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1180
|
+
</div>
|
|
1181
|
+
<auro-accordion alignRight>
|
|
1182
|
+
<span slot="trigger">See code</span>
|
|
1183
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/swapValue.html) -->
|
|
1184
|
+
<!-- The below code snippet is automatically added from ../apiExamples/swapValue.html -->
|
|
1185
|
+
|
|
1186
|
+
```html
|
|
1187
|
+
<auro-input id="swapExampleLeft" bordered>
|
|
1188
|
+
<span slot="label">Left Input</span>
|
|
1189
|
+
</auro-input>
|
|
1190
|
+
<auro-button id="swapExampleBtn">Swap Values</auro-button>
|
|
1191
|
+
<auro-input id="swapExampleRight" bordered>
|
|
1192
|
+
<span slot="label">Right Input</span>
|
|
1193
|
+
</auro-input>
|
|
1194
|
+
<style>
|
|
1195
|
+
#swapExampleWrapper {
|
|
1196
|
+
align-items: center;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
#swapExampleLeft,
|
|
1200
|
+
#swapExampleRight {
|
|
1201
|
+
flex: 1;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
#swapExampleBtn {
|
|
1205
|
+
width: unset;
|
|
1206
|
+
margin: 0 var(--auro-size-xs);
|
|
1207
|
+
}
|
|
1208
|
+
</style>
|
|
1209
|
+
```
|
|
1210
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1211
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/swapValue.js) -->
|
|
1212
|
+
<!-- The below code snippet is automatically added from ../apiExamples/swapValue.js -->
|
|
1213
|
+
|
|
1214
|
+
```js
|
|
1215
|
+
export function swapInputValues() {
|
|
1216
|
+
const btn = document.querySelector('#swapExampleBtn');
|
|
1217
|
+
const inputOne = document.querySelector('#swapExampleLeft');
|
|
1218
|
+
const inputTwo = document.querySelector('#swapExampleRight');
|
|
1219
|
+
|
|
1220
|
+
btn.addEventListener('click', () => {
|
|
1221
|
+
const valueOne = inputOne.value;
|
|
1222
|
+
const valueTwo = inputTwo.value;
|
|
1223
|
+
|
|
1224
|
+
inputOne.value = valueTwo;
|
|
1225
|
+
inputTwo.value = valueOne;
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
```
|
|
1229
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
1230
|
+
</auro-accordion>
|
|
1231
|
+
|
|
1232
|
+
## Theme Support
|
|
1233
|
+
|
|
1234
|
+
The component may be restyled using the following code sample and changing the values of the following token(s).
|
|
1235
|
+
|
|
1236
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../src/styles/tokens.scss) -->
|
|
1237
|
+
<!-- The below code snippet is automatically added from ../src/styles/tokens.scss -->
|
|
1238
|
+
|
|
1239
|
+
```scss
|
|
1240
|
+
@import "@aurodesignsystem/design-tokens/dist/alaska/SCSSVariables--alaska";
|
|
1241
|
+
|
|
1242
|
+
:host {
|
|
1243
|
+
--ds-auro-input-border-color: var(--ds-basic-color-border-bold, #{$ds-basic-color-border-bold});
|
|
1244
|
+
--ds-auro-input-container-color: var(--ds-basic-color-surface-default, #{$ds-basic-color-surface-default});
|
|
1245
|
+
--ds-auro-input-caret-color: var(--ds-advanced-color-state-focused, #{$ds-advanced-color-state-focused});
|
|
1246
|
+
--ds-auro-input-label-text-color: var(--ds-basic-color-texticon-muted, #{$ds-basic-color-texticon-muted});
|
|
1247
|
+
--ds-auro-input-placeholder-text-color: var(--ds-basic-color-texticon-default, #{$ds-basic-color-texticon-default});
|
|
1248
|
+
--ds-auro-input-text-color: var(--ds-basic-color-texticon-default, #{$ds-basic-color-texticon-default});
|
|
1249
|
+
--ds-auro-input-error-icon-color: var(--ds-basic-color-status-error, #{$ds-basic-color-status-error});
|
|
1250
|
+
}
|
|
1251
|
+
```
|
|
1252
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|