@aurodesignsystem/auro-accordion 4.3.1 → 4.4.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 +7 -0
- package/README.md +2 -3
- package/coverage/lcov-report/auro-accordion-button.js.html +184 -0
- package/coverage/lcov-report/auro-accordion-group.js.html +75 -75
- package/coverage/lcov-report/auro-accordion.js.html +106 -10
- package/coverage/lcov-report/color-css.js.html +1 -1
- package/coverage/lcov-report/iconVersion.js.html +1 -1
- package/coverage/lcov-report/index.html +44 -14
- package/coverage/lcov-report/style-button-css.js.html +91 -0
- package/coverage/lcov-report/style-css.js.html +1 -1
- package/coverage/lcov-report/tokens-css.js.html +1 -1
- package/coverage/lcov.info +296 -200
- package/demo/api.min.js +878 -851
- package/demo/index.min.js +878 -849
- package/dist/auro-accordion.d.ts +15 -0
- package/dist/auro-accordion.d.ts.map +1 -1
- package/dist/auro-accordion__bundled.js +878 -851
- package/index.js +0 -4
- package/package.json +1 -1
- package/src/auro-accordion.js +35 -3
- package/test/auro-accordion.test.js +2 -0
package/demo/index.min.js
CHANGED
|
@@ -114,6 +114,140 @@ let AuroLibraryRuntimeUtils$3 = class AuroLibraryRuntimeUtils {
|
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
+
// Copyright (c) 2023 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
118
|
+
// See LICENSE in the project root for license information.
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
122
|
+
/**
|
|
123
|
+
* Auro-accordion provides users a way to have collapsible content on a page.
|
|
124
|
+
* Use auro-accordion-group if you want to have auto closing accordion components when others are selected.
|
|
125
|
+
*
|
|
126
|
+
* @attr {Boolean} emphasis - If set, emphasis styles will be applied to the auro-accordions.
|
|
127
|
+
* @attr {String} variant - Sets accordion variant option. Possible values are: `sm`, `lg`.
|
|
128
|
+
* @attr {Boolean} noToggleExpanded - If set, multiple accordions can be open at the same time.
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
// build the component class
|
|
132
|
+
class AuroAccordionGroup extends r {
|
|
133
|
+
constructor() {
|
|
134
|
+
super();
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils$3();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// This function is to define props used within the scope of this component
|
|
143
|
+
// Be sure to review https://lit.dev/docs/components/properties/
|
|
144
|
+
// to understand how to use reflected attributes with your property settings.
|
|
145
|
+
static get properties() {
|
|
146
|
+
return {
|
|
147
|
+
// ...super.properties,
|
|
148
|
+
|
|
149
|
+
emphasis: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
reflect: true
|
|
152
|
+
},
|
|
153
|
+
variant: {
|
|
154
|
+
type: String,
|
|
155
|
+
reflect: true
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* This will register this element with the browser.
|
|
162
|
+
* @param {string} [name="auro-accordion-group"] - The name of element that you want to register to.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* AuroAccordionGroup.register("custom-accordion-button") // this will register this element to <custom-accordion-group/>
|
|
166
|
+
*
|
|
167
|
+
*/
|
|
168
|
+
static register(name = "auro-accordion-group") {
|
|
169
|
+
AuroLibraryRuntimeUtils$3.prototype.registerComponent(name, AuroAccordionGroup);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
firstUpdated() {
|
|
173
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
174
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-accordion-group');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
handleSlotContentChange() {
|
|
178
|
+
this.addEventListener('toggleExpanded', this.handleToggleExpanded);
|
|
179
|
+
|
|
180
|
+
this.handleItems();
|
|
181
|
+
|
|
182
|
+
this.items.forEach((item) => {
|
|
183
|
+
if (this.hasAttribute('emphasis')) {
|
|
184
|
+
item.setAttribute('chevron', 'right');
|
|
185
|
+
item.emphasis = true;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (this.hasAttribute('variant') && this.getAttribute('variant') === 'sm') {
|
|
189
|
+
item.setAttribute('variant', 'sm');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (this.hasAttribute('variant') && this.getAttribute('variant') === 'lg') {
|
|
193
|
+
item.setAttribute('variant', 'lg');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
item.grouped = true;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Internal function to toggle any expanded panels if it is not the one selected.
|
|
202
|
+
* @private
|
|
203
|
+
* @param {object} event - Standard event parameter.
|
|
204
|
+
*/
|
|
205
|
+
handleToggleExpanded(event) {
|
|
206
|
+
if (!this.hasAttribute('noToggleExpanded')) {
|
|
207
|
+
this.items.forEach((item) => {
|
|
208
|
+
if (item !== event.target && item.expanded) {
|
|
209
|
+
item.expanded = false;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
this.scrollIntoView({
|
|
214
|
+
behavior: "smooth",
|
|
215
|
+
block: "nearest",
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Internal function to add all accordions into an array.
|
|
222
|
+
* @private
|
|
223
|
+
*/
|
|
224
|
+
handleItems() {
|
|
225
|
+
const groupTagName = this.tagName.toLowerCase();
|
|
226
|
+
const accordionTagName = groupTagName.substring(0, groupTagName.indexOf('-group'));
|
|
227
|
+
|
|
228
|
+
this.items = Array.from(this.querySelectorAll(accordionTagName));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// function that renders the HTML and CSS into the scope of the component
|
|
232
|
+
render() {
|
|
233
|
+
return x`
|
|
234
|
+
<div>
|
|
235
|
+
<slot @slotchange="${this.handleSlotContentChange}"></slot>
|
|
236
|
+
</div>
|
|
237
|
+
`;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
var styleButtonCss = i$5`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}:host{border:unset}:host .auro-button{all:unset;width:100%;padding:var(--ds-size-200, 1rem) 0;cursor:pointer;pointer-events:none}:host .auro-button:after{border-color:transparent}:host .contentWrapper{display:flex;flex-direction:row-reverse}:host .textSlot{display:flex;flex:1}:host(.sm) .auro-button{padding:var(--ds-size-100, 0.5rem) 0}:host(.lg) .auro-button{padding:calc(var(--ds-size-200, 1rem) + var(--ds-size-50, 0.25rem)) 0}:host([fluid]) .contentWrapper{width:100%}:host(.iconRight) .contentWrapper{display:flex;flex-direction:row}`;
|
|
242
|
+
|
|
243
|
+
var styleCssAuroButton = i$5`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_insetNone{padding:0}.util_insetXxxs{padding:.125rem}.util_insetXxxs--stretch{padding:.25rem .125rem}.util_insetXxxs--squish{padding:0 .125rem}.util_insetXxs{padding:.25rem}.util_insetXxs--stretch{padding:.375rem .25rem}.util_insetXxs--squish{padding:.125rem .25rem}.util_insetXs{padding:.5rem}.util_insetXs--stretch{padding:.75rem .5rem}.util_insetXs--squish{padding:.25rem .5rem}.util_insetSm{padding:.75rem}.util_insetSm--stretch{padding:1.125rem .75rem}.util_insetSm--squish{padding:.375rem .75rem}.util_insetMd{padding:1rem}.util_insetMd--stretch{padding:1.5rem 1rem}.util_insetMd--squish{padding:.5rem 1rem}.util_insetLg{padding:1.5rem}.util_insetLg--stretch{padding:2.25rem 1.5rem}.util_insetLg--squish{padding:.75rem 1.5rem}.util_insetXl{padding:2rem}.util_insetXl--stretch{padding:3rem 2rem}.util_insetXl--squish{padding:1rem 2rem}.util_insetXxl{padding:3rem}.util_insetXxl--stretch{padding:4.5rem 3rem}.util_insetXxl--squish{padding:1.5rem 3rem}.util_insetXxxl{padding:4rem}.util_insetXxxl--stretch{padding:6rem 4rem}.util_insetXxxl--squish{padding:2rem 4rem}:host([fluid]) .auro-button,:host([fluid=true]) .auro-button{min-width:auto;width:100%}:host([variant=flat]){display:inline-block;height:var(--ds-size-300, 1.5rem);width:var(--ds-size-300, 1.5rem)}:host([variant=flat]) .auro-button{height:100%;width:100%}::slotted(svg){vertical-align:middle}slot{pointer-events:none}.auro-button{position:relative;padding:0 var(--ds-size-300, 1.5rem);cursor:pointer;border-width:1px;border-style:solid;border-radius:var(--ds-border-radius, 0.375rem);font-family:var(--ds-font-family-default, "AS Circular", Helvetica Neue, Arial, sans-serif);font-size:var(--ds-text-body-size-default, 1rem);font-weight:var(--ds-text-body-default-weight, 500);overflow:hidden;text-overflow:ellipsis;user-select:none;white-space:nowrap;min-height:var(--ds-size-600, 3rem);max-height:var(--ds-size-600, 3rem);display:inline-flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--ds-size-100, 0.5rem);margin:0;-webkit-touch-callout:none;-webkit-user-select:none}.auro-button:active{transform:scale(0.95)}.auro-button:focus-visible:not([variant=secondary]):not([variant=tertiary]):not([variant=flat]):after{display:block;content:"";height:calc(100% - 2px);width:calc(100% - 2px);position:absolute;top:1px;left:1px;border-radius:4px;border-style:solid;border-width:2px}.auro-button:focus-visible[variant=secondary]:after,.auro-button:focus-visible[variant=tertiary]:after{display:block;content:"";height:100%;width:100%;position:absolute;top:0;left:0;border-radius:var(--ds-border-radius, 0.375rem);border-style:solid;border-width:2px}.auro-button.loading{cursor:not-allowed}.auro-button.loading *:not([auro-loader]){visibility:hidden}@media screen and (min-width: 576px){.auro-button{min-width:8.75rem;width:auto}}.auro-button:disabled{cursor:not-allowed;transform:unset}.auro-button[variant=secondary]:disabled{cursor:not-allowed;transform:unset}.auro-button[variant=tertiary]:disabled{cursor:not-allowed;transform:unset}.auro-button[variant=flat]{height:unset;width:unset;min-height:unset;max-height:unset;min-width:unset;max-width:unset;border:0;border-radius:unset;gap:unset;padding:unset}.auro-button[onDark]:disabled{cursor:not-allowed;transform:unset}.auro-button[onDark][variant=secondary]:disabled{cursor:not-allowed;transform:unset}@media(hover: hover){.auro-button[onDark][variant=tertiary]:active,.auro-button[onDark][variant=tertiary]:hover{box-shadow:none}}.auro-button[onDark][variant=tertiary]:active{box-shadow:none}.auro-button[onDark][variant=tertiary]:disabled{cursor:not-allowed;transform:unset}.auro-button--slim{padding:var(--ds-size-100, 0.5rem) var(--ds-size-200, 1rem);font-size:var(--ds-text-body-size-sm, 0.875rem);min-width:unset;min-height:calc(var(--ds-size-500, 2.5rem) - var(--ds-size-50, 0.25rem));max-height:calc(var(--ds-size-500, 2.5rem) - var(--ds-size-50, 0.25rem))}.auro-button--iconOnly{padding:0 var(--ds-size-100, 0.5rem);border-radius:100px;min-width:unset;height:var(--ds-size-600, 3rem);width:var(--ds-size-500, 2.5rem)}.auro-button--iconOnly ::slotted(auro-icon){width:var(--ds-size-300, 1.5rem);height:var(--ds-size-300, 1.5rem)}.auro-button--iconOnlySlim{padding:0 var(--ds-size-50, 0.25rem);height:calc(var(--ds-size-400, 2rem) + var(--ds-size-50, 0.25rem));width:calc(var(--ds-size-300, 1.5rem) + var(--ds-size-50, 0.25rem))}.auro-button--iconOnlySlim ::slotted(auro-icon){width:calc(var(--ds-size-200, 1rem) + var(--ds-size-50, 0.25rem));height:calc(var(--ds-size-200, 1rem) + var(--ds-size-50, 0.25rem))}.auro-button--rounded{border-radius:100px;box-shadow:var(--ds-elevation-300, 0px 0px 15px rgba(0, 0, 0, 0.2));height:var(--ds-size-500, 2.5rem);min-width:unset;transition:all 300ms ease-out}.auro-button--rounded ::slotted(auro-icon){width:var(--ds-size-300, 1.5rem);height:var(--ds-size-300, 1.5rem)}:host([rounded]) .textSlot{transition:opacity 300ms ease-in;opacity:1}:host([rounded][iconOnly]) .textSlot{opacity:0}:host([rounded][iconOnly]) .textWrapper{display:none}:host([rounded][iconOnly]) .auro-button{min-width:unset;padding:unset;width:var(--ds-size-600, 3rem)}[auro-loader]{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none}`;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* @license
|
|
247
|
+
* Copyright 2018 Google LLC
|
|
248
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
249
|
+
*/const o=o=>o??E;
|
|
250
|
+
|
|
117
251
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
118
252
|
// See LICENSE in the project root for license information.
|
|
119
253
|
|
|
@@ -154,171 +288,88 @@ let AuroDependencyVersioning$1 = class AuroDependencyVersioning {
|
|
|
154
288
|
}
|
|
155
289
|
};
|
|
156
290
|
|
|
157
|
-
|
|
158
|
-
* @license
|
|
159
|
-
* Copyright 2018 Google LLC
|
|
160
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
161
|
-
*/const o=o=>o??E;
|
|
162
|
-
|
|
163
|
-
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
291
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
164
292
|
// See LICENSE in the project root for license information.
|
|
165
293
|
|
|
294
|
+
// ---------------------------------------------------------------------
|
|
166
295
|
|
|
167
|
-
|
|
168
|
-
* @attr {Boolean} hidden - If present, the component will be hidden both visually and from screen readers
|
|
169
|
-
* @attr {Boolean} hiddenVisually - If present, the component will be hidden visually, but still read by screen readers
|
|
170
|
-
* @attr {Boolean} hiddenAudible - If present, the component will be hidden from screen readers, but seen visually
|
|
171
|
-
*/
|
|
296
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
172
297
|
|
|
173
|
-
|
|
298
|
+
let AuroLibraryRuntimeUtils$2 = class AuroLibraryRuntimeUtils {
|
|
174
299
|
|
|
175
|
-
|
|
176
|
-
static get properties() {
|
|
177
|
-
return {
|
|
178
|
-
hidden: { type: Boolean,
|
|
179
|
-
reflect: true },
|
|
180
|
-
hiddenVisually: { type: Boolean,
|
|
181
|
-
reflect: true },
|
|
182
|
-
hiddenAudible: { type: Boolean,
|
|
183
|
-
reflect: true },
|
|
184
|
-
};
|
|
185
|
-
}
|
|
300
|
+
/* eslint-disable jsdoc/require-param */
|
|
186
301
|
|
|
187
302
|
/**
|
|
188
|
-
*
|
|
303
|
+
* This will register a new custom element with the browser.
|
|
304
|
+
* @param {String} name - The name of the custom element.
|
|
305
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
306
|
+
* @returns {void}
|
|
189
307
|
*/
|
|
190
|
-
|
|
191
|
-
if (
|
|
192
|
-
|
|
308
|
+
registerComponent(name, componentClass) {
|
|
309
|
+
if (!customElements.get(name)) {
|
|
310
|
+
customElements.define(name, class extends componentClass {});
|
|
193
311
|
}
|
|
194
|
-
|
|
195
|
-
return 'false'
|
|
196
312
|
}
|
|
197
|
-
}
|
|
198
313
|
|
|
199
|
-
|
|
314
|
+
/**
|
|
315
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
316
|
+
* @returns {void}
|
|
317
|
+
*/
|
|
318
|
+
closestElement(
|
|
319
|
+
selector, // selector like in .closest()
|
|
320
|
+
base = this, // extra functionality to skip a parent
|
|
321
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
322
|
+
!el || el === document || el === window
|
|
323
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
324
|
+
: found
|
|
325
|
+
? found // found a selector INside this element
|
|
326
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
327
|
+
) {
|
|
328
|
+
return __Closest(base);
|
|
329
|
+
}
|
|
330
|
+
/* eslint-enable jsdoc/require-param */
|
|
200
331
|
|
|
201
|
-
|
|
332
|
+
/**
|
|
333
|
+
* 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.
|
|
334
|
+
* @param {Object} elem - The element to check.
|
|
335
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
336
|
+
* @returns {void}
|
|
337
|
+
*/
|
|
338
|
+
handleComponentTagRename(elem, tagName) {
|
|
339
|
+
const tag = tagName.toLowerCase();
|
|
340
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
202
341
|
|
|
203
|
-
|
|
342
|
+
if (elemTag !== tag) {
|
|
343
|
+
elem.setAttribute(tag, true);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
204
346
|
|
|
205
|
-
/**
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Validates if an element is a specific Auro component.
|
|
349
|
+
* @param {Object} elem - The element to validate.
|
|
350
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
351
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
352
|
+
*/
|
|
353
|
+
elementMatch(elem, tagName) {
|
|
354
|
+
const tag = tagName.toLowerCase();
|
|
355
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
212
356
|
|
|
213
|
-
|
|
214
|
-
* A minimal in-memory map to de-duplicate Fetch API media requests.
|
|
215
|
-
*
|
|
216
|
-
* @param {String} uri
|
|
217
|
-
* @param {Object} [options={}]
|
|
218
|
-
* @param {ResponseParser} [options.responseParser=(response) => response.text()]
|
|
219
|
-
* @returns {Promise}
|
|
220
|
-
*/
|
|
221
|
-
const cacheFetch = (uri, options = {}) => {
|
|
222
|
-
const responseParser = options.responseParser || ((response) => response.text());
|
|
223
|
-
if (!_fetchMap.has(uri)) {
|
|
224
|
-
_fetchMap.set(uri, fetch(uri).then(responseParser));
|
|
357
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
225
358
|
}
|
|
226
|
-
return _fetchMap.get(uri);
|
|
227
359
|
};
|
|
228
360
|
|
|
229
|
-
var styleCss$2 = i$5`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}.ico_squareLarge{fill:currentColor;height:var(--auro-size-lg, var(--ds-size-300, 1.5rem))}.ico_squareSmall{fill:currentColor;height:.6rem}.ico_squareMed{fill:currentColor;height:var(--auro-size-md, var(--ds-size-200, 1rem))}.ico_squareSml{fill:currentColor;height:var(--auro-size-sm, var(--ds-size-150, 0.75rem))}:host{color:currentColor;vertical-align:middle;line-height:1;display:inline-block}:host .logo{color:var(--ds-color-brand-midnight-400, #01426a)}svg{min-width:var(--ds-auro-icon-size, 1.5rem) !important;width:var(--ds-auro-icon-size, 1.5rem) !important;height:var(--ds-auro-icon-size, 1.5rem) !important}.label{display:flex;align-items:flex-start}.label svg{margin:0 var(--ds-size-50, 0.25rem)}.labelContainer{line-height:1.8}`;
|
|
361
|
+
var colorCss$3 = i$5`[auro-loader]{color:var(--ds-auro-button-loader-color)}.auro-button{-webkit-tap-highlight-color:var(--ds-auro-button-tap-color);color:var(--ds-auro-button-text-color);background-color:var(--ds-auro-button-container-color);background-image:linear-gradient(var(--ds-auro-button-container-image), var(--ds-auro-button-container-image));border-color:var(--ds-auro-button-border-color)}.auro-button:not([variant=secondary]):not([variant=tertiary]):focus-visible:after{border-color:var(--ds-auro-button-border-inset-color)}.auro-button:not([ondark]):active{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-active-default, #225296);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-active-default, #225296);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-active-default, #225296)}.auro-button:not([ondark])[disabled]{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-disabled-default, #a0c9f1);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-disabled-default, #a0c9f1);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-disabled-default, #a0c9f1)}@media(hover: hover){.auro-button:not([ondark]):active:not(:disabled),.auro-button:not([ondark]):hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-primary-hover-default, #193d73);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-hover-default, #193d73);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-hover-default, #193d73)}}.auro-button:not([ondark])[variant=secondary]{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-default-default, #ffffff);--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-default-default, #ffffff);--ds-auro-button-border-color: var(--ds-color-border-ui-default-default, #2c67b5);--ds-auro-button-text-color: var(--ds-color-text-ui-default-default, #2c67b5)}@media(hover: hover){.auro-button:not([ondark])[variant=secondary]:active:not(:disabled),.auro-button:not([ondark])[variant=secondary]:hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-hover-default, rgba(0, 0, 0, 0.03));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-hover-default, rgba(0, 0, 0, 0.03));--ds-auro-button-border-color: var(--ds-color-border-ui-hover-default, #193d73);--ds-auro-button-text-color: var(--ds-color-text-ui-hover-default, #193d73)}}.auro-button:not([ondark])[variant=secondary]:focus-visible{--ds-auro-button-border-inset-color: var(--ds-color-border-ui-focus-default, #2c67b5)}.auro-button:not([ondark])[variant=secondary]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-active-default, #f0f7fd);--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-active-default, #f0f7fd);--ds-auro-button-border-color: var(--ds-color-border-ui-active-default, #225296);--ds-auro-button-text-color: var(--ds-color-text-ui-active-default, #225296)}.auro-button:not([ondark])[variant=secondary]:disabled{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-disabled-default, #f7f7f7);--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-disabled-default, #f7f7f7);--ds-auro-button-border-color: var(--ds-color-border-ui-disabled-default, #adadad);--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-default, #adadad)}.auro-button:not([ondark])[variant=tertiary]{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-default-default, rgba(0, 0, 0, 0.03));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-default-default, rgba(0, 0, 0, 0.03));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-default-default, #2c67b5)}@media(hover: hover){.auro-button:not([ondark])[variant=tertiary]:active:not(:disabled),.auro-button:not([ondark])[variant=tertiary]:hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-hover-default, rgba(0, 0, 0, 0.12));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-hover-default, rgba(0, 0, 0, 0.12));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-hover-default, #193d73)}}.auro-button:not([ondark])[variant=tertiary]:focus-visible{--ds-auro-button-border-color: var(--ds-color-border-ui-default-default, #2c67b5);--ds-auro-button-border-inset-color: var(--ds-color-border-ui-default-default, #2c67b5)}.auro-button:not([ondark])[variant=tertiary]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-active-default, rgba(0, 0, 0, 0.06));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-active-default, rgba(0, 0, 0, 0.06));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-active-default, #225296)}.auro-button:not([ondark])[variant=tertiary]:disabled{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-disabled-default, rgba(0, 0, 0, 0.03));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-disabled-default, rgba(0, 0, 0, 0.03));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-default, #adadad)}.auro-button:not([ondark])[variant=flat]{color:var(--ds-color-icon-ui-secondary-default-default);background-color:transparent;background-image:none;border-color:transparent}@media(hover: hover){.auro-button:not([ondark])[variant=flat]:active:not(:disabled),.auro-button:not([ondark])[variant=flat]:hover:not(:disabled){color:var(--ds-color-icon-ui-secondary-hover-default);background-color:transparent;background-image:none;border-color:transparent}}.auro-button:not([ondark])[variant=flat]:disabled{color:var(--ds-color-icon-ui-secondary-disabled-default);background-color:transparent;background-image:none;border-color:transparent}.auro-button[ondark]{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-default-inverse, #56bbde);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-default-inverse, #56bbde);--ds-auro-button-text-color: var(--ds-color-text-primary-default, #2a2a2a);--ds-auro-button-loader-color: var(--ds-color-text-primary-inverse, #ffffff);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-default-inverse, #56bbde)}@media(hover: hover){.auro-button[ondark]:active:not(:disabled),.auro-button[ondark]:hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-primary-hover-inverse, #a8e9f7);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-hover-inverse, #a8e9f7);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-hover-inverse, #a8e9f7)}}.auro-button[ondark]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-active-inverse, #6ad5ef);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-active-inverse, #6ad5ef);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-active-inverse, #6ad5ef)}.auro-button[ondark][disabled]{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-disabled-inverse, #275b72);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-disabled-inverse, #275b72);--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-inverse, #7e7e7e);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-disabled-inverse, #275b72)}.auro-button[ondark][variant=secondary]{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-default-inverse, rgba(255, 255, 255, 0.03));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-default-inverse, rgba(255, 255, 255, 0.03));--ds-auro-button-border-color: var(--ds-color-border-ui-default-inverse, #56bbde);--ds-auro-button-text-color: var(--ds-color-text-ui-default-inverse, #56bbde)}@media(hover: hover){.auro-button[ondark][variant=secondary]:hover{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-hover-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-hover-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-border-color: var(--ds-color-border-ui-hover-inverse, #a8e9f7);--ds-auro-button-text-color: var(--ds-color-text-ui-hover-inverse, #a8e9f7)}}.auro-button[ondark][variant=secondary]:focus-visible{--ds-auro-button-border-inset-color: var(--ds-color-border-ui-focus-inverse, #56bbde)}.auro-button[ondark][variant=secondary]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-active-inverse, rgba(255, 255, 255, 0.06));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-active-inverse, rgba(255, 255, 255, 0.06));--ds-auro-button-border-color: var(--ds-color-border-ui-active-inverse, #6ad5ef);--ds-auro-button-text-color: var(--ds-color-text-ui-active-inverse, #6ad5ef)}.auro-button[ondark][variant=secondary]:disabled{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-disabled-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-disabled-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-border-color: var(--ds-color-border-ui-disabled-inverse, #7e7e7e);--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-inverse, #7e7e7e)}.auro-button[ondark][variant=tertiary]{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-default-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-default-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-default-inverse, #56bbde)}@media(hover: hover){.auro-button[ondark][variant=tertiary]:active:not(:disabled),.auro-button[ondark][variant=tertiary]:hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-hover-inverse, rgba(255, 255, 255, 0.25));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-hover-inverse, rgba(255, 255, 255, 0.25));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-hover-inverse, #a8e9f7)}}.auro-button[ondark][variant=tertiary]:focus-visible{--ds-auro-button-border-color: var(--ds-color-border-ui-default-inverse, #56bbde);--ds-auro-button-border-inset-color: var(--ds-color-border-ui-default-inverse, #56bbde)}.auro-button[ondark][variant=tertiary]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-active-inverse, rgba(255, 255, 255, 0.06));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-active-inverse, rgba(255, 255, 255, 0.06));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-active-inverse, #6ad5ef)}.auro-button[ondark][variant=tertiary]:disabled{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-disabled-inverse, rgba(255, 255, 255, 0.25));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-disabled-inverse, rgba(255, 255, 255, 0.25));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-inverse, #7e7e7e)}.auro-button[ondark][variant=flat]{color:var(--ds-color-icon-ui-secondary-default-inverse);background-color:transparent;background-image:none;border-color:transparent}@media(hover: hover){.auro-button[ondark][variant=flat]:active:not(:disabled),.auro-button[ondark][variant=flat]:hover:not(:disabled){color:var(--ds-color-icon-ui-secondary-hover-inverse);background-color:transparent;background-image:none;border-color:transparent}}.auro-button[ondark][variant=flat]:disabled{color:var(--ds-color-icon-ui-disabled-default);background-color:transparent;background-image:none;border-color:transparent}`;
|
|
230
362
|
|
|
231
|
-
|
|
363
|
+
var tokensCss$3 = i$5`:host{--ds-auro-button-border-color: var(--ds-color-container-ui-primary-default-default, #2c67b5);--ds-auro-button-border-inset-color: var(--ds-color-border-emphasis-inverse, #f2f7fb);--ds-auro-button-container-color: var(--ds-color-container-ui-primary-default-default, #2c67b5);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-default-default, #2c67b5);--ds-auro-button-loader-color: var(--ds-color-utility-navy-default, #265688);--ds-auro-button-text-color: var(--ds-color-text-primary-inverse, #ffffff);--ds-auro-button-tap-color: transparent}`;
|
|
364
|
+
|
|
365
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
232
366
|
// See LICENSE in the project root for license information.
|
|
233
367
|
|
|
368
|
+
// ---------------------------------------------------------------------
|
|
234
369
|
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* @attr {Boolean} onDark - Set value for on-dark version of auro-icon
|
|
238
|
-
* @slot - Hidden from visibility, used for a11y if icon description is needed
|
|
239
|
-
*/
|
|
370
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
240
371
|
|
|
241
|
-
|
|
242
|
-
class BaseIcon extends AuroElement {
|
|
243
|
-
constructor() {
|
|
244
|
-
super();
|
|
245
|
-
this.onDark = false;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// function to define props used within the scope of this component
|
|
249
|
-
static get properties() {
|
|
250
|
-
return {
|
|
251
|
-
...super.properties,
|
|
252
|
-
onDark: {
|
|
253
|
-
type: Boolean,
|
|
254
|
-
reflect: true
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* @private
|
|
259
|
-
*/
|
|
260
|
-
svg: {
|
|
261
|
-
attribute: false,
|
|
262
|
-
reflect: true
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
static get styles() {
|
|
268
|
-
return i$5`
|
|
269
|
-
${styleCss$2}
|
|
270
|
-
`;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Async function to fetch requested icon from npm CDN.
|
|
275
|
-
* @private
|
|
276
|
-
* @param {string} category - Icon category.
|
|
277
|
-
* @param {string} name - Icon name.
|
|
278
|
-
* @returns {SVGElement} DOM - Ready HTML to be appended.
|
|
279
|
-
*/
|
|
280
|
-
async fetchIcon(category, name) {
|
|
281
|
-
let iconHTML = '';
|
|
282
|
-
|
|
283
|
-
if (category === 'logos') {
|
|
284
|
-
iconHTML = await cacheFetch(`${this.uri}/${category}/${name}.svg`);
|
|
285
|
-
} else {
|
|
286
|
-
iconHTML = await cacheFetch(`${this.uri}/icons/${category}/${name}.svg`);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const dom = new DOMParser().parseFromString(iconHTML, 'text/html');
|
|
290
|
-
|
|
291
|
-
return dom.body.querySelector('svg');
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// lifecycle function
|
|
295
|
-
async firstUpdated() {
|
|
296
|
-
if (!this.customSvg) {
|
|
297
|
-
const svg = await this.fetchIcon(this.category, this.name);
|
|
298
|
-
|
|
299
|
-
if (svg) {
|
|
300
|
-
this.svg = svg;
|
|
301
|
-
} else if (!svg) {
|
|
302
|
-
const penDOM = new DOMParser().parseFromString(error.svg, 'text/html');
|
|
303
|
-
|
|
304
|
-
this.svg = penDOM.body.firstChild;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
var tokensCss$3 = i$5`:host{--ds-auro-icon-color: var(--ds-color-icon-primary-default, $ds-color-icon-primary-default);--ds-auro-icon-size: var(--ds-size-300, $ds-size-300)}`;
|
|
311
|
-
|
|
312
|
-
var colorCss$3 = i$5`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[accent]){--ds-auro-icon-color: var(--ds-color-icon-accent-default, #a2c270)}:host(:not([onDark])[disabled]){--ds-auro-icon-color: var(--ds-color-icon-ui-primary-disabled-default, #adadad)}:host(:not([onDark])[emphasis]){--ds-auro-icon-color: var(--ds-color-icon-emphasis-default, #2a2a2a)}:host(:not([onDark])[error]){--ds-auro-icon-color: var(--ds-color-icon-error-default, #cc1816)}:host(:not([onDark])[info]){--ds-auro-icon-color: var(--ds-color-icon-info-default, #326aa5)}:host(:not([onDark])[secondary]){--ds-auro-icon-color: var(--ds-color-icon-secondary-default, #7e8894)}:host(:not([onDark])[subtle]){--ds-auro-icon-color: var(--ds-color-icon-subtle-default, #a0c9f1)}:host(:not([onDark])[success]){--ds-auro-icon-color: var(--ds-color-icon-success-default, #40a080)}:host(:not([onDark])[tertiary]){--ds-auro-icon-color: var(--ds-color-icon-tertiary-default, #afb9c6)}:host(:not([onDark])[warning]){--ds-auro-icon-color: var(--ds-color-icon-warning-default, #c49432)}:host([onDark]){--ds-auro-icon-color: var(--ds-color-icon-primary-inverse, #f7f7f7)}:host([onDark][accent]){--ds-auro-icon-color: var(--ds-color-icon-accent-inverse, #badd81)}:host([onDark][disabled]){--ds-auro-icon-color: var(--ds-color-icon-ui-primary-disabled-inverse, #7e7e7e)}:host([onDark][emphasis]){--ds-auro-icon-color: var(--ds-color-icon-emphasis-inverse, #ffffff)}:host([onDark][error]){--ds-auro-icon-color: var(--ds-color-icon-error-inverse, #f9aca6)}:host([onDark][info]){--ds-auro-icon-color: var(--ds-color-icon-info-inverse, #89b2d4)}:host([onDark][secondary]){--ds-auro-icon-color: var(--ds-color-icon-secondary-inverse, #ccd2db)}:host([onDark][subtle]){--ds-auro-icon-color: var(--ds-color-icon-subtle-inverse, #326aa5)}:host([onDark][success]){--ds-auro-icon-color: var(--ds-color-icon-success-inverse, #8eceb9)}:host([onDark][tertiary]){--ds-auro-icon-color: var(--ds-color-icon-tertiary-inverse, #939fad)}:host([onDark][warning]){--ds-auro-icon-color: var(--ds-color-icon-warning-inverse, #f2c153)}`;
|
|
313
|
-
|
|
314
|
-
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
315
|
-
// See LICENSE in the project root for license information.
|
|
316
|
-
|
|
317
|
-
// ---------------------------------------------------------------------
|
|
318
|
-
|
|
319
|
-
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
320
|
-
|
|
321
|
-
let AuroLibraryRuntimeUtils$2 = class AuroLibraryRuntimeUtils {
|
|
372
|
+
let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
|
|
322
373
|
|
|
323
374
|
/* eslint-disable jsdoc/require-param */
|
|
324
375
|
|
|
@@ -381,139 +432,81 @@ let AuroLibraryRuntimeUtils$2 = class AuroLibraryRuntimeUtils {
|
|
|
381
432
|
}
|
|
382
433
|
};
|
|
383
434
|
|
|
435
|
+
var styleCss$2 = i$5`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}:host,:host>span{position:relative}:host{width:2rem;height:2rem;display:inline-block;font-size:0}:host>span{position:absolute;display:inline-block;float:none;top:0;left:0;width:2rem;height:2rem;border-radius:100%;border-style:solid;border-width:0}:host([xs]),:host([xs])>span{width:1.2rem;height:1.2rem}:host([sm]),:host([sm])>span{width:3rem;height:3rem}:host([md]),:host([md])>span{width:5rem;height:5rem}:host([lg]),:host([lg])>span{width:8rem;height:8rem}:host{--margin: 0.375rem;--margin-xs: 0.2rem;--margin-sm: 0.5rem;--margin-md: 0.75rem;--margin-lg: 1rem}:host([pulse]),:host([pulse])>span{position:relative}:host([pulse]){width:calc(3rem + var(--margin)*6);height:1.5rem}:host([pulse])>span{width:1rem;height:1rem;margin:var(--margin);animation:pulse 1.5s ease infinite}:host([pulse][xs]){width:calc(2.55rem + var(--margin-xs)*6);height:1.55rem}:host([pulse][xs])>span{margin:var(--margin-xs);width:.65rem;height:.65rem}:host([pulse][sm]){width:calc(6rem + var(--margin-sm)*6);height:2.5rem}:host([pulse][sm])>span{margin:var(--margin-sm);width:2rem;height:2rem}:host([pulse][md]){width:calc(9rem + var(--margin-md)*6);height:3.5rem}:host([pulse][md])>span{margin:var(--margin-md);width:3rem;height:3rem}:host([pulse][lg]){width:calc(15rem + var(--margin-lg)*6);height:5.5rem}:host([pulse][lg])>span{margin:var(--margin-lg);width:5rem;height:5rem}:host([pulse])>span:nth-child(1){animation-delay:-400ms}:host([pulse])>span:nth-child(2){animation-delay:-200ms}:host([pulse])>span:nth-child(3){animation-delay:0ms}@keyframes pulse{0%,100%{opacity:.1;transform:scale(0.9)}50%{opacity:1;transform:scale(1.1)}}:host([orbit]),:host([orbit])>span{opacity:1}:host([orbit])>span{border-width:5px}:host([orbit])>span:nth-child(2){animation:orbit 2s linear infinite}:host([orbit][sm])>span{border-width:8px}:host([orbit][md])>span{border-width:13px}:host([orbit][lg])>span{border-width:21px}@keyframes orbit{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}:host([ringworm])>svg{animation:rotate 2s linear infinite;height:100%;width:100%;stroke:currentcolor;stroke-width:8}:host([ringworm]) .path{stroke-dashoffset:0;animation:ringworm 1.5s ease-in-out infinite;stroke-linecap:round}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes ringworm{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}100%{stroke-dasharray:89,200;stroke-dashoffset:-124px}}:host([laser]){position:static;width:100%;display:block;height:0;overflow:hidden;font-size:unset}:host([laser])>span{position:fixed;width:100%;height:.25rem;border-radius:0;z-index:100}:host([laser])>span:nth-child(1){border-color:currentcolor;opacity:.25}:host([laser])>span:nth-child(2){border-color:currentcolor;animation:laser 2s linear infinite;opacity:1;width:50%}:host([laser][sm])>span:nth-child(2){width:20%}:host([laser][md])>span:nth-child(2){width:30%}:host([laser][lg])>span:nth-child(2){width:50%;animation-duration:1.5s}:host([laser][xl])>span:nth-child(2){width:80%;animation-duration:1.5s}@keyframes laser{0%{left:-100%}100%{left:110%}}:host>.no-animation{display:none}@media(prefers-reduced-motion: reduce){:host{display:flex;align-items:center;justify-content:center;font-size:1rem}:host>span{opacity:1}:host>.loader{display:none}:host>.no-animation{display:block}}`;
|
|
436
|
+
|
|
437
|
+
var colorCss$2 = i$5`:host{color:var(--ds-auro-loader-color)}:host>span{background-color:var(--ds-auro-loader-background-color);border-color:var(--ds-auro-loader-border-color)}:host([onlight]){--ds-auro-loader-color: var(--ds-color-utility-navy-default, #265688)}:host([ondark]){--ds-auro-loader-color: var(--ds-color-utility-cyan-inverse, #a8e9f7)}:host([white]){--ds-auro-loader-color: var(--ds-color-utility-neutral-inverse, #ccd2db)}:host([orbit])>span{--ds-auro-loader-background-color: transparent}:host([orbit])>span:nth-child(1){--ds-auro-loader-border-color: currentcolor;opacity:.25}:host([orbit])>span:nth-child(2){--ds-auro-loader-border-color: currentcolor;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent}`;
|
|
438
|
+
|
|
439
|
+
var tokensCss$2 = i$5`:host{--ds-auro-loader-background-color: currentcolor;--ds-auro-loader-border-color: currentcolor;--ds-auro-loader-color: currentcolor}`;
|
|
440
|
+
|
|
384
441
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
385
442
|
// See LICENSE in the project root for license information.
|
|
386
443
|
|
|
387
444
|
|
|
388
445
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
389
446
|
/**
|
|
390
|
-
* auro-
|
|
447
|
+
* The auro-loader element is an easy to use animated loader component.
|
|
391
448
|
*
|
|
392
|
-
* @attr {
|
|
393
|
-
* @attr {
|
|
394
|
-
* @attr {Boolean}
|
|
395
|
-
* @attr {Boolean}
|
|
396
|
-
* @attr {Boolean}
|
|
397
|
-
* @attr {Boolean}
|
|
398
|
-
* @attr {Boolean}
|
|
399
|
-
* @attr {Boolean}
|
|
400
|
-
* @attr {Boolean}
|
|
401
|
-
* @attr {Boolean}
|
|
402
|
-
* @attr {Boolean}
|
|
403
|
-
* @
|
|
404
|
-
* @attr {Boolean} tertiary - Sets the icon to use the tertiary style.
|
|
405
|
-
* @attr {Boolean} subtle - Sets the icon to use the subtle style.
|
|
406
|
-
* @attr {Boolean} success - Sets the icon to use the success style.
|
|
407
|
-
* @attr {Boolean} warning - Sets the icon to use the warning style.
|
|
408
|
-
* @attr {String} ariaHidden - Set aria-hidden value. Default is `true`. Option is `false`.
|
|
409
|
-
* @attr {String} uri - Set the uri for CDN used when fetching icons
|
|
410
|
-
* @slot - Hidden from visibility, used for a11y if icon description is needed.
|
|
411
|
-
* @slot svg - Used for custom SVG content.
|
|
449
|
+
* @attr {Boolean} pulse - sets loader type
|
|
450
|
+
* @attr {Boolean} ringworm - sets loader type
|
|
451
|
+
* @attr {Boolean} laser - sets loader type
|
|
452
|
+
* @attr {Boolean} orbit - sets loader type
|
|
453
|
+
* @attr {Boolean} white - sets color of loader to white
|
|
454
|
+
* @attr {Boolean} ondark - sets color of loader to auro-color-ui-default-on-dark
|
|
455
|
+
* @attr {Boolean} onlight - sets color of loader to auro-color-ui-default-on-light
|
|
456
|
+
* @attr {Boolean} xs - sets size to extra small
|
|
457
|
+
* @attr {Boolean} sm - sets size to small
|
|
458
|
+
* @attr {Boolean} md - sets size to medium
|
|
459
|
+
* @attr {Boolean} lg - sets size to large
|
|
460
|
+
* @csspart element - apply style to adjust speed of animation
|
|
412
461
|
*/
|
|
413
462
|
|
|
414
463
|
// build the component class
|
|
415
|
-
class
|
|
464
|
+
class AuroLoader extends r {
|
|
416
465
|
constructor() {
|
|
417
466
|
super();
|
|
418
467
|
|
|
419
|
-
|
|
468
|
+
/**
|
|
469
|
+
* @private
|
|
470
|
+
*/
|
|
471
|
+
this.keys = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
420
472
|
|
|
421
|
-
|
|
422
|
-
|
|
473
|
+
/**
|
|
474
|
+
* @private
|
|
475
|
+
*/
|
|
476
|
+
this.mdCount = 3;
|
|
423
477
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
this.
|
|
433
|
-
|
|
434
|
-
this.
|
|
435
|
-
this.
|
|
436
|
-
this.
|
|
437
|
-
this.
|
|
438
|
-
this.primary = false;
|
|
439
|
-
this.secondary = false;
|
|
440
|
-
this.subtle = false;
|
|
441
|
-
this.success = false;
|
|
442
|
-
this.tertiary = false;
|
|
443
|
-
this.warning = false;
|
|
444
|
-
this.runtimeUtils = new AuroLibraryRuntimeUtils$2();
|
|
478
|
+
/**
|
|
479
|
+
* @private
|
|
480
|
+
*/
|
|
481
|
+
this.smCount = 2;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* @private
|
|
485
|
+
*/
|
|
486
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
|
|
487
|
+
|
|
488
|
+
this.orbit = false;
|
|
489
|
+
this.ringworm = false;
|
|
490
|
+
this.laser = false;
|
|
491
|
+
this.pulse = false;
|
|
445
492
|
}
|
|
446
493
|
|
|
447
494
|
// function to define props used within the scope of this component
|
|
448
495
|
static get properties() {
|
|
449
496
|
return {
|
|
450
|
-
|
|
451
|
-
accent: {
|
|
452
|
-
type: Boolean,
|
|
453
|
-
reflect: true
|
|
454
|
-
},
|
|
455
|
-
ariaHidden: {
|
|
456
|
-
type: String,
|
|
457
|
-
reflect: true
|
|
458
|
-
},
|
|
459
|
-
category: {
|
|
460
|
-
type: String,
|
|
461
|
-
reflect: true
|
|
462
|
-
},
|
|
463
|
-
customColor: {
|
|
464
|
-
type: Boolean
|
|
465
|
-
},
|
|
466
|
-
customSvg: {
|
|
467
|
-
type: Boolean
|
|
468
|
-
},
|
|
469
|
-
disabled: {
|
|
470
|
-
type: Boolean,
|
|
471
|
-
reflect: true
|
|
472
|
-
},
|
|
473
|
-
emphasis: {
|
|
474
|
-
type: Boolean,
|
|
475
|
-
reflect: true
|
|
476
|
-
},
|
|
477
|
-
error: {
|
|
478
|
-
type: Boolean,
|
|
479
|
-
reflect: true
|
|
480
|
-
},
|
|
481
|
-
info: {
|
|
482
|
-
type: Boolean,
|
|
483
|
-
reflect: true
|
|
484
|
-
},
|
|
485
|
-
label: {
|
|
486
|
-
type: Boolean,
|
|
487
|
-
reflect: true
|
|
488
|
-
},
|
|
489
|
-
name: {
|
|
490
|
-
type: String,
|
|
491
|
-
reflect: true
|
|
492
|
-
},
|
|
493
|
-
primary: {
|
|
494
|
-
type: Boolean,
|
|
495
|
-
reflect: true
|
|
496
|
-
},
|
|
497
|
-
secondary: {
|
|
498
|
-
type: Boolean,
|
|
499
|
-
reflect: true
|
|
500
|
-
},
|
|
501
|
-
subtle: {
|
|
497
|
+
pulse: {
|
|
502
498
|
type: Boolean,
|
|
503
499
|
reflect: true
|
|
504
500
|
},
|
|
505
|
-
|
|
501
|
+
orbit: {
|
|
506
502
|
type: Boolean,
|
|
507
503
|
reflect: true
|
|
508
504
|
},
|
|
509
|
-
|
|
505
|
+
ringworm: {
|
|
510
506
|
type: Boolean,
|
|
511
507
|
reflect: true
|
|
512
508
|
},
|
|
513
|
-
|
|
514
|
-
type: String
|
|
515
|
-
},
|
|
516
|
-
warning: {
|
|
509
|
+
laser: {
|
|
517
510
|
type: Boolean,
|
|
518
511
|
reflect: true
|
|
519
512
|
}
|
|
@@ -522,376 +515,332 @@ class AuroIcon extends BaseIcon {
|
|
|
522
515
|
|
|
523
516
|
static get styles() {
|
|
524
517
|
return [
|
|
525
|
-
super.styles,
|
|
526
|
-
i$5`${tokensCss$3}`,
|
|
527
518
|
i$5`${styleCss$2}`,
|
|
528
|
-
i$5`${colorCss$
|
|
519
|
+
i$5`${colorCss$2}`,
|
|
520
|
+
i$5`${tokensCss$2}`
|
|
529
521
|
];
|
|
530
522
|
}
|
|
531
523
|
|
|
532
524
|
/**
|
|
533
525
|
* This will register this element with the browser.
|
|
534
|
-
* @param {string} [name="auro-
|
|
526
|
+
* @param {string} [name="auro-loader"] - The name of element that you want to register to.
|
|
535
527
|
*
|
|
536
528
|
* @example
|
|
537
|
-
*
|
|
529
|
+
* AuroLoader.register("custom-loader") // this will register this element to <custom-loader/>
|
|
538
530
|
*
|
|
539
531
|
*/
|
|
540
|
-
static register(name = "auro-
|
|
541
|
-
AuroLibraryRuntimeUtils$
|
|
532
|
+
static register(name = "auro-loader") {
|
|
533
|
+
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroLoader);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
firstUpdated() {
|
|
537
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
538
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-loader');
|
|
542
539
|
}
|
|
543
540
|
|
|
544
541
|
connectedCallback() {
|
|
545
542
|
super.connectedCallback();
|
|
543
|
+
}
|
|
546
544
|
|
|
547
|
-
|
|
548
|
-
|
|
545
|
+
/**
|
|
546
|
+
* @private
|
|
547
|
+
* @returns {Array} Numbered array for template map.
|
|
548
|
+
*/
|
|
549
|
+
defineTemplate() {
|
|
550
|
+
let nodes = Array.from(Array(this.mdCount).keys());
|
|
551
|
+
|
|
552
|
+
if (this.orbit || this.laser) {
|
|
553
|
+
nodes = Array.from(Array(this.smCount).keys());
|
|
554
|
+
} else if (this.ringworm) {
|
|
555
|
+
nodes = Array.from(Array(0).keys());
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
return nodes;
|
|
549
559
|
}
|
|
550
560
|
|
|
561
|
+
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
562
|
+
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
563
|
+
|
|
551
564
|
// function that renders the HTML and CSS into the scope of the component
|
|
552
565
|
render() {
|
|
553
|
-
const a11y = {
|
|
554
|
-
'labelContainer': true,
|
|
555
|
-
'util_displayHiddenVisually': !this.label
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
const classes = {
|
|
559
|
-
'label': this.label
|
|
560
|
-
};
|
|
561
|
-
|
|
562
566
|
return x`
|
|
563
|
-
|
|
564
|
-
class="
|
|
565
|
-
|
|
566
|
-
<span aria-hidden="${o(this.ariaHidden ? this.ariaHidden : true)}" part="svg">
|
|
567
|
-
${this.customSvg ? x`
|
|
568
|
-
<slot name="svg"></slot>
|
|
569
|
-
` : x`
|
|
570
|
-
${this.svg}
|
|
571
|
-
`
|
|
572
|
-
}
|
|
573
|
-
</span>
|
|
567
|
+
${this.defineTemplate().map((idx) => x`
|
|
568
|
+
<span part="element" class="loader node-${idx}"></span>
|
|
569
|
+
`)}
|
|
574
570
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
571
|
+
<div class="no-animation">Loading...</div>
|
|
572
|
+
|
|
573
|
+
${this.ringworm ? x`
|
|
574
|
+
<svg part="element" class="circular" viewBox="25 25 50 50">
|
|
575
|
+
<circle class="path" cx="50" cy="50" r="20" fill="none"/>
|
|
576
|
+
</svg>`
|
|
577
|
+
: ``
|
|
578
|
+
}
|
|
579
579
|
`;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
-
var
|
|
584
|
-
|
|
585
|
-
var chevronUp = {"role":"img","color":"currentColor","title":"","desc":"Directional indicator; up.","width":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","height":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","xmlns":"http://www.w3.org/2000/svg","xmlns_xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 24 24","path":"/icons","style":"ico_squareLarge","type":"icon","name":"chevron-up","category":"interface","svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"chevron-up__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"chevron-up__desc\">Directional indicator; up.</desc><path d=\"m17.603 14.343-.073.084a.75.75 0 0 1-.976.073l-.084-.073L12 9.957l-4.47 4.47a.75.75 0 0 1-.976.073l-.084-.073a.75.75 0 0 1-.073-.976l.073-.085 4.823-4.823a1 1 0 0 1 1.414 0l4.823 4.823a.75.75 0 0 1 .073.977\"/></svg>"};
|
|
586
|
-
|
|
587
|
-
var chevronDown = {"role":"img","color":"currentColor","title":"","desc":"Directional indicator; down.","width":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","height":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","xmlns":"http://www.w3.org/2000/svg","xmlns_xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 24 24","path":"/icons","style":"ico_squareLarge","type":"icon","name":"chevron-down","category":"interface","svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"chevron-down__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"chevron-down__desc\">Directional indicator; down.</desc><path d=\"m6.397 9.554.073-.084a.75.75 0 0 1 .976-.073l.084.073L12 13.939l4.47-4.47a.75.75 0 0 1 .976-.072l.084.073a.75.75 0 0 1 .073.976l-.073.084L13.061 15l-.354.354a1 1 0 0 1-1.414 0L10.939 15l-4.47-4.47a.75.75 0 0 1-.072-.976l.073-.084z\"/></svg>"};
|
|
588
|
-
|
|
589
|
-
var styleCss$1 = i$5`:host{interpolate-size:allow-keywords}:host .trigger{position:relative;cursor:pointer;display:inline-block;border-width:1px;border-style:solid;border-radius:var(--ds-border-radius, 0.375rem)}:host .trigger:hover{text-decoration:underline}:host ::slotted([slot=trigger]){padding-left:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem);font-size:var(--ds-text-heading-300-size, 1.125rem)}:host .iconWrapper{height:var(--ds-size-300, 1.5rem);margin-top:-2px}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300,$ds-size-300)}:host [auro-icon][hidden]{display:none}:host .content{width:100%;transition:all .5s ease-in-out;transition-property:height;font-size:var(--ds-text-body-size-default, 1rem)}:host .componentWrapper{height:100%;overflow:hidden}:host .contentWrapper{padding-left:var(--ds-size-400, 2rem);padding-bottom:var(--ds-size-300, 1.5rem);padding-right:var(--ds-size-200, 1rem)}:host(:focus) .trigger{border-width:1px;border-style:solid}:host([chevron=right]) ::slotted([slot=trigger]){padding-left:0;padding-right:var(--ds-size-50, 0.25rem)}:host([alignRight]) .componentWrapper{display:flex;flex-direction:column;align-items:flex-end}:host([fluid]) .trigger{width:100%}:host([grouped]) .componentWrapper{border-bottom-width:1px;border-bottom-style:solid}:host(:not([expanded])) .content,:host([expanded=false]) .content{height:0 !important}:host([expanded]) .content{height:auto}:host([emphasis]) .trigger{border-style:solid;border-width:1px;border-left-width:2px;padding-left:var(--ds-size-200, 1rem)}:host([emphasis]) .trigger:before{display:block;position:absolute;top:-1px;left:-2px;width:1px;height:calc(100% + 2px);content:"";border-left-style:solid;border-left-width:2px}:host([emphasis]) .trigger:focus{border-left-width:1px;margin-left:1px}:host([emphasis]) .content{border-left-width:2px;border-left-style:solid;padding:unset}:host([emphasis]) .contentWrapper{padding-left:var(--ds-size-200, 1rem)}:host([emphasis]) .iconWrapper{padding-right:var(--ds-size-200, 1rem)}:host([emphasis]:not([expanded]):hover) .trigger{text-decoration:unset}:host([variant=sm]) ::slotted([slot=trigger]){font-size:var(--ds-text-body-size-default, 1rem)}:host([variant=lg]) ::slotted([slot=trigger]){font-size:var(--ds-text-heading-400-size, 1.25rem)}:host([chevron=none]) ::slotted([slot=trigger]),:host([chevron=none]) .contentWrapper{padding-left:unset}`;
|
|
590
|
-
|
|
591
|
-
var colorCss$2 = i$5`:host .trigger{color:var(--ds-auro-accordion-trigger-color);border-color:var(--ds-auro-accordion-trigger-border-color)}:host [auro-icon]{color:var(--ds-auro-accordion-trigger-icon-color)}:host(:focus){--ds-auro-accordion-trigger-border-color: var(--ds-color-border-active-default, #0074c8);--ds-auro-accordion-trigger-icon-color: var(--ds-color-icon-ui-secondary-focus-default, #7e7e7e)}:host(:hover){--ds-auro-accordion-trigger-icon-color: var(--ds-color-icon-ui-secondary-hover-default, #525252)}:host([grouped]) .componentWrapper{border-bottom-color:var(--ds-auro-accordion-group-border-color)}:host([emphasis]) .trigger:before{border-color:var(--ds-auro-accordion-trigger-border-color)}:host([emphasis]) .trigger:focus:before,:host([emphasis]) .trigger:hover:before{--ds-auro-accordion-trigger-border-color: var(--ds-color-border-active-default, #0074c8)}:host([emphasis]) .trigger:focus{--ds-auro-accordion-trigger-border-color: var(--ds-color-border-active-default, #0074c8)}:host([emphasis]) .content{border-left-color:var(--ds-auro-accordion-content-border-color)}:host([emphasis][expanded]) .trigger:before{--ds-auro-accordion-trigger-border-color: var(--ds-color-border-active-default, #0074c8)}:host([emphasis][expanded]) .content{--ds-auro-accordion-content-border-color: var(--ds-color-border-subtle-default, #f0f7fd)}`;
|
|
592
|
-
|
|
593
|
-
var tokensCss$2 = i$5`:host{--ds-auro-accordion-content-border-color: transparent;--ds-auro-accordion-group-border-color: var(--ds-color-border-divider-default, rgba(0, 0, 0, 0.12));--ds-auro-accordion-trigger-border-color: transparent;--ds-auro-accordion-trigger-color: var(--ds-color-text-primary-default, #2a2a2a);--ds-auro-accordion-trigger-icon-color: var(--ds-color-icon-ui-secondary-default-default, #7e7e7e)}`;
|
|
583
|
+
var loaderVersion = '3.1.1';
|
|
594
584
|
|
|
595
|
-
// Copyright (c)
|
|
585
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
596
586
|
// See LICENSE in the project root for license information.
|
|
597
587
|
|
|
598
588
|
|
|
599
|
-
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
600
589
|
/**
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
* @attr {Boolean}
|
|
605
|
-
* @attr {Boolean}
|
|
606
|
-
* @attr {Boolean}
|
|
607
|
-
* @attr {Boolean}
|
|
608
|
-
* @attr {
|
|
609
|
-
* @attr {String}
|
|
610
|
-
* @
|
|
611
|
-
* @
|
|
612
|
-
* @
|
|
613
|
-
* @
|
|
614
|
-
* @
|
|
615
|
-
* @
|
|
616
|
-
* @
|
|
590
|
+
* @attr {Boolean} autofocus - This Boolean attribute lets you specify that the button should have input focus when the page loads, unless overridden by the user
|
|
591
|
+
* @attr {Boolean} disabled - If set to true button will become disabled and not allow for interactions
|
|
592
|
+
* @attr {Boolean} iconOnly - If set to true, the button will contain an icon with no additional content
|
|
593
|
+
* @attr {Boolean} loading - If set to true button text will be replaced with `auro-loader` and become disabled
|
|
594
|
+
* @attr {Boolean} onDark - Set value for on-dark version of auro-button
|
|
595
|
+
* @attr {Boolean} rounded - If set to true, the button will have a rounded shape
|
|
596
|
+
* @attr {Boolean} slim - Set value for slim version of auro-button
|
|
597
|
+
* @attr {Boolean} fluid - Alters the shape of the button to be full width of its parent container
|
|
598
|
+
* @attr {String} arialabel - Populates the `aria-label` attribute that is used to define a string that labels the current element. Use it in cases where a text label is not visible on the screen. If there is visible text labeling the element, use `aria-labelledby` instead.
|
|
599
|
+
* @attr {String} arialabelledby - Populates the `aria-labelledby` attribute that establishes relationships between objects and their label(s), and its value should be one or more element IDs, which refer to elements that have the text needed for labeling. List multiple element IDs in a space delimited fashion.
|
|
600
|
+
* @attr {String} id - Set the unique ID of an element.
|
|
601
|
+
* @attr {String} title - Sets title attribute. The information is most often shown as a tooltip text when the mouse moves over the element.
|
|
602
|
+
* @attr {String} type - The type of the button. Possible values are: `submit`, `reset`, `button`
|
|
603
|
+
* @attr {String} value - Defines the value associated with the button which is submitted with the form data.
|
|
604
|
+
* @attr {String} variant - Sets button variant option. Possible values are: `secondary`, `tertiary`
|
|
605
|
+
* @attr {Boolean} secondary - DEPRECATED
|
|
606
|
+
* @attr {Boolean} tertiary - DEPRECATED
|
|
607
|
+
* @prop {Boolean} ready - When false the component API should not be called.
|
|
608
|
+
* @event auroButton-ready - Notifies that the component has finished initializing.
|
|
609
|
+
* @slot - Default slot for the text of the button.
|
|
610
|
+
* @slot icon - Slot to provide auro-icon for the button.
|
|
611
|
+
* @csspart button - Apply CSS to HTML5 button.
|
|
612
|
+
* @csspart loader - Apply CSS to auro-loader.
|
|
613
|
+
* @csspart text - Apply CSS to text slot.
|
|
614
|
+
* @csspart icon - Apply CSS to icon slot.
|
|
617
615
|
*/
|
|
618
616
|
|
|
619
|
-
|
|
620
|
-
|
|
617
|
+
/* eslint-disable lit/no-invalid-html, lit/binding-positions */
|
|
618
|
+
|
|
619
|
+
class AuroButton extends r {
|
|
620
|
+
|
|
621
621
|
constructor() {
|
|
622
622
|
super();
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
this.autofocus = false;
|
|
624
|
+
this.disabled = false;
|
|
625
|
+
this.iconOnly = false;
|
|
626
|
+
this.loading = false;
|
|
627
|
+
this.onDark = false;
|
|
628
|
+
this.ready = false;
|
|
629
|
+
this.secondary = false;
|
|
630
|
+
this.tertiary = false;
|
|
631
|
+
this.rounded = false;
|
|
632
|
+
this.slim = false;
|
|
633
|
+
this.fluid = false;
|
|
625
634
|
|
|
626
635
|
/**
|
|
627
|
-
*
|
|
636
|
+
* Generate unique names for dependency components.
|
|
628
637
|
*/
|
|
629
|
-
|
|
638
|
+
const versioning = new AuroDependencyVersioning$1();
|
|
630
639
|
|
|
631
640
|
/**
|
|
632
641
|
* @private
|
|
633
642
|
*/
|
|
634
|
-
this.
|
|
643
|
+
this.loaderTag = versioning.generateTag('auro-loader', loaderVersion, AuroLoader);
|
|
644
|
+
}
|
|
635
645
|
|
|
636
|
-
|
|
646
|
+
static get styles() {
|
|
647
|
+
return [
|
|
648
|
+
tokensCss$3,
|
|
649
|
+
styleCssAuroButton,
|
|
650
|
+
colorCss$3
|
|
651
|
+
];
|
|
637
652
|
}
|
|
638
653
|
|
|
639
|
-
// This function is to define props used within the scope of this component
|
|
640
|
-
// Be sure to review https://lit.dev/docs/components/properties/
|
|
641
|
-
// to understand how to use reflected attributes with your property settings.
|
|
642
654
|
static get properties() {
|
|
643
655
|
return {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
alignRight: {
|
|
656
|
+
autofocus: {
|
|
647
657
|
type: Boolean,
|
|
648
|
-
reflect: true
|
|
658
|
+
reflect: true
|
|
649
659
|
},
|
|
650
|
-
|
|
660
|
+
disabled: {
|
|
651
661
|
type: Boolean,
|
|
652
|
-
reflect: true
|
|
662
|
+
reflect: true
|
|
653
663
|
},
|
|
654
|
-
|
|
664
|
+
secondary: {
|
|
655
665
|
type: Boolean,
|
|
656
666
|
reflect: true
|
|
657
667
|
},
|
|
658
|
-
|
|
668
|
+
tertiary: {
|
|
659
669
|
type: Boolean,
|
|
660
670
|
reflect: true
|
|
661
671
|
},
|
|
662
|
-
|
|
672
|
+
fluid: {
|
|
673
|
+
type: Boolean,
|
|
674
|
+
reflect: true
|
|
675
|
+
},
|
|
676
|
+
iconOnly: {
|
|
677
|
+
type: Boolean,
|
|
678
|
+
reflect: true
|
|
679
|
+
},
|
|
680
|
+
loading: {
|
|
681
|
+
type: Boolean,
|
|
682
|
+
reflect: true
|
|
683
|
+
},
|
|
684
|
+
onDark: {
|
|
685
|
+
type: Boolean,
|
|
686
|
+
reflect: true
|
|
687
|
+
},
|
|
688
|
+
rounded: {
|
|
689
|
+
type: Boolean,
|
|
690
|
+
reflect: true
|
|
691
|
+
},
|
|
692
|
+
slim: {
|
|
693
|
+
type: Boolean,
|
|
694
|
+
reflect: true
|
|
695
|
+
},
|
|
696
|
+
arialabel: {
|
|
663
697
|
type: String,
|
|
664
698
|
reflect: true
|
|
665
699
|
},
|
|
666
|
-
|
|
700
|
+
arialabelledby: {
|
|
667
701
|
type: String,
|
|
668
702
|
reflect: true
|
|
669
|
-
}
|
|
703
|
+
},
|
|
704
|
+
title: {
|
|
705
|
+
type: String,
|
|
706
|
+
reflect: true
|
|
707
|
+
},
|
|
708
|
+
type: {
|
|
709
|
+
type: String,
|
|
710
|
+
reflect: true
|
|
711
|
+
},
|
|
712
|
+
value: {
|
|
713
|
+
type: String,
|
|
714
|
+
reflect: true
|
|
715
|
+
},
|
|
716
|
+
variant: {
|
|
717
|
+
type: String,
|
|
718
|
+
reflect: true
|
|
719
|
+
},
|
|
720
|
+
ready: { type: Boolean },
|
|
670
721
|
};
|
|
671
722
|
}
|
|
672
723
|
|
|
673
|
-
static get styles() {
|
|
674
|
-
return [
|
|
675
|
-
colorCss$2,
|
|
676
|
-
styleCss$1,
|
|
677
|
-
tokensCss$2
|
|
678
|
-
];
|
|
679
|
-
}
|
|
680
|
-
|
|
681
724
|
/**
|
|
682
725
|
* This will register this element with the browser.
|
|
683
|
-
* @param {string} [name="auro-
|
|
726
|
+
* @param {string} [name="auro-button"] - The name of element that you want to register to.
|
|
684
727
|
*
|
|
685
728
|
* @example
|
|
686
|
-
*
|
|
729
|
+
* AuroButton.register("custom-button") // this will register this element to <custom-button/>
|
|
687
730
|
*
|
|
688
731
|
*/
|
|
689
|
-
static register(name = "auro-
|
|
690
|
-
AuroLibraryRuntimeUtils$
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
firstUpdated() {
|
|
694
|
-
// Add the tag name as an attribute if it is different than the component name
|
|
695
|
-
this.runtimeUtils.handleComponentTagRename(this, 'auro-accordion');
|
|
732
|
+
static register(name = "auro-button") {
|
|
733
|
+
AuroLibraryRuntimeUtils$2.prototype.registerComponent(name, AuroButton);
|
|
696
734
|
}
|
|
697
735
|
|
|
698
736
|
/**
|
|
699
|
-
* Internal
|
|
737
|
+
* Internal method to apply focus to the HTML5 button.
|
|
700
738
|
* @private
|
|
701
|
-
* @
|
|
702
|
-
* @returns {TemplateResult} - The html template for the icon.
|
|
739
|
+
* @returns {void}
|
|
703
740
|
*/
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
const svg = dom.body.firstChild;
|
|
707
|
-
|
|
708
|
-
svg.setAttribute('slot', 'svg');
|
|
709
|
-
|
|
710
|
-
return u`${svg}`;
|
|
741
|
+
focus() {
|
|
742
|
+
this.renderRoot.querySelector('button').focus();
|
|
711
743
|
}
|
|
712
744
|
|
|
713
745
|
/**
|
|
714
|
-
*
|
|
746
|
+
* Marks the component as ready and sends event.
|
|
747
|
+
* @private
|
|
748
|
+
* @returns {void}
|
|
715
749
|
*/
|
|
716
|
-
|
|
717
|
-
this.
|
|
750
|
+
notifyReady() {
|
|
751
|
+
this.ready = true;
|
|
718
752
|
|
|
719
|
-
this.dispatchEvent(new CustomEvent('
|
|
753
|
+
this.dispatchEvent(new CustomEvent('auroButton-ready', {
|
|
720
754
|
bubbles: true,
|
|
755
|
+
cancelable: false,
|
|
721
756
|
composed: true,
|
|
722
|
-
detail: {
|
|
723
|
-
expanded: this.expanded
|
|
724
|
-
}
|
|
725
757
|
}));
|
|
726
758
|
}
|
|
727
759
|
|
|
728
|
-
|
|
760
|
+
updated() {
|
|
761
|
+
// support the old `secondary` and `tertiary` attributes` that are deprecated
|
|
762
|
+
if (this.secondary) {
|
|
763
|
+
this.setAttribute('variant', 'secondary');
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
if (this.tertiary) {
|
|
767
|
+
this.setAttribute('variant', 'tertiary');
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
firstUpdated() {
|
|
772
|
+
this.notifyReady();
|
|
773
|
+
}
|
|
774
|
+
|
|
729
775
|
render() {
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
776
|
+
const classes = {
|
|
777
|
+
'util_insetLg--squish': true,
|
|
778
|
+
'auro-button': true,
|
|
779
|
+
'auro-button--rounded': this.rounded,
|
|
780
|
+
'auro-button--slim': this.slim,
|
|
781
|
+
'auro-button--iconOnly': this.iconOnly,
|
|
782
|
+
'auro-button--iconOnlySlim': this.iconOnly && this.slim,
|
|
783
|
+
'loading': this.loading
|
|
735
784
|
};
|
|
736
785
|
|
|
737
786
|
return u`
|
|
738
|
-
<
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
787
|
+
<button
|
|
788
|
+
part="button"
|
|
789
|
+
aria-label="${o(this.arialabel ? this.arialabel : undefined)}"
|
|
790
|
+
aria-labelledby="${o(this.arialabelledby ? this.arialabelledby : undefined)}"
|
|
791
|
+
?autofocus="${this.autofocus}"
|
|
792
|
+
class="${e(classes)}"
|
|
793
|
+
?disabled="${this.disabled || this.loading}"
|
|
794
|
+
?onDark="${this.onDark}"
|
|
795
|
+
title="${o(this.title ? this.title : undefined)}"
|
|
796
|
+
name="${o(this.name ? this.name : undefined)}"
|
|
797
|
+
type="${o(this.type ? this.type : undefined)}"
|
|
798
|
+
variant="${o(this.variant ? this.variant : undefined)}"
|
|
799
|
+
.value="${o(this.value ? this.value : undefined)}"
|
|
800
|
+
@click="${() => {}}"
|
|
801
|
+
>
|
|
802
|
+
${o(this.loading ? u`<${this.loaderTag} pulse part="loader"></${this.loaderTag}>` : undefined)}
|
|
803
|
+
|
|
804
|
+
<span class="contentWrapper">
|
|
805
|
+
<span class="textSlot" part="text">
|
|
806
|
+
${this.iconOnly ? undefined : u`<slot></slot>`}
|
|
807
|
+
</span>
|
|
808
|
+
|
|
809
|
+
<span part="icon">
|
|
810
|
+
<slot name="icon"></slot>
|
|
811
|
+
</span>
|
|
812
|
+
</span>
|
|
813
|
+
</button>
|
|
763
814
|
`;
|
|
764
815
|
}
|
|
765
816
|
}
|
|
766
817
|
|
|
767
|
-
// Copyright (c)
|
|
818
|
+
// Copyright (c) 2022 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
768
819
|
// See LICENSE in the project root for license information.
|
|
769
820
|
|
|
770
821
|
|
|
771
|
-
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
772
|
-
/**
|
|
773
|
-
* Auro-accordion provides users a way to have collapsible content on a page.
|
|
774
|
-
* Use auro-accordion-group if you want to have auto closing accordion components when others are selected.
|
|
775
|
-
*
|
|
776
|
-
* @attr {Boolean} emphasis - If set, emphasis styles will be applied to the auro-accordions.
|
|
777
|
-
* @attr {String} variant - Sets accordion variant option. Possible values are: `sm`, `lg`.
|
|
778
|
-
* @attr {Boolean} noToggleExpanded - If set, multiple accordions can be open at the same time.
|
|
779
|
-
*/
|
|
780
|
-
|
|
781
822
|
// build the component class
|
|
782
|
-
class
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
*/
|
|
789
|
-
this.runtimeUtils = new AuroLibraryRuntimeUtils$3();
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
// This function is to define props used within the scope of this component
|
|
793
|
-
// Be sure to review https://lit.dev/docs/components/properties/
|
|
794
|
-
// to understand how to use reflected attributes with your property settings.
|
|
795
|
-
static get properties() {
|
|
796
|
-
return {
|
|
797
|
-
// ...super.properties,
|
|
798
|
-
|
|
799
|
-
emphasis: {
|
|
800
|
-
type: Boolean,
|
|
801
|
-
reflect: true
|
|
802
|
-
},
|
|
803
|
-
variant: {
|
|
804
|
-
type: String,
|
|
805
|
-
reflect: true
|
|
806
|
-
}
|
|
807
|
-
};
|
|
823
|
+
class AuroAccordionButton extends AuroButton {
|
|
824
|
+
static get styles() {
|
|
825
|
+
return [
|
|
826
|
+
styleCssAuroButton,
|
|
827
|
+
styleButtonCss
|
|
828
|
+
];
|
|
808
829
|
}
|
|
809
830
|
|
|
810
831
|
/**
|
|
811
832
|
* This will register this element with the browser.
|
|
812
|
-
* @param {string} [name="auro-accordion-
|
|
833
|
+
* @param {string} [name="auro-accordion-button"] - The name of element that you want to register to.
|
|
813
834
|
*
|
|
814
835
|
* @example
|
|
815
|
-
*
|
|
836
|
+
* AuroAccordionButton.register("custom-accordion-button") // this will register this element to <custom-accordion-button/>
|
|
816
837
|
*
|
|
817
838
|
*/
|
|
818
|
-
static register(name = "auro-accordion-
|
|
819
|
-
AuroLibraryRuntimeUtils$3.prototype.registerComponent(name,
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
firstUpdated() {
|
|
823
|
-
// Add the tag name as an attribute if it is different than the component name
|
|
824
|
-
this.runtimeUtils.handleComponentTagRename(this, 'auro-accordion-group');
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
handleSlotContentChange() {
|
|
828
|
-
this.addEventListener('toggleExpanded', this.handleToggleExpanded);
|
|
829
|
-
|
|
830
|
-
this.handleItems();
|
|
831
|
-
|
|
832
|
-
this.items.forEach((item) => {
|
|
833
|
-
if (this.hasAttribute('emphasis')) {
|
|
834
|
-
item.setAttribute('chevron', 'right');
|
|
835
|
-
item.emphasis = true;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
if (this.hasAttribute('variant') && this.getAttribute('variant') === 'sm') {
|
|
839
|
-
item.setAttribute('variant', 'sm');
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
if (this.hasAttribute('variant') && this.getAttribute('variant') === 'lg') {
|
|
843
|
-
item.setAttribute('variant', 'lg');
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
item.grouped = true;
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* Internal function to toggle any expanded panels if it is not the one selected.
|
|
852
|
-
* @private
|
|
853
|
-
* @param {object} event - Standard event parameter.
|
|
854
|
-
*/
|
|
855
|
-
handleToggleExpanded(event) {
|
|
856
|
-
if (!this.hasAttribute('noToggleExpanded')) {
|
|
857
|
-
this.items.forEach((item) => {
|
|
858
|
-
if (item !== event.target && item.expanded) {
|
|
859
|
-
item.expanded = false;
|
|
860
|
-
}
|
|
861
|
-
});
|
|
862
|
-
|
|
863
|
-
this.scrollIntoView({
|
|
864
|
-
behavior: "smooth",
|
|
865
|
-
block: "nearest",
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* Internal function to add all accordions into an array.
|
|
872
|
-
* @private
|
|
873
|
-
*/
|
|
874
|
-
handleItems() {
|
|
875
|
-
const groupTagName = this.tagName.toLowerCase();
|
|
876
|
-
const accordionTagName = groupTagName.substring(0, groupTagName.indexOf('-group'));
|
|
877
|
-
|
|
878
|
-
this.items = Array.from(this.querySelectorAll(accordionTagName));
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
// function that renders the HTML and CSS into the scope of the component
|
|
882
|
-
render() {
|
|
883
|
-
return x`
|
|
884
|
-
<div>
|
|
885
|
-
<slot @slotchange="${this.handleSlotContentChange}"></slot>
|
|
886
|
-
</div>
|
|
887
|
-
`;
|
|
839
|
+
static register(name = "auro-accordion-button") {
|
|
840
|
+
AuroLibraryRuntimeUtils$3.prototype.registerComponent(name, AuroAccordionButton);
|
|
888
841
|
}
|
|
889
842
|
}
|
|
890
843
|
|
|
891
|
-
var styleButtonCss = i$5`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}:host{border:unset}:host .auro-button{all:unset;width:100%;padding:var(--ds-size-200, 1rem) 0;cursor:pointer;pointer-events:none}:host .auro-button:after{border-color:transparent}:host .contentWrapper{display:flex;flex-direction:row-reverse}:host .textSlot{display:flex;flex:1}:host(.sm) .auro-button{padding:var(--ds-size-100, 0.5rem) 0}:host(.lg) .auro-button{padding:calc(var(--ds-size-200, 1rem) + var(--ds-size-50, 0.25rem)) 0}:host([fluid]) .contentWrapper{width:100%}:host(.iconRight) .contentWrapper{display:flex;flex-direction:row}`;
|
|
892
|
-
|
|
893
|
-
var styleCssAuroButton = i$5`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_insetNone{padding:0}.util_insetXxxs{padding:.125rem}.util_insetXxxs--stretch{padding:.25rem .125rem}.util_insetXxxs--squish{padding:0 .125rem}.util_insetXxs{padding:.25rem}.util_insetXxs--stretch{padding:.375rem .25rem}.util_insetXxs--squish{padding:.125rem .25rem}.util_insetXs{padding:.5rem}.util_insetXs--stretch{padding:.75rem .5rem}.util_insetXs--squish{padding:.25rem .5rem}.util_insetSm{padding:.75rem}.util_insetSm--stretch{padding:1.125rem .75rem}.util_insetSm--squish{padding:.375rem .75rem}.util_insetMd{padding:1rem}.util_insetMd--stretch{padding:1.5rem 1rem}.util_insetMd--squish{padding:.5rem 1rem}.util_insetLg{padding:1.5rem}.util_insetLg--stretch{padding:2.25rem 1.5rem}.util_insetLg--squish{padding:.75rem 1.5rem}.util_insetXl{padding:2rem}.util_insetXl--stretch{padding:3rem 2rem}.util_insetXl--squish{padding:1rem 2rem}.util_insetXxl{padding:3rem}.util_insetXxl--stretch{padding:4.5rem 3rem}.util_insetXxl--squish{padding:1.5rem 3rem}.util_insetXxxl{padding:4rem}.util_insetXxxl--stretch{padding:6rem 4rem}.util_insetXxxl--squish{padding:2rem 4rem}:host([fluid]) .auro-button,:host([fluid=true]) .auro-button{min-width:auto;width:100%}:host([variant=flat]){display:inline-block;height:var(--ds-size-300, 1.5rem);width:var(--ds-size-300, 1.5rem)}:host([variant=flat]) .auro-button{height:100%;width:100%}::slotted(svg){vertical-align:middle}slot{pointer-events:none}.auro-button{position:relative;padding:0 var(--ds-size-300, 1.5rem);cursor:pointer;border-width:1px;border-style:solid;border-radius:var(--ds-border-radius, 0.375rem);font-family:var(--ds-font-family-default, "AS Circular", Helvetica Neue, Arial, sans-serif);font-size:var(--ds-text-body-size-default, 1rem);font-weight:var(--ds-text-body-default-weight, 500);overflow:hidden;text-overflow:ellipsis;user-select:none;white-space:nowrap;min-height:var(--ds-size-600, 3rem);max-height:var(--ds-size-600, 3rem);display:inline-flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--ds-size-100, 0.5rem);margin:0;-webkit-touch-callout:none;-webkit-user-select:none}.auro-button:active{transform:scale(0.95)}.auro-button:focus-visible:not([variant=secondary]):not([variant=tertiary]):not([variant=flat]):after{display:block;content:"";height:calc(100% - 2px);width:calc(100% - 2px);position:absolute;top:1px;left:1px;border-radius:4px;border-style:solid;border-width:2px}.auro-button:focus-visible[variant=secondary]:after,.auro-button:focus-visible[variant=tertiary]:after{display:block;content:"";height:100%;width:100%;position:absolute;top:0;left:0;border-radius:var(--ds-border-radius, 0.375rem);border-style:solid;border-width:2px}.auro-button.loading{cursor:not-allowed}.auro-button.loading *:not([auro-loader]){visibility:hidden}@media screen and (min-width: 576px){.auro-button{min-width:8.75rem;width:auto}}.auro-button:disabled{cursor:not-allowed;transform:unset}.auro-button[variant=secondary]:disabled{cursor:not-allowed;transform:unset}.auro-button[variant=tertiary]:disabled{cursor:not-allowed;transform:unset}.auro-button[variant=flat]{height:unset;width:unset;min-height:unset;max-height:unset;min-width:unset;max-width:unset;border:0;border-radius:unset;gap:unset;padding:unset}.auro-button[onDark]:disabled{cursor:not-allowed;transform:unset}.auro-button[onDark][variant=secondary]:disabled{cursor:not-allowed;transform:unset}@media(hover: hover){.auro-button[onDark][variant=tertiary]:active,.auro-button[onDark][variant=tertiary]:hover{box-shadow:none}}.auro-button[onDark][variant=tertiary]:active{box-shadow:none}.auro-button[onDark][variant=tertiary]:disabled{cursor:not-allowed;transform:unset}.auro-button--slim{padding:var(--ds-size-100, 0.5rem) var(--ds-size-200, 1rem);font-size:var(--ds-text-body-size-sm, 0.875rem);min-width:unset;min-height:calc(var(--ds-size-500, 2.5rem) - var(--ds-size-50, 0.25rem));max-height:calc(var(--ds-size-500, 2.5rem) - var(--ds-size-50, 0.25rem))}.auro-button--iconOnly{padding:0 var(--ds-size-100, 0.5rem);border-radius:100px;min-width:unset;height:var(--ds-size-600, 3rem);width:var(--ds-size-500, 2.5rem)}.auro-button--iconOnly ::slotted(auro-icon){width:var(--ds-size-300, 1.5rem);height:var(--ds-size-300, 1.5rem)}.auro-button--iconOnlySlim{padding:0 var(--ds-size-50, 0.25rem);height:calc(var(--ds-size-400, 2rem) + var(--ds-size-50, 0.25rem));width:calc(var(--ds-size-300, 1.5rem) + var(--ds-size-50, 0.25rem))}.auro-button--iconOnlySlim ::slotted(auro-icon){width:calc(var(--ds-size-200, 1rem) + var(--ds-size-50, 0.25rem));height:calc(var(--ds-size-200, 1rem) + var(--ds-size-50, 0.25rem))}.auro-button--rounded{border-radius:100px;box-shadow:var(--ds-elevation-300, 0px 0px 15px rgba(0, 0, 0, 0.2));height:var(--ds-size-500, 2.5rem);min-width:unset;transition:all 300ms ease-out}.auro-button--rounded ::slotted(auro-icon){width:var(--ds-size-300, 1.5rem);height:var(--ds-size-300, 1.5rem)}:host([rounded]) .textSlot{transition:opacity 300ms ease-in;opacity:1}:host([rounded][iconOnly]) .textSlot{opacity:0}:host([rounded][iconOnly]) .textWrapper{display:none}:host([rounded][iconOnly]) .auro-button{min-width:unset;padding:unset;width:var(--ds-size-600, 3rem)}[auro-loader]{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none}`;
|
|
894
|
-
|
|
895
844
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
896
845
|
// See LICENSE in the project root for license information.
|
|
897
846
|
|
|
@@ -932,84 +881,161 @@ class AuroDependencyVersioning {
|
|
|
932
881
|
}
|
|
933
882
|
}
|
|
934
883
|
|
|
935
|
-
// Copyright (c) Alaska
|
|
884
|
+
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
936
885
|
// See LICENSE in the project root for license information.
|
|
937
886
|
|
|
938
|
-
// ---------------------------------------------------------------------
|
|
939
|
-
|
|
940
|
-
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
941
|
-
|
|
942
|
-
let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
|
|
943
887
|
|
|
944
|
-
|
|
888
|
+
/**
|
|
889
|
+
* @attr {Boolean} hidden - If present, the component will be hidden both visually and from screen readers
|
|
890
|
+
* @attr {Boolean} hiddenVisually - If present, the component will be hidden visually, but still read by screen readers
|
|
891
|
+
* @attr {Boolean} hiddenAudible - If present, the component will be hidden from screen readers, but seen visually
|
|
892
|
+
*/
|
|
945
893
|
|
|
946
|
-
|
|
947
|
-
* This will register a new custom element with the browser.
|
|
948
|
-
* @param {String} name - The name of the custom element.
|
|
949
|
-
* @param {Object} componentClass - The class to register as a custom element.
|
|
950
|
-
* @returns {void}
|
|
951
|
-
*/
|
|
952
|
-
registerComponent(name, componentClass) {
|
|
953
|
-
if (!customElements.get(name)) {
|
|
954
|
-
customElements.define(name, class extends componentClass {});
|
|
955
|
-
}
|
|
956
|
-
}
|
|
894
|
+
class AuroElement extends r {
|
|
957
895
|
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
: found
|
|
969
|
-
? found // found a selector INside this element
|
|
970
|
-
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
971
|
-
) {
|
|
972
|
-
return __Closest(base);
|
|
896
|
+
// function to define props used within the scope of this component
|
|
897
|
+
static get properties() {
|
|
898
|
+
return {
|
|
899
|
+
hidden: { type: Boolean,
|
|
900
|
+
reflect: true },
|
|
901
|
+
hiddenVisually: { type: Boolean,
|
|
902
|
+
reflect: true },
|
|
903
|
+
hiddenAudible: { type: Boolean,
|
|
904
|
+
reflect: true },
|
|
905
|
+
};
|
|
973
906
|
}
|
|
974
|
-
/* eslint-enable jsdoc/require-param */
|
|
975
907
|
|
|
976
908
|
/**
|
|
977
|
-
*
|
|
978
|
-
* @param {Object} elem - The element to check.
|
|
979
|
-
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
980
|
-
* @returns {void}
|
|
909
|
+
* @private Function that determines state of aria-hidden
|
|
981
910
|
*/
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
if (elemTag !== tag) {
|
|
987
|
-
elem.setAttribute(tag, true);
|
|
911
|
+
hideAudible(value) {
|
|
912
|
+
if (value) {
|
|
913
|
+
return 'true'
|
|
988
914
|
}
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
/**
|
|
992
|
-
* Validates if an element is a specific Auro component.
|
|
993
|
-
* @param {Object} elem - The element to validate.
|
|
994
|
-
* @param {String} tagName - The name of the Auro component to check against.
|
|
995
|
-
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
996
|
-
*/
|
|
997
|
-
elementMatch(elem, tagName) {
|
|
998
|
-
const tag = tagName.toLowerCase();
|
|
999
|
-
const elemTag = elem.tagName.toLowerCase();
|
|
1000
915
|
|
|
1001
|
-
return
|
|
916
|
+
return 'false'
|
|
1002
917
|
}
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
var colorCss$1 = i$5`[auro-loader]{color:var(--ds-auro-button-loader-color)}.auro-button{-webkit-tap-highlight-color:var(--ds-auro-button-tap-color);color:var(--ds-auro-button-text-color);background-color:var(--ds-auro-button-container-color);background-image:linear-gradient(var(--ds-auro-button-container-image), var(--ds-auro-button-container-image));border-color:var(--ds-auro-button-border-color)}.auro-button:not([variant=secondary]):not([variant=tertiary]):focus-visible:after{border-color:var(--ds-auro-button-border-inset-color)}.auro-button:not([ondark]):active{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-active-default, #225296);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-active-default, #225296);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-active-default, #225296)}.auro-button:not([ondark])[disabled]{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-disabled-default, #a0c9f1);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-disabled-default, #a0c9f1);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-disabled-default, #a0c9f1)}@media(hover: hover){.auro-button:not([ondark]):active:not(:disabled),.auro-button:not([ondark]):hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-primary-hover-default, #193d73);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-hover-default, #193d73);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-hover-default, #193d73)}}.auro-button:not([ondark])[variant=secondary]{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-default-default, #ffffff);--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-default-default, #ffffff);--ds-auro-button-border-color: var(--ds-color-border-ui-default-default, #2c67b5);--ds-auro-button-text-color: var(--ds-color-text-ui-default-default, #2c67b5)}@media(hover: hover){.auro-button:not([ondark])[variant=secondary]:active:not(:disabled),.auro-button:not([ondark])[variant=secondary]:hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-hover-default, rgba(0, 0, 0, 0.03));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-hover-default, rgba(0, 0, 0, 0.03));--ds-auro-button-border-color: var(--ds-color-border-ui-hover-default, #193d73);--ds-auro-button-text-color: var(--ds-color-text-ui-hover-default, #193d73)}}.auro-button:not([ondark])[variant=secondary]:focus-visible{--ds-auro-button-border-inset-color: var(--ds-color-border-ui-focus-default, #2c67b5)}.auro-button:not([ondark])[variant=secondary]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-active-default, #f0f7fd);--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-active-default, #f0f7fd);--ds-auro-button-border-color: var(--ds-color-border-ui-active-default, #225296);--ds-auro-button-text-color: var(--ds-color-text-ui-active-default, #225296)}.auro-button:not([ondark])[variant=secondary]:disabled{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-disabled-default, #f7f7f7);--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-disabled-default, #f7f7f7);--ds-auro-button-border-color: var(--ds-color-border-ui-disabled-default, #adadad);--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-default, #adadad)}.auro-button:not([ondark])[variant=tertiary]{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-default-default, rgba(0, 0, 0, 0.03));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-default-default, rgba(0, 0, 0, 0.03));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-default-default, #2c67b5)}@media(hover: hover){.auro-button:not([ondark])[variant=tertiary]:active:not(:disabled),.auro-button:not([ondark])[variant=tertiary]:hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-hover-default, rgba(0, 0, 0, 0.12));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-hover-default, rgba(0, 0, 0, 0.12));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-hover-default, #193d73)}}.auro-button:not([ondark])[variant=tertiary]:focus-visible{--ds-auro-button-border-color: var(--ds-color-border-ui-default-default, #2c67b5);--ds-auro-button-border-inset-color: var(--ds-color-border-ui-default-default, #2c67b5)}.auro-button:not([ondark])[variant=tertiary]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-active-default, rgba(0, 0, 0, 0.06));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-active-default, rgba(0, 0, 0, 0.06));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-active-default, #225296)}.auro-button:not([ondark])[variant=tertiary]:disabled{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-disabled-default, rgba(0, 0, 0, 0.03));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-disabled-default, rgba(0, 0, 0, 0.03));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-default, #adadad)}.auro-button:not([ondark])[variant=flat]{color:var(--ds-color-icon-ui-secondary-default-default);background-color:transparent;background-image:none;border-color:transparent}@media(hover: hover){.auro-button:not([ondark])[variant=flat]:active:not(:disabled),.auro-button:not([ondark])[variant=flat]:hover:not(:disabled){color:var(--ds-color-icon-ui-secondary-hover-default);background-color:transparent;background-image:none;border-color:transparent}}.auro-button:not([ondark])[variant=flat]:disabled{color:var(--ds-color-icon-ui-secondary-disabled-default);background-color:transparent;background-image:none;border-color:transparent}.auro-button[ondark]{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-default-inverse, #56bbde);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-default-inverse, #56bbde);--ds-auro-button-text-color: var(--ds-color-text-primary-default, #2a2a2a);--ds-auro-button-loader-color: var(--ds-color-text-primary-inverse, #ffffff);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-default-inverse, #56bbde)}@media(hover: hover){.auro-button[ondark]:active:not(:disabled),.auro-button[ondark]:hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-primary-hover-inverse, #a8e9f7);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-hover-inverse, #a8e9f7);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-hover-inverse, #a8e9f7)}}.auro-button[ondark]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-active-inverse, #6ad5ef);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-active-inverse, #6ad5ef);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-active-inverse, #6ad5ef)}.auro-button[ondark][disabled]{--ds-auro-button-container-color: var(--ds-color-container-ui-primary-disabled-inverse, #275b72);--ds-auro-button-container-image: var(--ds-color-container-ui-primary-disabled-inverse, #275b72);--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-inverse, #7e7e7e);--ds-auro-button-border-color: var(--ds-color-container-ui-primary-disabled-inverse, #275b72)}.auro-button[ondark][variant=secondary]{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-default-inverse, rgba(255, 255, 255, 0.03));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-default-inverse, rgba(255, 255, 255, 0.03));--ds-auro-button-border-color: var(--ds-color-border-ui-default-inverse, #56bbde);--ds-auro-button-text-color: var(--ds-color-text-ui-default-inverse, #56bbde)}@media(hover: hover){.auro-button[ondark][variant=secondary]:hover{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-hover-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-hover-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-border-color: var(--ds-color-border-ui-hover-inverse, #a8e9f7);--ds-auro-button-text-color: var(--ds-color-text-ui-hover-inverse, #a8e9f7)}}.auro-button[ondark][variant=secondary]:focus-visible{--ds-auro-button-border-inset-color: var(--ds-color-border-ui-focus-inverse, #56bbde)}.auro-button[ondark][variant=secondary]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-active-inverse, rgba(255, 255, 255, 0.06));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-active-inverse, rgba(255, 255, 255, 0.06));--ds-auro-button-border-color: var(--ds-color-border-ui-active-inverse, #6ad5ef);--ds-auro-button-text-color: var(--ds-color-text-ui-active-inverse, #6ad5ef)}.auro-button[ondark][variant=secondary]:disabled{--ds-auro-button-container-color: var(--ds-color-container-ui-secondary-disabled-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-container-image: var(--ds-color-container-ui-secondary-disabled-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-border-color: var(--ds-color-border-ui-disabled-inverse, #7e7e7e);--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-inverse, #7e7e7e)}.auro-button[ondark][variant=tertiary]{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-default-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-default-inverse, rgba(255, 255, 255, 0.12));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-default-inverse, #56bbde)}@media(hover: hover){.auro-button[ondark][variant=tertiary]:active:not(:disabled),.auro-button[ondark][variant=tertiary]:hover:not(:disabled){--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-hover-inverse, rgba(255, 255, 255, 0.25));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-hover-inverse, rgba(255, 255, 255, 0.25));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-hover-inverse, #a8e9f7)}}.auro-button[ondark][variant=tertiary]:focus-visible{--ds-auro-button-border-color: var(--ds-color-border-ui-default-inverse, #56bbde);--ds-auro-button-border-inset-color: var(--ds-color-border-ui-default-inverse, #56bbde)}.auro-button[ondark][variant=tertiary]:active{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-active-inverse, rgba(255, 255, 255, 0.06));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-active-inverse, rgba(255, 255, 255, 0.06));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-active-inverse, #6ad5ef)}.auro-button[ondark][variant=tertiary]:disabled{--ds-auro-button-container-color: var(--ds-color-container-ui-tertiary-disabled-inverse, rgba(255, 255, 255, 0.25));--ds-auro-button-container-image: var(--ds-color-container-ui-tertiary-disabled-inverse, rgba(255, 255, 255, 0.25));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-color-text-ui-disabled-inverse, #7e7e7e)}.auro-button[ondark][variant=flat]{color:var(--ds-color-icon-ui-secondary-default-inverse);background-color:transparent;background-image:none;border-color:transparent}@media(hover: hover){.auro-button[ondark][variant=flat]:active:not(:disabled),.auro-button[ondark][variant=flat]:hover:not(:disabled){color:var(--ds-color-icon-ui-secondary-hover-inverse);background-color:transparent;background-image:none;border-color:transparent}}.auro-button[ondark][variant=flat]:disabled{color:var(--ds-color-icon-ui-disabled-default);background-color:transparent;background-image:none;border-color:transparent}`;
|
|
918
|
+
}
|
|
1006
919
|
|
|
1007
|
-
var
|
|
920
|
+
var error = {"role":"img","color":"currentColor","title":"","desc":"Error alert indicator.","width":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","height":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","xmlns":"http://www.w3.org/2000/svg","xmlns_xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 24 24","path":"/icons","style":"ico_squareLarge","type":"icon","name":"error","category":"alert","deprecated":true,"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"error__desc\" class=\"ico_squareLarge\" data-deprecated=\"true\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"error__desc\">Error alert indicator.</desc><path d=\"m13.047 5.599 6.786 11.586A1.207 1.207 0 0 1 18.786 19H5.214a1.207 1.207 0 0 1-1.047-1.815l6.786-11.586a1.214 1.214 0 0 1 2.094 0m-1.165.87a.23.23 0 0 0-.085.085L5.419 17.442a.232.232 0 0 0 .203.35h12.756a.234.234 0 0 0 .203-.35L12.203 6.554a.236.236 0 0 0-.321-.084M12 15.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m-.024-6.22c.325 0 .589.261.589.583v4.434a.586.586 0 0 1-.589.583.586.586 0 0 1-.588-.583V9.863c0-.322.264-.583.588-.583\"/></svg>"};
|
|
1008
921
|
|
|
1009
|
-
|
|
1010
|
-
// See LICENSE in the project root for license information.
|
|
922
|
+
/* eslint-disable no-underscore-dangle, jsdoc/no-undefined-types, jsdoc/require-param-description */
|
|
1011
923
|
|
|
1012
|
-
|
|
924
|
+
const _fetchMap = new Map();
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* A callback to parse Response body.
|
|
928
|
+
*
|
|
929
|
+
* @callback ResponseParser
|
|
930
|
+
* @param {Fetch.Response} response
|
|
931
|
+
* @returns {Promise}
|
|
932
|
+
*/
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* A minimal in-memory map to de-duplicate Fetch API media requests.
|
|
936
|
+
*
|
|
937
|
+
* @param {String} uri
|
|
938
|
+
* @param {Object} [options={}]
|
|
939
|
+
* @param {ResponseParser} [options.responseParser=(response) => response.text()]
|
|
940
|
+
* @returns {Promise}
|
|
941
|
+
*/
|
|
942
|
+
const cacheFetch = (uri, options = {}) => {
|
|
943
|
+
const responseParser = options.responseParser || ((response) => response.text());
|
|
944
|
+
if (!_fetchMap.has(uri)) {
|
|
945
|
+
_fetchMap.set(uri, fetch(uri).then(responseParser));
|
|
946
|
+
}
|
|
947
|
+
return _fetchMap.get(uri);
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
var styleCss$1 = i$5`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}.ico_squareLarge{fill:currentColor;height:var(--auro-size-lg, var(--ds-size-300, 1.5rem))}.ico_squareSmall{fill:currentColor;height:.6rem}.ico_squareMed{fill:currentColor;height:var(--auro-size-md, var(--ds-size-200, 1rem))}.ico_squareSml{fill:currentColor;height:var(--auro-size-sm, var(--ds-size-150, 0.75rem))}:host{color:currentColor;vertical-align:middle;line-height:1;display:inline-block}:host .logo{color:var(--ds-color-brand-midnight-400, #01426a)}svg{min-width:var(--ds-auro-icon-size, 1.5rem) !important;width:var(--ds-auro-icon-size, 1.5rem) !important;height:var(--ds-auro-icon-size, 1.5rem) !important}.label{display:flex;align-items:flex-start}.label svg{margin:0 var(--ds-size-50, 0.25rem)}.labelContainer{line-height:1.8}`;
|
|
951
|
+
|
|
952
|
+
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
953
|
+
// See LICENSE in the project root for license information.
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
957
|
+
/**
|
|
958
|
+
* @attr {Boolean} onDark - Set value for on-dark version of auro-icon
|
|
959
|
+
* @slot - Hidden from visibility, used for a11y if icon description is needed
|
|
960
|
+
*/
|
|
961
|
+
|
|
962
|
+
// build the component class
|
|
963
|
+
class BaseIcon extends AuroElement {
|
|
964
|
+
constructor() {
|
|
965
|
+
super();
|
|
966
|
+
this.onDark = false;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
// function to define props used within the scope of this component
|
|
970
|
+
static get properties() {
|
|
971
|
+
return {
|
|
972
|
+
...super.properties,
|
|
973
|
+
onDark: {
|
|
974
|
+
type: Boolean,
|
|
975
|
+
reflect: true
|
|
976
|
+
},
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* @private
|
|
980
|
+
*/
|
|
981
|
+
svg: {
|
|
982
|
+
attribute: false,
|
|
983
|
+
reflect: true
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
static get styles() {
|
|
989
|
+
return i$5`
|
|
990
|
+
${styleCss$1}
|
|
991
|
+
`;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* Async function to fetch requested icon from npm CDN.
|
|
996
|
+
* @private
|
|
997
|
+
* @param {string} category - Icon category.
|
|
998
|
+
* @param {string} name - Icon name.
|
|
999
|
+
* @returns {SVGElement} DOM - Ready HTML to be appended.
|
|
1000
|
+
*/
|
|
1001
|
+
async fetchIcon(category, name) {
|
|
1002
|
+
let iconHTML = '';
|
|
1003
|
+
|
|
1004
|
+
if (category === 'logos') {
|
|
1005
|
+
iconHTML = await cacheFetch(`${this.uri}/${category}/${name}.svg`);
|
|
1006
|
+
} else {
|
|
1007
|
+
iconHTML = await cacheFetch(`${this.uri}/icons/${category}/${name}.svg`);
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
const dom = new DOMParser().parseFromString(iconHTML, 'text/html');
|
|
1011
|
+
|
|
1012
|
+
return dom.body.querySelector('svg');
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// lifecycle function
|
|
1016
|
+
async firstUpdated() {
|
|
1017
|
+
if (!this.customSvg) {
|
|
1018
|
+
const svg = await this.fetchIcon(this.category, this.name);
|
|
1019
|
+
|
|
1020
|
+
if (svg) {
|
|
1021
|
+
this.svg = svg;
|
|
1022
|
+
} else if (!svg) {
|
|
1023
|
+
const penDOM = new DOMParser().parseFromString(error.svg, 'text/html');
|
|
1024
|
+
|
|
1025
|
+
this.svg = penDOM.body.firstChild;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
var tokensCss$1 = i$5`:host{--ds-auro-icon-color: var(--ds-color-icon-primary-default, $ds-color-icon-primary-default);--ds-auro-icon-size: var(--ds-size-300, $ds-size-300)}`;
|
|
1032
|
+
|
|
1033
|
+
var colorCss$1 = i$5`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[accent]){--ds-auro-icon-color: var(--ds-color-icon-accent-default, #a2c270)}:host(:not([onDark])[disabled]){--ds-auro-icon-color: var(--ds-color-icon-ui-primary-disabled-default, #adadad)}:host(:not([onDark])[emphasis]){--ds-auro-icon-color: var(--ds-color-icon-emphasis-default, #2a2a2a)}:host(:not([onDark])[error]){--ds-auro-icon-color: var(--ds-color-icon-error-default, #cc1816)}:host(:not([onDark])[info]){--ds-auro-icon-color: var(--ds-color-icon-info-default, #326aa5)}:host(:not([onDark])[secondary]){--ds-auro-icon-color: var(--ds-color-icon-secondary-default, #7e8894)}:host(:not([onDark])[subtle]){--ds-auro-icon-color: var(--ds-color-icon-subtle-default, #a0c9f1)}:host(:not([onDark])[success]){--ds-auro-icon-color: var(--ds-color-icon-success-default, #40a080)}:host(:not([onDark])[tertiary]){--ds-auro-icon-color: var(--ds-color-icon-tertiary-default, #afb9c6)}:host(:not([onDark])[warning]){--ds-auro-icon-color: var(--ds-color-icon-warning-default, #c49432)}:host([onDark]){--ds-auro-icon-color: var(--ds-color-icon-primary-inverse, #f7f7f7)}:host([onDark][accent]){--ds-auro-icon-color: var(--ds-color-icon-accent-inverse, #badd81)}:host([onDark][disabled]){--ds-auro-icon-color: var(--ds-color-icon-ui-primary-disabled-inverse, #7e7e7e)}:host([onDark][emphasis]){--ds-auro-icon-color: var(--ds-color-icon-emphasis-inverse, #ffffff)}:host([onDark][error]){--ds-auro-icon-color: var(--ds-color-icon-error-inverse, #f9aca6)}:host([onDark][info]){--ds-auro-icon-color: var(--ds-color-icon-info-inverse, #89b2d4)}:host([onDark][secondary]){--ds-auro-icon-color: var(--ds-color-icon-secondary-inverse, #ccd2db)}:host([onDark][subtle]){--ds-auro-icon-color: var(--ds-color-icon-subtle-inverse, #326aa5)}:host([onDark][success]){--ds-auro-icon-color: var(--ds-color-icon-success-inverse, #8eceb9)}:host([onDark][tertiary]){--ds-auro-icon-color: var(--ds-color-icon-tertiary-inverse, #939fad)}:host([onDark][warning]){--ds-auro-icon-color: var(--ds-color-icon-warning-inverse, #f2c153)}`;
|
|
1034
|
+
|
|
1035
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1036
|
+
// See LICENSE in the project root for license information.
|
|
1037
|
+
|
|
1038
|
+
// ---------------------------------------------------------------------
|
|
1013
1039
|
|
|
1014
1040
|
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
1015
1041
|
|
|
@@ -1076,81 +1102,139 @@ class AuroLibraryRuntimeUtils {
|
|
|
1076
1102
|
}
|
|
1077
1103
|
}
|
|
1078
1104
|
|
|
1079
|
-
var styleCss = i$5`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}:host,:host>span{position:relative}:host{width:2rem;height:2rem;display:inline-block;font-size:0}:host>span{position:absolute;display:inline-block;float:none;top:0;left:0;width:2rem;height:2rem;border-radius:100%;border-style:solid;border-width:0}:host([xs]),:host([xs])>span{width:1.2rem;height:1.2rem}:host([sm]),:host([sm])>span{width:3rem;height:3rem}:host([md]),:host([md])>span{width:5rem;height:5rem}:host([lg]),:host([lg])>span{width:8rem;height:8rem}:host{--margin: 0.375rem;--margin-xs: 0.2rem;--margin-sm: 0.5rem;--margin-md: 0.75rem;--margin-lg: 1rem}:host([pulse]),:host([pulse])>span{position:relative}:host([pulse]){width:calc(3rem + var(--margin)*6);height:1.5rem}:host([pulse])>span{width:1rem;height:1rem;margin:var(--margin);animation:pulse 1.5s ease infinite}:host([pulse][xs]){width:calc(2.55rem + var(--margin-xs)*6);height:1.55rem}:host([pulse][xs])>span{margin:var(--margin-xs);width:.65rem;height:.65rem}:host([pulse][sm]){width:calc(6rem + var(--margin-sm)*6);height:2.5rem}:host([pulse][sm])>span{margin:var(--margin-sm);width:2rem;height:2rem}:host([pulse][md]){width:calc(9rem + var(--margin-md)*6);height:3.5rem}:host([pulse][md])>span{margin:var(--margin-md);width:3rem;height:3rem}:host([pulse][lg]){width:calc(15rem + var(--margin-lg)*6);height:5.5rem}:host([pulse][lg])>span{margin:var(--margin-lg);width:5rem;height:5rem}:host([pulse])>span:nth-child(1){animation-delay:-400ms}:host([pulse])>span:nth-child(2){animation-delay:-200ms}:host([pulse])>span:nth-child(3){animation-delay:0ms}@keyframes pulse{0%,100%{opacity:.1;transform:scale(0.9)}50%{opacity:1;transform:scale(1.1)}}:host([orbit]),:host([orbit])>span{opacity:1}:host([orbit])>span{border-width:5px}:host([orbit])>span:nth-child(2){animation:orbit 2s linear infinite}:host([orbit][sm])>span{border-width:8px}:host([orbit][md])>span{border-width:13px}:host([orbit][lg])>span{border-width:21px}@keyframes orbit{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}:host([ringworm])>svg{animation:rotate 2s linear infinite;height:100%;width:100%;stroke:currentcolor;stroke-width:8}:host([ringworm]) .path{stroke-dashoffset:0;animation:ringworm 1.5s ease-in-out infinite;stroke-linecap:round}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes ringworm{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}100%{stroke-dasharray:89,200;stroke-dashoffset:-124px}}:host([laser]){position:static;width:100%;display:block;height:0;overflow:hidden;font-size:unset}:host([laser])>span{position:fixed;width:100%;height:.25rem;border-radius:0;z-index:100}:host([laser])>span:nth-child(1){border-color:currentcolor;opacity:.25}:host([laser])>span:nth-child(2){border-color:currentcolor;animation:laser 2s linear infinite;opacity:1;width:50%}:host([laser][sm])>span:nth-child(2){width:20%}:host([laser][md])>span:nth-child(2){width:30%}:host([laser][lg])>span:nth-child(2){width:50%;animation-duration:1.5s}:host([laser][xl])>span:nth-child(2){width:80%;animation-duration:1.5s}@keyframes laser{0%{left:-100%}100%{left:110%}}:host>.no-animation{display:none}@media(prefers-reduced-motion: reduce){:host{display:flex;align-items:center;justify-content:center;font-size:1rem}:host>span{opacity:1}:host>.loader{display:none}:host>.no-animation{display:block}}`;
|
|
1080
|
-
|
|
1081
|
-
var colorCss = i$5`:host{color:var(--ds-auro-loader-color)}:host>span{background-color:var(--ds-auro-loader-background-color);border-color:var(--ds-auro-loader-border-color)}:host([onlight]){--ds-auro-loader-color: var(--ds-color-utility-navy-default, #265688)}:host([ondark]){--ds-auro-loader-color: var(--ds-color-utility-cyan-inverse, #a8e9f7)}:host([white]){--ds-auro-loader-color: var(--ds-color-utility-neutral-inverse, #ccd2db)}:host([orbit])>span{--ds-auro-loader-background-color: transparent}:host([orbit])>span:nth-child(1){--ds-auro-loader-border-color: currentcolor;opacity:.25}:host([orbit])>span:nth-child(2){--ds-auro-loader-border-color: currentcolor;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent}`;
|
|
1082
|
-
|
|
1083
|
-
var tokensCss = i$5`:host{--ds-auro-loader-background-color: currentcolor;--ds-auro-loader-border-color: currentcolor;--ds-auro-loader-color: currentcolor}`;
|
|
1084
|
-
|
|
1085
1105
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1086
1106
|
// See LICENSE in the project root for license information.
|
|
1087
1107
|
|
|
1088
1108
|
|
|
1089
1109
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
1090
1110
|
/**
|
|
1091
|
-
*
|
|
1111
|
+
* auro-icon provides users a way to use the Auro Icons by simply passing in the category and name.
|
|
1092
1112
|
*
|
|
1093
|
-
* @attr {
|
|
1094
|
-
* @attr {
|
|
1095
|
-
* @attr {Boolean}
|
|
1096
|
-
* @attr {Boolean}
|
|
1097
|
-
* @attr {Boolean}
|
|
1098
|
-
* @attr {Boolean}
|
|
1099
|
-
* @attr {Boolean}
|
|
1100
|
-
* @attr {Boolean}
|
|
1101
|
-
* @attr {Boolean}
|
|
1102
|
-
* @attr {Boolean}
|
|
1103
|
-
* @attr {Boolean}
|
|
1104
|
-
* @
|
|
1113
|
+
* @attr {String} category - The category of the icon you are looking for. See https://auro.alaskaair.com/icons/usage.
|
|
1114
|
+
* @attr {String} name - The name of the icon you are looking for without the file extension. See https://auro.alaskaair.com/icons/usage
|
|
1115
|
+
* @attr {Boolean} customColor - Removes primary selector.
|
|
1116
|
+
* @attr {Boolean} customSvg - When true, auro-icon will render a custom SVG inside the default slot.
|
|
1117
|
+
* @attr {Boolean} label - Exposes content in slot as icon label.
|
|
1118
|
+
* @attr {Boolean} primary - DEPRECATED: Sets the icon to use the baseline primary icon style.
|
|
1119
|
+
* @attr {Boolean} accent - Sets the icon to use the accent style.
|
|
1120
|
+
* @attr {Boolean} emphasis - Sets the icon to use the emphasis style.
|
|
1121
|
+
* @attr {Boolean} disabled - Sets the icon to use the disabled style.
|
|
1122
|
+
* @attr {Boolean} error - Sets the icon to use the error style.
|
|
1123
|
+
* @attr {Boolean} info - Sets the icon to use the info style.
|
|
1124
|
+
* @attr {Boolean} secondary - Sets the icon to use the secondary style.
|
|
1125
|
+
* @attr {Boolean} tertiary - Sets the icon to use the tertiary style.
|
|
1126
|
+
* @attr {Boolean} subtle - Sets the icon to use the subtle style.
|
|
1127
|
+
* @attr {Boolean} success - Sets the icon to use the success style.
|
|
1128
|
+
* @attr {Boolean} warning - Sets the icon to use the warning style.
|
|
1129
|
+
* @attr {String} ariaHidden - Set aria-hidden value. Default is `true`. Option is `false`.
|
|
1130
|
+
* @attr {String} uri - Set the uri for CDN used when fetching icons
|
|
1131
|
+
* @slot - Hidden from visibility, used for a11y if icon description is needed.
|
|
1132
|
+
* @slot svg - Used for custom SVG content.
|
|
1105
1133
|
*/
|
|
1106
1134
|
|
|
1107
1135
|
// build the component class
|
|
1108
|
-
class
|
|
1136
|
+
class AuroIcon extends BaseIcon {
|
|
1109
1137
|
constructor() {
|
|
1110
1138
|
super();
|
|
1111
1139
|
|
|
1112
|
-
|
|
1113
|
-
* @private
|
|
1114
|
-
*/
|
|
1115
|
-
this.keys = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
1116
|
-
|
|
1117
|
-
/**
|
|
1118
|
-
* @private
|
|
1119
|
-
*/
|
|
1120
|
-
this.mdCount = 3;
|
|
1140
|
+
this.uri = 'https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist';
|
|
1121
1141
|
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
*/
|
|
1125
|
-
this.smCount = 2;
|
|
1142
|
+
this.privateDefaults();
|
|
1143
|
+
}
|
|
1126
1144
|
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1145
|
+
/**
|
|
1146
|
+
* Internal Defaults.
|
|
1147
|
+
* @private
|
|
1148
|
+
* @returns {void}
|
|
1149
|
+
*/
|
|
1150
|
+
privateDefaults() {
|
|
1151
|
+
this.accent = false;
|
|
1152
|
+
this.customColor = false;
|
|
1153
|
+
this.customSvg = false;
|
|
1154
|
+
this.disabled = false;
|
|
1155
|
+
this.emphasis = false;
|
|
1156
|
+
this.error = false;
|
|
1157
|
+
this.info = false;
|
|
1158
|
+
this.label = false;
|
|
1159
|
+
this.primary = false;
|
|
1160
|
+
this.secondary = false;
|
|
1161
|
+
this.subtle = false;
|
|
1162
|
+
this.success = false;
|
|
1163
|
+
this.tertiary = false;
|
|
1164
|
+
this.warning = false;
|
|
1130
1165
|
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
1131
|
-
|
|
1132
|
-
this.orbit = false;
|
|
1133
|
-
this.ringworm = false;
|
|
1134
|
-
this.laser = false;
|
|
1135
|
-
this.pulse = false;
|
|
1136
1166
|
}
|
|
1137
1167
|
|
|
1138
1168
|
// function to define props used within the scope of this component
|
|
1139
1169
|
static get properties() {
|
|
1140
1170
|
return {
|
|
1141
|
-
|
|
1171
|
+
...super.properties,
|
|
1172
|
+
accent: {
|
|
1142
1173
|
type: Boolean,
|
|
1143
1174
|
reflect: true
|
|
1144
1175
|
},
|
|
1145
|
-
|
|
1176
|
+
ariaHidden: {
|
|
1177
|
+
type: String,
|
|
1178
|
+
reflect: true
|
|
1179
|
+
},
|
|
1180
|
+
category: {
|
|
1181
|
+
type: String,
|
|
1182
|
+
reflect: true
|
|
1183
|
+
},
|
|
1184
|
+
customColor: {
|
|
1185
|
+
type: Boolean
|
|
1186
|
+
},
|
|
1187
|
+
customSvg: {
|
|
1188
|
+
type: Boolean
|
|
1189
|
+
},
|
|
1190
|
+
disabled: {
|
|
1146
1191
|
type: Boolean,
|
|
1147
1192
|
reflect: true
|
|
1148
1193
|
},
|
|
1149
|
-
|
|
1194
|
+
emphasis: {
|
|
1150
1195
|
type: Boolean,
|
|
1151
1196
|
reflect: true
|
|
1152
1197
|
},
|
|
1153
|
-
|
|
1198
|
+
error: {
|
|
1199
|
+
type: Boolean,
|
|
1200
|
+
reflect: true
|
|
1201
|
+
},
|
|
1202
|
+
info: {
|
|
1203
|
+
type: Boolean,
|
|
1204
|
+
reflect: true
|
|
1205
|
+
},
|
|
1206
|
+
label: {
|
|
1207
|
+
type: Boolean,
|
|
1208
|
+
reflect: true
|
|
1209
|
+
},
|
|
1210
|
+
name: {
|
|
1211
|
+
type: String,
|
|
1212
|
+
reflect: true
|
|
1213
|
+
},
|
|
1214
|
+
primary: {
|
|
1215
|
+
type: Boolean,
|
|
1216
|
+
reflect: true
|
|
1217
|
+
},
|
|
1218
|
+
secondary: {
|
|
1219
|
+
type: Boolean,
|
|
1220
|
+
reflect: true
|
|
1221
|
+
},
|
|
1222
|
+
subtle: {
|
|
1223
|
+
type: Boolean,
|
|
1224
|
+
reflect: true
|
|
1225
|
+
},
|
|
1226
|
+
success: {
|
|
1227
|
+
type: Boolean,
|
|
1228
|
+
reflect: true
|
|
1229
|
+
},
|
|
1230
|
+
tertiary: {
|
|
1231
|
+
type: Boolean,
|
|
1232
|
+
reflect: true
|
|
1233
|
+
},
|
|
1234
|
+
uri: {
|
|
1235
|
+
type: String
|
|
1236
|
+
},
|
|
1237
|
+
warning: {
|
|
1154
1238
|
type: Boolean,
|
|
1155
1239
|
reflect: true
|
|
1156
1240
|
}
|
|
@@ -1159,332 +1243,277 @@ class AuroLoader extends r {
|
|
|
1159
1243
|
|
|
1160
1244
|
static get styles() {
|
|
1161
1245
|
return [
|
|
1162
|
-
|
|
1163
|
-
i$5`${
|
|
1164
|
-
i$5`${
|
|
1246
|
+
super.styles,
|
|
1247
|
+
i$5`${tokensCss$1}`,
|
|
1248
|
+
i$5`${styleCss$1}`,
|
|
1249
|
+
i$5`${colorCss$1}`
|
|
1165
1250
|
];
|
|
1166
1251
|
}
|
|
1167
1252
|
|
|
1168
1253
|
/**
|
|
1169
1254
|
* This will register this element with the browser.
|
|
1170
|
-
* @param {string} [name="auro-
|
|
1255
|
+
* @param {string} [name="auro-icon"] - The name of element that you want to register to.
|
|
1171
1256
|
*
|
|
1172
1257
|
* @example
|
|
1173
|
-
*
|
|
1258
|
+
* AuroIcon.register("custom-icon") // this will register this element to <custom-icon/>
|
|
1174
1259
|
*
|
|
1175
1260
|
*/
|
|
1176
|
-
static register(name = "auro-
|
|
1177
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent(name,
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
firstUpdated() {
|
|
1181
|
-
// Add the tag name as an attribute if it is different than the component name
|
|
1182
|
-
this.runtimeUtils.handleComponentTagRename(this, 'auro-loader');
|
|
1261
|
+
static register(name = "auro-icon") {
|
|
1262
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroIcon);
|
|
1183
1263
|
}
|
|
1184
1264
|
|
|
1185
1265
|
connectedCallback() {
|
|
1186
1266
|
super.connectedCallback();
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
/**
|
|
1190
|
-
* @private
|
|
1191
|
-
* @returns {Array} Numbered array for template map.
|
|
1192
|
-
*/
|
|
1193
|
-
defineTemplate() {
|
|
1194
|
-
let nodes = Array.from(Array(this.mdCount).keys());
|
|
1195
|
-
|
|
1196
|
-
if (this.orbit || this.laser) {
|
|
1197
|
-
nodes = Array.from(Array(this.smCount).keys());
|
|
1198
|
-
} else if (this.ringworm) {
|
|
1199
|
-
nodes = Array.from(Array(0).keys());
|
|
1200
|
-
}
|
|
1201
1267
|
|
|
1202
|
-
|
|
1268
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
1269
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-icon');
|
|
1203
1270
|
}
|
|
1204
1271
|
|
|
1205
|
-
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
1206
|
-
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
1207
|
-
|
|
1208
1272
|
// function that renders the HTML and CSS into the scope of the component
|
|
1209
1273
|
render() {
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1274
|
+
const a11y = {
|
|
1275
|
+
'labelContainer': true,
|
|
1276
|
+
'util_displayHiddenVisually': !this.label
|
|
1277
|
+
};
|
|
1214
1278
|
|
|
1215
|
-
|
|
1279
|
+
const classes = {
|
|
1280
|
+
'label': this.label
|
|
1281
|
+
};
|
|
1216
1282
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
:
|
|
1222
|
-
|
|
1283
|
+
return x`
|
|
1284
|
+
<div
|
|
1285
|
+
class="${e(classes)}"
|
|
1286
|
+
title="${o(this.title || undefined)}">
|
|
1287
|
+
<span aria-hidden="${o(this.ariaHidden ? this.ariaHidden : true)}" part="svg">
|
|
1288
|
+
${this.customSvg ? x`
|
|
1289
|
+
<slot name="svg"></slot>
|
|
1290
|
+
` : x`
|
|
1291
|
+
${this.svg}
|
|
1292
|
+
`
|
|
1293
|
+
}
|
|
1294
|
+
</span>
|
|
1295
|
+
|
|
1296
|
+
<div class="${e(a11y)}">
|
|
1297
|
+
<slot></slot>
|
|
1298
|
+
</div>
|
|
1299
|
+
</div>
|
|
1223
1300
|
`;
|
|
1224
1301
|
}
|
|
1225
1302
|
}
|
|
1226
1303
|
|
|
1227
|
-
var
|
|
1304
|
+
var iconVersion = '6.0.2';
|
|
1228
1305
|
|
|
1229
|
-
|
|
1306
|
+
var chevronUp = {"role":"img","color":"currentColor","title":"","desc":"Directional indicator; up.","width":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","height":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","xmlns":"http://www.w3.org/2000/svg","xmlns_xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 24 24","path":"/icons","style":"ico_squareLarge","type":"icon","name":"chevron-up","category":"interface","svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"chevron-up__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"chevron-up__desc\">Directional indicator; up.</desc><path d=\"m17.603 14.343-.073.084a.75.75 0 0 1-.976.073l-.084-.073L12 9.957l-4.47 4.47a.75.75 0 0 1-.976.073l-.084-.073a.75.75 0 0 1-.073-.976l.073-.085 4.823-4.823a1 1 0 0 1 1.414 0l4.823 4.823a.75.75 0 0 1 .073.977\"/></svg>"};
|
|
1307
|
+
|
|
1308
|
+
var chevronDown = {"role":"img","color":"currentColor","title":"","desc":"Directional indicator; down.","width":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","height":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","xmlns":"http://www.w3.org/2000/svg","xmlns_xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 24 24","path":"/icons","style":"ico_squareLarge","type":"icon","name":"chevron-down","category":"interface","svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"chevron-down__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"chevron-down__desc\">Directional indicator; down.</desc><path d=\"m6.397 9.554.073-.084a.75.75 0 0 1 .976-.073l.084.073L12 13.939l4.47-4.47a.75.75 0 0 1 .976-.072l.084.073a.75.75 0 0 1 .073.976l-.073.084L13.061 15l-.354.354a1 1 0 0 1-1.414 0L10.939 15l-4.47-4.47a.75.75 0 0 1-.072-.976l.073-.084z\"/></svg>"};
|
|
1309
|
+
|
|
1310
|
+
var styleCss = i$5`:host{interpolate-size:allow-keywords}:host .trigger{position:relative;cursor:pointer;display:inline-block;border-width:1px;border-style:solid;border-radius:var(--ds-border-radius, 0.375rem)}:host .trigger:hover{text-decoration:underline}:host ::slotted([slot=trigger]){padding-left:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem);font-size:var(--ds-text-heading-300-size, 1.125rem)}:host .iconWrapper{height:var(--ds-size-300, 1.5rem);margin-top:-2px}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300,$ds-size-300)}:host [auro-icon][hidden]{display:none}:host .content{width:100%;transition:all .5s ease-in-out;transition-property:height;font-size:var(--ds-text-body-size-default, 1rem)}:host .componentWrapper{height:100%;overflow:hidden}:host .contentWrapper{padding-left:var(--ds-size-400, 2rem);padding-bottom:var(--ds-size-300, 1.5rem);padding-right:var(--ds-size-200, 1rem)}:host(:focus) .trigger{border-width:1px;border-style:solid}:host([chevron=right]) ::slotted([slot=trigger]){padding-left:0;padding-right:var(--ds-size-50, 0.25rem)}:host([alignRight]) .componentWrapper{display:flex;flex-direction:column;align-items:flex-end}:host([fluid]) .trigger{width:100%}:host([grouped]) .componentWrapper{border-bottom-width:1px;border-bottom-style:solid}:host(:not([expanded])) .content,:host([expanded=false]) .content{height:0 !important}:host([expanded]) .content{height:auto}:host([emphasis]) .trigger{border-style:solid;border-width:1px;border-left-width:2px;padding-left:var(--ds-size-200, 1rem)}:host([emphasis]) .trigger:before{display:block;position:absolute;top:-1px;left:-2px;width:1px;height:calc(100% + 2px);content:"";border-left-style:solid;border-left-width:2px}:host([emphasis]) .trigger:focus{border-left-width:1px;margin-left:1px}:host([emphasis]) .content{border-left-width:2px;border-left-style:solid;padding:unset}:host([emphasis]) .contentWrapper{padding-left:var(--ds-size-200, 1rem)}:host([emphasis]) .iconWrapper{padding-right:var(--ds-size-200, 1rem)}:host([emphasis]:not([expanded]):hover) .trigger{text-decoration:unset}:host([variant=sm]) ::slotted([slot=trigger]){font-size:var(--ds-text-body-size-default, 1rem)}:host([variant=lg]) ::slotted([slot=trigger]){font-size:var(--ds-text-heading-400-size, 1.25rem)}:host([chevron=none]) ::slotted([slot=trigger]),:host([chevron=none]) .contentWrapper{padding-left:unset}`;
|
|
1311
|
+
|
|
1312
|
+
var colorCss = i$5`:host .trigger{color:var(--ds-auro-accordion-trigger-color);border-color:var(--ds-auro-accordion-trigger-border-color)}:host [auro-icon]{color:var(--ds-auro-accordion-trigger-icon-color)}:host(:focus){--ds-auro-accordion-trigger-border-color: var(--ds-color-border-active-default, #0074c8);--ds-auro-accordion-trigger-icon-color: var(--ds-color-icon-ui-secondary-focus-default, #7e7e7e)}:host(:hover){--ds-auro-accordion-trigger-icon-color: var(--ds-color-icon-ui-secondary-hover-default, #525252)}:host([grouped]) .componentWrapper{border-bottom-color:var(--ds-auro-accordion-group-border-color)}:host([emphasis]) .trigger:before{border-color:var(--ds-auro-accordion-trigger-border-color)}:host([emphasis]) .trigger:focus:before,:host([emphasis]) .trigger:hover:before{--ds-auro-accordion-trigger-border-color: var(--ds-color-border-active-default, #0074c8)}:host([emphasis]) .trigger:focus{--ds-auro-accordion-trigger-border-color: var(--ds-color-border-active-default, #0074c8)}:host([emphasis]) .content{border-left-color:var(--ds-auro-accordion-content-border-color)}:host([emphasis][expanded]) .trigger:before{--ds-auro-accordion-trigger-border-color: var(--ds-color-border-active-default, #0074c8)}:host([emphasis][expanded]) .content{--ds-auro-accordion-content-border-color: var(--ds-color-border-subtle-default, #f0f7fd)}`;
|
|
1313
|
+
|
|
1314
|
+
var tokensCss = i$5`:host{--ds-auro-accordion-content-border-color: transparent;--ds-auro-accordion-group-border-color: var(--ds-color-border-divider-default, rgba(0, 0, 0, 0.12));--ds-auro-accordion-trigger-border-color: transparent;--ds-auro-accordion-trigger-color: var(--ds-color-text-primary-default, #2a2a2a);--ds-auro-accordion-trigger-icon-color: var(--ds-color-icon-ui-secondary-default-default, #7e7e7e)}`;
|
|
1315
|
+
|
|
1316
|
+
// Copyright (c) 2023 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1230
1317
|
// See LICENSE in the project root for license information.
|
|
1231
1318
|
|
|
1232
1319
|
|
|
1320
|
+
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
1233
1321
|
/**
|
|
1234
|
-
*
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1237
|
-
* @attr {Boolean}
|
|
1238
|
-
* @attr {Boolean}
|
|
1239
|
-
* @attr {Boolean}
|
|
1240
|
-
* @attr {Boolean}
|
|
1241
|
-
* @attr {
|
|
1242
|
-
* @attr {String}
|
|
1243
|
-
* @
|
|
1244
|
-
* @
|
|
1245
|
-
* @
|
|
1246
|
-
* @
|
|
1247
|
-
* @
|
|
1248
|
-
* @
|
|
1249
|
-
* @
|
|
1250
|
-
* @attr {Boolean} tertiary - DEPRECATED
|
|
1251
|
-
* @prop {Boolean} ready - When false the component API should not be called.
|
|
1252
|
-
* @event auroButton-ready - Notifies that the component has finished initializing.
|
|
1253
|
-
* @slot - Default slot for the text of the button.
|
|
1254
|
-
* @slot icon - Slot to provide auro-icon for the button.
|
|
1255
|
-
* @csspart button - Apply CSS to HTML5 button.
|
|
1256
|
-
* @csspart loader - Apply CSS to auro-loader.
|
|
1257
|
-
* @csspart text - Apply CSS to text slot.
|
|
1258
|
-
* @csspart icon - Apply CSS to icon slot.
|
|
1322
|
+
* Auro-accordion provides users a way to have collapsible content on a page.
|
|
1323
|
+
* Use auro-accordion-group if you want to have auto closing accordion components when others are selected.
|
|
1324
|
+
*
|
|
1325
|
+
* @attr {Boolean} alignRight - If set, the trigger content will align right.
|
|
1326
|
+
* @attr {Boolean} expanded - If set, the accordion is expanded.
|
|
1327
|
+
* @attr {Boolean} emphasis - If set, emphasis styles will be applied to the auro-accordions.
|
|
1328
|
+
* @attr {Boolean} grouped - Attribute will be set on accordion when it appears in an accordion group.
|
|
1329
|
+
* @attr {String} chevron - Sets chevron variant option. Possible values are: `none`, `right`.
|
|
1330
|
+
* @attr {String} variant - Sets accordion variant option. Possible values are: `sm`, `lg`.
|
|
1331
|
+
* @slot - Default slot for the accordion content.
|
|
1332
|
+
* @slot trigger - Defines the content of the trigger element.
|
|
1333
|
+
* @csspart accordion - Apply CSS to Accordion wrapper.
|
|
1334
|
+
* @csspart trigger - Apply CSS to trigger element.
|
|
1335
|
+
* @csspart chevron - Apply CSS to chevron icon.
|
|
1336
|
+
* @csspart content - Apply CSS to the accordion content.
|
|
1337
|
+
* @event toggleExpanded - Notifies that the accordion has been expanded or closed.
|
|
1259
1338
|
*/
|
|
1260
1339
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
class AuroButton extends r {
|
|
1264
|
-
|
|
1340
|
+
// build the component class
|
|
1341
|
+
class AuroAccordion extends r {
|
|
1265
1342
|
constructor() {
|
|
1266
1343
|
super();
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
this.iconOnly = false;
|
|
1270
|
-
this.loading = false;
|
|
1271
|
-
this.onDark = false;
|
|
1272
|
-
this.ready = false;
|
|
1273
|
-
this.secondary = false;
|
|
1274
|
-
this.tertiary = false;
|
|
1275
|
-
this.rounded = false;
|
|
1276
|
-
this.slim = false;
|
|
1277
|
-
this.fluid = false;
|
|
1344
|
+
|
|
1345
|
+
const versioning = new AuroDependencyVersioning();
|
|
1278
1346
|
|
|
1279
1347
|
/**
|
|
1280
|
-
*
|
|
1348
|
+
* @private
|
|
1281
1349
|
*/
|
|
1282
|
-
|
|
1350
|
+
this.iconTag = versioning.generateTag('auro-icon', iconVersion, AuroIcon);
|
|
1283
1351
|
|
|
1284
1352
|
/**
|
|
1285
1353
|
* @private
|
|
1286
1354
|
*/
|
|
1287
|
-
this.
|
|
1288
|
-
}
|
|
1355
|
+
this.buttonNameHash = this.generateRandomLetters(4); //eslint-disable-line
|
|
1289
1356
|
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1357
|
+
/**
|
|
1358
|
+
* @private
|
|
1359
|
+
*/
|
|
1360
|
+
this.buttonTag = versioning.generateTag('auro-accordion-button', this.buttonNameHash, AuroAccordionButton);
|
|
1361
|
+
|
|
1362
|
+
/**
|
|
1363
|
+
* @private
|
|
1364
|
+
*/
|
|
1365
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils$3();
|
|
1366
|
+
|
|
1367
|
+
this.expanded = false;
|
|
1296
1368
|
}
|
|
1297
1369
|
|
|
1370
|
+
// This function is to define props used within the scope of this component
|
|
1371
|
+
// Be sure to review https://lit.dev/docs/components/properties/
|
|
1372
|
+
// to understand how to use reflected attributes with your property settings.
|
|
1298
1373
|
static get properties() {
|
|
1299
1374
|
return {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
},
|
|
1304
|
-
disabled: {
|
|
1305
|
-
type: Boolean,
|
|
1306
|
-
reflect: true
|
|
1307
|
-
},
|
|
1308
|
-
secondary: {
|
|
1309
|
-
type: Boolean,
|
|
1310
|
-
reflect: true
|
|
1311
|
-
},
|
|
1312
|
-
tertiary: {
|
|
1313
|
-
type: Boolean,
|
|
1314
|
-
reflect: true
|
|
1315
|
-
},
|
|
1316
|
-
fluid: {
|
|
1317
|
-
type: Boolean,
|
|
1318
|
-
reflect: true
|
|
1319
|
-
},
|
|
1320
|
-
iconOnly: {
|
|
1321
|
-
type: Boolean,
|
|
1322
|
-
reflect: true
|
|
1323
|
-
},
|
|
1324
|
-
loading: {
|
|
1375
|
+
// ...super.properties,
|
|
1376
|
+
|
|
1377
|
+
alignRight: {
|
|
1325
1378
|
type: Boolean,
|
|
1326
|
-
reflect: true
|
|
1379
|
+
reflect: true,
|
|
1327
1380
|
},
|
|
1328
|
-
|
|
1381
|
+
expanded: {
|
|
1329
1382
|
type: Boolean,
|
|
1330
|
-
reflect: true
|
|
1383
|
+
reflect: true,
|
|
1331
1384
|
},
|
|
1332
|
-
|
|
1385
|
+
emphasis: {
|
|
1333
1386
|
type: Boolean,
|
|
1334
1387
|
reflect: true
|
|
1335
1388
|
},
|
|
1336
|
-
|
|
1389
|
+
grouped: {
|
|
1337
1390
|
type: Boolean,
|
|
1338
1391
|
reflect: true
|
|
1339
1392
|
},
|
|
1340
|
-
|
|
1341
|
-
type: String,
|
|
1342
|
-
reflect: true
|
|
1343
|
-
},
|
|
1344
|
-
arialabelledby: {
|
|
1345
|
-
type: String,
|
|
1346
|
-
reflect: true
|
|
1347
|
-
},
|
|
1348
|
-
title: {
|
|
1349
|
-
type: String,
|
|
1350
|
-
reflect: true
|
|
1351
|
-
},
|
|
1352
|
-
type: {
|
|
1353
|
-
type: String,
|
|
1354
|
-
reflect: true
|
|
1355
|
-
},
|
|
1356
|
-
value: {
|
|
1393
|
+
chevron: {
|
|
1357
1394
|
type: String,
|
|
1358
1395
|
reflect: true
|
|
1359
1396
|
},
|
|
1360
|
-
variant:
|
|
1397
|
+
variant: {
|
|
1361
1398
|
type: String,
|
|
1362
1399
|
reflect: true
|
|
1363
|
-
}
|
|
1364
|
-
ready: { type: Boolean },
|
|
1400
|
+
}
|
|
1365
1401
|
};
|
|
1366
1402
|
}
|
|
1367
1403
|
|
|
1404
|
+
static get styles() {
|
|
1405
|
+
return [
|
|
1406
|
+
colorCss,
|
|
1407
|
+
styleCss,
|
|
1408
|
+
tokensCss
|
|
1409
|
+
];
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1368
1412
|
/**
|
|
1369
1413
|
* This will register this element with the browser.
|
|
1370
|
-
* @param {string} [name="auro-
|
|
1414
|
+
* @param {string} [name="auro-accordion"] - The name of element that you want to register to.
|
|
1371
1415
|
*
|
|
1372
1416
|
* @example
|
|
1373
|
-
*
|
|
1417
|
+
* AuroAccordion.register("custom-accordion") // this will register this element to <custom-accordion/>
|
|
1374
1418
|
*
|
|
1375
1419
|
*/
|
|
1376
|
-
static register(name = "auro-
|
|
1377
|
-
|
|
1420
|
+
static register(name = "auro-accordion") {
|
|
1421
|
+
const nameGroup = `${name}-group`;
|
|
1422
|
+
AuroLibraryRuntimeUtils$3.prototype.registerComponent(name, AuroAccordion);
|
|
1423
|
+
AuroAccordionGroup.register(nameGroup);
|
|
1378
1424
|
}
|
|
1379
1425
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
* @returns {void}
|
|
1384
|
-
*/
|
|
1385
|
-
focus() {
|
|
1386
|
-
this.renderRoot.querySelector('button').focus();
|
|
1426
|
+
firstUpdated() {
|
|
1427
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
1428
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-accordion');
|
|
1387
1429
|
}
|
|
1388
1430
|
|
|
1389
1431
|
/**
|
|
1390
|
-
*
|
|
1432
|
+
* Internal function to generate the HTML for the icon to use.
|
|
1391
1433
|
* @private
|
|
1392
|
-
* @
|
|
1434
|
+
* @param {string} svgContent - The imported svg icon.
|
|
1435
|
+
* @returns {TemplateResult} - The html template for the icon.
|
|
1393
1436
|
*/
|
|
1394
|
-
|
|
1395
|
-
|
|
1437
|
+
generateIconHtml(svgContent) {
|
|
1438
|
+
const dom = new DOMParser().parseFromString(svgContent, 'text/html');
|
|
1439
|
+
const svg = dom.body.firstChild;
|
|
1396
1440
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
composed: true,
|
|
1401
|
-
}));
|
|
1441
|
+
svg.setAttribute('slot', 'svg');
|
|
1442
|
+
|
|
1443
|
+
return u`${svg}`;
|
|
1402
1444
|
}
|
|
1403
1445
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1446
|
+
/**
|
|
1447
|
+
* Generates a random string of letters.
|
|
1448
|
+
* @private
|
|
1449
|
+
* @param {number} length - The number of characters to generate in the string.
|
|
1450
|
+
* @returns {string} - The generated string.
|
|
1451
|
+
*/
|
|
1452
|
+
generateRandomLetters(length) {
|
|
1453
|
+
let result = '';
|
|
1454
|
+
const characters = 'abcdefghijklmnopqrstuvwxyz';
|
|
1455
|
+
const charactersLength = characters.length;
|
|
1456
|
+
for (let index = 0; index < length; index += 1) {
|
|
1457
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
1408
1458
|
}
|
|
1409
1459
|
|
|
1410
|
-
|
|
1411
|
-
this.setAttribute('variant', 'tertiary');
|
|
1412
|
-
}
|
|
1460
|
+
return result;
|
|
1413
1461
|
}
|
|
1414
1462
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1463
|
+
/**
|
|
1464
|
+
* Toggles the visibility of the accordion content.
|
|
1465
|
+
*/
|
|
1466
|
+
toggle() {
|
|
1467
|
+
this.expanded = !this.expanded;
|
|
1468
|
+
|
|
1469
|
+
this.dispatchEvent(new CustomEvent('toggleExpanded', {
|
|
1470
|
+
bubbles: true,
|
|
1471
|
+
composed: true,
|
|
1472
|
+
detail: {
|
|
1473
|
+
expanded: this.expanded
|
|
1474
|
+
}
|
|
1475
|
+
}));
|
|
1417
1476
|
}
|
|
1418
1477
|
|
|
1478
|
+
// function that renders the HTML and CSS into the scope of the component
|
|
1419
1479
|
render() {
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1422
|
-
'
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
'auro-button--iconOnly': this.iconOnly,
|
|
1426
|
-
'auro-button--iconOnlySlim': this.iconOnly && this.slim,
|
|
1427
|
-
'loading': this.loading
|
|
1480
|
+
const buttonClasses = {
|
|
1481
|
+
"trigger": true,
|
|
1482
|
+
"iconRight": this.getAttribute('chevron') === 'right',
|
|
1483
|
+
"sm": this.getAttribute('variant') === 'sm',
|
|
1484
|
+
"lg": this.getAttribute('variant') === 'lg',
|
|
1428
1485
|
};
|
|
1429
1486
|
|
|
1430
1487
|
return u`
|
|
1431
|
-
<
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
</span>
|
|
1457
|
-
</button>
|
|
1488
|
+
<div class="componentWrapper" part="accordion">
|
|
1489
|
+
<${this.buttonTag}
|
|
1490
|
+
?fluid="${this.emphasis}"
|
|
1491
|
+
class="${e(buttonClasses)}"
|
|
1492
|
+
id="accordionTrigger"
|
|
1493
|
+
aria-controls="accordionContent"
|
|
1494
|
+
aria-expanded="${this.expanded}"
|
|
1495
|
+
@click="${this.toggle}"
|
|
1496
|
+
part="trigger">
|
|
1497
|
+
${this.chevron === 'none' ? undefined : u`
|
|
1498
|
+
<${this.iconTag} slot="icon" customSvg customColor ?hidden="${!this.expanded}">
|
|
1499
|
+
${this.generateIconHtml(chevronUp.svg)}
|
|
1500
|
+
</${this.iconTag}>
|
|
1501
|
+
<${this.iconTag} slot="icon" customSvg customColor ?hidden="${this.expanded}">
|
|
1502
|
+
${this.generateIconHtml(chevronDown.svg)}
|
|
1503
|
+
</${this.iconTag}>
|
|
1504
|
+
`}
|
|
1505
|
+
<slot name="trigger" part="triggerSlot"></slot>
|
|
1506
|
+
</${this.buttonTag}>
|
|
1507
|
+
<div class="content" id="accordionContent" aria-labelledby="accordionTrigger" inert="${!this.expanded || E}" part="content">
|
|
1508
|
+
<div class="contentWrapper" part="contentWrapper">
|
|
1509
|
+
<slot></slot>
|
|
1510
|
+
</div>
|
|
1511
|
+
</div>
|
|
1512
|
+
</div>
|
|
1458
1513
|
`;
|
|
1459
1514
|
}
|
|
1460
1515
|
}
|
|
1461
1516
|
|
|
1462
|
-
// Copyright (c) 2022 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1463
|
-
// See LICENSE in the project root for license information.
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
// build the component class
|
|
1467
|
-
class AuroAccordionButton extends AuroButton {
|
|
1468
|
-
static get styles() {
|
|
1469
|
-
return [
|
|
1470
|
-
styleCssAuroButton,
|
|
1471
|
-
styleButtonCss
|
|
1472
|
-
];
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
/**
|
|
1476
|
-
* This will register this element with the browser.
|
|
1477
|
-
* @param {string} [name="auro-accordion-button"] - The name of element that you want to register to.
|
|
1478
|
-
*
|
|
1479
|
-
* @example
|
|
1480
|
-
* AuroAccordionButton.register("custom-accordion-button") // this will register this element to <custom-accordion-button/>
|
|
1481
|
-
*
|
|
1482
|
-
*/
|
|
1483
|
-
static register(name = "auro-accordion-button") {
|
|
1484
|
-
AuroLibraryRuntimeUtils$3.prototype.registerComponent(name, AuroAccordionButton);
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
1517
|
AuroAccordion.register();
|
|
1489
1518
|
AuroAccordionGroup.register();
|
|
1490
1519
|
AuroAccordionButton.register();
|