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