scb-wc 0.1.76 → 0.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -41
- package/all.js +2 -0
- package/index.js +90 -88
- package/mvc/components/all.js +2 -0
- package/mvc/components/scb-accordion/scb-accordion-item.js +1 -1
- package/mvc/components/scb-button/scb-button.js +1 -1
- package/mvc/{vendor → components/scb-chevron}/scb-chevron.js +1 -1
- package/mvc/components/scb-datepicker/scb-datepicker.js +296 -0
- package/mvc/components/scb-dropdown/scb-dropdown.js +1 -1
- package/mvc/components/scb-grid/scb-grid-item.js +1 -1
- package/mvc/components/scb-grid/scb-grid.js +1 -1
- package/mvc/components/scb-header/scb-header.js +88 -62
- package/mvc/components/scb-icon-button/scb-icon-button.js +1 -1
- package/mvc/components/scb-menu/scb-menu-item.js +1 -1
- package/mvc/components/scb-select/scb-select.js +1 -1
- package/mvc/components/scb-skeleton/scb-skeleton.js +1 -1
- package/mvc/components/scb-textfield/scb-textfield.js +24 -319
- package/mvc/components/scb-toc/scb-toc-item.js +1 -1
- package/package.json +2 -2
- package/scb-chevron/scb-chevron.js +1 -0
- package/scb-components/index.d.ts +99 -0
- package/scb-components/scb-chevron/scb-chevron.d.ts +11 -0
- package/scb-components/scb-datepicker/scb-datepicker.d.ts +39 -0
- package/scb-components/scb-header/scb-header.d.ts +5 -0
- package/scb-datepicker/scb-datepicker.js +1 -0
- package/scb-header/scb-header.js +82 -20
- package/scb-wc.bundle.js +292 -266
- package/scb-wc.d.ts +198 -194
- package/scb-wc-public-entry/index.d.ts +0 -97
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/md-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/vendor.js","../../vendor/attachable-controller.js","../../vendor/vendor-lit.js","../scb-drawer/scb-drawer.js","../../vendor/decorate.js","../scb-divider/scb-divider.js","../../vendor/assertClassBrand.js","../scb-menu/scb-menu.js","../scb-menu/scb-menu-item.js","../../vendor/preload-helper.js","
|
|
2
|
-
import{_ as M,b as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/md-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/vendor.js","../../vendor/attachable-controller.js","../../vendor/vendor-lit.js","../scb-drawer/scb-drawer.js","../../vendor/decorate.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","../scb-search/scb-search.js","../../vendor/icon.js","../../vendor/ripple.js","../scb-button/scb-button.js","../../vendor/elevation.js","../../vendor/delegate.js","../../vendor/form-submitter.js","../../vendor/element-internals.js","../../vendor/form-label-activation.js","../scb-icon-button/scb-icon-button.js","../scb-skeleton/scb-skeleton.js","../scb-grid/scb-grid.js","../scb-grid/scb-grid-item.js","../scb-grid/scb-stack.js","../scb-dropdown/scb-dropdown.js","../scb-options-menu/scb-options-menu.js","../scb-options-menu/scb-options-menu-item.js","../scb-options-menu/scb-options-sub-menu.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as M,b as P,g as D,h,m as k,v,y as b}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as c}from"../../vendor/decorate.js";import{t as S}from"../../vendor/preload-helper.js";(function(){try{var m=typeof globalThis<"u"?globalThis:window;if(!m.__scb_ce_guard_installed__){m.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,r,s){try{customElements.get(t)||e(t,r,s)}catch(a){var i=String(a||"");if(i.indexOf("already been used")===-1&&i.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var C,z,I=0,R=()=>{if(typeof window>"u"||typeof document>"u"||!("customElements"in window)||document.head.querySelector("style[data-scb-header-pre-upgrade]"))return;const m=document.createElement("style");m.setAttribute("data-scb-header-pre-upgrade",""),m.textContent=`
|
|
3
3
|
scb-header:not(:defined),
|
|
4
4
|
scb-header[data-upgrading] {
|
|
5
5
|
display: block;
|
|
@@ -50,23 +50,23 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
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}},r=n=>n!=null&&!/^(false|0|off|no)$/i.test(n.trim()),s=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=>{s(n)||t(n.getAttribute("tabs"))||r(n.getAttribute("reserve-tabs"))||r(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,v=e(n.getAttribute("spacing-bottom"))??u;p?n.style.setProperty("--scb-header-spacing-block-start",p):n.style.removeProperty("--scb-header-spacing-block-start"),v?n.style.setProperty("--scb-header-spacing-block-end",v):n.style.removeProperty("--scb-header-spacing-block-end");const _=(n.getAttribute("logo-width")??"").trim();_?n.style.setProperty("--scb-header-pre-logo-w",_):n.style.removeProperty("--scb-header-pre-logo-w");const w=(n.getAttribute("logo-height")??"").trim();w?n.style.setProperty("--scb-header-pre-logo-img-h",w):n.style.removeProperty("--scb-header-pre-logo-img-h");const c=(n.getAttribute("search-height")??"").trim();c?n.style.setProperty("--scb-header-pre-control-size",c):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 v of p){if(!(v instanceof HTMLElement))continue;if(v.tagName.toLowerCase()==="scb-header"){i(v);continue}const _=v.closest?.("scb-header");_&&i(_)}}}});d.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabs","spacing","spacing-top","spacing-bottom","logo-width","logo-height","logo-aspect-ratio","logo-alt","logotype-text","search-height","reserve-tabs","layout-pending"]}),customElements.whenDefined("scb-header").then(()=>{d.disconnect()})};L();var z={fromAttribute:b=>b==null?!0:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>String(!!b)},C={fromAttribute:b=>b==null?!1:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>b?"":null},R={fromAttribute:b=>b==="small"||b==="large"?b:"medium",toAttribute:b=>{const e=String(b??"");return e==="small"||e==="large"?e:null}},o=(A=class extends M{constructor(){super(),this.maxWidth="1440px",this.size="medium",this.logoText="",this.logotypeText="",this.logoAlt="",this.logoHref="/",this.logoSrc="",this.logoWidth="",this.logoHeight="",this.logoAspectRatio="",this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel="Sök",this.menuButtonLabel="Meny",this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",this._menuExpanded=!1,this._searchId="header-search",this._drawerReady=!1,this._mobileSearchOpen=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{window.innerWidth>=this.BP_SM&&this._mobileSearchOpen&&this._setMobileSearchOpen(!1),this._scheduleMeasure()},this._onMenuSelect=t=>{const r=t.detail;this.dispatchEvent(new CustomEvent("scb-menu-select",{detail:r,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbmenuselect",{detail:r,bubbles:!0,composed:!0}));const s=r?.item,i=typeof r?.href=="string"?r.href:typeof r?.itemHref=="string"?r.itemHref:typeof r?.item_href=="string"?r.item_href:"",a=s?s.getAttribute("item-href")??s.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 r=Array.from(this.children),s=[],i=[],a=[];let d=-1,n=!1;const u=c=>({label:c.getAttribute("label")??"",href:c.getAttribute("href")??void 0,icon:c.getAttribute("icon")??void 0}),p=c=>{c.hasAttribute("role")&&c.removeAttribute("role"),c.getAttribute("aria-hidden")!=="true"&&c.setAttribute("aria-hidden","true")};for(const c of r){const x=c.tagName.toLowerCase();if(x==="scb-header-tab"){const f=c.getAttribute("label")??"",g=c.getAttribute("href"),k=g&&g.trim()!==""?g:void 0;(c.hasAttribute("selected")||c.getAttribute("selected")==="true"||c.getAttribute("active")==="true"||c.getAttribute("aria-current")==="page")&&d===-1&&(d=s.length),s.push({kind:"tab",label:f,href:k});continue}if(x==="scb-badge"){const f=c.querySelector("scb-dropdown");if(f){n=!0;const g=f.getAttribute("label")??"";(f.hasAttribute("selected")||f.getAttribute("selected")==="true"||f.getAttribute("active")==="true"||f.getAttribute("aria-current")==="page")&&d===-1&&(d=s.length);const k=`scb-header-tab-${s.length}`;c.getAttribute("slot")!==k&&c.setAttribute("slot",k),f.hasAttribute("slot")&&f.removeAttribute("slot"),f.hasAttribute("as-tab")||f.setAttribute("as-tab",""),s.push({kind:"dropdown",slotName:k,label:g});continue}}if(x==="scb-dropdown"){n=!0;const f=c.getAttribute("label")??"";(c.hasAttribute("selected")||c.getAttribute("selected")==="true"||c.getAttribute("active")==="true"||c.getAttribute("aria-current")==="page")&&d===-1&&(d=s.length);const g=`scb-header-tab-${s.length}`;c.getAttribute("slot")!==g&&c.setAttribute("slot",g),c.hasAttribute("as-tab")||c.setAttribute("as-tab",""),s.push({kind:"dropdown",slotName:g,label:f});continue}if(x==="scb-header-utility"){p(c),i.push({label:c.getAttribute("label")??"",href:c.getAttribute("href")??"#",target:c.getAttribute("target")??void 0});continue}if(x==="scb-header-menu-group"){const f={label:c.getAttribute("label")??"",icon:c.getAttribute("icon")??void 0,children:[]};c.querySelectorAll("scb-header-menu-item").forEach(g=>f.children.push(u(g))),a.push(f);continue}x==="scb-header-menu-item"&&a.push(u(c))}const v=!this._sameNavItems(this._slotNavItems,s),_=!this._sameUtilityItems(this._slotUtils,i),w=!this._sameMenuNodes(this._slotMenu,a);v&&(this._slotNavItems=s),_&&(this._slotUtils=i),w&&(this._slotMenu=a),n&&this._ensureDropdownReady(),!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,r=this._logoGroup;if(!t||!r)return;const s=window.innerWidth,i=t.clientWidth,a=this._overflows(this._util),d=this._tabsOverflows(),n=s<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&&s>=this.BP_SM&&s<this.BP_MD&&this._searchWrap){const v=getComputedStyle(this._searchWrap),_=Math.max(this._num(v.minWidth,this._tokenPx("--scb-header-search-min",250)),this._tokenPx("--scb-header-search-min",250)),w=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),c=this.showDrawer&&(this.alwaysShowMenuButton||s<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48):0;u=r.getBoundingClientRect().width+w+_+w+c+8>i+.5}this._setHideSearch(u);let p=!1;if(this.showDrawer&&(this.alwaysShowMenuButton||s<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const v=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),_=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48),w=(this._logoGroup?.getBoundingClientRect().width||0)+v+_;this._hideLogoText?p=!(i>=this._logoTextUnlockAt):w>i+.5&&(p=!0,this._logoTextUnlockAt=i+this._HYST)}else p=!1,this._logoTextUnlockAt=0;this._setHideLogoText(p)},this._onGlobalFocusRingKeydown=t=>{t.key==="Tab"&&(this.toggleAttribute("data-keyboard-focus",!0),this._ensureFocusRingReady())},this._onGlobalFocusRingPointerDown=()=>{this.removeAttribute("data-keyboard-focus")},this._onLocalFocusIn=t=>{const r=t.composedPath()[0];r instanceof HTMLElement&&r.matches(":focus-visible")&&this._ensureFocusRingReady()},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("draweropen",{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("drawerclose",{bubbles:!0,composed:!0}))},this._onMenuClick=async t=>{this.showDrawer&&(this._setMobileSearchOpen(!1),this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("menuclick",{bubbles:!0,composed:!0})),!this._drawerReady&&(t.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onMobileSearchToggle=()=>{const t=!this._mobileSearchOpen;this._setMobileSearchOpen(t),t&&this.updateComplete.then(()=>{this.renderRoot.querySelector(".mobile-search-panel .header-search-input")?.focus?.()})},this._onTabClick=t=>{const r=t.currentTarget;if(!r)return;const s=r.tagName.toLowerCase()==="a";if(s&&(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const i=r.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))&&s&&t.preventDefault()},this._onDropdownTabActivate=t=>{const r=t.detail?.dataIndex,s=typeof r=="number"?r:typeof r=="string"?Number(r):this._readTabIndexFromEvent(t);if(s==null||!Number.isFinite(s))return;const i=this._getNavItems();s<0||s>=i.length||i[s]?.kind==="dropdown"&&(this.activeTab=s,this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:s,href:""},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("tabchange",{detail:{index:s,href:""},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=t=>{const r=t.key;if(r!=="ArrowLeft"&&r!=="ArrowRight"&&r!=="Home"&&r!=="End")return;const s=this._getNavItems();if(!s.length)return;const i=this._readTabIndexFromEvent(t);if(i==null)return;let a=Math.max(0,Math.min(s.length-1,i));r==="ArrowRight"?a=(a+1)%s.length:r==="ArrowLeft"?a=(a-1+s.length)%s.length:r==="Home"?a=0:r==="End"&&(a=s.length-1),t.preventDefault(),this._focusTabAtIndex(a)},this._onNativeSearchInput=t=>{const r=t.currentTarget;this._emitSearchInput(r?.value??"")},this._onNativeSearchSubmit=t=>{t.preventDefault();const r=t.currentTarget?.querySelector(".header-search-input");this._emitSearchChange(r?.value??"")},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}))},this._onNativeSearchClear=t=>{t.preventDefault(),this._onSearchClear(),this.updateComplete.then(()=>{const r=t.currentTarget?.closest("form")?.querySelector(".header-search-input");r&&(r.value=""),r?.focus()})};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(()=>{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",T.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",T.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 _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(i=>i.disconnect()),this._slotWatchers=[];const e=["label","href","icon","target","selected","aria-current","active","role"],t=i=>{const a=new MutationObserver(d=>{this._scheduleHarvest()});this._slotWatchers.push(a),a.observe(i,{attributes:!0,attributeFilter:e})},r=()=>{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(v=>{r(),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=>{r(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(n,{childList:!0,subtree:!0}),n.querySelectorAll("scb-header-menu-item").forEach(p=>t(p))}}},s=new MutationObserver(i=>{let a=!1;for(const d of i)if(d.type==="childList"){a=!0;break}a&&r(),this._scheduleHarvest()});this._slotMo=s,s.observe(this,{childList:!0}),r()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1){const s=e[r],i=t[r];if(!s||!i||s.kind!==i.kind||s.label!==i.label)return!1;if(s.kind==="tab"&&i.kind==="tab"){if((s.href??"")!==(i.href??""))return!1}else if(s.kind==="dropdown"&&i.kind==="dropdown"&&s.slotName!==i.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1){const s=e[r],i=t[r];if(!s||!i||s.label!==i.label||s.href!==i.href||(s.target??"")!==(i.target??""))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1){const s=e[r],i=t[r];if(!s||!i||s.label!==i.label||(s.href??"")!==(i.href??"")||(s.icon??"")!==(i.icon??"")||!this._sameMenuNodes(s.children??[],i.children??[]))return!1}return!0}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_setMobileSearchOpen(e){this._mobileSearchOpen!==e&&(this._mobileSearchOpen=e,this.toggleAttribute("data-mobile-search-open",e))}_num(e,t){const r=Number.parseFloat(String(e??"").trim());return Number.isFinite(r)?r:t}_tokenPx(e,t){const r=getComputedStyle(this);return this._num(r.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 r=e.getBoundingClientRect();let s=r.left;for(const i of t){const a=i.getBoundingClientRect();a.width<=0||a.right>s&&(s=a.right)}return s-r.left>r.width+1}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this._onGlobalFocusRingKeydown,!0),window.addEventListener("pointerdown",this._onGlobalFocusRingPointerDown,!0),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._syncLandmarkAttributes(),this.renderRoot.addEventListener("focusin",this._onLocalFocusIn),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("banner")||e.has("bannerLabel"))&&this._syncLandmarkAttributes(),(e.has("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("logotypeText")||e.has("logoSrc")||e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio")||e.has("activeTab")||e.has("_slotNavItems")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("alwaysShowMenuButton")||e.has("showSearch")||e.has("layoutPending")||e.has("searchMax")||e.has("searchMin")||e.has("size"))&&this.updateComplete.then(()=>{this._scheduleMeasure()}),(e.has("showDrawer")||e.has("deferDrawer"))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has("showSearch")&&!this.showSearch&&this._setMobileSearchOpen(!1),e.has("layoutPending")&&!this.layoutPending&&this.requestLayout(),(e.has("activeTab")||e.has("_slotNavItems")||e.has("tabs")||e.has("size"))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],this.renderRoot.removeEventListener("focusin",this._onLocalFocusIn),window.removeEventListener("keydown",this._onGlobalFocusRingKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalFocusRingPointerDown,!0),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,r=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty("--scb-header-spacing-block-start",t):this.style.removeProperty("--scb-header-spacing-block-start"),r?this.style.setProperty("--scb-header-spacing-block-end",r):this.style.removeProperty("--scb-header-spacing-block-end")}_syncLandmarkAttributes(){const e=this.renderRoot.querySelector(".header-landmark");if(!e)return;if(!this.banner){e.removeAttribute("role"),e.removeAttribute("aria-label");return}e.setAttribute("role","banner");const t=(this.bannerLabel??"").trim();t?e.setAttribute("aria-label",t):e.removeAttribute("aria-label")}_applyLogoSizing(){const e=(this.logoWidth??"").trim(),t=(this.logoHeight??"").trim(),r=(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"),r?this.style.setProperty("--scb-header-logo-img-aspect-ratio",r):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)}_ensureFocusRingReady(){customElements.get("md-focus-ring")||(this._focusRingImportPromise??(this._focusRingImportPromise=$(()=>import("../../vendor/md-focus-ring.js").then(e=>e.t).then(()=>{}),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),this._focusRingImportPromise)}async _ensureDrawerReady(){this._drawerReady||(this._drawerImportPromise??(this._drawerImportPromise=Promise.all([$(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([5,6,2,4,7,8]),import.meta.url),$(()=>import("../scb-menu/scb-menu.js"),__vite__mapDeps([9,8,6,2,4,7,10,11,12,13,14]),import.meta.url),$(()=>import("../scb-search/scb-search.js"),__vite__mapDeps([15,6,11,2,0,1,3,4,16,17]),import.meta.url)]).then(()=>{})),await this._drawerImportPromise,this._drawerReady=!0)}async _ensureDropdownReady(){customElements.get("scb-dropdown")||(this._dropdownImportPromise??(this._dropdownImportPromise=$(()=>import("../scb-dropdown/scb-dropdown.js").then(()=>{}),__vite__mapDeps([18,6,2,19,8,20,4,0,1,3,16,21,22,23,24,17,12,25,26,7,27]),import.meta.url)),await this._dropdownImportPromise)}_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 r=this._getDropdownForSlot(e.slotName);if(!r)return;const s=String(t);r.getAttribute("data-index")!==s&&r.setAttribute("data-index",s),r.hasAttribute("as-tab")||r.setAttribute("as-tab","");const i=this.size,a=r;a?.size!==i&&(a.size=i),t===this.activeTab?r.getAttribute("aria-current")!=="page"&&r.setAttribute("aria-current","page"):r.hasAttribute("aria-current")&&r.removeAttribute("aria-current")})}_readTabIndexFromEvent(e){const t=e.composedPath?e.composedPath():[];for(const r of t){if(!(r instanceof HTMLElement))continue;const s=r.getAttribute("data-index");if(s==null)continue;const i=Number(s);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,r=(e.href??"").trim(),s=(e.icon??"").trim(),i=t?m`
|
|
53
|
+
`,document.head.appendChild(m);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}},r=n=>n!=null&&!/^(false|0|off|no)$/i.test(n.trim()),s=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=>{s(n)||t(n.getAttribute("tabs"))||r(n.getAttribute("reserve-tabs"))||r(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,y=e(n.getAttribute("spacing-bottom"))??u;p?n.style.setProperty("--scb-header-spacing-block-start",p):n.style.removeProperty("--scb-header-spacing-block-start"),y?n.style.setProperty("--scb-header-spacing-block-end",y):n.style.removeProperty("--scb-header-spacing-block-end");const _=(n.getAttribute("logo-width")??"").trim();_?n.style.setProperty("--scb-header-pre-logo-w",_):n.style.removeProperty("--scb-header-pre-logo-w");const x=(n.getAttribute("logo-height")??"").trim();x?n.style.setProperty("--scb-header-pre-logo-img-h",x):n.style.removeProperty("--scb-header-pre-logo-img-h");const l=(n.getAttribute("search-height")??"").trim();l?n.style.setProperty("--scb-header-pre-control-size",l):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 y of p){if(!(y instanceof HTMLElement))continue;if(y.tagName.toLowerCase()==="scb-header"){i(y);continue}const _=y.closest?.("scb-header");_&&i(_)}}}});d.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabs","spacing","spacing-top","spacing-bottom","logo-width","logo-height","logo-aspect-ratio","logo-alt","logotype-text","search-height","reserve-tabs","layout-pending"]}),customElements.whenDefined("scb-header").then(()=>{d.disconnect()})};R();var E={fromAttribute:m=>m==null?!0:!/^(false|0|off|no)$/i.test(m),toAttribute:m=>String(!!m)},$={fromAttribute:m=>m==null?!1:!/^(false|0|off|no)$/i.test(m),toAttribute:m=>m?"":null},L={fromAttribute:m=>m==="small"||m==="large"?m:"medium",toAttribute:m=>{const e=String(m??"");return e==="small"||e==="large"?e:null}},o=(C=class extends M{constructor(){super(),this.maxWidth="1440px",this.size="medium",this.logoText="",this.logotypeText="",this.logoAlt="",this.logoHref="/",this.logoSrc="",this.logoWidth="",this.logoHeight="",this.logoAspectRatio="",this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel="Sök",this.menuButtonLabel="Meny",this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",this._menuExpanded=!1,this._searchId="header-search",this._drawerReady=!1,this._mobileSearchOpen=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{window.innerWidth>=this.BP_SM&&this._mobileSearchOpen&&this._setMobileSearchOpen(!1),this._scheduleMeasure()},this._onMenuSelect=t=>{const r=t.detail;this.dispatchEvent(new CustomEvent("scb-menu-select",{detail:r,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbmenuselect",{detail:r,bubbles:!0,composed:!0}));const s=r?.item,i=typeof r?.href=="string"?r.href:typeof r?.itemHref=="string"?r.itemHref:typeof r?.item_href=="string"?r.item_href:"",a=s?s.getAttribute("item-href")??s.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 r=Array.from(this.children),s=[],i=[],a=[];let d=-1,n=!1;const u=l=>({label:l.getAttribute("label")??"",href:l.getAttribute("href")??void 0,icon:l.getAttribute("icon")??void 0}),p=l=>{l.hasAttribute("role")&&l.removeAttribute("role"),l.hasAttribute("hidden")||l.setAttribute("hidden",""),l.getAttribute("aria-hidden")!=="true"&&l.setAttribute("aria-hidden","true")};for(const l of r){const A=l.tagName.toLowerCase();if(this._isDrawerCloseNode(l)){this._syncDrawerCloseNode(l);continue}if(A==="scb-header-tab"){p(l);const g=l.getAttribute("label")??"",w=l.getAttribute("href"),f=w&&w.trim()!==""?w:void 0;(l.hasAttribute("selected")||l.getAttribute("selected")==="true"||l.getAttribute("active")==="true"||l.getAttribute("aria-current")==="page")&&d===-1&&(d=s.length),s.push({kind:"tab",label:g,href:f});continue}if(A==="scb-badge"){const g=l.querySelector("scb-dropdown");if(g){n=!0;const w=g.getAttribute("label")??"";(g.hasAttribute("selected")||g.getAttribute("selected")==="true"||g.getAttribute("active")==="true"||g.getAttribute("aria-current")==="page")&&d===-1&&(d=s.length);const f=`scb-header-tab-${s.length}`;l.getAttribute("slot")!==f&&l.setAttribute("slot",f),g.hasAttribute("slot")&&g.removeAttribute("slot"),g.hasAttribute("as-tab")||g.setAttribute("as-tab",""),s.push({kind:"dropdown",slotName:f,label:w});continue}}if(A==="scb-dropdown"){n=!0;const g=l.getAttribute("label")??"";(l.hasAttribute("selected")||l.getAttribute("selected")==="true"||l.getAttribute("active")==="true"||l.getAttribute("aria-current")==="page")&&d===-1&&(d=s.length);const w=`scb-header-tab-${s.length}`;l.getAttribute("slot")!==w&&l.setAttribute("slot",w),l.hasAttribute("as-tab")||l.setAttribute("as-tab",""),s.push({kind:"dropdown",slotName:w,label:g});continue}if(A==="scb-header-utility"){p(l),i.push({label:l.getAttribute("label")??"",href:l.getAttribute("href")??"#",target:l.getAttribute("target")??void 0});continue}if(A==="scb-header-menu-group"){p(l);const g={label:l.getAttribute("label")??"",icon:l.getAttribute("icon")??void 0,children:[]};l.querySelectorAll("scb-header-menu-item").forEach(w=>g.children.push(u(w))),a.push(g);continue}if(A==="scb-header-menu-item"){p(l),a.push(u(l));continue}l.hasAttribute("slot")||p(l)}const y=!this._sameNavItems(this._slotNavItems,s),_=!this._sameUtilityItems(this._slotUtils,i),x=!this._sameMenuNodes(this._slotMenu,a);y&&(this._slotNavItems=s),_&&(this._slotUtils=i),x&&(this._slotMenu=a),n&&this._ensureDropdownReady(),!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,r=this._logoGroup;if(!t||!r)return;const s=window.innerWidth,i=t.clientWidth,a=this._overflows(this._util),d=this._tabsOverflows(),n=s<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&&s>=this.BP_SM&&s<this.BP_MD&&this._searchWrap){const y=getComputedStyle(this._searchWrap),_=Math.max(this._num(y.minWidth,this._tokenPx("--scb-header-search-min",250)),this._tokenPx("--scb-header-search-min",250)),x=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),l=this.showDrawer&&(this.alwaysShowMenuButton||s<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48):0;u=r.getBoundingClientRect().width+x+_+x+l+8>i+.5}this._setHideSearch(u);let p=!1;if(this.showDrawer&&(this.alwaysShowMenuButton||s<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const y=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),_=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48),x=(this._logoGroup?.getBoundingClientRect().width||0)+y+_;this._hideLogoText?p=!(i>=this._logoTextUnlockAt):x>i+.5&&(p=!0,this._logoTextUnlockAt=i+this._HYST)}else p=!1,this._logoTextUnlockAt=0;this._setHideLogoText(p)},this._onGlobalFocusRingKeydown=t=>{t.key==="Tab"&&(this.toggleAttribute("data-keyboard-focus",!0),this._ensureFocusRingReady())},this._onGlobalFocusRingPointerDown=()=>{this.removeAttribute("data-keyboard-focus")},this._onLocalFocusIn=t=>{const r=t.composedPath()[0];r instanceof HTMLElement&&r.matches(":focus-visible")&&this._ensureFocusRingReady()},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("draweropen",{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("drawerclose",{bubbles:!0,composed:!0}))},this._onMenuClick=async t=>{this.showDrawer&&(this._setMobileSearchOpen(!1),this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("menuclick",{bubbles:!0,composed:!0})),!this._drawerReady&&(t.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onMobileSearchToggle=()=>{const t=!this._mobileSearchOpen;this._setMobileSearchOpen(t),t&&this.updateComplete.then(()=>{this.renderRoot.querySelector(".mobile-search-panel .header-search-input")?.focus?.()})},this._onTabClick=t=>{const r=t.currentTarget;if(!r)return;const s=r.tagName.toLowerCase()==="a";if(s&&(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const i=r.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))&&s&&t.preventDefault()},this._onDropdownTabActivate=t=>{const r=t.detail?.dataIndex,s=typeof r=="number"?r:typeof r=="string"?Number(r):this._readTabIndexFromEvent(t);if(s==null||!Number.isFinite(s))return;const i=this._getNavItems();s<0||s>=i.length||i[s]?.kind==="dropdown"&&(this.activeTab=s,this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:s,href:""},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("tabchange",{detail:{index:s,href:""},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=t=>{const r=t.key;if(r!=="ArrowLeft"&&r!=="ArrowRight"&&r!=="Home"&&r!=="End")return;const s=this._getNavItems();if(!s.length)return;const i=this._readTabIndexFromEvent(t);if(i==null)return;let a=Math.max(0,Math.min(s.length-1,i));r==="ArrowRight"?a=(a+1)%s.length:r==="ArrowLeft"?a=(a-1+s.length)%s.length:r==="Home"?a=0:r==="End"&&(a=s.length-1),t.preventDefault(),this._focusTabAtIndex(a)},this._onNativeSearchInput=t=>{const r=t.currentTarget;this._emitSearchInput(r?.value??"")},this._onNativeSearchSubmit=t=>{t.preventDefault();const r=t.currentTarget?.querySelector(".header-search-input");this._emitSearchChange(r?.value??"")},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}))},this._onNativeSearchClear=t=>{t.preventDefault(),this._onSearchClear(),this.updateComplete.then(()=>{const r=t.currentTarget?.closest("form")?.querySelector(".header-search-input");r&&(r.value=""),r?.focus()})};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(()=>{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",z.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",z.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 _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(i=>i.disconnect()),this._slotWatchers=[];const e=["label","href","icon","target","selected","aria-current","active","role"],t=i=>{const a=new MutationObserver(d=>{this._scheduleHarvest()});this._slotWatchers.push(a),a.observe(i,{attributes:!0,attributeFilter:e})},r=()=>{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(y=>{r(),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=>{r(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(n,{childList:!0,subtree:!0}),n.querySelectorAll("scb-header-menu-item").forEach(p=>t(p))}}},s=new MutationObserver(i=>{let a=!1;for(const d of i)if(d.type==="childList"){a=!0;break}a&&r(),this._scheduleHarvest()});this._slotMo=s,s.observe(this,{childList:!0}),r()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1){const s=e[r],i=t[r];if(!s||!i||s.kind!==i.kind||s.label!==i.label)return!1;if(s.kind==="tab"&&i.kind==="tab"){if((s.href??"")!==(i.href??""))return!1}else if(s.kind==="dropdown"&&i.kind==="dropdown"&&s.slotName!==i.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1){const s=e[r],i=t[r];if(!s||!i||s.label!==i.label||s.href!==i.href||(s.target??"")!==(i.target??""))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1){const s=e[r],i=t[r];if(!s||!i||s.label!==i.label||(s.href??"")!==(i.href??"")||(s.icon??"")!==(i.icon??"")||!this._sameMenuNodes(s.children??[],i.children??[]))return!1}return!0}_isDrawerCloseNode(e){const t=e.tagName.toLowerCase(),r=e.getAttribute("slot");if(r==="drawer-close")return!0;if(r||t!=="scb-icon-button")return!1;const s=(e.getAttribute("icon")??"").trim().toLowerCase(),i=(e.getAttribute("aria-label")??"").trim().toLowerCase();return s==="close"||i.includes("stäng")||i.includes("close")}_syncDrawerCloseNode(e){e.getAttribute("slot")!=="drawer-close"&&e.setAttribute("slot","drawer-close"),e.setAttribute("data-drawer-close",this._drawerId),e.setAttribute("aria-controls",this._drawerId),this._drawerReady?(e.removeAttribute("hidden"),e.removeAttribute("aria-hidden")):(e.hasAttribute("hidden")||e.setAttribute("hidden",""),e.getAttribute("aria-hidden")!=="true"&&e.setAttribute("aria-hidden","true"))}_syncDrawerCloseNodes(){for(const e of Array.from(this.children))this._isDrawerCloseNode(e)&&this._syncDrawerCloseNode(e)}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_setMobileSearchOpen(e){this._mobileSearchOpen!==e&&(this._mobileSearchOpen=e,this.toggleAttribute("data-mobile-search-open",e))}_num(e,t){const r=Number.parseFloat(String(e??"").trim());return Number.isFinite(r)?r:t}_tokenPx(e,t){const r=getComputedStyle(this);return this._num(r.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 r=e.getBoundingClientRect();let s=r.left;for(const i of t){const a=i.getBoundingClientRect();a.width<=0||a.right>s&&(s=a.right)}return s-r.left>r.width+1}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this._onGlobalFocusRingKeydown,!0),window.addEventListener("pointerdown",this._onGlobalFocusRingPointerDown,!0),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._syncLandmarkAttributes(),this.renderRoot.addEventListener("focusin",this._onLocalFocusIn),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("banner")||e.has("bannerLabel"))&&this._syncLandmarkAttributes(),(e.has("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("logotypeText")||e.has("logoSrc")||e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio")||e.has("activeTab")||e.has("_slotNavItems")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("alwaysShowMenuButton")||e.has("showSearch")||e.has("layoutPending")||e.has("searchMax")||e.has("searchMin")||e.has("size"))&&this.updateComplete.then(()=>{this._scheduleMeasure()}),(e.has("showDrawer")||e.has("deferDrawer"))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has("showSearch")&&!this.showSearch&&this._setMobileSearchOpen(!1),e.has("layoutPending")&&!this.layoutPending&&this.requestLayout(),(e.has("activeTab")||e.has("_slotNavItems")||e.has("tabs")||e.has("size"))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],this.renderRoot.removeEventListener("focusin",this._onLocalFocusIn),window.removeEventListener("keydown",this._onGlobalFocusRingKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalFocusRingPointerDown,!0),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,r=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty("--scb-header-spacing-block-start",t):this.style.removeProperty("--scb-header-spacing-block-start"),r?this.style.setProperty("--scb-header-spacing-block-end",r):this.style.removeProperty("--scb-header-spacing-block-end")}_syncLandmarkAttributes(){const e=this.renderRoot.querySelector(".header-landmark");if(!e)return;if(!this.banner){e.removeAttribute("role"),e.removeAttribute("aria-label");return}e.setAttribute("role","banner");const t=(this.bannerLabel??"").trim();t?e.setAttribute("aria-label",t):e.removeAttribute("aria-label")}_applyLogoSizing(){const e=(this.logoWidth??"").trim(),t=(this.logoHeight??"").trim(),r=(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"),r?this.style.setProperty("--scb-header-logo-img-aspect-ratio",r):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)}_ensureFocusRingReady(){customElements.get("md-focus-ring")||(this._focusRingImportPromise??(this._focusRingImportPromise=S(()=>import("../../vendor/md-focus-ring.js").then(e=>e.t).then(()=>{}),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),this._focusRingImportPromise)}async _ensureDrawerReady(){this._drawerReady||(this._drawerImportPromise??(this._drawerImportPromise=Promise.all([S(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([5,6,2,4,7,8]),import.meta.url),S(()=>import("../scb-menu/scb-menu.js"),__vite__mapDeps([9,8,6,2,4,7,10,11,12,13,14]),import.meta.url),S(()=>import("../scb-search/scb-search.js"),__vite__mapDeps([15,6,11,2,0,1,3,4,16,17]),import.meta.url),this._ensureDrawerSlotComponentsReady()]).then(()=>{})),await this._drawerImportPromise,this._drawerReady=!0,this._syncDrawerCloseNodes())}_drawerSlotContains(e){return[...this.querySelectorAll('[slot="drawer-menu"], [slot="drawer-close"]')].some(t=>t.matches(e)||!!t.querySelector(e))}async _ensureDrawerSlotComponentsReady(){this.querySelector('[slot="drawer-menu"], [slot="drawer-close"]')&&await Promise.all([this._drawerSlotContains("scb-button")?S(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([18,8,6,2,19,4,0,1,3,16,20,21,22,23,17]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-icon-button")?S(()=>import("../scb-icon-button/scb-icon-button.js"),__vite__mapDeps([24,8,6,11,2,16,1,4]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-skeleton")?S(()=>import("../scb-skeleton/scb-skeleton.js"),__vite__mapDeps([25,6,2,4]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-grid")?S(()=>import("../scb-grid/scb-grid.js"),__vite__mapDeps([26,8,6,2,4,27,28]),import.meta.url):Promise.resolve(),this._drawerSlotContains("scb-grid-item")?S(()=>import("../scb-grid/scb-grid-item.js"),__vite__mapDeps([27,8,6,2,4]),import.meta.url):Promise.resolve()])}async _ensureDropdownReady(){customElements.get("scb-dropdown")||(this._dropdownImportPromise??(this._dropdownImportPromise=S(()=>import("../scb-dropdown/scb-dropdown.js").then(()=>{}),__vite__mapDeps([29,6,2,18,8,19,4,0,1,3,16,20,21,22,23,17,12,30,31,7,32]),import.meta.url)),await this._dropdownImportPromise)}_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 r=this._getDropdownForSlot(e.slotName);if(!r)return;const s=String(t);r.getAttribute("data-index")!==s&&r.setAttribute("data-index",s),r.hasAttribute("as-tab")||r.setAttribute("as-tab","");const i=this.size,a=r;a?.size!==i&&(a.size=i),t===this.activeTab?r.getAttribute("aria-current")!=="page"&&r.setAttribute("aria-current","page"):r.hasAttribute("aria-current")&&r.removeAttribute("aria-current")})}_readTabIndexFromEvent(e){const t=e.composedPath?e.composedPath():[];for(const r of t){if(!(r instanceof HTMLElement))continue;const s=r.getAttribute("data-index");if(s==null)continue;const i=Number(s);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?b``:b`${e.map(t=>this._renderMenuNode(t))}`}_renderMenuNode(e){const t=Array.isArray(e.children)&&e.children.length>0,r=(e.href??"").trim(),s=(e.icon??"").trim(),i=t?b`
|
|
54
54
|
<scb-sub-menu label=${e.label}>
|
|
55
55
|
${e.children.map(a=>this._renderMenuNode(a))}
|
|
56
56
|
</scb-sub-menu>
|
|
57
|
-
`:
|
|
57
|
+
`:v;return s&&r?b`
|
|
58
58
|
<scb-menu-item label=${e.label} ?selected=${!1} leading-icon=${s} item-href=${r}>
|
|
59
59
|
${i}
|
|
60
60
|
</scb-menu-item>
|
|
61
|
-
`:s?
|
|
61
|
+
`:s?b`
|
|
62
62
|
<scb-menu-item label=${e.label} ?selected=${!1} leading-icon=${s}>
|
|
63
63
|
${i}
|
|
64
64
|
</scb-menu-item>
|
|
65
|
-
`:r?
|
|
65
|
+
`:r?b`
|
|
66
66
|
<scb-menu-item label=${e.label} ?selected=${!1} item-href=${r}>
|
|
67
67
|
${i}
|
|
68
68
|
</scb-menu-item>
|
|
69
|
-
`:
|
|
69
|
+
`:b`<scb-menu-item label=${e.label} ?selected=${!1}>${i}</scb-menu-item>`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}_emitSearchInput(e){this.searchText=e,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}))}_emitSearchChange(e,t){this.searchText=e,this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:t},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchchange",{detail:{value:this.searchText,active:t},bubbles:!0,composed:!0}))}_renderMenuButton(e="",t=!1){const r=e?`menu-trigger ${e}`:"menu-trigger",s=(this.menuButtonLabel??"").trim()||"Meny",i=this._menuExpanded?"true":"false";return t?b`
|
|
70
70
|
<button
|
|
71
71
|
type="button"
|
|
72
72
|
class=${`${r} header-icon-button`}
|
|
@@ -80,7 +80,7 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
80
80
|
<span class="header-symbol" aria-hidden="true">menu</span>
|
|
81
81
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
82
82
|
</button>
|
|
83
|
-
`:
|
|
83
|
+
`:b`
|
|
84
84
|
<button
|
|
85
85
|
type="button"
|
|
86
86
|
class=${`${r} header-text-button`}
|
|
@@ -94,7 +94,7 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
94
94
|
<span class="header-symbol" aria-hidden="true">menu</span>
|
|
95
95
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
96
96
|
</button>
|
|
97
|
-
`}_renderSearchForm(e,t,r=!0,s=!1){const i=this.searchPlaceholder??"",a=i.trim()||e,d=(this.searchText??"").length>0;return
|
|
97
|
+
`}_renderSearchForm(e,t,r=!0,s=!1){const i=this.searchPlaceholder??"",a=i.trim()||e,d=(this.searchText??"").length>0;return b`
|
|
98
98
|
<form
|
|
99
99
|
class=${s?"header-search header-search--mobile":"header-search"}
|
|
100
100
|
style=${t}
|
|
@@ -105,11 +105,11 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
105
105
|
<span class="header-search-icon header-symbol" aria-hidden="true">search</span>
|
|
106
106
|
<span class="sr-only">${a}</span>
|
|
107
107
|
<input
|
|
108
|
-
id=${s?
|
|
108
|
+
id=${s?v:this._searchId}
|
|
109
109
|
class="header-search-input"
|
|
110
110
|
type="search"
|
|
111
111
|
.value=${this.searchText}
|
|
112
|
-
placeholder=${i||
|
|
112
|
+
placeholder=${i||v}
|
|
113
113
|
aria-label=${a}
|
|
114
114
|
@input=${this._onNativeSearchInput}
|
|
115
115
|
/>
|
|
@@ -125,14 +125,14 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
125
125
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
126
126
|
</button>
|
|
127
127
|
</label>
|
|
128
|
-
${r?
|
|
128
|
+
${r?b`
|
|
129
129
|
<button type="submit" class="search-submit">
|
|
130
130
|
${e}
|
|
131
131
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
132
132
|
</button>
|
|
133
|
-
`:
|
|
133
|
+
`:v}
|
|
134
134
|
</form>
|
|
135
|
-
`}render(){const e=this._getNavItems(),t=this._slotUtils.length?this._slotUtils:this.utilityItems,r=this._slotMenu.length?this._slotMenu:this.menuData??[],s=this.logoText||this.logotypeText,i=this.logoAlt||s||"Gå till startsidan",a=this.querySelector('[slot="drawer-menu"]')!==null;this._syncFlags(t.length===0,!this.showSearch);const
|
|
135
|
+
`}render(){const e=this._getNavItems(),t=this._slotUtils.length?this._slotUtils:this.utilityItems,r=this._slotMenu.length?this._slotMenu:this.menuData??[],s=this.logoText||this.logotypeText,i=this.logoAlt||s||"Gå till startsidan",a=this.querySelector('[slot="drawer-menu"]')!==null,d=this.querySelector('[slot="drawer-close"]')!==null;this._syncFlags(t.length===0,!this.showSearch);const n=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:"",u=e.length>0||this.reserveTabs||this.layoutPending,p=(this.reserveTabs||this.layoutPending)&&(this.layoutPending||e.length===0),y=this.showDrawer&&(!this.deferDrawer||this._drawerReady),_=typeof window<"u"&&window.innerWidth>=this.BP_MD,x=this.showDrawer&&(_?this.alwaysShowMenuButton||this._collapsed:!0),l=x&&!_,A=x&&_,g=(this.searchButtonLabel??"").trim()||"Sök",w=this.showSearch&&!this._mobileSearchOpen;return b`
|
|
136
136
|
<slot
|
|
137
137
|
id="data-slot"
|
|
138
138
|
@slotchange=${()=>{this._harvest(),this._attachSlotObservers()}}
|
|
@@ -160,42 +160,42 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
160
160
|
|
|
161
161
|
<div class="actions">
|
|
162
162
|
<nav class="utility" aria-label="Funktionslänkar">
|
|
163
|
-
${t.map(
|
|
163
|
+
${t.map(f=>b`
|
|
164
164
|
<a
|
|
165
165
|
class="utility-link"
|
|
166
|
-
href=${
|
|
167
|
-
target=${
|
|
168
|
-
rel=${
|
|
166
|
+
href=${f.href}
|
|
167
|
+
target=${f.target||v}
|
|
168
|
+
rel=${f.target==="_blank"?"noopener noreferrer":v}
|
|
169
169
|
>
|
|
170
|
-
${
|
|
170
|
+
${f.label}
|
|
171
171
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
172
172
|
</a>
|
|
173
173
|
`)}
|
|
174
174
|
</nav>
|
|
175
175
|
|
|
176
|
-
${this.showSearch?
|
|
177
|
-
<div class="search" style=${
|
|
178
|
-
${this._renderSearchForm(
|
|
176
|
+
${this.showSearch?b`
|
|
177
|
+
<div class="search" style=${n}>
|
|
178
|
+
${this._renderSearchForm(g,n)}
|
|
179
179
|
</div>
|
|
180
|
-
`:
|
|
181
|
-
${
|
|
180
|
+
`:v}
|
|
181
|
+
${w?b`
|
|
182
182
|
<button
|
|
183
183
|
type="button"
|
|
184
184
|
class="mobile-search-trigger header-icon-button"
|
|
185
|
-
aria-label=${
|
|
186
|
-
title=${
|
|
185
|
+
aria-label=${g}
|
|
186
|
+
title=${g}
|
|
187
187
|
@click=${this._onMobileSearchToggle}
|
|
188
188
|
>
|
|
189
189
|
<span class="header-symbol" aria-hidden="true">search</span>
|
|
190
190
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
191
191
|
</button>
|
|
192
|
-
`:
|
|
193
|
-
${
|
|
192
|
+
`:v}
|
|
193
|
+
${l?this._renderMenuButton("",!0):v}
|
|
194
194
|
</div>
|
|
195
195
|
|
|
196
|
-
${this.showSearch&&this._mobileSearchOpen?
|
|
197
|
-
<div class="mobile-search-panel" style=${
|
|
198
|
-
${this._renderSearchForm(
|
|
196
|
+
${this.showSearch&&this._mobileSearchOpen?b`
|
|
197
|
+
<div class="mobile-search-panel" style=${n}>
|
|
198
|
+
${this._renderSearchForm(g,n,!1,!0)}
|
|
199
199
|
<button
|
|
200
200
|
type="button"
|
|
201
201
|
class="mobile-search-close header-icon-button"
|
|
@@ -207,20 +207,20 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
207
207
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
208
208
|
</button>
|
|
209
209
|
</div>
|
|
210
|
-
`:
|
|
210
|
+
`:v}
|
|
211
211
|
|
|
212
212
|
</div>
|
|
213
213
|
</div>
|
|
214
214
|
|
|
215
215
|
<div class="header-grid-item">
|
|
216
|
-
<div class=${
|
|
217
|
-
${
|
|
216
|
+
<div class=${u||A?"tabs-row":"tabs-row tabs-row--empty"}>
|
|
217
|
+
${u?p?b`
|
|
218
218
|
<div class="tabs-inset">
|
|
219
219
|
<div class="tabs-nav tabs-nav--skeleton" aria-hidden="true">
|
|
220
220
|
${this._renderTabSkeletons()}
|
|
221
221
|
</div>
|
|
222
222
|
</div>
|
|
223
|
-
`:e.length?
|
|
223
|
+
`:e.length?b`
|
|
224
224
|
<div class="tabs-inset">
|
|
225
225
|
<nav
|
|
226
226
|
class="tabs-nav"
|
|
@@ -228,49 +228,49 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
228
228
|
@keydown=${this._onTabsKeydown}
|
|
229
229
|
@scb-dropdown-tab-activate=${this._onDropdownTabActivate}
|
|
230
230
|
>
|
|
231
|
-
${e.map((
|
|
231
|
+
${e.map((f,T)=>f.kind==="dropdown"?b`
|
|
232
232
|
<div class="tab-wrap">
|
|
233
|
-
<slot name=${
|
|
233
|
+
<slot name=${f.slotName}></slot>
|
|
234
234
|
</div>
|
|
235
|
-
`:
|
|
235
|
+
`:f.href?b`
|
|
236
236
|
<div class="tab-wrap">
|
|
237
237
|
<a
|
|
238
238
|
class="tab-link"
|
|
239
|
-
href=${
|
|
240
|
-
data-index=${
|
|
241
|
-
aria-current=${
|
|
239
|
+
href=${f.href}
|
|
240
|
+
data-index=${T}
|
|
241
|
+
aria-current=${T===this.activeTab?"page":"false"}
|
|
242
242
|
@click=${this._onTabClick}
|
|
243
243
|
>
|
|
244
|
-
${
|
|
244
|
+
${f.label}
|
|
245
245
|
</a>
|
|
246
246
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
247
247
|
</div>
|
|
248
|
-
`:
|
|
248
|
+
`:b`
|
|
249
249
|
<div class="tab-wrap">
|
|
250
250
|
<button
|
|
251
251
|
type="button"
|
|
252
252
|
class="tab-link"
|
|
253
|
-
data-index=${
|
|
254
|
-
aria-current=${
|
|
253
|
+
data-index=${T}
|
|
254
|
+
aria-current=${T===this.activeTab?"page":"false"}
|
|
255
255
|
@click=${this._onTabClick}
|
|
256
256
|
>
|
|
257
|
-
${
|
|
257
|
+
${f.label}
|
|
258
258
|
</button>
|
|
259
259
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
260
260
|
</div>
|
|
261
261
|
`)}
|
|
262
262
|
</nav>
|
|
263
263
|
</div>
|
|
264
|
-
`:
|
|
264
|
+
`:v:v}
|
|
265
265
|
|
|
266
|
-
${
|
|
266
|
+
${A?this._renderMenuButton("menu-trigger--tabs-right"):v}
|
|
267
267
|
</div>
|
|
268
268
|
</div>
|
|
269
269
|
</div>
|
|
270
270
|
<div class="divider" role="presentation"></div>
|
|
271
271
|
</div>
|
|
272
272
|
|
|
273
|
-
${
|
|
273
|
+
${y?b`
|
|
274
274
|
<scb-drawer
|
|
275
275
|
id=${this._drawerId}
|
|
276
276
|
floating
|
|
@@ -283,9 +283,18 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
283
283
|
@scb-drawer-closed=${this._onDrawerClosed}
|
|
284
284
|
@scb-menu-select=${this._onMenuSelect}
|
|
285
285
|
>
|
|
286
|
-
|
|
286
|
+
${d?b`
|
|
287
|
+
<div class="drawer-close">
|
|
288
|
+
<slot
|
|
289
|
+
name="drawer-close"
|
|
290
|
+
@slotchange=${this._ensureDrawerSlotComponentsReady}
|
|
291
|
+
></slot>
|
|
292
|
+
</div>
|
|
293
|
+
`:v}
|
|
294
|
+
|
|
295
|
+
<slot name="drawer-menu" @slotchange=${this._ensureDrawerSlotComponentsReady}></slot>
|
|
287
296
|
|
|
288
|
-
${a?
|
|
297
|
+
${a?v:b`
|
|
289
298
|
<scb-menu
|
|
290
299
|
.label=${this.menuLabel??""}
|
|
291
300
|
.subLabel=${this.menuSubLabel??""}
|
|
@@ -295,28 +304,28 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
295
304
|
.supportingText=${this.menuSearchPlaceholder??""}
|
|
296
305
|
></scb-search>
|
|
297
306
|
|
|
298
|
-
${this.menuSectionLabel?
|
|
307
|
+
${this.menuSectionLabel?b`
|
|
299
308
|
<scb-menu-section
|
|
300
309
|
.label=${this.menuSectionLabel}
|
|
301
310
|
></scb-menu-section>
|
|
302
|
-
`:
|
|
311
|
+
`:v}
|
|
303
312
|
|
|
304
313
|
${this._renderMenuNodes(r)}
|
|
305
314
|
|
|
306
|
-
${this.includeUtilityInMenu&&(t?.length??0)>0?
|
|
315
|
+
${this.includeUtilityInMenu&&(t?.length??0)>0?b`
|
|
307
316
|
<scb-menu-section label=''></scb-menu-section>
|
|
308
|
-
${t.map(
|
|
317
|
+
${t.map(f=>b`
|
|
309
318
|
<scb-menu-item
|
|
310
|
-
label=${
|
|
311
|
-
item-href=${
|
|
319
|
+
label=${f.label}
|
|
320
|
+
item-href=${f.href}
|
|
312
321
|
></scb-menu-item>
|
|
313
322
|
`)}
|
|
314
|
-
`:
|
|
323
|
+
`:v}
|
|
315
324
|
</scb-menu>
|
|
316
325
|
`}
|
|
317
326
|
</scb-drawer>
|
|
318
|
-
`:
|
|
319
|
-
`}_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),r=t.length>0?t:e,s=Number(this.reserveTabsCount),i=Number.isFinite(s)&&s>0?Math.floor(s):t.length>0?t.length:e.length;return
|
|
327
|
+
`:v}
|
|
328
|
+
`}_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),r=t.length>0?t:e,s=Number(this.reserveTabsCount),i=Number.isFinite(s)&&s>0?Math.floor(s):t.length>0?t.length:e.length;return b`${Array.from({length:i},(a,d)=>r[d%r.length]).map(a=>b`<span class="tab-skeleton" style=${`inline-size:${a}`}></span>`)}`}_renderLogo(){const e=(this.logoSrc??"").trim();return e?b`<img class="logo" src=${e} alt="" aria-hidden="true" />`:b`
|
|
320
329
|
<svg
|
|
321
330
|
class="logo"
|
|
322
331
|
viewBox="0 0 48 54"
|
|
@@ -350,7 +359,7 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
350
359
|
</clipPath>
|
|
351
360
|
</defs>
|
|
352
361
|
</svg>
|
|
353
|
-
`}},
|
|
362
|
+
`}},z=C,C._JSON_ARRAY={fromAttribute:m=>{if(m==null||m==="")return[];try{const e=JSON.parse(m);return Array.isArray(e)?e:[]}catch{return[]}},toAttribute:m=>m==null?null:JSON.stringify(m)},C.BP_SM_DEFAULT=600,C.BP_MD_DEFAULT=840,C.styles=P`
|
|
354
363
|
:host {
|
|
355
364
|
display: block;
|
|
356
365
|
margin-block-start: var(--scb-header-spacing-block-start, 0);
|
|
@@ -1142,6 +1151,23 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
1142
1151
|
border: 0;
|
|
1143
1152
|
}
|
|
1144
1153
|
|
|
1154
|
+
.drawer-close {
|
|
1155
|
+
box-sizing: border-box;
|
|
1156
|
+
display: flex;
|
|
1157
|
+
justify-content: flex-end;
|
|
1158
|
+
padding-block-start: var(--spacing-4, 12px);
|
|
1159
|
+
padding-inline: var(--spacing-4, 12px);
|
|
1160
|
+
background: var(--md-sys-color-surface-container-lowest);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
.drawer-close[hidden] {
|
|
1164
|
+
display: none;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
.drawer-close ::slotted(*) {
|
|
1168
|
+
flex: 0 0 auto;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1145
1171
|
.divider {
|
|
1146
1172
|
border-bottom: var(--stroke-border, 1px) solid
|
|
1147
1173
|
var(--md-sys-color-outline-variant, #e0e0e0);
|
|
@@ -1152,4 +1178,4 @@ import{_ as M,b as E,g as P,h,m as S,v as y,y as m}from"../../vendor/vendor.js";
|
|
|
1152
1178
|
:host([data-hide-logo-text]) .logo-text {
|
|
1153
1179
|
display: none;
|
|
1154
1180
|
}
|
|
1155
|
-
`,
|
|
1181
|
+
`,C);c([h({type:String,attribute:"max-width"})],o.prototype,"maxWidth",void 0);c([h({type:String,reflect:!0})],o.prototype,"spacing",void 0);c([h({type:String,attribute:"spacing-top",reflect:!0})],o.prototype,"spacingTop",void 0);c([h({type:String,attribute:"spacing-bottom",reflect:!0})],o.prototype,"spacingBottom",void 0);c([h({type:String,reflect:!0,converter:L})],o.prototype,"size",void 0);c([h({type:String,attribute:"logo-text"})],o.prototype,"logoText",void 0);c([h({type:String,attribute:"logotype-text"})],o.prototype,"logotypeText",void 0);c([h({type:String,attribute:"logo-alt"})],o.prototype,"logoAlt",void 0);c([h({type:String,attribute:"logo-href"})],o.prototype,"logoHref",void 0);c([h({type:String,attribute:"logo-src"})],o.prototype,"logoSrc",void 0);c([h({type:String,attribute:"logo-width"})],o.prototype,"logoWidth",void 0);c([h({type:String,attribute:"logo-height"})],o.prototype,"logoHeight",void 0);c([h({type:String,attribute:"logo-aspect-ratio"})],o.prototype,"logoAspectRatio",void 0);c([h({type:Boolean,attribute:"logo-invert-dm",reflect:!0,converter:$})],o.prototype,"logoInvertDm",void 0);c([h({type:Boolean,reflect:!0})],o.prototype,"banner",void 0);c([h({type:String,attribute:"banner-label"})],o.prototype,"bannerLabel",void 0);c([h({type:Array,attribute:"tabs",converter:o._JSON_ARRAY})],o.prototype,"tabs",void 0);c([h({type:Number,attribute:"active-tab"})],o.prototype,"activeTab",void 0);c([h({type:Boolean,attribute:"reserve-tabs",reflect:!0,converter:$})],o.prototype,"reserveTabs",void 0);c([h({type:Number,attribute:"reserve-tabs-count"})],o.prototype,"reserveTabsCount",void 0);c([h({type:String,attribute:"reserve-tabs-widths"})],o.prototype,"reserveTabsWidths",void 0);c([h({type:Boolean,attribute:"layout-pending",reflect:!0,converter:$})],o.prototype,"layoutPending",void 0);c([h({type:Array,attribute:"utility-items",converter:o._JSON_ARRAY})],o.prototype,"utilityItems",void 0);c([h({type:String,attribute:"search-placeholder"})],o.prototype,"searchPlaceholder",void 0);c([h({type:String,attribute:"search-button-label"})],o.prototype,"searchButtonLabel",void 0);c([h({type:String,attribute:"menu-label"})],o.prototype,"menuLabel",void 0);c([h({type:String,attribute:"menu-button-label"})],o.prototype,"menuButtonLabel",void 0);c([h({type:String,attribute:"menu-sub-label"})],o.prototype,"menuSubLabel",void 0);c([h({type:String,attribute:"menu-section-label"})],o.prototype,"menuSectionLabel",void 0);c([h({type:String,attribute:"menu-search-placeholder"})],o.prototype,"menuSearchPlaceholder",void 0);c([h({type:Array,attribute:"menu-data",converter:o._JSON_ARRAY})],o.prototype,"menuData",void 0);c([h({type:Boolean,attribute:"defer-drawer",reflect:!0,converter:$})],o.prototype,"deferDrawer",void 0);c([h({type:Boolean,attribute:"show-drawer",reflect:!0,converter:E})],o.prototype,"showDrawer",void 0);c([h({type:Boolean,attribute:"always-show-menu-button",reflect:!0,converter:$})],o.prototype,"alwaysShowMenuButton",void 0);c([h({type:Boolean,attribute:"show-search",reflect:!0,converter:E})],o.prototype,"showSearch",void 0);c([h({type:Boolean,attribute:"include-utility-in-menu",reflect:!0,converter:$})],o.prototype,"includeUtilityInMenu",void 0);c([h({type:Boolean,attribute:"drawer-overlay",reflect:!0,converter:E})],o.prototype,"drawerOverlay",void 0);c([h({type:String,attribute:"search-max"})],o.prototype,"searchMax",void 0);c([h({type:String,attribute:"search-min"})],o.prototype,"searchMin",void 0);c([h({type:String,attribute:"search-height"})],o.prototype,"searchHeight",void 0);c([h({type:String,attribute:"search-text",reflect:!0})],o.prototype,"searchText",void 0);c([k()],o.prototype,"_drawerId",void 0);c([k()],o.prototype,"_menuExpanded",void 0);c([k()],o.prototype,"_searchId",void 0);c([k()],o.prototype,"_drawerReady",void 0);c([k()],o.prototype,"_mobileSearchOpen",void 0);c([k()],o.prototype,"_slotNavItems",void 0);c([k()],o.prototype,"_slotUtils",void 0);c([k()],o.prototype,"_slotMenu",void 0);c([k()],o.prototype,"_collapsed",void 0);c([k()],o.prototype,"_hideLogoText",void 0);o=z=c([D("scb-header")],o);
|
|
@@ -168,4 +168,4 @@ import{_ as m,b as _,g as v,h as s,v as i,y as r}from"../../vendor/vendor.js";im
|
|
|
168
168
|
md-filled-tonal-icon-button::part(button) {
|
|
169
169
|
border-radius: var(--scb-icon-button-shape-radius) !important;
|
|
170
170
|
}
|
|
171
|
-
`,p);function f(){const l=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??l,e=this.mapSpacingToken(this.spacingBottom)??l,a=this.mapSpacingToken(this.spacingLeft),c=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-icon-button-spacing-block-start",t):this.style.removeProperty("--scb-icon-button-spacing-block-start"),e?this.style.setProperty("--scb-icon-button-spacing-block-end",e):this.style.removeProperty("--scb-icon-button-spacing-block-end"),a?this.style.setProperty("--scb-icon-button-spacing-inline-start",a):this.style.removeProperty("--scb-icon-button-spacing-inline-start"),c?this.style.setProperty("--scb-icon-button-spacing-inline-end",c):this.style.removeProperty("--scb-icon-button-spacing-inline-end")}o([s({type:String})],n.prototype,"icon",void 0);o([s({type:Boolean,reflect:!0})],n.prototype,"filled",null);o([s({type:Boolean,attribute:"icon-filled",reflect:!0})],n.prototype,"iconFilled",null);o([s({type:String,attribute:"aria-label"})],n.prototype,"ariaLabel",void 0);o([s({type:String})],n.prototype,"variant",void 0);o([s({type:String,reflect:!0})],n.prototype,"size",void 0);o([s({type:String,reflect:!0})],n.prototype,"shape",void 0);o([s({type:Boolean,reflect:!0})],n.prototype,"toggle",void 0);o([s({type:Boolean,reflect:!0})],n.prototype,"selected",void 0);o([s({type:String})],n.prototype,"toggleofficon",void 0);o([s({type:String})],n.prototype,"toggleonicon",void 0);o([s({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);o([s({type:String,reflect:!0})],n.prototype,"spacing",void 0);o([s({type:String,attribute:"spacing-top",reflect:!0})],n.prototype,"spacingTop",void 0);o([s({type:String,attribute:"spacing-bottom",reflect:!0})],n.prototype,"spacingBottom",void 0);o([s({type:String,attribute:"spacing-left",reflect:!0})],n.prototype,"spacingLeft",void 0);o([s({type:String,attribute:"spacing-right",reflect:!0})],n.prototype,"spacingRight",void 0);o([s({type:String})],n.prototype,"href",void 0);o([s({type:String})],n.prototype,"target",void 0);o([s({type:String})],n.prototype,"rel",void 0);n=o([v("scb-icon-button")],n);
|
|
171
|
+
`,p);function f(){const l=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??l,e=this.mapSpacingToken(this.spacingBottom)??l,a=this.mapSpacingToken(this.spacingLeft),c=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-icon-button-spacing-block-start",t):this.style.removeProperty("--scb-icon-button-spacing-block-start"),e?this.style.setProperty("--scb-icon-button-spacing-block-end",e):this.style.removeProperty("--scb-icon-button-spacing-block-end"),a?this.style.setProperty("--scb-icon-button-spacing-inline-start",a):this.style.removeProperty("--scb-icon-button-spacing-inline-start"),c?this.style.setProperty("--scb-icon-button-spacing-inline-end",c):this.style.removeProperty("--scb-icon-button-spacing-inline-end")}o([s({type:String})],n.prototype,"icon",void 0);o([s({type:Boolean,reflect:!0})],n.prototype,"filled",null);o([s({type:Boolean,attribute:"icon-filled",reflect:!0})],n.prototype,"iconFilled",null);o([s({type:String,attribute:"aria-label"})],n.prototype,"ariaLabel",void 0);o([s({type:String})],n.prototype,"variant",void 0);o([s({type:String,reflect:!0})],n.prototype,"size",void 0);o([s({type:String,reflect:!0})],n.prototype,"shape",void 0);o([s({type:Boolean,reflect:!0})],n.prototype,"toggle",void 0);o([s({type:Boolean,reflect:!0})],n.prototype,"selected",void 0);o([s({type:String})],n.prototype,"toggleofficon",void 0);o([s({type:String})],n.prototype,"toggleonicon",void 0);o([s({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0);o([s({type:String,reflect:!0})],n.prototype,"spacing",void 0);o([s({type:String,attribute:"spacing-top",reflect:!0})],n.prototype,"spacingTop",void 0);o([s({type:String,attribute:"spacing-bottom",reflect:!0})],n.prototype,"spacingBottom",void 0);o([s({type:String,attribute:"spacing-left",reflect:!0})],n.prototype,"spacingLeft",void 0);o([s({type:String,attribute:"spacing-right",reflect:!0})],n.prototype,"spacingRight",void 0);o([s({type:String})],n.prototype,"href",void 0);o([s({type:String})],n.prototype,"target",void 0);o([s({type:String})],n.prototype,"rel",void 0);n=o([v("scb-icon-button")],n);export{n as ScbIconButton};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/ripple.js","../../vendor/rolldown-runtime.js","../../vendor/vendor.js","../../vendor/attachable-controller.js","../../vendor/vendor-lit.js","../../vendor/md-focus-ring.js","../../vendor/icon.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as g,b as _,g as f,h as r,m as v,v as u,y as l}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as s}from"../../vendor/decorate.js";import"
|
|
2
|
+
import{_ as g,b as _,g as f,h as r,m as v,v as u,y as l}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as s}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import{t as h}from"../../vendor/preload-helper.js";(function(){try{var a=typeof globalThis<"u"?globalThis:window;if(!a.__scb_ce_guard_installed__){a.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,n,d){try{customElements.get(t)||e(t,n,d)}catch(p){var m=String(p||"");if(m.indexOf("already been used")===-1&&m.indexOf("NotSupportedError")===-1)throw p}}}}catch{}})();var c,o,b={fromAttribute:a=>a==null?!1:!/^(false|0|off|no)$/i.test(a),toAttribute:a=>a?"":null},i=(c=class extends g{constructor(...e){super(...e),this.label="",this.selected=!1,this.noHighlightSelected=!1,this.leadingIcon="",this.itemHref="",this.hasChildren=!1,this.loading=!1,this.hasSlotContent=!1,this.expanded=!1,this.__submenuId=`sub-${Math.random().toString(36).slice(2)}`,this.__focusId=`f-${Math.random().toString(36).slice(2)}`,this._toggleExpand=t=>{t&&t.stopPropagation(),this.__isExpandable&&this.__setExpanded(!this.expanded)},this._onButtonClick=t=>{t.stopPropagation(),this._dispatchSelect(),this._toggleExpand()},this._onLinkClick=()=>{this._dispatchSelect()},this._onKeyDown=t=>{const n=Array.from(this.closest("scb-sub-menu, scb-menu")?.querySelectorAll("scb-menu-item")||[]),d=n.indexOf(this);switch(t.key){case"ArrowDown":t.preventDefault(),(n[d+1]||n[0]).shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break;case"ArrowUp":t.preventDefault(),(n[d-1]||n[n.length-1]).shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break;case"Home":t.preventDefault(),n[0].shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break;case"End":t.preventDefault(),n[n.length-1].shadowRoot?.querySelector(".scb-menu-label-text")?.focus();break}}}get __submenuEl(){return this.renderRoot.querySelector(`#${this.__submenuId}`)}get __isExpandable(){return this.hasSlotContent||this.hasChildren}async __ensureDepsLoaded(){o.__rippleLoaded||(await h(()=>import("../../vendor/ripple.js").then(e=>e.t),__vite__mapDeps([0,1,2,3,4]),import.meta.url),o.__rippleLoaded=!0),o.__focusRingLoaded||(await h(()=>import("../../vendor/md-focus-ring.js").then(e=>e.t),__vite__mapDeps([5,1,2,3,4]),import.meta.url),o.__focusRingLoaded=!0),this.leadingIcon&&!o.__iconLoaded&&(await h(()=>import("../../vendor/icon.js").then(e=>e.t),__vite__mapDeps([6,1,2,4]),import.meta.url),o.__iconLoaded=!0)}__syncHasSlotContentFromLightDom(){const e=Array.from(this.children);this.hasSlotContent=e.some(t=>t.tagName==="SCB-SUB-MENU")}connectedCallback(){super.connectedCallback(),this.__syncHasSlotContentFromLightDom()}_onSlotChange(e){const t=e.target.assignedElements({flatten:!0});this.hasSlotContent=t.some(n=>n.tagName==="SCB-SUB-MENU")}__setExpanded(e){if(!this.__isExpandable)return;this.expanded=e;const t={item:this,expanded:e,hasChildren:this.hasChildren,hasSlotContent:this.hasSlotContent,loading:this.loading,lazy:this.hasChildren&&!this.hasSlotContent};this.dispatchEvent(new CustomEvent("scb-menu-expand",{bubbles:!0,composed:!0,detail:t})),this.dispatchEvent(new CustomEvent("scbmenuexpand",{bubbles:!0,composed:!0,detail:t}))}_dispatchSelect(){this.dispatchEvent(new CustomEvent("scb-menu-select",{bubbles:!0,composed:!0,detail:{item:this}})),this.dispatchEvent(new CustomEvent("scbmenuselect",{bubbles:!0,composed:!0,detail:{item:this}}))}async firstUpdated(){await this.__ensureDepsLoaded(),this.__applyInert()}updated(e){e.has("leadingIcon")&&this.leadingIcon&&this.__ensureDepsLoaded(),(e.has("hasSlotContent")&&this.hasSlotContent||e.has("hasChildren")&&this.hasChildren||e.has("loading")&&this.loading)&&this.__ensureDepsLoaded(),(e.has("expanded")||e.has("hasChildren")||e.has("loading"))&&this.__applyInert()}__applyInert(){const e=this.__submenuEl;e&&(this.loading?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),this.expanded?(e.removeAttribute("inert"),e.setAttribute("aria-hidden","false")):(e.setAttribute("inert",""),e.setAttribute("aria-hidden","true")))}render(){const e=!!this.leadingIcon,t=!!this.itemHref,n=this.__isExpandable;return l`
|
|
3
3
|
<div class="scb-menu-item">
|
|
4
4
|
<div class="scb-menu-item-label" ?selected=${this.selected} ?no-highlight-selected=${this.noHighlightSelected}>
|
|
5
5
|
${t?l`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as h,b as u,g as b,h as a,s as g,y as d}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import{t as l}from"../../vendor/decorate.js";import"
|
|
1
|
+
import{_ as h,b as u,g as b,h as a,s as g,y as d}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import{t as l}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import"./scb-select-option.js";(function(){try{var p=typeof globalThis<"u"?globalThis:window;if(!p.__scb_ce_guard_installed__){p.__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(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var c,i=(c=class extends h{constructor(){super(),this._optionsObserver=null,this._internals=null,this.focusedIndex=-1,this.variant="single-select",this.value="",this.values=[],this.disabled=!1,this.required=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.withRadiobuttons=!1,this.noHighlightSelected=!1,this.size="large",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.zIndex=void 0,this._form=null,this._formResetHandler=null,this._formSubmitHandler=null,this._initialValue="",this._initialValues=[],this._customValidationMessage="",this._onDocumentClick=e=>{this.open&&(e.composedPath().includes(this)||this._setOpen(!1))},this._onSlotClick=e=>{const t=this.shadowRoot?.querySelector("slot");if(!t)return;const s=t.assignedElements({flatten:!0}).filter(o=>o.tagName.toLowerCase()==="scb-select-option"),r=e.composedPath(),n=s.find(o=>r.includes(o));n&&(this._selectOption(n),e.stopPropagation())},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._toggleOpen())},this._onOptionKeyDown=e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();const t=this.shadowRoot?.querySelector("slot");if(!t)return;const s=t.assignedElements({flatten:!0}).filter(o=>o.tagName.toLowerCase()==="scb-select-option"),r=e.composedPath(),n=s.find(o=>r.includes(o));n&&this._selectOption(n)}},"attachInternals"in this&&(this._internals=this.attachInternals())}_syncDensityForSize(){this.size==="extra-small"?this.setAttribute("data-density","-5"):this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentClick),this._optionsObserver=new MutationObserver(()=>{this.requestUpdate()}),this._optionsObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","value","disabled"]}),this._syncDensityForSize(),this._initialValue=this.value,this._initialValues=Array.isArray(this.values)?[...this.values]:[],this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.value=this._initialValue,this.values=Array.isArray(this._initialValues)?[...this._initialValues]:[],this._syncFormValue(),this._syncValidity(),this.requestUpdate()},this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form.addEventListener("reset",this._formResetHandler,!0),this._form.addEventListener("submit",this._formSubmitHandler,!0))}disconnectedCallback(){document.removeEventListener("mousedown",this._onDocumentClick),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),this._form&&this._formSubmitHandler&&this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._optionsObserver?.disconnect(),this._optionsObserver=null,super.disconnectedCallback()}_getMultiValues(){return Array.isArray(this.values)&&this.values.length>0?this.values:this.value?this.value.split(",").map(e=>e.trim()).filter(Boolean):[]}_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,r=this._mapSpacingToken(this.spacingLeft),n=this._mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-select-spacing-block-start",t):this.style.removeProperty("--scb-select-spacing-block-start"),s?this.style.setProperty("--scb-select-spacing-block-end",s):this.style.removeProperty("--scb-select-spacing-block-end"),r?this.style.setProperty("--scb-select-spacing-inline-start",r):this.style.removeProperty("--scb-select-spacing-inline-start"),n?this.style.setProperty("--scb-select-spacing-inline-end",n):this.style.removeProperty("--scb-select-spacing-inline-end")}_setOpen(e){this.open!==e&&(this.open=e,e?(this.focusedIndex=0,this.requestUpdate()):this.focusedIndex=-1)}_toggleOpen(){this.disabled||this._setOpen(!this.open)}_hasMoreThanFourOptions(){const e=this.shadowRoot?.querySelector("slot");if(!e)return!1;const t=e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option");return["extra-small","small","medium"].includes(this.size)?t.length>5:t.length>4}_selectOption(e){if(!e.disabled){if(this.variant==="multi-select"){const t=this._getMultiValues();t.indexOf(e.value)>-1?this.values=t.filter(s=>s!==e.value):this.values=[...t,e.value],this.value=this.values.join(","),this.dispatchEvent(new CustomEvent("change",{detail:{values:this.values},bubbles:!0,composed:!0}))}else this.variant==="single-select"&&this.withRadiobuttons?(this.value=e.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))):(this.value=e.value,this._setOpen(!1),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})));this._updateOptionsChecked(),this.requestUpdate()}}_getOptionLabel(e){return e.label||e.textContent?.trim()||""}_getSelectedLabel(){const e=this.shadowRoot?.querySelector("slot");if(!e)return"";const t=e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option");if(this.variant==="multi-select"){const s=this._getMultiValues(),r=t.filter(n=>s.includes(n.value));return r&&r.length>0?r.map(n=>this._getOptionLabel(n)).join(", "):""}else{const s=t.find(r=>r.value===this.value);return s?this._getOptionLabel(s):""}}firstUpdated(){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),this._applySpacing()}updated(e){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),e.has("size")&&this._syncDensityForSize(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing()}_syncFormValue(){if(this._internals){if(this.disabled||!this.name){this._internals.setFormValue(null);return}if(this.variant==="multi-select"){const e=this._getMultiValues();if(e.length===0){this._internals.setFormValue(null);return}const t=new FormData;e.forEach(s=>t.append(this.name,s)),this._internals.setFormValue(t);return}this._internals.setFormValue(this.value||null)}}_getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!(this.variant==="multi-select"?this._getMultiValues().length>0:this.value)?"Välj ett alternativ.":""}_syncValidity(){if(!this._internals)return;const e=this.disabled?"":this._getValidationMessage(),t=this.shadowRoot?.querySelector(".selected-value");if(!e){this._internals.setValidity({}),this.removeAttribute("aria-invalid"),t&&t.setCustomValidity("");return}t&&t.setCustomValidity(e),this._internals.setValidity({valueMissing:!0},e,t??void 0),this.setAttribute("aria-invalid","true")}checkValidity(){return!this._getValidationMessage()}reportValidity(){return this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=e,this._syncValidity()}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}_updateOptionsChecked(){const e=this.shadowRoot?.querySelector("slot");e&&e.assignedElements({flatten:!0}).filter(t=>t.tagName.toLowerCase()==="scb-select-option").forEach(t=>{if(this.noHighlightSelected?t.setAttribute("no-highlight-selected",""):t.removeAttribute("no-highlight-selected"),this.variant==="multi-select"){const s=this._getMultiValues();t.showCheckbox=!0,t.checked=s.includes(t.value),t.showRadio=!1}else t.showCheckbox=!1,t.checked=this.value===t.value,this.withRadiobuttons&&(t.showRadio=!0)})}render(){return d`
|
|
2
2
|
${this.label?d`
|
|
3
3
|
<label
|
|
4
4
|
class="select-label ${this.supportingText?"":"select-label--without-supporting"}"
|