@aurodesignsystem/auro-formkit 2.0.0-beta.52 → 2.0.0-beta.54

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +27 -6
  3. package/components/bibtemplate/dist/headerVersion.d.ts +1 -1
  4. package/components/bibtemplate/dist/index.js +4 -3
  5. package/components/bibtemplate/dist/registered.js +4 -3
  6. package/components/checkbox/README.md +56 -93
  7. package/components/checkbox/demo/index.md +0 -45
  8. package/components/checkbox/demo/readme.html +49 -0
  9. package/components/checkbox/demo/readme.md +142 -0
  10. package/components/combobox/README.md +57 -102
  11. package/components/combobox/demo/api.min.js +9 -7
  12. package/components/combobox/demo/index.md +0 -53
  13. package/components/combobox/demo/index.min.js +9 -7
  14. package/components/combobox/demo/readme.html +49 -0
  15. package/components/combobox/demo/readme.md +152 -0
  16. package/components/combobox/dist/index.js +9 -7
  17. package/components/combobox/dist/registered.js +9 -7
  18. package/components/counter/README.md +58 -100
  19. package/components/counter/demo/api.js +3 -0
  20. package/components/counter/demo/api.md +254 -12
  21. package/components/counter/demo/api.min.js +26 -11
  22. package/components/counter/demo/index.html +0 -1
  23. package/components/counter/demo/index.js +1 -2
  24. package/components/counter/demo/index.md +71 -221
  25. package/components/counter/demo/index.min.js +15 -11
  26. package/components/counter/demo/readme.html +49 -0
  27. package/components/counter/demo/readme.md +146 -0
  28. package/components/counter/dist/auro-counter-group.d.ts +6 -6
  29. package/components/counter/dist/auro-counter.d.ts +1 -1
  30. package/components/counter/dist/index.js +15 -11
  31. package/components/counter/dist/registered.js +15 -11
  32. package/components/datepicker/README.md +57 -95
  33. package/components/datepicker/demo/api.min.js +9 -7
  34. package/components/datepicker/demo/index.md +0 -39
  35. package/components/datepicker/demo/index.min.js +9 -7
  36. package/components/datepicker/demo/readme.html +49 -0
  37. package/components/datepicker/demo/readme.md +140 -0
  38. package/components/datepicker/dist/index.js +9 -7
  39. package/components/datepicker/dist/registered.js +9 -7
  40. package/components/dropdown/README.md +56 -92
  41. package/components/dropdown/demo/index.md +1 -60
  42. package/components/dropdown/demo/readme.html +49 -0
  43. package/components/dropdown/demo/readme.md +144 -0
  44. package/components/form/README.md +64 -98
  45. package/components/form/demo/index.md +94 -25
  46. package/components/form/demo/readme.html +49 -0
  47. package/components/form/demo/readme.md +146 -0
  48. package/components/input/README.md +56 -87
  49. package/components/input/demo/api.min.js +5 -4
  50. package/components/input/demo/index.md +0 -31
  51. package/components/input/demo/index.min.js +5 -4
  52. package/components/input/demo/readme.html +49 -0
  53. package/components/input/demo/readme.md +135 -0
  54. package/components/input/dist/index.js +5 -4
  55. package/components/input/dist/registered.js +5 -4
  56. package/components/menu/README.md +56 -93
  57. package/components/menu/demo/index.md +1 -44
  58. package/components/menu/demo/readme.html +49 -0
  59. package/components/menu/demo/readme.md +145 -0
  60. package/components/radio/README.md +56 -87
  61. package/components/radio/demo/index.md +0 -45
  62. package/components/radio/demo/readme.html +49 -0
  63. package/components/radio/demo/readme.md +137 -0
  64. package/components/select/README.md +57 -100
  65. package/components/select/demo/api.min.js +4 -3
  66. package/components/select/demo/index.md +0 -53
  67. package/components/select/demo/index.min.js +4 -3
  68. package/components/select/demo/readme.html +49 -0
  69. package/components/select/demo/readme.md +143 -0
  70. package/components/select/dist/index.js +4 -3
  71. package/components/select/dist/registered.js +4 -3
  72. package/package.json +3 -2
