@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
|
@@ -17,7 +17,7 @@ It automatically "scrapes" its inner content for any auro form elements, and sur
|
|
|
17
17
|
them (along with events) to the parent form element as a JSON object.
|
|
18
18
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
19
19
|
|
|
20
|
-
## Form
|
|
20
|
+
## Form Value Generation
|
|
21
21
|
|
|
22
22
|
Auro form exists to make a developer's life easier through surfacing all Auro form elements in a given form as a single
|
|
23
23
|
JSON object.
|
|
@@ -32,7 +32,7 @@ The following is required on each Auro form element in a form for it to be colle
|
|
|
32
32
|
That being said, we do _not_ require form elements to be direct children of `auro-form`.
|
|
33
33
|
They can be nested within other elements for styling, such as a `div`, `span` or `fieldset`.
|
|
34
34
|
|
|
35
|
-
### Form
|
|
35
|
+
### Form Data Structure
|
|
36
36
|
|
|
37
37
|
In a correctly registered scenario, `auro-form`
|
|
38
38
|
will automatically recognize the auro form elements and collect data from each on the form's `value` key as a JSON object.
|
|
@@ -68,7 +68,7 @@ interface AuroFormState {
|
|
|
68
68
|
}
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
## Accessing
|
|
71
|
+
## Accessing Form Data
|
|
72
72
|
|
|
73
73
|
As Auro components are designed to be framework-agnostic, data can be retrieved using simple vanilla JavaScript patterns.
|
|
74
74
|
If you have ever worked with a standard HTML5 form, you are already equipped to work with Auro forms!
|
|
@@ -76,11 +76,11 @@ If you have ever worked with a standard HTML5 form, you are already equipped to
|
|
|
76
76
|
Once you have a reference to the form element (React ref, querySelector, etc.),
|
|
77
77
|
you can access the form data using the following methods:
|
|
78
78
|
|
|
79
|
-
**Data
|
|
79
|
+
**Data Keys + Get Methods**:
|
|
80
80
|
- `.value` - Getter which returns the current form data as a JSON object.
|
|
81
81
|
- `.validity` - Returns the current validity state of the form (`valid` or `invalid`).
|
|
82
82
|
|
|
83
|
-
**Extra
|
|
83
|
+
**Extra Information**:
|
|
84
84
|
- `.isInitialState` - Returns a boolean indicating if the form is in its initial state.
|
|
85
85
|
|
|
86
86
|
**Events**
|
|
@@ -88,11 +88,11 @@ you can access the form data using the following methods:
|
|
|
88
88
|
- `reset` - Fires when the form is reset.
|
|
89
89
|
- `submit` - Fires when the form is submitted.
|
|
90
90
|
|
|
91
|
-
**Advanced
|
|
91
|
+
**Advanced Features**:
|
|
92
92
|
- `.formState` - This is the internal form state. It includes extra `required` and `validity` information for each form element.
|
|
93
93
|
This key is not required for normal form usage, but can add additional context for more complex forms.
|
|
94
94
|
|
|
95
|
-
## Important
|
|
95
|
+
## Important Note for Custom Elements
|
|
96
96
|
|
|
97
97
|
This **only applies to custom-named elements**.
|
|
98
98
|
|
|
@@ -104,8 +104,8 @@ which are only assigned during the initial render.
|
|
|
104
104
|
For example, the following is correct:
|
|
105
105
|
|
|
106
106
|
```javascript
|
|
107
|
-
import {AuroInput} from '@aurodesignsystem/auro-input';
|
|
108
|
-
import {AuroForm} from '@aurodesignsystem/auro-form';
|
|
107
|
+
import { AuroInput } from '@aurodesignsystem/auro-formkit/auro-input/class';
|
|
108
|
+
import { AuroForm } from '@aurodesignsystem/auro-formkit/auro-form/class';
|
|
109
109
|
|
|
110
110
|
AuroInput.register('my-custom-input'); // adds an internal identifier auro-form uses to recognize the custom element
|
|
111
111
|
AuroForm.register(); // render looks for said identifier
|
|
@@ -114,8 +114,8 @@ AuroForm.register(); // render looks for said identifier
|
|
|
114
114
|
The following is NOT correct and will result in forms not working as expected:
|
|
115
115
|
|
|
116
116
|
```javascript
|
|
117
|
-
import {AuroInput} from '@aurodesignsystem/auro-input';
|
|
118
|
-
import {AuroForm} from '@aurodesignsystem/auro-form';
|
|
117
|
+
import { AuroInput } from '@aurodesignsystem/auro-formkit/auro-input/class';
|
|
118
|
+
import { AuroForm } from '@aurodesignsystem/auro-formkit/auro-form/class';
|
|
119
119
|
|
|
120
120
|
AuroForm.register(); // forms start rendering, looking for auro inputs, or custom-named inputs
|
|
121
121
|
AuroInput.register('my-custom-input'); // too late, form has already rendered and did not find the custom element
|
|
@@ -124,6 +124,7 @@ AuroInput.register('my-custom-input'); // too late, form has already rendered an
|
|
|
124
124
|
## Examples
|
|
125
125
|
|
|
126
126
|
### Basic Form
|
|
127
|
+
|
|
127
128
|
The most basic form implementation requires an `auro-input` and an optional auro button with `type="submit"`.
|
|
128
129
|
|
|
129
130
|
By default, Auro Form connects a `submit` event to all `type="submit"` buttons within the form.
|
|
@@ -135,6 +136,7 @@ By default, Auro Form connects a `submit` event to all `type="submit"` buttons w
|
|
|
135
136
|
<auro-input id="search-box" name="searchBox" required>
|
|
136
137
|
<span slot="label">Search flights</span>
|
|
137
138
|
</auro-input>
|
|
139
|
+
<br />
|
|
138
140
|
<auro-button type="submit">Submit</auro-button>
|
|
139
141
|
</auro-form>
|
|
140
142
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
@@ -149,13 +151,15 @@ By default, Auro Form connects a `submit` event to all `type="submit"` buttons w
|
|
|
149
151
|
<auro-input id="search-box" name="searchBox" required>
|
|
150
152
|
<span slot="label">Search flights</span>
|
|
151
153
|
</auro-input>
|
|
154
|
+
<br />
|
|
152
155
|
<auro-button type="submit">Submit</auro-button>
|
|
153
156
|
</auro-form>
|
|
154
157
|
```
|
|
155
158
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
156
159
|
</auro-accordion>
|
|
157
160
|
|
|
158
|
-
### Form with
|
|
161
|
+
### Form with Column Layout
|
|
162
|
+
|
|
159
163
|
Auro Form is designed to be completely unstyled by default, allowing developers to use divs, structural elements, or
|
|
160
164
|
custom CSS to style the form.
|
|
161
165
|
|
|
@@ -264,7 +268,8 @@ This example shows that you can use advanced layouts with Auro Form, such as a c
|
|
|
264
268
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
265
269
|
</auro-accordion>
|
|
266
270
|
|
|
267
|
-
### Complex
|
|
271
|
+
### Complex Form
|
|
272
|
+
|
|
268
273
|
Finally, a more complex form example with multiple form elements, including a date picker and a select element.
|
|
269
274
|
|
|
270
275
|
<div class="exampleWrapper">
|
|
@@ -294,19 +299,16 @@ Finally, a more complex form example with multiple form elements, including a da
|
|
|
294
299
|
<auro-form class="complex-form">
|
|
295
300
|
<auro-input id="first-name" name="firstName" required>
|
|
296
301
|
<span slot="label">First Name</span>
|
|
297
|
-
</auro-input>
|
|
298
|
-
<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
<
|
|
304
|
-
<
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
</auro-input>
|
|
308
|
-
</div>
|
|
309
|
-
</div>
|
|
302
|
+
</auro-input>
|
|
303
|
+
<br />
|
|
304
|
+
<auro-input id="last-name" name="lastName" required>
|
|
305
|
+
<span slot="label">Last Name</span>
|
|
306
|
+
</auro-input>
|
|
307
|
+
<br />
|
|
308
|
+
<auro-input id="occupation" name="occupation" required>
|
|
309
|
+
<span slot="label">Occupation</span>
|
|
310
|
+
</auro-input>
|
|
311
|
+
<br />
|
|
310
312
|
<auro-input-two id="cool-fact" name="coolFact" required>
|
|
311
313
|
<span slot="label">Cool Fact</span>
|
|
312
314
|
</auro-input-two>
|
|
@@ -362,19 +364,16 @@ Finally, a more complex form example with multiple form elements, including a da
|
|
|
362
364
|
<auro-form class="complex-form">
|
|
363
365
|
<auro-input id="first-name" name="firstName" required>
|
|
364
366
|
<span slot="label">First Name</span>
|
|
365
|
-
</auro-input>
|
|
366
|
-
<
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
<
|
|
372
|
-
<
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
</auro-input>
|
|
376
|
-
</div>
|
|
377
|
-
</div>
|
|
367
|
+
</auro-input>
|
|
368
|
+
<br />
|
|
369
|
+
<auro-input id="last-name" name="lastName" required>
|
|
370
|
+
<span slot="label">Last Name</span>
|
|
371
|
+
</auro-input>
|
|
372
|
+
<br />
|
|
373
|
+
<auro-input id="occupation" name="occupation" required>
|
|
374
|
+
<span slot="label">Occupation</span>
|
|
375
|
+
</auro-input>
|
|
376
|
+
<br />
|
|
378
377
|
<auro-input-two id="cool-fact" name="coolFact" required>
|
|
379
378
|
<span slot="label">Cool Fact</span>
|
|
380
379
|
</auro-input-two>
|
|
@@ -109,7 +109,7 @@ class AuroLibraryRuntimeUtils {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
/* eslint-disable no-underscore-dangle,max-lines */
|
|
112
|
+
/* eslint-disable no-underscore-dangle, max-lines, object-property-newline */
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
/**
|
|
@@ -124,20 +124,25 @@ class AuroLibraryRuntimeUtils {
|
|
|
124
124
|
* @typedef {Object.<string, FormStateMember>} FormState - The form state.
|
|
125
125
|
*/
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
129
127
|
/**
|
|
130
|
-
* The auro-form element provides users a way to
|
|
128
|
+
* The `auro-form` element provides users a way to create and manage forms in a consistent manner.
|
|
129
|
+
* @customElement auro-form
|
|
131
130
|
*
|
|
132
|
-
* @attr {Boolean} fixed - Uses fixed pixel values for element shape
|
|
133
|
-
* @attr {String} cssClass - Applies designated CSS class to demo element - you want to delete me!
|
|
134
131
|
* @event {Event} change - Fires when form state changes.
|
|
135
132
|
*/
|
|
136
|
-
|
|
137
|
-
// build the component class
|
|
138
133
|
class AuroForm extends i {
|
|
139
134
|
static get properties() {
|
|
140
135
|
return {
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Applies designated CSS class to demo element - you want to delete me!
|
|
139
|
+
*/
|
|
140
|
+
cssClass: { type: Boolean },
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* If declared, use fixed pixel values for element shape.
|
|
144
|
+
*/
|
|
145
|
+
fixed: { type: Boolean, reflect: true },
|
|
141
146
|
formState: { attribute: false },
|
|
142
147
|
_validity: { attribute: false },
|
|
143
148
|
_isInitialState: { attribute: false },
|
|
@@ -18,6 +18,7 @@ The following sections are editable by making changes to the following files:
|
|
|
18
18
|
-->
|
|
19
19
|
|
|
20
20
|
# Form
|
|
21
|
+
|
|
21
22
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/description.md) -->
|
|
22
23
|
<!-- The below content is automatically added from ./docs/partials/description.md -->
|
|
23
24
|
`<auro-form>` is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) designed to
|
|
@@ -31,7 +32,15 @@ them (along with events) to the parent form element as a JSON object.
|
|
|
31
32
|
<!-- AURO-GENERATED-CONTENT This file is to be used for any additional content that should be included in the README.md which is specific to this component. -->
|
|
32
33
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
33
34
|
|
|
35
|
+
## Form Use Cases
|
|
36
|
+
|
|
37
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/useCases.md) -->
|
|
38
|
+
<!-- The below content is automatically added from ./docs/partials/useCases.md -->
|
|
39
|
+
The `<auro-form>` element should be used in situations where users want to build HTML forms.
|
|
40
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
41
|
+
|
|
34
42
|
## Getting Started
|
|
43
|
+
|
|
35
44
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/componentInstall.md) -->
|
|
36
45
|
<!-- The below content is automatically added from ../../docs/templates/componentInstall.md -->
|
|
37
46
|
|
|
@@ -44,30 +53,7 @@ $ npm i @aurodesignsystem/auro-formkit
|
|
|
44
53
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/gettingStarted.md) -->
|
|
45
54
|
<!-- The below content is automatically added from ../../docs/templates/gettingStarted.md -->
|
|
46
55
|
|
|
47
|
-
###
|
|
48
|
-
|
|
49
|
-
#### Automatic Registration
|
|
50
|
-
|
|
51
|
-
For automatic registration, simply import the component:
|
|
52
|
-
|
|
53
|
-
```javascript
|
|
54
|
-
// Registers <auro-form> automatically
|
|
55
|
-
import '@aurodesignsystem/auro-formkit/auro-form';
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
#### Custom Registration
|
|
59
|
-
|
|
60
|
-
To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our static `AuroForm.register('custom-form')` method on the component class and pass in a unique name.
|
|
61
|
-
|
|
62
|
-
```javascript
|
|
63
|
-
// Import the class only
|
|
64
|
-
import { AuroForm } from '@aurodesignsystem/auro-formkit/auro-form/class';
|
|
65
|
-
|
|
66
|
-
// Register with a custom name if desired
|
|
67
|
-
AuroForm.register('custom-form');
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
#### TypeScript Module Resolution
|
|
56
|
+
### TypeScript Module Resolution
|
|
71
57
|
|
|
72
58
|
When using TypeScript set `moduleResolution` to `bundler`, add the following to your `tsconfig.json`:
|
|
73
59
|
|
|
@@ -80,30 +66,10 @@ When using TypeScript set `moduleResolution` to `bundler`, add the following to
|
|
|
80
66
|
```
|
|
81
67
|
|
|
82
68
|
This configuration enables proper module resolution for the component's TypeScript files.
|
|
83
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
84
|
-
**Reference component in HTML**
|
|
85
|
-
|
|
86
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./apiExamples/basic.html) -->
|
|
87
|
-
<!-- The below code snippet is automatically added from ./apiExamples/basic.html -->
|
|
88
|
-
|
|
89
|
-
```html
|
|
90
|
-
<auro-form>
|
|
91
|
-
<auro-input id="search-box" name="searchBox" required>
|
|
92
|
-
<span slot="label">Search flights</span>
|
|
93
|
-
</auro-input>
|
|
94
|
-
<auro-button type="submit">Submit</auro-button>
|
|
95
|
-
</auro-form>
|
|
96
|
-
```
|
|
97
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
98
|
-
|
|
99
|
-
### Design Token CSS Custom Property dependency
|
|
100
|
-
|
|
101
|
-
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/designTokens.md) -->
|
|
102
|
-
The use of any Auro custom element has a dependency on the [Auro Design Tokens](https://auro.alaskaair.com/getting-started/developers/design-tokens).
|
|
103
|
-
|
|
104
69
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
105
70
|
|
|
106
71
|
## Install from CDN
|
|
72
|
+
|
|
107
73
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/bundleInstallDescription.md) -->
|
|
108
74
|
<!-- The below content is automatically added from ../../docs/templates/bundleInstallDescription.md -->
|
|
109
75
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
@@ -113,19 +79,7 @@ In cases where the project is not able to process JS assets, there are pre-proce
|
|
|
113
79
|
```
|
|
114
80
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
115
81
|
|
|
116
|
-
##
|
|
117
|
-
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/browserSupport.md) -->
|
|
118
|
-
For the most up to date information on [UI development browser support](https://auro.alaskaair.com/support/browsersSupport)
|
|
119
|
-
|
|
120
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
121
|
-
|
|
122
|
-
## auro-form use cases
|
|
123
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/useCases.md) -->
|
|
124
|
-
<!-- The below content is automatically added from ./docs/partials/useCases.md -->
|
|
125
|
-
The `<auro-form>` element should be used in situations where users want to build HTML forms.
|
|
126
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
127
|
-
|
|
128
|
-
## Formkit development
|
|
82
|
+
## Formkit Development
|
|
129
83
|
|
|
130
84
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/partials/developmentDescription.md) -->
|
|
131
85
|
<!-- The below content is automatically added from ../../docs/partials/developmentDescription.md -->
|
|
@@ -139,4 +93,8 @@ To only develop a single component, use the `--filter` flag:
|
|
|
139
93
|
```shell
|
|
140
94
|
npx turbo dev --filter=@aurodesignsystem/auro-input
|
|
141
95
|
```
|
|
96
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
97
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/customRegistration.md) -->
|
|
98
|
+
<!-- The below content is automatically added from ./docs/partials/customRegistration.md -->
|
|
99
|
+
The `auro-form` component does not support custom registration at this time.
|
|
142
100
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
<!-- Form elements MUST be registered BEFORE form if custom names are used -->
|
|
107
107
|
<script type="module" data-demo-script="true" src="./registerDemoDeps.js"></script>
|
|
108
108
|
<script type="module" data-demo-script="true" src="./index.js"></script>
|
|
109
|
-
<!--<script type="module" data-demo-script="true" src="~@
|
|
109
|
+
<!--<script type="module" data-demo-script="true" src="~@aurodesignsystem/auro-input/dist/index.min.js"></script>-->
|
|
110
110
|
|
|
111
111
|
<script>
|
|
112
112
|
const form = document.querySelector('auro-form');
|
|
@@ -9,14 +9,26 @@
|
|
|
9
9
|
* @typedef {Object.<string, FormStateMember>} FormState - The form state.
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
|
-
* The auro-form element provides users a way to
|
|
12
|
+
* The `auro-form` element provides users a way to create and manage forms in a consistent manner.
|
|
13
|
+
* @customElement auro-form
|
|
13
14
|
*
|
|
14
|
-
* @attr {Boolean} fixed - Uses fixed pixel values for element shape
|
|
15
|
-
* @attr {String} cssClass - Applies designated CSS class to demo element - you want to delete me!
|
|
16
15
|
* @event {Event} change - Fires when form state changes.
|
|
17
16
|
*/
|
|
18
17
|
export class AuroForm extends LitElement {
|
|
19
18
|
static get properties(): {
|
|
19
|
+
/**
|
|
20
|
+
* Applies designated CSS class to demo element - you want to delete me!
|
|
21
|
+
*/
|
|
22
|
+
cssClass: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* If declared, use fixed pixel values for element shape.
|
|
27
|
+
*/
|
|
28
|
+
fixed: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
reflect: boolean;
|
|
31
|
+
};
|
|
20
32
|
formState: {
|
|
21
33
|
attribute: boolean;
|
|
22
34
|
};
|
|
@@ -85,7 +85,7 @@ class AuroLibraryRuntimeUtils {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
/* eslint-disable no-underscore-dangle,max-lines */
|
|
88
|
+
/* eslint-disable no-underscore-dangle, max-lines, object-property-newline */
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
@@ -100,20 +100,25 @@ class AuroLibraryRuntimeUtils {
|
|
|
100
100
|
* @typedef {Object.<string, FormStateMember>} FormState - The form state.
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
105
103
|
/**
|
|
106
|
-
* The auro-form element provides users a way to
|
|
104
|
+
* The `auro-form` element provides users a way to create and manage forms in a consistent manner.
|
|
105
|
+
* @customElement auro-form
|
|
107
106
|
*
|
|
108
|
-
* @attr {Boolean} fixed - Uses fixed pixel values for element shape
|
|
109
|
-
* @attr {String} cssClass - Applies designated CSS class to demo element - you want to delete me!
|
|
110
107
|
* @event {Event} change - Fires when form state changes.
|
|
111
108
|
*/
|
|
112
|
-
|
|
113
|
-
// build the component class
|
|
114
109
|
class AuroForm extends LitElement {
|
|
115
110
|
static get properties() {
|
|
116
111
|
return {
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Applies designated CSS class to demo element - you want to delete me!
|
|
115
|
+
*/
|
|
116
|
+
cssClass: { type: Boolean },
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* If declared, use fixed pixel values for element shape.
|
|
120
|
+
*/
|
|
121
|
+
fixed: { type: Boolean, reflect: true },
|
|
117
122
|
formState: { attribute: false },
|
|
118
123
|
_validity: { attribute: false },
|
|
119
124
|
_isInitialState: { attribute: false },
|
|
@@ -85,7 +85,7 @@ class AuroLibraryRuntimeUtils {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
/* eslint-disable no-underscore-dangle,max-lines */
|
|
88
|
+
/* eslint-disable no-underscore-dangle, max-lines, object-property-newline */
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
@@ -100,20 +100,25 @@ class AuroLibraryRuntimeUtils {
|
|
|
100
100
|
* @typedef {Object.<string, FormStateMember>} FormState - The form state.
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
105
103
|
/**
|
|
106
|
-
* The auro-form element provides users a way to
|
|
104
|
+
* The `auro-form` element provides users a way to create and manage forms in a consistent manner.
|
|
105
|
+
* @customElement auro-form
|
|
107
106
|
*
|
|
108
|
-
* @attr {Boolean} fixed - Uses fixed pixel values for element shape
|
|
109
|
-
* @attr {String} cssClass - Applies designated CSS class to demo element - you want to delete me!
|
|
110
107
|
* @event {Event} change - Fires when form state changes.
|
|
111
108
|
*/
|
|
112
|
-
|
|
113
|
-
// build the component class
|
|
114
109
|
class AuroForm extends LitElement {
|
|
115
110
|
static get properties() {
|
|
116
111
|
return {
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Applies designated CSS class to demo element - you want to delete me!
|
|
115
|
+
*/
|
|
116
|
+
cssClass: { type: Boolean },
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* If declared, use fixed pixel values for element shape.
|
|
120
|
+
*/
|
|
121
|
+
fixed: { type: Boolean, reflect: true },
|
|
117
122
|
formState: { attribute: false },
|
|
118
123
|
_validity: { attribute: false },
|
|
119
124
|
_isInitialState: { attribute: false },
|
|
@@ -18,6 +18,7 @@ The following sections are editable by making changes to the following files:
|
|
|
18
18
|
-->
|
|
19
19
|
|
|
20
20
|
# Input
|
|
21
|
+
|
|
21
22
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/description.md) -->
|
|
22
23
|
<!-- The below content is automatically added from ./docs/partials/description.md -->
|
|
23
24
|
Use the `<auro-input>` custom element to create basic single-line text fields. Supports type `text`, `password`, and `email` with validation, required input, error states and a secondary `bordered` theme. Use the slots `label` and `helpText` for additional content support.
|
|
@@ -26,7 +27,18 @@ Use the `<auro-input>` custom element to create basic single-line text fields. S
|
|
|
26
27
|
<!-- The below content is automatically added from ./docs/partials/readmeAddlInfo.md -->
|
|
27
28
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
28
29
|
|
|
30
|
+
## Input Use Cases
|
|
31
|
+
|
|
32
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/useCases.md) -->
|
|
33
|
+
<!-- The below content is automatically added from ./docs/partials/useCases.md -->
|
|
34
|
+
The `<auro-input>` element should be used in situations where users may:
|
|
35
|
+
|
|
36
|
+
* needs to enter information
|
|
37
|
+
* be filling out a form
|
|
38
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
39
|
+
|
|
29
40
|
## Getting Started
|
|
41
|
+
|
|
30
42
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/componentInstall.md) -->
|
|
31
43
|
<!-- The below content is automatically added from ../../docs/templates/componentInstall.md -->
|
|
32
44
|
|
|
@@ -39,30 +51,7 @@ $ npm i @aurodesignsystem/auro-formkit
|
|
|
39
51
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/gettingStarted.md) -->
|
|
40
52
|
<!-- The below content is automatically added from ../../docs/templates/gettingStarted.md -->
|
|
41
53
|
|
|
42
|
-
###
|
|
43
|
-
|
|
44
|
-
#### Automatic Registration
|
|
45
|
-
|
|
46
|
-
For automatic registration, simply import the component:
|
|
47
|
-
|
|
48
|
-
```javascript
|
|
49
|
-
// Registers <auro-input> automatically
|
|
50
|
-
import '@aurodesignsystem/auro-formkit/auro-input';
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
#### Custom Registration
|
|
54
|
-
|
|
55
|
-
To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our static `AuroInput.register('custom-input')` method on the component class and pass in a unique name.
|
|
56
|
-
|
|
57
|
-
```javascript
|
|
58
|
-
// Import the class only
|
|
59
|
-
import { AuroInput } from '@aurodesignsystem/auro-formkit/auro-input/class';
|
|
60
|
-
|
|
61
|
-
// Register with a custom name if desired
|
|
62
|
-
AuroInput.register('custom-input');
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
#### TypeScript Module Resolution
|
|
54
|
+
### TypeScript Module Resolution
|
|
66
55
|
|
|
67
56
|
When using TypeScript set `moduleResolution` to `bundler`, add the following to your `tsconfig.json`:
|
|
68
57
|
|
|
@@ -75,29 +64,10 @@ When using TypeScript set `moduleResolution` to `bundler`, add the following to
|
|
|
75
64
|
```
|
|
76
65
|
|
|
77
66
|
This configuration enables proper module resolution for the component's TypeScript files.
|
|
78
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
79
|
-
**Reference component in HTML**
|
|
80
|
-
|
|
81
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./apiExamples/basic.html) -->
|
|
82
|
-
<!-- The below code snippet is automatically added from ./apiExamples/basic.html -->
|
|
83
|
-
|
|
84
|
-
```html
|
|
85
|
-
<auro-input>
|
|
86
|
-
<span slot="ariaLabel.clear">Clear All</span>
|
|
87
|
-
<span slot="label">Label</span>
|
|
88
|
-
<span slot="helpText">Help Text</span>
|
|
89
|
-
</auro-input>
|
|
90
|
-
```
|
|
91
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
92
|
-
|
|
93
|
-
### Design Token CSS Custom Property dependency
|
|
94
|
-
|
|
95
|
-
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/designTokens.md) -->
|
|
96
|
-
The use of any Auro custom element has a dependency on the [Auro Design Tokens](https://auro.alaskaair.com/getting-started/developers/design-tokens).
|
|
97
|
-
|
|
98
67
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
99
68
|
|
|
100
69
|
## Install from CDN
|
|
70
|
+
|
|
101
71
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/bundleInstallDescription.md) -->
|
|
102
72
|
<!-- The below content is automatically added from ../../docs/templates/bundleInstallDescription.md -->
|
|
103
73
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
@@ -107,22 +77,7 @@ In cases where the project is not able to process JS assets, there are pre-proce
|
|
|
107
77
|
```
|
|
108
78
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
109
79
|
|
|
110
|
-
##
|
|
111
|
-
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/browserSupport.md) -->
|
|
112
|
-
For the most up to date information on [UI development browser support](https://auro.alaskaair.com/support/browsersSupport)
|
|
113
|
-
|
|
114
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
115
|
-
|
|
116
|
-
## auro-input use cases
|
|
117
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/useCases.md) -->
|
|
118
|
-
<!-- The below content is automatically added from ./docs/partials/useCases.md -->
|
|
119
|
-
The `<auro-input>` element should be used in situations where users may:
|
|
120
|
-
|
|
121
|
-
* needs to enter information
|
|
122
|
-
* be filling out a form
|
|
123
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
124
|
-
|
|
125
|
-
## Formkit development
|
|
80
|
+
## Formkit Development
|
|
126
81
|
|
|
127
82
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/partials/developmentDescription.md) -->
|
|
128
83
|
<!-- The below content is automatically added from ../../docs/partials/developmentDescription.md -->
|
|
@@ -136,4 +91,44 @@ To only develop a single component, use the `--filter` flag:
|
|
|
136
91
|
```shell
|
|
137
92
|
npx turbo dev --filter=@aurodesignsystem/auro-input
|
|
138
93
|
```
|
|
94
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
95
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/customRegistration.md) -->
|
|
96
|
+
<!-- The below content is automatically added from ./docs/partials/customRegistration.md -->
|
|
97
|
+
|
|
98
|
+
## Custom Component Registration for Version Management
|
|
99
|
+
|
|
100
|
+
There are two key parts to every Auro component: the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</a> and the custom element definition. The class defines the component’s behavior, while the custom element registers it under a specific name so it can be used in HTML.
|
|
101
|
+
|
|
102
|
+
When you install the component as described on the `Install` page, the class is imported automatically, and the component is registered globally for you.
|
|
103
|
+
|
|
104
|
+
However, if you need to load multiple versions of the same component on a single page (for example, when two projects depend on different versions), you can manually register the class under a custom element name to avoid conflicts.
|
|
105
|
+
|
|
106
|
+
You can do this by importing only the component class and using the `register(name)` method with a unique name:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
// Import the class only
|
|
110
|
+
import { AuroInput } from '@aurodesignsystem/auro-formkit/auro-input/class';
|
|
111
|
+
|
|
112
|
+
// Register with a custom name if desired
|
|
113
|
+
AuroInput.register('custom-input');
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This will create a new custom element `<custom-input>` that behaves exactly like `<auro-input>`, allowing both to coexist on the same page without interfering with each other.
|
|
117
|
+
|
|
118
|
+
<div class="exampleWrapper exampleWrapper--flex">
|
|
119
|
+
<custom-input>
|
|
120
|
+
<span slot="label">Label</span>
|
|
121
|
+
<span slot="helpText">Help Text</span>
|
|
122
|
+
</custom-input>
|
|
123
|
+
</div>
|
|
124
|
+
<auro-accordion alignRight>
|
|
125
|
+
<span slot="trigger">See code</span>
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<custom-input>
|
|
129
|
+
<span slot="label">Label</span>
|
|
130
|
+
<span slot="helpText">Help Text</span>
|
|
131
|
+
</custom-input>
|
|
132
|
+
```
|
|
133
|
+
</auro-accordion>
|
|
139
134
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { changeLang } from "../apiExamples/changeLang";
|
|
2
1
|
import { customError } from "../apiExamples/error";
|
|
3
|
-
import { customErrorOnDark } from "../apiExamples/
|
|
2
|
+
import { customErrorOnDark } from "../apiExamples/appearance-inverse-error";
|
|
4
3
|
import { setReadonlyValue } from "../apiExamples/readonly";
|
|
5
|
-
import { swapInputValues } from "../apiExamples/swapValue";
|
|
6
4
|
import { programmaticallySetValue } from "../apiExamples/value";
|
|
7
|
-
import { resetStateExample } from "../apiExamples/
|
|
5
|
+
import { resetStateExample } from "../apiExamples/reset-state";
|
|
6
|
+
import { swapInputValues } from "../apiExamples/swap-value";
|
|
8
7
|
import './index.js';
|
|
9
8
|
|
|
10
9
|
export function initExamples(initCount) {
|
|
11
10
|
initCount = initCount || 0;
|
|
12
11
|
|
|
13
12
|
try {
|
|
14
|
-
changeLang();
|
|
15
13
|
customError();
|
|
16
14
|
customErrorOnDark();
|
|
17
15
|
setReadonlyValue();
|