scb-wc 0.1.45 → 0.1.47
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.
|
@@ -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","../scb-chevron/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
|
|
2
|
+
import"../../vendor/vendor-material.js";import{_ as M,b as E,g as P,h as c,m as x,v as f,y as m}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 $}from"../../vendor/preload-helper.js";import"../scb-search/scb-search.js";import"../scb-link/scb-link.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 S,C,I=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,34 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`,document.head.appendChild(b);const e=n=>{const u=String(n??"").trim();if(u)return/^\d+$/.test(u)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(u,10)))})`:u},t=n=>{const u=String(n??"").trim();if(!u)return!1;try{const p=JSON.parse(u);return Array.isArray(p)&&p.length>0}catch{return!1}},s=n=>n!=null&&!/^(false|0|off|no)$/i.test(n.trim()),r=n=>{for(const u of Array.from(n.children)){const p=u.tagName.toLowerCase();if(p==="scb-header-tab"||p==="scb-dropdown")return!0}return!1},i=n=>{r(n)||t(n.getAttribute("tabs"))||s(n.getAttribute("reserve-tabs"))||s(n.getAttribute("layout-pending"))?n.setAttribute("data-pre-has-tabs",""):n.removeAttribute("data-pre-has-tabs");const u=e(n.getAttribute("spacing")),p=e(n.getAttribute("spacing-top"))??u,g=e(n.getAttribute("spacing-bottom"))??u;p?n.style.setProperty("--scb-header-spacing-block-start",p):n.style.removeProperty("--scb-header-spacing-block-start"),g?n.style.setProperty("--scb-header-spacing-block-end",g):n.style.removeProperty("--scb-header-spacing-block-end");const h=(n.getAttribute("logo-width")??"").trim();h?n.style.setProperty("--scb-header-pre-logo-w",h):n.style.removeProperty("--scb-header-pre-logo-w");const y=(n.getAttribute("logo-height")??"").trim();y?n.style.setProperty("--scb-header-pre-logo-img-h",y):n.style.removeProperty("--scb-header-pre-logo-img-h");const m=(n.getAttribute("search-height")??"").trim();m?n.style.setProperty("--scb-header-pre-control-size",m):n.style.removeProperty("--scb-header-pre-control-size")};document.querySelectorAll("scb-header").forEach(i);const d=new MutationObserver(n=>{for(const u of n){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 g of p){if(!(g instanceof HTMLElement))continue;if(g.tagName.toLowerCase()==="scb-header"){i(g);continue}const h=g.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()})};I();var C={fromAttribute:b=>b==null?!0:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>String(!!b)},S={fromAttribute:b=>b==null?!1:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>b?"":null},N={fromAttribute:b=>b==="small"||b==="large"?b:"medium",toAttribute:b=>{const e=String(b??"");return e==="small"||e==="large"?e:null}},o=(x=class extends ${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.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._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=()=>{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 n=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 m=h.getAttribute("label")??"",_=h.getAttribute("href"),A=_&&_.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:m,href:A});continue}if(y==="scb-badge"){const m=h.querySelector("scb-dropdown");if(m){const _=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 A=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==A&&h.setAttribute("slot",A),m.hasAttribute("slot")&&m.removeAttribute("slot"),m.hasAttribute("as-tab")||m.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:A,label:_});continue}}if(y==="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 _=`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:m});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 m={label:h.getAttribute("label")??"",icon:h.getAttribute("icon")??void 0,children:[]};h.querySelectorAll("scb-header-menu-item").forEach(_=>m.children.push(n(_))),a.push(m);continue}y==="scb-header-menu-item"&&a.push(n(h))}const u=!this._sameNavItems(this._slotNavItems,r),p=!this._sameUtilityItems(this._slotUtils,i),g=!this._sameMenuNodes(this._slotMenu,a);u&&(this._slotNavItems=r),p&&(this._slotUtils=i),g&&(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(),n=r<this.BP_MD||a||d;this._collapsed?!n&&i>=this._unlockAtWidth&&this._setCollapsed(!1):n&&(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 g=getComputedStyle(this._searchWrap),h=Math.max(this._num(g.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)),m=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+m+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 g=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)+g+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.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._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 n=d?.kind==="tab"?d.href??"":"",u=new CustomEvent("tab-change",{detail:{index:a,href:n},bubbles:!0,composed:!0,cancelable:!0}),p=new CustomEvent("tabchange",{detail:{index:a,href:n},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=++P;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}requestLayout(){this.layoutPending||(this.setAttribute("data-layout-settling",""),this.updateComplete.then(()=>{requestAnimationFrame(()=>{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",k.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",k.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 n=a,u=new MutationObserver(g=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(n,{childList:!0});const p=n.querySelector("scb-dropdown");p&&t(p);continue}if(d==="scb-header-menu-group"){const n=a,u=new MutationObserver(p=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(n,{childList:!0,subtree:!0}),n.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"))}_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("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([T(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),T(()=>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(){const e=this.renderRoot.querySelector(".menu-trigger");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?v``:v`${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 v`
|
|
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 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 _=(l.getAttribute("logo-height")??"").trim();_?l.style.setProperty("--scb-header-pre-logo-img-h",_):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 y of p){if(!(y instanceof HTMLElement))continue;if(y.tagName.toLowerCase()==="scb-header"){i(y);continue}const h=y.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)},A={fromAttribute:b=>b==null?!1:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>b?"":null},z={fromAttribute:b=>b==="small"||b==="large"?b:"medium",toAttribute:b=>{const e=String(b??"");return e==="small"||e==="large"?e:null}},o=(S=class extends M{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._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=()=>{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 _=h.tagName.toLowerCase();if(_==="scb-header-tab"){const g=h.getAttribute("label")??"",w=h.getAttribute("href"),v=w&&w.trim()!==""?w: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:v});continue}if(_==="scb-badge"){const g=h.querySelector("scb-dropdown");if(g){const w=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 v=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==v&&h.setAttribute("slot",v),g.hasAttribute("slot")&&g.removeAttribute("slot"),g.hasAttribute("as-tab")||g.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:v,label:w});continue}}if(_==="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 w=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==w&&h.setAttribute("slot",w),h.hasAttribute("as-tab")||h.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:w,label:g});continue}if(_==="scb-header-utility"){i.push({label:h.getAttribute("label")??"",href:h.getAttribute("href")??"#",target:h.getAttribute("target")??void 0});continue}if(_==="scb-header-menu-group"){const g={label:h.getAttribute("label")??"",icon:h.getAttribute("icon")??void 0,children:[]};h.querySelectorAll("scb-header-menu-item").forEach(w=>g.children.push(l(w))),a.push(g);continue}_==="scb-header-menu-item"&&a.push(l(h))}const u=!this._sameNavItems(this._slotNavItems,r),p=!this._sameUtilityItems(this._slotUtils,i),y=!this._sameMenuNodes(this._slotMenu,a);u&&(this._slotNavItems=r),p&&(this._slotUtils=i),y&&(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),h=Math.max(this._num(y.minWidth,this._tokenPx("--scb-header-search-min",250)),this._tokenPx("--scb-header-search-min",250)),_=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+_+h+_+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 y=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),h=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48),_=(this._logoGroup?.getBoundingClientRect().width||0)+y+h;this._hideLogoText?p=!(i>=this._logoTextUnlockAt):_>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.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._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=++I;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}requestLayout(){this.layoutPending||(this.setAttribute("data-layout-settling",""),this.updateComplete.then(()=>{requestAnimationFrame(()=>{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",C.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",C.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(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"))}_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("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([$(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),$(()=>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`
|
|
54
54
|
<scb-menu-item
|
|
55
55
|
label=${e.label}
|
|
56
56
|
?selected=${!1}
|
|
57
57
|
leading-icon=${r||f}
|
|
58
58
|
item-href=${s||f}
|
|
59
59
|
>
|
|
60
|
-
${t?
|
|
60
|
+
${t?m`
|
|
61
61
|
<scb-sub-menu label=${e.label}>
|
|
62
62
|
${e.children.map(i=>this._renderMenuNode(i))}
|
|
63
63
|
</scb-sub-menu>
|
|
64
64
|
`:f}
|
|
65
65
|
</scb-menu-item>
|
|
66
|
-
`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}
|
|
66
|
+
`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}_renderMenuButton(e=""){return m`
|
|
67
|
+
<scb-button
|
|
68
|
+
class=${e?`menu-trigger ${e}`:"menu-trigger"}
|
|
69
|
+
variant="text"
|
|
70
|
+
label=${(this.menuButtonLabel??"").trim()||"Meny"}
|
|
71
|
+
icon="menu"
|
|
72
|
+
trailing-icon
|
|
73
|
+
.size=${this.size}
|
|
74
|
+
aria-controls=${this._drawerId}
|
|
75
|
+
aria-haspopup="dialog"
|
|
76
|
+
aria-expanded=${String(this._menuExpanded)}
|
|
77
|
+
title="Öppna meny"
|
|
78
|
+
@click=${this._onMenuClick}
|
|
79
|
+
></scb-button>
|
|
80
|
+
`}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()}`:f,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,h=this.showDrawer&&(y?this.alwaysShowMenuButton||this._collapsed:!0),_=h&&!y,g=h&&y,w=(this.searchButtonLabel??"").trim()||"Sök";return m`
|
|
67
81
|
<slot
|
|
68
82
|
id="data-slot"
|
|
69
83
|
@slotchange=${()=>{this._harvest(),this._attachSlotObservers()}}
|
|
@@ -102,16 +116,16 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
102
116
|
|
|
103
117
|
<div class="actions">
|
|
104
118
|
<nav class="utility" aria-label="Funktionslänkar">
|
|
105
|
-
${t.map(
|
|
119
|
+
${t.map(v=>m`
|
|
106
120
|
<scb-link
|
|
107
|
-
.href=${
|
|
108
|
-
.target=${
|
|
109
|
-
>${
|
|
121
|
+
.href=${v.href}
|
|
122
|
+
.target=${v.target??void 0}
|
|
123
|
+
>${v.label}</scb-link
|
|
110
124
|
>
|
|
111
125
|
`)}
|
|
112
126
|
</nav>
|
|
113
127
|
|
|
114
|
-
${this.showSearch?
|
|
128
|
+
${this.showSearch?m`
|
|
115
129
|
<div class="search" style=${d}>
|
|
116
130
|
<scb-search
|
|
117
131
|
id=${this._searchId}
|
|
@@ -125,27 +139,13 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
125
139
|
></scb-search>
|
|
126
140
|
<scb-button
|
|
127
141
|
variant="filled-tonal"
|
|
128
|
-
label
|
|
142
|
+
label=${w}
|
|
129
143
|
.size=${this.size}
|
|
130
144
|
@click=${this._onSearchClick}
|
|
131
145
|
></scb-button>
|
|
132
146
|
</div>
|
|
133
147
|
`:f}
|
|
134
|
-
${this.
|
|
135
|
-
<scb-button
|
|
136
|
-
class="menu-trigger"
|
|
137
|
-
variant="text"
|
|
138
|
-
label="Meny"
|
|
139
|
-
icon="menu"
|
|
140
|
-
trailing-icon
|
|
141
|
-
.size=${this.size}
|
|
142
|
-
aria-controls=${this._drawerId}
|
|
143
|
-
aria-haspopup="dialog"
|
|
144
|
-
aria-expanded=${String(this._menuExpanded)}
|
|
145
|
-
title="Öppna meny"
|
|
146
|
-
@click=${this._onMenuClick}
|
|
147
|
-
></scb-button>
|
|
148
|
-
`:f}
|
|
148
|
+
${_?this._renderMenuButton():f}
|
|
149
149
|
</div>
|
|
150
150
|
|
|
151
151
|
</div>
|
|
@@ -156,60 +156,64 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
156
156
|
col-span-medium="8"
|
|
157
157
|
col-span-expanded="12"
|
|
158
158
|
>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
<div class="tabs-
|
|
162
|
-
|
|
159
|
+
<div class="tabs-row">
|
|
160
|
+
${l?u?m`
|
|
161
|
+
<div class="tabs-inset">
|
|
162
|
+
<div class="tabs-nav tabs-nav--skeleton" aria-hidden="true">
|
|
163
|
+
${this._renderTabSkeletons()}
|
|
164
|
+
</div>
|
|
163
165
|
</div>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
166
|
+
`:e.length?m`
|
|
167
|
+
<div class="tabs-inset">
|
|
168
|
+
<nav
|
|
169
|
+
class="tabs-nav"
|
|
170
|
+
aria-label="Huvudnavigering"
|
|
171
|
+
@keydown=${this._onTabsKeydown}
|
|
172
|
+
@scb-dropdown-tab-activate=${this._onDropdownTabActivate}
|
|
173
|
+
>
|
|
174
|
+
${e.map((v,k)=>v.kind==="dropdown"?m`
|
|
175
|
+
<div class="tab-wrap">
|
|
176
|
+
<slot name=${v.slotName}></slot>
|
|
177
|
+
</div>
|
|
178
|
+
`:v.href?m`
|
|
179
|
+
<div class="tab-wrap">
|
|
180
|
+
<a
|
|
181
|
+
class="tab-link"
|
|
182
|
+
href=${v.href}
|
|
183
|
+
data-index=${k}
|
|
184
|
+
aria-current=${k===this.activeTab?"page":f}
|
|
185
|
+
@click=${this._onTabClick}
|
|
186
|
+
>
|
|
187
|
+
${v.label}
|
|
188
|
+
</a>
|
|
189
|
+
<md-focus-ring></md-focus-ring>
|
|
190
|
+
</div>
|
|
191
|
+
`:m`
|
|
192
|
+
<div class="tab-wrap">
|
|
193
|
+
<button
|
|
194
|
+
type="button"
|
|
195
|
+
class="tab-link"
|
|
196
|
+
data-index=${k}
|
|
197
|
+
aria-current=${k===this.activeTab?"page":f}
|
|
198
|
+
@click=${this._onTabClick}
|
|
199
|
+
>
|
|
200
|
+
${v.label}
|
|
201
|
+
</button>
|
|
202
|
+
<md-focus-ring></md-focus-ring>
|
|
203
|
+
</div>
|
|
204
|
+
`)}
|
|
205
|
+
</nav>
|
|
206
|
+
</div>
|
|
207
|
+
`:f:f}
|
|
208
|
+
|
|
209
|
+
${g?this._renderMenuButton("menu-trigger--tabs-right"):f}
|
|
210
|
+
</div>
|
|
207
211
|
<div class="divider" role="presentation"></div>
|
|
208
212
|
</scb-grid-item>
|
|
209
213
|
</scb-grid>
|
|
210
214
|
</div>
|
|
211
215
|
|
|
212
|
-
${p?
|
|
216
|
+
${p?m`
|
|
213
217
|
<scb-drawer
|
|
214
218
|
id=${this._drawerId}
|
|
215
219
|
floating
|
|
@@ -224,7 +228,7 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
224
228
|
>
|
|
225
229
|
<slot name="drawer-menu"></slot>
|
|
226
230
|
|
|
227
|
-
${a?f:
|
|
231
|
+
${a?f:m`
|
|
228
232
|
<scb-menu
|
|
229
233
|
.label=${this.menuLabel??""}
|
|
230
234
|
.subLabel=${this.menuSubLabel??""}
|
|
@@ -234,7 +238,7 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
234
238
|
.supportingText=${this.menuSearchPlaceholder??""}
|
|
235
239
|
></scb-search>
|
|
236
240
|
|
|
237
|
-
${this.menuSectionLabel?
|
|
241
|
+
${this.menuSectionLabel?m`
|
|
238
242
|
<scb-menu-section
|
|
239
243
|
.label=${this.menuSectionLabel}
|
|
240
244
|
></scb-menu-section>
|
|
@@ -242,12 +246,12 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
242
246
|
|
|
243
247
|
${this._renderMenuNodes(s)}
|
|
244
248
|
|
|
245
|
-
${this.includeUtilityInMenu&&(t?.length??0)>0?
|
|
249
|
+
${this.includeUtilityInMenu&&(t?.length??0)>0?m`
|
|
246
250
|
<scb-menu-section label=''></scb-menu-section>
|
|
247
|
-
${t.map(
|
|
251
|
+
${t.map(v=>m`
|
|
248
252
|
<scb-menu-item
|
|
249
|
-
label=${
|
|
250
|
-
item-href=${
|
|
253
|
+
label=${v.label}
|
|
254
|
+
item-href=${v.href}
|
|
251
255
|
></scb-menu-item>
|
|
252
256
|
`)}
|
|
253
257
|
`:f}
|
|
@@ -255,7 +259,7 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
255
259
|
`}
|
|
256
260
|
</scb-drawer>
|
|
257
261
|
`:f}
|
|
258
|
-
`}_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
|
|
262
|
+
`}_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 m`${Array.from({length:i},(a,d)=>s[d%s.length]).map(a=>m`<scb-skeleton variant="rounded" width=${a} height="16px"></scb-skeleton>`)}`}_renderLogo(){const e=(this.logoSrc??"").trim();return e?m`<img class="logo" src=${e} alt="" aria-hidden="true" />`:m`
|
|
259
263
|
<svg
|
|
260
264
|
class="logo"
|
|
261
265
|
viewBox="0 0 48 54"
|
|
@@ -289,7 +293,7 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
289
293
|
</clipPath>
|
|
290
294
|
</defs>
|
|
291
295
|
</svg>
|
|
292
|
-
`}},
|
|
296
|
+
`}},C=S,S._JSON_ARRAY={fromAttribute:b=>{if(b==null||b==="")return[];try{const e=JSON.parse(b);return Array.isArray(e)?e:[]}catch{return[]}},toAttribute:b=>b==null?null:JSON.stringify(b)},S.BP_SM_DEFAULT=600,S.BP_MD_DEFAULT=840,S.styles=E`
|
|
293
297
|
:host {
|
|
294
298
|
display: block;
|
|
295
299
|
margin-block-start: var(--scb-header-spacing-block-start, 0);
|
|
@@ -537,16 +541,22 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
537
541
|
color: var(--md-sys-color-on-surface, #1b1b1f);
|
|
538
542
|
--md-sys-color-primary: var(--md-sys-color-on-surface, #1b1b1f);
|
|
539
543
|
}
|
|
544
|
+
|
|
545
|
+
.menu-trigger--tabs-right {
|
|
546
|
+
margin-left: auto;
|
|
547
|
+
}
|
|
548
|
+
|
|
540
549
|
@media (max-width: 839.98px) {
|
|
541
550
|
.menu-trigger {
|
|
542
551
|
display: inline-flex;
|
|
543
552
|
}
|
|
544
553
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
554
|
+
|
|
555
|
+
@media (min-width: 840px) {
|
|
556
|
+
:host([always-show-menu-button]) .menu-trigger,
|
|
557
|
+
:host([data-collapsed]) .menu-trigger {
|
|
558
|
+
display: inline-flex;
|
|
559
|
+
}
|
|
550
560
|
}
|
|
551
561
|
|
|
552
562
|
.search {
|
|
@@ -592,10 +602,27 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
592
602
|
width: fit-content;
|
|
593
603
|
max-width: 100%;
|
|
594
604
|
}
|
|
605
|
+
|
|
606
|
+
.tabs-row {
|
|
607
|
+
display: flex;
|
|
608
|
+
align-items: center;
|
|
609
|
+
min-height: calc(var(--spacing-10, 40px));
|
|
610
|
+
gap: var(--spacing-5, 16px);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.tabs-row .tabs-inset {
|
|
614
|
+
flex: 1 1 auto;
|
|
615
|
+
min-width: 0;
|
|
616
|
+
}
|
|
617
|
+
|
|
595
618
|
@media (max-width: 839.98px) {
|
|
596
619
|
.tabs-inset {
|
|
597
620
|
display: none;
|
|
598
621
|
}
|
|
622
|
+
|
|
623
|
+
.tabs-row {
|
|
624
|
+
min-height: 0;
|
|
625
|
+
}
|
|
599
626
|
}
|
|
600
627
|
|
|
601
628
|
.tabs-nav {
|
|
@@ -696,4 +723,4 @@ import"../../vendor/vendor-material.js";import{_ as $,b as E,g as M,h as c,m as
|
|
|
696
723
|
:host([data-hide-logo-text]) .logo-text {
|
|
697
724
|
display: none;
|
|
698
725
|
}
|
|
699
|
-
`,
|
|
726
|
+
`,S);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:z})],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:A})],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:A})],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:A})],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:A})],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:A})],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:A})],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([x()],o.prototype,"_drawerId",void 0);n([x()],o.prototype,"_menuExpanded",void 0);n([x()],o.prototype,"_searchId",void 0);n([x()],o.prototype,"_drawerReady",void 0);n([x()],o.prototype,"_slotNavItems",void 0);n([x()],o.prototype,"_slotUtils",void 0);n([x()],o.prototype,"_slotMenu",void 0);n([x()],o.prototype,"_collapsed",void 0);n([x()],o.prototype,"_hideLogoText",void 0);o=C=n([P("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.47",
|
|
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": "A2906025A09BC85590D931ED1B6DA4CA25D20CE23D2B1D1F8897945FC5C4C1D7"
|
|
444
444
|
}
|
|
@@ -42,7 +42,9 @@ export declare class ScbHeader extends LitElement {
|
|
|
42
42
|
layoutPending: boolean;
|
|
43
43
|
utilityItems: UtilityItem[];
|
|
44
44
|
searchPlaceholder?: string;
|
|
45
|
+
searchButtonLabel: string;
|
|
45
46
|
menuLabel?: string;
|
|
47
|
+
menuButtonLabel: string;
|
|
46
48
|
menuSubLabel?: string;
|
|
47
49
|
menuSectionLabel?: string;
|
|
48
50
|
menuSearchPlaceholder?: string;
|
|
@@ -137,6 +139,7 @@ export declare class ScbHeader extends LitElement {
|
|
|
137
139
|
private _onSearchInput;
|
|
138
140
|
private _onSearchSubmit;
|
|
139
141
|
private _onSearchClear;
|
|
142
|
+
private _renderMenuButton;
|
|
140
143
|
render(): TemplateResult;
|
|
141
144
|
private _renderTabSkeletons;
|
|
142
145
|
private _renderLogo;
|
package/scb-header/scb-header.js
CHANGED
|
@@ -105,7 +105,7 @@ var u = {
|
|
|
105
105
|
c = this;
|
|
106
106
|
}
|
|
107
107
|
constructor() {
|
|
108
|
-
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.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._initialUpgradeComplete = !1, this._slotNavItems = [], this._slotUtils = [], this._slotMenu = [], this._measureScheduled = !1, this._scheduleMeasure = () => {
|
|
108
|
+
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._initialUpgradeComplete = !1, this._slotNavItems = [], this._slotUtils = [], this._slotMenu = [], this._measureScheduled = !1, this._scheduleMeasure = () => {
|
|
109
109
|
this.layoutPending || this._measureScheduled || (this._measureScheduled = !0, requestAnimationFrame(() => {
|
|
110
110
|
this._measureScheduled = !1, this._measure();
|
|
111
111
|
}));
|
|
@@ -643,16 +643,22 @@ var u = {
|
|
|
643
643
|
color: var(--md-sys-color-on-surface, #1b1b1f);
|
|
644
644
|
--md-sys-color-primary: var(--md-sys-color-on-surface, #1b1b1f);
|
|
645
645
|
}
|
|
646
|
+
|
|
647
|
+
.menu-trigger--tabs-right {
|
|
648
|
+
margin-left: auto;
|
|
649
|
+
}
|
|
650
|
+
|
|
646
651
|
@media (max-width: 839.98px) {
|
|
647
652
|
.menu-trigger {
|
|
648
653
|
display: inline-flex;
|
|
649
654
|
}
|
|
650
655
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
+
|
|
657
|
+
@media (min-width: 840px) {
|
|
658
|
+
:host([always-show-menu-button]) .menu-trigger,
|
|
659
|
+
:host([data-collapsed]) .menu-trigger {
|
|
660
|
+
display: inline-flex;
|
|
661
|
+
}
|
|
656
662
|
}
|
|
657
663
|
|
|
658
664
|
.search {
|
|
@@ -698,10 +704,27 @@ var u = {
|
|
|
698
704
|
width: fit-content;
|
|
699
705
|
max-width: 100%;
|
|
700
706
|
}
|
|
707
|
+
|
|
708
|
+
.tabs-row {
|
|
709
|
+
display: flex;
|
|
710
|
+
align-items: center;
|
|
711
|
+
min-height: calc(var(--spacing-10, 40px));
|
|
712
|
+
gap: var(--spacing-5, 16px);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
.tabs-row .tabs-inset {
|
|
716
|
+
flex: 1 1 auto;
|
|
717
|
+
min-width: 0;
|
|
718
|
+
}
|
|
719
|
+
|
|
701
720
|
@media (max-width: 839.98px) {
|
|
702
721
|
.tabs-inset {
|
|
703
722
|
display: none;
|
|
704
723
|
}
|
|
724
|
+
|
|
725
|
+
.tabs-row {
|
|
726
|
+
min-height: 0;
|
|
727
|
+
}
|
|
705
728
|
}
|
|
706
729
|
|
|
707
730
|
.tabs-nav {
|
|
@@ -989,8 +1012,9 @@ var u = {
|
|
|
989
1012
|
this._drawerReady ||= (this._drawerImportPromise ??= Promise.all([import("../scb-drawer/scb-drawer.js"), import("../scb-menu/scb-menu.js")]).then(() => void 0), await this._drawerImportPromise, !0);
|
|
990
1013
|
}
|
|
991
1014
|
_syncMenuBtnAria() {
|
|
992
|
-
|
|
993
|
-
|
|
1015
|
+
this.renderRoot.querySelectorAll(".menu-trigger").forEach((e) => {
|
|
1016
|
+
e.setAttribute("aria-expanded", String(this._menuExpanded));
|
|
1017
|
+
});
|
|
994
1018
|
}
|
|
995
1019
|
_getNavItems() {
|
|
996
1020
|
return this._slotNavItems.length ? this._slotNavItems : (this.tabs ?? []).map((e) => ({
|
|
@@ -1057,10 +1081,27 @@ var u = {
|
|
|
1057
1081
|
_syncFlags(e, t) {
|
|
1058
1082
|
this.toggleAttribute("data-no-utility", e), this.toggleAttribute("data-no-search", t);
|
|
1059
1083
|
}
|
|
1084
|
+
_renderMenuButton(e = "") {
|
|
1085
|
+
return r`
|
|
1086
|
+
<scb-button
|
|
1087
|
+
class=${e ? `menu-trigger ${e}` : "menu-trigger"}
|
|
1088
|
+
variant="text"
|
|
1089
|
+
label=${(this.menuButtonLabel ?? "").trim() || "Meny"}
|
|
1090
|
+
icon="menu"
|
|
1091
|
+
trailing-icon
|
|
1092
|
+
.size=${this.size}
|
|
1093
|
+
aria-controls=${this._drawerId}
|
|
1094
|
+
aria-haspopup="dialog"
|
|
1095
|
+
aria-expanded=${String(this._menuExpanded)}
|
|
1096
|
+
title="Öppna meny"
|
|
1097
|
+
@click=${this._onMenuClick}
|
|
1098
|
+
></scb-button>
|
|
1099
|
+
`;
|
|
1100
|
+
}
|
|
1060
1101
|
render() {
|
|
1061
1102
|
let e = this._getNavItems(), t = this._slotUtils.length ? this._slotUtils : this.utilityItems, n = this._slotMenu.length ? this._slotMenu : this.menuData ?? [], a = this.logoText || this.logotypeText, o = this.logoAlt || a || "Gå till startsidan", s = this.querySelector("[slot=\"drawer-menu\"]") !== null;
|
|
1062
1103
|
this._syncFlags(t.length === 0, !this.showSearch);
|
|
1063
|
-
let c = this.searchHeight && this.searchHeight.trim() ? `--scb-search-height:${this.searchHeight.trim()}` : i, l = e.length > 0 || this.reserveTabs || this.layoutPending, u = (this.reserveTabs || this.layoutPending) && (this.layoutPending || e.length === 0), d = this.showDrawer && (!this.deferDrawer || this._drawerReady);
|
|
1104
|
+
let c = this.searchHeight && this.searchHeight.trim() ? `--scb-search-height:${this.searchHeight.trim()}` : i, l = e.length > 0 || this.reserveTabs || this.layoutPending, u = (this.reserveTabs || this.layoutPending) && (this.layoutPending || e.length === 0), d = this.showDrawer && (!this.deferDrawer || this._drawerReady), f = typeof window < "u" && window.innerWidth >= this.BP_MD, p = this.showDrawer && (f ? this.alwaysShowMenuButton || this._collapsed : !0), m = p && !f, h = p && f, g = (this.searchButtonLabel ?? "").trim() || "Sök";
|
|
1064
1105
|
return r`
|
|
1065
1106
|
<slot
|
|
1066
1107
|
id="data-slot"
|
|
@@ -1125,27 +1166,13 @@ var u = {
|
|
|
1125
1166
|
></scb-search>
|
|
1126
1167
|
<scb-button
|
|
1127
1168
|
variant="filled-tonal"
|
|
1128
|
-
label
|
|
1169
|
+
label=${g}
|
|
1129
1170
|
.size=${this.size}
|
|
1130
1171
|
@click=${this._onSearchClick}
|
|
1131
1172
|
></scb-button>
|
|
1132
1173
|
</div>
|
|
1133
1174
|
` : i}
|
|
1134
|
-
${this.
|
|
1135
|
-
<scb-button
|
|
1136
|
-
class="menu-trigger"
|
|
1137
|
-
variant="text"
|
|
1138
|
-
label="Meny"
|
|
1139
|
-
icon="menu"
|
|
1140
|
-
trailing-icon
|
|
1141
|
-
.size=${this.size}
|
|
1142
|
-
aria-controls=${this._drawerId}
|
|
1143
|
-
aria-haspopup="dialog"
|
|
1144
|
-
aria-expanded=${String(this._menuExpanded)}
|
|
1145
|
-
title="Öppna meny"
|
|
1146
|
-
@click=${this._onMenuClick}
|
|
1147
|
-
></scb-button>
|
|
1148
|
-
` : i}
|
|
1175
|
+
${m ? this._renderMenuButton() : i}
|
|
1149
1176
|
</div>
|
|
1150
1177
|
|
|
1151
1178
|
</div>
|
|
@@ -1156,54 +1183,58 @@ var u = {
|
|
|
1156
1183
|
col-span-medium="8"
|
|
1157
1184
|
col-span-expanded="12"
|
|
1158
1185
|
>
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
<div class="tabs-
|
|
1162
|
-
|
|
1186
|
+
<div class="tabs-row">
|
|
1187
|
+
${l ? u ? r`
|
|
1188
|
+
<div class="tabs-inset">
|
|
1189
|
+
<div class="tabs-nav tabs-nav--skeleton" aria-hidden="true">
|
|
1190
|
+
${this._renderTabSkeletons()}
|
|
1191
|
+
</div>
|
|
1163
1192
|
</div>
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1193
|
+
` : e.length ? r`
|
|
1194
|
+
<div class="tabs-inset">
|
|
1195
|
+
<nav
|
|
1196
|
+
class="tabs-nav"
|
|
1197
|
+
aria-label="Huvudnavigering"
|
|
1198
|
+
@keydown=${this._onTabsKeydown}
|
|
1199
|
+
@scb-dropdown-tab-activate=${this._onDropdownTabActivate}
|
|
1200
|
+
>
|
|
1201
|
+
${e.map((e, t) => e.kind === "dropdown" ? r`
|
|
1202
|
+
<div class="tab-wrap">
|
|
1203
|
+
<slot name=${e.slotName}></slot>
|
|
1204
|
+
</div>
|
|
1205
|
+
` : e.href ? r`
|
|
1206
|
+
<div class="tab-wrap">
|
|
1207
|
+
<a
|
|
1208
|
+
class="tab-link"
|
|
1209
|
+
href=${e.href}
|
|
1210
|
+
data-index=${t}
|
|
1211
|
+
aria-current=${t === this.activeTab ? "page" : i}
|
|
1212
|
+
@click=${this._onTabClick}
|
|
1213
|
+
>
|
|
1214
|
+
${e.label}
|
|
1215
|
+
</a>
|
|
1216
|
+
<md-focus-ring></md-focus-ring>
|
|
1217
|
+
</div>
|
|
1218
|
+
` : r`
|
|
1219
|
+
<div class="tab-wrap">
|
|
1220
|
+
<button
|
|
1221
|
+
type="button"
|
|
1222
|
+
class="tab-link"
|
|
1223
|
+
data-index=${t}
|
|
1224
|
+
aria-current=${t === this.activeTab ? "page" : i}
|
|
1225
|
+
@click=${this._onTabClick}
|
|
1226
|
+
>
|
|
1227
|
+
${e.label}
|
|
1228
|
+
</button>
|
|
1229
|
+
<md-focus-ring></md-focus-ring>
|
|
1230
|
+
</div>
|
|
1231
|
+
`)}
|
|
1232
|
+
</nav>
|
|
1233
|
+
</div>
|
|
1234
|
+
` : i : i}
|
|
1235
|
+
|
|
1236
|
+
${h ? this._renderMenuButton("menu-trigger--tabs-right") : i}
|
|
1237
|
+
</div>
|
|
1207
1238
|
<div class="divider" role="presentation"></div>
|
|
1208
1239
|
</scb-grid-item>
|
|
1209
1240
|
</scb-grid>
|
|
@@ -1389,9 +1420,15 @@ e([o({
|
|
|
1389
1420
|
type: String,
|
|
1390
1421
|
attribute: "search-placeholder"
|
|
1391
1422
|
})], p.prototype, "searchPlaceholder", void 0), e([o({
|
|
1423
|
+
type: String,
|
|
1424
|
+
attribute: "search-button-label"
|
|
1425
|
+
})], p.prototype, "searchButtonLabel", void 0), e([o({
|
|
1392
1426
|
type: String,
|
|
1393
1427
|
attribute: "menu-label"
|
|
1394
1428
|
})], p.prototype, "menuLabel", void 0), e([o({
|
|
1429
|
+
type: String,
|
|
1430
|
+
attribute: "menu-button-label"
|
|
1431
|
+
})], p.prototype, "menuButtonLabel", void 0), e([o({
|
|
1395
1432
|
type: String,
|
|
1396
1433
|
attribute: "menu-sub-label"
|
|
1397
1434
|
})], p.prototype, "menuSubLabel", void 0), e([o({
|
package/scb-wc.bundle.js
CHANGED
|
@@ -8919,7 +8919,7 @@
|
|
|
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 yu={fromAttribute:e=>e==null?!0:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>String(!!e)},bu={fromAttribute:e=>e==null?!1:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>e?``:null},xu={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{_u=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.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._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=()=>{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.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._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=++vu;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(()=>{requestAnimationFrame(()=>{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`,_u.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx(`--bp-md`,_u.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}static{this.styles=p`
|
|
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 yu={fromAttribute:e=>e==null?!0:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>String(!!e)},bu={fromAttribute:e=>e==null?!1:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>e?``:null},xu={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{_u=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._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=()=>{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.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._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=++vu;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(()=>{requestAnimationFrame(()=>{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`,_u.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx(`--bp-md`,_u.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}static{this.styles=p`
|
|
8923
8923
|
:host {
|
|
8924
8924
|
display: block;
|
|
8925
8925
|
margin-block-start: var(--scb-header-spacing-block-start, 0);
|
|
@@ -9167,16 +9167,22 @@
|
|
|
9167
9167
|
color: var(--md-sys-color-on-surface, #1b1b1f);
|
|
9168
9168
|
--md-sys-color-primary: var(--md-sys-color-on-surface, #1b1b1f);
|
|
9169
9169
|
}
|
|
9170
|
+
|
|
9171
|
+
.menu-trigger--tabs-right {
|
|
9172
|
+
margin-left: auto;
|
|
9173
|
+
}
|
|
9174
|
+
|
|
9170
9175
|
@media (max-width: 839.98px) {
|
|
9171
9176
|
.menu-trigger {
|
|
9172
9177
|
display: inline-flex;
|
|
9173
9178
|
}
|
|
9174
9179
|
}
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
+
|
|
9181
|
+
@media (min-width: 840px) {
|
|
9182
|
+
:host([always-show-menu-button]) .menu-trigger,
|
|
9183
|
+
:host([data-collapsed]) .menu-trigger {
|
|
9184
|
+
display: inline-flex;
|
|
9185
|
+
}
|
|
9180
9186
|
}
|
|
9181
9187
|
|
|
9182
9188
|
.search {
|
|
@@ -9222,10 +9228,27 @@
|
|
|
9222
9228
|
width: fit-content;
|
|
9223
9229
|
max-width: 100%;
|
|
9224
9230
|
}
|
|
9231
|
+
|
|
9232
|
+
.tabs-row {
|
|
9233
|
+
display: flex;
|
|
9234
|
+
align-items: center;
|
|
9235
|
+
min-height: calc(var(--spacing-10, 40px));
|
|
9236
|
+
gap: var(--spacing-5, 16px);
|
|
9237
|
+
}
|
|
9238
|
+
|
|
9239
|
+
.tabs-row .tabs-inset {
|
|
9240
|
+
flex: 1 1 auto;
|
|
9241
|
+
min-width: 0;
|
|
9242
|
+
}
|
|
9243
|
+
|
|
9225
9244
|
@media (max-width: 839.98px) {
|
|
9226
9245
|
.tabs-inset {
|
|
9227
9246
|
display: none;
|
|
9228
9247
|
}
|
|
9248
|
+
|
|
9249
|
+
.tabs-row {
|
|
9250
|
+
min-height: 0;
|
|
9251
|
+
}
|
|
9229
9252
|
}
|
|
9230
9253
|
|
|
9231
9254
|
.tabs-nav {
|
|
@@ -9326,7 +9349,7 @@
|
|
|
9326
9349
|
:host([data-hide-logo-text]) .logo-text {
|
|
9327
9350
|
display: none;
|
|
9328
9351
|
}
|
|
9329
|
-
`}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`))}_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(`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(()=>(Fl(),Ml)),Promise.resolve().then(()=>(gu(),hu))]).then(()=>void 0),await this._drawerImportPromise,!0)}_syncMenuBtnAria(){
|
|
9352
|
+
`}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`))}_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(`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(()=>(Fl(),Ml)),Promise.resolve().then(()=>(gu(),hu))]).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`
|
|
9330
9353
|
<scb-menu-item
|
|
9331
9354
|
label=${e.label}
|
|
9332
9355
|
?selected=${!1}
|
|
@@ -9339,7 +9362,21 @@
|
|
|
9339
9362
|
</scb-sub-menu>
|
|
9340
9363
|
`:x}
|
|
9341
9364
|
</scb-menu-item>
|
|
9342
|
-
`}_syncFlags(e,t){this.toggleAttribute(`data-no-utility`,e),this.toggleAttribute(`data-no-search`,t)}
|
|
9365
|
+
`}_syncFlags(e,t){this.toggleAttribute(`data-no-utility`,e),this.toggleAttribute(`data-no-search`,t)}_renderMenuButton(e=``){return b`
|
|
9366
|
+
<scb-button
|
|
9367
|
+
class=${e?`menu-trigger ${e}`:`menu-trigger`}
|
|
9368
|
+
variant="text"
|
|
9369
|
+
label=${(this.menuButtonLabel??``).trim()||`Meny`}
|
|
9370
|
+
icon="menu"
|
|
9371
|
+
trailing-icon
|
|
9372
|
+
.size=${this.size}
|
|
9373
|
+
aria-controls=${this._drawerId}
|
|
9374
|
+
aria-haspopup="dialog"
|
|
9375
|
+
aria-expanded=${String(this._menuExpanded)}
|
|
9376
|
+
title="Öppna meny"
|
|
9377
|
+
@click=${this._onMenuClick}
|
|
9378
|
+
></scb-button>
|
|
9379
|
+
`}render(){let e=this._getNavItems(),t=this._slotUtils.length?this._slotUtils:this.utilityItems,n=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);let o=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:x,s=e.length>0||this.reserveTabs||this.layoutPending,c=(this.reserveTabs||this.layoutPending)&&(this.layoutPending||e.length===0),l=this.showDrawer&&(!this.deferDrawer||this._drawerReady),u=typeof window<`u`&&window.innerWidth>=this.BP_MD,d=this.showDrawer&&(u?this.alwaysShowMenuButton||this._collapsed:!0),f=d&&!u,p=d&&u,m=(this.searchButtonLabel??``).trim()||`Sök`;return b`
|
|
9343
9380
|
<slot
|
|
9344
9381
|
id="data-slot"
|
|
9345
9382
|
@slotchange=${()=>{this._harvest(),this._attachSlotObservers()}}
|
|
@@ -9401,27 +9438,13 @@
|
|
|
9401
9438
|
></scb-search>
|
|
9402
9439
|
<scb-button
|
|
9403
9440
|
variant="filled-tonal"
|
|
9404
|
-
label
|
|
9441
|
+
label=${m}
|
|
9405
9442
|
.size=${this.size}
|
|
9406
9443
|
@click=${this._onSearchClick}
|
|
9407
9444
|
></scb-button>
|
|
9408
9445
|
</div>
|
|
9409
9446
|
`:x}
|
|
9410
|
-
${this.
|
|
9411
|
-
<scb-button
|
|
9412
|
-
class="menu-trigger"
|
|
9413
|
-
variant="text"
|
|
9414
|
-
label="Meny"
|
|
9415
|
-
icon="menu"
|
|
9416
|
-
trailing-icon
|
|
9417
|
-
.size=${this.size}
|
|
9418
|
-
aria-controls=${this._drawerId}
|
|
9419
|
-
aria-haspopup="dialog"
|
|
9420
|
-
aria-expanded=${String(this._menuExpanded)}
|
|
9421
|
-
title="Öppna meny"
|
|
9422
|
-
@click=${this._onMenuClick}
|
|
9423
|
-
></scb-button>
|
|
9424
|
-
`:x}
|
|
9447
|
+
${f?this._renderMenuButton():x}
|
|
9425
9448
|
</div>
|
|
9426
9449
|
|
|
9427
9450
|
</div>
|
|
@@ -9432,54 +9455,58 @@
|
|
|
9432
9455
|
col-span-medium="8"
|
|
9433
9456
|
col-span-expanded="12"
|
|
9434
9457
|
>
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
<div class="tabs-
|
|
9438
|
-
|
|
9458
|
+
<div class="tabs-row">
|
|
9459
|
+
${s?c?b`
|
|
9460
|
+
<div class="tabs-inset">
|
|
9461
|
+
<div class="tabs-nav tabs-nav--skeleton" aria-hidden="true">
|
|
9462
|
+
${this._renderTabSkeletons()}
|
|
9463
|
+
</div>
|
|
9439
9464
|
</div>
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9465
|
+
`:e.length?b`
|
|
9466
|
+
<div class="tabs-inset">
|
|
9467
|
+
<nav
|
|
9468
|
+
class="tabs-nav"
|
|
9469
|
+
aria-label="Huvudnavigering"
|
|
9470
|
+
@keydown=${this._onTabsKeydown}
|
|
9471
|
+
@scb-dropdown-tab-activate=${this._onDropdownTabActivate}
|
|
9472
|
+
>
|
|
9473
|
+
${e.map((e,t)=>e.kind===`dropdown`?b`
|
|
9474
|
+
<div class="tab-wrap">
|
|
9475
|
+
<slot name=${e.slotName}></slot>
|
|
9476
|
+
</div>
|
|
9477
|
+
`:e.href?b`
|
|
9478
|
+
<div class="tab-wrap">
|
|
9479
|
+
<a
|
|
9480
|
+
class="tab-link"
|
|
9481
|
+
href=${e.href}
|
|
9482
|
+
data-index=${t}
|
|
9483
|
+
aria-current=${t===this.activeTab?`page`:x}
|
|
9484
|
+
@click=${this._onTabClick}
|
|
9485
|
+
>
|
|
9486
|
+
${e.label}
|
|
9487
|
+
</a>
|
|
9488
|
+
<md-focus-ring></md-focus-ring>
|
|
9489
|
+
</div>
|
|
9490
|
+
`:b`
|
|
9491
|
+
<div class="tab-wrap">
|
|
9492
|
+
<button
|
|
9493
|
+
type="button"
|
|
9494
|
+
class="tab-link"
|
|
9495
|
+
data-index=${t}
|
|
9496
|
+
aria-current=${t===this.activeTab?`page`:x}
|
|
9497
|
+
@click=${this._onTabClick}
|
|
9498
|
+
>
|
|
9499
|
+
${e.label}
|
|
9500
|
+
</button>
|
|
9501
|
+
<md-focus-ring></md-focus-ring>
|
|
9502
|
+
</div>
|
|
9503
|
+
`)}
|
|
9504
|
+
</nav>
|
|
9505
|
+
</div>
|
|
9506
|
+
`:x:x}
|
|
9507
|
+
|
|
9508
|
+
${p?this._renderMenuButton(`menu-trigger--tabs-right`):x}
|
|
9509
|
+
</div>
|
|
9483
9510
|
<div class="divider" role="presentation"></div>
|
|
9484
9511
|
</scb-grid-item>
|
|
9485
9512
|
</scb-grid>
|
|
@@ -9565,7 +9592,7 @@
|
|
|
9565
9592
|
</clipPath>
|
|
9566
9593
|
</defs>
|
|
9567
9594
|
</svg>
|
|
9568
|
-
`}};P([g({type:String,attribute:`max-width`})],Y.prototype,`maxWidth`,void 0),P([g({type:String,reflect:!0})],Y.prototype,`spacing`,void 0),P([g({type:String,attribute:`spacing-top`,reflect:!0})],Y.prototype,`spacingTop`,void 0),P([g({type:String,attribute:`spacing-bottom`,reflect:!0})],Y.prototype,`spacingBottom`,void 0),P([g({type:String,reflect:!0,converter:xu})],Y.prototype,`size`,void 0),P([g({type:String,attribute:`logo-text`})],Y.prototype,`logoText`,void 0),P([g({type:String,attribute:`logotype-text`})],Y.prototype,`logotypeText`,void 0),P([g({type:String,attribute:`logo-alt`})],Y.prototype,`logoAlt`,void 0),P([g({type:String,attribute:`logo-href`})],Y.prototype,`logoHref`,void 0),P([g({type:String,attribute:`logo-src`})],Y.prototype,`logoSrc`,void 0),P([g({type:String,attribute:`logo-width`})],Y.prototype,`logoWidth`,void 0),P([g({type:String,attribute:`logo-height`})],Y.prototype,`logoHeight`,void 0),P([g({type:String,attribute:`logo-aspect-ratio`})],Y.prototype,`logoAspectRatio`,void 0),P([g({type:Boolean,attribute:`logo-invert-dm`,reflect:!0,converter:bu})],Y.prototype,`logoInvertDm`,void 0),P([g({type:Boolean,reflect:!0})],Y.prototype,`banner`,void 0),P([g({type:String,attribute:`banner-label`})],Y.prototype,`bannerLabel`,void 0),P([g({type:Array,attribute:`tabs`,converter:Y._JSON_ARRAY})],Y.prototype,`tabs`,void 0),P([g({type:Number,attribute:`active-tab`})],Y.prototype,`activeTab`,void 0),P([g({type:Boolean,attribute:`reserve-tabs`,reflect:!0,converter:bu})],Y.prototype,`reserveTabs`,void 0),P([g({type:Number,attribute:`reserve-tabs-count`})],Y.prototype,`reserveTabsCount`,void 0),P([g({type:String,attribute:`reserve-tabs-widths`})],Y.prototype,`reserveTabsWidths`,void 0),P([g({type:Boolean,attribute:`layout-pending`,reflect:!0,converter:bu})],Y.prototype,`layoutPending`,void 0),P([g({type:Array,attribute:`utility-items`,converter:Y._JSON_ARRAY})],Y.prototype,`utilityItems`,void 0),P([g({type:String,attribute:`search-placeholder`})],Y.prototype,`searchPlaceholder`,void 0),P([g({type:String,attribute:`menu-label`})],Y.prototype,`menuLabel`,void 0),P([g({type:String,attribute:`menu-sub-label`})],Y.prototype,`menuSubLabel`,void 0),P([g({type:String,attribute:`menu-section-label`})],Y.prototype,`menuSectionLabel`,void 0),P([g({type:String,attribute:`menu-search-placeholder`})],Y.prototype,`menuSearchPlaceholder`,void 0),P([g({type:Array,attribute:`menu-data`,converter:Y._JSON_ARRAY})],Y.prototype,`menuData`,void 0),P([g({type:Boolean,attribute:`defer-drawer`,reflect:!0,converter:bu})],Y.prototype,`deferDrawer`,void 0),P([g({type:Boolean,attribute:`show-drawer`,reflect:!0,converter:yu})],Y.prototype,`showDrawer`,void 0),P([g({type:Boolean,attribute:`always-show-menu-button`,reflect:!0,converter:bu})],Y.prototype,`alwaysShowMenuButton`,void 0),P([g({type:Boolean,attribute:`show-search`,reflect:!0,converter:yu})],Y.prototype,`showSearch`,void 0),P([g({type:Boolean,attribute:`include-utility-in-menu`,reflect:!0,converter:bu})],Y.prototype,`includeUtilityInMenu`,void 0),P([g({type:Boolean,attribute:`drawer-overlay`,reflect:!0,converter:yu})],Y.prototype,`drawerOverlay`,void 0),P([g({type:String,attribute:`search-max`})],Y.prototype,`searchMax`,void 0),P([g({type:String,attribute:`search-min`})],Y.prototype,`searchMin`,void 0),P([g({type:String,attribute:`search-height`})],Y.prototype,`searchHeight`,void 0),P([g({type:String,attribute:`search-text`,reflect:!0})],Y.prototype,`searchText`,void 0),P([_()],Y.prototype,`_drawerId`,void 0),P([_()],Y.prototype,`_menuExpanded`,void 0),P([_()],Y.prototype,`_searchId`,void 0),P([_()],Y.prototype,`_drawerReady`,void 0),P([_()],Y.prototype,`_slotNavItems`,void 0),P([_()],Y.prototype,`_slotUtils`,void 0),P([_()],Y.prototype,`_slotMenu`,void 0),P([_()],Y.prototype,`_collapsed`,void 0),P([_()],Y.prototype,`_hideLogoText`,void 0),Y=_u=P([a(`scb-header`)],Y),C(),y(),w(),F();var Su,Cu={fromAttribute:e=>e??``,toAttribute:e=>typeof e==`string`?e.trim()===``?null:e:null},X=class extends S{static{Su=this}constructor(...e){super(...e),this.keyfigure=0,this.subtitle=``,this.supportingText=``,this.cardHref=``,this.href=``,this.icon=``,this.size=`large`,this.unit=``,this.width=``,this.maxWidth=``,this.height=``,this.maxHeight=``,this.sizing=``,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.__onKeyDown=e=>{let t=this.__effectiveHref;(e.key===`Enter`||e.key===` `)&&t&&(e.preventDefault(),this.__navigate(t,e))},this.__handleHrefNavigation=e=>{let t=this.__effectiveHref;t&&(e.target.closest(`a`)||this.__navigate(t,e))}}static{this.__iconLoaded=!1}static{this.__rippleLoaded=!1}static{this.styles=p`
|
|
9595
|
+
`}};P([g({type:String,attribute:`max-width`})],Y.prototype,`maxWidth`,void 0),P([g({type:String,reflect:!0})],Y.prototype,`spacing`,void 0),P([g({type:String,attribute:`spacing-top`,reflect:!0})],Y.prototype,`spacingTop`,void 0),P([g({type:String,attribute:`spacing-bottom`,reflect:!0})],Y.prototype,`spacingBottom`,void 0),P([g({type:String,reflect:!0,converter:xu})],Y.prototype,`size`,void 0),P([g({type:String,attribute:`logo-text`})],Y.prototype,`logoText`,void 0),P([g({type:String,attribute:`logotype-text`})],Y.prototype,`logotypeText`,void 0),P([g({type:String,attribute:`logo-alt`})],Y.prototype,`logoAlt`,void 0),P([g({type:String,attribute:`logo-href`})],Y.prototype,`logoHref`,void 0),P([g({type:String,attribute:`logo-src`})],Y.prototype,`logoSrc`,void 0),P([g({type:String,attribute:`logo-width`})],Y.prototype,`logoWidth`,void 0),P([g({type:String,attribute:`logo-height`})],Y.prototype,`logoHeight`,void 0),P([g({type:String,attribute:`logo-aspect-ratio`})],Y.prototype,`logoAspectRatio`,void 0),P([g({type:Boolean,attribute:`logo-invert-dm`,reflect:!0,converter:bu})],Y.prototype,`logoInvertDm`,void 0),P([g({type:Boolean,reflect:!0})],Y.prototype,`banner`,void 0),P([g({type:String,attribute:`banner-label`})],Y.prototype,`bannerLabel`,void 0),P([g({type:Array,attribute:`tabs`,converter:Y._JSON_ARRAY})],Y.prototype,`tabs`,void 0),P([g({type:Number,attribute:`active-tab`})],Y.prototype,`activeTab`,void 0),P([g({type:Boolean,attribute:`reserve-tabs`,reflect:!0,converter:bu})],Y.prototype,`reserveTabs`,void 0),P([g({type:Number,attribute:`reserve-tabs-count`})],Y.prototype,`reserveTabsCount`,void 0),P([g({type:String,attribute:`reserve-tabs-widths`})],Y.prototype,`reserveTabsWidths`,void 0),P([g({type:Boolean,attribute:`layout-pending`,reflect:!0,converter:bu})],Y.prototype,`layoutPending`,void 0),P([g({type:Array,attribute:`utility-items`,converter:Y._JSON_ARRAY})],Y.prototype,`utilityItems`,void 0),P([g({type:String,attribute:`search-placeholder`})],Y.prototype,`searchPlaceholder`,void 0),P([g({type:String,attribute:`search-button-label`})],Y.prototype,`searchButtonLabel`,void 0),P([g({type:String,attribute:`menu-label`})],Y.prototype,`menuLabel`,void 0),P([g({type:String,attribute:`menu-button-label`})],Y.prototype,`menuButtonLabel`,void 0),P([g({type:String,attribute:`menu-sub-label`})],Y.prototype,`menuSubLabel`,void 0),P([g({type:String,attribute:`menu-section-label`})],Y.prototype,`menuSectionLabel`,void 0),P([g({type:String,attribute:`menu-search-placeholder`})],Y.prototype,`menuSearchPlaceholder`,void 0),P([g({type:Array,attribute:`menu-data`,converter:Y._JSON_ARRAY})],Y.prototype,`menuData`,void 0),P([g({type:Boolean,attribute:`defer-drawer`,reflect:!0,converter:bu})],Y.prototype,`deferDrawer`,void 0),P([g({type:Boolean,attribute:`show-drawer`,reflect:!0,converter:yu})],Y.prototype,`showDrawer`,void 0),P([g({type:Boolean,attribute:`always-show-menu-button`,reflect:!0,converter:bu})],Y.prototype,`alwaysShowMenuButton`,void 0),P([g({type:Boolean,attribute:`show-search`,reflect:!0,converter:yu})],Y.prototype,`showSearch`,void 0),P([g({type:Boolean,attribute:`include-utility-in-menu`,reflect:!0,converter:bu})],Y.prototype,`includeUtilityInMenu`,void 0),P([g({type:Boolean,attribute:`drawer-overlay`,reflect:!0,converter:yu})],Y.prototype,`drawerOverlay`,void 0),P([g({type:String,attribute:`search-max`})],Y.prototype,`searchMax`,void 0),P([g({type:String,attribute:`search-min`})],Y.prototype,`searchMin`,void 0),P([g({type:String,attribute:`search-height`})],Y.prototype,`searchHeight`,void 0),P([g({type:String,attribute:`search-text`,reflect:!0})],Y.prototype,`searchText`,void 0),P([_()],Y.prototype,`_drawerId`,void 0),P([_()],Y.prototype,`_menuExpanded`,void 0),P([_()],Y.prototype,`_searchId`,void 0),P([_()],Y.prototype,`_drawerReady`,void 0),P([_()],Y.prototype,`_slotNavItems`,void 0),P([_()],Y.prototype,`_slotUtils`,void 0),P([_()],Y.prototype,`_slotMenu`,void 0),P([_()],Y.prototype,`_collapsed`,void 0),P([_()],Y.prototype,`_hideLogoText`,void 0),Y=_u=P([a(`scb-header`)],Y),C(),y(),w(),F();var Su,Cu={fromAttribute:e=>e??``,toAttribute:e=>typeof e==`string`?e.trim()===``?null:e:null},X=class extends S{static{Su=this}constructor(...e){super(...e),this.keyfigure=0,this.subtitle=``,this.supportingText=``,this.cardHref=``,this.href=``,this.icon=``,this.size=`large`,this.unit=``,this.width=``,this.maxWidth=``,this.height=``,this.maxHeight=``,this.sizing=``,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.__onKeyDown=e=>{let t=this.__effectiveHref;(e.key===`Enter`||e.key===` `)&&t&&(e.preventDefault(),this.__navigate(t,e))},this.__handleHrefNavigation=e=>{let t=this.__effectiveHref;t&&(e.target.closest(`a`)||this.__navigate(t,e))}}static{this.__iconLoaded=!1}static{this.__rippleLoaded=!1}static{this.styles=p`
|
|
9569
9596
|
:host {
|
|
9570
9597
|
display: block;
|
|
9571
9598
|
box-sizing: border-box;
|