@@ -0,0 +1,49 @@
1
+ <!--
2
+ Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
3
+ See LICENSE in the project root for license information.
4
+
5
+ HTML in this document is standardized and NOT to be edited.
6
+ All demo code should be added/edited in ./demo/index.md
7
+
8
+ With the exception of adding custom elements if needed for the demo.
9
+
10
+ ----------------------- DO NOT EDIT -----------------------------
11
+
12
+ -->
13
+
14
+ <!DOCTYPE html>
15
+ <html lang="en">
16
+ <head>
17
+ <meta charset="UTF-8" />
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
19
+ <title>Auro Web Component Generator | auro-dropdown custom element</title>
20
+ <link
21
+ rel="stylesheet"
22
+ type="text/css"
23
+ href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"
24
+ />
25
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/tokens/CSSCustomProperties.css">
26
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
27
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/elementDemoStyles.css" />
28
+ </head>
29
+ <body class="auro-markdown">
30
+ <main></main>
31
+
32
+ <script type="module">
33
+ import 'https://cdn.jsdelivr.net/npm/marked@latest/marked.min.js';
34
+ import 'https://cdn.jsdelivr.net/npm/prismjs@latest/prism.js';
35
+ fetch('./readme.md')
36
+ .then((response) => response.text())
37
+ .then((text) => {
38
+ const rawHtml = marked.parse(text);
39
+ document.querySelector('main').innerHTML = rawHtml;
40
+ Prism.highlightAll();
41
+ })
42
+ </script>
43
+ <script type="module">
44
+ import { initExamples } from "./index.min.js";
45
+
46
+ initExamples();
47
+ </script>
48
+ </body>
49
+ </html>
@@ -0,0 +1,144 @@
1
+ <!--
2
+ The README.md file is a compiled document. No edits should be made directly to this file.
3
+
4
+ README.md is created by running `npm run build:docs`.
5
+
6
+ This file is generated based on a template fetched from
7
+ `../../docs/templates/componentReadmeTemplate.md`
8
+ and copied to `./componentDocs/README.md` each time the docs are compiled.
9
+
10
+ The following sections are editable by making changes to the following files:
11
+
12
+ | SECTION | DESCRIPTION | FILE LOCATION |
13
+ |------------------------|---------------------------------------------------|-------------------------------------|
14
+ | Description | Description of the component | `./docs/partials/description.md` |
15
+ | Use Cases | Examples for when to use this component | `./docs/partials/useCases.md` |
16
+ | Additional Information | For use to add any component specific information | `./docs/partials/readmeAddlInfo.md` |
17
+ | Component Example Code | HTML sample code of the components use | `./apiExamples/basic.html` |
18
+ -->
19
+
20
+ # Dropdown
21
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/description.md) -->
22
+ <!-- The below content is automatically added from ./docs/partials/description.md -->
23
+ The `auro-dropdown` component is a trigger and dropdown element combination intended to be used with dropdown content that is interactive. `auro-dropdown` is content agnostic and any valid HTML can be placed in either the trigger or the dropdown.
24
+
25
+ _Note: if the dropdown content in your implementation is not interactive (e.g. a tooltip) [auro-popover](http://auro.alaskaair.com/components/auro/popover) may better serve your needs._
26
+ <!-- AURO-GENERATED-CONTENT:END -->
27
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/readmeAddlInfo.md) -->
28
+ <!-- The below content is automatically added from ./docs/partials/readmeAddlInfo.md -->
29
+ <!-- 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. -->
30
+ <!-- AURO-GENERATED-CONTENT:END -->
31
+
32
+ ## Getting Started
33
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/componentInstall.md) -->
34
+ <!-- The below content is automatically added from ../../docs/templates/componentInstall.md -->
35
+
36
+ #### NPM Installation
37
+
38
+ ```shell
39
+ $ npm i @aurodesignsystem/auro-formkit
40
+ ```
41
+ <!-- AURO-GENERATED-CONTENT:END -->
42
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/gettingStarted.md) -->
43
+ <!-- The below content is automatically added from ../../docs/templates/gettingStarted.md -->
44
+
45
+ ### Import Options
46
+
47
+ #### Automatic Registration
48
+
49
+ For automatic registration, simply import the component:
50
+
51
+ ```javascript
52
+ // Registers <auro-dropdown> automatically
53
+ import '@aurodesignsystem/auro-formkit/auro-dropdown';
54
+ ```
55
+
56
+ #### Custom Registration
57
+
58
+ To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our static `AuroDropdown.register('custom-dropdown')` method on the component class and pass in a unique name.
59
+
60
+ ```javascript
61
+ // Import the class only
62
+ import { AuroDropdown } from '@aurodesignsystem/auro-formkit/auro-dropdown/class';
63
+
64
+ // Register with a custom name if desired
65
+ AuroDropdown.register('custom-dropdown');
66
+ ```
67
+
68
+ #### TypeScript Module Resolution
69
+
70
+ When using TypeScript set `moduleResolution` to `bundler`, add the following to your `tsconfig.json`:
71
+
72
+ ```json
73
+ {
74
+ "compilerOptions": {
75
+ "moduleResolution": "bundler"
76
+ }
77
+ }
78
+ ```
79
+
80
+ This configuration enables proper module resolution for the component's TypeScript files.
81
+ <!-- AURO-GENERATED-CONTENT:END -->
82
+ **Reference component in HTML**
83
+
84
+ <!-- AURO-GENERATED-CONTENT:START (CODE:src=./apiExamples/basic.html) -->
85
+ <!-- The below code snippet is automatically added from ./apiExamples/basic.html -->
86
+
87
+ ```html
88
+ <auro-dropdown aria-label="custom label">
89
+ Lorem ipsum solar
90
+ <div slot="trigger">
91
+ Trigger
92
+ </div>
93
+ </auro-dropdown>
94
+ ```
95
+ <!-- AURO-GENERATED-CONTENT:END -->
96
+
97
+ ### Design Token CSS Custom Property dependency
98
+
99
+ <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/designTokens.md) -->
100
+ The use of any Auro custom element has a dependency on the [Auro Design Tokens](https://auro.alaskaair.com/getting-started/developers/design-tokens).
101
+
102
+ <!-- AURO-GENERATED-CONTENT:END -->
103
+
104
+ ## Install from CDN
105
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/bundleInstallDescription.md) -->
106
+ <!-- The below content is automatically added from ../../docs/templates/bundleInstallDescription.md -->
107
+ 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.
108
+
109
+ ```html
110
+ <script type="module "src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@2.0.0-beta.53/auro-dropdown/+esm"></script>
111
+ ```
112
+ <!-- AURO-GENERATED-CONTENT:END -->
113
+
114
+ ## UI development browser support
115
+ <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/browserSupport.md) -->
116
+ For the most up to date information on [UI development browser support](https://auro.alaskaair.com/support/browsersSupport)
117
+
118
+ <!-- AURO-GENERATED-CONTENT:END -->
119
+
120
+ ## auro-dropdown use cases
121
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/useCases.md) -->
122
+ <!-- The below content is automatically added from ./docs/partials/useCases.md -->
123
+ The `auro-dropdown` element should be used in situations where users may:
124
+
125
+ * interact with an element to get clarification on content offering
126
+ * provide definition to iconic imagery
127
+ * when interactive help is required
128
+ <!-- AURO-GENERATED-CONTENT:END -->
129
+
130
+ ## Formkit development
131
+
132
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/partials/developmentDescription.md) -->
133
+ <!-- The below content is automatically added from ../../docs/partials/developmentDescription.md -->
134
+
135
+ ### Filtering
136
+
137
+ Running the `dev` command will open a `localhost` development server for all components in the monorepo at once.
138
+
139
+ To only develop a single component, use the `--filter` flag:
140
+
141
+ ```shell
142
+ npx turbo dev --filter=@aurodesignsystem/auro-input
143
+ ```
144
+ <!-- AURO-GENERATED-CONTENT:END -->
@@ -18,56 +18,68 @@ The following sections are editable by making changes to the following files:
18
18
  -->
