@aurodesignsystem-dev/auro-formkit 0.0.0-pr1451.2 → 0.0.0-pr1451.21
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/components/checkbox/README.md +11 -27
- package/components/checkbox/demo/accessibility.html +49 -0
- package/components/checkbox/demo/accessibility.md +44 -0
- package/components/checkbox/demo/api.html +17 -25
- package/components/checkbox/demo/api.md +40 -416
- package/components/checkbox/demo/api.min.js +5 -4
- package/components/checkbox/demo/customize.html +52 -0
- package/components/checkbox/demo/customize.md +361 -0
- package/components/checkbox/demo/demo-support.js +60 -0
- package/components/checkbox/demo/design.html +52 -0
- package/components/checkbox/demo/design.md +149 -0
- package/components/checkbox/demo/getting-started.html +52 -0
- package/components/checkbox/demo/getting-started.md +261 -0
- package/components/checkbox/demo/index.html +17 -20
- package/components/checkbox/demo/index.md +144 -29
- package/components/checkbox/demo/index.min.js +5 -4
- package/components/checkbox/demo/keyboard-behavior.html +49 -0
- package/components/checkbox/demo/keyboard-behavior.md +0 -3
- package/components/checkbox/demo/layout.md +30 -0
- package/components/checkbox/demo/readme.html +10 -17
- package/components/checkbox/demo/readme.md +11 -27
- package/components/checkbox/demo/styles.css +974 -0
- package/components/checkbox/demo/voiceover.html +49 -0
- package/components/checkbox/demo/voiceover.md +37 -0
- package/components/checkbox/dist/auro-checkbox.d.ts +1 -0
- package/components/checkbox/dist/index.js +5 -4
- package/components/checkbox/dist/registered.js +5 -4
- package/components/combobox/README.md +8 -29
- package/components/combobox/demo/accessibility.html +2 -20
- package/components/combobox/demo/accessibility.md +1 -1
- package/components/combobox/demo/api.html +5 -52
- package/components/combobox/demo/api.md +53 -2261
- package/components/combobox/demo/api.min.js +15 -12
- package/components/combobox/demo/customize.html +53 -0
- package/components/combobox/demo/customize.js +24 -0
- package/components/combobox/demo/customize.md +1249 -0
- package/components/combobox/demo/customize.min.js +18132 -0
- package/components/combobox/demo/demo-support.js +60 -0
- package/components/combobox/demo/design.html +2 -43
- package/components/combobox/demo/design.md +4 -4
- package/components/combobox/demo/getting-started.html +53 -0
- package/components/combobox/demo/{install.js → getting-started.js} +2 -5
- package/components/combobox/demo/getting-started.md +397 -0
- package/components/combobox/demo/{install.min.js → getting-started.min.js} +14 -38
- package/components/combobox/demo/index.html +4 -47
- package/components/combobox/demo/index.md +3 -569
- package/components/combobox/demo/index.min.js +15 -12
- package/components/combobox/demo/keyboard-behavior.html +2 -20
- package/components/combobox/demo/keyboard-behavior.md +2 -2
- package/components/combobox/demo/layout.md +2 -2
- package/components/combobox/demo/readme.html +2 -43
- package/components/combobox/demo/readme.md +8 -29
- package/components/combobox/demo/styles.css +98 -105
- package/components/combobox/demo/voiceover.html +2 -20
- package/components/combobox/demo/voiceover.md +1 -1
- package/components/combobox/dist/index.js +12 -10
- package/components/combobox/dist/registered.js +12 -10
- package/components/counter/README.md +21 -51
- package/components/counter/demo/accessibility.html +49 -0
- package/components/counter/demo/accessibility.md +34 -0
- package/components/counter/demo/api.html +12 -20
- package/components/counter/demo/api.md +49 -1299
- package/components/counter/demo/api.min.js +6 -6
- package/components/counter/demo/customize.html +53 -0
- package/components/counter/demo/customize.md +650 -0
- package/components/counter/demo/demo-support.js +60 -0
- package/components/counter/demo/design.html +52 -0
- package/components/counter/demo/design.md +192 -0
- package/components/counter/demo/getting-started.html +54 -0
- package/components/counter/demo/getting-started.md +332 -0
- package/components/counter/demo/index.html +14 -19
- package/components/counter/demo/index.md +113 -47
- package/components/counter/demo/index.min.js +6 -6
- package/components/counter/demo/keyboard-behavior.html +49 -0
- package/components/counter/demo/keyboard-behavior.md +1 -1
- package/components/counter/demo/keyboardBehavior.html +7 -39
- package/components/counter/demo/layout.md +10 -0
- package/components/counter/demo/readme.html +11 -15
- package/components/counter/demo/readme.md +21 -51
- package/components/counter/demo/styles.css +974 -0
- package/components/counter/demo/voiceover.html +51 -0
- package/components/counter/demo/voiceover.md +80 -0
- package/components/counter/dist/index.js +6 -6
- package/components/counter/dist/registered.js +6 -6
- package/components/datepicker/README.md +10 -24
- package/components/datepicker/demo/accessibility.html +50 -0
- package/components/datepicker/demo/accessibility.md +64 -0
- package/components/datepicker/demo/api.md +69 -1739
- package/components/datepicker/demo/api.min.js +14 -14
- package/components/datepicker/demo/customize.html +53 -0
- package/components/datepicker/demo/customize.md +723 -0
- package/components/datepicker/demo/demo-support.js +60 -0
- package/components/{select/demo/layout.html → datepicker/demo/design.html} +7 -47
- package/components/datepicker/demo/design.md +158 -0
- package/components/datepicker/demo/getting-started.html +53 -0
- package/components/datepicker/demo/getting-started.md +237 -0
- package/components/datepicker/demo/index.html +14 -34
- package/components/datepicker/demo/index.md +160 -103
- package/components/datepicker/demo/index.min.js +14 -14
- package/components/datepicker/demo/keyboard-behavior.html +12 -33
- package/components/datepicker/demo/layout.md +92 -0
- package/components/datepicker/demo/readme.md +10 -24
- package/components/datepicker/demo/styles.css +974 -0
- package/components/{dropdown/demo/keyboardBehavior.html → datepicker/demo/voiceover.html} +14 -36
- package/components/datepicker/demo/voiceover.md +98 -0
- package/components/datepicker/dist/index.js +14 -14
- package/components/datepicker/dist/registered.js +14 -14
- package/components/dropdown/README.md +0 -25
- package/components/dropdown/demo/accessibility.html +49 -0
- package/components/dropdown/demo/accessibility.md +45 -0
- package/components/dropdown/demo/api.html +10 -19
- package/components/dropdown/demo/api.md +40 -1364
- package/components/dropdown/demo/api.min.js +2 -2
- package/components/dropdown/demo/customize.html +54 -0
- package/components/dropdown/demo/customize.md +780 -0
- package/components/dropdown/demo/demo-support.js +60 -0
- package/components/dropdown/demo/design.html +52 -0
- package/components/dropdown/demo/design.md +186 -0
- package/components/dropdown/demo/getting-started.html +54 -0
- package/components/dropdown/demo/getting-started.md +317 -0
- package/components/dropdown/demo/index.html +12 -20
- package/components/dropdown/demo/index.md +70 -225
- package/components/dropdown/demo/index.min.js +2 -2
- package/components/dropdown/demo/keyboard-behavior.html +49 -0
- package/components/dropdown/demo/keyboard-behavior.md +4 -8
- package/components/dropdown/demo/layout.md +21 -0
- package/components/dropdown/demo/readme.html +7 -20
- package/components/dropdown/demo/readme.md +0 -25
- package/components/dropdown/demo/styles.css +974 -0
- package/components/dropdown/demo/voiceover.html +51 -0
- package/components/dropdown/demo/voiceover.md +63 -0
- package/components/dropdown/dist/index.js +2 -2
- package/components/dropdown/dist/registered.js +2 -2
- package/components/form/README.md +9 -13
- package/components/form/demo/accessibility.html +51 -0
- package/components/form/demo/accessibility.md +23 -0
- package/components/form/demo/api.html +11 -14
- package/components/form/demo/api.md +14 -290
- package/components/form/demo/api.min.js +53 -50
- package/components/form/demo/customize.html +54 -0
- package/components/form/demo/customize.md +246 -0
- package/components/form/demo/demo-support.js +60 -0
- package/components/form/demo/getting-started.html +54 -0
- package/components/form/demo/getting-started.md +291 -0
- package/components/form/demo/index.html +12 -14
- package/components/form/demo/index.md +66 -96
- package/components/form/demo/index.min.js +53 -50
- package/components/form/demo/keyboard-behavior.html +51 -0
- package/components/form/demo/readme.html +12 -17
- package/components/form/demo/readme.md +9 -13
- package/components/form/demo/styles.css +974 -0
- package/components/form/demo/voiceover.html +51 -0
- package/components/form/demo/voiceover.md +36 -0
- package/components/helptext/dist/index.js +1 -1
- package/components/helptext/dist/registered.js +1 -1
- package/components/input/README.md +17 -28
- package/components/input/demo/accessibility.html +38 -0
- package/components/input/demo/accessibility.md +69 -0
- package/components/input/demo/api.html +17 -22
- package/components/input/demo/api.js +4 -23
- package/components/input/demo/api.md +67 -1267
- package/components/input/demo/api.min.js +6 -98
- package/components/input/demo/customize.html +54 -0
- package/components/input/demo/customize.js +25 -0
- package/components/input/demo/customize.md +1372 -0
- package/components/input/demo/customize.min.js +7431 -0
- package/components/input/demo/demo-support.js +60 -0
- package/components/input/demo/design.html +39 -0
- package/components/input/demo/design.md +224 -0
- package/components/input/demo/getting-started.html +53 -0
- package/components/input/demo/getting-started.js +8 -0
- package/components/input/demo/getting-started.md +312 -0
- package/components/input/demo/getting-started.min.js +7369 -0
- package/components/input/demo/index.html +16 -22
- package/components/input/demo/index.js +0 -11
- package/components/input/demo/index.md +171 -139
- package/components/input/demo/index.min.js +6 -18
- package/components/input/demo/keyboard-behavior.html +38 -0
- package/components/input/demo/layout.md +77 -0
- package/components/input/demo/readme.md +17 -28
- package/components/input/demo/styles.css +974 -0
- package/components/input/demo/voiceover.html +38 -0
- package/components/input/demo/voiceover.md +70 -0
- package/components/input/dist/base-input.d.ts +1 -0
- package/components/input/dist/index.js +6 -6
- package/components/input/dist/registered.js +6 -6
- package/components/menu/README.md +1 -5
- package/components/menu/demo/api.md +43 -43
- package/components/menu/demo/api.min.js +2 -2
- package/components/menu/demo/index.md +1 -1
- package/components/menu/demo/index.min.js +2 -2
- package/components/menu/demo/readme.md +1 -5
- package/components/menu/dist/index.js +2 -2
- package/components/menu/dist/registered.js +2 -2
- package/components/radio/README.md +9 -22
- package/components/radio/demo/accessibility.html +51 -0
- package/components/radio/demo/accessibility.md +44 -0
- package/components/radio/demo/api.html +13 -20
- package/components/radio/demo/api.md +44 -589
- package/components/radio/demo/api.min.js +3 -3
- package/components/radio/demo/customize.html +53 -0
- package/components/radio/demo/customize.md +368 -0
- package/components/radio/demo/demo-support.js +60 -0
- package/components/radio/demo/design.html +52 -0
- package/components/radio/demo/design.md +143 -0
- package/components/radio/demo/getting-started.html +54 -0
- package/components/radio/demo/getting-started.md +296 -0
- package/components/radio/demo/index.html +16 -19
- package/components/radio/demo/index.md +110 -45
- package/components/radio/demo/index.min.js +3 -3
- package/components/radio/demo/keyboard-behavior.html +51 -0
- package/components/radio/demo/layout.md +30 -0
- package/components/radio/demo/readme.html +11 -17
- package/components/radio/demo/readme.md +9 -22
- package/components/radio/demo/styles.css +974 -0
- package/components/radio/demo/voiceover.html +51 -0
- package/components/radio/demo/voiceover.md +43 -0
- package/components/radio/dist/index.js +3 -3
- package/components/radio/dist/registered.js +3 -3
- package/components/select/README.md +7 -4
- package/components/select/demo/accessibility.html +5 -21
- package/components/select/demo/accessibility.md +1 -1
- package/components/select/demo/api.html +3 -48
- package/components/select/demo/api.md +52 -2342
- package/components/select/demo/customize.html +54 -0
- package/components/select/demo/customize.js +11 -0
- package/components/select/demo/customize.md +1049 -0
- package/components/select/demo/{api.min.js → customize.min.js} +12 -113
- package/components/select/demo/demo-support.js +60 -0
- package/components/select/demo/design.html +3 -44
- package/components/select/demo/design.md +2 -2
- package/components/select/demo/getting-started.html +5 -76
- package/components/select/demo/getting-started.js +20 -3
- package/components/select/demo/getting-started.md +97 -705
- package/components/select/demo/getting-started.min.js +58 -9
- package/components/select/demo/index.html +4 -43
- package/components/select/demo/index.js +5 -3
- package/components/select/demo/index.md +2 -2
- package/components/select/demo/index.min.js +14 -9
- package/components/select/demo/keyboard-behavior.html +6 -47
- package/components/select/demo/keyboard-behavior.md +5 -6
- package/components/select/demo/keyboardBehavior.html +4 -46
- package/components/select/demo/readme.html +3 -44
- package/components/select/demo/readme.md +7 -4
- package/components/select/demo/styles.css +57 -109
- package/components/select/demo/voiceover.html +3 -30
- package/components/select/dist/index.js +5 -5
- package/components/select/dist/registered.js +5 -5
- package/custom-elements.json +249 -246
- package/package.json +3 -3
- package/components/combobox/demo/install.html +0 -94
- package/components/combobox/demo/install.md +0 -98
- package/components/select/demo/api.js +0 -39
- package/components/select/demo/install.md +0 -92
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {unified} from 'https://esm.sh/unified';
|
|
2
|
+
import remarkParse from 'https://esm.sh/remark-parse';
|
|
3
|
+
import remarkGfm from 'https://esm.sh/remark-gfm';
|
|
4
|
+
import remarkRehype from 'https://esm.sh/remark-rehype';
|
|
5
|
+
import rehypeRaw from 'https://esm.sh/rehype-raw';
|
|
6
|
+
import rehypeHighlight from 'https://esm.sh/rehype-highlight';
|
|
7
|
+
import rehypeStringify from 'https://esm.sh/rehype-stringify';
|
|
8
|
+
|
|
9
|
+
export async function renderPage(mdPath) {
|
|
10
|
+
const response = await fetch(mdPath);
|
|
11
|
+
const text = await response.text();
|
|
12
|
+
const result = await unified()
|
|
13
|
+
.use(remarkParse)
|
|
14
|
+
.use(remarkGfm)
|
|
15
|
+
.use(remarkRehype, { allowDangerousHtml: true })
|
|
16
|
+
.use(rehypeRaw)
|
|
17
|
+
.use(rehypeHighlight)
|
|
18
|
+
.use(rehypeStringify)
|
|
19
|
+
.process(text);
|
|
20
|
+
|
|
21
|
+
document.querySelector('main').innerHTML = String(result);
|
|
22
|
+
addCopyButtons();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function addCopyButtons() {
|
|
26
|
+
document.querySelectorAll('pre code[class*="language-"], pre code[class*="hljs"]').forEach((code) => {
|
|
27
|
+
const pre = code.parentElement;
|
|
28
|
+
const wrapper = document.createElement('div');
|
|
29
|
+
wrapper.className = 'pre-wrapper';
|
|
30
|
+
pre.parentNode.insertBefore(wrapper, pre);
|
|
31
|
+
wrapper.appendChild(pre);
|
|
32
|
+
const btn = document.createElement('button');
|
|
33
|
+
btn.className = 'copy-btn';
|
|
34
|
+
btn.textContent = 'Copy';
|
|
35
|
+
btn.addEventListener('click', () => {
|
|
36
|
+
const raw = code.textContent;
|
|
37
|
+
const text = raw.replace(/\u200B/g, '').replace(/^\n+/, '').replace(/\n+$/, '\n').replace(/^\$ /, '');
|
|
38
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
39
|
+
btn.textContent = 'Copied!';
|
|
40
|
+
setTimeout(() => { btn.textContent = 'Copy'; }, 1500);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
wrapper.appendChild(btn);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function openAccordion(id) {
|
|
48
|
+
document.querySelectorAll('auro-accordion').forEach((accordion) => {
|
|
49
|
+
accordion.removeAttribute('expanded');
|
|
50
|
+
});
|
|
51
|
+
const target = document.getElementById(id);
|
|
52
|
+
if (target) {
|
|
53
|
+
target.setAttribute('expanded', '');
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
56
|
+
}, 550);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
window.openAccordion = openAccordion;
|
|
@@ -39,49 +39,8 @@
|
|
|
39
39
|
<main></main>
|
|
40
40
|
|
|
41
41
|
<script type="module">
|
|
42
|
-
import {
|
|
43
|
-
|
|
44
|
-
import remarkGfm from 'https://esm.sh/remark-gfm';
|
|
45
|
-
import remarkRehype from 'https://esm.sh/remark-rehype';
|
|
46
|
-
import rehypeRaw from 'https://esm.sh/rehype-raw';
|
|
47
|
-
import rehypeHighlight from 'https://esm.sh/rehype-highlight';
|
|
48
|
-
import rehypeStringify from 'https://esm.sh/rehype-stringify';
|
|
49
|
-
|
|
50
|
-
const response = await fetch('./design.md');
|
|
51
|
-
const text = await response.text();
|
|
52
|
-
const result = await unified()
|
|
53
|
-
.use(remarkParse)
|
|
54
|
-
.use(remarkGfm)
|
|
55
|
-
.use(remarkRehype, { allowDangerousHtml: true })
|
|
56
|
-
.use(rehypeRaw)
|
|
57
|
-
.use(rehypeHighlight)
|
|
58
|
-
.use(rehypeStringify)
|
|
59
|
-
.process(text);
|
|
60
|
-
|
|
61
|
-
document.querySelector('main').innerHTML = String(result);
|
|
62
|
-
addCopyButtons();
|
|
63
|
-
|
|
64
|
-
function addCopyButtons() {
|
|
65
|
-
document.querySelectorAll('pre code[class*="language-"], pre code[class*="hljs"]').forEach((code) => {
|
|
66
|
-
const pre = code.parentElement;
|
|
67
|
-
const wrapper = document.createElement('div');
|
|
68
|
-
wrapper.className = 'pre-wrapper';
|
|
69
|
-
pre.parentNode.insertBefore(wrapper, pre);
|
|
70
|
-
wrapper.appendChild(pre);
|
|
71
|
-
const btn = document.createElement('button');
|
|
72
|
-
btn.className = 'copy-btn';
|
|
73
|
-
btn.textContent = 'Copy';
|
|
74
|
-
btn.addEventListener('click', () => {
|
|
75
|
-
const raw = code.textContent;
|
|
76
|
-
const text = raw.replace(/\u200B/g, '').replace(/^\n+/, '').replace(/\n+$/, '\n').replace(/^\$ /, '');
|
|
77
|
-
navigator.clipboard.writeText(text).then(() => {
|
|
78
|
-
btn.textContent = 'Copied!';
|
|
79
|
-
setTimeout(() => { btn.textContent = 'Copy'; }, 1500);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
wrapper.appendChild(btn);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
42
|
+
import { renderPage } from './demo-support.js';
|
|
43
|
+
await renderPage('./design.md');
|
|
85
44
|
</script>
|
|
86
45
|
|
|
87
46
|
<!-- If additional elements are needed for the demo, add them here. -->
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<div class="mainContent">
|
|
4
4
|
<div class="scrollWrapper">
|
|
5
5
|
<auro-header level="3" id="anatomy">Component Anatomy</auro-header>
|
|
6
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/layout.md) -->
|
|
7
|
-
<!-- The below content is automatically added from ./../docs/partials/layout.md -->
|
|
6
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/layout/layout.md) -->
|
|
7
|
+
<!-- The below content is automatically added from ./../docs/partials/layout/layout.md -->
|
|
8
8
|
<p>The component consists of the following elements:</p>
|
|
9
9
|
<ul>
|
|
10
10
|
<li>
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
<!-- The below content is automatically added from ./../apiExamples/appearance-inverse.html -->
|
|
88
88
|
<auro-combobox appearance="inverse">
|
|
89
89
|
<span slot="bib.fullscreen.headline">Bib Header</span>
|
|
90
|
-
<span slot="label">
|
|
90
|
+
<span slot="label">Inverse Appearance</span>
|
|
91
91
|
<auro-menu>
|
|
92
92
|
<auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
|
|
93
93
|
<auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
<!-- The below code snippet is automatically added from ./../apiExamples/appearance-inverse.html -->
|
|
106
106
|
<pre class="language-html"><code class="language-html"><auro-combobox appearance="inverse">
|
|
107
107
|
<span slot="bib.fullscreen.headline">Bib Header</span>
|
|
108
|
-
<span slot="label">
|
|
108
|
+
<span slot="label">Inverse Appearance</span>
|
|
109
109
|
<auro-menu>
|
|
110
110
|
<auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
|
|
111
111
|
<auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
|
|
@@ -0,0 +1,53 @@
|
|
|
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/getting-started.md
|
|
7
|
+
|
|
8
|
+
----------------------- DO NOT EDIT -----------------------------
|
|
9
|
+
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
<!DOCTYPE html>
|
|
13
|
+
<html lang="en">
|
|
14
|
+
<head>
|
|
15
|
+
<meta charset="UTF-8" />
|
|
16
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
17
|
+
<title>Auro Web Component Demo | auro-combobox | Getting Started</title>
|
|
18
|
+
|
|
19
|
+
<!-- highlight.js Stylesheet -->
|
|
20
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/styles/github.min.css"/>
|
|
21
|
+
|
|
22
|
+
<!-- Legacy reference is still needed to support auro-combobox's use of legacy token values at this time -->
|
|
23
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/legacy/auro-classic/CSSCustomProperties.css"/>
|
|
24
|
+
|
|
25
|
+
<!-- Design Token Alaska Theme -->
|
|
26
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/themes/alaska/CSSCustomProperties--alaska.min.css"/>
|
|
27
|
+
|
|
28
|
+
<!-- Webcore Stylesheet Alaska Theme -->
|
|
29
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/themes/alaska.global.min.css" />
|
|
30
|
+
|
|
31
|
+
<!-- Demo Specific Styles -->
|
|
32
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
|
|
33
|
+
<link rel="stylesheet" type="text/css" href="./styles.css" />
|
|
34
|
+
</head>
|
|
35
|
+
<body class="auro-markdown">
|
|
36
|
+
<main></main>
|
|
37
|
+
|
|
38
|
+
<!-- If additional elements are needed for the demo, add them here. -->
|
|
39
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-accordion@latest/+esm" type="module"></script>
|
|
40
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-nav@latest/+esm" type="module"></script>
|
|
41
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-header@latest/+esm" type="module"></script>
|
|
42
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-hyperlink@latest/+esm" type="module"></script>
|
|
43
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-icon@latest/+esm" type="module"></script>
|
|
44
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-button@latest/+esm" type="module"></script>
|
|
45
|
+
<script type="module">
|
|
46
|
+
import { renderPage } from './demo-support.js';
|
|
47
|
+
await renderPage('./getting-started.md');
|
|
48
|
+
import { initExamples } from "./getting-started.min.js";
|
|
49
|
+
initExamples();
|
|
50
|
+
</script>
|
|
51
|
+
<script src="./getting-started.min.js" data-demo-script="true" type="module"></script>
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */
|
|
2
2
|
|
|
3
|
-
import { swapValueExample } from '../apiExamples/swap-value';
|
|
4
|
-
|
|
5
3
|
import { AuroCombobox } from '../src/auro-combobox.js';
|
|
6
4
|
import '../../menu/src/registered.js';
|
|
7
5
|
|
|
@@ -12,10 +10,9 @@ export function initExamples(initCount) {
|
|
|
12
10
|
initCount = initCount || 0;
|
|
13
11
|
|
|
14
12
|
try {
|
|
15
|
-
|
|
16
|
-
} catch {
|
|
13
|
+
// Add any example initialization code here.
|
|
14
|
+
} catch (err) {
|
|
17
15
|
if (initCount <= 20) {
|
|
18
|
-
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
19
16
|
setTimeout(() => {
|
|
20
17
|
initExamples(initCount + 1);
|
|
21
18
|
}, 100);
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
<auro-header level="1" id="overview">Combobox - Getting Started</auro-header>
|
|
2
|
+
<div class="contentWrapper">
|
|
3
|
+
<nav>
|
|
4
|
+
<auro-nav anchorNavContent=".scrollWrapper">
|
|
5
|
+
<span slot="mobileToggleCollapsed">View More</span>
|
|
6
|
+
<span slot="mobileToggleExpanded">View Less</span>
|
|
7
|
+
<auro-anchorlink fluid href="#setup">Setup</auro-anchorlink>
|
|
8
|
+
<auro-anchorlink fluid href="#recommendedSetup" class="level2 body-xs" onclick="openAccordion('recommendedAccordion')">Recommended</auro-anchorlink>
|
|
9
|
+
<auro-anchorlink fluid href="#autoSetup" class="level2 body-xs" onclick="openAccordion('autoAccordion')">Auto</auro-anchorlink>
|
|
10
|
+
<auro-anchorlink fluid href="#cdnSetup" class="level2 body-xs" onclick="openAccordion('cdnAccordion')">CDN</auro-anchorlink>
|
|
11
|
+
<auro-anchorlink fluid href="#frameworks">Frameworks</auro-anchorlink>
|
|
12
|
+
<auro-anchorlink fluid href="#react" class="level2 body-xs" onclick="openAccordion('react')">React</auro-anchorlink>
|
|
13
|
+
<auro-anchorlink fluid href="#svelte" class="level2 body-xs" onclick="openAccordion('svelte')">Svelte</auro-anchorlink>
|
|
14
|
+
<auro-anchorlink fluid href="#minimalConfig">Minimal Config</auro-anchorlink>
|
|
15
|
+
<auro-anchorlink fluid href="#slots">Slots</auro-anchorlink>
|
|
16
|
+
<auro-anchorlink fluid href="#slot-default" class="level2 body-xs">(default)</auro-anchorlink>
|
|
17
|
+
<auro-anchorlink fluid href="#slot-label" class="level2 body-xs">label</auro-anchorlink>
|
|
18
|
+
<auro-anchorlink fluid href="#slot-helpText" class="level2 body-xs">helpText</auro-anchorlink>
|
|
19
|
+
<auro-anchorlink fluid href="#slot-optionalLabel" class="level2 body-xs">optionalLabel</auro-anchorlink>
|
|
20
|
+
<auro-anchorlink fluid href="#slot-displayValue" class="level2 body-xs">displayValue</auro-anchorlink>
|
|
21
|
+
<auro-anchorlink fluid href="#slot-ariaLabel-input-clear" class="level2 body-xs">ariaLabel.input.clear</auro-anchorlink>
|
|
22
|
+
<auro-anchorlink fluid href="#slot-ariaLabel-bib-close" class="level2 body-xs">ariaLabel.bib.close</auro-anchorlink>
|
|
23
|
+
<auro-anchorlink fluid href="#slot-bib-fullscreen-headline" class="level2 body-xs">bib.fullscreen.headline</auro-anchorlink>
|
|
24
|
+
<auro-anchorlink fluid href="#stateManagement">State Management</auro-anchorlink>
|
|
25
|
+
<auro-anchorlink fluid href="#inputValue" class="level2 body-xs">inputValue</auro-anchorlink>
|
|
26
|
+
<auro-anchorlink fluid href="#optionSelected" class="level2 body-xs">optionSelected</auro-anchorlink>
|
|
27
|
+
<auro-anchorlink fluid href="#typedValue" class="level2 body-xs">typedValue</auro-anchorlink>
|
|
28
|
+
<auro-anchorlink fluid href="#validity" class="level2 body-xs">Validity</auro-anchorlink>
|
|
29
|
+
<auro-anchorlink fluid href="#value" class="level2 body-xs">Value</auro-anchorlink>
|
|
30
|
+
<auro-anchorlink fluid href="#publicFunctions">Functions</auro-anchorlink>
|
|
31
|
+
<auro-anchorlink fluid href="#clear" class="level2 body-xs">clear()</auro-anchorlink>
|
|
32
|
+
<auro-anchorlink fluid href="#focus" class="level2 body-xs">focus()</auro-anchorlink>
|
|
33
|
+
<auro-anchorlink fluid href="#reset" class="level2 body-xs">reset()</auro-anchorlink>
|
|
34
|
+
<auro-anchorlink fluid href="#validate" class="level2 body-xs">validate()</auro-anchorlink>
|
|
35
|
+
<auro-anchorlink fluid href="#hideBib" class="level2 body-xs">hideBib()</auro-anchorlink>
|
|
36
|
+
<auro-anchorlink fluid href="#showBib" class="level2 body-xs">showBib()</auro-anchorlink>
|
|
37
|
+
</auro-nav>
|
|
38
|
+
</nav>
|
|
39
|
+
<div class="mainContent">
|
|
40
|
+
<div class="scrollWrapper">
|
|
41
|
+
<section>
|
|
42
|
+
<auro-header level="2" id="setup">Setup</auro-header>
|
|
43
|
+
<auro-accordion-group Emphasis>
|
|
44
|
+
<auro-accordion expanded class="section" id="recommendedAccordion">
|
|
45
|
+
<span slot="trigger">Recommended Installation and Implementation</span>
|
|
46
|
+
<div class="accordion-content">
|
|
47
|
+
<auro-header level="3">Install</auro-header>
|
|
48
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../../docs/templates/componentInstall.md) -->
|
|
49
|
+
<!-- The below content is automatically added from ./../../../docs/templates/componentInstall.md -->
|
|
50
|
+
<pre class="language-shell"><code class="language-shell">$ npm i @aurodesignsystem/auro-formkit</code></pre>
|
|
51
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
52
|
+
<auro-header level="3">Implementation</auro-header>
|
|
53
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/customRegistration.md) -->
|
|
54
|
+
<!-- The below content is automatically added from ./../docs/partials/customRegistration.md -->
|
|
55
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../../docs/partials/customRegistrationDescription.md) -->
|
|
56
|
+
<!-- The below content is automatically added from ./../../../docs/partials/customRegistrationDescription.md -->
|
|
57
|
+
<p>Every Auro component consists of a JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</a> and a <a href="https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define">custom element registration</a>. The class defines the component's behavior, and the registration maps it to an HTML tag name so it can be used in markup.</p>
|
|
58
|
+
<p>The default import (shown above) handles both steps automatically, registering the component under its standard tag name.</p>
|
|
59
|
+
<p>If you need multiple versions of the same component on a single page — for example, when two projects depend on different versions — you can register the class under a custom tag name to avoid conflicts.</p>
|
|
60
|
+
<p>To do this, import the component class directly and call its <code>register(name)</code> method with a unique name:</p>
|
|
61
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
62
|
+
<pre class="language-js"><code class="language-js">// Import the class only
|
|
63
|
+
import { AuroCombobox } from '@aurodesignsystem/auro-formkit/auro-combobox/class';
|
|
64
|
+
|
|
65
|
+
// Register with a custom name if desired
|
|
66
|
+
AuroCombobox.register('custom-combobox');</code></pre>
|
|
67
|
+
|
|
68
|
+
This will create a new custom element `<custom-combobox>` that behaves exactly like `<auro-combobox>`, allowing both to coexist on the same page without interfering with each other.
|
|
69
|
+
|
|
70
|
+
<pre class="language-html"><code class="language-html"><custom-combobox>
|
|
71
|
+
<span slot="bib.fullscreen.headline">Bib Header</span>
|
|
72
|
+
<span slot="label">Name</span>
|
|
73
|
+
<auro-menu>
|
|
74
|
+
<auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
|
|
75
|
+
<auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
|
|
76
|
+
<auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
|
|
77
|
+
<auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
|
|
78
|
+
<auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
|
|
79
|
+
<auro-menuoption static nomatch>No matching option</auro-menuoption>
|
|
80
|
+
</auro-menu>
|
|
81
|
+
</custom-combobox></code></pre>
|
|
82
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
83
|
+
</div>
|
|
84
|
+
</auro-accordion>
|
|
85
|
+
<auro-accordion class="section" id="autoAccordion">
|
|
86
|
+
<span slot="trigger">Auto Installation and Implementation</span>
|
|
87
|
+
<div class="accordion-content">
|
|
88
|
+
<p class="warning"><strong>Warning:</strong> Default registration can cause conflicts if another package registers the same tag name using a different version of the component, leading to unexpected behavior. Use custom registration to avoid this risk.</p>
|
|
89
|
+
<auro-header level="3">Install</auro-header>
|
|
90
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../../docs/templates/componentInstall.md) -->
|
|
91
|
+
<!-- The below content is automatically added from ./../../../docs/templates/componentInstall.md -->
|
|
92
|
+
<pre class="language-shell"><code class="language-shell">$ npm i @aurodesignsystem/auro-formkit</code></pre>
|
|
93
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
94
|
+
<auro-header level="3">Implementation</auro-header>
|
|
95
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/defaultRegistration.md) -->
|
|
96
|
+
<!-- The below content is automatically added from ./../docs/partials/getting-started/defaultRegistration.md -->
|
|
97
|
+
<p>Once installed, the component can be used in your project by importing the component's registered module:</p>
|
|
98
|
+
<pre class="language-js"><code class="language-js">import '@aurodesignsystem/auro-formkit/auro-combobox';</code></pre>
|
|
99
|
+
<p>This import registers the <code><auro-combobox></code> custom element globally. You can then use it in your HTML:</p>
|
|
100
|
+
<pre class="language-html"><code class="language-html"><auro-combobox>
|
|
101
|
+
<span slot="label">Choose an option</span>
|
|
102
|
+
<auro-menu>
|
|
103
|
+
<auro-menuoption value="option1">Option 1</auro-menuoption>
|
|
104
|
+
<auro-menuoption value="option2">Option 2</auro-menuoption>
|
|
105
|
+
<auro-menuoption static nomatch>No matching option</auro-menuoption>
|
|
106
|
+
</auro-menu>
|
|
107
|
+
</auro-combobox></code></pre>
|
|
108
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
109
|
+
</div>
|
|
110
|
+
</auro-accordion>
|
|
111
|
+
<auro-accordion class="section" id="cdnAccordion">
|
|
112
|
+
<span slot="trigger">CDN Installation and Implementation</span>
|
|
113
|
+
<div class="accordion-content">
|
|
114
|
+
<p class="warning"><strong>Warning:</strong> CDN install & registration can cause conflicts if another package registers the same tag name using a different version of the component, leading to unexpected behavior. Use custom registration to avoid this risk.</p>
|
|
115
|
+
<auro-header level="3">Install & Implementation</auro-header>
|
|
116
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/cdnRegistration.md) -->
|
|
117
|
+
<!-- The below content is automatically added from ./../docs/partials/getting-started/cdnRegistration.md -->
|
|
118
|
+
<p>Add the following script tag to your HTML to load the component directly from a CDN:</p>
|
|
119
|
+
<pre class="language-html"><code class="language-html"><script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@latest/auro-combobox/+esm"></script></code></pre>
|
|
120
|
+
<p>This script registers the <code><auro-combobox></code> custom element globally. You can then use it in your HTML:</p>
|
|
121
|
+
<pre class="language-html"><code class="language-html"><auro-combobox>
|
|
122
|
+
<span slot="label">Choose an option</span>
|
|
123
|
+
<auro-menu>
|
|
124
|
+
<auro-menuoption value="option1">Option 1</auro-menuoption>
|
|
125
|
+
<auro-menuoption value="option2">Option 2</auro-menuoption>
|
|
126
|
+
<auro-menuoption static nomatch>No matching option</auro-menuoption>
|
|
127
|
+
</auro-menu>
|
|
128
|
+
</auro-combobox></code></pre>
|
|
129
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
130
|
+
</div>
|
|
131
|
+
</auro-accordion>
|
|
132
|
+
</auro-accordion-group>
|
|
133
|
+
</section>
|
|
134
|
+
<section>
|
|
135
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/frameworks.md) -->
|
|
136
|
+
<!-- The below content is automatically added from ./../docs/partials/getting-started/frameworks.md -->
|
|
137
|
+
<auro-header level="2" id="frameworks">Frameworks</auro-header>
|
|
138
|
+
<auro-accordion-group Emphasis>
|
|
139
|
+
<auro-accordion class="section" id="react">
|
|
140
|
+
<span slot="trigger">React</span>
|
|
141
|
+
<div class="accordion-content">
|
|
142
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/react.md) -->
|
|
143
|
+
<!-- The below content is automatically added from ./../docs/partials/getting-started/react.md -->
|
|
144
|
+
React 19 includes <a href="https://react.dev/blog/2024/12/05/react-19#support-for-custom-elements">native support for custom elements</a>, so <code><auro-combobox></code> works directly in JSX without any wrapper library.
|
|
145
|
+
|
|
146
|
+
<auro-header level="3" id="reactImport">Import the Component</auro-header>
|
|
147
|
+
Import and register the components at the top level of your application (e.g. in your root `main.tsx` or `App.tsx`):
|
|
148
|
+
|
|
149
|
+
<pre class="language-js"><code class="language-js">import { AuroCombobox } from '@aurodesignsystem/auro-formkit/auro-combobox/class';
|
|
150
|
+
import { AuroMenu, AuroMenuOption } from '@aurodesignsystem/auro-formkit/auro-menu/class';
|
|
151
|
+
|
|
152
|
+
AuroCombobox.register('[custom]-combobox');
|
|
153
|
+
AuroMenu.register('[custom]-menu');
|
|
154
|
+
AuroMenuOption.register('[custom]-menuoption');</code></pre>
|
|
155
|
+
|
|
156
|
+
<auro-header level="3" id="reactTypeScript">TypeScript Declarations</auro-header>
|
|
157
|
+
The component ships with TypeScript type definitions for the `AuroCombobox` class. However, React's JSX does not automatically map custom element tag names to their types. To get type checking for `<auro-combobox>` in JSX, add the following declaration to a `.d.ts` file in your project:
|
|
158
|
+
|
|
159
|
+
<pre class="language-js"><code class="language-js">import type { AuroCombobox } from '@aurodesignsystem/auro-formkit/auro-combobox/class';
|
|
160
|
+
import type { AuroMenu, AuroMenuOption } from '@aurodesignsystem/auro-menu/auro-menu/class';
|
|
161
|
+
|
|
162
|
+
declare global {
|
|
163
|
+
namespace JSX {
|
|
164
|
+
interface IntrinsicElements {
|
|
165
|
+
'[custom]-combobox': React.HTMLAttributes<AuroCombobox> & Partial<AuroCombobox>;
|
|
166
|
+
'[custom]-menu': React.HTMLAttributes<AuroMenu> & Partial<AuroMenu>;
|
|
167
|
+
'[custom]-menuoption': React.HTMLAttributes<AuroMenuOption> & Partial<AuroMenuOption>;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}</code></pre>
|
|
171
|
+
|
|
172
|
+
<auro-header level="3" id="reactEvents">Event Handling</auro-header>
|
|
173
|
+
Auro components emit native `CustomEvent`s. Use a `ref` to attach event listeners in a `useEffect`:
|
|
174
|
+
|
|
175
|
+
<pre class="language-js"><code class="language-js">import { useRef, useEffect } from 'react';
|
|
176
|
+
|
|
177
|
+
const options = [
|
|
178
|
+
{ id: 'opt-1', value: 'SEA', label: 'Seattle-Tacoma International' },
|
|
179
|
+
{ id: 'opt-2', value: 'LAX', label: 'Los Angeles International' },
|
|
180
|
+
{ id: 'opt-3', value: 'JFK', label: 'John F. Kennedy International' },
|
|
181
|
+
{ id: 'opt-4', value: 'ORD', label: "O'Hare International" },
|
|
182
|
+
];
|
|
183
|
+
|
|
184
|
+
function MyCombobox() {
|
|
185
|
+
const comboboxRef = useRef<HTMLElement>(null);
|
|
186
|
+
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
const el = comboboxRef.current;
|
|
189
|
+
if (!el) return;
|
|
190
|
+
|
|
191
|
+
const handleInput = () => {
|
|
192
|
+
console.log('Selected value:', (el as any).value);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
el.addEventListener('input', handleInput);
|
|
196
|
+
return () => el.removeEventListener('input', handleInput);
|
|
197
|
+
}, []);
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<custom-combobox ref={comboboxRef}>
|
|
201
|
+
<span slot="label">Search airports</span>
|
|
202
|
+
<custom-menu>
|
|
203
|
+
{options.map(({ id, value, label }) => (
|
|
204
|
+
<custom-menuoption key={id} value={value}>{label}</custom-menuoption>
|
|
205
|
+
))}
|
|
206
|
+
<custom-menuoption static nomatch>No matching airport</custom-menuoption>
|
|
207
|
+
</custom-menu>
|
|
208
|
+
</custom-combobox>
|
|
209
|
+
);
|
|
210
|
+
}</code></pre>
|
|
211
|
+
|
|
212
|
+
<auro-header level="3" id="reactModuleResolution">Module Resolution</auro-header>
|
|
213
|
+
Ensure your `tsconfig.json` uses `"moduleResolution": "bundler"` so TypeScript can resolve the component's package exports:
|
|
214
|
+
|
|
215
|
+
<pre class="language-js"><code class="language-js">{
|
|
216
|
+
"compilerOptions": {
|
|
217
|
+
"moduleResolution": "bundler"
|
|
218
|
+
}
|
|
219
|
+
}</code></pre>
|
|
220
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
221
|
+
</div>
|
|
222
|
+
</auro-accordion>
|
|
223
|
+
<auro-accordion class="section" id="svelte">
|
|
224
|
+
<span slot="trigger">Svelte</span>
|
|
225
|
+
<div class="accordion-content">
|
|
226
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/svelte.md) -->
|
|
227
|
+
<!-- The below content is automatically added from ./../docs/partials/getting-started/svelte.md -->
|
|
228
|
+
Svelte has <a href="https://svelte.dev/docs/svelte/custom-elements">native support for custom elements</a>, so <code><auro-combobox></code> works directly in Svelte templates without any wrapper or configuration.
|
|
229
|
+
|
|
230
|
+
<auro-header level="3" id="svelteImport">Import the Component</auro-header>
|
|
231
|
+
Import and register the components in the `<script>` block:
|
|
232
|
+
|
|
233
|
+
<pre class="language-html"><code class="language-html"><script lang="ts">
|
|
234
|
+
import { AuroCombobox } from '@aurodesignsystem/auro-formkit/auro-combobox/class';
|
|
235
|
+
import { AuroMenu, AuroMenuOption } from '@aurodesignsystem/auro-formkit/auro-menu/class';
|
|
236
|
+
|
|
237
|
+
AuroCombobox.register('[custom]-combobox');
|
|
238
|
+
AuroMenu.register('[custom]-menu');
|
|
239
|
+
AuroMenuOption.register('[custom]-menuoption');
|
|
240
|
+
</script></code></pre>
|
|
241
|
+
|
|
242
|
+
<auro-header level="3" id="svelteUsage">Basic Usage</auro-header>
|
|
243
|
+
Use `<auro-combobox>` directly in your Svelte template. Properties can be bound using standard Svelte attribute syntax:
|
|
244
|
+
|
|
245
|
+
<pre class="language-html"><code class="language-html"><script lang="ts">
|
|
246
|
+
import { AuroCombobox } from '@aurodesignsystem/auro-formkit/auro-combobox/class';
|
|
247
|
+
import { AuroMenu, AuroMenuOption } from '@aurodesignsystem/auro-formkit/auro-menu/class';
|
|
248
|
+
|
|
249
|
+
AuroCombobox.register('[custom]-combobox');
|
|
250
|
+
AuroMenu.register('[custom]-menu');
|
|
251
|
+
AuroMenuOption.register('[custom]-menuoption');
|
|
252
|
+
|
|
253
|
+
const options: [string, string][] = [
|
|
254
|
+
['SEA', 'Seattle-Tacoma International'],
|
|
255
|
+
['LAX', 'Los Angeles International'],
|
|
256
|
+
['JFK', 'John F. Kennedy International'],
|
|
257
|
+
];
|
|
258
|
+
|
|
259
|
+
let comboboxValue = $state<string>('');
|
|
260
|
+
</script>
|
|
261
|
+
<custom-combobox value={comboboxValue}>
|
|
262
|
+
<span slot="label">Search airports</span>
|
|
263
|
+
<custom-menu>
|
|
264
|
+
{#each options as [value, label]}
|
|
265
|
+
<custom-menuoption {value}>{label}</custom-menuoption>
|
|
266
|
+
{/each}
|
|
267
|
+
<custom-menuoption static nomatch>No matching airport</custom-menuoption>
|
|
268
|
+
</custom-menu>
|
|
269
|
+
</custom-combobox></code></pre>
|
|
270
|
+
|
|
271
|
+
<auro-header level="3" id="svelteTypeScript">TypeScript Declarations</auro-header>
|
|
272
|
+
Svelte does not automatically know about custom element attributes. To get autocomplete and type checking for `<auro-combobox>` props in templates, add the following to a `.d.ts` file in your project (e.g. `src/auro-elements.d.ts`):
|
|
273
|
+
|
|
274
|
+
<pre class="language-js"><code class="language-js">import type { AuroCombobox } from '@aurodesignsystem/auro-formkit/auro-combobox/class';
|
|
275
|
+
import type { AuroMenu, AuroMenuOption } from '@aurodesignsystem/auro-formkit/auro-menu/class';
|
|
276
|
+
|
|
277
|
+
declare namespace svelteHTML {
|
|
278
|
+
interface IntrinsicElements {
|
|
279
|
+
'[custom]-combobox': Partial<AuroCombobox> & svelteHTML.HTMLAttributes<AuroCombobox>;
|
|
280
|
+
'[custom]-menu': Partial<AuroMenu> & svelteHTML.HTMLAttributes<AuroMenu>;
|
|
281
|
+
'[custom]-menuoption': Partial<AuroMenuOption> & svelteHTML.HTMLAttributes<AuroMenuOption>;
|
|
282
|
+
}
|
|
283
|
+
}</code></pre>
|
|
284
|
+
|
|
285
|
+
This enables prop hinting for attributes like `value`, `disabled`, and others directly in Svelte templates.
|
|
286
|
+
|
|
287
|
+
<auro-header level="3" id="svelteEvents">Event Handling</auro-header>
|
|
288
|
+
Auro components emit native `CustomEvent`s. Use the `oninput` handler directly on the element:
|
|
289
|
+
|
|
290
|
+
<pre class="language-html"><code class="language-html"><script lang="ts">
|
|
291
|
+
let value = $state('');
|
|
292
|
+
|
|
293
|
+
function handleInput(e: Event) {
|
|
294
|
+
value = (e.target as HTMLElement & { value: string }).value;
|
|
295
|
+
}
|
|
296
|
+
</script>
|
|
297
|
+
<custom-combobox oninput={handleInput}>
|
|
298
|
+
<span slot="label">Search airports</span>
|
|
299
|
+
<custom-menu>
|
|
300
|
+
<custom-menuoption value="SEA">Seattle-Tacoma International</custom-menuoption>
|
|
301
|
+
<custom-menuoption value="LAX">Los Angeles International</custom-menuoption>
|
|
302
|
+
<custom-menuoption static nomatch>No matching airport</custom-menuoption>
|
|
303
|
+
</custom-menu>
|
|
304
|
+
</custom-combobox>
|
|
305
|
+
<p>Selected: {value}</p></code></pre>
|
|
306
|
+
|
|
307
|
+
<auro-header level="3" id="svelteModuleResolution">Module Resolution</auro-header>
|
|
308
|
+
Ensure your `tsconfig.json` uses `"moduleResolution": "bundler"` so TypeScript can resolve the component's package exports:
|
|
309
|
+
|
|
310
|
+
<pre class="language-js"><code class="language-js">{
|
|
311
|
+
"compilerOptions": {
|
|
312
|
+
"moduleResolution": "bundler"
|
|
313
|
+
}
|
|
314
|
+
}</code></pre>
|
|
315
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
316
|
+
</div>
|
|
317
|
+
</auro-accordion>
|
|
318
|
+
</auro-accordion-group>
|
|
319
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
320
|
+
</section>
|
|
321
|
+
<section>
|
|
322
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/minimal-config.md) -->
|
|
323
|
+
<!-- The below content is automatically added from ./../docs/partials/getting-started/minimal-config.md -->
|
|
324
|
+
<auro-header level="3" id="minimalConfig">Minimal Configuration</auro-header>
|
|
325
|
+
Every <code><auro-combobox></code> implementation requires three things:
|
|
326
|
+
|
|
327
|
+
1. **A unique `id` attribute** — Required when the combobox is used within a form so it can be properly identified during submission and validation.
|
|
328
|
+
2. **A label in the `label` slot** — Provides an accessible label for the combobox element.
|
|
329
|
+
3. **One or more `<auro-menuoption>` elements** — Placed inside an `<auro-menu>` in the default slot to define the available choices.
|
|
330
|
+
|
|
331
|
+
<pre class="language-html"><code class="language-html"><auro-combobox id="airportSearch">
|
|
332
|
+
<span slot="label">Search airports</span>
|
|
333
|
+
<auro-menu>
|
|
334
|
+
<auro-menuoption value="SEA">Seattle-Tacoma International</auro-menuoption>
|
|
335
|
+
<auro-menuoption value="LAX">Los Angeles International</auro-menuoption>
|
|
336
|
+
<auro-menuoption value="JFK">John F. Kennedy International</auro-menuoption>
|
|
337
|
+
<auro-menuoption static nomatch>No matching airport</auro-menuoption>
|
|
338
|
+
</auro-menu>
|
|
339
|
+
</auro-combobox></code></pre>
|
|
340
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
341
|
+
</section>
|
|
342
|
+
<section>
|
|
343
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/getting-started/slots.md) -->
|
|
344
|
+
<!-- The below content is automatically added from ./../docs/partials/getting-started/slots.md -->
|
|
345
|
+
<auro-header level="2" id="slots">Slots</auro-header>
|
|
346
|
+
<p>The following slots are available on the <code><auro-combobox></code> element.</p>
|
|
347
|
+
<auro-header level="3" id="slot-default">(default)</auro-header>
|
|
348
|
+
<p>Default slot for the menu content. Place <code><auro-menuoption></code> elements here.</p>
|
|
349
|
+
<auro-header level="3" id="slot-label">label</auro-header>
|
|
350
|
+
<p>Defines the content of the label.</p>
|
|
351
|
+
<auro-header level="3" id="slot-helpText">helpText</auro-header>
|
|
352
|
+
<p>Defines the content of the help text displayed below the combobox.</p>
|
|
353
|
+
<auro-header level="3" id="slot-optionalLabel">optionalLabel</auro-header>
|
|
354
|
+
<p>Allows overriding the optional display text <code>"(optional)"</code>, which appears next to the label.</p>
|
|
355
|
+
<auro-header level="3" id="slot-displayValue">displayValue</auro-header>
|
|
356
|
+
<p>Allows custom HTML content to display the selected value when the combobox is not focused. Only works with <code>snowflake</code> and <code>emphasized</code> layouts.</p>
|
|
357
|
+
<auro-header level="3" id="slot-ariaLabel-input-clear">ariaLabel.input.clear</auro-header>
|
|
358
|
+
<p>Sets <code>aria-label</code> on the clear button.</p>
|
|
359
|
+
<auro-header level="3" id="slot-ariaLabel-bib-close">ariaLabel.bib.close</auro-header>
|
|
360
|
+
<p>Sets <code>aria-label</code> on the close button in the fullscreen bib.</p>
|
|
361
|
+
<auro-header level="3" id="slot-bib-fullscreen-headline">bib.fullscreen.headline</auro-header>
|
|
362
|
+
<p>Defines the headline to display above menu options in the fullscreen bib.</p>
|
|
363
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
364
|
+
</section>
|
|
365
|
+
<section>
|
|
366
|
+
<auro-header level="2" id="stateManagement">State Management</auro-header>
|
|
367
|
+
<p>The following read-only properties reflect the current state of the component and can be accessed via JavaScript.</p>
|
|
368
|
+
<auro-header level="3" id="inputValue">inputValue</auro-header>
|
|
369
|
+
<p>Returns the current value of the internal HTML5 <code>input</code> element. This reflects exactly what the user has typed, regardless of whether it matches a menu option.</p>
|
|
370
|
+
<auro-header level="3" id="optionSelected">optionSelected</auro-header>
|
|
371
|
+
<p>Returns the currently selected <code><auro-menuoption></code> element, or <code>undefined</code> if no option is selected.</p>
|
|
372
|
+
<auro-header level="3" id="typedValue">typedValue</auro-header>
|
|
373
|
+
<p>Gets or sets the value of the internal input element. Unlike <code>value</code>, this represents what the user typed (or what was programmatically set in the input), not the selected option value.</p>
|
|
374
|
+
<auro-header level="3" id="validity">validity</auro-header>
|
|
375
|
+
<p>Returns the current <code>validityState</code> of the component as a string. Possible values include <code>"valid"</code>, <code>"valueMissing"</code>, and <code>"customError"</code>.</p>
|
|
376
|
+
<auro-header level="3" id="value">value</auro-header>
|
|
377
|
+
<p>Gets or sets the selected value of the combobox. When set programmatically, the component will attempt to match and select the corresponding menu option.</p>
|
|
378
|
+
</section>
|
|
379
|
+
<section>
|
|
380
|
+
<auro-header level="2" id="publicFunctions">Functions</auro-header>
|
|
381
|
+
<p>The following public methods are available on the <code><auro-combobox></code> element.</p>
|
|
382
|
+
<auro-header level="3" id="clear">clear()</auro-header>
|
|
383
|
+
<p>Clears the current value of the combobox, resetting both the input and the selected option.</p>
|
|
384
|
+
<auro-header level="3" id="focus">focus()</auro-header>
|
|
385
|
+
<p>Programmatically moves focus to the combobox trigger input.</p>
|
|
386
|
+
<auro-header level="3" id="reset">reset()</auro-header>
|
|
387
|
+
<p>Resets the component to its initial state, clearing the value, input text, and validation state.</p>
|
|
388
|
+
<auro-header level="3" id="validate">validate()</auro-header>
|
|
389
|
+
<p>Triggers validation on the component. Pass <code>true</code> to force validation even when <code>noValidate</code> is set.</p>
|
|
390
|
+
<auro-header level="3" id="hideBib">hideBib()</auro-header>
|
|
391
|
+
<p>Programmatically hides the dropdown bib if it is currently open.</p>
|
|
392
|
+
<auro-header level="3" id="showBib">showBib()</auro-header>
|
|
393
|
+
<p>Programmatically shows the dropdown bib if there are options to display.</p>
|
|
394
|
+
</section>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|