scb-wc 0.1.62 → 0.1.64
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/mvc/components/scb-footer/scb-footer.js +1 -1
- package/mvc/components/scb-header/scb-header-utility.js +1 -1
- package/mvc/components/scb-header/scb-header.js +49 -49
- package/package.json +2 -2
- package/scb-components/scb-header/scb-header-utility.d.ts +3 -0
- package/scb-footer/scb-footer.js +1 -1
- package/scb-header/scb-header-utility.js +10 -1
- package/scb-header/scb-header.js +8 -5
- package/scb-wc.bundle.js +4 -4
|
@@ -217,7 +217,7 @@ import{_ as N,b as B,g as M,h as g,y as b}from"../../vendor/vendor.js";import"..
|
|
|
217
217
|
</scb-grid-item>
|
|
218
218
|
`}function V(e,t,a){return b`
|
|
219
219
|
<section class="group ${a?"group--centered":""}" aria-labelledby=${`scb-footer-sec-${t}`}>
|
|
220
|
-
<
|
|
220
|
+
<h2 id=${`scb-footer-sec-${t}`} class="title">${e.title}</h2>
|
|
221
221
|
<ul>
|
|
222
222
|
${e.links.map(n=>b`
|
|
223
223
|
<li>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var
|
|
1
|
+
import{n as o,t as a}from"../../vendor/assertClassBrand.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var n=customElements.define.bind(customElements);customElements.define=function(e,u,d){try{customElements.get(e)||n(e,u,d)}catch(s){var i=String(s||"");if(i.indexOf("already been used")===-1&&i.indexOf("NotSupportedError")===-1)throw s}}}}catch{}})();var r=new WeakSet,c=class extends HTMLElement{constructor(...t){super(...t),o(this,r)}static get observedAttributes(){return["role"]}get label(){return this.getAttribute("label")??""}set label(t){this.setAttribute("label",t)}get href(){return this.getAttribute("href")??"#"}set href(t){this.setAttribute("href",t)}get target(){return this.getAttribute("target")??void 0}set target(t){t==null?this.removeAttribute("target"):this.setAttribute("target",t)}connectedCallback(){a(r,this,l).call(this)}attributeChangedCallback(t){t==="role"&&a(r,this,l).call(this)}};function l(){this.hasAttribute("role")&&this.removeAttribute("role"),this.setAttribute("aria-hidden","true"),this.style.display="none"}customElements.define("scb-header-utility",c);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-drawer/scb-drawer.js","../../vendor/decorate.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../scb-divider/scb-divider.js","../../vendor/assertClassBrand.js","../scb-menu/scb-menu.js","../scb-menu/scb-menu-item.js","../../vendor/preload-helper.js","../../vendor/scb-chevron.js","../scb-menu/scb-menu-section.js","../scb-menu/scb-sub-menu.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
2
|
+
import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as S,v,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as n}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import{t as M}from"../../vendor/preload-helper.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-search/scb-search.js";import"../scb-dropdown/scb-dropdown.js";import"../scb-grid/scb-grid-item.js";import"../scb-grid/scb-grid.js";import"../scb-skeleton/scb-skeleton.js";(function(){try{var b=typeof globalThis<"u"?globalThis:window;if(!b.__scb_ce_guard_installed__){b.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,s,r){try{customElements.get(t)||e(t,s,r)}catch(a){var i=String(a||"");if(i.indexOf("already been used")===-1&&i.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var A,$,z=0,N=()=>{if(typeof window>"u"||typeof document>"u"||!("customElements"in window)||document.head.querySelector("style[data-scb-header-pre-upgrade]"))return;const b=document.createElement("style");b.setAttribute("data-scb-header-pre-upgrade",""),b.textContent=`
|
|
3
3
|
scb-header:not(:defined),
|
|
4
4
|
scb-header[data-upgrading] {
|
|
5
5
|
display: block;
|
|
@@ -50,20 +50,20 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`,document.head.appendChild(b);const e=l=>{const u=String(l??"").trim();if(u)return/^\d+$/.test(u)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(u,10)))})`:u},t=l=>{const u=String(l??"").trim();if(!u)return!1;try{const p=JSON.parse(u);return Array.isArray(p)&&p.length>0}catch{return!1}},s=l=>l!=null&&!/^(false|0|off|no)$/i.test(l.trim()),r=l=>{for(const u of Array.from(l.children)){const p=u.tagName.toLowerCase();if(p==="scb-header-tab"||p==="scb-dropdown")return!0}return!1},i=l=>{r(l)||t(l.getAttribute("tabs"))||s(l.getAttribute("reserve-tabs"))||s(l.getAttribute("layout-pending"))?l.setAttribute("data-pre-has-tabs",""):l.removeAttribute("data-pre-has-tabs");const u=e(l.getAttribute("spacing")),p=e(l.getAttribute("spacing-top"))??u,v=e(l.getAttribute("spacing-bottom"))??u;p?l.style.setProperty("--scb-header-spacing-block-start",p):l.style.removeProperty("--scb-header-spacing-block-start"),v?l.style.setProperty("--scb-header-spacing-block-end",v):l.style.removeProperty("--scb-header-spacing-block-end");const h=(l.getAttribute("logo-width")??"").trim();h?l.style.setProperty("--scb-header-pre-logo-w",h):l.style.removeProperty("--scb-header-pre-logo-w");const y=(l.getAttribute("logo-height")??"").trim();y?l.style.setProperty("--scb-header-pre-logo-img-h",y):l.style.removeProperty("--scb-header-pre-logo-img-h");const g=(l.getAttribute("search-height")??"").trim();g?l.style.setProperty("--scb-header-pre-control-size",g):l.style.removeProperty("--scb-header-pre-control-size")};document.querySelectorAll("scb-header").forEach(i);const d=new MutationObserver(l=>{for(const u of l){if(u.type==="attributes"){const p=u.target;p instanceof HTMLElement&&p.tagName.toLowerCase()==="scb-header"&&i(p);continue}if(u.type==="childList"){const p=[...Array.from(u.addedNodes),...Array.from(u.removedNodes)];for(const v of p){if(!(v instanceof HTMLElement))continue;if(v.tagName.toLowerCase()==="scb-header"){i(v);continue}const h=v.closest?.("scb-header");h&&i(h)}}}});d.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabs","spacing","spacing-top","spacing-bottom","logo-width","logo-height","logo-aspect-ratio","logo-alt","logotype-text","search-height","reserve-tabs","layout-pending"]}),customElements.whenDefined("scb-header").then(()=>{d.disconnect()})};N();var T={fromAttribute:b=>b==null?!0:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>String(!!b)},k={fromAttribute:b=>b==null?!1:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>b?"":null},D={fromAttribute:b=>b==="small"||b==="large"?b:"medium",toAttribute:b=>{const e=String(b??"");return e==="small"||e==="large"?e:null}},o=(A=class extends E{constructor(){super(),this.maxWidth="1440px",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.size="medium",this.logoText="",this.logotypeText="",this.logoAlt="",this.logoHref="/",this.logoSrc="",this.logoWidth="",this.logoHeight="",this.logoAspectRatio="",this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel="Sök",this.menuButtonLabel="Meny",this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",this._menuExpanded=!1,this._searchId="header-search",this._drawerReady=!1,this._mobileSearchOpen=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{window.innerWidth>=this.BP_SM&&this._mobileSearchOpen&&this._setMobileSearchOpen(!1),this._scheduleMeasure()},this._onMenuSelect=t=>{const s=t.detail;this.dispatchEvent(new CustomEvent("scb-menu-select",{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbmenuselect",{detail:s,bubbles:!0,composed:!0}));const r=s?.item,i=typeof s?.href=="string"?s.href:typeof s?.itemHref=="string"?s.itemHref:typeof s?.item_href=="string"?s.item_href:"",a=r?r.getAttribute("item-href")??r.getAttribute("href")??"":"";String(i||a||"").trim()&&this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._slotWatchers=[],this._harvestPending=!1,this._harvest=(t={})=>{const s=Array.from(this.children),r=[],i=[],a=[];let d=-1;const l=h=>({label:h.getAttribute("label")??"",href:h.getAttribute("href")??void 0,icon:h.getAttribute("icon")??void 0});for(const h of s){const y=h.tagName.toLowerCase();if(y==="scb-header-tab"){const g=h.getAttribute("label")??"",_=h.getAttribute("href"),S=_&&_.trim()!==""?_:void 0;(h.hasAttribute("selected")||h.getAttribute("selected")==="true"||h.getAttribute("active")==="true"||h.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length),r.push({kind:"tab",label:g,href:S});continue}if(y==="scb-badge"){const g=h.querySelector("scb-dropdown");if(g){const _=g.getAttribute("label")??"";(g.hasAttribute("selected")||g.getAttribute("selected")==="true"||g.getAttribute("active")==="true"||g.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length);const S=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==S&&h.setAttribute("slot",S),g.hasAttribute("slot")&&g.removeAttribute("slot"),g.hasAttribute("as-tab")||g.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:S,label:_});continue}}if(y==="scb-dropdown"){const g=h.getAttribute("label")??"";(h.hasAttribute("selected")||h.getAttribute("selected")==="true"||h.getAttribute("active")==="true"||h.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length);const _=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==_&&h.setAttribute("slot",_),h.hasAttribute("as-tab")||h.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:_,label:g});continue}if(y==="scb-header-utility"){i.push({label:h.getAttribute("label")??"",href:h.getAttribute("href")??"#",target:h.getAttribute("target")??void 0});continue}if(y==="scb-header-menu-group"){const g={label:h.getAttribute("label")??"",icon:h.getAttribute("icon")??void 0,children:[]};h.querySelectorAll("scb-header-menu-item").forEach(_=>g.children.push(l(_))),a.push(g);continue}y==="scb-header-menu-item"&&a.push(l(h))}const u=!this._sameNavItems(this._slotNavItems,r),p=!this._sameUtilityItems(this._slotUtils,i),v=!this._sameMenuNodes(this._slotMenu,a);u&&(this._slotNavItems=r),p&&(this._slotUtils=i),v&&(this._slotMenu=a),!this.hasAttribute("active-tab")&&d>=0&&this.activeTab!==d&&(this.activeTab=d),(t.scheduleMeasure??!0)&&queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{if(this.layoutPending)return;const t=this._top,s=this._logoGroup;if(!t||!s)return;const r=window.innerWidth,i=t.clientWidth,a=this._overflows(this._util),d=this._tabsOverflows(),l=r<this.BP_MD||a||d;this._collapsed?!l&&i>=this._unlockAtWidth&&this._setCollapsed(!1):l&&(this._unlockAtWidth=i+this._HYST,this._setCollapsed(!0));let u=!1;if(this.showSearch&&r>=this.BP_SM&&r<this.BP_MD&&this._searchWrap){const v=getComputedStyle(this._searchWrap),h=Math.max(this._num(v.minWidth,this._tokenPx("--scb-header-search-min",250)),this._tokenPx("--scb-header-search-min",250)),y=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),g=this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48):0;u=s.getBoundingClientRect().width+y+h+y+g+8>i+.5}this._setHideSearch(u);let p=!1;if(this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const v=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),h=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48),y=(this._logoGroup?.getBoundingClientRect().width||0)+v+h;this._hideLogoText?p=!(i>=this._logoTextUnlockAt):y>i+.5&&(p=!0,this._logoTextUnlockAt=i+this._HYST)}else p=!1,this._logoTextUnlockAt=0;this._setHideLogoText(p)},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("draweropen",{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("drawerclose",{bubbles:!0,composed:!0}))},this._onMenuClick=async t=>{this.showDrawer&&(this._setMobileSearchOpen(!1),this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("menuclick",{bubbles:!0,composed:!0})),!this._drawerReady&&(t.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onSearchClick=t=>{const s=this._searchEl;if(s?.submit&&typeof s.submit=="function"){s.submit();return}const r=s?.value??"";this.searchText=r,this.dispatchEvent(new CustomEvent("search-click",{detail:{value:r},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchclick",{detail:{value:r},bubbles:!0,composed:!0})),s?.focus?.()},this._onMobileSearchToggle=()=>{const t=!this._mobileSearchOpen;this._setMobileSearchOpen(t),t&&this.updateComplete.then(()=>{this.renderRoot.querySelector(".mobile-search-panel scb-search")?.focus?.()})},this._onTabClick=t=>{const s=t.currentTarget;if(!s)return;const r=s.tagName.toLowerCase()==="a";if(r&&(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const i=s.getAttribute("data-index"),a=i!=null?Number(i):0,d=this._getNavItems()[a];if(d?.kind==="dropdown")return;this.activeTab=a;const l=d?.kind==="tab"?d.href??"":"",u=new CustomEvent("tab-change",{detail:{index:a,href:l},bubbles:!0,composed:!0,cancelable:!0}),p=new CustomEvent("tabchange",{detail:{index:a,href:l},bubbles:!0,composed:!0,cancelable:!0});!(this.dispatchEvent(u)&&this.dispatchEvent(p))&&r&&t.preventDefault()},this._onDropdownTabActivate=t=>{const s=t.detail?.dataIndex,r=typeof s=="number"?s:typeof s=="string"?Number(s):this._readTabIndexFromEvent(t);if(r==null||!Number.isFinite(r))return;const i=this._getNavItems();r<0||r>=i.length||i[r]?.kind==="dropdown"&&(this.activeTab=r,this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("tabchange",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=t=>{const s=t.key;if(s!=="ArrowLeft"&&s!=="ArrowRight"&&s!=="Home"&&s!=="End")return;const r=this._getNavItems();if(!r.length)return;const i=this._readTabIndexFromEvent(t);if(i==null)return;let a=Math.max(0,Math.min(r.length-1,i));s==="ArrowRight"?a=(a+1)%r.length:s==="ArrowLeft"?a=(a-1+r.length)%r.length:s==="Home"?a=0:s==="End"&&(a=r.length-1),t.preventDefault(),this._focusTabAtIndex(a)},this._onSearchInput=t=>{this.searchText=t.detail?.value??"",this.dispatchEvent(new CustomEvent("search-input",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchinput",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:this.searchText},bubbles:!0,composed:!0}))},this._onSearchSubmit=t=>{this.searchText=t.detail?.value??"",this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:t.detail?.active},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchchange",{detail:{value:this.searchText,active:t.detail?.active},bubbles:!0,composed:!0}))},this._onSearchClear=()=>{this.searchText="",this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:""},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:""},bubbles:!0,composed:!0}))};const e=++z;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}requestLayout(){this.layoutPending||(this.setAttribute("data-layout-settling",""),this.updateComplete.then(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-layout-settling"))}))}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",$.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",$.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}get _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(i=>i.disconnect()),this._slotWatchers=[];const e=["label","href","icon","target","selected","aria-current","active"],t=i=>{const a=new MutationObserver(d=>{this._scheduleHarvest()});this._slotWatchers.push(a),a.observe(i,{attributes:!0,attributeFilter:e})},s=()=>{this._slotWatchers.forEach(a=>a.disconnect()),this._slotWatchers=[];const i=Array.from(this.children);for(const a of i){const d=a.tagName.toLowerCase();if((d==="scb-header-tab"||d==="scb-dropdown"||d==="scb-header-utility"||d==="scb-header-menu-item"||d==="scb-header-menu-group"||d==="scb-badge")&&t(a),d==="scb-badge"){const l=a,u=new MutationObserver(v=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(l,{childList:!0});const p=l.querySelector("scb-dropdown");p&&t(p);continue}if(d==="scb-header-menu-group"){const l=a,u=new MutationObserver(p=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(l,{childList:!0,subtree:!0}),l.querySelectorAll("scb-header-menu-item").forEach(p=>t(p))}}},r=new MutationObserver(i=>{let a=!1;for(const d of i)if(d.type==="childList"){a=!0;break}a&&s(),this._scheduleHarvest()});this._slotMo=r,r.observe(this,{childList:!0}),s()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.kind!==i.kind||r.label!==i.label)return!1;if(r.kind==="tab"&&i.kind==="tab"){if((r.href??"")!==(i.href??""))return!1}else if(r.kind==="dropdown"&&i.kind==="dropdown"&&r.slotName!==i.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.label!==i.label||r.href!==i.href||(r.target??"")!==(i.target??""))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.label!==i.label||(r.href??"")!==(i.href??"")||(r.icon??"")!==(i.icon??"")||!this._sameMenuNodes(r.children??[],i.children??[]))return!1}return!0}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_setMobileSearchOpen(e){this._mobileSearchOpen!==e&&(this._mobileSearchOpen=e,this.toggleAttribute("data-mobile-search-open",e))}_num(e,t){const s=Number.parseFloat(String(e??"").trim());return Number.isFinite(s)?s:t}_tokenPx(e,t){const s=getComputedStyle(this);return this._num(s.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!=="none":!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}_tabsOverflows(){const e=this._tabsNav;if(!e||!this._visible(e))return!1;const t=Array.from(e.querySelectorAll(".tab-wrap"));if(t.length===0)return!1;const s=e.getBoundingClientRect();let r=s.left;for(const i of t){const a=i.getBoundingClientRect();a.width<=0||a.right>r&&(r=a.right)}return r-s.left>s.width+1}connectedCallback(){super.connectedCallback(),this._initialUpgradeComplete||this.setAttribute("data-upgrading",""),this._harvest({scheduleMeasure:!1}),this._attachSlotObservers()}_finishInitialUpgrade(){this._initialUpgradeComplete||(this._initialUpgradeComplete=!0,requestAnimationFrame(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-upgrading"))}))}firstUpdated(){this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),this.updateComplete.then(()=>{this._harvest({scheduleMeasure:!1}),this._attachSlotObservers(),this._syncDropdownTabs(),this._finishInitialUpgrade()});const e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener("resize",this._onWindowResize,{passive:!0})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"380px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"250px"),e.has("searchHeight")&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty("--scb-search-height",this.searchHeight.trim()):this.style.removeProperty("--scb-search-height")),(e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio"))&&this._applyLogoSizing(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&this._applySpacing(),(e.has("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("logotypeText")||e.has("logoSrc")||e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio")||e.has("activeTab")||e.has("_slotNavItems")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("alwaysShowMenuButton")||e.has("showSearch")||e.has("layoutPending")||e.has("searchMax")||e.has("searchMin")||e.has("size"))&&this.updateComplete.then(()=>{this._scheduleMeasure()}),(e.has("showDrawer")||e.has("deferDrawer"))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has("showSearch")&&!this.showSearch&&this._setMobileSearchOpen(!1),e.has("layoutPending")&&!this.layoutPending&&this.requestLayout(),(e.has("activeTab")||e.has("_slotNavItems")||e.has("tabs")||e.has("size"))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}_mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_applySpacing(){const e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,s=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty("--scb-header-spacing-block-start",t):this.style.removeProperty("--scb-header-spacing-block-start"),s?this.style.setProperty("--scb-header-spacing-block-end",s):this.style.removeProperty("--scb-header-spacing-block-end")}_applyLogoSizing(){const e=(this.logoWidth??"").trim(),t=(this.logoHeight??"").trim(),s=(this.logoAspectRatio??"").trim();e?this.style.setProperty("--scb-header-logo-img-w",e):this.style.removeProperty("--scb-header-logo-img-w"),t?this.style.setProperty("--scb-header-logo-img-h",t):e?this.style.setProperty("--scb-header-logo-img-h","auto"):this.style.removeProperty("--scb-header-logo-img-h"),s?this.style.setProperty("--scb-header-logo-img-aspect-ratio",s):this.style.removeProperty("--scb-header-logo-img-aspect-ratio")}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0)}async _ensureDrawerReady(){this._drawerReady||(this._drawerImportPromise??(this._drawerImportPromise=Promise.all([M(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),M(()=>import("../scb-menu/scb-menu.js"),__vite__mapDeps([6,5,1,2,3,4,7,8,9,10,11]),import.meta.url)]).then(()=>{})),await this._drawerImportPromise,this._drawerReady=!0)}_syncMenuBtnAria(){this.renderRoot.querySelectorAll(".menu-trigger").forEach(e=>{e.setAttribute("aria-expanded",String(this._menuExpanded))})}_getNavItems(){return this._slotNavItems.length?this._slotNavItems:(this.tabs??[]).map(e=>({kind:"tab",...e}))}_getDropdownForSlot(e){const t=this.querySelector(`[slot="${e}"]`);return t?t.tagName.toLowerCase()==="scb-dropdown"?t:t.querySelector("scb-dropdown"):null}_syncDropdownTabs(){this._getNavItems().forEach((e,t)=>{if(e.kind!=="dropdown")return;const s=this._getDropdownForSlot(e.slotName);if(!s)return;const r=String(t);s.getAttribute("data-index")!==r&&s.setAttribute("data-index",r),s.hasAttribute("as-tab")||s.setAttribute("as-tab","");const i=this.size,a=s;a?.size!==i&&(a.size=i),t===this.activeTab?s.getAttribute("aria-current")!=="page"&&s.setAttribute("aria-current","page"):s.hasAttribute("aria-current")&&s.removeAttribute("aria-current")})}_readTabIndexFromEvent(e){const t=e.composedPath?e.composedPath():[];for(const s of t){if(!(s instanceof HTMLElement))continue;const r=s.getAttribute("data-index");if(r==null)continue;const i=Number(r);if(Number.isFinite(i))return i}return null}_focusTabAtIndex(e){const t=this._getNavItems()[e];if(t){if(t.kind==="dropdown"){this._getDropdownForSlot(t.slotName)?.focus?.();return}this.renderRoot.querySelector(`.tab-link[data-index="${e}"]`)?.focus?.()}}_renderMenuNodes(e){return!e||e.length===0?m``:m`${e.map(t=>this._renderMenuNode(t))}`}_renderMenuNode(e){const t=Array.isArray(e.children)&&e.children.length>0,s=(e.href??"").trim(),r=(e.icon??"").trim();return m`
|
|
53
|
+
`,document.head.appendChild(b);const e=l=>{const u=String(l??"").trim();if(u)return/^\d+$/.test(u)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(u,10)))})`:u},t=l=>{const u=String(l??"").trim();if(!u)return!1;try{const p=JSON.parse(u);return Array.isArray(p)&&p.length>0}catch{return!1}},s=l=>l!=null&&!/^(false|0|off|no)$/i.test(l.trim()),r=l=>{for(const u of Array.from(l.children)){const p=u.tagName.toLowerCase();if(p==="scb-header-tab"||p==="scb-dropdown")return!0}return!1},i=l=>{r(l)||t(l.getAttribute("tabs"))||s(l.getAttribute("reserve-tabs"))||s(l.getAttribute("layout-pending"))?l.setAttribute("data-pre-has-tabs",""):l.removeAttribute("data-pre-has-tabs");const u=e(l.getAttribute("spacing")),p=e(l.getAttribute("spacing-top"))??u,y=e(l.getAttribute("spacing-bottom"))??u;p?l.style.setProperty("--scb-header-spacing-block-start",p):l.style.removeProperty("--scb-header-spacing-block-start"),y?l.style.setProperty("--scb-header-spacing-block-end",y):l.style.removeProperty("--scb-header-spacing-block-end");const _=(l.getAttribute("logo-width")??"").trim();_?l.style.setProperty("--scb-header-pre-logo-w",_):l.style.removeProperty("--scb-header-pre-logo-w");const h=(l.getAttribute("logo-height")??"").trim();h?l.style.setProperty("--scb-header-pre-logo-img-h",h):l.style.removeProperty("--scb-header-pre-logo-img-h");const w=(l.getAttribute("search-height")??"").trim();w?l.style.setProperty("--scb-header-pre-control-size",w):l.style.removeProperty("--scb-header-pre-control-size")};document.querySelectorAll("scb-header").forEach(i);const d=new MutationObserver(l=>{for(const u of l){if(u.type==="attributes"){const p=u.target;p instanceof HTMLElement&&p.tagName.toLowerCase()==="scb-header"&&i(p);continue}if(u.type==="childList"){const p=[...Array.from(u.addedNodes),...Array.from(u.removedNodes)];for(const y of p){if(!(y instanceof HTMLElement))continue;if(y.tagName.toLowerCase()==="scb-header"){i(y);continue}const _=y.closest?.("scb-header");_&&i(_)}}}});d.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabs","spacing","spacing-top","spacing-bottom","logo-width","logo-height","logo-aspect-ratio","logo-alt","logotype-text","search-height","reserve-tabs","layout-pending"]}),customElements.whenDefined("scb-header").then(()=>{d.disconnect()})};N();var T={fromAttribute:b=>b==null?!0:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>String(!!b)},k={fromAttribute:b=>b==null?!1:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>b?"":null},D={fromAttribute:b=>b==="small"||b==="large"?b:"medium",toAttribute:b=>{const e=String(b??"");return e==="small"||e==="large"?e:null}},o=(A=class extends E{constructor(){super(),this.maxWidth="1440px",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.size="medium",this.logoText="",this.logotypeText="",this.logoAlt="",this.logoHref="/",this.logoSrc="",this.logoWidth="",this.logoHeight="",this.logoAspectRatio="",this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel="Sök",this.menuButtonLabel="Meny",this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",this._menuExpanded=!1,this._searchId="header-search",this._drawerReady=!1,this._mobileSearchOpen=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{window.innerWidth>=this.BP_SM&&this._mobileSearchOpen&&this._setMobileSearchOpen(!1),this._scheduleMeasure()},this._onMenuSelect=t=>{const s=t.detail;this.dispatchEvent(new CustomEvent("scb-menu-select",{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbmenuselect",{detail:s,bubbles:!0,composed:!0}));const r=s?.item,i=typeof s?.href=="string"?s.href:typeof s?.itemHref=="string"?s.itemHref:typeof s?.item_href=="string"?s.item_href:"",a=r?r.getAttribute("item-href")??r.getAttribute("href")??"":"";String(i||a||"").trim()&&this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._slotWatchers=[],this._harvestPending=!1,this._harvest=(t={})=>{const s=Array.from(this.children),r=[],i=[],a=[];let d=-1;const l=h=>({label:h.getAttribute("label")??"",href:h.getAttribute("href")??void 0,icon:h.getAttribute("icon")??void 0}),u=h=>{h.hasAttribute("role")&&h.removeAttribute("role"),h.getAttribute("aria-hidden")!=="true"&&h.setAttribute("aria-hidden","true")};for(const h of s){const w=h.tagName.toLowerCase();if(w==="scb-header-tab"){const m=h.getAttribute("label")??"",x=h.getAttribute("href"),f=x&&x.trim()!==""?x:void 0;(h.hasAttribute("selected")||h.getAttribute("selected")==="true"||h.getAttribute("active")==="true"||h.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length),r.push({kind:"tab",label:m,href:f});continue}if(w==="scb-badge"){const m=h.querySelector("scb-dropdown");if(m){const x=m.getAttribute("label")??"";(m.hasAttribute("selected")||m.getAttribute("selected")==="true"||m.getAttribute("active")==="true"||m.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length);const f=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==f&&h.setAttribute("slot",f),m.hasAttribute("slot")&&m.removeAttribute("slot"),m.hasAttribute("as-tab")||m.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:f,label:x});continue}}if(w==="scb-dropdown"){const m=h.getAttribute("label")??"";(h.hasAttribute("selected")||h.getAttribute("selected")==="true"||h.getAttribute("active")==="true"||h.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length);const x=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==x&&h.setAttribute("slot",x),h.hasAttribute("as-tab")||h.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:x,label:m});continue}if(w==="scb-header-utility"){u(h),i.push({label:h.getAttribute("label")??"",href:h.getAttribute("href")??"#",target:h.getAttribute("target")??void 0});continue}if(w==="scb-header-menu-group"){const m={label:h.getAttribute("label")??"",icon:h.getAttribute("icon")??void 0,children:[]};h.querySelectorAll("scb-header-menu-item").forEach(x=>m.children.push(l(x))),a.push(m);continue}w==="scb-header-menu-item"&&a.push(l(h))}const p=!this._sameNavItems(this._slotNavItems,r),y=!this._sameUtilityItems(this._slotUtils,i),_=!this._sameMenuNodes(this._slotMenu,a);p&&(this._slotNavItems=r),y&&(this._slotUtils=i),_&&(this._slotMenu=a),!this.hasAttribute("active-tab")&&d>=0&&this.activeTab!==d&&(this.activeTab=d),(t.scheduleMeasure??!0)&&queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{if(this.layoutPending)return;const t=this._top,s=this._logoGroup;if(!t||!s)return;const r=window.innerWidth,i=t.clientWidth,a=this._overflows(this._util),d=this._tabsOverflows(),l=r<this.BP_MD||a||d;this._collapsed?!l&&i>=this._unlockAtWidth&&this._setCollapsed(!1):l&&(this._unlockAtWidth=i+this._HYST,this._setCollapsed(!0));let u=!1;if(this.showSearch&&r>=this.BP_SM&&r<this.BP_MD&&this._searchWrap){const y=getComputedStyle(this._searchWrap),_=Math.max(this._num(y.minWidth,this._tokenPx("--scb-header-search-min",250)),this._tokenPx("--scb-header-search-min",250)),h=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),w=this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48):0;u=s.getBoundingClientRect().width+h+_+h+w+8>i+.5}this._setHideSearch(u);let p=!1;if(this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const y=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),_=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48),h=(this._logoGroup?.getBoundingClientRect().width||0)+y+_;this._hideLogoText?p=!(i>=this._logoTextUnlockAt):h>i+.5&&(p=!0,this._logoTextUnlockAt=i+this._HYST)}else p=!1,this._logoTextUnlockAt=0;this._setHideLogoText(p)},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("draweropen",{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("drawerclose",{bubbles:!0,composed:!0}))},this._onMenuClick=async t=>{this.showDrawer&&(this._setMobileSearchOpen(!1),this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("menuclick",{bubbles:!0,composed:!0})),!this._drawerReady&&(t.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onSearchClick=t=>{const s=this._searchEl;if(s?.submit&&typeof s.submit=="function"){s.submit();return}const r=s?.value??"";this.searchText=r,this.dispatchEvent(new CustomEvent("search-click",{detail:{value:r},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchclick",{detail:{value:r},bubbles:!0,composed:!0})),s?.focus?.()},this._onMobileSearchToggle=()=>{const t=!this._mobileSearchOpen;this._setMobileSearchOpen(t),t&&this.updateComplete.then(()=>{this.renderRoot.querySelector(".mobile-search-panel scb-search")?.focus?.()})},this._onTabClick=t=>{const s=t.currentTarget;if(!s)return;const r=s.tagName.toLowerCase()==="a";if(r&&(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const i=s.getAttribute("data-index"),a=i!=null?Number(i):0,d=this._getNavItems()[a];if(d?.kind==="dropdown")return;this.activeTab=a;const l=d?.kind==="tab"?d.href??"":"",u=new CustomEvent("tab-change",{detail:{index:a,href:l},bubbles:!0,composed:!0,cancelable:!0}),p=new CustomEvent("tabchange",{detail:{index:a,href:l},bubbles:!0,composed:!0,cancelable:!0});!(this.dispatchEvent(u)&&this.dispatchEvent(p))&&r&&t.preventDefault()},this._onDropdownTabActivate=t=>{const s=t.detail?.dataIndex,r=typeof s=="number"?s:typeof s=="string"?Number(s):this._readTabIndexFromEvent(t);if(r==null||!Number.isFinite(r))return;const i=this._getNavItems();r<0||r>=i.length||i[r]?.kind==="dropdown"&&(this.activeTab=r,this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("tabchange",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=t=>{const s=t.key;if(s!=="ArrowLeft"&&s!=="ArrowRight"&&s!=="Home"&&s!=="End")return;const r=this._getNavItems();if(!r.length)return;const i=this._readTabIndexFromEvent(t);if(i==null)return;let a=Math.max(0,Math.min(r.length-1,i));s==="ArrowRight"?a=(a+1)%r.length:s==="ArrowLeft"?a=(a-1+r.length)%r.length:s==="Home"?a=0:s==="End"&&(a=r.length-1),t.preventDefault(),this._focusTabAtIndex(a)},this._onSearchInput=t=>{this.searchText=t.detail?.value??"",this.dispatchEvent(new CustomEvent("search-input",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchinput",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:this.searchText},bubbles:!0,composed:!0}))},this._onSearchSubmit=t=>{this.searchText=t.detail?.value??"",this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:t.detail?.active},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchchange",{detail:{value:this.searchText,active:t.detail?.active},bubbles:!0,composed:!0}))},this._onSearchClear=()=>{this.searchText="",this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:""},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:""},bubbles:!0,composed:!0}))};const e=++z;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}requestLayout(){this.layoutPending||(this.setAttribute("data-layout-settling",""),this.updateComplete.then(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-layout-settling"))}))}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",$.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",$.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}get _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(i=>i.disconnect()),this._slotWatchers=[];const e=["label","href","icon","target","selected","aria-current","active","role"],t=i=>{const a=new MutationObserver(d=>{this._scheduleHarvest()});this._slotWatchers.push(a),a.observe(i,{attributes:!0,attributeFilter:e})},s=()=>{this._slotWatchers.forEach(a=>a.disconnect()),this._slotWatchers=[];const i=Array.from(this.children);for(const a of i){const d=a.tagName.toLowerCase();if((d==="scb-header-tab"||d==="scb-dropdown"||d==="scb-header-utility"||d==="scb-header-menu-item"||d==="scb-header-menu-group"||d==="scb-badge")&&t(a),d==="scb-badge"){const l=a,u=new MutationObserver(y=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(l,{childList:!0});const p=l.querySelector("scb-dropdown");p&&t(p);continue}if(d==="scb-header-menu-group"){const l=a,u=new MutationObserver(p=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(l,{childList:!0,subtree:!0}),l.querySelectorAll("scb-header-menu-item").forEach(p=>t(p))}}},r=new MutationObserver(i=>{let a=!1;for(const d of i)if(d.type==="childList"){a=!0;break}a&&s(),this._scheduleHarvest()});this._slotMo=r,r.observe(this,{childList:!0}),s()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.kind!==i.kind||r.label!==i.label)return!1;if(r.kind==="tab"&&i.kind==="tab"){if((r.href??"")!==(i.href??""))return!1}else if(r.kind==="dropdown"&&i.kind==="dropdown"&&r.slotName!==i.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.label!==i.label||r.href!==i.href||(r.target??"")!==(i.target??""))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.label!==i.label||(r.href??"")!==(i.href??"")||(r.icon??"")!==(i.icon??"")||!this._sameMenuNodes(r.children??[],i.children??[]))return!1}return!0}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_setMobileSearchOpen(e){this._mobileSearchOpen!==e&&(this._mobileSearchOpen=e,this.toggleAttribute("data-mobile-search-open",e))}_num(e,t){const s=Number.parseFloat(String(e??"").trim());return Number.isFinite(s)?s:t}_tokenPx(e,t){const s=getComputedStyle(this);return this._num(s.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!=="none":!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}_tabsOverflows(){const e=this._tabsNav;if(!e||!this._visible(e))return!1;const t=Array.from(e.querySelectorAll(".tab-wrap"));if(t.length===0)return!1;const s=e.getBoundingClientRect();let r=s.left;for(const i of t){const a=i.getBoundingClientRect();a.width<=0||a.right>r&&(r=a.right)}return r-s.left>s.width+1}connectedCallback(){super.connectedCallback(),this._initialUpgradeComplete||this.setAttribute("data-upgrading",""),this._harvest({scheduleMeasure:!1}),this._attachSlotObservers()}_finishInitialUpgrade(){this._initialUpgradeComplete||(this._initialUpgradeComplete=!0,requestAnimationFrame(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-upgrading"))}))}firstUpdated(){this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),this.updateComplete.then(()=>{this._harvest({scheduleMeasure:!1}),this._attachSlotObservers(),this._syncDropdownTabs(),this._finishInitialUpgrade()});const e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener("resize",this._onWindowResize,{passive:!0})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"380px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"250px"),e.has("searchHeight")&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty("--scb-search-height",this.searchHeight.trim()):this.style.removeProperty("--scb-search-height")),(e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio"))&&this._applyLogoSizing(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&this._applySpacing(),(e.has("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("logotypeText")||e.has("logoSrc")||e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio")||e.has("activeTab")||e.has("_slotNavItems")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("alwaysShowMenuButton")||e.has("showSearch")||e.has("layoutPending")||e.has("searchMax")||e.has("searchMin")||e.has("size"))&&this.updateComplete.then(()=>{this._scheduleMeasure()}),(e.has("showDrawer")||e.has("deferDrawer"))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has("showSearch")&&!this.showSearch&&this._setMobileSearchOpen(!1),e.has("layoutPending")&&!this.layoutPending&&this.requestLayout(),(e.has("activeTab")||e.has("_slotNavItems")||e.has("tabs")||e.has("size"))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}_mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_applySpacing(){const e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,s=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty("--scb-header-spacing-block-start",t):this.style.removeProperty("--scb-header-spacing-block-start"),s?this.style.setProperty("--scb-header-spacing-block-end",s):this.style.removeProperty("--scb-header-spacing-block-end")}_applyLogoSizing(){const e=(this.logoWidth??"").trim(),t=(this.logoHeight??"").trim(),s=(this.logoAspectRatio??"").trim();e?this.style.setProperty("--scb-header-logo-img-w",e):this.style.removeProperty("--scb-header-logo-img-w"),t?this.style.setProperty("--scb-header-logo-img-h",t):e?this.style.setProperty("--scb-header-logo-img-h","auto"):this.style.removeProperty("--scb-header-logo-img-h"),s?this.style.setProperty("--scb-header-logo-img-aspect-ratio",s):this.style.removeProperty("--scb-header-logo-img-aspect-ratio")}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0)}async _ensureDrawerReady(){this._drawerReady||(this._drawerImportPromise??(this._drawerImportPromise=Promise.all([M(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),M(()=>import("../scb-menu/scb-menu.js"),__vite__mapDeps([6,5,1,2,3,4,7,8,9,10,11]),import.meta.url)]).then(()=>{})),await this._drawerImportPromise,this._drawerReady=!0)}_syncMenuBtnAria(){this.renderRoot.querySelectorAll(".menu-trigger").forEach(e=>{e.setAttribute("aria-expanded",String(this._menuExpanded))})}_getNavItems(){return this._slotNavItems.length?this._slotNavItems:(this.tabs??[]).map(e=>({kind:"tab",...e}))}_getDropdownForSlot(e){const t=this.querySelector(`[slot="${e}"]`);return t?t.tagName.toLowerCase()==="scb-dropdown"?t:t.querySelector("scb-dropdown"):null}_syncDropdownTabs(){this._getNavItems().forEach((e,t)=>{if(e.kind!=="dropdown")return;const s=this._getDropdownForSlot(e.slotName);if(!s)return;const r=String(t);s.getAttribute("data-index")!==r&&s.setAttribute("data-index",r),s.hasAttribute("as-tab")||s.setAttribute("as-tab","");const i=this.size,a=s;a?.size!==i&&(a.size=i),t===this.activeTab?s.getAttribute("aria-current")!=="page"&&s.setAttribute("aria-current","page"):s.hasAttribute("aria-current")&&s.removeAttribute("aria-current")})}_readTabIndexFromEvent(e){const t=e.composedPath?e.composedPath():[];for(const s of t){if(!(s instanceof HTMLElement))continue;const r=s.getAttribute("data-index");if(r==null)continue;const i=Number(r);if(Number.isFinite(i))return i}return null}_focusTabAtIndex(e){const t=this._getNavItems()[e];if(t){if(t.kind==="dropdown"){this._getDropdownForSlot(t.slotName)?.focus?.();return}this.renderRoot.querySelector(`.tab-link[data-index="${e}"]`)?.focus?.()}}_renderMenuNodes(e){return!e||e.length===0?g``:g`${e.map(t=>this._renderMenuNode(t))}`}_renderMenuNode(e){const t=Array.isArray(e.children)&&e.children.length>0,s=(e.href??"").trim(),r=(e.icon??"").trim();return g`
|
|
54
54
|
<scb-menu-item
|
|
55
55
|
label=${e.label}
|
|
56
56
|
?selected=${!1}
|
|
57
|
-
leading-icon=${r||
|
|
58
|
-
item-href=${s||
|
|
57
|
+
leading-icon=${r||v}
|
|
58
|
+
item-href=${s||v}
|
|
59
59
|
>
|
|
60
|
-
${t?
|
|
60
|
+
${t?g`
|
|
61
61
|
<scb-sub-menu label=${e.label}>
|
|
62
62
|
${e.children.map(i=>this._renderMenuNode(i))}
|
|
63
63
|
</scb-sub-menu>
|
|
64
|
-
`:
|
|
64
|
+
`:v}
|
|
65
65
|
</scb-menu-item>
|
|
66
|
-
`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}_renderMenuButton(e="",t=!1){const s=e?`menu-trigger ${e}`:"menu-trigger",r=(this.menuButtonLabel??"").trim()||"Meny";return t?
|
|
66
|
+
`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}_renderMenuButton(e="",t=!1){const s=e?`menu-trigger ${e}`:"menu-trigger",r=(this.menuButtonLabel??"").trim()||"Meny";return t?g`
|
|
67
67
|
<scb-icon-button
|
|
68
68
|
class=${s}
|
|
69
69
|
icon="menu"
|
|
@@ -75,7 +75,7 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
75
75
|
title="Öppna meny"
|
|
76
76
|
@click=${this._onMenuClick}
|
|
77
77
|
></scb-icon-button>
|
|
78
|
-
`:
|
|
78
|
+
`:g`
|
|
79
79
|
<scb-button
|
|
80
80
|
class=${s}
|
|
81
81
|
variant="text"
|
|
@@ -89,7 +89,7 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
89
89
|
title="Öppna meny"
|
|
90
90
|
@click=${this._onMenuClick}
|
|
91
91
|
></scb-button>
|
|
92
|
-
`}render(){const e=this._getNavItems(),t=this._slotUtils.length?this._slotUtils:this.utilityItems,s=this._slotMenu.length?this._slotMenu:this.menuData??[],r=this.logoText||this.logotypeText,i=this.logoAlt||r||"Gå till startsidan",a=this.querySelector('[slot="drawer-menu"]')!==null;this._syncFlags(t.length===0,!this.showSearch);const d=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:
|
|
92
|
+
`}render(){const e=this._getNavItems(),t=this._slotUtils.length?this._slotUtils:this.utilityItems,s=this._slotMenu.length?this._slotMenu:this.menuData??[],r=this.logoText||this.logotypeText,i=this.logoAlt||r||"Gå till startsidan",a=this.querySelector('[slot="drawer-menu"]')!==null;this._syncFlags(t.length===0,!this.showSearch);const d=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:v,l=e.length>0||this.reserveTabs||this.layoutPending,u=(this.reserveTabs||this.layoutPending)&&(this.layoutPending||e.length===0),p=this.showDrawer&&(!this.deferDrawer||this._drawerReady),y=typeof window<"u"&&window.innerWidth>=this.BP_MD,_=this.showDrawer&&(y?this.alwaysShowMenuButton||this._collapsed:!0),h=_&&!y,w=_&&y,m=(this.searchButtonLabel??"").trim()||"Sök",x=this.showSearch&&!this._mobileSearchOpen;return g`
|
|
93
93
|
<slot
|
|
94
94
|
id="data-slot"
|
|
95
95
|
@slotchange=${()=>{this._harvest(),this._attachSlotObservers()}}
|
|
@@ -98,8 +98,8 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
98
98
|
|
|
99
99
|
<div
|
|
100
100
|
class="header-landmark"
|
|
101
|
-
role=${this.banner?"banner":
|
|
102
|
-
aria-label=${this.banner&&this.bannerLabel?this.bannerLabel:
|
|
101
|
+
role=${this.banner?"banner":v}
|
|
102
|
+
aria-label=${this.banner&&this.bannerLabel?this.bannerLabel:v}
|
|
103
103
|
>
|
|
104
104
|
<scb-grid
|
|
105
105
|
cols-compact="4"
|
|
@@ -128,17 +128,17 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
128
128
|
|
|
129
129
|
<div class="actions">
|
|
130
130
|
<nav class="utility" aria-label="Funktionslänkar">
|
|
131
|
-
${t.map(
|
|
131
|
+
${t.map(f=>g`
|
|
132
132
|
<scb-button
|
|
133
133
|
variant="text"
|
|
134
|
-
.href=${
|
|
135
|
-
.target=${
|
|
136
|
-
label=${
|
|
134
|
+
.href=${f.href}
|
|
135
|
+
.target=${f.target??""}
|
|
136
|
+
label=${f.label}
|
|
137
137
|
></scb-button>
|
|
138
138
|
`)}
|
|
139
139
|
</nav>
|
|
140
140
|
|
|
141
|
-
${this.showSearch?
|
|
141
|
+
${this.showSearch?g`
|
|
142
142
|
<div class="search" style=${d}>
|
|
143
143
|
<scb-search
|
|
144
144
|
id=${this._searchId}
|
|
@@ -152,13 +152,13 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
152
152
|
></scb-search>
|
|
153
153
|
<scb-button
|
|
154
154
|
variant="filled-tonal"
|
|
155
|
-
label=${
|
|
155
|
+
label=${m}
|
|
156
156
|
.size=${this.size}
|
|
157
157
|
@click=${this._onSearchClick}
|
|
158
158
|
></scb-button>
|
|
159
159
|
</div>
|
|
160
|
-
`:
|
|
161
|
-
${
|
|
160
|
+
`:v}
|
|
161
|
+
${x?g`
|
|
162
162
|
<scb-icon-button
|
|
163
163
|
class="mobile-search-trigger"
|
|
164
164
|
variant="filled-tonal"
|
|
@@ -166,11 +166,11 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
166
166
|
.size=${this.size}
|
|
167
167
|
@click=${this._onMobileSearchToggle}
|
|
168
168
|
></scb-icon-button>
|
|
169
|
-
`:
|
|
170
|
-
${
|
|
169
|
+
`:v}
|
|
170
|
+
${h?this._renderMenuButton("",!0):v}
|
|
171
171
|
</div>
|
|
172
172
|
|
|
173
|
-
${this.showSearch&&this._mobileSearchOpen?
|
|
173
|
+
${this.showSearch&&this._mobileSearchOpen?g`
|
|
174
174
|
<div class="mobile-search-panel" style=${d}>
|
|
175
175
|
<scb-search
|
|
176
176
|
.size=${this.size}
|
|
@@ -188,7 +188,7 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
188
188
|
@click=${this._onMobileSearchToggle}
|
|
189
189
|
></scb-icon-button>
|
|
190
190
|
</div>
|
|
191
|
-
`:
|
|
191
|
+
`:v}
|
|
192
192
|
|
|
193
193
|
</div>
|
|
194
194
|
</scb-grid-item>
|
|
@@ -198,14 +198,14 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
198
198
|
col-span-medium="8"
|
|
199
199
|
col-span-expanded="12"
|
|
200
200
|
>
|
|
201
|
-
<div class=${l||
|
|
202
|
-
${l?u?
|
|
201
|
+
<div class=${l||w?"tabs-row":"tabs-row tabs-row--empty"}>
|
|
202
|
+
${l?u?g`
|
|
203
203
|
<div class="tabs-inset">
|
|
204
204
|
<div class="tabs-nav tabs-nav--skeleton" aria-hidden="true">
|
|
205
205
|
${this._renderTabSkeletons()}
|
|
206
206
|
</div>
|
|
207
207
|
</div>
|
|
208
|
-
`:e.length?
|
|
208
|
+
`:e.length?g`
|
|
209
209
|
<div class="tabs-inset">
|
|
210
210
|
<nav
|
|
211
211
|
class="tabs-nav"
|
|
@@ -213,49 +213,49 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
213
213
|
@keydown=${this._onTabsKeydown}
|
|
214
214
|
@scb-dropdown-tab-activate=${this._onDropdownTabActivate}
|
|
215
215
|
>
|
|
216
|
-
${e.map((
|
|
216
|
+
${e.map((f,C)=>f.kind==="dropdown"?g`
|
|
217
217
|
<div class="tab-wrap">
|
|
218
|
-
<slot name=${
|
|
218
|
+
<slot name=${f.slotName}></slot>
|
|
219
219
|
</div>
|
|
220
|
-
`:
|
|
220
|
+
`:f.href?g`
|
|
221
221
|
<div class="tab-wrap">
|
|
222
222
|
<a
|
|
223
223
|
class="tab-link"
|
|
224
|
-
href=${
|
|
224
|
+
href=${f.href}
|
|
225
225
|
data-index=${C}
|
|
226
|
-
aria-current=${C===this.activeTab?"page":
|
|
226
|
+
aria-current=${C===this.activeTab?"page":v}
|
|
227
227
|
@click=${this._onTabClick}
|
|
228
228
|
>
|
|
229
|
-
${
|
|
229
|
+
${f.label}
|
|
230
230
|
</a>
|
|
231
231
|
<md-focus-ring></md-focus-ring>
|
|
232
232
|
</div>
|
|
233
|
-
`:
|
|
233
|
+
`:g`
|
|
234
234
|
<div class="tab-wrap">
|
|
235
235
|
<button
|
|
236
236
|
type="button"
|
|
237
237
|
class="tab-link"
|
|
238
238
|
data-index=${C}
|
|
239
|
-
aria-current=${C===this.activeTab?"page":
|
|
239
|
+
aria-current=${C===this.activeTab?"page":v}
|
|
240
240
|
@click=${this._onTabClick}
|
|
241
241
|
>
|
|
242
|
-
${
|
|
242
|
+
${f.label}
|
|
243
243
|
</button>
|
|
244
244
|
<md-focus-ring></md-focus-ring>
|
|
245
245
|
</div>
|
|
246
246
|
`)}
|
|
247
247
|
</nav>
|
|
248
248
|
</div>
|
|
249
|
-
`:
|
|
249
|
+
`:v:v}
|
|
250
250
|
|
|
251
|
-
${
|
|
251
|
+
${w?this._renderMenuButton("menu-trigger--tabs-right"):v}
|
|
252
252
|
</div>
|
|
253
253
|
</scb-grid-item>
|
|
254
254
|
</scb-grid>
|
|
255
255
|
<div class="divider" role="presentation"></div>
|
|
256
256
|
</div>
|
|
257
257
|
|
|
258
|
-
${p?
|
|
258
|
+
${p?g`
|
|
259
259
|
<scb-drawer
|
|
260
260
|
id=${this._drawerId}
|
|
261
261
|
floating
|
|
@@ -270,7 +270,7 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
270
270
|
>
|
|
271
271
|
<slot name="drawer-menu"></slot>
|
|
272
272
|
|
|
273
|
-
${a?
|
|
273
|
+
${a?v:g`
|
|
274
274
|
<scb-menu
|
|
275
275
|
.label=${this.menuLabel??""}
|
|
276
276
|
.subLabel=${this.menuSubLabel??""}
|
|
@@ -280,28 +280,28 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
280
280
|
.supportingText=${this.menuSearchPlaceholder??""}
|
|
281
281
|
></scb-search>
|
|
282
282
|
|
|
283
|
-
${this.menuSectionLabel?
|
|
283
|
+
${this.menuSectionLabel?g`
|
|
284
284
|
<scb-menu-section
|
|
285
285
|
.label=${this.menuSectionLabel}
|
|
286
286
|
></scb-menu-section>
|
|
287
|
-
`:
|
|
287
|
+
`:v}
|
|
288
288
|
|
|
289
289
|
${this._renderMenuNodes(s)}
|
|
290
290
|
|
|
291
|
-
${this.includeUtilityInMenu&&(t?.length??0)>0?
|
|
291
|
+
${this.includeUtilityInMenu&&(t?.length??0)>0?g`
|
|
292
292
|
<scb-menu-section label=''></scb-menu-section>
|
|
293
|
-
${t.map(
|
|
293
|
+
${t.map(f=>g`
|
|
294
294
|
<scb-menu-item
|
|
295
|
-
label=${
|
|
296
|
-
item-href=${
|
|
295
|
+
label=${f.label}
|
|
296
|
+
item-href=${f.href}
|
|
297
297
|
></scb-menu-item>
|
|
298
298
|
`)}
|
|
299
|
-
`:
|
|
299
|
+
`:v}
|
|
300
300
|
</scb-menu>
|
|
301
301
|
`}
|
|
302
302
|
</scb-drawer>
|
|
303
|
-
`:
|
|
304
|
-
`}_renderTabSkeletons(){const e=["96px","72px","88px","64px"],t=(this.reserveTabsWidths??"").split(/[\s,]+/).map(a=>a.trim()).filter(Boolean).map(a=>/^\d+(?:\.\d+)?$/.test(a)?`${a}px`:a),s=t.length>0?t:e,r=Number(this.reserveTabsCount),i=Number.isFinite(r)&&r>0?Math.floor(r):t.length>0?t.length:e.length;return
|
|
303
|
+
`:v}
|
|
304
|
+
`}_renderTabSkeletons(){const e=["96px","72px","88px","64px"],t=(this.reserveTabsWidths??"").split(/[\s,]+/).map(a=>a.trim()).filter(Boolean).map(a=>/^\d+(?:\.\d+)?$/.test(a)?`${a}px`:a),s=t.length>0?t:e,r=Number(this.reserveTabsCount),i=Number.isFinite(r)&&r>0?Math.floor(r):t.length>0?t.length:e.length;return g`${Array.from({length:i},(a,d)=>s[d%s.length]).map(a=>g`<scb-skeleton variant="rounded" width=${a} height="16px"></scb-skeleton>`)}`}_renderLogo(){const e=(this.logoSrc??"").trim();return e?g`<img class="logo" src=${e} alt="" aria-hidden="true" />`:g`
|
|
305
305
|
<svg
|
|
306
306
|
class="logo"
|
|
307
307
|
viewBox="0 0 48 54"
|
|
@@ -803,4 +803,4 @@ import"../../vendor/vendor-material.js";import{_ as E,b as P,g as I,h as c,m as
|
|
|
803
803
|
:host([data-hide-logo-text]) .logo-text {
|
|
804
804
|
display: none;
|
|
805
805
|
}
|
|
806
|
-
`,A);n([c({type:String,attribute:"max-width"})],o.prototype,"maxWidth",void 0);n([c({type:String,reflect:!0})],o.prototype,"spacing",void 0);n([c({type:String,attribute:"spacing-top",reflect:!0})],o.prototype,"spacingTop",void 0);n([c({type:String,attribute:"spacing-bottom",reflect:!0})],o.prototype,"spacingBottom",void 0);n([c({type:String,reflect:!0,converter:D})],o.prototype,"size",void 0);n([c({type:String,attribute:"logo-text"})],o.prototype,"logoText",void 0);n([c({type:String,attribute:"logotype-text"})],o.prototype,"logotypeText",void 0);n([c({type:String,attribute:"logo-alt"})],o.prototype,"logoAlt",void 0);n([c({type:String,attribute:"logo-href"})],o.prototype,"logoHref",void 0);n([c({type:String,attribute:"logo-src"})],o.prototype,"logoSrc",void 0);n([c({type:String,attribute:"logo-width"})],o.prototype,"logoWidth",void 0);n([c({type:String,attribute:"logo-height"})],o.prototype,"logoHeight",void 0);n([c({type:String,attribute:"logo-aspect-ratio"})],o.prototype,"logoAspectRatio",void 0);n([c({type:Boolean,attribute:"logo-invert-dm",reflect:!0,converter:k})],o.prototype,"logoInvertDm",void 0);n([c({type:Boolean,reflect:!0})],o.prototype,"banner",void 0);n([c({type:String,attribute:"banner-label"})],o.prototype,"bannerLabel",void 0);n([c({type:Array,attribute:"tabs",converter:o._JSON_ARRAY})],o.prototype,"tabs",void 0);n([c({type:Number,attribute:"active-tab"})],o.prototype,"activeTab",void 0);n([c({type:Boolean,attribute:"reserve-tabs",reflect:!0,converter:k})],o.prototype,"reserveTabs",void 0);n([c({type:Number,attribute:"reserve-tabs-count"})],o.prototype,"reserveTabsCount",void 0);n([c({type:String,attribute:"reserve-tabs-widths"})],o.prototype,"reserveTabsWidths",void 0);n([c({type:Boolean,attribute:"layout-pending",reflect:!0,converter:k})],o.prototype,"layoutPending",void 0);n([c({type:Array,attribute:"utility-items",converter:o._JSON_ARRAY})],o.prototype,"utilityItems",void 0);n([c({type:String,attribute:"search-placeholder"})],o.prototype,"searchPlaceholder",void 0);n([c({type:String,attribute:"search-button-label"})],o.prototype,"searchButtonLabel",void 0);n([c({type:String,attribute:"menu-label"})],o.prototype,"menuLabel",void 0);n([c({type:String,attribute:"menu-button-label"})],o.prototype,"menuButtonLabel",void 0);n([c({type:String,attribute:"menu-sub-label"})],o.prototype,"menuSubLabel",void 0);n([c({type:String,attribute:"menu-section-label"})],o.prototype,"menuSectionLabel",void 0);n([c({type:String,attribute:"menu-search-placeholder"})],o.prototype,"menuSearchPlaceholder",void 0);n([c({type:Array,attribute:"menu-data",converter:o._JSON_ARRAY})],o.prototype,"menuData",void 0);n([c({type:Boolean,attribute:"defer-drawer",reflect:!0,converter:k})],o.prototype,"deferDrawer",void 0);n([c({type:Boolean,attribute:"show-drawer",reflect:!0,converter:T})],o.prototype,"showDrawer",void 0);n([c({type:Boolean,attribute:"always-show-menu-button",reflect:!0,converter:k})],o.prototype,"alwaysShowMenuButton",void 0);n([c({type:Boolean,attribute:"show-search",reflect:!0,converter:T})],o.prototype,"showSearch",void 0);n([c({type:Boolean,attribute:"include-utility-in-menu",reflect:!0,converter:k})],o.prototype,"includeUtilityInMenu",void 0);n([c({type:Boolean,attribute:"drawer-overlay",reflect:!0,converter:T})],o.prototype,"drawerOverlay",void 0);n([c({type:String,attribute:"search-max"})],o.prototype,"searchMax",void 0);n([c({type:String,attribute:"search-min"})],o.prototype,"searchMin",void 0);n([c({type:String,attribute:"search-height"})],o.prototype,"searchHeight",void 0);n([c({type:String,attribute:"search-text",reflect:!0})],o.prototype,"searchText",void 0);n([
|
|
806
|
+
`,A);n([c({type:String,attribute:"max-width"})],o.prototype,"maxWidth",void 0);n([c({type:String,reflect:!0})],o.prototype,"spacing",void 0);n([c({type:String,attribute:"spacing-top",reflect:!0})],o.prototype,"spacingTop",void 0);n([c({type:String,attribute:"spacing-bottom",reflect:!0})],o.prototype,"spacingBottom",void 0);n([c({type:String,reflect:!0,converter:D})],o.prototype,"size",void 0);n([c({type:String,attribute:"logo-text"})],o.prototype,"logoText",void 0);n([c({type:String,attribute:"logotype-text"})],o.prototype,"logotypeText",void 0);n([c({type:String,attribute:"logo-alt"})],o.prototype,"logoAlt",void 0);n([c({type:String,attribute:"logo-href"})],o.prototype,"logoHref",void 0);n([c({type:String,attribute:"logo-src"})],o.prototype,"logoSrc",void 0);n([c({type:String,attribute:"logo-width"})],o.prototype,"logoWidth",void 0);n([c({type:String,attribute:"logo-height"})],o.prototype,"logoHeight",void 0);n([c({type:String,attribute:"logo-aspect-ratio"})],o.prototype,"logoAspectRatio",void 0);n([c({type:Boolean,attribute:"logo-invert-dm",reflect:!0,converter:k})],o.prototype,"logoInvertDm",void 0);n([c({type:Boolean,reflect:!0})],o.prototype,"banner",void 0);n([c({type:String,attribute:"banner-label"})],o.prototype,"bannerLabel",void 0);n([c({type:Array,attribute:"tabs",converter:o._JSON_ARRAY})],o.prototype,"tabs",void 0);n([c({type:Number,attribute:"active-tab"})],o.prototype,"activeTab",void 0);n([c({type:Boolean,attribute:"reserve-tabs",reflect:!0,converter:k})],o.prototype,"reserveTabs",void 0);n([c({type:Number,attribute:"reserve-tabs-count"})],o.prototype,"reserveTabsCount",void 0);n([c({type:String,attribute:"reserve-tabs-widths"})],o.prototype,"reserveTabsWidths",void 0);n([c({type:Boolean,attribute:"layout-pending",reflect:!0,converter:k})],o.prototype,"layoutPending",void 0);n([c({type:Array,attribute:"utility-items",converter:o._JSON_ARRAY})],o.prototype,"utilityItems",void 0);n([c({type:String,attribute:"search-placeholder"})],o.prototype,"searchPlaceholder",void 0);n([c({type:String,attribute:"search-button-label"})],o.prototype,"searchButtonLabel",void 0);n([c({type:String,attribute:"menu-label"})],o.prototype,"menuLabel",void 0);n([c({type:String,attribute:"menu-button-label"})],o.prototype,"menuButtonLabel",void 0);n([c({type:String,attribute:"menu-sub-label"})],o.prototype,"menuSubLabel",void 0);n([c({type:String,attribute:"menu-section-label"})],o.prototype,"menuSectionLabel",void 0);n([c({type:String,attribute:"menu-search-placeholder"})],o.prototype,"menuSearchPlaceholder",void 0);n([c({type:Array,attribute:"menu-data",converter:o._JSON_ARRAY})],o.prototype,"menuData",void 0);n([c({type:Boolean,attribute:"defer-drawer",reflect:!0,converter:k})],o.prototype,"deferDrawer",void 0);n([c({type:Boolean,attribute:"show-drawer",reflect:!0,converter:T})],o.prototype,"showDrawer",void 0);n([c({type:Boolean,attribute:"always-show-menu-button",reflect:!0,converter:k})],o.prototype,"alwaysShowMenuButton",void 0);n([c({type:Boolean,attribute:"show-search",reflect:!0,converter:T})],o.prototype,"showSearch",void 0);n([c({type:Boolean,attribute:"include-utility-in-menu",reflect:!0,converter:k})],o.prototype,"includeUtilityInMenu",void 0);n([c({type:Boolean,attribute:"drawer-overlay",reflect:!0,converter:T})],o.prototype,"drawerOverlay",void 0);n([c({type:String,attribute:"search-max"})],o.prototype,"searchMax",void 0);n([c({type:String,attribute:"search-min"})],o.prototype,"searchMin",void 0);n([c({type:String,attribute:"search-height"})],o.prototype,"searchHeight",void 0);n([c({type:String,attribute:"search-text",reflect:!0})],o.prototype,"searchText",void 0);n([S()],o.prototype,"_drawerId",void 0);n([S()],o.prototype,"_menuExpanded",void 0);n([S()],o.prototype,"_searchId",void 0);n([S()],o.prototype,"_drawerReady",void 0);n([S()],o.prototype,"_mobileSearchOpen",void 0);n([S()],o.prototype,"_slotNavItems",void 0);n([S()],o.prototype,"_slotUtils",void 0);n([S()],o.prototype,"_slotMenu",void 0);n([S()],o.prototype,"_collapsed",void 0);n([S()],o.prototype,"_hideLogoText",void 0);o=$=n([I("scb-header")],o);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.64",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -440,5 +440,5 @@
|
|
|
440
440
|
},
|
|
441
441
|
"./mvc/*": "./mvc/*"
|
|
442
442
|
},
|
|
443
|
-
"buildHash": "
|
|
443
|
+
"buildHash": "8B8F38024734AC1E0FEB471BF078B947FDE9D1529DA9147A1AC7504BB8E5A7A9"
|
|
444
444
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare class ScbHeaderUtility extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
static get observedAttributes(): string[];
|
|
2
4
|
get label(): string;
|
|
3
5
|
set label(value: string);
|
|
4
6
|
get href(): string;
|
|
@@ -6,6 +8,7 @@ export declare class ScbHeaderUtility extends HTMLElement {
|
|
|
6
8
|
get target(): '_self' | '_blank' | '_parent' | '_top' | undefined;
|
|
7
9
|
set target(value: '_self' | '_blank' | '_parent' | '_top' | undefined);
|
|
8
10
|
connectedCallback(): void;
|
|
11
|
+
attributeChangedCallback(name: string): void;
|
|
9
12
|
}
|
|
10
13
|
declare global {
|
|
11
14
|
interface HTMLElementTagNameMap {
|
package/scb-footer/scb-footer.js
CHANGED
|
@@ -290,7 +290,7 @@ var o = { fromAttribute(e) {
|
|
|
290
290
|
#f(e, t, n) {
|
|
291
291
|
return r`
|
|
292
292
|
<section class="group ${n ? "group--centered" : ""}" aria-labelledby=${`scb-footer-sec-${t}`}>
|
|
293
|
-
<
|
|
293
|
+
<h2 id=${`scb-footer-sec-${t}`} class="title">${e.title}</h2>
|
|
294
294
|
<ul>
|
|
295
295
|
${e.links.map((e) => r`
|
|
296
296
|
<li>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
//#region src/scb-components/scb-header/scb-header-utility.ts
|
|
2
2
|
var e = class extends HTMLElement {
|
|
3
|
+
static get observedAttributes() {
|
|
4
|
+
return ["role"];
|
|
5
|
+
}
|
|
3
6
|
get label() {
|
|
4
7
|
return this.getAttribute("label") ?? "";
|
|
5
8
|
}
|
|
@@ -19,7 +22,13 @@ var e = class extends HTMLElement {
|
|
|
19
22
|
e == null ? this.removeAttribute("target") : this.setAttribute("target", e);
|
|
20
23
|
}
|
|
21
24
|
connectedCallback() {
|
|
22
|
-
this
|
|
25
|
+
this.#e();
|
|
26
|
+
}
|
|
27
|
+
attributeChangedCallback(e) {
|
|
28
|
+
e === "role" && this.#e();
|
|
29
|
+
}
|
|
30
|
+
#e() {
|
|
31
|
+
this.hasAttribute("role") && this.removeAttribute("role"), this.setAttribute("aria-hidden", "true"), this.style.display = "none";
|
|
23
32
|
}
|
|
24
33
|
};
|
|
25
34
|
customElements.define("scb-header-utility", e);
|
package/scb-header/scb-header.js
CHANGED
|
@@ -129,7 +129,9 @@ var u = {
|
|
|
129
129
|
label: e.getAttribute("label") ?? "",
|
|
130
130
|
href: e.getAttribute("href") ?? void 0,
|
|
131
131
|
icon: e.getAttribute("icon") ?? void 0
|
|
132
|
-
})
|
|
132
|
+
}), s = (e) => {
|
|
133
|
+
e.hasAttribute("role") && e.removeAttribute("role"), e.getAttribute("aria-hidden") !== "true" && e.setAttribute("aria-hidden", "true");
|
|
134
|
+
};
|
|
133
135
|
for (let e of t) {
|
|
134
136
|
let t = e.tagName.toLowerCase();
|
|
135
137
|
if (t === "scb-header-tab") {
|
|
@@ -167,7 +169,7 @@ var u = {
|
|
|
167
169
|
continue;
|
|
168
170
|
}
|
|
169
171
|
if (t === "scb-header-utility") {
|
|
170
|
-
r.push({
|
|
172
|
+
s(e), r.push({
|
|
171
173
|
label: e.getAttribute("label") ?? "",
|
|
172
174
|
href: e.getAttribute("href") ?? "#",
|
|
173
175
|
target: e.getAttribute("target") ?? void 0
|
|
@@ -185,8 +187,8 @@ var u = {
|
|
|
185
187
|
}
|
|
186
188
|
t === "scb-header-menu-item" && i.push(o(e));
|
|
187
189
|
}
|
|
188
|
-
let
|
|
189
|
-
|
|
190
|
+
let c = !this._sameNavItems(this._slotNavItems, n), l = !this._sameUtilityItems(this._slotUtils, r), u = !this._sameMenuNodes(this._slotMenu, i);
|
|
191
|
+
c && (this._slotNavItems = n), l && (this._slotUtils = r), u && (this._slotMenu = i), !this.hasAttribute("active-tab") && a >= 0 && this.activeTab !== a && (this.activeTab = a), (e.scheduleMeasure ?? !0) && queueMicrotask(() => {
|
|
190
192
|
this.updateComplete.then(() => {
|
|
191
193
|
this._scheduleMeasure();
|
|
192
194
|
});
|
|
@@ -898,7 +900,8 @@ var u = {
|
|
|
898
900
|
"target",
|
|
899
901
|
"selected",
|
|
900
902
|
"aria-current",
|
|
901
|
-
"active"
|
|
903
|
+
"active",
|
|
904
|
+
"role"
|
|
902
905
|
], t = (t) => {
|
|
903
906
|
let n = new MutationObserver((e) => {
|
|
904
907
|
this._scheduleHarvest();
|
package/scb-wc.bundle.js
CHANGED
|
@@ -8031,7 +8031,7 @@ var ScbWc=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module
|
|
|
8031
8031
|
</scb-grid-item>
|
|
8032
8032
|
`}#f(e,t,n){return b`
|
|
8033
8033
|
<section class="group ${n?`group--centered`:``}" aria-labelledby=${`scb-footer-sec-${t}`}>
|
|
8034
|
-
<
|
|
8034
|
+
<h2 id=${`scb-footer-sec-${t}`} class="title">${e.title}</h2>
|
|
8035
8035
|
<ul>
|
|
8036
8036
|
${e.links.map(e=>b`
|
|
8037
8037
|
<li>
|
|
@@ -8451,7 +8451,7 @@ var ScbWc=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module
|
|
|
8451
8451
|
:host {
|
|
8452
8452
|
display: none !important;
|
|
8453
8453
|
}
|
|
8454
|
-
`}render(){return b`<slot></slot>`}};P([g({type:String})],au.prototype,`label`,void 0),P([g({type:String})],au.prototype,`href`,void 0),P([g({type:String,attribute:`drawer-id`})],au.prototype,`drawerId`,void 0),au=P([o(`scb-header-tab`)],au);var ou=class extends HTMLElement{get label(){return this.getAttribute(`label`)??``}set label(e){this.setAttribute(`label`,e)}get href(){return this.getAttribute(`href`)??`#`}set href(e){this.setAttribute(`href`,e)}get target(){return this.getAttribute(`target`)??void 0}set target(e){e==null?this.removeAttribute(`target`):this.setAttribute(`target`,e)}connectedCallback(){this.style.display=`none`}};customElements.define(`scb-header-utility`,ou),C(),y(),F();var su=class extends S{constructor(...e){super(...e),this.variant=`rectangular`,this.width=`100%`,this.height=`100%`,this.borderSize=`small`,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0}static{this.styles=m`
|
|
8454
|
+
`}render(){return b`<slot></slot>`}};P([g({type:String})],au.prototype,`label`,void 0),P([g({type:String})],au.prototype,`href`,void 0),P([g({type:String,attribute:`drawer-id`})],au.prototype,`drawerId`,void 0),au=P([o(`scb-header-tab`)],au);var ou=class extends HTMLElement{static get observedAttributes(){return[`role`]}get label(){return this.getAttribute(`label`)??``}set label(e){this.setAttribute(`label`,e)}get href(){return this.getAttribute(`href`)??`#`}set href(e){this.setAttribute(`href`,e)}get target(){return this.getAttribute(`target`)??void 0}set target(e){e==null?this.removeAttribute(`target`):this.setAttribute(`target`,e)}connectedCallback(){this.#e()}attributeChangedCallback(e){e===`role`&&this.#e()}#e(){this.hasAttribute(`role`)&&this.removeAttribute(`role`),this.setAttribute(`aria-hidden`,`true`),this.style.display=`none`}};customElements.define(`scb-header-utility`,ou),C(),y(),F();var su=class extends S{constructor(...e){super(...e),this.variant=`rectangular`,this.width=`100%`,this.height=`100%`,this.borderSize=`small`,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0}static{this.styles=m`
|
|
8455
8455
|
:host {
|
|
8456
8456
|
display: inline-block;
|
|
8457
8457
|
max-width: var(--scb-skeleton-width);
|
|
@@ -8919,7 +8919,7 @@ var ScbWc=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module
|
|
|
8919
8919
|
);
|
|
8920
8920
|
}
|
|
8921
8921
|
}
|
|
8922
|
-
`,document.head.appendChild(e);let t=e=>{let t=String(e??``).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t},n=e=>{let t=String(e??``).trim();if(!t)return!1;try{let e=JSON.parse(t);return Array.isArray(e)&&e.length>0}catch{return!1}},r=e=>e!=null&&!/^(false|0|off|no)$/i.test(e.trim()),i=e=>{for(let t of Array.from(e.children)){let e=t.tagName.toLowerCase();if(e===`scb-header-tab`||e===`scb-dropdown`)return!0}return!1},a=e=>{i(e)||n(e.getAttribute(`tabs`))||r(e.getAttribute(`reserve-tabs`))||r(e.getAttribute(`layout-pending`))?e.setAttribute(`data-pre-has-tabs`,``):e.removeAttribute(`data-pre-has-tabs`);let a=t(e.getAttribute(`spacing`)),o=t(e.getAttribute(`spacing-top`))??a,s=t(e.getAttribute(`spacing-bottom`))??a;o?e.style.setProperty(`--scb-header-spacing-block-start`,o):e.style.removeProperty(`--scb-header-spacing-block-start`),s?e.style.setProperty(`--scb-header-spacing-block-end`,s):e.style.removeProperty(`--scb-header-spacing-block-end`);let c=(e.getAttribute(`logo-width`)??``).trim();c?e.style.setProperty(`--scb-header-pre-logo-w`,c):e.style.removeProperty(`--scb-header-pre-logo-w`);let l=(e.getAttribute(`logo-height`)??``).trim();l?e.style.setProperty(`--scb-header-pre-logo-img-h`,l):e.style.removeProperty(`--scb-header-pre-logo-img-h`);let u=(e.getAttribute(`search-height`)??``).trim();u?e.style.setProperty(`--scb-header-pre-control-size`,u):e.style.removeProperty(`--scb-header-pre-control-size`)};document.querySelectorAll(`scb-header`).forEach(a);let o=new MutationObserver(e=>{for(let t of e){if(t.type===`attributes`){let e=t.target;e instanceof HTMLElement&&e.tagName.toLowerCase()===`scb-header`&&a(e);continue}if(t.type===`childList`){let e=[...Array.from(t.addedNodes),...Array.from(t.removedNodes)];for(let t of e){if(!(t instanceof HTMLElement))continue;if(t.tagName.toLowerCase()===`scb-header`){a(t);continue}let e=t.closest?.(`scb-header`);e&&a(e)}}}});o.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`tabs`,`spacing`,`spacing-top`,`spacing-bottom`,`logo-width`,`logo-height`,`logo-aspect-ratio`,`logo-alt`,`logotype-text`,`search-height`,`reserve-tabs`,`layout-pending`]}),customElements.whenDefined(`scb-header`).then(()=>{o.disconnect()})})();var bu={fromAttribute:e=>e==null?!0:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>String(!!e)},xu={fromAttribute:e=>e==null?!1:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>e?``:null},Su={fromAttribute:e=>e===`small`||e===`large`?e:`medium`,toAttribute:e=>{let t=String(e??``);return t===`small`||t===`large`?t:null}},Y=class extends S{static{vu=this}constructor(){super(),this.maxWidth=`1440px`,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.size=`medium`,this.logoText=``,this.logotypeText=``,this.logoAlt=``,this.logoHref=`/`,this.logoSrc=``,this.logoWidth=``,this.logoHeight=``,this.logoAspectRatio=``,this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel=`Sök`,this.menuButtonLabel=`Meny`,this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText=``,this._drawerId=`main-drawer`,this._menuExpanded=!1,this._searchId=`header-search`,this._drawerReady=!1,this._mobileSearchOpen=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{window.innerWidth>=this.BP_SM&&this._mobileSearchOpen&&this._setMobileSearchOpen(!1),this._scheduleMeasure()},this._onMenuSelect=e=>{let t=e.detail;this.dispatchEvent(new CustomEvent(`scb-menu-select`,{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`scbmenuselect`,{detail:t,bubbles:!0,composed:!0}));let n=t?.item,r=typeof t?.href==`string`?t.href:typeof t?.itemHref==`string`?t.itemHref:typeof t?.item_href==`string`?t.item_href:``,i=n?n.getAttribute(`item-href`)??n.getAttribute(`href`)??``:``;String(r||i||``).trim()&&this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._slotWatchers=[],this._harvestPending=!1,this._harvest=(e={})=>{let t=Array.from(this.children),n=[],r=[],i=[],a=-1,o=e=>({label:e.getAttribute(`label`)??``,href:e.getAttribute(`href`)??void 0,icon:e.getAttribute(`icon`)??void 0});for(let e of t){let t=e.tagName.toLowerCase();if(t===`scb-header-tab`){let t=e.getAttribute(`label`)??``,r=e.getAttribute(`href`),i=r&&r.trim()!==``?r:void 0;(e.hasAttribute(`selected`)||e.getAttribute(`selected`)===`true`||e.getAttribute(`active`)===`true`||e.getAttribute(`aria-current`)===`page`)&&a===-1&&(a=n.length),n.push({kind:`tab`,label:t,href:i});continue}if(t===`scb-badge`){let t=e.querySelector(`scb-dropdown`);if(t){let r=t.getAttribute(`label`)??``;(t.hasAttribute(`selected`)||t.getAttribute(`selected`)===`true`||t.getAttribute(`active`)===`true`||t.getAttribute(`aria-current`)===`page`)&&a===-1&&(a=n.length);let i=`scb-header-tab-${n.length}`;e.getAttribute(`slot`)!==i&&e.setAttribute(`slot`,i),t.hasAttribute(`slot`)&&t.removeAttribute(`slot`),t.hasAttribute(`as-tab`)||t.setAttribute(`as-tab`,``),n.push({kind:`dropdown`,slotName:i,label:r});continue}}if(t===`scb-dropdown`){let t=e.getAttribute(`label`)??``;(e.hasAttribute(`selected`)||e.getAttribute(`selected`)===`true`||e.getAttribute(`active`)===`true`||e.getAttribute(`aria-current`)===`page`)&&a===-1&&(a=n.length);let r=`scb-header-tab-${n.length}`;e.getAttribute(`slot`)!==r&&e.setAttribute(`slot`,r),e.hasAttribute(`as-tab`)||e.setAttribute(`as-tab`,``),n.push({kind:`dropdown`,slotName:r,label:t});continue}if(t===`scb-header-utility`){r.push({label:e.getAttribute(`label`)??``,href:e.getAttribute(`href`)??`#`,target:e.getAttribute(`target`)??void 0});continue}if(t===`scb-header-menu-group`){let t={label:e.getAttribute(`label`)??``,icon:e.getAttribute(`icon`)??void 0,children:[]};e.querySelectorAll(`scb-header-menu-item`).forEach(e=>t.children.push(o(e))),i.push(t);continue}t===`scb-header-menu-item`&&i.push(o(e))}let s=!this._sameNavItems(this._slotNavItems,n),c=!this._sameUtilityItems(this._slotUtils,r),l=!this._sameMenuNodes(this._slotMenu,i);s&&(this._slotNavItems=n),c&&(this._slotUtils=r),l&&(this._slotMenu=i),!this.hasAttribute(`active-tab`)&&a>=0&&this.activeTab!==a&&(this.activeTab=a),(e.scheduleMeasure??!0)&&queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{if(this.layoutPending)return;let e=this._top,t=this._logoGroup;if(!e||!t)return;let n=window.innerWidth,r=e.clientWidth,i=this._overflows(this._util),a=this._tabsOverflows(),o=n<this.BP_MD||i||a;this._collapsed?!o&&r>=this._unlockAtWidth&&this._setCollapsed(!1):o&&(this._unlockAtWidth=r+this._HYST,this._setCollapsed(!0));let s=!1;if(this.showSearch&&n>=this.BP_SM&&n<this.BP_MD&&this._searchWrap){let i=getComputedStyle(this._searchWrap),a=Math.max(this._num(i.minWidth,this._tokenPx(`--scb-header-search-min`,250)),this._tokenPx(`--scb-header-search-min`,250)),o=this._num(getComputedStyle(e).gap,this._tokenPx(`--spacing-7`,24)),c=this.showDrawer&&(this.alwaysShowMenuButton||n<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx(`--icon-size-extra-extra-large`,48):0;s=t.getBoundingClientRect().width+o+a+o+c+8>r+.5}this._setHideSearch(s);let c=!1;if(this.showDrawer&&(this.alwaysShowMenuButton||n<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){let t=this._num(getComputedStyle(e).gap,this._tokenPx(`--spacing-7`,24)),n=this._menuBtn?.getBoundingClientRect().width||this._tokenPx(`--icon-size-extra-extra-large`,48),i=(this._logoGroup?.getBoundingClientRect().width||0)+t+n;this._hideLogoText?c=!(r>=this._logoTextUnlockAt):i>r+.5&&(c=!0,this._logoTextUnlockAt=r+this._HYST)}else c=!1,this._logoTextUnlockAt=0;this._setHideLogoText(c)},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent(`drawer-open`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`draweropen`,{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent(`drawer-close`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`drawerclose`,{bubbles:!0,composed:!0}))},this._onMenuClick=async e=>{this.showDrawer&&(this._setMobileSearchOpen(!1),this.dispatchEvent(new CustomEvent(`menu-click`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`menuclick`,{bubbles:!0,composed:!0})),!this._drawerReady&&(e.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onSearchClick=e=>{let t=this._searchEl;if(t?.submit&&typeof t.submit==`function`){t.submit();return}let n=t?.value??``;this.searchText=n,this.dispatchEvent(new CustomEvent(`search-click`,{detail:{value:n},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchclick`,{detail:{value:n},bubbles:!0,composed:!0})),t?.focus?.()},this._onMobileSearchToggle=()=>{let e=!this._mobileSearchOpen;this._setMobileSearchOpen(e),e&&this.updateComplete.then(()=>{this.renderRoot.querySelector(`.mobile-search-panel scb-search`)?.focus?.()})},this._onTabClick=e=>{let t=e.currentTarget;if(!t)return;let n=t.tagName.toLowerCase()===`a`;if(n&&(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))return;let r=t.getAttribute(`data-index`),i=r==null?0:Number(r),a=this._getNavItems()[i];if(a?.kind===`dropdown`)return;this.activeTab=i;let o=a?.kind===`tab`?a.href??``:``,s=new CustomEvent(`tab-change`,{detail:{index:i,href:o},bubbles:!0,composed:!0,cancelable:!0}),c=new CustomEvent(`tabchange`,{detail:{index:i,href:o},bubbles:!0,composed:!0,cancelable:!0});!(this.dispatchEvent(s)&&this.dispatchEvent(c))&&n&&e.preventDefault()},this._onDropdownTabActivate=e=>{let t=e.detail?.dataIndex,n=typeof t==`number`?t:typeof t==`string`?Number(t):this._readTabIndexFromEvent(e);if(n==null||!Number.isFinite(n))return;let r=this._getNavItems();n<0||n>=r.length||r[n]?.kind===`dropdown`&&(this.activeTab=n,this.dispatchEvent(new CustomEvent(`tab-change`,{detail:{index:n,href:``},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`tabchange`,{detail:{index:n,href:``},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=e=>{let t=e.key;if(t!==`ArrowLeft`&&t!==`ArrowRight`&&t!==`Home`&&t!==`End`)return;let n=this._getNavItems();if(!n.length)return;let r=this._readTabIndexFromEvent(e);if(r==null)return;let i=Math.max(0,Math.min(n.length-1,r));t===`ArrowRight`?i=(i+1)%n.length:t===`ArrowLeft`?i=(i-1+n.length)%n.length:t===`Home`?i=0:t===`End`&&(i=n.length-1),e.preventDefault(),this._focusTabAtIndex(i)},this._onSearchInput=e=>{this.searchText=e.detail?.value??``,this.dispatchEvent(new CustomEvent(`search-input`,{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchinput`,{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`search-text-change`,{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchtextchange`,{detail:{value:this.searchText},bubbles:!0,composed:!0}))},this._onSearchSubmit=e=>{this.searchText=e.detail?.value??``,this.dispatchEvent(new CustomEvent(`search-change`,{detail:{value:this.searchText,active:e.detail?.active},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchchange`,{detail:{value:this.searchText,active:e.detail?.active},bubbles:!0,composed:!0}))},this._onSearchClear=()=>{this.searchText=``,this.dispatchEvent(new CustomEvent(`search-text-change`,{detail:{value:``},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchtextchange`,{detail:{value:``},bubbles:!0,composed:!0}))};let e=++yu;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}static{this._JSON_ARRAY={fromAttribute:e=>{if(e==null||e===``)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}},toAttribute:e=>e==null?null:JSON.stringify(e)}}requestLayout(){this.layoutPending||(this.setAttribute(`data-layout-settling`,``),this.updateComplete.then(()=>{this.isConnected&&(this._measure(),this.removeAttribute(`data-layout-settling`))}))}static{this.BP_SM_DEFAULT=600}static{this.BP_MD_DEFAULT=840}get _HYST(){return this._tokenPx(`--spacing-11`,64)}get BP_SM(){return this._tokenPx(`--bp-sm`,vu.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx(`--bp-md`,vu.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}static{this.styles=m`
|
|
8922
|
+
`,document.head.appendChild(e);let t=e=>{let t=String(e??``).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t},n=e=>{let t=String(e??``).trim();if(!t)return!1;try{let e=JSON.parse(t);return Array.isArray(e)&&e.length>0}catch{return!1}},r=e=>e!=null&&!/^(false|0|off|no)$/i.test(e.trim()),i=e=>{for(let t of Array.from(e.children)){let e=t.tagName.toLowerCase();if(e===`scb-header-tab`||e===`scb-dropdown`)return!0}return!1},a=e=>{i(e)||n(e.getAttribute(`tabs`))||r(e.getAttribute(`reserve-tabs`))||r(e.getAttribute(`layout-pending`))?e.setAttribute(`data-pre-has-tabs`,``):e.removeAttribute(`data-pre-has-tabs`);let a=t(e.getAttribute(`spacing`)),o=t(e.getAttribute(`spacing-top`))??a,s=t(e.getAttribute(`spacing-bottom`))??a;o?e.style.setProperty(`--scb-header-spacing-block-start`,o):e.style.removeProperty(`--scb-header-spacing-block-start`),s?e.style.setProperty(`--scb-header-spacing-block-end`,s):e.style.removeProperty(`--scb-header-spacing-block-end`);let c=(e.getAttribute(`logo-width`)??``).trim();c?e.style.setProperty(`--scb-header-pre-logo-w`,c):e.style.removeProperty(`--scb-header-pre-logo-w`);let l=(e.getAttribute(`logo-height`)??``).trim();l?e.style.setProperty(`--scb-header-pre-logo-img-h`,l):e.style.removeProperty(`--scb-header-pre-logo-img-h`);let u=(e.getAttribute(`search-height`)??``).trim();u?e.style.setProperty(`--scb-header-pre-control-size`,u):e.style.removeProperty(`--scb-header-pre-control-size`)};document.querySelectorAll(`scb-header`).forEach(a);let o=new MutationObserver(e=>{for(let t of e){if(t.type===`attributes`){let e=t.target;e instanceof HTMLElement&&e.tagName.toLowerCase()===`scb-header`&&a(e);continue}if(t.type===`childList`){let e=[...Array.from(t.addedNodes),...Array.from(t.removedNodes)];for(let t of e){if(!(t instanceof HTMLElement))continue;if(t.tagName.toLowerCase()===`scb-header`){a(t);continue}let e=t.closest?.(`scb-header`);e&&a(e)}}}});o.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`tabs`,`spacing`,`spacing-top`,`spacing-bottom`,`logo-width`,`logo-height`,`logo-aspect-ratio`,`logo-alt`,`logotype-text`,`search-height`,`reserve-tabs`,`layout-pending`]}),customElements.whenDefined(`scb-header`).then(()=>{o.disconnect()})})();var bu={fromAttribute:e=>e==null?!0:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>String(!!e)},xu={fromAttribute:e=>e==null?!1:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>e?``:null},Su={fromAttribute:e=>e===`small`||e===`large`?e:`medium`,toAttribute:e=>{let t=String(e??``);return t===`small`||t===`large`?t:null}},Y=class extends S{static{vu=this}constructor(){super(),this.maxWidth=`1440px`,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.size=`medium`,this.logoText=``,this.logotypeText=``,this.logoAlt=``,this.logoHref=`/`,this.logoSrc=``,this.logoWidth=``,this.logoHeight=``,this.logoAspectRatio=``,this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel=`Sök`,this.menuButtonLabel=`Meny`,this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText=``,this._drawerId=`main-drawer`,this._menuExpanded=!1,this._searchId=`header-search`,this._drawerReady=!1,this._mobileSearchOpen=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{window.innerWidth>=this.BP_SM&&this._mobileSearchOpen&&this._setMobileSearchOpen(!1),this._scheduleMeasure()},this._onMenuSelect=e=>{let t=e.detail;this.dispatchEvent(new CustomEvent(`scb-menu-select`,{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`scbmenuselect`,{detail:t,bubbles:!0,composed:!0}));let n=t?.item,r=typeof t?.href==`string`?t.href:typeof t?.itemHref==`string`?t.itemHref:typeof t?.item_href==`string`?t.item_href:``,i=n?n.getAttribute(`item-href`)??n.getAttribute(`href`)??``:``;String(r||i||``).trim()&&this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._slotWatchers=[],this._harvestPending=!1,this._harvest=(e={})=>{let t=Array.from(this.children),n=[],r=[],i=[],a=-1,o=e=>({label:e.getAttribute(`label`)??``,href:e.getAttribute(`href`)??void 0,icon:e.getAttribute(`icon`)??void 0}),s=e=>{e.hasAttribute(`role`)&&e.removeAttribute(`role`),e.getAttribute(`aria-hidden`)!==`true`&&e.setAttribute(`aria-hidden`,`true`)};for(let e of t){let t=e.tagName.toLowerCase();if(t===`scb-header-tab`){let t=e.getAttribute(`label`)??``,r=e.getAttribute(`href`),i=r&&r.trim()!==``?r:void 0;(e.hasAttribute(`selected`)||e.getAttribute(`selected`)===`true`||e.getAttribute(`active`)===`true`||e.getAttribute(`aria-current`)===`page`)&&a===-1&&(a=n.length),n.push({kind:`tab`,label:t,href:i});continue}if(t===`scb-badge`){let t=e.querySelector(`scb-dropdown`);if(t){let r=t.getAttribute(`label`)??``;(t.hasAttribute(`selected`)||t.getAttribute(`selected`)===`true`||t.getAttribute(`active`)===`true`||t.getAttribute(`aria-current`)===`page`)&&a===-1&&(a=n.length);let i=`scb-header-tab-${n.length}`;e.getAttribute(`slot`)!==i&&e.setAttribute(`slot`,i),t.hasAttribute(`slot`)&&t.removeAttribute(`slot`),t.hasAttribute(`as-tab`)||t.setAttribute(`as-tab`,``),n.push({kind:`dropdown`,slotName:i,label:r});continue}}if(t===`scb-dropdown`){let t=e.getAttribute(`label`)??``;(e.hasAttribute(`selected`)||e.getAttribute(`selected`)===`true`||e.getAttribute(`active`)===`true`||e.getAttribute(`aria-current`)===`page`)&&a===-1&&(a=n.length);let r=`scb-header-tab-${n.length}`;e.getAttribute(`slot`)!==r&&e.setAttribute(`slot`,r),e.hasAttribute(`as-tab`)||e.setAttribute(`as-tab`,``),n.push({kind:`dropdown`,slotName:r,label:t});continue}if(t===`scb-header-utility`){s(e),r.push({label:e.getAttribute(`label`)??``,href:e.getAttribute(`href`)??`#`,target:e.getAttribute(`target`)??void 0});continue}if(t===`scb-header-menu-group`){let t={label:e.getAttribute(`label`)??``,icon:e.getAttribute(`icon`)??void 0,children:[]};e.querySelectorAll(`scb-header-menu-item`).forEach(e=>t.children.push(o(e))),i.push(t);continue}t===`scb-header-menu-item`&&i.push(o(e))}let c=!this._sameNavItems(this._slotNavItems,n),l=!this._sameUtilityItems(this._slotUtils,r),u=!this._sameMenuNodes(this._slotMenu,i);c&&(this._slotNavItems=n),l&&(this._slotUtils=r),u&&(this._slotMenu=i),!this.hasAttribute(`active-tab`)&&a>=0&&this.activeTab!==a&&(this.activeTab=a),(e.scheduleMeasure??!0)&&queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{if(this.layoutPending)return;let e=this._top,t=this._logoGroup;if(!e||!t)return;let n=window.innerWidth,r=e.clientWidth,i=this._overflows(this._util),a=this._tabsOverflows(),o=n<this.BP_MD||i||a;this._collapsed?!o&&r>=this._unlockAtWidth&&this._setCollapsed(!1):o&&(this._unlockAtWidth=r+this._HYST,this._setCollapsed(!0));let s=!1;if(this.showSearch&&n>=this.BP_SM&&n<this.BP_MD&&this._searchWrap){let i=getComputedStyle(this._searchWrap),a=Math.max(this._num(i.minWidth,this._tokenPx(`--scb-header-search-min`,250)),this._tokenPx(`--scb-header-search-min`,250)),o=this._num(getComputedStyle(e).gap,this._tokenPx(`--spacing-7`,24)),c=this.showDrawer&&(this.alwaysShowMenuButton||n<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx(`--icon-size-extra-extra-large`,48):0;s=t.getBoundingClientRect().width+o+a+o+c+8>r+.5}this._setHideSearch(s);let c=!1;if(this.showDrawer&&(this.alwaysShowMenuButton||n<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){let t=this._num(getComputedStyle(e).gap,this._tokenPx(`--spacing-7`,24)),n=this._menuBtn?.getBoundingClientRect().width||this._tokenPx(`--icon-size-extra-extra-large`,48),i=(this._logoGroup?.getBoundingClientRect().width||0)+t+n;this._hideLogoText?c=!(r>=this._logoTextUnlockAt):i>r+.5&&(c=!0,this._logoTextUnlockAt=r+this._HYST)}else c=!1,this._logoTextUnlockAt=0;this._setHideLogoText(c)},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent(`drawer-open`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`draweropen`,{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent(`drawer-close`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`drawerclose`,{bubbles:!0,composed:!0}))},this._onMenuClick=async e=>{this.showDrawer&&(this._setMobileSearchOpen(!1),this.dispatchEvent(new CustomEvent(`menu-click`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`menuclick`,{bubbles:!0,composed:!0})),!this._drawerReady&&(e.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onSearchClick=e=>{let t=this._searchEl;if(t?.submit&&typeof t.submit==`function`){t.submit();return}let n=t?.value??``;this.searchText=n,this.dispatchEvent(new CustomEvent(`search-click`,{detail:{value:n},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchclick`,{detail:{value:n},bubbles:!0,composed:!0})),t?.focus?.()},this._onMobileSearchToggle=()=>{let e=!this._mobileSearchOpen;this._setMobileSearchOpen(e),e&&this.updateComplete.then(()=>{this.renderRoot.querySelector(`.mobile-search-panel scb-search`)?.focus?.()})},this._onTabClick=e=>{let t=e.currentTarget;if(!t)return;let n=t.tagName.toLowerCase()===`a`;if(n&&(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))return;let r=t.getAttribute(`data-index`),i=r==null?0:Number(r),a=this._getNavItems()[i];if(a?.kind===`dropdown`)return;this.activeTab=i;let o=a?.kind===`tab`?a.href??``:``,s=new CustomEvent(`tab-change`,{detail:{index:i,href:o},bubbles:!0,composed:!0,cancelable:!0}),c=new CustomEvent(`tabchange`,{detail:{index:i,href:o},bubbles:!0,composed:!0,cancelable:!0});!(this.dispatchEvent(s)&&this.dispatchEvent(c))&&n&&e.preventDefault()},this._onDropdownTabActivate=e=>{let t=e.detail?.dataIndex,n=typeof t==`number`?t:typeof t==`string`?Number(t):this._readTabIndexFromEvent(e);if(n==null||!Number.isFinite(n))return;let r=this._getNavItems();n<0||n>=r.length||r[n]?.kind===`dropdown`&&(this.activeTab=n,this.dispatchEvent(new CustomEvent(`tab-change`,{detail:{index:n,href:``},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`tabchange`,{detail:{index:n,href:``},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=e=>{let t=e.key;if(t!==`ArrowLeft`&&t!==`ArrowRight`&&t!==`Home`&&t!==`End`)return;let n=this._getNavItems();if(!n.length)return;let r=this._readTabIndexFromEvent(e);if(r==null)return;let i=Math.max(0,Math.min(n.length-1,r));t===`ArrowRight`?i=(i+1)%n.length:t===`ArrowLeft`?i=(i-1+n.length)%n.length:t===`Home`?i=0:t===`End`&&(i=n.length-1),e.preventDefault(),this._focusTabAtIndex(i)},this._onSearchInput=e=>{this.searchText=e.detail?.value??``,this.dispatchEvent(new CustomEvent(`search-input`,{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchinput`,{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`search-text-change`,{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchtextchange`,{detail:{value:this.searchText},bubbles:!0,composed:!0}))},this._onSearchSubmit=e=>{this.searchText=e.detail?.value??``,this.dispatchEvent(new CustomEvent(`search-change`,{detail:{value:this.searchText,active:e.detail?.active},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchchange`,{detail:{value:this.searchText,active:e.detail?.active},bubbles:!0,composed:!0}))},this._onSearchClear=()=>{this.searchText=``,this.dispatchEvent(new CustomEvent(`search-text-change`,{detail:{value:``},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`searchtextchange`,{detail:{value:``},bubbles:!0,composed:!0}))};let e=++yu;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}static{this._JSON_ARRAY={fromAttribute:e=>{if(e==null||e===``)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}},toAttribute:e=>e==null?null:JSON.stringify(e)}}requestLayout(){this.layoutPending||(this.setAttribute(`data-layout-settling`,``),this.updateComplete.then(()=>{this.isConnected&&(this._measure(),this.removeAttribute(`data-layout-settling`))}))}static{this.BP_SM_DEFAULT=600}static{this.BP_MD_DEFAULT=840}get _HYST(){return this._tokenPx(`--spacing-11`,64)}get BP_SM(){return this._tokenPx(`--bp-sm`,vu.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx(`--bp-md`,vu.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}static{this.styles=m`
|
|
8923
8923
|
:host {
|
|
8924
8924
|
display: block;
|
|
8925
8925
|
margin-block-start: var(--scb-header-spacing-block-start, 0);
|
|
@@ -9387,7 +9387,7 @@ var ScbWc=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module
|
|
|
9387
9387
|
:host([data-hide-logo-text]) .logo-text {
|
|
9388
9388
|
display: none;
|
|
9389
9389
|
}
|
|
9390
|
-
`}get _top(){return this.renderRoot.querySelector(`.top-row`)}get _util(){return this.renderRoot.querySelector(`.utility`)}get _logoGroup(){return this.renderRoot.querySelector(`.logo-wrap`)||this.renderRoot.querySelector(`.logo-group`)}get _searchWrap(){return this.renderRoot.querySelector(`.search`)}get _menuBtn(){return this.renderRoot.querySelector(`.menu-trigger`)}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}get _tabsNav(){return this.renderRoot.querySelector(`.tabs-nav`)}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[];let e=[`label`,`href`,`icon`,`target`,`selected`,`aria-current`,`active`],t=t=>{let n=new MutationObserver(e=>{this._scheduleHarvest()});this._slotWatchers.push(n),n.observe(t,{attributes:!0,attributeFilter:e})},n=()=>{this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[];let e=Array.from(this.children);for(let r of e){let e=r.tagName.toLowerCase();if((e===`scb-header-tab`||e===`scb-dropdown`||e===`scb-header-utility`||e===`scb-header-menu-item`||e===`scb-header-menu-group`||e===`scb-badge`)&&t(r),e===`scb-badge`){let e=r,i=new MutationObserver(e=>{n(),this._scheduleHarvest()});this._slotWatchers.push(i),i.observe(e,{childList:!0});let a=e.querySelector(`scb-dropdown`);a&&t(a);continue}if(e===`scb-header-menu-group`){let e=r,i=new MutationObserver(e=>{n(),this._scheduleHarvest()});this._slotWatchers.push(i),i.observe(e,{childList:!0,subtree:!0}),e.querySelectorAll(`scb-header-menu-item`).forEach(e=>t(e))}}},r=new MutationObserver(e=>{let t=!1;for(let n of e)if(n.type===`childList`){t=!0;break}t&&n(),this._scheduleHarvest()});this._slotMo=r,r.observe(this,{childList:!0}),n()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.kind!==i.kind||r.label!==i.label)return!1;if(r.kind===`tab`&&i.kind===`tab`){if((r.href??``)!==(i.href??``))return!1}else if(r.kind===`dropdown`&&i.kind===`dropdown`&&r.slotName!==i.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.label!==i.label||r.href!==i.href||(r.target??``)!==(i.target??``))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.label!==i.label||(r.href??``)!==(i.href??``)||(r.icon??``)!==(i.icon??``)||!this._sameMenuNodes(r.children??[],i.children??[]))return!1}return!0}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute(`data-collapsed`,``):this.removeAttribute(`data-collapsed`))}_setHideSearch(e){e?this.setAttribute(`data-hide-search`,``):this.removeAttribute(`data-hide-search`)}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute(`data-hide-logo-text`,``):this.removeAttribute(`data-hide-logo-text`))}_setMobileSearchOpen(e){this._mobileSearchOpen!==e&&(this._mobileSearchOpen=e,this.toggleAttribute(`data-mobile-search-open`,e))}_num(e,t){let n=Number.parseFloat(String(e??``).trim());return Number.isFinite(n)?n:t}_tokenPx(e,t){let n=getComputedStyle(this);return this._num(n.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!==`none`:!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}_tabsOverflows(){let e=this._tabsNav;if(!e||!this._visible(e))return!1;let t=Array.from(e.querySelectorAll(`.tab-wrap`));if(t.length===0)return!1;let n=e.getBoundingClientRect(),r=n.left;for(let e of t){let t=e.getBoundingClientRect();t.width<=0||t.right>r&&(r=t.right)}return r-n.left>n.width+1}connectedCallback(){super.connectedCallback(),this._initialUpgradeComplete||this.setAttribute(`data-upgrading`,``),this._harvest({scheduleMeasure:!1}),this._attachSlotObservers()}_finishInitialUpgrade(){this._initialUpgradeComplete||(this._initialUpgradeComplete=!0,requestAnimationFrame(()=>{this.isConnected&&(this._measure(),this.removeAttribute(`data-upgrading`))}))}firstUpdated(){this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),this.updateComplete.then(()=>{this._harvest({scheduleMeasure:!1}),this._attachSlotObservers(),this._syncDropdownTabs(),this._finishInitialUpgrade()});let e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener(`resize`,this._onWindowResize,{passive:!0})}updated(e){e.has(`searchMax`)&&this.style.setProperty(`--scb-header-search-max`,this.searchMax??`380px`),e.has(`searchMin`)&&this.style.setProperty(`--scb-header-search-min`,this.searchMin??`250px`),e.has(`searchHeight`)&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty(`--scb-search-height`,this.searchHeight.trim()):this.style.removeProperty(`--scb-search-height`)),(e.has(`logoWidth`)||e.has(`logoHeight`)||e.has(`logoAspectRatio`))&&this._applyLogoSizing(),(e.has(`spacing`)||e.has(`spacingTop`)||e.has(`spacingBottom`))&&this._applySpacing(),(e.has(`utilityItems`)||e.has(`tabs`)||e.has(`logoText`)||e.has(`logotypeText`)||e.has(`logoSrc`)||e.has(`logoWidth`)||e.has(`logoHeight`)||e.has(`logoAspectRatio`)||e.has(`activeTab`)||e.has(`_slotNavItems`)||e.has(`_slotUtils`)||e.has(`_slotMenu`)||e.has(`showDrawer`)||e.has(`alwaysShowMenuButton`)||e.has(`showSearch`)||e.has(`layoutPending`)||e.has(`searchMax`)||e.has(`searchMin`)||e.has(`size`))&&this.updateComplete.then(()=>{this._scheduleMeasure()}),(e.has(`showDrawer`)||e.has(`deferDrawer`))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has(`showSearch`)&&!this.showSearch&&this._setMobileSearchOpen(!1),e.has(`layoutPending`)&&!this.layoutPending&&this.requestLayout(),(e.has(`activeTab`)||e.has(`_slotNavItems`)||e.has(`tabs`)||e.has(`size`))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],window.removeEventListener(`resize`,this._onWindowResize),super.disconnectedCallback()}_mapSpacingToken(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_applySpacing(){let e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,n=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty(`--scb-header-spacing-block-start`,t):this.style.removeProperty(`--scb-header-spacing-block-start`),n?this.style.setProperty(`--scb-header-spacing-block-end`,n):this.style.removeProperty(`--scb-header-spacing-block-end`)}_applyLogoSizing(){let e=(this.logoWidth??``).trim(),t=(this.logoHeight??``).trim(),n=(this.logoAspectRatio??``).trim();e?this.style.setProperty(`--scb-header-logo-img-w`,e):this.style.removeProperty(`--scb-header-logo-img-w`),t?this.style.setProperty(`--scb-header-logo-img-h`,t):e?this.style.setProperty(`--scb-header-logo-img-h`,`auto`):this.style.removeProperty(`--scb-header-logo-img-h`),n?this.style.setProperty(`--scb-header-logo-img-aspect-ratio`,n):this.style.removeProperty(`--scb-header-logo-img-aspect-ratio`)}_closeDrawerNow(){let e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1)}_openDrawerNow(){let e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0)}async _ensureDrawerReady(){this._drawerReady||=(this._drawerImportPromise??=Promise.all([Promise.resolve().then(()=>(Il(),Nl)),Promise.resolve().then(()=>(_u(),gu))]).then(()=>void 0),await this._drawerImportPromise,!0)}_syncMenuBtnAria(){this.renderRoot.querySelectorAll(`.menu-trigger`).forEach(e=>{e.setAttribute(`aria-expanded`,String(this._menuExpanded))})}_getNavItems(){return this._slotNavItems.length?this._slotNavItems:(this.tabs??[]).map(e=>({kind:`tab`,...e}))}_getDropdownForSlot(e){let t=this.querySelector(`[slot="${e}"]`);return t?t.tagName.toLowerCase()===`scb-dropdown`?t:t.querySelector(`scb-dropdown`):null}_syncDropdownTabs(){this._getNavItems().forEach((e,t)=>{if(e.kind!==`dropdown`)return;let n=this._getDropdownForSlot(e.slotName);if(!n)return;let r=String(t);n.getAttribute(`data-index`)!==r&&n.setAttribute(`data-index`,r),n.hasAttribute(`as-tab`)||n.setAttribute(`as-tab`,``);let i=this.size,a=n;a?.size!==i&&(a.size=i),t===this.activeTab?n.getAttribute(`aria-current`)!==`page`&&n.setAttribute(`aria-current`,`page`):n.hasAttribute(`aria-current`)&&n.removeAttribute(`aria-current`)})}_readTabIndexFromEvent(e){let t=e.composedPath?e.composedPath():[];for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-index`);if(t==null)continue;let n=Number(t);if(Number.isFinite(n))return n}return null}_focusTabAtIndex(e){let t=this._getNavItems()[e];if(t){if(t.kind===`dropdown`){this._getDropdownForSlot(t.slotName)?.focus?.();return}this.renderRoot.querySelector(`.tab-link[data-index="${e}"]`)?.focus?.()}}_renderMenuNodes(e){return!e||e.length===0?b``:b`${e.map(e=>this._renderMenuNode(e))}`}_renderMenuNode(e){let t=Array.isArray(e.children)&&e.children.length>0,n=(e.href??``).trim(),r=(e.icon??``).trim();return b`
|
|
9390
|
+
`}get _top(){return this.renderRoot.querySelector(`.top-row`)}get _util(){return this.renderRoot.querySelector(`.utility`)}get _logoGroup(){return this.renderRoot.querySelector(`.logo-wrap`)||this.renderRoot.querySelector(`.logo-group`)}get _searchWrap(){return this.renderRoot.querySelector(`.search`)}get _menuBtn(){return this.renderRoot.querySelector(`.menu-trigger`)}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}get _tabsNav(){return this.renderRoot.querySelector(`.tabs-nav`)}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[];let e=[`label`,`href`,`icon`,`target`,`selected`,`aria-current`,`active`,`role`],t=t=>{let n=new MutationObserver(e=>{this._scheduleHarvest()});this._slotWatchers.push(n),n.observe(t,{attributes:!0,attributeFilter:e})},n=()=>{this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[];let e=Array.from(this.children);for(let r of e){let e=r.tagName.toLowerCase();if((e===`scb-header-tab`||e===`scb-dropdown`||e===`scb-header-utility`||e===`scb-header-menu-item`||e===`scb-header-menu-group`||e===`scb-badge`)&&t(r),e===`scb-badge`){let e=r,i=new MutationObserver(e=>{n(),this._scheduleHarvest()});this._slotWatchers.push(i),i.observe(e,{childList:!0});let a=e.querySelector(`scb-dropdown`);a&&t(a);continue}if(e===`scb-header-menu-group`){let e=r,i=new MutationObserver(e=>{n(),this._scheduleHarvest()});this._slotWatchers.push(i),i.observe(e,{childList:!0,subtree:!0}),e.querySelectorAll(`scb-header-menu-item`).forEach(e=>t(e))}}},r=new MutationObserver(e=>{let t=!1;for(let n of e)if(n.type===`childList`){t=!0;break}t&&n(),this._scheduleHarvest()});this._slotMo=r,r.observe(this,{childList:!0}),n()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.kind!==i.kind||r.label!==i.label)return!1;if(r.kind===`tab`&&i.kind===`tab`){if((r.href??``)!==(i.href??``))return!1}else if(r.kind===`dropdown`&&i.kind===`dropdown`&&r.slotName!==i.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.label!==i.label||r.href!==i.href||(r.target??``)!==(i.target??``))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.label!==i.label||(r.href??``)!==(i.href??``)||(r.icon??``)!==(i.icon??``)||!this._sameMenuNodes(r.children??[],i.children??[]))return!1}return!0}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute(`data-collapsed`,``):this.removeAttribute(`data-collapsed`))}_setHideSearch(e){e?this.setAttribute(`data-hide-search`,``):this.removeAttribute(`data-hide-search`)}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute(`data-hide-logo-text`,``):this.removeAttribute(`data-hide-logo-text`))}_setMobileSearchOpen(e){this._mobileSearchOpen!==e&&(this._mobileSearchOpen=e,this.toggleAttribute(`data-mobile-search-open`,e))}_num(e,t){let n=Number.parseFloat(String(e??``).trim());return Number.isFinite(n)?n:t}_tokenPx(e,t){let n=getComputedStyle(this);return this._num(n.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!==`none`:!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}_tabsOverflows(){let e=this._tabsNav;if(!e||!this._visible(e))return!1;let t=Array.from(e.querySelectorAll(`.tab-wrap`));if(t.length===0)return!1;let n=e.getBoundingClientRect(),r=n.left;for(let e of t){let t=e.getBoundingClientRect();t.width<=0||t.right>r&&(r=t.right)}return r-n.left>n.width+1}connectedCallback(){super.connectedCallback(),this._initialUpgradeComplete||this.setAttribute(`data-upgrading`,``),this._harvest({scheduleMeasure:!1}),this._attachSlotObservers()}_finishInitialUpgrade(){this._initialUpgradeComplete||(this._initialUpgradeComplete=!0,requestAnimationFrame(()=>{this.isConnected&&(this._measure(),this.removeAttribute(`data-upgrading`))}))}firstUpdated(){this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),this.updateComplete.then(()=>{this._harvest({scheduleMeasure:!1}),this._attachSlotObservers(),this._syncDropdownTabs(),this._finishInitialUpgrade()});let e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener(`resize`,this._onWindowResize,{passive:!0})}updated(e){e.has(`searchMax`)&&this.style.setProperty(`--scb-header-search-max`,this.searchMax??`380px`),e.has(`searchMin`)&&this.style.setProperty(`--scb-header-search-min`,this.searchMin??`250px`),e.has(`searchHeight`)&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty(`--scb-search-height`,this.searchHeight.trim()):this.style.removeProperty(`--scb-search-height`)),(e.has(`logoWidth`)||e.has(`logoHeight`)||e.has(`logoAspectRatio`))&&this._applyLogoSizing(),(e.has(`spacing`)||e.has(`spacingTop`)||e.has(`spacingBottom`))&&this._applySpacing(),(e.has(`utilityItems`)||e.has(`tabs`)||e.has(`logoText`)||e.has(`logotypeText`)||e.has(`logoSrc`)||e.has(`logoWidth`)||e.has(`logoHeight`)||e.has(`logoAspectRatio`)||e.has(`activeTab`)||e.has(`_slotNavItems`)||e.has(`_slotUtils`)||e.has(`_slotMenu`)||e.has(`showDrawer`)||e.has(`alwaysShowMenuButton`)||e.has(`showSearch`)||e.has(`layoutPending`)||e.has(`searchMax`)||e.has(`searchMin`)||e.has(`size`))&&this.updateComplete.then(()=>{this._scheduleMeasure()}),(e.has(`showDrawer`)||e.has(`deferDrawer`))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has(`showSearch`)&&!this.showSearch&&this._setMobileSearchOpen(!1),e.has(`layoutPending`)&&!this.layoutPending&&this.requestLayout(),(e.has(`activeTab`)||e.has(`_slotNavItems`)||e.has(`tabs`)||e.has(`size`))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],window.removeEventListener(`resize`,this._onWindowResize),super.disconnectedCallback()}_mapSpacingToken(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_applySpacing(){let e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,n=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty(`--scb-header-spacing-block-start`,t):this.style.removeProperty(`--scb-header-spacing-block-start`),n?this.style.setProperty(`--scb-header-spacing-block-end`,n):this.style.removeProperty(`--scb-header-spacing-block-end`)}_applyLogoSizing(){let e=(this.logoWidth??``).trim(),t=(this.logoHeight??``).trim(),n=(this.logoAspectRatio??``).trim();e?this.style.setProperty(`--scb-header-logo-img-w`,e):this.style.removeProperty(`--scb-header-logo-img-w`),t?this.style.setProperty(`--scb-header-logo-img-h`,t):e?this.style.setProperty(`--scb-header-logo-img-h`,`auto`):this.style.removeProperty(`--scb-header-logo-img-h`),n?this.style.setProperty(`--scb-header-logo-img-aspect-ratio`,n):this.style.removeProperty(`--scb-header-logo-img-aspect-ratio`)}_closeDrawerNow(){let e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1)}_openDrawerNow(){let e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0)}async _ensureDrawerReady(){this._drawerReady||=(this._drawerImportPromise??=Promise.all([Promise.resolve().then(()=>(Il(),Nl)),Promise.resolve().then(()=>(_u(),gu))]).then(()=>void 0),await this._drawerImportPromise,!0)}_syncMenuBtnAria(){this.renderRoot.querySelectorAll(`.menu-trigger`).forEach(e=>{e.setAttribute(`aria-expanded`,String(this._menuExpanded))})}_getNavItems(){return this._slotNavItems.length?this._slotNavItems:(this.tabs??[]).map(e=>({kind:`tab`,...e}))}_getDropdownForSlot(e){let t=this.querySelector(`[slot="${e}"]`);return t?t.tagName.toLowerCase()===`scb-dropdown`?t:t.querySelector(`scb-dropdown`):null}_syncDropdownTabs(){this._getNavItems().forEach((e,t)=>{if(e.kind!==`dropdown`)return;let n=this._getDropdownForSlot(e.slotName);if(!n)return;let r=String(t);n.getAttribute(`data-index`)!==r&&n.setAttribute(`data-index`,r),n.hasAttribute(`as-tab`)||n.setAttribute(`as-tab`,``);let i=this.size,a=n;a?.size!==i&&(a.size=i),t===this.activeTab?n.getAttribute(`aria-current`)!==`page`&&n.setAttribute(`aria-current`,`page`):n.hasAttribute(`aria-current`)&&n.removeAttribute(`aria-current`)})}_readTabIndexFromEvent(e){let t=e.composedPath?e.composedPath():[];for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-index`);if(t==null)continue;let n=Number(t);if(Number.isFinite(n))return n}return null}_focusTabAtIndex(e){let t=this._getNavItems()[e];if(t){if(t.kind===`dropdown`){this._getDropdownForSlot(t.slotName)?.focus?.();return}this.renderRoot.querySelector(`.tab-link[data-index="${e}"]`)?.focus?.()}}_renderMenuNodes(e){return!e||e.length===0?b``:b`${e.map(e=>this._renderMenuNode(e))}`}_renderMenuNode(e){let t=Array.isArray(e.children)&&e.children.length>0,n=(e.href??``).trim(),r=(e.icon??``).trim();return b`
|
|
9391
9391
|
<scb-menu-item
|
|
9392
9392
|
label=${e.label}
|
|
9393
9393
|
?selected=${!1}
|