19
19
 
20
20
  # Form
21
-
22
21
  <!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/description.md) -->
23
22
  <!-- The below content is automatically added from ./docs/partials/description.md -->
24
- `<auro-form>` is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) for the purpose of ...
25
-
26
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam convallis in tellus nec pellentesque. Integer bibendum ligula sit amet vehicula gravida. Maecenas accumsan, ligula vitae molestie iaculis, tellus mi laoreet ex [install instructions](https://auro.alaskaair.com/components/auro/button/install), ac malesuada velit dolor vel mi. Cras et rutrum urna. Sed mattis mi eu tortor ullamcorper, egestas bibendum mauris cursus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus viverra eros eget neque commodo vulputate. In tempus eu velit at dictum.
23
+ `<auro-form>` is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) designed to
24
+ serve as the base logic for all auro-constructed forms.
27
25
 
28
- Nulla at augue facilisis `odio lobortis` molestie vitae a nulla.
26
+ It automatically "scrapes" its inner content for any auro form elements, and surfaces
27
+ them (along with events) to the parent form element as a JSON object.
29
28
  <!-- AURO-GENERATED-CONTENT:END -->
30
29
  <!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/readmeAddlInfo.md) -->
31
30
  <!-- The below content is automatically added from ./docs/partials/readmeAddlInfo.md -->
