@aurodesignsystem/auro-accordion 4.3.1 → 4.4.1
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 +14 -0
- package/README.md +4 -5
- 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 +2 -2
- package/coverage/lcov-report/iconVersion.js.html +2 -2
- 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 +2 -2
- package/coverage/lcov-report/tokens-css.js.html +2 -2
- package/coverage/lcov.info +296 -200
- package/demo/api.min.js +875 -1006
- package/demo/index.min.js +875 -1004
- package/dist/auro-accordion.d.ts +15 -0
- package/dist/auro-accordion.d.ts.map +1 -1
- package/dist/auro-accordion__bundled.js +875 -1006
- package/dist/iconVersion.d.ts +1 -1
- package/dist/iconVersion.d.ts.map +1 -1
- package/index.js +0 -4
- package/package.json +9 -8
- package/src/auro-accordion.js +35 -3
- package/src/color-css.js +1 -1
- package/src/color.css +24 -25
- package/src/iconVersion.js +1 -1
- package/src/style-button-css.js +1 -1
- package/src/style-button.css +27 -46
- package/src/style-css.js +1 -1
- package/src/style.css +101 -102
- package/src/tokens-css.js +1 -1
- package/src/tokens.css +6 -6
- package/test/auro-accordion.test.js +2 -0
package/demo/api.min.js
CHANGED
|
@@ -15,40 +15,40 @@ function expandedExample() {
|
|
|
15
15
|
* Copyright 2019 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
17
|
*/
|
|
18
|
-
const t$2=globalThis,e$4=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult
|
|
18
|
+
const t$2=globalThis,e$4=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$4&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$3=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$5=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$4)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$4?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$3(e)})(t):t;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @license
|
|
22
22
|
* Copyright 2017 Google LLC
|
|
23
23
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
24
|
-
*/const{is:i$4,defineProperty:e$3,getOwnPropertyDescriptor:r$2,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$2=globalThis,c$1=a$2.trustedTypes,l$2=c$1?c$1.emptyScript:"",p$1=a$2.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$2={toAttribute(t,s){switch(s){case Boolean:t=t?l$2:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$4(t,s),y$1={attribute
|
|
24
|
+
*/const{is:i$4,defineProperty:e$3,getOwnPropertyDescriptor:r$2,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$2=globalThis,c$1=a$2.trustedTypes,l$2=c$1?c$1.emptyScript:"",p$1=a$2.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$2={toAttribute(t,s){switch(s){case Boolean:t=t?l$2:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$4(t,s),y$1={attribute:true,type:String,converter:u$2,reflect:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$2.litPropertyMetadata??=new WeakMap;class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=false),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$3(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$3(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$2).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$2;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),true===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t) true!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=false,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[d$1("elementProperties")]=new Map,b[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b}),(a$2.reactiveElementVersions??=[]).push("2.0.4");
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @license
|
|
28
28
|
* Copyright 2017 Google LLC
|
|
29
29
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
30
30
|
*/
|
|
31
|
-
const t$1=globalThis,i$3=t$1.trustedTypes,s$1=i$3?i$3.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$2="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$2="?"+h,n$1=`<${o$2}>`,r$1=document,l$1=()=>r$1.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a$1=Array.isArray,u$1=t=>a$1(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$1.createTreeWalker(r$1,129);function P(t,i){if(!a$1(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$2+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$2)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$3?i$3.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l$1()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l$1());}}}else if(8===r.nodeType)if(r.data===o$2)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$1.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(
|
|
31
|
+
const t$1=globalThis,i$3=t$1.trustedTypes,s$1=i$3?i$3.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$2="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$2="?"+h,n$1=`<${o$2}>`,r$1=document,l$1=()=>r$1.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a$1=Array.isArray,u$1=t=>a$1(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$1.createTreeWalker(r$1,129);function P(t,i){if(!a$1(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$2+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$2)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$3?i$3.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l$1()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l$1());}}}else if(8===r.nodeType)if(r.data===o$2)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$1.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$1).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$1,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u$1(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$1.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a$1(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l$1()),this.O(l$1()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.2.1");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l$1(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @license
|
|
35
35
|
* Copyright 2017 Google LLC
|
|
36
36
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
|
-
*/class r extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(
|
|
37
|
+
*/class r extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}}r._$litElement$=true,r["finalized"]=true,globalThis.litElementHydrateSupport?.({LitElement:r});const i$2=globalThis.litElementPolyfillSupport;i$2?.({LitElement:r});(globalThis.litElementVersions??=[]).push("4.1.1");
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2020 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
43
|
*/
|
|
44
|
-
const a=Symbol.for(""),o$1=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i$1=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a}),l=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f
|
|
44
|
+
const a=Symbol.for(""),o$1=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i$1=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a}),l=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o$1(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u=n(x);
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* @license
|
|
48
48
|
* Copyright 2017 Google LLC
|
|
49
49
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
50
|
*/
|
|
51
|
-
const t={ATTRIBUTE:1
|
|
51
|
+
const t={ATTRIBUTE:1},e$1=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* @license
|
|
@@ -63,7 +63,7 @@ const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e
|
|
|
63
63
|
|
|
64
64
|
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
class AuroLibraryRuntimeUtils {
|
|
67
67
|
|
|
68
68
|
/* eslint-disable jsdoc/require-param */
|
|
69
69
|
|
|
@@ -124,13 +124,147 @@ let AuroLibraryRuntimeUtils$3 = class AuroLibraryRuntimeUtils {
|
|
|
124
124
|
|
|
125
125
|
return elemTag === tag || elem.hasAttribute(tag);
|
|
126
126
|
}
|
|
127
|
-
}
|
|
127
|
+
}
|
|
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();
|
|
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.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`: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`: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),.auro-button--iconOnly ::slotted([auro-icon]){--ds-auro-icon-size:var(--ds-size-300, $ds-size-300)}.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),.auro-button--iconOnlySlim ::slotted([auro-icon]){--ds-auro-icon-size:calc(var(--ds-size-200, $ds-size-200) + var(--ds-size-50, $ds-size-50))}.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),.auro-button--rounded ::slotted([auro-icon]){--ds-auro-icon-size:var(--ds-size-300, $ds-size-300)}: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;
|
|
128
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
|
|
|
132
266
|
|
|
133
|
-
|
|
267
|
+
class AuroDependencyVersioning {
|
|
134
268
|
|
|
135
269
|
/**
|
|
136
270
|
* Generates a unique string to be used for child auro element naming.
|
|
@@ -164,81 +298,17 @@ let AuroDependencyVersioning$1 = class AuroDependencyVersioning {
|
|
|
164
298
|
|
|
165
299
|
return tag;
|
|
166
300
|
}
|
|
167
|
-
};
|
|
168
|
-
|
|
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
|
|
176
|
-
// See LICENSE in the project root for license information.
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
*/
|
|
184
|
-
|
|
185
|
-
class AuroElement extends r {
|
|
186
|
-
|
|
187
|
-
// function to define props used within the scope of this component
|
|
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
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* @private Function that determines state of aria-hidden
|
|
201
|
-
*/
|
|
202
|
-
hideAudible(value) {
|
|
203
|
-
if (value) {
|
|
204
|
-
return 'true'
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return 'false'
|
|
208
|
-
}
|
|
209
301
|
}
|
|
210
302
|
|
|
211
|
-
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>"};
|
|
212
|
-
|
|
213
|
-
/* eslint-disable no-underscore-dangle, jsdoc/no-undefined-types, jsdoc/require-param-description */
|
|
303
|
+
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}`;
|
|
214
304
|
|
|
215
|
-
|
|
305
|
+
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}`;
|
|
216
306
|
|
|
217
|
-
|
|
218
|
-
* A callback to parse Response body.
|
|
219
|
-
*
|
|
220
|
-
* @callback ResponseParser
|
|
221
|
-
* @param {Fetch.Response} response
|
|
222
|
-
* @returns {Promise}
|
|
223
|
-
*/
|
|
307
|
+
var styleCss$2 = i$5`: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}}`;
|
|
224
308
|
|
|
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));
|
|
237
|
-
}
|
|
238
|
-
return _fetchMap.get(uri);
|
|
239
|
-
};
|
|
309
|
+
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}`;
|
|
240
310
|
|
|
241
|
-
var
|
|
311
|
+
var tokensCss$2 = i$5`:host{--ds-auro-loader-background-color:currentcolor;--ds-auro-loader-border-color:currentcolor;--ds-auro-loader-color:currentcolor}`;
|
|
242
312
|
|
|
243
313
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
244
314
|
// See LICENSE in the project root for license information.
|
|
@@ -246,923 +316,755 @@ var styleCss$2 = i$5`*,*:before,*:after{box-sizing:border-box}@media(prefers-red
|
|
|
246
316
|
|
|
247
317
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
248
318
|
/**
|
|
249
|
-
*
|
|
250
|
-
*
|
|
319
|
+
* The auro-loader element is an easy to use animated loader component.
|
|
320
|
+
*
|
|
321
|
+
* @attr {Boolean} pulse - sets loader type
|
|
322
|
+
* @attr {Boolean} ringworm - sets loader type
|
|
323
|
+
* @attr {Boolean} laser - sets loader type
|
|
324
|
+
* @attr {Boolean} orbit - sets loader type
|
|
325
|
+
* @attr {Boolean} white - sets color of loader to white
|
|
326
|
+
* @attr {Boolean} ondark - sets color of loader to auro-color-ui-default-on-dark
|
|
327
|
+
* @attr {Boolean} onlight - sets color of loader to auro-color-ui-default-on-light
|
|
328
|
+
* @attr {Boolean} xs - sets size to extra small
|
|
329
|
+
* @attr {Boolean} sm - sets size to small
|
|
330
|
+
* @attr {Boolean} md - sets size to medium
|
|
331
|
+
* @attr {Boolean} lg - sets size to large
|
|
332
|
+
* @csspart element - apply style to adjust speed of animation
|
|
251
333
|
*/
|
|
252
334
|
|
|
253
335
|
// build the component class
|
|
254
|
-
class
|
|
336
|
+
class AuroLoader extends r {
|
|
255
337
|
constructor() {
|
|
256
338
|
super();
|
|
257
|
-
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* @private
|
|
342
|
+
*/
|
|
343
|
+
this.keys = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @private
|
|
347
|
+
*/
|
|
348
|
+
this.mdCount = 3;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* @private
|
|
352
|
+
*/
|
|
353
|
+
this.smCount = 2;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* @private
|
|
357
|
+
*/
|
|
358
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
359
|
+
|
|
360
|
+
this.orbit = false;
|
|
361
|
+
this.ringworm = false;
|
|
362
|
+
this.laser = false;
|
|
363
|
+
this.pulse = false;
|
|
258
364
|
}
|
|
259
365
|
|
|
260
366
|
// function to define props used within the scope of this component
|
|
261
367
|
static get properties() {
|
|
262
368
|
return {
|
|
263
|
-
|
|
264
|
-
onDark: {
|
|
369
|
+
pulse: {
|
|
265
370
|
type: Boolean,
|
|
266
371
|
reflect: true
|
|
267
372
|
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
reflect: true
|
|
373
|
+
orbit: {
|
|
374
|
+
type: Boolean,
|
|
375
|
+
reflect: true
|
|
376
|
+
},
|
|
377
|
+
ringworm: {
|
|
378
|
+
type: Boolean,
|
|
379
|
+
reflect: true
|
|
380
|
+
},
|
|
381
|
+
laser: {
|
|
382
|
+
type: Boolean,
|
|
383
|
+
reflect: true
|
|
275
384
|
}
|
|
276
385
|
};
|
|
277
386
|
}
|
|
278
387
|
|
|
279
388
|
static get styles() {
|
|
280
|
-
return
|
|
281
|
-
${styleCss$2}
|
|
282
|
-
|
|
389
|
+
return [
|
|
390
|
+
i$5`${styleCss$2}`,
|
|
391
|
+
i$5`${colorCss$2}`,
|
|
392
|
+
i$5`${tokensCss$2}`
|
|
393
|
+
];
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* This will register this element with the browser.
|
|
398
|
+
* @param {string} [name="auro-loader"] - The name of element that you want to register to.
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* AuroLoader.register("custom-loader") // this will register this element to <custom-loader/>
|
|
402
|
+
*
|
|
403
|
+
*/
|
|
404
|
+
static register(name = "auro-loader") {
|
|
405
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroLoader);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
firstUpdated() {
|
|
409
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
410
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-loader');
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
connectedCallback() {
|
|
414
|
+
super.connectedCallback();
|
|
283
415
|
}
|
|
284
416
|
|
|
285
417
|
/**
|
|
286
|
-
* Async function to fetch requested icon from npm CDN.
|
|
287
418
|
* @private
|
|
288
|
-
* @
|
|
289
|
-
* @param {string} name - Icon name.
|
|
290
|
-
* @returns {SVGElement} DOM - Ready HTML to be appended.
|
|
419
|
+
* @returns {Array} Numbered array for template map.
|
|
291
420
|
*/
|
|
292
|
-
|
|
293
|
-
let
|
|
421
|
+
defineTemplate() {
|
|
422
|
+
let nodes = Array.from(Array(this.mdCount).keys());
|
|
294
423
|
|
|
295
|
-
if (
|
|
296
|
-
|
|
297
|
-
} else {
|
|
298
|
-
|
|
424
|
+
if (this.orbit || this.laser) {
|
|
425
|
+
nodes = Array.from(Array(this.smCount).keys());
|
|
426
|
+
} else if (this.ringworm) {
|
|
427
|
+
nodes = Array.from(Array(0).keys());
|
|
299
428
|
}
|
|
300
429
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
return dom.body.querySelector('svg');
|
|
430
|
+
return nodes;
|
|
304
431
|
}
|
|
305
432
|
|
|
306
|
-
//
|
|
307
|
-
|
|
308
|
-
if (!this.customSvg) {
|
|
309
|
-
const svg = await this.fetchIcon(this.category, this.name);
|
|
433
|
+
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
434
|
+
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
310
435
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
436
|
+
// function that renders the HTML and CSS into the scope of the component
|
|
437
|
+
render() {
|
|
438
|
+
return x`
|
|
439
|
+
${this.defineTemplate().map((idx) => x`
|
|
440
|
+
<span part="element" class="loader node-${idx}"></span>
|
|
441
|
+
`)}
|
|
315
442
|
|
|
316
|
-
|
|
443
|
+
<div class="no-animation">Loading...</div>
|
|
444
|
+
|
|
445
|
+
${this.ringworm ? x`
|
|
446
|
+
<svg part="element" class="circular" viewBox="25 25 50 50">
|
|
447
|
+
<circle class="path" cx="50" cy="50" r="20" fill="none"/>
|
|
448
|
+
</svg>`
|
|
449
|
+
: ``
|
|
317
450
|
}
|
|
318
|
-
|
|
451
|
+
`;
|
|
319
452
|
}
|
|
320
453
|
}
|
|
321
454
|
|
|
322
|
-
var
|
|
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)}`;
|
|
455
|
+
var loaderVersion = '3.1.4';
|
|
325
456
|
|
|
326
457
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
327
458
|
// See LICENSE in the project root for license information.
|
|
328
459
|
|
|
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 {
|
|
334
|
-
|
|
335
|
-
/* eslint-disable jsdoc/require-param */
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* This will register a new custom element with the browser.
|
|
339
|
-
* @param {String} name - The name of the custom element.
|
|
340
|
-
* @param {Object} componentClass - The class to register as a custom element.
|
|
341
|
-
* @returns {void}
|
|
342
|
-
*/
|
|
343
|
-
registerComponent(name, componentClass) {
|
|
344
|
-
if (!customElements.get(name)) {
|
|
345
|
-
customElements.define(name, class extends componentClass {});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
460
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
461
|
+
/**
|
|
462
|
+
* @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
|
|
463
|
+
* @attr {Boolean} disabled - If set to true button will become disabled and not allow for interactions
|
|
464
|
+
* @attr {Boolean} iconOnly - If set to true, the button will contain an icon with no additional content
|
|
465
|
+
* @attr {Boolean} loading - If set to true button text will be replaced with `auro-loader` and become disabled
|
|
466
|
+
* @attr {Boolean} onDark - Set value for on-dark version of auro-button
|
|
467
|
+
* @attr {Boolean} rounded - If set to true, the button will have a rounded shape
|
|
468
|
+
* @attr {Boolean} slim - Set value for slim version of auro-button
|
|
469
|
+
* @attr {Boolean} fluid - Alters the shape of the button to be full width of its parent container
|
|
470
|
+
* @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.
|
|
471
|
+
* @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.
|
|
472
|
+
* @attr {String} id - Set the unique ID of an element.
|
|
473
|
+
* @attr {String} title - Sets title attribute. The information is most often shown as a tooltip text when the mouse moves over the element.
|
|
474
|
+
* @attr {String} type - The type of the button. Possible values are: `submit`, `reset`, `button`
|
|
475
|
+
* @attr {String} value - Defines the value associated with the button which is submitted with the form data.
|
|
476
|
+
* @attr {String} variant - Sets button variant option. Possible values are: `secondary`, `tertiary`
|
|
477
|
+
* @attr {Boolean} secondary - DEPRECATED
|
|
478
|
+
* @attr {Boolean} tertiary - DEPRECATED
|
|
479
|
+
* @prop {Boolean} ready - When false the component API should not be called.
|
|
480
|
+
* @event auroButton-ready - Notifies that the component has finished initializing.
|
|
481
|
+
* @slot - Default slot for the text of the button.
|
|
482
|
+
* @slot icon - Slot to provide auro-icon for the button.
|
|
483
|
+
* @csspart button - Apply CSS to HTML5 button.
|
|
484
|
+
* @csspart loader - Apply CSS to auro-loader.
|
|
485
|
+
* @csspart text - Apply CSS to text slot.
|
|
486
|
+
* @csspart icon - Apply CSS to icon slot.
|
|
487
|
+
*/
|
|
366
488
|
|
|
367
|
-
|
|
368
|
-
* 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.
|
|
369
|
-
* @param {Object} elem - The element to check.
|
|
370
|
-
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
371
|
-
* @returns {void}
|
|
372
|
-
*/
|
|
373
|
-
handleComponentTagRename(elem, tagName) {
|
|
374
|
-
const tag = tagName.toLowerCase();
|
|
375
|
-
const elemTag = elem.tagName.toLowerCase();
|
|
489
|
+
/* eslint-disable lit/no-invalid-html, lit/binding-positions */
|
|
376
490
|
|
|
377
|
-
|
|
378
|
-
elem.setAttribute(tag, true);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
491
|
+
class AuroButton extends r {
|
|
381
492
|
|
|
382
493
|
/**
|
|
383
|
-
*
|
|
384
|
-
* @
|
|
385
|
-
* @
|
|
386
|
-
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
494
|
+
* Enables form association for this element.
|
|
495
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals
|
|
496
|
+
* @returns {boolean} - Returns true to enable form association.
|
|
387
497
|
*/
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
const elemTag = elem.tagName.toLowerCase();
|
|
391
|
-
|
|
392
|
-
return elemTag === tag || elem.hasAttribute(tag);
|
|
498
|
+
static get formAssociated() {
|
|
499
|
+
return true;
|
|
393
500
|
}
|
|
394
|
-
};
|
|
395
501
|
|
|
396
|
-
|
|
397
|
-
|
|
502
|
+
constructor() {
|
|
503
|
+
super();
|
|
398
504
|
|
|
505
|
+
this.autofocus = false;
|
|
506
|
+
this.disabled = false;
|
|
507
|
+
this.iconOnly = false;
|
|
508
|
+
this.loading = false;
|
|
509
|
+
this.onDark = false;
|
|
510
|
+
this.ready = false;
|
|
511
|
+
this.secondary = false;
|
|
512
|
+
this.tertiary = false;
|
|
513
|
+
this.rounded = false;
|
|
514
|
+
this.slim = false;
|
|
515
|
+
this.fluid = false;
|
|
399
516
|
|
|
400
|
-
//
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
* @attr {String} name - The name of the icon you are looking for without the file extension. See https://auro.alaskaair.com/icons/usage
|
|
406
|
-
* @attr {Boolean} customColor - Removes primary selector.
|
|
407
|
-
* @attr {Boolean} customSvg - When true, auro-icon will render a custom SVG inside the default slot.
|
|
408
|
-
* @attr {Boolean} label - Exposes content in slot as icon label.
|
|
409
|
-
* @attr {Boolean} primary - DEPRECATED: Sets the icon to use the baseline primary icon style.
|
|
410
|
-
* @attr {Boolean} accent - Sets the icon to use the accent style.
|
|
411
|
-
* @attr {Boolean} emphasis - Sets the icon to use the emphasis style.
|
|
412
|
-
* @attr {Boolean} disabled - Sets the icon to use the disabled style.
|
|
413
|
-
* @attr {Boolean} error - Sets the icon to use the error style.
|
|
414
|
-
* @attr {Boolean} info - Sets the icon to use the info style.
|
|
415
|
-
* @attr {Boolean} secondary - Sets the icon to use the secondary style.
|
|
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.
|
|
424
|
-
*/
|
|
517
|
+
// Support for HTML5 forms
|
|
518
|
+
if (typeof this.attachInternals === 'function') {
|
|
519
|
+
this.internals = this.attachInternals();
|
|
520
|
+
} else {
|
|
521
|
+
this.internals = null;
|
|
425
522
|
|
|
426
|
-
//
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
super();
|
|
523
|
+
// eslint-disable-next-line no-console
|
|
524
|
+
console.warn('This browser does not support form association features. Some form-related functionality may not work as expected. Consider using a polyfill or handling click events manually.');
|
|
525
|
+
}
|
|
430
526
|
|
|
431
|
-
|
|
527
|
+
/**
|
|
528
|
+
* Generate unique names for dependency components.
|
|
529
|
+
*/
|
|
530
|
+
const versioning = new AuroDependencyVersioning();
|
|
432
531
|
|
|
433
|
-
|
|
532
|
+
/**
|
|
533
|
+
* @private
|
|
534
|
+
*/
|
|
535
|
+
this.loaderTag = versioning.generateTag('auro-loader', loaderVersion, AuroLoader);
|
|
434
536
|
}
|
|
435
537
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
this.accent = false;
|
|
443
|
-
this.customColor = false;
|
|
444
|
-
this.customSvg = false;
|
|
445
|
-
this.disabled = false;
|
|
446
|
-
this.emphasis = false;
|
|
447
|
-
this.error = false;
|
|
448
|
-
this.info = false;
|
|
449
|
-
this.label = false;
|
|
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();
|
|
538
|
+
static get styles() {
|
|
539
|
+
return [
|
|
540
|
+
tokensCss$3,
|
|
541
|
+
styleCssAuroButton,
|
|
542
|
+
colorCss$3
|
|
543
|
+
];
|
|
457
544
|
}
|
|
458
545
|
|
|
459
|
-
// function to define props used within the scope of this component
|
|
460
546
|
static get properties() {
|
|
461
547
|
return {
|
|
462
|
-
|
|
463
|
-
accent: {
|
|
548
|
+
autofocus: {
|
|
464
549
|
type: Boolean,
|
|
465
550
|
reflect: true
|
|
466
551
|
},
|
|
467
|
-
|
|
468
|
-
type:
|
|
552
|
+
disabled: {
|
|
553
|
+
type: Boolean,
|
|
469
554
|
reflect: true
|
|
470
555
|
},
|
|
471
|
-
|
|
472
|
-
type:
|
|
556
|
+
secondary: {
|
|
557
|
+
type: Boolean,
|
|
473
558
|
reflect: true
|
|
474
559
|
},
|
|
475
|
-
|
|
476
|
-
type: Boolean
|
|
477
|
-
},
|
|
478
|
-
customSvg: {
|
|
479
|
-
type: Boolean
|
|
480
|
-
},
|
|
481
|
-
disabled: {
|
|
560
|
+
tertiary: {
|
|
482
561
|
type: Boolean,
|
|
483
562
|
reflect: true
|
|
484
563
|
},
|
|
485
|
-
|
|
564
|
+
fluid: {
|
|
486
565
|
type: Boolean,
|
|
487
566
|
reflect: true
|
|
488
567
|
},
|
|
489
|
-
|
|
568
|
+
iconOnly: {
|
|
490
569
|
type: Boolean,
|
|
491
570
|
reflect: true
|
|
492
571
|
},
|
|
493
|
-
|
|
572
|
+
loading: {
|
|
494
573
|
type: Boolean,
|
|
495
574
|
reflect: true
|
|
496
575
|
},
|
|
497
|
-
|
|
576
|
+
onDark: {
|
|
498
577
|
type: Boolean,
|
|
499
578
|
reflect: true
|
|
500
579
|
},
|
|
501
|
-
|
|
502
|
-
type:
|
|
580
|
+
rounded: {
|
|
581
|
+
type: Boolean,
|
|
503
582
|
reflect: true
|
|
504
583
|
},
|
|
505
|
-
|
|
584
|
+
slim: {
|
|
506
585
|
type: Boolean,
|
|
507
586
|
reflect: true
|
|
508
587
|
},
|
|
509
|
-
|
|
510
|
-
type:
|
|
588
|
+
arialabel: {
|
|
589
|
+
type: String,
|
|
511
590
|
reflect: true
|
|
512
591
|
},
|
|
513
|
-
|
|
514
|
-
type:
|
|
592
|
+
arialabelledby: {
|
|
593
|
+
type: String,
|
|
515
594
|
reflect: true
|
|
516
595
|
},
|
|
517
|
-
|
|
518
|
-
type:
|
|
596
|
+
title: {
|
|
597
|
+
type: String,
|
|
519
598
|
reflect: true
|
|
520
599
|
},
|
|
521
|
-
|
|
522
|
-
type:
|
|
600
|
+
type: {
|
|
601
|
+
type: String,
|
|
523
602
|
reflect: true
|
|
524
603
|
},
|
|
525
|
-
|
|
526
|
-
type: String
|
|
604
|
+
value: {
|
|
605
|
+
type: String,
|
|
606
|
+
reflect: true
|
|
527
607
|
},
|
|
528
|
-
|
|
529
|
-
type:
|
|
608
|
+
variant: {
|
|
609
|
+
type: String,
|
|
530
610
|
reflect: true
|
|
531
|
-
}
|
|
611
|
+
},
|
|
612
|
+
ready: { type: Boolean },
|
|
532
613
|
};
|
|
533
614
|
}
|
|
534
615
|
|
|
535
|
-
static get styles() {
|
|
536
|
-
return [
|
|
537
|
-
super.styles,
|
|
538
|
-
i$5`${tokensCss$3}`,
|
|
539
|
-
i$5`${styleCss$2}`,
|
|
540
|
-
i$5`${colorCss$3}`
|
|
541
|
-
];
|
|
542
|
-
}
|
|
543
|
-
|
|
544
616
|
/**
|
|
545
617
|
* This will register this element with the browser.
|
|
546
|
-
* @param {string} [name="auro-
|
|
618
|
+
* @param {string} [name="auro-button"] - The name of element that you want to register to.
|
|
547
619
|
*
|
|
548
620
|
* @example
|
|
549
|
-
*
|
|
621
|
+
* AuroButton.register("custom-button") // this will register this element to <custom-button/>
|
|
550
622
|
*
|
|
551
623
|
*/
|
|
552
|
-
static register(name = "auro-
|
|
553
|
-
AuroLibraryRuntimeUtils
|
|
624
|
+
static register(name = "auro-button") {
|
|
625
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroButton);
|
|
554
626
|
}
|
|
555
627
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
628
|
+
/**
|
|
629
|
+
* Internal method to apply focus to the HTML5 button.
|
|
630
|
+
* @private
|
|
631
|
+
* @returns {void}
|
|
632
|
+
*/
|
|
633
|
+
focus() {
|
|
634
|
+
this.renderRoot.querySelector('button').focus();
|
|
561
635
|
}
|
|
562
636
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
const classes = {
|
|
571
|
-
'label': this.label
|
|
572
|
-
};
|
|
573
|
-
|
|
574
|
-
return x`
|
|
575
|
-
<div
|
|
576
|
-
class="${e(classes)}"
|
|
577
|
-
title="${o(this.title || undefined)}">
|
|
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>
|
|
637
|
+
/**
|
|
638
|
+
* Marks the component as ready and sends event.
|
|
639
|
+
* @private
|
|
640
|
+
* @returns {void}
|
|
641
|
+
*/
|
|
642
|
+
notifyReady() {
|
|
643
|
+
this.ready = true;
|
|
586
644
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
645
|
+
this.dispatchEvent(new CustomEvent('auroButton-ready', {
|
|
646
|
+
bubbles: true,
|
|
647
|
+
cancelable: false,
|
|
648
|
+
composed: true,
|
|
649
|
+
}));
|
|
592
650
|
}
|
|
593
|
-
}
|
|
594
651
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
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)}`;
|
|
652
|
+
updated() {
|
|
653
|
+
// support the old `secondary` and `tertiary` attributes` that are deprecated
|
|
654
|
+
if (this.secondary) {
|
|
655
|
+
this.setAttribute('variant', 'secondary');
|
|
656
|
+
}
|
|
606
657
|
|
|
607
|
-
|
|
608
|
-
|
|
658
|
+
if (this.tertiary) {
|
|
659
|
+
this.setAttribute('variant', 'tertiary');
|
|
660
|
+
}
|
|
661
|
+
}
|
|
609
662
|
|
|
663
|
+
firstUpdated() {
|
|
664
|
+
this.notifyReady();
|
|
665
|
+
}
|
|
610
666
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
* @attr {Boolean} alignRight - If set, the trigger content will align right.
|
|
617
|
-
* @attr {Boolean} expanded - If set, the accordion is expanded.
|
|
618
|
-
* @attr {Boolean} emphasis - If set, emphasis styles will be applied to the auro-accordions.
|
|
619
|
-
* @attr {Boolean} grouped - Attribute will be set on accordion when it appears in an accordion group.
|
|
620
|
-
* @attr {String} chevron - Sets chevron variant option. Possible values are: `none`, `right`.
|
|
621
|
-
* @attr {String} variant - Sets accordion variant option. Possible values are: `sm`, `lg`.
|
|
622
|
-
* @slot - Default slot for the accordion content.
|
|
623
|
-
* @slot trigger - Defines the content of the trigger element.
|
|
624
|
-
* @csspart accordion - Apply CSS to Accordion wrapper.
|
|
625
|
-
* @csspart trigger - Apply CSS to trigger element.
|
|
626
|
-
* @csspart chevron - Apply CSS to chevron icon.
|
|
627
|
-
* @csspart content - Apply CSS to the accordion content.
|
|
628
|
-
* @event toggleExpanded - Notifies that the accordion has been expanded or closed.
|
|
629
|
-
*/
|
|
667
|
+
surfaceSubmitEvent() {
|
|
668
|
+
if (this.form) {
|
|
669
|
+
this.form.requestSubmit();
|
|
670
|
+
}
|
|
671
|
+
}
|
|
630
672
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
super();
|
|
673
|
+
get form() {
|
|
674
|
+
return this.internals ? this.internals.form : null;
|
|
675
|
+
}
|
|
635
676
|
|
|
636
|
-
|
|
677
|
+
render() {
|
|
678
|
+
const classes = {
|
|
679
|
+
'util_insetLg--squish': true,
|
|
680
|
+
'auro-button': true,
|
|
681
|
+
'auroButton': true,
|
|
682
|
+
'auro-button--rounded': this.rounded,
|
|
683
|
+
'auro-button--slim': this.slim,
|
|
684
|
+
'auro-button--iconOnly': this.iconOnly,
|
|
685
|
+
'auro-button--iconOnlySlim': this.iconOnly && this.slim,
|
|
686
|
+
'loading': this.loading
|
|
687
|
+
};
|
|
637
688
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
689
|
+
return u`
|
|
690
|
+
<button
|
|
691
|
+
part="button"
|
|
692
|
+
aria-label="${o(this.arialabel ? this.arialabel : undefined)}"
|
|
693
|
+
aria-labelledby="${o(this.arialabelledby ? this.arialabelledby : undefined)}"
|
|
694
|
+
?autofocus="${this.autofocus}"
|
|
695
|
+
class="${e(classes)}"
|
|
696
|
+
?disabled="${this.disabled || this.loading}"
|
|
697
|
+
?onDark="${this.onDark}"
|
|
698
|
+
title="${o(this.title ? this.title : undefined)}"
|
|
699
|
+
name="${o(this.name ? this.name : undefined)}"
|
|
700
|
+
type="${o(this.type ? this.type : undefined)}"
|
|
701
|
+
variant="${o(this.variant ? this.variant : undefined)}"
|
|
702
|
+
.value="${o(this.value ? this.value : undefined)}"
|
|
703
|
+
@click="${this.type === 'submit' ? this.surfaceSubmitEvent : undefined}"
|
|
704
|
+
>
|
|
705
|
+
${o(this.loading ? u`<${this.loaderTag} pulse part="loader"></${this.loaderTag}>` : undefined)}
|
|
642
706
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
707
|
+
<span class="contentWrapper">
|
|
708
|
+
<span class="textSlot" part="text">
|
|
709
|
+
${this.iconOnly ? undefined : u`<slot></slot>`}
|
|
710
|
+
</span>
|
|
647
711
|
|
|
648
|
-
|
|
712
|
+
<span part="icon">
|
|
713
|
+
<slot name="icon"></slot>
|
|
714
|
+
</span>
|
|
715
|
+
</span>
|
|
716
|
+
</button>
|
|
717
|
+
`;
|
|
649
718
|
}
|
|
719
|
+
}
|
|
650
720
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
// to understand how to use reflected attributes with your property settings.
|
|
654
|
-
static get properties() {
|
|
655
|
-
return {
|
|
656
|
-
// ...super.properties,
|
|
721
|
+
// Copyright (c) 2022 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
722
|
+
// See LICENSE in the project root for license information.
|
|
657
723
|
|
|
658
|
-
alignRight: {
|
|
659
|
-
type: Boolean,
|
|
660
|
-
reflect: true,
|
|
661
|
-
},
|
|
662
|
-
expanded: {
|
|
663
|
-
type: Boolean,
|
|
664
|
-
reflect: true,
|
|
665
|
-
},
|
|
666
|
-
emphasis: {
|
|
667
|
-
type: Boolean,
|
|
668
|
-
reflect: true
|
|
669
|
-
},
|
|
670
|
-
grouped: {
|
|
671
|
-
type: Boolean,
|
|
672
|
-
reflect: true
|
|
673
|
-
},
|
|
674
|
-
chevron: {
|
|
675
|
-
type: String,
|
|
676
|
-
reflect: true
|
|
677
|
-
},
|
|
678
|
-
variant: {
|
|
679
|
-
type: String,
|
|
680
|
-
reflect: true
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
724
|
|
|
725
|
+
// build the component class
|
|
726
|
+
class AuroAccordionButton extends AuroButton {
|
|
685
727
|
static get styles() {
|
|
686
728
|
return [
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
tokensCss$2
|
|
729
|
+
styleCssAuroButton,
|
|
730
|
+
styleButtonCss
|
|
690
731
|
];
|
|
691
732
|
}
|
|
692
733
|
|
|
693
734
|
/**
|
|
694
735
|
* This will register this element with the browser.
|
|
695
|
-
* @param {string} [name="auro-accordion"] - The name of element that you want to register to.
|
|
736
|
+
* @param {string} [name="auro-accordion-button"] - The name of element that you want to register to.
|
|
696
737
|
*
|
|
697
738
|
* @example
|
|
698
|
-
*
|
|
739
|
+
* AuroAccordionButton.register("custom-accordion-button") // this will register this element to <custom-accordion-button/>
|
|
699
740
|
*
|
|
700
741
|
*/
|
|
701
|
-
static register(name = "auro-accordion") {
|
|
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');
|
|
742
|
+
static register(name = "auro-accordion-button") {
|
|
743
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroAccordionButton);
|
|
708
744
|
}
|
|
745
|
+
}
|
|
709
746
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
* @private
|
|
713
|
-
* @param {string} svgContent - The imported svg icon.
|
|
714
|
-
* @returns {TemplateResult} - The html template for the icon.
|
|
715
|
-
*/
|
|
716
|
-
generateIconHtml(svgContent) {
|
|
717
|
-
const dom = new DOMParser().parseFromString(svgContent, 'text/html');
|
|
718
|
-
const svg = dom.body.firstChild;
|
|
747
|
+
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
748
|
+
// See LICENSE in the project root for license information.
|
|
719
749
|
|
|
720
|
-
svg.setAttribute('slot', 'svg');
|
|
721
750
|
|
|
722
|
-
|
|
723
|
-
|
|
751
|
+
/**
|
|
752
|
+
* @attr {Boolean} hidden - If present, the component will be hidden both visually and from screen readers
|
|
753
|
+
* @attr {Boolean} hiddenVisually - If present, the component will be hidden visually, but still read by screen readers
|
|
754
|
+
* @attr {Boolean} hiddenAudible - If present, the component will be hidden from screen readers, but seen visually
|
|
755
|
+
*/
|
|
724
756
|
|
|
725
|
-
|
|
726
|
-
* Toggles the visibility of the accordion content.
|
|
727
|
-
*/
|
|
728
|
-
toggle() {
|
|
729
|
-
this.expanded = !this.expanded;
|
|
757
|
+
class AuroElement extends r {
|
|
730
758
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
759
|
+
// function to define props used within the scope of this component
|
|
760
|
+
static get properties() {
|
|
761
|
+
return {
|
|
762
|
+
hidden: { type: Boolean,
|
|
763
|
+
reflect: true },
|
|
764
|
+
hiddenVisually: { type: Boolean,
|
|
765
|
+
reflect: true },
|
|
766
|
+
hiddenAudible: { type: Boolean,
|
|
767
|
+
reflect: true },
|
|
768
|
+
};
|
|
738
769
|
}
|
|
739
770
|
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
};
|
|
771
|
+
/**
|
|
772
|
+
* @private Function that determines state of aria-hidden
|
|
773
|
+
*/
|
|
774
|
+
hideAudible(value) {
|
|
775
|
+
if (value) {
|
|
776
|
+
return 'true'
|
|
777
|
+
}
|
|
748
778
|
|
|
749
|
-
return
|
|
750
|
-
<div class="componentWrapper" part="accordion">
|
|
751
|
-
<auro-accordion-button
|
|
752
|
-
?fluid="${this.emphasis}"
|
|
753
|
-
class="${e(buttonClasses)}"
|
|
754
|
-
id="accordionTrigger"
|
|
755
|
-
aria-controls="accordionContent"
|
|
756
|
-
aria-expanded="${this.expanded}"
|
|
757
|
-
@click="${this.toggle}"
|
|
758
|
-
part="trigger">
|
|
759
|
-
${this.chevron === 'none' ? undefined : u`
|
|
760
|
-
<${this.iconTag} slot="icon" customSvg customColor ?hidden="${!this.expanded}">
|
|
761
|
-
${this.generateIconHtml(chevronUp.svg)}
|
|
762
|
-
</${this.iconTag}>
|
|
763
|
-
<${this.iconTag} slot="icon" customSvg customColor ?hidden="${this.expanded}">
|
|
764
|
-
${this.generateIconHtml(chevronDown.svg)}
|
|
765
|
-
</${this.iconTag}>
|
|
766
|
-
`}
|
|
767
|
-
<slot name="trigger" part="triggerSlot"></slot>
|
|
768
|
-
</auro-accordion-button>
|
|
769
|
-
<div class="content" id="accordionContent" aria-labelledby="accordionTrigger" inert="${!this.expanded || E}" part="content">
|
|
770
|
-
<div class="contentWrapper" part="contentWrapper">
|
|
771
|
-
<slot></slot>
|
|
772
|
-
</div>
|
|
773
|
-
</div>
|
|
774
|
-
</div>
|
|
775
|
-
`;
|
|
779
|
+
return 'false'
|
|
776
780
|
}
|
|
777
781
|
}
|
|
778
782
|
|
|
779
|
-
|
|
783
|
+
var error = {"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>"};
|
|
784
|
+
|
|
785
|
+
/* eslint-disable no-underscore-dangle, jsdoc/no-undefined-types, jsdoc/require-param-description */
|
|
786
|
+
|
|
787
|
+
const _fetchMap = new Map();
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* A callback to parse Response body.
|
|
791
|
+
*
|
|
792
|
+
* @callback ResponseParser
|
|
793
|
+
* @param {Fetch.Response} response
|
|
794
|
+
* @returns {Promise}
|
|
795
|
+
*/
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* A minimal in-memory map to de-duplicate Fetch API media requests.
|
|
799
|
+
*
|
|
800
|
+
* @param {String} uri
|
|
801
|
+
* @param {Object} [options={}]
|
|
802
|
+
* @param {ResponseParser} [options.responseParser=(response) => response.text()]
|
|
803
|
+
* @returns {Promise}
|
|
804
|
+
*/
|
|
805
|
+
const cacheFetch = (uri, options = {}) => {
|
|
806
|
+
const responseParser = options.responseParser || ((response) => response.text());
|
|
807
|
+
if (!_fetchMap.has(uri)) {
|
|
808
|
+
_fetchMap.set(uri, fetch(uri).then(responseParser));
|
|
809
|
+
}
|
|
810
|
+
return _fetchMap.get(uri);
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
var styleCss$1 = i$5`: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}.componentWrapper{display:flex}.svgWrapper{height:var(--ds-auro-icon-size);width:var(--ds-auro-icon-size)}.labelWrapper{margin-left:var(--ds-size-50, 0.25rem);line-height:1.8}`;
|
|
814
|
+
|
|
815
|
+
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
780
816
|
// See LICENSE in the project root for license information.
|
|
781
817
|
|
|
782
818
|
|
|
783
819
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
784
820
|
/**
|
|
785
|
-
*
|
|
786
|
-
*
|
|
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.
|
|
821
|
+
* @attr {Boolean} onDark - Set value for on-dark version of auro-icon
|
|
822
|
+
* @slot - Hidden from visibility, used for a11y if icon description is needed
|
|
791
823
|
*/
|
|
792
824
|
|
|
793
825
|
// build the component class
|
|
794
|
-
class
|
|
826
|
+
class BaseIcon extends AuroElement {
|
|
795
827
|
constructor() {
|
|
796
828
|
super();
|
|
797
|
-
|
|
798
|
-
/**
|
|
799
|
-
* @private
|
|
800
|
-
*/
|
|
801
|
-
this.runtimeUtils = new AuroLibraryRuntimeUtils$3();
|
|
829
|
+
this.onDark = false;
|
|
802
830
|
}
|
|
803
831
|
|
|
804
|
-
//
|
|
805
|
-
// Be sure to review https://lit.dev/docs/components/properties/
|
|
806
|
-
// to understand how to use reflected attributes with your property settings.
|
|
832
|
+
// function to define props used within the scope of this component
|
|
807
833
|
static get properties() {
|
|
808
834
|
return {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
emphasis: {
|
|
835
|
+
...super.properties,
|
|
836
|
+
onDark: {
|
|
812
837
|
type: Boolean,
|
|
813
838
|
reflect: true
|
|
814
839
|
},
|
|
815
|
-
|
|
816
|
-
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* @private
|
|
843
|
+
*/
|
|
844
|
+
svg: {
|
|
845
|
+
attribute: false,
|
|
817
846
|
reflect: true
|
|
818
847
|
}
|
|
819
848
|
};
|
|
820
849
|
}
|
|
821
850
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
*
|
|
826
|
-
* @example
|
|
827
|
-
* AuroAccordionGroup.register("custom-accordion-button") // this will register this element to <custom-accordion-group/>
|
|
828
|
-
*
|
|
829
|
-
*/
|
|
830
|
-
static register(name = "auro-accordion-group") {
|
|
831
|
-
AuroLibraryRuntimeUtils$3.prototype.registerComponent(name, AuroAccordionGroup);
|
|
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>
|
|
851
|
+
static get styles() {
|
|
852
|
+
return i$5`
|
|
853
|
+
${styleCss$1}
|
|
899
854
|
`;
|
|
900
855
|
}
|
|
901
|
-
}
|
|
902
|
-
|
|
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
|
-
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
908
|
-
// See LICENSE in the project root for license information.
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
class AuroDependencyVersioning {
|
|
912
856
|
|
|
913
857
|
/**
|
|
914
|
-
*
|
|
858
|
+
* Async function to fetch requested icon from npm CDN.
|
|
915
859
|
* @private
|
|
916
|
-
* @param {string}
|
|
917
|
-
* @param {string}
|
|
918
|
-
* @returns {
|
|
919
|
-
*/
|
|
920
|
-
generateElementName(baseName, version) {
|
|
921
|
-
let result = baseName;
|
|
922
|
-
|
|
923
|
-
result += '-';
|
|
924
|
-
result += version.replace(/[.]/g, '_');
|
|
925
|
-
|
|
926
|
-
return result;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* Generates a unique string to be used for child auro element naming.
|
|
931
|
-
* @param {string} baseName - Defines the first part of the unique element name.
|
|
932
|
-
* @param {string} version - Version of the component that will be appended to the baseName.
|
|
933
|
-
* @returns {string} - Unique string to be used for naming.
|
|
860
|
+
* @param {string} category - Icon category.
|
|
861
|
+
* @param {string} name - Icon name.
|
|
862
|
+
* @returns {SVGElement} DOM - Ready HTML to be appended.
|
|
934
863
|
*/
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
const tag = i$1`${s(elementName)}`;
|
|
864
|
+
async fetchIcon(category, name) {
|
|
865
|
+
let iconHTML = '';
|
|
938
866
|
|
|
939
|
-
if (
|
|
940
|
-
|
|
867
|
+
if (category === 'logos') {
|
|
868
|
+
iconHTML = await cacheFetch(`${this.uri}/${category}/${name}.svg`);
|
|
869
|
+
} else {
|
|
870
|
+
iconHTML = await cacheFetch(`${this.uri}/icons/${category}/${name}.svg`);
|
|
941
871
|
}
|
|
942
872
|
|
|
943
|
-
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
948
|
-
// See LICENSE in the project root for license information.
|
|
949
|
-
|
|
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
|
-
|
|
956
|
-
/* eslint-disable jsdoc/require-param */
|
|
873
|
+
const dom = new DOMParser().parseFromString(iconHTML, 'text/html');
|
|
957
874
|
|
|
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
|
-
}
|
|
875
|
+
return dom.body.querySelector('svg');
|
|
968
876
|
}
|
|
969
877
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
closestElement(
|
|
975
|
-
selector, // selector like in .closest()
|
|
976
|
-
base = this, // extra functionality to skip a parent
|
|
977
|
-
__Closest = (el, found = el && el.closest(selector)) =>
|
|
978
|
-
!el || el === document || el === window
|
|
979
|
-
? null // standard .closest() returns null for non-found selectors also
|
|
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);
|
|
985
|
-
}
|
|
986
|
-
/* eslint-enable jsdoc/require-param */
|
|
878
|
+
// lifecycle function
|
|
879
|
+
async firstUpdated() {
|
|
880
|
+
if (!this.customSvg) {
|
|
881
|
+
const svg = await this.fetchIcon(this.category, this.name);
|
|
987
882
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
* @returns {void}
|
|
993
|
-
*/
|
|
994
|
-
handleComponentTagRename(elem, tagName) {
|
|
995
|
-
const tag = tagName.toLowerCase();
|
|
996
|
-
const elemTag = elem.tagName.toLowerCase();
|
|
883
|
+
if (svg) {
|
|
884
|
+
this.svg = svg;
|
|
885
|
+
} else if (!svg) {
|
|
886
|
+
const penDOM = new DOMParser().parseFromString(error.svg, 'text/html');
|
|
997
887
|
|
|
998
|
-
|
|
999
|
-
|
|
888
|
+
this.svg = penDOM.body.firstChild;
|
|
889
|
+
}
|
|
1000
890
|
}
|
|
1001
891
|
}
|
|
892
|
+
}
|
|
1002
893
|
|
|
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
|
-
|
|
1013
|
-
return elemTag === tag || elem.hasAttribute(tag);
|
|
1014
|
-
}
|
|
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}`;
|
|
894
|
+
var tokensCss$1 = i$5`:host{--ds-auro-icon-color:var(--ds-color-icon-primary-default, #676767);--ds-auro-icon-size:var(--ds-size-300, 1.5rem)}`;
|
|
1018
895
|
|
|
1019
|
-
var
|
|
896
|
+
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)}`;
|
|
1020
897
|
|
|
1021
|
-
// Copyright (c) Alaska
|
|
898
|
+
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1022
899
|
// See LICENSE in the project root for license information.
|
|
1023
900
|
|
|
1024
|
-
// ---------------------------------------------------------------------
|
|
1025
|
-
|
|
1026
|
-
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
1027
|
-
|
|
1028
|
-
class AuroLibraryRuntimeUtils {
|
|
1029
901
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
* This will register a new custom element with the browser.
|
|
1034
|
-
* @param {String} name - The name of the custom element.
|
|
1035
|
-
* @param {Object} componentClass - The class to register as a custom element.
|
|
1036
|
-
* @returns {void}
|
|
1037
|
-
*/
|
|
1038
|
-
registerComponent(name, componentClass) {
|
|
1039
|
-
if (!customElements.get(name)) {
|
|
1040
|
-
customElements.define(name, class extends componentClass {});
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
902
|
+
class AuroIcon extends BaseIcon {
|
|
903
|
+
constructor() {
|
|
904
|
+
super();
|
|
1043
905
|
|
|
1044
|
-
|
|
1045
|
-
* Finds and returns the closest HTML Element based on a selector.
|
|
1046
|
-
* @returns {void}
|
|
1047
|
-
*/
|
|
1048
|
-
closestElement(
|
|
1049
|
-
selector, // selector like in .closest()
|
|
1050
|
-
base = this, // extra functionality to skip a parent
|
|
1051
|
-
__Closest = (el, found = el && el.closest(selector)) =>
|
|
1052
|
-
!el || el === document || el === window
|
|
1053
|
-
? null // standard .closest() returns null for non-found selectors also
|
|
1054
|
-
: found
|
|
1055
|
-
? found // found a selector INside this element
|
|
1056
|
-
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
1057
|
-
) {
|
|
1058
|
-
return __Closest(base);
|
|
906
|
+
this.privateDefaults();
|
|
1059
907
|
}
|
|
1060
|
-
/* eslint-enable jsdoc/require-param */
|
|
1061
908
|
|
|
1062
909
|
/**
|
|
1063
|
-
*
|
|
1064
|
-
* @
|
|
1065
|
-
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
910
|
+
* Internal Defaults.
|
|
911
|
+
* @private
|
|
1066
912
|
* @returns {void}
|
|
1067
913
|
*/
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
const elemTag = elem.tagName.toLowerCase();
|
|
1086
|
-
|
|
1087
|
-
return elemTag === tag || elem.hasAttribute(tag);
|
|
914
|
+
privateDefaults() {
|
|
915
|
+
this.accent = false;
|
|
916
|
+
this.customColor = false;
|
|
917
|
+
this.customSvg = false;
|
|
918
|
+
this.disabled = false;
|
|
919
|
+
this.emphasis = false;
|
|
920
|
+
this.error = false;
|
|
921
|
+
this.info = false;
|
|
922
|
+
this.label = false;
|
|
923
|
+
this.primary = false;
|
|
924
|
+
this.secondary = false;
|
|
925
|
+
this.subtle = false;
|
|
926
|
+
this.success = false;
|
|
927
|
+
this.tertiary = false;
|
|
928
|
+
this.warning = false;
|
|
929
|
+
this.uri = 'https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist';
|
|
930
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
1088
931
|
}
|
|
1089
|
-
}
|
|
1090
932
|
|
|
1091
|
-
|
|
933
|
+
// function to define props used within the scope of this component
|
|
934
|
+
static get properties() {
|
|
935
|
+
return {
|
|
936
|
+
...super.properties,
|
|
1092
937
|
|
|
1093
|
-
|
|
938
|
+
/**
|
|
939
|
+
* Sets the icon to use the accent style.
|
|
940
|
+
*/
|
|
941
|
+
accent: {
|
|
942
|
+
type: Boolean,
|
|
943
|
+
reflect: true
|
|
944
|
+
},
|
|
1094
945
|
|
|
1095
|
-
|
|
946
|
+
/**
|
|
947
|
+
* Set aria-hidden value. Default is `true`. Option is `false`.
|
|
948
|
+
*/
|
|
949
|
+
ariaHidden: {
|
|
950
|
+
type: String,
|
|
951
|
+
reflect: true
|
|
952
|
+
},
|
|
1096
953
|
|
|
1097
|
-
|
|
1098
|
-
|
|
954
|
+
/**
|
|
955
|
+
* The category of the icon you are looking for. See https://auro.alaskaair.com/icons/usage.
|
|
956
|
+
*/
|
|
957
|
+
category: {
|
|
958
|
+
type: String,
|
|
959
|
+
reflect: true
|
|
960
|
+
},
|
|
1099
961
|
|
|
962
|
+
/**
|
|
963
|
+
* Allows custom color to be set.
|
|
964
|
+
*/
|
|
965
|
+
customColor: {
|
|
966
|
+
type: Boolean
|
|
967
|
+
},
|
|
1100
968
|
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
* @attr {Boolean} laser - sets loader type
|
|
1108
|
-
* @attr {Boolean} orbit - sets loader type
|
|
1109
|
-
* @attr {Boolean} white - sets color of loader to white
|
|
1110
|
-
* @attr {Boolean} ondark - sets color of loader to auro-color-ui-default-on-dark
|
|
1111
|
-
* @attr {Boolean} onlight - sets color of loader to auro-color-ui-default-on-light
|
|
1112
|
-
* @attr {Boolean} xs - sets size to extra small
|
|
1113
|
-
* @attr {Boolean} sm - sets size to small
|
|
1114
|
-
* @attr {Boolean} md - sets size to medium
|
|
1115
|
-
* @attr {Boolean} lg - sets size to large
|
|
1116
|
-
* @csspart element - apply style to adjust speed of animation
|
|
1117
|
-
*/
|
|
969
|
+
/**
|
|
970
|
+
* When true, auro-icon will render a custom SVG inside the default slot.
|
|
971
|
+
*/
|
|
972
|
+
customSvg: {
|
|
973
|
+
type: Boolean
|
|
974
|
+
},
|
|
1118
975
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
976
|
+
/**
|
|
977
|
+
* Sets the icon to use the disabled style.
|
|
978
|
+
*/
|
|
979
|
+
disabled: {
|
|
980
|
+
type: Boolean,
|
|
981
|
+
reflect: true
|
|
982
|
+
},
|
|
1123
983
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
984
|
+
/**
|
|
985
|
+
* Sets the icon to use the emphasis style.
|
|
986
|
+
*/
|
|
987
|
+
emphasis: {
|
|
988
|
+
type: Boolean,
|
|
989
|
+
reflect: true
|
|
990
|
+
},
|
|
1128
991
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
992
|
+
/**
|
|
993
|
+
* Sets the icon to use the error style.
|
|
994
|
+
*/
|
|
995
|
+
error: {
|
|
996
|
+
type: Boolean,
|
|
997
|
+
reflect: true
|
|
998
|
+
},
|
|
1133
999
|
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1000
|
+
/**
|
|
1001
|
+
* Sets the icon to use the info style.
|
|
1002
|
+
*/
|
|
1003
|
+
info: {
|
|
1004
|
+
type: Boolean,
|
|
1005
|
+
reflect: true
|
|
1006
|
+
},
|
|
1138
1007
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1008
|
+
/**
|
|
1009
|
+
* Exposes content in slot as icon label.
|
|
1010
|
+
*/
|
|
1011
|
+
label: {
|
|
1012
|
+
type: Boolean,
|
|
1013
|
+
reflect: true
|
|
1014
|
+
},
|
|
1143
1015
|
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1016
|
+
/**
|
|
1017
|
+
* The name of the icon you are looking for without the file extension. See https://auro.alaskaair.com/icons/usage.
|
|
1018
|
+
*/
|
|
1019
|
+
name: {
|
|
1020
|
+
type: String,
|
|
1021
|
+
reflect: true
|
|
1022
|
+
},
|
|
1149
1023
|
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1024
|
+
/**
|
|
1025
|
+
* DEPRECATED: Sets the icon to use the baseline primary icon style.
|
|
1026
|
+
*/
|
|
1027
|
+
primary: {
|
|
1154
1028
|
type: Boolean,
|
|
1155
1029
|
reflect: true
|
|
1156
1030
|
},
|
|
1157
|
-
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Sets the icon to use the secondary style.
|
|
1034
|
+
*/
|
|
1035
|
+
secondary: {
|
|
1158
1036
|
type: Boolean,
|
|
1159
1037
|
reflect: true
|
|
1160
1038
|
},
|
|
1161
|
-
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Sets the icon to use the subtle style.
|
|
1042
|
+
*/
|
|
1043
|
+
subtle: {
|
|
1162
1044
|
type: Boolean,
|
|
1163
1045
|
reflect: true
|
|
1164
1046
|
},
|
|
1165
|
-
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* Sets the icon to use the success style.
|
|
1050
|
+
*/
|
|
1051
|
+
success: {
|
|
1052
|
+
type: Boolean,
|
|
1053
|
+
reflect: true
|
|
1054
|
+
},
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Sets the icon to use the tertiary style.
|
|
1058
|
+
*/
|
|
1059
|
+
tertiary: {
|
|
1060
|
+
type: Boolean,
|
|
1061
|
+
reflect: true
|
|
1062
|
+
},
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Sets the icon to use the warning style.
|
|
1066
|
+
*/
|
|
1067
|
+
warning: {
|
|
1166
1068
|
type: Boolean,
|
|
1167
1069
|
reflect: true
|
|
1168
1070
|
}
|
|
@@ -1171,335 +1073,302 @@ class AuroLoader extends r {
|
|
|
1171
1073
|
|
|
1172
1074
|
static get styles() {
|
|
1173
1075
|
return [
|
|
1174
|
-
|
|
1175
|
-
i$5`${
|
|
1176
|
-
i$5`${
|
|
1076
|
+
super.styles,
|
|
1077
|
+
i$5`${tokensCss$1}`,
|
|
1078
|
+
i$5`${styleCss$1}`,
|
|
1079
|
+
i$5`${colorCss$1}`
|
|
1177
1080
|
];
|
|
1178
1081
|
}
|
|
1179
1082
|
|
|
1180
1083
|
/**
|
|
1181
1084
|
* This will register this element with the browser.
|
|
1182
|
-
* @param {string} [name="auro-
|
|
1085
|
+
* @param {string} [name="auro-icon"] - The name of element that you want to register to.
|
|
1183
1086
|
*
|
|
1184
1087
|
* @example
|
|
1185
|
-
*
|
|
1088
|
+
* AuroIcon.register("custom-icon") // this will register this element to <custom-icon/>
|
|
1186
1089
|
*
|
|
1187
1090
|
*/
|
|
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');
|
|
1091
|
+
static register(name = "auro-icon") {
|
|
1092
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroIcon);
|
|
1195
1093
|
}
|
|
1196
1094
|
|
|
1197
1095
|
connectedCallback() {
|
|
1198
1096
|
super.connectedCallback();
|
|
1097
|
+
|
|
1098
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
1099
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-icon');
|
|
1199
1100
|
}
|
|
1200
1101
|
|
|
1201
1102
|
/**
|
|
1202
1103
|
* @private
|
|
1203
|
-
* @returns {
|
|
1104
|
+
* @returns {void} Exposes CSS parts for styling from parent components.
|
|
1204
1105
|
*/
|
|
1205
|
-
|
|
1206
|
-
|
|
1106
|
+
exposeCssParts() {
|
|
1107
|
+
this.setAttribute('exportparts', 'svg:iconSvg');
|
|
1108
|
+
}
|
|
1207
1109
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
} else if (this.ringworm) {
|
|
1211
|
-
nodes = Array.from(Array(0).keys());
|
|
1212
|
-
}
|
|
1110
|
+
async firstUpdated() {
|
|
1111
|
+
await super.firstUpdated();
|
|
1213
1112
|
|
|
1214
|
-
|
|
1215
|
-
|
|
1113
|
+
// Removes the SVG description for screenreader if ariaHidden is set to true
|
|
1114
|
+
if (!this.hasAttribute('ariaHidden') && this.svg) {
|
|
1115
|
+
const svgDesc = this.svg.querySelector('desc');
|
|
1216
1116
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1117
|
+
if (svgDesc) {
|
|
1118
|
+
svgDesc.remove();
|
|
1119
|
+
this.svg.removeAttribute('aria-labelledby');
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1219
1123
|
|
|
1220
1124
|
// function that renders the HTML and CSS into the scope of the component
|
|
1221
1125
|
render() {
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1126
|
+
const labelClasses = {
|
|
1127
|
+
'labelWrapper': true,
|
|
1128
|
+
'util_displayHiddenVisually': !this.label
|
|
1129
|
+
};
|
|
1226
1130
|
|
|
1227
|
-
|
|
1131
|
+
const svgClasses = {
|
|
1132
|
+
'svgWrapper': true,
|
|
1133
|
+
};
|
|
1228
1134
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1135
|
+
return x`
|
|
1136
|
+
<div class="componentWrapper">
|
|
1137
|
+
<div
|
|
1138
|
+
class="${e(svgClasses)}"
|
|
1139
|
+
title="${o(this.title || undefined)}">
|
|
1140
|
+
<span aria-hidden="${o(this.ariaHidden || true)}" part="svg">
|
|
1141
|
+
${this.customSvg ? x`
|
|
1142
|
+
<slot name="svg"></slot>
|
|
1143
|
+
` : x`
|
|
1144
|
+
${this.svg}
|
|
1145
|
+
`
|
|
1146
|
+
}
|
|
1147
|
+
</span>
|
|
1148
|
+
</div>
|
|
1149
|
+
|
|
1150
|
+
<div class="${e(labelClasses)}">
|
|
1151
|
+
<slot></slot>
|
|
1152
|
+
</div>
|
|
1153
|
+
</div>
|
|
1235
1154
|
`;
|
|
1236
1155
|
}
|
|
1237
1156
|
}
|
|
1238
1157
|
|
|
1239
|
-
var
|
|
1158
|
+
var iconVersion = '6.1.9';
|
|
1240
1159
|
|
|
1241
|
-
|
|
1160
|
+
var chevronUp = {"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>"};
|
|
1161
|
+
|
|
1162
|
+
var chevronDown = {"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>"};
|
|
1163
|
+
|
|
1164
|
+
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}`;
|
|
1165
|
+
|
|
1166
|
+
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)}`;
|
|
1167
|
+
|
|
1168
|
+
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)}`;
|
|
1169
|
+
|
|
1170
|
+
// Copyright (c) 2023 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1242
1171
|
// See LICENSE in the project root for license information.
|
|
1243
1172
|
|
|
1244
1173
|
|
|
1174
|
+
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
1245
1175
|
/**
|
|
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.
|
|
1176
|
+
* Auro-accordion provides users a way to have collapsible content on a page.
|
|
1177
|
+
* Use auro-accordion-group if you want to have auto closing accordion components when others are selected.
|
|
1178
|
+
*
|
|
1179
|
+
* @attr {Boolean} alignRight - If set, the trigger content will align right.
|
|
1180
|
+
* @attr {Boolean} expanded - If set, the accordion is expanded.
|
|
1181
|
+
* @attr {Boolean} emphasis - If set, emphasis styles will be applied to the auro-accordions.
|
|
1182
|
+
* @attr {Boolean} grouped - Attribute will be set on accordion when it appears in an accordion group.
|
|
1183
|
+
* @attr {String} chevron - Sets chevron variant option. Possible values are: `none`, `right`.
|
|
1184
|
+
* @attr {String} variant - Sets accordion variant option. Possible values are: `sm`, `lg`.
|
|
1185
|
+
* @slot - Default slot for the accordion content.
|
|
1186
|
+
* @slot trigger - Defines the content of the trigger element.
|
|
1187
|
+
* @csspart accordion - Apply CSS to Accordion wrapper.
|
|
1188
|
+
* @csspart trigger - Apply CSS to trigger element.
|
|
1189
|
+
* @csspart chevron - Apply CSS to chevron icon.
|
|
1190
|
+
* @csspart content - Apply CSS to the accordion content.
|
|
1191
|
+
* @event toggleExpanded - Notifies that the accordion has been expanded or closed.
|
|
1271
1192
|
*/
|
|
1272
1193
|
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
class AuroButton extends r {
|
|
1276
|
-
|
|
1194
|
+
// build the component class
|
|
1195
|
+
class AuroAccordion extends r {
|
|
1277
1196
|
constructor() {
|
|
1278
1197
|
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;
|
|
1198
|
+
|
|
1199
|
+
const versioning = new AuroDependencyVersioning();
|
|
1290
1200
|
|
|
1291
1201
|
/**
|
|
1292
|
-
*
|
|
1202
|
+
* @private
|
|
1293
1203
|
*/
|
|
1294
|
-
|
|
1204
|
+
this.iconTag = versioning.generateTag('auro-icon', iconVersion, AuroIcon);
|
|
1295
1205
|
|
|
1296
1206
|
/**
|
|
1297
1207
|
* @private
|
|
1298
1208
|
*/
|
|
1299
|
-
this.
|
|
1300
|
-
}
|
|
1209
|
+
this.buttonNameHash = this.generateRandomLetters(4); //eslint-disable-line
|
|
1301
1210
|
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1211
|
+
/**
|
|
1212
|
+
* @private
|
|
1213
|
+
*/
|
|
1214
|
+
this.buttonTag = versioning.generateTag('auro-accordion-button', this.buttonNameHash, AuroAccordionButton);
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* @private
|
|
1218
|
+
*/
|
|
1219
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
1220
|
+
|
|
1221
|
+
this.expanded = false;
|
|
1308
1222
|
}
|
|
1309
1223
|
|
|
1224
|
+
// This function is to define props used within the scope of this component
|
|
1225
|
+
// Be sure to review https://lit.dev/docs/components/properties/
|
|
1226
|
+
// to understand how to use reflected attributes with your property settings.
|
|
1310
1227
|
static get properties() {
|
|
1311
1228
|
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: {
|
|
1229
|
+
// ...super.properties,
|
|
1230
|
+
|
|
1231
|
+
alignRight: {
|
|
1337
1232
|
type: Boolean,
|
|
1338
|
-
reflect: true
|
|
1233
|
+
reflect: true,
|
|
1339
1234
|
},
|
|
1340
|
-
|
|
1235
|
+
expanded: {
|
|
1341
1236
|
type: Boolean,
|
|
1342
|
-
reflect: true
|
|
1237
|
+
reflect: true,
|
|
1343
1238
|
},
|
|
1344
|
-
|
|
1239
|
+
emphasis: {
|
|
1345
1240
|
type: Boolean,
|
|
1346
1241
|
reflect: true
|
|
1347
1242
|
},
|
|
1348
|
-
|
|
1243
|
+
grouped: {
|
|
1349
1244
|
type: Boolean,
|
|
1350
1245
|
reflect: true
|
|
1351
1246
|
},
|
|
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: {
|
|
1247
|
+
chevron: {
|
|
1369
1248
|
type: String,
|
|
1370
1249
|
reflect: true
|
|
1371
1250
|
},
|
|
1372
|
-
variant:
|
|
1251
|
+
variant: {
|
|
1373
1252
|
type: String,
|
|
1374
1253
|
reflect: true
|
|
1375
|
-
}
|
|
1376
|
-
ready: { type: Boolean },
|
|
1254
|
+
}
|
|
1377
1255
|
};
|
|
1378
1256
|
}
|
|
1379
1257
|
|
|
1258
|
+
static get styles() {
|
|
1259
|
+
return [
|
|
1260
|
+
colorCss,
|
|
1261
|
+
styleCss,
|
|
1262
|
+
tokensCss
|
|
1263
|
+
];
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1380
1266
|
/**
|
|
1381
1267
|
* This will register this element with the browser.
|
|
1382
|
-
* @param {string} [name="auro-
|
|
1268
|
+
* @param {string} [name="auro-accordion"] - The name of element that you want to register to.
|
|
1383
1269
|
*
|
|
1384
1270
|
* @example
|
|
1385
|
-
*
|
|
1271
|
+
* AuroAccordion.register("custom-accordion") // this will register this element to <custom-accordion/>
|
|
1386
1272
|
*
|
|
1387
1273
|
*/
|
|
1388
|
-
static register(name = "auro-
|
|
1389
|
-
|
|
1274
|
+
static register(name = "auro-accordion") {
|
|
1275
|
+
const nameGroup = `${name}-group`;
|
|
1276
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroAccordion);
|
|
1277
|
+
AuroAccordionGroup.register(nameGroup);
|
|
1390
1278
|
}
|
|
1391
1279
|
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
* @returns {void}
|
|
1396
|
-
*/
|
|
1397
|
-
focus() {
|
|
1398
|
-
this.renderRoot.querySelector('button').focus();
|
|
1280
|
+
firstUpdated() {
|
|
1281
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
1282
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-accordion');
|
|
1399
1283
|
}
|
|
1400
1284
|
|
|
1401
1285
|
/**
|
|
1402
|
-
*
|
|
1286
|
+
* Internal function to generate the HTML for the icon to use.
|
|
1403
1287
|
* @private
|
|
1404
|
-
* @
|
|
1288
|
+
* @param {string} svgContent - The imported svg icon.
|
|
1289
|
+
* @returns {TemplateResult} - The html template for the icon.
|
|
1405
1290
|
*/
|
|
1406
|
-
|
|
1407
|
-
|
|
1291
|
+
generateIconHtml(svgContent) {
|
|
1292
|
+
const dom = new DOMParser().parseFromString(svgContent, 'text/html');
|
|
1293
|
+
const svg = dom.body.firstChild;
|
|
1408
1294
|
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
composed: true,
|
|
1413
|
-
}));
|
|
1295
|
+
svg.setAttribute('slot', 'svg');
|
|
1296
|
+
|
|
1297
|
+
return u`${svg}`;
|
|
1414
1298
|
}
|
|
1415
1299
|
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1300
|
+
/**
|
|
1301
|
+
* Generates a random string of letters.
|
|
1302
|
+
* @private
|
|
1303
|
+
* @param {number} length - The number of characters to generate in the string.
|
|
1304
|
+
* @returns {string} - The generated string.
|
|
1305
|
+
*/
|
|
1306
|
+
generateRandomLetters(length) {
|
|
1307
|
+
let result = '';
|
|
1308
|
+
const characters = 'abcdefghijklmnopqrstuvwxyz';
|
|
1309
|
+
const charactersLength = characters.length;
|
|
1310
|
+
for (let index = 0; index < length; index += 1) {
|
|
1311
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
1420
1312
|
}
|
|
1421
1313
|
|
|
1422
|
-
|
|
1423
|
-
this.setAttribute('variant', 'tertiary');
|
|
1424
|
-
}
|
|
1314
|
+
return result;
|
|
1425
1315
|
}
|
|
1426
1316
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1317
|
+
/**
|
|
1318
|
+
* Toggles the visibility of the accordion content.
|
|
1319
|
+
*/
|
|
1320
|
+
toggle() {
|
|
1321
|
+
this.expanded = !this.expanded;
|
|
1322
|
+
|
|
1323
|
+
this.dispatchEvent(new CustomEvent('toggleExpanded', {
|
|
1324
|
+
bubbles: true,
|
|
1325
|
+
composed: true,
|
|
1326
|
+
detail: {
|
|
1327
|
+
expanded: this.expanded
|
|
1328
|
+
}
|
|
1329
|
+
}));
|
|
1429
1330
|
}
|
|
1430
1331
|
|
|
1332
|
+
// function that renders the HTML and CSS into the scope of the component
|
|
1431
1333
|
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
|
|
1334
|
+
const buttonClasses = {
|
|
1335
|
+
"trigger": true,
|
|
1336
|
+
"iconRight": this.getAttribute('chevron') === 'right',
|
|
1337
|
+
"sm": this.getAttribute('variant') === 'sm',
|
|
1338
|
+
"lg": this.getAttribute('variant') === 'lg',
|
|
1440
1339
|
};
|
|
1441
1340
|
|
|
1442
1341
|
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>
|
|
1342
|
+
<div class="componentWrapper" part="accordion">
|
|
1343
|
+
<${this.buttonTag}
|
|
1344
|
+
?fluid="${this.emphasis}"
|
|
1345
|
+
class="${e(buttonClasses)}"
|
|
1346
|
+
id="accordionTrigger"
|
|
1347
|
+
aria-controls="accordionContent"
|
|
1348
|
+
aria-expanded="${this.expanded}"
|
|
1349
|
+
@click="${this.toggle}"
|
|
1350
|
+
part="trigger">
|
|
1351
|
+
${this.chevron === 'none' ? undefined : u`
|
|
1352
|
+
<${this.iconTag} slot="icon" customSvg customColor ?hidden="${!this.expanded}">
|
|
1353
|
+
${this.generateIconHtml(chevronUp.svg)}
|
|
1354
|
+
</${this.iconTag}>
|
|
1355
|
+
<${this.iconTag} slot="icon" customSvg customColor ?hidden="${this.expanded}">
|
|
1356
|
+
${this.generateIconHtml(chevronDown.svg)}
|
|
1357
|
+
</${this.iconTag}>
|
|
1358
|
+
`}
|
|
1359
|
+
<slot name="trigger" part="triggerSlot"></slot>
|
|
1360
|
+
</${this.buttonTag}>
|
|
1361
|
+
<div class="content" id="accordionContent" aria-labelledby="accordionTrigger" inert="${!this.expanded || E}" part="content">
|
|
1362
|
+
<div class="contentWrapper" part="contentWrapper">
|
|
1363
|
+
<slot></slot>
|
|
1364
|
+
</div>
|
|
1365
|
+
</div>
|
|
1366
|
+
</div>
|
|
1470
1367
|
`;
|
|
1471
1368
|
}
|
|
1472
1369
|
}
|
|
1473
1370
|
|
|
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
1371
|
AuroAccordion.register();
|
|
1501
|
-
AuroAccordionGroup.register();
|
|
1502
|
-
AuroAccordionButton.register();
|
|
1503
1372
|
|
|
1504
1373
|
function initExamples(initCount) {
|
|
1505
1374
|
initCount = initCount || 0;
|