scb-wc-test 0.1.11 → 0.1.13
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/all.js +2 -0
- package/index.d.ts +1 -0
- package/index.js +34 -32
- package/mvc/components/all.js +1 -0
- package/mvc/components/scb-accordion/scb-accordion-item.js +21 -61
- package/mvc/components/scb-app-bar/scb-app-bar.js +1 -1
- package/mvc/components/scb-avatar/scb-avatar.js +1 -1
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +1 -1
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +1 -1
- package/mvc/components/scb-button/scb-button.js +1 -1
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +165 -126
- package/mvc/components/scb-card/scb-card.js +223 -217
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +1 -1
- package/mvc/components/scb-checkbox/scb-checkbox.js +9 -11
- package/mvc/components/scb-chips/scb-chip.js +1 -1
- package/mvc/components/scb-dialog/scb-dialog.js +2 -2
- package/mvc/components/scb-divider/scb-divider.js +43 -53
- package/mvc/components/scb-drawer/scb-drawer-item.js +2 -2
- package/mvc/components/scb-drawer/scb-drawer-section.js +4 -4
- package/mvc/components/scb-drawer/scb-drawer.js +1 -1
- package/mvc/components/scb-drawer/scb-sub-drawer.js +1 -1
- package/mvc/components/scb-fact-card/scb-fact-card-content.js +1 -1
- package/mvc/components/scb-fact-card/scb-fact-card.js +68 -55
- package/mvc/components/scb-footer/scb-footer-section.js +2 -2
- package/mvc/components/scb-footer/scb-footer.js +1 -1
- package/mvc/components/scb-grid/scb-grid-item.js +5 -3
- package/mvc/components/scb-grid/scb-grid.js +27 -10
- package/mvc/components/scb-grid/scb-stack.js +10 -6
- package/mvc/components/scb-header/scb-header-drawer-group.js +1 -1
- package/mvc/components/scb-header/scb-header-drawer-item.js +1 -1
- package/mvc/components/scb-header/scb-header-tab.js +1 -1
- package/mvc/components/scb-header/scb-header-utility.js +1 -1
- package/mvc/components/scb-header/scb-header.js +53 -49
- package/mvc/components/scb-icon-button/scb-icon-button.js +45 -80
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +84 -58
- package/mvc/components/scb-link/scb-link.js +39 -16
- package/mvc/components/scb-list/scb-list-item.js +115 -37
- package/mvc/components/scb-list/scb-list.js +16 -7
- package/mvc/components/scb-menu/scb-menu-item.js +1 -1
- package/mvc/components/scb-menu/scb-menu.js +1 -1
- package/mvc/components/scb-menu/scb-sub-menu.js +1 -1
- package/mvc/components/scb-notification/scb-notification.js +1 -1
- package/mvc/components/scb-notification-card/scb-notification-card.js +187 -0
- package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +1 -1
- package/mvc/components/scb-radio-button/scb-radio-button.js +29 -36
- package/mvc/components/scb-radio-button/scb-radio-group.js +1 -1
- package/mvc/components/scb-search/scb-search.js +48 -37
- package/mvc/components/scb-snackbar/scb-snackbar.js +8 -8
- package/mvc/components/scb-status-pill/scb-status-pill.js +1 -1
- package/mvc/components/scb-switch/scb-switch.js +1 -1
- package/mvc/components/scb-tabs/scb-primary-tab.js +1 -1
- package/mvc/components/scb-tabs/scb-secondary-tab.js +1 -1
- package/mvc/components/scb-tabs/scb-tabs.js +1 -1
- package/mvc/components/scb-textfield/scb-textfield.js +1 -1
- package/mvc/components/scb-toc/scb-toc-item.js +1 -1
- package/mvc/components/scb-toc/scb-toc.js +2 -2
- package/mvc/components/scb-tooltip/scb-tooltip.js +1 -1
- package/mvc/vendor/vendor-material.js +232 -312
- package/mvc/vendor/vendor.js +19 -23
- package/package.json +6 -2
- package/scb-accordion/scb-accordion-item.js +47 -98
- package/scb-calendar-card/scb-calendar-card.d.ts +6 -4
- package/scb-calendar-card/scb-calendar-card.js +207 -154
- package/scb-card/scb-card.d.ts +8 -3
- package/scb-card/scb-card.js +265 -250
- package/scb-checkbox/scb-checkbox.d.ts +1 -0
- package/scb-checkbox/scb-checkbox.js +56 -49
- package/scb-divider/scb-divider.d.ts +16 -4
- package/scb-divider/scb-divider.js +63 -69
- package/scb-fact-card/scb-fact-card.d.ts +8 -7
- package/scb-fact-card/scb-fact-card.js +100 -78
- package/scb-grid/scb-grid-item.d.ts +7 -2
- package/scb-grid/scb-grid-item.js +47 -33
- package/scb-grid/scb-grid.d.ts +7 -3
- package/scb-grid/scb-grid.js +57 -21
- package/scb-grid/scb-stack.d.ts +5 -1
- package/scb-grid/scb-stack.js +57 -31
- package/scb-header/scb-header.d.ts +1 -2
- package/scb-header/scb-header.js +154 -162
- package/scb-icon-button/scb-icon-button.d.ts +15 -11
- package/scb-icon-button/scb-icon-button.js +149 -132
- package/scb-keyfigure-card/scb-keyfigure-card.d.ts +6 -1
- package/scb-keyfigure-card/scb-keyfigure-card.js +139 -93
- package/scb-link/scb-link.d.ts +1 -0
- package/scb-link/scb-link.js +65 -38
- package/scb-list/scb-list-item.d.ts +8 -5
- package/scb-list/scb-list-item.js +183 -73
- package/scb-list/scb-list.d.ts +5 -0
- package/scb-list/scb-list.js +71 -21
- package/scb-notification-card/scb-notification-card.d.ts +18 -0
- package/scb-notification-card/scb-notification-card.js +264 -0
- package/scb-radio-button/scb-radio-button.js +46 -53
- package/scb-search/scb-search.d.ts +8 -0
- package/scb-search/scb-search.js +176 -139
- package/scb-wc-test.bundle.js +1870 -1546
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as d,n as o,i as y,x as g,t as b}from"../../vendor/vendor.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(s,i,a){try{customElements.get(s)||t(s,i,a)}catch(p){var c=String(p||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw p}}}}catch{}})();var v=Object.defineProperty,_=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},n=(e,t,s,i)=>{for(var a=i>1?void 0:i?_(t,s):t,c=e.length-1,p;c>=0;c--)(p=e[c])&&(a=(i?p(t,s,a):p(a))||a);return i&&a&&v(t,s,a),a},m=(e,t,s)=>t.has(e)||f("Cannot "+s),w=(e,t,s)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),u=(e,t,s)=>(m(e,t,"access private method"),s),l,h;let r=class extends y{constructor(){super(...arguments),w(this,l),this.direction="column",this.gap="",this.rowGap="",this.columnGap="",this.align="stretch",this.justify="start",this.wrap=!1,this.inline=!1}firstUpdated(){u(this,l,h).call(this)}updated(){u(this,l,h).call(this)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}parseGapShorthand(e){if(!e)return{};const t=e.trim().split(/\s+/);if(t.length===1){const s=this.mapSpacingToken(t[0]);return{row:s,col:s}}return{row:this.mapSpacingToken(t[0]),col:this.mapSpacingToken(t[1])}}render(){return g`<slot></slot>`}};l=new WeakSet;h=function(){this.style.setProperty("--scb-stack-direction",this.direction);const e="var(--spacing-5, 16px)",t=this.parseGapShorthand(this.gap),s=this.mapSpacingToken(this.rowGap)??t.row??e,i=this.mapSpacingToken(this.columnGap)??t.col??e;this.style.setProperty("--scb-stack-gap",`${s}`),this.style.setProperty("--scb-stack-row-gap",s),this.style.setProperty("--scb-stack-column-gap",i);const a={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},c={start:"flex-start",center:"center",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly"};this.style.setProperty("--scb-stack-align",a[this.align]??"stretch"),this.style.setProperty("--scb-stack-justify",c[this.justify]??"flex-start"),this.style.setProperty("--scb-stack-wrap",this.wrap?"wrap":"nowrap")};r.styles=d`
|
|
2
2
|
:host {
|
|
3
3
|
box-sizing: border-box;
|
|
4
4
|
display: var(--scb-stack-display, flex);
|
|
5
5
|
flex-direction: var(--scb-stack-direction, column);
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
/* Longhands med fallback till --scb-stack-gap och token-default */
|
|
8
|
+
row-gap: var(--scb-stack-row-gap, var(--scb-stack-gap, var(--spacing-5, 16px)));
|
|
9
|
+
column-gap: var(--scb-stack-column-gap, var(--scb-stack-gap, var(--spacing-5, 16px)));
|
|
10
|
+
|
|
7
11
|
align-items: var(--scb-stack-align, stretch);
|
|
8
12
|
justify-content: var(--scb-stack-justify, flex-start);
|
|
9
13
|
flex-wrap: var(--scb-stack-wrap, nowrap);
|
|
14
|
+
|
|
10
15
|
width: auto;
|
|
11
16
|
max-width: 100%;
|
|
17
|
+
min-inline-size: 0;
|
|
12
18
|
}
|
|
13
|
-
:host([inline]) {
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
`;i([l({type:String,reflect:!0})],a.prototype,"direction",2);i([l({type:String,reflect:!0})],a.prototype,"gap",2);i([l({type:String,reflect:!0})],a.prototype,"align",2);i([l({type:String,reflect:!0})],a.prototype,"justify",2);i([l({type:Boolean,reflect:!0})],a.prototype,"wrap",2);i([l({type:Boolean,reflect:!0})],a.prototype,"inline",2);a=i([v("scb-stack")],a);
|
|
19
|
+
:host([inline]) { --scb-stack-display: inline-flex; }
|
|
20
|
+
`;n([o({type:String,reflect:!0})],r.prototype,"direction",2);n([o({type:String,reflect:!0})],r.prototype,"gap",2);n([o({type:String,attribute:"row-gap",reflect:!0})],r.prototype,"rowGap",2);n([o({type:String,attribute:"column-gap",reflect:!0})],r.prototype,"columnGap",2);n([o({type:String,reflect:!0})],r.prototype,"align",2);n([o({type:String,reflect:!0})],r.prototype,"justify",2);n([o({type:Boolean,reflect:!0})],r.prototype,"wrap",2);n([o({type:Boolean,reflect:!0})],r.prototype,"inline",2);r=n([b("scb-stack")],r);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as _,n as c,i as p,x as u,t as d}from"../../vendor/vendor.js";(function(){try{var i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__scb_ce_guard_installed__=!0;var r=customElements.define.bind(customElements);customElements.define=function(t,s,e){try{customElements.get(t)||r(t,s,e)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,l=(i,r,t,s)=>{for(var e=s>1?void 0:s?b(r,t):r,n=i.length-1,o;n>=0;n--)(o=i[n])&&(e=(s?o(r,t,e):o(e))||e);return s&&e&&f(r,t,e),e};let a=class extends p{constructor(){super(...arguments),this.label=""}render(){return u`<slot></slot>`}};a.styles=_`:host{display:none !important}`;l([c({type:String})],a.prototype,"label",2);l([c({type:String})],a.prototype,"icon",2);a=l([d("scb-header-drawer-group")],a);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as p,n as c,i as _,x as d,t as f}from"../../vendor/vendor.js";(function(){try{var a=typeof globalThis<"u"?globalThis:window;if(!a.__scb_ce_guard_installed__){a.__scb_ce_guard_installed__=!0;var r=customElements.define.bind(customElements);customElements.define=function(t,s,e){try{customElements.get(t)||r(t,s,e)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var u=Object.defineProperty,b=Object.getOwnPropertyDescriptor,l=(a,r,t,s)=>{for(var e=s>1?void 0:s?b(r,t):r,n=a.length-1,o;n>=0;n--)(o=a[n])&&(e=(s?o(r,t,e):o(e))||e);return s&&e&&u(r,t,e),e};let i=class extends _{constructor(){super(...arguments),this.label="",this.href="#"}render(){return d`<slot></slot>`}};i.styles=p`:host{display:none !important}`;l([c({type:String})],i.prototype,"label",2);l([c({type:String})],i.prototype,"href",2);l([c({type:String})],i.prototype,"icon",2);i=l([f("scb-header-drawer-item")],i);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as _,n as c,i as f,x as d,t as p}from"../../vendor/vendor.js";(function(){try{var i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__scb_ce_guard_installed__=!0;var r=customElements.define.bind(customElements);customElements.define=function(t,s,e){try{customElements.get(t)||r(t,s,e)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var u=Object.defineProperty,b=Object.getOwnPropertyDescriptor,l=(i,r,t,s)=>{for(var e=s>1?void 0:s?b(r,t):r,n=i.length-1,o;n>=0;n--)(o=i[n])&&(e=(s?o(r,t,e):o(e))||e);return s&&e&&u(r,t,e),e};let a=class extends f{constructor(){super(...arguments),this.label="",this.href="#"}render(){return d`<slot></slot>`}};a.styles=_`:host{display:none !important}`;l([c({type:String})],a.prototype,"label",2);l([c({type:String})],a.prototype,"href",2);a=l([p("scb-header-tab")],a);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as p,n as c,i as _,x as f,t as u}from"../../vendor/vendor.js";(function(){try{var l=typeof globalThis<"u"?globalThis:window;if(!l.__scb_ce_guard_installed__){l.__scb_ce_guard_installed__=!0;var r=customElements.define.bind(customElements);customElements.define=function(t,s,e){try{customElements.get(t)||r(t,s,e)}catch(i){var n=String(i||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw i}}}}catch{}})();var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,a=(l,r,t,s)=>{for(var e=s>1?void 0:s?y(r,t):r,n=l.length-1,i;n>=0;n--)(i=l[n])&&(e=(s?i(r,t,e):i(e))||e);return s&&e&&d(r,t,e),e};let o=class extends _{constructor(){super(...arguments),this.label="",this.href="#"}render(){return f`<slot></slot>`}};o.styles=p`:host{display:none !important}`;a([c({type:String})],o.prototype,"label",2);a([c({type:String})],o.prototype,"href",2);a([c({type:String})],o.prototype,"target",2);o=a([u("scb-header-utility")],o);
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as f,n as l,r as p,i as x,x as c,E as d,t as S}from"../../vendor/vendor.js";import"../scb-grid/scb-grid-item.js";import"../scb-grid/scb-grid.js";import"../scb-link/scb-link.js";import"../scb-search/scb-search.js";import"../scb-tabs/scb-tabs.js";import"../scb-tabs/scb-secondary-tab.js";import"../scb-drawer/scb-drawer.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";import"../scb-list/scb-list.js";import"../../vendor/preload-helper.js";import"../scb-list/scb-list-item.js";import"../scb-tabs/scb-primary-tab.js";import"../scb-divider/scb-divider.js";import"../scb-drawer/scb-drawer-item.js";import"../scb-drawer/scb-drawer-section.js";import"../scb-drawer/scb-sub-drawer.js";import"../scb-tooltip/scb-tooltip.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(s,i,o){try{customElements.get(s)||t(s,i,o)}catch(n){var h=String(n||"");if(h.indexOf("already been used")===-1&&h.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var C=Object.defineProperty,M=Object.getOwnPropertyDescriptor,a=(e,t,s,i)=>{for(var o=i>1?void 0:i?M(t,s):t,h=e.length-1,n;h>=0;h--)(n=e[h])&&(o=(i?n(t,s,o):n(o))||o);return i&&o&&C(t,s,o),o};const y={fromAttribute:e=>e==null?!0:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>String(!!e)};let r=class extends x{constructor(){super(...arguments),this.maxWidth="1440px",this.logoText="Statistikmyndigheten",this.logoHref="/",this.banner=!1,this.tabs=[],this.activeTab=0,this.utilityItems=[],this.showDrawer=!0,this.showSearch=!0,this.includeUtilityInDrawer=!1,this._drawerId="main-drawer",this._drawerMounted=!1,this._drawerExpanded=!1,this._searchId="header-search",this._slotTabs=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{this._scheduleMeasure()},this._onDrawerSelect=e=>{this.dispatchEvent(new CustomEvent("drawer-select",{detail:e.detail,bubbles:!0,composed:!0})),this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._harvestPending=!1,this._harvest=()=>{const e=this._slotEl;if(!e)return;const t=e.assignedElements({flatten:!0}),s=[],i=[],o=[],h=n=>({label:n.getAttribute("label")??"",href:n.getAttribute("href")??void 0,icon:n.getAttribute("icon")??void 0});for(const n of t){const u=n.tagName.toLowerCase();if(u==="scb-header-tab"){s.push({label:n.getAttribute("label")??"",href:n.getAttribute("href")??"#"});continue}if(u==="scb-header-utility"){i.push({label:n.getAttribute("label")??"",href:n.getAttribute("href")??"#",target:n.getAttribute("target")??void 0});continue}if(u==="scb-header-drawer-group"){const b={label:n.getAttribute("label")??"",icon:n.getAttribute("icon")??void 0,children:[]};n.querySelectorAll("scb-header-drawer-item").forEach(m=>b.children.push(h(m))),o.push(b);continue}u==="scb-header-drawer-item"&&o.push(h(n))}this._slotTabs=s,this._slotUtils=i,this._slotMenu=o,queueMicrotask(()=>{this.updateComplete.then(()=>{this._applyActiveToTabs(),this._scheduleMeasure()})})},this._measure=()=>{const e=this._top,t=this._logoGroup;if(!e||!t)return;const s=window.innerWidth,i=e.clientWidth,o=this._overflows(this._util),h=this._overflows(this._tabsEl),n=s<this.BP_MD||o||h;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 m=getComputedStyle(this._searchWrap),_=Math.max(this._num(m.minWidth,this._tokenPx("--scb-header-search-min",320)),this._tokenPx("--scb-header-search-min",320)),g=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),w=this.showDrawer&&(s<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48):0;u=t.getBoundingClientRect().width+g+_+g+w+8>i+.5}this._setHideSearch(u);let b=!1;if(this.showDrawer&&(s<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const m=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),_=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48),g=(this._logoGroup?.getBoundingClientRect().width||0)+m+_;this._hideLogoText?b=!(i>=this._logoTextUnlockAt):g>i+.5&&(b=!0,this._logoTextUnlockAt=i+this._HYST)}else b=!1,this._logoTextUnlockAt=0;this._setHideLogoText(b)},this._onMenuClick=async e=>{e.preventDefault(),e.stopPropagation(),this.showDrawer&&(this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),await this._ensureDrawerMounted(),await r._nextFrame(),await r._nextFrame(),this._openDrawerNow())},this._onSearchClick=e=>{const t=this._searchEl;if(t?.submit&&typeof t.submit=="function"){t.submit();return}const s=t?.value??void 0;this.dispatchEvent(new CustomEvent("search-click",{detail:{value:s},bubbles:!0,composed:!0})),t?.focus?.()},this._onTabsChange=e=>{const s=e?.detail?.activeTabIndex??e.target?.activeTabIndex??0;this.activeTab=s;const o=(this._slotTabs.length?this._slotTabs:this.tabs)[s]?.href??"";this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:s,href:o},bubbles:!0,composed:!0}))}}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",r.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",r.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}get _slotEl(){return this.shadowRoot?.querySelector("slot#data-slot")??null}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _tabsEl(){return this.renderRoot.querySelector("scb-tabs")}get _logoGroup(){return 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}`)}_attachSlotObservers(){this._slotMo?.disconnect();const e=new MutationObserver(t=>{this._scheduleHarvest()});this._slotMo=e,e.observe(this,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["label","href","icon","target"]})}_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}firstUpdated(){this.updateComplete.then(()=>{this._harvest(),this._attachSlotObservers()});const e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener("resize",this._onWindowResize,{passive:!0});const t=this._menuBtn,s=()=>this._ensureDrawerMounted();t?.addEventListener("pointerenter",s,{once:!0}),t?.addEventListener("focusin",s,{once:!0}),t?.addEventListener("touchstart",s,{once:!0,passive:!0})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"480px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"320px"),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("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("activeTab")||e.has("_slotTabs")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("showSearch")||e.has("searchMax")||e.has("searchMin"))&&this.updateComplete.then(()=>{this._scheduleMeasure(),this._applyActiveToTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}async _ensureDrawerMounted(){this._drawerMounted||(this._drawerMounted=!0,await this.updateComplete)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0,e.setAttribute("open",""),e.show?.(),e.openDrawer?.(),this._drawerExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})))}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1),this._drawerExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0}))}_syncMenuBtnAria(){const e=this.renderRoot.querySelector(".menu-trigger");e&&e.setAttribute("aria-expanded",String(this._drawerExpanded))}_applyActiveToTabs(){const e=this._tabsEl;if(!e)return;e.activeTabIndex=this.activeTab,e.querySelectorAll("scb-secondary-tab").forEach((s,i)=>{s.selected=i===this.activeTab})}_renderDrawerNodes(e){return!e||e.length===0?c``:c`${e.map(t=>{const s=Array.isArray(t.children)&&t.children.length>0;return c`
|
|
2
2
|
<scb-drawer-item
|
|
3
3
|
label=${t.label}
|
|
4
4
|
?selected=${!1}
|
|
5
5
|
leading-icon=${t.icon??""}
|
|
6
6
|
item-href=${t.href??""}
|
|
7
7
|
>
|
|
8
|
-
${s?
|
|
8
|
+
${s?c`
|
|
9
9
|
<scb-sub-drawer label=${t.label}>
|
|
10
|
-
${t.children.map(
|
|
10
|
+
${t.children.map(i=>c`
|
|
11
11
|
<scb-drawer-item
|
|
12
|
-
label=${
|
|
13
|
-
item-href=${
|
|
14
|
-
leading-icon=${
|
|
12
|
+
label=${i.label}
|
|
13
|
+
item-href=${i.href??""}
|
|
14
|
+
leading-icon=${i.icon??""}
|
|
15
15
|
></scb-drawer-item>
|
|
16
16
|
`)}
|
|
17
17
|
</scb-sub-drawer>
|
|
18
|
-
`:
|
|
18
|
+
`:d}
|
|
19
19
|
</scb-drawer-item>
|
|
20
|
-
`})}`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}render(){const e=this._slotTabs.length?this._slotTabs:this.tabs,t=this._slotUtils.length?this._slotUtils:this.utilityItems,s=this._slotMenu.length?this._slotMenu:this.menuData??[];
|
|
21
|
-
<!-- Slot för wrapper-barn (osynliga; fungerar som datakällor) -->
|
|
20
|
+
`})}`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}render(){const e=this._slotTabs.length?this._slotTabs:this.tabs,t=this._slotUtils.length?this._slotUtils:this.utilityItems,s=this._slotMenu.length?this._slotMenu:this.menuData??[];this._syncFlags(t.length===0,!this.showSearch);const i=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:d;return c`
|
|
22
21
|
<slot id="data-slot" @slotchange=${()=>{this._harvest(),this._attachSlotObservers()}} hidden></slot>
|
|
23
22
|
|
|
24
|
-
<!-- Banner-landmark är opt-in och omsluter hela headerblocket -->
|
|
25
23
|
<div
|
|
26
24
|
class="header-landmark"
|
|
27
|
-
role=${this.banner?"banner":
|
|
28
|
-
aria-label=${this.banner&&this.bannerLabel?this.bannerLabel:
|
|
25
|
+
role=${this.banner?"banner":d}
|
|
26
|
+
aria-label=${this.banner&&this.bannerLabel?this.bannerLabel:d}
|
|
29
27
|
>
|
|
30
|
-
<scb-grid cols-compact="4" cols-medium="8" cols-expanded="12"
|
|
28
|
+
<scb-grid cols-compact="4" cols-medium="8" cols-expanded="12" max-width=${this.maxWidth} gap="0">
|
|
31
29
|
<scb-grid-item col-span-compact="4" col-span-medium="8" col-span-expanded="12">
|
|
32
30
|
<div class="top-row">
|
|
33
31
|
<a class="logo-group" href=${this.logoHref} aria-label="Gå till startsidan">
|
|
@@ -36,14 +34,15 @@ import{b as f,n as l,r as h,i as x,x as d,E as p,t as S}from"../../vendor/vendor
|
|
|
36
34
|
|
|
37
35
|
<div class="actions">
|
|
38
36
|
<nav class="utility" aria-label="Funktionslänkar">
|
|
39
|
-
${t.map(
|
|
37
|
+
${t.map(o=>c`<scb-link .href=${o.href} .target=${o.target??void 0}>${o.label}</scb-link>`)}
|
|
40
38
|
</nav>
|
|
41
39
|
|
|
42
|
-
${this.showSearch?
|
|
43
|
-
<div class="search">
|
|
40
|
+
${this.showSearch?c`
|
|
41
|
+
<div class="search" style=${i}>
|
|
44
42
|
<scb-search
|
|
45
43
|
id=${this._searchId}
|
|
46
44
|
size="compact"
|
|
45
|
+
style=${i}
|
|
47
46
|
.supportingText=${this.searchPlaceholder??""}
|
|
48
47
|
></scb-search>
|
|
49
48
|
<scb-button
|
|
@@ -52,30 +51,30 @@ import{b as f,n as l,r as h,i as x,x as d,E as p,t as S}from"../../vendor/vendor
|
|
|
52
51
|
@click=${this._onSearchClick}
|
|
53
52
|
></scb-button>
|
|
54
53
|
</div>
|
|
55
|
-
`:
|
|
54
|
+
`:d}
|
|
56
55
|
</div>
|
|
57
56
|
|
|
58
|
-
${this.showDrawer?
|
|
57
|
+
${this.showDrawer?c`
|
|
59
58
|
<scb-icon-button
|
|
60
59
|
class="menu-trigger"
|
|
61
60
|
aria-label="Meny"
|
|
62
61
|
icon="menu"
|
|
63
62
|
variant="outlined"
|
|
64
|
-
aria-controls=${this._drawerMounted?this._drawerId:
|
|
63
|
+
aria-controls=${this._drawerMounted?this._drawerId:d}
|
|
65
64
|
aria-haspopup="dialog"
|
|
66
65
|
aria-expanded=${String(this._drawerExpanded)}
|
|
67
66
|
data-drawer-toggle=${this._drawerId}
|
|
68
67
|
title="Öppna meny"
|
|
69
68
|
@click=${this._onMenuClick}
|
|
70
69
|
></scb-icon-button>
|
|
71
|
-
`:
|
|
70
|
+
`:d}
|
|
72
71
|
</div>
|
|
73
72
|
</scb-grid-item>
|
|
74
73
|
|
|
75
74
|
<scb-grid-item col-span-compact="4" col-span-medium="8" col-span-expanded="12">
|
|
76
75
|
<div class="tabs-inset">
|
|
77
76
|
<scb-tabs aria-label="Huvudnavigering" .activeTabIndex=${this.activeTab} @change=${this._onTabsChange}>
|
|
78
|
-
${e.map((
|
|
77
|
+
${e.map((o,h)=>c`<scb-secondary-tab ?selected=${h===this.activeTab}>${o.label}</scb-secondary-tab>`)}
|
|
79
78
|
</scb-tabs>
|
|
80
79
|
</div>
|
|
81
80
|
<div class="divider" role="presentation"></div>
|
|
@@ -83,7 +82,7 @@ import{b as f,n as l,r as h,i as x,x as d,E as p,t as S}from"../../vendor/vendor
|
|
|
83
82
|
</scb-grid>
|
|
84
83
|
</div>
|
|
85
84
|
|
|
86
|
-
${this.showDrawer&&this._drawerMounted?
|
|
85
|
+
${this.showDrawer&&this._drawerMounted?c`
|
|
87
86
|
<scb-drawer
|
|
88
87
|
id=${this._drawerId}
|
|
89
88
|
.label=${this.drawerLabel??""}
|
|
@@ -95,17 +94,17 @@ import{b as f,n as l,r as h,i as x,x as d,E as p,t as S}from"../../vendor/vendor
|
|
|
95
94
|
<scb-search size="compact" .supportingText=${this.drawerSearchPlaceholder??""}></scb-search>
|
|
96
95
|
</div>
|
|
97
96
|
|
|
98
|
-
${this.drawerSectionLabel?
|
|
97
|
+
${this.drawerSectionLabel?c`<scb-drawer-section .label=${this.drawerSectionLabel}></scb-drawer-section>`:d}
|
|
99
98
|
|
|
100
99
|
${this._renderDrawerNodes(s)}
|
|
101
100
|
|
|
102
|
-
${this.includeUtilityInDrawer&&(t?.length??0)>0?
|
|
101
|
+
${this.includeUtilityInDrawer&&(t?.length??0)>0?c`
|
|
103
102
|
<scb-drawer-section label=''></scb-drawer-section>
|
|
104
|
-
${t.map(
|
|
105
|
-
`:
|
|
103
|
+
${t.map(o=>c`<scb-drawer-item label=${o.label} item-href=${o.href}></scb-drawer-item>`)}
|
|
104
|
+
`:d}
|
|
106
105
|
</scb-drawer>
|
|
107
|
-
`:
|
|
108
|
-
`}_renderLogo(){return
|
|
106
|
+
`:d}
|
|
107
|
+
`}_renderLogo(){return c`
|
|
109
108
|
<svg class="logo" viewBox="0 0 48 54" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
110
109
|
<g clip-path="url(#clip0_scb_header)">
|
|
111
110
|
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"
|
|
@@ -120,12 +119,11 @@ import{b as f,n as l,r as h,i as x,x as d,E as p,t as S}from"../../vendor/vendor
|
|
|
120
119
|
`}};r._JSON_ARRAY={fromAttribute:e=>{if(e==null||e==="")return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}},toAttribute:e=>e==null?null:JSON.stringify(e)};r.BP_SM_DEFAULT=600;r.BP_MD_DEFAULT=840;r.styles=f`
|
|
121
120
|
:host {
|
|
122
121
|
display:block;
|
|
123
|
-
background:var(--md-sys-color-surface,#fff);
|
|
122
|
+
background:var(--md-sys-color-surface-container-lowest,#fff);
|
|
124
123
|
color:var(--md-sys-color-on-surface,#1b1b1f);
|
|
125
124
|
--scb-header-search-max: 380px;
|
|
126
125
|
--scb-header-search-min: 250px;
|
|
127
126
|
|
|
128
|
-
/* Overridebara logo-mått (knutna till tokens) */
|
|
129
127
|
--scb-header-logo-w: var(--icon-size-large, 40px);
|
|
130
128
|
--scb-header-logo-h: calc(var(--scb-header-logo-w) * 1.125);
|
|
131
129
|
}
|
|
@@ -148,7 +146,6 @@ import{b as f,n as l,r as h,i as x,x as d,E as p,t as S}from"../../vendor/vendor
|
|
|
148
146
|
|
|
149
147
|
.utility{ display:none; flex-wrap:nowrap; align-items:center; gap:var(--spacing-5,16px); min-width:0; }
|
|
150
148
|
.utility scb-link::part(anchor){
|
|
151
|
-
/* typografi och färg helt via tokens */
|
|
152
149
|
font-family: var(--md-sys-typescale-body-medium-font, var(--brand-font)), sans-serif;
|
|
153
150
|
font-size: var(--md-sys-typescale-body-medium-size);
|
|
154
151
|
line-height: var(--md-sys-typescale-body-medium-line-height);
|
|
@@ -220,21 +217,28 @@ import{b as f,n as l,r as h,i as x,x as d,E as p,t as S}from"../../vendor/vendor
|
|
|
220
217
|
--md-secondary-tab-active-state-layer-color: transparent;
|
|
221
218
|
}
|
|
222
219
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
220
|
+
.tabs-inset scb-tabs {
|
|
221
|
+
--md-secondary-tab-label-text-font: var(--md-sys-typescale-title-small-font, var(--brand-font, Inter));
|
|
222
|
+
--md-secondary-tab-label-text-size: var(--md-sys-typescale-title-small-size, 1rem);
|
|
223
|
+
--md-secondary-tab-label-text-line-height: var(--md-sys-typescale-title-small-line-height, 1.5rem);
|
|
224
|
+
--md-secondary-tab-label-text-weight: var(--md-sys-typescale-title-small-weight, 500);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@media (prefers-color-scheme: dark) {
|
|
228
|
+
.tabs-inset scb-tabs {
|
|
229
|
+
--nv-20: transparent;
|
|
230
|
+
--md-primary-tab-container-color: transparent;
|
|
231
|
+
--md-secondary-tab-container-color: transparent;
|
|
232
|
+
background-color: transparent !important;
|
|
233
|
+
}
|
|
234
|
+
.tabs-inset scb-tabs::part(container),
|
|
235
|
+
.tabs-inset scb-tabs::part(base),
|
|
236
|
+
.tabs-inset scb-tabs::part(tabbar) {
|
|
237
|
+
background: transparent !important;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
:host([data-hide-logo-text]) .logo-text {
|
|
242
|
+
display: none;
|
|
243
|
+
}
|
|
244
|
+
`;r._nextFrame=()=>new Promise(e=>requestAnimationFrame(()=>e()));a([l({type:String,attribute:"max-width"})],r.prototype,"maxWidth",2);a([l({type:String,attribute:"logo-text"})],r.prototype,"logoText",2);a([l({type:String,attribute:"logo-href"})],r.prototype,"logoHref",2);a([l({type:Boolean,reflect:!0})],r.prototype,"banner",2);a([l({type:String,attribute:"banner-label"})],r.prototype,"bannerLabel",2);a([l({attribute:"tabs",converter:r._JSON_ARRAY})],r.prototype,"tabs",2);a([l({type:Number,attribute:"active-tab"})],r.prototype,"activeTab",2);a([l({attribute:"utility-items",converter:r._JSON_ARRAY})],r.prototype,"utilityItems",2);a([l({type:String,attribute:"search-placeholder"})],r.prototype,"searchPlaceholder",2);a([l({type:String,attribute:"drawer-label"})],r.prototype,"drawerLabel",2);a([l({type:String,attribute:"drawer-sub-label"})],r.prototype,"drawerSubLabel",2);a([l({type:String,attribute:"drawer-section-label"})],r.prototype,"drawerSectionLabel",2);a([l({type:String,attribute:"drawer-search-placeholder"})],r.prototype,"drawerSearchPlaceholder",2);a([l({attribute:"menu-data",converter:r._JSON_ARRAY})],r.prototype,"menuData",2);a([l({attribute:"show-drawer",reflect:!0,converter:y})],r.prototype,"showDrawer",2);a([l({attribute:"show-search",reflect:!0,converter:y})],r.prototype,"showSearch",2);a([l({attribute:"include-utility-in-drawer",reflect:!0,converter:y})],r.prototype,"includeUtilityInDrawer",2);a([l({type:String,attribute:"search-max"})],r.prototype,"searchMax",2);a([l({type:String,attribute:"search-min"})],r.prototype,"searchMin",2);a([l({type:String,attribute:"search-height"})],r.prototype,"searchHeight",2);a([p()],r.prototype,"_drawerId",2);a([p()],r.prototype,"_drawerMounted",2);a([p()],r.prototype,"_drawerExpanded",2);a([p()],r.prototype,"_searchId",2);a([p()],r.prototype,"_slotTabs",2);a([p()],r.prototype,"_slotUtils",2);a([p()],r.prototype,"_slotMenu",2);a([p()],r.prototype,"_collapsed",2);a([p()],r.prototype,"_hideLogoText",2);r=a([S("scb-header")],r);
|
|
@@ -1,95 +1,60 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/vendor-material.js","../../vendor/vendor.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as
|
|
2
|
+
import{_ as c}from"../../vendor/preload-helper.js";import{a as p,n as u,i as m,x as l,t as f}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-tooltip/scb-tooltip.js";import"../scb-button/scb-button.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(i,r,s){try{customElements.get(i)||e(i,r,s)}catch(a){var o=String(a||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var g=Object.defineProperty,v=Object.getOwnPropertyDescriptor,d=(t,e,i,r)=>{for(var s=r>1?void 0:r?v(e,i):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(s=(r?a(e,i,s):a(s))||s);return r&&s&&g(e,i,s),s};let n=class extends m{constructor(){super(...arguments),this.ariaLabel="",this.tooltip="",this.variant="standard",this.icon="home",this.toggle=!1,this.selected=!1,this.toggleofficon="add",this.toggleonicon="remove",this.disabled=!1,this.__loadedVariants=new Set,this.__iconLoaded=!1,this.__onInnerChange=()=>{const e=!!this.__getMdHost()?.selected;this.toggle&&(this.selected=e),this.dispatchEvent(new CustomEvent("change",{detail:{selected:e},bubbles:!0,composed:!0}))}}async firstUpdated(){await this.__ensureDepsLoaded(),await this.updateComplete,this.__attachChangeListener(),this.__syncAria()}updated(t){super.updated(t),t.has("variant")||t.has("toggle")||t.has("icon")||t.has("ariaLabel")||t.has("selected")||t.has("disabled")||t.has("tooltip")?this.__ensureDepsLoaded().then(()=>queueMicrotask(()=>{this.__attachChangeListener(),this.__syncAria()})):queueMicrotask(()=>this.__attachChangeListener())}disconnectedCallback(){super.disconnectedCallback(),this.__lastBtn?.removeEventListener?.("change",this.__onInnerChange),this.__lastBtn=null,this.__ariaObserver?.disconnect()}async __ensureDepsLoaded(){if(!this.__loadedVariants.has(this.variant)){switch(this.variant){case"filled":await c(()=>import("../../vendor/vendor-material.js").then(t=>t.d),__vite__mapDeps([0,1]),import.meta.url);break;case"outlined":await c(()=>import("../../vendor/vendor-material.js").then(t=>t.e),__vite__mapDeps([0,1]),import.meta.url);break;case"filled-tonal":await c(()=>import("../../vendor/vendor-material.js").then(t=>t.g),__vite__mapDeps([0,1]),import.meta.url);break;default:await c(()=>import("../../vendor/vendor-material.js").then(t=>t.h),__vite__mapDeps([0,1]),import.meta.url);break}this.__loadedVariants.add(this.variant)}this.__iconLoaded||(await c(()=>import("../../vendor/vendor-material.js").then(t=>t.i),__vite__mapDeps([0,1]),import.meta.url),this.__iconLoaded=!0)}__getMdHost(){const t=this.renderRoot.querySelector("md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button");if(t)return t;const e=this.renderRoot.querySelector("scb-tooltip");if(e){const i=e.querySelector("md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button");if(i)return i}return null}__getInnerButton(t){const e=t?.shadowRoot;return e?e.querySelector("button")||e.querySelector('[role="button"]'):null}__stripNativeTitles(t){if(!t)return;t.removeAttribute("title"),this.__getInnerButton(t)?.removeAttribute("title");const i=t.shadowRoot;i&&i.querySelectorAll("[title]").forEach(r=>r.removeAttribute("title"))}__syncAria(){const t=this.__getMdHost();if(!t)return;const e=this.__getInnerButton(t),i=(this.ariaLabel||this.getAttribute("aria-label")||"").trim()||this.icon.trim(),r=this.getAttribute("aria-controls"),s=this.getAttribute("aria-expanded");e&&(i?e.setAttribute("aria-label",i):e.removeAttribute("aria-label"),r!==null?e.setAttribute("aria-controls",r):e.removeAttribute("aria-controls"),s!==null?e.setAttribute("aria-expanded",s):e.removeAttribute("aria-expanded"),e.removeAttribute("title")),t.removeAttribute("aria-label"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-expanded"),t.removeAttribute("title"),this.hasAttribute("aria-label")&&this.removeAttribute("aria-label"),this.hasAttribute("aria-controls")&&this.removeAttribute("aria-controls"),this.hasAttribute("aria-expanded")&&this.removeAttribute("aria-expanded"),this.__stripNativeTitles(t),this.__ariaObserver?.disconnect(),this.__ariaObserver=new MutationObserver(()=>{const o=this.__getMdHost(),a=this.__getInnerButton(o);if(!o||!a)return;const b=(this.ariaLabel||this.getAttribute("aria-label")||"").trim()||this.icon.trim(),h=this.getAttribute("aria-controls"),_=this.getAttribute("aria-expanded");b?a.setAttribute("aria-label",b):a.removeAttribute("aria-label"),h!==null?a.setAttribute("aria-controls",h):a.removeAttribute("aria-controls"),_!==null?a.setAttribute("aria-expanded",_):a.removeAttribute("aria-expanded"),this.__stripNativeTitles(o),o.removeAttribute("aria-label"),o.removeAttribute("aria-controls"),o.removeAttribute("aria-expanded"),o.removeAttribute("title"),this.hasAttribute("aria-label")&&this.removeAttribute("aria-label"),this.hasAttribute("aria-controls")&&this.removeAttribute("aria-controls"),this.hasAttribute("aria-expanded")&&this.removeAttribute("aria-expanded")}),this.__ariaObserver.observe(this,{attributes:!0,attributeFilter:["aria-label","aria-controls","aria-expanded"]})}__attachChangeListener(){const t=this.__getMdHost();t&&t!==this.__lastBtn&&(this.__lastBtn?.removeEventListener?.("change",this.__onInnerChange),t.addEventListener("change",this.__onInnerChange),this.__lastBtn=t),this.toggle&&t&&"selected"in t&&(t.selected=this.selected),this.__stripNativeTitles(t||null)}__renderMd(t=!1){const e=!!t,i=l`
|
|
3
3
|
<md-icon aria-hidden="true">${this.toggleofficon}</md-icon>
|
|
4
4
|
<md-icon slot="selected" aria-hidden="true">${this.toggleonicon}</md-icon>
|
|
5
|
-
`,
|
|
5
|
+
`,r=l`<md-icon aria-hidden="true">${this.icon}</md-icon>`;if(this.toggle)switch(this.variant){case"filled":return l`
|
|
6
6
|
<md-filled-icon-button
|
|
7
|
+
?scb-tooltip-button=${e}
|
|
7
8
|
toggle
|
|
8
|
-
|
|
9
|
+
?selected=${this.selected}
|
|
9
10
|
?disabled=${this.disabled}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
>${r}</md-filled-icon-button>
|
|
13
|
-
`;case"outlined":return a`
|
|
11
|
+
>${i}</md-filled-icon-button>
|
|
12
|
+
`;case"outlined":return l`
|
|
14
13
|
<md-outlined-icon-button
|
|
14
|
+
?scb-tooltip-button=${e}
|
|
15
15
|
toggle
|
|
16
|
-
|
|
16
|
+
?selected=${this.selected}
|
|
17
17
|
?disabled=${this.disabled}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
>${r}</md-outlined-icon-button>
|
|
21
|
-
`;case"filled-tonal":return a`
|
|
18
|
+
>${i}</md-outlined-icon-button>
|
|
19
|
+
`;case"filled-tonal":return l`
|
|
22
20
|
<md-filled-tonal-icon-button
|
|
21
|
+
?scb-tooltip-button=${e}
|
|
23
22
|
toggle
|
|
24
|
-
|
|
23
|
+
?selected=${this.selected}
|
|
25
24
|
?disabled=${this.disabled}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
>${r}</md-filled-tonal-icon-button>
|
|
29
|
-
`;default:return a`
|
|
25
|
+
>${i}</md-filled-tonal-icon-button>
|
|
26
|
+
`;default:return l`
|
|
30
27
|
<md-icon-button
|
|
31
|
-
|
|
28
|
+
?scb-tooltip-button=${e}
|
|
32
29
|
toggle
|
|
33
|
-
|
|
30
|
+
?selected=${this.selected}
|
|
34
31
|
?disabled=${this.disabled}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
`;case"
|
|
45
|
-
<md-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
:host([error]) md-filled-icon-button[variant='error'],
|
|
65
|
-
:host([error]) md-outlined-icon-button[variant='error'],
|
|
66
|
-
:host([error]) md-filled-tonal-icon-button[variant='error'],
|
|
67
|
-
:host([error]) md-icon-button[variant='error'] {
|
|
68
|
-
--md-sys-color-primary: var(--md-sys-color-error);
|
|
69
|
-
--md-sys-color-on-primary: var(--md-sys-color-on-error);
|
|
70
|
-
}
|
|
71
|
-
:host([error]) md-outlined-icon-button[variant='error'] md-icon,
|
|
72
|
-
:host([error]) md-icon-button[variant='error'] md-icon {
|
|
73
|
-
color: var(--md-sys-color-error) !important;
|
|
74
|
-
}
|
|
75
|
-
:host([error]) md-outlined-icon-button[variant='error'] {
|
|
76
|
-
--_outline-color: var(--md-sys-color-error);
|
|
77
|
-
--md-outlined-icon-button-pressed-outline-color: var(--md-sys-color-error);
|
|
78
|
-
}
|
|
79
|
-
:host([error]) md-outlined-icon-button[variant='error']:hover {
|
|
80
|
-
--md-outlined-icon-button-outline-width: 2px;
|
|
81
|
-
}
|
|
82
|
-
:host([error]) md-filled-tonal-icon-button[variant='error'] {
|
|
83
|
-
--md-filled-tonal-icon-button-container-color: var(--md-sys-color-error-container);
|
|
84
|
-
--md-filled-tonal-icon-button-label-text-color: var(--md-sys-color-on-error-container);
|
|
85
|
-
--md-filled-tonal-icon-button-hover-label-text-color: var(--md-sys-color-on-error-container);
|
|
86
|
-
--md-filled-tonal-icon-button-pressed-label-text-color: var(--md-sys-color-on-error-container);
|
|
87
|
-
--md-filled-tonal-icon-button-focus-label-text-color: var(--md-sys-color-on-error-container);
|
|
88
|
-
--md-filled-tonal-icon-button-icon-color: var(--md-sys-color-on-error-container);
|
|
89
|
-
--md-filled-tonal-icon-button-hover-icon-color: var(--md-sys-color-on-error-container);
|
|
90
|
-
--md-filled-tonal-icon-button-pressed-icon-color: var(--md-sys-color-on-error-container);
|
|
91
|
-
--md-filled-tonal-icon-button-focus-icon-color: var(--md-sys-color-on-error-container);
|
|
92
|
-
--md-filled-tonal-icon-button-hover-state-layer-color: var(--md-sys-color-on-error-container);
|
|
93
|
-
--md-filled-tonal-icon-button-pressed-state-layer-color: var(--md-sys-color-on-error-container);
|
|
94
|
-
}
|
|
95
|
-
`;l([s({type:String,reflect:!0,attribute:"aria-label"})],n.prototype,"ariaLabel",2);l([s({type:String})],n.prototype,"variant",2);l([s({type:String})],n.prototype,"icon",2);l([s({type:Boolean,reflect:!0})],n.prototype,"toggle",2);l([s({type:String})],n.prototype,"toggleofficon",2);l([s({type:String})],n.prototype,"toggleonicon",2);l([s({type:Boolean,reflect:!0})],n.prototype,"disabled",2);l([s({type:Boolean,reflect:!0})],n.prototype,"error",2);n=l([m("scb-icon-button")],n);export{n as ScbIconButton};
|
|
32
|
+
>${i}</md-icon-button>
|
|
33
|
+
`}switch(this.variant){case"filled":return l`
|
|
34
|
+
<md-filled-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
|
|
35
|
+
${r}
|
|
36
|
+
</md-filled-icon-button>
|
|
37
|
+
`;case"outlined":return l`
|
|
38
|
+
<md-outlined-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
|
|
39
|
+
${r}
|
|
40
|
+
</md-outlined-icon-button>
|
|
41
|
+
`;case"filled-tonal":return l`
|
|
42
|
+
<md-filled-tonal-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
|
|
43
|
+
${r}
|
|
44
|
+
</md-filled-tonal-icon-button>
|
|
45
|
+
`;default:return l`
|
|
46
|
+
<md-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
|
|
47
|
+
${r}
|
|
48
|
+
</md-icon-button>
|
|
49
|
+
`}}render(){const t=(this.tooltip||this.ariaLabel||"").trim();return t?l`
|
|
50
|
+
<scb-tooltip
|
|
51
|
+
variant="plain"
|
|
52
|
+
position="top"
|
|
53
|
+
trigger="hover"
|
|
54
|
+
.delay=${.12}
|
|
55
|
+
.arrow=${!0}
|
|
56
|
+
supporting-text=${t}
|
|
57
|
+
>
|
|
58
|
+
${this.__renderMd(!0)}
|
|
59
|
+
</scb-tooltip>
|
|
60
|
+
`:this.__renderMd(!1)}};n.styles=p``;d([u({type:String,attribute:"aria-label"})],n.prototype,"ariaLabel",2);d([u({type:String})],n.prototype,"tooltip",2);d([u({type:String})],n.prototype,"variant",2);d([u({type:String})],n.prototype,"icon",2);d([u({type:Boolean,reflect:!0})],n.prototype,"toggle",2);d([u({type:Boolean,reflect:!0})],n.prototype,"selected",2);d([u({type:String})],n.prototype,"toggleofficon",2);d([u({type:String})],n.prototype,"toggleonicon",2);d([u({type:Boolean,reflect:!0})],n.prototype,"disabled",2);n=d([f("scb-icon-button")],n);export{n as ScbIconButton};
|