32
31
  <!-- 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. -->
33
32
  <!-- AURO-GENERATED-CONTENT:END -->
34
33
 
35
- ## UI development browser support
36
-
37
- <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/browserSupport.md) -->
38
- For the most up to date information on [UI development browser support](https://auro.alaskaair.com/support/browsersSupport)
39
-
40
- <!-- AURO-GENERATED-CONTENT:END -->
41
-
42
- ## Install
43
-
34
+ ## Getting Started
44
35
  <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/componentInstall.md) -->
45
36
  <!-- The below content is automatically added from ../../docs/templates/componentInstall.md -->
46
37
 
38
+ #### NPM Installation
39
+
47
40
  ```shell
48
41
  $ npm i @aurodesignsystem/auro-formkit
49
42
  ```
50
43
  <!-- AURO-GENERATED-CONTENT:END -->
44
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/gettingStarted.md) -->
45
+ <!-- The below content is automatically added from ../../docs/templates/gettingStarted.md -->
51
46
 
52
- ### Design Token CSS Custom Property dependency
47
+ ### Import Options
48
+
49
+ #### Automatic Registration
53
50
 
54
- <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/designTokens.md) -->
55
- The use of any Auro custom element has a dependency on the [Auro Design Tokens](https://auro.alaskaair.com/getting-started/developers/design-tokens).
51
+ For automatic registration, simply import the component:
56
52
 
57
- <!-- AURO-GENERATED-CONTENT:END -->
53
+ ```javascript
54
+ // Registers <auro-form> automatically
55
+ import '@aurodesignsystem/auro-formkit/auro-form';
56
+ ```
58
57
 
59
- ### Define dependency in project component
58
+ #### Custom Registration
60
59
 
61
- <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/usage/componentImportDescription.md) -->
62
- Defining the component dependency within each component that is using the `<auro-form>` component.
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.
63
61
 
64
- <!-- AURO-GENERATED-CONTENT:END -->
65
- <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/componentUsage.md) -->
66
- <!-- The below content is automatically added from ../../docs/templates/componentUsage.md -->
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
+ ```
67
69
 
68
- ```js
69
- import "@aurodesignsystem/auro-formkit/auro-form";
70
+ #### TypeScript Module Resolution
71
+
72
+ When using TypeScript set `moduleResolution` to `bundler`, add the following to your `tsconfig.json`:
73
+
74
+ ```json
75
+ {
76
+ "compilerOptions": {
77
+ "moduleResolution": "bundler"
78
+ }
79
+ }
70
80
  ```
81
+
82
+ This configuration enables proper module resolution for the component's TypeScript files.
71
83
  <!-- AURO-GENERATED-CONTENT:END -->
72
84
  **Reference component in HTML**
73
85
 
@@ -76,33 +88,38 @@ import "@aurodesignsystem/auro-formkit/auro-form";
76
88
 
77
89
  ```html
78
90
  <auro-form>
79
- <auro-input>
80
- <span slot="label">Hello World</span>
81
- </auro-input>
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>
82
95
  </auro-form>
83
96
  ```
84
97
  <!-- AURO-GENERATED-CONTENT:END -->
85
98
 
86
- ## Install bundled assets from CDN
99
+ ### Design Token CSS Custom Property dependency
87
100
 
88
- <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/usage/bundleInstallDescription.md) -->
89
- In cases where the project is not able to process JS assets, there are pre-processed assets available for use. See -- `auro-form__bundled.js` for modern browsers. Legacy browsers such as IE11 are no longer supported.
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).
90
103
 
