@aurodesignsystem-dev/auro-formkit 0.0.0-pr593.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README.md +314 -0
- package/components/bibtemplate/dist/auro-bibtemplate.d.ts +39 -0
- package/components/bibtemplate/dist/headerVersion.d.ts +2 -0
- package/components/bibtemplate/dist/iconVersion.d.ts +2 -0
- package/components/bibtemplate/dist/index.d.ts +2 -0
- package/components/bibtemplate/dist/index.js +709 -0
- package/components/bibtemplate/dist/registered.js +709 -0
- package/components/bibtemplate/dist/styles/color-css.d.ts +2 -0
- package/components/bibtemplate/dist/styles/style-css.d.ts +2 -0
- package/components/bibtemplate/dist/styles/tokens-css.d.ts +2 -0
- package/components/checkbox/README.md +142 -0
- package/components/checkbox/demo/api.html +55 -0
- package/components/checkbox/demo/api.js +17 -0
- package/components/checkbox/demo/api.md +401 -0
- package/components/checkbox/demo/api.min.js +1833 -0
- package/components/checkbox/demo/index.html +51 -0
- package/components/checkbox/demo/index.js +8 -0
- package/components/checkbox/demo/index.md +327 -0
- package/components/checkbox/demo/index.min.js +1808 -0
- package/components/checkbox/demo/readme.html +50 -0
- package/components/checkbox/demo/readme.md +142 -0
- package/components/checkbox/dist/auro-checkbox-group.d.ts +166 -0
- package/components/checkbox/dist/auro-checkbox.d.ts +129 -0
- package/components/checkbox/dist/helptextVersion.d.ts +2 -0
- package/components/checkbox/dist/index.d.ts +3 -0
- package/components/checkbox/dist/index.js +1757 -0
- package/components/checkbox/dist/registered.js +1758 -0
- package/components/checkbox/dist/styles/auro-checkbox-css.d.ts +2 -0
- package/components/checkbox/dist/styles/auro-checkbox-group-css.d.ts +2 -0
- package/components/checkbox/dist/styles/color-css.d.ts +2 -0
- package/components/checkbox/dist/styles/colorGroup-css.d.ts +2 -0
- package/components/checkbox/dist/styles/tokens-css.d.ts +2 -0
- package/components/combobox/README.md +152 -0
- package/components/combobox/demo/api.html +57 -0
- package/components/combobox/demo/api.js +36 -0
- package/components/combobox/demo/api.md +1209 -0
- package/components/combobox/demo/api.min.js +15117 -0
- package/components/combobox/demo/index.html +56 -0
- package/components/combobox/demo/index.js +26 -0
- package/components/combobox/demo/index.md +621 -0
- package/components/combobox/demo/index.min.js +14971 -0
- package/components/combobox/demo/readme.html +50 -0
- package/components/combobox/demo/readme.md +152 -0
- package/components/combobox/dist/auro-combobox.d.ts +384 -0
- package/components/combobox/dist/bibtemplateVersion.d.ts +2 -0
- package/components/combobox/dist/dropdownVersion.d.ts +2 -0
- package/components/combobox/dist/index.d.ts +2 -0
- package/components/combobox/dist/index.js +13554 -0
- package/components/combobox/dist/inputVersion.d.ts +2 -0
- package/components/combobox/dist/registered.js +13556 -0
- package/components/combobox/dist/styles/style-css.d.ts +2 -0
- package/components/counter/README.md +146 -0
- package/components/counter/demo/api.html +54 -0
- package/components/counter/demo/api.js +20 -0
- package/components/counter/demo/api.md +584 -0
- package/components/counter/demo/api.min.js +7111 -0
- package/components/counter/demo/index.html +54 -0
- package/components/counter/demo/index.js +21 -0
- package/components/counter/demo/index.md +244 -0
- package/components/counter/demo/index.min.js +7075 -0
- package/components/counter/demo/readme.html +50 -0
- package/components/counter/demo/readme.md +146 -0
- package/components/counter/dist/auro-counter-button.d.ts +12 -0
- package/components/counter/dist/auro-counter-group.d.ts +235 -0
- package/components/counter/dist/auro-counter-wrapper.d.ts +22 -0
- package/components/counter/dist/auro-counter.d.ts +97 -0
- package/components/counter/dist/bibtemplateVersion.d.ts +2 -0
- package/components/counter/dist/dropdownVersion.d.ts +2 -0
- package/components/counter/dist/iconVersion.d.ts +2 -0
- package/components/counter/dist/index.d.ts +3 -0
- package/components/counter/dist/index.js +7018 -0
- package/components/counter/dist/registered.js +7019 -0
- package/components/counter/dist/styles/color-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-button-color-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-button-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-group-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-wrapper-color-css.d.ts +2 -0
- package/components/counter/dist/styles/counter-wrapper-css.d.ts +2 -0
- package/components/counter/dist/styles/style-css.d.ts +2 -0
- package/components/counter/dist/styles/tokens-css.d.ts +2 -0
- package/components/datepicker/README.md +140 -0
- package/components/datepicker/demo/api.html +57 -0
- package/components/datepicker/demo/api.js +35 -0
- package/components/datepicker/demo/api.md +1479 -0
- package/components/datepicker/demo/api.min.js +24534 -0
- package/components/datepicker/demo/index.html +56 -0
- package/components/datepicker/demo/index.js +19 -0
- package/components/datepicker/demo/index.md +112 -0
- package/components/datepicker/demo/index.min.js +24255 -0
- package/components/datepicker/demo/readme.html +50 -0
- package/components/datepicker/demo/readme.md +140 -0
- package/components/datepicker/dist/auro-calendar-cell.d.ts +163 -0
- package/components/datepicker/dist/auro-calendar-month.d.ts +20 -0
- package/components/datepicker/dist/auro-calendar.d.ts +133 -0
- package/components/datepicker/dist/auro-datepicker.d.ts +466 -0
- package/components/datepicker/dist/bibtemplateVersion.d.ts +2 -0
- package/components/datepicker/dist/buttonVersion.d.ts +2 -0
- package/components/datepicker/dist/dropdownVersion.d.ts +2 -0
- package/components/datepicker/dist/index.d.ts +2 -0
- package/components/datepicker/dist/index.js +24185 -0
- package/components/datepicker/dist/inputVersion.d.ts +2 -0
- package/components/datepicker/dist/popoverVersion.d.ts +2 -0
- package/components/datepicker/dist/registered.js +24185 -0
- package/components/datepicker/dist/styles/color-calendar-css.d.ts +2 -0
- package/components/datepicker/dist/styles/color-cell-css.d.ts +2 -0
- package/components/datepicker/dist/styles/color-css.d.ts +2 -0
- package/components/datepicker/dist/styles/color-month-css.d.ts +2 -0
- package/components/datepicker/dist/styles/style-auro-calendar-cell-css.d.ts +2 -0
- package/components/datepicker/dist/styles/style-auro-calendar-css.d.ts +2 -0
- package/components/datepicker/dist/styles/style-auro-calendar-month-css.d.ts +2 -0
- package/components/datepicker/dist/styles/style-css.d.ts +2 -0
- package/components/datepicker/dist/styles/tokens-css.d.ts +2 -0
- package/components/datepicker/dist/utilities.d.ts +78 -0
- package/components/datepicker/dist/utilitiesCalendar.d.ts +38 -0
- package/components/datepicker/dist/utilitiesCalendarRender.d.ts +50 -0
- package/components/datepicker/dist/vendor/wc-range-datepicker/day.d.ts +5 -0
- package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-calendar.d.ts +60 -0
- package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-cell.d.ts +1 -0
- package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker.d.ts +57 -0
- package/components/dropdown/README.md +144 -0
- package/components/dropdown/demo/api.html +57 -0
- package/components/dropdown/demo/api.js +21 -0
- package/components/dropdown/demo/api.md +1434 -0
- package/components/dropdown/demo/api.min.js +3826 -0
- package/components/dropdown/demo/index.html +55 -0
- package/components/dropdown/demo/index.js +19 -0
- package/components/dropdown/demo/index.md +510 -0
- package/components/dropdown/demo/index.min.js +3789 -0
- package/components/dropdown/demo/readme.html +50 -0
- package/components/dropdown/demo/readme.md +144 -0
- package/components/dropdown/dist/auro-dropdown.d.ts +406 -0
- package/components/dropdown/dist/auro-dropdownBib.d.ts +46 -0
- package/components/dropdown/dist/dropdownVersion.d.ts +2 -0
- package/components/dropdown/dist/helptextVersion.d.ts +2 -0
- package/components/dropdown/dist/iconVersion.d.ts +2 -0
- package/components/dropdown/dist/index.d.ts +2 -0
- package/components/dropdown/dist/index.js +3734 -0
- package/components/dropdown/dist/registered.js +3734 -0
- package/components/dropdown/dist/styles/bibColors-css.d.ts +2 -0
- package/components/dropdown/dist/styles/bibStyles-css.d.ts +2 -0
- package/components/dropdown/dist/styles/color-css.d.ts +2 -0
- package/components/dropdown/dist/styles/style-css.d.ts +2 -0
- package/components/dropdown/dist/styles/tokens-css.d.ts +2 -0
- package/components/form/README.md +142 -0
- package/components/form/demo/api.html +49 -0
- package/components/form/demo/api.js +3 -0
- package/components/form/demo/api.md +51 -0
- package/components/form/demo/api.min.js +638 -0
- package/components/form/demo/autocomplete.html +15 -0
- package/components/form/demo/index.html +50 -0
- package/components/form/demo/index.js +4 -0
- package/components/form/demo/index.md +403 -0
- package/components/form/demo/index.min.js +639 -0
- package/components/form/demo/readme.html +50 -0
- package/components/form/demo/readme.md +142 -0
- package/components/form/demo/registerDemoDeps.js +23 -0
- package/components/form/demo/working.html +118 -0
- package/components/form/dist/auro-form.d.ts +223 -0
- package/components/form/dist/index.d.ts +2 -0
- package/components/form/dist/index.js +614 -0
- package/components/form/dist/registered.d.ts +1 -0
- package/components/form/dist/registered.js +614 -0
- package/components/form/dist/styles/style-css.d.ts +2 -0
- package/components/helptext/dist/auro-helptext.d.ts +61 -0
- package/components/helptext/dist/index.d.ts +2 -0
- package/components/helptext/dist/index.js +209 -0
- package/components/helptext/dist/registered.js +209 -0
- package/components/helptext/dist/styles/color-css.d.ts +2 -0
- package/components/helptext/dist/styles/style-css.d.ts +2 -0
- package/components/helptext/dist/styles/tokens-css.d.ts +2 -0
- package/components/input/README.md +135 -0
- package/components/input/demo/api.html +42 -0
- package/components/input/demo/api.js +29 -0
- package/components/input/demo/api.md +1252 -0
- package/components/input/demo/api.min.js +7238 -0
- package/components/input/demo/index.html +43 -0
- package/components/input/demo/index.js +20 -0
- package/components/input/demo/index.md +202 -0
- package/components/input/demo/index.min.js +7157 -0
- package/components/input/demo/readme.html +50 -0
- package/components/input/demo/readme.md +135 -0
- package/components/input/dist/auro-input.d.ts +31 -0
- package/components/input/dist/base-input.d.ts +512 -0
- package/components/input/dist/buttonVersion.d.ts +2 -0
- package/components/input/dist/helptextVersion.d.ts +2 -0
- package/components/input/dist/i18n.d.ts +18 -0
- package/components/input/dist/iconVersion.d.ts +2 -0
- package/components/input/dist/index.d.ts +2 -0
- package/components/input/dist/index.js +7063 -0
- package/components/input/dist/registered.js +7063 -0
- package/components/input/dist/styles/borders-css.d.ts +2 -0
- package/components/input/dist/styles/color-css.d.ts +2 -0
- package/components/input/dist/styles/input-css.d.ts +2 -0
- package/components/input/dist/styles/label-css.d.ts +2 -0
- package/components/input/dist/styles/mixins-css.d.ts +2 -0
- package/components/input/dist/styles/notificationIcons-css.d.ts +2 -0
- package/components/input/dist/styles/style-css.d.ts +2 -0
- package/components/input/dist/styles/tokens-css.d.ts +2 -0
- package/components/input/dist/utilities.d.ts +25 -0
- package/components/menu/README.md +145 -0
- package/components/menu/demo/api.html +55 -0
- package/components/menu/demo/api.js +27 -0
- package/components/menu/demo/api.md +954 -0
- package/components/menu/demo/api.min.js +1538 -0
- package/components/menu/demo/index.html +52 -0
- package/components/menu/demo/index.js +28 -0
- package/components/menu/demo/index.md +61 -0
- package/components/menu/demo/index.min.js +1484 -0
- package/components/menu/demo/readme.html +50 -0
- package/components/menu/demo/readme.md +145 -0
- package/components/menu/dist/auro-menu-utils.d.ts +42 -0
- package/components/menu/dist/auro-menu.d.ts +205 -0
- package/components/menu/dist/auro-menuoption.d.ts +63 -0
- package/components/menu/dist/dropdownVersion.d.ts +2 -0
- package/components/menu/dist/iconVersion.d.ts +2 -0
- package/components/menu/dist/index.d.ts +4 -0
- package/components/menu/dist/index.js +1426 -0
- package/components/menu/dist/registered.js +1427 -0
- package/components/menu/dist/styles/color-menu-css.d.ts +2 -0
- package/components/menu/dist/styles/color-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/style-menu-css.d.ts +2 -0
- package/components/menu/dist/styles/style-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/tokens-css.d.ts +2 -0
- package/components/radio/README.md +137 -0
- package/components/radio/demo/api.html +53 -0
- package/components/radio/demo/api.js +19 -0
- package/components/radio/demo/api.md +562 -0
- package/components/radio/demo/api.min.js +1944 -0
- package/components/radio/demo/index.html +50 -0
- package/components/radio/demo/index.js +8 -0
- package/components/radio/demo/index.md +150 -0
- package/components/radio/demo/index.min.js +1901 -0
- package/components/radio/demo/readme.html +50 -0
- package/components/radio/demo/readme.md +137 -0
- package/components/radio/dist/auro-radio-group.d.ts +194 -0
- package/components/radio/dist/auro-radio.d.ts +144 -0
- package/components/radio/dist/helptextVersion.d.ts +2 -0
- package/components/radio/dist/index.d.ts +3 -0
- package/components/radio/dist/index.js +1850 -0
- package/components/radio/dist/registered.js +1851 -0
- package/components/radio/dist/styles/auro-radio-group-css.d.ts +2 -0
- package/components/radio/dist/styles/color-css.d.ts +2 -0
- package/components/radio/dist/styles/groupColor-css.d.ts +2 -0
- package/components/radio/dist/styles/style-css.d.ts +2 -0
- package/components/radio/dist/styles/tokens-css.d.ts +2 -0
- package/components/select/README.md +144 -0
- package/components/select/demo/api.html +71 -0
- package/components/select/demo/api.js +35 -0
- package/components/select/demo/api.md +1313 -0
- package/components/select/demo/api.min.js +7763 -0
- package/components/select/demo/index.html +66 -0
- package/components/select/demo/index.js +9 -0
- package/components/select/demo/index.md +815 -0
- package/components/select/demo/index.min.js +7651 -0
- package/components/select/demo/readme.html +50 -0
- package/components/select/demo/readme.md +144 -0
- package/components/select/dist/auro-select.d.ts +359 -0
- package/components/select/dist/bibtemplateVersion.d.ts +2 -0
- package/components/select/dist/dropdownVersion.d.ts +2 -0
- package/components/select/dist/index.d.ts +2 -0
- package/components/select/dist/index.js +6300 -0
- package/components/select/dist/registered.js +6300 -0
- package/components/select/dist/styles/style-css.d.ts +2 -0
- package/package.json +217 -0
- package/packages/build-tools/src/postinstall.mjs +12 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { css, LitElement, html } from 'lit';
|
|
2
|
+
|
|
3
|
+
var colorCss = css`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
|
|
4
|
+
|
|
5
|
+
var styleCss = css`.helptext-wrapper{display:none;font-size:var(--ds-basic-text-body-xs-font-size, 12px);font-weight:var(--ds-basic-text-body-xs-font-weight, 450);letter-spacing:var(--ds-basic-text-body-xs-letter-spacing, 0);line-height:var(--ds-basic-text-body-xs-line-height, 16px)}:host([large]) .helptext-wrapper{font-size:var(--ds-basic-text-body-default-font-size, 16px);font-weight:var(--ds-basic-text-body-default-font-weight, 450);letter-spacing:var(--ds-basic-text-body-default-letter-spacing, 0);line-height:var(--ds-basic-text-body-default-line-height, 24px)}.helptext-wrapper[visible]{display:block}::slotted(*:not(:empty)){margin-top:var(--ds-size-50, 0.25rem);margin-bottom:0}::slotted(p){margin-block:0}`;
|
|
6
|
+
|
|
7
|
+
var tokensCss = css`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
8
|
+
|
|
9
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
10
|
+
// See LICENSE in the project root for license information.
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
15
|
+
|
|
16
|
+
class AuroLibraryRuntimeUtils {
|
|
17
|
+
|
|
18
|
+
/* eslint-disable jsdoc/require-param */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* This will register a new custom element with the browser.
|
|
22
|
+
* @param {String} name - The name of the custom element.
|
|
23
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
24
|
+
* @returns {void}
|
|
25
|
+
*/
|
|
26
|
+
registerComponent(name, componentClass) {
|
|
27
|
+
if (!customElements.get(name)) {
|
|
28
|
+
customElements.define(name, class extends componentClass {});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
34
|
+
* @returns {void}
|
|
35
|
+
*/
|
|
36
|
+
closestElement(
|
|
37
|
+
selector, // selector like in .closest()
|
|
38
|
+
base = this, // extra functionality to skip a parent
|
|
39
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
40
|
+
!el || el === document || el === window
|
|
41
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
42
|
+
: found
|
|
43
|
+
? found // found a selector INside this element
|
|
44
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
45
|
+
) {
|
|
46
|
+
return __Closest(base);
|
|
47
|
+
}
|
|
48
|
+
/* eslint-enable jsdoc/require-param */
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
|
|
52
|
+
* @param {Object} elem - The element to check.
|
|
53
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
54
|
+
* @returns {void}
|
|
55
|
+
*/
|
|
56
|
+
handleComponentTagRename(elem, tagName) {
|
|
57
|
+
const tag = tagName.toLowerCase();
|
|
58
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
59
|
+
|
|
60
|
+
if (elemTag !== tag) {
|
|
61
|
+
elem.setAttribute(tag, true);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Validates if an element is a specific Auro component.
|
|
67
|
+
* @param {Object} elem - The element to validate.
|
|
68
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
69
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
70
|
+
*/
|
|
71
|
+
elementMatch(elem, tagName) {
|
|
72
|
+
const tag = tagName.toLowerCase();
|
|
73
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
74
|
+
|
|
75
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
80
|
+
// See LICENSE in the project root for license information.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Displays help text or error messages within form elements - Internal Use Only.
|
|
85
|
+
*
|
|
86
|
+
* @attr { Boolean } large - If declared, make font-size to 1rem(16px).
|
|
87
|
+
*/
|
|
88
|
+
class AuroHelpText extends LitElement {
|
|
89
|
+
|
|
90
|
+
constructor() {
|
|
91
|
+
super();
|
|
92
|
+
|
|
93
|
+
this.error = false;
|
|
94
|
+
this.onDark = false;
|
|
95
|
+
this.hasTextContent = false;
|
|
96
|
+
|
|
97
|
+
AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-helptext');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static get styles() {
|
|
101
|
+
return [
|
|
102
|
+
colorCss,
|
|
103
|
+
styleCss,
|
|
104
|
+
tokensCss
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// function to define props used within the scope of this component
|
|
109
|
+
static get properties() {
|
|
110
|
+
return {
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
slotNodes: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
hasTextContent: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* If declared, make font color red.
|
|
128
|
+
*/
|
|
129
|
+
error: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
reflect: true,
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* If declared, will apply onDark styles.
|
|
136
|
+
*/
|
|
137
|
+
onDark: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
reflect: true
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* This will register this element with the browser.
|
|
146
|
+
* @param {string} [name="auro-helptext"] - The name of element that you want to register to.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* AuroCheckbox.register("custom-helptext") // this will register this element to <custom-helptext/>
|
|
150
|
+
*
|
|
151
|
+
*/
|
|
152
|
+
static register(name = "auro-helptext") {
|
|
153
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroHelpText);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
updated() {
|
|
157
|
+
this.handleSlotChange();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
handleSlotChange(event) {
|
|
161
|
+
if (event) {
|
|
162
|
+
this.slotNodes = event.target.assignedNodes();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
this.hasTextContent = this.checkSlotsForContent(this.slotNodes);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Checks if any of the provided nodes or their nested slot nodes contain non-empty text content.
|
|
170
|
+
*
|
|
171
|
+
* @param {NodeList|Array} nodes - The list of nodes to check for content.
|
|
172
|
+
* @returns {boolean} - Returns true if any node or nested slot node contains non-empty text content, otherwise false.
|
|
173
|
+
* @private
|
|
174
|
+
*/
|
|
175
|
+
checkSlotsForContent(nodes) {
|
|
176
|
+
if (!nodes) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return nodes.some((node) => {
|
|
181
|
+
if (node.textContent.trim()) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (!node.querySelector) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const nestedSlot = node.tagName === 'SLOT' ? node : node.querySelector('slot');
|
|
190
|
+
if (!nestedSlot) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const nestedSlotNodes = nestedSlot.assignedNodes();
|
|
195
|
+
return this.checkSlotsForContent(nestedSlotNodes);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// function that renders the HTML and CSS into the scope of the component
|
|
200
|
+
render() {
|
|
201
|
+
return html`
|
|
202
|
+
<div class="helptext-wrapper" ?visible="${this.hasTextContent}">
|
|
203
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
204
|
+
</div>
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export { AuroHelpText };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { css, LitElement, html } from 'lit';
|
|
2
|
+
|
|
3
|
+
var colorCss = css`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
|
|
4
|
+
|
|
5
|
+
var styleCss = css`.helptext-wrapper{display:none;font-size:var(--ds-basic-text-body-xs-font-size, 12px);font-weight:var(--ds-basic-text-body-xs-font-weight, 450);letter-spacing:var(--ds-basic-text-body-xs-letter-spacing, 0);line-height:var(--ds-basic-text-body-xs-line-height, 16px)}:host([large]) .helptext-wrapper{font-size:var(--ds-basic-text-body-default-font-size, 16px);font-weight:var(--ds-basic-text-body-default-font-weight, 450);letter-spacing:var(--ds-basic-text-body-default-letter-spacing, 0);line-height:var(--ds-basic-text-body-default-line-height, 24px)}.helptext-wrapper[visible]{display:block}::slotted(*:not(:empty)){margin-top:var(--ds-size-50, 0.25rem);margin-bottom:0}::slotted(p){margin-block:0}`;
|
|
6
|
+
|
|
7
|
+
var tokensCss = css`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
8
|
+
|
|
9
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
10
|
+
// See LICENSE in the project root for license information.
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
15
|
+
|
|
16
|
+
class AuroLibraryRuntimeUtils {
|
|
17
|
+
|
|
18
|
+
/* eslint-disable jsdoc/require-param */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* This will register a new custom element with the browser.
|
|
22
|
+
* @param {String} name - The name of the custom element.
|
|
23
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
24
|
+
* @returns {void}
|
|
25
|
+
*/
|
|
26
|
+
registerComponent(name, componentClass) {
|
|
27
|
+
if (!customElements.get(name)) {
|
|
28
|
+
customElements.define(name, class extends componentClass {});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
34
|
+
* @returns {void}
|
|
35
|
+
*/
|
|
36
|
+
closestElement(
|
|
37
|
+
selector, // selector like in .closest()
|
|
38
|
+
base = this, // extra functionality to skip a parent
|
|
39
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
40
|
+
!el || el === document || el === window
|
|
41
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
42
|
+
: found
|
|
43
|
+
? found // found a selector INside this element
|
|
44
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
45
|
+
) {
|
|
46
|
+
return __Closest(base);
|
|
47
|
+
}
|
|
48
|
+
/* eslint-enable jsdoc/require-param */
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
|
|
52
|
+
* @param {Object} elem - The element to check.
|
|
53
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
54
|
+
* @returns {void}
|
|
55
|
+
*/
|
|
56
|
+
handleComponentTagRename(elem, tagName) {
|
|
57
|
+
const tag = tagName.toLowerCase();
|
|
58
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
59
|
+
|
|
60
|
+
if (elemTag !== tag) {
|
|
61
|
+
elem.setAttribute(tag, true);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Validates if an element is a specific Auro component.
|
|
67
|
+
* @param {Object} elem - The element to validate.
|
|
68
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
69
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
70
|
+
*/
|
|
71
|
+
elementMatch(elem, tagName) {
|
|
72
|
+
const tag = tagName.toLowerCase();
|
|
73
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
74
|
+
|
|
75
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
80
|
+
// See LICENSE in the project root for license information.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Displays help text or error messages within form elements - Internal Use Only.
|
|
85
|
+
*
|
|
86
|
+
* @attr { Boolean } large - If declared, make font-size to 1rem(16px).
|
|
87
|
+
*/
|
|
88
|
+
class AuroHelpText extends LitElement {
|
|
89
|
+
|
|
90
|
+
constructor() {
|
|
91
|
+
super();
|
|
92
|
+
|
|
93
|
+
this.error = false;
|
|
94
|
+
this.onDark = false;
|
|
95
|
+
this.hasTextContent = false;
|
|
96
|
+
|
|
97
|
+
AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-helptext');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static get styles() {
|
|
101
|
+
return [
|
|
102
|
+
colorCss,
|
|
103
|
+
styleCss,
|
|
104
|
+
tokensCss
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// function to define props used within the scope of this component
|
|
109
|
+
static get properties() {
|
|
110
|
+
return {
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
slotNodes: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
hasTextContent: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* If declared, make font color red.
|
|
128
|
+
*/
|
|
129
|
+
error: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
reflect: true,
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* If declared, will apply onDark styles.
|
|
136
|
+
*/
|
|
137
|
+
onDark: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
reflect: true
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* This will register this element with the browser.
|
|
146
|
+
* @param {string} [name="auro-helptext"] - The name of element that you want to register to.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* AuroCheckbox.register("custom-helptext") // this will register this element to <custom-helptext/>
|
|
150
|
+
*
|
|
151
|
+
*/
|
|
152
|
+
static register(name = "auro-helptext") {
|
|
153
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroHelpText);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
updated() {
|
|
157
|
+
this.handleSlotChange();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
handleSlotChange(event) {
|
|
161
|
+
if (event) {
|
|
162
|
+
this.slotNodes = event.target.assignedNodes();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
this.hasTextContent = this.checkSlotsForContent(this.slotNodes);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Checks if any of the provided nodes or their nested slot nodes contain non-empty text content.
|
|
170
|
+
*
|
|
171
|
+
* @param {NodeList|Array} nodes - The list of nodes to check for content.
|
|
172
|
+
* @returns {boolean} - Returns true if any node or nested slot node contains non-empty text content, otherwise false.
|
|
173
|
+
* @private
|
|
174
|
+
*/
|
|
175
|
+
checkSlotsForContent(nodes) {
|
|
176
|
+
if (!nodes) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return nodes.some((node) => {
|
|
181
|
+
if (node.textContent.trim()) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (!node.querySelector) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const nestedSlot = node.tagName === 'SLOT' ? node : node.querySelector('slot');
|
|
190
|
+
if (!nestedSlot) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const nestedSlotNodes = nestedSlot.assignedNodes();
|
|
195
|
+
return this.checkSlotsForContent(nestedSlotNodes);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// function that renders the HTML and CSS into the scope of the component
|
|
200
|
+
render() {
|
|
201
|
+
return html`
|
|
202
|
+
<div class="helptext-wrapper" ?visible="${this.hasTextContent}">
|
|
203
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
204
|
+
</div>
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
AuroHelpText.register();
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
# Input
|
|
21
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/description.md) -->
|
|
22
|
+
<!-- The below content is automatically added from ./docs/partials/description.md -->
|
|
23
|
+
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.
|
|
24
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
25
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/readmeAddlInfo.md) -->
|
|
26
|
+
<!-- The below content is automatically added from ./docs/partials/readmeAddlInfo.md -->
|
|
27
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
28
|
+
|
|
29
|
+
## Getting Started
|
|
30
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/componentInstall.md) -->
|
|
31
|
+
<!-- The below content is automatically added from ../../docs/templates/componentInstall.md -->
|
|
32
|
+
|
|
33
|
+
#### NPM Installation
|
|
34
|
+
|
|
35
|
+
```shell
|
|
36
|
+
$ npm i @aurodesignsystem/auro-formkit
|
|
37
|
+
```
|
|
38
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
39
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/gettingStarted.md) -->
|
|
40
|
+
<!-- The below content is automatically added from ../../docs/templates/gettingStarted.md -->
|
|
41
|
+
|
|
42
|
+
### Import Options
|
|
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
|
|
66
|
+
|
|
67
|
+
When using TypeScript set `moduleResolution` to `bundler`, add the following to your `tsconfig.json`:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"compilerOptions": {
|
|
72
|
+
"moduleResolution": "bundler"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
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 bordered></auro-input>
|
|
86
|
+
```
|
|
87
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
88
|
+
|
|
89
|
+
### Design Token CSS Custom Property dependency
|
|
90
|
+
|
|
91
|
+
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/designTokens.md) -->
|
|
92
|
+
The use of any Auro custom element has a dependency on the [Auro Design Tokens](https://auro.alaskaair.com/getting-started/developers/design-tokens).
|
|
93
|
+
|
|
94
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
95
|
+
|
|
96
|
+
## Install from CDN
|
|
97
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/templates/bundleInstallDescription.md) -->
|
|
98
|
+
<!-- The below content is automatically added from ../../docs/templates/bundleInstallDescription.md -->
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@0.0.0/auro-input/+esm"></script>
|
|
103
|
+
```
|
|
104
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
105
|
+
|
|
106
|
+
## UI development browser support
|
|
107
|
+
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/browserSupport.md) -->
|
|
108
|
+
For the most up to date information on [UI development browser support](https://auro.alaskaair.com/support/browsersSupport)
|
|
109
|
+
|
|
110
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
111
|
+
|
|
112
|
+
## auro-input use cases
|
|
113
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/useCases.md) -->
|
|
114
|
+
<!-- The below content is automatically added from ./docs/partials/useCases.md -->
|
|
115
|
+
The `<auro-input>` element should be used in situations where users may:
|
|
116
|
+
|
|
117
|
+
* needs to enter information
|
|
118
|
+
* be filling out a form
|
|
119
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
120
|
+
|
|
121
|
+
## Formkit development
|
|
122
|
+
|
|
123
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../../docs/partials/developmentDescription.md) -->
|
|
124
|
+
<!-- The below content is automatically added from ../../docs/partials/developmentDescription.md -->
|
|
125
|
+
|
|
126
|
+
### Filtering
|
|
127
|
+
|
|
128
|
+
Running the `dev` command will open a `localhost` development server for all components in the monorepo at once.
|
|
129
|
+
|
|
130
|
+
To only develop a single component, use the `--filter` flag:
|
|
131
|
+
|
|
132
|
+
```shell
|
|
133
|
+
npx turbo dev --filter=@aurodesignsystem/auro-input
|
|
134
|
+
```
|
|
135
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Auro Web Component Generator | auro-input custom element</title>
|
|
7
|
+
<link
|
|
8
|
+
rel="stylesheet"
|
|
9
|
+
type="text/css"
|
|
10
|
+
href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"
|
|
11
|
+
/>
|
|
12
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/auro-classic/CSSCustomProperties.css">
|
|
13
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/alaska/CSSCustomProperties--alaska.css">
|
|
14
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
|
|
15
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/elementDemoStyles.css" />
|
|
16
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/essentials-as.css" />
|
|
17
|
+
</head>
|
|
18
|
+
<body class="auro-markdown">
|
|
19
|
+
<main></main>
|
|
20
|
+
|
|
21
|
+
<script type="module">
|
|
22
|
+
import 'https://cdn.jsdelivr.net/npm/marked@latest/marked.min.js';
|
|
23
|
+
import 'https://cdn.jsdelivr.net/npm/prismjs@latest/prism.js';
|
|
24
|
+
fetch('./api.md')
|
|
25
|
+
.then((response) => response.text())
|
|
26
|
+
.then((text) => {
|
|
27
|
+
const rawHtml = marked.parse(text);
|
|
28
|
+
document.querySelector('main').innerHTML = rawHtml;
|
|
29
|
+
Prism.highlightAll();
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
32
|
+
<script type="module" data-demo-script="true">
|
|
33
|
+
import { initExamples } from "./api.min.js";
|
|
34
|
+
initExamples();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<!-- If additional elements are needed for the demo, add them here. -->
|
|
38
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-accordion@latest/dist/auro-accordion__bundled.js" type="module"></script>
|
|
39
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-radio@latest/dist/auro-radio__bundled.js" type="module"></script>
|
|
40
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-button@latest/dist/auro-button__bundled.js" type="module"></script>
|
|
41
|
+
</body>
|
|
42
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { changeLang } from "../apiExamples/changeLang";
|
|
2
|
+
import { customError } from "../apiExamples/error";
|
|
3
|
+
import { customErrorOnDark } from "../apiExamples/onDarkError";
|
|
4
|
+
import { setReadonlyValue } from "../apiExamples/readonly";
|
|
5
|
+
import { swapInputValues } from "../apiExamples/swapValue";
|
|
6
|
+
import { programmaticallySetValue } from "../apiExamples/value";
|
|
7
|
+
import { resetStateExample } from "../apiExamples/resetState";
|
|
8
|
+
import './index.js';
|
|
9
|
+
|
|
10
|
+
export function initExamples(initCount) {
|
|
11
|
+
initCount = initCount || 0;
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
changeLang();
|
|
15
|
+
customError();
|
|
16
|
+
customErrorOnDark();
|
|
17
|
+
setReadonlyValue();
|
|
18
|
+
swapInputValues();
|
|
19
|
+
programmaticallySetValue();
|
|
20
|
+
resetStateExample();
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (initCount <= 20) {
|
|
23
|
+
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
initExamples(initCount + 1);
|
|
26
|
+
}, 100);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|