UNPKG

@aurodesignsystem/auro-nav

Version:
718 lines (602 loc) 50.5 kB
/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ 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$3=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=!0,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$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$3=t=>new n$2("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===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$2(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; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const{is:i$2,defineProperty:e$3,getOwnPropertyDescriptor:r$2,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$2,getPrototypeOf:n$1}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1: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$2(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.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=!1),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:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$1(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=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$2(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 !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,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(!0),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&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).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$1;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);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;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)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;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=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}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$1.reactiveElementVersions??=[]).push("2.0.4"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t$1=globalThis,i$1=t$1.trustedTypes,s$1=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$2="$lit$",h=`lit$${(Math.random()+"").slice(9)}$`,o$1="?"+h,n=`<${o$1}>`,r$1=document,l=()=>r$1.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(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),w=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),A=new WeakMap,E=r$1.createTreeWalker(r$1,129);function C(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const P=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":"",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:d>=0?(o.push(a),s.slice(0,d)+e$2+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [C(t,l+(t[s]||"<?>")+(2===i?"</svg>":"")),o]};class V{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]=P(t,s);if(this.el=V.createElement(f,n),E.currentNode=this.el.content,2===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=E.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]?k:"?"===e[1]?H:"@"===e[1]?I:R}),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$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),E.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$1)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 N(t,i,s=t,e){if(i===w)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?.(!1),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=N(t,h._$AS(t,i.values),h,e)),i}class S{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,!0);E.currentNode=e;let h=E.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new M(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new L(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=E.nextNode(),o++);}return E.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 M{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}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=N(this,t,i),c(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==w&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t));}_(t){this._$AH!==T&&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=V.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new S(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 V(t)),i}k(t){a(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 M(this.S(l()),this.S(l()),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?.(!1,!0,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 R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=T,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=T;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=N(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==w,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=N(this,e[s+n],i,n),r===w&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===T?t=T:t!==T&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class k extends R{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===T?void 0:t;}}class H extends R{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==T);}}class I extends R{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=N(this,t,i,0)??T)===w)return;const s=this._$AH,e=t===T&&s!==T||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==T&&(s===T||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 L{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){N(this,t);}}const Z=t$1.litHtmlPolyfillSupport;Z?.(V,M),(t$1.litHtmlVersions??=[]).push("3.1.2");const j=(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 M(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */class s 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 i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=j(i,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return w}}s._$litElement$=!0,s[("finalized")]=!0,globalThis.litElementHydrateSupport?.({LitElement:s});const r=globalThis.litElementPolyfillSupport;r?.({LitElement:s});(globalThis.litElementVersions??=[]).push("4.0.4"); var styleBreadcrumbCss = i$3`*,*: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{display:inline-flex}:host .hyperlink:focus,:host .hyperlink:hover{text-decoration:underline}:host ::slotted(auro-icon[name=chevron-left]){display:none}:host:after{position:relative;display:inline-block;width:var(--ds-size-300, 1.5rem);height:var(--ds-size-300, 1.5rem);top:-1px;line-height:var(--ds-size-300, 1.5rem);margin-right:5px;margin-left:var(--ds-size-100, 0.5rem);background-color:var(--ds-color-icon-primary-default, #626b79);content:"";-webkit-mask-box-image:url("https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist/icons/interface/chevron-right.svg");mask-image:url("https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist/icons/interface/chevron-right.svg");mask-repeat:no-repeat}:host a{color:var(--ds-color-ui-default-default, #0074c8);text-decoration:none}@media screen and (max-width: 576px){:host ::slotted(auro-icon[name=chevron-left]){display:inline-block}:host ::slotted(auro-icon[name=home-stroke]){display:none}:host:after{content:unset}}:host(:not(:first-of-type)) ::slotted(auro-icon[name=home-stroke]){display:none}:host(:last-of-type){color:var(--ds-color-text-secondary-default, #626b79)}:host(:last-of-type):after{content:unset}@media screen and (max-width: 576px){:host(:not(:nth-last-of-type(2))){display:none}}`; var styleCssAuroHyperlink = i$3`*,*: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{display:inline-block}:host([type=nav]) .hyperlink:focus{text-decoration:underline}:host([fluid][type=cta]),:host([fluid=true][type=cta]){width:100%}:host([fluid][type=cta]) .hyperlink--cta,:host([fluid=true][type=cta]) .hyperlink--cta{width:100%}.hyperlink{transition:all .15s ease;color:var(--ds-color-ui-default-default, #0074c8);text-decoration:underline}.hyperlink:focus{text-decoration:none}.hyperlink:visited{color:var(--ds-color-ui-default-default, #0074c8)}.hyperlink:focus-visible{background-color:var(--ds-color-ui-default-default, #0074c8);color:var(--ds-color-text-primary-inverse, #ffffff);outline:var(--ds-color-ui-default-default, #0074c8) solid var(--ds-size-50, 0.25rem);outline-offset:unset}.hyperlink:focus-visible:hover{color:var(--ds-color-text-primary-inverse, #ffffff)}@media(hover: hover){.hyperlink:hover{color:var(--ds-color-ui-hover-default, #054687);text-decoration:none}.hyperlink--nav:hover{text-decoration:underline}.hyperlink--ondark:hover{color:var(--ds-color-ui-hover-inverse, #5de3f7)}}.hyperlink--button{display:inline-block;padding:0 var(--ds-size-200, 1rem);text-decoration:none;color:var(--ds-color-text-link-default, #0074c8);border:1px solid transparent;line-height:var(--ds-unitless-scale-300, 3)}:host(:not(.is-touching)) .hyperlink--button:hover{cursor:pointer;text-decoration:underline;color:var(--ds-color-ui-hover-default, #054687)}.hyperlink--nav{display:block;text-decoration:none}.hyperlink--cta{display:block;padding:0 var(--ds-size-200, 1rem);text-decoration:none;color:var(--ds-color-text-link-default, #0074c8);border:1px solid transparent;line-height:var(--ds-unitless-scale-300, 3);border:1px solid var(--ds-color-ui-default-default, #0074c8);border-radius:var(--ds-border-radius, 0.375rem);background-color:var(--ds-color-ui-default-default, #0074c8);color:var(--ds-color-text-primary-inverse, #ffffff);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);min-height:var(--ds-size-600, 3rem);max-height:var(--ds-size-600, 3rem);text-align:center;vertical-align:middle}:host(:not(.is-touching)) .hyperlink--cta:hover{cursor:pointer;text-decoration:underline;color:var(--ds-color-ui-hover-default, #054687)}.hyperlink--cta:active{transform:scale(0.95)}:host(:not(.is-touching)) .hyperlink--cta:hover{border:1px solid var(--ds-color-ui-hover-default, #054687);background-image:linear-gradient(var(--ds-color-ui-hover-default, #054687), var(--ds-color-ui-hover-default, #054687));color:var(--ds-color-text-primary-inverse, #ffffff);text-decoration:none}.hyperlink--cta:visited{color:var(--ds-color-text-primary-inverse, #ffffff)}@media screen and (min-width: 576px){.hyperlink--cta{display:inline-block;min-width:8.75rem;width:auto;padding:0 var(--ds-size-300, 1.5rem)}}.hyperlink--cta.hyperlink--secondary{border:1px solid var(--ds-color-ui-default-default, #0074c8);background-color:var(--ds-color-background-lightest, #ffffff);color:var(--ds-color-text-link-default, #0074c8)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--secondary:hover{border:1px solid var(--ds-color-ui-default-default, #0074c8);background-image:linear-gradient(var(--ds-color-background-lighter, #f8f8f8), var(--ds-color-background-lighter, #f8f8f8));color:var(--ds-color-text-link-default, #0074c8)}.hyperlink--cta.hyperlink--secondary.hyperlink--ondark{border:1px solid var(--ds-color-ui-default-inverse, #00cff0);background-color:transparent;color:var(--ds-color-ui-default-inverse, #00cff0)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--secondary.hyperlink--ondark:hover{border:1px solid var(--ds-color-ui-default-inverse, #00cff0);background-image:linear-gradient(var(--ds-color-base-black-opacity-15, rgba(0, 0, 0, 0.15)), var(--ds-color-base-black-opacity-15, rgba(0, 0, 0, 0.15)));color:var(--ds-color-ui-default-inverse, #00cff0)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--secondary.hyperlink--ondark:visited{color:var(--ds-color-ui-default-inverse, #00cff0)}.hyperlink--cta.hyperlink--ondark{border:1px solid var(--ds-color-ui-default-inverse, #00cff0);background-color:var(--ds-color-ui-default-inverse, #00cff0);color:var(--ds-color-text-primary-default, #222222)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--ondark:hover{border:1px solid var(--ds-color-ui-hover-inverse, #5de3f7);background-image:linear-gradient(var(--ds-color-ui-hover-inverse, #5de3f7), var(--ds-color-ui-hover-inverse, #5de3f7));color:var(--ds-color-text-primary-default, #222222)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--ondark:visited{color:var(--ds-color-text-primary-default, #222222)}.hyperlink--ondark{color:var(--ds-color-ui-default-inverse, #00cff0)}.hyperlink--ondark:visited{color:var(--ds-color-ui-default-inverse, #00cff0)}:host([small][type=cta]) .hyperlink--cta,:host([small=true][type=cta]) .hyperlink--cta{display:flex;min-width:unset;min-height:2.25rem;max-height:2.25rem;padding:var(--ds-size-100, 0.5rem) var(--ds-size-200, 1rem);line-height:var(--ds-unitless-scale-140, 1.4);font-size:var(--ds-text-body-size-sm, 0.875rem)}:host([small][type=cta]) .hyperlink--cta svg,:host([small=true][type=cta]) .hyperlink--cta svg{top:unset}svg{--auro-size-lg:1rem;position:relative;top:var(--ds-size-25, 0.125rem);margin-left:var(--ds-size-25, 0.125rem)}`; /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const o=o=>o??T; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},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)}} /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const e=e$1(class extends i{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return w}}); var externalLink = {"role":"img","color":"currentColor","title":"Link to external site.","desc":"This indicates a link to an external site that may not follow the same accessibility or privacy policies as Alaska Airlines. By selecting a partner link you agree to share your data with these sites.","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":"external-link","category":"interface","deprecated":false,"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"external-link__title external-link__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\"><title id=\"external-link__title\">Link to external site.</title><desc id=\"external-link__desc\">This indicates a link to an external site that may not follow the same accessibility or privacy policies as Alaska Airlines. By selecting a partner link you agree to share your data with these sites.</desc><path d=\"M7 6.25h5a.75.75 0 0 1 .102 1.494L12 7.75H7a1.25 1.25 0 0 0-1.244 1.123L5.75 9v8c0 .648.492 1.18 1.122 1.244L7 18.25h8a1.25 1.25 0 0 0 1.244-1.122L16.25 17v-5a.75.75 0 0 1 1.493-.101l.007.101v5a2.75 2.75 0 0 1-2.582 2.745L15 19.75H7a2.75 2.75 0 0 1-2.745-2.582L4.25 17V9a2.75 2.75 0 0 1 2.582-2.745zh5zm12.025-2 .125.015.11.032.128.061c.18.108.317.29.353.522l.009.12v5a.75.75 0 0 1-1.493.102L18.25 10V6.811l-6.72 6.72a.75.75 0 0 1-1.133-.977l.073-.084 6.718-6.72H14a.75.75 0 0 1-.743-.648L13.25 5a.75.75 0 0 1 .648-.743L14 4.25z\"/></svg>"}; var newWindow = {"role":"img","color":"currentColor","title":"Link will open a new tab or window.","desc":"Notice indicator to alert users that action will result in the browser opening a new tab or window.","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":"new-window","category":"interface","deprecated":false,"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"new-window__title new-window__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\"><title id=\"new-window__title\">Link will open a new tab or window.</title><desc id=\"new-window__desc\">Notice indicator to alert users that action will result in the browser opening a new tab or window.</desc><path fill-rule=\"evenodd\" d=\"M20.246 5.687a2.063 2.063 0 0 0-2.058-1.937H8.813l-.126.004A2.063 2.063 0 0 0 6.75 5.813v.937H6.5l-.168.005A2.75 2.75 0 0 0 3.75 9.5v8l.005.168A2.75 2.75 0 0 0 6.5 20.25h8l.168-.005A2.75 2.75 0 0 0 17.25 17.5v-.25h.938l.125-.004a2.063 2.063 0 0 0 1.937-2.058V5.813zM15.75 17.25H8.813a2.063 2.063 0 0 1-2.06-1.937l-.003-.126V8.25H6.5a1.25 1.25 0 0 0-1.244 1.123L5.25 9.5v8c0 .648.492 1.18 1.122 1.244l.128.006h8a1.25 1.25 0 0 0 1.243-1.122l.007-.128zm-6.625-12h8.75l.09.005a.875.875 0 0 1 .785.87v8.75l-.005.09a.875.875 0 0 1-.87.785h-8.75l-.09-.005a.875.875 0 0 1-.785-.87v-8.75l.005-.09a.875.875 0 0 1 .87-.785m4.28 1.757L13.507 7c.38 0 .693.3.743.69l.007.11-.007 1.938h2c.38 0 .694.301.743.691l.007.108c0 .405-.282.74-.648.792l-.102.007h-2.001l.001 1.865c0 .404-.282.739-.648.792L13.5 14c-.38 0-.694-.3-.743-.69l-.007-.11-.001-1.864H10.75c-.38 0-.694-.3-.743-.69L10 10.537c0-.404.282-.738.648-.791l.102-.008h2l.007-1.939c0-.404.282-.739.648-.792\"/></svg>"}; // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license // See LICENSE in the project root for license information. // build the component class class ComponentBase extends s { constructor() { super(); this.download = false; this.relative = false; this.secondary = false; this.ondark = false; this.small = false; /** * @private */ this.defaultreferrerpolicy = 'strict-origin-when-cross-origin'; /** * @private */ this.ariapressed = 'false'; /** * @private */ this.tabisactive = 'false'; /* If the component requires a touch detection, please use this function to determine if a user is actively touching a device, versus detecting if the device is touch enables or a handheld device. Also uncomment the touch detection lib above */ this.addEventListener('touchstart', function() { this.classList.add('is-touching'); }); } // function to define props used within the scope of thie component static get properties() { return { href: { type: String }, rel: { type: String }, role: { type: String }, target: { type: String }, download: { type: Boolean }, relative: { type: Boolean }, secondary: { type: Boolean }, ondark: { type: Boolean }, type: { type: String }, fluid: { type: Boolean }, referrerpolicy: { type: Boolean }, small: { type: Boolean } }; } /** * @private * @returns {string} Cleaned URL. */ get safeUri() { return this.href ? this.safeUrl(this.href, this.relative) : ''; } /** * @private * @returns {boolean} Whether or not URL includes protocol. */ get includesDomain() { return this.href ? this.safeUri.includes('http') : false; } /** * @private * @param {string} href - Include href value. * @param {boolean} relative - Include relative value. * @returns {string} URL definition. */ safeUrl(href, relative) { if (href !== undefined) { const url = new URL(href, 'https://www.alaskaair.com'); switch (url.protocol) { case 'javascript:': // eslint-disable-line return ''; case 'tel:': return href; case 'sms:': return href; case 'mailto:': return href; default: if (!relative) { url.protocol = 'https:'; return url.href; } else if (relative) { return href; } } } else if (href === undefined) { return undefined; } return undefined; } /** * Internal function to generate the HTML for the icon to use. * @private * @param {string} svgContent - The imported svg icon. * @returns {string} - The html template for the icon. */ generateIconHtml(svgContent) { const dom = new DOMParser().parseFromString(svgContent, 'text/html'), svg = dom.body.firstChild; return svg; } /** * @private * @param {string} target - Link destination target. * @returns {string} Correct icon. */ targetIcon(target) { if (target === '_blank' && this.safeUri.includes('alaskaair.com')) { return this.generateIconHtml(newWindow.svg); } else if (target === '_blank' && this.includesDomain) { return this.generateIconHtml(externalLink.svg); } return undefined; } /** * @private * @param {boolean} tabisactive - Tab state. * @returns {string} CSS class for active state. */ getTabState(tabisactive) { return tabisactive === true ? "is-active" : ''; } /** * @private * @param {string} target - Link destination target. * @param {string} rel - Defined rel option. * @returns {string} SEO security options. */ getReltype(target, rel) { if (rel) { return rel; } if (target === '_blank' && this.safeUri.includes('alaskaair.com')) { return rel; } if (target === '_blank' && this.includesDomain && !this.rel && !this.referrerpolicy) { return 'noopener noreferrer'; } if (target === '_blank' && this.referrerpolicy) { return 'external'; } return undefined; } /** * @private * @param {boolean} ariapressed - Aria state. * @returns {string} Aria attribute definition. */ ariaPressedState(ariapressed) { const ariaToggle = function (event) { const ariaPressedNode = this.shadowRoot.querySelector('[aria-pressed]'); ariaPressedNode.setAttribute("aria-pressed", 'false'); if (event.type === 'mousedown') { ariaPressedNode.ariaPressed = true; } else { ariaPressedNode.ariaPressed = false; } if (event.type === 'keydown') { if (event.code === 'Enter' || event.code === 'Space') { ariaPressedNode.ariaPressed = true; } else { ariaPressedNode.ariaPressed = false; } } }; // Add our event listeners this.addEventListener('mousedown', ariaToggle); this.addEventListener('mouseup', ariaToggle); this.addEventListener('keydown', ariaToggle); this.addEventListener('keyup', ariaToggle); return ariapressed; } // function that renders the HTML and CSS into the scope of the component render() { return x` ${this.getMarkup()} `; } } // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license // See LICENSE in the project root for license information. // See https://git.io/JJ6SJ for "How to document your components using JSDoc" /** * `<auro-hyperlink>` is a wrapper components for an HTML `<a>` element containing styling and behavior. * * @attr {Boolean} download - Specifies that the target will be downloaded when a user clicks on the hyperlink. * @attr {Boolean} fluid - Modifier for `type="cta"` fluid-width UI option. * @attr {Boolean} ondark - Specifies dark theme use of hyperlink. * @attr {Boolean} relative - Add flag to disable auto URL re-write feature. * @attr {Boolean} secondary - Modifier for `type="cta"` secondary UI option. * @attr {Boolean} small - Modifier for `type="cta"` small UI option. * @attr {Boolean} referrerpolicy - Sets `strict-origin-when-cross-origin` to send a full URL when performing a same-origin request, only sends the origin when the protocol security level stays the same (HTTPS→HTTPS), and sends no header to a less secure destination (HTTPS→HTTP). * @attr {String} rel - Specifies the relationship between the current document and the linked document. * @attr {String} role - Use for aria roles; currently supports `button` for extended experiences. * @attr {String} href - Specifies the URL of the page link. * @attr {String} target - Specifies where to open the linked document. * @attr {String} type - Enumerable attribute; [`nav`, `cta`] * @csspart link - Apply CSS to the `a` element */ // build the component class class AuroHyperlink extends ComponentBase { // function to define props used within the scope of this component static get properties() { return { ...super.properties }; } static get styles() { return [styleCssAuroHyperlink]; } /** * @private * @returns {object} Classes object. */ getMarkup() { const classes = { 'hyperlink': this.safeUri || this.role, 'hyperlink--nav': this.type === 'nav', 'hyperlink--ondark': this.ondark, 'hyperlink--button': this.role, 'hyperlink--cta': this.type === 'cta', 'hyperlink--secondary': this.secondary }; return x` ${this.safeUri || this.role ? x` <a part="link" aria-pressed="${o(this.role === 'button' ? this.ariaPressedState(this.ariapressed) : undefined)}" class="${e(classes)}" href="${o(this.role ? undefined : this.safeUri)}" rel="${o(this.target || this.rel ? this.getReltype(this.target, this.rel) : undefined)}" referrerpolicy="${o(this.referrerpolicy ? this.defaultreferrerpolicy : undefined)}" role="${o(this.role === 'button' ? this.role : undefined)}" ?download="${this.download}" target="${o(this.target && this.includesDomain ? this.target : undefined)}" tabindex="${o(this.role === 'button' ? '0' : undefined)}" ><slot></slot>${this.targetIcon(this.target, this.relative)}</a>` : x`<slot></slot>`} `; } } // default internal definition if (!customElements.get("auro-hyperlink")) { customElements.define("auro-hyperlink", AuroHyperlink); } // Copyright (c) 2022 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license // See LICENSE in the project root for license information. // build the component class class AuroBreadcrumb extends AuroHyperlink { static get styles() { return [ styleCssAuroHyperlink, styleBreadcrumbCss ]; } } var styleAnchorlinkCss = i$3`*,*: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{display:block;border:1px solid transparent;border-left:1px solid var(--ds-color-border-divider-default, rgba(0, 0, 0, 0.15))}:host a{display:block;color:var(--ds-color-text-secondary-default, #626b79) !important;text-decoration:none;font-size:var(--ds-text-body-size-sm, 0.875rem);width:100%;padding:var(--ds-size-100, 0.5rem) var(--ds-size-200, 1rem) var(--ds-size-100, 0.5rem) var(--ds-size-200, 1rem)}:host a:focus{background-color:unset;outline:unset}:host([active]) a,:host(:hover) a{color:var(--ds-color-text-primary-default, #222222) !important}:host(:focus){border:1px solid var(--ds-color-border-active-default, #0074c8);border-radius:5px}:host(:focus:hover) a{color:var(--ds-color-text-primary-default, #222222) !important}`; // Copyright (c) 2022 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license // See LICENSE in the project root for license information. // See https://git.io/JJ6SJ for "How to document your components using JSDoc" /** * The auro-nav element provides users a way to ... (it would be great if you fill this out). * * @attr {Boolean} active - If set, dethe link is currently the active link in the parent auro-nav. */ // build the component class class AuroAnchorlink extends AuroHyperlink { static get properties() { return { // ...super.properties, active: { type: Boolean, reflect: true } }; } static get styles() { return [ styleCssAuroHyperlink, styleAnchorlinkCss ]; } updated(changedProperties) { if (changedProperties.has('active')) { if (this.active) { this.dispatchEvent(new CustomEvent('auroAnchorLink-activated', { bubbles: true, composed: true })); } } } firstUpdated() { this.addEventListener('click', (evt) => { // Prevents from href from being followed (this is used for testing) evt.preventDefault(); this.active = true; }); } } var styleCss = i$3`*,*: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([anchornav]){position:relative}:host([anchornav]) .label-container{padding-bottom:var(--ds-size-200, 1rem);color:var(--ds-color-text-secondary-default, #626b79)}:host([anchornav]) .label-container.hidden{display:none}@media screen and (max-width: 576px){:host([anchornav]) .showHideBtn{display:block}}@media screen and (max-width: 576px){:host([anchornav]:not([aria-expanded])):before{position:absolute;bottom:0;left:0;display:block;width:100%;height:100%;background:linear-gradient(180deg, rgba(255, 255, 255, 0.0001) 0%, rgba(255, 255, 255, 0.00874633) 6.67%, rgba(255, 255, 255, 0.0356065) 13.33%, rgba(255, 255, 255, 0.0817517) 20%, rgba(255, 255, 255, 0.147497) 26.67%, rgba(255, 255, 255, 0.231852) 33.33%, rgba(255, 255, 255, 0.331951) 40%, rgba(255, 255, 255, 0.442747) 46.67%, rgba(255, 255, 255, 0.557353) 53.33%, rgba(255, 255, 255, 0.668149) 60%, rgba(255, 255, 255, 0.768248) 66.67%, rgba(255, 255, 255, 0.852603) 73.33%, rgba(255, 255, 255, 0.918348) 80%, rgba(255, 255, 255, 0.964494) 86.67%, rgba(255, 255, 255, 0.991354) 93.33%, #FFFFFF 100%);content:"";pointer-events:none}:host([anchornav]:not([aria-expanded])) .showHideBtn [more]{display:none}:host([anchornav]:not([aria-expanded])) .showHideBtn [less]{display:inline}:host([anchornav]:not([aria-expanded])) ::slotted(auro-anchorlink){display:none}:host([anchornav]:not([aria-expanded])) ::slotted(auro-anchorlink:nth-of-type(1)),:host([anchornav]:not([aria-expanded])) ::slotted(auro-anchorlink:nth-of-type(2)),:host([anchornav]:not([aria-expanded])) ::slotted(auro-anchorlink:nth-of-type(3)){display:block}}.showHideBtn{display:none;margin-top:var(--ds-size-150, 0.75rem)}.showHideBtn [less]{display:none}.anchorMarker{position:absolute;left:0;display:none;width:2px;background:var(--ds-color-brand-neutral-500, #626b79)}.anchorMarker:not([resizing]){transition:400ms ease-out}`; // Copyright (c) 2022 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license // See LICENSE in the project root for license information. // See https://git.io/JJ6SJ for "How to document your components using JSDoc" /** * The auro-nav element provides users a way to ... (it would be great if you fill this out). * * @attr {Boolean} activeLink - If set, defines the currently active link. * @attr {String} anchorNavContent - Defines the container that anchor links navigate within. * @slot Slot for insertion of navigation links. * @slot mobileToggleExpanded - Slot for button text in mobile when content is expanded. * @slot mobileToggleCollapsed - Slot for button text in mobile when content is collapsed. */ // build the component class class AuroNav extends s { constructor() { super(); this.anchorNavContent = undefined; /** * @private */ this.activeLink = undefined; /** * @private */ this.labelHidden = true; /** * @private */ this.mobileViewCollapsedNumLinks = 3; } // This function is to define props used within the scope of this component // Be sure to review https://lit-element.polymer-project.org/guide/properties#reflected-attributes // to understand how to use reflected attributes with your property settings. static get properties() { return { // ...super.properties, activeLink: { type: Object }, anchorNavContent: { type: String } }; } static get styles() { return [ styleCss ]; } /** * @private * @returns {void} Sets the labelHidden attribute to true if there is no label slot content. */ handleLabelSlot() { const slot = this.shadowRoot.querySelector('#label'); this.labelHidden = true; if (slot.assignedNodes().length > 0) { this.labelHidden = false; } } /** * @private * @returns {void} Inserts home and chevron-left icons for every breadcrumb. */ handleSlotItems() { this.manageBreadcrumbs(); this.manageAnchorlinks(); } /** * @private * @returns {void} Inserts home and chevron-left icons for every breadcrumb. */ manageBreadcrumbs() { const breadcrumbs = [...this.querySelectorAll('auro-breadcrumb')]; if (breadcrumbs.length > 0) { breadcrumbs.forEach((breadcrumb) => { this.insertIcon(breadcrumb, 'interface', 'home-stroke', 'var(--ds-size-200)'); this.insertIcon(breadcrumb, 'interface', 'chevron-left', 'var(--ds-size-300)'); }); } } /** * Used for the anchorLink version to bind events to all link elements in the slotted content. * @private * @returns {void} */ manageAnchorlinks() { this.anchorlinks = [...this.querySelectorAll('auro-anchorlink')]; if (this.anchorlinks.length > 0) { this.setAttribute('anchornav', true); this.requestUpdate(); this.anchorlinks.forEach((link) => { if (link.active) { this.activeLink = link; } link.addEventListener('auroAnchorLink-activated', (evt) => { if (this.activeLink !== evt.target) { this.activeLink = evt.target; } }); link.addEventListener('click', (evt) => { if (this.scrollContainer && this.activeLink) { const targetContent = document.querySelector(evt.target.href); if (targetContent) { targetContent.scrollIntoView(targetContent); } } }); }); this.assessActiveAnchorLink(); } } /** * Used to toggle visibility of all links after the first 3 when viewed in the mobile layout. * @private * @returns {void} */ toggleAnchorLinks() { if (!this.hasAttribute('aria-expanded')) { this.setAttribute('aria-expanded', true); } else { this.removeAttribute('aria-expanded'); } this.handleAnchorNavAnimation(); } /** * Used for the anchorLink version to animate the position and size of the marker used to identify the active link. * @private * @returns {void} */ handleAnchorNavAnimation() { const marker = this.shadowRoot.querySelector('#anchorMarker'); if (marker) { if (this.activeLink) { marker.style.display = 'block'; marker.style.height = `${this.activeLink.offsetHeight}px`; marker.style.top = `${this.activeLink.offsetTop}px`; } else { marker.style.display = 'none'; marker.style.height = 'unset'; marker.style.top = 'unset'; } } } /** * @private * @param {Object} link - Hyperlink in which the auro-icon is inserted. * @param {String} category - Category that the auro-icon is classified under. * @param {String} name - Name of the auro-icon. * @param {String} size - Height and width of the auro-icon. * @returns {void} Configures icon to be placed within each hyperlink. */ insertIcon(link, category, name, size) { const icon = document.createElement('auro-icon'); icon.setAttribute('customSize', true); icon.setAttribute('customColor', true); icon.category = category; icon.name = name; icon.style.width = size; icon.style.height = size; icon.style.lineHeight = `1.5rem`; icon.style.position = 'relative'; icon.style.top = '-2px'; icon.style.marginRight = `0.25rem`; link.insertAdjacentElement('afterbegin', icon); } /** * Sets the activeLink attribute based on which linked content section is in view. * @private * @returns {void} */ assessActiveAnchorLink() { let lastInView; /* eslint-disable-line init-declarations */ this.anchorlinks.forEach((anchorLink) => { const target = this.scrollContainer.querySelector(anchorLink.getAttribute('href')); if (target) { if (this.isScrolledIntoView(target)) { lastInView = anchorLink; } } }); if (this.activeLink !== lastInView) { this.activeLink = lastInView; } } /** * Used with the anchorLink version to determine if the designated content is currently viewable in the scrollbox. * @private * @param {Object} elem - The element to check if it is currently visible in the scrollContainer. * @returns {Boolean} If true, the element passed in is visible. */ isScrolledIntoView(elem) { const containerViewBottom = this.scrollContainer.scrollTop + this.scrollContainer.offsetHeight; const elementInViewPos = elem.offsetTop + elem.offsetHeight; const inView = containerViewBottom >= elementInViewPos; return inView; } updated(changedProperties) { if (changedProperties.has('activeLink')) { if (this.hasAttribute('anchornav')) { this.anchorlinks.forEach((anchorlink) => { if (this.activeLink !== anchorlink) { anchorlink.removeAttribute('active'); } }); this.handleAnchorNavAnimation(); } } } firstUpdated() { this.scrollContainer = document.querySelector(this.anchorNavContent); if (this.scrollContainer) { this.scrollContainer.addEventListener('scroll', () => { this.assessActiveAnchorLink(); }); } window.addEventListener('resize', () => { const marker = this.shadowRoot.querySelector('#anchorMarker'); if (marker) { marker.setAttribute('resizing', true); this.handleAnchorNavAnimation(); marker.removeAttribute('resizing'); } }); } // function that renders the HTML and CSS into the scope of the component render() { const labelClasses = { 'hidden': this.labelHidden, 'label-container': true }; return x` <div aria-label="navigation" role="navigation"> <div class=${e(labelClasses)}> <slot id="label" name="label" @slotchange="${this.handleLabelSlot}"></slot> </div> <slot @slotchange="${this.handleSlotItems}"></slot> </div> ${this.anchorlinks && this.anchorlinks.length > this.mobileViewCollapsedNumLinks ? x` <auro-button slim tertiary class="showHideBtn" @click=${this.toggleAnchorLinks}> <span more> <slot name="mobileToggleExpanded"></slot> </span> <span less> <slot name="mobileToggleCollapsed"></slot> </span> </auro-button> ` : undefined} ${this.anchorlinks ? x` <div id="anchorMarker" class="anchorMarker"></div> ` : undefined} `; } } /** * Register Custom Element. * @pa