91
- **WARNING!** When installing into your application environment, DO NOT use `@latest` for the requested version. Risks include unknown MAJOR version releases and instant adoption of any new features and possible bugs without developer knowledge. The `@latest` wildcard should NEVER be used for production customer-facing applications. You have been warned.
104
+ <!-- AURO-GENERATED-CONTENT:END -->
105
+
106
+ ## Install from CDN
107
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/bundleInstallDescription.md) -->
108
+ <!-- The below content is automatically added from ../../docs/templates/bundleInstallDescription.md -->
109
+ 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.
92
110
 
111
+ ```html
112
+ <script type="module "src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@2.0.0-beta.53/auro-form/+esm"></script>
113
+ ```
93
114
  <!-- AURO-GENERATED-CONTENT:END -->
94
115
 
95
- ### Bundle example code
116
+ ## UI development browser support
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)
96
119
 
97
- <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/componentBundleUseModBrowsers.md) -->
98
- <!-- The below content is automatically added from ../../docs/templates/componentBundleUseModBrowsers.md -->
99
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@4.13.0/dist/tokens/CSSCustomProperties.css" />
100
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@5.1.2/dist/bundled/essentials.css" />
101
- <script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-form@2.0.0-beta.51/dist/auro-form__bundled.js" type="module"></script>
102
120
  <!-- AURO-GENERATED-CONTENT:END -->
103
121
 
104
122
  ## auro-form use cases
105
-
106
123
  <!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/useCases.md) -->
107
124
  <!-- The below content is automatically added from ./docs/partials/useCases.md -->
108
125
  The `<auro-form>` element should be used in situations where users may:
@@ -112,69 +129,18 @@ The `<auro-form>` element should be used in situations where users may:
112
129
  * ...
113
130
  <!-- AURO-GENERATED-CONTENT:END -->
114
131
 
115
- ## API Code Examples
116
-
117
- ### Default auro-form
132
+ ## Formkit development
118
133
 
119
- <!-- AURO-GENERATED-CONTENT:START (CODE:src=./apiExamples/basic.html) -->
120
- <!-- The below code snippet is automatically added from ./apiExamples/basic.html -->
134
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/partials/developmentDescription.md) -->
135
+ <!-- The below content is automatically added from ../../docs/partials/developmentDescription.md -->
121
136
 
122
- ```html
123
- <auro-form>
124
- <auro-input>
125
- <span slot="label">Hello World</span>
126
- </auro-input>
127
- </auro-form>
128
- ```
129
- <!-- AURO-GENERATED-CONTENT:END -->
130
-
131
- ## Development
132
-
133
- <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/developmentDescription.md) -->
134
- In order to develop against this project, if you are not part of the core team, you will be required to fork the project prior to submitting a pull request.
137
+ ### Filtering
135
138
 
136
- Please be sure to review the [contribution guidelines](https://auro.alaskaair.com/contributing) for this project. Please make sure to **pay special attention** to the **conventional commits** section of the document.
137
-
138
- <!-- AURO-GENERATED-CONTENT:END -->
139
-
140
- ### Start development environment
139
+ Running the `dev` command will open a `localhost` development server for all components in the monorepo at once.
141
140
 
142
- <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/localhost.md) -->
143
- Once the project has been cloned to your local resource and you have installed all the dependencies you will need to open a shell session to run the **dev server**.
141
+ To only develop a single component, use the `--filter` flag:
144
142
 
145
143
  ```shell
146
- $ npm run dev
144
+ npx turbo dev --filter=@aurodesignsystem/auro-input
147
145
  ```
