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