148
-
149
- Open [localhost:8000](http://localhost:8000/)
150
-
151
- If running separate sessions is preferred, please run the following commands in individual terminal shells.
152
-
153
- ```shell
154
- $ npm run build:watch
155
-
156
- $ npm run serve
157
- ```
158
-
159
- <!-- AURO-GENERATED-CONTENT:END -->
160
-
161
- ### API generation
162
-
163
- <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/api.md) -->
164
- The custom element API file is generated in the build and committed back to the repo with a version change. If the API doc has changed without a version change, author's are to run `npm run build:api` to generate the doc and commit to version control.
165
-
166
- <!-- AURO-GENERATED-CONTENT:END -->
167
-
168
- ### Testing
169
-
170
- <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/testing.md) -->
171
- Automated tests are required for every Auro component. See `.\test\auro-form.test.js` for the tests for this component. Run `npm test` to run the tests and check code coverage. Tests must pass and meet a certain coverage threshold to commit. See [the testing documentation](https://auro.alaskaair.com/support/tests) for more details.
172
-
173
- <!-- AURO-GENERATED-CONTENT:END -->
174
-
175
- ### Bundled assets
176
-
177
- <!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/bundles.md) -->
178
- Bundled assets are only generated in the remote and not merged back to this repo. To review and/or test a bundled asset locally, run `$ npm run bundler` to generate assets.
179
-
180
146
  <!-- AURO-GENERATED-CONTENT:END -->
@@ -3,38 +3,107 @@ The index.md file is a compiled document. No edits should be made directly to th
3
3
 
4
4
  index.md is created by running `npm run build:markdownDocs`.
5
5
 
6
- This file is generated based on a template fetched from `./docs/partials/index.md`
7
- -->
8
- <!--
9
- The index.md file is a compiled document. No edits should be made directly to this file.
10
-
11
- index.md is created by running `npm run build:markdownDocs`.
12
-
13
6
  This file is generated based on a template fetched from `./docs/partials/index.md`
14
7
  -->
15
8
 
16
- # Form
17
-
18
- ## Dropdown
9
+ # Form
19
10
 
20
11
  <!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
21
12
  <!-- The below content is automatically added from ./../docs/partials/description.md -->
22
- `<auro-form>` is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) for the purpose of ...
13
+ `<auro-form>` is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) designed to
14
+ serve as the base logic for all auro-constructed forms.
23
15
 
24
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam convallis in tellus nec pellentesque. Integer bibendum ligula sit amet vehicula gravida. Maecenas accumsan, ligula vitae molestie iaculis, tellus mi laoreet ex [install instructions](https://auro.alaskaair.com/components/auro/button/install), ac malesuada velit dolor vel mi. Cras et rutrum urna. Sed mattis mi eu tortor ullamcorper, egestas bibendum mauris cursus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus viverra eros eget neque commodo vulputate. In tempus eu velit at dictum.
16
+ It automatically "scrapes" its inner content for any auro form elements, and surfaces
17
+ them (along with events) to the parent form element as a JSON object.
18
+ <!-- AURO-GENERATED-CONTENT:END -->
19
+
20
+ ## Form data generation
25
21
 
26
- Nulla at augue facilisis `odio lobortis` molestie vitae a nulla.
27
- <!-- AURO-GENERATED-CONTENT:END -->
28
- <auro-dropdown id="testing">
29
- <span slot="trigger">default 1</span>
30
- <span>this should go in the default slot</span>
31
- </auro-dropdown>
32
- <br /><br /><br />
33
- <my-select></my-select>
34
- <br /><br /><br /><br />
22
+ As covered in the description, `auro-form` makes a developer's life easier by surfacing Auro form elements as a JSON object.
23
+ The most common use case the Auro team identified when building Form was the need to collect form data in a structured way.
24
+
25
+ The following is required for an Auro form element to be collected automatically:
26
+
27
+ 1. It _must_ have a `name` attribute. This is required if vanilla HTML forms, and we follow the same pattern.
28
+ 2. It _must_ be an Auro form element. See note below for custom elements.
29
+
30
+ That being said, we do _not_ require form elements to be direct children of `auro-form`.
31
+ They can be nested within other elements for styling, such as a `div`, `span` or `fieldset`.
32
+
33
+ ## Important note for custom elements
34
+
35
+ When consuming custom-named Auro form elements (like `auro-input` as `my-custom-input`), these elements _must_ be registered
36
+ BEFORE auro-form due to rendering order and Shadown DOM limitations.
37
+
38
+ For example, the following is correct:
39
+
40
+ ```javascript
41
+ import {AuroInput} from '@aurodesignsystem/auro-input';
42
+ import {AuroForm} from '@aurodesignsystem/auro-form';
43
+
44
+ AuroInput.register('my-custom-input'); // adds an internal identifier auro-form uses to recognize the custom element
45
+ AuroForm.register(); // render looks for said identifier
46
+ ```
47
+
48
+ The following is NOT correct and will result in forms not working as expected:
49
+
50
+ ```javascript
51
+ import {AuroInput} from '@aurodesignsystem/auro-input';
52
+ import {AuroForm} from '@aurodesignsystem/auro-form';
53
+
54
+ AuroForm.register(); // forms start rendering, looking for auro inputs, or custom-named inputs
55
+ AuroInput.register('my-custom-input'); // too late, form has already rendered and did not find the custom element
56
+ ```
57
+
58
+ In a correctly registered scenario, `auro-form` will automatically recognize the custom element and collect its data in the following shape:
59
+
60
+ ```typescript
61
+ interface AuroFormState {
62
+ // value varies based on form element
63
+ [key: string]: string | string[] | number | boolean | null;
64
+ }
65
+ ```
66
+
67
+ A real-world example of this might be:
68
+
69
+ ```json
70
+ {
71
+ "hotelCity": "New York",
72
+ "dates": ["2022-01-01", "2022-01-15"],
73
+ "numberOfGuests": 2
74
+ }
75
+ ```
76
+
77
+ ## Examples
35
78
 
36
- ## Input
79
+ ### Basic Form
80
+ The most basic form implementation requires an `auro-input` and an optional auro button with `type="submit"`.
37
81
 
38
- <auro-input required placeholder="John Doe">
39
- <span slot="label">Full name</span>
40
- </auro-input>
82
+ By default, Auro Form connects a `submit` event to all `type="submit"` buttons within the form.
83
+
84
+ <div class="exampleWrapper">
85
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/basic.html) -->
86
+ <!-- The below content is automatically added from ./../apiExamples/basic.html -->
87
+ <auro-form>
88
+ <auro-input id="search-box" name="searchBox" required>
89
+ <span slot="label">Search flights</span>
90
+ </auro-input>
91
+ <auro-button type="submit">Submit</auro-button>
92
+ </auro-form>
93
+ <!-- AURO-GENERATED-CONTENT:END -->
94
+ </div>
95
+ <auro-accordion alignRight>
96
+ <span slot="trigger">See code</span>
97
+ <!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/basic.html) -->
98
+ <!-- The below code snippet is automatically added from ./../apiExamples/basic.html -->
99
+
100
+ ```html
101
+ <auro-form>
102
+ <auro-input id="search-box" name="searchBox" required>
103
+ <span slot="label">Search flights</span>
104
+ </auro-input>
105
+ <auro-button type="submit">Submit</auro-button>
106
+ </auro-form>
107
+ ```
108
+ <!-- AURO-GENERATED-CONTENT:END -->
109
+ </auro-accordion>
@@ -0,0 +1,49 @@
1
+ <!--
2
+ Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
3
+ See LICENSE in the project root for license information.
4
+
5
+ HTML in this document is standardized and NOT to be edited.
6
+ All demo code should be added/edited in ./demo/index.md
7
+
8
+ With the exception of adding custom elements if needed for the demo.
9
+
10
+ ----------------------- DO NOT EDIT -----------------------------
11
+
12
+ -->
13
+
14
+ <!DOCTYPE html>
15
+ <html lang="en">
16
+ <head>
17
+ <meta charset="UTF-8" />
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
19
+ <title>Auro Web Component Generator | auro-form custom element</title>
20
+ <link
21
+ rel="stylesheet"
22
+ type="text/css"
23
+ href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"
24
+ />
25
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/tokens/CSSCustomProperties.css">
26
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
27
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/elementDemoStyles.css" />
28
+ </head>
29
+ <body class="auro-markdown">
30
+ <main></main>
31
+
32
+ <script type="module">
33
+ import 'https://cdn.jsdelivr.net/npm/marked@latest/marked.min.js';
34
+ import 'https://cdn.jsdelivr.net/npm/prismjs@latest/prism.js';
35
+ fetch('./readme.md')
36
+ .then((response) => response.text())
37
+ .then((text) => {
38
+ const rawHtml = marked.parse(text);
39
+ document.querySelector('main').innerHTML = rawHtml;
40
+ Prism.highlightAll();
41
+ })
42
+ </script>
43
+ <script type="module">
44
+ import { initExamples } from "./index.min.js";
45
+
46
+ initExamples();
47
+ </script>
48
+ </body>
49
+ </html>